@webority/chat-elements 0.153.0 → 0.154.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
- (function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function r(e){let t=new Uint8Array(e),n=(e,n)=>String.fromCharCode(...t.slice(e,n));return n(0,4)===`OggS`?`audio/ogg`:t[0]===26&&t[1]===69&&t[2]===223&&t[3]===163?`audio/webm`:n(4,8)===`ftyp`?`audio/mp4`:n(0,4)===`RIFF`?`audio/wav`:n(0,3)===`ID3`||t[0]===255&&((t[1]??0)&224)==224?`audio/mpeg`:`application/octet-stream`}var i=e=>typeof e==`object`&&!!e&&!Array.isArray(e),a=e=>i(e)?e:{},o=class extends Error{path;constructor(e,t){super(`Expected ${t} at ${e}.`),this.name=`ChatDecodeError`,this.path=e}},s=(e,t)=>{if(!i(e))throw new o(t,`an object`);return e},c=(e,t,n,r)=>n(e[t],`${r}.${t}`),l=(e,t)=>{if(typeof e!=`string`)throw new o(t,`a string`);return e},u=(e,t)=>{if(typeof e!=`number`||Number.isNaN(e))throw new o(t,`a number`);return e},d=(e,t)=>{if(typeof e!=`boolean`)throw new o(t,`true or false`);return e},f=(e,t)=>{if(!(e instanceof ArrayBuffer))throw new o(t,`binary data`);return e},p=e=>(t,n)=>t==null?null:e(t,n),m=e=>(t,n)=>{if(!Array.isArray(t))throw new o(n,`a list`);return t.map((t,r)=>e(t,`${n}[${r}]`))},h=()=>e=>e,g=e=>(t,n)=>{let r=e.find(e=>e===t);if(r===void 0)throw new o(n,`one of ${e.join(`, `)}`);return r},_=(e,t,n)=>(r,i)=>{let a=c(s(r,i),`kind`,l,i);if(!(t=>e.some(e=>e===t))(a)){if(n)return n(a,i);throw new o(`${i}.kind`,`one of ${e.join(`, `)}`)}return t[a](r,i)},v=h()([`Pending`,`Confirmed`,`Rejected`,`Expired`,`Done`,`Failed`,`Repeat`]),y=h()([`Visitor`,`Customer`,`Assistant`,`Agent`,`Script`,`System`]),b=h()([`Off`,`FirstMessage`,`EveryInput`]),x=h()([`Bar`,`Line`,`Donut`]),S=h()([`Text`,`Integer`,`Decimal`,`MoneyMinor`,`Percent`,`Date`,`DateTimeUtc`]),C=h()([`Open`,`WaitingForAgent`,`WithAgent`,`Closed`]),w=h()([`Email`,`Phone`,`Name`,`Company`,`Text`,`LongText`,`Choice`,`MultiChoice`,`TimeSlot`,`File`,`Consent`]),T=h()([`None`,`Otp`]),E=h()([`Neutral`,`Positive`,`Caution`,`Negative`]),D=h()([`Requested`,`Waiting`,`Joined`,`Left`,`Ended`]),O=h()([`Open`,`Answered`,`Skipped`,`Expired`]),k=h()([`NeedsNewerApp`,`ActionLimitReached`,`ConversationContinued`,`AssistantUnavailable`,`OutOfTopic`,`ConversationTooLong`,`LeadAlreadyCaptured`]),A=h()([`Text`,`Sources`,`QuickReplies`,`InputRequest`,`Action`,`Notice`,`Table`,`Chart`,`Figures`,`RecordCard`,`Image`,`File`,`Ticket`,`Handoff`,`VoiceClip`]),j=h()([`Send`,`Open`,`Navigate`]),ee=h()([`Inline`,`Composer`]),te=h()([`Default`,`Primary`,`Cta`]),ne=h()([`Up`,`Down`]),re=h()([`messageStarted`,`partStarted`,`partDelta`,`partCompleted`,`messageReset`,`step`,`messageCompleted`,`conversationUpdated`,`typing`,`error`]),ie={Open:`Open`,InProgress:`In progress`,WaitingOnCustomer:`Waiting on you`,Resolved:`Resolved`,Closed:`Closed`,Cancelled:`Cancelled`},ae={Positive:`Good`,Caution:`Watch`,Negative:`Poor`,Neutral:``},M=Object.freeze({launcher:`Open chat`,launcherClose:`Close chat`,panelTitle:`Assistant`,headerStatus:`Usually replies instantly`,newChat:`New chat`,close:`Close`,history:`Past chats`,historyEmptyTitle:`No past chats`,historyEmptyText:`Your conversations show here.`,untitled:`Untitled chat`,rename:`Rename chat`,renameSave:`Save`,conversationTitle:`Chat name`,renameFailed:`We could not rename this chat. Please try again.`,deleteChat:`Delete chat`,deleteConfirmTitle:`Delete this chat?`,deleteConfirmMessage:`The conversation is removed for good.`,deleteConfirm:`Delete`,deleteFailed:`We could not delete this chat. Please try again.`,cancel:`Cancel`,loadMore:`Show more`,loadFailed:`We could not load your chats. Please try again.`,backToChat:`Back to the chat`,thread:`Conversation`,you:`You`,assistant:`Assistant`,agent:`Team`,thinking:`Working on it`,loadingConversation:`Loading the conversation`,emptyTitle:`How can I help?`,starters:`Suggested questions`,resumeLast:`Continue your last chat`,nudgeDismiss:`Dismiss suggestion`,composer:`Your message`,placeholder:`Ask anything`,send:`Send`,stop:`Stop`,composerHint:`Press Enter to send, Shift and Enter for a new line.`,counter:(e,t)=>`${e.toLocaleString(`en-GB`)} of ${t.toLocaleString(`en-GB`)}`,allowance:e=>e===0?`You have no messages left today.`:e===1?`You have 1 message left today.`:`You have ${e} messages left today.`,attach:`Attach a file`,attachHint:`Pictures or PDFs.`,removeAttachment:e=>`Remove ${e}`,attachmentUploading:`Uploading`,attachmentFailed:`That file did not upload. Please try again.`,attachmentLimit:e=>`You can attach up to ${e} files.`,editing:`Editing your message`,footerPrivacyFallback:`Privacy policy`,captchaNoticeBefore:`This site is protected by reCAPTCHA and the Google `,captchaPrivacyPolicy:`Privacy Policy`,captchaNoticeAnd:` and `,captchaTerms:`Terms of Service`,captchaNoticeAfter:` apply.`,captchaUnavailable:`We could not check this message. Please try again in a moment.`,newMessages:`New messages`,disclaimer:`The assistant can make mistakes, so check important details.`,copy:`Copy`,copied:`Copied`,share:`Share`,print:`Print`,retry:`Try again`,stopped:`Stopped.`,regenerate:`New answer`,edit:`Edit`,rateUp:`Helpful`,rateDown:`Not helpful`,rating:`Rate this answer`,rated:`Thanks for the feedback.`,ratingFailed:`Your rating did not save. Please try again.`,sources:`Sources`,openSource:e=>`Open ${e}`,quickReplies:`Suggested replies`,inputSubmitting:`Sending`,inputRequired:`This field is required.`,inputConsentRequired:`Please accept to continue.`,inputAnswered:`Details sent.`,inputExpired:`This form has expired.`,inputSkipped:`Skipped.`,inputOptional:`Optional`,inputChooseFile:`Choose a file`,inputSendCode:`Send code`,inputEnterCode:`Enter the code`,inputCodeSent:`We sent a code. Enter it below.`,inputCodeFailed:`The code could not be sent. Try again.`,inputRemoveFile:e=>`Remove ${e}`,actionConfirm:`Confirm`,actionDismiss:`Not now`,actionWorking:`Working on it`,actionConfirmed:`Confirmed.`,actionRejected:`Not sent.`,actionExpired:`This request expired and was not sent.`,actionDone:`Done.`,actionFailed:`We could not do this. Please try again.`,actionRepeat:e=>`Already done on ${e}. Nothing was sent again.`,fileOpen:e=>`Open ${e}`,needsNewerApp:`This message needs a newer version of the app.`,errorGeneric:`Something went wrong. Please try again.`,assistantOutdated:`The assistant needs an update before it can answer. Please try again later.`,typeAnswer:`or type your answer below`,skip:`Skip`,editSomething:`Edit something`,muteSounds:`Mute sounds`,unmuteSounds:`Unmute sounds`,preparingAnswer:e=>`${e} is preparing an answer`,explainTrigger:`Why?`,explainTriggerLabel:e=>`Why? Explain ${e}`,explainAskMore:`Ask more`,explainSlow:`Still working on this.`,explainOffline:`You are offline. Explanations need a connection.`,explainError:`This could not be explained just now. Try again.`,explainRetry:`Try again`,explainEmpty:`This could not be explained in words.`,explainCapacity:e=>`The limit for explanations has been reached. They come back at ${e}.`,explainCapacityNoDate:`You have reached today's limit. Try again later.`,explainNotCounted:`Explanations do not use your daily messages. A question you type does.`,openFullScreen:`Open full screen`,openSidePanel:`Open as side panel`,earlierChat:`Earlier chat`,justNow:`Just now`,today:`Today`,yesterday:`Yesterday`,dailyLimitRefresh:e=>`They refresh on ${e}.`,talkToPerson:`Talk to a person`,handoffRequested:`Connecting you to our team.`,handoffWaiting:`Waiting for the next available person.`,handoffQueued:e=>`You are number ${e} in line.`,handoffQueuedText:`We will bring you in as soon as someone is free.`,handoffJoined:e=>`${e} joined the chat.`,handoffJoinedText:e=>`The conversation so far has been shared with ${e}, so you will not need to repeat anything.`,handoffLeft:e=>`${e} left the chat.`,handoffLeftText:`Another member of the team may join, or you can start a new chat.`,handoffEnded:`This chat with our team has ended.`,handoffEndedText:`Thank you for talking to us. Start a new chat if you need anything else.`,handoffAgentFallback:`A member of our team`,handoffMoment:`One moment`,liveLost:`We lost the connection to support.`,agentTyping:e=>`${e} is typing`,agentSays:e=>`${e} says`,statusWaitingForAgent:`Waiting for a person`,statusWithAgent:e=>`${e} from our team`,openTickets:`Your open tickets`,ticketAria:e=>`Ticket ${e}`,ticketView:`View ticket`,ticketStatus:e=>ie[e]??``,table:`Table`,tableShowAll:e=>`Show all ${e} rows`,tableEmpty:`No rows to show.`,chart:`Chart`,chartEmpty:`No data to show.`,chartShowTable:`Show as table`,chartShowChart:`Show as chart`,chartLoadFailed:`This chart could not be drawn.`,chartLow:e=>`Low ${e}`,chartHigh:e=>`High ${e}`,figures:`Key figures`,figureStatus:e=>ae[e]??``,recordOpen:`Open`,recordOpenFor:e=>`Open ${e}`,imageLoading:`Loading image`,imageFailed:`This image could not be loaded.`,imageViewer:`Image viewer`,imageOpen:e=>`View image: ${e}`,dictate:`Dictate`,dictateStop:`Stop dictating`,dictateListening:`Listening`,dictateTranscribing:`Turning your voice into text`,dictationBlocked:`The microphone is blocked. Allow it in your settings to dictate.`,dictationNoMicrophone:`No microphone was found. Connect one and try again.`,dictationNotHeard:`Nothing was heard. Check your microphone and try again.`,dictationFailed:`Dictation stopped working. Try again.`,dictationUnavailable:`Dictation is not available here.`,dictateOpenSettings:`Open Settings`,readAloud:`Read aloud`,readAloudStop:`Stop reading`,readAloudFailed:`This could not be read aloud.`,voiceClip:`Voice message`,voiceClipPlay:`Play voice message`,voiceClipPause:`Pause voice message`,voiceClipFailed:`This voice message could not be played.`,voiceClipShowTranscript:`Show transcript`,voiceClipHideTranscript:`Hide transcript`,voiceClipTime:(e,t)=>`${e} of ${t}`,shareConversation:`Share this conversation`,printConversation:`Print this conversation`,shareFailed:`Could not share. Try again.`,printFailed:`Could not open the print view. Try again.`,printedOn:e=>`Printed on ${e}`}),oe=e=>e?{...M,...e}:M,se=(e,t)=>{if(e===null||typeof e==`string`||typeof e==`number`)return e;throw new o(t,`text, a number or null`)},ce=(e,t)=>{let n=s(e,t);return Object.fromEntries(Object.keys(n).map(e=>[e,l(n[e],`${t}.${e}`)]))},le=(e,t)=>{let n=s(e,t);return{marker:c(n,`marker`,u,t),title:c(n,`title`,l,t),reference:c(n,`reference`,l,t),url:c(n,`url`,p(l),t)}},ue=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),label:c(n,`label`,l,t)}},de=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),startDateTimeUtc:c(n,`startDateTimeUtc`,l,t),endDateTimeUtc:c(n,`endDateTimeUtc`,l,t)}},fe=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),label:c(n,`label`,l,t),action:c(n,`action`,g(j),t),target:c(n,`target`,p(l),t),navigateAfterMs:c(n,`navigateAfterMs`,p(u),t),icon:c(n,`icon`,p(l),t),variant:c(n,`variant`,p(g(te)),t)}},pe=(e,t)=>{let n=s(e,t);return{key:c(n,`key`,l,t),type:c(n,`type`,g(w),t),label:c(n,`label`,l,t),placeholder:c(n,`placeholder`,p(l),t),required:c(n,`required`,d,t),maxLength:c(n,`maxLength`,p(u),t),options:c(n,`options`,p(m(ue)),t),slots:c(n,`slots`,p(m(de)),t),consentText:c(n,`consentText`,p(l),t),verify:c(n,`verify`,g(T),t),accept:c(n,`accept`,p(m(l)),t),secret:c(n,`secret`,d,t),validator:c(n,`validator`,p(l),t)}},me=(e,t)=>{let n=s(e,t);return{key:c(n,`key`,l,t),label:c(n,`label`,l,t),type:c(n,`type`,g(S),t)}},he=(e,t)=>{let n=s(e,t);return{label:c(n,`label`,l,t),value:c(n,`value`,u,t)}},N=(e,t)=>{let n=s(e,t);return{name:c(n,`name`,l,t),points:c(n,`points`,m(he),t)}},ge=(e,t)=>{let n=s(e,t);return{label:c(n,`label`,l,t),value:c(n,`value`,u,t),unit:c(n,`unit`,p(l),t),status:c(n,`status`,g(E),t)}},_e=(e,t)=>{let n=s(e,t);return{label:c(n,`label`,l,t),value:c(n,`value`,l,t),type:c(n,`type`,g(S),t)}},ve=(e,t)=>{let n=s(e,t);return{route:c(n,`route`,l,t),params:c(n,`params`,ce,t)}},ye=(e,t)=>{let n=s(e,t);return{displayName:c(n,`displayName`,l,t),avatarUrl:c(n,`avatarUrl`,p(l),t)}},be=_(A,{Text:(e,t)=>({kind:`Text`,text:c(s(e,t),`text`,l,t)}),Sources:(e,t)=>({kind:`Sources`,sources:c(s(e,t),`sources`,m(le),t)}),QuickReplies:(e,t)=>{let n=s(e,t);return{kind:`QuickReplies`,replies:c(n,`replies`,m(fe),t),placement:c(n,`placement`,g(ee),t)}},InputRequest:(e,t)=>{let n=s(e,t);return{kind:`InputRequest`,requestId:c(n,`requestId`,l,t),title:c(n,`title`,p(l),t),fields:c(n,`fields`,m(pe),t),submitLabel:c(n,`submitLabel`,l,t),state:c(n,`state`,g(O),t),answeredSummary:c(n,`answeredSummary`,p(l),t),allowTyped:c(n,`allowTyped`,d,t),cancellable:c(n,`cancellable`,d,t)}},Action:(e,t)=>{let n=s(e,t);return{kind:`Action`,actionId:c(n,`actionId`,l,t),actionKind:c(n,`actionKind`,l,t),title:c(n,`title`,l,t),lines:c(n,`lines`,m(l),t),state:c(n,`state`,g(v),t),decidedDateTimeUtc:c(n,`decidedDateTimeUtc`,p(l),t),note:c(n,`note`,p(l),t),consentText:c(n,`consentText`,p(l),t),confirmLabel:c(n,`confirmLabel`,p(l),t),rejectLabel:c(n,`rejectLabel`,p(l),t),editFields:c(n,`editFields`,p(m(ue)),t)}},Notice:(e,t)=>{let n=s(e,t);return{kind:`Notice`,code:c(n,`code`,g(k),t),text:c(n,`text`,l,t)}},Table:(e,t)=>{let n=s(e,t);return{kind:`Table`,title:c(n,`title`,p(l),t),columns:c(n,`columns`,m(me),t),rows:c(n,`rows`,m(m(se)),t),currency:c(n,`currency`,p(l),t)}},Chart:(e,t)=>{let n=s(e,t);return{kind:`Chart`,title:c(n,`title`,p(l),t),chartType:c(n,`chartType`,g(x),t),unit:c(n,`unit`,p(l),t),series:c(n,`series`,m(N),t)}},Figures:(e,t)=>({kind:`Figures`,figures:c(s(e,t),`figures`,m(ge),t)}),RecordCard:(e,t)=>{let n=s(e,t);return{kind:`RecordCard`,recordType:c(n,`recordType`,l,t),recordId:c(n,`recordId`,l,t),title:c(n,`title`,l,t),subtitle:c(n,`subtitle`,p(l),t),fields:c(n,`fields`,m(_e),t),target:c(n,`target`,p(ve),t)}},Image:(e,t)=>{let n=s(e,t);return{kind:`Image`,attachmentId:c(n,`attachmentId`,l,t),alt:c(n,`alt`,l,t),width:c(n,`width`,p(u),t),height:c(n,`height`,p(u),t)}},File:(e,t)=>{let n=s(e,t);return{kind:`File`,attachmentId:c(n,`attachmentId`,l,t),fileName:c(n,`fileName`,l,t),contentType:c(n,`contentType`,l,t),length:c(n,`length`,u,t)}},Ticket:(e,t)=>{let n=s(e,t);return{kind:`Ticket`,ticketId:c(n,`ticketId`,l,t),number:c(n,`number`,l,t),subject:c(n,`subject`,l,t),status:c(n,`status`,l,t)}},Handoff:(e,t)=>{let n=s(e,t);return{kind:`Handoff`,state:c(n,`state`,g(D),t),queuePosition:c(n,`queuePosition`,p(u),t),agent:c(n,`agent`,p(ye),t)}},VoiceClip:(e,t)=>{let n=s(e,t);return{kind:`VoiceClip`,attachmentId:c(n,`attachmentId`,l,t),durationMs:c(n,`durationMs`,u,t),transcript:c(n,`transcript`,p(l),t)}}},()=>({kind:`Notice`,code:`NeedsNewerApp`,text:M.needsNewerApp})),xe=g(y),Se=g(ne),Ce=g(C),we=(e,t)=>{let n=s(e,t);return{kind:c(n,`kind`,xe,t),displayName:c(n,`displayName`,p(l),t),avatarUrl:c(n,`avatarUrl`,p(l),t)}},Te=(e,t)=>{let n=s(e,t);return{publicId:c(n,`publicId`,l,t),conversationId:c(n,`conversationId`,l,t),sequence:c(n,`sequence`,u,t),author:c(n,`author`,we,t),createdDateTimeUtc:c(n,`createdDateTimeUtc`,l,t),parts:c(n,`parts`,m(be),t),rating:c(n,`rating`,p(Se),t),ratingNote:c(n,`ratingNote`,p(l),t)}},Ee=(e,t)=>{let n=s(e,t);return{publicId:c(n,`publicId`,l,t),title:c(n,`title`,l,t),state:c(n,`state`,Ce,t),continuesConversationId:c(n,`continuesConversationId`,p(l),t),messages:c(n,`messages`,m(Te),t),hasEarlier:c(n,`hasEarlier`,d,t)}},De=(e,t)=>{let n=s(e,t);return{publicId:c(n,`publicId`,l,t),title:c(n,`title`,l,t),state:c(n,`state`,Ce,t),createdDateTimeUtc:c(n,`createdDateTimeUtc`,l,t),lastActivityDateTimeUtc:c(n,`lastActivityDateTimeUtc`,l,t)}},Oe=(e,t)=>{let n=s(e,t);return{items:c(n,`items`,m(De),t),page:c(n,`page`,u,t),pageSize:c(n,`pageSize`,u,t),totalCount:c(n,`totalCount`,u,t),totalPages:c(n,`totalPages`,u,t),totalCountCapped:c(n,`totalCountCapped`,d,t)}};Object.freeze(h()(`VisitorChat.Starters.Nudges.ResumeLast.OpenTickets.History.Rename.Delete.SuggestedReplies.Stop.Retry.Edit.Regenerate.Sources.Rating.Copy.Share.Print.Attachments.RichAnswers.InputRequests.LeadCapture.Booking.Scripts.AiAnswers.HumanHandoff.Dictation.ReadAloud.VoiceClips.Sounds.AutoOpen.BehaviourStarters.LeadShortcuts.LeadRecap.FigureText.LinkHandoff.Explain.PanelSwitch`.split(`.`)));var ke=e=>({VisitorChat:e(`VisitorChat`),Starters:e(`Starters`),Nudges:e(`Nudges`),ResumeLast:e(`ResumeLast`),OpenTickets:e(`OpenTickets`),History:e(`History`),Rename:e(`Rename`),Delete:e(`Delete`),SuggestedReplies:e(`SuggestedReplies`),Stop:e(`Stop`),Retry:e(`Retry`),Edit:e(`Edit`),Regenerate:e(`Regenerate`),Sources:e(`Sources`),Rating:e(`Rating`),Copy:e(`Copy`),Share:e(`Share`),Print:e(`Print`),Attachments:e(`Attachments`),RichAnswers:e(`RichAnswers`),InputRequests:e(`InputRequests`),LeadCapture:e(`LeadCapture`),Booking:e(`Booking`),Scripts:e(`Scripts`),AiAnswers:e(`AiAnswers`),HumanHandoff:e(`HumanHandoff`),Dictation:e(`Dictation`),ReadAloud:e(`ReadAloud`),VoiceClips:e(`VoiceClips`),Sounds:e(`Sounds`),AutoOpen:e(`AutoOpen`),BehaviourStarters:e(`BehaviourStarters`),LeadShortcuts:e(`LeadShortcuts`),LeadRecap:e(`LeadRecap`),FigureText:e(`FigureText`),LinkHandoff:e(`LinkHandoff`),Explain:e(`Explain`),PanelSwitch:e(`PanelSwitch`)}),Ae=()=>ke(()=>!1),je=(e,t)=>Object.freeze(ke(n=>e.features[n]===!0&&t?.[n]!==!1)),Me=(e,t)=>e===`/`||t===e||t.startsWith(`${e}/`),Ne=(e,{pathname:t,returning:n})=>{let r=e.start,i=r.greeting,a=r.starters;n&&(i=r.returningGreeting??i,a=r.returningStarters??a);let o=null;for(let e of r.pageRules)Me(e.pathPrefix,t)&&(o===null||e.pathPrefix.length>o.pathPrefix.length)&&(o=e);return o&&(i=o.greeting??i,a=o.starters??a),{greeting:i,starters:a}},Pe=(e,t)=>t.Nudges&&e.start.nudge?e.start.nudge:null,Fe=e=>e.captcha.mode!==`Off`&&typeof e.captcha.siteKey==`string`&&e.captcha.siteKey!==``,Ie=(e,t,n,r)=>{let i=n.length>0?n:[M.thinking],a=i[(r%i.length+i.length)%i.length];if(a===void 0)throw Error(`loader phrase index out of range for rotation ${r}`);let o=t.length>0?t[t.length-1]:void 0;return e===`Phrases`?{label:a,steps:[],activeIndex:-1}:e===`Steps`?{label:o??a,steps:t.length>0?[...t]:[a],activeIndex:t.length>0?t.length-1:0}:{label:o??a,steps:[],activeIndex:-1}},Le=g(te),Re=g(b),ze=g(w),Be=(e,t)=>{let n=s(e,t);return{name:c(n,`name`,l,t),tagline:c(n,`tagline`,p(l),t),intro:c(n,`intro`,p(l),t)}},Ve=(e,t)=>{let n=s(e,t);return{privacyText:c(n,`privacyText`,p(l),t),privacyUrl:c(n,`privacyUrl`,p(l),t),assuranceText:c(n,`assuranceText`,p(l),t),disclaimer:c(n,`disclaimer`,p(l),t)}},He=(e,t)=>{let n=s(e,t);return{mode:c(n,`mode`,Re,t),siteKey:c(n,`siteKey`,p(l),t),action:c(n,`action`,l,t),testToken:c(n,`testToken`,p(l),t)}},Ue=(e,t)=>{let n=s(e,t);return{maxMessageLength:c(n,`maxMessageLength`,u,t),maxAttachments:c(n,`maxAttachments`,u,t),maxFileBytes:c(n,`maxFileBytes`,u,t),contentTypes:c(n,`contentTypes`,m(l),t),maxRepliesPerConversation:c(n,`maxRepliesPerConversation`,p(u),t)}},We=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),label:c(n,`label`,l,t),message:c(n,`message`,l,t),icon:c(n,`icon`,p(l),t),variant:c(n,`variant`,p(Le),t)}},Ge=(e,t)=>{let n=s(e,t);return{pathPrefix:c(n,`pathPrefix`,l,t),greeting:c(n,`greeting`,p(l),t),starters:c(n,`starters`,p(m(We)),t)}},Ke=(e,t)=>{let n=s(e,t);return{kind:c(n,`kind`,l,t),text:c(n,`text`,l,t),delaySeconds:c(n,`delaySeconds`,u,t),scrollPercent:c(n,`scrollPercent`,p(u),t),pagesViewed:c(n,`pagesViewed`,p(u),t)}},qe=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),minTimeOnSiteSeconds:c(n,`minTimeOnSiteSeconds`,p(u),t),minScrollPercent:c(n,`minScrollPercent`,p(u),t),minPagesViewed:c(n,`minPagesViewed`,p(u),t),minServicesViewed:c(n,`minServicesViewed`,p(u),t),starters:c(n,`starters`,m(We),t),keepPageStarters:c(n,`keepPageStarters`,u,t)}},Je=(e,t)=>{let n=s(e,t);return{servicePathPrefixes:c(n,`servicePathPrefixes`,m(l),t),maxStarters:c(n,`maxStarters`,u,t),recentServiceStarter:c(n,`recentServiceStarter`,p(l),t)}},Ye=(e,t)=>{let n=s(e,t);return{greeting:c(n,`greeting`,l,t),starters:c(n,`starters`,m(We),t),pageRules:c(n,`pageRules`,m(Ge),t),returningGreeting:c(n,`returningGreeting`,p(l),t),returningStarters:c(n,`returningStarters`,p(m(We)),t),nudge:c(n,`nudge`,p(Ke),t),rules:c(n,`rules`,p(m(qe)),t),behaviour:c(n,`behaviour`,p(Je),t)}},Xe=(e,t)=>{let n=s(e,t);return{open:c(n,`open`,d,t),sent:c(n,`sent`,d,t),reply:c(n,`reply`,d,t),vibrate:c(n,`vibrate`,d,t),vibrateMs:c(n,`vibrateMs`,u,t),volume:c(n,`volume`,u,t),muteControl:c(n,`muteControl`,d,t)}},Ze=(e,t)=>{let n=s(e,t);return{typingPause:c(n,`typingPause`,d,t),pauseBaseMs:c(n,`pauseBaseMs`,u,t),pausePerCharMs:c(n,`pausePerCharMs`,u,t),pauseMaxMs:c(n,`pauseMaxMs`,u,t),handoffPauseMs:c(n,`handoffPauseMs`,u,t),thinkingPhrases:c(n,`thinkingPhrases`,m(l),t),phraseIntervalMs:c(n,`phraseIntervalMs`,u,t)}},Qe=(e,t)=>{let n=s(e,t);return{peek:c(n,`peek`,d,t),peekSeconds:c(n,`peekSeconds`,u,t),hoverLabel:c(n,`hoverLabel`,p(l),t),hideWhileOpen:c(n,`hideWhileOpen`,d,t),liftAboveBanner:c(n,`liftAboveBanner`,d,t),liftAboveFooter:c(n,`liftAboveFooter`,d,t),stepAsideForMenus:c(n,`stepAsideForMenus`,d,t),switchOnDark:c(n,`switchOnDark`,d,t)}},$e=(e,t)=>{let n=s(e,t);return{delaySeconds:c(n,`delaySeconds`,u,t),oncePerSession:c(n,`oncePerSession`,d,t),rememberDismissal:c(n,`rememberDismissal`,d,t),skipBelowWidthPx:c(n,`skipBelowWidthPx`,u,t),skipWhenFormTouched:c(n,`skipWhenFormTouched`,d,t),skipWhenCoversControl:c(n,`skipWhenCoversControl`,d,t),busyRetrySeconds:c(n,`busyRetrySeconds`,u,t),skipPathPrefixes:c(n,`skipPathPrefixes`,m(l),t)}},et=(e,t)=>{let n=s(e,t);return{motion:c(n,`motion`,d,t),sound:c(n,`sound`,Xe,t),pacing:c(n,`pacing`,Ze,t),launcher:c(n,`launcher`,Qe,t),autoOpen:c(n,`autoOpen`,$e,t)}},tt=(e,t)=>{let n=s(e,t),r=s(n.features,`${t}.features`);return{contractVersion:c(n,`contractVersion`,u,t),surface:c(n,`surface`,l,t),screen:c(n,`screen`,p(l),t),assistant:c(n,`assistant`,Be,t),start:c(n,`start`,Ye,t),features:ke(e=>c(r,e,d,`${t}.features`)),limits:c(n,`limits`,Ue,t),messagesLeftToday:c(n,`messagesLeftToday`,p(u),t),inputFieldTypes:c(n,`inputFieldTypes`,m(ze),t),footer:c(n,`footer`,Ve,t),captcha:c(n,`captcha`,He,t),experience:c(n,`experience`,et,t),speechAvailable:c(n,`speechAvailable`,d,t)}},nt=g(v),rt=(e,t)=>{let n=s(e,t);return{token:c(n,`token`,l,t),region:c(n,`region`,l,t),expiresDateTimeUtc:c(n,`expiresDateTimeUtc`,l,t)}},it=(e,t)=>{let n=s(e,t);return{publicId:c(n,`publicId`,l,t),fileName:c(n,`fileName`,l,t),contentType:c(n,`contentType`,l,t),length:c(n,`length`,u,t)}},at=(e,t)=>{let n=s(e,t);return{ticketId:c(n,`ticketId`,l,t),number:c(n,`number`,l,t),subject:c(n,`subject`,l,t),status:c(n,`status`,l,t),updatedDateTimeUtc:c(n,`updatedDateTimeUtc`,l,t)}},ot=(e,t)=>{let n=s(e,t);return{actionId:c(n,`actionId`,l,t),actionKind:c(n,`actionKind`,l,t),state:c(n,`state`,nt,t),decidedDateTimeUtc:c(n,`decidedDateTimeUtc`,p(l),t),note:c(n,`note`,p(l),t)}},st=(e,t)=>Reflect.get(e,t),ct=e=>typeof e==`object`&&!!e||typeof e==`function`,lt=(e,t)=>ct(e)&&typeof st(e,t)==`function`,ut=(e,t,n)=>{let r=st(e,t);if(typeof r!=`function`)throw Error(`${t} is not available on this host.`);return Reflect.apply(r,e,n)},dt=(e,t)=>{let n=st(globalThis,e);if(typeof n!=`function`)throw Error(`${e} is not available on this host.`);let r=Reflect.construct(n,t);if(!ct(r))throw Error(`${e} did not construct an object.`);return r},ft=e=>ct(e)&&typeof st(e,`aborted`)==`boolean`&&lt(e,`addEventListener`)&&lt(e,`removeEventListener`),pt=class{signal;#e;constructor(){let e=dt(`AbortController`,[]),t=st(e,`signal`);if(!ft(t))throw Error(`AbortController made no usable signal.`);this.#e=e,this.signal=t}abort(){ut(this.#e,`abort`,[])}},mt=new Map,ht=new Map,gt=1,_t=(e,t,n)=>{let r=gt++;return e.set(r,ut(globalThis,t,n(r))),r},vt=(e,t,n)=>{if(!e.has(n))return;let r=e.get(n);e.delete(n),ut(globalThis,t,[r])},yt=e=>lt(globalThis,e)?(t,n)=>{ut(globalThis,e,[t,n])}:void 0,bt={AbortController:pt,setTimeout:(e,t)=>_t(mt,`setTimeout`,n=>[()=>{mt.delete(n),e()},t]),clearTimeout:e=>vt(mt,`clearTimeout`,e),get requestAnimationFrame(){if(lt(globalThis,`requestAnimationFrame`))return e=>_t(ht,`requestAnimationFrame`,t=>[()=>{ht.delete(t),e()}])},get cancelAnimationFrame(){if(lt(globalThis,`cancelAnimationFrame`))return e=>vt(ht,`cancelAnimationFrame`,e)},get navigator(){let e=st(globalThis,`navigator`);if(!ct(e))return;let t=st(e,`onLine`);return typeof t==`boolean`?{onLine:t}:{}},get addEventListener(){return yt(`addEventListener`)},get removeEventListener(){return yt(`removeEventListener`)},get location(){let e=st(globalThis,`location`);if(!ct(e))return;let t=st(e,`pathname`);return typeof t==`string`?{pathname:t}:{}},get createFormData(){if(typeof st(globalThis,`FormData`)==`function`)return()=>{let e=dt(`FormData`,[]);return{native:e,append:(t,n,r)=>{ut(e,`append`,r===void 0?[t,n]:[t,n,r])}}}},get createObjectUrl(){let e=st(globalThis,`URL`);if(typeof st(globalThis,`Blob`)==`function`&&lt(e,`createObjectURL`)&&ct(e))return t=>{let n=ut(e,`createObjectURL`,[dt(`Blob`,[[t]])]);if(typeof n!=`string`)throw Error(`createObjectURL returned no URL.`);return n}},get revokeObjectUrl(){let e=st(globalThis,`URL`);if(ct(e)&&lt(e,`revokeObjectURL`))return t=>{ut(e,`revokeObjectURL`,[t])}},get crypto(){let e=st(globalThis,`crypto`);if(ct(e)&&lt(e,`randomUUID`))return{randomUUID:()=>{let t=ut(e,`randomUUID`,[]);if(typeof t!=`string`)throw Error(`randomUUID returned no string.`);return t}}}},xt=e=>re.some(t=>t===e),St=(e,t)=>{if(!xt(e))throw new o(`event`,`one of ${re.join(`, `)}`);let n=`event.${e}`,r=s(t,n);switch(e){case`messageStarted`:return{name:`messageStarted`,data:{message:c(r,`message`,Te,n)}};case`partStarted`:return{name:`partStarted`,data:{messageId:c(r,`messageId`,l,n),index:c(r,`index`,u,n),part:c(r,`part`,be,n)}};case`partDelta`:return{name:`partDelta`,data:{messageId:c(r,`messageId`,l,n),index:c(r,`index`,u,n),text:c(r,`text`,l,n)}};case`partCompleted`:return{name:`partCompleted`,data:{messageId:c(r,`messageId`,l,n),index:c(r,`index`,u,n),part:c(r,`part`,be,n)}};case`messageReset`:return{name:`messageReset`,data:{messageId:c(r,`messageId`,l,n)}};case`step`:return{name:`step`,data:{messageId:c(r,`messageId`,l,n),label:c(r,`label`,l,n)}};case`messageCompleted`:return{name:`messageCompleted`,data:{message:c(r,`message`,Te,n),messagesLeftToday:c(r,`messagesLeftToday`,p(u),n)}};case`conversationUpdated`:return{name:`conversationUpdated`,data:{conversationId:c(r,`conversationId`,l,n),state:c(r,`state`,Ce,n),title:c(r,`title`,l,n),continuesConversationId:c(r,`continuesConversationId`,p(l),n)}};case`typing`:return{name:`typing`,data:{authorKind:c(r,`authorKind`,xe,n),displayName:c(r,`displayName`,p(l),n)}};case`error`:return{name:`error`,data:{code:c(r,`code`,l,n),message:c(r,`message`,l,n)}}}},Ct=e=>{let t=``,n=t=>{let n=`message`,r=[];for(let e of t.split(`
1
+ (function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function r(e){let t=new Uint8Array(e),n=(e,n)=>String.fromCharCode(...t.slice(e,n));return n(0,4)===`OggS`?`audio/ogg`:t[0]===26&&t[1]===69&&t[2]===223&&t[3]===163?`audio/webm`:n(4,8)===`ftyp`?`audio/mp4`:n(0,4)===`RIFF`?`audio/wav`:n(0,3)===`ID3`||t[0]===255&&((t[1]??0)&224)==224?`audio/mpeg`:`application/octet-stream`}var i=e=>typeof e==`object`&&!!e&&!Array.isArray(e),a=e=>i(e)?e:{},o=class extends Error{path;constructor(e,t){super(`Expected ${t} at ${e}.`),this.name=`ChatDecodeError`,this.path=e}},s=(e,t)=>{if(!i(e))throw new o(t,`an object`);return e},c=(e,t,n,r)=>n(e[t],`${r}.${t}`),l=(e,t)=>{if(typeof e!=`string`)throw new o(t,`a string`);return e},u=(e,t)=>{if(typeof e!=`number`||Number.isNaN(e))throw new o(t,`a number`);return e},d=(e,t)=>{if(typeof e!=`boolean`)throw new o(t,`true or false`);return e},f=(e,t)=>{if(!(e instanceof ArrayBuffer))throw new o(t,`binary data`);return e},p=e=>(t,n)=>t==null?null:e(t,n),m=e=>(t,n)=>{if(!Array.isArray(t))throw new o(n,`a list`);return t.map((t,r)=>e(t,`${n}[${r}]`))},h=()=>e=>e,g=e=>(t,n)=>{let r=e.find(e=>e===t);if(r===void 0)throw new o(n,`one of ${e.join(`, `)}`);return r},_=(e,t,n)=>(r,i)=>{let a=c(s(r,i),`kind`,l,i);if(!(t=>e.some(e=>e===t))(a)){if(n)return n(a,i);throw new o(`${i}.kind`,`one of ${e.join(`, `)}`)}return t[a](r,i)},v=h()([`Pending`,`Confirmed`,`Rejected`,`Expired`,`Done`,`Failed`,`Repeat`]),y=h()([`Visitor`,`Customer`,`Assistant`,`Agent`,`Script`,`System`]),b=h()([`Off`,`FirstMessage`,`EveryInput`]),x=h()([`Bar`,`Line`,`Donut`]),S=h()([`Text`,`Integer`,`Decimal`,`MoneyMinor`,`Percent`,`Date`,`DateTimeUtc`]),C=h()([`Open`,`WaitingForAgent`,`WithAgent`,`Closed`]),w=h()([`Email`,`Phone`,`Name`,`Company`,`Text`,`LongText`,`Choice`,`MultiChoice`,`TimeSlot`,`File`,`Consent`]),T=h()([`None`,`Otp`]),E=h()([`Neutral`,`Positive`,`Caution`,`Negative`]),D=h()([`Requested`,`Waiting`,`Joined`,`Left`,`Ended`]),O=h()([`Open`,`Answered`,`Skipped`,`Expired`]),k=h()([`NeedsNewerApp`,`ActionLimitReached`,`ConversationContinued`,`AssistantUnavailable`,`OutOfTopic`,`ConversationTooLong`,`LeadAlreadyCaptured`]),A=h()([`Text`,`Sources`,`QuickReplies`,`InputRequest`,`Action`,`Notice`,`Table`,`Chart`,`Figures`,`RecordCard`,`Image`,`File`,`Ticket`,`Handoff`,`VoiceClip`]),j=h()([`Send`,`Open`,`Navigate`]),ee=h()([`Inline`,`Composer`]),te=h()([`Default`,`Primary`,`Cta`]),ne=h()([`Up`,`Down`]),re=h()([`messageStarted`,`partStarted`,`partDelta`,`partCompleted`,`messageReset`,`step`,`messageCompleted`,`conversationUpdated`,`typing`,`error`]),ie={Open:`Open`,InProgress:`In progress`,WaitingOnCustomer:`Waiting on you`,Resolved:`Resolved`,Closed:`Closed`,Cancelled:`Cancelled`},ae={Positive:`Good`,Caution:`Watch`,Negative:`Poor`,Neutral:``},M=Object.freeze({launcher:`Open chat`,launcherClose:`Close chat`,panelTitle:`Assistant`,headerStatus:`Usually replies instantly`,newChat:`New chat`,close:`Close`,history:`Past chats`,historyEmptyTitle:`No past chats`,historyEmptyText:`Your conversations show here.`,untitled:`Untitled chat`,rename:`Rename chat`,renameSave:`Save`,conversationTitle:`Chat name`,renameFailed:`We could not rename this chat. Please try again.`,deleteChat:`Delete chat`,deleteConfirmTitle:`Delete this chat?`,deleteConfirmMessage:`The conversation is removed for good.`,deleteConfirm:`Delete`,deleteFailed:`We could not delete this chat. Please try again.`,cancel:`Cancel`,loadMore:`Show more`,loadFailed:`We could not load your chats. Please try again.`,backToChat:`Back to the chat`,thread:`Conversation`,you:`You`,assistant:`Assistant`,agent:`Team`,thinking:`Working on it`,loadingConversation:`Loading the conversation`,emptyTitle:`How can I help?`,starters:`Suggested questions`,resumeLast:`Continue your last chat`,nudgeDismiss:`Dismiss suggestion`,composer:`Your message`,placeholder:`Ask anything`,send:`Send`,stop:`Stop`,composerHint:`Press Enter to send, Shift and Enter for a new line.`,counter:(e,t)=>`${e.toLocaleString(`en-GB`)} of ${t.toLocaleString(`en-GB`)}`,allowance:e=>e===0?`You have no messages left today.`:e===1?`You have 1 message left today.`:`You have ${e} messages left today.`,attach:`Attach a file`,attachHint:`Pictures or PDFs.`,removeAttachment:e=>`Remove ${e}`,attachmentUploading:`Uploading`,attachmentFailed:`That file did not upload. Please try again.`,attachmentLimit:e=>`You can attach up to ${e} files.`,editing:`Editing your message`,footerPrivacyFallback:`Privacy policy`,captchaNoticeBefore:`This site is protected by reCAPTCHA and the Google `,captchaPrivacyPolicy:`Privacy Policy`,captchaNoticeAnd:` and `,captchaTerms:`Terms of Service`,captchaNoticeAfter:` apply.`,captchaUnavailable:`We could not check this message. Please try again in a moment.`,newMessages:`New messages`,disclaimer:`The assistant can make mistakes, so check important details.`,copy:`Copy`,copied:`Copied`,share:`Share`,print:`Print`,retry:`Try again`,stopped:`Stopped.`,regenerate:`New answer`,edit:`Edit`,rateUp:`Helpful`,rateDown:`Not helpful`,rating:`Rate this answer`,rated:`Thanks for the feedback.`,ratingFailed:`Your rating did not save. Please try again.`,sources:`Sources`,openSource:e=>`Open ${e}`,quickReplies:`Suggested replies`,inputSubmitting:`Sending`,inputRequired:`This field is required.`,inputConsentRequired:`Please accept to continue.`,inputAnswered:`Details sent.`,inputExpired:`This form has expired.`,inputSkipped:`Skipped.`,inputOptional:`Optional`,inputChooseFile:`Choose a file`,inputSendCode:`Send code`,inputEnterCode:`Enter the code`,inputCodeSent:`We sent a code. Enter it below.`,inputCodeFailed:`The code could not be sent. Try again.`,inputRemoveFile:e=>`Remove ${e}`,actionConfirm:`Confirm`,actionDismiss:`Not now`,actionWorking:`Working on it`,actionConfirmed:`Confirmed.`,actionRejected:`Not sent.`,actionExpired:`This request expired and was not sent.`,actionDone:`Done.`,actionFailed:`We could not do this. Please try again.`,actionRepeat:e=>`Already done on ${e}. Nothing was sent again.`,fileOpen:e=>`Open ${e}`,needsNewerApp:`This message needs a newer version of the app.`,errorGeneric:`Something went wrong. Please try again.`,assistantOutdated:`The assistant needs an update before it can answer. Please try again later.`,typeAnswer:`or type your answer below`,skip:`Skip`,editSomething:`Edit something`,muteSounds:`Mute sounds`,unmuteSounds:`Unmute sounds`,preparingAnswer:e=>`${e} is preparing an answer`,explainTrigger:`Why?`,explainTriggerLabel:e=>`Why? Explain ${e}`,explainAskMore:`Ask more`,explainSlow:`Still working on this.`,explainOffline:`You are offline. Explanations need a connection.`,explainError:`This could not be explained just now. Try again.`,explainRetry:`Try again`,explainEmpty:`This could not be explained in words.`,explainCapacity:e=>`The limit for explanations has been reached. They come back at ${e}.`,explainCapacityNoDate:`You have reached today's limit. Try again later.`,explainNotCounted:`Explanations do not use your daily messages. A question you type does.`,openFullScreen:`Open full screen`,openSidePanel:`Open as side panel`,earlierChat:`Earlier chat`,justNow:`Just now`,today:`Today`,yesterday:`Yesterday`,dailyLimitRefresh:e=>`They refresh on ${e}.`,talkToPerson:`Talk to a person`,handoffRequested:`Connecting you to our team.`,handoffWaiting:`Waiting for the next available person.`,handoffQueued:e=>`You are number ${e} in line.`,handoffQueuedText:`We will bring you in as soon as someone is free.`,handoffJoined:e=>`${e} joined the chat.`,handoffJoinedText:e=>`The conversation so far has been shared with ${e}, so you will not need to repeat anything.`,handoffLeft:e=>`${e} left the chat.`,handoffLeftText:`Another member of the team may join, or you can start a new chat.`,handoffEnded:`This chat with our team has ended.`,handoffEndedText:`Thank you for talking to us. Start a new chat if you need anything else.`,handoffAgentFallback:`A member of our team`,handoffMoment:`One moment`,liveLost:`We lost the connection to support.`,agentTyping:e=>`${e} is typing`,agentSays:e=>`${e} says`,statusWaitingForAgent:`Waiting for a person`,statusWithAgent:e=>`${e} from our team`,openTickets:`Your open tickets`,ticketAria:e=>`Ticket ${e}`,ticketView:`View ticket`,ticketStatus:e=>ie[e]??``,table:`Table`,tableShowAll:e=>`Show all ${e} rows`,tableEmpty:`No rows to show.`,chart:`Chart`,chartEmpty:`No data to show.`,chartShowTable:`Show as table`,chartShowChart:`Show as chart`,chartLoadFailed:`This chart could not be drawn.`,chartLow:e=>`Low ${e}`,chartHigh:e=>`High ${e}`,figures:`Key figures`,figureStatus:e=>ae[e]??``,recordOpen:`Open`,recordOpenFor:e=>`Open ${e}`,imageLoading:`Loading image`,imageFailed:`This image could not be loaded.`,imageViewer:`Image viewer`,imageOpen:e=>`View image: ${e}`,dictate:`Dictate`,dictateStop:`Stop dictating`,dictateListening:`Listening`,dictateTranscribing:`Turning your voice into text`,dictationBlocked:`The microphone is blocked. Allow it in your settings to dictate.`,dictationNoMicrophone:`No microphone was found. Connect one and try again.`,dictationNotHeard:`Nothing was heard. Check your microphone and try again.`,dictationFailed:`Dictation stopped working. Try again.`,dictationUnavailable:`Dictation is not available here.`,dictateOpenSettings:`Open Settings`,readAloud:`Read aloud`,readAloudStop:`Stop reading`,readAloudFailed:`This could not be read aloud.`,voiceClip:`Voice message`,voiceClipPlay:`Play voice message`,voiceClipPause:`Pause voice message`,voiceClipFailed:`This voice message could not be played.`,voiceClipShowTranscript:`Show transcript`,voiceClipHideTranscript:`Hide transcript`,voiceClipTime:(e,t)=>`${e} of ${t}`,shareConversation:`Share this conversation`,printConversation:`Print this conversation`,shareFailed:`Could not share. Try again.`,printFailed:`Could not open the print view. Try again.`,printedOn:e=>`Printed on ${e}`}),oe=e=>e?{...M,...e}:M,se=(e,t)=>{if(e===null||typeof e==`string`||typeof e==`number`)return e;throw new o(t,`text, a number or null`)},ce=(e,t)=>{let n=s(e,t);return Object.fromEntries(Object.keys(n).map(e=>[e,l(n[e],`${t}.${e}`)]))},le=(e,t)=>{let n=s(e,t);return{marker:c(n,`marker`,u,t),title:c(n,`title`,l,t),reference:c(n,`reference`,l,t),url:c(n,`url`,p(l),t)}},ue=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),label:c(n,`label`,l,t)}},de=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),startDateTimeUtc:c(n,`startDateTimeUtc`,l,t),endDateTimeUtc:c(n,`endDateTimeUtc`,l,t)}},fe=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),label:c(n,`label`,l,t),action:c(n,`action`,g(j),t),target:c(n,`target`,p(l),t),navigateAfterMs:c(n,`navigateAfterMs`,p(u),t),icon:c(n,`icon`,p(l),t),variant:c(n,`variant`,p(g(te)),t)}},pe=(e,t)=>{let n=s(e,t);return{key:c(n,`key`,l,t),type:c(n,`type`,g(w),t),label:c(n,`label`,l,t),placeholder:c(n,`placeholder`,p(l),t),required:c(n,`required`,d,t),maxLength:c(n,`maxLength`,p(u),t),options:c(n,`options`,p(m(ue)),t),slots:c(n,`slots`,p(m(de)),t),consentText:c(n,`consentText`,p(l),t),verify:c(n,`verify`,g(T),t),accept:c(n,`accept`,p(m(l)),t),secret:c(n,`secret`,d,t),validator:c(n,`validator`,p(l),t)}},me=(e,t)=>{let n=s(e,t);return{key:c(n,`key`,l,t),label:c(n,`label`,l,t),type:c(n,`type`,g(S),t)}},he=(e,t)=>{let n=s(e,t);return{label:c(n,`label`,l,t),value:c(n,`value`,u,t)}},N=(e,t)=>{let n=s(e,t);return{name:c(n,`name`,l,t),points:c(n,`points`,m(he),t)}},ge=(e,t)=>{let n=s(e,t);return{label:c(n,`label`,l,t),value:c(n,`value`,u,t),unit:c(n,`unit`,p(l),t),status:c(n,`status`,g(E),t)}},_e=(e,t)=>{let n=s(e,t);return{label:c(n,`label`,l,t),value:c(n,`value`,l,t),type:c(n,`type`,g(S),t)}},ve=(e,t)=>{let n=s(e,t);return{route:c(n,`route`,l,t),params:c(n,`params`,ce,t)}},ye=(e,t)=>{let n=s(e,t);return{displayName:c(n,`displayName`,l,t),avatarUrl:c(n,`avatarUrl`,p(l),t)}},be=_(A,{Text:(e,t)=>({kind:`Text`,text:c(s(e,t),`text`,l,t)}),Sources:(e,t)=>({kind:`Sources`,sources:c(s(e,t),`sources`,m(le),t)}),QuickReplies:(e,t)=>{let n=s(e,t);return{kind:`QuickReplies`,replies:c(n,`replies`,m(fe),t),placement:c(n,`placement`,g(ee),t)}},InputRequest:(e,t)=>{let n=s(e,t);return{kind:`InputRequest`,requestId:c(n,`requestId`,l,t),title:c(n,`title`,p(l),t),fields:c(n,`fields`,m(pe),t),submitLabel:c(n,`submitLabel`,l,t),state:c(n,`state`,g(O),t),answeredSummary:c(n,`answeredSummary`,p(l),t),allowTyped:c(n,`allowTyped`,d,t),cancellable:c(n,`cancellable`,d,t)}},Action:(e,t)=>{let n=s(e,t);return{kind:`Action`,actionId:c(n,`actionId`,l,t),actionKind:c(n,`actionKind`,l,t),title:c(n,`title`,l,t),lines:c(n,`lines`,m(l),t),state:c(n,`state`,g(v),t),decidedDateTimeUtc:c(n,`decidedDateTimeUtc`,p(l),t),note:c(n,`note`,p(l),t),consentText:c(n,`consentText`,p(l),t),confirmLabel:c(n,`confirmLabel`,p(l),t),rejectLabel:c(n,`rejectLabel`,p(l),t),editFields:c(n,`editFields`,p(m(ue)),t)}},Notice:(e,t)=>{let n=s(e,t);return{kind:`Notice`,code:c(n,`code`,g(k),t),text:c(n,`text`,l,t)}},Table:(e,t)=>{let n=s(e,t);return{kind:`Table`,title:c(n,`title`,p(l),t),columns:c(n,`columns`,m(me),t),rows:c(n,`rows`,m(m(se)),t),currency:c(n,`currency`,p(l),t)}},Chart:(e,t)=>{let n=s(e,t);return{kind:`Chart`,title:c(n,`title`,p(l),t),chartType:c(n,`chartType`,g(x),t),unit:c(n,`unit`,p(l),t),series:c(n,`series`,m(N),t)}},Figures:(e,t)=>({kind:`Figures`,figures:c(s(e,t),`figures`,m(ge),t)}),RecordCard:(e,t)=>{let n=s(e,t);return{kind:`RecordCard`,recordType:c(n,`recordType`,l,t),recordId:c(n,`recordId`,l,t),title:c(n,`title`,l,t),subtitle:c(n,`subtitle`,p(l),t),fields:c(n,`fields`,m(_e),t),target:c(n,`target`,p(ve),t)}},Image:(e,t)=>{let n=s(e,t);return{kind:`Image`,attachmentId:c(n,`attachmentId`,l,t),alt:c(n,`alt`,l,t),width:c(n,`width`,p(u),t),height:c(n,`height`,p(u),t)}},File:(e,t)=>{let n=s(e,t);return{kind:`File`,attachmentId:c(n,`attachmentId`,l,t),fileName:c(n,`fileName`,l,t),contentType:c(n,`contentType`,l,t),length:c(n,`length`,u,t)}},Ticket:(e,t)=>{let n=s(e,t);return{kind:`Ticket`,ticketId:c(n,`ticketId`,l,t),number:c(n,`number`,l,t),subject:c(n,`subject`,l,t),status:c(n,`status`,l,t)}},Handoff:(e,t)=>{let n=s(e,t);return{kind:`Handoff`,state:c(n,`state`,g(D),t),queuePosition:c(n,`queuePosition`,p(u),t),agent:c(n,`agent`,p(ye),t)}},VoiceClip:(e,t)=>{let n=s(e,t);return{kind:`VoiceClip`,attachmentId:c(n,`attachmentId`,l,t),durationMs:c(n,`durationMs`,u,t),transcript:c(n,`transcript`,p(l),t)}}},()=>({kind:`Notice`,code:`NeedsNewerApp`,text:M.needsNewerApp})),xe=g(y),Se=g(ne),Ce=g(C),we=(e,t)=>{let n=s(e,t);return{kind:c(n,`kind`,xe,t),displayName:c(n,`displayName`,p(l),t),avatarUrl:c(n,`avatarUrl`,p(l),t)}},Te=(e,t)=>{let n=s(e,t);return{publicId:c(n,`publicId`,l,t),conversationId:c(n,`conversationId`,l,t),sequence:c(n,`sequence`,u,t),author:c(n,`author`,we,t),createdDateTimeUtc:c(n,`createdDateTimeUtc`,l,t),parts:c(n,`parts`,m(be),t),rating:c(n,`rating`,p(Se),t),ratingNote:c(n,`ratingNote`,p(l),t)}},Ee=(e,t)=>{let n=s(e,t);return{publicId:c(n,`publicId`,l,t),title:c(n,`title`,l,t),state:c(n,`state`,Ce,t),continuesConversationId:c(n,`continuesConversationId`,p(l),t),messages:c(n,`messages`,m(Te),t),hasEarlier:c(n,`hasEarlier`,d,t)}},De=(e,t)=>{let n=s(e,t);return{publicId:c(n,`publicId`,l,t),title:c(n,`title`,l,t),state:c(n,`state`,Ce,t),createdDateTimeUtc:c(n,`createdDateTimeUtc`,l,t),lastActivityDateTimeUtc:c(n,`lastActivityDateTimeUtc`,l,t)}},Oe=(e,t)=>{let n=s(e,t);return{items:c(n,`items`,m(De),t),page:c(n,`page`,u,t),pageSize:c(n,`pageSize`,u,t),totalCount:c(n,`totalCount`,u,t),totalPages:c(n,`totalPages`,u,t),totalCountCapped:c(n,`totalCountCapped`,d,t)}};Object.freeze(h()(`VisitorChat.Starters.Nudges.ResumeLast.OpenTickets.History.Rename.Delete.SuggestedReplies.Stop.Retry.Edit.Regenerate.Sources.Rating.Copy.Share.Print.Attachments.RichAnswers.InputRequests.LeadCapture.Booking.Scripts.AiAnswers.HumanHandoff.Dictation.ReadAloud.VoiceClips.Sounds.AutoOpen.BehaviourStarters.LeadShortcuts.LeadRecap.FigureText.LinkHandoff.Explain.PanelSwitch`.split(`.`)));var ke=e=>({VisitorChat:e(`VisitorChat`),Starters:e(`Starters`),Nudges:e(`Nudges`),ResumeLast:e(`ResumeLast`),OpenTickets:e(`OpenTickets`),History:e(`History`),Rename:e(`Rename`),Delete:e(`Delete`),SuggestedReplies:e(`SuggestedReplies`),Stop:e(`Stop`),Retry:e(`Retry`),Edit:e(`Edit`),Regenerate:e(`Regenerate`),Sources:e(`Sources`),Rating:e(`Rating`),Copy:e(`Copy`),Share:e(`Share`),Print:e(`Print`),Attachments:e(`Attachments`),RichAnswers:e(`RichAnswers`),InputRequests:e(`InputRequests`),LeadCapture:e(`LeadCapture`),Booking:e(`Booking`),Scripts:e(`Scripts`),AiAnswers:e(`AiAnswers`),HumanHandoff:e(`HumanHandoff`),Dictation:e(`Dictation`),ReadAloud:e(`ReadAloud`),VoiceClips:e(`VoiceClips`),Sounds:e(`Sounds`),AutoOpen:e(`AutoOpen`),BehaviourStarters:e(`BehaviourStarters`),LeadShortcuts:e(`LeadShortcuts`),LeadRecap:e(`LeadRecap`),FigureText:e(`FigureText`),LinkHandoff:e(`LinkHandoff`),Explain:e(`Explain`),PanelSwitch:e(`PanelSwitch`)}),Ae=()=>ke(()=>!1),je=(e,t)=>Object.freeze(ke(n=>e.features[n]===!0&&t?.[n]!==!1)),Me=(e,t)=>e===`/`||t===e||t.startsWith(`${e}/`),Ne=(e,{pathname:t,returning:n})=>{let r=e.start,i=r.greeting,a=r.starters;n&&(i=r.returningGreeting??i,a=r.returningStarters??a);let o=null;for(let e of r.pageRules)Me(e.pathPrefix,t)&&(o===null||e.pathPrefix.length>o.pathPrefix.length)&&(o=e);return o&&(i=o.greeting??i,a=o.starters??a),{greeting:i,starters:a}},Pe=(e,t)=>t.Nudges&&e.start.nudge?e.start.nudge:null,Fe=e=>e.captcha.mode!==`Off`&&typeof e.captcha.siteKey==`string`&&e.captcha.siteKey!==``,Ie=(e,t,n,r)=>{let i=n.length>0?n:[M.thinking],a=i[(r%i.length+i.length)%i.length];if(a===void 0)throw Error(`loader phrase index out of range for rotation ${r}`);let o=t.length>0?t[t.length-1]:void 0;return e===`Phrases`?{label:a,steps:[],activeIndex:-1}:e===`Steps`?{label:o??a,steps:t.length>0?[...t]:[a],activeIndex:t.length>0?t.length-1:0}:{label:o??a,steps:[],activeIndex:-1}},Le=g(te),Re=g(b),ze=g(w),Be=(e,t)=>{let n=s(e,t);return{name:c(n,`name`,l,t),tagline:c(n,`tagline`,p(l),t),intro:c(n,`intro`,p(l),t)}},Ve=(e,t)=>{let n=s(e,t);return{privacyText:c(n,`privacyText`,p(l),t),privacyUrl:c(n,`privacyUrl`,p(l),t),assuranceText:c(n,`assuranceText`,p(l),t),disclaimer:c(n,`disclaimer`,p(l),t)}},He=(e,t)=>{let n=s(e,t);return{mode:c(n,`mode`,Re,t),siteKey:c(n,`siteKey`,p(l),t),action:c(n,`action`,l,t),testToken:c(n,`testToken`,p(l),t)}},Ue=(e,t)=>{let n=s(e,t);return{maxMessageLength:c(n,`maxMessageLength`,u,t),maxAttachments:c(n,`maxAttachments`,u,t),maxFileBytes:c(n,`maxFileBytes`,u,t),contentTypes:c(n,`contentTypes`,m(l),t),maxRepliesPerConversation:c(n,`maxRepliesPerConversation`,p(u),t)}},We=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),label:c(n,`label`,l,t),message:c(n,`message`,l,t),icon:c(n,`icon`,p(l),t),variant:c(n,`variant`,p(Le),t)}},Ge=(e,t)=>{let n=s(e,t);return{pathPrefix:c(n,`pathPrefix`,l,t),greeting:c(n,`greeting`,p(l),t),starters:c(n,`starters`,p(m(We)),t)}},Ke=(e,t)=>{let n=s(e,t);return{kind:c(n,`kind`,l,t),text:c(n,`text`,l,t),delaySeconds:c(n,`delaySeconds`,u,t),scrollPercent:c(n,`scrollPercent`,p(u),t),pagesViewed:c(n,`pagesViewed`,p(u),t)}},qe=(e,t)=>{let n=s(e,t);return{id:c(n,`id`,l,t),minTimeOnSiteSeconds:c(n,`minTimeOnSiteSeconds`,p(u),t),minScrollPercent:c(n,`minScrollPercent`,p(u),t),minPagesViewed:c(n,`minPagesViewed`,p(u),t),minServicesViewed:c(n,`minServicesViewed`,p(u),t),starters:c(n,`starters`,m(We),t),keepPageStarters:c(n,`keepPageStarters`,u,t)}},Je=(e,t)=>{let n=s(e,t);return{servicePathPrefixes:c(n,`servicePathPrefixes`,m(l),t),maxStarters:c(n,`maxStarters`,u,t),recentServiceStarter:c(n,`recentServiceStarter`,p(l),t)}},Ye=(e,t)=>{let n=s(e,t);return{greeting:c(n,`greeting`,l,t),starters:c(n,`starters`,m(We),t),pageRules:c(n,`pageRules`,m(Ge),t),returningGreeting:c(n,`returningGreeting`,p(l),t),returningStarters:c(n,`returningStarters`,p(m(We)),t),nudge:c(n,`nudge`,p(Ke),t),rules:c(n,`rules`,p(m(qe)),t),behaviour:c(n,`behaviour`,p(Je),t)}},Xe=(e,t)=>{let n=s(e,t);return{open:c(n,`open`,d,t),sent:c(n,`sent`,d,t),reply:c(n,`reply`,d,t),vibrate:c(n,`vibrate`,d,t),vibrateMs:c(n,`vibrateMs`,u,t),volume:c(n,`volume`,u,t),muteControl:c(n,`muteControl`,d,t)}},Ze=(e,t)=>{let n=s(e,t);return{typingPause:c(n,`typingPause`,d,t),pauseBaseMs:c(n,`pauseBaseMs`,u,t),pausePerCharMs:c(n,`pausePerCharMs`,u,t),pauseMaxMs:c(n,`pauseMaxMs`,u,t),handoffPauseMs:c(n,`handoffPauseMs`,u,t),thinkingPhrases:c(n,`thinkingPhrases`,m(l),t),phraseIntervalMs:c(n,`phraseIntervalMs`,u,t)}},Qe=(e,t)=>{let n=s(e,t);return{peek:c(n,`peek`,d,t),peekSeconds:c(n,`peekSeconds`,u,t),hoverLabel:c(n,`hoverLabel`,p(l),t),hideWhileOpen:c(n,`hideWhileOpen`,d,t),liftAboveBanner:c(n,`liftAboveBanner`,d,t),liftAboveFooter:c(n,`liftAboveFooter`,d,t),stepAsideForMenus:c(n,`stepAsideForMenus`,d,t),switchOnDark:c(n,`switchOnDark`,d,t)}},$e=(e,t)=>{let n=s(e,t);return{delaySeconds:c(n,`delaySeconds`,u,t),oncePerSession:c(n,`oncePerSession`,d,t),rememberDismissal:c(n,`rememberDismissal`,d,t),skipBelowWidthPx:c(n,`skipBelowWidthPx`,u,t),skipWhenFormTouched:c(n,`skipWhenFormTouched`,d,t),skipWhenCoversControl:c(n,`skipWhenCoversControl`,d,t),busyRetrySeconds:c(n,`busyRetrySeconds`,u,t),skipPathPrefixes:c(n,`skipPathPrefixes`,m(l),t)}},et=(e,t)=>{let n=s(e,t);return{motion:c(n,`motion`,d,t),sound:c(n,`sound`,Xe,t),pacing:c(n,`pacing`,Ze,t),launcher:c(n,`launcher`,Qe,t),autoOpen:c(n,`autoOpen`,$e,t)}},tt=(e,t)=>{let n=s(e,t),r=s(n.features,`${t}.features`);return{contractVersion:c(n,`contractVersion`,u,t),surface:c(n,`surface`,l,t),screen:c(n,`screen`,p(l),t),assistant:c(n,`assistant`,Be,t),start:c(n,`start`,Ye,t),features:ke(e=>c(r,e,d,`${t}.features`)),limits:c(n,`limits`,Ue,t),messagesLeftToday:c(n,`messagesLeftToday`,p(u),t),inputFieldTypes:c(n,`inputFieldTypes`,m(ze),t),footer:c(n,`footer`,Ve,t),captcha:c(n,`captcha`,He,t),experience:c(n,`experience`,et,t),speechAvailable:c(n,`speechAvailable`,d,t)}},nt=g(v),rt=(e,t)=>{let n=s(e,t);return{token:c(n,`token`,l,t),region:c(n,`region`,l,t),expiresDateTimeUtc:c(n,`expiresDateTimeUtc`,l,t)}},it=(e,t)=>{let n=s(e,t);return{publicId:c(n,`publicId`,l,t),fileName:c(n,`fileName`,l,t),contentType:c(n,`contentType`,l,t),length:c(n,`length`,u,t)}},at=(e,t)=>{let n=s(e,t);return{ticketId:c(n,`ticketId`,l,t),number:c(n,`number`,l,t),subject:c(n,`subject`,l,t),status:c(n,`status`,l,t),updatedDateTimeUtc:c(n,`updatedDateTimeUtc`,l,t)}},ot=(e,t)=>{let n=s(e,t);return{actionId:c(n,`actionId`,l,t),actionKind:c(n,`actionKind`,l,t),state:c(n,`state`,nt,t),decidedDateTimeUtc:c(n,`decidedDateTimeUtc`,p(l),t),note:c(n,`note`,p(l),t)}},st=(e,t)=>Reflect.get(e,t),ct=e=>typeof e==`object`&&!!e||typeof e==`function`,lt=(e,t)=>ct(e)&&typeof st(e,t)==`function`,ut=(e,t,n)=>{let r=st(e,t);if(typeof r!=`function`)throw Error(`${t} is not available on this host.`);return Reflect.apply(r,e,n)},dt=(e,t)=>{let n=st(globalThis,e);if(typeof n!=`function`)throw Error(`${e} is not available on this host.`);let r=Reflect.construct(n,t);if(!ct(r))throw Error(`${e} did not construct an object.`);return r},ft=e=>ct(e)&&typeof st(e,`aborted`)==`boolean`&&lt(e,`addEventListener`)&&lt(e,`removeEventListener`),pt=class{signal;#e;constructor(){let e=dt(`AbortController`,[]),t=st(e,`signal`);if(!ft(t))throw Error(`AbortController made no usable signal.`);this.#e=e,this.signal=t}abort(){ut(this.#e,`abort`,[])}},mt=new Map,ht=new Map,gt=1,_t=(e,t,n)=>{let r=gt++;return e.set(r,ut(globalThis,t,n(r))),r},vt=(e,t,n)=>{if(!e.has(n))return;let r=e.get(n);e.delete(n),ut(globalThis,t,[r])},yt=e=>lt(globalThis,e)?(t,n)=>{ut(globalThis,e,[t,n])}:void 0,bt={AbortController:pt,setTimeout:(e,t)=>_t(mt,`setTimeout`,n=>[()=>{mt.delete(n),e()},t]),clearTimeout:e=>vt(mt,`clearTimeout`,e),get requestAnimationFrame(){if(lt(globalThis,`requestAnimationFrame`))return e=>_t(ht,`requestAnimationFrame`,t=>[()=>{ht.delete(t),e()}])},get cancelAnimationFrame(){if(lt(globalThis,`cancelAnimationFrame`))return e=>vt(ht,`cancelAnimationFrame`,e)},get navigator(){let e=st(globalThis,`navigator`);if(!ct(e))return;let t=st(e,`onLine`);return typeof t==`boolean`?{onLine:t}:{}},get addEventListener(){return yt(`addEventListener`)},get removeEventListener(){return yt(`removeEventListener`)},get location(){let e=st(globalThis,`location`);if(!ct(e))return;let t=st(e,`pathname`);return typeof t==`string`?{pathname:t}:{}},get createFormData(){if(typeof st(globalThis,`FormData`)==`function`)return()=>{let e=dt(`FormData`,[]);return{native:e,append:(t,n,r)=>{ut(e,`append`,r===void 0?[t,n]:[t,n,r])}}}},get createObjectUrl(){let e=st(globalThis,`URL`);if(typeof st(globalThis,`Blob`)==`function`&&lt(e,`createObjectURL`)&&ct(e))return t=>{let n=ut(e,`createObjectURL`,[dt(`Blob`,[[t]])]);if(typeof n!=`string`)throw Error(`createObjectURL returned no URL.`);return n}},get revokeObjectUrl(){let e=st(globalThis,`URL`);if(ct(e)&&lt(e,`revokeObjectURL`))return t=>{ut(e,`revokeObjectURL`,[t])}},get crypto(){let e=st(globalThis,`crypto`);if(!ct(e))return;let t=lt(e,`randomUUID`),n=lt(e,`getRandomValues`);if(!t&&!n)return;let r={};return t&&(r.randomUUID=()=>{let t=ut(e,`randomUUID`,[]);if(typeof t!=`string`)throw Error(`randomUUID returned no string.`);return t}),n&&(r.getRandomValues=t=>{let n=ut(e,`getRandomValues`,[t]);if(!(n instanceof Uint8Array))throw Error(`getRandomValues returned no bytes.`);return n}),r}},xt=e=>re.some(t=>t===e),St=(e,t)=>{if(!xt(e))throw new o(`event`,`one of ${re.join(`, `)}`);let n=`event.${e}`,r=s(t,n);switch(e){case`messageStarted`:return{name:`messageStarted`,data:{message:c(r,`message`,Te,n)}};case`partStarted`:return{name:`partStarted`,data:{messageId:c(r,`messageId`,l,n),index:c(r,`index`,u,n),part:c(r,`part`,be,n)}};case`partDelta`:return{name:`partDelta`,data:{messageId:c(r,`messageId`,l,n),index:c(r,`index`,u,n),text:c(r,`text`,l,n)}};case`partCompleted`:return{name:`partCompleted`,data:{messageId:c(r,`messageId`,l,n),index:c(r,`index`,u,n),part:c(r,`part`,be,n)}};case`messageReset`:return{name:`messageReset`,data:{messageId:c(r,`messageId`,l,n)}};case`step`:return{name:`step`,data:{messageId:c(r,`messageId`,l,n),label:c(r,`label`,l,n)}};case`messageCompleted`:return{name:`messageCompleted`,data:{message:c(r,`message`,Te,n),messagesLeftToday:c(r,`messagesLeftToday`,p(u),n)}};case`conversationUpdated`:return{name:`conversationUpdated`,data:{conversationId:c(r,`conversationId`,l,n),state:c(r,`state`,Ce,n),title:c(r,`title`,l,n),continuesConversationId:c(r,`continuesConversationId`,p(l),n)}};case`typing`:return{name:`typing`,data:{authorKind:c(r,`authorKind`,xe,n),displayName:c(r,`displayName`,p(l),n)}};case`error`:return{name:`error`,data:{code:c(r,`code`,l,n),message:c(r,`message`,l,n)}}}},Ct=e=>{let t=``,n=t=>{let n=`message`,r=[];for(let e of t.split(`
2
2
  `)){if(e===``||e.startsWith(`:`))continue;let t=e.indexOf(`:`),i=t===-1?e:e.slice(0,t),a=t===-1?``:e.slice(t+1);a.startsWith(` `)&&(a=a.slice(1)),i===`event`?n=a:i===`data`&&r.push(a)}if(r.length===0)return;let i;try{i=JSON.parse(r.join(`
3
3
  `))}catch{e({name:`error`,data:{code:`invalid-response`,message:``}});return}e({name:n,data:i})};return{push(e){if(!e)return;t=(t+e).replace(/\r\n/g,`
4
4
  `).replace(/\r(?!$)/g,`
5
5
  `);let r=t.split(`
6
6
 
7
- `);t=r.pop()??``;for(let e of r)n(e)},end(){let e=t.replace(/\r$/,``);t=``,e.trim()&&n(e)}}},wt=e=>{let t=null,n=null,r=Ct(({name:r,data:i})=>{if(n)return;let a;try{a=St(r,i)}catch(e){if(!(e instanceof o))throw e;n={code:`invalid-response`,message:``};return}a.name===`error`?n={code:a.data.code,message:a.data.message}:(a.name===`messageCompleted`&&(t=a.data.message),e?.(a))});return{push:e=>r.push(e),end:()=>r.end(),get last(){return t},get failure(){return n}}},Tt=class extends Error{code;status;resetsDateTimeUtc;errors;constructor(e,t,n,r=null,i=null){super(t),this.name=`ChatApiError`,this.code=e,this.status=n,this.resetsDateTimeUtc=r,this.errors=i}},Et=e=>{if(!i(e))return null;let t={errors:e.errors};return typeof e.code==`string`&&(t.code=e.code),typeof e.detail==`string`&&(t.detail=e.detail),typeof e.resetsDateTimeUtc==`string`&&(t.resetsDateTimeUtc=e.resetsDateTimeUtc),t},Dt=e=>{if(typeof e==`string`)try{return Et(JSON.parse(e))}catch{return null}return Et(e)},Ot=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(a(e)))Array.isArray(r)&&typeof r[0]==`string`&&(t[n]=r[0]);return Object.keys(t).length>0?t:null},eee=(e,t)=>{let n=a(e);return!!t?.aborted||n.code===`ERR_CANCELED`||n.name===`CanceledError`||n.name===`AbortError`},kt=(e,t)=>{if(e instanceof Tt)return e;if(eee(e,t))return new Tt(`aborted`,`The request was cancelled.`);let n=a(e).response;if(!n)return new Tt(`network`,M.errorGeneric);let r=a(n),i=Dt(r.data),o=typeof i?.code==`string`&&i.code?i.code:`unknown`,s=typeof i?.detail==`string`&&i.detail?i.detail:M.errorGeneric,c=typeof i?.resetsDateTimeUtc==`string`?i.resetsDateTimeUtc:null;return new Tt(o,s,typeof r.status==`number`?r.status:void 0,c,Ot(i?.errors))},At=e=>{try{return e()}catch(e){throw e instanceof o?new Tt(`invalid-response`,M.errorGeneric):e}},jt=async(e,t)=>{let n;try{n=(await e()).data}catch(e){throw kt(e)}return At(()=>t(n,`response`))},Mt=()=>void 0,Nt=e=>{let t=a(a(e).event).target;if(i(t)&&typeof t.responseText==`string`&&!(typeof t.status==`number`&&(t.status<200||t.status>=300)))return t.responseText},Pt=()=>{let e=bt.createFormData;if(!e)throw Error(`FormData is not available.`);return e()},Ft=e=>typeof a(e).uri==`string`,tee=(e,t)=>{if(Ft(t)){e.append(`file`,t);return}let n=a(t).name;if(typeof n!=`string`||n===``)throw Error(`The file needs a name.`);e.append(`file`,t,n)},It=()=>{let e=bt.crypto;return e?.randomUUID?e.randomUUID():`${Date.now().toString(36)}${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`},Lt=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t},Rt=e=>{let t=``,n=null;return r=>{let i=(t+r).split(`
8
- `);t=i.pop()??``;for(let t of i){let r=t.endsWith(`\r`)?t.slice(0,-1):t;if(!r.startsWith(`id:`))continue;let i=r.slice(3).replace(/^ /,``);if(!/^\d+$/.test(i))continue;let a=Number(i);(n===null||a>n)&&(n=a,e?.(a))}}},zt=(e,{base:t})=>{if(typeof t!=`string`||t.trim()===``)throw TypeError(`createChatClient needs a base path, e.g. { base: "/api/assistant" }.`);let n=t.replace(/\/+$/,``),r={"Chat-Contract":`4`},i=e=>`${n}/conversations/${encodeURIComponent(e)}`,a=e=>`${n}/attachments/${encodeURIComponent(e)}`,o=e=>`${n}/actions/${encodeURIComponent(e)}`,s=new Map,c=async t=>{let i=t===void 0?``:`?screen=${encodeURIComponent(t)}`;try{let t=await jt(()=>e.get(`${n}/profile${i}`,{headers:r}),tt);if(typeof t?.contractVersion!=`number`||t.contractVersion<4)throw new Tt(`assistant_outdated`,M.assistantOutdated);return t}catch(e){throw e instanceof Tt&&e.status===404?new Tt(`assistant_outdated`,M.assistantOutdated,404):e}},l=e=>{let t=e??``,n=s.get(t);return n||(n=c(e).catch(e=>{throw s.delete(t),e}),s.set(t,n)),n},u=async(t,n,r)=>{let i=wt(r.onEvent),a=0,o=e=>{typeof e!=`string`||e.length<=a||(i.push(e.slice(a)),a=e.length)},s;try{s=await e.post(t,n,{responseType:`text`,headers:r.headers,...r.signal===void 0?{}:{signal:r.signal},onDownloadProgress:e=>o(Nt(e))})}catch(e){throw kt(e,r.signal)}o(s.data),i.end();let c=i.failure;if(c)throw new Tt(c.code||`unknown`,c.message||M.errorGeneric);let l=i.last;if(!l)throw new Tt(`invalid-response`,M.errorGeneric,s.status);return l};return{getProfile:l,send:(e,t={})=>{let i=Lt({conversationId:e.conversationId,text:e.text,quickReplyId:e.quickReplyId,attachmentIds:e.attachmentIds&&e.attachmentIds.length>0?e.attachmentIds:void 0,replacesMessageId:e.replacesMessageId,pageContext:e.pageContext,captchaToken:e.captchaToken});return u(`${n}/messages`,i,{signal:t.signal,onEvent:t.onEvent,headers:{...r,Accept:`text/event-stream`,"Idempotency-Key":It()}})},answerInput:(e,t,i={})=>{let a=Lt({values:t.values,captchaToken:t.captchaToken,codes:t.codes,attribution:t.attribution});return u(`${n}/inputs/${encodeURIComponent(e)}`,a,{signal:i.signal,onEvent:i.onEvent,headers:{...r,Accept:`text/event-stream`,"Idempotency-Key":It()}})},confirmAction:t=>jt(()=>e.post(`${o(t)}/confirm`,{},{headers:r}),ot),rejectAction:(t,n)=>jt(()=>e.post(`${o(t)}/reject`,n===void 0?{}:{reason:n},{headers:r}),ot),listConversations:(t={})=>{let i=[];t.page!==void 0&&i.push(`page=${encodeURIComponent(String(t.page))}`),t.pageSize!==void 0&&i.push(`pageSize=${encodeURIComponent(String(t.pageSize))}`);let a=i.join(`&`),o=a?`${n}/conversations?${a}`:`${n}/conversations`;return jt(()=>e.get(o,{headers:r}),Oe)},getConversation:(t,n)=>{let a=n===void 0?i(t):`${i(t)}?afterSequence=${n}`;return jt(()=>e.get(a,{headers:r}),Ee)},renameConversation:async(t,n)=>{await jt(()=>e.put(`${i(t)}/title`,{title:n},{headers:r}),Mt)},deleteConversation:async t=>{await jt(()=>e.delete(i(t),{headers:r}),Mt)},rateMessage:async(t,i)=>{let a=typeof i.note==`string`?i.note.trim():``;await jt(()=>e.put(`${n}/messages/${encodeURIComponent(t)}/rating`,{rating:i.rating,note:a||null},{headers:r}),Mt)},uploadAttachment:(t,i={})=>{let a=Pt();return tee(a,t),jt(()=>e.post(`${n}/attachments`,a.native,{headers:{...r,"Content-Type":`multipart/form-data`},timeout:3e5,...i.signal===void 0?{}:{signal:i.signal},onUploadProgress:({loaded:e,total:t})=>{i.onProgress&&t&&i.onProgress((e??0)/t)}}),it)},deleteAttachment:async t=>{await jt(()=>e.delete(a(t),{headers:r}),Mt)},getAttachment:t=>jt(()=>e.get(a(t),{headers:r,responseType:`arraybuffer`}),f),sendOtp:async(t,i)=>{await jt(()=>e.post(`${n}/inputs/${encodeURIComponent(t)}/otp`,i,{headers:r}),Mt)},requestHandoff:(e,t={})=>{let i=typeof e.reason==`string`&&e.reason.trim()!==``?e.reason:void 0;return u(`${n}/handoff`,Lt({conversationId:e.conversationId,reason:i}),{signal:t.signal,onEvent:t.onEvent,headers:{...r,Accept:`text/event-stream`,"Idempotency-Key":It()}})},watchConversation:async(t,n)=>{let a=new bt.AbortController,o=()=>a.abort();n.signal?.aborted&&a.abort(),n.signal?.addEventListener(`abort`,o);let s=!1,c=null,l=()=>{c!==null&&bt.clearTimeout(c),c=bt.setTimeout(()=>{s=!0,a.abort()},n.stallTimeoutMs??9e4)},u=Rt(n.onCursor),d=wt(n.onEvent),f=0,p=e=>{if(typeof e!=`string`||e.length<=f)return;let t=e.slice(f);f=e.length,u(t),d.push(t),d.failure&&a.abort()},m={...r,Accept:`text/event-stream`};typeof n.afterSequence==`number`&&Number.isFinite(n.afterSequence)&&(m[`Last-Event-ID`]=String(n.afterSequence)),l();try{p((await e.get(`${i(t)}/events`,{headers:m,responseType:`text`,timeout:0,signal:a.signal,onDownloadProgress:e=>{let t=Nt(e);t!==void 0&&(l(),p(t))}})).data),u(`
9
- `),d.end();let n=d.failure;if(n)throw new Tt(n.code||`unknown`,n.message||M.errorGeneric)}catch(e){if(n.signal?.aborted)return;let t=d.failure;throw t?new Tt(t.code||`unknown`,t.message||M.errorGeneric):s?new Tt(`stalled`,M.errorGeneric):kt(e,a.signal)}finally{c!==null&&bt.clearTimeout(c),n.signal?.removeEventListener(`abort`,o)}},sendTyping:async t=>{await jt(()=>e.post(`${i(t)}/typing`,void 0,{headers:r}),Mt)},listOpenTickets:()=>jt(()=>e.get(`${n}/tickets/open`,{headers:r}),m(at)),getSpeechToken:()=>jt(()=>e.post(`${n}/speech/token`,void 0,{headers:r}),rt)}},Bt=20,Vt=e=>e instanceof Tt?{code:e.code,message:e.message||M.loadFailed,resetsDateTimeUtc:e.resetsDateTimeUtc}:{code:`unknown`,message:M.loadFailed,resetsDateTimeUtc:null},Ht=e=>{let t=e.client,n=e.pageSize??Bt,r=new Set,i={items:[],totalCount:null,loading:!1,error:null,hasMore:!1},a=0,o=!1,s=e=>{if(!o){i={...i,...e};for(let e of r)e()}};return{getState:()=>i,subscribe:e=>(r.add(e),()=>{r.delete(e)}),load:async()=>{a+=1;let e=a;s({loading:!0,error:null});try{let r=await t.listConversations({page:1,pageSize:n});if(o||e!==a)return;s({items:r.items,totalCount:r.totalCount,hasMore:r.page<r.totalPages||r.totalCountCapped&&r.items.length===n,loading:!1})}catch(t){if(o||e!==a)return;s({loading:!1,error:Vt(t)})}},loadMore:async()=>{if(i.loading||!i.hasMore)return;let e=a,r=Math.floor(i.items.length/n)+1;s({loading:!0,error:null});try{let c=await t.listConversations({page:r,pageSize:n});if(o||e!==a)return;let l=new Set(i.items.map(e=>e.publicId)),u=c.items.filter(e=>!l.has(e.publicId));s({items:[...i.items,...u],totalCount:c.totalCount,hasMore:c.page<c.totalPages||c.totalCountCapped&&c.items.length===n,loading:!1})}catch(t){if(o||e!==a)return;s({loading:!1,error:Vt(t)})}},rename:async(e,n)=>{let r=n.trim();if(await t.renameConversation(e,r),o)return;let a=r.replace(/\s+/g,` `);s({items:i.items.map(t=>t.publicId===e?{...t,title:a}:t)})},remove:async e=>{await t.deleteConversation(e),o||s({items:i.items.filter(t=>t.publicId!==e),totalCount:i.totalCount===null?null:i.totalCount-1})},dispose:()=>{o=!0,r.clear()}}},Ut=class extends Error{code;constructor(e,t){super(t??e),this.name=`ChatSpeechError`,this.code=e}},Wt=`×`,Gt=`[-+\\u2212]?\\d{1,3}`,Kt=new Map([[`times`,Wt],[`cdot`,`·`],[`sum`,`∑`],[`leq`,`≤`],[`le`,`≤`],[`geq`,`≥`],[`ge`,`≥`],[`neq`,`≠`],[`approx`,`≈`],[`pm`,`±`],[`rightarrow`,`→`],[`to`,`→`],[`alpha`,`α`],[`beta`,`β`],[`gamma`,`γ`],[`delta`,`δ`],[`lambda`,`λ`],[`mu`,`μ`],[`pi`,`π`],[`rho`,`ρ`],[`sigma`,`σ`],[`tau`,`τ`],[`Delta`,`Δ`],[`Omega`,`Ω`]]),qt=/\\\((.*?)\\\)|\\\[(.*?)\\\]|\$\$(.*?)\$\$/gs,Jt=/`[^`]+`/g,Yt=/([_^])(\{[^}]*\}|[A-Za-z0-9])/g,Xt=e=>`(?<${e}>\\{\\s*${Gt}\\s*\\}|\\(\\s*${Gt}\\s*\\)|${Gt})`,Zt=`(?<tensMantissa>\\d+(?:\\.\\d+)?) *[xX*] *10 ?\\^ ?${Xt(`tensExp`)}`,Qt=`\\b10 ?\\^ ?${Xt(`powExp`)}`,$t=`(?<![A-Za-z0-9_.#-])(?<etoken>\\d+(?:\\.\\d+)?[eE]${Gt})(?![A-Za-z0-9_.-])`,en=RegExp(`${Zt}|${Qt}|${$t}|(?<![A-Za-z0-9_])(?<symLetter>[A-Za-z])_(?<symSub>[A-Za-z0-9]+)(?<symPrime>')?(?![A-Za-z0-9_])`,`g`),tn=e=>e.replace(/\\(?:left|right)\b/g,``).replace(/\\(?:text|mathrm|mathbf|mathit|operatorname)\{([^{}]*)\}/g,`$1`).replace(/\\frac\{([^{}]*)\}\{([^{}]*)\}/g,`($1)/($2)`).replace(/\\sqrt\{([^{}]*)\}/g,`√($1)`).replace(/\\[,;:! ]/g,` `).replace(/\\([A-Za-z]+)/g,(e,t)=>Kt.get(t)??t),nn=e=>{let t=e.replace(/^[{(]\s*/,``).replace(/\s*[})]$/,``).trim().replace(/\u2212/g,`-`),n=``;return t.startsWith(`-`)?(n=`-`,t=t.slice(1)):t.startsWith(`+`)&&(t=t.slice(1)),t=t.replace(/^0+(?=\d)/,``),t===`0`?`0`:n+t},rn=e=>{if(!Number.isFinite(e))return[{kind:`text`,text:String(e)}];if(e===0)return[{kind:`text`,text:`0`}];if(e<0)return[{kind:`text`,text:`-`},...rn(-e)];let t=Math.floor(Math.log10(e)),n=e/10**t;Number(n.toFixed(2))>=10&&(n/=10,t+=1);let r=Math.abs(n-Math.round(n))<1e-9?String(Math.round(n)):String(Number(n.toFixed(2)));return t===0?[{kind:`text`,text:r}]:[{kind:`text`,text:`${r} ${Wt} 10`},{kind:`sup`,text:String(t)}]},an=(e,t)=>{let n=t.replace(/[{}]/g,``);n!==``&&e.push({kind:`text`,text:n})},on=e=>{let t=[],n=0;for(let r of e.matchAll(Yt)){let{index:i}=r,[,a,o]=r;if(i===void 0||a===void 0||o===void 0)throw Error(`figure script match is incomplete in "${e}"`);an(t,e.slice(n,i));let s=o.startsWith(`{`)?o.slice(1,-1):o;t.push({kind:a===`_`?`sub`:`sup`,text:s}),n=i+r[0].length}return an(t,e.slice(n)),t},sn=e=>{let t=[],n=0;for(let r of e.matchAll(en)){let i=r.index??0;i>n&&t.push({kind:`text`,text:e.slice(n,i)});let a=r.groups??{};a.tensMantissa===void 0?a.powExp===void 0?a.etoken===void 0?(t.push({kind:`text`,text:a.symLetter??``}),t.push({kind:`sub`,text:a.symSub??``}),a.symPrime!==void 0&&t.push({kind:`text`,text:`'`})):t.push(...rn(Number(a.etoken.replace(/\u2212/g,`-`)))):(t.push({kind:`text`,text:`10`}),t.push({kind:`sup`,text:nn(a.powExp)})):(t.push({kind:`text`,text:`${a.tensMantissa} ${Wt} 10`}),t.push({kind:`sup`,text:nn(a.tensExp??``)})),n=i+r[0].length}return n<e.length&&t.push({kind:`text`,text:e.slice(n)}),t},cn=e=>{let t=[],n=0;for(let r of e.matchAll(Jt)){let i=r.index??0;t.push(...sn(e.slice(n,i))),t.push({kind:`text`,text:r[0]}),n=i+r[0].length}return t.push(...sn(e.slice(n))),t},ln=e=>{let t=[];for(let n of e){if(n.text===``)continue;let e=t[t.length-1];n.kind===`text`&&e?.kind===`text`?t[t.length-1]={kind:`text`,text:e.text+n.text}:t.push(n)}return t};function un(e){if(typeof e!=`string`||e===``)return[];let t=[],n=0;for(let r of e.matchAll(qt)){let i=r.index??0;t.push(...cn(e.slice(n,i)));let a=r[1]??r[2]??r[3]??``;t.push(...on(tn(a))),n=i+r[0].length}return t.push(...cn(e.slice(n))),ln(t)}function dn(e){return un(e).map(e=>e.kind===`sup`?`^${e.text}`:e.text).join(``)}function fn(e){return Number.isFinite(e)&&e!==0&&Math.abs(e)<.001?rn(e):Number.isFinite(e)?[{kind:`text`,text:new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:10}).format(e)}]:[{kind:`text`,text:String(e)}]}var pn=/\[([^[\]\n]+)\](?!\()/g,mn=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),hn=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,gn=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,_n=new RegExp(pn.source,`y`),vn=e=>/[\p{L}\p{N}]/u.test(e);function yn(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function bn(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),o=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),s=n===`_`&&vn(e.charAt(i+n.length));if(a&&!o&&!s&&!yn(e,i))return i}return-1}function xn(e,t){let n=t?.isCitation,r=[],i=``,a=()=>{i&&=(r.push({type:`text`,text:i}),``)},o=0;for(;o<e.length;){let s=e.charAt(o),c=e.charAt(o+1);if(s===`\\`&&mn.has(c)){i+=c,o+=2;continue}if(s==="`"){let t=e.indexOf("`",o+1);if(t>o+1){a(),r.push({type:`code`,text:e.slice(o+1,t)}),o=t+1;continue}}let l=s+c;if(l===`**`||l===`__`||l===`~~`){let n=bn(e,o+2,l);if(n!==-1&&!(l===`__`&&vn(e.charAt(o-1)))){a();let i=xn(e.slice(o+2,n),t);l===`~~`?r.push({type:`strike`,children:i}):r.push({type:`strong`,children:i}),o=n+2;continue}i+=l,o+=2}else{if(s===`*`||s===`_`){let n=bn(e,o+1,s);if(n!==-1&&!(s===`_`&&vn(e.charAt(o-1)))){a(),r.push({type:`em`,children:xn(e.slice(o+1,n),t)}),o=n+1;continue}}if(s===`[`){hn.lastIndex=o;let t=hn.exec(e);if(t){let e=t[1],n=t[2];if(e===void 0||n===void 0)throw Error(`The link pattern always captures its label and href`);a(),r.push({type:`link`,href:n,children:xn(e)}),o+=t[0].length;continue}if(n){_n.lastIndex=o;let t=_n.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The citation pattern always captures its inner text`);if(n(e)){a(),r.push({type:`citation`,text:e}),o+=t[0].length;continue}}}}if(s===`!`){gn.lastIndex=o;let t=gn.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The image pattern always captures its alt text`);a(),r.push({type:`image`,children:xn(e)}),o+=t[0].length;continue}}i+=s,o+=1}}return a(),r.map((e,t)=>({...e,key:t}))}var Sn=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,Cn=/^https?:/i,wn=/^(mailto|tel):/i,Tn=/^(?:\/(?![/\\])|#|\?|\.{1,2}\/)/,En=/^https:\/\/[^/?#@\\\s]+$/i,Dn=/^[a-z][a-z0-9+.-]*:/i;function On(e){if(typeof e!=`string`)return null;let t=e.endsWith(`/`)?e.slice(0,-1):e;return En.test(t)?t:null}function kn(e,t,n,r,i){if(n&&(t===`page`||Sn.test(e))){let t=n(e);if(t!=null)return{kind:`app`,target:t}}if(t===`app`)return null;let a=i==null?null:On(i),o=a===null?e:An(e,a);return o===null?null:Tn.test(o)?{kind:`page`,href:o}:t===`page`&&!(Cn.test(o)&&r&&Mn(o,r))?null:Cn.test(o)?{kind:r&&Mn(o,r)?`page`:`web`,href:o}:wn.test(o)?{kind:`contact`,href:o}:null}function An(e,t){if(Dn.test(e))return e;if(e.startsWith(`//`))return`https:${e}`;if(e===``)return null;let n=e.indexOf(`#`),r=n<0?``:e.slice(n),i=n<0?e:e.slice(0,n),a=i.indexOf(`?`),o=a<0?i:i.slice(0,a),s=a<0?``:i.slice(a);return o===``?`${t}${s}${r}`:`${t}${jn(o.startsWith(`/`)?o:`/${o}`)}${s}${r}`}function jn(e){let t=e.split(`/`),n=[];return t.forEach((e,r)=>{let i=r===t.length-1;e===`.`?i&&n.push(``):e===`..`?(n.length>1&&n.pop(),i&&n.push(``)):n.push(e)}),n.join(`/`)}function Mn(e,t){if(e.slice(0,t.length).toLowerCase()!==t.toLowerCase())return!1;let n=e[t.length];return n===void 0||n===`/`||n===`?`||n===`#`}var Nn=/^\s*```/,Pn=/^\s*```\s*(\S*)/,Fn=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,In=/^\s*([-*_])(\s*\1){2,}\s*$/,Ln=/^(\s*)[-*+]\s+(.*)$/,Rn=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,zn=/^\s*>\s?(.*)$/,nee=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,ree=[1,2,3,4,5,6],Bn=e=>e.includes(`|`);function Vn(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function Hn(e,t){let n=e[t];if(n===void 0)throw Error(`startsTable was called past the last source line`);let r=e[t+1];return r!==void 0&&Bn(n)&&r.includes(`|`)&&nee.test(r)}function Un(e,t){let n=e[t];if(n===void 0)throw Error(`startsBlock was called past the last source line`);return Nn.test(n)||zn.test(n)||Ln.test(n)||Rn.test(n)||Fn.test(n)||In.test(n)||Hn(e,t)}function Wn(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function Gn(e){let t=Rn.exec(e);if(t){let e=t[1],n=t[2],r=t[3];if(e===void 0||n===void 0||r===void 0)throw Error(`The ordered list pattern always captures its indent, number and text`);return{text:r,depth:Wn(e),ordered:!0,number:Number(n)}}let n=Ln.exec(e);if(n){let e=n[1],t=n[2];if(e===void 0||t===void 0)throw Error(`The bullet list pattern always captures its indent and text`);return{text:t,depth:Wn(e),ordered:!1,number:0}}return null}function Kn(e){let t=(e??``).replace(/\r\n?/g,`
7
+ `);t=r.pop()??``;for(let e of r)n(e)},end(){let e=t.replace(/\r$/,``);t=``,e.trim()&&n(e)}}},wt=e=>{let t=null,n=null,r=Ct(({name:r,data:i})=>{if(n)return;let a;try{a=St(r,i)}catch(e){if(!(e instanceof o))throw e;n={code:`invalid-response`,message:``};return}a.name===`error`?n={code:a.data.code,message:a.data.message}:(a.name===`messageCompleted`&&(t=a.data.message),e?.(a))});return{push:e=>r.push(e),end:()=>r.end(),get last(){return t},get failure(){return n}}},Tt=class extends Error{code;status;resetsDateTimeUtc;errors;constructor(e,t){super(t.message,`cause`in t?{cause:t.cause}:void 0),this.name=`ChatApiError`,this.code=e,this.status=t.status,this.resetsDateTimeUtc=t.resetsDateTimeUtc??null,this.errors=t.errors??null}},Et=e=>{if(!i(e))return null;let t={errors:e.errors};return typeof e.code==`string`&&(t.code=e.code),typeof e.detail==`string`&&(t.detail=e.detail),typeof e.resetsDateTimeUtc==`string`&&(t.resetsDateTimeUtc=e.resetsDateTimeUtc),t},Dt=e=>{if(typeof e==`string`)try{return Et(JSON.parse(e))}catch{return null}return Et(e)},Ot=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(a(e)))Array.isArray(r)&&typeof r[0]==`string`&&(t[n]=r[0]);return Object.keys(t).length>0?t:null},eee=(e,t)=>{let n=a(e);return!!t?.aborted||n.code===`ERR_CANCELED`||n.name===`CanceledError`||n.name===`AbortError`},kt=(e,t)=>{if(e instanceof Tt)return e;if(eee(e,t))return new Tt(`aborted`,{message:`The request was cancelled.`});let n=a(e).response;if(!n)return new Tt(`network`,{message:M.errorGeneric});let r=a(n),i=Dt(r.data),o=typeof i?.code==`string`&&i.code?i.code:`unknown`,s=typeof i?.detail==`string`&&i.detail?i.detail:M.errorGeneric,c=typeof i?.resetsDateTimeUtc==`string`?i.resetsDateTimeUtc:null;return new Tt(o,{message:s,status:typeof r.status==`number`?r.status:void 0,resetsDateTimeUtc:c,errors:Ot(i?.errors)})},At=e=>{try{return e()}catch(e){throw e instanceof o?new Tt(`invalid-response`,{message:M.errorGeneric,cause:e}):e}},jt=async(e,t)=>{let n;try{n=(await e()).data}catch(e){throw kt(e)}return At(()=>t(n,`response`))},Mt=()=>void 0,Nt=e=>{let t=a(a(e).event).target;if(i(t)&&typeof t.responseText==`string`&&!(typeof t.status==`number`&&(t.status<200||t.status>=300)))return t.responseText},Pt=()=>{let e=bt.createFormData;if(!e)throw Error(`FormData is not available.`);return e()},Ft=e=>typeof a(e).uri==`string`,tee=(e,t)=>{if(Ft(t)){e.append(`file`,t);return}let n=a(t).name;if(typeof n!=`string`||n===``)throw Error(`The file needs a name.`);e.append(`file`,t,n)},It=()=>{let e=bt.crypto;if(e?.randomUUID)return e.randomUUID();if(e?.getRandomValues){let t=e.getRandomValues(new Uint8Array(16));return Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}throw Error(`A chat idempotency key needs crypto.randomUUID or crypto.getRandomValues, and this runtime has neither.`)},Lt=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t},Rt=e=>{let t=``,n=null;return r=>{let i=(t+r).split(`
8
+ `);t=i.pop()??``;for(let t of i){let r=t.endsWith(`\r`)?t.slice(0,-1):t;if(!r.startsWith(`id:`))continue;let i=r.slice(3).replace(/^ /,``);if(!/^\d+$/.test(i))continue;let a=Number(i);(n===null||a>n)&&(n=a,e?.(a))}}},zt=(e,{base:t})=>{if(typeof t!=`string`||t.trim()===``)throw TypeError(`createChatClient needs a base path, e.g. { base: "/api/assistant" }.`);let n=t.replace(/\/+$/,``),r={"Chat-Contract":`4`},i=e=>`${n}/conversations/${encodeURIComponent(e)}`,a=e=>`${n}/attachments/${encodeURIComponent(e)}`,o=e=>`${n}/actions/${encodeURIComponent(e)}`,s=new Map,c=async t=>{let i=t===void 0?``:`?screen=${encodeURIComponent(t)}`;try{let t=await jt(()=>e.get(`${n}/profile${i}`,{headers:r}),tt);if(typeof t?.contractVersion!=`number`||t.contractVersion<4)throw new Tt(`assistant_outdated`,{message:M.assistantOutdated});return t}catch(e){throw e instanceof Tt&&e.status===404?new Tt(`assistant_outdated`,{message:M.assistantOutdated,status:404,cause:e}):e}},l=e=>{let t=e??``,n=s.get(t);return n||(n=c(e).catch(e=>{throw s.delete(t),e}),s.set(t,n)),n},u=async(t,n,r)=>{let i=wt(r.onEvent),a=0,o=e=>{typeof e!=`string`||e.length<=a||(i.push(e.slice(a)),a=e.length)},s;try{s=await e.post(t,n,{responseType:`text`,headers:r.headers,...r.signal===void 0?{}:{signal:r.signal},onDownloadProgress:e=>o(Nt(e))})}catch(e){throw kt(e,r.signal)}o(s.data),i.end();let c=i.failure;if(c)throw new Tt(c.code||`unknown`,{message:c.message||M.errorGeneric});let l=i.last;if(!l)throw new Tt(`invalid-response`,{message:M.errorGeneric,status:s.status});return l};return{getProfile:l,send:(e,t={})=>{let i=Lt({conversationId:e.conversationId,text:e.text,quickReplyId:e.quickReplyId,attachmentIds:e.attachmentIds&&e.attachmentIds.length>0?e.attachmentIds:void 0,replacesMessageId:e.replacesMessageId,pageContext:e.pageContext,captchaToken:e.captchaToken});return u(`${n}/messages`,i,{signal:t.signal,onEvent:t.onEvent,headers:{...r,Accept:`text/event-stream`,"Idempotency-Key":It()}})},answerInput:(e,t,i={})=>{let a=Lt({values:t.values,captchaToken:t.captchaToken,codes:t.codes,attribution:t.attribution});return u(`${n}/inputs/${encodeURIComponent(e)}`,a,{signal:i.signal,onEvent:i.onEvent,headers:{...r,Accept:`text/event-stream`,"Idempotency-Key":It()}})},confirmAction:t=>jt(()=>e.post(`${o(t)}/confirm`,{},{headers:r}),ot),rejectAction:(t,n)=>jt(()=>e.post(`${o(t)}/reject`,n===void 0?{}:{reason:n},{headers:r}),ot),listConversations:(t={})=>{let i=[];t.page!==void 0&&i.push(`page=${encodeURIComponent(String(t.page))}`),t.pageSize!==void 0&&i.push(`pageSize=${encodeURIComponent(String(t.pageSize))}`);let a=i.join(`&`),o=a?`${n}/conversations?${a}`:`${n}/conversations`;return jt(()=>e.get(o,{headers:r}),Oe)},getConversation:(t,n)=>{let a=n===void 0?i(t):`${i(t)}?afterSequence=${n}`;return jt(()=>e.get(a,{headers:r}),Ee)},renameConversation:async(t,n)=>{await jt(()=>e.put(`${i(t)}/title`,{title:n},{headers:r}),Mt)},deleteConversation:async t=>{await jt(()=>e.delete(i(t),{headers:r}),Mt)},rateMessage:async(t,i)=>{let a=typeof i.note==`string`?i.note.trim():``;await jt(()=>e.put(`${n}/messages/${encodeURIComponent(t)}/rating`,{rating:i.rating,note:a||null},{headers:r}),Mt)},uploadAttachment:(t,i={})=>{let a=Pt();return tee(a,t),jt(()=>e.post(`${n}/attachments`,a.native,{headers:{...r,"Content-Type":`multipart/form-data`},timeout:3e5,...i.signal===void 0?{}:{signal:i.signal},onUploadProgress:({loaded:e,total:t})=>{i.onProgress&&t&&i.onProgress((e??0)/t)}}),it)},deleteAttachment:async t=>{await jt(()=>e.delete(a(t),{headers:r}),Mt)},getAttachment:t=>jt(()=>e.get(a(t),{headers:r,responseType:`arraybuffer`}),f),sendOtp:async(t,i)=>{await jt(()=>e.post(`${n}/inputs/${encodeURIComponent(t)}/otp`,i,{headers:r}),Mt)},requestHandoff:(e,t={})=>{let i=typeof e.reason==`string`&&e.reason.trim()!==``?e.reason:void 0;return u(`${n}/handoff`,Lt({conversationId:e.conversationId,reason:i}),{signal:t.signal,onEvent:t.onEvent,headers:{...r,Accept:`text/event-stream`,"Idempotency-Key":It()}})},watchConversation:async(t,n)=>{let a=new bt.AbortController,o=()=>a.abort();n.signal?.aborted&&a.abort(),n.signal?.addEventListener(`abort`,o);let s=!1,c=null,l=()=>{c!==null&&bt.clearTimeout(c),c=bt.setTimeout(()=>{s=!0,a.abort()},n.stallTimeoutMs??9e4)},u=Rt(n.onCursor),d=wt(n.onEvent),f=0,p=e=>{if(typeof e!=`string`||e.length<=f)return;let t=e.slice(f);f=e.length,u(t),d.push(t),d.failure&&a.abort()},m={...r,Accept:`text/event-stream`};typeof n.afterSequence==`number`&&Number.isFinite(n.afterSequence)&&(m[`Last-Event-ID`]=String(n.afterSequence)),l();try{p((await e.get(`${i(t)}/events`,{headers:m,responseType:`text`,timeout:0,signal:a.signal,onDownloadProgress:e=>{let t=Nt(e);t!==void 0&&(l(),p(t))}})).data),u(`
9
+ `),d.end();let n=d.failure;if(n)throw new Tt(n.code||`unknown`,{message:n.message||M.errorGeneric})}catch(e){if(n.signal?.aborted)return;let t=d.failure;throw t?new Tt(t.code||`unknown`,{message:t.message||M.errorGeneric,cause:e}):s?new Tt(`stalled`,{message:M.errorGeneric,cause:e}):kt(e,a.signal)}finally{c!==null&&bt.clearTimeout(c),n.signal?.removeEventListener(`abort`,o)}},sendTyping:async t=>{await jt(()=>e.post(`${i(t)}/typing`,void 0,{headers:r}),Mt)},listOpenTickets:()=>jt(()=>e.get(`${n}/tickets/open`,{headers:r}),m(at)),getSpeechToken:()=>jt(()=>e.post(`${n}/speech/token`,void 0,{headers:r}),rt)}},Bt=20,Vt=e=>e instanceof Tt?{code:e.code,message:e.message||M.loadFailed,resetsDateTimeUtc:e.resetsDateTimeUtc}:{code:`unknown`,message:M.loadFailed,resetsDateTimeUtc:null},Ht=e=>{let t=e.client,n=e.pageSize??Bt,r=new Set,i={items:[],totalCount:null,loading:!1,error:null,hasMore:!1},a=0,o=!1,s=e=>{if(!o){i={...i,...e};for(let e of r)e()}};return{getState:()=>i,subscribe:e=>(r.add(e),()=>{r.delete(e)}),load:async()=>{a+=1;let e=a;s({loading:!0,error:null});try{let r=await t.listConversations({page:1,pageSize:n});if(o||e!==a)return;s({items:r.items,totalCount:r.totalCount,hasMore:r.page<r.totalPages||r.totalCountCapped&&r.items.length===n,loading:!1})}catch(t){if(o||e!==a)return;s({loading:!1,error:Vt(t)})}},loadMore:async()=>{if(i.loading||!i.hasMore)return;let e=a,r=Math.floor(i.items.length/n)+1;s({loading:!0,error:null});try{let c=await t.listConversations({page:r,pageSize:n});if(o||e!==a)return;let l=new Set(i.items.map(e=>e.publicId)),u=c.items.filter(e=>!l.has(e.publicId));s({items:[...i.items,...u],totalCount:c.totalCount,hasMore:c.page<c.totalPages||c.totalCountCapped&&c.items.length===n,loading:!1})}catch(t){if(o||e!==a)return;s({loading:!1,error:Vt(t)})}},rename:async(e,n)=>{let r=n.trim();if(await t.renameConversation(e,r),o)return;let a=r.replace(/\s+/g,` `);s({items:i.items.map(t=>t.publicId===e?{...t,title:a}:t)})},remove:async e=>{await t.deleteConversation(e),o||s({items:i.items.filter(t=>t.publicId!==e),totalCount:i.totalCount===null?null:i.totalCount-1})},dispose:()=>{o=!0,r.clear()}}},Ut=class extends Error{code;constructor(e,t={}){super(t.message??e,`cause`in t?{cause:t.cause}:void 0),this.name=`ChatSpeechError`,this.code=e}},Wt=`×`,Gt=`[-+\\u2212]?\\d{1,3}`,Kt=new Map([[`times`,Wt],[`cdot`,`·`],[`sum`,`∑`],[`leq`,`≤`],[`le`,`≤`],[`geq`,`≥`],[`ge`,`≥`],[`neq`,`≠`],[`approx`,`≈`],[`pm`,`±`],[`rightarrow`,`→`],[`to`,`→`],[`alpha`,`α`],[`beta`,`β`],[`gamma`,`γ`],[`delta`,`δ`],[`lambda`,`λ`],[`mu`,`μ`],[`pi`,`π`],[`rho`,`ρ`],[`sigma`,`σ`],[`tau`,`τ`],[`Delta`,`Δ`],[`Omega`,`Ω`]]),qt=/\\\((.*?)\\\)|\\\[(.*?)\\\]|\$\$(.*?)\$\$/gs,Jt=/`[^`]+`/g,Yt=/([_^])(\{[^}]*\}|[A-Za-z0-9])/g,Xt=e=>`(?<${e}>\\{\\s*${Gt}\\s*\\}|\\(\\s*${Gt}\\s*\\)|${Gt})`,Zt=`(?<tensMantissa>\\d+(?:\\.\\d+)?) *[xX*] *10 ?\\^ ?${Xt(`tensExp`)}`,Qt=`\\b10 ?\\^ ?${Xt(`powExp`)}`,$t=`(?<![A-Za-z0-9_.#-])(?<etoken>\\d+(?:\\.\\d+)?[eE]${Gt})(?![A-Za-z0-9_.-])`,en=RegExp(`${Zt}|${Qt}|${$t}|(?<![A-Za-z0-9_])(?<symLetter>[A-Za-z])_(?<symSub>[A-Za-z0-9]+)(?<symPrime>')?(?![A-Za-z0-9_])`,`g`),tn=e=>e.replace(/\\(?:left|right)\b/g,``).replace(/\\(?:text|mathrm|mathbf|mathit|operatorname)\{([^{}]*)\}/g,`$1`).replace(/\\frac\{([^{}]*)\}\{([^{}]*)\}/g,`($1)/($2)`).replace(/\\sqrt\{([^{}]*)\}/g,`√($1)`).replace(/\\[,;:! ]/g,` `).replace(/\\([A-Za-z]+)/g,(e,t)=>Kt.get(t)??t),nn=e=>{let t=e.replace(/^[{(]\s*/,``).replace(/\s*[})]$/,``).trim().replace(/\u2212/g,`-`),n=``;return t.startsWith(`-`)?(n=`-`,t=t.slice(1)):t.startsWith(`+`)&&(t=t.slice(1)),t=t.replace(/^0+(?=\d)/,``),t===`0`?`0`:n+t},rn=e=>{if(!Number.isFinite(e))return[{kind:`text`,text:String(e)}];if(e===0)return[{kind:`text`,text:`0`}];if(e<0)return[{kind:`text`,text:`-`},...rn(-e)];let t=Math.floor(Math.log10(e)),n=e/10**t;Number(n.toFixed(2))>=10&&(n/=10,t+=1);let r=Math.abs(n-Math.round(n))<1e-9?String(Math.round(n)):String(Number(n.toFixed(2)));return t===0?[{kind:`text`,text:r}]:[{kind:`text`,text:`${r} ${Wt} 10`},{kind:`sup`,text:String(t)}]},an=(e,t)=>{let n=t.replace(/[{}]/g,``);n!==``&&e.push({kind:`text`,text:n})},on=e=>{let t=[],n=0;for(let r of e.matchAll(Yt)){let{index:i}=r,[,a,o]=r;if(i===void 0||a===void 0||o===void 0)throw Error(`figure script match is incomplete in "${e}"`);an(t,e.slice(n,i));let s=o.startsWith(`{`)?o.slice(1,-1):o;t.push({kind:a===`_`?`sub`:`sup`,text:s}),n=i+r[0].length}return an(t,e.slice(n)),t},sn=e=>{let t=[],n=0;for(let r of e.matchAll(en)){let i=r.index??0;i>n&&t.push({kind:`text`,text:e.slice(n,i)});let a=r.groups??{};a.tensMantissa===void 0?a.powExp===void 0?a.etoken===void 0?(t.push({kind:`text`,text:a.symLetter??``}),t.push({kind:`sub`,text:a.symSub??``}),a.symPrime!==void 0&&t.push({kind:`text`,text:`'`})):t.push(...rn(Number(a.etoken.replace(/\u2212/g,`-`)))):(t.push({kind:`text`,text:`10`}),t.push({kind:`sup`,text:nn(a.powExp)})):(t.push({kind:`text`,text:`${a.tensMantissa} ${Wt} 10`}),t.push({kind:`sup`,text:nn(a.tensExp??``)})),n=i+r[0].length}return n<e.length&&t.push({kind:`text`,text:e.slice(n)}),t},cn=e=>{let t=[],n=0;for(let r of e.matchAll(Jt)){let i=r.index??0;t.push(...sn(e.slice(n,i))),t.push({kind:`text`,text:r[0]}),n=i+r[0].length}return t.push(...sn(e.slice(n))),t},ln=e=>{let t=[];for(let n of e){if(n.text===``)continue;let e=t[t.length-1];n.kind===`text`&&e?.kind===`text`?t[t.length-1]={kind:`text`,text:e.text+n.text}:t.push(n)}return t};function un(e){if(typeof e!=`string`||e===``)return[];let t=[],n=0;for(let r of e.matchAll(qt)){let i=r.index??0;t.push(...cn(e.slice(n,i)));let a=r[1]??r[2]??r[3]??``;t.push(...on(tn(a))),n=i+r[0].length}return t.push(...cn(e.slice(n))),ln(t)}function dn(e){return un(e).map(e=>e.kind===`sup`?`^${e.text}`:e.text).join(``)}function fn(e){return Number.isFinite(e)&&e!==0&&Math.abs(e)<.001?rn(e):Number.isFinite(e)?[{kind:`text`,text:new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:10}).format(e)}]:[{kind:`text`,text:String(e)}]}var pn=/\[([^[\]\n]+)\](?!\()/g,mn=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),hn=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,gn=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,_n=new RegExp(pn.source,`y`),vn=e=>/[\p{L}\p{N}]/u.test(e);function yn(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function bn(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),o=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),s=n===`_`&&vn(e.charAt(i+n.length));if(a&&!o&&!s&&!yn(e,i))return i}return-1}function xn(e,t){let n=t?.isCitation,r=[],i=``,a=()=>{i&&=(r.push({type:`text`,text:i}),``)},o=0;for(;o<e.length;){let s=e.charAt(o),c=e.charAt(o+1);if(s===`\\`&&mn.has(c)){i+=c,o+=2;continue}if(s==="`"){let t=e.indexOf("`",o+1);if(t>o+1){a(),r.push({type:`code`,text:e.slice(o+1,t)}),o=t+1;continue}}let l=s+c;if(l===`**`||l===`__`||l===`~~`){let n=bn(e,o+2,l);if(n!==-1&&!(l===`__`&&vn(e.charAt(o-1)))){a();let i=xn(e.slice(o+2,n),t);l===`~~`?r.push({type:`strike`,children:i}):r.push({type:`strong`,children:i}),o=n+2;continue}i+=l,o+=2}else{if(s===`*`||s===`_`){let n=bn(e,o+1,s);if(n!==-1&&!(s===`_`&&vn(e.charAt(o-1)))){a(),r.push({type:`em`,children:xn(e.slice(o+1,n),t)}),o=n+1;continue}}if(s===`[`){hn.lastIndex=o;let t=hn.exec(e);if(t){let e=t[1],n=t[2];if(e===void 0||n===void 0)throw Error(`The link pattern always captures its label and href`);a(),r.push({type:`link`,href:n,children:xn(e)}),o+=t[0].length;continue}if(n){_n.lastIndex=o;let t=_n.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The citation pattern always captures its inner text`);if(n(e)){a(),r.push({type:`citation`,text:e}),o+=t[0].length;continue}}}}if(s===`!`){gn.lastIndex=o;let t=gn.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The image pattern always captures its alt text`);a(),r.push({type:`image`,children:xn(e)}),o+=t[0].length;continue}}i+=s,o+=1}}return a(),r.map((e,t)=>({...e,key:t}))}var Sn=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,Cn=/^https?:/i,wn=/^(mailto|tel):/i,Tn=/^(?:\/(?![/\\])|#|\?|\.{1,2}\/)/,En=/^https:\/\/[^/?#@\\\s]+$/i,Dn=/^[a-z][a-z0-9+.-]*:/i;function On(e){if(typeof e!=`string`)return null;let t=e.endsWith(`/`)?e.slice(0,-1):e;return En.test(t)?t:null}function kn(e,t,n,r,i){if(n&&(t===`page`||Sn.test(e))){let t=n(e);if(t!=null)return{kind:`app`,target:t}}if(t===`app`)return null;let a=i==null?null:On(i),o=a===null?e:An(e,a);return o===null?null:Tn.test(o)?{kind:`page`,href:o}:t===`page`&&!(Cn.test(o)&&r&&Mn(o,r))?null:Cn.test(o)?{kind:r&&Mn(o,r)?`page`:`web`,href:o}:wn.test(o)?{kind:`contact`,href:o}:null}function An(e,t){if(Dn.test(e))return e;if(e.startsWith(`//`))return`https:${e}`;if(e===``)return null;let n=e.indexOf(`#`),r=n<0?``:e.slice(n),i=n<0?e:e.slice(0,n),a=i.indexOf(`?`),o=a<0?i:i.slice(0,a),s=a<0?``:i.slice(a);return o===``?`${t}${s}${r}`:`${t}${jn(o.startsWith(`/`)?o:`/${o}`)}${s}${r}`}function jn(e){let t=e.split(`/`),n=[];return t.forEach((e,r)=>{let i=r===t.length-1;e===`.`?i&&n.push(``):e===`..`?(n.length>1&&n.pop(),i&&n.push(``)):n.push(e)}),n.join(`/`)}function Mn(e,t){if(e.slice(0,t.length).toLowerCase()!==t.toLowerCase())return!1;let n=e[t.length];return n===void 0||n===`/`||n===`?`||n===`#`}var Nn=/^\s*```/,Pn=/^\s*```\s*(\S*)/,Fn=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,In=/^\s*([-*_])(\s*\1){2,}\s*$/,Ln=/^(\s*)[-*+]\s+(.*)$/,Rn=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,zn=/^\s*>\s?(.*)$/,nee=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,ree=[1,2,3,4,5,6],Bn=e=>e.includes(`|`);function Vn(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function Hn(e,t){let n=e[t];if(n===void 0)throw Error(`startsTable was called past the last source line`);let r=e[t+1];return r!==void 0&&Bn(n)&&r.includes(`|`)&&nee.test(r)}function Un(e,t){let n=e[t];if(n===void 0)throw Error(`startsBlock was called past the last source line`);return Nn.test(n)||zn.test(n)||Ln.test(n)||Rn.test(n)||Fn.test(n)||In.test(n)||Hn(e,t)}function Wn(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function Gn(e){let t=Rn.exec(e);if(t){let e=t[1],n=t[2],r=t[3];if(e===void 0||n===void 0||r===void 0)throw Error(`The ordered list pattern always captures its indent, number and text`);return{text:r,depth:Wn(e),ordered:!0,number:Number(n)}}let n=Ln.exec(e);if(n){let e=n[1],t=n[2];if(e===void 0||t===void 0)throw Error(`The bullet list pattern always captures its indent and text`);return{text:t,depth:Wn(e),ordered:!1,number:0}}return null}function Kn(e){let t=(e??``).replace(/\r\n?/g,`
10
10
  `).split(`
11
11
  `),n=[],r=0;for(;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()){r+=1;continue}if(Nn.test(e)){let i=Pn.exec(e)?.[1]||null,a=[];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(Nn.test(e))break;a.push(e),r+=1}r+=1,n.push({type:`code`,text:a.join(`
12
12
  `),language:i});continue}if(Hn(t,r)){let i=Vn(e),a=[];for(r+=2;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||!Bn(e))break;a.push(Vn(e)),r+=1}n.push({type:`table`,header:i,rows:a});continue}if(In.test(e)){n.push({type:`rule`}),r+=1;continue}let i=Fn.exec(e);if(i){let e=i[1],t=i[2];if(e===void 0||t===void 0)throw Error(`The heading pattern always captures its hashes and text`);let a=ree[e.length-1];if(a===void 0)throw Error(`The heading pattern always captures one to six hashes`);n.push({type:`heading`,level:a,text:t}),r+=1;continue}if(zn.test(e)){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);let i=zn.exec(n);if(!i)break;let a=i[1];if(a===void 0)throw Error(`The quote pattern always captures its text`);e.push(a),r+=1}n.push({type:`quote`,lines:e});continue}let a=Gn(e);if(a){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);if(!n.trim())break;let i=Gn(n);if(i){if(i.depth===0&&i.ordered!==a.ordered)break;e.push(i)}else if(Un(t,r))break;else{let t=e[e.length-1];if(t===void 0)throw Error(`A list continuation line follows a list with no item`);t.text+=` ${n.trim()}`}r+=1}n.push({type:`list`,ordered:a.ordered,start:a.ordered?a.number:1,items:e});continue}let o=[e];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||Un(t,r))break;o.push(e),r+=1}n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var qn=e=>e.map(e=>e.type===`text`||e.type===`code`||e.type===`citation`?e.text:qn(e.children)).join(``),Jn=e=>qn(xn(e));function Yn(e){switch(e.type){case`paragraph`:case`quote`:return Jn(e.lines.join(` `));case`heading`:return Jn(e.text);case`list`:return e.items.map(e=>Jn(e.text)).join(`. `);case`table`:return[e.header,...e.rows].map(e=>e.map(Jn).join(`, `)).join(`. `);case`code`:return e.text;case`rule`:return``}}function Xn(e){return Kn(e).map(Yn).filter(Boolean).join(`
13
13
  `)}var Zn=[`KB`,`MB`,`GB`],Qn=e=>{if(e<1024)return`${e} B`;let t=e/1024,n=0;for(;t>=1024&&n<Zn.length-1;)t/=1024,n+=1;return`${t.toFixed(1)} ${Zn[n]}`},$n=new Intl.DateTimeFormat(`en-GB`,{timeZone:`Asia/Kolkata`,day:`2-digit`,month:`short`,year:`numeric`}),er=e=>$n.format(new Date(e)).replace(/ /g,`-`),tr=864e5,nr=(e,t,n=new Date)=>{let r=er(e);return r===er(n.toISOString())?t.today:r===er(new Date(n.getTime()-tr).toISOString())?t.yesterday:r},rr=e=>e.flatMap(e=>e.kind===`Text`?[Xn(e.text)]:e.kind===`Notice`?[e.text]:[]).filter(e=>e!==``).join(`
14
14
 
15
- `).trim(),ir=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],ar=`-`,or=new Intl.DateTimeFormat(`en-IN`,{timeZone:`Asia/Kolkata`,day:`2-digit`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0}),sr=e=>{let t=Date.parse(e);if(Number.isNaN(t))return ar;let n=or.formatToParts(t),r=e=>n.find(t=>t.type===e)?.value??``;return`${r(`day`)}-${ir[Number(r(`month`))-1]}-${r(`year`)}, ${r(`hour`)}:${r(`minute`)} ${r(`dayPeriod`).toUpperCase()}`},cr=new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:0}),lr=new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:3}),ur=new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:2}),dr=new Intl.NumberFormat(`en-IN`,{minimumFractionDigits:2,maximumFractionDigits:2}),fr=/^\d{4}-\d{2}-\d{2}$/,pr=e=>fr.test(e)?Date.parse(`${e}T00:00:00+05:30`):Date.parse(e),mr=e=>e.map(e=>e.kind===`sup`?`^${e.text}`:e.text).join(``),hr=(e,t)=>{if(t===null)return dr.format(e/100);try{let n=new Intl.NumberFormat(`en-IN`,{style:`currency`,currency:t}),r=n.resolvedOptions().maximumFractionDigits;if(r===void 0)throw Error(`No fraction digits resolved for currency ${t}.`);return n.format(e/10**r)}catch(n){if(!(n instanceof RangeError))throw n;return`${dr.format(e/100)} ${t.toUpperCase()}`}},gr=(e,t,n)=>{if(e==null||e===``)return ar;if(t===`Text`)return String(e);if(t===`Date`){let t=pr(String(e));return Number.isNaN(t)?ar:$n.format(t).replace(/ /g,`-`)}if(t===`DateTimeUtc`)return sr(String(e));let r=Number(e);return Number.isFinite(r)?t===`Integer`?cr.format(r):t===`Decimal`?r!==0&&Math.abs(r)<.001?mr(fn(r)):lr.format(r):t===`Percent`?`${ur.format(r)}%`:hr(r,n):String(e)},_r=/^https?:\/\/([^@/?#:]+)(?::\d+)?(?=[/?#]|$)/i;function vr(e,t){if(typeof e!=`string`||e===``||/[\t\n\r]/.test(e))return!1;if(e[0]===`/`)return e[1]!==`/`&&e[1]!==`\\`;if(t===void 0||t.length===0)return!1;let n=_r.exec(e);if(n===null)return!1;let r=n[1];if(r===void 0)return!1;let i=r.toLowerCase();return t.some(e=>e.toLowerCase()===i)}var yr=/^https?:\/\//i,br=e=>typeof e==`string`&&yr.test(e),xr={launcher:{style:`Round`,entrance:`Rise`,idle:`None`,labelReveal:`Bubble`,compact:!1,mark:`Icon`},panel:{motion:`Spring`,widthPx:420,maxHeightPx:650,bottomGapPx:80,height:`Fixed`,replyAvatars:!0,greetingLoaderMs:0},phone:{maxWidthPx:768,mode:`FullScreen`,sheetHeightDvh:85,sheetMaxHeightPx:640},input:{ring:!0,sendReveal:`OnText`,sendIcon:`arrow-up`},avoid:{liftSelectors:[`footer`,`.form-actions-sticky`,`.wui-tabbar`],menuSelectors:[`.offcanvas.show`,`wui-drawer[open]`,`[data-menu-open]`],darkSelectors:[`[data-theme='dark']`,`[data-bs-theme='dark']`],autoOpenOptOutSelector:`[data-chat-no-autoopen]`,autoOpenBusySelectors:[`[data-chat-busy]`]},motion:`On`,avatar:null,expressive:!1};function Sr(e){let t=e??{};return{launcher:{...xr.launcher,...t.launcher},panel:{...xr.panel,...t.panel},phone:{...xr.phone,...t.phone},input:{...xr.input,...t.input},avoid:{...xr.avoid,...t.avoid},motion:t.motion??xr.motion,avatar:t.avatar??xr.avatar,expressive:t.expressive??xr.expressive}}var Cr=(e,t,n)=>n||!t.typingPause?0:Math.min(t.pauseBaseMs+t.pausePerCharMs*e.length,t.pauseMaxMs),wr=new Set([`stalled`,`network`,`invalid-response`,`stream_ended`]),Tr=e=>e instanceof Tt?wr.has(e.code)?!0:e.status===408||e.status===429||e.status!==void 0&&e.status>=500:!1;function Er(e){let t=e.baseDelayMs??1e3,n=e.maxDelayMs??3e4,r=e.maxFailedAttempts??10,i=!1,a=null,o=null,s=null,c=0,l=0,u=0,d=e=>new Promise(t=>{s=t,o=bt.setTimeout(()=>{o=null,s=null,t()},e)});return(async()=>{for(;!i;){if(u>0&&(await Promise.allSettled([e.beforeReconnect()]),i))return;e.onStatus(`Connecting`);let o=new bt.AbortController;a=o;let s=!1,f=!1,p=null,m=()=>{i||(s=!0,c=0,l=0,f||(f=!0,e.onStatus(`Live`)))};try{await e.watch(e.getCursor(),o.signal,m)}catch(t){if(i)return;if(!Tr(t)){e.onError(t),e.onStatus(`Lost`);return}p=t}if(i)return;a=null;let h=Math.min(n,t*2**l);if(s||(c+=1,l+=1),c>=r){e.onError(p??new Tt(`connection_lost`,M.errorGeneric)),e.onStatus(`Lost`);return}await d(h),u+=1}})().catch(t=>e.onError(t)),{stop(){i||(i=!0,a?.abort(),a=null,o!==null&&(bt.clearTimeout(o),o=null),s?.(),s=null)}}}var Dr=e=>e.replace(/[-_]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/\s+/g,` `).trim(),Or=(e,t)=>e===`/`||t===e||t.startsWith(`${e}/`),kr=(e,t)=>{let n=e.starters,r=null;for(let n of e.pageRules)Or(n.pathPrefix,t.pathname)&&(r===null||n.pathPrefix.length>r.pathPrefix.length)&&(r=n);r?.starters&&(n=r.starters),t.returning&&e.returningStarters&&(n=e.returningStarters);let i=t.behaviour;if(t.behaviourStarters&&i&&e.rules){let t=e.rules.find(e=>(e.minTimeOnSiteSeconds===null||i.timeOnSiteSeconds>=e.minTimeOnSiteSeconds)&&(e.minScrollPercent===null||i.scrollPercent>=e.minScrollPercent)&&(e.minPagesViewed===null||i.pagesViewed>=e.minPagesViewed)&&(e.minServicesViewed===null||i.viewedServices.length>=e.minServicesViewed));t&&(n=[...t.starters,...n.slice(0,t.keepPageStarters)])}let a=e.behaviour?.recentServiceStarter,o=i?.viewedServices[i.viewedServices.length-1];if(t.behaviourStarters&&i&&a&&o!==void 0){let e=Dr(o),t=e.toLowerCase(),r=n.some(e=>e.label.toLowerCase().includes(t));if(e!==``&&!r){let t=a.replace(/\{service\}/g,e);n=[{id:`recent-service`,label:t,message:t,icon:null,variant:null},...n]}}let s=e.behaviour?.maxStarters;return s===void 0?[...n]:n.slice(0,s)},Ar=5e3,jr=3e3,Mr=300,Nr=1200,Pr=e=>{if(bt.requestAnimationFrame&&bt.cancelAnimationFrame){let t=bt.requestAnimationFrame(()=>e());return()=>bt.cancelAnimationFrame?.(t)}let t=bt.setTimeout(e,16);return()=>bt.clearTimeout(t)},Fr=e=>{let t=a(e);return{code:typeof t.code==`string`&&t.code?t.code:`unknown`,message:typeof t.message==`string`&&t.message?t.message:M.errorGeneric,resetsDateTimeUtc:typeof t.resetsDateTimeUtc==`string`?t.resetsDateTimeUtc:null}},Ir=(e,t)=>({id:e.publicId,author:e.author,createdDateTimeUtc:e.createdDateTimeUtc,parts:e.parts,sequence:e.sequence,rating:e.rating,ratingNote:e.ratingNote,streaming:!1,stored:!0,restored:t}),Lr=(e,t)=>{let n=e.findIndex(e=>e.id===t.id);return n<0?[...e,t]:e.map((e,r)=>r===n?t:e)},Rr=(e,t)=>{for(let n=e.length-1;n>=0;--n){let r=e[n];if(r!==void 0&&t(r))return n}return-1},zr=e=>e.flatMap(e=>e.kind===`Text`?[e.text]:[]).join(`
15
+ `).trim(),ir=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],ar=`-`,or=new Intl.DateTimeFormat(`en-IN`,{timeZone:`Asia/Kolkata`,day:`2-digit`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0}),sr=e=>{let t=Date.parse(e);if(Number.isNaN(t))return ar;let n=or.formatToParts(t),r=e=>n.find(t=>t.type===e)?.value??``;return`${r(`day`)}-${ir[Number(r(`month`))-1]}-${r(`year`)}, ${r(`hour`)}:${r(`minute`)} ${r(`dayPeriod`).toUpperCase()}`},cr=new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:0}),lr=new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:3}),ur=new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:2}),dr=new Intl.NumberFormat(`en-IN`,{minimumFractionDigits:2,maximumFractionDigits:2}),fr=/^\d{4}-\d{2}-\d{2}$/,pr=e=>fr.test(e)?Date.parse(`${e}T00:00:00+05:30`):Date.parse(e),mr=e=>e.map(e=>e.kind===`sup`?`^${e.text}`:e.text).join(``),hr=(e,t)=>{if(t===null)return dr.format(e/100);try{let n=new Intl.NumberFormat(`en-IN`,{style:`currency`,currency:t}),r=n.resolvedOptions().maximumFractionDigits;if(r===void 0)throw Error(`No fraction digits resolved for currency ${t}.`);return n.format(e/10**r)}catch(n){if(!(n instanceof RangeError))throw n;return`${dr.format(e/100)} ${t.toUpperCase()}`}},gr=(e,t,n)=>{if(e==null||e===``)return ar;if(t===`Text`)return String(e);if(t===`Date`){let t=pr(String(e));return Number.isNaN(t)?ar:$n.format(t).replace(/ /g,`-`)}if(t===`DateTimeUtc`)return sr(String(e));let r=Number(e);return Number.isFinite(r)?t===`Integer`?cr.format(r):t===`Decimal`?r!==0&&Math.abs(r)<.001?mr(fn(r)):lr.format(r):t===`Percent`?`${ur.format(r)}%`:hr(r,n):String(e)},_r=/^https?:\/\/([^@/?#:]+)(?::\d+)?(?=[/?#]|$)/i;function vr(e,t){if(typeof e!=`string`||e===``||/[\t\n\r]/.test(e))return!1;if(e[0]===`/`)return e[1]!==`/`&&e[1]!==`\\`;if(t===void 0||t.length===0)return!1;let n=_r.exec(e);if(n===null)return!1;let r=n[1];if(r===void 0)return!1;let i=r.toLowerCase();return t.some(e=>e.toLowerCase()===i)}var yr=/^https?:\/\//i,br=e=>typeof e==`string`&&yr.test(e),xr={launcher:{style:`Round`,entrance:`Rise`,idle:`None`,labelReveal:`Bubble`,compact:!1,mark:`Icon`},panel:{motion:`Spring`,widthPx:420,maxHeightPx:650,bottomGapPx:80,height:`Fixed`,replyAvatars:!0,greetingLoaderMs:0},phone:{maxWidthPx:768,mode:`FullScreen`,sheetHeightDvh:85,sheetMaxHeightPx:640},input:{ring:!0,sendReveal:`OnText`,sendIcon:`arrow-up`},avoid:{liftSelectors:[`footer`,`.form-actions-sticky`,`.wui-tabbar`],menuSelectors:[`.offcanvas.show`,`wui-drawer[open]`,`[data-menu-open]`],darkSelectors:[`[data-theme='dark']`,`[data-bs-theme='dark']`],autoOpenOptOutSelector:`[data-chat-no-autoopen]`,autoOpenBusySelectors:[`[data-chat-busy]`]},motion:`On`,avatar:null,expressive:!1};function Sr(e){let t=e??{};return{launcher:{...xr.launcher,...t.launcher},panel:{...xr.panel,...t.panel},phone:{...xr.phone,...t.phone},input:{...xr.input,...t.input},avoid:{...xr.avoid,...t.avoid},motion:t.motion??xr.motion,avatar:t.avatar??xr.avatar,expressive:t.expressive??xr.expressive}}var Cr=(e,t,n)=>n||!t.typingPause?0:Math.min(t.pauseBaseMs+t.pausePerCharMs*e.length,t.pauseMaxMs),wr=new Set([`stalled`,`network`,`invalid-response`,`stream_ended`]),Tr=e=>e instanceof Tt?wr.has(e.code)?!0:e.status===408||e.status===429||e.status!==void 0&&e.status>=500:!1;function Er(e){let t=e.baseDelayMs??1e3,n=e.maxDelayMs??3e4,r=e.maxFailedAttempts??10,i=!1,a=null,o=null,s=null,c=0,l=0,u=0,d=e=>new Promise(t=>{s=t,o=bt.setTimeout(()=>{o=null,s=null,t()},e)});return(async()=>{for(;!i;){if(u>0&&(await Promise.allSettled([e.beforeReconnect()]),i))return;e.onStatus(`Connecting`);let o=new bt.AbortController;a=o;let s=!1,f=!1,p=null,m=()=>{i||(s=!0,c=0,l=0,f||(f=!0,e.onStatus(`Live`)))};try{await e.watch(e.getCursor(),o.signal,m)}catch(t){if(i)return;if(!Tr(t)){e.onError(t),e.onStatus(`Lost`);return}p=t}if(i)return;a=null;let h=Math.min(n,t*2**l);if(s||(c+=1,l+=1),c>=r){e.onError(p??new Tt(`connection_lost`,{message:M.errorGeneric})),e.onStatus(`Lost`);return}await d(h),u+=1}})().catch(t=>e.onError(t)),{stop(){i||(i=!0,a?.abort(),a=null,o!==null&&(bt.clearTimeout(o),o=null),s?.(),s=null)}}}var Dr=e=>e.replace(/[-_]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/\s+/g,` `).trim(),Or=(e,t)=>e===`/`||t===e||t.startsWith(`${e}/`),kr=(e,t)=>{let n=e.starters,r=null;for(let n of e.pageRules)Or(n.pathPrefix,t.pathname)&&(r===null||n.pathPrefix.length>r.pathPrefix.length)&&(r=n);r?.starters&&(n=r.starters),t.returning&&e.returningStarters&&(n=e.returningStarters);let i=t.behaviour;if(t.behaviourStarters&&i&&e.rules){let t=e.rules.find(e=>(e.minTimeOnSiteSeconds===null||i.timeOnSiteSeconds>=e.minTimeOnSiteSeconds)&&(e.minScrollPercent===null||i.scrollPercent>=e.minScrollPercent)&&(e.minPagesViewed===null||i.pagesViewed>=e.minPagesViewed)&&(e.minServicesViewed===null||i.viewedServices.length>=e.minServicesViewed));t&&(n=[...t.starters,...n.slice(0,t.keepPageStarters)])}let a=e.behaviour?.recentServiceStarter,o=i?.viewedServices[i.viewedServices.length-1];if(t.behaviourStarters&&i&&a&&o!==void 0){let e=Dr(o),t=e.toLowerCase(),r=n.some(e=>e.label.toLowerCase().includes(t));if(e!==``&&!r){let t=a.replace(/\{service\}/g,e);n=[{id:`recent-service`,label:t,message:t,icon:null,variant:null},...n]}}let s=e.behaviour?.maxStarters;return s===void 0?[...n]:n.slice(0,s)},Ar=5e3,jr=3e3,Mr=300,Nr=1200,Pr=e=>{if(bt.requestAnimationFrame&&bt.cancelAnimationFrame){let t=bt.requestAnimationFrame(()=>e());return()=>bt.cancelAnimationFrame?.(t)}let t=bt.setTimeout(e,16);return()=>bt.clearTimeout(t)},Fr=e=>{let t=a(e);return{code:typeof t.code==`string`&&t.code?t.code:`unknown`,message:typeof t.message==`string`&&t.message?t.message:M.errorGeneric,resetsDateTimeUtc:typeof t.resetsDateTimeUtc==`string`?t.resetsDateTimeUtc:null}},Ir=(e,t)=>({id:e.publicId,author:e.author,createdDateTimeUtc:e.createdDateTimeUtc,parts:e.parts,sequence:e.sequence,rating:e.rating,ratingNote:e.ratingNote,streaming:!1,stored:!0,restored:t}),Lr=(e,t)=>{let n=e.findIndex(e=>e.id===t.id);return n<0?[...e,t]:e.map((e,r)=>r===n?t:e)},Rr=(e,t)=>{for(let n=e.length-1;n>=0;--n){let r=e[n];if(r!==void 0&&t(r))return n}return-1},zr=e=>e.flatMap(e=>e.kind===`Text`?[e.text]:[]).join(`
16
16
 
17
- `),Br=e=>e.flatMap(e=>e.kind===`File`?[{publicId:e.attachmentId,fileName:e.fileName,contentType:e.contentType,length:e.length}]:[]),Vr=e=>{let t=a(e);return{fileName:typeof t.name==`string`?t.name:``,contentType:typeof t.type==`string`?t.type:``,length:typeof t.size==`number`?t.size:null}},Hr=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.label===r.label&&e.message===r.message}),Ur=e=>{for(let t of e){if(!t.startsWith(`Enquiry type:`))continue;let e=t.slice(13).trim();return e===``?null:e}return null},Wr=e=>e.some(e=>e.kind===`Handoff`)?null:e.find(e=>e.kind===`InputRequest`)?.requestId??null,Gr=(e,t)=>e.some(e=>e.parts.some(e=>e.kind===`InputRequest`&&e.requestId===t&&(e.state===`Skipped`||e.state===`Expired`))),Kr=(e,t)=>{if(t!==`WithAgent`)return null;for(let t=e.length-1;t>=0;--t){let n=e[t];if(n!==void 0){for(let e=n.parts.length-1;e>=0;--e){let t=n.parts[e];if(t?.kind===`Handoff`){if(t.state===`Left`||t.state===`Ended`)return null;if(t.state===`Joined`&&t.agent)return t.agent}}if(n.author.kind===`Agent`)return{displayName:n.author.displayName??``,avatarUrl:n.author.avatarUrl}}}return null},qr=(e,t)=>{(e.cursor===null||t>e.cursor)&&(e.cursor=t)},Jr=(e,t)=>{let n=[];e!==``&&n.push({kind:`Text`,text:e});for(let e of t)n.push({kind:`File`,attachmentId:e.publicId,fileName:e.fileName,contentType:e.contentType,length:e.length});return n},Yr=e=>{let t=zr(e.parts);return{wireText:t===``?null:t,displayText:t,quickReplyId:null,replacesMessageId:null,attachments:Br(e.parts)}},Xr=e=>({profile:null,profileError:null,features:Ae(),conversationId:null,conversationState:`Open`,title:null,continuesConversationId:null,messages:[],thinking:!1,steps:[],streaming:!1,loading:!1,loadError:null,turnError:null,stopped:!1,messagesLeftToday:null,editing:null,attachments:[],lastConversation:null,open:!1,muted:e?.get(`wchat:muted`)===`1`,greeting:null,starters:[],pending:null,agent:null,agentTyping:null,live:`Off`,handoffPending:!1,handoffContactRequestId:null,handoffPause:!1,openTickets:[],draft:null}),Zr=(e,t)=>{let n=oe(t.labels),r=t.schedule??Pr,i=t.prefs,o=new Set,s=Xr(i),c=0,l=null,u=null,d=0,f=0,p=null,m=null,h=new Map,g=new Set,_=new Map,v=new Set,y=new Map,b={name:null,email:null,phone:null},x=new Set,S=null,C=null,w=null,T=null,E=null,D=!0,O=!1,k=new Set,A=new Map,j=Promise.resolve(),ee=0,te=()=>t.pathname?.()??bt.location?.pathname??`/`,ne=()=>t.reducedMotion?.()===!0||s.profile?.experience.motion===!1,re=()=>s.streaming||s.thinking,ie=e=>{if(!e.profile)return{...e,greeting:null,starters:[]};let n=te(),r=e.lastConversation!==null,i=Ne(e.profile,{pathname:n,returning:r}).greeting,a=kr(e.profile.start,{pathname:n,returning:r,behaviour:t.behaviour?.()??null,behaviourStarters:e.features.BehaviourStarters});return{...e,greeting:i,starters:Hr(e.starters,a)?e.starters:a}},ae=()=>{S!==null&&(bt.clearTimeout(S),S=null)},se=()=>{w!==null&&(bt.clearTimeout(w),w=null)},ce=e=>e.flatMap(e=>e.parts.flatMap(e=>e.kind===`Action`&&e.actionKind===`ChatLeadCapture`&&e.state===`Done`?[{actionId:e.actionId,leadType:Ur(e.lines)}]:[])),le=()=>{b.name=null,b.email=null,b.phone=null,x.clear()},ue=e=>{for(let t of ce(e))x.add(t.actionId)},de=()=>{for(let e of ce(s.messages))x.has(e.actionId)||(x.add(e.actionId),t.onEvent?.(`leadSubmitted`,{conversationId:s.conversationId,fields:{name:b.name,email:b.email,phone:b.phone},leadType:e.leadType}))},fe=(e,t)=>{let n=s.messages.flatMap(e=>e.parts).find(t=>t.kind===`InputRequest`&&t.requestId===e);if(n)for(let e of n.fields){let n=t[e.key];typeof n==`string`&&n.trim()!==``&&(e.type===`Email`?b.email=n.trim():e.type===`Phone`?b.phone=n.trim():(e.type===`Name`||e.key.toLowerCase()===`name`)&&(b.name=n.trim()))}},pe=e=>{let t=E;t!==null&&(E=null,t.handle?.stop(),e!==null&&N({live:e}))},me=()=>!O&&D&&s.features.HumanHandoff&&s.conversationId!==null&&(s.conversationState===`WaitingForAgent`||s.conversationState===`WithAgent`),he=()=>{if(!me()){E!==null&&pe(`Off`);return}let t=s.conversationId;if(t===null||E!==null&&E.conversationId===t)return;pe(null);let n={conversationId:t,cursor:null,handle:null};E=n;let r=Er({watch:(r,i,a)=>e.watchConversation(t,{afterSequence:r,signal:i,onCursor:e=>qr(n,e),onEvent:e=>{a(),E===n&&(e.name===`messageCompleted`&&qr(n,e.data.message.sequence),Le(e,`live`,()=>E===n))}}),beforeReconnect:()=>Re(),getCursor:()=>{let e=n.cursor;for(let t of s.messages)t.sequence!==null&&(e===null||t.sequence>e)&&(e=t.sequence);return e},onStatus:e=>{E===n&&s.live!==e&&N({live:e})},onError:e=>xe(e)});n.handle=r,E!==n&&r.stop()},N=e=>{let t={...s,...e};s.conversationState===`WithAgent`&&t.conversationState!==`WithAgent`&&t.agentTyping!==null&&(ae(),t.agentTyping=null),(e.messages!==void 0||e.conversationState!==void 0)&&(t.agent=Kr(t.messages,t.conversationState)),e.messages!==void 0&&t.handoffContactRequestId!==null&&Gr(t.messages,t.handoffContactRequestId)&&(t.handoffContactRequestId=null),s=ie(t);for(let e of o)e();e.messages!==void 0&&de(),he()},ge=(e,t)=>N({attachments:s.attachments.map(n=>n.key===e?{...n,...t}:n)}),_e=()=>{if(h.size===0)return;let e=[...h.values()];h.clear(),N({messages:s.messages.map(t=>{let n=e.filter(e=>e.messageId===t.id);if(n.length===0)return t;let r=t.parts.map((e,t)=>{let r=n.filter(e=>e.index===t).map(e=>e.text).join(``);return e.kind===`Text`&&r!==``?{...e,text:e.text+r}:e});return{...t,parts:r}})})},ve=()=>{h.clear(),u?.(),u=null},ye=(e,t,n)=>{let i=`${e}#${t}`,a=h.get(i);h.set(i,{messageId:e,index:t,text:(a?.text??``)+n}),u||=r(()=>{u=null,_e()})},be=()=>{_e(),c+=1,l?.abort(),l=null},xe=e=>{if(t.onError)t.onError(e);else throw e},Se=()=>{for(let e of y.values())e.abort();y.clear();for(let t of v){let n=_.get(t);n&&e.deleteAttachment(n.publicId).catch(xe)}v.clear(),_.clear()},Ce=e=>{let t=_.get(e);if(!t)throw Error(`No uploaded file for composer attachment ${e}.`);return t},we=async(t,r)=>{let i=new bt.AbortController;y.set(t,i);let a;try{a=await e.uploadAttachment(r,{signal:i.signal,onProgress:e=>{y.get(t)===i&&ge(t,{progress:e})}})}catch{y.get(t)===i&&(y.delete(t),ge(t,{status:`Failed`,progress:null,error:n.attachmentFailed}));return}y.get(t)===i?(y.delete(t),_.set(t,a),v.add(t),ge(t,{status:`Ready`,progress:null})):e.deleteAttachment(a.publicId).catch(xe)},Te=e=>{let n={...a(t.pageContext?.()),path:te(),behaviour:t.behaviour?.()??null};return e&&(n.attribution=t.attribution?.()??null),n},Ee=async()=>{let e=s.profile?.captcha;if(!e)return null;if(e.testToken)return e.testToken;if(!t.getCaptchaToken||e.mode===`Off`&&!e.siteKey)return null;let r;try{r=await t.getCaptchaToken(e.action)}catch(e){throw t.onError?.(e),new Tt(`captcha_unavailable`,n.captchaUnavailable)}if(!r)throw new Tt(`captcha_unavailable`,n.captchaUnavailable);return r},De=(e,t,n)=>{let r=Lr(s.messages,Ir(e,!1));N(n?{messages:r,messagesLeftToday:t??s.messagesLeftToday,steps:[],thinking:!1}:{messages:r})},Oe=e=>{let t=s.profile?.experience.pacing;return!t||g.has(e.publicId)||e.author.kind!==`Assistant`&&e.author.kind!==`Script`?0:Cr(rr(e.parts),t,ne())},ke=(e,t,n,r,i)=>{ee+=1,N({pending:{typing:!0,authorKind:e.author.kind}}),j=j.then(()=>new Promise(e=>bt.setTimeout(e,n))).then(()=>{--ee,r()&&De(e,t,i),ee===0&&N({pending:null})})},Ae=(e,t,n)=>{let r=[...e];return r[t]=n,r},Me=(e,t)=>s.messages.map(n=>n.id===e?t(n):n),Pe=e=>s.messages.some(t=>t.id===e),Fe=()=>{ae(),s.agentTyping!==null&&N({agentTyping:null})},Ie=e=>{ae(),S=bt.setTimeout(()=>{S=null,N({agentTyping:null})},Ar),N({agentTyping:{displayName:e}})},Le=(e,t,n)=>{if(!n())return;let r=t===`turn`;if(e.name===`partDelta`)g.add(e.data.messageId),ye(e.data.messageId,e.data.index,e.data.text);else switch(_e(),e.name){case`messageStarted`:{let t=e.data.message;if(t.author.kind===`Agent`&&Fe(),Pe(t.publicId))break;N({messages:[...s.messages,{id:t.publicId,author:t.author,createdDateTimeUtc:t.createdDateTimeUtc,parts:[...t.parts],sequence:t.sequence,rating:t.rating,ratingNote:t.ratingNote,streaming:!0,stored:!1,restored:!1}]});break}case`partStarted`:{let{messageId:t,index:n,part:i}=e.data;if(!Pe(t))break;N({messages:Me(t,e=>({...e,parts:Ae(e.parts,n,i)})),...r?{thinking:!1}:{}});break}case`partCompleted`:{let{messageId:t,index:n,part:r}=e.data;if(!Pe(t))break;N({messages:Me(t,e=>({...e,parts:Ae(e.parts,n,r)}))});break}case`messageReset`:{let{messageId:t}=e.data;if(!Pe(t))break;for(let e of[...h.keys()])h.get(e)?.messageId===t&&h.delete(e);N({messages:Me(t,e=>({...e,parts:[]})),...r?{thinking:!0,steps:[]}:{}});break}case`step`:{if(!r)break;let t=e.data.label;s.steps[s.steps.length-1]!==t&&N({steps:[...s.steps,t]});break}case`messageCompleted`:{let{message:t,messagesLeftToday:i}=e.data;t.author.kind===`Agent`&&Fe();let a=Oe(t);a>0||ee>0?ke(t,i,a,n,r):De(t,i,r);break}case`conversationUpdated`:{let t=e.data;N({conversationId:t.conversationId,conversationState:t.state,title:t.title,continuesConversationId:t.continuesConversationId});break}case`typing`:e.data.authorKind===`Agent`&&Ie(e.data.displayName)}},Re=async()=>{let t=s.conversationId;if(t===null)return;let n=c;try{let r=await e.getConversation(t);if(n!==c)return;let i=new Set(s.messages.filter(e=>e.restored).map(e=>e.id));N({messages:r.messages.map(e=>Ir(e,i.has(e.publicId))),title:r.title,conversationState:r.state,continuesConversationId:r.continuesConversationId})}catch(e){xe(e)}},ze=async(n,r,i)=>{let a=c,o=new bt.AbortController,u=()=>a===c&&!o.signal.aborted;l=o;let f=s.conversationId===null;d+=1;let m={id:`local-${d}`,author:{kind:`Visitor`,displayName:null,avatarUrl:null},createdDateTimeUtc:new Date().toISOString(),parts:Jr(n.displayText,n.attachments),sequence:null,rating:null,ratingNote:null,streaming:!1,stored:!1,restored:!1};i&&(v.clear(),_.clear()),N({messages:[...r,m],thinking:!0,streaming:!0,steps:[],turnError:null,stopped:!1,...i?{editing:null,attachments:[]}:{}});try{let t=await Ee();await e.send({conversationId:s.conversationId,text:n.wireText,quickReplyId:n.quickReplyId,attachmentIds:n.attachments.map(e=>e.publicId),replacesMessageId:n.replacesMessageId,pageContext:Te(f),captchaToken:t},{signal:o.signal,onEvent:e=>Le(e,`turn`,u)})}catch(e){if(_e(),!u())return;let t=Fr(e);N({messages:s.messages.filter(e=>!e.streaming),thinking:!1,streaming:!1,turnError:t,...t.code===`daily_limit`?{messagesLeftToday:0}:{},...t.code===`conversation_not_found`?{conversationId:null}:{}});return}finally{l===o&&(l=null)}if(await j,!u())return;_e(),N({thinking:!1,streaming:!1}),await Re();let h=s.conversationId;f&&h!==null&&h!==p&&(p=h,t.onEvent?.(`chatStarted`,{conversationId:h}))},Be=e=>N({messages:s.messages.map(t=>({...t,parts:t.parts.map(t=>t.kind===`Action`&&t.actionId===e.actionId?{...t,state:e.state,decidedDateTimeUtc:e.decidedDateTimeUtc,note:e.note}:t)}))}),Ve=async()=>{try{N({openTickets:await e.listOpenTickets()})}catch(e){xe(e)}},He=async()=>{try{let t=await e.listConversations({page:1,pageSize:1});N({lastConversation:t.items[0]??null})}catch(e){xe(e)}},Ue=async()=>{let n;try{n=await e.getProfile(t.screen)}catch(e){N({profileError:Fr(e)});return}let r=je(n,t.narrow);N({profile:n,profileError:null,features:r,messagesLeftToday:n.messagesLeftToday}),r.OpenTickets&&Ve(),r.ResumeLast&&r.History&&He(),t.conversationId&&await it(t.conversationId)},We=()=>(m||=Ue(),m),Ge=async e=>{let t=typeof e==`string`?e.trim():``,n=s.attachments.filter(e=>e.status===`Ready`);if(t===``&&n.length===0||s.streaming||s.attachments.some(e=>e.status===`Uploading`))return;let r=s.messages,i=null;if(s.editing){let e=s.messages.findIndex(e=>e.id===s.editing?.messageId),t=s.messages[e];if(!t?.stored)return;i=t.id,r=s.messages.slice(0,e)}let a=n.map(e=>Ce(e.key));await ze({wireText:t===``?null:t,displayText:t,quickReplyId:null,replacesMessageId:i,attachments:a},r,!0)},Ke=async e=>{e.action!==`Send`||re()||(e.id===`handoff.request`&&s.features.HumanHandoff&&s.conversationId!==null&&!s.handoffPending?await ht():await ze({wireText:null,displayText:e.label,quickReplyId:e.id,replacesMessageId:null,attachments:[]},s.messages,!1))},qe=async(t,n)=>{let r=await Ee();await e.sendOtp(t,{...n,captchaToken:r})},Je=async(r,i,a=null)=>{if(s.streaming)return{ok:!1,errors:{},message:n.errorGeneric};let o=c,u=new bt.AbortController,d=()=>o===c&&!u.signal.aborted;l=u,fe(r,i);let f=r===s.handoffContactRequestId;N({streaming:!0,thinking:!0});try{let n=await Ee();await e.answerInput(r,{values:i,codes:a,captchaToken:n,attribution:t.attribution?.()??null},{signal:u.signal,onEvent:e=>Le(e,`turn`,d)})}catch(e){return _e(),N({thinking:!1,streaming:!1}),u.signal.aborted?{ok:!1,errors:{},message:n.errorGeneric}:e instanceof Tt&&e.code===`validation_failed`?{ok:!1,errors:e.errors??{},message:e.message}:e instanceof Tt&&e.code===`input_request_closed`?(await Re(),{ok:!1,errors:{},message:e.message}):{ok:!1,errors:{},message:Fr(e).message}}finally{l===u&&(l=null)}return await j,d()&&(_e(),N({thinking:!1,streaming:!1}),t.onEvent?.(`inputSubmitted`,{requestId:r}),await Re(),f&&(N({handoffContactRequestId:null}),await ht().catch(xe))),{ok:!0}},Ye=async n=>{let r=await e.confirmAction(n);Be(r),t.onEvent?.(`chatActionConfirmed`,{actionId:r.actionId,kind:r.actionKind}),await Re()},Xe=async(t,n)=>{Be(await e.rejectAction(t,n)),await Re()},Ze=()=>{if(!s.streaming)return;ve();let e=l;l=null,e?.abort(),N({messages:s.messages.filter(e=>!e.streaming),thinking:!1,streaming:!1,stopped:!0,steps:[],pending:null})},Qe=async()=>{if(s.streaming||s.turnError===null&&!s.stopped)return;let e=Rr(s.messages,e=>e.author.kind===`Visitor`),t=s.messages[e];t!==void 0&&await ze(Yr(t),s.messages.slice(0,e),!1)},$e=async()=>{if(re())return;let e=Rr(s.messages,e=>e.author.kind===`Visitor`&&e.stored),t=s.messages[e];t!==void 0&&await ze({...Yr(t),replacesMessageId:t.id},s.messages.slice(0,e),!1)},et=e=>{let t=s.messages.find(t=>t.id===e);t?.stored&&t.author.kind===`Visitor`&&(Se(),N({editing:{messageId:e,text:zr(t.parts)},attachments:[]}))},tt=()=>{s.editing&&(Se(),N({editing:null,attachments:[]}))},nt=async e=>{let t=s.profile;if(!t||!s.features.Attachments)return;let r=t.limits,i=r.maxAttachments-s.attachments.filter(e=>e.status!==`Failed`).length,a=[],o=[];for(let t of e){let e=Vr(t);f+=1;let s=`file-${f}`,c={key:s,fileName:e.fileName,contentType:e.contentType,length:e.length??0};i<=0?a.push({...c,status:`Failed`,progress:null,error:n.attachmentLimit(r.maxAttachments)}):e.length!==null&&e.length>r.maxFileBytes||!r.contentTypes.includes(e.contentType)?a.push({...c,status:`Failed`,progress:null,error:n.attachmentFailed}):(--i,a.push({...c,status:`Uploading`,progress:0,error:null}),o.push({key:s,file:t}))}N({attachments:[...s.attachments,...a]}),await Promise.all(o.map(({key:e,file:t})=>we(e,t)))},rt=async t=>{let n=y.get(t);n&&(y.delete(t),n.abort());let r=v.has(t)?_.get(t):void 0;r&&await e.deleteAttachment(r.publicId),v.delete(t),_.delete(t),N({attachments:s.attachments.filter(e=>e.key!==t)})};async function it(t){be();let n=c;N({messages:[],conversationId:null,loadError:null,loading:!0,editing:null,thinking:!1,streaming:!1,steps:[],turnError:null,stopped:!1});try{let r=await e.getConversation(t);if(n!==c)return;let i=r.messages.map(e=>Ir(e,!0));le(),ue(i),N({messages:i,conversationId:r.publicId,title:r.title,conversationState:r.state,continuesConversationId:r.continuesConversationId})}catch(e){if(n!==c)return;N({loadError:Fr(e)})}finally{n===c&&N({loading:!1})}}let at=async()=>{let e=s.lastConversation;e&&await it(e.publicId)},ot=()=>{Se(),be(),ve(),le(),N({messages:[],conversationId:null,title:null,conversationState:`Open`,continuesConversationId:null,loadError:null,loading:!1,editing:null,attachments:[],thinking:!1,streaming:!1,steps:[],turnError:null,stopped:!1,pending:null}),s.features.OpenTickets&&Ve()},st=(e,t,n)=>{N({messages:Me(e,e=>({...e,rating:t,ratingNote:n}))})},ct=async(n,r,i)=>{let a=s.messages.find(e=>e.id===n);if(!a?.stored)throw Error(`Only a stored reply can be rated.`);let o={rating:a.rating,ratingNote:a.ratingNote},c=typeof i==`string`&&i.trim()?i.trim():null;st(n,r,c);try{await e.rateMessage(n,{rating:r,note:c})}catch(e){throw st(n,o.rating,o.ratingNote),e}t.onEvent?.(`rated`,{messageId:n,rating:r})},lt=e=>{let n=s.open,r=e?.trigger??`manual`,a=e?.draft,o={open:!0};typeof a==`string`&&a.trim()!==``&&(o.draft=a),!n&&r===`auto`&&i?.set(`wchat:auto-opened`,`1`),N(o),n||t.onEvent?.(`chatOpened`,{layout:t.layout??null,trigger:r})},ut=e=>{s.open&&(i?.set(`wchat:dismissed`,`1`),N({open:!1}),t.onEvent?.(`chatClosed`,{layout:t.layout??null,reason:e}))},dt=e=>{i?.set(`wchat:muted`,e?`1`:`0`),N({muted:e}),t.onEvent?.(`chatSoundToggled`,{muted:e})},ft=async e=>{re()||(e===s.handoffContactRequestId&&N({handoffContactRequestId:null}),t.onEvent?.(`chatLeadSkipped`,{requestId:e}),await ze({wireText:null,displayText:n.skip,quickReplyId:`lead.skip`,replacesMessageId:null,attachments:[]},s.messages,!1))},pt=async()=>{re()||(t.onEvent?.(`chatLeadCancelled`,{}),await ze({wireText:null,displayText:n.cancel,quickReplyId:`lead.cancel`,replacesMessageId:null,attachments:[]},s.messages,!1))},mt=async(e,t)=>{re()||s.messages.some(t=>t.parts.some(t=>t.kind===`Action`&&t.actionId===e))&&await ze({wireText:null,displayText:n.editSomething,quickReplyId:`lead.edit:${t}`,replacesMessageId:null,attachments:[]},s.messages,!1)},ht=async n=>{if(!s.features.HumanHandoff)throw new Tt(`chat_feature_off`,M.errorGeneric,403);let r=s.conversationId;if(r===null)throw new Tt(`conversation_required`,M.errorGeneric);if(s.streaming||s.handoffPending)throw new Tt(`busy`,M.errorGeneric);let i=new bt.AbortController;T=i,N({handoffPending:!0}),t.onEvent?.(`chatHandoffRequested`,{conversationId:r});let a=null;try{a=Wr((await e.requestHandoff({conversationId:r,reason:n??null},{signal:i.signal,onEvent:e=>Le(e,`handoff`,()=>!i.signal.aborted)})).parts)}catch(e){throw N({messages:s.messages.filter(e=>!e.streaming),handoffPending:!1}),e}finally{T===i&&(T=null)}N({handoffPending:!1,handoffContactRequestId:a}),await Re(),t.onEvent?.(`chatHandoff`,{destination:`person`})},gt=()=>{let t=s.conversationId;if(!s.features.HumanHandoff||t===null||s.conversationState!==`WithAgent`)return;let n=Date.now();C!==null&&n-C<jr||(C=n,Promise.allSettled([e.sendTyping(t)]))},_t=e=>{D=e,he()},vt=()=>{s.live===`Lost`&&me()&&(pe(null),he())},yt=e=>{if(t.reducedMotion?.()===!0)return Mr;let n=e.navigateAfterMs;if(typeof n==`number`&&Number.isFinite(n)&&n>=0)return n;let r=s.profile?.experience.pacing.handoffPauseMs;return typeof r==`number`&&Number.isFinite(r)?r:Nr},xt=()=>{se(),s.handoffPause&&N({handoffPause:!1})};return{client:e,getState:()=>s,subscribe:e=>(o.add(e),m||We(),()=>{o.delete(e)}),load:We,submit:Ge,chooseQuickReply:Ke,answerInput:Je,sendOtp:qe,confirmAction:Ye,rejectAction:Xe,stop:Ze,retry:Qe,regenerate:$e,startEdit:et,cancelEdit:tt,attach:nt,removeAttachment:rt,openConversation:it,resumeLast:at,newConversation:ot,rate:ct,open:lt,close:ut,setMuted:dt,skipField:ft,cancelLead:pt,editLeadField:mt,requestHandoff:ht,notifyTyping:gt,setLiveActive:_t,resumeLive:vt,beginHandoff:(e,n)=>{s.handoffPause||(N({handoffPause:!0}),t.onEvent?.(`chatHandoff`,{destination:e.id}),w=bt.setTimeout(()=>{w=null;try{n()}catch(e){xt(),xe(e)}},yt(e)))},endHandoffPause:xt,consumeDraft:()=>{s.draft!==null&&N({draft:null})},loadAttachmentUrl:t=>{let r=A.get(t);if(r!==void 0)return r;let i=(async()=>{let r=bt.createObjectUrl;if(!r)throw new Tt(`unsupported`,n.errorGeneric);let i=await e.getAttachment(t);if(O)throw new Tt(`aborted`,n.errorGeneric);let a=r(i);return k.add(a),a})();return A.set(t,i),i.catch(()=>{A.get(t)===i&&A.delete(t)}),i},reset:()=>{Se(),ve(),be(),m=null,j=Promise.resolve(),ee=0,g.clear(),p=null,le(),ae(),se(),N(Xr(i))},dispose:()=>{o.clear(),O=!0,c+=1;let e=l;l=null,e?.abort(),T?.abort(),T=null,se(),ae(),pe(null),Se(),ve();let t=bt.revokeObjectUrl;for(let e of k)t?.(e);k.clear(),A.clear(),N({attachments:[],editing:null,agentTyping:null})}}},Qr=e=>{let t=-1;for(let n=e.length-1;n>=0;--n)if(e[n]?.parts.some(e=>e.kind===`Handoff`)){t=n;break}let n=new Set;for(let r=0;r<t;r+=1){let t=e[r]?.id;t!==void 0&&n.add(t)}return n},$r=(e,t)=>({get features(){return e.getState().features},labels:t.labels,get isLast(){let n=e.getState().messages;return n[n.length-1]?.id===t.messageId},get busy(){let t=e.getState();return t.streaming||t.thinking},get handoffPause(){return e.getState().handoffPause},get handoffSettled(){return Qr(e.getState().messages).has(t.messageId)},chooseQuickReply(t){e.chooseQuickReply(t)},skipInput(t){e.skipField(t)},cancelLead(){e.cancelLead()},answerInput:(t,n,r)=>e.answerInput(t,n,r),uploadInputFile:async(t,n)=>(await e.client.uploadAttachment(t,n?{onProgress:n}:{})).publicId,sendOtp:(t,n)=>e.sendOtp(t,n),confirmAction:t=>e.confirmAction(t),rejectAction:(t,n)=>e.rejectAction(t,n),requestHandoff:t=>e.requestHandoff(t),beginHandoff:(t,n)=>e.beginHandoff(t,n),readAttachment:t=>e.client.getAttachment(t),loadAttachmentUrl:t=>e.loadAttachmentUrl(t),...t.openAttachment?{openAttachment:t.openAttachment}:{},...t.openRecord?{openRecord:t.openRecord}:{},...t.openTicket?{openTicket:t.openTicket}:{},...t.attachmentUrl?{attachmentUrl:t.attachmentUrl}:{},...t.handoffHosts?{handoffHosts:t.handoffHosts}:{},...t.openCitation?{openCitation:t.openCitation}:{},...t.isCitation?{isCitation:t.isCitation}:{},...t.openTarget?{openTarget:t.openTarget}:{},...t.onNavigate?{onNavigate:t.onNavigate}:{}}),ei=e=>e;function ti(e){return e!=null&&e.trim()!==``}function ni(e){return{kind:`paragraph`,text:e}}function ri(e){return e.split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e!==``).map(ni)}function ii(e){return br(e.url)?`${e.title} (${e.url})`:e.title}function ai(e,t){return t===null?e:`${e??``} (${t})`.trim()}function oi(e){let t=[],n=new Set,r=e.map(e=>{let r=new Map;for(let i of e.points)r.set(i.label,i.value),n.has(i.label)||(n.add(i.label),t.push(i.label));return r});return t.map(e=>[e,...r.map(t=>{let n=t.get(e);return n===void 0?``:gr(n,`Decimal`,null)})])}function si(e){return e.map(e=>e.kind===`sup`?`^${e.text}`:e.text).join(``)}function ci(e){return Math.abs(e)<.001&&e!==0?si(fn(e)):gr(e,`Decimal`,null)}function li(e,t){switch(e.kind){case`Text`:case`Notice`:return ri(rr([e]));case`Sources`:return e.sources.length===0?[]:[ni(t.sources),{kind:`list`,ordered:!0,items:e.sources.map(ii)}];case`QuickReplies`:case`Handoff`:return[];case`InputRequest`:return e.state!==`Answered`||!ti(e.answeredSummary)?[]:[ni(e.title===null?e.answeredSummary:`${e.title}: ${e.answeredSummary}`)];case`Action`:{let t=[ni(e.title)];return e.lines.length>0&&t.push({kind:`list`,ordered:!1,items:[...e.lines]}),t}case`Table`:return[{kind:`table`,title:e.title,head:e.columns.map(e=>e.label),rows:e.rows.map(t=>e.columns.map((n,r)=>gr(t[r]??null,n.type,e.currency)))}];case`Chart`:return e.series.length===0?[]:[{kind:`table`,title:ai(e.title,e.unit),head:[``,...e.series.map(e=>e.name)],rows:oi(e.series)}];case`Figures`:return e.figures.length===0?[]:[{kind:`table`,title:null,head:[],rows:e.figures.map(e=>[e.label,ci(e.value)+(ti(e.unit)?` ${e.unit}`:``)])}];case`RecordCard`:{let t=[ni(e.subtitle===null?e.title:`${e.title} ${e.subtitle}`)];return e.fields.length>0&&t.push({kind:`table`,title:null,head:[],rows:e.fields.map(e=>[e.label,gr(e.value,e.type,null)])}),t}case`Image`:return ti(e.alt)?[ni(e.alt)]:[];case`File`:return[ni(`${e.fileName} (${Qn(e.length)})`)];case`Ticket`:return[ni(`${e.number} ${e.subject}`)];case`VoiceClip`:return ti(e.transcript)?[ni(e.transcript)]:[];default:return[]}}function ui(e,t){switch(e.kind){case`paragraph`:return{kind:`paragraph`,text:t(e.text)};case`list`:return{kind:`list`,ordered:e.ordered,items:e.items.map(e=>t(e))};case`table`:return{kind:`table`,title:e.title===null?null:t(e.title),head:e.head.map(e=>t(e)),rows:e.rows.map(e=>e.map(e=>t(e)))}}}function di(e,t,n){switch(e.kind){case`Visitor`:case`Customer`:return t.you;case`Agent`:return ti(e.displayName)?e.displayName:t.agent;case`Assistant`:case`Script`:return ti(e.displayName)?e.displayName:ti(n)?n:t.assistant;case`System`:throw Error(`A System message has no speaker: buildTranscript skips it.`)}}function fi(e,t){let n=t.figureText?dn:ei,r=[],i=null;for(let a of e){if(a.streaming||a.author.kind===`System`)continue;let e=a.parts.flatMap(e=>li(e,t.labels)).map(e=>ui(e,n));e.length!==0&&(r.push({speaker:di(a.author,t.labels,t.assistantName),blocks:e}),i===null&&(i=er(a.createdDateTimeUtc)))}return{title:ti(t.title)?t.title:t.labels.untitled,dateText:i,entries:r}}function pi(e){switch(e.kind){case`paragraph`:return[e.text];case`list`:return e.items.map((t,n)=>e.ordered?`${n+1}. ${t}`:`- ${t}`);case`table`:{let t=[];e.title!==null&&t.push(e.title),e.head.length>0&&t.push(e.head.join(` | `));for(let n of e.rows)t.push(n.join(` | `));return t}}}function mi(e,t){let n=[];t.heading&&n.push([e.title,...e.dateText===null?[]:[e.dateText]].join(`
17
+ `),Br=e=>e.flatMap(e=>e.kind===`File`?[{publicId:e.attachmentId,fileName:e.fileName,contentType:e.contentType,length:e.length}]:[]),Vr=e=>{let t=a(e);return{fileName:typeof t.name==`string`?t.name:``,contentType:typeof t.type==`string`?t.type:``,length:typeof t.size==`number`?t.size:null}},Hr=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.label===r.label&&e.message===r.message}),Ur=e=>{for(let t of e){if(!t.startsWith(`Enquiry type:`))continue;let e=t.slice(13).trim();return e===``?null:e}return null},Wr=e=>e.some(e=>e.kind===`Handoff`)?null:e.find(e=>e.kind===`InputRequest`)?.requestId??null,Gr=(e,t)=>e.some(e=>e.parts.some(e=>e.kind===`InputRequest`&&e.requestId===t&&(e.state===`Skipped`||e.state===`Expired`))),Kr=(e,t)=>{if(t!==`WithAgent`)return null;for(let t=e.length-1;t>=0;--t){let n=e[t];if(n!==void 0){for(let e=n.parts.length-1;e>=0;--e){let t=n.parts[e];if(t?.kind===`Handoff`){if(t.state===`Left`||t.state===`Ended`)return null;if(t.state===`Joined`&&t.agent)return t.agent}}if(n.author.kind===`Agent`)return{displayName:n.author.displayName??``,avatarUrl:n.author.avatarUrl}}}return null},qr=(e,t)=>{(e.cursor===null||t>e.cursor)&&(e.cursor=t)},Jr=(e,t)=>{let n=[];e!==``&&n.push({kind:`Text`,text:e});for(let e of t)n.push({kind:`File`,attachmentId:e.publicId,fileName:e.fileName,contentType:e.contentType,length:e.length});return n},Yr=e=>{let t=zr(e.parts);return{wireText:t===``?null:t,displayText:t,quickReplyId:null,replacesMessageId:null,attachments:Br(e.parts)}},Xr=e=>({profile:null,profileError:null,features:Ae(),conversationId:null,conversationState:`Open`,title:null,continuesConversationId:null,messages:[],thinking:!1,steps:[],streaming:!1,loading:!1,loadError:null,turnError:null,stopped:!1,messagesLeftToday:null,editing:null,attachments:[],lastConversation:null,open:!1,muted:e?.get(`wchat:muted`)===`1`,greeting:null,starters:[],pending:null,agent:null,agentTyping:null,live:`Off`,handoffPending:!1,handoffContactRequestId:null,handoffPause:!1,openTickets:[],draft:null}),Zr=(e,t)=>{let n=oe(t.labels),r=t.schedule??Pr,i=t.prefs,o=new Set,s=Xr(i),c=0,l=null,u=null,d=0,f=0,p=null,m=null,h=new Map,g=new Set,_=new Map,v=new Set,y=new Map,b={name:null,email:null,phone:null},x=new Set,S=null,C=null,w=null,T=null,E=null,D=!0,O=!1,k=new Set,A=new Map,j=Promise.resolve(),ee=0,te=()=>t.pathname?.()??bt.location?.pathname??`/`,ne=()=>t.reducedMotion?.()===!0||s.profile?.experience.motion===!1,re=()=>s.streaming||s.thinking,ie=e=>{if(!e.profile)return{...e,greeting:null,starters:[]};let n=te(),r=e.lastConversation!==null,i=Ne(e.profile,{pathname:n,returning:r}).greeting,a=kr(e.profile.start,{pathname:n,returning:r,behaviour:t.behaviour?.()??null,behaviourStarters:e.features.BehaviourStarters});return{...e,greeting:i,starters:Hr(e.starters,a)?e.starters:a}},ae=()=>{S!==null&&(bt.clearTimeout(S),S=null)},se=()=>{w!==null&&(bt.clearTimeout(w),w=null)},ce=e=>e.flatMap(e=>e.parts.flatMap(e=>e.kind===`Action`&&e.actionKind===`ChatLeadCapture`&&e.state===`Done`?[{actionId:e.actionId,leadType:Ur(e.lines)}]:[])),le=()=>{b.name=null,b.email=null,b.phone=null,x.clear()},ue=e=>{for(let t of ce(e))x.add(t.actionId)},de=()=>{for(let e of ce(s.messages))x.has(e.actionId)||(x.add(e.actionId),t.onEvent?.(`leadSubmitted`,{conversationId:s.conversationId,fields:{name:b.name,email:b.email,phone:b.phone},leadType:e.leadType}))},fe=(e,t)=>{let n=s.messages.flatMap(e=>e.parts).find(t=>t.kind===`InputRequest`&&t.requestId===e);if(n)for(let e of n.fields){let n=t[e.key];typeof n==`string`&&n.trim()!==``&&(e.type===`Email`?b.email=n.trim():e.type===`Phone`?b.phone=n.trim():(e.type===`Name`||e.key.toLowerCase()===`name`)&&(b.name=n.trim()))}},pe=e=>{let t=E;t!==null&&(E=null,t.handle?.stop(),e!==null&&N({live:e}))},me=()=>!O&&D&&s.features.HumanHandoff&&s.conversationId!==null&&(s.conversationState===`WaitingForAgent`||s.conversationState===`WithAgent`),he=()=>{if(!me()){E!==null&&pe(`Off`);return}let t=s.conversationId;if(t===null||E!==null&&E.conversationId===t)return;pe(null);let n={conversationId:t,cursor:null,handle:null};E=n;let r=Er({watch:(r,i,a)=>e.watchConversation(t,{afterSequence:r,signal:i,onCursor:e=>qr(n,e),onEvent:e=>{a(),E===n&&(e.name===`messageCompleted`&&qr(n,e.data.message.sequence),Le(e,`live`,()=>E===n))}}),beforeReconnect:()=>Re(),getCursor:()=>{let e=n.cursor;for(let t of s.messages)t.sequence!==null&&(e===null||t.sequence>e)&&(e=t.sequence);return e},onStatus:e=>{E===n&&s.live!==e&&N({live:e})},onError:e=>xe(e)});n.handle=r,E!==n&&r.stop()},N=e=>{let t={...s,...e};s.conversationState===`WithAgent`&&t.conversationState!==`WithAgent`&&t.agentTyping!==null&&(ae(),t.agentTyping=null),(e.messages!==void 0||e.conversationState!==void 0)&&(t.agent=Kr(t.messages,t.conversationState)),e.messages!==void 0&&t.handoffContactRequestId!==null&&Gr(t.messages,t.handoffContactRequestId)&&(t.handoffContactRequestId=null),s=ie(t);for(let e of o)e();e.messages!==void 0&&de(),he()},ge=(e,t)=>N({attachments:s.attachments.map(n=>n.key===e?{...n,...t}:n)}),_e=()=>{if(h.size===0)return;let e=[...h.values()];h.clear(),N({messages:s.messages.map(t=>{let n=e.filter(e=>e.messageId===t.id);if(n.length===0)return t;let r=t.parts.map((e,t)=>{let r=n.filter(e=>e.index===t).map(e=>e.text).join(``);return e.kind===`Text`&&r!==``?{...e,text:e.text+r}:e});return{...t,parts:r}})})},ve=()=>{h.clear(),u?.(),u=null},ye=(e,t,n)=>{let i=`${e}#${t}`,a=h.get(i);h.set(i,{messageId:e,index:t,text:(a?.text??``)+n}),u||=r(()=>{u=null,_e()})},be=()=>{_e(),c+=1,l?.abort(),l=null},xe=e=>{if(t.onError)t.onError(e);else throw e},Se=()=>{for(let e of y.values())e.abort();y.clear();for(let t of v){let n=_.get(t);n&&e.deleteAttachment(n.publicId).catch(xe)}v.clear(),_.clear()},Ce=e=>{let t=_.get(e);if(!t)throw Error(`No uploaded file for composer attachment ${e}.`);return t},we=async(t,r)=>{let i=new bt.AbortController;y.set(t,i);let a;try{a=await e.uploadAttachment(r,{signal:i.signal,onProgress:e=>{y.get(t)===i&&ge(t,{progress:e})}})}catch{y.get(t)===i&&(y.delete(t),ge(t,{status:`Failed`,progress:null,error:n.attachmentFailed}));return}y.get(t)===i?(y.delete(t),_.set(t,a),v.add(t),ge(t,{status:`Ready`,progress:null})):e.deleteAttachment(a.publicId).catch(xe)},Te=e=>{let n={...a(t.pageContext?.()),path:te(),behaviour:t.behaviour?.()??null};return e&&(n.attribution=t.attribution?.()??null),n},Ee=async()=>{let e=s.profile?.captcha;if(!e)return null;if(e.testToken)return e.testToken;if(!t.getCaptchaToken||e.mode===`Off`&&!e.siteKey)return null;let r;try{r=await t.getCaptchaToken(e.action)}catch(e){throw t.onError?.(e),new Tt(`captcha_unavailable`,{message:n.captchaUnavailable,cause:e})}if(!r)throw new Tt(`captcha_unavailable`,{message:n.captchaUnavailable});return r},De=(e,t,n)=>{let r=Lr(s.messages,Ir(e,!1));N(n?{messages:r,messagesLeftToday:t??s.messagesLeftToday,steps:[],thinking:!1}:{messages:r})},Oe=e=>{let t=s.profile?.experience.pacing;return!t||g.has(e.publicId)||e.author.kind!==`Assistant`&&e.author.kind!==`Script`?0:Cr(rr(e.parts),t,ne())},ke=(e,t,n,r,i)=>{ee+=1,N({pending:{typing:!0,authorKind:e.author.kind}}),j=j.then(()=>new Promise(e=>bt.setTimeout(e,n))).then(()=>{--ee,r()&&De(e,t,i),ee===0&&N({pending:null})})},Ae=(e,t,n)=>{let r=[...e];return r[t]=n,r},Me=(e,t)=>s.messages.map(n=>n.id===e?t(n):n),Pe=e=>s.messages.some(t=>t.id===e),Fe=()=>{ae(),s.agentTyping!==null&&N({agentTyping:null})},Ie=e=>{ae(),S=bt.setTimeout(()=>{S=null,N({agentTyping:null})},Ar),N({agentTyping:{displayName:e}})},Le=(e,t,n)=>{if(!n())return;let r=t===`turn`;if(e.name===`partDelta`)g.add(e.data.messageId),ye(e.data.messageId,e.data.index,e.data.text);else switch(_e(),e.name){case`messageStarted`:{let t=e.data.message;if(t.author.kind===`Agent`&&Fe(),Pe(t.publicId))break;N({messages:[...s.messages,{id:t.publicId,author:t.author,createdDateTimeUtc:t.createdDateTimeUtc,parts:[...t.parts],sequence:t.sequence,rating:t.rating,ratingNote:t.ratingNote,streaming:!0,stored:!1,restored:!1}]});break}case`partStarted`:{let{messageId:t,index:n,part:i}=e.data;if(!Pe(t))break;N({messages:Me(t,e=>({...e,parts:Ae(e.parts,n,i)})),...r?{thinking:!1}:{}});break}case`partCompleted`:{let{messageId:t,index:n,part:r}=e.data;if(!Pe(t))break;N({messages:Me(t,e=>({...e,parts:Ae(e.parts,n,r)}))});break}case`messageReset`:{let{messageId:t}=e.data;if(!Pe(t))break;for(let e of[...h.keys()])h.get(e)?.messageId===t&&h.delete(e);N({messages:Me(t,e=>({...e,parts:[]})),...r?{thinking:!0,steps:[]}:{}});break}case`step`:{if(!r)break;let t=e.data.label;s.steps[s.steps.length-1]!==t&&N({steps:[...s.steps,t]});break}case`messageCompleted`:{let{message:t,messagesLeftToday:i}=e.data;t.author.kind===`Agent`&&Fe();let a=Oe(t);a>0||ee>0?ke(t,i,a,n,r):De(t,i,r);break}case`conversationUpdated`:{let t=e.data;N({conversationId:t.conversationId,conversationState:t.state,title:t.title,continuesConversationId:t.continuesConversationId});break}case`typing`:e.data.authorKind===`Agent`&&Ie(e.data.displayName)}},Re=async()=>{let t=s.conversationId;if(t===null)return;let n=c;try{let r=await e.getConversation(t);if(n!==c)return;let i=new Set(s.messages.filter(e=>e.restored).map(e=>e.id));N({messages:r.messages.map(e=>Ir(e,i.has(e.publicId))),title:r.title,conversationState:r.state,continuesConversationId:r.continuesConversationId})}catch(e){xe(e)}},ze=async(n,r,i)=>{let a=c,o=new bt.AbortController,u=()=>a===c&&!o.signal.aborted;l=o;let f=s.conversationId===null;d+=1;let m={id:`local-${d}`,author:{kind:`Visitor`,displayName:null,avatarUrl:null},createdDateTimeUtc:new Date().toISOString(),parts:Jr(n.displayText,n.attachments),sequence:null,rating:null,ratingNote:null,streaming:!1,stored:!1,restored:!1};i&&(v.clear(),_.clear()),N({messages:[...r,m],thinking:!0,streaming:!0,steps:[],turnError:null,stopped:!1,...i?{editing:null,attachments:[]}:{}});try{let t=await Ee();await e.send({conversationId:s.conversationId,text:n.wireText,quickReplyId:n.quickReplyId,attachmentIds:n.attachments.map(e=>e.publicId),replacesMessageId:n.replacesMessageId,pageContext:Te(f),captchaToken:t},{signal:o.signal,onEvent:e=>Le(e,`turn`,u)})}catch(e){if(_e(),!u())return;let t=Fr(e);N({messages:s.messages.filter(e=>!e.streaming),thinking:!1,streaming:!1,turnError:t,...t.code===`daily_limit`?{messagesLeftToday:0}:{},...t.code===`conversation_not_found`?{conversationId:null}:{}});return}finally{l===o&&(l=null)}if(await j,!u())return;_e(),N({thinking:!1,streaming:!1}),await Re();let h=s.conversationId;f&&h!==null&&h!==p&&(p=h,t.onEvent?.(`chatStarted`,{conversationId:h}))},Be=e=>N({messages:s.messages.map(t=>({...t,parts:t.parts.map(t=>t.kind===`Action`&&t.actionId===e.actionId?{...t,state:e.state,decidedDateTimeUtc:e.decidedDateTimeUtc,note:e.note}:t)}))}),Ve=async()=>{try{N({openTickets:await e.listOpenTickets()})}catch(e){xe(e)}},He=async()=>{try{let t=await e.listConversations({page:1,pageSize:1});N({lastConversation:t.items[0]??null})}catch(e){xe(e)}},Ue=async()=>{let n;try{n=await e.getProfile(t.screen)}catch(e){N({profileError:Fr(e)});return}let r=je(n,t.narrow);N({profile:n,profileError:null,features:r,messagesLeftToday:n.messagesLeftToday}),r.OpenTickets&&Ve(),r.ResumeLast&&r.History&&He(),t.conversationId&&await it(t.conversationId)},We=()=>(m||=Ue(),m),Ge=async e=>{let t=typeof e==`string`?e.trim():``,n=s.attachments.filter(e=>e.status===`Ready`);if(t===``&&n.length===0||s.streaming||s.attachments.some(e=>e.status===`Uploading`))return;let r=s.messages,i=null;if(s.editing){let e=s.messages.findIndex(e=>e.id===s.editing?.messageId),t=s.messages[e];if(!t?.stored)return;i=t.id,r=s.messages.slice(0,e)}let a=n.map(e=>Ce(e.key));await ze({wireText:t===``?null:t,displayText:t,quickReplyId:null,replacesMessageId:i,attachments:a},r,!0)},Ke=async e=>{e.action!==`Send`||re()||(e.id===`handoff.request`&&s.features.HumanHandoff&&s.conversationId!==null&&!s.handoffPending?await ht():await ze({wireText:null,displayText:e.label,quickReplyId:e.id,replacesMessageId:null,attachments:[]},s.messages,!1))},qe=async(t,n)=>{let r=await Ee();await e.sendOtp(t,{...n,captchaToken:r})},Je=async(r,i,a=null)=>{if(s.streaming)return{ok:!1,errors:{},message:n.errorGeneric};let o=c,u=new bt.AbortController,d=()=>o===c&&!u.signal.aborted;l=u,fe(r,i);let f=r===s.handoffContactRequestId;N({streaming:!0,thinking:!0});try{let n=await Ee();await e.answerInput(r,{values:i,codes:a,captchaToken:n,attribution:t.attribution?.()??null},{signal:u.signal,onEvent:e=>Le(e,`turn`,d)})}catch(e){return _e(),N({thinking:!1,streaming:!1}),u.signal.aborted?{ok:!1,errors:{},message:n.errorGeneric}:e instanceof Tt&&e.code===`validation_failed`?{ok:!1,errors:e.errors??{},message:e.message}:e instanceof Tt&&e.code===`input_request_closed`?(await Re(),{ok:!1,errors:{},message:e.message}):{ok:!1,errors:{},message:Fr(e).message}}finally{l===u&&(l=null)}return await j,d()&&(_e(),N({thinking:!1,streaming:!1}),t.onEvent?.(`inputSubmitted`,{requestId:r}),await Re(),f&&(N({handoffContactRequestId:null}),await ht().catch(xe))),{ok:!0}},Ye=async n=>{let r=await e.confirmAction(n);Be(r),t.onEvent?.(`chatActionConfirmed`,{actionId:r.actionId,kind:r.actionKind}),await Re()},Xe=async(t,n)=>{Be(await e.rejectAction(t,n)),await Re()},Ze=()=>{if(!s.streaming)return;ve();let e=l;l=null,e?.abort(),N({messages:s.messages.filter(e=>!e.streaming),thinking:!1,streaming:!1,stopped:!0,steps:[],pending:null})},Qe=async()=>{if(s.streaming||s.turnError===null&&!s.stopped)return;let e=Rr(s.messages,e=>e.author.kind===`Visitor`),t=s.messages[e];t!==void 0&&await ze(Yr(t),s.messages.slice(0,e),!1)},$e=async()=>{if(re())return;let e=Rr(s.messages,e=>e.author.kind===`Visitor`&&e.stored),t=s.messages[e];t!==void 0&&await ze({...Yr(t),replacesMessageId:t.id},s.messages.slice(0,e),!1)},et=e=>{let t=s.messages.find(t=>t.id===e);t?.stored&&t.author.kind===`Visitor`&&(Se(),N({editing:{messageId:e,text:zr(t.parts)},attachments:[]}))},tt=()=>{s.editing&&(Se(),N({editing:null,attachments:[]}))},nt=async e=>{let t=s.profile;if(!t||!s.features.Attachments)return;let r=t.limits,i=r.maxAttachments-s.attachments.filter(e=>e.status!==`Failed`).length,a=[],o=[];for(let t of e){let e=Vr(t);f+=1;let s=`file-${f}`,c={key:s,fileName:e.fileName,contentType:e.contentType,length:e.length??0};i<=0?a.push({...c,status:`Failed`,progress:null,error:n.attachmentLimit(r.maxAttachments)}):e.length!==null&&e.length>r.maxFileBytes||!r.contentTypes.includes(e.contentType)?a.push({...c,status:`Failed`,progress:null,error:n.attachmentFailed}):(--i,a.push({...c,status:`Uploading`,progress:0,error:null}),o.push({key:s,file:t}))}N({attachments:[...s.attachments,...a]}),await Promise.all(o.map(({key:e,file:t})=>we(e,t)))},rt=async t=>{let n=y.get(t);n&&(y.delete(t),n.abort());let r=v.has(t)?_.get(t):void 0;r&&await e.deleteAttachment(r.publicId),v.delete(t),_.delete(t),N({attachments:s.attachments.filter(e=>e.key!==t)})};async function it(t){be();let n=c;N({messages:[],conversationId:null,loadError:null,loading:!0,editing:null,thinking:!1,streaming:!1,steps:[],turnError:null,stopped:!1});try{let r=await e.getConversation(t);if(n!==c)return;let i=r.messages.map(e=>Ir(e,!0));le(),ue(i),N({messages:i,conversationId:r.publicId,title:r.title,conversationState:r.state,continuesConversationId:r.continuesConversationId})}catch(e){if(n!==c)return;N({loadError:Fr(e)})}finally{n===c&&N({loading:!1})}}let at=async()=>{let e=s.lastConversation;e&&await it(e.publicId)},ot=()=>{Se(),be(),ve(),le(),N({messages:[],conversationId:null,title:null,conversationState:`Open`,continuesConversationId:null,loadError:null,loading:!1,editing:null,attachments:[],thinking:!1,streaming:!1,steps:[],turnError:null,stopped:!1,pending:null}),s.features.OpenTickets&&Ve()},st=(e,t,n)=>{N({messages:Me(e,e=>({...e,rating:t,ratingNote:n}))})},ct=async(n,r,i)=>{let a=s.messages.find(e=>e.id===n);if(!a?.stored)throw Error(`Only a stored reply can be rated.`);let o={rating:a.rating,ratingNote:a.ratingNote},c=typeof i==`string`&&i.trim()?i.trim():null;st(n,r,c);try{await e.rateMessage(n,{rating:r,note:c})}catch(e){throw st(n,o.rating,o.ratingNote),e}t.onEvent?.(`rated`,{messageId:n,rating:r})},lt=e=>{let n=s.open,r=e?.trigger??`manual`,a=e?.draft,o={open:!0};typeof a==`string`&&a.trim()!==``&&(o.draft=a),!n&&r===`auto`&&i?.set(`wchat:auto-opened`,`1`),N(o),n||t.onEvent?.(`chatOpened`,{layout:t.layout??null,trigger:r})},ut=e=>{s.open&&(i?.set(`wchat:dismissed`,`1`),N({open:!1}),t.onEvent?.(`chatClosed`,{layout:t.layout??null,reason:e}))},dt=e=>{i?.set(`wchat:muted`,e?`1`:`0`),N({muted:e}),t.onEvent?.(`chatSoundToggled`,{muted:e})},ft=async e=>{re()||(e===s.handoffContactRequestId&&N({handoffContactRequestId:null}),t.onEvent?.(`chatLeadSkipped`,{requestId:e}),await ze({wireText:null,displayText:n.skip,quickReplyId:`lead.skip`,replacesMessageId:null,attachments:[]},s.messages,!1))},pt=async()=>{re()||(t.onEvent?.(`chatLeadCancelled`,{}),await ze({wireText:null,displayText:n.cancel,quickReplyId:`lead.cancel`,replacesMessageId:null,attachments:[]},s.messages,!1))},mt=async(e,t)=>{re()||s.messages.some(t=>t.parts.some(t=>t.kind===`Action`&&t.actionId===e))&&await ze({wireText:null,displayText:n.editSomething,quickReplyId:`lead.edit:${t}`,replacesMessageId:null,attachments:[]},s.messages,!1)},ht=async n=>{if(!s.features.HumanHandoff)throw new Tt(`chat_feature_off`,{message:M.errorGeneric,status:403});let r=s.conversationId;if(r===null)throw new Tt(`conversation_required`,{message:M.errorGeneric});if(s.streaming||s.handoffPending)throw new Tt(`busy`,{message:M.errorGeneric});let i=new bt.AbortController;T=i,N({handoffPending:!0}),t.onEvent?.(`chatHandoffRequested`,{conversationId:r});let a=null;try{a=Wr((await e.requestHandoff({conversationId:r,reason:n??null},{signal:i.signal,onEvent:e=>Le(e,`handoff`,()=>!i.signal.aborted)})).parts)}catch(e){throw N({messages:s.messages.filter(e=>!e.streaming),handoffPending:!1}),e}finally{T===i&&(T=null)}N({handoffPending:!1,handoffContactRequestId:a}),await Re(),t.onEvent?.(`chatHandoff`,{destination:`person`})},gt=()=>{let t=s.conversationId;if(!s.features.HumanHandoff||t===null||s.conversationState!==`WithAgent`)return;let n=Date.now();C!==null&&n-C<jr||(C=n,Promise.allSettled([e.sendTyping(t)]))},_t=e=>{D=e,he()},vt=()=>{s.live===`Lost`&&me()&&(pe(null),he())},yt=e=>{if(t.reducedMotion?.()===!0)return Mr;let n=e.navigateAfterMs;if(typeof n==`number`&&Number.isFinite(n)&&n>=0)return n;let r=s.profile?.experience.pacing.handoffPauseMs;return typeof r==`number`&&Number.isFinite(r)?r:Nr},xt=()=>{se(),s.handoffPause&&N({handoffPause:!1})};return{client:e,getState:()=>s,subscribe:e=>(o.add(e),m||We(),()=>{o.delete(e)}),load:We,submit:Ge,chooseQuickReply:Ke,answerInput:Je,sendOtp:qe,confirmAction:Ye,rejectAction:Xe,stop:Ze,retry:Qe,regenerate:$e,startEdit:et,cancelEdit:tt,attach:nt,removeAttachment:rt,openConversation:it,resumeLast:at,newConversation:ot,rate:ct,open:lt,close:ut,setMuted:dt,skipField:ft,cancelLead:pt,editLeadField:mt,requestHandoff:ht,notifyTyping:gt,setLiveActive:_t,resumeLive:vt,beginHandoff:(e,n)=>{s.handoffPause||(N({handoffPause:!0}),t.onEvent?.(`chatHandoff`,{destination:e.id}),w=bt.setTimeout(()=>{w=null;try{n()}catch(e){xt(),xe(e)}},yt(e)))},endHandoffPause:xt,consumeDraft:()=>{s.draft!==null&&N({draft:null})},loadAttachmentUrl:t=>{let r=A.get(t);if(r!==void 0)return r;let i=(async()=>{let r=bt.createObjectUrl;if(!r)throw new Tt(`unsupported`,{message:n.errorGeneric});let i=await e.getAttachment(t);if(O)throw new Tt(`aborted`,{message:n.errorGeneric});let a=r(i);return k.add(a),a})();return A.set(t,i),i.catch(()=>{A.get(t)===i&&A.delete(t)}),i},reset:()=>{Se(),ve(),be(),m=null,j=Promise.resolve(),ee=0,g.clear(),p=null,le(),ae(),se(),N(Xr(i))},dispose:()=>{o.clear(),O=!0,c+=1;let e=l;l=null,e?.abort(),T?.abort(),T=null,se(),ae(),pe(null),Se(),ve();let t=bt.revokeObjectUrl;for(let e of k)t?.(e);k.clear(),A.clear(),N({attachments:[],editing:null,agentTyping:null})}}},Qr=e=>{let t=-1;for(let n=e.length-1;n>=0;--n)if(e[n]?.parts.some(e=>e.kind===`Handoff`)){t=n;break}let n=new Set;for(let r=0;r<t;r+=1){let t=e[r]?.id;t!==void 0&&n.add(t)}return n},$r=(e,t)=>({get features(){return e.getState().features},labels:t.labels,get isLast(){let n=e.getState().messages;return n[n.length-1]?.id===t.messageId},get busy(){let t=e.getState();return t.streaming||t.thinking},get handoffPause(){return e.getState().handoffPause},get handoffSettled(){return Qr(e.getState().messages).has(t.messageId)},chooseQuickReply(t){e.chooseQuickReply(t)},skipInput(t){e.skipField(t)},cancelLead(){e.cancelLead()},answerInput:(t,n,r)=>e.answerInput(t,n,r),uploadInputFile:async(t,n)=>(await e.client.uploadAttachment(t,n?{onProgress:n}:{})).publicId,sendOtp:(t,n)=>e.sendOtp(t,n),confirmAction:t=>e.confirmAction(t),rejectAction:(t,n)=>e.rejectAction(t,n),requestHandoff:t=>e.requestHandoff(t),beginHandoff:(t,n)=>e.beginHandoff(t,n),readAttachment:t=>e.client.getAttachment(t),loadAttachmentUrl:t=>e.loadAttachmentUrl(t),...t.openAttachment?{openAttachment:t.openAttachment}:{},...t.openRecord?{openRecord:t.openRecord}:{},...t.openTicket?{openTicket:t.openTicket}:{},...t.attachmentUrl?{attachmentUrl:t.attachmentUrl}:{},...t.handoffHosts?{handoffHosts:t.handoffHosts}:{},...t.openCitation?{openCitation:t.openCitation}:{},...t.isCitation?{isCitation:t.isCitation}:{},...t.openTarget?{openTarget:t.openTarget}:{},...t.onNavigate?{onNavigate:t.onNavigate}:{}}),ei=e=>e;function ti(e){return e!=null&&e.trim()!==``}function ni(e){return{kind:`paragraph`,text:e}}function ri(e){return e.split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e!==``).map(ni)}function ii(e){return br(e.url)?`${e.title} (${e.url})`:e.title}function ai(e,t){return t===null?e:`${e??``} (${t})`.trim()}function oi(e){let t=[],n=new Set,r=e.map(e=>{let r=new Map;for(let i of e.points)r.set(i.label,i.value),n.has(i.label)||(n.add(i.label),t.push(i.label));return r});return t.map(e=>[e,...r.map(t=>{let n=t.get(e);return n===void 0?``:gr(n,`Decimal`,null)})])}function si(e){return e.map(e=>e.kind===`sup`?`^${e.text}`:e.text).join(``)}function ci(e){return Math.abs(e)<.001&&e!==0?si(fn(e)):gr(e,`Decimal`,null)}function li(e,t){switch(e.kind){case`Text`:case`Notice`:return ri(rr([e]));case`Sources`:return e.sources.length===0?[]:[ni(t.sources),{kind:`list`,ordered:!0,items:e.sources.map(ii)}];case`QuickReplies`:case`Handoff`:return[];case`InputRequest`:return e.state!==`Answered`||!ti(e.answeredSummary)?[]:[ni(e.title===null?e.answeredSummary:`${e.title}: ${e.answeredSummary}`)];case`Action`:{let t=[ni(e.title)];return e.lines.length>0&&t.push({kind:`list`,ordered:!1,items:[...e.lines]}),t}case`Table`:return[{kind:`table`,title:e.title,head:e.columns.map(e=>e.label),rows:e.rows.map(t=>e.columns.map((n,r)=>gr(t[r]??null,n.type,e.currency)))}];case`Chart`:return e.series.length===0?[]:[{kind:`table`,title:ai(e.title,e.unit),head:[``,...e.series.map(e=>e.name)],rows:oi(e.series)}];case`Figures`:return e.figures.length===0?[]:[{kind:`table`,title:null,head:[],rows:e.figures.map(e=>[e.label,ci(e.value)+(ti(e.unit)?` ${e.unit}`:``)])}];case`RecordCard`:{let t=[ni(e.subtitle===null?e.title:`${e.title} ${e.subtitle}`)];return e.fields.length>0&&t.push({kind:`table`,title:null,head:[],rows:e.fields.map(e=>[e.label,gr(e.value,e.type,null)])}),t}case`Image`:return ti(e.alt)?[ni(e.alt)]:[];case`File`:return[ni(`${e.fileName} (${Qn(e.length)})`)];case`Ticket`:return[ni(`${e.number} ${e.subject}`)];case`VoiceClip`:return ti(e.transcript)?[ni(e.transcript)]:[];default:return[]}}function ui(e,t){switch(e.kind){case`paragraph`:return{kind:`paragraph`,text:t(e.text)};case`list`:return{kind:`list`,ordered:e.ordered,items:e.items.map(e=>t(e))};case`table`:return{kind:`table`,title:e.title===null?null:t(e.title),head:e.head.map(e=>t(e)),rows:e.rows.map(e=>e.map(e=>t(e)))}}}function di(e,t,n){switch(e.kind){case`Visitor`:case`Customer`:return t.you;case`Agent`:return ti(e.displayName)?e.displayName:t.agent;case`Assistant`:case`Script`:return ti(e.displayName)?e.displayName:ti(n)?n:t.assistant;case`System`:throw Error(`A System message has no speaker: buildTranscript skips it.`)}}function fi(e,t){let n=t.figureText?dn:ei,r=[],i=null;for(let a of e){if(a.streaming||a.author.kind===`System`)continue;let e=a.parts.flatMap(e=>li(e,t.labels)).map(e=>ui(e,n));e.length!==0&&(r.push({speaker:di(a.author,t.labels,t.assistantName),blocks:e}),i===null&&(i=er(a.createdDateTimeUtc)))}return{title:ti(t.title)?t.title:t.labels.untitled,dateText:i,entries:r}}function pi(e){switch(e.kind){case`paragraph`:return[e.text];case`list`:return e.items.map((t,n)=>e.ordered?`${n+1}. ${t}`:`- ${t}`);case`table`:{let t=[];e.title!==null&&t.push(e.title),e.head.length>0&&t.push(e.head.join(` | `));for(let n of e.rows)t.push(n.join(` | `));return t}}}function mi(e,t){let n=[];t.heading&&n.push([e.title,...e.dateText===null?[]:[e.dateText]].join(`
18
18
  `));for(let r of e.entries){let e=t.speakers?[`${r.speaker}:`]:[];for(let t of r.blocks)e.push(...pi(t));n.push(e.join(`
19
19
  `))}return n.join(`
20
20
 
@@ -38,7 +38,7 @@
38
38
  `],nU=function(){function e(){this.richTextStyles={},this._nextStyleNameId=lu()}return e.prototype._generateStyleName=function(){return`__EC_aUTo_`+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var r=n===`richText`?this._generateStyleName():null,i=Th({color:t,type:e,renderMode:n,markerId:r});return V(i)?i:(this.richTextStyles[r]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};z(t)?L(t,function(e){return I(n,e)}):I(n,t);var r=this._generateStyleName();return this.richTextStyles[r]=n,`{`+r+`|`+e+`}`},e}(),rU=Iu(),iU=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=Kh({count:Eg,reset:Dg}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(rU(this).sourceManager=new XH(this)).prepareSource();var r=this.getInitialData(e,n);kg(r,this),this.dataTask.context.data=r,rU(this).dataBeforeProcessed=r,wg(this),this._initSelectedMapFromData(r)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=Ih(this),r=n?Rh(e):{},i=this.subType;BH.hasClass(i)&&(i+=`Series`),za(e,t.getTheme().get(this.subType)),za(e,this.getDefaultOption()),vu(e,`label`,[`show`]),this.fillDataTextStyle(e.data),n&&Lh(e,r,n)},t.prototype.mergeOption=function(e,t){e=za(this.option,e,!0),this.fillDataTextStyle(e.data);var n=Ih(this);n&&Lh(this.option,e,n);var r=rU(this).sourceManager;r.dirty(),r.prepareSource();var i=this.getInitialData(e,t);kg(i,this),this.dataTask.dirty(),this.dataTask.context.data=i,rU(this).dataBeforeProcessed=i,wg(this),this._initSelectedMapFromData(i)},t.prototype.fillDataTextStyle=function(e){if(e&&!to(e))for(var t=[`show`],n=0;n<e.length;n++)e[n]&&e[n].label&&vu(e[n],`label`,t)},t.prototype.getInitialData=function(e,t){},t.prototype.appendData=function(e){this.getRawData().appendData(e.data)},t.prototype.getData=function(e){var t=jg(this);if(t){var n=t.context.data;return e==null||!n.getLinkedData?n:n.getLinkedData(e)}return rU(this).data},t.prototype.getAllData=function(){var e=this.getData();return e&&e.getLinkedDataAll?e.getLinkedDataAll():[{data:e}]},t.prototype.setData=function(e){var t=jg(this);if(t){var n=t.context;n.outputData=e,t!==this.dataTask&&(n.data=e)}rU(this).data=e},t.prototype.getEncode=function(){var e=this.get(`encode`,!0);if(e)return W(e)},t.prototype.getSourceManager=function(){return rU(this).sourceManager},t.prototype.getSource=function(){return this.getSourceManager().getSource()},t.prototype.getRawData=function(){return rU(this).dataBeforeProcessed},t.prototype.getColorBy=function(){return this.get(`colorBy`)||`series`},t.prototype.isColorBySeries=function(){return this.getColorBy()===`series`},t.prototype.getBaseAxis=function(){var e=this.coordinateSystem;return e&&e.getBaseAxis&&e.getBaseAxis()},t.prototype.indicesOfNearest=function(e,t,n,r){var i=this.getData(),a=this.coordinateSystem,o=a&&a.getAxis(e);if(!a||!o)return[];var s=o.dataToCoord(n);r??=1/0;for(var c=[],l=1/0,u=-1,d=0,f=i.getDimensionIndex(t),p=i.getStore(),m=0,h=p.count();m<h;m++){var g=p.get(f,m),_=s-o.dataToCoord(g),v=Math.abs(_);v<=r&&((v<l||v===l&&_>=0&&u<0)&&(l=v,u=_,d=0),_===u&&(c[d++]=m))}return c.length=d,c},t.prototype.formatTooltip=function(e,t,n){return xg({series:this,dataIndex:e,multipleSeries:t})},t.prototype.isAnimationEnabled=function(){var e=this.ecModel;if(EF.node&&!(e&&e.ssr))return!1;var t=this.getShallow(`animation`);return t&&this.getData().count()>this.getShallow(`animationThreshold`)&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var r=this.ecModel,i=UH.prototype.getColorFromPalette.call(this,e,t,n);return i||=r.getColorFromPalette(e,t,n),i},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get(`progressive`)},t.prototype.getProgressiveThreshold=function(){return this.get(`progressiveThreshold`)},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var r=this.option.selectedMode,i=this.getData(t);if(r===`series`||n===`all`)this.option.selectedMap={},this._selectedDataIndicesMap={};else for(var a=0;a<e.length;a++){var o=e[a],s=Cg(i,o);n[s]=!1,this._selectedDataIndicesMap[s]=-1}}},t.prototype.toggleSelect=function(e,t){for(var n=[],r=0;r<e.length;r++)n[0]=e[r],this.isSelected(e[r],t)?this.unselect(n,t):this.select(n,t)},t.prototype.getSelectedDataIndices=function(){if(this.option.selectedMap===`all`)return[].slice.call(this.getData().getIndices());for(var e=this._selectedDataIndicesMap,t=Ya(e),n=[],r=0;r<t.length;r++){var i=e[t[r]];i>=0&&n.push(i)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var r=this.getData(t);return(n===`all`||n[Cg(r,e)])&&!r.getItemModel(e).get([`select`,`disabled`])},t.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var e=this.option.universalTransition;return e?e===!0||e&&e.enabled:!1},t.prototype._innerSelect=function(e,t){var n,r,i=this.option,a=i.selectedMode,o=t.length;if(a&&o){if(a===`series`)i.selectedMap=`all`;else if(a===`multiple`){H(i.selectedMap)||(i.selectedMap={});for(var s=i.selectedMap,c=0;c<o;c++){var l=t[c],u=Cg(e,l);s[u]=!0,this._selectedDataIndicesMap[u]=e.getRawIndex(l)}}else if(a===`single`||a===!0){var d=t[o-1],u=Cg(e,d);i.selectedMap=(n={},n[u]=!0,n),this._selectedDataIndicesMap=(r={},r[u]=e.getRawIndex(d),r)}}},t.prototype._initSelectedMapFromData=function(e){if(!this.option.selectedMap){var t=[];e.hasItemOption&&e.each(function(n){var r=e.getRawDataItem(n);r&&r.selected&&t.push(n)}),t.length>0&&this._innerSelect(e,t)}},t.registerClass=function(e){return BH.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type=`series.__base__`,e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol=`circle`,e.visualStyleAccessPath=`itemStyle`,e.visualDrawType=`fill`}(),t}(BH),Wa(iU,GH),Wa(iU,UH),Do(iU,BH),aU=lR.extend({type:`triangle`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r+a),e.lineTo(n-i,r+a),e.closePath()}}),oU={line:lB,rect:vR,roundRect:vR,square:vR,circle:zz,diamond:lR.extend({type:`diamond`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r),e.lineTo(n,r+a),e.lineTo(n-i,r),e.closePath()}}),pin:lR.extend({type:`pin`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,r=t.y,i=t.width/5*3,a=Math.max(i,t.height),o=i/2,s=o*o/(a-o),c=r-a+o+s,l=Math.asin(s/o),u=Math.cos(l)*o,d=Math.sin(l),f=Math.cos(l),p=o*.6,m=o*.7;e.moveTo(n-u,c+s),e.arc(n,c,o,Math.PI-l,Math.PI*2+l),e.bezierCurveTo(n+u-d*p,c+s+f*p,n,r-m,n,r),e.bezierCurveTo(n,r-m,n-u+d*p,c+s+f*p,n-u,c+s),e.closePath()}}),arrow:lR.extend({type:`arrow`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,r=t.width,i=t.x,a=t.y,o=r/3*2;e.moveTo(i,a),e.lineTo(i+o,a+n),e.lineTo(i,a+n/4*3),e.lineTo(i-o,a+n),e.lineTo(i,a),e.closePath()}}),triangle:aU},sU={line:function(e,t,n,r,i){i.x1=e,i.y1=t+r/2,i.x2=e+n,i.y2=t+r/2},rect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r},roundRect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r,i.r=Math.min(n,r)/4},square:function(e,t,n,r,i){var a=Math.min(n,r);i.x=e,i.y=t,i.width=a,i.height=a},circle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.r=Math.min(n,r)/2},diamond:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r},pin:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},arrow:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},triangle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r}},cU={},L(oU,function(e,t){cU[t]=new e}),lU=lR.extend({type:`symbol`,shape:{symbolType:``,x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var r=_s(e,t,n),i=this.shape;return i&&i.symbolType===`pin`&&t.position===`inside`&&(r.y=n.y+n.height*.4),r},buildPath:function(e,t,n){var r=t.symbolType;if(r!==`none`){var i=cU[r];i||=(r=`rect`,cU[r]),sU[r](t.x,t.y,t.width,t.height,i.shape),i.buildPath(e,i.shape,n)}}}),uU=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return t.prototype.getInitialData=function(e){return Tm(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new Lz,n=Ng(`line`,0,e.itemHeight/2,e.itemWidth,0,e.lineStyle.stroke,!1);t.add(n),n.setStyle(e.lineStyle);var r=this.getData().getVisual(`symbol`),i=this.getData().getVisual(`symbolRotate`),a=r===`none`?`circle`:r,o=e.itemHeight*.8,s=Ng(a,(e.itemWidth-o)/2,(e.itemHeight-o)/2,o,o,e.itemStyle.fill);return t.add(s),s.setStyle(e.itemStyle),s.rotation=(e.iconRotate===`inherit`?i:e.iconRotate||0)*Math.PI/180,s.setOrigin([e.itemWidth/2,e.itemHeight/2]),a.indexOf(`empty`)>-1&&(s.style.stroke=s.style.fill,s.style.fill=X.color.neutral00,s.style.lineWidth=2),t},t.type=`series.line`,t.dependencies=[`grid`,`polar`],t.defaultOption={z:3,coordinateSystem:`cartesian2d`,legendHoverLink:!0,clip:!0,label:{position:`top`},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:`solid`},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:`emptyCircle`,symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:`auto`,connectNulls:!1,sampling:`none`,animationEasing:`linear`,progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:`clone`},triggerLineEvent:!1,triggerEvent:!1},t}(iU),dU=function(e){F(t,e);function t(t,n,r,i){var a=e.call(this)||this;return a.updateData(t,n,r,i),a}return t.prototype._createSymbol=function(e,t,n,r,i,a){this.removeAll();var o=Ng(e,-1,-1,2,2,null,a);o.attr({z2:U(i,100),culling:!0,scaleX:r[0]/2,scaleY:r[1]/2}),o.drift=Rg,this._symbolType=e,this.add(o)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){Dd(this.childAt(0))},t.prototype.downplay=function(){Od(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?`move`:n.cursor},t.prototype.updateData=function(e,n,r,i){this.silent=!1;var a=e.getItemVisual(n,`symbol`)||`circle`,o=e.hostModel,s=t.getSymbolSize(e,n),c=t.getSymbolZ2(e,n),l=a!==this._symbolType,u=i&&i.disableAnimation;if(l){var d=e.getItemVisual(n,`symbolKeepAspect`);this._createSymbol(a,e,n,s,c,d)}else{var f=this.childAt(0);f.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?f.attr(p):Sf(f,p,o,n),Of(f)}if(this._updateCommon(e,n,s,r,i),l){var f=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:f.style.opacity}};f.scaleX=f.scaleY=0,f.style.opacity=0,Cf(f,p,o,n)}}u&&this.childAt(0).stopAnimation(`leave`)},t.prototype._updateCommon=function(e,t,n,r,i){var a=this.childAt(0),o=e.hostModel,s,c,l,u,d,f,p,m,h;if(r&&(s=r.emphasisItemStyle,c=r.blurItemStyle,l=r.selectItemStyle,u=r.focus,d=r.blurScope,p=r.labelStatesModels,m=r.hoverScale,h=r.cursorStyle,f=r.emphasisDisabled),!r||e.hasItemOption){var g=r&&r.itemModel?r.itemModel:e.getItemModel(t),_=g.getModel(`emphasis`);s=_.getModel(`itemStyle`).getItemStyle(),l=g.getModel([`select`,`itemStyle`]).getItemStyle(),c=g.getModel([`blur`,`itemStyle`]).getItemStyle(),u=_.get(`focus`),d=_.get(`blurScope`),f=_.get(`disabled`),p=gp(g),m=_.getShallow(`scale`),h=g.getShallow(`cursor`)}var v=e.getItemVisual(t,`symbolRotate`);a.attr(`rotation`,(v||0)*Math.PI/180||0);var y=Fg(e.getItemVisual(t,`symbolOffset`),n);y&&(a.x=y[0],a.y=y[1]),h&&a.attr(`cursor`,h);var b=e.getItemVisual(t,`style`),x=b.fill;if(a instanceof mR){var S=a.style;a.useStyle(I({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else a.__isEmptyBrush?a.useStyle(I({},b)):a.useStyle(b),a.style.decal=null,a.setColor(x,i&&i.symbolInnerColor),a.style.strokeNoScale=!0;var C=e.getItemVisual(t,`liftZ`),w=this._z2;C==null?w!=null&&(a.z2=w,this._z2=null):w??(this._z2=a.z2,a.z2+=C);var T=i&&i.useNameLabel;hp(a,p,{labelFetcher:o,labelDataIndex:t,defaultText:E,inheritColor:x,defaultOpacity:b.opacity});function E(t){return T?e.getName(t):Ig(e,t)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var D=a.ensureState(`emphasis`);D.style=s,a.ensureState(`select`).style=l,a.ensureState(`blur`).style=c;var O=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;D.scaleX=this._sizeX*O,D.scaleY=this._sizeY*O,this.setSymbolScale(1),Kd(this,u,d,f)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var r=this.childAt(0),i=QR(this).dataIndex,a=n&&n.animation;if(this.silent=r.silent=!0,n&&n.fadeLabel){var o=r.getTextContent();o&&Tf(o,{style:{opacity:0}},t,{dataIndex:i,removeOpt:a,cb:function(){r.removeTextContent()}})}else r.removeTextContent();Tf(r,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:i,cb:e,removeOpt:a})},t.getSymbolSize=function(e,t){return Pg(e.getItemVisual(t,`symbolSize`))},t.getSymbolZ2=function(e,t){return e.getItemVisual(t,`z2`)},t}(Lz),fU=function(){function e(e){this.group=new Lz,this._SymbolCtor=e||dU}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=Bg(t);var n=this.group,r=e.hostModel,i=this._data,a=this._SymbolCtor,o=t.disableAnimation,s=this._seriesScope=Vg(e),c={disableAnimation:o},l=t.getSymbolPoint||function(t){return e.getItemLayout(t)};i||n.removeAll(),e.diff(i).add(function(r){var i=l(r);zg(e,i,r,t)&&Hg(a,e,r,s,c,i,n)}).update(function(u,d){var f=i.getItemGraphicEl(d),p=l(u);if(!zg(e,p,u,t))n.remove(f);else{var m=e.getItemVisual(u,`symbol`)||`circle`,h=f&&f.getSymbolType&&f.getSymbolType();if(!f||h&&h!==m)n.remove(f),f=new a(e,u,s,c),f.setPosition(p);else{f.updateData(e,u,s,c);var g={x:p[0],y:p[1]};o?f.attr(g):Sf(f,g,r)}n.add(f),e.setItemGraphicEl(u,f)}}).remove(function(e){var t=i.getItemGraphicEl(e);t&&t.fadeOut(function(){n.remove(t)},r)}).execute(),this._getSymbolPoint=l,this._data=e},e.prototype.updateLayout=function(e){var t=this._data;if(t)for(var n=this,r=t.getStore(),i=0,a=r.count();i<a;i++){var o=t.getItemGraphicEl(i),s=n._getSymbolPoint(i);zg(t,s,i,e)?(o||=Hg(n._SymbolCtor,t,i,n._seriesScope,{disableAnimation:!0},s,n.group),o.stopAnimation(),o.setPosition(s),o.markRedraw()):o&&(n.group.remove(o),t.setItemGraphicEl(i,null))}},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=Vg(e),this._data=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n,r){this._progressiveEls=[],r=Bg(r);function i(e){e.isGroup||(e.incremental=n,e.ensureState(`emphasis`).hoverLayer=2)}for(var a=e.start;a<e.end;a++){var o=t.getItemLayout(a);if(zg(t,o,a,r)){var s=new this._SymbolCtor(t,a,this._seriesScope);s.traverse(i),s.setPosition(o),this.group.add(s),t.setItemGraphicEl(a,s),this._progressiveEls.push(s)}}},e.prototype.eachRendered=function(e){np(this._progressiveEls||this.group,e)},e.prototype.remove=function(e){var t=this.group,n=this._data;n&&e?n.eachItemGraphicEl(function(e){e.fadeOut(function(){t.remove(e)},n.hostModel)}):t.removeAll()},e}(),pU=typeof Float32Array<`u`?Float32Array:void 0,mU=typeof Float64Array<`u`?Float64Array:void 0,hU=Math.min,gU=Math.max,_U=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),vU=function(e){F(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polyline`,n}return t.prototype.getDefaultStyle=function(){return{stroke:X.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new _U},t.prototype.buildPath=function(e,t){var n=t.points,r=0,i=n.length/2;if(t.connectNulls){for(;i>0&&Kg(n[i*2-2],n[i*2-1]);i--);for(;r<i&&Kg(n[r*2],n[r*2+1]);r++);}for(;r<i;)r+=Zg(e,n,r,i,i,1,t.smooth,t.smoothMonotone,t.connectNulls)+1},t.prototype.getPointOn=function(e,t){this.path||(this.createPathProxy(),this.buildPath(this.path,this.shape));for(var n=this.path.data,r=QL.CMD,i,a,o=t===`x`,s=[],c=0;c<n.length;){var l=n[c++],u=void 0,d=void 0,f=void 0,p=void 0,m=void 0,h=void 0,g=void 0;switch(l){case r.M:i=n[c++],a=n[c++];break;case r.L:if(u=n[c++],d=n[c++],g=o?(e-i)/(u-i):(e-a)/(d-a),g<=1&&g>=0){var _=o?(d-a)*g+a:(u-i)*g+i;return o?[e,_]:[_,e]}i=u,a=d;break;case r.C:u=n[c++],d=n[c++],f=n[c++],p=n[c++],m=n[c++],h=n[c++];var v=o?Bs(i,u,f,m,e,s):Bs(a,d,p,h,e,s);if(v>0)for(var y=0;y<v;y++){var b=s[y];if(b<=1&&b>=0){var _=o?Rs(a,d,p,h,b):Rs(i,u,f,m,b);return o?[e,_]:[_,e]}}i=m,a=h}}},t}(lR),yU=function(e){F(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(_U),bU=function(e){F(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polygon`,n}return t.prototype.getDefaultShape=function(){return new yU},t.prototype.buildPath=function(e,t){var n=t.points,r=t.stackedOnPoints,i=0,a=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;a>0&&Kg(n[a*2-2],n[a*2-1]);a--);for(;i<a&&Kg(n[i*2],n[i*2+1]);i++);}for(;i<a;){var s=Zg(e,n,i,a,a,1,t.smooth,o,t.connectNulls);Zg(e,r,i+s-1,s,a,-1,t.stackedOnSmooth,o,t.connectNulls),i+=s+1,e.closePath()}},t}(lR),xU=Iu(),SU=Qg(),CU=function(){function e(){this.group=new Lz,this.uid=Om(`viewChart`),this.renderTask=Kh({plan:t_,reset:n_}),this.renderTask.context={view:this}}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.highlight=function(e,t,n,r){var i=e.getData(r&&r.dataType);i&&e_(i,r,`emphasis`)},e.prototype.downplay=function(e,t,n,r){var i=e.getData(r&&r.dataType);i&&e_(i,r,`normal`)},e.prototype.remove=function(e,t){this.group.removeAll()},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){this.render(e,t,n,r)},e.prototype.updateVisual=function(e,t,n,r){this.render(e,t,n,r)},e.prototype.eachRendered=function(e){np(this.group,e)},e.markUpdateMethod=function(e,t){xU(e).updateMethod=t},e.protoInitialize=function(){var t=e.prototype;t.type=`chart`}(),e}(),To(CU,[`dispose`]),jo(CU),wU={incrementalPrepareRender:{progress:function(e,t){t.view.incrementalRender(e,t.model,t.ecModel,t.api,t.payload)}},render:{forceFirstProgress:!0,progress:function(e,t){t.view.render(t.model,t.ecModel,t.api,t.payload)}}},TU=function(){function e(){}return e.prototype.isBlank=function(){return this._isBlank},e.prototype.setBlank=function(e){this._isBlank=e},e}(),jo(TU),EU=0,DU=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++EU,this._onCollect=e.onCollect}return e.createByAxisModel=function(t){var n=t.option,r=n.data,i=r&&R(r,pee);return new e({categories:i,needCollect:!i,deduplication:n.dedplication!==!1})},e.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},e.prototype.parseAndCollect=function(e){var t,n=this._needCollect;if(!V(e)&&!n)return e;if(n&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,this._onCollect&&this._onCollect(e,t),t;var r=this._getOrCreateMap();return t=r.get(e),t??(n?(t=this.categories.length,this.categories[t]=e,r.set(e,t),this._onCollect&&this._onCollect(e,t)):t=NaN),t},e.prototype._getOrCreateMap=function(){return this._map||=W(this.categories)},e}(),OU=Ya({needTransform:1,normalize:1,scale:1,transformIn:1,transformOut:1,contain:1,getExtent:1,getExtentUnsafe:1,setExtent:1,setExtent2:1,getFilter:1,sanitize:1,getDefaultStartValue:1,freeze:1}),kU={needTransform:function(){return!1},normalize:function(e){var t=this._extents[1]||this._extents[0];return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])},scale:function(e){var t=this._extents[1]||this._extents[0];return e*(t[1]-t[0])+t[0]},transformIn:function(e){return e},transformOut:function(e){return e},contain:function(e){var t=g_(this,null);return e>=t[0]&&e<=t[1]},getExtent:function(){return this._extents[0].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){y_(this._extents,0,e,t)},setExtent2:function(e,t,n){var r=this._extents;r[e]||(r[e]=r[0].slice()),y_(r,e,t,n)},freeze:function(){}},AU=function(e){F(t,e);function t(n){var r=e.call(this)||this;r.type=`ordinal`,r.parse=t.parse,p_(r,t.decoratedMethods);var i=n.ordinalMeta;i||=new DU({}),z(i)&&(i=new DU({categories:R(i,function(e){return H(e)?e.value:e})})),r._ordinalMeta=i;var a=f_(null,null,n.extent||[0,i.categories.length-1]);return r._mapper=a.mapper,m_(r,a.mapper),r}return t.parse=function(e){return e==null?e=NaN:V(e)?(e=this._ordinalMeta.getOrdinal(e),e??=NaN):e=MR(e),e},t.prototype.getTicks=function(){var e=[];return M_(this,0,function(t){e.push(t)}),e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(e==null)this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;else{for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],r=this._ticksByOrdinalNumber=[],i=0,a=this._ordinalMeta.categories.length,o=kR(a,t.length);i<o;++i){var s=n[i]=t[i];r[s]=i}for(var c=0;i<a;++i){for(;r[c]!=null;)c++;n[i]=c,r[c]=i}}},t.prototype._getTickNumber=function(e){var t=this._ticksByOrdinalNumber;return t&&e>=0&&e<t.length?t[e]:e},t.prototype.getRawOrdinalNumber=function(e){var t=this._ordinalNumbersByTick;return t&&e>=0&&e<t.length?t[e]:e},t.prototype.getLabel=function(e){if(!this.isBlank()){var t=this.getRawOrdinalNumber(e.value),n=this._ordinalMeta.categories[t];return n==null?``:n+``}},t.prototype.count=function(){var e=h_(this._mapper);return e[1]-e[0]+1},t.prototype.getOrdinalMeta=function(){return this._ordinalMeta},t.type=`ordinal`,t.decoratedMethods={needTransform:function(){return this._mapper.needTransform()},contain:function(e){return this._mapper.contain(this._getTickNumber(e))&&e>=0&&e<this._ordinalMeta.categories.length},normalize:function(e){return this._mapper.normalize(this._getTickNumber(e))},scale:function(e){return this.getRawOrdinalNumber(MR(this._mapper.scale(e)))},transformIn:function(e,t){return this._mapper.transformIn(this._getTickNumber(e),t)},transformOut:function(e,t){return this.getRawOrdinalNumber(this._mapper.transformOut(e,t))},getExtent:function(){return this._mapper.getExtent()},getExtentUnsafe:function(e,t){return this._mapper.getExtentUnsafe(e,t)},setExtent:function(e,t){return this._mapper.setExtent(e,t)},setExtent2:function(e,t,n){return this._mapper.setExtent2(e,t,n)}},t}(TU),TU.registerClass(AU),jU=function(e){F(t,e);function t(n){var r=e.call(this)||this;return r.type=`interval`,r.parse=t.parse,n||={},r.brk=f_(r,qm(r,n),null).brk,r._cfg={interval:0,intervalPrecision:2,intervalCount:void 0,niceExtent:void 0},r}return t.parse=function(e){return e==null||e===``?NaN:Number(e)},t.prototype.getConfig=function(){return Ra(this._cfg)},t.prototype.setConfig=function(e){var t=h_(this);this._cfg=e=Ra(e),e.niceExtent??(e.niceExtent=t.slice()),e.intervalPrecision??(e.intervalPrecision=E_(e.interval))},t.prototype.getTicks=function(e){e||={};var t=this._cfg,n=t.interval,r=h_(this),i=t.niceExtent,a=t.intervalPrecision,o=Km(),s=this.brk,c=o&&s,l=[];if(!n)return l;if(e.breakTicks===`only_break`&&c)return o.addBreaksToTicks(l,s.breaks,r),l;var u=3e3;r[0]<i[0]&&l.push({value:e.expandToNicedExtent?ql(i[0]-n,a):r[0]});for(var d=function(e,t){return MR((t-e)/n)},f=t.intervalCount,p=i[0],m=0;;m++){if(f==null){if(p>i[1]||!isFinite(p)||!isFinite(i[1]))break}else{if(m>f)break;p=kR(p,i[1]),m===f&&(p=i[1])}if(l.push({value:p}),p=ql(p+n,a),s){var h=s.calcNiceTickMultiple(p,d);h>=0&&(p=ql(p+h*n,a))}if(l.length>0&&p===l[l.length-1].value)break;if(l.length>u)return[]}var g=l.length?l[l.length-1].value:i[1];return r[1]>g&&l.push({value:e.expandToNicedExtent?ql(g+n,a):r[1]}),c&&o.pruneTicksByBreak(e.pruneByBreak,l,s.breaks,function(e){return e.value},t.interval,r),c&&e.breakTicks!==`none`&&o.addBreaksToTicks(l,s.breaks,r),l},t.prototype.getMinorTicks=function(e){return N_(this,e,Jm(this),this._cfg.interval)},t.prototype.getLabel=function(e,t){if(e==null)return``;var n=t&&t.precision;return n==null?n=Yl(e.value)||0:n===`auto`&&(n=this._cfg.intervalPrecision),bh(ql(e.value,n,!0))},t.type=`interval`,t}(TU),TU.registerClass(jU),MU=function(e,t,n,r){for(;n<r;){var i=n+r>>>1;e[i][1]<t?n=i+1:r=i}return n},NU=function(e){F(t,e);function t(n){var r=e.call(this)||this;return r.type=`time`,r.parse=t.parse,r._locale=n.locale,r._useUTC=n.useUTC,r._interval=0,r.brk=f_(r,qm(r,n),null).brk,r}return t.prototype.getLabel=function(e){return nh(e.value,OH[th($m(this._minLevelUnit))]||OH.second,this._useUTC,this._locale)},t.prototype.getFormattedLabel=function(e,t,n){return rh(e,t,n,this._locale,this._useUTC)},t.prototype.getTicks=function(e){e||={};var t=this._interval,n=h_(this),r=Km(),i=this.brk,a=r&&i,o=[];if(!t)return o;var s=this._useUTC;if(a&&e.breakTicks===`only_break`)return Km().addBreaksToTicks(o,i.breaks,n),o;o=H_(this._minLevelUnit,this._approxInterval,s,n,__(this),i);var c=kH.length-1,l=0;return L(o,function(e){e.time&&(c=Math.min(c,Ha(kH,e.time.upperTimeUnit)),l=Math.max(l,e.time.level))}),a&&Km().pruneTicksByBreak(e.pruneByBreak,o,i.breaks,function(e){return e.value},this._approxInterval,n),a&&e.breakTicks!==`none`&&Km().addBreaksToTicks(o,i.breaks,n,function(e){for(var t=Math.max(Ha(kH,ih(e.vmin,s)),Ha(kH,ih(e.vmax,s))),n=0,r=0;r<kH.length;r++)if(!P_(kH[r],e.vmin,e.vmax,s)){n=r;break}var i=Math.min(n,c);return{level:l,lowerTimeUnit:kH[Math.max(i,t)],upperTimeUnit:kH[i]}}),o},t.prototype.getMinorTicks=function(e){return N_(this,e,Jm(this),this._interval)},t.prototype.setTimeInterval=function(e){this._interval=e.interval,this._approxInterval=e.approxInterval,this._minLevelUnit=e.minLevelUnit},t.parse=function(e){return $a(e)?Math.round(e):+nu(e)},t.type=`time`,t}(TU),PU=[[`second`,yH],[`minute`,bH],[`hour`,xH],[`quarter-day`,xH*6],[`half-day`,xH*12],[`day`,SH*1.2],[`half-week`,SH*3.5],[`week`,SH*7],[`month`,SH*31],[`quarter`,SH*95],[`half-year`,CH/2],[`year`,CH]],FU=function(e,t){var n=e.getExtent();if(n[0]===n[1]&&(n[0]-=SH,n[1]+=SH),n[1]===-1/0&&n[0]===1/0){var r=new Date;n[1]=+new Date(r.getFullYear(),r.getMonth(),r.getDate()),n[0]=n[1]-SH}e.setExtent(n[0],n[1]);var i=j_(t.splitNumber,10),a=__(e)/i,o=t.minInterval,s=t.maxInterval;o!=null&&a<o&&(a=o),s!=null&&a>s&&(a=s);var c=PU.length,l=Math.min(MU(PU,a,0,c),c-1),u=PU[l][1],d=PU[Math.max(l-1,0)][0];e.setTimeInterval({approxInterval:a,interval:u,minLevelUnit:d})},TU.registerClass(NU),IU=0,LU=1,RU=2,zU=function(e){F(t,e);function t(n){var r=e.call(this)||this;r.type=`log`,r.parse=jU.parse,r.base=n.logBase||10;var i=[],a=[],o=r._lookup={from:i,to:a};i[IU]=i[LU]=a[IU]=a[LU]=NaN,p_(r,t.mapperMethods);var s=Km(),c=n.breakOption,l={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(c,r,{noNegative:!0},RU,l),r.powStub=new jU({breakParsed:l.original}),r.intervalStub=new jU({breakParsed:l.transformed}),m_(r,r.intervalStub),r}return t.prototype.getTicks=function(e){var t=this.base,n=this.powStub,r=Km(),i=this.intervalStub,a={lookup:{from:i.getExtent(),to:n.getExtent()}};return R(i.getTicks(e||{}),function(e){var i=e.value,o=O_(i,t,a),s;if(r){var c=r.getTicksBreakOutwardTransform(this,e,Jm(n),this._lookup);c&&(s=c.vBreak,o=c.tickVal)}return{value:o,break:s}},this)},t.prototype.getMinorTicks=function(e){return N_(this,e,Jm(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(e,t){return this.intervalStub.getLabel(e,t)},t.type=`log`,t.mapperMethods={needTransform:function(){return!0},normalize:function(e){return this.intervalStub.normalize(D_(e,this.base))},scale:function(e){return O_(this.intervalStub.scale(e),this.base,null)},transformIn:function(e,t){return e=D_(e,this.base),t&&t.depth===2?e:this.intervalStub.transformIn(e,t)},transformOut:function(e,t){var n=t?t.depth:null;return BU.depth=n,VU.lookup=this._lookup,O_(n===2?e:this.intervalStub.transformOut(e,BU),this.base,VU)},contain:function(e){return this.powStub.contain(e)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){if(!(!Qu(t,n)||t<=0||n<=0)){var r=HU,i=HU;if(e===0){var a=this._lookup;r=a.to,i=a.from}this.powStub.setExtent2(e,r[IU]=t,r[LU]=n);var o=this.base;this.intervalStub.setExtent2(e,i[IU]=D_(t,o),i[LU]=D_(n,o))}},getFilter:function(){return{g:0}},sanitize:function(e,t){return Qu(t[0],t[1])&&fu(e)&&e<=0&&(e=t[0]),e},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(e,t){return t===null?this.powStub.getExtentUnsafe(e,null):this.intervalStub.getExtentUnsafe(e,t)}},t}(TU),TU.registerClass(zU),BU={},VU={},HU=[],UU={value:1,category:1,time:1,log:1},WU=Iu(),GU=function(e){F(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(){var e=new Lz,t=new fU;this.group.add(t.group),this._symbolDraw=t,this._lineGroup=e,this._changePolyState=q(this._changePolyState,this)},t.prototype.render=function(e,t,n){var r=e.coordinateSystem,i=this.group,a=e.getData(),o=e.getModel(`lineStyle`),s=e.getModel(`areaStyle`),c=a.getLayout(`points`)||[],l=r.type===`polar`,u=this._coordSys,d=this._symbolDraw,f=this._polyline,p=this._polygon,m=this._lineGroup,h=!t.ssr&&e.get(`animation`),g=!s.isEmpty(),_=s.get(`origin`),v=Ug(r,a,_),y=g&&uv(r,a,v),b=e.get(`showSymbol`),x=e.get(`connectNulls`),S=b&&!l&&mv(e,a,r),C=this._data;C&&C.eachItemGraphicEl(function(e,t){e.__temp&&(i.remove(e),C.setItemGraphicEl(t,null))}),b||d.remove(),i.add(m);var w=!l&&e.get(`step`),T;r&&r.getArea&&e.get(`clip`,!0)&&(T=r.getArea(),T.width==null?T.r0&&(T.r0-=.5,T.r+=.5):(T.x-=.1,T.y-=.1,T.width+=.2,T.height+=.2)),this._clipShapeForSymbol=T;var E=pv(a,r,n)||a.getVisual(`style`)[a.getVisual(`drawType`)];if(!(f&&u.type===r.type&&w===this._step))b&&d.updateData(a,{isIgnore:S,clipShape:T,disableAnimation:!0,getSymbolPoint:function(e){return[c[e*2],c[e*2+1]]}}),h&&this._initSymbolLabelAnimation(a,r,T),w&&(y&&=dv(y,c,r,w,x),c=dv(c,null,r,w,x)),f=this._newPolyline(c),g?p=this._newPolygon(c,y):p&&=(m.remove(p),this._polygon=null),l||this._initOrUpdateEndLabel(e,r,Eh(E)),m.setClipPath(bv(this,r,!0,e));else{g&&!p?p=this._newPolygon(c,y):p&&!g&&(m.remove(p),p=this._polygon=null),l||this._initOrUpdateEndLabel(e,r,Eh(E));var D=m.getClipPath();D?Cf(D,{shape:bv(this,r,!1,e).shape},e):m.setClipPath(bv(this,r,!0,e)),b&&d.updateData(a,{isIgnore:S,clipShape:T,disableAnimation:!0,getSymbolPoint:function(e){return[c[e*2],c[e*2+1]]}}),ov(this._stackedOnPoints,y)&&ov(this._points,c)||(h?this._doUpdateAnimation(a,y,r,n,w,_,x):(w&&(y&&=dv(y,c,r,w,x),c=dv(c,null,r,w,x)),f.setShape({points:c}),p&&p.setShape({points:c,stackedOnPoints:y})))}var O=e.getModel(`emphasis`),k=O.get(`focus`),A=O.get(`blurScope`),j=O.get(`disabled`);if(f.useStyle(Va(o.getLineStyle(),{fill:`none`,stroke:E,lineJoin:`bevel`})),Jd(f,e,`lineStyle`),f.style.lineWidth>0&&e.get([`emphasis`,`lineStyle`,`width`])===`bolder`){var ee=f.getState(`emphasis`).style;ee.lineWidth=+f.style.lineWidth+1}QR(f).seriesIndex=e.seriesIndex,Kd(f,k,A,j);var te=lv(e.get(`smooth`)),ne=e.get(`smoothMonotone`);if(f.setShape({smooth:te,smoothMonotone:ne,connectNulls:x}),p){var re=a.getCalculationInfo(`stackedOnSeries`),ie=0;p.useStyle(Va(s.getAreaStyle(),{fill:E,opacity:.7,lineJoin:`bevel`,decal:a.getVisual(`style`).decal})),re&&(ie=lv(re.get(`smooth`))),p.setShape({smooth:te,stackedOnSmooth:ie,smoothMonotone:ne,connectNulls:x}),Jd(p,e,`areaStyle`),QR(p).seriesIndex=e.seriesIndex,Kd(p,k,A,j)}var ae=this._changePolyState;a.eachItemGraphicEl(function(e){e&&(e.onHoverStateChange=ae)}),this._polyline.onHoverStateChange=ae,this._data=a,this._coordSys=r,this._stackedOnPoints=y,this._points=c,this._step=w,this._valueOrigin=_;var M=e.get(`triggerEvent`),oe=e.get(`triggerLineEvent`),se=oe===!0||M===!0||M===`line`,ce=oe===!0||M===!0||M===`area`;this.packEventData(e,f,se),p&&this.packEventData(e,p,ce)},t.prototype.packEventData=function(e,t,n){QR(t).eventData=n?{componentType:`series`,componentSubType:`line`,componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:`line`,selfType:t===this._polygon?`area`:`line`}:null},t.prototype.highlight=function(e,t,n,r){var i=e.getData(),a=Fu(i,r);if(this._changePolyState(`emphasis`),!(a instanceof Array)&&a!=null&&a>=0){var o=i.getLayout(`points`),s=i.getItemGraphicEl(a);if(!s){var c=o[a*2],l=o[a*2+1];if(Kg(c,l)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,l))return;var u=e.get(`zlevel`)||0,d=e.get(`z`)||0;s=new dU(i,a),s.x=c,s.y=l,s.setZ(u,d);var f=s.getSymbolPath().getTextContent();f&&(f.zlevel=u,f.z=d,f.z2=this._polyline.z2+1),s.__temp=!0,i.setItemGraphicEl(a,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else CU.prototype.highlight.call(this,e,t,n,r)},t.prototype.downplay=function(e,t,n,r){var i=e.getData(),a=Fu(i,r);if(this._changePolyState(`normal`),a!=null&&a>=0){var o=i.getItemGraphicEl(a);o&&(o.__temp?(i.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else CU.prototype.downplay.call(this,e,t,n,r)},t.prototype._changePolyState=function(e){var t=this._polygon;vd(this._polyline,e),t&&vd(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new vU({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new bU({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var r,i,a=t.getBaseAxis(),o=a.inverse;t.type===`cartesian2d`?(r=a.isHorizontal(),i=!1):t.type===`polar`&&(r=a.dim===`angle`,i=!0);var s=e.hostModel,c=s.get(`animationDuration`);B(c)&&(c=c(null));var l=s.get(`animationDelay`)||0,u=B(l)?l(null):l;e.eachItemGraphicEl(function(e,a){var s=e;if(s){var d=[e.x,e.y],f=void 0,p=void 0,m=void 0;if(n){if(i){var h=n,g=t.pointToCoord(d);r?(f=h.startAngle,p=h.endAngle,m=-g[1]/180*Math.PI):(f=h.r0,p=h.r,m=g[0])}else{var _=n;r?(f=_.x,p=_.x+_.width,m=e.x):(f=_.y+_.height,p=_.y,m=e.y)}}var v=p===f?0:(m-f)/(p-f);o&&(v=1-v);var y=B(l)?l(a):c*v+u,b=s.getSymbolPath(),x=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:y}),x&&x.animateFrom({style:{opacity:0}},{duration:300,delay:y}),b.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(e,t,n){var r=e.getModel(`endLabel`);if(yv(e)){var i=e.getData(),a=this._polyline,o=i.getLayout(`points`);if(!o){a.removeTextContent(),this._endLabel=null;return}var s=this._endLabel;s||(s=this._endLabel=new CR({z2:200}),s.ignoreClip=!0,a.setTextContent(this._endLabel),a.disableLabelAnimation=!0);var c=gv(o);c>=0&&(hp(a,gp(e,`endLabel`),{inheritColor:n,labelFetcher:e,labelDataIndex:c,defaultText:function(e,t,n){return n==null?Ig(i,e):Lg(i,n)},enableTextSetter:!0},xv(r,t)),a.textConfig.position=null)}else this._endLabel&&=(this._polyline.removeTextContent(),null)},t.prototype._endLabelOnDuring=function(e,t,n,r,i,a,o){var s=this._endLabel,c=this._polyline;if(s){e<1&&r.originalX==null&&(r.originalX=s.x,r.originalY=s.y);var l=n.getLayout(`points`),u=n.hostModel,d=u.get(`connectNulls`),f=a.get(`precision`),p=a.get(`distance`)||0,m=o.getBaseAxis(),h=m.isHorizontal(),g=m.inverse,_=t.shape,v=g?h?_.x:_.y+_.height:h?_.x+_.width:_.y,y=(h?p:0)*(g?-1:1),b=(h?0:-p)*(g?-1:1),x=h?`x`:`y`,S=vv(l,v,x),C=S.range,w=C[1]-C[0],T=void 0;if(w>=1){if(w>1&&!d){var E=_v(l,C[0]);s.attr({x:E[0]+y,y:E[1]+b}),i&&(T=u.getRawValue(C[0]))}else{var E=c.getPointOn(v,x);E&&s.attr({x:E[0]+y,y:E[1]+b});var D=u.getRawValue(C[0]),O=u.getRawValue(C[1]);i&&(T=Gu(n,f,D,O,S.t))}r.lastFrameIndex=C[0]}else{var k=e===1||r.lastFrameIndex>0?C[0]:0,E=_v(l,k);i&&(T=u.getRawValue(k)),s.attr({x:E[0]+y,y:E[1]+b})}if(i){var A=GB(s);typeof A.setLabelText==`function`&&A.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,r,i,a,o){var s=this._polyline,c=this._polygon,l=e.hostModel,u=Xg(this._data,e,this._stackedOnPoints,t,this._coordSys,n,this._valueOrigin,a),d=u.current,f=u.stackedOnCurrent,p=u.next,m=u.stackedOnNext;if(i&&(f=dv(u.stackedOnCurrent,u.current,n,i,o),d=dv(u.current,null,n,i,o),m=dv(u.stackedOnNext,u.next,n,i,o),p=dv(u.next,null,n,i,o)),cv(d,p)>3e3||c&&cv(f,m)>3e3)s.stopAnimation(),s.setShape({points:p}),c&&(c.stopAnimation(),c.setShape({points:p,stackedOnPoints:m}));else{s.shape.__points=u.current,s.shape.points=d;var h={shape:{points:p}};u.current!==d&&(h.shape.__points=u.next),s.stopAnimation(),Sf(s,h,l),c&&(c.setShape({points:d,stackedOnPoints:f}),c.stopAnimation(),Sf(c,{shape:{stackedOnPoints:m}},l),s.shape.points!==c.shape.points&&(c.shape.points=s.shape.points));for(var g=[],_=u.status,v=0;v<_.length;v++)if(_[v].cmd===`=`){var y=e.getItemGraphicEl(_[v].idx1);y&&g.push({el:y,ptIdx:v})}s.animators&&s.animators.length&&s.animators[0].during(function(){c&&c.dirtyShape();for(var e=s.shape.__points,t=0;t<g.length;t++){var n=g[t].el,r=g[t].ptIdx*2;n.x=e[r],n.y=e[r+1],n.markRedraw()}})}},t.prototype.remove=function(e){var t=this.group,n=this._data;this._lineGroup.removeAll(),this._symbolDraw.remove(!0),n&&n.eachItemGraphicEl(function(e,r){e.__temp&&(t.remove(e),n.setItemGraphicEl(r,null))}),this._polyline=this._polygon=this._coordSys=this._points=this._stackedOnPoints=this._endLabel=this._data=null},t.type=`line`,t}(CU),KU={average:function(e){for(var t=0,n=0,r=0;r<e.length;r++)isNaN(e[r])||(t+=e[r],n++);return n===0?NaN:t/n},sum:function(e){for(var t=0,n=0;n<e.length;n++)t+=e[n]||0;return t},max:function(e){for(var t=-1/0,n=0;n<e.length;n++)e[n]>t&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;n<e.length;n++)e[n]<t&&(t=e[n]);return isFinite(t)?t:NaN},nearest:function(e){return e[0]}},qU=function(e){return Math.round(e.length/2)},JU=Iu(),YU=Iu(),XU={estimate:1,determine:2},ZU=Nv(`axisTick`),QU=Nv(`axisLabel`),$U=Iu(),eW=td(),tW=Iu(),nW=Iu(),rW={},iW=W(),aW=.8,oW=[0,1],sW=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]);return e>=n&&e<=r},e.prototype.containData=function(e){return this.scale.contain(this.scale.parse(e))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this.scale;return e=n.normalize(n.parse(e)),Hl(e,oW,uy(this),t)},e.prototype.coordToData=function(e,t){var n=Hl(e,uy(this),oW,t);return this.scale.scale(n)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){e||={};var t=e.tickModel||this.getTickModel(),n=R(Dv(this,t,{breakTicks:e.breakTicks,pruneByBreak:e.pruneByBreak}).ticks,function(e){return{coord:this.dataToCoord(iv(this.scale,e)),tick:e}},this),r=t.get(`alignWithLabel`),i=dy(this,n,r);return R(n,function(e){return{coord:e.coord,tickValue:e.tick.value,onBand:i}})},e.prototype.getMinorTicksCoords=function(){if(w_(this.scale))return[];var e=this.model.getModel(`minorTick`).get(`splitNumber`);return e>0&&e<100||(e=5),R(this.scale.getMinorTicks(e),function(e){return R(e,function(e){return{coord:this.dataToCoord(e),tickValue:e}},this)},this)},e.prototype.getViewLabels=function(e){return e||=Tv(XU.determine),Ev(this,e).labels},e.prototype.getLabelModel=function(){return this.model.getModel(`axisLabel`)},e.prototype.getTickModel=function(){return this.model.getModel(`axisTick`)},e.prototype.getBandWidth=function(){return sy(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(e){return e||=Tv(XU.determine),Lv(this,e)},e}(),cW=function(e){F(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r)||this;return o.index=0,o.type=i||`value`,o.position=a||`bottom`,o}return t.prototype.isHorizontal=function(){var e=this.position;return e===`top`||e===`bottom`},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e[this.dim===`x`?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if(this.type!==`category`)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(sW),lW=[`label`,`labelLine`,`layoutOption`,`priority`,`defaultAttr`,`marginForce`,`minMarginForce`,`marginDefault`,`suggestIgnore`],uW=1,dW=2,fW=uW|dW,pW=[0,0,0,0],mW=null,hW=`expandAxisBreak`,gW=`collapseAxisBreak`,_W=`toggleAxisBreak`,vW=`axisbreakchanged`,yW={type:hW,event:vW,update:`update`,refineEvent:Ey},bW={type:gW,event:vW,update:`update`,refineEvent:Ey},xW={type:_W,event:vW,update:`update`,refineEvent:Ey},SW=Math.PI,CW=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],wW=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],TW=Iu(),EW=Iu(),DW=function(){function e(e){this.recordMap={},this.resolveAxisNameOverlap=e}return e.prototype.ensureRecord=function(e){var t=e.axis.dim,n=e.componentIndex,r=this.recordMap,i=r[t]||(r[t]=[]);return i[n]||(i[n]={ready:{}})},e}(),OW=Lo(),kW=new J(0,0,0,0),AW=function(e,t,n,r,i,a){if($_(e.nameLocation)){var o=a.stOccupiedRect;o&&ky(gy({},o,a.transGroup.transform),r,i)}else Ay(a.labelInfoList,a.dirVec,r,i)},jW=function(){function e(e,t,n,r){this.group=new Lz,this._axisModel=e,this._api=t,this._local={},this._shared=r||new DW(AW),this._resetCfgDetermined(n)}return e.prototype.updateCfg=function(e){var t=this._cfg.raw;t.position=e.position,t.labelOffset=e.labelOffset,this._resetCfgDetermined(t)},e.prototype.__getRawCfg=function(){return this._cfg.raw},e.prototype._resetCfgDetermined=function(e){var t=this._axisModel,n=t.getDefaultOption?t.getDefaultOption():{},r=U(e.axisName,t.get(`name`)),i=t.get(`nameMoveOverlap`);(i==null||i===`auto`)&&(i=U(e.defaultNameMoveOverlap,!0));var a={raw:e,position:e.position,rotation:e.rotation,nameDirection:U(e.nameDirection,1),tickDirection:U(e.tickDirection,1),labelDirection:U(e.labelDirection,1),labelOffset:U(e.labelOffset,0),silent:U(e.silent,!0),axisName:r,nameLocation:so(t.get(`nameLocation`),n.nameLocation,`end`),shouldNameMoveOverlap:Wy(r)&&i,optionHideOverlap:t.get([`axisLabel`,`hideOverlap`]),showMinorTicks:t.get([`minorTick`,`show`])};this._cfg=a;var o=new Lz({x:a.position[0],y:a.position[1],rotation:a.rotation});o.updateTransform(),this._transformGroup=o;var s=this._shared.ensureRecord(t);s.transGroup=this._transformGroup,s.dirVec=new zF(Math.cos(-a.rotation),Math.sin(-a.rotation))},e.prototype.build=function(e,t){var n=this;return e||={axisLine:!0,axisTickLabelEstimate:!1,axisTickLabelDetermine:!0,axisName:!0},L(MW,function(r){e[r]&&NW[r](n._cfg,n._local,n._shared,n._axisModel,n.group,n._transformGroup,n._api,t||{})}),this},e.innerTextLayout=function(e,t,n){var r=eu(t-e),i,a;return tu(r)?(a=n>0?`top`:`bottom`,i=`center`):tu(r-SW)?(a=n>0?`bottom`:`top`,i=`center`):(a=`middle`,i=r>0&&r<SW?n>0?`right`:`left`:n>0?`left`:`right`),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+`Index`]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get(`tooltip`);return e.get(`silent`)||!(e.get(`triggerEvent`)||t&&t.show)},e}(),MW=[`axisLine`,`axisTickLabelEstimate`,`axisTickLabelDetermine`,`axisName`],NW={axisLine:function(e,t,n,r,i,a,o){var s=r.get([`axisLine`,`show`]);if(s===`auto`&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),s){var c=r.axis.getExtent(),l=a.transform,u=[c[0],0],d=[c[1],0],f=u[0]>d[0];l&&(rs(u,u,l),rs(d,d,l));var p=I({lineCap:`round`},r.getModel([`axisLine`,`lineStyle`]).getLineStyle()),m={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:p};if(r.get([`axisLine`,`breakLine`])&&Ym(r.axis.scale))Ty().buildAxisBreakLine(r,i,a,m);else{var h=new lB(I({shape:{x1:u[0],y1:u[1],x2:d[0],y2:d[1]}},m));Lf(h.shape,h.style.lineWidth),h.anid=`line`,i.add(h)}var g=r.get([`axisLine`,`symbol`]);if(g!=null){var _=r.get([`axisLine`,`symbolSize`]);V(g)&&(g=[g,g]),(V(_)||$a(_))&&(_=[_,_]);var v=Fg(r.get([`axisLine`,`symbolOffset`])||0,_),y=_[0],b=_[1];L([{rotate:e.rotation+Math.PI/2,offset:v[0],r:0},{rotate:e.rotation-Math.PI/2,offset:v[1],r:Math.sqrt((u[0]-d[0])*(u[0]-d[0])+(u[1]-d[1])*(u[1]-d[1]))}],function(t,n){if(g[n]!==`none`&&g[n]!=null){var r=Ng(g[n],-y/2,-b/2,y,b,p.stroke,!0),a=t.r+t.offset,o=f?d:u;r.attr({rotation:t.rotate,x:o[0]+a*Math.cos(e.rotation),y:o[1]-a*Math.sin(e.rotation),silent:!0,z2:11}),i.add(r)}})}}},axisTickLabelEstimate:function(e,t,n,r,i,a,o,s){zy(t,i,s)&&jy(e,t,n,r,i,a,o,XU.estimate)},axisTickLabelDetermine:function(e,t,n,r,i,a,o,s){zy(t,i,s)&&jy(e,t,n,r,i,a,o,XU.determine);var c=Ly(e,i,a,r);Py(e,t.labelLayoutList,c),Ry(e,i,a,r,e.tickDirection)},axisName:function(e,t,n,r,i,a,o,s){var c=n.ensureRecord(r);t.nameEl&&=(i.remove(t.nameEl),c.nameLayout=c.nameLocation=null);var l=e.axisName;if(Wy(l)){var u=e.nameLocation,d=e.nameDirection,f=r.getModel(`nameTextStyle`),p=r.get(`nameGap`)||0,m=r.axis.getExtent(),h=r.axis.inverse?-1:1,g=new zF(0,0),_=new zF(0,0);u===`start`?(g.x=m[0]-h*p,_.x=-h):u===`end`?(g.x=m[1]+h*p,_.x=h):(g.x=(m[0]+m[1])/2,g.y=e.labelOffset+d*p,_.y=d);var v=Lo();_.transform(Ho(v,v,e.rotation));var y=r.get(`nameRotate`);y!=null&&(y=y*SW/180);var b,x;$_(u)?b=jW.innerTextLayout(e.rotation,y??e.rotation,d):(b=My(e.rotation,u,y||0,m),x=e.raw.axisNameAvailableWidth,x!=null&&(x=Math.abs(x/Math.sin(b.rotation)),!isFinite(x)&&(x=null)));var S=f.getFont(),C=r.get(`nameTruncate`,!0)||{},w=C.ellipsis,T=oo(e.raw.nameTruncateMaxWidth,C.maxWidth,x),E=s.nameMarginLevel||0,D=new CR({x:g.x,y:g.y,rotation:b.rotation,silent:jW.isLabelSilent(r),style:_p(f,{text:l,font:S,overflow:`truncate`,width:T,ellipsis:w,fill:f.getTextColor()||r.get([`axisLine`,`lineStyle`,`color`]),align:f.get(`align`)||b.textAlign,verticalAlign:f.get(`verticalAlign`)||b.textVerticalAlign}),z2:1});if(ep({el:D,componentModel:r,itemName:l}),D.__fullText=l,D.anid=`name`,r.get(`triggerEvent`)){var O=jW.makeAxisEventDataBase(r);O.targetType=`axisName`,O.name=l,QR(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var k=c.nameLayout=my({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:$_(u)?CW[E]:wW[E]});if(c.nameLocation=u,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&k){var A=n.ensureRecord(r);n.resolveAxisNameOverlap(e,n,r,k,_,A)}}}},PW=new vR,FW=new vR,IW=Iu(),LW=3,RW=function(){function e(e,t,n,r,i){var a=w_(e),o=a?t.getCategories().length:null,s;if(a){var c=t.getCategories(!0);s=c&&!c.length}var l=n.slice();(x_(e)||C_(e)||S_(e))&&(Ju(l,$y(e,t.get(`dataMin`,!0))),Yu(l,$y(e,t.get(`dataMax`,!0)))),$u(l)||(l[0]=l[1]=NaN);var u=[],d=[!1,!1],f=t.get(`min`,!0);f===`dataMin`?(u[0]=l[0],d[0]=!0):(u[0]=$y(e,B(f)?f({min:l[0],max:l[1]}):f),d[0]=u[0]!=null);var p=t.get(`max`,!0);p===`dataMax`?(u[1]=l[1],d[1]=!0):(u[1]=$y(e,B(p)?p({min:l[0],max:l[1]}):p),d[1]=u[1]!=null);var m=eb(e,t),h=a?null:l[1]-l[0]||Math.abs(l[0]);u[0]??=a?s?l[0]:o?0:NaN:l[0]-m[0]*h,u[1]??=a?s?l[1]:o?o-1:NaN:l[1]+m[1]*h,!Zu(u[0])&&(u[0]=NaN),!Zu(u[1])&&(u[1]=NaN);var g=s||ao(u[0])||ao(u[1])||a&&!o,_=x_(e),v=_&&t.needIncludeZero&&t.needIncludeZero();v&&(u[0]>0&&u[1]>0&&!d[0]&&(u[0]=0),u[0]<0&&u[1]<0&&!d[1]&&(u[1]=0));var y=!1;u[0]>u[1]&&(u.reverse(),y=!0);var b=$y(e,t.get(`startValue`,!0)),x=b!=null;!fu(b)&&r&&(b=e.getDefaultStartValue?e.getDefaultStartValue():0),fu(b)&&(x||!_||v)&&(b<u[0]&&!d[0]?(u[0]=b,d[0]=!0):b>u[1]&&!d[1]&&(u[1]=b,d[1]=!0)),Qy(this._i={scale:e,dataMM:l,noZoomEffMM:u,zoomMM:[],fixMM:d,zoomFixMM:[!1,!1],startValue:b,isBlank:g,incl0:v,tggAxInv:y,ctnShp:i},u)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var e=this._i,t=e.zoomMM,n=e.noZoomEffMM,r=e.zoomFixMM,i=e.fixMM,a={fixMM:i,zoomFixMM:r,isBlank:e.isBlank,incl0:e.incl0,tggAxInv:e.tggAxInv,ctnShp:e.ctnShp,effMM:n.slice()},o=a.effMM;return t[0]!=null&&(o[0]=t[0],i[0]=r[0]=!0),t[1]!=null&&(o[1]=t[1],i[1]=r[1]=!0),Qy(e,o),a},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(e,t){this._i.zoomMM[e]=t},e}(),zW=W(),BW=Jg({ctor:mU},50),VW={left:0,right:0,top:0,bottom:0},HW=[`25%`,`25%`],UW=`cartesian2d`,WW=function(e){F(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(t,n){var r=Rh(t.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),r&&t.outerBounds&&Lh(t.outerBounds,r)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&t.outerBounds&&Lh(this.option.outerBounds,t.outerBounds)},t.type=`grid`,t.dependencies=[`xAxis`,`yAxis`],t.layoutMode=`box`,t.defaultOption={show:!1,z:0,left:`15%`,top:65,right:`10%`,bottom:80,containLabel:!1,outerBoundsMode:`auto`,outerBounds:VW,outerBoundsContain:`all`,outerBoundsClampWidth:HW[0],outerBoundsClampHeight:HW[1],backgroundColor:X.color.transparent,borderWidth:1,borderColor:X.color.neutral30},t}(BH),GW=td(),KW=`__ec_stack_`,qW=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){return Tm(null,this,{useEncodeDefaulter:!0})},t.prototype.getMarkerPosition=function(e,t,n){var r=this.coordinateSystem;if(r&&r.clampData){var i=r.clampData(e),a=r.dataToPoint(i);if(n)L(r.getAxes(),function(e,n){if(e.type===`category`&&t!=null){var r=e.getTicksCoords(),o=e.getTickModel().get(`alignWithLabel`),s=i[n],c=t[n]===`x1`||t[n]===`y1`;if(c&&!o&&(s+=1),r.length<2)return;if(r.length===2){a[n]=e.toGlobalCoord(e.getExtent()[+!!c]);return}for(var l=void 0,u=void 0,d=1,f=0;f<r.length;f++){var p=r[f].coord,m=f===r.length-1?r[f-1].tickValue+d:r[f].tickValue;if(m===s){u=p;break}if(m<s)l=p;else if(l!=null&&m>s){u=(p+l)/2;break}f===1&&(d=m-r[0].tickValue)}u??(l?l&&(u=r[r.length-1].coord):u=r[0].coord),a[n]=e.toGlobalCoord(u)}});else{var o=this.getData(),s=o.getLayout(`offset`),c=o.getLayout(`size`),l=+!r.getBaseAxis().isHorizontal();a[l]+=s+c/2}return a}return[NaN,NaN]},t.prototype.__requireStartValue=function(e){return this.getBaseAxis()!==e},t.type=`series.__base_bar__`,t.defaultOption={z:2,coordinateSystem:`cartesian2d`,legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:`mod`,defaultBarGap:`10%`},t}(iU),iU.registerClass(qW),JW=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(){return Tm(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get(`realtimeSort`,!0)||null})},t.prototype.getProgressive=function(){return this.get(`large`)?this.get(`progressive`):!1},t.prototype.__preparePipelineContext=function(e,t){var n=id(this,e,t);return n.progressiveRender&&(n.large=!0),n},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type=`series.bar`,t.dependencies=[`grid`,`polar`],t.defaultOption=jm(qW.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:`rgba(180, 180, 180, 0.2)`,borderColor:null,borderWidth:0,borderType:`solid`,borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:X.color.primary,borderWidth:2}},realtimeSort:!1}),t}(qW),YW=`\0__throttleOriginMethod`,XW=`\0__throttleRate`,ZW=`\0__throttleType`,QW=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),$W=function(e){F(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`sausage`,n}return t.prototype.getDefaultShape=function(){return new QW},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.max(t.r0||0,0),a=Math.max(t.r,0),o=(a-i)*.5,s=i+o,c=t.startAngle,l=t.endAngle,u=t.clockwise,d=Math.PI*2,f=u?l-c<d:c-l<d;f||(c=l-(u?d:-d));var p=Math.cos(c),m=Math.sin(c),h=Math.cos(l),g=Math.sin(l);f?(e.moveTo(p*i+n,m*i+r),e.arc(p*s+n,m*s+r,o,-Math.PI+c,c,!u)):e.moveTo(p*a+n,m*a+r),e.arc(n,r,a,c,l,!u),e.arc(h*s+n,g*s+r,o,l-Math.PI*2,l-Math.PI,!u),i!==0&&e.arc(n,r,i,l,c,u)},t}(lR),eG=Math.max,tG=Math.min,nG=function(e){F(t,e);function t(){var t=e.call(this)||this;return t.type=`bar`,t._isFirstFrame=!0,t}return t.prototype.render=function(e,t,n,r){this._model=e,this._removeOnRenderedListener(n),this._updateDrawMode(e);var i=e.get(`coordinateSystem`);(i===`cartesian2d`||i===`polar`)&&(this._progressiveEls=null,this._isLargeDraw?this._renderLarge(e,t,n):this._renderNormal(e,t,n,r))},t.prototype.incrementalPrepareRender=function(e){this._clear(),this._updateDrawMode(e),this._updateLargeClip(e)},t.prototype.incrementalRender=function(e,t){this._progressiveEls=[],this._incrementalRenderLarge(e,t)},t.prototype.eachRendered=function(e){np(this._progressiveEls||this.group,e)},t.prototype._updateDrawMode=function(e){var t=e.pipelineContext.large;(this._isLargeDraw==null||t!==this._isLargeDraw)&&(this._isLargeDraw=t,this._clear())},t.prototype._renderNormal=function(e,t,n,r){var i=this.group,a=e.getData(),o=this._data,s=e.coordinateSystem,c=s.getBaseAxis(),l;s.type===`cartesian2d`?l=c.isHorizontal():s.type===`polar`&&(l=c.dim===`angle`);var u=e.isAnimationEnabled()?e:null,d=Ib(e,s);d&&this._enableRealtimeSort(d,a,n);var f=e.get(`clip`,!0)||d,p=s.getArea();i.removeClipPath();var m=e.get(`roundCap`,!0),h=e.get(`showBackground`,!0),g=e.getModel(`backgroundStyle`),_=g.get(`borderRadius`)||0,v=[],y=this._backgroundEls,b=r&&r.isInitSort,x=r&&r.type===`changeAxisOrder`;function S(e){var t=cG[s.type](a,e);if(!t)return null;var n=Kb(s,l,t);return n.useStyle(g.getItemStyle()),s.type===`cartesian2d`?n.setShape(`r`,_):n.setShape(`cornerRadius`,_),v[e]=n,n}a.diff(o).add(function(t){var n=a.getItemModel(t),r=cG[s.type](a,t,n);if(r&&(h&&S(t),a.hasValue(t)&&sG[s.type](r))){var o=!1;f&&(o=rG[s.type](p,r));var g=iG[s.type](e,a,t,r,l,u,c.model,!1,m);d&&(g.forceLabelAnimation=!0),Vb(g,a,t,n,r,e,l,s.type===`polar`),b?g.attr({shape:r}):d?Lb(d,u,g,r,t,l,!1,!1):Cf(g,{shape:r},e,t),a.setItemGraphicEl(t,g),i.add(g),g.ignore=o}}).update(function(t,n){var r=a.getItemModel(t),C=cG[s.type](a,t,r);if(C){if(h){var w=void 0;y.length===0?w=S(n):(w=y[n],w.useStyle(g.getItemStyle()),s.type===`cartesian2d`?w.setShape(`r`,_):w.setShape(`cornerRadius`,_),v[t]=w);var T=cG[s.type](a,t),E=Gb(l,T,s);Sf(w,{shape:E},u,t)}var D=o.getItemGraphicEl(n);if(!a.hasValue(t)||!sG[s.type](C))i.remove(D);else{var O=!1;if(f&&(O=rG[s.type](p,C),O&&i.remove(D)),D&&(D.type===`sector`&&m||D.type===`sausage`&&!m)&&(D&&Df(D,e,n),D=null),D?Of(D):D=iG[s.type](e,a,t,C,l,u,c.model,!0,m),d&&(D.forceLabelAnimation=!0),x){var k=D.getTextContent();if(k){var A=GB(k);A.prevValue!=null&&(A.prevValue=A.value)}}else Vb(D,a,t,r,C,e,l,s.type===`polar`);b?D.attr({shape:C}):d?Lb(d,u,D,C,t,l,!0,x):Sf(D,{shape:C},e,t,null),a.setItemGraphicEl(t,D),D.ignore=O,i.add(D)}}}).remove(function(t){var n=o.getItemGraphicEl(t);n&&Df(n,e,t)}).execute();var C=this._backgroundGroup||=new Lz;C.removeAll();for(var w=0;w<v.length;++w)C.add(v[w]);i.add(C),this._backgroundEls=v,this._data=a},t.prototype._renderLarge=function(e,t,n){this._clear(),Ub(e,this.group),this._updateLargeClip(e)},t.prototype._incrementalRenderLarge=function(e,t){this._removeBackground(),Ub(t,this.group,this._progressiveEls,!0)},t.prototype._updateLargeClip=function(e){var t=e.get(`clip`,!0)&&a_(e.coordinateSystem,!1,e),n=this.group;t?n.setClipPath(t):n.removeClipPath()},t.prototype._enableRealtimeSort=function(e,t,n){var r=this;if(t.count()){var i=e.baseAxis;if(this._isFirstFrame)this._dispatchInitSort(t,e,n),this._isFirstFrame=!1;else{var a=function(e){var n=t.getItemGraphicEl(e),r=n&&n.shape;return r&&Math.abs(i.isHorizontal()?r.height:r.width)||0};this._onRendered=function(){r._updateSortWithinSameData(t,a,i,n)},n.getZr().on(`rendered`,this._onRendered)}}},t.prototype._dataSort=function(e,t,n){var r=[];return e.each(e.mapDimension(t.dim),function(e,t){var i=n(t);i??=NaN,r.push({dataIndex:t,mappedValue:i,ordinalNumber:e})}),r.sort(function(e,t){return t.mappedValue-e.mappedValue}),{ordinalNumbers:R(r,function(e){return e.ordinalNumber})}},t.prototype._isOrderChangedWithinSameData=function(e,t,n){for(var r=n.scale,i=e.mapDimension(n.dim),a=Number.MAX_VALUE,o=0,s=r.getOrdinalMeta().categories.length;o<s;++o){var c=e.rawIndexOf(i,r.getRawOrdinalNumber(o)),l=c<0?Number.MIN_VALUE:t(e.indexOfRawIndex(c));if(l>a)return!0;a=l}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,r=n.getExtent(),i=Math.max(0,r[0]),a=Math.min(r[1],n.getOrdinalMeta().categories.length-1);i<=a;++i)if(e.ordinalNumbers[i]!==n.getRawOrdinalNumber(i))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,r){if(this._isOrderChangedWithinSameData(e,t,n)){var i=this._dataSort(e,n,t);this._isOrderDifferentInView(i,n)&&(this._removeOnRenderedListener(r),r.dispatchAction({type:`changeAxisOrder`,componentType:n.dim+`Axis`,axisId:n.index,sortInfo:i}))}},t.prototype._dispatchInitSort=function(e,t,n){var r=t.baseAxis,i=this._dataSort(e,r,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:`changeAxisOrder`,componentType:r.dim+`Axis`,isInitSort:!0,axisId:r.index,sortInfo:i})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&=(e.getZr().off(`rendered`,this._onRendered),null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){Df(t,e,QR(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=`bar`,t}(CU),rG={cartesian2d:function(e,t){var n=t.width<0?-1:1,r=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=eG(t.x,e.x),s=tG(t.x+t.width,i),c=eG(t.y,e.y),l=tG(t.y+t.height,a),u=s<o,d=l<c;return t.x=u&&o>i?s:o,t.y=d&&c>a?l:c,t.width=u?0:s-o,t.height=d?0:l-c,n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height),u||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}var i=tG(t.r,e.r),a=eG(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}return o}},iG={cartesian2d:function(e,t,n,r,i,a,o,s,c){var l=new vR({shape:I({},r),z2:1});if(l.__dataIndex=n,l.name=`item`,a){var u=l.shape,d=i?`height`:`width`;u[d]=0}return l},polar:function(e,t,n,r,i,a,o,s,c){var l=!i&&c?$W:eB,u=new l({shape:r,z2:1});if(u.name=`item`,u.calculateTextPosition=jb(Bb(i),{isRoundCap:l===$W}),a){var d=u.shape,f=i?`r`:`endAngle`,p={};d[f]=i?r.r0:r.startAngle,p[f]=r[f],(s?Sf:Cf)(u,{shape:p},a)}return u}},aG=[`x`,`y`,`width`,`height`],oG=[`cx`,`cy`,`r`,`startAngle`,`endAngle`],sG={cartesian2d:function(e){return!Rb(e,aG)},polar:function(e){return!Rb(e,oG)}},cG={cartesian2d:function(e,t,n){var r=e.getItemLayout(t);if(!r)return null;var i=n?Hb(n,r):0,a=r.width>0?1:-1,o=r.height>0?1:-1;return{x:r.x+a*i/2,y:r.y+o*i/2,width:r.width-a*i,height:r.height-o*i}},polar:function(e,t,n){var r=e.getItemLayout(t);return{cx:r.cx,cy:r.cy,r0:r.r0,r:r.r,startAngle:r.startAngle,endAngle:r.endAngle,clockwise:r.clockwise}}},lG=function(){function e(){}return e}(),uG=function(e){F(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`largeBar`,n}return t.prototype.getDefaultShape=function(){return new lG},t.prototype.buildPath=function(e,t){for(var n=t.points,r=this.baseDimIdx,i=1-this.baseDimIdx,a=[],o=[],s=this.barWidth,c=0;c<n.length;c+=3)o[r]=s,o[i]=n[c+2],a[r]=n[c+r],a[i]=n[c+i],e.rect(a[0],a[1],o[0],o[1])},t}(lR),dG=Ob(function(e){var t=this,n=Wb(t,e.offsetX,e.offsetY);QR(t).dataIndex=n>=0?n:null},30,!1),fG=function(){function e(e,t){this._getDataWithEncodedVisual=e,this._getRawData=t}return e.prototype.getAllNames=function(){var e=this._getRawData();return e.mapArray(e.getName)},e.prototype.containName=function(e){return this._getRawData().indexOfName(e)>=0},e.prototype.indexOfName=function(e){return this._getDataWithEncodedVisual().indexOfName(e)},e.prototype.getItemVisual=function(e,t){return this._getDataWithEncodedVisual().getItemVisual(e,t)},e}(),pG=Iu(),mG=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new fG(q(this.getData,this),q(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return ex(this,{coordDimensions:[`value`],encodeDefaulter:Za(kp,this)})},t.prototype.getDataParams=function(t){var n=this.getData(),r=pG(n),i=r.seats;if(!i){var a=[];n.each(n.mapDimension(`value`),function(e){a.push(e)}),i=r.seats=Ql(a,n.hostModel.get(`percentPrecision`))}var o=e.prototype.getDataParams.call(this,t);return o.percent=i[t]||0,o.$vars.push(`percent`),o},t.prototype._defaultLabelLine=function(e){vu(e,`labelLine`,[`show`]);var t=e.labelLine,n=e.emphasis.labelLine;t.show=t.show&&e.label.show,n.show=n.show&&e.emphasis.label.show},t.type=`series.pie`,t.defaultOption={z:2,legendHoverLink:!0,colorBy:`data`,center:[`50%`,`50%`],radius:[0,`50%`],clockwise:!0,startAngle:90,endAngle:`auto`,padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,coordinateSystemUsage:`box`,left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:`truncate`,position:`outer`,alignTo:`none`,edgeDistance:`25%`,distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:30,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:`solid`}},itemStyle:{borderWidth:1,borderJoin:`round`},showEmptyCircle:!0,emptyCircleStyle:{color:`lightgray`,opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:`expansion`,animationDuration:1e3,animationTypeUpdate:`transition`,animationEasingUpdate:`cubicInOut`,animationDurationUpdate:500,animationEasing:`cubicInOut`},t}(iU),pm({fullType:mG.type,getCoord2:function(e){return e.getShallow(`center`)}}),hG=Math.PI*2,gG=QL.CMD,_G=[`top`,`right`,`bottom`,`left`],vG=[],yG=new zF,bG=new zF,xG=new zF,SG=new zF,CG=new zF,wG=[],TG=new zF,EG=Math.PI/180,DG={minMarginForce:[null,0,null,0],marginDefault:[1,0,1,0]},OG={},kG=Math.PI*2,AG=Math.PI/180,jG=ad(`pie`,bx),MG=Iu(),NG=function(e){F(t,e);function t(t,n,r){var i=e.call(this)||this;i.z2=2;var a=new CR;return i.setTextContent(a),i.updateData(t,n,r,!0),i}return t.prototype.updateData=function(e,t,n,r){var i=this,a=e.hostModel,o=e.getItemModel(t),s=o.getModel(`emphasis`),c=e.getItemLayout(t),l=I(Fb(o.getModel(`itemStyle`),c,!0),c);if(isNaN(l.startAngle))i.setShape(l);else{if(r){i.setShape(l);var u=a.getShallow(`animationType`);a.ecModel.ssr?(Cf(i,{scaleX:0,scaleY:0},a,{dataIndex:t,isFrom:!0}),i.originX=l.cx,i.originY=l.cy):u===`scale`?(i.shape.r=c.r0,Cf(i,{shape:{r:c.r}},a,t)):n==null?(i.shape.endAngle=c.startAngle,Sf(i,{shape:{endAngle:c.endAngle}},a,t)):(i.setShape({startAngle:n,endAngle:n}),Cf(i,{shape:{startAngle:c.startAngle,endAngle:c.endAngle}},a,t))}else Of(i),Sf(i,{shape:l},a,t);i.useStyle(e.getItemVisual(t,`style`)),Jd(i,o);var d=(c.startAngle+c.endAngle)/2,f=a.get(`selectedOffset`),p=Math.cos(d)*f,m=Math.sin(d)*f,h=o.getShallow(`cursor`);h&&i.attr(`cursor`,h),this._updateLabel(a,e,t),i.ensureState(`emphasis`).shape=I({r:c.r+(s.get(`scale`)&&s.get(`scaleSize`)||0)},Fb(s.getModel(`itemStyle`),c)),I(i.ensureState(`select`),{x:p,y:m,shape:Fb(o.getModel([`select`,`itemStyle`]),c)}),I(i.ensureState(`blur`),{shape:Fb(o.getModel([`blur`,`itemStyle`]),c)});var g=i.getTextGuideLine(),_=i.getTextContent();g&&I(g.ensureState(`select`),{x:p,y:m}),I(_.ensureState(`select`),{x:p,y:m}),Kd(this,s.get(`focus`),s.get(`blurScope`),s.get(`disabled`))}},t.prototype._updateLabel=function(e,t,n){var r=this,i=t.getItemModel(n),a=i.getModel(`labelLine`),o=t.getItemVisual(n,`style`),s=o&&o.fill,c=o&&o.opacity;hp(r,gp(i),{labelFetcher:t.hostModel,labelDataIndex:n,inheritColor:s,defaultOpacity:c,defaultText:e.getFormattedLabel(n,`normal`)||t.getName(n)});var l=r.getTextContent();r.setTextConfig({position:null,rotation:null}),l.attr({z2:10});var u=i.get([`label`,`position`]);if(u!==`outside`&&u!==`outer`)r.removeTextGuideLine();else{var d=this.getTextGuideLine();d||(d=new oB,this.setTextGuideLine(d)),fx(this,px(i),{stroke:s,opacity:so(a.get([`lineStyle`,`opacity`]),c,1)})}},t}(eB),PG=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`pie`,t.ignoreLabelLineUpdate=!0,t}return t.prototype.render=function(e,t,n,r){var i=e.getData(),a=this._data,o=this.group,s;if(!a&&i.count()>0){for(var c=i.getItemLayout(0),l=1;isNaN(c&&c.startAngle)&&l<i.count();++l)c=i.getItemLayout(l);c&&(s=c.startAngle)}if(this._emptyCircleSector&&o.remove(this._emptyCircleSector),i.count()===0&&e.get(`showEmptyCircle`)){var u=new eB({shape:Ra(MG(e))});u.useStyle(e.getModel(`emptyCircleStyle`).getItemStyle()),this._emptyCircleSector=u,o.add(u)}i.diff(a).add(function(e){var t=new NG(i,e,s);i.setItemGraphicEl(e,t),o.add(t)}).update(function(e,t){var n=a.getItemGraphicEl(t);n.updateData(i,e,s),n.off(`click`),o.add(n),i.setItemGraphicEl(e,n)}).remove(function(t){Df(a.getItemGraphicEl(t),e,t)}).execute(),yx(e),e.get(`animationTypeUpdate`)!==`expansion`&&(this._data=i)},t.prototype.dispose=function(){},t.prototype.containPoint=function(e,t){var n=t.getData().getItemLayout(0);if(n){var r=e[0]-n.cx,i=e[1]-n.cy,a=Math.sqrt(r*r+i*i);return a<=n.r&&a>=n.r0}},t.type=`pie`,t}(CU),FG=function(){function e(e,t){this.target=e,this.topTarget=t&&t.topTarget}return e}(),IG=function(){function e(e){this.handler=e,e.on(`mousedown`,this._dragStart,this),e.on(`mousemove`,this._drag,this),e.on(`mouseup`,this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new FG(t,e),`dragstart`,e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,r=e.offsetY,i=n-this._x,a=r-this._y;this._x=n,this._y=r,t.drift(i,a,e),this.handler.dispatchToElement(new FG(t,e),`drag`,e.event);var o=this.handler.findHover(n,r,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new FG(s,e),`dragleave`,e.event),o&&o!==s&&this.handler.dispatchToElement(new FG(o,e),`dragenter`,e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new FG(t,e),`dragend`,e.event),this._dropTarget&&this.handler.dispatchToElement(new FG(this._dropTarget,e),`drop`,e.event),this._draggingTarget=null,this._dropTarget=null},e}(),LG=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,RG=[],zG=EF.browser.firefox&&+EF.browser.version.split(`.`)[0]<39,BG=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0},VG=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a<o;a++){var s=r[a],c=Cx(n,s,{});i.points.push([c.zrX,c.zrY]),i.touches.push(s)}this._track.push(i)}},e.prototype._recognize=function(e){for(var t in HG)if(HG.hasOwnProperty(t)){var n=HG[t](this._track,e);if(n)return n}},e}(),HG={pinch:function(e,t){var n=e.length;if(n){var r=(e[n-1]||{}).points,i=(e[n-2]||{}).points||r;if(i&&i.length>1&&r&&r.length>1){var a=Mx(r)/Mx(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=Nx(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},UG=`silent`,WG=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.handler=null,t}return t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(iL),GG=function(){function e(e,t){this.x=e,this.y=t}return e}(),KG=[`click`,`dblclick`,`mousewheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],qG=new J(0,0,0,0),JG=function(e){F(t,e);function t(t,n,r,i,a){var o=e.call(this)||this;return o._hovered=new GG(0,0),o.storage=t,o.painter=n,o.painterRoot=i,o._pointerSize=a,r||=new WG,o.proxy=null,o.setHandlerProxy(r),o._draggingMgr=new IG(o),o}return t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(L(KG,function(t){e.on&&e.on(t,this[t],this)},this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,r=Rx(this,t,n),i=this._hovered,a=i.target;a&&!a.__zr&&(i=this.findHover(i.x,i.y),a=i.target);var o=this._hovered=r?new GG(t,n):this.findHover(t,n),s=o.target,c=this.proxy;c.setCursor&&c.setCursor(s?s.cursor:`default`),a&&s!==a&&this.dispatchToElement(i,`mouseout`,e),this.dispatchToElement(o,`mousemove`,e),s&&s!==a&&this.dispatchToElement(o,`mouseover`,e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;t!==`only_globalout`&&this.dispatchToElement(this._hovered,`mouseout`,e),t!==`no_globalout`&&this.trigger(`globalout`,{type:`globalout`,event:e})},t.prototype.resize=function(){this._hovered=new GG(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){e||={};var r=e.target;if(!(r&&r.silent)){for(var i=`on`+t,a=Px(t,e,n);r&&(r[i]&&(a.cancelBubble=!!r[i].call(r,a)),r.trigger(t,a),r=r.__hostTarget?r.__hostTarget:r.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(t,a),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(e){typeof e[i]==`function`&&e[i].call(e,a),e.trigger&&e.trigger(t,a)}))}},t.prototype.findHover=function(e,t,n){var r=this.storage.getDisplayList(),i=new GG(e,t);if(Lx(r,i,e,t,n),this._pointerSize&&!i.target){for(var a=[],o=this._pointerSize,s=o/2,c=new J(e-s,t-s,o,o),l=r.length-1;l>=0;l--){var u=r[l];u===n||u.ignore||u.ignoreCoarsePointer||u.parent&&u.parent.ignoreCoarsePointer||(qG.copy(u.getBoundingRect()),u.transform&&qG.applyTransform(u.transform),qG.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m<s;m+=d)for(var h=0;h<p;h+=f)if(Lx(a,i,e+m*Math.cos(h),t+m*Math.sin(h),n),i.target)return i}}return i},t.prototype.processGesture=function(e,t){this._gestureMgr||=new VG;var n=this._gestureMgr;t===`start`&&n.clear();var r=n.recognize(e,this.findHover(e.zrX,e.zrY,null).target,this.proxy.dom);if(t===`end`&&n.clear(),r){var i=r.type;e.gestureEvent=i;var a=new GG;a.target=r.target,this.dispatchToElement(a,i,r.event)}},t}(iL),L([`click`,`mousedown`,`mouseup`,`mousewheel`,`dblclick`,`contextmenu`],function(e){JG.prototype[e]=function(t){var n=t.zrX,r=t.zrY,i=Rx(this,n,r),a,o;if(e===`mouseup`&&i||(a=this.findHover(n,r),o=a.target),e===`mousedown`)this._downEl=o,this._downPoint=[t.zrX,t.zrY],this._upEl=o;else if(e===`mouseup`)this._upEl=o;else if(e===`click`){if(this._downEl!==this._upEl||!this._downPoint||LF(this._downPoint,[t.zrX,t.zrY])>4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}}),YG=32,XG=7,ZG=!1,QG=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=Jx}return e.prototype.traverse=function(e,t){for(var n=0;n<this._roots.length;n++)this._roots[n].traverse(e,t)},e.prototype.getDisplayList=function(e,t){t||=!1;var n=this._displayList;return(e||!n.length)&&this.updateDisplayList(t),n},e.prototype.updateDisplayList=function(e){this._displayListLen=0;for(var t=this._roots,n=this._displayList,r=0,i=t.length;r<i;r++)this._updateAndAddDisplayable(t[r],null,e);n.length=this._displayListLen,Kx(n,Jx)},e.prototype._updateAndAddDisplayable=function(e,t,n){if(!e.ignore||n){e.beforeUpdate(),e.update(),e.afterUpdate();var r=e.getClipPath(),i=t&&t.length,a=0,o=e.__clipPaths;if(!e.ignoreClip&&(i||r)){if(o||=e.__clipPaths=[],i)for(var s=0;s<t.length;s++)o[a++]=t[s];for(var c=r,l=e;c;)c.parent=l,c.updateTransform(),o[a++]=c,l=c,c=c.getClipPath()}if(o&&(o.length=a),e.childrenRef){for(var u=e.childrenRef(),d=0;d<u.length;d++){var f=u[d];e.__dirty&&(f.__dirty|=1),this._updateAndAddDisplayable(f,o,n)}e.__dirty=0}else{var p=e;isNaN(p.z)&&(qx(),p.z=0),isNaN(p.z2)&&(qx(),p.z2=0),isNaN(p.zlevel)&&(qx(),p.zlevel=0),this._displayList[this._displayListLen++]=p}var m=e.getDecalElement&&e.getDecalElement();m&&this._updateAndAddDisplayable(m,o,n);var h=e.getTextGuideLine();h&&this._updateAndAddDisplayable(h,o,n);var g=e.getTextContent();g&&this._updateAndAddDisplayable(g,o,n)}},e.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},e.prototype.delRoot=function(e){if(e instanceof Array)for(var t=0,n=e.length;t<n;t++)this.delRoot(e[t]);else{var r=Ha(this._roots,e);r>=0&&this._roots.splice(r,1)}},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),$G=EF.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)},eK=function(e){F(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=Yx()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)&&(r.ondestroy(),this.removeClip(r)),r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&($G(t),!e._paused&&e.update())}$G(t)},t.prototype.start=function(){this._running||(this._time=Yx(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=Yx(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=Yx()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new rL(e,t.loop);return this.addAnimator(n),n},t}(iL),tK=300,nK=EF.domSupported,rK=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:R(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),iK={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},aK=!1,oK=function(){function e(e,t){this.stopPropagation=bo,this.stopImmediatePropagation=bo,this.preventDefault=bo,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),sK={mousedown:function(e){e=Dx(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=Dx(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=Dx(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=Dx(this.dom,e);var t=e.toElement||e.relatedTarget;eS(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){aK=!0,e=Dx(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){aK||(e=Dx(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=Dx(this.dom,e),Qx(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),sK.mousemove.call(this,e),sK.mousedown.call(this,e)},touchmove:function(e){e=Dx(this.dom,e),Qx(e),this.handler.processGesture(e,`change`),sK.mousemove.call(this,e)},touchend:function(e){e=Dx(this.dom,e),Qx(e),this.handler.processGesture(e,`end`),sK.mouseup.call(this,e),+new Date-this.__lastTouchMoment<tK&&sK.click.call(this,e)},pointerdown:function(e){sK.mousedown.call(this,e)},pointermove:function(e){Xx(e)||sK.mousemove.call(this,e)},pointerup:function(e){sK.mouseup.call(this,e)},pointerout:function(e){Xx(e)||sK.mouseout.call(this,e)}},L([`click`,`dblclick`,`contextmenu`],function(e){sK[e]=function(t){t=Dx(this.dom,t),this.trigger(e,t)}}),cK={pointermove:function(e){Xx(e)||cK.mousemove.call(this,e)},pointerup:function(e){cK.mouseup.call(this,e)},mousemove:function(e){this.trigger(`mousemove`,e)},mouseup:function(e){var t=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger(`mouseup`,e),t&&(e.zrEventControl=`only_globalout`,this.trigger(`mouseout`,e))}},lK=function(){function e(e,t){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=t}return e}(),uK=function(e){F(t,e);function t(t,n){var r=e.call(this)||this;return r.__pointerCapturing=!1,r.dom=t,r.painterRoot=n,r._localHandlerScope=new lK(t,sK),nK&&(r._globalHandlerScope=new lK(document,cK)),tS(r,r._localHandlerScope),r}return t.prototype.dispose=function(){iS(this._localHandlerScope),nK&&iS(this._globalHandlerScope)},t.prototype.setCursor=function(e){this.dom.style&&(this.dom.style.cursor=e||`default`)},t.prototype.__togglePointerCapture=function(e){if(this.__mayPointerCapture=null,nK&&+this.__pointerCapturing^e){this.__pointerCapturing=e;var t=this._globalHandlerScope;e?nS(this,t):iS(t)}},t}(iL),dK={},fK={},pK=function(){function e(e,t,n){var r=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!1,this._darkMode=!1,n||={},this.dom=t,this.id=e;var i=new QG,a=n.renderer||`canvas`;dK[a]||(a=Ya(dK)[0]),n.useDirtyRect=n.useDirtyRect!=null&&n.useDirtyRect;var o=new dK[a](t,i,n,e),s=n.ssr||o.ssrOnly;this.storage=i,this.painter=o;var c=!EF.node&&!EF.worker&&!s?new uK(o.getViewportRoot(),o.root):null,l=n.useCoarsePointer,u=l==null||l===`auto`?EF.touchEventsSupported:!!l,d=44,f;u&&(f=U(n.pointerSize,d)),this.handler=new JG(i,o,c,o.root,f),this.animation=new eK({stage:{update:s?null:function(){return r._flush(!1)}}}),s||this.animation.start()}return e.prototype.add=function(e){!this._disposed&&e&&(this.storage.addRoot(e),e.addSelfToZr(this),this.refresh())},e.prototype.remove=function(e){!this._disposed&&e&&(this.storage.delRoot(e),e.removeSelfFromZr(this),this.refresh())},e.prototype.configLayer=function(e,t){this._disposed||(this.painter.configLayer&&this.painter.configLayer(e,t),this.refresh())},e.prototype.setBackgroundColor=function(e){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(e),this.refresh(),this._backgroundColor=e,this._darkMode=oS(e))},e.prototype.getBackgroundColor=function(){return this._backgroundColor},e.prototype.setDarkMode=function(e){this._darkMode=e},e.prototype.isDarkMode=function(){return this._darkMode},e.prototype.refreshImmediately=function(e){this._disposed||this._refresh({animUpdate:!e,refresh:!0,refreshHover:!1})},e.prototype._refresh=function(e){e.animUpdate&&this.animation.update(!0),this._needsRefresh=this._needsRefreshHover=!1,this.painter.refresh({refresh:e.refresh,refreshHover:e.refreshHover}),this._needsRefresh=this._needsRefreshHover=!1},e.prototype.refresh=function(){this._disposed||(this._needsRefresh=!0,this.animation.start())},e.prototype.flush=function(){this._disposed||this._flush(!0)},e.prototype._flush=function(e){var t,n=Yx(),r=this._needsRefresh,i=this._needsRefreshHover;(r||i)&&(t=!0,this._refresh({animUpdate:e,refresh:r,refreshHover:i}));var a=Yx();t?(this._stillFrameAccum=0,this.trigger(`rendered`,{elapsedTime:a-n})):this._sleepAfterStill>0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(e){this._disposed||(e||={},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t<e.length;t++)e[t]instanceof Lz&&e[t].removeSelfFromZr(this);this.storage.delAllRoots(),this.painter.clear()}},e.prototype.dispose=function(){this._disposed||(this.animation.stop(),this.clear(),this.storage.dispose(),this.painter.dispose(),this.handler.dispose(),this.animation=this.storage=this.painter=this.handler=null,this._disposed=!0,aS(this.id))},e}(),hK=``,typeof navigator<`u`&&(hK=navigator.platform||``),gK=`rgba(0, 0, 0, 0.2)`,_K=X.color.theme[0],vK=hc(_K,null,null,.9),yK={darkMode:`auto`,colorBy:`series`,color:X.color.theme,gradientColor:[vK,_K],aria:{decal:{decals:[{color:gK,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:gK,symbol:`circle`,dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:gK,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:gK,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:gK,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:gK,symbol:`triangle`,dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:hK.match(/^Win/)?`Microsoft YaHei`:`sans-serif`,fontSize:12,fontStyle:`normal`,fontWeight:`normal`},blendMode:null,stateAnimation:{duration:300,easing:`cubicOut`},animation:`auto`,animationDuration:1e3,animationDurationUpdate:500,animationEasing:`cubicInOut`,animationEasingUpdate:`cubicInOut`,animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1},bK=W(),wK=`\0_ec_inner`,TK=1,EK=function(e){F(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(e,t,n,r,i,a){r||={},this.option=null,this._theme=new rV(r),this._locale=new rV(i),this._optionManager=a},t.prototype.setOption=function(e,t,n){var r=gS(t);this._optionManager.setOption(e,n,r),this._resetOption(null,r)},t.prototype.resetOption=function(e,t){return this._resetOption(e,gS(t))},t.prototype._resetOption=function(e,t){var n=!1,r=this._optionManager;if(!e||e===`recreate`){var i=r.mountOption(e===`recreate`);!this.option||e===`recreate`?CK(this,i):(this.restoreData(),this._mergeOption(i,t)),n=!0}if((e===`timeline`||e===`media`)&&this.restoreData(),!e||e===`recreate`||e===`timeline`){var a=r.getTimelineOption(this);a&&(n=!0,this._mergeOption(a,t))}if(!e||e===`recreate`||e===`media`){var o=r.getMediaOption(this);o.length&&L(o,function(e){n=!0,this._mergeOption(e,t)},this)}return n},t.prototype.mergeOption=function(e){this._mergeOption(e,null)},t.prototype._mergeOption=function(e,t){var n=this.option,r=this._componentsMap,i=this._componentsCount,a=[],o=W(),s=t&&t.replaceMergeMainTypeMap;Dp(this),L(e,function(e,t){e!=null&&(BH.hasClass(t)?t&&(a.push(t),o.set(t,!0)):n[t]=n[t]==null?Ra(e):za(n[t],e,!0))}),s&&s.each(function(e,t){BH.hasClass(t)&&!o.get(t)&&(a.push(t),o.set(t,!0))}),BH.topologicalTravel(a,BH.getAllClassMainTypes(),c,this);function c(t){var a=dS(this,t,_u(e[t])),o=r.get(t),c=xu(o,a,o?s&&s.get(t)?`replaceMerge`:`normalMerge`:`replaceAll`);Nu(c,t,BH),n[t]=null,r.set(t,null),i.set(t,0);var l=[],u=[],d=0,f;L(c,function(e,n){var r=e.existing,i=e.newOption;if(!i)r&&(r.mergeOption({},this),r.optionUpdated({},!1));else{var a=t===`series`,o=BH.getClass(t,e.keyInfo.subType,!a);if(!o)return;if(t===`tooltip`){if(f)return;f=!0}if(r&&r.constructor===o)r.name=e.keyInfo.name,r.mergeOption(i,this),r.optionUpdated(i,!1);else{var s=I({componentIndex:n},e.keyInfo);r=new o(i,this,this,s),I(r,s),e.brandNew&&(r.__requireNewView=!0),r.init(i,this,this),r.optionUpdated(null,!0)}}r?(l.push(r.option),u.push(r),d++):(l.push(void 0),u.push(void 0))},this),n[t]=l,r.set(t,u),i.set(t,d),t===`series`&&xK(this)}this._seriesIndices||xK(this)},t.prototype.getOption=function(){var e=Ra(this.option);return L(e,function(t,n){if(BH.hasClass(n)){for(var r=_u(t),i=r.length,a=!1,o=i-1;o>=0;o--)r[o]&&!Mu(r[o])?a=!0:(r[o]=null,!a&&i--);r.length=i,e[n]=r}}),delete e[wK],e},t.prototype.setTheme=function(e){this._theme=new rV(e),this._resetOption(`recreate`,null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var r=n[t||0];if(r)return r;if(t==null){for(var i=0;i<n.length;i++)if(n[i])return n[i]}}},t.prototype.queryComponents=function(e){var t=e.mainType;if(!t)return[];var n=e.index,r=e.id,i=e.name,a=this._componentsMap.get(t);if(!a||!a.length)return[];var o;return n==null?o=r==null?i==null?qa(a,function(e){return!!e}):mS(`name`,i,a):mS(`id`,r,a):(o=[],L(_u(n),function(e){a[e]&&o.push(a[e])})),hS(o,e)},t.prototype.findComponents=function(e){var t=e.query,n=e.mainType,r=i(t);return a(hS(r?this.queryComponents(r):qa(this._componentsMap.get(n),function(e){return!!e}),e));function i(e){var t=n+`Index`,r=n+`Id`,i=n+`Name`;return e&&(e[t]!=null||e[r]!=null||e[i]!=null)?{mainType:n,index:e[t],id:e[r],name:e[i]}:null}function a(t){return e.filter?qa(t,e.filter):t}},t.prototype.eachComponent=function(e,t,n){var r=this._componentsMap;if(B(e)){var i=t,a=e;r.each(function(e,t){for(var n=0;e&&n<e.length;n++){var r=e[n];r&&a.call(i,t,r,r.componentIndex)}})}else for(var o=V(e)?r.get(e):H(e)?this.findComponents(e):null,s=0;o&&s<o.length;s++){var c=o[s];c&&t.call(n,c,c.componentIndex)}},t.prototype.getSeriesByName=function(e){var t=Au(e,null);return qa(this._componentsMap.get(`series`),function(e){return!!e&&t!=null&&e.name===t})},t.prototype.getSeriesByIndex=function(e){return this._componentsMap.get(`series`)[e]},t.prototype.getSeriesByType=function(e){return qa(this._componentsMap.get(`series`),function(t){return!!t&&t.subType===e})},t.prototype.getSeries=function(){return qa(this._componentsMap.get(`series`),function(e){return!!e})},t.prototype.getSeriesCount=function(){return this._componentsCount.get(`series`)},t.prototype.eachSeries=function(e,t){SK(this),L(this._seriesIndices,function(n){var r=this._componentsMap.get(`series`)[n];e.call(t,r,n)},this)},t.prototype.eachRawSeries=function(e,t){L(this._componentsMap.get(`series`),function(n){n&&e.call(t,n,n.componentIndex)})},t.prototype.eachSeriesByType=function(e,t,n){SK(this),L(this._seriesIndices,function(r){var i=this._componentsMap.get(`series`)[r];i.subType===e&&t.call(n,i,r)},this)},t.prototype.eachRawSeriesByType=function(e,t,n){return L(this.getSeriesByType(e),t,n)},t.prototype.isSeriesFiltered=function(e){return SK(this),this._seriesIndicesMap.get(e.componentIndex)==null},t.prototype.getCurrentSeriesIndices=function(){return(this._seriesIndices||[]).slice()},t.prototype.filterSeries=function(e,t){SK(this);var n=[];L(this._seriesIndices,function(r){var i=this._componentsMap.get(`series`)[r];e.call(t,i,r)&&n.push(r)},this),this._seriesIndices=n,this._seriesIndicesMap=W(n)},t.prototype.restoreData=function(e){xK(this);var t=this._componentsMap,n=[];t.each(function(e,t){BH.hasClass(t)&&n.push(t)}),BH.topologicalTravel(n,BH.getAllClassMainTypes(),function(n){L(t.get(n),function(t){t&&(n!==`series`||!fS(t,e))&&t.restoreData()})})},t.internalField=function(){xK=function(e){var t=e._seriesIndices=[];L(e._componentsMap.get(`series`),function(e){e&&t.push(e.componentIndex)}),e._seriesIndicesMap=W(t)},SK=function(e){},CK=function(e,t){e.option={},e.option[wK]=TK,e._componentsMap=W({series:[]}),e._componentsCount=W();var n=t.aria;H(n)&&n.enabled==null&&(n.enabled=!0),pS(t,e._theme.option),za(t,yK,!1),e._mergeOption(t,null)}}(),t}(rV),Wa(EK,UH),DK=/^(min|max)?(.+)$/,OK=function(){function e(e){this._timelineOptions=[],this._mediaList=[],this._currentMediaIndices=[],this._api=e}return e.prototype.setOption=function(e,t,n){e&&(L(_u(e.series),function(e){e&&e.data&&to(e.data)&&po(e.data)}),L(_u(e.dataset),function(e){e&&e.source&&to(e.source)&&po(e.source)})),e=Ra(e);var r=this._optionBackup,i=_S(e,t,!r);this._newBaseOption=i.baseOption,r?(i.timelineOptions.length&&(r.timelineOptions=i.timelineOptions),i.mediaList.length&&(r.mediaList=i.mediaList),i.mediaDefault&&(r.mediaDefault=i.mediaDefault)):this._optionBackup=i},e.prototype.mountOption=function(e){var t=this._optionBackup;return this._timelineOptions=t.timelineOptions,this._mediaList=t.mediaList,this._mediaDefault=t.mediaDefault,this._currentMediaIndices=[],Ra(e?t.baseOption:this._newBaseOption)},e.prototype.getTimelineOption=function(e){var t,n=this._timelineOptions;if(n.length){var r=e.getComponent(`timeline`);r&&(t=Ra(n[r.getCurrentIndex()]))}return t},e.prototype.getMediaOption=function(e){var t=this._api.getWidth(),n=this._api.getHeight(),r=this._mediaList,i=this._mediaDefault,a=[],o=[];if(!r.length&&!i)return o;for(var s=0,c=r.length;s<c;s++)vS(r[s].query,t,n)&&a.push(s);return!a.length&&i&&(a=[-1]),a.length&&!bS(a,this._currentMediaIndices)&&(o=R(a,function(e){return Ra(e===-1?i.option:r[e].option)})),this._currentMediaIndices=a,o},e}(),kK=L,AK=H,jK=[`areaStyle`,`lineStyle`,`nodeStyle`,`linkStyle`,`chordStyle`,`label`,`labelLine`],MK=[[`x`,`left`],[`y`,`top`],[`x2`,`right`],[`y2`,`bottom`]],NK=[`grid`,`geo`,`parallel`,`legend`,`toolbox`,`title`,`visualMap`,`dataZoom`,`timeline`],PK=[[`borderRadius`,`barBorderRadius`],[`borderColor`,`barBorderColor`],[`borderWidth`,`barBorderWidth`]],FK=od(zS),IK=function(){function e(){this.group=new Lz,this.uid=Om(`viewComponent`)}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){},e.prototype.updateLayout=function(e,t,n,r){},e.prototype.updateVisual=function(e,t,n,r){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}(),To(IK),jo(IK),LK=Iu(),RK={itemStyle:Mo(eV,!0),lineStyle:Mo(ZB,!0)},zK={lineStyle:`stroke`,itemStyle:`fill`},BK={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=e.getModel(r),a=VS(e,r)(i),o=i.getShallow(`decal`);o&&(n.setVisual(`decal`,o),o.dirty=!0);var s=HS(e,r),c=a[s],l=B(c)?c:null,u=a.fill===`auto`||a.stroke===`auto`;if(!a[s]||l||u){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());a[s]||(a[s]=d,n.setVisual(`colorFromPalette`,!0)),a.fill=a.fill===`auto`||B(a.fill)?d:a.fill,a.stroke=a.stroke===`auto`||B(a.stroke)?d:a.stroke}if(n.setVisual(`style`,a),n.setVisual(`drawType`,s),!t.isSeriesFiltered(e)&&l)return n.setVisual(`colorFromPalette`,!1),{dataEach:function(t,n){var r=e.getDataParams(n),i=I({},a);i[s]=l(r),t.setItemVisual(n,`style`,i)}}}},VK=new rV,HK={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=VS(e,r),a=n.getVisual(`drawType`);return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[r]){VK.option=n[r];var o=i(VK);I(e.ensureUniqueItemVisual(t,`style`),o),VK.option.decal&&(e.setItemVisual(t,`decal`,VK.option.decal),VK.option.decal.dirty=!0),a in o&&e.setItemVisual(t,`colorFromPalette`,!1)}}:null}}}},UK={performRawSeries:!0,overallReset:function(e){var t=W();e.eachSeries(function(e){if(!e.isColorBySeries()){var n=e.type+`-`+e.getColorBy();LK(e).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(e){if(!e.isColorBySeries()){var t=e.getRawData(),n={},r=e.getData(),i=LK(e).scope,a=HS(e,e.visualStyleAccessPath||`itemStyle`);r.each(function(e){var t=r.getRawIndex(e);n[t]=e}),t.each(function(o){var s=n[o];if(r.getItemVisual(s,`colorFromPalette`)){var c=r.ensureUniqueItemVisual(s,`style`),l=t.getName(o)||o+``,u=t.count();c[a]=e.getColorFromPalette(l,i,u)}})}})}},WK=Math.PI,GK=function(){function e(e,t,n,r){this._stageTaskMap=W(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),r=this._visualHandlers=r.slice(),this._allHandlers=n.concat(r)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(e){var t=e.overallTask;t&&t.dirty()})},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),r=n.context,i=!t&&n.progressiveEnabled&&(!r||r.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,a=r&&r.modDataCount;return{step:i,modBy:a==null?null:Math.ceil(a/i),modDataCount:a}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid);e.pipelineContext=n.context=e.__preparePipelineContext?e.__preparePipelineContext(t,n):id(e,t,n)},e.prototype.restorePipelines=function(e,t){var n=this,r=n._pipelineMap=W();t.eachSeries(function(t){var i=e.painter.type===`canvas`&&t.getProgressive(),a=t.uid;r.set(a,{id:a,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),n._pipe(t,t.dataTask)})},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;L(this._allHandlers,function(r){var i=e.get(r.uid)||e.set(r.uid,{});uo(!(r.reset&&r.overallReset),``),r.reset&&this._createSeriesStageTask(r,i,t,n),r.overallReset&&this._createOverallStageTask(r,i,t,n)},this)},e.prototype.prepareView=function(e,t,n,r){var i=e.renderTask,a=i.context;a.model=t,a.ecModel=n,a.api=r,i.__block=!e.incrementalPrepareRender,this._pipe(t,i)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,r){r||={};var i=!1,a=this;L(e,function(e,s){if(!(r.visualType&&r.visualType!==e.visualType)){var c=a._stageTaskMap.get(e.uid),l=c.seriesTaskMap,u=c.overallTask;if(u){var d,f=u.agentStubMap;f.each(function(e){o(r,e)&&(e.dirty(),d=!0)}),d&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,r.block);f.each(function(e){e.perform(p)}),u.perform(p)&&(i=!0)}else l&&l.each(function(s,c){o(r,s)&&s.dirty();var l=a.getPerformArgs(s,r.block);l.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(i=!0)})}});function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(e){t=e.dataTask.perform()||t}),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},e.prototype.updatePayload=function(e,t){t!==`remain`&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,r){var i=this,a=t.seriesTaskMap,o=t.seriesTaskMap=W(),s=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(l):s?n.eachRawSeriesByType(s,l):c&&c(n,r).each(l);function l(t){var s=t.uid,c=o.set(s,a&&a.get(s)||Kh({plan:JS,reset:YS,count:ZS}));c.context={model:t,ecModel:n,api:r,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(t,c)}},e.prototype._createOverallStageTask=function(e,t,n,r){var i=this,a=t.overallTask=t.overallTask||Kh({reset:WS});a.context={ecModel:n,api:r,overallReset:e.overallReset,scheduler:i};var o=a.agentStubMap,s=a.agentStubMap=W(),c=e.seriesType,l=e.getTargetSeries,u=e.dirtyOnOverallProgress,d=!1;uo(!e.createOnAllSeries,``),c?n.eachRawSeriesByType(c,f):l?l(n,r).each(f):L(n.getSeries(),f);function f(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,Kh({reset:GS,onDirty:qS})));n.context={model:e,dirtyOnOverallProgress:u},n.agent=a,n.__block=u,i._pipe(e,n)}d&&a.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,r=this._pipelineMap.get(n);!r.head&&(r.head=t),r.tail&&r.tail.pipe(t),r.tail=t,t.__idxInPipeline=r.count++,t.__pipeline=r},e.wrapStageHandler=function(e,t){return B(e)&&(e={overallReset:e,seriesType:QS(e)}),e.uid=Om(`stageHandler`),t&&(e.visualType=t),e},e}(),KK=XS(0),qK={},JK={},$S(qK,EK),$S(JK,dz),qK.eachSeriesByType=qK.eachRawSeriesByType=function(e){YK=e},qK.eachComponent=function(e){e.mainType===`series`&&e.subType&&(YK=e.subType)},Z=X.darkColor,XK=Z.background,ZK=function(){return{axisLine:{lineStyle:{color:Z.axisLine}},splitLine:{lineStyle:{color:Z.axisSplitLine}},splitArea:{areaStyle:{color:[Z.backgroundTint,Z.backgroundTransparent]}},minorSplitLine:{lineStyle:{color:Z.axisMinorSplitLine}},axisLabel:{color:Z.axisLabel},axisName:{}}},QK={label:{color:Z.secondary},itemStyle:{borderColor:Z.borderTint},dividerLineStyle:{color:Z.border}},$K={darkMode:!0,color:Z.theme,backgroundColor:XK,axisPointer:{lineStyle:{color:Z.border},crossStyle:{color:Z.borderShade},label:{color:Z.tertiary}},legend:{textStyle:{color:Z.secondary},pageTextStyle:{color:Z.tertiary}},textStyle:{color:Z.secondary},title:{textStyle:{color:Z.primary},subtextStyle:{color:Z.quaternary}},toolbox:{iconStyle:{borderColor:Z.accent50},feature:{dataView:{backgroundColor:XK,textColor:Z.primary,textareaColor:Z.background,textareaBorderColor:Z.border,buttonColor:Z.accent50,buttonTextColor:Z.neutral00}}},tooltip:{backgroundColor:Z.neutral20,defaultBorderColor:Z.border,textStyle:{color:Z.tertiary}},dataZoom:{borderColor:Z.accent10,textStyle:{color:Z.tertiary},brushStyle:{color:Z.backgroundTint},handleStyle:{color:Z.neutral00,borderColor:Z.accent20},moveHandleStyle:{color:Z.accent40},emphasis:{handleStyle:{borderColor:Z.accent50}},dataBackground:{lineStyle:{color:Z.accent30},areaStyle:{color:Z.accent20}},selectedDataBackground:{lineStyle:{color:Z.accent50},areaStyle:{color:Z.accent30}}},visualMap:{textStyle:{color:Z.secondary},handleStyle:{borderColor:Z.neutral30}},timeline:{lineStyle:{color:Z.accent10},label:{color:Z.tertiary},controlStyle:{color:Z.accent30,borderColor:Z.accent30}},calendar:{itemStyle:{color:Z.neutral00,borderColor:Z.neutral20},dayLabel:{color:Z.tertiary},monthLabel:{color:Z.secondary},yearLabel:{color:Z.secondary}},matrix:{x:QK,y:QK,backgroundColor:{borderColor:Z.axisLine},body:{itemStyle:{borderColor:Z.borderTint}}},timeAxis:ZK(),logAxis:ZK(),valueAxis:ZK(),categoryAxis:ZK(),line:{symbol:`circle`},graph:{color:Z.theme},gauge:{title:{color:Z.secondary},axisLine:{lineStyle:{color:[[1,Z.neutral05]]}},axisLabel:{color:Z.axisLabel},detail:{color:Z.primary}},candlestick:{itemStyle:{color:`#f64e56`,color0:`#54ea92`,borderColor:`#f64e56`,borderColor0:`#54ea92`}},funnel:{itemStyle:{borderColor:Z.background}},radar:function(){var e=ZK();return e.axisName={color:Z.axisLabel},e.axisLine.lineStyle.color=Z.neutral20,e}(),treemap:{breadcrumb:{itemStyle:{color:Z.neutral20,textStyle:{color:Z.secondary}},emphasis:{itemStyle:{color:Z.neutral30}}}},sunburst:{itemStyle:{borderColor:Z.background}},map:{itemStyle:{borderColor:Z.border,areaColor:Z.neutral10},label:{color:Z.tertiary},emphasis:{label:{color:Z.primary},itemStyle:{areaColor:Z.highlight}},select:{label:{color:Z.primary},itemStyle:{areaColor:Z.highlight}}},geo:{itemStyle:{borderColor:Z.border,areaColor:Z.neutral10},emphasis:{label:{color:Z.primary},itemStyle:{areaColor:Z.highlight}},select:{label:{color:Z.primary},itemStyle:{color:Z.highlight}}}},$K.categoryAxis.splitLine.show=!1,eq=function(){function e(){}return e.prototype.normalizeQuery=function(e){var t={},n={},r={};if(V(e)){var i=So(e);t.mainType=i.main||null,t.subType=i.sub||null}else{var a=[`Index`,`Name`,`Id`],o={name:1,dataIndex:1,dataType:1};L(e,function(e,i){for(var s=!1,c=0;c<a.length;c++){var l=a[c],u=i.lastIndexOf(l);if(u>0&&u===i.length-l.length){var d=i.slice(0,u);d!==`data`&&(t.mainType=d,t[l.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(i)&&(n[i]=e,s=!0),s||(r[i]=e)})}return{cptQuery:t,dataQuery:n,otherQuery:r}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var r=n.targetEl,i=n.packedEvent,a=n.model,o=n.view;if(!a||!o)return!0;var s=t.cptQuery,c=t.dataQuery;return l(s,a,`mainType`)&&l(s,a,`subType`)&&l(s,a,`index`,`componentIndex`)&&l(s,a,`name`)&&l(s,a,`id`)&&l(c,i,`name`)&&l(c,i,`dataIndex`)&&l(c,i,`dataType`)&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,r,i));function l(e,t,n,r){return e[n]==null||t[r||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),tq=[`symbol`,`symbolSize`,`symbolRotate`,`symbolOffset`],nq=tq.concat([`symbolKeepAspect`]),rq={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual(`legendIcon`,e.legendIcon),!e.hasSymbolVisual)return;for(var r={},i={},a=!1,o=0;o<tq.length;o++){var s=tq[o],c=e.get(s);B(c)?(a=!0,i[s]=c):r[s]=c}if(r.symbol=r.symbol||e.defaultSymbol,n.setVisual(I({legendIcon:e.legendIcon||r.symbol,symbolKeepAspect:e.get(`symbolKeepAspect`)},r)),t.isSeriesFiltered(e))return;var l=Ya(i);function u(t,n){for(var r=e.getRawValue(n),a=e.getDataParams(n),o=0;o<l.length;o++){var s=l[o];t.setItemVisual(n,s,i[s](r,a))}}return{dataEach:a?u:null}}},iq={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){if(!e.hasSymbolVisual||t.isSeriesFiltered(e))return;var n=e.getData();function r(e,t){for(var n=e.getItemModel(t),r=0;r<nq.length;r++){var i=nq[r],a=n.getShallow(i,!0);a!=null&&e.setItemVisual(t,i,a)}}return{dataEach:n.hasItemOption?r:null}}},aq=new iL,oq={},sq={},cq=Math.round(Math.random()*9),lq=typeof Object.defineProperty==`function`,uq=function(){function e(){this._id=`__ec_inner_`+cq++}return e.prototype.get=function(e){return this._guard(e)[this._id]},e.prototype.set=function(e,t){var n=this._guard(e);return lq?Object.defineProperty(n,this._id,{value:t,enumerable:!1,configurable:!0}):n[this._id]=t,this},e.prototype.delete=function(e){return this.has(e)?(delete this._guard(e)[this._id],!0):!1},e.prototype.has=function(e){return!!this._guard(e)[this._id]},e.prototype._guard=function(e){if(e!==Object(e))throw TypeError(`Value of WeakMap is not a non-null object.`);return e},e}(),dq=new QL(!0),fq=[`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`],pq=[[`lineCap`,`butt`],[`lineJoin`,`miter`],[`miterLimit`,10]],mq=1,hq=2,gq=3,_q=4,vq=new uq,yq=new FF(100),bq=[`symbol`,`symbolSize`,`symbolKeepAspect`,`color`,`backgroundColor`,`dashArrayX`,`dashArrayY`,`maxTileWidth`,`maxTileHeight`],xq=od(UC),Sq=1,Cq=800,wq=900,Tq=920,Eq=1e3,Dq=2e3,Oq=5e3,kq=1e3,Aq=1100,jq=2e3,Mq=3e3,Nq=4e3,Pq=4500,Fq=4600,Iq=5e3,Lq=6e3,Rq=7e3,zq={PROCESSOR:{SERIES_FILTER:Cq,AXIS_STATISTICS:Tq,FILTER:Eq,STATISTIC:Oq,STATISTICS:Oq},VISUAL:{LAYOUT:kq,PROGRESSIVE_LAYOUT:Aq,GLOBAL:jq,CHART:Mq,POST_CHART_LAYOUT:Fq,COMPONENT:Nq,BRUSH:Iq,CHART_ITEM:Pq,ARIA:Lq,DECAL:Rq}},Bq=`__flagInMainProcess`,Vq=`__mainProcessVersion`,Hq=`__pendingUpdate`,Uq=`__needsUpdateStatus`,Wq=/^[a-zA-Z0-9_]+$/,Gq=`__connectUpdateStatus`,Kq=0,qq=1,Jq=2,Yq=function(e){F(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(iL),Xq=Yq.prototype,Xq.on=GC(`on`),Xq.off=GC(`off`),gJ=function(e){F(t,e);function t(t,n,r){var i=e.call(this,new eq)||this;i._chartsViews=[],i._chartsMap={},i._componentsViews=[],i._componentsMap={},i._pendingActions=[],r||={},i.__v_skip=!0,i._dom=t;var a=`canvas`,o=`auto`,s=!1;i[Vq]=1,r.ssr&&uS(function(e){var t=QR(e),n=t.dataIndex;if(n!=null){var r=W();return r.set(`series_index`,t.seriesIndex),r.set(`data_index`,n),t.ssrType&&r.set(`ssr_type`,t.ssrType),r}});var c=i._zr=sS(t,{renderer:r.renderer||a,devicePixelRatio:r.devicePixelRatio,width:r.width,height:r.height,ssr:r.ssr,useDirtyRect:U(r.useDirtyRect,s),useCoarsePointer:U(r.useCoarsePointer,o),pointerSize:r.pointerSize});i._ssr=r.ssr,i._throttledZrFlush=Ob(q(c.flush,c),17),i._updateTheme(n),i._locale=Hm(r.locale||_H),i._coordSysMgr=new $V;var l=i._api=dJ(i);function u(e,t){return e.__prio-t.__prio}return Kx(wJ,u),Kx(SJ,u),i._scheduler=new GK(i,l,SJ,wJ),i._messageCenter=new Yq,i._initEvents(),i.resize=q(i.resize,i),c.animation.on(`frame`,i._onframe,i),oJ(c,i),sJ(c,i),po(i),i}return t.prototype._onframe=function(){if(!this._disposed){var e=this._scheduler,t=this._model,n=this._api;if(mJ(this),this[Hq]){var r=this[Hq].silent;this[Bq]=!0,hJ(this);try{Zq(this),eJ.update.call(this,null,this[Hq].updateParams)}catch(e){throw this[Bq]=!1,this[Hq]=null,e}this._zr.flush(),this[Bq]=!1,this[Hq]=null,iJ.call(this,r),aJ.call(this,r)}else if(e.unfinished){var i=Sq;do{e.unfinished=!1;var a=oF.getTime();e.performSeriesTasks(t),e.performDataProcessorTasks(t),nJ(this,t),e.performVisualTasks(t),uJ(this,this._model,n,`remain`,{}),i-=oF.getTime()-a}while(i>0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[Bq]){if(this._disposed)this.id;else{var r,i,a;if(H(t)&&(n=t.lazyUpdate,r=t.silent,i=t.replaceMerge,a=t.transition,t=t.notMerge),this[Bq]=!0,hJ(this),!this._model||t){var o=new OK(this._api),s=this._theme,c=this._model=new EK;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:i},CJ);var l={seriesTransition:a,optionChanged:!0};if(n)this[Hq]={silent:r,updateParams:l},this[Bq]=!1,this.getZr().wakeUp();else{try{Zq(this),eJ.update.call(this,null,l)}catch(e){throw this[Hq]=null,this[Bq]=!1,e}this._ssr||this._zr.flush(),this[Hq]=null,this[Bq]=!1,iJ.call(this,r),aJ.call(this,r)}}}},t.prototype.setTheme=function(e,t){if(!this[Bq]){if(this._disposed)this.id;else{var n=this._model;if(n){var r=t&&t.silent,i=null;this[Hq]&&(r??=this[Hq].silent,i=this[Hq].updateParams,this[Hq]=null),this[Bq]=!0,hJ(this);try{this._updateTheme(e),n.setTheme(this._theme),Zq(this),eJ.update.call(this,{type:`setTheme`},i)}catch(e){throw this[Bq]=!1,e}this[Bq]=!1,iJ.call(this,r),aJ.call(this,r)}}}},t.prototype._updateTheme=function(e){V(e)&&(e=TJ[e]),e&&(e=Ra(e),e&&RS(e,!0),this._theme=e)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||EF.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){return e||={},this._zr.painter.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get(`backgroundColor`),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){return e||={},this._zr.painter.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){var e=this._zr;return L(e.storage.getDisplayList(),function(e){e.stopAnimation(null,!0)}),e.painter.toDataURL()},t.prototype.getDataURL=function(e){if(this._disposed)this.id;else{e||={};var t=e.excludeComponents,n=this._model,r=[],i=this;L(t,function(e){n.eachComponent({mainType:e},function(e){var t=i._componentsMap[e.__viewId];t.group.ignore||(r.push(t),t.group.ignore=!0)})});var a=this._zr.painter.getType()===`svg`?this.getSvgDataURL():this.renderToCanvas(e).toDataURL(`image/`+(e&&e.type||`png`));return L(r,function(e){e.group.ignore=!1}),a}},t.prototype.getConnectedDataURL=function(e){if(this._disposed)this.id;else{var t=e.type===`svg`,n=this.group,r=Math.min,i=Math.max,a=1/0;if(OJ[n]){var o=a,s=a,c=-a,l=-a,u=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();L(DJ,function(a,d){if(a.group===n){var f=t?a.getZr().painter.getSvgDom().innerHTML:a.renderToCanvas(Ra(e)),p=a.getDom().getBoundingClientRect();o=r(p.left,o),s=r(p.top,s),c=i(p.right,c),l=i(p.bottom,l),u.push({dom:f,left:p.left,top:p.top})}}),o*=d,s*=d,c*=d,l*=d;var f=c-o,p=l-s,m=oF.createCanvas(),h=sS(m,{renderer:t?`svg`:`canvas`});if(h.resize({width:f,height:p}),t){var g=``;return L(u,function(e){var t=e.left-o,n=e.top-s;g+=`<g transform="translate(`+t+`,`+n+`)">`+e.dom+`</g>`}),h.painter.getSvgRoot().innerHTML=g,e.connectedBackgroundColor&&h.painter.setBackgroundColor(e.connectedBackgroundColor),h.refreshImmediately(),h.painter.toDataURL()}return e.connectedBackgroundColor&&h.add(new vR({shape:{x:0,y:0,width:f,height:p},style:{fill:e.connectedBackgroundColor}})),L(u,function(e){var t=new mR({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});h.add(t)}),h.refreshImmediately(),m.toDataURL(`image/`+(e&&e.type||`png`))}return this.getDataURL(e)}},t.prototype.convertToPixel=function(e,t,n){return tJ(this,`convertToPixel`,e,t,n)},t.prototype.convertToLayout=function(e,t,n){return tJ(this,`convertToLayout`,e,t,n)},t.prototype.convertFromPixel=function(e,t,n){return tJ(this,`convertFromPixel`,e,t,n)},t.prototype.containPixel=function(e,t){if(this._disposed)this.id;else{var n=this._model,r;return L(Lu(n,e),function(e,n){n.indexOf(`Models`)>=0&&L(e,function(e){var i=e.coordinateSystem;if(i&&i.containPoint)r||=!!i.containPoint(t);else if(n===`seriesModels`){var a=this._chartsMap[e.__viewId];a&&a.containPoint&&(r||=a.containPoint(t,e))}},this)},this),!!r}},t.prototype.getVisual=function(e,t){var n=this._model,r=Lu(n,e,{defaultMainType:`series`}),i=r.seriesModel.getData(),a=r.hasOwnProperty(`dataIndexInside`)?r.dataIndexInside:r.hasOwnProperty(`dataIndex`)?i.indexOfRawIndex(r.dataIndex):null;return a==null?tC(i,t):eC(i,a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e=this;L(vJ,function(t){var n=function(n){var r=e.getModel(),i=n.target,a;if(t===`globalout`?a={}:i&&rC(i,function(e){var t=QR(e);if(t&&t.dataIndex!=null){var n=t.dataModel||r.getSeriesByIndex(t.seriesIndex);return a=n&&n.getDataParams(t.dataIndex,t.dataType,i)||{},!0}if(t.eventData)return a=I({},t.eventData),!0},!0),a){var o=a.componentType,s=a.componentIndex;(o===`markLine`||o===`markPoint`||o===`markArea`)&&(o=`series`,s=a.seriesIndex);var c=o&&s!=null&&r.getComponent(o,s),l=c&&e[c.mainType===`series`?`_chartsMap`:`_componentsMap`][c.__viewId];a.event=n,a.type=t,e._$eventProcessor.eventInfo={targetEl:i,packedEvent:a,model:c,view:l},e.trigger(t,a)}};n.zrEventfulCallAtLast=!0,e._zr.on(t,n,e)});var t=this._messageCenter;L(xJ,function(n,r){t.on(r,function(t){e.trigger(r,t)})}),Qb(t,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){this._disposed?this.id:this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed)this.id;else{this._disposed=!0,this.getDom()&&Vu(this.getDom(),AJ,``);var e=this,t=e._api,n=e._model;L(e._componentsViews,function(e){e.dispose(n,t)}),L(e._chartsViews,function(e){e.dispose(n,t)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete DJ[e.id]}},t.prototype.resize=function(e){if(!this[Bq]){if(this._disposed)this.id;else{this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption(`media`),r=e&&e.silent;this[Hq]&&(r??=this[Hq].silent,n=!0,this[Hq]=null),this[Bq]=!0,hJ(this);try{n&&Zq(this),eJ.update.call(this,{type:`resize`,animation:I({duration:0},e&&e.animation)})}catch(e){throw this[Bq]=!1,e}this[Bq]=!1,iJ.call(this,r),aJ.call(this,r)}}}},t.prototype.showLoading=function(e,t){if(this._disposed)this.id;else if(H(e)&&(t=e,e=``),e||=`default`,this.hideLoading(),EJ[e]){var n=EJ[e](this._api,t),r=this._zr;this._loadingFX=n,r.add(n)}},t.prototype.hideLoading=function(){this._disposed?this.id:(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},t.prototype.makeActionFromEvent=function(e){var t=I({},e);return t.type=bJ[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed)this.id;else if(H(t)||(t={silent:!!t}),yJ[e.type]&&this._model){if(this[Bq])this._pendingActions.push(e);else{var n=t.silent;rJ.call(this,e,n);var r=t.flush;r?this._zr.flush():r!==!1&&EF.browser.weChat&&this._throttledZrFlush(),iJ.call(this,n),aJ.call(this,n)}}},t.prototype.updateLabelLayout=function(){aq.trigger(`series:layoutlabels`,this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed)this.id;else{var t=e.seriesIndex;this.getModel().getSeriesByIndex(t).appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},t.internalField=function(){Zq=function(e){Hv(e._model);var t=e._scheduler;t.restorePipelines(e._zr,e._model),t.prepareStageTasks(),Qq(e,!0),Qq(e,!1),t.plan()},Qq=function(e,t){for(var n=e._model,r=e._scheduler,i=t?e._componentsViews:e._chartsViews,a=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,c=0;c<i.length;c++)i[c].__alive=!1;t?n.eachComponent(function(e,t){e!==`series`&&l(t)}):n.eachSeries(l);function l(e){var c=e.__requireNewView;e.__requireNewView=!1;var l=`_ec_`+e.id+`_`+e.type,u=!c&&a[l];if(!u){var d=So(e.type);u=new(t?IK.getClass(d.main,d.sub):CU.getClass(d.sub)),u.init(n,s),a[l]=u,i.push(u),o.add(u.group)}e.__viewId=u.__id=l,u.__alive=!0,u.__model=e,u.group.__ecComponentInfo={mainType:e.mainType,index:e.componentIndex},!t&&r.prepareView(u,e,n,s)}for(var c=0;c<i.length;){var u=i[c];u.__alive?c++:(!t&&u.renderTask.dispose(),o.remove(u.group),u.dispose(n,s),i.splice(c,1),a[u.__id]===u&&delete a[u.__id],u.__id=u.group.__ecComponentInfo=null)}},$q=function(e,t,n,r,i){var a=e._model;if(a.setUpdatePayload(n),!r){L([].concat(e._componentsViews,e._chartsViews),l);return}var o=Bu(n,r,i),s=n.excludeSeriesId,c;s!=null&&(c=W(),L(_u(s),function(e){var t=Au(e,null);t!=null&&c.set(t,!0)})),a&&a.eachComponent(o,function(t){if(!(c&&c.get(t.id)!=null)){if($d(n)){if(t instanceof iU)n.type===`highlight`&&!n.notBlur&&!t.get([`emphasis`,`disabled`])&&Ld(t,n,e._api);else{var r=Rd(t.mainType,t.componentIndex,n.name,e._api),i=r.focusSelf,a=r.dispatchers;n.type===`highlight`&&i&&!n.notBlur&&Id(t.mainType,t.componentIndex,e._api),a&&L(a,function(e){n.type===`highlight`?Dd(e):Od(e)})}}else Qd(n)&&t instanceof iU&&(Vd(t,n,e._api),Hd(t),pJ(e))}},e),a&&a.eachComponent(o,function(t){c&&c.get(t.id)!=null||l(e[r===`series`?`_chartsMap`:`_componentsMap`][t.__viewId])},e);function l(r){r&&r.__alive&&r[t]&&r[t](r.__model,a,e._api,n)}},eJ={prepareAndUpdate:function(e){Zq(this),eJ.update.call(this,e,e&&{optionChanged:e.newOption!=null})},update:function(e,n){var r=this._model,i=this._api,a=this._zr,o=this._coordSysMgr,s=this._scheduler;if(r){Uv(r),r.setUpdatePayload(e),s.restoreData(r,e),s.performSeriesTasks(r),o.create(r,i),aq.trigger(`coordsys:aftercreate`,r,i),s.performDataProcessorTasks(r,e),nJ(this,r),o.update(r,i),t(r),s.performVisualTasks(r,e);var c=r.get(`backgroundColor`)||`transparent`;a.setBackgroundColor(c);var l=r.get(`darkMode`);l!=null&&l!==`auto`&&a.setDarkMode(l),cJ(this,r,i,e,n),aq.trigger(`afterupdate`,r,i)}},updateTransform:function(e){var t=this,n=t._model,r=t._api;if(n){n.setUpdatePayload(e);var i=[];n.eachComponent(function(a,o){if(a!==`series`){var s=t.getViewOfComponentModel(o);if(s&&s.__alive){if(s.updateTransform){var c=s.updateTransform(o,n,r,e);c&&c.update&&i.push(s)}else i.push(s)}}});var a=W();n.eachSeries(function(i){var o=t._chartsMap[i.__viewId],s=i.pipelineContext;if(o.updateTransform&&!s.progressiveRender){var c=o.updateTransform(i,n,r,e);c&&c.update&&a.set(i.uid,1)}else a.set(i.uid,1)}),t._scheduler.performVisualTasks(n,e,{setDirty:!0,dirtyMap:a}),uJ(t,n,r,e,{},a),aq.trigger(`afterupdate`,n,r)}},updateView:function(e){var n=this._model;n&&(n.setUpdatePayload(e),CU.markUpdateMethod(e,`updateView`),t(n),this._scheduler.performVisualTasks(n,e,{setDirty:!0}),cJ(this,n,this._api,e,{}),aq.trigger(`afterupdate`,n,this._api))},updateVisual:function(e){var n=this,r=this._model;r&&(r.setUpdatePayload(e),r.eachSeries(function(e){e.getData().clearAllVisual()}),CU.markUpdateMethod(e,`updateVisual`),t(r),this._scheduler.performVisualTasks(r,e,{visualType:`visual`,setDirty:!0}),r.eachComponent(function(t,i){if(t!==`series`){var a=n.getViewOfComponentModel(i);a&&a.__alive&&a.updateVisual(i,r,n._api,e)}}),r.eachSeries(function(t){n._chartsMap[t.__viewId].updateVisual(t,r,n._api,e)}),aq.trigger(`afterupdate`,r,this._api))},updateLayout:function(e){eJ.update.call(this,e)}};function e(e,t,n,r,i){if(e._disposed)e.id;else for(var a=e._model,o=e._coordSysMgr.getCoordinateSystems(),s,c=Lu(a,n),l=0;l<o.length;l++){var u=o[l];if(u[t]&&(s=u[t](a,c,r,i))!=null)return s}}tJ=e,nJ=function(e,t){var n=e._chartsMap,r=e._scheduler;t.eachSeries(function(e){r.updateStreamModes(e,n[e.__viewId])})},rJ=function(e,t){var n=this,r=this.getModel(),i=e.type,a=e.escapeConnect,o=yJ[i],s=(o.update||`update`).split(`:`),c=s.pop(),l=s[0]!=null&&So(s[0]);this[Bq]=!0,hJ(this);var u=[e],d=!1;e.batch&&(d=!0,u=R(e.batch,function(t){return t=Va(I({},t),e),t.batch=null,t}));var f=[],p,m=[],h=o.nonRefinedEventType,g=Qd(e),_=$d(e);if(_&&Pd(this._api),L(u,function(t){var i=o.action(t,r,n._api);if(o.refineEvent?m.push(i):p=i,p||=I({},t),p.type=h,f.push(p),_){var a=Ru(e),s=a.queryOptionMap,u=a.mainTypeSpecified?s.keys()[0]:`series`;$q(n,c,t,u),pJ(n)}else g?($q(n,c,t,`series`),pJ(n)):l&&$q(n,c,t,l.main,l.sub)}),c!==`none`&&!_&&!g&&!l)try{this[Hq]?(Zq(this),eJ.update.call(this,e),this[Hq]=null):eJ[c].call(this,e)}catch(e){throw this[Bq]=!1,e}if(p=d?{type:h,escapeConnect:a,batch:f}:f[0],this[Bq]=!1,!t){var v=void 0;if(o.refineEvent){var y=o.refineEvent(m,e,r,this._api).eventContent;uo(H(y)),v=Va({type:o.refinedEventType},y),v.fromAction=e.type,v.fromActionPayload=e,v.escapeConnect=!0}var b=this._messageCenter;b.trigger(p.type,p),v&&b.trigger(v.type,v)}},iJ=function(e){for(var t=this._pendingActions;t.length;){var n=t.shift();rJ.call(this,n,e)}},aJ=function(e){!e&&this.trigger(`updated`)},oJ=function(e,t){e.on(`rendered`,function(n){t.trigger(`rendered`,n),e.animation.isFinished()&&!t[Hq]&&!t._scheduler.unfinished&&!t._pendingActions.length?t.trigger(`finished`):e.refresh()})},sJ=function(e,t){e.on(`mouseover`,function(e){var n=e.target,r=rC(n,Xd);r&&(zd(r,e,t._api),pJ(t))}).on(`mouseout`,function(e){var n=e.target,r=rC(n,Xd);r&&(Bd(r,e,t._api),pJ(t))}).on(`click`,function(e){var n=e.target,r=rC(n,function(e){return QR(e).dataIndex!=null},!0);if(r){var i=r.selected?`unselect`:`select`,a=QR(r);t._api.dispatchAction({type:i,dataType:a.dataType,dataIndexInside:a.dataIndex,seriesIndex:a.seriesIndex,isFromClick:!0})}})};function t(e){e.clearColorPalette(),e.eachSeries(function(e){e.clearColorPalette()})}function n(e){var t=[],n=[],r=!1;if(e.eachComponent(function(e,i){var a=i.get(`zlevel`)||0,o=i.get(`z`)||0,s=i.getZLevelKey();r||=!!s,(e===`series`?n:t).push({zlevel:a,z:o,idx:i.componentIndex,type:e,key:s})}),r){var i=t.concat(n),a,o;Kx(i,function(e,t){return e.zlevel===t.zlevel?e.z-t.z:e.zlevel-t.zlevel}),L(i,function(t){var n=e.getComponent(t.type,t.idx),r=t.zlevel,i=t.key;a!=null&&(r=Math.max(a,r)),i?(r===a&&i!==o&&r++,o=i):o&&=(r===a&&r++,``),a=r,n.setZLevel(r)})}}cJ=function(e,t,r,i,a){n(t),lJ(e,t,r,i,a),L(e._chartsViews,function(e){e.__alive=!1}),uJ(e,t,r,i,a),L(e._chartsViews,function(e){e.__alive||e.remove(t,r)})},lJ=function(e,t,n,r,i,a){L(a||e._componentsViews,function(e){var i=e.__model;s(i,e),e.render(i,t,n,r),o(i,e),c(i,e)})},uJ=function(e,t,n,r,l,u){var d=e._scheduler;l=I(l||{},{updatedSeries:t.getSeries()}),aq.trigger(`series:beforeupdate`,t,n,l);var f=!1;t.eachSeries(function(t){var n=e._chartsMap[t.__viewId];n.__alive=!0;var i=n.renderTask;d.updatePayload(i,r),s(t,n),u&&u.get(t.uid)&&i.dirty(),i.perform(d.getPerformArgs(i))&&(f=!0),n.group.silent=!!t.get(`silent`),a(t,n),Hd(t)}),d.unfinished=f||d.unfinished,aq.trigger(`series:layoutlabels`,t,n,l),aq.trigger(`series:transition`,t,n,l),t.eachSeries(function(t){var n=e._chartsMap[t.__viewId];o(t,n),c(t,n)}),i(e,t),aq.trigger(`series:afterupdate`,t,n,l)},pJ=function(e){e[Uq]=!0,e.getZr().wakeUp()},hJ=function(e){e[Vq]=(e[Vq]+1)%1e6},mJ=function(e){e[Uq]&&(e.getZr().storage.traverse(function(e){wf(e)||r(e)}),e[Uq]=!1)};function r(e){for(var t=[],n=e.currentStates,r=0;r<n.length;r++){var i=n[r];i!==`emphasis`&&i!==`blur`&&i!==`select`&&t.push(i)}e.selected&&e.states.select&&t.push(`select`),e.hoverState===2&&e.states.emphasis?t.push(`emphasis`):e.hoverState===1&&e.states.blur&&t.push(`blur`),e.useStates(t)}function i(e,t){var n=e._zr;if(n.painter.type===`canvas`){var r=n.storage,i=0;r.traverse(function(e){e.isGroup||i++});var a=i>U(t.get(`hoverLayerThreshold`),yK.hoverLayerThreshold)&&!EF.node&&!EF.worker;(e._usingTHL||a)&&(t.eachSeries(function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered(function(e){var t=e.states.emphasis;t&&t.hoverLayer!==2&&(t.hoverLayer=+!!a)})}}),e._usingTHL=a)}}function a(e,t){var n=e.get(`blendMode`)||null;t.eachRendered(function(e){e.isGroup||(e.style.blend=n)})}function o(e,t){if(!e.preventAutoZ){var n=op(e);t.eachRendered(function(e){return cp(e,n.z,n.zlevel),!0})}}function s(e,t){t.eachRendered(function(e){if(!wf(e)){var t=e.getTextContent(),n=e.getTextGuideLine();e.stateTransition&&=null,t&&t.stateTransition&&(t.stateTransition=null),n&&n.stateTransition&&(n.stateTransition=null),e.hasState()?(e.prevStates=e.currentStates,e.clearStates()):e.prevStates&&=null}})}function c(e,t){var n=e.getModel(`stateAnimation`),i=e.isAnimationEnabled(),a=n.get(`duration`),o=a>0?{duration:a,delay:n.get(`delay`),easing:n.get(`easing`)}:null;t.eachRendered(function(e){if(e.states&&e.states.emphasis){if(wf(e))return;if(e instanceof lR&&ef(e),e.__dirty){var t=e.prevStates;t&&e.useStates(t)}if(i){e.stateTransition=o;var n=e.getTextContent(),a=e.getTextGuideLine();n&&(n.stateTransition=o),a&&(a.stateTransition=o)}e.__dirty&&r(e)}})}dJ=function(e){return new(function(t){F(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}return n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(n!=null)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){Dd(t,n),pJ(e)},n.prototype.leaveEmphasis=function(t,n){Od(t,n),pJ(e)},n.prototype.enterBlur=function(t){kd(t),pJ(e)},n.prototype.leaveBlur=function(t){Ad(t),pJ(e)},n.prototype.enterSelect=function(t){jd(t),pJ(e)},n.prototype.leaveSelect=function(t){Md(t),pJ(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n.prototype.getECUpdateCycleVersion=function(){return e[Vq]},n.prototype.usingTHL=function(){return e._usingTHL},n}(dz))(e)},fJ=function(e){function t(e,t){for(var n=0;n<e.length;n++){var r=e[n];r[Gq]=t}}L(bJ,function(n,r){e._messageCenter.on(r,function(n){if(OJ[e.group]&&e[Gq]!==Kq){if(n&&n.escapeConnect)return;var r=e.makeActionFromEvent(n),i=[];L(DJ,function(t){t!==e&&t.group===e.group&&i.push(t)}),t(i,Kq),L(i,function(e){e[Gq]!==qq&&e.dispatchAction(r)}),t(i,Jq)}})})}}(),t}(iL),_J=gJ.prototype,_J.on=WC(`on`),_J.off=WC(`off`),_J.one=function(e,t,n){var r=this;function i(){var n=[...arguments];t&&t.apply&&t.apply(this,n),r.off(e,i)}this.on.call(this,e,i,n)},vJ=[`click`,`dblclick`,`mouseover`,`mouseout`,`mousemove`,`mousedown`,`mouseup`,`globalout`,`contextmenu`],yJ={},bJ={},xJ={},SJ=[],CJ=[],wJ=[],TJ={},EJ={},DJ={},OJ={},kJ=new Date-0,new Date-0,AJ=`_echarts_instance_`,jJ=[],MJ=Qh,iw(jq,BK),iw(Pq,HK),iw(Pq,UK),iw(jq,rq),iw(Pq,iq),iw(Rq,xq),XC(RS),ZC(wq,FK),ow(`default`,US),tw({type:vz,event:vz,update:vz},bo),tw({type:yz,event:yz,update:yz},bo),tw({type:bz,event:Cz,update:bz,action:bo,refineEvent:cw,publishNonRefinedEvent:!0}),tw({type:xz,event:Cz,update:xz,action:bo,refineEvent:cw,publishNonRefinedEvent:!0}),tw({type:Sz,event:Cz,update:Sz,action:bo,refineEvent:cw,publishNonRefinedEvent:!0}),YC(`default`,{}),YC(`dark`,$K),NJ=[],PJ={registerPreprocessor:XC,registerProcessor:ZC,registerPostInit:QC,registerPostUpdate:$C,registerUpdateLifecycle:ew,registerAction:tw,registerCoordinateSystem:nw,registerLayout:rw,registerVisual:iw,registerTransform:MJ,registerLoading:ow,registerMap:sw,registerImpl:iC,PRIORITY:zq,ComponentModel:BH,ComponentView:IK,SeriesModel:iU,ChartView:CU,registerComponentModel:function(e){BH.registerClass(e)},registerComponentView:function(e){IK.registerClass(e)},registerSeriesModel:function(e){iU.registerClass(e)},registerChartView:function(e){CU.registerClass(e)},registerCustomSeries:function(e,t){oC(e,t)},registerSubTypeDefaulter:function(e,t){BH.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){cS(e,t)}},FJ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return t.prototype.getInitialData=function(e,t){return Tm(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){return this.option.progressive??(this.option.large?5e3:this.get(`progressive`))},t.prototype.getProgressiveThreshold=function(){return this.option.progressiveThreshold??(this.option.large?1e4:this.get(`progressiveThreshold`))},t.prototype.brushSelector=function(e,t,n){return n.point(t.getItemLayout(e))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:``},t.type=`series.scatter`,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:X.color.primary}},universalTransition:{divideShape:`clone`}},t}(iU),IJ=4,LJ=function(){function e(){}return e}(),RJ=function(e){F(t,e);function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.getDefaultShape=function(){return new LJ},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.beforeBrush=function(e){e&&!e.contentRetained&&this.reset()},t.prototype.buildPath=function(e,t){var n=t.points,r=t.size,i=this.symbolProxy,a=i.shape,o=e.getContext?e.getContext():e,s=o&&r[0]<IJ,c=this.softClipShape,l;if(s)this._ctx=o;else{for(this._ctx=null,l=this._off;l<n.length;){var u=n[l++],d=n[l++];isNaN(u)||isNaN(d)||(!c||c.contain(u,d))&&(a.x=u-r[0]/2,a.y=d-r[1]/2,a.width=r[0],a.height=r[1],i.buildPath(e,a,!0))}this.incremental&&(this._off=l,this.notClear=!0)}},t.prototype.afterBrush=function(){var e=this.shape,t=e.points,n=e.size,r=this._ctx,i=this.softClipShape,a;if(r){for(a=this._off;a<t.length;){var o=t[a++],s=t[a++];isNaN(o)||isNaN(s)||(!i||i.contain(o,s))&&r.fillRect(o-n[0]/2,s-n[1]/2,n[0],n[1])}this.incremental&&(this._off=a,this.notClear=!0)}},t.prototype.findDataIndex=function(e,t){for(var n=this.shape,r=n.points,i=n.size,a=Math.max(i[0],4),o=Math.max(i[1],4),s=r.length/2-1;s>=0;s--){var c=s*2,l=r[c]-a/2,u=r[c+1]-o/2;if(e>=l&&t>=u&&e<=l+a&&t<=u+o)return s}return-1},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),r=this.getBoundingRect();return e=n[0],t=n[1],r.contain(e,t)?(this.hoverDataIdx=this.findDataIndex(e,t))>=0:(this.hoverDataIdx=-1,!1)},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var t=this.shape,n=t.points,r=t.size,i=r[0],a=r[1],o=1/0,s=1/0,c=-1/0,l=-1/0,u=0;u<n.length;){var d=n[u++],f=n[u++];o=Math.min(d,o),c=Math.max(d,c),s=Math.min(f,s),l=Math.max(f,l)}e=this._rect=new J(o-i/2,s-a/2,c-o+i,l-s+a)}return e},t}(lR),zJ=function(){function e(){this.group=new Lz}return e.prototype.updateData=function(e,t){this._clear(),this._data=e;var n=this._create();n.setShape({points:e.getLayout(`points`)}),this._setCommon(n,e,t)},e.prototype.updateLayout=function(e){var t=this._data;if(t){var n=t.getLayout(`points`);this.group.eachChild(function(e){if(e.startIndex!=null){var t=(e.endIndex-e.startIndex)*2,r=e.startIndex*4*2;n=new Float32Array(n.buffer,r,t)}e.setShape(`points`,n),e.reset(),e.stopAnimation()})}},e.prototype.incrementalPrepareUpdate=function(e){this._clear()},e.prototype.incrementalUpdate=function(e,t,n,r){var i=this._newAdded[0],a=t.getLayout(`points`),o=i&&i.shape.points;if(o&&o.length<2e4){var s=o.length,c=new Float32Array(s+a.length);c.set(o),c.set(a,s),i.endIndex=e.end,i.setShape({points:c})}else{this._newAdded=[];var l=this._create();l.startIndex=e.start,l.endIndex=e.end,l.incremental=n,l.setShape({points:a}),this._setCommon(l,t,r)}},e.prototype.eachRendered=function(e){this._newAdded[0]&&e(this._newAdded[0])},e.prototype._create=function(){var e=new RJ({cursor:`default`});return e.ignoreCoarsePointer=!0,this.group.add(e),this._newAdded.push(e),e},e.prototype._setCommon=function(e,t,n){var r=t.hostModel;n||={};var i=t.getVisual(`symbolSize`);e.setShape(`size`,i instanceof Array?i:[i,i]),e.softClipShape=n.clipShape||null,e.symbolProxy=Ng(t.getVisual(`symbol`),0,0,0,0),e.setColor=e.symbolProxy.setColor;var a=e.shape.size[0]<IJ;e.useStyle(r.getModel(`itemStyle`).getItemStyle(a?[`color`,`shadowBlur`,`shadowColor`]:[`color`]));var o=t.getVisual(`style`),s=o&&o.fill;s&&e.setColor(s);var c=QR(e);c.seriesIndex=r.seriesIndex,e.on(`mousemove`,function(t){c.dataIndex=null;var n=e.hoverDataIdx;n>=0&&(c.dataIndex=n+(e.startIndex||0))})},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),BJ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=e.getData();this._updateSymbolDraw(r,e).updateData(r,uw(e)),this._finished=!0},t.prototype.incrementalPrepareRender=function(e,t,n){var r=e.getData();this._updateSymbolDraw(r,e).incrementalPrepareUpdate(r),this._finished=!1},t.prototype.incrementalRender=function(e,t,n){this._symbolDraw.incrementalUpdate(e,t.getData(),rd(t),uw(t)),this._finished=e.end===t.getData().count()},t.prototype.updateTransform=function(e,t,n){var r=e.getData();if(this.group.dirty(),this._finished){var i=Sv(``).reset(e,t,n);i.progress&&i.progress({start:0,end:r.count(),count:r.count()},r),this._symbolDraw.updateLayout(uw(e))}else return{update:!0}},t.prototype.eachRendered=function(e){this._symbolDraw&&this._symbolDraw.eachRendered(e)},t.prototype._updateSymbolDraw=function(e,t){var n=this._symbolDraw,r=t.pipelineContext.large;return n&&r===this._isLargeDraw||(n&&n.remove(),n=this._symbolDraw=r?new zJ:new fU,this._isLargeDraw=r,this.group.removeAll()),this.group.add(n.group),n},t.prototype.remove=function(e,t){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type=`scatter`,t}(CU),VJ=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),HJ=function(e){F(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents(`grid`,YR).models[0]},t.type=`cartesian2dAxis`,t}(BH),Wa(HJ,VJ),UJ={show:!0,z:0,inverse:!1,name:``,nameLocation:`end`,nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:`...`,placeholder:`.`},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:`auto`,onZeroAxisIndex:null,lineStyle:{color:X.color.axisLine,width:1,type:`solid`},symbol:[`none`,`none`],symbolSize:[10,15],breakLine:!0},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12,color:X.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:X.color.axisSplitLine,width:1,type:`solid`}},splitArea:{show:!1,areaStyle:{color:[X.color.backgroundTint,X.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:X.color.neutral00,borderColor:X.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:`auto`}},WJ=za({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:`auto`,show:`auto`},axisLabel:{interval:`auto`}},UJ),GJ=za({boundaryGap:[0,0],axisLine:{show:`auto`},axisTick:{show:`auto`},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:X.color.axisMinorSplitLine,width:1}}},UJ),KJ={category:WJ,value:GJ,time:za({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:`bold`}}},splitLine:{show:!1}},GJ),log:Va({logBase:10},GJ)},qJ=function(){function e(e){this.type=`cartesian`,this._dimList=[],this._axes={},this.name=e||``}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return R(this._dimList,function(e){return this._axes[e]},this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),qa(this.getAxes(),function(t){return t.scale.type===e})},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),JJ=[`x`,`y`],YJ=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=UW,t.dimensions=JJ,t}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis(`x`).scale,t=this.getAxis(`y`).scale;if(pw(e)&&pw(t)){var n=g_(e,null),r=g_(t,null),i=this.dataToPoint([n[0],r[0]]),a=this.dataToPoint([n[1],r[1]]),o=n[1]-n[0],s=r[1]-r[0];if(o&&s){var c=(a[0]-i[0])/o,l=(a[1]-i[1])/s,u=i[0]-n[0]*c,d=i[1]-r[0]*l,f=this._transform=[c,0,0,l,u,d];this._invTransform=Wo([],f)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale(`ordinal`)[0]||this.getAxesByScale(`time`)[0]||this.getAxis(`x`)},t.prototype.containPoint=function(e){var t=this.getAxis(`x`),n=this.getAxis(`y`);return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis(`x`).containData(e[0])&&this.getAxis(`y`).containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),r=this.dataToPoint(t),i=this.getArea(),a=new J(n[0],n[1],r[0]-n[0],r[1]-n[1]);return i.intersect(a)},t.prototype.dataToPoint=function(e,t,n){n||=[];var r=e[0],i=e[1];if(this._transform&&r!=null&&isFinite(r)&&i!=null&&isFinite(i))return rs(n,e,this._transform);var a=this.getAxis(`x`),o=this.getAxis(`y`);return n[0]=a.toGlobalCoord(a.dataToCoord(r,t)),n[1]=o.toGlobalCoord(o.dataToCoord(i,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis(`x`).scale,r=this.getAxis(`y`).scale,i=n.getExtent(),a=r.getExtent(),o=n.parse(e[0]),s=r.parse(e[1]);return t||=[],t[0]=Math.min(Math.max(Math.min(i[0],i[1]),o),Math.max(i[0],i[1])),t[1]=Math.min(Math.max(Math.min(a[0],a[1]),s),Math.max(a[0],a[1])),t},t.prototype.pointToData=function(e,t,n){if(n||=[],this._invTransform)return rs(n,e,this._invTransform);var r=this.getAxis(`x`),i=this.getAxis(`y`);return n[0]=r.coordToData(r.toLocalCoord(e[0]),t),n[1]=i.coordToData(i.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis(e.dim===`x`?`y`:`x`)},t.prototype.getArea=function(e){e||=0;var t=this.getAxis(`x`).getGlobalExtent(),n=this.getAxis(`y`).getGlobalExtent(),r=Math.min(t[0],t[1])-e,i=Math.min(n[0],n[1])-e;return new J(r,i,Math.max(t[0],t[1])-r+e,Math.max(n[0],n[1])-i+e)},t}(qJ),XJ={interval:hw,log:hw,time:FU,ordinal:bo},ZJ=[[3,1],[0,2]],QJ=function(){function e(e,t,n){this.type=`grid`,this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=JJ,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;L(this._axesList,function(e){ib(e,1);var t=e.scale;w_(t)&&t.setSortInfo(e.model.get(`categorySortInfo`))});function r(e){for(var t=Ya(e),n=[],r=t.length-1;r>=0;r--){var i=e[+t[r]];i.__alignTo?n.push(i):vw(i)}L(n,function(e){Tw(e,e.__alignTo)?vw(e):mw(e,e.__alignTo.scale)})}r(n.x),r(n.y);var i={};L(n.x,function(e){Sw(n,`y`,e,i)}),L(n.y,function(e){Sw(n,`x`,e,i)}),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var r=Nh(e,t),i=this._rect=Mh(e.getBoxLayoutParams(),r.refContainer),a=this._axesMap,o=this._coordsList,s=e.get(`containLabel`);if(Dw(a,i),!n){var c=Aw(i,o,a,s,t),l=void 0;if(s)$J?($J(this._axesList,i),Dw(a,i)):l=kw(i.clone(),`axisLabel`,null,i,a,c,r);else{var u=Mw(e,i,r),d=u.outerBoundsRect,f=u.parsedOuterBoundsContain,p=u.outerBoundsClamp;d&&(l=kw(d,f,p,i,a,c,r))}jw(i,a,XU.determine,null,l,r),L(this._coordsList,function(e){e.calcAffineTransform()})}},e.prototype.getAxis=function(e,t){var n=this._axesMap[e];if(n!=null)return n[t||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var n=`x`+e+`y`+t;return this._coordsMap[n]}H(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var r=0,i=this._coordsList;r<i.length;r++)if(i[r].getAxis(`x`).index===e||i[r].getAxis(`y`).index===t)return i[r]},e.prototype.getCartesians=function(){return this._coordsList.slice()},e.prototype.convertToPixel=function(e,t,n){var r=this._findConvertTarget(t);return r.cartesian?r.cartesian.dataToPoint(n):r.axis?r.axis.toGlobalCoord(r.axis.dataToCoord(n)):null},e.prototype.convertFromPixel=function(e,t,n){var r=this._findConvertTarget(t);return r.cartesian?r.cartesian.pointToData(n):r.axis?r.axis.coordToData(r.axis.toLocalCoord(n)):null},e.prototype._findConvertTarget=function(e){var t=e.seriesModel,n=e.xAxisModel||t&&t.getReferringComponents(`xAxis`,YR).models[0],r=e.yAxisModel||t&&t.getReferringComponents(`yAxis`,YR).models[0],i=e.gridModel,a=this._coordsList,o,s;return t?(o=t.coordinateSystem,Ha(a,o)<0&&(o=null)):n&&r?o=this.getCartesian(n.componentIndex,r.componentIndex):n?s=this.getAxis(`x`,n.componentIndex):r?s=this.getAxis(`y`,r.componentIndex):i&&i.coordinateSystem===this&&(o=this._coordsList[0]),{cartesian:o,axis:s}},e.prototype.containPoint=function(e){var t=this._coordsList[0];if(t)return t.containPoint(e)},e.prototype._initCartesian=function(e,t,n){var r=this,i=this,a={left:!1,right:!1,top:!1,bottom:!1},o={x:{},y:{}},s={x:0,y:0};if(t.eachComponent(`xAxis`,c(`x`),this),t.eachComponent(`yAxis`,c(`y`),this),!s.x||!s.y){this._axesMap={},this._axesList=[];return}this._axesMap=o,L(o.x,function(t,n){L(o.y,function(i,a){var o=`x`+n+`y`+a,s=new YJ(o);s.master=r,s.model=e,r._coordsMap[o]=s,r._coordsList.push(s),s.addAxis(t),s.addAxis(i)})}),ww(o.x),ww(o.y);function c(t){return function(n,r){if(xw(n,e)){var c=n.get(`position`);t===`x`?c!==`top`&&c!==`bottom`&&(c=a.bottom?`top`:`bottom`):c!==`left`&&c!==`right`&&(c=a.left?`right`:`left`),a[c]=!0;var l=U_(n),u=new cW(t,W_(n,l,!0),[0,0],l,c);u.onBand=av(u.scale,n),u.inverse=n.get(`inverse`),n.axis=u,u.model=n,u.grid=i,u.index=r,i._axesList.push(u),o[t][r]=u,s[t]++}}}},e.prototype.getTooltipAxes=function(e){var t=[],n=[];return L(this.getCartesians(),function(r){var i=e!=null&&e!==`auto`?r.getAxis(e):r.getBaseAxis(),a=r.getOtherAxis(i);Ha(t,i)<0&&t.push(i),Ha(n,a)<0&&n.push(a)}),{baseAxes:t,otherAxes:n}},e.create=function(t,n){var r=[];return t.eachComponent(`grid`,function(i,a){var o=new e(i,t,n);o.name=`grid_`+a,o.resize(i,n,!0),i.coordinateSystem=o,r.push(o),L(o._axesList,function(t){rb(t,e.dimIdxMap)})}),t.eachSeries(function(e){var t,n;gm({targetModel:e,coordSysType:UW,coordSysProvider:r});function r(){var r=Yy(e),i=r.xAxisModel,a=r.yAxisModel;return t=i.axis,n=a.axis,i.getCoordSysModel().coordinateSystem.getCartesian(i.componentIndex,a.componentIndex)}t&&n&&(iy(t,e,UW),iy(n,e,UW))},this),r},e.dimensions=JJ,e.dimIdxMap=om(JJ),e}(),eY=function(e,t,n,r,i,a){var o=n.axis.dim===`x`?`y`:`x`;AW(e,t,n,r,i,a),$_(e.nameLocation)||L(t.recordMap[o],function(e){e&&e.labelInfoList&&e.dirVec&&Ay(e.labelInfoList,e.dirVec,r,i)})},tY={},nY=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(t,n,r,i){this.axisPointerClass&&zw(t),e.prototype.render.apply(this,arguments),this._doUpdateAxisPointerClass(t,r,!0)},t.prototype.updateAxisPointer=function(e,t,n,r){this._doUpdateAxisPointerClass(e,n,!1)},t.prototype.remove=function(e,t){var n=this._axisPointer;n&&n.remove(t)},t.prototype.dispose=function(t,n){this._disposeAxisPointer(n),e.prototype.dispose.apply(this,arguments)},t.prototype._doUpdateAxisPointerClass=function(e,n,r){var i=t.getAxisPointerClass(this.axisPointerClass);if(i){var a=Vw(e);a?(this._axisPointer||=new i).render(e,a,n,r):this._disposeAxisPointer(n)}},t.prototype._disposeAxisPointer=function(e){this._axisPointer&&this._axisPointer.dispose(e),this._axisPointer=null},t.registerAxisPointerClass=function(e,t){tY[e]=t},t.getAxisPointerClass=function(e){return e&&tY[e]},t.type=`axis`,t}(IK),rY=Iu(),iY=[`splitArea`,`splitLine`,`minorSplitLine`,`breakArea`],aY=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass=`CartesianAxisPointer`,n}return t.prototype.render=function(t,n,r,i){this.group.removeAll();var a=this._axisGroup;this._axisGroup=new Lz,this.group.add(this._axisGroup),ev(t)&&(this._axisGroup.add(t.axis.axisBuilder.group),L(iY,function(e){t.get([e,`show`])&&oY[e](this,this._axisGroup,t,t.getCoordSysModel(),r)},this),i&&i.type===`changeAxisOrder`&&i.isInitSort||Wf(a,this._axisGroup,t),e.prototype.render.call(this,t,n,r,i))},t.prototype.remove=function(){Gw(this)},t.type=`cartesianAxis`,t}(nY),oY={splitLine:function(e,t,n,r,i){var a=n.axis;if(!a.scale.isBlank()){var o=n.getModel(`splitLine`),s=o.getModel(`lineStyle`),c=s.get(`color`),l=o.get(`showMinLine`)!==!1,u=o.get(`showMaxLine`)!==!1;c=z(c)?c:[c];for(var d=r.coordinateSystem.getRect(),f=a.isHorizontal(),p=0,m=a.getTicksCoords({tickModel:o,breakTicks:`none`,pruneByBreak:`preserve_extent_bound`}),h=[],g=[],_=s.getLineStyle(),v=0;v<m.length;v++){var y=a.toGlobalCoord(m[v].coord);if(!(v===0&&!l||v===m.length-1&&!u)){var b=m[v].tickValue;f?(h[0]=y,h[1]=d.y,g[0]=y,g[1]=d.y+d.height):(h[0]=d.x,h[1]=y,g[0]=d.x+d.width,g[1]=y);var x=p++%c.length,S=new lB({anid:b==null?null:`line_`+b,autoBatch:!0,shape:{x1:h[0],y1:h[1],x2:g[0],y2:g[1]},style:Va({stroke:c[x]},_),silent:!0});Lf(S.shape,_.lineWidth),t.add(S)}}}},minorSplitLine:function(e,t,n,r,i){var a=n.axis,o=n.getModel(`minorSplitLine`).getModel(`lineStyle`),s=r.coordinateSystem.getRect(),c=a.isHorizontal(),l=a.getMinorTicksCoords();if(l.length)for(var u=[],d=[],f=o.getLineStyle(),p=0;p<l.length;p++)for(var m=0;m<l[p].length;m++){var h=a.toGlobalCoord(l[p][m].coord);c?(u[0]=h,u[1]=s.y,d[0]=h,d[1]=s.y+s.height):(u[0]=s.x,u[1]=h,d[0]=s.x+s.width,d[1]=h);var g=new lB({anid:`minor_line_`+l[p][m].tickValue,autoBatch:!0,shape:{x1:u[0],y1:u[1],x2:d[0],y2:d[1]},style:f,silent:!0});Lf(g.shape,f.lineWidth),t.add(g)}},splitArea:function(e,t,n,r,i){Ww(e,t,n,r)},breakArea:function(e,t,n,r,i){var a=Ty(),o=n.axis.scale;a&&o.type!==`ordinal`&&a.rectCoordBuildBreakAxis(t,e,n,r.coordinateSystem.getRect(),i)}},sY=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`xAxis`,t}(aY),cY=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=sY.type,t}return t.type=`yAxis`,t}(aY),lY=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`grid`,t}return t.prototype.render=function(e,t){this.group.removeAll(),e.get(`show`)&&this.group.add(new vR({shape:e.coordinateSystem.getRect(),style:Va({fill:e.get(`backgroundColor`)},e.getItemStyle()),silent:!0,z2:-1}))},t.type=`grid`,t}(IK),uY={offset:0},dY=Iu(),tw({type:`takeGlobalCursor`,event:`globalCursorTaken`,update:`update`},bo),fY={axisPointer:1,tooltip:1,brush:1},pY=function(e){F(t,e);function t(t){var n=e.call(this)||this;n._zr=t;var r=q(n._mousedownHandler,n),i=q(n._mousemoveHandler,n),a=q(n._mouseupHandler,n),o=q(n._mousewheelHandler,n),s=q(n._pinchHandler,n);return n.enable=function(e,n){var c=n.zInfo,l=op(c.component),u=l.z,d=l.zlevel,f={component:c.component,z:u,zlevel:d,z2:U(c.z2,-1/0)},p=I({},n.triggerInfo);this._opt=Va(I({},n),{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0,zInfoParsed:f,triggerInfo:p,cursorGrab:`grab`,cursorGrabbing:`grabbing`}),e??=!0,this._enabled&&this._controlType===e||(this.disable(),this._enabled=!0,(e===!0||e===`move`||e===`pan`)&&(Qw(t,`mousedown`,r,f),Qw(t,`mousemove`,i,f),Qw(t,`mouseup`,a,f)),(e===!0||e===`scale`||e===`zoom`)&&(Qw(t,`mousewheel`,o,f),Qw(t,`pinch`,s,f)))},n.disable=function(){this._enabled&&(this._enabled=!1,$w(t,`mousedown`,r),$w(t,`mousemove`,i),$w(t,`mouseup`,a),$w(t,`mousewheel`,o),$w(t,`pinch`,s))},n}return t.prototype.isDragging=function(){return this._dragging},t.prototype.isPinching=function(){return this._pinching},t.prototype._checkPointer=function(e,t,n){var r=this._opt,i=r.zInfoParsed;if(Yw(e,r.api,i.component))return!1;var a=r.triggerInfo,o=a.roamTrigger,s=!1;return o===`global`&&(s=!0),s||=a.isInSelf(e,t,n),s&&a.isInClip&&!a.isInClip(e,t,n)&&(s=!1),s},t.prototype._decideCursorStyle=function(e,t,n,r){var i=e.target;if(!i&&this._checkPointer(e,t,n))return this._opt.cursorGrab;if(r)return i&&i.cursor||`default`},t.prototype.dispose=function(){this.disable()},t.prototype._mousedownHandler=function(e){if(!(jx(e)||Xw(e))){for(var t=e.target;t;){if(t.draggable)return;t=t.__hostTarget||t.parent}var n=e.offsetX,r=e.offsetY;this._checkPointer(e,n,r)&&(this._x=n,this._y=r,this._dragging=!0)}},t.prototype._mousemoveHandler=function(e){var t=this._zr;if(!(e.gestureEvent===`pinch`||Jw(t,`globalPan`)||Xw(e))){var n=e.offsetX,r=e.offsetY;if(!this._dragging||!rT(`moveOnMouseMove`,e,this._opt)){var i=this._decideCursorStyle(e,n,r,!1);i&&t.setCursorStyle(i)}else{t.setCursorStyle(this._opt.cursorGrabbing);var a=this._x,o=this._y,s=n-a,c=r-o;this._x=n,this._y=r,this._opt.preventDefaultMouseMove&&BG(e.event),e.__ecRoamConsumed=!0,nT(this,`pan`,`moveOnMouseMove`,e,{dx:s,dy:c,oldX:a,oldY:o,newX:n,newY:r,isAvailableBehavior:null})}}},t.prototype._mouseupHandler=function(e){if(!Xw(e)){var t=this._zr;if(!jx(e)){this._dragging=!1;var n=this._decideCursorStyle(e,e.offsetX,e.offsetY,!0);n&&t.setCursorStyle(n)}}},t.prototype._mousewheelHandler=function(e){if(!Xw(e)){var t=rT(`zoomOnMouseWheel`,e,this._opt),n=rT(`moveOnMouseWheel`,e,this._opt),r=e.wheelDelta,i=Math.abs(r),a=e.offsetX,o=e.offsetY;if(r!==0&&(t||n)){if(t){var s=i>3?1.4:i>1?1.2:1.1,c=r>0?s:1/s;this._checkTriggerMoveZoom(this,`zoom`,`zoomOnMouseWheel`,e,{scale:c,originX:a,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(r),u=(r>0?1:-1)*(l>3?.4:l>1?.15:.05);this._checkTriggerMoveZoom(this,`scrollMove`,`moveOnMouseWheel`,e,{scrollDelta:u,originX:a,originY:o,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(e){if(!(Jw(this._zr,`globalPan`)||Xw(e))){var t=e.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,`zoom`,null,e,{scale:t,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(e,t,n,r,i){e._checkPointer(r,i.originX,i.originY)&&(BG(r.event),r.__ecRoamConsumed=!0,nT(e,t,n,r,i))},t}(iL),mY=Iu(),hY=`view`,gY=function(e){F(t,e);function t(t,n,r){var i=e.call(this)||this;i.type=hY,i.dimensions=[`x`,`y`];var a=iT(i);a.invertY=t,a.lgCt=n,a.lgGeo=r;var o=a.trans=[];return o[0]=Ps(),o[1]=Ps(),o[2]=Ps(),a.mtRaw=Lo(),a.mtRawInv=Lo(),a.mtOverall=Lo(),a.mtOverallInv=Lo(),a.zoom=1,i}return t.prototype.getBoundingRect=function(){return aT(null,this)},t.prototype.getViewRect=function(){return oT(null,this)},t.prototype.getRoamTransform=function(){return TI(iT(this).trans[1])},t.prototype.dataToPoint=function(e,t,n){var r=t?iT(this).mtRaw:iT(this).mtOverall;return n||=[],r?rs(n,e,r):Ko(n,e)},t.prototype.pointToData=function(e,t,n){n||=[];var r=iT(this).mtOverallInv;return r?rs(n,e,r):Ko(n,e)},t.prototype.convertToPixel=function(e,t,n){var r=bT(t);return r===this?r.dataToPoint(n):null},t.prototype.convertFromPixel=function(e,t,n){var r=bT(t);return r===this?r.pointToData(n):null},t.prototype.containPoint=function(e){var t=iT(this);return tI(_Y,t.dataRect),rI(_Y,_Y,t.mtOverall),iI(_Y,e[0],e[1])},t.dimensions=[`x`,`y`],t}(wI),_Y=$F(),vY=Lo(),yY=Lo(),bY=$F(),xY=[],SY=Lo(),CY=Lo(),wY=[],TY=Ps(),EY=Ps(),DY=[],OY=new J(0,0,0,0),kY=Iu(),AY=function(){function e(e,t){this.depth=0,this.height=0,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.isExpand=!1,this.name=e||``,this.hostTree=t}return e.prototype.isRemoved=function(){return this.dataIndex<0},e.prototype.eachNode=function(e,t,n){B(e)&&(n=t,t=e,e=null),e||={},V(e)&&(e={order:e});var r=e.order||`preorder`,i=this[e.attr||`children`],a;r===`preorder`&&(a=t.call(n,this));for(var o=0;!a&&o<i.length;o++)i[o].eachNode(e,t,n);r===`postorder`&&t.call(n,this)},e.prototype.updateDepthAndHeight=function(e){var t=0;this.depth=e;for(var n=0;n<this.children.length;n++){var r=this.children[n];r.updateDepthAndHeight(e+1),r.height>t&&(t=r.height)}this.height=t+1},e.prototype.getNodeById=function(e){if(this.getId()===e)return this;for(var t=0,n=this.children,r=n.length;t<r;t++){var i=n[t].getNodeById(e);if(i)return i}},e.prototype.contains=function(e){if(e===this)return!0;for(var t=0,n=this.children,r=n.length;t<r;t++){var i=n[t].contains(e);if(i)return i}},e.prototype.getAncestors=function(e){for(var t=[],n=e?this:this.parentNode;n;)t.push(n),n=n.parentNode;return t.reverse(),t},e.prototype.getAncestorsIndices=function(){for(var e=[],t=this;t;)e.push(t.dataIndex),t=t.parentNode;return e.reverse(),e},e.prototype.getDescendantIndices=function(){var e=[];return this.eachNode(function(t){e.push(t.dataIndex)}),e},e.prototype.getValue=function(e){var t=this.hostTree.data;return t.getStore().get(t.getDimensionIndex(e||`value`),this.dataIndex)},e.prototype.setLayout=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemLayout(this.dataIndex,e,t)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostTree.data.getItemModel(this.dataIndex).getModel(e)},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,e,t)},e.prototype.getVisual=function(e){return this.hostTree.data.getItemVisual(this.dataIndex,e)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var e=this.parentNode.children,t=0;t<e.length;++t)if(e[t]===this)return t;return-1}return-1},e.prototype.isAncestorOf=function(e){for(var t=e.parentNode;t;){if(t===this)return!0;t=t.parentNode}return!1},e.prototype.isDescendantOf=function(e){return e!==this&&e.isAncestorOf(this)},e}(),jY=function(){function e(e){this.type=`tree`,this._nodes=[],this.hostModel=e}return e.prototype.eachNode=function(e,t,n){this.root.eachNode(e,t,n)},e.prototype.getNodeByDataIndex=function(e){var t=this.data.getRawIndex(e);return this._nodes[t]},e.prototype.getNodeById=function(e){return this.root.getNodeById(e)},e.prototype.update=function(){for(var e=this.data,t=this._nodes,n=0,r=t.length;n<r;n++)t[n].dataIndex=-1;for(var n=0,r=e.count();n<r;n++)t[e.getRawIndex(n)].dataIndex=n},e.prototype.clearLayouts=function(){this.data.clearItemLayouts()},e.createTree=function(t,n,r){var i=new e(n),a=[],o=1;s(t);function s(e,t){var n=e.value;o=Math.max(o,z(n)?n.length:1),a.push(e);var r=new AY(Au(e.name,``),i);t?XT(r,t):i.root=r,i._nodes.push(r);var c=e.children;if(c)for(var l=0;l<c.length;l++)s(c[l],r)}i.root.updateDepthAndHeight(0);var c=lm(a,{coordDimensions:[`value`],dimensionsCount:o}).dimensions,l=new XV(c,n);return l.initData(a),r&&r(l),VT({mainData:l,struct:i,structAttr:`tree`}),i.update(),i},e}(),MY=[`treemapZoomToNode`,`treemapRender`,`treemapMove`],NY=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.preventUsingHoverLayer=!0,n}return t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};rE(n);var r=e.levels||[],i=new rV({itemStyle:this.designatedVisualItemStyle={}},this,t);r=e.levels=iE(r,t);var a=R(r||[],function(e){return new rV(e,i,t)},this),o=jY.createTree(n,this,s);function s(e){e.wrapMethod(`getItemModel`,function(e,t){var n=o.getNodeByDataIndex(t);return e.parentModel=(n?a[n.depth]:null)||i,e})}return o.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.formatTooltip=function(e,t,n){var r=this.getData(),i=this.getRawValue(e);return og(`nameValue`,{name:r.getName(e),value:i})},t.prototype.getDataParams=function(t){var n=e.prototype.getDataParams.apply(this,arguments);return n.treeAncestors=eE(this.getData().tree.getNodeByDataIndex(t),this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(e){this.layoutInfo=this.layoutInfo||{},I(this.layoutInfo,e)},t.prototype.mapIdToIndex=function(e){var t=this._idIndexMap;t||(t=this._idIndexMap=W(),this._idIndexMapCount=0);var n=t.get(e);return n??t.set(e,n=this._idIndexMapCount++),n},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(e){e?this._viewRoot=e:e=this._viewRoot;var t=this.getRawData().tree.root;(!e||e!==t&&!t.contains(e))&&(this._viewRoot=t)},t.prototype.enableAriaDecal=function(){nE(this)},t.type=`series.treemap`,t.layoutMode=`box`,t.defaultOption={progressive:0,coordinateSystemUsage:`box`,left:X.size.l,top:X.size.xxxl,right:X.size.l,bottom:X.size.xxxl,sort:!0,clipWindow:`origin`,squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:`▶`,zoomToNodeRatio:.1024,scaleLimit:{max:5,min:.2},roam:!0,roamTrigger:`global`,nodeClick:`zoomToNode`,animation:!0,animationDurationUpdate:900,animationEasing:`quinticInOut`,breadcrumb:{show:!0,height:22,left:`center`,bottom:X.size.m,emptyItemWidth:25,itemStyle:{color:X.color.backgroundShade,textStyle:{color:X.color.secondary}},emphasis:{itemStyle:{color:X.color.background}}},label:{show:!0,distance:0,padding:5,position:`inside`,color:X.color.neutral00,overflow:`truncate`},upperLabel:{show:!1,position:[0,`50%`],height:20,overflow:`truncate`,verticalAlign:`middle`},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:X.color.neutral00,borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,`50%`],overflow:`truncate`,verticalAlign:`middle`}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:`index`,visibleMin:10,childrenVisibleMin:null,levels:[]},t}(iU),PY=8,FY=8,IY=5,LY=function(){function e(e){this.group=new Lz,e.add(this.group)}return e.prototype.render=function(e,t,n,r){var i=e.getModel(`breadcrumb`),a=this.group;if(a.removeAll(),i.get(`show`)&&n){var o=i.getModel(`itemStyle`),s=i.getModel(`emphasis`),c=o.getModel(`textStyle`),l=s.getModel([`itemStyle`,`textStyle`]),u=Nh(e,t).refContainer,d={left:i.get(`left`),right:i.get(`right`),top:i.get(`top`),bottom:i.get(`bottom`)},f={emptyItemWidth:i.get(`emptyItemWidth`),totalWidth:0,renderList:[]},p=Mh(d,u);this._prepare(n,f,c),this._renderContent(e,f,p,o,s,c,l,r),Ph(a,d,u)}},e.prototype._prepare=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=Au(r.getModel().get(`name`),``),a=n.getTextRect(i),o=Math.max(a.width+PY*2,t.emptyItemWidth);t.totalWidth+=o+FY,t.renderList.push({node:r,text:i,width:o})}},e.prototype._renderContent=function(e,t,n,r,i,a,o,s){for(var c=0,l=t.emptyItemWidth,u=e.get([`breadcrumb`,`height`]),d=t.totalWidth,f=t.renderList,p=i.getModel(`itemStyle`).getItemStyle(),m=f.length-1;m>=0;m--){var h=f[m],g=h.node,_=h.width,v=h.text;d>n.width&&(d-=_-l,_=l,v=null);var y=new iB({shape:{points:aE(c,0,_,u,m===f.length-1,m===0)},style:Va(r.getItemStyle(),{lineJoin:`bevel`}),textContent:new CR({style:_p(a,{text:v})}),textConfig:{position:`inside`},z2:1e5,onclick:Za(s,g)});y.disableLabelAnimation=!0,y.getTextContent().ensureState(`emphasis`).style=_p(o,{text:v}),y.ensureState(`emphasis`).style=p,Kd(y,i.get(`focus`),i.get(`blurScope`),i.get(`disabled`)),this.group.add(y),oE(y,e,g),c+=_+FY}},e.prototype.remove=function(){this.group.removeAll()},e}(),RY=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(e,t,n,r,i){return!this._elExistsMap[e.id]&&(this._elExistsMap[e.id]=!0,this._storage.push({el:e,target:t,duration:n,delay:r,easing:i}),!0)},e.prototype.finished=function(e){return this._finishedCallback=e,this},e.prototype.start=function(){for(var e=this,t=this._storage.length,n=function(){t--,t<=0&&(e._storage.length=0,e._elExistsMap={},e._finishedCallback&&e._finishedCallback())},r=0,i=this._storage.length;r<i;r++){var a=this._storage[r];a.el.animateTo(a.target,{duration:a.duration,delay:a.delay,easing:a.easing,setToFinal:!0,done:n,aborted:n})}return this},e}(),zY=Math.max,BY=Math.min,VY=L,HY=[`itemStyle`,`borderWidth`],UY=[`itemStyle`,`gapWidth`],WY=[`upperLabel`,`show`],GY=[`upperLabel`,`height`],KY={seriesType:`treemap`,reset:function(e,t,n,r){var i=e.option,a=Nh(e,n).refContainer,o=Mh(e.getBoxLayoutParams(),a),s=r&&r.type,c=ZT(r,[`treemapZoomToNode`,`treemapRootToNode`],e),l=s===`treemapRender`||s===`treemapMove`?r.rootRect:null,u=e.getViewRoot(),d=QT(u);if(s!==`treemapMove`){var f=!1,p=s===`treemapZoomToNode`?(f=!0,mE(e,c,u,o)):l?(f=!0,I({},l)):I({},o);if(f){var m=vE(o,p);m=yE(m,e),p.width=o.width*m,p.height=o.height*m}var h=i.sort;h&&h!==`asc`&&h!==`desc`&&(h=`desc`);var g={squareRatio:i.squareRatio,sort:h,leafDepth:i.leafDepth};u.hostTree.clearLayouts();var _={x:0,y:0,width:p.width,height:p.height,area:p.width*p.height};u.setLayout(_),cE(u,g,!1,0),_=u.getLayout(),VY(d,function(e,t){var n=(d[t+1]||u).getValue();e.setLayout(I({dataExtent:[n,n],borderWidth:0,upperHeight:0},_))})}var v=e.getData().tree.root;v.setLayout(hE(o,l,c),!0),e.setLayoutInfo(o),gE(v,new J(-o.x,-o.y,n.getWidth(),n.getHeight()),d,u,0)}},qY=Lz,JY=vR,YY=3,XY=`label`,ZY=`upperLabel`,QY=100,$Y=20,eX=30,tX=Mo([[`fill`,`color`],[`stroke`,`strokeColor`],[`lineWidth`,`strokeWidth`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`shadowColor`]]),nX=function(e){var t=tX(e);return t.stroke=t.fill=t.lineWidth=null,t},rX=Iu(),iX=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._state=`ready`,n._storage=bE(),n}return t.prototype.render=function(e,t,n,r){if(!(Ha(t.findComponents({mainType:`series`,subType:`treemap`,query:r}),e)<0)){this.seriesModel=e,this.api=n,this.ecModel=t;var i=ZT(r,[`treemapZoomToNode`,`treemapRootToNode`],e),a=r&&r.type,o=e.layoutInfo,s=!this._oldTree,c=this._storage,l=a===`treemapRootToNode`&&i&&c?{rootNodeGroup:c.nodeGroup[i.node.getRawIndex()],direction:r.direction}:null,u=this._giveContainerGroup(o),d=e.get(`animation`),f=this._doRender(u,e,l);d&&!s&&(!a||a===`treemapZoomToNode`||a===`treemapRootToNode`)?this._doAnimation(u,f,e,l):f.renderFinally(),this._resetController(n),this._renderBreadcrumb(e,n,i)}},t.prototype._giveContainerGroup=function(e){var t=this._containerGroup;return t||(t=this._containerGroup=new qY,this._initEvents(t),this.group.add(t)),t.x=e.x,t.y=e.y,t},t.prototype._doRender=function(e,t,n){var r=t.getData().tree,i=this._oldTree,a=bE(),o=bE(),s=this._storage,c=[];function l(e,r,i,l){return xE(t,o,s,n,a,c,e,r,i,l)}d(r.root?[r.root]:[],i&&i.root?[i.root]:[],e,r===i||!i,0);var u=f(s);return this._oldTree=r,this._storage=o,{lastsForAnimation:a,willDeleteEls:u,renderFinally:p};function d(e,t,n,r,i){r?(t=e,L(e,function(e,t){!e.isRemoved()&&o(t,t)})):new iV(t,e,a,a).add(o).update(o).remove(Za(o,null)).execute();function a(e){return e.getId()}function o(a,o){var s=a==null?null:e[a],c=o==null?null:t[o],u=l(s,c,n,i);u&&d(s&&s.viewChildren||[],c&&c.viewChildren||[],u,r,i+1)}}function f(e){var t=bE();return e&&L(e,function(e,n){var r=t[n];L(e,function(e){e&&(r.push(e),rX(e).willDelete=!0)})}),t}function p(){L(u,function(e){L(e,function(e){e.parent&&e.parent.remove(e)})}),L(c,function(e){e.invisible=!0,e.dirty()})}},t.prototype._doAnimation=function(e,t,n,r){var i=n.get(`animationDurationUpdate`),a=n.get(`animationEasing`),o=(B(i)?0:i)||0,s=(B(a)?null:a)||`cubicOut`,c=sE();L(t.willDeleteEls,function(e,t){L(e,function(e,n){if(!e.invisible){var i=e.parent,a,l=rX(i);if(r&&r.direction===`drillDown`)a=i===r.rootNodeGroup?{shape:{x:0,y:0,width:l.nodeWidth,height:l.nodeHeight},style:{opacity:0}}:{style:{opacity:0}};else{var u=0,d=0;l.willDelete||(u=l.nodeWidth/2,d=l.nodeHeight/2),a=t===`nodeGroup`?{x:u,y:d,style:{opacity:0}}:{shape:{x:u,y:d,width:0,height:0},style:{opacity:0}}}a&&c.add(e,a,o,0,s)}})}),L(this._storage,function(e,n){L(e,function(e,r){var i=t.lastsForAnimation[n][r],a={};i&&(e instanceof Lz?i.oldX!=null&&(a.x=e.x,a.y=e.y,e.x=i.oldX,e.y=i.oldY):(i.oldShape&&(a.shape=I({},e.shape),e.setShape(i.oldShape)),i.fadein?(e.setStyle(`opacity`,0),a.style={opacity:1}):e.style.opacity!==1&&(a.style={opacity:1})),c.add(e,a,o,0,s))})},this),this._state=`animating`,c.finished(q(function(){this._state=`ready`,t.renderFinally()},this)).start()},t.prototype._resetController=function(e){var t=this,n=this.seriesModel,r=this._controller;r||(r=this._controller=new pY(e.getZr()),r.on(`pan`,q(this._onPan,this)),r.on(`zoom`,q(this._onZoom,this))),r.enable(n.get(`roam`),{api:e,zInfo:{component:n},triggerInfo:{roamTrigger:n.get(`roamTrigger`),isInSelf:function(e,n,r){var i=t._containerGroup;return i?i.getBoundingRect().contain(n-i.x,r-i.y):!1}}})},t.prototype._clearController=function(){var e=this._controller;e&&=(e.dispose(),null)},t.prototype._onPan=function(e){if(this._state!==`animating`&&(Math.abs(e.dx)>YY||Math.abs(e.dy)>YY)){var t=this.seriesModel.getData().tree.root;if(!t)return;var n=t.getLayout();if(!n)return;this.api.dispatchAction({type:`treemapMove`,from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+e.dx,y:n.y+e.dy,width:n.width,height:n.height}})}},t.prototype._onZoom=function(e){var t=e.originX,n=e.originY,r=e.scale,i=this.seriesModel;if(this._state!==`animating`){var a=i.getData().tree.root;if(!a)return;var o=a.getLayout();if(!o)return;var s=new J(o.x,o.y,o.width,o.height),c=i.layoutInfo,l=vE(c,o),u=l*r;u=yE(u,i);var d=u/l;t-=c.x,n-=c.y;var f=Lo();Vo(f,f,[-t,-n]),Uo(f,f,[d,d]),Vo(f,f,[t,n]),s.applyTransform(f),this.api.dispatchAction({type:`treemapRender`,from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:s.x,y:s.y,width:s.width,height:s.height}})}},t.prototype._initEvents=function(e){var t=this;e.on(`click`,function(e){if(t._state===`ready`){var n=t.seriesModel.get(`nodeClick`,!0);if(n){var r=t.findTarget(e.offsetX,e.offsetY);if(r){var i=r.node;if(i.getLayout().isLeafRoot)t._rootToNode(r);else if(n===`zoomToNode`)t._zoomToNode(r);else if(n===`link`){var a=i.hostTree.data.getItemModel(i.dataIndex),o=a.get(`link`,!0),s=a.get(`target`,!0)||`blank`;o&&Dh(o,s)}}}}},this)},t.prototype._renderBreadcrumb=function(e,t,n){var r=this;n||(n=e.get(`leafDepth`,!0)==null?this.findTarget(t.getWidth()/2,t.getHeight()/2):{node:e.getViewRoot()},n||={node:e.getData().tree.root}),(this._breadcrumb||=new LY(this.group)).render(e,t,n.node,function(t){r._state!==`animating`&&($T(e.getViewRoot(),t)?r._rootToNode({node:t}):r._zoomToNode({node:t}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=bE(),this._state=`ready`,this._breadcrumb&&this._breadcrumb.remove()},t.prototype.dispose=function(){this._clearController()},t.prototype._zoomToNode=function(e){this.api.dispatchAction({type:`treemapZoomToNode`,from:this.uid,seriesId:this.seriesModel.id,targetNode:e.node})},t.prototype._rootToNode=function(e){this.api.dispatchAction({type:`treemapRootToNode`,from:this.uid,seriesId:this.seriesModel.id,targetNode:e.node})},t.prototype.findTarget=function(e,t){var n;return this.seriesModel.getViewRoot().eachNode({attr:`viewChildren`,order:`preorder`},function(r){var i=this._storage.background[r.getRawIndex()];if(i){var a=i.transformCoordToLocal(e,t),o=i.shape;if(o.x<=a[0]&&a[0]<=o.x+o.width&&o.y<=a[1]&&a[1]<=o.y+o.height)n={node:r,offsetX:a[0],offsetY:a[1]};else return!1}},this),n},t.type=`treemap`,t}(CU),aX=L,oX=H,sX=-1,cX=function(){function e(t){var n=t.mappingMethod,r=t.type,i=this.option=Ra(t);this.type=r,this.mappingMethod=n,this._normalizeData=lX[n];var a=e.visualHandlers[r];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[n],n===`piecewise`?(TE(i),CE(i)):n===`category`?i.categories?wE(i):TE(i,!0):(uo(n!==`linear`||i.dataExtent),TE(i))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return q(this._normalizeData,this)},e.listVisualTypes=function(){return Ya(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){H(e)?L(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,r){var i,a=z(t)?[]:H(t)?{}:(i=!0,null);return e.eachVisual(t,function(e,t){var o=n.call(r,e,t);i?a=o:a[t]=o}),a},e.retrieveVisuals=function(t){var n={},r;return t&&aX(e.visualHandlers,function(e,i){t.hasOwnProperty(i)&&(n[i]=t[i],r=!0)}),r?n:null},e.prepareVisualTypes=function(e){if(z(e))e=e.slice();else if(oX(e)){var t=[];aX(e,function(e,n){t.push(n)}),e=t}else return[];return e.sort(function(e,t){return t===`color`&&e!==`color`&&e.indexOf(`color`)===0?1:-1}),e},e.dependsOn=function(e,t){return t===`color`?!!(e&&e.indexOf(t)===0):e===t},e.findPieceIndex=function(e,t,n){for(var r,i=1/0,a=0,o=t.length;a<o;a++){var s=t[a].value;if(s!=null){if(s===e||V(s)&&s===e+``)return a;n&&d(s,a)}}for(var a=0,o=t.length;a<o;a++){var c=t[a],l=c.interval,u=c.close;if(l){if(l[0]===-1/0){if(PE(u[1],e,l[1]))return a}else if(l[1]===1/0){if(PE(u[0],l[0],e))return a}else if(PE(u[0],l[0],e)&&PE(u[1],e,l[1]))return a;n&&d(l[0],a),n&&d(l[1],a)}}if(n)return e===1/0?t.length-1:e===-1/0?0:r;function d(t,n){var a=Math.abs(t-e);a<i&&(i=a,r=n)}},e.visualHandlers={color:{applyVisual:OE(`color`),getColorMapper:function(){var e=this.option;return q(e.mappingMethod===`category`?function(e,t){return!t&&(e=this._normalizeData(e)),kE.call(this,e)}:function(t,n,r){var i=!!r;return!n&&(t=this._normalizeData(t)),r=pc(t,e.parsedVisual,r),i?r:_c(r,`rgba`)},this)},_normalizedToVisual:{linear:function(e){return _c(pc(e,this.option.parsedVisual),`rgba`)},category:kE,piecewise:function(e,t){var n=ME.call(this,t);return n??=_c(pc(e,this.option.parsedVisual),`rgba`),n},fixed:AE}},colorHue:EE(function(e,t){return hc(e,t)}),colorSaturation:EE(function(e,t){return hc(e,null,t)}),colorLightness:EE(function(e,t){return hc(e,null,null,t)}),colorAlpha:EE(function(e,t){return gc(e,t)}),decal:{applyVisual:OE(`decal`),_normalizedToVisual:{linear:null,category:kE,piecewise:null,fixed:null}},opacity:{applyVisual:OE(`opacity`),_normalizedToVisual:jE([0,1])},liftZ:{applyVisual:OE(`liftZ`),_normalizedToVisual:{linear:AE,category:AE,piecewise:AE,fixed:AE}},symbol:{applyVisual:function(e,t,n){n(`symbol`,this.mapValueToVisual(e))},_normalizedToVisual:{linear:DE,category:kE,piecewise:function(e,t){var n=ME.call(this,t);return n??=DE.call(this,e),n},fixed:AE}},symbolSize:{applyVisual:OE(`symbolSize`),_normalizedToVisual:jE([0,1])}},e}(),lX={linear:function(e){return Hl(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,n=cX.findPieceIndex(e,t,!0);if(n!=null)return Hl(n,[0,t.length-1],[0,1],!0)},category:function(e){return(this.option.categories?this.option.categoryMap[e]:e)??sX},fixed:bo},uX=`itemStyle`,dX=Iu(),fX={seriesType:`treemap`,reset:function(e){var t=e.getData().tree.root;t.isRemoved()||FE(t,{},e.getViewRoot().getAncestors(),e)}},pX=function(){function e(e){this.type=`graph`,this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=e||!1}return e.prototype.isDirected=function(){return this._directed},e.prototype.addNode=function(e,t){e=e==null?``+t:``+e;var n=this._nodesMap;if(!n[WE(e)]){var r=new mX(e,t);return r.hostGraph=this,this.nodes.push(r),n[WE(e)]=r,r}},e.prototype.getNodeByIndex=function(e){var t=this.data.getRawIndex(e);return this.nodes[t]},e.prototype.getNodeById=function(e){return this._nodesMap[WE(e)]},e.prototype.addEdge=function(e,t,n){var r=this._nodesMap,i=this._edgesMap;if($a(e)&&(e=this.nodes[e]),$a(t)&&(t=this.nodes[t]),e instanceof mX||(e=r[WE(e)]),t instanceof mX||(t=r[WE(t)]),e&&t){var a=e.id+`-`+t.id,o=new hX(e,t,n);return o.hostGraph=this,this._directed&&(e.outEdges.push(o),t.inEdges.push(o)),e.edges.push(o),e!==t&&t.edges.push(o),this.edges.push(o),i[a]=o,o}},e.prototype.getEdgeByIndex=function(e){var t=this.edgeData.getRawIndex(e);return this.edges[t]},e.prototype.getEdge=function(e,t){e instanceof mX&&(e=e.id),t instanceof mX&&(t=t.id);var n=this._edgesMap;return this._directed?n[e+`-`+t]:n[e+`-`+t]||n[t+`-`+e]},e.prototype.eachNode=function(e,t){for(var n=this.nodes,r=n.length,i=0;i<r;i++)n[i].dataIndex>=0&&e.call(t,n[i],i)},e.prototype.eachEdge=function(e,t){for(var n=this.edges,r=n.length,i=0;i<r;i++)n[i].dataIndex>=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&e.call(t,n[i],i)},e.prototype.breadthFirstTraverse=function(e,t,n,r){if(t instanceof mX||(t=this._nodesMap[WE(t)]),t){for(var i=n===`out`?`outEdges`:n===`in`?`inEdges`:`edges`,a=0;a<this.nodes.length;a++)this.nodes[a].__visited=!1;if(!e.call(r,t,null))for(var o=[t];o.length;)for(var s=o.shift(),c=s[i],a=0;a<c.length;a++){var l=c[a],u=l.node1===s?l.node2:l.node1;if(!u.__visited){if(e.call(r,u,s))return;o.push(u),u.__visited=!0}}}},e.prototype.update=function(){for(var e=this.data,t=this.edgeData,n=this.nodes,r=this.edges,i=0,a=n.length;i<a;i++)n[i].dataIndex=-1;for(var i=0,a=e.count();i<a;i++)n[e.getRawIndex(i)].dataIndex=i;t.filterSelf(function(e){var n=r[t.getRawIndex(e)];return n.node1.dataIndex>=0&&n.node2.dataIndex>=0});for(var i=0,a=r.length;i<a;i++)r[i].dataIndex=-1;for(var i=0,a=t.count();i<a;i++)r[t.getRawIndex(i)].dataIndex=i},e.prototype.clone=function(){for(var t=new e(this._directed),n=this.nodes,r=this.edges,i=0;i<n.length;i++)t.addNode(n[i].id,n[i].dataIndex);for(var i=0;i<r.length;i++){var a=r[i];t.addEdge(a.node1.id,a.node2.id,a.dataIndex)}return t},e}(),mX=function(){function e(e,t){this.inEdges=[],this.outEdges=[],this.edges=[],this.dataIndex=-1,this.id=e??``,this.dataIndex=t??-1}return e.prototype.degree=function(){return this.edges.length},e.prototype.inDegree=function(){return this.inEdges.length},e.prototype.outDegree=function(){return this.outEdges.length},e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostGraph.data.getItemModel(this.dataIndex).getModel(e)},e.prototype.getAdjacentDataIndices=function(){for(var e={edge:[],node:[]},t=0;t<this.edges.length;t++){var n=this.edges[t];n.dataIndex<0||(e.edge.push(n.dataIndex),e.node.push(n.node1.dataIndex,n.node2.dataIndex))}return e},e.prototype.getTrajectoryDataIndices=function(){for(var e=W(),t=W(),n=0,r=this.edges.length;n<r;n++){var i=this.edges[n];if(!(i.dataIndex<0)){e.set(i.dataIndex,!0);for(var a=[i.node1],o=[i.node2],s=0;s<a.length;){var c=a[s];s++,t.set(c.dataIndex,!0);for(var l=c.inEdges,u=0,d=l.length,f=void 0,p=void 0;u<d;u++)f=l[u],p=f.dataIndex,p>=0&&!e.hasKey(p)&&(e.set(p,!0),a.push(f.node1))}for(s=0;s<o.length;){var m=o[s];s++,t.set(m.dataIndex,!0);for(var h=m.outEdges,u=0,g=h.length,_=void 0,v=void 0;u<g;u++)_=h[u],v=_.dataIndex,v>=0&&!e.hasKey(v)&&(e.set(v,!0),o.push(_.node2))}}}return{edge:e.keys(),node:t.keys()}},e}(),hX=function(){function e(e,t,n){this.dataIndex=-1,this.node1=e,this.node2=t,this.dataIndex=n??-1}return e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostGraph.edgeData.getItemModel(this.dataIndex).getModel(e)},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var e=W(),t=W();e.set(this.dataIndex,!0);for(var n=[this.node1],r=[this.node2],i=0;i<n.length;){var a=n[i];i++,t.set(a.dataIndex,!0);for(var o=a.inEdges,s=0,c=o.length,l=void 0,u=void 0;s<c;s++)l=a.inEdges[s],u=l.dataIndex,u>=0&&!e.hasKey(u)&&(e.set(u,!0),n.push(l.node1))}for(i=0;i<r.length;){var d=r[i];i++,t.set(d.dataIndex,!0);for(var f=d.outEdges,s=0,c=f.length,p=void 0,m=void 0;s<c;s++)p=d.outEdges[s],m=p.dataIndex,m>=0&&!e.hasKey(m)&&(e.set(m,!0),r.push(p.node2))}return{edge:e.keys(),node:t.keys()}},e}(),Wa(mX,GE(`hostGraph`,`data`)),Wa(hX,GE(`hostGraph`,`edgeData`)),gX=lB.prototype,_X=fB.prototype,vX=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return e}(),(function(e){F(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(vX),yX=function(e){F(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-line`,n}return t.prototype.getDefaultStyle=function(){return{stroke:X.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new vX},t.prototype.buildPath=function(e,t){qE(t)?gX.buildPath.call(this,e,t):_X.buildPath.call(this,e,t)},t.prototype.pointAt=function(e){return qE(this.shape)?gX.pointAt.call(this,e):_X.pointAt.call(this,e)},t.prototype.tangentAt=function(e){var t=this.shape,n=qE(t)?[t.x2-t.x1,t.y2-t.y1]:_X.tangentAt.call(this,e);return es(n,n)},t}(lR),bX=[`fromSymbol`,`toSymbol`],xX=function(e){F(t,e);function t(t,n,r){var i=e.call(this)||this;return i._createLine(t,n,r),i}return t.prototype._createLine=function(e,t,n){var r=e.hostModel,i=e.getItemLayout(t),a=e.getItemVisual(t,`z2`),o=ZE(i);o.shape.percent=0,Cf(o,{z2:U(a,0),shape:{percent:1}},r,t),this.add(o),L(bX,function(n){var r=XE(n,e,t);this.add(r),this[JE(n)]=YE(n,e,t)},this),this._updateCommonStl(e,t,n)},t.prototype.updateData=function(e,t,n){var r=e.hostModel,i=this.childOfName(`line`),a=e.getItemLayout(t),o={shape:{}};QE(o.shape,a),Sf(i,o,r,t),L(bX,function(n){var r=YE(n,e,t),i=JE(n);if(this[i]!==r){this.remove(this.childOfName(n));var a=XE(n,e,t);this.add(a)}this[i]=r},this),this._updateCommonStl(e,t,n)},t.prototype.getLinePath=function(){return this.childAt(0)},t.prototype._updateCommonStl=function(e,t,n){var r=e.hostModel,i=this.childOfName(`line`),a=n&&n.emphasisLineStyle,o=n&&n.blurLineStyle,s=n&&n.selectLineStyle,c=n&&n.labelStatesModels,l=n&&n.emphasisDisabled,u=n&&n.focus,d=n&&n.blurScope;if(!n||e.hasItemOption){var f=e.getItemModel(t),p=f.getModel(`emphasis`);a=p.getModel(`lineStyle`).getLineStyle(),o=f.getModel([`blur`,`lineStyle`]).getLineStyle(),s=f.getModel([`select`,`lineStyle`]).getLineStyle(),l=p.get(`disabled`),u=p.get(`focus`),d=p.get(`blurScope`),c=gp(f)}var m=e.getItemVisual(t,`style`),h=m.stroke;i.useStyle(m),i.style.fill=null,i.style.strokeNoScale=!0,i.ensureState(`emphasis`).style=a,i.ensureState(`blur`).style=o,i.ensureState(`select`).style=s,L(bX,function(e){var t=this.childOfName(e);if(t){t.setColor(h),t.style.opacity=m.opacity;for(var n=0;n<gz.length;n++){var r=gz[n],a=i.getState(r);if(a){var o=a.style||{},s=t.ensureState(r),c=s.style||={};o.stroke!=null&&(c[t.__isEmptyBrush?`stroke`:`fill`]=o.stroke),o.opacity!=null&&(c.opacity=o.opacity)}}t.markRedraw()}},this);var g=r.getRawValue(t);hp(this,c,{labelDataIndex:t,labelFetcher:{getFormattedLabel:function(t,n){return r.getFormattedLabel(t,n,e.dataType)}},inheritColor:h||X.color.neutral99,defaultOpacity:m.opacity,defaultText:(g==null?e.getName(t):isFinite(g)?ql(g,10):g)+``});var _=this.getTextContent();if(_){var v=c.normal;_.__align=_.style.align,_.__verticalAlign=_.style.verticalAlign,_.__position=v.get(`position`)||`middle`;var y=v.get(`distance`);z(y)||(y=[y,y]),_.__labelDistance=y}this.setTextConfig({position:null,local:!0,inside:!1}),Kd(this,u,d,l)},t.prototype.highlight=function(){Dd(this)},t.prototype.downplay=function(){Od(this)},t.prototype.updateLayout=function(e,t){this.childOfName(`line`).stopAnimation(),this.setLinePoints(e.getItemLayout(t))},t.prototype.setLinePoints=function(e){var t=this.childOfName(`line`);QE(t.shape,e),t.dirty()},t.prototype.beforeUpdate=function(){var e=this,t=e.childOfName(`fromSymbol`),n=e.childOfName(`toSymbol`),r=e.getTextContent();if(!t&&!n&&(!r||r.ignore))return;for(var i=1,a=this.parent;a;)a.scaleX&&(i/=a.scaleX),a=a.parent;var o=e.childOfName(`line`);if(!this.__dirty&&!o.__dirty)return;var s=o.shape.percent,c=o.pointAt(0),l=o.pointAt(s),u=Xo([],l,c);es(u,u);function d(e,t){var n=e.__specifiedRotation;if(n==null){var r=o.tangentAt(t);e.attr(`rotation`,(t===1?-1:1)*Math.PI/2-Math.atan2(r[1],r[0]))}else e.attr(`rotation`,n)}if(t&&(t.setPosition(c),d(t,0),t.scaleX=t.scaleY=i*s,t.markRedraw()),n&&(n.setPosition(l),d(n,1),n.scaleX=n.scaleY=i*s,n.markRedraw()),r&&!r.ignore){r.x=r.y=0,r.originX=r.originY=0;var f=void 0,p=void 0,m=r.__labelDistance,h=m[0]*i,g=m[1]*i,_=s/2,v=o.tangentAt(_),y=[v[1],-v[0]],b=o.pointAt(_);y[1]>0&&(y[0]=-y[0],y[1]=-y[1]);var x=v[0]<0?-1:1;if(r.__position!==`start`&&r.__position!==`end`){var S=-Math.atan2(v[1],v[0]);l[0]<c[0]&&(S=Math.PI+S),r.rotation=S}var C=void 0;switch(r.__position){case`insideStartTop`:case`insideMiddleTop`:case`insideEndTop`:case`middle`:C=-g,p=`bottom`;break;case`insideStartBottom`:case`insideMiddleBottom`:case`insideEndBottom`:C=g,p=`top`;break;default:C=0,p=`middle`}switch(r.__position){case`end`:r.x=u[0]*h+l[0],r.y=u[1]*g+l[1],f=u[0]>.8?`left`:u[0]<-.8?`right`:`center`,p=u[1]>.8?`top`:u[1]<-.8?`bottom`:`middle`;break;case`start`:r.x=-u[0]*h+c[0],r.y=-u[1]*g+c[1],f=u[0]>.8?`right`:u[0]<-.8?`left`:`center`,p=u[1]>.8?`bottom`:u[1]<-.8?`top`:`middle`;break;case`insideStartTop`:case`insideStart`:case`insideStartBottom`:r.x=h*x+c[0],r.y=c[1]+C,f=v[0]<0?`right`:`left`,r.originX=-h*x,r.originY=-C;break;case`insideMiddleTop`:case`insideMiddle`:case`insideMiddleBottom`:case`middle`:r.x=b[0],r.y=b[1]+C,f=`center`,r.originY=-C;break;case`insideEndTop`:case`insideEnd`:case`insideEndBottom`:r.x=-h*x+l[0],r.y=l[1]+C,f=v[0]>=0?`right`:`left`,r.originX=h*x,r.originY=-C}r.scaleX=r.scaleY=i,r.setStyle({verticalAlign:r.__verticalAlign||p,align:r.__align||f})}},t}(Lz),SX=function(){function e(e){this.group=new Lz,this._LineCtor=e||xX}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,r=n.group,i=n._lineData;n._lineData=e,i||r.removeAll();var a=eD(e);e.diff(i).add(function(n){t._doAdd(e,n,a)}).update(function(n,r){t._doUpdate(i,e,r,n,a)}).remove(function(e){r.remove(i.getItemGraphicEl(e))}).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,n){t.updateLayout(e,n)},this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=eD(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){this._progressiveEls=[];function r(e){!e.isGroup&&!$E(e)&&(e.incremental=n,e.ensureState(`emphasis`).hoverLayer=2)}for(var i=e.start;i<e.end;i++)if(nD(t.getItemLayout(i))){var a=new this._LineCtor(t,i,this._seriesScope);a.traverse(r),this.group.add(a),t.setItemGraphicEl(i,a),this._progressiveEls.push(a)}},e.prototype.remove=function(){this.group.removeAll()},e.prototype.eachRendered=function(e){np(this._progressiveEls||this.group,e)},e.prototype._doAdd=function(e,t,n){if(nD(e.getItemLayout(t))){var r=new this._LineCtor(e,t,n);e.setItemGraphicEl(t,r),this.group.add(r)}},e.prototype._doUpdate=function(e,t,n,r,i){var a=e.getItemGraphicEl(n);nD(t.getItemLayout(r))?(a?a.updateData(t,r,i):a=new this._LineCtor(t,r,i),t.setItemGraphicEl(r,a),this.group.add(a)):this.group.remove(a)},e}(),CX=function(){function e(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return e}(),wX=function(e){F(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`pointer`,n}return t.prototype.getDefaultShape=function(){return new CX},t.prototype.buildPath=function(e,t){var n=Math.cos,r=Math.sin,i=t.r,a=t.width,o=t.angle,s=t.x-n(o)*a*(a>=i/3?1:2),c=t.y-r(o)*a*(a>=i/3?1:2);o=t.angle-Math.PI/2,e.moveTo(s,c),e.lineTo(t.x+n(o)*a,t.y+r(o)*a),e.lineTo(t.x+n(t.angle)*i,t.y+r(t.angle)*i),e.lineTo(t.x-n(o)*a,t.y-r(o)*a),e.lineTo(s,c)},t}(lR),TX=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){this.group.removeAll();var r=e.get([`axisLine`,`lineStyle`,`color`]),i=rD(e,n);this._renderMain(e,t,n,r,i),this._data=e.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(e,t,n,r,i){var a=this.group,o=e.get(`clockwise`),s=-e.get(`startAngle`)/180*Math.PI,c=-e.get(`endAngle`)/180*Math.PI,l=e.getModel(`axisLine`),u=l.get(`roundCap`)?$W:eB,d=l.get(`show`),f=l.getModel(`lineStyle`),p=f.get(`width`),m=[s,c];dl(m,!o),s=m[0],c=m[1];for(var h=c-s,g=s,_=[],v=0;d&&v<r.length;v++){var y=Math.min(Math.max(r[v][0],0),1);c=s+h*y;var b=new u({shape:{startAngle:g,endAngle:c,cx:i.cx,cy:i.cy,clockwise:o,r0:i.r-p,r:i.r},silent:!0});b.setStyle({fill:r[v][1]}),b.setStyle(f.getLineStyle([`color`,`width`])),_.push(b),g=c}_.reverse(),L(_,function(e){return a.add(e)});var x=function(e){if(e<=0)return r[0][1];for(var t=0;t<r.length;t++)if(r[t][0]>=e&&(t===0?0:r[t-1][0])<e)return r[t][1];return r[t-1][1]};this._renderTicks(e,t,n,x,i,s,c,o,p),this._renderTitleAndDetail(e,t,n,x,i),this._renderAnchor(e,i),this._renderPointer(e,t,n,x,i,s,c,o,p)},t.prototype._renderTicks=function(e,t,n,r,i,a,o,s,c){for(var l=this.group,u=i.cx,d=i.cy,f=i.r,p=+e.get(`min`),m=+e.get(`max`),h=e.getModel(`splitLine`),g=e.getModel(`axisTick`),_=e.getModel(`axisLabel`),v=e.get(`splitNumber`),y=g.get(`splitNumber`),b=Y(h.get(`length`),f),x=Y(g.get(`length`),f),S=a,C=(o-a)/v,w=C/y,T=h.getModel(`lineStyle`).getLineStyle(),E=g.getModel(`lineStyle`).getLineStyle(),D=h.get(`distance`),O,k,A=0;A<=v;A++){if(O=Math.cos(S),k=Math.sin(S),h.get(`show`)){var j=D?D+c:c,ee=new lB({shape:{x1:O*(f-j)+u,y1:k*(f-j)+d,x2:O*(f-b-j)+u,y2:k*(f-b-j)+d},style:T,silent:!0});T.stroke===`auto`&&ee.setStyle({stroke:r(A/v)}),l.add(ee)}if(_.get(`show`)){var j=_.get(`distance`)+D,te=iD(ql(A*(m-p)/v+p,14),_.get(`formatter`)),ne=r(A/v),re=O*(f-b-j)+u,ie=k*(f-b-j)+d,ae=_.get(`rotate`),M=0;ae===`radial`?(M=-S+2*Math.PI,M>Math.PI/2&&(M+=Math.PI)):ae===`tangential`?M=-S-Math.PI/2:$a(ae)&&(M=ae*Math.PI/180),M===0?l.add(new CR({style:_p(_,{text:te,x:re,y:ie,verticalAlign:k<-.8?`top`:k>.8?`bottom`:`middle`,align:O<-.4?`left`:O>.4?`right`:`center`},{inheritColor:ne}),silent:!0})):l.add(new CR({style:_p(_,{text:te,x:re,y:ie,verticalAlign:`middle`,align:`center`},{inheritColor:ne}),silent:!0,originX:re,originY:ie,rotation:M}))}if(g.get(`show`)&&A!==v){var j=g.get(`distance`);j=j?j+c:c;for(var oe=0;oe<=y;oe++){O=Math.cos(S),k=Math.sin(S);var se=new lB({shape:{x1:O*(f-j)+u,y1:k*(f-j)+d,x2:O*(f-x-j)+u,y2:k*(f-x-j)+d},silent:!0,style:E});E.stroke===`auto`&&se.setStyle({stroke:r((A+oe/y)/v)}),l.add(se),S+=w}S-=w}else S+=C}},t.prototype._renderPointer=function(e,t,n,r,i,a,o,s,c){var l=this.group,u=this._data,d=this._progressEls,f=[],p=e.get([`pointer`,`show`]),m=e.getModel(`progress`),h=m.get(`show`),g=e.getData(),_=g.mapDimension(`value`),v=+e.get(`min`),y=+e.get(`max`),b=[v,y],x=[a,o];function S(t,n){var r=g.getItemModel(t).getModel(`pointer`),a=Y(r.get(`width`),i.r),o=Y(r.get(`length`),i.r),s=e.get([`pointer`,`icon`]),c=r.get(`offsetCenter`),l=Y(c[0],i.r),u=Y(c[1],i.r),d=r.get(`keepAspect`),f=s?Ng(s,l-a/2,u-o,a,o,null,d):new wX({shape:{angle:-Math.PI/2,width:a,r:o,x:l,y:u}});return f.rotation=-(n+Math.PI/2),f.x=i.cx,f.y=i.cy,f}function C(e,t){var n=m.get(`roundCap`)?$W:eB,r=m.get(`overlap`),o=r?m.get(`width`):c/g.count(),l=r?i.r-o:i.r-(e+1)*o,u=r?i.r:i.r-e*o,d=new n({shape:{startAngle:a,endAngle:t,cx:i.cx,cy:i.cy,clockwise:s,r0:l,r:u}});return r&&(d.z2=Hl(g.get(_,e),[v,y],[100,0],!0)),d}(h||p)&&(g.diff(u).add(function(t){var n=g.get(_,t);if(p){var r=S(t,a);Cf(r,{rotation:-((isNaN(+n)?x[0]:Hl(n,b,x,!0))+Math.PI/2)},e),l.add(r),g.setItemGraphicEl(t,r)}if(h){var i=C(t,a);Cf(i,{shape:{endAngle:Hl(n,b,x,m.get(`clip`))}},e),l.add(i),$R(e.seriesIndex,g.dataType,t,i),f[t]=i}}).update(function(t,n){var r=g.get(_,t);if(p){var i=u.getItemGraphicEl(n),o=i?i.rotation:a,s=S(t,o);s.rotation=o,Sf(s,{rotation:-((isNaN(+r)?x[0]:Hl(r,b,x,!0))+Math.PI/2)},e),l.add(s),g.setItemGraphicEl(t,s)}if(h){var c=d[n],v=C(t,c?c.shape.endAngle:a);Sf(v,{shape:{endAngle:Hl(r,b,x,m.get(`clip`))}},e),l.add(v),$R(e.seriesIndex,g.dataType,t,v),f[t]=v}}).execute(),g.each(function(e){var t=g.getItemModel(e),n=t.getModel(`emphasis`),i=n.get(`focus`),a=n.get(`blurScope`),o=n.get(`disabled`),s=r(Hl(g.get(_,e),b,[0,1],!0));if(p){var c=g.getItemGraphicEl(e),l=g.getItemVisual(e,`style`),u=l.fill;if(c instanceof mR){var d=c.style;c.useStyle(I({image:d.image,x:d.x,y:d.y,width:d.width,height:d.height},l))}else c.useStyle(l),c.type!==`pointer`&&c.setColor(u);c.setStyle(t.getModel([`pointer`,`itemStyle`]).getItemStyle()),c.style.fill===`auto`&&c.setStyle(`fill`,s),c.z2EmphasisLift=0,Jd(c,t),Kd(c,i,a,o)}if(h){var m=f[e];m.useStyle(g.getItemVisual(e,`style`)),m.setStyle(t.getModel([`progress`,`itemStyle`]).getItemStyle()),m.style.fill===`auto`&&m.setStyle(`fill`,s),m.z2EmphasisLift=0,Jd(m,t),Kd(m,i,a,o)}}),this._progressEls=f)},t.prototype._renderAnchor=function(e,t){var n=e.getModel(`anchor`);if(n.get(`show`)){var r=n.get(`size`),i=n.get(`icon`),a=n.get(`offsetCenter`),o=n.get(`keepAspect`),s=Ng(i,t.cx-r/2+Y(a[0],t.r),t.cy-r/2+Y(a[1],t.r),r,r,null,o);s.z2=+!!n.get(`showAbove`),s.setStyle(n.getModel(`itemStyle`).getItemStyle()),this.group.add(s)}},t.prototype._renderTitleAndDetail=function(e,t,n,r,i){var a=this,o=e.getData(),s=o.mapDimension(`value`),c=+e.get(`min`),l=+e.get(`max`),u=new Lz,d=[],f=[],p=e.isAnimationEnabled(),m=e.get([`pointer`,`showAbove`]);o.diff(this._data).add(function(e){d[e]=new CR({silent:!0}),f[e]=new CR({silent:!0})}).update(function(e,t){d[e]=a._titleEls[t],f[e]=a._detailEls[t]}).execute(),o.each(function(t){var n=o.getItemModel(t),a=o.get(s,t),h=new Lz,g=r(Hl(a,[c,l],[0,1],!0)),_=n.getModel(`title`);if(_.get(`show`)){var v=_.get(`offsetCenter`),y=i.cx+Y(v[0],i.r),b=i.cy+Y(v[1],i.r),x=d[t];x.attr({z2:m?0:2,style:_p(_,{x:y,y:b,text:o.getName(t),align:`center`,verticalAlign:`middle`},{inheritColor:g})}),h.add(x)}var S=n.getModel(`detail`);if(S.get(`show`)){var C=S.get(`offsetCenter`),w=i.cx+Y(C[0],i.r),T=i.cy+Y(C[1],i.r),E=Y(S.get(`width`),i.r),D=Y(S.get(`height`),i.r),O=e.get([`progress`,`show`])?o.getItemVisual(t,`style`).fill:g,x=f[t],k=S.get(`formatter`);x.attr({z2:m?0:2,style:_p(S,{x:w,y:T,text:iD(a,k),width:isNaN(E)?null:E,height:isNaN(D)?null:D,align:`center`,verticalAlign:`middle`},{inheritColor:O})}),Cp(x,{normal:S},a,function(e){return iD(e,k)}),p&&wp(x,t,o,e,{getFormattedLabel:function(e,t,n,r,i,o){return iD(o?o.interpolatedValue:a,k)}}),h.add(x)}u.add(h)}),this.group.add(u),this._titleEls=d,this._detailEls=f},t.type=`gauge`,t}(CU),EX=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.visualStyleAccessPath=`itemStyle`,n}return t.prototype.getInitialData=function(e,t){return ex(this,[`value`])},t.type=`series.gauge`,t.defaultOption={z:2,colorBy:`data`,center:[`50%`,`50%`],legendHoverLink:!0,radius:`75%`,startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,X.color.neutral10]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:X.color.axisTick,width:3,type:`solid`}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:X.color.axisTickMinor,width:1,type:`solid`}},axisLabel:{show:!0,distance:15,color:X.color.axisLabel,fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:`60%`,width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:`circle`,offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:X.color.neutral00,borderWidth:0,borderColor:X.color.theme[0]}},title:{show:!0,offsetCenter:[0,`20%`],color:X.color.secondary,fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:X.color.transparent,borderWidth:0,borderColor:X.color.neutral40,width:100,height:null,padding:[5,10],offsetCenter:[0,`40%`],color:X.color.primary,fontSize:30,fontWeight:`bold`,lineHeight:30,valueAnimation:!1}},t}(iU),DX=`funnel`,OX=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new fG(q(this.getData,this),q(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.getInitialData=function(e,t){return ex(this,{coordDimensions:[`value`],encodeDefaulter:Za(kp,this)})},t.prototype._defaultLabelLine=function(e){vu(e,`labelLine`,[`show`]);var t=e.labelLine,n=e.emphasis.labelLine;t.show=t.show&&e.label.show,n.show=n.show&&e.emphasis.label.show},t.prototype.getDataParams=function(t){var n=this.getData(),r=e.prototype.getDataParams.call(this,t),i=n.mapDimension(`value`),a=n.getSum(i);return r.percent=a?+(n.get(i,t)/a*100).toFixed(2):0,r.$vars.push(`percent`),r},t.type=`series.`+DX,t.defaultOption={coordinateSystemUsage:`box`,z:2,legendHoverLink:!0,colorBy:`data`,left:80,top:60,right:80,bottom:65,minSize:`0%`,maxSize:`100%`,sort:`descending`,orient:`vertical`,gap:0,funnelAlign:`center`,label:{show:!0,position:`outer`},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:X.color.neutral00,borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:X.color.primary}}},t}(iU),kX=[`itemStyle`,`opacity`],AX=function(e){F(t,e);function t(t,n){var r=e.call(this)||this,i=r,a=new oB,o=new CR;return i.setTextContent(o),r.setTextGuideLine(a),r.updateData(t,n,!0),r}return t.prototype.updateData=function(e,t,n){var r=this,i=e.hostModel,a=e.getItemModel(t),o=e.getItemLayout(t),s=a.getModel(`emphasis`),c=a.get(kX);c??=1,n||Of(r),r.useStyle(e.getItemVisual(t,`style`)),r.style.lineJoin=`round`,n?(r.setShape({points:o.points}),r.style.opacity=0,Cf(r,{style:{opacity:c}},i,t)):Sf(r,{style:{opacity:c},shape:{points:o.points}},i,t),Jd(r,a),this._updateLabel(e,t),Kd(this,s.get(`focus`),s.get(`blurScope`),s.get(`disabled`))},t.prototype._updateLabel=function(e,t){var n=this,r=this.getTextGuideLine(),i=n.getTextContent(),a=e.hostModel,o=e.getItemModel(t),s=e.getItemLayout(t).label,c=e.getItemVisual(t,`style`),l=c.fill;hp(i,gp(o),{labelFetcher:e.hostModel,labelDataIndex:t,defaultOpacity:c.opacity,defaultText:e.getName(t)},{normal:{align:s.textAlign,verticalAlign:s.verticalAlign}});var u=o.getModel(`label`).get(`color`)===`inherit`?l:null;n.setTextConfig({local:!0,inside:!!s.inside,insideStroke:u,outsideFill:u});var d=s.linePoints;r.setShape({points:d}),n.textGuideLineConfig={anchor:d?new zF(d[0][0],d[0][1]):null},Sf(i,{style:{x:s.x,y:s.y}},a,t),i.attr({rotation:s.rotation,originX:s.x,originY:s.y,z2:10}),fx(n,px(o),{stroke:l})},t}(iB),jX=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=DX,t.ignoreLabelLineUpdate=!0,t}return t.prototype.render=function(e,t,n){var r=e.getData(),i=this._data,a=this.group;r.diff(i).add(function(e){var t=new AX(r,e);r.setItemGraphicEl(e,t),a.add(t)}).update(function(e,t){var n=i.getItemGraphicEl(t);n.updateData(r,e),a.add(n),r.setItemGraphicEl(e,n)}).remove(function(t){Df(i.getItemGraphicEl(t),e,t)}).execute(),this._data=r},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type=DX,t}(CU),MX=ad(DX,cD),NX=`sankey`,PX=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){var n=e.edges||e.links||[],r=e.data||e.nodes||[],i=e.levels||[];this.levelModels=[];for(var a=this.levelModels,o=0;o<i.length;o++)i[o].depth!=null&&i[o].depth>=0&&(a[i[o].depth]=new rV(i[o],this,t));return KE(r,n,this,!0,s).data;function s(e,t){e.wrapMethod(`getItemModel`,function(e,t){var n=e.parentModel,r=n.getData().getItemLayout(t);if(r){var i=r.depth,a=n.levelModels[i];a&&(e.parentModel=a)}return e}),t.wrapMethod(`getItemModel`,function(e,t){var n=e.parentModel,r=n.getGraph().getEdgeByIndex(t).node1.getLayout();if(r){var i=r.depth,a=n.levelModels[i];a&&(e.parentModel=a)}return e})}},t.prototype.setNodePosition=function(e,t){var n=(this.option.data||this.option.nodes)[e];n.localX=t[0],n.localY=t[1]},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(e,t,n){function r(e){return isNaN(e)||e==null}if(n===`edge`){var i=this.getDataParams(e,n),a=i.data,o=i.value;return og(`nameValue`,{name:a.source+` -- `+a.target,value:o,noValue:r(o)})}var s=this.getGraph().getNodeByIndex(e).getLayout().value,c=this.getDataParams(e,n).data.name;return og(`nameValue`,{name:c==null?null:c+``,value:s,noValue:r(s)})},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(t,n){var r=e.prototype.getDataParams.call(this,t,n);return r.value==null&&n===`node`&&(r.value=this.getGraph().getNodeByIndex(t).getLayout().value),r},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type=`series.`+NX,t.layoutMode=`box`,t.defaultOption={z:2,coordinateSystemUsage:`box`,left:`5%`,top:`5%`,right:`20%`,bottom:`5%`,orient:`horizontal`,nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:`global`,center:null,zoom:1,label:{show:!0,position:`right`,fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:`justify`,lineStyle:{color:X.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:X.color.primary}},animationEasing:`linear`,animationDuration:1e3},t}(iU),FX=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return e}(),IX=function(e){F(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new FX},t.prototype.buildPath=function(e,t){var n=t.extent;e.moveTo(t.x1,t.y1),e.bezierCurveTo(t.cpx1,t.cpy1,t.cpx2,t.cpy2,t.x2,t.y2),t.orient===`vertical`?(e.lineTo(t.x2+n,t.y2),e.bezierCurveTo(t.cpx2+n,t.cpy2,t.cpx1+n,t.cpy1,t.x1+n,t.y1)):(e.lineTo(t.x2,t.y2+n),e.bezierCurveTo(t.cpx2,t.cpy2+n,t.cpx1,t.cpy1+n,t.x1,t.y1+n)),e.closePath()},t.prototype.highlight=function(){Dd(this)},t.prototype.downplay=function(){Od(this)},t}(lR),LX=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=NX,t._mainGroup=new Lz,t}return t.prototype.init=function(e,t){this._controller=new pY(t.getZr()),this.group.add(this._mainGroup),this._firstRender=!0},t.prototype.render=function(e,t,n){var r=e.getGraph(),i=this._mainGroup,a=e.layoutInfo,o=a.width,s=a.height,c=e.getData(),l=e.getData(`edge`),u=e.get(`orient`);i.removeAll(),i.x=a.x,i.y=a.y,this._updateViewCoordSys(e,n),IT(e,n,this._controller,LT(i),null),r.eachEdge(function(t){var n=new IX,r=QR(n);r.dataIndex=t.dataIndex,r.seriesIndex=e.seriesIndex,r.dataType=`edge`;var a=t.getModel(),c=a.getModel(`lineStyle`),d=c.get(`curveness`),f=t.node1.getLayout(),p=t.node1.getModel(),m=p.get(`localX`),h=p.get(`localY`),g=t.node2.getLayout(),_=t.node2.getModel(),v=_.get(`localX`),y=_.get(`localY`),b=t.getLayout(),x,S,C,w,T,E,D,O;n.shape.extent=Math.max(1,b.dy),n.shape.orient=u,u===`vertical`?(x=(m==null?f.x:m*o)+b.sy,S=(h==null?f.y:h*s)+f.dy,C=(v==null?g.x:v*o)+b.ty,w=y==null?g.y:y*s,T=x,E=S*(1-d)+w*d,D=C,O=S*d+w*(1-d)):(x=(m==null?f.x:m*o)+f.dx,S=(h==null?f.y:h*s)+b.sy,C=v==null?g.x:v*o,w=(y==null?g.y:y*s)+b.ty,T=x*(1-d)+C*d,E=S,D=x*d+C*(1-d),O=w),n.setShape({x1:x,y1:S,x2:C,y2:w,cpx1:T,cpy1:E,cpx2:D,cpy2:O}),n.useStyle(c.getItemStyle()),mD(n.style,u,t);var k=``+a.get(`value`),A=gp(a,`edgeLabel`);hp(n,A,{labelFetcher:{getFormattedLabel:function(t,n,r,i,a,o){return e.getFormattedLabel(t,n,`edge`,i,so(a,A.normal&&A.normal.get(`formatter`),k),o)}},labelDataIndex:t.dataIndex,defaultText:k}),n.setTextConfig({position:`inside`});var j=a.getModel(`emphasis`);Jd(n,a,`lineStyle`,function(e){var n=e.getItemStyle();return mD(n,u,t),n}),i.add(n),l.setItemGraphicEl(t.dataIndex,n);var ee=j.get(`focus`);Kd(n,ee===`adjacency`?t.getAdjacentDataIndices():ee===`trajectory`?t.getTrajectoryDataIndices():ee,j.get(`blurScope`),j.get(`disabled`))}),r.eachNode(function(t){var n=t.getLayout(),r=t.getModel(),a=r.get(`localX`),l=r.get(`localY`),u=r.getModel(`emphasis`),d=r.get([`itemStyle`,`borderRadius`])||0,f=new vR({shape:{x:a==null?n.x:a*o,y:l==null?n.y:l*s,width:n.dx,height:n.dy,r:d},style:r.getModel(`itemStyle`).getItemStyle(),z2:10});hp(f,gp(r),{labelFetcher:{getFormattedLabel:function(t,n){return e.getFormattedLabel(t,n,`node`)}},labelDataIndex:t.dataIndex,defaultText:t.id}),f.disableLabelAnimation=!0,f.setStyle(`fill`,t.getVisual(`color`)),f.setStyle(`decal`,t.getVisual(`style`).decal),Jd(f,r),i.add(f),c.setItemGraphicEl(t.dataIndex,f),QR(f).dataType=`node`;var p=u.get(`focus`);Kd(f,p===`adjacency`?t.getAdjacentDataIndices():p===`trajectory`?t.getTrajectoryDataIndices():p,u.get(`blurScope`),u.get(`disabled`))}),c.eachItemGraphicEl(function(t,r){c.getItemModel(r).get(`draggable`)&&(t.drift=function(t,i){this.shape.x+=t,this.shape.y+=i,this.dirty(),n.dispatchAction({type:`dragNode`,seriesId:e.id,dataIndex:c.getRawIndex(r),localX:this.shape.x/o,localY:this.shape.y/s})},t.draggable=!0,t.cursor=`move`)}),!this._data&&e.isAnimationEnabled()&&i.setClipPath(hD(i.getBoundingRect(),e,function(){i.removeClipPath()})),this._data=e.getData(),this._firstRender=!1},t.prototype.__updateOnOwnRoam=function(e,t,n){ST(this.group,2,t.coordinateSystem,null)},t.prototype.dispose=function(){this._controller&&this._controller.dispose()},t.prototype._updateViewCoordSys=function(e,t){var n=e.layoutInfo,r=e.coordinateSystem=BT(e,t,n.x,n.y,n.width,n.height);ST(this.group,2,r,this._firstRender?null:e)},t.type=NX,t}(CU),RX=ad(NX,gD),zX=ad(NX,RD),BX=256,VX=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=oF.createCanvas();this.canvas=e}return e.prototype.update=function(e,t,n,r,i,a){var o=this._getBrush(),s=this._getGradient(i,`inRange`),c=this._getGradient(i,`outOfRange`),l=this.pointSize+this.blurSize,u=this.canvas,d=u.getContext(`2d`),f=e.length;u.width=t,u.height=n;for(var p=0;p<f;++p){var m=e[p],h=m[0],g=m[1],_=m[2],v=r(_);d.globalAlpha=v,d.drawImage(o,h-l,g-l)}if(!u.width||!u.height)return u;for(var y=d.getImageData(0,0,u.width,u.height),b=y.data,x=0,S=b.length,C=this.minOpacity,w=this.maxOpacity-C;x<S;){var v=b[x+3]/256,T=Math.floor(v*(BX-1))*4;if(v>0){var E=a(v)?s:c;v>0&&(v=v*w+C),b[x++]=E[T],b[x++]=E[T+1],b[x++]=E[T+2],b[x++]=E[T+3]*v*256}else x+=4}return d.putImageData(y,0,0),u},e.prototype._getBrush=function(){var e=this._brushCanvas||=oF.createCanvas(),t=this.pointSize+this.blurSize,n=t*2;e.width=n,e.height=n;var r=e.getContext(`2d`);return r.clearRect(0,0,n,n),r.shadowOffsetX=n,r.shadowBlur=this.blurSize,r.shadowColor=X.color.neutral99,r.beginPath(),r.arc(-t,t,this.pointSize,0,Math.PI*2,!0),r.closePath(),r.fill(),e},e.prototype._getGradient=function(e,t){for(var n=this._gradientPixels,r=n[t]||(n[t]=new Uint8ClampedArray(1024)),i=[0,0,0,0],a=0,o=0;o<256;o++)e[t](o/255,!0,i),r[a++]=i[0],r[a++]=i[1],r[a++]=i[2],r[a++]=i[3];return r},e}(),HX=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r;t.eachComponent(`visualMap`,function(t){t.eachTargetSeries(function(n){n===e&&(r=t)})}),this._progressiveEls=null,this.group.removeAll();var i=e.coordinateSystem;i.type===`cartesian2d`||i.type===`calendar`||i.type===`matrix`?this._renderOnGridLike(e,n,0,e.getData().count()):c_(i)&&this._renderOnGeo(i,e,r,n)},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll()},t.prototype.incrementalRender=function(e,t,n,r){var i=t.coordinateSystem;i&&(c_(i)?this.render(t,n,r):(this._progressiveEls=[],this._renderOnGridLike(t,r,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){np(this._progressiveEls||this.group,e)},t.prototype._renderOnGridLike=function(e,t,n,r,i){var a=e.coordinateSystem,o=s_(a,`cartesian2d`),s=s_(a,`matrix`),c,l,u,d;if(o){var f=a.getAxis(`x`),p=a.getAxis(`y`);c=sy(f).w+.5,l=sy(p).w+.5,u=f.scale.getExtent(),d=p.scale.getExtent()}for(var m=this.group,h=e.getData(),g=e.getModel([`emphasis`,`itemStyle`]).getItemStyle(),_=e.getModel([`blur`,`itemStyle`]).getItemStyle(),v=e.getModel([`select`,`itemStyle`]).getItemStyle(),y=e.get([`itemStyle`,`borderRadius`]),b=gp(e),x=e.getModel(`emphasis`),S=x.get(`focus`),C=x.get(`blurScope`),w=x.get(`disabled`),T=o||s?[h.mapDimension(`x`),h.mapDimension(`y`),h.mapDimension(`value`)]:[h.mapDimension(`time`),h.mapDimension(`value`)],E=n;E<r;E++){var D=void 0,O=h.getItemVisual(E,`style`);if(o){var k=h.get(T[0],E),A=h.get(T[1],E);if(isNaN(h.get(T[2],E))||isNaN(k)||isNaN(A)||k<u[0]||k>u[1]||A<d[0]||A>d[1])continue;var j=a.dataToPoint([k,A]);D=new vR({shape:{x:j[0]-c/2,y:j[1]-l/2,width:c,height:l},style:O})}else if(s){var ee=a.dataToLayout([h.get(T[0],E),h.get(T[1],E)]).rect;if(ao(ee.x))continue;D=new vR({z2:1,shape:ee,style:O})}else{if(isNaN(h.get(T[1],E)))continue;var te=a.dataToLayout([h.get(T[0],E)]),ee=te.contentRect||te.rect;if(ao(ee.x)||ao(ee.y))continue;D=new vR({z2:1,shape:ee,style:O})}if(h.hasItemOption){var ne=h.getItemModel(E),re=ne.getModel(`emphasis`);g=re.getModel(`itemStyle`).getItemStyle(),_=ne.getModel([`blur`,`itemStyle`]).getItemStyle(),v=ne.getModel([`select`,`itemStyle`]).getItemStyle(),y=ne.get([`itemStyle`,`borderRadius`]),S=re.get(`focus`),C=re.get(`blurScope`),w=re.get(`disabled`),b=gp(ne)}D.shape.r=y;var ie=e.getRawValue(E),ae=`-`;ie&&ie[2]!=null&&(ae=ie[2]+``),hp(D,b,{labelFetcher:e,labelDataIndex:E,defaultOpacity:O.opacity,defaultText:ae}),D.ensureState(`emphasis`).style=g,D.ensureState(`blur`).style=_,D.ensureState(`select`).style=v,Kd(D,S,C,w),D.incremental=rd(e,i),i&&(D.states.emphasis.hoverLayer=2),m.add(D),h.setItemGraphicEl(E,D),this._progressiveEls&&this._progressiveEls.push(D)}},t.prototype._renderOnGeo=function(e,t,n,r){var i=n.targetVisuals.inRange,a=n.targetVisuals.outOfRange,o=t.getData(),s=this._hmLayer||this._hmLayer||new VX;s.blurSize=t.get(`blurSize`),s.pointSize=t.get(`pointSize`),s.minOpacity=t.get(`minOpacity`),s.maxOpacity=t.get(`maxOpacity`);var c=e.getViewRect().clone(),l=e.getRoamTransform();c.applyTransform(l);var u=Math.max(c.x,0),d=Math.max(c.y,0),f=Math.min(c.width+c.x,r.getWidth()),p=Math.min(c.height+c.y,r.getHeight()),m=f-u,h=p-d,g=[o.mapDimension(`lng`),o.mapDimension(`lat`),o.mapDimension(`value`)],_=o.mapArray(g,function(t,n,r){var i=e.dataToPoint([t,n]);return i[0]-=u,i[1]-=d,i.push(r),i}),v=n.getExtent(),y=n.type===`visualMap.continuous`?VD(v,n.option.range):BD(v,n.getPieceList(),n.option.selected);s.update(_,m,h,i.color.getNormalizer(),{inRange:i.color.getColorMapper(),outOfRange:a.color.getColorMapper()},y);var b=new mR({style:{width:m,height:h,x:u,y:d,image:s.canvas},silent:!0});this.group.add(b)},t.type=`heatmap`,t}(CU),UX=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){return Tm(null,this,{generateCoord:`value`})},t.prototype.preventIncremental=function(){var e=$V.get(this.get(`coordinateSystem`));if(e&&e.dimensions)return e.dimensions[0]===`lng`&&e.dimensions[1]===`lat`},t.type=`series.heatmap`,t.dependencies=[`grid`,`geo`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:X.color.primary}}},t}(iU),WX={position:[`x`,`y`],scale:[`scaleX`,`scaleY`],origin:[`originX`,`originY`]},GX=Ya(WX),Ka(EI,function(e,t){return e[t]=1,e},{}),EI.join(`, `),KX=[``,`style`,`shape`,`extra`],qX=Iu(),JX={},YX={setTransform:function(e,t){return JX.el[e]=t,this},getTransform:function(e){return JX.el[e]},setShape:function(e,t){var n=JX.el,r=n.shape||={};return r[e]=t,n.dirtyShape&&n.dirtyShape(),this},getShape:function(e){var t=JX.el.shape;if(t)return t[e]},setStyle:function(e,t){var n=JX.el,r=n.style;return r&&(r[e]=t,n.dirtyStyle&&n.dirtyStyle()),this},getStyle:function(e){var t=JX.el.style;if(t)return t[e]},setExtra:function(e,t){var n=JX.el.extra||(JX.el.extra={});return n[e]=t,this},getExtra:function(e){var t=JX.el.extra;if(t)return t[e]}},XX=Iu(),ZX=[`percent`,`easing`,`shape`,`style`,`extra`],QX=Iu(),$X=Ra,eZ=q,tZ=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,r){var i=t.get(`value`),a=t.get(`status`);if(this._axisModel=e,this._axisPointerModel=t,this._api=n,r||this._lastValue!==i||this._lastStatus!==a){this._lastValue=i,this._lastStatus=a;var o=this._group,s=this._handle;if(!a||a===`hide`)o&&o.hide(),s&&s.hide();else{o&&o.show(),s&&s.show();var c={};this.makeElOption(c,i,e,t,n);var l=c.graphicKey;l!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=l;var u=this._moveAnimation=this.determineAnimation(e,t);if(!o)o=this._group=new Lz,this.createPointerEl(o,c,e,t),this.createLabelEl(o,c,e,t),n.getZr().add(o);else{var d=Za(oO,t,u);this.updatePointerEl(o,c,d),this.updateLabelEl(o,c,d,t)}uO(o,t,!0),this._renderHandle(i)}}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get(`animation`),r=e.axis,i=r.type===`category`,a=t.get(`snap`);if(!a&&!i)return!1;if(n===`auto`||n==null){var o=this.animationThreshold;if(i&&sy(r).w>o)return!0;if(a){var s=Bw(e).seriesDataCount,c=r.getExtent();return Math.abs(c[0]-c[1])/s>o}return!1}return n===!0},e.prototype.makeElOption=function(e,t,n,r,i){},e.prototype.createPointerEl=function(e,t,n,r){var i=t.pointer;if(i){var a=QX(e).pointerEl=new jB[i.type]($X(t.pointer));e.add(a)}},e.prototype.createLabelEl=function(e,t,n,r){if(t.label){var i=QX(e).labelEl=new CR($X(t.label));e.add(i),cO(i,r)}},e.prototype.updatePointerEl=function(e,t,n){var r=QX(e).pointerEl;r&&t.pointer&&(r.setStyle(t.pointer.style),n(r,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,r){var i=QX(e).labelEl;i&&(i.setStyle(t.label.style),n(i,{x:t.label.x,y:t.label.y}),cO(i,r))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t=this._axisPointerModel,n=this._api.getZr(),r=this._handle,i=t.getModel(`handle`),a=t.get(`status`);if(!i.get(`show`)||!a||a===`hide`)r&&n.remove(r),this._handle=null;else{var o;this._handle||(o=!0,r=this._handle=qf(i.get(`icon`),{cursor:`move`,draggable:!0,onmousemove:function(e){BG(e.event)},onmousedown:eZ(this._onHandleDragMove,this,0,0),drift:eZ(this._onHandleDragMove,this),ondragend:eZ(this._onHandleDragEnd,this)}),n.add(r)),uO(r,t,!1),r.setStyle(i.getItemStyle(null,[`color`,`borderColor`,`borderWidth`,`opacity`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`]));var s=i.get(`size`);z(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,kb(this,`_doDispatchAxisPointer`,i.get(`throttle`)||0,`fixRate`),this._moveHandleToValue(e,o)}}},e.prototype._moveHandleToValue=function(e,t){oO(this._axisPointerModel,!t&&this._moveAnimation,this._handle,lO(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var r=this.updateHandleTransform(lO(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=r,n.stopAnimation(),n.attr(lO(r)),QX(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:`updateAxisPointer`,x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get(`value`);this._moveHandleToValue(e),this._api.dispatchAction({type:`hideTip`})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,r=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),r&&t.remove(r),this._group=null,this._handle=null,this._payloadInfo=null),Ab(this,`_doDispatchAxisPointer`)},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}},e}(),nZ=function(e){F(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(e,t,n,r,i){var a=n.axis,o=a.grid,s=r.get(`type`),c=a.getGlobalExtent(),l=xO(o,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(t,!0));if(s&&s!==`none`){var d=dO(r),f=rZ[s](a,u,c,l,r.get(`seriesDataIndices`),r.ecModel);f.style=d,e.graphicKey=f.type,e.pointer=f}gO(t,e,qy(o.getRect(),n),n,r,i)},t.prototype.getHandleTransform=function(e,t,n){var r=qy(t.axis.grid.getRect(),t,{labelInside:!1});r.labelMargin=n.get([`handle`,`margin`]);var i=hO(t.axis,e,r);return{x:i[0],y:i[1],rotation:r.rotation+(r.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,r){var i=n.axis,a=i.grid,o=i.getGlobalExtent(!0),s=xO(a,i).getOtherAxis(i).getGlobalExtent(),c=i.dim===`x`?0:1,l=[e.x,e.y];l[c]+=t[c],l[c]=kR(o[1],l[c]),l[c]=AR(o[0],l[c]);var u=(s[1]+s[0])/2,d=[u,u];return d[c]=l[c],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:`middle`},{align:`center`}][c]}},t}(tZ),rZ={line:function(e,t,n,r){return{type:`Line`,subPixelOptimize:!0,shape:_O([t,r[0]],[t,r[1]],SO(e))}},shadow:function(e,t,n,r,i,a){var o=yO(e,i,a),s=r[1]-r[0],c=bO(t,n,o),l=c[0],u=c[1];return{type:`Rect`,shape:vO([l,r[0]],[u-l,s],SO(e))}}},iZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`axisPointer`,t.defaultOption={show:`auto`,z:50,type:`line`,snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:X.color.border,width:1,type:`dashed`},shadowStyle:{color:X.color.shadowTint},label:{show:!0,formatter:null,precision:`auto`,margin:3,color:X.color.neutral00,padding:[5,7,5,7],backgroundColor:X.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:`M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z`,size:45,margin:50,color:X.color.accent40,throttle:40}},t}(BH),aZ=Iu(),oZ=L,sZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=t.getComponent(`tooltip`),i=e.get(`triggerOn`)||r&&r.get(`triggerOn`)||`mousemove|click|mousewheel`;CO(`axisPointer`,n,function(e,t,n){i!==`none`&&(e===`leave`||i.indexOf(e)>=0)&&n({type:`updateAxisPointer`,currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})})},t.prototype.remove=function(e,t){kO(`axisPointer`,t)},t.prototype.dispose=function(e,t){kO(`axisPointer`,t)},t.type=`axisPointer`,t}(IK),cZ=Iu(),lZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(t,n,r){var i=Rh(t);e.prototype.init.apply(this,arguments),WO(t,i)},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),WO(this.option,t)},t.prototype.getCellSize=function(){return this.option.cellSize},t.type=`calendar`,t.layoutMode=`box`,t.defaultOption={z:2,left:80,top:60,cellSize:20,orient:`horizontal`,splitLine:{show:!0,lineStyle:{color:X.color.axisLine,width:1,type:`solid`}},itemStyle:{color:X.color.neutral00,borderWidth:1,borderColor:X.color.neutral10},dayLabel:{show:!0,firstDay:0,position:`start`,margin:X.size.s,color:X.color.secondary},monthLabel:{show:!0,position:`start`,margin:X.size.s,align:`center`,formatter:null,color:X.color.secondary},yearLabel:{show:!0,position:null,margin:X.size.xl,formatter:null,color:X.color.quaternary,fontFamily:`sans-serif`,fontWeight:`bolder`,fontSize:20}},t}(BH),uZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=this.group;r.removeAll();var i=e.coordinateSystem,a=i.getRangeInfo(),o=i.getOrient(),s=t.getLocaleModel();this._renderDayRect(e,a,r),this._renderLines(e,a,o,r),this._renderYearText(e,a,o,r),this._renderMonthText(e,s,o,r),this._renderWeekText(e,s,a,o,r)},t.prototype._renderDayRect=function(e,t,n){for(var r=e.coordinateSystem,i=e.getModel(`itemStyle`).getItemStyle(),a=r.getCellWidth(),o=r.getCellHeight(),s=t.start.time;s<=t.end.time;s=r.getNextNDay(s,1).time){var c=r.dataToCalendarLayout([s],!1).tl,l=new vR({shape:{x:c[0],y:c[1],width:a,height:o},cursor:`default`,style:i});n.add(l)}},t.prototype._renderLines=function(e,t,n,r){var i=this,a=e.coordinateSystem,o=e.getModel([`splitLine`,`lineStyle`]).getLineStyle(),s=e.get([`splitLine`,`show`]),c=o.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var l=t.start,u=0;l.time<=t.end.time;u++){f(l.formatedDate),u===0&&(l=a.getDateInfo(t.start.y+`-`+t.start.m));var d=l.date;d.setMonth(d.getMonth()+1),l=a.getDateInfo(d)}f(a.getNextNDay(t.end.time,1).formatedDate);function f(t){i._firstDayOfMonth.push(a.getDateInfo(t)),i._firstDayPoints.push(a.dataToCalendarLayout([t],!1).tl);var c=i._getLinePointsOfOneWeek(e,t,n);i._tlpoints.push(c[0]),i._blpoints.push(c[c.length-1]),s&&i._drawSplitline(c,o,r)}s&&this._drawSplitline(i._getEdgesPoints(i._tlpoints,c,n),o,r),s&&this._drawSplitline(i._getEdgesPoints(i._blpoints,c,n),o,r)},t.prototype._getEdgesPoints=function(e,t,n){var r=[e[0].slice(),e[e.length-1].slice()],i=n===`horizontal`?0:1;return r[0][i]=r[0][i]-t/2,r[1][i]=r[1][i]+t/2,r},t.prototype._drawSplitline=function(e,t,n){var r=new oB({z2:20,shape:{points:e},style:t});n.add(r)},t.prototype._getLinePointsOfOneWeek=function(e,t,n){for(var r=e.coordinateSystem,i=r.getDateInfo(t),a=[],o=0;o<7;o++){var s=r.getNextNDay(i.time,o),c=r.dataToCalendarLayout([s.time],!1);a[2*s.day]=c.tl,a[2*s.day+1]=c[n===`horizontal`?`bl`:`tr`]}return a},t.prototype._formatterLabel=function(e,t){return V(e)&&e?wh(e,t):B(e)?e(t):t.nameMap},t.prototype._yearTextPositionControl=function(e,t,n,r,i){var a=t[0],o=t[1],s=[`center`,`bottom`];r===`bottom`?(o+=i,s=[`center`,`top`]):r===`left`?a-=i:r===`right`?(a+=i,s=[`center`,`top`]):o-=i;var c=0;return(r===`left`||r===`right`)&&(c=Math.PI/2),{rotation:c,x:a,y:o,style:{align:s[0],verticalAlign:s[1]}}},t.prototype._renderYearText=function(e,t,n,r){var i=e.getModel(`yearLabel`);if(i.get(`show`)){var a=i.get(`margin`),o=i.get(`position`);o||=n===`horizontal`?`left`:`top`;var s=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(s[0][0]+s[1][0])/2,l=(s[0][1]+s[1][1])/2,u=n===`horizontal`?0:1,d={top:[c,s[u][1]],bottom:[c,s[1-u][1]],left:[s[1-u][0],l],right:[s[u][0],l]},f=t.start.y;+t.end.y>+t.start.y&&(f=f+`-`+t.end.y);var p=i.get(`formatter`),m={start:t.start.y,end:t.end.y,nameMap:f},h=new CR({z2:30,style:_p(i,{text:this._formatterLabel(p,m)}),silent:i.get(`silent`)});h.attr(this._yearTextPositionControl(h,d[o],n,o,a)),r.add(h)}},t.prototype._monthTextPositionControl=function(e,t,n,r,i){var a=`left`,o=`top`,s=e[0],c=e[1];return n===`horizontal`?(c+=i,t&&(a=`center`),r===`start`&&(o=`bottom`)):(s+=i,t&&(o=`middle`),r===`start`&&(a=`right`)),{x:s,y:c,align:a,verticalAlign:o}},t.prototype._renderMonthText=function(e,t,n,r){var i=e.getModel(`monthLabel`);if(i.get(`show`)){var a=i.get(`nameMap`),o=i.get(`margin`),s=i.get(`position`),c=i.get(`align`),l=[this._tlpoints,this._blpoints];(!a||V(a))&&(a&&(t=Um(a)||t),a=t.get([`time`,`monthAbbr`])||[]);var u=s===`start`?0:1,d=n===`horizontal`?0:1;o=s===`start`?-o:o;for(var f=c===`center`,p=i.get(`silent`),m=0;m<l[u].length-1;m++){var h=l[u][m].slice(),g=this._firstDayOfMonth[m];f&&(h[d]=(this._firstDayPoints[m][d]+l[0][m+1][d])/2);var _=i.get(`formatter`),v=a[g.m-1],y={yyyy:g.y,yy:(g.y+``).slice(2),MM:g.m,M:+g.m,nameMap:v},b=new CR({z2:30,style:I(_p(i,{text:this._formatterLabel(_,y)}),this._monthTextPositionControl(h,f,n,s,o)),silent:p});r.add(b)}}},t.prototype._weekTextPositionControl=function(e,t,n,r,i){var a=`center`,o=`middle`,s=e[0],c=e[1],l=n===`start`;return t===`horizontal`?(s=s+r+(l?1:-1)*i[0]/2,a=l?`right`:`left`):(c=c+r+(l?1:-1)*i[1]/2,o=l?`bottom`:`top`),{x:s,y:c,align:a,verticalAlign:o}},t.prototype._renderWeekText=function(e,t,n,r,i){var a=e.getModel(`dayLabel`);if(a.get(`show`)){var o=e.coordinateSystem,s=a.get(`position`),c=a.get(`nameMap`),l=a.get(`margin`),u=o.getFirstDayOfWeek();(!c||V(c))&&(c&&(t=Um(c)||t),c=t.get([`time`,`dayOfWeekShort`])||R(t.get([`time`,`dayOfWeekAbbr`]),function(e){return e[0]}));var d=o.getNextNDay(n.end.time,7-n.lweek).time,f=[o.getCellWidth(),o.getCellHeight()];l=Y(l,Math.min(f[1],f[0])),s===`start`&&(d=o.getNextNDay(n.start.time,-(7+n.fweek)).time,l=-l);for(var p=a.get(`silent`),m=0;m<7;m++){var h=o.getNextNDay(d,m),g=o.dataToCalendarLayout([h.time],!1).center,_=m;_=Math.abs((m+u)%7);var v=new CR({z2:30,style:I(_p(a,{text:c[_]}),this._weekTextPositionControl(g,r,s,l,f)),silent:p});i.add(v)}}},t.type=`calendar`,t}(IK),dZ=864e5,fZ=function(){function e(t,n,r){this.type=`calendar`,this.dimensions=e.dimensions,this.getDimensionsInfo=e.getDimensionsInfo,this._model=t,this._update(n,r)}return e.getDimensionsInfo=function(){return[{name:`time`,type:`time`},`value`]},e.prototype.getRangeInfo=function(){return this._rangeInfo},e.prototype.getModel=function(){return this._model},e.prototype.getRect=function(){return this._rect},e.prototype.getCellWidth=function(){return this._sw},e.prototype.getCellHeight=function(){return this._sh},e.prototype.getOrient=function(){return this._orient},e.prototype.getFirstDayOfWeek=function(){return this._firstDayOfWeek},e.prototype.getDateInfo=function(e){e=nu(e);var t=e.getFullYear(),n=e.getMonth()+1,r=n<10?`0`+n:``+n,i=e.getDate(),a=i<10?`0`+i:``+i,o=e.getDay();return o=Math.abs((o+7-this.getFirstDayOfWeek())%7),{y:t+``,m:r,d:a,day:o,time:e.getTime(),formatedDate:t+`-`+r+`-`+a,date:e}},e.prototype.getNextNDay=function(e,t){return t||=0,t===0||(e=new Date(this.getDateInfo(e).time),e.setDate(e.getDate()+t)),this.getDateInfo(e)},e.prototype._update=function(e,t){this._firstDayOfWeek=+this._model.getModel(`dayLabel`).get(`firstDay`),this._orient=this._model.get(`orient`),this._lineWidth=this._model.getModel(`itemStyle`).getItemStyle().lineWidth||0,this._rangeInfo=this._getRangeInfo(this._initRangeOption());var n=this._rangeInfo.weeks||1,r=[`width`,`height`],i=this._model.getCellSize().slice(),a=this._model.getBoxLayoutParams(),o=this._orient===`horizontal`?[n,7]:[7,n];L([0,1],function(e){l(i,e)&&(a[r[e]]=i[e]*o[e])});var s={width:t.getWidth(),height:t.getHeight()},c=this._rect=Mh(a,s);L([0,1],function(e){l(i,e)||(i[e]=c[r[e]]/o[e])});function l(e,t){return e[t]!=null&&e[t]!==`auto`}this._sw=i[0],this._sh=i[1]},e.prototype.dataToPoint=function(e,t,n){n||=[],z(e)&&(e=e[0]),t??=!0;var r=this.getDateInfo(e),i=this._rangeInfo,a=r.formatedDate;if(t&&!(r.time>=i.start.time&&r.time<i.end.time+dZ))return n[0]=n[1]=NaN,n;var o=r.day,s=this._getRangeInfo([i.start.time,a]).nthWeek;return this._orient===`vertical`?(n[0]=this._rect.x+o*this._sw+this._sw/2,n[1]=this._rect.y+s*this._sh+this._sh/2):(n[0]=this._rect.x+s*this._sw+this._sw/2,n[1]=this._rect.y+o*this._sh+this._sh/2),n},e.prototype.pointToData=function(e){var t=this.pointToDate(e);return t&&t.time},e.prototype.dataToLayout=function(e,t,n){n||={};var r=n.rect=n.rect||{},i=n.contentRect=n.contentRect||{},a=this.dataToPoint(e,t);return r.x=a[0]-this._sw/2,r.y=a[1]-this._sh/2,r.width=this._sw,r.height=this._sh,J.copy(i,r),Qf(i,this._lineWidth/2,!0,!0),n},e.prototype.dataToCalendarLayout=function(e,t){var n=this.dataToPoint(e,t);return{center:n,tl:[n[0]-this._sw/2,n[1]-this._sh/2],tr:[n[0]+this._sw/2,n[1]-this._sh/2],br:[n[0]+this._sw/2,n[1]+this._sh/2],bl:[n[0]-this._sw/2,n[1]+this._sh/2]}},e.prototype.pointToDate=function(e){var t=Math.floor((e[0]-this._rect.x)/this._sw)+1,n=Math.floor((e[1]-this._rect.y)/this._sh)+1,r=this._rangeInfo.range;return this._orient===`vertical`?this._getDateByWeeksAndDay(n,t-1,r):this._getDateByWeeksAndDay(t,n-1,r)},e.prototype.convertToPixel=function(e,t,n){var r=GO(t);return r===this?r.dataToPoint(n):null},e.prototype.convertToLayout=function(e,t,n){var r=GO(t);return r===this?r.dataToLayout(n):null},e.prototype.convertFromPixel=function(e,t,n){var r=GO(t);return r===this?r.pointToData(n):null},e.prototype.containPoint=function(e){return console.warn(`Not implemented.`),!1},e.prototype._initRangeOption=function(){var e=this._model.get(`range`),t;if(z(e)&&e.length===1&&(e=e[0]),z(e))t=e;else{var n=e.toString();if(/^\d{4}$/.test(n)&&(t=[n+`-01-01`,n+`-12-31`]),/^\d{4}[\/|-]\d{1,2}$/.test(n)){var r=this.getDateInfo(n),i=r.date;i.setMonth(i.getMonth()+1);var a=this.getNextNDay(i,-1);t=[r.formatedDate,a.formatedDate]}/^\d{4}[\/|-]\d{1,2}[\/|-]\d{1,2}$/.test(n)&&(t=[n,n])}if(!t)return e;var o=this._getRangeInfo(t);return o.start.time>o.end.time&&t.reverse(),t},e.prototype._getRangeInfo=function(e){var t=[this.getDateInfo(e[0]),this.getDateInfo(e[1])],n;t[0].time>t[1].time&&(n=!0,t.reverse());var r=Math.floor(t[1].time/dZ)-Math.floor(t[0].time/dZ)+1,i=new Date(t[0].time),a=i.getDate(),o=t[1].date.getDate();i.setDate(a+r-1);var s=i.getDate();if(s!==o)for(var c=i.getTime()-t[1].time>0?1:-1;(s=i.getDate())!==o&&(i.getTime()-t[1].time)*c>0;)r-=c,i.setDate(s-c);var l=Math.floor((r+t[0].day+6)/7),u=n?-l+1:l-1;return n&&t.reverse(),{range:[t[0].formatedDate,t[1].formatedDate],start:t[0],end:t[1],allDay:r,weeks:l,nthWeek:u,fweek:t[0].day,lweek:t[1].day}},e.prototype._getDateByWeeksAndDay=function(e,t,n){var r=this._getRangeInfo(n);if(e>r.weeks||e===0&&t<r.fweek||e===r.weeks&&t>r.lweek)return null;var i=(e-1)*7-r.fweek+t,a=new Date(r.start.time);return a.setDate(+r.start.d+i),this.getDateInfo(a)},e.create=function(t,n){var r=[];return t.eachComponent(`calendar`,function(i){var a=new e(i,t,n);r.push(a),i.coordinateSystem=a}),t.eachComponent(function(e,t){gm({targetModel:t,coordSysType:`calendar`,coordSysProvider:tH})}),r},e.dimensions=[`time`,`value`],e}(),pZ=[`transition`,`enterFrom`,`leaveTo`],mZ=pZ.concat([`enterAnimation`,`updateAnimation`,`leaveAnimation`]),hZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.preventAutoZ=!0,n}return t.prototype.mergeOption=function(t,n){var r=this.option.elements;this.option.elements=null,e.prototype.mergeOption.call(this,t,n),this.option.elements=r},t.prototype.optionUpdated=function(e,t){var n=this.option,r=(t?n:e).elements,i=n.elements=t?[]:n.elements,a=[];this._flatten(r,a,null);var o=xu(i,a,`normalMerge`),s=this._elOptionsToUpdate=[];L(o,function(e,t){var n=e.newOption;n&&(s.push(n),qO(e,n),YO(i,t,n),ZO(i[t],n))},this),n.elements=qa(i,function(e){return e&&delete e.$action,e!=null})},t.prototype._flatten=function(e,t,n){L(e,function(e){if(e){n&&(e.parentOption=n),t.push(e);var r=e.children;r&&r.length&&this._flatten(r,t,e),delete e.children}},this)},t.prototype.useElOptionsToUpdate=function(){var e=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,e},t.type=`graphic`,t.defaultOption={elements:[]},t}(BH),gZ={path:null,compoundPath:null,group:Lz,image:mR,text:CR},_Z=Iu(),vZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(){this._elMap=W()},t.prototype.render=function(e,t,n){e!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=e,this._updateElements(e),this._relocate(e,n)},t.prototype._updateElements=function(e){var t=e.useElOptionsToUpdate();if(t){var n=this._elMap,r=this.group,i=e.get(`z`),a=e.get(`zlevel`);L(t,function(t){var o=Au(t.id,null),s=o==null?null:n.get(o),c=Au(t.parentId,null),l=c==null?r:n.get(c),u=t.type,d=t.style;u===`text`&&d&&t.hv&&t.hv[1]&&(d.textVerticalAlign=d.textBaseline=d.verticalAlign=d.align=null);var f=t.textContent,p=t.textConfig;if(d&&l_(d,u,!!p,!!f)){var m=u_(d,u,!0);!p&&m.textConfig&&(p=t.textConfig=m.textConfig),!f&&m.textContent&&(f=m.textContent)}var h=nk(t),g=t.$action||`merge`,_=g===`merge`,v=g===`replace`;if(_){var y=!s,b=s;y?b=$O(o,l,t.type,n):(b&&(_Z(b).isNew=!1),iO(b)),b&&(WD(b,h,e,{isInit:y}),tk(b,t,i,a))}else if(v){ek(s,t,n,e);var x=$O(o,l,t.type,n);x&&(WD(x,h,e,{isInit:!0}),tk(x,t,i,a))}else g===`remove`&&(GD(s,t),ek(s,t,n,e));var S=n.get(o);if(S&&f){if(_){var C=S.getTextContent();C?C.attr(f):S.setTextContent(new CR(f))}else v&&S.setTextContent(new CR(f))}if(S){var w=t.clipPath;if(w){var T=w.type,E=void 0,y=!1;if(_){var D=S.getClipPath();y=!D||_Z(D).type!==T,E=y?QO(T):D}else v&&(y=!0,E=QO(T));S.setClipPath(E),WD(E,w,e,{isInit:y}),aO(E,w.keyframeAnimation,e)}var O=_Z(S);S.setTextConfig(p),O.option=t,rk(S,e,t),ep({el:S,componentModel:e,itemName:S.name,itemTooltipOption:t.tooltip}),aO(S,t.keyframeAnimation,e)}})}},t.prototype._relocate=function(e,t){for(var n=e.option.elements,r=this.group,i=this._elMap,a=t.getWidth(),o=t.getHeight(),s=[`x`,`y`],c=0;c<n.length;c++){var l=n[c],u=Au(l.id,null),d=u==null?null:i.get(u);if(d&&d.isGroup){var f=d.parent,p=f===r,m=_Z(d),h=_Z(f);m.width=Y(m.option.width,p?a:h.width)||0,m.height=Y(m.option.height,p?o:h.height)||0}}for(var c=n.length-1;c>=0;c--){var l=n[c],u=Au(l.id,null),d=u==null?null:i.get(u);if(d){var f=d.parent,h=_Z(f),g=f===r?{width:a,height:o}:{width:h.width,height:h.height},_={},v=Ph(d,l,g,null,{hv:l.hv,boundingMode:l.bounding},_);if(!_Z(d).isNew&&v){for(var y=l.transition,b={},x=0;x<s.length;x++){var S=s[x],C=_[S];y&&(qD(y)||Ha(y,S)>=0)?b[S]=C:d[S]=C}Sf(d,b,e,0)}else d.attr(_)}}},t.prototype._clear=function(){var e=this,t=this._elMap;t.each(function(n){ek(n,_Z(n).option,t,e._lastGraphicModel)}),this._elMap=W()},t.prototype.dispose=function(){this._clear()},t.type=`graphic`,t}(IK),yZ=[`x`,`y`,`radius`,`angle`,`single`],bZ=Iu(),xZ=[`cartesian2d`,`polar`,`singleAxis`],SZ=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},e}(),CZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=[`percent`,`percent`],n}return t.prototype.init=function(e,t,n){var r=pk(e);this.settledOption=r,this.mergeDefaultAndTheme(e,n),this._doInit(r)},t.prototype.mergeOption=function(e){var t=pk(e);za(this.option,e,!0),za(this.settledOption,t,!0),this._doInit(t)},t.prototype._doInit=function(e){var t=this.option;this._setDefaultThrottle(e),this._updateRangeUse(e);var n=this.settledOption;L([[`start`,`startValue`],[`end`,`endValue`]],function(e,r){this._rangePropMode[r]===`value`&&(t[e[0]]=n[e[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var e=this.get(`orient`,!0),t=this._targetAxisInfoMap=W();this._fillSpecifiedTargetAxis(t)?this._orient=e||this._makeAutoOrientByTargetAxis():(this._orient=e||`horizontal`,this._fillAutoTargetAxisByOrient(t,this._orient)),this._noTarget=!0,t.each(function(e){e.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(e){var t=!1;return L(yZ,function(n){var r=this.getReferringComponents(ok(n),XR);if(r.specified){t=!0;var i=new SZ;L(r.models,function(e){i.add(e.componentIndex)}),e.set(n,i)}},this),t},t.prototype._fillAutoTargetAxisByOrient=function(e,t){var n=this.ecModel,r=!0;if(r){var i=t===`vertical`?`y`:`x`,a=n.findComponents({mainType:i+`Axis`});o(a,i)}if(r){var a=n.findComponents({mainType:`singleAxis`,filter:function(e){return e.get(`orient`,!0)===t}});o(a,`single`)}function o(t,n){var i=t[0];if(i){var a=new SZ;if(a.add(i.componentIndex),e.set(n,a),r=!1,n===`x`||n===`y`){var o=i.getReferringComponents(`grid`,YR).models[0];o&&L(t,function(e){i.componentIndex!==e.componentIndex&&o===e.getReferringComponents(`grid`,YR).models[0]&&a.add(e.componentIndex)})}}}r&&L(yZ,function(t){if(r){var i=n.findComponents({mainType:ok(t),filter:function(e){return e.get(`type`,!0)===`category`}});if(i[0]){var a=new SZ;a.add(i[0].componentIndex),e.set(t,a),r=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var e;return this.eachTargetAxis(function(t){!e&&(e=t)},this),e===`y`?`vertical`:`horizontal`},t.prototype._setDefaultThrottle=function(e){if(e.hasOwnProperty(`throttle`)&&(this._autoThrottle=!1),this._autoThrottle){var t=this.ecModel.option;this.option.throttle=t.animation&&t.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(e){var t=this._rangePropMode,n=this.get(`rangeMode`);L([[`start`,`startValue`],[`end`,`endValue`]],function(r,i){var a=e[r[0]]!=null,o=e[r[1]]!=null;a&&!o?t[i]=`percent`:!a&&o?t[i]=`value`:n?t[i]=n[i]:a&&(t[i]=`percent`)})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var e;return this.eachTargetAxis(function(t,n){e??=this.ecModel.getComponent(ok(t),n)},this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each(function(n,r){L(n.indexList,function(n){e.call(t,r,n)})})},t.prototype.getAxisProxy=function(e,t){return uk(this.getAxisModel(e,t))},t.prototype.getAxisModel=function(e,t){var n=this._targetAxisInfoMap.get(e);if(n&&n.indexMap[t])return this.ecModel.getComponent(ok(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;L([[`start`,`startValue`],[`end`,`endValue`]],function(r){(e[r[0]]!=null||e[r[1]]!=null)&&(t[r[0]]=n[r[0]]=e[r[0]],t[r[1]]=n[r[1]]=e[r[1]])},this),this._updateRangeUse(e)},t.prototype.setCalculatedRange=function(e){var t=this.option;L([`start`,`startValue`,`end`,`endValue`],function(n){t[n]=e[n]})},t.prototype.getPercentRange=function(){var e=this.findRepresentativeAxisProxy();if(e)return e.getWindow().percent},t.prototype.getValueRange=function(e,t){if(e==null&&t==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getWindow().value}else return this.getAxisProxy(e,t).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(e){if(e)return uk(e);for(var t,n=this._targetAxisInfoMap.keys(),r=0;r<n.length;r++)for(var i=n[r],a=this._targetAxisInfoMap.get(i),o=0;o<a.indexList.length;o++){var s=this.getAxisProxy(i,a.indexList[o]);if(s.hostedBy(this))return s;t||=s}return t},t.prototype.getRangePropMode=function(){return this._rangePropMode.slice()},t.prototype.getOrient=function(){return this._orient},t.type=`dataZoom`,t.dependencies=[`xAxis`,`yAxis`,`radiusAxis`,`angleAxis`,`singleAxis`,`series`,`toolbox`],t.defaultOption={z:4,filterMode:`filter`,start:0,end:100},t}(BH),wZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n,r){this.dataZoomModel=e,this.ecModel=t,this.api=n},t.type=`dataZoom`,t}(IK),TZ=function(){function e(e,t,n,r){this._dimName=e,this._axisIndex=t,this.ecModel=r,this._dataZoomModel=n}return e.prototype.hostedBy=function(e){return this._dataZoomModel===e},e.prototype.getWindow=function(){return Ra(this._window)},e.prototype.getTargetSeriesModels=function(){var e=[];return this.ecModel.eachSeries(function(t){if(ak(t)){var n=ok(this._dimName),r=t.getReferringComponents(n,YR).models[0];r&&this._axisIndex===r.componentIndex&&e.push(t)}},this),e},e.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+`Axis`,this._axisIndex)},e.prototype.getMinMaxSpan=function(){return Ra(this._minMaxSpan)},e.prototype.calculateDataWindow=function(e){var t=this._extent,n=this.getAxisModel().axis,r=n.scale,i=this._dataZoomModel.getRangePropMode(),a=[0,100],o=[],s=[],c,l=[!1,!1];L([`start`,`end`],function(n,u){var d=e[n],f=e[n+`Value`];i[u]===`percent`?(d??=a[u],f=Hl(d,a,t),l[u]=!0):(c=!0,f==null?f=t[u]:(f=r.parse(f),r.sanitize&&(f=r.sanitize(f,t))),d=Hl(f,t,a)),s[u]=f==null||isNaN(f)?t[u]:f,o[u]=d==null||isNaN(d)?a[u]:d}),Jl(s),Jl(o);var u=this._minMaxSpan;c?d(s,o,t,a,!1):d(o,s,a,t,!0);function d(e,t,n,r,i){var a=i?`Span`:`ValueSpan`;dD(0,e,n,`all`,u[`min`+a],u[`max`+a]);for(var o=0;o<2;o++)t[o]=Hl(e[o],n,r,!0),i&&(t[o]=t[o],l[o]=!0);ed(t)}var f=w_(r)||S_(r),p=n.getExtent(),m=jR(p[1]-p[0]),h=f?0:Zl(s,m,.5);L([[0,PR],[1,NR]],function(e){var n=e[0],r=e[1];l[n]&&isFinite(h)&&(s[n]=ql(s[n],h),s[n]=kR(t[1],AR(t[0],s[n])),o[n]===a[n]&&(s[n]=t[n],f&&(s[n]=r(s[n]))))}),ed(s);var g=[Hl(s[0],t,a,!0),Hl(s[1],t,a,!0)];return ed(g),{value:s,percent:o,percentInverted:g,valuePrecision:h}},e.prototype.reset=function(e,t){if(this.hostedBy(e)){var n=this.getAxisModel().axis;ib(n,2);var r=n.scale.rawExtentInfo;this._extent=r.makeNoZoom(),this._updateMinMaxSpan();var i=e.settledOption;t&&(i=Va({start:t[0],end:t[1]},i));var a=this._window=this.calculateDataWindow(i),o=a.percent,s=a.value;o[0]!==0&&r.setZoomMM(0,s[0]),o[1]!==100&&r.setZoomMM(1,s[1])}},e.prototype.filterData=function(e,t){if(!this.hostedBy(e))return;var n=this._dimName,r=this.getTargetSeriesModels(),i=e.get(`filterMode`),a=this._window.value;if(i===`none`)return;L(r,function(e){var t=e.getData(),r=t.mapDimensionsAll(n);if(r.length){if(i===`weakFilter`){var s=t.getStore(),c=R(r,function(e){return t.getDimensionIndex(e)},t);t.filterSelf(function(e){for(var t,n,i,o=0;o<r.length;o++){var l=s.get(c[o],e),u=!isNaN(l),d=l<a[0],f=l>a[1];if(u&&!d&&!f)return!0;u&&(i=!0),d&&(t=!0),f&&(n=!0)}return i&&t&&n})}else L(r,function(n){if(i===`empty`)e.setData(t=t.map(n,function(e){return o(e)?e:NaN}));else{var r={};r[n]=a,t.selectRange(r)}});L(r,function(e){t.setApproximateExtent(a,e)})}});function o(e){return e>=a[0]&&e<=a[1]}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._extent;L([`min`,`max`],function(r){var i=t.get(r+`Span`),a=t.get(r+`ValueSpan`);a!=null&&(a=this.getAxisModel().axis.scale.parse(a)),a==null?i!=null&&(a=Hl(i,[0,100],n,!0)-n[0]):i=Hl(n[0]+a,n,[0,100],!0),e[r+`Span`]=i,e[r+`ValueSpan`]=a},this)},e}(),EZ={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(t){e.eachComponent(`dataZoom`,function(n){n.eachTargetAxis(function(r,i){t(r,i,e.getComponent(ok(r),i),n)})})}var n=[];t(function(t,r,i,a){if(!uk(i)){var o=new TZ(t,r,a,e);n.push(o),dk(i,o)}});var r=W();return L(n,function(e){L(e.getTargetSeriesModels(),function(e){r.set(e.uid,e)})}),r},overallReset:function(e,t){e.eachComponent(`dataZoom`,function(e){var n=[];e.eachTargetAxis(function(t,r){var i=e.getAxisProxy(t,r),a=fk(e,i);a?n.push([i,a]):i.reset(e,null)}),L(n,function(t){t[0].reset(e,t[1].getWindow().percentInverted)}),e.eachTargetAxis(function(n,r){e.getAxisProxy(n,r).filterData(e,t)})}),e.eachComponent(`dataZoom`,function(e){var t=e.findRepresentativeAxisProxy();if(t){var n=t.getWindow(),r=n.percent,i=n.value;e.setCalculatedRange({start:r[0],end:r[1],startValue:i[0],endValue:i[1]})}})}},DZ=td(),OZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`tooltip`,t.dependencies=[`axisPointer`],t.defaultOption={z:60,show:!0,showContent:!0,trigger:`item`,triggerOn:`mousemove|click|mousewheel`,alwaysShowContent:!1,renderMode:`auto`,confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:X.color.neutral00,shadowBlur:10,shadowColor:`rgba(0, 0, 0, .2)`,shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:X.color.border,padding:null,extraCssText:``,axisPointer:{type:`line`,axis:`auto`,animation:`auto`,animationDurationUpdate:200,animationEasingUpdate:`exponentialOut`,crossStyle:{color:X.color.borderShade,width:1,type:`dashed`,textStyle:{}}},textStyle:{color:X.color.tertiary,fontSize:14}},t}(BH),kZ=vk([`transform`,`webkitTransform`,`OTransform`,`MozTransform`,`msTransform`]),AZ=vk([`webkitTransition`,`transition`,`OTransition`,`MozTransition`,`msTransition`]),jZ=yk(AZ,`transition`),MZ=yk(kZ,`transform`),NZ=`position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;`+(EF.transform3dSupported?`will-change:transform;`:``),PZ=function(){function e(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,EF.wxa)return null;var n=document.createElement(`div`);n.domBelongToZr=!0,this.el=n;var r=this._zr=e.getZr(),i=t.appendTo,a=i&&(V(i)?document.querySelector(i):no(i)?i:B(i)&&i(e.getDom()));Dk(this._styleCoord,r,a,e.getWidth()/2,e.getHeight()/2),(a||e.getDom()).appendChild(n),this._api=e,this._container=a;var o=this;n.onmouseenter=function(){o._enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},n.onmousemove=function(e){if(e||=window.event,!o._enterable){var t=r.handler;Dx(r.painter.getViewportRoot(),e,!0),t.dispatch(`mousemove`,e)}},n.onmouseleave=function(){o._inContent=!1,o._enterable&&o._show&&o.hideLater(o._hideDelay)}}return e.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),n=bk(t,`position`),r=t.style;r.position!==`absolute`&&n!==`absolute`&&(r.position=`relative`)}var i=e.get(`alwaysShowContent`);i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=e.get(`displayTransition`)&&e.get(`transitionDuration`)>0,this.el.className=e.get(`className`)||``},e.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,r=n.style,i=this._styleCoord;n.innerHTML?r.cssText=NZ+Ek(e,!this._firstShow,this._longHide,this._enableDisplayTransition)+wk(i[0],i[1],!0)+(`border-color:`+Eh(t)+`;`)+(e.get(`extraCssText`)||``)+(`;pointer-events:`+(this._enterable?`auto`:`none`)):r.display=`none`,this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(e,t,n,r,i){var a=this.el;if(e==null)a.innerHTML=``;else{var o=``;if(V(i)&&n.get(`trigger`)===`item`&&!_k(n)&&(o=Sk(n,r,i)),V(e))a.innerHTML=e+o;else if(e){a.innerHTML=``,z(e)||(e=[e]);for(var s=0;s<e.length;s++)no(e[s])&&e[s].parentNode!==a&&a.appendChild(e[s]);if(o&&a.childNodes.length){var c=document.createElement(`div`);c.innerHTML=o,a.appendChild(c)}}}},e.prototype.setEnterable=function(e){this._enterable=e},e.prototype.getSize=function(){var e=this.el;return e?[e.offsetWidth,e.offsetHeight]:[0,0]},e.prototype.moveTo=function(e,t){if(this.el){var n=this._styleCoord;if(Dk(n,this._zr,this._container,e,t),n[0]!=null&&n[1]!=null){var r=this.el.style;L(wk(n[0],n[1]),function(e){r[e[0]]=e[1]})}}},e.prototype._moveIfResized=function(){var e=this._styleCoord[2],t=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),t*this._zr.getHeight())},e.prototype.hide=function(){var e=this,t=this.el.style;this._enableDisplayTransition?(t.visibility=`hidden`,t.opacity=`0`):t.display=`none`,EF.transform3dSupported&&(t.willChange=``),this._show=!1,this._longHideTimeout=setTimeout(function(){return e._longHide=!0},500)},e.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(q(this.hide,this),e)):this.hide())},e.prototype.isShow=function(){return this._show},e.prototype.dispose=function(){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var e=this._zr;Fm(e&&e.painter&&e.painter.getViewportRoot(),this._container);var t=this.el;if(t){t.onmouseenter=t.onmousemove=t.onmouseleave=null;var n=t.parentNode;n&&n.removeChild(t)}this.el=this._container=null},e}(),FZ=function(){function e(e){this._show=!1,this._styleCoord=[0,0,0,0],this._alwaysShowContent=!1,this._enterable=!0,this._zr=e.getZr(),Ak(this._styleCoord,this._zr,e.getWidth()/2,e.getHeight()/2)}return e.prototype.update=function(e){var t=e.get(`alwaysShowContent`);t&&this._moveIfResized(),this._alwaysShowContent=t},e.prototype.show=function(){this._hideTimeout&&clearTimeout(this._hideTimeout),this.el.show(),this._show=!0},e.prototype.setContent=function(e,t,n,r,i){var a=this;H(e)&&hu(``),this.el&&this._zr.remove(this.el);var o=n.getModel(`textStyle`);this.el=new CR({style:{rich:t.richTextStyles,text:e,lineHeight:22,borderWidth:1,borderColor:r,textShadowColor:o.get(`textShadowColor`),fill:n.get([`textStyle`,`color`]),padding:bg(n,`richText`),verticalAlign:`top`,align:`left`},z:n.get(`z`)}),L([`backgroundColor`,`borderRadius`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`],function(e){a.el.style[e]=n.get(e)}),L([`textShadowBlur`,`textShadowOffsetX`,`textShadowOffsetY`],function(e){a.el.style[e]=o.get(e)||0}),this._zr.add(this.el);var s=this;this.el.on(`mouseover`,function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0}),this.el.on(`mouseout`,function(){s._enterable&&s._show&&s.hideLater(s._hideDelay),s._inContent=!1})},e.prototype.setEnterable=function(e){this._enterable=e},e.prototype.getSize=function(){var e=this.el,t=this.el.getBoundingRect(),n=kk(e.style);return[t.width+n.left+n.right,t.height+n.top+n.bottom]},e.prototype.moveTo=function(e,t){var n=this.el;if(n){var r=this._styleCoord;Ak(r,this._zr,e,t),e=r[0],t=r[1];var i=n.style,a=Ok(i.borderWidth||0),o=kk(i);n.x=e+a+o.left,n.y=t+a+o.top,n.markRedraw()}},e.prototype._moveIfResized=function(){var e=this._styleCoord[2],t=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),t*this._zr.getHeight())},e.prototype.hide=function(){this.el&&this.el.hide(),this._show=!1},e.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(q(this.hide,this),e)):this.hide())},e.prototype.isShow=function(){return this._show},e.prototype.dispose=function(){this._zr.remove(this.el)},e}(),IZ=new vR({shape:{x:-1,y:-1,width:2,height:2}}),LZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(e,t){if(!EF.node&&t.getDom()){var n=e.getComponent(`tooltip`),r=this._renderMode=Uu(n.get(`renderMode`));this._tooltipContent=r===`richText`?new FZ(t):new PZ(t,{appendTo:n.get(`appendToBody`,!0)?`body`:n.get(`appendTo`,!0)})}},t.prototype.render=function(e,t,n){if(!EF.node&&n.getDom()){this.group.removeAll(),this._tooltipModel=e,this._ecModel=t,this._api=n;var r=this._tooltipContent;r.update(e),r.setEnterable(e.get(`enterable`)),this._initGlobalListener(),this._keepShow(),this._renderMode!==`richText`&&e.get(`transitionDuration`)?kb(this,`_updatePosition`,50,`fixRate`):Ab(this,`_updatePosition`)}},t.prototype._initGlobalListener=function(){var e=this._tooltipModel.get(`triggerOn`);CO(`itemTooltip`,this._api,q(function(t,n,r){e!==`none`&&(e.indexOf(t)>=0?this._tryShow(n,r):t===`leave`&&this._hide(r))},this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,r=e.get(`triggerOn`);if(e.get(`trigger`)!==`axis`&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&r!==`none`&&r!==`click`){var i=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&i.manuallyShowTip(e,t,n,{x:i._lastX,y:i._lastY,dataByCoordSys:i._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(e,t,n,r){if(r.from!==this.uid&&!EF.node&&n.getDom()){var i=Mk(r,n);this._ticket=``;var a=r.dataByCoordSys,o=yee(r,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:r.position,positionDefault:`bottom`},i)}else if(r.tooltip&&r.x!=null&&r.y!=null){var c=IZ;c.x=r.x,c.y=r.y,c.update(),QR(c).tooltipConfig={name:null,option:r.tooltip},this._tryShow({offsetX:r.x,offsetY:r.y,target:c},i)}else if(a)this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,dataByCoordSys:a,tooltipOption:r.tooltipOption},i);else if(r.seriesIndex!=null){if(this._manuallyAxisShowTip(e,t,n,r))return;var l=AO(r,t),u=l.point[0],d=l.point[1];u!=null&&d!=null&&this._tryShow({offsetX:u,offsetY:d,target:l.el,position:r.position,positionDefault:`bottom`},i)}else r.x!=null&&r.y!=null&&(n.dispatchAction({type:`updateAxisPointer`,x:r.x,y:r.y}),this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,target:n.getZr().findHover(r.x,r.y).target},i))}},t.prototype.manuallyHideTip=function(e,t,n,r){var i=this._tooltipContent;this._tooltipModel&&i.hideLater(this._tooltipModel.get(`hideDelay`)),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,r.from!==this.uid&&this._hide(Mk(r,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,r){var i=r.seriesIndex,a=r.dataIndex,o=t.getComponent(`axisPointer`).coordSysAxesInfo;if(i!=null&&a!=null&&o!=null){var s=t.getSeriesByIndex(i);if(s&&jk([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model],this._tooltipModel).get(`trigger`)===`axis`)return n.dispatchAction({type:`updateAxisPointer`,seriesIndex:i,dataIndex:a,position:r.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var r=e.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,e);else if(n){if(QR(n).ssrType===`legend`)return;this._lastDataByCoordSys=null,this._cbParamsList=null;var i,a;rC(n,function(e){if(e.tooltipDisabled)return i=a=null,!0;i||a||(QR(e).dataIndex==null?QR(e).tooltipConfig!=null&&(a=e):i=e)},!0),i?this._showSeriesItemTooltip(e,i,t):a?this._showComponentItemTooltip(e,a,t):this._hide(t)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get(`showDelay`);t=q(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,r=this._tooltipModel,i=[t.offsetX,t.offsetY],a=jk([t.tooltipOption],r),o=this._renderMode,s=[],c=og(`section`,{blocks:[],noHeader:!0}),l=[],u=new nU;L(e,function(e){L(e.dataByAxis,function(e){var t=n.getComponent(e.axisDim+`Axis`,e.axisIndex),i=e.value,a=t.axis,d=a.scale.parse(i);if(t&&i!=null){var f=mO(i,a,n,e.seriesDataIndices,e.valueLabelOpt),p=og(`section`,{header:f,noHeader:!fo(f),sortBlocks:!0,blocks:[]});c.blocks.push(p),L(e.seriesDataIndices,function(i){var a=n.getSeriesByIndex(i.seriesIndex),c=i.dataIndexInside,m=a.getDataParams(c);if(!(m.dataIndex<0)){m.axisDim=e.axisDim,m.axisIndex=e.axisIndex,m.axisType=e.axisType,m.axisId=e.axisId,m.axisValue=Y_(t.axis,{value:d}),m.axisValueLabel=f,m.marker=u.makeTooltipMarker(`item`,Eh(m.color),o);var h=Gh(a.formatTooltip(c,!0,null)),g=h.frag;if(g){var _=jk([a],r).get(`valueFormatter`);p.blocks.push(_?I({valueFormatter:_},g):g)}h.text&&l.push(h.text),s.push(m)}})}})}),c.blocks.reverse(),l.reverse();var d=t.position,f=fg(c,u,o,a.get(`order`),n.get(`useUTC`),a.get(`textStyle`));f&&l.unshift(f);var p=o===`richText`?`
39
39
 
40
40
  `:`<br/>`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=QR(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=jk([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(m==null||m===`item`){var h=s.getDataParams(c,l),g=new nU;h.marker=g.makeTooltipMarker(`item`,Eh(h.color),d);var _=Gh(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?fg(y?I({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=QR(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(V(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=Ra(a),a.content=Bm(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=jk(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new nU;this._showOrMove(d,function(){var n=Ra(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,e.get(`showContent`)&&e.get(`show`)){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o||=e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`),e.get(`defaultBorderColor`,!0)).color;if(u){if(V(u)){var p=e.ecModel.get(`useUTC`),m=z(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=nh(m.axisValue,d,p)),d=Ch(d,n,!0)}else if(B(u)){var g=q(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u}l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r,i){if(n===`axis`||z(t))return{color:r||i};if(!z(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t||=e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),B(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),z(t))n=Y(t[0],s),r=Y(t[1],c);else if(H(t)){var p=t;p.width=l[0],p.height=l[1];var m=Mh(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(V(t)&&o){var h=vee(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=gee(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=Nk(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=Nk(d)?l[1]/2:d===`bottom`?l[1]:0),_k(e)){var h=_ee(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&L(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i&&=o.length===s.length,i&&L(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&L(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&L(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,this._cbParamsList=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){!EF.node&&t.getDom()&&(Ab(this,`_updatePosition`),this._tooltipContent.dispose(),kO(`itemTooltip`,t),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type=`tooltip`,t}(IK),RZ=L,zZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode={type:`box`,ignoreSize:!0},n}return t.type=`title`,t.defaultOption={z:6,show:!0,text:``,target:`blank`,subtext:``,subtarget:`blank`,left:`center`,top:X.size.m,backgroundColor:X.color.transparent,borderColor:X.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:`bold`,color:X.color.primary},subtextStyle:{fontSize:12,color:X.color.quaternary}},t}(BH),BZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){if(this.group.removeAll(),e.get(`show`)){var r=this.group,i=e.getModel(`textStyle`),a=e.getModel(`subtextStyle`),o=e.get(`textAlign`),s=U(e.get(`textBaseline`),e.get(`textVerticalAlign`)),c=new CR({style:_p(i,{text:e.get(`text`),fill:i.getTextColor()},{disableBox:!0}),z2:10}),l=c.getBoundingRect(),u=e.get(`subtext`),d=new CR({style:_p(a,{text:u,fill:a.getTextColor(),y:l.height+e.get(`itemGap`),verticalAlign:`top`},{disableBox:!0}),z2:10}),f=e.get(`link`),p=e.get(`sublink`),m=e.get(`triggerEvent`,!0);c.silent=!f&&!m,d.silent=!p&&!m,f&&c.on(`click`,function(){Dh(f,`_`+e.get(`target`))}),p&&d.on(`click`,function(){Dh(p,`_`+e.get(`subtarget`))}),QR(c).eventData=QR(d).eventData=m?{componentType:`title`,componentIndex:e.componentIndex}:null,r.add(c),u&&r.add(d);var h=r.getBoundingRect(),g=e.getBoxLayoutParams();g.width=h.width,g.height=h.height;var _=Mh(g,Nh(e,n).refContainer,e.get(`padding`));o||(o=e.get(`left`)||e.get(`right`),o===`middle`&&(o=`center`),o===`right`?_.x+=_.width:o===`center`&&(_.x+=_.width/2)),s||(s=e.get(`top`)||e.get(`bottom`),s===`center`&&(s=`middle`),s===`bottom`?_.y+=_.height:s===`middle`&&(_.y+=_.height/2),s||=`top`),r.x=_.x,r.y=_.y,r.markRedraw();var v={align:o,verticalAlign:s};c.setStyle(v),d.setStyle(v),h=r.getBoundingRect();var y=_.margin,b=e.getItemStyle([`color`,`opacity`]);b.fill=e.get(`backgroundColor`);var x=new vR({shape:{x:h.x-y[3],y:h.y-y[0],width:h.width+y[1]+y[3],height:h.height+y[0]+y[2],r:e.get(`borderRadius`)},style:b,subPixelOptimize:!0,silent:!0});r.add(x)}},t.type=`title`,t}(IK),VZ=Iu(),HZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.createdBySelf=!1,n.preventAutoZ=!0,n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n),this._mergeOption(e,n,!1,!0)},t.prototype.isAnimationEnabled=function(){if(EF.node)return!1;var e=this.__hostSeries;return this.getShallow(`animation`)&&e&&e.isAnimationEnabled()},t.prototype.mergeOption=function(e,t){this._mergeOption(e,t,!1,!1)},t.prototype._mergeOption=function(e,t,n,r){var i=this.mainType;n||t.eachSeries(function(e){var n=e.get(this.mainType,!0),a=VZ(e)[i];!n||!n.data?VZ(e)[i]=null:(a?a._mergeOption(n,t,!0):(r&&Ik(n),L(n.data,function(e){e instanceof Array?(Ik(e[0]),Ik(e[1])):Ik(e)}),a=this.createMarkerModelFromSeries(n,this,t),I(a,{mainType:this.mainType,seriesIndex:e.seriesIndex,name:e.name,createdBySelf:!0}),a.__hostSeries=e),VZ(e)[i]=a)},this)},t.prototype.formatTooltip=function(e,t,n){var r=this.getData(),i=this.getRawValue(e),a=r.getName(e);return og(`section`,{header:this.name,blocks:[og(`nameValue`,{name:a,value:i,noName:!a,noValue:i==null})]})},t.prototype.getData=function(){return this._data},t.prototype.setData=function(e){this._data=e},t.prototype.getDataParams=function(e,t){var n=GH.prototype.getDataParams.call(this,e,t),r=this.__hostSeries;return r&&(n.seriesId=r.id,n.seriesName=r.name,n.seriesType=r.subType),n},t.getMarkerModelFromSeries=function(e,t){return VZ(e)[t]},t.type=`marker`,t.dependencies=[`series`,`grid`,`polar`,`geo`],t}(BH),Wa(HZ,GH.prototype),UZ={min:Za(Lk,`min`),max:Za(Lk,`max`),average:Za(Lk,`average`),median:Za(Lk,`median`)},WZ=Iu(),GZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(){this.markerGroupMap=W()},t.prototype.render=function(e,t,n){var r=this,i=this.markerGroupMap;i.each(function(e){WZ(e).keep=!1}),t.eachSeries(function(e){var i=HZ.getMarkerModelFromSeries(e,r.type);i&&r.renderSeries(e,i,t,n)}),i.each(function(e){!WZ(e).keep&&r.group.remove(e.group)}),kee(t,i,this.type)},t.prototype.markKeep=function(e){WZ(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;L(e,function(e){var r=HZ.getMarkerModelFromSeries(e,n.type);r&&r.getData().eachItemGraphicEl(function(e){e&&(t?kd(e):Ad(e))})})},t.type=`marker`,t}(IK),KZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markLine`,t.defaultOption={z:5,symbol:[`circle`,`arrow`],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:`item`},label:{show:!0,position:`end`,distance:5},lineStyle:{type:`dashed`},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:`linear`},t}(HZ),qZ=Iu(),JZ=function(e,t,n,r){var i=e.getData(),a;if(z(r))a=r;else{var o=r.type;if(o===`min`||o===`max`||o===`average`||o===`median`||r.xAxis!=null||r.yAxis!=null){var s=void 0,c=void 0;if(r.yAxis!=null||r.xAxis!=null)s=t.getAxis(r.yAxis==null?`x`:`y`),c=oo(r.yAxis,r.xAxis);else{var l=zk(r,i,t,e);s=l.valueAxis,c=Vk(i,Sm(i,l.valueDataDim),o)}var u=s.dim===`x`?0:1,d=1-u,f=Ra(r),p={coord:[]};f.type=null,f.coord=[],f.coord[d]=-1/0,p.coord[d]=1/0;var m=n.get(`precision`);m>=0&&$a(c)&&(c=+c.toFixed(Math.min(m,20))),f.coord[u]=p.coord[u]=c,a=[f,p,{type:o,valueIndex:r.valueIndex,value:c}]}else a=[]}var h=[Rk(e,a[0]),Rk(e,a[1]),I({},a[2])];return h[2].type=h[2].type||null,za(h[2],h[0]),za(h[2],h[1]),h},YZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=HZ.getMarkerModelFromSeries(e,`markLine`);if(t){var r=t.getData(),i=qZ(t).from,a=qZ(t).to;i.each(function(t){Gk(i,t,!0,e,n),Gk(a,t,!1,e,n)}),r.each(function(e){r.setItemLayout(e,[i.getItemLayout(e),a.getItemLayout(e)])}),this.markerGroupMap.get(e.id).updateLayout()}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,new SX);this.group.add(c.group);var l=Kk(i,e,t),u=l.from,d=l.to,f=l.line;qZ(t).from=u,qZ(t).to=d,t.setData(f);var p=t.get(`symbol`),m=t.get(`symbolSize`),h=t.get(`symbolRotate`),g=t.get(`symbolOffset`);z(p)||(p=[p,p]),z(m)||(m=[m,m]),z(h)||(h=[h,h]),z(g)||(g=[g,g]),l.from.each(function(e){_(u,e,!0),_(d,e,!1)}),f.each(function(e){var t=f.getItemModel(e),n=t.getModel(`lineStyle`).getLineStyle();f.setItemLayout(e,[u.getItemLayout(e),d.getItemLayout(e)]);var r=t.get(`z2`);n.stroke??=u.getItemVisual(e,`style`).fill,f.setItemVisual(e,{z2:U(r,0),fromSymbolKeepAspect:u.getItemVisual(e,`symbolKeepAspect`),fromSymbolOffset:u.getItemVisual(e,`symbolOffset`),fromSymbolRotate:u.getItemVisual(e,`symbolRotate`),fromSymbolSize:u.getItemVisual(e,`symbolSize`),fromSymbol:u.getItemVisual(e,`symbol`),toSymbolKeepAspect:d.getItemVisual(e,`symbolKeepAspect`),toSymbolOffset:d.getItemVisual(e,`symbolOffset`),toSymbolRotate:d.getItemVisual(e,`symbolRotate`),toSymbolSize:d.getItemVisual(e,`symbolSize`),toSymbol:d.getItemVisual(e,`symbol`),style:n})}),c.updateData(f),l.line.eachItemGraphicEl(function(e){QR(e).dataModel=t,e.traverse(function(e){QR(e).dataModel=t})});function _(t,n,i){var a=t.getItemModel(n);Gk(t,n,i,e,r);var s=a.getModel(`itemStyle`).getItemStyle();s.fill??=tC(o,`color`),t.setItemVisual(n,{symbolKeepAspect:a.get(`symbolKeepAspect`),symbolOffset:U(a.get(`symbolOffset`,!0),g[+!i]),symbolRotate:U(a.get(`symbolRotate`,!0),h[+!i]),symbolSize:U(a.get(`symbolSize`),m[+!i]),symbol:U(a.get(`symbol`,!0),p[+!i]),style:s})}this.markKeep(c),c.group.silent=t.get(`silent`)||e.get(`silent`)},t.type=`markLine`,t}(GZ),XZ=function(e,t){if(t===`all`)return{type:`all`,title:e.getLocaleModel().get([`legend`,`selector`,`all`])};if(t===`inverse`)return{type:`inverse`,title:e.getLocaleModel().get([`legend`,`selector`,`inverse`])}},ZZ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode={type:`box`,ignoreSize:!0},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n),e.selected=e.selected||{},this._updateSelector(e)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),this._updateSelector(t)},t.prototype._updateSelector=function(e){var t=e.selector,n=this.ecModel;t===!0&&(t=e.selector=[`all`,`inverse`]),z(t)&&L(t,function(e,r){V(e)&&(e={type:e}),t[r]=za(e,XZ(n,e.type))})},t.prototype.optionUpdated=function(){this._updateData(this.ecModel);var e=this._data;if(e[0]&&this.get(`selectedMode`)===`single`){for(var t=!1,n=0;n<e.length;n++){var r=e[n].get(`name`);if(this.isSelected(r)){this.select(r),t=!0;break}}!t&&this.select(e[0].get(`name`))}},t.prototype._updateData=function(e){var t=[],n=[];e.eachRawSeries(function(r){var i=r.name;n.push(i);var a;if(r.legendVisualProvider){var o=r.legendVisualProvider.getAllNames();e.isSeriesFiltered(r)||(n=n.concat(o)),o.length?t=t.concat(o):a=!0}else a=!0;a&&ju(r)&&t.push(r.name)}),this._availableNames=n;var r=this.get(`data`)||t,i=W(),a=R(r,function(e){return(V(e)||$a(e))&&(e={name:e}),i.get(e.name)?null:(i.set(e.name,!0),new rV(e,this,this.ecModel))},this);this._data=qa(a,function(e){return!!e})},t.prototype.getData=function(){return this._data},t.prototype.select=function(e){var t=this.option.selected;if(this.get(`selectedMode`)===`single`){var n=this._data;L(n,function(e){t[e.get(`name`)]=!1})}t[e]=!0},t.prototype.unSelect=function(e){this.get(`selectedMode`)!==`single`&&(this.option.selected[e]=!1)},t.prototype.toggleSelected=function(e){var t=this.option.selected;t.hasOwnProperty(e)||(t[e]=!0),this[t[e]?`unSelect`:`select`](e)},t.prototype.allSelect=function(){var e=this._data,t=this.option.selected;L(e,function(e){t[e.get(`name`,!0)]=!0})},t.prototype.inverseSelect=function(){var e=this._data,t=this.option.selected;L(e,function(e){var n=e.get(`name`,!0);t.hasOwnProperty(n)||(t[n]=!0),t[n]=!t[n]})},t.prototype.isSelected=function(e){var t=this.option.selected;return!(t.hasOwnProperty(e)&&!t[e])&&Ha(this._availableNames,e)>=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,bottom:X.size.m,align:`auto`,backgroundColor:X.color.transparent,borderColor:X.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:X.color.disabled,inactiveBorderColor:X.color.disabled,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:X.color.disabled,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:X.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:X.color.tertiary,borderWidth:1,borderColor:X.color.border},emphasis:{selectorLabel:{show:!0,color:X.color.quaternary}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(BH),QZ=Za,$Z=L,eQ=Lz,tQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new eQ),this.group.add(this._selectorGroup=new eQ),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);i&&i!==`auto`||(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=Nh(e,n).refContainer,l=e.getBoxLayoutParams(),u=e.get(`padding`),d=Mh(l,c,u),f=this.layoutInner(e,i,d,r,o,s),p=Mh(Va({width:f.width,height:f.height},l),c,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=gk(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=W(),l=t.get(`selectedMode`),u=t.get(`triggerEvent`),d=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&d.push(e.id)}),$Z(t.getData(),function(i,a){var o=this,f=i.get(`name`);if(!this.newlineDisabled&&(f===``||f===`
41
- `)){var p=new eQ;p.newline=!0,s.add(p)}else{var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,QZ(Xk,f,null,r,d)).on(`mouseover`,QZ(Zk,m.name,null,r,d)).on(`mouseout`,QZ(Qk,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=QR(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=lc(h.fill);_&&_[3]===0&&(_[3]=.2,h=I(I({},h),{fill:_c(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,QZ(Xk,null,f,r,d)).on(`mouseover`,QZ(Zk,null,f,r,d)).on(`mouseout`,QZ(Qk,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=QR(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};QR(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();$Z(e,function(e){var r=e.type,i=new CR({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),hp(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),Wd(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=Jk(c,r,o,s,d,m,u),y=new eQ,b=r.getModel(`textStyle`);if(B(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(Yk({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;V(w)&&w?T=w.replace(`{name}`,t??``):B(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new CR({style:_p(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new vR({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&ep({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),Wd(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();LH(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){LH(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(IK),nQ=od(nA),rQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.setScrollDataIndex=function(e){this.option.scrollDataIndex=e},t.prototype.init=function(t,n,r){var i=Rh(t);e.prototype.init.call(this,t,n,r),iA(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),iA(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=jm(ZZ.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:`end`,pageFormatter:`{current}/{total}`,pageIcons:{horizontal:[`M0,0L12,-10L12,10z`,`M0,0L-12,-10L-12,10z`],vertical:[`M0,0L20,0L10,-20z`,`M0,0L20,0L10,20z`]},pageIconColor:X.color.accent50,pageIconInactiveColor:X.color.accent10,pageIconSize:15,pageTextStyle:{color:X.color.tertiary},animationDurationUpdate:800}),t}(ZZ),iQ=Lz,aQ=[`width`,`height`],oQ=[`x`,`y`],sQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!0,n._currentIndex=0,n}return t.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new iQ),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new iQ)},t.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(t,n,r,i,a,o,s){var c=this;e.prototype.renderInner.call(this,t,n,r,i,a,o,s);var l=this._controllerGroup,u=n.get(`pageIconSize`,!0),d=z(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new CR({name:`pageText`,style:{text:`xx/xx`,fill:f.getTextColor(),font:f.getFont(),verticalAlign:`middle`,align:`center`},silent:!0})),p(`pageNext`,1);function p(e,t){var r=e+`DataIndex`,a=qf(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:q(c._pageGo,c,r,n,i)},{x:-d[0]/2,y:-d[1]/2,width:d[0],height:d[1]});a.name=e,l.add(a)}},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getSelectorGroup(),s=e.getOrient().index,c=aQ[s],l=oQ[s],u=aQ[1-s],d=oQ[1-s];i&&LH(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=Ra(n);i&&(h[c]=n[c]-p[c]-f);var g=this._layoutContentAndController(e,r,h,s,c,u,d,l);if(i){if(a===`end`)m[s]+=g[c]+f;else{var _=p[c]+f;m[s]-=_,g[l]-=_}g[c]+=p[c]+f,m[1-s]+=g[d]+g[u]/2-p[u]/2,g[u]=Math.max(g[u],p[u]),g[d]=Math.min(g[d],p[d]+m[1-s]),o.x=m[0],o.y=m[1],o.markRedraw()}return g},t.prototype._layoutContentAndController=function(e,t,n,r,i,a,o,s){var c=this.getContentGroup(),l=this._containerGroup,u=this._controllerGroup;LH(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),LH(`horizontal`,u,e.get(`pageButtonItemGap`,!0));var d=c.getBoundingRect(),f=u.getBoundingRect(),p=this._showController=d[i]>n[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=U(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new vR({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&Sf(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;L([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,V(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=aQ[i],o=oQ[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i<g.i&&(g=h,f.pagePrevDataIndex??=h.i,++f.pageCount,++f.pageIndex),h=_;return f;function v(e){if(e){var t=e.getBoundingRect(),n=t[o]+e[o];return{s:n,e:n+t[a],i:e.__legendDataIndex}}}function y(e,t){return e.e>=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(tQ),cQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=jm(CZ.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(CZ),lQ=Iu(),uQ=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){e.prototype.render.apply(this,arguments),t.noTarget()?this._clear():(this.range=t.getPercentRange(),cA(r,t,{pan:q(dQ.pan,this),zoom:q(dQ.zoom,this),scrollMove:q(dQ.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){lA(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(wZ),dQ={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=fQ[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(dD(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:gA(function(e,t,n,r,i,a){var o=fQ[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:gA(function(e,t,n,r,i,a){return fQ[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})},fQ={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}},pQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=jm(CZ.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:X.color.accent10,borderRadius:0,backgroundColor:X.color.transparent,dataBackground:{lineStyle:{color:X.color.accent30,width:.5},areaStyle:{color:X.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:X.color.accent40,width:.5},areaStyle:{color:X.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:X.color.neutral00,borderColor:X.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:X.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:X.color.tertiary},brushSelect:!0,brushStyle:{color:X.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:X.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(CZ),mQ=vR,hQ=1,gQ=30,_Q=7,vQ=`horizontal`,yQ=`vertical`,bQ=5,xQ=[`line`,`bar`,`candlestick`,`scatter`],SQ={easing:`cubicOut`,duration:100,delay:0},CQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=q(this._onBrush,this),this._onBrushEnd=q(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){e.prototype.render.apply(this,arguments),kb(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1?this.group.removeAll():t.noTarget()?(this._clear(),this.group.removeAll()):(i&&i.type===`dataZoom`&&i.from===this.uid||this._buildView(),this._updateView())},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Ab(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new Lz;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?_Q:0,r=Nh(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===vQ?{right:r.width-i.x-i.width,top:r.height-gQ-a-n,width:i.width,height:gQ}:{right:a,top:i.y,width:gQ,height:i.height},s=Rh(e.option);L([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=Mh(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===yQ&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===vQ&&!i?{scaleY:o?1:-1,scaleX:1}:n===vQ&&i?{scaleY:o?1:-1,scaleX:-1}:n===yQ&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]),c=isNaN(s.x)?0:s.x,l=isNaN(s.y)?0:s.y;e.x=t.x-c,e.y=t.y-l,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new mQ({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new mQ({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:q(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b)v||(y+=g);else{y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:Hl(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new Lz,r=new iB({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new oB({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){L(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&Ha(xQ,e.get(`type`))<0)){var o=r.getComponent(ok(i),a).axis,s=yA(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new mQ({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new mQ({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:hQ,fill:X.color.transparent}})),L([0,1],function(t){var a=o.get(`handleIcon`);!cU[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=Ng(a,-1,0,2,2,null,!0);s.attr({cursor:bA(this._orient),draggable:!0,drift:q(this._onDragMove,this,t),ondragend:q(this._onDragEnd,this),onmouseover:q(this._onOverDataInfoTriggerArea,this,!0),onmouseout:q(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=Y(l,this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),Wd(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new CR({silent:!0,invisible:!f,style:_p(d,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=u;if(l){var f=Y(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new vR({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=Ng(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,X.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new vR({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:q(this._onActualMoveZoneDrift,this),ondragstart:q(this._onActualMoveZoneDragStart,this),ondragend:q(this._onActualMoveZoneDragEnd,this),onmouseover:q(this._onOverDataInfoTriggerArea,this,!0),onmouseout:q(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[Hl(e[0],[0,100],t,!0),Hl(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];dD(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:Hl(a.minSpan,o,i,!0),a.maxSpan==null?null:Hl(a.maxSpan,o,i,!0));var s=this._range,c=this._range=Jl([Hl(r[0],i,o,!0),Hl(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=Jl(n.slice()),i=this._size;L([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;c<o.length;c++){var l=o[c],u=l.getClipPath();u||(u=new vR,l.setClipPath(u)),u.setShape({x:s[c],y:0,width:s[c+1]-s[c],height:i[1]})}this._updateDataInfo(e)},t.prototype._updateDataInfo=function(e){var t=this.dataZoomModel,n=this._displayables,r=n.handleLabels,i=this._orient,a=[``,``];if(t.get(`showDetail`)){var o=t.findRepresentativeAxisProxy(),s=o.getAxisModel().axis.scale;if(o){var c=this._range,l;if(e){var u={start:c[0],end:c[1]},d=fk(t,o);if(d){var f=d.calculateDataWindow(u).percentInverted;u={start:f[0],end:f[1]}}l=o.calculateDataWindow(u)}else l=o.getWindow();a=[vA(t,0,l,s),vA(t,1,l,s)]}}var p=Jl(this._handleEnds.slice());m.call(this,0),m.call(this,1);function m(e){var t=zf(n.handles[e].parent,this.group),o=Vf(e===0?`right`:`left`,t),s=this._handleWidth/2+bQ,c=Bf([p[e]+(e===0?-s:s),this._size[1]/2],t);r[e].setStyle({x:c[0],y:c[1],verticalAlign:i===vQ?`middle`:o,align:i===vQ?o:`center`,text:a[e]})}},t.prototype._onOverDataInfoTriggerArea=function(e){this._isOverDataInfoTriggerArea=e,this._showDataInfo(e)},t.prototype._showDataInfo=function(e){var t=(this.dataZoomModel.get(`handleLabel`)||{}).show||!1,n=this.dataZoomModel.getModel([`emphasis`,`handleLabel`]).get(`show`)||!1,r=e||this._dragging?n:t,i=this._displayables,a=i.handleLabels;a[0].attr(`invisible`,!r),a[1].attr(`invisible`,!r),i.moveHandle&&this.api[r?`enterEmphasis`:`leaveEmphasis`](i.moveHandle,1)},t.prototype._onActualMoveZoneDrift=function(e,t,n){this.api.getZr().setCursorStyle(`grabbing`),this._onDragMove(`all`,e,t,n)},t.prototype._onActualMoveZoneDragStart=function(e){e.target.attr(`cursor`,`grabbing`),this._showDataInfo(!0)},t.prototype._onActualMoveZoneDragEnd=function(e){e.target.attr(`cursor`,`grab`),this._onDragEnd()},t.prototype._onDragMove=function(e,t,n,r){this._dragging=!0,BG(r.event);var i=this._displayables.sliderGroup.getLocalTransform(),a=Bf([t,n],i,!0),o=this._updateInterval(e,a[0]),s=this.dataZoomModel.get(`realtime`);this._updateView(!s),o&&s&&this._dispatchZoomAction(!0)},t.prototype._onDragEnd=function(){this._dragging=!1,this._isOverDataInfoTriggerArea||this._showDataInfo(!1),!this.dataZoomModel.get(`realtime`)&&this._dispatchZoomAction(!1)},t.prototype._onClickPanel=function(e){var t=this._size,n=this._displayables.sliderGroup.transformCoordToLocal(e.offsetX,e.offsetY);if(!(n[0]<0||n[0]>t[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new zF(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();dD(0,a,r,0,o.minSpan==null?null:Hl(o.minSpan,i,r,!0),o.maxSpan==null?null:Hl(o.maxSpan,i,r,!0)),this._range=Jl([Hl(a[0],r,i,!0),Hl(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(BG(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new mQ({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?SQ:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=ck(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(wZ),wQ={get:function(e,t,n){var r=Ra((TQ[e]||{})[t]);return n&&z(r)?r[r.length-1]:r}},TQ={color:{active:[`#006edd`,`#e0ffff`],inactive:[X.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},EQ=cX.mapVisual,DQ=cX.eachVisual,OQ=z,kQ=L,AQ=Jl,jQ=Hl,MQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&xee(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=q(e,this),this.controllerVisuals=Fk(this.option.controller,t,e),this.targetVisuals=Fk(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return kQ(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=zu(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return R(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){L(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],z(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);return V(o)?o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c):B(o)?s?o(e[0],e[1]):o(e):s?e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1]:c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=AQ([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=Ja(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};za(r,n),za(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){OQ(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},kQ(r,function(e,t){if(cX.isValidType(t)){var n=wQ.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;kQ(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&Ra(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&Ra(n)||(a?s[0]:[s[0],s[0]])),c.symbol=EQ(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;DQ(l,function(e){e>u&&(u=e)}),c.symbolSize=EQ(l,function(e){return jQ(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:X.color.transparent,borderColor:X.color.borderTint,contentColor:X.color.theme[0],inactiveColor:X.color.disabled,borderWidth:0,padding:X.size.m,textGap:10,precision:0,textStyle:{color:X.color.secondary}},t}(BH),NQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.autoPositionValues={left:1,right:1,top:1,bottom:1},n}return t.prototype.init=function(e,t){this.ecModel=e,this.api=t},t.prototype.render=function(e,t,n,r){this.visualMapModel=e,e.get(`show`)===!1?this.group.removeAll():this.doRender(e,t,n,r)},t.prototype.renderBackground=function(e){var t=this.visualMapModel,n=jH(t.get(`padding`)||0),r=e.getBoundingRect();e.add(new vR({z2:-1,silent:!0,shape:{x:r.x-n[3],y:r.y-n[0],width:r.width+n[3]+n[1],height:r.height+n[0]+n[2]},style:{fill:t.get(`backgroundColor`),stroke:t.get(`borderColor`),lineWidth:t.get(`borderWidth`)}}))},t.prototype.getControllerVisual=function(e,t,n){n||={};var r=n.forceState,i=this.visualMapModel,a={};t===`color`&&(a.color=i.get(`contentColor`));function o(e){return a[e]}function s(e,t){a[e]=t}var c=i.controllerVisuals[r||i.getValueState(e)];return L(cX.prepareVisualTypes(c),function(r){var i=c[r];n.convertOpacityToAlpha&&r===`opacity`&&(r=`colorAlpha`,i=c.__alphaForOpacity),cX.dependsOn(r,t)&&i&&i.applyVisual(e,o,s)}),a[t]},t.prototype.positionGroup=function(e){var t=this.visualMapModel,n=this.api,r=Nh(t,n).refContainer;Ph(e,t.getBoxLayoutParams(),r)},t.prototype.doRender=function(e,t,n,r){},t.type=`visualMap`,t}(IK),PQ=[[`left`,`right`,`width`],[`top`,`bottom`,`height`]],FQ={type:`selectDataRange`,event:`dataRangeSelected`,update:`update`},IQ=function(e,t){t.eachComponent({mainType:`visualMap`,query:e},function(t){t.setSelected(e.selected)})},LQ=[{createOnAllSeries:!0,reset:function(e,t){var n=[];return t.eachComponent(`visualMap`,function(t){var r=e.pipelineContext;!t.isTargetSeries(e)||r&&r.large||n.push(See(t.stateList,t.targetVisuals,q(t.getValueState,t),t.getDataDimensionIndex(e.getData())))}),n}},{createOnAllSeries:!0,reset:function(e,t){var n=e.getData(),r=[];t.eachComponent(`visualMap`,function(t){if(t.isTargetSeries(e)){var i=t.getVisualMeta(q(TA,null,e,t))||{stops:[],outerColors:[]},a=t.getDataDimensionIndex(n);a>=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}],RQ=L,zQ=!1,BQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],VQ[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=Ra(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=R(this._pieceList,function(e){return e=Ra(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=cX.listVisualTypes(),i=this.isCategory();L(t.pieces,function(e){L(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),L(n,function(e,n){var r=!1;L(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&L(this.stateList,function(e){(t[e]||(t[e]={}))[n]=wQ.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,L(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;L(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=Ra(e)},t.prototype.getValueState=function(e){var t=cX.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){cX.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return L(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=jm(MQ.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(MQ),VQ={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o<i;s+=a,o++){var c=o===i-1?r[1]:s+a;e.push({interval:[s,c],close:[1,1]})}t.maxOpen&&e.push({interval:[r[1],1/0],close:[0,0]}),ou(e),L(e,function(e,t){e.index=t,e.text=this.formatValueText(e.interval)},this)},categories:function(e){var t=this.option;L(t.categories,function(t){e.push({text:this.formatValueText(t,!0),value:t})},this),kA(t,e)},pieces:function(e){var t=this.option;L(t.pieces,function(t,n){H(t)||(t={value:t});var r={text:``,index:n};if(t.label!=null&&(r.text=t.label),t.hasOwnProperty(`value`)){var i=r.value=t.value;r.interval=[i,i],r.close=[1,1]}else{for(var a=r.interval=[],o=r.close=[0,0],s=[1,0,1],c=[-1/0,1/0],l=[],u=0;u<2;u++){for(var d=[[`gte`,`gt`,`min`],[`lte`,`lt`,`max`]][u],f=0;f<3&&a[u]==null;f++)a[u]=t[d[f]],o[u]=s[f],l[u]=f===2;a[u]??(a[u]=c[u])}l[0]&&a[1]===1/0&&(o[0]=0),l[1]&&a[0]===-1/0&&(o[1]=0),a[0]===a[1]&&o[0]&&o[1]&&(r.value=a[0])}r.visual=cX.retrieveVisuals(t),e.push(r)},this),kA(t,e),ou(e),L(e,function(e){var t=e.close,n=[[`<`,`≤`][t[1]],[`>`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}},HQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=oo(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),L(o.viewPieceList,function(o){var s=o.piece,u=new Lz;u.onclick=q(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new CR({style:_p(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:U(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),LH(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:wA(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return CA(e,this.api,e.itemSize);var n=t.align;return n&&n!==`auto`||(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new Lz,o=this.visualMapModel.textStyleModel;a.add(new CR({style:_p(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=R(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=Ng(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=Ra(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,L(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(NQ),UQ=[`align`,`verticalAlign`,`width`,`height`,`fontSize`],WQ=new wI,GQ=Iu(),KQ=Iu(),qQ=[`x`,`y`,`rotation`],JQ=function(){function e(){this._labelList=[],this._chartViewList=[]}return e.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},e.prototype._addLabel=function(e,t,n,r,i){var a=r.style,o=r.__hostTarget.textConfig||{},s=r.getComputedTransform(),c=r.getBoundingRect().plain();J.applyTransform(c,c,s),s?WQ.setLocalTransform(s):(WQ.x=WQ.y=WQ.rotation=WQ.originX=WQ.originY=0,WQ.scaleX=WQ.scaleY=1),WQ.rotation=hl(WQ.rotation);var l=r.__hostTarget,u;if(l){u=l.getBoundingRect().plain();var d=l.getComputedTransform();J.applyTransform(u,u,d)}var f=u&&l.getTextGuideLine();this._labelList.push({label:r,labelLine:f,seriesModel:n,dataIndex:e,dataType:t,layoutOptionOrCb:i,layoutOption:null,rect:c,hostRect:u,priority:u?u.width*u.height:0,defaultAttr:{ignore:r.ignore,labelGuideIgnore:f&&f.ignore,x:WQ.x,y:WQ.y,scaleX:WQ.scaleX,scaleY:WQ.scaleY,rotation:WQ.rotation,style:{x:a.x,y:a.y,align:a.align,verticalAlign:a.verticalAlign,width:a.width,height:a.height,fontSize:a.fontSize},cursor:r.cursor,attachedPos:o.position,attachedRot:o.rotation}})},e.prototype.addLabelsOfSeries=function(e){var t=this;this._chartViewList.push(e);var n=e.__model,r=n.get(`labelLayout`);(B(r)||Ya(r).length)&&e.group.traverse(function(e){if(e.ignore)return!0;var i=e.getTextContent(),a=QR(e);i&&!i.disableLabelLayout&&t._addLabel(a.dataIndex,a.dataType,n,i,r)})},e.prototype.updateLayoutConfig=function(e){var t=e.getWidth(),n=e.getHeight();function r(e,t){return function(){sx(e,t)}}for(var i=0;i<this._labelList.length;i++){var a=this._labelList[i],o=a.label,s=o.__hostTarget,c=a.defaultAttr,l=void 0;l=B(a.layoutOptionOrCb)?a.layoutOptionOrCb(MA(a,s)):a.layoutOptionOrCb,l||={},a.layoutOption=l;var u=Math.PI/180;s&&s.setTextConfig({local:!1,position:l.x!=null||l.y!=null?null:c.attachedPos,rotation:l.rotate==null?c.attachedRot:l.rotate*u,offset:[l.dx||0,l.dy||0]});var d=!1;if(l.x==null?(o.x=c.x,o.setStyle(`x`,c.style.x)):(o.x=Y(l.x,t),o.setStyle(`x`,0),d=!0),l.y==null?(o.y=c.y,o.setStyle(`y`,c.style.y)):(o.y=Y(l.y,n),o.setStyle(`y`,0),d=!0),l.labelLinePoints){var f=s.getTextGuideLine();f&&(f.setShape({points:l.labelLinePoints}),d=!1)}var p=GQ(o);p.needsUpdateLabelLine=d,o.rotation=l.rotate==null?c.rotation:l.rotate*u,o.scaleX=c.scaleX,o.scaleY=c.scaleY;for(var m=0;m<UQ.length;m++){var h=UQ[m];o.setStyle(h,l[h]==null?c.style[h]:l[h])}if(l.draggable){if(o.draggable=!0,o.cursor=`move`,s){var g=a.seriesModel;a.dataIndex!=null&&(g=a.seriesModel.getData(a.dataType).getItemModel(a.dataIndex)),o.on(`drag`,r(s,g.getModel(`labelLine`)))}}else o.off(`drag`),o.cursor=c.cursor}},e.prototype.layout=function(e){var t=e.getWidth(),n=e.getHeight(),r=[];L(this._labelList,function(e){e.defaultAttr.ignore||r.push(vy({},e))});var i=qa(r,function(e){return e.layoutOption.moveOverlap===`shiftX`}),a=qa(r,function(e){return e.layoutOption.moveOverlap===`shiftY`});by(i,0,0,t),by(a,1,0,n);var o=qa(r,function(e){return e.layoutOption.hideOverlap});xy(o),Sy(o)},e.prototype.processLabelsOverall=function(){var e=this;L(this._chartViewList,function(t){var n=t.__model,r=t.ignoreLabelLineUpdate,i=n.isAnimationEnabled();t.group.traverse(function(t){if(t.ignore&&!t.forceLabelAnimation)return!0;var a=!r,o=t.getTextContent();!a&&o&&(a=GQ(o).needsUpdateLabelLine),a&&e._updateLabelLine(t,n),i&&e._animateLabels(t,n)})})},e.prototype._updateLabelLine=function(e,t){var n=e.getTextContent(),r=QR(e),i=r.dataIndex;if(n&&i!=null){var a=t.getData(r.dataType),o=a.getItemModel(i),s={},c=a.getItemVisual(i,`style`);c&&(s.stroke=c[a.getVisual(`drawType`)]);var l=o.getModel(`labelLine`);fx(e,px(o),s),sx(e,l)}},e.prototype._animateLabels=function(e,t){var n=e.getTextContent(),r=e.getTextGuideLine();if(n&&(e.forceLabelAnimation||!n.ignore&&!n.invisible&&!e.disableLabelAnimation&&!wf(e))){var i=GQ(n),a=i.oldLayout,o=QR(e),s=o.dataIndex,c={x:n.x,y:n.y,rotation:n.rotation},l=t.getData(o.dataType);if(a){n.attr(a);var u=e.prevStates;u&&(Ha(u,`select`)>=0&&n.attr(i.oldLayoutSelect),Ha(u,`emphasis`)>=0&&n.attr(i.oldLayoutEmphasis)),Sf(n,c,t,s)}else if(n.attr(c),!GB(n).valueAnimation){var d=U(n.style.opacity,1);n.style.opacity=0,Cf(n,{style:{opacity:d}},t,s)}if(i.oldLayout=c,n.states.select){var f=i.oldLayoutSelect={};NA(f,c,qQ),NA(f,n.states.select,qQ)}if(n.states.emphasis){var p=i.oldLayoutEmphasis={};NA(p,c,qQ),NA(p,n.states.emphasis,qQ)}wp(n,s,l,t,t)}if(r&&!r.ignore&&!r.invisible){var i=KQ(r),a=i.oldLayout,m={points:r.shape.points};a?(r.attr({shape:a}),Sf(r,{shape:m},t)):(r.setShape(m),r.style.strokePercent=0,Cf(r,{style:{strokePercent:1}},t)),i.oldLayout=m}},e}(),YQ=Iu(),XQ=function(){function e(t,n){p_(this,e.decoratedMethods),this._outOfBrk=v_(null,n);var r=this._linear=v_(null,n);m_(this,r),this.breaks=t&&t.breaks||[]}return e.prototype.hasBreaks=function(){return!!this.breaks.length},e.prototype.calcNiceTickMultiple=function(e,t){for(var n=0;n<this.breaks.length;n++){var r=this.breaks[n];if(r.vmin<e&&e<r.vmax)return t(e,r.vmax)}return 0},e.decoratedMethods={needTransform:function(){return!this.breaks.length},getExtent:function(){return this._outOfBrk.getExtent()},getExtentUnsafe:function(e,t){return t==null||t===2?this._outOfBrk.getExtentUnsafe(e,null):this._linear.getExtentUnsafe(e,null)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){Qu(t,n)&&(e===0&&IA(this,[t,n]),this._outOfBrk.setExtent2(e,t,n),this._linear.setExtent2(e,this.transformIn(t,null),this.transformIn(n,null)))},normalize:function(e){return this._linear.normalize(this.transformIn(e,null))},scale:function(e){return this.transformOut(this._linear.scale(e),null)},contain:function(e){return this._outOfBrk.contain(e)},transformIn:function(e,t){if(t&&t.depth===2)return e;for(var n=ZQ,r=QQ,i=!0,a=0;a<this.breaks.length;a++){var o=this.breaks[a];if(e<=o.vmax){e>o.vmin?n+=o.vmin-r+(e-o.vmin)/(o.vmax-o.vmin)*o.gapReal:n+=e-r,r=o.vmax,i=!1;break}n+=o.vmin-r+o.gapReal,r=o.vmax}return i&&(n+=e-r),n},transformOut:function(e,t){if(t&&t.depth===2)return e;for(var n=ZQ,r=QQ,i=!0,a=0,o=0;o<this.breaks.length;o++){var s=this.breaks[o],c=n+s.vmin-r,l=c+s.gapReal;if(e<=l){a=e>c?s.vmin+(e-c)/(l-c)*(s.vmax-s.vmin):r+e-n,r=s.vmax,i=!1;break}n=l,r=s.vmax}return i&&(a=r+e-n),a}},e}(),ZQ=0,QQ=0,$Q={vmin:`start`,vmax:`end`},e$=Iu(),t$=Math.sin,n$=Math.cos,r$=Math.PI,i$=Math.PI*2,a$=180/r$,o$=function(){function e(){}return e.prototype.reset=function(e){this._start=!0,this._d=[],this._str=``,this._p=10**(e||4)},e.prototype.moveTo=function(e,t){this._add(`M`,e,t)},e.prototype.lineTo=function(e,t){this._add(`L`,e,t)},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){this._add(`C`,e,t,n,r,i,a)},e.prototype.quadraticCurveTo=function(e,t,n,r){this._add(`Q`,e,t,n,r)},e.prototype.arc=function(e,t,n,r,i,a){this.ellipse(e,t,n,n,0,r,i,a)},e.prototype.ellipse=function(e,t,n,r,i,a,o,s){var c=o-a,l=!s,u=Math.abs(c),d=xc(u-i$)||(l?c>=i$:-c>=i$),f=c>0?c%i$:c%i$+i$,p=!1;p=d?!0:!xc(u)&&f>=r$==!!l;var m=e+n*n$(a),h=t+r*t$(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*a$);if(d){var _=1/this._p,v=(l?1:-1)*(i$-_);this._add(`A`,n,r,g,1,+l,e+n*n$(a+v),t+r*t$(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*n$(o),b=t+r*t$(o);this._add(`A`,n,r,g,+p,+l,y,b)}},e.prototype.rect=function(e,t,n,r){this._add(`M`,e,t),this._add(`l`,n,0),this._add(`l`,0,r),this._add(`l`,-n,0),this._add(`Z`)},e.prototype.closePath=function(){this._d.length>0&&this._add(`Z`)},e.prototype._add=function(e,t,n,r,i,a,o,s,c){for(var l=[],u=this._p,d=1;d<arguments.length;d++){var f=arguments[d];if(isNaN(f)){this._invalid=!0;return}l.push(Math.round(f*u)/u)}this._d.push(e+l.join(` `)),this._start=e===`Z`},e.prototype.generateStr=function(){this._str=this._invalid?``:this._d.join(``),this._d=[]},e.prototype.getStr=function(){return this._str},e}(),s$=`none`,c$=Math.round,l$=[`lineCap`,`miterLimit`,`lineJoin`],u$=R(l$,function(e){return`stroke-`+e.toLowerCase()}),d$=`http://www.w3.org/2000/svg`,f$=`http://www.w3.org/1999/xlink`,p$=`http://www.w3.org/2000/xmlns/`,m$=`http://www.w3.org/XML/1998/namespace`,h$=`ecmeta_`,g$=0,_$={cubicIn:`0.32,0,0.67,0`,cubicOut:`0.33,1,0.68,1`,cubicInOut:`0.65,0,0.35,1`,quadraticIn:`0.11,0,0.5,0`,quadraticOut:`0.5,1,0.89,1`,quadraticInOut:`0.45,0,0.55,1`,quarticIn:`0.5,0,0.75,0`,quarticOut:`0.25,1,0.5,1`,quarticInOut:`0.76,0,0.24,1`,quinticIn:`0.64,0,0.78,0`,quinticOut:`0.22,1,0.36,1`,quinticInOut:`0.83,0,0.17,1`,sinusoidalIn:`0.12,0,0.39,0`,sinusoidalOut:`0.61,1,0.88,1`,sinusoidalInOut:`0.37,0,0.63,1`,exponentialIn:`0.7,0,0.84,0`,exponentialOut:`0.16,1,0.3,1`,exponentialInOut:`0.87,0,0.13,1`,circularIn:`0.55,0,1,0.45`,circularOut:`0,0.55,0.45,1`,circularInOut:`0.85,0,0.15,1`},v$=`transform-origin`,y$={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`},b$=Math.round,x$={circle:[Mj([`cx`,`cy`,`r`])],polyline:[Aj,jj],polygon:[Aj,jj]},S$=58,C$=120,w$=sj(``,``),T$=0,E$=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=oM(`configLayer`),this.storage=t,this._opts=n=I({},n),this.root=e,this._id=`zr`+T$++,this._oldVNode=pj(n.width,n.height),e&&!n.ssr){var r=this._viewport=document.createElement(`div`);r.style.cssText=`position:relative;overflow:hidden`;var i=this._svgDom=this._oldVNode.elm=oj(`svg`);nM(null,this._oldVNode),r.appendChild(i),e.appendChild(r)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style=`position:absolute;left:0;top:0;user-select:none`,aM(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return Lj(e,fj(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=fj(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var a=[],o=this._bgVNode=sM(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=sj(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=R(Ya(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(sj(`defs`,`defs`,{},c)),e.animation){var l=dj(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=sj(`style`,`stl`,{},[],l);a.push(u)}}return pj(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},uj(this.renderToVNode({animation:U(e.cssAnimation,!0),emphasis:U(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:U(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var r=e.length,i=[],a=0,o,s,c=0,l=0;l<r;l++){var u=e[l];if(!u.invisible){var d=u.__clipPaths,f=d&&d.length||0,p=s&&s.length||0,m=void 0;for(m=Math.max(f-1,p-1);m>=0&&!(d&&s&&d[m]===s[m]);m--);for(var h=p-1;h>m;h--)a--,o=i[a-1];for(var g=m+1;g<f;g++){var _={};Vj(d[g],_,t);var v=sj(`g`,`clip-g-`+c++,_,[]);(o?o.children:n).push(v),i[a++]=v,o=v}s=d;var y=Lj(u,t);y&&(o?o.children:n).push(y)}}},e.prototype.resize=function(e,t){var n=this._opts,r=this.root,i=this._viewport;if(e!=null&&(n.width=e),t!=null&&(n.height=t),r&&i&&(i.style.display=`none`,e=pC(r,0,n),t=pC(r,1,n),i.style.display=``),this._width!==e||this._height!==t){if(this._width=e,this._height=t,i){var a=i.style;a.width=e+`px`,a.height=t+`px`}if(Ac(this._backgroundColor))this.refresh();else{var o=this._svgDom;o&&(o.setAttribute(`width`,e),o.setAttribute(`height`,t));var s=this._bgVNode&&this._bgVNode.elm;s&&(s.setAttribute(`width`,e),s.setAttribute(`height`,t))}}},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e.prototype.dispose=function(){this.root&&(this.root.innerHTML=``),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},e.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},e.prototype.toDataURL=function(e){var t=this.renderToString(),n=`data:image/svg+xml;`;return e?(t=KI(t),t&&n+`base64,`+t):n+`charset=UTF-8,`+encodeURIComponent(t)},e}(),D$=function(e){F(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.zlevel=0,i.zlevel2=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__prevIdx={startIdx:0,endIdx:0};var a;r||=oL,typeof t==`string`?a=lM(t,n,r):H(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(vo(a),a.onselectstart=function(){return!1},o.padding=`0`,o.margin=`0`,o.borderWidth=`0`),i.painter=n,i.dpr=r,i}return t.prototype.afterBrush=function(){this.__prevIdx=dM(this)},t.prototype.initContext=function(){this.ctx=this.dom.getContext(`2d`),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=lM(`back-`+this.id,this.painter,e),this.ctxBack=this.domBack.getContext(`2d`),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,t,n,r){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var i=[],a=this.maxRepaintRectCount,o=!1,s=new J(0,0,0,0);function c(e){if(e.isFinite()&&!e.isZero()){if(i.length===0){var t=new J(0,0,0,0);t.copy(e),i.push(t)}else{for(var n=!1,r=1/0,c=0,l=0;l<i.length;++l){var u=i[l];if(u.intersect(e)){var d=new J(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}if(o){s.copy(e),s.union(u);var f=e.width*e.height,p=u.width*u.height,m=s.width*s.height-f-p;m<r&&(r=m,c=l)}}if(o&&(i[c].union(e),n=!0),!n){var t=new J(0,0,0,0);t.copy(e),i.push(t)}o||=i.length>=a}}}for(var l=dM(this),u=l.startIdx;u<l.endIdx;++u){var d=e[u];if(d){var f=d.shouldBePainted(n,r,!0,!0),p=d.__isRendered&&(d.__dirty&1||!f)?d.getPrevPaintRect():null;p&&c(p);var m=f&&(d.__dirty&1||!d.__isRendered)?d.getPaintRect():null;m&&c(m)}}for(var h=this.__prevIdx,u=h.startIdx;u<h.endIdx;++u){var d=t[u],f=d&&d.shouldBePainted(n,r,!0,!0);if(d&&(!f||!d.__zr)&&d.__isRendered){var p=d.getPrevPaintRect();p&&c(p)}}var g;do{g=!1;for(var u=0;u<i.length;)if(i[u].isZero())i.splice(u,1);else{for(var _=u+1;_<i.length;)i[u].intersect(i[_])?(g=!0,i[u].union(i[_]),i.splice(_,1)):_++;u++}}while(g);return this._paintRects=i,i},t.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},t.prototype.resize=function(e,t){var n=this.dpr,r=this.dom,i=r.style,a=this.domBack;i&&(i.width=e+`px`,i.height=t+`px`),r.width=e*n,r.height=t*n,a&&(a.width=e*n,a.height=t*n,n!==1&&this.ctxBack.scale(n,n))},t.prototype.clear=function(e,t,n){var r=this.dom,i=this.ctx,a=r.width,o=r.height;t||=this.clearColor;var s=this.motionBlur&&!e,c=this.lastFrameAlpha,l=this.dpr,u=this;s&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation=`copy`,this.ctxBack.drawImage(r,0,0,a/l,o/l));var d=this.domBack;function f(e,n,r,a){if(i.clearRect(e,n,r,a),t&&t!==`transparent`){var o=void 0;ro(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||uC(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):io(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=xC(i,t,{dirty:function(){u.setUnpainted(),u.painter.refresh()}})),i.save(),i.fillStyle=o||t,i.fillRect(e,n,r,a),i.restore()}s&&(i.save(),i.globalAlpha=c,i.drawImage(d,e,n,r,a),i.restore())}!n||s?f(0,0,a,o):n.length&&L(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(iL),O$=1e5,k$=314159,A$=void 0,j$=1,M$=2,N$=1,P$=2,F$=4,I$=N$|F$,L$=function(){function e(e,t,n,r){this.type=`canvas`,this._prevDisplayList=[],this._layerConfig={},this._needsManuallyCompositing=!1,this.type=`canvas`,this._i={layerStack:[],layers:[]};var i=!e.nodeName||e.nodeName.toUpperCase()===`CANVAS`;if(this._opts=n=I({},n||{}),this.dpr=n.devicePixelRatio||oL,this._singleCanvas=i,this.root=e,e.style&&(vo(e),e.innerHTML=``),this.storage=t,this._prevDisplayList=[],i){var a=e,o=a.width,s=a.height;n.width!=null&&(o=n.width),n.height!=null&&(s=n.height),this.dpr=n.devicePixelRatio||1,a.width=o*this.dpr,a.height=s*this.dpr,this._width=o,this._height=s;var c=mM(a,this,k$,0);c.initContext(),this._insertLayer(c,k$,0,!0),this._domRoot=e}else{this._width=pC(e,0,n),this._height=pC(e,1,n);var l=this._domRoot=pM(this._width,this._height);e.appendChild(l)}}return e.prototype.getType=function(){return`canvas`},e.prototype.isSingleCanvas=function(){return this._singleCanvas},e.prototype.getViewportRoot=function(){return this._domRoot},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.refresh=function(e){var t=e&&!H(e)?{paintAll:!!e}:e||{},n=U(t.refresh,!0),r=U(t.refreshHover,!1);if(r&&(this._hoverLayerDirty=M$),!n)return r&&this._paintHoverList(this.storage.getDisplayList(!1)),this;var i=this.storage.getDisplayList(!0);this._updateLayerStatus(i,t.paintAll),this._redrawId=Math.random();var a=this._prevDisplayList;this._paintList(i,a,this._redrawId);var o=this._backgroundColor;return bM(this._i,function(e,t,n,r){e.refresh&&e.refresh(r===0?o:null)},P$),this._opts.useDirtyRect&&(this._prevDisplayList=i.slice()),this},e.prototype._paintHoverList=function(e){var t=this._i.hoverlayer,n=this._hoverLayerDirty;if(this._hoverLayerDirty=A$,n!==A$&&(!t&&n===M$&&(t=this._i.hoverlayer=this._ensureLayer(O$)),t)){t.clear();for(var r={inHover:!0,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},i,a=0,o=e.length;a<o;a++){var s=e[a];if(s.__inHover){i||(i=t.ctx,i.save());var c=s.__hoverStyle,l=void 0;c&&(l=s.style,s.style=c),PC(i,s,r),c&&(s.style=l)}}i&&(FC(i,r),i.restore())}},e.prototype.getHoverLayer=function(){return this._ensureLayer(O$)},e.prototype.paintOne=function(e,t){NC(e,t)},e.prototype._paintList=function(e,t,n){if(this._redrawId===n){var r=this._doPaintList(e,t);if(this._needsManuallyCompositing&&this._compositeManually(),r)bM(this._i,function(e){e.afterBrush&&e.afterBrush()},I$),this._paintHoverList(e);else{var i=this;$G(function(){i._paintList(e,t,n)})}}},e.prototype._compositeManually=function(){var e=this._ensureLayer(k$).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),bM(this._i,function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)},N$)},e.prototype._doPaintList=function(e,t){var n=this,r=!0;return bM(this._i,function(i){var a=!1;if(vM(i,function(e){(e.drawIdx<e.endIdx||e.notClearIdx>=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!uM(i)?i.createRepaintRects(e,t,n._width,n._height):null,s=n._i.layerStack[0],c=!0;if(i.__dirty){c=!1,i.__dirty=!1;var l=i.zlevel===s.zl&&i.zlevel2===s.zl2?n._backgroundColor:null;i.clear(!1,l,o)}vM(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},I$),EF.wxa&&bM(this._i,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),r},e.prototype._paintPerCursor=function(e,t,n,r,i){var a=e.ctx;if(r){if(!r.length)t.drawIdx=t.endIdx;else for(var o=this.dpr,s=0;s<r.length;++s){var c=r[s];a.save(),a.beginPath(),a.rect(c.x*o,c.y*o,c.width*o,c.height*o),a.clip(),this._paintPerCursorInRect(e,t,n,c,i),a.restore()}}else a.save(),this._paintPerCursorInRect(e,t,n,null,i),a.restore();return t.drawIdx>=t.endIdx},e.prototype._paintPerCursorInRect=function(e,t,n,r,i){for(var a={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},o=e.ctx,s=uM(e),c=s&&oF.getTime(),l=t.drawIdx,u=t.notClearIdx,d=u>=0?Math.min(u,l):l;d<t.endIdx;d++){var f=n[d];if(!(d<l&&!f.notClear)){if(f.__inHover&&(this._hoverLayerDirty=M$),r!=null){var p=f.getPaintRect();p&&p.intersect(r)&&(PC(o,f,a),f.setPrevPaintRect(p))}else PC(o,f,a);if(s&&oF.getTime()-c>15){d++;break}}}FC(o,a),t.drawIdx=Math.max(d,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=k$,t=0);var i=yM(this._i,e)[t];return i||(i=mM(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&za(i,this._layerConfig[e],!0),(n||r&&e!==k$)&&(i.virtual=!0),this._insertLayer(i,e,t,!1),i.initContext()),i},e.prototype.insertLayer=function(e,t){this._insertLayer(t,e,0,!1)},e.prototype._insertLayer=function(e,t,n,r){var i=this._i,a=i.layers,o=i.layerStack,s=this._domRoot,c=null;if(!(a[t]&&a[t][n])&&fM(e)){for(var l=o.length,u=0;u<l&&(o[u].zl<t||o[u].zl===t&&o[u].zl2<n);)u++;if(u>0&&(c=yM(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),yM(i,t)[n]=e,!r&&!e.virtual){if(c){var d=c.dom;d.nextSibling?s.insertBefore(e.dom,d.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}e.painter||=this}},e.prototype.eachLayer=function(e,t){return bM(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return bM(this._i,function(n,r){e.call(t,n,r)},N$)},e.prototype.eachOtherLayer=function(e,t){return bM(this._i,function(n,r){e.call(t,n,r)},P$)},e.prototype.getLayers=function(){var e={};return bM(this._i,function(t,n,r){e[t.id]=t}),e},e.prototype._updateLayerStatus=function(e,t){var n=this;if(n._singleCanvas)for(var r=1;r<e.length;r++){var i=e[r];if(i.zlevel!==e[r-1].zlevel||i.incremental){n._needsManuallyCompositing=!0;break}}bM(n._i,function(e){e.__dirty=!1,vM(e,function(e){e.used=!1,e.endIdxNew=0,e.notClearIdx=-1})},I$);for(var a,o=null,s=null,c=!1,l=0,u=e.length;l<u;l++){var i=e[l],d=i.zlevel,f=i.incremental,p=void 0;if(a!==d&&(a=d,c=!1),f?(c=!0,p=1):p=c?2:0,(!o||d!==o.zlevel||p!==o.zlevel2)&&(o=n._ensureLayer(d,p),s=null,!o.__builtin__))La(`ZLevel `+d+` has been used by unknown layer `+o.id);else{if((!s||f!==s.key)&&(s=_M(o,f),!s.used)){if(s.used=!0,!t&&s.first===i.id){var m=l-s.startIdx;s.startIdx=l,s.drawIdx+=m,s.endIdx+=m}else o.__dirty=!0,s.first=i.id,s.startIdx=s.drawIdx=l,s.endIdx=l+1}s.endIdxNew=l+1,i.__dirty&1&&!i.__inHover&&((!f||!i.notClear&&l<s.drawIdx)&&(o.__dirty=!0),f&&i.notClear&&s.notClearIdx<0&&(s.notClearIdx=l))}}bM(n._i,function(t){for(var r=t.__cursorStack,i=t.__cursors,a=r.length-1;a>=0;a--){var o=i.get(r[a]);if(!o.used)t.__dirty=!0,i.removeKey(r[a]),r.splice(a,1);else{var s=o.endIdxNew;(uM(t)?s<o.drawIdx:s!==o.endIdx||!s||e[s-1].id!==o.last)&&(t.__dirty=!0),o.endIdx=o.endIdxNew,o.last=s?e[s-1].id:NaN}}t.__dirty&&(vM(t,function(e){e.drawIdx=e.startIdx}),n._hoverLayerDirty===A$&&(n._hoverLayerDirty=j$))},I$)},e.prototype.clear=function(){return bM(this._i,function(e){e.clear(),hM(e)},N$),this},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,bM(this._i,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?za(n[e],t,!0):n[e]=t,bM(this._i,function(e,t){za(e,n[t],!0)})}},e.prototype.delLayer=function(e){for(var t=this._i.layerStack,n=this._i.layers,r=t.length-1;r>=0;r--){var i=t[r];if(i.zl===e){var a=n[e][i.zl2];if(a.__builtin__)continue;if(t.splice(r,1),n[e][i.zl2]=void 0,!a.virtual){var o=a.dom.parentNode;o&&o.removeChild(a.dom)}}}},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;e!=null&&(r.width=e),t!=null&&(r.height=t),e=pC(i,0,r),t=pC(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,bM(this._i,function(n){n.resize(e,t)}),this.refresh({paintAll:!0})),this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this._ensureLayer(k$).resize(e,t)}return this},e.prototype.clearLayer=function(e){L(this._i.layers[e],function(e){e&&!e.__builtin__&&e.clear()})},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._i.layers[k$][0].dom;var t=new D$(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;bM(this._i,function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else{for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},o=this.storage.getDisplayList(!0),s=0,c=o.length;s<c;s++){var l=o[s];PC(n,l,a)}FC(n,a)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}(),R$=Object.freeze({INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`,JPY:`¥`}),z$=e=>typeof e==`string`&&/^[A-Z]{3}$/.test(e),B$=(e=`INR`)=>R$[e]??`${e} `,V$=`en-IN`,H$=/\{([A-Za-z0-9_]+)\}/g,U$=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0,W$=new Map,G$=0,K$=new Map,q$={aprShortLabel:`Apr`,aprilLabel:`April`,augShortLabel:`Aug`,augustLabel:`August`,decShortLabel:`Dec`,decemberLabel:`December`,emptyValueLabel:`-`,febShortLabel:`Feb`,februaryLabel:`February`,friMinLabel:`Fr`,friShortLabel:`Fri`,fridayLabel:`Friday`,janShortLabel:`Jan`,januaryLabel:`January`,julShortLabel:`Jul`,julyLabel:`July`,junShortLabel:`Jun`,juneLabel:`June`,marShortLabel:`Mar`,marchLabel:`March`,mayLabel:`May`,mayShortLabel:`May`,monMinLabel:`Mo`,monShortLabel:`Mon`,mondayLabel:`Monday`,novShortLabel:`Nov`,novemberLabel:`November`,octShortLabel:`Oct`,octoberLabel:`October`,satMinLabel:`Sa`,satShortLabel:`Sat`,saturdayLabel:`Saturday`,sepShortLabel:`Sep`,septemberLabel:`September`,sunMinLabel:`Su`,sunShortLabel:`Sun`,sundayLabel:`Sunday`,thuMinLabel:`Th`,thuShortLabel:`Thu`,thursdayLabel:`Thursday`,tueMinLabel:`Tu`,tueShortLabel:`Tue`,tuesdayLabel:`Tuesday`,wedMinLabel:`We`,wedShortLabel:`Wed`,wednesdayLabel:`Wednesday`},J$=`Asia/Kolkata`,Y$=198e5,X$=new Map,Z$=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],Q$=[`rupees`,`paise`],$$=[`ms`,`s`,`min`,`h`],e1=[`day`,`month`,`year`,`datetime`,`time`],t1=()=>EM(`formatters`,q$),n1=()=>t1().emptyValueLabel,r1=`−`,i1=[`janShortLabel`,`febShortLabel`,`marShortLabel`,`aprShortLabel`,`mayShortLabel`,`junShortLabel`,`julShortLabel`,`augShortLabel`,`sepShortLabel`,`octShortLabel`,`novShortLabel`,`decShortLabel`],a1={short:[`sunShortLabel`,`monShortLabel`,`tueShortLabel`,`wedShortLabel`,`thuShortLabel`,`friShortLabel`,`satShortLabel`],long:[`sundayLabel`,`mondayLabel`,`tuesdayLabel`,`wednesdayLabel`,`thursdayLabel`,`fridayLabel`,`saturdayLabel`],min:[`sunMinLabel`,`monMinLabel`,`tueMinLabel`,`wedMinLabel`,`thuMinLabel`,`friMinLabel`,`satMinLabel`]},o1=(e,t)=>t1()[wM(e[t],`no date name at index ${t}`)],s1=e=>o1(i1,e),c1=(e,t)=>wM(e[t],`no compact unit at index ${t}`),l1=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],u1=[[1e9,`B`],[1e6,`M`],[1e3,`K`]],d1=e=>!e||e===`INR`?`en-IN`:`en-US`,f1=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=20?e:t,p1=new Map,m1=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=p1.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:e}),p1.set(n,r)),r},h1=new Map,g1=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=h1.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:e,maximumFractionDigits:e}),h1.set(n,r)),r},_1=e=>typeof e==`number`&&Number.isFinite(e),v1=e=>e<0&&!Object.is(Math.abs(e),0)?r1:``,y1=(e,t)=>t===`paise`?Number(zM(e)):e,b1=2,x1=(e,t,n)=>{let r=Math.min(t,b1),i=10n**BigInt(b1-r),a=(BigInt(zM(e).replace(`.`,``))+i/2n)/i,o=10n**BigInt(r),s=g1(0,n).format(a/o);return t===0?s:`${s}.${(a%o).toString().padStart(r,`0`)}${`0`.repeat(t-r)}`},S1=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2,C1={ms:1,s:1e3,min:6e4,h:36e5},w1={aboveLabel:`Above`,areaChartLabel:`Area chart`,arrowKeysText:`{title}: use the arrow keys to read the values`,bandLabel:`Band`,barChartLabel:`Bar chart`,belowLabel:`Below`,bubbleChartLabel:`Bubble chart`,calendarHeatmapLabel:`Calendar heatmap`,calendarRangeText:`, from {first} to {last}`,calendarSummaryTextOne:`Calendar heatmap of {label}, {n} day.`,calendarSummaryTextOther:`Calendar heatmap of {label}, {n} days{range}.`,categoryLabel:`Category`,centerLabel:`Total`,changeLabel:`Change`,chartLabel:`chart`,columnChartLabel:`Column chart`,columnFallbackLabel:`column`,columnXLabel:`X`,constantSpanText:`{label} is {lo}.`,currencyFormatText:`This chart's currency format needs a currency code, such as "INR", in its currency field.`,dataSuffixLabel:`data`,dateLabel:`Date`,donutChartLabel:`Donut chart`,donutLargestText:`{top} is the largest, at {share}.`,donutSummaryTextOne:`Donut chart of {label} in {rows} part, {total} in all.`,donutSummaryTextOther:`Donut chart of {label} in {rows} parts, {total} in all.`,emptyText:`No data to show for this chart.`,errorText:`This chart couldn't load. Try again in a moment.`,everySeriesHiddenText:`Every series is hidden.`,firstStageLabel:`first stage`,fromLabel:`From`,funnelChartLabel:`Funnel chart`,funnelPreviousStepText:`{share} of previous step`,funnelStartText:`{first} is {firstValue} and {last} is {lastValue}, {share} of the start.`,funnelSummaryText:`Funnel chart of {label} in {n} stages.`,gaugeBandText:`, in the {band} band`,gaugeLabel:`Gauge`,gaugeSummaryText:`{type}: {label} is {value} on a scale from {min} to {max}{band}.`,groupLabel:`Group`,groupsTextOne:` in {count} group: {groups}`,groupsTextOther:` in {count} groups: {groups}`,heatmapLabel:`Heatmap`,heatmapSummaryText:`Heatmap of {label} by {group} and {x}, {n} cells.`,highestAtLowestAtText:`Highest is {highValue} at {highGroup}, {high}; lowest is {lowValue} at {lowGroup}, {low}.`,highestLowestText:`Highest is {maxValue} on {max}; lowest is {minValue} on {min}.`,itemLabel:`Item`,largestFallText:`The largest fall is {xText}, {signed}.`,largestFlowText:`The largest flow is {xText} to {toText}, {fmtAt}.`,largestRiseText:`The largest rise is {xText}, {signed}.`,latestText:`Latest {latest}`,legendLabel:`Legend`,lessLabel:`Less`,lineChartLabel:`Line chart`,loadingText:`Loading chart`,measureLabel:`Measure`,moreLabel:`More`,ofFirstStepText:`Of {first}`,ofPreviousStepLabel:`Of previous step`,openingShareText:`{share} of opening`,opensAtClosesAtText:`It opens at {opening} and closes at {closing}.`,otherLabel:`Other`,pointsSummaryTextOne:`{n} point, {first}.`,pointsSummaryTextOther:`{n} points, from {first} to {last}.`,rangeSpanText:`{label} runs from {lo} to {hi}.`,rowFallbackLabel:`row`,rowLabel:`Row`,runningTotalLabel:`Running total`,sankeyLabel:`Sankey diagram`,sankeySummaryText:`Sankey diagram of {label}: {n} flows between {nodes} places.`,scaleLabel:`Scale`,scaleRangeText:`{min} to {max}`,scatterPlotLabel:`Scatter plot`,scatterSummaryText:`{type} of {label} against {xLabel}, {count} points{groups}.`,shareLabel:`Share`,shareOfAllLabel:`Share of all`,shareOfGroupLabel:`Share of group`,shareOfParentText:`Share of {parent}`,shareOfStepText:`{share} of {first}`,sharedAxisText:`, sharing one x axis`,showingFirstRowsDownloadText:`Showing the first {rows} of {total} rows. Download the CSV for all of them.`,smallMultiplesLabel:`Small multiples`,stackedPercentText:`, stacked to 100%`,stackedText:`, stacked`,stageLabel:`Stage`,stepLabel:`Step`,summaryText:`{type} of {series}{stacked}{sharedAxis}.`,targetGapText:`{direction} {label} by {gap}`,targetLabel:`target`,toLabel:`To`,tooManyGroupsText:`This chart has more groups than it can show clearly.`,tooManySeriesText:`This chart has more series than it can show clearly.`,totalText:`Total {total}`,treemapEmptyText:`Treemap of {label}: no items.`,treemapLabel:`Treemap`,treemapLargestGroupText:`{name} is the largest group, at {share}.`,treemapSummaryText:`Treemap of {label}: {n} items in {totals} groups, {total} in all.`,trendLabel:`Trend`,untitledLabel:`Chart`,waterfallLabel:`Waterfall chart`,waterfallSummaryText:`Waterfall chart of {label}.`},Q=()=>EM(`chart`,w1),T1=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],E1=[`none`,`stacked`,`percent`],D1=[`category`,`time`,`value`],O1=[`auto`,`svg`,`canvas`],k1=[`ready`,`loading`,`empty`,`error`],A1=[`chart`,`table`],j1=[`chart-1`,`chart-2`,`chart-3`,`chart-4`,`chart-5`,`chart-6`,`chart-7`,`chart-8`],M1={line:`lineChartLabel`,area:`areaChartLabel`,column:`columnChartLabel`,bar:`barChartLabel`,donut:`donutChartLabel`,heatmap:`heatmapLabel`,calendar:`calendarHeatmapLabel`,funnel:`funnelChartLabel`,gauge:`gaugeLabel`,waterfall:`waterfallLabel`,treemap:`treemapLabel`,sankey:`sankeyLabel`,scatter:`scatterPlotLabel`,bubble:`bubbleChartLabel`,multiples:`smallMultiplesLabel`},N1=e=>Q()[M1[e]],P1=[`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],F1=e=>P1.includes(e),I1=[`area`,`column`,`bar`],L1=[`line`,`area`,`column`,`bar`,`multiples`],R1={line:[`category`,`time`],area:[`category`,`time`],column:[`category`,`time`],bar:[`category`,`time`],multiples:[`category`,`time`],calendar:[`time`],scatter:[`value`],bubble:[`value`]},z1={group:[`heatmap`,`treemap`,`scatter`,`bubble`],to:[`sankey`],size:[`bubble`],trend:[`scatter`,`bubble`],zoom:[`line`,`area`],bands:[`gauge`],centerLabel:[`donut`],sliceValues:[`donut`],valueLabels:[`line`,`column`,`bar`]},B1={gauge:240,calendar:200,treemap:340,sankey:340},V1=100,H1=72,U1=32,W1=[`type`,`title`,`description`,`data`,`x`,`series`,`group`,`to`,`size`,`trend`,`zoom`,`bands`,`stack`,`y`,`target`,`centerLabel`,`sliceValues`,`valueLabels`,`height`,`state`,`emptyText`,`errorText`,`loadingText`,`renderer`,`timeZone`],G1=[`key`,`kind`,`format`,`label`,`labelFit`],K1=[`auto`,`all`,`rotate`,`ellipsis`],q1=[`key`,`label`,`format`,`colour`],J1=[`key`,`label`],Y1=[`key`,`label`,`format`],X1=[`upTo`,`label`],Z1=[`label`,`format`,`min`,`max`,`wholeNumbers`],Q1=[`value`,`label`],$1=[`style`,`currency`,`unit`,`decimals`,`pattern`],e0=[...Q$,...$$],t0=new Set,n0=e=>e.map(e=>`"${e}"`).join(` | `),r0=e=>typeof e==`number`&&Number.isFinite(e),i0=e=>typeof e==`object`&&!!e&&!Array.isArray(e),a0=(e,t)=>Reflect.get(e,t),o0=e=>e===null||typeof e==`string`||typeof e==`number`,s0=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,o0(t)?t:null])),c0=(e,t)=>e.some(e=>e===t),l0=e=>[...new Set(e)],u0=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(e,t),1/0),d0=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(e,t),-1/0),f0=(e,t)=>e.data.map((n,r)=>K(e,t,r)).filter(e=>e!=null),p0=(e,t)=>t?G((e??0)/t,{style:`percent`}):n1(),m0=(e,t)=>t==null?n1():ZM(wN(e,t),`gauge band`).label,h0=(e,t,n)=>{if(!t.length)return null;let r=u0(t),i=d0(t);return r===i?OM(Q().constantSpanText,{label:e,lo:G(r,n)}):OM(Q().rangeSpanText,{label:e,lo:G(r,n),hi:G(i,n)})},g0=(e,t)=>{let n=oN(e);return G(K(e,n.key,t),n.format)},_0=864e5,v0={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},y0=e=>v0[e]??0,b0=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],x0=()=>EM(`chart`,w1),lw([wv,Yb,Sx,HD,uD,aD,UE,zD,qw,UO,bee,sA,qk,ik,KO,AA,SA,Cee,nj,PA,cM,xM]),S0=e=>typeof e==`number`,C0=e=>S0(e)?e:null,w0=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],T0=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`),E0=(e,t)=>{let n=e.filter(e=>typeof e==`number`&&Number.isFinite(e));return[Math.min(...t?[0,...n]:n),Math.max(...t?[0,...n]:n)]},D0=24,O0=4,k0=.6,A0=(e,t)=>String(e).length*t*k0,j0=(e,t)=>{let n=e[t];if(n===void 0)throw Error(`chart palette has no colour at slot ${t}`);return n},M0=[.2126,.7152,.0722],N0=e=>e.map(e=>e/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,n)=>e+t*(M0[n]??0),0),P0=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05),F0=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:oP(e,t)},{offset:1,color:oP(e,0)}]}),I0=(e,t)=>e+IM(e,t),L0=e=>[...new Set(e)],R0=(e,t)=>e.data.map((n,r)=>K(e,t,r)),z0=(e,t,n={})=>({type:`category`,data:t,axisLine:{lineStyle:{color:e.axis}},axisTick:{show:!1},axisLabel:{color:e.label,fontSize:12,margin:12,hideOverlap:!0},...n}),B0=(e,t,n={})=>({type:`value`,splitNumber:4,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:e.grid,type:`solid`,width:1}},axisLabel:{color:e.label,fontSize:12,formatter:t},...n}),V0=6048e5,H0=(e,t)=>{let n=FM(e,t);return`${n.year}-${String(n.month+1).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)}`},U0=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(t,e),1/0),W0=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(t,e),-1/0),G0=9,K0=24,q0=4,J0=72,Y0=12,X0=(e,t)=>Math.floor(t/Math.max(1,e)-q0),Z0=12,Q0=44,$0=28,e2=8,t2=32,n2=8,r2=26,i2={donut:pP,heatmap:gP,calendar:vP,funnel:yP,gauge:bP,waterfall:EP,treemap:OP,sankey:AP,scatter:MP,bubble:MP,multiples:NP},a2=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`,typeof HTMLElement>`u`)throw Error(a2);o2=HTMLElement,s2=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0,c2=()=>EM(`chart`,w1),l2=`wui-chart:select`,u2=`wui-chart:legend-change`,d2=`wui-chart:ready`,f2=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],p2=`(prefers-color-scheme: dark)`,m2=`(prefers-reduced-motion: reduce)`,h2=`(forced-colors: active)`,g2=`(prefers-contrast: more)`,_2=`print`,v2=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,y2=!1,b2=new Map,x2=[...[1,2,3,4,5,6,7,8].map(e=>`--color-chart-${e}`),...[0,1,2,3,4,5,6].map(e=>`--color-chart-seq-${e}`),`--color-chart-neutral`,`--wui-chart-rise`,`--wui-chart-fall`,`--color-chart-grid`,`--color-chart-axis`,`--color-chart-label`,`--color-surface`,`--color-text`,`--color-text-body`,`--color-text-muted`],S2=new Set,C2=null,w2=0,T2=class extends o2{static get observedAttributes(){return[`view`]}constructor(){super(),KP(this,`uid`,void 0),KP(this,`_spec`,void 0),KP(this,`_normal`,void 0),KP(this,`_hidden`,void 0),KP(this,`_focus`,void 0),KP(this,`_awaitingSpec`,!1),KP(this,`_parts`,null),KP(this,`_theme`,null),KP(this,`_width`,null),KP(this,`_visible`,!1),KP(this,`_resizeObserver`,null),KP(this,`_intersection`,null),KP(this,`_engine`,null),KP(this,`_drawn`,!1),KP(this,`_drawnType`,null),KP(this,`_announcedReady`,!1),KP(this,`_legendSignature`,null),KP(this,`_tableSpec`,null),w2+=1,this.uid=`wui-chart-${w2}`,this._spec=null,this._normal=null,this._hidden=new Set,this._focus=null}get spec(){return this._spec}set spec(e){this._spec=e??null,this._normal=null,this._clearFocus(),this._parts&&this._update()}get view(){return this.getAttribute(`view`)===`table`?`table`:`chart`}set view(e){this.setAttribute(`view`,String(e??`chart`))}connectedCallback(){if(s2(this,`spec`)){let e=this.spec;delete this.spec,this._spec=e??null}if(this._spec??=this._readScript(),this._spec==null&&!this.querySelector(`:scope > script[type='application/json']`)&&(this._awaitingSpec=!0,queueMicrotask(()=>{this._awaitingSpec=!1,this._parts&&this._update()})),this._build(),YP(this),this._theme=JP(this),this._width=this.clientWidth,this._resizeObserver=new ResizeObserver(()=>this._resized()),this._resizeObserver.observe(this),typeof IntersectionObserver==`function`){this._visible=!1;let e=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&(e.disconnect(),this._visible=!0,this._update())},{threshold:.05});this._intersection=e,e.observe(this)}else this._visible=!0;this._update()}disconnectedCallback(){XP(this),this._resizeObserver?.disconnect(),this._intersection?.disconnect(),this._engine?.dispose(),this._engine=null,this._drawn=!1,this._parts=null,this.removeAttribute(`data-ready`)}attributeChangedCallback(e,t,n){t!==n&&this._parts&&(QM(`view`,n,A1),this._update())}toCsv(){let{spec:e}=this._normalized();return e?BN(e):``}toPng(){let{spec:e}=this._normalized();return e?LP(e,this._theme??JP(this),this._size(e),{hidden:this._hidden,renderer:hN(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));ZP(t,e??`${VN(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&ZP(t,e??`${VN(this._normalized().spec)}.png`)}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!(e instanceof HTMLScriptElement))return null;try{return JSON.parse(String(e.textContent))}catch(e){return CM(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e instanceof Error?e.message:void 0),null}}_normalized(){return this._normal??=nN(this._spec),this._normal}_build(){let e=TM(`div`,{class:`wui-chart-legend`});e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,c2().legendLabel),e.hidden=!0,e.addEventListener(`click`,e=>{let t=e.target instanceof Element?e.target.closest(`.wui-chart-legend-item`):null;t instanceof HTMLElement&&this._toggle(t.dataset.key)});let t=TM(`div`,{class:`wui-chart-surface`});t.tabIndex=0,t.setAttribute(`role`,`group`),t.setAttribute(`aria-roledescription`,c2().chartLabel),t.addEventListener(`keydown`,e=>this._onKey(e)),t.addEventListener(`blur`,()=>this._clearFocus());let n=TM(`div`,{class:`wui-chart-canvas`});n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=TM(`div`,{class:`wui-chart-state`});r.setAttribute(`role`,`status`),r.hidden=!0;let i=TM(`div`,{class:`wui-chart-table-wrap visually-hidden`}),a=TM(`p`,{class:`visually-hidden`});a.id=`${this.uid}-summary`;let o=TM(`div`,{class:`visually-hidden`});o.setAttribute(`aria-live`,`polite`),this.replaceChildren(e,t,r,i,a,o),this.setAttribute(`role`,`figure`),this.setAttribute(`aria-describedby`,a.id),this._parts={legend:e,surface:t,canvas:n,state:r,tableWrap:i,summary:a,live:o},this._legendSignature=null,this._tableSpec=null}_size(e){return{width:this._parts?.surface.clientWidth||this.clientWidth||800,height:e.height}}_update(){if(!this._parts||this._awaitingSpec&&this._spec==null)return;let{spec:e,problem:t}=this._normalized(),n=this._parts,r=e===null?`error`:e.state===`ready`&&(!e.data.length||!cN(e))?`empty`:e.state,i=`${e?.height??320}px`,a=this.view===`table`,o=e!==null&&(r===`ready`||r===`loading`&&this._drawn),s=r===`loading`&&o;if(this.setAttribute(`aria-label`,e?.title||c2().untitledLabel),r===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`),this.setAttribute(`data-state`,r),n.surface.setAttribute(`aria-label`,OM(c2().arrowKeysText,{title:e?.title||c2().untitledLabel})),n.summary.textContent=e?HN(e,this._hidden):``,e){if(!s){let t=new Set(gN(e));for(let e of this._hidden)t.has(e)||this._hidden.delete(e)}this._renderTable(e)}else n.tableWrap.replaceChildren();s||this._renderLegend(e,o&&!a),this._renderState(r,e===null?t:r===`error`?e.errorText:r===`loading`?e.loadingText??c2().loadingText:e.emptyText,i,o);let c=r===`ready`&&!a;s||this.toggleAttribute(`data-ready`,!c);let l=n.surface.hidden&&o&&!a;n.surface.hidden=!o||a,n.surface.style.height=i,n.tableWrap.className=a&&e?`wui-chart-table-wrap`:`wui-chart-table-wrap visually-hidden`,n.tableWrap.style.height=a&&e?i:``,a&&e?(n.tableWrap.tabIndex=0,n.tableWrap.setAttribute(`role`,`region`),n.tableWrap.setAttribute(`aria-label`,`${e.title||c2().untitledLabel} ${c2().dataSuffixLabel}`)):(n.tableWrap.removeAttribute(`tabindex`),n.tableWrap.removeAttribute(`role`),n.tableWrap.removeAttribute(`aria-label`)),l&&this._engine?.resize(),r===`ready`&&!a&&this._visible&&this._draw()}_renderState(e,t,n,r){let i=this._parts?.state;if(!i)return;let a=!r&&e!==`ready`;i.hidden=!a,a?(i.style.height=n,e===`loading`?i.replaceChildren(TM(`div`,{class:`skeleton wui-chart-skeleton`}),TM(`span`,{class:`visually-hidden`},t)):i.replaceChildren(TM(`p`,{class:`wui-chart-state-text`},t))):i.replaceChildren()}_colour(e,t){let n=this._theme;if(!n)return;if(e.type===`donut`)return kN(e,t,n);let r=e.series[t],i=e.type===`line`||e.type===`area`||e.type===`column`||e.type===`bar`;return n.palette[r&&i?NN(r,t):t]}_renderLegend(e,t){let n=this._parts?.legend;if(!n)return;let r=e?gN(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!e||!i)return;let a=_N(e),o=r.map((t,n)=>this._colour(e,n)),s=JSON.stringify([e.type,r,a,o]);s!==this._legendSignature&&(this._legendSignature=s,n.replaceChildren(...r.map((t,n)=>{let r=TM(`button`,{class:`wui-chart-legend-item`});r.type=`button`,r.dataset.key=t;let i=TM(`span`,{class:e.type===`line`?`wui-chart-legend-swatch wui-chart-legend-swatch-line`:`wui-chart-legend-swatch`}),s=o[n];return s!==void 0&&(i.style.background=s),r.append(i,TM(`span`,{class:`wui-chart-legend-label`},a[n])),r})));for(let e of n.children){if(!(e instanceof HTMLElement))throw Error(`Expected a legend item to be an HTMLElement.`);let t=e.dataset.key;e.setAttribute(`aria-pressed`,String(t===void 0||!this._hidden.has(t)))}}_renderTable(e){if(this._tableSpec===e||!this._parts)return;this._tableSpec=e;let t=LN(e),n=TM(`table`,{class:`wui-chart-table`});n.append(TM(`caption`,{class:`visually-hidden`},t.caption));let r=TM(`tr`);t.head.forEach((e,t)=>{let n=TM(`th`,t?{class:`wui-chart-num`}:null,e);n.scope=`col`,r.append(n)});let i=TM(`thead`);i.append(r),n.append(i);let a=TM(`tbody`);for(let e of t.rows){let t=TM(`tr`),n=TM(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>TM(`td`,{class:`wui-chart-num`},e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push(TM(`p`,{class:`wui-chart-table-note`},OM(c2().showingFirstRowsDownloadText,{rows:t.rows.length,total:t.total}))),this._parts.tableWrap.replaceChildren(...o)}_draw(){let{spec:e}=this._normalized();if(!e||!this._parts||!this._theme)return;let t=hN(e),n=e.type!==this._drawnType;this._engine&&this._engine.renderer!==t&&(this._engine.dispose(),this._engine=null);let r=`${e.height}px`,i=this._parts.canvas.style.height!==r;this._parts.canvas.style.height=r,i&&this._engine?.resize(),this._engine||(this._engine=RP(this._parts.canvas,{renderer:t}),this._engine.onSelect(({seriesIndex:e,dataIndex:t})=>this._select(e,t)),this._engine.onFinished(()=>{this.setAttribute(`data-ready`,``),this._announcedReady||(this._announcedReady=!0,this.dispatchEvent(new CustomEvent(d2,{bubbles:!0,detail:{renderer:t}})))}),n=!0),this._engine.render(e,this._theme,this._size(e),{hidden:this._hidden,renderer:t},{replace:n}),this._drawnType=e.type,this._drawn=!0}_themeChanged(e=!1){if(!this._parts)return;let t=JP(this);JSON.stringify(t)!==JSON.stringify(this._theme)&&(this._theme=t,this._update(),e&&this._engine?.flush())}_resized(){let e=this.clientWidth;e!==this._width&&(this._width=e,this._engine&&this._drawn&&this._parts&&(this._parts.surface.hidden||this._engine.resize(),this._update()))}_toggle(e){let{spec:t}=this._normalized();if(!t||e==null)return;this._hidden.has(e)?this._hidden.delete(e):this._hidden.add(e),this._clearFocus(),this._update();let n=Object.fromEntries(gN(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(u2,{bubbles:!0,detail:{visible:n}}))}_onKey(e){let{spec:t}=this._normalized();if(!t||!this._engine||!this._theme||this.view===`table`||e.altKey||e.ctrlKey||e.metaKey)return;if(BP(e)){if(!this._focus)return;e.preventDefault(),this._select(this._focus.series,this._focus.index);return}if(!f2.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=KN(t,this._focus,HP(e.key,VP(this)),this._hidden);n?(this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(FN(AN(t,n.index,this._hidden,this._theme)))):this._clearFocus()}_announce(e){let t=this._parts?.live;t&&(t.textContent=e===t.textContent?`${e} `:e)}_clearFocus(){this._focus&&(this._focus=null,this._engine?.clearFocus(),this._parts&&(this._parts.live.textContent=``))}_select(e,t){let{spec:n}=this._normalized();if(!n)return;let r=n.series[F1(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(l2,{bubbles:!0,detail:{series:r.key,label:r.label,x:i?.[n.x.key]??null,value:K(n,r.key,t),row:i,index:t}}))}},Pa(`wui-chart`,T2)})),D2=null;async function O2(){await Promise.resolve().then(()=>(E2(),Na)),await customElements.whenDefined(`wui-chart`)}async function k2(){return D2??=O2().catch(e=>{throw D2=null,e}),D2}var A2={sub:`wui-chat-sub`,sup:`wui-chat-sup`};function j2(e,t){let n=e.ownerDocument??document;for(let r of t)if(r.kind===`sub`||r.kind===`sup`){let t=n.createElement(r.kind);t.className=A2[r.kind],t.textContent=r.text,e.append(t)}else e.append(n.createTextNode(r.text))}function M2(e,t){e.replaceChildren(),j2(e,un(String(t??``)))}function N2(e){return dn(String(e??``))}function P2(e){return fn(e)}var F2=8,I2=8,L2={Bar:`column`,Line:`line`,Donut:`donut`};function R2(e,t){return e===`Bar`&&t>4?300:240}function z2(e,t){let n=e.chartType===`Donut`,r=n?e.series.slice(0,1):e.series.slice(0,F2),i=r.map((e,n)=>({key:`s${n}`,label:N2(e.name)||t.chart})),a=Object.fromEntries(i.map(e=>[e.key,null])),o=new Map;r.forEach((e,t)=>{for(let n of e.points){let e=String(n.label),r=o.get(e);r===void 0&&(r={label:N2(e),...a},o.set(e,r)),r[`s${t}`]=n.value}});let s=[...o.values()],c={type:L2[e.chartType],title:N2(e.title)||t.chart,x:{key:`label`,kind:`category`},series:i,data:s,height:R2(e.chartType,s.length)};return e.chartType===`Bar`&&s.length<=I2&&(c.x.labelFit=`all`,c.valueLabels=!0),!n&&e.unit&&(c.y={label:N2(e.unit)}),s.length===0&&(c.state=`empty`,c.emptyText=t.chartEmpty),c}ba(`wui-chat-part-chart`,class extends ya{#e=null;#t=0;#n=null;#r=null;#i=null;#a=null;renderPart(e,t,n){let r=JSON.stringify(e);if(r===this.#e)return;this.#e=r,this.#t+=1;let i=this.#t,a=this.ownerDocument??document,o=this.#o(a);if(this.#r?.remove(),this.#r=null,e.title){let t=P(a,`figcaption`,`wui-chat-chart-title`);M2(t,e.title),o.figure.prepend(t),this.#r=t}let s=this.#i;if(s!==null){let t=z2(e,n.labels);Object.assign(s,{spec:t}),this.#s(o,s,t.state!==`empty`,n.labels)}else k2().then(()=>{if(i!==this.#t||!this.isConnected)return;let t=z2(e,n.labels),r=a.createElement(`wui-chart`);Object.assign(r,{spec:t}),this.#i=r,o.body.replaceChildren(r),this.#s(o,r,t.state!==`empty`,n.labels)},()=>{i===this.#t&&this.isConnected&&this.#l(o.body,n.labels)})}disposePart(){this.#t+=1,this.#e=null}#o(e){if(this.#n===null){let t=P(e,`figure`,`wui-chat-chart`),n=P(e,`div`,`wui-chat-chart-body`);t.append(n),this.replaceChildren(t),this.#n={figure:t,body:n}}return this.#n}#s(e,t,n,r){if(!n){this.#a?.remove(),this.#a=null;return}if(!this.#a){let n=P(this.ownerDocument??document,`button`,`btn btn-link btn-sm wui-chat-chart-toggle`);n.type=`button`,n.addEventListener(`click`,()=>this.#c(e,t)),e.figure.append(n),this.#a=n}let i=t.getAttribute(`view`)===`table`;this.#a.setAttribute(`aria-pressed`,String(i)),this.#a.textContent=i?r.chartShowChart:r.chartShowTable}#c(e,t){let n=this.activeTurn,r=t.getAttribute(`view`)!==`table`;t.setAttribute(`view`,r?`table`:`chart`),this.#s(e,t,!0,n.labels)}#l(e,t){let n=P(this.ownerDocument??document,`p`,`wui-chat-chart-error`,t.chartLoadFailed);n.setAttribute(`role`,`status`),e.replaceChildren(n),this.#a?.remove(),this.#a=null}});var B2={Positive:`wui-metric-tone-success`,Caution:`wui-metric-tone-warning`,Negative:`wui-metric-tone-danger`},V2=new Set([`Positive`,`Caution`,`Negative`]),H2=.001;function U2(e,t,n){let r=B2[t.status],i=P(e,`div`,r?`wui-metric ${r}`:`wui-metric`);i.dataset.status=t.status;let a=P(e,`div`,`wui-metric-label`);M2(a,t.label);let o=P(e,`div`,`wui-metric-value`);if(j2(o,t.value!==0&&Math.abs(t.value)<H2?P2(t.value):[{kind:`text`,text:zi(t.value)}]),t.unit){let n=P(e,`span`,`wui-chat-figure-unit`);M2(n,t.unit),n.prepend(` `),o.append(n)}return V2.has(t.status)&&o.append(P(e,`span`,`visually-hidden`,n.figureStatus(t.status))),i.append(a,o),i}ba(`wui-chat-part-figures`,class extends ya{#e=null;renderPart(e,t,n){let r=JSON.stringify(e);if(r===this.#e)return;if(this.#e=r,!e.figures||e.figures.length===0){this.replaceChildren();return}let i=this.ownerDocument??document,a=P(i,`div`,`wui-chat-figures`),o=P(i,`div`,`wui-metric-strip wui-metric-strip-sm wui-chat-figures-strip`);o.setAttribute(`role`,`group`),o.setAttribute(`aria-label`,n.labels.figures);for(let t of e.figures)o.append(U2(i,t,n.labels));a.append(o),this.replaceChildren(a)}}),ba(`wui-chat-part-file`,class extends ya{renderPart(e,t,n){let r=n.openAttachment,i=typeof r==`function`,a=document.createElement(i?`button`:`span`);a.className=`wui-chat-file-chip`,i&&(a.setAttribute(`type`,`button`),a.setAttribute(`aria-label`,n.labels.fileOpen(e.fileName)),a.addEventListener(`click`,()=>r(e)));let o=xa(document,`document-text`,16),s=document.createElement(`span`);s.className=`wui-chat-file-name`,s.textContent=e.fileName;let c=document.createElement(`span`);c.className=`wui-chat-file-size`,c.textContent=Qn(e.length),a.append(...[o,s,c].filter(e=>e!==null));let l=document.createElement(`div`);l.className=`wui-chat-file`,l.append(a),this.replaceChildren(l)}});var W2=`(prefers-reduced-motion: reduce)`;function G2(e,t){let n=e.style.animation;e.style.animation=`none`;let r=e.getBoundingClientRect();e.style.animation=n,e.style.transformOrigin=`${t.left+t.width/2-r.left}px ${t.top+t.height/2-r.top}px`}function K2(e,t){let n=typeof window.matchMedia==`function`?window.matchMedia(W2):null,r=new Set,i=()=>e.motion===`Reduced`||t?.motion===!1||n?.matches===!0,a=i();function o(){let e=i();if(e!==a){a=e;for(let e of r)e(a)}}return n?.addEventListener(`change`,o),{get reduced(){return a},subscribe(e){return r.add(e),()=>{r.delete(e)}},destroy(){n?.removeEventListener(`change`,o),r.clear()}}}var q2=`AppButton`,J2={primary:`btn-primary`,secondary:`btn-soft-primary`,ghost:`btn-ghost-primary`,outline:`btn-outline-primary`,neutral:`btn-soft-neutral`,danger:`btn-danger`};function Y2(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function $(e,t,n){let r=document.createElement(e);if(t&&(r.className=t),n)for(let[e,t]of Object.entries(n))t!=null&&r.setAttribute(e,t);return r}function X2(e,t=16){return Xi(e,{size:t})??$(`span`,`d-inline-flex`)}function Z2(e=`primary`,t=`md`){if(!Y2(J2,e))throw Error(`Unknown button variant "${e}". Use one of ${Object.keys(J2).join(`, `)}.`);return`btn ${J2[e]}${t===`sm`?` btn-sm`:``}`}function Q2(e,t,n,r){let i=$(`button`,`${Z2(e,`sm`)} wui-chat-action-btn`,{type:`button`});return i.dataset.wui=q2,n&&i.append(X2(n,14)),i.append(document.createTextNode(t)),i.addEventListener(`click`,r),i}function $2(e,t,n){let r=$(`button`,`wui-chat-icon-btn`,{type:`button`,"aria-label":e,title:e});return r.append(X2(t,20)),r.addEventListener(`click`,n),r}function e4(e,t){let n=e.getAttribute(t);if(n!=null&&n!==``)try{return JSON.parse(n)}catch{throw Error(`<wui-chat ${t}> must be valid JSON.`)}}function t4(e){let t;return n=>{let r=e.dataset.state;if((!n||r!==`open`&&r!==`opening`)&&(n||r!==`closed`&&r!==`closing`)){if(clearTimeout(t),n)e.dataset.state=`opening`,t=setTimeout(()=>{e.dataset.state=`open`},620);else{e.dataset.state=`closing`;let n=e.classList.contains(`wui-chat--panel-motion-none`)?0:300;t=setTimeout(()=>{e.dataset.state=`closed`},n)}}}}function n4(e,t){t.position!==void 0&&(e.classList.toggle(`wui-chat--end`,t.position===`end`),e.classList.toggle(`wui-chat--start`,t.position===`start`)),t.reduced!==void 0&&e.classList.toggle(`wui-chat--reduced`,!!t.reduced),t.expressive!==void 0&&e.classList.toggle(`wui-chat--expressive`,t.expressive===!0),t.sendReveal!==void 0&&e.classList.toggle(`wui-chat--send-always`,t.sendReveal===`Always`),t.inputRing!==void 0&&e.classList.toggle(`wui-chat--input-ring-off`,t.inputRing===!1),t.panelMotion!==void 0&&(e.classList.toggle(`wui-chat--panel-motion-gentle`,t.panelMotion===`Gentle`),e.classList.toggle(`wui-chat--panel-motion-none`,t.panelMotion===`None`)),t.offsetX!==void 0&&e.style.setProperty(`--wui-chat-offset-x`,`${t.offsetX}px`),t.offsetY!==void 0&&e.style.setProperty(`--wui-chat-offset-y`,`${t.offsetY}px`),t.width!==void 0&&e.style.setProperty(`--wui-chat-width`,t.width),t.maxHeight!==void 0&&e.style.setProperty(`--wui-chat-panel-max-height`,`${t.maxHeight}px`),t.bottomGap!==void 0&&e.style.setProperty(`--wui-chat-bottom-gap`,`${t.bottomGap}px`),t.panelHeight!==void 0&&e.classList.toggle(`wui-chat--panel-height-content`,t.panelHeight===`Content`),t.avatar!==void 0&&(t.avatar?(e.style.setProperty(`--wui-chat-avatar`,`url(${JSON.stringify(t.avatar)})`),e.style.setProperty(`--wui-chat-typing-mark`,`url(${JSON.stringify(t.avatar)})`)):(e.style.removeProperty(`--wui-chat-avatar`),e.style.removeProperty(`--wui-chat-typing-mark`))),t.replyAvatars!==void 0&&e.classList.toggle(`wui-chat--reply-avatars-off`,t.replyAvatars===!1)}var r4=[`Text`,`Sources`,`QuickReplies`,`InputRequest`,`Action`,`Notice`,`Table`,`Chart`,`Figures`,`RecordCard`,`Image`,`File`,`Ticket`,`Handoff`,`VoiceClip`],i4={launcher:`wui-chat--launcher`,docked:`wui-chat--docked`,"full-page":`wui-chat--full-page`,embedded:`wui-chat--embedded`};function a4(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function o4({id:e,layout:t,position:n,role:r,launcher:i,onToggle:a}){let o=$(`div`,`wui-chat ${i4[t]} wui-chat--${n}`),s=$(`section`,`wui-chat-panel`,{id:e,role:r}),c=i?t4(o):null;o.dataset.state=i?`closed`:`open`;let l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=`round`,_=!1,v=`bubble`,y=null,b=null,x=!1,S=`icon`,C=!1;function w(){if(!l)return;let e=l.dataset.launcher,t=[`wui-chat-launcher-wrap`];e===`entering`&&y&&t.push(`wui-chat-launcher--entrance-${y}`),e===`idle`&&b&&b!==`none`&&(b!==`ring`||g===`pill`)&&t.push(`wui-chat-launcher--idle-${b}`),l.className=t.join(` `)}function T(){if(!u)return;let e=[...u.classList].filter(e=>e.endsWith(`--opening`)||e.endsWith(`--closing`)),t=[`wui-chat-launcher`,`wui-chat-launcher--${g}`];g===`pill`&&_&&t.push(`wui-chat-launcher--compact`),S!==`icon`&&t.push(`wui-chat-launcher--mark-${S}`),t.push(`wui-chat-launcher--reveal-${v}`,...e),u.className=t.join(` `)}function E(){p&&m&&(p.textContent=h||m.launcher)}function D(){if(!u||!f||!m)return;let e=C?m.launcherClose:h||m.launcher;u.setAttribute(`aria-label`,e),f.textContent=e}if(i){let t=$(`div`,`wui-chat-launcher-wrap`);l=t,t.dataset.launcher=`idle`;let n=$(`button`,`wui-chat-launcher`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-controls":e});u=n;let r=$(`span`,`wui-chat-launcher-icon`,{"aria-hidden":`true`});d=r,r.append(X2(`chat`,24));let i=$(`span`,`wui-chat-launcher-close`,{"aria-hidden":`true`});i.append(X2(`x`,24));let c=$(`span`,`wui-chat-launcher-label`);f=c,n.append(r,i,c),n.addEventListener(`click`,()=>a()),n.addEventListener(`animationend`,e=>{e.target===n&&n.classList.remove(`wui-chat-launcher--opening`,`wui-chat-launcher--closing`)});let m=$(`span`,`wui-chat-launcher-bubble`,{"aria-hidden":`true`});p=m,t.append(n,m),t.addEventListener(`animationend`,e=>{e.target===t&&t.dataset.launcher===`entering`&&(t.dataset.launcher=`idle`,w())}),T(),w(),o.append(t,s)}else o.append(s);function O(e){if(!c)return;let t=e&&!C&&u!==null&&u?u.getBoundingClientRect():null;e!==C&&u&&(u.classList.remove(`wui-chat-launcher--opening`,`wui-chat-launcher--closing`),u.classList.add(e?`wui-chat-launcher--opening`:`wui-chat-launcher--closing`)),C=e,c(e),t&&G2(s,t),u&&(u.setAttribute(`aria-expanded`,String(e)),D())}function k(e){m=e,u&&(D(),E())}function A(e){if(n4(o,e),e.theme!==void 0&&(e.theme===`light`||e.theme===`dark`?o.dataset.theme=e.theme:delete o.dataset.theme),!u||!l||!d)return;e.launcherStyle!==void 0&&(g=e.launcherStyle===`Pill`?`pill`:`round`),e.compact!==void 0&&(_=e.compact),e.labelReveal!==void 0&&(v=e.labelReveal===`Expand`?`expand`:`bubble`),e.entrance!==void 0&&(y=e.entrance===`None`?null:a4(e.entrance)),e.idle!==void 0&&(b=e.idle===`None`?`none`:a4(e.idle)),e.phone!==void 0&&(x=e.phone),e.hoverLabel!==void 0&&(h=e.hoverLabel||null),e.launcherMark!==void 0&&(S=a4(e.launcherMark)),e.icon!==void 0&&e.icon!==d.dataset.icon&&(d.dataset.icon=e.icon,d.replaceChildren(X2(e.icon,24)));let t=e.launcherState??l.dataset.launcher;x&&t===`entering`&&(t=`idle`),t===`entering`&&!y&&(t=`idle`),l.dataset.launcher=t,T(),w(),E(),D()}return{root:o,panel:s,setOpen:O,setLabels:k,setAppearance:A,nudgeHost:l,launcherButton:u,role:r}}var s4={Open:`info`,InProgress:`info`,WaitingOnCustomer:`warning`,Resolved:`success`,Closed:`neutral`,Cancelled:`neutral`},c4=/^\/[/\\]/,l4=/^https?:\/\//i,u4=/[\t\r\n]/g;function d4(e){return typeof e==`string`&&e.trim()!==``}function f4(e){return e.replace(u4,``)}function p4(e){if(typeof e!=`string`)return!1;let t=f4(e);return t.startsWith(`/`)?!c4.test(t):l4.test(t)}function m4(e){if(typeof e!=`string`)return`?`;let t=e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>([...e][0]??``).toUpperCase()).join(``);return t===``?`?`:t}function h4(e,t){let n=e?.displayName,r=m4(d4(n)?n:t),i=$(`span`,`wui-chat-avatar`,{"aria-hidden":`true`}),a=e?.avatarUrl,o=typeof a==`string`?f4(a):null;if(p4(o)){let e=$(`img`,null,{alt:``,src:o,loading:`lazy`});e.addEventListener(`error`,()=>{i.textContent=r}),i.append(e)}else i.textContent=r;return i}function g4(e,t){let n=$(`div`,`wui-chat-agent-head`),r=$(`span`,`wui-chat-agent-name`),i=e?.displayName;r.textContent=d4(i)?i:t.agent;let a=$(`span`,`wui-chat-agent-role wui-chat-agent-tag`);return a.textContent=t.agent,n.append(h4(e,t.agent),r,a),n}function _4(e,t){let n=e.displayName,r=$(`li`,`wui-chat-message wui-chat-message--agent wui-chat-message--typing`),i=$(`span`,`wui-chat-typing`);for(let e=0;e<3;e+=1)i.append($(`span`,`wui-chat-typing-dot`,{"aria-hidden":`true`}));let a=$(`span`,`visually-hidden`);return a.textContent=t.agentTyping(d4(n)?n:t.agent),r.append(g4({kind:`Agent`,displayName:n,avatarUrl:null},t),i,a),r}function v4(e){return typeof e==`string`&&Y2(s4,e)?s4[e]??null:null}function y4(e,t){return v4(e)===null?``:t.ticketStatus(e)}var b4=new Set([`Requested`,`Waiting`]),x4=new Set([`Requested`,`Waiting`,`Joined`]),S4=x4;function C4(e,t){let n=e?.displayName;return typeof n==`string`&&n.trim()!==``?n:t.handoffAgentFallback}function w4(){let e=$(`div`,`wui-chat-handoff-pulses`);for(let t=0;t<3;t+=1)e.append($(`span`,`wui-chat-handoff-pulse`,{"aria-hidden":`true`}));return e}function T4(e,t,n){let r=$(e,t);return r.textContent=n,r}function E4(e,t){let n=$(`div`,`wui-chat-handoff-body`);return n.append(T4(`strong`,`wui-chat-handoff-title`,e),T4(`p`,`wui-chat-handoff-text`,t)),n}function D4(e,t){if(typeof e.queuePosition!=`number`){let e=$(`span`,`wui-chat-system-line-stack`);return e.append(T4(`p`,`wui-chat-handoff-text`,t.handoffWaiting),T4(`p`,`wui-chat-handoff-text`,t.handoffQueuedText)),[w4(),e]}let n=$(`span`,`wui-chat-handoff-position`,{"aria-hidden":`true`});return n.textContent=String(e.queuePosition),[n,E4(t.handoffQueued(e.queuePosition),t.handoffQueuedText)]}function O4(e,t){let n=C4(e.agent,t),r=$(`span`,`wui-chat-handoff-agent`);return r.append(h4(e.agent,t.handoffAgentFallback),$(`span`,`wui-chat-handoff-online`,{"aria-hidden":`true`})),[r,E4(t.handoffJoined(n),t.handoffJoinedText(n))]}function k4(e,t){switch(e.state){case`Requested`:return[w4(),T4(`p`,`wui-chat-handoff-text`,t.handoffRequested)];case`Waiting`:return D4(e,t);case`Joined`:return O4(e,t);case`Left`:return[E4(t.handoffLeft(C4(e.agent,t)),t.handoffLeftText)];case`Ended`:return[E4(t.handoffEnded,t.handoffEndedText)];default:return null}}ba(`wui-chat-part-handoff`,class extends ya{_signature;constructor(){super(),this._signature=null}renderPart(e,t,n){let r=n.isLast,i=n.handoffSettled===!0&&b4.has(e.state),a=JSON.stringify([e.state,e.queuePosition,e.agent,r,n.features.HumanHandoff,n.busy,i]);if(a===this._signature)return;if(this._signature=a,i){this.replaceChildren();return}let o=k4(e,n.labels);if(o===null){this.replaceChildren();return}let s=$(`div`,`wui-chat-handoff wui-chat-handoff--${e.state.toLowerCase()}`);if(r&&b4.has(e.state)&&s.classList.add(`wui-chat-handoff--live`),r&&x4.has(e.state)&&s.setAttribute(`role`,`status`),S4.has(e.state)){s.classList.add(`wui-chat-system-line`);let e=$(`span`,`wui-chat-system-line-content`);e.append(...o),s.append(e)}else s.append(...o);this.replaceChildren(s)}});function A4(e,t){if(typeof customElements>`u`||customElements.get(e))return;let n=[];if(typeof document<`u`)for(let r of document.querySelectorAll(e))for(let i of Object.keys(r)){let a=Object.getOwnPropertyDescriptor(t.prototype,i);if(a&&(a.set||a.get)&&(n.push([r,i,Reflect.get(r,i)]),!Reflect.deleteProperty(r,i)))throw Error(`defineElement: could not clear the early "${i}" property on <${e}>.`)}customElements.define(e,t);for(let[t,r,i]of n)if(!Reflect.set(t,r,i))throw Error(`defineElement: could not restore the "${r}" property on <${e}>.`)}var j4=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(j4);var M4=HTMLElement,N4={closeLabel:`Close`,countText:`{position} of {total}`,downloadLabel:`Download`,imageFailedMessage:`This image can't be shown.`,label:`Image viewer`,nextImageLabel:`Next image`,previousImageLabel:`Previous image`,zoomInLabel:`Zoom in`,zoomOutLabel:`Zoom out`},P4=`a.wui-lightbox-item`,F4=1,I4=4,L4=.5,R4=2,z4=50,B4=6,V4=300,H4=300;function U4(e){return Number.isFinite(e)?Math.min(I4,Math.max(F4,e)):F4}function W4(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function G4(e,t){return Math.abs(e)<z4||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function K4(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}var q4=()=>Ti(`lightbox`,N4);function J4(e,t,n){let r=ki(`button`,{class:`u-action wui-lightbox-btn ${n}`,type:`button`,"aria-label":t,title:t});r.style.setProperty(`--wui-action-size`,`40px`);let i=Xi(e,{size:20});return r.replaceChildren(...i?[i]:[]),r}A4(`wui-lightbox`,class extends M4{_ui;_index;_zoom;_pan;_pointers;_gesture;_lastTap;_returnTo;_release;_onClick;static get observedAttributes(){return[`open-index`]}constructor(){super(),this._ui=null,this._index=0,this._zoom=F4,this._pan={x:0,y:0},this._pointers=new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._release=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target,n=t instanceof Element?t.closest(P4):null;if(!(n instanceof HTMLAnchorElement)||!this.contains(n))return;let r=this._links().indexOf(n);r<0||(e.preventDefault(),this.open(r))}}get _view(){if(!this._ui)throw Error(`<wui-lightbox> viewer is not open.`);return this._ui}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||q4().label}set label(e){this.setAttribute(`label`,String(e??``))}get layout(){return this.getAttribute(`layout`)===`single`?`single`:`gallery`}set layout(e){if(e===`single`)this.setAttribute(`layout`,`single`);else if(e===`gallery`||e===``)this.removeAttribute(`layout`);else throw Error(`<wui-lightbox> layout must be "gallery" or "single", received "${e}".`)}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick),this._syncOpenIndex()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}attributeChangedCallback(){this.isConnected&&this._syncOpenIndex()}_syncOpenIndex(){let e=this.getAttribute(`open-index`);e===null?this.close():this.open(Number(e))}_links(){return[...this.querySelectorAll(P4)].filter(e=>e instanceof HTMLAnchorElement)}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||K4(t)}})}open(e=0){let t=this._items();if(!t.length)return!1;if(!this._ui){let t=document.activeElement;this._returnTo=t instanceof HTMLElement||t instanceof SVGElement?t:null,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))}return this._show(e,t),!0}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._release?.(),this._release=null,this._ui.root.open&&this._ui.root.close(),this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null)}_build(){let e=ki(`dialog`,{class:`wui-lightbox-overlay`,role:`dialog`,"aria-label":this.label,tabindex:`-1`}),t=ki(`div`,{class:`wui-lightbox-bar`}),n=ki(`span`,{class:`wui-lightbox-count`,"aria-live":`polite`}),r=ki(`div`,{class:`wui-lightbox-tools`}),i=J4(`zoom-out`,q4().zoomOutLabel,`wui-lightbox-zoom-out`),a=J4(`zoom-in`,q4().zoomInLabel,`wui-lightbox-zoom-in`),o=ki(`a`,{class:`u-action wui-lightbox-btn wui-lightbox-download`,"aria-label":q4().downloadLabel,title:q4().downloadLabel});o.style.setProperty(`--wui-action-size`,`40px`);let s=Xi(`download`,{size:20});o.replaceChildren(...s?[s]:[]),o.hidden=!this.download;let c=J4(`x`,q4().closeLabel,`wui-lightbox-close`);r.append(i,a,o,c),t.append(n,r);let l=ki(`div`,{class:`wui-lightbox-stage`}),u=J4(`chevron-left`,q4().previousImageLabel,`wui-lightbox-nav wui-lightbox-prev`),d=J4(`chevron-right`,q4().nextImageLabel,`wui-lightbox-nav wui-lightbox-next`),f=ki(`img`,{class:`wui-lightbox-image`,decoding:`async`,draggable:`false`,alt:``}),p=ki(`p`,{class:`wui-lightbox-status`,role:`status`});l.append(f,p,u,d);let m=ki(`p`,{class:`wui-lightbox-caption`});e.append(t,l,m);let h={root:e,count:n,zoomOut:i,zoomIn:a,download:o,close:c,stage:l,prev:u,next:d,image:f,status:p,caption:m};this._ui=h,c.addEventListener(`click`,()=>this.close()),u.addEventListener(`click`,()=>this.step(-1)),d.addEventListener(`click`,()=>this.step(1)),i.addEventListener(`click`,()=>this._setZoom(this._zoom-L4)),a.addEventListener(`click`,()=>this._setZoom(this._zoom+L4)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),l.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),l.addEventListener(`pointermove`,e=>this._onPointerMove(e)),l.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),l.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),l.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),f.addEventListener(`load`,()=>{this._ui===h&&(p.textContent=``,l.removeAttribute(`aria-busy`),f.hidden=!1,this._applyTransform())}),f.addEventListener(`error`,()=>{this._ui===h&&(l.removeAttribute(`aria-busy`),f.hidden=!0,p.textContent=q4().imageFailedMessage)}),this.append(e),this._release=ma(e,{escape:!0,backdrop:!1,focus:`panel`,onRequestClose:()=>this.close()})}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,t){let n=this._view,r=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),i=t[r];if(!i)throw Error(`<wui-lightbox> image missing.`);let a=r!==this._index||!n.image.getAttribute(`src`);if(this._index=r,this._zoom=F4,this._pan={x:0,y:0},n.count.textContent=aee(q4().countText,{position:zi(r+1,{decimals:0}),total:zi(t.length,{decimals:0})}),n.caption.textContent=i.caption,n.caption.hidden=!i.caption,n.download.href=i.src,n.download.setAttribute(`download`,i.name),n.prev.hidden=n.next.hidden=t.length<2,n.stage.setAttribute(`aria-busy`,`true`),n.status.textContent=``,n.image.hidden=!1,n.image.alt=i.alt||i.caption,n.image.src=i.src,this._applyTransform(),this._syncZoomButtons(),t.length>1){let e=t[(r+1)%t.length],n=t[(r-1+t.length)%t.length];if(!e||!n)throw Error(`<wui-lightbox> neighbour image missing.`);for(let t of[e,n])new Image().src=t.src}a&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:r}}))}_syncZoomButtons(){let e=this._view;e.zoomOut.disabled=this._zoom<=F4,e.zoomIn.disabled=this._zoom>=I4;let t=document.activeElement;(t===e.zoomOut||t===e.zoomIn)&&t instanceof HTMLButtonElement&&t.disabled&&e.close.focus()}_setZoom(e){this._ui&&(this._zoom=U4(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._view;return W4(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._view;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>F4)}_onKeyDown(e){let t=ea(e.key,$i(this));if(t===`ArrowLeft`||t===`ArrowRight`)e.preventDefault(),this.step(t===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+L4)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-L4)):e.key===`0`&&(e.preventDefault(),this._setZoom(F4))}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){let t=e.target;if(t instanceof Element&&t.closest(`.wui-lightbox-nav`))return;let n=this._view;if(n.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let e=[...this._pointers.values()],t=e[0],n=e[1];if(!t||!n)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._gesture={kind:`pinch`,distance:Math.hypot(t.x-n.x,t.y-n.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===n.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(t&&this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let e=[...this._pointers.values()],n=e[0],r=e[1];if(!n||!r)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._setZoom(t.zoom*Math.hypot(n.x-r.x,n.y-r.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>B4&&(t.moved=!0),this._zoom>F4&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._view.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved?this._zoom===F4&&this.step(G4(r,i)):e.timeStamp-n.startTime>V4||(n.onImage?e.timeStamp-this._lastTap<H4?(this._lastTap=-1/0,this._setZoom(this._zoom>F4?F4:R4)):this._lastTap=e.timeStamp:this.close())}}),ba(`wui-chat-part-image`,class extends ya{#e=null;#t=0;#n=null;renderPart(e,t,n){if(e.attachmentId===this.#e)return;this.#e=e.attachmentId;let r=this.ownerDocument??document,i=P(r,`figure`,`wui-chat-image`),a=P(r,`div`,`wui-chat-image-frame`);this.#n=a;let{width:o,height:s}=e;o!==null&&s!==null&&Number.isFinite(o)&&Number.isFinite(s)&&o>0&&s>0&&(a.style.aspectRatio=`${o} / ${s}`),i.append(a),this.replaceChildren(i),this.#r(e,n)}disposePart(){this.#t+=1,this.#e=null}#r(e,t){this.#t+=1;let n=this.#t,r=this.ownerDocument??document,i=this.#n;if(i===null)return;let a=P(r,`div`,`wui-chat-image-skeleton`);a.setAttribute(`aria-hidden`,`true`);let o=P(r,`span`,`visually-hidden`,t.labels.imageLoading);o.setAttribute(`role`,`status`),i.replaceChildren(a,o),typeof t.loadAttachmentUrl==`function`?t.loadAttachmentUrl(e.attachmentId).then(r=>{n===this.#t&&this.isConnected&&this.#i(r,e,t)},()=>{n===this.#t&&this.isConnected&&this.#a(e,t)}):this.#a(e,t)}#i(e,t,n){let r=this.#n;if(r===null)return;let i=this.ownerDocument??document,a=N2(t.alt),o=i.createElement(`wui-lightbox`);o.setAttribute(`label`,n.labels.imageViewer),o.setAttribute(`layout`,`single`);let s=P(i,`a`,`wui-lightbox-item`);s.setAttribute(`href`,e),s.dataset.caption=a,s.dataset.name=a;let c=i.createElement(`img`);c.src=e,c.alt=a,c.decoding=`async`,s.append(c),o.append(s),r.replaceChildren(o)}#a(e,t){let n=this.#n;if(n===null)return;let r=this.ownerDocument??document,i=P(r,`p`,`wui-chat-image-error`,t.labels.imageFailed);i.setAttribute(`role`,`status`);let a=P(r,`button`,`btn btn-soft-primary btn-sm`,t.labels.retry);a.type=`button`,a.addEventListener(`click`,()=>this.#r(e,t)),n.replaceChildren(i,a)}});var Y4={Email:{type:`email`,autocomplete:`email`},Phone:{type:`tel`,autocomplete:`tel`},Name:{type:`text`,autocomplete:`name`},Company:{type:`text`,autocomplete:`organization`},Text:{type:`text`,autocomplete:null},LongText:{type:`text`,autocomplete:null}},X4=[`Open`,`Answered`,`Skipped`,`Expired`],Z4=0;function Q4(e){return Z4+=1,`${e}-${Z4}`}function $4(e,t,n){let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.textContent=n),r}function e3(){let e=$4(`p`,`wui-chat-field-error`);return e.id=Q4(`wui-chat-field-error`),e.setAttribute(`role`,`alert`),e.hidden=!0,e}function t3(e,t){return e.required?[]:[$4(`span`,`wui-chat-field-hint`,t.inputOptional)]}function n3(e,t,n){let r=Q4(`wui-chat-field`),i=Y4[t],a=t===`LongText`&&!e.secret,o;if(a){let e=$4(`textarea`,`form-control wui-chat-input-control`);e.rows=3,o=e}else{let t=$4(`input`,`form-control wui-chat-input-control`);t.type=e.secret?`password`:i.type,e.secret?t.autocomplete=`off`:i.autocomplete&&(t.autocomplete=i.autocomplete),o=t}o.id=r,o.name=e.key,e.placeholder!=null&&(o.placeholder=e.placeholder),e.maxLength!=null&&(o.maxLength=e.maxLength),e.required&&o.setAttribute(`aria-required`,`true`);let s=$4(`label`,`form-label`,e.label);s.htmlFor=r;let c=e3();o.setAttribute(`aria-describedby`,c.id);let l=$4(`div`,`wui-chat-field`);return l.dataset.key=e.key,l.append(s,...t3(e,n),o,c),{field:e,element:l,controls:[o],focus:o,invalid:o,error:c,control:o,read:()=>e.secret?o.value:o.value.trim()}}function r3(e,t,n,r,i){let a=e.control,o=$4(`button`,`btn btn-soft-primary`,n.inputSendCode);o.type=`button`,o.dataset.wui=`AppButton`;let s=$4(`p`,`wui-chat-field-hint`);s.setAttribute(`aria-live`,`polite`);let c=Q4(`wui-chat-field`),l=$4(`label`,`form-label`,n.inputEnterCode);l.htmlFor=c,l.hidden=!0;let u=$4(`input`,`form-control wui-chat-input-control`);return u.type=`text`,u.id=c,u.inputMode=`numeric`,u.autocomplete=`one-time-code`,u.hidden=!0,o.addEventListener(`click`,async()=>{o.disabled=!0;try{await r.sendOtp(i,{fieldKey:t.key,value:a.value.trim()}),s.textContent=n.inputCodeSent,l.hidden=!1,u.hidden=!1}catch{s.textContent=n.inputCodeFailed}finally{o.disabled=!1}}),e.element.insertBefore(o,e.error),e.element.insertBefore(s,e.error),e.element.insertBefore(l,e.error),e.element.insertBefore(u,e.error),{...e,controls:[...e.controls,o,u],codeRead:()=>u.value.trim()}}function i3(e,t){let n=Q4(`wui-chat-field-label`),r=$4(`span`,`form-label`,e.label);r.id=n;let i=$4(`div`);i.setAttribute(`role`,`radiogroup`),i.setAttribute(`aria-labelledby`,n);let a=e3();i.setAttribute(`aria-describedby`,a.id);let o=[];for(let t of e.options??[]){let n=$4(`div`,`form-check`),r=$4(`input`,`form-check-input`);r.type=`radio`,r.name=e.key,r.value=t.id,r.id=Q4(`wui-chat-option`);let a=$4(`label`,`form-check-label`,t.label);a.htmlFor=r.id,n.append(r,a),i.append(n),o.push(r)}o.length===0&&(i.tabIndex=-1);let s=$4(`div`,`wui-chat-field`);return s.dataset.key=e.key,s.append(r,...t3(e,t),i,a),{field:e,element:s,controls:o,focus:o[0]??i,invalid:i,error:a,read:()=>o.find(e=>e.checked)?.value??``}}function a3(e,t){let n=Q4(`wui-chat-field-label`),r=$4(`span`,`form-label`,e.label);r.id=n;let i=$4(`div`,`wui-chat-input-choices`);i.setAttribute(`role`,`group`),i.setAttribute(`aria-labelledby`,n);let a=e3();i.setAttribute(`aria-describedby`,a.id);let o=[];for(let t of e.options??[]){let n=$4(`div`,`form-check`),r=$4(`input`,`form-check-input`);r.type=`checkbox`,r.name=e.key,r.value=t.id,r.id=Q4(`wui-chat-option`);let a=$4(`label`,`form-check-label`,t.label);a.htmlFor=r.id,n.append(r,a),i.append(n),o.push(r)}o.length===0&&(i.tabIndex=-1);let s=$4(`div`,`wui-chat-field`);return s.dataset.key=e.key,s.append(r,...t3(e,t),i,a),{field:e,element:s,controls:o,focus:o[0]??i,invalid:i,error:a,read:()=>JSON.stringify(o.filter(e=>e.checked).map(e=>e.value))}}function o3(e,t){let n=Q4(`wui-chat-field-label`),r=$4(`span`,`form-label`,e.label);r.id=n;let i=$4(`div`,`wui-chat-input-slots`);i.setAttribute(`role`,`radiogroup`),i.setAttribute(`aria-labelledby`,n);let a=e3();i.setAttribute(`aria-describedby`,a.id);let o=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`}),s=[];for(let t of e.slots??[]){let n=$4(`input`,`wui-chat-input-slot-radio`);n.type=`radio`,n.name=e.key,n.value=t.id,n.id=Q4(`wui-chat-slot`);let r=$4(`label`,`btn btn-soft-primary wui-chat-input-slot`,o.format(new Date(t.startDateTimeUtc)));r.htmlFor=n.id,i.append(n,r),s.push(n)}s.length===0&&(i.tabIndex=-1);let c=$4(`div`,`wui-chat-field`);return c.dataset.key=e.key,c.append(r,...t3(e,t),i,a),{field:e,element:c,controls:s,focus:s[0]??i,invalid:i,error:a,read:()=>s.find(e=>e.checked)?.value??``}}function s3(e,t,n){let r=Q4(`wui-chat-field-label`),i=$4(`span`,`form-label`,e.label);i.id=r;let a=e3(),o=$4(`input`);o.type=`file`,o.name=e.key,o.id=Q4(`wui-chat-field`),o.hidden=!0,e.accept?.length&&(o.accept=e.accept.join(`,`));let s=$4(`button`,`btn btn-soft-primary`,t.inputChooseFile);s.type=`button`,s.dataset.wui=`AppButton`,s.setAttribute(`aria-describedby`,a.id),s.addEventListener(`click`,()=>o.click());let c=$4(`span`,`wui-chat-input-file-status`);c.setAttribute(`aria-live`,`polite`);let l=$4(`button`,`btn btn-link-primary`);l.type=`button`,l.dataset.wui=`AppButton`,l.hidden=!0;let u=$4(`div`,`wui-chat-input-file`);u.setAttribute(`role`,`group`),u.setAttribute(`aria-labelledby`,r),u.append(s,c,l,o);let d=`empty`,f=``,p=``,m=0,h=()=>{c.textContent=d===`uploading`?`${t.attachmentUploading} ${f}`:f,l.hidden=f===``,l.textContent=f===``?``:t.inputRemoveFile(f);let e=d===`failed`;a.textContent=e?t.attachmentFailed:``,a.hidden=!e,e?u.setAttribute(`aria-invalid`,`true`):u.removeAttribute(`aria-invalid`)},g=async e=>{m+=1;let t=m;d=`uploading`,f=e.name,p=``,h();try{let r=await n.uploadInputFile(e);if(t!==m)return;p=r,d=`ready`}catch{if(t!==m)return;d=`failed`}h()};o.addEventListener(`change`,()=>{let e=o.files?.[0];e&&g(e)}),l.addEventListener(`click`,()=>{m+=1,d=`empty`,f=``,p=``,o.value=``,h()}),h();let _=$4(`div`,`wui-chat-field`);return _.dataset.key=e.key,_.append(i,...t3(e,t),u,a),{field:e,element:_,controls:[s,l,o],focus:s,invalid:u,error:a,read:()=>d===`ready`?p:``,uploadProblem:()=>d===`uploading`?t.attachmentUploading:d===`failed`?t.attachmentFailed:null}}function c3(e){let t=$4(`input`,`form-check-input`);t.type=`checkbox`,t.name=e.key,t.id=Q4(`wui-chat-field`);let n=$4(`label`,`form-check-label`,e.consentText||e.label);n.htmlFor=t.id;let r=e3();t.setAttribute(`aria-describedby`,r.id);let i=$4(`div`,`form-check`);i.append(t,n);let a=$4(`div`,`wui-chat-field`);return a.dataset.key=e.key,a.append(i,r),{field:e,element:a,controls:[t],focus:t,invalid:t,error:r,read:()=>t.checked?`true`:`false`}}function l3(e,t,n,r){if(e.type===`Choice`)return i3(e,t);if(e.type===`MultiChoice`)return a3(e,t);if(e.type===`TimeSlot`)return o3(e,t);if(e.type===`File`)return s3(e,t,n);if(e.type===`Consent`)return c3(e);let i=n3(e,e.type,t);return e.verify===`Otp`?r3(i,e,t,n,r):i}function u3(e,t,n){let r=e.uploadProblem?.();if(r)return r;let{field:i}=e;return i.required?i.type===`Consent`?t===`true`?null:n.inputConsentRequired:i.type===`MultiChoice`?t===`[]`?n.inputRequired:null:t===``?n.inputRequired:null:null}function d3(e,t){return e.state===`Answered`?$4(`p`,`wui-chat-input-summary`,e.answeredSummary||t.inputAnswered):$4(`p`,`wui-chat-input-summary`,e.state===`Skipped`?t.inputSkipped:t.inputExpired)}ba(`wui-chat-part-input-request`,class extends ya{_signature;_generation;constructor(){super(),this._signature=null,this._generation=0}renderPart(e,t,n){for(let t of X4)this.classList.toggle(`wui-chat-input-request--${t.toLowerCase()}`,e.state===t);let r=JSON.stringify([e.requestId,e.state,e.answeredSummary,e.fields]);r!==this._signature&&(this._signature=r,this._generation+=1,this.replaceChildren(this._content(e,n)))}_content(e,t){return e.state===`Open`?this._form(e,this._generation):d3(e,t.labels)}_form(e,t){let n=this.activeTurn,r=n.labels,i=n.features,a=$4(`form`,`wui-chat-input-form`);a.noValidate=!0,a.setAttribute(`aria-label`,e.title||e.submitLabel),e.title&&a.append($4(`h3`,`wui-chat-input-title`,e.title));let o=e.fields.map(t=>l3(t,r,n,e.requestId));for(let e of o)a.append(e.element);let s=$4(`p`,`wui-chat-input-error`);s.setAttribute(`role`,`status`),s.hidden=!0,a.append(s);let c=$4(`button`,`btn btn-primary`,e.submitLabel);c.type=`submit`,c.dataset.wui=`AppButton`;let l=$4(`div`,`d-flex flex-wrap gap-2`);l.append(c);let u=[c];if(i.LeadShortcuts&&e.fields.length===1&&!e.fields[0]?.required){let t=$4(`button`,`btn btn-soft-primary`,r.skip);t.type=`button`,t.dataset.wui=`AppButton`,t.addEventListener(`click`,()=>this.activeTurn.skipInput(e.requestId)),l.append(t),u.push(t)}if(i.LeadShortcuts&&e.cancellable){let e=$4(`button`,`btn btn-link-primary`,r.cancel);e.type=`button`,e.dataset.wui=`AppButton`,e.addEventListener(`click`,()=>this.activeTurn.cancelLead()),l.append(e),u.push(e)}a.append(l),e.allowTyped&&a.append($4(`p`,`wui-chat-input-typed`,r.typeAnswer));let d=!1,f=t=>{for(let e of o)for(let n of e.controls)n.disabled=t;for(let e of u)e.disabled=t;c.textContent=t?r.inputSubmitting:e.submitLabel},p=()=>{for(let e of o)e.error.hidden=!0,e.error.textContent=``,e.invalid.removeAttribute(`aria-invalid`);s.hidden=!0,s.textContent=``},m=(e,t)=>{e.error.textContent=t,e.error.hidden=!1,e.invalid.setAttribute(`aria-invalid`,`true`)};return a.addEventListener(`submit`,async n=>{if(n.preventDefault(),d)return;p();let i={},a={},l=[];for(let e of o){let t=e.read();i[e.field.key]=t,e.codeRead&&(a[e.field.key]=e.codeRead());let n=u3(e,t,r);n&&l.push([e,n])}let[u]=l;if(u){for(let[e,t]of l)m(e,t);u[0].focus.focus();return}d=!0,f(!0);let h;try{h=await this.activeTurn.answerInput(e.requestId,i,Object.keys(a).length>0?a:null)}catch{h={ok:!1,errors:{},message:r.errorGeneric}}if(t!==this._generation||h.ok)return;d=!1;let g=null;for(let e of o){let t=h.errors?.[e.field.key];t&&(m(e,t),g??=e)}h.message!=null&&(s.textContent=h.message,s.hidden=!1),f(!1),g?g.focus.focus():o[0]?o[0].focus.focus():c.focus()}),a}});var f3={ActionLimitReached:`warning`,ConversationTooLong:`warning`,AssistantUnavailable:`danger`},p3={info:`info`,warning:`alert-triangle`,danger:`alert-circle`};ba(`wui-chat-part-notice`,class extends ya{renderPart(e){let t=this.ownerDocument??document,n=f3[e.code]??`info`,r=P(t,`div`,`wui-chat-notice wui-chat-notice--${n}`);r.setAttribute(`role`,n===`danger`?`alert`:`status`);let i=P(t,`span`,`wui-chat-notice-icon`);i.setAttribute(`aria-hidden`,`true`);let a=xa(t,p3[n],16);a&&i.append(a);let o=P(t,`div`,`wui-chat-notice-body`);o.append(P(t,`span`,`wui-chat-notice-text`,e.text));let s=e.action;if(s){let e=P(t,`button`,`wui-chat-notice-action`,s.label);e.type=`button`,e.addEventListener(`click`,()=>s.run()),o.append(e)}r.append(i,o),this.replaceChildren(r)}});function m3(e){switch(e){case`Primary`:return`wui-chat-quick-reply--primary`;case`Cta`:return`wui-chat-quick-reply--cta`;case`Default`:case null:return``}}ba(`wui-chat-part-quick-replies`,class extends ya{#e=null;renderPart(e,t,n){let r=n.features.SuggestedReplies===!0&&n.isLast===!0&&n.busy===!1&&e.replies.length>0,i=typeof n.openTarget==`function`,a=typeof n.beginHandoff==`function`,o=n.handoffPause===!0,s=JSON.stringify([r,e.replies,e.placement,n.labels.quickReplies,n.labels.handoffMoment,i,a,o,n.handoffHosts??null,n.features.LinkHandoff===!0]);if(s===this.#e)return;this.#e=s;let c=this.querySelector(`:scope > .wui-chat-quick-replies:not(.wui-chat-quick-replies--leaving)`);if(!r&&c){this.#t(c);return}if(this.replaceChildren(),!r)return;let l=this.ownerDocument,u=e.placement===`Composer`,d=P(l,`div`,u?`wui-chat-quick-replies wui-chat-quick-replies--composer`:`wui-chat-quick-replies`);d.setAttribute(`role`,`group`),d.setAttribute(`aria-label`,n.labels.quickReplies);let f=u?null:e.replies.find(e=>e.id===`handoff.request`&&e.action===`Send`),p=0;f&&(d.classList.add(`wui-chat-quick-replies--offer`),d.append(this.#n(l,f,n)),p+=1);for(let t of e.replies){if(t===f||t.action===`Open`&&(!t.target||!i))continue;let e=null;if(t.action===`Navigate`){if(n.features.LinkHandoff!==!0)continue;if(vr(t.target,n.handoffHosts))e=t.target;else{let r=t.target===null?null:n.resolveLink?.(t.target);e=typeof r==`string`&&r!==``?r:null}if(e===null){d.append(P(l,`span`,null,t.label));continue}if(!a)continue}d.append(this.#r(l,t,p,n,f?`wui-chat-quick-reply--quiet`:``,e)),p+=1}if(o){let e=P(l,`span`,`visually-hidden`,n.labels.handoffMoment);e.setAttribute(`role`,`status`),d.append(e)}d.childElementCount>0&&this.append(d)}#t(e){e.classList.add(`wui-chat-quick-replies--leaving`);let t=this.ownerDocument.defaultView,n=Number.parseFloat(t?t.getComputedStyle(e).animationDuration:``)*1e3;t===null||!(n>0)?e.remove():t.setTimeout(()=>e.remove(),n)}#n(e,t,n){let r=P(e,`div`,`wui-chat-offer`);return r.style.setProperty(`--wui-chat-i`,`0`),r.append(P(e,`div`,`wui-chat-offer-title`,t.label)),r.append(this.#r(e,{...t,variant:`Primary`},0,n,`wui-chat-offer-action`)),r}#r(e,t,n,r,i=``,a=null){let o=e.createElement(`button`);o.type=`button`,o.className=[`wui-chat-quick-reply`,m3(t.variant),i].filter(Boolean).join(` `),o.style.setProperty(`--wui-chat-i`,String(n));let s=t.action===`Navigate`,c=s&&r.handoffPause===!0;if(o.disabled=c,t.icon){let n=xa(e,t.icon,16);if(n){let t=P(e,`span`,`wui-chat-quick-reply-icon`);t.setAttribute(`aria-hidden`,`true`),t.append(n),o.append(t)}}return o.append(P(e,`span`,`wui-chat-quick-reply-label`,c?r.labels.handoffMoment:t.label)),o.addEventListener(`click`,()=>{if(t.action===`Open`){let{openTarget:e}=this.activeTurn;if(t.target===null||e===void 0)throw Error(`${this.localName} drew an Open chip without a target or openTarget`);e.call(this.activeTurn,t.target)}else if(s){let{beginHandoff:e}=this.activeTurn;if(a===null||e===void 0)throw Error(`${this.localName} drew a Navigate chip without a destination or beginHandoff`);e.call(this.activeTurn,t,()=>this.#i(a))}else this.activeTurn.chooseQuickReply(t),this.closest(`.wui-chat`)?.querySelector(`.wui-chat-input`)?.focus()}),o}#i(e){typeof this.activeTurn.openTarget==`function`?this.activeTurn.openTarget(e):globalThis.location.assign(e)}});var h3=new Set([`Integer`,`Decimal`,`MoneyMinor`,`Percent`]);function g3(e){return h3.has(e)}function _3(e,t,n,r=!0){let i=e=>r?un(e):[{kind:`text`,text:e}];if(t==null||t===``)return[{kind:`text`,text:Mi()}];if(e===`Date`||e===`DateTimeUtc`)return[{kind:`text`,text:gr(t,e,n)}];if(g3(e)){let r=Number(t);return i(Number.isFinite(r)?gr(r,e,n):String(t))}return i(String(t))}var v3=0;function y3(e){return v3+=1,`${e}-${v3}`}ba(`wui-chat-part-record-card`,class extends ya{#e=null;renderPart(e,t,n){let r=!!e.target&&typeof n.openRecord==`function`,i=n.features?.FigureText===!0,a=JSON.stringify([e,r,i]);if(a===this.#e)return;this.#e=a;let o=this.ownerDocument,s=P(o,`article`,`wui-chat-record`),c=y3(`wui-chat-record-title`);s.setAttribute(`aria-labelledby`,c);let l=P(o,`div`,`wui-chat-record-head`),u=P(o,`strong`,`wui-chat-record-title`);if(u.id=c,u.setAttribute(`role`,`heading`),u.setAttribute(`aria-level`,`3`),i?M2(u,e.title):u.textContent=String(e.title??``),l.append(u),e.subtitle){let t=P(o,`span`,`wui-chat-record-subtitle`);i?M2(t,e.subtitle):t.textContent=String(e.subtitle??``),l.append(t)}if(s.append(l),e.fields?.length>0){let t=P(o,`dl`,`wui-chat-record-fields`);for(let n of e.fields){let e=P(o,`div`),r=P(o,`dt`);i?M2(r,n.label):r.textContent=String(n.label??``);let a=P(o,`dd`);g3(n.type)&&(a.className=`wui-chat-num`),j2(a,_3(n.type,n.value,null,i)),e.append(r,a),t.append(e)}s.append(t)}if(r){let t=P(o,`button`,`btn btn-soft-primary btn-sm wui-chat-record-open`,n.labels.recordOpen);t.type=`button`,t.setAttribute(`aria-label`,n.labels.recordOpenFor(N2(e.title))),t.addEventListener(`click`,()=>{let{openRecord:t}=this.activeTurn;if(t===void 0)throw Error(`${this.localName} lost openRecord after it drew the button`);t.call(this.activeTurn,e)}),s.append(t)}this.replaceChildren(s)}});var b3=/^https?:\/\//i;ba(`wui-chat-part-sources`,class extends ya{renderPart(e,t,n){if(this.replaceChildren(),!n.features.Sources||e.sources.length===0)return;let r=this.ownerDocument,i=P(r,`div`,`wui-chat-sources`);i.append(P(r,`p`,`wui-chat-sources-label`,n.labels.sources));let a=P(r,`ul`,`wui-chat-sources-list`);a.setAttribute(`aria-label`,n.labels.sources);for(let t of e.sources){let e=r.createElement(`li`);e.append(this.#e(r,t,n)),a.append(e)}i.append(a),this.append(i)}#e(e,t,n){let r;if(typeof t.url==`string`&&b3.test(t.url)){let i=P(e,`a`,`wui-chat-source`);i.setAttribute(`href`,t.url),i.setAttribute(`target`,`_blank`),i.setAttribute(`rel`,`noopener noreferrer`),i.setAttribute(`aria-label`,n.labels.openSource(t.title)),r=i}else r=P(e,`span`,`wui-chat-source`),r.tabIndex=-1;return r.dataset.marker=String(t.marker),r.append(P(e,`span`,`wui-chat-source-marker`,String(t.marker)),P(e,`span`,`wui-chat-source-title`,t.title)),r}});var x3=25,S3=0;function C3(e,t,n){let r=e.createElement(`tr`);for(let i of t.columns){let t=e.createElement(`th`);t.setAttribute(`scope`,`col`),g3(i.type)&&(t.className=`wui-chat-num`),n?M2(t,i.label):t.textContent=String(i.label??``),r.append(t)}return r}function w3(e,t,n,r){let i=e.createElement(`tr`);return t.columns.forEach((a,o)=>{let s=o===0&&a.type===`Text`,c=e.createElement(s?`th`:`td`);s&&c.setAttribute(`scope`,`row`),g3(a.type)&&(c.className=`wui-chat-num`);let l=n[o];l==null||l===``?c.append(P(c.ownerDocument,`span`,`wui-chat-null`,Mi())):j2(c,_3(a.type,l,t.currency,r)),i.append(c)}),i}function T3(e,t){let n=()=>{let n=t.scrollWidth-t.clientWidth;e.dataset.scroll=n<=1?`none`:t.scrollLeft>=n-1?`end`:t.scrollLeft>0?`middle`:`start`};t.addEventListener(`scroll`,n,{passive:!0}),typeof ResizeObserver<`u`&&new ResizeObserver(n).observe(t),n()}function E3(e,t,n,r,i){let a=e.ownerDocument;for(let o of t.rows.slice(n,r))e.append(w3(a,t,o,i))}ba(`wui-chat-part-table`,class extends ya{#e=null;renderPart(e,t,n){let r=n.features?.FigureText===!0,i=JSON.stringify([e,r]);if(i===this.#e)return;if(this.#e=i,!e.columns||e.columns.length===0){this.replaceChildren();return}let a=this.ownerDocument,o=P(a,`figure`,`wui-chat-table`),s=null;if(e.title){S3+=1,s=`wui-chat-table-${S3}`;let t=P(a,`figcaption`,`wui-chat-table-title`);t.id=s,r?M2(t,e.title):t.textContent=String(e.title??``),o.append(t)}let c=P(a,`div`,`table-wrap wui-chat-table-wrap`);c.tabIndex=0,c.setAttribute(`role`,`region`),s?c.setAttribute(`aria-labelledby`,s):c.setAttribute(`aria-label`,n.labels.table);let l=P(a,`table`,`table table-sm wui-chat-table-grid`),u=a.createElement(`thead`);u.append(C3(a,e,r));let d=a.createElement(`tbody`);E3(d,e,0,Math.min(e.rows.length,x3),r),l.append(u,d),c.append(l);let f=P(a,`div`,`wui-chat-table-frame`),p=P(a,`span`,`wui-chat-table-cue`);if(p.setAttribute(`aria-hidden`,`true`),f.append(c,p),o.append(f),T3(f,c),e.rows.length>x3){let t=P(a,`button`,`btn btn-soft-primary btn-sm wui-chat-table-more`,n.labels.tableShowAll(e.rows.length));t.type=`button`,t.addEventListener(`click`,()=>{E3(d,e,x3,e.rows.length,r),t.remove()}),o.append(t)}this.replaceChildren(o)}});var D3=/\[([^[\]\n]+)\](?!\()/g,O3=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),k3=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,A3=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,j3=new RegExp(D3.source,`y`),M3=e=>/[\p{L}\p{N}]/u.test(e);function N3(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function P3(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),o=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),s=n===`_`&&M3(e.charAt(i+n.length));if(a&&!o&&!s&&!N3(e,i))return i}return-1}function F3(e,t){let n=t?.isCitation,r=[],i=``,a=()=>{i&&=(r.push({type:`text`,text:i}),``)},o=0;for(;o<e.length;){let s=e.charAt(o),c=e.charAt(o+1);if(s===`\\`&&O3.has(c)){i+=c,o+=2;continue}if(s==="`"){let t=e.indexOf("`",o+1);if(t>o+1){a(),r.push({type:`code`,text:e.slice(o+1,t)}),o=t+1;continue}}let l=s+c;if(l===`**`||l===`__`||l===`~~`){let n=P3(e,o+2,l);if(n!==-1&&!(l===`__`&&M3(e.charAt(o-1)))){a();let i=F3(e.slice(o+2,n),t);l===`~~`?r.push({type:`strike`,children:i}):r.push({type:`strong`,children:i}),o=n+2;continue}i+=l,o+=2}else{if(s===`*`||s===`_`){let n=P3(e,o+1,s);if(n!==-1&&!(s===`_`&&M3(e.charAt(o-1)))){a(),r.push({type:`em`,children:F3(e.slice(o+1,n),t)}),o=n+1;continue}}if(s===`[`){k3.lastIndex=o;let t=k3.exec(e);if(t){let e=t[1],n=t[2];if(e===void 0||n===void 0)throw Error(`The link pattern always captures its label and href`);a(),r.push({type:`link`,href:n,children:F3(e)}),o+=t[0].length;continue}if(n){j3.lastIndex=o;let t=j3.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The citation pattern always captures its inner text`);if(n(e)){a(),r.push({type:`citation`,text:e}),o+=t[0].length;continue}}}}if(s===`!`){A3.lastIndex=o;let t=A3.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The image pattern always captures its alt text`);a(),r.push({type:`image`,children:F3(e)}),o+=t[0].length;continue}}i+=s,o+=1}}return a(),r.map((e,t)=>({...e,key:t}))}var I3=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,L3=/^https?:/i,R3=/^(mailto|tel):/i,z3=/^(?:\/(?![/\\])|#|\?|\.{1,2}\/)/,B3=/^https:\/\/[^/?#@\\\s]+$/i,V3=/^[a-z][a-z0-9+.-]*:/i;function H3(e){if(typeof e!=`string`)return null;let t=e.endsWith(`/`)?e.slice(0,-1):e;return B3.test(t)?t:null}function U3(e,t,n,r,i){if(n&&(t===`page`||I3.test(e))){let t=n(e);if(t!=null)return{kind:`app`,target:t}}if(t===`app`)return null;let a=i==null?null:H3(i),o=a===null?e:W3(e,a);return o===null?null:z3.test(o)?{kind:`page`,href:o}:t===`page`&&!(L3.test(o)&&r&&K3(o,r))?null:L3.test(o)?{kind:r&&K3(o,r)?`page`:`web`,href:o}:R3.test(o)?{kind:`contact`,href:o}:null}function W3(e,t){if(V3.test(e))return e;if(e.startsWith(`//`))return`https:${e}`;if(e===``)return null;let n=e.indexOf(`#`),r=n<0?``:e.slice(n),i=n<0?e:e.slice(0,n),a=i.indexOf(`?`),o=a<0?i:i.slice(0,a),s=a<0?``:i.slice(a);return o===``?`${t}${s}${r}`:`${t}${G3(o.startsWith(`/`)?o:`/${o}`)}${s}${r}`}function G3(e){let t=e.split(`/`),n=[];return t.forEach((e,r)=>{let i=r===t.length-1;e===`.`?i&&n.push(``):e===`..`?(n.length>1&&n.pop(),i&&n.push(``)):n.push(e)}),n.join(`/`)}function K3(e,t){if(e.slice(0,t.length).toLowerCase()!==t.toLowerCase())return!1;let n=e[t.length];return n===void 0||n===`/`||n===`?`||n===`#`}function q3(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var J3=/^\s*```/,Y3=/^\s*```\s*(\S*)/,X3=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,Z3=/^\s*([-*_])(\s*\1){2,}\s*$/,Q3=/^(\s*)[-*+]\s+(.*)$/,$3=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,e6=/^\s*>\s?(.*)$/,t6=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,n6=[1,2,3,4,5,6],r6=e=>e.includes(`|`);function i6(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function a6(e,t){let n=e[t];if(n===void 0)throw Error(`startsTable was called past the last source line`);let r=e[t+1];return r!==void 0&&r6(n)&&r.includes(`|`)&&t6.test(r)}function o6(e,t){let n=e[t];if(n===void 0)throw Error(`startsBlock was called past the last source line`);return J3.test(n)||e6.test(n)||Q3.test(n)||$3.test(n)||X3.test(n)||Z3.test(n)||a6(e,t)}function s6(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function c6(e){let t=$3.exec(e);if(t){let e=t[1],n=t[2],r=t[3];if(e===void 0||n===void 0||r===void 0)throw Error(`The ordered list pattern always captures its indent, number and text`);return{text:r,depth:s6(e),ordered:!0,number:Number(n)}}let n=Q3.exec(e);if(n){let e=n[1],t=n[2];if(e===void 0||t===void 0)throw Error(`The bullet list pattern always captures its indent and text`);return{text:t,depth:s6(e),ordered:!1,number:0}}return null}function l6(e){let t=(e??``).replace(/\r\n?/g,`
41
+ `)){var p=new eQ;p.newline=!0,s.add(p)}else{var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,QZ(Xk,f,null,r,d)).on(`mouseover`,QZ(Zk,m.name,null,r,d)).on(`mouseout`,QZ(Qk,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=QR(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=lc(h.fill);_&&_[3]===0&&(_[3]=.2,h=I(I({},h),{fill:_c(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,QZ(Xk,null,f,r,d)).on(`mouseover`,QZ(Zk,null,f,r,d)).on(`mouseout`,QZ(Qk,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=QR(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};QR(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();$Z(e,function(e){var r=e.type,i=new CR({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),hp(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),Wd(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=Jk(c,r,o,s,d,m,u),y=new eQ,b=r.getModel(`textStyle`);if(B(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(Yk({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;V(w)&&w?T=w.replace(`{name}`,t??``):B(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new CR({style:_p(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new vR({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&ep({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),Wd(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();LH(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){LH(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(IK),nQ=od(nA),rQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.setScrollDataIndex=function(e){this.option.scrollDataIndex=e},t.prototype.init=function(t,n,r){var i=Rh(t);e.prototype.init.call(this,t,n,r),iA(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),iA(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=jm(ZZ.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:`end`,pageFormatter:`{current}/{total}`,pageIcons:{horizontal:[`M0,0L12,-10L12,10z`,`M0,0L-12,-10L-12,10z`],vertical:[`M0,0L20,0L10,-20z`,`M0,0L20,0L10,20z`]},pageIconColor:X.color.accent50,pageIconInactiveColor:X.color.accent10,pageIconSize:15,pageTextStyle:{color:X.color.tertiary},animationDurationUpdate:800}),t}(ZZ),iQ=Lz,aQ=[`width`,`height`],oQ=[`x`,`y`],sQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!0,n._currentIndex=0,n}return t.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new iQ),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new iQ)},t.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(t,n,r,i,a,o,s){var c=this;e.prototype.renderInner.call(this,t,n,r,i,a,o,s);var l=this._controllerGroup,u=n.get(`pageIconSize`,!0),d=z(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new CR({name:`pageText`,style:{text:`xx/xx`,fill:f.getTextColor(),font:f.getFont(),verticalAlign:`middle`,align:`center`},silent:!0})),p(`pageNext`,1);function p(e,t){var r=e+`DataIndex`,a=qf(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:q(c._pageGo,c,r,n,i)},{x:-d[0]/2,y:-d[1]/2,width:d[0],height:d[1]});a.name=e,l.add(a)}},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getSelectorGroup(),s=e.getOrient().index,c=aQ[s],l=oQ[s],u=aQ[1-s],d=oQ[1-s];i&&LH(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=Ra(n);i&&(h[c]=n[c]-p[c]-f);var g=this._layoutContentAndController(e,r,h,s,c,u,d,l);if(i){if(a===`end`)m[s]+=g[c]+f;else{var _=p[c]+f;m[s]-=_,g[l]-=_}g[c]+=p[c]+f,m[1-s]+=g[d]+g[u]/2-p[u]/2,g[u]=Math.max(g[u],p[u]),g[d]=Math.min(g[d],p[d]+m[1-s]),o.x=m[0],o.y=m[1],o.markRedraw()}return g},t.prototype._layoutContentAndController=function(e,t,n,r,i,a,o,s){var c=this.getContentGroup(),l=this._containerGroup,u=this._controllerGroup;LH(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),LH(`horizontal`,u,e.get(`pageButtonItemGap`,!0));var d=c.getBoundingRect(),f=u.getBoundingRect(),p=this._showController=d[i]>n[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=U(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new vR({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&Sf(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;L([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,V(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=aQ[i],o=oQ[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i<g.i&&(g=h,f.pagePrevDataIndex??=h.i,++f.pageCount,++f.pageIndex),h=_;return f;function v(e){if(e){var t=e.getBoundingRect(),n=t[o]+e[o];return{s:n,e:n+t[a],i:e.__legendDataIndex}}}function y(e,t){return e.e>=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(tQ),cQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=jm(CZ.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(CZ),lQ=Iu(),uQ=function(e){F(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){e.prototype.render.apply(this,arguments),t.noTarget()?this._clear():(this.range=t.getPercentRange(),cA(r,t,{pan:q(dQ.pan,this),zoom:q(dQ.zoom,this),scrollMove:q(dQ.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){lA(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(wZ),dQ={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=fQ[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(dD(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:gA(function(e,t,n,r,i,a){var o=fQ[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:gA(function(e,t,n,r,i,a){return fQ[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})},fQ={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}},pQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=jm(CZ.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:X.color.accent10,borderRadius:0,backgroundColor:X.color.transparent,dataBackground:{lineStyle:{color:X.color.accent30,width:.5},areaStyle:{color:X.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:X.color.accent40,width:.5},areaStyle:{color:X.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:X.color.neutral00,borderColor:X.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:X.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:X.color.tertiary},brushSelect:!0,brushStyle:{color:X.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:X.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(CZ),mQ=vR,hQ=1,gQ=30,_Q=7,vQ=`horizontal`,yQ=`vertical`,bQ=5,xQ=[`line`,`bar`,`candlestick`,`scatter`],SQ={easing:`cubicOut`,duration:100,delay:0},CQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=q(this._onBrush,this),this._onBrushEnd=q(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){e.prototype.render.apply(this,arguments),kb(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1?this.group.removeAll():t.noTarget()?(this._clear(),this.group.removeAll()):(i&&i.type===`dataZoom`&&i.from===this.uid||this._buildView(),this._updateView())},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Ab(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new Lz;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?_Q:0,r=Nh(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===vQ?{right:r.width-i.x-i.width,top:r.height-gQ-a-n,width:i.width,height:gQ}:{right:a,top:i.y,width:gQ,height:i.height},s=Rh(e.option);L([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=Mh(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===yQ&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===vQ&&!i?{scaleY:o?1:-1,scaleX:1}:n===vQ&&i?{scaleY:o?1:-1,scaleX:-1}:n===yQ&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]),c=isNaN(s.x)?0:s.x,l=isNaN(s.y)?0:s.y;e.x=t.x-c,e.y=t.y-l,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new mQ({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new mQ({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:q(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b)v||(y+=g);else{y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:Hl(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new Lz,r=new iB({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new oB({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){L(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&Ha(xQ,e.get(`type`))<0)){var o=r.getComponent(ok(i),a).axis,s=yA(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new mQ({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new mQ({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:hQ,fill:X.color.transparent}})),L([0,1],function(t){var a=o.get(`handleIcon`);!cU[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=Ng(a,-1,0,2,2,null,!0);s.attr({cursor:bA(this._orient),draggable:!0,drift:q(this._onDragMove,this,t),ondragend:q(this._onDragEnd,this),onmouseover:q(this._onOverDataInfoTriggerArea,this,!0),onmouseout:q(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=Y(l,this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),Wd(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new CR({silent:!0,invisible:!f,style:_p(d,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=u;if(l){var f=Y(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new vR({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=Ng(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,X.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new vR({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:q(this._onActualMoveZoneDrift,this),ondragstart:q(this._onActualMoveZoneDragStart,this),ondragend:q(this._onActualMoveZoneDragEnd,this),onmouseover:q(this._onOverDataInfoTriggerArea,this,!0),onmouseout:q(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[Hl(e[0],[0,100],t,!0),Hl(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];dD(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:Hl(a.minSpan,o,i,!0),a.maxSpan==null?null:Hl(a.maxSpan,o,i,!0));var s=this._range,c=this._range=Jl([Hl(r[0],i,o,!0),Hl(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=Jl(n.slice()),i=this._size;L([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;c<o.length;c++){var l=o[c],u=l.getClipPath();u||(u=new vR,l.setClipPath(u)),u.setShape({x:s[c],y:0,width:s[c+1]-s[c],height:i[1]})}this._updateDataInfo(e)},t.prototype._updateDataInfo=function(e){var t=this.dataZoomModel,n=this._displayables,r=n.handleLabels,i=this._orient,a=[``,``];if(t.get(`showDetail`)){var o=t.findRepresentativeAxisProxy(),s=o.getAxisModel().axis.scale;if(o){var c=this._range,l;if(e){var u={start:c[0],end:c[1]},d=fk(t,o);if(d){var f=d.calculateDataWindow(u).percentInverted;u={start:f[0],end:f[1]}}l=o.calculateDataWindow(u)}else l=o.getWindow();a=[vA(t,0,l,s),vA(t,1,l,s)]}}var p=Jl(this._handleEnds.slice());m.call(this,0),m.call(this,1);function m(e){var t=zf(n.handles[e].parent,this.group),o=Vf(e===0?`right`:`left`,t),s=this._handleWidth/2+bQ,c=Bf([p[e]+(e===0?-s:s),this._size[1]/2],t);r[e].setStyle({x:c[0],y:c[1],verticalAlign:i===vQ?`middle`:o,align:i===vQ?o:`center`,text:a[e]})}},t.prototype._onOverDataInfoTriggerArea=function(e){this._isOverDataInfoTriggerArea=e,this._showDataInfo(e)},t.prototype._showDataInfo=function(e){var t=(this.dataZoomModel.get(`handleLabel`)||{}).show||!1,n=this.dataZoomModel.getModel([`emphasis`,`handleLabel`]).get(`show`)||!1,r=e||this._dragging?n:t,i=this._displayables,a=i.handleLabels;a[0].attr(`invisible`,!r),a[1].attr(`invisible`,!r),i.moveHandle&&this.api[r?`enterEmphasis`:`leaveEmphasis`](i.moveHandle,1)},t.prototype._onActualMoveZoneDrift=function(e,t,n){this.api.getZr().setCursorStyle(`grabbing`),this._onDragMove(`all`,e,t,n)},t.prototype._onActualMoveZoneDragStart=function(e){e.target.attr(`cursor`,`grabbing`),this._showDataInfo(!0)},t.prototype._onActualMoveZoneDragEnd=function(e){e.target.attr(`cursor`,`grab`),this._onDragEnd()},t.prototype._onDragMove=function(e,t,n,r){this._dragging=!0,BG(r.event);var i=this._displayables.sliderGroup.getLocalTransform(),a=Bf([t,n],i,!0),o=this._updateInterval(e,a[0]),s=this.dataZoomModel.get(`realtime`);this._updateView(!s),o&&s&&this._dispatchZoomAction(!0)},t.prototype._onDragEnd=function(){this._dragging=!1,this._isOverDataInfoTriggerArea||this._showDataInfo(!1),!this.dataZoomModel.get(`realtime`)&&this._dispatchZoomAction(!1)},t.prototype._onClickPanel=function(e){var t=this._size,n=this._displayables.sliderGroup.transformCoordToLocal(e.offsetX,e.offsetY);if(!(n[0]<0||n[0]>t[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new zF(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();dD(0,a,r,0,o.minSpan==null?null:Hl(o.minSpan,i,r,!0),o.maxSpan==null?null:Hl(o.maxSpan,i,r,!0)),this._range=Jl([Hl(a[0],r,i,!0),Hl(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(BG(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new mQ({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?SQ:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=ck(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(wZ),wQ={get:function(e,t,n){var r=Ra((TQ[e]||{})[t]);return n&&z(r)?r[r.length-1]:r}},TQ={color:{active:[`#006edd`,`#e0ffff`],inactive:[X.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},EQ=cX.mapVisual,DQ=cX.eachVisual,OQ=z,kQ=L,AQ=Jl,jQ=Hl,MQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&xee(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=q(e,this),this.controllerVisuals=Fk(this.option.controller,t,e),this.targetVisuals=Fk(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return kQ(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=zu(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return R(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){L(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],z(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);return V(o)?o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c):B(o)?s?o(e[0],e[1]):o(e):s?e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1]:c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=AQ([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=Ja(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};za(r,n),za(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){OQ(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},kQ(r,function(e,t){if(cX.isValidType(t)){var n=wQ.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;kQ(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&Ra(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&Ra(n)||(a?s[0]:[s[0],s[0]])),c.symbol=EQ(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;DQ(l,function(e){e>u&&(u=e)}),c.symbolSize=EQ(l,function(e){return jQ(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:X.color.transparent,borderColor:X.color.borderTint,contentColor:X.color.theme[0],inactiveColor:X.color.disabled,borderWidth:0,padding:X.size.m,textGap:10,precision:0,textStyle:{color:X.color.secondary}},t}(BH),NQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.autoPositionValues={left:1,right:1,top:1,bottom:1},n}return t.prototype.init=function(e,t){this.ecModel=e,this.api=t},t.prototype.render=function(e,t,n,r){this.visualMapModel=e,e.get(`show`)===!1?this.group.removeAll():this.doRender(e,t,n,r)},t.prototype.renderBackground=function(e){var t=this.visualMapModel,n=jH(t.get(`padding`)||0),r=e.getBoundingRect();e.add(new vR({z2:-1,silent:!0,shape:{x:r.x-n[3],y:r.y-n[0],width:r.width+n[3]+n[1],height:r.height+n[0]+n[2]},style:{fill:t.get(`backgroundColor`),stroke:t.get(`borderColor`),lineWidth:t.get(`borderWidth`)}}))},t.prototype.getControllerVisual=function(e,t,n){n||={};var r=n.forceState,i=this.visualMapModel,a={};t===`color`&&(a.color=i.get(`contentColor`));function o(e){return a[e]}function s(e,t){a[e]=t}var c=i.controllerVisuals[r||i.getValueState(e)];return L(cX.prepareVisualTypes(c),function(r){var i=c[r];n.convertOpacityToAlpha&&r===`opacity`&&(r=`colorAlpha`,i=c.__alphaForOpacity),cX.dependsOn(r,t)&&i&&i.applyVisual(e,o,s)}),a[t]},t.prototype.positionGroup=function(e){var t=this.visualMapModel,n=this.api,r=Nh(t,n).refContainer;Ph(e,t.getBoxLayoutParams(),r)},t.prototype.doRender=function(e,t,n,r){},t.type=`visualMap`,t}(IK),PQ=[[`left`,`right`,`width`],[`top`,`bottom`,`height`]],FQ={type:`selectDataRange`,event:`dataRangeSelected`,update:`update`},IQ=function(e,t){t.eachComponent({mainType:`visualMap`,query:e},function(t){t.setSelected(e.selected)})},LQ=[{createOnAllSeries:!0,reset:function(e,t){var n=[];return t.eachComponent(`visualMap`,function(t){var r=e.pipelineContext;!t.isTargetSeries(e)||r&&r.large||n.push(See(t.stateList,t.targetVisuals,q(t.getValueState,t),t.getDataDimensionIndex(e.getData())))}),n}},{createOnAllSeries:!0,reset:function(e,t){var n=e.getData(),r=[];t.eachComponent(`visualMap`,function(t){if(t.isTargetSeries(e)){var i=t.getVisualMeta(q(TA,null,e,t))||{stops:[],outerColors:[]},a=t.getDataDimensionIndex(n);a>=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}],RQ=L,zQ=!1,BQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],VQ[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=Ra(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=R(this._pieceList,function(e){return e=Ra(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=cX.listVisualTypes(),i=this.isCategory();L(t.pieces,function(e){L(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),L(n,function(e,n){var r=!1;L(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&L(this.stateList,function(e){(t[e]||(t[e]={}))[n]=wQ.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,L(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;L(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=Ra(e)},t.prototype.getValueState=function(e){var t=cX.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){cX.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return L(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=jm(MQ.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(MQ),VQ={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o<i;s+=a,o++){var c=o===i-1?r[1]:s+a;e.push({interval:[s,c],close:[1,1]})}t.maxOpen&&e.push({interval:[r[1],1/0],close:[0,0]}),ou(e),L(e,function(e,t){e.index=t,e.text=this.formatValueText(e.interval)},this)},categories:function(e){var t=this.option;L(t.categories,function(t){e.push({text:this.formatValueText(t,!0),value:t})},this),kA(t,e)},pieces:function(e){var t=this.option;L(t.pieces,function(t,n){H(t)||(t={value:t});var r={text:``,index:n};if(t.label!=null&&(r.text=t.label),t.hasOwnProperty(`value`)){var i=r.value=t.value;r.interval=[i,i],r.close=[1,1]}else{for(var a=r.interval=[],o=r.close=[0,0],s=[1,0,1],c=[-1/0,1/0],l=[],u=0;u<2;u++){for(var d=[[`gte`,`gt`,`min`],[`lte`,`lt`,`max`]][u],f=0;f<3&&a[u]==null;f++)a[u]=t[d[f]],o[u]=s[f],l[u]=f===2;a[u]??(a[u]=c[u])}l[0]&&a[1]===1/0&&(o[0]=0),l[1]&&a[0]===-1/0&&(o[1]=0),a[0]===a[1]&&o[0]&&o[1]&&(r.value=a[0])}r.visual=cX.retrieveVisuals(t),e.push(r)},this),kA(t,e),ou(e),L(e,function(e){var t=e.close,n=[[`<`,`≤`][t[1]],[`>`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}},HQ=function(e){F(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=oo(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),L(o.viewPieceList,function(o){var s=o.piece,u=new Lz;u.onclick=q(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new CR({style:_p(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:U(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),LH(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:wA(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return CA(e,this.api,e.itemSize);var n=t.align;return n&&n!==`auto`||(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new Lz,o=this.visualMapModel.textStyleModel;a.add(new CR({style:_p(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=R(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=Ng(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=Ra(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,L(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(NQ),UQ=[`align`,`verticalAlign`,`width`,`height`,`fontSize`],WQ=new wI,GQ=Iu(),KQ=Iu(),qQ=[`x`,`y`,`rotation`],JQ=function(){function e(){this._labelList=[],this._chartViewList=[]}return e.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},e.prototype._addLabel=function(e,t,n,r,i){var a=r.style,o=r.__hostTarget.textConfig||{},s=r.getComputedTransform(),c=r.getBoundingRect().plain();J.applyTransform(c,c,s),s?WQ.setLocalTransform(s):(WQ.x=WQ.y=WQ.rotation=WQ.originX=WQ.originY=0,WQ.scaleX=WQ.scaleY=1),WQ.rotation=hl(WQ.rotation);var l=r.__hostTarget,u;if(l){u=l.getBoundingRect().plain();var d=l.getComputedTransform();J.applyTransform(u,u,d)}var f=u&&l.getTextGuideLine();this._labelList.push({label:r,labelLine:f,seriesModel:n,dataIndex:e,dataType:t,layoutOptionOrCb:i,layoutOption:null,rect:c,hostRect:u,priority:u?u.width*u.height:0,defaultAttr:{ignore:r.ignore,labelGuideIgnore:f&&f.ignore,x:WQ.x,y:WQ.y,scaleX:WQ.scaleX,scaleY:WQ.scaleY,rotation:WQ.rotation,style:{x:a.x,y:a.y,align:a.align,verticalAlign:a.verticalAlign,width:a.width,height:a.height,fontSize:a.fontSize},cursor:r.cursor,attachedPos:o.position,attachedRot:o.rotation}})},e.prototype.addLabelsOfSeries=function(e){var t=this;this._chartViewList.push(e);var n=e.__model,r=n.get(`labelLayout`);(B(r)||Ya(r).length)&&e.group.traverse(function(e){if(e.ignore)return!0;var i=e.getTextContent(),a=QR(e);i&&!i.disableLabelLayout&&t._addLabel(a.dataIndex,a.dataType,n,i,r)})},e.prototype.updateLayoutConfig=function(e){var t=e.getWidth(),n=e.getHeight();function r(e,t){return function(){sx(e,t)}}for(var i=0;i<this._labelList.length;i++){var a=this._labelList[i],o=a.label,s=o.__hostTarget,c=a.defaultAttr,l=void 0;l=B(a.layoutOptionOrCb)?a.layoutOptionOrCb(MA(a,s)):a.layoutOptionOrCb,l||={},a.layoutOption=l;var u=Math.PI/180;s&&s.setTextConfig({local:!1,position:l.x!=null||l.y!=null?null:c.attachedPos,rotation:l.rotate==null?c.attachedRot:l.rotate*u,offset:[l.dx||0,l.dy||0]});var d=!1;if(l.x==null?(o.x=c.x,o.setStyle(`x`,c.style.x)):(o.x=Y(l.x,t),o.setStyle(`x`,0),d=!0),l.y==null?(o.y=c.y,o.setStyle(`y`,c.style.y)):(o.y=Y(l.y,n),o.setStyle(`y`,0),d=!0),l.labelLinePoints){var f=s.getTextGuideLine();f&&(f.setShape({points:l.labelLinePoints}),d=!1)}var p=GQ(o);p.needsUpdateLabelLine=d,o.rotation=l.rotate==null?c.rotation:l.rotate*u,o.scaleX=c.scaleX,o.scaleY=c.scaleY;for(var m=0;m<UQ.length;m++){var h=UQ[m];o.setStyle(h,l[h]==null?c.style[h]:l[h])}if(l.draggable){if(o.draggable=!0,o.cursor=`move`,s){var g=a.seriesModel;a.dataIndex!=null&&(g=a.seriesModel.getData(a.dataType).getItemModel(a.dataIndex)),o.on(`drag`,r(s,g.getModel(`labelLine`)))}}else o.off(`drag`),o.cursor=c.cursor}},e.prototype.layout=function(e){var t=e.getWidth(),n=e.getHeight(),r=[];L(this._labelList,function(e){e.defaultAttr.ignore||r.push(vy({},e))});var i=qa(r,function(e){return e.layoutOption.moveOverlap===`shiftX`}),a=qa(r,function(e){return e.layoutOption.moveOverlap===`shiftY`});by(i,0,0,t),by(a,1,0,n);var o=qa(r,function(e){return e.layoutOption.hideOverlap});xy(o),Sy(o)},e.prototype.processLabelsOverall=function(){var e=this;L(this._chartViewList,function(t){var n=t.__model,r=t.ignoreLabelLineUpdate,i=n.isAnimationEnabled();t.group.traverse(function(t){if(t.ignore&&!t.forceLabelAnimation)return!0;var a=!r,o=t.getTextContent();!a&&o&&(a=GQ(o).needsUpdateLabelLine),a&&e._updateLabelLine(t,n),i&&e._animateLabels(t,n)})})},e.prototype._updateLabelLine=function(e,t){var n=e.getTextContent(),r=QR(e),i=r.dataIndex;if(n&&i!=null){var a=t.getData(r.dataType),o=a.getItemModel(i),s={},c=a.getItemVisual(i,`style`);c&&(s.stroke=c[a.getVisual(`drawType`)]);var l=o.getModel(`labelLine`);fx(e,px(o),s),sx(e,l)}},e.prototype._animateLabels=function(e,t){var n=e.getTextContent(),r=e.getTextGuideLine();if(n&&(e.forceLabelAnimation||!n.ignore&&!n.invisible&&!e.disableLabelAnimation&&!wf(e))){var i=GQ(n),a=i.oldLayout,o=QR(e),s=o.dataIndex,c={x:n.x,y:n.y,rotation:n.rotation},l=t.getData(o.dataType);if(a){n.attr(a);var u=e.prevStates;u&&(Ha(u,`select`)>=0&&n.attr(i.oldLayoutSelect),Ha(u,`emphasis`)>=0&&n.attr(i.oldLayoutEmphasis)),Sf(n,c,t,s)}else if(n.attr(c),!GB(n).valueAnimation){var d=U(n.style.opacity,1);n.style.opacity=0,Cf(n,{style:{opacity:d}},t,s)}if(i.oldLayout=c,n.states.select){var f=i.oldLayoutSelect={};NA(f,c,qQ),NA(f,n.states.select,qQ)}if(n.states.emphasis){var p=i.oldLayoutEmphasis={};NA(p,c,qQ),NA(p,n.states.emphasis,qQ)}wp(n,s,l,t,t)}if(r&&!r.ignore&&!r.invisible){var i=KQ(r),a=i.oldLayout,m={points:r.shape.points};a?(r.attr({shape:a}),Sf(r,{shape:m},t)):(r.setShape(m),r.style.strokePercent=0,Cf(r,{style:{strokePercent:1}},t)),i.oldLayout=m}},e}(),YQ=Iu(),XQ=function(){function e(t,n){p_(this,e.decoratedMethods),this._outOfBrk=v_(null,n);var r=this._linear=v_(null,n);m_(this,r),this.breaks=t&&t.breaks||[]}return e.prototype.hasBreaks=function(){return!!this.breaks.length},e.prototype.calcNiceTickMultiple=function(e,t){for(var n=0;n<this.breaks.length;n++){var r=this.breaks[n];if(r.vmin<e&&e<r.vmax)return t(e,r.vmax)}return 0},e.decoratedMethods={needTransform:function(){return!this.breaks.length},getExtent:function(){return this._outOfBrk.getExtent()},getExtentUnsafe:function(e,t){return t==null||t===2?this._outOfBrk.getExtentUnsafe(e,null):this._linear.getExtentUnsafe(e,null)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){Qu(t,n)&&(e===0&&IA(this,[t,n]),this._outOfBrk.setExtent2(e,t,n),this._linear.setExtent2(e,this.transformIn(t,null),this.transformIn(n,null)))},normalize:function(e){return this._linear.normalize(this.transformIn(e,null))},scale:function(e){return this.transformOut(this._linear.scale(e),null)},contain:function(e){return this._outOfBrk.contain(e)},transformIn:function(e,t){if(t&&t.depth===2)return e;for(var n=ZQ,r=QQ,i=!0,a=0;a<this.breaks.length;a++){var o=this.breaks[a];if(e<=o.vmax){e>o.vmin?n+=o.vmin-r+(e-o.vmin)/(o.vmax-o.vmin)*o.gapReal:n+=e-r,r=o.vmax,i=!1;break}n+=o.vmin-r+o.gapReal,r=o.vmax}return i&&(n+=e-r),n},transformOut:function(e,t){if(t&&t.depth===2)return e;for(var n=ZQ,r=QQ,i=!0,a=0,o=0;o<this.breaks.length;o++){var s=this.breaks[o],c=n+s.vmin-r,l=c+s.gapReal;if(e<=l){a=e>c?s.vmin+(e-c)/(l-c)*(s.vmax-s.vmin):r+e-n,r=s.vmax,i=!1;break}n=l,r=s.vmax}return i&&(a=r+e-n),a}},e}(),ZQ=0,QQ=0,$Q={vmin:`start`,vmax:`end`},e$=Iu(),t$=Math.sin,n$=Math.cos,r$=Math.PI,i$=Math.PI*2,a$=180/r$,o$=function(){function e(){}return e.prototype.reset=function(e){this._start=!0,this._d=[],this._str=``,this._p=10**(e||4)},e.prototype.moveTo=function(e,t){this._add(`M`,e,t)},e.prototype.lineTo=function(e,t){this._add(`L`,e,t)},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){this._add(`C`,e,t,n,r,i,a)},e.prototype.quadraticCurveTo=function(e,t,n,r){this._add(`Q`,e,t,n,r)},e.prototype.arc=function(e,t,n,r,i,a){this.ellipse(e,t,n,n,0,r,i,a)},e.prototype.ellipse=function(e,t,n,r,i,a,o,s){var c=o-a,l=!s,u=Math.abs(c),d=xc(u-i$)||(l?c>=i$:-c>=i$),f=c>0?c%i$:c%i$+i$,p=!1;p=d?!0:!xc(u)&&f>=r$==!!l;var m=e+n*n$(a),h=t+r*t$(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*a$);if(d){var _=1/this._p,v=(l?1:-1)*(i$-_);this._add(`A`,n,r,g,1,+l,e+n*n$(a+v),t+r*t$(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*n$(o),b=t+r*t$(o);this._add(`A`,n,r,g,+p,+l,y,b)}},e.prototype.rect=function(e,t,n,r){this._add(`M`,e,t),this._add(`l`,n,0),this._add(`l`,0,r),this._add(`l`,-n,0),this._add(`Z`)},e.prototype.closePath=function(){this._d.length>0&&this._add(`Z`)},e.prototype._add=function(e,t,n,r,i,a,o,s,c){for(var l=[],u=this._p,d=1;d<arguments.length;d++){var f=arguments[d];if(isNaN(f)){this._invalid=!0;return}l.push(Math.round(f*u)/u)}this._d.push(e+l.join(` `)),this._start=e===`Z`},e.prototype.generateStr=function(){this._str=this._invalid?``:this._d.join(``),this._d=[]},e.prototype.getStr=function(){return this._str},e}(),s$=`none`,c$=Math.round,l$=[`lineCap`,`miterLimit`,`lineJoin`],u$=R(l$,function(e){return`stroke-`+e.toLowerCase()}),d$=`http://www.w3.org/2000/svg`,f$=`http://www.w3.org/1999/xlink`,p$=`http://www.w3.org/2000/xmlns/`,m$=`http://www.w3.org/XML/1998/namespace`,h$=`ecmeta_`,g$=0,_$={cubicIn:`0.32,0,0.67,0`,cubicOut:`0.33,1,0.68,1`,cubicInOut:`0.65,0,0.35,1`,quadraticIn:`0.11,0,0.5,0`,quadraticOut:`0.5,1,0.89,1`,quadraticInOut:`0.45,0,0.55,1`,quarticIn:`0.5,0,0.75,0`,quarticOut:`0.25,1,0.5,1`,quarticInOut:`0.76,0,0.24,1`,quinticIn:`0.64,0,0.78,0`,quinticOut:`0.22,1,0.36,1`,quinticInOut:`0.83,0,0.17,1`,sinusoidalIn:`0.12,0,0.39,0`,sinusoidalOut:`0.61,1,0.88,1`,sinusoidalInOut:`0.37,0,0.63,1`,exponentialIn:`0.7,0,0.84,0`,exponentialOut:`0.16,1,0.3,1`,exponentialInOut:`0.87,0,0.13,1`,circularIn:`0.55,0,1,0.45`,circularOut:`0,0.55,0.45,1`,circularInOut:`0.85,0,0.15,1`},v$=`transform-origin`,y$={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`},b$=Math.round,x$={circle:[Mj([`cx`,`cy`,`r`])],polyline:[Aj,jj],polygon:[Aj,jj]},S$=58,C$=120,w$=sj(``,``),T$=0,E$=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=oM(`configLayer`),this.storage=t,this._opts=n=I({},n),this.root=e,this._id=`zr`+T$++,this._oldVNode=pj(n.width,n.height),e&&!n.ssr){var r=this._viewport=document.createElement(`div`);r.style.cssText=`position:relative;overflow:hidden`;var i=this._svgDom=this._oldVNode.elm=oj(`svg`);nM(null,this._oldVNode),r.appendChild(i),e.appendChild(r)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style=`position:absolute;left:0;top:0;user-select:none`,aM(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return Lj(e,fj(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=fj(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var a=[],o=this._bgVNode=sM(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=sj(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=R(Ya(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(sj(`defs`,`defs`,{},c)),e.animation){var l=dj(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=sj(`style`,`stl`,{},[],l);a.push(u)}}return pj(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},uj(this.renderToVNode({animation:U(e.cssAnimation,!0),emphasis:U(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:U(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var r=e.length,i=[],a=0,o,s,c=0,l=0;l<r;l++){var u=e[l];if(!u.invisible){var d=u.__clipPaths,f=d&&d.length||0,p=s&&s.length||0,m=void 0;for(m=Math.max(f-1,p-1);m>=0&&!(d&&s&&d[m]===s[m]);m--);for(var h=p-1;h>m;h--)a--,o=i[a-1];for(var g=m+1;g<f;g++){var _={};Vj(d[g],_,t);var v=sj(`g`,`clip-g-`+c++,_,[]);(o?o.children:n).push(v),i[a++]=v,o=v}s=d;var y=Lj(u,t);y&&(o?o.children:n).push(y)}}},e.prototype.resize=function(e,t){var n=this._opts,r=this.root,i=this._viewport;if(e!=null&&(n.width=e),t!=null&&(n.height=t),r&&i&&(i.style.display=`none`,e=pC(r,0,n),t=pC(r,1,n),i.style.display=``),this._width!==e||this._height!==t){if(this._width=e,this._height=t,i){var a=i.style;a.width=e+`px`,a.height=t+`px`}if(Ac(this._backgroundColor))this.refresh();else{var o=this._svgDom;o&&(o.setAttribute(`width`,e),o.setAttribute(`height`,t));var s=this._bgVNode&&this._bgVNode.elm;s&&(s.setAttribute(`width`,e),s.setAttribute(`height`,t))}}},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e.prototype.dispose=function(){this.root&&(this.root.innerHTML=``),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},e.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},e.prototype.toDataURL=function(e){var t=this.renderToString(),n=`data:image/svg+xml;`;return e?(t=KI(t),t&&n+`base64,`+t):n+`charset=UTF-8,`+encodeURIComponent(t)},e}(),D$=function(e){F(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.zlevel=0,i.zlevel2=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__prevIdx={startIdx:0,endIdx:0};var a;r||=oL,typeof t==`string`?a=lM(t,n,r):H(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(vo(a),a.onselectstart=function(){return!1},o.padding=`0`,o.margin=`0`,o.borderWidth=`0`),i.painter=n,i.dpr=r,i}return t.prototype.afterBrush=function(){this.__prevIdx=dM(this)},t.prototype.initContext=function(){this.ctx=this.dom.getContext(`2d`),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=lM(`back-`+this.id,this.painter,e),this.ctxBack=this.domBack.getContext(`2d`),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,t,n,r){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var i=[],a=this.maxRepaintRectCount,o=!1,s=new J(0,0,0,0);function c(e){if(e.isFinite()&&!e.isZero()){if(i.length===0){var t=new J(0,0,0,0);t.copy(e),i.push(t)}else{for(var n=!1,r=1/0,c=0,l=0;l<i.length;++l){var u=i[l];if(u.intersect(e)){var d=new J(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}if(o){s.copy(e),s.union(u);var f=e.width*e.height,p=u.width*u.height,m=s.width*s.height-f-p;m<r&&(r=m,c=l)}}if(o&&(i[c].union(e),n=!0),!n){var t=new J(0,0,0,0);t.copy(e),i.push(t)}o||=i.length>=a}}}for(var l=dM(this),u=l.startIdx;u<l.endIdx;++u){var d=e[u];if(d){var f=d.shouldBePainted(n,r,!0,!0),p=d.__isRendered&&(d.__dirty&1||!f)?d.getPrevPaintRect():null;p&&c(p);var m=f&&(d.__dirty&1||!d.__isRendered)?d.getPaintRect():null;m&&c(m)}}for(var h=this.__prevIdx,u=h.startIdx;u<h.endIdx;++u){var d=t[u],f=d&&d.shouldBePainted(n,r,!0,!0);if(d&&(!f||!d.__zr)&&d.__isRendered){var p=d.getPrevPaintRect();p&&c(p)}}var g;do{g=!1;for(var u=0;u<i.length;)if(i[u].isZero())i.splice(u,1);else{for(var _=u+1;_<i.length;)i[u].intersect(i[_])?(g=!0,i[u].union(i[_]),i.splice(_,1)):_++;u++}}while(g);return this._paintRects=i,i},t.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},t.prototype.resize=function(e,t){var n=this.dpr,r=this.dom,i=r.style,a=this.domBack;i&&(i.width=e+`px`,i.height=t+`px`),r.width=e*n,r.height=t*n,a&&(a.width=e*n,a.height=t*n,n!==1&&this.ctxBack.scale(n,n))},t.prototype.clear=function(e,t,n){var r=this.dom,i=this.ctx,a=r.width,o=r.height;t||=this.clearColor;var s=this.motionBlur&&!e,c=this.lastFrameAlpha,l=this.dpr,u=this;s&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation=`copy`,this.ctxBack.drawImage(r,0,0,a/l,o/l));var d=this.domBack;function f(e,n,r,a){if(i.clearRect(e,n,r,a),t&&t!==`transparent`){var o=void 0;ro(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||uC(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):io(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=xC(i,t,{dirty:function(){u.setUnpainted(),u.painter.refresh()}})),i.save(),i.fillStyle=o||t,i.fillRect(e,n,r,a),i.restore()}s&&(i.save(),i.globalAlpha=c,i.drawImage(d,e,n,r,a),i.restore())}!n||s?f(0,0,a,o):n.length&&L(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(iL),O$=1e5,k$=314159,A$=void 0,j$=1,M$=2,N$=1,P$=2,F$=4,I$=N$|F$,L$=function(){function e(e,t,n,r){this.type=`canvas`,this._prevDisplayList=[],this._layerConfig={},this._needsManuallyCompositing=!1,this.type=`canvas`,this._i={layerStack:[],layers:[]};var i=!e.nodeName||e.nodeName.toUpperCase()===`CANVAS`;if(this._opts=n=I({},n||{}),this.dpr=n.devicePixelRatio||oL,this._singleCanvas=i,this.root=e,e.style&&(vo(e),e.innerHTML=``),this.storage=t,this._prevDisplayList=[],i){var a=e,o=a.width,s=a.height;n.width!=null&&(o=n.width),n.height!=null&&(s=n.height),this.dpr=n.devicePixelRatio||1,a.width=o*this.dpr,a.height=s*this.dpr,this._width=o,this._height=s;var c=mM(a,this,k$,0);c.initContext(),this._insertLayer(c,k$,0,!0),this._domRoot=e}else{this._width=pC(e,0,n),this._height=pC(e,1,n);var l=this._domRoot=pM(this._width,this._height);e.appendChild(l)}}return e.prototype.getType=function(){return`canvas`},e.prototype.isSingleCanvas=function(){return this._singleCanvas},e.prototype.getViewportRoot=function(){return this._domRoot},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.refresh=function(e){var t=e&&!H(e)?{paintAll:!!e}:e||{},n=U(t.refresh,!0),r=U(t.refreshHover,!1);if(r&&(this._hoverLayerDirty=M$),!n)return r&&this._paintHoverList(this.storage.getDisplayList(!1)),this;var i=this.storage.getDisplayList(!0);this._updateLayerStatus(i,t.paintAll),this._redrawId=Math.random();var a=this._prevDisplayList;this._paintList(i,a,this._redrawId);var o=this._backgroundColor;return bM(this._i,function(e,t,n,r){e.refresh&&e.refresh(r===0?o:null)},P$),this._opts.useDirtyRect&&(this._prevDisplayList=i.slice()),this},e.prototype._paintHoverList=function(e){var t=this._i.hoverlayer,n=this._hoverLayerDirty;if(this._hoverLayerDirty=A$,n!==A$&&(!t&&n===M$&&(t=this._i.hoverlayer=this._ensureLayer(O$)),t)){t.clear();for(var r={inHover:!0,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},i,a=0,o=e.length;a<o;a++){var s=e[a];if(s.__inHover){i||(i=t.ctx,i.save());var c=s.__hoverStyle,l=void 0;c&&(l=s.style,s.style=c),PC(i,s,r),c&&(s.style=l)}}i&&(FC(i,r),i.restore())}},e.prototype.getHoverLayer=function(){return this._ensureLayer(O$)},e.prototype.paintOne=function(e,t){NC(e,t)},e.prototype._paintList=function(e,t,n){if(this._redrawId===n){var r=this._doPaintList(e,t);if(this._needsManuallyCompositing&&this._compositeManually(),r)bM(this._i,function(e){e.afterBrush&&e.afterBrush()},I$),this._paintHoverList(e);else{var i=this;$G(function(){i._paintList(e,t,n)})}}},e.prototype._compositeManually=function(){var e=this._ensureLayer(k$).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),bM(this._i,function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)},N$)},e.prototype._doPaintList=function(e,t){var n=this,r=!0;return bM(this._i,function(i){var a=!1;if(vM(i,function(e){(e.drawIdx<e.endIdx||e.notClearIdx>=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!uM(i)?i.createRepaintRects(e,t,n._width,n._height):null,s=n._i.layerStack[0],c=!0;if(i.__dirty){c=!1,i.__dirty=!1;var l=i.zlevel===s.zl&&i.zlevel2===s.zl2?n._backgroundColor:null;i.clear(!1,l,o)}vM(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},I$),EF.wxa&&bM(this._i,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),r},e.prototype._paintPerCursor=function(e,t,n,r,i){var a=e.ctx;if(r){if(!r.length)t.drawIdx=t.endIdx;else for(var o=this.dpr,s=0;s<r.length;++s){var c=r[s];a.save(),a.beginPath(),a.rect(c.x*o,c.y*o,c.width*o,c.height*o),a.clip(),this._paintPerCursorInRect(e,t,n,c,i),a.restore()}}else a.save(),this._paintPerCursorInRect(e,t,n,null,i),a.restore();return t.drawIdx>=t.endIdx},e.prototype._paintPerCursorInRect=function(e,t,n,r,i){for(var a={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},o=e.ctx,s=uM(e),c=s&&oF.getTime(),l=t.drawIdx,u=t.notClearIdx,d=u>=0?Math.min(u,l):l;d<t.endIdx;d++){var f=n[d];if(!(d<l&&!f.notClear)){if(f.__inHover&&(this._hoverLayerDirty=M$),r!=null){var p=f.getPaintRect();p&&p.intersect(r)&&(PC(o,f,a),f.setPrevPaintRect(p))}else PC(o,f,a);if(s&&oF.getTime()-c>15){d++;break}}}FC(o,a),t.drawIdx=Math.max(d,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=k$,t=0);var i=yM(this._i,e)[t];return i||(i=mM(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&za(i,this._layerConfig[e],!0),(n||r&&e!==k$)&&(i.virtual=!0),this._insertLayer(i,e,t,!1),i.initContext()),i},e.prototype.insertLayer=function(e,t){this._insertLayer(t,e,0,!1)},e.prototype._insertLayer=function(e,t,n,r){var i=this._i,a=i.layers,o=i.layerStack,s=this._domRoot,c=null;if(!(a[t]&&a[t][n])&&fM(e)){for(var l=o.length,u=0;u<l&&(o[u].zl<t||o[u].zl===t&&o[u].zl2<n);)u++;if(u>0&&(c=yM(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),yM(i,t)[n]=e,!r&&!e.virtual){if(c){var d=c.dom;d.nextSibling?s.insertBefore(e.dom,d.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}e.painter||=this}},e.prototype.eachLayer=function(e,t){return bM(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return bM(this._i,function(n,r){e.call(t,n,r)},N$)},e.prototype.eachOtherLayer=function(e,t){return bM(this._i,function(n,r){e.call(t,n,r)},P$)},e.prototype.getLayers=function(){var e={};return bM(this._i,function(t,n,r){e[t.id]=t}),e},e.prototype._updateLayerStatus=function(e,t){var n=this;if(n._singleCanvas)for(var r=1;r<e.length;r++){var i=e[r];if(i.zlevel!==e[r-1].zlevel||i.incremental){n._needsManuallyCompositing=!0;break}}bM(n._i,function(e){e.__dirty=!1,vM(e,function(e){e.used=!1,e.endIdxNew=0,e.notClearIdx=-1})},I$);for(var a,o=null,s=null,c=!1,l=0,u=e.length;l<u;l++){var i=e[l],d=i.zlevel,f=i.incremental,p=void 0;if(a!==d&&(a=d,c=!1),f?(c=!0,p=1):p=c?2:0,(!o||d!==o.zlevel||p!==o.zlevel2)&&(o=n._ensureLayer(d,p),s=null,!o.__builtin__))La(`ZLevel `+d+` has been used by unknown layer `+o.id);else{if((!s||f!==s.key)&&(s=_M(o,f),!s.used)){if(s.used=!0,!t&&s.first===i.id){var m=l-s.startIdx;s.startIdx=l,s.drawIdx+=m,s.endIdx+=m}else o.__dirty=!0,s.first=i.id,s.startIdx=s.drawIdx=l,s.endIdx=l+1}s.endIdxNew=l+1,i.__dirty&1&&!i.__inHover&&((!f||!i.notClear&&l<s.drawIdx)&&(o.__dirty=!0),f&&i.notClear&&s.notClearIdx<0&&(s.notClearIdx=l))}}bM(n._i,function(t){for(var r=t.__cursorStack,i=t.__cursors,a=r.length-1;a>=0;a--){var o=i.get(r[a]);if(!o.used)t.__dirty=!0,i.removeKey(r[a]),r.splice(a,1);else{var s=o.endIdxNew;(uM(t)?s<o.drawIdx:s!==o.endIdx||!s||e[s-1].id!==o.last)&&(t.__dirty=!0),o.endIdx=o.endIdxNew,o.last=s?e[s-1].id:NaN}}t.__dirty&&(vM(t,function(e){e.drawIdx=e.startIdx}),n._hoverLayerDirty===A$&&(n._hoverLayerDirty=j$))},I$)},e.prototype.clear=function(){return bM(this._i,function(e){e.clear(),hM(e)},N$),this},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,bM(this._i,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?za(n[e],t,!0):n[e]=t,bM(this._i,function(e,t){za(e,n[t],!0)})}},e.prototype.delLayer=function(e){for(var t=this._i.layerStack,n=this._i.layers,r=t.length-1;r>=0;r--){var i=t[r];if(i.zl===e){var a=n[e][i.zl2];if(a.__builtin__)continue;if(t.splice(r,1),n[e][i.zl2]=void 0,!a.virtual){var o=a.dom.parentNode;o&&o.removeChild(a.dom)}}}},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;e!=null&&(r.width=e),t!=null&&(r.height=t),e=pC(i,0,r),t=pC(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,bM(this._i,function(n){n.resize(e,t)}),this.refresh({paintAll:!0})),this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this._ensureLayer(k$).resize(e,t)}return this},e.prototype.clearLayer=function(e){L(this._i.layers[e],function(e){e&&!e.__builtin__&&e.clear()})},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._i.layers[k$][0].dom;var t=new D$(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;bM(this._i,function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else{for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},o=this.storage.getDisplayList(!0),s=0,c=o.length;s<c;s++){var l=o[s];PC(n,l,a)}FC(n,a)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}(),R$=Object.freeze({INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`,JPY:`¥`}),z$=e=>typeof e==`string`&&/^[A-Z]{3}$/.test(e),B$=(e=`INR`)=>R$[e]??`${e} `,V$=`en-IN`,H$=/\{([A-Za-z0-9_]+)\}/g,U$=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0,W$=new Map,G$=0,K$=new Map,q$={aprShortLabel:`Apr`,aprilLabel:`April`,augShortLabel:`Aug`,augustLabel:`August`,decShortLabel:`Dec`,decemberLabel:`December`,emptyValueLabel:`-`,febShortLabel:`Feb`,februaryLabel:`February`,friMinLabel:`Fr`,friShortLabel:`Fri`,fridayLabel:`Friday`,janShortLabel:`Jan`,januaryLabel:`January`,julShortLabel:`Jul`,julyLabel:`July`,junShortLabel:`Jun`,juneLabel:`June`,marShortLabel:`Mar`,marchLabel:`March`,mayLabel:`May`,mayShortLabel:`May`,monMinLabel:`Mo`,monShortLabel:`Mon`,mondayLabel:`Monday`,novShortLabel:`Nov`,novemberLabel:`November`,octShortLabel:`Oct`,octoberLabel:`October`,satMinLabel:`Sa`,satShortLabel:`Sat`,saturdayLabel:`Saturday`,sepShortLabel:`Sep`,septemberLabel:`September`,sunMinLabel:`Su`,sunShortLabel:`Sun`,sundayLabel:`Sunday`,thuMinLabel:`Th`,thuShortLabel:`Thu`,thursdayLabel:`Thursday`,tueMinLabel:`Tu`,tueShortLabel:`Tue`,tuesdayLabel:`Tuesday`,wedMinLabel:`We`,wedShortLabel:`Wed`,wednesdayLabel:`Wednesday`},J$=`Asia/Kolkata`,Y$=198e5,X$=new Map,Z$=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],Q$=[`rupees`,`paise`],$$=[`ms`,`s`,`min`,`h`],e1=[`day`,`month`,`year`,`datetime`,`time`],t1=()=>EM(`formatters`,q$),n1=()=>t1().emptyValueLabel,r1=`−`,i1=[`janShortLabel`,`febShortLabel`,`marShortLabel`,`aprShortLabel`,`mayShortLabel`,`junShortLabel`,`julShortLabel`,`augShortLabel`,`sepShortLabel`,`octShortLabel`,`novShortLabel`,`decShortLabel`],a1={short:[`sunShortLabel`,`monShortLabel`,`tueShortLabel`,`wedShortLabel`,`thuShortLabel`,`friShortLabel`,`satShortLabel`],long:[`sundayLabel`,`mondayLabel`,`tuesdayLabel`,`wednesdayLabel`,`thursdayLabel`,`fridayLabel`,`saturdayLabel`],min:[`sunMinLabel`,`monMinLabel`,`tueMinLabel`,`wedMinLabel`,`thuMinLabel`,`friMinLabel`,`satMinLabel`]},o1=(e,t)=>t1()[wM(e[t],`no date name at index ${t}`)],s1=e=>o1(i1,e),c1=(e,t)=>wM(e[t],`no compact unit at index ${t}`),l1=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],u1=[[1e9,`B`],[1e6,`M`],[1e3,`K`]],d1=e=>!e||e===`INR`?`en-IN`:`en-US`,f1=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=20?e:t,p1=new Map,m1=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=p1.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:e}),p1.set(n,r)),r},h1=new Map,g1=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=h1.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:e,maximumFractionDigits:e}),h1.set(n,r)),r},_1=e=>typeof e==`number`&&Number.isFinite(e),v1=e=>e<0&&!Object.is(Math.abs(e),0)?r1:``,y1=(e,t)=>t===`paise`?Number(zM(e)):e,b1=2,x1=(e,t,n)=>{let r=Math.min(t,b1),i=10n**BigInt(b1-r),a=(BigInt(zM(e).replace(`.`,``))+i/2n)/i,o=10n**BigInt(r),s=g1(0,n).format(a/o);return t===0?s:`${s}.${(a%o).toString().padStart(r,`0`)}${`0`.repeat(t-r)}`},S1=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2,C1={ms:1,s:1e3,min:6e4,h:36e5},w1={aboveLabel:`Above`,areaChartLabel:`Area chart`,arrowKeysText:`{title}: use the arrow keys to read the values`,bandLabel:`Band`,barChartLabel:`Bar chart`,belowLabel:`Below`,bubbleChartLabel:`Bubble chart`,calendarHeatmapLabel:`Calendar heatmap`,calendarRangeText:`, from {first} to {last}`,calendarSummaryTextOne:`Calendar heatmap of {label}, {n} day.`,calendarSummaryTextOther:`Calendar heatmap of {label}, {n} days{range}.`,categoryLabel:`Category`,centerLabel:`Total`,changeLabel:`Change`,chartLabel:`chart`,columnChartLabel:`Column chart`,columnFallbackLabel:`column`,columnXLabel:`X`,constantSpanText:`{label} is {lo}.`,currencyFormatText:`This chart's currency format needs a currency code, such as "INR", in its currency field.`,dataSuffixLabel:`data`,dateLabel:`Date`,donutChartLabel:`Donut chart`,donutLargestText:`{top} is the largest, at {share}.`,donutSummaryTextOne:`Donut chart of {label} in {rows} part, {total} in all.`,donutSummaryTextOther:`Donut chart of {label} in {rows} parts, {total} in all.`,emptyText:`No data to show for this chart.`,errorText:`This chart couldn't load. Try again in a moment.`,everySeriesHiddenText:`Every series is hidden.`,firstStageLabel:`first stage`,fromLabel:`From`,funnelChartLabel:`Funnel chart`,funnelPreviousStepText:`{share} of previous step`,funnelStartText:`{first} is {firstValue} and {last} is {lastValue}, {share} of the start.`,funnelSummaryText:`Funnel chart of {label} in {n} stages.`,gaugeBandText:`, in the {band} band`,gaugeLabel:`Gauge`,gaugeSummaryText:`{type}: {label} is {value} on a scale from {min} to {max}{band}.`,groupLabel:`Group`,groupsTextOne:` in {count} group: {groups}`,groupsTextOther:` in {count} groups: {groups}`,heatmapLabel:`Heatmap`,heatmapSummaryText:`Heatmap of {label} by {group} and {x}, {n} cells.`,highestAtLowestAtText:`Highest is {highValue} at {highGroup}, {high}; lowest is {lowValue} at {lowGroup}, {low}.`,highestLowestText:`Highest is {maxValue} on {max}; lowest is {minValue} on {min}.`,itemLabel:`Item`,largestFallText:`The largest fall is {xText}, {signed}.`,largestFlowText:`The largest flow is {xText} to {toText}, {fmtAt}.`,largestRiseText:`The largest rise is {xText}, {signed}.`,latestText:`Latest {latest}`,legendLabel:`Legend`,lessLabel:`Less`,lineChartLabel:`Line chart`,loadingText:`Loading chart`,measureLabel:`Measure`,moreLabel:`More`,ofFirstStepText:`Of {first}`,ofPreviousStepLabel:`Of previous step`,openingShareText:`{share} of opening`,opensAtClosesAtText:`It opens at {opening} and closes at {closing}.`,otherLabel:`Other`,pointsSummaryTextOne:`{n} point, {first}.`,pointsSummaryTextOther:`{n} points, from {first} to {last}.`,rangeSpanText:`{label} runs from {lo} to {hi}.`,rowFallbackLabel:`row`,rowLabel:`Row`,runningTotalLabel:`Running total`,sankeyLabel:`Sankey diagram`,sankeySummaryText:`Sankey diagram of {label}: {n} flows between {nodes} places.`,scaleLabel:`Scale`,scaleRangeText:`{min} to {max}`,scatterPlotLabel:`Scatter plot`,scatterSummaryText:`{type} of {label} against {xLabel}, {count} points{groups}.`,shareLabel:`Share`,shareOfAllLabel:`Share of all`,shareOfGroupLabel:`Share of group`,shareOfParentText:`Share of {parent}`,shareOfStepText:`{share} of {first}`,sharedAxisText:`, sharing one x axis`,showingFirstRowsDownloadText:`Showing the first {rows} of {total} rows. Download the CSV for all of them.`,smallMultiplesLabel:`Small multiples`,stackedPercentText:`, stacked to 100%`,stackedText:`, stacked`,stageLabel:`Stage`,stepLabel:`Step`,summaryText:`{type} of {series}{stacked}{sharedAxis}.`,targetGapText:`{direction} {label} by {gap}`,targetLabel:`target`,toLabel:`To`,tooManyGroupsText:`This chart has more groups than it can show clearly.`,tooManySeriesText:`This chart has more series than it can show clearly.`,totalText:`Total {total}`,treemapEmptyText:`Treemap of {label}: no items.`,treemapLabel:`Treemap`,treemapLargestGroupText:`{name} is the largest group, at {share}.`,treemapSummaryText:`Treemap of {label}: {n} items in {totals} groups, {total} in all.`,trendLabel:`Trend`,untitledLabel:`Chart`,waterfallLabel:`Waterfall chart`,waterfallSummaryText:`Waterfall chart of {label}.`},Q=()=>EM(`chart`,w1),T1=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],E1=[`none`,`stacked`,`percent`],D1=[`category`,`time`,`value`],O1=[`auto`,`svg`,`canvas`],k1=[`ready`,`loading`,`empty`,`error`],A1=[`chart`,`table`],j1=[`chart-1`,`chart-2`,`chart-3`,`chart-4`,`chart-5`,`chart-6`,`chart-7`,`chart-8`],M1={line:`lineChartLabel`,area:`areaChartLabel`,column:`columnChartLabel`,bar:`barChartLabel`,donut:`donutChartLabel`,heatmap:`heatmapLabel`,calendar:`calendarHeatmapLabel`,funnel:`funnelChartLabel`,gauge:`gaugeLabel`,waterfall:`waterfallLabel`,treemap:`treemapLabel`,sankey:`sankeyLabel`,scatter:`scatterPlotLabel`,bubble:`bubbleChartLabel`,multiples:`smallMultiplesLabel`},N1=e=>Q()[M1[e]],P1=[`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],F1=e=>P1.includes(e),I1=[`area`,`column`,`bar`],L1=[`line`,`area`,`column`,`bar`,`multiples`],R1={line:[`category`,`time`],area:[`category`,`time`],column:[`category`,`time`],bar:[`category`,`time`],multiples:[`category`,`time`],calendar:[`time`],scatter:[`value`],bubble:[`value`]},z1={group:[`heatmap`,`treemap`,`scatter`,`bubble`],to:[`sankey`],size:[`bubble`],trend:[`scatter`,`bubble`],zoom:[`line`,`area`],bands:[`gauge`],centerLabel:[`donut`],sliceValues:[`donut`],valueLabels:[`line`,`column`,`bar`]},B1={gauge:240,calendar:200,treemap:340,sankey:340},V1=100,H1=72,U1=32,W1=[`type`,`title`,`description`,`data`,`x`,`series`,`group`,`to`,`size`,`trend`,`zoom`,`bands`,`stack`,`y`,`target`,`centerLabel`,`sliceValues`,`valueLabels`,`height`,`state`,`emptyText`,`errorText`,`loadingText`,`renderer`,`timeZone`],G1=[`key`,`kind`,`format`,`label`,`labelFit`],K1=[`auto`,`all`,`rotate`,`ellipsis`],q1=[`key`,`label`,`format`,`colour`],J1=[`key`,`label`],Y1=[`key`,`label`,`format`],X1=[`upTo`,`label`],Z1=[`label`,`format`,`min`,`max`,`wholeNumbers`],Q1=[`value`,`label`],$1=[`style`,`currency`,`unit`,`decimals`,`pattern`],e0=[...Q$,...$$],t0=new Set,n0=e=>e.map(e=>`"${e}"`).join(` | `),r0=e=>typeof e==`number`&&Number.isFinite(e),i0=e=>typeof e==`object`&&!!e&&!Array.isArray(e),a0=(e,t)=>Reflect.get(e,t),o0=e=>e===null||typeof e==`string`||typeof e==`number`,s0=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,o0(t)?t:null])),c0=(e,t)=>e.some(e=>e===t),l0=e=>[...new Set(e)],u0=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(e,t),1/0),d0=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(e,t),-1/0),f0=(e,t)=>e.data.map((n,r)=>K(e,t,r)).filter(e=>e!=null),p0=(e,t)=>t?G((e??0)/t,{style:`percent`}):n1(),m0=(e,t)=>t==null?n1():ZM(wN(e,t),`gauge band`).label,h0=(e,t,n)=>{if(!t.length)return null;let r=u0(t),i=d0(t);return r===i?OM(Q().constantSpanText,{label:e,lo:G(r,n)}):OM(Q().rangeSpanText,{label:e,lo:G(r,n),hi:G(i,n)})},g0=(e,t)=>{let n=oN(e);return G(K(e,n.key,t),n.format)},_0=864e5,v0={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},y0=e=>v0[e]??0,b0=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],x0=()=>EM(`chart`,w1),lw([wv,Yb,Sx,HD,uD,aD,UE,zD,qw,UO,bee,sA,qk,ik,KO,AA,SA,Cee,nj,PA,cM,xM]),S0=e=>typeof e==`number`,C0=e=>S0(e)?e:null,w0=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],T0=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`),E0=(e,t)=>{let n=e.filter(e=>typeof e==`number`&&Number.isFinite(e));return[Math.min(...t?[0,...n]:n),Math.max(...t?[0,...n]:n)]},D0=24,O0=4,k0=.6,A0=(e,t)=>String(e).length*t*k0,j0=(e,t)=>{let n=e[t];if(n===void 0)throw Error(`chart palette has no colour at slot ${t}`);return n},M0=[.2126,.7152,.0722],N0=e=>e.map(e=>e/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,n)=>e+t*(M0[n]??0),0),P0=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05),F0=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:oP(e,t)},{offset:1,color:oP(e,0)}]}),I0=(e,t)=>e+IM(e,t),L0=e=>[...new Set(e)],R0=(e,t)=>e.data.map((n,r)=>K(e,t,r)),z0=(e,t,n={})=>({type:`category`,data:t,axisLine:{lineStyle:{color:e.axis}},axisTick:{show:!1},axisLabel:{color:e.label,fontSize:12,margin:12,hideOverlap:!0},...n}),B0=(e,t,n={})=>({type:`value`,splitNumber:4,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:e.grid,type:`solid`,width:1}},axisLabel:{color:e.label,fontSize:12,formatter:t},...n}),V0=6048e5,H0=(e,t)=>{let n=FM(e,t);return`${n.year}-${String(n.month+1).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)}`},U0=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(t,e),1/0),W0=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(t,e),-1/0),G0=9,K0=24,q0=4,J0=72,Y0=12,X0=(e,t)=>Math.floor(t/Math.max(1,e)-q0),Z0=12,Q0=44,$0=28,e2=8,t2=32,n2=8,r2=26,i2={donut:pP,heatmap:gP,calendar:vP,funnel:yP,gauge:bP,waterfall:EP,treemap:OP,sankey:AP,scatter:MP,bubble:MP,multiples:NP},a2=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`,typeof HTMLElement>`u`)throw Error(a2);o2=HTMLElement,s2=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0,c2=()=>EM(`chart`,w1),l2=`wui-chart:select`,u2=`wui-chart:legend-change`,d2=`wui-chart:ready`,f2=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],p2=`(prefers-color-scheme: dark)`,m2=`(prefers-reduced-motion: reduce)`,h2=`(forced-colors: active)`,g2=`(prefers-contrast: more)`,_2=`print`,v2=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,y2=!1,b2=new Map,x2=[...[1,2,3,4,5,6,7,8].map(e=>`--color-chart-${e}`),...[0,1,2,3,4,5,6].map(e=>`--color-chart-seq-${e}`),`--color-chart-neutral`,`--wui-chart-rise`,`--wui-chart-fall`,`--color-chart-grid`,`--color-chart-axis`,`--color-chart-label`,`--color-surface`,`--color-text`,`--color-text-body`,`--color-text-muted`],S2=new Set,C2=null,w2=0,T2=class extends o2{static get observedAttributes(){return[`view`]}constructor(){super(),KP(this,`uid`,void 0),KP(this,`_spec`,void 0),KP(this,`_normal`,void 0),KP(this,`_hidden`,void 0),KP(this,`_focus`,void 0),KP(this,`_awaitingSpec`,!1),KP(this,`_parts`,null),KP(this,`_theme`,null),KP(this,`_width`,null),KP(this,`_visible`,!1),KP(this,`_resizeObserver`,null),KP(this,`_intersection`,null),KP(this,`_engine`,null),KP(this,`_drawn`,!1),KP(this,`_drawnType`,null),KP(this,`_announcedReady`,!1),KP(this,`_legendSignature`,null),KP(this,`_tableSpec`,null),w2+=1,this.uid=`wui-chart-${w2}`,this._spec=null,this._normal=null,this._hidden=new Set,this._focus=null}get spec(){return this._spec}set spec(e){this._spec=e??null,this._normal=null,this._clearFocus(),this._parts&&this._update()}get view(){return this.getAttribute(`view`)===`table`?`table`:`chart`}set view(e){this.setAttribute(`view`,String(e??`chart`))}connectedCallback(){if(s2(this,`spec`)){let e=this.spec;delete this.spec,this._spec=e??null}if(this._spec??=this._readScript(),this._spec==null&&!this.querySelector(`:scope > script[type='application/json']`)&&(this._awaitingSpec=!0,queueMicrotask(()=>{this._awaitingSpec=!1,this._parts&&this._update()})),this._build(),YP(this),this._theme=JP(this),this._width=this.clientWidth,this._resizeObserver=new ResizeObserver(()=>this._resized()),this._resizeObserver.observe(this),typeof IntersectionObserver==`function`){this._visible=!1;let e=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&(e.disconnect(),this._visible=!0,this._update())},{threshold:.05});this._intersection=e,e.observe(this)}else this._visible=!0;this._update()}disconnectedCallback(){XP(this),this._resizeObserver?.disconnect(),this._intersection?.disconnect(),this._engine?.dispose(),this._engine=null,this._drawn=!1,this._parts=null,this.removeAttribute(`data-ready`)}attributeChangedCallback(e,t,n){t!==n&&this._parts&&(QM(`view`,n,A1),this._update())}toCsv(){let{spec:e}=this._normalized();return e?BN(e):``}toPng(){let{spec:e}=this._normalized();return e?LP(e,this._theme??JP(this),this._size(e),{hidden:this._hidden,renderer:hN(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));ZP(t,e??`${VN(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&ZP(t,e??`${VN(this._normalized().spec)}.png`)}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!(e instanceof HTMLScriptElement))return null;try{return JSON.parse(String(e.textContent))}catch(e){return CM(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e instanceof Error?e.message:void 0),null}}_normalized(){return this._normal??=nN(this._spec),this._normal}_build(){let e=TM(`div`,{class:`wui-chart-legend`});e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,c2().legendLabel),e.hidden=!0,e.addEventListener(`click`,e=>{let t=e.target instanceof Element?e.target.closest(`.wui-chart-legend-item`):null;t instanceof HTMLElement&&this._toggle(t.dataset.key)});let t=TM(`div`,{class:`wui-chart-surface`});t.tabIndex=0,t.setAttribute(`role`,`group`),t.setAttribute(`aria-roledescription`,c2().chartLabel),t.addEventListener(`keydown`,e=>this._onKey(e)),t.addEventListener(`blur`,()=>this._clearFocus());let n=TM(`div`,{class:`wui-chart-canvas`});n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=TM(`div`,{class:`wui-chart-state`});r.setAttribute(`role`,`status`),r.hidden=!0;let i=TM(`div`,{class:`wui-chart-table-wrap visually-hidden`}),a=TM(`p`,{class:`visually-hidden`});a.id=`${this.uid}-summary`;let o=TM(`div`,{class:`visually-hidden`});o.setAttribute(`aria-live`,`polite`),this.replaceChildren(e,t,r,i,a,o),this.setAttribute(`role`,`figure`),this.setAttribute(`aria-describedby`,a.id),this._parts={legend:e,surface:t,canvas:n,state:r,tableWrap:i,summary:a,live:o},this._legendSignature=null,this._tableSpec=null}_size(e){return{width:this._parts?.surface.clientWidth||this.clientWidth||800,height:e.height}}_update(){if(!this._parts||this._awaitingSpec&&this._spec==null)return;let{spec:e,problem:t}=this._normalized(),n=this._parts,r=e===null?`error`:e.state===`ready`&&(!e.data.length||!cN(e))?`empty`:e.state,i=`${e?.height??320}px`,a=this.view===`table`,o=e!==null&&(r===`ready`||r===`loading`&&this._drawn),s=r===`loading`&&o;if(this.setAttribute(`aria-label`,e?.title||c2().untitledLabel),r===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`),this.setAttribute(`data-state`,r),n.surface.setAttribute(`aria-label`,OM(c2().arrowKeysText,{title:e?.title||c2().untitledLabel})),n.summary.textContent=e?HN(e,this._hidden):``,e){if(!s){let t=new Set(gN(e));for(let e of this._hidden)t.has(e)||this._hidden.delete(e)}this._renderTable(e)}else n.tableWrap.replaceChildren();s||this._renderLegend(e,o&&!a),this._renderState(r,e===null?t:r===`error`?e.errorText:r===`loading`?e.loadingText??c2().loadingText:e.emptyText,i,o);let c=r===`ready`&&!a;s||this.toggleAttribute(`data-ready`,!c);let l=n.surface.hidden&&o&&!a;n.surface.hidden=!o||a,n.surface.style.height=i,n.tableWrap.className=a&&e?`wui-chart-table-wrap`:`wui-chart-table-wrap visually-hidden`,n.tableWrap.style.height=a&&e?i:``,a&&e?(n.tableWrap.tabIndex=0,n.tableWrap.setAttribute(`role`,`region`),n.tableWrap.setAttribute(`aria-label`,`${e.title||c2().untitledLabel} ${c2().dataSuffixLabel}`)):(n.tableWrap.removeAttribute(`tabindex`),n.tableWrap.removeAttribute(`role`),n.tableWrap.removeAttribute(`aria-label`)),l&&this._engine?.resize(),r===`ready`&&!a&&this._visible&&this._draw()}_renderState(e,t,n,r){let i=this._parts?.state;if(!i)return;let a=!r&&e!==`ready`;i.hidden=!a,a?(i.style.height=n,e===`loading`?i.replaceChildren(TM(`div`,{class:`skeleton wui-chart-skeleton`}),TM(`span`,{class:`visually-hidden`},t)):i.replaceChildren(TM(`p`,{class:`wui-chart-state-text`},t))):i.replaceChildren()}_colour(e,t){let n=this._theme;if(!n)return;if(e.type===`donut`)return kN(e,t,n);let r=e.series[t],i=e.type===`line`||e.type===`area`||e.type===`column`||e.type===`bar`;return n.palette[r&&i?NN(r,t):t]}_renderLegend(e,t){let n=this._parts?.legend;if(!n)return;let r=e?gN(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!e||!i)return;let a=_N(e),o=r.map((t,n)=>this._colour(e,n)),s=JSON.stringify([e.type,r,a,o]);s!==this._legendSignature&&(this._legendSignature=s,n.replaceChildren(...r.map((t,n)=>{let r=TM(`button`,{class:`wui-chart-legend-item`});r.type=`button`,r.dataset.key=t;let i=TM(`span`,{class:e.type===`line`?`wui-chart-legend-swatch wui-chart-legend-swatch-line`:`wui-chart-legend-swatch`}),s=o[n];return s!==void 0&&(i.style.background=s),r.append(i,TM(`span`,{class:`wui-chart-legend-label`},a[n])),r})));for(let e of n.children){if(!(e instanceof HTMLElement))throw Error(`Expected a legend item to be an HTMLElement.`);let t=e.dataset.key;e.setAttribute(`aria-pressed`,String(t===void 0||!this._hidden.has(t)))}}_renderTable(e){if(this._tableSpec===e||!this._parts)return;this._tableSpec=e;let t=LN(e),n=TM(`table`,{class:`wui-chart-table`});n.append(TM(`caption`,{class:`visually-hidden`},t.caption));let r=TM(`tr`);t.head.forEach((e,t)=>{let n=TM(`th`,t?{class:`wui-chart-num`}:null,e);n.scope=`col`,r.append(n)});let i=TM(`thead`);i.append(r),n.append(i);let a=TM(`tbody`);for(let e of t.rows){let t=TM(`tr`),n=TM(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>TM(`td`,{class:`wui-chart-num`},e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push(TM(`p`,{class:`wui-chart-table-note`},OM(c2().showingFirstRowsDownloadText,{rows:t.rows.length,total:t.total}))),this._parts.tableWrap.replaceChildren(...o)}_draw(){let{spec:e}=this._normalized();if(!e||!this._parts||!this._theme)return;let t=hN(e),n=e.type!==this._drawnType;this._engine&&this._engine.renderer!==t&&(this._engine.dispose(),this._engine=null);let r=`${e.height}px`,i=this._parts.canvas.style.height!==r;this._parts.canvas.style.height=r,i&&this._engine?.resize(),this._engine||(this._engine=RP(this._parts.canvas,{renderer:t}),this._engine.onSelect(({seriesIndex:e,dataIndex:t})=>this._select(e,t)),this._engine.onFinished(()=>{this.setAttribute(`data-ready`,``),this._announcedReady||(this._announcedReady=!0,this.dispatchEvent(new CustomEvent(d2,{bubbles:!0,detail:{renderer:t}})))}),n=!0),this._engine.render(e,this._theme,this._size(e),{hidden:this._hidden,renderer:t},{replace:n}),this._drawnType=e.type,this._drawn=!0}_themeChanged(e=!1){if(!this._parts)return;let t=JP(this);JSON.stringify(t)!==JSON.stringify(this._theme)&&(this._theme=t,this._update(),e&&this._engine?.flush())}_resized(){let e=this.clientWidth;e!==this._width&&(this._width=e,this._engine&&this._drawn&&this._parts&&(this._parts.surface.hidden||this._engine.resize(),this._update()))}_toggle(e){let{spec:t}=this._normalized();if(!t||e==null)return;this._hidden.has(e)?this._hidden.delete(e):this._hidden.add(e),this._clearFocus(),this._update();let n=Object.fromEntries(gN(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(u2,{bubbles:!0,detail:{visible:n}}))}_onKey(e){let{spec:t}=this._normalized();if(!t||!this._engine||!this._theme||this.view===`table`||e.altKey||e.ctrlKey||e.metaKey)return;if(BP(e)){if(!this._focus)return;e.preventDefault(),this._select(this._focus.series,this._focus.index);return}if(!f2.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=KN(t,this._focus,HP(e.key,VP(this)),this._hidden);n?(this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(FN(AN(t,n.index,this._hidden,this._theme)))):this._clearFocus()}_announce(e){let t=this._parts?.live;t&&(t.textContent=e===t.textContent?`${e} `:e)}_clearFocus(){this._focus&&(this._focus=null,this._engine?.clearFocus(),this._parts&&(this._parts.live.textContent=``))}_select(e,t){let{spec:n}=this._normalized();if(!n)return;let r=n.series[F1(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(l2,{bubbles:!0,detail:{series:r.key,label:r.label,x:i?.[n.x.key]??null,value:K(n,r.key,t),row:i,index:t}}))}},Pa(`wui-chart`,T2)})),D2=null;async function O2(){await Promise.resolve().then(()=>(E2(),Na)),await customElements.whenDefined(`wui-chart`)}async function k2(){return D2??=O2().catch(e=>{throw D2=null,e}),D2}var A2={sub:`wui-chat-sub`,sup:`wui-chat-sup`};function j2(e,t){let n=e.ownerDocument??document;for(let r of t)if(r.kind===`sub`||r.kind===`sup`){let t=n.createElement(r.kind);t.className=A2[r.kind],t.textContent=r.text,e.append(t)}else e.append(n.createTextNode(r.text))}function M2(e,t){e.replaceChildren(),j2(e,un(String(t??``)))}function N2(e){return dn(String(e??``))}function P2(e){return fn(e)}var F2=8,I2=8,L2={Bar:`column`,Line:`line`,Donut:`donut`};function R2(e,t){return e===`Bar`&&t>4?300:240}function z2(e,t){let n=e.chartType===`Donut`,r=n?e.series.slice(0,1):e.series.slice(0,F2),i=r.map((e,n)=>({key:`s${n}`,label:N2(e.name)||t.chart})),a=Object.fromEntries(i.map(e=>[e.key,null])),o=new Map;r.forEach((e,t)=>{for(let n of e.points){let e=String(n.label),r=o.get(e);r===void 0&&(r={label:N2(e),...a},o.set(e,r)),r[`s${t}`]=n.value}});let s=[...o.values()],c={type:L2[e.chartType],title:N2(e.title)||t.chart,x:{key:`label`,kind:`category`},series:i,data:s,height:R2(e.chartType,s.length)};return e.chartType===`Bar`&&s.length<=I2&&(c.x.labelFit=`all`,c.valueLabels=!0),!n&&e.unit&&(c.y={label:N2(e.unit)}),s.length===0&&(c.state=`empty`,c.emptyText=t.chartEmpty),c}ba(`wui-chat-part-chart`,class extends ya{#e=null;#t=0;#n=null;#r=null;#i=null;#a=null;renderPart(e,t,n){let r=JSON.stringify(e);if(r===this.#e)return;this.#e=r,this.#t+=1;let i=this.#t,a=this.ownerDocument??document,o=this.#o(a);if(this.#r?.remove(),this.#r=null,e.title){let t=P(a,`figcaption`,`wui-chat-chart-title`);M2(t,e.title),o.figure.prepend(t),this.#r=t}let s=this.#i;if(s!==null){let t=z2(e,n.labels);Object.assign(s,{spec:t}),this.#s(o,s,t.state!==`empty`,n.labels)}else k2().then(()=>{if(i!==this.#t||!this.isConnected)return;let t=z2(e,n.labels),r=a.createElement(`wui-chart`);Object.assign(r,{spec:t}),this.#i=r,o.body.replaceChildren(r),this.#s(o,r,t.state!==`empty`,n.labels)},()=>{i===this.#t&&this.isConnected&&this.#l(o.body,n.labels)})}disposePart(){this.#t+=1,this.#e=null}#o(e){if(this.#n===null){let t=P(e,`figure`,`wui-chat-chart`),n=P(e,`div`,`wui-chat-chart-body`);t.append(n),this.replaceChildren(t),this.#n={figure:t,body:n}}return this.#n}#s(e,t,n,r){if(!n){this.#a?.remove(),this.#a=null;return}if(!this.#a){let n=P(this.ownerDocument??document,`button`,`btn btn-link btn-sm wui-chat-chart-toggle`);n.type=`button`,n.addEventListener(`click`,()=>this.#c(e,t)),e.figure.append(n),this.#a=n}let i=t.getAttribute(`view`)===`table`;this.#a.setAttribute(`aria-pressed`,String(i)),this.#a.textContent=i?r.chartShowChart:r.chartShowTable}#c(e,t){let n=this.activeTurn,r=t.getAttribute(`view`)!==`table`;t.setAttribute(`view`,r?`table`:`chart`),this.#s(e,t,!0,n.labels)}#l(e,t){let n=P(this.ownerDocument??document,`p`,`wui-chat-chart-error`,t.chartLoadFailed);n.setAttribute(`role`,`status`),e.replaceChildren(n),this.#a?.remove(),this.#a=null}});var B2={Positive:`wui-metric-tone-success`,Caution:`wui-metric-tone-warning`,Negative:`wui-metric-tone-danger`},V2=new Set([`Positive`,`Caution`,`Negative`]),H2=.001;function U2(e,t,n){let r=B2[t.status],i=P(e,`div`,r?`wui-metric ${r}`:`wui-metric`);i.dataset.status=t.status;let a=P(e,`div`,`wui-metric-label`);M2(a,t.label);let o=P(e,`div`,`wui-metric-value`);if(j2(o,t.value!==0&&Math.abs(t.value)<H2?P2(t.value):[{kind:`text`,text:zi(t.value)}]),t.unit){let n=P(e,`span`,`wui-chat-figure-unit`);M2(n,t.unit),n.prepend(` `),o.append(n)}return V2.has(t.status)&&o.append(P(e,`span`,`visually-hidden`,n.figureStatus(t.status))),i.append(a,o),i}ba(`wui-chat-part-figures`,class extends ya{#e=null;renderPart(e,t,n){let r=JSON.stringify(e);if(r===this.#e)return;if(this.#e=r,!e.figures||e.figures.length===0){this.replaceChildren();return}let i=this.ownerDocument??document,a=P(i,`div`,`wui-chat-figures`),o=P(i,`div`,`wui-metric-strip wui-metric-strip-sm wui-chat-figures-strip`);o.setAttribute(`role`,`group`),o.setAttribute(`aria-label`,n.labels.figures);for(let t of e.figures)o.append(U2(i,t,n.labels));a.append(o),this.replaceChildren(a)}}),ba(`wui-chat-part-file`,class extends ya{renderPart(e,t,n){let r=n.openAttachment,i=typeof r==`function`,a=document.createElement(i?`button`:`span`);a.className=`wui-chat-file-chip`,i&&(a.setAttribute(`type`,`button`),a.setAttribute(`aria-label`,n.labels.fileOpen(e.fileName)),a.addEventListener(`click`,()=>r(e)));let o=xa(document,`document-text`,16),s=document.createElement(`span`);s.className=`wui-chat-file-name`,s.textContent=e.fileName;let c=document.createElement(`span`);c.className=`wui-chat-file-size`,c.textContent=Qn(e.length),a.append(...[o,s,c].filter(e=>e!==null));let l=document.createElement(`div`);l.className=`wui-chat-file`,l.append(a),this.replaceChildren(l)}});var W2=`(prefers-reduced-motion: reduce)`;function G2(e,t){let n=e.style.animation;e.style.animation=`none`;let r=e.getBoundingClientRect();e.style.animation=n,e.style.transformOrigin=`${t.left+t.width/2-r.left}px ${t.top+t.height/2-r.top}px`}function K2(e,t){let n=typeof window.matchMedia==`function`?window.matchMedia(W2):null,r=new Set,i=()=>e.motion===`Reduced`||t?.motion===!1||n?.matches===!0,a=i();function o(){let e=i();if(e!==a){a=e;for(let e of r)e(a)}}return n?.addEventListener(`change`,o),{get reduced(){return a},subscribe(e){return r.add(e),()=>{r.delete(e)}},destroy(){n?.removeEventListener(`change`,o),r.clear()}}}var q2=`AppButton`,J2={primary:`btn-primary`,secondary:`btn-soft-primary`,ghost:`btn-ghost-primary`,outline:`btn-outline-primary`,neutral:`btn-soft-neutral`,danger:`btn-danger`};function Y2(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function $(e,t,n){let r=document.createElement(e);if(t&&(r.className=t),n)for(let[e,t]of Object.entries(n))t!=null&&r.setAttribute(e,t);return r}function X2(e,t=16){return Xi(e,{size:t})??$(`span`,`d-inline-flex`)}function Z2(e=`primary`,t=`md`){if(!Y2(J2,e))throw Error(`Unknown button variant "${e}". Use one of ${Object.keys(J2).join(`, `)}.`);return`btn ${J2[e]}${t===`sm`?` btn-sm`:``}`}function Q2(e,t,n,r){let i=$(`button`,`${Z2(e,`sm`)} wui-chat-action-btn`,{type:`button`});return i.dataset.wui=q2,n&&i.append(X2(n,14)),i.append(document.createTextNode(t)),i.addEventListener(`click`,r),i}function $2(e,t,n){let r=$(`button`,`wui-chat-icon-btn`,{type:`button`,"aria-label":e,title:e});return r.append(X2(t,20)),r.addEventListener(`click`,n),r}function e4(e,t){let n=e.getAttribute(t);if(n!=null&&n!==``)try{return JSON.parse(n)}catch(e){throw Error(`<wui-chat ${t}> must be valid JSON.`,{cause:e})}}function t4(e){let t;return n=>{let r=e.dataset.state;if((!n||r!==`open`&&r!==`opening`)&&(n||r!==`closed`&&r!==`closing`)){if(clearTimeout(t),n)e.dataset.state=`opening`,t=setTimeout(()=>{e.dataset.state=`open`},620);else{e.dataset.state=`closing`;let n=e.classList.contains(`wui-chat--panel-motion-none`)?0:300;t=setTimeout(()=>{e.dataset.state=`closed`},n)}}}}function n4(e,t){t.position!==void 0&&(e.classList.toggle(`wui-chat--end`,t.position===`end`),e.classList.toggle(`wui-chat--start`,t.position===`start`)),t.reduced!==void 0&&e.classList.toggle(`wui-chat--reduced`,!!t.reduced),t.expressive!==void 0&&e.classList.toggle(`wui-chat--expressive`,t.expressive===!0),t.sendReveal!==void 0&&e.classList.toggle(`wui-chat--send-always`,t.sendReveal===`Always`),t.inputRing!==void 0&&e.classList.toggle(`wui-chat--input-ring-off`,t.inputRing===!1),t.panelMotion!==void 0&&(e.classList.toggle(`wui-chat--panel-motion-gentle`,t.panelMotion===`Gentle`),e.classList.toggle(`wui-chat--panel-motion-none`,t.panelMotion===`None`)),t.offsetX!==void 0&&e.style.setProperty(`--wui-chat-offset-x`,`${t.offsetX}px`),t.offsetY!==void 0&&e.style.setProperty(`--wui-chat-offset-y`,`${t.offsetY}px`),t.width!==void 0&&e.style.setProperty(`--wui-chat-width`,t.width),t.maxHeight!==void 0&&e.style.setProperty(`--wui-chat-panel-max-height`,`${t.maxHeight}px`),t.bottomGap!==void 0&&e.style.setProperty(`--wui-chat-bottom-gap`,`${t.bottomGap}px`),t.panelHeight!==void 0&&e.classList.toggle(`wui-chat--panel-height-content`,t.panelHeight===`Content`),t.avatar!==void 0&&(t.avatar?(e.style.setProperty(`--wui-chat-avatar`,`url(${JSON.stringify(t.avatar)})`),e.style.setProperty(`--wui-chat-typing-mark`,`url(${JSON.stringify(t.avatar)})`)):(e.style.removeProperty(`--wui-chat-avatar`),e.style.removeProperty(`--wui-chat-typing-mark`))),t.replyAvatars!==void 0&&e.classList.toggle(`wui-chat--reply-avatars-off`,t.replyAvatars===!1)}var r4=[`Text`,`Sources`,`QuickReplies`,`InputRequest`,`Action`,`Notice`,`Table`,`Chart`,`Figures`,`RecordCard`,`Image`,`File`,`Ticket`,`Handoff`,`VoiceClip`],i4={launcher:`wui-chat--launcher`,docked:`wui-chat--docked`,"full-page":`wui-chat--full-page`,embedded:`wui-chat--embedded`};function a4(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function o4({id:e,layout:t,position:n,role:r,launcher:i,onToggle:a}){let o=$(`div`,`wui-chat ${i4[t]} wui-chat--${n}`),s=$(`section`,`wui-chat-panel`,{id:e,role:r}),c=i?t4(o):null;o.dataset.state=i?`closed`:`open`;let l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=`round`,_=!1,v=`bubble`,y=null,b=null,x=!1,S=`icon`,C=!1;function w(){if(!l)return;let e=l.dataset.launcher,t=[`wui-chat-launcher-wrap`];e===`entering`&&y&&t.push(`wui-chat-launcher--entrance-${y}`),e===`idle`&&b&&b!==`none`&&(b!==`ring`||g===`pill`)&&t.push(`wui-chat-launcher--idle-${b}`),l.className=t.join(` `)}function T(){if(!u)return;let e=[...u.classList].filter(e=>e.endsWith(`--opening`)||e.endsWith(`--closing`)),t=[`wui-chat-launcher`,`wui-chat-launcher--${g}`];g===`pill`&&_&&t.push(`wui-chat-launcher--compact`),S!==`icon`&&t.push(`wui-chat-launcher--mark-${S}`),t.push(`wui-chat-launcher--reveal-${v}`,...e),u.className=t.join(` `)}function E(){p&&m&&(p.textContent=h||m.launcher)}function D(){if(!u||!f||!m)return;let e=C?m.launcherClose:h||m.launcher;u.setAttribute(`aria-label`,e),f.textContent=e}if(i){let t=$(`div`,`wui-chat-launcher-wrap`);l=t,t.dataset.launcher=`idle`;let n=$(`button`,`wui-chat-launcher`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-controls":e});u=n;let r=$(`span`,`wui-chat-launcher-icon`,{"aria-hidden":`true`});d=r,r.append(X2(`chat`,24));let i=$(`span`,`wui-chat-launcher-close`,{"aria-hidden":`true`});i.append(X2(`x`,24));let c=$(`span`,`wui-chat-launcher-label`);f=c,n.append(r,i,c),n.addEventListener(`click`,()=>a()),n.addEventListener(`animationend`,e=>{e.target===n&&n.classList.remove(`wui-chat-launcher--opening`,`wui-chat-launcher--closing`)});let m=$(`span`,`wui-chat-launcher-bubble`,{"aria-hidden":`true`});p=m,t.append(n,m),t.addEventListener(`animationend`,e=>{e.target===t&&t.dataset.launcher===`entering`&&(t.dataset.launcher=`idle`,w())}),T(),w(),o.append(t,s)}else o.append(s);function O(e){if(!c)return;let t=e&&!C&&u!==null&&u?u.getBoundingClientRect():null;e!==C&&u&&(u.classList.remove(`wui-chat-launcher--opening`,`wui-chat-launcher--closing`),u.classList.add(e?`wui-chat-launcher--opening`:`wui-chat-launcher--closing`)),C=e,c(e),t&&G2(s,t),u&&(u.setAttribute(`aria-expanded`,String(e)),D())}function k(e){m=e,u&&(D(),E())}function A(e){if(n4(o,e),e.theme!==void 0&&(e.theme===`light`||e.theme===`dark`?o.dataset.theme=e.theme:delete o.dataset.theme),!u||!l||!d)return;e.launcherStyle!==void 0&&(g=e.launcherStyle===`Pill`?`pill`:`round`),e.compact!==void 0&&(_=e.compact),e.labelReveal!==void 0&&(v=e.labelReveal===`Expand`?`expand`:`bubble`),e.entrance!==void 0&&(y=e.entrance===`None`?null:a4(e.entrance)),e.idle!==void 0&&(b=e.idle===`None`?`none`:a4(e.idle)),e.phone!==void 0&&(x=e.phone),e.hoverLabel!==void 0&&(h=e.hoverLabel||null),e.launcherMark!==void 0&&(S=a4(e.launcherMark)),e.icon!==void 0&&e.icon!==d.dataset.icon&&(d.dataset.icon=e.icon,d.replaceChildren(X2(e.icon,24)));let t=e.launcherState??l.dataset.launcher;x&&t===`entering`&&(t=`idle`),t===`entering`&&!y&&(t=`idle`),l.dataset.launcher=t,T(),w(),E(),D()}return{root:o,panel:s,setOpen:O,setLabels:k,setAppearance:A,nudgeHost:l,launcherButton:u,role:r}}var s4={Open:`info`,InProgress:`info`,WaitingOnCustomer:`warning`,Resolved:`success`,Closed:`neutral`,Cancelled:`neutral`},c4=/^\/[/\\]/,l4=/^https?:\/\//i,u4=/[\t\r\n]/g;function d4(e){return typeof e==`string`&&e.trim()!==``}function f4(e){return e.replace(u4,``)}function p4(e){if(typeof e!=`string`)return!1;let t=f4(e);return t.startsWith(`/`)?!c4.test(t):l4.test(t)}function m4(e){if(typeof e!=`string`)return`?`;let t=e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>([...e][0]??``).toUpperCase()).join(``);return t===``?`?`:t}function h4(e,t){let n=e?.displayName,r=m4(d4(n)?n:t),i=$(`span`,`wui-chat-avatar`,{"aria-hidden":`true`}),a=e?.avatarUrl,o=typeof a==`string`?f4(a):null;if(p4(o)){let e=$(`img`,null,{alt:``,src:o,loading:`lazy`});e.addEventListener(`error`,()=>{i.textContent=r}),i.append(e)}else i.textContent=r;return i}function g4(e,t){let n=$(`div`,`wui-chat-agent-head`),r=$(`span`,`wui-chat-agent-name`),i=e?.displayName;r.textContent=d4(i)?i:t.agent;let a=$(`span`,`wui-chat-agent-role wui-chat-agent-tag`);return a.textContent=t.agent,n.append(h4(e,t.agent),r,a),n}function _4(e,t){let n=e.displayName,r=$(`li`,`wui-chat-message wui-chat-message--agent wui-chat-message--typing`),i=$(`span`,`wui-chat-typing`);for(let e=0;e<3;e+=1)i.append($(`span`,`wui-chat-typing-dot`,{"aria-hidden":`true`}));let a=$(`span`,`visually-hidden`);return a.textContent=t.agentTyping(d4(n)?n:t.agent),r.append(g4({kind:`Agent`,displayName:n,avatarUrl:null},t),i,a),r}function v4(e){return typeof e==`string`&&Y2(s4,e)?s4[e]??null:null}function y4(e,t){return v4(e)===null?``:t.ticketStatus(e)}var b4=new Set([`Requested`,`Waiting`]),x4=new Set([`Requested`,`Waiting`,`Joined`]),S4=x4;function C4(e,t){let n=e?.displayName;return typeof n==`string`&&n.trim()!==``?n:t.handoffAgentFallback}function w4(){let e=$(`div`,`wui-chat-handoff-pulses`);for(let t=0;t<3;t+=1)e.append($(`span`,`wui-chat-handoff-pulse`,{"aria-hidden":`true`}));return e}function T4(e,t,n){let r=$(e,t);return r.textContent=n,r}function E4(e,t){let n=$(`div`,`wui-chat-handoff-body`);return n.append(T4(`strong`,`wui-chat-handoff-title`,e),T4(`p`,`wui-chat-handoff-text`,t)),n}function D4(e,t){if(typeof e.queuePosition!=`number`){let e=$(`span`,`wui-chat-system-line-stack`);return e.append(T4(`p`,`wui-chat-handoff-text`,t.handoffWaiting),T4(`p`,`wui-chat-handoff-text`,t.handoffQueuedText)),[w4(),e]}let n=$(`span`,`wui-chat-handoff-position`,{"aria-hidden":`true`});return n.textContent=String(e.queuePosition),[n,E4(t.handoffQueued(e.queuePosition),t.handoffQueuedText)]}function O4(e,t){let n=C4(e.agent,t),r=$(`span`,`wui-chat-handoff-agent`);return r.append(h4(e.agent,t.handoffAgentFallback),$(`span`,`wui-chat-handoff-online`,{"aria-hidden":`true`})),[r,E4(t.handoffJoined(n),t.handoffJoinedText(n))]}function k4(e,t){switch(e.state){case`Requested`:return[w4(),T4(`p`,`wui-chat-handoff-text`,t.handoffRequested)];case`Waiting`:return D4(e,t);case`Joined`:return O4(e,t);case`Left`:return[E4(t.handoffLeft(C4(e.agent,t)),t.handoffLeftText)];case`Ended`:return[E4(t.handoffEnded,t.handoffEndedText)];default:return null}}ba(`wui-chat-part-handoff`,class extends ya{_signature;constructor(){super(),this._signature=null}renderPart(e,t,n){let r=n.isLast,i=n.handoffSettled===!0&&b4.has(e.state),a=JSON.stringify([e.state,e.queuePosition,e.agent,r,n.features.HumanHandoff,n.busy,i]);if(a===this._signature)return;if(this._signature=a,i){this.replaceChildren();return}let o=k4(e,n.labels);if(o===null){this.replaceChildren();return}let s=$(`div`,`wui-chat-handoff wui-chat-handoff--${e.state.toLowerCase()}`);if(r&&b4.has(e.state)&&s.classList.add(`wui-chat-handoff--live`),r&&x4.has(e.state)&&s.setAttribute(`role`,`status`),S4.has(e.state)){s.classList.add(`wui-chat-system-line`);let e=$(`span`,`wui-chat-system-line-content`);e.append(...o),s.append(e)}else s.append(...o);this.replaceChildren(s)}});function A4(e,t){if(typeof customElements>`u`||customElements.get(e))return;let n=[];if(typeof document<`u`)for(let r of document.querySelectorAll(e))for(let i of Object.keys(r)){let a=Object.getOwnPropertyDescriptor(t.prototype,i);if(a&&(a.set||a.get)&&(n.push([r,i,Reflect.get(r,i)]),!Reflect.deleteProperty(r,i)))throw Error(`defineElement: could not clear the early "${i}" property on <${e}>.`)}customElements.define(e,t);for(let[t,r,i]of n)if(!Reflect.set(t,r,i))throw Error(`defineElement: could not restore the "${r}" property on <${e}>.`)}var j4=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(j4);var M4=HTMLElement,N4={closeLabel:`Close`,countText:`{position} of {total}`,downloadLabel:`Download`,imageFailedMessage:`This image can't be shown.`,label:`Image viewer`,nextImageLabel:`Next image`,previousImageLabel:`Previous image`,zoomInLabel:`Zoom in`,zoomOutLabel:`Zoom out`},P4=`a.wui-lightbox-item`,F4=1,I4=4,L4=.5,R4=2,z4=50,B4=6,V4=300,H4=300;function U4(e){return Number.isFinite(e)?Math.min(I4,Math.max(F4,e)):F4}function W4(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function G4(e,t){return Math.abs(e)<z4||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function K4(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}var q4=()=>Ti(`lightbox`,N4);function J4(e,t,n){let r=ki(`button`,{class:`u-action wui-lightbox-btn ${n}`,type:`button`,"aria-label":t,title:t});r.style.setProperty(`--wui-action-size`,`40px`);let i=Xi(e,{size:20});return r.replaceChildren(...i?[i]:[]),r}A4(`wui-lightbox`,class extends M4{_ui;_index;_zoom;_pan;_pointers;_gesture;_lastTap;_returnTo;_release;_onClick;static get observedAttributes(){return[`open-index`]}constructor(){super(),this._ui=null,this._index=0,this._zoom=F4,this._pan={x:0,y:0},this._pointers=new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._release=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target,n=t instanceof Element?t.closest(P4):null;if(!(n instanceof HTMLAnchorElement)||!this.contains(n))return;let r=this._links().indexOf(n);r<0||(e.preventDefault(),this.open(r))}}get _view(){if(!this._ui)throw Error(`<wui-lightbox> viewer is not open.`);return this._ui}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||q4().label}set label(e){this.setAttribute(`label`,String(e??``))}get layout(){return this.getAttribute(`layout`)===`single`?`single`:`gallery`}set layout(e){if(e===`single`)this.setAttribute(`layout`,`single`);else if(e===`gallery`||e===``)this.removeAttribute(`layout`);else throw Error(`<wui-lightbox> layout must be "gallery" or "single", received "${e}".`)}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick),this._syncOpenIndex()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}attributeChangedCallback(){this.isConnected&&this._syncOpenIndex()}_syncOpenIndex(){let e=this.getAttribute(`open-index`);e===null?this.close():this.open(Number(e))}_links(){return[...this.querySelectorAll(P4)].filter(e=>e instanceof HTMLAnchorElement)}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||K4(t)}})}open(e=0){let t=this._items();if(!t.length)return!1;if(!this._ui){let t=document.activeElement;this._returnTo=t instanceof HTMLElement||t instanceof SVGElement?t:null,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))}return this._show(e,t),!0}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._release?.(),this._release=null,this._ui.root.open&&this._ui.root.close(),this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null)}_build(){let e=ki(`dialog`,{class:`wui-lightbox-overlay`,role:`dialog`,"aria-label":this.label,tabindex:`-1`}),t=ki(`div`,{class:`wui-lightbox-bar`}),n=ki(`span`,{class:`wui-lightbox-count`,"aria-live":`polite`}),r=ki(`div`,{class:`wui-lightbox-tools`}),i=J4(`zoom-out`,q4().zoomOutLabel,`wui-lightbox-zoom-out`),a=J4(`zoom-in`,q4().zoomInLabel,`wui-lightbox-zoom-in`),o=ki(`a`,{class:`u-action wui-lightbox-btn wui-lightbox-download`,"aria-label":q4().downloadLabel,title:q4().downloadLabel});o.style.setProperty(`--wui-action-size`,`40px`);let s=Xi(`download`,{size:20});o.replaceChildren(...s?[s]:[]),o.hidden=!this.download;let c=J4(`x`,q4().closeLabel,`wui-lightbox-close`);r.append(i,a,o,c),t.append(n,r);let l=ki(`div`,{class:`wui-lightbox-stage`}),u=J4(`chevron-left`,q4().previousImageLabel,`wui-lightbox-nav wui-lightbox-prev`),d=J4(`chevron-right`,q4().nextImageLabel,`wui-lightbox-nav wui-lightbox-next`),f=ki(`img`,{class:`wui-lightbox-image`,decoding:`async`,draggable:`false`,alt:``}),p=ki(`p`,{class:`wui-lightbox-status`,role:`status`});l.append(f,p,u,d);let m=ki(`p`,{class:`wui-lightbox-caption`});e.append(t,l,m);let h={root:e,count:n,zoomOut:i,zoomIn:a,download:o,close:c,stage:l,prev:u,next:d,image:f,status:p,caption:m};this._ui=h,c.addEventListener(`click`,()=>this.close()),u.addEventListener(`click`,()=>this.step(-1)),d.addEventListener(`click`,()=>this.step(1)),i.addEventListener(`click`,()=>this._setZoom(this._zoom-L4)),a.addEventListener(`click`,()=>this._setZoom(this._zoom+L4)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),l.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),l.addEventListener(`pointermove`,e=>this._onPointerMove(e)),l.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),l.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),l.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),f.addEventListener(`load`,()=>{this._ui===h&&(p.textContent=``,l.removeAttribute(`aria-busy`),f.hidden=!1,this._applyTransform())}),f.addEventListener(`error`,()=>{this._ui===h&&(l.removeAttribute(`aria-busy`),f.hidden=!0,p.textContent=q4().imageFailedMessage)}),this.append(e),this._release=ma(e,{escape:!0,backdrop:!1,focus:`panel`,onRequestClose:()=>this.close()})}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,t){let n=this._view,r=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),i=t[r];if(!i)throw Error(`<wui-lightbox> image missing.`);let a=r!==this._index||!n.image.getAttribute(`src`);if(this._index=r,this._zoom=F4,this._pan={x:0,y:0},n.count.textContent=aee(q4().countText,{position:zi(r+1,{decimals:0}),total:zi(t.length,{decimals:0})}),n.caption.textContent=i.caption,n.caption.hidden=!i.caption,n.download.href=i.src,n.download.setAttribute(`download`,i.name),n.prev.hidden=n.next.hidden=t.length<2,n.stage.setAttribute(`aria-busy`,`true`),n.status.textContent=``,n.image.hidden=!1,n.image.alt=i.alt||i.caption,n.image.src=i.src,this._applyTransform(),this._syncZoomButtons(),t.length>1){let e=t[(r+1)%t.length],n=t[(r-1+t.length)%t.length];if(!e||!n)throw Error(`<wui-lightbox> neighbour image missing.`);for(let t of[e,n])new Image().src=t.src}a&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:r}}))}_syncZoomButtons(){let e=this._view;e.zoomOut.disabled=this._zoom<=F4,e.zoomIn.disabled=this._zoom>=I4;let t=document.activeElement;(t===e.zoomOut||t===e.zoomIn)&&t instanceof HTMLButtonElement&&t.disabled&&e.close.focus()}_setZoom(e){this._ui&&(this._zoom=U4(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._view;return W4(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._view;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>F4)}_onKeyDown(e){let t=ea(e.key,$i(this));if(t===`ArrowLeft`||t===`ArrowRight`)e.preventDefault(),this.step(t===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+L4)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-L4)):e.key===`0`&&(e.preventDefault(),this._setZoom(F4))}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){let t=e.target;if(t instanceof Element&&t.closest(`.wui-lightbox-nav`))return;let n=this._view;if(n.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let e=[...this._pointers.values()],t=e[0],n=e[1];if(!t||!n)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._gesture={kind:`pinch`,distance:Math.hypot(t.x-n.x,t.y-n.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===n.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(t&&this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let e=[...this._pointers.values()],n=e[0],r=e[1];if(!n||!r)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._setZoom(t.zoom*Math.hypot(n.x-r.x,n.y-r.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>B4&&(t.moved=!0),this._zoom>F4&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._view.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved?this._zoom===F4&&this.step(G4(r,i)):e.timeStamp-n.startTime>V4||(n.onImage?e.timeStamp-this._lastTap<H4?(this._lastTap=-1/0,this._setZoom(this._zoom>F4?F4:R4)):this._lastTap=e.timeStamp:this.close())}}),ba(`wui-chat-part-image`,class extends ya{#e=null;#t=0;#n=null;renderPart(e,t,n){if(e.attachmentId===this.#e)return;this.#e=e.attachmentId;let r=this.ownerDocument??document,i=P(r,`figure`,`wui-chat-image`),a=P(r,`div`,`wui-chat-image-frame`);this.#n=a;let{width:o,height:s}=e;o!==null&&s!==null&&Number.isFinite(o)&&Number.isFinite(s)&&o>0&&s>0&&(a.style.aspectRatio=`${o} / ${s}`),i.append(a),this.replaceChildren(i),this.#r(e,n)}disposePart(){this.#t+=1,this.#e=null}#r(e,t){this.#t+=1;let n=this.#t,r=this.ownerDocument??document,i=this.#n;if(i===null)return;let a=P(r,`div`,`wui-chat-image-skeleton`);a.setAttribute(`aria-hidden`,`true`);let o=P(r,`span`,`visually-hidden`,t.labels.imageLoading);o.setAttribute(`role`,`status`),i.replaceChildren(a,o),typeof t.loadAttachmentUrl==`function`?t.loadAttachmentUrl(e.attachmentId).then(r=>{n===this.#t&&this.isConnected&&this.#i(r,e,t)},()=>{n===this.#t&&this.isConnected&&this.#a(e,t)}):this.#a(e,t)}#i(e,t,n){let r=this.#n;if(r===null)return;let i=this.ownerDocument??document,a=N2(t.alt),o=i.createElement(`wui-lightbox`);o.setAttribute(`label`,n.labels.imageViewer),o.setAttribute(`layout`,`single`);let s=P(i,`a`,`wui-lightbox-item`);s.setAttribute(`href`,e),s.dataset.caption=a,s.dataset.name=a;let c=i.createElement(`img`);c.src=e,c.alt=a,c.decoding=`async`,s.append(c),o.append(s),r.replaceChildren(o)}#a(e,t){let n=this.#n;if(n===null)return;let r=this.ownerDocument??document,i=P(r,`p`,`wui-chat-image-error`,t.labels.imageFailed);i.setAttribute(`role`,`status`);let a=P(r,`button`,`btn btn-soft-primary btn-sm`,t.labels.retry);a.type=`button`,a.addEventListener(`click`,()=>this.#r(e,t)),n.replaceChildren(i,a)}});var Y4={Email:{type:`email`,autocomplete:`email`},Phone:{type:`tel`,autocomplete:`tel`},Name:{type:`text`,autocomplete:`name`},Company:{type:`text`,autocomplete:`organization`},Text:{type:`text`,autocomplete:null},LongText:{type:`text`,autocomplete:null}},X4=[`Open`,`Answered`,`Skipped`,`Expired`],Z4=0;function Q4(e){return Z4+=1,`${e}-${Z4}`}function $4(e,t,n){let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.textContent=n),r}function e3(){let e=$4(`p`,`wui-chat-field-error`);return e.id=Q4(`wui-chat-field-error`),e.setAttribute(`role`,`alert`),e.hidden=!0,e}function t3(e,t){return e.required?[]:[$4(`span`,`wui-chat-field-hint`,t.inputOptional)]}function n3(e,t,n){let r=Q4(`wui-chat-field`),i=Y4[t],a=t===`LongText`&&!e.secret,o;if(a){let e=$4(`textarea`,`form-control wui-chat-input-control`);e.rows=3,o=e}else{let t=$4(`input`,`form-control wui-chat-input-control`);t.type=e.secret?`password`:i.type,e.secret?t.autocomplete=`off`:i.autocomplete&&(t.autocomplete=i.autocomplete),o=t}o.id=r,o.name=e.key,e.placeholder!=null&&(o.placeholder=e.placeholder),e.maxLength!=null&&(o.maxLength=e.maxLength),e.required&&o.setAttribute(`aria-required`,`true`);let s=$4(`label`,`form-label`,e.label);s.htmlFor=r;let c=e3();o.setAttribute(`aria-describedby`,c.id);let l=$4(`div`,`wui-chat-field`);return l.dataset.key=e.key,l.append(s,...t3(e,n),o,c),{field:e,element:l,controls:[o],focus:o,invalid:o,error:c,control:o,read:()=>e.secret?o.value:o.value.trim()}}function r3(e,t,n,r,i){let a=e.control,o=$4(`button`,`btn btn-soft-primary`,n.inputSendCode);o.type=`button`,o.dataset.wui=`AppButton`;let s=$4(`p`,`wui-chat-field-hint`);s.setAttribute(`aria-live`,`polite`);let c=Q4(`wui-chat-field`),l=$4(`label`,`form-label`,n.inputEnterCode);l.htmlFor=c,l.hidden=!0;let u=$4(`input`,`form-control wui-chat-input-control`);return u.type=`text`,u.id=c,u.inputMode=`numeric`,u.autocomplete=`one-time-code`,u.hidden=!0,o.addEventListener(`click`,async()=>{o.disabled=!0;try{await r.sendOtp(i,{fieldKey:t.key,value:a.value.trim()}),s.textContent=n.inputCodeSent,l.hidden=!1,u.hidden=!1}catch{s.textContent=n.inputCodeFailed}finally{o.disabled=!1}}),e.element.insertBefore(o,e.error),e.element.insertBefore(s,e.error),e.element.insertBefore(l,e.error),e.element.insertBefore(u,e.error),{...e,controls:[...e.controls,o,u],codeRead:()=>u.value.trim()}}function i3(e,t){let n=Q4(`wui-chat-field-label`),r=$4(`span`,`form-label`,e.label);r.id=n;let i=$4(`div`);i.setAttribute(`role`,`radiogroup`),i.setAttribute(`aria-labelledby`,n);let a=e3();i.setAttribute(`aria-describedby`,a.id);let o=[];for(let t of e.options??[]){let n=$4(`div`,`form-check`),r=$4(`input`,`form-check-input`);r.type=`radio`,r.name=e.key,r.value=t.id,r.id=Q4(`wui-chat-option`);let a=$4(`label`,`form-check-label`,t.label);a.htmlFor=r.id,n.append(r,a),i.append(n),o.push(r)}o.length===0&&(i.tabIndex=-1);let s=$4(`div`,`wui-chat-field`);return s.dataset.key=e.key,s.append(r,...t3(e,t),i,a),{field:e,element:s,controls:o,focus:o[0]??i,invalid:i,error:a,read:()=>o.find(e=>e.checked)?.value??``}}function a3(e,t){let n=Q4(`wui-chat-field-label`),r=$4(`span`,`form-label`,e.label);r.id=n;let i=$4(`div`,`wui-chat-input-choices`);i.setAttribute(`role`,`group`),i.setAttribute(`aria-labelledby`,n);let a=e3();i.setAttribute(`aria-describedby`,a.id);let o=[];for(let t of e.options??[]){let n=$4(`div`,`form-check`),r=$4(`input`,`form-check-input`);r.type=`checkbox`,r.name=e.key,r.value=t.id,r.id=Q4(`wui-chat-option`);let a=$4(`label`,`form-check-label`,t.label);a.htmlFor=r.id,n.append(r,a),i.append(n),o.push(r)}o.length===0&&(i.tabIndex=-1);let s=$4(`div`,`wui-chat-field`);return s.dataset.key=e.key,s.append(r,...t3(e,t),i,a),{field:e,element:s,controls:o,focus:o[0]??i,invalid:i,error:a,read:()=>JSON.stringify(o.filter(e=>e.checked).map(e=>e.value))}}function o3(e,t){let n=Q4(`wui-chat-field-label`),r=$4(`span`,`form-label`,e.label);r.id=n;let i=$4(`div`,`wui-chat-input-slots`);i.setAttribute(`role`,`radiogroup`),i.setAttribute(`aria-labelledby`,n);let a=e3();i.setAttribute(`aria-describedby`,a.id);let o=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`}),s=[];for(let t of e.slots??[]){let n=$4(`input`,`wui-chat-input-slot-radio`);n.type=`radio`,n.name=e.key,n.value=t.id,n.id=Q4(`wui-chat-slot`);let r=$4(`label`,`btn btn-soft-primary wui-chat-input-slot`,o.format(new Date(t.startDateTimeUtc)));r.htmlFor=n.id,i.append(n,r),s.push(n)}s.length===0&&(i.tabIndex=-1);let c=$4(`div`,`wui-chat-field`);return c.dataset.key=e.key,c.append(r,...t3(e,t),i,a),{field:e,element:c,controls:s,focus:s[0]??i,invalid:i,error:a,read:()=>s.find(e=>e.checked)?.value??``}}function s3(e,t,n){let r=Q4(`wui-chat-field-label`),i=$4(`span`,`form-label`,e.label);i.id=r;let a=e3(),o=$4(`input`);o.type=`file`,o.name=e.key,o.id=Q4(`wui-chat-field`),o.hidden=!0,e.accept?.length&&(o.accept=e.accept.join(`,`));let s=$4(`button`,`btn btn-soft-primary`,t.inputChooseFile);s.type=`button`,s.dataset.wui=`AppButton`,s.setAttribute(`aria-describedby`,a.id),s.addEventListener(`click`,()=>o.click());let c=$4(`span`,`wui-chat-input-file-status`);c.setAttribute(`aria-live`,`polite`);let l=$4(`button`,`btn btn-link-primary`);l.type=`button`,l.dataset.wui=`AppButton`,l.hidden=!0;let u=$4(`div`,`wui-chat-input-file`);u.setAttribute(`role`,`group`),u.setAttribute(`aria-labelledby`,r),u.append(s,c,l,o);let d=`empty`,f=``,p=``,m=0,h=()=>{c.textContent=d===`uploading`?`${t.attachmentUploading} ${f}`:f,l.hidden=f===``,l.textContent=f===``?``:t.inputRemoveFile(f);let e=d===`failed`;a.textContent=e?t.attachmentFailed:``,a.hidden=!e,e?u.setAttribute(`aria-invalid`,`true`):u.removeAttribute(`aria-invalid`)},g=async e=>{m+=1;let t=m;d=`uploading`,f=e.name,p=``,h();try{let r=await n.uploadInputFile(e);if(t!==m)return;p=r,d=`ready`}catch{if(t!==m)return;d=`failed`}h()};o.addEventListener(`change`,()=>{let e=o.files?.[0];e&&g(e)}),l.addEventListener(`click`,()=>{m+=1,d=`empty`,f=``,p=``,o.value=``,h()}),h();let _=$4(`div`,`wui-chat-field`);return _.dataset.key=e.key,_.append(i,...t3(e,t),u,a),{field:e,element:_,controls:[s,l,o],focus:s,invalid:u,error:a,read:()=>d===`ready`?p:``,uploadProblem:()=>d===`uploading`?t.attachmentUploading:d===`failed`?t.attachmentFailed:null}}function c3(e){let t=$4(`input`,`form-check-input`);t.type=`checkbox`,t.name=e.key,t.id=Q4(`wui-chat-field`);let n=$4(`label`,`form-check-label`,e.consentText||e.label);n.htmlFor=t.id;let r=e3();t.setAttribute(`aria-describedby`,r.id);let i=$4(`div`,`form-check`);i.append(t,n);let a=$4(`div`,`wui-chat-field`);return a.dataset.key=e.key,a.append(i,r),{field:e,element:a,controls:[t],focus:t,invalid:t,error:r,read:()=>t.checked?`true`:`false`}}function l3(e,t,n,r){if(e.type===`Choice`)return i3(e,t);if(e.type===`MultiChoice`)return a3(e,t);if(e.type===`TimeSlot`)return o3(e,t);if(e.type===`File`)return s3(e,t,n);if(e.type===`Consent`)return c3(e);let i=n3(e,e.type,t);return e.verify===`Otp`?r3(i,e,t,n,r):i}function u3(e,t,n){let r=e.uploadProblem?.();if(r)return r;let{field:i}=e;return i.required?i.type===`Consent`?t===`true`?null:n.inputConsentRequired:i.type===`MultiChoice`?t===`[]`?n.inputRequired:null:t===``?n.inputRequired:null:null}function d3(e,t){return e.state===`Answered`?$4(`p`,`wui-chat-input-summary`,e.answeredSummary||t.inputAnswered):$4(`p`,`wui-chat-input-summary`,e.state===`Skipped`?t.inputSkipped:t.inputExpired)}ba(`wui-chat-part-input-request`,class extends ya{_signature;_generation;constructor(){super(),this._signature=null,this._generation=0}renderPart(e,t,n){for(let t of X4)this.classList.toggle(`wui-chat-input-request--${t.toLowerCase()}`,e.state===t);let r=JSON.stringify([e.requestId,e.state,e.answeredSummary,e.fields]);r!==this._signature&&(this._signature=r,this._generation+=1,this.replaceChildren(this._content(e,n)))}_content(e,t){return e.state===`Open`?this._form(e,this._generation):d3(e,t.labels)}_form(e,t){let n=this.activeTurn,r=n.labels,i=n.features,a=$4(`form`,`wui-chat-input-form`);a.noValidate=!0,a.setAttribute(`aria-label`,e.title||e.submitLabel),e.title&&a.append($4(`h3`,`wui-chat-input-title`,e.title));let o=e.fields.map(t=>l3(t,r,n,e.requestId));for(let e of o)a.append(e.element);let s=$4(`p`,`wui-chat-input-error`);s.setAttribute(`role`,`status`),s.hidden=!0,a.append(s);let c=$4(`button`,`btn btn-primary`,e.submitLabel);c.type=`submit`,c.dataset.wui=`AppButton`;let l=$4(`div`,`d-flex flex-wrap gap-2`);l.append(c);let u=[c];if(i.LeadShortcuts&&e.fields.length===1&&!e.fields[0]?.required){let t=$4(`button`,`btn btn-soft-primary`,r.skip);t.type=`button`,t.dataset.wui=`AppButton`,t.addEventListener(`click`,()=>this.activeTurn.skipInput(e.requestId)),l.append(t),u.push(t)}if(i.LeadShortcuts&&e.cancellable){let e=$4(`button`,`btn btn-link-primary`,r.cancel);e.type=`button`,e.dataset.wui=`AppButton`,e.addEventListener(`click`,()=>this.activeTurn.cancelLead()),l.append(e),u.push(e)}a.append(l),e.allowTyped&&a.append($4(`p`,`wui-chat-input-typed`,r.typeAnswer));let d=!1,f=t=>{for(let e of o)for(let n of e.controls)n.disabled=t;for(let e of u)e.disabled=t;c.textContent=t?r.inputSubmitting:e.submitLabel},p=()=>{for(let e of o)e.error.hidden=!0,e.error.textContent=``,e.invalid.removeAttribute(`aria-invalid`);s.hidden=!0,s.textContent=``},m=(e,t)=>{e.error.textContent=t,e.error.hidden=!1,e.invalid.setAttribute(`aria-invalid`,`true`)};return a.addEventListener(`submit`,async n=>{if(n.preventDefault(),d)return;p();let i={},a={},l=[];for(let e of o){let t=e.read();i[e.field.key]=t,e.codeRead&&(a[e.field.key]=e.codeRead());let n=u3(e,t,r);n&&l.push([e,n])}let[u]=l;if(u){for(let[e,t]of l)m(e,t);u[0].focus.focus();return}d=!0,f(!0);let h;try{h=await this.activeTurn.answerInput(e.requestId,i,Object.keys(a).length>0?a:null)}catch{h={ok:!1,errors:{},message:r.errorGeneric}}if(t!==this._generation||h.ok)return;d=!1;let g=null;for(let e of o){let t=h.errors?.[e.field.key];t&&(m(e,t),g??=e)}h.message!=null&&(s.textContent=h.message,s.hidden=!1),f(!1),g?g.focus.focus():o[0]?o[0].focus.focus():c.focus()}),a}});var f3={ActionLimitReached:`warning`,ConversationTooLong:`warning`,AssistantUnavailable:`danger`},p3={info:`info`,warning:`alert-triangle`,danger:`alert-circle`};ba(`wui-chat-part-notice`,class extends ya{renderPart(e){let t=this.ownerDocument??document,n=f3[e.code]??`info`,r=P(t,`div`,`wui-chat-notice wui-chat-notice--${n}`);r.setAttribute(`role`,n===`danger`?`alert`:`status`);let i=P(t,`span`,`wui-chat-notice-icon`);i.setAttribute(`aria-hidden`,`true`);let a=xa(t,p3[n],16);a&&i.append(a);let o=P(t,`div`,`wui-chat-notice-body`);o.append(P(t,`span`,`wui-chat-notice-text`,e.text));let s=e.action;if(s){let e=P(t,`button`,`wui-chat-notice-action`,s.label);e.type=`button`,e.addEventListener(`click`,()=>s.run()),o.append(e)}r.append(i,o),this.replaceChildren(r)}});function m3(e){switch(e){case`Primary`:return`wui-chat-quick-reply--primary`;case`Cta`:return`wui-chat-quick-reply--cta`;case`Default`:case null:return``}}ba(`wui-chat-part-quick-replies`,class extends ya{#e=null;renderPart(e,t,n){let r=n.features.SuggestedReplies===!0&&n.isLast===!0&&n.busy===!1&&e.replies.length>0,i=typeof n.openTarget==`function`,a=typeof n.beginHandoff==`function`,o=n.handoffPause===!0,s=JSON.stringify([r,e.replies,e.placement,n.labels.quickReplies,n.labels.handoffMoment,i,a,o,n.handoffHosts??null,n.features.LinkHandoff===!0]);if(s===this.#e)return;this.#e=s;let c=this.querySelector(`:scope > .wui-chat-quick-replies:not(.wui-chat-quick-replies--leaving)`);if(!r&&c){this.#t(c);return}if(this.replaceChildren(),!r)return;let l=this.ownerDocument,u=e.placement===`Composer`,d=P(l,`div`,u?`wui-chat-quick-replies wui-chat-quick-replies--composer`:`wui-chat-quick-replies`);d.setAttribute(`role`,`group`),d.setAttribute(`aria-label`,n.labels.quickReplies);let f=u?null:e.replies.find(e=>e.id===`handoff.request`&&e.action===`Send`),p=0;f&&(d.classList.add(`wui-chat-quick-replies--offer`),d.append(this.#n(l,f,n)),p+=1);for(let t of e.replies){if(t===f||t.action===`Open`&&(!t.target||!i))continue;let e=null;if(t.action===`Navigate`){if(n.features.LinkHandoff!==!0)continue;if(vr(t.target,n.handoffHosts))e=t.target;else{let r=t.target===null?null:n.resolveLink?.(t.target);e=typeof r==`string`&&r!==``?r:null}if(e===null){d.append(P(l,`span`,null,t.label));continue}if(!a)continue}d.append(this.#r(l,t,p,n,f?`wui-chat-quick-reply--quiet`:``,e)),p+=1}if(o){let e=P(l,`span`,`visually-hidden`,n.labels.handoffMoment);e.setAttribute(`role`,`status`),d.append(e)}d.childElementCount>0&&this.append(d)}#t(e){e.classList.add(`wui-chat-quick-replies--leaving`);let t=this.ownerDocument.defaultView,n=Number.parseFloat(t?t.getComputedStyle(e).animationDuration:``)*1e3;t===null||!(n>0)?e.remove():t.setTimeout(()=>e.remove(),n)}#n(e,t,n){let r=P(e,`div`,`wui-chat-offer`);return r.style.setProperty(`--wui-chat-i`,`0`),r.append(P(e,`div`,`wui-chat-offer-title`,t.label)),r.append(this.#r(e,{...t,variant:`Primary`},0,n,`wui-chat-offer-action`)),r}#r(e,t,n,r,i=``,a=null){let o=e.createElement(`button`);o.type=`button`,o.className=[`wui-chat-quick-reply`,m3(t.variant),i].filter(Boolean).join(` `),o.style.setProperty(`--wui-chat-i`,String(n));let s=t.action===`Navigate`,c=s&&r.handoffPause===!0;if(o.disabled=c,t.icon){let n=xa(e,t.icon,16);if(n){let t=P(e,`span`,`wui-chat-quick-reply-icon`);t.setAttribute(`aria-hidden`,`true`),t.append(n),o.append(t)}}return o.append(P(e,`span`,`wui-chat-quick-reply-label`,c?r.labels.handoffMoment:t.label)),o.addEventListener(`click`,()=>{if(t.action===`Open`){let{openTarget:e}=this.activeTurn;if(t.target===null||e===void 0)throw Error(`${this.localName} drew an Open chip without a target or openTarget`);e.call(this.activeTurn,t.target)}else if(s){let{beginHandoff:e}=this.activeTurn;if(a===null||e===void 0)throw Error(`${this.localName} drew a Navigate chip without a destination or beginHandoff`);e.call(this.activeTurn,t,()=>this.#i(a))}else this.activeTurn.chooseQuickReply(t),this.closest(`.wui-chat`)?.querySelector(`.wui-chat-input`)?.focus()}),o}#i(e){typeof this.activeTurn.openTarget==`function`?this.activeTurn.openTarget(e):globalThis.location.assign(e)}});var h3=new Set([`Integer`,`Decimal`,`MoneyMinor`,`Percent`]);function g3(e){return h3.has(e)}function _3(e,t,n,r=!0){let i=e=>r?un(e):[{kind:`text`,text:e}];if(t==null||t===``)return[{kind:`text`,text:Mi()}];if(e===`Date`||e===`DateTimeUtc`)return[{kind:`text`,text:gr(t,e,n)}];if(g3(e)){let r=Number(t);return i(Number.isFinite(r)?gr(r,e,n):String(t))}return i(String(t))}var v3=0;function y3(e){return v3+=1,`${e}-${v3}`}ba(`wui-chat-part-record-card`,class extends ya{#e=null;renderPart(e,t,n){let r=!!e.target&&typeof n.openRecord==`function`,i=n.features?.FigureText===!0,a=JSON.stringify([e,r,i]);if(a===this.#e)return;this.#e=a;let o=this.ownerDocument,s=P(o,`article`,`wui-chat-record`),c=y3(`wui-chat-record-title`);s.setAttribute(`aria-labelledby`,c);let l=P(o,`div`,`wui-chat-record-head`),u=P(o,`strong`,`wui-chat-record-title`);if(u.id=c,u.setAttribute(`role`,`heading`),u.setAttribute(`aria-level`,`3`),i?M2(u,e.title):u.textContent=String(e.title??``),l.append(u),e.subtitle){let t=P(o,`span`,`wui-chat-record-subtitle`);i?M2(t,e.subtitle):t.textContent=String(e.subtitle??``),l.append(t)}if(s.append(l),e.fields?.length>0){let t=P(o,`dl`,`wui-chat-record-fields`);for(let n of e.fields){let e=P(o,`div`),r=P(o,`dt`);i?M2(r,n.label):r.textContent=String(n.label??``);let a=P(o,`dd`);g3(n.type)&&(a.className=`wui-chat-num`),j2(a,_3(n.type,n.value,null,i)),e.append(r,a),t.append(e)}s.append(t)}if(r){let t=P(o,`button`,`btn btn-soft-primary btn-sm wui-chat-record-open`,n.labels.recordOpen);t.type=`button`,t.setAttribute(`aria-label`,n.labels.recordOpenFor(N2(e.title))),t.addEventListener(`click`,()=>{let{openRecord:t}=this.activeTurn;if(t===void 0)throw Error(`${this.localName} lost openRecord after it drew the button`);t.call(this.activeTurn,e)}),s.append(t)}this.replaceChildren(s)}});var b3=/^https?:\/\//i;ba(`wui-chat-part-sources`,class extends ya{renderPart(e,t,n){if(this.replaceChildren(),!n.features.Sources||e.sources.length===0)return;let r=this.ownerDocument,i=P(r,`div`,`wui-chat-sources`);i.append(P(r,`p`,`wui-chat-sources-label`,n.labels.sources));let a=P(r,`ul`,`wui-chat-sources-list`);a.setAttribute(`aria-label`,n.labels.sources);for(let t of e.sources){let e=r.createElement(`li`);e.append(this.#e(r,t,n)),a.append(e)}i.append(a),this.append(i)}#e(e,t,n){let r;if(typeof t.url==`string`&&b3.test(t.url)){let i=P(e,`a`,`wui-chat-source`);i.setAttribute(`href`,t.url),i.setAttribute(`target`,`_blank`),i.setAttribute(`rel`,`noopener noreferrer`),i.setAttribute(`aria-label`,n.labels.openSource(t.title)),r=i}else r=P(e,`span`,`wui-chat-source`),r.tabIndex=-1;return r.dataset.marker=String(t.marker),r.append(P(e,`span`,`wui-chat-source-marker`,String(t.marker)),P(e,`span`,`wui-chat-source-title`,t.title)),r}});var x3=25,S3=0;function C3(e,t,n){let r=e.createElement(`tr`);for(let i of t.columns){let t=e.createElement(`th`);t.setAttribute(`scope`,`col`),g3(i.type)&&(t.className=`wui-chat-num`),n?M2(t,i.label):t.textContent=String(i.label??``),r.append(t)}return r}function w3(e,t,n,r){let i=e.createElement(`tr`);return t.columns.forEach((a,o)=>{let s=o===0&&a.type===`Text`,c=e.createElement(s?`th`:`td`);s&&c.setAttribute(`scope`,`row`),g3(a.type)&&(c.className=`wui-chat-num`);let l=n[o];l==null||l===``?c.append(P(c.ownerDocument,`span`,`wui-chat-null`,Mi())):j2(c,_3(a.type,l,t.currency,r)),i.append(c)}),i}function T3(e,t){let n=()=>{let n=t.scrollWidth-t.clientWidth;e.dataset.scroll=n<=1?`none`:t.scrollLeft>=n-1?`end`:t.scrollLeft>0?`middle`:`start`};t.addEventListener(`scroll`,n,{passive:!0}),typeof ResizeObserver<`u`&&new ResizeObserver(n).observe(t),n()}function E3(e,t,n,r,i){let a=e.ownerDocument;for(let o of t.rows.slice(n,r))e.append(w3(a,t,o,i))}ba(`wui-chat-part-table`,class extends ya{#e=null;renderPart(e,t,n){let r=n.features?.FigureText===!0,i=JSON.stringify([e,r]);if(i===this.#e)return;if(this.#e=i,!e.columns||e.columns.length===0){this.replaceChildren();return}let a=this.ownerDocument,o=P(a,`figure`,`wui-chat-table`),s=null;if(e.title){S3+=1,s=`wui-chat-table-${S3}`;let t=P(a,`figcaption`,`wui-chat-table-title`);t.id=s,r?M2(t,e.title):t.textContent=String(e.title??``),o.append(t)}let c=P(a,`div`,`table-wrap wui-chat-table-wrap`);c.tabIndex=0,c.setAttribute(`role`,`region`),s?c.setAttribute(`aria-labelledby`,s):c.setAttribute(`aria-label`,n.labels.table);let l=P(a,`table`,`table table-sm wui-chat-table-grid`),u=a.createElement(`thead`);u.append(C3(a,e,r));let d=a.createElement(`tbody`);E3(d,e,0,Math.min(e.rows.length,x3),r),l.append(u,d),c.append(l);let f=P(a,`div`,`wui-chat-table-frame`),p=P(a,`span`,`wui-chat-table-cue`);if(p.setAttribute(`aria-hidden`,`true`),f.append(c,p),o.append(f),T3(f,c),e.rows.length>x3){let t=P(a,`button`,`btn btn-soft-primary btn-sm wui-chat-table-more`,n.labels.tableShowAll(e.rows.length));t.type=`button`,t.addEventListener(`click`,()=>{E3(d,e,x3,e.rows.length,r),t.remove()}),o.append(t)}this.replaceChildren(o)}});var D3=/\[([^[\]\n]+)\](?!\()/g,O3=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),k3=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,A3=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,j3=new RegExp(D3.source,`y`),M3=e=>/[\p{L}\p{N}]/u.test(e);function N3(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function P3(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),o=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),s=n===`_`&&M3(e.charAt(i+n.length));if(a&&!o&&!s&&!N3(e,i))return i}return-1}function F3(e,t){let n=t?.isCitation,r=[],i=``,a=()=>{i&&=(r.push({type:`text`,text:i}),``)},o=0;for(;o<e.length;){let s=e.charAt(o),c=e.charAt(o+1);if(s===`\\`&&O3.has(c)){i+=c,o+=2;continue}if(s==="`"){let t=e.indexOf("`",o+1);if(t>o+1){a(),r.push({type:`code`,text:e.slice(o+1,t)}),o=t+1;continue}}let l=s+c;if(l===`**`||l===`__`||l===`~~`){let n=P3(e,o+2,l);if(n!==-1&&!(l===`__`&&M3(e.charAt(o-1)))){a();let i=F3(e.slice(o+2,n),t);l===`~~`?r.push({type:`strike`,children:i}):r.push({type:`strong`,children:i}),o=n+2;continue}i+=l,o+=2}else{if(s===`*`||s===`_`){let n=P3(e,o+1,s);if(n!==-1&&!(s===`_`&&M3(e.charAt(o-1)))){a(),r.push({type:`em`,children:F3(e.slice(o+1,n),t)}),o=n+1;continue}}if(s===`[`){k3.lastIndex=o;let t=k3.exec(e);if(t){let e=t[1],n=t[2];if(e===void 0||n===void 0)throw Error(`The link pattern always captures its label and href`);a(),r.push({type:`link`,href:n,children:F3(e)}),o+=t[0].length;continue}if(n){j3.lastIndex=o;let t=j3.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The citation pattern always captures its inner text`);if(n(e)){a(),r.push({type:`citation`,text:e}),o+=t[0].length;continue}}}}if(s===`!`){A3.lastIndex=o;let t=A3.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The image pattern always captures its alt text`);a(),r.push({type:`image`,children:F3(e)}),o+=t[0].length;continue}}i+=s,o+=1}}return a(),r.map((e,t)=>({...e,key:t}))}var I3=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,L3=/^https?:/i,R3=/^(mailto|tel):/i,z3=/^(?:\/(?![/\\])|#|\?|\.{1,2}\/)/,B3=/^https:\/\/[^/?#@\\\s]+$/i,V3=/^[a-z][a-z0-9+.-]*:/i;function H3(e){if(typeof e!=`string`)return null;let t=e.endsWith(`/`)?e.slice(0,-1):e;return B3.test(t)?t:null}function U3(e,t,n,r,i){if(n&&(t===`page`||I3.test(e))){let t=n(e);if(t!=null)return{kind:`app`,target:t}}if(t===`app`)return null;let a=i==null?null:H3(i),o=a===null?e:W3(e,a);return o===null?null:z3.test(o)?{kind:`page`,href:o}:t===`page`&&!(L3.test(o)&&r&&K3(o,r))?null:L3.test(o)?{kind:r&&K3(o,r)?`page`:`web`,href:o}:R3.test(o)?{kind:`contact`,href:o}:null}function W3(e,t){if(V3.test(e))return e;if(e.startsWith(`//`))return`https:${e}`;if(e===``)return null;let n=e.indexOf(`#`),r=n<0?``:e.slice(n),i=n<0?e:e.slice(0,n),a=i.indexOf(`?`),o=a<0?i:i.slice(0,a),s=a<0?``:i.slice(a);return o===``?`${t}${s}${r}`:`${t}${G3(o.startsWith(`/`)?o:`/${o}`)}${s}${r}`}function G3(e){let t=e.split(`/`),n=[];return t.forEach((e,r)=>{let i=r===t.length-1;e===`.`?i&&n.push(``):e===`..`?(n.length>1&&n.pop(),i&&n.push(``)):n.push(e)}),n.join(`/`)}function K3(e,t){if(e.slice(0,t.length).toLowerCase()!==t.toLowerCase())return!1;let n=e[t.length];return n===void 0||n===`/`||n===`?`||n===`#`}function q3(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var J3=/^\s*```/,Y3=/^\s*```\s*(\S*)/,X3=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,Z3=/^\s*([-*_])(\s*\1){2,}\s*$/,Q3=/^(\s*)[-*+]\s+(.*)$/,$3=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,e6=/^\s*>\s?(.*)$/,t6=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,n6=[1,2,3,4,5,6],r6=e=>e.includes(`|`);function i6(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function a6(e,t){let n=e[t];if(n===void 0)throw Error(`startsTable was called past the last source line`);let r=e[t+1];return r!==void 0&&r6(n)&&r.includes(`|`)&&t6.test(r)}function o6(e,t){let n=e[t];if(n===void 0)throw Error(`startsBlock was called past the last source line`);return J3.test(n)||e6.test(n)||Q3.test(n)||$3.test(n)||X3.test(n)||Z3.test(n)||a6(e,t)}function s6(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function c6(e){let t=$3.exec(e);if(t){let e=t[1],n=t[2],r=t[3];if(e===void 0||n===void 0||r===void 0)throw Error(`The ordered list pattern always captures its indent, number and text`);return{text:r,depth:s6(e),ordered:!0,number:Number(n)}}let n=Q3.exec(e);if(n){let e=n[1],t=n[2];if(e===void 0||t===void 0)throw Error(`The bullet list pattern always captures its indent and text`);return{text:t,depth:s6(e),ordered:!1,number:0}}return null}function l6(e){let t=(e??``).replace(/\r\n?/g,`
42
42
  `).split(`
43
43
  `),n=[],r=0;for(;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()){r+=1;continue}if(J3.test(e)){let i=Y3.exec(e)?.[1]||null,a=[];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(J3.test(e))break;a.push(e),r+=1}r+=1,n.push({type:`code`,text:a.join(`
44
- `),language:i});continue}if(a6(t,r)){let i=i6(e),a=[];for(r+=2;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||!r6(e))break;a.push(i6(e)),r+=1}n.push({type:`table`,header:i,rows:a});continue}if(Z3.test(e)){n.push({type:`rule`}),r+=1;continue}let i=X3.exec(e);if(i){let e=i[1],t=i[2];if(e===void 0||t===void 0)throw Error(`The heading pattern always captures its hashes and text`);let a=n6[e.length-1];if(a===void 0)throw Error(`The heading pattern always captures one to six hashes`);n.push({type:`heading`,level:a,text:t}),r+=1;continue}if(e6.test(e)){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);let i=e6.exec(n);if(!i)break;let a=i[1];if(a===void 0)throw Error(`The quote pattern always captures its text`);e.push(a),r+=1}n.push({type:`quote`,lines:e});continue}let a=c6(e);if(a){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);if(!n.trim())break;let i=c6(n);if(i){if(i.depth===0&&i.ordered!==a.ordered)break;e.push(i)}else if(o6(t,r))break;else{let t=e[e.length-1];if(t===void 0)throw Error(`A list continuation line follows a list with no item`);t.text+=` ${n.trim()}`}r+=1}n.push({type:`list`,ordered:a.ordered,start:a.ordered?a.number:1,items:e});continue}let o=[e];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||o6(t,r))break;o.push(e),r+=1}n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var u6=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`],d6=[`razor`,`cshtml`],f6=[`app`,`web`,`page`],p6=e=>e!==void 0&&f6.includes(e);function m6(e,t,n,r,i=null){let a=h6(n,r).map((e,n)=>{let r=t[n],i=r?.sig===e.sig?r.nodes:null;return{sig:e.sig,nodes:i??e.build()}}),o=new Set(a.flatMap(e=>e.nodes));for(let e of t)for(let t of e.nodes)o.has(t)||t.parentNode?.removeChild(t);let s=i;for(let t of a.flatMap(e=>e.nodes))(t.parentNode!==e||t.previousSibling!==s)&&e.insertBefore(t,s?s.nextSibling:e.firstChild),s=t;return a}function h6(e,t){let n={links:p6(t.links)?t.links:`web`,headings:t.headings===`text`?`text`:`outline`,resolveLink:t.resolveLink,isCitation:t.isCitation,figureText:typeof t.figureText==`function`?t.figureText:void 0,base:typeof t.base==`string`?t.base:void 0},r=t.resolverGeneration??0;return l6(e).map(e=>({sig:`${JSON.stringify(e)}|${n.links}|${n.headings}|${n.base??``}|${r}`,build:()=>_6(n,e)}))}var g6=class extends M4{_drawn;_blocks;_observer;_connected;_resolveLink;_isCitation;_resolverGeneration;_figureText;static get observedAttributes(){return[`links`,`headings`,`base`]}constructor(){super(),this._drawn=[],this._blocks=[],this._observer=null,this._connected=!1,this._resolveLink=void 0,this._isCitation=void 0,this._resolverGeneration=0,this._figureText=void 0}connectedCallback(){this._connected=!0,this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._drawn.some(t=>t.contains(e.target)))&&this._render()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._connected=!1,this._observer?.disconnect(),this._observer=null}get resolveLink(){return this._resolveLink}set resolveLink(e){this._resolveLink=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get base(){return this.getAttribute(`base`)??void 0}set base(e){e==null?this.removeAttribute(`base`):this.setAttribute(`base`,String(e))}get isCitation(){return this._isCitation}set isCitation(e){this._isCitation=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get figureText(){return this._figureText}set figureText(e){this._figureText=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}attributeChangedCallback(e,t,n){t!==n&&this._connected&&this._render()}_source(){return Array.from(this.children).find(e=>e instanceof HTMLPreElement&&e.classList.contains(`wui-markdown-source`))}_render(){let e=this._source();e&&(this._blocks=m6(this,this._blocks,e.textContent??``,{links:this.getAttribute(`links`)??void 0,headings:this.getAttribute(`headings`)??void 0,base:this.getAttribute(`base`)??void 0,resolveLink:this._resolveLink,isCitation:this._isCitation,figureText:this._figureText,resolverGeneration:this._resolverGeneration},e),this._drawn=this._blocks.flatMap(e=>e.nodes),e.hidden=!0,this._observer?.takeRecords())}};function _6(e,t){switch(t.type){case`paragraph`:return[ki(`p`,null,...v6(e,t.lines))];case`heading`:return[y6(e,t)];case`list`:return b6(e,t.items);case`table`:return[S6(e,t)];case`code`:return[w6(t)];case`quote`:return[ki(`blockquote`,null,...v6(e,t.lines))];case`rule`:return[ki(`hr`)];default:return[]}}function v6(e,t){let n=[];return t.forEach((t,r)=>{r>0&&n.push(ki(`br`)),n.push(...T6(e,t))}),n}function y6(e,t){let n=T6(e,t.text);return e.headings===`text`?ki(`p`,{class:`fw-semibold`},...n):ki(`h2`,null,...n)}function b6(e,t){let n=[];for(let r=0;r<t.length;){let i=x6(e,t,r);n.push(i.list),r=i.next}return n}function x6(e,t,n){let r=t[n];if(!r)throw Error(`List run starts past its items.`);let{depth:i,ordered:a,number:o}=r,s=ki(a?`ol`:`ul`,a&&o!==1?{start:o}:null),c=null,l=n,u=t[l];for(;u&&u.depth>=i;){if(u.depth===i)c=ki(`li`,null,...T6(e,u.text)),s.append(c),l+=1;else{let n=x6(e,t,l);if(!c)throw Error(`Nested list has no item before it.`);c.append(n.list),l=n.next}u=t[l]}return{list:s,next:l}}function S6(e,t){let n=t.header.map(t=>ki(`th`,{scope:`col`},...T6(e,t))),r=t.rows.map(n=>ki(`tr`,null,...t.header.map((t,r)=>ki(`td`,null,...T6(e,n[r]??``)))));return ki(`div`,{class:`table-responsive`},ki(`table`,{class:`table`},ki(`thead`,null,ki(`tr`,null,...n)),ki(`tbody`,null,...r)))}function C6(e){return e===null?`text`:d6.includes(e.toLowerCase())?`razor`:u6.includes(e)?e:`text`}function w6(e){let t=ki(`pre`,{class:`wui-code-source`},ki(`code`,null,e.text));return ki(`wui-code-block`,{class:`wui-code-block`,language:C6(e.language)},t)}function T6(e,t){return E6(e,F3(t,{isCitation:e.isCitation}))}function E6(e,t){return t.flatMap(t=>D6(e,t))}function D6(e,t){switch(t.type){case`code`:return[ki(`code`,null,t.text)];case`strong`:return[ki(`strong`,null,...E6(e,t.children))];case`em`:return[ki(`em`,null,...E6(e,t.children))];case`strike`:return[ki(`del`,null,...E6(e,t.children))];case`image`:return[document.createTextNode(`[`),...E6(e,t.children),document.createTextNode(`]`)];case`link`:return O6(e,t);case`citation`:return[A6(t.text)];case`text`:return e.figureText?k6(e.figureText,t.text):[document.createTextNode(t.text)];default:throw Error(`wui-markdown: unknown inline token ${JSON.stringify(t)}`)}}function O6(e,t){let n=E6(e,t.children),r=U3(t.href,e.links,e.resolveLink,globalThis.location?.origin,e.base);if(!r)return n;if(r.kind===`app`){let e=q3(r.target);return e?[j6(e,n,!1)]:n}return[j6(r.href,n,r.kind===`web`)]}function k6(e,t){return e(t).map(e=>e.kind===`sub`||e.kind===`sup`?ki(e.kind,null,e.text):document.createTextNode(e.text))}function A6(e){let t=ki(`span`,{class:`chip-label`},e),n=ki(`button`,{type:`button`,class:`chip-body`,"aria-label":e},t);return n.addEventListener(`click`,()=>{n.dispatchEvent(new CustomEvent(`wui-markdown-citation`,{bubbles:!0,detail:{citation:e}}))}),ki(`span`,{class:`chip primary chip-outline chip-sm chip-clickable wui-markdown-citation`,"data-wui":`AppChip`},n)}function j6(e,t,n){let r=ki(`span`,{class:`wui-link__label`},...t);return ki(`a`,{class:`wui-link wui-link--static`,"data-wui":`AppLink`,href:e,target:n?`_blank`:void 0,rel:n?`noopener noreferrer`:void 0},r)}A4(`wui-markdown`,g6);var M6=`AppButton`,N6=new Set([`primary`,`success`,`warning`,`danger`,`info`,`neutral`]),P6={solid:e=>`btn-${e}`,soft:e=>`btn-soft-${e}`,outline:e=>`btn-outline-${e}`,ghost:e=>`btn-ghost-${e}`,link:e=>`btn-link-${e}`,glass:()=>`btn-glass`};function F6(e){return Bi(P6,e)}function I6(e=`primary`,t=`solid`,n=`md`){if(!N6.has(e))throw RangeError(`buttonClass: unknown tone "${e}"`);if(!F6(t))throw RangeError(`buttonClass: unknown variant "${t}"`);let r=P6[t](e);return n===`md`?`btn ${r}`:`btn ${r} btn-${n}`}var L6={copiedLabel:`Copied`,copyLabel:`Copy`,label:`Code`};Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`]);var R6=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,razor:`Razor`,css:`CSS`}),z6=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),B6=`(?![\\s\\S])`,V6=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${B6})`).source,H6=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,z6([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],U6=[[`comment`,RegExp(`//[^\\n]*|${V6}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,z6(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,z6([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],W6=[[`comment`,RegExp(`//[^\\n]*|${V6}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,z6(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,z6([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],G6=[[`comment`,RegExp(`--[^\\n]*|${V6}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,z6(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,z6([`true`,`false`])],[`type`,z6([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],K6=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,z6([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,z6(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],q6=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],J6=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${B6})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],Y6={json:H6,js:U6,cs:W6,sql:G6,bash:K6,http:q6,css:[[`comment`,new RegExp(V6)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:J6,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},X6=e=>Bi(Y6,e),Z6=new Map;function Q6(e){let t=Z6.get(e);if(!t){let n=Y6[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},Z6.set(e,t)}return t}function $6(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function e8(e,t,n=[]){let{re:r,types:i}=Q6(e),a=0;for(let o of t.matchAll(r)){let r=o[0];if(!r)continue;$6(n,`plain`,t.slice(a,o.index));let s=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[s]===`tag`?e8(`htmlTag`,r,n):$6(n,i[s]??`plain`,r),a=o.index+r.length}return $6(n,`plain`,t.slice(a)),n}function t8(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return e8(`http`,e);let n=t[0]??``,r=e8(`http`,e.slice(0,t.index+n.length)),i=e.slice(t.index+n.length),a=i.trimStart()[0];return a===`{`||a===`[`?e8(`json`,i,r):a===`<`?e8(`html`,i,r):($6(r,`plain`,i),r)}function n8(e,t){let n=String(e??``);if(!n||n.length>1e5)return n?[[`plain`,n]]:[];if(t===`http`)return t8(n);let r=t===`razor`?`html`:t;return!X6(r)||r===`htmlTag`?[[`plain`,n]]:e8(r,n)}function r8(e,t){let n=[],r=[n];for(let[i,a]of n8(e,t))a.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&(n=[],r.push(n)),e&&n.push([i,e])});return r.length>1&&n.length===0&&r.pop(),r}var i8=()=>Ti(`codeBlock`,L6);function a8(e){return Bi(R6,e)}var o8=class extends M4{_title;_view;_codeEl;_copyIcon;_copyText;_chrome=null;_copied=!1;_observer=null;_timer=0;_cancelFrame=null;constructor(){super();let e=this.ownerDocument;this._title=e.createElement(`span`),this._title.className=`wui-code-title`,this._view=e.createElement(`div`),this._codeEl=e.createElement(`code`),this._copyIcon=e.createElement(`span`),this._copyIcon.className=`wui-code-copy-icon`,this._copyText=e.createElement(`span`)}static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}connectedCallback(){this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._schedule()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._cancelPending()}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_code(){return(this._source()?.textContent??``).replace(/\r?\n$/,``)}_schedule(){if(this._cancelFrame)return;let e=()=>{this._cancelFrame=null,this._render()};if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(e);this._cancelFrame=()=>cancelAnimationFrame(t)}else{let t=!0;queueMicrotask(()=>{t&&e()}),this._cancelFrame=()=>{t=!1}}}_cancelPending(){this._cancelFrame?.(),this._cancelFrame=null}_render(){if(!this._source())return;this._cancelPending();let e=this.ownerDocument;this._chrome||this._build(e);let t=this.getAttribute(`language`),n=t!==null&&a8(t)?t:`text`,r=this.getAttribute(`label`)||``,i=r8(this._code(),n);this._title.textContent=r||R6[n],this._view.setAttribute(`aria-label`,r||i8().label),this._view.style.setProperty(`--wui-code-digits`,String(String(i.length).length)),this._codeEl.replaceChildren(...i.map(t=>s8(e,t))),this._copied||(this._copyText.textContent=this._copyLabel()),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_build(e){let t=e.createElement(`div`);t.className=`wui-code-chrome`,t.append(this._bar(e));let n=this._view;n.className=`wui-code-view`,n.setAttribute(`role`,`region`),n.tabIndex=0;let r=e.createElement(`pre`);r.className=`wui-code-pre`,r.append(this._codeEl),n.append(r),t.append(n),this._chrome=t,this.append(t)}_bar(e){let t=e.createElement(`div`);t.className=`wui-code-bar`;let n=e.createElement(`button`);return n.type=`button`,n.className=`${I6(`primary`,`ghost`,`sm`)} wui-code-copy`,n.dataset.wui=M6,n.setAttribute(`aria-live`,`polite`),this._setCopied(!1),n.append(this._copyIcon,this._copyText),n.addEventListener(`click`,async()=>{await Oi(this._code())&&(this._setCopied(!0),clearTimeout(this._timer),this._timer=window.setTimeout(()=>this._setCopied(!1),2e3))}),t.append(this._title,n),t}_setCopied(e){this._copied=e;let t=Xi(e?`check`:`files`,{size:14});this._copyIcon.replaceChildren(...t?[t]:[]),this._copyText.textContent=this._copyLabel()}_copyLabel(){return this._copied?this.getAttribute(`copied-label`)||i8().copiedLabel:this.getAttribute(`copy-label`)||i8().copyLabel}};function s8(e,t){let n=e.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of t){if(r===`plain`){n.append(i);continue}let t=e.createElement(`span`);t.className=`wui-code-t-${r}`,t.textContent=i,n.append(t)}return n}A4(`wui-code-block`,o8);var c8=new Set([`Visitor`,`Customer`]),l8=/^\d+$/;function u8(e,t){return e?.features?.Sources===!0?typeof e?.isCitation==`function`?e.isCitation(t):l8.test(t):!1}function d8(e,t){if(vr(e,t?.handoffHosts))return e;let n=t?.resolveLink?.(e);return typeof n==`string`&&n!==``?n:null}function f8(e,t){let n=globalThis.location?.origin;for(let r of e.querySelectorAll(`a[href]`)){let e=r.dataset.linkSource??r.getAttribute(`href`)??``;r.dataset.linkSource=e;let i=d8(e,t);i===null?r.replaceWith(r.ownerDocument.createTextNode(r.textContent??``)):(i!==r.getAttribute(`href`)&&r.setAttribute(`href`,i),kn(i,`web`,void 0,n)?.kind===`web`?(r.setAttribute(`target`,`_blank`),r.setAttribute(`rel`,`noopener noreferrer`)):(r.removeAttribute(`target`),r.removeAttribute(`rel`)))}}function p8(e,t){f8(e,t)}ba(`wui-chat-part-text`,class extends ya{#e=null;#t=null;#n=!1;#r=null;constructor(){super(),this.addEventListener(`wui-markdown-citation`,e=>{let t=this.turn;typeof t?.openCitation==`function`&&t.openCitation(Number(e.detail.citation))}),this.addEventListener(`click`,e=>this.#a(e))}renderPart(e,t,n){let r=c8.has(t.author.kind)?`plain`:`markdown`,i=this.#e;if((i===null||i.mode!==r)&&(i=r===`plain`?{mode:r,node:this.#s()}:this.#c(e.text),this.#e=i,this.#t=null,this.replaceChildren(i.node)),i.mode===`plain`){let t=this.turn?.features?.FigureText===!0,n=JSON.stringify([e.text,t]);n!==this.#t&&(this.#t=n,i.node.replaceChildren(),t?j2(i.node,un(e.text)):i.node.append(this.ownerDocument.createTextNode(e.text)))}else this.#o(i.node),i.source.textContent!==e.text&&(i.source.textContent=e.text);this.toggleAttribute(`data-streaming`,t.streaming===!0),this.#n||(this.#n=!0,this.closest(`[data-restored]`)||this.classList.add(`wui-chat-part-enter`)),this.#i()}disposePart(){this.#r?.disconnect(),this.#r=null}#i(){this.#r||(this.#r=new MutationObserver(()=>p8(this,this.turn)),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}),p8(this,this.turn))}#a(e){let t=e.target instanceof Element?e.target.closest(`a[href]`):null,n=this.turn;if(!t||!this.contains(t))return;let r=t.getAttribute(`href`)??``;r.startsWith(`#`)||(r.startsWith(`/`)&&typeof n?.onNavigate==`function`?(e.preventDefault(),n.onNavigate(r)):typeof n?.openTarget==`function`&&(e.preventDefault(),n.openTarget(r)))}#o(e){let t=this.turn?.features?.FigureText===!0?un:void 0;e.figureText!==t&&(e.figureText=t)}#s(){return P(this.ownerDocument,`div`,`wui-chat-bubble`)}#c(e){let t=this.ownerDocument,n=P(t,`wui-markdown`,`wui-markdown wui-chat-text`);n.setAttribute(`links`,`web`),n.setAttribute(`headings`,`text`),n.isCitation=e=>u8(this.turn,e);let r=P(t,`pre`,`wui-markdown-source`,e);return n.append(r),{mode:`markdown`,node:n,source:r}}}),ba(`wui-chat-part-ticket`,class extends ya{renderPart(e,t,n){let{labels:r}=n,i=$(`article`,`wui-chat-ticket`,{"aria-label":r.ticketAria(e.number)}),a=$(`div`,`wui-chat-ticket-head`),o=$(`span`,`wui-chat-ticket-number`);o.textContent=r.ticketAria(e.number),a.append(o);let s=v4(e.status);if(s!==null){let t=$(`span`,`wui-chat-ticket-badge wui-chat-ticket-badge--${s}`);t.textContent=y4(e.status,r),a.append(t)}let c=$(`strong`,`wui-chat-ticket-title`);if(c.textContent=e.subject,i.append(a,c),typeof n.openTicket==`function`){let t=$(`div`,`wui-chat-ticket-foot`),a=$(`button`,`wui-chat-ticket-link`,{type:`button`});a.textContent=r.ticketView,a.addEventListener(`click`,()=>{let{openTicket:t}=n;if(t===void 0)throw Error(`${this.localName} lost openTicket after it drew the link`);t.call(n,{ticketId:e.ticketId,number:e.number})}),t.append(a),i.append(t)}this.replaceChildren(i)}});var m8=`http://www.w3.org/2000/svg`,h8={mic:`M12 15a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-2.08A7 7 0 0 0 19 12z`,stop:`M6 6h12v12H6z`,play:`M8 5v14l11-7z`,pause:`M6 5h4v14H6zm8 0h4v14h-4z`,speaker:`M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z`};function g8(e,t=18){if(!Y2(h8,e))throw Error(`Unknown voice icon "${e}".`);let n=document.createElementNS(m8,`svg`);n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`),n.setAttribute(`fill`,`currentColor`);let r=document.createElementNS(m8,`path`);return r.setAttribute(`d`,h8[e]),n.append(r),n}var _8=40,v8=null;function y8(e){let t=P(document,`span`,`wui-chat-clip-bar`);return t.style.setProperty(`--wui-chat-bar-height`,`${Math.round(e*100)}%`),t}function b8(e,t){e.replaceChildren(..._i(t,_8).map(y8))}ba(`wui-chat-part-voice-clip`,class extends ya{#e=null;#t=!1;#n=0;#r=0;#i=!1;#a=null;#o=null;#s=null;#c=0;#l=!1;renderPart(e,t,n){if(!n.features.VoiceClips){this.#u(e.transcript);return}let r=this.#e??this.#d(e.attachmentId);e.attachmentId!==r.attachmentId&&(this.disposePart(),r.attachmentId=e.attachmentId,this.#r=0,b8(r.wave,e.attachmentId)),this.#n=e.durationMs,this.#f(r,e)}disposePart(){this.#c+=1,this.#a?.pause(),this.#s!==null&&URL.revokeObjectURL(this.#s),v8===this&&(v8=null),this.#a=null,this.#o=null,this.#s=null,this.#i=!1}#u(e){if(this.disposePart(),this.#e=null,typeof e==`string`&&e!==``){let t=P(document,`p`,`wui-chat-clip-transcript`);t.textContent=e,this.replaceChildren(t)}else this.replaceChildren()}#d(e){let t=P(document,`div`,`wui-chat-clip`);t.setAttribute(`role`,`group`);let n=P(document,`div`,`wui-chat-clip-row`),r=P(document,`button`,`wui-chat-clip-play`);r.type=`button`;let i=P(document,`div`,`wui-chat-clip-wave`);i.setAttribute(`aria-hidden`,`true`);let a=P(document,`span`,`wui-chat-clip-time`);n.append(r,i,a);let o=P(document,`p`,`wui-chat-clip-error`);o.setAttribute(`role`,`status`),o.hidden=!0,t.append(n,o);let s={attachmentId:e,root:t,play:r,wave:i,time:a,error:o,transcript:null};return r.addEventListener(`click`,()=>this.#C(s)),b8(i,e),this.#e=s,this.replaceChildren(t),s}#f(e,t){let n=this.activeTurn.labels;e.root.setAttribute(`aria-label`,n.voiceClip),e.play.disabled=this.#l||typeof this.activeTurn.readAttachment!=`function`,this.#p(e),this.#m(e),this.#h(e,t.transcript)}#p(e){let t=this.activeTurn.labels,n=this.#i?t.voiceClipPause:t.voiceClipPlay;e.play.setAttribute(`aria-label`,n),e.play.title=n,e.play.replaceChildren(g8(this.#i?`pause`:`play`,18))}#m(e){let t=this.#n/1e3,n=t>0?Math.min(1,this.#r/t):0,r=Math.floor(n*_8);[...e.wave.children].forEach((e,t)=>{e.classList.toggle(`wui-chat-clip-bar--played`,t<r)});let i=vi(Math.max(1,Math.round(t)));e.time.textContent=this.activeTurn.labels.voiceClipTime(vi(this.#r),i)}#h(e,t){if(typeof t!=`string`||t===``){e.transcript?.toggle.remove(),e.transcript?.text.remove(),e.transcript=null;return}let n=e.transcript??this.#g(e);n.text.textContent=t,this.#_(n)}#g(e){let t=P(document,`button`,`wui-chat-clip-toggle`);t.type=`button`;let n=P(document,`p`,`wui-chat-clip-transcript`);n.hidden=!this.#t;let r={toggle:t,text:n};return t.addEventListener(`click`,()=>{this.#t=!this.#t,n.hidden=!this.#t,this.#_(r)}),e.transcript=r,e.root.append(t,n),r}#_(e){let t=this.activeTurn.labels;e.toggle.setAttribute(`aria-expanded`,String(this.#t)),e.toggle.textContent=this.#t?t.voiceClipHideTranscript:t.voiceClipShowTranscript}#v(e){return this.#o??=this.#y(e).catch(e=>{throw this.#o=null,e}),this.#o}async#y(e){let t=this.#c,{readAttachment:n}=this.activeTurn;if(n===void 0)throw Error(`${this.localName} loaded a clip on a turn without readAttachment`);let i=await n.call(this.activeTurn,e.attachmentId),a=URL.createObjectURL(new Blob([i],{type:r(i)}));if(t!==this.#c)return URL.revokeObjectURL(a),null;this.#s!==null&&URL.revokeObjectURL(this.#s),this.#s=a;let o=new Audio(this.#s);return o.addEventListener(`timeupdate`,()=>{this.#r=o.currentTime,this.#m(e)}),o.addEventListener(`ended`,()=>{this.#r=0,this.#b(),this.#m(e)}),o.addEventListener(`error`,()=>{this.#b(),this.#o=null,this.#S(e)}),this.#a=o,o}#b(){this.#a?.pause(),this.#x(!1)}#x(e){this.#i=e,e?(v8&&v8!==this&&v8.#b(),v8=this):v8===this&&(v8=null);let t=this.#e;t!==null&&this.#p(t)}#S(e){e.error.textContent=this.activeTurn.labels.voiceClipFailed,e.error.hidden=!1}async#C(e){if(this.#i)this.#b();else{e.error.hidden=!0,this.#l=!0,e.play.disabled=!0,e.play.setAttribute(`aria-busy`,`true`);try{let t=await this.#v(e);if(t===null)return;this.#x(!0),await t.play()}catch{this.#b(),this.#o=null,this.#S(e)}finally{this.#l=!1,e.play.removeAttribute(`aria-busy`),e.play.disabled=typeof this.activeTurn.readAttachment!=`function`}}}});var x8={Text:`wui-chat-part-text`,Sources:`wui-chat-part-sources`,QuickReplies:`wui-chat-part-quick-replies`,InputRequest:`wui-chat-part-input-request`,Action:`wui-chat-part-action`,Notice:`wui-chat-part-notice`,Table:`wui-chat-part-table`,Chart:`wui-chat-part-chart`,Figures:`wui-chat-part-figures`,RecordCard:`wui-chat-part-record-card`,Image:`wui-chat-part-image`,File:`wui-chat-part-file`,Ticket:`wui-chat-part-ticket`,Handoff:`wui-chat-part-handoff`,VoiceClip:`wui-chat-part-voice-clip`},S8=n({SpeechConfig:()=>void 0}),C8=t((()=>{})),w8=1e4,T8=2e3,E8=3e5,D8=new Set([`NotAllowedError`,`SecurityError`,`PermissionDeniedError`]),O8=new Set([`NotFoundError`,`OverconstrainedError`,`NotReadableError`]);function k8(e){return D8.has(j8(e,`name`))?new Ut(`Blocked`,M8(e)):O8.has(j8(e,`name`))?new Ut(`NoMicrophone`,M8(e)):A8(e)}function A8(e){return e instanceof Ut?e:new Ut(`Failed`,M8(e)??String(e))}function j8(e,t){return typeof e==`object`&&e||typeof e==`function`?Reflect.get(e,t):void 0}function M8(e){let t=j8(e,`message`);return t==null?void 0:String(t)}function N8(e){return typeof e==`object`&&!!e}function P8(e){let t=j8(e,`SpeechConfig`),n=j8(e,`AudioConfig`),r=j8(e,`NoMatchDetails`);return typeof j8(t,`fromAuthorizationToken`)==`function`&&typeof j8(n,`fromDefaultMicrophoneInput`)==`function`&&typeof j8(n,`fromSpeakerOutput`)==`function`&&typeof j8(r,`fromResult`)==`function`&&typeof j8(e,`SpeechRecognizer`)==`function`&&typeof j8(e,`SpeakerAudioDestination`)==`function`&&typeof j8(e,`SpeechSynthesizer`)==`function`&&N8(j8(e,`PropertyId`))&&N8(j8(e,`ResultReason`))&&N8(j8(e,`NoMatchReason`))&&N8(j8(e,`CancellationReason`))}function F8(e){if(!P8(e))throw new Ut(`Unavailable`,`Speech is not available in this browser.`);return e}var I8=null;function L8(){let e=globalThis,t=`SpeechSDK`in e?e.SpeechSDK:void 0;return t?Promise.resolve(F8(t)):(I8===null&&(I8=Promise.resolve().then(()=>(C8(),S8)).then(e=>F8(j8(e,`SpeechConfig`)?e:j8(e,`default`))).catch(e=>{throw I8=null,e})),I8)}function R8(){return globalThis.document?.documentElement?.lang||globalThis.navigator?.language||`en-US`}function z8(e){let t=e.getToken,n=e.loadSdk??L8,r=e.getLanguage??R8,i=typeof navigator<`u`&&typeof navigator.mediaDevices?.getUserMedia==`function`,a=typeof window<`u`&&window.isSecureContext===!0,o=i&&a,s=typeof window<`u`,c=null,l=null,u=null;function d(){return c!==null&&Date.parse(c.expiresDateTimeUtc)-Date.now()>6e4?Promise.resolve(c):(l===null&&(l=Promise.resolve().then(()=>t()).then(e=>(c=e,l=null,e),e=>{throw l=null,A8(e)})),l)}function f(){return u===null&&(u=Promise.resolve().then(()=>n()).then(e=>{if(!e?.SpeechConfig)throw new Ut(`Unavailable`,`Speech is not available in this browser.`);return e}).catch(e=>{throw u=null,A8(e)})),u}function p(e={}){let{signal:t,onText:n,onEnd:i}=e;if(t?.aborted)return i?.(),Promise.resolve();let a=()=>{},s=()=>{},c=new Promise((e,t)=>{a=e,s=t}),l=!1,u=!1,p=null,m=!1,h=``,g=[],_,v,y,b=()=>{clearTimeout(_),clearTimeout(v),clearTimeout(y)},x=e=>{if(!l){l=!0,b(),t?.removeEventListener(`abort`,S);try{p?.close()}finally{try{i?.()}finally{e?s(e):a()}}}};async function S(){if(!(l||u)){u=!0,b();try{let e=p;e!==null&&await new Promise(t=>e.stopContinuousRecognitionAsync(()=>t(),()=>t()))}finally{x(null)}}}let C=()=>[...g,h].filter(e=>e!==``).join(` `).trim(),w=(e,t)=>{m||(m=!0,clearTimeout(_)),clearTimeout(v),v=setTimeout(S,T8),n?.(C(),t)};async function T(){if(t?.addEventListener(`abort`,S),!o){x(new Ut(`Unavailable`,`Dictation is not available in this browser.`));return}let n;try{n=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){x(k8(e));return}for(let e of n.getTracks())e.stop();if(!l)try{let t=await f(),n=await d();if(l)return;let i=t.SpeechConfig.fromAuthorizationToken(n.token,n.region);i.speechRecognitionLanguage=e.language||r(),i.setProperty(t.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs,String(w8));let a=new t.SpeechRecognizer(i,t.AudioConfig.fromDefaultMicrophoneInput());if(p=a,a.recognizing=(e,t)=>{if(l)return;let n=t.result?.text;n&&(h=n,w(n,!1))},a.recognized=(e,n)=>{if(l)return;let{reason:r,text:i}=n.result;r===t.ResultReason.RecognizedSpeech&&i?(g.push(i),h=``,w(i,!0)):r===t.ResultReason.NoMatch&&t.NoMatchDetails.fromResult(n.result).reason===t.NoMatchReason.InitialSilenceTimeout&&x(new Ut(`NoSpeech`,`No speech was heard.`))},a.canceled=(e,n)=>{l||(n.reason===t.CancellationReason.Error?x(new Ut(`Failed`,n.errorDetails)):x(null))},a.sessionStopped=()=>x(null),await new Promise((e,t)=>a.startContinuousRecognitionAsync(()=>e(),t)),l)return;e.onStarted?.(),_=setTimeout(()=>{m||x(new Ut(`NoSpeech`,`No speech was heard.`))},w8),y=setTimeout(S,E8)}catch(e){x(A8(e))}}return T(),c}async function m(e,t={}){let{signal:n}=t;if(!n?.aborted)try{let i=await f(),a=await d();if(n?.aborted)return;let o=i.SpeechConfig.fromAuthorizationToken(a.token,a.region);o.speechSynthesisLanguage=t.language||r();let s=new i.SpeakerAudioDestination,c=new i.SpeechSynthesizer(o,i.AudioConfig.fromSpeakerOutput(s));await new Promise((t,r)=>{let a=!1,o=()=>{n?.removeEventListener(`abort`,d),c.close(),s.close()},l=()=>{a||(a=!0,o(),t())},u=e=>{a||(a=!0,o(),r(A8(e)))};function d(){s.pause(),l()}n?.addEventListener(`abort`,d),s.onAudioEnd=l;try{c.speakTextAsync(e,e=>{e.reason!==i.ResultReason.SynthesizingAudioCompleted&&u(new Ut(`Failed`,`The reply could not be synthesised.`))},e=>u(e))}catch(e){u(e)}})}catch(e){throw A8(e)}}return{dictation:o,readAloud:s,streamsText:!0,startDictation:p,speak:m}}var B8=8e3,V8=6e3,H8=new Set([`Blocked`,`NoMicrophone`]);function U8(e){let t=e instanceof Ut?e.code:`Failed`;return{code:t,source:`Dictation`,sticky:H8.has(t)}}function W8(e){let t=rr(e.filter(e=>e.kind===`Text`)).replace(/ ?\[\d+\]/g,``).replace(/\s+/g,` `).trim();if(t.length<=6e3)return t;let n=t.slice(0,V8),r=n.lastIndexOf(`. `);return r===-1?n.trim():n.slice(0,r+1)}function G8(e,t){switch(e.code){case`Blocked`:return t.dictationBlocked;case`NoMicrophone`:return t.dictationNoMicrophone;case`NoSpeech`:return t.dictationNotHeard;case`Unavailable`:return t.dictationUnavailable;case`Failed`:return t.dictationFailed;case`SpeakFailed`:return t.readAloudFailed;default:throw Error(`Unknown voice note code "${e.code}".`)}}function K8(e){let t=e.getState,n=e.speech??z8({getToken:e.getToken}),r=`Idle`,i=null,a=null,o=null,s=null,c=0,l=null,u=new Set,d=()=>({mode:r,messageId:i,startedAtMs:a,note:o});function f(){let e=d();for(let t of[...u])t(e)}function p(e){r=e.mode,i=e.messageId??null,a=e.startedAtMs??null,f()}function m(){l!==null&&clearTimeout(l),l=null}function h(e){m(),o=e,e&&!e.sticky&&(l=setTimeout(()=>{l=null,o=null,f()},B8)),f()}function g(){o!==null&&(m(),o=null,f())}function _(){c+=1;let e={id:c,controller:new AbortController,stopped:!1};return s=e,e}function v(e){s===e&&(s=null,p({mode:`Idle`}))}function y(){let e=s;s=null,e&&(e.stopped=!0,e.controller.abort()),r!==`Idle`&&p({mode:`Idle`})}function b(){let e=t();return!!(e.features.Dictation&&e.profile?.speechAvailable&&n.dictation)}function x(){let e=t();return!!(e.features.ReadAloud&&e.profile?.speechAvailable&&n.readAloud)}async function S(e){if(r===`Dictating`){y();return}if(y(),h(null),!b())return;let t=e.getText(),i=t!==``&&!/\s$/.test(t)?`${t} `:t,a=_();p({mode:`Dictating`});try{await n.startDictation({signal:a.controller.signal,onText:t=>{s===a&&e.setText(i+t)},onEnd:()=>v(a)})}catch(e){if(a.stopped)return;v(a),h(U8(e))}}async function C(e,t){if(r===`Speaking`&&i===e){y();return}y(),h(null);let a=W8(t);if(a===``)return;let o=_();p({mode:`Speaking`,messageId:e});try{await n.speak(a,{signal:o.controller.signal}),v(o)}catch{if(o.stopped)return;v(o),h({code:`SpeakFailed`,source:`ReadAloud`,sticky:!1,messageId:e})}}function w(e){return u.add(e),()=>{u.delete(e)}}function T(){y(),m(),o=null,u.clear()}return{canDictate:b,canSpeak:x,getStatus:d,subscribe:w,toggleDictation:S,toggleSpeak:C,stop:y,dismissNote:g,destroy:T}}var q8=new Set([`Shift`,`Control`,`Alt`,`Meta`,`Escape`]);function J8(e,t){e.isTrusted&&!q8.has(e.key)&&t.getStatus().mode===`Dictating`&&t.stop()}function Y8({voice:e,getLabels:t,textarea:n,onTextChanged:r}){let i=null,a=$(`button`,`wui-chat-tool wui-chat-mic`,{type:`button`});a.append(g8(`mic`,20)),a.hidden=!0,a.addEventListener(`click`,()=>{e.toggleDictation({getText:()=>n.value,setText:e=>{n.value=n.maxLength>0?e.slice(0,n.maxLength):e,r(),n.setSelectionRange(n.value.length,n.value.length)}})});let o=$(`p`,`wui-chat-voice-note`,{role:`status`});o.hidden=!0;let s=$(`span`,`visually-hidden`,{"aria-live":`polite`});function c(e){let n=t(),r=e.note?.source===`ReadAloud`?null:e.note,i=e.mode===`Dictating`,c=i?n.dictateStop:n.dictate;a.setAttribute(`aria-pressed`,String(i)),a.setAttribute(`aria-label`,c),a.title=c;let l=r?.code===`Blocked`||r?.code===`NoMicrophone`;r===null?(o.hidden=!0,o.textContent=``):(o.hidden=!1,o.textContent=G8(r,n),o.setAttribute(`role`,r.sticky?`alert`:`status`)),o.classList.toggle(`wui-chat-voice-note--blocked`,l),s.textContent=i?n.dictateListening:``}function l(t){let{state:n}=t;a.hidden=!e.canDictate();let r=e.getStatus().mode===`Speaking`,i=n.messagesLeftToday===0;a.disabled=i||r||n.handoffPause===!0}function u(e){c(e),i!==null&&l(i)}let d=e.subscribe(u);function f(t){i=t,l(t),c(e.getStatus())}function p(){d()}return{buttons:[a],note:o,announcer:s,paint:f,destroy:p}}var X8=10,Z8=.9,Q8=0;function $8(e){for(let t of e.toReversed())for(let e of t.parts.toReversed())if(e.kind===`InputRequest`&&e.state===`Open`)return e.fields[0]?.label??e.title??null;return null}function e5(e){Q8+=1;let t=`wui-chat-composer-hint-${Q8}`,n=$(`p`,`wui-chat-allowance`,{role:`status`});n.hidden=!0;let r=$(`span`),i=$(`button`,`btn btn-ghost-primary btn-sm wui-chat-action-btn`,{type:`button`});i.addEventListener(`click`,()=>e.onCancelEdit());let a=$(`div`,`wui-chat-editing`);a.hidden=!0,a.append(r,i);let o=$(`div`,`wui-chat-attachments`);o.hidden=!0;let s=$(`button`,`wui-chat-tool`,{type:`button`});s.append(X2(`paperclip`,20)),s.hidden=!0;let c=$(`input`,null,{type:`file`,multiple:``,tabindex:`-1`});c.hidden=!0,c.addEventListener(`change`,()=>{let t=[...c.files??[]];c.value=``,t.length>0&&e.onAttach(t)}),s.addEventListener(`click`,()=>c.click());let l=$(`textarea`,`wui-chat-input`,{rows:`1`,"aria-describedby":t}),u=$(`span`,`visually-hidden`,{id:t}),d=$(`span`,`wui-chat-counter`);d.hidden=!0;let f=$(`button`,`wui-chat-send`,{type:`submit`});f.append(X2(`arrow-up`,18));let p=$(`button`,`wui-chat-send wui-chat-send--stop`,{type:`button`});p.append(X2(`stop`,16)),p.hidden=!0,p.addEventListener(`click`,()=>e.onStop());let m=$(`form`,`wui-chat-composer`);m.append(s,c,l,d,u,p,f);let h=null,g=null,_=null,v=0,y=null;function b(){l.style.height=`auto`,l.style.height=`${l.scrollHeight}px`;let e=getComputedStyle(l),t=l.scrollHeight-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom);m.classList.toggle(`wui-chat-composer--multiline`,t>(parseFloat(e.lineHeight)||22)*1.5)}function x(){return y?.attachments.some(e=>e.status===`Uploading`)??!1}function S(){return y?.attachments.some(e=>e.status===`Ready`)??!1}function C(){let e=l.value.length,t=v>0&&e>v*Z8;d.hidden=!t,t&&_&&(d.textContent=_.counter(e,v))}function w(){let e=y?.messagesLeftToday??null,t=l.value.trim()===``&&!S();f.disabled=!!y?.streaming||e===0||x()||t||y?.handoffPause===!0,m.classList.toggle(`wui-chat-composer--has-text`,!t)}function T(){if(f.disabled)return;let t=l.value.trim();l.value=``,b(),C(),w(),e.voice?.stop(),e.voice?.dismissNote(),e.onSubmit(t)}l.addEventListener(`input`,()=>{b(),C(),w(),l.value!==``&&e.onTyping?.()}),l.addEventListener(`keydown`,e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),T())}),m.addEventListener(`submit`,e=>{e.preventDefault(),T()});let E=e.voice,D=E?Y8({voice:E,getLabels:()=>{if(_===null)throw Error(`composer labels are read before the first render`);return _},textarea:l,onTextChanged:()=>{b(),C(),w()}}):null;if(E&&D){let e=D.buttons[0];e&&m.insertBefore(e,f),l.addEventListener(`keydown`,e=>J8(e,E))}function O(t,n){let r=t.map(t=>{let r=$(`span`,`wui-chat-chip`),i=$(`span`,null,t.status===`Failed`?{title:t.error??``}:null);i.textContent=t.fileName;let a=$(`button`,`wui-chat-chip-remove`,{type:`button`,"aria-label":n.removeAttachment(t.fileName)});a.append(X2(`x`,14)),a.addEventListener(`click`,()=>e.onRemove(t.key));let o=[];if(t.status===`Uploading`){let e=$(`progress`,`wui-chat-chip-progress`,{max:`1`});typeof t.progress==`number`&&(e.value=t.progress);let r=$(`span`,`wui-chat-chip-status`);r.textContent=n.attachmentUploading,o.push(e,r)}if(t.status===`Failed`){let e=$(`span`,`wui-chat-chip-error`,{"aria-live":`polite`});e.textContent=t.error||n.attachmentFailed,o.push(e)}return r.append(i,...o,a),r});o.replaceChildren(...r),o.hidden=r.length===0}function k(t){y=t.state,_=t.labels,v=t.maxLength,t.sendIcon&&f.dataset.icon!==t.sendIcon&&(f.dataset.icon=t.sendIcon,f.replaceChildren(X2(t.sendIcon,18)));let o=y.messagesLeftToday;m.setAttribute(`aria-label`,_.composer),u.textContent=_.composerHint,l.setAttribute(`aria-label`,_.composer),l.maxLength=v,l.placeholder=y.handoffPause?_.handoffMoment:$8(y.messages)??_.placeholder,l.disabled=o===0||y.handoffPause===!0,n.hidden=!(o!==null&&o<=X8),!n.hidden&&o!==null&&(n.textContent=_.allowance(o));let d=y.editing?.messageId??null;if(d!==h){let t=h!==null;h=d,y.editing?(e.voice?.stop(),l.value=y.editing.text,b()):t&&(l.value=``,b())}a.hidden=!y.editing,r.textContent=_.editing,i.textContent=_.cancel;let x=t.draft??null;typeof x==`string`&&x!==``&&x!==g&&(g=x,l.value=x,l.dispatchEvent(new Event(`input`)),l.focus(),e.onDraftApplied?.()),O(y.attachments,_);let S=y.features.Attachments&&(y.profile?.limits.maxAttachments??0)>0&&y.handoffPause!==!0;s.hidden=!S,s.setAttribute(`aria-label`,_.attach),s.title=_.attachHint,c.accept=t.accept??``;let T=y.streaming&&y.features.Stop===!0;p.hidden=!T,p.setAttribute(`aria-label`,_.stop),f.hidden=T,f.setAttribute(`aria-label`,_.send),C(),w(),D?.paint({state:y})}function A(){l.focus()}function j(){D?.destroy();for(let e of ee)e.remove()}let ee=[n,a,o,...D?[D.note,D.announcer]:[],m];return{nodes:ee,paint:k,focus:A,destroy:j,getDraft:()=>l.value}}var t5=`https://policies.google.com/privacy`,n5=`https://policies.google.com/terms`;function r5(e,t){let n=$(`a`,`wui-chat-footer-link`,{href:t,target:`_blank`,rel:`noopener noreferrer`});return n.textContent=e,n}function i5(){let e=$(`p`,`wui-chat-footer`);e.hidden=!0;function t(t){let{labels:n,profile:r}=t,i=[];if(r){let e=$(`span`,`wui-chat-footer-text`);e.textContent=r.footer.disclaimer||n.disclaimer,i.push(e);let{privacyText:t}=r.footer,a=br(r.footer.privacyUrl)?r.footer.privacyUrl:null;if(a){let e=$(`span`,`wui-chat-footer-privacy`),r=$(`a`,`wui-chat-footer-link`,{href:a});r.textContent=t||n.footerPrivacyFallback,e.append(r),i.push(e)}else if(t){let e=$(`span`,`wui-chat-footer-privacy`);e.textContent=t,i.push(e)}if(r.footer.assuranceText){let e=$(`span`);e.textContent=r.footer.assuranceText,i.push(e)}if(Fe(r)){let e=$(`span`,`wui-chat-footer-captcha`);e.append(document.createTextNode(n.captchaNoticeBefore),r5(n.captchaPrivacyPolicy,t5),document.createTextNode(n.captchaNoticeAnd),r5(n.captchaTerms,n5),document.createTextNode(n.captchaNoticeAfter)),i.push(e)}}e.replaceChildren(...i),e.hidden=i.length===0}return{el:e,paint:t}}function a5(e,t,n){e.setAttribute(`aria-label`,t),e.title=t,e.dataset.icon!==n&&(e.dataset.icon=n,e.replaceChildren(X2(n,20)))}function o5(e){let t=$(`span`,`wui-chat-orb`,{"aria-hidden":`true`}),n=$(`strong`,`wui-chat-title`);e.titleId&&(n.id=e.titleId);let r=$(`span`,`wui-chat-tagline`),i=$(`span`,`wui-chat-status`),a=$(`div`,`wui-chat-header-text`);a.append(n,r,i);let o=$(`span`,`wui-chat-header-conversation`);o.hidden=!0;let s=$2(``,`history`,()=>e.onHistory()),c=$2(``,`volume-high`,()=>e.onMute()),l=$2(``,`plus`,()=>e.onNew()),u=$2(``,`maximize-4`,()=>e.onSwitch());u.classList.add(`wui-chat-switch-btn`,`wui-chat-switch-btn--full`);let d=$2(``,`panel-left-open`,()=>e.onSwitch());d.classList.add(`wui-chat-switch-btn`,`wui-chat-switch-btn--side`);let f=$2(``,`x`,()=>e.onClose());f.classList.add(`wui-chat-close-btn`);let p=$(`div`,`wui-chat-header-actions`);p.append(o,s,c,l,u,d,f);let m=$(`header`,`wui-chat-header`);m.append(t,a,p);function h(e){let{labels:t}=e;m.hidden=!1,n.textContent=e.title??``,r.textContent=e.tagline??``,r.hidden=!e.tagline,i.textContent=e.status??``,s.hidden=!e.showHistory,e.viewingHistory?a5(s,t.backToChat,`arrow-left`):a5(s,t.history,`history`),c.hidden=!e.showMute,a5(c,e.muted?t.unmuteSounds:t.muteSounds,e.muted?`volume-mute`:`volume-high`),l.hidden=!!e.viewingHistory||e.showNew===!1,l.disabled=!e.canNew,a5(l,t.newChat,`plus`),u.hidden=e.switchTo!==`full-page`,u.disabled=!e.canSwitch,a5(u,t.openFullScreen,`maximize-4`),d.hidden=e.switchTo!==`docked`,d.disabled=!e.canSwitch,a5(d,t.openSidePanel,`panel-left-open`),f.hidden=!e.showClose,a5(f,t.close,`x`)}return{el:m,conversation:o,paint:h}}var s5=120;function c5(e,t,n=`outline`){let r=$(`button`,`${Z2(n,`sm`)} wui-chat-action-btn`,{type:`button`});return r.textContent=e,r.addEventListener(`click`,t),r}function l5(e){let t=$(`div`,`wui-chat-history`);t.hidden=!0;let n=null,r=null,i=null,a=null,o=null,s=!1;function c(){return n||(n=Ht({client:e.getClient()}),r=n.subscribe(()=>_()),n)}function l(e){i={id:e.publicId,kind:`rename`,draft:e.title??``,saving:!1},a=null,o=null,s=!0,_()}function u(e){i={id:e.publicId,kind:`delete`,saving:!1},a=null,o=null,_()}function d(){i=null,a=null,o=null,_()}async function f(){let t=i;if(t?.kind!==`rename`||t.saving)return;let n=t.draft.trim();if(n){t.saving=!0,_();try{await c().rename(t.id,n),i===t&&(i=null),a=null,o=null}catch{if(i!==t)return;t.saving=!1,o=e.getLabels().renameFailed}_()}}async function p(){let t=i;if(!(t?.kind!==`delete`||t.saving)){t.saving=!0,_();try{await c().remove(t.id),i===t&&(i=null),a=null,e.onDeleted(t.id)}catch{if(i!==t)return;t.saving=!1,a=e.getLabels().deleteFailed}_()}}function m(e,t){let n=$(`li`,`wui-chat-history-row wui-chat-history-row--editing`),r=$(`input`,`wui-chat-history-input`,{type:`text`,"aria-label":e.conversationTitle,maxlength:String(s5)});r.value=t.draft,r.addEventListener(`input`,()=>{t.draft=r.value,i.disabled=t.saving||!t.draft.trim()}),r.addEventListener(`keydown`,e=>{e.key===`Enter`&&!e.isComposing&&e.keyCode!==229?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),d())});let i=c5(e.renameSave,()=>f(),`primary`);if(i.disabled=t.saving||!t.draft.trim(),n.append(r,i,c5(e.cancel,()=>d(),`ghost`)),o!==null){let e=$(`p`,`wui-chat-history-error`,{role:`alert`});e.textContent=o,n.append(e)}return s&&(s=!1,queueMicrotask(()=>r.focus())),n}function h(e,t){let n=$(`li`,`wui-chat-history-row wui-chat-history-row--confirm`),r=$(`p`);r.textContent=e.deleteConfirmTitle;let i=$(`p`);i.textContent=e.deleteConfirmMessage;let a=c5(e.deleteConfirm,()=>p(),`danger`);return a.disabled=t.saving,n.append(r,i,a,c5(e.cancel,()=>d(),`ghost`)),n}function g(t,n,r){if(i?.id===t.publicId&&i.kind===`rename`)return m(n,i);if(i?.id===t.publicId&&i.kind===`delete`)return h(n,i);let a=$(`li`,`wui-chat-history-row`),o=$(`button`,`wui-chat-history-open`,{type:`button`}),s=$(`span`,`wui-chat-history-title`);s.textContent=t.title||n.untitled;let c=$(`span`,`wui-chat-history-time`);return c.textContent=er(t.lastActivityDateTimeUtc),o.append(s,c),o.addEventListener(`click`,()=>e.onOpen(t.publicId)),a.append(o),r.Rename&&a.append($2(n.rename,`pencil`,()=>l(t))),r.Delete&&a.append($2(n.deleteChat,`trash`,()=>u(t))),a}function _(){let r=e.getLabels(),i=e.getFeatures(),o=n?n.getState():{items:[],totalCount:null,loading:!1,error:null,hasMore:!1},s=[];if(o.error||a){let e=$(`p`,`wui-chat-history-error`,{role:`alert`});o.error?(e.append(document.createTextNode(r.loadFailed),document.createTextNode(` `)),e.append(c5(r.retry,()=>c().load(),`outline`))):e.textContent=a,s.push(e)}if(o.loading&&o.items.length===0){let e=$(`p`,`wui-chat-history-empty`,{role:`status`});e.textContent=r.loadingConversation,s.push(e)}if(o.items.length===0&&!o.loading&&!o.error){let e=$(`p`,`wui-chat-history-empty`),t=$(`span`);t.textContent=r.historyEmptyTitle;let n=$(`span`);n.textContent=r.historyEmptyText,e.append(t,n),s.push(e)}if(o.items.length>0){let e=$(`ul`,`wui-chat-history-list`,{"aria-label":r.history});e.append(...o.items.map(e=>g(e,r,i))),s.push(e)}o.hasMore&&!o.loading&&s.push(c5(r.loadMore,()=>c().loadMore(),`outline`)),t.replaceChildren(...s)}function v(){t.hidden=!1,Promise.allSettled([c().load()]),_()}function y(){t.hidden=!0}function b(){r?.(),r=null,n?.dispose(),n=null}return{el:t,show:v,hide:y,paint:_,dispose:b}}var u5=new Set([`GET`,`HEAD`]);function d5(){let e=document.querySelector(`meta[name="wui-csrf"]`),t=e?.getAttribute(`content`);return t?{token:t,header:e?.getAttribute(`data-header`)||`RequestVerificationToken`}:null}async function f5(e,{lenient:t=!1}={}){let n=await e.text();if(n){if((e.headers.get(`content-type`)||``).includes(`json`)){if(!t)return JSON.parse(n);try{return JSON.parse(n)}catch{return n}}return n}}async function p5(e,t,n){let r=new TextDecoder,i=e.getReader(),a=``;for(;;){let{done:e,value:o}=await i.read();if(e)break;a+=r.decode(o,{stream:!0}),n({event:{target:{responseText:a,status:t}}})}return a+=r.decode(),a}function m5({fetch:e=(...e)=>globalThis.fetch(...e)}={}){async function t(t,n,r,i={}){let a={...i.headers},o;if(typeof FormData<`u`&&r instanceof FormData){for(let e of Object.keys(a))e.toLowerCase()===`content-type`&&delete a[e];o=r}else r!==void 0&&(a[`Content-Type`]=`application/json`,o=JSON.stringify(r));if(!u5.has(t)){let e=d5();e&&(a[e.header]=e.token)}let s=i.signal,c=s,l,u,d=()=>l?.abort(s?.reason);(i.timeout??0)>0&&(l=new AbortController,c=l.signal,s?.aborted?l.abort(s.reason):s?.addEventListener(`abort`,d,{once:!0}),u=setTimeout(()=>l?.abort(new DOMException(`The request timed out.`,`TimeoutError`)),i.timeout));try{let r={method:t,headers:a,credentials:`same-origin`};o!==void 0&&(r.body=o),c&&(r.signal=c);let s=await e(n,r);if(!s.ok){let e=Error(`Request failed with status ${s.status}`);throw e.response={status:s.status,data:await f5(s,{lenient:!0})},e}let l;return l=i.responseType===`arraybuffer`?await s.arrayBuffer():typeof i.onDownloadProgress==`function`&&s.body?await p5(s.body,s.status,i.onDownloadProgress):await f5(s),{data:l,status:s.status}}finally{clearTimeout(u),s?.removeEventListener(`abort`,d)}}return{get:(e,n)=>t(`GET`,e,void 0,n),post:(e,n,r)=>t(`POST`,e,n,r),put:(e,n,r)=>t(`PUT`,e,n,r),delete:(e,n)=>t(`DELETE`,e,void 0,n)}}function h5(e){let t,n=!1,r=!1,i=$(`div`,`wui-chat-nudge`,{role:`status`});i.hidden=!0;let a=$(`button`,`wui-chat-nudge-text`,{type:`button`}),o=$(`button`,`wui-chat-nudge-close`,{type:`button`});o.append(X2(`x`,14)),i.append(a,o);function s(){clearTimeout(t),t=void 0}function c(){s(),r=!0,i.hidden=!0}a.addEventListener(`click`,()=>{i.hidden=!0,e.onActivate()}),o.addEventListener(`click`,()=>{c(),e.onDismiss()});function l(e){s(),r||n||(t=setTimeout(()=>{t=void 0,a.textContent=e.text,o.setAttribute(`aria-label`,e.label),i.hidden=!1,n=!0},e.delaySeconds*1e3))}function u(){s(),i.remove()}return{el:i,schedule:l,cancel:s,dismiss:c,isShown:()=>n,destroy:u}}var g5=6e4,_5=60*g5,v5=48*_5;function y5(e){if(typeof e!=`string`||e===``)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function b5(e,t=Date.now(),n){let r=y5(e);if(r===null)return``;let i=t-r,a=Math.abs(i),o=i>=0,s=new Intl.RelativeTimeFormat(n,{numeric:`auto`});if(a<g5)return s.format(0,`second`);if(a<_5){let e=Math.floor(a/g5);return s.format(o?-e:e,`minute`)}if(a<v5){let e=Math.floor(a/_5);return s.format(o?-e:e,`hour`)}return new Intl.DateTimeFormat(n,{day:`numeric`,month:`short`,year:`numeric`}).format(new Date(r))}function x5(e,t){let n=y5(e);return n===null?``:new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(n))}function S5(e,t){e.addEventListener(`click`,()=>t()),e.addEventListener(`keydown`,e=>{(Qi(e)||e.key===` `)&&(e.preventDefault(),t())})}function C5(e){let{list:t,getLabels:n,getFeatures:r,onOpen:i}=e,a=e.now??(()=>Date.now()),o=$(`div`,`wui-chat-empty-rows wui-chat-empty-rows--past`);o.hidden=!0;let s=!1;function c(e,t){let n=$(`div`,`card card-pad-sm card-clickable wui-chat-empty-row`,{role:`button`,tabindex:`0`}),r=$(`div`,`card-body wui-chat-empty-row-body`),o=$(`span`,`wui-chat-empty-row-title`);o.textContent=e.title||t.earlierChat;let s=$(`span`,`wui-chat-empty-row-time`,{title:x5(e.lastActivityDateTimeUtc)});return s.textContent=b5(e.lastActivityDateTimeUtc,a()),r.append(o,s),n.append(r),S5(n,()=>i(e.publicId)),n}function l(){if(s)return;let e=t.getState().items;if(r().History!==!0||e.length===0){o.replaceChildren(),o.hidden=!0;return}let i=n();o.replaceChildren(...e.slice(0,20).map(e=>c(e,i))),o.hidden=!1}let u=t.subscribe(l);return{el:o,refresh(){r().History===!0&&t.load().catch(e=>globalThis.reportError?.(e))},paint:l,dispose(){s=!0,u()}}}var w5=`https://www.google.com/recaptcha/api.js?render=`;function T5(e){return e!==void 0&&typeof e.ready==`function`&&typeof e.execute==`function`}var E5=new Map;function D5(e){let t=E5.get(e);if(t!==void 0)return t;let n=new Promise((t,n)=>{let r=globalThis.grecaptcha;if(T5(r)){t(r);return}let i=document.createElement(`script`);i.src=w5+encodeURIComponent(e),i.async=!0;let a=t=>{E5.delete(e),n(Object.assign(Error(t),{code:`captcha_unavailable`}))};i.addEventListener(`load`,()=>{let e=globalThis.grecaptcha;e===void 0||typeof e.ready!=`function`?a(`The reCAPTCHA script loaded without grecaptcha.`):e.ready(()=>{let e=globalThis.grecaptcha;T5(e)?t(e):a(`reCAPTCHA became ready without execute.`)})}),i.addEventListener(`error`,()=>{E5.delete(e),n(Error(`The reCAPTCHA script did not load.`))}),document.head.append(i)});return E5.set(e,n),n}async function O5(e,t){let n=await D5(e);await new Promise(e=>n.ready(()=>e()));let r=await n.execute(e,{action:t});if(!r)throw Object.assign(Error(`reCAPTCHA returned no token.`),{code:`captcha_unavailable`});return r}var k5=`data-wchat-printing`,A5=`data-wchat-print-hide`,j5=`data-wchat-print-path`,M5=`data-wchat-print-target`,N5=new Set([`script`,`style`,`link`,`template`]),P5=null;function F5(){if(P5!==null){for(let e of P5.marked)e.removeAttribute(A5),e.removeAttribute(j5),e.removeAttribute(M5);P5.heading.remove(),document.documentElement.removeAttribute(k5),window.removeEventListener(`afterprint`,P5.onAfterPrint),P5=null}}function I5(e,t,n,r,i){F5();let a=e.querySelector(`.wui-chat-panel`);if(a===null)throw Error(`print needs the wui-chat root`);let o=[],s=a;for(;s!==null&&s!==document.documentElement;){s.setAttribute(j5,``),o.push(s);let e=s.parentElement;if(e===null)throw Error(`print walk left the chat root`);for(let t of e.children)t===s||N5.has(t.localName)||(t.setAttribute(A5,``),o.push(t));s=e}for(let e of n)e.setAttribute(A5,``),o.push(e);r!==null&&(r.setAttribute(M5,``),o.push(r));let c=document.createElement(`div`);c.className=`wui-chat-print-heading`;let l=document.createElement(`h1`);l.textContent=i.title;let u=document.createElement(`p`);u.textContent=i.printedOn,c.append(l,u),a.prepend(c),document.documentElement.setAttribute(k5,t);let d=()=>F5();window.addEventListener(`afterprint`,d,{once:!0}),P5={marked:o,heading:c,onAfterPrint:d};try{window.print()}catch(e){throw F5(),e}}function L5(e,t){I5(e,`conversation`,[],null,t)}function R5(e,t,n){if(!e.contains(t))throw Error(`printReply needs a message inside the wui-chat root`);I5(e,`reply`,Array.from(e.querySelectorAll(`li.wui-chat-message`)).filter(e=>e!==t),t,n)}function z5(){return typeof navigator<`u`&&typeof navigator.share==`function`}async function B5({title:e,text:t}){if(!z5())return`failed`;try{return await navigator.share({title:e,text:t}),`shared`}catch(e){return typeof e==`object`&&e&&`name`in e&&e.name===`AbortError`?`cancelled`:`failed`}}var V5=new Set([`Assistant`,`Agent`,`Script`]),H5=new WeakMap;function U5(e,t,n){let{labels:r,features:i,title:a,busy:o,assistantName:s}=n;if(rr(t.parts)!==``){if(i.Share&&z5()){let n=Q2(`ghost`,r.share,`share`,()=>void(async()=>{let e=J5([t],i,r,a,!1,s);e!==``&&await B5({title:a,text:e})===`failed`&&Q5(n.parentElement,r.shareFailed)})());n.disabled=o===!0,e.append(n)}if(i.Print){let t=Q2(`ghost`,r.print,`printer`,()=>{try{let e=t.closest(`.wui-chat`),n=t.closest(`li.wui-chat-message`);if(!(e instanceof HTMLElement)||!(n instanceof HTMLElement))throw Error(`printReply needs a message inside the wui-chat root`);R5(e,n,{title:a,printedOn:X5(r)})}catch{Z5(t,r.printFailed)}});e.append(t)}}}function W5(e,t,n){if(t.streaming||t.thinking||t.loading||t.conversationId===null||t.messages.filter(e=>e.stored&&V5.has(e.author.kind)&&rr(e.parts)!==``).length===0){e.hidden=!0;return}let{labels:r,features:i}=n,a=!!i.Share&&z5(),o=!!i.Print;if(!a&&!o){e.hidden=!0;return}let s=[a,o,t.messages.length,r.shareConversation,r.printConversation].join(`|`);e.dataset.sig!==s&&(e.dataset.sig=s,e.replaceChildren(),a&&e.append(K5(e,r,i,n)),o&&e.append(q5(e,r,n))),e.hidden=!1}function G5(e,t,n,r){return e.iconOnly?$2(t,n,r):Q2(`ghost`,t,n,r)}function K5(e,t,n,r){return G5(r,t.shareConversation,`share`,()=>void(async()=>{let i=r.getState(),a=Y5(i,r);await B5({title:a,text:J5(i.messages.filter(e=>e.stored),n,t,a,!0,i.profile?.assistant.name)})===`failed`&&Q5(e,t.shareFailed)})())}function q5(e,t,n){let r=G5(n,t.printConversation,`printer`,()=>{try{let r=e.closest(`.wui-chat`);if(!(r instanceof HTMLElement))throw Error(`printConversation needs the wui-chat root`);L5(r,{title:Y5(n.getState(),n),printedOn:X5(t)})}catch{n.iconOnly?Q5(e,t.printFailed):Z5(r,t.printFailed)}});return r}function J5(e,t,n,r,i,a){return mi(fi(e,{labels:n,title:r,figureText:t.FigureText,...a===void 0?{}:{assistantName:a}}),{heading:i,speakers:i})}function Y5(e,t){return typeof e.title==`string`&&e.title!==``?e.title:t.title}function X5(e){return e.printedOn(er(new Date().toISOString()))}function Z5(e,t){let n=e.lastChild;if(!(n instanceof Text))return;let r=H5.get(n);r&&clearTimeout(r.timer);let i=r??{original:n.data};n.data=t,i.timer=setTimeout(()=>{n.data=i.original,H5.delete(n)},Di),H5.set(n,i)}function Q5(e,t){if(!e)return;let n=document.createElement(`span`);n.className=`wui-chat-action-notice`,n.setAttribute(`role`,`status`),n.textContent=t,e.append(n),setTimeout(()=>n.remove(),Di)}var $5=`data-wchat-docked`,e7=`--wui-chat-docked-width`,t7=420,n7=new Set;function r7(e,t){let n=document.documentElement;n.setAttribute($5,e),n.style.setProperty(e7,t)}function i7(){let e=document.documentElement;e.removeAttribute($5),e.style.removeProperty(e7)}function a7(e){let t=o4({...e,layout:`docked`,role:`dialog`,launcher:!0}),n={},r=e.position,i=!1,a=null,o=()=>`${Math.round(t.panel.getBoundingClientRect().width)||t7}px`;function s(){n7.add(n),r7(r,o()),typeof ResizeObserver==`function`&&(a=new ResizeObserver(()=>document.documentElement.style.setProperty(e7,o())),a.observe(t.panel))}function c(){a?.disconnect(),a=null,n7.delete(n),n7.size===0&&i7()}function l(e){t.setOpen(e),e&&!i?(i=!0,s()):!e&&i&&(i=!1,c())}function u(e){t.setAppearance(e),e.position!==void 0&&(r=e.position,i&&document.documentElement.setAttribute($5,r))}function d(){l(!1)}return{...t,setOpen:l,setAppearance:u,destroy:d}}function o7(e){return o4({...e,layout:`embedded`,role:`region`,launcher:!1})}var s7=`wchat:peeked`,c7=576,l7=200;function u7(e){let t=o4({...e,layout:`launcher`,role:`dialog`,launcher:!0}),{root:n,panel:r}=t;if(!t.nudgeHost||!t.launcherButton)throw Error(`a launcher shell always has its launcher`);let i=t.nudgeHost,a=t.launcherButton,o={peek:!1,peekSeconds:3,hideWhileOpen:!1,expressive:!1};a.dataset.state=`closed`;let s=!1,c=!1,l,u,d=()=>o.hideWhileOpen||o.expressive;function f(){!o.peek||s||c||i.dataset.launcher!==`idle`||globalThis.innerWidth<c7||globalThis.sessionStorage.getItem(s7)!==null||(globalThis.sessionStorage.setItem(s7,`1`),i.dataset.launcher=`peeking`,l=setTimeout(()=>{l=void 0,i.dataset.launcher===`peeking`&&(i.dataset.launcher=`idle`)},o.peekSeconds*1e3))}i.addEventListener(`animationend`,e=>{e.target===i&&i.dataset.launcher===`idle`&&f()});function p(e){if(e!==c){if(c=e,clearTimeout(l),l=void 0,e)clearTimeout(u),u=void 0,d()?(i.dataset.launcher=`hidden`,i.toggleAttribute(`inert`,!0)):i.dataset.launcher===`peeking`&&(i.dataset.launcher=`idle`);else if(d()){let e=r.contains(document.activeElement);u=setTimeout(()=>{u=void 0,i.toggleAttribute(`inert`,!1),i.dataset.launcher=`idle`,e&&a.focus()},l7)}}a.dataset.state=e?`open`:`closed`,t.setOpen(e)}function m(e){e.reduced!==void 0&&(s=!!e.reduced),e.peek!==void 0&&(o.peek=e.peek),e.peekSeconds!==void 0&&(o.peekSeconds=e.peekSeconds),e.hideWhileOpen!==void 0&&(o.hideWhileOpen=e.hideWhileOpen),e.expressive!==void 0&&(o.expressive=e.expressive===!0),e.phoneMode!==void 0&&n.classList.toggle(`wui-chat--sheet`,e.phoneMode===`Sheet`),e.sheetHeightDvh!==void 0&&n.style.setProperty(`--wui-chat-sheet-height`,`${e.sheetHeightDvh}dvh`),e.sheetMaxHeightPx!==void 0&&n.style.setProperty(`--wui-chat-sheet-max-height`,`${e.sheetMaxHeightPx}px`),t.setAppearance(e),!d()&&i.dataset.launcher===`hidden`&&!c&&(i.dataset.launcher=`idle`),i.dataset.launcher===`idle`&&f()}return{...t,nudgeHost:i,launcherButton:a,setOpen:p,setAppearance:m}}function d7(e){return o4({...e,layout:`full-page`,role:`region`,launcher:!1})}var f7=new Set([`Agent`,`Customer`]);function p7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-typing`,e.setAttribute(`aria-hidden`,`true`),e.hidden=!0;let t=document.createElement(`span`);t.className=`wui-chat-loader-typing-orb`;let n=document.createElement(`span`);n.className=`wui-chat-loader-typing-dots`;for(let e=0;e<3;e++){let e=document.createElement(`span`);e.className=`wui-chat-loader-typing-dot`,n.append(e)}e.append(t,n);function r({active:n,reduced:r,authorKind:i}){e.hidden=!n,e.classList.toggle(`wui-chat-loader--reduced`,r===!0),t.hidden=f7.has(i)}function i(){e.remove()}return{el:e,update:r,destroy:i}}var m7=3,h7={Primary:`wui-chat-starter--primary`,Cta:`wui-chat-starter--cta`};function g7(e,t){e.addEventListener(`click`,()=>t()),e.addEventListener(`keydown`,e=>{(Qi(e)||e.key===` `)&&(e.preventDefault(),t())})}function _7(e){let t=$(`h2`,`wui-chat-greeting`),n=$(`div`,`wui-chat-empty-hero`),r=$(`p`,`wui-chat-empty-intro`);r.hidden=!0,n.append($(`span`,`wui-chat-orb`,{"aria-hidden":`true`}),t,r);let i=$(`div`,`wui-chat-empty-extra`);i.hidden=!0;let a=$(`div`,`wui-chat-starters`,{role:`group`}),o=$(`div`,`wui-chat-empty-rows`),s=$(`div`,`wui-chat-empty-past`),c=$(`div`,`wui-chat-empty`,{role:`group`}),l=p7();c.append(l.el,n,i,a,o,s);let u;function d(t,n){let r=$(`button`,[`wui-chat-starter`,(t.variant===null?void 0:h7[t.variant])??``].filter(Boolean).join(` `),{type:`button`});return r.style.setProperty(`--wui-chat-i`,String(n)),t.icon&&r.append(X2(t.icon,16)),r.append(document.createTextNode(t.label)),r.addEventListener(`click`,()=>e.onStarter(t)),r}function f(t,n){let r=$(`div`,`card card-pad-sm card-clickable wui-chat-empty-row`,{role:`button`,tabindex:`0`}),i=$(`div`,`card-body wui-chat-empty-row-body`),a=$(`span`,`wui-chat-empty-row-label`);a.textContent=n.resumeLast;let o=$(`span`,`wui-chat-empty-row-title`,{title:t.title||n.untitled});o.textContent=t.title||n.untitled;let s=$(`span`,`wui-chat-empty-row-time`);return s.textContent=er(t.lastActivityDateTimeUtc),i.append(a,o,s),r.append(i),g7(r,()=>e.onResume()),r}function p(t,n,r){let i=r?$(`div`,`card card-pad-sm card-clickable wui-chat-empty-row`,{role:`button`,tabindex:`0`}):$(`div`,`card card-pad-sm wui-chat-empty-row`),a=$(`div`,`card-body wui-chat-empty-row-body`),o=$(`span`,`wui-chat-empty-row-label`);o.textContent=n.ticketAria(t.number);let s=$(`span`,`wui-chat-empty-row-title`);s.textContent=t.subject;let c=$(`span`,`wui-chat-empty-row-status`);return c.textContent=y4(t.status,n),a.append(o,s,c),i.append(a),r&&g7(i,()=>e.onTicket(t)),i}function m(e,t){if(e.features?.OpenTickets!==!0||!e.openTickets?.length)return null;let n=$(`div`,`wui-chat-open-tickets`,{role:`group`,"aria-label":t.openTickets});return n.append(...e.openTickets.slice(0,m7).map(n=>p(n,t,e.ticketsClickable===!0))),n}function h(e){let{labels:n}=e;t.textContent=e.greeting??``;let i=e.intro??``;r.textContent=i,r.hidden=!i,c.setAttribute(`aria-label`,n.emptyTitle);let s=e.starters??[];a.setAttribute(`aria-label`,n.starters),a.hidden=!e.showStarters||s.length===0,a.replaceChildren(...s.map(d));let l=e.resume??null,u=m(e,n);o.hidden=l===null&&u===null,o.replaceChildren(...[l===null?null:f(l,n),u].filter(e=>e!==null))}function g(e){clearTimeout(u),c.classList.remove(`wui-chat-empty--revealed`),c.classList.add(`wui-chat-empty--intro`),l.update({active:!0,reduced:!1,authorKind:`Assistant`}),u=setTimeout(()=>{u=void 0,l.update({active:!1,reduced:!1,authorKind:`Assistant`}),c.classList.replace(`wui-chat-empty--intro`,`wui-chat-empty--revealed`)},e)}return{el:c,paint:h,intro:g,extraHost:i,pastHost:s}}function v7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-orb`;let t=document.createElement(`span`);t.className=`wui-chat-loader-orb-mark`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`span`);n.className=`wui-chat-loader-orb-glow`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`span`);r.className=`wui-chat-loader-orb-disc`,r.setAttribute(`aria-hidden`,`true`),t.append(n,r);let i=document.createElement(`span`);return i.className=`wui-chat-loader-orb-label`,e.append(t,i),{el:e,render(e){i.textContent!==e.label&&(i.textContent=e.label)}}}var y7=150,b7=1800;function x7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-phrases`;let t=document.createElement(`span`);t.className=`wui-chat-loader-phrases-orb`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`span`);n.className=`wui-chat-loader-phrases-stage`,e.append(t,n);let r=null,i=null;function a(){return e.closest(`.wui-chat-loader`)?.classList.contains(`wui-chat-loader--reduced`)===!0}function o(e){if(e.label===r)return;r=e.label;let t=i,o=document.createElement(`span`);o.className=`wui-chat-loader-phrases-text wui-chat-loader-phrases-text--in`,o.textContent=e.label,o.style.animationDelay=`-${Math.round(performance.now()%b7)}ms, 0s`,n.append(o),i=o,t&&(t.classList.remove(`wui-chat-loader-phrases-text--in`),t.classList.add(`wui-chat-loader-phrases-text--out`),t.style.animationDelay=`-${Math.round(performance.now()%b7)}ms, 0s`,a()?t.remove():setTimeout(()=>t.remove(),y7))}return{el:e,render:o}}var S7=[`95%`,`80%`,`60%`];function C7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-skeleton`;let t=document.createElement(`div`);t.className=`wui-chat-loader-skeleton-label`;let n=document.createElement(`div`);n.className=`wui-chat-loader-skeleton-body`;let r=document.createElement(`span`);r.className=`wui-chat-loader-skeleton-avatar`,r.setAttribute(`aria-hidden`,`true`),n.append(r);for(let e of S7){let t=document.createElement(`span`);t.className=`wui-chat-loader-skeleton-line`,t.setAttribute(`aria-hidden`,`true`),t.style.width=e,n.append(t)}return e.append(t,n),{el:e,render(e){t.textContent!==e.label&&(t.textContent=e.label)}}}var w7=`http://www.w3.org/2000/svg`;function T7(e){if(e===`done`){let e=document.createElementNS(w7,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`wui-chat-loader-steps-check`);let t=document.createElementNS(w7,`path`);return t.setAttribute(`d`,`M3 8.5 6.5 12 13 4.5`),t.setAttribute(`pathLength`,`1`),e.append(t),e}let t=document.createElement(`span`);return t.className=e===`active`?`wui-chat-loader-steps-ring`:`wui-chat-loader-steps-dot`,t}function E7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-steps`;let t=document.createElement(`span`);t.className=`wui-chat-loader-steps-pill`;let n=document.createElement(`ol`);n.className=`wui-chat-loader-steps-list`,e.append(t,n);let r=[];function i(){let e=document.createElement(`li`);e.className=`wui-chat-loader-steps-item`;let t=document.createElement(`span`);t.className=`wui-chat-loader-steps-icon`,t.setAttribute(`aria-hidden`,`true`);let i=document.createElement(`span`);i.className=`wui-chat-loader-steps-text`,e.append(t,i);let a={li:e,icon:t,text:i,state:null};return r.push(a),n.append(e),a}function a(e){let a=e.steps.length===0;for(t.hidden=!a,n.hidden=a,a&&t.textContent!==e.label&&(t.textContent=e.label),e.steps.forEach((t,n)=>{let a=r[n]??i();a.text.textContent!==t&&(a.text.textContent=t);let o=n<e.activeIndex?`done`:n===e.activeIndex?`active`:`pending`;a.state!==o&&(a.state=o,a.li.dataset.state=o,a.icon.replaceChildren(T7(o)))});r.length>e.steps.length;)r.pop()?.li.remove()}return{el:e,render:a}}var D7={Steps:E7,Phrases:x7,Orb:v7,Skeleton:C7},O7=500;function k7(){let e=document.createElement(`div`);e.className=`wui-chat-loader`,e.setAttribute(`role`,`status`),e.hidden=!0;let t=document.createElement(`span`);t.className=`wui-chat-loader-avatar`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`div`);n.className=`wui-chat-loader-body`;let r=document.createElement(`span`);r.className=`visually-hidden`,e.append(t,n,r);let i=null,a=null,o=0,s=null,c=0,l=null,u=!1;function d(){s!==null&&clearInterval(s),s=null}function f(){e.isConnected?(o+=1,p()):d()}function p(){if(!a||!i)return;let t=Ie(i.style,i.steps,i.phrases,o);a.render(t),e.setAttribute(`aria-label`,t.label)}function m(){l!==null&&clearTimeout(l),l=null,u=!1,r.textContent=``}function h(e){!u&&l===null&&e&&(l=setTimeout(()=>{l=null,u=!0,r.textContent=e},O7))}function g(t){if(!t.active)i=null,e.hidden=!0,e.removeAttribute(`data-loading`),d(),m();else{if(!Y2(D7,t.style))throw Error(`Unknown loader style. Use Steps, Phrases, Orb or Skeleton.`);if(!(t.intervalMs>0))throw Error(`Loader intervalMs must be a positive number.`);if(i={...t,steps:t.steps??[],phrases:t.phrases??[]},e.hidden=!1,e.setAttribute(`data-loading`,`true`),e.classList.toggle(`wui-chat-loader--reduced`,t.reduced===!0),!a||a.style!==t.style){let r=D7[t.style]();n.replaceChildren(r.el),a={style:t.style,render:r.render},e.dataset.style=t.style,o=0}h(t.announce),t.reduced===!0?(d(),o=0):(s===null||c!==t.intervalMs)&&(d(),c=t.intervalMs,s=setInterval(f,c)),p()}}function _(){d(),m(),a=null,i=null,e.remove()}return{el:e,update:g,destroy:_}}function A7({voice:e,getLabels:t,message:n}){if(n.streaming||!e.canSpeak()||W8(n.parts)===``)return null;let r=e.getStatus(),i=r.mode===`Speaking`&&r.messageId===n.id,a=t(),o=i?a.readAloudStop:a.readAloud,s=$(`button`,`wui-chat-action-btn wui-chat-speak`,{type:`button`,"aria-pressed":String(i),"aria-label":o,title:o});return s.append(g8(i?`stop`:`speaker`,16)),s.addEventListener(`click`,()=>{e.toggleSpeak(n.id,n.parts)}),s}function j7({voice:e,getLabels:t,message:n}){let r=e.getStatus().note;if(r?.code!==`SpeakFailed`||r.messageId!==n.id)return null;let i=$(`span`,`wui-chat-action-notice`,{role:`status`});return i.textContent=G8(r,t()),i}function M7(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.author.kind===`Visitor`&&n.stored)return n}}var N7=new Set([`Assistant`,`Agent`]),P7=new Set([`Assistant`,`Agent`,`Script`]),F7=new Set([`Visitor`,`Customer`]),I7=48,L7=120,R7={author:{kind:`Assistant`,displayName:null,avatarUrl:null}},z7={warning:`alert-triangle`,danger:`alert-circle`};function B7(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=I7}function V7(e){let{kind:t,displayName:n}=e.author;return t===`Agent`?`Agent:${n??``}`:t===`Script`?`Assistant`:t}function H7(e){for(let t=e?.parentElement;t&&t!==document.body;t=t.parentElement){let{overflowY:e}=getComputedStyle(t);if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t}return null}function U7(e){let t=e.textContent?.trim();t&&!e.hasAttribute(`aria-label`)&&(e.setAttribute(`aria-label`,t),e.setAttribute(`title`,t))}function W7(e){return e.reduced===!0}function G7(e,t,n){let r=$(`button`,`${Z2(`ghost`,`sm`)} wui-chat-action-btn`,{type:`button`,"aria-label":e,title:e}),i=$(`span`);return i.textContent=e,r.append(X2(t,14),i),r.addEventListener(`click`,n),{node:r,text:i}}function K7(e,t){return e.profile?.assistant.name??t.panelTitle}function q7(e,t,n){return e.author.displayName==null?e.author.kind===`Visitor`||e.author.kind===`Customer`?n.you:e.author.kind===`Agent`?n.agent:t.profile?.assistant.name??n.assistant:e.author.displayName}function J7(e){let t=$(`li`,`wui-chat-day`,{role:`presentation`}),n=$(`span`);return n.textContent=e,t.append(n),t}function Y7(e){let t=$(`ol`,`wui-chat-thread`),n=$(`div`,`wui-chat-log`,{role:`log`,"aria-live":`polite`});n.append(t);let r=k7(),i=$(`li`,`wui-chat-message wui-chat-message--assistant wui-chat-message--loading`),a=$(`div`,`wui-chat-loader-slot`);a.append(r.el),i.append(a);let o=!1,s,c=$(`li`,`wui-chat-message wui-chat-message--assistant wui-chat-message--greeting`,{"data-run-start":``,"data-restored":``}),l=$(`div`,`wui-chat-message-body`),u=$(`p`,`wui-chat-text`);l.append(u),c.append(l);let d=$(`button`,`wui-chat-jump`,{type:`button`}),f=$(`div`,`wui-chat-jump-slot`);f.hidden=!0,f.append(d);let p=null,m=!0,h=null,g=null,_=new Map,v=``,y=null;function b(e,t){return{kind:e.kind,part:e,tag:t[e.kind]}}function x(t,n,r){return Object.assign(document.createElement(t),{message:r,turn:e.makeTurnApi(r.id),chatPart:n})}function S(e){return $(`div`,`wui-chat-part wui-chat-part--${e.toLowerCase()}`)}function C(e,t,n,r){e.parts=[];let i=[],a=e=>{let r=b(e,n),i=S(r.kind);return i.append(x(r.tag,r.part,t)),i};for(let e of r(t))if(Array.isArray(e)){let t=$(`div`,`wui-chat-part-group`);t.append(...e.map(a)),i.push(t)}else i.push(a(e));e.body.replaceChildren(...i)}function w(t,n,r){let i=[];n.parts.forEach((a,o)=>{let s=b(a,r),c=t.parts[o];if(c&&c.kind===s.kind&&c.tag===s.tag){c.part!==s.part&&(c.element.message=n,c.element.turn=e.makeTurnApi(n.id),c.element.chatPart=s.part,c.part=s.part),i.push(c);return}let l=S(s.kind),u=x(s.tag,s.part,n);l.append(u),i.push({kind:s.kind,tag:s.tag,part:s.part,element:u,wrapper:l})}),t.parts=i,T(t.body,i.map(e=>e.wrapper))}function T(e,t){let n=new Set(t);for(let t of[...e.children])n.has(t)||t.remove();t.forEach((t,n)=>{e.children[n]!==t&&e.insertBefore(t,e.children[n]??null)})}function E(e,t,n){let r=$(`div`,`wui-chat-rating`,{role:`group`,"aria-label":`${n.rateUp} / ${n.rateDown}`}),i=[[`Up`,n.rateUp,`thumbs-up`],[`Down`,n.rateDown,`thumbs-down`]];for(let[a,o,s]of i){let i=t.rating===a,c=$(`button`,`${Z2(i?`neutral`:`ghost`,`sm`)} wui-chat-action-btn`,{type:`button`,"aria-pressed":String(i),"data-rating":a,"aria-label":o,title:o}),l=$(`span`);l.textContent=o,c.append(X2(s,14),l),c.addEventListener(`click`,()=>D(e,t,a,n)),r.append(c)}if(e.ratingNote){let t=$(`span`,null,{role:`status`});t.textContent=e.ratingNote,r.append(t)}return r}async function D(t,n,r,i){try{await e.onRate(n.id,r),t.ratingNote=i.rated}catch{t.ratingNote=i.ratingFailed}y&&ce(y.state,y.context)}function O(t,n,r,i,a){let{labels:o}=i,s=r.features,c=n.author.kind,l=rr(n.parts),u=[];if(s.Copy&&P7.has(c)&&l){let e=G7(o.copy,`copy`,()=>void(async()=>{await Oi(l)&&(e.text.textContent=o.copied,e.node.dataset.done=``,e.node.setAttribute(`aria-label`,o.copied),e.node.title=o.copied,clearTimeout(t.copyTimer),t.copyTimer=setTimeout(()=>{e.text.textContent=o.copy,delete e.node.dataset.done,e.node.setAttribute(`aria-label`,o.copy),e.node.title=o.copy},Di))})());u.push(e.node)}let d=e.getVoice?.();if(d&&P7.has(c)){let e=A7({voice:d,getLabels:()=>o,message:n});e&&u.push(e);let t=j7({voice:d,getLabels:()=>o,message:n});t&&u.push(t)}if(P7.has(c)){let e=$(`div`);U5(e,n,{labels:o,features:s,title:K7(r,o),assistantName:r.profile?.assistant.name,busy:r.streaming||r.thinking});for(let t of e.children)U7(t);u.push(...e.childNodes)}let f=r.messages.some(e=>e.author.kind===`Visitor`&&e.stored);a&&c===`Assistant`&&!r.streaming&&!r.thinking&&s.Regenerate&&f&&u.push(G7(o.regenerate,`refresh`,()=>e.onRegenerate()).node);let p=M7(r.messages);s.Edit&&p?.id===n.id&&!r.streaming&&!r.thinking&&u.push(G7(o.edit,`pencil`,()=>e.getSession().startEdit(n.id)).node),s.Rating&&n.stored&&N7.has(c)&&u.push(E(t,n,o)),t.actions.hidden=u.length===0,t.actions.replaceChildren(...u)}function k(e){let t=_.get(e.id);if(t)return t;let n=$(`li`,`wui-chat-message`),r=$(`span`,`wui-chat-author visually-hidden`),i=$(`div`,`wui-chat-message-body`),a=$(`div`,`wui-chat-message-actions`);n.append(r,i,a);let o={li:n,author:r,body:i,actions:a,head:null,parts:[],copyTimer:void 0,ratingNote:null};return _.set(e.id,o),o}function A(e,t,n,r){let i=n?.author.kind===`Agent`&&t.author.kind===`Agent`&&(n.author.displayName??``)===(t.author.displayName??``);e.head?.remove(),e.head=t.author.kind===`Agent`&&!i?g4(t.author,r):null,e.head&&e.li.insertBefore(e.head,e.body)}function j(t,n,r,i,a,o){let{labels:s}=i;t.li.className=`wui-chat-message wui-chat-message--${n.author.kind.toLowerCase()}`,t.li.toggleAttribute(`data-restored`,n.restored===!0),t.li.toggleAttribute(`data-run-start`,!o||V7(o)!==V7(n)),n.streaming?t.li.setAttribute(`aria-busy`,`true`):t.li.removeAttribute(`aria-busy`),t.author.textContent=`${q7(n,r,s)}: `,A(t,n,o,s);let c=e.getRenderers(),l=e.getLayoutParts();typeof l==`function`?C(t,n,c,l):w(t,n,c),n.streaming?(t.actions.hidden=!0,t.actions.replaceChildren()):O(t,n,r,i,a)}function ee(e,t){let n=$(`li`,`wui-chat-message wui-chat-message--system wui-chat-message--notice`),r=$(`div`,`wui-chat-notice wui-chat-notice--${e}`,{role:e===`danger`?`alert`:`status`}),i=$(`span`,`wui-chat-notice-icon`,{"aria-hidden":`true`});i.append(X2(z7[e],16));let a=$(`div`,`wui-chat-notice-body`),o=$(`span`,`wui-chat-notice-text`);return o.textContent=t,a.append(o),r.append(i,a),n.append(r),n}function te(e,t){let n=e.resetsDateTimeUtc?` ${t.dailyLimitRefresh(x5(e.resetsDateTimeUtc))}`:``;return ee(`warning`,`${e.message}${n}`)}function ne(t,n){let{labels:r}=n,i=t.turnError,a=i?.code??``;if(i&&a===`daily_limit`)return te(i,r);if(a.endsWith(`feature_off`))return ee(`danger`,t.turnError?.message||r.stopped);let o=$(`li`,`wui-chat-message wui-chat-message--system wui-chat-message--error`),s=$(`p`,`wui-chat-error`,{role:`alert`});s.textContent=t.turnError?.message||r.stopped;let c=X2(`alert-circle`,16);if(c.setAttribute(`aria-hidden`,`true`),o.append(c,s),t.features.Retry){let t=$(`div`,`wui-chat-message-actions`);t.append(G7(r.retry,`rotate-ccw`,()=>e.onRetry()).node),o.append(t)}return o}function re(){return t.closest(`.wui-chat`)}function ie(){return t.closest(`.wui-chat-body`)??H7(t)}function ae(e){re()?.classList.toggle(`wui-chat--scrolled`,e.scrollTop>0),B7(e)&&(f.hidden=!0)}function M(){p!==null&&(m=B7(p),ae(p))}function oe(e){n.nextElementSibling!==f&&n.parentNode&&n.after(f),e!==p&&(p?.removeEventListener(`scroll`,M),p=e,e.addEventListener(`scroll`,M,{passive:!0}),!h&&typeof ResizeObserver==`function`&&(h=new ResizeObserver(()=>{m&&p&&(p.scrollTop=p.scrollHeight)}),h.observe(t)))}d.addEventListener(`click`,()=>{let e=ie(),t=y?.context.reduced===!0;e?.scrollTo({top:e.scrollHeight,behavior:t?`auto`:`smooth`}),f.hidden=!0,d.blur()});function se(e,t){let n=e.messages[e.messages.length-1],r=n?`${n.id}|${n.parts.length}|${rr(n.parts).length}`:``;if(r===v)return;let i=v===``||e.conversationId!==g;v=r,g=e.conversationId;let a=ie();a&&(oe(a),i||t||n!==void 0&&F7.has(n.author.kind)?(a.scrollTop=a.scrollHeight,f.hidden=!0,m=!0):(f.hidden=!1,m=!1),ae(a))}function ce(e,a){y={state:e,context:a};let{labels:l}=a;n.setAttribute(`aria-label`,l.thread),d.textContent=l.newMessages??`New messages`;let f=ie();f&&oe(f);let p=f===null||f.clientHeight===0||B7(f),m=[],h=new Set,g=e.messages.filter(e=>!(e.streaming&&e.parts.length===0)),v=g[0],b=v!==void 0&&F7.has(v.author.kind)&&e.greeting?e.greeting:null,x=null,S=e=>{let t=nr(e.createdDateTimeUtc,l);t!==x&&(x=t,m.push(J7(t)))};b&&v&&(S(v),u.textContent=b,m.push(c)),g.forEach((t,n)=>{let r=k(t);h.add(t.id),S(t);let i=g[n-1]??(b?R7:null);j(r,t,e,a,n===g.length-1,i),m.push(r.li)});for(let e of[..._.keys()])h.has(e)||_.delete(e);e.agentTyping&&m.push(_4(e.agentTyping,l)),e.thinking?(clearTimeout(s),s=void 0,i.classList.remove(`wui-chat-message--leaving`),o=!0,r.update({active:!0,style:a.loaderStyle,steps:e.steps,phrases:a.phrases,intervalMs:a.intervalMs,reduced:a.reduced,announce:a.assistantName?.trim()?l.preparingAnswer(a.assistantName):void 0}),m.push(i)):o&&s===void 0&&!W7(a)?(i.classList.add(`wui-chat-message--leaving`),s=setTimeout(()=>{s=void 0,o=!1,i.classList.remove(`wui-chat-message--leaving`),r.update({active:!1}),y&&ce(y.state,y.context)},L7),m.push(i)):s===void 0?(o=!1,r.update({active:!1})):m.push(i),!e.streaming&&(e.turnError||e.stopped)&&m.push(ne(e,a)),T(t,m),se(e,p)}function le(e){return _.get(e)?.li??null}function ue(){clearTimeout(s),r.destroy(),p?.removeEventListener(`scroll`,M),h?.disconnect(),_.clear(),y=null,n.remove()}return{el:n,paint:ce,find:le,destroy:ue}}var X7=`wchat:auto-opened`,Z7=`wchat:dismissed`,Q7=`button, a[href], input, select, textarea`,$7=`input, textarea`;function e9(e){return!e.closest(`.wui-chat`)}function t9(e){return e instanceof Element&&e.matches($7)&&e9(e)}function n9(){return[...document.querySelectorAll($7)].some(e=>e9(e)&&e.value!==e.defaultValue)}function r9(e){return e.length!==0&&[...document.querySelectorAll(e.join(`,`))].some(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0})}function i9(e){return e?[...document.querySelectorAll(Q7)].some(t=>{if(!e9(t))return!1;let n=t.getBoundingClientRect();return n.width===0||n.height===0?!1:n.left<e.right&&n.right>e.left&&n.top<e.bottom&&n.bottom>e.top}):!1}function a9(e,t,n){if(e.oncePerSession&&sessionStorage.getItem(X7)||e.rememberDismissal&&sessionStorage.getItem(Z7)||window.innerWidth<e.skipBelowWidthPx)return!0;let r=window.location.pathname;if(e.skipPathPrefixes.some(e=>r.startsWith(e)))return!0;let i=t.avoid.autoOpenOptOutSelector;return i&&document.querySelector(i)||e.skipWhenFormTouched&&n9()||n.isOpen()?!0:e.skipWhenCoversControl&&i9(n.panelRect())}function o9(e){return t9(document.activeElement)||r9(e.avoid.menuSelectors)||r9(e.avoid.autoOpenBusySelectors)}function s9(e,t,n){let r;function i(){r=void 0,a9(e,t,n)||(o9(t)?r=setTimeout(i,e.busyRetrySeconds*1e3):(sessionStorage.setItem(X7,`1`),n.open()))}return r=setTimeout(i,e.delaySeconds*1e3),{cancel(){clearTimeout(r),r=void 0}}}var c9=.4,l9=20;function u9(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function d9(e){let t=e.match(/[\d.]+/g);if(!t||t.length<3)return null;let[n=0,r=0,i=0]=t.slice(0,3).map(Number);return{r:n,g:r,b:i,alpha:t.length>3?Number(t[3])/(e.includes(`%`)?100:1):1}}function f9({r:e,g:t,b:n}){return .2126*u9(e)+.7152*u9(t)+.0722*u9(n)}function p9(e,t){let n=e.getBoundingClientRect(),r=document.elementsFromPoint?.(n.left+n.width/2,n.top+n.height/2)??[],i=t.length?t.join(`,`):null;for(let t of r){if(e.contains(t))continue;if(i&&t.closest(i))return!0;let n=d9(getComputedStyle(t).backgroundColor);if(n&&n.alpha>0)return f9(n)<c9}return!1}function m9(e){return e.length===0?[]:[...document.querySelectorAll(e.join(`,`))]}function h9(e){let t=0;for(let n of e){let e=n.getBoundingClientRect();e.height!==0&&(t=Math.max(t,window.innerHeight-e.top))}return t>0?t+l9:0}function g9(e){if(e.length===0)return!1;for(let t of document.querySelectorAll(e.join(`,`))){let e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return!0}return!1}function _9(e,t,n){let r=n.ownerDocument.documentElement,i=0,a=!1,o=null;function s(){i=0;let s=t.liftAboveFooter?m9(e.liftSelectors):[];if(o)for(let e of s)o.observe(e);n.style.setProperty(`--wui-chat-lift`,`${h9(s)}px`);let c=n.getBoundingClientRect(),l=c.height===0?0:Math.round(window.innerHeight-c.top);r.style.setProperty(`--wui-chat-launcher-block`,`${l}px`);let u=t.stepAsideForMenus&&g9(e.menuSelectors);u&&!a?(n.dataset.launcher=`hidden`,n.inert=!0,a=!0):!u&&a&&(n.dataset.launcher=`idle`,n.inert=!1,a=!1);let d=t.switchOnDark&&p9(n,e.darkSelectors);d&&n.dataset.onDark===void 0&&(n.dataset.onDark=``),!d&&n.dataset.onDark!==void 0&&delete n.dataset.onDark}function c(){i||=requestAnimationFrame(s)}typeof ResizeObserver==`function`&&(o=new ResizeObserver(c));let l=new MutationObserver(c);return l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`,`open`,`data-menu-open`]}),document.addEventListener(`scroll`,c,{capture:!0,passive:!0}),window.addEventListener(`resize`,c),window.addEventListener(`load`,c),n.addEventListener(`animationend`,c),c(),{destroy(){i&&cancelAnimationFrame(i),i=0,o?.disconnect(),l.disconnect(),document.removeEventListener(`scroll`,c,{capture:!0}),window.removeEventListener(`resize`,c),window.removeEventListener(`load`,c),n.removeEventListener(`animationend`,c),a&&=(n.inert=!1,!1),delete n.dataset.onDark,n.style.removeProperty(`--wui-chat-lift`),r.style.removeProperty(`--wui-chat-launcher-block`)}}}var v9=`wchat:session-start`,y9=`wchat:pages`,b9=`wchat:services`;function x9(e){let t=sessionStorage.getItem(e);return t?JSON.parse(t):[]}function S9(e,t){sessionStorage.setItem(e,JSON.stringify(t))}function C9(e,t){let n=t.find(t=>e.startsWith(t));return n===void 0?null:e.slice(n.length).replace(/^\/+|\/+$/g,``)||null}function w9(e){sessionStorage.getItem(v9)||sessionStorage.setItem(v9,String(Date.now()));let t=0;function n(){let e=document.documentElement.scrollHeight;if(e<=0)return;let n=(window.scrollY+window.innerHeight)/e*100;n>t&&(t=n)}return window.addEventListener(`scroll`,n,{passive:!0}),function(){n();let r=window.location.pathname,i=x9(y9);i.includes(r)||(i.push(r),S9(y9,i));let a=C9(r,e),o=x9(b9);return a!==null&&(o=o.filter(e=>e!==a),o.push(a),o=o.slice(-10),S9(b9,o)),{timeOnSiteSeconds:Math.floor((Date.now()-Number(sessionStorage.getItem(v9)))/1e3),scrollPercent:Math.min(100,Math.floor(t)),pagesViewed:i.length,viewedServices:o}}}var Aee=`a[href],button:not([disabled]),input:not([disabled]):not([type='hidden']),select:not([disabled]),textarea:not([disabled]),[tabindex]`;function jee(e,t){if(t.key!==`Tab`)return;let n=[...e.querySelectorAll(Aee)].filter(e=>e.tabIndex>=0&&!e.hidden),r=n[0],i=n[n.length-1];if(!r||!i){t.preventDefault();return}let a=e.ownerDocument.activeElement,o=e.contains(a);t.shiftKey?o&&a!==r||(t.preventDefault(),i.focus()):o&&a!==i||(t.preventDefault(),r.focus())}function Mee(e){e?.isConnected&&e.focus()}function Nee(e,t){if(t||typeof navigator>`u`)return;let n=navigator;typeof n.vibrate==`function`&&n.vibrate(e)}var T9=`wui-chat-lock`,E9=`wui-chat-scroll-lock`;function Pee(e){let t=e.ownerDocument,n=[t.documentElement,t.body],r=e.style.overscrollBehavior;for(let e of n)e.classList.add(T9);e.setAttribute(`data-lenis-prevent`,``),e.style.overscrollBehavior=`contain`,window.dispatchEvent(new CustomEvent(E9,{detail:{locked:!0}}));let i=!0;return function(){if(i){i=!1;for(let e of n)e.classList.remove(T9);e.removeAttribute(`data-lenis-prevent`),e.style.overscrollBehavior=r,window.dispatchEvent(new CustomEvent(E9,{detail:{locked:!1}}))}}}var Fee={open:{from:420,to:920,seconds:.16,peak:.16},reply:{from:680,to:540,seconds:.11,peak:.06},sent:{from:540,to:760,seconds:.09,peak:.05}},D9=[`pointerdown`,`keydown`,`touchstart`],O9=`wchat:muted`,Iee=1e-4;function Lee(e,t){let n=t.get(O9)===`1`,r=null;function i(){for(let e of D9)document.removeEventListener(e,a)}function a(){let e=globalThis.AudioContext||globalThis.webkitAudioContext;!r&&e&&(r=new e),r?.state===`suspended`&&r.resume().catch(e=>globalThis.reportError?.(e)),i()}for(let e of D9)document.addEventListener(e,a);return{play(t){let i=Fee[t];if(!i||n||!r||!e[t]||!(e.volume>0))return;let a=r.currentTime,o=r.createOscillator(),s=r.createGain();o.type=`sine`,o.frequency.setValueAtTime(i.from,a),o.frequency.linearRampToValueAtTime(i.to,a+i.seconds),s.gain.setValueAtTime(i.peak*e.volume,a),s.gain.exponentialRampToValueAtTime(Iee,a+i.seconds),o.connect(s),s.connect(r.destination),o.start(a),o.stop(a+i.seconds)},setMuted(e){n=!!e,t.set(O9,n?`1`:`0`)},isMuted(){return n},destroy(){i(),r?.close().catch(e=>globalThis.reportError?.(e)),r=null}}}var Ree=2e3,zee=500,Bee=32,k9=16,A9=`data-wchat-switching`;function Vee(e){return new Promise(t=>setTimeout(t,e))}function j9(e,t){return typeof e!=`function`||e()?Promise.resolve():new Promise(n=>{let r=0,i=()=>{e()||r>=t?n():(r+=k9,setTimeout(i,k9))};setTimeout(i,k9)})}async function Hee(e,t={}){let n=t.reduced??globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;if(typeof document.startViewTransition!=`function`||n){await e();return}let r=document.documentElement;r.setAttribute(A9,``);try{let n=()=>!t.target||document.querySelector(`.wui-chat--${t.target}`)!==null,r=()=>(typeof t.pageReady!=`function`||t.pageReady())&&n(),i=document.startViewTransition(async()=>{await e(),await j9(t.routeReady,Ree),await j9(r,zee),await Vee(Bee)});Promise.allSettled([i.ready]);try{await i.updateCallbackDone}finally{await Promise.allSettled([i.finished])}}finally{r.removeAttribute(A9)}}var Uee=100,Wee=12,Gee=220,Kee=640;function M9(e,t){let n=t.phone.mode===`Sheet`,r=window.visualViewport,i;function a(){e.style.removeProperty(`bottom`),e.style.removeProperty(`max-height`)}function o(){if(i=void 0,window.innerWidth>t.phone.maxWidthPx){a();return}if(!r)return;let o=Math.max(0,window.innerHeight-r.height-r.offsetTop),s=r.height-Wee;n&&(s=Math.min(Kee,Math.max(Gee,s))),e.style.bottom=`${o}px`,e.style.maxHeight=`${s}px`}function s(){clearTimeout(i),i=setTimeout(o,Uee)}return r?.addEventListener(`resize`,s),r?.addEventListener(`scroll`,s),window.addEventListener(`resize`,s),window.addEventListener(`orientationchange`,s),o(),{destroy(){clearTimeout(i),r?.removeEventListener(`resize`,s),r?.removeEventListener(`scroll`,s),window.removeEventListener(`resize`,s),window.removeEventListener(`orientationchange`,s),a()}}}var N9=[`launcher`,`docked`,`full-page`,`embedded`],P9=[`end`,`start`],F9={steps:`Steps`,phrases:`Phrases`,orb:`Orb`,skeleton:`Skeleton`},qee={on:`On`,reduced:`Reduced`},Jee=[`auto`,`light`,`dark`];function Yee(e){return Jee.find(t=>t===e)??`auto`}var Xee=`wchat:muted`,Zee=6e4,Qee=400,$ee=[`labels`,`pageContext`,`compact`,`expressive`,`open`,`layoutParts`,`getCaptchaToken`,`attribution`,`openAttachment`,`openCitation`,`openTarget`,`openTicket`,`onNavigate`,`resolveLink`,`emptyContent`,`onPanelSwitch`,`preloadPanelSwitch`],I9={...x8};function L9(e,t){if(!r4.includes(e))throw Error(`Unknown part kind "${e}". Use one of ${r4.join(`, `)}.`);if(typeof t!=`string`||!t.includes(`-`))throw Error(`Renderer tag "${t}" must be a custom element name containing a hyphen.`)}function ete(e,t){L9(e,t),I9[e]=t}function R9(e,t){return n=>{let r=n.toLowerCase(),i=Y2(t,r)?t[r]:void 0;if(i===void 0)throw Error(`<wui-chat ${e}> must be one of ${Object.keys(t).join(`, `)}, got "${n}".`);return i}}function z9(e){return t=>{let n=Number(t);if(!Number.isInteger(n)||n<0)throw Error(`<wui-chat ${e}> must be a whole number of pixels, got "${t}".`);return n}}function B9(e){return t=>{if(t===``||t===`true`)return!0;if(t===`false`)return!1;throw Error(`<wui-chat ${e}> must be true or false, got "${t}".`)}}var V9=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),H9=[[`launcher-style`,`launcher`,`style`,R9(`launcher-style`,{round:`Round`,pill:`Pill`})],[`entrance`,`launcher`,`entrance`,R9(`entrance`,{"slide-up":`SlideUp`,"bounce-in":`BounceIn`,"fade-in-pulse":`FadeInPulse`,"spin-scale":`SpinScale`,"wiggle-in":`WiggleIn`,"elastic-in":`ElasticIn`,rise:`Rise`,none:`None`})],[`idle`,`launcher`,`idle`,R9(`idle`,{"float-and-pulse":`FloatAndPulse`,ring:`Ring`,none:`None`})],[`label-reveal`,`launcher`,`labelReveal`,R9(`label-reveal`,{bubble:`Bubble`,expand:`Expand`})],[`compact`,`launcher`,`compact`,B9(`compact`)],[`launcher-mark`,`launcher`,`mark`,R9(`launcher-mark`,{icon:`Icon`,avatar:`Avatar`,orb:`Orb`})],[`panel-height`,`panel`,`height`,R9(`panel-height`,{fixed:`Fixed`,content:`Content`})],[`reply-avatars`,`panel`,`replyAvatars`,B9(`reply-avatars`)],[`greeting-loader-ms`,`panel`,`greetingLoaderMs`,z9(`greeting-loader-ms`)],[`panel-motion`,`panel`,`motion`,R9(`panel-motion`,{spring:`Spring`,gentle:`Gentle`,none:`None`})],[`panel-width`,`panel`,`widthPx`,z9(`panel-width`)],[`panel-max-height`,`panel`,`maxHeightPx`,z9(`panel-max-height`)],[`panel-bottom-gap`,`panel`,`bottomGapPx`,z9(`panel-bottom-gap`)],[`phone-max-width`,`phone`,`maxWidthPx`,z9(`phone-max-width`)],[`phone-mode`,`phone`,`mode`,R9(`phone-mode`,{"full-screen":`FullScreen`,sheet:`Sheet`})],[`sheet-height-dvh`,`phone`,`sheetHeightDvh`,z9(`sheet-height-dvh`)],[`sheet-max-height`,`phone`,`sheetMaxHeightPx`,z9(`sheet-max-height`)],[`input-ring`,`input`,`ring`,B9(`input-ring`)],[`send-reveal`,`input`,`sendReveal`,R9(`send-reveal`,{"on-text":`OnText`,always:`Always`})],[`send-icon`,`input`,`sendIcon`,e=>e],[`lift-selectors`,`avoid`,`liftSelectors`,V9],[`menu-selectors`,`avoid`,`menuSelectors`,V9],[`dark-selectors`,`avoid`,`darkSelectors`,V9],[`autoopen-busy-selectors`,`avoid`,`autoOpenBusySelectors`,V9],[`autoopen-optout-selector`,`avoid`,`autoOpenOptOutSelector`,e=>e]],U9={layout:`launcher`,position:`end`,"offset-x":`24`,"offset-y":`24`,loader:`steps`,motion:`on`,icon:`chat`},W9=[`base`,`layout`,`position`,`offset-x`,`offset-y`,`loader`,`screen`,`motion`,`theme`,`icon`,`avatar`,`narrow`,...H9.map(([e])=>e).filter(e=>e!==`compact`)],tte=e=>e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase());function G9(e){let t={launcher:{},panel:{},phone:{},input:{},avoid:{}};for(let[n,r,i,a]of H9){let o=e.getAttribute(n);o!=null&&(t[r][i]=a(o))}let n=e.getAttribute(`motion`),r=e.getAttribute(`avatar`),i=e.getAttribute(`expressive`);return Sr({...t,...n==null?{}:{motion:R9(`motion`,qee)(n)},...r?{avatar:r}:{},...i==null?{}:{expressive:B9(`expressive`)(i)}})}function nte(e){let t=e.getAttribute(`loader`)??`steps`,n=Y2(F9,t)?F9[t]:void 0;if(n===void 0)throw Error(`<wui-chat loader> must be one of ${Object.keys(F9).join(`, `)}, got "${t}".`);return n}function rte(e){let t=e.getAttribute(`narrow`);if(t!=null&&t!==``)return Object.fromEntries(V9(t).map(e=>[e,!1]))}function K9(e){return e===Xee?globalThis.localStorage:globalThis.sessionStorage}var q9={get:e=>K9(e).getItem(e),set:(e,t)=>K9(e).setItem(e,t)};function J9(e){return globalThis.innerWidth<=e.phone.maxWidthPx}function ite(e){let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)}function ate(e){return e.features.HumanHandoff===!0&&e.conversationState===`Open`&&e.messages.some(e=>e.author.kind===`Visitor`||e.author.kind===`Customer`)&&!e.streaming&&!e.thinking}function ote(e,t){if(e.conversationState===`WaitingForAgent`)return t.statusWaitingForAgent;if(e.conversationState===`WithAgent`){let n=e.agent?.displayName;return t.statusWithAgent(typeof n==`string`&&n.trim()!==``?n:t.handoffAgentFallback)}return t.headerStatus}function Y9(e,t,n){return t.PanelSwitch!==!0||typeof n!=`function`?null:e===`docked`?`full-page`:e===`full-page`?`docked`:null}function ste(e){if(!N9.some(t=>t===e))throw Error(`<wui-chat layout> must be one of ${N9.join(`, `)}, got "${e}".`)}function X9(e){if(!P9.some(t=>t===e))throw Error(`<wui-chat position> must be one of ${P9.join(`, `)}, got "${e}".`)}function cte(e,t){let n=e[t];delete e[t],e[t]=n}function lte(e){return e==null?{}:Object(e)}var Z9=0,Q9=class extends va{static get observedAttributes(){return[...W9,`compact`,`expressive`,`open`,`labels`,`page-context`,`narrow`].filter((e,t,n)=>n.indexOf(e)===t)}constructor(){super(),Z9+=1,this._uid=`wui-chat-${Z9}`,this._built=!1,this._session=null,this._unsubscribe=null,this._voice=null,this._voiceConversationId=void 0,this._labelsProp=void 0,this._pageContextProp=void 0,this._layoutParts=null,this._renderers={...I9},this._rendererApi={define:(e,t)=>{L9(e,t),this._renderers[e]=t,this._render()},map:this._renderers},this._captchaToken=null,this._attribution=null,this._openAttachmentProp=null,this._openCitationProp=null,this._openTargetProp=null,this._resolveLinkProp=null,this._openTicketProp=void 0,this._emptyContentProp=null,this._onPanelSwitchProp=null,this._preloadPanelSwitchProp=null,this._preloaded=!1,this._pastList=null,this._past=null,this._pastRefreshed=!1,this._historyShown=!1,this._openedConversation=null,this._lastOpen=!1,this._openTrigger=`manual`,this._focusTimer=null,this._nudgeArmed=!1,this._seeded=!1,this._wasLoading=!1,this._seen=new Set,this._sound=null,this._behaviour=null,this._autoOpen=null,this._avoid=null,this._motion=null,this._phone=null,this._requesting=!1,this._onKeyDown=e=>{e.key===`Escape`&&this._session?.getState().open&&(e.stopPropagation(),this._session.close(`escape`))}}get session(){return this._session??null}get conversationId(){return this._session?.getState().conversationId??null}get labels(){return oe({...lte(e4(this,`labels`)),...this._labelsProp})}set labels(e){this._labelsProp=e??void 0,this._render()}get pageContext(){return this._pageContextProp===void 0?e4(this,`page-context`):this._pageContextProp}set pageContext(e){this._pageContextProp=e===null?void 0:e}get compact(){let e=this.getAttribute(`compact`);return e!=null&&B9(`compact`)(e)}set compact(e){this.toggleAttribute(`compact`,e===!0||e===``||e===`true`)}get expressive(){let e=this.getAttribute(`expressive`);return e!=null&&B9(`expressive`)(e)}set expressive(e){this.toggleAttribute(`expressive`,e===!0||e===``||e===`true`)}get open(){return this.hasAttribute(`open`)}set open(e){this.toggleAttribute(`open`,e===!0||e===``||e===`true`)}get renderers(){return this._rendererApi}get layoutParts(){return this._layoutParts}set layoutParts(e){this._layoutParts=typeof e==`function`?e:null,this._render()}get getCaptchaToken(){return this._captchaToken}set getCaptchaToken(e){this._captchaToken=typeof e==`function`?e:null}get attribution(){return this._attribution}set attribution(e){this._attribution=typeof e==`function`?e:null}get openAttachment(){return this._openAttachmentProp??(e=>this._defaultOpenAttachment(e))}set openAttachment(e){this._openAttachmentProp=typeof e==`function`?e:null}get openCitation(){return this._openCitationProp??((e,t)=>this._defaultOpenCitation(e,t))}set openCitation(e){this._openCitationProp=typeof e==`function`?e:null}get openTarget(){return this._openTargetProp??(e=>this._defaultOpenTarget(e))}set openTarget(e){this._openTargetProp=typeof e==`function`?e:null}get openTicket(){return this._openTicketProp}set openTicket(e){this._openTicketProp=typeof e==`function`?e:void 0}get onNavigate(){return this._onNavigateProp}set onNavigate(e){this._onNavigateProp=typeof e==`function`?e:void 0}get resolveLink(){return this._resolveLinkProp}set resolveLink(e){this._resolveLinkProp=typeof e==`function`?e:null}get emptyContent(){return this._emptyContentProp}set emptyContent(e){if(e!==null&&!(e instanceof Node))throw TypeError(`emptyContent must be a Node or null`);this._emptyContentProp=e,this._applyEmptyContent()}get onPanelSwitch(){return this._onPanelSwitchProp}set onPanelSwitch(e){this._onPanelSwitchProp=typeof e==`function`?e:null}get preloadPanelSwitch(){return this._preloadPanelSwitchProp}set preloadPanelSwitch(e){this._preloadPanelSwitchProp=typeof e==`function`?e:null}connectedCallback(){this._adoptEarlyProperties();let e=this._assertLayout();if(this._assertPosition(),this.base.trim()===``)throw TypeError(`<wui-chat> needs a base path, e.g. base="/api/assistant".`);this._built||this._build(),this._shell||this._buildShell(e),this._session||this._createSession(),this._past||this._createPast(),this._unsubscribe||=this.requireSession().subscribe(()=>this._render()),this._render()}_adoptEarlyProperties(){for(let e of $ee)Y2(this,e)&&cte(this,e)}disconnectedCallback(){this._voice?.stop(),this._session?.stop(),this._unsubscribe?.(),this._unsubscribe=null,this._disposePast(),this._shell?.destroy?.(),document.removeEventListener(`keydown`,this._onKeyDown),this._avoid?.destroy(),this._avoid=null,this._autoOpen?.cancel(),this._autoOpen=null,this._motion?.destroy(),this._motion=null}attributeChangedCallback(e,t,n){if(this._built&&t!==n){if(e===`layout`)this._buildShell(this._assertLayout());else if(e===`position`)this._assertPosition();else if(e===`base`||e===`screen`||e===`narrow`)this._resetSession();else if(e===`motion`)this._motion?.destroy(),this._motion=null;else if(e===`open`&&this._session){let e=this._session.getState().open;this.open!==e&&this._setOpen(this.open,`manual`)}this._render()}}toggle(){this._session&&(this._session.getState().open?this._session.close(`button`):this._setOpen(!0,`manual`))}close(){this._voice?.stop(),this._session?.close(`button`)}newConversation(){this._voice?.stop(),this._session?.newConversation(),this._past?.refresh()}reset(){this._voice?.stop(),this._session?.reset()}_setOpen(e,t){this._session&&(e?(this._openTrigger=t,this._session.open({trigger:t})):this._session.close(`button`))}_assertLayout(){let e=this.layout;return ste(e),e}_assertPosition(){X9(this.position)}get _position(){let e=this.position;return X9(e),e}_isLauncherLike(){return this.layout===`launcher`||this.layout===`docked`}requireSession(){if(!this._session)throw TypeError(`wui-chat: _session is not ready; the element is not connected`);return this._session}requireVoice(){if(!this._voice)throw TypeError(`wui-chat: _voice is not ready; the element is not connected`);return this._voice}requireMotion(){if(!this._motion)throw TypeError(`wui-chat: _motion is not ready; the element is not connected`);return this._motion}requirePastList(){if(!this._pastList)throw TypeError(`wui-chat: _pastList is not ready; the element is not connected`);return this._pastList}requireNudgeHost(){if(!this._shell.nudgeHost)throw TypeError(`wui-chat: the launcher shell has no nudge host`);return this._shell.nudgeHost}_build(){this._built=!0,this._header=o5({onNew:()=>this.newConversation(),onHistory:()=>this._toggleHistory(),onClose:()=>this.close(),onMute:()=>{this._session&&this._session.setMuted(!this._session.getState().muted)},onSwitch:()=>this._switchPanel(),titleId:`${this._uid}-title`}),this._starters=_7({onStarter:e=>this.requireSession().submit(e.message),onResume:()=>this.requireSession().resumeLast(),onTicket:e=>{typeof this.openTicket==`function`&&this.openTicket({ticketId:e.ticketId,number:e.number})}}),this._applyEmptyContent(),this._voice=K8({getState:()=>this.requireSession().getState(),getToken:()=>this.requireSession().client.getSpeechToken()}),this._voice.subscribe(()=>this._render()),this._thread=Y7({getRenderers:()=>this._renderers,getLayoutParts:()=>this._layoutParts,makeTurnApi:e=>this._makeTurnApi(e),onRetry:()=>this.requireSession().retry(),onRegenerate:()=>this.requireSession().regenerate(),onRate:(e,t)=>this.requireSession().rate(e,t),getSession:()=>this.requireSession(),getVoice:()=>this._voice}),this._composer=e5({voice:this._voice,onSubmit:e=>this.requireSession().submit(e),onStop:()=>this.requireSession().stop(),onAttach:e=>this.requireSession().attach(e),onRemove:e=>this.requireSession().removeAttachment(e),onCancelEdit:()=>this.requireSession().cancelEdit(),onTyping:()=>this.requireSession().notifyTyping(),onDraftApplied:()=>this.requireSession().consumeDraft()}),this._footer=i5(),this._history=l5({getClient:()=>this.requireSession().client,getLabels:()=>this.labels,getFeatures:()=>this.requireSession().getState().features,onOpen:e=>{Promise.allSettled([this.requireSession().openConversation(e)]),this._toggleHistory(!1)},onDeleted:e=>{e===this.conversationId&&this.requireSession().newConversation()}}),this._nudge=h5({onActivate:()=>this._setOpen(!0,`manual`),onDismiss:()=>{}}),this._status=$(`p`,null,{role:`status`}),this._status.hidden=!0,this._errorEl=$(`p`,`wui-chat-profile-error`,{role:`alert`}),this._errorEl.hidden=!0,this._liveStatus=$(`p`,`wui-chat-live-status`,{role:`status`}),this._liveStatus.hidden=!0,this._talk=$(`button`,`${Z2(`outline`,`sm`)} wui-chat-handoff-request`,{type:`button`}),this._talk.addEventListener(`click`,()=>this._requestHandoff()),this._liveRetry=$(`button`,Z2(`ghost`,`sm`),{type:`button`}),this._liveRetry.addEventListener(`click`,()=>this.requireSession().resumeLive()),this._liveError=$(`p`,`wui-chat-live-error`,{role:`alert`}),this._liveError.hidden=!0,this._live=$(`div`,`wui-chat-live`),this._live.append(this._liveStatus,this._talk,this._liveRetry,this._liveError),this._live.hidden=!0,this._body=$(`div`,`wui-chat-body`),this._body.append(this._starters.el,this._thread.el,this._live,this._history.el,this._status,this._errorEl),this._foot=$(`div`,`wui-chat-foot`),this._foot.append(...this._composer.nodes,this._footer.el)}_buildShell(e){let t={launcher:u7,docked:a7,"full-page":d7,embedded:o7};this._shell?.destroy?.(),this._avoid?.destroy(),this._avoid=null,this._autoOpen?.cancel(),this._autoOpen=null,this._lastOpen=!1,this._launcherPlayed=!1;let n=t[e]({id:`${this._uid}-panel`,position:this._position,onToggle:()=>this.toggle()});n.panel.append(this._header.el,this._body,this._foot),n.panel.setAttribute(`aria-labelledby`,`${this._uid}-title`),n.panel.addEventListener(`keydown`,e=>{e.key===`Tab`&&jee(n.panel,e)}),n.nudgeHost&&n.nudgeHost.prepend(this._nudge.el),this._shell=n,this.replaceChildren(n.root)}_createSession(){let e=zt(m5(),{base:this.base}),t=rte(this);this._session=Zr(e,{...this.screen?{screen:this.screen}:{},...t===void 0?{}:{narrow:t},pageContext:()=>this.pageContext,attribution:()=>this._attribution?.()??null,behaviour:()=>this._session?.getState().features.BehaviourStarters?this._behaviour?.()??null:null,prefs:q9,reducedMotion:()=>this._motion?.reduced??!1,schedule:ite,getCaptchaToken:e=>{if(this._captchaToken)return this._captchaToken(e);let t=this._session?.getState().profile?.captcha?.siteKey;return t?O5(t,e):Promise.resolve(null)},onEvent:(e,t)=>{this.dispatchEvent(new CustomEvent(`wui-chat-event`,{bubbles:!0,detail:{name:e,data:t}}))},onError:()=>{},labels:this.labels}),this._unsubscribe=null,this._lastOpen=!1,this._openApplied=!1,this._seeded=!1,this._wasLoading=!1,this._seen=new Set,this._pastRefreshed=!1}_createPast(){this._pastList=Ht({client:this.requireSession().client,pageSize:20}),this._past=C5({list:this._pastList,getLabels:()=>this.labels,getFeatures:()=>this.requireSession().getState().features,onOpen:e=>{Promise.allSettled([this.requireSession().openConversation(e)])}}),this._starters.pastHost.append(this._past.el)}_disposePast(){this._past&&(this._past.el.remove(),this._past.dispose(),this.requirePastList().dispose(),this._past=null,this._pastList=null)}_applyEmptyContent(){if(!this._starters)return;let e=this._starters.extraHost;e.replaceChildren(...this._emptyContentProp?[this._emptyContentProp]:[]),e.hidden=!this._emptyContentProp}_switchPanel(){let e=this.requireSession().getState(),t=this._onPanelSwitchProp,n=Y9(this.layout,e.features,t);if(t===null||n===null)return;n===`full-page`&&this.close();let r={from:this.layout,to:n,conversationId:e.conversationId,draft:this._composer.getDraft()};Hee(()=>t.call(this,r),{target:n,reduced:this._motion?.reduced===!0}).then(()=>document.querySelector(`.wui-chat--${n} .wui-chat-input`)?.focus()).catch(e=>globalThis.reportError?.(e))}async _requestHandoff(){this._requesting=!0,this._liveError.hidden=!0,this._render();try{await this.requireSession().requestHandoff()}catch(e){let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;this._liveError.textContent=typeof t==`string`&&t||this.labels.errorGeneric,this._liveError.hidden=!1}finally{this._requesting=!1,this._render()}}_paintLive(e,t,n){let r=e.live===`Lost`,i=ate(e);this._liveStatus.hidden=!r,this._liveStatus.textContent=r?t.liveLost:``,this._liveRetry.hidden=!r,this._liveRetry.textContent=t.retry,this._talk.hidden=!i,this._talk.textContent=t.talkToPerson,this._talk.disabled=this._requesting,this._live.hidden=n||!r&&!i}_resetSession(){this._voice?.stop(),this._unsubscribe?.(),this._unsubscribe=null,this._session?.dispose(),this._session=null,this._disposePast(),this._history.dispose(),this.isConnected&&(this._createSession(),this._createPast(),this._unsubscribe=this.requireSession().subscribe(()=>this._render()))}_toggleHistory(e=!this._historyShown){this._historyShown=e,e?this._history.show():this._history.hide(),this._render()}_makeTurnApi(e){let t=$r(this.requireSession(),{messageId:e,labels:this.labels,openAttachment:e=>this.openAttachment(e),openCitation:t=>this.openCitation(e,t),openTarget:e=>this.openTarget(e),openTicket:this.openTicket,onNavigate:this.onNavigate});return t.resolveLink=this.resolveLink,t}_defaultOpenAttachment(e){this.requireSession().client.getAttachment(e.attachmentId).then(t=>{let n=URL.createObjectURL(new Blob([t],{type:e.contentType}));window.open(n,`_blank`,`noopener`),setTimeout(()=>URL.revokeObjectURL(n),Zee)}).catch(e=>globalThis.reportError?.(e))}_defaultOpenCitation(e,t){let n=this._thread.find(e);if(n){for(let e of n.querySelectorAll(`[data-marker]`))if(e.dataset.marker===String(t)){e.focus();return}}}_defaultOpenTarget(e){/^https?:\/\//i.test(e)?window.open(e,`_blank`,`noopener`):window.location.assign(e)}_render(){this._built&&this._session&&this._paint(this._session.getState())}_paint(e){e.conversationId!==this._voiceConversationId&&(this._voiceConversationId=e.conversationId,this.requireVoice().stop());let t=this.labels,n=e.profile,r=this._isLauncherLike();if(!n){this.hidden=r,this._header.el.hidden=!0,this._starters.el.hidden=!0,this._thread.el.hidden=!0,this._history.el.hidden=!0,this._foot.hidden=!0,this._errorEl.hidden=e.profileError==null,e.profileError&&(this._errorEl.textContent=e.profileError.message),this._status.hidden=e.profileError!=null,this._status.textContent=t.loadingConversation,this._shell.panel.setAttribute(`aria-busy`,String(e.profileError==null));return}if(this._shell.panel.removeAttribute(`aria-busy`),!e.features.VisitorChat){this.hidden=!0,this._status.hidden=!0;return}this.hidden=!1;let i=e.features,a=G9(this);this._ensureRuntime(e,n,a,t);let o=e.loading,s=e.loadError,c=e.messages.length===0&&!o,l=this._historyShown&&i.History===!0,u=e.messages.some(e=>e.author.kind===`Visitor`||e.author.kind===`Customer`),d=Y9(this.layout,i,this._onPanelSwitchProp),f=e.streaming||e.thinking;this._header.paint({labels:t,title:n.assistant.name,tagline:n.assistant.tagline,status:ote(e,t),canNew:!f,showNew:this.layout===`full-page`||u,showHistory:i.History,showClose:r||this.layout===`full-page`&&d!==null,switchTo:d,canSwitch:!f,viewingHistory:l,showMute:i.Sounds&&n.experience.sound.muteControl,muted:e.muted}),W5(this._header.conversation,e,{labels:t,features:i,title:n.assistant.name??t.panelTitle,getState:()=>this.requireSession().getState(),iconOnly:!0}),l&&(this._header.conversation.hidden=!0),this._starters.el.hidden=!c||l,c&&e.open&&!this._introPlayed&&a.panel.greetingLoaderMs>0&&!this.requireMotion().reduced&&(this._introPlayed=!0,this._starters.intro(a.panel.greetingLoaderMs)),c&&this._starters.paint({labels:t,greeting:e.greeting,intro:n.assistant.intro,starters:e.starters,showStarters:i.Starters&&!e.streaming,resume:!i.History&&i.ResumeLast?e.lastConversation:null,openTickets:e.openTickets,features:e.features,ticketsClickable:typeof this.openTicket==`function`}),i.History&&!this._pastRefreshed&&(this._pastRefreshed=!0,this._past?.refresh()),this._past?.paint();let p=!c&&!o&&!s&&!l;this._thread.el.hidden=!p,p&&this._thread.paint(e,{labels:t,loaderStyle:nte(this),reduced:this._motion?.reduced??!1,phrases:n.experience.pacing.thinkingPhrases,intervalMs:n.experience.pacing.phraseIntervalMs,assistantName:n.assistant.name}),this._paintLive(e,t,l),this._status.hidden=!o||l,this._status.textContent=t.loadingConversation,this._errorEl.hidden=!s||l,s&&(this._errorEl.textContent=s.message),this._foot.hidden=l,this._composer.paint({state:e,labels:t,maxLength:n.limits.maxMessageLength,accept:n.limits.contentTypes.join(`,`),draft:e.draft??null,sendIcon:a.input.sendIcon}),this._footer.paint({labels:t,profile:n}),this._history.el.hidden=!l,this._syncOpen(e,n,i,t,r),this._syncConversation(e),this._playSounds(e)}_ensureRuntime(e,t,n,r){let i=e.features;this._motion||(this._motion=K2(n,t.experience),this._motion.subscribe(()=>this._render())),i.Sounds&&!this._sound&&(this._sound=Lee(t.experience.sound,q9)),!i.Sounds&&this._sound&&(this._sound=null),i.BehaviourStarters&&!this._behaviour&&(this._behaviour=w9(t.start.behaviour?.servicePathPrefixes??[]));let a=this._isLauncherLike();a&&!this._avoid&&this.layout===`launcher`&&(this._avoid=_9(n.avoid,t.experience.launcher,this.requireNudgeHost())),this.layout===`launcher`&&i.AutoOpen&&!this._autoOpen&&(this._autoOpen=s9(t.experience.autoOpen,n,{open:()=>this._setOpen(!0,`auto`),isOpen:()=>this.requireSession().getState().open,panelRect:()=>this._shell.panel.getBoundingClientRect()}));let o=J9(n);this._shell.setLabels(r),this._shell.setAppearance({position:this._position,offsetX:this.hasAttribute(`offset-x`)?z9(`offset-x`)(this.getAttribute(`offset-x`)??``):void 0,offsetY:this.hasAttribute(`offset-y`)?z9(`offset-y`)(this.getAttribute(`offset-y`)??``):void 0,width:`${n.panel.widthPx}px`,maxHeight:n.panel.maxHeightPx,bottomGap:n.panel.bottomGapPx,reduced:this._motion.reduced,sendReveal:n.input.sendReveal,inputRing:n.input.ring,panelMotion:n.panel.motion,theme:Yee(this.getAttribute(`theme`)),icon:this.icon,launcherStyle:n.launcher.style,compact:n.launcher.compact,labelReveal:n.launcher.labelReveal,entrance:n.launcher.entrance,idle:n.launcher.idle,launcherMark:n.launcher.mark,panelHeight:n.panel.height,replyAvatars:n.panel.replyAvatars,avatar:n.avatar,expressive:n.expressive,phone:o,hoverLabel:t.experience.launcher.hoverLabel,peek:t.experience.launcher.peek,peekSeconds:t.experience.launcher.peekSeconds,hideWhileOpen:t.experience.launcher.hideWhileOpen,phoneMode:n.phone.mode,sheetHeightDvh:n.phone.sheetHeightDvh,sheetMaxHeightPx:n.phone.sheetMaxHeightPx,launcherState:this._launcherPlayed?void 0:`entering`}),this._launcherPlayed=!0,this._shell.root.classList.toggle(`wui-chat--phone`,a&&J9(n))}_syncOpen(e,t,n,r,i){if(i){if(!this._openApplied&&(this._openApplied=!0,this.hasAttribute(`open`)&&!e.open))this._setOpen(!0,`manual`);else if(this._shell.setOpen(e.open),this.toggleAttribute(`open`,e.open),e.open!==this._lastOpen&&(this._lastOpen=e.open,this._onOpenChange(e.open)),e.open)this._nudge.cancel(),this._nudgeArmed=!1,this._autoOpen?.cancel();else if(n.Nudges&&this.layout===`launcher`&&!this._nudgeArmed){let e=Pe(t,n);e&&(this._nudge.schedule({text:e.text,delaySeconds:e.delaySeconds,label:r.nudgeDismiss}),this._nudgeArmed=!0)}}}_onOpenChange(e){let t=J9(G9(this));if(e){if(document.addEventListener(`keydown`,this._onKeyDown),this._sound?.play(`open`),this._past?.refresh(),this.layout===`docked`&&!this._preloaded&&typeof this._preloadPanelSwitchProp==`function`){this._preloaded=!0;let e=this._preloadPanelSwitchProp;Promise.allSettled([new Promise(t=>t(e.call(this)))]).then(e=>{for(let t of e)t.status===`rejected`&&globalThis.reportError?.(t.reason)})}if(t){let e=G9(this);this._phone={fit:M9(this._shell.panel,e),unlock:Pee(this._thread.el)}}else this._openTrigger===`manual`&&(this._focusTimer=setTimeout(()=>{this._focusTimer=null,this._composer.focus()},Qee))}else document.removeEventListener(`keydown`,this._onKeyDown),clearTimeout(this._focusTimer??void 0),this._focusTimer=null,this._phone?.fit.destroy(),this._phone?.unlock(),this._phone=null,this._historyShown&&(this._historyShown=!1,this._history.hide(),this._render()),Mee(this._shell.launcherButton)}_syncConversation(e){let t=this.getAttribute(`conversation-id`);t&&t!==this._openedConversation&&!e.loading&&(this._openedConversation=t,e.conversationId!==t&&Promise.allSettled([this.requireSession().openConversation(t)]))}_playSounds(e){if(e.loading){this._wasLoading=!0;for(let t of e.messages)this._seen.add(t.id)}else if(this._wasLoading||!this._seeded){this._wasLoading=!1,this._seeded=!0;for(let t of e.messages)this._seen.add(t.id)}else for(let t of e.messages)this._seen.has(t.id)||(this._seen.add(t.id),this._announce(t))}_announce(e){if(!this._sound||e.restored||e.parts.some(e=>e.kind===`Notice`))return;let t=e.author.kind;if(t===`Visitor`)e.stored||this._sound.play(`sent`);else if(t===`Assistant`||t===`Script`||t===`Agent`){this._sound.play(`reply`);let e=this.requireSession().getState().profile;e?.experience.sound.vibrate&&Nee(e.experience.sound.vibrateMs,this._sound.isMuted())}}};Object.defineProperty(Q9.prototype,"layout",{get(){return this.getAttribute(`layout`)??U9.layout},set(e){this.setAttribute(`layout`,String(e))}});for(let e of W9)e!==`layout`&&Object.defineProperty(Q9.prototype,tte(e),{configurable:!0,get(){return this.getAttribute(e)??U9[e]??``},set(t){t==null?this.removeAttribute(e):this.setAttribute(e,String(t))}});function $9(){typeof customElements<`u`&&!customElements.get(`wui-chat`)&&customElements.define(`wui-chat`,Q9)}$9(),$9(),globalThis.WeborityChat=Object.assign(globalThis.WeborityChat||{},{session:e=>e.session,renderers:{define:ete}})})();
44
+ `),language:i});continue}if(a6(t,r)){let i=i6(e),a=[];for(r+=2;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||!r6(e))break;a.push(i6(e)),r+=1}n.push({type:`table`,header:i,rows:a});continue}if(Z3.test(e)){n.push({type:`rule`}),r+=1;continue}let i=X3.exec(e);if(i){let e=i[1],t=i[2];if(e===void 0||t===void 0)throw Error(`The heading pattern always captures its hashes and text`);let a=n6[e.length-1];if(a===void 0)throw Error(`The heading pattern always captures one to six hashes`);n.push({type:`heading`,level:a,text:t}),r+=1;continue}if(e6.test(e)){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);let i=e6.exec(n);if(!i)break;let a=i[1];if(a===void 0)throw Error(`The quote pattern always captures its text`);e.push(a),r+=1}n.push({type:`quote`,lines:e});continue}let a=c6(e);if(a){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);if(!n.trim())break;let i=c6(n);if(i){if(i.depth===0&&i.ordered!==a.ordered)break;e.push(i)}else if(o6(t,r))break;else{let t=e[e.length-1];if(t===void 0)throw Error(`A list continuation line follows a list with no item`);t.text+=` ${n.trim()}`}r+=1}n.push({type:`list`,ordered:a.ordered,start:a.ordered?a.number:1,items:e});continue}let o=[e];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||o6(t,r))break;o.push(e),r+=1}n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var u6=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`],d6=[`razor`,`cshtml`],f6=[`app`,`web`,`page`],p6=e=>e!==void 0&&f6.includes(e);function m6(e,t,n,r,i=null){let a=h6(n,r).map((e,n)=>{let r=t[n],i=r?.sig===e.sig?r.nodes:null;return{sig:e.sig,nodes:i??e.build()}}),o=new Set(a.flatMap(e=>e.nodes));for(let e of t)for(let t of e.nodes)o.has(t)||t.parentNode?.removeChild(t);let s=i;for(let t of a.flatMap(e=>e.nodes))(t.parentNode!==e||t.previousSibling!==s)&&e.insertBefore(t,s?s.nextSibling:e.firstChild),s=t;return a}function h6(e,t){let n={links:p6(t.links)?t.links:`web`,headings:t.headings===`text`?`text`:`outline`,resolveLink:t.resolveLink,isCitation:t.isCitation,figureText:typeof t.figureText==`function`?t.figureText:void 0,base:typeof t.base==`string`?t.base:void 0},r=t.resolverGeneration??0;return l6(e).map(e=>({sig:`${JSON.stringify(e)}|${n.links}|${n.headings}|${n.base??``}|${r}`,build:()=>_6(n,e)}))}var g6=class extends M4{_drawn;_blocks;_observer;_connected;_resolveLink;_isCitation;_resolverGeneration;_figureText;static get observedAttributes(){return[`links`,`headings`,`base`]}constructor(){super(),this._drawn=[],this._blocks=[],this._observer=null,this._connected=!1,this._resolveLink=void 0,this._isCitation=void 0,this._resolverGeneration=0,this._figureText=void 0}connectedCallback(){this._connected=!0,this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._drawn.some(t=>t.contains(e.target)))&&this._render()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._connected=!1,this._observer?.disconnect(),this._observer=null}get resolveLink(){return this._resolveLink}set resolveLink(e){this._resolveLink=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get base(){return this.getAttribute(`base`)??void 0}set base(e){e==null?this.removeAttribute(`base`):this.setAttribute(`base`,String(e))}get isCitation(){return this._isCitation}set isCitation(e){this._isCitation=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get figureText(){return this._figureText}set figureText(e){this._figureText=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}attributeChangedCallback(e,t,n){t!==n&&this._connected&&this._render()}_source(){return Array.from(this.children).find(e=>e instanceof HTMLPreElement&&e.classList.contains(`wui-markdown-source`))}_render(){let e=this._source();e&&(this._blocks=m6(this,this._blocks,e.textContent??``,{links:this.getAttribute(`links`)??void 0,headings:this.getAttribute(`headings`)??void 0,base:this.getAttribute(`base`)??void 0,resolveLink:this._resolveLink,isCitation:this._isCitation,figureText:this._figureText,resolverGeneration:this._resolverGeneration},e),this._drawn=this._blocks.flatMap(e=>e.nodes),e.hidden=!0,this._observer?.takeRecords())}};function _6(e,t){switch(t.type){case`paragraph`:return[ki(`p`,null,...v6(e,t.lines))];case`heading`:return[y6(e,t)];case`list`:return b6(e,t.items);case`table`:return[S6(e,t)];case`code`:return[w6(t)];case`quote`:return[ki(`blockquote`,null,...v6(e,t.lines))];case`rule`:return[ki(`hr`)];default:return[]}}function v6(e,t){let n=[];return t.forEach((t,r)=>{r>0&&n.push(ki(`br`)),n.push(...T6(e,t))}),n}function y6(e,t){let n=T6(e,t.text);return e.headings===`text`?ki(`p`,{class:`fw-semibold`},...n):ki(`h2`,null,...n)}function b6(e,t){let n=[];for(let r=0;r<t.length;){let i=x6(e,t,r);n.push(i.list),r=i.next}return n}function x6(e,t,n){let r=t[n];if(!r)throw Error(`List run starts past its items.`);let{depth:i,ordered:a,number:o}=r,s=ki(a?`ol`:`ul`,a&&o!==1?{start:o}:null),c=null,l=n,u=t[l];for(;u&&u.depth>=i;){if(u.depth===i)c=ki(`li`,null,...T6(e,u.text)),s.append(c),l+=1;else{let n=x6(e,t,l);if(!c)throw Error(`Nested list has no item before it.`);c.append(n.list),l=n.next}u=t[l]}return{list:s,next:l}}function S6(e,t){let n=t.header.map(t=>ki(`th`,{scope:`col`},...T6(e,t))),r=t.rows.map(n=>ki(`tr`,null,...t.header.map((t,r)=>ki(`td`,null,...T6(e,n[r]??``)))));return ki(`div`,{class:`table-responsive`},ki(`table`,{class:`table`},ki(`thead`,null,ki(`tr`,null,...n)),ki(`tbody`,null,...r)))}function C6(e){return e===null?`text`:d6.includes(e.toLowerCase())?`razor`:u6.includes(e)?e:`text`}function w6(e){let t=ki(`pre`,{class:`wui-code-source`},ki(`code`,null,e.text));return ki(`wui-code-block`,{class:`wui-code-block`,language:C6(e.language)},t)}function T6(e,t){return E6(e,F3(t,{isCitation:e.isCitation}))}function E6(e,t){return t.flatMap(t=>D6(e,t))}function D6(e,t){switch(t.type){case`code`:return[ki(`code`,null,t.text)];case`strong`:return[ki(`strong`,null,...E6(e,t.children))];case`em`:return[ki(`em`,null,...E6(e,t.children))];case`strike`:return[ki(`del`,null,...E6(e,t.children))];case`image`:return[document.createTextNode(`[`),...E6(e,t.children),document.createTextNode(`]`)];case`link`:return O6(e,t);case`citation`:return[A6(t.text)];case`text`:return e.figureText?k6(e.figureText,t.text):[document.createTextNode(t.text)];default:throw Error(`wui-markdown: unknown inline token ${JSON.stringify(t)}`)}}function O6(e,t){let n=E6(e,t.children),r=U3(t.href,e.links,e.resolveLink,globalThis.location?.origin,e.base);if(!r)return n;if(r.kind===`app`){let e=q3(r.target);return e?[j6(e,n,!1)]:n}return[j6(r.href,n,r.kind===`web`)]}function k6(e,t){return e(t).map(e=>e.kind===`sub`||e.kind===`sup`?ki(e.kind,null,e.text):document.createTextNode(e.text))}function A6(e){let t=ki(`span`,{class:`chip-label`},e),n=ki(`button`,{type:`button`,class:`chip-body`,"aria-label":e},t);return n.addEventListener(`click`,()=>{n.dispatchEvent(new CustomEvent(`wui-markdown-citation`,{bubbles:!0,detail:{citation:e}}))}),ki(`span`,{class:`chip primary chip-outline chip-sm chip-clickable wui-markdown-citation`,"data-wui":`AppChip`},n)}function j6(e,t,n){let r=ki(`span`,{class:`wui-link__label`},...t);return ki(`a`,{class:`wui-link wui-link--static`,"data-wui":`AppLink`,href:e,target:n?`_blank`:void 0,rel:n?`noopener noreferrer`:void 0},r)}A4(`wui-markdown`,g6);var M6=`AppButton`,N6=new Set([`primary`,`success`,`warning`,`danger`,`info`,`neutral`]),P6={solid:e=>`btn-${e}`,soft:e=>`btn-soft-${e}`,outline:e=>`btn-outline-${e}`,ghost:e=>`btn-ghost-${e}`,link:e=>`btn-link-${e}`,glass:()=>`btn-glass`};function F6(e){return Bi(P6,e)}function I6(e=`primary`,t=`solid`,n=`md`){if(!N6.has(e))throw RangeError(`buttonClass: unknown tone "${e}"`);if(!F6(t))throw RangeError(`buttonClass: unknown variant "${t}"`);let r=P6[t](e);return n===`md`?`btn ${r}`:`btn ${r} btn-${n}`}var L6={copiedLabel:`Copied`,copyLabel:`Copy`,label:`Code`};Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`]);var R6=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,razor:`Razor`,css:`CSS`}),z6=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),B6=`(?![\\s\\S])`,V6=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${B6})`).source,H6=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,z6([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],U6=[[`comment`,RegExp(`//[^\\n]*|${V6}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,z6(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,z6([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],W6=[[`comment`,RegExp(`//[^\\n]*|${V6}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,z6(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,z6([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],G6=[[`comment`,RegExp(`--[^\\n]*|${V6}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,z6(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,z6([`true`,`false`])],[`type`,z6([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],K6=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,z6([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,z6(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],q6=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],J6=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${B6})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],Y6={json:H6,js:U6,cs:W6,sql:G6,bash:K6,http:q6,css:[[`comment`,new RegExp(V6)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:J6,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},X6=e=>Bi(Y6,e),Z6=new Map;function Q6(e){let t=Z6.get(e);if(!t){let n=Y6[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},Z6.set(e,t)}return t}function $6(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function e8(e,t,n=[]){let{re:r,types:i}=Q6(e),a=0;for(let o of t.matchAll(r)){let r=o[0];if(!r)continue;$6(n,`plain`,t.slice(a,o.index));let s=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[s]===`tag`?e8(`htmlTag`,r,n):$6(n,i[s]??`plain`,r),a=o.index+r.length}return $6(n,`plain`,t.slice(a)),n}function t8(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return e8(`http`,e);let n=t[0]??``,r=e8(`http`,e.slice(0,t.index+n.length)),i=e.slice(t.index+n.length),a=i.trimStart()[0];return a===`{`||a===`[`?e8(`json`,i,r):a===`<`?e8(`html`,i,r):($6(r,`plain`,i),r)}function n8(e,t){let n=String(e??``);if(!n||n.length>1e5)return n?[[`plain`,n]]:[];if(t===`http`)return t8(n);let r=t===`razor`?`html`:t;return!X6(r)||r===`htmlTag`?[[`plain`,n]]:e8(r,n)}function r8(e,t){let n=[],r=[n];for(let[i,a]of n8(e,t))a.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&(n=[],r.push(n)),e&&n.push([i,e])});return r.length>1&&n.length===0&&r.pop(),r}var i8=()=>Ti(`codeBlock`,L6);function a8(e){return Bi(R6,e)}var o8=class extends M4{_title;_view;_codeEl;_copyIcon;_copyText;_chrome=null;_copied=!1;_observer=null;_timer=0;_cancelFrame=null;constructor(){super();let e=this.ownerDocument;this._title=e.createElement(`span`),this._title.className=`wui-code-title`,this._view=e.createElement(`div`),this._codeEl=e.createElement(`code`),this._copyIcon=e.createElement(`span`),this._copyIcon.className=`wui-code-copy-icon`,this._copyText=e.createElement(`span`)}static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}connectedCallback(){this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._schedule()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._cancelPending()}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_code(){return(this._source()?.textContent??``).replace(/\r?\n$/,``)}_schedule(){if(this._cancelFrame)return;let e=()=>{this._cancelFrame=null,this._render()};if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(e);this._cancelFrame=()=>cancelAnimationFrame(t)}else{let t=!0;queueMicrotask(()=>{t&&e()}),this._cancelFrame=()=>{t=!1}}}_cancelPending(){this._cancelFrame?.(),this._cancelFrame=null}_render(){if(!this._source())return;this._cancelPending();let e=this.ownerDocument;this._chrome||this._build(e);let t=this.getAttribute(`language`),n=t!==null&&a8(t)?t:`text`,r=this.getAttribute(`label`)||``,i=r8(this._code(),n);this._title.textContent=r||R6[n],this._view.setAttribute(`aria-label`,r||i8().label),this._view.style.setProperty(`--wui-code-digits`,String(String(i.length).length)),this._codeEl.replaceChildren(...i.map(t=>s8(e,t))),this._copied||(this._copyText.textContent=this._copyLabel()),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_build(e){let t=e.createElement(`div`);t.className=`wui-code-chrome`,t.append(this._bar(e));let n=this._view;n.className=`wui-code-view`,n.setAttribute(`role`,`region`),n.tabIndex=0;let r=e.createElement(`pre`);r.className=`wui-code-pre`,r.append(this._codeEl),n.append(r),t.append(n),this._chrome=t,this.append(t)}_bar(e){let t=e.createElement(`div`);t.className=`wui-code-bar`;let n=e.createElement(`button`);return n.type=`button`,n.className=`${I6(`primary`,`ghost`,`sm`)} wui-code-copy`,n.dataset.wui=M6,n.setAttribute(`aria-live`,`polite`),this._setCopied(!1),n.append(this._copyIcon,this._copyText),n.addEventListener(`click`,async()=>{await Oi(this._code())&&(this._setCopied(!0),clearTimeout(this._timer),this._timer=window.setTimeout(()=>this._setCopied(!1),2e3))}),t.append(this._title,n),t}_setCopied(e){this._copied=e;let t=Xi(e?`check`:`files`,{size:14});this._copyIcon.replaceChildren(...t?[t]:[]),this._copyText.textContent=this._copyLabel()}_copyLabel(){return this._copied?this.getAttribute(`copied-label`)||i8().copiedLabel:this.getAttribute(`copy-label`)||i8().copyLabel}};function s8(e,t){let n=e.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of t){if(r===`plain`){n.append(i);continue}let t=e.createElement(`span`);t.className=`wui-code-t-${r}`,t.textContent=i,n.append(t)}return n}A4(`wui-code-block`,o8);var c8=new Set([`Visitor`,`Customer`]),l8=/^\d+$/;function u8(e,t){return e?.features?.Sources===!0?typeof e?.isCitation==`function`?e.isCitation(t):l8.test(t):!1}function d8(e,t){if(vr(e,t?.handoffHosts))return e;let n=t?.resolveLink?.(e);return typeof n==`string`&&n!==``?n:null}function f8(e,t){let n=globalThis.location?.origin;for(let r of e.querySelectorAll(`a[href]`)){let e=r.dataset.linkSource??r.getAttribute(`href`)??``;r.dataset.linkSource=e;let i=d8(e,t);i===null?r.replaceWith(r.ownerDocument.createTextNode(r.textContent??``)):(i!==r.getAttribute(`href`)&&r.setAttribute(`href`,i),kn(i,`web`,void 0,n)?.kind===`web`?(r.setAttribute(`target`,`_blank`),r.setAttribute(`rel`,`noopener noreferrer`)):(r.removeAttribute(`target`),r.removeAttribute(`rel`)))}}function p8(e,t){f8(e,t)}ba(`wui-chat-part-text`,class extends ya{#e=null;#t=null;#n=!1;#r=null;constructor(){super(),this.addEventListener(`wui-markdown-citation`,e=>{let t=this.turn;typeof t?.openCitation==`function`&&t.openCitation(Number(e.detail.citation))}),this.addEventListener(`click`,e=>this.#a(e))}renderPart(e,t,n){let r=c8.has(t.author.kind)?`plain`:`markdown`,i=this.#e;if((i===null||i.mode!==r)&&(i=r===`plain`?{mode:r,node:this.#s()}:this.#c(e.text),this.#e=i,this.#t=null,this.replaceChildren(i.node)),i.mode===`plain`){let t=this.turn?.features?.FigureText===!0,n=JSON.stringify([e.text,t]);n!==this.#t&&(this.#t=n,i.node.replaceChildren(),t?j2(i.node,un(e.text)):i.node.append(this.ownerDocument.createTextNode(e.text)))}else this.#o(i.node),i.source.textContent!==e.text&&(i.source.textContent=e.text);this.toggleAttribute(`data-streaming`,t.streaming===!0),this.#n||(this.#n=!0,this.closest(`[data-restored]`)||this.classList.add(`wui-chat-part-enter`)),this.#i()}disposePart(){this.#r?.disconnect(),this.#r=null}#i(){this.#r||(this.#r=new MutationObserver(()=>p8(this,this.turn)),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}),p8(this,this.turn))}#a(e){let t=e.target instanceof Element?e.target.closest(`a[href]`):null,n=this.turn;if(!t||!this.contains(t))return;let r=t.getAttribute(`href`)??``;r.startsWith(`#`)||(r.startsWith(`/`)&&typeof n?.onNavigate==`function`?(e.preventDefault(),n.onNavigate(r)):typeof n?.openTarget==`function`&&(e.preventDefault(),n.openTarget(r)))}#o(e){let t=this.turn?.features?.FigureText===!0?un:void 0;e.figureText!==t&&(e.figureText=t)}#s(){return P(this.ownerDocument,`div`,`wui-chat-bubble`)}#c(e){let t=this.ownerDocument,n=P(t,`wui-markdown`,`wui-markdown wui-chat-text`);n.setAttribute(`links`,`web`),n.setAttribute(`headings`,`text`),n.isCitation=e=>u8(this.turn,e);let r=P(t,`pre`,`wui-markdown-source`,e);return n.append(r),{mode:`markdown`,node:n,source:r}}}),ba(`wui-chat-part-ticket`,class extends ya{renderPart(e,t,n){let{labels:r}=n,i=$(`article`,`wui-chat-ticket`,{"aria-label":r.ticketAria(e.number)}),a=$(`div`,`wui-chat-ticket-head`),o=$(`span`,`wui-chat-ticket-number`);o.textContent=r.ticketAria(e.number),a.append(o);let s=v4(e.status);if(s!==null){let t=$(`span`,`wui-chat-ticket-badge wui-chat-ticket-badge--${s}`);t.textContent=y4(e.status,r),a.append(t)}let c=$(`strong`,`wui-chat-ticket-title`);if(c.textContent=e.subject,i.append(a,c),typeof n.openTicket==`function`){let t=$(`div`,`wui-chat-ticket-foot`),a=$(`button`,`wui-chat-ticket-link`,{type:`button`});a.textContent=r.ticketView,a.addEventListener(`click`,()=>{let{openTicket:t}=n;if(t===void 0)throw Error(`${this.localName} lost openTicket after it drew the link`);t.call(n,{ticketId:e.ticketId,number:e.number})}),t.append(a),i.append(t)}this.replaceChildren(i)}});var m8=`http://www.w3.org/2000/svg`,h8={mic:`M12 15a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-2.08A7 7 0 0 0 19 12z`,stop:`M6 6h12v12H6z`,play:`M8 5v14l11-7z`,pause:`M6 5h4v14H6zm8 0h4v14h-4z`,speaker:`M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z`};function g8(e,t=18){if(!Y2(h8,e))throw Error(`Unknown voice icon "${e}".`);let n=document.createElementNS(m8,`svg`);n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`),n.setAttribute(`fill`,`currentColor`);let r=document.createElementNS(m8,`path`);return r.setAttribute(`d`,h8[e]),n.append(r),n}var _8=40,v8=null;function y8(e){let t=P(document,`span`,`wui-chat-clip-bar`);return t.style.setProperty(`--wui-chat-bar-height`,`${Math.round(e*100)}%`),t}function b8(e,t){e.replaceChildren(..._i(t,_8).map(y8))}ba(`wui-chat-part-voice-clip`,class extends ya{#e=null;#t=!1;#n=0;#r=0;#i=!1;#a=null;#o=null;#s=null;#c=0;#l=!1;renderPart(e,t,n){if(!n.features.VoiceClips){this.#u(e.transcript);return}let r=this.#e??this.#d(e.attachmentId);e.attachmentId!==r.attachmentId&&(this.disposePart(),r.attachmentId=e.attachmentId,this.#r=0,b8(r.wave,e.attachmentId)),this.#n=e.durationMs,this.#f(r,e)}disposePart(){this.#c+=1,this.#a?.pause(),this.#s!==null&&URL.revokeObjectURL(this.#s),v8===this&&(v8=null),this.#a=null,this.#o=null,this.#s=null,this.#i=!1}#u(e){if(this.disposePart(),this.#e=null,typeof e==`string`&&e!==``){let t=P(document,`p`,`wui-chat-clip-transcript`);t.textContent=e,this.replaceChildren(t)}else this.replaceChildren()}#d(e){let t=P(document,`div`,`wui-chat-clip`);t.setAttribute(`role`,`group`);let n=P(document,`div`,`wui-chat-clip-row`),r=P(document,`button`,`wui-chat-clip-play`);r.type=`button`;let i=P(document,`div`,`wui-chat-clip-wave`);i.setAttribute(`aria-hidden`,`true`);let a=P(document,`span`,`wui-chat-clip-time`);n.append(r,i,a);let o=P(document,`p`,`wui-chat-clip-error`);o.setAttribute(`role`,`status`),o.hidden=!0,t.append(n,o);let s={attachmentId:e,root:t,play:r,wave:i,time:a,error:o,transcript:null};return r.addEventListener(`click`,()=>this.#C(s)),b8(i,e),this.#e=s,this.replaceChildren(t),s}#f(e,t){let n=this.activeTurn.labels;e.root.setAttribute(`aria-label`,n.voiceClip),e.play.disabled=this.#l||typeof this.activeTurn.readAttachment!=`function`,this.#p(e),this.#m(e),this.#h(e,t.transcript)}#p(e){let t=this.activeTurn.labels,n=this.#i?t.voiceClipPause:t.voiceClipPlay;e.play.setAttribute(`aria-label`,n),e.play.title=n,e.play.replaceChildren(g8(this.#i?`pause`:`play`,18))}#m(e){let t=this.#n/1e3,n=t>0?Math.min(1,this.#r/t):0,r=Math.floor(n*_8);[...e.wave.children].forEach((e,t)=>{e.classList.toggle(`wui-chat-clip-bar--played`,t<r)});let i=vi(Math.max(1,Math.round(t)));e.time.textContent=this.activeTurn.labels.voiceClipTime(vi(this.#r),i)}#h(e,t){if(typeof t!=`string`||t===``){e.transcript?.toggle.remove(),e.transcript?.text.remove(),e.transcript=null;return}let n=e.transcript??this.#g(e);n.text.textContent=t,this.#_(n)}#g(e){let t=P(document,`button`,`wui-chat-clip-toggle`);t.type=`button`;let n=P(document,`p`,`wui-chat-clip-transcript`);n.hidden=!this.#t;let r={toggle:t,text:n};return t.addEventListener(`click`,()=>{this.#t=!this.#t,n.hidden=!this.#t,this.#_(r)}),e.transcript=r,e.root.append(t,n),r}#_(e){let t=this.activeTurn.labels;e.toggle.setAttribute(`aria-expanded`,String(this.#t)),e.toggle.textContent=this.#t?t.voiceClipHideTranscript:t.voiceClipShowTranscript}#v(e){return this.#o??=this.#y(e).catch(e=>{throw this.#o=null,e}),this.#o}async#y(e){let t=this.#c,{readAttachment:n}=this.activeTurn;if(n===void 0)throw Error(`${this.localName} loaded a clip on a turn without readAttachment`);let i=await n.call(this.activeTurn,e.attachmentId),a=URL.createObjectURL(new Blob([i],{type:r(i)}));if(t!==this.#c)return URL.revokeObjectURL(a),null;this.#s!==null&&URL.revokeObjectURL(this.#s),this.#s=a;let o=new Audio(this.#s);return o.addEventListener(`timeupdate`,()=>{this.#r=o.currentTime,this.#m(e)}),o.addEventListener(`ended`,()=>{this.#r=0,this.#b(),this.#m(e)}),o.addEventListener(`error`,()=>{this.#b(),this.#o=null,this.#S(e)}),this.#a=o,o}#b(){this.#a?.pause(),this.#x(!1)}#x(e){this.#i=e,e?(v8&&v8!==this&&v8.#b(),v8=this):v8===this&&(v8=null);let t=this.#e;t!==null&&this.#p(t)}#S(e){e.error.textContent=this.activeTurn.labels.voiceClipFailed,e.error.hidden=!1}async#C(e){if(this.#i)this.#b();else{e.error.hidden=!0,this.#l=!0,e.play.disabled=!0,e.play.setAttribute(`aria-busy`,`true`);try{let t=await this.#v(e);if(t===null)return;this.#x(!0),await t.play()}catch{this.#b(),this.#o=null,this.#S(e)}finally{this.#l=!1,e.play.removeAttribute(`aria-busy`),e.play.disabled=typeof this.activeTurn.readAttachment!=`function`}}}});var x8={Text:`wui-chat-part-text`,Sources:`wui-chat-part-sources`,QuickReplies:`wui-chat-part-quick-replies`,InputRequest:`wui-chat-part-input-request`,Action:`wui-chat-part-action`,Notice:`wui-chat-part-notice`,Table:`wui-chat-part-table`,Chart:`wui-chat-part-chart`,Figures:`wui-chat-part-figures`,RecordCard:`wui-chat-part-record-card`,Image:`wui-chat-part-image`,File:`wui-chat-part-file`,Ticket:`wui-chat-part-ticket`,Handoff:`wui-chat-part-handoff`,VoiceClip:`wui-chat-part-voice-clip`},S8=n({SpeechConfig:()=>void 0}),C8=t((()=>{})),w8=1e4,T8=2e3,E8=3e5,D8=new Set([`NotAllowedError`,`SecurityError`,`PermissionDeniedError`]),O8=new Set([`NotFoundError`,`OverconstrainedError`,`NotReadableError`]);function k8(e){return D8.has(j8(e,`name`))?new Ut(`Blocked`,{message:M8(e)}):O8.has(j8(e,`name`))?new Ut(`NoMicrophone`,{message:M8(e)}):A8(e)}function A8(e){return e instanceof Ut?e:new Ut(`Failed`,{message:M8(e)??String(e)})}function j8(e,t){return typeof e==`object`&&e||typeof e==`function`?Reflect.get(e,t):void 0}function M8(e){let t=j8(e,`message`);return t==null?void 0:String(t)}function N8(e){return typeof e==`object`&&!!e}function P8(e){let t=j8(e,`SpeechConfig`),n=j8(e,`AudioConfig`),r=j8(e,`NoMatchDetails`);return typeof j8(t,`fromAuthorizationToken`)==`function`&&typeof j8(n,`fromDefaultMicrophoneInput`)==`function`&&typeof j8(n,`fromSpeakerOutput`)==`function`&&typeof j8(r,`fromResult`)==`function`&&typeof j8(e,`SpeechRecognizer`)==`function`&&typeof j8(e,`SpeakerAudioDestination`)==`function`&&typeof j8(e,`SpeechSynthesizer`)==`function`&&N8(j8(e,`PropertyId`))&&N8(j8(e,`ResultReason`))&&N8(j8(e,`NoMatchReason`))&&N8(j8(e,`CancellationReason`))}function F8(e){if(!P8(e))throw new Ut(`Unavailable`,{message:`Speech is not available in this browser.`});return e}var I8=null;function L8(){let e=globalThis,t=`SpeechSDK`in e?e.SpeechSDK:void 0;return t?Promise.resolve(F8(t)):(I8===null&&(I8=Promise.resolve().then(()=>(C8(),S8)).then(e=>F8(j8(e,`SpeechConfig`)?e:j8(e,`default`))).catch(e=>{throw I8=null,e})),I8)}function R8(){return globalThis.document?.documentElement?.lang||globalThis.navigator?.language||`en-US`}function z8(e){let t=e.getToken,n=e.loadSdk??L8,r=e.getLanguage??R8,i=typeof navigator<`u`&&typeof navigator.mediaDevices?.getUserMedia==`function`,a=typeof window<`u`&&window.isSecureContext===!0,o=i&&a,s=typeof window<`u`,c=null,l=null,u=null;function d(){return c!==null&&Date.parse(c.expiresDateTimeUtc)-Date.now()>6e4?Promise.resolve(c):(l===null&&(l=Promise.resolve().then(()=>t()).then(e=>(c=e,l=null,e),e=>{throw l=null,A8(e)})),l)}function f(){return u===null&&(u=Promise.resolve().then(()=>n()).then(e=>{if(!e?.SpeechConfig)throw new Ut(`Unavailable`,{message:`Speech is not available in this browser.`});return e}).catch(e=>{throw u=null,A8(e)})),u}function p(e={}){let{signal:t,onText:n,onEnd:i}=e;if(t?.aborted)return i?.(),Promise.resolve();let a=()=>{},s=()=>{},c=new Promise((e,t)=>{a=e,s=t}),l=!1,u=!1,p=null,m=!1,h=``,g=[],_,v,y,b=()=>{clearTimeout(_),clearTimeout(v),clearTimeout(y)},x=e=>{if(!l){l=!0,b(),t?.removeEventListener(`abort`,S);try{p?.close()}finally{try{i?.()}finally{e?s(e):a()}}}};async function S(){if(!(l||u)){u=!0,b();try{let e=p;e!==null&&await new Promise(t=>e.stopContinuousRecognitionAsync(()=>t(),()=>t()))}finally{x(null)}}}let C=()=>[...g,h].filter(e=>e!==``).join(` `).trim(),w=(e,t)=>{m||(m=!0,clearTimeout(_)),clearTimeout(v),v=setTimeout(S,T8),n?.(C(),t)};async function T(){if(t?.addEventListener(`abort`,S),!o){x(new Ut(`Unavailable`,{message:`Dictation is not available in this browser.`}));return}let n;try{n=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){x(k8(e));return}for(let e of n.getTracks())e.stop();if(!l)try{let t=await f(),n=await d();if(l)return;let i=t.SpeechConfig.fromAuthorizationToken(n.token,n.region);i.speechRecognitionLanguage=e.language||r(),i.setProperty(t.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs,String(w8));let a=new t.SpeechRecognizer(i,t.AudioConfig.fromDefaultMicrophoneInput());if(p=a,a.recognizing=(e,t)=>{if(l)return;let n=t.result?.text;n&&(h=n,w(n,!1))},a.recognized=(e,n)=>{if(l)return;let{reason:r,text:i}=n.result;r===t.ResultReason.RecognizedSpeech&&i?(g.push(i),h=``,w(i,!0)):r===t.ResultReason.NoMatch&&t.NoMatchDetails.fromResult(n.result).reason===t.NoMatchReason.InitialSilenceTimeout&&x(new Ut(`NoSpeech`,{message:`No speech was heard.`}))},a.canceled=(e,n)=>{l||(n.reason===t.CancellationReason.Error?x(new Ut(`Failed`,{message:n.errorDetails})):x(null))},a.sessionStopped=()=>x(null),await new Promise((e,t)=>a.startContinuousRecognitionAsync(()=>e(),t)),l)return;e.onStarted?.(),_=setTimeout(()=>{m||x(new Ut(`NoSpeech`,{message:`No speech was heard.`}))},w8),y=setTimeout(S,E8)}catch(e){x(A8(e))}}return T(),c}async function m(e,t={}){let{signal:n}=t;if(!n?.aborted)try{let i=await f(),a=await d();if(n?.aborted)return;let o=i.SpeechConfig.fromAuthorizationToken(a.token,a.region);o.speechSynthesisLanguage=t.language||r();let s=new i.SpeakerAudioDestination,c=new i.SpeechSynthesizer(o,i.AudioConfig.fromSpeakerOutput(s));await new Promise((t,r)=>{let a=!1,o=()=>{n?.removeEventListener(`abort`,d),c.close(),s.close()},l=()=>{a||(a=!0,o(),t())},u=e=>{a||(a=!0,o(),r(A8(e)))};function d(){s.pause(),l()}n?.addEventListener(`abort`,d),s.onAudioEnd=l;try{c.speakTextAsync(e,e=>{e.reason!==i.ResultReason.SynthesizingAudioCompleted&&u(new Ut(`Failed`,{message:`The reply could not be synthesised.`}))},e=>u(e))}catch(e){u(e)}})}catch(e){throw A8(e)}}return{dictation:o,readAloud:s,streamsText:!0,startDictation:p,speak:m}}var B8=8e3,V8=6e3,H8=new Set([`Blocked`,`NoMicrophone`]);function U8(e){let t=e instanceof Ut?e.code:`Failed`;return{code:t,source:`Dictation`,sticky:H8.has(t)}}function W8(e){let t=rr(e.filter(e=>e.kind===`Text`)).replace(/ ?\[\d+\]/g,``).replace(/\s+/g,` `).trim();if(t.length<=6e3)return t;let n=t.slice(0,V8),r=n.lastIndexOf(`. `);return r===-1?n.trim():n.slice(0,r+1)}function G8(e,t){switch(e.code){case`Blocked`:return t.dictationBlocked;case`NoMicrophone`:return t.dictationNoMicrophone;case`NoSpeech`:return t.dictationNotHeard;case`Unavailable`:return t.dictationUnavailable;case`Failed`:return t.dictationFailed;case`SpeakFailed`:return t.readAloudFailed;default:throw Error(`Unknown voice note code "${e.code}".`)}}function K8(e){let t=e.getState,n=e.speech??z8({getToken:e.getToken}),r=`Idle`,i=null,a=null,o=null,s=null,c=0,l=null,u=new Set,d=()=>({mode:r,messageId:i,startedAtMs:a,note:o});function f(){let e=d();for(let t of[...u])t(e)}function p(e){r=e.mode,i=e.messageId??null,a=e.startedAtMs??null,f()}function m(){l!==null&&clearTimeout(l),l=null}function h(e){m(),o=e,e&&!e.sticky&&(l=setTimeout(()=>{l=null,o=null,f()},B8)),f()}function g(){o!==null&&(m(),o=null,f())}function _(){c+=1;let e={id:c,controller:new AbortController,stopped:!1};return s=e,e}function v(e){s===e&&(s=null,p({mode:`Idle`}))}function y(){let e=s;s=null,e&&(e.stopped=!0,e.controller.abort()),r!==`Idle`&&p({mode:`Idle`})}function b(){let e=t();return!!(e.features.Dictation&&e.profile?.speechAvailable&&n.dictation)}function x(){let e=t();return!!(e.features.ReadAloud&&e.profile?.speechAvailable&&n.readAloud)}async function S(e){if(r===`Dictating`){y();return}if(y(),h(null),!b())return;let t=e.getText(),i=t!==``&&!/\s$/.test(t)?`${t} `:t,a=_();p({mode:`Dictating`});try{await n.startDictation({signal:a.controller.signal,onText:t=>{s===a&&e.setText(i+t)},onEnd:()=>v(a)})}catch(e){if(a.stopped)return;v(a),h(U8(e))}}async function C(e,t){if(r===`Speaking`&&i===e){y();return}y(),h(null);let a=W8(t);if(a===``)return;let o=_();p({mode:`Speaking`,messageId:e});try{await n.speak(a,{signal:o.controller.signal}),v(o)}catch{if(o.stopped)return;v(o),h({code:`SpeakFailed`,source:`ReadAloud`,sticky:!1,messageId:e})}}function w(e){return u.add(e),()=>{u.delete(e)}}function T(){y(),m(),o=null,u.clear()}return{canDictate:b,canSpeak:x,getStatus:d,subscribe:w,toggleDictation:S,toggleSpeak:C,stop:y,dismissNote:g,destroy:T}}var q8=new Set([`Shift`,`Control`,`Alt`,`Meta`,`Escape`]);function J8(e,t){e.isTrusted&&!q8.has(e.key)&&t.getStatus().mode===`Dictating`&&t.stop()}function Y8({voice:e,getLabels:t,textarea:n,onTextChanged:r}){let i=null,a=$(`button`,`wui-chat-tool wui-chat-mic`,{type:`button`});a.append(g8(`mic`,20)),a.hidden=!0,a.addEventListener(`click`,()=>{e.toggleDictation({getText:()=>n.value,setText:e=>{n.value=n.maxLength>0?e.slice(0,n.maxLength):e,r(),n.setSelectionRange(n.value.length,n.value.length)}})});let o=$(`p`,`wui-chat-voice-note`,{role:`status`});o.hidden=!0;let s=$(`span`,`visually-hidden`,{"aria-live":`polite`});function c(e){let n=t(),r=e.note?.source===`ReadAloud`?null:e.note,i=e.mode===`Dictating`,c=i?n.dictateStop:n.dictate;a.setAttribute(`aria-pressed`,String(i)),a.setAttribute(`aria-label`,c),a.title=c;let l=r?.code===`Blocked`||r?.code===`NoMicrophone`;r===null?(o.hidden=!0,o.textContent=``):(o.hidden=!1,o.textContent=G8(r,n),o.setAttribute(`role`,r.sticky?`alert`:`status`)),o.classList.toggle(`wui-chat-voice-note--blocked`,l),s.textContent=i?n.dictateListening:``}function l(t){let{state:n}=t;a.hidden=!e.canDictate();let r=e.getStatus().mode===`Speaking`,i=n.messagesLeftToday===0;a.disabled=i||r||n.handoffPause===!0}function u(e){c(e),i!==null&&l(i)}let d=e.subscribe(u);function f(t){i=t,l(t),c(e.getStatus())}function p(){d()}return{buttons:[a],note:o,announcer:s,paint:f,destroy:p}}var X8=10,Z8=.9,Q8=0;function $8(e){for(let t of e.toReversed())for(let e of t.parts.toReversed())if(e.kind===`InputRequest`&&e.state===`Open`)return e.fields[0]?.label??e.title??null;return null}function e5(e){Q8+=1;let t=`wui-chat-composer-hint-${Q8}`,n=$(`p`,`wui-chat-allowance`,{role:`status`});n.hidden=!0;let r=$(`span`),i=$(`button`,`btn btn-ghost-primary btn-sm wui-chat-action-btn`,{type:`button`});i.addEventListener(`click`,()=>e.onCancelEdit());let a=$(`div`,`wui-chat-editing`);a.hidden=!0,a.append(r,i);let o=$(`div`,`wui-chat-attachments`);o.hidden=!0;let s=$(`button`,`wui-chat-tool`,{type:`button`});s.append(X2(`paperclip`,20)),s.hidden=!0;let c=$(`input`,null,{type:`file`,multiple:``,tabindex:`-1`});c.hidden=!0,c.addEventListener(`change`,()=>{let t=[...c.files??[]];c.value=``,t.length>0&&e.onAttach(t)}),s.addEventListener(`click`,()=>c.click());let l=$(`textarea`,`wui-chat-input`,{rows:`1`,"aria-describedby":t}),u=$(`span`,`visually-hidden`,{id:t}),d=$(`span`,`wui-chat-counter`);d.hidden=!0;let f=$(`button`,`wui-chat-send`,{type:`submit`});f.append(X2(`arrow-up`,18));let p=$(`button`,`wui-chat-send wui-chat-send--stop`,{type:`button`});p.append(X2(`stop`,16)),p.hidden=!0,p.addEventListener(`click`,()=>e.onStop());let m=$(`form`,`wui-chat-composer`);m.append(s,c,l,d,u,p,f);let h=null,g=null,_=null,v=0,y=null;function b(){l.style.height=`auto`,l.style.height=`${l.scrollHeight}px`;let e=getComputedStyle(l),t=l.scrollHeight-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom);m.classList.toggle(`wui-chat-composer--multiline`,t>(parseFloat(e.lineHeight)||22)*1.5)}function x(){return y?.attachments.some(e=>e.status===`Uploading`)??!1}function S(){return y?.attachments.some(e=>e.status===`Ready`)??!1}function C(){let e=l.value.length,t=v>0&&e>v*Z8;d.hidden=!t,t&&_&&(d.textContent=_.counter(e,v))}function w(){let e=y?.messagesLeftToday??null,t=l.value.trim()===``&&!S();f.disabled=!!y?.streaming||e===0||x()||t||y?.handoffPause===!0,m.classList.toggle(`wui-chat-composer--has-text`,!t)}function T(){if(f.disabled)return;let t=l.value.trim();l.value=``,b(),C(),w(),e.voice?.stop(),e.voice?.dismissNote(),e.onSubmit(t)}l.addEventListener(`input`,()=>{b(),C(),w(),l.value!==``&&e.onTyping?.()}),l.addEventListener(`keydown`,e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),T())}),m.addEventListener(`submit`,e=>{e.preventDefault(),T()});let E=e.voice,D=E?Y8({voice:E,getLabels:()=>{if(_===null)throw Error(`composer labels are read before the first render`);return _},textarea:l,onTextChanged:()=>{b(),C(),w()}}):null;if(E&&D){let e=D.buttons[0];e&&m.insertBefore(e,f),l.addEventListener(`keydown`,e=>J8(e,E))}function O(t,n){let r=t.map(t=>{let r=$(`span`,`wui-chat-chip`),i=$(`span`,null,t.status===`Failed`?{title:t.error??``}:null);i.textContent=t.fileName;let a=$(`button`,`wui-chat-chip-remove`,{type:`button`,"aria-label":n.removeAttachment(t.fileName)});a.append(X2(`x`,14)),a.addEventListener(`click`,()=>e.onRemove(t.key));let o=[];if(t.status===`Uploading`){let e=$(`progress`,`wui-chat-chip-progress`,{max:`1`});typeof t.progress==`number`&&(e.value=t.progress);let r=$(`span`,`wui-chat-chip-status`);r.textContent=n.attachmentUploading,o.push(e,r)}if(t.status===`Failed`){let e=$(`span`,`wui-chat-chip-error`,{"aria-live":`polite`});e.textContent=t.error||n.attachmentFailed,o.push(e)}return r.append(i,...o,a),r});o.replaceChildren(...r),o.hidden=r.length===0}function k(t){y=t.state,_=t.labels,v=t.maxLength,t.sendIcon&&f.dataset.icon!==t.sendIcon&&(f.dataset.icon=t.sendIcon,f.replaceChildren(X2(t.sendIcon,18)));let o=y.messagesLeftToday;m.setAttribute(`aria-label`,_.composer),u.textContent=_.composerHint,l.setAttribute(`aria-label`,_.composer),l.maxLength=v,l.placeholder=y.handoffPause?_.handoffMoment:$8(y.messages)??_.placeholder,l.disabled=o===0||y.handoffPause===!0,n.hidden=!(o!==null&&o<=X8),!n.hidden&&o!==null&&(n.textContent=_.allowance(o));let d=y.editing?.messageId??null;if(d!==h){let t=h!==null;h=d,y.editing?(e.voice?.stop(),l.value=y.editing.text,b()):t&&(l.value=``,b())}a.hidden=!y.editing,r.textContent=_.editing,i.textContent=_.cancel;let x=t.draft??null;typeof x==`string`&&x!==``&&x!==g&&(g=x,l.value=x,l.dispatchEvent(new Event(`input`)),l.focus(),e.onDraftApplied?.()),O(y.attachments,_);let S=y.features.Attachments&&(y.profile?.limits.maxAttachments??0)>0&&y.handoffPause!==!0;s.hidden=!S,s.setAttribute(`aria-label`,_.attach),s.title=_.attachHint,c.accept=t.accept??``;let T=y.streaming&&y.features.Stop===!0;p.hidden=!T,p.setAttribute(`aria-label`,_.stop),f.hidden=T,f.setAttribute(`aria-label`,_.send),C(),w(),D?.paint({state:y})}function A(){l.focus()}function j(){D?.destroy();for(let e of ee)e.remove()}let ee=[n,a,o,...D?[D.note,D.announcer]:[],m];return{nodes:ee,paint:k,focus:A,destroy:j,getDraft:()=>l.value}}var t5=`https://policies.google.com/privacy`,n5=`https://policies.google.com/terms`;function r5(e,t){let n=$(`a`,`wui-chat-footer-link`,{href:t,target:`_blank`,rel:`noopener noreferrer`});return n.textContent=e,n}function i5(){let e=$(`p`,`wui-chat-footer`);e.hidden=!0;function t(t){let{labels:n,profile:r}=t,i=[];if(r){let e=$(`span`,`wui-chat-footer-text`);e.textContent=r.footer.disclaimer||n.disclaimer,i.push(e);let{privacyText:t}=r.footer,a=br(r.footer.privacyUrl)?r.footer.privacyUrl:null;if(a){let e=$(`span`,`wui-chat-footer-privacy`),r=$(`a`,`wui-chat-footer-link`,{href:a});r.textContent=t||n.footerPrivacyFallback,e.append(r),i.push(e)}else if(t){let e=$(`span`,`wui-chat-footer-privacy`);e.textContent=t,i.push(e)}if(r.footer.assuranceText){let e=$(`span`);e.textContent=r.footer.assuranceText,i.push(e)}if(Fe(r)){let e=$(`span`,`wui-chat-footer-captcha`);e.append(document.createTextNode(n.captchaNoticeBefore),r5(n.captchaPrivacyPolicy,t5),document.createTextNode(n.captchaNoticeAnd),r5(n.captchaTerms,n5),document.createTextNode(n.captchaNoticeAfter)),i.push(e)}}e.replaceChildren(...i),e.hidden=i.length===0}return{el:e,paint:t}}function a5(e,t,n){e.setAttribute(`aria-label`,t),e.title=t,e.dataset.icon!==n&&(e.dataset.icon=n,e.replaceChildren(X2(n,20)))}function o5(e){let t=$(`span`,`wui-chat-orb`,{"aria-hidden":`true`}),n=$(`strong`,`wui-chat-title`);e.titleId&&(n.id=e.titleId);let r=$(`span`,`wui-chat-tagline`),i=$(`span`,`wui-chat-status`),a=$(`div`,`wui-chat-header-text`);a.append(n,r,i);let o=$(`span`,`wui-chat-header-conversation`);o.hidden=!0;let s=$2(``,`history`,()=>e.onHistory()),c=$2(``,`volume-high`,()=>e.onMute()),l=$2(``,`plus`,()=>e.onNew()),u=$2(``,`maximize-4`,()=>e.onSwitch());u.classList.add(`wui-chat-switch-btn`,`wui-chat-switch-btn--full`);let d=$2(``,`panel-left-open`,()=>e.onSwitch());d.classList.add(`wui-chat-switch-btn`,`wui-chat-switch-btn--side`);let f=$2(``,`x`,()=>e.onClose());f.classList.add(`wui-chat-close-btn`);let p=$(`div`,`wui-chat-header-actions`);p.append(o,s,c,l,u,d,f);let m=$(`header`,`wui-chat-header`);m.append(t,a,p);function h(e){let{labels:t}=e;m.hidden=!1,n.textContent=e.title??``,r.textContent=e.tagline??``,r.hidden=!e.tagline,i.textContent=e.status??``,s.hidden=!e.showHistory,e.viewingHistory?a5(s,t.backToChat,`arrow-left`):a5(s,t.history,`history`),c.hidden=!e.showMute,a5(c,e.muted?t.unmuteSounds:t.muteSounds,e.muted?`volume-mute`:`volume-high`),l.hidden=!!e.viewingHistory||e.showNew===!1,l.disabled=!e.canNew,a5(l,t.newChat,`plus`),u.hidden=e.switchTo!==`full-page`,u.disabled=!e.canSwitch,a5(u,t.openFullScreen,`maximize-4`),d.hidden=e.switchTo!==`docked`,d.disabled=!e.canSwitch,a5(d,t.openSidePanel,`panel-left-open`),f.hidden=!e.showClose,a5(f,t.close,`x`)}return{el:m,conversation:o,paint:h}}var s5=120;function c5(e,t,n=`outline`){let r=$(`button`,`${Z2(n,`sm`)} wui-chat-action-btn`,{type:`button`});return r.textContent=e,r.addEventListener(`click`,t),r}function l5(e){let t=$(`div`,`wui-chat-history`);t.hidden=!0;let n=null,r=null,i=null,a=null,o=null,s=!1;function c(){return n||(n=Ht({client:e.getClient()}),r=n.subscribe(()=>_()),n)}function l(e){i={id:e.publicId,kind:`rename`,draft:e.title??``,saving:!1},a=null,o=null,s=!0,_()}function u(e){i={id:e.publicId,kind:`delete`,saving:!1},a=null,o=null,_()}function d(){i=null,a=null,o=null,_()}async function f(){let t=i;if(t?.kind!==`rename`||t.saving)return;let n=t.draft.trim();if(n){t.saving=!0,_();try{await c().rename(t.id,n),i===t&&(i=null),a=null,o=null}catch{if(i!==t)return;t.saving=!1,o=e.getLabels().renameFailed}_()}}async function p(){let t=i;if(!(t?.kind!==`delete`||t.saving)){t.saving=!0,_();try{await c().remove(t.id),i===t&&(i=null),a=null,e.onDeleted(t.id)}catch{if(i!==t)return;t.saving=!1,a=e.getLabels().deleteFailed}_()}}function m(e,t){let n=$(`li`,`wui-chat-history-row wui-chat-history-row--editing`),r=$(`input`,`wui-chat-history-input`,{type:`text`,"aria-label":e.conversationTitle,maxlength:String(s5)});r.value=t.draft,r.addEventListener(`input`,()=>{t.draft=r.value,i.disabled=t.saving||!t.draft.trim()}),r.addEventListener(`keydown`,e=>{e.key===`Enter`&&!e.isComposing&&e.keyCode!==229?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),d())});let i=c5(e.renameSave,()=>f(),`primary`);if(i.disabled=t.saving||!t.draft.trim(),n.append(r,i,c5(e.cancel,()=>d(),`ghost`)),o!==null){let e=$(`p`,`wui-chat-history-error`,{role:`alert`});e.textContent=o,n.append(e)}return s&&(s=!1,queueMicrotask(()=>r.focus())),n}function h(e,t){let n=$(`li`,`wui-chat-history-row wui-chat-history-row--confirm`),r=$(`p`);r.textContent=e.deleteConfirmTitle;let i=$(`p`);i.textContent=e.deleteConfirmMessage;let a=c5(e.deleteConfirm,()=>p(),`danger`);return a.disabled=t.saving,n.append(r,i,a,c5(e.cancel,()=>d(),`ghost`)),n}function g(t,n,r){if(i?.id===t.publicId&&i.kind===`rename`)return m(n,i);if(i?.id===t.publicId&&i.kind===`delete`)return h(n,i);let a=$(`li`,`wui-chat-history-row`),o=$(`button`,`wui-chat-history-open`,{type:`button`}),s=$(`span`,`wui-chat-history-title`);s.textContent=t.title||n.untitled;let c=$(`span`,`wui-chat-history-time`);return c.textContent=er(t.lastActivityDateTimeUtc),o.append(s,c),o.addEventListener(`click`,()=>e.onOpen(t.publicId)),a.append(o),r.Rename&&a.append($2(n.rename,`pencil`,()=>l(t))),r.Delete&&a.append($2(n.deleteChat,`trash`,()=>u(t))),a}function _(){let r=e.getLabels(),i=e.getFeatures(),o=n?n.getState():{items:[],totalCount:null,loading:!1,error:null,hasMore:!1},s=[];if(o.error||a){let e=$(`p`,`wui-chat-history-error`,{role:`alert`});o.error?(e.append(document.createTextNode(r.loadFailed),document.createTextNode(` `)),e.append(c5(r.retry,()=>c().load(),`outline`))):e.textContent=a,s.push(e)}if(o.loading&&o.items.length===0){let e=$(`p`,`wui-chat-history-empty`,{role:`status`});e.textContent=r.loadingConversation,s.push(e)}if(o.items.length===0&&!o.loading&&!o.error){let e=$(`p`,`wui-chat-history-empty`),t=$(`span`);t.textContent=r.historyEmptyTitle;let n=$(`span`);n.textContent=r.historyEmptyText,e.append(t,n),s.push(e)}if(o.items.length>0){let e=$(`ul`,`wui-chat-history-list`,{"aria-label":r.history});e.append(...o.items.map(e=>g(e,r,i))),s.push(e)}o.hasMore&&!o.loading&&s.push(c5(r.loadMore,()=>c().loadMore(),`outline`)),t.replaceChildren(...s)}function v(){t.hidden=!1,Promise.allSettled([c().load()]),_()}function y(){t.hidden=!0}function b(){r?.(),r=null,n?.dispose(),n=null}return{el:t,show:v,hide:y,paint:_,dispose:b}}var u5=new Set([`GET`,`HEAD`]);function d5(){let e=document.querySelector(`meta[name="wui-csrf"]`),t=e?.getAttribute(`content`);return t?{token:t,header:e?.getAttribute(`data-header`)||`RequestVerificationToken`}:null}async function f5(e,{lenient:t=!1}={}){let n=await e.text();if(n){if((e.headers.get(`content-type`)||``).includes(`json`)){if(!t)return JSON.parse(n);try{return JSON.parse(n)}catch{return n}}return n}}async function p5(e,t,n){let r=new TextDecoder,i=e.getReader(),a=``;for(;;){let{done:e,value:o}=await i.read();if(e)break;a+=r.decode(o,{stream:!0}),n({event:{target:{responseText:a,status:t}}})}return a+=r.decode(),a}function m5({fetch:e=(...e)=>globalThis.fetch(...e)}={}){async function t(t,n,r,i={}){let a={...i.headers},o;if(typeof FormData<`u`&&r instanceof FormData){for(let e of Object.keys(a))e.toLowerCase()===`content-type`&&delete a[e];o=r}else r!==void 0&&(a[`Content-Type`]=`application/json`,o=JSON.stringify(r));if(!u5.has(t)){let e=d5();e&&(a[e.header]=e.token)}let s=i.signal,c=s,l,u,d=()=>l?.abort(s?.reason);(i.timeout??0)>0&&(l=new AbortController,c=l.signal,s?.aborted?l.abort(s.reason):s?.addEventListener(`abort`,d,{once:!0}),u=setTimeout(()=>l?.abort(new DOMException(`The request timed out.`,`TimeoutError`)),i.timeout));try{let r={method:t,headers:a,credentials:`same-origin`};o!==void 0&&(r.body=o),c&&(r.signal=c);let s=await e(n,r);if(!s.ok){let e=Error(`Request failed with status ${s.status}`);throw e.response={status:s.status,data:await f5(s,{lenient:!0})},e}let l;return l=i.responseType===`arraybuffer`?await s.arrayBuffer():typeof i.onDownloadProgress==`function`&&s.body?await p5(s.body,s.status,i.onDownloadProgress):await f5(s),{data:l,status:s.status}}finally{clearTimeout(u),s?.removeEventListener(`abort`,d)}}return{get:(e,n)=>t(`GET`,e,void 0,n),post:(e,n,r)=>t(`POST`,e,n,r),put:(e,n,r)=>t(`PUT`,e,n,r),delete:(e,n)=>t(`DELETE`,e,void 0,n)}}function h5(e){let t,n=!1,r=!1,i=$(`div`,`wui-chat-nudge`,{role:`status`});i.hidden=!0;let a=$(`button`,`wui-chat-nudge-text`,{type:`button`}),o=$(`button`,`wui-chat-nudge-close`,{type:`button`});o.append(X2(`x`,14)),i.append(a,o);function s(){clearTimeout(t),t=void 0}function c(){s(),r=!0,i.hidden=!0}a.addEventListener(`click`,()=>{i.hidden=!0,e.onActivate()}),o.addEventListener(`click`,()=>{c(),e.onDismiss()});function l(e){s(),r||n||(t=setTimeout(()=>{t=void 0,a.textContent=e.text,o.setAttribute(`aria-label`,e.label),i.hidden=!1,n=!0},e.delaySeconds*1e3))}function u(){s(),i.remove()}return{el:i,schedule:l,cancel:s,dismiss:c,isShown:()=>n,destroy:u}}var g5=6e4,_5=60*g5,v5=48*_5;function y5(e){if(typeof e!=`string`||e===``)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function b5(e,t=Date.now(),n){let r=y5(e);if(r===null)return``;let i=t-r,a=Math.abs(i),o=i>=0,s=new Intl.RelativeTimeFormat(n,{numeric:`auto`});if(a<g5)return s.format(0,`second`);if(a<_5){let e=Math.floor(a/g5);return s.format(o?-e:e,`minute`)}if(a<v5){let e=Math.floor(a/_5);return s.format(o?-e:e,`hour`)}return new Intl.DateTimeFormat(n,{day:`numeric`,month:`short`,year:`numeric`}).format(new Date(r))}function x5(e,t){let n=y5(e);return n===null?``:new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(n))}function S5(e,t){e.addEventListener(`click`,()=>t()),e.addEventListener(`keydown`,e=>{(Qi(e)||e.key===` `)&&(e.preventDefault(),t())})}function C5(e){let{list:t,getLabels:n,getFeatures:r,onOpen:i}=e,a=e.now??(()=>Date.now()),o=$(`div`,`wui-chat-empty-rows wui-chat-empty-rows--past`);o.hidden=!0;let s=!1;function c(e,t){let n=$(`div`,`card card-pad-sm card-clickable wui-chat-empty-row`,{role:`button`,tabindex:`0`}),r=$(`div`,`card-body wui-chat-empty-row-body`),o=$(`span`,`wui-chat-empty-row-title`);o.textContent=e.title||t.earlierChat;let s=$(`span`,`wui-chat-empty-row-time`,{title:x5(e.lastActivityDateTimeUtc)});return s.textContent=b5(e.lastActivityDateTimeUtc,a()),r.append(o,s),n.append(r),S5(n,()=>i(e.publicId)),n}function l(){if(s)return;let e=t.getState().items;if(r().History!==!0||e.length===0){o.replaceChildren(),o.hidden=!0;return}let i=n();o.replaceChildren(...e.slice(0,20).map(e=>c(e,i))),o.hidden=!1}let u=t.subscribe(l);return{el:o,refresh(){r().History===!0&&t.load().catch(e=>globalThis.reportError?.(e))},paint:l,dispose(){s=!0,u()}}}var w5=`https://www.google.com/recaptcha/api.js?render=`;function T5(e){return e!==void 0&&typeof e.ready==`function`&&typeof e.execute==`function`}var E5=new Map;function D5(e){let t=E5.get(e);if(t!==void 0)return t;let n=new Promise((t,n)=>{let r=globalThis.grecaptcha;if(T5(r)){t(r);return}let i=document.createElement(`script`);i.src=w5+encodeURIComponent(e),i.async=!0;let a=t=>{E5.delete(e),n(Object.assign(Error(t),{code:`captcha_unavailable`}))};i.addEventListener(`load`,()=>{let e=globalThis.grecaptcha;e===void 0||typeof e.ready!=`function`?a(`The reCAPTCHA script loaded without grecaptcha.`):e.ready(()=>{let e=globalThis.grecaptcha;T5(e)?t(e):a(`reCAPTCHA became ready without execute.`)})}),i.addEventListener(`error`,()=>{E5.delete(e),n(Error(`The reCAPTCHA script did not load.`))}),document.head.append(i)});return E5.set(e,n),n}async function O5(e,t){let n=await D5(e);await new Promise(e=>n.ready(()=>e()));let r=await n.execute(e,{action:t});if(!r)throw Object.assign(Error(`reCAPTCHA returned no token.`),{code:`captcha_unavailable`});return r}var k5=`data-wchat-printing`,A5=`data-wchat-print-hide`,j5=`data-wchat-print-path`,M5=`data-wchat-print-target`,N5=new Set([`script`,`style`,`link`,`template`]),P5=null;function F5(){if(P5!==null){for(let e of P5.marked)e.removeAttribute(A5),e.removeAttribute(j5),e.removeAttribute(M5);P5.heading.remove(),document.documentElement.removeAttribute(k5),window.removeEventListener(`afterprint`,P5.onAfterPrint),P5=null}}function I5(e,t,n,r,i){F5();let a=e.querySelector(`.wui-chat-panel`);if(a===null)throw Error(`print needs the wui-chat root`);let o=[],s=a;for(;s!==null&&s!==document.documentElement;){s.setAttribute(j5,``),o.push(s);let e=s.parentElement;if(e===null)throw Error(`print walk left the chat root`);for(let t of e.children)t===s||N5.has(t.localName)||(t.setAttribute(A5,``),o.push(t));s=e}for(let e of n)e.setAttribute(A5,``),o.push(e);r!==null&&(r.setAttribute(M5,``),o.push(r));let c=document.createElement(`div`);c.className=`wui-chat-print-heading`;let l=document.createElement(`h1`);l.textContent=i.title;let u=document.createElement(`p`);u.textContent=i.printedOn,c.append(l,u),a.prepend(c),document.documentElement.setAttribute(k5,t);let d=()=>F5();window.addEventListener(`afterprint`,d,{once:!0}),P5={marked:o,heading:c,onAfterPrint:d};try{window.print()}catch(e){throw F5(),e}}function L5(e,t){I5(e,`conversation`,[],null,t)}function R5(e,t,n){if(!e.contains(t))throw Error(`printReply needs a message inside the wui-chat root`);I5(e,`reply`,Array.from(e.querySelectorAll(`li.wui-chat-message`)).filter(e=>e!==t),t,n)}function z5(){return typeof navigator<`u`&&typeof navigator.share==`function`}async function B5({title:e,text:t}){if(!z5())return`failed`;try{return await navigator.share({title:e,text:t}),`shared`}catch(e){return typeof e==`object`&&e&&`name`in e&&e.name===`AbortError`?`cancelled`:`failed`}}var V5=new Set([`Assistant`,`Agent`,`Script`]),H5=new WeakMap;function U5(e,t,n){let{labels:r,features:i,title:a,busy:o,assistantName:s}=n;if(rr(t.parts)!==``){if(i.Share&&z5()){let n=Q2(`ghost`,r.share,`share`,()=>void(async()=>{let e=J5([t],i,r,a,!1,s);e!==``&&await B5({title:a,text:e})===`failed`&&Q5(n.parentElement,r.shareFailed)})());n.disabled=o===!0,e.append(n)}if(i.Print){let t=Q2(`ghost`,r.print,`printer`,()=>{try{let e=t.closest(`.wui-chat`),n=t.closest(`li.wui-chat-message`);if(!(e instanceof HTMLElement)||!(n instanceof HTMLElement))throw Error(`printReply needs a message inside the wui-chat root`);R5(e,n,{title:a,printedOn:X5(r)})}catch{Z5(t,r.printFailed)}});e.append(t)}}}function W5(e,t,n){if(t.streaming||t.thinking||t.loading||t.conversationId===null||t.messages.filter(e=>e.stored&&V5.has(e.author.kind)&&rr(e.parts)!==``).length===0){e.hidden=!0;return}let{labels:r,features:i}=n,a=!!i.Share&&z5(),o=!!i.Print;if(!a&&!o){e.hidden=!0;return}let s=[a,o,t.messages.length,r.shareConversation,r.printConversation].join(`|`);e.dataset.sig!==s&&(e.dataset.sig=s,e.replaceChildren(),a&&e.append(K5(e,r,i,n)),o&&e.append(q5(e,r,n))),e.hidden=!1}function G5(e,t,n,r){return e.iconOnly?$2(t,n,r):Q2(`ghost`,t,n,r)}function K5(e,t,n,r){return G5(r,t.shareConversation,`share`,()=>void(async()=>{let i=r.getState(),a=Y5(i,r);await B5({title:a,text:J5(i.messages.filter(e=>e.stored),n,t,a,!0,i.profile?.assistant.name)})===`failed`&&Q5(e,t.shareFailed)})())}function q5(e,t,n){let r=G5(n,t.printConversation,`printer`,()=>{try{let r=e.closest(`.wui-chat`);if(!(r instanceof HTMLElement))throw Error(`printConversation needs the wui-chat root`);L5(r,{title:Y5(n.getState(),n),printedOn:X5(t)})}catch{n.iconOnly?Q5(e,t.printFailed):Z5(r,t.printFailed)}});return r}function J5(e,t,n,r,i,a){return mi(fi(e,{labels:n,title:r,figureText:t.FigureText,...a===void 0?{}:{assistantName:a}}),{heading:i,speakers:i})}function Y5(e,t){return typeof e.title==`string`&&e.title!==``?e.title:t.title}function X5(e){return e.printedOn(er(new Date().toISOString()))}function Z5(e,t){let n=e.lastChild;if(!(n instanceof Text))return;let r=H5.get(n);r&&clearTimeout(r.timer);let i=r??{original:n.data};n.data=t,i.timer=setTimeout(()=>{n.data=i.original,H5.delete(n)},Di),H5.set(n,i)}function Q5(e,t){if(!e)return;let n=document.createElement(`span`);n.className=`wui-chat-action-notice`,n.setAttribute(`role`,`status`),n.textContent=t,e.append(n),setTimeout(()=>n.remove(),Di)}var $5=`data-wchat-docked`,e7=`--wui-chat-docked-width`,t7=420,n7=new Set;function r7(e,t){let n=document.documentElement;n.setAttribute($5,e),n.style.setProperty(e7,t)}function i7(){let e=document.documentElement;e.removeAttribute($5),e.style.removeProperty(e7)}function a7(e){let t=o4({...e,layout:`docked`,role:`dialog`,launcher:!0}),n={},r=e.position,i=!1,a=null,o=()=>`${Math.round(t.panel.getBoundingClientRect().width)||t7}px`;function s(){n7.add(n),r7(r,o()),typeof ResizeObserver==`function`&&(a=new ResizeObserver(()=>document.documentElement.style.setProperty(e7,o())),a.observe(t.panel))}function c(){a?.disconnect(),a=null,n7.delete(n),n7.size===0&&i7()}function l(e){t.setOpen(e),e&&!i?(i=!0,s()):!e&&i&&(i=!1,c())}function u(e){t.setAppearance(e),e.position!==void 0&&(r=e.position,i&&document.documentElement.setAttribute($5,r))}function d(){l(!1)}return{...t,setOpen:l,setAppearance:u,destroy:d}}function o7(e){return o4({...e,layout:`embedded`,role:`region`,launcher:!1})}var s7=`wchat:peeked`,c7=576,l7=200;function u7(e){let t=o4({...e,layout:`launcher`,role:`dialog`,launcher:!0}),{root:n,panel:r}=t;if(!t.nudgeHost||!t.launcherButton)throw Error(`a launcher shell always has its launcher`);let i=t.nudgeHost,a=t.launcherButton,o={peek:!1,peekSeconds:3,hideWhileOpen:!1,expressive:!1};a.dataset.state=`closed`;let s=!1,c=!1,l,u,d=()=>o.hideWhileOpen||o.expressive;function f(){!o.peek||s||c||i.dataset.launcher!==`idle`||globalThis.innerWidth<c7||globalThis.sessionStorage.getItem(s7)!==null||(globalThis.sessionStorage.setItem(s7,`1`),i.dataset.launcher=`peeking`,l=setTimeout(()=>{l=void 0,i.dataset.launcher===`peeking`&&(i.dataset.launcher=`idle`)},o.peekSeconds*1e3))}i.addEventListener(`animationend`,e=>{e.target===i&&i.dataset.launcher===`idle`&&f()});function p(e){if(e!==c){if(c=e,clearTimeout(l),l=void 0,e)clearTimeout(u),u=void 0,d()?(i.dataset.launcher=`hidden`,i.toggleAttribute(`inert`,!0)):i.dataset.launcher===`peeking`&&(i.dataset.launcher=`idle`);else if(d()){let e=r.contains(document.activeElement);u=setTimeout(()=>{u=void 0,i.toggleAttribute(`inert`,!1),i.dataset.launcher=`idle`,e&&a.focus()},l7)}}a.dataset.state=e?`open`:`closed`,t.setOpen(e)}function m(e){e.reduced!==void 0&&(s=!!e.reduced),e.peek!==void 0&&(o.peek=e.peek),e.peekSeconds!==void 0&&(o.peekSeconds=e.peekSeconds),e.hideWhileOpen!==void 0&&(o.hideWhileOpen=e.hideWhileOpen),e.expressive!==void 0&&(o.expressive=e.expressive===!0),e.phoneMode!==void 0&&n.classList.toggle(`wui-chat--sheet`,e.phoneMode===`Sheet`),e.sheetHeightDvh!==void 0&&n.style.setProperty(`--wui-chat-sheet-height`,`${e.sheetHeightDvh}dvh`),e.sheetMaxHeightPx!==void 0&&n.style.setProperty(`--wui-chat-sheet-max-height`,`${e.sheetMaxHeightPx}px`),t.setAppearance(e),!d()&&i.dataset.launcher===`hidden`&&!c&&(i.dataset.launcher=`idle`),i.dataset.launcher===`idle`&&f()}return{...t,nudgeHost:i,launcherButton:a,setOpen:p,setAppearance:m}}function d7(e){return o4({...e,layout:`full-page`,role:`region`,launcher:!1})}var f7=new Set([`Agent`,`Customer`]);function p7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-typing`,e.setAttribute(`aria-hidden`,`true`),e.hidden=!0;let t=document.createElement(`span`);t.className=`wui-chat-loader-typing-orb`;let n=document.createElement(`span`);n.className=`wui-chat-loader-typing-dots`;for(let e=0;e<3;e++){let e=document.createElement(`span`);e.className=`wui-chat-loader-typing-dot`,n.append(e)}e.append(t,n);function r({active:n,reduced:r,authorKind:i}){e.hidden=!n,e.classList.toggle(`wui-chat-loader--reduced`,r===!0),t.hidden=f7.has(i)}function i(){e.remove()}return{el:e,update:r,destroy:i}}var m7=3,h7={Primary:`wui-chat-starter--primary`,Cta:`wui-chat-starter--cta`};function g7(e,t){e.addEventListener(`click`,()=>t()),e.addEventListener(`keydown`,e=>{(Qi(e)||e.key===` `)&&(e.preventDefault(),t())})}function _7(e){let t=$(`h2`,`wui-chat-greeting`),n=$(`div`,`wui-chat-empty-hero`),r=$(`p`,`wui-chat-empty-intro`);r.hidden=!0,n.append($(`span`,`wui-chat-orb`,{"aria-hidden":`true`}),t,r);let i=$(`div`,`wui-chat-empty-extra`);i.hidden=!0;let a=$(`div`,`wui-chat-starters`,{role:`group`}),o=$(`div`,`wui-chat-empty-rows`),s=$(`div`,`wui-chat-empty-past`),c=$(`div`,`wui-chat-empty`,{role:`group`}),l=p7();c.append(l.el,n,i,a,o,s);let u;function d(t,n){let r=$(`button`,[`wui-chat-starter`,(t.variant===null?void 0:h7[t.variant])??``].filter(Boolean).join(` `),{type:`button`});return r.style.setProperty(`--wui-chat-i`,String(n)),t.icon&&r.append(X2(t.icon,16)),r.append(document.createTextNode(t.label)),r.addEventListener(`click`,()=>e.onStarter(t)),r}function f(t,n){let r=$(`div`,`card card-pad-sm card-clickable wui-chat-empty-row`,{role:`button`,tabindex:`0`}),i=$(`div`,`card-body wui-chat-empty-row-body`),a=$(`span`,`wui-chat-empty-row-label`);a.textContent=n.resumeLast;let o=$(`span`,`wui-chat-empty-row-title`,{title:t.title||n.untitled});o.textContent=t.title||n.untitled;let s=$(`span`,`wui-chat-empty-row-time`);return s.textContent=er(t.lastActivityDateTimeUtc),i.append(a,o,s),r.append(i),g7(r,()=>e.onResume()),r}function p(t,n,r){let i=r?$(`div`,`card card-pad-sm card-clickable wui-chat-empty-row`,{role:`button`,tabindex:`0`}):$(`div`,`card card-pad-sm wui-chat-empty-row`),a=$(`div`,`card-body wui-chat-empty-row-body`),o=$(`span`,`wui-chat-empty-row-label`);o.textContent=n.ticketAria(t.number);let s=$(`span`,`wui-chat-empty-row-title`);s.textContent=t.subject;let c=$(`span`,`wui-chat-empty-row-status`);return c.textContent=y4(t.status,n),a.append(o,s,c),i.append(a),r&&g7(i,()=>e.onTicket(t)),i}function m(e,t){if(e.features?.OpenTickets!==!0||!e.openTickets?.length)return null;let n=$(`div`,`wui-chat-open-tickets`,{role:`group`,"aria-label":t.openTickets});return n.append(...e.openTickets.slice(0,m7).map(n=>p(n,t,e.ticketsClickable===!0))),n}function h(e){let{labels:n}=e;t.textContent=e.greeting??``;let i=e.intro??``;r.textContent=i,r.hidden=!i,c.setAttribute(`aria-label`,n.emptyTitle);let s=e.starters??[];a.setAttribute(`aria-label`,n.starters),a.hidden=!e.showStarters||s.length===0,a.replaceChildren(...s.map(d));let l=e.resume??null,u=m(e,n);o.hidden=l===null&&u===null,o.replaceChildren(...[l===null?null:f(l,n),u].filter(e=>e!==null))}function g(e){clearTimeout(u),c.classList.remove(`wui-chat-empty--revealed`),c.classList.add(`wui-chat-empty--intro`),l.update({active:!0,reduced:!1,authorKind:`Assistant`}),u=setTimeout(()=>{u=void 0,l.update({active:!1,reduced:!1,authorKind:`Assistant`}),c.classList.replace(`wui-chat-empty--intro`,`wui-chat-empty--revealed`)},e)}return{el:c,paint:h,intro:g,extraHost:i,pastHost:s}}function v7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-orb`;let t=document.createElement(`span`);t.className=`wui-chat-loader-orb-mark`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`span`);n.className=`wui-chat-loader-orb-glow`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`span`);r.className=`wui-chat-loader-orb-disc`,r.setAttribute(`aria-hidden`,`true`),t.append(n,r);let i=document.createElement(`span`);return i.className=`wui-chat-loader-orb-label`,e.append(t,i),{el:e,render(e){i.textContent!==e.label&&(i.textContent=e.label)}}}var y7=150,b7=1800;function x7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-phrases`;let t=document.createElement(`span`);t.className=`wui-chat-loader-phrases-orb`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`span`);n.className=`wui-chat-loader-phrases-stage`,e.append(t,n);let r=null,i=null;function a(){return e.closest(`.wui-chat-loader`)?.classList.contains(`wui-chat-loader--reduced`)===!0}function o(e){if(e.label===r)return;r=e.label;let t=i,o=document.createElement(`span`);o.className=`wui-chat-loader-phrases-text wui-chat-loader-phrases-text--in`,o.textContent=e.label,o.style.animationDelay=`-${Math.round(performance.now()%b7)}ms, 0s`,n.append(o),i=o,t&&(t.classList.remove(`wui-chat-loader-phrases-text--in`),t.classList.add(`wui-chat-loader-phrases-text--out`),t.style.animationDelay=`-${Math.round(performance.now()%b7)}ms, 0s`,a()?t.remove():setTimeout(()=>t.remove(),y7))}return{el:e,render:o}}var S7=[`95%`,`80%`,`60%`];function C7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-skeleton`;let t=document.createElement(`div`);t.className=`wui-chat-loader-skeleton-label`;let n=document.createElement(`div`);n.className=`wui-chat-loader-skeleton-body`;let r=document.createElement(`span`);r.className=`wui-chat-loader-skeleton-avatar`,r.setAttribute(`aria-hidden`,`true`),n.append(r);for(let e of S7){let t=document.createElement(`span`);t.className=`wui-chat-loader-skeleton-line`,t.setAttribute(`aria-hidden`,`true`),t.style.width=e,n.append(t)}return e.append(t,n),{el:e,render(e){t.textContent!==e.label&&(t.textContent=e.label)}}}var w7=`http://www.w3.org/2000/svg`;function T7(e){if(e===`done`){let e=document.createElementNS(w7,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`wui-chat-loader-steps-check`);let t=document.createElementNS(w7,`path`);return t.setAttribute(`d`,`M3 8.5 6.5 12 13 4.5`),t.setAttribute(`pathLength`,`1`),e.append(t),e}let t=document.createElement(`span`);return t.className=e===`active`?`wui-chat-loader-steps-ring`:`wui-chat-loader-steps-dot`,t}function E7(){let e=document.createElement(`div`);e.className=`wui-chat-loader-steps`;let t=document.createElement(`span`);t.className=`wui-chat-loader-steps-pill`;let n=document.createElement(`ol`);n.className=`wui-chat-loader-steps-list`,e.append(t,n);let r=[];function i(){let e=document.createElement(`li`);e.className=`wui-chat-loader-steps-item`;let t=document.createElement(`span`);t.className=`wui-chat-loader-steps-icon`,t.setAttribute(`aria-hidden`,`true`);let i=document.createElement(`span`);i.className=`wui-chat-loader-steps-text`,e.append(t,i);let a={li:e,icon:t,text:i,state:null};return r.push(a),n.append(e),a}function a(e){let a=e.steps.length===0;for(t.hidden=!a,n.hidden=a,a&&t.textContent!==e.label&&(t.textContent=e.label),e.steps.forEach((t,n)=>{let a=r[n]??i();a.text.textContent!==t&&(a.text.textContent=t);let o=n<e.activeIndex?`done`:n===e.activeIndex?`active`:`pending`;a.state!==o&&(a.state=o,a.li.dataset.state=o,a.icon.replaceChildren(T7(o)))});r.length>e.steps.length;)r.pop()?.li.remove()}return{el:e,render:a}}var D7={Steps:E7,Phrases:x7,Orb:v7,Skeleton:C7},O7=500;function k7(){let e=document.createElement(`div`);e.className=`wui-chat-loader`,e.setAttribute(`role`,`status`),e.hidden=!0;let t=document.createElement(`span`);t.className=`wui-chat-loader-avatar`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`div`);n.className=`wui-chat-loader-body`;let r=document.createElement(`span`);r.className=`visually-hidden`,e.append(t,n,r);let i=null,a=null,o=0,s=null,c=0,l=null,u=!1;function d(){s!==null&&clearInterval(s),s=null}function f(){e.isConnected?(o+=1,p()):d()}function p(){if(!a||!i)return;let t=Ie(i.style,i.steps,i.phrases,o);a.render(t),e.setAttribute(`aria-label`,t.label)}function m(){l!==null&&clearTimeout(l),l=null,u=!1,r.textContent=``}function h(e){!u&&l===null&&e&&(l=setTimeout(()=>{l=null,u=!0,r.textContent=e},O7))}function g(t){if(!t.active)i=null,e.hidden=!0,e.removeAttribute(`data-loading`),d(),m();else{if(!Y2(D7,t.style))throw Error(`Unknown loader style. Use Steps, Phrases, Orb or Skeleton.`);if(!(t.intervalMs>0))throw Error(`Loader intervalMs must be a positive number.`);if(i={...t,steps:t.steps??[],phrases:t.phrases??[]},e.hidden=!1,e.setAttribute(`data-loading`,`true`),e.classList.toggle(`wui-chat-loader--reduced`,t.reduced===!0),!a||a.style!==t.style){let r=D7[t.style]();n.replaceChildren(r.el),a={style:t.style,render:r.render},e.dataset.style=t.style,o=0}h(t.announce),t.reduced===!0?(d(),o=0):(s===null||c!==t.intervalMs)&&(d(),c=t.intervalMs,s=setInterval(f,c)),p()}}function _(){d(),m(),a=null,i=null,e.remove()}return{el:e,update:g,destroy:_}}function A7({voice:e,getLabels:t,message:n}){if(n.streaming||!e.canSpeak()||W8(n.parts)===``)return null;let r=e.getStatus(),i=r.mode===`Speaking`&&r.messageId===n.id,a=t(),o=i?a.readAloudStop:a.readAloud,s=$(`button`,`wui-chat-action-btn wui-chat-speak`,{type:`button`,"aria-pressed":String(i),"aria-label":o,title:o});return s.append(g8(i?`stop`:`speaker`,16)),s.addEventListener(`click`,()=>{e.toggleSpeak(n.id,n.parts)}),s}function j7({voice:e,getLabels:t,message:n}){let r=e.getStatus().note;if(r?.code!==`SpeakFailed`||r.messageId!==n.id)return null;let i=$(`span`,`wui-chat-action-notice`,{role:`status`});return i.textContent=G8(r,t()),i}function M7(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.author.kind===`Visitor`&&n.stored)return n}}var N7=new Set([`Assistant`,`Agent`]),P7=new Set([`Assistant`,`Agent`,`Script`]),F7=new Set([`Visitor`,`Customer`]),I7=48,L7=120,R7={author:{kind:`Assistant`,displayName:null,avatarUrl:null}},z7={warning:`alert-triangle`,danger:`alert-circle`};function B7(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=I7}function V7(e){let{kind:t,displayName:n}=e.author;return t===`Agent`?`Agent:${n??``}`:t===`Script`?`Assistant`:t}function H7(e){for(let t=e?.parentElement;t&&t!==document.body;t=t.parentElement){let{overflowY:e}=getComputedStyle(t);if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t}return null}function U7(e){let t=e.textContent?.trim();t&&!e.hasAttribute(`aria-label`)&&(e.setAttribute(`aria-label`,t),e.setAttribute(`title`,t))}function W7(e){return e.reduced===!0}function G7(e,t,n){let r=$(`button`,`${Z2(`ghost`,`sm`)} wui-chat-action-btn`,{type:`button`,"aria-label":e,title:e}),i=$(`span`);return i.textContent=e,r.append(X2(t,14),i),r.addEventListener(`click`,n),{node:r,text:i}}function K7(e,t){return e.profile?.assistant.name??t.panelTitle}function q7(e,t,n){return e.author.displayName==null?e.author.kind===`Visitor`||e.author.kind===`Customer`?n.you:e.author.kind===`Agent`?n.agent:t.profile?.assistant.name??n.assistant:e.author.displayName}function J7(e){let t=$(`li`,`wui-chat-day`,{role:`presentation`}),n=$(`span`);return n.textContent=e,t.append(n),t}function Y7(e){let t=$(`ol`,`wui-chat-thread`),n=$(`div`,`wui-chat-log`,{role:`log`,"aria-live":`polite`});n.append(t);let r=k7(),i=$(`li`,`wui-chat-message wui-chat-message--assistant wui-chat-message--loading`),a=$(`div`,`wui-chat-loader-slot`);a.append(r.el),i.append(a);let o=!1,s,c=$(`li`,`wui-chat-message wui-chat-message--assistant wui-chat-message--greeting`,{"data-run-start":``,"data-restored":``}),l=$(`div`,`wui-chat-message-body`),u=$(`p`,`wui-chat-text`);l.append(u),c.append(l);let d=$(`button`,`wui-chat-jump`,{type:`button`}),f=$(`div`,`wui-chat-jump-slot`);f.hidden=!0,f.append(d);let p=null,m=!0,h=null,g=null,_=new Map,v=``,y=null;function b(e,t){return{kind:e.kind,part:e,tag:t[e.kind]}}function x(t,n,r){return Object.assign(document.createElement(t),{message:r,turn:e.makeTurnApi(r.id),chatPart:n})}function S(e){return $(`div`,`wui-chat-part wui-chat-part--${e.toLowerCase()}`)}function C(e,t,n,r){e.parts=[];let i=[],a=e=>{let r=b(e,n),i=S(r.kind);return i.append(x(r.tag,r.part,t)),i};for(let e of r(t))if(Array.isArray(e)){let t=$(`div`,`wui-chat-part-group`);t.append(...e.map(a)),i.push(t)}else i.push(a(e));e.body.replaceChildren(...i)}function w(t,n,r){let i=[];n.parts.forEach((a,o)=>{let s=b(a,r),c=t.parts[o];if(c&&c.kind===s.kind&&c.tag===s.tag){c.part!==s.part&&(c.element.message=n,c.element.turn=e.makeTurnApi(n.id),c.element.chatPart=s.part,c.part=s.part),i.push(c);return}let l=S(s.kind),u=x(s.tag,s.part,n);l.append(u),i.push({kind:s.kind,tag:s.tag,part:s.part,element:u,wrapper:l})}),t.parts=i,T(t.body,i.map(e=>e.wrapper))}function T(e,t){let n=new Set(t);for(let t of[...e.children])n.has(t)||t.remove();t.forEach((t,n)=>{e.children[n]!==t&&e.insertBefore(t,e.children[n]??null)})}function E(e,t,n){let r=$(`div`,`wui-chat-rating`,{role:`group`,"aria-label":`${n.rateUp} / ${n.rateDown}`}),i=[[`Up`,n.rateUp,`thumbs-up`],[`Down`,n.rateDown,`thumbs-down`]];for(let[a,o,s]of i){let i=t.rating===a,c=$(`button`,`${Z2(i?`neutral`:`ghost`,`sm`)} wui-chat-action-btn`,{type:`button`,"aria-pressed":String(i),"data-rating":a,"aria-label":o,title:o}),l=$(`span`);l.textContent=o,c.append(X2(s,14),l),c.addEventListener(`click`,()=>D(e,t,a,n)),r.append(c)}if(e.ratingNote){let t=$(`span`,null,{role:`status`});t.textContent=e.ratingNote,r.append(t)}return r}async function D(t,n,r,i){try{await e.onRate(n.id,r),t.ratingNote=i.rated}catch{t.ratingNote=i.ratingFailed}y&&ce(y.state,y.context)}function O(t,n,r,i,a){let{labels:o}=i,s=r.features,c=n.author.kind,l=rr(n.parts),u=[];if(s.Copy&&P7.has(c)&&l){let e=G7(o.copy,`copy`,()=>void(async()=>{await Oi(l)&&(e.text.textContent=o.copied,e.node.dataset.done=``,e.node.setAttribute(`aria-label`,o.copied),e.node.title=o.copied,clearTimeout(t.copyTimer),t.copyTimer=setTimeout(()=>{e.text.textContent=o.copy,delete e.node.dataset.done,e.node.setAttribute(`aria-label`,o.copy),e.node.title=o.copy},Di))})());u.push(e.node)}let d=e.getVoice?.();if(d&&P7.has(c)){let e=A7({voice:d,getLabels:()=>o,message:n});e&&u.push(e);let t=j7({voice:d,getLabels:()=>o,message:n});t&&u.push(t)}if(P7.has(c)){let e=$(`div`);U5(e,n,{labels:o,features:s,title:K7(r,o),assistantName:r.profile?.assistant.name,busy:r.streaming||r.thinking});for(let t of e.children)U7(t);u.push(...e.childNodes)}let f=r.messages.some(e=>e.author.kind===`Visitor`&&e.stored);a&&c===`Assistant`&&!r.streaming&&!r.thinking&&s.Regenerate&&f&&u.push(G7(o.regenerate,`refresh`,()=>e.onRegenerate()).node);let p=M7(r.messages);s.Edit&&p?.id===n.id&&!r.streaming&&!r.thinking&&u.push(G7(o.edit,`pencil`,()=>e.getSession().startEdit(n.id)).node),s.Rating&&n.stored&&N7.has(c)&&u.push(E(t,n,o)),t.actions.hidden=u.length===0,t.actions.replaceChildren(...u)}function k(e){let t=_.get(e.id);if(t)return t;let n=$(`li`,`wui-chat-message`),r=$(`span`,`wui-chat-author visually-hidden`),i=$(`div`,`wui-chat-message-body`),a=$(`div`,`wui-chat-message-actions`);n.append(r,i,a);let o={li:n,author:r,body:i,actions:a,head:null,parts:[],copyTimer:void 0,ratingNote:null};return _.set(e.id,o),o}function A(e,t,n,r){let i=n?.author.kind===`Agent`&&t.author.kind===`Agent`&&(n.author.displayName??``)===(t.author.displayName??``);e.head?.remove(),e.head=t.author.kind===`Agent`&&!i?g4(t.author,r):null,e.head&&e.li.insertBefore(e.head,e.body)}function j(t,n,r,i,a,o){let{labels:s}=i;t.li.className=`wui-chat-message wui-chat-message--${n.author.kind.toLowerCase()}`,t.li.toggleAttribute(`data-restored`,n.restored===!0),t.li.toggleAttribute(`data-run-start`,!o||V7(o)!==V7(n)),n.streaming?t.li.setAttribute(`aria-busy`,`true`):t.li.removeAttribute(`aria-busy`),t.author.textContent=`${q7(n,r,s)}: `,A(t,n,o,s);let c=e.getRenderers(),l=e.getLayoutParts();typeof l==`function`?C(t,n,c,l):w(t,n,c),n.streaming?(t.actions.hidden=!0,t.actions.replaceChildren()):O(t,n,r,i,a)}function ee(e,t){let n=$(`li`,`wui-chat-message wui-chat-message--system wui-chat-message--notice`),r=$(`div`,`wui-chat-notice wui-chat-notice--${e}`,{role:e===`danger`?`alert`:`status`}),i=$(`span`,`wui-chat-notice-icon`,{"aria-hidden":`true`});i.append(X2(z7[e],16));let a=$(`div`,`wui-chat-notice-body`),o=$(`span`,`wui-chat-notice-text`);return o.textContent=t,a.append(o),r.append(i,a),n.append(r),n}function te(e,t){let n=e.resetsDateTimeUtc?` ${t.dailyLimitRefresh(x5(e.resetsDateTimeUtc))}`:``;return ee(`warning`,`${e.message}${n}`)}function ne(t,n){let{labels:r}=n,i=t.turnError,a=i?.code??``;if(i&&a===`daily_limit`)return te(i,r);if(a.endsWith(`feature_off`))return ee(`danger`,t.turnError?.message||r.stopped);let o=$(`li`,`wui-chat-message wui-chat-message--system wui-chat-message--error`),s=$(`p`,`wui-chat-error`,{role:`alert`});s.textContent=t.turnError?.message||r.stopped;let c=X2(`alert-circle`,16);if(c.setAttribute(`aria-hidden`,`true`),o.append(c,s),t.features.Retry){let t=$(`div`,`wui-chat-message-actions`);t.append(G7(r.retry,`rotate-ccw`,()=>e.onRetry()).node),o.append(t)}return o}function re(){return t.closest(`.wui-chat`)}function ie(){return t.closest(`.wui-chat-body`)??H7(t)}function ae(e){re()?.classList.toggle(`wui-chat--scrolled`,e.scrollTop>0),B7(e)&&(f.hidden=!0)}function M(){p!==null&&(m=B7(p),ae(p))}function oe(e){n.nextElementSibling!==f&&n.parentNode&&n.after(f),e!==p&&(p?.removeEventListener(`scroll`,M),p=e,e.addEventListener(`scroll`,M,{passive:!0}),!h&&typeof ResizeObserver==`function`&&(h=new ResizeObserver(()=>{m&&p&&(p.scrollTop=p.scrollHeight)}),h.observe(t)))}d.addEventListener(`click`,()=>{let e=ie(),t=y?.context.reduced===!0;e?.scrollTo({top:e.scrollHeight,behavior:t?`auto`:`smooth`}),f.hidden=!0,d.blur()});function se(e,t){let n=e.messages[e.messages.length-1],r=n?`${n.id}|${n.parts.length}|${rr(n.parts).length}`:``;if(r===v)return;let i=v===``||e.conversationId!==g;v=r,g=e.conversationId;let a=ie();a&&(oe(a),i||t||n!==void 0&&F7.has(n.author.kind)?(a.scrollTop=a.scrollHeight,f.hidden=!0,m=!0):(f.hidden=!1,m=!1),ae(a))}function ce(e,a){y={state:e,context:a};let{labels:l}=a;n.setAttribute(`aria-label`,l.thread),d.textContent=l.newMessages??`New messages`;let f=ie();f&&oe(f);let p=f===null||f.clientHeight===0||B7(f),m=[],h=new Set,g=e.messages.filter(e=>!(e.streaming&&e.parts.length===0)),v=g[0],b=v!==void 0&&F7.has(v.author.kind)&&e.greeting?e.greeting:null,x=null,S=e=>{let t=nr(e.createdDateTimeUtc,l);t!==x&&(x=t,m.push(J7(t)))};b&&v&&(S(v),u.textContent=b,m.push(c)),g.forEach((t,n)=>{let r=k(t);h.add(t.id),S(t);let i=g[n-1]??(b?R7:null);j(r,t,e,a,n===g.length-1,i),m.push(r.li)});for(let e of[..._.keys()])h.has(e)||_.delete(e);e.agentTyping&&m.push(_4(e.agentTyping,l)),e.thinking?(clearTimeout(s),s=void 0,i.classList.remove(`wui-chat-message--leaving`),o=!0,r.update({active:!0,style:a.loaderStyle,steps:e.steps,phrases:a.phrases,intervalMs:a.intervalMs,reduced:a.reduced,announce:a.assistantName?.trim()?l.preparingAnswer(a.assistantName):void 0}),m.push(i)):o&&s===void 0&&!W7(a)?(i.classList.add(`wui-chat-message--leaving`),s=setTimeout(()=>{s=void 0,o=!1,i.classList.remove(`wui-chat-message--leaving`),r.update({active:!1}),y&&ce(y.state,y.context)},L7),m.push(i)):s===void 0?(o=!1,r.update({active:!1})):m.push(i),!e.streaming&&(e.turnError||e.stopped)&&m.push(ne(e,a)),T(t,m),se(e,p)}function le(e){return _.get(e)?.li??null}function ue(){clearTimeout(s),r.destroy(),p?.removeEventListener(`scroll`,M),h?.disconnect(),_.clear(),y=null,n.remove()}return{el:n,paint:ce,find:le,destroy:ue}}var X7=`wchat:auto-opened`,Z7=`wchat:dismissed`,Q7=`button, a[href], input, select, textarea`,$7=`input, textarea`;function e9(e){return!e.closest(`.wui-chat`)}function t9(e){return e instanceof Element&&e.matches($7)&&e9(e)}function n9(){return[...document.querySelectorAll($7)].some(e=>e9(e)&&e.value!==e.defaultValue)}function r9(e){return e.length!==0&&[...document.querySelectorAll(e.join(`,`))].some(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0})}function i9(e){return e?[...document.querySelectorAll(Q7)].some(t=>{if(!e9(t))return!1;let n=t.getBoundingClientRect();return n.width===0||n.height===0?!1:n.left<e.right&&n.right>e.left&&n.top<e.bottom&&n.bottom>e.top}):!1}function a9(e,t,n){if(e.oncePerSession&&sessionStorage.getItem(X7)||e.rememberDismissal&&sessionStorage.getItem(Z7)||window.innerWidth<e.skipBelowWidthPx)return!0;let r=window.location.pathname;if(e.skipPathPrefixes.some(e=>r.startsWith(e)))return!0;let i=t.avoid.autoOpenOptOutSelector;return i&&document.querySelector(i)||e.skipWhenFormTouched&&n9()||n.isOpen()?!0:e.skipWhenCoversControl&&i9(n.panelRect())}function o9(e){return t9(document.activeElement)||r9(e.avoid.menuSelectors)||r9(e.avoid.autoOpenBusySelectors)}function s9(e,t,n){let r;function i(){r=void 0,a9(e,t,n)||(o9(t)?r=setTimeout(i,e.busyRetrySeconds*1e3):(sessionStorage.setItem(X7,`1`),n.open()))}return r=setTimeout(i,e.delaySeconds*1e3),{cancel(){clearTimeout(r),r=void 0}}}var c9=.4,l9=20;function u9(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function d9(e){let t=e.match(/[\d.]+/g);if(!t||t.length<3)return null;let[n=0,r=0,i=0]=t.slice(0,3).map(Number);return{r:n,g:r,b:i,alpha:t.length>3?Number(t[3])/(e.includes(`%`)?100:1):1}}function f9({r:e,g:t,b:n}){return .2126*u9(e)+.7152*u9(t)+.0722*u9(n)}function p9(e,t){let n=e.getBoundingClientRect(),r=document.elementsFromPoint?.(n.left+n.width/2,n.top+n.height/2)??[],i=t.length?t.join(`,`):null;for(let t of r){if(e.contains(t))continue;if(i&&t.closest(i))return!0;let n=d9(getComputedStyle(t).backgroundColor);if(n&&n.alpha>0)return f9(n)<c9}return!1}function m9(e){return e.length===0?[]:[...document.querySelectorAll(e.join(`,`))]}function h9(e){let t=0;for(let n of e){let e=n.getBoundingClientRect();e.height!==0&&(t=Math.max(t,window.innerHeight-e.top))}return t>0?t+l9:0}function g9(e){if(e.length===0)return!1;for(let t of document.querySelectorAll(e.join(`,`))){let e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return!0}return!1}function _9(e,t,n){let r=n.ownerDocument.documentElement,i=0,a=!1,o=null;function s(){i=0;let s=t.liftAboveFooter?m9(e.liftSelectors):[];if(o)for(let e of s)o.observe(e);n.style.setProperty(`--wui-chat-lift`,`${h9(s)}px`);let c=n.getBoundingClientRect(),l=c.height===0?0:Math.round(window.innerHeight-c.top);r.style.setProperty(`--wui-chat-launcher-block`,`${l}px`);let u=t.stepAsideForMenus&&g9(e.menuSelectors);u&&!a?(n.dataset.launcher=`hidden`,n.inert=!0,a=!0):!u&&a&&(n.dataset.launcher=`idle`,n.inert=!1,a=!1);let d=t.switchOnDark&&p9(n,e.darkSelectors);d&&n.dataset.onDark===void 0&&(n.dataset.onDark=``),!d&&n.dataset.onDark!==void 0&&delete n.dataset.onDark}function c(){i||=requestAnimationFrame(s)}typeof ResizeObserver==`function`&&(o=new ResizeObserver(c));let l=new MutationObserver(c);return l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`,`open`,`data-menu-open`]}),document.addEventListener(`scroll`,c,{capture:!0,passive:!0}),window.addEventListener(`resize`,c),window.addEventListener(`load`,c),n.addEventListener(`animationend`,c),c(),{destroy(){i&&cancelAnimationFrame(i),i=0,o?.disconnect(),l.disconnect(),document.removeEventListener(`scroll`,c,{capture:!0}),window.removeEventListener(`resize`,c),window.removeEventListener(`load`,c),n.removeEventListener(`animationend`,c),a&&=(n.inert=!1,!1),delete n.dataset.onDark,n.style.removeProperty(`--wui-chat-lift`),r.style.removeProperty(`--wui-chat-launcher-block`)}}}var v9=`wchat:session-start`,y9=`wchat:pages`,b9=`wchat:services`;function x9(e){let t=sessionStorage.getItem(e);return t?JSON.parse(t):[]}function S9(e,t){sessionStorage.setItem(e,JSON.stringify(t))}function C9(e,t){let n=t.find(t=>e.startsWith(t));return n===void 0?null:e.slice(n.length).replace(/^\/+|\/+$/g,``)||null}function w9(e){sessionStorage.getItem(v9)||sessionStorage.setItem(v9,String(Date.now()));let t=0;function n(){let e=document.documentElement.scrollHeight;if(e<=0)return;let n=(window.scrollY+window.innerHeight)/e*100;n>t&&(t=n)}return window.addEventListener(`scroll`,n,{passive:!0}),function(){n();let r=window.location.pathname,i=x9(y9);i.includes(r)||(i.push(r),S9(y9,i));let a=C9(r,e),o=x9(b9);return a!==null&&(o=o.filter(e=>e!==a),o.push(a),o=o.slice(-10),S9(b9,o)),{timeOnSiteSeconds:Math.floor((Date.now()-Number(sessionStorage.getItem(v9)))/1e3),scrollPercent:Math.min(100,Math.floor(t)),pagesViewed:i.length,viewedServices:o}}}var Aee=`a[href],button:not([disabled]),input:not([disabled]):not([type='hidden']),select:not([disabled]),textarea:not([disabled]),[tabindex]`;function jee(e,t){if(t.key!==`Tab`)return;let n=[...e.querySelectorAll(Aee)].filter(e=>e.tabIndex>=0&&!e.hidden),r=n[0],i=n[n.length-1];if(!r||!i){t.preventDefault();return}let a=e.ownerDocument.activeElement,o=e.contains(a);t.shiftKey?o&&a!==r||(t.preventDefault(),i.focus()):o&&a!==i||(t.preventDefault(),r.focus())}function Mee(e){e?.isConnected&&e.focus()}function Nee(e,t){if(t||typeof navigator>`u`)return;let n=navigator;typeof n.vibrate==`function`&&n.vibrate(e)}var T9=`wui-chat-lock`,E9=`wui-chat-scroll-lock`;function Pee(e){let t=e.ownerDocument,n=[t.documentElement,t.body],r=e.style.overscrollBehavior;for(let e of n)e.classList.add(T9);e.setAttribute(`data-lenis-prevent`,``),e.style.overscrollBehavior=`contain`,window.dispatchEvent(new CustomEvent(E9,{detail:{locked:!0}}));let i=!0;return function(){if(i){i=!1;for(let e of n)e.classList.remove(T9);e.removeAttribute(`data-lenis-prevent`),e.style.overscrollBehavior=r,window.dispatchEvent(new CustomEvent(E9,{detail:{locked:!1}}))}}}var Fee={open:{from:420,to:920,seconds:.16,peak:.16},reply:{from:680,to:540,seconds:.11,peak:.06},sent:{from:540,to:760,seconds:.09,peak:.05}},D9=[`pointerdown`,`keydown`,`touchstart`],O9=`wchat:muted`,Iee=1e-4;function Lee(e,t){let n=t.get(O9)===`1`,r=null;function i(){for(let e of D9)document.removeEventListener(e,a)}function a(){let e=globalThis.AudioContext||globalThis.webkitAudioContext;!r&&e&&(r=new e),r?.state===`suspended`&&r.resume().catch(e=>globalThis.reportError?.(e)),i()}for(let e of D9)document.addEventListener(e,a);return{play(t){let i=Fee[t];if(!i||n||!r||!e[t]||!(e.volume>0))return;let a=r.currentTime,o=r.createOscillator(),s=r.createGain();o.type=`sine`,o.frequency.setValueAtTime(i.from,a),o.frequency.linearRampToValueAtTime(i.to,a+i.seconds),s.gain.setValueAtTime(i.peak*e.volume,a),s.gain.exponentialRampToValueAtTime(Iee,a+i.seconds),o.connect(s),s.connect(r.destination),o.start(a),o.stop(a+i.seconds)},setMuted(e){n=!!e,t.set(O9,n?`1`:`0`)},isMuted(){return n},destroy(){i(),r?.close().catch(e=>globalThis.reportError?.(e)),r=null}}}var Ree=2e3,zee=500,Bee=32,k9=16,A9=`data-wchat-switching`;function Vee(e){return new Promise(t=>setTimeout(t,e))}function j9(e,t){return typeof e!=`function`||e()?Promise.resolve():new Promise(n=>{let r=0,i=()=>{e()||r>=t?n():(r+=k9,setTimeout(i,k9))};setTimeout(i,k9)})}async function Hee(e,t={}){let n=t.reduced??globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;if(typeof document.startViewTransition!=`function`||n){await e();return}let r=document.documentElement;r.setAttribute(A9,``);try{let n=()=>!t.target||document.querySelector(`.wui-chat--${t.target}`)!==null,r=()=>(typeof t.pageReady!=`function`||t.pageReady())&&n(),i=document.startViewTransition(async()=>{await e(),await j9(t.routeReady,Ree),await j9(r,zee),await Vee(Bee)});Promise.allSettled([i.ready]);try{await i.updateCallbackDone}finally{await Promise.allSettled([i.finished])}}finally{r.removeAttribute(A9)}}var Uee=100,Wee=12,Gee=220,Kee=640;function M9(e,t){let n=t.phone.mode===`Sheet`,r=window.visualViewport,i;function a(){e.style.removeProperty(`bottom`),e.style.removeProperty(`max-height`)}function o(){if(i=void 0,window.innerWidth>t.phone.maxWidthPx){a();return}if(!r)return;let o=Math.max(0,window.innerHeight-r.height-r.offsetTop),s=r.height-Wee;n&&(s=Math.min(Kee,Math.max(Gee,s))),e.style.bottom=`${o}px`,e.style.maxHeight=`${s}px`}function s(){clearTimeout(i),i=setTimeout(o,Uee)}return r?.addEventListener(`resize`,s),r?.addEventListener(`scroll`,s),window.addEventListener(`resize`,s),window.addEventListener(`orientationchange`,s),o(),{destroy(){clearTimeout(i),r?.removeEventListener(`resize`,s),r?.removeEventListener(`scroll`,s),window.removeEventListener(`resize`,s),window.removeEventListener(`orientationchange`,s),a()}}}var N9=[`launcher`,`docked`,`full-page`,`embedded`],P9=[`end`,`start`],F9={steps:`Steps`,phrases:`Phrases`,orb:`Orb`,skeleton:`Skeleton`},qee={on:`On`,reduced:`Reduced`},Jee=[`auto`,`light`,`dark`];function Yee(e){return Jee.find(t=>t===e)??`auto`}var Xee=`wchat:muted`,Zee=6e4,Qee=400,$ee=[`labels`,`pageContext`,`compact`,`expressive`,`open`,`layoutParts`,`getCaptchaToken`,`attribution`,`openAttachment`,`openCitation`,`openTarget`,`openTicket`,`onNavigate`,`resolveLink`,`emptyContent`,`onPanelSwitch`,`preloadPanelSwitch`],I9={...x8};function L9(e,t){if(!r4.includes(e))throw Error(`Unknown part kind "${e}". Use one of ${r4.join(`, `)}.`);if(typeof t!=`string`||!t.includes(`-`))throw Error(`Renderer tag "${t}" must be a custom element name containing a hyphen.`)}function ete(e,t){L9(e,t),I9[e]=t}function R9(e,t){return n=>{let r=n.toLowerCase(),i=Y2(t,r)?t[r]:void 0;if(i===void 0)throw Error(`<wui-chat ${e}> must be one of ${Object.keys(t).join(`, `)}, got "${n}".`);return i}}function z9(e){return t=>{let n=Number(t);if(!Number.isInteger(n)||n<0)throw Error(`<wui-chat ${e}> must be a whole number of pixels, got "${t}".`);return n}}function B9(e){return t=>{if(t===``||t===`true`)return!0;if(t===`false`)return!1;throw Error(`<wui-chat ${e}> must be true or false, got "${t}".`)}}var V9=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),H9=[[`launcher-style`,`launcher`,`style`,R9(`launcher-style`,{round:`Round`,pill:`Pill`})],[`entrance`,`launcher`,`entrance`,R9(`entrance`,{"slide-up":`SlideUp`,"bounce-in":`BounceIn`,"fade-in-pulse":`FadeInPulse`,"spin-scale":`SpinScale`,"wiggle-in":`WiggleIn`,"elastic-in":`ElasticIn`,rise:`Rise`,none:`None`})],[`idle`,`launcher`,`idle`,R9(`idle`,{"float-and-pulse":`FloatAndPulse`,ring:`Ring`,none:`None`})],[`label-reveal`,`launcher`,`labelReveal`,R9(`label-reveal`,{bubble:`Bubble`,expand:`Expand`})],[`compact`,`launcher`,`compact`,B9(`compact`)],[`launcher-mark`,`launcher`,`mark`,R9(`launcher-mark`,{icon:`Icon`,avatar:`Avatar`,orb:`Orb`})],[`panel-height`,`panel`,`height`,R9(`panel-height`,{fixed:`Fixed`,content:`Content`})],[`reply-avatars`,`panel`,`replyAvatars`,B9(`reply-avatars`)],[`greeting-loader-ms`,`panel`,`greetingLoaderMs`,z9(`greeting-loader-ms`)],[`panel-motion`,`panel`,`motion`,R9(`panel-motion`,{spring:`Spring`,gentle:`Gentle`,none:`None`})],[`panel-width`,`panel`,`widthPx`,z9(`panel-width`)],[`panel-max-height`,`panel`,`maxHeightPx`,z9(`panel-max-height`)],[`panel-bottom-gap`,`panel`,`bottomGapPx`,z9(`panel-bottom-gap`)],[`phone-max-width`,`phone`,`maxWidthPx`,z9(`phone-max-width`)],[`phone-mode`,`phone`,`mode`,R9(`phone-mode`,{"full-screen":`FullScreen`,sheet:`Sheet`})],[`sheet-height-dvh`,`phone`,`sheetHeightDvh`,z9(`sheet-height-dvh`)],[`sheet-max-height`,`phone`,`sheetMaxHeightPx`,z9(`sheet-max-height`)],[`input-ring`,`input`,`ring`,B9(`input-ring`)],[`send-reveal`,`input`,`sendReveal`,R9(`send-reveal`,{"on-text":`OnText`,always:`Always`})],[`send-icon`,`input`,`sendIcon`,e=>e],[`lift-selectors`,`avoid`,`liftSelectors`,V9],[`menu-selectors`,`avoid`,`menuSelectors`,V9],[`dark-selectors`,`avoid`,`darkSelectors`,V9],[`autoopen-busy-selectors`,`avoid`,`autoOpenBusySelectors`,V9],[`autoopen-optout-selector`,`avoid`,`autoOpenOptOutSelector`,e=>e]],U9={layout:`launcher`,position:`end`,"offset-x":`24`,"offset-y":`24`,loader:`steps`,motion:`on`,icon:`chat`},W9=[`base`,`layout`,`position`,`offset-x`,`offset-y`,`loader`,`screen`,`motion`,`theme`,`icon`,`avatar`,`narrow`,...H9.map(([e])=>e).filter(e=>e!==`compact`)],tte=e=>e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase());function G9(e){let t={launcher:{},panel:{},phone:{},input:{},avoid:{}};for(let[n,r,i,a]of H9){let o=e.getAttribute(n);o!=null&&(t[r][i]=a(o))}let n=e.getAttribute(`motion`),r=e.getAttribute(`avatar`),i=e.getAttribute(`expressive`);return Sr({...t,...n==null?{}:{motion:R9(`motion`,qee)(n)},...r?{avatar:r}:{},...i==null?{}:{expressive:B9(`expressive`)(i)}})}function nte(e){let t=e.getAttribute(`loader`)??`steps`,n=Y2(F9,t)?F9[t]:void 0;if(n===void 0)throw Error(`<wui-chat loader> must be one of ${Object.keys(F9).join(`, `)}, got "${t}".`);return n}function rte(e){let t=e.getAttribute(`narrow`);if(t!=null&&t!==``)return Object.fromEntries(V9(t).map(e=>[e,!1]))}function K9(e){return e===Xee?globalThis.localStorage:globalThis.sessionStorage}var q9={get:e=>K9(e).getItem(e),set:(e,t)=>K9(e).setItem(e,t)};function J9(e){return globalThis.innerWidth<=e.phone.maxWidthPx}function ite(e){let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)}function ate(e){return e.features.HumanHandoff===!0&&e.conversationState===`Open`&&e.messages.some(e=>e.author.kind===`Visitor`||e.author.kind===`Customer`)&&!e.streaming&&!e.thinking}function ote(e,t){if(e.conversationState===`WaitingForAgent`)return t.statusWaitingForAgent;if(e.conversationState===`WithAgent`){let n=e.agent?.displayName;return t.statusWithAgent(typeof n==`string`&&n.trim()!==``?n:t.handoffAgentFallback)}return t.headerStatus}function Y9(e,t,n){return t.PanelSwitch!==!0||typeof n!=`function`?null:e===`docked`?`full-page`:e===`full-page`?`docked`:null}function ste(e){if(!N9.some(t=>t===e))throw Error(`<wui-chat layout> must be one of ${N9.join(`, `)}, got "${e}".`)}function X9(e){if(!P9.some(t=>t===e))throw Error(`<wui-chat position> must be one of ${P9.join(`, `)}, got "${e}".`)}function cte(e,t){let n=e[t];delete e[t],e[t]=n}function lte(e){return e==null?{}:Object(e)}var Z9=0,Q9=class extends va{static get observedAttributes(){return[...W9,`compact`,`expressive`,`open`,`labels`,`page-context`,`narrow`].filter((e,t,n)=>n.indexOf(e)===t)}constructor(){super(),Z9+=1,this._uid=`wui-chat-${Z9}`,this._built=!1,this._session=null,this._unsubscribe=null,this._voice=null,this._voiceConversationId=void 0,this._labelsProp=void 0,this._pageContextProp=void 0,this._layoutParts=null,this._renderers={...I9},this._rendererApi={define:(e,t)=>{L9(e,t),this._renderers[e]=t,this._render()},map:this._renderers},this._captchaToken=null,this._attribution=null,this._openAttachmentProp=null,this._openCitationProp=null,this._openTargetProp=null,this._resolveLinkProp=null,this._openTicketProp=void 0,this._emptyContentProp=null,this._onPanelSwitchProp=null,this._preloadPanelSwitchProp=null,this._preloaded=!1,this._pastList=null,this._past=null,this._pastRefreshed=!1,this._historyShown=!1,this._openedConversation=null,this._lastOpen=!1,this._openTrigger=`manual`,this._focusTimer=null,this._nudgeArmed=!1,this._seeded=!1,this._wasLoading=!1,this._seen=new Set,this._sound=null,this._behaviour=null,this._autoOpen=null,this._avoid=null,this._motion=null,this._phone=null,this._requesting=!1,this._onKeyDown=e=>{e.key===`Escape`&&this._session?.getState().open&&(e.stopPropagation(),this._session.close(`escape`))}}get session(){return this._session??null}get conversationId(){return this._session?.getState().conversationId??null}get labels(){return oe({...lte(e4(this,`labels`)),...this._labelsProp})}set labels(e){this._labelsProp=e??void 0,this._render()}get pageContext(){return this._pageContextProp===void 0?e4(this,`page-context`):this._pageContextProp}set pageContext(e){this._pageContextProp=e===null?void 0:e}get compact(){let e=this.getAttribute(`compact`);return e!=null&&B9(`compact`)(e)}set compact(e){this.toggleAttribute(`compact`,e===!0||e===``||e===`true`)}get expressive(){let e=this.getAttribute(`expressive`);return e!=null&&B9(`expressive`)(e)}set expressive(e){this.toggleAttribute(`expressive`,e===!0||e===``||e===`true`)}get open(){return this.hasAttribute(`open`)}set open(e){this.toggleAttribute(`open`,e===!0||e===``||e===`true`)}get renderers(){return this._rendererApi}get layoutParts(){return this._layoutParts}set layoutParts(e){this._layoutParts=typeof e==`function`?e:null,this._render()}get getCaptchaToken(){return this._captchaToken}set getCaptchaToken(e){this._captchaToken=typeof e==`function`?e:null}get attribution(){return this._attribution}set attribution(e){this._attribution=typeof e==`function`?e:null}get openAttachment(){return this._openAttachmentProp??(e=>this._defaultOpenAttachment(e))}set openAttachment(e){this._openAttachmentProp=typeof e==`function`?e:null}get openCitation(){return this._openCitationProp??((e,t)=>this._defaultOpenCitation(e,t))}set openCitation(e){this._openCitationProp=typeof e==`function`?e:null}get openTarget(){return this._openTargetProp??(e=>this._defaultOpenTarget(e))}set openTarget(e){this._openTargetProp=typeof e==`function`?e:null}get openTicket(){return this._openTicketProp}set openTicket(e){this._openTicketProp=typeof e==`function`?e:void 0}get onNavigate(){return this._onNavigateProp}set onNavigate(e){this._onNavigateProp=typeof e==`function`?e:void 0}get resolveLink(){return this._resolveLinkProp}set resolveLink(e){this._resolveLinkProp=typeof e==`function`?e:null}get emptyContent(){return this._emptyContentProp}set emptyContent(e){if(e!==null&&!(e instanceof Node))throw TypeError(`emptyContent must be a Node or null`);this._emptyContentProp=e,this._applyEmptyContent()}get onPanelSwitch(){return this._onPanelSwitchProp}set onPanelSwitch(e){this._onPanelSwitchProp=typeof e==`function`?e:null}get preloadPanelSwitch(){return this._preloadPanelSwitchProp}set preloadPanelSwitch(e){this._preloadPanelSwitchProp=typeof e==`function`?e:null}connectedCallback(){this._adoptEarlyProperties();let e=this._assertLayout();if(this._assertPosition(),this.base.trim()===``)throw TypeError(`<wui-chat> needs a base path, e.g. base="/api/assistant".`);this._built||this._build(),this._shell||this._buildShell(e),this._session||this._createSession(),this._past||this._createPast(),this._unsubscribe||=this.requireSession().subscribe(()=>this._render()),this._render()}_adoptEarlyProperties(){for(let e of $ee)Y2(this,e)&&cte(this,e)}disconnectedCallback(){this._voice?.stop(),this._session?.stop(),this._unsubscribe?.(),this._unsubscribe=null,this._disposePast(),this._shell?.destroy?.(),document.removeEventListener(`keydown`,this._onKeyDown),this._avoid?.destroy(),this._avoid=null,this._autoOpen?.cancel(),this._autoOpen=null,this._motion?.destroy(),this._motion=null}attributeChangedCallback(e,t,n){if(this._built&&t!==n){if(e===`layout`)this._buildShell(this._assertLayout());else if(e===`position`)this._assertPosition();else if(e===`base`||e===`screen`||e===`narrow`)this._resetSession();else if(e===`motion`)this._motion?.destroy(),this._motion=null;else if(e===`open`&&this._session){let e=this._session.getState().open;this.open!==e&&this._setOpen(this.open,`manual`)}this._render()}}toggle(){this._session&&(this._session.getState().open?this._session.close(`button`):this._setOpen(!0,`manual`))}close(){this._voice?.stop(),this._session?.close(`button`)}newConversation(){this._voice?.stop(),this._session?.newConversation(),this._past?.refresh()}reset(){this._voice?.stop(),this._session?.reset()}_setOpen(e,t){this._session&&(e?(this._openTrigger=t,this._session.open({trigger:t})):this._session.close(`button`))}_assertLayout(){let e=this.layout;return ste(e),e}_assertPosition(){X9(this.position)}get _position(){let e=this.position;return X9(e),e}_isLauncherLike(){return this.layout===`launcher`||this.layout===`docked`}requireSession(){if(!this._session)throw TypeError(`wui-chat: _session is not ready; the element is not connected`);return this._session}requireVoice(){if(!this._voice)throw TypeError(`wui-chat: _voice is not ready; the element is not connected`);return this._voice}requireMotion(){if(!this._motion)throw TypeError(`wui-chat: _motion is not ready; the element is not connected`);return this._motion}requirePastList(){if(!this._pastList)throw TypeError(`wui-chat: _pastList is not ready; the element is not connected`);return this._pastList}requireNudgeHost(){if(!this._shell.nudgeHost)throw TypeError(`wui-chat: the launcher shell has no nudge host`);return this._shell.nudgeHost}_build(){this._built=!0,this._header=o5({onNew:()=>this.newConversation(),onHistory:()=>this._toggleHistory(),onClose:()=>this.close(),onMute:()=>{this._session&&this._session.setMuted(!this._session.getState().muted)},onSwitch:()=>this._switchPanel(),titleId:`${this._uid}-title`}),this._starters=_7({onStarter:e=>this.requireSession().submit(e.message),onResume:()=>this.requireSession().resumeLast(),onTicket:e=>{typeof this.openTicket==`function`&&this.openTicket({ticketId:e.ticketId,number:e.number})}}),this._applyEmptyContent(),this._voice=K8({getState:()=>this.requireSession().getState(),getToken:()=>this.requireSession().client.getSpeechToken()}),this._voice.subscribe(()=>this._render()),this._thread=Y7({getRenderers:()=>this._renderers,getLayoutParts:()=>this._layoutParts,makeTurnApi:e=>this._makeTurnApi(e),onRetry:()=>this.requireSession().retry(),onRegenerate:()=>this.requireSession().regenerate(),onRate:(e,t)=>this.requireSession().rate(e,t),getSession:()=>this.requireSession(),getVoice:()=>this._voice}),this._composer=e5({voice:this._voice,onSubmit:e=>this.requireSession().submit(e),onStop:()=>this.requireSession().stop(),onAttach:e=>this.requireSession().attach(e),onRemove:e=>this.requireSession().removeAttachment(e),onCancelEdit:()=>this.requireSession().cancelEdit(),onTyping:()=>this.requireSession().notifyTyping(),onDraftApplied:()=>this.requireSession().consumeDraft()}),this._footer=i5(),this._history=l5({getClient:()=>this.requireSession().client,getLabels:()=>this.labels,getFeatures:()=>this.requireSession().getState().features,onOpen:e=>{Promise.allSettled([this.requireSession().openConversation(e)]),this._toggleHistory(!1)},onDeleted:e=>{e===this.conversationId&&this.requireSession().newConversation()}}),this._nudge=h5({onActivate:()=>this._setOpen(!0,`manual`),onDismiss:()=>{}}),this._status=$(`p`,null,{role:`status`}),this._status.hidden=!0,this._errorEl=$(`p`,`wui-chat-profile-error`,{role:`alert`}),this._errorEl.hidden=!0,this._liveStatus=$(`p`,`wui-chat-live-status`,{role:`status`}),this._liveStatus.hidden=!0,this._talk=$(`button`,`${Z2(`outline`,`sm`)} wui-chat-handoff-request`,{type:`button`}),this._talk.addEventListener(`click`,()=>this._requestHandoff()),this._liveRetry=$(`button`,Z2(`ghost`,`sm`),{type:`button`}),this._liveRetry.addEventListener(`click`,()=>this.requireSession().resumeLive()),this._liveError=$(`p`,`wui-chat-live-error`,{role:`alert`}),this._liveError.hidden=!0,this._live=$(`div`,`wui-chat-live`),this._live.append(this._liveStatus,this._talk,this._liveRetry,this._liveError),this._live.hidden=!0,this._body=$(`div`,`wui-chat-body`),this._body.append(this._starters.el,this._thread.el,this._live,this._history.el,this._status,this._errorEl),this._foot=$(`div`,`wui-chat-foot`),this._foot.append(...this._composer.nodes,this._footer.el)}_buildShell(e){let t={launcher:u7,docked:a7,"full-page":d7,embedded:o7};this._shell?.destroy?.(),this._avoid?.destroy(),this._avoid=null,this._autoOpen?.cancel(),this._autoOpen=null,this._lastOpen=!1,this._launcherPlayed=!1;let n=t[e]({id:`${this._uid}-panel`,position:this._position,onToggle:()=>this.toggle()});n.panel.append(this._header.el,this._body,this._foot),n.panel.setAttribute(`aria-labelledby`,`${this._uid}-title`),n.panel.addEventListener(`keydown`,e=>{e.key===`Tab`&&jee(n.panel,e)}),n.nudgeHost&&n.nudgeHost.prepend(this._nudge.el),this._shell=n,this.replaceChildren(n.root)}_createSession(){let e=zt(m5(),{base:this.base}),t=rte(this);this._session=Zr(e,{...this.screen?{screen:this.screen}:{},...t===void 0?{}:{narrow:t},pageContext:()=>this.pageContext,attribution:()=>this._attribution?.()??null,behaviour:()=>this._session?.getState().features.BehaviourStarters?this._behaviour?.()??null:null,prefs:q9,reducedMotion:()=>this._motion?.reduced??!1,schedule:ite,getCaptchaToken:e=>{if(this._captchaToken)return this._captchaToken(e);let t=this._session?.getState().profile?.captcha?.siteKey;return t?O5(t,e):Promise.resolve(null)},onEvent:(e,t)=>{this.dispatchEvent(new CustomEvent(`wui-chat-event`,{bubbles:!0,detail:{name:e,data:t}}))},onError:()=>{},labels:this.labels}),this._unsubscribe=null,this._lastOpen=!1,this._openApplied=!1,this._seeded=!1,this._wasLoading=!1,this._seen=new Set,this._pastRefreshed=!1}_createPast(){this._pastList=Ht({client:this.requireSession().client,pageSize:20}),this._past=C5({list:this._pastList,getLabels:()=>this.labels,getFeatures:()=>this.requireSession().getState().features,onOpen:e=>{Promise.allSettled([this.requireSession().openConversation(e)])}}),this._starters.pastHost.append(this._past.el)}_disposePast(){this._past&&(this._past.el.remove(),this._past.dispose(),this.requirePastList().dispose(),this._past=null,this._pastList=null)}_applyEmptyContent(){if(!this._starters)return;let e=this._starters.extraHost;e.replaceChildren(...this._emptyContentProp?[this._emptyContentProp]:[]),e.hidden=!this._emptyContentProp}_switchPanel(){let e=this.requireSession().getState(),t=this._onPanelSwitchProp,n=Y9(this.layout,e.features,t);if(t===null||n===null)return;n===`full-page`&&this.close();let r={from:this.layout,to:n,conversationId:e.conversationId,draft:this._composer.getDraft()};Hee(()=>t.call(this,r),{target:n,reduced:this._motion?.reduced===!0}).then(()=>document.querySelector(`.wui-chat--${n} .wui-chat-input`)?.focus()).catch(e=>globalThis.reportError?.(e))}async _requestHandoff(){this._requesting=!0,this._liveError.hidden=!0,this._render();try{await this.requireSession().requestHandoff()}catch(e){let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;this._liveError.textContent=typeof t==`string`&&t||this.labels.errorGeneric,this._liveError.hidden=!1}finally{this._requesting=!1,this._render()}}_paintLive(e,t,n){let r=e.live===`Lost`,i=ate(e);this._liveStatus.hidden=!r,this._liveStatus.textContent=r?t.liveLost:``,this._liveRetry.hidden=!r,this._liveRetry.textContent=t.retry,this._talk.hidden=!i,this._talk.textContent=t.talkToPerson,this._talk.disabled=this._requesting,this._live.hidden=n||!r&&!i}_resetSession(){this._voice?.stop(),this._unsubscribe?.(),this._unsubscribe=null,this._session?.dispose(),this._session=null,this._disposePast(),this._history.dispose(),this.isConnected&&(this._createSession(),this._createPast(),this._unsubscribe=this.requireSession().subscribe(()=>this._render()))}_toggleHistory(e=!this._historyShown){this._historyShown=e,e?this._history.show():this._history.hide(),this._render()}_makeTurnApi(e){let t=$r(this.requireSession(),{messageId:e,labels:this.labels,openAttachment:e=>this.openAttachment(e),openCitation:t=>this.openCitation(e,t),openTarget:e=>this.openTarget(e),openTicket:this.openTicket,onNavigate:this.onNavigate});return t.resolveLink=this.resolveLink,t}_defaultOpenAttachment(e){this.requireSession().client.getAttachment(e.attachmentId).then(t=>{let n=URL.createObjectURL(new Blob([t],{type:e.contentType}));window.open(n,`_blank`,`noopener`),setTimeout(()=>URL.revokeObjectURL(n),Zee)}).catch(e=>globalThis.reportError?.(e))}_defaultOpenCitation(e,t){let n=this._thread.find(e);if(n){for(let e of n.querySelectorAll(`[data-marker]`))if(e.dataset.marker===String(t)){e.focus();return}}}_defaultOpenTarget(e){/^https?:\/\//i.test(e)?window.open(e,`_blank`,`noopener`):window.location.assign(e)}_render(){this._built&&this._session&&this._paint(this._session.getState())}_paint(e){e.conversationId!==this._voiceConversationId&&(this._voiceConversationId=e.conversationId,this.requireVoice().stop());let t=this.labels,n=e.profile,r=this._isLauncherLike();if(!n){this.hidden=r,this._header.el.hidden=!0,this._starters.el.hidden=!0,this._thread.el.hidden=!0,this._history.el.hidden=!0,this._foot.hidden=!0,this._errorEl.hidden=e.profileError==null,e.profileError&&(this._errorEl.textContent=e.profileError.message),this._status.hidden=e.profileError!=null,this._status.textContent=t.loadingConversation,this._shell.panel.setAttribute(`aria-busy`,String(e.profileError==null));return}if(this._shell.panel.removeAttribute(`aria-busy`),!e.features.VisitorChat){this.hidden=!0,this._status.hidden=!0;return}this.hidden=!1;let i=e.features,a=G9(this);this._ensureRuntime(e,n,a,t);let o=e.loading,s=e.loadError,c=e.messages.length===0&&!o,l=this._historyShown&&i.History===!0,u=e.messages.some(e=>e.author.kind===`Visitor`||e.author.kind===`Customer`),d=Y9(this.layout,i,this._onPanelSwitchProp),f=e.streaming||e.thinking;this._header.paint({labels:t,title:n.assistant.name,tagline:n.assistant.tagline,status:ote(e,t),canNew:!f,showNew:this.layout===`full-page`||u,showHistory:i.History,showClose:r||this.layout===`full-page`&&d!==null,switchTo:d,canSwitch:!f,viewingHistory:l,showMute:i.Sounds&&n.experience.sound.muteControl,muted:e.muted}),W5(this._header.conversation,e,{labels:t,features:i,title:n.assistant.name??t.panelTitle,getState:()=>this.requireSession().getState(),iconOnly:!0}),l&&(this._header.conversation.hidden=!0),this._starters.el.hidden=!c||l,c&&e.open&&!this._introPlayed&&a.panel.greetingLoaderMs>0&&!this.requireMotion().reduced&&(this._introPlayed=!0,this._starters.intro(a.panel.greetingLoaderMs)),c&&this._starters.paint({labels:t,greeting:e.greeting,intro:n.assistant.intro,starters:e.starters,showStarters:i.Starters&&!e.streaming,resume:!i.History&&i.ResumeLast?e.lastConversation:null,openTickets:e.openTickets,features:e.features,ticketsClickable:typeof this.openTicket==`function`}),i.History&&!this._pastRefreshed&&(this._pastRefreshed=!0,this._past?.refresh()),this._past?.paint();let p=!c&&!o&&!s&&!l;this._thread.el.hidden=!p,p&&this._thread.paint(e,{labels:t,loaderStyle:nte(this),reduced:this._motion?.reduced??!1,phrases:n.experience.pacing.thinkingPhrases,intervalMs:n.experience.pacing.phraseIntervalMs,assistantName:n.assistant.name}),this._paintLive(e,t,l),this._status.hidden=!o||l,this._status.textContent=t.loadingConversation,this._errorEl.hidden=!s||l,s&&(this._errorEl.textContent=s.message),this._foot.hidden=l,this._composer.paint({state:e,labels:t,maxLength:n.limits.maxMessageLength,accept:n.limits.contentTypes.join(`,`),draft:e.draft??null,sendIcon:a.input.sendIcon}),this._footer.paint({labels:t,profile:n}),this._history.el.hidden=!l,this._syncOpen(e,n,i,t,r),this._syncConversation(e),this._playSounds(e)}_ensureRuntime(e,t,n,r){let i=e.features;this._motion||(this._motion=K2(n,t.experience),this._motion.subscribe(()=>this._render())),i.Sounds&&!this._sound&&(this._sound=Lee(t.experience.sound,q9)),!i.Sounds&&this._sound&&(this._sound=null),i.BehaviourStarters&&!this._behaviour&&(this._behaviour=w9(t.start.behaviour?.servicePathPrefixes??[]));let a=this._isLauncherLike();a&&!this._avoid&&this.layout===`launcher`&&(this._avoid=_9(n.avoid,t.experience.launcher,this.requireNudgeHost())),this.layout===`launcher`&&i.AutoOpen&&!this._autoOpen&&(this._autoOpen=s9(t.experience.autoOpen,n,{open:()=>this._setOpen(!0,`auto`),isOpen:()=>this.requireSession().getState().open,panelRect:()=>this._shell.panel.getBoundingClientRect()}));let o=J9(n);this._shell.setLabels(r),this._shell.setAppearance({position:this._position,offsetX:this.hasAttribute(`offset-x`)?z9(`offset-x`)(this.getAttribute(`offset-x`)??``):void 0,offsetY:this.hasAttribute(`offset-y`)?z9(`offset-y`)(this.getAttribute(`offset-y`)??``):void 0,width:`${n.panel.widthPx}px`,maxHeight:n.panel.maxHeightPx,bottomGap:n.panel.bottomGapPx,reduced:this._motion.reduced,sendReveal:n.input.sendReveal,inputRing:n.input.ring,panelMotion:n.panel.motion,theme:Yee(this.getAttribute(`theme`)),icon:this.icon,launcherStyle:n.launcher.style,compact:n.launcher.compact,labelReveal:n.launcher.labelReveal,entrance:n.launcher.entrance,idle:n.launcher.idle,launcherMark:n.launcher.mark,panelHeight:n.panel.height,replyAvatars:n.panel.replyAvatars,avatar:n.avatar,expressive:n.expressive,phone:o,hoverLabel:t.experience.launcher.hoverLabel,peek:t.experience.launcher.peek,peekSeconds:t.experience.launcher.peekSeconds,hideWhileOpen:t.experience.launcher.hideWhileOpen,phoneMode:n.phone.mode,sheetHeightDvh:n.phone.sheetHeightDvh,sheetMaxHeightPx:n.phone.sheetMaxHeightPx,launcherState:this._launcherPlayed?void 0:`entering`}),this._launcherPlayed=!0,this._shell.root.classList.toggle(`wui-chat--phone`,a&&J9(n))}_syncOpen(e,t,n,r,i){if(i){if(!this._openApplied&&(this._openApplied=!0,this.hasAttribute(`open`)&&!e.open))this._setOpen(!0,`manual`);else if(this._shell.setOpen(e.open),this.toggleAttribute(`open`,e.open),e.open!==this._lastOpen&&(this._lastOpen=e.open,this._onOpenChange(e.open)),e.open)this._nudge.cancel(),this._nudgeArmed=!1,this._autoOpen?.cancel();else if(n.Nudges&&this.layout===`launcher`&&!this._nudgeArmed){let e=Pe(t,n);e&&(this._nudge.schedule({text:e.text,delaySeconds:e.delaySeconds,label:r.nudgeDismiss}),this._nudgeArmed=!0)}}}_onOpenChange(e){let t=J9(G9(this));if(e){if(document.addEventListener(`keydown`,this._onKeyDown),this._sound?.play(`open`),this._past?.refresh(),this.layout===`docked`&&!this._preloaded&&typeof this._preloadPanelSwitchProp==`function`){this._preloaded=!0;let e=this._preloadPanelSwitchProp;Promise.allSettled([new Promise(t=>t(e.call(this)))]).then(e=>{for(let t of e)t.status===`rejected`&&globalThis.reportError?.(t.reason)})}if(t){let e=G9(this);this._phone={fit:M9(this._shell.panel,e),unlock:Pee(this._thread.el)}}else this._openTrigger===`manual`&&(this._focusTimer=setTimeout(()=>{this._focusTimer=null,this._composer.focus()},Qee))}else document.removeEventListener(`keydown`,this._onKeyDown),clearTimeout(this._focusTimer??void 0),this._focusTimer=null,this._phone?.fit.destroy(),this._phone?.unlock(),this._phone=null,this._historyShown&&(this._historyShown=!1,this._history.hide(),this._render()),Mee(this._shell.launcherButton)}_syncConversation(e){let t=this.getAttribute(`conversation-id`);t&&t!==this._openedConversation&&!e.loading&&(this._openedConversation=t,e.conversationId!==t&&Promise.allSettled([this.requireSession().openConversation(t)]))}_playSounds(e){if(e.loading){this._wasLoading=!0;for(let t of e.messages)this._seen.add(t.id)}else if(this._wasLoading||!this._seeded){this._wasLoading=!1,this._seeded=!0;for(let t of e.messages)this._seen.add(t.id)}else for(let t of e.messages)this._seen.has(t.id)||(this._seen.add(t.id),this._announce(t))}_announce(e){if(!this._sound||e.restored||e.parts.some(e=>e.kind===`Notice`))return;let t=e.author.kind;if(t===`Visitor`)e.stored||this._sound.play(`sent`);else if(t===`Assistant`||t===`Script`||t===`Agent`){this._sound.play(`reply`);let e=this.requireSession().getState().profile;e?.experience.sound.vibrate&&Nee(e.experience.sound.vibrateMs,this._sound.isMuted())}}};Object.defineProperty(Q9.prototype,"layout",{get(){return this.getAttribute(`layout`)??U9.layout},set(e){this.setAttribute(`layout`,String(e))}});for(let e of W9)e!==`layout`&&Object.defineProperty(Q9.prototype,tte(e),{configurable:!0,get(){return this.getAttribute(e)??U9[e]??``},set(t){t==null?this.removeAttribute(e):this.setAttribute(e,String(t))}});function $9(){typeof customElements<`u`&&!customElements.get(`wui-chat`)&&customElements.define(`wui-chat`,Q9)}$9(),$9(),globalThis.WeborityChat=Object.assign(globalThis.WeborityChat||{},{session:e=>e.session,renderers:{define:ete}})})();