@accurix/centrinfo-widget 5.0.0 → 5.1.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,39 +1,179 @@
1
- var Centrinfo=(function(Vr){"use strict";var YO=Object.defineProperty;var XO=(Vr,ur,Be)=>ur in Vr?YO(Vr,ur,{enumerable:!0,configurable:!0,writable:!0,value:Be}):Vr[ur]=Be;var se=(Vr,ur,Be)=>XO(Vr,typeof ur!="symbol"?ur+"":ur,Be);var ur,Be,zp,Ln,Fp,Hp,Vp,hu,Ps,Ji,Up,pu,vu,gu,Gp,Rs={},Es=[],J1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Os=Array.isArray;function fn(t,e){for(var r in e)t[r]=e[r];return t}function mu(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Q1(t,e,r){var n,a,i,o={};for(i in e)i=="key"?n=e[i]:i=="ref"?a=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?ur.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)o[i]===void 0&&(o[i]=t.defaultProps[i]);return Ns(t,o,n,a,null)}function Ns(t,e,r,n,a){var i={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++zp,__i:-1,__u:0};return a==null&&Be.vnode!=null&&Be.vnode(i),i}function Me(t){return t.children}function Bs(t,e){this.props=t,this.context=e}function ti(t,e){if(e==null)return t.__?ti(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?ti(t):null}function ew(t){if(t.__P&&t.__d){var e=t.__v,r=e.__e,n=[],a=[],i=fn({},e);i.__v=e.__v+1,Be.vnode&&Be.vnode(i),_u(t.__P,i,e,t.__n,t.__P.namespaceURI,32&e.__u?[r]:null,n,r??ti(e),!!(32&e.__u),a),i.__v=e.__v,i.__.__k[i.__i]=i,Zp(n,i,a),e.__e=e.__=null,i.__e!=r&&$p(i)}}function $p(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),$p(t)}function yu(t){(!t.__d&&(t.__d=!0)&&Ln.push(t)&&!zs.__r++||Fp!=Be.debounceRendering)&&((Fp=Be.debounceRendering)||Hp)(zs)}function zs(){try{for(var t,e=1;Ln.length;)Ln.length>e&&Ln.sort(Vp),t=Ln.shift(),e=Ln.length,ew(t)}finally{Ln.length=zs.__r=0}}function Wp(t,e,r,n,a,i,o,s,l,c,u){var f,h,d,p,m,g,v,y=n&&n.__k||Es,b=e.length;for(l=tw(r,e,y,l,b),f=0;f<b;f++)(d=r.__k[f])!=null&&(h=d.__i!=-1&&y[d.__i]||Rs,d.__i=f,g=_u(t,d,h,a,i,o,s,l,c,u),p=d.__e,d.ref&&h.ref!=d.ref&&(h.ref&&xu(h.ref,null,d),u.push(d.ref,d.__c||p,d)),m==null&&p!=null&&(m=p),(v=!!(4&d.__u))||h.__k===d.__k?(l=qp(d,l,t,v),v&&h.__e&&(h.__e=null)):typeof d.type=="function"&&g!==void 0?l=g:p&&(l=p.nextSibling),d.__u&=-7);return r.__e=m,l}function tw(t,e,r,n,a){var i,o,s,l,c,u=r.length,f=u,h=0;for(t.__k=new Array(a),i=0;i<a;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=t.__k[i]=Ns(null,o,null,null,null):Os(o)?o=t.__k[i]=Ns(Me,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=t.__k[i]=Ns(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[i]=o,l=i+h,o.__=t,o.__b=t.__b+1,s=null,(c=o.__i=rw(o,r,l,f))!=-1&&(f--,(s=r[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(a>u?h--:a<u&&h++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,o.__u|=4))):t.__k[i]=null;if(f)for(i=0;i<u;i++)(s=r[i])!=null&&(2&s.__u)==0&&(s.__e==n&&(n=ti(s)),jp(s,s));return n}function qp(t,e,r,n){var a,i;if(typeof t.type=="function"){for(a=t.__k,i=0;a&&i<a.length;i++)a[i]&&(a[i].__=t,e=qp(a[i],e,r,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=ti(t)),r.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function rw(t,e,r,n){var a,i,o,s=t.key,l=t.type,c=e[r],u=c!=null&&(2&c.__u)==0;if(c===null&&s==null||u&&s==c.key&&l==c.type)return r;if(n>(u?1:0)){for(a=r-1,i=r+1;a>=0||i<e.length;)if((c=e[o=a>=0?a--:i++])!=null&&(2&c.__u)==0&&s==c.key&&l==c.type)return o}return-1}function Yp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||J1.test(e)?r:r+"px"}function Fs(t,e,r,n,a){var i,o;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Yp(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Yp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(Up,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=r,r?n?r[Ji]=n[Ji]:(r[Ji]=pu,t.addEventListener(e,i?gu:vu,i)):t.removeEventListener(e,i?gu:vu,i);else{if(a=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Xp(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e[Ps]==null)e[Ps]=pu++;else if(e[Ps]<r[Ji])return;return r(Be.event?Be.event(e):e)}}}function _u(t,e,r,n,a,i,o,s,l,c){var u,f,h,d,p,m,g,v,y,b,x,w,S,k,C,A=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[s=e.__e=r.__e]),(u=Be.__b)&&u(e);e:if(typeof A=="function")try{if(v=e.props,y=A.prototype&&A.prototype.render,b=(u=A.contextType)&&n[u.__c],x=u?b?b.props.value:u.__:n,r.__c?g=(f=e.__c=r.__c).__=f.__E:(y?e.__c=f=new A(v,x):(e.__c=f=new Bs(v,x),f.constructor=A,f.render=aw),b&&b.sub(f),f.state||(f.state={}),f.__n=n,h=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=fn({},f.__s)),fn(f.__s,A.getDerivedStateFromProps(v,f.__s))),d=f.props,p=f.state,f.__v=e,h)y&&A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&A.getDerivedStateFromProps==null&&v!==d&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),e.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(v,f.__s,x)===!1){e.__v!=r.__v&&(f.props=v,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(M){M&&(M.__=e)}),Es.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(d,p,m)})}if(f.context=x,f.props=v,f.__P=t,f.__e=!1,w=Be.__r,S=0,y)f.state=f.__s,f.__d=!1,w&&w(e),u=f.render(f.props,f.state,f.context),Es.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,w&&w(e),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++S<25);f.state=f.__s,f.getChildContext!=null&&(n=fn(fn({},n),f.getChildContext())),y&&!h&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(d,p)),k=u!=null&&u.type===Me&&u.key==null?Kp(u.props.children):u,s=Wp(t,Os(k)?k:[k],e,r,n,a,i,o,s,l,c),f.base=e.__e,e.__u&=-161,f.__h.length&&o.push(f),g&&(f.__E=f.__=null)}catch(M){if(e.__v=null,l||i!=null)if(M.then){for(e.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,e.__e=s}else{for(C=i.length;C--;)mu(i[C]);bu(e)}else e.__e=r.__e,e.__k=r.__k,M.then||bu(e);Be.__e(M,e,r)}else i==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):s=e.__e=nw(r.__e,e,r,n,a,i,o,l,c);return(u=Be.diffed)&&u(e),128&e.__u?void 0:s}function bu(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(bu))}function Zp(t,e,r){for(var n=0;n<r.length;n++)xu(r[n],r[++n],r[++n]);Be.__c&&Be.__c(e,t),t.some(function(a){try{t=a.__h,a.__h=[],t.some(function(i){i.call(a)})}catch(i){Be.__e(i,a.__v)}})}function Kp(t){return typeof t!="object"||t==null||t.__b>0?t:Os(t)?t.map(Kp):t.constructor!==void 0?null:fn({},t)}function nw(t,e,r,n,a,i,o,s,l){var c,u,f,h,d,p,m,g=r.props||Rs,v=e.props,y=e.type;if(y=="svg"?a="http://www.w3.org/2000/svg":y=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((d=i[c])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){t=d,i[c]=null;break}}if(t==null){if(y==null)return document.createTextNode(v);t=document.createElementNS(a,y,v.is&&v),s&&(Be.__m&&Be.__m(e,i),s=!1),i=null}if(y==null)g===v||s&&t.data==v||(t.data=v);else{if(i=y=="textarea"&&v.defaultValue!=null?null:i&&ur.call(t.childNodes),!s&&i!=null)for(g={},c=0;c<t.attributes.length;c++)g[(d=t.attributes[c]).name]=d.value;for(c in g)d=g[c],c=="dangerouslySetInnerHTML"?f=d:c=="children"||c in v||c=="value"&&"defaultValue"in v||c=="checked"&&"defaultChecked"in v||Fs(t,c,null,d,a);for(c in v)d=v[c],c=="children"?h=d:c=="dangerouslySetInnerHTML"?u=d:c=="value"?p=d:c=="checked"?m=d:s&&typeof d!="function"||g[c]===d||Fs(t,c,d,g[c],a);if(u)s||f&&(u.__html==f.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),e.__k=[];else if(f&&(t.innerHTML=""),Wp(e.type=="template"?t.content:t,Os(h)?h:[h],e,r,n,y=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,o,i?i[0]:r.__k&&ti(r,0),s,l),i!=null)for(c=i.length;c--;)mu(i[c]);s&&y!="textarea"||(c="value",y=="progress"&&p==null?t.removeAttribute("value"):p!=null&&(p!==t[c]||y=="progress"&&!p||y=="option"&&p!=g[c])&&Fs(t,c,p,g[c],a),c="checked",m!=null&&m!=t[c]&&Fs(t,c,m,g[c],a))}return t}function xu(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(a){Be.__e(a,r)}}function jp(t,e,r){var n,a;if(Be.unmount&&Be.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||xu(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){Be.__e(i,e)}n.base=n.__P=null}if(n=t.__k)for(a=0;a<n.length;a++)n[a]&&jp(n[a],e,r||typeof t.type!="function");r||mu(t.__e),t.__c=t.__=t.__e=void 0}function aw(t,e,r){return this.constructor(t,r)}function Jp(t,e,r){var n,a,i,o;e==document&&(e=document.documentElement),Be.__&&Be.__(t,e),a=(n=!1)?null:e.__k,i=[],o=[],_u(e,t=e.__k=Q1(Me,null,[t]),a||Rs,Rs,e.namespaceURI,a?null:e.firstChild?ur.call(e.childNodes):null,i,a?a.__e:e.firstChild,n,o),Zp(i,t,o)}function iw(t){function e(r){var n,a;return this.getChildContext||(n=new Set,(a={})[e.__c]=this,this.getChildContext=function(){return a},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&n.forEach(function(o){o.__e=!0,yu(o)})},this.sub=function(i){n.add(i);var o=i.componentWillUnmount;i.componentWillUnmount=function(){n&&n.delete(i),o&&o.call(i)}}),r.children}return e.__c="__cC"+Gp++,e.__=t,e.Provider=e.__l=(e.Consumer=function(r,n){return r.children(n)}).contextType=e,e}ur=Es.slice,Be={__e:function(t,e,r,n){for(var a,i,o;e=e.__;)if((a=e.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(t)),o=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(t,n||{}),o=a.__d),o)return a.__E=a}catch(s){t=s}throw t}},zp=0,Bs.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=fn({},this.state),typeof t=="function"&&(t=t(fn({},r),this.props)),t&&fn(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),yu(this))},Bs.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),yu(this))},Bs.prototype.render=Me,Ln=[],Hp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Vp=function(t,e){return t.__v.__b-e.__v.__b},zs.__r=0,hu=Math.random().toString(8),Ps="__d"+hu,Ji="__a"+hu,Up=/(PointerCapture)$|Capture$/i,pu=0,vu=Xp(!1),gu=Xp(!0),Gp=0;var ow=0;function _(t,e,r,n,a,i){e||(e={});var o,s,l=e;if("ref"in l)for(s in l={},e)s=="ref"?o=e[s]:l[s]=e[s];var c={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ow,__i:-1,__u:0,__source:a,__self:i};if(typeof t=="function"&&(o=t.defaultProps))for(s in o)l[s]===void 0&&(l[s]=o[s]);return Be.vnode&&Be.vnode(c),c}class Qi extends Error{constructor(r,n){super(n);se(this,"status");this.status=r,this.name="ApiError"}}const wu=()=>({agentName:"Accurix",greeting:"Hi! 👋 How can I help you today?",widgetModule:"chat",assistantMediaKind:"image",soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:"text",allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[]}),sw="Sara is an AI assistant; answers may be imperfect.",lw="Accurix is an AI assistant; answers may be imperfect.",Qp=t=>{typeof console>"u"||console.warn(`[centrinfo-widget] Could not load saved widget configuration from the API (${t}). Showing default widget chrome. Check data-token, data-api-base, CORS, and backend availability.`)},Su=(t,e={})=>{const n=t.disclaimerText?.trim()?.toLowerCase(),a=e.agentName?.trim()||t.agentName?.trim()||"Accurix",i=e.agentAvatarUrl?.trim()||t.agentAvatarUrl?.trim();return{...t,allowVoiceInput:!!(t.allowVoiceInput&&t.talkbackMode&&t.talkbackMode!=="text"),voiceOutputEnabled:!!(t.voiceOutputEnabled&&t.talkbackMode&&t.talkbackMode!=="text"),agentName:a,agentAvatarUrl:i||void 0,disclaimerText:n===sw.toLowerCase()||n?.includes("sara is an ai assistant")?lw:t.disclaimerText}};class ev{constructor(e,r,n,a,i={},o,s,l="floating"){se(this,"baseUrl");se(this,"token");se(this,"gifApiKey");se(this,"analyticsContextToken");se(this,"bootstrapOverrides");se(this,"identityToken");se(this,"identityTokenProvider");se(this,"chatSurface");this.baseUrl=e,this.token=r,this.gifApiKey=n,this.analyticsContextToken=a,this.bootstrapOverrides=i,this.identityToken=o,this.identityTokenProvider=s,this.chatSurface=l}async currentIdentityToken(){if(this.identityTokenProvider){const e=await this.identityTokenProvider();this.identityToken=e?.trim()||void 0}return this.identityToken}headers(e=!0){const r={Authorization:`Bearer ${this.token}`};return e&&(r["Content-Type"]="application/json"),r}async json(e){let r;try{r=await e.json()}catch{r=void 0}if(!e.ok){const n=uw(r)??`request failed (${e.status})`;throw new Qi(e.status,n)}return r?.data??r}async bootstrap(){try{const e=await fetch(`${this.baseUrl}/public-chat/bootstrap`,{headers:this.headers(!1)});if(!e.ok)return Qp(`bootstrap request failed with ${e.status}`),Su(wu(),this.bootstrapOverrides);const r=await this.json(e);return Su({...wu(),...r},this.bootstrapOverrides)}catch(e){return Qp(e instanceof Error?e.message:"bootstrap request failed"),Su(wu(),this.bootstrapOverrides)}}async history(){const e=await this.currentIdentityToken();if(!e)return{conversations:[]};const r=await fetch(`${this.baseUrl}/public-chat/history`,{method:"POST",headers:this.headers(),body:JSON.stringify({identityToken:e,surface:this.chatSurface})}),n=await this.json(r);return{activeSessionId:n.activeSessionId,conversations:Array.isArray(n.conversations)?n.conversations:[]}}async stream(e,r,n){const a=await this.currentIdentityToken(),i=await fetch(`${this.baseUrl}/public-chat/stream`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:e,sessionId:r,clientMessageId:n.clientMessageId,attachmentId:n.attachmentId,attachmentIds:n.attachmentIds,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:a,surface:this.chatSurface}),signal:n.signal});return!i.ok||!i.body?this.send(e,r,n):fw(i.body,n)}async liveEvents(e,r){const n=`sessionId=${encodeURIComponent(e)}&after=${encodeURIComponent(r)}`,a=await fetch(`${this.baseUrl}/public-chat/live-events?${n}`,{headers:this.headers(!1)}),i=await this.json(a);return{mode:i.mode??"ai",assignedAgentName:i.assignedAgentName,agentTyping:!!i.agentTyping,agentTypingName:i.agentTypingName,conversationEnded:!!i.conversationEnded,events:i.events??[]}}async typing(e,r){try{const n=await fetch(`${this.baseUrl}/public-chat/typing`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:e,isTyping:r})});if(!n.ok)try{await n.text()}catch{}}catch{}}async presence(e){try{await fetch(`${this.baseUrl}/public-chat/presence`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:e})})}catch{}}async send(e,r,n){const a=await this.currentIdentityToken(),i=await fetch(`${this.baseUrl}/public-chat`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:e,sessionId:r,clientMessageId:n.clientMessageId,attachmentId:n.attachmentId,attachmentIds:n.attachmentIds,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:a,surface:this.chatSurface}),signal:n.signal}),o=await this.json(i);return n.onChunk(o.answer??""),{answer:o.answer??"",sources:o.sources??[],suggestedReplies:o.suggestedReplies??[],availableActions:o.availableActions??[],actions:o.actions??[],selectedAction:o.selectedAction,handoffOffered:o.handoffOffered??!1,requestedContactFields:tv(o.requestedContactFields),conversationEnded:o.conversationEnded??!1,liveMode:o.liveMode,assignedAgentName:o.assignedAgentName,audioBase64:o.audioBase64,mimeType:o.mimeType,visualization:o.visualization,artifacts:o.artifacts}}async action(e,r,n){const a=n?.trim()||(e==="contact-support"?"inquiry":e),i=await fetch(`${this.baseUrl}/public-chat/${a}`,{method:"POST",headers:this.headers(),body:JSON.stringify(r)}),o=await this.json(i);return{ok:!0,note:o?.note,booking:o?.booking,caseReference:o?.caseReference||void 0,inquiryId:o?.inquiryId||o?.inquiry?.id||void 0}}async confirmHostedBooking(e){const r=await fetch(`${this.baseUrl}/public-chat/book-demo/confirm`,{method:"POST",headers:this.headers(),body:JSON.stringify(e)}),n=await this.json(r);if(!n?.booking)throw new Error("Calendar booking confirmation was unavailable.");return n.booking}async speak(e){const r=await fetch(`${this.baseUrl}/public-chat/speak`,{method:"POST",headers:this.headers(),body:JSON.stringify({text:e})}),n=await this.json(r);return{providerReady:!!n.providerReady,message:n.message,audioBase64:n.audioBase64,mimeType:n.mimeType}}async identify(e,r){if(!(!e||!r))try{const n=await fetch(`${this.baseUrl}/public-chat/identify`,{method:"POST",headers:this.headers(),body:JSON.stringify(cw(e,r))});if(!n.ok)try{await n.text()}catch{}}catch{}}async transcribe(e,r,n,a){const i=await fetch(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(),body:JSON.stringify({audioBase64:e,mimeType:r,languageHint:n,durationSeconds:a})});return(await this.json(i)).text??""}async transcribeAudio(e,r,n,a){const i=new FormData;i.append("audio",e,"voice-recording"),i.append("mimeType",r||e.type||"audio/webm"),n&&i.append("languageHint",n),a!==void 0&&Number.isFinite(a)&&i.append("durationSeconds",String(a));const o=await fetch(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(!1),body:i});return(await this.json(o)).text??""}async endConversation(e){try{const r=await fetch(`${this.baseUrl}/public-chat/end`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:e})});if(!r.ok)try{await r.text()}catch{}}catch{}}async sendFeedback(e){try{const r=await fetch(`${this.baseUrl}/public-chat/feedback`,{method:"POST",headers:this.headers(),body:JSON.stringify(e)});if(!r.ok)try{await r.text()}catch{}}catch{}}async uploadAttachment(e,r,n,a,i){const o=await fetch(`${this.baseUrl}/public-chat/attachments`,{method:"POST",headers:this.headers(),body:JSON.stringify({fileBase64:e,mimeType:r,filename:n,sessionId:a,analyze:i})});return this.json(o)}async fetchAttachment(e,r){const n=await fetch(`${this.baseUrl}/public-chat/attachments/${encodeURIComponent(e)}?sessionId=${encodeURIComponent(r)}`,{headers:this.headers(!1)});if(!n.ok)throw new Qi(n.status,"This file is no longer available.");return n.blob()}async demoSlots(e,r){const n=`from=${encodeURIComponent(e)}&to=${encodeURIComponent(r)}`,a=await fetch(`${this.baseUrl}/public-chat/demo-slots?${n}`,{headers:this.headers(!1)});if(!a.ok){const o=new Error("Calendar availability is temporarily unavailable.");throw o.status=a.status,o}const i=await this.json(a);return{status:i?.status,reason:i?.reason,timezone:i?.timezone,slotDurationMinutes:i?.slotDurationMinutes,available:i?.available,taken:i?.taken??[],busy:i?.busy??[]}}async searchGifs(e){if(!this.gifApiKey)return[];const n=`https://tenor.googleapis.com/v2/search?q=${encodeURIComponent(e.trim()||"trending")}&key=${this.gifApiKey}&limit=24&media_filter=tinygif,gif&contentfilter=high`;try{const a=await fetch(n);return a.ok?((await a.json()).results??[]).map(o=>({id:o.id,url:o.media_formats?.gif?.url??o.media_formats?.tinygif?.url??"",preview:o.media_formats?.tinygif?.url??o.media_formats?.gif?.url??"",alt:o.content_description||"GIF"})).filter(o=>o.url):[]}catch{return[]}}}const cw=(t,e)=>{const r={...e.customAttributes??{},...e.metadata??{}};e.createdAt!==void 0&&(r.createdAt=e.createdAt),e.avatarUrl&&(r.avatarUrl=e.avatarUrl),e.company&&(r.company=e.company);const n={sessionId:t},a=e.externalId??e.userId;return a&&(n.externalId=a),e.email&&(n.email=e.email),e.firstName&&(n.firstName=e.firstName),e.lastName&&(n.lastName=e.lastName),e.name&&(n.name=e.name),e.phone&&(n.phone=e.phone),Object.keys(r).length>0&&(n.metadata=r),n},uw=t=>{const e=t?.message;if(Array.isArray(e))return e.join(", ");if(typeof e=="string")return e},fw=async(t,e)=>{const r=t.getReader(),n=new TextDecoder,a={answer:"",sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1,requestedContactFields:[],conversationEnded:!1};let i="";for(;;){const{done:o,value:s}=await r.read();if(o)break;i+=n.decode(s,{stream:!0});let l;for(;(l=i.indexOf(`
1
+ var Centrinfo=(function(St){"use strict";var Lp=Object.defineProperty;var Dp=(St,$t,Yt)=>$t in St?Lp(St,$t,{enumerable:!0,configurable:!0,writable:!0,value:Yt}):St[$t]=Yt;var B=(St,$t,Yt)=>Dp(St,typeof $t!="symbol"?$t+"":$t,Yt);const $t={notComparable:"Not comparable yet"},Yt=e=>!e||e==="observed"||e==="confirmed_zero",Ir=(e,t)=>{let n=typeof e.value=="number"&&Number.isFinite(e.value)?e.value:null,a=typeof t.value=="number"&&Number.isFinite(t.value)?t.value:null;return e.status==="missing"||t.status==="missing"||n===null||a===null?{kind:"not_comparable",reason:"missing",label:$t.notComparable}:Yt(e.status)?Yt(t.status)?a===0?{kind:"not_comparable",reason:"previous_zero",label:n===0?"No change (0)":n>0?"Up from 0":"Down from 0"}:{kind:"change",percent:(n-a)/Math.abs(a)*100}:{kind:"not_comparable",reason:"previous_no_records",label:$t.notComparable}:{kind:"not_comparable",reason:"current_no_records",label:`${e.label?.trim()||"Current period"}: no records yet`}},_n=e=>e&&["day","week","month","quarter","year"].includes(e)?e:"period",Er=e=>e==="day"?"vs yesterday at this time":`vs same point last ${_n(e)}`,os=(e,t)=>{if(!e.cutoffAt)return;let n=new Date(e.cutoffAt);if(Number.isNaN(n.getTime()))return;let a=e.timezone||void 0,i="";try{i=new Intl.DateTimeFormat(t,{...e.grain==="day"?{}:{weekday:"short",day:"numeric",month:"short"},hour:"2-digit",minute:"2-digit",timeZone:a}).format(n)}catch{i=n.toISOString()}let o=e.grain==="day"?"on both days":`in both ${_n(e.grain)}s`,s=e.cutoffSource==="data_as_of"?", the time of the latest record":"";return`Compared up to ${i} ${o}${s}${a?` (${a})`:""}`},zr=(e,t,n,a={format:String})=>{if(!e||!e.comparisonBasis||e.comparisonBasis==="complete")return;let i=e.comparisonBasis,o=Ir(t,n);if(o.kind==="not_comparable"&&o.reason!=="previous_zero")return{basis:i,kind:"neutral",tone:"neutral",label:o.label,copy:"",reason:o.reason};let s=a.format,c=e.currentPeriod?.label||t.label||"Current period",u=e.previousPeriod?.label||n.label||"Previous period",l=typeof t.value=="number"?t.value:e.currentValue,d=typeof e.previousFullValue=="number"?e.previousFullValue:typeof n.value=="number"?n.value:void 0,p=e.grain==="day"?"full day":`full ${_n(e.grain)}`,g=d===void 0?void 0:`${u} ${p}: ${s(d)}`,f=d===void 0?void 0:`${p.charAt(0).toUpperCase()}${p.slice(1)}: ${s(d)}`;if(i==="like_for_like"&&typeof e.previousToDateValue=="number"&&typeof l=="number"){let h=Ir({value:l,status:t.status},{value:e.previousToDateValue,status:"observed"}),I=os(e,a.locale);if(h.kind==="change"){let x=h.percent;return{basis:i,kind:"change",percent:x,tone:x===0?"neutral":x>0?"positive":"negative",label:`${x>0?"↑":x<0?"↓":"→"} ${Math.abs(x).toFixed(1)}%`,copy:Er(e.grain),secondary:g,compactSecondary:f,title:I}}return{basis:i,kind:"neutral",tone:"neutral",label:h.label,copy:Er(e.grain),secondary:g,compactSecondary:f,title:I,reason:h.reason}}if(i==="not_comparable")return{basis:i,kind:"neutral",tone:"neutral",label:"Not comparable",copy:e.reason||"",reason:e.reason};let y=[typeof l=="number"?`${c} so far: ${s(l)}`:`${c}: in progress`];return d!==void 0&&y.push(`${u}: ${s(d)} (${p})`),{basis:"current_in_progress_no_time",kind:"neutral",tone:"neutral",label:y.join(" · "),copy:"",title:e.reason,reason:e.reason}},Nr=e=>e?.grain==="day"?"Yesterday at this time":`Same point last ${_n(e?.grain)}`,Ra=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?"":e.toISOString().slice(0,10);let t=typeof e=="string"?e.trim():"";return/^\d{4}-\d{2}-\d{2}/.test(t)?t.slice(0,10):""},Rr=(e,t)=>{let n=Ra(t);if(!(!n||!e)){if(e.previousPeriod?.start&&Ra(e.previousPeriod.start)===n)return"previous";if(e.currentPeriod?.start&&Ra(e.currentPeriod.start)===n)return"current"}},Lr=(e,t,n,a={format:String})=>{if(!e||!e.series?.length||!e.comparisonBasis||e.comparisonBasis==="complete")return;let i=Rr(e,t);if(!i)return;let o=String(n??""),s=e.series.find(u=>u.key===o);if(!s)return;let c=e.comparisonBasis;if(i==="previous"){let u=c==="like_for_like"&&typeof s.previousToDateValue=="number";return{side:i,basis:c,toDate:u,plotValue:u?s.previousToDateValue:void 0,fullValue:s.previousFullValue}}return{side:i,basis:c,toDate:!1,display:zr({...e,currentValue:s.currentValue,previousToDateValue:s.previousToDateValue,previousFullValue:s.previousFullValue},{value:s.currentValue,status:s.currentValue===void 0?"missing":"observed"},{value:s.previousFullValue,status:s.previousFullValue===void 0?"missing":"observed"},a)}},La=e=>!!(e&&e.seriesField&&e.series?.length&&e.comparisonBasis&&e.comparisonBasis!=="complete"&&e.comparisonBasis!=="not_comparable"),ss=e=>{if(!La(e))return;let t=e.currentPeriod?.label||"Current period";return e.comparisonBasis==="like_for_like"?`${t} so far, compared with ${Nr(e).toLowerCase()}`:`${t} so far; the previous period is shown in full, so the bars are not like for like`},cs=(e,t,n)=>{if(!t)return[];if(t.side==="previous")return typeof t.fullValue=="number"&&t.toDate?[`Full ${e?.grain==="day"?"day":_n(e?.grain)}: ${n(t.fullValue)}`]:[];let a=t.display;return a?a.kind==="change"&&a.percent!==void 0?[`${a.label} ${a.copy}`.trim()]:a.kind==="neutral"&&a.label&&t.basis==="like_for_like"?[a.label]:[]:[]},ta="__previous_to_date",ls="Previous to date",Dr=(e,t)=>{let n=e.trim().toLowerCase(),a=t.trim().toLowerCase();return n===a||n.endsWith(`.${a}`)||a.endsWith(`.${n}`)},ds=e=>{let t=e.periodComparison,n=e.rows;if(!n?.length||!La(t)||t.comparisonBasis!=="like_for_like"||!t.series?.some(p=>typeof p.previousToDateValue=="number"))return e;let a=e.columnMetadata??[],i=e.columns?.filter(Boolean)??(a.length?a.map(p=>String(p.key??p.name??"")).filter(Boolean):Object.keys(n[0]??{}));if(i.includes(ta))return e;let o=i.find(p=>Dr(t.seriesField,p));if(!o)return e;let s=p=>a.find(g=>(g.key??g.name)===p),c=i.find(p=>{let g=s(p);return g?.semanticRole==="date"||g?.role==="date"||g?.dataType==="date"||g?.dataType==="datetime"}),u=(t.measureField?i.find(p=>Dr(t.measureField,p)):void 0)??i.find(p=>s(p)?.semanticRole==="measure"),l=n.map(p=>{let g=c?Rr(t,p[c]):"current",f=t.series?.find(h=>h.key===String(p[o]??"")),y=g&&typeof f?.previousToDateValue=="number"?f.previousToDateValue:null;return{...p,[ta]:y}}),d={...(u?s(u):void 0)??{dataType:"number",semanticRole:"measure"},key:ta,name:void 0,label:ls,aggregation:"none",sourceField:void 0,priority:"secondary",groupable:!1,filterable:!1};return{...e,rows:l,columns:e.columns?[...e.columns,ta]:e.columns,columnMetadata:a.length?[...a,d]:e.columnMetadata}},us=e=>!!(e?.lastPeriodInProgress||e?.caveats?.some(t=>t.code==="incomplete_final_period")||e?.periodComparison?.currentPeriod?.inProgress),ps="In progress";var na,Re,Pr,Bt,Or,Fr,Ur,Da,aa,wn,Br,Pa,Oa,Fa,qr,ra={},ia=[],fs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,oa=Array.isArray;function Et(e,t){for(var n in t)e[n]=t[n];return e}function Ua(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hs(e,t,n){var a,i,o,s={};for(o in t)o=="key"?a=t[o]:o=="ref"?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?na.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return sa(e,s,a,i,null)}function sa(e,t,n,a,i){var o={type:e,props:t,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Pr,__i:-1,__u:0};return i==null&&Re.vnode!=null&&Re.vnode(o),o}function ce(e){return e.children}function ca(e,t){this.props=e,this.context=t}function cn(e,t){if(t==null)return e.__?cn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?cn(e):null}function ms(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,a=[],i=[],o=Et({},t);o.__v=t.__v+1,Re.vnode&&Re.vnode(o),qa(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,a,n??cn(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,Kr(a,o,i),t.__e=t.__=null,o.__e!=n&&Vr(o)}}function Vr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Vr(e)}function Ba(e){(!e.__d&&(e.__d=!0)&&Bt.push(e)&&!la.__r++||Or!=Re.debounceRendering)&&((Or=Re.debounceRendering)||Fr)(la)}function la(){try{for(var e,t=1;Bt.length;)Bt.length>t&&Bt.sort(Ur),e=Bt.shift(),t=Bt.length,ms(e)}finally{Bt.length=la.__r=0}}function jr(e,t,n,a,i,o,s,c,u,l,d){var p,g,f,y,h,I,x,m=a&&a.__k||ia,T=t.length;for(u=gs(n,t,m,u,T),p=0;p<T;p++)(f=n.__k[p])!=null&&(g=f.__i!=-1&&m[f.__i]||ra,f.__i=p,I=qa(e,f,g,i,o,s,c,u,l,d),y=f.__e,f.ref&&g.ref!=f.ref&&(g.ref&&ja(g.ref,null,f),d.push(f.ref,f.__c||y,f)),h==null&&y!=null&&(h=y),(x=!!(4&f.__u))||g.__k===f.__k?(u=Hr(f,u,e,x),x&&g.__e&&(g.__e=null)):typeof f.type=="function"&&I!==void 0?u=I:y&&(u=y.nextSibling),f.__u&=-7);return n.__e=h,u}function gs(e,t,n,a,i){var o,s,c,u,l,d=n.length,p=d,g=0;for(e.__k=new Array(i),o=0;o<i;o++)(s=t[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[o]=sa(null,s,null,null,null):oa(s)?s=e.__k[o]=sa(ce,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[o]=sa(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[o]=s,u=o+g,s.__=e,s.__b=e.__b+1,c=null,(l=s.__i=bs(s,n,u,p))!=-1&&(p--,(c=n[l])&&(c.__u|=2)),c==null||c.__v==null?(l==-1&&(i>d?g--:i<d&&g++),typeof s.type!="function"&&(s.__u|=4)):l!=u&&(l==u-1?g--:l==u+1?g++:(l>u?g--:g++,s.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<d;o++)(c=n[o])!=null&&(2&c.__u)==0&&(c.__e==a&&(a=cn(c)),Zr(c,c));return a}function Hr(e,t,n,a){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=Hr(i[o],t,n,a));return t}e.__e!=t&&(a&&(t&&e.type&&!t.parentNode&&(t=cn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function bs(e,t,n,a){var i,o,s,c=e.key,u=e.type,l=t[n],d=l!=null&&(2&l.__u)==0;if(l===null&&c==null||d&&c==l.key&&u==l.type)return n;if(a>(d?1:0)){for(i=n-1,o=n+1;i>=0||o<t.length;)if((l=t[s=i>=0?i--:o++])!=null&&(2&l.__u)==0&&c==l.key&&u==l.type)return s}return-1}function Wr(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||fs.test(t)?n:n+"px"}function da(e,t,n,a,i){var o,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof a=="string"&&(e.style.cssText=a=""),a)for(t in a)n&&t in n||Wr(e.style,t,"");if(n)for(t in n)a&&n[t]==a[t]||Wr(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Br,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?a?n[wn]=a[wn]:(n[wn]=Pa,e.addEventListener(t,o?Fa:Oa,o)):e.removeEventListener(t,o?Fa:Oa,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Gr(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[aa]==null)t[aa]=Pa++;else if(t[aa]<n[wn])return;return n(Re.event?Re.event(t):t)}}}function qa(e,t,n,a,i,o,s,c,u,l){var d,p,g,f,y,h,I,x,m,T,F,M,Q,Y,X,j=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=Re.__b)&&d(t);e:if(typeof j=="function")try{if(x=t.props,m=j.prototype&&j.prototype.render,T=(d=j.contextType)&&a[d.__c],F=d?T?T.props.value:d.__:a,n.__c?I=(p=t.__c=n.__c).__=p.__E:(m?t.__c=p=new j(x,F):(t.__c=p=new ca(x,F),p.constructor=j,p.render=xs),T&&T.sub(p),p.state||(p.state={}),p.__n=a,g=p.__d=!0,p.__h=[],p._sb=[]),m&&p.__s==null&&(p.__s=p.state),m&&j.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Et({},p.__s)),Et(p.__s,j.getDerivedStateFromProps(x,p.__s))),f=p.props,y=p.state,p.__v=t,g)m&&j.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),m&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(m&&j.getDerivedStateFromProps==null&&x!==f&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(x,F),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(x,p.__s,F)===!1){t.__v!=n.__v&&(p.props=x,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(U){U&&(U.__=t)}),ia.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(x,p.__s,F),m&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(f,y,h)})}if(p.context=F,p.props=x,p.__P=e,p.__e=!1,M=Re.__r,Q=0,m)p.state=p.__s,p.__d=!1,M&&M(t),d=p.render(p.props,p.state,p.context),ia.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++Q<25);p.state=p.__s,p.getChildContext!=null&&(a=Et(Et({},a),p.getChildContext())),m&&!g&&p.getSnapshotBeforeUpdate!=null&&(h=p.getSnapshotBeforeUpdate(f,y)),Y=d!=null&&d.type===ce&&d.key==null?Yr(d.props.children):d,c=jr(e,oa(Y)?Y:[Y],t,n,a,i,o,s,c,u,l),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),I&&(p.__E=p.__=null)}catch(U){if(t.__v=null,u||o!=null)if(U.then){for(t.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for(X=o.length;X--;)Ua(o[X]);Va(t)}else t.__e=n.__e,t.__k=n.__k,U.then||Va(t);Re.__e(U,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=vs(n.__e,t,n,a,i,o,s,u,l);return(d=Re.diffed)&&d(t),128&t.__u?void 0:c}function Va(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Va))}function Kr(e,t,n){for(var a=0;a<n.length;a++)ja(n[a],n[++a],n[++a]);Re.__c&&Re.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){Re.__e(o,i.__v)}})}function Yr(e){return typeof e!="object"||e==null||e.__b>0?e:oa(e)?e.map(Yr):e.constructor!==void 0?null:Et({},e)}function vs(e,t,n,a,i,o,s,c,u){var l,d,p,g,f,y,h,I=n.props||ra,x=t.props,m=t.type;if(m=="svg"?i="http://www.w3.org/2000/svg":m=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((f=o[l])&&"setAttribute"in f==!!m&&(m?f.localName==m:f.nodeType==3)){e=f,o[l]=null;break}}if(e==null){if(m==null)return document.createTextNode(x);e=document.createElementNS(i,m,x.is&&x),c&&(Re.__m&&Re.__m(t,o),c=!1),o=null}if(m==null)I===x||c&&e.data==x||(e.data=x);else{if(o=m=="textarea"&&x.defaultValue!=null?null:o&&na.call(e.childNodes),!c&&o!=null)for(I={},l=0;l<e.attributes.length;l++)I[(f=e.attributes[l]).name]=f.value;for(l in I)f=I[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in x||l=="value"&&"defaultValue"in x||l=="checked"&&"defaultChecked"in x||da(e,l,null,f,i);for(l in x)f=x[l],l=="children"?g=f:l=="dangerouslySetInnerHTML"?d=f:l=="value"?y=f:l=="checked"?h=f:c&&typeof f!="function"||I[l]===f||da(e,l,f,I[l],i);if(d)c||p&&(d.__html==p.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(p&&(e.innerHTML=""),jr(t.type=="template"?e.content:e,oa(g)?g:[g],t,n,a,m=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:n.__k&&cn(n,0),c,u),o!=null)for(l=o.length;l--;)Ua(o[l]);c&&m!="textarea"||(l="value",m=="progress"&&y==null?e.removeAttribute("value"):y!=null&&(y!==e[l]||m=="progress"&&!y||m=="option"&&y!=I[l])&&da(e,l,y,I[l],i),l="checked",h!=null&&h!=e[l]&&da(e,l,h,I[l],i))}return e}function ja(e,t,n){try{if(typeof e=="function"){var a=typeof e.__u=="function";a&&e.__u(),a&&t==null||(e.__u=e(t))}else e.current=t}catch(i){Re.__e(i,n)}}function Zr(e,t,n){var a,i;if(Re.unmount&&Re.unmount(e),(a=e.ref)&&(a.current&&a.current!=e.__e||ja(a,null,t)),(a=e.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(o){Re.__e(o,t)}a.base=a.__P=null}if(a=e.__k)for(i=0;i<a.length;i++)a[i]&&Zr(a[i],t,n||typeof e.type!="function");n||Ua(e.__e),e.__c=e.__=e.__e=void 0}function xs(e,t,n){return this.constructor(e,n)}function Jr(e,t,n){var a,i,o,s;t==document&&(t=document.documentElement),Re.__&&Re.__(e,t),i=(a=!1)?null:t.__k,o=[],s=[],qa(t,e=t.__k=hs(ce,null,[e]),i||ra,ra,t.namespaceURI,i?null:t.firstChild?na.call(t.childNodes):null,o,i?i.__e:t.firstChild,a,s),Kr(o,e,s)}function Ha(e){function t(n){var a,i;return this.getChildContext||(a=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){a=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&a.forEach(function(s){s.__e=!0,Ba(s)})},this.sub=function(o){a.add(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){a&&a.delete(o),s&&s.call(o)}}),n.children}return t.__c="__cC"+qr++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,a){return n.children(a)}).contextType=t,t}na=ia.slice,Re={__e:function(e,t,n,a){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,a||{}),s=i.__d),s)return i.__E=i}catch(c){e=c}throw e}},Pr=0,ca.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Et({},this.state),typeof e=="function"&&(e=e(Et({},n),this.props)),e&&Et(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ba(this))},ca.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ba(this))},ca.prototype.render=ce,Bt=[],Fr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ur=function(e,t){return e.__v.__b-t.__v.__b},la.__r=0,Da=Math.random().toString(8),aa="__d"+Da,wn="__a"+Da,Br=/(PointerCapture)$|Capture$/i,Pa=0,Oa=Gr(!1),Fa=Gr(!0),qr=0;var Zt,Oe,Wa,Xr,kn=0,Qr=[],je=Re,ei=je.__b,ti=je.__r,ni=je.diffed,ai=je.__c,ri=je.unmount,ii=je.__;function Sn(e,t){je.__h&&je.__h(Oe,e,kn||t),kn=0;var n=Oe.__H||(Oe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function S(e){return kn=1,ys(si,e)}function ys(e,t,n){var a=Sn(Zt++,2);if(a.t=e,!a.__c&&(a.__=[si(void 0,t),function(c){var u=a.__N?a.__N[0]:a.__[0],l=a.t(u,c);u!==l&&(a.__N=[l,a.__[1]],a.__c.setState({}))}],a.__c=Oe,!Oe.__f)){var i=function(c,u,l){if(!a.__c.__H)return!0;var d=a.__c.__H.__.filter(function(g){return g.__c});if(d.every(function(g){return!g.__N}))return!o||o.call(this,c,u,l);var p=a.__c.props!==c;return d.some(function(g){if(g.__N){var f=g.__[0];g.__=g.__N,g.__N=void 0,f!==g.__[0]&&(p=!0)}}),o&&o.call(this,c,u,l)||p};Oe.__f=!0;var o=Oe.shouldComponentUpdate,s=Oe.componentWillUpdate;Oe.componentWillUpdate=function(c,u,l){if(this.__e){var d=o;o=void 0,i(c,u,l),o=d}s&&s.call(this,c,u,l)},Oe.shouldComponentUpdate=i}return a.__N||a.__}function J(e,t){var n=Sn(Zt++,3);!je.__s&&Ya(n.__H,t)&&(n.__=e,n.u=t,Oe.__H.__h.push(n))}function $n(e,t){var n=Sn(Zt++,4);!je.__s&&Ya(n.__H,t)&&(n.__=e,n.u=t,Oe.__h.push(n))}function R(e){return kn=5,qe(function(){return{current:e}},[])}function qe(e,t){var n=Sn(Zt++,7);return Ya(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function O(e,t){return kn=8,qe(function(){return e},t)}function Ga(e){var t=Oe.context[e.__c],n=Sn(Zt++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Oe)),t.props.value):e.__}function _s(){for(var e;e=Qr.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ua),t.__h.some(Ka),t.__h=[]}catch(n){t.__h=[],je.__e(n,e.__v)}}}je.__b=function(e){Oe=null,ei&&ei(e)},je.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ii&&ii(e,t)},je.__r=function(e){ti&&ti(e),Zt=0;var t=(Oe=e.__c).__H;t&&(Wa===Oe?(t.__h=[],Oe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ua),t.__h.some(Ka),t.__h=[],Zt=0)),Wa=Oe},je.diffed=function(e){ni&&ni(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Qr.push(t)!==1&&Xr===je.requestAnimationFrame||((Xr=je.requestAnimationFrame)||ws)(_s)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Wa=Oe=null},je.__c=function(e,t){t.some(function(n){try{n.__h.some(ua),n.__h=n.__h.filter(function(a){return!a.__||Ka(a)})}catch(a){t.some(function(i){i.__h&&(i.__h=[])}),t=[],je.__e(a,n.__v)}}),ai&&ai(e,t)},je.unmount=function(e){ri&&ri(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(a){try{ua(a)}catch(i){t=i}}),n.__H=void 0,t&&je.__e(t,n.__v))};var oi=typeof requestAnimationFrame=="function";function ws(e){var t,n=function(){clearTimeout(a),oi&&cancelAnimationFrame(t),setTimeout(e)},a=setTimeout(n,35);oi&&(t=requestAnimationFrame(n))}function ua(e){var t=Oe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Oe=t}function Ka(e){var t=Oe;e.__c=e.__(),Oe=t}function Ya(e,t){return!e||e.length!==t.length||t.some(function(n,a){return n!==e[a]})}function si(e,t){return typeof t=="function"?t(e):t}var ks=0;function r(e,t,n,a,i,o){t||(t={});var s,c,u=t;if("ref"in u)for(c in u={},t)c=="ref"?s=t[c]:u[c]=t[c];var l={type:e,props:u,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ks,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(s=e.defaultProps))for(c in s)u[c]===void 0&&(u[c]=s[c]);return Re.vnode&&Re.vnode(l),l}const pa=(e,t=11)=>{let n=0;for(let a of e)n+=(a.codePointAt(0)??0)>11904?1:.58;return Math.ceil(n*t)},Ss=(e,t=12,n=20)=>Math.max(n,Math.ceil(e)+t),$s=(e,t=12,n=8)=>Math.ceil(t+e+n),Ts=(e,t,n=11)=>e.length===0||Math.max(...e.map(a=>pa(a,n)))<=t-4?{kind:"native"}:e.length>12?{kind:"auto"}:Math.floor((t-4)/(.58*n))>=6?{kind:"truncate",width:Math.max(16,Math.floor(t-4))}:{kind:"rotate",rotate:40,width:72},Za=e=>Array.isArray(e)?e:e?[e]:[],Cs=(e,t)=>{let n=[];for(let a of e)if(Array.isArray(a.data))for(let i of a.data){let o=i;i&&typeof i=="object"&&!Array.isArray(i)&&(o=i.value),Array.isArray(o)&&(o=o[1]),typeof o=="number"&&Number.isFinite(o)&&n.push(o)}return n},As=(e,t,n)=>{let a=e.axisLabel?.formatter,i=Cs(t),o=typeof e.min=="number"?e.min:Math.min(0,...i),s=typeof e.max=="number"?e.max:Math.max(0,...i)*1.1,c=i.length||e.min!==void 0?[o,s]:[];return c.length?Math.max(...c.map(u=>{let l=String(u);try{typeof a=="function"&&(l=String(a(u)))}catch{}return pa(l)})):pa("00000")},Ms=(e,t)=>{if(!(t>0)||Array.isArray(e.grid))return e;let n=Za(e.xAxis),a=Za(e.yAxis),i=a[0]?.type==="category",o=i?a[0]:n[0],s=i?n[0]:a[0];if(!o||o.type!=="category"||!s||s.type!=="value")return e;let c=t<420,u=Za(e.series),l={...e.grid??{}},d=(o.data??[]).map(h=>String(h&&typeof h=="object"?h.value??"":h)),p={...e,grid:l},g={...o},f={...s},y=0;if(i)c&&(y=Math.min(t*.35,90),g={...g,axisLabel:{...o.axisLabel,width:Math.floor(y),overflow:"truncate",ellipsis:"…"}},l.left=8);else{let h=As(s,u);if(y=h+8,c&&!s.name)l.left=8;else if(s.name){let I=Ss(h);f={...f,nameGap:Math.min(s.nameGap??I,I)},y+=18}}if(!i){let h=typeof l.left=="number"?l.left:0,I=typeof l.right=="number"?l.right:0,x=Ts(d,Math.max(40,t-h-I-y)/Math.max(1,d.length)),m=o.axisLabel?.fontSize??11,T=m+2;if(x.kind==="truncate"||x.kind==="rotate"){let F=x.kind==="rotate"?x.rotate:0;if(g.axisLabel={...o.axisLabel,interval:0,hideOverlap:!1,rotate:F,width:x.width,overflow:"truncate",ellipsis:"…"},F){let M=Math.max(0,...d.map(Y=>pa(Y,m))),Q=Math.min(x.width,M);T=Math.ceil(Q*Math.sin(F*Math.PI/180))+m}}o.name&&c?g.nameGap=Math.min(o.nameGap??99,$s(T,6,4)):c&&l.containLabel===!0&&typeof l.bottom=="number"&&(l.bottom=Math.min(l.bottom,8))}return i?(p.yAxis=Array.isArray(e.yAxis)?[g,...a.slice(1)]:g,p.xAxis=Array.isArray(e.xAxis)?[f,...n.slice(1)]:f):(p.xAxis=Array.isArray(e.xAxis)?[g,...n.slice(1)]:g,p.yAxis=Array.isArray(e.yAxis)?[f,...a.slice(1)]:f),p},Is=/^(\d{4})-(\d{2})-(\d{2})$/,Es=/^(\d{4})-(\d{2})$/,zs=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/,Ns=/(?:Z|[+-]\d{2}:?\d{2})$/i,ci=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:{date:e,calendar:!1,hasTime:!0};if(typeof e=="number"&&Number.isFinite(e))return{date:new Date(e),calendar:!1,hasTime:!0};if(typeof e!="string")return null;let t=e.trim(),n=Is.exec(t);if(n)return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3]))),calendar:!0,hasTime:!1};if(n=Es.exec(t),n)return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,1)),calendar:!0,hasTime:!1};if(n=zs.exec(t),n&&!Ns.test(t))return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3]),Number(n[4]),Number(n[5]),Number(n[6]??0))),calendar:!0,hasTime:!0};if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return null;let a=new Date(t);return Number.isNaN(a.getTime())?null:{date:a,calendar:!1,hasTime:!0}},Rs=e=>{if(e){if(/h/i.test(e)&&/:/.test(e))return"hour";if(/d{2}/i.test(e))return"day";if(/q/i.test(e))return"quarter";if(/M{2,}/.test(e))return"month";if(/y{2,}/i.test(e))return"year"}},li=e=>{let t=e.map(ci).filter(a=>a!==null);if(t.length===0)return;let n=a=>a.date.getUTCHours()+a.date.getUTCMinutes();return t.some(a=>a.hasTime&&n(a)!==0)?t.every(a=>a.date.getUTCMinutes()===0)?"hour":void 0:t.length>1&&t.every(a=>a.date.getUTCDate()===1)?"month":"day"},Jt=(e,t)=>{try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(e,{...t,timeZone:"UTC"})}},di=(e,t,n={})=>{let a=ci(e);if(!a)return;let i=t?.grain??Rs(t?.formatPattern)??n.grain,o=a.calendar?"UTC":n.timezone||void 0,{date:s}=a;switch(i){case"year":return Jt(n.locale,{year:"numeric",timeZone:o}).format(s);case"quarter":{let c=Number(Jt("en-US",{month:"numeric",timeZone:o}).format(s)),u=Jt(n.locale,{year:"numeric",timeZone:o}).format(s);return`Q${Math.floor((c-1)/3)+1} ${u}`}case"month":return Jt(n.locale,{month:"short",year:"numeric",timeZone:o}).format(s);case"week":case"day":return Jt(n.locale,{day:"numeric",month:"short",year:"numeric",timeZone:o}).format(s);case"hour":return Jt(n.locale,{day:"numeric",month:"short",hour:"numeric",minute:"2-digit",timeZone:o}).format(s);default:return Jt(n.locale,{dateStyle:"medium",...a.hasTime?{timeStyle:"short"}:{},timeZone:o}).format(s)}},ui=e=>{let t=e?/\.([0#]+)/.exec(e):null;if(!t)return;let n=t[1];return{min:(n.match(/0/g)??[]).length,max:n.length}},Ja=(e,t)=>{let n=ui(e);return n?{minimumFractionDigits:n.min,maximumFractionDigits:n.max}:{maximumFractionDigits:t}},Tn=e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){let t=Number(e);if(Number.isFinite(t))return t}return null},pi=(e,t)=>t&&Math.abs(e)>=1e4?"compact":"standard",fi=(e,t={})=>new Intl.NumberFormat(t.locale,{notation:pi(e,t.compact),...Ja(t.pattern,t.maxFractionDigits??2)}).format(e),Ls=(e,t,n={})=>{let a=t?.trim().toUpperCase();if(a&&/^[A-Z]{3}$/.test(a))try{return new Intl.NumberFormat(n.locale,{style:"currency",currency:a,notation:pi(e,n.compact),...ui(n.pattern)?Ja(n.pattern,2):{}}).format(e)}catch{}return fi(e,{...n,maxFractionDigits:2})},Ds=(e,t={})=>{let n=!!(t.pattern&&/(?<!\\)%/.test(t.pattern)),a=Ja(t.pattern,2);return new Intl.NumberFormat(t.locale,{style:"percent",...a}).format(n?e:e/100)},Xa=(e,t,n={})=>{let{locale:a,compact:i}=n;return t?.dataType==="currency"?Ls(e,t.currencyCode||n.currencyCode,{locale:a,compact:i,pattern:t.formatPattern}):t?.dataType==="percent"?Ds(e,{locale:a,pattern:t.formatPattern}):fi(e,{locale:a,compact:i,pattern:t?.formatPattern,maxFractionDigits:n.maxFractionDigits})},Ps=(e,t,n={})=>{if(e==null||e==="")return"—";if(t?.dataType==="date"||t?.dataType==="datetime"){let a=di(e,t,n);if(a)return a}if(t?.dataType==="currency"||t?.dataType==="percent"){let a=Tn(e);if(a!==null)return Xa(a,t,n)}return typeof e=="number"&&Number.isFinite(e)?Xa(e,t,{...n,maxFractionDigits:4}):typeof e=="boolean"?e?n.yes??"Yes":n.no??"No":String(e)},fa={resultDetails:"Result details",liveMetric:"Live metric",currentValue:"Current value",noMatchTitle:"No matching data",noMatchBody:"No approved records matched this question.",chartType:"Chart type",chooseChartType:"Choose chart type",aggregate:"Aggregate",aggregateTitle:"Ask for a new governed calculation",aggregateCharge:"New governed answer. Query charges may apply.",chartFallback:"Chart",chartLine:"Line",chartBar:"Bar",chartStackedBar:"Stacked bar",chartLineHint:"Best for change over time.",chartBarHint:"Compare categories or ranked values.",chartStackedBarHint:"Compare totals and their parts.",aggregationSum:"Total",aggregationAvg:"Average",aggregationMin:"Minimum",aggregationMax:"Maximum",aggregationCount:"Total count",aggregationCountDistinct:"Unique count",download:"Download",downloadData:"Download this data",expandTable:"Expand table",expandChart:"Expand chart",restoreView:"Restore assistant view",aboutResult:"About this result",aboutPeriod:"Period",aboutResults:"Results",aboutChecked:"Checked",aboutTimezone:"Timezone",aboutSourceData:"Source data",aboutFilters:"Filters",rowOne:"{count} row",rowMany:"{count} rows",filtersOne:"{count} applied filter",filtersMany:"{count} applied filters",filtersApplied:"{count} applied",notSet:"Not set",noValue:"No value",yes:"Yes",no:"No",chartValues:"Values",chartTitle:"{measure} by {dimension}",seriesLimited:"Showing {shown} of {total} series.",summaryLatest:"Latest ({category}): {values}.",summaryNoTrend:"No numeric trend values are available.",summaryHighest:"Highest: {category}, {series} {value}.",summaryNoComparison:"No numeric comparison values are available.",zoomControls:"Chart zoom controls",zoomIn:"Zoom in chart",zoomOut:"Zoom out chart",zoomReset:"Reset chart zoom",zoomResetShort:"Reset",zoomNone:"No chart points",zoomAllOne:"All {count} point",zoomAllMany:"All {count} points",zoomRange:"{start} – {end} · {visible} of {count} points",inProgress:"in progress",newContent:"New content",updatedAt:"Updated {time}",liveData:"Live data",viewData:"View data",hideData:"Hide data",inProgressLegend:"In progress",governedResult:"Governed result"},bt=(e,t)=>e.replace(/\{(\w+)\}/g,(n,a)=>String(t[a]??"")),Os=e=>Object.fromEntries(Object.entries(e??{}).filter(([,t])=>t!=null)),Qa=e=>({...fa,...Os(e),explanation:{...e?.explanation}});let hi=()=>Promise.resolve().then(()=>Fo),Cn=null,mi=!1;const Fs=e=>{hi=e,Cn=null,mi=!0},Us=()=>(Cn||(Cn=hi().catch(e=>{throw Cn=null,e})),Cn),Xt={background:"#ffffff",border:"#dce4e9",muted:"#5b7186",surface:"#ffffff",text:"#0f1e2a",colors:["#2f7f55","#2563eb","#b45309","#7c3aed"]},gi="cf-widget-category-zoom",bi=.68,ln=e=>({startIndex:0,endIndex:Math.max(0,e-1)}),An=(e,t)=>{if(t<=0)return ln(0);let n=t-1,a=Math.max(0,Math.min(n,Math.floor(Math.min(e.startIndex,e.endIndex))));return{startIndex:a,endIndex:Math.max(a,Math.min(n,Math.floor(Math.max(e.startIndex,e.endIndex))))}},vi=(e,t,n)=>{let a=An(e,n);if(n<=2)return ln(n);let i=a.endIndex-a.startIndex+1,o=t==="in"?Math.max(2,Math.floor(i*bi)):Math.min(n,Math.ceil(i/bi));if(o===i)return a;let s=(a.startIndex+a.endIndex)/2,c=n-o,u=Math.max(0,Math.min(c,Math.round(s-(o-1)/2)));return{startIndex:u,endIndex:u+o-1}},Bs=(e,t,n=fa)=>{let a=e.length;if(a===0)return n.zoomNone;let i=An(t,a);return i.startIndex===0&&i.endIndex===a-1?bt(a===1?n.zoomAllOne:n.zoomAllMany,{count:a}):bt(n.zoomRange,{start:e[i.startIndex]??"",end:e[i.endIndex]??"",visible:i.endIndex-i.startIndex+1,count:a})},qs=e=>{let t=e.replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:"Value"},Vs=e=>{let t=new Set,n=[];return e.forEach(a=>{let i=a?.trim();!i||t.has(i)||(t.add(i),n.push(i))}),n},er=Tn,Mn=e=>{if(e===null)return"null:";if(e===void 0)return"undefined:";if(typeof e=="object")try{return`object:${JSON.stringify(e)}`}catch{return"object:"}return`${typeof e}:${String(e)}`},In=(e,t)=>t?e.columnMetadata?.find(n=>n.key===t):void 0,tr=(e,t)=>{let n=In(e,t);if(!n||n.currencyCode||n.dataType!=="currency")return n;let a=e.currency;return a?.code&&!a.isMixed?{...n,currencyCode:a.code}:n},En=(e,t)=>In(e,t)?.label?.trim()||qs(t),js=(e,t,n,a)=>({locale:t,timezone:e.timezone||e.periodComparison?.timezone,grain:a,yes:n.yes,no:n.no}),xi=e=>e?.dataType==="date"||e?.dataType==="datetime"||e?.semanticRole==="date",yi=(e,t,n)=>{let a=In(e,t);if(xi(a))return a?.grain??e.periodComparison?.grain??li(n.map(i=>i[t]))},_i=(e,t,n,a,i,o)=>{if(n==null||n==="")return a.notSet;let s=In(e,t);if(s?.dataType==="boolean"){let c=String(n).trim().toLowerCase();return n===!1||n===0||["0","false","no"].includes(c)?a.no:a.yes}if(xi(s)){let c=di(n,s,js(e,i,a,o));if(c)return c}return String(n)},Qt=(e,t,n,a=!1,i)=>Xa(e,t,{locale:i,compact:a,currencyCode:n?.currency?.code&&!n.currency.isMixed?n.currency.code:void 0}),Hs=(e,t)=>{if(e.presentation==="table"||e.presentation==="kpi")return null;if(t)return t;let n=e.chartRecommendation?.type;return n==="line"||n==="bar"||n==="stacked_bar"?n:e.type==="line"||e.type==="bar"||e.type==="stacked_bar"?e.type:null},wi=e=>e.chartRecommendation?.categoryField?.trim()||e.label?.trim()||e.columnMetadata?.find(t=>["date","dimension","geography","boolean"].includes(t.semanticRole))?.key||e.columns?.[0],ki=e=>e.chartRecommendation?.seriesField?.trim()||e.seriesField?.trim()||e.series?.trim()||void 0,Si=(e,t,n)=>{let a=Vs([...e.chartRecommendation?.valueFields??[],...e.valueFields??[],e.value,...e.columnMetadata?.filter(o=>o.semanticRole==="measure").map(o=>o.key)??[]]),i=new Set([...e.columns??[],...e.columnMetadata?.map(o=>o.key)??[],...Object.keys(e.rows?.[0]??{})]);return a.filter(o=>o!==t&&o!==n&&i.has(o)).filter(o=>e.rows?.some(s=>er(s[o])!==null))},Ws=(e,t,n,a,i,o,s)=>{let c=i?` ${bt(o.seriesLimited,{shown:a.length,total:a.length+i})}`:"",u=(d,p)=>Qt(d,p,e,!1,s);if(t==="line"){let d=n.length-1,p=a.map(g=>{let f=g.values[d];return f==null?null:`${g.name}: ${u(f,g.valueColumn)}`}).filter(g=>!!g);return p.length?`${bt(o.summaryLatest,{category:n[d]??"",values:p.join("; ")})}${c}`:`${o.summaryNoTrend}${c}`}let l;return a.forEach(d=>{d.values.forEach((p,g)=>{p===null||l&&p<=l.value||(l={category:n[g]??o.notSet,series:d,value:p})})}),l?`${bt(o.summaryHighest,{category:l.category,series:l.series.name,value:u(l.value,l.series.valueColumn)})}${c}`:`${o.summaryNoComparison}${c}`},nr=(e,t,n={})=>{let a=Qa(n.labels),i=n.locale,o=Hs(e,t),s=wi(e),c=e.rows??[];if(!o||!s||c.length===0)return null;let u=ki(e),l=Si(e,s,u);if(l.length===0)return null;let d=l.length===1?u:void 0,p=yi(e,s,c),g=l[0],f=d&&La(e.periodComparison)&&(!e.periodComparison.measureField||!g||g===e.periodComparison.measureField||g.endsWith(`.${e.periodComparison.measureField}`)||e.periodComparison.measureField.endsWith(`.${g}`))?e.periodComparison:void 0,y=(()=>{if(!f?.seriesField||!d)return;let D=(q,C)=>q===C||q.endsWith(`.${C}`)||C.endsWith(`.${q}`);if(D(f.seriesField,s))return{group:s,time:d,timeIsSeries:!0};if(D(f.seriesField,d))return{group:d,time:s,timeIsSeries:!1}})(),h=D=>Qt(D,tr(e,g??""),e,!1,i),I=D=>f&&y?Lr(f,D[y.time],D[y.group],{format:h,locale:i}):void 0,x=(D,q)=>f?.comparisonBasis==="like_for_like"&&Lr(f,D,f.series?.[0]?.key)?.side==="previous"?Nr(f):q,m=[],T=new Set;c.forEach(D=>{let q=Mn(D[s]);if(T.has(q))return;T.add(q);let C=_i(e,s,D[s],a,i,p);m.push({key:q,label:y&&!y.timeIsSeries?x(D[s],C):C})});let F=m.map(D=>D.label),M=0,Q;if(d){let D=[],q=new Set;c.forEach(_=>{let L=Mn(_[d]);if(q.has(L))return;q.add(L);let $=_i(e,d,_[d],a,i,yi(e,d,c));D.push({key:L,label:y?.timeIsSeries?x(_[d],$):$})});let C=D.slice(0,4);M=Math.max(0,D.length-C.length);let Z=l[0];Q=C.map(_=>{let L=new Map,$=new Map;return c.forEach(P=>{if(Mn(P[d])!==_.key)return;let fe=Mn(P[s]);if(!L.has(fe)){let oe=I(P);$.set(fe,oe),L.set(fe,oe?.side==="previous"&&oe.plotValue!==void 0?oe.plotValue:er(P[Z]))}}),{field:Z,name:_.label,values:m.map(P=>L.get(P.key)??null),valueColumn:tr(e,Z),...y?{points:m.map(P=>$.get(P.key))}:{}}})}else M=Math.max(0,l.length-4),Q=l.slice(0,4).map(D=>({field:D,name:En(e,D),values:c.map(q=>er(q[D])),valueColumn:tr(e,D)}));if(Q.length===0)return null;let Y=En(e,s),X=a.chartValues;d?X=En(e,l[0]):Q.length===1&&(X=Q[0].name);let j=e.title?.trim()||bt(a.chartTitle,{measure:X,dimension:Y}),U;if(In(e,s)?.semanticRole==="date"&&m.length>1&&us(e)){let D="";c.forEach(C=>{let Z=String(C[s]??"");Z>D&&(D=Z)});let q=m.findIndex(C=>C.key===Mn(D));q>=0&&(U=q)}return{type:o,title:j,xAxisTitle:Y,yAxisTitle:X,categories:F,series:Q,omittedSeriesCount:M,inProgressIndex:U,...y&&f?{comparison:f,comparisonNote:ss(f)}:{},locale:i,labels:a,summary:Ws(e,o,F,Q,M,a,i)}},ar=[{value:"sum",label:"Total"},{value:"avg",label:"Average"},{value:"min",label:"Minimum"},{value:"max",label:"Maximum"},{value:"count",label:"Total count"},{value:"count_distinct",label:"Unique count"}],Gs={sum:"aggregationSum",avg:"aggregationAvg",min:"aggregationMin",max:"aggregationMax",count:"aggregationCount",count_distinct:"aggregationCountDistinct"},Ks=(e,t=fa)=>String(t[Gs[e]]),$i=(e,t)=>{let n=e.columnMetadata?.find(a=>a.key===t)?.allowedAggregations;return n?.length?ar.filter(a=>n.includes(a.value)):[...ar]},Ys=(e,t,n)=>{let a=wi(e);if(!a||!Si(e,a,ki(e)).includes(t)||!$i(e,t).some(o=>o.value===n))return;let i=ar.find(o=>o.value===n)?.label;if(i)return`Using the same approved data, filters, and period as "${e.title?.trim()||e.label?.trim()||"the previous chart"}", calculate ${i.toLowerCase()} of ${En(e,t)} for each ${En(e,a)}. Return a chart and show a table if this app permits it.`},Zs=(e,t=fa)=>{if(e.presentation==="table"||e.presentation==="kpi")return[];let n=nr(e);if(!n)return[];let a=[{type:"line",label:t.chartLine,hint:t.chartLineHint},{type:"bar",label:t.chartBar,hint:t.chartBarHint}];return n.series.length>1&&a.push({type:"stacked_bar",label:t.chartStackedBar,hint:t.chartStackedBarHint}),a},Js=e=>t=>{let n=e.inProgressIndex??-1,a=(Array.isArray(t)?t:[t]).filter(s=>{if(!s||typeof s!="object")return!1;let c=String(s.seriesId??"").startsWith("in-progress:"),u=s.dataIndex,l=s.value;return c?u===n:!(u===n&&l==null)}),i=String(a[0]?.axisValueLabel??a[0]?.name??""),o=s=>s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;");return[i?`<strong>${o(i)}</strong>`:"",...a.map(s=>{let c=e.series[Math.floor(Number(s.seriesIndex)/2)]??e.series[0];return`${String(s.marker??"")}${o(String(s.seriesName??""))}: ${o(Qt(s.value,c?.valueColumn,void 0,!1,e.locale))}`})].filter(Boolean).join("<br/>")},Xs=e=>t=>{let n=(Array.isArray(t)?t:[t]).filter(s=>!!s&&typeof s=="object"),a=s=>s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;"),i=String(n[0]?.axisValueLabel??n[0]?.name??""),o=n.flatMap(s=>{let c=e.series[Number(s.seriesIndex)]??e.series[0],u=c?.points?.[Number(s.dataIndex)],l=d=>Qt(d,c?.valueColumn,void 0,!1,e.locale);return[`${String(s.marker??"")}${a(String(s.seriesName??""))}: ${a(l(s.value))}`,...cs(e.comparison,u,l).map(d=>`<span style="opacity:.75">${a(d)}</span>`)]});return[i?`<strong>${a(i)}</strong>`:"",...o].filter(Boolean).join("<br/>")},Qs=(e,{expanded:t=!1,reducedMotion:n=!1,theme:a=Xt,zoomWindow:i=ln(e.categories.length)}={})=>{let o=e.series.length>1||e.type==="line"&&(e.inProgressIndex??0)>0,s=e.type==="stacked_bar",c=e.categories.length>2,u=An(i,e.categories.length);return{animation:!n,animationDuration:n?0:260,aria:{enabled:!0,decal:{show:!0},label:{description:`${e.title}. ${e.summary}`}},backgroundColor:"transparent",color:a.colors,textStyle:{color:a.text,fontFamily:"inherit"},grid:{top:o?t?48:42:14,right:12,bottom:t?18:10,left:10,containLabel:!0},legend:{show:o,type:"scroll",top:0,left:"center",itemWidth:12,itemHeight:8,textStyle:{color:a.muted,fontSize:t?11:10}},tooltip:{trigger:"axis",...e.type==="line"&&(e.inProgressIndex??0)>0?{formatter:Js(e)}:e.comparison?{formatter:Xs(e)}:{},triggerOn:"mousemove|click",confine:!0,backgroundColor:a.surface,borderColor:a.border,borderWidth:1,textStyle:{color:a.text,fontSize:12},axisPointer:{type:"line",lineStyle:{color:a.muted,opacity:.5}}},dataZoom:c?[{id:gi,type:"inside",xAxisIndex:0,startValue:u.startIndex,endValue:u.endIndex,minValueSpan:1,filterMode:"filter",disabled:!0}]:void 0,xAxis:{type:"category",data:e.categories,name:e.xAxisTitle,nameLocation:"middle",nameGap:t?38:32,nameTextStyle:{color:a.muted,fontSize:t?11:10},axisLine:{lineStyle:{color:a.border}},axisTick:{show:!1},axisLabel:{color:a.muted,fontSize:t?11:9,hideOverlap:!0,interval:"auto",rotate:!t&&e.categories.length>5?28:0,formatter:l=>l.length>(t?18:11)?`${l.slice(0,t?16:9)}…`:l}},yAxis:{type:"value",name:e.yAxisTitle,nameLocation:"middle",nameGap:t?52:44,nameTextStyle:{color:a.muted,fontSize:t?11:10},axisLabel:{color:a.muted,fontSize:t?11:9,formatter:l=>Qt(l,e.series[0]?.valueColumn,void 0,!0,e.locale)},axisLine:{show:!1},axisTick:{show:!1},splitNumber:4,splitLine:{lineStyle:{color:a.border,opacity:.75}}},series:e.series.flatMap((l,d)=>{let p=e.inProgressIndex??-1,g={type:e.type==="line"?"line":"bar",name:l.name,data:l.values,stack:s?"total":void 0,connectNulls:!1,showSymbol:e.type==="line"&&e.categories.length<=18,symbol:"circle",symbolSize:t?7:6,smooth:!1,maxBarWidth:t?38:28,lineStyle:e.type==="line"?{width:t?3:2.5}:void 0,itemStyle:e.type==="line"?{borderColor:a.background,borderWidth:2}:{borderRadius:s?0:[4,4,0,0]},emphasis:{focus:"series"},tooltip:{valueFormatter:y=>Qt(y,l.valueColumn,void 0,!1,e.locale)}};if(p<0)return[g];let f=a.colors[d%a.colors.length];return e.type==="line"?p===0?[g]:[{...g,lineStyle:{...g.lineStyle,color:f},itemStyle:{...g.itemStyle,color:f},data:l.values.map((y,h)=>h===p?null:y)},{...g,id:`in-progress:${d}`,name:e.labels.inProgressLegend||ps,showSymbol:!0,symbol:"emptyCircle",lineStyle:{width:t?3:2.5,type:"dashed",color:f,opacity:.6},itemStyle:{color:f,opacity:.6},data:l.values.map((y,h)=>h===p||h===p-1?y:null)}]:[{...g,data:l.values.map((y,h)=>h===p?{value:y,itemStyle:{opacity:.45,borderType:"dashed",borderWidth:1.5,borderColor:f}}:y)}]})}},ec=e=>{let t=getComputedStyle(e),n=(c,u)=>{for(let l of c){let d=t.getPropertyValue(l).trim();if(d)return d}return u},[a,i,o,s]=Xt.colors;return{background:n(["--rv-bg","--cf-bg"],Xt.background),border:n(["--rv-border","--cf-border"],Xt.border),muted:n(["--rv-muted","--cf-muted"],Xt.muted),surface:n(["--rv-surface","--cf-surface"],Xt.surface),text:n(["--rv-text","--cf-text"],Xt.text),colors:[n(["--rv-chart-1","--rv-accent","--cf-accent"],a),n(["--rv-chart-2"],i),n(["--rv-chart-3"],o),n(["--rv-chart-4"],s)]}},tc=["data-theme","data-color-scheme","class","style"],nc=(e,t)=>{let n=[];if(typeof matchMedia<"u"){let a=matchMedia("(prefers-color-scheme: dark)");a.addEventListener?.("change",t),n.push(()=>a.removeEventListener?.("change",t))}if(typeof MutationObserver<"u"){let a=new MutationObserver(t),i=e;for(;i;){i instanceof Element&&a.observe(i,{attributes:!0,attributeFilter:tc});let o=i.parentNode;i=o instanceof ShadowRoot?o.host:o}n.push(()=>a.disconnect())}return()=>n.forEach(a=>a())},ac=({model:e,expanded:t=!1,classPrefix:n="cf"})=>{let a=R(null),i=R(null),[o,s]=S(()=>({model:e,window:ln(e.categories.length)})),[c,u]=S(!1),l=o.model===e?An(o.window,e.categories.length):ln(e.categories.length),d=R(l);d.current=l;let p=X=>{let j=An(X,e.categories.length);d.current=j,s({model:e,window:j}),i.current?.dispatchAction({type:"dataZoom",dataZoomId:gi,startValue:j.startIndex,endValue:j.endIndex})},[g,f]=S(!1),[y,h]=S(0),[I,x]=S(0);J(()=>{let X=a.current;if(X)return nc(X,()=>x(j=>j+1))},[]),J(()=>{let X=a.current;if(!X)return;let j=!1,U=null;return Us().then(({init:D})=>{if(j||!X.isConnected||!mi&&typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes("jsdom"))return;let q=D(X,null,{renderer:"canvas",devicePixelRatio:Math.min(window.devicePixelRatio||1,2)});i.current=q;let C=()=>{q.resize(),h(Math.round(X.clientWidth/40))},Z=typeof ResizeObserver>"u"?null:new ResizeObserver(C);Z?.observe(X),Z||window.addEventListener("resize",C,{passive:!0}),U=()=>{Z?.disconnect(),Z||window.removeEventListener("resize",C),q.dispose(),i.current=null},f(!0)}).catch(()=>{j||u(!0)}),()=>{j=!0,U?.()}},[]),J(()=>{let X=a.current,j=i.current;if(!X||!j)return;let U=typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches;j.setOption(Ms(Qs(e,{expanded:t,reducedMotion:U,theme:ec(X),zoomWindow:d.current}),X.clientWidth),{lazyUpdate:!0,notMerge:!0}),j.resize()},[t,e,g,I,y]);let m=e.labels,T=!c&&e.categories.length>2,F=l.endIndex-l.startIndex+1,M=l.startIndex===0&&l.endIndex===e.categories.length-1,Q=T&&F>2,Y=T&&!M;return r(ce,{children:[r("div",{ref:a,class:`${n}-analytics-echart${t?" is-expanded":""}`,role:"img","aria-label":`${e.title}. ${e.summary}`,"data-chart-status":c?"fallback":"ready",children:c?r("span",{class:`${n}-analytics-echart__fallback`,children:e.summary}):null}),e.comparisonNote?r("p",{class:`${n}-analytics-comparison-note`,"data-comparison-note":!0,style:"margin:4px 2px 0;font-size:11px;color:var(--rv-muted,#5b7186)",children:e.comparisonNote}):null,T?r("div",{class:`${n}-analytics-zoom`,children:[r("span",{class:`${n}-analytics-zoom__range`,"aria-live":"polite","aria-atomic":"true",children:Bs(e.categories,l,m)}),r("div",{class:`${n}-analytics-zoom__controls`,role:"group","aria-label":m.zoomControls,children:[r("button",{type:"button","aria-label":m.zoomOut,title:m.zoomOut,disabled:!Y,onClick:()=>p(vi(d.current,"out",e.categories.length)),children:"−"}),r("button",{type:"button",class:`${n}-analytics-zoom__reset`,"aria-label":m.zoomReset,title:m.zoomReset,disabled:M,onClick:()=>p(ln(e.categories.length)),children:m.zoomResetShort}),r("button",{type:"button","aria-label":m.zoomIn,title:m.zoomIn,disabled:!Q,onClick:()=>p(vi(d.current,"in",e.categories.length)),children:"+"})]})]}):null]})},zn=e=>{let t=e.replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:"Value"},Ti=(e,t)=>(t?.length?t:Object.keys(e[0]??{})).map(n=>typeof n=="string"?{key:n,label:zn(n)}:{...n,label:n.label?.trim()||zn(n.key)}),rr=(e,t,n,a={})=>Ps(e,n,{...a,locale:t??a.locale}),Ci=e=>{let t=String(e??"");return/[",\r\n]/.test(t)?`"${t.replaceAll('"','""')}"`:t},rc=(e,t)=>{let n=Ti(e,t);return[n.map(a=>Ci(a.label)).join(","),...e.map(a=>n.map(i=>Ci(a[i.key])).join(","))].join(`\r
2
+ `)},Ai=({label:e,options:t,value:n,onChange:a,classPrefix:i})=>{let o=R(null),s=R(null),[c,u]=S(n),[l,d]=S(!1);J(()=>u(n),[n]);let p=f=>`${i}-${f}`,g=f=>{u(f),o.current&&(o.current.dataset.value=f,o.current.open=!1,o.current.querySelector("summary")?.focus()),a?.(f)};return r("details",{ref:o,"data-result-popover":!0,"data-result-select":!0,"data-value":c,class:p("sdk-select"),onToggle:f=>{let y=f.currentTarget.open;d(y);let h=s.current;if(h){if(h.setAttribute("popover","manual"),!y){typeof h.hidePopover=="function"&&h.matches(":popover-open")&&h.hidePopover();return}typeof h.showPopover=="function"&&!h.matches(":popover-open")&&h.showPopover(),requestAnimationFrame(()=>{if(!o.current?.open||!h.isConnected)return;let I=o.current.querySelector("summary").getBoundingClientRect(),x=Math.max(I.width,Math.min(220,innerWidth-24)),m=Math.min(h.scrollHeight,240);h.style.width=`${x}px`,h.style.left=`${Math.max(12,Math.min(I.left,innerWidth-x-12))}px`,h.style.top=`${I.bottom+m+6<=innerHeight-12?I.bottom+6:Math.max(12,I.top-m-6)}px`})}},children:[r("summary",{class:p("sdk-select-trigger"),role:"combobox","aria-label":e,"aria-haspopup":"listbox","aria-expanded":l,children:[r("span",{children:t.find(([f])=>f===c)?.[1]??c}),r("span",{"aria-hidden":"true",children:"⌄"})]}),r("div",{ref:s,class:p("sdk-select-list"),role:"listbox","aria-label":e,popover:"manual",children:t.map(([f,y])=>r("button",{type:"button",role:"option","aria-selected":f===c,onClick:()=>g(f),children:y},f))})]})},ic=(e,t,n)=>{let a=n.value.trim();if(!a)return!0;let i=String(e??""),o=typeof e=="number"?e:NaN,s=Number(a),c=!Number.isNaN(o)&&!Number.isNaN(s)?o-s:i.localeCompare(a,void 0,{numeric:!0,sensitivity:"base"});switch(n.operator){case"equals":return c===0;case"not_equals":return c!==0;case"gt":return c>0;case"gte":return c>=0;case"lt":return c<0;case"lte":return c<=0;default:return i.toLocaleLowerCase().includes(a.toLocaleLowerCase())||t.toLocaleLowerCase().includes(a.toLocaleLowerCase())}},oc=({rows:e,columns:t,maxRows:n=100,locale:a,format:i,expanded:o=!1,classPrefix:s="cr",pageSize:c=10})=>{let u=qe(()=>Ti(e,t),[t,e]),l=u.map(k=>k.key).join("\0"),[d,p]=S(()=>u.map(k=>k.key)),[g,f]=S(""),[y,h]=S(),[I,x]=S("asc"),[m,T]=S({}),[F,M]=S(),[Q,Y]=S([]),[X,j]=S({}),[U,D]=S(()=>u.map(k=>k.key)),[q,C]=S(!1),[Z,_]=S([]),[L,$]=S("table"),[P,fe]=S(1),[oe,Ue]=S(c),ke=R(null);J(()=>{let k=V=>{let H=V.composedPath();ke.current?.querySelectorAll("details[data-result-popover][open]").forEach(ae=>{H.includes(ae)||(ae.open=!1)})},K=V=>{let H=[...ke.current?.querySelectorAll("details[data-result-popover][open]")??[]].at(-1);V.key!=="Escape"||!H||(H.open=!1,H.querySelector("summary")?.focus(),V.preventDefault())};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",K),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",K)}},[]),J(()=>{p(u.map(k=>k.key)),h(void 0),T({}),M(void 0),Y([]),j({}),D(u.map(k=>k.key)),_([]),fe(1)},[l]);let Ce=U.map(k=>u.find(K=>K.key===k)).filter(k=>!!(k&&d.includes(k.key))),Le=qe(()=>{let k=g.toLocaleLowerCase(a),K=e.map((V,H)=>({row:V,index:H})).filter(({row:V})=>Ce.some(H=>rr(V[H.key],a,H,i).toLocaleLowerCase(a).includes(k))&&Object.entries(m).every(([H,ae])=>{let ye=u.find(Se=>Se.key===H);return ic(V[H],rr(V[H],a,ye,i),ae)}));return y?K.sort((V,H)=>{let ae=V.row[y],ye=H.row[y],Se=typeof ae=="number"?ae:NaN,Qe=typeof ye=="number"?ye:NaN,Ge=!Number.isNaN(Se)&&!Number.isNaN(Qe)?Se-Qe:String(ae??"").localeCompare(String(ye??""),a,{numeric:!0,sensitivity:"base"});return I==="asc"?Ge:-Ge}):K},[Ce,m,i,a,g,u,e,I,y]),Ie=Le.slice(0,Math.max(1,n)),Ae=Math.max(1,Math.ceil(Ie.length/oe)),ge=Math.min(P,Ae),Ze=o?Ie:Ie.slice((ge-1)*oe,ge*oe),be=Ze.length>0&&Ze.every(({index:k})=>Z.includes(k)),ie=k=>`${s}-${k}`,Je=()=>{p(u.map(k=>k.key)),D(u.map(k=>k.key)),j({}),h(void 0),x("asc"),T({}),M(void 0),Y([]),C(!1),f(""),_([]),$("table"),fe(1)};if(e.length===0||u.length===0)return r("div",{class:ie("table-note"),children:"No rows returned."});let He=k=>{let K=new Set(Ze.map(({index:V})=>V));_(V=>k?[...new Set([...V,...K])]:V.filter(H=>!K.has(H)))};return r("section",{ref:ke,class:ie("data-table"),children:[r("div",{class:ie("table-fields"),children:[r("strong",{children:"Fields"}),r("div",{class:ie("field-list"),children:u.map(k=>r("span",{class:ie("field-chip"),children:k.label},k.key))}),r("span",{class:ie("table-field-count"),children:[e.length.toLocaleString(a)," rows"]})]}),r("div",{class:ie("table-controls"),children:[r("label",{class:ie("table-search"),children:[r("span",{"aria-hidden":"true",children:"⌕"}),r("input",{type:"search",value:g,placeholder:"Search this result...","aria-label":"Search this result",onInput:k=>{f(k.currentTarget.value.trim()),fe(1)}})]}),r("div",{class:ie("table-modes"),role:"group","aria-label":"Table display mode",children:["table","matrix"].map(k=>r("button",{type:"button",class:`${ie("segment")}${L===k?" is-active":""}`,"aria-pressed":L===k,onClick:()=>$(k),children:k==="table"?"Table":"Matrix"},k))})]}),r("div",{class:ie("table-column-bar"),children:[r("details",{"data-result-popover":!0,class:ie("column-picker"),children:[r("summary",{children:"Columns"}),r("div",{class:ie("column-menu"),children:U.map((k,K)=>{let V=u.find(H=>H.key===k);return V?r("div",{class:ie("column-picker-row"),children:[r("label",{children:[r("input",{type:"checkbox",checked:d.includes(V.key),onChange:H=>{let ae=H.currentTarget.checked;p(ye=>ae?[...new Set([...ye,V.key])]:ye.length>1?ye.filter(Se=>Se!==V.key):ye)}}),r("span",{children:X[V.key]||V.label})]}),r("button",{type:"button","aria-label":`Move ${V.label} left`,disabled:K===0,onClick:()=>D(H=>{let ae=[...H];return[ae[K-1],ae[K]]=[ae[K],ae[K-1]],ae}),children:"↑"}),r("button",{type:"button","aria-label":`Move ${V.label} right`,disabled:K===U.length-1,onClick:()=>D(H=>{let ae=[...H];return[ae[K+1],ae[K]]=[ae[K],ae[K+1]],ae}),children:"↓"})]},V.key):null})})]}),r("button",{type:"button",class:ie("table-view-button"),"aria-pressed":q,onClick:()=>C(k=>!k),children:q?"Comfortable rows":"Compact rows"}),r("button",{type:"button",class:ie("table-view-button"),onClick:Je,children:"Reset view"})]}),Object.keys(m).length?r("div",{class:ie("table-filter-bar"),children:Object.entries(m).map(([k,K])=>{let V=u.find(H=>H.key===k);return r("button",{type:"button",class:ie("table-filter-chip"),"aria-label":`Clear ${V?.label??k} filter`,onClick:()=>T(H=>{let ae={...H};return delete ae[k],ae}),children:[X[k]||V?.label||k," ",K.operator.replaceAll("_"," ")," ",K.value," ×"]},k)})}):null,r("div",{class:ie("table-wrap"),role:"region","aria-label":"Scrollable result table",tabIndex:0,children:r("table",{class:`${ie("table")}${L==="matrix"?" is-matrix":""}${q?" is-compact":""}`,children:[r("caption",{class:ie("visually-hidden"),children:["Result table with ",Le.length," ",Le.length===1?"row":"rows"]}),r("thead",{children:r("tr",{children:[r("th",{class:ie("select-cell"),children:r("input",{type:"checkbox","aria-label":"Select all visible rows",checked:be,onChange:k=>He(k.currentTarget.checked)})}),Ce.map(k=>r("th",{scope:"col",class:F===k.key?"is-pinned":void 0,style:F===k.key?{left:"34px"}:void 0,"aria-sort":y===k.key?I==="asc"?"ascending":"descending":"none",children:[r("button",{type:"button",class:ie("table-sort"),"aria-label":`Sort by ${k.label}`,onClick:()=>{y===k.key?x(K=>K==="asc"?"desc":"asc"):(h(k.key),x("asc")),fe(1)},children:[r("span",{children:X[k.key]||k.label}),r("span",{class:ie("sort-direction"),"aria-hidden":"true",children:y===k.key?I==="asc"?"↑":"↓":"↕"})]}),r("details",{"data-result-popover":!0,class:ie("table-column-menu"),onToggle:K=>{let V=K.currentTarget,H=V.querySelector(`.${ie("table-column-panel")}`);if(H?.setAttribute("popover","manual"),!V.open){H&&typeof H.hidePopover=="function"&&H.matches(":popover-open")&&H.hidePopover(),V.querySelectorAll("details[data-result-select][open]").forEach(ae=>{ae.open=!1});return}ke.current?.querySelectorAll("details[data-result-popover][open]").forEach(ae=>{ae!==V&&!V.contains(ae)&&(ae.open=!1)}),H&&typeof H.showPopover=="function"&&!H.matches(":popover-open")&&H.showPopover(),requestAnimationFrame(()=>{if(!V.open||!V.isConnected)return;let ae=V.querySelector("summary")?.getBoundingClientRect();if(!ae||!H)return;let{width:ye,height:Se}=H.getBoundingClientRect(),Qe=ae.bottom+Se+5<=innerHeight-12?ae.bottom+5:ae.top-Se-5;H.style.left=`${Math.max(12,Math.min(ae.right-ye,innerWidth-ye-12))}px`,H.style.top=`${Math.max(12,Math.min(Qe,innerHeight-Se-12))}px`})},children:[r("summary",{"aria-label":`Actions for ${k.label}`,children:"⋯"}),r("div",{class:ie("table-column-panel"),popover:"manual",children:[r("strong",{children:X[k.key]||k.label}),r("button",{type:"button",onClick:()=>{h(k.key),x("asc"),fe(1)},children:"Sort ascending"}),r("button",{type:"button",onClick:()=>{h(k.key),x("desc"),fe(1)},children:"Sort descending"}),r("span",{children:"Filter values"}),r(Ai,{classPrefix:s,label:`Filter operator for ${k.label}`,value:m[k.key]?.operator??"contains",options:[["contains","Contains"],["equals","Equals"],["not_equals","Does not equal"],["gt","Greater than"],["gte","At least"],["lt","Less than"],["lte","At most"]]}),r("input",{type:"text","aria-label":`Filter value for ${k.label}`,defaultValue:m[k.key]?.value??"",placeholder:"Enter a value"}),r("button",{type:"button",onClick:K=>{let V=K.currentTarget.parentElement,H=V.querySelector('input[aria-label^="Filter value"]').value.trim(),ae=V.querySelector("[data-result-select]").dataset.value;T(ye=>{let Se={...ye};return H?Se[k.key]={operator:ae,value:H}:delete Se[k.key],Se}),fe(1),K.currentTarget.closest("details").open=!1},children:"Apply filter"}),r("button",{type:"button",onClick:K=>{M(V=>V===k.key?void 0:k.key),D(V=>[k.key,...V.filter(H=>H!==k.key)]),K.currentTarget.closest("details").open=!1},children:F===k.key?"Unpin column":"Pin column"}),r("button",{type:"button",onClick:K=>{Y(V=>V.includes(k.key)?V.filter(H=>H!==k.key):[...V,k.key]),K.currentTarget.closest("details").open=!1},children:Q.includes(k.key)?"Do not wrap text":"Wrap text"}),r("input",{type:"text","aria-label":`Display name for ${k.label}`,defaultValue:X[k.key]||k.label,maxLength:80}),r("button",{type:"button",onClick:K=>{let V=K.currentTarget.parentElement.querySelector('input[aria-label^="Display name"]').value.trim();j(H=>({...H,[k.key]:V||k.label||k.key})),K.currentTarget.closest("details").open=!1},children:"Apply display name"})]})]})]},k.key))]})}),r("tbody",{children:Ze.map(({row:k,index:K})=>r("tr",{class:Z.includes(K)?"is-selected":void 0,children:[r("td",{class:ie("select-cell"),children:r("input",{type:"checkbox","aria-label":`Select row ${K+1}`,checked:Z.includes(K),onChange:V=>_(H=>V.currentTarget.checked?[...new Set([...H,K])]:H.filter(ae=>ae!==K))})}),Ce.map(V=>r("td",{class:`${Q.includes(V.key)?"is-wrapped":""} ${F===V.key?"is-pinned":""}`.trim(),style:F===V.key?{left:"34px"}:void 0,children:rr(k[V.key],a,V,i)},V.key))]},K))})]})}),r("div",{class:ie("table-summary"),children:[r("span",{children:Ie.length?`${((ge-1)*oe+1).toLocaleString(a)}-${Math.min(ge*oe,Ie.length).toLocaleString(a)} of ${Le.length.toLocaleString(a)}`:`0 of ${Le.length.toLocaleString(a)}`}),o?r("span",{children:e.length>n?`First ${n.toLocaleString(a)} rows available`:"All returned rows loaded"}):r("div",{class:ie("table-pagination"),"aria-label":"Table pagination",children:[r("label",{children:[r("span",{children:"Rows"}),r(Ai,{classPrefix:s,label:"Rows per page",value:String(oe),options:[["10","10"],["25","25"],["50","50"]],onChange:k=>{Ue(Number(k)),fe(1)}})]}),r("button",{type:"button","aria-label":"Previous page",disabled:ge<=1,onClick:()=>fe(k=>Math.max(1,k-1)),children:"‹"}),r("span",{children:[ge," / ",Ae]}),r("button",{type:"button","aria-label":"Next page",disabled:ge>=Ae,onClick:()=>fe(k=>Math.min(Ae,k+1)),children:"›"})]})]})]})},sc=(e,t,n)=>{let a=Qa(t),i=[],o=e.reportingPeriod?.label?.trim();o&&i.push({label:a.aboutPeriod,value:o});let s=e.rowCount??e.rows?.length;typeof s=="number"&&i.push({label:a.aboutResults,value:bt(s===1?a.rowOne:a.rowMany,{count:s})});let c=e.explanation?.checkedAt??e.freshness?.answeredAt,u=e.explanation?.timezone??e.timezone??e.reportingPeriod?.timezone;if(c){let d=new Date(c),p=c;if(!Number.isNaN(d.getTime()))try{p=new Intl.DateTimeFormat(n,{dateStyle:"medium",timeStyle:"short",...u?{timeZone:u}:{}}).format(d)}catch{p=d.toLocaleString(n)}i.push({label:a.aboutChecked,value:p})}u&&i.push({label:a.aboutTimezone,value:u});let l=e.explanation?.dataFreshness?.status??e.freshness?.status;return l&&l!=="unknown"&&i.push({label:a.aboutSourceData,value:l.replaceAll("_"," ")}),e.appliedFilters?.length&&i.push({label:a.aboutFilters,value:bt(a.filtersApplied,{count:e.appliedFilters.length})}),i},Mi=e=>e.columns?.length?e.columns:Object.keys(e.rows?.[0]??{}),cc=e=>{let t=e.rows??[],n=e.currency?.code&&!e.currency.isMixed?e.currency.code:void 0;return Mi(e).map(a=>{let i=e.columnMetadata?.find(s=>s.key===a);if(!i)return{key:a,label:zn(a)};let o=i.dataType==="date"||i.dataType==="datetime"||i.semanticRole==="date";return{key:a,label:i.label,dataType:i.dataType,currencyCode:i.currencyCode||(i.dataType==="currency"?n:void 0),formatPattern:i.formatPattern,grain:o?i.grain??e.periodComparison?.grain??li(t.map(s=>s[a])):void 0}})},lc=(e,t)=>{let n=e.rows?.[0]??{};return e.chartRecommendation?.valueFields?.[0]??e.valueFields?.[0]??e.value??e.columnMetadata?.find(a=>a.semanticRole==="measure"&&a.key in n)?.key??t.find(a=>Tn(n[a])!==null)??t[1]??t[0]},dc=(e,t,n="analytics-result.csv")=>{if(typeof document>"u"||e.length===0)return;let a=rc(t,e),i=URL.createObjectURL(new Blob([a],{type:"text/csv;charset=utf-8"})),o=document.createElement("a");o.href=i,o.download=n,o.click(),URL.revokeObjectURL(i)},dn=new Set,Ii=e=>{let t=e.composedPath();dn.forEach(n=>{n.isOpen()&&!n.contains(t)&&n.close(!1)})},Ei=e=>{if(e.key==="Escape"){for(let t of dn)if(t.isOpen()){t.close(!0),e.preventDefault();return}}},uc=e=>(dn.size===0&&typeof document<"u"&&(document.addEventListener("pointerdown",Ii),document.addEventListener("keydown",Ei)),dn.add(e),()=>{dn.delete(e),dn.size===0&&typeof document<"u"&&(document.removeEventListener("pointerdown",Ii),document.removeEventListener("keydown",Ei))}),ha=({children:e,size:t=15})=>r("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",children:e}),pc=()=>r(ha,{children:r("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})}),fc=()=>r(ha,{children:r("path",{d:"M18 6 6 18M6 6l12 12"})}),zi=()=>r(ha,{size:13,children:r("path",{d:"m6 9 6 6 6-6"})}),hc=()=>r(ha,{size:13,children:r("path",{d:"m5 12 5 5L20 7"})}),Ni=({type:e,className:t})=>r("svg",{viewBox:"0 0 32 32","aria-hidden":"true",class:t,fill:"none",children:[r("path",{d:"M6 26h21M6 7v19",stroke:"var(--rv-muted)","stroke-width":"1.4","stroke-linecap":"round"}),e==="line"?r("path",{d:"M8 21c4-7 7 2 11-6 2.5-5 4.5-2 7-7",stroke:"var(--rv-chart-2)","stroke-width":"2.1","stroke-linecap":"round","stroke-linejoin":"round"}):e==="stacked_bar"?r(ce,{children:[9,15,21].map((n,a)=>r("g",{children:[r("rect",{x:n,y:18-a*2,width:"4",height:8+a*2,fill:"var(--rv-chart-2)",rx:"0.6"}),r("rect",{x:n,y:13-a,width:"4",height:"5",fill:"var(--rv-chart-3)",rx:"0.6"}),r("rect",{x:n,y:9-a,width:"4",height:"4",fill:"var(--rv-chart-1)",rx:"0.6"})]},n))}):r(ce,{children:[r("rect",{x:"9",y:"18",width:"4",height:"8",fill:"var(--rv-chart-2)",rx:"0.7"}),r("rect",{x:"15",y:"13",width:"4",height:"13",fill:"var(--rv-chart-2)",rx:"0.7"}),r("rect",{x:"21",y:"8",width:"4",height:"18",fill:"var(--rv-chart-2)",rx:"0.7"})]})]}),Ri=e=>{let[t,n]=S(!1),a=R(null),i=R(null),o=R(t);return o.current=t,J(()=>uc({isOpen:()=>o.current,contains:s=>!!(a.current&&s.includes(a.current)||i.current&&s.includes(i.current)),close:s=>{n(!1),s&&a.current?.focus()}}),[]),$n(()=>{if(!t)return;let s=()=>{let c=a.current,u=i.current;if(!c||!u)return;u.style.left="0px",u.style.top="0px";let l=u.getBoundingClientRect(),d=c.getBoundingClientRect(),p=document.documentElement.clientWidth||window.innerWidth,g=document.documentElement.clientHeight||window.innerHeight,f=getComputedStyle(c).direction==="rtl",y=e==="end"===f?d.left:d.right-l.width;y=Math.max(8,Math.min(y,p-l.width-8));let h=d.bottom+7;h+l.height>g-8&&d.top-7-l.height>8&&(h=d.top-7-l.height),u.style.left=`${y-l.left}px`,u.style.top=`${h-l.top}px`};return s(),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),i.current?.querySelector('[aria-selected="true"], button')?.focus({preventScroll:!0}),()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[t,e]),{open:t,setOpen:n,triggerRef:a,layerRef:i}},mc=({visualization:e,field:t,prefix:n,labels:a,locale:i,headerTitle:o})=>{let s=e.rows??[],c=e.columnMetadata?.find(x=>x.key===t),u=t?s[0]?.[t]:void 0,l=Tn(u),d=x=>Qt(x,c,e,!1,i),p=l===null?String(u??a.noValue):d(l),g=e.periodComparison,f=!g?.measureField||g.measureField===t,y=t?Tn(s[1]?.[t]):null,h=l!==null&&g&&f?zr(g,{value:l,status:"observed",label:g.currentPeriod?.label},{value:y??g.previousFullValue??g.previousToDateValue,status:"observed",label:g.previousPeriod?.label},{format:d,locale:i}):void 0,I=c?.label??(t?zn(t):a.currentValue);return r("section",{class:`${n}-analytics-kpi`,"aria-label":o??I,"data-testid":"analytics-kpi",children:[r("div",{class:`${n}-analytics-kpi__label`,children:I}),r("div",{class:`${n}-analytics-kpi__value`,children:p}),h?r(ce,{children:[r("div",{class:`${n}-analytics-kpi__change is-${h.tone}`,"data-comparison-basis":h.basis,title:h.title,children:[r("span",{children:h.label}),h.copy?r("span",{class:`${n}-analytics-kpi__copy`,children:h.copy}):null]}),h.secondary?r("div",{class:`${n}-analytics-kpi__secondary`,children:h.secondary}):null]}):null]})},gc=({visualization:e,classPrefix:t,labels:n,locale:a,expanded:i=!1,onExpand:o,onClose:s,expandControlId:c,onFollowUp:u,onDownload:l,headerActions:d,children:p,dataToggle:g,cardRef:f,maxTableRows:y=100})=>{let h=qe(()=>Qa(n),[n]),I=qe(()=>nr(e,void 0,{labels:h,locale:a}),[e,h,a]),[x,m]=S(I?.type);J(()=>m(I?.type),[I]);let[T,F]=S(!1),M=qe(()=>Zs(e,h),[e,h]),Q=qe(()=>nr(e,x,{labels:h,locale:a}),[e,x,h,a]),Y=x??Q?.type??I?.type,X=M.find(be=>be.type===Y),j=[...new Set(Q?.series.map(be=>be.field)??[])],U=Ri("end"),D=Ri("start"),q=e.rows??[],C=Mi(e),Z=qe(()=>ds(e),[e]),_=qe(()=>cc(Z),[Z]),L=qe(()=>({locale:a,timezone:e.timezone||e.periodComparison?.timezone,yes:h.yes,no:h.no}),[a,e.timezone,e.periodComparison?.timezone,h]),$=sc(e,h,a),P=l===!1||!e.downloadAvailable?null:()=>(l??dc)(C,q),fe=$.length?r("details",{class:`${t}-analytics-inspect`,children:[r("summary",{children:h.aboutResult}),r("dl",{children:$.map(be=>r("div",{children:[r("dt",{children:be.label}),r("dd",{children:be.value})]},be.label))})]}):null,oe=(()=>{let be=e.freshness?.answeredAt,ie=be?new Date(be):null;return!ie||Number.isNaN(ie.getTime())?h.liveData:bt(h.updatedAt,{time:new Intl.DateTimeFormat(a,{hour:"numeric",minute:"2-digit"}).format(ie)})})(),Ue=e.rowCount??q.length,ke=e.appliedFilters?.length??0,Ce=r("div",{class:`${t}-analytics-meta`,"data-testid":"analytics-result-meta",role:"group","aria-label":h.resultDetails,children:[r("span",{children:[r("span",{"aria-hidden":"true",class:`${t}-analytics-meta__dot`}),oe]}),e.reportingPeriod?.label?r("span",{children:e.reportingPeriod.label}):null,r("span",{children:bt(Ue===1?h.rowOne:h.rowMany,{count:Ue})}),ke>0?r("span",{children:bt(ke===1?h.filtersOne:h.filtersMany,{count:ke})}):null]}),Le=(be,ie,Je,He=h.expandChart)=>r("div",{class:`${t}-analytics-result`,children:[r("section",{ref:f,class:`${t}-analytics-visualization${i?" is-expanded":""}`,"aria-label":be,children:[r("div",{class:`${t}-analytics-visualization__header`,children:[r("div",{children:[r("div",{class:`${t}-analytics-visualization__title`,children:be}),Ce]}),r("div",{class:`${t}-analytics-visualization__actions`,children:[Je,d,i&&s?r("button",{type:"button",class:`${t}-analytics-visualization__close`,"aria-label":h.restoreView,title:h.restoreView,onClick:s,children:r(fc,{})}):o&&e.expandable!==!1?r("button",{type:"button",class:`${t}-analytics-visualization__expand`,"aria-label":He,title:He,"data-visualization-message":c,onClick:o,children:r(pc,{})}):null]})]}),ie,fe,p]}),r("div",{class:`${t}-analytics-layer`,children:[u?r("div",{ref:D.layerRef,class:`${t}-analytics-chart-picker__menu`,style:{position:"fixed"},role:"menu","aria-label":h.aggregate,hidden:!D.open,children:j.flatMap(k=>$i(e,k).map(K=>{let V=e.columnMetadata?.find(H=>H.key===k)?.label??zn(k);return r("button",{type:"button",role:"menuitem",onClick:()=>{let H=Ys(e,k,K.value);H&&u(H),D.setOpen(!1)},children:r("span",{class:`${t}-analytics-chart-picker__copy`,children:[r("strong",{children:[Ks(K.value,h)," · ",V]}),r("small",{children:h.aggregateCharge})]})},`${k}:${K.value}`)}))}):null,r("div",{ref:U.layerRef,class:`${t}-analytics-chart-picker__menu`,style:{position:"fixed"},role:"listbox","aria-label":h.chartType,hidden:!U.open,children:M.map(k=>{let K=k.type===Y;return r("button",{type:"button",role:"option","aria-selected":K,class:K?"is-selected":"",onClick:()=>{m(k.type),U.setOpen(!1),U.triggerRef.current?.focus()},children:[r("span",{class:`${t}-analytics-chart-picker__icon`,children:r(Ni,{type:k.type,className:`${t}-chart-type-icon`})}),r("span",{class:`${t}-analytics-chart-picker__copy`,children:[r("strong",{children:k.label}),r("small",{children:k.hint})]}),K?r(hc,{}):null]},k.type)})})]})]}),Ie=r(oc,{rows:Z.rows??q,columns:_,maxRows:y,expanded:i,classPrefix:t,locale:a,format:L}),Ae=()=>e.tableAvailable===!1||C.length===0?null:Le(e.title?.trim()||h.resultDetails,r(ce,{children:Ie}),P?r("button",{type:"button",class:`${t}-analytics-visualization__download`,onClick:P,children:h.download}):null,h.expandTable);if(q.length===0)return r(ce,{children:[r("section",{class:`${t}-analytics-empty`,role:"status","data-testid":"analytics-empty-state",children:[r("p",{children:h.noMatchTitle}),r("p",{children:h.noMatchBody})]}),fe,p]});if(e.presentation==="table"||!e.presentation&&e.type==="table")return Ae()??r(ce,{children:p});let ge=g&&e.tableAvailable!==!1?r("button",{type:"button",class:`${t}-analytics-visualization__download`,"aria-expanded":T,onClick:()=>F(be=>{let ie=!be;return g.onToggle?.(ie),ie}),children:T?h.hideData:h.viewData}):null,Ze=T?r("div",{class:`${t}-analytics-data`,children:Ie}):null;return e.presentation==="kpi"||!e.presentation&&e.type==="kpi"?Le(h.liveMetric,r(ce,{children:[r(mc,{visualization:e,field:lc(e,C),prefix:t,labels:h,locale:a}),ge,Ze]})):Q?Le(Q.title,r(ce,{children:[r(ac,{model:Q,expanded:i,classPrefix:t}),P?r("button",{type:"button",class:`${t}-analytics-visualization__download`,onClick:P,children:h.downloadData}):null,ge,Ze]}),r(ce,{children:[u?r("div",{class:`${t}-analytics-chart-picker ${t}-analytics-chart-picker--aggregation`,children:r("button",{type:"button",ref:D.triggerRef,"aria-haspopup":"menu","aria-expanded":D.open,"aria-label":h.aggregate,title:h.aggregateTitle,onClick:()=>{U.setOpen(!1),D.setOpen(!D.open)},children:[r("span",{class:`${t}-analytics-chart-picker__current`,children:r("span",{children:h.aggregate})}),r(zi,{})]})}):null,M.length>1?r("div",{class:`${t}-analytics-chart-picker`,children:r("button",{type:"button",ref:U.triggerRef,"aria-haspopup":"listbox","aria-expanded":U.open,"aria-label":h.chooseChartType,title:h.chooseChartType,onClick:()=>{D.setOpen(!1),U.setOpen(!U.open)},children:[r("span",{class:`${t}-analytics-chart-picker__current`,children:[r(Ni,{type:Y??Q.type,className:`${t}-chart-type-icon`}),r("span",{children:X?.label??h.chartFallback})]}),r(zi,{})]})}):null]})):Ae()??r(ce,{children:p})},bc=["#2563eb","#b45309","#7c3aed"],vc=["#60a5fa","#fbbf24","#a78bfa"],xc=(e,t)=>{let n=`.${e}-analytics-visualization`,a=`.${e}-analytics-result`,i=`.${e}-analytics-chart-picker`,o=`.${e}-analytics-kpi`;return`
3
+ ${a}{
4
+ display:contents;
5
+ --rv-bg:${t.bg};--rv-surface:${t.surface};--rv-surface-2:${t.surface2};--rv-text:${t.text};
6
+ --rv-muted:${t.muted};--rv-border:${t.border};--rv-accent:${t.accent};--rv-on-accent:${t.onAccent};
7
+ --rv-chart-1:${t.accent};--rv-chart-2:${t.chart[0]};--rv-chart-3:${t.chart[1]};--rv-chart-4:${t.chart[2]};
8
+ }
9
+ ${t.darkSelector} ${a}{--rv-chart-2:${t.chartDark[0]};--rv-chart-3:${t.chartDark[1]};--rv-chart-4:${t.chartDark[2]}}
10
+ ${n}{box-sizing:border-box;width:100%;max-width:100%;margin-block-start:8px;min-width:0;overflow:hidden;border:1px solid var(--rv-border);border-radius:13px;background:var(--rv-surface);padding:12px;color:var(--rv-muted);font-size:11px}
11
+ ${n}.is-expanded{display:flex;min-height:100%;flex-direction:column;margin:0;border:0;border-radius:0;background:transparent;padding:0}
12
+ ${n}__header{display:flex;width:100%;min-width:0;min-height:32px;align-items:center;justify-content:space-between;gap:10px}
13
+ ${n}__header>div:first-child{min-width:0}
14
+ ${n}__actions{display:flex;flex:0 0 auto;align-items:center;gap:6px}
15
+ ${n}__title{overflow:hidden;color:var(--rv-muted);font-size:10px;font-weight:750;letter-spacing:.08em;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap}
16
+ .${e}-analytics-meta{display:flex;flex-wrap:wrap;align-items:center;gap:3px 7px;margin-block-start:4px;color:var(--rv-muted);font-size:9px;line-height:1.35}
17
+ .${e}-analytics-meta__dot{display:inline-block;width:5px;height:5px;margin-inline-end:4px;border-radius:999px;background:var(--rv-accent)}
18
+ ${n}__download{width:fit-content;min-height:32px;margin-block-start:6px;border:1px solid var(--rv-border);border-radius:8px;background:var(--rv-surface);padding:6px 9px;color:var(--rv-text);font:inherit;font-size:10px;font-weight:700;cursor:pointer}
19
+ ${n}__header ${n}__download{margin:0}
20
+ ${n}__download:hover{border-color:var(--rv-accent);color:var(--rv-accent)}
21
+ ${n}__expand,${n}__close{display:grid;width:30px;height:30px;flex:0 0 auto;place-items:center;border:1px solid var(--rv-border);border-radius:9px;background:var(--rv-bg);color:var(--rv-text);cursor:pointer}
22
+ ${n}__expand:hover,${n}__close:hover{background:var(--rv-surface-2)}
23
+ ${n} button:focus-visible,${n} summary:focus-visible,${a} ${i}__menu button:focus-visible{outline:2px solid var(--rv-accent);outline-offset:2px}
24
+ .${e}-analytics-inspect{margin-block-start:10px;padding-block-start:9px;border-block-start:1px solid var(--rv-border);color:var(--rv-muted);font-size:11px}
25
+ .${e}-analytics-inspect summary{width:max-content;max-width:100%;cursor:pointer;color:var(--rv-text);font-weight:650}
26
+ .${e}-analytics-inspect dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;margin:10px 0 0}
27
+ .${e}-analytics-inspect dt{margin:0;color:var(--rv-muted)}
28
+ .${e}-analytics-inspect dd{margin:2px 0 0;color:var(--rv-text);overflow-wrap:anywhere}
29
+ .${e}-analytics-data{margin-block-start:8px}
30
+ ${i}{position:relative;display:inline-flex;min-width:0;color:var(--rv-muted);font-size:9px;font-weight:700}
31
+ ${i}>button{display:inline-flex;min-width:92px;max-width:138px;height:30px;align-items:center;gap:6px;border:1px solid var(--rv-border);border-radius:8px;background:var(--rv-bg);padding:0 8px;color:var(--rv-text);font:inherit;cursor:pointer;transition:border-color .16s ease,background .16s ease}
32
+ ${i}>button:hover,${i}>button[aria-expanded="true"]{border-color:var(--rv-accent);background:color-mix(in oklab,var(--rv-accent) 9%,var(--rv-bg))}
33
+ ${i}>button>svg:last-child{flex:0 0 13px;margin-inline-start:auto;color:var(--rv-muted);transition:transform .16s ease}
34
+ ${i}>button[aria-expanded="true"]>svg:last-child{transform:rotate(180deg)}
35
+ ${i}__current{display:inline-flex;min-width:0;align-items:center;gap:6px}
36
+ ${i}__current>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
37
+ .${e}-chart-type-icon{width:17px;height:17px;flex:0 0 17px}
38
+ ${i}__menu{z-index:2147483000;display:grid;min-width:196px;max-width:calc(100vw - 16px);max-height:min(400px,calc(100dvh - 32px));overflow-y:auto;overscroll-behavior:contain;padding:6px;border:1px solid var(--rv-border);border-radius:12px;background:var(--rv-bg);color:var(--rv-text);font-size:9px;box-shadow:0 18px 45px rgb(0 0 0/.22)}
39
+ ${i}__menu[hidden]{display:none}
40
+ ${i}__menu button{display:flex;width:100%;min-height:46px;align-items:flex-start;gap:8px;border:0;border-radius:9px;background:transparent;padding:7px;color:var(--rv-text);font:inherit;text-align:start;cursor:pointer}
41
+ ${i}__menu button:hover,${i}__menu button.is-selected{background:color-mix(in oklab,var(--rv-accent) 10%,var(--rv-bg))}
42
+ ${i}__menu button>svg:last-child{flex:0 0 13px;margin-block-start:4px}
43
+ ${i}__icon{display:inline-flex;width:30px;height:30px;flex:0 0 30px;align-items:center;justify-content:center;border-radius:9px;background:var(--rv-surface-2);box-shadow:inset 0 0 0 1px var(--rv-border)}
44
+ ${i}__icon .${e}-chart-type-icon{width:25px;height:25px;flex-basis:25px}
45
+ ${i}__copy{display:grid;min-width:0;flex:1;gap:2px}
46
+ ${i}__copy strong{font-size:10px;line-height:1.25}
47
+ ${i}__copy small{color:var(--rv-muted);font-size:9px;font-weight:560;line-height:1.3}
48
+ ${o}{padding:9px 0 5px}
49
+ ${o}__label{color:var(--rv-muted);font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}
50
+ ${o}__value{margin-block-start:5px;color:var(--rv-text);font-size:30px;font-weight:750;letter-spacing:-.035em;line-height:1}
51
+ ${o}__change{display:inline-flex;flex-wrap:wrap;gap:2px 6px;margin-block-start:8px;font-size:11px;font-weight:700;color:var(--rv-muted)}
52
+ ${o}__change.is-positive{color:var(--rv-success,#15803d)}
53
+ ${o}__change.is-negative{color:var(--rv-danger,#b42318)}
54
+ ${o}__copy{font-weight:560;color:var(--rv-muted)}
55
+ ${o}__secondary{margin-block-start:3px;color:var(--rv-muted);font-size:10px}
56
+ .${e}-analytics-empty{margin-block-start:8px;border:1px dashed var(--rv-border);border-radius:11px;padding:18px 14px;color:var(--rv-text);text-align:center}
57
+ .${e}-analytics-empty p{margin:0}
58
+ .${e}-analytics-empty p+p{margin-block-start:4px;color:var(--rv-muted);font-size:10px}
59
+ .${e}-analytics-echart{position:relative;width:100%;height:196px;min-width:0}
60
+ ${n}.is-expanded .${e}-analytics-echart{height:auto;min-height:310px;flex:1}
61
+ .${e}-analytics-echart canvas:focus-visible{outline:2px solid var(--rv-accent);outline-offset:-2px}
62
+ .${e}-analytics-echart__fallback{display:grid;height:100%;place-items:center;border:1px dashed var(--rv-border);border-radius:9px;padding:16px;color:var(--rv-muted);text-align:center;line-height:1.5}
63
+ .${e}-analytics-zoom{display:flex;min-width:0;align-items:center;justify-content:space-between;gap:8px;margin-block-start:4px;border-block-start:1px solid var(--rv-border);padding-block-start:8px}
64
+ .${e}-analytics-zoom__range{min-width:0;overflow:hidden;color:var(--rv-muted);font-size:10px;font-weight:650;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}
65
+ .${e}-analytics-zoom__controls{display:inline-flex;flex:0 0 auto;align-items:center;overflow:hidden;border:1px solid var(--rv-border);border-radius:9px;background:var(--rv-bg)}
66
+ .${e}-analytics-zoom__controls button{display:grid;min-width:40px;height:40px;place-items:center;border:0;border-radius:0;background:transparent;color:var(--rv-text);font:inherit;font-size:16px;font-weight:700;line-height:1;cursor:pointer}
67
+ .${e}-analytics-zoom__controls button+button{border-inline-start:1px solid var(--rv-border)}
68
+ .${e}-analytics-zoom__controls button:hover:not(:disabled){background:var(--rv-surface-2)}
69
+ .${e}-analytics-zoom__controls button:focus-visible{position:relative;z-index:1;outline:2px solid var(--rv-accent);outline-offset:-2px}
70
+ .${e}-analytics-zoom__controls button:disabled{cursor:not-allowed;opacity:.38}
71
+ .${e}-analytics-zoom__controls .${e}-analytics-zoom__reset{min-width:56px;padding:0 10px;font-size:10px;font-weight:700}
72
+ `},yc=(e,t)=>{if(typeof MutationObserver>"u")return()=>{};let n=e.scrollHeight,a=0,i=()=>{a=0;let s=e.scrollHeight,c=s>n,u=t.isAtBottom();n=s,c&&(u?(e.scrollTop=e.scrollHeight,t.onFollow?.()):t.onUnseen?.())},o=new MutationObserver(()=>{a||(a=typeof requestAnimationFrame=="function"?requestAnimationFrame(i):setTimeout(i,0))});return o.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{o.disconnect(),a&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a)}};class un extends Error{constructor(n,a,i){super(a);B(this,"status");B(this,"retryAfterSeconds");this.status=n,this.retryAfterSeconds=i,this.name="ApiError"}}const ir=()=>({agentName:"Accurix",greeting:"Hi! 👋 How can I help you today?",widgetModule:"chat",assistantMediaKind:"image",soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:"text",allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[]}),_c="Sara is an AI assistant; answers may be imperfect.",wc="Accurix is an AI assistant; answers may be imperfect.",Li=e=>{typeof console>"u"||console.warn(`[centrinfo-widget] Could not load saved widget configuration from the API (${e}). Showing default widget chrome. Check data-token, data-api-base, CORS, and backend availability.`)},or=(e,t={})=>{const a=e.disclaimerText?.trim()?.toLowerCase(),i=t.agentName?.trim()||e.agentName?.trim()||"Accurix",o=t.agentAvatarUrl?.trim()||e.agentAvatarUrl?.trim();return{...e,allowVoiceInput:!!(e.allowVoiceInput&&e.talkbackMode&&e.talkbackMode!=="text"),voiceOutputEnabled:!!(e.voiceOutputEnabled&&e.talkbackMode&&e.talkbackMode!=="text"),agentName:i,agentAvatarUrl:o||void 0,disclaimerText:a===_c.toLowerCase()||a?.includes("sara is an ai assistant")?wc:e.disclaimerText}},kc=15e3,Sc=6e4,$c=["/transcribe","/speak","/attachments","/stream"],Tc=e=>{const t=e.split("?")[0]??e;return $c.some(n=>t.includes(`/public-chat${n}`))||t.endsWith("/public-chat")?Sc:kc},Cc=e=>{const t=e.headers?.get?.("Retry-After"),n=t?Number(t):NaN;return Number.isFinite(n)&&n>=0?n:void 0},Ac=e=>{try{const t=e.split(".")[1];if(!t)return null;const n=atob(t.replace(/-/g,"+").replace(/_/g,"/")),a=JSON.parse(n).exp;return typeof a=="number"&&Number.isFinite(a)?a*1e3:null}catch{return null}};class Mc{constructor(t,n,a,i,o={},s,c,u="floating"){B(this,"baseUrl");B(this,"token");B(this,"gifApiKey");B(this,"analyticsContextToken");B(this,"bootstrapOverrides");B(this,"identityToken");B(this,"identityTokenProvider");B(this,"chatSurface");B(this,"cachedIdentity",null);B(this,"identityFlight",null);this.baseUrl=t,this.token=n,this.gifApiKey=a,this.analyticsContextToken=i,this.bootstrapOverrides=o,this.identityToken=s,this.identityTokenProvider=c,this.chatSurface=u}async currentIdentityToken(){if(!this.identityTokenProvider)return this.identityToken;const t=this.cachedIdentity;return t&&Date.now()<t.refreshAt?t.token:(this.identityFlight??(this.identityFlight=(async()=>{try{const n=(await this.identityTokenProvider()??"").trim();this.identityToken=n||void 0;const a=n?Ac(n):null;return this.cachedIdentity=n&&a!==null?{token:n,refreshAt:a-6e4}:null,this.identityToken}finally{this.identityFlight=null}})()),this.identityFlight)}async fetchT(t,n={}){const a=new AbortController;let i=!1;const o=setTimeout(()=>{i=!0,a.abort()},Tc(t)),s=n.signal,c=()=>a.abort();s?.aborted?a.abort():s?.addEventListener("abort",c,{once:!0});try{return await fetch(t,{...n,signal:a.signal})}catch(u){throw i&&!s?.aborted?new un(408,"The request took too long. Please try again."):u}finally{clearTimeout(o),s?.removeEventListener("abort",c)}}headers(t=!0){const n={Authorization:`Bearer ${this.token}`};return t&&(n["Content-Type"]="application/json"),n}async json(t){let n;try{n=await t.json()}catch{n=void 0}if(!t.ok){const a=Ec(n)??`request failed (${t.status})`;throw new un(t.status,a,Cc(t))}return n?.data??n}async bootstrap(){try{const t=await this.fetchT(`${this.baseUrl}/public-chat/bootstrap`,{headers:this.headers(!1)});if(!t.ok)return Li(`bootstrap request failed with ${t.status}`),or(ir(),this.bootstrapOverrides);const n=await this.json(t);return or({...ir(),...n},this.bootstrapOverrides)}catch(t){return Li(t instanceof Error?t.message:"bootstrap request failed"),or(ir(),this.bootstrapOverrides)}}async history(){const t=await this.currentIdentityToken();if(!t)return{conversations:[]};const n=await this.fetchT(`${this.baseUrl}/public-chat/history`,{method:"POST",headers:this.headers(),body:JSON.stringify({identityToken:t,surface:this.chatSurface})}),a=await this.json(n);return{activeSessionId:a.activeSessionId,conversations:Array.isArray(a.conversations)?a.conversations:[]}}async stream(t,n,a){const i=await this.currentIdentityToken(),o=await this.fetchT(`${this.baseUrl}/public-chat/stream`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:t,sessionId:n,clientMessageId:a.clientMessageId,attachmentId:a.attachmentId,attachmentIds:a.attachmentIds,voicePlaybackRequested:!!a.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:i,surface:this.chatSurface}),signal:a.signal});return!o.ok||!o.body?((o.status===429||o.status===401)&&await this.json(o),this.send(t,n,a)):zc(o.body,a)}async liveEvents(t,n){const a=`sessionId=${encodeURIComponent(t)}&after=${encodeURIComponent(n)}`,i=await this.fetchT(`${this.baseUrl}/public-chat/live-events?${a}`,{headers:this.headers(!1)}),o=await this.json(i);return{mode:o.mode??"ai",assignedAgentName:o.assignedAgentName,agentTyping:!!o.agentTyping,agentTypingName:o.agentTypingName,conversationEnded:!!o.conversationEnded,events:o.events??[]}}async typing(t,n){try{const a=await this.fetchT(`${this.baseUrl}/public-chat/typing`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:t,isTyping:n})});if(!a.ok)try{await a.text()}catch{}}catch{}}async presence(t){try{await this.fetchT(`${this.baseUrl}/public-chat/presence`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:t})})}catch{}}async send(t,n,a){const i=await this.currentIdentityToken(),o=await this.fetchT(`${this.baseUrl}/public-chat`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:t,sessionId:n,clientMessageId:a.clientMessageId,attachmentId:a.attachmentId,attachmentIds:a.attachmentIds,voicePlaybackRequested:!!a.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:i,surface:this.chatSurface}),signal:a.signal}),s=await this.json(o);return a.onChunk(s.answer??""),{answer:s.answer??"",sources:s.sources??[],suggestedReplies:s.suggestedReplies??[],availableActions:s.availableActions??[],actions:s.actions??[],selectedAction:s.selectedAction,handoffOffered:s.handoffOffered??!1,requestedContactFields:Di(s.requestedContactFields),conversationEnded:s.conversationEnded??!1,liveMode:s.liveMode,assignedAgentName:s.assignedAgentName,audioBase64:s.audioBase64,mimeType:s.mimeType,visualization:s.visualization,artifacts:s.artifacts}}async action(t,n,a){const i=a?.trim()||(t==="contact-support"?"inquiry":t),o=await this.fetchT(`${this.baseUrl}/public-chat/${i}`,{method:"POST",headers:this.headers(),body:JSON.stringify(n)}),s=await this.json(o);return{ok:!0,note:s?.note,booking:s?.booking,caseReference:s?.caseReference||void 0,inquiryId:s?.inquiryId||s?.inquiry?.id||void 0}}async confirmHostedBooking(t){const n=await this.fetchT(`${this.baseUrl}/public-chat/book-demo/confirm`,{method:"POST",headers:this.headers(),body:JSON.stringify(t)}),a=await this.json(n);if(!a?.booking)throw new Error("Calendar booking confirmation was unavailable.");return a.booking}async speak(t){const n=await this.fetchT(`${this.baseUrl}/public-chat/speak`,{method:"POST",headers:this.headers(),body:JSON.stringify({text:t})}),a=await this.json(n);return{providerReady:!!a.providerReady,message:a.message,audioBase64:a.audioBase64,mimeType:a.mimeType}}async identify(t,n){if(!(!t||!n))try{const a=await this.fetchT(`${this.baseUrl}/public-chat/identify`,{method:"POST",headers:this.headers(),body:JSON.stringify(Ic(t,n))});if(!a.ok)try{await a.text()}catch{}}catch{}}async transcribe(t,n,a,i){const o=await this.fetchT(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(),body:JSON.stringify({audioBase64:t,mimeType:n,languageHint:a,durationSeconds:i})});return(await this.json(o)).text??""}async transcribeAudio(t,n,a,i){const o=new FormData;o.append("audio",t,"voice-recording"),o.append("mimeType",n||t.type||"audio/webm"),a&&o.append("languageHint",a),i!==void 0&&Number.isFinite(i)&&o.append("durationSeconds",String(i));const s=await this.fetchT(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(!1),body:o});return(await this.json(s)).text??""}async endConversation(t){try{const n=await this.fetchT(`${this.baseUrl}/public-chat/end`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:t})});if(!n.ok)try{await n.text()}catch{}}catch{}}async sendFeedback(t){try{const n=await this.fetchT(`${this.baseUrl}/public-chat/feedback`,{method:"POST",headers:this.headers(),body:JSON.stringify(t)});if(!n.ok)try{await n.text()}catch{}}catch{}}async sendExplanationFeedback(t){const n=await this.fetchT(`${this.baseUrl}/public-chat/explanation-feedback`,{method:"POST",headers:this.headers(),body:JSON.stringify(t)});await this.json(n)}async fetchExplanation(t,n,a="widget",i){const o=await this.fetchT(`${this.baseUrl}/public-chat/analytics-explanations/${encodeURIComponent(t)}?sessionId=${encodeURIComponent(n)}&surface=${a}`,{method:"GET",headers:this.headers(!1),signal:i});return this.explanationJob(o,t)}async retryExplanation(t,n,a="widget"){const i=await this.fetchT(`${this.baseUrl}/public-chat/analytics-explanations/${encodeURIComponent(t)}/retry`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:n,surface:a})});return this.explanationJob(i,t)}async explanationJob(t,n){return t.status===404||t.status===410?{status:"failed",explanationId:n,retryAvailable:!1}:this.json(t)}async uploadAttachment(t,n,a,i,o){const s=await this.fetchT(`${this.baseUrl}/public-chat/attachments`,{method:"POST",headers:this.headers(),body:JSON.stringify({fileBase64:t,mimeType:n,filename:a,sessionId:i,analyze:o})});return this.json(s)}async fetchAttachment(t,n){const a=await this.fetchT(`${this.baseUrl}/public-chat/attachments/${encodeURIComponent(t)}?sessionId=${encodeURIComponent(n)}`,{headers:this.headers(!1)});if(!a.ok)throw new un(a.status,"This file is no longer available.");return a.blob()}async demoSlots(t,n){const a=`from=${encodeURIComponent(t)}&to=${encodeURIComponent(n)}`,i=await this.fetchT(`${this.baseUrl}/public-chat/demo-slots?${a}`,{headers:this.headers(!1)});if(!i.ok){const s=new Error("Calendar availability is temporarily unavailable.");throw s.status=i.status,s}const o=await this.json(i);return{status:o?.status,reason:o?.reason,timezone:o?.timezone,slotDurationMinutes:o?.slotDurationMinutes,available:o?.available,taken:o?.taken??[],busy:o?.busy??[]}}async searchGifs(t){if(!this.gifApiKey)return[];const a=`https://tenor.googleapis.com/v2/search?q=${encodeURIComponent(t.trim()||"trending")}&key=${this.gifApiKey}&limit=24&media_filter=tinygif,gif&contentfilter=high`;try{const i=await this.fetchT(a,{});return i.ok?((await i.json()).results??[]).map(s=>({id:s.id,url:s.media_formats?.gif?.url??s.media_formats?.tinygif?.url??"",preview:s.media_formats?.tinygif?.url??s.media_formats?.gif?.url??"",alt:s.content_description||"GIF"})).filter(s=>s.url):[]}catch{return[]}}}const Ic=(e,t)=>{const n={...t.customAttributes??{},...t.metadata??{}};t.createdAt!==void 0&&(n.createdAt=t.createdAt),t.avatarUrl&&(n.avatarUrl=t.avatarUrl),t.company&&(n.company=t.company);const a={sessionId:e},i=t.externalId??t.userId;return i&&(a.externalId=i),t.email&&(a.email=t.email),t.firstName&&(a.firstName=t.firstName),t.lastName&&(a.lastName=t.lastName),t.name&&(a.name=t.name),t.phone&&(a.phone=t.phone),Object.keys(n).length>0&&(a.metadata=n),a},Ec=e=>{const t=e?.message;if(Array.isArray(t))return t.join(", ");if(typeof t=="string")return t},zc=async(e,t)=>{const n=e.getReader(),a=new TextDecoder,i={answer:"",sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1,requestedContactFields:[],conversationEnded:!1};let o="";for(;;){const{done:s,value:c}=await n.read();if(s)break;o+=a.decode(c,{stream:!0});let u;for(;(u=o.indexOf(`
2
73
 
3
- `))!==-1;){const c=i.slice(0,l);i=i.slice(l+2);const u=dw(c);if(u){if(u.event==="error")throw new Qi(502,u.data?.message??"stream error");if(u.event==="chunk"&&typeof u.data?.text=="string")a.answer+=u.data.text,e.onChunk(u.data.text);else if(u.event==="reset")a.answer="",e.onReset?.();else if(u.event==="final"&&u.data)typeof u.data.answer=="string"&&(a.answer=u.data.answer),a.sources=u.data.sources??[],a.suggestedReplies=u.data.suggestedReplies??[],a.availableActions=u.data.availableActions??[],a.actions=u.data.actions??[],a.selectedAction=u.data.selectedAction,a.handoffOffered=!!u.data.handoffOffered,a.requestedContactFields=tv(u.data.requestedContactFields),a.conversationEnded=!!u.data.conversationEnded,a.liveMode=u.data.liveMode,a.assignedAgentName=u.data.assignedAgentName,a.visualization=u.data.visualization,a.artifacts=u.data.artifacts,a.audioBase64=u.data.audioBase64,a.mimeType=u.data.mimeType,e.onTextReady?.();else if(u.event==="audio"&&u.data)typeof u.data.seq=="number"?(a.liveAudio=!0,e.onAudioSegment?.({seq:u.data.seq,audioBase64:u.data.audioBase64??"",mimeType:u.data.mimeType,text:typeof u.data.text=="string"?u.data.text:void 0})):(a.audioBase64=u.data.audioBase64,a.mimeType=u.data.mimeType);else if(u.event==="done")return a}}}return a},dw=t=>{let e="message";const r=[];for(const n of t.split(`
4
- `))n.startsWith("event:")?e=n.slice(6).trim():n.startsWith("data:")&&r.push(n.slice(5).trim());if(r.length===0)return{event:e};try{return{event:e,data:JSON.parse(r.join(`
5
- `))}}catch{return{event:e}}},tv=t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):[],fr=t=>new Promise(e=>setTimeout(e,t)),rv={agentName:"Accurix",agentAvatarUrl:"",widgetModule:"assistant",assistantMediaUrl:"https://images.unsplash.com/photo-1494790108377-be9c29b29330",assistantMediaKind:"image",assistantPrivacyUrl:"https://accurix.tech/privacy",soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:"avatar",avatarProvider:"demo",avatarId:"accurix-demo",greeting:"Hi! I'm Accurix, the AI assistant for Accurix. Ask me anything about products, pricing, or documentation — or book a demo.",allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:["public_book_demo","public_capture_contact","public_submit_inquiry"],agentDescription:"I help with Accurix products, pricing, and documentation.",welcomeSubtitle:"Ask me anything — most answers are instant.",disclaimerText:"Accurix is an AI assistant; answers may be imperfect.",starterQuestions:["What can Accurix help with?","How do I get started?","What's your pricing?"],featuredLinks:[{label:"Accurix founders",url:"https://accurix.tech/about"},{label:"Pricing",url:"https://accurix.tech/pricing"}]},hw=[{match:/demo chart|monthly orders|orders by status/i,result:{answer:"Orders moved in different directions by status in the latest month. The chart below shows one line for submitted, approved, and fulfilled orders.",sources:[],suggestedReplies:["Show a demo KPI","Show a demo table"],handoffOffered:!1,visualization:{version:1,presentation:"chart",type:"line",title:"Monthly orders by status",columns:["month","status","order_count"],rows:[{month:"2025-01-01",status:"Submitted",order_count:12},{month:"2025-01-01",status:"Approved",order_count:16},{month:"2025-01-01",status:"Fulfilled",order_count:14},{month:"2025-02-01",status:"Submitted",order_count:14},{month:"2025-02-01",status:"Approved",order_count:15},{month:"2025-02-01",status:"Fulfilled",order_count:15},{month:"2025-03-01",status:"Submitted",order_count:13},{month:"2025-03-01",status:"Approved",order_count:17},{month:"2025-03-01",status:"Fulfilled",order_count:16},{month:"2025-04-01",status:"Submitted",order_count:15},{month:"2025-04-01",status:"Approved",order_count:16},{month:"2025-04-01",status:"Fulfilled",order_count:17},{month:"2025-05-01",status:"Submitted",order_count:16},{month:"2025-05-01",status:"Approved",order_count:18},{month:"2025-05-01",status:"Fulfilled",order_count:17},{month:"2025-06-01",status:"Submitted",order_count:17},{month:"2025-06-01",status:"Approved",order_count:17},{month:"2025-06-01",status:"Fulfilled",order_count:18},{month:"2025-07-01",status:"Submitted",order_count:18},{month:"2025-07-01",status:"Approved",order_count:19},{month:"2025-07-01",status:"Fulfilled",order_count:18},{month:"2025-08-01",status:"Submitted",order_count:19},{month:"2025-08-01",status:"Approved",order_count:18},{month:"2025-08-01",status:"Fulfilled",order_count:19}],rowCount:24,timezone:"UTC",columnMetadata:[{key:"month",label:"Order month",dataType:"date",semanticRole:"date"},{key:"status",label:"Status",dataType:"text",semanticRole:"dimension"},{key:"order_count",label:"Distinct order count",dataType:"number",semanticRole:"measure",aggregation:"count_distinct"}],chartRecommendation:{type:"line",mode:"time_series",categoryField:"month",valueFields:["order_count"],seriesField:"status"},expandable:!0,tableAvailable:!1,explanation:{headline:"The latest results moved in different directions by status.",summary:"Submitted and fulfilled orders increased, while approved orders decreased.",evidence:["Submitted orders increased from 18 in July to 19 in August.","Approved orders decreased from 19 in July to 18 in August.","Fulfilled orders increased from 18 in July to 19 in August."],businessMeaning:"Overall order activity is steady, but the small approval decline is worth watching if it continues.",followUps:["Which status changed the most?","How does this compare with the prior quarter?"],source:"governed_result"}}}},{match:/demo kpi|active accounts/i,result:{answer:"There are 5,632 active accounts in the current demo result.",sources:[],suggestedReplies:["Show a demo chart","Show a demo table"],handoffOffered:!1,visualization:{version:1,presentation:"kpi",type:"kpi",title:"Active accounts",columns:["active_accounts"],value:"active_accounts",rows:[{active_accounts:5632}],rowCount:1,columnMetadata:[{key:"active_accounts",label:"Active accounts",dataType:"number",semanticRole:"measure",aggregation:"count_distinct"}],explanation:{headline:"Active accounts are 5,632.",summary:"This is the latest value in the demo result.",evidence:["The displayed active-account count is 5,632."],source:"governed_result"}}}},{match:/demo table|account health/i,result:{answer:"Nine accounts are included in this governed result. The table shows a compact preview and can be expanded to inspect every permitted row.",sources:[],suggestedReplies:["Show a demo chart","Test the hidden table response"],handoffOffered:!1,visualization:{version:1,presentation:"table",type:"table",title:"Account health",columns:["account_name","region","health_score","renewal_month"],rows:[{account_name:"Northstar Industries",region:"West",health_score:94,renewal_month:"August"},{account_name:"Apex Group",region:"East",health_score:91,renewal_month:"September"},{account_name:"Summit Retail",region:"North",health_score:88,renewal_month:"August"},{account_name:"Harbor Logistics",region:"South",health_score:86,renewal_month:"October"},{account_name:"Brightline Media",region:"West",health_score:84,renewal_month:"November"},{account_name:"Redwood Labs",region:"East",health_score:82,renewal_month:"September"},{account_name:"Atlas Foods",region:"North",health_score:79,renewal_month:"December"},{account_name:"Cedar Health",region:"South",health_score:77,renewal_month:"October"},{account_name:"Bluewave Energy",region:"West",health_score:74,renewal_month:"December"}],rowCount:9,columnMetadata:[{key:"account_name",label:"Account",dataType:"text",semanticRole:"dimension"},{key:"region",label:"Region",dataType:"text",semanticRole:"geography"},{key:"health_score",label:"Health score",dataType:"number",semanticRole:"measure"},{key:"renewal_month",label:"Renewal month",dataType:"text",semanticRole:"date"}],expandable:!0,tableAvailable:!0,downloadAvailable:!0,explanation:{headline:"Nine accounts are available for review.",summary:"Health scores range from 74 to 94 across four regions.",evidence:["Northstar Industries has the highest health score at 94."],source:"governed_result"}}}},{match:/hidden table|table response/i,result:{answer:"Three accounts need attention. The public widget explains the result without exposing its underlying rows.",sources:[],suggestedReplies:["Show a demo chart","Show a demo KPI"],handoffOffered:!1,visualization:{version:1,presentation:"table",type:"table",columns:["account_name","risk_score"],rows:[{account_name:"Private account A",risk_score:91},{account_name:"Private account B",risk_score:87},{account_name:"Private account C",risk_score:82}],rowCount:3,tableAvailable:!1,explanation:{headline:"Three accounts need attention.",summary:"The written result is available without displaying a public data table.",evidence:["Three accounts matched the approved attention rule."],source:"governed_result"}}}},{match:/^\s*(hi+|hey+|hello|yo|sup|howdy|hola|thanks|thank you|thx|good (morning|afternoon|evening))\b/i,result:{answer:"Hello! 👋 How can I help you today?",sources:[],suggestedReplies:["How do I track a shipment?","How does customs work?"],handoffOffered:!1}},{match:/track|shipment|where|status/i,result:{answer:"Centrinfo can answer from your indexed knowledge base, public website, connected files, and approved organization tools. It keeps answers grounded in your configured sources and can hand a conversation to your team when the AI is not enough.",sources:[{title:"Centrinfo public widget",url:"https://accurix.tech/centrinfo"}],suggestedReplies:["How does the widget work?","Can a human take over?"],handoffOffered:!1}},{match:/custom|clear|duty|tariff|import/i,result:{answer:"Accurix connects your organization knowledge, channels, integrations, and public widget in one place. You can configure which sources the AI can use, which tools visitors can trigger, and when your team should take over live chat.",sources:[{title:"Accurix documentation",url:"https://accurix.tech/docs"}],suggestedReplies:["Which tools can I connect?","How do permissions work?"],handoffOffered:!1}},{match:/price|cost|pricing|plan|quote/i,result:{answer:"Accurix uses a usage-based pricing model. Organizations keep an active subscription and spend credits as the AI answers, searches, and uses tools. Credit top-ups can extend usage when the subscription grant runs low.",sources:[{title:"Pricing",url:"https://accurix.tech/pricing"}],suggestedReplies:["How do credits work?","Can I top up credits?"],handoffOffered:!1}}],pw={answer:"That's a great question — I don't have a confident answer from Accurix's published docs yet. Want me to pass it to the team so a human can follow up? You can also book a quick demo.",sources:[],suggestedReplies:["What can you help with?"],handoffOffered:!0},vw=t=>hw.find(e=>e.match.test(t))?.result??pw;class gw{async history(){return{conversations:[]}}async bootstrap(){return await fr(180),rv}async stream(e,r,n){await fr(550);const a=vw(e),i=a.answer.split(/(\s+)/);for(const o of i){if(n.signal?.aborted)break;n.onChunk(o),await fr(18+Math.min(40,o.length*6))}return{...a,availableActions:rv.availableActions}}async liveEvents(){return{mode:"ai",conversationEnded:!1,events:[]}}async presence(e){}async typing(){await fr(20)}async action(e,r){return await fr(450),{ok:!0,note:{"book-demo":"Demo requested — we'll email you a few times that work. 📅",contact:"Got it — saved your details. ✅","contact-support":"Support request sent. The team can follow up from this chat. ✅",inquiry:"Thanks! We'll get back to you shortly. ✉️","request-callback":"We'll call you back soon. 📞","schedule-callback":"Your callback has been scheduled.","subscribe-newsletter":"You're subscribed. 🎉"}[e]}}async speak(){return await fr(120),{providerReady:!1,message:"Demo voice provider is not connected."}}async transcribe(e,r,n,a){return await fr(700),"How do I track a shipment?"}async uploadAttachment(e,r,n){return{id:`demo-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async identify(e,r){await fr(50)}async endConversation(e){await fr(50)}async sendFeedback(){await fr(50)}async demoSlots(e,r){return await fr(150),{taken:[[11,0],[15,0]].map(([a,i])=>{const o=new Date;return o.setHours(a,i,0,0),o.toISOString()}),busy:[]}}async searchGifs(e){await fr(280);const r=e.trim().toLowerCase(),n=r?ku.filter(i=>i.alt.includes(r)||i.tags.some(o=>o.includes(r)||r.includes(o))):ku;return(n.length>0?n:ku).map(i=>({id:i.id,url:nv(i.emoji,i.anim),preview:nv(i.emoji,i.anim),alt:i.alt}))}}const Hs="<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>",Vs="<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>",nv=(t,e)=>{const r=`<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><rect width='128' height='128' rx='14' fill='#eef1f4'/><text x='64' y='88' font-size='64' text-anchor='middle'>${t}${e}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(r)}`},ku=[{id:"g1",emoji:"👍",alt:"thumbs up",tags:["thumbs","yes","ok","great","good"],anim:Hs},{id:"g2",emoji:"🎉",alt:"celebrate",tags:["party","yay","congrats","celebrate"],anim:Vs},{id:"g3",emoji:"👋",alt:"wave hello",tags:["hi","hello","hey","wave","bye"],anim:Vs},{id:"g4",emoji:"❤️",alt:"heart",tags:["love","thanks","heart"],anim:Hs},{id:"g5",emoji:"🤔",alt:"thinking",tags:["hmm","think","thinking"],anim:Vs},{id:"g6",emoji:"😂",alt:"laughing",tags:["lol","funny","haha","laugh"],anim:Hs},{id:"g7",emoji:"🔥",alt:"fire",tags:["fire","hot","lit","awesome"],anim:Hs},{id:"g8",emoji:"🚀",alt:"rocket",tags:["rocket","launch","fast","go"],anim:Vs}],Tu=t=>new Promise(e=>setTimeout(e,t));class mw{constructor(e,r){se(this,"real");se(this,"strings");this.real=e,this.strings=r}bootstrap(){return this.real.bootstrap()}async history(){return{conversations:[]}}async stream(e,r,n){await Tu(300);for(const a of this.strings.previewReply.split(/(\s+)/)){if(n.signal?.aborted)break;n.onChunk(a),await Tu(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async liveEvents(){return{mode:"ai",conversationEnded:!1,events:[]}}async presence(e){}async typing(){}async action(){return await Tu(250),{ok:!0,note:this.strings.previewActionNote}}async speak(){return{providerReady:!1,message:"Preview voice provider is not connected."}}async identify(){}async endConversation(){}async sendFeedback(){}async transcribe(e,r,n,a){return""}async uploadAttachment(e,r,n){return{id:`preview-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}}var oa,nt,Cu,av,eo=0,iv=[],ft=Be,ov=ft.__b,sv=ft.__r,lv=ft.diffed,cv=ft.__c,uv=ft.unmount,fv=ft.__;function to(t,e){ft.__h&&ft.__h(nt,t,eo||e),eo=0;var r=nt.__H||(nt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function U(t){return eo=1,yw(hv,t)}function yw(t,e,r){var n=to(oa++,2);if(n.t=t,!n.__c&&(n.__=[hv(void 0,e),function(s){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,s);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=nt,!nt.__f)){var a=function(s,l,c){if(!n.__c.__H)return!0;var u=n.__c.__H.__.filter(function(h){return h.__c});if(u.every(function(h){return!h.__N}))return!i||i.call(this,s,l,c);var f=n.__c.props!==s;return u.some(function(h){if(h.__N){var d=h.__[0];h.__=h.__N,h.__N=void 0,d!==h.__[0]&&(f=!0)}}),i&&i.call(this,s,l,c)||f};nt.__f=!0;var i=nt.shouldComponentUpdate,o=nt.componentWillUpdate;nt.componentWillUpdate=function(s,l,c){if(this.__e){var u=i;i=void 0,a(s,l,c),i=u}o&&o.call(this,s,l,c)},nt.shouldComponentUpdate=a}return n.__N||n.__}function le(t,e){var r=to(oa++,3);!ft.__s&&Du(r.__H,e)&&(r.__=t,r.u=e,nt.__H.__h.push(r))}function Mu(t,e){var r=to(oa++,4);!ft.__s&&Du(r.__H,e)&&(r.__=t,r.u=e,nt.__h.push(r))}function X(t){return eo=5,Ht(function(){return{current:t}},[])}function Ht(t,e){var r=to(oa++,7);return Du(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Y(t,e){return eo=8,Ht(function(){return t},e)}function _w(t){var e=nt.context[t.__c],r=to(oa++,9);return r.c=t,e?(r.__==null&&(r.__=!0,e.sub(nt)),e.props.value):t.__}function bw(){for(var t;t=iv.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(Us),e.__h.some(Au),e.__h=[]}catch(r){e.__h=[],ft.__e(r,t.__v)}}}ft.__b=function(t){nt=null,ov&&ov(t)},ft.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),fv&&fv(t,e)},ft.__r=function(t){sv&&sv(t),oa=0;var e=(nt=t.__c).__H;e&&(Cu===nt?(e.__h=[],nt.__h=[],e.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.some(Us),e.__h.some(Au),e.__h=[],oa=0)),Cu=nt},ft.diffed=function(t){lv&&lv(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(iv.push(e)!==1&&av===ft.requestAnimationFrame||((av=ft.requestAnimationFrame)||xw)(bw)),e.__H.__.some(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Cu=nt=null},ft.__c=function(t,e){e.some(function(r){try{r.__h.some(Us),r.__h=r.__h.filter(function(n){return!n.__||Au(n)})}catch(n){e.some(function(a){a.__h&&(a.__h=[])}),e=[],ft.__e(n,r.__v)}}),cv&&cv(t,e)},ft.unmount=function(t){uv&&uv(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.some(function(n){try{Us(n)}catch(a){e=a}}),r.__H=void 0,e&&ft.__e(e,r.__v))};var dv=typeof requestAnimationFrame=="function";function xw(t){var e,r=function(){clearTimeout(n),dv&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);dv&&(e=requestAnimationFrame(r))}function Us(t){var e=nt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),nt=e}function Au(t){var e=nt;t.__c=t.__(),nt=e}function Du(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function hv(t,e){return typeof e=="function"?e(t):e}var Iu=function(t,e){return Iu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},Iu(t,e)};function K(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Iu(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Lu=12,ww="sans-serif",sa=Lu+"px "+ww,Sw=20,kw=100,Tw="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function Cw(t){var e={};if(typeof JSON>"u")return e;for(var r=0;r<t.length;r++){var n=String.fromCharCode(r+32),a=(t.charCodeAt(r)-Sw)/kw;e[n]=a}return e}var Mw=Cw(Tw),ri={createCanvas:function(){return typeof document<"u"&&document.createElement("canvas")},measureText:(function(){var t,e;return function(r,n){if(!t){var a=ri.createCanvas();t=a&&a.getContext("2d")}if(t)return e!==n&&(e=t.font=n||sa),t.measureText(r);r=r||"",n=n||sa;var i=/((?:\d+)?\.?\d*)px/.exec(n),o=i&&+i[1]||Lu,s=0;if(n.indexOf("mono")>=0)s=o*r.length;else for(var l=0;l<r.length;l++){var c=Mw[r[l]];s+=c==null?o:c*o}return{width:s}}})(),loadImage:function(t,e,r){var n=new Image;return n.onload=e,n.onerror=r,n.src=t,n}},pv=ni(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(t,e){return t["[object "+e+"]"]=!0,t},{}),vv=ni(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(t,e){return t["[object "+e+"Array]"]=!0,t},{}),ro=Object.prototype.toString,Gs=Array.prototype,Aw=Gs.forEach,Dw=Gs.filter,Pu=Gs.slice,Iw=Gs.map,gv=function(){}.constructor,$s=gv?gv.prototype:null,Ru="__proto__",Lw=2311;function mv(){return Lw++}function Eu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];typeof console<"u"&&console.error.apply(console,t)}function Ie(t){if(t==null||typeof t!="object")return t;var e=t,r=ro.call(t);if(r==="[object Array]"){if(!io(t)){e=[];for(var n=0,a=t.length;n<a;n++)e[n]=Ie(t[n])}}else if(vv[r]){if(!io(t)){var i=t.constructor;if(i.from)e=i.from(t);else{e=new i(t.length);for(var n=0,a=t.length;n<a;n++)e[n]=t[n]}}}else if(!pv[r]&&!io(t)&&!no(t)){e={};for(var o in t)t.hasOwnProperty(o)&&o!==Ru&&(e[o]=Ie(t[o]))}return e}function Oe(t,e,r){if(!de(e)||!de(t))return r?Ie(e):t;for(var n in e)if(e.hasOwnProperty(n)&&n!==Ru){var a=t[n],i=e[n];de(i)&&de(a)&&!ee(i)&&!ee(a)&&!no(i)&&!no(a)&&!yv(i)&&!yv(a)&&!io(i)&&!io(a)?Oe(a,i,r):(r||!(n in t))&&(t[n]=Ie(e[n]))}return t}function q(t,e){if(Object.assign)Object.assign(t,e);else for(var r in e)e.hasOwnProperty(r)&&r!==Ru&&(t[r]=e[r]);return t}function He(t,e,r){for(var n=at(e),a=0,i=n.length;a<i;a++){var o=n[a];t[o]==null&&(t[o]=e[o])}return t}function Ue(t,e){if(t){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r}return-1}function Pw(t,e){var r=t.prototype;function n(){}n.prototype=e.prototype,t.prototype=new n;for(var a in r)r.hasOwnProperty(a)&&(t.prototype[a]=r[a]);t.prototype.constructor=t,t.superClass=e}function Ur(t,e,r){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var n=Object.getOwnPropertyNames(e),a=0;a<n.length;a++){var i=n[a];i!=="constructor"&&t[i]==null&&(t[i]=e[i])}else He(t,e)}function Vt(t){return!t||typeof t=="string"?!1:typeof t.length=="number"}function I(t,e,r){if(t&&e)if(t.forEach&&t.forEach===Aw)t.forEach(e,r);else if(t.length===+t.length)for(var n=0,a=t.length;n<a;n++)e.call(r,t[n],n,t);else for(var i in t)t.hasOwnProperty(i)&&e.call(r,t[i],i,t)}function he(t,e,r){if(!t)return[];if(!e)return Nu(t);if(t.map&&t.map===Iw)return t.map(e,r);for(var n=[],a=0,i=t.length;a<i;a++)n.push(e.call(r,t[a],a,t));return n}function ni(t,e,r,n){if(t&&e){for(var a=0,i=t.length;a<i;a++)r=e.call(n,r,t[a],a,t);return r}}function bt(t,e,r){if(!t)return[];if(!e)return Nu(t);if(t.filter&&t.filter===Dw)return t.filter(e,r);for(var n=[],a=0,i=t.length;a<i;a++)e.call(r,t[a],a,t)&&n.push(t[a]);return n}function at(t){if(!t)return[];if(Object.keys)return Object.keys(t);var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(r);return e}function Rw(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return function(){return t.apply(e,r.concat(Pu.call(arguments)))}}var Ne=$s&&ke($s.bind)?$s.call.bind($s.bind):Rw;function dt(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return function(){return t.apply(this,e.concat(Pu.call(arguments)))}}function ee(t){return Array.isArray?Array.isArray(t):ro.call(t)==="[object Array]"}function ke(t){return typeof t=="function"}function ae(t){return typeof t=="string"}function Ou(t){return ro.call(t)==="[object String]"}function et(t){return typeof t=="number"}function de(t){var e=typeof t;return e==="function"||!!t&&e==="object"}function yv(t){return!!pv[ro.call(t)]}function Ut(t){return!!vv[ro.call(t)]}function no(t){return typeof t=="object"&&typeof t.nodeType=="number"&&typeof t.ownerDocument=="object"}function Ws(t){return t.colorStops!=null}function Ew(t){return t.image!=null}function qs(t){return t!==t}function ao(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=0,n=t.length;r<n;r++)if(t[r]!=null)return t[r]}function Pe(t,e){return t??e}function Ys(t,e,r){return t??e??r}function Nu(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Pu.apply(t,e)}function _v(t){if(typeof t=="number")return[t,t,t,t];var e=t.length;return e===2?[t[0],t[1],t[0],t[1]]:e===3?[t[0],t[1],t[2],t[1]]:t}function dn(t,e){if(!t)throw new Error(e)}function Gr(t){return t==null?null:typeof t.trim=="function"?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}var bv="__ec_primitive__";function Bu(t){t[bv]=!0}function io(t){return t[bv]}var Ow=(function(){function t(){this.data={}}return t.prototype.delete=function(e){var r=this.has(e);return r&&delete this.data[e],r},t.prototype.has=function(e){return this.data.hasOwnProperty(e)},t.prototype.get=function(e){return this.data[e]},t.prototype.set=function(e,r){return this.data[e]=r,this},t.prototype.keys=function(){return at(this.data)},t.prototype.forEach=function(e){var r=this.data;for(var n in r)r.hasOwnProperty(n)&&e(r[n],n)},t})(),xv=typeof Map=="function";function Nw(){return xv?new Map:new Ow}var Bw=(function(){function t(e){var r=ee(e);this.data=Nw();var n=this;e instanceof t?e.each(a):e&&I(e,a);function a(i,o){r?n.set(i,o):n.set(o,i)}}return t.prototype.hasKey=function(e){return this.data.has(e)},t.prototype.get=function(e){return this.data.get(e)},t.prototype.set=function(e,r){return this.data.set(e,r),r},t.prototype.each=function(e,r){this.data.forEach(function(n,a){e.call(r,n,a)})},t.prototype.keys=function(){var e=this.data.keys();return xv?Array.from(e):e},t.prototype.removeKey=function(e){this.data.delete(e)},t})();function me(t){return new Bw(t)}function zw(t,e){for(var r=new t.constructor(t.length+e.length),n=0;n<t.length;n++)r[n]=t[n];for(var a=t.length,n=0;n<e.length;n++)r[n+a]=e[n];return r}function Xs(t,e){var r;if(Object.create)r=Object.create(t);else{var n=function(){};n.prototype=t,r=new n}return e&&q(r,e),r}function wv(t){var e=t.style;e.webkitUserSelect="none",e.userSelect="none",e.webkitTapHighlightColor="rgba(0,0,0,0)",e["-webkit-touch-callout"]="none"}function la(t,e){return t.hasOwnProperty(e)}function Et(){}var Fw=180/Math.PI,Hw=(function(){function t(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return t})(),Vw=(function(){function t(){this.browser=new Hw,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow=typeof window<"u"}return t})(),_e=new Vw;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(_e.wxa=!0,_e.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?_e.worker=!0:!_e.hasGlobalWindow||"Deno"in window?(_e.node=!0,_e.svgSupported=!0):Uw(navigator.userAgent,_e);function Uw(t,e){var r=e.browser,n=t.match(/Firefox\/([\d.]+)/),a=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),i=t.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(t);n&&(r.firefox=!0,r.version=n[1]),a&&(r.ie=!0,r.version=a[1]),i&&(r.edge=!0,r.version=i[1],r.newEdge=+i[1].split(".")[0]>18),o&&(r.weChat=!0),e.svgSupported=typeof SVGRect<"u",e.touchEventsSupported="ontouchstart"in window&&!r.ie&&!r.edge,e.pointerEventsSupported="onpointerdown"in window&&(r.edge||r.ie&&+r.version>=11),e.domSupported=typeof document<"u";var s=document.documentElement.style;e.transform3dSupported=(r.ie&&"transition"in s||r.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||r.ie&&+r.version>=9}var Gw=".",ca="___EC__COMPONENT__CONTAINER___",Sv="___EC__EXTENDED_CLASS___";function $r(t){var e={main:"",sub:""};if(t){var r=t.split(Gw);e.main=r[0]||"",e.sub=r[1]||""}return e}function $w(t){dn(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(t),'componentType "'+t+'" illegal')}function Ww(t){return!!(t&&t[Sv])}function zu(t,e){t.$constructor=t,t.extend=function(r){var n=this,a;return qw(n)?a=(function(i){K(o,i);function o(){return i.apply(this,arguments)||this}return o})(n):(a=function(){(r.$constructor||n).apply(this,arguments)},Pw(a,this)),q(a.prototype,r),a[Sv]=!0,a.extend=this.extend,a.superCall=Zw,a.superApply=Kw,a.superClass=n,a}}function qw(t){return ke(t)&&/^class\s/.test(Function.prototype.toString.call(t))}function kv(t,e){t.extend=e.extend}var Yw=Math.round(Math.random()*10);function Xw(t){var e=["__\0is_clz",Yw++].join("_");t.prototype[e]=!0,t.isInstance=function(r){return!!(r&&r[e])}}function Zw(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return this.superClass.prototype[e].apply(t,r)}function Kw(t,e,r){return this.superClass.prototype[e].apply(t,r)}function Zs(t){var e={};t.registerClass=function(n){var a=n.type||n.prototype.type;if(a){$w(a),n.prototype.type=a;var i=$r(a);if(!i.sub)e[i.main]=n;else if(i.sub!==ca){var o=r(i);o[i.sub]=n}}return n},t.getClass=function(n,a,i){var o=e[n];if(o&&o[ca]&&(o=a?o[a]:null),i&&!o)throw new Error(a?"Component "+n+"."+(a||"")+" is used but not imported.":n+".type should be specified.");return o},t.getClassesByMainType=function(n){var a=$r(n),i=[],o=e[a.main];return o&&o[ca]?I(o,function(s,l){l!==ca&&i.push(s)}):i.push(o),i},t.hasClass=function(n){var a=$r(n);return!!e[a.main]},t.getAllClassMainTypes=function(){var n=[];return I(e,function(a,i){n.push(i)}),n},t.hasSubTypes=function(n){var a=$r(n),i=e[a.main];return i&&i[ca]};function r(n){var a=e[n.main];return(!a||!a[ca])&&(a=e[n.main]={},a[ca]=!0),a}}function oo(t,e){for(var r=0;r<t.length;r++)t[r][1]||(t[r][1]=t[r][0]);return e=e||!1,function(n,a,i){for(var o={},s=0;s<t.length;s++){var l=t[s][1];if(!(a&&Ue(a,l)>=0||i&&Ue(i,l)<0)){var c=n.getShallow(l,e);c!=null&&(o[t[s][0]]=c)}}return o}}var jw=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],Jw=oo(jw),Qw=(function(){function t(){}return t.prototype.getAreaStyle=function(e,r){return Jw(this,e,r)},t})(),Tv=(function(){function t(e){this.value=e}return t})(),eS=(function(){function t(){this._len=0}return t.prototype.insert=function(e){var r=new Tv(e);return this.insertEntry(r),r},t.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},t.prototype.remove=function(e){var r=e.prev,n=e.next;r?r.next=n:this.head=n,n?n.prev=r:this.tail=r,e.next=e.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t})(),so=(function(){function t(e){this._list=new eS,this._maxSize=10,this._map={},this._maxSize=e}return t.prototype.put=function(e,r){var n=this._list,a=this._map,i=null;if(a[e]==null){var o=n.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=n.head;n.remove(l),delete a[l.key],i=l.value,this._lastRemovedEntry=l}s?s.value=r:s=new Tv(r),s.key=e,n.insertEntry(s),a[e]=s}return i},t.prototype.get=function(e){var r=this._map[e],n=this._list;if(r!=null)return r!==n.tail&&(n.remove(r),n.insertEntry(r)),r.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t})(),Fu=new so(50);function tS(t){if(typeof t=="string"){var e=Fu.get(t);return e&&e.image}else return t}function Cv(t,e,r,n,a){if(t)if(typeof t=="string"){if(e&&e.__zrImageSrc===t||!r)return e;var i=Fu.get(t),o={hostEl:r,cb:n,cbPayload:a};return i?(e=i.image,!Ks(e)&&i.pending.push(o)):(e=ri.loadImage(t,Mv,Mv),e.__zrImageSrc=t,Fu.put(t,e.__cachedImgObj={image:e,pending:[o]})),e}else return t;else return e}function Mv(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e<t.pending.length;e++){var r=t.pending[e],n=r.cb;n&&n(this,r.cbPayload),r.hostEl.dirty()}t.pending.length=0}function Ks(t){return t&&t.width&&t.height}function ai(){return[1,0,0,1,0,0]}function Hu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function rS(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function ii(t,e,r){var n=e[0]*r[0]+e[2]*r[1],a=e[1]*r[0]+e[3]*r[1],i=e[0]*r[2]+e[2]*r[3],o=e[1]*r[2]+e[3]*r[3],s=e[0]*r[4]+e[2]*r[5]+e[4],l=e[1]*r[4]+e[3]*r[5]+e[5];return t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=s,t[5]=l,t}function Vu(t,e,r){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+r[0],t[5]=e[5]+r[1],t}function Uu(t,e,r,n){n===void 0&&(n=[0,0]);var a=e[0],i=e[2],o=e[4],s=e[1],l=e[3],c=e[5],u=Math.sin(r),f=Math.cos(r);return t[0]=a*f+s*u,t[1]=-a*u+s*f,t[2]=i*f+l*u,t[3]=-i*u+f*l,t[4]=f*(o-n[0])+u*(c-n[1])+n[0],t[5]=f*(c-n[1])-u*(o-n[0])+n[1],t}function nS(t,e,r){var n=r[0],a=r[1];return t[0]=e[0]*n,t[1]=e[1]*a,t[2]=e[2]*n,t[3]=e[3]*a,t[4]=e[4]*n,t[5]=e[5]*a,t}function Gu(t,e){var r=e[0],n=e[2],a=e[4],i=e[1],o=e[3],s=e[5],l=r*o-i*n;return l?(l=1/l,t[0]=o*l,t[1]=-i*l,t[2]=-n*l,t[3]=r*l,t[4]=(n*s-o*a)*l,t[5]=(i*a-r*s)*l,t):null}var Je=(function(){function t(e,r){this.x=e||0,this.y=r||0}return t.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(e,r){return this.x=e,this.y=r,this},t.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},t.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},t.prototype.scale=function(e){this.x*=e,this.y*=e},t.prototype.scaleAndAdd=function(e,r){this.x+=e.x*r,this.y+=e.y*r},t.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},t.prototype.dot=function(e){return this.x*e.x+this.y*e.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},t.prototype.distance=function(e){var r=this.x-e.x,n=this.y-e.y;return Math.sqrt(r*r+n*n)},t.prototype.distanceSquare=function(e){var r=this.x-e.x,n=this.y-e.y;return r*r+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(e){if(e){var r=this.x,n=this.y;return this.x=e[0]*r+e[2]*n+e[4],this.y=e[1]*r+e[3]*n+e[5],this}},t.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},t.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},t.set=function(e,r,n){e.x=r,e.y=n},t.copy=function(e,r){e.x=r.x,e.y=r.y},t.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},t.lenSquare=function(e){return e.x*e.x+e.y*e.y},t.dot=function(e,r){return e.x*r.x+e.y*r.y},t.add=function(e,r,n){e.x=r.x+n.x,e.y=r.y+n.y},t.sub=function(e,r,n){e.x=r.x-n.x,e.y=r.y-n.y},t.scale=function(e,r,n){e.x=r.x*n,e.y=r.y*n},t.scaleAndAdd=function(e,r,n,a){e.x=r.x+n.x*a,e.y=r.y+n.y*a},t.lerp=function(e,r,n,a){var i=1-a;e.x=i*r.x+a*n.x,e.y=i*r.y+a*n.y},t})(),js=Math.min,Js=Math.max,ua=new Je,fa=new Je,da=new Je,ha=new Je,lo=new Je,co=new Je,Ge=(function(){function t(e,r,n,a){n<0&&(e=e+n,n=-n),a<0&&(r=r+a,a=-a),this.x=e,this.y=r,this.width=n,this.height=a}return t.prototype.union=function(e){var r=js(e.x,this.x),n=js(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Js(e.x+e.width,this.x+this.width)-r:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Js(e.y+e.height,this.y+this.height)-n:this.height=e.height,this.x=r,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(e){var r=this,n=e.width/r.width,a=e.height/r.height,i=ai();return Vu(i,i,[-r.x,-r.y]),nS(i,i,[n,a]),Vu(i,i,[e.x,e.y]),i},t.prototype.intersect=function(e,r){if(!e)return!1;e instanceof t||(e=t.create(e));var n=this,a=n.x,i=n.x+n.width,o=n.y,s=n.y+n.height,l=e.x,c=e.x+e.width,u=e.y,f=e.y+e.height,h=!(i<l||c<a||s<u||f<o);if(r){var d=1/0,p=0,m=Math.abs(i-l),g=Math.abs(c-a),v=Math.abs(s-u),y=Math.abs(f-o),b=Math.min(m,g),x=Math.min(v,y);i<l||c<a?b>p&&(p=b,m<g?Je.set(co,-m,0):Je.set(co,g,0)):b<d&&(d=b,m<g?Je.set(lo,m,0):Je.set(lo,-g,0)),s<u||f<o?x>p&&(p=x,v<y?Je.set(co,0,-v):Je.set(co,0,y)):b<d&&(d=b,v<y?Je.set(lo,0,v):Je.set(lo,0,-y))}return r&&Je.copy(r,h?lo:co),h},t.prototype.contain=function(e,r){var n=this;return e>=n.x&&e<=n.x+n.width&&r>=n.y&&r<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return this.width===0||this.height===0},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(e,r){e.x=r.x,e.y=r.y,e.width=r.width,e.height=r.height},t.applyTransform=function(e,r,n){if(!n){e!==r&&t.copy(e,r);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var a=n[0],i=n[3],o=n[4],s=n[5];e.x=r.x*a+o,e.y=r.y*i+s,e.width=r.width*a,e.height=r.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}ua.x=da.x=r.x,ua.y=ha.y=r.y,fa.x=ha.x=r.x+r.width,fa.y=da.y=r.y+r.height,ua.transform(n),ha.transform(n),fa.transform(n),da.transform(n),e.x=js(ua.x,fa.x,da.x,ha.x),e.y=js(ua.y,fa.y,da.y,ha.y);var l=Js(ua.x,fa.x,da.x,ha.x),c=Js(ua.y,fa.y,da.y,ha.y);e.width=l-e.x,e.height=c-e.y},t})(),Av={};function ar(t,e){e=e||sa;var r=Av[e];r||(r=Av[e]=new so(500));var n=r.get(t);return n==null&&(n=ri.measureText(t,e).width,r.put(t,n)),n}function Dv(t,e,r,n){var a=ar(t,e),i=Wu(e),o=uo(0,a,r),s=oi(0,i,n),l=new Ge(o,s,a,i);return l}function $u(t,e,r,n){var a=((t||"")+"").split(`
6
- `),i=a.length;if(i===1)return Dv(a[0],e,r,n);for(var o=new Ge(0,0,0,0),s=0;s<a.length;s++){var l=Dv(a[s],e,r,n);s===0?o.copy(l):o.union(l)}return o}function uo(t,e,r){return r==="right"?t-=e:r==="center"&&(t-=e/2),t}function oi(t,e,r){return r==="middle"?t-=e/2:r==="bottom"&&(t-=e),t}function Wu(t){return ar("国",t)}function Pn(t,e){return typeof t=="string"?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t}function Qs(t,e,r){var n=e.position||"inside",a=e.distance!=null?e.distance:5,i=r.height,o=r.width,s=i/2,l=r.x,c=r.y,u="left",f="top";if(n instanceof Array)l+=Pn(n[0],r.width),c+=Pn(n[1],r.height),u=null,f=null;else switch(n){case"left":l-=a,c+=s,u="right",f="middle";break;case"right":l+=a+o,c+=s,f="middle";break;case"top":l+=o/2,c-=a,u="center",f="bottom";break;case"bottom":l+=o/2,c+=i+a,u="center";break;case"inside":l+=o/2,c+=s,u="center",f="middle";break;case"insideLeft":l+=a,c+=s,f="middle";break;case"insideRight":l+=o-a,c+=s,u="right",f="middle";break;case"insideTop":l+=o/2,c+=a,u="center";break;case"insideBottom":l+=o/2,c+=i-a,u="center",f="bottom";break;case"insideTopLeft":l+=a,c+=a;break;case"insideTopRight":l+=o-a,c+=a,u="right";break;case"insideBottomLeft":l+=a,c+=i-a,f="bottom";break;case"insideBottomRight":l+=o-a,c+=i-a,u="right",f="bottom";break}return t=t||{},t.x=l,t.y=c,t.align=u,t.verticalAlign=f,t}var qu=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function aS(t,e,r,n,a,i){if(!r){t.text="",t.isTruncated=!1;return}var o=(e+"").split(`
7
- `);i=Iv(r,n,a,i);for(var s=!1,l={},c=0,u=o.length;c<u;c++)Lv(l,o[c],i),o[c]=l.textLine,s=s||l.isTruncated;t.text=o.join(`
8
- `),t.isTruncated=s}function Iv(t,e,r,n){n=n||{};var a=q({},n);a.font=e,r=Pe(r,"..."),a.maxIterations=Pe(n.maxIterations,2);var i=a.minChar=Pe(n.minChar,0);a.cnCharWidth=ar("国",e);var o=a.ascCharWidth=ar("a",e);a.placeholder=Pe(n.placeholder,"");for(var s=t=Math.max(0,t-1),l=0;l<i&&s>=o;l++)s-=o;var c=ar(r,e);return c>s&&(r="",c=0),s=t-c,a.ellipsis=r,a.ellipsisWidth=c,a.contentWidth=s,a.containerWidth=t,a}function Lv(t,e,r){var n=r.containerWidth,a=r.font,i=r.contentWidth;if(!n){t.textLine="",t.isTruncated=!1;return}var o=ar(e,a);if(o<=n){t.textLine=e,t.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=r.maxIterations){e+=r.ellipsis;break}var l=s===0?iS(e,i,r.ascCharWidth,r.cnCharWidth):o>0?Math.floor(e.length*i/o):0;e=e.substr(0,l),o=ar(e,a)}e===""&&(e=r.placeholder),t.textLine=e,t.isTruncated=!0}function iS(t,e,r,n){for(var a=0,i=0,o=t.length;i<o&&a<e;i++){var s=t.charCodeAt(i);a+=0<=s&&s<=127?r:n}return i}function oS(t,e){t!=null&&(t+="");var r=e.overflow,n=e.padding,a=e.font,i=r==="truncate",o=Wu(a),s=Pe(e.lineHeight,o),l=!!e.backgroundColor,c=e.lineOverflow==="truncate",u=!1,f=e.width,h;f!=null&&(r==="break"||r==="breakAll")?h=t?Rv(t,e.font,f,r==="breakAll",0).lines:[]:h=t?t.split(`
9
- `):[];var d=h.length*s,p=Pe(e.height,d);if(d>p&&c){var m=Math.floor(p/s);u=u||h.length>m,h=h.slice(0,m)}if(t&&i&&f!=null)for(var g=Iv(f,a,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),v={},y=0;y<h.length;y++)Lv(v,h[y],g),h[y]=v.textLine,u=u||v.isTruncated;for(var b=p,x=0,y=0;y<h.length;y++)x=Math.max(ar(h[y],a),x);f==null&&(f=x);var w=x;return n&&(b+=n[0]+n[2],w+=n[1]+n[3],f+=n[1]+n[3]),l&&(w=f),{lines:h,height:p,outerWidth:w,outerHeight:b,lineHeight:s,calculatedLineHeight:o,contentWidth:x,contentHeight:d,width:f,isTruncated:u}}var sS=(function(){function t(){}return t})(),Pv=(function(){function t(e){this.tokens=[],e&&(this.tokens=e)}return t})(),lS=(function(){function t(){this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.outerWidth=0,this.outerHeight=0,this.lines=[],this.isTruncated=!1}return t})();function cS(t,e){var r=new lS;if(t!=null&&(t+=""),!t)return r;for(var n=e.width,a=e.height,i=e.overflow,o=(i==="break"||i==="breakAll")&&n!=null?{width:n,accumWidth:0,breakAll:i==="breakAll"}:null,s=qu.lastIndex=0,l;(l=qu.exec(t))!=null;){var c=l.index;c>s&&Yu(r,t.substring(s,c),e,o),Yu(r,l[2],e,o,l[1]),s=qu.lastIndex}s<t.length&&Yu(r,t.substring(s,t.length),e,o);var u=[],f=0,h=0,d=e.padding,p=i==="truncate",m=e.lineOverflow==="truncate",g={};function v(H,Z,re){H.width=Z,H.lineHeight=re,f+=re,h=Math.max(h,Z)}e:for(var y=0;y<r.lines.length;y++){for(var b=r.lines[y],x=0,w=0,S=0;S<b.tokens.length;S++){var k=b.tokens[S],C=k.styleName&&e.rich[k.styleName]||{},A=k.textPadding=C.padding,M=A?A[1]+A[3]:0,T=k.font=C.font||e.font;k.contentHeight=Wu(T);var D=Pe(C.height,k.contentHeight);if(k.innerHeight=D,A&&(D+=A[0]+A[2]),k.height=D,k.lineHeight=Ys(C.lineHeight,e.lineHeight,D),k.align=C&&C.align||e.align,k.verticalAlign=C&&C.verticalAlign||"middle",m&&a!=null&&f+k.lineHeight>a){var L=r.lines.length;S>0?(b.tokens=b.tokens.slice(0,S),v(b,w,x),r.lines=r.lines.slice(0,y+1)):r.lines=r.lines.slice(0,y),r.isTruncated=r.isTruncated||r.lines.length<L;break e}var R=C.width,O=R==null||R==="auto";if(typeof R=="string"&&R.charAt(R.length-1)==="%")k.percentWidth=R,u.push(k),k.contentWidth=ar(k.text,T);else{if(O){var B=C.backgroundColor,j=B&&B.image;j&&(j=tS(j),Ks(j)&&(k.width=Math.max(k.width,j.width*D/j.height)))}var P=p&&n!=null?n-w:null;P!=null&&P<k.width?!O||P<M?(k.text="",k.width=k.contentWidth=0):(aS(g,k.text,P-M,T,e.ellipsis,{minChar:e.truncateMinChar}),k.text=g.text,r.isTruncated=r.isTruncated||g.isTruncated,k.width=k.contentWidth=ar(k.text,T)):k.contentWidth=ar(k.text,T)}k.width+=M,w+=k.width,C&&(x=Math.max(x,k.lineHeight))}v(b,w,x)}r.outerWidth=r.width=Pe(n,h),r.outerHeight=r.height=Pe(a,f),r.contentHeight=f,r.contentWidth=h,d&&(r.outerWidth+=d[1]+d[3],r.outerHeight+=d[0]+d[2]);for(var y=0;y<u.length;y++){var k=u[y],V=k.percentWidth;k.width=parseInt(V,10)/100*r.width}return r}function Yu(t,e,r,n,a){var i=e==="",o=a&&r.rich[a]||{},s=t.lines,l=o.font||r.font,c=!1,u,f;if(n){var h=o.padding,d=h?h[1]+h[3]:0;if(o.width!=null&&o.width!=="auto"){var p=Pn(o.width,n.width)+d;s.length>0&&p+n.accumWidth>n.width&&(u=e.split(`
10
- `),c=!0),n.accumWidth=p}else{var m=Rv(e,l,n.width,n.breakAll,n.accumWidth);n.accumWidth=m.accumWidth+d,f=m.linesWidths,u=m.lines}}else u=e.split(`
11
- `);for(var g=0;g<u.length;g++){var v=u[g],y=new sS;if(y.styleName=a,y.text=v,y.isLineHolder=!v&&!i,typeof o.width=="number"?y.width=o.width:y.width=f?f[g]:ar(v,l),!g&&!c){var b=(s[s.length-1]||(s[0]=new Pv)).tokens,x=b.length;x===1&&b[0].isLineHolder?b[0]=y:(v||!x||i)&&b.push(y)}else s.push(new Pv([y]))}}function uS(t){var e=t.charCodeAt(0);return e>=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}var fS=ni(",&?/;] ".split(""),function(t,e){return t[e]=!0,t},{});function dS(t){return uS(t)?!!fS[t]:!0}function Rv(t,e,r,n,a){for(var i=[],o=[],s="",l="",c=0,u=0,f=0;f<t.length;f++){var h=t.charAt(f);if(h===`
12
- `){l&&(s+=l,u+=c),i.push(s),o.push(u),s="",l="",c=0,u=0;continue}var d=ar(h,e),p=n?!1:!dS(h);if(i.length?u+d>r:a+u+d>r){u?(s||l)&&(p?(s||(s=l,l="",c=0,u=c),i.push(s),o.push(u-c),l+=h,c+=d,s="",u=c):(l&&(s+=l,l="",c=0),i.push(s),o.push(u),s=h,u=d)):p?(i.push(l),o.push(c),l=h,c=d):(i.push(h),o.push(d));continue}u+=d,p?(l+=h,c+=d):(l&&(s+=l,l="",c=0),s+=h)}return!i.length&&!s&&(s=t,l="",c=0),l&&(s+=l),s&&(i.push(s),o.push(u)),i.length===1&&(u+=a),{accumWidth:u,lines:i,linesWidths:o}}function si(t,e){return t==null&&(t=0),e==null&&(e=0),[t,e]}function hS(t){return[t[0],t[1]]}function Ev(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function pS(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function vS(t){return Math.sqrt(gS(t))}function gS(t){return t[0]*t[0]+t[1]*t[1]}function Xu(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function mS(t,e){var r=vS(e);return r===0?(t[0]=0,t[1]=0):(t[0]=e[0]/r,t[1]=e[1]/r),t}function Zu(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var yS=Zu;function _S(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}var li=_S;function dr(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[2]*a+r[4],t[1]=r[1]*n+r[3]*a+r[5],t}function ci(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function ui(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}var Ov=Hu,Nv=5e-5;function pa(t){return t>Nv||t<-Nv}var va=[],fi=[],Ku=ai(),ju=Math.abs,Ju=(function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},t.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},t.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},t.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},t.prototype.needLocalTransform=function(){return pa(this.rotation)||pa(this.x)||pa(this.y)||pa(this.scaleX-1)||pa(this.scaleY-1)||pa(this.skewX)||pa(this.skewY)},t.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,r=this.needLocalTransform(),n=this.transform;if(!(r||e)){n&&(Ov(n),this.invTransform=null);return}n=n||ai(),r?this.getLocalTransform(n):Ov(n),e&&(r?ii(n,e,n):rS(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n)},t.prototype._resolveGlobalScaleRatio=function(e){var r=this.globalScaleRatio;if(r!=null&&r!==1){this.getGlobalScale(va);var n=va[0]<0?-1:1,a=va[1]<0?-1:1,i=((va[0]-n)*r+n)/va[0]||0,o=((va[1]-a)*r+a)/va[1]||0;e[0]*=i,e[1]*=i,e[2]*=o,e[3]*=o}this.invTransform=this.invTransform||ai(),Gu(this.invTransform,e)},t.prototype.getComputedTransform=function(){for(var e=this,r=[];e;)r.push(e),e=e.parent;for(;e=r.pop();)e.updateTransform();return this.transform},t.prototype.setLocalTransform=function(e){if(e){var r=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],a=Math.atan2(e[1],e[0]),i=Math.PI/2+a-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(i),r=Math.sqrt(r),this.skewX=i,this.skewY=0,this.rotation=-a,this.x=+e[4],this.y=+e[5],this.scaleX=r,this.scaleY=n,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,r=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||ai(),ii(fi,e.invTransform,r),r=fi);var n=this.originX,a=this.originY;(n||a)&&(Ku[4]=n,Ku[5]=a,ii(fi,r,Ku),fi[4]-=n,fi[5]-=a,r=fi),this.setLocalTransform(r)}},t.prototype.getGlobalScale=function(e){var r=this.transform;return e=e||[],r?(e[0]=Math.sqrt(r[0]*r[0]+r[1]*r[1]),e[1]=Math.sqrt(r[2]*r[2]+r[3]*r[3]),r[0]<0&&(e[0]=-e[0]),r[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},t.prototype.transformCoordToLocal=function(e,r){var n=[e,r],a=this.invTransform;return a&&dr(n,n,a),n},t.prototype.transformCoordToGlobal=function(e,r){var n=[e,r],a=this.transform;return a&&dr(n,n,a),n},t.prototype.getLineScale=function(){var e=this.transform;return e&&ju(e[0]-1)>1e-10&&ju(e[3]-1)>1e-10?Math.sqrt(ju(e[0]*e[3]-e[2]*e[1])):1},t.prototype.copyTransform=function(e){bS(this,e)},t.getLocalTransform=function(e,r){r=r||[];var n=e.originX||0,a=e.originY||0,i=e.scaleX,o=e.scaleY,s=e.anchorX,l=e.anchorY,c=e.rotation||0,u=e.x,f=e.y,h=e.skewX?Math.tan(e.skewX):0,d=e.skewY?Math.tan(-e.skewY):0;if(n||a||s||l){var p=n+s,m=a+l;r[4]=-p*i-h*m*o,r[5]=-m*o-d*p*i}else r[4]=r[5]=0;return r[0]=i,r[3]=o,r[1]=d*i,r[2]=h*o,c&&Uu(r,r,c),r[4]+=n+u,r[5]+=a+f,r},t.initDefaultProps=(function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0})(),t})(),fo=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function bS(t,e){for(var r=0;r<fo.length;r++){var n=fo[r];t[n]=e[n]}}var ho={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return .5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return t===0?0:Math.pow(1024,t-1)},exponentialOut:function(t){return t===1?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,r=.1,n=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=n/4):e=n*Math.asin(1/r)/(2*Math.PI),-(r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)))},elasticOut:function(t){var e,r=.1,n=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=n/4):e=n*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},elasticInOut:function(t){var e,r=.1,n=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=n/4):e=n*Math.asin(1/r)/(2*Math.PI),(t*=2)<1?-.5*(r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)):r*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-ho.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?ho.bounceIn(t*2)*.5:ho.bounceOut(t*2-1)*.5+.5}},el=Math.pow,Rn=Math.sqrt,tl=1e-8,Bv=1e-4,zv=Rn(3),rl=1/3,Wr=si(),hr=si(),di=si();function En(t){return t>-tl&&t<tl}function Fv(t){return t>tl||t<-tl}function wt(t,e,r,n,a){var i=1-a;return i*i*(i*t+3*a*e)+a*a*(a*n+3*i*r)}function Hv(t,e,r,n,a){var i=1-a;return 3*(((e-t)*i+2*(r-e)*a)*i+(n-r)*a*a)}function nl(t,e,r,n,a,i){var o=n+3*(e-r)-t,s=3*(r-e*2+t),l=3*(e-t),c=t-a,u=s*s-3*o*l,f=s*l-9*o*c,h=l*l-3*s*c,d=0;if(En(u)&&En(f))if(En(s))i[0]=0;else{var p=-l/s;p>=0&&p<=1&&(i[d++]=p)}else{var m=f*f-4*u*h;if(En(m)){var g=f/u,p=-s/o+g,v=-g/2;p>=0&&p<=1&&(i[d++]=p),v>=0&&v<=1&&(i[d++]=v)}else if(m>0){var y=Rn(m),b=u*s+1.5*o*(-f+y),x=u*s+1.5*o*(-f-y);b<0?b=-el(-b,rl):b=el(b,rl),x<0?x=-el(-x,rl):x=el(x,rl);var p=(-s-(b+x))/(3*o);p>=0&&p<=1&&(i[d++]=p)}else{var w=(2*u*s-3*o*f)/(2*Rn(u*u*u)),S=Math.acos(w)/3,k=Rn(u),C=Math.cos(S),p=(-s-2*k*C)/(3*o),v=(-s+k*(C+zv*Math.sin(S)))/(3*o),A=(-s+k*(C-zv*Math.sin(S)))/(3*o);p>=0&&p<=1&&(i[d++]=p),v>=0&&v<=1&&(i[d++]=v),A>=0&&A<=1&&(i[d++]=A)}}return d}function Vv(t,e,r,n,a){var i=6*r-12*e+6*t,o=9*e+3*n-3*t-9*r,s=3*e-3*t,l=0;if(En(o)){if(Fv(i)){var c=-s/i;c>=0&&c<=1&&(a[l++]=c)}}else{var u=i*i-4*o*s;if(En(u))a[0]=-i/(2*o);else if(u>0){var f=Rn(u),c=(-i+f)/(2*o),h=(-i-f)/(2*o);c>=0&&c<=1&&(a[l++]=c),h>=0&&h<=1&&(a[l++]=h)}}return l}function al(t,e,r,n,a,i){var o=(e-t)*a+t,s=(r-e)*a+e,l=(n-r)*a+r,c=(s-o)*a+o,u=(l-s)*a+s,f=(u-c)*a+c;i[0]=t,i[1]=o,i[2]=c,i[3]=f,i[4]=f,i[5]=u,i[6]=l,i[7]=n}function xS(t,e,r,n,a,i,o,s,l,c,u){var f,h=.005,d=1/0,p,m,g,v;Wr[0]=l,Wr[1]=c;for(var y=0;y<1;y+=.05)hr[0]=wt(t,r,a,o,y),hr[1]=wt(e,n,i,s,y),g=li(Wr,hr),g<d&&(f=y,d=g);d=1/0;for(var b=0;b<32&&!(h<Bv);b++)p=f-h,m=f+h,hr[0]=wt(t,r,a,o,p),hr[1]=wt(e,n,i,s,p),g=li(hr,Wr),p>=0&&g<d?(f=p,d=g):(di[0]=wt(t,r,a,o,m),di[1]=wt(e,n,i,s,m),v=li(di,Wr),m<=1&&v<d?(f=m,d=v):h*=.5);return Rn(d)}function wS(t,e,r,n,a,i,o,s,l){for(var c=t,u=e,f=0,h=1/l,d=1;d<=l;d++){var p=d*h,m=wt(t,r,a,o,p),g=wt(e,n,i,s,p),v=m-c,y=g-u;f+=Math.sqrt(v*v+y*y),c=m,u=g}return f}function Gt(t,e,r,n){var a=1-n;return a*(a*t+2*n*e)+n*n*r}function Uv(t,e,r,n){return 2*((1-n)*(e-t)+n*(r-e))}function SS(t,e,r,n,a){var i=t-2*e+r,o=2*(e-t),s=t-n,l=0;if(En(i)){if(Fv(o)){var c=-s/o;c>=0&&c<=1&&(a[l++]=c)}}else{var u=o*o-4*i*s;if(En(u)){var c=-o/(2*i);c>=0&&c<=1&&(a[l++]=c)}else if(u>0){var f=Rn(u),c=(-o+f)/(2*i),h=(-o-f)/(2*i);c>=0&&c<=1&&(a[l++]=c),h>=0&&h<=1&&(a[l++]=h)}}return l}function Gv(t,e,r){var n=t+r-2*e;return n===0?.5:(t-e)/n}function il(t,e,r,n,a){var i=(e-t)*n+t,o=(r-e)*n+e,s=(o-i)*n+i;a[0]=t,a[1]=i,a[2]=s,a[3]=s,a[4]=o,a[5]=r}function kS(t,e,r,n,a,i,o,s,l){var c,u=.005,f=1/0;Wr[0]=o,Wr[1]=s;for(var h=0;h<1;h+=.05){hr[0]=Gt(t,r,a,h),hr[1]=Gt(e,n,i,h);var d=li(Wr,hr);d<f&&(c=h,f=d)}f=1/0;for(var p=0;p<32&&!(u<Bv);p++){var m=c-u,g=c+u;hr[0]=Gt(t,r,a,m),hr[1]=Gt(e,n,i,m);var d=li(hr,Wr);if(m>=0&&d<f)c=m,f=d;else{di[0]=Gt(t,r,a,g),di[1]=Gt(e,n,i,g);var v=li(di,Wr);g<=1&&v<f?(c=g,f=v):u*=.5}}return Rn(f)}function TS(t,e,r,n,a,i,o){for(var s=t,l=e,c=0,u=1/o,f=1;f<=o;f++){var h=f*u,d=Gt(t,r,a,h),p=Gt(e,n,i,h),m=d-s,g=p-l;c+=Math.sqrt(m*m+g*g),s=d,l=p}return c}var CS=/cubic-bezier\(([0-9,\.e ]+)\)/;function $v(t){var e=t&&CS.exec(t);if(e){var r=e[1].split(","),n=+Gr(r[0]),a=+Gr(r[1]),i=+Gr(r[2]),o=+Gr(r[3]);if(isNaN(n+a+i+o))return;var s=[];return function(l){return l<=0?0:l>=1?1:nl(0,n,i,1,l,s)&&wt(0,a,o,1,s[0])}}}var MS=(function(){function t(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Et,this.ondestroy=e.ondestroy||Et,this.onrestart=e.onrestart||Et,e.easing&&this.setEasing(e.easing)}return t.prototype.step=function(e,r){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),this._paused){this._pausedTime+=r;return}var n=this._life,a=e-this._startTime-this._pausedTime,i=a/n;i<0&&(i=0),i=Math.min(i,1);var o=this.easingFunc,s=o?o(i):i;if(this.onframe(s),i===1)if(this.loop){var l=a%n;this._startTime=e-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(e){this.easing=e,this.easingFunc=ke(e)?e:ho[e]||$v(e)},t})(),Wv={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function On(t){return t=Math.round(t),t<0?0:t>255?255:t}function Qu(t){return t<0?0:t>1?1:t}function ef(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?On(parseFloat(e)/100*255):On(parseInt(e,10))}function po(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?Qu(parseFloat(e)/100):Qu(parseFloat(e))}function tf(t,e,r){return r<0?r+=1:r>1&&(r-=1),r*6<1?t+(e-t)*r*6:r*2<1?e:r*3<2?t+(e-t)*(.6666666666666666-r)*6:t}function ol(t,e,r){return t+(e-t)*r}function pr(t,e,r,n,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t}function rf(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var qv=new so(20),sl=null;function hi(t,e){sl&&rf(sl,e),sl=qv.put(t,sl||e.slice())}function hn(t,e){if(t){e=e||[];var r=qv.get(t);if(r)return rf(e,r);t=t+"";var n=t.replace(/ /g,"").toLowerCase();if(n in Wv)return rf(e,Wv[n]),hi(t,e),e;var a=n.length;if(n.charAt(0)==="#"){if(a===4||a===5){var i=parseInt(n.slice(1,4),16);if(!(i>=0&&i<=4095)){pr(e,0,0,0,1);return}return pr(e,(i&3840)>>4|(i&3840)>>8,i&240|(i&240)>>4,i&15|(i&15)<<4,a===5?parseInt(n.slice(4),16)/15:1),hi(t,e),e}else if(a===7||a===9){var i=parseInt(n.slice(1,7),16);if(!(i>=0&&i<=16777215)){pr(e,0,0,0,1);return}return pr(e,(i&16711680)>>16,(i&65280)>>8,i&255,a===9?parseInt(n.slice(7),16)/255:1),hi(t,e),e}return}var o=n.indexOf("("),s=n.indexOf(")");if(o!==-1&&s+1===a){var l=n.substr(0,o),c=n.substr(o+1,s-(o+1)).split(","),u=1;switch(l){case"rgba":if(c.length!==4)return c.length===3?pr(e,+c[0],+c[1],+c[2],1):pr(e,0,0,0,1);u=po(c.pop());case"rgb":if(c.length>=3)return pr(e,ef(c[0]),ef(c[1]),ef(c[2]),c.length===3?u:po(c[3])),hi(t,e),e;pr(e,0,0,0,1);return;case"hsla":if(c.length!==4){pr(e,0,0,0,1);return}return c[3]=po(c[3]),Yv(c,e),hi(t,e),e;case"hsl":if(c.length!==3){pr(e,0,0,0,1);return}return Yv(c,e),hi(t,e),e;default:return}}pr(e,0,0,0,1)}}function Yv(t,e){var r=(parseFloat(t[0])%360+360)%360/360,n=po(t[1]),a=po(t[2]),i=a<=.5?a*(n+1):a+n-a*n,o=a*2-i;return e=e||[],pr(e,On(tf(o,i,r+.3333333333333333)*255),On(tf(o,i,r)*255),On(tf(o,i,r-.3333333333333333)*255),1),t.length===4&&(e[3]=t[3]),e}function Xv(t,e){var r=hn(t);if(r){for(var n=0;n<3;n++)r[n]=r[n]*(1-e)|0,r[n]>255?r[n]=255:r[n]<0&&(r[n]=0);return ll(r,r.length===4?"rgba":"rgb")}}function AS(t,e,r){if(!(!(e&&e.length)||!(t>=0&&t<=1))){var n=t*(e.length-1),a=Math.floor(n),i=Math.ceil(n),o=hn(e[a]),s=hn(e[i]),l=n-a,c=ll([On(ol(o[0],s[0],l)),On(ol(o[1],s[1],l)),On(ol(o[2],s[2],l)),Qu(ol(o[3],s[3],l))],"rgba");return r?{color:c,leftIndex:a,rightIndex:i,value:n}:c}}function ll(t,e){if(!(!t||!t.length)){var r=t[0]+","+t[1]+","+t[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(r+=","+t[3]),e+"("+r+")"}}function cl(t,e){var r=hn(t);return r?(.299*r[0]+.587*r[1]+.114*r[2])*r[3]/255+(1-r[3])*e:0}var Zv=new so(100);function Kv(t){if(ae(t)){var e=Zv.get(t);return e||(e=Xv(t,-.1),Zv.put(t,e)),e}else if(Ws(t)){var r=q({},t);return r.colorStops=he(t.colorStops,function(n){return{offset:n.offset,color:Xv(n.color,-.1)}}),r}return t}function DS(t){return t.type==="linear"}function IS(t){return t.type==="radial"}(function(){return _e.hasGlobalWindow&&ke(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:typeof Buffer<"u"?function(t){return Buffer.from(t).toString("base64")}:function(t){return null}})();var nf=Array.prototype.slice;function pn(t,e,r){return(e-t)*r+t}function af(t,e,r,n){for(var a=e.length,i=0;i<a;i++)t[i]=pn(e[i],r[i],n);return t}function LS(t,e,r,n){for(var a=e.length,i=a&&e[0].length,o=0;o<a;o++){t[o]||(t[o]=[]);for(var s=0;s<i;s++)t[o][s]=pn(e[o][s],r[o][s],n)}return t}function ul(t,e,r,n){for(var a=e.length,i=0;i<a;i++)t[i]=e[i]+r[i]*n;return t}function jv(t,e,r,n){for(var a=e.length,i=a&&e[0].length,o=0;o<a;o++){t[o]||(t[o]=[]);for(var s=0;s<i;s++)t[o][s]=e[o][s]+r[o][s]*n}return t}function PS(t,e){for(var r=t.length,n=e.length,a=r>n?e:t,i=Math.min(r,n),o=a[i-1]||{color:[0,0,0,0],offset:0},s=i;s<Math.max(r,n);s++)a.push({offset:o.offset,color:o.color.slice()})}function RS(t,e,r){var n=t,a=e;if(!(!n.push||!a.push)){var i=n.length,o=a.length;if(i!==o){var s=i>o;if(s)n.length=o;else for(var l=i;l<o;l++)n.push(r===1?a[l]:nf.call(a[l]))}for(var c=n[0]&&n[0].length,l=0;l<n.length;l++)if(r===1)isNaN(n[l])&&(n[l]=a[l]);else for(var u=0;u<c;u++)isNaN(n[l][u])&&(n[l][u]=a[l][u])}}function fl(t){if(Vt(t)){var e=t.length;if(Vt(t[0])){for(var r=[],n=0;n<e;n++)r.push(nf.call(t[n]));return r}return nf.call(t)}return t}function dl(t){return t[0]=Math.floor(t[0])||0,t[1]=Math.floor(t[1])||0,t[2]=Math.floor(t[2])||0,t[3]=t[3]==null?1:t[3],"rgba("+t.join(",")+")"}function ES(t){return Vt(t&&t[0])?2:1}var hl=0,pl=1,Jv=2,vo=3,of=4,sf=5,Qv=6;function eg(t){return t===of||t===sf}function vl(t){return t===pl||t===Jv}var go=[0,0,0,0],OS=(function(){function t(e){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=e}return t.prototype.isFinished=function(){return this._finished},t.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},t.prototype.needsAnimate=function(){return this.keyframes.length>=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(e,r,n){this._needsSort=!0;var a=this.keyframes,i=a.length,o=!1,s=Qv,l=r;if(Vt(r)){var c=ES(r);s=c,(c===1&&!et(r[0])||c===2&&!et(r[0][0]))&&(o=!0)}else if(et(r)&&!qs(r))s=hl;else if(ae(r))if(!isNaN(+r))s=hl;else{var u=hn(r);u&&(l=u,s=vo)}else if(Ws(r)){var f=q({},l);f.colorStops=he(r.colorStops,function(d){return{offset:d.offset,color:hn(d.color)}}),DS(r)?s=of:IS(r)&&(s=sf),l=f}i===0?this.valType=s:(s!==this.valType||s===Qv)&&(o=!0),this.discrete=this.discrete||o;var h={time:e,value:l,rawValue:r,percent:0};return n&&(h.easing=n,h.easingFunc=ke(n)?n:ho[n]||$v(n)),a.push(h),h},t.prototype.prepare=function(e,r){var n=this.keyframes;this._needsSort&&n.sort(function(m,g){return m.time-g.time});for(var a=this.valType,i=n.length,o=n[i-1],s=this.discrete,l=vl(a),c=eg(a),u=0;u<i;u++){var f=n[u],h=f.value,d=o.value;f.percent=f.time/e,s||(l&&u!==i-1?RS(h,d,a):c&&PS(h.colorStops,d.colorStops))}if(!s&&a!==sf&&r&&this.needsAnimate()&&r.needsAnimate()&&a===r.valType&&!r._finished){this._additiveTrack=r;for(var p=n[0].value,u=0;u<i;u++)a===hl?n[u].additiveValue=n[u].value-p:a===vo?n[u].additiveValue=ul([],n[u].value,p,-1):vl(a)&&(n[u].additiveValue=a===pl?ul([],n[u].value,p,-1):jv([],n[u].value,p,-1))}},t.prototype.step=function(e,r){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var n=this._additiveTrack!=null,a=n?"additiveValue":"value",i=this.valType,o=this.keyframes,s=o.length,l=this.propName,c=i===vo,u,f=this._lastFr,h=Math.min,d,p;if(s===1)d=p=o[0];else{if(r<0)u=0;else if(r<this._lastFrP){var m=h(f+1,s-1);for(u=m;u>=0&&!(o[u].percent<=r);u--);u=h(u,s-2)}else{for(u=f;u<s&&!(o[u].percent>r);u++);u=h(u-1,s-2)}p=o[u+1],d=o[u]}if(d&&p){this._lastFr=u,this._lastFrP=r;var g=p.percent-d.percent,v=g===0?1:h((r-d.percent)/g,1);p.easingFunc&&(v=p.easingFunc(v));var y=n?this._additiveValue:c?go:e[l];if((vl(i)||c)&&!y&&(y=this._additiveValue=[]),this.discrete)e[l]=v<1?d.rawValue:p.rawValue;else if(vl(i))i===pl?af(y,d[a],p[a],v):LS(y,d[a],p[a],v);else if(eg(i)){var b=d[a],x=p[a],w=i===of;e[l]={type:w?"linear":"radial",x:pn(b.x,x.x,v),y:pn(b.y,x.y,v),colorStops:he(b.colorStops,function(k,C){var A=x.colorStops[C];return{offset:pn(k.offset,A.offset,v),color:dl(af([],k.color,A.color,v))}}),global:x.global},w?(e[l].x2=pn(b.x2,x.x2,v),e[l].y2=pn(b.y2,x.y2,v)):e[l].r=pn(b.r,x.r,v)}else if(c)af(y,d[a],p[a],v),n||(e[l]=dl(y));else{var S=pn(d[a],p[a],v);n?this._additiveValue=S:e[l]=S}n&&this._addToTarget(e)}}},t.prototype._addToTarget=function(e){var r=this.valType,n=this.propName,a=this._additiveValue;r===hl?e[n]=e[n]+a:r===vo?(hn(e[n],go),ul(go,go,a,1),e[n]=dl(go)):r===pl?ul(e[n],e[n],a,1):r===Jv&&jv(e[n],e[n],a,1)},t})(),lf=(function(){function t(e,r,n,a){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=r,r&&a){Eu("Can' use additive animation on looped animation.");return}this._additiveAnimators=a,this._allowDiscrete=n}return t.prototype.getMaxTime=function(){return this._maxTime},t.prototype.getDelay=function(){return this._delay},t.prototype.getLoop=function(){return this._loop},t.prototype.getTarget=function(){return this._target},t.prototype.changeTarget=function(e){this._target=e},t.prototype.when=function(e,r,n){return this.whenWithKeys(e,r,at(r),n)},t.prototype.whenWithKeys=function(e,r,n,a){for(var i=this._tracks,o=0;o<n.length;o++){var s=n[o],l=i[s];if(!l){l=i[s]=new OS(s);var c=void 0,u=this._getAdditiveTrack(s);if(u){var f=u.keyframes,h=f[f.length-1];c=h&&h.value,u.valType===vo&&c&&(c=dl(c))}else c=this._target[s];if(c==null)continue;e>0&&l.addKeyframe(0,fl(c),a),this._trackKeys.push(s)}l.addKeyframe(e,fl(r[s]),a)}return this._maxTime=Math.max(this._maxTime,e),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var r=e.length,n=0;n<r;n++)e[n].call(this)},t.prototype._abortedCallback=function(){this._setTracksFinished();var e=this.animation,r=this._abortedCbs;if(e&&e.removeClip(this._clip),this._clip=null,r)for(var n=0;n<r.length;n++)r[n].call(this)},t.prototype._setTracksFinished=function(){for(var e=this._tracks,r=this._trackKeys,n=0;n<r.length;n++)e[r[n]].setFinished()},t.prototype._getAdditiveTrack=function(e){var r,n=this._additiveAnimators;if(n)for(var a=0;a<n.length;a++){var i=n[a].getTrack(e);i&&(r=i)}return r},t.prototype.start=function(e){if(!(this._started>0)){this._started=1;for(var r=this,n=[],a=this._maxTime||0,i=0;i<this._trackKeys.length;i++){var o=this._trackKeys[i],s=this._tracks[o],l=this._getAdditiveTrack(o),c=s.keyframes,u=c.length;if(s.prepare(a,l),s.needsAnimate())if(!this._allowDiscrete&&s.discrete){var f=c[u-1];f&&(r._target[s.propName]=f.rawValue),s.setFinished()}else n.push(s)}if(n.length||this._force){var h=new MS({life:a,loop:this._loop,delay:this._delay||0,onframe:function(d){r._started=2;var p=r._additiveAnimators;if(p){for(var m=!1,g=0;g<p.length;g++)if(p[g]._clip){m=!0;break}m||(r._additiveAnimators=null)}for(var g=0;g<n.length;g++)n[g].step(r._target,d);var v=r._onframeCbs;if(v)for(var g=0;g<v.length;g++)v[g](r._target,d)},ondestroy:function(){r._doneCallback()}});this._clip=h,this.animation&&this.animation.addClip(h),e&&h.setEasing(e)}else this._doneCallback();return this}},t.prototype.stop=function(e){if(this._clip){var r=this._clip;e&&r.onframe(1),this._abortedCallback()}},t.prototype.delay=function(e){return this._delay=e,this},t.prototype.during=function(e){return e&&(this._onframeCbs||(this._onframeCbs=[]),this._onframeCbs.push(e)),this},t.prototype.done=function(e){return e&&(this._doneCbs||(this._doneCbs=[]),this._doneCbs.push(e)),this},t.prototype.aborted=function(e){return e&&(this._abortedCbs||(this._abortedCbs=[]),this._abortedCbs.push(e)),this},t.prototype.getClip=function(){return this._clip},t.prototype.getTrack=function(e){return this._tracks[e]},t.prototype.getTracks=function(){var e=this;return he(this._trackKeys,function(r){return e._tracks[r]})},t.prototype.stopTracks=function(e,r){if(!e.length||!this._clip)return!0;for(var n=this._tracks,a=this._trackKeys,i=0;i<e.length;i++){var o=n[e[i]];o&&!o.isFinished()&&(r?o.step(this._target,1):this._started===1&&o.step(this._target,0),o.setFinished())}for(var s=!0,i=0;i<a.length;i++)if(!n[a[i]].isFinished()){s=!1;break}return s&&this._abortedCallback(),s},t.prototype.saveTo=function(e,r,n){if(e){r=r||this._trackKeys;for(var a=0;a<r.length;a++){var i=r[a],o=this._tracks[i];if(!(!o||o.isFinished())){var s=o.keyframes,l=s[n?0:s.length-1];l&&(e[i]=fl(l.rawValue))}}}},t.prototype.__changeFinalValue=function(e,r){r=r||at(e);for(var n=0;n<r.length;n++){var a=r[n],i=this._tracks[a];if(i){var o=i.keyframes;if(o.length>1){var s=o.pop();i.addKeyframe(s.time,e[a]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},t})(),Ir=(function(){function t(e){e&&(this._$eventProcessor=e)}return t.prototype.on=function(e,r,n,a){this._$handlers||(this._$handlers={});var i=this._$handlers;if(typeof r=="function"&&(a=n,n=r,r=null),!n||!e)return this;var o=this._$eventProcessor;r!=null&&o&&o.normalizeQuery&&(r=o.normalizeQuery(r)),i[e]||(i[e]=[]);for(var s=0;s<i[e].length;s++)if(i[e][s].h===n)return this;var l={h:n,query:r,ctx:a||this,callAtLast:n.zrEventfulCallAtLast},c=i[e].length-1,u=i[e][c];return u&&u.callAtLast?i[e].splice(c,0,l):i[e].push(l),this},t.prototype.isSilent=function(e){var r=this._$handlers;return!r||!r[e]||!r[e].length},t.prototype.off=function(e,r){var n=this._$handlers;if(!n)return this;if(!e)return this._$handlers={},this;if(r){if(n[e]){for(var a=[],i=0,o=n[e].length;i<o;i++)n[e][i].h!==r&&a.push(n[e][i]);n[e]=a}n[e]&&n[e].length===0&&delete n[e]}else delete n[e];return this},t.prototype.trigger=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this._$handlers)return this;var a=this._$handlers[e],i=this._$eventProcessor;if(a)for(var o=r.length,s=a.length,l=0;l<s;l++){var c=a[l];if(!(i&&i.filter&&c.query!=null&&!i.filter(e,c.query)))switch(o){case 0:c.h.call(c.ctx);break;case 1:c.h.call(c.ctx,r[0]);break;case 2:c.h.call(c.ctx,r[0],r[1]);break;default:c.h.apply(c.ctx,r);break}}return i&&i.afterTrigger&&i.afterTrigger(e),this},t.prototype.triggerWithContext=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this._$handlers)return this;var a=this._$handlers[e],i=this._$eventProcessor;if(a)for(var o=r.length,s=r[o-1],l=a.length,c=0;c<l;c++){var u=a[c];if(!(i&&i.filter&&u.query!=null&&!i.filter(e,u.query)))switch(o){case 0:u.h.call(s);break;case 1:u.h.call(s,r[0]);break;case 2:u.h.call(s,r[0],r[1]);break;default:u.h.apply(s,r.slice(1,o-1));break}}return i&&i.afterTrigger&&i.afterTrigger(e),this},t})(),tg=1;_e.hasGlobalWindow&&(tg=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var gl=tg,cf=.4,uf="#333",ff="#ccc",NS="#eee",ir=1,mo=2,pi=4,df="__zr_normal__",hf=fo.concat(["ignore"]),BS=ni(fo,function(t,e){return t[e]=!0,t},{ignore:!1}),vi={},zS=new Ge(0,0,0,0),ml=(function(){function t(e){this.id=mv(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return t.prototype._init=function(e){this.attr(e)},t.prototype.drift=function(e,r,n){switch(this.draggable){case"horizontal":r=0;break;case"vertical":e=0;break}var a=this.transform;a||(a=this.transform=[1,0,0,1,0,0]),a[4]+=e,a[5]+=r,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(e){var r=this._textContent;if(r&&(!r.ignore||e)){this.textConfig||(this.textConfig={});var n=this.textConfig,a=n.local,i=r.innerTransformable,o=void 0,s=void 0,l=!1;i.parent=a?this:null;var c=!1;if(i.copyTransform(r),n.position!=null){var u=zS;n.layoutRect?u.copy(n.layoutRect):u.copy(this.getBoundingRect()),a||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(vi,n,u):Qs(vi,n,u),i.x=vi.x,i.y=vi.y,o=vi.align,s=vi.verticalAlign;var f=n.origin;if(f&&n.rotation!=null){var h=void 0,d=void 0;f==="center"?(h=u.width*.5,d=u.height*.5):(h=Pn(f[0],u.width),d=Pn(f[1],u.height)),c=!0,i.originX=-i.x+h+(a?0:u.x),i.originY=-i.y+d+(a?0:u.y)}}n.rotation!=null&&(i.rotation=n.rotation);var p=n.offset;p&&(i.x+=p[0],i.y+=p[1],c||(i.originX=-p[0],i.originY=-p[1]));var m=n.inside==null?typeof n.position=="string"&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),v=void 0,y=void 0,b=void 0;m&&this.canBeInsideText()?(v=n.insideFill,y=n.insideStroke,(v==null||v==="auto")&&(v=this.getInsideTextFill()),(y==null||y==="auto")&&(y=this.getInsideTextStroke(v),b=!0)):(v=n.outsideFill,y=n.outsideStroke,(v==null||v==="auto")&&(v=this.getOutsideFill()),(y==null||y==="auto")&&(y=this.getOutsideStroke(v),b=!0)),v=v||"#000",(v!==g.fill||y!==g.stroke||b!==g.autoStroke||o!==g.align||s!==g.verticalAlign)&&(l=!0,g.fill=v,g.stroke=y,g.autoStroke=b,g.align=o,g.verticalAlign=s,r.setDefaultTextStyle(g)),r.__dirty|=ir,l&&r.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(e){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?ff:uf},t.prototype.getOutsideStroke=function(e){var r=this.__zr&&this.__zr.getBackgroundColor(),n=typeof r=="string"&&hn(r);n||(n=[255,255,255,1]);for(var a=n[3],i=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*a+(i?0:255)*(1-a);return n[3]=1,ll(n,"rgba")},t.prototype.traverse=function(e,r){},t.prototype.attrKV=function(e,r){e==="textConfig"?this.setTextConfig(r):e==="textContent"?this.setTextContent(r):e==="clipPath"?this.setClipPath(r):e==="extra"?(this.extra=this.extra||{},q(this.extra,r)):this[e]=r},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(e,r){if(typeof e=="string")this.attrKV(e,r);else if(de(e))for(var n=e,a=at(n),i=0;i<a.length;i++){var o=a[i];this.attrKV(o,e[o])}return this.markRedraw(),this},t.prototype.saveCurrentToNormalState=function(e){this._innerSaveToNormal(e);for(var r=this._normalState,n=0;n<this.animators.length;n++){var a=this.animators[n],i=a.__fromStateTransition;if(!(a.getLoop()||i&&i!==df)){var o=a.targetName,s=o?r[o]:r;a.saveTo(s)}}},t.prototype._innerSaveToNormal=function(e){var r=this._normalState;r||(r=this._normalState={}),e.textConfig&&!r.textConfig&&(r.textConfig=this.textConfig),this._savePrimaryToNormal(e,r,hf)},t.prototype._savePrimaryToNormal=function(e,r,n){for(var a=0;a<n.length;a++){var i=n[a];e[i]!=null&&!(i in r)&&(r[i]=this[i])}},t.prototype.hasState=function(){return this.currentStates.length>0},t.prototype.getState=function(e){return this.states[e]},t.prototype.ensureState=function(e){var r=this.states;return r[e]||(r[e]={}),r[e]},t.prototype.clearStates=function(e){this.useState(df,!1,e)},t.prototype.useState=function(e,r,n,a){var i=e===df,o=this.hasState();if(!(!o&&i)){var s=this.currentStates,l=this.stateTransition;if(!(Ue(s,e)>=0&&(r||s.length===1))){var c;if(this.stateProxy&&!i&&(c=this.stateProxy(e)),c||(c=this.states&&this.states[e]),!c&&!i){Eu("State "+e+" not exists.");return}i||this.saveCurrentToNormalState(c);var u=!!(c&&c.hoverLayer||a);u&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,c,this._normalState,r,!n&&!this.__inHover&&l&&l.duration>0,l);var f=this._textContent,h=this._textGuide;return f&&f.useState(e,r,n,u),h&&h.useState(e,r,n,u),i?(this.currentStates=[],this._normalState={}):r?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!u&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~ir),c}}},t.prototype.useStates=function(e,r,n){if(!e.length)this.clearStates();else{var a=[],i=this.currentStates,o=e.length,s=o===i.length;if(s){for(var l=0;l<o;l++)if(e[l]!==i[l]){s=!1;break}}if(s)return;for(var l=0;l<o;l++){var c=e[l],u=void 0;this.stateProxy&&(u=this.stateProxy(c,e)),u||(u=this.states[c]),u&&a.push(u)}var f=a[o-1],h=!!(f&&f.hoverLayer||n);h&&this._toggleHoverLayerFlag(!0);var d=this._mergeStates(a),p=this.stateTransition;this.saveCurrentToNormalState(d),this._applyStateObj(e.join(","),d,this._normalState,!1,!r&&!this.__inHover&&p&&p.duration>0,p);var m=this._textContent,g=this._textGuide;m&&m.useStates(e,r,h),g&&g.useStates(e,r,h),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~ir)}},t.prototype.isSilent=function(){for(var e=this.silent,r=this.parent;!e&&r;){if(r.silent){e=!0;break}r=r.parent}return e},t.prototype._updateAnimationTargets=function(){for(var e=0;e<this.animators.length;e++){var r=this.animators[e];r.targetName&&r.changeTarget(this[r.targetName])}},t.prototype.removeState=function(e){var r=Ue(this.currentStates,e);if(r>=0){var n=this.currentStates.slice();n.splice(r,1),this.useStates(n)}},t.prototype.replaceState=function(e,r,n){var a=this.currentStates.slice(),i=Ue(a,e),o=Ue(a,r)>=0;i>=0?o?a.splice(i,1):a[i]=r:n&&!o&&a.push(r),this.useStates(a)},t.prototype.toggleState=function(e,r){r?this.useState(e,!0):this.removeState(e)},t.prototype._mergeStates=function(e){for(var r={},n,a=0;a<e.length;a++){var i=e[a];q(r,i),i.textConfig&&(n=n||{},q(n,i.textConfig))}return n&&(r.textConfig=n),r},t.prototype._applyStateObj=function(e,r,n,a,i,o){var s=!(r&&a);r&&r.textConfig?(this.textConfig=q({},a?this.textConfig:n.textConfig),q(this.textConfig,r.textConfig)):s&&n.textConfig&&(this.textConfig=n.textConfig);for(var l={},c=!1,u=0;u<hf.length;u++){var f=hf[u],h=i&&BS[f];r&&r[f]!=null?h?(c=!0,l[f]=r[f]):this[f]=r[f]:s&&n[f]!=null&&(h?(c=!0,l[f]=n[f]):this[f]=n[f])}if(!i)for(var u=0;u<this.animators.length;u++){var d=this.animators[u],p=d.targetName;d.getLoop()||d.__changeFinalValue(p?(r||n)[p]:r||n)}c&&this._transitionState(e,l,o)},t.prototype._attachComponent=function(e){if(!(e.__zr&&!e.__hostTarget)&&e!==this){var r=this.__zr;r&&e.addSelfToZr(r),e.__zr=r,e.__hostTarget=this}},t.prototype._detachComponent=function(e){e.__zr&&e.removeSelfFromZr(e.__zr),e.__zr=null,e.__hostTarget=null},t.prototype.getClipPath=function(){return this._clipPath},t.prototype.setClipPath=function(e){this._clipPath&&this._clipPath!==e&&this.removeClipPath(),this._attachComponent(e),this._clipPath=e,this.markRedraw()},t.prototype.removeClipPath=function(){var e=this._clipPath;e&&(this._detachComponent(e),this._clipPath=null,this.markRedraw())},t.prototype.getTextContent=function(){return this._textContent},t.prototype.setTextContent=function(e){var r=this._textContent;r!==e&&(r&&r!==e&&this.removeTextContent(),e.innerTransformable=new Ju,this._attachComponent(e),this._textContent=e,this.markRedraw())},t.prototype.setTextConfig=function(e){this.textConfig||(this.textConfig={}),q(this.textConfig,e),this.markRedraw()},t.prototype.removeTextConfig=function(){this.textConfig=null,this.markRedraw()},t.prototype.removeTextContent=function(){var e=this._textContent;e&&(e.innerTransformable=null,this._detachComponent(e),this._textContent=null,this._innerTextDefaultStyle=null,this.markRedraw())},t.prototype.getTextGuideLine=function(){return this._textGuide},t.prototype.setTextGuideLine=function(e){this._textGuide&&this._textGuide!==e&&this.removeTextGuideLine(),this._attachComponent(e),this._textGuide=e,this.markRedraw()},t.prototype.removeTextGuideLine=function(){var e=this._textGuide;e&&(this._detachComponent(e),this._textGuide=null,this.markRedraw())},t.prototype.markRedraw=function(){this.__dirty|=ir;var e=this.__zr;e&&(this.__inHover?e.refreshHover():e.refresh()),this.__hostTarget&&this.__hostTarget.markRedraw()},t.prototype.dirty=function(){this.markRedraw()},t.prototype._toggleHoverLayerFlag=function(e){this.__inHover=e;var r=this._textContent,n=this._textGuide;r&&(r.__inHover=e),n&&(n.__inHover=e)},t.prototype.addSelfToZr=function(e){if(this.__zr!==e){this.__zr=e;var r=this.animators;if(r)for(var n=0;n<r.length;n++)e.animation.addAnimator(r[n]);this._clipPath&&this._clipPath.addSelfToZr(e),this._textContent&&this._textContent.addSelfToZr(e),this._textGuide&&this._textGuide.addSelfToZr(e)}},t.prototype.removeSelfFromZr=function(e){if(this.__zr){this.__zr=null;var r=this.animators;if(r)for(var n=0;n<r.length;n++)e.animation.removeAnimator(r[n]);this._clipPath&&this._clipPath.removeSelfFromZr(e),this._textContent&&this._textContent.removeSelfFromZr(e),this._textGuide&&this._textGuide.removeSelfFromZr(e)}},t.prototype.animate=function(e,r,n){var a=e?this[e]:this,i=new lf(a,r,n);return e&&(i.targetName=e),this.addAnimator(i,e),i},t.prototype.addAnimator=function(e,r){var n=this.__zr,a=this;e.during(function(){a.updateDuringAnimation(r)}).done(function(){var i=a.animators,o=Ue(i,e);o>=0&&i.splice(o,1)}),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(e){this.markRedraw()},t.prototype.stopAnimation=function(e,r){for(var n=this.animators,a=n.length,i=[],o=0;o<a;o++){var s=n[o];!e||e===s.scope?s.stop(r):i.push(s)}return this.animators=i,this},t.prototype.animateTo=function(e,r,n){pf(this,e,r,n)},t.prototype.animateFrom=function(e,r,n){pf(this,e,r,n,!0)},t.prototype._transitionState=function(e,r,n,a){for(var i=pf(this,r,n,a),o=0;o<i.length;o++)i[o].__fromStateTransition=e},t.prototype.getBoundingRect=function(){return null},t.prototype.getPaintRect=function(){return null},t.initDefaultProps=(function(){var e=t.prototype;e.type="element",e.name="",e.ignore=e.silent=e.isGroup=e.draggable=e.dragging=e.ignoreClip=e.__inHover=!1,e.__dirty=ir;function r(n,a,i,o){Object.defineProperty(e,n,{get:function(){if(!this[a]){var l=this[a]=[];s(this,l)}return this[a]},set:function(l){this[i]=l[0],this[o]=l[1],this[a]=l,s(this,l)}});function s(l,c){Object.defineProperty(c,0,{get:function(){return l[i]},set:function(u){l[i]=u}}),Object.defineProperty(c,1,{get:function(){return l[o]},set:function(u){l[o]=u}})}}Object.defineProperty&&(r("position","_legacyPos","x","y"),r("scale","_legacyScale","scaleX","scaleY"),r("origin","_legacyOrigin","originX","originY"))})(),t})();Ur(ml,Ir),Ur(ml,Ju);function pf(t,e,r,n,a){r=r||{};var i=[];rg(t,"",t,e,r,n,i,a);var o=i.length,s=!1,l=r.done,c=r.aborted,u=function(){s=!0,o--,o<=0&&(s?l&&l():c&&c())},f=function(){o--,o<=0&&(s?l&&l():c&&c())};o||l&&l(),i.length>0&&r.during&&i[0].during(function(p,m){r.during(m)});for(var h=0;h<i.length;h++){var d=i[h];u&&d.done(u),f&&d.aborted(f),r.force&&d.duration(r.duration),d.start(r.easing)}return i}function vf(t,e,r){for(var n=0;n<r;n++)t[n]=e[n]}function FS(t){return Vt(t[0])}function HS(t,e,r){if(Vt(e[r]))if(Vt(t[r])||(t[r]=[]),Ut(e[r])){var n=e[r].length;t[r].length!==n&&(t[r]=new e[r].constructor(n),vf(t[r],e[r],n))}else{var a=e[r],i=t[r],o=a.length;if(FS(a))for(var s=a[0].length,l=0;l<o;l++)i[l]?vf(i[l],a[l],s):i[l]=Array.prototype.slice.call(a[l]);else vf(i,a,o);i.length=a.length}else t[r]=e[r]}function VS(t,e){return t===e||Vt(t)&&Vt(e)&&US(t,e)}function US(t,e){var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function rg(t,e,r,n,a,i,o,s){for(var l=at(n),c=a.duration,u=a.delay,f=a.additive,h=a.setToFinal,d=!de(i),p=t.animators,m=[],g=0;g<l.length;g++){var v=l[g],y=n[v];if(y!=null&&r[v]!=null&&(d||i[v]))if(de(y)&&!Vt(y)&&!Ws(y)){if(e){s||(r[v]=y,t.updateDuringAnimation(e));continue}rg(t,v,r[v],y,a,i&&i[v],o,s)}else m.push(v);else s||(r[v]=y,t.updateDuringAnimation(e),m.push(v))}var b=m.length;if(!f&&b)for(var x=0;x<p.length;x++){var w=p[x];if(w.targetName===e){var S=w.stopTracks(m);if(S){var k=Ue(p,w);p.splice(k,1)}}}if(a.force||(m=bt(m,function(T){return!VS(n[T],r[T])}),b=m.length),b>0||a.force&&!o.length){var C=void 0,A=void 0,M=void 0;if(s){A={},h&&(C={});for(var x=0;x<b;x++){var v=m[x];A[v]=r[v],h?C[v]=n[v]:r[v]=n[v]}}else if(h){M={};for(var x=0;x<b;x++){var v=m[x];M[v]=fl(r[v]),HS(r,n,v)}}var w=new lf(r,!1,!1,f?bt(p,function(D){return D.targetName===e}):null);w.targetName=e,a.scope&&(w.scope=a.scope),h&&C&&w.whenWithKeys(0,C,m),M&&w.whenWithKeys(0,M,m),w.whenWithKeys(c??500,s?A:n,m).delay(u||0),t.addAnimator(w,e),o.push(w)}}var gf="__zr_style_"+Math.round(Math.random()*10),ga={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},yl={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};ga[gf]=!0;var ng=["z","z2","invisible"],GS=["invisible"],yo=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype._init=function(r){for(var n=at(r),a=0;a<n.length;a++){var i=n[a];i==="style"?this.useStyle(r[i]):t.prototype.attrKV.call(this,i,r[i])}this.style||this.useStyle({})},e.prototype.beforeBrush=function(){},e.prototype.afterBrush=function(){},e.prototype.innerBeforeBrush=function(){},e.prototype.innerAfterBrush=function(){},e.prototype.shouldBePainted=function(r,n,a,i){var o=this.transform;if(this.ignore||this.invisible||this.style.opacity===0||this.culling&&$S(this,r,n)||o&&!o[0]&&!o[3])return!1;if(a&&this.__clipPaths){for(var s=0;s<this.__clipPaths.length;++s)if(this.__clipPaths[s].isZeroArea())return!1}if(i&&this.parent)for(var l=this.parent;l;){if(l.ignore)return!1;l=l.parent}return!0},e.prototype.contain=function(r,n){return this.rectContain(r,n)},e.prototype.traverse=function(r,n){r.call(n,this)},e.prototype.rectContain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();return i.contain(a[0],a[1])},e.prototype.getPaintRect=function(){var r=this._paintRect;if(!this._paintRect||this.__dirty){var n=this.transform,a=this.getBoundingRect(),i=this.style,o=i.shadowBlur||0,s=i.shadowOffsetX||0,l=i.shadowOffsetY||0;r=this._paintRect||(this._paintRect=new Ge(0,0,0,0)),n?Ge.applyTransform(r,a,n):r.copy(a),(o||s||l)&&(r.width+=o*2+Math.abs(s),r.height+=o*2+Math.abs(l),r.x=Math.min(r.x,r.x+s-o),r.y=Math.min(r.y,r.y+l-o));var c=this.dirtyRectTolerance;r.isZero()||(r.x=Math.floor(r.x-c),r.y=Math.floor(r.y-c),r.width=Math.ceil(r.width+1+c*2),r.height=Math.ceil(r.height+1+c*2))}return r},e.prototype.setPrevPaintRect=function(r){r?(this._prevPaintRect=this._prevPaintRect||new Ge(0,0,0,0),this._prevPaintRect.copy(r)):this._prevPaintRect=null},e.prototype.getPrevPaintRect=function(){return this._prevPaintRect},e.prototype.animateStyle=function(r){return this.animate("style",r)},e.prototype.updateDuringAnimation=function(r){r==="style"?this.dirtyStyle():this.markRedraw()},e.prototype.attrKV=function(r,n){r!=="style"?t.prototype.attrKV.call(this,r,n):this.style?this.setStyle(n):this.useStyle(n)},e.prototype.setStyle=function(r,n){return typeof r=="string"?this.style[r]=n:q(this.style,r),this.dirtyStyle(),this},e.prototype.dirtyStyle=function(r){r||this.markRedraw(),this.__dirty|=mo,this._rect&&(this._rect=null)},e.prototype.dirty=function(){this.dirtyStyle()},e.prototype.styleChanged=function(){return!!(this.__dirty&mo)},e.prototype.styleUpdated=function(){this.__dirty&=~mo},e.prototype.createStyle=function(r){return Xs(ga,r)},e.prototype.useStyle=function(r){r[gf]||(r=this.createStyle(r)),this.__inHover?this.__hoverStyle=r:this.style=r,this.dirtyStyle()},e.prototype.isStyleObject=function(r){return r[gf]},e.prototype._innerSaveToNormal=function(r){t.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.style&&!n.style&&(n.style=this._mergeStyle(this.createStyle(),this.style)),this._savePrimaryToNormal(r,n,ng)},e.prototype._applyStateObj=function(r,n,a,i,o,s){t.prototype._applyStateObj.call(this,r,n,a,i,o,s);var l=!(n&&i),c;if(n&&n.style?o?i?c=n.style:(c=this._mergeStyle(this.createStyle(),a.style),this._mergeStyle(c,n.style)):(c=this._mergeStyle(this.createStyle(),i?this.style:a.style),this._mergeStyle(c,n.style)):l&&(c=a.style),c)if(o){var u=this.style;if(this.style=this.createStyle(l?{}:u),l)for(var f=at(u),h=0;h<f.length;h++){var d=f[h];d in c&&(c[d]=c[d],this.style[d]=u[d])}for(var p=at(c),h=0;h<p.length;h++){var d=p[h];this.style[d]=this.style[d]}this._transitionState(r,{style:c},s,this.getAnimationStyleProps())}else this.useStyle(c);for(var m=this.__inHover?GS:ng,h=0;h<m.length;h++){var d=m[h];n&&n[d]!=null?this[d]=n[d]:l&&a[d]!=null&&(this[d]=a[d])}},e.prototype._mergeStates=function(r){for(var n=t.prototype._mergeStates.call(this,r),a,i=0;i<r.length;i++){var o=r[i];o.style&&(a=a||{},this._mergeStyle(a,o.style))}return a&&(n.style=a),n},e.prototype._mergeStyle=function(r,n){return q(r,n),r},e.prototype.getAnimationStyleProps=function(){return yl},e.initDefaultProps=(function(){var r=e.prototype;r.type="displayable",r.invisible=!1,r.z=0,r.z2=0,r.zlevel=0,r.culling=!1,r.cursor="pointer",r.rectHover=!1,r.incremental=!1,r._rect=null,r.dirtyRectTolerance=0,r.__dirty=ir|mo})(),e})(ml),mf=new Ge(0,0,0,0),yf=new Ge(0,0,0,0);function $S(t,e,r){return mf.copy(t.getBoundingRect()),t.transform&&mf.applyTransform(t.transform),yf.width=e,yf.height=r,!mf.intersect(yf)}var vr=Math.min,gr=Math.max,_f=Math.sin,bf=Math.cos,ma=Math.PI*2,_l=si(),bl=si(),xl=si();function ag(t,e,r,n,a,i){a[0]=vr(t,r),a[1]=vr(e,n),i[0]=gr(t,r),i[1]=gr(e,n)}var ig=[],og=[];function WS(t,e,r,n,a,i,o,s,l,c){var u=Vv,f=wt,h=u(t,r,a,o,ig);l[0]=1/0,l[1]=1/0,c[0]=-1/0,c[1]=-1/0;for(var d=0;d<h;d++){var p=f(t,r,a,o,ig[d]);l[0]=vr(p,l[0]),c[0]=gr(p,c[0])}h=u(e,n,i,s,og);for(var d=0;d<h;d++){var m=f(e,n,i,s,og[d]);l[1]=vr(m,l[1]),c[1]=gr(m,c[1])}l[0]=vr(t,l[0]),c[0]=gr(t,c[0]),l[0]=vr(o,l[0]),c[0]=gr(o,c[0]),l[1]=vr(e,l[1]),c[1]=gr(e,c[1]),l[1]=vr(s,l[1]),c[1]=gr(s,c[1])}function qS(t,e,r,n,a,i,o,s){var l=Gv,c=Gt,u=gr(vr(l(t,r,a),1),0),f=gr(vr(l(e,n,i),1),0),h=c(t,r,a,u),d=c(e,n,i,f);o[0]=vr(t,a,h),o[1]=vr(e,i,d),s[0]=gr(t,a,h),s[1]=gr(e,i,d)}function YS(t,e,r,n,a,i,o,s,l){var c=ci,u=ui,f=Math.abs(a-i);if(f%ma<1e-4&&f>1e-4){s[0]=t-r,s[1]=e-n,l[0]=t+r,l[1]=e+n;return}if(_l[0]=bf(a)*r+t,_l[1]=_f(a)*n+e,bl[0]=bf(i)*r+t,bl[1]=_f(i)*n+e,c(s,_l,bl),u(l,_l,bl),a=a%ma,a<0&&(a=a+ma),i=i%ma,i<0&&(i=i+ma),a>i&&!o?i+=ma:a<i&&o&&(a+=ma),o){var h=i;i=a,a=h}for(var d=0;d<i;d+=Math.PI/2)d>a&&(xl[0]=bf(d)*r+t,xl[1]=_f(d)*n+e,c(s,xl,s),u(l,xl,l))}var $e={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},ya=[],_a=[],qr=[],Nn=[],Yr=[],Xr=[],xf=Math.min,wf=Math.max,ba=Math.cos,xa=Math.sin,vn=Math.abs,Sf=Math.PI,Bn=Sf*2,kf=typeof Float32Array<"u",_o=[];function Tf(t){var e=Math.round(t/Sf*1e8)/1e8;return e%2*Sf}function XS(t,e){var r=Tf(t[0]);r<0&&(r+=Bn);var n=r-t[0],a=t[1];a+=n,!e&&a-r>=Bn?a=r+Bn:e&&r-a>=Bn?a=r-Bn:!e&&r>a?a=r+(Bn-Tf(r-a)):e&&r<a&&(a=r-(Bn-Tf(a-r))),t[0]=r,t[1]=a}var wa=(function(){function t(e){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,e&&(this._saveData=!1),this._saveData&&(this.data=[])}return t.prototype.increaseVersion=function(){this._version++},t.prototype.getVersion=function(){return this._version},t.prototype.setScale=function(e,r,n){n=n||0,n>0&&(this._ux=vn(n/gl/e)||0,this._uy=vn(n/gl/r)||0)},t.prototype.setDPR=function(e){this.dpr=e},t.prototype.setContext=function(e){this._ctx=e},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(e,r){return this._drawPendingPt(),this.addData($e.M,e,r),this._ctx&&this._ctx.moveTo(e,r),this._x0=e,this._y0=r,this._xi=e,this._yi=r,this},t.prototype.lineTo=function(e,r){var n=vn(e-this._xi),a=vn(r-this._yi),i=n>this._ux||a>this._uy;if(this.addData($e.L,e,r),this._ctx&&i&&this._ctx.lineTo(e,r),i)this._xi=e,this._yi=r,this._pendingPtDist=0;else{var o=n*n+a*a;o>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=r,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(e,r,n,a,i,o){return this._drawPendingPt(),this.addData($e.C,e,r,n,a,i,o),this._ctx&&this._ctx.bezierCurveTo(e,r,n,a,i,o),this._xi=i,this._yi=o,this},t.prototype.quadraticCurveTo=function(e,r,n,a){return this._drawPendingPt(),this.addData($e.Q,e,r,n,a),this._ctx&&this._ctx.quadraticCurveTo(e,r,n,a),this._xi=n,this._yi=a,this},t.prototype.arc=function(e,r,n,a,i,o){this._drawPendingPt(),_o[0]=a,_o[1]=i,XS(_o,o),a=_o[0],i=_o[1];var s=i-a;return this.addData($e.A,e,r,n,n,a,s,0,o?0:1),this._ctx&&this._ctx.arc(e,r,n,a,i,o),this._xi=ba(i)*n+e,this._yi=xa(i)*n+r,this},t.prototype.arcTo=function(e,r,n,a,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,r,n,a,i),this},t.prototype.rect=function(e,r,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,r,n,a),this.addData($e.R,e,r,n,a),this},t.prototype.closePath=function(){this._drawPendingPt(),this.addData($e.Z);var e=this._ctx,r=this._x0,n=this._y0;return e&&e.closePath(),this._xi=r,this._yi=n,this},t.prototype.fill=function(e){e&&e.fill(),this.toStatic()},t.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},t.prototype.len=function(){return this._len},t.prototype.setData=function(e){var r=e.length;!(this.data&&this.data.length===r)&&kf&&(this.data=new Float32Array(r));for(var n=0;n<r;n++)this.data[n]=e[n];this._len=r},t.prototype.appendPath=function(e){e instanceof Array||(e=[e]);for(var r=e.length,n=0,a=this._len,i=0;i<r;i++)n+=e[i].len();kf&&this.data instanceof Float32Array&&(this.data=new Float32Array(a+n));for(var i=0;i<r;i++)for(var o=e[i].data,s=0;s<o.length;s++)this.data[a++]=o[s];this._len=a},t.prototype.addData=function(e,r,n,a,i,o,s,l,c){if(this._saveData){var u=this.data;this._len+arguments.length>u.length&&(this._expandData(),u=this.data);for(var f=0;f<arguments.length;f++)u[this._len++]=arguments[f]}},t.prototype._drawPendingPt=function(){this._pendingPtDist>0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],r=0;r<this._len;r++)e[r]=this.data[r];this.data=e}},t.prototype.toStatic=function(){if(this._saveData){this._drawPendingPt();var e=this.data;e instanceof Array&&(e.length=this._len,kf&&this._len>11&&(this.data=new Float32Array(e)))}},t.prototype.getBoundingRect=function(){qr[0]=qr[1]=Yr[0]=Yr[1]=Number.MAX_VALUE,Nn[0]=Nn[1]=Xr[0]=Xr[1]=-Number.MAX_VALUE;var e=this.data,r=0,n=0,a=0,i=0,o;for(o=0;o<this._len;){var s=e[o++],l=o===1;switch(l&&(r=e[o],n=e[o+1],a=r,i=n),s){case $e.M:r=a=e[o++],n=i=e[o++],Yr[0]=a,Yr[1]=i,Xr[0]=a,Xr[1]=i;break;case $e.L:ag(r,n,e[o],e[o+1],Yr,Xr),r=e[o++],n=e[o++];break;case $e.C:WS(r,n,e[o++],e[o++],e[o++],e[o++],e[o],e[o+1],Yr,Xr),r=e[o++],n=e[o++];break;case $e.Q:qS(r,n,e[o++],e[o++],e[o],e[o+1],Yr,Xr),r=e[o++],n=e[o++];break;case $e.A:var c=e[o++],u=e[o++],f=e[o++],h=e[o++],d=e[o++],p=e[o++]+d;o+=1;var m=!e[o++];l&&(a=ba(d)*f+c,i=xa(d)*h+u),YS(c,u,f,h,d,p,m,Yr,Xr),r=ba(p)*f+c,n=xa(p)*h+u;break;case $e.R:a=r=e[o++],i=n=e[o++];var g=e[o++],v=e[o++];ag(a,i,a+g,i+v,Yr,Xr);break;case $e.Z:r=a,n=i;break}ci(qr,qr,Yr),ui(Nn,Nn,Xr)}return o===0&&(qr[0]=qr[1]=Nn[0]=Nn[1]=0),new Ge(qr[0],qr[1],Nn[0]-qr[0],Nn[1]-qr[1])},t.prototype._calculateLength=function(){var e=this.data,r=this._len,n=this._ux,a=this._uy,i=0,o=0,s=0,l=0;this._pathSegLen||(this._pathSegLen=[]);for(var c=this._pathSegLen,u=0,f=0,h=0;h<r;){var d=e[h++],p=h===1;p&&(i=e[h],o=e[h+1],s=i,l=o);var m=-1;switch(d){case $e.M:i=s=e[h++],o=l=e[h++];break;case $e.L:{var g=e[h++],v=e[h++],y=g-i,b=v-o;(vn(y)>n||vn(b)>a||h===r-1)&&(m=Math.sqrt(y*y+b*b),i=g,o=v);break}case $e.C:{var x=e[h++],w=e[h++],g=e[h++],v=e[h++],S=e[h++],k=e[h++];m=wS(i,o,x,w,g,v,S,k,10),i=S,o=k;break}case $e.Q:{var x=e[h++],w=e[h++],g=e[h++],v=e[h++];m=TS(i,o,x,w,g,v,10),i=g,o=v;break}case $e.A:var C=e[h++],A=e[h++],M=e[h++],T=e[h++],D=e[h++],L=e[h++],R=L+D;h+=1,p&&(s=ba(D)*M+C,l=xa(D)*T+A),m=wf(M,T)*xf(Bn,Math.abs(L)),i=ba(R)*M+C,o=xa(R)*T+A;break;case $e.R:{s=i=e[h++],l=o=e[h++];var O=e[h++],B=e[h++];m=O*2+B*2;break}case $e.Z:{var y=s-i,b=l-o;m=Math.sqrt(y*y+b*b),i=s,o=l;break}}m>=0&&(c[f++]=m,u+=m)}return this._pathLen=u,u},t.prototype.rebuildPath=function(e,r){var n=this.data,a=this._ux,i=this._uy,o=this._len,s,l,c,u,f,h,d=r<1,p,m,g=0,v=0,y,b=0,x,w;if(!(d&&(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,m=this._pathLen,y=r*m,!y)))e:for(var S=0;S<o;){var k=n[S++],C=S===1;switch(C&&(c=n[S],u=n[S+1],s=c,l=u),k!==$e.L&&b>0&&(e.lineTo(x,w),b=0),k){case $e.M:s=c=n[S++],l=u=n[S++],e.moveTo(c,u);break;case $e.L:{f=n[S++],h=n[S++];var A=vn(f-c),M=vn(h-u);if(A>a||M>i){if(d){var T=p[v++];if(g+T>y){var D=(y-g)/T;e.lineTo(c*(1-D)+f*D,u*(1-D)+h*D);break e}g+=T}e.lineTo(f,h),c=f,u=h,b=0}else{var L=A*A+M*M;L>b&&(x=f,w=h,b=L)}break}case $e.C:{var R=n[S++],O=n[S++],B=n[S++],j=n[S++],P=n[S++],V=n[S++];if(d){var T=p[v++];if(g+T>y){var D=(y-g)/T;al(c,R,B,P,D,ya),al(u,O,j,V,D,_a),e.bezierCurveTo(ya[1],_a[1],ya[2],_a[2],ya[3],_a[3]);break e}g+=T}e.bezierCurveTo(R,O,B,j,P,V),c=P,u=V;break}case $e.Q:{var R=n[S++],O=n[S++],B=n[S++],j=n[S++];if(d){var T=p[v++];if(g+T>y){var D=(y-g)/T;il(c,R,B,D,ya),il(u,O,j,D,_a),e.quadraticCurveTo(ya[1],_a[1],ya[2],_a[2]);break e}g+=T}e.quadraticCurveTo(R,O,B,j),c=B,u=j;break}case $e.A:var H=n[S++],Z=n[S++],re=n[S++],Te=n[S++],ge=n[S++],xe=n[S++],Ce=n[S++],be=!n[S++],it=re>Te?re:Te,Qe=vn(re-Te)>.001,ze=ge+xe,oe=!1;if(d){var T=p[v++];g+T>y&&(ze=ge+xe*(y-g)/T,oe=!0),g+=T}if(Qe&&e.ellipse?e.ellipse(H,Z,re,Te,Ce,ge,ze,be):e.arc(H,Z,it,ge,ze,be),oe)break e;C&&(s=ba(ge)*re+H,l=xa(ge)*Te+Z),c=ba(ze)*re+H,u=xa(ze)*Te+Z;break;case $e.R:s=c=n[S],l=u=n[S+1],f=n[S++],h=n[S++];var pe=n[S++],ot=n[S++];if(d){var T=p[v++];if(g+T>y){var Xe=y-g;e.moveTo(f,h),e.lineTo(f+xf(Xe,pe),h),Xe-=pe,Xe>0&&e.lineTo(f+pe,h+xf(Xe,ot)),Xe-=ot,Xe>0&&e.lineTo(f+wf(pe-Xe,0),h+ot),Xe-=pe,Xe>0&&e.lineTo(f,h+wf(ot-Xe,0));break e}g+=T}e.rect(f,h,pe,ot);break;case $e.Z:if(d){var T=p[v++];if(g+T>y){var D=(y-g)/T;e.lineTo(c*(1-D)+s*D,u*(1-D)+l*D);break e}g+=T}e.closePath(),c=s,u=l}}},t.prototype.clone=function(){var e=new t,r=this.data;return e.data=r.slice?r.slice():Array.prototype.slice.call(r),e._len=this._len,e},t.CMD=$e,t.initDefaultProps=(function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0})(),t})();function gi(t,e,r,n,a,i,o){if(a===0)return!1;var s=a,l=0,c=t;if(o>e+s&&o>n+s||o<e-s&&o<n-s||i>t+s&&i>r+s||i<t-s&&i<r-s)return!1;if(t!==r)l=(e-n)/(t-r),c=(t*n-r*e)/(t-r);else return Math.abs(i-t)<=s/2;var u=l*i-o+c,f=u*u/(l*l+1);return f<=s/2*s/2}function ZS(t,e,r,n,a,i,o,s,l,c,u){if(l===0)return!1;var f=l;if(u>e+f&&u>n+f&&u>i+f&&u>s+f||u<e-f&&u<n-f&&u<i-f&&u<s-f||c>t+f&&c>r+f&&c>a+f&&c>o+f||c<t-f&&c<r-f&&c<a-f&&c<o-f)return!1;var h=xS(t,e,r,n,a,i,o,s,c,u);return h<=f/2}function KS(t,e,r,n,a,i,o,s,l){if(o===0)return!1;var c=o;if(l>e+c&&l>n+c&&l>i+c||l<e-c&&l<n-c&&l<i-c||s>t+c&&s>r+c&&s>a+c||s<t-c&&s<r-c&&s<a-c)return!1;var u=kS(t,e,r,n,a,i,s,l);return u<=c/2}var sg=Math.PI*2;function wl(t){return t%=sg,t<0&&(t+=sg),t}var bo=Math.PI*2;function jS(t,e,r,n,a,i,o,s,l){if(o===0)return!1;var c=o;s-=t,l-=e;var u=Math.sqrt(s*s+l*l);if(u-c>r||u+c<r)return!1;if(Math.abs(n-a)%bo<1e-4)return!0;if(i){var f=n;n=wl(a),a=wl(f)}else n=wl(n),a=wl(a);n>a&&(a+=bo);var h=Math.atan2(l,s);return h<0&&(h+=bo),h>=n&&h<=a||h+bo>=n&&h+bo<=a}function Sa(t,e,r,n,a,i){if(i>e&&i>n||i<e&&i<n||n===e)return 0;var o=(i-e)/(n-e),s=n<e?1:-1;(o===1||o===0)&&(s=n<e?.5:-.5);var l=o*(r-t)+t;return l===a?1/0:l>a?s:0}var zn=wa.CMD,ka=Math.PI*2,JS=1e-4;function QS(t,e){return Math.abs(t-e)<JS}var Ot=[-1,-1,-1],mr=[-1,-1];function ek(){var t=mr[0];mr[0]=mr[1],mr[1]=t}function tk(t,e,r,n,a,i,o,s,l,c){if(c>e&&c>n&&c>i&&c>s||c<e&&c<n&&c<i&&c<s)return 0;var u=nl(e,n,i,s,c,Ot);if(u===0)return 0;for(var f=0,h=-1,d=void 0,p=void 0,m=0;m<u;m++){var g=Ot[m],v=g===0||g===1?.5:1,y=wt(t,r,a,o,g);y<l||(h<0&&(h=Vv(e,n,i,s,mr),mr[1]<mr[0]&&h>1&&ek(),d=wt(e,n,i,s,mr[0]),h>1&&(p=wt(e,n,i,s,mr[1]))),h===2?g<mr[0]?f+=d<e?v:-v:g<mr[1]?f+=p<d?v:-v:f+=s<p?v:-v:g<mr[0]?f+=d<e?v:-v:f+=s<d?v:-v)}return f}function rk(t,e,r,n,a,i,o,s){if(s>e&&s>n&&s>i||s<e&&s<n&&s<i)return 0;var l=SS(e,n,i,s,Ot);if(l===0)return 0;var c=Gv(e,n,i);if(c>=0&&c<=1){for(var u=0,f=Gt(e,n,i,c),h=0;h<l;h++){var d=Ot[h]===0||Ot[h]===1?.5:1,p=Gt(t,r,a,Ot[h]);p<o||(Ot[h]<c?u+=f<e?d:-d:u+=i<f?d:-d)}return u}else{var d=Ot[0]===0||Ot[0]===1?.5:1,p=Gt(t,r,a,Ot[0]);return p<o?0:i<e?d:-d}}function nk(t,e,r,n,a,i,o,s){if(s-=e,s>r||s<-r)return 0;var l=Math.sqrt(r*r-s*s);Ot[0]=-l,Ot[1]=l;var c=Math.abs(n-a);if(c<1e-4)return 0;if(c>=ka-1e-4){n=0,a=ka;var u=i?1:-1;return o>=Ot[0]+t&&o<=Ot[1]+t?u:0}if(n>a){var f=n;n=a,a=f}n<0&&(n+=ka,a+=ka);for(var h=0,d=0;d<2;d++){var p=Ot[d];if(p+t>o){var m=Math.atan2(s,p),u=i?1:-1;m<0&&(m=ka+m),(m>=n&&m<=a||m+ka>=n&&m+ka<=a)&&(m>Math.PI/2&&m<Math.PI*1.5&&(u=-u),h+=u)}}return h}function lg(t,e,r,n,a){for(var i=t.data,o=t.len(),s=0,l=0,c=0,u=0,f=0,h,d,p=0;p<o;){var m=i[p++],g=p===1;switch(m===zn.M&&p>1&&(r||(s+=Sa(l,c,u,f,n,a))),g&&(l=i[p],c=i[p+1],u=l,f=c),m){case zn.M:u=i[p++],f=i[p++],l=u,c=f;break;case zn.L:if(r){if(gi(l,c,i[p],i[p+1],e,n,a))return!0}else s+=Sa(l,c,i[p],i[p+1],n,a)||0;l=i[p++],c=i[p++];break;case zn.C:if(r){if(ZS(l,c,i[p++],i[p++],i[p++],i[p++],i[p],i[p+1],e,n,a))return!0}else s+=tk(l,c,i[p++],i[p++],i[p++],i[p++],i[p],i[p+1],n,a)||0;l=i[p++],c=i[p++];break;case zn.Q:if(r){if(KS(l,c,i[p++],i[p++],i[p],i[p+1],e,n,a))return!0}else s+=rk(l,c,i[p++],i[p++],i[p],i[p+1],n,a)||0;l=i[p++],c=i[p++];break;case zn.A:var v=i[p++],y=i[p++],b=i[p++],x=i[p++],w=i[p++],S=i[p++];p+=1;var k=!!(1-i[p++]);h=Math.cos(w)*b+v,d=Math.sin(w)*x+y,g?(u=h,f=d):s+=Sa(l,c,h,d,n,a);var C=(n-v)*x/b+v;if(r){if(jS(v,y,x,w,w+S,k,e,C,a))return!0}else s+=nk(v,y,x,w,w+S,k,C,a);l=Math.cos(w+S)*b+v,c=Math.sin(w+S)*x+y;break;case zn.R:u=l=i[p++],f=c=i[p++];var A=i[p++],M=i[p++];if(h=u+A,d=f+M,r){if(gi(u,f,h,f,e,n,a)||gi(h,f,h,d,e,n,a)||gi(h,d,u,d,e,n,a)||gi(u,d,u,f,e,n,a))return!0}else s+=Sa(h,f,h,d,n,a),s+=Sa(u,d,u,f,n,a);break;case zn.Z:if(r){if(gi(l,c,u,f,e,n,a))return!0}else s+=Sa(l,c,u,f,n,a);l=u,c=f;break}}return!r&&!QS(c,f)&&(s+=Sa(l,c,u,f,n,a)||0),s!==0}function ak(t,e,r){return lg(t,0,!1,e,r)}function ik(t,e,r,n){return lg(t,e,!0,r,n)}var cg=He({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},ga),ok={style:He({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},yl.style)},Cf=fo.concat(["invisible","culling","z","z2","zlevel","parent"]),qe=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.update=function(){var r=this;t.prototype.update.call(this);var n=this.style;if(n.decal){var a=this._decalEl=this._decalEl||new e;a.buildPath===e.prototype.buildPath&&(a.buildPath=function(l){r.buildPath(l,r.shape)}),a.silent=!0;var i=a.style;for(var o in n)i[o]!==n[o]&&(i[o]=n[o]);i.fill=n.fill?n.decal:null,i.decal=null,i.shadowColor=null,n.strokeFirst&&(i.stroke=null);for(var s=0;s<Cf.length;++s)a[Cf[s]]=this[Cf[s]];a.__dirty|=ir}else this._decalEl&&(this._decalEl=null)},e.prototype.getDecalElement=function(){return this._decalEl},e.prototype._init=function(r){var n=at(r);this.shape=this.getDefaultShape();var a=this.getDefaultStyle();a&&this.useStyle(a);for(var i=0;i<n.length;i++){var o=n[i],s=r[o];o==="style"?this.style?q(this.style,s):this.useStyle(s):o==="shape"?q(this.shape,s):t.prototype.attrKV.call(this,o,s)}this.style||this.useStyle({})},e.prototype.getDefaultStyle=function(){return null},e.prototype.getDefaultShape=function(){return{}},e.prototype.canBeInsideText=function(){return this.hasFill()},e.prototype.getInsideTextFill=function(){var r=this.style.fill;if(r!=="none"){if(ae(r)){var n=cl(r,0);return n>.5?uf:n>.2?NS:ff}else if(r)return ff}return uf},e.prototype.getInsideTextStroke=function(r){var n=this.style.fill;if(ae(n)){var a=this.__zr,i=!!(a&&a.isDarkMode()),o=cl(r,0)<cf;if(i===o)return n}},e.prototype.buildPath=function(r,n,a){},e.prototype.pathUpdated=function(){this.__dirty&=~pi},e.prototype.getUpdatedPathProxy=function(r){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,r),this.path},e.prototype.createPathProxy=function(){this.path=new wa(!1)},e.prototype.hasStroke=function(){var r=this.style,n=r.stroke;return!(n==null||n==="none"||!(r.lineWidth>0))},e.prototype.hasFill=function(){var r=this.style,n=r.fill;return n!=null&&n!=="none"},e.prototype.getBoundingRect=function(){var r=this._rect,n=this.style,a=!r;if(a){var i=!1;this.path||(i=!0,this.createPathProxy());var o=this.path;(i||this.__dirty&pi)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),r=o.getBoundingRect()}if(this._rect=r,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=r.clone());if(this.__dirty||a){s.copy(r);var l=n.strokeNoScale?this.getLineScale():1,c=n.lineWidth;if(!this.hasFill()){var u=this.strokeContainThreshold;c=Math.max(c,u??4)}l>1e-10&&(s.width+=c/l,s.height+=c/l,s.x-=c/l/2,s.y-=c/l/2)}return s}return r},e.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect(),o=this.style;if(r=a[0],n=a[1],i.contain(r,n)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,c=o.strokeNoScale?this.getLineScale():1;if(c>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),ik(s,l/c,r,n)))return!0}if(this.hasFill())return ak(s,r,n)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=pi,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(r){return this.animate("shape",r)},e.prototype.updateDuringAnimation=function(r){r==="style"?this.dirtyStyle():r==="shape"?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(r,n){r==="shape"?this.setShape(n):t.prototype.attrKV.call(this,r,n)},e.prototype.setShape=function(r,n){var a=this.shape;return a||(a=this.shape={}),typeof r=="string"?a[r]=n:q(a,r),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&pi)},e.prototype.createStyle=function(r){return Xs(cg,r)},e.prototype._innerSaveToNormal=function(r){t.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.shape&&!n.shape&&(n.shape=q({},this.shape))},e.prototype._applyStateObj=function(r,n,a,i,o,s){t.prototype._applyStateObj.call(this,r,n,a,i,o,s);var l=!(n&&i),c;if(n&&n.shape?o?i?c=n.shape:(c=q({},a.shape),q(c,n.shape)):(c=q({},i?this.shape:a.shape),q(c,n.shape)):l&&(c=a.shape),c)if(o){this.shape=q({},this.shape);for(var u={},f=at(c),h=0;h<f.length;h++){var d=f[h];typeof c[d]=="object"?this.shape[d]=c[d]:u[d]=c[d]}this._transitionState(r,{shape:u},s)}else this.shape=c,this.dirtyShape()},e.prototype._mergeStates=function(r){for(var n=t.prototype._mergeStates.call(this,r),a,i=0;i<r.length;i++){var o=r[i];o.shape&&(a=a||{},this._mergeStyle(a,o.shape))}return a&&(n.shape=a),n},e.prototype.getAnimationStyleProps=function(){return ok},e.prototype.isZeroArea=function(){return!1},e.extend=function(r){var n=(function(i){K(o,i);function o(s){var l=i.call(this,s)||this;return r.init&&r.init.call(l,s),l}return o.prototype.getDefaultStyle=function(){return Ie(r.style)},o.prototype.getDefaultShape=function(){return Ie(r.shape)},o})(e);for(var a in r)typeof r[a]=="function"&&(n.prototype[a]=r[a]);return n},e.initDefaultProps=(function(){var r=e.prototype;r.type="path",r.strokeContainThreshold=5,r.segmentIgnoreThreshold=0,r.subPixelOptimize=!1,r.autoBatch=!1,r.__dirty=ir|mo|pi})(),e})(yo),sk=He({strokeFirst:!0,font:sa,x:0,y:0,textAlign:"left",textBaseline:"top",miterLimit:2},cg),Sl=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.hasStroke=function(){var r=this.style,n=r.stroke;return n!=null&&n!=="none"&&r.lineWidth>0},e.prototype.hasFill=function(){var r=this.style,n=r.fill;return n!=null&&n!=="none"},e.prototype.createStyle=function(r){return Xs(sk,r)},e.prototype.setBoundingRect=function(r){this._rect=r},e.prototype.getBoundingRect=function(){var r=this.style;if(!this._rect){var n=r.text;n!=null?n+="":n="";var a=$u(n,r.font,r.textAlign,r.textBaseline);if(a.x+=r.x||0,a.y+=r.y||0,this.hasStroke()){var i=r.lineWidth;a.x-=i/2,a.y-=i/2,a.width+=i,a.height+=i}this._rect=a}return this._rect},e.initDefaultProps=(function(){var r=e.prototype;r.dirtyRectTolerance=10})(),e})(yo);Sl.prototype.type="tspan";var lk=He({x:0,y:0},ga),ck={style:He({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},yl.style)};function uk(t){return!!(t&&typeof t!="string"&&t.width&&t.height)}var Fn=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.createStyle=function(r){return Xs(lk,r)},e.prototype._getSize=function(r){var n=this.style,a=n[r];if(a!=null)return a;var i=uk(n.image)?n.image:this.__image;if(!i)return 0;var o=r==="width"?"height":"width",s=n[o];return s==null?i[r]:i[r]/i[o]*s},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return ck},e.prototype.getBoundingRect=function(){var r=this.style;return this._rect||(this._rect=new Ge(r.x||0,r.y||0,this.getWidth(),this.getHeight())),this._rect},e})(yo);Fn.prototype.type="image";function fk(t,e){var r=e.x,n=e.y,a=e.width,i=e.height,o=e.r,s,l,c,u;a<0&&(r=r+a,a=-a),i<0&&(n=n+i,i=-i),typeof o=="number"?s=l=c=u=o:o instanceof Array?o.length===1?s=l=c=u=o[0]:o.length===2?(s=c=o[0],l=u=o[1]):o.length===3?(s=o[0],l=u=o[1],c=o[2]):(s=o[0],l=o[1],c=o[2],u=o[3]):s=l=c=u=0;var f;s+l>a&&(f=s+l,s*=a/f,l*=a/f),c+u>a&&(f=c+u,c*=a/f,u*=a/f),l+c>i&&(f=l+c,l*=i/f,c*=i/f),s+u>i&&(f=s+u,s*=i/f,u*=i/f),t.moveTo(r+s,n),t.lineTo(r+a-l,n),l!==0&&t.arc(r+a-l,n+l,l,-Math.PI/2,0),t.lineTo(r+a,n+i-c),c!==0&&t.arc(r+a-c,n+i-c,c,0,Math.PI/2),t.lineTo(r+u,n+i),u!==0&&t.arc(r+u,n+i-u,u,Math.PI/2,Math.PI),t.lineTo(r,n+s),s!==0&&t.arc(r+s,n+s,s,Math.PI,Math.PI*1.5)}var mi=Math.round;function ug(t,e,r){if(e){var n=e.x1,a=e.x2,i=e.y1,o=e.y2;t.x1=n,t.x2=a,t.y1=i,t.y2=o;var s=r&&r.lineWidth;return s&&(mi(n*2)===mi(a*2)&&(t.x1=t.x2=Ta(n,s,!0)),mi(i*2)===mi(o*2)&&(t.y1=t.y2=Ta(i,s,!0))),t}}function fg(t,e,r){if(e){var n=e.x,a=e.y,i=e.width,o=e.height;t.x=n,t.y=a,t.width=i,t.height=o;var s=r&&r.lineWidth;return s&&(t.x=Ta(n,s,!0),t.y=Ta(a,s,!0),t.width=Math.max(Ta(n+i,s,!1)-t.x,i===0?0:1),t.height=Math.max(Ta(a+o,s,!1)-t.y,o===0?0:1)),t}}function Ta(t,e,r){if(!e)return t;var n=mi(t*2);return(n+mi(e))%2===0?n/2:(n+(r?1:-1))/2}var dk=(function(){function t(){this.x=0,this.y=0,this.width=0,this.height=0}return t})(),hk={},_t=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new dk},e.prototype.buildPath=function(r,n){var a,i,o,s;if(this.subPixelOptimize){var l=fg(hk,n,this.style);a=l.x,i=l.y,o=l.width,s=l.height,l.r=n.r,n=l}else a=n.x,i=n.y,o=n.width,s=n.height;n.r?fk(r,n):r.rect(a,i,o,s)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e})(qe);_t.prototype.type="rect";var dg={fill:"#000"},hg=2,pk={style:He({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},yl.style)},$t=(function(t){K(e,t);function e(r){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=dg,n.attr(r),n}return e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var r=0;r<this._children.length;r++){var n=this._children[r];n.zlevel=this.zlevel,n.z=this.z,n.z2=this.z2,n.culling=this.culling,n.cursor=this.cursor,n.invisible=this.invisible}},e.prototype.updateTransform=function(){var r=this.innerTransformable;r?(r.updateTransform(),r.transform&&(this.transform=r.transform)):t.prototype.updateTransform.call(this)},e.prototype.getLocalTransform=function(r){var n=this.innerTransformable;return n?n.getLocalTransform(r):t.prototype.getLocalTransform.call(this,r)},e.prototype.getComputedTransform=function(){return this.__hostTarget&&(this.__hostTarget.getComputedTransform(),this.__hostTarget.updateInnerText(!0)),t.prototype.getComputedTransform.call(this)},e.prototype._updateSubTexts=function(){this._childCursor=0,_k(this.style),this.style.rich?this._updateRichTexts():this._updatePlainTexts(),this._children.length=this._childCursor,this.styleUpdated()},e.prototype.addSelfToZr=function(r){t.prototype.addSelfToZr.call(this,r);for(var n=0;n<this._children.length;n++)this._children[n].__zr=r},e.prototype.removeSelfFromZr=function(r){t.prototype.removeSelfFromZr.call(this,r);for(var n=0;n<this._children.length;n++)this._children[n].__zr=null},e.prototype.getBoundingRect=function(){if(this.styleChanged()&&this._updateSubTexts(),!this._rect){for(var r=new Ge(0,0,0,0),n=this._children,a=[],i=null,o=0;o<n.length;o++){var s=n[o],l=s.getBoundingRect(),c=s.getLocalTransform(a);c?(r.copy(l),r.applyTransform(c),i=i||r.clone(),i.union(r)):(i=i||l.clone(),i.union(l))}this._rect=i||r}return this._rect},e.prototype.setDefaultTextStyle=function(r){this._defaultStyle=r||dg},e.prototype.setTextContent=function(r){},e.prototype._mergeStyle=function(r,n){if(!n)return r;var a=n.rich,i=r.rich||a&&{};return q(r,n),a&&i?(this._mergeRich(i,a),r.rich=i):i&&(r.rich=i),r},e.prototype._mergeRich=function(r,n){for(var a=at(n),i=0;i<a.length;i++){var o=a[i];r[o]=r[o]||{},q(r[o],n[o])}},e.prototype.getAnimationStyleProps=function(){return pk},e.prototype._getOrCreateChild=function(r){var n=this._children[this._childCursor];return(!n||!(n instanceof r))&&(n=new r),this._children[this._childCursor++]=n,n.__zr=this.__zr,n.parent=this,n},e.prototype._updatePlainTexts=function(){var r=this.style,n=r.font||sa,a=r.padding,i=bg(r),o=oS(i,r),s=Mf(r),l=!!r.backgroundColor,c=o.outerHeight,u=o.outerWidth,f=o.contentWidth,h=o.lines,d=o.lineHeight,p=this._defaultStyle;this.isTruncated=!!o.isTruncated;var m=r.x||0,g=r.y||0,v=r.align||p.align||"left",y=r.verticalAlign||p.verticalAlign||"top",b=m,x=oi(g,o.contentHeight,y);if(s||a){var w=uo(m,u,v),S=oi(g,c,y);s&&this._renderBackground(r,r,w,S,u,c)}x+=d/2,a&&(b=_g(m,v,a),y==="top"?x+=a[0]:y==="bottom"&&(x-=a[2]));for(var k=0,C=!1,A=yg("fill"in r?r.fill:(C=!0,p.fill)),M=mg("stroke"in r?r.stroke:!l&&(!p.autoStroke||C)?(k=hg,p.stroke):null),T=r.textShadowBlur>0,D=r.width!=null&&(r.overflow==="truncate"||r.overflow==="break"||r.overflow==="breakAll"),L=o.calculatedLineHeight,R=0;R<h.length;R++){var O=this._getOrCreateChild(Sl),B=O.createStyle();O.useStyle(B),B.text=h[R],B.x=b,B.y=x,B.textAlign=v,B.textBaseline="middle",B.opacity=r.opacity,B.strokeFirst=!0,T&&(B.shadowBlur=r.textShadowBlur||0,B.shadowColor=r.textShadowColor||"transparent",B.shadowOffsetX=r.textShadowOffsetX||0,B.shadowOffsetY=r.textShadowOffsetY||0),B.stroke=M,B.fill=A,M&&(B.lineWidth=r.lineWidth||k,B.lineDash=r.lineDash,B.lineDashOffset=r.lineDashOffset||0),B.font=n,vg(B,r),x+=d,D&&O.setBoundingRect(new Ge(uo(B.x,f,B.textAlign),oi(B.y,L,B.textBaseline),f,L))}},e.prototype._updateRichTexts=function(){var r=this.style,n=bg(r),a=cS(n,r),i=a.width,o=a.outerWidth,s=a.outerHeight,l=r.padding,c=r.x||0,u=r.y||0,f=this._defaultStyle,h=r.align||f.align,d=r.verticalAlign||f.verticalAlign;this.isTruncated=!!a.isTruncated;var p=uo(c,o,h),m=oi(u,s,d),g=p,v=m;l&&(g+=l[3],v+=l[0]);var y=g+i;Mf(r)&&this._renderBackground(r,r,p,m,o,s);for(var b=!!r.backgroundColor,x=0;x<a.lines.length;x++){for(var w=a.lines[x],S=w.tokens,k=S.length,C=w.lineHeight,A=w.width,M=0,T=g,D=y,L=k-1,R=void 0;M<k&&(R=S[M],!R.align||R.align==="left");)this._placeToken(R,r,C,v,T,"left",b),A-=R.width,T+=R.width,M++;for(;L>=0&&(R=S[L],R.align==="right");)this._placeToken(R,r,C,v,D,"right",b),A-=R.width,D-=R.width,L--;for(T+=(i-(T-g)-(y-D)-A)/2;M<=L;)R=S[M],this._placeToken(R,r,C,v,T+R.width/2,"center",b),T+=R.width,M++;v+=C}},e.prototype._placeToken=function(r,n,a,i,o,s,l){var c=n.rich[r.styleName]||{};c.text=r.text;var u=r.verticalAlign,f=i+a/2;u==="top"?f=i+r.height/2:u==="bottom"&&(f=i+a-r.height/2);var h=!r.isLineHolder&&Mf(c);h&&this._renderBackground(c,n,s==="right"?o-r.width:s==="center"?o-r.width/2:o,f-r.height/2,r.width,r.height);var d=!!c.backgroundColor,p=r.textPadding;p&&(o=_g(o,s,p),f-=r.height/2-p[0]-r.innerHeight/2);var m=this._getOrCreateChild(Sl),g=m.createStyle();m.useStyle(g);var v=this._defaultStyle,y=!1,b=0,x=yg("fill"in c?c.fill:"fill"in n?n.fill:(y=!0,v.fill)),w=mg("stroke"in c?c.stroke:"stroke"in n?n.stroke:!d&&!l&&(!v.autoStroke||y)?(b=hg,v.stroke):null),S=c.textShadowBlur>0||n.textShadowBlur>0;g.text=r.text,g.x=o,g.y=f,S&&(g.shadowBlur=c.textShadowBlur||n.textShadowBlur||0,g.shadowColor=c.textShadowColor||n.textShadowColor||"transparent",g.shadowOffsetX=c.textShadowOffsetX||n.textShadowOffsetX||0,g.shadowOffsetY=c.textShadowOffsetY||n.textShadowOffsetY||0),g.textAlign=s,g.textBaseline="middle",g.font=r.font||sa,g.opacity=Ys(c.opacity,n.opacity,1),vg(g,c),w&&(g.lineWidth=Ys(c.lineWidth,n.lineWidth,b),g.lineDash=Pe(c.lineDash,n.lineDash),g.lineDashOffset=n.lineDashOffset||0,g.stroke=w),x&&(g.fill=x);var k=r.contentWidth,C=r.contentHeight;m.setBoundingRect(new Ge(uo(g.x,k,g.textAlign),oi(g.y,C,g.textBaseline),k,C))},e.prototype._renderBackground=function(r,n,a,i,o,s){var l=r.backgroundColor,c=r.borderWidth,u=r.borderColor,f=l&&l.image,h=l&&!f,d=r.borderRadius,p=this,m,g;if(h||r.lineHeight||c&&u){m=this._getOrCreateChild(_t),m.useStyle(m.createStyle()),m.style.fill=null;var v=m.shape;v.x=a,v.y=i,v.width=o,v.height=s,v.r=d,m.dirtyShape()}if(h){var y=m.style;y.fill=l||null,y.fillOpacity=Pe(r.fillOpacity,1)}else if(f){g=this._getOrCreateChild(Fn),g.onload=function(){p.dirtyStyle()};var b=g.style;b.image=l.image,b.x=a,b.y=i,b.width=o,b.height=s}if(c&&u){var y=m.style;y.lineWidth=c,y.stroke=u,y.strokeOpacity=Pe(r.strokeOpacity,1),y.lineDash=r.borderDash,y.lineDashOffset=r.borderDashOffset||0,m.strokeContainThreshold=0,m.hasFill()&&m.hasStroke()&&(y.strokeFirst=!0,y.lineWidth*=2)}var x=(m||g).style;x.shadowBlur=r.shadowBlur||0,x.shadowColor=r.shadowColor||"transparent",x.shadowOffsetX=r.shadowOffsetX||0,x.shadowOffsetY=r.shadowOffsetY||0,x.opacity=Ys(r.opacity,n.opacity,1)},e.makeFont=function(r){var n="";return yk(r)&&(n=[r.fontStyle,r.fontWeight,mk(r.fontSize),r.fontFamily||"sans-serif"].join(" ")),n&&Gr(n)||r.textFont||r.font},e})(yo),vk={left:!0,right:1,center:1},gk={top:1,bottom:1,middle:1},pg=["fontStyle","fontWeight","fontSize","fontFamily"];function mk(t){return typeof t=="string"&&(t.indexOf("px")!==-1||t.indexOf("rem")!==-1||t.indexOf("em")!==-1)?t:isNaN(+t)?Lu+"px":t+"px"}function vg(t,e){for(var r=0;r<pg.length;r++){var n=pg[r],a=e[n];a!=null&&(t[n]=a)}}function yk(t){return t.fontSize!=null||t.fontFamily||t.fontWeight}function _k(t){return gg(t),I(t.rich,gg),t}function gg(t){if(t){t.font=$t.makeFont(t);var e=t.align;e==="middle"&&(e="center"),t.align=e==null||vk[e]?e:"left";var r=t.verticalAlign;r==="center"&&(r="middle"),t.verticalAlign=r==null||gk[r]?r:"top";var n=t.padding;n&&(t.padding=_v(t.padding))}}function mg(t,e){return t==null||e<=0||t==="transparent"||t==="none"?null:t.image||t.colorStops?"#000":t}function yg(t){return t==null||t==="none"?null:t.image||t.colorStops?"#000":t}function _g(t,e,r){return e==="right"?t-r[1]:e==="center"?t+r[3]/2-r[1]/2:t+r[3]}function bg(t){var e=t.text;return e!=null&&(e+=""),e}function Mf(t){return!!(t.backgroundColor||t.lineHeight||t.borderWidth&&t.borderColor)}var xg=1e-4,wg=20;function bk(t){return t.replace(/^\s+|\s+$/g,"")}function Ca(t,e,r,n){var a=e[0],i=e[1],o=r[0],s=r[1],l=i-a,c=s-o;if(l===0)return c===0?o:(o+s)/2;if(n)if(l>0){if(t<=a)return o;if(t>=i)return s}else{if(t>=a)return o;if(t<=i)return s}else{if(t===a)return o;if(t===i)return s}return(t-a)/l*c+o}function Nt(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%";break}return ae(t)?bk(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):t==null?NaN:+t}function mt(t,e,r){return e==null&&(e=10),e=Math.min(Math.max(0,e),wg),t=(+t).toFixed(e),r?t:+t}function xk(t){return t.sort(function(e,r){return e-r}),t}function gn(t){if(t=+t,isNaN(t))return 0;if(t>1e-14){for(var e=1,r=0;r<15;r++,e*=10)if(Math.round(t*e)/e===t)return r}return wk(t)}function wk(t){var e=t.toString().toLowerCase(),r=e.indexOf("e"),n=r>0?+e.slice(r+1):0,a=r>0?r:e.length,i=e.indexOf("."),o=i<0?0:a-1-i;return Math.max(0,o-n)}function Sg(t,e){var r=Math.log,n=Math.LN10,a=Math.floor(r(t[1]-t[0])/n),i=Math.round(r(Math.abs(e[1]-e[0]))/n),o=Math.min(Math.max(-a+i,0),20);return isFinite(o)?o:20}function Sk(t,e){var r=Math.max(gn(t),gn(e)),n=t+e;return r>wg?n:mt(n,r)}function kg(t){var e=Math.PI*2;return(t%e+e)%e}function kl(t){return t>-xg&&t<xg}var kk=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function mn(t){if(t instanceof Date)return t;if(ae(t)){var e=kk.exec(t);if(!e)return new Date(NaN);if(e[8]){var r=+e[4]||0;return e[8].toUpperCase()!=="Z"&&(r-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,r,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}else return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0)}else if(t==null)return new Date(NaN);return new Date(Math.round(t))}function Tk(t){return Math.pow(10,Af(t))}function Af(t){if(t===0)return 0;var e=Math.floor(Math.log(t)/Math.LN10);return t/Math.pow(10,e)>=10&&e++,e}function Tg(t,e){var r=Af(t),n=Math.pow(10,r),a=t/n,i;return a<1.5?i=1:a<2.5?i=2:a<4?i=3:a<7?i=5:i=10,t=i*n,r>=-20?+t.toFixed(r<0?-r:0):t}function Tl(t){var e=parseFloat(t);return e==t&&(e!==0||!ae(t)||t.indexOf("x")<=0)?e:NaN}function Ck(t){return!isNaN(Tl(t))}function Cg(){return Math.round(Math.random()*9)}function Mg(t,e){return e===0?t:Mg(e,t%e)}function Ag(t,e){return t==null?e:e==null?t:t*e/Mg(t,e)}function Wt(t){throw new Error(t)}function Dg(t,e,r){return(e-t)*r+t}var Ig="series\0",Mk="\0_ec_\0";function Mt(t){return t instanceof Array?t:t==null?[]:[t]}function Lg(t,e,r){if(t){t[e]=t[e]||{},t.emphasis=t.emphasis||{},t.emphasis[e]=t.emphasis[e]||{};for(var n=0,a=r.length;n<a;n++){var i=r[n];!t.emphasis[e].hasOwnProperty(i)&&t[e].hasOwnProperty(i)&&(t.emphasis[e][i]=t[e][i])}}}var Pg=["fontStyle","fontWeight","fontSize","fontFamily","rich","tag","color","textBorderColor","textBorderWidth","width","height","lineHeight","align","verticalAlign","baseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY","backgroundColor","borderColor","borderWidth","borderRadius","padding"];function xo(t){return de(t)&&!ee(t)&&!(t instanceof Date)?t.value:t}function Ak(t){return de(t)&&!(t instanceof Array)}function Dk(t,e,r){var n=r==="normalMerge",a=r==="replaceMerge",i=r==="replaceAll";t=t||[],e=(e||[]).slice();var o=me();I(e,function(l,c){if(!de(l)){e[c]=null;return}});var s=Ik(t,o,r);return(n||a)&&Lk(s,t,o,e),n&&Pk(s,e),n||a?Rk(s,e,a):i&&Ek(s,e),Ok(s),s}function Ik(t,e,r){var n=[];if(r==="replaceAll")return n;for(var a=0;a<t.length;a++){var i=t[a];i&&i.id!=null&&e.set(i.id,a),n.push({existing:r==="replaceMerge"||So(i)?null:i,newOption:null,keyInfo:null,brandNew:null})}return n}function Lk(t,e,r,n){I(n,function(a,i){if(!(!a||a.id==null)){var o=wo(a.id),s=r.get(o);if(s!=null){var l=t[s];dn(!l.newOption,'Duplicated option on id "'+o+'".'),l.newOption=a,l.existing=e[s],n[i]=null}}})}function Pk(t,e){I(e,function(r,n){if(!(!r||r.name==null))for(var a=0;a<t.length;a++){var i=t[a].existing;if(!t[a].newOption&&i&&(i.id==null||r.id==null)&&!So(r)&&!So(i)&&Rg("name",i,r)){t[a].newOption=r,e[n]=null;return}}})}function Rk(t,e,r){I(e,function(n){if(n){for(var a,i=0;(a=t[i])&&(a.newOption||So(a.existing)||a.existing&&n.id!=null&&!Rg("id",n,a.existing));)i++;a?(a.newOption=n,a.brandNew=r):t.push({newOption:n,brandNew:r,existing:null,keyInfo:null}),i++}})}function Ek(t,e){I(e,function(r){t.push({newOption:r,brandNew:!0,existing:null,keyInfo:null})})}function Ok(t){var e=me();I(t,function(r){var n=r.existing;n&&e.set(n.id,r)}),I(t,function(r){var n=r.newOption;dn(!n||n.id==null||!e.get(n.id)||e.get(n.id)===r,"id duplicates: "+(n&&n.id)),n&&n.id!=null&&e.set(n.id,r),!r.keyInfo&&(r.keyInfo={})}),I(t,function(r,n){var a=r.existing,i=r.newOption,o=r.keyInfo;if(de(i)){if(o.name=i.name!=null?wo(i.name):a?a.name:Ig+n,a)o.id=wo(a.id);else if(i.id!=null)o.id=wo(i.id);else{var s=0;do o.id="\0"+o.name+"\0"+s++;while(e.get(o.id))}e.set(o.id,r)}})}function Rg(t,e,r){var n=Zr(e[t],null),a=Zr(r[t],null);return n!=null&&a!=null&&n===a}function wo(t){return Zr(t,"")}function Zr(t,e){return t==null?e:ae(t)?t:et(t)||Ou(t)?t+"":e}function Df(t){var e=t.name;return!!(e&&e.indexOf(Ig))}function So(t){return t&&t.id!=null&&wo(t.id).indexOf(Mk)===0}function Nk(t,e,r){I(t,function(n){var a=n.newOption;de(a)&&(n.keyInfo.mainType=e,n.keyInfo.subType=Bk(e,a,n.existing,r))})}function Bk(t,e,r,n){var a=e.type?e.type:r?r.subType:n.determineSubType(t,e);return a}function Ma(t,e){if(e.dataIndexInside!=null)return e.dataIndexInside;if(e.dataIndex!=null)return ee(e.dataIndex)?he(e.dataIndex,function(r){return t.indexOfRawIndex(r)}):t.indexOfRawIndex(e.dataIndex);if(e.name!=null)return ee(e.name)?he(e.name,function(r){return t.indexOfName(r)}):t.indexOfName(e.name)}function ht(){var t="__ec_inner_"+zk++;return function(e){return e[t]||(e[t]={})}}var zk=Cg();function If(t,e,r){var n=Lf(e,r),a=n.mainTypeSpecified,i=n.queryOptionMap,o=n.others,s=o,l=r?r.defaultMainType:null;return!a&&l&&i.set(l,{}),i.each(function(c,u){var f=ko(t,u,c,{useDefault:l===u,enableAll:r&&r.enableAll!=null?r.enableAll:!0,enableNone:r&&r.enableNone!=null?r.enableNone:!0});s[u+"Models"]=f.models,s[u+"Model"]=f.models[0]}),s}function Lf(t,e){var r;if(ae(t)){var n={};n[t+"Index"]=0,r=n}else r=t;var a=me(),i={},o=!1;return I(r,function(s,l){if(l==="dataIndex"||l==="dataIndexInside"){i[l]=s;return}var c=l.match(/^(\w+)(Index|Id|Name)$/)||[],u=c[1],f=(c[2]||"").toLowerCase();if(!(!u||!f||e&&e.includeMainTypes&&Ue(e.includeMainTypes,u)<0)){o=o||!!u;var h=a.get(u)||a.set(u,{});h[f]=s}}),{mainTypeSpecified:o,queryOptionMap:a,others:i}}var qt={useDefault:!0,enableAll:!1,enableNone:!1},Fk={useDefault:!1,enableAll:!0,enableNone:!0};function ko(t,e,r,n){n=n||qt;var a=r.index,i=r.id,o=r.name,s={models:null,specified:a!=null||i!=null||o!=null};if(!s.specified){var l=void 0;return s.models=n.useDefault&&(l=t.getComponent(e))?[l]:[],s}return a==="none"||a===!1?(dn(n.enableNone,'`"none"` or `false` is not a valid value on index option.'),s.models=[],s):(a==="all"&&(dn(n.enableAll,'`"all"` is not a valid value on index option.'),a=i=o=null),s.models=t.queryComponents({mainType:e,index:a,id:i,name:o}),s)}function Eg(t,e,r){t.setAttribute?t.setAttribute(e,r):t[e]=r}function Hk(t,e){return t.getAttribute?t.getAttribute(e):t[e]}function Vk(t){return t==="auto"?_e.domSupported?"html":"richText":t||"html"}function Uk(t,e,r,n,a){var i=e==null||e==="auto";if(n==null)return n;if(et(n)){var o=Dg(r||0,n,a);return mt(o,i?Math.max(gn(r||0),gn(n)):e)}else{if(ae(n))return a<1?r:n;for(var s=[],l=r,c=n,u=Math.max(l?l.length:0,c.length),f=0;f<u;++f){var h=t.getDimensionInfo(f);if(h&&h.type==="ordinal")s[f]=(a<1&&l?l:c)[f];else{var d=l&&l[f]?l[f]:0,p=c[f],o=Dg(d,p,a);s[f]=mt(o,i?Math.max(gn(d),gn(p)):e)}}return s}}var We=ht(),Gk=function(t,e,r,n){if(n){var a=We(n);a.dataIndex=r,a.dataType=e,a.seriesIndex=t,a.ssrType="chart",n.type==="group"&&n.traverse(function(i){var o=We(i);o.seriesIndex=t,o.dataIndex=r,o.dataType=e,o.ssrType="chart"})}},Og=1,Ng={},Bg=ht(),Pf=ht(),Rf=0,Cl=1,Ml=2,Kr=["emphasis","blur","select"],zg=["normal","emphasis","blur","select"],$k=10,Wk=9,Aa="highlight",Al="downplay",To="select",Dl="unselect",Co="toggleSelect";function yi(t){return t!=null&&t!=="none"}function Il(t,e,r){t.onHoverStateChange&&(t.hoverState||0)!==r&&t.onHoverStateChange(e),t.hoverState=r}function Fg(t){Il(t,"emphasis",Ml)}function Hg(t){t.hoverState===Ml&&Il(t,"normal",Rf)}function Ef(t){Il(t,"blur",Cl)}function Vg(t){t.hoverState===Cl&&Il(t,"normal",Rf)}function qk(t){t.selected=!0}function Yk(t){t.selected=!1}function Ug(t,e,r){e(t,r)}function yn(t,e,r){Ug(t,e,r),t.isGroup&&t.traverse(function(n){Ug(n,e,r)})}function Gg(t,e){switch(e){case"emphasis":t.hoverState=Ml;break;case"normal":t.hoverState=Rf;break;case"blur":t.hoverState=Cl;break;case"select":t.selected=!0}}function Xk(t,e,r,n){for(var a=t.style,i={},o=0;o<e.length;o++){var s=e[o],l=a[s];i[s]=l??(n&&n[s])}for(var o=0;o<t.animators.length;o++){var c=t.animators[o];c.__fromStateTransition&&c.__fromStateTransition.indexOf(r)<0&&c.targetName==="style"&&c.saveTo(i,e)}return i}function Zk(t,e,r,n){var a=r&&Ue(r,"select")>=0,i=!1;if(t instanceof qe){var o=Bg(t),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(yi(s)||yi(l)){n=n||{};var c=n.style||{};c.fill==="inherit"?(i=!0,n=q({},n),c=q({},c),c.fill=s):!yi(c.fill)&&yi(s)?(i=!0,n=q({},n),c=q({},c),c.fill=Kv(s)):!yi(c.stroke)&&yi(l)&&(i||(n=q({},n),c=q({},c)),c.stroke=Kv(l)),n.style=c}}if(n&&n.z2==null){i||(n=q({},n));var u=t.z2EmphasisLift;n.z2=t.z2+(u??$k)}return n}function Kk(t,e,r){if(r&&r.z2==null){r=q({},r);var n=t.z2SelectLift;r.z2=t.z2+(n??Wk)}return r}function jk(t,e,r){var n=Ue(t.currentStates,e)>=0,a=t.style.opacity,i=n?null:Xk(t,["opacity"],e,{opacity:1});r=r||{};var o=r.style||{};return o.opacity==null&&(r=q({},r),o=q({opacity:n?a:i.opacity*.1},o),r.style=o),r}function Of(t,e){var r=this.states[t];if(this.style){if(t==="emphasis")return Zk(this,t,e,r);if(t==="blur")return jk(this,t,r);if(t==="select")return Kk(this,t,r)}return r}function Jk(t){t.stateProxy=Of;var e=t.getTextContent(),r=t.getTextGuideLine();e&&(e.stateProxy=Of),r&&(r.stateProxy=Of)}function $g(t,e){!Zg(t,e)&&!t.__highByOuter&&yn(t,Fg)}function Wg(t,e){!Zg(t,e)&&!t.__highByOuter&&yn(t,Hg)}function Ll(t,e){t.__highByOuter|=1<<(e||0),yn(t,Fg)}function Pl(t,e){!(t.__highByOuter&=~(1<<(e||0)))&&yn(t,Hg)}function Qk(t){yn(t,Ef)}function qg(t){yn(t,Vg)}function Yg(t){yn(t,qk)}function Xg(t){yn(t,Yk)}function Zg(t,e){return t.__highDownSilentOnTouch&&e.zrByTouch}function Kg(t){var e=t.getModel(),r=[],n=[];e.eachComponent(function(a,i){var o=Pf(i),s=a==="series",l=s?t.getViewOfSeriesModel(i):t.getViewOfComponentModel(i);!s&&n.push(l),o.isBlured&&(l.group.traverse(function(c){Vg(c)}),s&&r.push(i)),o.isBlured=!1}),I(n,function(a){a&&a.toggleBlurSeries&&a.toggleBlurSeries(r,!1,e)})}function Nf(t,e,r,n){var a=n.getModel();r=r||"coordinateSystem";function i(c,u){for(var f=0;f<u.length;f++){var h=c.getItemGraphicEl(u[f]);h&&qg(h)}}if(t!=null&&!(!e||e==="none")){var o=a.getSeriesByIndex(t),s=o.coordinateSystem;s&&s.master&&(s=s.master);var l=[];a.eachSeries(function(c){var u=o===c,f=c.coordinateSystem;f&&f.master&&(f=f.master);var h=f&&s?f===s:u;if(!(r==="series"&&!u||r==="coordinateSystem"&&!h||e==="series"&&u)){var d=n.getViewOfSeriesModel(c);if(d.group.traverse(function(g){g.__highByOuter&&u&&e==="self"||Ef(g)}),Vt(e))i(c.getData(),e);else if(de(e))for(var p=at(e),m=0;m<p.length;m++)i(c.getData(p[m]),e[p[m]]);l.push(c),Pf(c).isBlured=!0}}),a.eachComponent(function(c,u){if(c!=="series"){var f=n.getViewOfComponentModel(u);f&&f.toggleBlurSeries&&f.toggleBlurSeries(l,!0,a)}})}}function Bf(t,e,r){if(!(t==null||e==null)){var n=r.getModel().getComponent(t,e);if(n){Pf(n).isBlured=!0;var a=r.getViewOfComponentModel(n);!a||!a.focusBlurEnabled||a.group.traverse(function(i){Ef(i)})}}}function e2(t,e,r){var n=t.seriesIndex,a=t.getData(e.dataType);if(a){var i=Ma(a,e);i=(ee(i)?i[0]:i)||0;var o=a.getItemGraphicEl(i);if(!o)for(var s=a.count(),l=0;!o&&l<s;)o=a.getItemGraphicEl(l++);if(o){var c=We(o);Nf(n,c.focus,c.blurScope,r)}else{var u=t.get(["emphasis","focus"]),f=t.get(["emphasis","blurScope"]);u!=null&&Nf(n,u,f,r)}}}function zf(t,e,r,n){var a={focusSelf:!1,dispatchers:null};if(t==null||t==="series"||e==null||r==null)return a;var i=n.getModel().getComponent(t,e);if(!i)return a;var o=n.getViewOfComponentModel(i);if(!o||!o.findHighDownDispatchers)return a;for(var s=o.findHighDownDispatchers(r),l,c=0;c<s.length;c++)if(We(s[c]).focus==="self"){l=!0;break}return{focusSelf:l,dispatchers:s}}function t2(t,e,r){var n=We(t),a=zf(n.componentMainType,n.componentIndex,n.componentHighDownName,r),i=a.dispatchers,o=a.focusSelf;i?(o&&Bf(n.componentMainType,n.componentIndex,r),I(i,function(s){return $g(s,e)})):(Nf(n.seriesIndex,n.focus,n.blurScope,r),n.focus==="self"&&Bf(n.componentMainType,n.componentIndex,r),$g(t,e))}function r2(t,e,r){Kg(r);var n=We(t),a=zf(n.componentMainType,n.componentIndex,n.componentHighDownName,r).dispatchers;a?I(a,function(i){return Wg(i,e)}):Wg(t,e)}function n2(t,e,r){if(Uf(e)){var n=e.dataType,a=t.getData(n),i=Ma(a,e);ee(i)||(i=[i]),t[e.type===Co?"toggleSelect":e.type===To?"select":"unselect"](i,n)}}function jg(t){var e=t.getAllData();I(e,function(r){var n=r.data,a=r.type;n.eachItemGraphicEl(function(i,o){t.isSelected(o,a)?Yg(i):Xg(i)})})}function a2(t){var e=[];return t.eachSeries(function(r){var n=r.getAllData();I(n,function(a){a.data;var i=a.type,o=r.getSelectedDataIndices();if(o.length>0){var s={dataIndex:o,seriesIndex:r.seriesIndex};i!=null&&(s.dataType=i),e.push(s)}})}),e}function Ff(t,e,r){Qg(t,!0),yn(t,Jk),o2(t,e,r)}function i2(t){Qg(t,!1)}function Rl(t,e,r,n){n?i2(t):Ff(t,e,r)}function o2(t,e,r){var n=We(t);e!=null?(n.focus=e,n.blurScope=r):n.focus&&(n.focus=null)}var Jg=["emphasis","blur","select"],s2={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Hf(t,e,r,n){r=r||"itemStyle";for(var a=0;a<Jg.length;a++){var i=Jg[a],o=e.getModel([i,r]),s=t.ensureState(i);s.style=o[s2[r]]()}}function Qg(t,e){var r=e===!1,n=t;t.highDownSilentOnTouch&&(n.__highDownSilentOnTouch=t.highDownSilentOnTouch),(!r||n.__highDownDispatcher)&&(n.__highByOuter=n.__highByOuter||0,n.__highDownDispatcher=!r)}function Vf(t){return!!(t&&t.__highDownDispatcher)}function l2(t){var e=Ng[t];return e==null&&Og<=32&&(e=Ng[t]=Og++),e}function Uf(t){var e=t.type;return e===To||e===Dl||e===Co}function em(t){var e=t.type;return e===Aa||e===Al}function c2(t){var e=Bg(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var r=t.states.select||{};e.selectFill=r.style&&r.style.fill||null,e.selectStroke=r.style&&r.style.stroke||null}var _i=wa.CMD,u2=[[],[],[]],tm=Math.sqrt,f2=Math.atan2;function d2(t,e){if(e){var r=t.data,n=t.len(),a,i,o,s,l,c,u=_i.M,f=_i.C,h=_i.L,d=_i.R,p=_i.A,m=_i.Q;for(o=0,s=0;o<n;){switch(a=r[o++],s=o,i=0,a){case u:i=1;break;case h:i=1;break;case f:i=3;break;case m:i=2;break;case p:var g=e[4],v=e[5],y=tm(e[0]*e[0]+e[1]*e[1]),b=tm(e[2]*e[2]+e[3]*e[3]),x=f2(-e[1]/b,e[0]/y);r[o]*=y,r[o++]+=g,r[o]*=b,r[o++]+=v,r[o++]*=y,r[o++]*=b,r[o++]+=x,r[o++]+=x,o+=2,s=o;break;case d:c[0]=r[o++],c[1]=r[o++],dr(c,c,e),r[s++]=c[0],r[s++]=c[1],c[0]+=r[o++],c[1]+=r[o++],dr(c,c,e),r[s++]=c[0],r[s++]=c[1]}for(l=0;l<i;l++){var w=u2[l];w[0]=r[o++],w[1]=r[o++],dr(w,w,e),r[s++]=w[0],r[s++]=w[1]}}t.increaseVersion()}}var Gf=Math.sqrt,El=Math.sin,Ol=Math.cos,Mo=Math.PI;function rm(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function $f(t,e){return(t[0]*e[0]+t[1]*e[1])/(rm(t)*rm(e))}function nm(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos($f(t,e))}function am(t,e,r,n,a,i,o,s,l,c,u){var f=l*(Mo/180),h=Ol(f)*(t-r)/2+El(f)*(e-n)/2,d=-1*El(f)*(t-r)/2+Ol(f)*(e-n)/2,p=h*h/(o*o)+d*d/(s*s);p>1&&(o*=Gf(p),s*=Gf(p));var m=(a===i?-1:1)*Gf((o*o*(s*s)-o*o*(d*d)-s*s*(h*h))/(o*o*(d*d)+s*s*(h*h)))||0,g=m*o*d/s,v=m*-s*h/o,y=(t+r)/2+Ol(f)*g-El(f)*v,b=(e+n)/2+El(f)*g+Ol(f)*v,x=nm([1,0],[(h-g)/o,(d-v)/s]),w=[(h-g)/o,(d-v)/s],S=[(-1*h-g)/o,(-1*d-v)/s],k=nm(w,S);if($f(w,S)<=-1&&(k=Mo),$f(w,S)>=1&&(k=0),k<0){var C=Math.round(k/Mo*1e6)/1e6;k=Mo*2+C%2*Mo}u.addData(c,y,b,o,s,x,k,f,i)}var h2=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,p2=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function v2(t){var e=new wa;if(!t)return e;var r=0,n=0,a=r,i=n,o,s=wa.CMD,l=t.match(h2);if(!l)return e;for(var c=0;c<l.length;c++){for(var u=l[c],f=u.charAt(0),h=void 0,d=u.match(p2)||[],p=d.length,m=0;m<p;m++)d[m]=parseFloat(d[m]);for(var g=0;g<p;){var v=void 0,y=void 0,b=void 0,x=void 0,w=void 0,S=void 0,k=void 0,C=r,A=n,M=void 0,T=void 0;switch(f){case"l":r+=d[g++],n+=d[g++],h=s.L,e.addData(h,r,n);break;case"L":r=d[g++],n=d[g++],h=s.L,e.addData(h,r,n);break;case"m":r+=d[g++],n+=d[g++],h=s.M,e.addData(h,r,n),a=r,i=n,f="l";break;case"M":r=d[g++],n=d[g++],h=s.M,e.addData(h,r,n),a=r,i=n,f="L";break;case"h":r+=d[g++],h=s.L,e.addData(h,r,n);break;case"H":r=d[g++],h=s.L,e.addData(h,r,n);break;case"v":n+=d[g++],h=s.L,e.addData(h,r,n);break;case"V":n=d[g++],h=s.L,e.addData(h,r,n);break;case"C":h=s.C,e.addData(h,d[g++],d[g++],d[g++],d[g++],d[g++],d[g++]),r=d[g-2],n=d[g-1];break;case"c":h=s.C,e.addData(h,d[g++]+r,d[g++]+n,d[g++]+r,d[g++]+n,d[g++]+r,d[g++]+n),r+=d[g-2],n+=d[g-1];break;case"S":v=r,y=n,M=e.len(),T=e.data,o===s.C&&(v+=r-T[M-4],y+=n-T[M-3]),h=s.C,C=d[g++],A=d[g++],r=d[g++],n=d[g++],e.addData(h,v,y,C,A,r,n);break;case"s":v=r,y=n,M=e.len(),T=e.data,o===s.C&&(v+=r-T[M-4],y+=n-T[M-3]),h=s.C,C=r+d[g++],A=n+d[g++],r+=d[g++],n+=d[g++],e.addData(h,v,y,C,A,r,n);break;case"Q":C=d[g++],A=d[g++],r=d[g++],n=d[g++],h=s.Q,e.addData(h,C,A,r,n);break;case"q":C=d[g++]+r,A=d[g++]+n,r+=d[g++],n+=d[g++],h=s.Q,e.addData(h,C,A,r,n);break;case"T":v=r,y=n,M=e.len(),T=e.data,o===s.Q&&(v+=r-T[M-4],y+=n-T[M-3]),r=d[g++],n=d[g++],h=s.Q,e.addData(h,v,y,r,n);break;case"t":v=r,y=n,M=e.len(),T=e.data,o===s.Q&&(v+=r-T[M-4],y+=n-T[M-3]),r+=d[g++],n+=d[g++],h=s.Q,e.addData(h,v,y,r,n);break;case"A":b=d[g++],x=d[g++],w=d[g++],S=d[g++],k=d[g++],C=r,A=n,r=d[g++],n=d[g++],h=s.A,am(C,A,r,n,S,k,b,x,w,h,e);break;case"a":b=d[g++],x=d[g++],w=d[g++],S=d[g++],k=d[g++],C=r,A=n,r+=d[g++],n+=d[g++],h=s.A,am(C,A,r,n,S,k,b,x,w,h,e);break}}(f==="z"||f==="Z")&&(h=s.Z,e.addData(h),r=a,n=i),o=h}return e.toStatic(),e}var im=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.applyTransform=function(r){},e})(qe);function om(t){return t.setData!=null}function sm(t,e){var r=v2(t),n=q({},e);return n.buildPath=function(a){if(om(a)){a.setData(r.data);var i=a.getContext();i&&a.rebuildPath(i,1)}else{var i=a;r.rebuildPath(i,1)}},n.applyTransform=function(a){d2(r,a),this.dirtyShape()},n}function g2(t,e){return new im(sm(t,e))}function m2(t,e){var r=sm(t,e),n=(function(a){K(i,a);function i(o){var s=a.call(this,o)||this;return s.applyTransform=r.applyTransform,s.buildPath=r.buildPath,s}return i})(im);return n}function y2(t,e){for(var r=[],n=t.length,a=0;a<n;a++){var i=t[a];r.push(i.getUpdatedPathProxy(!0))}var o=new qe(e);return o.createPathProxy(),o.buildPath=function(s){if(om(s)){s.appendPath(r);var l=s.getContext();l&&s.rebuildPath(l,1)}},o}var St=(function(t){K(e,t);function e(r){var n=t.call(this)||this;return n.isGroup=!0,n._children=[],n.attr(r),n}return e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(r){return this._children[r]},e.prototype.childOfName=function(r){for(var n=this._children,a=0;a<n.length;a++)if(n[a].name===r)return n[a]},e.prototype.childCount=function(){return this._children.length},e.prototype.add=function(r){return r&&r!==this&&r.parent!==this&&(this._children.push(r),this._doAdd(r)),this},e.prototype.addBefore=function(r,n){if(r&&r!==this&&r.parent!==this&&n&&n.parent===this){var a=this._children,i=a.indexOf(n);i>=0&&(a.splice(i,0,r),this._doAdd(r))}return this},e.prototype.replace=function(r,n){var a=Ue(this._children,r);return a>=0&&this.replaceAt(n,a),this},e.prototype.replaceAt=function(r,n){var a=this._children,i=a[n];if(r&&r!==this&&r.parent!==this&&r!==i){a[n]=r,i.parent=null;var o=this.__zr;o&&i.removeSelfFromZr(o),this._doAdd(r)}return this},e.prototype._doAdd=function(r){r.parent&&r.parent.remove(r),r.parent=this;var n=this.__zr;n&&n!==r.__zr&&r.addSelfToZr(n),n&&n.refresh()},e.prototype.remove=function(r){var n=this.__zr,a=this._children,i=Ue(a,r);return i<0?this:(a.splice(i,1),r.parent=null,n&&r.removeSelfFromZr(n),n&&n.refresh(),this)},e.prototype.removeAll=function(){for(var r=this._children,n=this.__zr,a=0;a<r.length;a++){var i=r[a];n&&i.removeSelfFromZr(n),i.parent=null}return r.length=0,this},e.prototype.eachChild=function(r,n){for(var a=this._children,i=0;i<a.length;i++){var o=a[i];r.call(n,o,i)}return this},e.prototype.traverse=function(r,n){for(var a=0;a<this._children.length;a++){var i=this._children[a],o=r.call(n,i);i.isGroup&&!o&&i.traverse(r,n)}return this},e.prototype.addSelfToZr=function(r){t.prototype.addSelfToZr.call(this,r);for(var n=0;n<this._children.length;n++){var a=this._children[n];a.addSelfToZr(r)}},e.prototype.removeSelfFromZr=function(r){t.prototype.removeSelfFromZr.call(this,r);for(var n=0;n<this._children.length;n++){var a=this._children[n];a.removeSelfFromZr(r)}},e.prototype.getBoundingRect=function(r){for(var n=new Ge(0,0,0,0),a=r||this._children,i=[],o=null,s=0;s<a.length;s++){var l=a[s];if(!(l.ignore||l.invisible)){var c=l.getBoundingRect(),u=l.getLocalTransform(i);u?(Ge.applyTransform(n,c,u),o=o||n.clone(),o.union(n)):(o=o||c.clone(),o.union(c))}}return o||n},e})(ml);St.prototype.type="group";var _2=(function(){function t(){this.cx=0,this.cy=0,this.r=0}return t})(),Nl=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new _2},e.prototype.buildPath=function(r,n){r.moveTo(n.cx+n.r,n.cy),r.arc(n.cx,n.cy,n.r,0,Math.PI*2)},e})(qe);Nl.prototype.type="circle";var b2=(function(){function t(){this.cx=0,this.cy=0,this.rx=0,this.ry=0}return t})(),Wf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new b2},e.prototype.buildPath=function(r,n){var a=.5522848,i=n.cx,o=n.cy,s=n.rx,l=n.ry,c=s*a,u=l*a;r.moveTo(i-s,o),r.bezierCurveTo(i-s,o-u,i-c,o-l,i,o-l),r.bezierCurveTo(i+c,o-l,i+s,o-u,i+s,o),r.bezierCurveTo(i+s,o+u,i+c,o+l,i,o+l),r.bezierCurveTo(i-c,o+l,i-s,o+u,i-s,o),r.closePath()},e})(qe);Wf.prototype.type="ellipse";var lm=Math.PI,qf=lm*2,Da=Math.sin,bi=Math.cos,x2=Math.acos,At=Math.atan2,cm=Math.abs,Ao=Math.sqrt,Do=Math.max,jr=Math.min,Lr=1e-4;function w2(t,e,r,n,a,i,o,s){var l=r-t,c=n-e,u=o-a,f=s-i,h=f*l-u*c;if(!(h*h<Lr))return h=(u*(e-i)-f*(t-a))/h,[t+h*l,e+h*c]}function Bl(t,e,r,n,a,i,o){var s=t-r,l=e-n,c=(o?i:-i)/Ao(s*s+l*l),u=c*l,f=-c*s,h=t+u,d=e+f,p=r+u,m=n+f,g=(h+p)/2,v=(d+m)/2,y=p-h,b=m-d,x=y*y+b*b,w=a-i,S=h*m-p*d,k=(b<0?-1:1)*Ao(Do(0,w*w*x-S*S)),C=(S*b-y*k)/x,A=(-S*y-b*k)/x,M=(S*b+y*k)/x,T=(-S*y+b*k)/x,D=C-g,L=A-v,R=M-g,O=T-v;return D*D+L*L>R*R+O*O&&(C=M,A=T),{cx:C,cy:A,x0:-u,y0:-f,x1:C*(a/w-1),y1:A*(a/w-1)}}function S2(t){var e;if(ee(t)){var r=t.length;if(!r)return t;r===1?e=[t[0],t[0],0,0]:r===2?e=[t[0],t[0],t[1],t[1]]:r===3?e=t.concat(t[2]):e=t}else e=[t,t,t,t];return e}function k2(t,e){var r,n=Do(e.r,0),a=Do(e.r0||0,0),i=n>0,o=a>0;if(!(!i&&!o)){if(i||(n=a,a=0),a>n){var s=n;n=a,a=s}var l=e.startAngle,c=e.endAngle;if(!(isNaN(l)||isNaN(c))){var u=e.cx,f=e.cy,h=!!e.clockwise,d=cm(c-l),p=d>qf&&d%qf;if(p>Lr&&(d=p),!(n>Lr))t.moveTo(u,f);else if(d>qf-Lr)t.moveTo(u+n*bi(l),f+n*Da(l)),t.arc(u,f,n,l,c,!h),a>Lr&&(t.moveTo(u+a*bi(c),f+a*Da(c)),t.arc(u,f,a,c,l,h));else{var m=void 0,g=void 0,v=void 0,y=void 0,b=void 0,x=void 0,w=void 0,S=void 0,k=void 0,C=void 0,A=void 0,M=void 0,T=void 0,D=void 0,L=void 0,R=void 0,O=n*bi(l),B=n*Da(l),j=a*bi(c),P=a*Da(c),V=d>Lr;if(V){var H=e.cornerRadius;H&&(r=S2(H),m=r[0],g=r[1],v=r[2],y=r[3]);var Z=cm(n-a)/2;if(b=jr(Z,v),x=jr(Z,y),w=jr(Z,m),S=jr(Z,g),A=k=Do(b,x),M=C=Do(w,S),(k>Lr||C>Lr)&&(T=n*bi(c),D=n*Da(c),L=a*bi(l),R=a*Da(l),d<lm)){var re=w2(O,B,L,R,T,D,j,P);if(re){var Te=O-re[0],ge=B-re[1],xe=T-re[0],Ce=D-re[1],be=1/Da(x2((Te*xe+ge*Ce)/(Ao(Te*Te+ge*ge)*Ao(xe*xe+Ce*Ce)))/2),it=Ao(re[0]*re[0]+re[1]*re[1]);A=jr(k,(n-it)/(be+1)),M=jr(C,(a-it)/(be-1))}}}if(!V)t.moveTo(u+O,f+B);else if(A>Lr){var Qe=jr(v,A),ze=jr(y,A),oe=Bl(L,R,O,B,n,Qe,h),pe=Bl(T,D,j,P,n,ze,h);t.moveTo(u+oe.cx+oe.x0,f+oe.cy+oe.y0),A<k&&Qe===ze?t.arc(u+oe.cx,f+oe.cy,A,At(oe.y0,oe.x0),At(pe.y0,pe.x0),!h):(Qe>0&&t.arc(u+oe.cx,f+oe.cy,Qe,At(oe.y0,oe.x0),At(oe.y1,oe.x1),!h),t.arc(u,f,n,At(oe.cy+oe.y1,oe.cx+oe.x1),At(pe.cy+pe.y1,pe.cx+pe.x1),!h),ze>0&&t.arc(u+pe.cx,f+pe.cy,ze,At(pe.y1,pe.x1),At(pe.y0,pe.x0),!h))}else t.moveTo(u+O,f+B),t.arc(u,f,n,l,c,!h);if(!(a>Lr)||!V)t.lineTo(u+j,f+P);else if(M>Lr){var Qe=jr(m,M),ze=jr(g,M),oe=Bl(j,P,T,D,a,-ze,h),pe=Bl(O,B,L,R,a,-Qe,h);t.lineTo(u+oe.cx+oe.x0,f+oe.cy+oe.y0),M<C&&Qe===ze?t.arc(u+oe.cx,f+oe.cy,M,At(oe.y0,oe.x0),At(pe.y0,pe.x0),!h):(ze>0&&t.arc(u+oe.cx,f+oe.cy,ze,At(oe.y0,oe.x0),At(oe.y1,oe.x1),!h),t.arc(u,f,a,At(oe.cy+oe.y1,oe.cx+oe.x1),At(pe.cy+pe.y1,pe.cx+pe.x1),h),Qe>0&&t.arc(u+pe.cx,f+pe.cy,Qe,At(pe.y1,pe.x1),At(pe.y0,pe.x0),!h))}else t.lineTo(u+j,f+P),t.arc(u,f,a,c,l,h)}t.closePath()}}}var T2=(function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return t})(),xi=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new T2},e.prototype.buildPath=function(r,n){k2(r,n)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e})(qe);xi.prototype.type="sector";var C2=(function(){function t(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return t})(),Yf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new C2},e.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.PI*2;r.moveTo(a+n.r,i),r.arc(a,i,n.r,0,o,!1),r.moveTo(a+n.r0,i),r.arc(a,i,n.r0,0,o,!0)},e})(qe);Yf.prototype.type="ring";function M2(t,e,r,n){var a=[],i=[],o=[],s=[],l,c,u,f;if(n){u=[1/0,1/0],f=[-1/0,-1/0];for(var h=0,d=t.length;h<d;h++)ci(u,u,t[h]),ui(f,f,t[h]);ci(u,u,n[0]),ui(f,f,n[1])}for(var h=0,d=t.length;h<d;h++){var p=t[h];if(r)l=t[h?h-1:d-1],c=t[(h+1)%d];else if(h===0||h===d-1){a.push(hS(t[h]));continue}else l=t[h-1],c=t[h+1];pS(i,c,l),Xu(i,i,e);var m=Zu(p,l),g=Zu(p,c),v=m+g;v!==0&&(m/=v,g/=v),Xu(o,i,-m),Xu(s,i,g);var y=Ev([],p,o),b=Ev([],p,s);n&&(ui(y,y,u),ci(y,y,f),ui(b,b,u),ci(b,b,f)),a.push(y),a.push(b)}return r&&a.push(a.shift()),a}function um(t,e,r){var n=e.smooth,a=e.points;if(a&&a.length>=2){if(n){var i=M2(a,n,r,e.smoothConstraint);t.moveTo(a[0][0],a[0][1]);for(var o=a.length,s=0;s<(r?o:o-1);s++){var l=i[s*2],c=i[s*2+1],u=a[(s+1)%o];t.bezierCurveTo(l[0],l[1],c[0],c[1],u[0],u[1])}}else{t.moveTo(a[0][0],a[0][1]);for(var s=1,f=a.length;s<f;s++)t.lineTo(a[s][0],a[s][1])}r&&t.closePath()}}var A2=(function(){function t(){this.points=null,this.smooth=0,this.smoothConstraint=null}return t})(),Xf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new A2},e.prototype.buildPath=function(r,n){um(r,n,!0)},e})(qe);Xf.prototype.type="polygon";var D2=(function(){function t(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null}return t})(),Zf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new D2},e.prototype.buildPath=function(r,n){um(r,n,!1)},e})(qe);Zf.prototype.type="polyline";var I2={},L2=(function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return t})(),Hn=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new L2},e.prototype.buildPath=function(r,n){var a,i,o,s;if(this.subPixelOptimize){var l=ug(I2,n,this.style);a=l.x1,i=l.y1,o=l.x2,s=l.y2}else a=n.x1,i=n.y1,o=n.x2,s=n.y2;var c=n.percent;c!==0&&(r.moveTo(a,i),c<1&&(o=a*(1-c)+o*c,s=i*(1-c)+s*c),r.lineTo(o,s))},e.prototype.pointAt=function(r){var n=this.shape;return[n.x1*(1-r)+n.x2*r,n.y1*(1-r)+n.y2*r]},e})(qe);Hn.prototype.type="line";var Yt=[],P2=(function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1}return t})();function fm(t,e,r){var n=t.cpx2,a=t.cpy2;return n!=null||a!=null?[(r?Hv:wt)(t.x1,t.cpx1,t.cpx2,t.x2,e),(r?Hv:wt)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(r?Uv:Gt)(t.x1,t.cpx1,t.x2,e),(r?Uv:Gt)(t.y1,t.cpy1,t.y2,e)]}var Kf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new P2},e.prototype.buildPath=function(r,n){var a=n.x1,i=n.y1,o=n.x2,s=n.y2,l=n.cpx1,c=n.cpy1,u=n.cpx2,f=n.cpy2,h=n.percent;h!==0&&(r.moveTo(a,i),u==null||f==null?(h<1&&(il(a,l,o,h,Yt),l=Yt[1],o=Yt[2],il(i,c,s,h,Yt),c=Yt[1],s=Yt[2]),r.quadraticCurveTo(l,c,o,s)):(h<1&&(al(a,l,u,o,h,Yt),l=Yt[1],u=Yt[2],o=Yt[3],al(i,c,f,s,h,Yt),c=Yt[1],f=Yt[2],s=Yt[3]),r.bezierCurveTo(l,c,u,f,o,s)))},e.prototype.pointAt=function(r){return fm(this.shape,r,!1)},e.prototype.tangentAt=function(r){var n=fm(this.shape,r,!0);return mS(n,n)},e})(qe);Kf.prototype.type="bezier-curve";var R2=(function(){function t(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return t})(),zl=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new R2},e.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.max(n.r,0),s=n.startAngle,l=n.endAngle,c=n.clockwise,u=Math.cos(s),f=Math.sin(s);r.moveTo(u*o+a,f*o+i),r.arc(a,i,o,s,l,!c)},e})(qe);zl.prototype.type="arc";var E2=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="compound",r}return e.prototype._updatePathDirty=function(){for(var r=this.shape.paths,n=this.shapeChanged(),a=0;a<r.length;a++)n=n||r[a].shapeChanged();n&&this.dirtyShape()},e.prototype.beforeBrush=function(){this._updatePathDirty();for(var r=this.shape.paths||[],n=this.getGlobalScale(),a=0;a<r.length;a++)r[a].path||r[a].createPathProxy(),r[a].path.setScale(n[0],n[1],r[a].segmentIgnoreThreshold)},e.prototype.buildPath=function(r,n){for(var a=n.paths||[],i=0;i<a.length;i++)a[i].buildPath(r,a[i].shape,!0)},e.prototype.afterBrush=function(){for(var r=this.shape.paths||[],n=0;n<r.length;n++)r[n].pathUpdated()},e.prototype.getBoundingRect=function(){return this._updatePathDirty.call(this),qe.prototype.getBoundingRect.call(this)},e})(qe),dm=(function(){function t(e){this.colorStops=e||[]}return t.prototype.addColorStop=function(e,r){this.colorStops.push({offset:e,color:r})},t})(),hm=(function(t){K(e,t);function e(r,n,a,i,o,s){var l=t.call(this,o)||this;return l.x=r??0,l.y=n??0,l.x2=a??1,l.y2=i??0,l.type="linear",l.global=s||!1,l}return e})(dm),O2=(function(t){K(e,t);function e(r,n,a,i,o){var s=t.call(this,i)||this;return s.x=r??.5,s.y=n??.5,s.r=a??.5,s.type="radial",s.global=o||!1,s}return e})(dm),Ia=[0,0],La=[0,0],Fl=new Je,Hl=new Je,Vl=(function(){function t(e,r){this._corners=[],this._axes=[],this._origin=[0,0];for(var n=0;n<4;n++)this._corners[n]=new Je;for(var n=0;n<2;n++)this._axes[n]=new Je;e&&this.fromBoundingRect(e,r)}return t.prototype.fromBoundingRect=function(e,r){var n=this._corners,a=this._axes,i=e.x,o=e.y,s=i+e.width,l=o+e.height;if(n[0].set(i,o),n[1].set(s,o),n[2].set(s,l),n[3].set(i,l),r)for(var c=0;c<4;c++)n[c].transform(r);Je.sub(a[0],n[1],n[0]),Je.sub(a[1],n[3],n[0]),a[0].normalize(),a[1].normalize();for(var c=0;c<2;c++)this._origin[c]=a[c].dot(n[0])},t.prototype.intersect=function(e,r){var n=!0,a=!r;return Fl.set(1/0,1/0),Hl.set(0,0),!this._intersectCheckOneSide(this,e,Fl,Hl,a,1)&&(n=!1,a)||!this._intersectCheckOneSide(e,this,Fl,Hl,a,-1)&&(n=!1,a)||a||Je.copy(r,n?Fl:Hl),n},t.prototype._intersectCheckOneSide=function(e,r,n,a,i,o){for(var s=!0,l=0;l<2;l++){var c=this._axes[l];if(this._getProjMinMaxOnAxis(l,e._corners,Ia),this._getProjMinMaxOnAxis(l,r._corners,La),Ia[1]<La[0]||Ia[0]>La[1]){if(s=!1,i)return s;var u=Math.abs(La[0]-Ia[1]),f=Math.abs(Ia[0]-La[1]);Math.min(u,f)>a.len()&&(u<f?Je.scale(a,c,-u*o):Je.scale(a,c,f*o))}else if(n){var u=Math.abs(La[0]-Ia[1]),f=Math.abs(Ia[0]-La[1]);Math.min(u,f)<n.len()&&(u<f?Je.scale(n,c,u*o):Je.scale(n,c,-f*o))}}return s},t.prototype._getProjMinMaxOnAxis=function(e,r,n){for(var a=this._axes[e],i=this._origin,o=r[0].dot(a)+i[e],s=o,l=o,c=1;c<r.length;c++){var u=r[c].dot(a)+i[e];s=Math.min(u,s),l=Math.max(u,l)}n[0]=s,n[1]=l},t})(),N2=[],B2=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.notClear=!0,r.incremental=!0,r._displayables=[],r._temporaryDisplayables=[],r._cursor=0,r}return e.prototype.traverse=function(r,n){r.call(n,this)},e.prototype.useStyle=function(){this.style={}},e.prototype.getCursor=function(){return this._cursor},e.prototype.innerAfterBrush=function(){this._cursor=this._displayables.length},e.prototype.clearDisplaybles=function(){this._displayables=[],this._temporaryDisplayables=[],this._cursor=0,this.markRedraw(),this.notClear=!1},e.prototype.clearTemporalDisplayables=function(){this._temporaryDisplayables=[]},e.prototype.addDisplayable=function(r,n){n?this._temporaryDisplayables.push(r):this._displayables.push(r),this.markRedraw()},e.prototype.addDisplayables=function(r,n){n=n||!1;for(var a=0;a<r.length;a++)this.addDisplayable(r[a],n)},e.prototype.getDisplayables=function(){return this._displayables},e.prototype.getTemporalDisplayables=function(){return this._temporaryDisplayables},e.prototype.eachPendingDisplayable=function(r){for(var n=this._cursor;n<this._displayables.length;n++)r&&r(this._displayables[n]);for(var n=0;n<this._temporaryDisplayables.length;n++)r&&r(this._temporaryDisplayables[n])},e.prototype.update=function(){this.updateTransform();for(var r=this._cursor;r<this._displayables.length;r++){var n=this._displayables[r];n.parent=this,n.update(),n.parent=null}for(var r=0;r<this._temporaryDisplayables.length;r++){var n=this._temporaryDisplayables[r];n.parent=this,n.update(),n.parent=null}},e.prototype.getBoundingRect=function(){if(!this._rect){for(var r=new Ge(1/0,1/0,-1/0,-1/0),n=0;n<this._displayables.length;n++){var a=this._displayables[n],i=a.getBoundingRect().clone();a.needLocalTransform()&&i.applyTransform(a.getLocalTransform(N2)),r.union(i)}this._rect=r}return this._rect},e.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(i.contain(a[0],a[1]))for(var o=0;o<this._displayables.length;o++){var s=this._displayables[o];if(s.contain(r,n))return!0}return!1},e})(yo),z2=ht();function F2(t,e,r,n,a){var i;if(e&&e.ecModel){var o=e.ecModel.getUpdatePayload();i=o&&o.animation}var s=e&&e.isAnimationEnabled(),l=t==="update";if(s){var c=void 0,u=void 0,f=void 0;n?(c=Pe(n.duration,200),u=Pe(n.easing,"cubicOut"),f=0):(c=e.getShallow(l?"animationDurationUpdate":"animationDuration"),u=e.getShallow(l?"animationEasingUpdate":"animationEasing"),f=e.getShallow(l?"animationDelayUpdate":"animationDelay")),i&&(i.duration!=null&&(c=i.duration),i.easing!=null&&(u=i.easing),i.delay!=null&&(f=i.delay)),ke(f)&&(f=f(r,a)),ke(c)&&(c=c(r));var h={duration:c||0,delay:f,easing:u};return h}else return null}function jf(t,e,r,n,a,i,o){var s=!1,l;ke(a)?(o=i,i=a,a=null):de(a)&&(i=a.cb,o=a.during,s=a.isFrom,l=a.removeOpt,a=a.dataIndex);var c=t==="leave";c||e.stopAnimation("leave");var u=F2(t,n,a,c?l||{}:null,n&&n.getAnimationDelayParams?n.getAnimationDelayParams(e,a):null);if(u&&u.duration>0){var f=u.duration,h=u.delay,d=u.easing,p={duration:f,delay:h||0,easing:d,done:i,force:!!i||!!o,setToFinal:!c,scope:t,during:o};s?e.animateFrom(r,p):e.animateTo(r,p)}else e.stopAnimation(),!s&&e.attr(r),o&&o(1),i&&i()}function or(t,e,r,n,a,i){jf("update",t,e,r,n,a,i)}function _n(t,e,r,n,a,i){jf("enter",t,e,r,n,a,i)}function Io(t){if(!t.__zr)return!0;for(var e=0;e<t.animators.length;e++){var r=t.animators[e];if(r.scope==="leave")return!0}return!1}function Ul(t,e,r,n,a,i){Io(t)||jf("leave",t,e,r,n,a,i)}function pm(t,e,r,n){t.removeTextContent(),t.removeTextGuideLine(),Ul(t,{style:{opacity:0}},e,r,n)}function Jf(t,e,r){function n(){t.parent&&t.parent.remove(t)}t.isGroup?t.traverse(function(a){a.isGroup||pm(a,e,r,n)}):pm(t,e,r,n)}function vm(t){z2(t).oldStyle=t.style}var Gl=Math.max,$l=Math.min,Qf={};function H2(t){return qe.extend(t)}var V2=m2;function U2(t,e){return V2(t,e)}function Pr(t,e){Qf[t]=e}function G2(t){if(Qf.hasOwnProperty(t))return Qf[t]}function ed(t,e,r,n){var a=g2(t,e);return r&&(n==="center"&&(r=mm(r,a.getBoundingRect())),ym(a,r)),a}function gm(t,e,r){var n=new Fn({style:{image:t,x:e.x,y:e.y,width:e.width,height:e.height},onload:function(a){if(r==="center"){var i={width:a.width,height:a.height};n.setStyle(mm(e,i))}}});return n}function mm(t,e){var r=e.width/e.height,n=t.height*r,a;n<=t.width?a=t.height:(n=t.width,a=n/r);var i=t.x+t.width/2,o=t.y+t.height/2;return{x:i-n/2,y:o-a/2,width:n,height:a}}var $2=y2;function ym(t,e){if(t.applyTransform){var r=t.getBoundingRect(),n=r.calculateTransform(e);t.applyTransform(n)}}function Lo(t,e){return ug(t,t,{lineWidth:e}),t}function W2(t){return fg(t.shape,t.shape,t.style),t}var q2=Ta;function Y2(t,e){for(var r=Hu([]);t&&t!==e;)ii(r,t.getLocalTransform(),r),t=t.parent;return r}function td(t,e,r){return e&&!Vt(e)&&(e=Ju.getLocalTransform(e)),r&&(e=Gu([],e)),dr([],t,e)}function X2(t,e,r){var n=e[4]===0||e[5]===0||e[0]===0?1:Math.abs(2*e[4]/e[0]),a=e[4]===0||e[5]===0||e[2]===0?1:Math.abs(2*e[4]/e[2]),i=[t==="left"?-n:t==="right"?n:0,t==="top"?-a:t==="bottom"?a:0];return i=td(i,e,r),Math.abs(i[0])>Math.abs(i[1])?i[0]>0?"right":"left":i[1]>0?"bottom":"top"}function _m(t){return!t.isGroup}function Z2(t){return t.shape!=null}function bm(t,e,r){if(!t||!e)return;function n(o){var s={};return o.traverse(function(l){_m(l)&&l.anid&&(s[l.anid]=l)}),s}function a(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Z2(o)&&(s.shape=q({},o.shape)),s}var i=n(t);e.traverse(function(o){if(_m(o)&&o.anid){var s=i[o.anid];if(s){var l=a(o);o.attr(a(s)),or(o,l,r,We(o).dataIndex)}}})}function K2(t,e){return he(t,function(r){var n=r[0];n=Gl(n,e.x),n=$l(n,e.x+e.width);var a=r[1];return a=Gl(a,e.y),a=$l(a,e.y+e.height),[n,a]})}function j2(t,e){var r=Gl(t.x,e.x),n=$l(t.x+t.width,e.x+e.width),a=Gl(t.y,e.y),i=$l(t.y+t.height,e.y+e.height);if(n>=r&&i>=a)return{x:r,y:a,width:n-r,height:i-a}}function rd(t,e,r){var n=q({rectHover:!0},e),a=n.style={strokeNoScale:!0};if(r=r||{x:-1,y:-1,width:2,height:2},t)return t.indexOf("image://")===0?(a.image=t.slice(8),He(a,r),new Fn(n)):ed(t.replace("path://",""),n,r,"center")}function J2(t,e,r,n,a){for(var i=0,o=a[a.length-1];i<a.length;i++){var s=a[i];if(xm(t,e,r,n,s[0],s[1],o[0],o[1]))return!0;o=s}}function xm(t,e,r,n,a,i,o,s){var l=r-t,c=n-e,u=o-a,f=s-i,h=nd(u,f,l,c);if(Q2(h))return!1;var d=t-a,p=e-i,m=nd(d,p,l,c)/h;if(m<0||m>1)return!1;var g=nd(d,p,u,f)/h;return!(g<0||g>1)}function nd(t,e,r,n){return t*n-r*e}function Q2(t){return t<=1e-6&&t>=-1e-6}function Wl(t){var e=t.itemTooltipOption,r=t.componentModel,n=t.itemName,a=ae(e)?{formatter:e}:e,i=r.mainType,o=r.componentIndex,s={componentType:i,name:n,$vars:["name"]};s[i+"Index"]=o;var l=t.formatterParamsExtra;l&&I(at(l),function(u){la(s,u)||(s[u]=l[u],s.$vars.push(u))});var c=We(t.el);c.componentMainType=i,c.componentIndex=o,c.tooltipConfig={name:n,option:He({content:n,encodeHTMLContent:!0,formatterParams:s},a)}}function wm(t,e){var r;t.isGroup&&(r=e(t)),r||t.traverse(e)}function ql(t,e){if(t)if(ee(t))for(var r=0;r<t.length;r++)wm(t[r],e);else wm(t,e)}Pr("circle",Nl),Pr("ellipse",Wf),Pr("sector",xi),Pr("ring",Yf),Pr("polygon",Xf),Pr("polyline",Zf),Pr("rect",_t),Pr("line",Hn),Pr("bezierCurve",Kf),Pr("arc",zl);const eT=Object.freeze(Object.defineProperty({__proto__:null,Arc:zl,BezierCurve:Kf,BoundingRect:Ge,Circle:Nl,CompoundPath:E2,Ellipse:Wf,Group:St,Image:Fn,IncrementalDisplayable:B2,Line:Hn,LinearGradient:hm,OrientedBoundingRect:Vl,Path:qe,Point:Je,Polygon:Xf,Polyline:Zf,RadialGradient:O2,Rect:_t,Ring:Yf,Sector:xi,Text:$t,applyTransform:td,clipPointsByRect:K2,clipRectByRect:j2,createIcon:rd,extendPath:U2,extendShape:H2,getShapeClass:G2,getTransform:Y2,groupTransition:bm,initProps:_n,isElementRemoved:Io,lineLineIntersect:xm,linePolygonIntersect:J2,makeImage:gm,makePath:ed,mergePath:$2,registerShape:Pr,removeElement:Ul,removeElementWithFadeOut:Jf,resizePath:ym,setTooltipConfig:Wl,subPixelOptimize:q2,subPixelOptimizeLine:Lo,subPixelOptimizeRect:W2,transformDirection:X2,traverseElements:ql,updateProps:or},Symbol.toStringTag,{value:"Module"}));var Yl={};function tT(t,e){for(var r=0;r<Kr.length;r++){var n=Kr[r],a=e[n],i=t.ensureState(n);i.style=i.style||{},i.style.text=a}var o=t.currentStates.slice();t.clearStates(!0),t.setStyle({text:e.normal}),t.useStates(o,!0)}function Sm(t,e,r){var n=t.labelFetcher,a=t.labelDataIndex,i=t.labelDimIndex,o=e.normal,s;n&&(s=n.getFormattedLabel(a,"normal",null,i,o&&o.get("formatter"),r!=null?{interpolatedValue:r}:null)),s==null&&(s=ke(t.defaultText)?t.defaultText(a,t,r):t.defaultText);for(var l={normal:s},c=0;c<Kr.length;c++){var u=Kr[c],f=e[u];l[u]=Pe(n?n.getFormattedLabel(a,u,null,i,f&&f.get("formatter")):null,s)}return l}function Xl(t,e,r,n){r=r||Yl;for(var a=t instanceof $t,i=!1,o=0;o<zg.length;o++){var s=e[zg[o]];if(s&&s.getShallow("show")){i=!0;break}}var l=a?t:t.getTextContent();if(i){a||(l||(l=new $t,t.setTextContent(l)),t.stateProxy&&(l.stateProxy=t.stateProxy));var c=Sm(r,e),u=e.normal,f=!!u.getShallow("show"),h=wi(u,n&&n.normal,r,!1,!a);h.text=c.normal,a||t.setTextConfig(km(u,r,!1));for(var o=0;o<Kr.length;o++){var d=Kr[o],s=e[d];if(s){var p=l.ensureState(d),m=!!Pe(s.getShallow("show"),f);if(m!==f&&(p.ignore=!m),p.style=wi(s,n&&n[d],r,!0,!a),p.style.text=c[d],!a){var g=t.ensureState(d);g.textConfig=km(s,r,!0)}}}l.silent=!!u.getShallow("silent"),l.style.x!=null&&(h.x=l.style.x),l.style.y!=null&&(h.y=l.style.y),l.ignore=!f,l.useStyle(h),l.dirty(),r.enableTextSetter&&(Kl(l).setLabelText=function(v){var y=Sm(r,e,v);tT(l,y)})}else l&&(l.ignore=!0);t.dirty()}function Zl(t,e){e=e||"label";for(var r={normal:t.getModel(e)},n=0;n<Kr.length;n++){var a=Kr[n];r[a]=t.getModel([a,e])}return r}function wi(t,e,r,n,a){var i={};return rT(i,t,r,n,a),e&&q(i,e),i}function km(t,e,r){e=e||{};var n={},a,i=t.getShallow("rotate"),o=Pe(t.getShallow("distance"),r?null:5),s=t.getShallow("offset");return a=t.getShallow("position")||(r?null:"inside"),a==="outside"&&(a=e.defaultOutsidePosition||"top"),a!=null&&(n.position=a),s!=null&&(n.offset=s),i!=null&&(i*=Math.PI/180,n.rotation=i),o!=null&&(n.distance=o),n.outsideFill=t.get("color")==="inherit"?e.inheritColor||null:"auto",n}function rT(t,e,r,n,a){r=r||Yl;var i=e.ecModel,o=i&&i.option.textStyle,s=nT(e),l;if(s){l={};for(var c in s)if(s.hasOwnProperty(c)){var u=e.getModel(["rich",c]);Am(l[c]={},u,o,r,n,a,!1,!0)}}l&&(t.rich=l);var f=e.get("overflow");f&&(t.overflow=f);var h=e.get("minMargin");h!=null&&(t.margin=h),Am(t,e,o,r,n,a,!0,!1)}function nT(t){for(var e;t&&t!==t.ecModel;){var r=(t.option||Yl).rich;if(r){e=e||{};for(var n=at(r),a=0;a<n.length;a++){var i=n[a];e[i]=1}}t=t.parentModel}return e}var Tm=["fontStyle","fontWeight","fontSize","fontFamily","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY"],Cm=["align","lineHeight","width","height","tag","verticalAlign","ellipsis"],Mm=["padding","borderWidth","borderRadius","borderDashOffset","backgroundColor","borderColor","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];function Am(t,e,r,n,a,i,o,s){r=!a&&r||Yl;var l=n&&n.inheritColor,c=e.getShallow("color"),u=e.getShallow("textBorderColor"),f=Pe(e.getShallow("opacity"),r.opacity);(c==="inherit"||c==="auto")&&(l?c=l:c=null),(u==="inherit"||u==="auto")&&(l?u=l:u=null),i||(c=c||r.color,u=u||r.textBorderColor),c!=null&&(t.fill=c),u!=null&&(t.stroke=u);var h=Pe(e.getShallow("textBorderWidth"),r.textBorderWidth);h!=null&&(t.lineWidth=h);var d=Pe(e.getShallow("textBorderType"),r.textBorderType);d!=null&&(t.lineDash=d);var p=Pe(e.getShallow("textBorderDashOffset"),r.textBorderDashOffset);p!=null&&(t.lineDashOffset=p),!a&&f==null&&!s&&(f=n&&n.defaultOpacity),f!=null&&(t.opacity=f),!a&&!i&&t.fill==null&&n.inheritColor&&(t.fill=n.inheritColor);for(var m=0;m<Tm.length;m++){var g=Tm[m],v=Pe(e.getShallow(g),r[g]);v!=null&&(t[g]=v)}for(var m=0;m<Cm.length;m++){var g=Cm[m],v=e.getShallow(g);v!=null&&(t[g]=v)}if(t.verticalAlign==null){var y=e.getShallow("baseline");y!=null&&(t.verticalAlign=y)}if(!o||!n.disableBox){for(var m=0;m<Mm.length;m++){var g=Mm[m],v=e.getShallow(g);v!=null&&(t[g]=v)}var b=e.getShallow("borderType");b!=null&&(t.borderDash=b),(t.backgroundColor==="auto"||t.backgroundColor==="inherit")&&l&&(t.backgroundColor=l),(t.borderColor==="auto"||t.borderColor==="inherit")&&l&&(t.borderColor=l)}}function aT(t,e){var r=e&&e.getModel("textStyle");return Gr([t.fontStyle||r&&r.getShallow("fontStyle")||"",t.fontWeight||r&&r.getShallow("fontWeight")||"",(t.fontSize||r&&r.getShallow("fontSize")||12)+"px",t.fontFamily||r&&r.getShallow("fontFamily")||"sans-serif"].join(" "))}var Kl=ht();function iT(t,e,r,n){if(t){var a=Kl(t);a.prevValue=a.value,a.value=r;var i=e.normal;a.valueAnimation=i.get("valueAnimation"),a.valueAnimation&&(a.precision=i.get("precision"),a.defaultInterpolatedText=n,a.statesModels=e)}}var oT=["textStyle","color"],ad=["fontStyle","fontWeight","fontSize","fontFamily","padding","lineHeight","rich","width","height","overflow"],id=new $t,sT=(function(){function t(){}return t.prototype.getTextColor=function(e){var r=this.ecModel;return this.getShallow("color")||(!e&&r?r.get(oT):null)},t.prototype.getFont=function(){return aT({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},t.prototype.getTextRect=function(e){for(var r={text:e,verticalAlign:this.getShallow("verticalAlign")||this.getShallow("baseline")},n=0;n<ad.length;n++)r[ad[n]]=this.getShallow(ad[n]);return id.useStyle(r),id.update(),id.getBoundingRect()},t})(),Dm=[["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","type"],["lineDashOffset","dashOffset"],["lineCap","cap"],["lineJoin","join"],["miterLimit"]],lT=oo(Dm),cT=(function(){function t(){}return t.prototype.getLineStyle=function(e){return lT(this,e)},t})(),Im=[["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","borderType"],["lineDashOffset","borderDashOffset"],["lineCap","borderCap"],["lineJoin","borderJoin"],["miterLimit","borderMiterLimit"]],uT=oo(Im),fT=(function(){function t(){}return t.prototype.getItemStyle=function(e,r){return uT(this,e,r)},t})(),lt=(function(){function t(e,r,n){this.parentModel=r,this.ecModel=n,this.option=e}return t.prototype.init=function(e,r,n){},t.prototype.mergeOption=function(e,r){Oe(this.option,e,!0)},t.prototype.get=function(e,r){return e==null?this.option:this._doGet(this.parsePath(e),!r&&this.parentModel)},t.prototype.getShallow=function(e,r){var n=this.option,a=n==null?n:n[e];if(a==null&&!r){var i=this.parentModel;i&&(a=i.getShallow(e))}return a},t.prototype.getModel=function(e,r){var n=e!=null,a=n?this.parsePath(e):null,i=n?this._doGet(a):this.option;return r=r||this.parentModel&&this.parentModel.getModel(this.resolveParentPath(a)),new t(i,r,this.ecModel)},t.prototype.isEmpty=function(){return this.option==null},t.prototype.restoreData=function(){},t.prototype.clone=function(){var e=this.constructor;return new e(Ie(this.option))},t.prototype.parsePath=function(e){return typeof e=="string"?e.split("."):e},t.prototype.resolveParentPath=function(e){return e},t.prototype.isAnimationEnabled=function(){if(!_e.node&&this.option){if(this.option.animation!=null)return!!this.option.animation;if(this.parentModel)return this.parentModel.isAnimationEnabled()}},t.prototype._doGet=function(e,r){var n=this.option;if(!e)return n;for(var a=0;a<e.length&&!(e[a]&&(n=n&&typeof n=="object"?n[e[a]]:null,n==null));a++);return n==null&&r&&(n=r._doGet(this.resolveParentPath(e),r.parentModel)),n},t})();zu(lt),Xw(lt),Ur(lt,cT),Ur(lt,fT),Ur(lt,Qw),Ur(lt,sT);function Po(t){return t==null?0:t.length||1}function Lm(t){return t}var dT=(function(){function t(e,r,n,a,i,o){this._old=e,this._new=r,this._oldKeyGetter=n||Lm,this._newKeyGetter=a||Lm,this.context=i,this._diffModeMultiple=o==="multiple"}return t.prototype.add=function(e){return this._add=e,this},t.prototype.update=function(e){return this._update=e,this},t.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},t.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},t.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},t.prototype.remove=function(e){return this._remove=e,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var e=this._old,r=this._new,n={},a=new Array(e.length),i=new Array(r.length);this._initIndexMap(e,null,a,"_oldKeyGetter"),this._initIndexMap(r,n,i,"_newKeyGetter");for(var o=0;o<e.length;o++){var s=a[o],l=n[s],c=Po(l);if(c>1){var u=l.shift();l.length===1&&(n[s]=l[0]),this._update&&this._update(u,o)}else c===1?(n[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(i,n)},t.prototype._executeMultiple=function(){var e=this._old,r=this._new,n={},a={},i=[],o=[];this._initIndexMap(e,n,i,"_oldKeyGetter"),this._initIndexMap(r,a,o,"_newKeyGetter");for(var s=0;s<i.length;s++){var l=i[s],c=n[l],u=a[l],f=Po(c),h=Po(u);if(f>1&&h===1)this._updateManyToOne&&this._updateManyToOne(u,c),a[l]=null;else if(f===1&&h>1)this._updateOneToMany&&this._updateOneToMany(u,c),a[l]=null;else if(f===1&&h===1)this._update&&this._update(u,c),a[l]=null;else if(f>1&&h>1)this._updateManyToMany&&this._updateManyToMany(u,c),a[l]=null;else if(f>1)for(var d=0;d<f;d++)this._remove&&this._remove(c[d]);else this._remove&&this._remove(c)}this._performRestAdd(o,a)},t.prototype._performRestAdd=function(e,r){for(var n=0;n<e.length;n++){var a=e[n],i=r[a],o=Po(i);if(o>1)for(var s=0;s<o;s++)this._add&&this._add(i[s]);else o===1&&this._add&&this._add(i);r[a]=null}},t.prototype._initIndexMap=function(e,r,n,a){for(var i=this._diffModeMultiple,o=0;o<e.length;o++){var s="_ec_"+this[a](e[o],o);if(i||(n[o]=s),!!r){var l=r[s],c=Po(l);c===0?(r[s]=o,i&&n.push(s)):c===1?r[s]=[l,o]:l.push(o)}}},t})(),Pm=me(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),yr="original",Xt="arrayRows",Jr="objectRows",bn="keyedColumns",Vn="typedArray",Rm="unknown",xn="column",Si="row",sr={Must:1,Might:2,Not:3},Em=ht();function hT(t){Em(t).datasetMap=me()}function pT(t,e,r){var n={},a=Om(e);if(!a||!t)return n;var i=[],o=[],s=e.ecModel,l=Em(s).datasetMap,c=a.uid+"_"+r.seriesLayoutBy,u,f;t=t.slice(),I(t,function(m,g){var v=de(m)?m:t[g]={name:m};v.type==="ordinal"&&u==null&&(u=g,f=p(v)),n[v.name]=[]});var h=l.get(c)||l.set(c,{categoryWayDim:f,valueWayDim:0});I(t,function(m,g){var v=m.name,y=p(m);if(u==null){var b=h.valueWayDim;d(n[v],b,y),d(o,b,y),h.valueWayDim+=y}else if(u===g)d(n[v],0,y),d(i,0,y);else{var b=h.categoryWayDim;d(n[v],b,y),d(o,b,y),h.categoryWayDim+=y}});function d(m,g,v){for(var y=0;y<v;y++)m.push(g+y)}function p(m){var g=m.dimsDef;return g?g.length:1}return i.length&&(n.itemName=i),o.length&&(n.seriesName=o),n}function Om(t){var e=t.get("data",!0);if(!e)return ko(t.ecModel,"dataset",{index:t.get("datasetIndex",!0),id:t.get("datasetId",!0)},qt).models[0]}function vT(t){return!t.get("transform",!0)&&!t.get("fromTransformResult",!0)?[]:ko(t.ecModel,"dataset",{index:t.get("fromDatasetIndex",!0),id:t.get("fromDatasetId",!0)},qt).models}function Nm(t,e){return gT(t.data,t.sourceFormat,t.seriesLayoutBy,t.dimensionsDefine,t.startIndex,e)}function gT(t,e,r,n,a,i){var o,s=5;if(Ut(t))return sr.Not;var l,c;if(n){var u=n[i];de(u)?(l=u.name,c=u.type):ae(u)&&(l=u)}if(c!=null)return c==="ordinal"?sr.Must:sr.Not;if(e===Xt){var f=t;if(r===Si){for(var h=f[i],d=0;d<(h||[]).length&&d<s;d++)if((o=x(h[a+d]))!=null)return o}else for(var d=0;d<f.length&&d<s;d++){var p=f[a+d];if(p&&(o=x(p[i]))!=null)return o}}else if(e===Jr){var m=t;if(!l)return sr.Not;for(var d=0;d<m.length&&d<s;d++){var g=m[d];if(g&&(o=x(g[l]))!=null)return o}}else if(e===bn){var v=t;if(!l)return sr.Not;var h=v[l];if(!h||Ut(h))return sr.Not;for(var d=0;d<h.length&&d<s;d++)if((o=x(h[d]))!=null)return o}else if(e===yr)for(var y=t,d=0;d<y.length&&d<s;d++){var g=y[d],b=xo(g);if(!ee(b))return sr.Not;if((o=x(b[i]))!=null)return o}function x(w){var S=ae(w);if(w!=null&&Number.isFinite(Number(w))&&w!=="")return S?sr.Might:sr.Not;if(S&&w!=="-")return sr.Must}return sr.Not}var jl=(function(){function t(e){this.data=e.data||(e.sourceFormat===bn?{}:[]),this.sourceFormat=e.sourceFormat||Rm,this.seriesLayoutBy=e.seriesLayoutBy||xn,this.startIndex=e.startIndex||0,this.dimensionsDetectedCount=e.dimensionsDetectedCount,this.metaRawOption=e.metaRawOption;var r=this.dimensionsDefine=e.dimensionsDefine;if(r)for(var n=0;n<r.length;n++){var a=r[n];a.type==null&&Nm(this,n)===sr.Must&&(a.type="ordinal")}}return t})();function od(t){return t instanceof jl}function sd(t,e,r){r=r||zm(t);var n=e.seriesLayoutBy,a=yT(t,r,n,e.sourceHeader,e.dimensions),i=new jl({data:t,sourceFormat:r,seriesLayoutBy:n,dimensionsDefine:a.dimensionsDefine,startIndex:a.startIndex,dimensionsDetectedCount:a.dimensionsDetectedCount,metaRawOption:Ie(e)});return i}function Bm(t){return new jl({data:t,sourceFormat:Ut(t)?Vn:yr})}function mT(t){return new jl({data:t.data,sourceFormat:t.sourceFormat,seriesLayoutBy:t.seriesLayoutBy,dimensionsDefine:Ie(t.dimensionsDefine),startIndex:t.startIndex,dimensionsDetectedCount:t.dimensionsDetectedCount})}function zm(t){var e=Rm;if(Ut(t))e=Vn;else if(ee(t)){t.length===0&&(e=Xt);for(var r=0,n=t.length;r<n;r++){var a=t[r];if(a!=null){if(ee(a)||Ut(a)){e=Xt;break}else if(de(a)){e=Jr;break}}}}else if(de(t)){for(var i in t)if(la(t,i)&&Vt(t[i])){e=bn;break}}return e}function yT(t,e,r,n,a){var i,o;if(!t)return{dimensionsDefine:Fm(a),startIndex:o,dimensionsDetectedCount:i};if(e===Xt){var s=t;n==="auto"||n==null?Hm(function(c){c!=null&&c!=="-"&&(ae(c)?o==null&&(o=1):o=0)},r,s,10):o=et(n)?n:n?1:0,!a&&o===1&&(a=[],Hm(function(c,u){a[u]=c!=null?c+"":""},r,s,1/0)),i=a?a.length:r===Si?s.length:s[0]?s[0].length:null}else if(e===Jr)a||(a=_T(t));else if(e===bn)a||(a=[],I(t,function(c,u){a.push(u)}));else if(e===yr){var l=xo(t[0]);i=ee(l)&&l.length||1}return{startIndex:o,dimensionsDefine:Fm(a),dimensionsDetectedCount:i}}function _T(t){for(var e=0,r;e<t.length&&!(r=t[e++]););if(r)return at(r)}function Fm(t){if(t){var e=me();return he(t,function(r,n){r=de(r)?r:{name:r};var a={name:r.name,displayName:r.displayName,type:r.type};if(a.name==null)return a;a.name+="",a.displayName==null&&(a.displayName=a.name);var i=e.get(a.name);return i?a.name+="-"+i.count++:e.set(a.name,{count:1}),a})}}function Hm(t,e,r,n){if(e===Si)for(var a=0;a<r.length&&a<n;a++)t(r[a]?r[a][0]:null,a);else for(var i=r[0]||[],a=0;a<i.length&&a<n;a++)t(i[a],a)}function Vm(t){var e=t.sourceFormat;return e===Jr||e===bn}var Pa,Ra,Ea,Um,Gm,$m=(function(){function t(e,r){var n=od(e)?e:Bm(e);this._source=n;var a=this._data=n.data;n.sourceFormat===Vn&&(this._offset=0,this._dimSize=r,this._data=a),Gm(this,a,n)}return t.prototype.getSource=function(){return this._source},t.prototype.count=function(){return 0},t.prototype.getItem=function(e,r){},t.prototype.appendData=function(e){},t.prototype.clean=function(){},t.protoInitialize=(function(){var e=t.prototype;e.pure=!1,e.persistent=!0})(),t.internalField=(function(){var e;Gm=function(o,s,l){var c=l.sourceFormat,u=l.seriesLayoutBy,f=l.startIndex,h=l.dimensionsDefine,d=Um[cd(c,u)];if(q(o,d),c===Vn)o.getItem=r,o.count=a,o.fillStorage=n;else{var p=qm(c,u);o.getItem=Ne(p,null,s,f,h);var m=Xm(c,u);o.count=Ne(m,null,s,f,h)}};var r=function(o,s){o=o-this._offset,s=s||[];for(var l=this._data,c=this._dimSize,u=c*o,f=0;f<c;f++)s[f]=l[u+f];return s},n=function(o,s,l,c){for(var u=this._data,f=this._dimSize,h=0;h<f;h++){for(var d=c[h],p=d[0]==null?1/0:d[0],m=d[1]==null?-1/0:d[1],g=s-o,v=l[h],y=0;y<g;y++){var b=u[y*f+h];v[o+y]=b,b<p&&(p=b),b>m&&(m=b)}d[0]=p,d[1]=m}},a=function(){return this._data?this._data.length/this._dimSize:0};Um=(e={},e[Xt+"_"+xn]={pure:!0,appendData:i},e[Xt+"_"+Si]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[Jr]={pure:!0,appendData:i},e[bn]={pure:!0,appendData:function(o){var s=this._data;I(o,function(l,c){for(var u=s[c]||(s[c]=[]),f=0;f<(l||[]).length;f++)u.push(l[f])})}},e[yr]={appendData:i},e[Vn]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},e);function i(o){for(var s=0;s<o.length;s++)this._data.push(o[s])}})(),t})(),Wm=function(t,e,r,n){return t[n]},bT=(Pa={},Pa[Xt+"_"+xn]=function(t,e,r,n){return t[n+e]},Pa[Xt+"_"+Si]=function(t,e,r,n,a){n+=e;for(var i=a||[],o=t,s=0;s<o.length;s++){var l=o[s];i[s]=l?l[n]:null}return i},Pa[Jr]=Wm,Pa[bn]=function(t,e,r,n,a){for(var i=a||[],o=0;o<r.length;o++){var s=r[o].name,l=t[s];i[o]=l?l[n]:null}return i},Pa[yr]=Wm,Pa);function qm(t,e){var r=bT[cd(t,e)];return r}var Ym=function(t,e,r){return t.length},xT=(Ra={},Ra[Xt+"_"+xn]=function(t,e,r){return Math.max(0,t.length-e)},Ra[Xt+"_"+Si]=function(t,e,r){var n=t[0];return n?Math.max(0,n.length-e):0},Ra[Jr]=Ym,Ra[bn]=function(t,e,r){var n=r[0].name,a=t[n];return a?a.length:0},Ra[yr]=Ym,Ra);function Xm(t,e){var r=xT[cd(t,e)];return r}var ld=function(t,e,r){return t[e]},wT=(Ea={},Ea[Xt]=ld,Ea[Jr]=function(t,e,r){return t[r]},Ea[bn]=ld,Ea[yr]=function(t,e,r){var n=xo(t);return n instanceof Array?n[e]:n},Ea[Vn]=ld,Ea);function Zm(t){var e=wT[t];return e}function cd(t,e){return t===Xt?t+"_"+e:t}function ki(t,e,r){if(t){var n=t.getRawDataItem(e);if(n!=null){var a=t.getStore(),i=a.getSource().sourceFormat;if(r!=null){var o=t.getDimensionIndex(r),s=a.getDimensionProperty(o);return Zm(i)(n,o,s)}else{var l=n;return i===yr&&(l=xo(n)),l}}}}var ST=(function(){function t(e,r){this._encode=e,this._schema=r}return t.prototype.get=function(){return{fullDimensions:this._getFullDimensionNames(),encode:this._encode}},t.prototype._getFullDimensionNames=function(){return this._cachedDimNames||(this._cachedDimNames=this._schema?this._schema.makeOutputDimensionNames():[]),this._cachedDimNames},t})();function kT(t,e){var r={},n=r.encode={},a=me(),i=[],o=[],s={};I(t.dimensions,function(h){var d=t.getDimensionInfo(h),p=d.coordDim;if(p){var m=d.coordDimIndex;ud(n,p)[m]=h,d.isExtraCoord||(a.set(p,1),CT(d.type)&&(i[0]=h),ud(s,p)[m]=t.getDimensionIndex(d.name)),d.defaultTooltip&&o.push(h)}Pm.each(function(g,v){var y=ud(n,v),b=d.otherDims[v];b!=null&&b!==!1&&(y[b]=d.name)})});var l=[],c={};a.each(function(h,d){var p=n[d];c[d]=p[0],l=l.concat(p)}),r.dataDimsOnCoord=l,r.dataDimIndicesOnCoord=he(l,function(h){return t.getDimensionInfo(h).storeDimIndex}),r.encodeFirstDimNotExtra=c;var u=n.label;u&&u.length&&(i=u.slice());var f=n.tooltip;return f&&f.length?o=f.slice():o.length||(o=i.slice()),n.defaultedLabel=i,n.defaultedTooltip=o,r.userOutput=new ST(s,e),r}function ud(t,e){return t.hasOwnProperty(e)||(t[e]=[]),t[e]}function TT(t){return t==="category"?"ordinal":t==="time"?"time":"float"}function CT(t){return!(t==="ordinal"||t==="time")}var Jl=(function(){function t(e){this.otherDims={},e!=null&&q(this,e)}return t})();function Ql(t,e){var r=e&&e.type;return r==="ordinal"?t:(r==="time"&&!et(t)&&t!=null&&t!=="-"&&(t=+mn(t)),t==null||t===""?NaN:Number(t))}me({number:function(t){return parseFloat(t)},time:function(t){return+mn(t)},trim:function(t){return ae(t)?Gr(t):t}});var MT=(function(){function t(e,r){var n=e==="desc";this._resultLT=n?1:-1,r==null&&(r=n?"min":"max"),this._incomparable=r==="min"?-1/0:1/0}return t.prototype.evaluate=function(e,r){var n=et(e)?e:Tl(e),a=et(r)?r:Tl(r),i=isNaN(n),o=isNaN(a);if(i&&(n=this._incomparable),o&&(a=this._incomparable),i&&o){var s=ae(e),l=ae(r);s&&(n=l?e:0),l&&(a=s?r:0)}return n<a?this._resultLT:n>a?-this._resultLT:0},t})(),ec="undefined",AT=typeof Uint32Array===ec?Array:Uint32Array,DT=typeof Uint16Array===ec?Array:Uint16Array,Km=typeof Int32Array===ec?Array:Int32Array,jm=typeof Float64Array===ec?Array:Float64Array,Jm={float:jm,int:Km,ordinal:Array,number:Array,time:jm},fd;function Ti(t){return t>65535?AT:DT}function Ci(){return[1/0,-1/0]}function IT(t){var e=t.constructor;return e===Array?t.slice():new e(t)}function Qm(t,e,r,n,a){var i=Jm[r||"float"];if(a){var o=t[e],s=o&&o.length;if(s!==n){for(var l=new i(n),c=0;c<s;c++)l[c]=o[c];t[e]=l}}else t[e]=new i(n)}var dd=(function(){function t(){this._chunks=[],this._rawExtent=[],this._extent=[],this._count=0,this._rawCount=0,this._calcDimNameToIdx=me()}return t.prototype.initData=function(e,r,n){this._provider=e,this._chunks=[],this._indices=null,this.getRawIndex=this._getRawIdxIdentity;var a=e.getSource(),i=this.defaultDimValueGetter=fd[a.sourceFormat];this._dimValueGetter=n||i,this._rawExtent=[],Vm(a),this._dimensions=he(r,function(o){return{type:o.type,property:o.property}}),this._initDataFromProvider(0,e.count())},t.prototype.getProvider=function(){return this._provider},t.prototype.getSource=function(){return this._provider.getSource()},t.prototype.ensureCalculationDimension=function(e,r){var n=this._calcDimNameToIdx,a=this._dimensions,i=n.get(e);if(i!=null){if(a[i].type===r)return i}else i=a.length;return a[i]={type:r},n.set(e,i),this._chunks[i]=new Jm[r||"float"](this._rawCount),this._rawExtent[i]=Ci(),i},t.prototype.collectOrdinalMeta=function(e,r){var n=this._chunks[e],a=this._dimensions[e],i=this._rawExtent,o=a.ordinalOffset||0,s=n.length;o===0&&(i[e]=Ci());for(var l=i[e],c=o;c<s;c++){var u=n[c]=r.parseAndCollect(n[c]);isNaN(u)||(l[0]=Math.min(u,l[0]),l[1]=Math.max(u,l[1]))}a.ordinalMeta=r,a.ordinalOffset=s,a.type="ordinal"},t.prototype.getOrdinalMeta=function(e){var r=this._dimensions[e],n=r.ordinalMeta;return n},t.prototype.getDimensionProperty=function(e){var r=this._dimensions[e];return r&&r.property},t.prototype.appendData=function(e){var r=this._provider,n=this.count();r.appendData(e);var a=r.count();return r.persistent||(a+=n),n<a&&this._initDataFromProvider(n,a,!0),[n,a]},t.prototype.appendValues=function(e,r){for(var n=this._chunks,a=this._dimensions,i=a.length,o=this._rawExtent,s=this.count(),l=s+Math.max(e.length,r||0),c=0;c<i;c++){var u=a[c];Qm(n,c,u.type,l,!0)}for(var f=[],h=s;h<l;h++)for(var d=h-s,p=0;p<i;p++){var u=a[p],m=fd.arrayRows.call(this,e[d]||f,u.property,d,p);n[p][h]=m;var g=o[p];m<g[0]&&(g[0]=m),m>g[1]&&(g[1]=m)}return this._rawCount=this._count=l,{start:s,end:l}},t.prototype._initDataFromProvider=function(e,r,n){for(var a=this._provider,i=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,c=he(o,function(y){return y.property}),u=0;u<s;u++){var f=o[u];l[u]||(l[u]=Ci()),Qm(i,u,f.type,r,n)}if(a.fillStorage)a.fillStorage(e,r,i,l);else for(var h=[],d=e;d<r;d++){h=a.getItem(d,h);for(var p=0;p<s;p++){var m=i[p],g=this._dimValueGetter(h,c[p],d,p);m[d]=g;var v=l[p];g<v[0]&&(v[0]=g),g>v[1]&&(v[1]=g)}}!a.persistent&&a.clean&&a.clean(),this._rawCount=this._count=r,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(e,r){if(!(r>=0&&r<this._count))return NaN;var n=this._chunks[e];return n?n[this.getRawIndex(r)]:NaN},t.prototype.getValues=function(e,r){var n=[],a=[];if(r==null){r=e,e=[];for(var i=0;i<this._dimensions.length;i++)a.push(i)}else a=e;for(var i=0,o=a.length;i<o;i++)n.push(this.get(a[i],r));return n},t.prototype.getByRawIndex=function(e,r){if(!(r>=0&&r<this._rawCount))return NaN;var n=this._chunks[e];return n?n[r]:NaN},t.prototype.getSum=function(e){var r=this._chunks[e],n=0;if(r)for(var a=0,i=this.count();a<i;a++){var o=this.get(e,a);isNaN(o)||(n+=o)}return n},t.prototype.getMedian=function(e){var r=[];this.each([e],function(i){isNaN(i)||r.push(i)});var n=r.sort(function(i,o){return i-o}),a=this.count();return a===0?0:a%2===1?n[(a-1)/2]:(n[a/2]+n[a/2-1])/2},t.prototype.indexOfRawIndex=function(e){if(e>=this._rawCount||e<0)return-1;if(!this._indices)return e;var r=this._indices,n=r[e];if(n!=null&&n<this._count&&n===e)return e;for(var a=0,i=this._count-1;a<=i;){var o=(a+i)/2|0;if(r[o]<e)a=o+1;else if(r[o]>e)i=o-1;else return o}return-1},t.prototype.indicesOfNearest=function(e,r,n){var a=this._chunks,i=a[e],o=[];if(!i)return o;n==null&&(n=1/0);for(var s=1/0,l=-1,c=0,u=0,f=this.count();u<f;u++){var h=this.getRawIndex(u),d=r-i[h],p=Math.abs(d);p<=n&&((p<s||p===s&&d>=0&&l<0)&&(s=p,l=d,c=0),d===l&&(o[c++]=u))}return o.length=c,o},t.prototype.getIndices=function(){var e,r=this._indices;if(r){var n=r.constructor,a=this._count;if(n===Array){e=new n(a);for(var i=0;i<a;i++)e[i]=r[i]}else e=new n(r.buffer,0,a)}else{var n=Ti(this._rawCount);e=new n(this.count());for(var i=0;i<e.length;i++)e[i]=i}return e},t.prototype.filter=function(e,r){if(!this._count)return this;for(var n=this.clone(),a=n.count(),i=Ti(n._rawCount),o=new i(a),s=[],l=e.length,c=0,u=e[0],f=n._chunks,h=0;h<a;h++){var d=void 0,p=n.getRawIndex(h);if(l===0)d=r(h);else if(l===1){var m=f[u][p];d=r(m,h)}else{for(var g=0;g<l;g++)s[g]=f[e[g]][p];s[g]=h,d=r.apply(null,s)}d&&(o[c++]=p)}return c<a&&(n._indices=o),n._count=c,n._extent=[],n._updateGetRawIdx(),n},t.prototype.selectRange=function(e){var r=this.clone(),n=r._count;if(!n)return this;var a=at(e),i=a.length;if(!i)return this;var o=r.count(),s=Ti(r._rawCount),l=new s(o),c=0,u=a[0],f=e[u][0],h=e[u][1],d=r._chunks,p=!1;if(!r._indices){var m=0;if(i===1){for(var g=d[a[0]],v=0;v<n;v++){var y=g[v];(y>=f&&y<=h||isNaN(y))&&(l[c++]=m),m++}p=!0}else if(i===2){for(var g=d[a[0]],b=d[a[1]],x=e[a[1]][0],w=e[a[1]][1],v=0;v<n;v++){var y=g[v],S=b[v];(y>=f&&y<=h||isNaN(y))&&(S>=x&&S<=w||isNaN(S))&&(l[c++]=m),m++}p=!0}}if(!p)if(i===1)for(var v=0;v<o;v++){var k=r.getRawIndex(v),y=d[a[0]][k];(y>=f&&y<=h||isNaN(y))&&(l[c++]=k)}else for(var v=0;v<o;v++){for(var C=!0,k=r.getRawIndex(v),A=0;A<i;A++){var M=a[A],y=d[M][k];(y<e[M][0]||y>e[M][1])&&(C=!1)}C&&(l[c++]=r.getRawIndex(v))}return c<o&&(r._indices=l),r._count=c,r._extent=[],r._updateGetRawIdx(),r},t.prototype.map=function(e,r){var n=this.clone(e);return this._updateDims(n,e,r),n},t.prototype.modify=function(e,r){this._updateDims(this,e,r)},t.prototype._updateDims=function(e,r,n){for(var a=e._chunks,i=[],o=r.length,s=e.count(),l=[],c=e._rawExtent,u=0;u<r.length;u++)c[r[u]]=Ci();for(var f=0;f<s;f++){for(var h=e.getRawIndex(f),d=0;d<o;d++)l[d]=a[r[d]][h];l[o]=f;var p=n&&n.apply(null,l);if(p!=null){typeof p!="object"&&(i[0]=p,p=i);for(var u=0;u<p.length;u++){var m=r[u],g=p[u],v=c[m],y=a[m];y&&(y[h]=g),g<v[0]&&(v[0]=g),g>v[1]&&(v[1]=g)}}}},t.prototype.lttbDownSample=function(e,r){var n=this.clone([e],!0),a=n._chunks,i=a[e],o=this.count(),s=0,l=Math.floor(1/r),c=this.getRawIndex(0),u,f,h,d=new(Ti(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));d[s++]=c;for(var p=1;p<o-1;p+=l){for(var m=Math.min(p+l,o-1),g=Math.min(p+l*2,o),v=(g+m)/2,y=0,b=m;b<g;b++){var x=this.getRawIndex(b),w=i[x];isNaN(w)||(y+=w)}y/=g-m;var S=p,k=Math.min(p+l,o),C=p-1,A=i[c];u=-1,h=S;for(var M=-1,T=0,b=S;b<k;b++){var x=this.getRawIndex(b),w=i[x];if(isNaN(w)){T++,M<0&&(M=x);continue}f=Math.abs((C-v)*(w-A)-(C-b)*(y-A)),f>u&&(u=f,h=x)}T>0&&T<k-S&&(d[s++]=Math.min(M,h),h=Math.max(M,h)),d[s++]=h,c=h}return d[s++]=this.getRawIndex(o-1),n._count=s,n._indices=d,n.getRawIndex=this._getRawIdx,n},t.prototype.minmaxDownSample=function(e,r){for(var n=this.clone([e],!0),a=n._chunks,i=Math.floor(1/r),o=a[e],s=this.count(),l=new(Ti(this._rawCount))(Math.ceil(s/i)*2),c=0,u=0;u<s;u+=i){var f=u,h=o[this.getRawIndex(f)],d=u,p=o[this.getRawIndex(d)],m=i;u+i>s&&(m=s-u);for(var g=0;g<m;g++){var v=this.getRawIndex(u+g),y=o[v];y<h&&(h=y,f=u+g),y>p&&(p=y,d=u+g)}var b=this.getRawIndex(f),x=this.getRawIndex(d);f<d?(l[c++]=b,l[c++]=x):(l[c++]=x,l[c++]=b)}return n._count=c,n._indices=l,n._updateGetRawIdx(),n},t.prototype.downSample=function(e,r,n,a){for(var i=this.clone([e],!0),o=i._chunks,s=[],l=Math.floor(1/r),c=o[e],u=this.count(),f=i._rawExtent[e]=Ci(),h=new(Ti(this._rawCount))(Math.ceil(u/l)),d=0,p=0;p<u;p+=l){l>u-p&&(l=u-p,s.length=l);for(var m=0;m<l;m++){var g=this.getRawIndex(p+m);s[m]=c[g]}var v=n(s),y=this.getRawIndex(Math.min(p+a(s,v)||0,u-1));c[y]=v,v<f[0]&&(f[0]=v),v>f[1]&&(f[1]=v),h[d++]=y}return i._count=d,i._indices=h,i._updateGetRawIdx(),i},t.prototype.each=function(e,r){if(this._count)for(var n=e.length,a=this._chunks,i=0,o=this.count();i<o;i++){var s=this.getRawIndex(i);switch(n){case 0:r(i);break;case 1:r(a[e[0]][s],i);break;case 2:r(a[e[0]][s],a[e[1]][s],i);break;default:for(var l=0,c=[];l<n;l++)c[l]=a[e[l]][s];c[l]=i,r.apply(null,c)}}},t.prototype.getDataExtent=function(e){var r=this._chunks[e],n=Ci();if(!r)return n;var a=this.count(),i=!this._indices,o;if(i)return this._rawExtent[e].slice();if(o=this._extent[e],o)return o.slice();o=n;for(var s=o[0],l=o[1],c=0;c<a;c++){var u=this.getRawIndex(c),f=r[u];f<s&&(s=f),f>l&&(l=f)}return o=[s,l],this._extent[e]=o,o},t.prototype.getRawDataItem=function(e){var r=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(r);for(var n=[],a=this._chunks,i=0;i<a.length;i++)n.push(a[i][r]);return n},t.prototype.clone=function(e,r){var n=new t,a=this._chunks,i=e&&ni(e,function(s,l){return s[l]=!0,s},{});if(i)for(var o=0;o<a.length;o++)n._chunks[o]=i[o]?IT(a[o]):a[o];else n._chunks=a;return this._copyCommonProps(n),r||(n._indices=this._cloneIndices()),n._updateGetRawIdx(),n},t.prototype._copyCommonProps=function(e){e._count=this._count,e._rawCount=this._rawCount,e._provider=this._provider,e._dimensions=this._dimensions,e._extent=Ie(this._extent),e._rawExtent=Ie(this._rawExtent)},t.prototype._cloneIndices=function(){if(this._indices){var e=this._indices.constructor,r=void 0;if(e===Array){var n=this._indices.length;r=new e(n);for(var a=0;a<n;a++)r[a]=this._indices[a]}else r=new e(this._indices);return r}return null},t.prototype._getRawIdxIdentity=function(e){return e},t.prototype._getRawIdx=function(e){return e<this._count&&e>=0?this._indices[e]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=(function(){function e(r,n,a,i){return Ql(r[i],this._dimensions[i])}fd={arrayRows:e,objectRows:function(r,n,a,i){return Ql(r[n],this._dimensions[i])},keyedColumns:e,original:function(r,n,a,i){var o=r&&(r.value==null?r:r.value);return Ql(o instanceof Array?o[i]:o,this._dimensions[i])},typedArray:function(r,n,a,i){return r[i]}}})(),t})(),LT=ht(),PT={float:"f",int:"i",ordinal:"o",number:"n",time:"t"},ey=(function(){function t(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return t.prototype.isDimensionOmitted=function(){return this._dimOmitted},t.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||(this._dimNameMap=ny(this.source)))},t.prototype.getSourceDimensionIndex=function(e){return Pe(this._dimNameMap.get(e),-1)},t.prototype.getSourceDimension=function(e){var r=this.source.dimensionsDefine;if(r)return r[e]},t.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,r=Vm(this.source),n=!ay(e),a="",i=[],o=0,s=0;o<e;o++){var l=void 0,c=void 0,u=void 0,f=this.dimensions[s];if(f&&f.storeDimIndex===o)l=r?f.name:null,c=f.type,u=f.ordinalMeta,s++;else{var h=this.getSourceDimension(o);h&&(l=r?h.name:null,c=h.type)}i.push({property:l,type:c,ordinalMeta:u}),r&&l!=null&&(!f||!f.isCalculationCoord)&&(a+=n?l.replace(/\`/g,"`1").replace(/\$/g,"`2"):l),a+="$",a+=PT[c]||"f",u&&(a+=u.uid),a+="$"}var d=this.source,p=[d.seriesLayoutBy,d.startIndex,a].join("$$");return{dimensions:i,hash:p}},t.prototype.makeOutputDimensionNames=function(){for(var e=[],r=0,n=0;r<this._fullDimCount;r++){var a=void 0,i=this.dimensions[n];if(i&&i.storeDimIndex===r)i.isCalculationCoord||(a=i.name),n++;else{var o=this.getSourceDimension(r);o&&(a=o.name)}e.push(a)}return e},t.prototype.appendCalculationDimension=function(e){this.dimensions.push(e),e.isCalculationCoord=!0,this._fullDimCount++,this._updateDimOmitted(!0)},t})();function ty(t){return t instanceof ey}function ry(t){for(var e=me(),r=0;r<(t||[]).length;r++){var n=t[r],a=de(n)?n.name:n;a!=null&&e.get(a)==null&&e.set(a,r)}return e}function ny(t){var e=LT(t);return e.dimNameMap||(e.dimNameMap=ry(t.dimensionsDefine))}function ay(t){return t>30}var Ro=de,Un=he,RT=typeof Int32Array>"u"?Array:Int32Array,ET="e\0\0",iy=-1,OT=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],NT=["_approximateExtent"],oy,tc,Eo,Oo,hd,No,pd,BT=(function(){function t(e,r){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var n,a=!1;ty(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(a=!0,n=e),n=n||["x","y"];for(var i={},o=[],s={},l=!1,c={},u=0;u<n.length;u++){var f=n[u],h=ae(f)?new Jl({name:f}):f instanceof Jl?f:new Jl(f),d=h.name;h.type=h.type||"float",h.coordDim||(h.coordDim=d,h.coordDimIndex=0);var p=h.otherDims=h.otherDims||{};o.push(d),i[d]=h,c[d]!=null&&(l=!0),h.createInvertedIndices&&(s[d]=[]),p.itemName===0&&(this._nameDimIdx=u),p.itemId===0&&(this._idDimIdx=u),a&&(h.storeDimIndex=u)}if(this.dimensions=o,this._dimInfos=i,this._initGetDimensionInfo(l),this.hostModel=r,this._invertedIndicesMap=s,this._dimOmitted){var m=this._dimIdxToName=me();I(o,function(g){m.set(i[g].storeDimIndex,g)})}}return t.prototype.getDimension=function(e){var r=this._recognizeDimIndex(e);if(r==null)return e;if(r=e,!this._dimOmitted)return this.dimensions[r];var n=this._dimIdxToName.get(r);if(n!=null)return n;var a=this._schema.getSourceDimension(r);if(a)return a.name},t.prototype.getDimensionIndex=function(e){var r=this._recognizeDimIndex(e);if(r!=null)return r;if(e==null)return-1;var n=this._getDimInfo(e);return n?n.storeDimIndex:this._dimOmitted?this._schema.getSourceDimensionIndex(e):-1},t.prototype._recognizeDimIndex=function(e){if(et(e)||e!=null&&!isNaN(e)&&!this._getDimInfo(e)&&(!this._dimOmitted||this._schema.getSourceDimensionIndex(e)<0))return+e},t.prototype._getStoreDimIndex=function(e){var r=this.getDimensionIndex(e);return r},t.prototype.getDimensionInfo=function(e){return this._getDimInfo(this.getDimension(e))},t.prototype._initGetDimensionInfo=function(e){var r=this._dimInfos;this._getDimInfo=e?function(n){return r.hasOwnProperty(n)?r[n]:void 0}:function(n){return r[n]}},t.prototype.getDimensionsOnCoord=function(){return this._dimSummary.dataDimsOnCoord.slice()},t.prototype.mapDimension=function(e,r){var n=this._dimSummary;if(r==null)return n.encodeFirstDimNotExtra[e];var a=n.encode[e];return a?a[r]:null},t.prototype.mapDimensionsAll=function(e){var r=this._dimSummary,n=r.encode[e];return(n||[]).slice()},t.prototype.getStore=function(){return this._store},t.prototype.initData=function(e,r,n){var a=this,i;if(e instanceof dd&&(i=e),!i){var o=this.dimensions,s=od(e)||Vt(e)?new $m(e,o.length):e;i=new dd;var l=Un(o,function(c){return{type:a._dimInfos[c].type,property:c}});i.initData(s,l,n)}this._store=i,this._nameList=(r||[]).slice(),this._idList=[],this._nameRepeatCount={},this._doInit(0,i.count()),this._dimSummary=kT(this,this._schema),this.userOutput=this._dimSummary.userOutput},t.prototype.appendData=function(e){var r=this._store.appendData(e);this._doInit(r[0],r[1])},t.prototype.appendValues=function(e,r){var n=this._store.appendValues(e,r&&r.length),a=n.start,i=n.end,o=this._shouldMakeIdFromName();if(this._updateOrdinalMeta(),r)for(var s=a;s<i;s++){var l=s-a;this._nameList[s]=r[l],o&&pd(this,s)}},t.prototype._updateOrdinalMeta=function(){for(var e=this._store,r=this.dimensions,n=0;n<r.length;n++){var a=this._dimInfos[r[n]];a.ordinalMeta&&e.collectOrdinalMeta(a.storeDimIndex,a.ordinalMeta)}},t.prototype._shouldMakeIdFromName=function(){var e=this._store.getProvider();return this._idDimIdx==null&&e.getSource().sourceFormat!==Vn&&!e.fillStorage},t.prototype._doInit=function(e,r){if(!(e>=r)){var n=this._store,a=n.getProvider();this._updateOrdinalMeta();var i=this._nameList,o=this._idList,s=a.getSource().sourceFormat,l=s===yr;if(l&&!a.pure)for(var c=[],u=e;u<r;u++){var f=a.getItem(u,c);if(!this.hasItemOption&&Ak(f)&&(this.hasItemOption=!0),f){var h=f.name;i[u]==null&&h!=null&&(i[u]=Zr(h,null));var d=f.id;o[u]==null&&d!=null&&(o[u]=Zr(d,null))}}if(this._shouldMakeIdFromName())for(var u=e;u<r;u++)pd(this,u);oy(this)}},t.prototype.getApproximateExtent=function(e){return this._approximateExtent[e]||this._store.getDataExtent(this._getStoreDimIndex(e))},t.prototype.setApproximateExtent=function(e,r){r=this.getDimension(r),this._approximateExtent[r]=e.slice()},t.prototype.getCalculationInfo=function(e){return this._calculationInfo[e]},t.prototype.setCalculationInfo=function(e,r){Ro(e)?q(this._calculationInfo,e):this._calculationInfo[e]=r},t.prototype.getName=function(e){var r=this.getRawIndex(e),n=this._nameList[r];return n==null&&this._nameDimIdx!=null&&(n=Eo(this,this._nameDimIdx,r)),n==null&&(n=""),n},t.prototype._getCategory=function(e,r){var n=this._store.get(e,r),a=this._store.getOrdinalMeta(e);return a?a.categories[n]:n},t.prototype.getId=function(e){return tc(this,this.getRawIndex(e))},t.prototype.count=function(){return this._store.count()},t.prototype.get=function(e,r){var n=this._store,a=this._dimInfos[e];if(a)return n.get(a.storeDimIndex,r)},t.prototype.getByRawIndex=function(e,r){var n=this._store,a=this._dimInfos[e];if(a)return n.getByRawIndex(a.storeDimIndex,r)},t.prototype.getIndices=function(){return this._store.getIndices()},t.prototype.getDataExtent=function(e){return this._store.getDataExtent(this._getStoreDimIndex(e))},t.prototype.getSum=function(e){return this._store.getSum(this._getStoreDimIndex(e))},t.prototype.getMedian=function(e){return this._store.getMedian(this._getStoreDimIndex(e))},t.prototype.getValues=function(e,r){var n=this,a=this._store;return ee(e)?a.getValues(Un(e,function(i){return n._getStoreDimIndex(i)}),r):a.getValues(e)},t.prototype.hasValue=function(e){for(var r=this._dimSummary.dataDimIndicesOnCoord,n=0,a=r.length;n<a;n++)if(isNaN(this._store.get(r[n],e)))return!1;return!0},t.prototype.indexOfName=function(e){for(var r=0,n=this._store.count();r<n;r++)if(this.getName(r)===e)return r;return-1},t.prototype.getRawIndex=function(e){return this._store.getRawIndex(e)},t.prototype.indexOfRawIndex=function(e){return this._store.indexOfRawIndex(e)},t.prototype.rawIndexOf=function(e,r){var n=e&&this._invertedIndicesMap[e],a=n&&n[r];return a==null||isNaN(a)?iy:a},t.prototype.indicesOfNearest=function(e,r,n){return this._store.indicesOfNearest(this._getStoreDimIndex(e),r,n)},t.prototype.each=function(e,r,n){ke(e)&&(n=r,r=e,e=[]);var a=n||this,i=Un(Oo(e),this._getStoreDimIndex,this);this._store.each(i,a?Ne(r,a):r)},t.prototype.filterSelf=function(e,r,n){ke(e)&&(n=r,r=e,e=[]);var a=n||this,i=Un(Oo(e),this._getStoreDimIndex,this);return this._store=this._store.filter(i,a?Ne(r,a):r),this},t.prototype.selectRange=function(e){var r=this,n={},a=at(e);return I(a,function(i){var o=r._getStoreDimIndex(i);n[o]=e[i]}),this._store=this._store.selectRange(n),this},t.prototype.mapArray=function(e,r,n){ke(e)&&(n=r,r=e,e=[]),n=n||this;var a=[];return this.each(e,function(){a.push(r&&r.apply(this,arguments))},n),a},t.prototype.map=function(e,r,n,a){var i=n||a||this,o=Un(Oo(e),this._getStoreDimIndex,this),s=No(this);return s._store=this._store.map(o,i?Ne(r,i):r),s},t.prototype.modify=function(e,r,n,a){var i=n||a||this,o=Un(Oo(e),this._getStoreDimIndex,this);this._store.modify(o,i?Ne(r,i):r)},t.prototype.downSample=function(e,r,n,a){var i=No(this);return i._store=this._store.downSample(this._getStoreDimIndex(e),r,n,a),i},t.prototype.minmaxDownSample=function(e,r){var n=No(this);return n._store=this._store.minmaxDownSample(this._getStoreDimIndex(e),r),n},t.prototype.lttbDownSample=function(e,r){var n=No(this);return n._store=this._store.lttbDownSample(this._getStoreDimIndex(e),r),n},t.prototype.getRawDataItem=function(e){return this._store.getRawDataItem(e)},t.prototype.getItemModel=function(e){var r=this.hostModel,n=this.getRawDataItem(e);return new lt(n,r,r&&r.ecModel)},t.prototype.diff=function(e){var r=this;return new dT(e?e.getStore().getIndices():[],this.getStore().getIndices(),function(n){return tc(e,n)},function(n){return tc(r,n)})},t.prototype.getVisual=function(e){var r=this._visual;return r&&r[e]},t.prototype.setVisual=function(e,r){this._visual=this._visual||{},Ro(e)?q(this._visual,e):this._visual[e]=r},t.prototype.getItemVisual=function(e,r){var n=this._itemVisuals[e],a=n&&n[r];return a??this.getVisual(r)},t.prototype.hasItemVisual=function(){return this._itemVisuals.length>0},t.prototype.ensureUniqueItemVisual=function(e,r){var n=this._itemVisuals,a=n[e];a||(a=n[e]={});var i=a[r];return i==null&&(i=this.getVisual(r),ee(i)?i=i.slice():Ro(i)&&(i=q({},i)),a[r]=i),i},t.prototype.setItemVisual=function(e,r,n){var a=this._itemVisuals[e]||{};this._itemVisuals[e]=a,Ro(r)?q(a,r):a[r]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(e,r){Ro(e)?q(this._layout,e):this._layout[e]=r},t.prototype.getLayout=function(e){return this._layout[e]},t.prototype.getItemLayout=function(e){return this._itemLayouts[e]},t.prototype.setItemLayout=function(e,r,n){this._itemLayouts[e]=n?q(this._itemLayouts[e]||{},r):r},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(e,r){var n=this.hostModel&&this.hostModel.seriesIndex;Gk(n,this.dataType,e,r),this._graphicEls[e]=r},t.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},t.prototype.eachItemGraphicEl=function(e,r){I(this._graphicEls,function(n,a){n&&e&&e.call(r,n,a)})},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:Un(this.dimensions,this._getDimInfo,this),this.hostModel)),hd(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(e,r){var n=this[e];ke(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var a=n.apply(this,arguments);return r.apply(this,[a].concat(Nu(arguments)))})},t.internalField=(function(){oy=function(e){var r=e._invertedIndicesMap;I(r,function(n,a){var i=e._dimInfos[a],o=i.ordinalMeta,s=e._store;if(o){n=r[a]=new RT(o.categories.length);for(var l=0;l<n.length;l++)n[l]=iy;for(var l=0;l<s.count();l++)n[s.get(i.storeDimIndex,l)]=l}})},Eo=function(e,r,n){return Zr(e._getCategory(r,n),null)},tc=function(e,r){var n=e._idList[r];return n==null&&e._idDimIdx!=null&&(n=Eo(e,e._idDimIdx,r)),n==null&&(n=ET+r),n},Oo=function(e){return ee(e)||(e=e!=null?[e]:[]),e},No=function(e){var r=new t(e._schema?e._schema:Un(e.dimensions,e._getDimInfo,e),e.hostModel);return hd(r,e),r},hd=function(e,r){I(OT.concat(r.__wrappedMethods||[]),function(n){r.hasOwnProperty(n)&&(e[n]=r[n])}),e.__wrappedMethods=r.__wrappedMethods,I(NT,function(n){e[n]=Ie(r[n])}),e._calculationInfo=q({},r._calculationInfo)},pd=function(e,r){var n=e._nameList,a=e._idList,i=e._nameDimIdx,o=e._idDimIdx,s=n[r],l=a[r];if(s==null&&i!=null&&(n[r]=s=Eo(e,i,r)),l==null&&o!=null&&(a[r]=l=Eo(e,o,r)),l==null&&s!=null){var c=e._nameRepeatCount,u=c[s]=(c[s]||0)+1;l=s,u>1&&(l+="__ec__"+u),a[r]=l}}})(),t})();function zT(t,e){od(t)||(t=Bm(t)),e=e||{};var r=e.coordDimensions||[],n=e.dimensionsDefine||t.dimensionsDefine||[],a=me(),i=[],o=HT(t,r,n,e.dimensionsCount),s=e.canOmitUnusedDimensions&&ay(o),l=n===t.dimensionsDefine,c=l?ny(t):ry(n),u=e.encodeDefine;!u&&e.encodeDefaulter&&(u=e.encodeDefaulter(t,o));for(var f=me(u),h=new Km(o),d=0;d<h.length;d++)h[d]=-1;function p(A){var M=h[A];if(M<0){var T=n[A],D=de(T)?T:{name:T},L=new Jl,R=D.name;R!=null&&c.get(R)!=null&&(L.name=L.displayName=R),D.type!=null&&(L.type=D.type),D.displayName!=null&&(L.displayName=D.displayName);var O=i.length;return h[A]=O,L.storeDimIndex=A,i.push(L),L}return i[M]}if(!s)for(var d=0;d<o;d++)p(d);f.each(function(A,M){var T=Mt(A).slice();if(T.length===1&&!ae(T[0])&&T[0]<0){f.set(M,!1);return}var D=f.set(M,[]);I(T,function(L,R){var O=ae(L)?c.get(L):L;O!=null&&O<o&&(D[R]=O,g(p(O),M,R))})});var m=0;I(r,function(A){var M,T,D,L;if(ae(A))M=A,L={};else{L=A,M=L.name;var R=L.ordinalMeta;L.ordinalMeta=null,L=q({},L),L.ordinalMeta=R,T=L.dimsDef,D=L.otherDims,L.name=L.coordDim=L.coordDimIndex=L.dimsDef=L.otherDims=null}var O=f.get(M);if(O!==!1){if(O=Mt(O),!O.length)for(var B=0;B<(T&&T.length||1);B++){for(;m<o&&p(m).coordDim!=null;)m++;m<o&&O.push(m++)}I(O,function(j,P){var V=p(j);if(l&&L.type!=null&&(V.type=L.type),g(He(V,L),M,P),V.name==null&&T){var H=T[P];!de(H)&&(H={name:H}),V.name=V.displayName=H.name,V.defaultTooltip=H.defaultTooltip}D&&He(V.otherDims,D)})}});function g(A,M,T){Pm.get(M)!=null?A.otherDims[M]=T:(A.coordDim=M,A.coordDimIndex=T,a.set(M,!0))}var v=e.generateCoord,y=e.generateCoordCount,b=y!=null;y=v?y||1:0;var x=v||"value";function w(A){A.name==null&&(A.name=A.coordDim)}if(s)I(i,function(A){w(A)}),i.sort(function(A,M){return A.storeDimIndex-M.storeDimIndex});else for(var S=0;S<o;S++){var k=p(S),C=k.coordDim;C==null&&(k.coordDim=VT(x,a,b),k.coordDimIndex=0,(!v||y<=0)&&(k.isExtraCoord=!0),y--),w(k),k.type==null&&(Nm(t,S)===sr.Must||k.isExtraCoord&&(k.otherDims.itemName!=null||k.otherDims.seriesName!=null))&&(k.type="ordinal")}return FT(i),new ey({source:t,dimensions:i,fullDimensionCount:o,dimensionOmitted:s})}function FT(t){for(var e=me(),r=0;r<t.length;r++){var n=t[r],a=n.name,i=e.get(a)||0;i>0&&(n.name=a+(i-1)),i++,e.set(a,i)}}function HT(t,e,r,n){var a=Math.max(t.dimensionsDetectedCount||1,e.length,r.length,n||0);return I(e,function(i){var o;de(i)&&(o=i.dimsDef)&&(a=Math.max(a,o.length))}),a}function VT(t,e,r){if(r||e.hasKey(t)){for(var n=0;e.hasKey(t+n);)n++;t+=n}return e.set(t,!0),t}var vd={},gd=(function(){function t(){this._coordinateSystems=[]}return t.prototype.create=function(e,r){var n=[];I(vd,function(a,i){var o=a.create(e,r);n=n.concat(o||[])}),this._coordinateSystems=n},t.prototype.update=function(e,r){I(this._coordinateSystems,function(n){n.update&&n.update(e,r)})},t.prototype.getCoordinateSystems=function(){return this._coordinateSystems.slice()},t.register=function(e,r){vd[e]=r},t.get=function(e){return vd[e]},t})(),UT=(function(){function t(e){this.coordSysDims=[],this.axisMap=me(),this.categoryAxisMap=me(),this.coordSysName=e}return t})();function GT(t){var e=t.get("coordinateSystem"),r=new UT(e),n=$T[e];if(n)return n(t,r,r.axisMap,r.categoryAxisMap),r}var $T={cartesian2d:function(t,e,r,n){var a=t.getReferringComponents("xAxis",qt).models[0],i=t.getReferringComponents("yAxis",qt).models[0];e.coordSysDims=["x","y"],r.set("x",a),r.set("y",i),Mi(a)&&(n.set("x",a),e.firstCategoryDimIndex=0),Mi(i)&&(n.set("y",i),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,r,n){var a=t.getReferringComponents("singleAxis",qt).models[0];e.coordSysDims=["single"],r.set("single",a),Mi(a)&&(n.set("single",a),e.firstCategoryDimIndex=0)},polar:function(t,e,r,n){var a=t.getReferringComponents("polar",qt).models[0],i=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],r.set("radius",i),r.set("angle",o),Mi(i)&&(n.set("radius",i),e.firstCategoryDimIndex=0),Mi(o)&&(n.set("angle",o),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},geo:function(t,e,r,n){e.coordSysDims=["lng","lat"]},parallel:function(t,e,r,n){var a=t.ecModel,i=a.getComponent("parallel",t.get("parallelIndex")),o=e.coordSysDims=i.dimensions.slice();I(i.parallelAxisIndex,function(s,l){var c=a.getComponent("parallelAxis",s),u=o[l];r.set(u,c),Mi(c)&&(n.set(u,c),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=l))})}};function Mi(t){return t.get("type")==="category"}function WT(t,e,r){r=r||{};var n=r.byIndex,a=r.stackedCoordDimension,i,o,s;qT(e)?i=e:(o=e.schema,i=o.dimensions,s=e.store);var l=!!(t&&t.get("stack")),c,u,f,h;if(I(i,function(y,b){ae(y)&&(i[b]=y={name:y}),l&&!y.isExtraCoord&&(!n&&!c&&y.ordinalMeta&&(c=y),!u&&y.type!=="ordinal"&&y.type!=="time"&&(!a||a===y.coordDim)&&(u=y))}),u&&!n&&!c&&(n=!0),u){f="__\0ecstackresult_"+t.id,h="__\0ecstackedover_"+t.id,c&&(c.createInvertedIndices=!0);var d=u.coordDim,p=u.type,m=0;I(i,function(y){y.coordDim===d&&m++});var g={name:f,coordDim:d,coordDimIndex:m,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},v={name:h,coordDim:h,coordDimIndex:m+1,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};o?(s&&(g.storeDimIndex=s.ensureCalculationDimension(h,p),v.storeDimIndex=s.ensureCalculationDimension(f,p)),o.appendCalculationDimension(g),o.appendCalculationDimension(v)):(i.push(g),i.push(v))}return{stackedDimension:u&&u.name,stackedByDimension:c&&c.name,isStackedByIndex:n,stackedOverDimension:h,stackResultDimension:f}}function qT(t){return!ty(t.schema)}function Ai(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function YT(t,e){return Ai(t,e)?t.getCalculationInfo("stackResultDimension"):e}function XT(t,e){var r=t.get("coordinateSystem"),n=gd.get(r),a;return e&&e.coordSysDims&&(a=he(e.coordSysDims,function(i){var o={name:i},s=e.axisMap.get(i);if(s){var l=s.get("type");o.type=TT(l)}return o})),a||(a=n&&(n.getDimensionsInfo?n.getDimensionsInfo():n.dimensions.slice())||["x","y"]),a}function ZT(t,e,r){var n,a;return r&&I(t,function(i,o){var s=i.coordDim,l=r.categoryAxisMap.get(s);l&&(n==null&&(n=o),i.ordinalMeta=l.getOrdinalMeta(),e&&(i.createInvertedIndices=!0)),i.otherDims.itemName!=null&&(a=!0)}),!a&&n!=null&&(t[n].otherDims.itemName=0),n}function md(t,e,r){r=r||{};var n=e.getSourceManager(),a,i=!1;a=n.getSource(),i=a.sourceFormat===yr;var o=GT(e),s=XT(e,o),l=r.useEncodeDefaulter,c=ke(l)?l:l?dt(pT,s,e):null,u={coordDimensions:s,generateCoord:r.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:c,canOmitUnusedDimensions:!i},f=zT(a,u),h=ZT(f.dimensions,r.createInvertedIndices,o),d=i?null:n.getSharedDataStore(f),p=WT(e,{schema:f,store:d}),m=new BT(f,e);m.setCalculationInfo(p);var g=h!=null&&KT(a)?function(v,y,b,x){return x===h?b:this.defaultDimValueGetter(v,y,b,x)}:null;return m.hasItemOption=!1,m.initData(i?a:d,null,g),m}function KT(t){if(t.sourceFormat===yr){var e=jT(t.data||[]);return!ee(xo(e))}}function jT(t){for(var e=0;e<t.length&&t[e]==null;)e++;return t[e]}var JT=Math.round(Math.random()*10);function rc(t){return[t||"",JT++].join("_")}function QT(t){var e={};t.registerSubTypeDefaulter=function(r,n){var a=$r(r);e[a.main]=n},t.determineSubType=function(r,n){var a=n.type;if(!a){var i=$r(r).main;t.hasSubTypes(r)&&e[i]&&(a=e[i](n))}return a}}function eC(t,e){t.topologicalTravel=function(i,o,s,l){if(!i.length)return;var c=r(o),u=c.graph,f=c.noEntryList,h={};for(I(i,function(y){h[y]=!0});f.length;){var d=f.pop(),p=u[d],m=!!h[d];m&&(s.call(l,d,p.originalDeps.slice()),delete h[d]),I(p.successor,m?v:g)}I(h,function(){var y="";throw new Error(y)});function g(y){u[y].entryCount--,u[y].entryCount===0&&f.push(y)}function v(y){h[y]=!0,g(y)}};function r(i){var o={},s=[];return I(i,function(l){var c=n(o,l),u=c.originalDeps=e(l),f=a(u,i);c.entryCount=f.length,c.entryCount===0&&s.push(l),I(f,function(h){Ue(c.predecessor,h)<0&&c.predecessor.push(h);var d=n(o,h);Ue(d.successor,h)<0&&d.successor.push(l)})}),{graph:o,noEntryList:s}}function n(i,o){return i[o]||(i[o]={predecessor:[],successor:[]}),i[o]}function a(i,o){var s=[];return I(i,function(l){Ue(o,l)>=0&&s.push(l)}),s}}function yd(t,e){return Oe(Oe({},t,!0),e,!0)}var tC=Math.log(2);function _d(t,e,r,n,a,i){var o=n+"-"+a,s=t.length;if(i.hasOwnProperty(o))return i[o];if(e===1){var l=Math.round(Math.log((1<<s)-1&~a)/tC);return t[r][l]}for(var c=n|1<<r,u=r+1;n&1<<u;)u++;for(var f=0,h=0,d=0;h<s;h++){var p=1<<h;p&a||(f+=(d%2?-1:1)*t[r][h]*_d(t,e-1,u,c,a|p,i),d++)}return i[o]=f,f}function sy(t,e){var r=[[t[0],t[1],1,0,0,0,-e[0]*t[0],-e[0]*t[1]],[0,0,0,t[0],t[1],1,-e[1]*t[0],-e[1]*t[1]],[t[2],t[3],1,0,0,0,-e[2]*t[2],-e[2]*t[3]],[0,0,0,t[2],t[3],1,-e[3]*t[2],-e[3]*t[3]],[t[4],t[5],1,0,0,0,-e[4]*t[4],-e[4]*t[5]],[0,0,0,t[4],t[5],1,-e[5]*t[4],-e[5]*t[5]],[t[6],t[7],1,0,0,0,-e[6]*t[6],-e[6]*t[7]],[0,0,0,t[6],t[7],1,-e[7]*t[6],-e[7]*t[7]]],n={},a=_d(r,8,0,0,0,n);if(a!==0){for(var i=[],o=0;o<8;o++)for(var s=0;s<8;s++)i[s]==null&&(i[s]=0),i[s]+=((o+s)%2?-1:1)*_d(r,7,o===0?1:0,1<<o,1<<s,n)/a*e[o];return function(l,c,u){var f=c*i[6]+u*i[7]+1;l[0]=(c*i[0]+u*i[1]+i[2])/f,l[1]=(c*i[3]+u*i[4]+i[5])/f}}}var ly="___zrEVENTSAVED",bd=[];function rC(t,e,r,n,a){return xd(bd,e,n,a,!0)&&xd(t,r,bd[0],bd[1])}function xd(t,e,r,n,a){if(e.getBoundingClientRect&&_e.domSupported&&!cy(e)){var i=e[ly]||(e[ly]={}),o=nC(e,i),s=aC(o,i,a);if(s)return s(t,r,n),!0}return!1}function nC(t,e){var r=e.markers;if(r)return r;r=e.markers=[];for(var n=["left","right"],a=["top","bottom"],i=0;i<4;i++){var o=document.createElement("div"),s=o.style,l=i%2,c=(i>>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",n[l]+":0",a[c]+":0",n[1-l]+":auto",a[1-c]+":auto",""].join("!important;"),t.appendChild(o),r.push(o)}return r}function aC(t,e,r){for(var n=r?"invTrans":"trans",a=e[n],i=e.srcCoords,o=[],s=[],l=!0,c=0;c<4;c++){var u=t[c].getBoundingClientRect(),f=2*c,h=u.left,d=u.top;o.push(h,d),l=l&&i&&h===i[f]&&d===i[f+1],s.push(t[c].offsetLeft,t[c].offsetTop)}return l&&a?a:(e.srcCoords=o,e[n]=r?sy(s,o):sy(o,s))}function cy(t){return t.nodeName.toUpperCase()==="CANVAS"}var iC=/([&<>"'])/g,oC={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Zt(t){return t==null?"":(t+"").replace(iC,function(e,r){return oC[r]})}const sC={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}},lC={time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}};var nc="ZH",wd="EN",Di=wd,ac={},Sd={},uy=_e.domSupported?(function(){var t=(document.documentElement.lang||navigator.language||navigator.browserLanguage||Di).toUpperCase();return t.indexOf(nc)>-1?nc:Di})():Di;function fy(t,e){t=t.toUpperCase(),Sd[t]=new lt(e),ac[t]=e}function cC(t){if(ae(t)){var e=ac[t.toUpperCase()]||{};return t===nc||t===wd?Ie(e):Oe(Ie(e),Ie(ac[Di]),!1)}else return Oe(Ie(t),Ie(ac[Di]),!1)}function uC(t){return Sd[t]}function fC(){return Sd[Di]}fy(wd,sC),fy(nc,lC);var kd=1e3,Td=kd*60,Bo=Td*60,_r=Bo*24,dy=_r*365,zo={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},ic="{yyyy}-{MM}-{dd}",hy={year:"{yyyy}",month:"{yyyy}-{MM}",day:ic,hour:ic+" "+zo.hour,minute:ic+" "+zo.minute,second:ic+" "+zo.second,millisecond:zo.none},Cd=["year","month","day","hour","minute","second","millisecond"],py=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Gn(t,e){return t+="","0000".substr(0,e-t.length)+t}function Ii(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function dC(t){return t===Ii(t)}function hC(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function oc(t,e,r,n){var a=mn(t),i=a[Md(r)](),o=a[Li(r)]()+1,s=Math.floor((o-1)/3)+1,l=a[sc(r)](),c=a["get"+(r?"UTC":"")+"Day"](),u=a[Fo(r)](),f=(u-1)%12+1,h=a[lc(r)](),d=a[cc(r)](),p=a[uc(r)](),m=u>=12?"pm":"am",g=m.toUpperCase(),v=n instanceof lt?n:uC(n||uy)||fC(),y=v.getModel("time"),b=y.get("month"),x=y.get("monthAbbr"),w=y.get("dayOfWeek"),S=y.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,m+"").replace(/{A}/g,g+"").replace(/{yyyy}/g,i+"").replace(/{yy}/g,Gn(i%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,b[o-1]).replace(/{MMM}/g,x[o-1]).replace(/{MM}/g,Gn(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Gn(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,w[c]).replace(/{ee}/g,S[c]).replace(/{e}/g,c+"").replace(/{HH}/g,Gn(u,2)).replace(/{H}/g,u+"").replace(/{hh}/g,Gn(f+"",2)).replace(/{h}/g,f+"").replace(/{mm}/g,Gn(h,2)).replace(/{m}/g,h+"").replace(/{ss}/g,Gn(d,2)).replace(/{s}/g,d+"").replace(/{SSS}/g,Gn(p,3)).replace(/{S}/g,p+"")}function pC(t,e,r,n,a){var i=null;if(ae(r))i=r;else if(ke(r))i=r(t.value,e,{level:t.level});else{var o=q({},zo);if(t.level>0)for(var s=0;s<Cd.length;++s)o[Cd[s]]="{primary|"+o[Cd[s]]+"}";var l=r?r.inherit===!1?r:He(r,o):o,c=vy(t.value,a);if(l[c])i=l[c];else if(l.inherit){for(var u=py.indexOf(c),s=u-1;s>=0;--s)if(l[c]){i=l[c];break}i=i||o.none}if(ee(i)){var f=t.level==null?0:t.level>=0?t.level:i.length+t.level;f=Math.min(f,i.length-1),i=i[f]}}return oc(new Date(t.value),i,a,n)}function vy(t,e){var r=mn(t),n=r[Li(e)]()+1,a=r[sc(e)](),i=r[Fo(e)](),o=r[lc(e)](),s=r[cc(e)](),l=r[uc(e)](),c=l===0,u=c&&s===0,f=u&&o===0,h=f&&i===0,d=h&&a===1,p=d&&n===1;return p?"year":d?"month":h?"day":f?"hour":u?"minute":c?"second":"millisecond"}function gy(t,e,r){var n=et(t)?mn(t):t;switch(e=e||vy(t,r),e){case"year":return n[Md(r)]();case"half-year":return n[Li(r)]()>=6?1:0;case"quarter":return Math.floor((n[Li(r)]()+1)/4);case"month":return n[Li(r)]();case"day":return n[sc(r)]();case"half-day":return n[Fo(r)]()/24;case"hour":return n[Fo(r)]();case"minute":return n[lc(r)]();case"second":return n[cc(r)]();case"millisecond":return n[uc(r)]()}}function Md(t){return t?"getUTCFullYear":"getFullYear"}function Li(t){return t?"getUTCMonth":"getMonth"}function sc(t){return t?"getUTCDate":"getDate"}function Fo(t){return t?"getUTCHours":"getHours"}function lc(t){return t?"getUTCMinutes":"getMinutes"}function cc(t){return t?"getUTCSeconds":"getSeconds"}function uc(t){return t?"getUTCMilliseconds":"getMilliseconds"}function vC(t){return t?"setUTCFullYear":"setFullYear"}function my(t){return t?"setUTCMonth":"setMonth"}function yy(t){return t?"setUTCDate":"setDate"}function _y(t){return t?"setUTCHours":"setHours"}function by(t){return t?"setUTCMinutes":"setMinutes"}function xy(t){return t?"setUTCSeconds":"setSeconds"}function wy(t){return t?"setUTCMilliseconds":"setMilliseconds"}function Sy(t){if(!Ck(t))return ae(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function ky(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(r,n){return n.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var fc=_v;function Ad(t,e,r){var n="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function a(u){return u&&Gr(u)?u:"-"}function i(u){return!!(u!=null&&!isNaN(u)&&isFinite(u))}var o=e==="time",s=t instanceof Date;if(o||s){var l=o?mn(t):t;if(isNaN(+l)){if(s)return"-"}else return oc(l,n,r)}if(e==="ordinal")return Ou(t)?a(t):et(t)&&i(t)?t+"":"-";var c=Tl(t);return i(c)?Sy(c):Ou(t)?a(t):typeof t=="boolean"?t+"":"-"}var Ty=["a","b","c","d","e","f","g"],Dd=function(t,e){return"{"+t+(e??"")+"}"};function Cy(t,e,r){ee(e)||(e=[e]);var n=e.length;if(!n)return"";for(var a=e[0].$vars||[],i=0;i<a.length;i++){var o=Ty[i];t=t.replace(Dd(o),Dd(o,0))}for(var s=0;s<n;s++)for(var l=0;l<a.length;l++){var c=e[s][a[l]];t=t.replace(Dd(Ty[l],s),r?Zt(c):c)}return t}function gC(t,e){var r=ae(t)?{color:t,extraCssText:e}:t||{},n=r.color,a=r.type;e=r.extraCssText;var i=r.renderMode||"html";if(!n)return"";if(i==="html")return a==="subItem"?'<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;border-radius:4px;width:4px;height:4px;background-color:'+Zt(n)+";"+(e||"")+'"></span>':'<span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:'+Zt(n)+";"+(e||"")+'"></span>';var o=r.markerId||"markerX";return{renderMode:i,content:"{"+o+"|} ",style:a==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:n}:{width:10,height:10,borderRadius:5,backgroundColor:n}}}function Oa(t,e){return e=e||"transparent",ae(t)?t:de(t)&&t.colorStops&&(t.colorStops[0]||{}).color||e}var dc=I,mC=["left","right","top","bottom","width","height"],hc=[["width","left","right"],["height","top","bottom"]];function Id(t,e,r,n,a){var i=0,o=0;n==null&&(n=1/0),a==null&&(a=1/0);var s=0;e.eachChild(function(l,c){var u=l.getBoundingRect(),f=e.childAt(c+1),h=f&&f.getBoundingRect(),d,p;if(t==="horizontal"){var m=u.width+(h?-h.x+u.x:0);d=i+m,d>n||l.newline?(i=0,d=m,o+=s+r,s=u.height):s=Math.max(s,u.height)}else{var g=u.height+(h?-h.y+u.y:0);p=o+g,p>a||l.newline?(i+=s+r,o=0,p=g,s=u.width):s=Math.max(s,u.width)}l.newline||(l.x=i,l.y=o,l.markRedraw(),t==="horizontal"?i=d+r:o=p+r)})}var Ho=Id;dt(Id,"vertical"),dt(Id,"horizontal");function pc(t,e,r){r=fc(r||0);var n=e.width,a=e.height,i=Nt(t.left,n),o=Nt(t.top,a),s=Nt(t.right,n),l=Nt(t.bottom,a),c=Nt(t.width,n),u=Nt(t.height,a),f=r[2]+r[0],h=r[1]+r[3],d=t.aspect;switch(isNaN(c)&&(c=n-s-h-i),isNaN(u)&&(u=a-l-f-o),d!=null&&(isNaN(c)&&isNaN(u)&&(d>n/a?c=n*.8:u=a*.8),isNaN(c)&&(c=d*u),isNaN(u)&&(u=c/d)),isNaN(i)&&(i=n-s-c-h),isNaN(o)&&(o=a-l-u-f),t.left||t.right){case"center":i=n/2-c/2-r[3];break;case"right":i=n-c-h;break}switch(t.top||t.bottom){case"middle":case"center":o=a/2-u/2-r[0];break;case"bottom":o=a-u-f;break}i=i||0,o=o||0,isNaN(c)&&(c=n-h-i-(s||0)),isNaN(u)&&(u=a-f-o-(l||0));var p=new Ge(i+r[3],o+r[0],c,u);return p.margin=r,p}function Vo(t){var e=t.layoutMode||t.constructor.layoutMode;return de(e)?e:e?{type:e}:null}function Pi(t,e,r){var n=r&&r.ignoreSize;!ee(n)&&(n=[n,n]);var a=o(hc[0],0),i=o(hc[1],1);c(hc[0],t,a),c(hc[1],t,i);function o(u,f){var h={},d=0,p={},m=0,g=2;if(dc(u,function(b){p[b]=t[b]}),dc(u,function(b){s(e,b)&&(h[b]=p[b]=e[b]),l(h,b)&&d++,l(p,b)&&m++}),n[f])return l(e,u[1])?p[u[2]]=null:l(e,u[2])&&(p[u[1]]=null),p;if(m===g||!d)return p;if(d>=g)return h;for(var v=0;v<u.length;v++){var y=u[v];if(!s(h,y)&&s(t,y)){h[y]=t[y];break}}return h}function s(u,f){return u.hasOwnProperty(f)}function l(u,f){return u[f]!=null&&u[f]!=="auto"}function c(u,f,h){dc(u,function(d){f[d]=h[d]})}}function vc(t){return yC({},t)}function yC(t,e){return e&&t&&dc(mC,function(r){e.hasOwnProperty(r)&&(t[r]=e[r])}),t}var _C=ht(),Ye=(function(t){K(e,t);function e(r,n,a){var i=t.call(this,r,n,a)||this;return i.uid=rc("ec_cpt_model"),i}return e.prototype.init=function(r,n,a){this.mergeDefaultAndTheme(r,a)},e.prototype.mergeDefaultAndTheme=function(r,n){var a=Vo(this),i=a?vc(r):{},o=n.getTheme();Oe(r,o.get(this.mainType)),Oe(r,this.getDefaultOption()),a&&Pi(r,i,a)},e.prototype.mergeOption=function(r,n){Oe(this.option,r,!0);var a=Vo(this);a&&Pi(this.option,r,a)},e.prototype.optionUpdated=function(r,n){},e.prototype.getDefaultOption=function(){var r=this.constructor;if(!Ww(r))return r.defaultOption;var n=_C(this);if(!n.defaultOption){for(var a=[],i=r;i;){var o=i.prototype.defaultOption;o&&a.push(o),i=i.superClass}for(var s={},l=a.length-1;l>=0;l--)s=Oe(s,a[l],!0);n.defaultOption=s}return n.defaultOption},e.prototype.getReferringComponents=function(r,n){var a=r+"Index",i=r+"Id";return ko(this.ecModel,r,{index:this.get(a,!0),id:this.get(i,!0)},n)},e.prototype.getBoxLayoutParams=function(){var r=this;return{left:r.get("left"),top:r.get("top"),right:r.get("right"),bottom:r.get("bottom"),width:r.get("width"),height:r.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(r){this.option.zlevel=r},e.protoInitialize=(function(){var r=e.prototype;r.type="component",r.id="",r.name="",r.mainType="",r.subType="",r.componentIndex=0})(),e})(lt);kv(Ye,lt),Zs(Ye),QT(Ye),eC(Ye,bC);function bC(t){var e=[];return I(Ye.getClassesByMainType(t),function(r){e=e.concat(r.dependencies||r.prototype.dependencies||[])}),e=he(e,function(r){return $r(r).main}),t!=="dataset"&&Ue(e,"dataset")<=0&&e.unshift("dataset"),e}var My=ht(),xC=ht(),Ld=(function(){function t(){}return t.prototype.getColorFromPalette=function(e,r,n){var a=Mt(this.get("color",!0)),i=this.get("colorLayer",!0);return Dy(this,My,a,i,e,r,n)},t.prototype.clearColorPalette=function(){SC(this,My)},t})();function Ay(t,e,r,n){var a=Mt(t.get(["aria","decal","decals"]));return Dy(t,xC,a,null,e,r,n)}function wC(t,e){for(var r=t.length,n=0;n<r;n++)if(t[n].length>e)return t[n];return t[r-1]}function Dy(t,e,r,n,a,i,o){i=i||t;var s=e(i),l=s.paletteIdx||0,c=s.paletteNameMap=s.paletteNameMap||{};if(c.hasOwnProperty(a))return c[a];var u=o==null||!n?r:wC(n,o);if(u=u||r,!(!u||!u.length)){var f=u[l];return a&&(c[a]=f),s.paletteIdx=(l+1)%u.length,f}}function SC(t,e){e(t).paletteIdx=0,e(t).paletteNameMap={}}var kC=/\{@(.+?)\}/g,TC=(function(){function t(){}return t.prototype.getDataParams=function(e,r){var n=this.getData(r),a=this.getRawValue(e,r),i=n.getRawIndex(e),o=n.getName(e),s=n.getRawDataItem(e),l=n.getItemVisual(e,"style"),c=l&&l[n.getItemVisual(e,"drawType")||"fill"],u=l&&l.stroke,f=this.mainType,h=f==="series",d=n.userOutput&&n.userOutput.get();return{componentType:f,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:h?this.subType:null,seriesIndex:this.seriesIndex,seriesId:h?this.id:null,seriesName:h?this.name:null,name:o,dataIndex:i,data:s,dataType:r,value:a,color:c,borderColor:u,dimensionNames:d?d.fullDimensions:null,encode:d?d.encode:null,$vars:["seriesName","name","value"]}},t.prototype.getFormattedLabel=function(e,r,n,a,i,o){r=r||"normal";var s=this.getData(n),l=this.getDataParams(e,n);if(o&&(l.value=o.interpolatedValue),a!=null&&ee(l.value)&&(l.value=l.value[a]),!i){var c=s.getItemModel(e);i=c.get(r==="normal"?["label","formatter"]:[r,"label","formatter"])}if(ke(i))return l.status=r,l.dimensionIndex=a,i(l);if(ae(i)){var u=Cy(i,l);return u.replace(kC,function(f,h){var d=h.length,p=h;p.charAt(0)==="["&&p.charAt(d-1)==="]"&&(p=+p.slice(1,d-1));var m=ki(s,e,p);if(o&&ee(o.interpolatedValue)){var g=s.getDimensionIndex(p);g>=0&&(m=o.interpolatedValue[g])}return m!=null?m+"":""})}},t.prototype.getRawValue=function(e,r){return ki(this.getData(r),e)},t.prototype.formatTooltip=function(e,r,n){},t})();function Iy(t){var e,r;return de(t)?t.type&&(r=t):e=t,{text:e,frag:r}}function Uo(t){return new CC(t)}var CC=(function(){function t(e){e=e||{},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return t.prototype.perform=function(e){var r=this._upstream,n=e&&e.skip;if(this._dirty&&r){var a=this.context;a.data=a.outputData=r.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=this._plan(this.context));var o=u(this._modBy),s=this._modDataCount||0,l=u(e&&e.modBy),c=e&&e.modDataCount||0;(o!==l||s!==c)&&(i="reset");function u(y){return!(y>=1)&&(y=1),y}var f;(this._dirty||i==="reset")&&(this._dirty=!1,f=this._doReset(n)),this._modBy=l,this._modDataCount=c;var h=e&&e.step;if(r?this._dueEnd=r._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,p=Math.min(h!=null?this._dueIndex+h:1/0,this._dueEnd);if(!n&&(f||d<p)){var m=this._progress;if(ee(m))for(var g=0;g<m.length;g++)this._doProgress(m[g],d,p,l,c);else this._doProgress(m,d,p,l,c)}this._dueIndex=p;var v=this._settedOutputEnd!=null?this._settedOutputEnd:p;this._outputDueEnd=v}else this._dueIndex=this._outputDueEnd=this._settedOutputEnd!=null?this._settedOutputEnd:this._dueEnd;return this.unfinished()},t.prototype.dirty=function(){this._dirty=!0,this._onDirty&&this._onDirty(this.context)},t.prototype._doProgress=function(e,r,n,a,i){Ly.reset(r,n,a,i),this._callingProgress=e,this._callingProgress({start:r,end:n,count:n-r,next:Ly.next},this.context)},t.prototype._doReset=function(e){this._dueIndex=this._outputDueEnd=this._dueEnd=0,this._settedOutputEnd=null;var r,n;!e&&this._reset&&(r=this._reset(this.context),r&&r.progress&&(n=r.forceFirstProgress,r=r.progress),ee(r)&&!r.length&&(r=null)),this._progress=r,this._modBy=this._modDataCount=null;var a=this._downstream;return a&&a.dirty(),n},t.prototype.unfinished=function(){return this._progress&&this._dueIndex<this._dueEnd},t.prototype.pipe=function(e){(this._downstream!==e||this._dirty)&&(this._downstream=e,e._upstream=this,e.dirty())},t.prototype.dispose=function(){this._disposed||(this._upstream&&(this._upstream._downstream=null),this._downstream&&(this._downstream._upstream=null),this._dirty=!1,this._disposed=!0)},t.prototype.getUpstream=function(){return this._upstream},t.prototype.getDownstream=function(){return this._downstream},t.prototype.setOutputEnd=function(e){this._outputDueEnd=this._settedOutputEnd=e},t})(),Ly=(function(){var t,e,r,n,a,i={reset:function(l,c,u,f){e=l,t=c,r=u,n=f,a=Math.ceil(n/r),i.next=r>1&&n>0?s:o}};return i;function o(){return e<t?e++:null}function s(){var l=e%a*r+Math.ceil(e/a),c=e>=t?null:l<n?l:e;return e++,c}})(),MC=(function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(e){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(e){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(e,r){},t.prototype.retrieveValueFromItem=function(e,r){},t.prototype.convertValue=function(e,r){return Ql(e,r)},t})();function AC(t,e){var r=new MC,n=t.data,a=r.sourceFormat=t.sourceFormat,i=t.startIndex,o="";t.seriesLayoutBy!==xn&&Wt(o);var s=[],l={},c=t.dimensionsDefine;if(c)I(c,function(m,g){var v=m.name,y={index:g,name:v,displayName:m.displayName};if(s.push(y),v!=null){var b="";la(l,v)&&Wt(b),l[v]=y}});else for(var u=0;u<t.dimensionsDetectedCount;u++)s.push({index:u});var f=qm(a,xn);e.__isBuiltIn&&(r.getRawDataItem=function(m){return f(n,i,s,m)},r.getRawData=Ne(DC,null,t)),r.cloneRawData=Ne(IC,null,t);var h=Xm(a,xn);r.count=Ne(h,null,n,i,s);var d=Zm(a);r.retrieveValue=function(m,g){var v=f(n,i,s,m);return p(v,g)};var p=r.retrieveValueFromItem=function(m,g){if(m!=null){var v=s[g];if(v)return d(m,g,v.name)}};return r.getDimensionInfo=Ne(LC,null,s,l),r.cloneAllDimensionInfo=Ne(PC,null,s),r}function DC(t){var e=t.sourceFormat;if(!Pd(e)){var r="";Wt(r)}return t.data}function IC(t){var e=t.sourceFormat,r=t.data;if(!Pd(e)){var n="";Wt(n)}if(e===Xt){for(var a=[],i=0,o=r.length;i<o;i++)a.push(r[i].slice());return a}else if(e===Jr){for(var a=[],i=0,o=r.length;i<o;i++)a.push(q({},r[i]));return a}}function LC(t,e,r){if(r!=null){if(et(r)||!isNaN(r)&&!la(e,r))return t[r];if(la(e,r))return e[r]}}function PC(t){return Ie(t)}var Py=me();function RC(t){t=Ie(t);var e=t.type,r="";e||Wt(r);var n=e.split(":");n.length!==2&&Wt(r);var a=!1;n[0]==="echarts"&&(e=n[1],a=!0),t.__isBuiltIn=a,Py.set(e,t)}function EC(t,e,r){var n=Mt(t),a=n.length,i="";a||Wt(i);for(var o=0,s=a;o<s;o++){var l=n[o];e=OC(l,e),o!==s-1&&(e.length=Math.max(e.length,1))}return e}function OC(t,e,r,n){var a="";e.length||Wt(a),de(t)||Wt(a);var i=t.type,o=Py.get(i);o||Wt(a);var s=he(e,function(c){return AC(c,o)}),l=Mt(o.transform({upstream:s[0],upstreamList:s,config:Ie(t.config)}));return he(l,function(c,u){var f="";de(c)||Wt(f),c.data||Wt(f);var h=zm(c.data);Pd(h)||Wt(f);var d,p=e[0];if(p&&u===0&&!c.dimensions){var m=p.startIndex;m&&(c.data=p.data.slice(0,m).concat(c.data)),d={seriesLayoutBy:xn,sourceHeader:m,dimensions:p.metaRawOption.dimensions}}else d={seriesLayoutBy:xn,sourceHeader:0,dimensions:c.dimensions};return sd(c.data,d,null)})}function Pd(t){return t===Xt||t===Jr}var NC=(function(){function t(e){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=e}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(e,r){this._sourceList=e,this._upstreamSignList=r,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,r=this._getUpstreamSourceManagers(),n=!!r.length,a,i;if(gc(e)){var o=e,s=void 0,l=void 0,c=void 0;if(n){var u=r[0];u.prepareSource(),c=u.getSource(),s=c.data,l=c.sourceFormat,i=[u._getVersionSign()]}else s=o.get("data",!0),l=Ut(s)?Vn:yr,i=[];var f=this._getSourceMetaRawOption()||{},h=c&&c.metaRawOption||{},d=Pe(f.seriesLayoutBy,h.seriesLayoutBy)||null,p=Pe(f.sourceHeader,h.sourceHeader),m=Pe(f.dimensions,h.dimensions),g=d!==h.seriesLayoutBy||!!p!=!!h.sourceHeader||m;a=g?[sd(s,{seriesLayoutBy:d,sourceHeader:p,dimensions:m},l)]:[]}else{var v=e;if(n){var y=this._applyTransform(r);a=y.sourceList,i=y.upstreamSignList}else{var b=v.get("source",!0);a=[sd(b,this._getSourceMetaRawOption(),null)],i=[]}}this._setLocalSource(a,i)},t.prototype._applyTransform=function(e){var r=this._sourceHost,n=r.get("transform",!0),a=r.get("fromTransformResult",!0);if(a!=null){var i="";e.length!==1&&Ry(i)}var o,s=[],l=[];return I(e,function(c){c.prepareSource();var u=c.getSource(a||0),f="";a!=null&&!u&&Ry(f),s.push(u),l.push(c._getVersionSign())}),n?o=EC(n,s,{datasetIndex:r.componentIndex}):a!=null&&(o=[mT(s[0])]),{sourceList:o,upstreamSignList:l}},t.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),r=0;r<e.length;r++){var n=e[r];if(n._isDirty()||this._upstreamSignList[r]!==n._getVersionSign())return!0}},t.prototype.getSource=function(e){e=e||0;var r=this._sourceList[e];if(!r){var n=this._getUpstreamSourceManagers();return n[0]&&n[0].getSource(e)}return r},t.prototype.getSharedDataStore=function(e){var r=e.makeStoreSchema();return this._innerGetDataStore(r.dimensions,e.source,r.hash)},t.prototype._innerGetDataStore=function(e,r,n){var a=0,i=this._storeList,o=i[a];o||(o=i[a]={});var s=o[n];if(!s){var l=this._getUpstreamSourceManagers()[0];gc(this._sourceHost)&&l?s=l._innerGetDataStore(e,r,n):(s=new dd,s.initData(new $m(r,e.length),e)),o[n]=s}return s},t.prototype._getUpstreamSourceManagers=function(){var e=this._sourceHost;if(gc(e)){var r=Om(e);return r?[r.getSourceManager()]:[]}else return he(vT(e),function(n){return n.getSourceManager()})},t.prototype._getSourceMetaRawOption=function(){var e=this._sourceHost,r,n,a;if(gc(e))r=e.get("seriesLayoutBy",!0),n=e.get("sourceHeader",!0),a=e.get("dimensions",!0);else if(!this._getUpstreamSourceManagers().length){var i=e;r=i.get("seriesLayoutBy",!0),n=i.get("sourceHeader",!0),a=i.get("dimensions",!0)}return{seriesLayoutBy:r,sourceHeader:n,dimensions:a}},t})();function gc(t){return t.mainType==="series"}function Ry(t){throw new Error(t)}var BC="line-height:1";function Ey(t){var e=t.lineHeight;return e==null?BC:"line-height:"+Zt(e+"")+"px"}function Oy(t,e){var r=t.color||"#6e7079",n=t.fontSize||12,a=t.fontWeight||"400",i=t.color||"#464646",o=t.fontSize||14,s=t.fontWeight||"900";return e==="html"?{nameStyle:"font-size:"+Zt(n+"")+"px;color:"+Zt(r)+";font-weight:"+Zt(a+""),valueStyle:"font-size:"+Zt(o+"")+"px;color:"+Zt(i)+";font-weight:"+Zt(s+"")}:{nameStyle:{fontSize:n,fill:r,fontWeight:a},valueStyle:{fontSize:o,fill:i,fontWeight:s}}}var zC=[0,10,20,30],FC=["",`
13
- `,`
14
-
15
- `,`
16
-
17
-
18
- `];function Go(t,e){return e.type=t,e}function Rd(t){return t.type==="section"}function Ny(t){return Rd(t)?HC:VC}function By(t){if(Rd(t)){var e=0,r=t.blocks.length,n=r>1||r>0&&!t.noHeader;return I(t.blocks,function(a){var i=By(a);i>=e&&(e=i+ +(n&&(!i||Rd(a)&&!a.noHeader)))}),e}return 0}function HC(t,e,r,n){var a=e.noHeader,i=UC(By(e)),o=[],s=e.blocks||[];dn(!s||ee(s)),s=s||[];var l=t.orderMode;if(e.sortBlocks&&l){s=s.slice();var c={valueAsc:"asc",valueDesc:"desc"};if(la(c,l)){var u=new MT(c[l],null);s.sort(function(m,g){return u.evaluate(m.sortParam,g.sortParam)})}else l==="seriesDesc"&&s.reverse()}I(s,function(m,g){var v=e.valueFormatter,y=Ny(m)(v?q(q({},t),{valueFormatter:v}):t,m,g>0?i.html:0,n);y!=null&&o.push(y)});var f=t.renderMode==="richText"?o.join(i.richText):Ed(n,o.join(""),a?r:i.html);if(a)return f;var h=Ad(e.header,"ordinal",t.useUTC),d=Oy(n,t.renderMode).nameStyle,p=Ey(n);return t.renderMode==="richText"?Fy(t,h,d)+i.richText+f:Ed(n,'<div style="'+d+";"+p+';">'+Zt(h)+"</div>"+f,r)}function VC(t,e,r,n){var a=t.renderMode,i=e.noName,o=e.noValue,s=!e.markerType,l=e.name,c=t.useUTC,u=e.valueFormatter||t.valueFormatter||function(x){return x=ee(x)?x:[x],he(x,function(w,S){return Ad(w,ee(d)?d[S]:d,c)})};if(!(i&&o)){var f=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",a),h=i?"":Ad(l,"ordinal",c),d=e.valueType,p=o?[]:u(e.value,e.dataIndex),m=!s||!i,g=!s&&i,v=Oy(n,a),y=v.nameStyle,b=v.valueStyle;return a==="richText"?(s?"":f)+(i?"":Fy(t,h,y))+(o?"":WC(t,p,m,g,b)):Ed(n,(s?"":f)+(i?"":GC(h,!s,y))+(o?"":$C(p,m,g,b)),r)}}function zy(t,e,r,n,a,i){if(t){var o=Ny(t),s={useUTC:a,renderMode:r,orderMode:n,markupStyleCreator:e,valueFormatter:t.valueFormatter};return o(s,t,0,i)}}function UC(t){return{html:zC[t],richText:FC[t]}}function Ed(t,e,r){var n='<div style="clear:both"></div>',a="margin: "+r+"px 0 0",i=Ey(t);return'<div style="'+a+";"+i+';">'+e+n+"</div>"}function GC(t,e,r){var n=e?"margin-left:2px":"";return'<span style="'+r+";"+n+'">'+Zt(t)+"</span>"}function $C(t,e,r,n){var a=r?"10px":"20px",i=e?"float:right;margin-left:"+a:"";return t=ee(t)?t:[t],'<span style="'+i+";"+n+'">'+he(t,function(o){return Zt(o)}).join("&nbsp;&nbsp;")+"</span>"}function Fy(t,e,r){return t.markupStyleCreator.wrapRichTextStyle(e,r)}function WC(t,e,r,n,a){var i=[a],o=n?10:20;return r&&i.push({padding:[0,0,0,o],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(ee(e)?e.join(" "):e,i)}function qC(t,e){var r=t.getData().getItemVisual(e,"style"),n=r[t.visualDrawType];return Oa(n)}function Hy(t,e){var r=t.get("padding");return r??(e==="richText"?[8,10]:10)}var Od=(function(){function t(){this.richTextStyles={},this._nextStyleNameId=Cg()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(e,r,n){var a=n==="richText"?this._generateStyleName():null,i=gC({color:r,type:e,renderMode:n,markerId:a});return ae(i)?i:(this.richTextStyles[a]=i.style,i.content)},t.prototype.wrapRichTextStyle=function(e,r){var n={};ee(r)?I(r,function(i){return q(n,i)}):q(n,r);var a=this._generateStyleName();return this.richTextStyles[a]=n,"{"+a+"|"+e+"}"},t})();function YC(t){var e=t.series,r=t.dataIndex,n=t.multipleSeries,a=e.getData(),i=a.mapDimensionsAll("defaultedTooltip"),o=i.length,s=e.getRawValue(r),l=ee(s),c=qC(e,r),u,f,h,d;if(o>1||l&&!o){var p=XC(s,e,r,i,c);u=p.inlineValues,f=p.inlineValueTypes,h=p.blocks,d=p.inlineValues[0]}else if(o){var m=a.getDimensionInfo(i[0]);d=u=ki(a,r,i[0]),f=m.type}else d=u=l?s[0]:s;var g=Df(e),v=g&&e.name||"",y=a.getName(r),b=n?v:y;return Go("section",{header:v,noHeader:n||!g,sortParam:d,blocks:[Go("nameValue",{markerType:"item",markerColor:c,name:b,noName:!Gr(b),value:u,valueType:f,dataIndex:r})].concat(h||[])})}function XC(t,e,r,n,a){var i=e.getData(),o=ni(t,function(f,h,d){var p=i.getDimensionInfo(d);return f=f||p&&p.tooltip!==!1&&p.displayName!=null},!1),s=[],l=[],c=[];n.length?I(n,function(f){u(ki(i,r,f),f)}):I(t,u);function u(f,h){var d=i.getDimensionInfo(h);!d||d.otherDims.tooltip===!1||(o?c.push(Go("nameValue",{markerType:"subItem",markerColor:a,name:d.displayName,value:f,valueType:d.type})):(s.push(f),l.push(d.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:c}}var $n=ht();function mc(t,e){return t.getName(e)||t.getId(e)}var ZC="__universalTransitionEnabled",Qr=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._selectedDataIndicesMap={},r}return e.prototype.init=function(r,n,a){this.seriesIndex=this.componentIndex,this.dataTask=Uo({count:jC,reset:JC}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(r,a);var i=$n(this).sourceManager=new NC(this);i.prepareSource();var o=this.getInitialData(r,a);Uy(o,this),this.dataTask.context.data=o,$n(this).dataBeforeProcessed=o,Vy(this),this._initSelectedMapFromData(o)},e.prototype.mergeDefaultAndTheme=function(r,n){var a=Vo(this),i=a?vc(r):{},o=this.subType;Ye.hasClass(o)&&(o+="Series"),Oe(r,n.getTheme().get(this.subType)),Oe(r,this.getDefaultOption()),Lg(r,"label",["show"]),this.fillDataTextStyle(r.data),a&&Pi(r,i,a)},e.prototype.mergeOption=function(r,n){r=Oe(this.option,r,!0),this.fillDataTextStyle(r.data);var a=Vo(this);a&&Pi(this.option,r,a);var i=$n(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(r,n);Uy(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,$n(this).dataBeforeProcessed=o,Vy(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(r){if(r&&!Ut(r))for(var n=["show"],a=0;a<r.length;a++)r[a]&&r[a].label&&Lg(r[a],"label",n)},e.prototype.getInitialData=function(r,n){},e.prototype.appendData=function(r){var n=this.getRawData();n.appendData(r.data)},e.prototype.getData=function(r){var n=Nd(this);if(n){var a=n.context.data;return r==null||!a.getLinkedData?a:a.getLinkedData(r)}else return $n(this).data},e.prototype.getAllData=function(){var r=this.getData();return r&&r.getLinkedDataAll?r.getLinkedDataAll():[{data:r}]},e.prototype.setData=function(r){var n=Nd(this);if(n){var a=n.context;a.outputData=r,n!==this.dataTask&&(a.data=r)}$n(this).data=r},e.prototype.getEncode=function(){var r=this.get("encode",!0);if(r)return me(r)},e.prototype.getSourceManager=function(){return $n(this).sourceManager},e.prototype.getSource=function(){return this.getSourceManager().getSource()},e.prototype.getRawData=function(){return $n(this).dataBeforeProcessed},e.prototype.getColorBy=function(){var r=this.get("colorBy");return r||"series"},e.prototype.isColorBySeries=function(){return this.getColorBy()==="series"},e.prototype.getBaseAxis=function(){var r=this.coordinateSystem;return r&&r.getBaseAxis&&r.getBaseAxis()},e.prototype.formatTooltip=function(r,n,a){return YC({series:this,dataIndex:r,multipleSeries:n})},e.prototype.isAnimationEnabled=function(){var r=this.ecModel;if(_e.node&&!(r&&r.ssr))return!1;var n=this.getShallow("animation");return n&&this.getData().count()>this.getShallow("animationThreshold")&&(n=!1),!!n},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(r,n,a){var i=this.ecModel,o=Ld.prototype.getColorFromPalette.call(this,r,n,a);return o||(o=i.getColorFromPalette(r,n,a)),o},e.prototype.coordDimToDataDim=function(r){return this.getRawData().mapDimensionsAll(r)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(r,n){this._innerSelect(this.getData(n),r)},e.prototype.unselect=function(r,n){var a=this.option.selectedMap;if(a){var i=this.option.selectedMode,o=this.getData(n);if(i==="series"||a==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s<r.length;s++){var l=r[s],c=mc(o,l);a[c]=!1,this._selectedDataIndicesMap[c]=-1}}},e.prototype.toggleSelect=function(r,n){for(var a=[],i=0;i<r.length;i++)a[0]=r[i],this.isSelected(r[i],n)?this.unselect(a,n):this.select(a,n)},e.prototype.getSelectedDataIndices=function(){if(this.option.selectedMap==="all")return[].slice.call(this.getData().getIndices());for(var r=this._selectedDataIndicesMap,n=at(r),a=[],i=0;i<n.length;i++){var o=r[n[i]];o>=0&&a.push(o)}return a},e.prototype.isSelected=function(r,n){var a=this.option.selectedMap;if(!a)return!1;var i=this.getData(n);return(a==="all"||a[mc(i,r)])&&!i.getItemModel(r).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[ZC])return!0;var r=this.option.universalTransition;return r?r===!0?!0:r&&r.enabled:!1},e.prototype._innerSelect=function(r,n){var a,i,o=this.option,s=o.selectedMode,l=n.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){de(o.selectedMap)||(o.selectedMap={});for(var c=o.selectedMap,u=0;u<l;u++){var f=n[u],h=mc(r,f);c[h]=!0,this._selectedDataIndicesMap[h]=r.getRawIndex(f)}}else if(s==="single"||s===!0){var d=n[l-1],h=mc(r,d);o.selectedMap=(a={},a[h]=!0,a),this._selectedDataIndicesMap=(i={},i[h]=r.getRawIndex(d),i)}}},e.prototype._initSelectedMapFromData=function(r){if(!this.option.selectedMap){var n=[];r.hasItemOption&&r.each(function(a){var i=r.getRawDataItem(a);i&&i.selected&&n.push(a)}),n.length>0&&this._innerSelect(r,n)}},e.registerClass=function(r){return Ye.registerClass(r)},e.protoInitialize=(function(){var r=e.prototype;r.type="series.__base__",r.seriesIndex=0,r.ignoreStyleOnData=!1,r.hasSymbolVisual=!1,r.defaultSymbol="circle",r.visualStyleAccessPath="itemStyle",r.visualDrawType="fill"})(),e})(Ye);Ur(Qr,TC),Ur(Qr,Ld),kv(Qr,Ye);function Vy(t){var e=t.name;Df(t)||(t.name=KC(t)||e)}function KC(t){var e=t.getRawData(),r=e.mapDimensionsAll("seriesName"),n=[];return I(r,function(a){var i=e.getDimensionInfo(a);i.displayName&&n.push(i.displayName)}),n.join(" ")}function jC(t){return t.model.getRawData().count()}function JC(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),QC}function QC(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Uy(t,e){I(zw(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),function(r){t.wrapMethod(r,dt(eM,e))})}function eM(t,e){var r=Nd(t);return r&&r.setOutputEnd((e||this).count()),e}function Nd(t){var e=(t.ecModel||{}).scheduler,r=e&&e.getPipeline(t.uid);if(r){var n=r.currentTask;if(n){var a=n.agentStubMap;a&&(n=a.get(t.uid))}return n}}var tM=qe.extend({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var r=e.cx,n=e.cy,a=e.width/2,i=e.height/2;t.moveTo(r,n-i),t.lineTo(r+a,n+i),t.lineTo(r-a,n+i),t.closePath()}}),rM=qe.extend({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var r=e.cx,n=e.cy,a=e.width/2,i=e.height/2;t.moveTo(r,n-i),t.lineTo(r+a,n),t.lineTo(r,n+i),t.lineTo(r-a,n),t.closePath()}}),nM=qe.extend({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var r=e.x,n=e.y,a=e.width/5*3,i=Math.max(a,e.height),o=a/2,s=o*o/(i-o),l=n-i+o+s,c=Math.asin(s/o),u=Math.cos(c)*o,f=Math.sin(c),h=Math.cos(c),d=o*.6,p=o*.7;t.moveTo(r-u,l+s),t.arc(r,l,o,Math.PI-c,Math.PI*2+c),t.bezierCurveTo(r+u-f*d,l+s+h*d,r,n-p,r,n),t.bezierCurveTo(r,n-p,r-u+f*d,l+s+h*d,r-u,l+s),t.closePath()}}),aM=qe.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var r=e.height,n=e.width,a=e.x,i=e.y,o=n/3*2;t.moveTo(a,i),t.lineTo(a+o,i+r),t.lineTo(a,i+r/4*3),t.lineTo(a-o,i+r),t.lineTo(a,i),t.closePath()}}),iM={line:Hn,rect:_t,roundRect:_t,square:_t,circle:Nl,diamond:rM,pin:nM,arrow:aM,triangle:tM},oM={line:function(t,e,r,n,a){a.x1=t,a.y1=e+n/2,a.x2=t+r,a.y2=e+n/2},rect:function(t,e,r,n,a){a.x=t,a.y=e,a.width=r,a.height=n},roundRect:function(t,e,r,n,a){a.x=t,a.y=e,a.width=r,a.height=n,a.r=Math.min(r,n)/4},square:function(t,e,r,n,a){var i=Math.min(r,n);a.x=t,a.y=e,a.width=i,a.height=i},circle:function(t,e,r,n,a){a.cx=t+r/2,a.cy=e+n/2,a.r=Math.min(r,n)/2},diamond:function(t,e,r,n,a){a.cx=t+r/2,a.cy=e+n/2,a.width=r,a.height=n},pin:function(t,e,r,n,a){a.x=t+r/2,a.y=e+n/2,a.width=r,a.height=n},arrow:function(t,e,r,n,a){a.x=t+r/2,a.y=e+n/2,a.width=r,a.height=n},triangle:function(t,e,r,n,a){a.cx=t+r/2,a.cy=e+n/2,a.width=r,a.height=n}},Bd={};I(iM,function(t,e){Bd[e]=new t});var sM=qe.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(t,e,r){var n=Qs(t,e,r),a=this.shape;return a&&a.symbolType==="pin"&&e.position==="inside"&&(n.y=r.y+r.height*.4),n},buildPath:function(t,e,r){var n=e.symbolType;if(n!=="none"){var a=Bd[n];a||(n="rect",a=Bd[n]),oM[n](e.x,e.y,e.width,e.height,a.shape),a.buildPath(t,a.shape,r)}}});function lM(t,e){if(this.type!=="image"){var r=this.style;this.__isEmptyBrush?(r.stroke=t,r.fill=e||"#fff",r.lineWidth=2):this.shape.symbolType==="line"?r.stroke=t:r.fill=t,this.markRedraw()}}function Ri(t,e,r,n,a,i,o){var s=t.indexOf("empty")===0;s&&(t=t.substr(5,1).toLowerCase()+t.substr(6));var l;return t.indexOf("image://")===0?l=gm(t.slice(8),new Ge(e,r,n,a),o?"center":"cover"):t.indexOf("path://")===0?l=ed(t.slice(7),{},new Ge(e,r,n,a),o?"center":"cover"):l=new sM({shape:{symbolType:t,x:e,y:r,width:n,height:a}}),l.__isEmptyBrush=s,l.setColor=lM,i&&l.setColor(i),l}function cM(t){return ee(t)||(t=[+t,+t]),[t[0]||0,t[1]||0]}function Gy(t,e){if(t!=null)return ee(t)||(t=[t,t]),[Nt(t[0],e[0])||0,Nt(Pe(t[1],t[0]),e[1])||0]}var uM=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.hasSymbolVisual=!0,r}return e.prototype.getInitialData=function(r){return md(null,this,{useEncodeDefaulter:!0})},e.prototype.getLegendIcon=function(r){var n=new St,a=Ri("line",0,r.itemHeight/2,r.itemWidth,0,r.lineStyle.stroke,!1);n.add(a),a.setStyle(r.lineStyle);var i=this.getData().getVisual("symbol"),o=this.getData().getVisual("symbolRotate"),s=i==="none"?"circle":i,l=r.itemHeight*.8,c=Ri(s,(r.itemWidth-l)/2,(r.itemHeight-l)/2,l,l,r.itemStyle.fill);n.add(c),c.setStyle(r.itemStyle);var u=r.iconRotate==="inherit"?o:r.iconRotate||0;return c.rotation=u*Math.PI/180,c.setOrigin([r.itemWidth/2,r.itemHeight/2]),s.indexOf("empty")>-1&&(c.style.stroke=c.style.fill,c.style.fill="#fff",c.style.lineWidth=2),n},e.type="series.line",e.dependencies=["grid","polar"],e.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:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},e})(Qr);function zd(t,e){var r=t.mapDimensionsAll("defaultedLabel"),n=r.length;if(n===1){var a=ki(t,e,r[0]);return a!=null?a+"":null}else if(n){for(var i=[],o=0;o<r.length;o++)i.push(ki(t,e,r[o]));return i.join(" ")}}function $y(t,e){var r=t.mapDimensionsAll("defaultedLabel");if(!ee(e))return e+"";for(var n=[],a=0;a<r.length;a++){var i=t.getDimensionIndex(r[a]);i>=0&&n.push(e[i])}return n.join(" ")}var Fd=(function(t){K(e,t);function e(r,n,a,i){var o=t.call(this)||this;return o.updateData(r,n,a,i),o}return e.prototype._createSymbol=function(r,n,a,i,o){this.removeAll();var s=Ri(r,-1,-1,2,2,null,o);s.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),s.drift=fM,this._symbolType=r,this.add(s)},e.prototype.stopSymbolAnimation=function(r){this.childAt(0).stopAnimation(null,r)},e.prototype.getSymbolType=function(){return this._symbolType},e.prototype.getSymbolPath=function(){return this.childAt(0)},e.prototype.highlight=function(){Ll(this.childAt(0))},e.prototype.downplay=function(){Pl(this.childAt(0))},e.prototype.setZ=function(r,n){var a=this.childAt(0);a.zlevel=r,a.z=n},e.prototype.setDraggable=function(r,n){var a=this.childAt(0);a.draggable=r,a.cursor=!n&&r?"move":a.cursor},e.prototype.updateData=function(r,n,a,i){this.silent=!1;var o=r.getItemVisual(n,"symbol")||"circle",s=r.hostModel,l=e.getSymbolSize(r,n),c=o!==this._symbolType,u=i&&i.disableAnimation;if(c){var f=r.getItemVisual(n,"symbolKeepAspect");this._createSymbol(o,r,n,l,f)}else{var h=this.childAt(0);h.silent=!1;var d={scaleX:l[0]/2,scaleY:l[1]/2};u?h.attr(d):or(h,d,s,n),vm(h)}if(this._updateCommon(r,n,l,a,i),c){var h=this.childAt(0);if(!u){var d={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:h.style.opacity}};h.scaleX=h.scaleY=0,h.style.opacity=0,_n(h,d,s,n)}}u&&this.childAt(0).stopAnimation("leave")},e.prototype._updateCommon=function(r,n,a,i,o){var s=this.childAt(0),l=r.hostModel,c,u,f,h,d,p,m,g,v;if(i&&(c=i.emphasisItemStyle,u=i.blurItemStyle,f=i.selectItemStyle,h=i.focus,d=i.blurScope,m=i.labelStatesModels,g=i.hoverScale,v=i.cursorStyle,p=i.emphasisDisabled),!i||r.hasItemOption){var y=i&&i.itemModel?i.itemModel:r.getItemModel(n),b=y.getModel("emphasis");c=b.getModel("itemStyle").getItemStyle(),f=y.getModel(["select","itemStyle"]).getItemStyle(),u=y.getModel(["blur","itemStyle"]).getItemStyle(),h=b.get("focus"),d=b.get("blurScope"),p=b.get("disabled"),m=Zl(y),g=b.getShallow("scale"),v=y.getShallow("cursor")}var x=r.getItemVisual(n,"symbolRotate");s.attr("rotation",(x||0)*Math.PI/180||0);var w=Gy(r.getItemVisual(n,"symbolOffset"),a);w&&(s.x=w[0],s.y=w[1]),v&&s.attr("cursor",v);var S=r.getItemVisual(n,"style"),k=S.fill;if(s instanceof Fn){var C=s.style;s.useStyle(q({image:C.image,x:C.x,y:C.y,width:C.width,height:C.height},S))}else s.__isEmptyBrush?s.useStyle(q({},S)):s.useStyle(S),s.style.decal=null,s.setColor(k,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var A=r.getItemVisual(n,"liftZ"),M=this._z2;A!=null?M==null&&(this._z2=s.z2,s.z2+=A):M!=null&&(s.z2=M,this._z2=null);var T=o&&o.useNameLabel;Xl(s,m,{labelFetcher:l,labelDataIndex:n,defaultText:D,inheritColor:k,defaultOpacity:S.opacity});function D(O){return T?r.getName(O):zd(r,O)}this._sizeX=a[0]/2,this._sizeY=a[1]/2;var L=s.ensureState("emphasis");L.style=c,s.ensureState("select").style=f,s.ensureState("blur").style=u;var R=g==null||g===!0?Math.max(1.1,3/this._sizeY):isFinite(g)&&g>0?+g:1;L.scaleX=this._sizeX*R,L.scaleY=this._sizeY*R,this.setSymbolScale(1),Rl(this,h,d,p)},e.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},e.prototype.fadeOut=function(r,n,a){var i=this.childAt(0),o=We(this).dataIndex,s=a&&a.animation;if(this.silent=i.silent=!0,a&&a.fadeLabel){var l=i.getTextContent();l&&Ul(l,{style:{opacity:0}},n,{dataIndex:o,removeOpt:s,cb:function(){i.removeTextContent()}})}else i.removeTextContent();Ul(i,{style:{opacity:0},scaleX:0,scaleY:0},n,{dataIndex:o,cb:r,removeOpt:s})},e.getSymbolSize=function(r,n){return cM(r.getItemVisual(n,"symbolSize"))},e})(St);function fM(t,e){this.parent.drift(t,e)}function Hd(t,e,r,n){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(n.isIgnore&&n.isIgnore(r))&&!(n.clipShape&&!n.clipShape.contain(e[0],e[1]))&&t.getItemVisual(r,"symbol")!=="none"}function Wy(t){return t!=null&&!de(t)&&(t={isIgnore:t}),t||{}}function qy(t){var e=t.hostModel,r=e.getModel("emphasis");return{emphasisItemStyle:r.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:r.get("focus"),blurScope:r.get("blurScope"),emphasisDisabled:r.get("disabled"),hoverScale:r.get("scale"),labelStatesModels:Zl(e),cursorStyle:e.get("cursor")}}var dM=(function(){function t(e){this.group=new St,this._SymbolCtor=e||Fd}return t.prototype.updateData=function(e,r){this._progressiveEls=null,r=Wy(r);var n=this.group,a=e.hostModel,i=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=qy(e),c={disableAnimation:s},u=r.getSymbolPoint||function(f){return e.getItemLayout(f)};i||n.removeAll(),e.diff(i).add(function(f){var h=u(f);if(Hd(e,h,f,r)){var d=new o(e,f,l,c);d.setPosition(h),e.setItemGraphicEl(f,d),n.add(d)}}).update(function(f,h){var d=i.getItemGraphicEl(h),p=u(f);if(!Hd(e,p,f,r)){n.remove(d);return}var m=e.getItemVisual(f,"symbol")||"circle",g=d&&d.getSymbolType&&d.getSymbolType();if(!d||g&&g!==m)n.remove(d),d=new o(e,f,l,c),d.setPosition(p);else{d.updateData(e,f,l,c);var v={x:p[0],y:p[1]};s?d.attr(v):or(d,v,a)}n.add(d),e.setItemGraphicEl(f,d)}).remove(function(f){var h=i.getItemGraphicEl(f);h&&h.fadeOut(function(){n.remove(h)},a)}).execute(),this._getSymbolPoint=u,this._data=e},t.prototype.updateLayout=function(){var e=this,r=this._data;r&&r.eachItemGraphicEl(function(n,a){var i=e._getSymbolPoint(a);n.setPosition(i),n.markRedraw()})},t.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=qy(e),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(e,r,n){this._progressiveEls=[],n=Wy(n);function a(l){l.isGroup||(l.incremental=!0,l.ensureState("emphasis").hoverLayer=!0)}for(var i=e.start;i<e.end;i++){var o=r.getItemLayout(i);if(Hd(r,o,i,n)){var s=new this._SymbolCtor(r,i,this._seriesScope);s.traverse(a),s.setPosition(o),this.group.add(s),r.setItemGraphicEl(i,s),this._progressiveEls.push(s)}}},t.prototype.eachRendered=function(e){ql(this._progressiveEls||this.group,e)},t.prototype.remove=function(e){var r=this.group,n=this._data;n&&e?n.eachItemGraphicEl(function(a){a.fadeOut(function(){r.remove(a)},n.hostModel)}):r.removeAll()},t})();function Yy(t,e,r){var n=t.getBaseAxis(),a=t.getOtherAxis(n),i=hM(a,r),o=n.dim,s=a.dim,l=e.mapDimension(s),c=e.mapDimension(o),u=s==="x"||s==="radius"?1:0,f=he(t.dimensions,function(p){return e.mapDimension(p)}),h=!1,d=e.getCalculationInfo("stackResultDimension");return Ai(e,f[0])&&(h=!0,f[0]=d),Ai(e,f[1])&&(h=!0,f[1]=d),{dataDimsForPoint:f,valueStart:i,valueAxisDim:s,baseAxisDim:o,stacked:!!h,valueDim:l,baseDim:c,baseDataOffset:u,stackedOverDimension:e.getCalculationInfo("stackedOverDimension")}}function hM(t,e){var r=0,n=t.scale.getExtent();return e==="start"?r=n[0]:e==="end"?r=n[1]:et(e)&&!isNaN(e)?r=e:n[0]>0?r=n[0]:n[1]<0&&(r=n[1]),r}function Xy(t,e,r,n){var a=NaN;t.stacked&&(a=r.get(r.getCalculationInfo("stackedOverDimension"),n)),isNaN(a)&&(a=t.valueStart);var i=t.baseDataOffset,o=[];return o[i]=r.get(t.baseDim,n),o[1-i]=a,e.dataToPoint(o)}var Zy=typeof Float32Array<"u",pM=Zy?Float32Array:Array;function wn(t){return ee(t)?Zy?new Float32Array(t):t:new pM(t)}function vM(t,e){var r=[];return e.diff(t).add(function(n){r.push({cmd:"+",idx:n})}).update(function(n,a){r.push({cmd:"=",idx:a,idx1:n})}).remove(function(n){r.push({cmd:"-",idx:n})}).execute(),r}function gM(t,e,r,n,a,i,o,s){for(var l=vM(t,e),c=[],u=[],f=[],h=[],d=[],p=[],m=[],g=Yy(a,e,o),v=t.getLayout("points")||[],y=e.getLayout("points")||[],b=0;b<l.length;b++){var x=l[b],w=!0,S=void 0,k=void 0;switch(x.cmd){case"=":S=x.idx*2,k=x.idx1*2;var C=v[S],A=v[S+1],M=y[k],T=y[k+1];(isNaN(C)||isNaN(A))&&(C=M,A=T),c.push(C,A),u.push(M,T),f.push(r[S],r[S+1]),h.push(n[k],n[k+1]),m.push(e.getRawIndex(x.idx1));break;case"+":var D=x.idx,L=g.dataDimsForPoint,R=a.dataToPoint([e.get(L[0],D),e.get(L[1],D)]);k=D*2,c.push(R[0],R[1]),u.push(y[k],y[k+1]);var O=Xy(g,a,e,D);f.push(O[0],O[1]),h.push(n[k],n[k+1]),m.push(e.getRawIndex(D));break;case"-":w=!1}w&&(d.push(x),p.push(p.length))}p.sort(function(xe,Ce){return m[xe]-m[Ce]});for(var B=c.length,j=wn(B),P=wn(B),V=wn(B),H=wn(B),Z=[],b=0;b<p.length;b++){var re=p[b],Te=b*2,ge=re*2;j[Te]=c[ge],j[Te+1]=c[ge+1],P[Te]=u[ge],P[Te+1]=u[ge+1],V[Te]=f[ge],V[Te+1]=f[ge+1],H[Te]=h[ge],H[Te+1]=h[ge+1],Z[b]=d[re]}return{current:j,next:P,stackedOnCurrent:V,stackedOnNext:H,status:Z}}var Wn=Math.min,qn=Math.max;function Na(t,e){return isNaN(t)||isNaN(e)}function Vd(t,e,r,n,a,i,o,s,l){for(var c,u,f,h,d,p,m=r,g=0;g<n;g++){var v=e[m*2],y=e[m*2+1];if(m>=a||m<0)break;if(Na(v,y)){if(l){m+=i;continue}break}if(m===r)t[i>0?"moveTo":"lineTo"](v,y),f=v,h=y;else{var b=v-c,x=y-u;if(b*b+x*x<.5){m+=i;continue}if(o>0){for(var w=m+i,S=e[w*2],k=e[w*2+1];S===v&&k===y&&g<n;)g++,w+=i,m+=i,S=e[w*2],k=e[w*2+1],v=e[m*2],y=e[m*2+1],b=v-c,x=y-u;var C=g+1;if(l)for(;Na(S,k)&&C<n;)C++,w+=i,S=e[w*2],k=e[w*2+1];var A=.5,M=0,T=0,D=void 0,L=void 0;if(C>=n||Na(S,k))d=v,p=y;else{M=S-c,T=k-u;var R=v-c,O=S-v,B=y-u,j=k-y,P=void 0,V=void 0;if(s==="x"){P=Math.abs(R),V=Math.abs(O);var H=M>0?1:-1;d=v-H*P*o,p=y,D=v+H*V*o,L=y}else if(s==="y"){P=Math.abs(B),V=Math.abs(j);var Z=T>0?1:-1;d=v,p=y-Z*P*o,D=v,L=y+Z*V*o}else P=Math.sqrt(R*R+B*B),V=Math.sqrt(O*O+j*j),A=V/(V+P),d=v-M*o*(1-A),p=y-T*o*(1-A),D=v+M*o*A,L=y+T*o*A,D=Wn(D,qn(S,v)),L=Wn(L,qn(k,y)),D=qn(D,Wn(S,v)),L=qn(L,Wn(k,y)),M=D-v,T=L-y,d=v-M*P/V,p=y-T*P/V,d=Wn(d,qn(c,v)),p=Wn(p,qn(u,y)),d=qn(d,Wn(c,v)),p=qn(p,Wn(u,y)),M=v-d,T=y-p,D=v+M*V/P,L=y+T*V/P}t.bezierCurveTo(f,h,d,p,v,y),f=D,h=L}else t.lineTo(v,y)}c=v,u=y,m+=i}return g}var Ky=(function(){function t(){this.smooth=0,this.smoothConstraint=!0}return t})(),mM=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="ec-polyline",n}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Ky},e.prototype.buildPath=function(r,n){var a=n.points,i=0,o=a.length/2;if(n.connectNulls){for(;o>0&&Na(a[o*2-2],a[o*2-1]);o--);for(;i<o&&Na(a[i*2],a[i*2+1]);i++);}for(;i<o;)i+=Vd(r,a,i,o,o,1,n.smooth,n.smoothMonotone,n.connectNulls)+1},e.prototype.getPointOn=function(r,n){this.path||(this.createPathProxy(),this.buildPath(this.path,this.shape));for(var a=this.path,i=a.data,o=wa.CMD,s,l,c=n==="x",u=[],f=0;f<i.length;){var h=i[f++],d=void 0,p=void 0,m=void 0,g=void 0,v=void 0,y=void 0,b=void 0;switch(h){case o.M:s=i[f++],l=i[f++];break;case o.L:if(d=i[f++],p=i[f++],b=c?(r-s)/(d-s):(r-l)/(p-l),b<=1&&b>=0){var x=c?(p-l)*b+l:(d-s)*b+s;return c?[r,x]:[x,r]}s=d,l=p;break;case o.C:d=i[f++],p=i[f++],m=i[f++],g=i[f++],v=i[f++],y=i[f++];var w=c?nl(s,d,m,v,r,u):nl(l,p,g,y,r,u);if(w>0)for(var S=0;S<w;S++){var k=u[S];if(k<=1&&k>=0){var x=c?wt(l,p,g,y,k):wt(s,d,m,v,k);return c?[r,x]:[x,r]}}s=v,l=y;break}}},e})(qe),yM=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(Ky),_M=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="ec-polygon",n}return e.prototype.getDefaultShape=function(){return new yM},e.prototype.buildPath=function(r,n){var a=n.points,i=n.stackedOnPoints,o=0,s=a.length/2,l=n.smoothMonotone;if(n.connectNulls){for(;s>0&&Na(a[s*2-2],a[s*2-1]);s--);for(;o<s&&Na(a[o*2],a[o*2+1]);o++);}for(;o<s;){var c=Vd(r,a,o,s,s,1,n.smooth,l,n.connectNulls);Vd(r,i,o+c-1,c,s,-1,n.stackedOnSmooth,l,n.connectNulls),o+=c+1,r.closePath()}},e})(qe);function Ud(){var t=ht();return function(e){var r=t(e),n=e.pipelineContext,a=!!r.large,i=!!r.progressiveRender,o=r.large=!!(n&&n.large),s=r.progressiveRender=!!(n&&n.progressiveRender);return(a!==o||i!==s)&&"reset"}}var jy=ht(),bM=Ud(),Rr=(function(){function t(){this.group=new St,this.uid=rc("viewChart"),this.renderTask=Uo({plan:xM,reset:wM}),this.renderTask.context={view:this}}return t.prototype.init=function(e,r){},t.prototype.render=function(e,r,n,a){},t.prototype.highlight=function(e,r,n,a){var i=e.getData(a&&a.dataType);i&&Qy(i,a,"emphasis")},t.prototype.downplay=function(e,r,n,a){var i=e.getData(a&&a.dataType);i&&Qy(i,a,"normal")},t.prototype.remove=function(e,r){this.group.removeAll()},t.prototype.dispose=function(e,r){},t.prototype.updateView=function(e,r,n,a){this.render(e,r,n,a)},t.prototype.updateLayout=function(e,r,n,a){this.render(e,r,n,a)},t.prototype.updateVisual=function(e,r,n,a){this.render(e,r,n,a)},t.prototype.eachRendered=function(e){ql(this.group,e)},t.markUpdateMethod=function(e,r){jy(e).updateMethod=r},t.protoInitialize=(function(){var e=t.prototype;e.type="chart"})(),t})();function Jy(t,e,r){t&&Vf(t)&&(e==="emphasis"?Ll:Pl)(t,r)}function Qy(t,e,r){var n=Ma(t,e),a=e&&e.highlightKey!=null?l2(e.highlightKey):null;n!=null?I(Mt(n),function(i){Jy(t.getItemGraphicEl(i),r,a)}):t.eachItemGraphicEl(function(i){Jy(i,r,a)})}zu(Rr),Zs(Rr);function xM(t){return bM(t.model)}function wM(t){var e=t.model,r=t.ecModel,n=t.api,a=t.payload,i=e.pipelineContext.progressiveRender,o=t.view,s=a&&jy(a).updateMethod,l=i?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](e,r,n,a),SM[l]}var SM={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}};function e0(t,e,r,n,a){var i=t.getArea(),o=i.x,s=i.y,l=i.width,c=i.height,u=r.get(["lineStyle","width"])||0;o-=u/2,s-=u/2,l+=u,c+=u,l=Math.ceil(l),o!==Math.floor(o)&&(o=Math.floor(o),l++);var f=new _t({shape:{x:o,y:s,width:l,height:c}});if(e){var h=t.getBaseAxis(),d=h.isHorizontal(),p=h.inverse;d?(p&&(f.shape.x+=l),f.shape.width=0):(p||(f.shape.y+=c),f.shape.height=0);var m=ke(a)?function(g){a(g,f)}:null;_n(f,{shape:{width:l,height:c,x:o,y:s}},r,null,n,m)}return f}function t0(t,e,r){var n=t.getArea(),a=mt(n.r0,1),i=mt(n.r,1),o=new xi({shape:{cx:mt(t.cx,1),cy:mt(t.cy,1),r0:a,r:i,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}});if(e){var s=t.getBaseAxis().dim==="angle";s?o.shape.endAngle=n.startAngle:o.shape.r=a,_n(o,{shape:{endAngle:n.endAngle,r:i}},r)}return o}function kM(t,e,r,n,a){if(t){if(t.type==="polar")return t0(t,e,r);if(t.type==="cartesian2d")return e0(t,e,r,n,a)}else return null;return null}function Gd(t,e){return t.type===e}function r0(t,e){if(t.length===e.length){for(var r=0;r<t.length;r++)if(t[r]!==e[r])return;return!0}}function n0(t){for(var e=1/0,r=1/0,n=-1/0,a=-1/0,i=0;i<t.length;){var o=t[i++],s=t[i++];isNaN(o)||(e=Math.min(o,e),n=Math.max(o,n)),isNaN(s)||(r=Math.min(s,r),a=Math.max(s,a))}return[[e,r],[n,a]]}function a0(t,e){var r=n0(t),n=r[0],a=r[1],i=n0(e),o=i[0],s=i[1];return Math.max(Math.abs(n[0]-o[0]),Math.abs(n[1]-o[1]),Math.abs(a[0]-s[0]),Math.abs(a[1]-s[1]))}function i0(t){return et(t)?t:t?.5:0}function TM(t,e,r){if(!r.valueDim)return[];for(var n=e.count(),a=wn(n*2),i=0;i<n;i++){var o=Xy(r,t,e,i);a[i*2]=o[0],a[i*2+1]=o[1]}return a}function Yn(t,e,r,n,a){var i=r.getBaseAxis(),o=i.dim==="x"||i.dim==="radius"?0:1,s=[],l=0,c=[],u=[],f=[],h=[];if(a){for(l=0;l<t.length;l+=2){var d=e||t;!isNaN(d[l])&&!isNaN(d[l+1])&&h.push(t[l],t[l+1])}t=h}for(l=0;l<t.length-2;l+=2)switch(f[0]=t[l+2],f[1]=t[l+3],u[0]=t[l],u[1]=t[l+1],s.push(u[0],u[1]),n){case"end":c[o]=f[o],c[1-o]=u[1-o],s.push(c[0],c[1]);break;case"middle":var p=(u[o]+f[o])/2,m=[];c[o]=m[o]=p,c[1-o]=u[1-o],m[1-o]=f[1-o],s.push(c[0],c[1]),s.push(m[0],m[1]);break;default:c[o]=u[o],c[1-o]=f[1-o],s.push(c[0],c[1])}return s.push(t[l++],t[l++]),s}function CM(t,e){var r=[],n=t.length,a,i;function o(u,f,h){var d=u.coord,p=(h-d)/(f.coord-d),m=AS(p,[u.color,f.color]);return{coord:h,color:m}}for(var s=0;s<n;s++){var l=t[s],c=l.coord;if(c<0)a=l;else if(c>e){i?r.push(o(i,l,e)):a&&r.push(o(a,l,0),o(a,l,e));break}else a&&(r.push(o(a,l,0)),a=null),r.push(l),i=l}return r}function MM(t,e,r){var n=t.getVisual("visualMeta");if(!(!n||!n.length||!t.count())&&e.type==="cartesian2d"){for(var a,i,o=n.length-1;o>=0;o--){var s=t.getDimensionInfo(n[o].dimension);if(a=s&&s.coordDim,a==="x"||a==="y"){i=n[o];break}}if(i){var l=e.getAxis(a),c=he(i.stops,function(b){return{coord:l.toGlobalCoord(l.dataToCoord(b.value)),color:b.color}}),u=c.length,f=i.outerColors.slice();u&&c[0].coord>c[u-1].coord&&(c.reverse(),f.reverse());var h=CM(c,a==="x"?r.getWidth():r.getHeight()),d=h.length;if(!d&&u)return c[0].coord<0?f[1]?f[1]:c[u-1].color:f[0]?f[0]:c[0].color;var p=10,m=h[0].coord-p,g=h[d-1].coord+p,v=g-m;if(v<.001)return"transparent";I(h,function(b){b.offset=(b.coord-m)/v}),h.push({offset:d?h[d-1].offset:.5,color:f[1]||"transparent"}),h.unshift({offset:d?h[0].offset:.5,color:f[0]||"transparent"});var y=new hm(0,0,0,0,h,!0);return y[a]=m,y[a+"2"]=g,y}}}function AM(t,e,r){var n=t.get("showAllSymbol"),a=n==="auto";if(!(n&&!a)){var i=r.getAxesByScale("ordinal")[0];if(i&&!(a&&DM(i,e))){var o=e.mapDimension(i.dim),s={};return I(i.getViewLabels(),function(l){var c=i.scale.getRawOrdinalNumber(l.tickValue);s[c]=1}),function(l){return!s.hasOwnProperty(e.get(o,l))}}}}function DM(t,e){var r=t.getExtent(),n=Math.abs(r[1]-r[0])/t.scale.count();isNaN(n)&&(n=0);for(var a=e.count(),i=Math.max(1,Math.round(a/5)),o=0;o<a;o+=i)if(Fd.getSymbolSize(e,o)[t.isHorizontal()?1:0]*1.5>n)return!1;return!0}function IM(t,e){return isNaN(t)||isNaN(e)}function LM(t){for(var e=t.length/2;e>0&&IM(t[e*2-2],t[e*2-1]);e--);return e-1}function o0(t,e){return[t[e*2],t[e*2+1]]}function PM(t,e,r){for(var n=t.length/2,a=r==="x"?0:1,i,o,s=0,l=-1,c=0;c<n;c++)if(o=t[c*2+a],!(isNaN(o)||isNaN(t[c*2+1-a]))){if(c===0){i=o;continue}if(i<=e&&o>=e||i>=e&&o<=e){l=c;break}s=c,i=o}return{range:[s,l],t:(e-i)/(o-i)}}function s0(t){if(t.get(["endLabel","show"]))return!0;for(var e=0;e<Kr.length;e++)if(t.get([Kr[e],"endLabel","show"]))return!0;return!1}function $d(t,e,r,n){if(Gd(e,"cartesian2d")){var a=n.getModel("endLabel"),i=a.get("valueAnimation"),o=n.getData(),s={lastFrameIndex:0},l=s0(n)?function(d,p){t._endLabelOnDuring(d,p,o,s,i,a,e)}:null,c=e.getBaseAxis().isHorizontal(),u=e0(e,r,n,function(){var d=t._endLabel;d&&r&&s.originalX!=null&&d.attr({x:s.originalX,y:s.originalY})},l);if(!n.get("clip",!0)){var f=u.shape,h=Math.max(f.width,f.height);c?(f.y-=h,f.height+=h*2):(f.x-=h,f.width+=h*2)}return l&&l(1,u),u}else return t0(e,r,n)}function RM(t,e){var r=e.getBaseAxis(),n=r.isHorizontal(),a=r.inverse,i=n?a?"right":"left":"center",o=n?"middle":a?"top":"bottom";return{normal:{align:t.get("align")||i,verticalAlign:t.get("verticalAlign")||o}}}var EM=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.init=function(){var r=new St,n=new dM;this.group.add(n.group),this._symbolDraw=n,this._lineGroup=r,this._changePolyState=Ne(this._changePolyState,this)},e.prototype.render=function(r,n,a){var i=r.coordinateSystem,o=this.group,s=r.getData(),l=r.getModel("lineStyle"),c=r.getModel("areaStyle"),u=s.getLayout("points")||[],f=i.type==="polar",h=this._coordSys,d=this._symbolDraw,p=this._polyline,m=this._polygon,g=this._lineGroup,v=!n.ssr&&r.get("animation"),y=!c.isEmpty(),b=c.get("origin"),x=Yy(i,s,b),w=y&&TM(i,s,x),S=r.get("showSymbol"),k=r.get("connectNulls"),C=S&&!f&&AM(r,s,i),A=this._data;A&&A.eachItemGraphicEl(function(xe,Ce){xe.__temp&&(o.remove(xe),A.setItemGraphicEl(Ce,null))}),S||d.remove(),o.add(g);var M=f?!1:r.get("step"),T;i&&i.getArea&&r.get("clip",!0)&&(T=i.getArea(),T.width!=null?(T.x-=.1,T.y-=.1,T.width+=.2,T.height+=.2):T.r0&&(T.r0-=.5,T.r+=.5)),this._clipShapeForSymbol=T;var D=MM(s,i,a)||s.getVisual("style")[s.getVisual("drawType")];if(!(p&&h.type===i.type&&M===this._step))S&&d.updateData(s,{isIgnore:C,clipShape:T,disableAnimation:!0,getSymbolPoint:function(xe){return[u[xe*2],u[xe*2+1]]}}),v&&this._initSymbolLabelAnimation(s,i,T),M&&(w&&(w=Yn(w,u,i,M,k)),u=Yn(u,null,i,M,k)),p=this._newPolyline(u),y?m=this._newPolygon(u,w):m&&(g.remove(m),m=this._polygon=null),f||this._initOrUpdateEndLabel(r,i,Oa(D)),g.setClipPath($d(this,i,!0,r));else{y&&!m?m=this._newPolygon(u,w):m&&!y&&(g.remove(m),m=this._polygon=null),f||this._initOrUpdateEndLabel(r,i,Oa(D));var L=g.getClipPath();if(L){var R=$d(this,i,!1,r);_n(L,{shape:R.shape},r)}else g.setClipPath($d(this,i,!0,r));S&&d.updateData(s,{isIgnore:C,clipShape:T,disableAnimation:!0,getSymbolPoint:function(xe){return[u[xe*2],u[xe*2+1]]}}),(!r0(this._stackedOnPoints,w)||!r0(this._points,u))&&(v?this._doUpdateAnimation(s,w,i,a,M,b,k):(M&&(w&&(w=Yn(w,u,i,M,k)),u=Yn(u,null,i,M,k)),p.setShape({points:u}),m&&m.setShape({points:u,stackedOnPoints:w})))}var O=r.getModel("emphasis"),B=O.get("focus"),j=O.get("blurScope"),P=O.get("disabled");if(p.useStyle(He(l.getLineStyle(),{fill:"none",stroke:D,lineJoin:"bevel"})),Hf(p,r,"lineStyle"),p.style.lineWidth>0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var V=p.getState("emphasis").style;V.lineWidth=+p.style.lineWidth+1}We(p).seriesIndex=r.seriesIndex,Rl(p,B,j,P);var H=i0(r.get("smooth")),Z=r.get("smoothMonotone");if(p.setShape({smooth:H,smoothMonotone:Z,connectNulls:k}),m){var re=s.getCalculationInfo("stackedOnSeries"),Te=0;m.useStyle(He(c.getAreaStyle(),{fill:D,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),re&&(Te=i0(re.get("smooth"))),m.setShape({smooth:H,stackedOnSmooth:Te,smoothMonotone:Z,connectNulls:k}),Hf(m,r,"areaStyle"),We(m).seriesIndex=r.seriesIndex,Rl(m,B,j,P)}var ge=this._changePolyState;s.eachItemGraphicEl(function(xe){xe&&(xe.onHoverStateChange=ge)}),this._polyline.onHoverStateChange=ge,this._data=s,this._coordSys=i,this._stackedOnPoints=w,this._points=u,this._step=M,this._valueOrigin=b,r.get("triggerLineEvent")&&(this.packEventData(r,p),m&&this.packEventData(r,m))},e.prototype.packEventData=function(r,n){We(n).eventData={componentType:"series",componentSubType:"line",componentIndex:r.componentIndex,seriesIndex:r.seriesIndex,seriesName:r.name,seriesType:"line"}},e.prototype.highlight=function(r,n,a,i){var o=r.getData(),s=Ma(o,i);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),c=o.getItemGraphicEl(s);if(!c){var u=l[s*2],f=l[s*2+1];if(isNaN(u)||isNaN(f)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(u,f))return;var h=r.get("zlevel")||0,d=r.get("z")||0;c=new Fd(o,s),c.x=u,c.y=f,c.setZ(h,d);var p=c.getSymbolPath().getTextContent();p&&(p.zlevel=h,p.z=d,p.z2=this._polyline.z2+1),c.__temp=!0,o.setItemGraphicEl(s,c),c.stopSymbolAnimation(!0),this.group.add(c)}c.highlight()}else Rr.prototype.highlight.call(this,r,n,a,i)},e.prototype.downplay=function(r,n,a,i){var o=r.getData(),s=Ma(o,i);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else Rr.prototype.downplay.call(this,r,n,a,i)},e.prototype._changePolyState=function(r){var n=this._polygon;Gg(this._polyline,r),n&&Gg(n,r)},e.prototype._newPolyline=function(r){var n=this._polyline;return n&&this._lineGroup.remove(n),n=new mM({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(n),this._polyline=n,n},e.prototype._newPolygon=function(r,n){var a=this._polygon;return a&&this._lineGroup.remove(a),a=new _M({shape:{points:r,stackedOnPoints:n},segmentIgnoreThreshold:2}),this._lineGroup.add(a),this._polygon=a,a},e.prototype._initSymbolLabelAnimation=function(r,n,a){var i,o,s=n.getBaseAxis(),l=s.inverse;n.type==="cartesian2d"?(i=s.isHorizontal(),o=!1):n.type==="polar"&&(i=s.dim==="angle",o=!0);var c=r.hostModel,u=c.get("animationDuration");ke(u)&&(u=u(null));var f=c.get("animationDelay")||0,h=ke(f)?f(null):f;r.eachItemGraphicEl(function(d,p){var m=d;if(m){var g=[d.x,d.y],v=void 0,y=void 0,b=void 0;if(a)if(o){var x=a,w=n.pointToCoord(g);i?(v=x.startAngle,y=x.endAngle,b=-w[1]/180*Math.PI):(v=x.r0,y=x.r,b=w[0])}else{var S=a;i?(v=S.x,y=S.x+S.width,b=d.x):(v=S.y+S.height,y=S.y,b=d.y)}var k=y===v?0:(b-v)/(y-v);l&&(k=1-k);var C=ke(f)?f(p):u*k+h,A=m.getSymbolPath(),M=A.getTextContent();m.attr({scaleX:0,scaleY:0}),m.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:C}),M&&M.animateFrom({style:{opacity:0}},{duration:300,delay:C}),A.disableLabelAnimation=!0}})},e.prototype._initOrUpdateEndLabel=function(r,n,a){var i=r.getModel("endLabel");if(s0(r)){var o=r.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var c=this._endLabel;c||(c=this._endLabel=new $t({z2:200}),c.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var u=LM(l);u>=0&&(Xl(s,Zl(r,"endLabel"),{inheritColor:a,labelFetcher:r,labelDataIndex:u,defaultText:function(f,h,d){return d!=null?$y(o,d):zd(o,f)},enableTextSetter:!0},RM(i,n)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},e.prototype._endLabelOnDuring=function(r,n,a,i,o,s,l){var c=this._endLabel,u=this._polyline;if(c){r<1&&i.originalX==null&&(i.originalX=c.x,i.originalY=c.y);var f=a.getLayout("points"),h=a.hostModel,d=h.get("connectNulls"),p=s.get("precision"),m=s.get("distance")||0,g=l.getBaseAxis(),v=g.isHorizontal(),y=g.inverse,b=n.shape,x=y?v?b.x:b.y+b.height:v?b.x+b.width:b.y,w=(v?m:0)*(y?-1:1),S=(v?0:-m)*(y?-1:1),k=v?"x":"y",C=PM(f,x,k),A=C.range,M=A[1]-A[0],T=void 0;if(M>=1){if(M>1&&!d){var D=o0(f,A[0]);c.attr({x:D[0]+w,y:D[1]+S}),o&&(T=h.getRawValue(A[0]))}else{var D=u.getPointOn(x,k);D&&c.attr({x:D[0]+w,y:D[1]+S});var L=h.getRawValue(A[0]),R=h.getRawValue(A[1]);o&&(T=Uk(a,p,L,R,C.t))}i.lastFrameIndex=A[0]}else{var O=r===1||i.lastFrameIndex>0?A[0]:0,D=o0(f,O);o&&(T=h.getRawValue(O)),c.attr({x:D[0]+w,y:D[1]+S})}if(o){var B=Kl(c);typeof B.setLabelText=="function"&&B.setLabelText(T)}}},e.prototype._doUpdateAnimation=function(r,n,a,i,o,s,l){var c=this._polyline,u=this._polygon,f=r.hostModel,h=gM(this._data,r,this._stackedOnPoints,n,this._coordSys,a,this._valueOrigin),d=h.current,p=h.stackedOnCurrent,m=h.next,g=h.stackedOnNext;if(o&&(p=Yn(h.stackedOnCurrent,h.current,a,o,l),d=Yn(h.current,null,a,o,l),g=Yn(h.stackedOnNext,h.next,a,o,l),m=Yn(h.next,null,a,o,l)),a0(d,m)>3e3||u&&a0(p,g)>3e3){c.stopAnimation(),c.setShape({points:m}),u&&(u.stopAnimation(),u.setShape({points:m,stackedOnPoints:g}));return}c.shape.__points=h.current,c.shape.points=d;var v={shape:{points:m}};h.current!==d&&(v.shape.__points=h.next),c.stopAnimation(),or(c,v,f),u&&(u.setShape({points:d,stackedOnPoints:p}),u.stopAnimation(),or(u,{shape:{stackedOnPoints:g}},f),c.shape.points!==u.shape.points&&(u.shape.points=c.shape.points));for(var y=[],b=h.status,x=0;x<b.length;x++){var w=b[x].cmd;if(w==="="){var S=r.getItemGraphicEl(b[x].idx1);S&&y.push({el:S,ptIdx:x})}}c.animators&&c.animators.length&&c.animators[0].during(function(){u&&u.dirtyShape();for(var k=c.shape.__points,C=0;C<y.length;C++){var A=y[C].el,M=y[C].ptIdx*2;A.x=k[M],A.y=k[M+1],A.markRedraw()}})},e.prototype.remove=function(r){var n=this.group,a=this._data;this._lineGroup.removeAll(),this._symbolDraw.remove(!0),a&&a.eachItemGraphicEl(function(i,o){i.__temp&&(n.remove(i),a.setItemGraphicEl(o,null))}),this._polyline=this._polygon=this._coordSys=this._points=this._stackedOnPoints=this._endLabel=this._data=null},e.type="line",e})(Rr);function OM(t,e){return{seriesType:t,plan:Ud(),reset:function(r){var n=r.getData(),a=r.coordinateSystem;if(r.pipelineContext,!!a){var i=he(a.dimensions,function(f){return n.mapDimension(f)}).slice(0,2),o=i.length,s=n.getCalculationInfo("stackResultDimension");Ai(n,i[0])&&(i[0]=s),Ai(n,i[1])&&(i[1]=s);var l=n.getStore(),c=n.getDimensionIndex(i[0]),u=n.getDimensionIndex(i[1]);return o&&{progress:function(f,h){for(var d=f.end-f.start,p=wn(d*o),m=[],g=[],v=f.start,y=0;v<f.end;v++){var b=void 0;if(o===1){var x=l.get(c,v);b=a.dataToPoint(x,null,g)}else m[0]=l.get(c,v),m[1]=l.get(u,v),b=a.dataToPoint(m,null,g);p[y++]=b[0],p[y++]=b[1]}h.setLayout("points",p)}}}}}}var NM={average:function(t){for(var e=0,r=0,n=0;n<t.length;n++)isNaN(t[n])||(e+=t[n],r++);return r===0?NaN:e/r},sum:function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r]||0;return e},max:function(t){for(var e=-1/0,r=0;r<t.length;r++)t[r]>e&&(e=t[r]);return isFinite(e)?e:NaN},min:function(t){for(var e=1/0,r=0;r<t.length;r++)t[r]<e&&(e=t[r]);return isFinite(e)?e:NaN},nearest:function(t){return t[0]}},BM=function(t){return Math.round(t.length/2)};function l0(t){return{seriesType:t,reset:function(e,r,n){var a=e.getData(),i=e.get("sampling"),o=e.coordinateSystem,s=a.count();if(s>10&&o.type==="cartesian2d"&&i){var l=o.getBaseAxis(),c=o.getOtherAxis(l),u=l.getExtent(),f=n.getDevicePixelRatio(),h=Math.abs(u[1]-u[0])*(f||1),d=Math.round(s/h);if(isFinite(d)&&d>1){i==="lttb"?e.setData(a.lttbDownSample(a.mapDimension(c.dim),1/d)):i==="minmax"&&e.setData(a.minmaxDownSample(a.mapDimension(c.dim),1/d));var p=void 0;ae(i)?p=NM[i]:ke(i)&&(p=i),p&&e.setData(a.downSample(a.mapDimension(c.dim),1/d,p,BM))}}}}}function zM(t){t.registerChartView(EM),t.registerSeriesModel(uM),t.registerLayout(OM("line")),t.registerVisual({seriesType:"line",reset:function(e){var r=e.getData(),n=e.getModel("lineStyle").getLineStyle();n&&!n.stroke&&(n.stroke=r.getVisual("style").fill),r.setVisual("legendLineStyle",n)}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,l0("line"))}var FM="__ec_stack_";function c0(t){return t.get("stack")||FM+t.seriesIndex}function Wd(t){return t.dim+t.index}function u0(t,e){var r=[];return e.eachSeriesByType(t,function(n){d0(n)&&r.push(n)}),r}function HM(t){var e={};I(t,function(l){var c=l.coordinateSystem,u=c.getBaseAxis();if(!(u.type!=="time"&&u.type!=="value"))for(var f=l.getData(),h=u.dim+"_"+u.index,d=f.getDimensionIndex(f.mapDimension(u.dim)),p=f.getStore(),m=0,g=p.count();m<g;++m){var v=p.get(d,m);e[h]?e[h].push(v):e[h]=[v]}});var r={};for(var n in e)if(e.hasOwnProperty(n)){var a=e[n];if(a){a.sort(function(l,c){return l-c});for(var i=null,o=1;o<a.length;++o){var s=a[o]-a[o-1];s>0&&(i=i===null?s:Math.min(i,s))}r[n]=i}}return r}function f0(t){var e=HM(t),r=[];return I(t,function(n){var a=n.coordinateSystem,i=a.getBaseAxis(),o=i.getExtent(),s;if(i.type==="category")s=i.getBandWidth();else if(i.type==="value"||i.type==="time"){var l=i.dim+"_"+i.index,c=e[l],u=Math.abs(o[1]-o[0]),f=i.scale.getExtent(),h=Math.abs(f[1]-f[0]);s=c?u/h*c:u}else{var d=n.getData();s=Math.abs(o[1]-o[0])/d.count()}var p=Nt(n.get("barWidth"),s),m=Nt(n.get("barMaxWidth"),s),g=Nt(n.get("barMinWidth")||(h0(n)?.5:1),s),v=n.get("barGap"),y=n.get("barCategoryGap");r.push({bandWidth:s,barWidth:p,barMaxWidth:m,barMinWidth:g,barGap:v,barCategoryGap:y,axisKey:Wd(i),stackId:c0(n)})}),VM(r)}function VM(t){var e={};I(t,function(n,a){var i=n.axisKey,o=n.bandWidth,s=e[i]||{bandWidth:o,remainedWidth:o,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},l=s.stacks;e[i]=s;var c=n.stackId;l[c]||s.autoWidthCount++,l[c]=l[c]||{width:0,maxWidth:0};var u=n.barWidth;u&&!l[c].width&&(l[c].width=u,u=Math.min(s.remainedWidth,u),s.remainedWidth-=u);var f=n.barMaxWidth;f&&(l[c].maxWidth=f);var h=n.barMinWidth;h&&(l[c].minWidth=h);var d=n.barGap;d!=null&&(s.gap=d);var p=n.barCategoryGap;p!=null&&(s.categoryGap=p)});var r={};return I(e,function(n,a){r[a]={};var i=n.stacks,o=n.bandWidth,s=n.categoryGap;if(s==null){var l=at(i).length;s=Math.max(35-l*4,15)+"%"}var c=Nt(s,o),u=Nt(n.gap,1),f=n.remainedWidth,h=n.autoWidthCount,d=(f-c)/(h+(h-1)*u);d=Math.max(d,0),I(i,function(v){var y=v.maxWidth,b=v.minWidth;if(v.width){var x=v.width;y&&(x=Math.min(x,y)),b&&(x=Math.max(x,b)),v.width=x,f-=x+u*x,h--}else{var x=d;y&&y<x&&(x=Math.min(y,f)),b&&b>x&&(x=b),x!==d&&(v.width=x,f-=x+u*x,h--)}}),d=(f-c)/(h+(h-1)*u),d=Math.max(d,0);var p=0,m;I(i,function(v,y){v.width||(v.width=d),m=v,p+=v.width*(1+u)}),m&&(p-=m.width*u);var g=-p/2;I(i,function(v,y){r[a][y]=r[a][y]||{bandWidth:o,offset:g,width:v.width},g+=v.width*(1+u)})}),r}function UM(t,e,r){if(t&&e){var n=t[Wd(e)];return n}}function GM(t,e){var r=u0(t,e),n=f0(r);I(r,function(a){var i=a.getData(),o=a.coordinateSystem,s=o.getBaseAxis(),l=c0(a),c=n[Wd(s)][l],u=c.offset,f=c.width;i.setLayout({bandWidth:c.bandWidth,offset:u,size:f})})}function $M(t){return{seriesType:t,plan:Ud(),reset:function(e){if(d0(e)){var r=e.getData(),n=e.coordinateSystem,a=n.getBaseAxis(),i=n.getOtherAxis(a),o=r.getDimensionIndex(r.mapDimension(i.dim)),s=r.getDimensionIndex(r.mapDimension(a.dim)),l=e.get("showBackground",!0),c=r.mapDimension(i.dim),u=r.getCalculationInfo("stackResultDimension"),f=Ai(r,c)&&!!r.getCalculationInfo("stackedOnSeries"),h=i.isHorizontal(),d=WM(a,i),p=h0(e),m=e.get("barMinHeight")||0,g=u&&r.getDimensionIndex(u),v=r.getLayout("size"),y=r.getLayout("offset");return{progress:function(b,x){for(var w=b.count,S=p&&wn(w*3),k=p&&l&&wn(w*3),C=p&&wn(w),A=n.master.getRect(),M=h?A.width:A.height,T,D=x.getStore(),L=0;(T=b.next())!=null;){var R=D.get(f?g:o,T),O=D.get(s,T),B=d,j=void 0;f&&(j=+R-D.get(o,T));var P=void 0,V=void 0,H=void 0,Z=void 0;if(h){var re=n.dataToPoint([R,O]);if(f){var Te=n.dataToPoint([j,O]);B=Te[0]}P=B,V=re[1]+y,H=re[0]-B,Z=v,Math.abs(H)<m&&(H=(H<0?-1:1)*m)}else{var re=n.dataToPoint([O,R]);if(f){var Te=n.dataToPoint([O,j]);B=Te[1]}P=re[0]+y,V=B,H=v,Z=re[1]-B,Math.abs(Z)<m&&(Z=(Z<=0?-1:1)*m)}p?(S[L]=P,S[L+1]=V,S[L+2]=h?H:Z,k&&(k[L]=h?A.x:P,k[L+1]=h?V:A.y,k[L+2]=M),C[T]=T):x.setItemLayout(T,{x:P,y:V,width:H,height:Z}),L+=3}p&&x.setLayout({largePoints:S,largeDataIndices:C,largeBackgroundPoints:k,valueAxisHorizontal:h})}}}}}}function d0(t){return t.coordinateSystem&&t.coordinateSystem.type==="cartesian2d"}function h0(t){return t.pipelineContext&&t.pipelineContext.large}function WM(t,e){var r=e.model.get("startValue");return r||(r=0),e.toGlobalCoord(e.dataToCoord(e.type==="log"?r>0?r:1:r))}var qd=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.getInitialData=function(r,n){return md(null,this,{useEncodeDefaulter:!0})},e.prototype.getMarkerPosition=function(r,n,a){var i=this.coordinateSystem;if(i&&i.clampData){var o=i.clampData(r),s=i.dataToPoint(o);if(a)I(i.getAxes(),function(h,d){if(h.type==="category"&&n!=null){var p=h.getTicksCoords(),m=h.getTickModel().get("alignWithLabel"),g=o[d],v=n[d]==="x1"||n[d]==="y1";if(v&&!m&&(g+=1),p.length<2)return;if(p.length===2){s[d]=h.toGlobalCoord(h.getExtent()[v?1:0]);return}for(var y=void 0,b=void 0,x=1,w=0;w<p.length;w++){var S=p[w].coord,k=w===p.length-1?p[w-1].tickValue+x:p[w].tickValue;if(k===g){b=S;break}else if(k<g)y=S;else if(y!=null&&k>g){b=(S+y)/2;break}w===1&&(x=k-p[0].tickValue)}b==null&&(y?y&&(b=p[p.length-1].coord):b=p[0].coord),s[d]=h.toGlobalCoord(b)}});else{var l=this.getData(),c=l.getLayout("offset"),u=l.getLayout("size"),f=i.getBaseAxis().isHorizontal()?0:1;s[f]+=c+u/2}return s}return[NaN,NaN]},e.type="series.__base_bar__",e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod"},e})(Qr);Qr.registerClass(qd);var qM=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.getInitialData=function(){return md(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},e.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},e.prototype.getProgressiveThreshold=function(){var r=this.get("progressiveThreshold"),n=this.get("largeThreshold");return n>r&&(r=n),r},e.prototype.brushSelector=function(r,n,a){return a.rect(n.getItemLayout(r))},e.type="series.bar",e.dependencies=["grid","polar"],e.defaultOption=yd(qd.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:"#212121"}},realtimeSort:!1}),e})(qd),yc="\0__throttleOriginMethod",p0="\0__throttleRate",v0="\0__throttleType";function Yd(t,e,r){var n,a=0,i=0,o=null,s,l,c,u;e=e||0;function f(){i=new Date().getTime(),o=null,t.apply(l,c||[])}var h=function(){for(var d=[],p=0;p<arguments.length;p++)d[p]=arguments[p];n=new Date().getTime(),l=this,c=d;var m=u||e,g=u||r;u=null,s=n-(g?a:i)-m,clearTimeout(o),g?o=setTimeout(f,m):s>=0?f():o=setTimeout(f,-s),a=n};return h.clear=function(){o&&(clearTimeout(o),o=null)},h.debounceNextCall=function(d){u=d},h}function Xd(t,e,r,n){var a=t[e];if(a){var i=a[yc]||a,o=a[v0],s=a[p0];if(s!==r||o!==n){if(r==null||!n)return t[e]=i;a=t[e]=Yd(i,r,n==="debounce"),a[yc]=i,a[v0]=n,a[p0]=r}return a}}function Zd(t,e){var r=t[e];r&&r[yc]&&(r.clear&&r.clear(),t[e]=r[yc])}var YM=(function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return t})(),g0=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="sausage",n}return e.prototype.getDefaultShape=function(){return new YM},e.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.max(n.r0||0,0),s=Math.max(n.r,0),l=(s-o)*.5,c=o+l,u=n.startAngle,f=n.endAngle,h=n.clockwise,d=Math.PI*2,p=h?f-u<d:u-f<d;p||(u=f-(h?d:-d));var m=Math.cos(u),g=Math.sin(u),v=Math.cos(f),y=Math.sin(f);p?(r.moveTo(m*o+a,g*o+i),r.arc(m*c+a,g*c+i,l,-Math.PI+u,u,!h)):r.moveTo(m*s+a,g*s+i),r.arc(a,i,s,u,f,!h),r.arc(v*c+a,y*c+i,l,f-Math.PI*2,f-Math.PI,!h),o!==0&&r.arc(a,i,o,f,u,h)},e})(qe);function XM(t,e){e=e||{};var r=e.isRoundCap;return function(n,a,i){var o=a.position;if(!o||o instanceof Array)return Qs(n,a,i);var s=t(o),l=a.distance!=null?a.distance:5,c=this.shape,u=c.cx,f=c.cy,h=c.r,d=c.r0,p=(h+d)/2,m=c.startAngle,g=c.endAngle,v=(m+g)/2,y=r?Math.abs(h-d)/2:0,b=Math.cos,x=Math.sin,w=u+h*b(m),S=f+h*x(m),k="left",C="top";switch(s){case"startArc":w=u+(d-l)*b(v),S=f+(d-l)*x(v),k="center",C="top";break;case"insideStartArc":w=u+(d+l)*b(v),S=f+(d+l)*x(v),k="center",C="bottom";break;case"startAngle":w=u+p*b(m)+_c(m,l+y,!1),S=f+p*x(m)+bc(m,l+y,!1),k="right",C="middle";break;case"insideStartAngle":w=u+p*b(m)+_c(m,-l+y,!1),S=f+p*x(m)+bc(m,-l+y,!1),k="left",C="middle";break;case"middle":w=u+p*b(v),S=f+p*x(v),k="center",C="middle";break;case"endArc":w=u+(h+l)*b(v),S=f+(h+l)*x(v),k="center",C="bottom";break;case"insideEndArc":w=u+(h-l)*b(v),S=f+(h-l)*x(v),k="center",C="top";break;case"endAngle":w=u+p*b(g)+_c(g,l+y,!0),S=f+p*x(g)+bc(g,l+y,!0),k="left",C="middle";break;case"insideEndAngle":w=u+p*b(g)+_c(g,-l+y,!0),S=f+p*x(g)+bc(g,-l+y,!0),k="right",C="middle";break;default:return Qs(n,a,i)}return n=n||{},n.x=w,n.y=S,n.align=k,n.verticalAlign=C,n}}function ZM(t,e,r,n){if(et(n)){t.setTextConfig({rotation:n});return}else if(ee(e)){t.setTextConfig({rotation:0});return}var a=t.shape,i=a.clockwise?a.startAngle:a.endAngle,o=a.clockwise?a.endAngle:a.startAngle,s=(i+o)/2,l,c=r(e);switch(c){case"startArc":case"insideStartArc":case"middle":case"insideEndArc":case"endArc":l=s;break;case"startAngle":case"insideStartAngle":l=i;break;case"endAngle":case"insideEndAngle":l=o;break;default:t.setTextConfig({rotation:0});return}var u=Math.PI*1.5-l;c==="middle"&&u>Math.PI/2&&u<Math.PI*1.5&&(u-=Math.PI),t.setTextConfig({rotation:u})}function _c(t,e,r){return e*Math.sin(t)*(r?-1:1)}function bc(t,e,r){return e*Math.cos(t)*(r?1:-1)}function KM(t,e,r){var n=t.get("borderRadius");if(n==null)return{cornerRadius:0};ee(n)||(n=[n,n,n,n]);var a=Math.abs(e.r||0-e.r0||0);return{cornerRadius:he(n,function(i){return Pn(i,a)})}}var Kd=Math.max,jd=Math.min;function jM(t,e){var r=t.getArea&&t.getArea();if(Gd(t,"cartesian2d")){var n=t.getBaseAxis();if(n.type!=="category"||!n.onBand){var a=e.getLayout("bandWidth");n.isHorizontal()?(r.x-=a,r.width+=a*2):(r.y-=a,r.height+=a*2)}}return r}var JM=(function(t){K(e,t);function e(){var r=t.call(this)||this;return r.type=e.type,r._isFirstFrame=!0,r}return e.prototype.render=function(r,n,a,i){this._model=r,this._removeOnRenderedListener(a),this._updateDrawMode(r);var o=r.get("coordinateSystem");(o==="cartesian2d"||o==="polar")&&(this._progressiveEls=null,this._isLargeDraw?this._renderLarge(r,n,a):this._renderNormal(r,n,a,i))},e.prototype.incrementalPrepareRender=function(r){this._clear(),this._updateDrawMode(r),this._updateLargeClip(r)},e.prototype.incrementalRender=function(r,n){this._progressiveEls=[],this._incrementalRenderLarge(r,n)},e.prototype.eachRendered=function(r){ql(this._progressiveEls||this.group,r)},e.prototype._updateDrawMode=function(r){var n=r.pipelineContext.large;(this._isLargeDraw==null||n!==this._isLargeDraw)&&(this._isLargeDraw=n,this._clear())},e.prototype._renderNormal=function(r,n,a,i){var o=this.group,s=r.getData(),l=this._data,c=r.coordinateSystem,u=c.getBaseAxis(),f;c.type==="cartesian2d"?f=u.isHorizontal():c.type==="polar"&&(f=u.dim==="angle");var h=r.isAnimationEnabled()?r:null,d=QM(r,c);d&&this._enableRealtimeSort(d,s,a);var p=r.get("clip",!0)||d,m=jM(c,s);o.removeClipPath();var g=r.get("roundCap",!0),v=r.get("showBackground",!0),y=r.getModel("backgroundStyle"),b=y.get("borderRadius")||0,x=[],w=this._backgroundEls,S=i&&i.isInitSort,k=i&&i.type==="changeAxisOrder";function C(T){var D=xc[c.type](s,T),L=oA(c,f,D);return L.useStyle(y.getItemStyle()),c.type==="cartesian2d"?L.setShape("r",b):L.setShape("cornerRadius",b),x[T]=L,L}s.diff(l).add(function(T){var D=s.getItemModel(T),L=xc[c.type](s,T,D);if(v&&C(T),!(!s.hasValue(T)||!x0[c.type](L))){var R=!1;p&&(R=m0[c.type](m,L));var O=y0[c.type](r,s,T,L,f,h,u.model,!1,g);d&&(O.forceLabelAnimation=!0),S0(O,s,T,D,L,r,f,c.type==="polar"),S?O.attr({shape:L}):d?_0(d,h,O,L,T,f,!1,!1):_n(O,{shape:L},r,T),s.setItemGraphicEl(T,O),o.add(O),O.ignore=R}}).update(function(T,D){var L=s.getItemModel(T),R=xc[c.type](s,T,L);if(v){var O=void 0;w.length===0?O=C(D):(O=w[D],O.useStyle(y.getItemStyle()),c.type==="cartesian2d"?O.setShape("r",b):O.setShape("cornerRadius",b),x[T]=O);var B=xc[c.type](s,T),j=M0(f,B,c);or(O,{shape:j},h,T)}var P=l.getItemGraphicEl(D);if(!s.hasValue(T)||!x0[c.type](R)){o.remove(P);return}var V=!1;if(p&&(V=m0[c.type](m,R),V&&o.remove(P)),P?vm(P):P=y0[c.type](r,s,T,R,f,h,u.model,!!P,g),d&&(P.forceLabelAnimation=!0),k){var H=P.getTextContent();if(H){var Z=Kl(H);Z.prevValue!=null&&(Z.prevValue=Z.value)}}else S0(P,s,T,L,R,r,f,c.type==="polar");S?P.attr({shape:R}):d?_0(d,h,P,R,T,f,!0,k):or(P,{shape:R},r,T,null),s.setItemGraphicEl(T,P),P.ignore=V,o.add(P)}).remove(function(T){var D=l.getItemGraphicEl(T);D&&Jf(D,r,T)}).execute();var A=this._backgroundGroup||(this._backgroundGroup=new St);A.removeAll();for(var M=0;M<x.length;++M)A.add(x[M]);o.add(A),this._backgroundEls=x,this._data=s},e.prototype._renderLarge=function(r,n,a){this._clear(),T0(r,this.group),this._updateLargeClip(r)},e.prototype._incrementalRenderLarge=function(r,n){this._removeBackground(),T0(n,this.group,this._progressiveEls,!0)},e.prototype._updateLargeClip=function(r){var n=r.get("clip",!0)&&kM(r.coordinateSystem,!1,r),a=this.group;n?a.setClipPath(n):a.removeClipPath()},e.prototype._enableRealtimeSort=function(r,n,a){var i=this;if(n.count()){var o=r.baseAxis;if(this._isFirstFrame)this._dispatchInitSort(n,r,a),this._isFirstFrame=!1;else{var s=function(l){var c=n.getItemGraphicEl(l),u=c&&c.shape;return u&&Math.abs(o.isHorizontal()?u.height:u.width)||0};this._onRendered=function(){i._updateSortWithinSameData(n,s,o,a)},a.getZr().on("rendered",this._onRendered)}}},e.prototype._dataSort=function(r,n,a){var i=[];return r.each(r.mapDimension(n.dim),function(o,s){var l=a(s);l=l??NaN,i.push({dataIndex:s,mappedValue:l,ordinalNumber:o})}),i.sort(function(o,s){return s.mappedValue-o.mappedValue}),{ordinalNumbers:he(i,function(o){return o.ordinalNumber})}},e.prototype._isOrderChangedWithinSameData=function(r,n,a){for(var i=a.scale,o=r.mapDimension(a.dim),s=Number.MAX_VALUE,l=0,c=i.getOrdinalMeta().categories.length;l<c;++l){var u=r.rawIndexOf(o,i.getRawOrdinalNumber(l)),f=u<0?Number.MIN_VALUE:n(r.indexOfRawIndex(u));if(f>s)return!0;s=f}return!1},e.prototype._isOrderDifferentInView=function(r,n){for(var a=n.scale,i=a.getExtent(),o=Math.max(0,i[0]),s=Math.min(i[1],a.getOrdinalMeta().categories.length-1);o<=s;++o)if(r.ordinalNumbers[o]!==a.getRawOrdinalNumber(o))return!0},e.prototype._updateSortWithinSameData=function(r,n,a,i){if(this._isOrderChangedWithinSameData(r,n,a)){var o=this._dataSort(r,a,n);this._isOrderDifferentInView(o,a)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",axisId:a.index,sortInfo:o}))}},e.prototype._dispatchInitSort=function(r,n,a){var i=n.baseAxis,o=this._dataSort(r,i,function(s){return r.get(r.mapDimension(n.otherAxis.dim),s)});a.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:o})},e.prototype.remove=function(r,n){this._clear(this._model),this._removeOnRenderedListener(n)},e.prototype.dispose=function(r,n){this._removeOnRenderedListener(n)},e.prototype._removeOnRenderedListener=function(r){this._onRendered&&(r.getZr().off("rendered",this._onRendered),this._onRendered=null)},e.prototype._clear=function(r){var n=this.group,a=this._data;r&&r.isAnimationEnabled()&&a&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],a.eachItemGraphicEl(function(i){Jf(i,r,We(i).dataIndex)})):n.removeAll(),this._data=null,this._isFirstFrame=!0},e.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},e.type="bar",e})(Rr),m0={cartesian2d:function(t,e){var r=e.width<0?-1:1,n=e.height<0?-1:1;r<0&&(e.x+=e.width,e.width=-e.width),n<0&&(e.y+=e.height,e.height=-e.height);var a=t.x+t.width,i=t.y+t.height,o=Kd(e.x,t.x),s=jd(e.x+e.width,a),l=Kd(e.y,t.y),c=jd(e.y+e.height,i),u=s<o,f=c<l;return e.x=u&&o>a?s:o,e.y=f&&l>i?c:l,e.width=u?0:s-o,e.height=f?0:c-l,r<0&&(e.x+=e.width,e.width=-e.width),n<0&&(e.y+=e.height,e.height=-e.height),u||f},polar:function(t,e){var r=e.r0<=e.r?1:-1;if(r<0){var n=e.r;e.r=e.r0,e.r0=n}var a=jd(e.r,t.r),i=Kd(e.r0,t.r0);e.r=a,e.r0=i;var o=a-i<0;if(r<0){var n=e.r;e.r=e.r0,e.r0=n}return o}},y0={cartesian2d:function(t,e,r,n,a,i,o,s,l){var c=new _t({shape:q({},n),z2:1});if(c.__dataIndex=r,c.name="item",i){var u=c.shape,f=a?"height":"width";u[f]=0}return c},polar:function(t,e,r,n,a,i,o,s,l){var c=!a&&l?g0:xi,u=new c({shape:n,z2:1});u.name="item";var f=w0(a);if(u.calculateTextPosition=XM(f,{isRoundCap:c===g0}),i){var h=u.shape,d=a?"r":"endAngle",p={};h[d]=a?n.r0:n.startAngle,p[d]=n[d],(s?or:_n)(u,{shape:p},i)}return u}};function QM(t,e){var r=t.get("realtimeSort",!0),n=e.getBaseAxis();if(r&&n.type==="category"&&e.type==="cartesian2d")return{baseAxis:n,otherAxis:e.getOtherAxis(n)}}function _0(t,e,r,n,a,i,o,s){var l,c;i?(c={x:n.x,width:n.width},l={y:n.y,height:n.height}):(c={y:n.y,height:n.height},l={x:n.x,width:n.width}),s||(o?or:_n)(r,{shape:l},e,a,null);var u=e?t.baseAxis.model:null;(o?or:_n)(r,{shape:c},u,a)}function b0(t,e){for(var r=0;r<e.length;r++)if(!isFinite(t[e[r]]))return!0;return!1}var eA=["x","y","width","height"],tA=["cx","cy","r","startAngle","endAngle"],x0={cartesian2d:function(t){return!b0(t,eA)},polar:function(t){return!b0(t,tA)}},xc={cartesian2d:function(t,e,r){var n=t.getItemLayout(e),a=r?nA(r,n):0,i=n.width>0?1:-1,o=n.height>0?1:-1;return{x:n.x+i*a/2,y:n.y+o*a/2,width:n.width-i*a,height:n.height-o*a}},polar:function(t,e,r){var n=t.getItemLayout(e);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}}};function rA(t){return t.startAngle!=null&&t.endAngle!=null&&t.startAngle===t.endAngle}function w0(t){return(function(e){var r=e?"Arc":"Angle";return function(n){switch(n){case"start":case"insideStart":case"end":case"insideEnd":return n+r;default:return n}}})(t)}function S0(t,e,r,n,a,i,o,s){var l=e.getItemVisual(r,"style");if(s){if(!i.get("roundCap")){var u=t.shape,f=KM(n.getModel("itemStyle"),u);q(u,f),t.setShape(u)}}else{var c=n.get(["itemStyle","borderRadius"])||0;t.setShape("r",c)}t.useStyle(l);var h=n.getShallow("cursor");h&&t.attr("cursor",h);var d=s?o?a.r>=a.r0?"endArc":"startArc":a.endAngle>=a.startAngle?"endAngle":"startAngle":o?a.height>=0?"bottom":"top":a.width>=0?"right":"left",p=Zl(n);Xl(t,p,{labelFetcher:i,labelDataIndex:r,defaultText:zd(i.getData(),r),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:d});var m=t.getTextContent();if(s&&m){var g=n.get(["label","position"]);t.textConfig.inside=g==="middle"?!0:null,ZM(t,g==="outside"?d:g,w0(o),n.get(["label","rotate"]))}iT(m,p,i.getRawValue(r),function(y){return $y(e,y)});var v=n.getModel(["emphasis"]);Rl(t,v.get("focus"),v.get("blurScope"),v.get("disabled")),Hf(t,n),rA(a)&&(t.style.fill="none",t.style.stroke="none",I(t.states,function(y){y.style&&(y.style.fill=y.style.stroke="none")}))}function nA(t,e){var r=t.get(["itemStyle","borderColor"]);if(!r||r==="none")return 0;var n=t.get(["itemStyle","borderWidth"])||0,a=isNaN(e.width)?Number.MAX_VALUE:Math.abs(e.width),i=isNaN(e.height)?Number.MAX_VALUE:Math.abs(e.height);return Math.min(n,a,i)}var aA=(function(){function t(){}return t})(),k0=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="largeBar",n}return e.prototype.getDefaultShape=function(){return new aA},e.prototype.buildPath=function(r,n){for(var a=n.points,i=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],c=this.barWidth,u=0;u<a.length;u+=3)l[i]=c,l[o]=a[u+2],s[i]=a[u+i],s[o]=a[u+o],r.rect(s[0],s[1],l[0],l[1])},e})(qe);function T0(t,e,r,n){var a=t.getData(),i=a.getLayout("valueAxisHorizontal")?1:0,o=a.getLayout("largeDataIndices"),s=a.getLayout("size"),l=t.getModel("backgroundStyle"),c=a.getLayout("largeBackgroundPoints");if(c){var u=new k0({shape:{points:c},incremental:!!n,silent:!0,z2:0});u.baseDimIdx=i,u.largeDataIndices=o,u.barWidth=s,u.useStyle(l.getItemStyle()),e.add(u),r&&r.push(u)}var f=new k0({shape:{points:a.getLayout("largePoints")},incremental:!!n,ignoreCoarsePointer:!0,z2:1});f.baseDimIdx=i,f.largeDataIndices=o,f.barWidth=s,e.add(f),f.useStyle(a.getVisual("style")),f.style.stroke=null,We(f).seriesIndex=t.seriesIndex,t.get("silent")||(f.on("mousedown",C0),f.on("mousemove",C0)),r&&r.push(f)}var C0=Yd(function(t){var e=this,r=iA(e,t.offsetX,t.offsetY);We(e).dataIndex=r>=0?r:null},30,!1);function iA(t,e,r){for(var n=t.baseDimIdx,a=1-n,i=t.shape.points,o=t.largeDataIndices,s=[],l=[],c=t.barWidth,u=0,f=i.length/3;u<f;u++){var h=u*3;if(l[n]=c,l[a]=i[h+2],s[n]=i[h+n],s[a]=i[h+a],l[a]<0&&(s[a]+=l[a],l[a]=-l[a]),e>=s[0]&&e<=s[0]+l[0]&&r>=s[1]&&r<=s[1]+l[1])return o[u]}return-1}function M0(t,e,r){if(Gd(r,"cartesian2d")){var n=e,a=r.getArea();return{x:t?n.x:a.x,y:t?a.y:n.y,width:t?n.width:a.width,height:t?a.height:n.height}}else{var a=r.getArea(),i=e;return{cx:a.cx,cy:a.cy,r0:t?a.r0:i.r0,r:t?a.r:i.r,startAngle:t?i.startAngle:0,endAngle:t?i.endAngle:Math.PI*2}}}function oA(t,e,r){var n=t.type==="polar"?xi:_t;return new n({shape:M0(e,r,t),silent:!0,z2:0})}function sA(t){t.registerChartView(JM),t.registerSeriesModel(qM),t.registerLayout(t.PRIORITY.VISUAL.LAYOUT,dt(GM,"bar")),t.registerLayout(t.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,$M("bar")),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,l0("bar")),t.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(e,r){var n=e.componentType||"series";r.eachComponent({mainType:n,query:e},function(a){e.sortInfo&&a.axis.setCategorySortInfo(e.sortInfo)})})}function Ei(t,e,r,n,a){var i=t+e;r.isSilent(i)||n.eachComponent({mainType:"series",subType:"pie"},function(o){for(var s=o.seriesIndex,l=o.option.selectedMap,c=a.selected,u=0;u<c.length;u++)if(c[u].seriesIndex===s){var f=o.getData(),h=Ma(f,a.fromActionPayload);r.trigger(i,{type:i,seriesId:o.id,name:ee(h)?f.getName(h[0]):f.getName(h),selected:ae(l)?l:q({},l)})}})}function lA(t,e,r){t.on("selectchanged",function(n){var a=r.getModel();n.isFromClick?(Ei("map","selectchanged",e,a,n),Ei("pie","selectchanged",e,a,n)):n.fromAction==="select"?(Ei("map","selected",e,a,n),Ei("pie","selected",e,a,n)):n.fromAction==="unselect"&&(Ei("map","unselected",e,a,n),Ei("pie","unselected",e,a,n))})}function cA(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];if(!n.defaultAttr.ignore){var a=n.label,i=a.getComputedTransform(),o=a.getBoundingRect(),s=!i||i[1]<1e-5&&i[2]<1e-5,l=a.style.margin||0,c=o.clone();c.applyTransform(i),c.x-=l/2,c.y-=l/2,c.width+=l,c.height+=l;var u=s?new Vl(o,i):null;e.push({label:a,labelLine:n.labelLine,rect:c,localRect:o,obb:u,priority:n.priority,defaultAttr:n.defaultAttr,layoutOption:n.computedLayoutOption,axisAligned:s,transform:i})}}return e}function uA(t){var e=[];t.sort(function(m,g){return g.priority-m.priority});var r=new Ge(0,0,0,0);function n(m){if(!m.ignore){var g=m.ensureState("emphasis");g.ignore==null&&(g.ignore=!1)}m.ignore=!0}for(var a=0;a<t.length;a++){var i=t[a],o=i.axisAligned,s=i.localRect,l=i.transform,c=i.label,u=i.labelLine;r.copy(i.rect),r.width-=.1,r.height-=.1,r.x+=.05,r.y+=.05;for(var f=i.obb,h=!1,d=0;d<e.length;d++){var p=e[d];if(r.intersect(p.rect)){if(o&&p.axisAligned){h=!0;break}if(p.obb||(p.obb=new Vl(p.localRect,p.transform)),f||(f=new Vl(s,l)),f.intersect(p.obb)){h=!0;break}}}h?(n(c),u&&n(u)):(c.attr("ignore",i.defaultAttr.ignore),u&&u.attr("ignore",i.defaultAttr.labelGuideIgnore),e.push(i))}}var Oi=(function(){function t(e,r){this.target=e,this.topTarget=r&&r.topTarget}return t})(),fA=(function(){function t(e){this.handler=e,e.on("mousedown",this._dragStart,this),e.on("mousemove",this._drag,this),e.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(e){for(var r=e.target;r&&!r.draggable;)r=r.parent||r.__hostTarget;r&&(this._draggingTarget=r,r.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new Oi(r,e),"dragstart",e.event))},t.prototype._drag=function(e){var r=this._draggingTarget;if(r){var n=e.offsetX,a=e.offsetY,i=n-this._x,o=a-this._y;this._x=n,this._y=a,r.drift(i,o,e),this.handler.dispatchToElement(new Oi(r,e),"drag",e.event);var s=this.handler.findHover(n,a,r).target,l=this._dropTarget;this._dropTarget=s,r!==s&&(l&&s!==l&&this.handler.dispatchToElement(new Oi(l,e),"dragleave",e.event),s&&s!==l&&this.handler.dispatchToElement(new Oi(s,e),"dragenter",e.event))}},t.prototype._dragEnd=function(e){var r=this._draggingTarget;r&&(r.dragging=!1),this.handler.dispatchToElement(new Oi(r,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new Oi(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},t})(),dA=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Jd=[],hA=_e.browser.firefox&&+_e.browser.version.split(".")[0]<39;function Qd(t,e,r,n){return r=r||{},n?A0(t,e,r):hA&&e.layerX!=null&&e.layerX!==e.offsetX?(r.zrX=e.layerX,r.zrY=e.layerY):e.offsetX!=null?(r.zrX=e.offsetX,r.zrY=e.offsetY):A0(t,e,r),r}function A0(t,e,r){if(_e.domSupported&&t.getBoundingClientRect){var n=e.clientX,a=e.clientY;if(cy(t)){var i=t.getBoundingClientRect();r.zrX=n-i.left,r.zrY=a-i.top;return}else if(xd(Jd,t,n,a)){r.zrX=Jd[0],r.zrY=Jd[1];return}}r.zrX=r.zrY=0}function eh(t){return t||window.event}function br(t,e,r){if(e=eh(e),e.zrX!=null)return e;var n=e.type,a=n&&n.indexOf("touch")>=0;if(a){var o=n!=="touchend"?e.targetTouches[0]:e.changedTouches[0];o&&Qd(t,o,e,r)}else{Qd(t,e,e,r);var i=pA(e);e.zrDelta=i?i/120:-(e.detail||0)/3}var s=e.button;return e.which==null&&s!==void 0&&dA.test(e.type)&&(e.which=s&1?1:s&2?3:s&4?2:0),e}function pA(t){var e=t.wheelDelta;if(e)return e;var r=t.deltaX,n=t.deltaY;if(r==null||n==null)return e;var a=Math.abs(n!==0?n:r),i=n>0?-1:n<0?1:r>0?-1:1;return 3*a*i}function vA(t,e,r,n){t.addEventListener(e,r,n)}function gA(t,e,r,n){t.removeEventListener(e,r,n)}var wc=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0};function D0(t){return t.which===2||t.which===3}var mA=(function(){function t(){this._track=[]}return t.prototype.recognize=function(e,r,n){return this._doTrack(e,r,n),this._recognize(e)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(e,r,n){var a=e.touches;if(a){for(var i={points:[],touches:[],target:r,event:e},o=0,s=a.length;o<s;o++){var l=a[o],c=Qd(n,l,{});i.points.push([c.zrX,c.zrY]),i.touches.push(l)}this._track.push(i)}},t.prototype._recognize=function(e){for(var r in th)if(th.hasOwnProperty(r)){var n=th[r](this._track,e);if(n)return n}},t})();function I0(t){var e=t[1][0]-t[0][0],r=t[1][1]-t[0][1];return Math.sqrt(e*e+r*r)}function yA(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var th={pinch:function(t,e){var r=t.length;if(r){var n=(t[r-1]||{}).points,a=(t[r-2]||{}).points||n;if(a&&a.length>1&&n&&n.length>1){var i=I0(n)/I0(a);!isFinite(i)&&(i=1),e.pinchScale=i;var o=yA(n);return e.pinchX=o[0],e.pinchY=o[1],{type:"pinch",target:t[0].target,event:e}}}}},L0="silent";function _A(t,e,r){return{type:t,event:r,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:r.zrX,offsetY:r.zrY,gestureEvent:r.gestureEvent,pinchX:r.pinchX,pinchY:r.pinchY,pinchScale:r.pinchScale,wheelDelta:r.zrDelta,zrByTouch:r.zrByTouch,which:r.which,stop:bA}}function bA(){wc(this.event)}var xA=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.handler=null,r}return e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e})(Ir),$o=(function(){function t(e,r){this.x=e,this.y=r}return t})(),wA=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],rh=new Ge(0,0,0,0),P0=(function(t){K(e,t);function e(r,n,a,i,o){var s=t.call(this)||this;return s._hovered=new $o(0,0),s.storage=r,s.painter=n,s.painterRoot=i,s._pointerSize=o,a=a||new xA,s.proxy=null,s.setHandlerProxy(a),s._draggingMgr=new fA(s),s}return e.prototype.setHandlerProxy=function(r){this.proxy&&this.proxy.dispose(),r&&(I(wA,function(n){r.on&&r.on(n,this[n],this)},this),r.handler=this),this.proxy=r},e.prototype.mousemove=function(r){var n=r.zrX,a=r.zrY,i=E0(this,n,a),o=this._hovered,s=o.target;s&&!s.__zr&&(o=this.findHover(o.x,o.y),s=o.target);var l=this._hovered=i?new $o(n,a):this.findHover(n,a),c=l.target,u=this.proxy;u.setCursor&&u.setCursor(c?c.cursor:"default"),s&&c!==s&&this.dispatchToElement(o,"mouseout",r),this.dispatchToElement(l,"mousemove",r),c&&c!==s&&this.dispatchToElement(l,"mouseover",r)},e.prototype.mouseout=function(r){var n=r.zrEventControl;n!=="only_globalout"&&this.dispatchToElement(this._hovered,"mouseout",r),n!=="no_globalout"&&this.trigger("globalout",{type:"globalout",event:r})},e.prototype.resize=function(){this._hovered=new $o(0,0)},e.prototype.dispatch=function(r,n){var a=this[r];a&&a.call(this,n)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(r){var n=this.proxy;n.setCursor&&n.setCursor(r)},e.prototype.dispatchToElement=function(r,n,a){r=r||{};var i=r.target;if(!(i&&i.silent)){for(var o="on"+n,s=_A(n,r,a);i&&(i[o]&&(s.cancelBubble=!!i[o].call(i,s)),i.trigger(n,s),i=i.__hostTarget?i.__hostTarget:i.parent,!s.cancelBubble););s.cancelBubble||(this.trigger(n,s),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(l){typeof l[o]=="function"&&l[o].call(l,s),l.trigger&&l.trigger(n,s)}))}},e.prototype.findHover=function(r,n,a){var i=this.storage.getDisplayList(),o=new $o(r,n);if(R0(i,o,r,n,a),this._pointerSize&&!o.target){for(var s=[],l=this._pointerSize,c=l/2,u=new Ge(r-c,n-c,l,l),f=i.length-1;f>=0;f--){var h=i[f];h!==a&&!h.ignore&&!h.ignoreCoarsePointer&&(!h.parent||!h.parent.ignoreCoarsePointer)&&(rh.copy(h.getBoundingRect()),h.transform&&rh.applyTransform(h.transform),rh.intersect(u)&&s.push(h))}if(s.length)for(var d=4,p=Math.PI/12,m=Math.PI*2,g=0;g<c;g+=d)for(var v=0;v<m;v+=p){var y=r+g*Math.cos(v),b=n+g*Math.sin(v);if(R0(s,o,y,b,a),o.target)return o}}return o},e.prototype.processGesture=function(r,n){this._gestureMgr||(this._gestureMgr=new mA);var a=this._gestureMgr;n==="start"&&a.clear();var i=a.recognize(r,this.findHover(r.zrX,r.zrY,null).target,this.proxy.dom);if(n==="end"&&a.clear(),i){var o=i.type;r.gestureEvent=o;var s=new $o;s.target=i.target,this.dispatchToElement(s,o,i.event)}},e})(Ir);I(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){P0.prototype[t]=function(e){var r=e.zrX,n=e.zrY,a=E0(this,r,n),i,o;if((t!=="mouseup"||!a)&&(i=this.findHover(r,n),o=i.target),t==="mousedown")this._downEl=o,this._downPoint=[e.zrX,e.zrY],this._upEl=o;else if(t==="mouseup")this._upEl=o;else if(t==="click"){if(this._downEl!==this._upEl||!this._downPoint||yS(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(i,t,e)}});function SA(t,e,r){if(t[t.rectHover?"rectContain":"contain"](e,r)){for(var n=t,a=void 0,i=!1;n;){if(n.ignoreClip&&(i=!0),!i){var o=n.getClipPath();if(o&&!o.contain(e,r))return!1}n.silent&&(a=!0);var s=n.__hostTarget;n=s||n.parent}return a?L0:!0}return!1}function R0(t,e,r,n,a){for(var i=t.length-1;i>=0;i--){var o=t[i],s=void 0;if(o!==a&&!o.ignore&&(s=SA(o,r,n))&&(!e.topTarget&&(e.topTarget=o),s!==L0)){e.target=o;break}}}function E0(t,e,r){var n=t.painter;return e<0||e>n.getWidth()||r<0||r>n.getHeight()}var O0=32,Wo=7;function kA(t){for(var e=0;t>=O0;)e|=t&1,t>>=1;return t+e}function N0(t,e,r,n){var a=e+1;if(a===r)return 1;if(n(t[a++],t[e])<0){for(;a<r&&n(t[a],t[a-1])<0;)a++;TA(t,e,a)}else for(;a<r&&n(t[a],t[a-1])>=0;)a++;return a-e}function TA(t,e,r){for(r--;e<r;){var n=t[e];t[e++]=t[r],t[r--]=n}}function B0(t,e,r,n,a){for(n===e&&n++;n<r;n++){for(var i=t[n],o=e,s=n,l;o<s;)l=o+s>>>1,a(i,t[l])<0?s=l:o=l+1;var c=n-o;switch(c){case 3:t[o+3]=t[o+2];case 2:t[o+2]=t[o+1];case 1:t[o+1]=t[o];break;default:for(;c>0;)t[o+c]=t[o+c-1],c--}t[o]=i}}function nh(t,e,r,n,a,i){var o=0,s=0,l=1;if(i(t,e[r+a])>0){for(s=n-a;l<s&&i(t,e[r+a+l])>0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}else{for(s=a+1;l<s&&i(t,e[r+a-l])<=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s);var c=o;o=a-l,l=a-c}for(o++;o<l;){var u=o+(l-o>>>1);i(t,e[r+u])>0?o=u+1:l=u}return l}function ah(t,e,r,n,a,i){var o=0,s=0,l=1;if(i(t,e[r+a])<0){for(s=a+1;l<s&&i(t,e[r+a-l])<0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s);var c=o;o=a-l,l=a-c}else{for(s=n-a;l<s&&i(t,e[r+a+l])>=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}for(o++;o<l;){var u=o+(l-o>>>1);i(t,e[r+u])<0?l=u:o=u+1}return l}function CA(t,e){var r=Wo,n,a,i=0,o=[];n=[],a=[];function s(d,p){n[i]=d,a[i]=p,i+=1}function l(){for(;i>1;){var d=i-2;if(d>=1&&a[d-1]<=a[d]+a[d+1]||d>=2&&a[d-2]<=a[d]+a[d-1])a[d-1]<a[d+1]&&d--;else if(a[d]>a[d+1])break;u(d)}}function c(){for(;i>1;){var d=i-2;d>0&&a[d-1]<a[d+1]&&d--,u(d)}}function u(d){var p=n[d],m=a[d],g=n[d+1],v=a[d+1];a[d]=m+v,d===i-3&&(n[d+1]=n[d+2],a[d+1]=a[d+2]),i--;var y=ah(t[g],t,p,m,0,e);p+=y,m-=y,m!==0&&(v=nh(t[p+m-1],t,g,v,v-1,e),v!==0&&(m<=v?f(p,m,g,v):h(p,m,g,v)))}function f(d,p,m,g){var v=0;for(v=0;v<p;v++)o[v]=t[d+v];var y=0,b=m,x=d;if(t[x++]=t[b++],--g===0){for(v=0;v<p;v++)t[x+v]=o[y+v];return}if(p===1){for(v=0;v<g;v++)t[x+v]=t[b+v];t[x+g]=o[y];return}for(var w=r,S,k,C;;){S=0,k=0,C=!1;do if(e(t[b],o[y])<0){if(t[x++]=t[b++],k++,S=0,--g===0){C=!0;break}}else if(t[x++]=o[y++],S++,k=0,--p===1){C=!0;break}while((S|k)<w);if(C)break;do{if(S=ah(t[b],o,y,p,0,e),S!==0){for(v=0;v<S;v++)t[x+v]=o[y+v];if(x+=S,y+=S,p-=S,p<=1){C=!0;break}}if(t[x++]=t[b++],--g===0){C=!0;break}if(k=nh(o[y],t,b,g,0,e),k!==0){for(v=0;v<k;v++)t[x+v]=t[b+v];if(x+=k,b+=k,g-=k,g===0){C=!0;break}}if(t[x++]=o[y++],--p===1){C=!0;break}w--}while(S>=Wo||k>=Wo);if(C)break;w<0&&(w=0),w+=2}if(r=w,r<1&&(r=1),p===1){for(v=0;v<g;v++)t[x+v]=t[b+v];t[x+g]=o[y]}else{if(p===0)throw new Error;for(v=0;v<p;v++)t[x+v]=o[y+v]}}function h(d,p,m,g){var v=0;for(v=0;v<g;v++)o[v]=t[m+v];var y=d+p-1,b=g-1,x=m+g-1,w=0,S=0;if(t[x--]=t[y--],--p===0){for(w=x-(g-1),v=0;v<g;v++)t[w+v]=o[v];return}if(g===1){for(x-=p,y-=p,S=x+1,w=y+1,v=p-1;v>=0;v--)t[S+v]=t[w+v];t[x]=o[b];return}for(var k=r;;){var C=0,A=0,M=!1;do if(e(o[b],t[y])<0){if(t[x--]=t[y--],C++,A=0,--p===0){M=!0;break}}else if(t[x--]=o[b--],A++,C=0,--g===1){M=!0;break}while((C|A)<k);if(M)break;do{if(C=p-ah(o[b],t,d,p,p-1,e),C!==0){for(x-=C,y-=C,p-=C,S=x+1,w=y+1,v=C-1;v>=0;v--)t[S+v]=t[w+v];if(p===0){M=!0;break}}if(t[x--]=o[b--],--g===1){M=!0;break}if(A=g-nh(t[y],o,0,g,g-1,e),A!==0){for(x-=A,b-=A,g-=A,S=x+1,w=b+1,v=0;v<A;v++)t[S+v]=o[w+v];if(g<=1){M=!0;break}}if(t[x--]=t[y--],--p===0){M=!0;break}k--}while(C>=Wo||A>=Wo);if(M)break;k<0&&(k=0),k+=2}if(r=k,r<1&&(r=1),g===1){for(x-=p,y-=p,S=x+1,w=y+1,v=p-1;v>=0;v--)t[S+v]=t[w+v];t[x]=o[b]}else{if(g===0)throw new Error;for(w=x-(g-1),v=0;v<g;v++)t[w+v]=o[v]}}return{mergeRuns:l,forceMergeRuns:c,pushRun:s}}function Sc(t,e,r,n){r||(r=0),n||(n=t.length);var a=n-r;if(!(a<2)){var i=0;if(a<O0){i=N0(t,r,n,e),B0(t,r,n,r+i,e);return}var o=CA(t,e),s=kA(a);do{if(i=N0(t,r,n,e),i<s){var l=a;l>s&&(l=s),B0(t,r,r+l,r+i,e),i=l}o.pushRun(r,i),o.mergeRuns(),a-=i,r+=i}while(a!==0);o.forceMergeRuns()}}var z0=!1;function ih(){z0||(z0=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function F0(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var MA=(function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=F0}return t.prototype.traverse=function(e,r){for(var n=0;n<this._roots.length;n++)this._roots[n].traverse(e,r)},t.prototype.getDisplayList=function(e,r){r=r||!1;var n=this._displayList;return(e||!n.length)&&this.updateDisplayList(r),n},t.prototype.updateDisplayList=function(e){this._displayListLen=0;for(var r=this._roots,n=this._displayList,a=0,i=r.length;a<i;a++)this._updateAndAddDisplayable(r[a],null,e);n.length=this._displayListLen,Sc(n,F0)},t.prototype._updateAndAddDisplayable=function(e,r,n){if(!(e.ignore&&!n)){e.beforeUpdate(),e.update(),e.afterUpdate();var a=e.getClipPath();if(e.ignoreClip)r=null;else if(a){r?r=r.slice():r=[];for(var i=a,o=e;i;)i.parent=o,i.updateTransform(),r.push(i),o=i,i=i.getClipPath()}if(e.childrenRef){for(var s=e.childrenRef(),l=0;l<s.length;l++){var c=s[l];e.__dirty&&(c.__dirty|=ir),this._updateAndAddDisplayable(c,r,n)}e.__dirty=0}else{var u=e;r&&r.length?u.__clipPaths=r:u.__clipPaths&&u.__clipPaths.length>0&&(u.__clipPaths=[]),isNaN(u.z)&&(ih(),u.z=0),isNaN(u.z2)&&(ih(),u.z2=0),isNaN(u.zlevel)&&(ih(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var f=e.getDecalElement&&e.getDecalElement();f&&this._updateAndAddDisplayable(f,r,n);var h=e.getTextGuideLine();h&&this._updateAndAddDisplayable(h,r,n);var d=e.getTextContent();d&&this._updateAndAddDisplayable(d,r,n)}},t.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},t.prototype.delRoot=function(e){if(e instanceof Array){for(var r=0,n=e.length;r<n;r++)this.delRoot(e[r]);return}var a=Ue(this._roots,e);a>=0&&this._roots.splice(a,1)},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t})(),kc;kc=_e.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};function Ni(){return new Date().getTime()}var AA=(function(t){K(e,t);function e(r){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,r=r||{},n.stage=r.stage||{},n}return e.prototype.addClip=function(r){r.animation&&this.removeClip(r),this._head?(this._tail.next=r,r.prev=this._tail,r.next=null,this._tail=r):this._head=this._tail=r,r.animation=this},e.prototype.addAnimator=function(r){r.animation=this;var n=r.getClip();n&&this.addClip(n)},e.prototype.removeClip=function(r){if(r.animation){var n=r.prev,a=r.next;n?n.next=a:this._head=a,a?a.prev=n:this._tail=n,r.next=r.prev=r.animation=null}},e.prototype.removeAnimator=function(r){var n=r.getClip();n&&this.removeClip(n),r.animation=null},e.prototype.update=function(r){for(var n=Ni()-this._pausedTime,a=n-this._time,i=this._head;i;){var o=i.next,s=i.step(n,a);s&&(i.ondestroy(),this.removeClip(i)),i=o}this._time=n,r||(this.trigger("frame",a),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var r=this;this._running=!0;function n(){r._running&&(kc(n),!r._paused&&r.update())}kc(n)},e.prototype.start=function(){this._running||(this._time=Ni(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=Ni(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=Ni()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var r=this._head;r;){var n=r.next;r.prev=r.next=r.animation=null,r=n}this._head=this._tail=null},e.prototype.isFinished=function(){return this._head==null},e.prototype.animate=function(r,n){n=n||{},this.start();var a=new lf(r,n.loop);return this.addAnimator(a),a},e})(Ir),DA=300,oh=_e.domSupported,sh=(function(){var t=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],r={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},n=he(t,function(a){var i=a.replace("mouse","pointer");return r.hasOwnProperty(i)?i:a});return{mouse:t,touch:e,pointer:n}})(),H0={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},V0=!1;function lh(t){var e=t.pointerType;return e==="pen"||e==="touch"}function IA(t){t.touching=!0,t.touchTimer!=null&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}function ch(t){t&&(t.zrByTouch=!0)}function LA(t,e){return br(t.dom,new PA(t,e),!0)}function U0(t,e){for(var r=e,n=!1;r&&r.nodeType!==9&&!(n=r.domBelongToZr||r!==e&&r===t.painterRoot);)r=r.parentNode;return n}var PA=(function(){function t(e,r){this.stopPropagation=Et,this.stopImmediatePropagation=Et,this.preventDefault=Et,this.type=r.type,this.target=this.currentTarget=e.dom,this.pointerType=r.pointerType,this.clientX=r.clientX,this.clientY=r.clientY}return t})(),Er={mousedown:function(t){t=br(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=br(this.dom,t);var e=this.__mayPointerCapture;e&&(t.zrX!==e[0]||t.zrY!==e[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=br(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){t=br(this.dom,t);var e=t.toElement||t.relatedTarget;U0(this,e)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){V0=!0,t=br(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){V0||(t=br(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){t=br(this.dom,t),ch(t),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Er.mousemove.call(this,t),Er.mousedown.call(this,t)},touchmove:function(t){t=br(this.dom,t),ch(t),this.handler.processGesture(t,"change"),Er.mousemove.call(this,t)},touchend:function(t){t=br(this.dom,t),ch(t),this.handler.processGesture(t,"end"),Er.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<DA&&Er.click.call(this,t)},pointerdown:function(t){Er.mousedown.call(this,t)},pointermove:function(t){lh(t)||Er.mousemove.call(this,t)},pointerup:function(t){Er.mouseup.call(this,t)},pointerout:function(t){lh(t)||Er.mouseout.call(this,t)}};I(["click","dblclick","contextmenu"],function(t){Er[t]=function(e){e=br(this.dom,e),this.trigger(t,e)}});var uh={pointermove:function(t){lh(t)||uh.mousemove.call(this,t)},pointerup:function(t){uh.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function RA(t,e){var r=e.domHandlers;_e.pointerEventsSupported?I(sh.pointer,function(n){Tc(e,n,function(a){r[n].call(t,a)})}):(_e.touchEventsSupported&&I(sh.touch,function(n){Tc(e,n,function(a){r[n].call(t,a),IA(e)})}),I(sh.mouse,function(n){Tc(e,n,function(a){a=eh(a),e.touching||r[n].call(t,a)})}))}function EA(t,e){_e.pointerEventsSupported?I(H0.pointer,r):_e.touchEventsSupported||I(H0.mouse,r);function r(n){function a(i){i=eh(i),U0(t,i.target)||(i=LA(t,i),e.domHandlers[n].call(t,i))}Tc(e,n,a,{capture:!0})}}function Tc(t,e,r,n){t.mounted[e]=r,t.listenerOpts[e]=n,vA(t.domTarget,e,r,n)}function fh(t){var e=t.mounted;for(var r in e)e.hasOwnProperty(r)&&gA(t.domTarget,r,e[r],t.listenerOpts[r]);t.mounted={}}var G0=(function(){function t(e,r){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=r}return t})(),OA=(function(t){K(e,t);function e(r,n){var a=t.call(this)||this;return a.__pointerCapturing=!1,a.dom=r,a.painterRoot=n,a._localHandlerScope=new G0(r,Er),oh&&(a._globalHandlerScope=new G0(document,uh)),RA(a,a._localHandlerScope),a}return e.prototype.dispose=function(){fh(this._localHandlerScope),oh&&fh(this._globalHandlerScope)},e.prototype.setCursor=function(r){this.dom.style&&(this.dom.style.cursor=r||"default")},e.prototype.__togglePointerCapture=function(r){if(this.__mayPointerCapture=null,oh&&+this.__pointerCapturing^+r){this.__pointerCapturing=r;var n=this._globalHandlerScope;r?EA(this,n):fh(n)}},e})(Ir);var Cc={},$0={};function NA(t){delete $0[t]}function BA(t){if(!t)return!1;if(typeof t=="string")return cl(t,1)<cf;if(t.colorStops){for(var e=t.colorStops,r=0,n=e.length,a=0;a<n;a++)r+=cl(e[a].color,1);return r/=n,r<cf}return!1}var zA=(function(){function t(e,r,n){var a=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=r,this.id=e;var i=new MA,o=n.renderer||"canvas";Cc[o]||(o=at(Cc)[0]),n.useDirtyRect=n.useDirtyRect==null?!1:n.useDirtyRect;var s=new Cc[o](r,i,n,e),l=n.ssr||s.ssrOnly;this.storage=i,this.painter=s;var c=!_e.node&&!_e.worker&&!l?new OA(s.getViewportRoot(),s.root):null,u=n.useCoarsePointer,f=u==null||u==="auto"?_e.touchEventsSupported:!!u,h=44,d;f&&(d=Pe(n.pointerSize,h)),this.handler=new P0(i,s,c,s.root,d),this.animation=new AA({stage:{update:l?null:function(){return a._flush(!0)}}}),l||this.animation.start()}return t.prototype.add=function(e){this._disposed||!e||(this.storage.addRoot(e),e.addSelfToZr(this),this.refresh())},t.prototype.remove=function(e){this._disposed||!e||(this.storage.delRoot(e),e.removeSelfFromZr(this),this.refresh())},t.prototype.configLayer=function(e,r){this._disposed||(this.painter.configLayer&&this.painter.configLayer(e,r),this.refresh())},t.prototype.setBackgroundColor=function(e){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(e),this.refresh(),this._backgroundColor=e,this._darkMode=BA(e))},t.prototype.getBackgroundColor=function(){return this._backgroundColor},t.prototype.setDarkMode=function(e){this._darkMode=e},t.prototype.isDarkMode=function(){return this._darkMode},t.prototype.refreshImmediately=function(e){this._disposed||(e||this.animation.update(!0),this._needsRefresh=!1,this.painter.refresh(),this._needsRefresh=!1)},t.prototype.refresh=function(){this._disposed||(this._needsRefresh=!0,this.animation.start())},t.prototype.flush=function(){this._disposed||this._flush(!1)},t.prototype._flush=function(e){var r,n=Ni();this._needsRefresh&&(r=!0,this.refreshImmediately(e)),this._needsRefreshHover&&(r=!0,this.refreshHoverImmediately());var a=Ni();r?(this._stillFrameAccum=0,this.trigger("rendered",{elapsedTime:a-n})):this._sleepAfterStill>0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&this.painter.getType()==="canvas"&&this.painter.refreshHover())},t.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},t.prototype.findHover=function(e,r){if(!this._disposed)return this.handler.findHover(e,r)},t.prototype.on=function(e,r,n){return this._disposed||this.handler.on(e,r,n),this},t.prototype.off=function(e,r){this._disposed||this.handler.off(e,r)},t.prototype.trigger=function(e,r){this._disposed||this.handler.trigger(e,r)},t.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),r=0;r<e.length;r++)e[r]instanceof St&&e[r].removeSelfFromZr(this);this.storage.delAllRoots(),this.painter.clear()}},t.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,NA(this.id))},t})();function W0(t,e){var r=new zA(mv(),t,e);return $0[r.id]=r,r}function FA(t,e){Cc[t]=e}var q0="";typeof navigator<"u"&&(q0=navigator.platform||"");var Bi="rgba(0, 0, 0, 0.2)";const HA={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:Bi,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Bi,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Bi,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Bi,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Bi,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Bi,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:q0.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};var VA=me();function UA(t,e,r){var n=VA.get(e);if(!n)return r;var a=n(t);return a?r.concat(a):r}var Mc,qo,Y0,X0="\0_ec_inner",GA=1,dh=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.init=function(r,n,a,i,o,s){i=i||{},this.option=null,this._theme=new lt(i),this._locale=new lt(o),this._optionManager=s},e.prototype.setOption=function(r,n,a){var i=j0(n);this._optionManager.setOption(r,a,i),this._resetOption(null,i)},e.prototype.resetOption=function(r,n){return this._resetOption(r,j0(n))},e.prototype._resetOption=function(r,n){var a=!1,i=this._optionManager;if(!r||r==="recreate"){var o=i.mountOption(r==="recreate");!this.option||r==="recreate"?Y0(this,o):(this.restoreData(),this._mergeOption(o,n)),a=!0}if((r==="timeline"||r==="media")&&this.restoreData(),!r||r==="recreate"||r==="timeline"){var s=i.getTimelineOption(this);s&&(a=!0,this._mergeOption(s,n))}if(!r||r==="recreate"||r==="media"){var l=i.getMediaOption(this);l.length&&I(l,function(c){a=!0,this._mergeOption(c,n)},this)}return a},e.prototype.mergeOption=function(r){this._mergeOption(r,null)},e.prototype._mergeOption=function(r,n){var a=this.option,i=this._componentsMap,o=this._componentsCount,s=[],l=me(),c=n&&n.replaceMergeMainTypeMap;hT(this),I(r,function(f,h){f!=null&&(Ye.hasClass(h)?h&&(s.push(h),l.set(h,!0)):a[h]=a[h]==null?Ie(f):Oe(a[h],f,!0))}),c&&c.each(function(f,h){Ye.hasClass(h)&&!l.get(h)&&(s.push(h),l.set(h,!0))}),Ye.topologicalTravel(s,Ye.getAllClassMainTypes(),u,this);function u(f){var h=UA(this,f,Mt(r[f])),d=i.get(f),p=d?c&&c.get(f)?"replaceMerge":"normalMerge":"replaceAll",m=Dk(d,h,p);Nk(m,f,Ye),a[f]=null,i.set(f,null),o.set(f,0);var g=[],v=[],y=0,b;I(m,function(x,w){var S=x.existing,k=x.newOption;if(!k)S&&(S.mergeOption({},this),S.optionUpdated({},!1));else{var C=f==="series",A=Ye.getClass(f,x.keyInfo.subType,!C);if(!A)return;if(f==="tooltip"){if(b)return;b=!0}if(S&&S.constructor===A)S.name=x.keyInfo.name,S.mergeOption(k,this),S.optionUpdated(k,!1);else{var M=q({componentIndex:w},x.keyInfo);S=new A(k,this,this,M),q(S,M),x.brandNew&&(S.__requireNewView=!0),S.init(k,this,this),S.optionUpdated(null,!0)}}S?(g.push(S.option),v.push(S),y++):(g.push(void 0),v.push(void 0))},this),a[f]=g,i.set(f,v),o.set(f,y),f==="series"&&Mc(this)}this._seriesIndices||Mc(this)},e.prototype.getOption=function(){var r=Ie(this.option);return I(r,function(n,a){if(Ye.hasClass(a)){for(var i=Mt(n),o=i.length,s=!1,l=o-1;l>=0;l--)i[l]&&!So(i[l])?s=!0:(i[l]=null,!s&&o--);i.length=o,r[a]=i}}),delete r[X0],r},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(r){this._payload=r},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(r,n){var a=this._componentsMap.get(r);if(a){var i=a[n||0];if(i)return i;if(n==null){for(var o=0;o<a.length;o++)if(a[o])return a[o]}}},e.prototype.queryComponents=function(r){var n=r.mainType;if(!n)return[];var a=r.index,i=r.id,o=r.name,s=this._componentsMap.get(n);if(!s||!s.length)return[];var l;return a!=null?(l=[],I(Mt(a),function(c){s[c]&&l.push(s[c])})):i!=null?l=Z0("id",i,s):o!=null?l=Z0("name",o,s):l=bt(s,function(c){return!!c}),K0(l,r)},e.prototype.findComponents=function(r){var n=r.query,a=r.mainType,i=s(n),o=i?this.queryComponents(i):bt(this._componentsMap.get(a),function(c){return!!c});return l(K0(o,r));function s(c){var u=a+"Index",f=a+"Id",h=a+"Name";return c&&(c[u]!=null||c[f]!=null||c[h]!=null)?{mainType:a,index:c[u],id:c[f],name:c[h]}:null}function l(c){return r.filter?bt(c,r.filter):c}},e.prototype.eachComponent=function(r,n,a){var i=this._componentsMap;if(ke(r)){var o=n,s=r;i.each(function(f,h){for(var d=0;f&&d<f.length;d++){var p=f[d];p&&s.call(o,h,p,p.componentIndex)}})}else for(var l=ae(r)?i.get(r):de(r)?this.findComponents(r):null,c=0;l&&c<l.length;c++){var u=l[c];u&&n.call(a,u,u.componentIndex)}},e.prototype.getSeriesByName=function(r){var n=Zr(r,null);return bt(this._componentsMap.get("series"),function(a){return!!a&&n!=null&&a.name===n})},e.prototype.getSeriesByIndex=function(r){return this._componentsMap.get("series")[r]},e.prototype.getSeriesByType=function(r){return bt(this._componentsMap.get("series"),function(n){return!!n&&n.subType===r})},e.prototype.getSeries=function(){return bt(this._componentsMap.get("series"),function(r){return!!r})},e.prototype.getSeriesCount=function(){return this._componentsCount.get("series")},e.prototype.eachSeries=function(r,n){qo(this),I(this._seriesIndices,function(a){var i=this._componentsMap.get("series")[a];r.call(n,i,a)},this)},e.prototype.eachRawSeries=function(r,n){I(this._componentsMap.get("series"),function(a){a&&r.call(n,a,a.componentIndex)})},e.prototype.eachSeriesByType=function(r,n,a){qo(this),I(this._seriesIndices,function(i){var o=this._componentsMap.get("series")[i];o.subType===r&&n.call(a,o,i)},this)},e.prototype.eachRawSeriesByType=function(r,n,a){return I(this.getSeriesByType(r),n,a)},e.prototype.isSeriesFiltered=function(r){return qo(this),this._seriesIndicesMap.get(r.componentIndex)==null},e.prototype.getCurrentSeriesIndices=function(){return(this._seriesIndices||[]).slice()},e.prototype.filterSeries=function(r,n){qo(this);var a=[];I(this._seriesIndices,function(i){var o=this._componentsMap.get("series")[i];r.call(n,o,i)&&a.push(i)},this),this._seriesIndices=a,this._seriesIndicesMap=me(a)},e.prototype.restoreData=function(r){Mc(this);var n=this._componentsMap,a=[];n.each(function(i,o){Ye.hasClass(o)&&a.push(o)}),Ye.topologicalTravel(a,Ye.getAllClassMainTypes(),function(i){I(n.get(i),function(o){o&&(i!=="series"||!$A(o,r))&&o.restoreData()})})},e.internalField=(function(){Mc=function(r){var n=r._seriesIndices=[];I(r._componentsMap.get("series"),function(a){a&&n.push(a.componentIndex)}),r._seriesIndicesMap=me(n)},qo=function(r){},Y0=function(r,n){r.option={},r.option[X0]=GA,r._componentsMap=me({series:[]}),r._componentsCount=me();var a=n.aria;de(a)&&a.enabled==null&&(a.enabled=!0),WA(n,r._theme.option),Oe(n,HA,!1),r._mergeOption(n,null)}})(),e})(lt);function $A(t,e){if(e){var r=e.seriesIndex,n=e.seriesId,a=e.seriesName;return r!=null&&t.componentIndex!==r||n!=null&&t.id!==n||a!=null&&t.name!==a}}function WA(t,e){var r=t.color&&!t.colorLayer;I(e,function(n,a){a==="colorLayer"&&r||Ye.hasClass(a)||(typeof n=="object"?t[a]=t[a]?Oe(t[a],n,!1):Ie(n):t[a]==null&&(t[a]=n))})}function Z0(t,e,r){if(ee(e)){var n=me();return I(e,function(i){if(i!=null){var o=Zr(i,null);o!=null&&n.set(i,!0)}}),bt(r,function(i){return i&&n.get(i[t])})}else{var a=Zr(e,null);return bt(r,function(i){return i&&a!=null&&i[t]===a})}}function K0(t,e){return e.hasOwnProperty("subType")?bt(t,function(r){return r&&r.subType===e.subType}):t}function j0(t){var e=me();return t&&I(Mt(t.replaceMerge),function(r){e.set(r,!0)}),{replaceMergeMainTypeMap:e}}Ur(dh,Ld);var qA=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isSSR","isDisposed","on","off","getDataURL","getConnectedDataURL","getOption","getId","updateLabelLayout"],J0=(function(){function t(e){I(qA,function(r){this[r]=Ne(e[r],e)},this)}return t})(),YA=/^(min|max)?(.+)$/,XA=(function(){function t(e){this._timelineOptions=[],this._mediaList=[],this._currentMediaIndices=[],this._api=e}return t.prototype.setOption=function(e,r,n){e&&(I(Mt(e.series),function(o){o&&o.data&&Ut(o.data)&&Bu(o.data)}),I(Mt(e.dataset),function(o){o&&o.source&&Ut(o.source)&&Bu(o.source)})),e=Ie(e);var a=this._optionBackup,i=ZA(e,r,!a);this._newBaseOption=i.baseOption,a?(i.timelineOptions.length&&(a.timelineOptions=i.timelineOptions),i.mediaList.length&&(a.mediaList=i.mediaList),i.mediaDefault&&(a.mediaDefault=i.mediaDefault)):this._optionBackup=i},t.prototype.mountOption=function(e){var r=this._optionBackup;return this._timelineOptions=r.timelineOptions,this._mediaList=r.mediaList,this._mediaDefault=r.mediaDefault,this._currentMediaIndices=[],Ie(e?r.baseOption:this._newBaseOption)},t.prototype.getTimelineOption=function(e){var r,n=this._timelineOptions;if(n.length){var a=e.getComponent("timeline");a&&(r=Ie(n[a.getCurrentIndex()]))}return r},t.prototype.getMediaOption=function(e){var r=this._api.getWidth(),n=this._api.getHeight(),a=this._mediaList,i=this._mediaDefault,o=[],s=[];if(!a.length&&!i)return s;for(var l=0,c=a.length;l<c;l++)KA(a[l].query,r,n)&&o.push(l);return!o.length&&i&&(o=[-1]),o.length&&!JA(o,this._currentMediaIndices)&&(s=he(o,function(u){return Ie(u===-1?i.option:a[u].option)})),this._currentMediaIndices=o,s},t})();function ZA(t,e,r){var n=[],a,i,o=t.baseOption,s=t.timeline,l=t.options,c=t.media,u=!!t.media,f=!!(l||s||o&&o.timeline);o?(i=o,i.timeline||(i.timeline=s)):((f||u)&&(t.options=t.media=null),i=t),u&&ee(c)&&I(c,function(d){d&&d.option&&(d.query?n.push(d):a||(a=d))}),h(i),I(l,function(d){return h(d)}),I(n,function(d){return h(d.option)});function h(d){I(e,function(p){p(d,r)})}return{baseOption:i,timelineOptions:l||[],mediaDefault:a,mediaList:n}}function KA(t,e,r){var n={width:e,height:r,aspectratio:e/r},a=!0;return I(t,function(i,o){var s=o.match(YA);if(!(!s||!s[1]||!s[2])){var l=s[1],c=s[2].toLowerCase();jA(n[c],i,l)||(a=!1)}}),a}function jA(t,e,r){return r==="min"?t>=e:r==="max"?t<=e:t===e}function JA(t,e){return t.join(",")===e.join(",")}var Or=I,Yo=de,Q0=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function hh(t){var e=t&&t.itemStyle;if(e)for(var r=0,n=Q0.length;r<n;r++){var a=Q0[r],i=e.normal,o=e.emphasis;i&&i[a]&&(t[a]=t[a]||{},t[a].normal?Oe(t[a].normal,i[a]):t[a].normal=i[a],i[a]=null),o&&o[a]&&(t[a]=t[a]||{},t[a].emphasis?Oe(t[a].emphasis,o[a]):t[a].emphasis=o[a],o[a]=null)}}function Dt(t,e,r){if(t&&t[e]&&(t[e].normal||t[e].emphasis)){var n=t[e].normal,a=t[e].emphasis;n&&(r?(t[e].normal=t[e].emphasis=null,He(t[e],n)):t[e]=n),a&&(t.emphasis=t.emphasis||{},t.emphasis[e]=a,a.focus&&(t.emphasis.focus=a.focus),a.blurScope&&(t.emphasis.blurScope=a.blurScope))}}function Xo(t){Dt(t,"itemStyle"),Dt(t,"lineStyle"),Dt(t,"areaStyle"),Dt(t,"label"),Dt(t,"labelLine"),Dt(t,"upperLabel"),Dt(t,"edgeLabel")}function pt(t,e){var r=Yo(t)&&t[e],n=Yo(r)&&r.textStyle;if(n)for(var a=0,i=Pg.length;a<i;a++){var o=Pg[a];n.hasOwnProperty(o)&&(r[o]=n[o])}}function xr(t){t&&(Xo(t),pt(t,"label"),t.emphasis&&pt(t.emphasis,"label"))}function QA(t){if(Yo(t)){hh(t),Xo(t),pt(t,"label"),pt(t,"upperLabel"),pt(t,"edgeLabel"),t.emphasis&&(pt(t.emphasis,"label"),pt(t.emphasis,"upperLabel"),pt(t.emphasis,"edgeLabel"));var e=t.markPoint;e&&(hh(e),xr(e));var r=t.markLine;r&&(hh(r),xr(r));var n=t.markArea;n&&xr(n);var a=t.data;if(t.type==="graph"){a=a||t.nodes;var i=t.links||t.edges;if(i&&!Ut(i))for(var o=0;o<i.length;o++)xr(i[o]);I(t.categories,function(c){Xo(c)})}if(a&&!Ut(a))for(var o=0;o<a.length;o++)xr(a[o]);if(e=t.markPoint,e&&e.data)for(var s=e.data,o=0;o<s.length;o++)xr(s[o]);if(r=t.markLine,r&&r.data)for(var l=r.data,o=0;o<l.length;o++)ee(l[o])?(xr(l[o][0]),xr(l[o][1])):xr(l[o]);t.type==="gauge"?(pt(t,"axisLabel"),pt(t,"title"),pt(t,"detail")):t.type==="treemap"?(Dt(t.breadcrumb,"itemStyle"),I(t.levels,function(c){Xo(c)})):t.type==="tree"&&Xo(t.leaves)}}function Sn(t){return ee(t)?t:t?[t]:[]}function e_(t){return(ee(t)?t[0]:t)||{}}function eD(t,e){Or(Sn(t.series),function(n){Yo(n)&&QA(n)});var r=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","parallelAxis","radar"];e&&r.push("valueAxis","categoryAxis","logAxis","timeAxis"),Or(r,function(n){Or(Sn(t[n]),function(a){a&&(pt(a,"axisLabel"),pt(a.axisPointer,"label"))})}),Or(Sn(t.parallel),function(n){var a=n&&n.parallelAxisDefault;pt(a,"axisLabel"),pt(a&&a.axisPointer,"label")}),Or(Sn(t.calendar),function(n){Dt(n,"itemStyle"),pt(n,"dayLabel"),pt(n,"monthLabel"),pt(n,"yearLabel")}),Or(Sn(t.radar),function(n){pt(n,"name"),n.name&&n.axisName==null&&(n.axisName=n.name,delete n.name),n.nameGap!=null&&n.axisNameGap==null&&(n.axisNameGap=n.nameGap,delete n.nameGap)}),Or(Sn(t.geo),function(n){Yo(n)&&(xr(n),Or(Sn(n.regions),function(a){xr(a)}))}),Or(Sn(t.timeline),function(n){xr(n),Dt(n,"label"),Dt(n,"itemStyle"),Dt(n,"controlStyle",!0);var a=n.data;ee(a)&&I(a,function(i){de(i)&&(Dt(i,"label"),Dt(i,"itemStyle"))})}),Or(Sn(t.toolbox),function(n){Dt(n,"iconStyle"),Or(n.feature,function(a){Dt(a,"iconStyle")})}),pt(e_(t.axisPointer),"label"),pt(e_(t.tooltip).axisPointer,"label")}function tD(t,e){for(var r=e.split(","),n=t,a=0;a<r.length&&(n=n&&n[r[a]],n!=null);a++);return n}function rD(t,e,r,n){for(var a=e.split(","),i=t,o,s=0;s<a.length-1;s++)o=a[s],i[o]==null&&(i[o]={}),i=i[o];i[a[s]]==null&&(i[a[s]]=r)}function t_(t){t&&I(nD,function(e){e[0]in t&&!(e[1]in t)&&(t[e[1]]=t[e[0]])})}var nD=[["x","left"],["y","top"],["x2","right"],["y2","bottom"]],aD=["grid","geo","parallel","legend","toolbox","title","visualMap","dataZoom","timeline"],ph=[["borderRadius","barBorderRadius"],["borderColor","barBorderColor"],["borderWidth","barBorderWidth"]];function Zo(t){var e=t&&t.itemStyle;if(e)for(var r=0;r<ph.length;r++){var n=ph[r][1],a=ph[r][0];e[n]!=null&&(e[a]=e[n])}}function r_(t){t&&t.alignTo==="edge"&&t.margin!=null&&t.edgeDistance==null&&(t.edgeDistance=t.margin)}function n_(t){t&&t.downplay&&!t.blur&&(t.blur=t.downplay)}function iD(t){t&&t.focusNodeAdjacency!=null&&(t.emphasis=t.emphasis||{},t.emphasis.focus==null&&(t.emphasis.focus="adjacency"))}function a_(t,e){if(t)for(var r=0;r<t.length;r++)e(t[r]),t[r]&&a_(t[r].children,e)}function i_(t,e){eD(t,e),t.series=Mt(t.series),I(t.series,function(r){if(de(r)){var n=r.type;if(n==="line")r.clipOverflow!=null&&(r.clip=r.clipOverflow);else if(n==="pie"||n==="gauge"){r.clockWise!=null&&(r.clockwise=r.clockWise),r_(r.label);var a=r.data;if(a&&!Ut(a))for(var i=0;i<a.length;i++)r_(a[i]);r.hoverOffset!=null&&(r.emphasis=r.emphasis||{},(r.emphasis.scaleSize=null)&&(r.emphasis.scaleSize=r.hoverOffset))}else if(n==="gauge"){var o=tD(r,"pointer.color");o!=null&&rD(r,"itemStyle.color",o)}else if(n==="bar"){Zo(r),Zo(r.backgroundStyle),Zo(r.emphasis);var a=r.data;if(a&&!Ut(a))for(var i=0;i<a.length;i++)typeof a[i]=="object"&&(Zo(a[i]),Zo(a[i]&&a[i].emphasis))}else if(n==="sunburst"){var s=r.highlightPolicy;s&&(r.emphasis=r.emphasis||{},r.emphasis.focus||(r.emphasis.focus=s)),n_(r),a_(r.data,n_)}else n==="graph"||n==="sankey"?iD(r):n==="map"&&(r.mapType&&!r.map&&(r.map=r.mapType),r.mapLocation&&He(r,r.mapLocation));r.hoverAnimation!=null&&(r.emphasis=r.emphasis||{},r.emphasis&&r.emphasis.scale==null&&(r.emphasis.scale=r.hoverAnimation)),t_(r)}}),t.dataRange&&(t.visualMap=t.dataRange),I(aD,function(r){var n=t[r];n&&(ee(n)||(n=[n]),I(n,function(a){t_(a)}))})}function oD(t){var e=me();t.eachSeries(function(r){var n=r.get("stack");if(n){var a=e.get(n)||e.set(n,[]),i=r.getData(),o={stackResultDimension:i.getCalculationInfo("stackResultDimension"),stackedOverDimension:i.getCalculationInfo("stackedOverDimension"),stackedDimension:i.getCalculationInfo("stackedDimension"),stackedByDimension:i.getCalculationInfo("stackedByDimension"),isStackedByIndex:i.getCalculationInfo("isStackedByIndex"),data:i,seriesModel:r};if(!o.stackedDimension||!(o.isStackedByIndex||o.stackedByDimension))return;a.length&&i.setCalculationInfo("stackedOnSeries",a[a.length-1].seriesModel),a.push(o)}}),e.each(sD)}function sD(t){I(t,function(e,r){var n=[],a=[NaN,NaN],i=[e.stackResultDimension,e.stackedOverDimension],o=e.data,s=e.isStackedByIndex,l=e.seriesModel.get("stackStrategy")||"samesign";o.modify(i,function(c,u,f){var h=o.get(e.stackedDimension,f);if(isNaN(h))return a;var d,p;s?p=o.getRawIndex(f):d=o.get(e.stackedByDimension,f);for(var m=NaN,g=r-1;g>=0;g--){var v=t[g];if(s||(p=v.data.rawIndexOf(v.stackedByDimension,d)),p>=0){var y=v.data.getByRawIndex(v.stackResultDimension,p);if(l==="all"||l==="positive"&&y>0||l==="negative"&&y<0||l==="samesign"&&h>=0&&y>0||l==="samesign"&&h<=0&&y<0){h=Sk(h,y),m=y;break}}}return n[0]=h,n[1]=m,n})})}var Nr=(function(){function t(){this.group=new St,this.uid=rc("viewComponent")}return t.prototype.init=function(e,r){},t.prototype.render=function(e,r,n,a){},t.prototype.dispose=function(e,r){},t.prototype.updateView=function(e,r,n,a){},t.prototype.updateLayout=function(e,r,n,a){},t.prototype.updateVisual=function(e,r,n,a){},t.prototype.toggleBlurSeries=function(e,r,n){},t.prototype.eachRendered=function(e){var r=this.group;r&&r.traverse(e)},t})();zu(Nr),Zs(Nr);var o_=ht(),s_={itemStyle:oo(Im,!0),lineStyle:oo(Dm,!0)},lD={lineStyle:"stroke",itemStyle:"fill"};function l_(t,e){var r=t.visualStyleMapper||s_[e];return r||(console.warn("Unknown style type '"+e+"'."),s_.itemStyle)}function c_(t,e){var r=t.visualDrawType||lD[e];return r||(console.warn("Unknown style type '"+e+"'."),"fill")}var cD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var r=t.getData(),n=t.visualStyleAccessPath||"itemStyle",a=t.getModel(n),i=l_(t,n),o=i(a),s=a.getShallow("decal");s&&(r.setVisual("decal",s),s.dirty=!0);var l=c_(t,n),c=o[l],u=ke(c)?c:null,f=o.fill==="auto"||o.stroke==="auto";if(!o[l]||u||f){var h=t.getColorFromPalette(t.name,null,e.getSeriesCount());o[l]||(o[l]=h,r.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||ke(o.fill)?h:o.fill,o.stroke=o.stroke==="auto"||ke(o.stroke)?h:o.stroke}if(r.setVisual("style",o),r.setVisual("drawType",l),!e.isSeriesFiltered(t)&&u)return r.setVisual("colorFromPalette",!1),{dataEach:function(d,p){var m=t.getDataParams(p),g=q({},o);g[l]=u(m),d.setItemVisual(p,"style",g)}}}},Ko=new lt,uD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!(t.ignoreStyleOnData||e.isSeriesFiltered(t))){var r=t.getData(),n=t.visualStyleAccessPath||"itemStyle",a=l_(t,n),i=r.getVisual("drawType");return{dataEach:r.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[n]){Ko.option=l[n];var c=a(Ko),u=o.ensureUniqueItemVisual(s,"style");q(u,c),Ko.option.decal&&(o.setItemVisual(s,"decal",Ko.option.decal),Ko.option.decal.dirty=!0),i in c&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},fD={performRawSeries:!0,overallReset:function(t){var e=me();t.eachSeries(function(r){var n=r.getColorBy();if(!r.isColorBySeries()){var a=r.type+"-"+n,i=e.get(a);i||(i={},e.set(a,i)),o_(r).scope=i}}),t.eachSeries(function(r){if(!(r.isColorBySeries()||t.isSeriesFiltered(r))){var n=r.getRawData(),a={},i=r.getData(),o=o_(r).scope,s=r.visualStyleAccessPath||"itemStyle",l=c_(r,s);i.each(function(c){var u=i.getRawIndex(c);a[u]=c}),n.each(function(c){var u=a[c],f=i.getItemVisual(u,"colorFromPalette");if(f){var h=i.ensureUniqueItemVisual(u,"style"),d=n.getName(c)||c+"",p=n.count();h[l]=r.getColorFromPalette(d,o,p)}})}})}},Ac=Math.PI;function dD(t,e){e=e||{},He(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var r=new St,n=new _t({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});r.add(n);var a=new $t({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),i=new _t({style:{fill:"none"},textContent:a,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});r.add(i);var o;return e.showSpinner&&(o=new zl({shape:{startAngle:-Ac/2,endAngle:-Ac/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:Ac*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:Ac*3/2}).delay(300).start("circularInOut"),r.add(o)),r.resize=function(){var s=a.getBoundingRect().width,l=e.showSpinner?e.spinnerRadius:0,c=(t.getWidth()-l*2-(e.showSpinner&&s?10:0)-s)/2-(e.showSpinner&&s?0:5+s/2)+(e.showSpinner?0:s/2)+(s?0:l),u=t.getHeight()/2;e.showSpinner&&o.setShape({cx:c,cy:u}),i.setShape({x:c-l,y:u-l,width:l*2,height:l*2}),n.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},r.resize(),r}var u_=(function(){function t(e,r,n,a){this._stageTaskMap=me(),this.ecInstance=e,this.api=r,n=this._dataProcessorHandlers=n.slice(),a=this._visualHandlers=a.slice(),this._allHandlers=n.concat(a)}return t.prototype.restoreData=function(e,r){e.restoreData(r),this._stageTaskMap.each(function(n){var a=n.overallTask;a&&a.dirty()})},t.prototype.getPerformArgs=function(e,r){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),a=n.context,i=!r&&n.progressiveEnabled&&(!a||a.progressiveRender)&&e.__idxInPipeline>n.blockIndex,o=i?n.step:null,s=a&&a.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},t.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},t.prototype.updateStreamModes=function(e,r){var n=this._pipelineMap.get(e.uid),a=e.getData(),i=a.count(),o=n.progressiveEnabled&&r.incrementalPrepareRender&&i>=n.threshold,s=e.get("large")&&i>=e.get("largeThreshold"),l=e.get("progressiveChunkMode")==="mod"?i:null;e.pipelineContext=n.context={progressiveRender:o,modDataCount:l,large:s}},t.prototype.restorePipelines=function(e){var r=this,n=r._pipelineMap=me();e.eachSeries(function(a){var i=a.getProgressive(),o=a.uid;n.set(o,{id:o,head:null,tail:null,threshold:a.getProgressiveThreshold(),progressiveEnabled:i&&!(a.preventIncremental&&a.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),r._pipe(a,a.dataTask)})},t.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,r=this.api.getModel(),n=this.api;I(this._allHandlers,function(a){var i=e.get(a.uid)||e.set(a.uid,{}),o="";dn(!(a.reset&&a.overallReset),o),a.reset&&this._createSeriesStageTask(a,i,r,n),a.overallReset&&this._createOverallStageTask(a,i,r,n)},this)},t.prototype.prepareView=function(e,r,n,a){var i=e.renderTask,o=i.context;o.model=r,o.ecModel=n,o.api=a,i.__block=!e.incrementalPrepareRender,this._pipe(r,i)},t.prototype.performDataProcessorTasks=function(e,r){this._performStageTasks(this._dataProcessorHandlers,e,r,{block:!0})},t.prototype.performVisualTasks=function(e,r,n){this._performStageTasks(this._visualHandlers,e,r,n)},t.prototype._performStageTasks=function(e,r,n,a){a=a||{};var i=!1,o=this;I(e,function(l,c){if(!(a.visualType&&a.visualType!==l.visualType)){var u=o._stageTaskMap.get(l.uid),f=u.seriesTaskMap,h=u.overallTask;if(h){var d,p=h.agentStubMap;p.each(function(g){s(a,g)&&(g.dirty(),d=!0)}),d&&h.dirty(),o.updatePayload(h,n);var m=o.getPerformArgs(h,a.block);p.each(function(g){g.perform(m)}),h.perform(m)&&(i=!0)}else f&&f.each(function(g,v){s(a,g)&&g.dirty();var y=o.getPerformArgs(g,a.block);y.skip=!l.performRawSeries&&r.isSeriesFiltered(g.context.model),o.updatePayload(g,n),g.perform(y)&&(i=!0)})}});function s(l,c){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(c.__pipeline.id))}this.unfinished=i||this.unfinished},t.prototype.performSeriesTasks=function(e){var r;e.eachSeries(function(n){r=n.dataTask.perform()||r}),this.unfinished=r||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each(function(e){var r=e.tail;do{if(r.__block){e.blockIndex=r.__idxInPipeline;break}r=r.getUpstream()}while(r)})},t.prototype.updatePayload=function(e,r){r!=="remain"&&(e.context.payload=r)},t.prototype._createSeriesStageTask=function(e,r,n,a){var i=this,o=r.seriesTaskMap,s=r.seriesTaskMap=me(),l=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(u):l?n.eachRawSeriesByType(l,u):c&&c(n,a).each(u);function u(f){var h=f.uid,d=s.set(h,o&&o.get(h)||Uo({plan:mD,reset:yD,count:bD}));d.context={model:f,ecModel:n,api:a,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(f,d)}},t.prototype._createOverallStageTask=function(e,r,n,a){var i=this,o=r.overallTask=r.overallTask||Uo({reset:hD});o.context={ecModel:n,api:a,overallReset:e.overallReset,scheduler:i};var s=o.agentStubMap,l=o.agentStubMap=me(),c=e.seriesType,u=e.getTargetSeries,f=!0,h=!1,d="";dn(!e.createOnAllSeries,d),c?n.eachRawSeriesByType(c,p):u?u(n,a).each(p):(f=!1,I(n.getSeries(),p));function p(m){var g=m.uid,v=l.set(g,s&&s.get(g)||(h=!0,Uo({reset:pD,onDirty:gD})));v.context={model:m,overallProgress:f},v.agent=o,v.__block=f,i._pipe(m,v)}h&&o.dirty()},t.prototype._pipe=function(e,r){var n=e.uid,a=this._pipelineMap.get(n);!a.head&&(a.head=r),a.tail&&a.tail.pipe(r),a.tail=r,r.__idxInPipeline=a.count++,r.__pipeline=a},t.wrapStageHandler=function(e,r){return ke(e)&&(e={overallReset:e,seriesType:xD(e)}),e.uid=rc("stageHandler"),r&&(e.visualType=r),e},t})();function hD(t){t.overallReset(t.ecModel,t.api,t.payload)}function pD(t){return t.overallProgress&&vD}function vD(){this.agent.dirty(),this.getDownstream().dirty()}function gD(){this.agent&&this.agent.dirty()}function mD(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function yD(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=Mt(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?he(e,function(r,n){return f_(n)}):_D}var _D=f_(0);function f_(t){return function(e,r){var n=r.data,a=r.resetDefines[t];if(a&&a.dataEach)for(var i=e.start;i<e.end;i++)a.dataEach(n,i);else a&&a.progress&&a.progress(e,n)}}function bD(t){return t.data.count()}function xD(t){Dc=null;try{t(jo,d_)}catch{}return Dc}var jo={},d_={},Dc;h_(jo,dh),h_(d_,J0),jo.eachSeriesByType=jo.eachRawSeriesByType=function(t){Dc=t},jo.eachComponent=function(t){t.mainType==="series"&&t.subType&&(Dc=t.subType)};function h_(t,e){for(var r in e.prototype)t[r]=Et}var p_=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"];const wD={color:p_,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],p_]};var It="#B9B8CE",v_="#100C2A",Ic=function(){return{axisLine:{lineStyle:{color:It}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},g_=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],m_={darkMode:!0,color:g_,backgroundColor:v_,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:It},pageTextStyle:{color:It}},textStyle:{color:It},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:It}},dataZoom:{borderColor:"#71708A",textStyle:{color:It},brushStyle:{color:"rgba(135,163,206,0.3)"},handleStyle:{color:"#353450",borderColor:"#C5CBE3"},moveHandleStyle:{color:"#B0B6C3",opacity:.3},fillerColor:"rgba(135,163,206,0.2)",emphasis:{handleStyle:{borderColor:"#91B7F2",color:"#4D587D"},moveHandleStyle:{color:"#636D9A",opacity:.7}},dataBackground:{lineStyle:{color:"#71708A",width:1},areaStyle:{color:"#71708A"}},selectedDataBackground:{lineStyle:{color:"#87A3CE"},areaStyle:{color:"#87A3CE"}}},visualMap:{textStyle:{color:It}},timeline:{lineStyle:{color:It},label:{color:It},controlStyle:{color:It,borderColor:It}},calendar:{itemStyle:{color:v_},dayLabel:{color:It},monthLabel:{color:It},yearLabel:{color:It}},timeAxis:Ic(),logAxis:Ic(),valueAxis:Ic(),categoryAxis:Ic(),line:{symbol:"circle"},graph:{color:g_},gauge:{title:{color:It},axisLine:{lineStyle:{color:[[1,"rgba(207,212,219,0.2)"]]}},axisLabel:{color:It},detail:{color:"#EEF1FA"}},candlestick:{itemStyle:{color:"#f64e56",color0:"#54ea92",borderColor:"#f64e56",borderColor0:"#54ea92"}}};m_.categoryAxis.splitLine.show=!1;var SD=(function(){function t(){}return t.prototype.normalizeQuery=function(e){var r={},n={},a={};if(ae(e)){var i=$r(e);r.mainType=i.main||null,r.subType=i.sub||null}else{var o=["Index","Name","Id"],s={name:1,dataIndex:1,dataType:1};I(e,function(l,c){for(var u=!1,f=0;f<o.length;f++){var h=o[f],d=c.lastIndexOf(h);if(d>0&&d===c.length-h.length){var p=c.slice(0,d);p!=="data"&&(r.mainType=p,r[h.toLowerCase()]=l,u=!0)}}s.hasOwnProperty(c)&&(n[c]=l,u=!0),u||(a[c]=l)})}return{cptQuery:r,dataQuery:n,otherQuery:a}},t.prototype.filter=function(e,r){var n=this.eventInfo;if(!n)return!0;var a=n.targetEl,i=n.packedEvent,o=n.model,s=n.view;if(!o||!s)return!0;var l=r.cptQuery,c=r.dataQuery;return u(l,o,"mainType")&&u(l,o,"subType")&&u(l,o,"index","componentIndex")&&u(l,o,"name")&&u(l,o,"id")&&u(c,i,"name")&&u(c,i,"dataIndex")&&u(c,i,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(e,r.otherQuery,a,i));function u(f,h,d,p){return f[d]==null||h[p||d]===f[d]}},t.prototype.afterTrigger=function(){this.eventInfo=null},t})(),vh=["symbol","symbolSize","symbolRotate","symbolOffset"],y_=vh.concat(["symbolKeepAspect"]),kD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var r=t.getData();if(t.legendIcon&&r.setVisual("legendIcon",t.legendIcon),!t.hasSymbolVisual)return;for(var n={},a={},i=!1,o=0;o<vh.length;o++){var s=vh[o],l=t.get(s);ke(l)?(i=!0,a[s]=l):n[s]=l}if(n.symbol=n.symbol||t.defaultSymbol,r.setVisual(q({legendIcon:t.legendIcon||n.symbol,symbolKeepAspect:t.get("symbolKeepAspect")},n)),e.isSeriesFiltered(t))return;var c=at(a);function u(f,h){for(var d=t.getRawValue(h),p=t.getDataParams(h),m=0;m<c.length;m++){var g=c[m];f.setItemVisual(h,g,a[g](d,p))}}return{dataEach:i?u:null}}},TD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.hasSymbolVisual||e.isSeriesFiltered(t))return;var r=t.getData();function n(a,i){for(var o=a.getItemModel(i),s=0;s<y_.length;s++){var l=y_[s],c=o.getShallow(l,!0);c!=null&&a.setItemVisual(i,l,c)}}return{dataEach:r.hasItemOption?n:null}}};function CD(t,e,r){switch(r){case"color":var n=t.getItemVisual(e,"style");return n[t.getVisual("drawType")];case"opacity":return t.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getItemVisual(e,r)}}function MD(t,e){switch(e){case"color":var r=t.getVisual("style");return r[t.getVisual("drawType")];case"opacity":return t.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getVisual(e)}}function Jo(t,e,r){for(var n;t&&!(e(t)&&(n=t,r));)t=t.__hostTarget||t.parent;return n}var AD=Math.round(Math.random()*9),DD=typeof Object.defineProperty=="function",ID=(function(){function t(){this._id="__ec_inner_"+AD++}return t.prototype.get=function(e){return this._guard(e)[this._id]},t.prototype.set=function(e,r){var n=this._guard(e);return DD?Object.defineProperty(n,this._id,{value:r,enumerable:!1,configurable:!0}):n[this._id]=r,this},t.prototype.delete=function(e){return this.has(e)?(delete this._guard(e)[this._id],!0):!1},t.prototype.has=function(e){return!!this._guard(e)[this._id]},t.prototype._guard=function(e){if(e!==Object(e))throw TypeError("Value of WeakMap is not a non-null object.");return e},t})();function Ba(t){return isFinite(t)}function LD(t,e,r){var n=e.x==null?0:e.x,a=e.x2==null?1:e.x2,i=e.y==null?0:e.y,o=e.y2==null?0:e.y2;e.global||(n=n*r.width+r.x,a=a*r.width+r.x,i=i*r.height+r.y,o=o*r.height+r.y),n=Ba(n)?n:0,a=Ba(a)?a:1,i=Ba(i)?i:0,o=Ba(o)?o:0;var s=t.createLinearGradient(n,i,a,o);return s}function PD(t,e,r){var n=r.width,a=r.height,i=Math.min(n,a),o=e.x==null?.5:e.x,s=e.y==null?.5:e.y,l=e.r==null?.5:e.r;e.global||(o=o*n+r.x,s=s*a+r.y,l=l*i),o=Ba(o)?o:.5,s=Ba(s)?s:.5,l=l>=0&&Ba(l)?l:.5;var c=t.createRadialGradient(o,s,0,o,s,l);return c}function gh(t,e,r){for(var n=e.type==="radial"?PD(t,e,r):LD(t,e,r),a=e.colorStops,i=0;i<a.length;i++)n.addColorStop(a[i].offset,a[i].color);return n}function RD(t,e){if(t===e||!t&&!e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!0;return!1}function Lc(t){return parseInt(t,10)}function Pc(t,e,r){var n=["width","height"][e],a=["clientWidth","clientHeight"][e],i=["paddingLeft","paddingTop"][e],o=["paddingRight","paddingBottom"][e];if(r[n]!=null&&r[n]!=="auto")return parseFloat(r[n]);var s=document.defaultView.getComputedStyle(t);return(t[a]||Lc(s[n])||Lc(t.style[n]))-(Lc(s[i])||0)-(Lc(s[o])||0)|0}function ED(t,e){return!t||t==="solid"||!(e>0)?null:t==="dashed"?[4*e,2*e]:t==="dotted"?[e]:et(t)?[t]:ee(t)?t:null}function __(t){var e=t.style,r=e.lineDash&&e.lineWidth>0&&ED(e.lineDash,e.lineWidth),n=e.lineDashOffset;if(r){var a=e.strokeNoScale&&t.getLineScale?t.getLineScale():1;a&&a!==1&&(r=he(r,function(i){return i/a}),n/=a)}return[r,n]}var OD=new wa(!0);function Rc(t){var e=t.stroke;return!(e==null||e==="none"||!(t.lineWidth>0))}function b_(t){return typeof t=="string"&&t!=="none"}function Ec(t){var e=t.fill;return e!=null&&e!=="none"}function x_(t,e){if(e.fillOpacity!=null&&e.fillOpacity!==1){var r=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=r}else t.fill()}function w_(t,e){if(e.strokeOpacity!=null&&e.strokeOpacity!==1){var r=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=r}else t.stroke()}function mh(t,e,r){var n=Cv(e.image,e.__image,r);if(Ks(n)){var a=t.createPattern(n,e.repeat||"repeat");if(typeof DOMMatrix=="function"&&a&&a.setTransform){var i=new DOMMatrix;i.translateSelf(e.x||0,e.y||0),i.rotateSelf(0,0,(e.rotation||0)*Fw),i.scaleSelf(e.scaleX||1,e.scaleY||1),a.setTransform(i)}return a}}function ND(t,e,r,n){var a,i=Rc(r),o=Ec(r),s=r.strokePercent,l=s<1,c=!e.path;(!e.silent||l)&&c&&e.createPathProxy();var u=e.path||OD,f=e.__dirty;if(!n){var h=r.fill,d=r.stroke,p=o&&!!h.colorStops,m=i&&!!d.colorStops,g=o&&!!h.image,v=i&&!!d.image,y=void 0,b=void 0,x=void 0,w=void 0,S=void 0;(p||m)&&(S=e.getBoundingRect()),p&&(y=f?gh(t,h,S):e.__canvasFillGradient,e.__canvasFillGradient=y),m&&(b=f?gh(t,d,S):e.__canvasStrokeGradient,e.__canvasStrokeGradient=b),g&&(x=f||!e.__canvasFillPattern?mh(t,h,e):e.__canvasFillPattern,e.__canvasFillPattern=x),v&&(w=f||!e.__canvasStrokePattern?mh(t,d,e):e.__canvasStrokePattern,e.__canvasStrokePattern=x),p?t.fillStyle=y:g&&(x?t.fillStyle=x:o=!1),m?t.strokeStyle=b:v&&(w?t.strokeStyle=w:i=!1)}var k=e.getGlobalScale();u.setScale(k[0],k[1],e.segmentIgnoreThreshold);var C,A;t.setLineDash&&r.lineDash&&(a=__(e),C=a[0],A=a[1]);var M=!0;(c||f&pi)&&(u.setDPR(t.dpr),l?u.setContext(null):(u.setContext(t),M=!1),u.reset(),e.buildPath(u,e.shape,n),u.toStatic(),e.pathUpdated()),M&&u.rebuildPath(t,l?s:1),C&&(t.setLineDash(C),t.lineDashOffset=A),n||(r.strokeFirst?(i&&w_(t,r),o&&x_(t,r)):(o&&x_(t,r),i&&w_(t,r))),C&&t.setLineDash([])}function BD(t,e,r){var n=e.__image=Cv(r.image,e.__image,e,e.onload);if(!(!n||!Ks(n))){var a=r.x||0,i=r.y||0,o=e.getWidth(),s=e.getHeight(),l=n.width/n.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=n.width,s=n.height),r.sWidth&&r.sHeight){var c=r.sx||0,u=r.sy||0;t.drawImage(n,c,u,r.sWidth,r.sHeight,a,i,o,s)}else if(r.sx&&r.sy){var c=r.sx,u=r.sy,f=o-c,h=s-u;t.drawImage(n,c,u,f,h,a,i,o,s)}else t.drawImage(n,a,i,o,s)}}function zD(t,e,r){var n,a=r.text;if(a!=null&&(a+=""),a){t.font=r.font||sa,t.textAlign=r.textAlign,t.textBaseline=r.textBaseline;var i=void 0,o=void 0;t.setLineDash&&r.lineDash&&(n=__(e),i=n[0],o=n[1]),i&&(t.setLineDash(i),t.lineDashOffset=o),r.strokeFirst?(Rc(r)&&t.strokeText(a,r.x,r.y),Ec(r)&&t.fillText(a,r.x,r.y)):(Ec(r)&&t.fillText(a,r.x,r.y),Rc(r)&&t.strokeText(a,r.x,r.y)),i&&t.setLineDash([])}}var S_=["shadowBlur","shadowOffsetX","shadowOffsetY"],k_=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function T_(t,e,r,n,a){var i=!1;if(!n&&(r=r||{},e===r))return!1;if(n||e.opacity!==r.opacity){Kt(t,a),i=!0;var o=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(o)?ga.opacity:o}(n||e.blend!==r.blend)&&(i||(Kt(t,a),i=!0),t.globalCompositeOperation=e.blend||ga.blend);for(var s=0;s<S_.length;s++){var l=S_[s];(n||e[l]!==r[l])&&(i||(Kt(t,a),i=!0),t[l]=t.dpr*(e[l]||0))}return(n||e.shadowColor!==r.shadowColor)&&(i||(Kt(t,a),i=!0),t.shadowColor=e.shadowColor||ga.shadowColor),i}function C_(t,e,r,n,a){var i=Qo(e,a.inHover),o=n?null:r&&Qo(r,a.inHover)||{};if(i===o)return!1;var s=T_(t,i,o,n,a);if((n||i.fill!==o.fill)&&(s||(Kt(t,a),s=!0),b_(i.fill)&&(t.fillStyle=i.fill)),(n||i.stroke!==o.stroke)&&(s||(Kt(t,a),s=!0),b_(i.stroke)&&(t.strokeStyle=i.stroke)),(n||i.opacity!==o.opacity)&&(s||(Kt(t,a),s=!0),t.globalAlpha=i.opacity==null?1:i.opacity),e.hasStroke()){var l=i.lineWidth,c=l/(i.strokeNoScale&&e.getLineScale?e.getLineScale():1);t.lineWidth!==c&&(s||(Kt(t,a),s=!0),t.lineWidth=c)}for(var u=0;u<k_.length;u++){var f=k_[u],h=f[0];(n||i[h]!==o[h])&&(s||(Kt(t,a),s=!0),t[h]=i[h]||f[1])}return s}function FD(t,e,r,n,a){return T_(t,Qo(e,a.inHover),r&&Qo(r,a.inHover),n,a)}function M_(t,e){var r=e.transform,n=t.dpr||1;r?t.setTransform(n*r[0],n*r[1],n*r[2],n*r[3],n*r[4],n*r[5]):t.setTransform(n,0,0,n,0,0)}function HD(t,e,r){for(var n=!1,a=0;a<t.length;a++){var i=t[a];n=n||i.isZeroArea(),M_(e,i),e.beginPath(),i.buildPath(e,i.shape),e.clip()}r.allClipped=n}function VD(t,e){return t&&e?t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||t[4]!==e[4]||t[5]!==e[5]:!(!t&&!e)}var A_=1,D_=2,I_=3,L_=4;function UD(t){var e=Ec(t),r=Rc(t);return!(t.lineDash||!(+e^+r)||e&&typeof t.fill!="string"||r&&typeof t.stroke!="string"||t.strokePercent<1||t.strokeOpacity<1||t.fillOpacity<1)}function Kt(t,e){e.batchFill&&t.fill(),e.batchStroke&&t.stroke(),e.batchFill="",e.batchStroke=""}function Qo(t,e){return e&&t.__hoverStyle||t.style}function P_(t,e){za(t,e,{inHover:!1,viewWidth:0,viewHeight:0},!0)}function za(t,e,r,n){var a=e.transform;if(!e.shouldBePainted(r.viewWidth,r.viewHeight,!1,!1)){e.__dirty&=~ir,e.__isRendered=!1;return}var i=e.__clipPaths,o=r.prevElClipPaths,s=!1,l=!1;if((!o||RD(i,o))&&(o&&o.length&&(Kt(t,r),t.restore(),l=s=!0,r.prevElClipPaths=null,r.allClipped=!1,r.prevEl=null),i&&i.length&&(Kt(t,r),t.save(),HD(i,t,r),s=!0),r.prevElClipPaths=i),r.allClipped){e.__isRendered=!1;return}e.beforeBrush&&e.beforeBrush(),e.innerBeforeBrush();var c=r.prevEl;c||(l=s=!0);var u=e instanceof qe&&e.autoBatch&&UD(e.style);s||VD(a,c.transform)?(Kt(t,r),M_(t,e)):u||Kt(t,r);var f=Qo(e,r.inHover);e instanceof qe?(r.lastDrawType!==A_&&(l=!0,r.lastDrawType=A_),C_(t,e,c,l,r),(!u||!r.batchFill&&!r.batchStroke)&&t.beginPath(),ND(t,e,f,u),u&&(r.batchFill=f.fill||"",r.batchStroke=f.stroke||"")):e instanceof Sl?(r.lastDrawType!==I_&&(l=!0,r.lastDrawType=I_),C_(t,e,c,l,r),zD(t,e,f)):e instanceof Fn?(r.lastDrawType!==D_&&(l=!0,r.lastDrawType=D_),FD(t,e,c,l,r),BD(t,e,f)):e.getTemporalDisplayables&&(r.lastDrawType!==L_&&(l=!0,r.lastDrawType=L_),GD(t,e,r)),u&&n&&Kt(t,r),e.innerAfterBrush(),e.afterBrush&&e.afterBrush(),r.prevEl=e,e.__dirty=0,e.__isRendered=!0}function GD(t,e,r){var n=e.getDisplayables(),a=e.getTemporalDisplayables();t.save();var i={prevElClipPaths:null,prevEl:null,allClipped:!1,viewWidth:r.viewWidth,viewHeight:r.viewHeight,inHover:r.inHover},o,s;for(o=e.getCursor(),s=n.length;o<s;o++){var l=n[o];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),za(t,l,i,o===s-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),i.prevEl=l}for(var c=0,u=a.length;c<u;c++){var l=a[c];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),za(t,l,i,c===u-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),i.prevEl=l}e.clearTemporalDisplayables(),e.notClear=!0,t.restore()}var yh=new ID,R_=new so(100),E_=["symbol","symbolSize","symbolKeepAspect","color","backgroundColor","dashArrayX","dashArrayY","maxTileWidth","maxTileHeight"];function _h(t,e){if(t==="none")return null;var r=e.getDevicePixelRatio(),n=e.getZr(),a=n.painter.type==="svg";t.dirty&&yh.delete(t);var i=yh.get(t);if(i)return i;var o=He(t,{symbol:"rect",symbolSize:1,symbolKeepAspect:!0,color:"rgba(0, 0, 0, 0.2)",backgroundColor:null,dashArrayX:5,dashArrayY:5,rotation:0,maxTileWidth:512,maxTileHeight:512});o.backgroundColor==="none"&&(o.backgroundColor=null);var s={repeat:"repeat"};return l(s),s.rotation=o.rotation,s.scaleX=s.scaleY=a?1:1/r,yh.set(t,s),t.dirty=!1,s;function l(c){for(var u=[r],f=!0,h=0;h<E_.length;++h){var d=o[E_[h]];if(d!=null&&!ee(d)&&!ae(d)&&!et(d)&&typeof d!="boolean"){f=!1;break}u.push(d)}var p;if(f){p=u.join(",")+(a?"-svg":"");var m=R_.get(p);m&&(a?c.svgElement=m:c.image=m)}var g=N_(o.dashArrayX),v=$D(o.dashArrayY),y=O_(o.symbol),b=WD(g),x=B_(v),w=!a&&ri.createCanvas(),S=a&&{tag:"g",attrs:{},key:"dcl",children:[]},k=A(),C;w&&(w.width=k.width*r,w.height=k.height*r,C=w.getContext("2d")),M(),f&&R_.put(p,w||S),c.image=w,c.svgElement=S,c.svgWidth=k.width,c.svgHeight=k.height;function A(){for(var T=1,D=0,L=b.length;D<L;++D)T=Ag(T,b[D]);for(var R=1,D=0,L=y.length;D<L;++D)R=Ag(R,y[D].length);T*=R;var O=x*b.length*y.length;return{width:Math.max(1,Math.min(T,o.maxTileWidth)),height:Math.max(1,Math.min(O,o.maxTileHeight))}}function M(){C&&(C.clearRect(0,0,w.width,w.height),o.backgroundColor&&(C.fillStyle=o.backgroundColor,C.fillRect(0,0,w.width,w.height)));for(var T=0,D=0;D<v.length;++D)T+=v[D];if(T<=0)return;for(var L=-x,R=0,O=0,B=0;L<k.height;){if(R%2===0){for(var j=O/2%y.length,P=0,V=0,H=0;P<k.width*2;){for(var Z=0,D=0;D<g[B].length;++D)Z+=g[B][D];if(Z<=0)break;if(V%2===0){var re=(1-o.symbolSize)*.5,Te=P+g[B][V]*re,ge=L+v[R]*re,xe=g[B][V]*o.symbolSize,Ce=v[R]*o.symbolSize,be=H/2%y[j].length;it(Te,ge,xe,Ce,y[j][be])}P+=g[B][V],++H,++V,V===g[B].length&&(V=0)}++B,B===g.length&&(B=0)}L+=v[R],++O,++R,R===v.length&&(R=0)}function it(Qe,ze,oe,pe,ot){var Xe=a?1:r,kt=Ri(ot,Qe*Xe,ze*Xe,oe*Xe,pe*Xe,o.color,o.symbolKeepAspect);if(a){var tt=n.painter.renderOneToVNode(kt);tt&&S.children.push(tt)}else P_(C,kt)}}}}function O_(t){if(!t||t.length===0)return[["rect"]];if(ae(t))return[[t]];for(var e=!0,r=0;r<t.length;++r)if(!ae(t[r])){e=!1;break}if(e)return O_([t]);for(var n=[],r=0;r<t.length;++r)ae(t[r])?n.push([t[r]]):n.push(t[r]);return n}function N_(t){if(!t||t.length===0)return[[0,0]];if(et(t)){var e=Math.ceil(t);return[[e,e]]}for(var r=!0,n=0;n<t.length;++n)if(!et(t[n])){r=!1;break}if(r)return N_([t]);for(var a=[],n=0;n<t.length;++n)if(et(t[n])){var e=Math.ceil(t[n]);a.push([e,e])}else{var e=he(t[n],function(s){return Math.ceil(s)});e.length%2===1?a.push(e.concat(e)):a.push(e)}return a}function $D(t){if(!t||typeof t=="object"&&t.length===0)return[0,0];if(et(t)){var e=Math.ceil(t);return[e,e]}var r=he(t,function(n){return Math.ceil(n)});return t.length%2?r.concat(r):r}function WD(t){return he(t,function(e){return B_(e)})}function B_(t){for(var e=0,r=0;r<t.length;++r)e+=t[r];return t.length%2===1?e*2:e}function qD(t,e){t.eachRawSeries(function(r){if(!t.isSeriesFiltered(r)){var n=r.getData();n.hasItemVisual()&&n.each(function(o){var s=n.getItemVisual(o,"decal");if(s){var l=n.ensureUniqueItemVisual(o,"style");l.decal=_h(s,e)}});var a=n.getVisual("decal");if(a){var i=n.getVisual("style");i.decal=_h(a,e)}}})}var Br=new Ir,z_={};function YD(t,e){z_[t]=e}function XD(t){return z_[t]}var ZD=1,KD=800,jD=900,JD=1e3,QD=2e3,eI=5e3,F_=1e3,tI=1100,bh=2e3,H_=3e3,rI=4e3,Oc=4500,nI=4600,aI=5e3,iI=6e3,V_=7e3,oI={PROCESSOR:{FILTER:JD,SERIES_FILTER:KD,STATISTIC:eI},VISUAL:{LAYOUT:F_,PROGRESSIVE_LAYOUT:tI,GLOBAL:bh,CHART:H_,POST_CHART_LAYOUT:nI,COMPONENT:rI,BRUSH:aI,CHART_ITEM:Oc,ARIA:iI,DECAL:V_}},Lt="__flagInMainProcess",jt="__pendingUpdate",xh="__needsUpdateStatus",U_=/^[a-zA-Z0-9_]+$/,wh="__connectUpdateStatus",G_=0,sI=1,lI=2;function $_(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this.isDisposed()){this.id;return}return q_(this,t,e)}}function W_(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return q_(this,t,e)}}function q_(t,e,r){return r[0]=r[0]&&r[0].toLowerCase(),Ir.prototype[e].apply(t,r)}var Y_=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(Ir),X_=Y_.prototype;X_.on=W_("on"),X_.off=W_("off");var zi,Sh,Nc,Xn,kh,Th,Ch,es,ts,Z_,K_,Mh,j_,Bc,J_,Q_,wr,eb,tb=(function(t){K(e,t);function e(r,n,a){var i=t.call(this,new SD)||this;i._chartsViews=[],i._chartsMap={},i._componentsViews=[],i._componentsMap={},i._pendingActions=[],a=a||{},ae(n)&&(n=rb[n]),i._dom=r;var o="canvas",s="auto",l=!1;a.ssr;var c=i._zr=W0(r,{renderer:a.renderer||o,devicePixelRatio:a.devicePixelRatio,width:a.width,height:a.height,ssr:a.ssr,useDirtyRect:Pe(a.useDirtyRect,l),useCoarsePointer:Pe(a.useCoarsePointer,s),pointerSize:a.pointerSize});i._ssr=a.ssr,i._throttledZrFlush=Yd(Ne(c.flush,c),17),n=Ie(n),n&&i_(n,!0),i._theme=n,i._locale=cC(a.locale||uy),i._coordSysMgr=new gd;var u=i._api=J_(i);function f(h,d){return h.__prio-d.__prio}return Sc(Fc,f),Sc(Dh,f),i._scheduler=new u_(i,u,Dh,Fc),i._messageCenter=new Y_,i._initEvents(),i.resize=Ne(i.resize,i),c.animation.on("frame",i._onframe,i),Z_(c,i),K_(c,i),Bu(i),i}return e.prototype._onframe=function(){if(!this._disposed){eb(this);var r=this._scheduler;if(this[jt]){var n=this[jt].silent;this[Lt]=!0;try{zi(this),Xn.update.call(this,null,this[jt].updateParams)}catch(l){throw this[Lt]=!1,this[jt]=null,l}this._zr.flush(),this[Lt]=!1,this[jt]=null,es.call(this,n),ts.call(this,n)}else if(r.unfinished){var a=ZD,i=this._model,o=this._api;r.unfinished=!1;do{var s=+new Date;r.performSeriesTasks(i),r.performDataProcessorTasks(i),Th(this,i),r.performVisualTasks(i),Bc(this,this._model,o,"remain",{}),a-=+new Date-s}while(a>0&&r.unfinished);r.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(r,n,a){if(!this[Lt]){if(this._disposed){this.id;return}var i,o,s;if(de(n)&&(a=n.lazyUpdate,i=n.silent,o=n.replaceMerge,s=n.transition,n=n.notMerge),this[Lt]=!0,!this._model||n){var l=new XA(this._api),c=this._theme,u=this._model=new dh;u.scheduler=this._scheduler,u.ssr=this._ssr,u.init(null,null,null,c,this._locale,l)}this._model.setOption(r,{replaceMerge:o},Ih);var f={seriesTransition:s,optionChanged:!0};if(a)this[jt]={silent:i,updateParams:f},this[Lt]=!1,this.getZr().wakeUp();else{try{zi(this),Xn.update.call(this,null,f)}catch(h){throw this[jt]=null,this[Lt]=!1,h}this._ssr||this._zr.flush(),this[jt]=null,this[Lt]=!1,es.call(this,i),ts.call(this,i)}}},e.prototype.setTheme=function(){},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||_e.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(r){return this.renderToCanvas(r)},e.prototype.renderToCanvas=function(r){r=r||{};var n=this._zr.painter;return n.getRenderedCanvas({backgroundColor:r.backgroundColor||this._model.get("backgroundColor"),pixelRatio:r.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(r){r=r||{};var n=this._zr.painter;return n.renderToString({useViewBox:r.useViewBox})},e.prototype.getSvgDataURL=function(){if(_e.svgSupported){var r=this._zr,n=r.storage.getDisplayList();return I(n,function(a){a.stopAnimation(null,!0)}),r.painter.toDataURL()}},e.prototype.getDataURL=function(r){if(this._disposed){this.id;return}r=r||{};var n=r.excludeComponents,a=this._model,i=[],o=this;I(n,function(l){a.eachComponent({mainType:l},function(c){var u=o._componentsMap[c.__viewId];u.group.ignore||(i.push(u),u.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(r).toDataURL("image/"+(r&&r.type||"png"));return I(i,function(l){l.group.ignore=!1}),s},e.prototype.getConnectedDataURL=function(r){if(this._disposed){this.id;return}var n=r.type==="svg",a=this.group,i=Math.min,o=Math.max,s=1/0;if(nb[a]){var l=s,c=s,u=-s,f=-s,h=[],d=r&&r.pixelRatio||this.getDevicePixelRatio();I(ns,function(b,x){if(b.group===a){var w=n?b.getZr().painter.getSvgDom().innerHTML:b.renderToCanvas(Ie(r)),S=b.getDom().getBoundingClientRect();l=i(S.left,l),c=i(S.top,c),u=o(S.right,u),f=o(S.bottom,f),h.push({dom:w,left:S.left,top:S.top})}}),l*=d,c*=d,u*=d,f*=d;var p=u-l,m=f-c,g=ri.createCanvas(),v=W0(g,{renderer:n?"svg":"canvas"});if(v.resize({width:p,height:m}),n){var y="";return I(h,function(b){var x=b.left-l,w=b.top-c;y+='<g transform="translate('+x+","+w+')">'+b.dom+"</g>"}),v.painter.getSvgRoot().innerHTML=y,r.connectedBackgroundColor&&v.painter.setBackgroundColor(r.connectedBackgroundColor),v.refreshImmediately(),v.painter.toDataURL()}else return r.connectedBackgroundColor&&v.add(new _t({shape:{x:0,y:0,width:p,height:m},style:{fill:r.connectedBackgroundColor}})),I(h,function(b){var x=new Fn({style:{x:b.left*d-l,y:b.top*d-c,image:b.dom}});v.add(x)}),v.refreshImmediately(),g.toDataURL("image/"+(r&&r.type||"png"))}else return this.getDataURL(r)},e.prototype.convertToPixel=function(r,n){return kh(this,"convertToPixel",r,n)},e.prototype.convertFromPixel=function(r,n){return kh(this,"convertFromPixel",r,n)},e.prototype.containPixel=function(r,n){if(this._disposed){this.id;return}var a=this._model,i,o=If(a,r);return I(o,function(s,l){l.indexOf("Models")>=0&&I(s,function(c){var u=c.coordinateSystem;if(u&&u.containPoint)i=i||!!u.containPoint(n);else if(l==="seriesModels"){var f=this._chartsMap[c.__viewId];f&&f.containPoint&&(i=i||f.containPoint(n,c))}},this)},this),!!i},e.prototype.getVisual=function(r,n){var a=this._model,i=If(a,r,{defaultMainType:"series"}),o=i.seriesModel,s=o.getData(),l=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?s.indexOfRawIndex(i.dataIndex):null;return l!=null?CD(s,l,n):MD(s,n)},e.prototype.getViewOfComponentModel=function(r){return this._componentsMap[r.__viewId]},e.prototype.getViewOfSeriesModel=function(r){return this._chartsMap[r.__viewId]},e.prototype._initEvents=function(){var r=this;I(cI,function(n){var a=function(i){var o=r.getModel(),s=i.target,l,c=n==="globalout";if(c?l={}:s&&Jo(s,function(p){var m=We(p);if(m&&m.dataIndex!=null){var g=m.dataModel||o.getSeriesByIndex(m.seriesIndex);return l=g&&g.getDataParams(m.dataIndex,m.dataType,s)||{},!0}else if(m.eventData)return l=q({},m.eventData),!0},!0),l){var u=l.componentType,f=l.componentIndex;(u==="markLine"||u==="markPoint"||u==="markArea")&&(u="series",f=l.seriesIndex);var h=u&&f!=null&&o.getComponent(u,f),d=h&&r[h.mainType==="series"?"_chartsMap":"_componentsMap"][h.__viewId];l.event=i,l.type=n,r._$eventProcessor.eventInfo={targetEl:s,packedEvent:l,model:h,view:d},r.trigger(n,l)}};a.zrEventfulCallAtLast=!0,r._zr.on(n,a,r)}),I(rs,function(n,a){r._messageCenter.on(a,function(i){this.trigger(a,i)},r)}),I(["selectchanged"],function(n){r._messageCenter.on(n,function(a){this.trigger(n,a)},r)}),lA(this._messageCenter,this,this._api)},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var r=this.getDom();r&&Eg(this.getDom(),Ph,"");var n=this,a=n._api,i=n._model;I(n._componentsViews,function(o){o.dispose(i,a)}),I(n._chartsViews,function(o){o.dispose(i,a)}),n._zr.dispose(),n._dom=n._model=n._chartsMap=n._componentsMap=n._chartsViews=n._componentsViews=n._scheduler=n._api=n._zr=n._throttledZrFlush=n._theme=n._coordSysMgr=n._messageCenter=null,delete ns[n.id]},e.prototype.resize=function(r){if(!this[Lt]){if(this._disposed){this.id;return}this._zr.resize(r);var n=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!n){var a=n.resetOption("media"),i=r&&r.silent;this[jt]&&(i==null&&(i=this[jt].silent),a=!0,this[jt]=null),this[Lt]=!0;try{a&&zi(this),Xn.update.call(this,{type:"resize",animation:q({duration:0},r&&r.animation)})}catch(o){throw this[Lt]=!1,o}this[Lt]=!1,es.call(this,i),ts.call(this,i)}}},e.prototype.showLoading=function(r,n){if(this._disposed){this.id;return}if(de(r)&&(n=r,r=""),r=r||"default",this.hideLoading(),!!Lh[r]){var a=Lh[r](this._api,n),i=this._zr;this._loadingFX=a,i.add(a)}},e.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},e.prototype.makeActionFromEvent=function(r){var n=q({},r);return n.type=rs[r.type],n},e.prototype.dispatchAction=function(r,n){if(this._disposed){this.id;return}if(de(n)||(n={silent:!!n}),!!zc[r.type]&&this._model){if(this[Lt]){this._pendingActions.push(r);return}var a=n.silent;Ch.call(this,r,a);var i=n.flush;i?this._zr.flush():i!==!1&&_e.browser.weChat&&this._throttledZrFlush(),es.call(this,a),ts.call(this,a)}},e.prototype.updateLabelLayout=function(){Br.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(r){if(this._disposed){this.id;return}var n=r.seriesIndex,a=this.getModel(),i=a.getSeriesByIndex(n);i.appendData(r),this._scheduler.unfinished=!0,this.getZr().wakeUp()},e.internalField=(function(){zi=function(f){var h=f._scheduler;h.restorePipelines(f._model),h.prepareStageTasks(),Sh(f,!0),Sh(f,!1),h.plan()},Sh=function(f,h){for(var d=f._model,p=f._scheduler,m=h?f._componentsViews:f._chartsViews,g=h?f._componentsMap:f._chartsMap,v=f._zr,y=f._api,b=0;b<m.length;b++)m[b].__alive=!1;h?d.eachComponent(function(S,k){S!=="series"&&x(k)}):d.eachSeries(x);function x(S){var k=S.__requireNewView;S.__requireNewView=!1;var C="_ec_"+S.id+"_"+S.type,A=!k&&g[C];if(!A){var M=$r(S.type),T=h?Nr.getClass(M.main,M.sub):Rr.getClass(M.sub);A=new T,A.init(d,y),g[C]=A,m.push(A),v.add(A.group)}S.__viewId=A.__id=C,A.__alive=!0,A.__model=S,A.group.__ecComponentInfo={mainType:S.mainType,index:S.componentIndex},!h&&p.prepareView(A,S,d,y)}for(var b=0;b<m.length;){var w=m[b];w.__alive?b++:(!h&&w.renderTask.dispose(),v.remove(w.group),w.dispose(d,y),m.splice(b,1),g[w.__id]===w&&delete g[w.__id],w.__id=w.group.__ecComponentInfo=null)}},Nc=function(f,h,d,p,m){var g=f._model;if(g.setUpdatePayload(d),!p){I([].concat(f._componentsViews).concat(f._chartsViews),w);return}var v={};v[p+"Id"]=d[p+"Id"],v[p+"Index"]=d[p+"Index"],v[p+"Name"]=d[p+"Name"];var y={mainType:p,query:v};m&&(y.subType=m);var b=d.excludeSeriesId,x;b!=null&&(x=me(),I(Mt(b),function(S){var k=Zr(S,null);k!=null&&x.set(k,!0)})),g&&g.eachComponent(y,function(S){var k=x&&x.get(S.id)!=null;if(!k)if(em(d))if(S instanceof Qr)d.type===Aa&&!d.notBlur&&!S.get(["emphasis","disabled"])&&e2(S,d,f._api);else{var C=zf(S.mainType,S.componentIndex,d.name,f._api),A=C.focusSelf,M=C.dispatchers;d.type===Aa&&A&&!d.notBlur&&Bf(S.mainType,S.componentIndex,f._api),M&&I(M,function(T){d.type===Aa?Ll(T):Pl(T)})}else Uf(d)&&S instanceof Qr&&(n2(S,d,f._api),jg(S),wr(f))},f),g&&g.eachComponent(y,function(S){var k=x&&x.get(S.id)!=null;k||w(f[p==="series"?"_chartsMap":"_componentsMap"][S.__viewId])},f);function w(S){S&&S.__alive&&S[h]&&S[h](S.__model,g,f._api,d)}},Xn={prepareAndUpdate:function(f){zi(this),Xn.update.call(this,f,{optionChanged:f.newOption!=null})},update:function(f,h){var d=this._model,p=this._api,m=this._zr,g=this._coordSysMgr,v=this._scheduler;if(d){d.setUpdatePayload(f),v.restoreData(d,f),v.performSeriesTasks(d),g.create(d,p),v.performDataProcessorTasks(d,f),Th(this,d),g.update(d,p),r(d),v.performVisualTasks(d,f),Mh(this,d,p,f,h);var y=d.get("backgroundColor")||"transparent",b=d.get("darkMode");m.setBackgroundColor(y),b!=null&&b!=="auto"&&m.setDarkMode(b),Br.trigger("afterupdate",d,p)}},updateTransform:function(f){var h=this,d=this._model,p=this._api;if(d){d.setUpdatePayload(f);var m=[];d.eachComponent(function(v,y){if(v!=="series"){var b=h.getViewOfComponentModel(y);if(b&&b.__alive)if(b.updateTransform){var x=b.updateTransform(y,d,p,f);x&&x.update&&m.push(b)}else m.push(b)}});var g=me();d.eachSeries(function(v){var y=h._chartsMap[v.__viewId];if(y.updateTransform){var b=y.updateTransform(v,d,p,f);b&&b.update&&g.set(v.uid,1)}else g.set(v.uid,1)}),r(d),this._scheduler.performVisualTasks(d,f,{setDirty:!0,dirtyMap:g}),Bc(this,d,p,f,{},g),Br.trigger("afterupdate",d,p)}},updateView:function(f){var h=this._model;h&&(h.setUpdatePayload(f),Rr.markUpdateMethod(f,"updateView"),r(h),this._scheduler.performVisualTasks(h,f,{setDirty:!0}),Mh(this,h,this._api,f,{}),Br.trigger("afterupdate",h,this._api))},updateVisual:function(f){var h=this,d=this._model;d&&(d.setUpdatePayload(f),d.eachSeries(function(p){p.getData().clearAllVisual()}),Rr.markUpdateMethod(f,"updateVisual"),r(d),this._scheduler.performVisualTasks(d,f,{visualType:"visual",setDirty:!0}),d.eachComponent(function(p,m){if(p!=="series"){var g=h.getViewOfComponentModel(m);g&&g.__alive&&g.updateVisual(m,d,h._api,f)}}),d.eachSeries(function(p){var m=h._chartsMap[p.__viewId];m.updateVisual(p,d,h._api,f)}),Br.trigger("afterupdate",d,this._api))},updateLayout:function(f){Xn.update.call(this,f)}},kh=function(f,h,d,p){if(f._disposed){f.id;return}for(var m=f._model,g=f._coordSysMgr.getCoordinateSystems(),v,y=If(m,d),b=0;b<g.length;b++){var x=g[b];if(x[h]&&(v=x[h](m,y,p))!=null)return v}},Th=function(f,h){var d=f._chartsMap,p=f._scheduler;h.eachSeries(function(m){p.updateStreamModes(m,d[m.__viewId])})},Ch=function(f,h){var d=this,p=this.getModel(),m=f.type,g=f.escapeConnect,v=zc[m],y=v.actionInfo,b=(y.update||"update").split(":"),x=b.pop(),w=b[0]!=null&&$r(b[0]);this[Lt]=!0;var S=[f],k=!1;f.batch&&(k=!0,S=he(f.batch,function(R){return R=He(q({},R),f),R.batch=null,R}));var C=[],A,M=Uf(f),T=em(f);if(T&&Kg(this._api),I(S,function(R){if(A=v.action(R,d._model,d._api),A=A||q({},R),A.type=y.event||A.type,C.push(A),T){var O=Lf(f),B=O.queryOptionMap,j=O.mainTypeSpecified,P=j?B.keys()[0]:"series";Nc(d,x,R,P),wr(d)}else M?(Nc(d,x,R,"series"),wr(d)):w&&Nc(d,x,R,w.main,w.sub)}),x!=="none"&&!T&&!M&&!w)try{this[jt]?(zi(this),Xn.update.call(this,f),this[jt]=null):Xn[x].call(this,f)}catch(R){throw this[Lt]=!1,R}if(k?A={type:y.event||m,escapeConnect:g,batch:C}:A=C[0],this[Lt]=!1,!h){var D=this._messageCenter;if(D.trigger(A.type,A),M){var L={type:"selectchanged",escapeConnect:g,selected:a2(p),isFromClick:f.isFromClick||!1,fromAction:f.type,fromActionPayload:f};D.trigger(L.type,L)}}},es=function(f){for(var h=this._pendingActions;h.length;){var d=h.shift();Ch.call(this,d,f)}},ts=function(f){!f&&this.trigger("updated")},Z_=function(f,h){f.on("rendered",function(d){h.trigger("rendered",d),f.animation.isFinished()&&!h[jt]&&!h._scheduler.unfinished&&!h._pendingActions.length&&h.trigger("finished")})},K_=function(f,h){f.on("mouseover",function(d){var p=d.target,m=Jo(p,Vf);m&&(t2(m,d,h._api),wr(h))}).on("mouseout",function(d){var p=d.target,m=Jo(p,Vf);m&&(r2(m,d,h._api),wr(h))}).on("click",function(d){var p=d.target,m=Jo(p,function(y){return We(y).dataIndex!=null},!0);if(m){var g=m.selected?"unselect":"select",v=We(m);h._api.dispatchAction({type:g,dataType:v.dataType,dataIndexInside:v.dataIndex,seriesIndex:v.seriesIndex,isFromClick:!0})}})};function r(f){f.clearColorPalette(),f.eachSeries(function(h){h.clearColorPalette()})}function n(f){var h=[],d=[],p=!1;if(f.eachComponent(function(y,b){var x=b.get("zlevel")||0,w=b.get("z")||0,S=b.getZLevelKey();p=p||!!S,(y==="series"?d:h).push({zlevel:x,z:w,idx:b.componentIndex,type:y,key:S})}),p){var m=h.concat(d),g,v;Sc(m,function(y,b){return y.zlevel===b.zlevel?y.z-b.z:y.zlevel-b.zlevel}),I(m,function(y){var b=f.getComponent(y.type,y.idx),x=y.zlevel,w=y.key;g!=null&&(x=Math.max(g,x)),w?(x===g&&w!==v&&x++,v=w):v&&(x===g&&x++,v=""),g=x,b.setZLevel(x)})}}Mh=function(f,h,d,p,m){n(h),j_(f,h,d,p,m),I(f._chartsViews,function(g){g.__alive=!1}),Bc(f,h,d,p,m),I(f._chartsViews,function(g){g.__alive||g.remove(h,d)})},j_=function(f,h,d,p,m,g){I(g||f._componentsViews,function(v){var y=v.__model;c(y,v),v.render(y,h,d,p),s(y,v),u(y,v)})},Bc=function(f,h,d,p,m,g){var v=f._scheduler;m=q(m||{},{updatedSeries:h.getSeries()}),Br.trigger("series:beforeupdate",h,d,m);var y=!1;h.eachSeries(function(b){var x=f._chartsMap[b.__viewId];x.__alive=!0;var w=x.renderTask;v.updatePayload(w,p),c(b,x),g&&g.get(b.uid)&&w.dirty(),w.perform(v.getPerformArgs(w))&&(y=!0),x.group.silent=!!b.get("silent"),o(b,x),jg(b)}),v.unfinished=y||v.unfinished,Br.trigger("series:layoutlabels",h,d,m),Br.trigger("series:transition",h,d,m),h.eachSeries(function(b){var x=f._chartsMap[b.__viewId];s(b,x),u(b,x)}),i(f,h),Br.trigger("series:afterupdate",h,d,m)},wr=function(f){f[xh]=!0,f.getZr().wakeUp()},eb=function(f){f[xh]&&(f.getZr().storage.traverse(function(h){Io(h)||a(h)}),f[xh]=!1)};function a(f){for(var h=[],d=f.currentStates,p=0;p<d.length;p++){var m=d[p];m==="emphasis"||m==="blur"||m==="select"||h.push(m)}f.selected&&f.states.select&&h.push("select"),f.hoverState===Ml&&f.states.emphasis?h.push("emphasis"):f.hoverState===Cl&&f.states.blur&&h.push("blur"),f.useStates(h)}function i(f,h){var d=f._zr,p=d.storage,m=0;p.traverse(function(g){g.isGroup||m++}),m>h.get("hoverLayerThreshold")&&!_e.node&&!_e.worker&&h.eachSeries(function(g){if(!g.preventUsingHoverLayer){var v=f._chartsMap[g.__viewId];v.__alive&&v.eachRendered(function(y){y.states.emphasis&&(y.states.emphasis.hoverLayer=!0)})}})}function o(f,h){var d=f.get("blendMode")||null;h.eachRendered(function(p){p.isGroup||(p.style.blend=d)})}function s(f,h){if(!f.preventAutoZ){var d=f.get("z")||0,p=f.get("zlevel")||0;h.eachRendered(function(m){return l(m,d,p,-1/0),!0})}}function l(f,h,d,p){var m=f.getTextContent(),g=f.getTextGuideLine(),v=f.isGroup;if(v)for(var y=f.childrenRef(),b=0;b<y.length;b++)p=Math.max(l(y[b],h,d,p),p);else f.z=h,f.zlevel=d,p=Math.max(f.z2,p);if(m&&(m.z=h,m.zlevel=d,isFinite(p)&&(m.z2=p+2)),g){var x=f.textGuideLineConfig;g.z=h,g.zlevel=d,isFinite(p)&&(g.z2=p+(x&&x.showAbove?1:-1))}return p}function c(f,h){h.eachRendered(function(d){if(!Io(d)){var p=d.getTextContent(),m=d.getTextGuideLine();d.stateTransition&&(d.stateTransition=null),p&&p.stateTransition&&(p.stateTransition=null),m&&m.stateTransition&&(m.stateTransition=null),d.hasState()?(d.prevStates=d.currentStates,d.clearStates()):d.prevStates&&(d.prevStates=null)}})}function u(f,h){var d=f.getModel("stateAnimation"),p=f.isAnimationEnabled(),m=d.get("duration"),g=m>0?{duration:m,delay:d.get("delay"),easing:d.get("easing")}:null;h.eachRendered(function(v){if(v.states&&v.states.emphasis){if(Io(v))return;if(v instanceof qe&&c2(v),v.__dirty){var y=v.prevStates;y&&v.useStates(y)}if(p){v.stateTransition=g;var b=v.getTextContent(),x=v.getTextGuideLine();b&&(b.stateTransition=g),x&&(x.stateTransition=g)}v.__dirty&&a(v)}})}J_=function(f){return new((function(h){K(d,h);function d(){return h!==null&&h.apply(this,arguments)||this}return d.prototype.getCoordinateSystems=function(){return f._coordSysMgr.getCoordinateSystems()},d.prototype.getComponentByElement=function(p){for(;p;){var m=p.__ecComponentInfo;if(m!=null)return f._model.getComponent(m.mainType,m.index);p=p.parent}},d.prototype.enterEmphasis=function(p,m){Ll(p,m),wr(f)},d.prototype.leaveEmphasis=function(p,m){Pl(p,m),wr(f)},d.prototype.enterBlur=function(p){Qk(p),wr(f)},d.prototype.leaveBlur=function(p){qg(p),wr(f)},d.prototype.enterSelect=function(p){Yg(p),wr(f)},d.prototype.leaveSelect=function(p){Xg(p),wr(f)},d.prototype.getModel=function(){return f.getModel()},d.prototype.getViewOfComponentModel=function(p){return f.getViewOfComponentModel(p)},d.prototype.getViewOfSeriesModel=function(p){return f.getViewOfSeriesModel(p)},d})(J0))(f)},Q_=function(f){function h(d,p){for(var m=0;m<d.length;m++){var g=d[m];g[wh]=p}}I(rs,function(d,p){f._messageCenter.on(p,function(m){if(nb[f.group]&&f[wh]!==G_){if(m&&m.escapeConnect)return;var g=f.makeActionFromEvent(m),v=[];I(ns,function(y){y!==f&&y.group===f.group&&v.push(y)}),h(v,G_),I(v,function(y){y[wh]!==sI&&y.dispatchAction(g)}),h(v,lI)}})})}})(),e})(Ir),Ah=tb.prototype;Ah.on=$_("on"),Ah.off=$_("off"),Ah.one=function(t,e,r){var n=this;function a(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];e&&e.apply&&e.apply(this,i),n.off(t,a)}this.on.call(this,t,a,r)};var cI=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];function ZO(t){}var zc={},rs={},Dh=[],Ih=[],Fc=[],rb={},Lh={},ns={},nb={},uI=+new Date-0,Ph="_echarts_instance_";function fI(t,e,r){var n=!(r&&r.ssr);if(n){var a=dI(t);if(a)return a}var i=new tb(t,e,r);return i.id="ec_"+uI++,ns[i.id]=i,n&&Eg(t,Ph,i.id),Q_(i),Br.trigger("afterinit",i),i}function dI(t){return ns[Hk(t,Ph)]}function ab(t,e){rb[t]=e}function ib(t){Ue(Ih,t)<0&&Ih.push(t)}function ob(t,e){Eh(Dh,t,e,QD)}function hI(t){Rh("afterinit",t)}function pI(t){Rh("afterupdate",t)}function Rh(t,e){Br.on(t,e)}function Fa(t,e,r){ke(e)&&(r=e,e="");var n=de(t)?t.type:[t,t={event:e}][0];t.event=(t.event||n).toLowerCase(),e=t.event,!rs[e]&&(dn(U_.test(n)&&U_.test(e)),zc[n]||(zc[n]={action:r,actionInfo:t}),rs[e]=n)}function vI(t,e){gd.register(t,e)}function gI(t,e){Eh(Fc,t,e,F_,"layout")}function Ha(t,e){Eh(Fc,t,e,H_,"visual")}var sb=[];function Eh(t,e,r,n,a){if((ke(e)||de(e))&&(r=e,e=n),!(Ue(sb,r)>=0)){sb.push(r);var i=u_.wrapStageHandler(r,a);i.__prio=e,i.__raw=r,t.push(i)}}function lb(t,e){Lh[t]=e}function mI(t,e,r){var n=XD("registerMap");n&&n(t,e,r)}var yI=RC;Ha(bh,cD),Ha(Oc,uD),Ha(Oc,fD),Ha(bh,kD),Ha(Oc,TD),Ha(V_,qD),ib(i_),ob(jD,oD),lb("default",dD),Fa({type:Aa,event:Aa,update:Aa},Et),Fa({type:Al,event:Al,update:Al},Et),Fa({type:To,event:To,update:To},Et),Fa({type:Dl,event:Dl,update:Dl},Et),Fa({type:Co,event:Co,update:Co},Et),ab("light",wD),ab("dark",m_);var cb=[],_I={registerPreprocessor:ib,registerProcessor:ob,registerPostInit:hI,registerPostUpdate:pI,registerUpdateLifecycle:Rh,registerAction:Fa,registerCoordinateSystem:vI,registerLayout:gI,registerVisual:Ha,registerTransform:yI,registerLoading:lb,registerMap:mI,registerImpl:YD,PRIORITY:oI,ComponentModel:Ye,ComponentView:Nr,SeriesModel:Qr,ChartView:Rr,registerComponentModel:function(t){Ye.registerClass(t)},registerComponentView:function(t){Nr.registerClass(t)},registerSeriesModel:function(t){Qr.registerClass(t)},registerChartView:function(t){Rr.registerClass(t)},registerSubTypeDefaulter:function(t,e){Ye.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){FA(t,e)}};function Zn(t){if(ee(t)){I(t,function(e){Zn(e)});return}Ue(cb,t)>=0||(cb.push(t),ke(t)&&(t={install:t}),t.install(_I))}var bI=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e})(Ye),xI=(function(){function t(){}return t.prototype.getNeedCrossZero=function(){var e=this.option;return!e.scale},t.prototype.getCoordSysModel=function(){},t})(),Oh=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",qt).models[0]},e.type="cartesian2dAxis",e})(Ye);Ur(Oh,xI);var ub={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:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},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},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},wI=Oe({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},ub),Nh=Oe({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},ub),SI=Oe({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},Nh),kI=He({logBase:10},Nh);const TI={category:wI,value:Nh,time:SI,log:kI};var CI=0,Bh=(function(){function t(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++CI}return t.createByAxisModel=function(e){var r=e.option,n=r.data,a=n&&he(n,MI);return new t({categories:a,needCollect:!a,deduplication:r.dedplication!==!1})},t.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},t.prototype.parseAndCollect=function(e){var r,n=this._needCollect;if(!ae(e)&&!n)return e;if(n&&!this._deduplication)return r=this.categories.length,this.categories[r]=e,r;var a=this._getOrCreateMap();return r=a.get(e),r==null&&(n?(r=this.categories.length,this.categories[r]=e,a.set(e,r)):r=NaN),r},t.prototype._getOrCreateMap=function(){return this._map||(this._map=me(this.categories))},t})();function MI(t){return de(t)&&t.value!=null?t.value:t+""}var AI={value:1,category:1,time:1,log:1};function fb(t,e,r,n){I(AI,function(a,i){var o=Oe(Oe({},TI[i],!0),n,!0),s=(function(l){K(c,l);function c(){var u=l!==null&&l.apply(this,arguments)||this;return u.type=e+"Axis."+i,u}return c.prototype.mergeDefaultAndTheme=function(u,f){var h=Vo(this),d=h?vc(u):{},p=f.getTheme();Oe(u,p.get(i+"Axis")),Oe(u,this.getDefaultOption()),u.type=db(u),h&&Pi(u,d,h)},c.prototype.optionUpdated=function(){var u=this.option;u.type==="category"&&(this.__ordinalMeta=Bh.createByAxisModel(this))},c.prototype.getCategories=function(u){var f=this.option;if(f.type==="category")return u?f.data:this.__ordinalMeta.categories},c.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},c.type=e+"Axis."+i,c.defaultOption=o,c})(r);t.registerComponentModel(s)}),t.registerSubTypeDefaulter(e+"Axis",db)}function db(t){return t.type||(t.data?"category":"value")}var en=(function(){function t(e){this._setting=e||{},this._extent=[1/0,-1/0]}return t.prototype.getSetting=function(e){return this._setting[e]},t.prototype.unionExtent=function(e){var r=this._extent;e[0]<r[0]&&(r[0]=e[0]),e[1]>r[1]&&(r[1]=e[1])},t.prototype.unionExtentFromData=function(e,r){this.unionExtent(e.getApproximateExtent(r))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(e,r){var n=this._extent;isNaN(e)||(n[0]=e),isNaN(r)||(n[1]=r)},t.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(e){this._isBlank=e},t})();Zs(en);function zh(t){return t.type==="interval"||t.type==="log"}function DI(t,e,r,n){var a={},i=t[1]-t[0],o=a.interval=Tg(i/e);r!=null&&o<r&&(o=a.interval=r),n!=null&&o>n&&(o=a.interval=n);var s=a.intervalPrecision=hb(o),l=a.niceTickExtent=[mt(Math.ceil(t[0]/o)*o,s),mt(Math.floor(t[1]/o)*o,s)];return II(l,t),a}function Fh(t){var e=Math.pow(10,Af(t)),r=t/e;return r?r===2?r=3:r===3?r=5:r*=2:r=1,mt(r*e)}function hb(t){return gn(t)+2}function pb(t,e,r){t[e]=Math.max(Math.min(t[e],r[1]),r[0])}function II(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),pb(t,0,e),pb(t,1,e),t[0]>t[1]&&(t[0]=t[1])}function Hc(t,e){return t>=e[0]&&t<=e[1]}function Vc(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function Uc(t,e){return t*(e[1]-e[0])+e[0]}var Hh=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;n.type="ordinal";var a=n.getSetting("ordinalMeta");return a||(a=new Bh({})),ee(a)&&(a=new Bh({categories:he(a,function(i){return de(i)?i.value:i})})),n._ordinalMeta=a,n._extent=n.getSetting("extent")||[0,a.categories.length-1],n}return e.prototype.parse=function(r){return r==null?NaN:ae(r)?this._ordinalMeta.getOrdinal(r):Math.round(r)},e.prototype.contain=function(r){return r=this.parse(r),Hc(r,this._extent)&&this._ordinalMeta.categories[r]!=null},e.prototype.normalize=function(r){return r=this._getTickNumber(this.parse(r)),Vc(r,this._extent)},e.prototype.scale=function(r){return r=Math.round(Uc(r,this._extent)),this.getRawOrdinalNumber(r)},e.prototype.getTicks=function(){for(var r=[],n=this._extent,a=n[0];a<=n[1];)r.push({value:a}),a++;return r},e.prototype.getMinorTicks=function(r){},e.prototype.setSortInfo=function(r){if(r==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var n=r.ordinalNumbers,a=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Math.min(s,n.length);o<l;++o){var c=n[o];a[o]=c,i[c]=o}for(var u=0;o<s;++o){for(;i[u]!=null;)u++;a.push(u),i[u]=o}},e.prototype._getTickNumber=function(r){var n=this._ticksByOrdinalNumber;return n&&r>=0&&r<n.length?n[r]:r},e.prototype.getRawOrdinalNumber=function(r){var n=this._ordinalNumbersByTick;return n&&r>=0&&r<n.length?n[r]:r},e.prototype.getLabel=function(r){if(!this.isBlank()){var n=this.getRawOrdinalNumber(r.value),a=this._ordinalMeta.categories[n];return a==null?"":a+""}},e.prototype.count=function(){return this._extent[1]-this._extent[0]+1},e.prototype.unionExtentFromData=function(r,n){this.unionExtent(r.getApproximateExtent(n))},e.prototype.isInExtentRange=function(r){return r=this._getTickNumber(r),this._extent[0]<=r&&this._extent[1]>=r},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e})(en);en.registerClass(Hh);var Va=mt,Fi=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="interval",r._interval=0,r._intervalPrecision=2,r}return e.prototype.parse=function(r){return r},e.prototype.contain=function(r){return Hc(r,this._extent)},e.prototype.normalize=function(r){return Vc(r,this._extent)},e.prototype.scale=function(r){return Uc(r,this._extent)},e.prototype.setExtent=function(r,n){var a=this._extent;isNaN(r)||(a[0]=parseFloat(r)),isNaN(n)||(a[1]=parseFloat(n))},e.prototype.unionExtent=function(r){var n=this._extent;r[0]<n[0]&&(n[0]=r[0]),r[1]>n[1]&&(n[1]=r[1]),this.setExtent(n[0],n[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(r){this._interval=r,this._niceExtent=this._extent.slice(),this._intervalPrecision=hb(r)},e.prototype.getTicks=function(r){var n=this._interval,a=this._extent,i=this._niceExtent,o=this._intervalPrecision,s=[];if(!n)return s;var l=1e4;a[0]<i[0]&&(r?s.push({value:Va(i[0]-n,o)}):s.push({value:a[0]}));for(var c=i[0];c<=i[1]&&(s.push({value:c}),c=Va(c+n,o),c!==s[s.length-1].value);)if(s.length>l)return[];var u=s.length?s[s.length-1].value:i[1];return a[1]>u&&(r?s.push({value:Va(u+n,o)}):s.push({value:a[1]})),s},e.prototype.getMinorTicks=function(r){for(var n=this.getTicks(!0),a=[],i=this.getExtent(),o=1;o<n.length;o++){for(var s=n[o],l=n[o-1],c=0,u=[],f=s.value-l.value,h=f/r;c<r-1;){var d=Va(l.value+(c+1)*h);d>i[0]&&d<i[1]&&u.push(d),c++}a.push(u)}return a},e.prototype.getLabel=function(r,n){if(r==null)return"";var a=n&&n.precision;a==null?a=gn(r.value)||0:a==="auto"&&(a=this._intervalPrecision);var i=Va(r.value,a,!0);return Sy(i)},e.prototype.calcNiceTicks=function(r,n,a){r=r||5;var i=this._extent,o=i[1]-i[0];if(isFinite(o)){o<0&&(o=-o,i.reverse());var s=DI(i,r,n,a);this._intervalPrecision=s.intervalPrecision,this._interval=s.interval,this._niceExtent=s.niceTickExtent}},e.prototype.calcNiceExtent=function(r){var n=this._extent;if(n[0]===n[1])if(n[0]!==0){var a=Math.abs(n[0]);r.fixMax||(n[1]+=a/2),n[0]-=a/2}else n[1]=1;var i=n[1]-n[0];isFinite(i)||(n[0]=0,n[1]=1),this.calcNiceTicks(r.splitNumber,r.minInterval,r.maxInterval);var o=this._interval;r.fixMin||(n[0]=Va(Math.floor(n[0]/o)*o)),r.fixMax||(n[1]=Va(Math.ceil(n[1]/o)*o))},e.prototype.setNiceExtent=function(r,n){this._niceExtent=[r,n]},e.type="interval",e})(en);en.registerClass(Fi);var LI=function(t,e,r,n){for(;r<n;){var a=r+n>>>1;t[a][1]<e?r=a+1:n=a}return r},vb=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="time",n}return e.prototype.getLabel=function(r){var n=this.getSetting("useUTC");return oc(r.value,hy[hC(Ii(this._minLevelUnit))]||hy.second,n,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(r,n,a){var i=this.getSetting("useUTC"),o=this.getSetting("locale");return pC(r,n,a,o,i)},e.prototype.getTicks=function(){var r=this._interval,n=this._extent,a=[];if(!r)return a;a.push({value:n[0],level:0});var i=this.getSetting("useUTC"),o=zI(this._minLevelUnit,this._approxInterval,i,n);return a=a.concat(o),a.push({value:n[1],level:0}),a},e.prototype.calcNiceExtent=function(r){var n=this._extent;if(n[0]===n[1]&&(n[0]-=_r,n[1]+=_r),n[1]===-1/0&&n[0]===1/0){var a=new Date;n[1]=+new Date(a.getFullYear(),a.getMonth(),a.getDate()),n[0]=n[1]-_r}this.calcNiceTicks(r.splitNumber,r.minInterval,r.maxInterval)},e.prototype.calcNiceTicks=function(r,n,a){r=r||10;var i=this._extent,o=i[1]-i[0];this._approxInterval=o/r,n!=null&&this._approxInterval<n&&(this._approxInterval=n),a!=null&&this._approxInterval>a&&(this._approxInterval=a);var s=Gc.length,l=Math.min(LI(Gc,this._approxInterval,0,s),s-1);this._interval=Gc[l][1],this._minLevelUnit=Gc[Math.max(l-1,0)][0]},e.prototype.parse=function(r){return et(r)?r:+mn(r)},e.prototype.contain=function(r){return Hc(this.parse(r),this._extent)},e.prototype.normalize=function(r){return Vc(this.parse(r),this._extent)},e.prototype.scale=function(r){return Uc(r,this._extent)},e.type="time",e})(Fi),Gc=[["second",kd],["minute",Td],["hour",Bo],["quarter-day",Bo*6],["half-day",Bo*12],["day",_r*1.2],["half-week",_r*3.5],["week",_r*7],["month",_r*31],["quarter",_r*95],["half-year",dy/2],["year",dy]];function PI(t,e,r,n){var a=mn(e),i=mn(r),o=function(p){return gy(a,p,n)===gy(i,p,n)},s=function(){return o("year")},l=function(){return s()&&o("month")},c=function(){return l()&&o("day")},u=function(){return c()&&o("hour")},f=function(){return u()&&o("minute")},h=function(){return f()&&o("second")},d=function(){return h()&&o("millisecond")};switch(t){case"year":return s();case"month":return l();case"day":return c();case"hour":return u();case"minute":return f();case"second":return h();case"millisecond":return d()}}function RI(t,e){return t/=_r,t>16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function EI(t){var e=30*_r;return t/=e,t>6?6:t>3?3:t>2?2:1}function OI(t){return t/=Bo,t>12?12:t>6?6:t>3.5?4:t>2?2:1}function gb(t,e){return t/=e?Td:kd,t>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function NI(t){return Tg(t)}function BI(t,e,r){var n=new Date(t);switch(Ii(e)){case"year":case"month":n[my(r)](0);case"day":n[yy(r)](1);case"hour":n[_y(r)](0);case"minute":n[by(r)](0);case"second":n[xy(r)](0),n[wy(r)](0)}return n.getTime()}function zI(t,e,r,n){var a=1e4,i=py,o=0;function s(M,T,D,L,R,O,B){for(var j=new Date(T),P=T,V=j[L]();P<D&&P<=n[1];)B.push({value:P}),V+=M,j[R](V),P=j.getTime();B.push({value:P,notAdd:!0})}function l(M,T,D){var L=[],R=!T.length;if(!PI(Ii(M),n[0],n[1],r)){R&&(T=[{value:BI(new Date(n[0]),M,r)},{value:n[1]}]);for(var O=0;O<T.length-1;O++){var B=T[O].value,j=T[O+1].value;if(B!==j){var P=void 0,V=void 0,H=void 0,Z=!1;switch(M){case"year":P=Math.max(1,Math.round(e/_r/365)),V=Md(r),H=vC(r);break;case"half-year":case"quarter":case"month":P=EI(e),V=Li(r),H=my(r);break;case"week":case"half-week":case"day":P=RI(e),V=sc(r),H=yy(r),Z=!0;break;case"half-day":case"quarter-day":case"hour":P=OI(e),V=Fo(r),H=_y(r);break;case"minute":P=gb(e,!0),V=lc(r),H=by(r);break;case"second":P=gb(e,!1),V=cc(r),H=xy(r);break;case"millisecond":P=NI(e),V=uc(r),H=wy(r);break}s(P,B,j,V,H,Z,L),M==="year"&&D.length>1&&O===0&&D.unshift({value:D[0].value-P})}}for(var O=0;O<L.length;O++)D.push(L[O]);return L}}for(var c=[],u=[],f=0,h=0,d=0;d<i.length&&o++<a;++d){var p=Ii(i[d]);if(dC(i[d])){l(i[d],c[c.length-1]||[],u);var m=i[d+1]?Ii(i[d+1]):null;if(p!==m){if(u.length){h=f,u.sort(function(M,T){return M.value-T.value});for(var g=[],v=0;v<u.length;++v){var y=u[v].value;(v===0||u[v-1].value!==y)&&(g.push(u[v]),y>=n[0]&&y<=n[1]&&f++)}var b=(n[1]-n[0])/e;if(f>b*1.5&&h>b/1.5||(c.push(g),f>b||t===i[d]))break}u=[]}}}for(var x=bt(he(c,function(M){return bt(M,function(T){return T.value>=n[0]&&T.value<=n[1]&&!T.notAdd})}),function(M){return M.length>0}),w=[],S=x.length-1,d=0;d<x.length;++d)for(var k=x[d],C=0;C<k.length;++C)w.push({value:k[C].value,level:S-d});w.sort(function(M,T){return M.value-T.value});for(var A=[],d=0;d<w.length;++d)(d===0||w[d].value!==w[d-1].value)&&A.push(w[d]);return A}en.registerClass(vb);var mb=en.prototype,as=Fi.prototype,FI=mt,HI=Math.floor,VI=Math.ceil,$c=Math.pow,zr=Math.log,Vh=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="log",r.base=10,r._originalScale=new Fi,r._interval=0,r}return e.prototype.getTicks=function(r){var n=this._originalScale,a=this._extent,i=n.getExtent(),o=as.getTicks.call(this,r);return he(o,function(s){var l=s.value,c=mt($c(this.base,l));return c=l===a[0]&&this._fixMin?Wc(c,i[0]):c,c=l===a[1]&&this._fixMax?Wc(c,i[1]):c,{value:c}},this)},e.prototype.setExtent=function(r,n){var a=zr(this.base);r=zr(Math.max(0,r))/a,n=zr(Math.max(0,n))/a,as.setExtent.call(this,r,n)},e.prototype.getExtent=function(){var r=this.base,n=mb.getExtent.call(this);n[0]=$c(r,n[0]),n[1]=$c(r,n[1]);var a=this._originalScale,i=a.getExtent();return this._fixMin&&(n[0]=Wc(n[0],i[0])),this._fixMax&&(n[1]=Wc(n[1],i[1])),n},e.prototype.unionExtent=function(r){this._originalScale.unionExtent(r);var n=this.base;r[0]=zr(r[0])/zr(n),r[1]=zr(r[1])/zr(n),mb.unionExtent.call(this,r)},e.prototype.unionExtentFromData=function(r,n){this.unionExtent(r.getApproximateExtent(n))},e.prototype.calcNiceTicks=function(r){r=r||10;var n=this._extent,a=n[1]-n[0];if(!(a===1/0||a<=0)){var i=Tk(a),o=r/a*i;for(o<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var s=[mt(VI(n[0]/i)*i),mt(HI(n[1]/i)*i)];this._interval=i,this._niceExtent=s}},e.prototype.calcNiceExtent=function(r){as.calcNiceExtent.call(this,r),this._fixMin=r.fixMin,this._fixMax=r.fixMax},e.prototype.parse=function(r){return r},e.prototype.contain=function(r){return r=zr(r)/zr(this.base),Hc(r,this._extent)},e.prototype.normalize=function(r){return r=zr(r)/zr(this.base),Vc(r,this._extent)},e.prototype.scale=function(r){return r=Uc(r,this._extent),$c(this.base,r)},e.type="log",e})(en),yb=Vh.prototype;yb.getMinorTicks=as.getMinorTicks,yb.getLabel=as.getLabel;function Wc(t,e){return FI(t,gn(e))}en.registerClass(Vh);var UI=(function(){function t(e,r,n){this._prepareParams(e,r,n)}return t.prototype._prepareParams=function(e,r,n){n[1]<n[0]&&(n=[NaN,NaN]),this._dataMin=n[0],this._dataMax=n[1];var a=this._isOrdinal=e.type==="ordinal";this._needCrossZero=e.type==="interval"&&r.getNeedCrossZero&&r.getNeedCrossZero();var i=r.get("min",!0);i==null&&(i=r.get("startValue",!0));var o=this._modelMinRaw=i;ke(o)?this._modelMinNum=qc(e,o({min:n[0],max:n[1]})):o!=="dataMin"&&(this._modelMinNum=qc(e,o));var s=this._modelMaxRaw=r.get("max",!0);if(ke(s)?this._modelMaxNum=qc(e,s({min:n[0],max:n[1]})):s!=="dataMax"&&(this._modelMaxNum=qc(e,s)),a)this._axisDataLen=r.getCategories().length;else{var l=r.get("boundaryGap"),c=ee(l)?l:[l||0,l||0];typeof c[0]=="boolean"||typeof c[1]=="boolean"?this._boundaryGapInner=[0,0]:this._boundaryGapInner=[Pn(c[0],1),Pn(c[1],1)]}},t.prototype.calculate=function(){var e=this._isOrdinal,r=this._dataMin,n=this._dataMax,a=this._axisDataLen,i=this._boundaryGapInner,o=e?null:n-r||Math.abs(r),s=this._modelMinRaw==="dataMin"?r:this._modelMinNum,l=this._modelMaxRaw==="dataMax"?n:this._modelMaxNum,c=s!=null,u=l!=null;s==null&&(s=e?a?0:NaN:r-i[0]*o),l==null&&(l=e?a?a-1:NaN:n+i[1]*o),(s==null||!isFinite(s))&&(s=NaN),(l==null||!isFinite(l))&&(l=NaN);var f=qs(s)||qs(l)||e&&!a;this._needCrossZero&&(s>0&&l>0&&!c&&(s=0),s<0&&l<0&&!u&&(l=0));var h=this._determinedMin,d=this._determinedMax;return h!=null&&(s=h,c=!0),d!=null&&(l=d,u=!0),{min:s,max:l,minFixed:c,maxFixed:u,isBlank:f}},t.prototype.modifyDataMinMax=function(e,r){this[$I[e]]=r},t.prototype.setDeterminedMinMax=function(e,r){var n=GI[e];this[n]=r},t.prototype.freeze=function(){this.frozen=!0},t})(),GI={min:"_determinedMin",max:"_determinedMax"},$I={min:"_dataMin",max:"_dataMax"};function _b(t,e,r){var n=t.rawExtentInfo;return n||(n=new UI(t,e,r),t.rawExtentInfo=n,n)}function qc(t,e){return e==null?null:qs(e)?NaN:t.parse(e)}function bb(t,e){var r=t.type,n=_b(t,e,t.getExtent()).calculate();t.setBlank(n.isBlank);var a=n.min,i=n.max,o=e.ecModel;if(o&&r==="time"){var s=u0("bar",o),l=!1;if(I(s,function(f){l=l||f.getBaseAxis()===e.axis}),l){var c=f0(s),u=WI(a,i,e,c);a=u.min,i=u.max}}return{extent:[a,i],fixMin:n.minFixed,fixMax:n.maxFixed}}function WI(t,e,r,n){var a=r.axis.getExtent(),i=Math.abs(a[1]-a[0]),o=UM(n,r.axis);if(o===void 0)return{min:t,max:e};var s=1/0;I(o,function(d){s=Math.min(d.offset,s)});var l=-1/0;I(o,function(d){l=Math.max(d.offset+d.width,l)}),s=Math.abs(s),l=Math.abs(l);var c=s+l,u=e-t,f=1-(s+l)/i,h=u/f-u;return e+=h*(l/c),t-=h*(s/c),{min:t,max:e}}function xb(t,e){var r=e,n=bb(t,r),a=n.extent,i=r.get("splitNumber");t instanceof Vh&&(t.base=r.get("logBase"));var o=t.type,s=r.get("interval"),l=o==="interval"||o==="time";t.setExtent(a[0],a[1]),t.calcNiceExtent({splitNumber:i,fixMin:n.fixMin,fixMax:n.fixMax,minInterval:l?r.get("minInterval"):null,maxInterval:l?r.get("maxInterval"):null}),s!=null&&t.setInterval&&t.setInterval(s)}function qI(t,e){if(e=e||t.get("type"),e)switch(e){case"category":return new Hh({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[1/0,-1/0]});case"time":return new vb({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new(en.getClass(e)||Fi)}}function YI(t){var e=t.scale.getExtent(),r=e[0],n=e[1];return!(r>0&&n>0||r<0&&n<0)}function Hi(t){var e=t.getLabelModel().get("formatter"),r=t.type==="category"?t.scale.getExtent()[0]:null;return t.scale.type==="time"?(function(n){return function(a,i){return t.scale.getFormattedLabel(a,i,n)}})(e):ae(e)?(function(n){return function(a){var i=t.scale.getLabel(a),o=n.replace("{value}",i??"");return o}})(e):ke(e)?(function(n){return function(a,i){return r!=null&&(i=a.value-r),n(Uh(t,a),i,a.level!=null?{level:a.level}:null)}})(e):function(n){return t.scale.getLabel(n)}}function Uh(t,e){return t.type==="category"?t.scale.getLabel(e):e.value}function XI(t){var e=t.model,r=t.scale;if(!(!e.get(["axisLabel","show"])||r.isBlank())){var n,a,i=r.getExtent();r instanceof Hh?a=r.count():(n=r.getTicks(),a=n.length);var o=t.getLabelModel(),s=Hi(t),l,c=1;a>40&&(c=Math.ceil(a/40));for(var u=0;u<a;u+=c){var f=n?n[u]:{value:i[0]+u},h=s(f,u),d=o.getTextRect(h),p=ZI(d,o.get("rotate")||0);l?l.union(p):l=p}return l}}function ZI(t,e){var r=e*Math.PI/180,n=t.width,a=t.height,i=n*Math.abs(Math.cos(r))+Math.abs(a*Math.sin(r)),o=n*Math.abs(Math.sin(r))+Math.abs(a*Math.cos(r)),s=new Ge(t.x,t.y,i,o);return s}function Gh(t){var e=t.get("interval");return e??"auto"}function wb(t){return t.type==="category"&&Gh(t.getLabelModel())===0}function Sb(t,e){var r={};return I(t.mapDimensionsAll(e),function(n){r[YT(t,n)]=!0}),at(r)}function KI(t,e,r){e&&I(Sb(e,r),function(n){var a=e.getApproximateExtent(n);a[0]<t[0]&&(t[0]=a[0]),a[1]>t[1]&&(t[1]=a[1])})}var jI=(function(){function t(e){this.type="cartesian",this._dimList=[],this._axes={},this.name=e||""}return t.prototype.getAxis=function(e){return this._axes[e]},t.prototype.getAxes=function(){return he(this._dimList,function(e){return this._axes[e]},this)},t.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),bt(this.getAxes(),function(r){return r.scale.type===e})},t.prototype.addAxis=function(e){var r=e.dim;this._axes[r]=e,this._dimList.push(r)},t})(),$h=["x","y"];function kb(t){return t.type==="interval"||t.type==="time"}var JI=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="cartesian2d",r.dimensions=$h,r}return e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,n=this.getAxis("y").scale;if(!(!kb(r)||!kb(n))){var a=r.getExtent(),i=n.getExtent(),o=this.dataToPoint([a[0],i[0]]),s=this.dataToPoint([a[1],i[1]]),l=a[1]-a[0],c=i[1]-i[0];if(!(!l||!c)){var u=(s[0]-o[0])/l,f=(s[1]-o[1])/c,h=o[0]-a[0]*u,d=o[1]-i[0]*f,p=this._transform=[u,0,0,f,h,d];this._invTransform=Gu([],p)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(r){var n=this.getAxis("x"),a=this.getAxis("y");return n.contain(n.toLocalCoord(r[0]))&&a.contain(a.toLocalCoord(r[1]))},e.prototype.containData=function(r){return this.getAxis("x").containData(r[0])&&this.getAxis("y").containData(r[1])},e.prototype.containZone=function(r,n){var a=this.dataToPoint(r),i=this.dataToPoint(n),o=this.getArea(),s=new Ge(a[0],a[1],i[0]-a[0],i[1]-a[1]);return o.intersect(s)},e.prototype.dataToPoint=function(r,n,a){a=a||[];var i=r[0],o=r[1];if(this._transform&&i!=null&&isFinite(i)&&o!=null&&isFinite(o))return dr(a,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return a[0]=s.toGlobalCoord(s.dataToCoord(i,n)),a[1]=l.toGlobalCoord(l.dataToCoord(o,n)),a},e.prototype.clampData=function(r,n){var a=this.getAxis("x").scale,i=this.getAxis("y").scale,o=a.getExtent(),s=i.getExtent(),l=a.parse(r[0]),c=i.parse(r[1]);return n=n||[],n[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),n[1]=Math.min(Math.max(Math.min(s[0],s[1]),c),Math.max(s[0],s[1])),n},e.prototype.pointToData=function(r,n){var a=[];if(this._invTransform)return dr(a,r,this._invTransform);var i=this.getAxis("x"),o=this.getAxis("y");return a[0]=i.coordToData(i.toLocalCoord(r[0]),n),a[1]=o.coordToData(o.toLocalCoord(r[1]),n),a},e.prototype.getOtherAxis=function(r){return this.getAxis(r.dim==="x"?"y":"x")},e.prototype.getArea=function(r){r=r||0;var n=this.getAxis("x").getGlobalExtent(),a=this.getAxis("y").getGlobalExtent(),i=Math.min(n[0],n[1])-r,o=Math.min(a[0],a[1])-r,s=Math.max(n[0],n[1])-i+r,l=Math.max(a[0],a[1])-o+r;return new Ge(i,o,s,l)},e})(jI),is=ht();function Tb(t,e){var r=he(e,function(n){return t.scale.parse(n)});return t.type==="time"&&r.length>0&&(r.sort(),r.unshift(r[0]),r.push(r[r.length-1])),r}function QI(t){var e=t.getLabelModel().get("customValues");if(e){var r=Hi(t),n=t.scale.getExtent(),a=Tb(t,e),i=bt(a,function(o){return o>=n[0]&&o<=n[1]});return{labels:he(i,function(o){var s={value:o};return{formattedLabel:r(s),rawLabel:t.scale.getLabel(s),tickValue:o}})}}return t.type==="category"?tL(t):nL(t)}function eL(t,e){var r=t.getTickModel().get("customValues");if(r){var n=t.scale.getExtent(),a=Tb(t,r);return{ticks:bt(a,function(i){return i>=n[0]&&i<=n[1]})}}return t.type==="category"?rL(t,e):{ticks:he(t.scale.getTicks(),function(i){return i.value})}}function tL(t){var e=t.getLabelModel(),r=Cb(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:r.labelCategoryInterval}:r}function Cb(t,e){var r=Mb(t,"labels"),n=Gh(e),a=Ab(r,n);if(a)return a;var i,o;return ke(n)?i=Lb(t,n):(o=n==="auto"?aL(t):n,i=Ib(t,o)),Db(r,n,{labels:i,labelCategoryInterval:o})}function rL(t,e){var r=Mb(t,"ticks"),n=Gh(e),a=Ab(r,n);if(a)return a;var i,o;if((!e.get("show")||t.scale.isBlank())&&(i=[]),ke(n))i=Lb(t,n,!0);else if(n==="auto"){var s=Cb(t,t.getLabelModel());o=s.labelCategoryInterval,i=he(s.labels,function(l){return l.tickValue})}else o=n,i=Ib(t,o,!0);return Db(r,n,{ticks:i,tickCategoryInterval:o})}function nL(t){var e=t.scale.getTicks(),r=Hi(t);return{labels:he(e,function(n,a){return{level:n.level,formattedLabel:r(n,a),rawLabel:t.scale.getLabel(n),tickValue:n.value}})}}function Mb(t,e){return is(t)[e]||(is(t)[e]=[])}function Ab(t,e){for(var r=0;r<t.length;r++)if(t[r].key===e)return t[r].value}function Db(t,e,r){return t.push({key:e,value:r}),r}function aL(t){var e=is(t).autoInterval;return e??(is(t).autoInterval=t.calculateCategoryInterval())}function iL(t){var e=oL(t),r=Hi(t),n=(e.axisRotate-e.labelRotate)/180*Math.PI,a=t.scale,i=a.getExtent(),o=a.count();if(i[1]-i[0]<1)return 0;var s=1;o>40&&(s=Math.max(1,Math.floor(o/40)));for(var l=i[0],c=t.dataToCoord(l+1)-t.dataToCoord(l),u=Math.abs(c*Math.cos(n)),f=Math.abs(c*Math.sin(n)),h=0,d=0;l<=i[1];l+=s){var p=0,m=0,g=$u(r({value:l}),e.font,"center","top");p=g.width*1.3,m=g.height*1.3,h=Math.max(h,p,7),d=Math.max(d,m,7)}var v=h/u,y=d/f;isNaN(v)&&(v=1/0),isNaN(y)&&(y=1/0);var b=Math.max(0,Math.floor(Math.min(v,y))),x=is(t.model),w=t.getExtent(),S=x.lastAutoInterval,k=x.lastTickCount;return S!=null&&k!=null&&Math.abs(S-b)<=1&&Math.abs(k-o)<=1&&S>b&&x.axisExtent0===w[0]&&x.axisExtent1===w[1]?b=S:(x.lastTickCount=o,x.lastAutoInterval=b,x.axisExtent0=w[0],x.axisExtent1=w[1]),b}function oL(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function Ib(t,e,r){var n=Hi(t),a=t.scale,i=a.getExtent(),o=t.getLabelModel(),s=[],l=Math.max((e||0)+1,1),c=i[0],u=a.count();c!==0&&l>1&&u/l>2&&(c=Math.round(Math.ceil(c/l)*l));var f=wb(t),h=o.get("showMinLabel")||f,d=o.get("showMaxLabel")||f;h&&c!==i[0]&&m(i[0]);for(var p=c;p<=i[1];p+=l)m(p);d&&p-l!==i[1]&&m(i[1]);function m(g){var v={value:g};s.push(r?g:{formattedLabel:n(v),rawLabel:a.getLabel(v),tickValue:g})}return s}function Lb(t,e,r){var n=t.scale,a=Hi(t),i=[];return I(n.getTicks(),function(o){var s=n.getLabel(o),l=o.value;e(o.value,s)&&i.push(r?l:{formattedLabel:a(o),rawLabel:s,tickValue:l})}),i}var Pb=[0,1],sL=(function(){function t(e,r,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=r,this._extent=n||[0,0]}return t.prototype.contain=function(e){var r=this._extent,n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return e>=n&&e<=a},t.prototype.containData=function(e){return this.scale.contain(e)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(e){return Sg(e||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(e,r){var n=this._extent;n[0]=e,n[1]=r},t.prototype.dataToCoord=function(e,r){var n=this._extent,a=this.scale;return e=a.normalize(e),this.onBand&&a.type==="ordinal"&&(n=n.slice(),Rb(n,a.count())),Ca(e,Pb,n,r)},t.prototype.coordToData=function(e,r){var n=this._extent,a=this.scale;this.onBand&&a.type==="ordinal"&&(n=n.slice(),Rb(n,a.count()));var i=Ca(e,n,Pb,r);return this.scale.scale(i)},t.prototype.pointToData=function(e,r){},t.prototype.getTicksCoords=function(e){e=e||{};var r=e.tickModel||this.getTickModel(),n=eL(this,r),a=n.ticks,i=he(a,function(s){return{coord:this.dataToCoord(this.scale.type==="ordinal"?this.scale.getRawOrdinalNumber(s):s),tickValue:s}},this),o=r.get("alignWithLabel");return lL(this,i,o,e.clamp),i},t.prototype.getMinorTicksCoords=function(){if(this.scale.type==="ordinal")return[];var e=this.model.getModel("minorTick"),r=e.get("splitNumber");r>0&&r<100||(r=5);var n=this.scale.getMinorTicks(r),a=he(n,function(i){return he(i,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return a},t.prototype.getViewLabels=function(){return QI(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var e=this._extent,r=this.scale.getExtent(),n=r[1]-r[0]+(this.onBand?1:0);n===0&&(n=1);var a=Math.abs(e[1]-e[0]);return Math.abs(a)/n},t.prototype.calculateCategoryInterval=function(){return iL(this)},t})();function Rb(t,e){var r=t[1]-t[0],n=e,a=r/n/2;t[0]+=a,t[1]-=a}function lL(t,e,r,n){var a=e.length;if(!t.onBand||r||!a)return;var i=t.getExtent(),o,s;if(a===1)e[0].coord=i[0],o=e[1]={coord:i[1],tickValue:e[0].tickValue};else{var l=e[a-1].tickValue-e[0].tickValue,c=(e[a-1].coord-e[0].coord)/l;I(e,function(d){d.coord-=c/2});var u=t.scale.getExtent();s=1+u[1]-e[a-1].tickValue,o={coord:e[a-1].coord+c*s,tickValue:u[1]+1},e.push(o)}var f=i[0]>i[1];h(e[0].coord,i[0])&&(n?e[0].coord=i[0]:e.shift()),n&&h(i[0],e[0].coord)&&e.unshift({coord:i[0]}),h(i[1],o.coord)&&(n?o.coord=i[1]:e.pop()),n&&h(o.coord,i[1])&&e.push({coord:i[1]});function h(d,p){return d=mt(d),p=mt(p),f?d>p:d<p}}var cL=(function(t){K(e,t);function e(r,n,a,i,o){var s=t.call(this,r,n,a)||this;return s.index=0,s.type=i||"value",s.position=o||"bottom",s}return e.prototype.isHorizontal=function(){var r=this.position;return r==="top"||r==="bottom"},e.prototype.getGlobalExtent=function(r){var n=this.getExtent();return n[0]=this.toGlobalCoord(n[0]),n[1]=this.toGlobalCoord(n[1]),r&&n[0]>n[1]&&n.reverse(),n},e.prototype.pointToData=function(r,n){return this.coordToData(this.toLocalCoord(r[this.dim==="x"?0:1]),n)},e.prototype.setCategorySortInfo=function(r){if(this.type!=="category")return!1;this.model.option.categorySortInfo=r,this.scale.setSortInfo(r)},e})(sL);function Wh(t,e,r){r=r||{};var n=t.coordinateSystem,a=e.axis,i={},o=a.getAxesOnZeroOf()[0],s=a.position,l=o?"onZero":s,c=a.dim,u=n.getRect(),f=[u.x,u.x+u.width,u.y,u.y+u.height],h={left:0,right:1,top:0,bottom:1,onZero:2},d=e.get("offset")||0,p=c==="x"?[f[2]-d,f[3]+d]:[f[0]-d,f[1]+d];if(o){var m=o.toGlobalCoord(o.dataToCoord(0));p[h.onZero]=Math.max(Math.min(m,p[1]),p[0])}i.position=[c==="y"?p[h[l]]:f[0],c==="x"?p[h[l]]:f[3]],i.rotation=Math.PI/2*(c==="x"?0:1);var g={top:-1,bottom:1,left:-1,right:1};i.labelDirection=i.tickDirection=i.nameDirection=g[s],i.labelOffset=o?p[h[s]]-p[h.onZero]:0,e.get(["axisTick","inside"])&&(i.tickDirection=-i.tickDirection),ao(r.labelInside,e.get(["axisLabel","inside"]))&&(i.labelDirection=-i.labelDirection);var v=e.get(["axisLabel","rotate"]);return i.labelRotate=l==="top"?-v:v,i.z2=1,i}function Eb(t){return t.get("coordinateSystem")==="cartesian2d"}function Ob(t){var e={xAxisModel:null,yAxisModel:null};return I(e,function(r,n){var a=n.replace(/Model$/,""),i=t.getReferringComponents(a,qt).models[0];e[n]=i}),e}var qh=Math.log;function uL(t,e,r){var n=Fi.prototype,a=n.getTicks.call(r),i=n.getTicks.call(r,!0),o=a.length-1,s=n.getInterval.call(r),l=bb(t,e),c=l.extent,u=l.fixMin,f=l.fixMax;if(t.type==="log"){var h=qh(t.base);c=[qh(c[0])/h,qh(c[1])/h]}t.setExtent(c[0],c[1]),t.calcNiceExtent({splitNumber:o,fixMin:u,fixMax:f});var d=n.getExtent.call(t);u&&(c[0]=d[0]),f&&(c[1]=d[1]);var p=n.getInterval.call(t),m=c[0],g=c[1];if(u&&f)p=(g-m)/o;else if(u)for(g=c[0]+p*o;g<c[1]&&isFinite(g)&&isFinite(c[1]);)p=Fh(p),g=c[0]+p*o;else if(f)for(m=c[1]-p*o;m>c[0]&&isFinite(m)&&isFinite(c[0]);)p=Fh(p),m=c[1]-p*o;else{var v=t.getTicks().length-1;v>o&&(p=Fh(p));var y=p*o;g=Math.ceil(c[1]/p)*p,m=mt(g-y),m<0&&c[0]>=0?(m=0,g=mt(y)):g>0&&c[1]<=0&&(g=0,m=-mt(y))}var b=(a[0].value-i[0].value)/s,x=(a[o].value-i[o].value)/s;n.setExtent.call(t,m+p*b,g+p*x),n.setInterval.call(t,p),(b||x)&&n.setNiceExtent.call(t,m+p,g-p)}var fL=(function(){function t(e,r,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=$h,this._initCartesian(e,r,n),this.model=e}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(e,r){var n=this._axesMap;this._updateScale(e,this.model);function a(o){var s,l=at(o),c=l.length;if(c){for(var u=[],f=c-1;f>=0;f--){var h=+l[f],d=o[h],p=d.model,m=d.scale;zh(m)&&p.get("alignTicks")&&p.get("interval")==null?u.push(d):(xb(m,p),zh(m)&&(s=d))}u.length&&(s||(s=u.pop(),xb(s.scale,s.model)),I(u,function(g){uL(g.scale,g.model,s.scale)}))}}a(n.x),a(n.y);var i={};I(n.x,function(o){Nb(n,"y",o,i)}),I(n.y,function(o){Nb(n,"x",o,i)}),this.resize(this.model,r)},t.prototype.resize=function(e,r,n){var a=e.getBoxLayoutParams(),i=!n&&e.get("containLabel"),o=pc(a,{width:r.getWidth(),height:r.getHeight()});this._rect=o;var s=this._axesList;l(),i&&(I(s,function(c){if(!c.model.get(["axisLabel","inside"])){var u=XI(c);if(u){var f=c.isHorizontal()?"height":"width",h=c.model.get(["axisLabel","margin"]);o[f]-=u[f]+h,c.position==="top"?o.y+=u.height+h:c.position==="left"&&(o.x+=u.width+h)}}}),l()),I(this._coordsList,function(c){c.calcAffineTransform()});function l(){I(s,function(c){var u=c.isHorizontal(),f=u?[0,o.width]:[0,o.height],h=c.inverse?1:0;c.setExtent(f[h],f[1-h]),dL(c,u?o.x:o.y)})}},t.prototype.getAxis=function(e,r){var n=this._axesMap[e];if(n!=null)return n[r||0]},t.prototype.getAxes=function(){return this._axesList.slice()},t.prototype.getCartesian=function(e,r){if(e!=null&&r!=null){var n="x"+e+"y"+r;return this._coordsMap[n]}de(e)&&(r=e.yAxisIndex,e=e.xAxisIndex);for(var a=0,i=this._coordsList;a<i.length;a++)if(i[a].getAxis("x").index===e||i[a].getAxis("y").index===r)return i[a]},t.prototype.getCartesians=function(){return this._coordsList.slice()},t.prototype.convertToPixel=function(e,r,n){var a=this._findConvertTarget(r);return a.cartesian?a.cartesian.dataToPoint(n):a.axis?a.axis.toGlobalCoord(a.axis.dataToCoord(n)):null},t.prototype.convertFromPixel=function(e,r,n){var a=this._findConvertTarget(r);return a.cartesian?a.cartesian.pointToData(n):a.axis?a.axis.coordToData(a.axis.toLocalCoord(n)):null},t.prototype._findConvertTarget=function(e){var r=e.seriesModel,n=e.xAxisModel||r&&r.getReferringComponents("xAxis",qt).models[0],a=e.yAxisModel||r&&r.getReferringComponents("yAxis",qt).models[0],i=e.gridModel,o=this._coordsList,s,l;if(r)s=r.coordinateSystem,Ue(o,s)<0&&(s=null);else if(n&&a)s=this.getCartesian(n.componentIndex,a.componentIndex);else if(n)l=this.getAxis("x",n.componentIndex);else if(a)l=this.getAxis("y",a.componentIndex);else if(i){var c=i.coordinateSystem;c===this&&(s=this._coordsList[0])}return{cartesian:s,axis:l}},t.prototype.containPoint=function(e){var r=this._coordsList[0];if(r)return r.containPoint(e)},t.prototype._initCartesian=function(e,r,n){var a=this,i=this,o={left:!1,right:!1,top:!1,bottom:!1},s={x:{},y:{}},l={x:0,y:0};if(r.eachComponent("xAxis",c("x"),this),r.eachComponent("yAxis",c("y"),this),!l.x||!l.y){this._axesMap={},this._axesList=[];return}this._axesMap=s,I(s.x,function(u,f){I(s.y,function(h,d){var p="x"+f+"y"+d,m=new JI(p);m.master=a,m.model=e,a._coordsMap[p]=m,a._coordsList.push(m),m.addAxis(u),m.addAxis(h)})});function c(u){return function(f,h){if(Yh(f,e)){var d=f.get("position");u==="x"?d!=="top"&&d!=="bottom"&&(d=o.bottom?"top":"bottom"):d!=="left"&&d!=="right"&&(d=o.left?"right":"left"),o[d]=!0;var p=new cL(u,qI(f),[0,0],f.get("type"),d),m=p.type==="category";p.onBand=m&&f.get("boundaryGap"),p.inverse=f.get("inverse"),f.axis=p,p.model=f,p.grid=i,p.index=h,i._axesList.push(p),s[u][h]=p,l[u]++}}}},t.prototype._updateScale=function(e,r){I(this._axesList,function(a){if(a.scale.setExtent(1/0,-1/0),a.type==="category"){var i=a.model.get("categorySortInfo");a.scale.setSortInfo(i)}}),e.eachSeries(function(a){if(Eb(a)){var i=Ob(a),o=i.xAxisModel,s=i.yAxisModel;if(!Yh(o,r)||!Yh(s,r))return;var l=this.getCartesian(o.componentIndex,s.componentIndex),c=a.getData(),u=l.getAxis("x"),f=l.getAxis("y");n(c,u),n(c,f)}},this);function n(a,i){I(Sb(a,i.dim),function(o){i.scale.unionExtentFromData(a,o)})}},t.prototype.getTooltipAxes=function(e){var r=[],n=[];return I(this.getCartesians(),function(a){var i=e!=null&&e!=="auto"?a.getAxis(e):a.getBaseAxis(),o=a.getOtherAxis(i);Ue(r,i)<0&&r.push(i),Ue(n,o)<0&&n.push(o)}),{baseAxes:r,otherAxes:n}},t.create=function(e,r){var n=[];return e.eachComponent("grid",function(a,i){var o=new t(a,e,r);o.name="grid_"+i,o.resize(a,r,!0),a.coordinateSystem=o,n.push(o)}),e.eachSeries(function(a){if(Eb(a)){var i=Ob(a),o=i.xAxisModel,s=i.yAxisModel,l=o.getCoordSysModel(),c=l.coordinateSystem;a.coordinateSystem=c.getCartesian(o.componentIndex,s.componentIndex)}}),n},t.dimensions=$h,t})();function Yh(t,e){return t.getCoordSysModel()===e}function Nb(t,e,r,n){r.getAxesOnZeroOf=function(){return i?[i]:[]};var a=t[e],i,o=r.model,s=o.get(["axisLine","onZero"]),l=o.get(["axisLine","onZeroAxisIndex"]);if(!s)return;if(l!=null)Bb(a[l])&&(i=a[l]);else for(var c in a)if(a.hasOwnProperty(c)&&Bb(a[c])&&!n[u(a[c])]){i=a[c];break}i&&(n[u(i)]=!0);function u(f){return f.dim+"_"+f.index}}function Bb(t){return t&&t.type!=="category"&&t.type!=="time"&&YI(t)}function dL(t,e){var r=t.getExtent(),n=r[0]+r[1];t.toGlobalCoord=t.dim==="x"?function(a){return a+e}:function(a){return n-a+e},t.toLocalCoord=t.dim==="x"?function(a){return a-e}:function(a){return n-a+e}}var Kn=Math.PI,jn=(function(){function t(e,r){this.group=new St,this.opt=r,this.axisModel=e,He(r,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new St({x:r.position[0],y:r.position[1],rotation:r.rotation});n.updateTransform(),this._transformGroup=n}return t.prototype.hasBuilder=function(e){return!!zb[e]},t.prototype.add=function(e){zb[e](this.opt,this.axisModel,this.group,this._transformGroup)},t.prototype.getGroup=function(){return this.group},t.innerTextLayout=function(e,r,n){var a=kg(r-e),i,o;return kl(a)?(o=n>0?"top":"bottom",i="center"):kl(a-Kn)?(o=n>0?"bottom":"top",i="center"):(o="middle",a>0&&a<Kn?i=n>0?"right":"left":i=n>0?"left":"right"),{rotation:a,textAlign:i,textVerticalAlign:o}},t.makeAxisEventDataBase=function(e){var r={componentType:e.mainType,componentIndex:e.componentIndex};return r[e.mainType+"Index"]=e.componentIndex,r},t.isLabelSilent=function(e){var r=e.get("tooltip");return e.get("silent")||!(e.get("triggerEvent")||r&&r.show)},t})(),zb={axisLine:function(t,e,r,n){var a=e.get(["axisLine","show"]);if(a==="auto"&&t.handleAutoShown&&(a=t.handleAutoShown("axisLine")),!!a){var i=e.axis.getExtent(),o=n.transform,s=[i[0],0],l=[i[1],0],c=s[0]>l[0];o&&(dr(s,s,o),dr(l,l,o));var u=q({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),f=new Hn({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:u,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});Lo(f.shape,f.style.lineWidth),f.anid="line",r.add(f);var h=e.get(["axisLine","symbol"]);if(h!=null){var d=e.get(["axisLine","symbolSize"]);ae(h)&&(h=[h,h]),(ae(d)||et(d))&&(d=[d,d]);var p=Gy(e.get(["axisLine","symbolOffset"])||0,d),m=d[0],g=d[1];I([{rotate:t.rotation+Math.PI/2,offset:p[0],r:0},{rotate:t.rotation-Math.PI/2,offset:p[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(v,y){if(h[y]!=="none"&&h[y]!=null){var b=Ri(h[y],-m/2,-g/2,m,g,u.stroke,!0),x=v.r+v.offset,w=c?l:s;b.attr({rotation:v.rotate,x:w[0]+x*Math.cos(t.rotation),y:w[1]-x*Math.sin(t.rotation),silent:!0,z2:11}),r.add(b)}})}}},axisTickLabel:function(t,e,r,n){var a=vL(r,n,e,t),i=mL(r,n,e,t);if(pL(e,i,a),gL(r,n,e,t.tickDirection),e.get(["axisLabel","hideOverlap"])){var o=cA(he(i,function(s){return{label:s,priority:s.z2,defaultAttr:{ignore:s.ignore}}}));uA(o)}},axisName:function(t,e,r,n){var a=ao(t.axisName,e.get("name"));if(a){var i=e.get("nameLocation"),o=t.nameDirection,s=e.getModel("nameTextStyle"),l=e.get("nameGap")||0,c=e.axis.getExtent(),u=c[0]>c[1]?-1:1,f=[i==="start"?c[0]-u*l:i==="end"?c[1]+u*l:(c[0]+c[1])/2,Hb(i)?t.labelOffset+o*l:0],h,d=e.get("nameRotate");d!=null&&(d=d*Kn/180);var p;Hb(i)?h=jn.innerTextLayout(t.rotation,d??t.rotation,o):(h=hL(t.rotation,i,d||0,c),p=t.axisNameAvailableWidth,p!=null&&(p=Math.abs(p/Math.sin(h.rotation)),!isFinite(p)&&(p=null)));var m=s.getFont(),g=e.get("nameTruncate",!0)||{},v=g.ellipsis,y=ao(t.nameTruncateMaxWidth,g.maxWidth,p),b=new $t({x:f[0],y:f[1],rotation:h.rotation,silent:jn.isLabelSilent(e),style:wi(s,{text:a,font:m,overflow:"truncate",width:y,ellipsis:v,fill:s.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:s.get("align")||h.textAlign,verticalAlign:s.get("verticalAlign")||h.textVerticalAlign}),z2:1});if(Wl({el:b,componentModel:e,itemName:a}),b.__fullText=a,b.anid="name",e.get("triggerEvent")){var x=jn.makeAxisEventDataBase(e);x.targetType="axisName",x.name=a,We(b).eventData=x}n.add(b),b.updateTransform(),r.add(b),b.decomposeTransform()}}};function hL(t,e,r,n){var a=kg(r-t),i,o,s=n[0]>n[1],l=e==="start"&&!s||e!=="start"&&s;return kl(a-Kn/2)?(o=l?"bottom":"top",i="center"):kl(a-Kn*1.5)?(o=l?"top":"bottom",i="center"):(o="middle",a<Kn*1.5&&a>Kn/2?i=l?"left":"right":i=l?"right":"left"),{rotation:a,textAlign:i,textVerticalAlign:o}}function pL(t,e,r){if(!wb(t.axis)){var n=t.get(["axisLabel","showMinLabel"]),a=t.get(["axisLabel","showMaxLabel"]);e=e||[],r=r||[];var i=e[0],o=e[1],s=e[e.length-1],l=e[e.length-2],c=r[0],u=r[1],f=r[r.length-1],h=r[r.length-2];n===!1?(Sr(i),Sr(c)):Fb(i,o)&&(n?(Sr(o),Sr(u)):(Sr(i),Sr(c))),a===!1?(Sr(s),Sr(f)):Fb(l,s)&&(a?(Sr(l),Sr(h)):(Sr(s),Sr(f)))}}function Sr(t){t&&(t.ignore=!0)}function Fb(t,e){var r=t&&t.getBoundingRect().clone(),n=e&&e.getBoundingRect().clone();if(!(!r||!n)){var a=Hu([]);return Uu(a,a,-t.rotation),r.applyTransform(ii([],a,t.getLocalTransform())),n.applyTransform(ii([],a,e.getLocalTransform())),r.intersect(n)}}function Hb(t){return t==="middle"||t==="center"}function Vb(t,e,r,n,a){for(var i=[],o=[],s=[],l=0;l<t.length;l++){var c=t[l].coord;o[0]=c,o[1]=0,s[0]=c,s[1]=r,e&&(dr(o,o,e),dr(s,s,e));var u=new Hn({shape:{x1:o[0],y1:o[1],x2:s[0],y2:s[1]},style:n,z2:2,autoBatch:!0,silent:!0});Lo(u.shape,u.style.lineWidth),u.anid=a+"_"+t[l].tickValue,i.push(u)}return i}function vL(t,e,r,n){var a=r.axis,i=r.getModel("axisTick"),o=i.get("show");if(o==="auto"&&n.handleAutoShown&&(o=n.handleAutoShown("axisTick")),!(!o||a.scale.isBlank())){for(var s=i.getModel("lineStyle"),l=n.tickDirection*i.get("length"),c=a.getTicksCoords(),u=Vb(c,e.transform,l,He(s.getLineStyle(),{stroke:r.get(["axisLine","lineStyle","color"])}),"ticks"),f=0;f<u.length;f++)t.add(u[f]);return u}}function gL(t,e,r,n){var a=r.axis,i=r.getModel("minorTick");if(!(!i.get("show")||a.scale.isBlank())){var o=a.getMinorTicksCoords();if(o.length)for(var s=i.getModel("lineStyle"),l=n*i.get("length"),c=He(s.getLineStyle(),He(r.getModel("axisTick").getLineStyle(),{stroke:r.get(["axisLine","lineStyle","color"])})),u=0;u<o.length;u++)for(var f=Vb(o[u],e.transform,l,c,"minorticks_"+u),h=0;h<f.length;h++)t.add(f[h])}}function mL(t,e,r,n){var a=r.axis,i=ao(n.axisLabelShow,r.get(["axisLabel","show"]));if(!(!i||a.scale.isBlank())){var o=r.getModel("axisLabel"),s=o.get("margin"),l=a.getViewLabels(),c=(ao(n.labelRotate,o.get("rotate"))||0)*Kn/180,u=jn.innerTextLayout(n.rotation,c,n.labelDirection),f=r.getCategories&&r.getCategories(!0),h=[],d=jn.isLabelSilent(r),p=r.get("triggerEvent");return I(l,function(m,g){var v=a.scale.type==="ordinal"?a.scale.getRawOrdinalNumber(m.tickValue):m.tickValue,y=m.formattedLabel,b=m.rawLabel,x=o;if(f&&f[v]){var w=f[v];de(w)&&w.textStyle&&(x=new lt(w.textStyle,o,r.ecModel))}var S=x.getTextColor()||r.get(["axisLine","lineStyle","color"]),k=a.dataToCoord(v),C=x.getShallow("align",!0)||u.textAlign,A=Pe(x.getShallow("alignMinLabel",!0),C),M=Pe(x.getShallow("alignMaxLabel",!0),C),T=x.getShallow("verticalAlign",!0)||x.getShallow("baseline",!0)||u.textVerticalAlign,D=Pe(x.getShallow("verticalAlignMinLabel",!0),T),L=Pe(x.getShallow("verticalAlignMaxLabel",!0),T),R=new $t({x:k,y:n.labelOffset+n.labelDirection*s,rotation:u.rotation,silent:d,z2:10+(m.level||0),style:wi(x,{text:y,align:g===0?A:g===l.length-1?M:C,verticalAlign:g===0?D:g===l.length-1?L:T,fill:ke(S)?S(a.type==="category"?b:a.type==="value"?v+"":v,g):S})});if(R.anid="label_"+v,Wl({el:R,componentModel:r,itemName:y,formatterParamsExtra:{isTruncated:function(){return R.isTruncated},value:b,tickIndex:g}}),p){var O=jn.makeAxisEventDataBase(r);O.targetType="axisLabel",O.value=b,O.tickIndex=g,a.type==="category"&&(O.dataIndex=v),We(R).eventData=O}e.add(R),R.updateTransform(),h.push(R),t.add(R),R.decomposeTransform()}),h}}function yL(t,e){var r={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return _L(r,t,e),r.seriesInvolved&&xL(r,t),r}function _L(t,e,r){var n=e.getComponent("tooltip"),a=e.getComponent("axisPointer"),i=a.get("link",!0)||[],o=[];I(r.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=os(s.model),c=t.coordSysAxesInfo[l]={};t.coordSysMap[l]=s;var u=s.model,f=u.getModel("tooltip",n);if(I(s.getAxes(),dt(m,!1,null)),s.getTooltipAxes&&n&&f.get("show")){var h=f.get("trigger")==="axis",d=f.get(["axisPointer","type"])==="cross",p=s.getTooltipAxes(f.get(["axisPointer","axis"]));(h||d)&&I(p.baseAxes,dt(m,d?"cross":!0,h)),d&&I(p.otherAxes,dt(m,"cross",!1))}function m(g,v,y){var b=y.model.getModel("axisPointer",a),x=b.get("show");if(!(!x||x==="auto"&&!g&&!Kh(b))){v==null&&(v=b.get("triggerTooltip")),b=g?bL(y,f,a,e,g,v):b;var w=b.get("snap"),S=b.get("triggerEmphasis"),k=os(y.model),C=v||w||y.type==="category",A=t.axesInfo[k]={key:k,axis:y,coordSys:s,axisPointerModel:b,triggerTooltip:v,triggerEmphasis:S,involveSeries:C,snap:w,useHandle:Kh(b),seriesModels:[],linkGroup:null};c[k]=A,t.seriesInvolved=t.seriesInvolved||C;var M=wL(i,y);if(M!=null){var T=o[M]||(o[M]={axesInfo:{}});T.axesInfo[k]=A,T.mapper=i[M].mapper,A.linkGroup=T}}}})}function bL(t,e,r,n,a,i){var o=e.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};I(s,function(h){l[h]=Ie(o.get(h))}),l.snap=t.type!=="category"&&!!i,o.get("type")==="cross"&&(l.type="line");var c=l.label||(l.label={});if(c.show==null&&(c.show=!1),a==="cross"){var u=o.get(["label","show"]);if(c.show=u??!0,!i){var f=l.lineStyle=o.get("crossStyle");f&&He(c,f.textStyle)}}return t.model.getModel("axisPointer",new lt(l,r,n))}function xL(t,e){e.eachSeries(function(r){var n=r.coordinateSystem,a=r.get(["tooltip","trigger"],!0),i=r.get(["tooltip","show"],!0);!n||a==="none"||a===!1||a==="item"||i===!1||r.get(["axisPointer","show"],!0)===!1||I(t.coordSysAxesInfo[os(n.model)],function(o){var s=o.axis;n.getAxis(s.dim)===s&&(o.seriesModels.push(r),o.seriesDataCount==null&&(o.seriesDataCount=0),o.seriesDataCount+=r.getData().count())})})}function wL(t,e){for(var r=e.model,n=e.dim,a=0;a<t.length;a++){var i=t[a]||{};if(Xh(i[n+"AxisId"],r.id)||Xh(i[n+"AxisIndex"],r.componentIndex)||Xh(i[n+"AxisName"],r.name))return a}}function Xh(t,e){return t==="all"||ee(t)&&Ue(t,e)>=0||t===e}function SL(t){var e=Zh(t);if(e){var r=e.axisPointerModel,n=e.axis.scale,a=r.option,i=r.get("status"),o=r.get("value");o!=null&&(o=n.parse(o));var s=Kh(r);i==null&&(a.status=s?"show":"hide");var l=n.getExtent().slice();l[0]>l[1]&&l.reverse(),(o==null||o>l[1])&&(o=l[1]),o<l[0]&&(o=l[0]),a.value=o,s&&(a.status=e.axis.scale.isBlank()?"hide":"show")}}function Zh(t){var e=(t.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[os(t)]}function kL(t){var e=Zh(t);return e&&e.axisPointerModel}function Kh(t){return!!t.get(["handle","show"])}function os(t){return t.type+"||"+t.id}var Ub={},Gb=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.render=function(r,n,a,i){this.axisPointerClass&&SL(r),t.prototype.render.apply(this,arguments),this._doUpdateAxisPointerClass(r,a,!0)},e.prototype.updateAxisPointer=function(r,n,a,i){this._doUpdateAxisPointerClass(r,a,!1)},e.prototype.remove=function(r,n){var a=this._axisPointer;a&&a.remove(n)},e.prototype.dispose=function(r,n){this._disposeAxisPointer(n),t.prototype.dispose.apply(this,arguments)},e.prototype._doUpdateAxisPointerClass=function(r,n,a){var i=e.getAxisPointerClass(this.axisPointerClass);if(i){var o=kL(r);o?(this._axisPointer||(this._axisPointer=new i)).render(r,o,n,a):this._disposeAxisPointer(n)}},e.prototype._disposeAxisPointer=function(r){this._axisPointer&&this._axisPointer.dispose(r),this._axisPointer=null},e.registerAxisPointerClass=function(r,n){Ub[r]=n},e.getAxisPointerClass=function(r){return r&&Ub[r]},e.type="axis",e})(Nr),jh=ht();function TL(t,e,r,n){var a=r.axis;if(!a.scale.isBlank()){var i=r.getModel("splitArea"),o=i.getModel("areaStyle"),s=o.get("color"),l=n.coordinateSystem.getRect(),c=a.getTicksCoords({tickModel:i,clamp:!0});if(c.length){var u=s.length,f=jh(t).splitAreaColors,h=me(),d=0;if(f)for(var p=0;p<c.length;p++){var m=f.get(c[p].tickValue);if(m!=null){d=(m+(u-1)*p)%u;break}}var g=a.toGlobalCoord(c[0].coord),v=o.getAreaStyle();s=ee(s)?s:[s];for(var p=1;p<c.length;p++){var y=a.toGlobalCoord(c[p].coord),b=void 0,x=void 0,w=void 0,S=void 0;a.isHorizontal()?(b=g,x=l.y,w=y-b,S=l.height,g=b+w):(b=l.x,x=g,w=l.width,S=y-x,g=x+S);var k=c[p-1].tickValue;k!=null&&h.set(k,d),e.add(new _t({anid:k!=null?"area_"+k:null,shape:{x:b,y:x,width:w,height:S},style:He({fill:s[d]},v),autoBatch:!0,silent:!0})),d=(d+1)%u}jh(t).splitAreaColors=h}}}function CL(t){jh(t).splitAreaColors=null}var ML=["axisLine","axisTickLabel","axisName"],AL=["splitArea","splitLine","minorSplitLine"],$b=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.axisPointerClass="CartesianAxisPointer",r}return e.prototype.render=function(r,n,a,i){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new St,this.group.add(this._axisGroup),!!r.get("show")){var s=r.getCoordSysModel(),l=Wh(s,r),c=new jn(r,q({handleAutoShown:function(f){for(var h=s.coordinateSystem.getCartesians(),d=0;d<h.length;d++)if(zh(h[d].getOtherAxis(r.axis).scale))return!0;return!1}},l));I(ML,c.add,c),this._axisGroup.add(c.getGroup()),I(AL,function(f){r.get([f,"show"])&&DL[f](this,this._axisGroup,r,s)},this);var u=i&&i.type==="changeAxisOrder"&&i.isInitSort;u||bm(o,this._axisGroup,r),t.prototype.render.call(this,r,n,a,i)}},e.prototype.remove=function(){CL(this)},e.type="cartesianAxis",e})(Gb),DL={splitLine:function(t,e,r,n){var a=r.axis;if(!a.scale.isBlank()){var i=r.getModel("splitLine"),o=i.getModel("lineStyle"),s=o.get("color"),l=i.get("showMinLine")!==!1,c=i.get("showMaxLine")!==!1;s=ee(s)?s:[s];for(var u=n.coordinateSystem.getRect(),f=a.isHorizontal(),h=0,d=a.getTicksCoords({tickModel:i}),p=[],m=[],g=o.getLineStyle(),v=0;v<d.length;v++){var y=a.toGlobalCoord(d[v].coord);if(!(v===0&&!l||v===d.length-1&&!c)){var b=d[v].tickValue;f?(p[0]=y,p[1]=u.y,m[0]=y,m[1]=u.y+u.height):(p[0]=u.x,p[1]=y,m[0]=u.x+u.width,m[1]=y);var x=h++%s.length,w=new Hn({anid:b!=null?"line_"+b:null,autoBatch:!0,shape:{x1:p[0],y1:p[1],x2:m[0],y2:m[1]},style:He({stroke:s[x]},g),silent:!0});Lo(w.shape,g.lineWidth),e.add(w)}}}},minorSplitLine:function(t,e,r,n){var a=r.axis,i=r.getModel("minorSplitLine"),o=i.getModel("lineStyle"),s=n.coordinateSystem.getRect(),l=a.isHorizontal(),c=a.getMinorTicksCoords();if(c.length)for(var u=[],f=[],h=o.getLineStyle(),d=0;d<c.length;d++)for(var p=0;p<c[d].length;p++){var m=a.toGlobalCoord(c[d][p].coord);l?(u[0]=m,u[1]=s.y,f[0]=m,f[1]=s.y+s.height):(u[0]=s.x,u[1]=m,f[0]=s.x+s.width,f[1]=m);var g=new Hn({anid:"minor_line_"+c[d][p].tickValue,autoBatch:!0,shape:{x1:u[0],y1:u[1],x2:f[0],y2:f[1]},style:h,silent:!0});Lo(g.shape,h.lineWidth),e.add(g)}},splitArea:function(t,e,r,n){TL(t,e,r,n)}},Wb=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="xAxis",e})($b),IL=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Wb.type,r}return e.type="yAxis",e})($b),LL=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="grid",r}return e.prototype.render=function(r,n){this.group.removeAll(),r.get("show")&&this.group.add(new _t({shape:r.coordinateSystem.getRect(),style:He({fill:r.get("backgroundColor")},r.getItemStyle()),silent:!0,z2:-1}))},e.type="grid",e})(Nr),qb={offset:0};function PL(t){t.registerComponentView(LL),t.registerComponentModel(bI),t.registerCoordinateSystem("cartesian2d",fL),fb(t,"x",Oh,qb),fb(t,"y",Oh,qb),t.registerComponentView(Wb),t.registerComponentView(IL),t.registerPreprocessor(function(e){e.xAxis&&e.yAxis&&!e.grid&&(e.grid={})})}var Yb="\0_ec_interaction_mutex";function Xb(t,e){return!!RL(t)[e]}function RL(t){return t[Yb]||(t[Yb]={})}Fa({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},Et);var EL=(function(t){K(e,t);function e(r){var n=t.call(this)||this;n._zr=r;var a=Ne(n._mousedownHandler,n),i=Ne(n._mousemoveHandler,n),o=Ne(n._mouseupHandler,n),s=Ne(n._mousewheelHandler,n),l=Ne(n._pinchHandler,n);return n.enable=function(c,u){this.disable(),this._opt=He(Ie(u)||{},{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),c==null&&(c=!0),(c===!0||c==="move"||c==="pan")&&(r.on("mousedown",a),r.on("mousemove",i),r.on("mouseup",o)),(c===!0||c==="scale"||c==="zoom")&&(r.on("mousewheel",s),r.on("pinch",l))},n.disable=function(){r.off("mousedown",a),r.off("mousemove",i),r.off("mouseup",o),r.off("mousewheel",s),r.off("pinch",l)},n}return e.prototype.isDragging=function(){return this._dragging},e.prototype.isPinching=function(){return this._pinching},e.prototype.setPointerChecker=function(r){this.pointerChecker=r},e.prototype.dispose=function(){this.disable()},e.prototype._mousedownHandler=function(r){if(!D0(r)){for(var n=r.target;n;){if(n.draggable)return;n=n.__hostTarget||n.parent}var a=r.offsetX,i=r.offsetY;this.pointerChecker&&this.pointerChecker(r,a,i)&&(this._x=a,this._y=i,this._dragging=!0)}},e.prototype._mousemoveHandler=function(r){if(!(!this._dragging||!Yc("moveOnMouseMove",r,this._opt)||r.gestureEvent==="pinch"||Xb(this._zr,"globalPan"))){var n=r.offsetX,a=r.offsetY,i=this._x,o=this._y,s=n-i,l=a-o;this._x=n,this._y=a,this._opt.preventDefaultMouseMove&&wc(r.event),Zb(this,"pan","moveOnMouseMove",r,{dx:s,dy:l,oldX:i,oldY:o,newX:n,newY:a,isAvailableBehavior:null})}},e.prototype._mouseupHandler=function(r){D0(r)||(this._dragging=!1)},e.prototype._mousewheelHandler=function(r){var n=Yc("zoomOnMouseWheel",r,this._opt),a=Yc("moveOnMouseWheel",r,this._opt),i=r.wheelDelta,o=Math.abs(i),s=r.offsetX,l=r.offsetY;if(!(i===0||!n&&!a)){if(n){var c=o>3?1.4:o>1?1.2:1.1,u=i>0?c:1/c;Jh(this,"zoom","zoomOnMouseWheel",r,{scale:u,originX:s,originY:l,isAvailableBehavior:null})}if(a){var f=Math.abs(i),h=(i>0?1:-1)*(f>3?.4:f>1?.15:.05);Jh(this,"scrollMove","moveOnMouseWheel",r,{scrollDelta:h,originX:s,originY:l,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(r){if(!Xb(this._zr,"globalPan")){var n=r.pinchScale>1?1.1:1/1.1;Jh(this,"zoom",null,r,{scale:n,originX:r.pinchX,originY:r.pinchY,isAvailableBehavior:null})}},e})(Ir);function Jh(t,e,r,n,a){t.pointerChecker&&t.pointerChecker(n,a.originX,a.originY)&&(wc(n.event),Zb(t,e,r,n,a))}function Zb(t,e,r,n,a){a.isAvailableBehavior=Ne(Yc,null,r,n),t.trigger(e,a)}function Yc(t,e,r){var n=r[t];return!t||n&&(!ae(n)||e.event[n+"Key"])}function Qh(t,e,r,n,a,i){t=t||0;var o=r[1]-r[0];if(a!=null&&(a=Vi(a,[0,o])),i!=null&&(i=Math.max(i,a??0)),n==="all"){var s=Math.abs(e[1]-e[0]);s=Vi(s,[0,o]),a=i=Vi(s,[a,i]),n=0}e[0]=Vi(e[0],r),e[1]=Vi(e[1],r);var l=ep(e,n);e[n]+=t;var c=a||0,u=r.slice();l.sign<0?u[0]+=c:u[1]-=c,e[n]=Vi(e[n],u);var f;return f=ep(e,n),a!=null&&(f.sign!==l.sign||f.span<a)&&(e[1-n]=e[n]+l.sign*a),f=ep(e,n),i!=null&&f.span>i&&(e[1-n]=e[n]+f.sign*i),e}function ep(t,e){var r=t[e]-t[1-e];return{span:Math.abs(r),sign:r>0?-1:r<0?1:e?-1:1}}function Vi(t,e){return Math.min(e[1]!=null?e[1]:1/0,Math.max(e[0]!=null?e[0]:-1/0,t))}var Ua=ht(),Kb=Ie,tp=Ne,OL=(function(){function t(){this._dragging=!1,this.animationThreshold=15}return t.prototype.render=function(e,r,n,a){var i=r.get("value"),o=r.get("status");if(this._axisModel=e,this._axisPointerModel=r,this._api=n,!(!a&&this._lastValue===i&&this._lastStatus===o)){this._lastValue=i,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var c={};this.makeElOption(c,i,e,r,n);var u=c.graphicKey;u!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=u;var f=this._moveAnimation=this.determineAnimation(e,r);if(!s)s=this._group=new St,this.createPointerEl(s,c,e,r),this.createLabelEl(s,c,e,r),n.getZr().add(s);else{var h=dt(jb,r,f);this.updatePointerEl(s,c,h),this.updateLabelEl(s,c,h,r)}ex(s,r,!0),this._renderHandle(i)}},t.prototype.remove=function(e){this.clear(e)},t.prototype.dispose=function(e){this.clear(e)},t.prototype.determineAnimation=function(e,r){var n=r.get("animation"),a=e.axis,i=a.type==="category",o=r.get("snap");if(!o&&!i)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(i&&a.getBandWidth()>s)return!0;if(o){var l=Zh(e).seriesDataCount,c=a.getExtent();return Math.abs(c[0]-c[1])/l>s}return!1}return n===!0},t.prototype.makeElOption=function(e,r,n,a,i){},t.prototype.createPointerEl=function(e,r,n,a){var i=r.pointer;if(i){var o=Ua(e).pointerEl=new eT[i.type](Kb(r.pointer));e.add(o)}},t.prototype.createLabelEl=function(e,r,n,a){if(r.label){var i=Ua(e).labelEl=new $t(Kb(r.label));e.add(i),Qb(i,a)}},t.prototype.updatePointerEl=function(e,r,n){var a=Ua(e).pointerEl;a&&r.pointer&&(a.setStyle(r.pointer.style),n(a,{shape:r.pointer.shape}))},t.prototype.updateLabelEl=function(e,r,n,a){var i=Ua(e).labelEl;i&&(i.setStyle(r.label.style),n(i,{x:r.label.x,y:r.label.y}),Qb(i,a))},t.prototype._renderHandle=function(e){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),a=this._handle,i=r.getModel("handle"),o=r.get("status");if(!i.get("show")||!o||o==="hide"){a&&n.remove(a),this._handle=null;return}var s;this._handle||(s=!0,a=this._handle=rd(i.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(c){wc(c.event)},onmousedown:tp(this._onHandleDragMove,this,0,0),drift:tp(this._onHandleDragMove,this),ondragend:tp(this._onHandleDragEnd,this)}),n.add(a)),ex(a,r,!1),a.setStyle(i.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=i.get("size");ee(l)||(l=[l,l]),a.scaleX=l[0]/2,a.scaleY=l[1]/2,Xd(this,"_doDispatchAxisPointer",i.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,s)}},t.prototype._moveHandleToValue=function(e,r){jb(this._axisPointerModel,!r&&this._moveAnimation,this._handle,rp(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(e,r){var n=this._handle;if(n){this._dragging=!0;var a=this.updateHandleTransform(rp(n),[e,r],this._axisModel,this._axisPointerModel);this._payloadInfo=a,n.stopAnimation(),n.attr(rp(a)),Ua(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){var e=this._handle;if(e){var r=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:r.cursorPoint[0],y:r.cursorPoint[1],tooltipOption:r.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){this._dragging=!1;var e=this._handle;if(e){var r=this._axisPointerModel.get("value");this._moveHandleToValue(r),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var r=e.getZr(),n=this._group,a=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),a&&r.remove(a),this._group=null,this._handle=null,this._payloadInfo=null),Zd(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(e,r,n){return n=n||0,{x:e[n],y:e[1-n],width:r[n],height:r[1-n]}},t})();function jb(t,e,r,n){Jb(Ua(r).lastProp,n)||(Ua(r).lastProp=n,e?or(r,n,t):(r.stopAnimation(),r.attr(n)))}function Jb(t,e){if(de(t)&&de(e)){var r=!0;return I(e,function(n,a){r=r&&Jb(t[a],n)}),!!r}else return t===e}function Qb(t,e){t[e.get(["label","show"])?"show":"hide"]()}function rp(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function ex(t,e,r){var n=e.get("z"),a=e.get("zlevel");t&&t.traverse(function(i){i.type!=="group"&&(n!=null&&(i.z=n),a!=null&&(i.zlevel=a),i.silent=r)})}function NL(t){var e=t.get("type"),r=t.getModel(e+"Style"),n;return e==="line"?(n=r.getLineStyle(),n.fill=null):e==="shadow"&&(n=r.getAreaStyle(),n.stroke=null),n}function BL(t,e,r,n,a){var i=r.get("value"),o=tx(i,e.axis,e.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=fc(s.get("padding")||0),c=s.getFont(),u=$u(o,c),f=a.position,h=u.width+l[1]+l[3],d=u.height+l[0]+l[2],p=a.align;p==="right"&&(f[0]-=h),p==="center"&&(f[0]-=h/2);var m=a.verticalAlign;m==="bottom"&&(f[1]-=d),m==="middle"&&(f[1]-=d/2),zL(f,h,d,n);var g=s.get("backgroundColor");(!g||g==="auto")&&(g=e.get(["axisLine","lineStyle","color"])),t.label={x:f[0],y:f[1],style:wi(s,{text:o,font:c,fill:s.getTextColor(),padding:l,backgroundColor:g}),z2:10}}function zL(t,e,r,n){var a=n.getWidth(),i=n.getHeight();t[0]=Math.min(t[0]+e,a)-e,t[1]=Math.min(t[1]+r,i)-r,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}function tx(t,e,r,n,a){t=e.scale.parse(t);var i=e.scale.getLabel({value:t},{precision:a.precision}),o=a.formatter;if(o){var s={value:Uh(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};I(n,function(l){var c=r.getSeriesByIndex(l.seriesIndex),u=l.dataIndexInside,f=c&&c.getDataParams(u);f&&s.seriesData.push(f)}),ae(o)?i=o.replace("{value}",i):ke(o)&&(i=o(s))}return i}function rx(t,e,r){var n=ai();return Uu(n,n,r.rotation),Vu(n,n,r.position),td([t.dataToCoord(e),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function FL(t,e,r,n,a,i){var o=jn.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=a.get(["label","margin"]),BL(e,n,a,i,{position:rx(n.axis,t,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function HL(t,e,r){return r=r||0,{x1:t[r],y1:t[1-r],x2:e[r],y2:e[1-r]}}function VL(t,e,r){return r=r||0,{x:t[r],y:t[1-r],width:e[r],height:e[1-r]}}var UL=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.grid,c=i.get("type"),u=nx(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(n,!0));if(c&&c!=="none"){var h=NL(i),d=GL[c](s,f,u);d.style=h,r.graphicKey=d.type,r.pointer=d}var p=Wh(l.model,a);FL(n,r,p,a,i,o)},e.prototype.getHandleTransform=function(r,n,a){var i=Wh(n.axis.grid.model,n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=rx(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.grid,l=o.getGlobalExtent(!0),c=nx(s,o).getOtherAxis(o).getGlobalExtent(),u=o.dim==="x"?0:1,f=[r.x,r.y];f[u]+=n[u],f[u]=Math.min(l[1],f[u]),f[u]=Math.max(l[0],f[u]);var h=(c[1]+c[0])/2,d=[h,h];d[u]=f[u];var p=[{verticalAlign:"middle"},{align:"center"}];return{x:f[0],y:f[1],rotation:r.rotation,cursorPoint:d,tooltipOption:p[u]}},e})(OL);function nx(t,e){var r={};return r[e.dim+"AxisIndex"]=e.index,t.getCartesian(r)}var GL={line:function(t,e,r){var n=HL([e,r[0]],[e,r[1]],ax(t));return{type:"Line",subPixelOptimize:!0,shape:n}},shadow:function(t,e,r){var n=Math.max(1,t.getBandWidth()),a=r[1]-r[0];return{type:"Rect",shape:VL([e-n/2,r[0]],[n,a],ax(t))}}};function ax(t){return t.dim==="x"?0:1}var $L=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",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:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e})(Ye),kn=ht(),WL=I;function ix(t,e,r){if(!_e.node){var n=e.getZr();kn(n).records||(kn(n).records={}),qL(n,e);var a=kn(n).records[t]||(kn(n).records[t]={});a.handler=r}}function qL(t,e){if(kn(t).initialized)return;kn(t).initialized=!0,r("click",dt(ox,"click")),r("mousemove",dt(ox,"mousemove")),r("globalout",XL);function r(n,a){t.on(n,function(i){var o=ZL(e);WL(kn(t).records,function(s){s&&a(s,i,o.dispatchAction)}),YL(o.pendings,e)})}}function YL(t,e){var r=t.showTip.length,n=t.hideTip.length,a;r?a=t.showTip[r-1]:n&&(a=t.hideTip[n-1]),a&&(a.dispatchAction=null,e.dispatchAction(a))}function XL(t,e,r){t.handler("leave",null,r)}function ox(t,e,r,n){e.handler(t,r,n)}function ZL(t){var e={showTip:[],hideTip:[]},r=function(n){var a=e[n.type];a?a.push(n):(n.dispatchAction=r,t.dispatchAction(n))};return{dispatchAction:r,pendings:e}}function np(t,e){if(!_e.node){var r=e.getZr(),n=(kn(r).records||{})[t];n&&(kn(r).records[t]=null)}}var KL=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.render=function(r,n,a){var i=n.getComponent("tooltip"),o=r.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";ix("axisPointer",a,function(s,l,c){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&c({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},e.prototype.remove=function(r,n){np("axisPointer",n)},e.prototype.dispose=function(r,n){np("axisPointer",n)},e.type="axisPointer",e})(Nr);function sx(t,e){var r=[],n=t.seriesIndex,a;if(n==null||!(a=e.getSeriesByIndex(n)))return{point:[]};var i=a.getData(),o=Ma(i,t);if(o==null||o<0||ee(o))return{point:[]};var s=i.getItemGraphicEl(o),l=a.coordinateSystem;if(a.getTooltipPosition)r=a.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(t.isStacked){var c=l.getBaseAxis(),u=l.getOtherAxis(c),f=u.dim,h=c.dim,d=f==="x"||f==="radius"?1:0,p=i.mapDimension(h),m=[];m[d]=i.get(p,o),m[1-d]=i.get(i.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(i.getValues(he(l.dimensions,function(v){return i.mapDimension(v)}),o))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),r=[g.x+g.width/2,g.y+g.height/2]}return{point:r,el:s}}var lx=ht();function jL(t,e,r){var n=t.currTrigger,a=[t.x,t.y],i=t,o=t.dispatchAction||Ne(r.dispatchAction,r),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){Xc(a)&&(a=sx({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},e).point);var l=Xc(a),c=i.axesInfo,u=s.axesInfo,f=n==="leave"||Xc(a),h={},d={},p={list:[],map:{}},m={showPointer:dt(QL,d),showTooltip:dt(eP,p)};I(s.coordSysMap,function(v,y){var b=l||v.containPoint(a);I(s.coordSysAxesInfo[y],function(x,w){var S=x.axis,k=aP(c,x);if(!f&&b&&(!c||k)){var C=k&&k.value;C==null&&!l&&(C=S.pointToData(a)),C!=null&&cx(x,C,m,!1,h)}})});var g={};return I(u,function(v,y){var b=v.linkGroup;b&&!d[y]&&I(b.axesInfo,function(x,w){var S=d[w];if(x!==v&&S){var k=S.value;b.mapper&&(k=v.axis.scale.parse(b.mapper(k,ux(x),ux(v)))),g[v.key]=k}})}),I(g,function(v,y){cx(u[y],v,m,!0,h)}),tP(d,u,h),rP(p,a,t,o),nP(u,o,r),h}}function cx(t,e,r,n,a){var i=t.axis;if(!(i.scale.isBlank()||!i.containData(e))){if(!t.involveSeries){r.showPointer(t,e);return}var o=JL(e,t),s=o.payloadBatch,l=o.snapToValue;s[0]&&a.seriesIndex==null&&q(a,s[0]),!n&&t.snap&&i.containData(l)&&l!=null&&(e=l),r.showPointer(t,e,s),r.showTooltip(t,o,l)}}function JL(t,e){var r=e.axis,n=r.dim,a=t,i=[],o=Number.MAX_VALUE,s=-1;return I(e.seriesModels,function(l,c){var u=l.getData().mapDimensionsAll(n),f,h;if(l.getAxisTooltipData){var d=l.getAxisTooltipData(u,t,r);h=d.dataIndices,f=d.nestestValue}else{if(h=l.getData().indicesOfNearest(u[0],t,r.type==="category"?.5:null),!h.length)return;f=l.getData().get(u[0],h[0])}if(!(f==null||!isFinite(f))){var p=t-f,m=Math.abs(p);m<=o&&((m<o||p>=0&&s<0)&&(o=m,s=p,a=f,i.length=0),I(h,function(g){i.push({seriesIndex:l.seriesIndex,dataIndexInside:g,dataIndex:l.getData().getRawIndex(g)})}))}}),{payloadBatch:i,snapToValue:a}}function QL(t,e,r,n){t[e.key]={value:r,payloadBatch:n}}function eP(t,e,r,n){var a=r.payloadBatch,i=e.axis,o=i.model,s=e.axisPointerModel;if(!(!e.triggerTooltip||!a.length)){var l=e.coordSys.model,c=os(l),u=t.map[c];u||(u=t.map[c]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(u)),u.dataByAxis.push({axisDim:i.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:a.slice()})}}function tP(t,e,r){var n=r.axesInfo=[];I(e,function(a,i){var o=a.axisPointerModel.option,s=t[i];s?(!a.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!a.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:a.axis.dim,axisIndex:a.axis.model.componentIndex,value:o.value})})}function rP(t,e,r,n){if(Xc(e)||!t.list.length){n({type:"hideTip"});return}var a=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:r.tooltipOption,position:r.position,dataIndexInside:a.dataIndexInside,dataIndex:a.dataIndex,seriesIndex:a.seriesIndex,dataByCoordSys:t.list})}function nP(t,e,r){var n=r.getZr(),a="axisPointerLastHighlights",i=lx(n)[a]||{},o=lx(n)[a]={};I(t,function(c,u){var f=c.axisPointerModel.option;f.status==="show"&&c.triggerEmphasis&&I(f.seriesDataIndices,function(h){var d=h.seriesIndex+" | "+h.dataIndex;o[d]=h})});var s=[],l=[];I(i,function(c,u){!o[u]&&l.push(c)}),I(o,function(c,u){!i[u]&&s.push(c)}),l.length&&r.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&r.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function aP(t,e){for(var r=0;r<(t||[]).length;r++){var n=t[r];if(e.axis.dim===n.axisDim&&e.axis.model.componentIndex===n.axisIndex)return n}}function ux(t){var e=t.axis.model,r={},n=r.axisDim=t.axis.dim;return r.axisIndex=r[n+"AxisIndex"]=e.componentIndex,r.axisName=r[n+"AxisName"]=e.name,r.axisId=r[n+"AxisId"]=e.id,r}function Xc(t){return!t||t[0]==null||isNaN(t[0])||t[1]==null||isNaN(t[1])}function fx(t){Gb.registerAxisPointerClass("CartesianAxisPointer",UL),t.registerComponentModel($L),t.registerComponentView(KL),t.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var r=e.axisPointer.link;r&&!ee(r)&&(e.axisPointer.link=[r])}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,function(e,r){e.getComponent("axisPointer").coordSysAxesInfo=yL(e,r)}),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},jL)}function iP(t){Zn(PL),Zn(fx)}var dx=["x","y","radius","angle","single"],oP=["cartesian2d","polar","singleAxis"];function sP(t){var e=t.get("coordinateSystem");return Ue(oP,e)>=0}function Ga(t){return t+"Axis"}function lP(t,e){var r=me(),n=[],a=me();t.eachComponent({mainType:"dataZoom",query:e},function(u){a.get(u.uid)||s(u)});var i;do i=!1,t.eachComponent("dataZoom",o);while(i);function o(u){!a.get(u.uid)&&l(u)&&(s(u),i=!0)}function s(u){a.set(u.uid,!0),n.push(u),c(u)}function l(u){var f=!1;return u.eachTargetAxis(function(h,d){var p=r.get(h);p&&p[d]&&(f=!0)}),f}function c(u){u.eachTargetAxis(function(f,h){(r.get(f)||r.set(f,[]))[h]=!0})}return n}function cP(t){var e=t.ecModel,r={infoList:[],infoMap:me()};return t.eachTargetAxis(function(n,a){var i=e.getComponent(Ga(n),a);if(i){var o=i.getCoordSysModel();if(o){var s=o.uid,l=r.infoMap.get(s);l||(l={model:o,axisModels:[]},r.infoList.push(l),r.infoMap.set(s,l)),l.axisModels.push(i)}}}),r}var ap=(function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},t})(),hx=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r._autoThrottle=!0,r._noTarget=!0,r._rangePropMode=["percent","percent"],r}return e.prototype.init=function(r,n,a){var i=px(r);this.settledOption=i,this.mergeDefaultAndTheme(r,a),this._doInit(i)},e.prototype.mergeOption=function(r){var n=px(r);Oe(this.option,r,!0),Oe(this.settledOption,n,!0),this._doInit(n)},e.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var a=this.settledOption;I([["start","startValue"],["end","endValue"]],function(i,o){this._rangePropMode[o]==="value"&&(n[i[0]]=a[i[0]]=null)},this),this._resetTarget()},e.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=me(),a=this._fillSpecifiedTargetAxis(n);a?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(i){i.indexList.length&&(this._noTarget=!1)},this)},e.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return I(dx,function(a){var i=this.getReferringComponents(Ga(a),Fk);if(i.specified){n=!0;var o=new ap;I(i.models,function(s){o.add(s.componentIndex)}),r.set(a,o)}},this),n},e.prototype._fillAutoTargetAxisByOrient=function(r,n){var a=this.ecModel,i=!0;if(i){var o=n==="vertical"?"y":"x",s=a.findComponents({mainType:o+"Axis"});l(s,o)}if(i){var s=a.findComponents({mainType:"singleAxis",filter:function(u){return u.get("orient",!0)===n}});l(s,"single")}function l(c,u){var f=c[0];if(f){var h=new ap;if(h.add(f.componentIndex),r.set(u,h),i=!1,u==="x"||u==="y"){var d=f.getReferringComponents("grid",qt).models[0];d&&I(c,function(p){f.componentIndex!==p.componentIndex&&d===p.getReferringComponents("grid",qt).models[0]&&h.add(p.componentIndex)})}}}i&&I(dx,function(c){if(i){var u=a.findComponents({mainType:Ga(c),filter:function(h){return h.get("type",!0)==="category"}});if(u[0]){var f=new ap;f.add(u[0].componentIndex),r.set(c,f),i=!1}}},this)},e.prototype._makeAutoOrientByTargetAxis=function(){var r;return this.eachTargetAxis(function(n){!r&&(r=n)},this),r==="y"?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(r){if(r.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var n=this.ecModel.option;this.option.throttle=n.animation&&n.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(r){var n=this._rangePropMode,a=this.get("rangeMode");I([["start","startValue"],["end","endValue"]],function(i,o){var s=r[i[0]]!=null,l=r[i[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":a?n[o]=a[o]:s&&(n[o]="percent")})},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,a){r==null&&(r=this.ecModel.getComponent(Ga(n),a))},this),r},e.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(a,i){I(a.indexList,function(o){r.call(n,i,o)})})},e.prototype.getAxisProxy=function(r,n){var a=this.getAxisModel(r,n);if(a)return a.__dzAxisProxy},e.prototype.getAxisModel=function(r,n){var a=this._targetAxisInfoMap.get(r);if(a&&a.indexMap[n])return this.ecModel.getComponent(Ga(r),n)},e.prototype.setRawRange=function(r){var n=this.option,a=this.settledOption;I([["start","startValue"],["end","endValue"]],function(i){(r[i[0]]!=null||r[i[1]]!=null)&&(n[i[0]]=a[i[0]]=r[i[0]],n[i[1]]=a[i[1]]=r[i[1]])},this),this._updateRangeUse(r)},e.prototype.setCalculatedRange=function(r){var n=this.option;I(["start","startValue","end","endValue"],function(a){n[a]=r[a]})},e.prototype.getPercentRange=function(){var r=this.findRepresentativeAxisProxy();if(r)return r.getDataPercentWindow()},e.prototype.getValueRange=function(r,n){if(r==null&&n==null){var a=this.findRepresentativeAxisProxy();if(a)return a.getDataValueWindow()}else return this.getAxisProxy(r,n).getDataValueWindow()},e.prototype.findRepresentativeAxisProxy=function(r){if(r)return r.__dzAxisProxy;for(var n,a=this._targetAxisInfoMap.keys(),i=0;i<a.length;i++)for(var o=a[i],s=this._targetAxisInfoMap.get(o),l=0;l<s.indexList.length;l++){var c=this.getAxisProxy(o,s.indexList[l]);if(c.hostedBy(this))return c;n||(n=c)}return n},e.prototype.getRangePropMode=function(){return this._rangePropMode.slice()},e.prototype.getOrient=function(){return this._orient},e.type="dataZoom",e.dependencies=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","series","toolbox"],e.defaultOption={z:4,filterMode:"filter",start:0,end:100},e})(Ye);function px(t){var e={};return I(["start","end","startValue","endValue","throttle"],function(r){t.hasOwnProperty(r)&&(e[r]=t[r])}),e}var uP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.render=function(r,n,a,i){this.dataZoomModel=r,this.ecModel=n,this.api=a},e.type="dataZoom",e})(Nr),Ui=I,vx=xk,fP=(function(){function t(e,r,n,a){this._dimName=e,this._axisIndex=r,this.ecModel=a,this._dataZoomModel=n}return t.prototype.hostedBy=function(e){return this._dataZoomModel===e},t.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},t.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},t.prototype.getTargetSeriesModels=function(){var e=[];return this.ecModel.eachSeries(function(r){if(sP(r)){var n=Ga(this._dimName),a=r.getReferringComponents(n,qt).models[0];a&&this._axisIndex===a.componentIndex&&e.push(r)}},this),e},t.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},t.prototype.getMinMaxSpan=function(){return Ie(this._minMaxSpan)},t.prototype.calculateDataWindow=function(e){var r=this._dataExtent,n=this.getAxisModel(),a=n.axis.scale,i=this._dataZoomModel.getRangePropMode(),o=[0,100],s=[],l=[],c;Ui(["start","end"],function(h,d){var p=e[h],m=e[h+"Value"];i[d]==="percent"?(p==null&&(p=o[d]),m=a.parse(Ca(p,o,r))):(c=!0,m=m==null?r[d]:a.parse(m),p=Ca(m,r,o)),l[d]=m==null||isNaN(m)?r[d]:m,s[d]=p==null||isNaN(p)?o[d]:p}),vx(l),vx(s);var u=this._minMaxSpan;c?f(l,s,r,o,!1):f(s,l,o,r,!0);function f(h,d,p,m,g){var v=g?"Span":"ValueSpan";Qh(0,h,p,"all",u["min"+v],u["max"+v]);for(var y=0;y<2;y++)d[y]=Ca(h[y],p,m,!0),g&&(d[y]=a.parse(d[y]))}return{valueWindow:l,percentWindow:s}},t.prototype.reset=function(e){if(e===this._dataZoomModel){var r=this.getTargetSeriesModels();this._dataExtent=dP(this,this._dimName,r),this._updateMinMaxSpan();var n=this.calculateDataWindow(e.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},t.prototype.filterData=function(e,r){if(e!==this._dataZoomModel)return;var n=this._dimName,a=this.getTargetSeriesModels(),i=e.get("filterMode"),o=this._valueWindow;if(i==="none")return;Ui(a,function(l){var c=l.getData(),u=c.mapDimensionsAll(n);if(u.length){if(i==="weakFilter"){var f=c.getStore(),h=he(u,function(d){return c.getDimensionIndex(d)},c);c.filterSelf(function(d){for(var p,m,g,v=0;v<u.length;v++){var y=f.get(h[v],d),b=!isNaN(y),x=y<o[0],w=y>o[1];if(b&&!x&&!w)return!0;b&&(g=!0),x&&(p=!0),w&&(m=!0)}return g&&p&&m})}else Ui(u,function(d){if(i==="empty")l.setData(c=c.map(d,function(m){return s(m)?m:NaN}));else{var p={};p[d]=o,c.selectRange(p)}});Ui(u,function(d){c.setApproximateExtent(o,d)})}});function s(l){return l>=o[0]&&l<=o[1]}},t.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},r=this._dataZoomModel,n=this._dataExtent;Ui(["min","max"],function(a){var i=r.get(a+"Span"),o=r.get(a+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?i=Ca(n[0]+o,n,[0,100],!0):i!=null&&(o=Ca(i,[0,100],n,!0)-n[0]),e[a+"Span"]=i,e[a+"ValueSpan"]=o},this)},t.prototype._setAxisModel=function(){var e=this.getAxisModel(),r=this._percentWindow,n=this._valueWindow;if(r){var a=Sg(n,[0,500]);a=Math.min(a,20);var i=e.axis.scale.rawExtentInfo;r[0]!==0&&i.setDeterminedMinMax("min",+n[0].toFixed(a)),r[1]!==100&&i.setDeterminedMinMax("max",+n[1].toFixed(a)),i.freeze()}},t})();function dP(t,e,r){var n=[1/0,-1/0];Ui(r,function(o){KI(n,o.getData(),e)});var a=t.getAxisModel(),i=_b(a.axis.scale,a,n).calculate();return[i.min,i.max]}var hP={getTargetSeries:function(t){function e(a){t.eachComponent("dataZoom",function(i){i.eachTargetAxis(function(o,s){var l=t.getComponent(Ga(o),s);a(o,s,l,i)})})}e(function(a,i,o,s){o.__dzAxisProxy=null});var r=[];e(function(a,i,o,s){o.__dzAxisProxy||(o.__dzAxisProxy=new fP(a,i,s,t),r.push(o.__dzAxisProxy))});var n=me();return I(r,function(a){I(a.getTargetSeriesModels(),function(i){n.set(i.uid,i)})}),n},overallReset:function(t,e){t.eachComponent("dataZoom",function(r){r.eachTargetAxis(function(n,a){r.getAxisProxy(n,a).reset(r)}),r.eachTargetAxis(function(n,a){r.getAxisProxy(n,a).filterData(r,e)})}),t.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var a=n.getDataPercentWindow(),i=n.getDataValueWindow();r.setCalculatedRange({start:a[0],end:a[1],startValue:i[0],endValue:i[1]})}})}};function pP(t){t.registerAction("dataZoom",function(e,r){var n=lP(r,e);I(n,function(a){a.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var gx=!1;function vP(t){gx||(gx=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,hP),pP(t),t.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function gP(t,e){var r=fc(e.get("padding")),n=e.getItemStyle(["color","opacity"]);return n.fill=e.get("backgroundColor"),t=new _t({shape:{x:t.x-r[3],y:t.y-r[0],width:t.width+r[1]+r[3],height:t.height+r[0]+r[2],r:e.get("borderRadius")},style:n,silent:!0,z2:-1}),t}var mP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e})(Ye);function mx(t){var e=t.get("confine");return e!=null?!!e:t.get("renderMode")==="richText"}function yx(t){if(_e.domSupported){for(var e=document.documentElement.style,r=0,n=t.length;r<n;r++)if(t[r]in e)return t[r]}}var _x=yx(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),yP=yx(["webkitTransition","transition","OTransition","MozTransition","msTransition"]);function bx(t,e){if(!t)return e;e=ky(e,!0);var r=t.indexOf(e);return t=r===-1?e:"-"+t.slice(0,r)+"-"+e,t.toLowerCase()}function _P(t,e){var r=t.currentStyle||document.defaultView&&document.defaultView.getComputedStyle(t);return r?r[e]:null}var bP=bx(yP,"transition"),ip=bx(_x,"transform"),xP="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(_e.transform3dSupported?"will-change:transform;":"");function wP(t){return t=t==="left"?"right":t==="right"?"left":t==="top"?"bottom":"top",t}function SP(t,e,r){if(!ae(r)||r==="inside")return"";var n=t.get("backgroundColor"),a=t.get("borderWidth");e=Oa(e);var i=wP(r),o=Math.max(Math.round(a)*1.5,6),s="",l=ip+":",c;Ue(["left","right"],i)>-1?(s+="top:50%",l+="translateY(-50%) rotate("+(c=i==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(c=i==="top"?225:45)+"deg)");var u=c*Math.PI/180,f=o+a,h=f*Math.abs(Math.cos(u))+f*Math.abs(Math.sin(u)),d=Math.round(((h-Math.SQRT2*a)/2+Math.SQRT2*a-(h-f)/2)*100)/100;s+=";"+i+":-"+d+"px";var p=e+" solid "+a+"px;",m=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+p,"border-right:"+p,"background-color:"+n+";"];return'<div style="'+m.join("")+'"></div>'}function kP(t,e){var r="cubic-bezier(0.23,1,0.32,1)",n=" "+t/2+"s "+r,a="opacity"+n+",visibility"+n;return e||(n=" "+t+"s "+r,a+=_e.transformSupported?","+ip+n:",left"+n+",top"+n),bP+":"+a}function xx(t,e,r){var n=t.toFixed(0)+"px",a=e.toFixed(0)+"px";if(!_e.transformSupported)return r?"top:"+a+";left:"+n+";":[["top",a],["left",n]];var i=_e.transform3dSupported,o="translate"+(i?"3d":"")+"("+n+","+a+(i?",0":"")+")";return r?"top:0;left:0;"+ip+":"+o+";":[["top",0],["left",0],[_x,o]]}function TP(t){var e=[],r=t.get("fontSize"),n=t.getTextColor();n&&e.push("color:"+n),e.push("font:"+t.getFont());var a=Pe(t.get("lineHeight"),Math.round(r*3/2));r&&e.push("line-height:"+a+"px");var i=t.get("textShadowColor"),o=t.get("textShadowBlur")||0,s=t.get("textShadowOffsetX")||0,l=t.get("textShadowOffsetY")||0;return i&&o&&e.push("text-shadow:"+s+"px "+l+"px "+o+"px "+i),I(["decoration","align"],function(c){var u=t.get(c);u&&e.push("text-"+c+":"+u)}),e.join(";")}function CP(t,e,r){var n=[],a=t.get("transitionDuration"),i=t.get("backgroundColor"),o=t.get("shadowBlur"),s=t.get("shadowColor"),l=t.get("shadowOffsetX"),c=t.get("shadowOffsetY"),u=t.getModel("textStyle"),f=Hy(t,"html"),h=l+"px "+c+"px "+o+"px "+s;return n.push("box-shadow:"+h),e&&a&&n.push(kP(a,r)),i&&n.push("background-color:"+i),I(["width","color","radius"],function(d){var p="border-"+d,m=ky(p),g=t.get(m);g!=null&&n.push(p+":"+g+(d==="color"?"":"px"))}),n.push(TP(u)),f!=null&&n.push("padding:"+fc(f).join("px ")+"px"),n.join(";")+";"}function Sx(t,e,r,n,a){var i=e&&e.painter;if(r){var o=i&&i.getViewportRoot();o&&rC(t,o,r,n,a)}else{t[0]=n,t[1]=a;var s=i&&i.getViewportRootOffset();s&&(t[0]+=s.offsetLeft,t[1]+=s.offsetTop)}t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}var MP=(function(){function t(e,r){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,_e.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var a=this._zr=e.getZr(),i=r.appendTo,o=i&&(ae(i)?document.querySelector(i):no(i)?i:ke(i)&&i(e.getDom()));Sx(this._styleCoord,a,o,e.getWidth()/2,e.getHeight()/2),(o||e.getDom()).appendChild(n),this._api=e,this._container=o;var s=this;n.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},n.onmousemove=function(l){if(l=l||window.event,!s._enterable){var c=a.handler,u=a.painter.getViewportRoot();br(u,l,!0),c.dispatch("mousemove",l)}},n.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return t.prototype.update=function(e){if(!this._container){var r=this._api.getDom(),n=_P(r,"position"),a=r.style;a.position!=="absolute"&&n!=="absolute"&&(a.position="relative")}var i=e.get("alwaysShowContent");i&&this._moveIfResized(),this._alwaysShowContent=i,this.el.className=e.get("className")||""},t.prototype.show=function(e,r){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,a=n.style,i=this._styleCoord;n.innerHTML?a.cssText=xP+CP(e,!this._firstShow,this._longHide)+xx(i[0],i[1],!0)+("border-color:"+Oa(r)+";")+(e.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):a.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},t.prototype.setContent=function(e,r,n,a,i){var o=this.el;if(e==null){o.innerHTML="";return}var s="";if(ae(i)&&n.get("trigger")==="item"&&!mx(n)&&(s=SP(n,a,i)),ae(e))o.innerHTML=e+s;else if(e){o.innerHTML="",ee(e)||(e=[e]);for(var l=0;l<e.length;l++)no(e[l])&&e[l].parentNode!==o&&o.appendChild(e[l]);if(s&&o.childNodes.length){var c=document.createElement("div");c.innerHTML=s,o.appendChild(c)}}},t.prototype.setEnterable=function(e){this._enterable=e},t.prototype.getSize=function(){var e=this.el;return e?[e.offsetWidth,e.offsetHeight]:[0,0]},t.prototype.moveTo=function(e,r){if(this.el){var n=this._styleCoord;if(Sx(n,this._zr,this._container,e,r),n[0]!=null&&n[1]!=null){var a=this.el.style,i=xx(n[0],n[1]);I(i,function(o){a[o[0]]=o[1]})}}},t.prototype._moveIfResized=function(){var e=this._styleCoord[2],r=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),r*this._zr.getHeight())},t.prototype.hide=function(){var e=this,r=this.el.style;r.visibility="hidden",r.opacity="0",_e.transform3dSupported&&(r.willChange=""),this._show=!1,this._longHideTimeout=setTimeout(function(){return e._longHide=!0},500)},t.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(Ne(this.hide,this),e)):this.hide())},t.prototype.isShow=function(){return this._show},t.prototype.dispose=function(){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var e=this.el.parentNode;e&&e.removeChild(this.el),this.el=this._container=null},t})(),AP=(function(){function t(e){this._show=!1,this._styleCoord=[0,0,0,0],this._alwaysShowContent=!1,this._enterable=!0,this._zr=e.getZr(),Tx(this._styleCoord,this._zr,e.getWidth()/2,e.getHeight()/2)}return t.prototype.update=function(e){var r=e.get("alwaysShowContent");r&&this._moveIfResized(),this._alwaysShowContent=r},t.prototype.show=function(){this._hideTimeout&&clearTimeout(this._hideTimeout),this.el.show(),this._show=!0},t.prototype.setContent=function(e,r,n,a,i){var o=this;de(e)&&Wt(""),this.el&&this._zr.remove(this.el);var s=n.getModel("textStyle");this.el=new $t({style:{rich:r.richTextStyles,text:e,lineHeight:22,borderWidth:1,borderColor:a,textShadowColor:s.get("textShadowColor"),fill:n.get(["textStyle","color"]),padding:Hy(n,"richText"),verticalAlign:"top",align:"left"},z:n.get("z")}),I(["backgroundColor","borderRadius","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"],function(c){o.el.style[c]=n.get(c)}),I(["textShadowBlur","textShadowOffsetX","textShadowOffsetY"],function(c){o.el.style[c]=s.get(c)||0}),this._zr.add(this.el);var l=this;this.el.on("mouseover",function(){l._enterable&&(clearTimeout(l._hideTimeout),l._show=!0),l._inContent=!0}),this.el.on("mouseout",function(){l._enterable&&l._show&&l.hideLater(l._hideDelay),l._inContent=!1})},t.prototype.setEnterable=function(e){this._enterable=e},t.prototype.getSize=function(){var e=this.el,r=this.el.getBoundingRect(),n=kx(e.style);return[r.width+n.left+n.right,r.height+n.top+n.bottom]},t.prototype.moveTo=function(e,r){var n=this.el;if(n){var a=this._styleCoord;Tx(a,this._zr,e,r),e=a[0],r=a[1];var i=n.style,o=Jn(i.borderWidth||0),s=kx(i);n.x=e+o+s.left,n.y=r+o+s.top,n.markRedraw()}},t.prototype._moveIfResized=function(){var e=this._styleCoord[2],r=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),r*this._zr.getHeight())},t.prototype.hide=function(){this.el&&this.el.hide(),this._show=!1},t.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(Ne(this.hide,this),e)):this.hide())},t.prototype.isShow=function(){return this._show},t.prototype.dispose=function(){this._zr.remove(this.el)},t})();function Jn(t){return Math.max(0,t)}function kx(t){var e=Jn(t.shadowBlur||0),r=Jn(t.shadowOffsetX||0),n=Jn(t.shadowOffsetY||0);return{left:Jn(e-r),right:Jn(e+r),top:Jn(e-n),bottom:Jn(e+n)}}function Tx(t,e,r,n){t[0]=r,t[1]=n,t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}var DP=new _t({shape:{x:-1,y:-1,width:2,height:2}}),IP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.init=function(r,n){if(!(_e.node||!n.getDom())){var a=r.getComponent("tooltip"),i=this._renderMode=Vk(a.get("renderMode"));this._tooltipContent=i==="richText"?new AP(n):new MP(n,{appendTo:a.get("appendToBody",!0)?"body":a.get("appendTo",!0)})}},e.prototype.render=function(r,n,a){if(!(_e.node||!a.getDom())){this.group.removeAll(),this._tooltipModel=r,this._ecModel=n,this._api=a;var i=this._tooltipContent;i.update(r),i.setEnterable(r.get("enterable")),this._initGlobalListener(),this._keepShow(),this._renderMode!=="richText"&&r.get("transitionDuration")?Xd(this,"_updatePosition",50,"fixRate"):Zd(this,"_updatePosition")}},e.prototype._initGlobalListener=function(){var r=this._tooltipModel,n=r.get("triggerOn");ix("itemTooltip",this._api,Ne(function(a,i,o){n!=="none"&&(n.indexOf(a)>=0?this._tryShow(i,o):a==="leave"&&this._hide(o))},this))},e.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,a=this._api,i=r.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&i!=="none"&&i!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!a.isDisposed()&&o.manuallyShowTip(r,n,a,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},e.prototype.manuallyShowTip=function(r,n,a,i){if(!(i.from===this.uid||_e.node||!a.getDom())){var o=Cx(i,a);this._ticket="";var s=i.dataByCoordSys,l=EP(i,n,a);if(l){var c=l.el.getBoundingRect().clone();c.applyTransform(l.el.transform),this._tryShow({offsetX:c.x+c.width/2,offsetY:c.y+c.height/2,target:l.el,position:i.position,positionDefault:"bottom"},o)}else if(i.tooltip&&i.x!=null&&i.y!=null){var u=DP;u.x=i.x,u.y=i.y,u.update(),We(u).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:u},o)}else if(s)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:s,tooltipOption:i.tooltipOption},o);else if(i.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,a,i))return;var f=sx(i,n),h=f.point[0],d=f.point[1];h!=null&&d!=null&&this._tryShow({offsetX:h,offsetY:d,target:f.el,position:i.position,positionDefault:"bottom"},o)}else i.x!=null&&i.y!=null&&(a.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:a.getZr().findHover(i.x,i.y).target},o))}},e.prototype.manuallyHideTip=function(r,n,a,i){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(Cx(i,a))},e.prototype._manuallyAxisShowTip=function(r,n,a,i){var o=i.seriesIndex,s=i.dataIndex,l=n.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var c=n.getSeriesByIndex(o);if(c){var u=c.getData(),f=ss([u.getItemModel(s),c,(c.coordinateSystem||{}).model],this._tooltipModel);if(f.get("trigger")==="axis")return a.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:i.position}),!0}}},e.prototype._tryShow=function(r,n){var a=r.target,i=this._tooltipModel;if(i){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(a){var s=We(a);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,c;Jo(a,function(u){if(We(u).dataIndex!=null)return l=u,!0;if(We(u).tooltipConfig!=null)return c=u,!0},!0),l?this._showSeriesItemTooltip(r,l,n):c?this._showComponentItemTooltip(r,c,n):this._hide(n)}else this._lastDataByCoordSys=null,this._hide(n)}},e.prototype._showOrMove=function(r,n){var a=r.get("showDelay");n=Ne(n,this),clearTimeout(this._showTimout),a>0?this._showTimout=setTimeout(n,a):n()},e.prototype._showAxisTooltip=function(r,n){var a=this._ecModel,i=this._tooltipModel,o=[n.offsetX,n.offsetY],s=ss([n.tooltipOption],i),l=this._renderMode,c=[],u=Go("section",{blocks:[],noHeader:!0}),f=[],h=new Od;I(r,function(y){I(y.dataByAxis,function(b){var x=a.getComponent(b.axisDim+"Axis",b.axisIndex),w=b.value;if(!(!x||w==null)){var S=tx(w,x.axis,a,b.seriesDataIndices,b.valueLabelOpt),k=Go("section",{header:S,noHeader:!Gr(S),sortBlocks:!0,blocks:[]});u.blocks.push(k),I(b.seriesDataIndices,function(C){var A=a.getSeriesByIndex(C.seriesIndex),M=C.dataIndexInside,T=A.getDataParams(M);if(!(T.dataIndex<0)){T.axisDim=b.axisDim,T.axisIndex=b.axisIndex,T.axisType=b.axisType,T.axisId=b.axisId,T.axisValue=Uh(x.axis,{value:w}),T.axisValueLabel=S,T.marker=h.makeTooltipMarker("item",Oa(T.color),l);var D=Iy(A.formatTooltip(M,!0,null)),L=D.frag;if(L){var R=ss([A],i).get("valueFormatter");k.blocks.push(R?q({valueFormatter:R},L):L)}D.text&&f.push(D.text),c.push(T)}})}})}),u.blocks.reverse(),f.reverse();var d=n.position,p=s.get("order"),m=zy(u,h,l,p,a.get("useUTC"),s.get("textStyle"));m&&f.unshift(m);var g=l==="richText"?`
19
-
20
- `:"<br/>",v=f.join(g);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,c)?this._updatePosition(s,d,o[0],o[1],this._tooltipContent,c):this._showTooltipContent(s,v,c,Math.random()+"",o[0],o[1],d,null,h)})},e.prototype._showSeriesItemTooltip=function(r,n,a){var i=this._ecModel,o=We(n),s=o.seriesIndex,l=i.getSeriesByIndex(s),c=o.dataModel||l,u=o.dataIndex,f=o.dataType,h=c.getData(f),d=this._renderMode,p=r.positionDefault,m=ss([h.getItemModel(u),c,l&&(l.coordinateSystem||{}).model],this._tooltipModel,p?{position:p}:null),g=m.get("trigger");if(!(g!=null&&g!=="item")){var v=c.getDataParams(u,f),y=new Od;v.marker=y.makeTooltipMarker("item",Oa(v.color),d);var b=Iy(c.formatTooltip(u,!1,f)),x=m.get("order"),w=m.get("valueFormatter"),S=b.frag,k=S?zy(w?q({valueFormatter:w},S):S,y,d,x,i.get("useUTC"),m.get("textStyle")):b.text,C="item_"+c.name+"_"+u;this._showOrMove(m,function(){this._showTooltipContent(m,k,v,C,r.offsetX,r.offsetY,r.position,r.target,y)}),a({type:"showTip",dataIndexInside:u,dataIndex:h.getRawIndex(u),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(r,n,a){var i=this._renderMode==="html",o=We(n),s=o.tooltipConfig,l=s.option||{},c=l.encodeHTMLContent;if(ae(l)){var u=l;l={content:u,formatter:u},c=!0}c&&i&&l.content&&(l=Ie(l),l.content=Zt(l.content));var f=[l],h=this._ecModel.getComponent(o.componentMainType,o.componentIndex);h&&f.push(h),f.push({formatter:l.content});var d=r.positionDefault,p=ss(f,this._tooltipModel,d?{position:d}:null),m=p.get("content"),g=Math.random()+"",v=new Od;this._showOrMove(p,function(){var y=Ie(p.get("formatterParams")||{});this._showTooltipContent(p,m,y,g,r.offsetX,r.offsetY,r.position,n,v)}),a({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(r,n,a,i,o,s,l,c,u){if(this._ticket="",!(!r.get("showContent")||!r.get("show"))){var f=this._tooltipContent;f.setEnterable(r.get("enterable"));var h=r.get("formatter");l=l||r.get("position");var d=n,p=this._getNearestPoint([o,s],a,r.get("trigger"),r.get("borderColor")),m=p.color;if(h)if(ae(h)){var g=r.ecModel.get("useUTC"),v=ee(a)?a[0]:a,y=v&&v.axisType&&v.axisType.indexOf("time")>=0;d=h,y&&(d=oc(v.axisValue,d,g)),d=Cy(d,a,!0)}else if(ke(h)){var b=Ne(function(x,w){x===this._ticket&&(f.setContent(w,u,r,m,l),this._updatePosition(r,l,o,s,f,a,c))},this);this._ticket=i,d=h(a,i,b)}else d=h;f.setContent(d,u,r,m,l),f.show(r,m),this._updatePosition(r,l,o,s,f,a,c)}},e.prototype._getNearestPoint=function(r,n,a,i){if(a==="axis"||ee(n))return{color:i||(this._renderMode==="html"?"#fff":"none")};if(!ee(n))return{color:i||n.color||n.borderColor}},e.prototype._updatePosition=function(r,n,a,i,o,s,l){var c=this._api.getWidth(),u=this._api.getHeight();n=n||r.get("position");var f=o.getSize(),h=r.get("align"),d=r.get("verticalAlign"),p=l&&l.getBoundingRect().clone();if(l&&p.applyTransform(l.transform),ke(n)&&(n=n([a,i],s,o.el,p,{viewSize:[c,u],contentSize:f.slice()})),ee(n))a=Nt(n[0],c),i=Nt(n[1],u);else if(de(n)){var m=n;m.width=f[0],m.height=f[1];var g=pc(m,{width:c,height:u});a=g.x,i=g.y,h=null,d=null}else if(ae(n)&&l){var v=RP(n,p,f,r.get("borderWidth"));a=v[0],i=v[1]}else{var v=LP(a,i,o,c,u,h?null:20,d?null:20);a=v[0],i=v[1]}if(h&&(a-=Mx(h)?f[0]/2:h==="right"?f[0]:0),d&&(i-=Mx(d)?f[1]/2:d==="bottom"?f[1]:0),mx(r)){var v=PP(a,i,o,c,u);a=v[0],i=v[1]}o.moveTo(a,i)},e.prototype._updateContentNotChangedOnAxis=function(r,n){var a=this._lastDataByCoordSys,i=this._cbParamsList,o=!!a&&a.length===r.length;return o&&I(a,function(s,l){var c=s.dataByAxis||[],u=r[l]||{},f=u.dataByAxis||[];o=o&&c.length===f.length,o&&I(c,function(h,d){var p=f[d]||{},m=h.seriesDataIndices||[],g=p.seriesDataIndices||[];o=o&&h.value===p.value&&h.axisType===p.axisType&&h.axisId===p.axisId&&m.length===g.length,o&&I(m,function(v,y){var b=g[y];o=o&&v.seriesIndex===b.seriesIndex&&v.dataIndex===b.dataIndex}),i&&I(h.seriesDataIndices,function(v){var y=v.seriesIndex,b=n[y],x=i[y];b&&x&&x.data!==b.data&&(o=!1)})})}),this._lastDataByCoordSys=r,this._cbParamsList=n,!!o},e.prototype._hide=function(r){this._lastDataByCoordSys=null,r({type:"hideTip",from:this.uid})},e.prototype.dispose=function(r,n){_e.node||!n.getDom()||(Zd(this,"_updatePosition"),this._tooltipContent.dispose(),np("itemTooltip",n))},e.type="tooltip",e})(Nr);function ss(t,e,r){var n=e.ecModel,a;r?(a=new lt(r,n,n),a=new lt(e.option,a,n)):a=e;for(var i=t.length-1;i>=0;i--){var o=t[i];o&&(o instanceof lt&&(o=o.get("tooltip",!0)),ae(o)&&(o={formatter:o}),o&&(a=new lt(o,a,n)))}return a}function Cx(t,e){return t.dispatchAction||Ne(e.dispatchAction,e)}function LP(t,e,r,n,a,i,o){var s=r.getSize(),l=s[0],c=s[1];return i!=null&&(t+l+i+2>n?t-=l+i:t+=i),o!=null&&(e+c+o>a?e-=c+o:e+=o),[t,e]}function PP(t,e,r,n,a){var i=r.getSize(),o=i[0],s=i[1];return t=Math.min(t+o,n)-o,e=Math.min(e+s,a)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function RP(t,e,r,n){var a=r[0],i=r[1],o=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,c=e.width,u=e.height;switch(t){case"inside":s=e.x+c/2-a/2,l=e.y+u/2-i/2;break;case"top":s=e.x+c/2-a/2,l=e.y-i-o;break;case"bottom":s=e.x+c/2-a/2,l=e.y+u+o;break;case"left":s=e.x-a-o,l=e.y+u/2-i/2;break;case"right":s=e.x+c+o,l=e.y+u/2-i/2}return[s,l]}function Mx(t){return t==="center"||t==="middle"}function EP(t,e,r){var n=Lf(t).queryOptionMap,a=n.keys()[0];if(!(!a||a==="series")){var i=ko(e,a,n.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=i.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(c){var u=We(c).tooltipConfig;if(u&&u.name===t.name)return l=c,!0}),l)return{componentMainType:a,componentIndex:o.componentIndex,el:l}}}}function OP(t){Zn(fx),t.registerComponentModel(mP),t.registerComponentView(IP),t.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Et),t.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Et)}var NP=function(t,e){if(e==="all")return{type:"all",title:t.getLocaleModel().get(["legend","selector","all"])};if(e==="inverse")return{type:"inverse",title:t.getLocaleModel().get(["legend","selector","inverse"])}},op=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.layoutMode={type:"box",ignoreSize:!0},r}return e.prototype.init=function(r,n,a){this.mergeDefaultAndTheme(r,a),r.selected=r.selected||{},this._updateSelector(r)},e.prototype.mergeOption=function(r,n){t.prototype.mergeOption.call(this,r,n),this._updateSelector(r)},e.prototype._updateSelector=function(r){var n=r.selector,a=this.ecModel;n===!0&&(n=r.selector=["all","inverse"]),ee(n)&&I(n,function(i,o){ae(i)&&(i={type:i}),n[o]=Oe(i,NP(a,i.type))})},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var r=this._data;if(r[0]&&this.get("selectedMode")==="single"){for(var n=!1,a=0;a<r.length;a++){var i=r[a].get("name");if(this.isSelected(i)){this.select(i),n=!0;break}}!n&&this.select(r[0].get("name"))}},e.prototype._updateData=function(r){var n=[],a=[];r.eachRawSeries(function(l){var c=l.name;a.push(c);var u;if(l.legendVisualProvider){var f=l.legendVisualProvider,h=f.getAllNames();r.isSeriesFiltered(l)||(a=a.concat(h)),h.length?n=n.concat(h):u=!0}else u=!0;u&&Df(l)&&n.push(l.name)}),this._availableNames=a;var i=this.get("data")||n,o=me(),s=he(i,function(l){return(ae(l)||et(l))&&(l={name:l}),o.get(l.name)?null:(o.set(l.name,!0),new lt(l,this,this.ecModel))},this);this._data=bt(s,function(l){return!!l})},e.prototype.getData=function(){return this._data},e.prototype.select=function(r){var n=this.option.selected,a=this.get("selectedMode");if(a==="single"){var i=this._data;I(i,function(o){n[o.get("name")]=!1})}n[r]=!0},e.prototype.unSelect=function(r){this.get("selectedMode")!=="single"&&(this.option.selected[r]=!1)},e.prototype.toggleSelected=function(r){var n=this.option.selected;n.hasOwnProperty(r)||(n[r]=!0),this[n[r]?"unSelect":"select"](r)},e.prototype.allSelect=function(){var r=this._data,n=this.option.selected;I(r,function(a){n[a.get("name",!0)]=!0})},e.prototype.inverseSelect=function(){var r=this._data,n=this.option.selected;I(r,function(a){var i=a.get("name",!0);n.hasOwnProperty(i)||(n[i]=!0),n[i]=!n[i]})},e.prototype.isSelected=function(r){var n=this.option.selected;return!(n.hasOwnProperty(r)&&!n[r])&&Ue(this._availableNames,r)>=0},e.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",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:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e})(Ye),Gi=dt,sp=I,Zc=St,Ax=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.newlineDisabled=!1,r}return e.prototype.init=function(){this.group.add(this._contentGroup=new Zc),this.group.add(this._selectorGroup=new Zc),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(r,n,a){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!r.get("show",!0)){var o=r.get("align"),s=r.get("orient");(!o||o==="auto")&&(o=r.get("left")==="right"&&s==="vertical"?"right":"left");var l=r.get("selector",!0),c=r.get("selectorPosition",!0);l&&(!c||c==="auto")&&(c=s==="horizontal"?"end":"start"),this.renderInner(o,r,n,a,l,s,c);var u=r.getBoxLayoutParams(),f={width:a.getWidth(),height:a.getHeight()},h=r.get("padding"),d=pc(u,f,h),p=this.layoutInner(r,o,d,i,l,c),m=pc(He({width:p.width,height:p.height},u),f,h);this.group.x=m.x-p.x,this.group.y=m.y-p.y,this.group.markRedraw(),this.group.add(this._backgroundEl=gP(p,r))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(r,n,a,i,o,s,l){var c=this.getContentGroup(),u=me(),f=n.get("selectedMode"),h=[];a.eachRawSeries(function(d){!d.get("legendHoverLink")&&h.push(d.id)}),sp(n.getData(),function(d,p){var m=d.get("name");if(!this.newlineDisabled&&(m===""||m===`
21
- `)){var g=new Zc;g.newline=!0,c.add(g);return}var v=a.getSeriesByName(m)[0];if(!u.get(m))if(v){var y=v.getData(),b=y.getVisual("legendLineStyle")||{},x=y.getVisual("legendIcon"),w=y.getVisual("style"),S=this._createItem(v,m,p,d,n,r,b,w,x,f,i);S.on("click",Gi(Dx,m,null,i,h)).on("mouseover",Gi(lp,v.name,null,i,h)).on("mouseout",Gi(cp,v.name,null,i,h)),a.ssr&&S.eachChild(function(k){var C=We(k);C.seriesIndex=v.seriesIndex,C.dataIndex=p,C.ssrType="legend"}),u.set(m,!0)}else a.eachRawSeries(function(k){if(!u.get(m)&&k.legendVisualProvider){var C=k.legendVisualProvider;if(!C.containName(m))return;var A=C.indexOfName(m),M=C.getItemVisual(A,"style"),T=C.getItemVisual(A,"legendIcon"),D=hn(M.fill);D&&D[3]===0&&(D[3]=.2,M=q(q({},M),{fill:ll(D,"rgba")}));var L=this._createItem(k,m,p,d,n,r,{},M,T,f,i);L.on("click",Gi(Dx,null,m,i,h)).on("mouseover",Gi(lp,null,m,i,h)).on("mouseout",Gi(cp,null,m,i,h)),a.ssr&&L.eachChild(function(R){var O=We(R);O.seriesIndex=k.seriesIndex,O.dataIndex=p,O.ssrType="legend"}),u.set(m,!0)}},this)},this),o&&this._createSelector(o,n,i,s,l)},e.prototype._createSelector=function(r,n,a,i,o){var s=this.getSelectorGroup();sp(r,function(c){var u=c.type,f=new $t({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:u==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(f);var h=n.getModel("selectorLabel"),d=n.getModel(["emphasis","selectorLabel"]);Xl(f,{normal:h,emphasis:d},{defaultText:c.title}),Ff(f)})},e.prototype._createItem=function(r,n,a,i,o,s,l,c,u,f,h){var d=r.visualDrawType,p=o.get("itemWidth"),m=o.get("itemHeight"),g=o.isSelected(n),v=i.get("symbolRotate"),y=i.get("symbolKeepAspect"),b=i.get("icon");u=b||u||"roundRect";var x=BP(u,i,l,c,d,g,h),w=new Zc,S=i.getModel("textStyle");if(ke(r.getLegendIcon)&&(!b||b==="inherit"))w.add(r.getLegendIcon({itemWidth:p,itemHeight:m,icon:u,iconRotate:v,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:y}));else{var k=b==="inherit"&&r.getData().getVisual("symbol")?v==="inherit"?r.getData().getVisual("symbolRotate"):v:0;w.add(zP({itemWidth:p,itemHeight:m,icon:u,iconRotate:k,itemStyle:x.itemStyle,symbolKeepAspect:y}))}var C=s==="left"?p+5:-5,A=s,M=o.get("formatter"),T=n;ae(M)&&M?T=M.replace("{name}",n??""):ke(M)&&(T=M(n));var D=g?S.getTextColor():i.get("inactiveColor");w.add(new $t({style:wi(S,{text:T,x:C,y:m/2,fill:D,align:A,verticalAlign:"middle"},{inheritColor:D})}));var L=new _t({shape:w.getBoundingRect(),style:{fill:"transparent"}}),R=i.getModel("tooltip");return R.get("show")&&Wl({el:L,componentModel:o,itemName:n,itemTooltipOption:R.option}),w.add(L),w.eachChild(function(O){O.silent=!0}),L.silent=!f,this.getContentGroup().add(w),Ff(w),w.__legendDataIndex=a,w},e.prototype.layoutInner=function(r,n,a,i,o,s){var l=this.getContentGroup(),c=this.getSelectorGroup();Ho(r.get("orient"),l,r.get("itemGap"),a.width,a.height);var u=l.getBoundingRect(),f=[-u.x,-u.y];if(c.markRedraw(),l.markRedraw(),o){Ho("horizontal",c,r.get("selectorItemGap",!0));var h=c.getBoundingRect(),d=[-h.x,-h.y],p=r.get("selectorButtonGap",!0),m=r.getOrient().index,g=m===0?"width":"height",v=m===0?"height":"width",y=m===0?"y":"x";s==="end"?d[m]+=u[g]+p:f[m]+=h[g]+p,d[1-m]+=u[v]/2-h[v]/2,c.x=d[0],c.y=d[1],l.x=f[0],l.y=f[1];var b={x:0,y:0};return b[g]=u[g]+p+h[g],b[v]=Math.max(u[v],h[v]),b[y]=Math.min(0,h[y]+d[1-m]),b}else return l.x=f[0],l.y=f[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e})(Nr);function BP(t,e,r,n,a,i,o){function s(g,v){g.lineWidth==="auto"&&(g.lineWidth=v.lineWidth>0?2:0),sp(g,function(y,b){g[b]==="inherit"&&(g[b]=v[b])})}var l=e.getModel("itemStyle"),c=l.getItemStyle(),u=t.lastIndexOf("empty",0)===0?"fill":"stroke",f=l.getShallow("decal");c.decal=!f||f==="inherit"?n.decal:_h(f,o),c.fill==="inherit"&&(c.fill=n[a]),c.stroke==="inherit"&&(c.stroke=n[u]),c.opacity==="inherit"&&(c.opacity=(a==="fill"?n:r).opacity),s(c,n);var h=e.getModel("lineStyle"),d=h.getLineStyle();if(s(d,r),c.fill==="auto"&&(c.fill=n.fill),c.stroke==="auto"&&(c.stroke=n.fill),d.stroke==="auto"&&(d.stroke=n.fill),!i){var p=e.get("inactiveBorderWidth"),m=c[u];c.lineWidth=p==="auto"?n.lineWidth>0&&m?2:0:c.lineWidth,c.fill=e.get("inactiveColor"),c.stroke=e.get("inactiveBorderColor"),d.stroke=h.get("inactiveColor"),d.lineWidth=h.get("inactiveWidth")}return{itemStyle:c,lineStyle:d}}function zP(t){var e=t.icon||"roundRect",r=Ri(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);return r.setStyle(t.itemStyle),r.rotation=(t.iconRotate||0)*Math.PI/180,r.setOrigin([t.itemWidth/2,t.itemHeight/2]),e.indexOf("empty")>-1&&(r.style.stroke=r.style.fill,r.style.fill="#fff",r.style.lineWidth=2),r}function Dx(t,e,r,n){cp(t,e,r,n),r.dispatchAction({type:"legendToggleSelect",name:t??e}),lp(t,e,r,n)}function Ix(t){for(var e=t.getZr().storage.getDisplayList(),r,n=0,a=e.length;n<a&&!(r=e[n].states.emphasis);)n++;return r&&r.hoverLayer}function lp(t,e,r,n){Ix(r)||r.dispatchAction({type:"highlight",seriesName:t,name:e,excludeSeriesId:n})}function cp(t,e,r,n){Ix(r)||r.dispatchAction({type:"downplay",seriesName:t,name:e,excludeSeriesId:n})}function FP(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(r){for(var n=0;n<e.length;n++)if(!e[n].isSelected(r.name))return!1;return!0})}function ls(t,e,r){var n=t==="allSelect"||t==="inverseSelect",a={},i=[];r.eachComponent({mainType:"legend",query:e},function(s){n?s[t]():s[t](e.name),Lx(s,a),i.push(s.componentIndex)});var o={};return r.eachComponent("legend",function(s){I(a,function(l,c){s[l?"select":"unSelect"](c)}),Lx(s,o)}),n?{selected:o,legendIndex:i}:{name:e.name,selected:o}}function Lx(t,e){var r=e||{};return I(t.getData(),function(n){var a=n.get("name");if(!(a===`
22
- `||a==="")){var i=t.isSelected(a);la(r,a)?r[a]=r[a]&&i:r[a]=i}}),r}function HP(t){t.registerAction("legendToggleSelect","legendselectchanged",dt(ls,"toggleSelected")),t.registerAction("legendAllSelect","legendselectall",dt(ls,"allSelect")),t.registerAction("legendInverseSelect","legendinverseselect",dt(ls,"inverseSelect")),t.registerAction("legendSelect","legendselected",dt(ls,"select")),t.registerAction("legendUnSelect","legendunselected",dt(ls,"unSelect"))}function Px(t){t.registerComponentModel(op),t.registerComponentView(Ax),t.registerProcessor(t.PRIORITY.PROCESSOR.SERIES_FILTER,FP),t.registerSubTypeDefaulter("legend",function(){return"plain"}),HP(t)}var VP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.setScrollDataIndex=function(r){this.option.scrollDataIndex=r},e.prototype.init=function(r,n,a){var i=vc(r);t.prototype.init.call(this,r,n,a),Rx(this,r,i)},e.prototype.mergeOption=function(r,n){t.prototype.mergeOption.call(this,r,n),Rx(this,this.option,r)},e.type="legend.scroll",e.defaultOption=yd(op.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:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),e})(op);function Rx(t,e,r){var n=t.getOrient(),a=[1,1];a[n.index]=0,Pi(e,r,{type:"box",ignoreSize:!!a})}var Ex=St,up=["width","height"],fp=["x","y"],UP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.newlineDisabled=!0,r._currentIndex=0,r}return e.prototype.init=function(){t.prototype.init.call(this),this.group.add(this._containerGroup=new Ex),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Ex)},e.prototype.resetInner=function(){t.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},e.prototype.renderInner=function(r,n,a,i,o,s,l){var c=this;t.prototype.renderInner.call(this,r,n,a,i,o,s,l);var u=this._controllerGroup,f=n.get("pageIconSize",!0),h=ee(f)?f:[f,f];p("pagePrev",0);var d=n.getModel("pageTextStyle");u.add(new $t({name:"pageText",style:{text:"xx/xx",fill:d.getTextColor(),font:d.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),p("pageNext",1);function p(m,g){var v=m+"DataIndex",y=rd(n.get("pageIcons",!0)[n.getOrient().name][g],{onclick:Ne(c._pageGo,c,v,n,i)},{x:-h[0]/2,y:-h[1]/2,width:h[0],height:h[1]});y.name=m,u.add(y)}},e.prototype.layoutInner=function(r,n,a,i,o,s){var l=this.getSelectorGroup(),c=r.getOrient().index,u=up[c],f=fp[c],h=up[1-c],d=fp[1-c];o&&Ho("horizontal",l,r.get("selectorItemGap",!0));var p=r.get("selectorButtonGap",!0),m=l.getBoundingRect(),g=[-m.x,-m.y],v=Ie(a);o&&(v[u]=a[u]-m[u]-p);var y=this._layoutContentAndController(r,i,v,c,u,h,d,f);if(o){if(s==="end")g[c]+=y[u]+p;else{var b=m[u]+p;g[c]-=b,y[f]-=b}y[u]+=m[u]+p,g[1-c]+=y[d]+y[h]/2-m[h]/2,y[h]=Math.max(y[h],m[h]),y[d]=Math.min(y[d],m[d]+g[1-c]),l.x=g[0],l.y=g[1],l.markRedraw()}return y},e.prototype._layoutContentAndController=function(r,n,a,i,o,s,l,c){var u=this.getContentGroup(),f=this._containerGroup,h=this._controllerGroup;Ho(r.get("orient"),u,r.get("itemGap"),i?a.width:null,i?null:a.height),Ho("horizontal",h,r.get("pageButtonItemGap",!0));var d=u.getBoundingRect(),p=h.getBoundingRect(),m=this._showController=d[o]>a[o],g=[-d.x,-d.y];n||(g[i]=u[c]);var v=[0,0],y=[-p.x,-p.y],b=Pe(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var x=r.get("pageButtonPosition",!0);x==="end"?y[i]+=a[o]-p[o]:v[i]+=p[o]+b}y[1-i]+=d[s]/2-p[s]/2,u.setPosition(g),f.setPosition(v),h.setPosition(y);var w={x:0,y:0};if(w[o]=m?a[o]:d[o],w[s]=Math.max(d[s],p[s]),w[l]=Math.min(0,p[l]+y[1-i]),f.__rectSize=a[o],m){var S={x:0,y:0};S[o]=Math.max(a[o]-p[o]-b,0),S[s]=w[s],f.setClipPath(new _t({shape:S})),f.__rectSize=S[o]}else h.eachChild(function(C){C.attr({invisible:!0,silent:!0})});var k=this._getPageInfo(r);return k.pageIndex!=null&&or(u,{x:k.contentPosition[0],y:k.contentPosition[1]},m?r:null),this._updatePageInfoView(r,k),w},e.prototype._pageGo=function(r,n,a){var i=this._getPageInfo(n)[r];i!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:n.id})},e.prototype._updatePageInfoView=function(r,n){var a=this._controllerGroup;I(["pagePrev","pageNext"],function(u){var f=u+"DataIndex",h=n[f]!=null,d=a.childOfName(u);d&&(d.setStyle("fill",h?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),d.cursor=h?"pointer":"default")});var i=a.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,c=n.pageCount;i&&o&&i.setStyle("text",ae(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",c==null?"":c+""):o({current:l,total:c}))},e.prototype._getPageInfo=function(r){var n=r.get("scrollDataIndex",!0),a=this.getContentGroup(),i=this._containerGroup.__rectSize,o=r.getOrient().index,s=up[o],l=fp[o],c=this._findTargetItemIndex(n),u=a.children(),f=u[c],h=u.length,d=h?1:0,p={contentPosition:[a.x,a.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!f)return p;var m=x(f);p.contentPosition[o]=-m.s;for(var g=c+1,v=m,y=m,b=null;g<=h;++g)b=x(u[g]),(!b&&y.e>v.s+i||b&&!w(b,v.s))&&(y.i>v.i?v=y:v=b,v&&(p.pageNextDataIndex==null&&(p.pageNextDataIndex=v.i),++p.pageCount)),y=b;for(var g=c-1,v=m,y=m,b=null;g>=-1;--g)b=x(u[g]),(!b||!w(y,b.s))&&v.i<y.i&&(y=v,p.pagePrevDataIndex==null&&(p.pagePrevDataIndex=v.i),++p.pageCount,++p.pageIndex),v=b;return p;function x(S){if(S){var k=S.getBoundingRect(),C=k[l]+S[l];return{s:C,e:C+k[s],i:S.__legendDataIndex}}}function w(S,k){return S.e>=k&&S.s<=k+i}},e.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,a=this.getContentGroup(),i;return a.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===r&&(n=s)}),n??i},e.type="legend.scroll",e})(Ax);function GP(t){t.registerAction("legendScroll","legendscroll",function(e,r){var n=e.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:e},function(a){a.setScrollDataIndex(n)})})}function $P(t){Zn(Px),t.registerComponentModel(VP),t.registerComponentView(UP),GP(t)}function WP(t){Zn(Px),Zn($P)}var qP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="dataZoom.inside",e.defaultOption=yd(hx.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e})(hx),dp=ht();function YP(t,e,r){dp(t).coordSysRecordMap.each(function(n){var a=n.dataZoomInfoMap.get(e.uid);a&&(a.getRange=r)})}function XP(t,e){for(var r=dp(t).coordSysRecordMap,n=r.keys(),a=0;a<n.length;a++){var i=n[a],o=r.get(i),s=o.dataZoomInfoMap;if(s){var l=e.uid,c=s.get(l);c&&(s.removeKey(l),s.keys().length||Ox(r,o))}}}function Ox(t,e){if(e){t.removeKey(e.model.uid);var r=e.controller;r&&r.dispose()}}function ZP(t,e){var r={model:e,containsPoint:dt(jP,e),dispatchAction:dt(KP,t),dataZoomInfoMap:null,controller:null},n=r.controller=new EL(t.getZr());return I(["pan","zoom","scrollMove"],function(a){n.on(a,function(i){var o=[];r.dataZoomInfoMap.each(function(s){if(i.isAvailableBehavior(s.model.option)){var l=(s.getRange||{})[a],c=l&&l(s.dzReferCoordSysInfo,r.model.mainType,r.controller,i);!s.model.get("disabled",!0)&&c&&o.push({dataZoomId:s.model.id,start:c[0],end:c[1]})}}),o.length&&r.dispatchAction(o)})}),r}function KP(t,e){t.isDisposed()||t.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:e})}function jP(t,e,r,n){return t.coordinateSystem.containPoint([r,n])}function JP(t){var e,r="type_",n={type_true:2,type_move:1,type_false:0,type_undefined:-1},a=!0;return t.each(function(i){var o=i.model,s=o.get("disabled",!0)?!1:o.get("zoomLock",!0)?"move":!0;n[r+s]>n[r+e]&&(e=s),a=a&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!a}}}function QP(t){t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,function(e,r){var n=dp(r),a=n.coordSysRecordMap||(n.coordSysRecordMap=me());a.each(function(i){i.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=cP(i);I(o.infoList,function(s){var l=s.model.uid,c=a.get(l)||a.set(l,ZP(r,s.model)),u=c.dataZoomInfoMap||(c.dataZoomInfoMap=me());u.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),a.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var c=l.keys()[0];c!=null&&(s=l.get(c))}if(!s){Ox(a,i);return}var u=JP(l);o.enable(u.controlType,u.opt),o.setPointerChecker(i.containsPoint),Xd(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var eR=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return e.prototype.render=function(r,n,a){if(t.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),YP(a,r,{pan:Ne(hp.pan,this),zoom:Ne(hp.zoom,this),scrollMove:Ne(hp.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),t.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){XP(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e})(uP),hp={zoom:function(t,e,r,n){var a=this.range,i=a.slice(),o=t.axisModels[0];if(o){var s=pp[e](null,[n.originX,n.originY],o,r,t),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(i[1]-i[0])+i[0],c=Math.max(1/n.scale,0);i[0]=(i[0]-l)*c+l,i[1]=(i[1]-l)*c+l;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Qh(0,i,[0,100],0,u.minSpan,u.maxSpan),this.range=i,a[0]!==i[0]||a[1]!==i[1])return i}},pan:Nx(function(t,e,r,n,a,i){var o=pp[n]([i.oldX,i.oldY],[i.newX,i.newY],e,a,r);return o.signal*(t[1]-t[0])*o.pixel/o.pixelLength}),scrollMove:Nx(function(t,e,r,n,a,i){var o=pp[n]([0,0],[i.scrollDelta,i.scrollDelta],e,a,r);return o.signal*(t[1]-t[0])*i.scrollDelta})};function Nx(t){return function(e,r,n,a){var i=this.range,o=i.slice(),s=e.axisModels[0];if(s){var l=t(o,s,e,r,n,a);if(Qh(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var pp={grid:function(t,e,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem.getRect();return t=t||[0,0],i.dim==="x"?(o.pixel=e[0]-t[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=e[1]-t[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(t,e,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),c=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),r.mainType==="radiusAxis"?(o.pixel=e[0]-t[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=i.inverse?1:-1):(o.pixel=e[1]-t[1],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=i.inverse?-1:1),o},singleAxis:function(t,e,r,n,a){var i=r.axis,o=a.model.coordinateSystem.getRect(),s={};return t=t||[0,0],i.orient==="horizontal"?(s.pixel=e[0]-t[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function tR(t){vP(t),t.registerComponentModel(qP),t.registerComponentView(eR),QP(t)}var rR={label:{enabled:!0},decal:{show:!1}},Bx=ht(),nR={};function aR(t,e){var r=t.getModel("aria");if(!r.get("enabled"))return;var n=Ie(rR);Oe(n.label,t.getLocaleModel().get("aria"),!1),Oe(r.option,n,!1),a(),i();function a(){var c=r.getModel("decal"),u=c.get("show");if(u){var f=me();t.eachSeries(function(h){if(!h.isColorBySeries()){var d=f.get(h.type);d||(d={},f.set(h.type,d)),Bx(h).scope=d}}),t.eachRawSeries(function(h){if(t.isSeriesFiltered(h))return;if(ke(h.enableAriaDecal)){h.enableAriaDecal();return}var d=h.getData();if(h.isColorBySeries()){var y=Ay(h.ecModel,h.name,nR,t.getSeriesCount()),b=d.getVisual("decal");d.setVisual("decal",x(b,y))}else{var p=h.getRawData(),m={},g=Bx(h).scope;d.each(function(w){var S=d.getRawIndex(w);m[S]=w});var v=p.count();p.each(function(w){var S=m[w],k=p.getName(w)||w+"",C=Ay(h.ecModel,k,g,v),A=d.getItemVisual(S,"decal");d.setItemVisual(S,"decal",x(A,C))})}function x(w,S){var k=w?q(q({},S),w):S;return k.dirty=!0,k}})}}function i(){var c=e.getZr().dom;if(c){var u=t.getLocaleModel().get("aria"),f=r.getModel("label");if(f.option=He(f.option,u),!!f.get("enabled")){if(c.setAttribute("role","img"),f.get("description")){c.setAttribute("aria-label",f.get("description"));return}var h=t.getSeriesCount(),d=f.get(["data","maxCount"])||10,p=f.get(["series","maxCount"])||10,m=Math.min(h,p),g;if(!(h<1)){var v=s();if(v){var y=f.get(["general","withTitle"]);g=o(y,{title:v})}else g=f.get(["general","withoutTitle"]);var b=[],x=h>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);g+=o(x,{seriesCount:h}),t.eachSeries(function(C,A){if(A<m){var M=void 0,T=C.get("name"),D=T?"withName":"withoutName";M=h>1?f.get(["series","multiple",D]):f.get(["series","single",D]),M=o(M,{seriesId:C.seriesIndex,seriesName:C.get("name"),seriesType:l(C.subType)});var L=C.getData();if(L.count()>d){var R=f.get(["data","partialData"]);M+=o(R,{displayCnt:d})}else M+=f.get(["data","allData"]);for(var O=f.get(["data","separator","middle"]),B=f.get(["data","separator","end"]),j=f.get(["data","excludeDimensionId"]),P=[],V=0;V<L.count();V++)if(V<d){var H=L.getName(V),Z=j?bt(L.getValues(V),function(Te,ge){return Ue(j,ge)===-1}):L.getValues(V),re=f.get(["data",H?"withName":"withoutName"]);P.push(o(re,{name:H,value:Z.join(O)}))}M+=P.join(O)+B,b.push(M)}});var w=f.getModel(["series","multiple","separator"]),S=w.get("middle"),k=w.get("end");g+=b.join(S)+k,c.setAttribute("aria-label",g)}}}}function o(c,u){if(!ae(c))return c;var f=c;return I(u,function(h,d){f=f.replace(new RegExp("\\{\\s*"+d+"\\s*\\}","g"),h)}),f}function s(){var c=t.get("title");return c&&c.length&&(c=c[0]),c&&c.text}function l(c){var u=t.getLocaleModel().get(["series","typeNames"]);return u[c]||u.chart}}function iR(t){if(!(!t||!t.aria)){var e=t.aria;e.show!=null&&(e.enabled=e.show),e.label=e.label||{},I(["description","general","series","data"],function(r){e[r]!=null&&(e.label[r]=e[r])})}}function oR(t){t.registerPreprocessor(iR),t.registerVisual(t.PRIORITY.VISUAL.ARIA,aR)}function zx(t,e,r){var n=ri.createCanvas(),a=e.getWidth(),i=e.getHeight(),o=n.style;return o&&(o.position="absolute",o.left="0",o.top="0",o.width=a+"px",o.height=i+"px",n.setAttribute("data-zr-dom-id",t)),n.width=a*r,n.height=i*r,n}var vp=(function(t){K(e,t);function e(r,n,a){var i=t.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.incremental=!1,i.zlevel=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__used=!1,i.__drawIndex=0,i.__startIndex=0,i.__endIndex=0,i.__prevStartIndex=null,i.__prevEndIndex=null;var o;a=a||gl,typeof r=="string"?o=zx(r,n,a):de(r)&&(o=r,r=o.id),i.id=r,i.dom=o;var s=o.style;return s&&(wv(o),o.onselectstart=function(){return!1},s.padding="0",s.margin="0",s.borderWidth="0"),i.painter=n,i.dpr=a,i}return e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var r=this.dpr;this.domBack=zx("back-"+this.id,this.painter,r),this.ctxBack=this.domBack.getContext("2d"),r!==1&&this.ctxBack.scale(r,r)},e.prototype.createRepaintRects=function(r,n,a,i){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var o=[],s=this.maxRepaintRectCount,l=!1,c=new Ge(0,0,0,0);function u(y){if(!(!y.isFinite()||y.isZero()))if(o.length===0){var b=new Ge(0,0,0,0);b.copy(y),o.push(b)}else{for(var x=!1,w=1/0,S=0,k=0;k<o.length;++k){var C=o[k];if(C.intersect(y)){var A=new Ge(0,0,0,0);A.copy(C),A.union(y),o[k]=A,x=!0;break}else if(l){c.copy(y),c.union(C);var M=y.width*y.height,T=C.width*C.height,D=c.width*c.height,L=D-M-T;L<w&&(w=L,S=k)}}if(l&&(o[S].union(y),x=!0),!x){var b=new Ge(0,0,0,0);b.copy(y),o.push(b)}l||(l=o.length>=s)}}for(var f=this.__startIndex;f<this.__endIndex;++f){var h=r[f];if(h){var d=h.shouldBePainted(a,i,!0,!0),p=h.__isRendered&&(h.__dirty&ir||!d)?h.getPrevPaintRect():null;p&&u(p);var m=d&&(h.__dirty&ir||!h.__isRendered)?h.getPaintRect():null;m&&u(m)}}for(var f=this.__prevStartIndex;f<this.__prevEndIndex;++f){var h=n[f],d=h&&h.shouldBePainted(a,i,!0,!0);if(h&&(!d||!h.__zr)&&h.__isRendered){var p=h.getPrevPaintRect();p&&u(p)}}var g;do{g=!1;for(var f=0;f<o.length;){if(o[f].isZero()){o.splice(f,1);continue}for(var v=f+1;v<o.length;)o[f].intersect(o[v])?(g=!0,o[f].union(o[v]),o.splice(v,1)):v++;f++}}while(g);return this._paintRects=o,o},e.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},e.prototype.resize=function(r,n){var a=this.dpr,i=this.dom,o=i.style,s=this.domBack;o&&(o.width=r+"px",o.height=n+"px"),i.width=r*a,i.height=n*a,s&&(s.width=r*a,s.height=n*a,a!==1&&this.ctxBack.scale(a,a))},e.prototype.clear=function(r,n,a){var i=this.dom,o=this.ctx,s=i.width,l=i.height;n=n||this.clearColor;var c=this.motionBlur&&!r,u=this.lastFrameAlpha,f=this.dpr,h=this;c&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(i,0,0,s/f,l/f));var d=this.domBack;function p(m,g,v,y){if(o.clearRect(m,g,v,y),n&&n!=="transparent"){var b=void 0;if(Ws(n)){var x=n.global||n.__width===v&&n.__height===y;b=x&&n.__canvasGradient||gh(o,n,{x:0,y:0,width:v,height:y}),n.__canvasGradient=b,n.__width=v,n.__height=y}else Ew(n)&&(n.scaleX=n.scaleX||f,n.scaleY=n.scaleY||f,b=mh(o,n,{dirty:function(){h.setUnpainted(),h.painter.refresh()}}));o.save(),o.fillStyle=b||n,o.fillRect(m,g,v,y),o.restore()}c&&(o.save(),o.globalAlpha=u,o.drawImage(d,m,g,v,y),o.restore())}!a||c?p(0,0,s,l):a.length&&I(a,function(m){p(m.x*f,m.y*f,m.width*f,m.height*f)})},e})(Ir),Fx=1e5,$a=314159,Kc=.01,sR=.001;function lR(t){return t?t.__builtin__?!0:!(typeof t.resize!="function"||typeof t.refresh!="function"):!1}function cR(t,e){var r=document.createElement("div");return r.style.cssText=["position:relative","width:"+t+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",r}var uR=(function(){function t(e,r,n,a){this.type="canvas",this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type="canvas";var i=!e.nodeName||e.nodeName.toUpperCase()==="CANVAS";this._opts=n=q({},n||{}),this.dpr=n.devicePixelRatio||gl,this._singleCanvas=i,this.root=e;var o=e.style;o&&(wv(e),e.innerHTML=""),this.storage=r;var s=this._zlevelList;this._prevDisplayList=[];var l=this._layers;if(i){var u=e,f=u.width,h=u.height;n.width!=null&&(f=n.width),n.height!=null&&(h=n.height),this.dpr=n.devicePixelRatio||1,u.width=f*this.dpr,u.height=h*this.dpr,this._width=f,this._height=h;var d=new vp(u,this,this.dpr);d.__builtin__=!0,d.initContext(),l[$a]=d,d.zlevel=$a,s.push($a),this._domRoot=e}else{this._width=Pc(e,0,n),this._height=Pc(e,1,n);var c=this._domRoot=cR(this._width,this._height);e.appendChild(c)}}return t.prototype.getType=function(){return"canvas"},t.prototype.isSingleCanvas=function(){return this._singleCanvas},t.prototype.getViewportRoot=function(){return this._domRoot},t.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},t.prototype.refresh=function(e){var r=this.storage.getDisplayList(!0),n=this._prevDisplayList,a=this._zlevelList;this._redrawId=Math.random(),this._paintList(r,n,e,this._redrawId);for(var i=0;i<a.length;i++){var o=a[i],s=this._layers[o];if(!s.__builtin__&&s.refresh){var l=i===0?this._backgroundColor:null;s.refresh(l)}}return this._opts.useDirtyRect&&(this._prevDisplayList=r.slice()),this},t.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},t.prototype._paintHoverList=function(e){var r=e.length,n=this._hoverlayer;if(n&&n.clear(),!!r){for(var a={inHover:!0,viewWidth:this._width,viewHeight:this._height},i,o=0;o<r;o++){var s=e[o];s.__inHover&&(n||(n=this._hoverlayer=this.getLayer(Fx)),i||(i=n.ctx,i.save()),za(i,s,a,o===r-1))}i&&i.restore()}},t.prototype.getHoverLayer=function(){return this.getLayer(Fx)},t.prototype.paintOne=function(e,r){P_(e,r)},t.prototype._paintList=function(e,r,n,a){if(this._redrawId===a){n=n||!1,this._updateLayerStatus(e);var i=this._doPaintList(e,r,n),o=i.finished,s=i.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),s&&this._paintHoverList(e),o)this.eachLayer(function(c){c.afterBrush&&c.afterBrush()});else{var l=this;kc(function(){l._paintList(e,r,n,a)})}}},t.prototype._compositeManually=function(){var e=this.getLayer($a).ctx,r=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,r,n),this.eachBuiltinLayer(function(a){a.virtual&&e.drawImage(a.dom,0,0,r,n)})},t.prototype._doPaintList=function(e,r,n){for(var a=this,i=[],o=this._opts.useDirtyRect,s=0;s<this._zlevelList.length;s++){var l=this._zlevelList[s],c=this._layers[l];c.__builtin__&&c!==this._hoverlayer&&(c.__dirty||n)&&i.push(c)}for(var u=!0,f=!1,h=function(m){var g=i[m],v=g.ctx,y=o&&g.createRepaintRects(e,r,d._width,d._height),b=n?g.__startIndex:g.__drawIndex,x=!n&&g.incremental&&Date.now,w=x&&Date.now(),S=g.zlevel===d._zlevelList[0]?d._backgroundColor:null;if(g.__startIndex===g.__endIndex)g.clear(!1,S,y);else if(b===g.__startIndex){var k=e[b];(!k.incremental||!k.notClear||n)&&g.clear(!1,S,y)}b===-1&&(console.error("For some unknown reason. drawIndex is -1"),b=g.__startIndex);var C,A=function(L){var R={inHover:!1,allClipped:!1,prevEl:null,viewWidth:a._width,viewHeight:a._height};for(C=b;C<g.__endIndex;C++){var O=e[C];if(O.__inHover&&(f=!0),a._doPaintEl(O,g,o,L,R,C===g.__endIndex-1),x){var B=Date.now()-w;if(B>15)break}}R.prevElClipPaths&&v.restore()};if(y)if(y.length===0)C=g.__endIndex;else for(var M=d.dpr,T=0;T<y.length;++T){var D=y[T];v.save(),v.beginPath(),v.rect(D.x*M,D.y*M,D.width*M,D.height*M),v.clip(),A(D),v.restore()}else v.save(),A(),v.restore();g.__drawIndex=C,g.__drawIndex<g.__endIndex&&(u=!1)},d=this,p=0;p<i.length;p++)h(p);return _e.wxa&&I(this._layers,function(m){m&&m.ctx&&m.ctx.draw&&m.ctx.draw()}),{finished:u,needsRefreshHover:f}},t.prototype._doPaintEl=function(e,r,n,a,i,o){var s=r.ctx;if(n){var l=e.getPaintRect();(!a||l&&l.intersect(a))&&(za(s,e,i,o),e.setPrevPaintRect(l))}else za(s,e,i,o)},t.prototype.getLayer=function(e,r){this._singleCanvas&&!this._needsManuallyCompositing&&(e=$a);var n=this._layers[e];return n||(n=new vp("zr_"+e,this,this.dpr),n.zlevel=e,n.__builtin__=!0,this._layerConfig[e]?Oe(n,this._layerConfig[e],!0):this._layerConfig[e-Kc]&&Oe(n,this._layerConfig[e-Kc],!0),r&&(n.virtual=r),this.insertLayer(e,n),n.initContext()),n},t.prototype.insertLayer=function(e,r){var n=this._layers,a=this._zlevelList,i=a.length,o=this._domRoot,s=null,l=-1;if(!n[e]&&lR(r)){if(i>0&&e>a[0]){for(l=0;l<i-1&&!(a[l]<e&&a[l+1]>e);l++);s=n[a[l]]}if(a.splice(l+1,0,e),n[e]=r,!r.virtual)if(s){var c=s.dom;c.nextSibling?o.insertBefore(r.dom,c.nextSibling):o.appendChild(r.dom)}else o.firstChild?o.insertBefore(r.dom,o.firstChild):o.appendChild(r.dom);r.painter||(r.painter=this)}},t.prototype.eachLayer=function(e,r){for(var n=this._zlevelList,a=0;a<n.length;a++){var i=n[a];e.call(r,this._layers[i],i)}},t.prototype.eachBuiltinLayer=function(e,r){for(var n=this._zlevelList,a=0;a<n.length;a++){var i=n[a],o=this._layers[i];o.__builtin__&&e.call(r,o,i)}},t.prototype.eachOtherLayer=function(e,r){for(var n=this._zlevelList,a=0;a<n.length;a++){var i=n[a],o=this._layers[i];o.__builtin__||e.call(r,o,i)}},t.prototype.getLayers=function(){return this._layers},t.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(f,h){f.__dirty=f.__used=!1});function r(f){i&&(i.__endIndex!==f&&(i.__dirty=!0),i.__endIndex=f)}if(this._singleCanvas)for(var n=1;n<e.length;n++){var a=e[n];if(a.zlevel!==e[n-1].zlevel||a.incremental){this._needsManuallyCompositing=!0;break}}var i=null,o=0,s,l;for(l=0;l<e.length;l++){var a=e[l],c=a.zlevel,u=void 0;s!==c&&(s=c,o=0),a.incremental?(u=this.getLayer(c+sR,this._needsManuallyCompositing),u.incremental=!0,o=1):u=this.getLayer(c+(o>0?Kc:0),this._needsManuallyCompositing),u.__builtin__||Eu("ZLevel "+c+" has been used by unkown layer "+u.id),u!==i&&(u.__used=!0,u.__startIndex!==l&&(u.__dirty=!0),u.__startIndex=l,u.incremental?u.__drawIndex=-1:u.__drawIndex=l,r(l),i=u),a.__dirty&ir&&!a.__inHover&&(u.__dirty=!0,u.incremental&&u.__drawIndex<0&&(u.__drawIndex=l))}r(l),this.eachBuiltinLayer(function(f,h){!f.__used&&f.getElementCount()>0&&(f.__dirty=!0,f.__startIndex=f.__endIndex=f.__drawIndex=0),f.__dirty&&f.__drawIndex<0&&(f.__drawIndex=f.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(e){e.clear()},t.prototype.setBackgroundColor=function(e){this._backgroundColor=e,I(this._layers,function(r){r.setUnpainted()})},t.prototype.configLayer=function(e,r){if(r){var n=this._layerConfig;n[e]?Oe(n[e],r,!0):n[e]=r;for(var a=0;a<this._zlevelList.length;a++){var i=this._zlevelList[a];if(i===e||i===e+Kc){var o=this._layers[i];Oe(o,n[e],!0)}}}},t.prototype.delLayer=function(e){var r=this._layers,n=this._zlevelList,a=r[e];a&&(a.dom.parentNode.removeChild(a.dom),delete r[e],n.splice(Ue(n,e),1))},t.prototype.resize=function(e,r){if(this._domRoot.style){var n=this._domRoot;n.style.display="none";var a=this._opts,i=this.root;if(e!=null&&(a.width=e),r!=null&&(a.height=r),e=Pc(i,0,a),r=Pc(i,1,a),n.style.display="",this._width!==e||r!==this._height){n.style.width=e+"px",n.style.height=r+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(e,r);this.refresh(!0)}this._width=e,this._height=r}else{if(e==null||r==null)return;this._width=e,this._height=r,this.getLayer($a).resize(e,r)}return this},t.prototype.clearLayer=function(e){var r=this._layers[e];r&&r.clear()},t.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},t.prototype.getRenderedCanvas=function(e){if(e=e||{},this._singleCanvas&&!this._compositeManually)return this._layers[$a].dom;var r=new vp("image",this,e.pixelRatio||this.dpr);r.initContext(),r.clear(!1,e.backgroundColor||this._backgroundColor);var n=r.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var a=r.dom.width,i=r.dom.height;this.eachLayer(function(f){f.__builtin__?n.drawImage(f.dom,0,0,a,i):f.renderToCanvas&&(n.save(),f.renderToCanvas(n),n.restore())})}else for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height},s=this.storage.getDisplayList(!0),l=0,c=s.length;l<c;l++){var u=s[l];za(n,u,o,l===c-1)}return r.dom},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t})();function fR(t){t.registerPainter("canvas",uR)}Zn([oR,sA,fR,tR,iP,WP,zM,OP]);const Wa={background:"#ffffff",border:"#dce4e9",muted:"#5b7186",surface:"#ffffff",text:"#0f1e2a",colors:["#2f7f55","#2563eb","#d97706","#7c3aed"]},Hx="cf-widget-category-zoom",Vx=.68,$i=t=>({startIndex:0,endIndex:Math.max(0,t-1)}),cs=(t,e)=>{if(e<=0)return $i(0);let r=e-1,n=Math.max(0,Math.min(r,Math.floor(Math.min(t.startIndex,t.endIndex))));return{startIndex:n,endIndex:Math.max(n,Math.min(r,Math.floor(Math.max(t.startIndex,t.endIndex))))}},Ux=(t,e,r)=>{let n=cs(t,r);if(r<=2)return $i(r);let a=n.endIndex-n.startIndex+1,i=e==="in"?Math.max(2,Math.floor(a*Vx)):Math.min(r,Math.ceil(a/Vx));if(i===a)return n;let o=(n.startIndex+n.endIndex)/2,s=r-i,l=Math.max(0,Math.min(s,Math.round(o-(i-1)/2)));return{startIndex:l,endIndex:l+i-1}},dR=(t,e)=>{let r=t.length;if(r===0)return"No chart points";let n=cs(e,r);if(n.startIndex===0&&n.endIndex===r-1)return`All ${r} ${r===1?"point":"points"}`;let a=n.endIndex-n.startIndex+1;return`${t[n.startIndex]} – ${t[n.endIndex]} · ${a} of ${r} points`},hR=t=>{let e=t.replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").trim();return e?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:"Value"},pR=t=>{let e=new Set,r=[];return t.forEach(n=>{let a=n?.trim();!a||e.has(a)||(e.add(a),r.push(a))}),r},gp=t=>{if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&t.trim()){let e=Number(t);if(Number.isFinite(e))return e}return null},jc=t=>{if(t===null)return"null:";if(t===void 0)return"undefined:";if(typeof t=="object")try{return`object:${JSON.stringify(t)}`}catch{return"object:"}return`${typeof t}:${String(t)}`},Jc=(t,e)=>e?t.columnMetadata?.find(r=>r.key===e):void 0,mp=(t,e)=>Jc(t,e)?.label?.trim()||hR(e),Gx=(t,e,r)=>{if(r==null||r==="")return"Not set";let n=Jc(t,e);if(n?.dataType==="boolean"){let a=String(r).trim().toLowerCase();return r===!1||r===0||["0","false","no"].includes(a)?"No":"Yes"}if(n?.dataType==="date"||n?.dataType==="datetime"){let a=new Date(r);if(!Number.isNaN(a.getTime()))try{return new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric",timeZone:t.timezone||"UTC"}).format(a)}catch{return new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric",timeZone:"UTC"}).format(a)}}return String(r)},us=(t,e,r,n=!1)=>{if(e?.dataType==="currency"){let a=e.currencyCode||r?.currency?.code;if(a)return new Intl.NumberFormat(void 0,{style:"currency",currency:a,notation:n&&Math.abs(t)>=1e4?"compact":"standard",maximumFractionDigits:2}).format(t)}return e?.dataType==="percent"?new Intl.NumberFormat(void 0,{style:"percent",maximumFractionDigits:2}).format(Math.abs(t)>1?t/100:t):new Intl.NumberFormat(void 0,{notation:n&&Math.abs(t)>=1e4?"compact":"standard",maximumFractionDigits:2}).format(t)},vR=(t,e)=>{if(t.presentation==="table"||t.presentation==="kpi")return null;if(e)return e;let r=t.chartRecommendation?.type;return r==="line"||r==="bar"||r==="stacked_bar"?r:t.type==="line"||t.type==="bar"||t.type==="stacked_bar"?t.type:null},gR=t=>t.chartRecommendation?.categoryField?.trim()||t.label?.trim()||t.columnMetadata?.find(e=>["date","dimension","geography","boolean"].includes(e.semanticRole))?.key||t.columns?.[0],mR=t=>t.chartRecommendation?.seriesField?.trim()||t.seriesField?.trim()||t.series?.trim()||void 0,yR=(t,e,r)=>{let n=pR([...t.chartRecommendation?.valueFields??[],...t.valueFields??[],t.value,...t.columnMetadata?.filter(i=>i.semanticRole==="measure").map(i=>i.key)??[]]),a=new Set([...t.columns??[],...t.columnMetadata?.map(i=>i.key)??[],...Object.keys(t.rows?.[0]??{})]);return n.filter(i=>i!==e&&i!==r&&a.has(i)).filter(i=>t.rows?.some(o=>gp(o[i])!==null))},_R=(t,e,r,n,a)=>{let i=a?` Showing 4 of ${n.length+a} series.`:"";if(e==="line"){let s=r.length-1,l=n.map(c=>{let u=c.values[s];return u==null?null:`${c.name}: ${us(u,c.valueColumn,t)}`}).filter(c=>!!c);return l.length?`Latest (${r[s]}): ${l.join("; ")}.${i}`:`No numeric trend values are available.${i}`}let o;return n.forEach(s=>{s.values.forEach((l,c)=>{l===null||o&&l<=o.value||(o={category:r[c]??"Not set",series:s,value:l})})}),o?`Highest: ${o.category}, ${o.series.name} ${us(o.value,o.series.valueColumn,t)}.${i}`:`No numeric comparison values are available.${i}`},yp=(t,e)=>{let r=vR(t,e),n=gR(t),a=t.rows??[];if(!r||!n||a.length===0)return null;let i=mR(t),o=yR(t,n,i);if(o.length===0)return null;let s=o.length===1?i:void 0,l=[],c=new Set;a.forEach(m=>{let g=jc(m[n]);c.has(g)||(c.add(g),l.push({key:g,label:Gx(t,n,m[n])}))});let u=l.map(m=>m.label),f=0,h;if(s){let m=[],g=new Set;a.forEach(b=>{let x=jc(b[s]);g.has(x)||(g.add(x),m.push({key:x,label:Gx(t,s,b[s])}))});let v=m.slice(0,4);f=Math.max(0,m.length-v.length);let y=o[0];h=v.map(b=>{let x=new Map;return a.forEach(w=>{if(jc(w[s])!==b.key)return;let S=jc(w[n]);x.has(S)||x.set(S,gp(w[y]))}),{field:y,name:b.label,values:l.map(w=>x.get(w.key)??null),valueColumn:Jc(t,y)}})}else f=Math.max(0,o.length-4),h=o.slice(0,4).map(m=>({field:m,name:mp(t,m),values:a.map(g=>gp(g[m])),valueColumn:Jc(t,m)}));if(h.length===0)return null;let d=mp(t,n),p="Values";return s?p=mp(t,o[0]):h.length===1&&(p=h[0].name),{type:r,title:t.title?.trim()||`${p} by ${d}`,xAxisTitle:d,yAxisTitle:p,categories:u,series:h,omittedSeriesCount:f,summary:_R(t,r,u,h,f)}},bR=t=>{if(t.presentation==="table"||t.presentation==="kpi")return[];let e=yp(t);if(!e)return[];let r=[{type:"line",label:"Line"},{type:"bar",label:"Bar"}];return e.series.length>1&&r.push({type:"stacked_bar",label:"Stacked bar"}),r},xR=(t,{expanded:e=!1,reducedMotion:r=!1,theme:n=Wa,zoomWindow:a=$i(t.categories.length)}={})=>{let i=t.series.length>1,o=t.type==="stacked_bar",s=t.categories.length>2,l=cs(a,t.categories.length);return{animation:!r,animationDuration:r?0:260,aria:{enabled:!0,decal:{show:!0},label:{description:`${t.title}. ${t.summary}`}},backgroundColor:"transparent",color:n.colors,textStyle:{color:n.text,fontFamily:"inherit"},grid:{top:i?e?48:42:14,right:12,bottom:e?18:10,left:10,containLabel:!0},legend:{show:i,type:"scroll",top:0,left:"center",itemWidth:12,itemHeight:8,textStyle:{color:n.muted,fontSize:e?11:10}},tooltip:{trigger:"axis",triggerOn:"mousemove|click",confine:!0,backgroundColor:n.surface,borderColor:n.border,borderWidth:1,textStyle:{color:n.text,fontSize:12},axisPointer:{type:"line",lineStyle:{color:n.muted,opacity:.5}}},dataZoom:s?[{id:Hx,type:"inside",xAxisIndex:0,startValue:l.startIndex,endValue:l.endIndex,minValueSpan:1,filterMode:"filter",disabled:!0}]:void 0,xAxis:{type:"category",data:t.categories,name:t.xAxisTitle,nameLocation:"middle",nameGap:e?38:32,nameTextStyle:{color:n.muted,fontSize:e?11:10},axisLine:{lineStyle:{color:n.border}},axisTick:{show:!1},axisLabel:{color:n.muted,fontSize:e?11:9,hideOverlap:!0,interval:"auto",rotate:!e&&t.categories.length>5?28:0,formatter:c=>c.length>(e?18:11)?`${c.slice(0,e?16:9)}…`:c}},yAxis:{type:"value",name:t.yAxisTitle,nameLocation:"middle",nameGap:e?52:44,nameTextStyle:{color:n.muted,fontSize:e?11:10},axisLabel:{color:n.muted,fontSize:e?11:9,formatter:c=>us(c,t.series[0]?.valueColumn,void 0,!0)},axisLine:{show:!1},axisTick:{show:!1},splitNumber:4,splitLine:{lineStyle:{color:n.border,opacity:.75}}},series:t.series.map(c=>({type:t.type==="line"?"line":"bar",name:c.name,data:c.values,stack:o?"total":void 0,connectNulls:!1,showSymbol:t.type==="line"&&t.categories.length<=18,symbol:"circle",symbolSize:e?7:6,smooth:!1,maxBarWidth:e?38:28,lineStyle:t.type==="line"?{width:e?3:2.5}:void 0,itemStyle:t.type==="line"?{borderColor:n.background,borderWidth:2}:{borderRadius:o?0:[4,4,0,0]},emphasis:{focus:"series"},tooltip:{valueFormatter:u=>us(u,c.valueColumn)}}))}},wR=t=>{let e=getComputedStyle(t),r=(a,i)=>e.getPropertyValue(a).trim()||i,n=r("--cf-accent",Wa.colors[0]);return{background:r("--cf-bg",Wa.background),border:r("--cf-border",Wa.border),muted:r("--cf-muted",Wa.muted),surface:r("--cf-surface",Wa.surface),text:r("--cf-text",Wa.text),colors:[n,"#2563eb","#d97706","#7c3aed"]}},SR=({model:t,expanded:e=!1})=>{let r=X(null),n=X(null),[a,i]=U(()=>({model:t,window:$i(t.categories.length)})),[o,s]=U(!1),l=a.model===t?cs(a.window,t.categories.length):$i(t.categories.length),c=X(l);c.current=l;let u=g=>{let v=cs(g,t.categories.length);c.current=v,i({model:t,window:v}),n.current?.dispatchAction({type:"dataZoom",dataZoomId:Hx,startValue:v.startIndex,endValue:v.endIndex})};le(()=>{let g=r.current;if(!(!g||typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes("jsdom")))try{let v=fI(g,null,{renderer:"canvas",devicePixelRatio:Math.min(window.devicePixelRatio||1,2)});n.current=v;let y=()=>v.resize(),b=typeof ResizeObserver>"u"?null:new ResizeObserver(y);return b?.observe(g),b||window.addEventListener("resize",y,{passive:!0}),()=>{b?.disconnect(),b||window.removeEventListener("resize",y),v.dispose(),n.current=null}}catch{s(!0);return}},[]),le(()=>{let g=r.current,v=n.current;if(!g||!v)return;let y=typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches;v.setOption(xR(t,{expanded:e,reducedMotion:y,theme:wR(g),zoomWindow:c.current}),{lazyUpdate:!0,notMerge:!0}),v.resize()},[e,t]);let f=!o&&t.categories.length>2,h=l.endIndex-l.startIndex+1,d=l.startIndex===0&&l.endIndex===t.categories.length-1,p=f&&h>2,m=f&&!d;return _(Me,{children:[_("div",{ref:r,class:`cf-analytics-echart${e?" is-expanded":""}`,role:"img","aria-label":`${t.title}. ${t.summary}`,"data-chart-status":o?"fallback":"ready",children:o?_("span",{class:"cf-analytics-echart__fallback",children:t.summary}):null}),f?_("div",{class:"cf-analytics-zoom",children:[_("span",{class:"cf-analytics-zoom__range","aria-live":"polite","aria-atomic":"true",children:dR(t.categories,l)}),_("div",{class:"cf-analytics-zoom__controls",role:"group","aria-label":"Chart zoom controls",children:[_("button",{type:"button","aria-label":"Zoom out chart",title:"Zoom out",disabled:!m,onClick:()=>u(Ux(c.current,"out",t.categories.length)),children:"−"}),_("button",{type:"button",class:"cf-analytics-zoom__reset","aria-label":"Reset chart zoom",title:"Reset zoom",disabled:d,onClick:()=>u($i(t.categories.length)),children:"Reset"}),_("button",{type:"button","aria-label":"Zoom in chart",title:"Zoom in",disabled:!p,onClick:()=>u(Ux(c.current,"in",t.categories.length)),children:"+"})]})]}):null]})},$x=t=>{let e=t.replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").trim();return e?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:"Value"},Wx=(t,e)=>(e?.length?e:Object.keys(t[0]??{})).map(r=>typeof r=="string"?{key:r,label:$x(r)}:{...r,label:r.label?.trim()||$x(r.key)}),qx=(t,e,r)=>{if(t==null||t==="")return"—";if((r?.dataType==="date"||r?.dataType==="datetime")&&typeof t=="string"){let n=new Date(t);if(!Number.isNaN(n.getTime()))return new Intl.DateTimeFormat(e,{dateStyle:"medium",...r.dataType==="datetime"?{timeStyle:"short"}:{}}).format(n)}return r?.dataType==="currency"&&typeof t=="number"?new Intl.NumberFormat(e,{style:"currency",currency:r.currencyCode||"USD",maximumFractionDigits:2}).format(t):typeof t=="number"&&Number.isFinite(t)?new Intl.NumberFormat(e,{maximumFractionDigits:4}).format(t):typeof t=="boolean"?t?"Yes":"No":String(t)},Yx=t=>{let e=String(t??"");return/[",\r\n]/.test(e)?`"${e.replaceAll('"','""')}"`:e},kR=(t,e)=>{let r=Wx(t,e);return[r.map(n=>Yx(n.label)).join(","),...t.map(n=>r.map(a=>Yx(n[a.key])).join(","))].join(`\r
23
- `)},TR=({rows:t,columns:e,maxRows:r=100,locale:n,expanded:a=!1,classPrefix:i="cr",pageSize:o=10})=>{let s=Ht(()=>Wx(t,e),[e,t]),l=s.map(P=>P.key).join("\0"),[c,u]=U(()=>s.map(P=>P.key)),[f,h]=U(""),[d,p]=U(),[m,g]=U("asc"),[v,y]=U([]),[b,x]=U("table"),[w,S]=U(1),[k,C]=U(o);le(()=>{u(s.map(P=>P.key)),p(void 0),y([]),S(1)},[l]);let A=s.filter(P=>c.includes(P.key)),M=Ht(()=>{let P=f.toLocaleLowerCase(n),V=t.map((H,Z)=>({row:H,index:Z})).filter(({row:H})=>A.some(Z=>qx(H[Z.key],n,Z).toLocaleLowerCase(n).includes(P)));return d?V.sort((H,Z)=>{let re=H.row[d],Te=Z.row[d],ge=typeof re=="number"?re:NaN,xe=typeof Te=="number"?Te:NaN,Ce=!Number.isNaN(ge)&&!Number.isNaN(xe)?ge-xe:String(re??"").localeCompare(String(Te??""),n,{numeric:!0,sensitivity:"base"});return m==="asc"?Ce:-Ce}):V},[A,n,f,t,m,d]),T=M.slice(0,Math.max(1,r)),D=Math.max(1,Math.ceil(T.length/k)),L=Math.min(w,D),R=a?T:T.slice((L-1)*k,L*k),O=R.length>0&&R.every(({index:P})=>v.includes(P)),B=P=>`${i}-${P}`;if(t.length===0||s.length===0)return _("div",{class:B("table-note"),children:"No rows returned."});let j=P=>{let V=new Set(R.map(({index:H})=>H));y(H=>P?[...new Set([...H,...V])]:H.filter(Z=>!V.has(Z)))};return _("section",{class:B("data-table"),children:[_("div",{class:B("table-fields"),children:[_("strong",{children:"Fields"}),_("div",{class:B("field-list"),children:s.map(P=>_("span",{class:B("field-chip"),children:P.label},P.key))}),_("span",{class:B("table-field-count"),children:[t.length.toLocaleString(n)," rows"]})]}),_("div",{class:B("table-controls"),children:[_("label",{class:B("table-search"),children:[_("span",{"aria-hidden":"true",children:"⌕"}),_("input",{type:"search",value:f,placeholder:"Search this result...","aria-label":"Search this result",onInput:P=>{h(P.currentTarget.value.trim()),S(1)}})]}),_("div",{class:B("table-modes"),role:"group","aria-label":"Table display mode",children:["table","matrix"].map(P=>_("button",{type:"button",class:`${B("segment")}${b===P?" is-active":""}`,"aria-pressed":b===P,onClick:()=>x(P),children:P==="table"?"Table":"Matrix"},P))})]}),_("div",{class:B("table-column-bar"),children:_("details",{class:B("column-picker"),children:[_("summary",{children:"Columns"}),_("div",{class:B("column-menu"),children:s.map(P=>_("label",{children:[_("input",{type:"checkbox",checked:c.includes(P.key),onChange:V=>{let H=V.currentTarget.checked;u(Z=>H?[...new Set([...Z,P.key])]:Z.length>1?Z.filter(re=>re!==P.key):Z)}}),_("span",{children:P.label})]},P.key))})]})}),_("div",{class:B("table-wrap"),role:"region","aria-label":"Scrollable result table",tabIndex:0,children:_("table",{class:`${B("table")}${b==="matrix"?" is-matrix":""}`,children:[_("caption",{class:B("visually-hidden"),children:["Result table with ",M.length," ",M.length===1?"row":"rows"]}),_("thead",{children:_("tr",{children:[_("th",{class:B("select-cell"),children:_("input",{type:"checkbox","aria-label":"Select all visible rows",checked:O,onChange:P=>j(P.currentTarget.checked)})}),A.map(P=>_("th",{scope:"col",children:_("button",{type:"button",class:B("table-sort"),"aria-label":`Sort by ${P.label}`,onClick:()=>{d===P.key?g(V=>V==="asc"?"desc":"asc"):(p(P.key),g("asc")),S(1)},children:[_("span",{children:P.label}),_("span",{class:B("sort-direction"),"aria-hidden":"true",children:d===P.key?m==="asc"?"↑":"↓":"↕"})]})},P.key))]})}),_("tbody",{children:R.map(({row:P,index:V})=>_("tr",{class:v.includes(V)?"is-selected":void 0,children:[_("td",{class:B("select-cell"),children:_("input",{type:"checkbox","aria-label":`Select row ${V+1}`,checked:v.includes(V),onChange:H=>y(Z=>H.currentTarget.checked?[...new Set([...Z,V])]:Z.filter(re=>re!==V))})}),A.map(H=>_("td",{children:qx(P[H.key],n,H)},H.key))]},V))})]})}),_("div",{class:B("table-summary"),children:[_("span",{children:T.length?`${((L-1)*k+1).toLocaleString(n)}-${Math.min(L*k,T.length).toLocaleString(n)} of ${M.length.toLocaleString(n)}`:`0 of ${M.length.toLocaleString(n)}`}),a?_("span",{children:t.length>r?`First ${r.toLocaleString(n)} rows available`:"All returned rows loaded"}):_("div",{class:B("table-pagination"),"aria-label":"Table pagination",children:[_("label",{children:[_("span",{children:"Rows"}),_("select",{"aria-label":"Rows per page",value:k,onChange:P=>{C(Number(P.currentTarget.value)),S(1)},children:[10,25,50].map(P=>_("option",{value:P,children:P},P))})]}),_("button",{type:"button","aria-label":"Previous page",disabled:L<=1,onClick:()=>S(P=>Math.max(1,P-1)),children:"‹"}),_("span",{children:[L," / ",D]}),_("button",{type:"button","aria-label":"Next page",disabled:L>=D,onClick:()=>S(P=>Math.min(D,P+1)),children:"›"})]})]})]})},_p=16e3;class CR{constructor(e){se(this,"ratio");se(this,"position",0);se(this,"carry",[]);this.ratio=e/_p}process(e){if(this.ratio===1)return e.slice();const r=this.carry.length?Float32Array.from([...this.carry,...e]):e,n=[];let a=this.position;for(;a+this.ratio<=r.length;){const o=Math.floor(a),s=Math.min(r.length,Math.floor(a+this.ratio));let l=0;for(let c=o;c<s;c+=1)l+=r[c]??0;n.push(s>o?l/(s-o):0),a+=this.ratio}const i=Math.floor(a);return this.carry=Array.from(r.subarray(i)),this.position=a-i,Float32Array.from(n)}}const MR=(t,e=_p)=>{const r=t.reduce((s,l)=>s+l.length,0),n=new ArrayBuffer(44+r*2),a=new DataView(n),i=(s,l)=>{for(let c=0;c<l.length;c+=1)a.setUint8(s+c,l.charCodeAt(c))};i(0,"RIFF"),a.setUint32(4,36+r*2,!0),i(8,"WAVE"),i(12,"fmt "),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,e,!0),a.setUint32(28,e*2,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),i(36,"data"),a.setUint32(40,r*2,!0);let o=44;for(const s of t)for(let l=0;l<s.length;l+=1){const c=Math.max(-1,Math.min(1,s[l]??0));a.setInt16(o,c<0?c*32768:c*32767,!0),o+=2}return new Blob([n],{type:"audio/wav"})},Xx=t=>t.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").split(/\s+/).filter(e=>e.length>1),AR=(t,e)=>{const r=Xx(t);if(r.length===0||!e.trim())return!1;const n=new Set(Xx(e));return r.filter(a=>n.has(a)).length/r.length>=.7},Zx=300,DR=()=>{const t=globalThis;if(t.__voiceDebug)return!0;try{return t.localStorage?.getItem("accurix.voiceDebug")==="1"}catch{return!1}};class IR{constructor(e=()=>Date.now()){se(this,"now");se(this,"entries",[]);se(this,"startedAt");this.now=e,this.startedAt=e(),globalThis.__accurixVoiceLog=()=>this.list()}add(e,r){const n={at:Math.round(this.now()-this.startedAt),event:e,detail:r};this.entries.push(n),this.entries.length>Zx&&this.entries.splice(0,this.entries.length-Zx),DR()&&console.debug(`VOICEDBG ${e} ${r?JSON.stringify(r):""}`)}list(){return this.entries.slice()}}const bp=_p/50,Jt=20,LR=500,PR=120,RR=300,ER=280,OR=600,NR=300,BR=12e3,zR=25e3,FR=300,HR=2e4,VR=60,UR=400,GR=250,xp=8e-4,$R=.1,WR=2.8,qR=1.8,YR=.006,XR=.004,ZR=1.8,KR=1.4,jR=2e3,JR=2e3;class QR{constructor(e){se(this,"options");se(this,"endSilenceMs");se(this,"pending",new Float32Array(0));se(this,"levels",[]);se(this,"framesSinceFloor",0);se(this,"floor",xp*4);se(this,"recentSpeech",[]);se(this,"preroll",[]);se(this,"silentMs",0);se(this,"inputSilent",!1);se(this,"outputActive",!1);se(this,"turns",[]);se(this,"nextTurnId",1);this.options=e,this.endSilenceMs=e.endSilenceMs??JR}get hearing(){return this.current()?.capturing??!1}get processing(){return this.turns.some(e=>!e.capturing&&!e.cancelled)}feed(e){let r=e;this.pending.length&&(r=new Float32Array(this.pending.length+e.length),r.set(this.pending),r.set(e,this.pending.length));let n=0;for(;n+bp<=r.length;)this.frame(r.slice(n,n+bp)),n+=bp;this.pending=r.slice(n)}setOutputActive(e){this.outputActive!==e&&(this.outputActive=e,this.options.log.add("output",{active:e}))}finishTurn(){const e=this.current();e&&(e.capturing?this.endTurn(e,"done"):e.closed||(e.closed=!0,e.endedBy="done",this.options.log.add("turn-done",{turn:e.id})))}reset(e){for(const r of this.turns)r.cancelled=!0;this.turns.length&&this.options.log.add("turns-dropped",{reason:e,count:this.turns.length}),this.turns=[],this.preroll=[],this.recentSpeech=[],this.pending=new Float32Array(0),this.options.onChange()}current(){return this.turns[this.turns.length-1]}frame(e){let r=0,n=0;for(let f=0;f<e.length;f+=1){const h=e[f]??0;r+=h*h,n=Math.max(n,Math.abs(h))}const a=Math.sqrt(r/e.length);this.trackInputSilence(n);const i=this.current();!i?.capturing&&!this.outputActive&&this.trackFloor(a);const o=this.outputActive,s=Math.max(YR,this.floor*WR)*(o?ZR:1),l=Math.max(XR,this.floor*qR)*(o?KR:1),c=a>=s,u=a>=l;if(!i?.capturing){for(this.preroll.push(e);this.preroll.length*Jt>LR;)this.preroll.shift();this.recentSpeech.push(c);const f=(o?OR:RR)/Jt;for(;this.recentSpeech.length>f;)this.recentSpeech.shift();const h=this.recentSpeech.filter(Boolean).length*Jt;h>=(o?ER:PR)&&this.beginCapture(h);return}i.chunk.push(e),i.chunkMs+=Jt,i.durationMs+=Jt,c&&(i.voicedMs+=Jt,i.chunkVoicedMs+=Jt),i.quietMs=u?0:i.quietMs+Jt,o&&(i.overlappedOutput=!0),i.quietMs>=this.endSilenceMs?this.endTurn(i,"silence"):(i.chunkMs>=zR||i.chunkMs>=BR&&i.quietMs>=FR||i.chunkMs>=HR&&i.quietMs>=VR)&&this.cutChunk(i)}trackFloor(e){if(this.levels.push(e),this.levels.length>GR&&this.levels.shift(),this.framesSinceFloor+=1,this.framesSinceFloor<10&&this.levels.length>10)return;this.framesSinceFloor=0;const r=this.levels.slice().sort((n,a)=>n-a);this.floor=Math.max(xp,r[Math.floor(r.length*$R)]??xp)}trackInputSilence(e){this.silentMs=e===0?this.silentMs+Jt:0;const r=this.silentMs>=jR;r!==this.inputSilent&&(this.inputSilent=r,this.options.log.add("input-silent",{silent:r}),this.options.onInputSilent?.(r))}beginCapture(e){const r=this.current();let n;r&&!r.capturing&&!r.closed?(n=r,n.capturing=!0,this.options.log.add("turn-resumed",{turn:n.id})):(n={id:this.nextTurnId++,capturing:!0,closed:!1,endedBy:"silence",chunk:[],chunkMs:0,chunkVoicedMs:0,quietMs:0,voicedMs:0,durationMs:0,overlappedOutput:this.outputActive,results:[],chunkCount:0,cancelled:!1},this.turns.push(n),this.options.log.add("turn-start",{turn:n.id,overOutput:this.outputActive}),this.options.listener.speechStart?.({turnId:n.id,overlappedOutput:this.outputActive})),n.chunk.push(...this.preroll),n.chunkMs+=this.preroll.length*Jt,n.durationMs+=this.preroll.length*Jt,n.voicedMs+=e,n.chunkVoicedMs+=e,n.quietMs=0,this.preroll=[],this.recentSpeech=[],this.options.onChange()}endTurn(e,r){const n=Math.max(0,Math.floor((e.quietMs-UR)/Jt));if(n>0&&(e.chunk.splice(e.chunk.length-Math.min(n,e.chunk.length)),e.chunkMs=e.chunk.length*Jt),e.capturing=!1,e.endedBy=r,r==="done"&&(e.closed=!0),this.options.log.add("turn-end",{turn:e.id,by:r,ms:e.durationMs,voicedMs:e.voicedMs}),e.chunkCount===0&&e.voicedMs<NR){this.turns=this.turns.filter(a=>a!==e),this.options.log.add("turn-noise",{turn:e.id,reason:"too-short"}),this.options.listener.noise?.({id:e.id,reason:"too-short",overlappedOutput:e.overlappedOutput}),this.options.onChange();return}this.cutChunk(e),this.options.onChange(),this.settle()}cutChunk(e){if(e.chunk.length===0)return;const r=e.chunk,n=e.chunkCount;e.chunkCount+=1,e.results[n]=void 0,e.chunk=[];const a=r.length*Jt,i=e.chunkVoicedMs;if(e.chunkMs=0,e.chunkVoicedMs=0,i===0&&n>0){e.results[n]="";return}this.options.log.add("chunk",{turn:e.id,index:n,ms:a}),this.options.transcribe({audio:MR(r),mimeType:"audio/wav",durationSeconds:a/1e3,turnId:e.id,chunkIndex:n}).then(o=>(o??"").trim(),()=>null).then(o=>{if(e.cancelled)return;e.results[n]=o,this.options.log.add("chunk-text",{turn:e.id,index:n,chars:o===null?-1:o.length});const s=[];for(const l of e.results){if(l===void 0)break;l&&s.push(l)}s.length&&this.options.listener.partial?.({turnId:e.id,text:s.join(" ")}),this.settle()})}settle(){for(;this.turns.length;){const e=this.turns[0];if(!e||e.capturing||e.results.some(i=>i===void 0))return;this.turns.shift();const r=e.results.filter(i=>typeof i=="string"&&i!==""),n=e.results.every(i=>i===null),a=r.join(" ").replace(/\s+/g," ").trim();if(a)this.options.log.add("turn",{turn:e.id,chars:a.length,by:e.endedBy}),this.options.listener.turn?.({id:e.id,text:a,durationMs:e.durationMs,endedBy:e.endedBy,overlappedOutput:e.overlappedOutput});else{const i=n?"transcribe-failed":"empty-transcript";this.options.log.add("turn-noise",{turn:e.id,reason:i}),this.options.listener.noise?.({id:e.id,reason:i,overlappedOutput:e.overlappedOutput})}this.options.onChange()}}}const e5=2048,t5=[300,1e3,2500],r5=()=>typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"&&typeof globalThis.AudioContext=="function",n5=t=>{const e=t?.name;return e==="NotAllowedError"||e==="SecurityError"?"permission-denied":e==="NotFoundError"||e==="OverconstrainedError"?"no-device":"error"};class Kx{constructor(e){se(this,"options");se(this,"log",new IR);se(this,"turns");se(this,"mic","off");se(this,"reason");se(this,"muted",!1);se(this,"inputSilent",!1);se(this,"stream",null);se(this,"context",null);se(this,"source",null);se(this,"processor",null);se(this,"sink",null);se(this,"downsampler",null);se(this,"deviceId");se(this,"generation",0);se(this,"recoveryAttempt",0);se(this,"recoveryTimer",null);se(this,"lastSnapshot","");se(this,"groupId");se(this,"onTrackEnded",()=>{this.log.add("track-ended"),this.recover("track-ended")});se(this,"onTrackMuteChange",()=>{const e=this.stream?.getAudioTracks()[0];this.log.add("track-mute-change",{muted:!!e?.muted}),this.refreshMic()});se(this,"onContextState",()=>{const e=this.context?.state;this.log.add("audio-state",{state:e}),(e==="suspended"||e==="interrupted")&&this.context?.resume().catch(()=>{}),this.refreshMic()});se(this,"onDeviceChange",()=>{this.checkDevices()});this.options=e,this.deviceId=e.deviceId,this.turns=new QR({transcribe:e.transcribe,listener:e.listener,log:this.log,endSilenceMs:e.endSilenceMs,onChange:()=>this.publish(),onInputSilent:r=>{this.inputSilent=r,this.publish()}})}get snapshot(){let e=this.mic,r=this.reason;return e==="listening"&&this.inputSilent&&(e="unavailable",r="input-silent"),e==="listening"&&this.turns.hearing&&(e="hearing"),{mic:e,processing:this.turns.processing,reason:e==="unavailable"?r:void 0}}get active(){return this.mic!=="off"}async start(){this.mic==="off"&&(this.log.add("start"),this.mediaDevices()?.addEventListener("devicechange",this.onDeviceChange),await this.open("start"))}stop(e="stopped"){this.mic!=="off"&&(this.log.add("stop",{reason:e}),this.generation+=1,this.clearRecovery(),this.mediaDevices()?.removeEventListener("devicechange",this.onDeviceChange),this.turns.reset(e),this.close(),this.context?.close().catch(()=>{}),this.context=null,this.setMic("off"))}setMuted(e){if(!(this.muted===e||this.mic==="off")){this.muted=e,this.log.add(e?"mute":"unmute");for(const r of this.stream?.getAudioTracks()??[])r.enabled=!e;e?(this.turns.reset("muted"),this.setMic("muted")):this.refreshMic()}}finishTurn(){this.log.add("done-pressed"),this.turns.finishTurn()}setOutputActive(e){this.turns.setOutputActive(e)}async selectDevice(e){e!==this.deviceId&&(this.deviceId=e,this.mic!=="off"&&(this.log.add("device-selected"),this.turns.reset("device-selected"),this.close(),await this.open("device-selected")))}mediaDevices(){return this.options.media?.mediaDevices??(typeof navigator<"u"?navigator.mediaDevices:void 0)}async open(e){const r=++this.generation;this.setMic("starting");const n=this.options.media?.getUserMedia??(r5()?i=>navigator.mediaDevices.getUserMedia(i):null);if(!n){this.unavailable("unsupported");return}let a;try{a=await n({audio:{...this.deviceId?{deviceId:{exact:this.deviceId}}:{},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(i){if(r!==this.generation)return;const o=n5(i);if(this.log.add("mic-open-failed",{why:e,reason:o}),o==="no-device"&&this.deviceId){this.deviceId=void 0,await this.open("default-device");return}this.unavailable(o);return}if(r!==this.generation){a.getTracks().forEach(i=>i.stop());return}try{this.connect(a)}catch(i){this.log.add("audio-setup-failed",{message:String(i?.name??"error")}),a.getTracks().forEach(o=>o.stop()),this.unavailable("error");return}this.recoveryAttempt=0,this.groupId=a.getAudioTracks()[0]?.getSettings?.().groupId,this.log.add("mic-open",{why:e}),this.refreshMic()}connect(e){this.stream=e;for(const n of e.getAudioTracks())n.enabled=!this.muted,n.addEventListener("ended",this.onTrackEnded),n.addEventListener("mute",this.onTrackMuteChange),n.addEventListener("unmute",this.onTrackMuteChange);const r=this.context??this.options.media?.createAudioContext?.()??new globalThis.AudioContext;this.context||(this.context=r,r.addEventListener("statechange",this.onContextState)),r.state==="suspended"&&r.resume().catch(()=>{}),this.downsampler=new CR(r.sampleRate),this.source=r.createMediaStreamSource(e),this.processor=r.createScriptProcessor(e5,1,1),this.sink=r.createGain(),this.sink.gain.value=0,this.processor.onaudioprocess=n=>{if(this.muted||!this.downsampler)return;const a=this.downsampler.process(n.inputBuffer.getChannelData(0));if(this.turns.feed(a),this.options.listener.level&&a.length){let i=0;for(const o of a)i+=o*o;this.options.listener.level(Math.sqrt(i/a.length))}},this.source.connect(this.processor),this.processor.connect(this.sink),this.sink.connect(r.destination)}close(){this.processor&&(this.processor.onaudioprocess=null),this.source?.disconnect(),this.processor?.disconnect(),this.sink?.disconnect(),this.source=null,this.processor=null,this.sink=null;for(const e of this.stream?.getTracks()??[])e.removeEventListener("ended",this.onTrackEnded),e.removeEventListener("mute",this.onTrackMuteChange),e.removeEventListener("unmute",this.onTrackMuteChange),e.stop();this.stream=null,this.inputSilent=!1}refreshMic(){if(this.mic==="off")return;if(this.muted)return this.setMic("muted");const e=this.stream?.getAudioTracks()[0];if(!e||e.readyState!=="live")return this.unavailable("device-lost");if(e.muted)return this.unavailable("track-muted");if(this.context&&this.context.state!=="running")return this.unavailable("audio-suspended");this.reason=void 0,this.setMic("listening")}unavailable(e){this.reason=e,this.setMic("unavailable")}setMic(e){this.mic!==e&&this.log.add("mic",{state:e,reason:e==="unavailable"?this.reason:void 0}),this.mic=e,this.publish()}publish(){const e=this.snapshot,r=JSON.stringify(e);r!==this.lastSnapshot&&(this.lastSnapshot=r,this.options.listener.state?.(e))}recover(e){if(this.mic==="off"||this.recoveryTimer)return;const r=t5[this.recoveryAttempt];if(this.turns.reset(e),this.close(),r===void 0){this.log.add("mic-recovery-gave-up",{why:e}),this.unavailable("device-lost");return}this.recoveryAttempt+=1,this.unavailable("device-lost"),this.log.add("mic-recovering",{why:e,attempt:this.recoveryAttempt}),this.recoveryTimer=setTimeout(()=>{this.recoveryTimer=null,this.mic!=="off"&&this.open(e)},r)}clearRecovery(){this.recoveryTimer&&clearTimeout(this.recoveryTimer),this.recoveryTimer=null,this.recoveryAttempt=0}async checkDevices(){const e=this.stream?.getAudioTracks()[0];if(!e||e.readyState!=="live"){this.log.add("device-change",{live:!1}),this.recover("device-change");return}let r=[];try{r=(await this.mediaDevices()?.enumerateDevices()??[]).filter(o=>o.kind==="audioinput")}catch{return}const n=r.some(o=>!this.groupId||o.groupId===this.groupId),a=r.find(o=>o.deviceId==="default"),i=!this.deviceId&&a!==void 0&&this.groupId!==void 0&&a.groupId!==this.groupId;this.log.add("device-change",{live:!0,ours:n,defaultMoved:i}),(!n||i)&&this.recover("device-change")}}const a5=[{name:"Smileys",emojis:["😀","😃","😄","😁","😅","😂","🤣","😊","😇","🙂","🙃","😉","😌","😍","🥰","😘","😋","😛","😜","🤪","🤗","🤭","🤔","🤐","😐","😶","😏","🙄","😴","🥳","😎","🤓","🥺","😢","😭","😤","😠","🤯","😬","😱","🤩","🥱"]},{name:"Gestures",emojis:["👍","👎","👌","🤌","✌️","🤞","🤟","🤘","🤙","👈","👉","👆","👇","✋","🖐️","👋","🤝","🙏","💪","👏","🙌","👐","🤲","🫶"]},{name:"Hearts & symbols",emojis:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","💔","❣️","💕","💖","💘","💝","✨","⭐","🌟","💫","🔥","🎉","🎊","✅","❌","⚡","💯","🚀"]},{name:"Animals & nature",emojis:["🐶","🐱","🦊","🐻","🐼","🐨","🦁","🐮","🐸","🐵","🐧","🦄","🐝","🦋","🐢","🐬","🌷","🌸","🌹","🌻","🌳","🍀"]},{name:"Food & drink",emojis:["🍎","🍌","🍉","🍓","🍒","🥑","🍔","🍟","🍕","🌮","🍿","🍩","🍪","🎂","☕","🍵","🍺","🥂","🍷"]},{name:"Objects & travel",emojis:["🚀","✈️","🚗","🏠","📦","📱","💻","⌚","📷","💡","🔑","🎁","📌","✏️","📝","📞","📧","💰","📈","⏰","🔔","🎯","🏆","🎮","🎵","💬","👀"]}],Qc={"contact-support":{title:"Contact support",submit:"Request support",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"subject",label:"Subject",kind:"text",required:!0},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"Describe what you need help with."}]},inquiry:{title:"Leave a message",submit:"Send message",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"How can we help?"}]},contact:{title:"Share your details",submit:"Save",fields:[{key:"name",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"email",label:"Email",kind:"email",required:!0,identity:"email"},{key:"phone",label:"Phone",kind:"tel",required:!0,identity:"phone"}]},"book-demo":{title:"Book a demo",submit:"Request demo",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"preferredAt",label:"Preferred time",kind:"text",placeholder:"e.g. Thursday 3pm"},{key:"notes",label:"Notes",kind:"textarea",placeholder:"Anything we should know?"}]},"request-callback":{title:"Request a callback",submit:"Request callback",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorPhone",label:"Phone number",kind:"tel",required:!0,identity:"phone"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"schedule-callback":{title:"Schedule a callback",submit:"Schedule callback",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorPhone",label:"Phone number",kind:"tel",required:!0,identity:"phone"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"subscribe-newsletter":{title:"Subscribe",submit:"Subscribe",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"}]}},wp={openChat:"Open chat",closeChat:"Close chat",closeHistory:"Close conversation history",unreadMessage:"1 unread message",unreadMessages:"{count} unread messages",muteSounds:"Mute sounds",unmuteSounds:"Unmute sounds",statusOnline:"Online · replies instantly",statusOffline:"Away · leave a message",liveSupport:"Live support",reconnectSupport:"Reconnect to support",reconnectPrompt:"I can bring a teammate back into this chat.",waitingForTeam:"AI helping · team notified",assistantName:"Assistant",chatName:"Chat",welcomeLabel:"{name} welcome",welcomeEyebrow:"Ready when you are",welcomePrompt:"Ask a question, leave a message, or book a demo.",agentTyping:"{name} is typing…",expandedAnalyticsResult:"Expanded analytics result",privacyAndData:"Privacy and local data",muteMicrophone:"Mute microphone",unmuteMicrophone:"Unmute microphone",chooseMicrophone:"Choose microphone",defaultMicrophone:"Default microphone",microphone:"Microphone",talkNow:"Talk now",expandView:"Expand view",exitExpandedView:"Exit expanded view",minimizeVoiceChat:"Minimize voice chat",endVoiceChat:"End voice chat",restoreVoiceChat:"Restore voice chat",reopenVoiceChat:"Reopen voice chat with {name}",voiceConnecting:"Connecting…",voiceListening:"Listening…",voiceHearing:"Hearing you…",voiceUnavailable:"Can’t hear you — check your microphone.",voiceProcessing:"Transcribing…",voiceSpeaking:"Speaking…",voiceNoise:"No clear speech heard. Move closer to the mic and try again.",voiceMisunderstood:"Could not transcribe that. Please try again or type your message.",voiceDenied:"Microphone unavailable. Allow access or type your message.",composerPlaceholder:"Type your message…",send:"Send message",emoji:"Emoji",gifs:"GIFs",attachFile:"Attach a file",recordVoice:"Record a voice message",stopRecording:"Stop recording",actionTestMode:"Test mode",stop:"Stop",copy:"Copy",copied:"Copied",retry:"Retry",clearChat:"Clear conversation",clearChatConfirm:"Clear this conversation?",clearChatConfirmBody:"This clears the messages on this device and starts a fresh chat.",clearConfirmCta:"Clear chat",endChat:"End conversation",endChatConfirm:"End this conversation?",endChatConfirmBody:"You won't be able to send more messages in this chat, but you can start a new one anytime.",endConfirmCta:"End conversation",conversationEnded:"This conversation has ended.",startNewChat:"Start a new conversation",pastConversations:"Past conversations",viewingPast:"Viewing a past conversation (read-only)",backToChat:"Back to current chat",historyEnded:"ended",feedbackHelpful:"Helpful",feedbackNotHelpful:"Not helpful",feedbackThanks:"Thanks for the feedback",csatPrompt:"How was this chat?",feedbackCommentPlaceholder:"What went wrong? (optional)",feedbackSend:"Send",cancel:"Cancel",newMessages:"New messages",poweredBy:"Powered by",searchGifs:"Search GIFs…",searchingGifs:"Searching…",noGifs:"No GIFs found",assistantTyping:"Assistant is typing",emptyReply:"Sorry, I couldn't generate a reply.",errorGeneric:"Something went wrong reaching the assistant. Please try again.",errorRateLimit:"You’re sending messages a little fast — give it a second and try again.",attaching:"Reading file…",attachTooLarge:"That file is too large (max 5 MB).",attachFailed:"Could not attach that file. Check its type and try again.",attachPreviewTitle:"Preview of {name}",attachOpen:"Preview {name}",attachDownload:"Download",attachPreviewClose:"Close preview",attachPreviewLoading:"Loading file…",attachPreviewFailed:"This file can’t be shown right now. It may have expired.",attachPreviewUnsupported:"This file can’t be previewed here. Download it to open it.",attachAnalysisFailed:"Saved for the team; AI could not read it.",removeAttachment:"Remove attachment",attachLimit:"You can attach up to {count} files to one message.",attachedFiles:"Attached files",removeAttachmentNamed:"Remove {name}",dropFileHere:"Drop the file here",clearDeviceData:"Clear conversations from this device",clearDeviceDataBody:"This removes locally stored conversations and visitor details from this browser. It cannot be undone.",clearDeviceDataCta:"Clear this device",handoffTitle:"Want our team to follow up?",handoffName:"Name (optional)",handoffEmail:"Your email",handoffNotify:"Notify the team",sending:"Sending…",handoffShared:"I’ve shared this with our team — they’ll get back to you at {email}.",formThanks:"Thanks! We’ll be in touch.",caseReference:"Reference: {reference}",formError:"Something went wrong — please try again.",actionContactOptions:"Contact options",actionGetInTouch:"Get in touch",actionMore:"+{count} more",actionNeedHelp:"Need help?",actionChoose:"Choose what you want to do",actionFooter:"We’ll ask for your full name and the best email or phone so the team can reach you.",actionCategorySupport:"Support",actionCategorySales:"Talk to sales",actionCategoryMarketing:"Stay in touch",actionClose:"Close",actionAs:"as {identity}",bookingPickTime:"What time works best?",bookingPickDay:"Pick a day",bookingPickTimeLabel:"Pick a time",bookingDuration:"{count}-minute demo",bookingCallbackDuration:"{count}-minute callback",bookingTimezone:"Times shown in {timezone}",bookingSchedulerFallback:"the scheduler",bookingCheckingAvailability:"Checking calendar availability…",bookingNoSlots:"No available times were found in this booking window.",bookingAvailabilityUnavailable:"Calendar availability is temporarily unavailable. Please try again shortly.",bookingEarlierToday:"Earlier today",bookingCalendarBusy:"Busy on the calendar",bookingAlreadyBooked:"Already booked",bookingNotOffered:"Not offered by the calendar",bookingRequested:"Requested for {when} — we’ll confirm by email.",bookingVerificationPending:"We received your request for {when}, but could not verify the calendar booking. Check your email; the team will follow up. Please do not book this time again.",bookingCallbackRequested:"Callback requested for {when}.",bookingCallbackConfirmed:"Your callback is scheduled for {when}.",bookingConfirmed:"You’re booked for {when}! A calendar invite is on its way. 📅",bookingSlotTaken:"That time was just taken — please pick another.",bookingViaProvider:"Pick a time that works for you on {provider}.",bookingOpenScheduler:"Open the scheduler",bookingLinkOpened:"Opening the scheduler — pick a time that suits you. 📅",bookingScheduled:"Your demo is booked. A calendar invitation has been sent to your email.",bookingBackToChat:"Back to chat",bookingOpenNewTab:"Open in new tab",bookingCloseScheduler:"Close scheduler",bookingLoadingScheduler:"Loading scheduler…",bookingMeetingLink:"Meeting link",bookingManageLink:"Manage booking",bookingCheckingDetails:"Getting your meeting link…",bookingDetailsUnavailable:"Your booking is in Calendly, but we could not load the meeting link. Check your calendar invitation or try again.",bookingRetryDetails:"Retry",previewReply:"👋 This is a preview — replies here are samples. Publish the widget on your site to chat with the live AI.",previewActionNote:"Preview — nothing was actually sent. This works for real once you publish.",previewBanner:"Preview — sample replies, no AI"},ct=(t,e)=>t.replace(/\{(\w+)\}/g,(r,n)=>e[n]??""),fs=(t,e,r)=>!e||t.includes(e)?t:`${t} ${ct(r.caseReference,{reference:e})}`,i5=t=>t?{...wp,...t}:wp,jx=iw(wp),o5=jx.Provider,kr=()=>_w(jx),qa=[["AF","Afghanistan","93"],["AL","Albania","355"],["DZ","Algeria","213"],["AS","American Samoa","1684"],["AD","Andorra","376"],["AO","Angola","244"],["AI","Anguilla","1264"],["AG","Antigua and Barbuda","1268"],["AR","Argentina","54"],["AM","Armenia","374"],["AW","Aruba","297"],["AU","Australia","61"],["AT","Austria","43"],["AZ","Azerbaijan","994"],["BS","Bahamas","1242"],["BH","Bahrain","973"],["BD","Bangladesh","880"],["BB","Barbados","1246"],["BY","Belarus","375"],["BE","Belgium","32"],["BZ","Belize","501"],["BJ","Benin","229"],["BM","Bermuda","1441"],["BT","Bhutan","975"],["BO","Bolivia","591"],["BA","Bosnia and Herzegovina","387"],["BW","Botswana","267"],["BR","Brazil","55"],["BN","Brunei","673"],["BG","Bulgaria","359"],["BF","Burkina Faso","226"],["BI","Burundi","257"],["CV","Cabo Verde","238"],["KH","Cambodia","855"],["CM","Cameroon","237"],["CA","Canada","1"],["KY","Cayman Islands","1345"],["CF","Central African Republic","236"],["TD","Chad","235"],["CL","Chile","56"],["CN","China","86"],["CO","Colombia","57"],["KM","Comoros","269"],["CG","Congo","242"],["CD","Congo, Democratic Republic","243"],["CK","Cook Islands","682"],["CR","Costa Rica","506"],["CI","Cote d'Ivoire","225"],["HR","Croatia","385"],["CU","Cuba","53"],["CW","Curacao","599"],["CY","Cyprus","357"],["CZ","Czechia","420"],["DK","Denmark","45"],["DJ","Djibouti","253"],["DM","Dominica","1767"],["DO","Dominican Republic","1809"],["EC","Ecuador","593"],["EG","Egypt","20"],["SV","El Salvador","503"],["GQ","Equatorial Guinea","240"],["ER","Eritrea","291"],["EE","Estonia","372"],["SZ","Eswatini","268"],["ET","Ethiopia","251"],["FO","Faroe Islands","298"],["FJ","Fiji","679"],["FI","Finland","358"],["FR","France","33"],["GF","French Guiana","594"],["PF","French Polynesia","689"],["GA","Gabon","241"],["GM","Gambia","220"],["GE","Georgia","995"],["DE","Germany","49"],["GH","Ghana","233"],["GI","Gibraltar","350"],["GR","Greece","30"],["GL","Greenland","299"],["GD","Grenada","1473"],["GP","Guadeloupe","590"],["GU","Guam","1671"],["GT","Guatemala","502"],["GG","Guernsey","44"],["GN","Guinea","224"],["GW","Guinea-Bissau","245"],["GY","Guyana","592"],["HT","Haiti","509"],["HN","Honduras","504"],["HK","Hong Kong","852"],["HU","Hungary","36"],["IS","Iceland","354"],["IN","India","91"],["ID","Indonesia","62"],["IR","Iran","98"],["IQ","Iraq","964"],["IE","Ireland","353"],["IM","Isle of Man","44"],["IL","Israel","972"],["IT","Italy","39"],["JM","Jamaica","1876"],["JP","Japan","81"],["JE","Jersey","44"],["JO","Jordan","962"],["KZ","Kazakhstan","7"],["KE","Kenya","254"],["KI","Kiribati","686"],["XK","Kosovo","383"],["KW","Kuwait","965"],["KG","Kyrgyzstan","996"],["LA","Laos","856"],["LV","Latvia","371"],["LB","Lebanon","961"],["LS","Lesotho","266"],["LR","Liberia","231"],["LY","Libya","218"],["LI","Liechtenstein","423"],["LT","Lithuania","370"],["LU","Luxembourg","352"],["MO","Macao","853"],["MG","Madagascar","261"],["MW","Malawi","265"],["MY","Malaysia","60"],["MV","Maldives","960"],["ML","Mali","223"],["MT","Malta","356"],["MH","Marshall Islands","692"],["MQ","Martinique","596"],["MR","Mauritania","222"],["MU","Mauritius","230"],["MX","Mexico","52"],["FM","Micronesia","691"],["MD","Moldova","373"],["MC","Monaco","377"],["MN","Mongolia","976"],["ME","Montenegro","382"],["MS","Montserrat","1664"],["MA","Morocco","212"],["MZ","Mozambique","258"],["MM","Myanmar","95"],["NA","Namibia","264"],["NR","Nauru","674"],["NP","Nepal","977"],["NL","Netherlands","31"],["NC","New Caledonia","687"],["NZ","New Zealand","64"],["NI","Nicaragua","505"],["NE","Niger","227"],["NG","Nigeria","234"],["NU","Niue","683"],["KP","North Korea","850"],["MK","North Macedonia","389"],["MP","Northern Mariana Islands","1670"],["NO","Norway","47"],["OM","Oman","968"],["PK","Pakistan","92"],["PW","Palau","680"],["PS","Palestine","970"],["PA","Panama","507"],["PG","Papua New Guinea","675"],["PY","Paraguay","595"],["PE","Peru","51"],["PH","Philippines","63"],["PL","Poland","48"],["PT","Portugal","351"],["PR","Puerto Rico","1787"],["QA","Qatar","974"],["RE","Reunion","262"],["RO","Romania","40"],["RU","Russia","7"],["RW","Rwanda","250"],["KN","Saint Kitts and Nevis","1869"],["LC","Saint Lucia","1758"],["VC","Saint Vincent and the Grenadines","1784"],["WS","Samoa","685"],["SM","San Marino","378"],["ST","Sao Tome and Principe","239"],["SA","Saudi Arabia","966"],["SN","Senegal","221"],["RS","Serbia","381"],["SC","Seychelles","248"],["SL","Sierra Leone","232"],["SG","Singapore","65"],["SK","Slovakia","421"],["SI","Slovenia","386"],["SB","Solomon Islands","677"],["SO","Somalia","252"],["ZA","South Africa","27"],["KR","South Korea","82"],["SS","South Sudan","211"],["ES","Spain","34"],["LK","Sri Lanka","94"],["SD","Sudan","249"],["SR","Suriname","597"],["SE","Sweden","46"],["CH","Switzerland","41"],["SY","Syria","963"],["TW","Taiwan","886"],["TJ","Tajikistan","992"],["TZ","Tanzania","255"],["TH","Thailand","66"],["TL","Timor-Leste","670"],["TG","Togo","228"],["TO","Tonga","676"],["TT","Trinidad and Tobago","1868"],["TN","Tunisia","216"],["TR","Turkey","90"],["TM","Turkmenistan","993"],["TC","Turks and Caicos Islands","1649"],["TV","Tuvalu","688"],["UG","Uganda","256"],["UA","Ukraine","380"],["AE","United Arab Emirates","971"],["GB","United Kingdom","44"],["US","United States","1"],["UY","Uruguay","598"],["UZ","Uzbekistan","998"],["VU","Vanuatu","678"],["VA","Vatican City","39"],["VE","Venezuela","58"],["VN","Vietnam","84"],["VG","Virgin Islands, British","1284"],["VI","Virgin Islands, U.S.","1340"],["YE","Yemen","967"],["ZM","Zambia","260"],["ZW","Zimbabwe","263"]].map(([t,e,r])=>({iso:t,name:e,dial:r})),Jx=t=>[...t.toUpperCase()].map(e=>String.fromCodePoint(127397+e.charCodeAt(0))).join(""),s5=()=>{let t="";try{if(Intl.DateTimeFormat().resolvedOptions().timeZone==="Africa/Lagos"&&(t="NG"),!t){const e=navigator.languages?.[0]||navigator.language;t=new Intl.Locale(e).region||""}}catch{t=""}return qa.find(e=>e.iso===t)??qa.find(e=>e.iso==="US")},l5=t=>{const e=s5(),r=t?.trim()??"";if(!r.startsWith("+"))return{country:e,national:r.replace(/\D/g,"")};const n=r.replace(/\D/g,""),a=[...qa].sort((i,o)=>o.dial.length-i.dial.length).find(i=>n.startsWith(i.dial))??e;return{country:a,national:n.slice(a.dial.length)}},Qx=(t,e)=>{const r=e.replace(/\D/g,"").replace(/^0+/,"");return r?`+${t.dial}${r}`:""},c5=t=>{const e=t.replace(/\D/g,"");return t.startsWith("+")&&e.length>=8&&e.length<=15},Ve=(t,e)=>_("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",...e,children:t}),u5=t=>_("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...t,children:_("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5 3.25h14A3.75 3.75 0 0 1 22.75 7v6A3.75 3.75 0 0 1 19 16.75h-7.19l-4.26 3.84A.75.75 0 0 1 6.25 20v-3.32A3.75 3.75 0 0 1 2.25 13V7A3.75 3.75 0 0 1 6 3.25Zm3 7.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z"})}),Ya=t=>Ve(_("path",{d:"m6 9 6 6 6-6"}),t),f5=t=>Ve(_(Me,{children:[_("path",{d:"m22 2-7 20-4-9-9-4Z"}),_("path",{d:"M22 2 11 13"})]}),t),ds=t=>Ve(_(Me,{children:[_("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),_("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),_("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),t),d5=t=>Ve(_(Me,{children:[_("path",{d:"M9 9v1a3 3 0 0 0 4.24 2.73"}),_("path",{d:"M15 5.5V5a3 3 0 0 0-5.94-.6"}),_("path",{d:"M19 10v2a7 7 0 0 1-9.9 6.36"}),_("path",{d:"M5 10v2a6.98 6.98 0 0 0 1.11 3.79"}),_("line",{x1:"12",y1:"19",x2:"12",y2:"22"}),_("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}),t),hs=t=>Ve(_(Me,{children:[_("path",{d:"M15 3h6v6"}),_("path",{d:"M10 14 21 3"}),_("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),t),h5=t=>Ve(_(Me,{children:[_("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),_("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),_("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),_("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),t),Sp=t=>Ve(_(Me,{children:[_("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),_("path",{d:"m22 7-10 5L2 7"})]}),t),p5=t=>Ve(_("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z"}),t),e1=t=>Ve(_(Me,{children:[_("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),_("path",{d:"M18 19h-2"}),_("rect",{x:"3",y:"13",width:"4",height:"6",rx:"2"}),_("rect",{x:"17",y:"13",width:"4",height:"6",rx:"2"})]}),t),v5=t=>Ve(_(Me,{children:[_("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z"}),_("path",{d:"M8 9h8M8 13h5"})]}),t),g5=t=>Ve(_(Me,{children:[_("path",{d:"M3 4h18M4 4v12h16V4M12 16v5M8 21h8"}),_("path",{d:"m8 12 2.5-2.5 2 2L16 8"})]}),t),m5=t=>Ve(_(Me,{children:[_("path",{d:"M15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}),_("path",{d:"M3 9h12M7 2v4M12 2v4"}),_("circle",{cx:"17",cy:"17",r:"4"}),_("path",{d:"M17 15v2l1.5 1"})]}),t),y5=t=>Ve(_(Me,{children:[_("path",{d:"M4 4h16v16H5a3 3 0 0 1-3-3V6"}),_("path",{d:"M8 8h8M8 12h8M8 16h5"})]}),t),_5=t=>Ve(_(Me,{children:[_("circle",{cx:"12",cy:"12",r:"9"}),_("path",{d:"M8.5 14.5a4 4 0 0 0 7 0"}),_("line",{x1:"9",y1:"9.5",x2:"9.01",y2:"9.5"}),_("line",{x1:"15",y1:"9.5",x2:"15.01",y2:"9.5"})]}),t),Qn=t=>Ve(_(Me,{children:[_("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),_("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),t),b5=t=>Ve(_(Me,{children:[_("path",{d:"M11 5 6 9H2v6h4l5 4z"}),_("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),_("path",{d:"M19 5a9 9 0 0 1 0 14"})]}),t),x5=t=>Ve(_(Me,{children:[_("path",{d:"M11 5 6 9H2v6h4l5 4z"}),_("line",{x1:"22",y1:"9",x2:"16",y2:"15"}),_("line",{x1:"16",y1:"9",x2:"22",y2:"15"})]}),t),Xa=t=>Ve(_("path",{d:"M20 6 9 17l-5-5"}),t),w5=t=>Ve(_(Me,{children:[_("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),_("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),t),S5=t=>Ve(_(Me,{children:[_("path",{d:"M1 4v6h6"}),_("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),t),k5=t=>Ve(_("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),t),eu=t=>Ve(_("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"}),t),kp=t=>Ve(_(Me,{children:[_("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),_("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}),t),T5=t=>Ve(_(Me,{children:[_("circle",{cx:"12",cy:"12",r:"9"}),_("path",{d:"M12 7v5l3 2"})]}),t),t1=t=>Ve(_(Me,{children:[_("path",{d:"M7 10v12"}),_("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),t),r1=t=>Ve(_(Me,{children:[_("path",{d:"M17 14V2"}),_("path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"})]}),t),Tp=t=>Ve(_(Me,{children:[_("path",{d:"M15 3h6v6"}),_("path",{d:"M9 21H3v-6"}),_("path",{d:"M21 3l-7 7"}),_("path",{d:"M3 21l7-7"})]}),t),C5=t=>Ve(_(Me,{children:[_("path",{d:"M9 3v6H3"}),_("path",{d:"M15 21v-6h6"}),_("path",{d:"M9 9 2 2"}),_("path",{d:"M15 15l7 7"})]}),t),M5=t=>Ve(_(Me,{children:[_("rect",{x:"3",y:"4",width:"18",height:"14",rx:"2"}),_("rect",{x:"11",y:"11",width:"8",height:"6",rx:"1",fill:"currentColor",stroke:"none"})]}),t),A5=t=>Ve(_(Me,{children:[_("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),_("path",{d:"M12 15V9"}),_("path",{d:"m8.5 12.5 3.5-3.5 3.5 3.5"})]}),t),D5=t=>Ve(_(Me,{children:[_("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),_("path",{d:"m19 12-7 7-7-7"})]}),t),n1=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(\[[^\]]+\]\([^\s)]+\))|(https?:\/\/[^\s)]+)/g,I5=t=>t.replace(/([^\n])\s+((?:[-*•]|\d+\.)\s+)(?=(?:\*\*[^*\n]{1,80}\*\*|[A-Z][A-Za-z0-9/& -]{1,50}:))/g,`$1
24
- $2`),Wi=t=>{const e=[];let r=0,n=0,a;for(n1.lastIndex=0;(a=n1.exec(t))!==null;){a.index>r&&e.push(t.slice(r,a.index));const i=a[0];if(i.startsWith("`"))e.push(_("code",{class:"cf-md-code",children:i.slice(1,-1)},n++));else if(i.startsWith("**"))e.push(_("strong",{children:i.slice(2,-2)},n++));else if(i.startsWith("[")&&!/\]\(https?:\/\//.test(i))e.push(/^\[([^\]]+)\]/.exec(i)?.[1]??i);else if(i.startsWith("[")){const o=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(i),s=o?o[1]:i,l=o?o[2]:"#";e.push(_("a",{href:l,target:"_blank",rel:"noopener noreferrer nofollow",children:s},n++))}else e.push(_("a",{href:i,target:"_blank",rel:"noopener noreferrer nofollow",children:i},n++));r=a.index+i.length}return r<t.length&&e.push(t.slice(r)),e},L5=/^(```|#{1,6}\s|\s*[-*•]\s|\s*\d+\.\s)/,P5=(t,e,r)=>{const n=`cf-md-h cf-md-h--${Math.min(t,6)}`;return t<=2?_("h3",{class:n,children:e},r):t===3?_("h4",{class:n,children:e},r):_("h5",{class:n,children:e},r)},R5=t=>{const e=I5(t.replace(/\r\n/g,`
74
+ `))!==-1;){const l=o.slice(0,u);o=o.slice(u+2);const d=Nc(l);if(d){if(d.event==="error")throw new un(502,d.data?.message??"stream error");if(d.event==="chunk"&&typeof d.data?.text=="string")i.answer+=d.data.text,t.onChunk(d.data.text);else if(d.event==="reset")i.answer="",t.onReset?.();else if(d.event==="final"&&d.data)typeof d.data.answer=="string"&&(i.answer=d.data.answer),i.sources=d.data.sources??[],i.suggestedReplies=d.data.suggestedReplies??[],i.availableActions=d.data.availableActions??[],i.actions=d.data.actions??[],i.selectedAction=d.data.selectedAction,i.handoffOffered=!!d.data.handoffOffered,i.requestedContactFields=Di(d.data.requestedContactFields),i.conversationEnded=!!d.data.conversationEnded,i.liveMode=d.data.liveMode,i.assignedAgentName=d.data.assignedAgentName,i.visualization=d.data.visualization,i.artifacts=d.data.artifacts,i.audioBase64=d.data.audioBase64,i.mimeType=d.data.mimeType,t.onTextReady?.();else if(d.event==="audio"&&d.data)typeof d.data.seq=="number"?(i.liveAudio=!0,t.onAudioSegment?.({seq:d.data.seq,audioBase64:d.data.audioBase64??"",mimeType:d.data.mimeType,text:typeof d.data.text=="string"?d.data.text:void 0})):(i.audioBase64=d.data.audioBase64,i.mimeType=d.data.mimeType);else if(d.event==="done")return i}}}return i},Nc=e=>{let t="message";const n=[];for(const a of e.split(`
75
+ `))a.startsWith("event:")?t=a.slice(6).trim():a.startsWith("data:")&&n.push(a.slice(5).trim());if(n.length===0)return{event:t};try{return{event:t,data:JSON.parse(n.join(`
76
+ `))}}catch{return{event:t}}},Di=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];let sr=()=>Promise.resolve().then(()=>Fo);const Rc=e=>{sr=e},Pi=e=>new Mc(e.apiBaseUrl,e.token,e.gifApiKey,e.analyticsContextToken,{agentName:e.agentName,agentAvatarUrl:e.agentAvatarUrl},e.identityToken,e.getIdentityToken,e.chatSurface),Oi=e=>{const t=n=>(...a)=>e().then(i=>i[n].apply(i,a));return{bootstrap:t("bootstrap"),history:t("history"),stream:t("stream"),liveEvents:t("liveEvents"),presence:t("presence"),typing:t("typing"),action:t("action"),speak:t("speak"),transcribe:t("transcribe"),searchGifs:t("searchGifs"),demoSlots:t("demoSlots"),identify:t("identify"),endConversation:t("endConversation"),sendFeedback:t("sendFeedback"),sendExplanationFeedback:t("sendExplanationFeedback"),uploadAttachment:t("uploadAttachment")}},Lc=e=>e.demo?Oi(async()=>new(await sr()).MockTransport):e.preview?Oi(async()=>{const{PreviewTransport:t}=await sr();return new t(Pi(e),e.strings)}):Pi(e),cr=16e3;class Dc{constructor(t){B(this,"ratio");B(this,"position",0);B(this,"carry",[]);this.ratio=t/cr}process(t){if(this.ratio===1)return t.slice();const n=this.carry.length?Float32Array.from([...this.carry,...t]):t,a=[];let i=this.position;for(;i+this.ratio<=n.length;){const s=Math.floor(i),c=Math.min(n.length,Math.floor(i+this.ratio));let u=0;for(let l=s;l<c;l+=1)u+=n[l]??0;a.push(c>s?u/(c-s):0),i+=this.ratio}const o=Math.floor(i);return this.carry=Array.from(n.subarray(o)),this.position=i-o,Float32Array.from(a)}}const Pc=(e,t=cr)=>{const n=e.reduce((c,u)=>c+u.length,0),a=new ArrayBuffer(44+n*2),i=new DataView(a),o=(c,u)=>{for(let l=0;l<u.length;l+=1)i.setUint8(c+l,u.charCodeAt(l))};o(0,"RIFF"),i.setUint32(4,36+n*2,!0),o(8,"WAVE"),o(12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(36,"data"),i.setUint32(40,n*2,!0);let s=44;for(const c of e)for(let u=0;u<c.length;u+=1){const l=Math.max(-1,Math.min(1,c[u]??0));i.setInt16(s,l<0?l*32768:l*32767,!0),s+=2}return new Blob([a],{type:"audio/wav"})},Fi=e=>e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").split(/\s+/).filter(t=>t.length>1),Oc=(e,t)=>{const n=Fi(e);if(n.length===0||!t.trim())return!1;const a=new Set(Fi(t));return n.filter(i=>a.has(i)).length/n.length>=.7},Ui=e=>{const t=e.replace(/```[\s\S]*?```/g,"").split(`
77
+ `),n=new Set;for(let a=1;a<t.length;a+=1){const i=t[a]?.trim().replace(/^\|/,"").replace(/\|$/,"");if(!(!t[a-1]?.includes("|")||!i||!i.split("|").every(o=>/^\s*:?-{3,}:?\s*$/.test(o)))){n.add(a-1),n.add(a);for(let o=a+1;o<t.length&&t[o]?.includes("|");o+=1)n.add(o)}}return t.filter((a,i)=>!n.has(i)).join(`
78
+ `).trim()},Fc=(e,t)=>{const n=t?.explanation,a=[n?.summary?.trim()||n?.headline?.trim(),n?.businessMeaning?.trim(),...n?.limitations??[]].filter(o=>!!o?.trim()),i=a.length?[...new Set(a)].join(`
79
+ `):e;return Ui(i)||(i.trim()?"The detailed results are available in the chat.":"")},Bi=300,Uc=()=>{const e=globalThis;if(e.__voiceDebug)return!0;try{return e.localStorage?.getItem("accurix.voiceDebug")==="1"}catch{return!1}};class Bc{constructor(t=()=>Date.now()){B(this,"now");B(this,"entries",[]);B(this,"startedAt");this.now=t,this.startedAt=t(),globalThis.__accurixVoiceLog=()=>this.list()}add(t,n){const a={at:Math.round(this.now()-this.startedAt),event:t,detail:n};this.entries.push(a),this.entries.length>Bi&&this.entries.splice(0,this.entries.length-Bi),Uc()&&console.debug(`VOICEDBG ${t} ${n?JSON.stringify(n):""}`)}list(){return this.entries.slice()}}const lr=cr/50,it=20,qc=500,Vc=120,jc=300,Hc=280,Wc=600,Gc=300,Kc=12e3,Yc=25e3,Zc=300,Jc=2e4,Xc=60,Qc=400,el=250,dr=8e-4,tl=.1,nl=2.8,al=1.8,rl=.006,il=.004,ol=1.8,sl=1.4,cl=2e3,ll=2e3;class dl{constructor(t){B(this,"options");B(this,"endSilenceMs");B(this,"pending",new Float32Array(0));B(this,"levels",[]);B(this,"framesSinceFloor",0);B(this,"floor",dr*4);B(this,"recentSpeech",[]);B(this,"preroll",[]);B(this,"silentMs",0);B(this,"inputSilent",!1);B(this,"outputActive",!1);B(this,"turns",[]);B(this,"nextTurnId",1);this.options=t,this.endSilenceMs=t.endSilenceMs??ll}get hearing(){return this.current()?.capturing??!1}get processing(){return this.turns.some(t=>!t.capturing&&!t.cancelled)}feed(t){let n=t;this.pending.length&&(n=new Float32Array(this.pending.length+t.length),n.set(this.pending),n.set(t,this.pending.length));let a=0;for(;a+lr<=n.length;)this.frame(n.slice(a,a+lr)),a+=lr;this.pending=n.slice(a)}setOutputActive(t){this.outputActive!==t&&(this.outputActive=t,this.options.log.add("output",{active:t}))}finishTurn(){const t=this.current();t&&(t.capturing?this.endTurn(t,"done"):t.closed||(t.closed=!0,t.endedBy="done",this.options.log.add("turn-done",{turn:t.id})))}reset(t){for(const n of this.turns)n.cancelled=!0;this.turns.length&&this.options.log.add("turns-dropped",{reason:t,count:this.turns.length}),this.turns=[],this.preroll=[],this.recentSpeech=[],this.pending=new Float32Array(0),this.options.onChange()}current(){return this.turns[this.turns.length-1]}frame(t){let n=0,a=0;for(let p=0;p<t.length;p+=1){const g=t[p]??0;n+=g*g,a=Math.max(a,Math.abs(g))}const i=Math.sqrt(n/t.length);this.trackInputSilence(a);const o=this.current();!o?.capturing&&!this.outputActive&&this.trackFloor(i);const s=this.outputActive,c=Math.max(rl,this.floor*nl)*(s?ol:1),u=Math.max(il,this.floor*al)*(s?sl:1),l=i>=c,d=i>=u;if(!o?.capturing){for(this.preroll.push(t);this.preroll.length*it>qc;)this.preroll.shift();this.recentSpeech.push(l);const p=(s?Wc:jc)/it;for(;this.recentSpeech.length>p;)this.recentSpeech.shift();const g=this.recentSpeech.filter(Boolean).length*it;g>=(s?Hc:Vc)&&this.beginCapture(g);return}o.chunk.push(t),o.chunkMs+=it,o.durationMs+=it,l&&(o.voicedMs+=it,o.chunkVoicedMs+=it),o.quietMs=d?0:o.quietMs+it,s&&(o.overlappedOutput=!0),o.quietMs>=this.endSilenceMs?this.endTurn(o,"silence"):(o.chunkMs>=Yc||o.chunkMs>=Kc&&o.quietMs>=Zc||o.chunkMs>=Jc&&o.quietMs>=Xc)&&this.cutChunk(o)}trackFloor(t){if(this.levels.push(t),this.levels.length>el&&this.levels.shift(),this.framesSinceFloor+=1,this.framesSinceFloor<10&&this.levels.length>10)return;this.framesSinceFloor=0;const n=this.levels.slice().sort((a,i)=>a-i);this.floor=Math.max(dr,n[Math.floor(n.length*tl)]??dr)}trackInputSilence(t){this.silentMs=t===0?this.silentMs+it:0;const n=this.silentMs>=cl;n!==this.inputSilent&&(this.inputSilent=n,this.options.log.add("input-silent",{silent:n}),this.options.onInputSilent?.(n))}beginCapture(t){const n=this.current();let a;n&&!n.capturing&&!n.closed?(a=n,a.capturing=!0,this.options.log.add("turn-resumed",{turn:a.id})):(a={id:this.nextTurnId++,capturing:!0,closed:!1,endedBy:"silence",chunk:[],chunkMs:0,chunkVoicedMs:0,quietMs:0,voicedMs:0,durationMs:0,overlappedOutput:this.outputActive,results:[],chunkCount:0,cancelled:!1},this.turns.push(a),this.options.log.add("turn-start",{turn:a.id,overOutput:this.outputActive}),this.options.listener.speechStart?.({turnId:a.id,overlappedOutput:this.outputActive})),a.chunk.push(...this.preroll),a.chunkMs+=this.preroll.length*it,a.durationMs+=this.preroll.length*it,a.voicedMs+=t,a.chunkVoicedMs+=t,a.quietMs=0,this.preroll=[],this.recentSpeech=[],this.options.onChange()}endTurn(t,n){const a=Math.max(0,Math.floor((t.quietMs-Qc)/it));if(a>0&&(t.chunk.splice(t.chunk.length-Math.min(a,t.chunk.length)),t.chunkMs=t.chunk.length*it),t.capturing=!1,t.endedBy=n,n==="done"&&(t.closed=!0),this.options.log.add("turn-end",{turn:t.id,by:n,ms:t.durationMs,voicedMs:t.voicedMs}),t.chunkCount===0&&t.voicedMs<Gc){this.turns=this.turns.filter(i=>i!==t),this.options.log.add("turn-noise",{turn:t.id,reason:"too-short"}),this.options.listener.noise?.({id:t.id,reason:"too-short",overlappedOutput:t.overlappedOutput}),this.options.onChange();return}this.cutChunk(t),this.options.onChange(),this.settle()}cutChunk(t){if(t.chunk.length===0)return;const n=t.chunk,a=t.chunkCount;t.chunkCount+=1,t.results[a]=void 0,t.chunk=[];const i=n.length*it,o=t.chunkVoicedMs;if(t.chunkMs=0,t.chunkVoicedMs=0,o===0&&a>0){t.results[a]="";return}this.options.log.add("chunk",{turn:t.id,index:a,ms:i}),this.options.transcribe({audio:Pc(n),mimeType:"audio/wav",durationSeconds:i/1e3,turnId:t.id,chunkIndex:a}).then(s=>(s??"").trim(),()=>null).then(s=>{if(t.cancelled)return;t.results[a]=s,this.options.log.add("chunk-text",{turn:t.id,index:a,chars:s===null?-1:s.length});const c=[];for(const u of t.results){if(u===void 0)break;u&&c.push(u)}c.length&&this.options.listener.partial?.({turnId:t.id,text:c.join(" ")}),this.settle()})}settle(){for(;this.turns.length;){const t=this.turns[0];if(!t||t.capturing||t.results.some(o=>o===void 0))return;this.turns.shift();const n=t.results.filter(o=>typeof o=="string"&&o!==""),a=t.results.every(o=>o===null),i=n.join(" ").replace(/\s+/g," ").trim();if(i)this.options.log.add("turn",{turn:t.id,chars:i.length,by:t.endedBy}),this.options.listener.turn?.({id:t.id,text:i,durationMs:t.durationMs,endedBy:t.endedBy,overlappedOutput:t.overlappedOutput});else{const o=a?"transcribe-failed":"empty-transcript";this.options.log.add("turn-noise",{turn:t.id,reason:o}),this.options.listener.noise?.({id:t.id,reason:o,overlappedOutput:t.overlappedOutput})}this.options.onChange()}}}const ul=2048,pl=[300,1e3,2500],fl=()=>typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"&&typeof globalThis.AudioContext=="function",hl=e=>{const t=e?.name;return t==="NotAllowedError"||t==="SecurityError"?"permission-denied":t==="NotFoundError"||t==="OverconstrainedError"?"no-device":"error"};class qi{constructor(t){B(this,"options");B(this,"log",new Bc);B(this,"turns");B(this,"mic","off");B(this,"reason");B(this,"muted",!1);B(this,"inputSilent",!1);B(this,"stream",null);B(this,"context",null);B(this,"source",null);B(this,"processor",null);B(this,"sink",null);B(this,"downsampler",null);B(this,"deviceId");B(this,"generation",0);B(this,"recoveryAttempt",0);B(this,"recoveryTimer",null);B(this,"lastSnapshot","");B(this,"groupId");B(this,"onTrackEnded",()=>{this.log.add("track-ended"),this.recover("track-ended")});B(this,"onTrackMuteChange",()=>{const t=this.stream?.getAudioTracks()[0];this.log.add("track-mute-change",{muted:!!t?.muted}),this.refreshMic()});B(this,"onContextState",()=>{const t=this.context?.state;this.log.add("audio-state",{state:t}),(t==="suspended"||t==="interrupted")&&this.context?.resume().catch(()=>{}),this.refreshMic()});B(this,"onDeviceChange",()=>{this.checkDevices()});this.options=t,this.deviceId=t.deviceId,this.turns=new dl({transcribe:t.transcribe,listener:t.listener,log:this.log,endSilenceMs:t.endSilenceMs,onChange:()=>this.publish(),onInputSilent:n=>{this.inputSilent=n,this.publish()}})}get snapshot(){let t=this.mic,n=this.reason;return t==="listening"&&this.inputSilent&&(t="unavailable",n="input-silent"),t==="listening"&&this.turns.hearing&&(t="hearing"),{mic:t,processing:this.turns.processing,reason:t==="unavailable"?n:void 0}}get active(){return this.mic!=="off"}async start(){this.mic==="off"&&(this.log.add("start"),this.mediaDevices()?.addEventListener("devicechange",this.onDeviceChange),await this.open("start"))}stop(t="stopped"){this.mic!=="off"&&(this.log.add("stop",{reason:t}),this.generation+=1,this.clearRecovery(),this.mediaDevices()?.removeEventListener("devicechange",this.onDeviceChange),this.turns.reset(t),this.close(),this.context?.close().catch(()=>{}),this.context=null,this.setMic("off"))}setMuted(t){if(!(this.muted===t||this.mic==="off")){this.muted=t,this.log.add(t?"mute":"unmute");for(const n of this.stream?.getAudioTracks()??[])n.enabled=!t;t?(this.turns.reset("muted"),this.setMic("muted")):this.refreshMic()}}finishTurn(){this.log.add("done-pressed"),this.turns.finishTurn()}setOutputActive(t){this.turns.setOutputActive(t)}async selectDevice(t){t!==this.deviceId&&(this.deviceId=t,this.mic!=="off"&&(this.log.add("device-selected"),this.turns.reset("device-selected"),this.close(),await this.open("device-selected")))}mediaDevices(){return this.options.media?.mediaDevices??(typeof navigator<"u"?navigator.mediaDevices:void 0)}async open(t){const n=++this.generation;this.setMic("starting");const a=this.options.media?.getUserMedia??(fl()?o=>navigator.mediaDevices.getUserMedia(o):null);if(!a){this.unavailable("unsupported");return}let i;try{i=await a({audio:{...this.deviceId?{deviceId:{exact:this.deviceId}}:{},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(o){if(n!==this.generation)return;const s=hl(o);if(this.log.add("mic-open-failed",{why:t,reason:s}),s==="no-device"&&this.deviceId){this.deviceId=void 0,await this.open("default-device");return}this.unavailable(s);return}if(n!==this.generation){i.getTracks().forEach(o=>o.stop());return}try{this.connect(i)}catch(o){this.log.add("audio-setup-failed",{message:String(o?.name??"error")}),i.getTracks().forEach(s=>s.stop()),this.unavailable("error");return}this.recoveryAttempt=0,this.groupId=i.getAudioTracks()[0]?.getSettings?.().groupId,this.log.add("mic-open",{why:t}),this.refreshMic()}connect(t){this.stream=t;for(const a of t.getAudioTracks())a.enabled=!this.muted,a.addEventListener("ended",this.onTrackEnded),a.addEventListener("mute",this.onTrackMuteChange),a.addEventListener("unmute",this.onTrackMuteChange);const n=this.context??this.options.media?.createAudioContext?.()??new globalThis.AudioContext;this.context||(this.context=n,n.addEventListener("statechange",this.onContextState)),n.state==="suspended"&&n.resume().catch(()=>{}),this.downsampler=new Dc(n.sampleRate),this.source=n.createMediaStreamSource(t),this.processor=n.createScriptProcessor(ul,1,1),this.sink=n.createGain(),this.sink.gain.value=0,this.processor.onaudioprocess=a=>{if(this.muted||!this.downsampler)return;const i=this.downsampler.process(a.inputBuffer.getChannelData(0));if(this.turns.feed(i),this.options.listener.level&&i.length){let o=0;for(const s of i)o+=s*s;this.options.listener.level(Math.sqrt(o/i.length))}},this.source.connect(this.processor),this.processor.connect(this.sink),this.sink.connect(n.destination)}close(){this.processor&&(this.processor.onaudioprocess=null),this.source?.disconnect(),this.processor?.disconnect(),this.sink?.disconnect(),this.source=null,this.processor=null,this.sink=null;for(const t of this.stream?.getTracks()??[])t.removeEventListener("ended",this.onTrackEnded),t.removeEventListener("mute",this.onTrackMuteChange),t.removeEventListener("unmute",this.onTrackMuteChange),t.stop();this.stream=null,this.inputSilent=!1}refreshMic(){if(this.mic==="off")return;if(this.muted)return this.setMic("muted");const t=this.stream?.getAudioTracks()[0];if(!t||t.readyState!=="live")return this.unavailable("device-lost");if(t.muted)return this.unavailable("track-muted");if(this.context&&this.context.state!=="running")return this.unavailable("audio-suspended");this.reason=void 0,this.setMic("listening")}unavailable(t){this.reason=t,this.setMic("unavailable")}setMic(t){this.mic!==t&&this.log.add("mic",{state:t,reason:t==="unavailable"?this.reason:void 0}),this.mic=t,this.publish()}publish(){const t=this.snapshot,n=JSON.stringify(t);n!==this.lastSnapshot&&(this.lastSnapshot=n,this.options.listener.state?.(t))}recover(t){if(this.mic==="off"||this.recoveryTimer)return;const n=pl[this.recoveryAttempt];if(this.turns.reset(t),this.close(),n===void 0){this.log.add("mic-recovery-gave-up",{why:t}),this.unavailable("device-lost");return}this.recoveryAttempt+=1,this.unavailable("device-lost"),this.log.add("mic-recovering",{why:t,attempt:this.recoveryAttempt}),this.recoveryTimer=setTimeout(()=>{this.recoveryTimer=null,this.mic!=="off"&&this.open(t)},n)}clearRecovery(){this.recoveryTimer&&clearTimeout(this.recoveryTimer),this.recoveryTimer=null,this.recoveryAttempt=0}async checkDevices(){const t=this.stream?.getAudioTracks()[0];if(!t||t.readyState!=="live"){this.log.add("device-change",{live:!1}),this.recover("device-change");return}let n=[];try{n=(await this.mediaDevices()?.enumerateDevices()??[]).filter(s=>s.kind==="audioinput")}catch{return}const a=n.some(s=>!this.groupId||s.groupId===this.groupId),i=n.find(s=>s.deviceId==="default"),o=!this.deviceId&&i!==void 0&&this.groupId!==void 0&&i.groupId!==this.groupId;this.log.add("device-change",{live:!0,ours:a,defaultMoved:o}),(!a||o)&&this.recover("device-change")}}const ur=e=>!!(e?.headline?.trim()||e?.summary?.trim()),ml=(e,t={})=>{const n=e?.explanation??void 0,a=e?.businessAnalysis?.explanation??void 0,i=[t.requested??void 0,n?.source==="ai_grounded"?n:void 0,a,n];for(const o of i)if(o&&ur(o))return o;return t.fallback?.()},vt={eyebrow:"Answer from your data",provenanceAI:"AI-assisted · evidence checked",provenanceGoverned:"Based on current values",comparison:"Comparison",conclusions:"What we can conclude",whyItMatters:"Why it matters",limits:"Important limits",investigate:"Investigate further",evidenceList:"Evidence checked",causes:"Possible causes",causesHint:"Not proven causes",howToCheck:"How to check:",recommendations:"Recommended next steps",watch:"Watch:",outlook:"Outlook",followUps:"Ask a follow-up",sourceNoteAI:"AI-assisted wording, checked against the live values shown here.",sourceNoteGoverned:"Based only on the live values shown here.",evidence:"Evidence",evidenceMetric:"Metric",evidencePeriod:"Period",evidenceTimezone:"Timezone",evidenceFilters:"Filters",evidenceValue:"Value",evidenceStatus:"Status",evidenceSource:"Source",evidenceChecked:"Checked",openSource:"Open source",closeEvidence:"Close evidence details",citationLabel:"Show evidence",sourceCard:"This card",sourceSupportingQuery:"Supporting query",feedbackPrompt:"Was this explanation helpful?",feedbackHelpful:"Helpful explanation",feedbackNotHelpful:"Unhelpful explanation",feedbackReasonsPrompt:"What went wrong? (optional)",feedbackCommentPlaceholder:"Anything else? (optional)",feedbackSubmit:"Send feedback",feedbackThanks:"Thanks for the feedback.",feedbackUndo:"Undo",feedbackError:"Feedback could not be saved. Try again.",notComparable:"Not comparable yet",basicExplanation:"Basic explanation",preparingDetailed:"Preparing a detailed explanation…",detailedReady:"Detailed explanation ready.",detailedUnavailable:"A detailed explanation is not available right now.",detailedRetry:"Try again",region:"Explanation",inProgress:"in progress",expand:"Expand explanation",collapse:"Collapse explanation",reasonWrongNumbers:"Wrong numbers",reasonMissingComparison:"Missing comparison",reasonUnclear:"Unclear",reasonTooLong:"Too long"},Vi=[{id:"wrong_numbers",label:"Wrong numbers"},{id:"missing_comparison",label:"Missing comparison"},{id:"unclear",label:"Unclear"},{id:"too_long",label:"Too long"}],pr=500,gl=e=>e==="ai_grounded"||e==="rag_deterministic_analysis",ji=e=>{switch(e){case"confirmed_zero":return"confirmed 0";case"empty_bucket":case"unconfirmed_zero":return"no records yet";case"missing":return"missing";default:return""}},Hi=e=>{switch(e){case"confirmed_zero":return"confirmed";case"empty_bucket":case"unconfirmed_zero":return"caution";case"missing":return"missing";default:return"neutral"}},bl=e=>{const t=(e??"").trim().toLowerCase().replaceAll("-","_");return t==="low"||t==="low_quality"?"Low-confidence forecast":t==="medium"||t==="directional"?"Directional forecast":t==="high"||t==="validated"||t==="trusted"?"Validated forecast":"Forecast estimate"},Wi=/^\d{4}-\d{2}-\d{2}$/,ma=(e,t,n,a)=>{try{return new Intl.DateTimeFormat(t,a?{...n,timeZone:a}:n).format(e)}catch{return new Intl.DateTimeFormat(t,n).format(e)}},Gi=(e,t)=>ma(e,"en-CA",{year:"numeric",month:"2-digit",day:"2-digit"},t),Ki=(e,t={})=>{const n=e?.trim();if(!n)return"";const a=new Date(n);if(Number.isNaN(a.getTime()))return"";const i={hour:"2-digit",minute:"2-digit",hour12:!1},o=Gi(a,t.timezone)===Gi(t.now??new Date,t.timezone);return ma(a,t.locale,o?i:{...i,month:"short",day:"numeric"},t.timezone)},vl=(e,t={})=>{const n=e.timezone?.trim(),a=Ki(e.checkedAt,{...t,timezone:n});return[n?`Times in ${n}`:"",a?`Checked ${a}`:""].filter(Boolean).join(" · ")},Yi=(e,t,n)=>{const a=e?.trim();if(!a)return"";if(Wi.test(a)){const o=new Date(`${a}T00:00:00Z`);return Number.isNaN(o.getTime())?a:ma(o,t,{day:"numeric",month:"short",year:"numeric"},"UTC")}const i=new Date(a);return Number.isNaN(i.getTime())?a:ma(i,t,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1},n)},xl=(e,t={})=>{if(!e)return"";const n=e.timezone?.trim()||t.timezone?.trim(),a=Yi(e.start,t.locale,n),i=Yi(e.end,t.locale,n);return a&&i?`${a} – ${i} (end not included)`:a?`From ${a}`:i?`Before ${i}`:""},yl=(e,t,n)=>{if(!e)return{label:"Updated",description:"Source freshness is unavailable.",tone:"neutral"};if(e.status==="current")return{label:"Fresh",description:"Source data is current.",tone:"success"};if(e.status==="no_data")return{label:"No source data",description:"No source data is available for this period or an earlier period.",tone:"neutral"};if(e.status!=="delayed")return{label:"Updated",description:"Source freshness is unavailable.",tone:"neutral"};const a=s=>{if(!s)return"";const c=Wi.test(s)?new Date(`${s}T00:00:00`):new Date(s);return Number.isNaN(c.getTime())?"":new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(c)},i=a(e.dataAsOf),o=a(t);return{label:`${o?`Checked ${o} · `:""}Latest record${i?` ${i}`:""}`,description:`Latest matching record${i?`: ${i}`:" date is unavailable"}. An older record alone does not prove a source delay.`,tone:"neutral"}},Ke=(e,t)=>t(String(e??"").replace(/\s+/g," ").trim()).trim(),Zi=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e.toLocaleString(t):"",_l=e=>{const t=[];return e?.liveboardTileId?.trim()&&t.push({kind:"liveboard_tile",id:e.liveboardTileId.trim()}),e?.insightId?.trim()&&t.push({kind:"insight",id:e.insightId.trim()}),e?.queryRunId?.trim()&&t.push({kind:"query_run",id:e.queryRunId.trim()}),t},wl=(e,t={})=>{const{locale:n}=t,a={...vt,...t.copy},i=t.cleanText??(_=>_),o=e.timezone?.trim()||void 0,s=new Map;for(const _ of e.evidenceItems??[])_?.id?.trim()&&!s.has(_.id.trim())&&s.set(_.id.trim(),_);const c=[],u={},l=_=>{const L=_?.trim();if(!L)return;const $=u[L];if($)return{id:L,index:$.index};const P=s.get(L);if(!P)return;const fe=P.valueStatus,oe=ji(fe)||(fe==="observed"?"observed":""),Ue=P.source?.kind,ke={id:L,index:c.length+1,text:Ke(P.text,i),...P.metric?.trim()?{metric:P.metric.trim()}:{},...P.period?.label?.trim()?{periodLabel:P.period.label.trim()}:{},...(()=>{const Ce=xl(P.period,{locale:n,timezone:o});return Ce?{periodRange:Ce}:{}})(),...P.period?.timezone?.trim()||o?{timezone:P.period?.timezone?.trim()||o}:{},...P.filters?.length?{filters:P.filters.map(Ce=>Ce.trim()).filter(Boolean)}:{},...(()=>{const Ce=Zi(P.value,n);return Ce?{valueText:Ce}:{}})(),...oe?{statusLabel:oe}:{},statusTone:Hi(fe),...P.statusReason?.trim()?{statusReason:Ke(P.statusReason,i)}:{},...Ue==="card"?{sourceLabel:vt.sourceCard}:Ue==="supporting_query"?{sourceLabel:vt.sourceSupportingQuery}:{},sourceTargets:_l(P.source),...(()=>{const Ce=Ki(P.checkedAt??e.checkedAt,{locale:n,timezone:o,now:t.now});return Ce?{checkedText:Ce}:{}})()};return ke.filters&&ke.filters.length===0&&delete ke.filters,c.push(ke),u[L]=ke,{id:L,index:ke.index}},d=_=>{const L=new Set,$=[];for(const P of _??[]){const fe=l(P);fe&&!L.has(fe.id)&&(L.add(fe.id),$.push(fe))}return $},p=gl(e.source)||e.level==="detailed",g=Ke(e.headline,i)||Ke(e.summary,i),f={text:g,citations:d(e.headlineEvidenceIds)},y=Ke(e.summary,i),h=y&&y!==g?{text:y,citations:d(e.summaryEvidenceIds)}:void 0;if(!h&&y&&e.summaryEvidenceIds?.length)for(const _ of d(e.summaryEvidenceIds))f.citations.some(L=>L.id===_.id)||f.citations.push(_);const I=(e.periods??[]).filter(_=>_?.label?.trim()).map(_=>{const L=_.valueStatus,$=ji(L),P=_.valueText?.trim()||Zi(_.value,n)||(L==="missing"?"—":""),fe=$?_.statusReason?.trim()||s.get(_.evidenceId?.trim()??"")?.statusReason?.trim():"",oe=l(_.evidenceId);return{key:_.evidenceId||`${_.label}-${_.start??""}-${_.end??""}`,label:_.label.trim(),valueText:P,...L?{status:L}:{},statusLabel:$,statusTone:Hi(L),inProgress:!!_.inProgress,current:!!_.current,...fe?{reason:Ke(fe,i)}:{},...oe?{citation:oe}:{}}}),x=t.maxConclusions??4,m=(e.evidenceStatements??[]).map(_=>({text:Ke(_.text,i),citations:d(_.evidenceIds)})).filter(_=>_.text),T=(m.length>0?m:(e.evidence??[]).map(_=>Ke(_,i)).filter(Boolean).map(_=>({text:_,citations:[]}))).filter((_,L,$)=>$.findIndex(P=>P.text===_.text)===L).filter(_=>_.text!==f.text&&_.text!==h?.text).slice(0,x),F=Ke(e.businessMeaning,i),M=F?{text:F,citations:d(e.businessMeaningEvidenceIds)}:void 0,Q=[],Y=_=>{_.text&&!Q.some(L=>L.text===_.text)&&Q.push(_)},X=(e.limitations??[]).map(_=>_.toLowerCase());for(const _ of I){const L=X.some($=>$.includes(_.label.toLowerCase())&&$.includes("in progress"));_.inProgress&&!L&&Y({kind:"in_progress",text:`${_.label} is still in progress, so its total can still change.`,..._.citation?{citation:_.citation}:{}}),(_.status==="empty_bucket"||_.status==="unconfirmed_zero")&&Y({kind:"no_records",text:`${_.label} has no records yet. This is not a confirmed 0${_.reason?`: ${_.reason.replace(/\.$/,"")}`:""}.`,..._.citation?{citation:_.citation}:{}}),_.status==="missing"&&Y({kind:"missing",text:`${_.label} is missing${_.reason?`: ${_.reason.replace(/\.$/,"")}`:""}.`,..._.citation?{citation:_.citation}:{}})}e.currentPeriodInProgress&&!I.some(_=>_.inProgress)&&Y({kind:"in_progress",text:"The current period is still in progress, so its total can still change."});for(const _ of e.missing??[]){if(!_?.label?.trim()||!_.reason?.trim())continue;const L=l(_.evidenceId);Y({kind:"missing",text:kl(_),...L?{citation:L}:{}})}(e.dataFreshness?.status==="delayed"||e.dataFreshness?.status==="no_data")&&Y({kind:"freshness",text:yl(e.dataFreshness,e.checkedAt,n).description});for(const _ of e.limitations??[]){const L=Ke(_,i);L&&Y({kind:"limitation",text:L})}const j=(e.possibleDrivers??[]).map(_=>({title:Ke(_.hypothesis,i),howToCheck:Ke(_.howToCheck,i),citations:d(_.evidenceIds)})).filter(_=>_.title).slice(0,t.maxCauses??3),U=(e.recommendations??[]).map(_=>({title:Ke(_.action,i),why:Ke(_.why,i),..._.successMetric?.trim()?{watch:Ke(_.successMetric,i)}:{},citations:d(_.evidenceIds)})).filter(_=>_.title).slice(0,t.maxRecommendations??3),D=Ke(e.forecast?.text,i),q=D?{badge:bl(e.forecast?.qualityStatus),text:D,...e.forecast?.limitations?.trim()?{note:Ke(e.forecast.limitations,i)}:{}}:void 0,C=(e.followUps??[]).map(_=>Ke(_,i)).filter(Boolean).filter((_,L,$)=>$.indexOf(_)===L).slice(0,t.maxFollowUps??4);for(const _ of s.keys())l(_);const Z=Ke(e.conversationalPreface,i);return{...e.explanationId?.trim()?{explanationId:e.explanationId.trim()}:{},ai:p,lead:{eyebrow:a.eyebrow,provenance:p?a.provenanceAI:e.level==="basic"?a.basicExplanation:a.provenanceGoverned,...Z?{preface:Z}:{},headline:f,...h?{summary:h}:{}},comparison:I,conclusions:T,...M?{businessMeaning:M}:{},limits:Q,checkedLine:vl(e,{locale:n,now:t.now}),investigate:{causes:j,recommendations:U,...q?{outlook:q}:{},followUps:C},hasInvestigate:j.length>0||U.length>0||!!q||C.length>0||c.length>0,evidence:c,evidenceById:u,sourceNote:p?a.sourceNoteAI:a.sourceNoteGoverned}},kl=e=>`${e.label.trim()} could not be established: ${e.reason.trim()}`,Sl=e=>`[${e.index}]`,$l=(e,t)=>{const n={...vt,...t},a=[];e.metric&&a.push({key:"metric",label:n.evidenceMetric,value:e.metric});const i=[e.periodLabel,e.periodRange].filter(Boolean).join(" · ");i&&a.push({key:"period",label:n.evidencePeriod,value:i}),e.timezone&&a.push({key:"timezone",label:n.evidenceTimezone,value:e.timezone}),e.filters?.length&&a.push({key:"filters",label:n.evidenceFilters,value:e.filters.join("; ")});const o=[e.valueText,e.statusLabel].filter(Boolean).join(" · ");return o&&a.push({key:"value",label:n.evidenceValue,value:o}),e.statusReason&&a.push({key:"reason",label:n.evidenceStatus,value:e.statusReason}),e.sourceLabel&&a.push({key:"source",label:n.evidenceSource,value:e.sourceLabel}),e.checkedText&&a.push({key:"checked",label:n.evidenceChecked,value:e.checkedText}),a},Tl=e=>{const t=new Set(Vi.map(i=>i.id)),n=Array.from(e.comment??"").map(i=>{const o=i.charCodeAt(0);return o<32||o>=127&&o<=159?" ":i}).join("").replace(/\s+/g," ").trim(),a=e.rating==="down"?[...new Set(e.reasons??[])].filter(i=>t.has(i)).slice(0,4):[];return{explanationId:e.explanationId,rating:e.rating,...a.length?{reasons:a}:{},...e.rating!=="clear"&&n?{comment:Array.from(n).slice(0,pr).join("")}:{},...e.modelId?{modelId:e.modelId}:{},...typeof e.modelVersion=="number"&&e.modelVersion>0?{modelVersion:e.modelVersion}:{}}},Cl=(e,t)=>{const n=`.${e}-xp`;return`
80
+ ${n}{display:grid;gap:12px;color:${t.text};font-size:13px;line-height:1.55;min-width:0}
81
+ ${n} h3,${n} h4,${n} p,${n} ul,${n} ol,${n} dl,${n} dd{margin:0}
82
+ ${n} ul,${n} ol{padding:0;list-style:none}
83
+ ${n}__lead{display:grid;gap:6px}
84
+ ${n}__meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px}
85
+ ${n}__eyebrow{color:${t.accent};font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}
86
+ ${n}__provenance{display:inline-flex;align-items:center;gap:6px;color:${t.muted};font-size:11px;font-weight:600}
87
+ ${n}__provenance::before{content:"";width:6px;height:6px;border-radius:999px;background:${t.accent}}
88
+ ${n}__preface{color:${t.muted}}
89
+ ${n}__headline{color:${t.text};font-size:16px;font-weight:700;line-height:1.4;letter-spacing:-.01em}
90
+ ${n}__summary{color:${t.muted}}
91
+ ${n}{position:relative}
92
+ ${n}__expand{position:absolute;inset-block-start:0;inset-inline-end:0;display:grid;width:28px;height:28px;place-items:center;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:14px;line-height:1;cursor:pointer}
93
+ ${n}.is-expanded{max-width:none;font-size:14px}
94
+ ${n}.has-expand ${n}__lead{padding-inline-end:36px}
95
+ ${n}__ai{min-height:18px;color:${t.muted};font-size:12px}
96
+ ${n}__ai-note{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:0}
97
+ ${n}__ai[data-ai-status="pending"] ${n}__ai-note::before{content:"";width:6px;height:6px;border-radius:999px;background:${t.accent};animation:${n.replace(/[^a-z0-9]/gi,"")}-ai-pulse 1.2s ease-in-out infinite}
98
+ ${n}__ai-retry{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-weight:600;padding:2px 10px;cursor:pointer}
99
+ ${n}__ai-retry:disabled{opacity:.6;cursor:default}
100
+ ${n}__sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
101
+ @keyframes ${n.replace(/[^a-z0-9]/gi,"")}-ai-pulse{0%,100%{opacity:.35}50%{opacity:1}}
102
+ @media (prefers-reduced-motion:reduce){${n}__ai-note::before{animation:none}}
103
+ ${n}__step{display:grid;gap:8px;border-top:1px solid ${t.border};padding-top:12px}
104
+ ${n}__title{color:${t.text};font-size:12px;font-weight:700}
105
+ ${n}__periods{display:grid;gap:6px}
106
+ ${n}__period{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;border:1px solid ${t.border};border-radius:10px;background:${t.subtle};padding:8px 10px}
107
+ ${n}__period-label{min-width:0;flex:1 1 auto;color:${t.muted};font-weight:600}
108
+ ${n}__period-value{color:${t.text};font-size:15px;font-weight:700;font-variant-numeric:tabular-nums}
109
+ ${n}__period-reason{flex-basis:100%;color:${t.muted};font-size:11px}
110
+ ${n}__chip{display:inline-flex;align-items:center;border-radius:999px;padding:2px 8px;font-size:11px;font-weight:650;white-space:nowrap;border:1px solid transparent}
111
+ ${n}__chip.is-confirmed{background:color-mix(in srgb,${t.success} 12%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.success} 35%,transparent)}
112
+ ${n}__chip.is-caution{background:color-mix(in srgb,${t.warning} 14%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.warning} 40%,transparent)}
113
+ ${n}__chip.is-missing{background:color-mix(in srgb,${t.danger} 10%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.danger} 35%,transparent)}
114
+ ${n}__chip.is-progress{background:transparent;color:${t.muted};border-color:${t.border}}
115
+ ${n}__list{display:grid;gap:6px}
116
+ ${n}__list>li{position:relative;padding-inline-start:14px;color:${t.text}}
117
+ ${n}__list>li::before{content:"";position:absolute;inset-inline-start:2px;top:.62em;width:5px;height:5px;border-radius:999px;background:${t.accent}}
118
+ ${n}__limits>li::before{background:${t.warning}}
119
+ ${n}__meaning{border-inline-start:2px solid ${t.accent};border-start-end-radius:8px;border-end-end-radius:8px;background:color-mix(in srgb,${t.accent} 7%,transparent);padding:8px 10px;color:${t.text}}
120
+ ${n}__meaning strong{font-weight:700}
121
+ ${n}__checked{color:${t.muted};font-size:11px}
122
+ ${n}__cite{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;margin-inline-start:3px;vertical-align:middle;border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.accent};font:inherit;font-size:11px;font-weight:700;line-height:1;padding:0 5px;cursor:pointer}
123
+ ${n}__cite:hover,${n}__cite[aria-expanded="true"]{border-color:${t.accent};background:color-mix(in srgb,${t.accent} 10%,${t.surface})}
124
+ ${n} button:focus-visible,${n} summary:focus-visible,${n} textarea:focus-visible{outline:2px solid ${t.accent};outline-offset:2px}
125
+ ${n}__evidence-panel{display:grid;gap:8px;border:1px solid color-mix(in srgb,${t.accent} 35%,${t.border});border-radius:10px;background:${t.surface};padding:10px 12px;box-shadow:0 6px 18px color-mix(in srgb,${t.text} 12%,transparent)}
126
+ ${n}__evidence-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
127
+ ${n}__evidence-text{color:${t.text};font-weight:650}
128
+ ${n}__evidence-rows{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:4px 12px;font-size:12px}
129
+ ${n}__evidence-rows dt{color:${t.muted}}
130
+ ${n}__evidence-rows dd{color:${t.text};overflow-wrap:anywhere}
131
+ ${n}__evidence-actions{display:flex;flex-wrap:wrap;gap:8px}
132
+ ${n}__button{display:inline-flex;align-items:center;gap:6px;min-height:32px;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;font-weight:600;padding:5px 10px;cursor:pointer}
133
+ ${n}__button:hover{border-color:${t.accent}}
134
+ ${n}__button.is-primary{border-color:${t.accent};background:${t.accent};color:${t.onAccent??"#fff"}}
135
+ ${n}__close{border:0;background:transparent;color:${t.muted};font:inherit;font-size:16px;line-height:1;padding:2px 6px;cursor:pointer;border-radius:6px}
136
+ ${n}__investigate{border-top:1px solid ${t.border};padding-top:10px}
137
+ ${n}__investigate>summary{cursor:pointer;color:${t.text};font-weight:700;list-style:revert}
138
+ ${n}__investigate-body{display:grid;gap:12px;margin-top:10px}
139
+ ${n}__group{display:grid;gap:6px}
140
+ ${n}__group-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 8px}
141
+ ${n}__hint{color:${t.muted};font-size:11px;font-weight:600}
142
+ ${n}__card{border-radius:8px;background:${t.subtle};padding:8px 10px}
143
+ ${n}__card-title{color:${t.text};font-weight:700}
144
+ ${n}__card-body{margin-top:2px;color:${t.muted};font-size:12px}
145
+ ${n}__questions{display:flex;flex-wrap:wrap;gap:6px}
146
+ ${n}__question{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:6px 10px;text-align:start;cursor:pointer}
147
+ ${n}__question:hover{border-color:${t.accent}}
148
+ ${n}__source{color:${t.muted};font-size:11px}
149
+ ${n}__feedback{display:grid;gap:8px;border-top:1px solid ${t.border};padding-top:10px}
150
+ ${n}__feedback-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
151
+ ${n}__feedback-label{color:${t.muted};font-size:12px;font-weight:600}
152
+ ${n}__vote{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:${t.muted};font:inherit;cursor:pointer}
153
+ ${n}__vote:hover{background:color-mix(in srgb,${t.accent} 10%,transparent);color:${t.accent}}
154
+ ${n}__vote svg{width:15px;height:15px}
155
+ ${n}__vote[aria-pressed="true"]{color:${t.accent};background:color-mix(in srgb,${t.accent} 12%,transparent)}
156
+ ${n}__reasons{display:flex;flex-wrap:wrap;gap:6px;border:0;margin:0;padding:0}
157
+ ${n}__reasons legend{margin-bottom:6px;color:${t.muted};font-size:12px;padding:0}
158
+ ${n}__reason{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:4px 10px;cursor:pointer}
159
+ ${n}__reason[aria-pressed="true"]{border-color:${t.accent};background:color-mix(in srgb,${t.accent} 12%,${t.surface})}
160
+ ${n}__comment{width:100%;box-sizing:border-box;min-height:56px;resize:vertical;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:8px}
161
+ ${n}__feedback-note{color:${t.muted};font-size:12px}
162
+ ${n}__feedback-error{color:${t.danger};font-size:12px}
163
+ `};class Al{constructor(t,n,a,i={}){B(this,"explanationId");B(this,"submit");B(this,"onChange");B(this,"context");B(this,"state",{phase:"idle",reasons:[],comment:""});this.explanationId=t,this.submit=n,this.onChange=a,this.context=i}set(t){this.state={...this.state,...t},this.onChange(this.state)}async save(t,n){const a=this.state;this.set({phase:"saving",error:void 0});try{await this.submit(Tl({explanationId:this.explanationId,...this.context,...t})),this.set({...n,error:void 0})}catch{this.set({phase:a.phase==="details"?"details":"error",rating:a.rating,error:vt.feedbackError})}}vote(t){return this.state.phase==="saving"?Promise.resolve():this.save({rating:t},t==="up"?{phase:"done",rating:t,reasons:[],comment:""}:{phase:"details",rating:t})}toggleReason(t){const n=this.state.reasons.includes(t)?this.state.reasons.filter(a=>a!==t):[...this.state.reasons,t];this.set({reasons:n})}setComment(t){this.set({comment:Array.from(t).slice(0,pr).join("")})}send(){return this.state.phase==="saving"?Promise.resolve():this.save({rating:"down",reasons:this.state.reasons,comment:this.state.comment},{phase:"done",rating:"down"})}undo(){return this.state.phase==="saving"?Promise.resolve():this.save({rating:"clear"},{phase:"idle",rating:void 0,reasons:[],comment:""})}}const Ji={delaysMs:[1e3,2e3,4e3],capMs:45e3},fr=e=>e==="pending"||e==="ready"||e==="failed"?e:"not_requested",Ml=e=>fr(e?.aiExplanation?.status);class Il{constructor(t,n,a,i={}){B(this,"transport");B(this,"onChange");B(this,"state");B(this,"handle");B(this,"disposed",!1);B(this,"generation",0);B(this,"attempt",0);B(this,"startedAt",0);B(this,"delays");B(this,"capMs");B(this,"now");B(this,"schedule");B(this,"cancelTimer");B(this,"isVisible");B(this,"onSettled");B(this,"inFlight",null);B(this,"pausedAt",null);B(this,"onVisibilityChange",()=>{this.disposed||this.pausedAt===null||!this.isVisible()||(this.startedAt+=this.now()-this.pausedAt,this.pausedAt=null,this.queue())});this.transport=n,this.onChange=a,this.delays=i.delaysMs?.length?i.delaysMs:Ji.delaysMs,this.capMs=i.capMs??Ji.capMs,this.now=i.now??(()=>Date.now()),this.schedule=i.schedule??((c,u)=>setTimeout(c,u)),this.cancelTimer=i.cancel??(c=>clearTimeout(c)),this.isVisible=i.isVisible??(()=>typeof document>"u"||document.visibilityState!=="hidden"),this.onSettled=i.onSettled;const o=Ml(t),s=o==="pending"&&!n?"not_requested":o;this.state={status:s,explanation:t,retryAvailable:s==="failed"&&this.canRetry(t.aiExplanation?.retryAvailable),retrying:!1,announcement:""}}get explanationId(){return this.state.explanation.aiExplanation?.explanationId||this.state.explanation.explanationId||""}canRetry(t){return!!this.transport?.retry&&t!==!1}set(t){if(this.disposed)return;const n=this.state.status;this.state={...this.state,...t},this.onChange(this.state);const a=this.state.status;a!==n&&(a==="ready"||a==="failed"||a==="not_requested")&&this.onSettled?.(a)}start(){this.state.status!=="pending"||!this.explanationId||(this.disposed=!1,this.startedAt=this.now(),this.attempt=0,typeof document<"u"&&document.addEventListener("visibilitychange",this.onVisibilityChange),this.queue())}queue(){if(this.disposed)return;if(!this.isVisible()){this.pausedAt??(this.pausedAt=this.now());return}const t=this.now()-this.startedAt;if(t>=this.capMs){this.fail(!0);return}const n=this.delays[Math.min(this.attempt,this.delays.length-1)]??4e3;this.attempt+=1;const a=this.generation;this.handle=this.schedule(()=>{this.pollOnce(a)},Math.min(n,Math.max(0,this.capMs-t)))}async pollOnce(t){if(this.disposed||t!==this.generation||!this.transport)return;if(!this.isVisible()){this.pausedAt??(this.pausedAt=this.now());return}const n=new AbortController;this.inFlight=n;try{const a=await this.transport.poll(this.explanationId,n.signal);if(this.disposed||t!==this.generation)return;this.apply(a)}catch{if(this.disposed||t!==this.generation)return;this.queue()}finally{this.inFlight===n&&(this.inFlight=null)}}apply(t){const n=fr(t.status);if(this.applyBasicUpdate(t,n),n==="ready"&&t.explanation&&ur(t.explanation)){this.set({status:"ready",explanation:t.explanation,retryAvailable:!1,retrying:!1,announcement:vt.detailedReady});return}if(n==="pending"){this.state.status!=="pending"&&this.set({status:"pending",retrying:!1,announcement:""}),this.queue();return}if(n==="not_requested"){this.set({status:"not_requested",retryAvailable:!1,retrying:!1,announcement:""});return}this.fail(this.canRetry(t.retryAvailable))}applyBasicUpdate(t,n){const a=t.basic;if(!a||n==="ready"||this.state.status==="ready"||!ur(a))return;const i=this.state.explanation;a.headline===i.headline&&a.summary===i.summary||this.set({explanation:{...a,explanationId:i.explanationId??a.explanationId,aiExplanation:i.aiExplanation,level:i.level}})}fail(t){this.generation+=1,this.set({status:"failed",retryAvailable:t&&this.canRetry(!0),retrying:!1,announcement:vt.detailedUnavailable})}async retry(){if(!this.transport?.retry||this.state.retrying||this.state.status==="ready")return;const t=this.explanationId;if(!t)return;this.generation+=1;const n=this.generation;this.set({retrying:!0,announcement:""});try{const a=await this.transport.retry(t);if(this.disposed||n!==this.generation)return;if(fr(a.status)==="pending"){this.set({status:"pending",retrying:!1,retryAvailable:!1,announcement:vt.preparingDetailed}),this.startedAt=this.now(),this.attempt=0,this.queue();return}this.apply(a)}catch{if(this.disposed||n!==this.generation)return;this.set({status:"failed",retrying:!1,retryAvailable:!1,announcement:vt.detailedUnavailable})}}dispose(){this.disposed=!0,this.generation+=1,this.inFlight?.abort(),this.inFlight=null,this.handle!==void 0&&this.cancelTimer(this.handle),typeof document<"u"&&document.removeEventListener("visibilitychange",this.onVisibilityChange)}}const Xi=Ha(vt),Nn=()=>Ga(Xi),El=(e,t)=>{const n=R(t);n.current=t;const a=R(()=>{}),i=e.aiExplanation?.explanationId??e.explanationId??"",o=e.aiExplanation?.status==="pending"?"pending":"settled",s=qe(()=>{const d=n.current,p=d?{poll:(g,f)=>n.current.poll(g,f),...d.retry?{retry:(g,f)=>n.current.retry(g,f)}:{}}:void 0;return new Il(e,p,g=>a.current(g),{onSettled:g=>n.current?.settled?.(i,g)})},[i,o,!!t]),[c,u]=S(s.state);return J(()=>(a.current=u,u(s.state),s.start(),()=>s.dispose()),[s]),[c.status==="ready"?c:{...c,explanation:e},s]},zl=({prefix:e,state:t,onRetry:n})=>{const a=Nn();return r("div",{class:`${e}-xp__ai`,"data-ai-status":t.status,children:[t.status==="pending"?r("p",{class:`${e}-xp__ai-note`,children:a.preparingDetailed}):null,t.status==="failed"?r("p",{class:`${e}-xp__ai-note`,children:[a.detailedUnavailable,t.retryAvailable?r("button",{type:"button",class:`${e}-xp__ai-retry`,disabled:t.retrying,onClick:n,children:a.detailedRetry}):null]}):null,r("span",{class:`${e}-xp__sr`,role:"status","aria-live":"polite",children:t.announcement})]})},Nl=({citations:e,step:t,prefix:n,active:a,onToggle:i,evidenceById:o})=>{const s=Nn();return e.length===0?null:r(ce,{children:e.map(c=>{const u=a?.id===c.id&&a.step===t;return r("button",{type:"button",class:`${n}-xp__cite`,"data-evidence-id":c.id,"aria-expanded":u,"aria-label":`${s.citationLabel} ${c.index}: ${o[c.id]?.text??""}`.trim(),onClick:l=>i(c.id,t,l.currentTarget),children:Sl(c).slice(1,-1)},c.id)})})},Rl=(e,t)=>e.sourceTargets.find(n=>t?t(n):!0),Ll=({evidence:e,prefix:t,onClose:n,onOpenSource:a,canOpenSource:i})=>{const o=Nn(),s=R(null);J(()=>{s.current?.focus()},[e.id]);const c=a?Rl(e,i):void 0;return r("div",{ref:s,class:`${t}-xp__evidence-panel`,role:"region",tabIndex:-1,"aria-label":`${o.evidence} ${e.index}`,"data-testid":"analytics-explanation-evidence",onKeyDown:u=>{u.key==="Escape"&&(u.stopPropagation(),n())},children:[r("div",{class:`${t}-xp__evidence-head`,children:[r("p",{class:`${t}-xp__evidence-text`,children:["[",e.index,"] ",e.text]}),r("button",{type:"button",class:`${t}-xp__close`,"aria-label":o.closeEvidence,onClick:n,children:"×"})]}),r("dl",{class:`${t}-xp__evidence-rows`,children:$l(e,o).map(u=>r("div",{style:{display:"contents"},"data-row":u.key,children:[r("dt",{children:u.label}),r("dd",{children:u.value})]},u.key))}),c&&a?r("div",{class:`${t}-xp__evidence-actions`,children:r("button",{type:"button",class:`${t}-xp__button`,onClick:()=>a(c,e),children:o.openSource})}):null]})},Qi=({down:e})=>r("svg",{viewBox:"0 0 24 24",width:"15",height:"15",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",style:e?{transform:"scaleY(-1)"}:void 0,children:r("path",{d:"M7 10v11H3V10h4Zm0 0 4-7a2 2 0 0 1 2 2v4h6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.8 21H7"})}),Dl=(e,t,n)=>t==="wrong_numbers"?e.reasonWrongNumbers:t==="missing_comparison"?e.reasonMissingComparison:t==="unclear"?e.reasonUnclear:t==="too_long"?e.reasonTooLong:n,Pl=({prefix:e,explanationId:t,submit:n,context:a})=>{const i=Nn(),[o,s]=S({phase:"idle",reasons:[],comment:""}),c=qe(()=>new Al(t,n,s,a),[t]),u=o.phase==="saving";return r("div",{class:`${e}-xp__feedback`,"data-testid":"analytics-explanation-feedback",children:[o.phase==="done"?r("div",{class:`${e}-xp__feedback-row`,role:"status",children:[r("span",{class:`${e}-xp__feedback-note`,children:i.feedbackThanks}),r("button",{type:"button",class:`${e}-xp__button`,onClick:()=>{c.undo()},children:i.feedbackUndo})]}):r("div",{class:`${e}-xp__feedback-row`,children:[r("span",{class:`${e}-xp__feedback-label`,children:i.feedbackPrompt}),r("button",{type:"button",class:`${e}-xp__vote`,"aria-label":i.feedbackHelpful,"aria-pressed":o.rating==="up",disabled:u,onClick:()=>{c.vote("up")},children:r(Qi,{down:!1})}),r("button",{type:"button",class:`${e}-xp__vote`,"aria-label":i.feedbackNotHelpful,"aria-pressed":o.rating==="down",disabled:u,onClick:()=>{c.vote("down")},children:r(Qi,{down:!0})})]}),o.phase==="details"||u&&o.rating==="down"?r("form",{class:`${e}-xp__feedback-form`,onSubmit:l=>{l.preventDefault(),c.send()},children:[r("fieldset",{class:`${e}-xp__reasons`,children:[r("legend",{children:i.feedbackReasonsPrompt}),Vi.map(l=>r("button",{type:"button",class:`${e}-xp__reason`,"aria-pressed":o.reasons.includes(l.id),onClick:()=>c.toggleReason(l.id),children:Dl(i,l.id,l.label)},l.id))]}),r("textarea",{class:`${e}-xp__comment`,"aria-label":i.feedbackCommentPlaceholder,placeholder:i.feedbackCommentPlaceholder,maxLength:pr,value:o.comment,onInput:l=>c.setComment(l.currentTarget.value)}),r("div",{class:`${e}-xp__feedback-row`,children:r("button",{type:"submit",class:`${e}-xp__button is-primary`,disabled:u,children:i.feedbackSubmit})})]}):null,o.error?r("p",{class:`${e}-xp__feedback-error`,role:"alert",children:o.error}):null]})},eo=({aiTransport:e,...t})=>{const[n,a]=El(t.explanation,e),i=Ol(t.explanation),o=qe(()=>({...vt,...t.copy}),[t.copy]);return r(Xi.Provider,{value:o,children:r(Fl,{...t,explanation:n.explanation,aiStatus:i?r(zl,{prefix:t.classPrefix,state:n,onRetry:()=>{a.retry()}}):null})})},Ol=e=>!!(e.aiExplanation&&e.aiExplanation.status!=="not_requested"),Fl=({explanation:e,aiStatus:t,classPrefix:n,showLead:a=!0,investigateOpen:i=!1,onFollowUp:o,onOpenSource:s,canOpenSource:c,onFeedback:u,feedbackContext:l,onExpand:d,onCollapse:p,expanded:g=!1,...f})=>{const y=Nn(),h=R(null),I=R(null),x=R(!1),m=()=>{const C=h.current,Z=C?.getRootNode(),_=Z&&"activeElement"in Z?Z.activeElement:null;return!!(C&&_&&C.contains(_))},T=qe(()=>(x.current=m(),wl(e,{...f,copy:y})),[e,f.locale,f.cleanText,y]),[F,M]=S(),Q=R(null);$n(()=>{!F||T.evidenceById[F.id]&&h.current?.querySelector('[data-testid="analytics-explanation-evidence"]')||(M(void 0),x.current&&!m()&&(I.current??h.current)?.focus())},[T]);const Y=(C,Z,_)=>{Q.current=_,M(L=>L?.id===C&&L.step===Z?void 0:{id:C,step:Z})},X=()=>{M(void 0);const C=Q.current;C?.isConnected?C.focus():(I.current??h.current)?.focus()},j=(C,Z)=>r(Nl,{citations:C,step:Z,prefix:n,active:F,onToggle:Y,evidenceById:T.evidenceById}),U=C=>{if(!F||F.step!==C)return null;const Z=T.evidenceById[F.id];return Z?r(Ll,{evidence:Z,prefix:n,onClose:X,onOpenSource:s,canOpenSource:c}):null},D=(C,Z)=>r(ce,{children:[C.text,j(C.citations,Z)]}),{investigate:q}=T;return r("section",{ref:h,class:`${n}-xp${g?" is-expanded":""}${d||p?" has-expand":""}`,"data-testid":"analytics-explanation","aria-label":y.region,tabIndex:-1,children:[g&&p?r("button",{type:"button",class:`${n}-xp__expand`,"aria-label":y.collapse,title:y.collapse,onClick:p,children:"×"}):d?r("button",{type:"button",class:`${n}-xp__expand`,"aria-label":y.expand,title:y.expand,"data-testid":"analytics-explanation-expand",onClick:d,children:"⤢"}):null,a?r("div",{class:`${n}-xp__lead`,"data-step":"lead",children:[T.lead.preface?r("p",{class:`${n}-xp__preface`,children:T.lead.preface}):null,r("div",{class:`${n}-xp__meta`,children:[r("span",{class:`${n}-xp__eyebrow`,children:T.lead.eyebrow}),r("span",{class:`${n}-xp__provenance`,children:T.lead.provenance})]}),r("h3",{class:`${n}-xp__headline`,ref:I,tabIndex:-1,children:D(T.lead.headline,"lead")}),T.lead.summary?r("p",{class:`${n}-xp__summary`,children:D(T.lead.summary,"lead")}):null,U("lead")]}):null,t,T.comparison.length>0?r("section",{class:`${n}-xp__step`,"data-step":"comparison",children:[r("h4",{class:`${n}-xp__title`,children:y.comparison}),r("ul",{class:`${n}-xp__periods`,children:T.comparison.map(C=>r("li",{class:`${n}-xp__period`,"data-status":C.status??"observed",children:[r("span",{class:`${n}-xp__period-label`,children:C.label}),C.valueText?r("span",{class:`${n}-xp__period-value`,children:C.valueText}):null,C.statusLabel?r("span",{class:`${n}-xp__chip is-${C.statusTone}`,children:C.statusLabel}):null,C.inProgress?r("span",{class:`${n}-xp__chip is-progress`,children:y.inProgress}):null,C.citation?j([C.citation],"comparison"):null,C.reason?r("small",{class:`${n}-xp__period-reason`,children:C.reason}):null]},C.key))}),U("comparison")]}):null,T.conclusions.length>0||T.businessMeaning?r("section",{class:`${n}-xp__step`,"data-step":"conclusions",children:[r("h4",{class:`${n}-xp__title`,children:y.conclusions}),T.conclusions.length>0?r("ul",{class:`${n}-xp__list`,children:T.conclusions.map(C=>r("li",{children:D(C,"conclusions")},C.text))}):null,T.businessMeaning?r("p",{class:`${n}-xp__meaning`,children:[r("strong",{children:[y.whyItMatters,": "]}),D(T.businessMeaning,"conclusions")]}):null,U("conclusions")]}):null,T.limits.length>0?r("section",{class:`${n}-xp__step`,"data-step":"limits",children:[r("h4",{class:`${n}-xp__title`,children:y.limits}),r("ul",{class:`${n}-xp__list ${n}-xp__limits`,children:T.limits.map(C=>r("li",{"data-kind":C.kind,children:[C.text,C.citation?j([C.citation],"limits"):null]},C.text))}),U("limits")]}):null,T.checkedLine?r("p",{class:`${n}-xp__checked`,"data-step":"checked",children:T.checkedLine}):null,T.hasInvestigate?r("details",{class:`${n}-xp__investigate`,"data-step":"investigate",open:i,children:[r("summary",{children:y.investigate}),r("div",{class:`${n}-xp__investigate-body`,children:[q.causes.length>0?r("div",{class:`${n}-xp__group`,children:[r("div",{class:`${n}-xp__group-head`,children:[r("h4",{class:`${n}-xp__title`,children:y.causes}),r("span",{class:`${n}-xp__hint`,children:y.causesHint})]}),q.causes.map(C=>r("article",{class:`${n}-xp__card`,children:[r("p",{class:`${n}-xp__card-title`,children:[C.title,j(C.citations,"investigate")]}),C.howToCheck?r("p",{class:`${n}-xp__card-body`,children:[y.howToCheck," ",C.howToCheck]}):null]},C.title))]}):null,q.recommendations.length>0?r("div",{class:`${n}-xp__group`,children:[r("h4",{class:`${n}-xp__title`,children:y.recommendations}),q.recommendations.map(C=>r("article",{class:`${n}-xp__card`,children:[r("p",{class:`${n}-xp__card-title`,children:[C.title,j(C.citations,"investigate")]}),C.why?r("p",{class:`${n}-xp__card-body`,children:C.why}):null,C.watch?r("p",{class:`${n}-xp__card-body`,children:[y.watch," ",C.watch]}):null]},C.title))]}):null,q.outlook?r("div",{class:`${n}-xp__group`,children:[r("div",{class:`${n}-xp__group-head`,children:[r("h4",{class:`${n}-xp__title`,children:y.outlook}),r("span",{class:`${n}-xp__hint`,children:q.outlook.badge})]}),r("p",{class:`${n}-xp__card-body`,children:q.outlook.text}),q.outlook.note?r("p",{class:`${n}-xp__card-body`,children:q.outlook.note}):null]}):null,o&&q.followUps.length>0?r("div",{class:`${n}-xp__group`,children:[r("h4",{class:`${n}-xp__title`,children:y.followUps}),r("div",{class:`${n}-xp__questions`,children:q.followUps.map(C=>r("button",{type:"button",class:`${n}-xp__question`,onClick:()=>o(C),children:C},C))})]}):null,T.evidence.length>0?r("div",{class:`${n}-xp__group`,children:[r("h4",{class:`${n}-xp__title`,children:y.evidenceList}),r("ul",{class:`${n}-xp__list`,children:T.evidence.map(C=>r("li",{children:[C.text,j([{id:C.id,index:C.index}],"investigate")]},C.id))})]}):null,U("investigate")]})]}):null,r("p",{class:`${n}-xp__source`,children:T.sourceNote}),u&&T.explanationId?r(Pl,{prefix:n,explanationId:T.explanationId,submit:u,context:l}):null]})},Ul=[{name:"Smileys",emojis:["😀","😃","😄","😁","😅","😂","🤣","😊","😇","🙂","🙃","😉","😌","😍","🥰","😘","😋","😛","😜","🤪","🤗","🤭","🤔","🤐","😐","😶","😏","🙄","😴","🥳","😎","🤓","🥺","😢","😭","😤","😠","🤯","😬","😱","🤩","🥱"]},{name:"Gestures",emojis:["👍","👎","👌","🤌","✌️","🤞","🤟","🤘","🤙","👈","👉","👆","👇","✋","🖐️","👋","🤝","🙏","💪","👏","🙌","👐","🤲","🫶"]},{name:"Hearts & symbols",emojis:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","💔","❣️","💕","💖","💘","💝","✨","⭐","🌟","💫","🔥","🎉","🎊","✅","❌","⚡","💯","🚀"]},{name:"Animals & nature",emojis:["🐶","🐱","🦊","🐻","🐼","🐨","🦁","🐮","🐸","🐵","🐧","🦄","🐝","🦋","🐢","🐬","🌷","🌸","🌹","🌻","🌳","🍀"]},{name:"Food & drink",emojis:["🍎","🍌","🍉","🍓","🍒","🥑","🍔","🍟","🍕","🌮","🍿","🍩","🍪","🎂","☕","🍵","🍺","🥂","🍷"]},{name:"Objects & travel",emojis:["🚀","✈️","🚗","🏠","📦","📱","💻","⌚","📷","💡","🔑","🎁","📌","✏️","📝","📞","📧","💰","📈","⏰","🔔","🎯","🏆","🎮","🎵","💬","👀"]}],ga={"contact-support":{title:"Contact support",submit:"Request support",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"subject",label:"Subject",kind:"text",required:!0},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"Describe what you need help with."}]},inquiry:{title:"Leave a message",submit:"Send message",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"How can we help?"}]},contact:{title:"Share your details",submit:"Save",fields:[{key:"name",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"email",label:"Email",kind:"email",required:!0,identity:"email"},{key:"phone",label:"Phone",kind:"tel",required:!0,identity:"phone"}]},"book-demo":{title:"Book a demo",submit:"Request demo",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"preferredAt",label:"Preferred time",kind:"text",placeholder:"e.g. Thursday 3pm"},{key:"notes",label:"Notes",kind:"textarea",placeholder:"Anything we should know?"}]},"request-callback":{title:"Request a callback",submit:"Request callback",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorPhone",label:"Phone number",kind:"tel",required:!0,identity:"phone"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"schedule-callback":{title:"Schedule a callback",submit:"Schedule callback",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorPhone",label:"Phone number",kind:"tel",required:!0,identity:"phone"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"subscribe-newsletter":{title:"Subscribe",submit:"Subscribe",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"}]}},hr={openChat:"Open chat",closeChat:"Close chat",closeHistory:"Close conversation history",unreadMessage:"1 unread message",unreadMessages:"{count} unread messages",muteSounds:"Mute sounds",unmuteSounds:"Unmute sounds",statusOnline:"Online · replies instantly",statusOffline:"Away · leave a message",liveSupport:"Live support",reconnectSupport:"Reconnect to support",reconnectPrompt:"I can bring a teammate back into this chat.",waitingForTeam:"AI helping · team notified",assistantName:"Assistant",chatName:"Chat",welcomeLabel:"{name} welcome",welcomeEyebrow:"Ready when you are",welcomePrompt:"Ask a question, leave a message, or book a demo.",agentTyping:"{name} is typing…",expandedAnalyticsResult:"Expanded analytics result",privacyAndData:"Privacy and local data",muteMicrophone:"Mute microphone",unmuteMicrophone:"Unmute microphone",chooseMicrophone:"Choose microphone",defaultMicrophone:"Default microphone",microphone:"Microphone",talkNow:"Talk now",expandView:"Expand view",exitExpandedView:"Exit expanded view",minimizeVoiceChat:"Minimize voice chat",endVoiceChat:"End voice chat",restoreVoiceChat:"Restore voice chat",reopenVoiceChat:"Reopen voice chat with {name}",voiceConnecting:"Connecting…",voiceListening:"Listening…",voiceHearing:"Hearing you…",voiceUnavailable:"Can’t hear you — check your microphone.",voiceProcessing:"Transcribing…",voiceSpeaking:"Speaking…",voiceNoise:"No clear speech heard. Move closer to the mic and try again.",voiceMisunderstood:"Could not transcribe that. Please try again or type your message.",voiceDenied:"Microphone unavailable. Allow access or type your message.",composerPlaceholder:"Type your message…",send:"Send message",emoji:"Emoji",gifs:"GIFs",attachFile:"Attach a file",recordVoice:"Record a voice message",stopRecording:"Stop recording",actionTestMode:"Test mode",stop:"Stop",copy:"Copy",copied:"Copied",retry:"Retry",clearChat:"Clear conversation",clearChatConfirm:"Clear this conversation?",clearChatConfirmBody:"This clears the messages on this device and starts a fresh chat.",clearConfirmCta:"Clear chat",endChat:"End conversation",endChatConfirm:"End this conversation?",endChatConfirmBody:"You won't be able to send more messages in this chat, but you can start a new one anytime.",endConfirmCta:"End conversation",conversationEnded:"This conversation has ended.",startNewChat:"Start a new conversation",pastConversations:"Past conversations",viewingPast:"Viewing a past conversation (read-only)",backToChat:"Back to current chat",historyEnded:"ended",feedbackHelpful:"Helpful",feedbackNotHelpful:"Not helpful",feedbackAnswerPrompt:"Was this answer helpful?",feedbackThanks:"Thanks for the feedback",csatPrompt:"How was this chat?",feedbackCommentPlaceholder:"What went wrong? (optional)",feedbackSend:"Send",cancel:"Cancel",newMessages:"New messages",poweredBy:"Powered by",searchGifs:"Search GIFs…",searchingGifs:"Searching…",noGifs:"No GIFs found",assistantTyping:"Assistant is typing",emptyReply:"Sorry, I couldn't generate a reply.",errorGeneric:"Something went wrong reaching the assistant. Please try again.",errorRateLimit:"You’re sending messages a little fast — give it a second and try again.",resultExpired:"This result is not stored on this device. Ask again to see it.",attaching:"Reading file…",attachTooLarge:"That file is too large (max 5 MB).",attachFailed:"Could not attach that file. Check its type and try again.",attachPreviewTitle:"Preview of {name}",attachOpen:"Preview {name}",attachDownload:"Download",attachPreviewClose:"Close preview",attachPreviewLoading:"Loading file…",attachPreviewFailed:"This file can’t be shown right now. It may have expired.",attachPreviewUnsupported:"This file can’t be previewed here. Download it to open it.",attachAnalysisFailed:"Saved for the team; AI could not read it.",removeAttachment:"Remove attachment",attachLimit:"You can attach up to {count} files to one message.",attachedFiles:"Attached files",removeAttachmentNamed:"Remove {name}",dropFileHere:"Drop the file here",clearDeviceData:"Clear conversations from this device",clearDeviceDataBody:"This removes locally stored conversations and visitor details from this browser. It cannot be undone.",clearDeviceDataCta:"Clear this device",handoffTitle:"Want our team to follow up?",handoffName:"Name (optional)",handoffEmail:"Your email",handoffNotify:"Notify the team",sending:"Sending…",handoffShared:"I’ve shared this with our team — they’ll get back to you at {email}.",formThanks:"Thanks! We’ll be in touch.",caseReference:"Reference: {reference}",formError:"Something went wrong — please try again.",actionContactOptions:"Contact options",actionGetInTouch:"Get in touch",actionMore:"+{count} more",actionNeedHelp:"Need help?",actionChoose:"Choose what you want to do",actionFooter:"We’ll ask for your full name and the best email or phone so the team can reach you.",actionCategorySupport:"Support",actionCategorySales:"Talk to sales",actionCategoryMarketing:"Stay in touch",actionClose:"Close",actionAs:"as {identity}",bookingPickTime:"What time works best?",bookingPickDay:"Pick a day",bookingPickTimeLabel:"Pick a time",bookingDuration:"{count}-minute demo",bookingCallbackDuration:"{count}-minute callback",bookingTimezone:"Times shown in {timezone}",bookingSchedulerFallback:"the scheduler",bookingCheckingAvailability:"Checking calendar availability…",bookingNoSlots:"No available times were found in this booking window.",bookingAvailabilityUnavailable:"Calendar availability is temporarily unavailable. Please try again shortly.",bookingEarlierToday:"Earlier today",bookingCalendarBusy:"Busy on the calendar",bookingAlreadyBooked:"Already booked",bookingNotOffered:"Not offered by the calendar",bookingRequested:"Requested for {when} — we’ll confirm by email.",bookingVerificationPending:"We received your request for {when}, but could not verify the calendar booking. Check your email; the team will follow up. Please do not book this time again.",bookingCallbackRequested:"Callback requested for {when}.",bookingCallbackConfirmed:"Your callback is scheduled for {when}.",bookingConfirmed:"You’re booked for {when}! A calendar invite is on its way. 📅",bookingSlotTaken:"That time was just taken — please pick another.",bookingViaProvider:"Pick a time that works for you on {provider}.",bookingOpenScheduler:"Open the scheduler",bookingLinkOpened:"Opening the scheduler — pick a time that suits you. 📅",bookingScheduled:"Your demo is booked. A calendar invitation has been sent to your email.",bookingBackToChat:"Back to chat",bookingOpenNewTab:"Open in new tab",bookingCloseScheduler:"Close scheduler",bookingLoadingScheduler:"Loading scheduler…",bookingMeetingLink:"Meeting link",bookingManageLink:"Manage booking",bookingCheckingDetails:"Getting your meeting link…",bookingDetailsUnavailable:"Your booking is in Calendly, but we could not load the meeting link. Check your calendar invitation or try again.",bookingRetryDetails:"Retry",previewReply:"👋 This is a preview — replies here are samples. Publish the widget on your site to chat with the live AI.",previewActionNote:"Preview — nothing was actually sent. This works for real once you publish.",previewBanner:"Preview — sample replies, no AI"},Ve=(e,t)=>e.replace(/\{(\w+)\}/g,(n,a)=>t[a]??""),Rn=(e,t,n)=>!t||e.includes(t)?e:`${e} ${Ve(n.caseReference,{reference:t})}`,Bl=e=>e?{...hr,...e}:hr,to=Ha(hr),ql=to.Provider,no=Ha(void 0),Vl=no.Provider,mr=()=>Ga(no),jl=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb"]),Hl=(e,t)=>{if(t==="ltr"||t==="rtl")return t;const n=(e??"").trim().toLowerCase().split(/[-_]/)[0]??"";return jl.has(n)?"rtl":"ltr"},ot=()=>Ga(to),en=[["AF","Afghanistan","93"],["AL","Albania","355"],["DZ","Algeria","213"],["AS","American Samoa","1684"],["AD","Andorra","376"],["AO","Angola","244"],["AI","Anguilla","1264"],["AG","Antigua and Barbuda","1268"],["AR","Argentina","54"],["AM","Armenia","374"],["AW","Aruba","297"],["AU","Australia","61"],["AT","Austria","43"],["AZ","Azerbaijan","994"],["BS","Bahamas","1242"],["BH","Bahrain","973"],["BD","Bangladesh","880"],["BB","Barbados","1246"],["BY","Belarus","375"],["BE","Belgium","32"],["BZ","Belize","501"],["BJ","Benin","229"],["BM","Bermuda","1441"],["BT","Bhutan","975"],["BO","Bolivia","591"],["BA","Bosnia and Herzegovina","387"],["BW","Botswana","267"],["BR","Brazil","55"],["BN","Brunei","673"],["BG","Bulgaria","359"],["BF","Burkina Faso","226"],["BI","Burundi","257"],["CV","Cabo Verde","238"],["KH","Cambodia","855"],["CM","Cameroon","237"],["CA","Canada","1"],["KY","Cayman Islands","1345"],["CF","Central African Republic","236"],["TD","Chad","235"],["CL","Chile","56"],["CN","China","86"],["CO","Colombia","57"],["KM","Comoros","269"],["CG","Congo","242"],["CD","Congo, Democratic Republic","243"],["CK","Cook Islands","682"],["CR","Costa Rica","506"],["CI","Cote d'Ivoire","225"],["HR","Croatia","385"],["CU","Cuba","53"],["CW","Curacao","599"],["CY","Cyprus","357"],["CZ","Czechia","420"],["DK","Denmark","45"],["DJ","Djibouti","253"],["DM","Dominica","1767"],["DO","Dominican Republic","1809"],["EC","Ecuador","593"],["EG","Egypt","20"],["SV","El Salvador","503"],["GQ","Equatorial Guinea","240"],["ER","Eritrea","291"],["EE","Estonia","372"],["SZ","Eswatini","268"],["ET","Ethiopia","251"],["FO","Faroe Islands","298"],["FJ","Fiji","679"],["FI","Finland","358"],["FR","France","33"],["GF","French Guiana","594"],["PF","French Polynesia","689"],["GA","Gabon","241"],["GM","Gambia","220"],["GE","Georgia","995"],["DE","Germany","49"],["GH","Ghana","233"],["GI","Gibraltar","350"],["GR","Greece","30"],["GL","Greenland","299"],["GD","Grenada","1473"],["GP","Guadeloupe","590"],["GU","Guam","1671"],["GT","Guatemala","502"],["GG","Guernsey","44"],["GN","Guinea","224"],["GW","Guinea-Bissau","245"],["GY","Guyana","592"],["HT","Haiti","509"],["HN","Honduras","504"],["HK","Hong Kong","852"],["HU","Hungary","36"],["IS","Iceland","354"],["IN","India","91"],["ID","Indonesia","62"],["IR","Iran","98"],["IQ","Iraq","964"],["IE","Ireland","353"],["IM","Isle of Man","44"],["IL","Israel","972"],["IT","Italy","39"],["JM","Jamaica","1876"],["JP","Japan","81"],["JE","Jersey","44"],["JO","Jordan","962"],["KZ","Kazakhstan","7"],["KE","Kenya","254"],["KI","Kiribati","686"],["XK","Kosovo","383"],["KW","Kuwait","965"],["KG","Kyrgyzstan","996"],["LA","Laos","856"],["LV","Latvia","371"],["LB","Lebanon","961"],["LS","Lesotho","266"],["LR","Liberia","231"],["LY","Libya","218"],["LI","Liechtenstein","423"],["LT","Lithuania","370"],["LU","Luxembourg","352"],["MO","Macao","853"],["MG","Madagascar","261"],["MW","Malawi","265"],["MY","Malaysia","60"],["MV","Maldives","960"],["ML","Mali","223"],["MT","Malta","356"],["MH","Marshall Islands","692"],["MQ","Martinique","596"],["MR","Mauritania","222"],["MU","Mauritius","230"],["MX","Mexico","52"],["FM","Micronesia","691"],["MD","Moldova","373"],["MC","Monaco","377"],["MN","Mongolia","976"],["ME","Montenegro","382"],["MS","Montserrat","1664"],["MA","Morocco","212"],["MZ","Mozambique","258"],["MM","Myanmar","95"],["NA","Namibia","264"],["NR","Nauru","674"],["NP","Nepal","977"],["NL","Netherlands","31"],["NC","New Caledonia","687"],["NZ","New Zealand","64"],["NI","Nicaragua","505"],["NE","Niger","227"],["NG","Nigeria","234"],["NU","Niue","683"],["KP","North Korea","850"],["MK","North Macedonia","389"],["MP","Northern Mariana Islands","1670"],["NO","Norway","47"],["OM","Oman","968"],["PK","Pakistan","92"],["PW","Palau","680"],["PS","Palestine","970"],["PA","Panama","507"],["PG","Papua New Guinea","675"],["PY","Paraguay","595"],["PE","Peru","51"],["PH","Philippines","63"],["PL","Poland","48"],["PT","Portugal","351"],["PR","Puerto Rico","1787"],["QA","Qatar","974"],["RE","Reunion","262"],["RO","Romania","40"],["RU","Russia","7"],["RW","Rwanda","250"],["KN","Saint Kitts and Nevis","1869"],["LC","Saint Lucia","1758"],["VC","Saint Vincent and the Grenadines","1784"],["WS","Samoa","685"],["SM","San Marino","378"],["ST","Sao Tome and Principe","239"],["SA","Saudi Arabia","966"],["SN","Senegal","221"],["RS","Serbia","381"],["SC","Seychelles","248"],["SL","Sierra Leone","232"],["SG","Singapore","65"],["SK","Slovakia","421"],["SI","Slovenia","386"],["SB","Solomon Islands","677"],["SO","Somalia","252"],["ZA","South Africa","27"],["KR","South Korea","82"],["SS","South Sudan","211"],["ES","Spain","34"],["LK","Sri Lanka","94"],["SD","Sudan","249"],["SR","Suriname","597"],["SE","Sweden","46"],["CH","Switzerland","41"],["SY","Syria","963"],["TW","Taiwan","886"],["TJ","Tajikistan","992"],["TZ","Tanzania","255"],["TH","Thailand","66"],["TL","Timor-Leste","670"],["TG","Togo","228"],["TO","Tonga","676"],["TT","Trinidad and Tobago","1868"],["TN","Tunisia","216"],["TR","Turkey","90"],["TM","Turkmenistan","993"],["TC","Turks and Caicos Islands","1649"],["TV","Tuvalu","688"],["UG","Uganda","256"],["UA","Ukraine","380"],["AE","United Arab Emirates","971"],["GB","United Kingdom","44"],["US","United States","1"],["UY","Uruguay","598"],["UZ","Uzbekistan","998"],["VU","Vanuatu","678"],["VA","Vatican City","39"],["VE","Venezuela","58"],["VN","Vietnam","84"],["VG","Virgin Islands, British","1284"],["VI","Virgin Islands, U.S.","1340"],["YE","Yemen","967"],["ZM","Zambia","260"],["ZW","Zimbabwe","263"]].map(([e,t,n])=>({iso:e,name:t,dial:n})),ao=e=>[...e.toUpperCase()].map(t=>String.fromCodePoint(127397+t.charCodeAt(0))).join(""),Wl=()=>{let e="";try{if(Intl.DateTimeFormat().resolvedOptions().timeZone==="Africa/Lagos"&&(e="NG"),!e){const t=navigator.languages?.[0]||navigator.language;e=new Intl.Locale(t).region||""}}catch{e=""}return en.find(t=>t.iso===e)??en.find(t=>t.iso==="US")},Gl=e=>{const t=Wl(),n=e?.trim()??"";if(!n.startsWith("+"))return{country:t,national:n.replace(/\D/g,"")};const a=n.replace(/\D/g,""),i=[...en].sort((o,s)=>s.dial.length-o.dial.length).find(o=>a.startsWith(o.dial))??t;return{country:i,national:a.slice(i.dial.length)}},ro=(e,t)=>{const n=t.replace(/\D/g,"").replace(/^0+/,"");return n?`+${e.dial}${n}`:""},Kl=e=>{const t=e.replace(/\D/g,"");return e.startsWith("+")&&t.length>=8&&t.length<=15},Te=(e,t)=>r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",...t,children:e}),Yl=e=>r("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:r("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5 3.25h14A3.75 3.75 0 0 1 22.75 7v6A3.75 3.75 0 0 1 19 16.75h-7.19l-4.26 3.84A.75.75 0 0 1 6.25 20v-3.32A3.75 3.75 0 0 1 2.25 13V7A3.75 3.75 0 0 1 6 3.25Zm3 7.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z"})}),pn=e=>Te(r("path",{d:"m6 9 6 6 6-6"}),e),Zl=e=>Te(r(ce,{children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),e),Ln=e=>Te(r(ce,{children:[r("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),r("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),r("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),e),Jl=e=>Te(r(ce,{children:[r("path",{d:"M9 9v1a3 3 0 0 0 4.24 2.73"}),r("path",{d:"M15 5.5V5a3 3 0 0 0-5.94-.6"}),r("path",{d:"M19 10v2a7 7 0 0 1-9.9 6.36"}),r("path",{d:"M5 10v2a6.98 6.98 0 0 0 1.11 3.79"}),r("line",{x1:"12",y1:"19",x2:"12",y2:"22"}),r("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}),e),Dn=e=>Te(r(ce,{children:[r("path",{d:"M15 3h6v6"}),r("path",{d:"M10 14 21 3"}),r("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),e),Xl=e=>Te(r(ce,{children:[r("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),r("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),r("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),r("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),e),gr=e=>Te(r(ce,{children:[r("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),r("path",{d:"m22 7-10 5L2 7"})]}),e),Ql=e=>Te(r("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z"}),e),io=e=>Te(r(ce,{children:[r("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),r("path",{d:"M18 19h-2"}),r("rect",{x:"3",y:"13",width:"4",height:"6",rx:"2"}),r("rect",{x:"17",y:"13",width:"4",height:"6",rx:"2"})]}),e),ed=e=>Te(r(ce,{children:[r("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z"}),r("path",{d:"M8 9h8M8 13h5"})]}),e),td=e=>Te(r(ce,{children:[r("path",{d:"M3 4h18M4 4v12h16V4M12 16v5M8 21h8"}),r("path",{d:"m8 12 2.5-2.5 2 2L16 8"})]}),e),nd=e=>Te(r(ce,{children:[r("path",{d:"M15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}),r("path",{d:"M3 9h12M7 2v4M12 2v4"}),r("circle",{cx:"17",cy:"17",r:"4"}),r("path",{d:"M17 15v2l1.5 1"})]}),e),ad=e=>Te(r(ce,{children:[r("path",{d:"M4 4h16v16H5a3 3 0 0 1-3-3V6"}),r("path",{d:"M8 8h8M8 12h8M8 16h5"})]}),e),rd=e=>Te(r(ce,{children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M8.5 14.5a4 4 0 0 0 7 0"}),r("line",{x1:"9",y1:"9.5",x2:"9.01",y2:"9.5"}),r("line",{x1:"15",y1:"9.5",x2:"15.01",y2:"9.5"})]}),e),Pn=e=>Te(r(ce,{children:[r("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),e),id=e=>Te(r(ce,{children:[r("path",{d:"M11 5 6 9H2v6h4l5 4z"}),r("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),r("path",{d:"M19 5a9 9 0 0 1 0 14"})]}),e),od=e=>Te(r(ce,{children:[r("path",{d:"M11 5 6 9H2v6h4l5 4z"}),r("line",{x1:"22",y1:"9",x2:"16",y2:"15"}),r("line",{x1:"16",y1:"9",x2:"22",y2:"15"})]}),e),fn=e=>Te(r("path",{d:"M20 6 9 17l-5-5"}),e),sd=e=>Te(r(ce,{children:[r("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),r("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),e),cd=e=>Te(r(ce,{children:[r("path",{d:"M1 4v6h6"}),r("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),e),ld=e=>Te(r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),e),ba=e=>Te(r("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"}),e),br=e=>Te(r(ce,{children:[r("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),r("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}),e),dd=e=>Te(r(ce,{children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 7v5l3 2"})]}),e),oo=e=>Te(r(ce,{children:[r("path",{d:"M7 10v12"}),r("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),e),so=e=>Te(r(ce,{children:[r("path",{d:"M17 14V2"}),r("path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"})]}),e),ud=e=>Te(r(ce,{children:[r("path",{d:"M15 3h6v6"}),r("path",{d:"M9 21H3v-6"}),r("path",{d:"M21 3l-7 7"}),r("path",{d:"M3 21l7-7"})]}),e),pd=e=>Te(r(ce,{children:[r("path",{d:"M9 3v6H3"}),r("path",{d:"M15 21v-6h6"}),r("path",{d:"M9 9 2 2"}),r("path",{d:"M15 15l7 7"})]}),e),fd=e=>Te(r(ce,{children:[r("rect",{x:"3",y:"4",width:"18",height:"14",rx:"2"}),r("rect",{x:"11",y:"11",width:"8",height:"6",rx:"1",fill:"currentColor",stroke:"none"})]}),e),hd=e=>Te(r(ce,{children:[r("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),r("path",{d:"M12 15V9"}),r("path",{d:"m8.5 12.5 3.5-3.5 3.5 3.5"})]}),e),md=e=>Te(r(ce,{children:[r("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r("path",{d:"m19 12-7 7-7-7"})]}),e),co=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(\[[^\]]+\]\([^\s)]+\))|(https?:\/\/[^\s)]+)/g,gd=e=>e.replace(/([^\n])\s+((?:[-*•]|\d+\.)\s+)(?=(?:\*\*[^*\n]{1,80}\*\*|[A-Z][A-Za-z0-9/& -]{1,50}:))/g,`$1
164
+ $2`),hn=e=>{const t=[];let n=0,a=0,i;for(co.lastIndex=0;(i=co.exec(e))!==null;){i.index>n&&t.push(e.slice(n,i.index));const o=i[0];if(o.startsWith("`"))t.push(r("code",{class:"cf-md-code",children:o.slice(1,-1)},a++));else if(o.startsWith("**"))t.push(r("strong",{children:o.slice(2,-2)},a++));else if(o.startsWith("[")&&!/\]\(https?:\/\//.test(o))t.push(/^\[([^\]]+)\]/.exec(o)?.[1]??o);else if(o.startsWith("[")){const s=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(o),c=s?s[1]:o,u=s?s[2]:"#";t.push(r("a",{href:u,target:"_blank",rel:"noopener noreferrer nofollow",children:c},a++))}else t.push(r("a",{href:o,target:"_blank",rel:"noopener noreferrer nofollow",children:o},a++));n=i.index+o.length}return n<e.length&&t.push(e.slice(n)),t},bd=/^(```|#{1,6}\s|\s*[-*•]\s|\s*\d+\.\s)/,vd=(e,t,n)=>{const a=`cf-md-h cf-md-h--${Math.min(e,6)}`;return e<=2?r("h3",{class:a,children:t},n):e===3?r("h4",{class:a,children:t},n):r("h5",{class:a,children:t},n)},xd=e=>{const t=gd(e.replace(/\r\n/g,`
25
165
  `)).split(`
26
- `),r=[];let n=0,a=0;for(;a<e.length;){const i=e[a];if(i.trim().startsWith("```")){const u=[];for(a++;a<e.length&&!e[a].trim().startsWith("```");)u.push(e[a]),a++;a++,r.push(_("pre",{class:"cf-md-pre",children:_("code",{children:u.join(`
27
- `)})},n++));continue}if(i.trim()===""){a++;continue}const o=/^(#{1,6})\s+(.*)$/.exec(i);if(o){r.push(P5(o[1].length,Wi(o[2]),n++)),a++;continue}if(/^\s*[-*•]\s+/.test(i)){const u=[];for(;a<e.length&&/^\s*[-*•]\s+/.test(e[a]);)u.push(_("li",{children:Wi(e[a].replace(/^\s*[-*•]\s+/,""))},u.length)),a++;r.push(_("ul",{class:"cf-md-list",children:u},n++));continue}if(/^\s*\d+\.\s+/.test(i)){const u=[];for(;a<e.length&&/^\s*\d+\.\s+/.test(e[a]);)u.push(_("li",{children:Wi(e[a].replace(/^\s*\d+\.\s+/,""))},u.length)),a++;r.push(_("ol",{class:"cf-md-list",children:u},n++));continue}const s=[i];for(a++;a<e.length&&e[a].trim()!==""&&!L5.test(e[a]);)s.push(e[a]),a++;const l=s.join(" ");if(/:\s*$/.test(l)&&a<e.length&&/^(?:\s*[-*•]\s+|\s*\d+\.\s+)/.test(e[a])){const u=/^(.*[.!?])\s+([^.!?]{2,120}:)$/.exec(l);u&&r.push(_("p",{children:Wi(u[1])},n++)),r.push(_("p",{class:"cf-md-list-intro",children:Wi(u?.[2]??l)},n++))}else r.push(_("p",{children:Wi(l)},n++))}return r},E5=t=>{const e=(t??"").trim().toLowerCase().replaceAll("-","_");return e==="low"||e==="low_quality"?"Low-confidence forecast":e==="medium"||e==="directional"?"Directional forecast":e==="high"||e==="validated"||e==="trusted"?"Validated forecast":"Forecast estimate"},O5=t=>{if(!t)return"Live data";const e=new Date(t);return Number.isNaN(e.getTime())?"Live data":`Updated ${new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e)}`},N5=({answeredAt:t,reportingPeriod:e,filters:r=[],rowCount:n})=>_("div",{class:"cf-analytics-meta","data-testid":"analytics-result-meta","aria-label":"Result details",children:[_("span",{children:[_("span",{"aria-hidden":"true",class:"cf-analytics-meta__dot"}),O5(t)]}),e?.label?_("span",{children:e.label}):null,typeof n=="number"?_("span",{children:[n," ",n===1?"row":"rows"]}):null,r.length>0?_("span",{children:[r.length," applied ",r.length===1?"filter":"filters"]}):null]}),B5=({label:t,value:e})=>_("section",{class:"cf-analytics-kpi","aria-label":t,"data-testid":"analytics-kpi",children:[_("div",{class:"cf-analytics-kpi__label",children:t}),_("div",{class:"cf-analytics-kpi__value",children:e})]}),z5=({title:t="No matching data",description:e="No approved records matched this question."})=>_("section",{class:"cf-analytics-empty",role:"status","data-testid":"analytics-empty-state",children:[_("p",{children:t}),_("p",{children:e})]}),F5=t=>t==="line"?"Best for change over time.":t==="stacked_bar"?"Compare totals and their parts.":"Compare categories or ranked values.",a1=({type:t,className:e="cf-chart-type-icon"})=>t==="line"?_("svg",{viewBox:"0 0 32 32","aria-hidden":"true",class:e,children:[_("path",{d:"M6 25h21M6 7v18",fill:"none",stroke:"#6B7280","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"}),_("path",{d:"M8 21c4-7 7 2 11-6 2.5-5 4.5-2 7-7",fill:"none",stroke:"#2563EB","stroke-width":"2.1","stroke-linecap":"round","stroke-linejoin":"round"})]}):t==="stacked_bar"?_("svg",{viewBox:"0 0 32 32","aria-hidden":"true",class:e,children:[_("path",{d:"M6 26h21M6 7v19",fill:"none",stroke:"#6B7280","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"}),[9,15,21].map((r,n)=>_("g",{children:[_("rect",{x:r,y:18-n*2,width:"4",height:8+n*2,fill:"#2563EB",rx:"0.6"}),_("rect",{x:r,y:13-n,width:"4",height:"5",fill:"#F59E0B",rx:"0.6"}),_("rect",{x:r,y:9-n,width:"4",height:"4",fill:"#22C55E",rx:"0.6"})]},r))]}):_("svg",{viewBox:"0 0 32 32","aria-hidden":"true",class:e,children:[_("path",{d:"M6 26h21M6 7v19",fill:"none",stroke:"#6B7280","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"}),_("rect",{x:"9",y:"18",width:"4",height:"8",fill:"#2563EB",rx:"0.7"}),_("rect",{x:"15",y:"13",width:"4",height:"13",fill:"#2563EB",rx:"0.7"}),_("rect",{x:"21",y:"8",width:"4",height:"18",fill:"#2563EB",rx:"0.7"})]}),H5=({explanation:t,onFollowUp:e,showLead:r=!1,maxFollowUps:n=3})=>_("section",{class:"cf-analytics-explanation","data-testid":"inline-analytics-explanation","aria-label":"Analysis and supporting evidence",children:[r?_("div",{class:"cf-analytics-explanation__lead","data-testid":"analytics-explanation-lead",children:[t.conversationalPreface?_("p",{class:"cf-analytics-explanation__summary",children:t.conversationalPreface}):null,_("div",{class:"cf-analytics-explanation__lead-meta",children:[_("span",{class:"cf-analytics-explanation__eyebrow",children:"Answer from your data"}),_("span",{class:"cf-analytics-explanation__provenance",children:[_("span",{"aria-hidden":"true",class:"cf-analytics-explanation__provenance-dot"}),t.source==="ai_grounded"?"AI-assisted · evidence checked":"Based on current values"]})]}),_("h3",{class:"cf-analytics-explanation__headline",children:t.headline}),_("p",{class:"cf-analytics-explanation__summary",children:t.summary})]}):null,_("div",{class:"cf-analytics-explanation__body",children:[(t.evidence?.length??0)>0?_("section",{class:"cf-analytics-explanation__section",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"What the numbers show"}),_("ul",{class:"cf-analytics-explanation__evidence",children:t.evidence?.slice(0,4).map(a=>_("li",{class:"cf-analytics-explanation__evidence-item",children:[_("span",{"aria-hidden":"true",class:"cf-analytics-explanation__evidence-bullet"}),_("span",{children:a})]},a))})]}):null,t.businessMeaning?_("section",{class:"cf-analytics-explanation__meaning",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Why this may matter"}),_("p",{class:"cf-analytics-explanation__paragraph",children:t.businessMeaning})]}):null,(t.possibleDrivers?.length??0)>0?_("section",{class:"cf-analytics-explanation__section",children:[_("div",{class:"cf-analytics-explanation__section-heading",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Possibilities worth checking"}),_("span",{class:"cf-analytics-explanation__hint",children:"These are not proven causes"})]}),_("div",{class:"cf-analytics-explanation__drivers",children:t.possibleDrivers?.slice(0,2).map(a=>_("article",{class:"cf-analytics-explanation__driver",children:[_("p",{class:"cf-analytics-explanation__driver-title",children:a.hypothesis}),_("p",{class:"cf-analytics-explanation__driver-body",children:[_("span",{class:"cf-analytics-explanation__driver-label",children:"How to check:"})," ",a.howToCheck]})]},`${a.hypothesis}-${a.howToCheck}`))})]}):null,(t.recommendations?.length??0)>0?_("section",{class:"cf-analytics-explanation__section",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Useful next steps"}),_("div",{class:"cf-analytics-explanation__recommendations",children:t.recommendations?.slice(0,3).map((a,i)=>_("article",{class:"cf-analytics-explanation__recommendation",children:[_("span",{class:"cf-analytics-explanation__recommendation-index",children:i+1}),_("div",{children:[_("p",{class:"cf-analytics-explanation__recommendation-title",children:a.action}),_("p",{class:"cf-analytics-explanation__recommendation-body",children:a.why}),a.successMetric?_("p",{class:"cf-analytics-explanation__recommendation-body",children:[_("span",{class:"cf-analytics-explanation__driver-label",children:"Watch:"})," ",a.successMetric]}):null]})]},`${a.action}-${a.why}`))})]}):null,t.forecast?_("section",{class:"cf-analytics-explanation__outlook",children:[_("div",{class:"cf-analytics-explanation__outlook-header",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Outlook"}),_("span",{class:"cf-analytics-explanation__outlook-badge",children:E5(t.forecast.qualityStatus)})]}),_("p",{class:"cf-analytics-explanation__paragraph",children:t.forecast.text}),t.forecast.limitations?_("p",{class:"cf-analytics-explanation__recommendation-body",children:t.forecast.limitations}):null]}):null,e&&(t.followUps?.length??0)>0?_("section",{class:"cf-analytics-explanation__section cf-analytics-explanation__follow-up",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Ask a follow-up"}),_("div",{class:"cf-analytics-explanation__questions",children:t.followUps?.slice(0,n).map(a=>_("button",{type:"button",class:"cf-analytics-explanation__question",onClick:()=>e(a),children:a},a))})]}):null,(t.limitations?.length??0)>0?_("details",{class:"cf-analytics-explanation__limits",children:[_("summary",{class:"cf-analytics-explanation__limits-summary",children:"Important limits"}),_("ul",{class:"cf-analytics-explanation__limits-list",children:t.limitations?.map(a=>_("li",{children:a},a))})]}):null]}),_("p",{class:"cf-analytics-explanation__source",children:t.source==="ai_grounded"?"AI-assisted wording, checked against the live values shown here.":"Based only on the live values shown here."})]}),Cp=t=>t.explanation?.source==="ai_grounded"?t.explanation:t.businessAnalysis?.explanation??t.explanation,i1=()=>{const t=X(null);return le(()=>{const e=requestAnimationFrame(()=>t.current?.scrollIntoView?.({block:"end"}));return()=>cancelAnimationFrame(e)},[]),t},V5=t=>t.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()??"").join("")||"🤖",ps=t=>{const e=t?.avatarId?.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-");return e?` cf-avatar-preset--${e}`:""},U5={"support-guide":"SG","sales-host":"SH","calm-advisor":"CA","technical-guide":"TG","school-desk":"SD","front-office":"FO"},tu=t=>{const e=t?.avatarId?.trim().toLowerCase();return e&&U5[e]||(t?V5(t.agentName):"·")},o1=({persona:t,small:e,hideWhenMissing:r})=>{const n=e?"cf-msg__avatar":"cf-header__avatar",a=t?.agentAvatarUrl?.trim();return a?_("span",{class:n,children:_("img",{src:a,alt:""})}):r?null:_("span",{class:`${n}${ps(t)}`,children:tu(t)})},G5=()=>{const t=kr(),[e,r]=U(0),n=["Understanding your question","Checking approved information","Preparing your answer"];return le(()=>{const a=[window.setTimeout(()=>r(1),1800),window.setTimeout(()=>r(2),5e3)];return()=>a.forEach(i=>window.clearTimeout(i))},[]),_("div",{class:"cf-msg__bubble cf-typing","aria-label":t.assistantTyping,children:[_("span",{class:"cf-typing__label","aria-live":"polite",children:n[e]}),_("span",{class:"cf-typing__dot"}),_("span",{class:"cf-typing__dot"}),_("span",{class:"cf-typing__dot"})]})},$5=3,W5=({msg:t})=>{if(!t.sources||t.sources.length===0)return null;const e=new Set,r=[];for(const i of t.sources){const o=(i.url||i.title||"").toLowerCase();!o||e.has(o)||(e.add(o),r.push(i))}if(r.length===0)return null;const n=r.slice(0,$5),a=r.length-n.length;return _("div",{class:"cf-sources",children:[n.map((i,o)=>i.url?_("a",{class:"cf-source",href:i.url,target:"_blank",rel:"noopener noreferrer nofollow",title:i.title||i.url,children:[_(hs,{}),_("span",{children:i.title||i.url})]},o):_("span",{class:"cf-source",title:i.title,children:[_(hs,{}),_("span",{children:i.title})]},o)),a>0&&_("span",{class:"cf-source cf-source--more",children:["+",a," more"]})]})},q5=({replies:t,onPick:e})=>t&&t.length>0?_("div",{class:"cf-chips",children:t.map((r,n)=>_("button",{type:"button",class:"cf-chip",onClick:()=>e(r),children:r},n))}):null,Y5=({persona:t,starters:e,onPick:r,onFocusComposer:n,speaking:a,voiceState:i="idle",replyPending:o=!1,pinned:s=!1,muted:l=!1,onToggleMute:c,onEndCall:u,onTalkNow:f,showTalkNow:h=!1,micLevel:d=0,theaterMode:p=!1,onToggleTheater:m,onMinimize:g,audioDevices:v=[],selectedAudioDeviceId:y="",onSelectAudioDevice:b,connectingOnly:x=!1})=>{if(!t)return null;const w=!!(t.allowVoiceInput&&t.talkbackMode&&t.talkbackMode!=="text");if(!(w||t.widgetModule==="assistant"))return null;const k=t.agentAvatarUrl?.trim()||"",C=t.assistantMediaUrl?.trim()||k,A=t.assistantMediaKind==="video"&&!!C,M=e.slice(0,3),T=i!=="idle",D=i!=="idle"?"End voice chat":`Speak with ${t.agentName}`,L=s&&w&&!T&&!a,R=i==="connecting"||i==="processing"||T&&o,O=["cf-assistant-card__stage","cf-assistant-card__stage--local",T?"is-live":"",R?"is-thinking":"",qi(i)&&!l?"is-listening":"",a||i==="speaking"?"is-speaking":"",l?"is-muted":""].filter(Boolean).join(" "),B=qi(i)&&!l?{"--cf-listen":String(Math.max(.18,Math.min(1,d*8)))}:void 0,j=R&&_("span",{class:"cf-call-ripple","aria-hidden":"true",children:[_("span",{}),_("span",{}),_("span",{})]});if(x)return _("div",{class:"cf-assistant-card cf-assistant-card--connecting","aria-live":"polite",children:[_("div",{class:"cf-assistant-card__connecting-avatar",children:[k?_("img",{src:k,alt:""}):_("span",{class:`cf-assistant-card__connecting-face${ps(t)}`,children:tu(t)}),j]}),_("div",{class:"cf-assistant-card__connecting-copy",children:[_("span",{class:"cf-assistant-card__connecting-eyebrow",children:t.agentName}),_("strong",{children:"Connecting with the AI…"})]})]});const P=T&&u&&_(xE,{voiceState:i,muted:l,onToggleMute:c??(()=>{}),onEndCall:u,onTalkNow:f??(()=>{}),showTalkNow:h,micLevel:d,theaterMode:p,onToggleTheater:m??(()=>{}),onMinimize:g??(()=>{}),audioDevices:v,selectedAudioDeviceId:y,onSelectAudioDevice:b??(()=>{})});return L?_("div",{class:"cf-assistant-card cf-assistant-card--pinned cf-assistant-card--compact",children:_("button",{type:"button",class:"cf-assistant-card__compact-speak",onClick:n,children:[k?_("span",{class:"cf-assistant-card__compact-avatar",children:_("img",{src:k,alt:""})}):null,_("span",{class:"cf-assistant-card__compact-mic","aria-hidden":"true",children:_(ds,{})}),_("span",{class:"cf-assistant-card__compact-label",children:D})]})}):_("div",{class:`cf-assistant-card ${s?"cf-assistant-card--pinned":""} ${a?"is-speaking":""}`,children:[(C||w)&&_("div",{class:O,style:B,children:[_("div",{class:`cf-assistant-card__media ${C?"cf-assistant-card__media--uploaded":"cf-assistant-card__media--generated"}${ps(t)}`,children:[A?_("video",{src:C,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):C?_("img",{src:C,alt:""}):_("div",{class:`cf-assistant-card__avatar-stage${ps(t)}`,children:_("div",{class:"cf-assistant-card__face",children:[_("span",{class:"cf-assistant-card__initials",children:tu(t)}),_("span",{class:"cf-assistant-card__eye cf-assistant-card__eye--left"}),_("span",{class:"cf-assistant-card__eye cf-assistant-card__eye--right"}),_("span",{class:"cf-assistant-card__mouth"})]})}),C&&!A&&_("span",{class:"cf-assistant-card__mouth cf-assistant-card__mouth--overlay"}),_("span",{class:"cf-avatar-aura cf-avatar-aura--one","aria-hidden":"true"}),_("span",{class:"cf-avatar-aura cf-avatar-aura--two","aria-hidden":"true"}),_("span",{class:"cf-avatar-listen-ring","aria-hidden":"true"}),_("span",{class:"cf-avatar-wave","aria-hidden":"true",children:[_("span",{}),_("span",{}),_("span",{}),_("span",{})]})]}),j,T&&_("span",{class:"cf-call-status",role:"status","aria-live":"polite",children:Ap(i)}),w&&(P||_("button",{type:"button",class:"cf-assistant-card__speak",onClick:n,children:[_(ds,{}),D]}))]}),!s&&_(Me,{children:[t.agentDescription?_("p",{class:"cf-assistant-card__copy",children:t.agentDescription}):_("p",{class:"cf-assistant-card__copy",children:t.greeting}),M.length>0&&_("div",{class:"cf-assistant-card__chips",children:M.map(V=>_("button",{type:"button",class:"cf-assistant-card__chip",onClick:()=>r(V),children:V},V))}),t.disclaimerText||t.assistantPrivacyUrl?_("p",{class:"cf-assistant-card__privacy",children:[t.disclaimerText||"This chat may be recorded for quality and support.",t.assistantPrivacyUrl?_(Me,{children:[" ",_("a",{href:t.assistantPrivacyUrl,target:"_blank",rel:"noopener noreferrer nofollow",children:"Privacy Policy"})]}):null]}):null]})]})},X5={calendar:h5,"calendar-clock":m5,headset:e1,mail:Sp,message:v5,newsletter:y5,phone:p5,presentation:g5,lifebuoy:e1},Z5=t=>X5[t]??Sp,K5=t=>{if(t.id==="public_contact_support")return"contact-support";switch(t.endpoint){case"book-demo":return"book-demo";case"request-callback":return"request-callback";case"schedule-callback":return"schedule-callback";case"subscribe-newsletter":return"subscribe-newsletter";case"contact":return"contact";default:return"inquiry"}},j5={public_contact_support:{label:"Contact support",description:"Send your request to the support team.",category:"support",icon:"headset",endpoint:"inquiry"},public_submit_inquiry:{label:"Leave a message",description:"Send your question and contact details.",category:"support",icon:"message",endpoint:"inquiry"},public_book_demo:{label:"Book a demo",description:"Request a demo from the team.",category:"sales",icon:"presentation",endpoint:"book-demo"},public_request_callback:{label:"Request a callback",description:"Ask the next available sales teammate to call you.",category:"sales",icon:"phone",endpoint:"request-callback"},public_schedule_callback:{label:"Schedule a callback",description:"Choose an available date and time for a call.",category:"sales",icon:"calendar-clock",endpoint:"schedule-callback"},public_subscribe_newsletter:{label:"Subscribe",description:"Get product updates.",category:"marketing",icon:"newsletter",endpoint:"subscribe-newsletter"}},J5=(t,e,r={})=>Array.isArray(t)?t.filter(n=>n.readiness!=="unavailable").map(n=>s1(n,r[n.id])):(e??[]).flatMap(n=>{const a=j5[n];if(!a)return[];const i=K5({...a,id:n}),o=Qc[i];return[{...a,id:n,presentation:i==="book-demo"||i==="schedule-callback"?"booking":"form",formTitle:o.title,submitLabel:o.submit,fields:o.fields,delivery:"",prompt:"",shortLabel:a.label.toLowerCase(),enabled:!0,readiness:"available",legacyFallback:!0}]}).map(n=>s1(n,r[n.id])),s1=(t,e)=>{if(!e)return t;const r=e.fields??{};return{...t,...Object.fromEntries(Object.entries(e).filter(([n,a])=>n!=="fields"&&a!==void 0)),fields:t.fields.map(n=>({...n,...r[n.key]}))}},Q5=(t,e)=>{const r=t.map(n=>n.label);return r.length===0?e.actionGetInTouch:r.length<=3?r.join(", "):`${r.slice(0,2).join(", ")} ${ct(e.actionMore,{count:String(r.length-2)})}`},l1=({label:t,required:e,value:r,onInput:n})=>{const a=Ht(()=>l5(r),[]),[i,o]=U(a.country.iso),[s,l]=U(a.national),[c,u]=U(!1),[f,h]=U(""),d=X(null),p=qa.find(v=>v.iso===i)??a.country,m=Ht(()=>{const v=f.trim().toLowerCase().replace(/^\+/,"");return v?qa.filter(y=>y.name.toLowerCase().includes(v)||y.iso.toLowerCase().includes(v)||y.dial.includes(v)):qa},[f]);le(()=>{if(!c)return;const v=b=>{d.current&&!b.composedPath().includes(d.current)&&u(!1)},y=b=>{b.key==="Escape"&&u(!1)};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",y),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",y)}},[c]);const g=v=>{const y=qa.find(b=>b.iso===v)??p;o(y.iso),u(!1),h(""),n(Qx(y,s))};return _("div",{class:"cf-phone",role:"group","aria-label":`${t}${e?" *":""}`,ref:d,children:[_("span",{class:"cf-phone__label",children:[t,e?" *":""]}),_("div",{class:"cf-phone__control",children:[_("button",{type:"button",class:"cf-phone__country","aria-label":`${p.name}, +${p.dial}. Choose country and calling code`,"aria-haspopup":"listbox","aria-expanded":c,onClick:()=>u(v=>!v),children:[_("span",{"aria-hidden":"true",children:Jx(p.iso)}),_("span",{class:"cf-phone__country-code",children:["+",p.dial]}),_(Ya,{})]}),_("input",{class:"cf-phone__input",type:"tel",inputMode:"numeric",pattern:"[0-9]*",autoComplete:"tel-national",maxLength:15,placeholder:"8028509941",value:s,"aria-label":t,onInput:v=>{const y=v.target,b=y.value.replace(/\D/g,"");y.value=b,l(b),n(Qx(p,b))}})]}),c?_("div",{class:"cf-phone__menu",children:[_("input",{class:"cf-phone__search",type:"search",placeholder:"Search country or code","aria-label":"Search countries",value:f,autoFocus:!0,onInput:v=>h(v.target.value)}),_("div",{class:"cf-phone__options",role:"listbox","aria-label":"Countries",children:m.length>0?m.map(v=>_("button",{type:"button",class:`cf-phone__option ${v.iso===p.iso?"is-selected":""}`,role:"option","aria-selected":v.iso===p.iso,onClick:()=>g(v.iso),children:[_("span",{"aria-hidden":"true",children:Jx(v.iso)}),_("span",{class:"cf-phone__option-name",children:v.name}),_("span",{class:"cf-phone__option-code",children:["+",v.dial]})]},v.iso)):_("div",{class:"cf-phone__empty",children:"No countries found"})})]}):null]})},eE=({field:t,value:e,onInput:r})=>{if(t.kind==="tel")return _(l1,{label:t.label,required:t.required,value:e,onInput:r});const n=t.placeholder??t.label,a={class:"cf-form__input",placeholder:t.required?`${n} *`:n,value:e,"aria-label":t.label,onInput:i=>r(i.target.value)};return t.kind==="textarea"?_("textarea",{rows:2,...a}):_("input",{type:t.kind,...a})},tE=({spec:t,visitor:e,onSubmit:r,onCancel:n})=>{const a=kr(),i=i1(),[o,s]=U(()=>{const v={};for(const y of t.fields)y.identity&&e[y.identity]&&(v[y.key]=e[y.identity]);return v}),[l,c]=U("idle"),[u,f]=U(""),h=v=>!!(v.identity&&e[v.identity]?.trim()),d=t.fields.filter(v=>!h(v)),p=d.every(v=>!v.required||(o[v.key]?.trim()??"")!==""),m=e.email||e.name||"",g=async()=>{if(!p||l==="submitting")return;c("submitting");const v={},y={};for(const b of t.fields){const x=o[b.key]?.trim();x&&(v[b.key]=x,b.identity&&(y[b.identity]=x))}try{const b=await r(v,y);f(fs(b.note||a.formThanks,b.caseReference,a)),c("done")}catch{c("error")}};return l==="done"?_("div",{class:"cf-form cf-form--done",children:[_(Xa,{}),_("span",{children:u})]}):_("div",{class:"cf-form",ref:i,children:[d.length===0&&m&&_("div",{class:"cf-form__as",children:ct(a.actionAs,{identity:m})}),d.map(v=>_(eE,{field:v,value:o[v.key]??"",onInput:y=>s(b=>({...b,[v.key]:y}))},v.key)),l==="error"&&_("div",{class:"cf-form__err",children:a.formError}),_("div",{class:"cf-form__actions",children:[n&&_("button",{type:"button",class:"cf-form__cancel",onClick:n,children:a.cancel}),_("button",{type:"button",class:"cf-form__submit",disabled:!p||l==="submitting",onClick:g,children:l==="submitting"?a.sending:t.submit})]})]})},c1=t=>String(t).padStart(2,"0"),rE=()=>{const t=[];for(let e=9;e<=17;e++)t.push(`${c1(e)}:00`),t.push(`${c1(e)}:30`);return t},nE=t=>{const e=new Date;return e.setHours(0,0,0,0),Array.from({length:t},(r,n)=>{const a=new Date(e);return a.setDate(e.getDate()+n),a})},aE=(t,e)=>{const[r,n]=e.split(":").map(Number),a=new Date(t.getFullYear(),t.getMonth(),t.getDate(),r??0,n??0);try{return new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"}).format(a)}catch{return`${t.toDateString()} ${e}`}},Tn=(t,e)=>{const[r,n]=e.split(":").map(Number);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),r??0,n??0)},iE=(t,e)=>{const r=Tn(t,e);try{return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(r)}catch{return e}},ru=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}},u1=(t,e)=>{try{const r=new URL(t);return r.searchParams.set("embed_type","Inline"),globalThis.location?.hostname&&r.searchParams.set("embed_domain",globalThis.location.hostname),e.name?.trim()&&r.searchParams.set("name",e.name.trim()),e.email?.trim()&&r.searchParams.set("email",e.email.trim()),r.toString()}catch{return t}},oE=(t,e)=>{if(!e?.contentWindow||t.source!==e.contentWindow)return!1;try{const r=new URL(t.origin).hostname;if(r!=="calendly.com"&&!r.endsWith(".calendly.com"))return!1}catch{return!1}return!!(t.data&&typeof t.data=="object"&&typeof t.data.event=="string")},sE=({actionId:t,fields:e=Qc["book-demo"].fields,visitor:r,onSubmit:n,onCancel:a,onDemoSlots:i,onConfirmHostedBooking:o,scheduler:s,title:l,submitLabel:c})=>{const u=t==="public_schedule_callback",f=u?Qc["schedule-callback"]:Qc["book-demo"],h=l?.trim()||f.title,d=kr(),p=i1(),m=!!(!u&&s?.connected&&s.provider==="calendly"),g=m?d.bookingOpenScheduler:c?.trim()||f.submit,v=!!(s?.connected&&s.mode==="event"&&!m&&(s.availability===void 0||s.availability.calendarIds.length>0)),y=Math.min(60,Math.max(1,s?.availability?.bookingWindowDays??14)),b=Ht(()=>nE(y),[y]),[x,w]=U(null),[S,k]=U(v?"loading":"request_only"),[C,A]=U(s?.availability?.slotDurationMinutes??30),[M,T]=U(ru()||s?.availability?.timezone||""),D=Ht(()=>v?S!=="available"||x===null?[]:[...new Set([...x].map(te=>{const Se=new Date(te);return`${String(Se.getHours()).padStart(2,"0")}:${String(Se.getMinutes()).padStart(2,"0")}`}))].sort():rE(),[x,S,v]),L=Ht(()=>{const te=Date.now();for(let Se=0;Se<b.length;Se++)if(D.some(Le=>Tn(b[Se],Le).getTime()>te))return Se;return 0},[b,D]),[R,O]=U(L),[B,j]=U(null),[P,V]=U(r.name??""),[H,Z]=U(r.email??""),[re,Te]=U(r.phone??""),[ge,xe]=U(""),[Ce,be]=U("idle"),[it,Qe]=U(""),[ze,oe]=U(!1),[pe,ot]=U(""),[Xe,kt]=U("scheduler"),[tt,lr]=U(null),[Cr,Tt]=U("idle"),[Pt,Bt]=U(""),[xt,tn]=U(""),[F,ue]=U(""),De=X(null),we=async(te,Se,Le)=>{Tt("loading");try{const ve=await o?.(te,Se,Le),Ae=ve?.meetingUrl||ve?.eventLink||"",cr=ve?.rescheduleUrl||ve?.cancelUrl||"";ot(Ae||cr),kt(Ae?"meeting":"manage"),Tt(Ae||cr?"idle":"error")}catch{Tt("error")}};le(()=>{if(!Pt)return;const te=Se=>{if(!oE(Se,De.current)||Se.data.event!=="calendly.event_scheduled")return;const Le=Se.data.payload,ve=Le?.event?.uri?.trim()||"",Ae=Le?.invitee?.uri?.trim()||"";F&&ve&&Ae?(lr({eventUri:ve,inviteeUri:Ae}),we(F,ve,Ae)):Tt("error"),Bt(""),Qe(fs(d.bookingScheduled,xt,d)),be("done")};return window.addEventListener("message",te),()=>window.removeEventListener("message",te)},[o,xt,F,Pt,d]),le(()=>{if(!v||S!=="available"||x===null)return;const te=b.findIndex(Se=>D.some(Le=>x.has(Tn(Se,Le).getTime())));te>=0&&O(te)},[x,S,b,v,D]);const rt=!!(!u&&s?.connected&&(s.mode==="link"||s.provider==="calendly")),vt=async()=>{if(Ce==="submitting"||Ce==="scheduling"||!r.name?.trim()&&!P.trim()||!r.email?.trim()&&!H.trim())return;be("submitting");const te={};H.trim()&&(te.email=H.trim()),P.trim()&&(te.name=P.trim());try{const Se=await n({...H.trim()?{visitorEmail:H.trim()}:{},...P.trim()?{visitorName:P.trim()}:{}},te),Le=Se.booking?.schedulingLink||s?.bookingLink||"";if(!Le){be("error");return}ot(Le),kt("scheduler"),tn(Se.caseReference||""),ue(Se.inquiryId||""),Bt(u1(Le,{name:P.trim()||r.name,email:H.trim()||r.email})),be("scheduling")}catch{be("error")}},[Mr,rn]=U(new Set),[Fr,bs]=U([]),[Za,Qt]=U(0),[Xi,Zi]=U(!1);le(()=>{if(!i)return;let te=!0;const Se=new Date,Le=new Date;return Le.setDate(Le.getDate()+y+1),i(Se.toISOString(),Le.toISOString()).then(ve=>{if(te)if(rn(new Set(ve.taken.map(Ae=>Date.parse(Ae)).filter(Ae=>!Number.isNaN(Ae)))),bs(ve.busy.map(Ae=>[Date.parse(Ae.start),Date.parse(Ae.end)]).filter(([Ae,cr])=>!Number.isNaN(Ae)&&!Number.isNaN(cr))),A(ve.slotDurationMinutes??30),T(ru()||ve.timezone||""),v){if(ve.status!=="available"||!Array.isArray(ve.available)){w(null),k("unavailable");return}w(new Set(ve.available.map(Ae=>Date.parse(Ae)).filter(Ae=>!Number.isNaN(Ae)))),k("available")}else k(ve.status??"request_only")}).catch(()=>{!te||!v||(w(null),k("unavailable"))}),()=>{te=!1}},[y,v,i,Za]);const nn=!!r.email?.trim(),Cn=!!r.name?.trim(),ea=!!r.phone?.trim(),an=re,Ka=!!B&&(!v||S==="available")&&(Cn||P.trim()!=="")&&(u?ea||c5(an):nn||H.trim()!==""),er=(u?r.phone||r.name:r.email||r.name)||"",tr=te=>e.find(Se=>Se.key===te),Mn=tr("visitorPhone"),zt=tr("topic"),xs=te=>Mr.has(Tn(b[R],te).getTime()),ws=te=>Tn(b[R],te).getTime()<=Date.now(),Ss=C*60*1e3,ks=te=>{const Se=Tn(b[R],te).getTime(),Le=Se+Ss;return Fr.some(([ve,Ae])=>Se<Ae&&Le>ve)},An=te=>!v||x?.has(Tn(b[R],te).getTime())===!0,Ts=async()=>{if(!Ka||Ce==="submitting"||!B)return;be("submitting"),Zi(!1);const te=Tn(b[R],B),Se=aE(b[R],B),Le={};P.trim()&&(Le.name=P.trim()),u?an&&(Le.phone=an):H.trim()&&(Le.email=H.trim());try{const ve=await n(u?{bestTime:Se,slotAt:te.toISOString(),visitorTimezone:ru()||"UTC",...an?{visitorPhone:an}:{},...P.trim()?{visitorName:P.trim()}:{},...ge.trim()?{topic:ge.trim()}:{}}:{preferredAt:Se,slotAt:te.toISOString(),visitorTimezone:ru()||"UTC",...H.trim()?{visitorEmail:H.trim()}:{},...P.trim()?{visitorName:P.trim()}:{}},Le);if(!u&&ve.booking?.mode==="link"&&ve.booking.schedulingLink?.trim()){const Ae=ve.booking.schedulingLink.trim();ot(Ae),tn(ve.caseReference||""),ue(ve.inquiryId||""),Bt(u1(Ae,{name:P.trim()||r.name,email:H.trim()||r.email})),be("scheduling");return}ve.booking?.confirmed?(Qe(fs(ve.note||ct(u?d.bookingCallbackConfirmed:d.bookingConfirmed,{when:Se}),ve.caseReference,d)),ot(ve.booking.meetingUrl||ve.booking.rescheduleUrl||ve.booking.cancelUrl||ve.booking.eventLink||""),kt(ve.booking.meetingUrl||ve.booking.eventLink?"meeting":"manage")):ve.booking?.verificationPending?(oe(!0),Qe(fs(ve.note||ct(d.bookingVerificationPending,{when:Se}),ve.caseReference,d))):Qe(fs(ve.note||ct(u?d.bookingCallbackRequested:d.bookingRequested,{when:Se}),ve.caseReference,d)),be("done")}catch(ve){ve?.status===409?(rn(Ae=>new Set(Ae).add(te.getTime())),j(null),Zi(!0),Qt(Ae=>Ae+1),be("idle")):be("error")}},ja=()=>{Bt(""),be("idle"),a?.()};return Ce==="scheduling"&&Pt?_("div",{class:"cf-scheduler-overlay",role:"dialog","aria-modal":"true","aria-label":h,children:[_("header",{class:"cf-scheduler-overlay__head",children:[_("button",{type:"button",class:"cf-scheduler-overlay__back",onClick:ja,children:d.bookingBackToChat}),_("strong",{children:h}),_("div",{class:"cf-scheduler-overlay__tools",children:[_("a",{href:pe,target:"_blank",rel:"noopener noreferrer",children:[d.bookingOpenNewTab," ",_(hs,{})]}),_("button",{type:"button","aria-label":d.bookingCloseScheduler,onClick:ja,children:_(Qn,{})})]})]}),_("div",{class:"cf-scheduler-overlay__body",children:[_("div",{class:"cf-scheduler-overlay__loading",children:d.bookingLoadingScheduler}),_("iframe",{ref:De,class:"cf-scheduler-overlay__frame",src:Pt,title:h,allow:"camera; microphone; fullscreen; payment"})]})]}):Ce==="done"?_("div",{class:`cf-form cf-form--done${ze?" cf-form--pending":""}`,role:ze?"alert":"status",children:[!ze&&_(Xa,{}),_("span",{children:it}),Cr==="loading"&&_("span",{role:"status",children:d.bookingCheckingDetails}),Cr==="error"&&_("div",{class:"cf-booking__receipt-error",role:"alert",children:[_("span",{children:d.bookingDetailsUnavailable}),tt&&F&&o&&_("button",{type:"button",class:"cf-booking__back",onClick:()=>{we(F,tt.eventUri,tt.inviteeUri)},children:d.bookingRetryDetails})]}),pe&&_("a",{class:"cf-booking__link",href:pe,target:"_blank",rel:"noopener noreferrer",children:[Xe==="meeting"?d.bookingMeetingLink:Xe==="manage"?d.bookingManageLink:d.bookingOpenScheduler," ",_(hs,{}),_("span",{class:"cf-booking__url",children:pe})]}),a&&_("button",{type:"button",class:"cf-booking__back",onClick:a,children:d.bookingBackToChat})]}):rt?_("div",{class:"cf-form cf-booking",ref:p,children:[_("div",{class:"cf-booking__hint",children:ct(d.bookingViaProvider,{provider:s?.label??d.bookingSchedulerFallback})}),nn?er?_("div",{class:"cf-form__as",children:ct(d.actionAs,{identity:er})}):null:_(Me,{children:[!r.name?.trim()&&_("input",{class:"cf-form__input",type:"text",placeholder:`${d.handoffName} *`,value:P,"aria-label":d.handoffName,onInput:te=>V(te.target.value)}),_("input",{class:"cf-form__input",type:"email",placeholder:`${d.handoffEmail} *`,value:H,"aria-label":d.handoffEmail,onInput:te=>Z(te.target.value)})]}),Ce==="error"&&_("div",{class:"cf-form__err",children:d.formError}),_("div",{class:"cf-form__actions",children:[a&&_("button",{type:"button",class:"cf-form__cancel",onClick:a,children:d.cancel}),_("button",{type:"button",class:"cf-form__submit",disabled:Ce==="submitting"||!r.name?.trim()&&P.trim()===""||!nn&&H.trim()==="",onClick:vt,children:Ce==="submitting"?d.sending:d.bookingOpenScheduler})]})]}):_("div",{class:"cf-form cf-booking",ref:p,children:[_("div",{class:"cf-booking__hint",children:[d.bookingPickTime," ·"," ",_("span",{class:"cf-booking__dur",children:ct(u?d.bookingCallbackDuration:d.bookingDuration,{count:String(C)})}),M?` · ${ct(d.bookingTimezone,{timezone:M})}`:""]}),v&&S==="loading"?_("div",{class:"cf-booking__state",role:"status",children:d.bookingCheckingAvailability}):null,v&&S==="unavailable"?_("div",{class:"cf-form__err",role:"alert",children:d.bookingAvailabilityUnavailable}):null,v&&S==="available"&&D.length===0?_("div",{class:"cf-booking__state",role:"status",children:d.bookingNoSlots}):null,D.length>0?_("div",{class:"cf-booking__dates",role:"tablist","aria-label":d.bookingPickDay,children:b.map((te,Se)=>_("button",{type:"button",role:"tab","aria-selected":Se===R,disabled:v&&S==="available"&&!D.some(Le=>x?.has(Tn(te,Le).getTime())),class:`cf-booking__date ${Se===R?"is-selected":""}`,onClick:()=>{O(Se),j(null)},children:[_("span",{class:"cf-booking__dow",children:te.toLocaleDateString(void 0,{weekday:"short"})}),_("span",{class:"cf-booking__dom",children:te.getDate()})]},Se))}):null,D.length>0?_("div",{class:"cf-booking__slots",role:"listbox","aria-label":d.bookingPickTimeLabel,children:D.map(te=>{const Se=ws(te),Le=ks(te),ve=xs(te),Ae=An(te),cr=ve||Se||Le||!Ae;return _("button",{type:"button",role:"option","aria-selected":B===te,disabled:cr,title:Se?d.bookingEarlierToday:Le?d.bookingCalendarBusy:ve?d.bookingAlreadyBooked:Ae?void 0:d.bookingNotOffered,class:`cf-booking__slot ${B===te?"is-selected":""} ${cr?"is-taken":""}`,onClick:()=>j(te),children:iE(b[R],te)},te)})}):null,Xi&&_("div",{class:"cf-form__err",children:d.bookingSlotTaken}),er?_("div",{class:"cf-form__as",children:ct(d.actionAs,{identity:er})}):null,!Cn&&_("input",{class:"cf-form__input",type:"text",placeholder:`${d.handoffName} *`,value:P,"aria-label":d.handoffName,onInput:te=>V(te.target.value)}),u&&!ea&&_(l1,{label:Mn?.label??"Phone number",required:!0,value:re,onInput:Te}),u&&zt?_("input",{class:"cf-form__input",type:"text",placeholder:zt.placeholder||zt.label,value:ge,"aria-label":zt.label,onInput:te=>xe(te.target.value)}):null,!u&&!nn&&_(Me,{children:_("input",{class:"cf-form__input",type:"email",placeholder:`${d.handoffEmail} *`,value:H,"aria-label":d.handoffEmail,onInput:te=>Z(te.target.value)})}),Ce==="error"&&_("div",{class:"cf-form__err",children:d.formError}),_("div",{class:"cf-form__actions",children:[a&&_("button",{type:"button",class:"cf-form__cancel",onClick:a,children:d.cancel}),_("button",{type:"button",class:"cf-form__submit",disabled:!Ka||Ce==="submitting",onClick:Ts,children:Ce==="submitting"?d.sending:g})]})]})},f1=({actions:t,descriptors:e,visitor:r,onSubmitForm:n,onDemoSlots:a,onConfirmHostedBooking:i,scheduler:o,exclude:s=[],openAction:l,translations:c={},onClose:u})=>{const f=kr(),[h,d]=U(null),[p,m]=U(!1),g=X(null),v=X(null),y=X(!1),b=Ht(()=>`cf-actions-${Math.random().toString(36).slice(2,9)}`,[]),x=Ht(()=>J5(e,t,c).filter(M=>!s.includes(M.id)&&!s.includes(M.endpoint)),[e,t,s,c]);le(()=>{l&&x.some(M=>M.id===l)&&(d(l),m(!0))},[l,x]);const w=h?x.find(M=>M.id===h):void 0,S=Y(()=>{if(u){u();return}y.current=!0,d(null),m(!1)},[u]),k=Y(()=>{u?u():d(null)},[u]);Mu(()=>{p||!y.current||(y.current=!1,g.current?.focus())},[p]);const C=X({drawerOpen:p,activeId:h});if(C.current={drawerOpen:p,activeId:h},le(()=>{const M=T=>{if(T.key!=="Escape")return;const{drawerOpen:D,activeId:L}=C.current;!D&&!L||(T.stopPropagation(),L?k():S())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[k,S]),le(()=>{p&&v.current?.querySelector("button, input, textarea, select")?.focus()},[p,h]),x.length===0)return null;const A=p?w?_("div",{ref:v,id:b,class:"cf-action-drawer is-open",role:"dialog","aria-modal":"false","aria-label":w.formTitle||w.label,children:[_("div",{class:"cf-action-drawer__handle","aria-hidden":"true"}),_("div",{class:"cf-action-drawer__head",children:[_("div",{children:[_("strong",{children:w.formTitle||w.label}),w.legacyFallback?_("small",{class:"cf-action-test-mode",children:f.actionTestMode}):null]}),_("button",{type:"button",class:"cf-action-drawer__close","aria-label":f.actionClose,onClick:k,children:_(Qn,{})})]}),w.readiness==="degraded"&&w.readinessNote?_("p",{class:"cf-action-drawer__note cf-action-drawer__note--warn",role:"status",children:w.readinessNote}):null,w.presentation==="booking"||w.endpoint==="book-demo"||w.endpoint==="schedule-callback"?_(sE,{actionId:w.id,fields:w.fields,visitor:r,title:w.formTitle,submitLabel:w.submitLabel,onCancel:k,onSubmit:(M,T)=>n(w.id,M,T,w.endpoint),onDemoSlots:a,onConfirmHostedBooking:i,scheduler:o}):_(tE,{spec:{title:w.formTitle||w.label,submit:w.submitLabel,fields:w.endpoint==="request-callback"?w.fields.filter(M=>M.key!=="bestTime"):w.fields},visitor:r,onCancel:k,onSubmit:(M,T)=>n(w.id,M,T,w.endpoint)})]}):_("div",{ref:v,id:b,class:"cf-action-drawer cf-action-drawer--menu",role:"dialog","aria-modal":"false","aria-label":f.actionChoose,children:[_("div",{class:"cf-action-drawer__handle","aria-hidden":"true"}),_("div",{class:"cf-action-drawer__head",children:[_("div",{children:[_("span",{class:"cf-action-drawer__eyebrow",children:f.actionNeedHelp}),_("strong",{children:f.actionChoose})]}),_("button",{type:"button",class:"cf-action-drawer__close","aria-label":f.actionClose,onClick:S,children:_(Qn,{})})]}),_("div",{class:"cf-action-drawer__grid",children:x.map(M=>{const T=Z5(M.icon);return _("button",{type:"button",class:"cf-action-card",onClick:()=>d(M.id),children:[_("span",{class:`cf-action-card__icon cf-action-card__icon--${M.category}`,children:_(T,{})}),_("span",{class:"cf-action-card__copy",children:[_("strong",{children:M.label}),M.legacyFallback?_("small",{class:"cf-action-test-mode",children:f.actionTestMode}):null,_("small",{children:M.description}),M.readiness==="degraded"&&M.readinessNote?_("small",{class:"cf-action-card__warn",children:M.readinessNote}):null]}),_(Ya,{})]},M.id)})}),_("p",{class:"cf-action-drawer__note",children:f.actionFooter})]}):null;return _("div",{class:"cf-action-shell",children:[_("button",{ref:g,type:"button",class:"cf-action-trigger",hidden:p,"aria-expanded":p,"aria-controls":b,onClick:()=>p?S():m(!0),children:[_("span",{class:"cf-action-trigger__icon",children:_(Sp,{})}),_("span",{class:"cf-action-trigger__copy",children:[_("strong",{children:f.actionContactOptions}),_("small",{children:Q5(x,f)})]}),_(Ya,{})]}),A]})},lE=({hasEmail:t,visitor:e,question:r,onSubmitForm:n})=>{const a=kr(),[i,o]=U(!1),[s,l]=U(!1),[c,u]=U(e.name??""),[f,h]=U(e.email??"");if(t)return _("div",{class:"cf-handoff cf-handoff--done",children:[_(Xa,{}),_("span",{children:"We’ve alerted the team. If someone is available, they can continue here."})]});if(i){const p=e.email||f;return _("div",{class:"cf-handoff cf-handoff--done",children:[_(Xa,{}),_("span",{children:ct(a.handoffShared,{email:p})})]})}const d=async()=>{if(!(!f.trim()||s)){l(!0);try{await n("inquiry",{visitorEmail:f.trim(),...c.trim()?{visitorName:c.trim()}:{},message:r||"I had a question the assistant couldn’t answer.",subject:"Help request from chat"},{email:f.trim(),name:c.trim()||void 0}),o(!0)}catch{l(!1)}}};return _("div",{class:"cf-handoff",children:[_("div",{class:"cf-handoff__title",children:a.handoffTitle}),_("input",{class:"cf-form__input",type:"text",placeholder:a.handoffName,value:c,"aria-label":a.handoffName,onInput:p=>u(p.target.value)}),_("input",{class:"cf-form__input",type:"email",placeholder:`${a.handoffEmail} *`,value:f,"aria-label":a.handoffEmail,onInput:p=>h(p.target.value)}),_("button",{type:"button",class:"cf-form__submit",disabled:!f.trim()||s,onClick:d,children:s?a.sending:a.handoffNotify})]})},cE=({text:t})=>{const e=kr(),[r,n]=U(!1);return _("button",{type:"button",class:"cf-tool",onClick:async()=>{try{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1500)}catch{}},"aria-label":e.copy,children:[r?_(Xa,{}):_(w5,{}),r?e.copied:e.copy]})},uE=({items:t,onPick:e})=>t.length===0?null:_("div",{class:"cf-starters",children:t.map((r,n)=>_("button",{type:"button",class:"cf-starter",onClick:()=>e(r),children:r},n))}),fE=({items:t})=>{const e=t.filter(r=>r.label.trim()&&r.url.trim()).slice(0,4);return e.length===0?null:_("div",{class:"cf-featured-links",children:e.map((r,n)=>_("a",{class:"cf-featured-link",href:r.url,target:"_blank",rel:"noopener noreferrer nofollow",title:r.label,children:[_(hs,{}),_("span",{children:r.label})]},`${r.url}-${n}`))})},dE=({msg:t,onRate:e})=>{const r=kr(),[n,a]=U(!1),[i,o]=U(""),s=t.feedback,l=()=>{e(t.id,"up"),a(!1)},c=()=>{e(t.id,"down"),a(!0)},u=()=>{e(t.id,"down",i.trim()),a(!1)};return _("div",{class:"cf-feedback",children:[_("div",{class:"cf-feedback__row",children:[_("button",{type:"button",class:`cf-feedback__btn ${s==="up"?"is-active":""}`,"aria-label":r.feedbackHelpful,"aria-pressed":s==="up",onClick:l,children:_(t1,{})}),_("button",{type:"button",class:`cf-feedback__btn ${s==="down"?"is-active":""}`,"aria-label":r.feedbackNotHelpful,"aria-pressed":s==="down",onClick:c,children:_(r1,{})}),s&&!n&&_("span",{class:"cf-feedback__thanks",children:r.feedbackThanks})]}),n&&s==="down"&&_("div",{class:"cf-feedback__comment",children:[_("textarea",{class:"cf-feedback__input",rows:2,placeholder:r.feedbackCommentPlaceholder,value:i,onInput:f=>o(f.target.value)}),_("button",{type:"button",class:"cf-feedback__send",onClick:u,children:r.feedbackSend})]})]})},d1=t=>t.attachments??(t.attachmentName?[{id:t.attachmentId,name:t.attachmentName}]:[]),hE=({msg:t,persona:e,isLast:r,visitor:n,hasEmail:a,lastQuestion:i,showActions:o,onPickReply:s,onSubmitForm:l,onDemoSlots:c,onConfirmHostedBooking:u,onRetry:f,ratable:h,onRate:d,onExpandVisualization:p,onReconnect:m,onOpenAttachment:g})=>{const v=kr(),y=t.role==="user",b=t.liveEventType??"",x=t.content.trim().toLowerCase(),w=b==="handoff_queued"||b==="agent_joined"||b==="agent_left"||b==="ai_handback"||b==="conversation_ended"||x.includes("joined the chat")||x.includes("left the chat")||x.includes("support agents will be with you"),S=t.role==="system"||w,k=t.requestedContactFields?.includes("email")===!0,C=r&&!y&&!S&&!t.reconnectOffer&&!!(t.handoffOffered||k),A=C&&!a?["inquiry"]:[],M=!t.pending&&!t.streaming,T=[...t.artifacts??[],...t.visualization&&!(t.artifacts??[]).some(D=>D.type==="visualization")?[{type:"visualization",visualization:t.visualization}]:[]];return S?_("div",{class:"cf-msg cf-msg--system",children:_("div",{class:"cf-system-event",children:[_("div",{class:"cf-system-event__mark","aria-hidden":"true"}),_("div",{class:"cf-system-event__text",children:t.content}),m&&_("button",{type:"button",class:"cf-system-event__action",onClick:m,children:v.reconnectSupport}),t.createdAt&&_("div",{class:"cf-system-event__time",children:new Date(t.createdAt).toLocaleString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"})})]})}):_("div",{class:`cf-msg cf-msg--${y?"user":"agent"}`,children:[!y&&_(o1,{persona:e,small:!0}),_("div",{class:"cf-msg__col",children:[t.pending&&t.content===""?_(G5,{}):t.imageUrl?_("div",{class:"cf-msg__bubble cf-msg__bubble--media",children:[_("img",{class:"cf-msg__media",src:t.imageUrl,alt:"GIF"}),t.content&&_("span",{class:"cf-msg__caption",children:t.content})]}):_("div",{class:"cf-msg__bubble",children:[y?t.content:R5(t.content),t.streaming&&_("span",{class:"cf-caret","aria-hidden":"true"})]}),y?null:T.map((D,L)=>D.type==="visualization"&&D.visualization?_(h1,{visualization:D.visualization,onExpand:p?()=>p(t.id):void 0,expandControlId:t.id},`visualization-${L}`):D.type==="image"&&(D.data||D.uri?.startsWith("https://"))&&["image/png","image/jpeg","image/webp"].includes(D.mimeType??"")?_("figure",{class:"cf-artifact",children:[D.title?_("figcaption",{children:D.title}):null,_("img",{src:D.uri||`data:${D.mimeType};base64,${D.data}`,alt:D.altText||D.caption||D.title||"Tool result"}),D.caption&&D.caption!==D.title?_("p",{children:D.caption}):null]},`image-${L}`):D.type==="video"&&D.uri?.startsWith("https://")&&(D.mimeType??"").startsWith("video/")?_("figure",{class:"cf-artifact",children:[D.title?_("figcaption",{children:D.title}):null,_("video",{controls:!0,preload:"metadata",playsInline:!0,src:D.uri}),D.caption&&D.caption!==D.title?_("p",{children:D.caption}):null]},`video-${L}`):D.type==="resource_link"&&D.uri?.startsWith("https://")?_("a",{class:"cf-artifact-link",href:D.uri,target:"_blank",rel:"noopener noreferrer nofollow",children:[_("strong",{children:D.title||D.name||"Open result"}),D.caption?_("span",{children:D.caption}):null]},`link-${L}`):null),!y&&t.visualization&&Cp(t.visualization)?_(H5,{explanation:Cp(t.visualization),onFollowUp:s,showLead:!t.content.toLocaleLowerCase().includes(Cp(t.visualization).headline.toLocaleLowerCase())}):null,y&&d1(t).length>0&&_("div",{class:"cf-attach-row cf-attach-row--sent",children:d1(t).map((D,L)=>g?_("button",{type:"button",class:"cf-attach-chip cf-attach-chip--open",title:ct(v.attachOpen,{name:D.name}),"aria-label":ct(v.attachOpen,{name:D.name}),onClick:()=>g(t,D,L),children:[_(eu,{}),_("span",{children:D.name})]},`${D.id??D.name}-${L}`):_("div",{class:"cf-attach-chip",title:D.name,children:[_(eu,{}),_("span",{children:D.name})]},`${D.id??D.name}-${L}`))}),!y&&_(Me,{children:[M&&(t.error||t.content)&&_("div",{class:"cf-msg__actions",children:[_("div",{class:"cf-msg__tools",children:t.error?_("button",{type:"button",class:"cf-tool",onClick:()=>f(t.id,t.retryText??""),children:[_(S5,{}),v.retry]}):_(cE,{text:t.content})}),h&&!t.error&&t.content&&_(dE,{msg:t,onRate:d})]}),_(W5,{msg:t}),r&&_(q5,{replies:t.suggestedReplies,onPick:s}),C&&_(lE,{hasEmail:a,visitor:n,question:i,onSubmitForm:l}),o&&_(f1,{actions:t.availableActions,descriptors:t.actions,openAction:t.selectedAction,visitor:n,onSubmitForm:l,onDemoSlots:c,onConfirmHostedBooking:u,scheduler:e?.scheduler,exclude:A})]})]})]})},h1=({visualization:t,expanded:e=!1,onExpand:r,onClose:n,expandControlId:a})=>{const i=X(null),o=Ht(()=>yp(t),[t]),[s,l]=U(o?.type);le(()=>l(o?.type),[o]);const c=Ht(()=>bR(t),[t]),u=Ht(()=>yp(t,s),[s,t]),f=s??u?.type??o?.type,h=c.find(b=>b.type===f),d=t.rows??[],p=t.columns?.length?t.columns:Object.keys(d[0]??{}),m=p.map(b=>{const x=t.columnMetadata?.find(w=>w.key===b);return x?{key:b,label:x.label,dataType:x.dataType,currencyCode:x.currencyCode}:b});if(d.length===0)return _(z5,{});const g=_(N5,{answeredAt:t.freshness?.answeredAt,reportingPeriod:t.reportingPeriod,filters:t.appliedFilters,rowCount:t.rowCount??d.length}),v=()=>t.tableAvailable===!1||p.length===0?null:_("div",{class:`cf-analytics-visualization${e?" is-expanded":""}`,children:[_("div",{class:"cf-analytics-visualization__header",children:[_("div",{children:[_("div",{class:"cf-analytics-visualization__title",children:t.title?.trim()||"Result details"}),g]}),_("div",{class:"cf-analytics-visualization__actions",children:[t.downloadAvailable?_("button",{type:"button",class:"cf-analytics-visualization__download",onClick:()=>p1(p,d),children:"Download"}):null,e&&n?_("button",{type:"button",class:"cf-analytics-visualization__close","aria-label":"Restore assistant view",onClick:n,children:_(Qn,{})}):r&&t.expandable!==!1?_("button",{type:"button",class:"cf-analytics-visualization__expand","aria-label":"Expand table","data-visualization-message":a,onClick:r,children:_(Tp,{})}):null]})]}),_(TR,{rows:d,columns:m,maxRows:100,expanded:e,classPrefix:"cf"})]});if(t.presentation==="table"||!t.presentation&&t.type==="table")return v();const y=t.chartRecommendation?.valueFields?.[0]??t.valueFields?.[0]??t.value??p[1];if(t.presentation==="kpi"||!t.presentation&&t.type==="kpi"){const b=d[0]?.[y??p[0]??""],x=typeof b=="number"?b:Number(b),w=t.columnMetadata?.find(k=>k.key===y),S=Number.isFinite(x)?us(x,w,t):String(b??"No value");return _("div",{class:`cf-analytics-visualization${e?" is-expanded":""}`,children:[_("div",{class:"cf-analytics-visualization__header",children:[_("div",{children:[_("div",{class:"cf-analytics-visualization__title",children:"Live metric"}),g]}),e&&n?_("button",{type:"button",class:"cf-analytics-visualization__close","aria-label":"Restore assistant view",onClick:n,children:_(Qn,{})}):null]}),_(B5,{label:w?.label??y??"Current value",value:S})]})}return u?_("div",{class:`cf-analytics-visualization${e?" is-expanded":""}`,children:[_("div",{class:"cf-analytics-visualization__header",children:[_("div",{children:[_("div",{class:"cf-analytics-visualization__title",children:u.title}),g]}),_("div",{class:"cf-analytics-visualization__actions",children:[c.length>1?_("details",{ref:i,class:"cf-analytics-chart-picker",children:[_("summary",{"aria-label":"Choose chart type",title:"Choose chart type",children:[_("span",{class:"cf-analytics-chart-picker__current",children:[_(a1,{type:f??u.type}),_("span",{children:h?.label??"Chart"})]}),_(Ya,{})]}),_("div",{class:"cf-analytics-chart-picker__menu",role:"listbox","aria-label":"Chart type",children:c.map(b=>{const x=b.type===f;return _("button",{type:"button",role:"option","aria-selected":x,class:x?"is-selected":"",onClick:()=>{l(b.type),i.current&&(i.current.open=!1)},children:[_("span",{class:"cf-analytics-chart-picker__icon",children:_(a1,{type:b.type})}),_("span",{class:"cf-analytics-chart-picker__copy",children:[_("strong",{children:b.label}),_("small",{children:F5(b.type)})]}),x?_(Xa,{}):null]},b.type)})})]}):null,e&&n?_("button",{type:"button",class:"cf-analytics-visualization__close","aria-label":"Restore assistant view",onClick:n,children:_(Qn,{})}):r&&t.expandable!==!1?_("button",{type:"button",class:"cf-analytics-visualization__expand","aria-label":"Expand chart","data-visualization-message":a,onClick:r,children:_(Tp,{})}):null]})]}),_(SR,{model:u,expanded:e}),t.downloadAvailable?_("button",{type:"button",class:"cf-analytics-visualization__download",onClick:()=>p1(p,d),children:"Download this data"}):null]}):v()},p1=(t,e)=>{if(typeof document>"u"||t.length===0)return;const r=kR(e,t),n=URL.createObjectURL(new Blob([r],{type:"text/csv;charset=utf-8"})),a=document.createElement("a");a.href=n,a.download="analytics-result.csv",a.click(),URL.revokeObjectURL(n)},v1=t=>new Promise((e,r)=>{const n=new FileReader;n.onload=()=>e(String(n.result).split(",")[1]??""),n.onerror=r,n.readAsDataURL(t)}),pE=({onPick:t})=>_("div",{class:"cf-picker cf-emoji",children:a5.map(e=>_("div",{class:"cf-emoji__group",children:[_("div",{class:"cf-emoji__label",children:e.name}),_("div",{class:"cf-emoji__grid",children:e.emojis.map((r,n)=>_("button",{type:"button",class:"cf-emoji__btn",onClick:()=>t(r),"aria-label":r,children:r},n))})]},e.name))}),vE=({onSearch:t,onPick:e})=>{const r=kr(),[n,a]=U(""),[i,o]=U([]),[s,l]=U(!0);return le(()=>{let c=!0;l(!0);const u=setTimeout(()=>{t(n).then(f=>c&&(o(f),l(!1))).catch(()=>c&&(o([]),l(!1)))},300);return()=>{c=!1,clearTimeout(u)}},[n,t]),_("div",{class:"cf-picker cf-gif",children:[_("input",{class:"cf-gif__search",placeholder:r.searchGifs,value:n,"aria-label":r.searchGifs,onInput:c=>a(c.target.value)}),_("div",{class:"cf-gif__grid",children:s?_("div",{class:"cf-gif__hint",children:r.searchingGifs}):i.length===0?_("div",{class:"cf-gif__hint",children:r.noGifs}):i.map(c=>_("button",{type:"button",class:"cf-gif__item",onClick:()=>e(c.url),"aria-label":c.alt,children:_("img",{src:c.preview,alt:c.alt,loading:"lazy"})},c.id))}),_("div",{class:"cf-gif__powered",children:"via Tenor"})]})},gE=5*1024*1024,Mp=5,mE="image/png,image/jpeg,image/webp,image/gif,application/pdf",yE=15e3,qi=t=>t==="listening"||t==="hearing",Ap=t=>{switch(t){case"connecting":return"Connecting with AI…";case"listening":return"Listening now — go ahead.";case"hearing":return"Hearing you…";case"unavailable":return"I can’t hear you — check your microphone.";case"speaking":return"AI is speaking — talk to interrupt.";case"processing":return"Working on it — keep talking to add more.";case"noise":return"I couldn't hear clear words. Try again closer to the mic.";case"misunderstood":return"I didn't understand that. Please try again.";case"denied":return"Microphone access is blocked. Allow the mic or type your question.";case"muted":return"Muted — tap the mic to unmute.";case"timeout":return"Didn't hear anything for a while — ending the call.";default:return""}},_E=.004,g1=({muted:t,listening:e,micLevel:r,onToggleMute:n})=>{const a=e&&r>=_E;return _("button",{type:"button",class:`cf-call-btn ${t?"is-muted":""} ${e?"is-listening":""} ${a?"is-hot":""}`,"aria-label":t?"Unmute microphone":"Mute microphone","aria-pressed":t,onClick:n,style:e?{"--cf-wave":String(Math.max(.2,Math.min(1,r*6)))}:void 0,children:t?_(d5,{}):_(ds,{})})},bE=({audioDevices:t,selectedAudioDeviceId:e,onSelectAudioDevice:r})=>{const[n,a]=U(!1),[i,o]=U(null),s=X(null);le(()=>{if(!n)return;const c=u=>{s.current&&!u.composedPath().includes(s.current)&&a(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]),Mu(()=>{if(!n){o(null);return}const c=s.current;if(!c)return;let u=new DOMRect(0,0,window.innerWidth,window.innerHeight);for(let g=c.parentElement;g;g=g.parentElement){const v=getComputedStyle(g);if(v.overflow!=="visible"||v.overflowY!=="visible"){u=g.getBoundingClientRect();break}}const f=c.getBoundingClientRect(),h=8,d=u.bottom-f.bottom-h*2,p=f.top-u.top-h*2,m=p>d;o({up:m,maxHeight:Math.max(72,Math.floor(m?p:d))})},[n]);const l=[{deviceId:"",label:"Default microphone"},...t];return _("div",{class:"cf-call-more",ref:s,children:[_("button",{type:"button",class:"cf-call-btn cf-call-btn--microphones","aria-label":"Choose microphone","aria-expanded":n,onClick:()=>a(c=>!c),children:_(Ya,{})}),n&&_("div",{class:`cf-call-menu${i?.up?" cf-call-menu--up":""}`,role:"menu",style:i?{maxHeight:`${i.maxHeight}px`}:{visibility:"hidden"},children:[_("div",{class:"cf-call-menu__label",children:"Microphone"}),l.map(c=>_("button",{type:"button",role:"menuitemradio","aria-checked":c.deviceId===e,class:`cf-call-menu__item ${c.deviceId===e?"is-active":""}`,onClick:()=>{r(c.deviceId),a(!1)},children:[c.deviceId===e?_(Xa,{}):_("span",{class:"cf-call-menu__spacer"}),_("span",{children:c.label})]},c.deviceId))]})]})},xE=({voiceState:t,muted:e,onToggleMute:r,onEndCall:n,onTalkNow:a,showTalkNow:i,micLevel:o,theaterMode:s,onToggleTheater:l,onMinimize:c,audioDevices:u,selectedAudioDeviceId:f,onSelectAudioDevice:h})=>_("div",{class:"cf-call-controls",children:[_(g1,{muted:e,listening:qi(t)&&!e,micLevel:o,onToggleMute:r}),_(bE,{audioDevices:u,selectedAudioDeviceId:f,onSelectAudioDevice:h}),i&&_("button",{type:"button",class:"cf-call-btn cf-call-btn--talk","aria-label":"Talk now",onClick:a,children:_(ds,{})}),_("button",{type:"button",class:"cf-call-btn","aria-label":s?"Exit expanded view":"Expand view","aria-pressed":s,onClick:l,children:s?_(C5,{}):_(Tp,{})}),_("button",{type:"button",class:"cf-call-btn","aria-label":"Minimize voice chat",onClick:c,children:_(M5,{})}),_("button",{type:"button",class:"cf-call-btn cf-call-btn--end","aria-label":"End voice chat",onClick:n,children:_(kp,{})})]}),wE=({persona:t,voiceState:e,muted:r,onToggleMute:n,onEndCall:a,micLevel:i,onExpand:o})=>{const s=h=>h.stopPropagation(),l=t?.assistantMediaUrl?.trim()||t?.agentAvatarUrl?.trim()||"",c=t?.assistantMediaKind==="video"&&!!l,u=t?.agentName||"Assistant",f=["cf-floating-call-card",qi(e)&&!r?"is-listening":"",e==="speaking"?"is-speaking":"",e==="processing"||e==="connecting"?"is-thinking":"",r?"is-muted":""].filter(Boolean).join(" ");return _("div",{class:f,style:qi(e)&&!r?{"--cf-listen":String(Math.max(.18,Math.min(1,i*8)))}:void 0,role:"button",tabIndex:0,"aria-label":`Reopen voice chat with ${u}`,onClick:o,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o())},children:[_("div",{class:"cf-floating-call-card__media","aria-hidden":"true",children:l?c?_("video",{src:l,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):_("img",{src:l,alt:""}):_("div",{class:`cf-floating-call-card__avatar${ps(t)}`,children:[_("span",{children:tu(t)}),_("span",{class:"cf-floating-call-card__eye cf-floating-call-card__eye--left"}),_("span",{class:"cf-floating-call-card__eye cf-floating-call-card__eye--right"}),_("span",{class:"cf-floating-call-card__mouth"})]})}),_("div",{class:"cf-floating-call-card__shade","aria-hidden":"true"}),_("span",{class:"cf-floating-call-card__status",role:"status","aria-live":"polite",children:Ap(e)}),_("div",{class:"cf-floating-call-card__controls",onClick:s,onKeyDown:s,role:"presentation",children:[_(g1,{muted:r,listening:qi(e)&&!r,micLevel:i,onToggleMute:n}),_("button",{type:"button",class:"cf-call-btn cf-call-btn--restore","aria-label":"Restore voice chat",onClick:h=>{s(h),o()},children:_(A5,{})}),_("button",{type:"button",class:"cf-call-btn cf-call-btn--end","aria-label":"End voice chat",onClick:h=>{s(h),a()},children:_(kp,{})})]})]})},SE=(t,e)=>{switch(t){case"connecting":return e.voiceConnecting;case"listening":return e.voiceListening;case"hearing":return e.voiceHearing;case"unavailable":return e.voiceUnavailable;case"processing":return e.voiceProcessing;case"speaking":return e.voiceSpeaking;case"noise":return e.voiceNoise;case"misunderstood":return e.voiceMisunderstood;case"denied":return e.voiceDenied;default:return Ap(t)}},kE=({draftStore:t,onSend:e,onSendGif:r,onTyping:n,disabled:a,allowVoice:i,onTranscribe:o,gifEnabled:s,onSearchGifs:l,allowAttach:c,analyzeAttachments:u=!0,onUpload:f,voiceStartSignal:h=0,onVoiceStateChange:d,onPreviewAttachment:p})=>{const m=kr(),[g,v]=U(()=>t.value),y=F=>{const ue=typeof F=="function"?F(g):F;t.value=ue,v(ue)},[b,x]=U(!1),[w,S]=U(!1),[k,C]=U("idle"),[A,M]=U("none"),[T,D]=U([]),L=X([]);L.current=T;const R=X(0),[O,B]=U(!1),[j,P]=U(!1),[V,H]=U(""),Z=X(null),re=X(null),Te=X(null),ge=X(0),xe=X(null),Ce=X(void 0),be=F=>{C(F),d?.(F)},it=()=>{Ce.current&&window.clearTimeout(Ce.current),Ce.current=void 0};le(()=>{const F=Z.current;F&&(F.style.height="auto",F.style.height=`${Math.min(F.scrollHeight,110)}px`)},[g]),le(()=>()=>{for(const F of L.current)F.previewUrl&&URL.revokeObjectURL(F.previewUrl)},[]);const Qe=F=>{D(ue=>{const De=ue.find(we=>we.key===F);return De?.previewUrl&&URL.revokeObjectURL(De.previewUrl),ue.filter(we=>we.key!==F)})},ze=()=>D([]);le(()=>{if(A==="none")return;const F=ue=>{re.current&&!ue.composedPath().includes(re.current)&&M("none")};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[A]);const oe=F=>M(ue=>ue===F?"none":F),pe=F=>{const ue=Z.current;if(!ue){y(rt=>rt+F);return}const De=ue.selectionStart??g.length,we=ue.selectionEnd??g.length;y(g.slice(0,De)+F+g.slice(we)),requestAnimationFrame(()=>{ue.focus();const rt=De+F.length;ue.setSelectionRange(rt,rt)})},ot=F=>{M("none"),r(F)},Xe=async F=>{if(F.length===0)return;H("");const ue=Mp-L.current.length-R.current;if(ue<=0){H(ct(m.attachLimit,{count:String(Mp)}));return}const De=F.slice(0,ue);for(const we of De){R.current+=1;try{await kt(we)}finally{R.current-=1}}F.length>De.length&&H(ct(m.attachLimit,{count:String(Mp)}))},kt=async F=>{const ue=++ge.current;if(F.size>gE){H(m.attachTooLarge);return}if(!f){H(m.attachFailed);return}B(!0);try{const De=await v1(F),we=await f(De,F.type||"application/octet-stream",F.name,u);if(ue!==ge.current)return;const rt={key:`${we.id||F.name}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,id:we.id,analysisFailed:we.analysisFailed,name:F.name,text:we.text,mimeType:F.type||"application/octet-stream",size:F.size,previewUrl:F.type.startsWith("image/")?URL.createObjectURL(F):void 0,file:F};D(vt=>[...vt,rt])}catch(De){De instanceof Qi&&De.status===413?H(m.attachTooLarge):De instanceof Qi&&[400,415,503].includes(De.status)?H(De.message):H(m.attachFailed)}finally{ue===ge.current&&B(!1)}},tt=async F=>{const ue=F.target,De=Array.from(ue.files??[]);ue.value="",await Xe(De)},lr=()=>{ge.current+=1,B(!1),H("")},Cr=(!!g.trim()||T.length>0)&&!a&&!O&&!w,Tt=()=>{Cr&&(e(g,T.length>0?{attachments:T.map(F=>({id:F.id,name:F.name,text:F.text,file:F.file}))}:void 0),n?.(!1),y(""),ze(),H(""))},Pt=F=>{const ue=F.trim();if(!ue||a){be("misunderstood");return}const De=g.trim(),we=De?`${De} ${ue}`:ue;e(we),n?.(!1),y(""),ze(),H(""),be("idle")},Bt=F=>{if(F.key==="Enter"&&!F.shiftKey){if(a)return;F.preventDefault(),Tt()}else F.key==="Escape"&&A!=="none"&&(F.preventDefault(),F.stopPropagation(),M("none"))},xt=()=>{it(),xe.current?.stop("dictation-ended"),xe.current=null,x(!1),S(!1)},tn=async()=>{const F=xe.current;if(F){const{mic:we,processing:rt}=F.snapshot;we==="hearing"||rt?F.finishTurn():(xt(),be("idle"));return}const ue=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||void 0;be("connecting");const De=new Kx({transcribe:async({audio:we,mimeType:rt,durationSeconds:vt})=>o(await v1(we),rt,ue,vt),listener:{state:({mic:we,processing:rt,reason:vt})=>{if(xe.current===De){if(we==="unavailable"){if(vt==="permission-denied"||vt==="unsupported"||vt==="no-device"||vt==="error"){xt(),be("denied");return}be("unavailable");return}x(we==="listening"||we==="hearing"),S(rt),we==="starting"?be("connecting"):rt&&we!=="hearing"?be("processing"):we==="hearing"?be("hearing"):we==="listening"&&be("listening")}},speechStart:()=>it(),turn:we=>{xe.current===De&&(xt(),Pt(we.text))},noise:we=>{xe.current===De&&(xt(),be(we.reason==="transcribe-failed"?"misunderstood":"noise"))}}});xe.current=De,Ce.current=window.setTimeout(()=>{xe.current===De&&(xt(),be("noise"))},yE),await De.start()};return le(()=>{!h||!i||a||b||w||tn()},[h]),le(()=>()=>{it(),xe.current?.stop("unmounted"),xe.current=null},[]),_("div",{class:`cf-composer ${j?"is-dragging":""}`,ref:re,onDragEnter:F=>{c&&(F.preventDefault(),P(!0))},onDragOver:F=>{c&&F.preventDefault()},onDragLeave:F=>{F.currentTarget===F.target&&P(!1)},onDrop:F=>{c&&(F.preventDefault(),P(!1),Xe(Array.from(F.dataTransfer?.files??[])))},children:[A==="emoji"&&_(pE,{onPick:pe}),A==="gif"&&_(vE,{onSearch:l,onPick:ot}),(T.length>0||O||V)&&_("div",{class:"cf-attach-row",role:"list","aria-label":m.attachedFiles,children:[T.map(F=>_("span",{class:"cf-attach-chip",role:"listitem",title:F.name,children:[_("button",{type:"button",class:"cf-attach-open","aria-label":ct(m.attachOpen,{name:F.name}),disabled:!p,onClick:()=>p?.(F.file,F.name),children:[F.previewUrl?_("img",{class:"cf-attach-preview",src:F.previewUrl,alt:""}):_(eu,{}),_("span",{class:"cf-attach-copy",children:[_("span",{children:F.name}),_("small",{children:F.analysisFailed?m.attachAnalysisFailed:`${Math.max(1,Math.ceil(F.size/1024))} KB`})]})]}),_("button",{type:"button",class:"cf-attach-x","aria-label":ct(m.removeAttachmentNamed,{name:F.name}),onClick:()=>Qe(F.key),children:_(Qn,{})})]},F.key)),O&&_("span",{class:"cf-attach-status",children:[_("span",{children:m.attaching}),_("button",{type:"button",onClick:lr,children:m.cancel})]}),V&&!O&&_("span",{class:"cf-attach-status cf-attach-status--err",children:V})]}),k!=="idle"&&_("div",{class:"cf-voice-state","aria-live":"polite",children:[_("span",{class:`cf-voice-state__dot ${b?"is-live":""}`}),SE(k,m)]}),_("div",{class:"cf-composer__field",children:[_("button",{type:"button",class:`cf-iconbtn ${A==="emoji"?"is-active":""}`,"aria-label":m.emoji,"aria-pressed":A==="emoji",onClick:()=>oe("emoji"),children:A==="emoji"?_(Qn,{}):_(_5,{})}),s&&_("button",{type:"button",class:`cf-iconbtn cf-gifbtn ${A==="gif"?"is-active":""}`,"aria-label":m.gifs,"aria-pressed":A==="gif",onClick:()=>oe("gif"),children:_("span",{class:"cf-gif-label",children:"GIF"})}),c&&_(Me,{children:[_("input",{ref:Te,type:"file",class:"cf-file-input",accept:mE,multiple:!0,onChange:tt,tabIndex:-1,"aria-hidden":"true"}),_("button",{type:"button",class:"cf-iconbtn","aria-label":m.attachFile,disabled:O,onClick:()=>Te.current?.click(),children:_(eu,{})})]}),_("textarea",{ref:Z,class:"cf-textarea",rows:1,placeholder:m.composerPlaceholder,value:g,"aria-label":m.composerPlaceholder,"aria-busy":a,onInput:F=>{const ue=F.target.value;y(ue),n?.(!!ue.trim())},onPaste:F=>{const ue=Array.from(F.clipboardData?.files??[]);!c||ue.length===0||(F.preventDefault(),Xe(ue))},onKeyDown:Bt}),i&&_("button",{type:"button",class:`cf-iconbtn cf-mic ${b?"is-recording":""}`,"aria-label":b?m.stopRecording:m.recordVoice,"aria-pressed":b,disabled:w||a,onClick:tn,children:_(ds,{})}),_("button",{type:"button",class:"cf-send","aria-label":m.send,disabled:!Cr,onClick:Tt,children:_(f5,{})})]})]})},TE=t=>t.replace(/\[[^\]]{0,60}\]/g," ").replace(/\(([^)]{0,60})\)/g,(e,r)=>m1.has(r.trim().toLowerCase().replace(/[.!?,…]+$/,"").replace(/\s+/g," "))?" ":e).replace(/\*[^*]{0,60}\*/g," ").replace(/\s+/g," ").trim(),m1=new Set(["background noise","engine noise","noise","inaudible","unintelligible","silence","no speech","static","music","laughter","applause","wind","breathing","click","clicks","clicking","mouse click","mouse clicks","beep","beeps","beeping","tap","taps","tapping","typing","keyboard typing","cough","coughing","sigh","hmm","mm","mmm","uh","um","ah","oh"]),CE=/^\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?(?:\s*(?:-|–|—|to|-->)\s*\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?)?$/,ME=t=>{const e=t.trim().toLowerCase().replace(/[()[\]*]/g," ").replace(/[.!?,…]+$/,"").replace(/\s+/g," ").trim();return!e||/^(?:sh+\s*)+$/.test(e)||CE.test(e)?!0:m1.has(e)},AE=t=>{const e=t.trim().toLowerCase().replace(/\s+/g," ");return e?/^(?:transcribe|transcription|transcribed text)[.!:]*$/.test(e)?!0:e.includes("transcribe this audio recording verbatim")||e.includes("preserve the spoken language and any code-switching")||e.includes("output only the transcribed text, no commentary"):!1};let y1=!0,vs=null;const DE=t=>{y1=t},IE=()=>{const t=typeof window<"u"?window.AudioContext??window.webkitAudioContext:void 0;if(!t)return null;if(!vs)try{vs=new t}catch{return null}return vs.state==="suspended"&&vs.resume(),vs},gs=(t,e,r,n,a,i)=>{const o=t.createOscillator(),s=t.createGain();o.type=a,o.frequency.setValueAtTime(e,r),o.connect(s),s.connect(t.destination),s.gain.setValueAtTime(1e-4,r),s.gain.exponentialRampToValueAtTime(i,r+.012),s.gain.exponentialRampToValueAtTime(1e-4,r+n),o.start(r),o.stop(r+n+.03)},Yi=t=>{if(!y1)return;const e=IE();if(!e)return;const r=e.currentTime;try{t==="open"?(gs(e,523,r,.12,"sine",.05),gs(e,784,r+.08,.16,"sine",.05)):t==="send"?gs(e,660,r,.08,"triangle",.04):t==="receive"&&(gs(e,880,r,.1,"sine",.045),gs(e,1175,r+.09,.14,"sine",.045))}catch{}},LE=t=>t.startsWith("image/")?"image":t==="application/pdf"?"pdf":"other",PE=({state:t,onClose:e})=>{const r=kr(),n=X(null);le(()=>{n.current?.focus();const i=o=>{o.key==="Escape"&&(o.stopPropagation(),e())};return document.addEventListener("keydown",i,!0),()=>document.removeEventListener("keydown",i,!0)},[e]);const a=t.status==="ready"?LE(t.mimeType):"other";return _("div",{class:"cf-preview",role:"dialog","aria-modal":"true","aria-label":ct(r.attachPreviewTitle,{name:t.name}),onClick:i=>{i.target===i.currentTarget&&e()},children:_("div",{class:"cf-preview__frame",children:[_("div",{class:"cf-preview__bar",children:[_("span",{class:"cf-preview__name",title:t.name,children:t.name}),t.status==="ready"&&_("a",{class:"cf-preview__btn",href:t.url,download:t.name,children:r.attachDownload}),_("button",{ref:n,type:"button",class:"cf-preview__btn cf-preview__close","aria-label":r.attachPreviewClose,onClick:e,children:"✕"})]}),_("div",{class:"cf-preview__body",children:[t.status==="loading"&&_("p",{class:"cf-preview__note",children:r.attachPreviewLoading}),t.status==="error"&&_("p",{class:"cf-preview__note",children:r.attachPreviewFailed}),t.status==="ready"&&a==="image"&&_("img",{class:"cf-preview__image",src:t.url,alt:t.name}),t.status==="ready"&&a==="pdf"&&_("iframe",{class:"cf-preview__pdf",src:t.url,title:t.name}),t.status==="ready"&&a==="other"&&_("p",{class:"cf-preview__note",children:r.attachPreviewUnsupported})]})]})})},RE=t=>new Promise((e,r)=>{const n=new FileReader;n.onload=()=>e(String(n.result??"").split(",")[1]??""),n.onerror=()=>r(n.error),n.readAsDataURL(t)}),EE=(t,e)=>t?.status===429?e.errorRateLimit:e.errorGeneric,Dp=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),nu=(t,e)=>{const r=Dp(),n={stage:t,durationMs:Math.max(0,r-e)};try{performance.measure(`centrinfo-widget:${t}`,{start:e,end:r})}catch{}return typeof window<"u"&&typeof CustomEvent<"u"&&window.dispatchEvent(new CustomEvent("centrinfo:performance",{detail:n})),n},OE=/!?\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,NE=/https?:\/\/[^\s)]+/g,BE=t=>t.replace(/```[\s\S]*?```/g,e=>e.replace(/^```[^\n]*\n?/,"").replace(/```$/,"").trim()),zE=t=>BE(t).replace(OE,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/(^|[\s([{])\*([^*\n]{1,120})\*(?=[\s.,;:!?)}\]]|$)/g,"$1$2").replace(/(^|[\s([{])_([^_\n]{1,120})_(?=[\s.,;:!?)}\]]|$)/g,"$1$2").replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}[-*+]\s+/gm,"").replace(/^\s{0,3}\d+\.\s+/gm,"").replace(/\s+\*/g," ").replace(/\*\s+/g," ").replace(/[*_]{2,}/g,"").replace(NE,e=>e.replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/\/$/,"")).replace(/[ \t]+\n/g,`
166
+ `),n=[];let a=0,i=0;for(;i<t.length;){const o=t[i];if(o.trim().startsWith("```")){const d=[];for(i++;i<t.length&&!t[i].trim().startsWith("```");)d.push(t[i]),i++;i++,n.push(r("pre",{class:"cf-md-pre",children:r("code",{children:d.join(`
167
+ `)})},a++));continue}if(o.trim()===""){i++;continue}const s=/^(#{1,6})\s+(.*)$/.exec(o);if(s){n.push(vd(s[1].length,hn(s[2]),a++)),i++;continue}if(/^\s*[-*•]\s+/.test(o)){const d=[];for(;i<t.length&&/^\s*[-*•]\s+/.test(t[i]);)d.push(r("li",{children:hn(t[i].replace(/^\s*[-*•]\s+/,""))},d.length)),i++;n.push(r("ul",{class:"cf-md-list",children:d},a++));continue}if(/^\s*\d+\.\s+/.test(o)){const d=[];for(;i<t.length&&/^\s*\d+\.\s+/.test(t[i]);)d.push(r("li",{children:hn(t[i].replace(/^\s*\d+\.\s+/,""))},d.length)),i++;n.push(r("ol",{class:"cf-md-list",children:d},a++));continue}const c=[o];for(i++;i<t.length&&t[i].trim()!==""&&!bd.test(t[i]);)c.push(t[i]),i++;const u=c.join(" ");if(/:\s*$/.test(u)&&i<t.length&&/^(?:\s*[-*•]\s+|\s*\d+\.\s+)/.test(t[i])){const d=/^(.*[.!?])\s+([^.!?]{2,120}:)$/.exec(u);d&&n.push(r("p",{children:hn(d[1])},a++)),n.push(r("p",{class:"cf-md-list-intro",children:hn(d?.[2]??u)},a++))}else n.push(r("p",{children:hn(u)},a++))}return n},va=e=>ml(e),lo=()=>{const e=R(null);return J(()=>{const t=requestAnimationFrame(()=>e.current?.scrollIntoView?.({block:"end"}));return()=>cancelAnimationFrame(t)},[]),e},yd=e=>e.trim().split(/\s+/).slice(0,2).map(t=>t[0]?.toUpperCase()??"").join("")||"🤖",On=e=>{const t=e?.avatarId?.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-");return t?` cf-avatar-preset--${t}`:""},_d={"support-guide":"SG","sales-host":"SH","calm-advisor":"CA","technical-guide":"TG","school-desk":"SD","front-office":"FO"},xa=e=>{const t=e?.avatarId?.trim().toLowerCase();return t&&_d[t]||(e?yd(e.agentName):"·")},uo=({persona:e,small:t,hideWhenMissing:n})=>{const a=t?"cf-msg__avatar":"cf-header__avatar",i=e?.agentAvatarUrl?.trim();return i?r("span",{class:a,children:r("img",{src:i,alt:""})}):n?null:r("span",{class:`${a}${On(e)}`,children:xa(e)})},wd=()=>{const e=ot(),[t,n]=S(0),a=["Understanding your question","Checking approved information","Preparing your answer"];return J(()=>{const i=[window.setTimeout(()=>n(1),1800),window.setTimeout(()=>n(2),5e3)];return()=>i.forEach(o=>window.clearTimeout(o))},[]),r("div",{class:"cf-msg__bubble cf-typing","aria-label":e.assistantTyping,children:[r("span",{class:"cf-typing__label","aria-live":"polite",children:a[t]}),r("span",{class:"cf-typing__dot"}),r("span",{class:"cf-typing__dot"}),r("span",{class:"cf-typing__dot"})]})},kd=3,Sd=({msg:e})=>{if(!e.sources||e.sources.length===0)return null;const t=new Set,n=[];for(const o of e.sources){const s=(o.url||o.title||"").toLowerCase();!s||t.has(s)||o.url&&e.content.includes(o.url)||(t.add(s),n.push(o))}if(n.length===0)return null;const a=n.slice(0,kd),i=n.length-a.length;return r("div",{class:"cf-sources",children:[a.map((o,s)=>o.url?r("a",{class:"cf-source",href:o.url,target:"_blank",rel:"noopener noreferrer nofollow",title:o.title||o.url,children:[r(Dn,{}),r("span",{children:o.title||o.url})]},s):r("span",{class:"cf-source",title:o.title,children:[r(Dn,{}),r("span",{children:o.title})]},s)),i>0&&r("span",{class:"cf-source cf-source--more",children:["+",i," more"]})]})},$d=({replies:e,onPick:t})=>e&&e.length>0?r("div",{class:"cf-chips",children:e.map((n,a)=>r("button",{type:"button",class:"cf-chip",onClick:()=>t(n),children:n},a))}):null,Td=({persona:e,starters:t,onPick:n,onFocusComposer:a,speaking:i,voiceState:o="idle",replyPending:s=!1,pinned:c=!1,muted:u=!1,onToggleMute:l,onEndCall:d,onTalkNow:p,showTalkNow:g=!1,micLevel:f=0,theaterMode:y=!1,onToggleTheater:h,onMinimize:I,audioDevices:x=[],selectedAudioDeviceId:m="",onSelectAudioDevice:T,connectingOnly:F=!1})=>{if(!e)return null;const M=!!(e.allowVoiceInput&&e.talkbackMode&&e.talkbackMode!=="text");if(!(M||e.widgetModule==="assistant"))return null;const Y=e.agentAvatarUrl?.trim()||"",X=e.assistantMediaUrl?.trim()||Y,j=e.assistantMediaKind==="video"&&!!X,U=t.slice(0,3),D=o!=="idle",q=o!=="idle"?"End voice chat":`Speak with ${e.agentName}`,C=c&&M&&!D&&!i,Z=o==="connecting"||o==="processing"||D&&s,_=["cf-assistant-card__stage","cf-assistant-card__stage--local",D?"is-live":"",Z?"is-thinking":"",mn(o)&&!u?"is-listening":"",i||o==="speaking"?"is-speaking":"",u?"is-muted":""].filter(Boolean).join(" "),L=mn(o)&&!u?{"--cf-listen":String(Math.max(.18,Math.min(1,f*8)))}:void 0,$=Z&&r("span",{class:"cf-call-ripple","aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{})]});if(F)return r("div",{class:"cf-assistant-card cf-assistant-card--connecting","aria-live":"polite",children:[r("div",{class:"cf-assistant-card__connecting-avatar",children:[Y?r("img",{src:Y,alt:""}):r("span",{class:`cf-assistant-card__connecting-face${On(e)}`,children:xa(e)}),$]}),r("div",{class:"cf-assistant-card__connecting-copy",children:[r("span",{class:"cf-assistant-card__connecting-eyebrow",children:e.agentName}),r("strong",{children:"Connecting with the AI…"})]})]});const P=D&&d&&r(tu,{voiceState:o,muted:u,onToggleMute:l??(()=>{}),onEndCall:d,onTalkNow:p??(()=>{}),showTalkNow:g,micLevel:f,theaterMode:y,onToggleTheater:h??(()=>{}),onMinimize:I??(()=>{}),audioDevices:x,selectedAudioDeviceId:m,onSelectAudioDevice:T??(()=>{})});return C?r("div",{class:"cf-assistant-card cf-assistant-card--pinned cf-assistant-card--compact",children:r("button",{type:"button",class:"cf-assistant-card__compact-speak",onClick:a,children:[Y?r("span",{class:"cf-assistant-card__compact-avatar",children:r("img",{src:Y,alt:""})}):null,r("span",{class:"cf-assistant-card__compact-mic","aria-hidden":"true",children:r(Ln,{})}),r("span",{class:"cf-assistant-card__compact-label",children:q})]})}):r("div",{class:`cf-assistant-card ${c?"cf-assistant-card--pinned":""} ${i?"is-speaking":""}`,children:[(X||M)&&r("div",{class:_,style:L,children:[r("div",{class:`cf-assistant-card__media ${X?"cf-assistant-card__media--uploaded":"cf-assistant-card__media--generated"}${On(e)}`,children:[j?r("video",{src:X,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):X?r("img",{src:X,alt:""}):r("div",{class:`cf-assistant-card__avatar-stage${On(e)}`,children:r("div",{class:"cf-assistant-card__face",children:[r("span",{class:"cf-assistant-card__initials",children:xa(e)}),r("span",{class:"cf-assistant-card__eye cf-assistant-card__eye--left"}),r("span",{class:"cf-assistant-card__eye cf-assistant-card__eye--right"}),r("span",{class:"cf-assistant-card__mouth"})]})}),X&&!j&&r("span",{class:"cf-assistant-card__mouth cf-assistant-card__mouth--overlay"}),r("span",{class:"cf-avatar-aura cf-avatar-aura--one","aria-hidden":"true"}),r("span",{class:"cf-avatar-aura cf-avatar-aura--two","aria-hidden":"true"}),r("span",{class:"cf-avatar-listen-ring","aria-hidden":"true"}),r("span",{class:"cf-avatar-wave","aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{}),r("span",{})]})]}),$,D&&r("span",{class:"cf-call-status",role:"status","aria-live":"polite",children:xr(o)}),M&&(P||r("button",{type:"button",class:"cf-assistant-card__speak",onClick:a,children:[r(Ln,{}),q]}))]}),!c&&r(ce,{children:[e.agentDescription?r("p",{class:"cf-assistant-card__copy",children:e.agentDescription}):r("p",{class:"cf-assistant-card__copy",children:e.greeting}),U.length>0&&r("div",{class:"cf-assistant-card__chips",children:U.map(fe=>r("button",{type:"button",class:"cf-assistant-card__chip",onClick:()=>n(fe),children:fe},fe))}),e.disclaimerText||e.assistantPrivacyUrl?r("p",{class:"cf-assistant-card__privacy",children:[e.disclaimerText||"This chat may be recorded for quality and support.",e.assistantPrivacyUrl?r(ce,{children:[" ",r("a",{href:e.assistantPrivacyUrl,target:"_blank",rel:"noopener noreferrer nofollow",children:"Privacy Policy"})]}):null]}):null]})]})},Cd={calendar:Xl,"calendar-clock":nd,headset:io,mail:gr,message:ed,newsletter:ad,phone:Ql,presentation:td,lifebuoy:io},Ad=e=>Cd[e]??gr,Md=e=>{if(e.id==="public_contact_support")return"contact-support";switch(e.endpoint){case"book-demo":return"book-demo";case"request-callback":return"request-callback";case"schedule-callback":return"schedule-callback";case"subscribe-newsletter":return"subscribe-newsletter";case"contact":return"contact";default:return"inquiry"}},Id={public_contact_support:{label:"Contact support",description:"Send your request to the support team.",category:"support",icon:"headset",endpoint:"inquiry"},public_submit_inquiry:{label:"Leave a message",description:"Send your question and contact details.",category:"support",icon:"message",endpoint:"inquiry"},public_book_demo:{label:"Book a demo",description:"Request a demo from the team.",category:"sales",icon:"presentation",endpoint:"book-demo"},public_request_callback:{label:"Request a callback",description:"Ask the next available sales teammate to call you.",category:"sales",icon:"phone",endpoint:"request-callback"},public_schedule_callback:{label:"Schedule a callback",description:"Choose an available date and time for a call.",category:"sales",icon:"calendar-clock",endpoint:"schedule-callback"},public_subscribe_newsletter:{label:"Subscribe",description:"Get product updates.",category:"marketing",icon:"newsletter",endpoint:"subscribe-newsletter"}},Ed=(e,t,n={})=>Array.isArray(e)?e.filter(a=>a.readiness!=="unavailable").map(a=>po(a,n[a.id])):(t??[]).flatMap(a=>{const i=Id[a];if(!i)return[];const o=Md({...i,id:a}),s=ga[o];return[{...i,id:a,presentation:o==="book-demo"||o==="schedule-callback"?"booking":"form",formTitle:s.title,submitLabel:s.submit,fields:s.fields,delivery:"",prompt:"",shortLabel:i.label.toLowerCase(),enabled:!0,readiness:"available",legacyFallback:!0}]}).map(a=>po(a,n[a.id])),po=(e,t)=>{if(!t)return e;const n=t.fields??{};return{...e,...Object.fromEntries(Object.entries(t).filter(([a,i])=>a!=="fields"&&i!==void 0)),fields:e.fields.map(a=>({...a,...n[a.key]}))}},zd=(e,t)=>{const n=e.map(a=>a.label);return n.length===0?t.actionGetInTouch:n.length<=3?n.join(", "):`${n.slice(0,2).join(", ")} ${Ve(t.actionMore,{count:String(n.length-2)})}`},fo=({label:e,required:t,value:n,onInput:a})=>{const i=qe(()=>Gl(n),[]),[o,s]=S(i.country.iso),[c,u]=S(i.national),[l,d]=S(!1),[p,g]=S(""),f=R(null),y=en.find(x=>x.iso===o)??i.country,h=qe(()=>{const x=p.trim().toLowerCase().replace(/^\+/,"");return x?en.filter(m=>m.name.toLowerCase().includes(x)||m.iso.toLowerCase().includes(x)||m.dial.includes(x)):en},[p]);J(()=>{if(!l)return;const x=T=>{f.current&&!T.composedPath().includes(f.current)&&d(!1)},m=T=>{T.key==="Escape"&&d(!1)};return document.addEventListener("pointerdown",x),document.addEventListener("keydown",m),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",m)}},[l]);const I=x=>{const m=en.find(T=>T.iso===x)??y;s(m.iso),d(!1),g(""),a(ro(m,c))};return r("div",{class:"cf-phone",role:"group","aria-label":`${e}${t?" *":""}`,ref:f,children:[r("span",{class:"cf-phone__label",children:[e,t?" *":""]}),r("div",{class:"cf-phone__control",children:[r("button",{type:"button",class:"cf-phone__country","aria-label":`${y.name}, +${y.dial}. Choose country and calling code`,"aria-haspopup":"listbox","aria-expanded":l,onClick:()=>d(x=>!x),children:[r("span",{"aria-hidden":"true",children:ao(y.iso)}),r("span",{class:"cf-phone__country-code",children:["+",y.dial]}),r(pn,{})]}),r("input",{class:"cf-phone__input",type:"tel",inputMode:"numeric",pattern:"[0-9]*",autoComplete:"tel-national",maxLength:15,placeholder:"8028509941",value:c,"aria-label":e,onInput:x=>{const m=x.target,T=m.value.replace(/\D/g,"");m.value=T,u(T),a(ro(y,T))}})]}),l?r("div",{class:"cf-phone__menu",children:[r("input",{class:"cf-phone__search",type:"search",placeholder:"Search country or code","aria-label":"Search countries",value:p,autoFocus:!0,onInput:x=>g(x.target.value)}),r("div",{class:"cf-phone__options",role:"listbox","aria-label":"Countries",children:h.length>0?h.map(x=>r("button",{type:"button",class:`cf-phone__option ${x.iso===y.iso?"is-selected":""}`,role:"option","aria-selected":x.iso===y.iso,onClick:()=>I(x.iso),children:[r("span",{"aria-hidden":"true",children:ao(x.iso)}),r("span",{class:"cf-phone__option-name",children:x.name}),r("span",{class:"cf-phone__option-code",children:["+",x.dial]})]},x.iso)):r("div",{class:"cf-phone__empty",children:"No countries found"})})]}):null]})},Nd=({field:e,value:t,onInput:n})=>{if(e.kind==="tel")return r(fo,{label:e.label,required:e.required,value:t,onInput:n});const a=e.placeholder??e.label,i={class:"cf-form__input",placeholder:e.required?`${a} *`:a,value:t,"aria-label":e.label,onInput:o=>n(o.target.value)};return e.kind==="textarea"?r("textarea",{rows:2,...i}):r("input",{type:e.kind,...i})},Rd=({spec:e,visitor:t,onSubmit:n,onCancel:a})=>{const i=ot(),o=lo(),[s,c]=S(()=>{const x={};for(const m of e.fields)m.identity&&t[m.identity]&&(x[m.key]=t[m.identity]);return x}),[u,l]=S("idle"),[d,p]=S(""),g=x=>!!(x.identity&&t[x.identity]?.trim()),f=e.fields.filter(x=>!g(x)),y=f.every(x=>!x.required||(s[x.key]?.trim()??"")!==""),h=t.email||t.name||"",I=async()=>{if(!y||u==="submitting")return;l("submitting");const x={},m={};for(const T of e.fields){const F=s[T.key]?.trim();F&&(x[T.key]=F,T.identity&&(m[T.identity]=F))}try{const T=await n(x,m);p(Rn(T.note||i.formThanks,T.caseReference,i)),l("done")}catch{l("error")}};return u==="done"?r("div",{class:"cf-form cf-form--done",children:[r(fn,{}),r("span",{children:d})]}):r("div",{class:"cf-form",ref:o,children:[f.length===0&&h&&r("div",{class:"cf-form__as",children:Ve(i.actionAs,{identity:h})}),f.map(x=>r(Nd,{field:x,value:s[x.key]??"",onInput:m=>c(T=>({...T,[x.key]:m}))},x.key)),u==="error"&&r("div",{class:"cf-form__err",children:i.formError}),r("div",{class:"cf-form__actions",children:[a&&r("button",{type:"button",class:"cf-form__cancel",onClick:a,children:i.cancel}),r("button",{type:"button",class:"cf-form__submit",disabled:!y||u==="submitting",onClick:I,children:u==="submitting"?i.sending:e.submit})]})]})},ho=e=>String(e).padStart(2,"0"),Ld=()=>{const e=[];for(let t=9;t<=17;t++)e.push(`${ho(t)}:00`),e.push(`${ho(t)}:30`);return e},Dd=e=>{const t=new Date;return t.setHours(0,0,0,0),Array.from({length:e},(n,a)=>{const i=new Date(t);return i.setDate(t.getDate()+a),i})},Pd=(e,t)=>{const[n,a]=t.split(":").map(Number),i=new Date(e.getFullYear(),e.getMonth(),e.getDate(),n??0,a??0);try{return new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"}).format(i)}catch{return`${e.toDateString()} ${t}`}},zt=(e,t)=>{const[n,a]=t.split(":").map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate(),n??0,a??0)},Od=(e,t)=>{const n=zt(e,t);try{return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(n)}catch{return t}},ya=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}},mo=(e,t)=>{try{const n=new URL(e);return n.searchParams.set("embed_type","Inline"),globalThis.location?.hostname&&n.searchParams.set("embed_domain",globalThis.location.hostname),t.name?.trim()&&n.searchParams.set("name",t.name.trim()),t.email?.trim()&&n.searchParams.set("email",t.email.trim()),n.toString()}catch{return e}},Fd=(e,t)=>{if(!t?.contentWindow||e.source!==t.contentWindow)return!1;try{const n=new URL(e.origin).hostname;if(n!=="calendly.com"&&!n.endsWith(".calendly.com"))return!1}catch{return!1}return!!(e.data&&typeof e.data=="object"&&typeof e.data.event=="string")},Ud=({actionId:e,fields:t=ga["book-demo"].fields,visitor:n,onSubmit:a,onCancel:i,onDemoSlots:o,onConfirmHostedBooking:s,scheduler:c,title:u,submitLabel:l})=>{const d=e==="public_schedule_callback",p=d?ga["schedule-callback"]:ga["book-demo"],g=u?.trim()||p.title,f=ot(),y=lo(),h=!!(!d&&c?.connected&&c.provider==="calendly"),I=h?f.bookingOpenScheduler:l?.trim()||p.submit,x=!!(c?.connected&&c.mode==="event"&&!h&&(c.availability===void 0||c.availability.calendarIds.length>0)),m=Math.min(60,Math.max(1,c?.availability?.bookingWindowDays??14)),T=qe(()=>Dd(m),[m]),[F,M]=S(null),[Q,Y]=S(x?"loading":"request_only"),[X,j]=S(c?.availability?.slotDurationMinutes??30),[U,D]=S(ya()||c?.availability?.timezone||""),q=qe(()=>x?Q!=="available"||F===null?[]:[...new Set([...F].map(ee=>{const pe=new Date(ee);return`${String(pe.getHours()).padStart(2,"0")}:${String(pe.getMinutes()).padStart(2,"0")}`}))].sort():Ld(),[F,Q,x]),C=qe(()=>{const ee=Date.now();for(let pe=0;pe<T.length;pe++)if(q.some($e=>zt(T[pe],$e).getTime()>ee))return pe;return 0},[T,q]),[Z,_]=S(C),[L,$]=S(null),[P,fe]=S(n.name??""),[oe,Ue]=S(n.email??""),[ke,Ce]=S(n.phone??""),[Le,Ie]=S(""),[Ae,ge]=S("idle"),[Ze,be]=S(""),[ie,Je]=S(!1),[He,k]=S(""),[K,V]=S("scheduler"),[H,ae]=S(null),[ye,Se]=S("idle"),[Qe,Ge]=S(""),[tt,nt]=S(""),[A,he]=S(""),de=R(null),me=async(ee,pe,$e)=>{Se("loading");try{const ue=await s?.(ee,pe,$e),ve=ue?.meetingUrl||ue?.eventLink||"",wt=ue?.rescheduleUrl||ue?.cancelUrl||"";k(ve||wt),V(ve?"meeting":"manage"),Se(ve||wt?"idle":"error")}catch{Se("error")}};J(()=>{if(!Qe)return;const ee=pe=>{if(!Fd(pe,de.current)||pe.data.event!=="calendly.event_scheduled")return;const $e=pe.data.payload,ue=$e?.event?.uri?.trim()||"",ve=$e?.invitee?.uri?.trim()||"";A&&ue&&ve?(ae({eventUri:ue,inviteeUri:ve}),me(A,ue,ve)):Se("error"),Ge(""),be(Rn(f.bookingScheduled,tt,f)),ge("done")};return window.addEventListener("message",ee),()=>window.removeEventListener("message",ee)},[s,tt,A,Qe,f]),J(()=>{if(!x||Q!=="available"||F===null)return;const ee=T.findIndex(pe=>q.some($e=>F.has(zt(pe,$e).getTime())));ee>=0&&_(ee)},[F,Q,T,x,q]);const Fe=!!(!d&&c?.connected&&(c.mode==="link"||c.provider==="calendly")),We=async()=>{if(Ae==="submitting"||Ae==="scheduling"||!n.name?.trim()&&!P.trim()||!n.email?.trim()&&!oe.trim())return;ge("submitting");const ee={};oe.trim()&&(ee.email=oe.trim()),P.trim()&&(ee.name=P.trim());try{const pe=await a({...oe.trim()?{visitorEmail:oe.trim()}:{},...P.trim()?{visitorName:P.trim()}:{}},ee),$e=pe.booking?.schedulingLink||c?.bookingLink||"";if(!$e){ge("error");return}k($e),V("scheduler"),nt(pe.caseReference||""),he(pe.inquiryId||""),Ge(mo($e,{name:P.trim()||n.name,email:oe.trim()||n.email})),ge("scheduling")}catch{ge("error")}},[pt,dt]=S(new Set),[xt,Nt]=S([]),[yt,jn]=S(0),[tn,at]=S(!1);J(()=>{if(!o)return;let ee=!0;const pe=new Date,$e=new Date;return $e.setDate($e.getDate()+m+1),o(pe.toISOString(),$e.toISOString()).then(ue=>{if(ee)if(dt(new Set(ue.taken.map(ve=>Date.parse(ve)).filter(ve=>!Number.isNaN(ve)))),Nt(ue.busy.map(ve=>[Date.parse(ve.start),Date.parse(ve.end)]).filter(([ve,wt])=>!Number.isNaN(ve)&&!Number.isNaN(wt))),j(ue.slotDurationMinutes??30),D(ya()||ue.timezone||""),x){if(ue.status!=="available"||!Array.isArray(ue.available)){M(null),Y("unavailable");return}M(new Set(ue.available.map(ve=>Date.parse(ve)).filter(ve=>!Number.isNaN(ve)))),Y("available")}else Y(ue.status??"request_only")}).catch(()=>{!ee||!x||(M(null),Y("unavailable"))}),()=>{ee=!1}},[m,x,o,yt]);const Rt=!!n.email?.trim(),bn=!!n.name?.trim(),qt=!!n.phone?.trim(),ft=ke,Vt=!!L&&(!x||Q==="available")&&(bn||P.trim()!=="")&&(d?qt||Kl(ft):Rt||oe.trim()!==""),Lt=(d?n.phone||n.name:n.email||n.name)||"",nn=ee=>t.find(pe=>pe.key===ee),_t=nn("visitorPhone"),Xe=nn("topic"),Dt=ee=>pt.has(zt(T[Z],ee).getTime()),ht=ee=>zt(T[Z],ee).getTime()<=Date.now(),Pt=X*60*1e3,jt=ee=>{const pe=zt(T[Z],ee).getTime(),$e=pe+Pt;return xt.some(([ue,ve])=>pe<ve&&$e>ue)},Hn=ee=>!x||F?.has(zt(T[Z],ee).getTime())===!0,Wn=async()=>{if(!Vt||Ae==="submitting"||!L)return;ge("submitting"),at(!1);const ee=zt(T[Z],L),pe=Pd(T[Z],L),$e={};P.trim()&&($e.name=P.trim()),d?ft&&($e.phone=ft):oe.trim()&&($e.email=oe.trim());try{const ue=await a(d?{bestTime:pe,slotAt:ee.toISOString(),visitorTimezone:ya()||"UTC",...ft?{visitorPhone:ft}:{},...P.trim()?{visitorName:P.trim()}:{},...Le.trim()?{topic:Le.trim()}:{}}:{preferredAt:pe,slotAt:ee.toISOString(),visitorTimezone:ya()||"UTC",...oe.trim()?{visitorEmail:oe.trim()}:{},...P.trim()?{visitorName:P.trim()}:{}},$e);if(!d&&ue.booking?.mode==="link"&&ue.booking.schedulingLink?.trim()){const ve=ue.booking.schedulingLink.trim();k(ve),nt(ue.caseReference||""),he(ue.inquiryId||""),Ge(mo(ve,{name:P.trim()||n.name,email:oe.trim()||n.email})),ge("scheduling");return}ue.booking?.confirmed?(be(Rn(ue.note||Ve(d?f.bookingCallbackConfirmed:f.bookingConfirmed,{when:pe}),ue.caseReference,f)),k(ue.booking.meetingUrl||ue.booking.rescheduleUrl||ue.booking.cancelUrl||ue.booking.eventLink||""),V(ue.booking.meetingUrl||ue.booking.eventLink?"meeting":"manage")):ue.booking?.verificationPending?(Je(!0),be(Rn(ue.note||Ve(f.bookingVerificationPending,{when:pe}),ue.caseReference,f))):be(Rn(ue.note||Ve(d?f.bookingCallbackRequested:f.bookingRequested,{when:pe}),ue.caseReference,f)),ge("done")}catch(ue){ue?.status===409?(dt(ve=>new Set(ve).add(ee.getTime())),$(null),at(!0),jn(ve=>ve+1),ge("idle")):ge("error")}},vn=()=>{Ge(""),ge("idle"),i?.()};return Ae==="scheduling"&&Qe?r("div",{class:"cf-scheduler-overlay",role:"dialog","aria-modal":"true","aria-label":g,children:[r("header",{class:"cf-scheduler-overlay__head",children:[r("button",{type:"button",class:"cf-scheduler-overlay__back",onClick:vn,children:f.bookingBackToChat}),r("strong",{children:g}),r("div",{class:"cf-scheduler-overlay__tools",children:[r("a",{href:He,target:"_blank",rel:"noopener noreferrer",children:[f.bookingOpenNewTab," ",r(Dn,{})]}),r("button",{type:"button","aria-label":f.bookingCloseScheduler,onClick:vn,children:r(Pn,{})})]})]}),r("div",{class:"cf-scheduler-overlay__body",children:[r("div",{class:"cf-scheduler-overlay__loading",children:f.bookingLoadingScheduler}),r("iframe",{ref:de,class:"cf-scheduler-overlay__frame",src:Qe,title:g,allow:"camera; microphone; fullscreen; payment"})]})]}):Ae==="done"?r("div",{class:`cf-form cf-form--done${ie?" cf-form--pending":""}`,role:ie?"alert":"status",children:[!ie&&r(fn,{}),r("span",{children:Ze}),ye==="loading"&&r("span",{role:"status",children:f.bookingCheckingDetails}),ye==="error"&&r("div",{class:"cf-booking__receipt-error",role:"alert",children:[r("span",{children:f.bookingDetailsUnavailable}),H&&A&&s&&r("button",{type:"button",class:"cf-booking__back",onClick:()=>{me(A,H.eventUri,H.inviteeUri)},children:f.bookingRetryDetails})]}),He&&r("a",{class:"cf-booking__link",href:He,target:"_blank",rel:"noopener noreferrer",children:[K==="meeting"?f.bookingMeetingLink:K==="manage"?f.bookingManageLink:f.bookingOpenScheduler," ",r(Dn,{}),r("span",{class:"cf-booking__url",children:He})]}),i&&r("button",{type:"button",class:"cf-booking__back",onClick:i,children:f.bookingBackToChat})]}):Fe?r("div",{class:"cf-form cf-booking",ref:y,children:[r("div",{class:"cf-booking__hint",children:Ve(f.bookingViaProvider,{provider:c?.label??f.bookingSchedulerFallback})}),Rt?Lt?r("div",{class:"cf-form__as",children:Ve(f.actionAs,{identity:Lt})}):null:r(ce,{children:[!n.name?.trim()&&r("input",{class:"cf-form__input",type:"text",placeholder:`${f.handoffName} *`,value:P,"aria-label":f.handoffName,onInput:ee=>fe(ee.target.value)}),r("input",{class:"cf-form__input",type:"email",placeholder:`${f.handoffEmail} *`,value:oe,"aria-label":f.handoffEmail,onInput:ee=>Ue(ee.target.value)})]}),Ae==="error"&&r("div",{class:"cf-form__err",children:f.formError}),r("div",{class:"cf-form__actions",children:[i&&r("button",{type:"button",class:"cf-form__cancel",onClick:i,children:f.cancel}),r("button",{type:"button",class:"cf-form__submit",disabled:Ae==="submitting"||!n.name?.trim()&&P.trim()===""||!Rt&&oe.trim()==="",onClick:We,children:Ae==="submitting"?f.sending:f.bookingOpenScheduler})]})]}):r("div",{class:"cf-form cf-booking",ref:y,children:[r("div",{class:"cf-booking__hint",children:[f.bookingPickTime," ·"," ",r("span",{class:"cf-booking__dur",children:Ve(d?f.bookingCallbackDuration:f.bookingDuration,{count:String(X)})}),U?` · ${Ve(f.bookingTimezone,{timezone:U})}`:""]}),x&&Q==="loading"?r("div",{class:"cf-booking__state",role:"status",children:f.bookingCheckingAvailability}):null,x&&Q==="unavailable"?r("div",{class:"cf-form__err",role:"alert",children:f.bookingAvailabilityUnavailable}):null,x&&Q==="available"&&q.length===0?r("div",{class:"cf-booking__state",role:"status",children:f.bookingNoSlots}):null,q.length>0?r("div",{class:"cf-booking__dates",role:"tablist","aria-label":f.bookingPickDay,children:T.map((ee,pe)=>r("button",{type:"button",role:"tab","aria-selected":pe===Z,disabled:x&&Q==="available"&&!q.some($e=>F?.has(zt(ee,$e).getTime())),class:`cf-booking__date ${pe===Z?"is-selected":""}`,onClick:()=>{_(pe),$(null)},children:[r("span",{class:"cf-booking__dow",children:ee.toLocaleDateString(void 0,{weekday:"short"})}),r("span",{class:"cf-booking__dom",children:ee.getDate()})]},pe))}):null,q.length>0?r("div",{class:"cf-booking__slots",role:"listbox","aria-label":f.bookingPickTimeLabel,children:q.map(ee=>{const pe=ht(ee),$e=jt(ee),ue=Dt(ee),ve=Hn(ee),wt=ue||pe||$e||!ve;return r("button",{type:"button",role:"option","aria-selected":L===ee,disabled:wt,title:pe?f.bookingEarlierToday:$e?f.bookingCalendarBusy:ue?f.bookingAlreadyBooked:ve?void 0:f.bookingNotOffered,class:`cf-booking__slot ${L===ee?"is-selected":""} ${wt?"is-taken":""}`,onClick:()=>$(ee),children:Od(T[Z],ee)},ee)})}):null,tn&&r("div",{class:"cf-form__err",children:f.bookingSlotTaken}),Lt?r("div",{class:"cf-form__as",children:Ve(f.actionAs,{identity:Lt})}):null,!bn&&r("input",{class:"cf-form__input",type:"text",placeholder:`${f.handoffName} *`,value:P,"aria-label":f.handoffName,onInput:ee=>fe(ee.target.value)}),d&&!qt&&r(fo,{label:_t?.label??"Phone number",required:!0,value:ke,onInput:Ce}),d&&Xe?r("input",{class:"cf-form__input",type:"text",placeholder:Xe.placeholder||Xe.label,value:Le,"aria-label":Xe.label,onInput:ee=>Ie(ee.target.value)}):null,!d&&!Rt&&r(ce,{children:r("input",{class:"cf-form__input",type:"email",placeholder:`${f.handoffEmail} *`,value:oe,"aria-label":f.handoffEmail,onInput:ee=>Ue(ee.target.value)})}),Ae==="error"&&r("div",{class:"cf-form__err",children:f.formError}),r("div",{class:"cf-form__actions",children:[i&&r("button",{type:"button",class:"cf-form__cancel",onClick:i,children:f.cancel}),r("button",{type:"button",class:"cf-form__submit",disabled:!Vt||Ae==="submitting",onClick:Wn,children:Ae==="submitting"?f.sending:I})]})]})},go=({actions:e,descriptors:t,visitor:n,onSubmitForm:a,onDemoSlots:i,onConfirmHostedBooking:o,scheduler:s,exclude:c=[],openAction:u,translations:l={},onClose:d})=>{const p=ot(),[g,f]=S(null),[y,h]=S(!1),I=R(null),x=R(null),m=R(!1),T=qe(()=>`cf-actions-${Math.random().toString(36).slice(2,9)}`,[]),F=qe(()=>Ed(t,e,l).filter(U=>!c.includes(U.id)&&!c.includes(U.endpoint)),[t,e,c,l]);J(()=>{u&&F.some(U=>U.id===u)&&(f(u),h(!0))},[u,F]);const M=g?F.find(U=>U.id===g):void 0,Q=O(()=>{if(d){d();return}m.current=!0,f(null),h(!1)},[d]),Y=O(()=>{d?d():f(null)},[d]);$n(()=>{y||!m.current||(m.current=!1,I.current?.focus())},[y]);const X=R({drawerOpen:y,activeId:g});if(X.current={drawerOpen:y,activeId:g},J(()=>{const U=D=>{if(D.key!=="Escape")return;const{drawerOpen:q,activeId:C}=X.current;!q&&!C||(D.stopPropagation(),C?Y():Q())};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[Y,Q]),J(()=>{y&&x.current?.querySelector("button, input, textarea, select")?.focus()},[y,g]),F.length===0)return null;const j=y?M?r("div",{ref:x,id:T,class:"cf-action-drawer is-open",role:"dialog","aria-modal":"false","aria-label":M.formTitle||M.label,children:[r("div",{class:"cf-action-drawer__handle","aria-hidden":"true"}),r("div",{class:"cf-action-drawer__head",children:[r("div",{children:[r("strong",{children:M.formTitle||M.label}),M.legacyFallback?r("small",{class:"cf-action-test-mode",children:p.actionTestMode}):null]}),r("button",{type:"button",class:"cf-action-drawer__close","aria-label":p.actionClose,onClick:Y,children:r(Pn,{})})]}),M.readiness==="degraded"&&M.readinessNote?r("p",{class:"cf-action-drawer__note cf-action-drawer__note--warn",role:"status",children:M.readinessNote}):null,M.presentation==="booking"||M.endpoint==="book-demo"||M.endpoint==="schedule-callback"?r(Ud,{actionId:M.id,fields:M.fields,visitor:n,title:M.formTitle,submitLabel:M.submitLabel,onCancel:Y,onSubmit:(U,D)=>a(M.id,U,D,M.endpoint),onDemoSlots:i,onConfirmHostedBooking:o,scheduler:s}):r(Rd,{spec:{title:M.formTitle||M.label,submit:M.submitLabel,fields:M.endpoint==="request-callback"?M.fields.filter(U=>U.key!=="bestTime"):M.fields},visitor:n,onCancel:Y,onSubmit:(U,D)=>a(M.id,U,D,M.endpoint)})]}):r("div",{ref:x,id:T,class:"cf-action-drawer cf-action-drawer--menu",role:"dialog","aria-modal":"false","aria-label":p.actionChoose,children:[r("div",{class:"cf-action-drawer__handle","aria-hidden":"true"}),r("div",{class:"cf-action-drawer__head",children:[r("div",{children:[r("span",{class:"cf-action-drawer__eyebrow",children:p.actionNeedHelp}),r("strong",{children:p.actionChoose})]}),r("button",{type:"button",class:"cf-action-drawer__close","aria-label":p.actionClose,onClick:Q,children:r(Pn,{})})]}),r("div",{class:"cf-action-drawer__grid",children:F.map(U=>{const D=Ad(U.icon);return r("button",{type:"button",class:"cf-action-card",onClick:()=>f(U.id),children:[r("span",{class:`cf-action-card__icon cf-action-card__icon--${U.category}`,children:r(D,{})}),r("span",{class:"cf-action-card__copy",children:[r("strong",{children:U.label}),U.legacyFallback?r("small",{class:"cf-action-test-mode",children:p.actionTestMode}):null,r("small",{children:U.description}),U.readiness==="degraded"&&U.readinessNote?r("small",{class:"cf-action-card__warn",children:U.readinessNote}):null]}),r(pn,{})]},U.id)})}),r("p",{class:"cf-action-drawer__note",children:p.actionFooter})]}):null;return r("div",{class:"cf-action-shell",children:[r("button",{ref:I,type:"button",class:"cf-action-trigger",hidden:y,"aria-expanded":y,"aria-controls":T,onClick:()=>y?Q():h(!0),children:[r("span",{class:"cf-action-trigger__icon",children:r(gr,{})}),r("span",{class:"cf-action-trigger__copy",children:[r("strong",{children:p.actionContactOptions}),r("small",{children:zd(F,p)})]}),r(pn,{})]}),j]})},Bd=({hasEmail:e,visitor:t,question:n,onSubmitForm:a})=>{const i=ot(),[o,s]=S(!1),[c,u]=S(!1),[l,d]=S(t.name??""),[p,g]=S(t.email??"");if(e)return r("div",{class:"cf-handoff cf-handoff--done",children:[r(fn,{}),r("span",{children:"We’ve alerted the team. If someone is available, they can continue here."})]});if(o){const y=t.email||p;return r("div",{class:"cf-handoff cf-handoff--done",children:[r(fn,{}),r("span",{children:Ve(i.handoffShared,{email:y})})]})}const f=async()=>{if(!(!p.trim()||c)){u(!0);try{await a("inquiry",{visitorEmail:p.trim(),...l.trim()?{visitorName:l.trim()}:{},message:n||"I had a question the assistant couldn’t answer.",subject:"Help request from chat"},{email:p.trim(),name:l.trim()||void 0}),s(!0)}catch{u(!1)}}};return r("div",{class:"cf-handoff",children:[r("div",{class:"cf-handoff__title",children:i.handoffTitle}),r("input",{class:"cf-form__input",type:"text",placeholder:i.handoffName,value:l,"aria-label":i.handoffName,onInput:y=>d(y.target.value)}),r("input",{class:"cf-form__input",type:"email",placeholder:`${i.handoffEmail} *`,value:p,"aria-label":i.handoffEmail,onInput:y=>g(y.target.value)}),r("button",{type:"button",class:"cf-form__submit",disabled:!p.trim()||c,onClick:f,children:c?i.sending:i.handoffNotify})]})},qd=({text:e})=>{const t=ot(),[n,a]=S(!1);return r("button",{type:"button",class:"cf-tool",onClick:async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)}catch{}},"aria-label":t.copy,children:[n?r(fn,{}):r(sd,{}),n?t.copied:t.copy]})},Vd=({items:e,onPick:t})=>e.length===0?null:r("div",{class:"cf-starters",children:e.map((n,a)=>r("button",{type:"button",class:"cf-starter",onClick:()=>t(n),children:n},a))}),jd=({items:e})=>{const t=e.filter(n=>n.label.trim()&&n.url.trim()).slice(0,4);return t.length===0?null:r("div",{class:"cf-featured-links",children:t.map((n,a)=>r("a",{class:"cf-featured-link",href:n.url,target:"_blank",rel:"noopener noreferrer nofollow",title:n.label,children:[r(Dn,{}),r("span",{children:n.label})]},`${n.url}-${a}`))})},Hd=({msg:e,onRate:t})=>{const n=ot(),[a,i]=S(!1),[o,s]=S(""),c=e.feedback,u=()=>{t(e.id,"up"),i(!1)},l=()=>{t(e.id,"down"),i(!0)},d=()=>{t(e.id,"down",o.trim()),i(!1)};return r("div",{class:"cf-feedback",children:[r("div",{class:"cf-feedback__row",children:[r("span",{class:"cf-feedback__label",children:n.feedbackAnswerPrompt}),r("button",{type:"button",class:`cf-feedback__btn ${c==="up"?"is-active":""}`,"aria-label":`${n.feedbackHelpful} answer`,"aria-pressed":c==="up",onClick:u,children:r(oo,{})}),r("button",{type:"button",class:`cf-feedback__btn ${c==="down"?"is-active":""}`,"aria-label":`${n.feedbackNotHelpful} answer`,"aria-pressed":c==="down",onClick:l,children:r(so,{})}),c&&!a&&r("span",{class:"cf-feedback__thanks",children:n.feedbackThanks})]}),a&&c==="down"&&r("div",{class:"cf-feedback__comment",children:[r("textarea",{class:"cf-feedback__input",rows:2,placeholder:n.feedbackCommentPlaceholder,value:o,onInput:p=>s(p.target.value)}),r("button",{type:"button",class:"cf-feedback__send",onClick:d,children:n.feedbackSend})]})]})},bo=e=>e.attachments??(e.attachmentName?[{id:e.attachmentId,name:e.attachmentName}]:[]),Wd=({msg:e,persona:t,isLast:n,visitor:a,hasEmail:i,lastQuestion:o,showActions:s,onPickReply:c,onSubmitForm:u,onDemoSlots:l,onConfirmHostedBooking:d,onRetry:p,ratable:g,onRate:f,onExpandVisualization:y,onExpandExplanation:h,onReconnect:I,onOpenAttachment:x,onExplanationFeedback:m,explanationTransport:T,onOpenAnalyticsSource:F})=>{const M=ot(),Q=mr(),Y=e.role==="user",X=e.liveEventType??"",j=e.content.trim().toLowerCase(),U=X==="handoff_queued"||X==="agent_joined"||X==="agent_left"||X==="ai_handback"||X==="conversation_ended"||j.includes("joined the chat")||j.includes("left the chat")||j.includes("support agents will be with you"),D=e.role==="system"||U,q=e.requestedContactFields?.includes("email")===!0,C=n&&!Y&&!D&&!e.reconnectOffer&&!!(e.handoffOffered||q),Z=C&&!i?["inquiry"]:[],_=!e.pending&&!e.streaming,L=[...e.artifacts??[],...e.visualization&&!(e.artifacts??[]).some($=>$.type==="visualization")?[{type:"visualization",visualization:e.visualization}]:[]];return D?r("div",{class:"cf-msg cf-msg--system",children:r("div",{class:"cf-system-event",children:[r("div",{class:"cf-system-event__mark","aria-hidden":"true"}),r("div",{class:"cf-system-event__text",children:e.content}),I&&r("button",{type:"button",class:"cf-system-event__action",onClick:I,children:M.reconnectSupport}),e.createdAt&&r("div",{class:"cf-system-event__time",children:new Date(e.createdAt).toLocaleString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"})})]})}):r("div",{class:`cf-msg cf-msg--${Y?"user":"agent"}`,children:[!Y&&r(uo,{persona:t,small:!0}),r("div",{class:"cf-msg__col",children:[e.pending&&e.content===""?r(wd,{}):e.imageUrl?r("div",{class:"cf-msg__bubble cf-msg__bubble--media",children:[r("img",{class:"cf-msg__media",src:e.imageUrl,alt:"GIF"}),e.content&&r("span",{class:"cf-msg__caption",children:e.content})]}):r("div",{class:"cf-msg__bubble",children:[Y?e.content:xd(e.content),e.streaming&&r("span",{class:"cf-caret","aria-hidden":"true"})]}),Y?null:L.map(($,P)=>$.type==="visualization"&&$.visualization?r(vo,{visualization:$.visualization,onFollowUp:c,onExpand:y?()=>y(e.id):void 0,expandControlId:e.id},`visualization-${P}`):$.type==="image"&&($.data||$.uri?.startsWith("https://"))&&["image/png","image/jpeg","image/webp"].includes($.mimeType??"")?r("figure",{class:"cf-artifact",children:[$.title?r("figcaption",{children:$.title}):null,r("img",{src:$.uri||`data:${$.mimeType};base64,${$.data}`,alt:$.altText||$.caption||$.title||"Tool result"}),$.caption&&$.caption!==$.title?r("p",{children:$.caption}):null]},`image-${P}`):$.type==="video"&&$.uri?.startsWith("https://")&&($.mimeType??"").startsWith("video/")?r("figure",{class:"cf-artifact",children:[$.title?r("figcaption",{children:$.title}):null,r("video",{controls:!0,preload:"metadata",playsInline:!0,src:$.uri}),$.caption&&$.caption!==$.title?r("p",{children:$.caption}):null]},`video-${P}`):$.type==="resource_link"&&$.uri?.startsWith("https://")?r("a",{class:"cf-artifact-link",href:$.uri,target:"_blank",rel:"noopener noreferrer nofollow",children:[r("strong",{children:$.title||$.name||"Open result"}),$.caption?r("span",{children:$.caption}):null]},`link-${P}`):null),!Y&&e.resultExpired&&!e.visualization?r("p",{class:"cf-analytics-expired","data-testid":"analytics-result-expired",children:[e.resultExpired.title?r("strong",{children:[e.resultExpired.title,". "]}):null,M.resultExpired]}):null,!Y&&e.visualization&&va(e.visualization)?r("div",{class:"cf-analytics-explanation","data-testid":"inline-analytics-explanation","data-explanation-message":e.id,children:r(eo,{classPrefix:"cf",copy:M.analytics?.explanation,locale:Q,onExpand:h?()=>h(e.id):void 0,explanation:va(e.visualization),onFollowUp:c,onFeedback:m,aiTransport:T,canOpenSource:$=>!!F&&($.kind==="liveboard_tile"||$.kind==="insight"),onOpenSource:F?$=>{($.kind==="liveboard_tile"||$.kind==="insight")&&F({kind:$.kind,id:$.id,...e.visualization?.appliedFilters?.length?{appliedFilters:e.visualization.appliedFilters}:{}})}:void 0,maxFollowUps:3,showLead:(()=>{const $=va(e.visualization).headline?.trim().toLocaleLowerCase();return!$||!e.content.toLocaleLowerCase().includes($)})()})}):null,Y&&bo(e).length>0&&r("div",{class:"cf-attach-row cf-attach-row--sent",children:bo(e).map(($,P)=>x?r("button",{type:"button",class:"cf-attach-chip cf-attach-chip--open",title:Ve(M.attachOpen,{name:$.name}),"aria-label":Ve(M.attachOpen,{name:$.name}),onClick:()=>x(e,$,P),children:[r(ba,{}),r("span",{children:$.name})]},`${$.id??$.name}-${P}`):r("div",{class:"cf-attach-chip",title:$.name,children:[r(ba,{}),r("span",{children:$.name})]},`${$.id??$.name}-${P}`))}),!Y&&r(ce,{children:[_&&(e.error||e.content)&&r("div",{class:"cf-msg__actions",children:[r("div",{class:"cf-msg__tools",children:e.error?r("button",{type:"button",class:"cf-tool",onClick:()=>p(e.id,e.retryText??""),children:[r(cd,{}),M.retry]}):r(qd,{text:e.content})}),g&&!e.error&&e.content?r(Hd,{msg:e,onRate:f}):null]}),r(Sd,{msg:e}),n&&r($d,{replies:e.suggestedReplies,onPick:c}),C&&r(Bd,{hasEmail:i,visitor:a,question:o,onSubmitForm:u}),s&&r(go,{actions:e.availableActions,descriptors:e.actions,openAction:e.selectedAction,visitor:a,onSubmitForm:u,onDemoSlots:l,onConfirmHostedBooking:d,scheduler:t?.scheduler,exclude:Z})]})]})]})},Gd=({visualization:e,onClose:t,onFollowUp:n,onFeedback:a,transport:i,onOpenSource:o})=>{const s=ot(),c=mr(),u=va(e);return u?r("div",{class:"cf-analytics-explanation is-expanded","data-testid":"expanded-analytics-explanation",children:r(eo,{classPrefix:"cf",explanation:u,copy:s.analytics?.explanation,locale:c,expanded:!0,onCollapse:t,onFollowUp:n,onFeedback:a,aiTransport:i,canOpenSource:l=>!!o&&(l.kind==="liveboard_tile"||l.kind==="insight"),onOpenSource:o?l=>{(l.kind==="liveboard_tile"||l.kind==="insight")&&o({kind:l.kind,id:l.id,...e.appliedFilters?.length?{appliedFilters:e.appliedFilters}:{}})}:void 0})}):null},vo=({visualization:e,expanded:t=!1,onExpand:n,onClose:a,onFollowUp:i,expandControlId:o})=>{const s=ot(),c=mr();return r(gc,{visualization:e,classPrefix:"cf",labels:s.analytics,locale:c,expanded:t,onExpand:n,onClose:a,onFollowUp:i,expandControlId:o})},xo=e=>new Promise((t,n)=>{const a=new FileReader;a.onload=()=>t(String(a.result).split(",")[1]??""),a.onerror=n,a.readAsDataURL(e)}),Kd=({onPick:e})=>r("div",{class:"cf-picker cf-emoji",children:Ul.map(t=>r("div",{class:"cf-emoji__group",children:[r("div",{class:"cf-emoji__label",children:t.name}),r("div",{class:"cf-emoji__grid",children:t.emojis.map((n,a)=>r("button",{type:"button",class:"cf-emoji__btn",onClick:()=>e(n),"aria-label":n,children:n},a))})]},t.name))}),Yd=({onSearch:e,onPick:t})=>{const n=ot(),[a,i]=S(""),[o,s]=S([]),[c,u]=S(!0);return J(()=>{let l=!0;u(!0);const d=setTimeout(()=>{e(a).then(p=>l&&(s(p),u(!1))).catch(()=>l&&(s([]),u(!1)))},300);return()=>{l=!1,clearTimeout(d)}},[a,e]),r("div",{class:"cf-picker cf-gif",children:[r("input",{class:"cf-gif__search",placeholder:n.searchGifs,value:a,"aria-label":n.searchGifs,onInput:l=>i(l.target.value)}),r("div",{class:"cf-gif__grid",children:c?r("div",{class:"cf-gif__hint",children:n.searchingGifs}):o.length===0?r("div",{class:"cf-gif__hint",children:n.noGifs}):o.map(l=>r("button",{type:"button",class:"cf-gif__item",onClick:()=>t(l.url),"aria-label":l.alt,children:r("img",{src:l.preview,alt:l.alt,loading:"lazy"})},l.id))}),r("div",{class:"cf-gif__powered",children:"via Tenor"})]})},Zd=5*1024*1024,vr=5,Jd="image/png,image/jpeg,image/webp,image/gif,application/pdf",Xd=15e3,mn=e=>e==="listening"||e==="hearing",xr=e=>{switch(e){case"connecting":return"Connecting with AI…";case"listening":return"Listening now — go ahead.";case"hearing":return"Hearing you…";case"unavailable":return"I can’t hear you — check your microphone.";case"speaking":return"AI is speaking — talk to interrupt.";case"processing":return"Working on it — keep talking to add more.";case"noise":return"I couldn't hear clear words. Try again closer to the mic.";case"misunderstood":return"I didn't understand that. Please try again.";case"denied":return"Microphone access is blocked. Allow the mic or type your question.";case"muted":return"Muted — tap the mic to unmute.";case"timeout":return"Didn't hear anything for a while — ending the call.";default:return""}},Qd=.004,yo=({muted:e,listening:t,micLevel:n,onToggleMute:a})=>{const i=t&&n>=Qd;return r("button",{type:"button",class:`cf-call-btn ${e?"is-muted":""} ${t?"is-listening":""} ${i?"is-hot":""}`,"aria-label":e?"Unmute microphone":"Mute microphone","aria-pressed":e,onClick:a,style:t?{"--cf-wave":String(Math.max(.2,Math.min(1,n*6)))}:void 0,children:e?r(Jl,{}):r(Ln,{})})},eu=({audioDevices:e,selectedAudioDeviceId:t,onSelectAudioDevice:n})=>{const[a,i]=S(!1),[o,s]=S(null),c=R(null);J(()=>{if(!a)return;const l=d=>{c.current&&!d.composedPath().includes(c.current)&&i(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[a]),$n(()=>{if(!a){s(null);return}const l=c.current;if(!l)return;let d=new DOMRect(0,0,window.innerWidth,window.innerHeight);for(let I=l.parentElement;I;I=I.parentElement){const x=getComputedStyle(I);if(x.overflow!=="visible"||x.overflowY!=="visible"){d=I.getBoundingClientRect();break}}const p=l.getBoundingClientRect(),g=8,f=d.bottom-p.bottom-g*2,y=p.top-d.top-g*2,h=y>f;s({up:h,maxHeight:Math.max(72,Math.floor(h?y:f))})},[a]);const u=[{deviceId:"",label:"Default microphone"},...e];return r("div",{class:"cf-call-more",ref:c,children:[r("button",{type:"button",class:"cf-call-btn cf-call-btn--microphones","aria-label":"Choose microphone","aria-expanded":a,onClick:()=>i(l=>!l),children:r(pn,{})}),a&&r("div",{class:`cf-call-menu${o?.up?" cf-call-menu--up":""}`,role:"menu",style:o?{maxHeight:`${o.maxHeight}px`}:{visibility:"hidden"},children:[r("div",{class:"cf-call-menu__label",children:"Microphone"}),u.map(l=>r("button",{type:"button",role:"menuitemradio","aria-checked":l.deviceId===t,class:`cf-call-menu__item ${l.deviceId===t?"is-active":""}`,onClick:()=>{n(l.deviceId),i(!1)},children:[l.deviceId===t?r(fn,{}):r("span",{class:"cf-call-menu__spacer"}),r("span",{children:l.label})]},l.deviceId))]})]})},tu=({voiceState:e,muted:t,onToggleMute:n,onEndCall:a,onTalkNow:i,showTalkNow:o,micLevel:s,theaterMode:c,onToggleTheater:u,onMinimize:l,audioDevices:d,selectedAudioDeviceId:p,onSelectAudioDevice:g})=>r("div",{class:"cf-call-controls",children:[r(yo,{muted:t,listening:mn(e)&&!t,micLevel:s,onToggleMute:n}),r(eu,{audioDevices:d,selectedAudioDeviceId:p,onSelectAudioDevice:g}),o&&r("button",{type:"button",class:"cf-call-btn cf-call-btn--talk","aria-label":"Talk now",onClick:i,children:r(Ln,{})}),r("button",{type:"button",class:"cf-call-btn","aria-label":c?"Exit expanded view":"Expand view","aria-pressed":c,onClick:u,children:c?r(pd,{}):r(ud,{})}),r("button",{type:"button",class:"cf-call-btn","aria-label":"Minimize voice chat",onClick:l,children:r(fd,{})}),r("button",{type:"button",class:"cf-call-btn cf-call-btn--end","aria-label":"End voice chat",onClick:a,children:r(br,{})})]}),nu=({persona:e,voiceState:t,muted:n,onToggleMute:a,onEndCall:i,micLevel:o,onExpand:s})=>{const c=g=>g.stopPropagation(),u=e?.assistantMediaUrl?.trim()||e?.agentAvatarUrl?.trim()||"",l=e?.assistantMediaKind==="video"&&!!u,d=e?.agentName||"Assistant",p=["cf-floating-call-card",mn(t)&&!n?"is-listening":"",t==="speaking"?"is-speaking":"",t==="processing"||t==="connecting"?"is-thinking":"",n?"is-muted":""].filter(Boolean).join(" ");return r("div",{class:p,style:mn(t)&&!n?{"--cf-listen":String(Math.max(.18,Math.min(1,o*8)))}:void 0,role:"button",tabIndex:0,"aria-label":`Reopen voice chat with ${d}`,onClick:s,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),s())},children:[r("div",{class:"cf-floating-call-card__media","aria-hidden":"true",children:u?l?r("video",{src:u,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):r("img",{src:u,alt:""}):r("div",{class:`cf-floating-call-card__avatar${On(e)}`,children:[r("span",{children:xa(e)}),r("span",{class:"cf-floating-call-card__eye cf-floating-call-card__eye--left"}),r("span",{class:"cf-floating-call-card__eye cf-floating-call-card__eye--right"}),r("span",{class:"cf-floating-call-card__mouth"})]})}),r("div",{class:"cf-floating-call-card__shade","aria-hidden":"true"}),r("span",{class:"cf-floating-call-card__status",role:"status","aria-live":"polite",children:xr(t)}),r("div",{class:"cf-floating-call-card__controls",onClick:c,onKeyDown:c,role:"presentation",children:[r(yo,{muted:n,listening:mn(t)&&!n,micLevel:o,onToggleMute:a}),r("button",{type:"button",class:"cf-call-btn cf-call-btn--restore","aria-label":"Restore voice chat",onClick:g=>{c(g),s()},children:r(hd,{})}),r("button",{type:"button",class:"cf-call-btn cf-call-btn--end","aria-label":"End voice chat",onClick:g=>{c(g),i()},children:r(br,{})})]})]})},au=(e,t)=>{switch(e){case"connecting":return t.voiceConnecting;case"listening":return t.voiceListening;case"hearing":return t.voiceHearing;case"unavailable":return t.voiceUnavailable;case"processing":return t.voiceProcessing;case"speaking":return t.voiceSpeaking;case"noise":return t.voiceNoise;case"misunderstood":return t.voiceMisunderstood;case"denied":return t.voiceDenied;default:return xr(e)}},ru=({draftStore:e,onSend:t,onSendGif:n,onTyping:a,disabled:i,allowVoice:o,onTranscribe:s,gifEnabled:c,onSearchGifs:u,allowAttach:l,analyzeAttachments:d=!0,onUpload:p,voiceStartSignal:g=0,onVoiceStateChange:f,onPreviewAttachment:y})=>{const h=ot(),[I,x]=S(()=>e.value),m=A=>{const he=typeof A=="function"?A(I):A;e.value=he,x(he)},[T,F]=S(!1),[M,Q]=S(!1),[Y,X]=S("idle"),[j,U]=S("none"),[D,q]=S([]),C=R([]);C.current=D;const Z=R(0),[_,L]=S(!1),[$,P]=S(!1),[fe,oe]=S(""),Ue=R(null),ke=R(null),Ce=R(null),Le=R(0),Ie=R(null),Ae=R(void 0),ge=A=>{X(A),f?.(A)},Ze=()=>{Ae.current&&window.clearTimeout(Ae.current),Ae.current=void 0};J(()=>{const A=Ue.current;A&&(A.style.height="auto",A.style.height=`${Math.min(A.scrollHeight,110)}px`)},[I]),J(()=>()=>{for(const A of C.current)A.previewUrl&&URL.revokeObjectURL(A.previewUrl)},[]);const be=A=>{q(he=>{const de=he.find(me=>me.key===A);return de?.previewUrl&&URL.revokeObjectURL(de.previewUrl),he.filter(me=>me.key!==A)})},ie=()=>q([]);J(()=>{if(j==="none")return;const A=he=>{ke.current&&!he.composedPath().includes(ke.current)&&U("none")};return document.addEventListener("pointerdown",A),()=>document.removeEventListener("pointerdown",A)},[j]);const Je=A=>U(he=>he===A?"none":A),He=A=>{const he=Ue.current;if(!he){m(Fe=>Fe+A);return}const de=he.selectionStart??I.length,me=he.selectionEnd??I.length;m(I.slice(0,de)+A+I.slice(me)),requestAnimationFrame(()=>{he.focus();const Fe=de+A.length;he.setSelectionRange(Fe,Fe)})},k=A=>{U("none"),n(A)},K=async A=>{if(A.length===0)return;oe("");const he=Le.current,de=vr-C.current.length-Z.current;if(de<=0){oe(Ve(h.attachLimit,{count:String(vr)}));return}const me=A.slice(0,de);Z.current+=me.length,L(!0);for(const Fe of me){if(he!==Le.current)break;try{await V(Fe,he)}finally{he===Le.current&&(Z.current-=1,L(Z.current>0))}}he===Le.current&&A.length>me.length&&oe(Ve(h.attachLimit,{count:String(vr)}))},V=async(A,he)=>{if(A.size>Zd){oe(h.attachTooLarge);return}if(!p){oe(h.attachFailed);return}try{const de=await xo(A);if(he!==Le.current)return;const me=await p(de,A.type||"application/octet-stream",A.name,d);if(he!==Le.current)return;const Fe={key:`${me.id||A.name}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,id:me.id,analysisFailed:me.analysisFailed,name:A.name,text:me.text,mimeType:A.type||"application/octet-stream",size:A.size,previewUrl:A.type.startsWith("image/")?URL.createObjectURL(A):void 0,file:A};q(We=>[...We,Fe])}catch(de){if(he!==Le.current)return;de instanceof un&&de.status===413?oe(h.attachTooLarge):de instanceof un&&[400,415,503].includes(de.status)?oe(de.message):oe(h.attachFailed)}},H=async A=>{const he=A.target,de=Array.from(he.files??[]);he.value="",await K(de)},ae=()=>{Le.current+=1,Z.current=0,L(!1),oe("")},ye=(!!I.trim()||D.length>0)&&!i&&!_&&!M,Se=()=>{ye&&(t(I,D.length>0?{attachments:D.map(A=>({id:A.id,name:A.name,text:A.text,file:A.file}))}:void 0),a?.(!1),m(""),ie(),oe(""))},Qe=A=>{const he=A.trim();if(!he||i){ge("misunderstood");return}const de=I.trim(),me=de?`${de} ${he}`:he;t(me),a?.(!1),m(""),ie(),oe(""),ge("idle")},Ge=A=>{if(A.key==="Enter"&&!A.shiftKey){if(i)return;A.preventDefault(),Se()}else A.key==="Escape"&&j!=="none"&&(A.preventDefault(),A.stopPropagation(),U("none"))},tt=()=>{Ze(),Ie.current?.stop("dictation-ended"),Ie.current=null,F(!1),Q(!1)},nt=async()=>{const A=Ie.current;if(A){const{mic:me,processing:Fe}=A.snapshot;me==="hearing"||Fe?A.finishTurn():(tt(),ge("idle"));return}const he=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||void 0;ge("connecting");const de=new qi({transcribe:async({audio:me,mimeType:Fe,durationSeconds:We})=>s(await xo(me),Fe,he,We),listener:{state:({mic:me,processing:Fe,reason:We})=>{if(Ie.current===de){if(me==="unavailable"){if(We==="permission-denied"||We==="unsupported"||We==="no-device"||We==="error"){tt(),ge("denied");return}ge("unavailable");return}F(me==="listening"||me==="hearing"),Q(Fe),me==="starting"?ge("connecting"):Fe&&me!=="hearing"?ge("processing"):me==="hearing"?ge("hearing"):me==="listening"&&ge("listening")}},speechStart:()=>Ze(),turn:me=>{Ie.current===de&&(tt(),Qe(me.text))},noise:me=>{Ie.current===de&&(tt(),ge(me.reason==="transcribe-failed"?"misunderstood":"noise"))}}});Ie.current=de,Ae.current=window.setTimeout(()=>{Ie.current===de&&(tt(),ge("noise"))},Xd),await de.start()};return J(()=>{!g||!o||i||T||M||nt()},[g]),J(()=>()=>{Ze(),Ie.current?.stop("unmounted"),Ie.current=null},[]),r("div",{class:`cf-composer ${$?"is-dragging":""}`,ref:ke,onDragEnter:A=>{l&&(A.preventDefault(),P(!0))},onDragOver:A=>{l&&A.preventDefault()},onDragLeave:A=>{A.currentTarget===A.target&&P(!1)},onDrop:A=>{l&&(A.preventDefault(),P(!1),K(Array.from(A.dataTransfer?.files??[])))},children:[j==="emoji"&&r(Kd,{onPick:He}),j==="gif"&&r(Yd,{onSearch:u,onPick:k}),(D.length>0||_||fe)&&r("div",{class:"cf-attach-row",role:"list","aria-label":h.attachedFiles,children:[D.map(A=>r("span",{class:"cf-attach-chip",role:"listitem",title:A.name,children:[r("button",{type:"button",class:"cf-attach-open","aria-label":Ve(h.attachOpen,{name:A.name}),disabled:!y,onClick:()=>y?.(A.file,A.name),children:[A.previewUrl?r("img",{class:"cf-attach-preview",src:A.previewUrl,alt:""}):r(ba,{}),r("span",{class:"cf-attach-copy",children:[r("span",{children:A.name}),r("small",{children:A.analysisFailed?h.attachAnalysisFailed:`${Math.max(1,Math.ceil(A.size/1024))} KB`})]})]}),r("button",{type:"button",class:"cf-attach-x","aria-label":Ve(h.removeAttachmentNamed,{name:A.name}),onClick:()=>be(A.key),children:r(Pn,{})})]},A.key)),_&&r("span",{class:"cf-attach-status",children:[r("span",{children:h.attaching}),r("button",{type:"button",onClick:ae,children:h.cancel})]}),fe&&!_&&r("span",{class:"cf-attach-status cf-attach-status--err",children:fe})]}),Y!=="idle"&&r("div",{class:"cf-voice-state","aria-live":"polite",children:[r("span",{class:`cf-voice-state__dot ${T?"is-live":""}`}),au(Y,h)]}),r("div",{class:"cf-composer__field",children:[r("button",{type:"button",class:`cf-iconbtn ${j==="emoji"?"is-active":""}`,"aria-label":h.emoji,"aria-pressed":j==="emoji",onClick:()=>Je("emoji"),children:j==="emoji"?r(Pn,{}):r(rd,{})}),c&&r("button",{type:"button",class:`cf-iconbtn cf-gifbtn ${j==="gif"?"is-active":""}`,"aria-label":h.gifs,"aria-pressed":j==="gif",onClick:()=>Je("gif"),children:r("span",{class:"cf-gif-label",children:"GIF"})}),l&&r(ce,{children:[r("input",{ref:Ce,type:"file",class:"cf-file-input",accept:Jd,multiple:!0,onChange:H,tabIndex:-1,"aria-hidden":"true"}),r("button",{type:"button",class:"cf-iconbtn","aria-label":h.attachFile,disabled:_,onClick:()=>Ce.current?.click(),children:r(ba,{})})]}),r("textarea",{ref:Ue,class:"cf-textarea",rows:1,placeholder:h.composerPlaceholder,value:I,"aria-label":h.composerPlaceholder,"aria-busy":i,onInput:A=>{const he=A.target.value;m(he),a?.(!!he.trim())},onPaste:A=>{const he=Array.from(A.clipboardData?.files??[]);!l||he.length===0||(A.preventDefault(),K(he))},onKeyDown:Ge}),o&&r("button",{type:"button",class:`cf-iconbtn cf-mic ${T?"is-recording":""}`,"aria-label":T?h.stopRecording:h.recordVoice,"aria-pressed":T,disabled:M||i,onClick:nt,children:r(Ln,{})}),r("button",{type:"button",class:"cf-send","aria-label":h.send,disabled:!ye,onClick:Se,children:r(Zl,{})})]})]})},iu=e=>e.replace(/\[[^\]]{0,60}\]/g," ").replace(/\(([^)]{0,60})\)/g,(t,n)=>_o.has(n.trim().toLowerCase().replace(/[.!?,…]+$/,"").replace(/\s+/g," "))?" ":t).replace(/\*[^*]{0,60}\*/g," ").replace(/\s+/g," ").trim(),_o=new Set(["background noise","engine noise","noise","inaudible","unintelligible","silence","no speech","static","music","laughter","applause","wind","breathing","click","clicks","clicking","mouse click","mouse clicks","beep","beeps","beeping","tap","taps","tapping","typing","keyboard typing","cough","coughing","sigh","hmm","mm","mmm","uh","um","ah","oh"]),ou=/^\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?(?:\s*(?:-|–|—|to|-->)\s*\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?)?$/,su=e=>{const t=e.trim().toLowerCase().replace(/[()[\]*]/g," ").replace(/[.!?,…]+$/,"").replace(/\s+/g," ").trim();return!t||/^(?:sh+\s*)+$/.test(t)||ou.test(t)?!0:_o.has(t)},cu=e=>{const t=e.trim().toLowerCase().replace(/\s+/g," ");return t?/^(?:transcribe|transcription|transcribed text)[.!:]*$/.test(t)?!0:t.includes("transcribe this audio recording verbatim")||t.includes("preserve the spoken language and any code-switching")||t.includes("output only the transcribed text, no commentary"):!1};let wo=!0,Fn=null;const lu=e=>{wo=e},du=()=>{const e=typeof window<"u"?window.AudioContext??window.webkitAudioContext:void 0;if(!e)return null;if(!Fn)try{Fn=new e}catch{return null}return Fn.state==="suspended"&&Fn.resume(),Fn},Un=(e,t,n,a,i,o)=>{const s=e.createOscillator(),c=e.createGain();s.type=i,s.frequency.setValueAtTime(t,n),s.connect(c),c.connect(e.destination),c.gain.setValueAtTime(1e-4,n),c.gain.exponentialRampToValueAtTime(o,n+.012),c.gain.exponentialRampToValueAtTime(1e-4,n+a),s.start(n),s.stop(n+a+.03)},gn=e=>{if(!wo)return;const t=du();if(!t)return;const n=t.currentTime;try{e==="open"?(Un(t,523,n,.12,"sine",.05),Un(t,784,n+.08,.16,"sine",.05)):e==="send"?Un(t,660,n,.08,"triangle",.04):e==="receive"&&(Un(t,880,n,.1,"sine",.045),Un(t,1175,n+.09,.14,"sine",.045))}catch{}},uu=e=>e.startsWith("image/")?"image":e==="application/pdf"?"pdf":"other",pu=({state:e,onClose:t})=>{const n=ot(),a=R(null);J(()=>{a.current?.focus();const o=s=>{s.key==="Escape"&&(s.stopPropagation(),t())};return document.addEventListener("keydown",o,!0),()=>document.removeEventListener("keydown",o,!0)},[t]);const i=e.status==="ready"?uu(e.mimeType):"other";return r("div",{class:"cf-preview",role:"dialog","aria-modal":"true","aria-label":Ve(n.attachPreviewTitle,{name:e.name}),onClick:o=>{o.target===o.currentTarget&&t()},children:r("div",{class:"cf-preview__frame",children:[r("div",{class:"cf-preview__bar",children:[r("span",{class:"cf-preview__name",title:e.name,children:e.name}),e.status==="ready"&&r("a",{class:"cf-preview__btn",href:e.url,download:e.name,children:n.attachDownload}),r("button",{ref:a,type:"button",class:"cf-preview__btn cf-preview__close","aria-label":n.attachPreviewClose,onClick:t,children:"✕"})]}),r("div",{class:"cf-preview__body",children:[e.status==="loading"&&r("p",{class:"cf-preview__note",children:n.attachPreviewLoading}),e.status==="error"&&r("p",{class:"cf-preview__note",children:n.attachPreviewFailed}),e.status==="ready"&&i==="image"&&r("img",{class:"cf-preview__image",src:e.url,alt:e.name}),e.status==="ready"&&i==="pdf"&&r("iframe",{class:"cf-preview__pdf",src:e.url,title:e.name}),e.status==="ready"&&i==="other"&&r("p",{class:"cf-preview__note",children:n.attachPreviewUnsupported})]})]})})},fu=e=>new Promise((t,n)=>{const a=new FileReader;a.onload=()=>t(String(a.result??"").split(",")[1]??""),a.onerror=()=>n(a.error),a.readAsDataURL(e)}),hu=(e,t)=>e?.status===429?t.errorRateLimit:t.errorGeneric,yr=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),_a=(e,t)=>{const n=yr(),a={stage:e,durationMs:Math.max(0,n-t)};try{performance.measure(`centrinfo-widget:${e}`,{start:t,end:n})}catch{}return typeof window<"u"&&typeof CustomEvent<"u"&&window.dispatchEvent(new CustomEvent("centrinfo:performance",{detail:a})),a},mu=/!?\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,gu=/https?:\/\/[^\s)]+/g,ko=e=>Ui(e).replace(mu,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/(^|[\s([{])\*([^*\n]{1,120})\*(?=[\s.,;:!?)}\]]|$)/g,"$1$2").replace(/(^|[\s([{])_([^_\n]{1,120})_(?=[\s.,;:!?)}\]]|$)/g,"$1$2").replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}[-*+]\s+/gm,"").replace(/^\s{0,3}\d+\.\s+/gm,"").replace(/\s+\*/g," ").replace(/\*\s+/g," ").replace(/[*_]{2,}/g,"").replace(gu,t=>t.replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/\/$/,"")).replace(/[ \t]+\n/g,`
28
168
  `).replace(/\n{3,}/g,`
29
169
 
30
- `).replace(/[ \t]{2,}/g," ").trim(),Tr=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,au=(t,e)=>{typeof console>"u"||console.warn(`[centrinfo-widget] ${t}`,e??{})},_1=(t,e,r,n,a=1,i,o=!1,s,l)=>{t.current?.pause(),t.current=null,typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),e.current=null;const c=()=>{const m=i?.trim();if(!o||!m||typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return!1;const g=new SpeechSynthesisUtterance(m);let v=!1;const y=()=>{v||(v=!0,e.current===g&&(e.current=null,l?.()))};return g.rate=a,g.lang=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en-US",g.onend=y,g.onerror=y,e.current=g,s?.(),window.speechSynthesis.cancel(),window.speechSynthesis.speak(g),!0};if(!r||typeof Audio>"u")return c();const u=new Audio(`data:${n||"audio/mpeg"};base64,${r}`);let f=!1,h=!1;const d=()=>{f||(f=!0,t.current===u&&(t.current=null,l?.()))},p=()=>{if(!f){if(h||t.current!==u){d();return}f=!0,t.current=null,c()||l?.()}};return u.playbackRate=a,u.onended=d,u.onerror=p,t.current=u,u.play().then(()=>{if(!f){if(t.current!==u){d();return}h=!0,s?.(Number.isFinite(u.duration)?u.duration*1e3:void 0)}}).catch(p),!0},FE=t=>{try{return t==="none"?null:t==="session"?sessionStorage:localStorage}catch{return null}},HE=t=>{let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(36)},VE=t=>{try{const e=t?.split(".")[1];if(!e)return;const r=e.replace(/-/g,"+").replace(/_/g,"/"),n=JSON.parse(atob(r.padEnd(Math.ceil(r.length/4)*4,"=")));for(const a of["sub","external_user_id","user_id"]){const i=n[a];if(typeof i=="string"&&i.trim())return i.trim()}}catch{}},UE=t=>{const e=t.user?.externalId?.trim()||t.user?.userId?.trim()||t.user?.email?.trim().toLowerCase()||VE(t.identityToken)||(t.identityToken||t.getIdentityToken?"authenticated":"anonymous");return`${t.token.slice(0,12)}:${t.chatSurface}:${HE(e)}`},ms=t=>`${t.chatSurface}:${Tr()}`,GE=t=>t.slice(0,12),ys=t=>`centrinfo:session:${t}`,Ip=t=>`centrinfo:visitor:${t}`,iu=(t,e)=>`centrinfo:chat:${t}:${e}`,Lp=t=>`centrinfo:history:${t}`,b1=20,Pp=720*60*60*1e3,$E=1440*60*1e3,WE=(t,e)=>{try{return JSON.parse(t?.getItem(Ip(e))||"{}")}catch{return{}}},qE=(t,e,r)=>{if(!t)return ms(r);try{const n=ys(e),a=t.getItem(n);if(a)return a;const i=ms(r);return t.setItem(n,i),i}catch{return ms(r)}},x1=(t,e,r)=>{if(!t)return{};try{const n=t.getItem(iu(e,r));return n?JSON.parse(n):{}}catch{return{}}},w1=(t,e,r)=>{const{ts:n,expiresAt:a,messages:i}=x1(t,e,r);return Array.isArray(i)?typeof a=="number"&&Date.now()>a?[]:typeof n=="number"&&Date.now()-n>Pp?[]:i:[]},YE=(t,e,r)=>{const{ts:n,expiresAt:a,messages:i,ended:o}=x1(t,e,r);return!Array.isArray(i)||i.length===0||typeof a=="number"&&Date.now()>a||typeof n=="number"&&Date.now()-n>Pp?!1:o===!0||typeof n=="number"&&Date.now()-n>$E},XE=t=>Number.isFinite(t??NaN)?Math.max(5,Math.min(200,Math.round(t))):50,ZE=t=>Number.isFinite(t??NaN)?Math.max(1,Math.min(365,Math.round(t)))*24*60*60*1e3:Pp,S1=(t,e,r,n,a,i,o,s)=>{if(t)try{if(!i){t.removeItem(iu(e,r));return}const l=n.filter(u=>!u.pending).slice(-o);if(l.length===0)return;const c=Date.now();t.setItem(iu(e,r),JSON.stringify({ts:c,expiresAt:c+s,messages:l,ended:a}))}catch{}},KE=(t,e)=>{if(!t)return[];try{const r=t.getItem(Lp(e)),n=r?JSON.parse(r):[];return Array.isArray(n)?n:[]}catch{return[]}},ou=(t,e,r)=>{if(t)try{t.setItem(Lp(e),JSON.stringify(r.slice(0,b1)))}catch{}},k1=(t,e)=>{if(t)try{const r=`centrinfo:chat:${e}:`,n=new Set([ys(e),Ip(e),Lp(e)]),a=[];for(let i=0;i<t.length;i++){const o=t.key(i);o&&(n.has(o)||o.startsWith(r))&&a.push(o)}a.forEach(i=>t.removeItem(i))}catch{}},jE=t=>{const n=(t.find(a=>a.role==="user"&&a.content.trim())?.content||t.find(a=>a.content.trim())?.content||"").trim().replace(/\s+/g," ");return n.length>60?n.slice(0,60)+"…":n||"Conversation"},JE=t=>({id:`live:${t.id}`,role:t.type==="chat"||t.type==="ai_resume"?"assistant":"system",content:t.content,authorName:t.authorName,liveEventType:t.type,createdAt:t.createdAt,offerReconnect:t.type==="ai_handback"&&t.reconnectOffered===!0}),T1=t=>(t??[]).find(e=>e.category==="support"&&e.enabled&&e.readiness!=="unavailable"&&(e.liveHandoff??e.id==="public_contact_support")),QE=(t,e)=>{if(e==="ai")for(let r=t.length-1;r>=0;r--){const n=t[r];if(n){if(n.reconnectOffer)return;if(n.liveEventType==="ai_handback")return n.offerReconnect?n.id:void 0}}},eO=(t,e,r=!0)=>{const n=X(FE(e.persistence)).current,a=UE(e),i=X(qE(n,a,e)),o=X(null),s=X(null),l=X(null),c=X(null),u=X(null),f=X(null),h=X(new Map),d=X(!1),p=X(void 0),m=X(null),g=X({}),v=X({}),[y,b]=U(null),[x,w]=U(()=>w1(n,a,i.current)),S=X(x.length>0),k=X(x.some(E=>E.role==="user")),[C,A]=U(!1),[M,T]=U(!1),[D,L]=U({status:"idle"}),R=X({}),[O,B]=U(()=>YE(n,a,i.current)),[j,P]=U(()=>WE(n,a)),[V,H]=U(()=>KE(n,a)),[Z,re]=U(null),[Te,ge]=U([]),[xe,Ce]=U("ai"),[be,it]=U(void 0),[Qe,ze]=U(void 0),oe=X(new Date().toISOString()),pe=X(void 0),ot=X(!1),Xe=X(0),kt=X(j);le(()=>{kt.current=j},[j]);const tt=y?.memoryEnabled!==!1,lr=XE(y?.memoryMessageCap),Cr=ZE(y?.memoryRetentionDays),Tt=Y(()=>{o.current?.abort(),k1(n,a),k1(n,GE(e.token));const E=ms(e);i.current=E;try{n?.setItem(ys(a),E)}catch{}re(null),ge([]),B(!1),H([]),P({}),Ce("ai"),it(void 0),ze(void 0),oe.current=new Date().toISOString(),w(y?[{id:Tr(),role:"assistant",content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[])},[n,a,e.token,y]),Pt=Y(E=>{try{n?.setItem(Ip(a),JSON.stringify(E))}catch{}},[n,a]),Bt=Y(E=>{const z=(E.email??"").trim().toLowerCase(),W=(kt.current.email??"").trim().toLowerCase();z&&W&&z!==W&&Tt();const G={};E.email?.trim()&&(G.email=E.email.trim()),E.phone?.trim()&&(G.phone=E.phone.trim());const ie=[E.firstName,E.lastName].filter(ce=>!!ce?.trim()).join(" ").trim()||E.name?.trim()||"";ie&&(G.name=ie),Object.keys(G).length>0&&P(ce=>{const ye={...G,...ce};return Pt(ye),ye}),t.identify(i.current,E).catch(()=>{})},[t,Pt,Tt]),xt=Y(E=>{b(E),w(z=>{if(z.length===0)return[{id:Tr(),role:"assistant",content:E.greeting,availableActions:E.availableActions,actions:E.actions}];const W=z.some(J=>J.role==="user"),G=z[0];return!W&&G?.role==="assistant"?[{...G,content:E.greeting,availableActions:E.availableActions,actions:E.actions},...z.slice(1)]:z})},[]);le(()=>{if(y?.memoryEnabled===!1){try{n?.removeItem(iu(a,i.current))}catch{}ou(n,a,[]),H([]),re(null),ge([]),w(E=>S.current?(S.current=!1,y?[{id:Tr(),role:"assistant",content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[]):E)}},[y,n,a]);const tn=Y(async()=>{const E=await t.bootstrap();xt(E)},[xt,t]);le(()=>{let E=!0;const z=W=>W.messages.map(G=>({id:G.id,role:G.role,content:G.content,authorName:G.authorName,liveEventType:G.messageType,offerReconnect:G.messageType==="ai_handback"&&G.reconnectOffered===!0,sources:G.sources,visualization:G.visualization,artifacts:G.artifacts,createdAt:G.createdAt}));return t.history().then(W=>{if(!E||W.conversations.length===0)return;const G=W.conversations.map(ye=>({sessionId:ye.sessionId,ts:Date.parse(ye.lastSeenAt)||Date.now(),title:ye.title,ended:ye.ended}));for(const ye of W.conversations)S1(n,a,ye.sessionId,z(ye),ye.ended,!0,lr,Cr);ou(n,a,G),H(G);const J=W.conversations.find(ye=>ye.sessionId===W.activeSessionId);if(!J||k.current)return;const ie=z(J);i.current=J.sessionId,S.current=ie.length>0;try{n?.setItem(ys(a),J.sessionId)}catch{}const ce=ie[ie.length-1]?.createdAt;ce&&(oe.current=ce),B(J.ended),w(ie)}).catch(()=>{}),()=>{E=!1}},[lr,Cr,a,n,t]),le(()=>{let E=!0;return t.bootstrap().then(z=>{E&&xt(z)}),e.user&&Bt(e.user),()=>{E=!1}},[xt,t]),le(()=>{const E=e.configRefreshSeconds;if(!r||E<=0||typeof window>"u")return;let z=!0,W=!1;const G=Math.max(10,E)*1e3,J=()=>typeof document>"u"||document.visibilityState!=="hidden",ie=async()=>{if(!(!z||W||!J())){W=!0;try{await tn()}catch{}finally{W=!1}}};ie();const ce=window.setInterval(ie,G),ye=()=>{ie()},Fe=()=>{ie()};return window.addEventListener("focus",ye),document?.addEventListener?.("visibilitychange",Fe),()=>{z=!1,window.clearInterval(ce),window.removeEventListener("focus",ye),document?.removeEventListener?.("visibilitychange",Fe)}},[r,e.configRefreshSeconds,tn]),le(()=>{S1(n,a,i.current,x,O,tt,lr,Cr)},[x,O,n,a,tt,lr,Cr]),le(()=>{if(!r||O||Z)return;const E=()=>{document.visibilityState==="visible"&&t.presence(i.current)};E();const z=window.setInterval(E,1e4);return document.addEventListener("visibilitychange",E),()=>{window.clearInterval(z),document.removeEventListener("visibilitychange",E)}},[r,O,t,Z]),le(()=>{if(O||Z)return;let E=!0,z=!1;const W=async()=>{if(!z){z=!0;try{const J=await t.liveEvents(i.current,oe.current);if(!E)return;if(Ce(J.mode),it(J.assignedAgentName||void 0),ze(J.agentTyping?J.agentTypingName||J.assignedAgentName||"Agent":void 0),J.conversationEnded){B(!0),Ce("ai"),it(void 0),ze(void 0),w(ie=>ie.some(ce=>ce.id==="live:conversation-ended")?ie:[...ie,{id:"live:conversation-ended",role:"system",content:e.strings.conversationEnded,liveEventType:"conversation_ended",createdAt:new Date().toISOString()}]);return}if(J.events.length>0){let ie=oe.current,ce=Date.parse(ie);const ye=J.events.map(Fe=>{const ne=Date.parse(Fe.createdAt);return Number.isFinite(ne)&&ne>ce&&(ce=ne,ie=Fe.createdAt),JE(Fe)});oe.current=ie,w(Fe=>{const ne=new Set(Fe.map(yt=>yt.id)),rr=ye.filter(yt=>!ne.has(yt.id));return rr.length>0?[...Fe,...rr]:Fe}),ye.some(Fe=>Fe.role==="assistant")&&Yi("receive")}}catch{}finally{z=!1}}};W();const G=window.setInterval(W,2200);return()=>{E=!1,window.clearInterval(G)}},[e.strings.conversationEnded,t,O,Z]),le(()=>{if(!tt){ou(n,a,[]),H(z=>z.length>0?[]:z);return}x.some(z=>z.role==="user")&&H(z=>{const W=i.current,J=[{sessionId:W,ts:Date.now(),title:jE(x),ended:O},...z.filter(ie=>ie.sessionId!==W)];return ou(n,a,J),J.slice(0,b1)})},[x,O,n,a,tt]);const F=Y((E,z)=>{w(W=>W.map(G=>G.id===E?{...G,...z}:G))},[]),ue=Y(()=>{p.current!==void 0&&typeof window<"u"&&window.clearInterval(p.current),p.current=void 0},[]),De=Y((E,z)=>{ue(),delete g.current[E],m.current===E&&(m.current=null),F(E,{content:z,pending:!1,streaming:!1})},[ue,F]),we=Y((E,z,W)=>{const G=z.trim();if(!G||typeof window>"u"){De(E,G);return}ue(),m.current=E;const J=G.match(/\S+\s*/g)??[G],ie=W&&W>0?W:J.length*95,ce=Math.max(28,Math.min(150,ie/Math.max(J.length,1)));let ye=0;F(E,{content:"",pending:!1,streaming:!0}),p.current=window.setInterval(()=>{ye+=1;const Fe=J.slice(0,ye).join("");F(E,{content:Fe,pending:!1,streaming:ye<J.length}),ye>=J.length&&(ue(),delete g.current[E],m.current===E&&(m.current=null),F(E,{content:G,pending:!1,streaming:!1}))},ce)},[ue,De,F]),rt=Y(()=>{const E=m.current;ue(),m.current=null;const z=g.current;g.current={};for(const[W,G]of Object.entries(z))F(W,{content:G,pending:!1,streaming:!1});E&&!(E in z)&&F(E,{pending:!1,streaming:!1})},[ue,F]),vt=Y(E=>{if(O||Z||xe==="ai"||typeof window>"u")return;if(pe.current!==void 0&&window.clearTimeout(pe.current),!E){if(!ot.current)return;ot.current=!1,Xe.current=0,t.typing(i.current,!1).catch(()=>{});return}const z=Date.now();(!ot.current||z-Xe.current>2500)&&(ot.current=!0,Xe.current=z,t.typing(i.current,!0).catch(()=>{})),pe.current=window.setTimeout(()=>{ot.current&&(ot.current=!1,Xe.current=0,t.typing(i.current,!1).catch(()=>{}))},1600)},[t,O,Z,xe]);le(()=>()=>{pe.current!==void 0&&typeof window<"u"&&window.clearTimeout(pe.current)},[]),le(()=>()=>ue(),[ue]);const Mr=Y((E,z,W={})=>{rt(),A(!0);const G=Dp();let J=!1;const ie=new AbortController;o.current=ie;const ce=!!(y?.allowVoiceInput&&y?.voiceOutputEnabled&&y.talkbackMode!=="text"),ye=!!W.forceVoicePlayback,Fe=Q=>{ye&&L(Ee=>Ee.agentId===z?{status:Q,agentId:z}:Ee)};ye&&L({status:"answering",agentId:z});const ne={pending:new Map,nextSeq:0,highestSeq:-1,playing:!1,ended:!1,started:!1,stopped:!1,utterance:null},rr=()=>{f.current===Ct&&(f.current=null),ne.started&&(ne.started=!1,T(!1),Fe("done"))},yt=()=>{ne.stopped||ne.started||(ne.started=!0,nu("voice-first-audio",G),T(!0),Fe("speaking"))},ra=()=>typeof window<"u"&&"speechSynthesis"in window&&typeof SpeechSynthesisUtterance<"u",Rt=()=>{c.current&&ne.playing&&(c.current.pause(),c.current=null),ne.utterance&&(u.current===ne.utterance&&(u.current=null),ne.utterance=null,ra()&&window.speechSynthesis.cancel()),ne.playing=!1},gt=(Q,Ee)=>{const st=Q?.trim();if(!st||!ra())return!1;const Re=new SpeechSynthesisUtterance(st);return Re.rate=y?.voiceSpeed??1,Re.lang=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en-US",Re.onstart=yt,Re.onend=Ee,Re.onerror=Ee,ne.utterance=Re,u.current=Re,window.speechSynthesis.speak(Re),d.current&&window.speechSynthesis.pause(),!0},Hr=()=>{for(;!ne.stopped&&!ne.playing;){let Q=ne.pending.get(ne.nextSeq);if(!Q&&ne.ended&&ne.pending.size>0&&(ne.nextSeq=Math.min(...ne.pending.keys()),Q=ne.pending.get(ne.nextSeq)),!Q){ne.ended&&rr();return}if(ne.pending.delete(ne.nextSeq),ne.nextSeq+=1,Ze(Q))return}},Ze=Q=>{let Ee=!1;const st=()=>{Ee||(Ee=!0,u.current===ne.utterance&&(u.current=null),ne.utterance=null,ne.playing=!1,Hr())};if(!Q.audioBase64||typeof Audio>"u")return ne.playing=gt(Q.text,st),ne.playing;const Re=new Audio(`data:${Q.mimeType||"audio/mpeg"};base64,${Q.audioBase64}`);Re.playbackRate=y?.voiceSpeed??1,Re.volume=d.current?.2:1,ne.playing=!0,c.current=Re;let Ft=!1,Ar=!1;const Dn=()=>{Ee||Ar||(Ar=!0,c.current===Re&&(c.current=null),!(!Ft&&!ne.stopped&&gt(Q.text,st))&&st())};return Re.onended=()=>{c.current===Re&&(c.current=null),st()},Re.onerror=Dn,Re.play().then(()=>{Ft=!0,yt()}).catch(Dn),!0},Ct=()=>{ne.stopped=!0,ne.pending.clear(),Rt(),rr()};t.stream(E,i.current,{voicePlaybackRequested:!!W.forceVoicePlayback,clientMessageId:W.clientMessageId,attachmentId:W.attachmentId,attachmentIds:W.attachmentIds,signal:ie.signal,onChunk:Q=>{Q&&!J&&(J=!0,nu("data-first-chunk",G)),W.forceVoicePlayback&&Q&&(v.current[z]=!0),w(Ee=>Ee.map(st=>st.id===z?{...st,content:st.content+Q,pending:!1,streaming:!0}:st))},onTextReady:()=>{w(Q=>Q.map(Ee=>Ee.id===z?{...Ee,pending:!1,streaming:!1}:Ee))},onReset:()=>{w(Q=>Q.map(Ee=>Ee.id===z?{...Ee,content:"",pending:!0,streaming:!1}:Ee)),ne.pending.clear(),ne.nextSeq=ne.highestSeq+1,Rt()},onAudioSegment:Q=>{!ye||ne.stopped||Q.seq<ne.nextSeq||ne.pending.has(Q.seq)||(f.current=Ct,ne.highestSeq=Math.max(ne.highestSeq,Q.seq),ne.pending.set(Q.seq,Q),Hr())}}).then(Q=>{if(r&&!Q.conversationEnded&&typeof document<"u"&&document.visibilityState==="visible"&&t.presence(i.current),Q.liveMode&&(Ce(Q.liveMode),it(Q.assignedAgentName||void 0)),Q.liveMode&&Q.liveMode!=="ai"&&!Q.answer.trim()){w(Re=>Re.filter(Ft=>Ft.id!==z)),Fe("done");return}const Ee=!!v.current[z];delete v.current[z];const st=!!(W.forceVoicePlayback&&ce&&!Q.liveAudio&&Q.audioBase64&&Q.answer.trim()&&!Ee);if(st&&(g.current[z]=Q.answer),w(Re=>Re.map(Ft=>Ft.id===z?{...Ft,content:st?"":Q.answer||Ft.content||e.strings.emptyReply,pending:!1,streaming:st,error:!1,retryText:void 0,sources:Q.sources,suggestedReplies:Q.suggestedReplies,availableActions:Q.availableActions,actions:Q.actions,selectedAction:Q.selectedAction,handoffOffered:Q.handoffOffered,requestedContactFields:Q.requestedContactFields,visualization:Q.visualization,artifacts:Q.artifacts}:Ft)),Yi("receive"),Q.liveAudio?(ne.ended=!0,Hr()):W.forceVoicePlayback&&!Q.audioBase64&&au(ce?"Talkback expected backend TTS audio, but the chat response did not include audioBase64.":"Talkback voice was requested, but the loaded widget token config does not enable provider TTS.",{voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode,voiceProvider:y?.voiceProvider,hasAudioBase64:!!Q.audioBase64}),W.forceVoicePlayback&&!Q.liveAudio){const Re=_1(c,u,Q.audioBase64,Q.mimeType,y?.voiceSpeed??1,Q.answer,!0,Ft=>{T(!0),Fe("speaking"),st&&we(z,Q.answer,Ft)},()=>{T(!1),Fe("done"),st&&De(z,Q.answer)});Re||Fe("done"),st&&!Re&&De(z,Q.answer)}Q.answer&&e.onMessage?.({role:"assistant",content:Q.answer}),Q.handoffOffered&&e.onHandoff?.(),Q.conversationEnded&&B(!0)}).catch(Q=>{if(ie.signal.aborted){ne.stopped||Ct(),delete v.current[z],w(st=>st.flatMap(Re=>Re.id!==z?[Re]:Re.content.trim()?[{...Re,pending:!1,streaming:!1}]:[])),Fe("done");return}Fe("failed"),delete v.current[z];const Ee=EE(Q,e.strings);F(z,{content:Ee,pending:!1,streaming:!1,error:!0,retryText:E})}).finally(()=>{nu("data-complete",G),delete v.current[z],o.current===ie&&(A(!1),o.current=null,s.current?.agentId===z&&(s.current=null))})},[t,r,e,F,y?.allowVoiceInput,y?.talkbackMode,y?.voiceOutputEnabled,y?.voiceSpeed,rt]),rn=Y((E,z={})=>{const W=E.trim(),{imageUrl:G,attachmentName:J,attachmentText:ie,attachmentId:ce,attachmentFile:ye,forceVoicePlayback:Fe,userMessageId:ne}=z,rr=z.attachments??(J||ce||ie?[{id:ce,name:J??"",text:ie,file:ye}]:[]);if(!W&&!G&&rr.length===0||o.current&&!o.current.signal.aborted||O)return;k.current=!0;let yt=W;for(const Ze of rr){const Ct=Ze.name?` "${Ze.name}"`:"";Ze.text?yt=`${yt}
170
+ `).replace(/[ \t]{2,}/g," ").trim(),bu=(e,t)=>ko(Fc(e,t)),vu=45e3,_r=e=>e.type==="visualization",xu=e=>{const t=!!e.visualization,n=(e.artifacts??[]).some(_r);if(!t&&!n)return e;const{visualization:a,artifacts:i,...o}=e,s=(i??[]).filter(u=>!_r(u)),c=a?.title??(i??[]).find(_r)?.visualization?.title??e.resultExpired?.title;return{...o,...s.length>0?{artifacts:s}:{},resultExpired:c?{title:c}:{}}},wr=e=>e.map(xu),yu=(e,t=Date.now())=>{const n=e.visualization?.explanation?.aiExplanation;if(!e.visualization?.explanation||!n||n.status!=="pending")return e;const a=e.createdAt?Date.parse(e.createdAt):NaN;return Number.isFinite(a)&&t-a<vu?e:{...e,visualization:{...e.visualization,explanation:{...e.visualization.explanation,aiExplanation:{...n,status:"failed",retryAvailable:!1}}}}},_u=e=>e instanceof DOMException&&(e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED"),wu=(e,t,n,a)=>{let i=a;for(let o=0;o<4&&i.length>0;o+=1)try{return e.setItem(t,n(i)),!0}catch(s){if(!_u(s))return!1;i=i.slice(Math.ceil(i.length/2))}try{e.removeItem(t)}catch{}return!1},ku=(e,t)=>{if(e)try{const n=[];for(let a=0;a<e.length;a+=1){const i=e.key(a);i?.startsWith(t)&&n.push(i)}for(const a of n){const i=e.getItem(a);if(!i)continue;const o=JSON.parse(i);if(!Array.isArray(o.messages))continue;const s=wr(o.messages);s.some((c,u)=>c!==o.messages[u])&&e.setItem(a,JSON.stringify({...o,messages:s}))}}catch{}},Su=(e,t=()=>Date.now())=>{let n=null,a=null,i=Number.NEGATIVE_INFINITY;const o=()=>{a!==null&&(clearTimeout(a),a=null);const s=n;n=null,s&&(i=t(),s())};return{schedule:s=>{if(n=s,a!==null)return;const c=e-(t()-i);c<=0?o():a=setTimeout(o,c)},flush:o,cancel:()=>{a!==null&&clearTimeout(a),a=null,n=null}}},ut=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,wa=(e,t)=>{typeof console>"u"||console.warn(`[centrinfo-widget] ${e}`,t??{})},So=(e,t,n,a,i=1,o,s=!1,c,u)=>{e.current?.pause(),e.current=null,typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),t.current=null;const l=()=>{const h=o?.trim();if(!s||!h||typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return!1;const I=new SpeechSynthesisUtterance(h);let x=!1;const m=()=>{x||(x=!0,t.current===I&&(t.current=null,u?.()))};return I.rate=i,I.lang=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en-US",I.onend=m,I.onerror=m,t.current=I,c?.(),window.speechSynthesis.cancel(),window.speechSynthesis.speak(I),!0};if(!n||typeof Audio>"u")return l();const d=new Audio(`data:${a||"audio/mpeg"};base64,${n}`);let p=!1,g=!1;const f=()=>{p||(p=!0,e.current===d&&(e.current=null,u?.()))},y=()=>{if(!p){if(g||e.current!==d){f();return}p=!0,e.current=null,l()||u?.()}};return d.playbackRate=i,d.onended=f,d.onerror=y,e.current=d,d.play().then(()=>{if(!p){if(e.current!==d){f();return}g=!0,c?.(Number.isFinite(d.duration)?d.duration*1e3:void 0)}}).catch(y),!0},$u=e=>{try{return e==="none"?null:e==="session"?sessionStorage:localStorage}catch{return null}},Tu=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},Cu=e=>{try{const t=e?.split(".")[1];if(!t)return;const n=t.replace(/-/g,"+").replace(/_/g,"/"),a=JSON.parse(atob(n.padEnd(Math.ceil(n.length/4)*4,"=")));for(const i of["sub","external_user_id","user_id"]){const o=a[i];if(typeof o=="string"&&o.trim())return o.trim()}}catch{}},Au=e=>{const t=e.user?.externalId?.trim()||e.user?.userId?.trim()||e.user?.email?.trim().toLowerCase()||Cu(e.identityToken)||(e.identityToken||e.getIdentityToken?"authenticated":"anonymous");return`${e.token.slice(0,12)}:${e.chatSurface}:${Tu(t)}`},Bn=e=>`${e.chatSurface}:${ut()}`,Mu=e=>e.slice(0,12),qn=e=>`centrinfo:session:${e}`,kr=e=>`centrinfo:visitor:${e}`,ka=(e,t)=>`centrinfo:chat:${e}:${t}`,Sr=e=>`centrinfo:history:${e}`,Iu=1e3,$o=20,$r=720*60*60*1e3,Eu=1440*60*1e3,zu=(e,t)=>{try{return JSON.parse(e?.getItem(kr(t))||"{}")}catch{return{}}},Nu=(e,t,n)=>{if(!e)return Bn(n);try{const a=qn(t),i=e.getItem(a);if(i)return i;const o=Bn(n);return e.setItem(a,o),o}catch{return Bn(n)}},To=(e,t,n)=>{if(!e)return{};try{const a=e.getItem(ka(t,n));return a?JSON.parse(a):{}}catch{return{}}},Co=(e,t,n)=>{const{ts:a,expiresAt:i,messages:o}=To(e,t,n);return Array.isArray(o)?typeof i=="number"&&Date.now()>i?[]:typeof a=="number"&&Date.now()-a>$r?[]:wr(o):[]},Ru=(e,t,n)=>{const{ts:a,expiresAt:i,messages:o,ended:s}=To(e,t,n);return!Array.isArray(o)||o.length===0||typeof i=="number"&&Date.now()>i||typeof a=="number"&&Date.now()-a>$r?!1:s===!0||typeof a=="number"&&Date.now()-a>Eu},Lu=e=>Number.isFinite(e??NaN)?Math.max(5,Math.min(200,Math.round(e))):50,Du=e=>Number.isFinite(e??NaN)?Math.max(1,Math.min(365,Math.round(e)))*24*60*60*1e3:$r,Ao=(e,t,n,a,i,o,s,c)=>{if(e)try{if(!o){e.removeItem(ka(t,n));return}const u=a.filter(d=>!d.pending).slice(-s);if(u.length===0)return;const l=Date.now();wu(e,ka(t,n),d=>JSON.stringify({ts:l,expiresAt:l+c,messages:wr(d),ended:i}),u)}catch{}},Pu=(e,t)=>{if(!e)return[];try{const n=e.getItem(Sr(t)),a=n?JSON.parse(n):[];return Array.isArray(a)?a:[]}catch{return[]}},Sa=(e,t,n)=>{if(e)try{e.setItem(Sr(t),JSON.stringify(n.slice(0,$o)))}catch{}},Mo=(e,t)=>{if(e)try{const n=`centrinfo:chat:${t}:`,a=new Set([qn(t),kr(t),Sr(t)]),i=[];for(let o=0;o<e.length;o++){const s=e.key(o);s&&(a.has(s)||s.startsWith(n))&&i.push(s)}i.forEach(o=>e.removeItem(o))}catch{}},Ou=e=>{const a=(e.find(i=>i.role==="user"&&i.content.trim())?.content||e.find(i=>i.content.trim())?.content||"").trim().replace(/\s+/g," ");return a.length>60?a.slice(0,60)+"…":a||"Conversation"},Fu=e=>({id:`live:${e.id}`,role:e.type==="chat"||e.type==="ai_resume"?"assistant":"system",content:e.content,authorName:e.authorName,liveEventType:e.type,createdAt:e.createdAt,offerReconnect:e.type==="ai_handback"&&e.reconnectOffered===!0}),Io=e=>(e??[]).find(t=>t.category==="support"&&t.enabled&&t.readiness!=="unavailable"&&(t.liveHandoff??t.id==="public_contact_support")),Uu=(e,t)=>{if(t==="ai")for(let n=e.length-1;n>=0;n--){const a=e[n];if(a){if(a.reconnectOffer)return;if(a.liveEventType==="ai_handback")return a.offerReconnect?a.id:void 0}}},Bu=(e,t,n=!0)=>{const a=R($u(t.persistence)).current,i=Au(t),o=R(Nu(a,i,t)),s=R(null),c=R(null),u=R(null),l=R(null),d=R(null),p=R(null),g=R(new Map),f=R(!1),y=R(void 0),h=R(null),I=R({}),x=R({}),[m,T]=S(null),[F,M]=S(()=>Co(a,i,o.current)),Q=R(null);Q.current||(Q.current=Su(Iu));const Y=R(F.length>0),X=R(F.some(b=>b.role==="user")),[j,U]=S(!1),[D,q]=S(!1),[C,Z]=S({status:"idle"}),_=R({}),[L,$]=S(()=>Ru(a,i,o.current)),[P,fe]=S(()=>zu(a,i)),[oe,Ue]=S(()=>Pu(a,i)),[ke,Ce]=S(null),[Le,Ie]=S([]),[Ae,ge]=S("ai"),[Ze,be]=S(void 0),[ie,Je]=S(void 0),He=R(new Date().toISOString()),k=R(void 0),K=R(!1),V=R(0),H=R(P);J(()=>{H.current=P},[P]);const ae=m?.memoryEnabled!==!1,ye=Lu(m?.memoryMessageCap),Se=Du(m?.memoryRetentionDays),Qe=O(()=>{s.current?.abort(),Q.current?.cancel(),Mo(a,i),Mo(a,Mu(t.token));const b=Bn(t);o.current=b;try{a?.setItem(qn(i),b)}catch{}Ce(null),Ie([]),$(!1),Ue([]),fe({}),ge("ai"),be(void 0),Je(void 0),He.current=new Date().toISOString(),M(m?[{id:ut(),role:"assistant",content:m.greeting,availableActions:m.availableActions,actions:m.actions}]:[])},[a,i,t.token,m]),Ge=O(b=>{try{a?.setItem(kr(i),JSON.stringify(b))}catch{}},[a,i]),tt=O(b=>{const w=(b.email??"").trim().toLowerCase(),z=(H.current.email??"").trim().toLowerCase();w&&z&&w!==z&&Qe();const E={};b.email?.trim()&&(E.email=b.email.trim()),b.phone?.trim()&&(E.phone=b.phone.trim());const te=[b.firstName,b.lastName].filter(se=>!!se?.trim()).join(" ").trim()||b.name?.trim()||"";te&&(E.name=te),Object.keys(E).length>0&&fe(se=>{const ne={...E,...se};return Ge(ne),ne}),e.identify(o.current,b).catch(()=>{})},[e,Ge,Qe]),nt=R(0),A=O(b=>{nt.current=Date.now(),T(b),M(w=>{if(w.length===0)return[{id:ut(),role:"assistant",content:b.greeting,availableActions:b.availableActions,actions:b.actions}];const z=w.some(G=>G.role==="user"),E=w[0];return!z&&E?.role==="assistant"?[{...E,content:b.greeting,availableActions:b.availableActions,actions:b.actions},...w.slice(1)]:w})},[]);J(()=>{if(m?.memoryEnabled===!1){Q.current?.cancel();try{a?.removeItem(ka(i,o.current))}catch{}Sa(a,i,[]),Ue([]),Ce(null),Ie([]),M(b=>Y.current?(Y.current=!1,m?[{id:ut(),role:"assistant",content:m.greeting,availableActions:m.availableActions,actions:m.actions}]:[]):b)}},[m,a,i]);const he=O(async()=>{const b=await e.bootstrap();A(b)},[A,e]);J(()=>{let b=!0;const w=z=>z.messages.map(E=>yu({id:E.id,role:E.role,content:E.content,authorName:E.authorName,liveEventType:E.messageType,offerReconnect:E.messageType==="ai_handback"&&E.reconnectOffered===!0,sources:E.sources,visualization:E.visualization,artifacts:E.artifacts,createdAt:E.createdAt}));return e.history().then(z=>{if(!b||z.conversations.length===0)return;const E=z.conversations.map(ne=>({sessionId:ne.sessionId,ts:Date.parse(ne.lastSeenAt)||Date.now(),title:ne.title,ended:ne.ended}));for(const ne of z.conversations)Ao(a,i,ne.sessionId,w(ne),ne.ended,!0,ye,Se);Sa(a,i,E),Ue(E);const G=z.conversations.find(ne=>ne.sessionId===z.activeSessionId);if(!G||X.current)return;const te=w(G);o.current=G.sessionId,Y.current=te.length>0;try{a?.setItem(qn(i),G.sessionId)}catch{}const se=te[te.length-1]?.createdAt;se&&(He.current=se),$(G.ended),M(te)}).catch(()=>{}),()=>{b=!1}},[ye,Se,i,a,e]),J(()=>{let b=!0;return nt.current=Date.now(),e.bootstrap().then(w=>{b&&A(w)}),t.user&&tt(t.user),()=>{b=!1}},[A,e]),J(()=>{const b=t.configRefreshSeconds;if(!n||b<=0||typeof window>"u")return;let w=!0,z=!1;const E=Math.max(10,b)*1e3,G=()=>typeof document>"u"||document.visibilityState!=="hidden",te=async()=>{if(!(!w||z||!G())){z=!0;try{await he()}catch{}finally{z=!1}}};Date.now()-nt.current>=E&&te();const se=window.setInterval(te,E),ne=()=>{te()},_e=()=>{te()};return window.addEventListener("focus",ne),document?.addEventListener?.("visibilitychange",_e),()=>{w=!1,window.clearInterval(se),window.removeEventListener("focus",ne),document?.removeEventListener?.("visibilitychange",_e)}},[n,t.configRefreshSeconds,he]),J(()=>{const b=o.current;Q.current.schedule(()=>Ao(a,i,b,F,L,ae,ye,Se))},[F,L,a,i,ae,ye,Se]),J(()=>{const b=Q.current,w=()=>{document.visibilityState==="hidden"&&b.flush()};return document.addEventListener("visibilitychange",w),window.addEventListener("pagehide",b.flush),()=>{document.removeEventListener("visibilitychange",w),window.removeEventListener("pagehide",b.flush),b.flush()}},[]),J(()=>{ku(a,"centrinfo:chat:")},[a]),J(()=>{if(!n||L||ke)return;const b=()=>{document.visibilityState==="visible"&&e.presence(o.current)};b();const w=window.setInterval(b,1e4);return document.addEventListener("visibilitychange",b),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",b)}},[n,L,e,ke]),J(()=>{if(!n||L||ke)return;let b=!0,w=!1,z=0,E;const G=()=>{E!==void 0&&window.clearTimeout(E),!(!b||document.hidden)&&(E=window.setTimeout(()=>{te()},Math.min(3e4,2200*2**z)))},te=async()=>{if(!(w||document.hidden||!b)){w=!0;try{const ne=await e.liveEvents(o.current,He.current);if(!b)return;if(z=0,ge(ne.mode),be(ne.assignedAgentName||void 0),Je(ne.agentTyping?ne.agentTypingName||ne.assignedAgentName||"Agent":void 0),ne.conversationEnded){$(!0),ge("ai"),be(void 0),Je(void 0),M(_e=>_e.some(re=>re.id==="live:conversation-ended")?_e:[..._e,{id:"live:conversation-ended",role:"system",content:t.strings.conversationEnded,liveEventType:"conversation_ended",createdAt:new Date().toISOString()}]);return}if(ne.events.length>0){let _e=He.current,re=Date.parse(_e);const st=ne.events.map(De=>{const ct=Date.parse(De.createdAt);return Number.isFinite(ct)&&ct>re&&(re=ct,_e=De.createdAt),Fu(De)});He.current=_e,M(De=>{const ct=new Set(De.map(Pe=>Pe.id)),Ye=st.filter(Pe=>!ct.has(Pe.id));return Ye.length>0?[...De,...Ye]:De}),st.some(De=>De.role==="assistant")&&gn("receive")}}catch{z=Math.min(z+1,4)}finally{w=!1,G()}}},se=()=>{document.hidden?E!==void 0&&window.clearTimeout(E):te()};return document.addEventListener("visibilitychange",se),document.hidden||te(),()=>{b=!1,E!==void 0&&window.clearTimeout(E),document.removeEventListener("visibilitychange",se)}},[n,t.strings.conversationEnded,e,L,ke]),J(()=>{if(!ae){Sa(a,i,[]),Ue(w=>w.length>0?[]:w);return}F.some(w=>w.role==="user")&&Ue(w=>{const z=o.current,G=[{sessionId:z,ts:Date.now(),title:Ou(F),ended:L},...w.filter(te=>te.sessionId!==z)];return Sa(a,i,G),G.slice(0,$o)})},[F,L,a,i,ae]);const de=O((b,w)=>{M(z=>z.map(E=>E.id===b?{...E,...w}:E))},[]),me=O(()=>{y.current!==void 0&&typeof window<"u"&&window.clearInterval(y.current),y.current=void 0},[]),Fe=O((b,w)=>{me(),delete I.current[b],h.current===b&&(h.current=null),de(b,{content:w,pending:!1,streaming:!1})},[me,de]),We=O((b,w,z)=>{const E=w.trim();if(!E||typeof window>"u"){Fe(b,E);return}me(),h.current=b;const G=E.match(/\S+\s*/g)??[E],te=z&&z>0?z:G.length*95,se=Math.max(28,Math.min(150,te/Math.max(G.length,1)));let ne=0;de(b,{content:"",pending:!1,streaming:!0}),y.current=window.setInterval(()=>{ne+=1;const _e=G.slice(0,ne).join("");de(b,{content:_e,pending:!1,streaming:ne<G.length}),ne>=G.length&&(me(),delete I.current[b],h.current===b&&(h.current=null),de(b,{content:E,pending:!1,streaming:!1}))},se)},[me,Fe,de]),pt=O(()=>{const b=h.current;me(),h.current=null;const w=I.current;I.current={};for(const[z,E]of Object.entries(w))de(z,{content:E,pending:!1,streaming:!1});b&&!(b in w)&&de(b,{pending:!1,streaming:!1})},[me,de]),dt=O(b=>{if(L||ke||Ae==="ai"||typeof window>"u")return;if(k.current!==void 0&&window.clearTimeout(k.current),!b){if(!K.current)return;K.current=!1,V.current=0,e.typing(o.current,!1).catch(()=>{});return}const w=Date.now();(!K.current||w-V.current>2500)&&(K.current=!0,V.current=w,e.typing(o.current,!0).catch(()=>{})),k.current=window.setTimeout(()=>{K.current&&(K.current=!1,V.current=0,e.typing(o.current,!1).catch(()=>{}))},1600)},[e,L,ke,Ae]);J(()=>()=>{k.current!==void 0&&typeof window<"u"&&window.clearTimeout(k.current)},[]),J(()=>()=>me(),[me]);const xt=O((b,w,z={})=>{pt(),U(!0);const E=yr();let G=!1;const te=new AbortController;s.current=te;const se=!!(m?.allowVoiceInput&&m?.voiceOutputEnabled&&m.talkbackMode!=="text"),ne=!!z.forceVoicePlayback,_e=W=>{ne&&Z(we=>we.agentId===w?{status:W,agentId:w}:we)};ne&&Z({status:"answering",agentId:w});const re={pending:new Map,nextSeq:0,highestSeq:-1,playing:!1,ended:!1,started:!1,stopped:!1,utterance:null},st=()=>{p.current===et&&(p.current=null),re.started&&(re.started=!1,q(!1),_e("done"))},De=()=>{re.stopped||re.started||(re.started=!0,_a("voice-first-audio",E),q(!0),_e("speaking"))},ct=()=>typeof window<"u"&&"speechSynthesis"in window&&typeof SpeechSynthesisUtterance<"u",Ye=()=>{l.current&&re.playing&&(l.current.pause(),l.current=null),re.utterance&&(d.current===re.utterance&&(d.current=null),re.utterance=null,ct()&&window.speechSynthesis.cancel()),re.playing=!1},Pe=(W,we)=>{const Be=W?.trim();if(!Be||!ct())return!1;const xe=new SpeechSynthesisUtterance(Be);return xe.rate=m?.voiceSpeed??1,xe.lang=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en-US",xe.onstart=De,xe.onend=we,xe.onerror=we,re.utterance=xe,d.current=xe,window.speechSynthesis.speak(xe),f.current&&window.speechSynthesis.pause(),!0},kt=()=>{for(;!re.stopped&&!re.playing;){let W=re.pending.get(re.nextSeq);if(!W&&re.ended&&re.pending.size>0&&(re.nextSeq=Math.min(...re.pending.keys()),W=re.pending.get(re.nextSeq)),!W){re.ended&&st();return}if(re.pending.delete(re.nextSeq),re.nextSeq+=1,Ee(W))return}},Ee=W=>{let we=!1;const Be=()=>{we||(we=!0,d.current===re.utterance&&(d.current=null),re.utterance=null,re.playing=!1,kt())};if(!W.audioBase64||typeof Audio>"u")return re.playing=Pe(W.text,Be),re.playing;const xe=new Audio(`data:${W.mimeType||"audio/mpeg"};base64,${W.audioBase64}`);xe.playbackRate=m?.voiceSpeed??1,xe.volume=f.current?.2:1,re.playing=!0,l.current=xe;let rt=!1,mt=!1;const Ft=()=>{we||mt||(mt=!0,l.current===xe&&(l.current=null),!(!rt&&!re.stopped&&Pe(W.text,Be))&&Be())};return xe.onended=()=>{l.current===xe&&(l.current=null),Be()},xe.onerror=Ft,xe.play().then(()=>{rt=!0,De()}).catch(Ft),!0},et=()=>{re.stopped=!0,re.pending.clear(),Ye(),st()};e.stream(b,o.current,{voicePlaybackRequested:!!z.forceVoicePlayback,clientMessageId:z.clientMessageId,attachmentId:z.attachmentId,attachmentIds:z.attachmentIds,signal:te.signal,onChunk:W=>{W&&!G&&(G=!0,_a("data-first-chunk",E)),z.forceVoicePlayback&&W&&(x.current[w]=!0),M(we=>we.map(Be=>Be.id===w?{...Be,content:Be.content+W,pending:!1,streaming:!0}:Be))},onTextReady:()=>{M(W=>W.map(we=>we.id===w?{...we,pending:!1,streaming:!1}:we))},onReset:()=>{M(W=>W.map(we=>we.id===w?{...we,content:"",pending:!0,streaming:!1}:we)),re.pending.clear(),re.nextSeq=re.highestSeq+1,Ye()},onAudioSegment:W=>{!ne||re.stopped||W.seq<re.nextSeq||re.pending.has(W.seq)||(p.current=et,re.highestSeq=Math.max(re.highestSeq,W.seq),re.pending.set(W.seq,W),kt())}}).then(W=>{if(n&&!W.conversationEnded&&typeof document<"u"&&document.visibilityState==="visible"&&e.presence(o.current),W.liveMode&&(ge(W.liveMode),be(W.assignedAgentName||void 0)),W.liveMode&&W.liveMode!=="ai"&&!W.answer.trim()){M(xe=>xe.filter(rt=>rt.id!==w)),_e("done");return}const we=!!x.current[w];delete x.current[w];const Be=!!(z.forceVoicePlayback&&se&&!W.liveAudio&&W.audioBase64&&W.answer.trim()&&!we);if(Be&&(I.current[w]=W.answer),M(xe=>xe.map(rt=>rt.id===w?{...rt,content:Be?"":W.answer||rt.content||t.strings.emptyReply,pending:!1,streaming:Be,error:!1,retryText:void 0,sources:W.sources,suggestedReplies:W.suggestedReplies,availableActions:W.availableActions,actions:W.actions,selectedAction:W.selectedAction,handoffOffered:W.handoffOffered,requestedContactFields:W.requestedContactFields,visualization:W.visualization,artifacts:W.artifacts}:rt)),gn("receive"),W.liveAudio?(re.ended=!0,kt()):z.forceVoicePlayback&&!W.audioBase64&&wa(se?"Talkback expected backend TTS audio, but the chat response did not include audioBase64.":"Talkback voice was requested, but the loaded widget token config does not enable provider TTS.",{voiceOutputEnabled:m?.voiceOutputEnabled,talkbackMode:m?.talkbackMode,voiceProvider:m?.voiceProvider,hasAudioBase64:!!W.audioBase64}),z.forceVoicePlayback&&!W.liveAudio){const xe=So(l,d,W.audioBase64,W.mimeType,m?.voiceSpeed??1,bu(W.answer,W.visualization),!0,rt=>{q(!0),_e("speaking"),Be&&We(w,W.answer,rt)},()=>{q(!1),_e("done"),Be&&Fe(w,W.answer)});xe||_e("done"),Be&&!xe&&Fe(w,W.answer)}W.answer&&t.onMessage?.({role:"assistant",content:W.answer}),W.handoffOffered&&t.onHandoff?.(),W.conversationEnded&&$(!0)}).catch(W=>{if(te.signal.aborted){re.stopped||et(),delete x.current[w],M(Be=>Be.flatMap(xe=>xe.id!==w?[xe]:xe.content.trim()?[{...xe,pending:!1,streaming:!1}]:[])),_e("done");return}_e("failed"),delete x.current[w];const we=hu(W,t.strings);de(w,{content:we,pending:!1,streaming:!1,error:!0,retryText:b})}).finally(()=>{_a("data-complete",E),delete x.current[w],s.current===te&&(U(!1),s.current=null,c.current?.agentId===w&&(c.current=null))})},[e,n,t,de,m?.allowVoiceInput,m?.talkbackMode,m?.voiceOutputEnabled,m?.voiceSpeed,pt]),Nt=O((b,w={})=>{const z=b.trim(),{imageUrl:E,attachmentName:G,attachmentText:te,attachmentId:se,attachmentFile:ne,forceVoicePlayback:_e,userMessageId:re}=w,st=w.attachments??(G||se||te?[{id:se,name:G??"",text:te,file:ne}]:[]);if(!z&&!E&&st.length===0||s.current&&!s.current.signal.aborted||L)return;X.current=!0;let De=z;for(const Ee of st){const et=Ee.name?` "${Ee.name}"`:"";Ee.text?De=`${De}
31
171
 
32
- [Attached file${Ct}]:
33
- ${Ze.text}`.trim():Ze.id&&(yt=`${yt}
172
+ [Attached file${et}]:
173
+ ${Ee.text}`.trim():Ee.id&&(De=`${De}
34
174
 
35
- [The visitor attached a file${Ct}. It is saved for staff, but its contents were not available to the AI. Do not claim to have inspected it.]`.trim())}!yt&&G&&(yt=G);const ra=rr.map(Ze=>({id:Ze.id,name:Ze.name})),Rt=rr.flatMap(Ze=>Ze.id?[Ze.id]:[]),gt={id:ne||Tr(),role:"user",content:W,imageUrl:G,attachments:ra.length>0?ra:void 0};rr.forEach((Ze,Ct)=>{Ze.file&&(h.current.set(`${gt.id}:${Ct}`,Ze.file),Ze.id&&h.current.set(Ze.id,Ze.file))});const Hr=Tr();w(Ze=>[...!!(ne&&Ze.some(Ee=>Ee.id===ne))?Ze.map(Ee=>Ee.id===ne?{...Ee,content:W,pending:!1,streaming:!1,imageUrl:G,attachments:gt.attachments}:Ee):[...Ze,gt],{id:Hr,role:"assistant",content:"",pending:!0}]),Yi("send"),e.onMessage?.({role:"user",content:yt}),R.current[Hr]=gt.id,s.current={userId:gt.id,agentId:Hr,text:W,backendText:yt},Mr(yt,Hr,{forceVoicePlayback:Fe,clientMessageId:gt.id,attachmentId:Rt[0],attachmentIds:Rt})},[O,e,Mr]),Fr=Y((E,z,W,G,J)=>{const ie=Tr();w(ce=>[...ce.filter(ye=>ye.id!==E.agentId&&(!G.userMessageId||ye.id!==G.userMessageId)).map(ye=>ye.id===E.userId?{...ye,content:z,pending:!1,streaming:!1}:ye),{id:ie,role:"assistant",content:"",pending:!0}]),J&&e.onMessage?.({role:"user",content:J}),R.current[ie]=E.userId,s.current={userId:E.userId,agentId:ie,text:z,backendText:W},Mr(W,ie,{forceVoicePlayback:G.forceVoicePlayback,clientMessageId:Tr()})},[e,Mr]),bs=Y((E,z={})=>{const W=E.trim();if(!W||O)return;const G=o.current&&!o.current.signal.aborted?s.current:null,J=G??l.current;if(l.current=null,!J){rn(W,z);return}G&&o.current?.abort(),Fr(J,`${J.text} ${W}`.replace(/\s+/g," ").trim(),`${J.backendText}
36
- ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.aborted?s.current:null;return E?(l.current=E,o.current?.abort(),!0):!1},[]),Qt=Y(()=>{const E=l.current;l.current=null,!(!E||O)&&Fr(E,E.text,E.backendText,{forceVoicePlayback:!0})},[O,Fr]),Xi=Y(()=>o.current?.abort(),[]),Zi=Y(E=>{d.current=E;const z=c.current;z&&(z.volume=E?.2:1),u.current&&typeof window<"u"&&"speechSynthesis"in window&&(E?window.speechSynthesis.pause():window.speechSynthesis.resume())},[]),nn=Y(()=>{f.current?.(),f.current=null,d.current=!1,rt(),L(E=>E.status==="speaking"||E.status==="answering"?{...E,status:"done"}:E),c.current?.pause(),c.current=null,typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),u.current=null,T(!1)},[rt]),Cn=Y(E=>{const z=zE(E);if(!z)return Promise.resolve(!1);rt();const W=!!(y?.allowVoiceInput&&y?.voiceOutputEnabled&&y.talkbackMode!=="text"),G=(J,ie)=>new Promise(ce=>{let ye=!1;_1(c,u,J,ie,y?.voiceSpeed??1,z,!0,()=>{ye=!0,T(!0)},()=>{T(!1),ce(ye)})||(T(!1),ce(!1))});return W?t.speak(z).then(J=>J.audioBase64?G(J.audioBase64,J.mimeType):(au("Talkback prompt TTS did not return provider audio.",{providerReady:J.providerReady,message:J.message,voiceProvider:y?.voiceProvider,voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode}),G())).catch(J=>(au("Talkback prompt TTS request failed before audio playback.",{error:J instanceof Error?J.message:String(J),voiceProvider:y?.voiceProvider,voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode}),G())):(au("Talkback prompt wanted voice, but the loaded widget token config has provider TTS disabled.",{voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode,voiceProvider:y?.voiceProvider}),G())},[y?.allowVoiceInput,y?.talkbackMode,y?.voiceOutputEnabled,y?.voiceSpeed,rt,t]),ea=Y((E,z,W={})=>{if(C||O||!z)return;F(E,{content:"",pending:!0,streaming:!1,error:!1}),Yi("send");const G=x.findIndex(ie=>ie.id===E),J=G>0?x[G-1]:void 0;Mr(z,E,{...W,clientMessageId:R.current[E]??(J?.role==="user"?J.id:void 0)})},[C,O,x,F,Mr]),an=Y((E,z,W)=>{F(E,{feedback:z});const G=x.findIndex(ce=>ce.id===E),J=G>=0?x[G]?.content:void 0;let ie;for(let ce=G-1;ce>=0;ce--)if(x[ce]?.role==="user"){ie=x[ce]?.content;break}t.sendFeedback({sessionId:i.current,messageId:E,rating:z,comment:W,question:ie,answer:J}).catch(()=>{})},[t,F,x]),Ka=Y(async(E,z,W={},G)=>{e.onAction?.(E);const J=E==="public_contact_support"||E==="public_submit_inquiry"?{actionId:E}:{},ie=await t.action(E,{sessionId:i.current,...z,...J},G),ce={};return W.name?.trim()&&(ce.name=W.name.trim()),W.email?.trim()&&(ce.email=W.email.trim()),W.phone?.trim()&&(ce.phone=W.phone.trim()),Object.keys(ce).length>0&&(P(ye=>{const Fe={...ye,...ce};return Pt(Fe),Fe}),ce.email&&E!=="contact"&&t.action("contact",{sessionId:i.current,...ce}).catch(()=>{})),Yi("receive"),ie},[t,e,Pt]),er=Y((E,z,W)=>t.confirmHostedBooking?.({sessionId:i.current,inquiryId:E,eventUri:z,inviteeUri:W})??Promise.resolve(void 0),[t]),tr=Y(E=>{const z=E.trim();z&&w(W=>W.some(G=>G.role==="assistant"&&G.content===z)?W:[...W,{id:Tr(),role:"assistant",content:z}])},[]),Mn=Y(()=>{const E=T1(y?.actions);return E?(w(z=>[...z,{id:Tr(),role:"assistant",content:e.strings.reconnectPrompt,actions:[E],selectedAction:E.id,handoffOffered:!0,reconnectOffer:!0,createdAt:new Date().toISOString()}]),!0):!1},[e.strings.reconnectPrompt,y?.actions]),zt=Y(E=>{k.current=!0;const z=Tr();return w(W=>[...W,{id:z,role:"user",content:E.trim(),pending:!0}]),z},[]),xs=Y((E,z)=>{w(W=>W.map(G=>G.id===E?{...G,...z}:G))},[]),ws=Y(E=>{w(z=>z.filter(W=>W.id!==E))},[]),Ss=Y((E,z)=>{t.sendFeedback({sessionId:i.current,messageId:"__csat__",rating:E,comment:z}).catch(()=>{})},[t]),ks=Y(async(E,z,W,G)=>{const J=Dp();try{if(typeof E!="string"&&t.transcribeAudio)return await t.transcribeAudio(E,z,W,G);const ie=typeof E=="string"?E:await RE(E);return await t.transcribe(ie,z,W,G)}finally{nu("voice-transcription",J)}},[t]),An=Y(async(E,z,W=0)=>{const G=h.current.get(`${E.id}:${W}`)??(z.id?h.current.get(z.id):void 0);if(G)return G;if(!z.id||!t.fetchAttachment)throw new Error("This file is no longer available.");return t.fetchAttachment(z.id,i.current)},[t]),Ts=Y((E,z,W,G)=>t.uploadAttachment?t.uploadAttachment(E,z,W,i.current,G):Promise.reject(new Error("File upload is unavailable")),[t]),ja=Y(E=>t.searchGifs(E),[t]),te=Y((E,z)=>t.demoSlots(E,z),[t]),Se=Y(E=>rn("",{imageUrl:E}),[rn]),Le=e.demo||!!e.gifApiKey,ve=Y(()=>{o.current?.abort(),B(!0),t.endConversation(i.current).catch(()=>{})},[t]),Ae=Y(()=>{o.current?.abort();const E=ms(e);i.current=E;try{n?.setItem(ys(a),E)}catch{}re(null),ge([]),B(!1),Ce("ai"),it(void 0),ze(void 0),oe.current=new Date().toISOString(),w(y?[{id:Tr(),role:"assistant",content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[])},[n,a,y]),cr=Y(E=>{if(tt){if(E===i.current){re(null);return}ge(w1(n,a,E)),re(E)}},[n,a,tt]),ta=Y(()=>{re(null),ge([])},[]),on=e.starters.length>0?e.starters:y?.starterQuestions??[],sn=y?.featuredLinks??[];return{persona:y,messages:x,sending:C,assistantSpeaking:M,voiceReply:D,visitor:j,starters:on,featuredLinks:sn,hasEmail:!!j.email,liveMode:xe,assignedAgentName:be,agentTypingName:Qe,send:rn,amend:bs,hold:Za,resumeHeld:Qt,duckSpeaking:Zi,sendGif:Se,notifyTyping:vt,stop:Xi,retry:ea,rateMessage:an,injectAssistant:tr,reconnectSupport:Mn,appendUserDraft:zt,patchMessage:xs,removeMessage:ws,submitCsat:Ss,submitForm:Ka,confirmHostedBooking:er,transcribe:ks,uploadAttachment:Ts,loadAttachment:An,searchGifs:ja,demoSlots:te,gifEnabled:Le,identify:Bt,ended:O,endConversation:ve,startNew:Ae,history:tt?V:[],viewingSessionId:Z,viewMessages:Te,openConversation:cr,closeHistoryView:ta,shutdown:Tt,stopSpeaking:nn,speakAssistantText:Cn}},tO=({name:t,greeting:e})=>{const r=kr();return _("section",{class:"cf-empty-welcome","aria-label":ct(r.welcomeLabel,{name:t}),children:[_("span",{class:"cf-empty-welcome__eyebrow",children:r.welcomeEyebrow}),_("h2",{children:t}),_("p",{children:e||r.welcomePrompt})]})},Rp=(t,e,r)=>{if(t.key==="Escape"){t.preventDefault(),t.stopPropagation(),r();return}if(t.key!=="Tab")return;const n=Array.from(e.querySelectorAll('button, [href], textarea, input, select, [tabindex]:not([tabindex="-1"])')).filter(c=>!c.hasAttribute("disabled")&&c.getAttribute("aria-hidden")!=="true"&&c.tabIndex>=0);if(n.length===0)return;const a=e.getRootNode(),i=t.composedPath()[0],o=i instanceof HTMLElement?i:"activeElement"in a?a.activeElement:document.activeElement,s=n[0],l=n[n.length-1];t.shiftKey&&(o===s||!e.contains(o))?(t.preventDefault(),t.stopPropagation(),l.focus()):!t.shiftKey&&(o===l||!e.contains(o))&&(t.preventDefault(),t.stopPropagation(),s.focus())},su=new Map,C1=t=>{if(!t||typeof document>"u"||typeof CanvasRenderingContext2D>"u")return;const e=document.createElement("canvas").getContext("2d");if(!e)return;e.fillStyle="#010203",e.fillStyle=t;const r=e.fillStyle;if(r==="#010203"&&t.trim().toLowerCase()!=="#010203")return;const n=r.match(/^#([\da-f]{6})$/i)?.[1];if(n)return[Number.parseInt(n.slice(0,2),16),Number.parseInt(n.slice(2,4),16),Number.parseInt(n.slice(4,6),16),1];const a=r.match(/^rgba?\(([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:[, /]+([\d.]+))?\)$/i);if(!a)return;const i=a.slice(1,5).map(Number);if(!i.some(o=>!Number.isFinite(o)))return[i[0],i[1],i[2],i[3]??1]},rO=(t,e="#ffffff")=>{const r=`${t??""}|${e}`;if(su.has(r))return su.get(r);const n=C1(t),a=C1(e)??[255,255,255,1];if(!n){su.set(r,void 0);return}const i=n[3],s=n.slice(0,3).map((h,d)=>h*i+a[d]*(1-i)).map(h=>{const d=h/255;return d<=.04045?d/12.92:((d+.055)/1.055)**2.4}),l=s[0]*.2126+s[1]*.7152+s[2]*.0722,c=1.05/(l+.05),u=(l+.05)/.059,f=c>=u?"#ffffff":"#0f1e2a";return su.set(r,f),f},nO=t=>{const[e,r]=U("light");return le(()=>{if(t!=="auto"||typeof matchMedia>"u")return;const n=matchMedia("(prefers-color-scheme: dark)"),a=()=>r(n.matches?"dark":"light");return a(),n.addEventListener("change",a),()=>n.removeEventListener("change",a)},[t]),t==="auto"?e:t},aO=6e4,iO=90,M1={end:"end the call",mute:"mute your microphone",minimize:"minimize the chat",expand:"expand the view",shrink:"exit the expanded view"},A1=t=>t.trim().toLowerCase().replace(/[^\p{L}\p{N}\s']/gu," ").replace(/\s+/g," ").trim(),oO=[{action:"shrink",re:/\b(?:exit|leave|quit|close)\b[\s\w]*\b(?:full ?screen|expanded|theat(?:er|re))\b|\bshrink\b|\bsmaller view\b/},{action:"end",re:/\b(?:end|close|stop|finish|hang ?up|quit|exit)\b[\s\w]*\b(?:call|chat|conversation|convo|session|talking)\b|\bhang ?up\b|\bgood ?bye\b|^bye(?: bye)?$/},{action:"mute",re:/\bmute\b|\bstop listening\b/},{action:"minimize",re:/\bminimi[sz]e\b|\bhide\b[\s\w]*\b(?:chat|call|window|widget)\b/},{action:"expand",re:/\bexpand\b|\bmaximi[sz]e\b|\bfull ?screen\b|\btheat(?:er|re) mode\b|\bbigger view\b/}],sO=/^(?:yes|yeah|yep|yup|sure|correct|confirm|affirmative|go ahead|do it|please do|ok(?:ay)?)\b/,lO=/^(?:no|nope|nah|cancel|never ?mind|don'?t|stop)\b/,cO=/^(?:end|close|stop|finish|hang ?up|quit|exit|bye|good ?bye)\b/,uO=t=>{const e=A1(t);if(!e)return null;for(const{action:r,re:n}of oO)if(n.test(e)){const a=e.split(" ").length;return{action:r,confident:r==="end"?a<=10:a<=6}}return null},fO=t=>`I didn't catch yes or no. Say yes to ${M1[t]}, or no to keep talking.`,dO=({transport:t,config:e,bindControls:r,composerDraftStore:n})=>{const a=e.strings,[i,o]=U(e.openByDefault),{persona:s,messages:l,sending:c,assistantSpeaking:u,visitor:f,hasEmail:h,liveMode:d,assignedAgentName:p,agentTypingName:m,starters:g,featuredLinks:v,send:y,sendGif:b,notifyTyping:x,stop:w,amend:S,hold:k,resumeHeld:C,duckSpeaking:A,retry:M,rateMessage:T,injectAssistant:D,reconnectSupport:L,appendUserDraft:R,patchMessage:O,removeMessage:B,submitCsat:j,submitForm:P,confirmHostedBooking:V,transcribe:H,uploadAttachment:Z,loadAttachment:re,searchGifs:Te,demoSlots:ge,gifEnabled:xe,identify:Ce,ended:be,endConversation:it,startNew:Qe,history:ze,viewingSessionId:oe,viewMessages:pe,openConversation:ot,closeHistoryView:Xe,shutdown:kt,stopSpeaking:tt,speakAssistantText:lr}=eO(t,e,i),Cr=QE(l,d),[Tt,Pt]=U(null),Bt=X(0),xt=Y((N,$,fe)=>{fe===Bt.current&&Pt({status:"ready",name:$,url:URL.createObjectURL(N),mimeType:N.type||"application/octet-stream"})},[]),tn=Y((N,$,fe)=>{const Ke=$.name,je=++Bt.current;Pt({status:"loading",name:Ke}),re(N,$,fe).then(Dr=>xt(Dr,Ke,je),()=>{je===Bt.current&&Pt({status:"error",name:Ke})})},[re,xt]),F=Y((N,$)=>xt(N,$,++Bt.current),[xt]),ue=Y(()=>{Bt.current+=1,Pt(null)},[]);le(()=>()=>{Tt?.status==="ready"&&URL.revokeObjectURL(Tt.url)},[Tt]);const De=!!T1(s?.actions),[we,rt]=U(0),[vt,Mr]=U({mic:"off",processing:!1}),[rn,Fr]=U(null),[bs,Za]=U(!1),[Qt,Xi]=U(!1),[Zi,nn]=U(!1),[Cn,ea]=U(!1),[an,Ka]=U(0),[er,tr]=U(!1),[Mn,zt]=U(null),[xs,ws]=U([]),[Ss,ks]=U(""),[An,Ts]=U(()=>{try{return localStorage.getItem("centrinfo:muted")==="1"}catch{return!1}}),ja=nO(e.theme),te=s?.soundEnabled??!0;le(()=>{DE(e.sound&&te&&!An)},[e.sound,te,An]);const Se=Y(()=>{Ts(N=>{const $=!N;try{localStorage.setItem("centrinfo:muted",$?"1":"0")}catch{}return $})},[]),Le=X(null),ve=X(null),Ae=X(null),cr=X(0),ta=X(!1),on=X(!1),sn=X(null),E=X(0),z=X(void 0),W=X(0),G=X(null),J=X(!1),ie=X(null),ce=X(""),ye=X(()=>{}),Fe=X(""),ne=X(c),rr=X(y);rr.current=y;const yt=X(S);yt.current=S;const ra=X(H);ra.current=H;const Rt=X(!1),gt=X(!1),Hr=X("");Hr.current=[...l].reverse().find(N=>N.role==="assistant")?.content??"";const Ze=X(u);ne.current=c,Ze.current=u;const Ct=Qt?bs?"timeout":Cn||vt.mic==="muted"?"muted":vt.mic==="unavailable"?vt.reason==="permission-denied"||vt.reason==="unsupported"?"denied":"unavailable":vt.mic==="off"||vt.mic==="starting"?"connecting":vt.mic==="hearing"?"hearing":u?"speaking":rn??(vt.processing||c?"processing":"listening"):"idle",[Q,Ee]=U(!0),[st,Re]=U(!1),Ft=X(0),[Ar,Dn]=U(!1),[Ja,Qa]=U(!1),R1=X(null),[na,ei]=U(!1),kO=X({value:""}),TO=n??kO.current,E1=X({confirmEnd:Ar,confirmClear:Ja,showHistory:na});E1.current={confirmEnd:Ar,confirmClear:Ja,showHistory:na};const[CO,O1]=U(!1),ut=!!oe,Op=ut?pe:l,Cs=Op.find(N=>N.id===Mn&&N.visualization)?.visualization;le(()=>{!Mn||Cs||(zt(null),tr(!1))},[Cs,Mn]);const Ki=Y(()=>{o(!0),rt(0),Yi("open"),e.onOpen?.(),e.onShow?.()},[e]),ln=Y(()=>{o(!1),tr(!1),zt(null),e.onClose?.(),e.onHide?.(),ve.current?.focus()},[e]),Ms=Y(()=>i?ln():Ki(),[i,Ki,ln]),MO=Y(()=>Dn(!0),[]),AO=Y(()=>{it(),Dn(!1)},[it]),DO=Y(()=>{Qe(),Re(!1),Ee(!0)},[Qe]);le(()=>{Ar&&R1.current?.focus()},[Ar]),le(()=>{r({open:Ki,close:ln,toggle:Ms,identify:Ce,startNew:Qe,endConversation:it,shutdown:kt})},[r,Ki,ln,Ms,Ce,Qe,it,kt]),le(()=>{const N=l.filter($=>$.role==="assistant"&&!$.pending).length;if(i){cr.current=N;return}N>cr.current&&rt(N-cr.current)},[l,i]),le(()=>{e.onUnreadChange?.(we)},[we,e]),le(()=>{const N=e.sessionDurationMinutes;if(!N||N<=0)return;const $=setTimeout(()=>kt(),N*60*1e3);return()=>clearTimeout($)},[e.sessionDurationMinutes,l,i,kt]),le(()=>{const N=e.customLauncherSelector;if(!N||typeof document>"u")return;let $=[];try{$=Array.from(document.querySelectorAll(N))}catch{return}const fe=Ke=>{Ke.preventDefault(),Ms()};return $.forEach(Ke=>Ke.addEventListener("click",fe)),()=>$.forEach(Ke=>Ke.removeEventListener("click",fe))},[e.customLauncherSelector,Ms]);const N1=X(!1);le(()=>{const N=e.proactiveMessage?.trim();if(!N||N1.current)return;const $=e.proactiveOnPaths??[],fe=typeof location<"u"?location.pathname:"";if($.length>0&&!$.some(Dr=>fe.includes(Dr)))return;const Ke=`centrinfo:proactive:${e.token.slice(0,12)}`;try{if(sessionStorage.getItem(Ke)==="1")return}catch{}const je=setTimeout(()=>{if(!(i||be||l.some(Dr=>Dr.role==="user"))){N1.current=!0;try{sessionStorage.setItem(Ke,"1")}catch{}D(N),Ki()}},Math.max(0,e.proactiveDelaySeconds)*1e3);return()=>clearTimeout(je)},[e.proactiveMessage]),le(()=>{const N=Ae.current;if(!i||!N)return;const $=l[l.length-1],fe=Date.now()<Ft.current;$?.role==="user"||Q||fe?(requestAnimationFrame(()=>{N.scrollTop=N.scrollHeight}),Re(!1),fe&&Ee(!0)):Re(!0)},[l,i,c,Q]);const IO=Y(()=>{const N=Ae.current;if(!N)return;if(ta.current&&!ut){Ee(!0),Re(!1);return}const $=N.scrollHeight-N.scrollTop-N.clientHeight<80;Ee($),$&&Re(!1)},[ut]),aa=Y(()=>{const N=Ae.current;N&&(N.scrollTop=N.scrollHeight),Re(!1),Ee(!0)},[]),lu=Y(()=>{Ft.current=Date.now()+3e3,requestAnimationFrame(aa)},[aa]);le(()=>{if(!i||ut||!Qt||Ct==="connecting")return;Ft.current=Date.now()+6e4,aa();const N=requestAnimationFrame(()=>{aa(),requestAnimationFrame(aa)}),$=[80,180,360].map(fe=>window.setTimeout(aa,fe));return()=>{cancelAnimationFrame(N),$.forEach(fe=>window.clearTimeout(fe))}},[u,l,i,aa,c,Qt,ut,Ct]);const B1=Y(()=>{Le.current?.querySelector(".cf-textarea")?.focus()},[]),As=Y((N,$)=>{Fr(N),z.current&&window.clearTimeout(z.current),z.current=window.setTimeout(()=>Fr(null),3e3),$&&!on.current&&lr($)},[lr]),cu=Y(N=>{const $=ie.current;if($)return $;lu();const fe=R(N);return ie.current=fe,O(fe,{content:ce.current||N,pending:!0,streaming:!1}),fe},[R,lu,O]),In=Y(()=>{const N=ie.current;if(N){if(ce.current){O(N,{content:ce.current,pending:!0});return}ie.current=null,B(N)}},[O,B]),ia=Y(()=>{gt.current&&(gt.current=!1,A(!1)),Rt.current&&(Rt.current=!1,C())},[A,C]),nr=Y(()=>{ta.current=!1,sn.current?.stop("call-ended"),sn.current=null,Rt.current=!1,gt.current=!1,on.current=!1,G.current=null,J.current=!1;const N=ie.current;ie.current=null,ce.current="",N&&B(N),z.current&&window.clearTimeout(z.current),Fr(null),Za(!1),Mr({mic:"off",processing:!1}),Ka(0),Xi(!1),nn(!1),ea(!1),tr(!1),zt(null),tt()},[B,tt]),LO=Y(()=>{er&&zt(null),tr(!er)},[er]),PO=Y(N=>{zt(N),tr(!0)},[]),RO=Y(()=>{const N=Mn;zt(null),tr(!1),window.requestAnimationFrame(()=>{Array.from(Le.current?.querySelectorAll("[data-visualization-message]")??[]).find(fe=>fe.dataset.visualizationMessage===N)?.focus()})},[Mn]),EO=Y(()=>{zt(null),tr(!1)},[]),z1=Y((N,$,fe=!1)=>{if(lu(),$&&(O($,{content:N,pending:!1,streaming:!1}),ie.current===$&&(ie.current=null)),ce.current="",fe){tt(),yt.current(N,{forceVoicePlayback:!0,userMessageId:$});return}ta.current&&(k()?yt.current(N,{forceVoicePlayback:!0,userMessageId:$}):rr.current(N,{forceVoicePlayback:!0,userMessageId:$}))},[lu,k,O,tt]),cn=Y(N=>{D(N),lr(N)},[D,lr]),F1=Y(()=>{if(E.current=Date.now(),Fr(null),Ze.current){gt.current=!0,A(!0);return}Rt.current||(Rt.current=k()),cu("Listening...")},[A,cu,k]),H1=Y(N=>{const $=ie.current;if(!$||gt.current)return;const fe=[ce.current,N].filter(Boolean).join(" ");O($,{content:`${fe} ...`,pending:!0})},[O]),V1=Y(N=>{E.current=Date.now();const $=[ce.current,N.text].map(un=>un.trim()).filter(Boolean).join(" ").replace(/\s+/g," ").trim();if((gt.current||N.overlappedOutput)&&AR(N.text,Hr.current)){In(),ia();return}if(!$||ME($)||AE($)){const un=gt.current||Rt.current;In(),ia(),un||As("misunderstood");return}gt.current&&(gt.current=!1,w(),tt());const Ke=G.current;if(Ke){ce.current="",In();const un=A1($);if(sO.test(un)||Ke==="end"&&cO.test(un)){G.current=null,ye.current(Ke);return}if(lO.test(un)){G.current=null,cn("Okay, never mind — what would you like to know?");return}cn(fO(Ke));return}const je=uO($);if(je){if(ce.current="",In(),ia(),je.confident){ye.current(je.action);return}G.current=je.action,cn(`Just to confirm — you want me to ${M1[je.action]}? Please say yes or no.`);return}const Dr=cu($);O(Dr,{content:$,pending:!0});const ji=Rt.current;Rt.current=!1,z1($,Dr,ji)},[cu,O,ia,z1,In,As,cn,w,tt]),U1=Y(N=>{E.current=Date.now();const $=gt.current||Rt.current;if(In(),ia(),!($||N.overlappedOutput||N.reason==="too-short")){if(N.reason==="transcribe-failed"){As("misunderstood","I couldn't transcribe that. Please try again, or type your question.");return}As("noise")}},[ia,In,As]),Ds=X({speechStart:F1,partial:H1,turn:V1,noise:U1});Ds.current={speechStart:F1,partial:H1,turn:V1,noise:U1};const G1=Y(()=>{navigator.mediaDevices?.enumerateDevices().then(N=>{ws(N.filter($=>$.kind==="audioinput").map(($,fe)=>({deviceId:$.deviceId,label:$.label||`Microphone ${fe+1}`})))}).catch(()=>{})},[]),OO=Y(()=>{if(ta.current){nr();return}if(B1(),!s?.allowVoiceInput||!s.talkbackMode||s.talkbackMode==="text"||ne.current||be||ut)return;E.current=Date.now(),on.current=!1,ta.current=!0,ea(!1),Xi(!0),nn(!1),Za(!1);let N=!1;const $=new Kx({deviceId:Fe.current||void 0,transcribe:async({audio:fe,mimeType:Ke,durationSeconds:je})=>{const Dr=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||void 0;return TE(await ra.current(fe,Ke,Dr,je))},listener:{state:fe=>{Mr(fe),fe.mic!=="starting"&&fe.mic!=="off"&&nn(!0),!N&&fe.mic==="listening"&&(N=!0,G1())},speechStart:()=>Ds.current.speechStart(),partial:({text:fe})=>Ds.current.partial(fe),turn:fe=>Ds.current.turn(fe),noise:fe=>Ds.current.noise(fe),level:fe=>{const Ke=performance.now();Ke-W.current<iO||(W.current=Ke,Ka(fe))}}});sn.current=$,$.setOutputActive(Ze.current),$.start()},[nr,be,B1,s,G1,ut]),uu=Y(()=>{const N=!on.current;on.current=N,ea(N),sn.current?.setMuted(N),N?(ce.current="",In(),ia()):E.current=Date.now()},[ia,In]),$1=Y(N=>{switch(E.current=Date.now(),N){case"end":J.current=!0,cn("Okay — ending our call now. Goodbye!"),window.setTimeout(()=>{J.current&&(J.current=!1,nr())},2e3);break;case"mute":{on.current||uu(),cn("Muted. Tap the mic button when you want me to listen again.");break}case"minimize":ln(),cn("Minimized — I'm still listening. Tap the call pill to bring the chat back.");break;case"expand":tr(!0),cn("Sure — expanding the view.");break;case"shrink":zt(null),tr(!1),cn("Okay — back to the smaller view.");break}},[ln,nr,cn,uu]);le(()=>{ye.current=$1},[$1]);const W1=X(!1);le(()=>{W1.current&&!u&&J.current&&(J.current=!1,nr()),W1.current=u},[u,nr]);const NO=Y(N=>{Fe.current=N,ks(N),sn.current?.selectDevice(N||void 0)},[]),BO=Y(()=>{!ta.current||on.current||(gt.current=!1,Rt.current=!1,w(),tt(),E.current=Date.now())},[w,tt]);le(()=>{sn.current?.setOutputActive(u),E.current=Date.now()},[u]),le(()=>{if(Ct!=="denied")return;const N=window.setTimeout(()=>nr(),3500);return()=>window.clearTimeout(N)},[nr,Ct]),le(()=>{if(!Qt)return;const N=window.setInterval(()=>{const $=sn.current;!$||on.current||ne.current||Ze.current||$.snapshot.mic==="hearing"||$.snapshot.processing||Date.now()-E.current<aO||(sn.current?.log.add("call-timeout"),Za(!0),window.setTimeout(()=>nr(),2400))},5e3);return()=>window.clearInterval(N)},[nr,Qt]);const zO=Qt&&!Cn&&(c||u);le(()=>()=>nr(),[nr]);const[FO,HO]=U(""),q1=X(!1);le(()=>{if(q1.current&&!c){const N=[...l].reverse().find($=>$.role==="assistant"&&!$.streaming&&!$.pending&&$.content);N&&HO(N.content)}q1.current=c},[c,l]),Mu(()=>{if(!i)return;const N=Le.current,$=Ar||Ja?N?.querySelector(".cf-confirm__card"):na?N?.querySelector(".cf-history"):null;if(!$)return;const fe=$.getRootNode(),Ke="activeElement"in fe?fe.activeElement:document.activeElement;(!Ke||!$.contains(Ke))&&$.querySelector('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])')?.focus()},[Ja,Ar,i,na]),le(()=>{if(!i)return;const N=Le.current,$=Ar||Ja?N?.querySelector(".cf-confirm__card"):na?N?.querySelector(".cf-history"):null,fe=N?.querySelectorAll(":scope > .cf-header, :scope > .cf-panel__video, :scope > .cf-panel__chat");fe?.forEach(je=>{$?(je.setAttribute("inert",""),je.setAttribute("aria-hidden","true")):(je.removeAttribute("inert"),je.removeAttribute("aria-hidden"))}),$||requestAnimationFrame(()=>N?.querySelector(".cf-textarea")?.focus());const Ke=je=>{if(je.key==="Escape"){je.preventDefault();const Ls=E1.current;if(Ls.confirmEnd){Dn(!1);return}if(Ls.confirmClear){Qa(!1);return}if(Ls.showHistory){ei(!1);return}ln();return}if(je.key!=="Tab"||!$)return;const Dr=$.querySelectorAll('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])'),ji=Array.from(Dr).filter(Ls=>!Ls.hasAttribute("disabled"));if(ji.length===0)return;const un=ji[0],K1=ji[ji.length-1],j1=$.getRootNode()instanceof ShadowRoot?$.getRootNode().activeElement:document.activeElement;je.shiftKey&&j1===un?(je.preventDefault(),K1.focus()):!je.shiftKey&&j1===K1&&(je.preventDefault(),un.focus())};return N?.addEventListener("keydown",Ke),()=>{N?.removeEventListener("keydown",Ke),fe?.forEach(je=>{je.removeAttribute("inert"),je.removeAttribute("aria-hidden")})}},[i,ln,Ar,Ja,na]),le(()=>{const N=Le.current;N&&(i?N.removeAttribute("inert"):N.setAttribute("inert",""))},[i]);const fu=e.accentColor??e.themeTokens?.accent??s?.accentColor,Y1=e.themeTokens?.accentText??rO(fu,e.themeTokens?.background??(ja==="dark"?"#0f1c27":"#ffffff")),VO={zIndex:e.zIndex,"--cf-h-pad":`${e.horizontalPadding}px`,"--cf-v-pad":`${e.verticalPadding}px`,...Y1?{"--cf-accent-ink":Y1}:{},...e.themeTokens?.accentStrong?{"--cf-accent-2":e.themeTokens.accentStrong}:{},...e.themeTokens?.background?{"--cf-bg":e.themeTokens.background}:{},...e.themeTokens?.surface?{"--cf-surface":e.themeTokens.surface}:{},...e.themeTokens?.surfaceMuted?{"--cf-surface-2":e.themeTokens.surfaceMuted}:{},...e.themeTokens?.text?{"--cf-text":e.themeTokens.text}:{},...e.themeTokens?.mutedText?{"--cf-muted":e.themeTokens.mutedText}:{},...e.themeTokens?.border?{"--cf-border":e.themeTokens.border}:{},...e.themeTokens?.shadow?{"--cf-shadow":e.themeTokens.shadow}:{},...e.themeTokens?.radius?{"--cf-radius":e.themeTokens.radius}:{},...e.themeTokens?.fontFamily?{"--cf-font":e.themeTokens.fontFamily}:{},...e.themeTokens?.success?{"--cf-success":e.themeTokens.success}:{},...e.themeTokens?.warning?{"--cf-warning":e.themeTokens.warning}:{},...e.themeTokens?.danger?{"--cf-danger":e.themeTokens.danger}:{},...fu?{"--cf-accent":fu,"--cf-accent-2":e.themeTokens?.accentStrong??`color-mix(in oklab, ${fu} 76%, #14141f)`}:{}},UO=N=>y(N),GO=[...l].reverse().find(N=>N.role==="user"&&N.content.trim())?.content??"",du=l.some(N=>N.role==="user"),X1=!!(s?.allowVoiceInput&&s?.talkbackMode&&s.talkbackMode!=="text"),Z1=X1,Is=!ut&&Z1&&!du?Op.filter((N,$)=>!($===0&&N.role==="assistant")):Op,$O=d==="human"&&p?p:s?.agentName??a.chatName,WO=d==="human"?a.liveSupport:d==="queued"?a.waitingForTeam:s?.offline?a.statusOffline:a.statusOnline,Np=!be&&!ut?s?.availableActions:void 0,qO=!be&&!ut?s?.actions:void 0,Bp=Qt&&!Zi&&Ct==="connecting"&&!ut;return _(o5,{value:a,children:_("div",{class:"cf-root","data-theme":ja,"data-align":e.alignment,"data-display":"floating",style:VO,children:[er&&i&&_("div",{class:"cf-theater-backdrop",onClick:EO}),_("div",{ref:Le,class:`cf-panel ${i?"is-open":""} ${Qt?"cf-panel--call":""} ${Bp?"cf-panel--voice-connecting":""} ${er&&i?"cf-panel--theater":""} ${Cs?"cf-panel--analytics-focus":""}`,role:"dialog","aria-modal":"false","aria-label":`${a.chatName}: ${s?.agentName??a.assistantName}`,"aria-hidden":!i,children:[Tt&&i&&_(PE,{state:Tt,onClose:ue}),_("div",{class:"cf-header",children:[_(o1,{persona:s,hideWhenMissing:!0}),_("div",{class:"cf-header__meta",children:[_("div",{class:"cf-header__name",children:$O}),_("div",{class:`cf-header__status ${d==="ai"&&s?.offline?"cf-header__status--offline":""}`,children:_("span",{class:"cf-header__status-text",children:WO})})]}),_("div",{class:"cf-header__actions",children:[ze.length>0&&_("button",{type:"button",class:"cf-header__btn","aria-label":a.pastConversations,title:a.pastConversations,"aria-pressed":na,onClick:()=>ei(N=>!N),children:_(T5,{})}),du&&!be&&!ut&&_("button",{type:"button",class:"cf-header__btn","aria-label":a.endChat,title:a.endChat,onClick:MO,children:_(kp,{})}),e.sound&&te&&_("button",{type:"button",class:"cf-header__btn","aria-label":An?a.unmuteSounds:a.muteSounds,"aria-pressed":An,onClick:Se,children:An?_(x5,{}):_(b5,{})}),_("button",{type:"button",class:"cf-header__btn cf-header__close","aria-label":a.closeChat,onClick:ln,children:_(Ya,{})})]})]}),_("div",{class:"cf-panel__video",children:Cs?_("div",{class:"cf-analytics-focus",role:"region","aria-label":a.expandedAnalyticsResult,children:_(h1,{visualization:Cs,expanded:!0,onClose:RO})}):!ut&&Z1?_(Y5,{persona:s,starters:[],onPick:y,onFocusComposer:OO,speaking:u,voiceState:Ct,replyPending:Qt&&c&&!u,pinned:!0,muted:Cn,onToggleMute:uu,onEndCall:nr,onTalkNow:BO,showTalkNow:zO,micLevel:an,theaterMode:er,onToggleTheater:LO,onMinimize:ln,audioDevices:xs,selectedAudioDeviceId:Ss,onSelectAudioDevice:NO,connectingOnly:Bp}):null}),!Bp&&_("div",{class:"cf-panel__chat",children:[e.preview&&_("div",{class:"cf-preview-banner",children:a.previewBanner}),ut&&_("div",{class:"cf-viewing-banner",children:a.viewingPast}),_("div",{class:"cf-body",ref:Ae,role:"log",onScroll:IO,children:[Is.map((N,$)=>_(hE,{msg:N,persona:s,isLast:!ut&&$===Is.length-1,visitor:f,hasEmail:h,lastQuestion:GO,showActions:!ut&&$===Is.length-1&&!!(N.handoffOffered||N.selectedAction),onPickReply:UO,onSubmitForm:P,onDemoSlots:ge,onConfirmHostedBooking:V,onRetry:M,ratable:!ut&&Is.slice(0,$).some(fe=>fe.role==="user"),onRate:T,onExpandVisualization:ut?void 0:PO,onOpenAttachment:tn,onReconnect:!ut&&!be&&De&&N.id===Cr?L:void 0},N.id)),!du&&!ut&&_(Me,{children:[Is.length===0&&_(tO,{name:s?.agentName??a.assistantName,greeting:s?.greeting}),_(uE,{items:g,onPick:y}),_(fE,{items:v})]}),st&&_("button",{type:"button",class:"cf-newmsg",onClick:aa,children:[_(D5,{}),a.newMessages]})]}),_("div",{class:"cf-sr-live","aria-live":"polite","aria-atomic":"true",children:FO}),c&&!be&&!ut&&_("div",{class:"cf-stopbar",children:_("button",{type:"button",class:"cf-stop",onClick:w,children:[_(k5,{}),a.stop]})}),ut?_("div",{class:"cf-ended",children:_("button",{type:"button",class:"cf-ended__btn",onClick:Xe,children:a.backToChat})}):be?_("div",{class:"cf-ended",children:[_("p",{class:"cf-ended__text",children:a.conversationEnded}),e.csat&&du?CO?_("p",{class:"cf-ended__text",children:a.feedbackThanks}):_("div",{class:"cf-csat",children:[_("span",{class:"cf-csat__q",children:a.csatPrompt}),_("button",{type:"button",class:"cf-csat__btn","aria-label":a.feedbackHelpful,onClick:()=>{j("up"),O1(!0)},children:_(t1,{})}),_("button",{type:"button",class:"cf-csat__btn","aria-label":a.feedbackNotHelpful,onClick:()=>{j("down"),O1(!0)},children:_(r1,{})})]}):null,_("button",{type:"button",class:"cf-ended__btn",onClick:DO,children:a.startNewChat})]}):_(Me,{children:[m?_("div",{class:"cf-live-typing","aria-live":"polite",children:ct(a.agentTyping,{name:m})}):null,Np&&Np.length>0&&_("div",{class:"cf-footer-actions",children:_(f1,{actions:Np,descriptors:qO,visitor:f,onSubmitForm:P,onDemoSlots:ge,onConfirmHostedBooking:V,scheduler:s?.scheduler,translations:e.actionTranslations})},"footer-actions"),_(kE,{draftStore:TO,onSend:y,onSendGif:b,onTyping:x,disabled:c,allowVoice:X1,onTranscribe:H,gifEnabled:xe,onSearchGifs:Te,allowAttach:e.attachments,analyzeAttachments:!0,onUpload:Z,onPreviewAttachment:F},"composer")]}),!be&&s?.disclaimerText&&_("div",{class:"cf-disclaimer",children:s.disclaimerText}),_("div",{class:"cf-footer",children:[_("button",{type:"button",class:"cf-footer__privacy","aria-label":a.clearDeviceData,onClick:()=>Qa(!0),children:a.privacyAndData}),_("span",{"aria-hidden":"true",children:"·"}),a.poweredBy," ",_("a",{href:"https://accurix.tech/centrinfo",target:"_blank",rel:"noopener noreferrer",children:"Centrinfo"})]})]}),Ar&&_("div",{class:"cf-confirm",onClick:()=>Dn(!1),children:_("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":a.endChatConfirm,onClick:N=>N.stopPropagation(),onKeyDownCapture:N=>Rp(N,N.currentTarget,()=>Dn(!1)),children:[_("div",{class:"cf-confirm__title",children:a.endChatConfirm}),_("div",{class:"cf-confirm__body",children:a.endChatConfirmBody}),_("div",{class:"cf-confirm__actions",children:[_("button",{ref:R1,type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>Dn(!1),children:a.cancel}),_("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:AO,children:a.endConfirmCta})]})]})},"confirm-end"),na&&_("div",{class:"cf-confirm",onClick:()=>ei(!1),children:_("div",{class:"cf-history",role:"dialog","aria-modal":"true","aria-label":a.pastConversations,onClick:N=>N.stopPropagation(),onKeyDownCapture:N=>Rp(N,N.currentTarget,()=>ei(!1)),children:[_("div",{class:"cf-history__head",children:[_("span",{children:a.pastConversations}),_("button",{type:"button",class:"cf-header__btn","aria-label":a.closeHistory,onClick:()=>ei(!1),children:_(Ya,{})})]}),_("div",{class:"cf-history__list",children:ze.map(N=>_("button",{type:"button",class:`cf-history__item ${N.sessionId===oe?"is-active":""}`,onClick:()=>{ot(N.sessionId),ei(!1)},children:[_("span",{class:"cf-history__title",children:N.title}),_("span",{class:"cf-history__meta",children:[new Date(N.ts).toLocaleDateString(void 0,{month:"short",day:"numeric"}),N.ended?` · ${a.historyEnded}`:""]})]},N.sessionId))}),_("div",{class:"cf-history__footer",children:_("button",{type:"button",class:"cf-history__clear",onClick:()=>{ei(!1),Qa(!0)},children:a.clearDeviceData})})]})},"history"),Ja&&_("div",{class:"cf-confirm",onClick:()=>Qa(!1),children:_("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":a.clearDeviceData,onClick:N=>N.stopPropagation(),onKeyDownCapture:N=>Rp(N,N.currentTarget,()=>Qa(!1)),children:[_("div",{class:"cf-confirm__title",children:a.clearDeviceData}),_("div",{class:"cf-confirm__body",children:a.clearDeviceDataBody}),_("div",{class:"cf-confirm__actions",children:[_("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>Qa(!1),children:a.cancel}),_("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:()=>{Qa(!1),kt()},children:a.clearDeviceDataCta})]})]})},"confirm-clear")]}),Qt&&!i?_(wE,{persona:s,voiceState:Ct,muted:Cn,onToggleMute:uu,onEndCall:nr,micLevel:an,onExpand:Ki}):er&&i?null:!e.hideDefaultLauncher&&_("button",{ref:ve,type:"button",class:"cf-launcher","aria-label":i?a.closeChat:we>0?`${a.openChat}. ${we===1?a.unreadMessage:ct(a.unreadMessages,{count:String(we)})}`:a.openChat,"aria-expanded":i,onClick:Ms,children:[e.launcherIcon?_("img",{class:"cf-launcher__img",src:e.launcherIcon,alt:""}):_(u5,{}),!i&&we>0&&_("span",{class:"cf-launcher__badge","aria-hidden":"true",children:we>99?"99+":we})]})]})})},hO="https://api.accurixtech.com",pO=()=>typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en",vO=(t,e)=>{if(!t)return;const r=e.trim().toLowerCase(),n=r.split("-")[0]??r,a=Object.entries(t);return a.find(([i])=>i.toLowerCase()===r)?.[1]??a.find(([i])=>i.toLowerCase()===n)?.[1]},gO=t=>{if(!t||typeof t.token!="string"||t.token.length===0)throw new Error("[centrinfo-widget] `token` is required — pass your pub_* token to Centrinfo.init({ token }).");const e=t.locale?.trim()||pO(),r=vO(t.translations,e);return{token:t.token,chatSurface:t.chatSurface??"floating",analyticsContextToken:t.analyticsContextToken,identityToken:t.identityToken,getIdentityToken:t.getIdentityToken,apiBaseUrl:(t.apiBaseUrl??hO).replace(/\/$/,""),accentColor:t.accentColor,themeTokens:t.themeTokens,agentName:t.agentName?.trim()||void 0,agentAvatarUrl:t.agentAvatarUrl?.trim()||void 0,launcherIcon:t.launcherIcon,gifApiKey:t.gifApiKey,theme:t.theme??"auto",openByDefault:t.openByDefault??!1,sound:t.sound??!0,starters:t.starters??[],strings:i5({...r?.labels,...t.labels}),locale:e,actionTranslations:r?.actions??{},persistence:t.persistence??"local",attachments:t.attachments??!0,zIndex:t.zIndex??2147483e3,styleNonce:t.styleNonce?.trim()??"",demo:t.demo??!1,preview:t.preview??!1,alignment:t.alignment==="left"?"left":"right",horizontalPadding:typeof t.horizontalPadding=="number"?t.horizontalPadding:20,verticalPadding:typeof t.verticalPadding=="number"?t.verticalPadding:20,hideDefaultLauncher:t.hideDefaultLauncher??!1,customLauncherSelector:t.customLauncherSelector,sessionDurationMinutes:typeof t.sessionDurationMinutes=="number"?t.sessionDurationMinutes:0,configRefreshSeconds:typeof t.configRefreshSeconds=="number"?t.configRefreshSeconds:30,proactiveMessage:t.proactiveMessage,proactiveDelaySeconds:typeof t.proactiveDelaySeconds=="number"?t.proactiveDelaySeconds:5,proactiveOnPaths:t.proactiveOnPaths,csat:t.csat??!0,user:t.user,onOpen:t.onOpen,onClose:t.onClose,onShow:t.onShow,onHide:t.onHide,onUnreadChange:t.onUnreadChange,onMessage:t.onMessage,onAction:t.onAction,onHandoff:t.onHandoff}},D1=`
175
+ [The visitor attached a file${et}. It is saved for staff, but its contents were not available to the AI. Do not claim to have inspected it.]`.trim())}!De&&E&&(De=E);const ct=st.map(Ee=>({id:Ee.id,name:Ee.name})),Ye=st.flatMap(Ee=>Ee.id?[Ee.id]:[]),Pe={id:re||ut(),role:"user",content:z,imageUrl:E,attachments:ct.length>0?ct:void 0};st.forEach((Ee,et)=>{Ee.file&&(g.current.set(`${Pe.id}:${et}`,Ee.file),Ee.id&&g.current.set(Ee.id,Ee.file))});const kt=ut();M(Ee=>[...!!(re&&Ee.some(we=>we.id===re))?Ee.map(we=>we.id===re?{...we,content:z,pending:!1,streaming:!1,imageUrl:E,attachments:Pe.attachments}:we):[...Ee,Pe],{id:kt,role:"assistant",content:"",pending:!0}]),gn("send"),t.onMessage?.({role:"user",content:De}),_.current[kt]=Pe.id,c.current={userId:Pe.id,agentId:kt,text:z,backendText:De},xt(De,kt,{forceVoicePlayback:_e,clientMessageId:Pe.id,attachmentId:Ye[0],attachmentIds:Ye})},[L,t,xt]),yt=O((b,w,z,E,G)=>{const te=ut();M(se=>[...se.filter(ne=>ne.id!==b.agentId&&(!E.userMessageId||ne.id!==E.userMessageId)).map(ne=>ne.id===b.userId?{...ne,content:w,pending:!1,streaming:!1}:ne),{id:te,role:"assistant",content:"",pending:!0}]),G&&t.onMessage?.({role:"user",content:G}),_.current[te]=b.userId,c.current={userId:b.userId,agentId:te,text:w,backendText:z},xt(z,te,{forceVoicePlayback:E.forceVoicePlayback,clientMessageId:ut()})},[t,xt]),jn=O((b,w={})=>{const z=b.trim();if(!z||L)return;const E=s.current&&!s.current.signal.aborted?c.current:null,G=E??u.current;if(u.current=null,!G){Nt(z,w);return}E&&s.current?.abort(),yt(G,`${G.text} ${z}`.replace(/\s+/g," ").trim(),`${G.backendText}
176
+ ${z}`.trim(),w,z)},[L,yt,Nt]),tn=O(()=>{const b=s.current&&!s.current.signal.aborted?c.current:null;return b?(u.current=b,s.current?.abort(),!0):!1},[]),at=O(()=>{const b=u.current;u.current=null,!(!b||L)&&yt(b,b.text,b.backendText,{forceVoicePlayback:!0})},[L,yt]),Rt=O(()=>s.current?.abort(),[]),bn=O(b=>{f.current=b;const w=l.current;w&&(w.volume=b?.2:1),d.current&&typeof window<"u"&&"speechSynthesis"in window&&(b?window.speechSynthesis.pause():window.speechSynthesis.resume())},[]),qt=O(()=>{p.current?.(),p.current=null,f.current=!1,pt(),Z(b=>b.status==="speaking"||b.status==="answering"?{...b,status:"done"}:b),l.current?.pause(),l.current=null,typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),d.current=null,q(!1)},[pt]),ft=O(b=>{const w=ko(b);if(!w)return Promise.resolve(!1);pt();const z=!!(m?.allowVoiceInput&&m?.voiceOutputEnabled&&m.talkbackMode!=="text"),E=(G,te)=>new Promise(se=>{let ne=!1;So(l,d,G,te,m?.voiceSpeed??1,w,!0,()=>{ne=!0,q(!0)},()=>{q(!1),se(ne)})||(q(!1),se(!1))});return z?e.speak(w).then(G=>G.audioBase64?E(G.audioBase64,G.mimeType):(wa("Talkback prompt TTS did not return provider audio.",{providerReady:G.providerReady,message:G.message,voiceProvider:m?.voiceProvider,voiceOutputEnabled:m?.voiceOutputEnabled,talkbackMode:m?.talkbackMode}),E())).catch(G=>(wa("Talkback prompt TTS request failed before audio playback.",{error:G instanceof Error?G.message:String(G),voiceProvider:m?.voiceProvider,voiceOutputEnabled:m?.voiceOutputEnabled,talkbackMode:m?.talkbackMode}),E())):(wa("Talkback prompt wanted voice, but the loaded widget token config has provider TTS disabled.",{voiceOutputEnabled:m?.voiceOutputEnabled,talkbackMode:m?.talkbackMode,voiceProvider:m?.voiceProvider}),E())},[m?.allowVoiceInput,m?.talkbackMode,m?.voiceOutputEnabled,m?.voiceSpeed,pt,e]),Vt=O((b,w,z={})=>{if(j||L||!w)return;de(b,{content:"",pending:!0,streaming:!1,error:!1}),gn("send");const E=F.findIndex(te=>te.id===b),G=E>0?F[E-1]:void 0;xt(w,b,{...z,clientMessageId:_.current[b]??(G?.role==="user"?G.id:void 0)})},[j,L,F,de,xt]),Lt=O((b,w,z)=>{de(b,{feedback:w});const E=F.findIndex(se=>se.id===b),G=E>=0?F[E]?.content:void 0;let te;for(let se=E-1;se>=0;se--)if(F[se]?.role==="user"){te=F[se]?.content;break}e.sendFeedback({sessionId:o.current,messageId:b,rating:w,comment:z,question:te,answer:G}).catch(()=>{})},[e,de,F]),nn=O(async(b,w,z={},E)=>{t.onAction?.(b);const G=b==="public_contact_support"||b==="public_submit_inquiry"?{actionId:b}:{},te=await e.action(b,{sessionId:o.current,...w,...G},E),se={};return z.name?.trim()&&(se.name=z.name.trim()),z.email?.trim()&&(se.email=z.email.trim()),z.phone?.trim()&&(se.phone=z.phone.trim()),Object.keys(se).length>0&&(fe(ne=>{const _e={...ne,...se};return Ge(_e),_e}),se.email&&b!=="contact"&&e.action("contact",{sessionId:o.current,...se}).catch(()=>{})),gn("receive"),te},[e,t,Ge]),_t=O((b,w,z)=>e.confirmHostedBooking?.({sessionId:o.current,inquiryId:b,eventUri:w,inviteeUri:z})??Promise.resolve(void 0),[e]),Xe=O(b=>{const w=b.trim();w&&M(z=>z.some(E=>E.role==="assistant"&&E.content===w)?z:[...z,{id:ut(),role:"assistant",content:w}])},[]),Dt=O(()=>{const b=Io(m?.actions);return b?(M(w=>[...w,{id:ut(),role:"assistant",content:t.strings.reconnectPrompt,actions:[b],selectedAction:b.id,handoffOffered:!0,reconnectOffer:!0,createdAt:new Date().toISOString()}]),!0):!1},[t.strings.reconnectPrompt,m?.actions]),ht=O(b=>{X.current=!0;const w=ut();return M(z=>[...z,{id:w,role:"user",content:b.trim(),pending:!0}]),w},[]),Pt=O((b,w)=>{M(z=>z.map(E=>E.id===b?{...E,...w}:E))},[]),jt=O(b=>{M(w=>w.filter(z=>z.id!==b))},[]),Hn=O(async(b,w="widget")=>{if(!e.sendExplanationFeedback)throw new Error("Explanation feedback is unavailable.");await e.sendExplanationFeedback({...b,sessionId:o.current,surface:w})},[e]),Wn=O((b="widget")=>{const w=e.fetchExplanation?.bind(e);if(!w)return;const z=e.retryExplanation?.bind(e),E=G=>G;return{poll:async(G,te)=>E(await w(G,o.current,b,te)),settled:(G,te)=>{te!=="not_requested"&&M(se=>se.map(ne=>{const _e=ne.visualization?.explanation?.aiExplanation;return!_e||(_e.explanationId??ne.visualization?.explanation?.explanationId)!==G||_e.status===te?ne:{...ne,visualization:{...ne.visualization,explanation:{...ne.visualization.explanation,aiExplanation:{..._e,status:te}}}}}))},...z?{retry:async G=>E(await z(G,o.current,b))}:{}}},[e]),vn=O((b,w)=>{e.sendFeedback({sessionId:o.current,messageId:"__csat__",rating:b,comment:w}).catch(()=>{})},[e]),ee=O(async(b,w,z,E)=>{const G=yr();try{if(typeof b!="string"&&e.transcribeAudio)return await e.transcribeAudio(b,w,z,E);const te=typeof b=="string"?b:await fu(b);return await e.transcribe(te,w,z,E)}finally{_a("voice-transcription",G)}},[e]),pe=O(async(b,w,z=0)=>{const E=g.current.get(`${b.id}:${z}`)??(w.id?g.current.get(w.id):void 0);if(E)return E;if(!w.id||!e.fetchAttachment)throw new Error("This file is no longer available.");return e.fetchAttachment(w.id,o.current)},[e]),$e=O((b,w,z,E)=>e.uploadAttachment?e.uploadAttachment(b,w,z,o.current,E):Promise.reject(new Error("File upload is unavailable")),[e]),ue=O(b=>e.searchGifs(b),[e]),ve=O((b,w)=>e.demoSlots(b,w),[e]),wt=O(b=>Nt("",{imageUrl:b}),[Nt]),Ot=t.demo||!!t.gifApiKey,Ta=O(()=>{s.current?.abort(),$(!0),e.endConversation(o.current).catch(()=>{})},[e]),an=O(()=>{s.current?.abort();const b=Bn(t);o.current=b;try{a?.setItem(qn(i),b)}catch{}Ce(null),Ie([]),$(!1),ge("ai"),be(void 0),Je(void 0),He.current=new Date().toISOString(),M(m?[{id:ut(),role:"assistant",content:m.greeting,availableActions:m.availableActions,actions:m.actions}]:[])},[a,i,m]),Gn=O(b=>{if(ae){if(b===o.current){Ce(null);return}Ie(Co(a,i,b)),Ce(b)}},[a,i,ae]),Ht=O(()=>{Ce(null),Ie([])},[]),Tt=t.starters.length>0?t.starters:m?.starterQuestions??[],Ct=m?.featuredLinks??[];return{persona:m,messages:F,sending:j,assistantSpeaking:D,voiceReply:C,visitor:P,starters:Tt,featuredLinks:Ct,hasEmail:!!P.email,liveMode:Ae,assignedAgentName:Ze,agentTypingName:ie,send:Nt,amend:jn,hold:tn,resumeHeld:at,duckSpeaking:bn,sendGif:wt,notifyTyping:dt,stop:Rt,retry:Vt,rateMessage:Lt,rateExplanation:Hn,explanationTransport:Wn,injectAssistant:Xe,reconnectSupport:Dt,appendUserDraft:ht,patchMessage:Pt,removeMessage:jt,submitCsat:vn,submitForm:nn,confirmHostedBooking:_t,transcribe:ee,uploadAttachment:$e,loadAttachment:pe,searchGifs:ue,demoSlots:ve,gifEnabled:Ot,identify:tt,ended:L,endConversation:Ta,startNew:an,history:ae?oe:[],viewingSessionId:ke,viewMessages:Le,openConversation:Gn,closeHistoryView:Ht,shutdown:Qe,stopSpeaking:qt,speakAssistantText:ft}},qu=({name:e,greeting:t})=>{const n=ot();return r("section",{class:"cf-empty-welcome","aria-label":Ve(n.welcomeLabel,{name:e}),children:[r("span",{class:"cf-empty-welcome__eyebrow",children:n.welcomeEyebrow}),r("h2",{children:e}),r("p",{children:t||n.welcomePrompt})]})},Tr=(e,t,n)=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),n();return}if(e.key!=="Tab")return;const a=Array.from(t.querySelectorAll('button, [href], textarea, input, select, [tabindex]:not([tabindex="-1"])')).filter(l=>!l.hasAttribute("disabled")&&l.getAttribute("aria-hidden")!=="true"&&l.tabIndex>=0);if(a.length===0)return;const i=t.getRootNode(),o=e.composedPath()[0],s=o instanceof HTMLElement?o:"activeElement"in i?i.activeElement:document.activeElement,c=a[0],u=a[a.length-1];e.shiftKey&&(s===c||!t.contains(s))?(e.preventDefault(),e.stopPropagation(),u.focus()):!e.shiftKey&&(s===u||!t.contains(s))&&(e.preventDefault(),e.stopPropagation(),c.focus())},$a=new Map,Eo=e=>{if(!e||typeof document>"u"||typeof CanvasRenderingContext2D>"u")return;const t=document.createElement("canvas").getContext("2d");if(!t)return;t.fillStyle="#010203",t.fillStyle=e;const n=t.fillStyle;if(n==="#010203"&&e.trim().toLowerCase()!=="#010203")return;const a=n.match(/^#([\da-f]{6})$/i)?.[1];if(a)return[Number.parseInt(a.slice(0,2),16),Number.parseInt(a.slice(2,4),16),Number.parseInt(a.slice(4,6),16),1];const i=n.match(/^rgba?\(([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:[, /]+([\d.]+))?\)$/i);if(!i)return;const o=i.slice(1,5).map(Number);if(!o.some(s=>!Number.isFinite(s)))return[o[0],o[1],o[2],o[3]??1]},Vu=(e,t="#ffffff")=>{const n=`${e??""}|${t}`;if($a.has(n))return $a.get(n);const a=Eo(e),i=Eo(t)??[255,255,255,1];if(!a){$a.set(n,void 0);return}const o=a[3],c=a.slice(0,3).map((g,f)=>g*o+i[f]*(1-o)).map(g=>{const f=g/255;return f<=.04045?f/12.92:((f+.055)/1.055)**2.4}),u=c[0]*.2126+c[1]*.7152+c[2]*.0722,l=1.05/(u+.05),d=(u+.05)/.059,p=l>=d?"#ffffff":"#0f1e2a";return $a.set(n,p),p},ju=e=>{const[t,n]=S("light");return J(()=>{if(e!=="auto"||typeof matchMedia>"u")return;const a=matchMedia("(prefers-color-scheme: dark)"),i=()=>n(a.matches?"dark":"light");return i(),a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[e]),e==="auto"?t:e},Hu=6e4,Wu=90,zo={end:"end the call",mute:"mute your microphone",minimize:"minimize the chat",expand:"expand the view",shrink:"exit the expanded view"},No=e=>e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s']/gu," ").replace(/\s+/g," ").trim(),Gu=[{action:"shrink",re:/\b(?:exit|leave|quit|close)\b[\s\w]*\b(?:full ?screen|expanded|theat(?:er|re))\b|\bshrink\b|\bsmaller view\b/},{action:"end",re:/\b(?:end|close|stop|finish|hang ?up|quit|exit)\b[\s\w]*\b(?:call|chat|conversation|convo|session|talking)\b|\bhang ?up\b|\bgood ?bye\b|^bye(?: bye)?$/},{action:"mute",re:/\bmute\b|\bstop listening\b/},{action:"minimize",re:/\bminimi[sz]e\b|\bhide\b[\s\w]*\b(?:chat|call|window|widget)\b/},{action:"expand",re:/\bexpand\b|\bmaximi[sz]e\b|\bfull ?screen\b|\btheat(?:er|re) mode\b|\bbigger view\b/}],Ku=/^(?:yes|yeah|yep|yup|sure|correct|confirm|affirmative|go ahead|do it|please do|ok(?:ay)?)\b/,Yu=/^(?:no|nope|nah|cancel|never ?mind|don'?t|stop)\b/,Zu=/^(?:end|close|stop|finish|hang ?up|quit|exit|bye|good ?bye)\b/,Ju=e=>{const t=No(e);if(!t)return null;for(const{action:n,re:a}of Gu)if(a.test(t)){const i=t.split(" ").length;return{action:n,confident:n==="end"?i<=10:i<=6}}return null},Xu=e=>`I didn't catch yes or no. Say yes to ${zo[e]}, or no to keep talking.`,Qu=({transport:e,config:t,bindControls:n,composerDraftStore:a})=>{const i=t.strings,[o,s]=S(t.openByDefault),{persona:c,messages:u,sending:l,assistantSpeaking:d,visitor:p,hasEmail:g,liveMode:f,assignedAgentName:y,agentTypingName:h,starters:I,featuredLinks:x,send:m,sendGif:T,notifyTyping:F,stop:M,amend:Q,hold:Y,resumeHeld:X,duckSpeaking:j,retry:U,rateMessage:D,rateExplanation:q,explanationTransport:C,injectAssistant:Z,reconnectSupport:_,appendUserDraft:L,patchMessage:$,removeMessage:P,submitCsat:fe,submitForm:oe,confirmHostedBooking:Ue,transcribe:ke,uploadAttachment:Ce,loadAttachment:Le,searchGifs:Ie,demoSlots:Ae,gifEnabled:ge,identify:Ze,ended:be,endConversation:ie,startNew:Je,history:He,viewingSessionId:k,viewMessages:K,openConversation:V,closeHistoryView:H,shutdown:ae,stopSpeaking:ye,speakAssistantText:Se}=Bu(e,t,o),Qe=Uu(u,f),[Ge,tt]=S(null),nt=R(0),A=O((v,N,le)=>{le===nt.current&&tt({status:"ready",name:N,url:URL.createObjectURL(v),mimeType:v.type||"application/octet-stream"})},[]),he=O((v,N,le)=>{const Me=N.name,Ne=++nt.current;tt({status:"loading",name:Me}),Le(v,N,le).then(gt=>A(gt,Me,Ne),()=>{Ne===nt.current&&tt({status:"error",name:Me})})},[Le,A]),de=O((v,N)=>A(v,N,++nt.current),[A]),me=O(()=>{nt.current+=1,tt(null)},[]);J(()=>()=>{Ge?.status==="ready"&&URL.revokeObjectURL(Ge.url)},[Ge]);const Fe=!!Io(c?.actions),[We,pt]=S(0),[dt,xt]=S({mic:"off",processing:!1}),[Nt,yt]=S(null),[jn,tn]=S(!1),[at,Rt]=S(!1),[bn,qt]=S(!1),[ft,Vt]=S(!1),[Lt,nn]=S(0),[_t,Xe]=S(!1),[Dt,ht]=S(null),[Pt,jt]=S(null),[Hn,Wn]=S([]),[vn,ee]=S(""),[pe,$e]=S(()=>{try{return localStorage.getItem("centrinfo:muted")==="1"}catch{return!1}}),ue=ju(t.theme),ve=c?.soundEnabled??!0;J(()=>{lu(t.sound&&ve&&!pe)},[t.sound,ve,pe]);const wt=O(()=>{$e(v=>{const N=!v;try{localStorage.setItem("centrinfo:muted",N?"1":"0")}catch{}return N})},[]),Ot=R(null),Ta=R(null),an=R(null),Gn=R(0),Ht=R(!1),Tt=R(!1),Ct=R(null),b=R(0),w=R(void 0),z=R(0),E=R(null),G=R(!1),te=R(null),se=R(""),ne=R(()=>{}),_e=R(""),re=R(l),st=R(m);st.current=m;const De=R(Q);De.current=Q;const ct=R(ke);ct.current=ke;const Ye=R(!1),Pe=R(!1),kt=R("");kt.current=[...u].reverse().find(v=>v.role==="assistant")?.content??"";const Ee=R(d);re.current=l,Ee.current=d;const et=at?jn?"timeout":ft||dt.mic==="muted"?"muted":dt.mic==="unavailable"?dt.reason==="permission-denied"||dt.reason==="unsupported"?"denied":"unavailable":dt.mic==="off"||dt.mic==="starting"?"connecting":dt.mic==="hearing"?"hearing":d?"speaking":Nt??(dt.processing||l?"processing":"listening"):"idle",[W,we]=S(!0),[Be,xe]=S(!1),rt=R(0),[mt,Ft]=S(!1),[rn,on]=S(!1),Uo=R(null),[Wt,sn]=S(!1),pp=R({value:""}),fp=a??pp.current,Bo=R({confirmEnd:mt,confirmClear:rn,showHistory:Wt});Bo.current={confirmEnd:mt,confirmClear:rn,showHistory:Wt};const[hp,qo]=S(!1),ze=!!k,Ca=ze?K:u,Kn=Ca.find(v=>v.id===Dt&&v.visualization)?.visualization,Yn=Ca.find(v=>v.id===Pt&&v.visualization);J(()=>{!Pt||Yn||(jt(null),Xe(!1))},[Pt,Yn]),J(()=>{!Dt||Kn||(ht(null),Xe(!1))},[Kn,Dt]);const xn=O(()=>{s(!0),pt(0),gn("open"),t.onOpen?.(),t.onShow?.()},[t]),At=O(()=>{s(!1),Xe(!1),ht(null),t.onClose?.(),t.onHide?.(),Ta.current?.focus()},[t]),Zn=O(()=>o?At():xn(),[o,xn,At]),mp=O(()=>Ft(!0),[]),gp=O(()=>{ie(),Ft(!1)},[ie]),bp=O(()=>{Je(),xe(!1),we(!0)},[Je]);J(()=>{mt&&Uo.current?.focus()},[mt]),J(()=>{n({open:xn,close:At,toggle:Zn,identify:Ze,startNew:Je,endConversation:ie,shutdown:ae})},[n,xn,At,Zn,Ze,Je,ie,ae]),J(()=>{const v=u.filter(N=>N.role==="assistant"&&!N.pending).length;if(o){Gn.current=v;return}v>Gn.current&&pt(v-Gn.current)},[u,o]),J(()=>{t.onUnreadChange?.(We)},[We,t]),J(()=>{const v=t.sessionDurationMinutes;if(!v||v<=0)return;const N=setTimeout(()=>ae(),v*60*1e3);return()=>clearTimeout(N)},[t.sessionDurationMinutes,u,o,ae]),J(()=>{const v=t.customLauncherSelector;if(!v||typeof document>"u")return;let N=[];try{N=Array.from(document.querySelectorAll(v))}catch{return}const le=Me=>{Me.preventDefault(),Zn()};return N.forEach(Me=>Me.addEventListener("click",le)),()=>N.forEach(Me=>Me.removeEventListener("click",le))},[t.customLauncherSelector,Zn]);const Vo=R(!1);J(()=>{const v=t.proactiveMessage?.trim();if(!v||Vo.current)return;const N=t.proactiveOnPaths??[],le=typeof location<"u"?location.pathname:"";if(N.length>0&&!N.some(gt=>le.includes(gt)))return;const Me=`centrinfo:proactive:${t.token.slice(0,12)}`;try{if(sessionStorage.getItem(Me)==="1")return}catch{}const Ne=setTimeout(()=>{if(!(o||be||u.some(gt=>gt.role==="user"))){Vo.current=!0;try{sessionStorage.setItem(Me,"1")}catch{}Z(v),xn()}},Math.max(0,t.proactiveDelaySeconds)*1e3);return()=>clearTimeout(Ne)},[t.proactiveMessage]),J(()=>{const v=an.current;if(!o||!v)return;const N=u[u.length-1],le=Date.now()<rt.current;N?.role==="user"||W||le?(requestAnimationFrame(()=>{v.scrollTop=v.scrollHeight}),xe(!1),le&&we(!0)):xe(!0)},[u,o,l,W]);const jo=R(!0);jo.current=W,J(()=>{const v=an.current;if(!(!o||!v))return yc(v,{isAtBottom:()=>jo.current,onUnseen:()=>xe(!0)})},[o,ze]);const vp=O(()=>{const v=an.current;if(!v)return;if(Ht.current&&!ze){we(!0),xe(!1);return}const N=v.scrollHeight-v.scrollTop-v.clientHeight<80;we(N),N&&xe(!1)},[ze]),Gt=O(()=>{const v=an.current;v&&(v.scrollTop=v.scrollHeight),xe(!1),we(!0)},[]),Aa=O(()=>{rt.current=Date.now()+3e3,requestAnimationFrame(Gt)},[Gt]);J(()=>{if(!o||ze||!at||et==="connecting")return;rt.current=Date.now()+6e4,Gt();const v=requestAnimationFrame(()=>{Gt(),requestAnimationFrame(Gt)}),N=[80,180,360].map(le=>window.setTimeout(Gt,le));return()=>{cancelAnimationFrame(v),N.forEach(le=>window.clearTimeout(le))}},[d,u,o,Gt,l,at,ze,et]);const Ho=O(()=>{Ot.current?.querySelector(".cf-textarea")?.focus()},[]),Jn=O((v,N)=>{yt(v),w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>yt(null),3e3),N&&!Tt.current&&Se(N)},[Se]),Ma=O(v=>{const N=te.current;if(N)return N;Aa();const le=L(v);return te.current=le,$(le,{content:se.current||v,pending:!0,streaming:!1}),le},[L,Aa,$]),Ut=O(()=>{const v=te.current;if(v){if(se.current){$(v,{content:se.current,pending:!0});return}te.current=null,P(v)}},[$,P]),Kt=O(()=>{Pe.current&&(Pe.current=!1,j(!1)),Ye.current&&(Ye.current=!1,X())},[j,X]),lt=O(()=>{Ht.current=!1,Ct.current?.stop("call-ended"),Ct.current=null,Ye.current=!1,Pe.current=!1,Tt.current=!1,E.current=null,G.current=!1;const v=te.current;te.current=null,se.current="",v&&P(v),w.current&&window.clearTimeout(w.current),yt(null),tn(!1),xt({mic:"off",processing:!1}),nn(0),Rt(!1),qt(!1),Vt(!1),Xe(!1),ht(null),ye()},[P,ye]),xp=O(()=>{_t&&ht(null),Xe(!_t)},[_t]),yp=O(v=>{ht(v),Xe(!0)},[]),_p=O(v=>{jt(v),Xe(!0)},[]),Ia=O(()=>{const v=Dt,N=Pt;ht(null),jt(null),Xe(!1),window.requestAnimationFrame(()=>{(N?Ot.current?.querySelector(`[data-explanation-message="${N}"]`)?.querySelector('[data-testid="analytics-explanation-expand"]'):Array.from(Ot.current?.querySelectorAll("[data-visualization-message]")??[]).find(Me=>Me.dataset.visualizationMessage===v))?.focus()})},[Dt,Pt]),wp=O(()=>{ht(null),jt(null),Xe(!1)},[]),Wo=O((v,N,le=!1)=>{if(Aa(),N&&($(N,{content:v,pending:!1,streaming:!1}),te.current===N&&(te.current=null)),se.current="",le){ye(),De.current(v,{forceVoicePlayback:!0,userMessageId:N});return}Ht.current&&(Y()?De.current(v,{forceVoicePlayback:!0,userMessageId:N}):st.current(v,{forceVoicePlayback:!0,userMessageId:N}))},[Aa,Y,$,ye]),Mt=O(v=>{Z(v),Se(v)},[Z,Se]),Go=O(()=>{if(b.current=Date.now(),yt(null),Ee.current){Pe.current=!0,j(!0);return}Ye.current||(Ye.current=Y()),Ma("Listening...")},[j,Ma,Y]),Ko=O(v=>{const N=te.current;if(!N||Pe.current)return;const le=[se.current,v].filter(Boolean).join(" ");$(N,{content:`${le} ...`,pending:!0})},[$]),Yo=O(v=>{b.current=Date.now();const N=[se.current,v.text].map(It=>It.trim()).filter(Boolean).join(" ").replace(/\s+/g," ").trim();if((Pe.current||v.overlappedOutput)&&Oc(v.text,kt.current)){Ut(),Kt();return}if(!N||su(N)||cu(N)){const It=Pe.current||Ye.current;Ut(),Kt(),It||Jn("misunderstood");return}Pe.current&&(Pe.current=!1,M(),ye());const Me=E.current;if(Me){se.current="",Ut();const It=No(N);if(Ku.test(It)||Me==="end"&&Zu.test(It)){E.current=null,ne.current(Me);return}if(Yu.test(It)){E.current=null,Mt("Okay, never mind — what would you like to know?");return}Mt(Xu(Me));return}const Ne=Ju(N);if(Ne){if(se.current="",Ut(),Kt(),Ne.confident){ne.current(Ne.action);return}E.current=Ne.action,Mt(`Just to confirm — you want me to ${zo[Ne.action]}? Please say yes or no.`);return}const gt=Ma(N);$(gt,{content:N,pending:!0});const yn=Ye.current;Ye.current=!1,Wo(N,gt,yn)},[Ma,$,Kt,Wo,Ut,Jn,Mt,M,ye]),Zo=O(v=>{b.current=Date.now();const N=Pe.current||Ye.current;if(Ut(),Kt(),!(N||v.overlappedOutput||v.reason==="too-short")){if(v.reason==="transcribe-failed"){Jn("misunderstood","I couldn't transcribe that. Please try again, or type your question.");return}Jn("noise")}},[Kt,Ut,Jn]),Xn=R({speechStart:Go,partial:Ko,turn:Yo,noise:Zo});Xn.current={speechStart:Go,partial:Ko,turn:Yo,noise:Zo};const Jo=O(()=>{navigator.mediaDevices?.enumerateDevices().then(v=>{Wn(v.filter(N=>N.kind==="audioinput").map((N,le)=>({deviceId:N.deviceId,label:N.label||`Microphone ${le+1}`})))}).catch(()=>{})},[]),kp=O(()=>{if(Ht.current){lt();return}if(Ho(),!c?.allowVoiceInput||!c.talkbackMode||c.talkbackMode==="text"||re.current||be||ze)return;b.current=Date.now(),Tt.current=!1,Ht.current=!0,Vt(!1),Rt(!0),qt(!1),tn(!1);let v=!1;const N=new qi({deviceId:_e.current||void 0,transcribe:async({audio:le,mimeType:Me,durationSeconds:Ne})=>{const gt=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||void 0;return iu(await ct.current(le,Me,gt,Ne))},listener:{state:le=>{xt(le),le.mic!=="starting"&&le.mic!=="off"&&qt(!0),!v&&le.mic==="listening"&&(v=!0,Jo())},speechStart:()=>Xn.current.speechStart(),partial:({text:le})=>Xn.current.partial(le),turn:le=>Xn.current.turn(le),noise:le=>Xn.current.noise(le),level:le=>{const Me=performance.now();Me-z.current<Wu||(z.current=Me,nn(le))}}});Ct.current=N,N.setOutputActive(Ee.current),N.start()},[lt,be,Ho,c,Jo,ze]),Ea=O(()=>{const v=!Tt.current;Tt.current=v,Vt(v),Ct.current?.setMuted(v),v?(se.current="",Ut(),Kt()):b.current=Date.now()},[Kt,Ut]),Xo=O(v=>{switch(b.current=Date.now(),v){case"end":G.current=!0,Mt("Okay — ending our call now. Goodbye!"),window.setTimeout(()=>{G.current&&(G.current=!1,lt())},2e3);break;case"mute":{Tt.current||Ea(),Mt("Muted. Tap the mic button when you want me to listen again.");break}case"minimize":At(),Mt("Minimized — I'm still listening. Tap the call pill to bring the chat back.");break;case"expand":Xe(!0),Mt("Sure — expanding the view.");break;case"shrink":ht(null),Xe(!1),Mt("Okay — back to the smaller view.");break}},[At,lt,Mt,Ea]);J(()=>{ne.current=Xo},[Xo]);const Qo=R(!1);J(()=>{Qo.current&&!d&&G.current&&(G.current=!1,lt()),Qo.current=d},[d,lt]);const Sp=O(v=>{_e.current=v,ee(v),Ct.current?.selectDevice(v||void 0)},[]),$p=O(()=>{!Ht.current||Tt.current||(Pe.current=!1,Ye.current=!1,M(),ye(),b.current=Date.now())},[M,ye]);J(()=>{Ct.current?.setOutputActive(d),b.current=Date.now()},[d]),J(()=>{if(et!=="denied")return;const v=window.setTimeout(()=>lt(),3500);return()=>window.clearTimeout(v)},[lt,et]),J(()=>{if(!at)return;const v=window.setInterval(()=>{const N=Ct.current;!N||Tt.current||re.current||Ee.current||N.snapshot.mic==="hearing"||N.snapshot.processing||Date.now()-b.current<Hu||(Ct.current?.log.add("call-timeout"),tn(!0),window.setTimeout(()=>lt(),2400))},5e3);return()=>window.clearInterval(v)},[lt,at]);const Tp=at&&!ft&&(l||d);J(()=>()=>lt(),[lt]);const[Cp,Ap]=S(""),es=R(!1);J(()=>{if(es.current&&!l){const v=[...u].reverse().find(N=>N.role==="assistant"&&!N.streaming&&!N.pending&&N.content);v&&Ap(v.content)}es.current=l},[l,u]),$n(()=>{if(!o)return;const v=Ot.current,N=mt||rn?v?.querySelector(".cf-confirm__card"):Wt?v?.querySelector(".cf-history"):null;if(!N)return;const le=N.getRootNode(),Me="activeElement"in le?le.activeElement:document.activeElement;(!Me||!N.contains(Me))&&N.querySelector('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])')?.focus()},[rn,mt,o,Wt]),J(()=>{if(!o)return;const v=Ot.current,N=mt||rn?v?.querySelector(".cf-confirm__card"):Wt?v?.querySelector(".cf-history"):null,le=v?.querySelectorAll(":scope > .cf-header, :scope > .cf-panel__video, :scope > .cf-panel__chat");le?.forEach(Ne=>{N?(Ne.setAttribute("inert",""),Ne.setAttribute("aria-hidden","true")):(Ne.removeAttribute("inert"),Ne.removeAttribute("aria-hidden"))}),N||requestAnimationFrame(()=>v?.querySelector(".cf-textarea")?.focus());const Me=Ne=>{if(Ne.key==="Escape"){Ne.preventDefault();const ea=Bo.current;if(ea.confirmEnd){Ft(!1);return}if(ea.confirmClear){on(!1);return}if(ea.showHistory){sn(!1);return}At();return}if(Ne.key!=="Tab"||!N)return;const gt=N.querySelectorAll('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])'),yn=Array.from(gt).filter(ea=>!ea.hasAttribute("disabled"));if(yn.length===0)return;const It=yn[0],rs=yn[yn.length-1],is=N.getRootNode()instanceof ShadowRoot?N.getRootNode().activeElement:document.activeElement;Ne.shiftKey&&is===It?(Ne.preventDefault(),rs.focus()):!Ne.shiftKey&&is===rs&&(Ne.preventDefault(),It.focus())};return v?.addEventListener("keydown",Me),()=>{v?.removeEventListener("keydown",Me),le?.forEach(Ne=>{Ne.removeAttribute("inert"),Ne.removeAttribute("aria-hidden")})}},[o,At,mt,rn,Wt]),J(()=>{const v=Ot.current;v&&(o?v.removeAttribute("inert"):v.setAttribute("inert",""))},[o]);const za=t.accentColor??t.themeTokens?.accent??c?.accentColor,ts=t.themeTokens?.accentText??Vu(za,t.themeTokens?.background??(ue==="dark"?"#0f1c27":"#ffffff")),Mp={zIndex:t.zIndex,"--cf-h-pad":`${t.horizontalPadding}px`,"--cf-v-pad":`${t.verticalPadding}px`,...ts?{"--cf-accent-ink":ts}:{},...t.themeTokens?.accentStrong?{"--cf-accent-2":t.themeTokens.accentStrong}:{},...t.themeTokens?.background?{"--cf-bg":t.themeTokens.background}:{},...t.themeTokens?.surface?{"--cf-surface":t.themeTokens.surface}:{},...t.themeTokens?.surfaceMuted?{"--cf-surface-2":t.themeTokens.surfaceMuted}:{},...t.themeTokens?.text?{"--cf-text":t.themeTokens.text}:{},...t.themeTokens?.mutedText?{"--cf-muted":t.themeTokens.mutedText}:{},...t.themeTokens?.border?{"--cf-border":t.themeTokens.border}:{},...t.themeTokens?.shadow?{"--cf-shadow":t.themeTokens.shadow}:{},...t.themeTokens?.radius?{"--cf-radius":t.themeTokens.radius}:{},...t.themeTokens?.fontFamily?{"--cf-font":t.themeTokens.fontFamily}:{},...t.themeTokens?.success?{"--cf-success":t.themeTokens.success}:{},...t.themeTokens?.warning?{"--cf-warning":t.themeTokens.warning}:{},...t.themeTokens?.danger?{"--cf-danger":t.themeTokens.danger}:{},...za?{"--cf-accent":za,"--cf-accent-2":t.themeTokens?.accentStrong??`color-mix(in oklab, ${za} 76%, #14141f)`}:{}},Ip=v=>m(v),Ep=[...u].reverse().find(v=>v.role==="user"&&v.content.trim())?.content??"",Na=u.some(v=>v.role==="user"),ns=!!(c?.allowVoiceInput&&c?.talkbackMode&&c.talkbackMode!=="text"),as=ns,Qn=!ze&&as&&!Na?Ca.filter((v,N)=>!(N===0&&v.role==="assistant")):Ca,zp=f==="human"&&y?y:c?.agentName??i.chatName,Np=f==="human"?i.liveSupport:f==="queued"?i.waitingForTeam:c?.offline?i.statusOffline:i.statusOnline,Ar=!be&&!ze?c?.availableActions:void 0,Rp=!be&&!ze?c?.actions:void 0,Mr=at&&!bn&&et==="connecting"&&!ze;return r(ql,{value:i,children:r(Vl,{value:t.locale,children:r("div",{class:"cf-root",dir:t.dir,"data-theme":ue,"data-align":t.alignment,"data-display":"floating",style:Mp,children:[_t&&o&&r("div",{class:"cf-theater-backdrop",onClick:wp}),r("div",{ref:Ot,class:`cf-panel ${o?"is-open":""} ${at?"cf-panel--call":""} ${Mr?"cf-panel--voice-connecting":""} ${_t&&o?"cf-panel--theater":""} ${Kn||Yn?"cf-panel--analytics-focus":""}`,role:"dialog","aria-modal":"false","aria-label":`${i.chatName}: ${c?.agentName??i.assistantName}`,"aria-hidden":!o,children:[Ge&&o&&r(pu,{state:Ge,onClose:me}),r("div",{class:"cf-header",children:[r(uo,{persona:c,hideWhenMissing:!0}),r("div",{class:"cf-header__meta",children:[r("div",{class:"cf-header__name",children:zp}),r("div",{class:`cf-header__status ${f==="ai"&&c?.offline?"cf-header__status--offline":""}`,children:r("span",{class:"cf-header__status-text",children:Np})})]}),r("div",{class:"cf-header__actions",children:[He.length>0&&r("button",{type:"button",class:"cf-header__btn","aria-label":i.pastConversations,title:i.pastConversations,"aria-pressed":Wt,onClick:()=>sn(v=>!v),children:r(dd,{})}),Na&&!be&&!ze&&r("button",{type:"button",class:"cf-header__btn","aria-label":i.endChat,title:i.endChat,onClick:mp,children:r(br,{})}),t.sound&&ve&&r("button",{type:"button",class:"cf-header__btn","aria-label":pe?i.unmuteSounds:i.muteSounds,"aria-pressed":pe,onClick:wt,children:pe?r(od,{}):r(id,{})}),r("button",{type:"button",class:"cf-header__btn cf-header__close","aria-label":i.closeChat,onClick:At,children:r(pn,{})})]})]}),r("div",{class:"cf-panel__video",children:Kn?r("div",{class:"cf-analytics-focus",role:"region","aria-label":i.expandedAnalyticsResult,children:r(vo,{visualization:Kn,expanded:!0,onFollowUp:v=>{Ia(),m(v)},onClose:Ia})}):Yn?.visualization?r("div",{class:"cf-analytics-focus",role:"region","aria-label":i.expandedAnalyticsResult,children:r(Gd,{visualization:Yn.visualization,onClose:Ia,onFollowUp:v=>{Ia(),m(v)},onFeedback:ze?void 0:q,transport:ze?void 0:C("widget"),onOpenSource:t.onOpenAnalyticsSource})}):!ze&&as?r(Td,{persona:c,starters:[],onPick:m,onFocusComposer:kp,speaking:d,voiceState:et,replyPending:at&&l&&!d,pinned:!0,muted:ft,onToggleMute:Ea,onEndCall:lt,onTalkNow:$p,showTalkNow:Tp,micLevel:Lt,theaterMode:_t,onToggleTheater:xp,onMinimize:At,audioDevices:Hn,selectedAudioDeviceId:vn,onSelectAudioDevice:Sp,connectingOnly:Mr}):null}),!Mr&&r("div",{class:"cf-panel__chat",children:[t.preview&&r("div",{class:"cf-preview-banner",children:i.previewBanner}),ze&&r("div",{class:"cf-viewing-banner",children:i.viewingPast}),r("div",{class:"cf-body",ref:an,role:"log",onScroll:vp,children:[Qn.map((v,N)=>r(Wd,{msg:v,persona:c,isLast:!ze&&N===Qn.length-1,visitor:p,hasEmail:g,lastQuestion:Ep,showActions:!ze&&N===Qn.length-1&&!!(v.handoffOffered||v.selectedAction),onPickReply:Ip,onSubmitForm:oe,onDemoSlots:Ae,onConfirmHostedBooking:Ue,onRetry:U,ratable:!ze&&Qn.slice(0,N).some(le=>le.role==="user"),onRate:D,onExplanationFeedback:ze?void 0:q,explanationTransport:ze?void 0:C("widget"),onOpenAnalyticsSource:t.onOpenAnalyticsSource,onExpandVisualization:ze?void 0:yp,onExpandExplanation:ze?void 0:_p,onOpenAttachment:he,onReconnect:!ze&&!be&&Fe&&v.id===Qe?_:void 0},v.id)),!Na&&!ze&&r(ce,{children:[Qn.length===0&&r(qu,{name:c?.agentName??i.assistantName,greeting:c?.greeting}),r(Vd,{items:I,onPick:m}),r(jd,{items:x})]}),Be&&r("button",{type:"button",class:"cf-newmsg",onClick:Gt,children:[r(md,{}),i.newMessages]})]}),r("div",{class:"cf-sr-live","aria-live":"polite","aria-atomic":"true",children:Cp}),l&&!be&&!ze&&r("div",{class:"cf-stopbar",children:r("button",{type:"button",class:"cf-stop",onClick:M,children:[r(ld,{}),i.stop]})}),ze?r("div",{class:"cf-ended",children:r("button",{type:"button",class:"cf-ended__btn",onClick:H,children:i.backToChat})}):be?r("div",{class:"cf-ended",children:[r("p",{class:"cf-ended__text",children:i.conversationEnded}),t.csat&&Na?hp?r("p",{class:"cf-ended__text",children:i.feedbackThanks}):r("div",{class:"cf-csat",children:[r("span",{class:"cf-csat__q",children:i.csatPrompt}),r("button",{type:"button",class:"cf-csat__btn","aria-label":i.feedbackHelpful,onClick:()=>{fe("up"),qo(!0)},children:r(oo,{})}),r("button",{type:"button",class:"cf-csat__btn","aria-label":i.feedbackNotHelpful,onClick:()=>{fe("down"),qo(!0)},children:r(so,{})})]}):null,r("button",{type:"button",class:"cf-ended__btn",onClick:bp,children:i.startNewChat})]}):r(ce,{children:[h?r("div",{class:"cf-live-typing","aria-live":"polite",children:Ve(i.agentTyping,{name:h})}):null,Ar&&Ar.length>0&&r("div",{class:"cf-footer-actions",children:r(go,{actions:Ar,descriptors:Rp,visitor:p,onSubmitForm:oe,onDemoSlots:Ae,onConfirmHostedBooking:Ue,scheduler:c?.scheduler,translations:t.actionTranslations})},"footer-actions"),r(ru,{draftStore:fp,onSend:m,onSendGif:T,onTyping:F,disabled:l,allowVoice:ns,onTranscribe:ke,gifEnabled:ge,onSearchGifs:Ie,allowAttach:t.attachments,analyzeAttachments:!0,onUpload:Ce,onPreviewAttachment:de},"composer")]}),!be&&c?.disclaimerText&&r("div",{class:"cf-disclaimer",children:c.disclaimerText}),r("div",{class:"cf-footer",children:[r("button",{type:"button",class:"cf-footer__privacy","aria-label":i.clearDeviceData,onClick:()=>on(!0),children:i.privacyAndData}),r("span",{"aria-hidden":"true",children:"·"}),i.poweredBy," ",r("a",{href:"https://accurix.tech/centrinfo",target:"_blank",rel:"noopener noreferrer",children:"Centrinfo"})]})]}),mt&&r("div",{class:"cf-confirm",onClick:()=>Ft(!1),children:r("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":i.endChatConfirm,onClick:v=>v.stopPropagation(),onKeyDownCapture:v=>Tr(v,v.currentTarget,()=>Ft(!1)),children:[r("div",{class:"cf-confirm__title",children:i.endChatConfirm}),r("div",{class:"cf-confirm__body",children:i.endChatConfirmBody}),r("div",{class:"cf-confirm__actions",children:[r("button",{ref:Uo,type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>Ft(!1),children:i.cancel}),r("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:gp,children:i.endConfirmCta})]})]})},"confirm-end"),Wt&&r("div",{class:"cf-confirm",onClick:()=>sn(!1),children:r("div",{class:"cf-history",role:"dialog","aria-modal":"true","aria-label":i.pastConversations,onClick:v=>v.stopPropagation(),onKeyDownCapture:v=>Tr(v,v.currentTarget,()=>sn(!1)),children:[r("div",{class:"cf-history__head",children:[r("span",{children:i.pastConversations}),r("button",{type:"button",class:"cf-header__btn","aria-label":i.closeHistory,onClick:()=>sn(!1),children:r(pn,{})})]}),r("div",{class:"cf-history__list",children:He.map(v=>r("button",{type:"button",class:`cf-history__item ${v.sessionId===k?"is-active":""}`,onClick:()=>{V(v.sessionId),sn(!1)},children:[r("span",{class:"cf-history__title",children:v.title}),r("span",{class:"cf-history__meta",children:[new Date(v.ts).toLocaleDateString(void 0,{month:"short",day:"numeric"}),v.ended?` · ${i.historyEnded}`:""]})]},v.sessionId))}),r("div",{class:"cf-history__footer",children:r("button",{type:"button",class:"cf-history__clear",onClick:()=>{sn(!1),on(!0)},children:i.clearDeviceData})})]})},"history"),rn&&r("div",{class:"cf-confirm",onClick:()=>on(!1),children:r("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":i.clearDeviceData,onClick:v=>v.stopPropagation(),onKeyDownCapture:v=>Tr(v,v.currentTarget,()=>on(!1)),children:[r("div",{class:"cf-confirm__title",children:i.clearDeviceData}),r("div",{class:"cf-confirm__body",children:i.clearDeviceDataBody}),r("div",{class:"cf-confirm__actions",children:[r("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>on(!1),children:i.cancel}),r("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:()=>{on(!1),ae()},children:i.clearDeviceDataCta})]})]})},"confirm-clear")]}),at&&!o?r(nu,{persona:c,voiceState:et,muted:ft,onToggleMute:Ea,onEndCall:lt,micLevel:Lt,onExpand:xn}):_t&&o?null:!t.hideDefaultLauncher&&r("button",{ref:Ta,type:"button",class:"cf-launcher","aria-label":o?i.closeChat:We>0?`${i.openChat}. ${We===1?i.unreadMessage:Ve(i.unreadMessages,{count:String(We)})}`:i.openChat,"aria-expanded":o,onClick:Zn,children:[t.launcherIcon?r("img",{class:"cf-launcher__img",src:t.launcherIcon,alt:""}):r(Yl,{}),!o&&We>0&&r("span",{class:"cf-launcher__badge","aria-hidden":"true",children:We>99?"99+":We})]})]})})})},ep="https://api.accurixtech.com",tp=()=>typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en",np=(e,t)=>{if(!e)return;const n=t.trim().toLowerCase(),a=n.split("-")[0]??n,i=Object.entries(e);return i.find(([o])=>o.toLowerCase()===n)?.[1]??i.find(([o])=>o.toLowerCase()===a)?.[1]},ap=e=>{if(!e||typeof e.token!="string"||e.token.length===0)throw new Error("[centrinfo-widget] `token` is required — pass your pub_* token to Centrinfo.init({ token }).");const t=e.locale?.trim()||tp(),n=np(e.translations,t);return{token:e.token,chatSurface:e.chatSurface??"floating",analyticsContextToken:e.analyticsContextToken,identityToken:e.identityToken,getIdentityToken:e.getIdentityToken,apiBaseUrl:(e.apiBaseUrl??ep).replace(/\/$/,""),accentColor:e.accentColor,themeTokens:e.themeTokens,agentName:e.agentName?.trim()||void 0,agentAvatarUrl:e.agentAvatarUrl?.trim()||void 0,launcherIcon:e.launcherIcon,gifApiKey:e.gifApiKey,theme:e.theme??"auto",openByDefault:e.openByDefault??!1,sound:e.sound??!0,starters:e.starters??[],strings:Bl({...n?.labels,...e.labels,...n?.labels?.analytics||e.labels?.analytics?{analytics:{...n?.labels?.analytics,...e.labels?.analytics,explanation:{...n?.labels?.analytics?.explanation,...e.labels?.analytics?.explanation}}}:{}}),locale:t,dir:Hl(t,e.dir),actionTranslations:n?.actions??{},persistence:e.persistence??"local",attachments:e.attachments??!0,zIndex:e.zIndex??2147483e3,styleNonce:e.styleNonce?.trim()??"",demo:e.demo??!1,preview:e.preview??!1,alignment:e.alignment==="left"?"left":"right",horizontalPadding:typeof e.horizontalPadding=="number"?e.horizontalPadding:20,verticalPadding:typeof e.verticalPadding=="number"?e.verticalPadding:20,hideDefaultLauncher:e.hideDefaultLauncher??!1,customLauncherSelector:e.customLauncherSelector,sessionDurationMinutes:typeof e.sessionDurationMinutes=="number"?e.sessionDurationMinutes:0,configRefreshSeconds:typeof e.configRefreshSeconds=="number"?e.configRefreshSeconds:30,proactiveMessage:e.proactiveMessage,proactiveDelaySeconds:typeof e.proactiveDelaySeconds=="number"?e.proactiveDelaySeconds:5,proactiveOnPaths:e.proactiveOnPaths,csat:e.csat??!0,user:e.user,onOpen:e.onOpen,onClose:e.onClose,onShow:e.onShow,onHide:e.onHide,onUnreadChange:e.onUnreadChange,onMessage:e.onMessage,onOpenAnalyticsSource:e.onOpenAnalyticsSource,onAction:e.onAction,onHandoff:e.onHandoff}},Ro=`
37
177
  :host {
38
178
  all: initial;
39
179
  }
@@ -48,6 +188,8 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
48
188
  --cf-muted: #5b7186;
49
189
  --cf-border: #e4e9ee;
50
190
  --cf-danger: #b42318;
191
+ --cf-success: #15803d;
192
+ --cf-warning: #b45309;
51
193
  --cf-shadow: 0 12px 48px -12px rgba(15, 30, 42, 0.4), 0 4px 12px -4px rgba(15, 30, 42, 0.2);
52
194
  --cf-radius: 18px;
53
195
  --cf-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
@@ -69,6 +211,9 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
69
211
  --cf-text: #eef3f7;
70
212
  --cf-muted: #93a7b6;
71
213
  --cf-border: #2a3d4c;
214
+ --cf-success: #4ade80;
215
+ --cf-warning: #fbbf24;
216
+ --cf-danger: #f87171;
72
217
  --cf-shadow: 0 12px 48px -12px rgba(0, 0, 0, 0.6), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
73
218
  }
74
219
  .cf-root *,
@@ -716,6 +861,7 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
716
861
  /* Per-message 👍/👎 feedback. */
717
862
  .cf-feedback { margin-top: 0; }
718
863
  .cf-feedback__row { display: flex; align-items: center; gap: 4px; }
864
+ .cf-feedback__label { margin-right: 4px; color: var(--cf-muted); font-size: 11.5px; }
719
865
  .cf-feedback__btn {
720
866
  display: inline-flex;
721
867
  align-items: center;
@@ -2914,20 +3060,6 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
2914
3060
  .cf-attach-x:hover { background: var(--cf-surface); color: var(--cf-text); }
2915
3061
  .cf-attach-x svg { width: 11px; height: 11px; }
2916
3062
 
2917
- /* ---------- Mobile: full-screen panel ---------- */
2918
- @media (max-width: 480px) {
2919
- .cf-panel {
2920
- bottom: 0;
2921
- right: 0;
2922
- width: 100vw;
2923
- max-width: 100vw;
2924
- height: 100dvh;
2925
- max-height: 100dvh;
2926
- border-radius: 0;
2927
- }
2928
- .cf-launcher { bottom: 16px; right: 16px; }
2929
- }
2930
-
2931
3063
  /* ---------- Keyframes ---------- */
2932
3064
  @keyframes cf-pop {
2933
3065
  from { transform: scale(0); opacity: 0; }
@@ -2962,223 +3094,6 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
2962
3094
  scroll-behavior: auto !important;
2963
3095
  }
2964
3096
  }
2965
- .cf-analytics-visualization {
2966
- box-sizing: border-box;
2967
- width: 100%;
2968
- max-width: 100%;
2969
- margin-top: 8px;
2970
- min-width: 0;
2971
- overflow: hidden;
2972
- border: 1px solid var(--cf-border);
2973
- border-radius: 13px;
2974
- background: var(--cf-surface);
2975
- padding: 12px;
2976
- color: var(--cf-muted);
2977
- font-size: 11px;
2978
- }
2979
- .cf-analytics-visualization.is-expanded {
2980
- display: flex;
2981
- min-height: 100%;
2982
- flex-direction: column;
2983
- margin: 0;
2984
- border: 0;
2985
- border-radius: 0;
2986
- background: transparent;
2987
- padding: 0;
2988
- }
2989
- .cf-analytics-visualization__header {
2990
- display: flex;
2991
- width: 100%;
2992
- min-width: 0;
2993
- min-height: 32px;
2994
- align-items: center;
2995
- justify-content: space-between;
2996
- gap: 10px;
2997
- }
2998
- .cf-analytics-visualization__header > div:first-child {
2999
- min-width: 0;
3000
- }
3001
- .cf-analytics-visualization__actions {
3002
- display: flex;
3003
- flex: 0 0 auto;
3004
- align-items: center;
3005
- gap: 6px;
3006
- }
3007
- .cf-analytics-chart-picker {
3008
- position: relative;
3009
- display: inline-flex;
3010
- min-width: 0;
3011
- color: var(--cf-muted);
3012
- font-size: 9px;
3013
- font-weight: 700;
3014
- }
3015
-
3016
- .cf-analytics-chart-picker summary {
3017
- display: inline-flex;
3018
- min-width: 92px;
3019
- max-width: 138px;
3020
- height: 30px;
3021
- align-items: center;
3022
- gap: 6px;
3023
- border: 1px solid var(--cf-border);
3024
- border-radius: 8px;
3025
- background: var(--cf-bg);
3026
- padding: 0 8px;
3027
- color: var(--cf-text);
3028
- list-style: none;
3029
- cursor: pointer;
3030
- box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
3031
- transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
3032
- }
3033
-
3034
- .cf-analytics-chart-picker summary::-webkit-details-marker { display: none; }
3035
- .cf-analytics-chart-picker summary:hover,
3036
- .cf-analytics-chart-picker[open] summary {
3037
- border-color: var(--cf-accent);
3038
- background: color-mix(in oklab, var(--cf-accent) 9%, var(--cf-bg));
3039
- }
3040
- .cf-analytics-chart-picker summary:focus-visible {
3041
- outline: 2px solid var(--cf-accent);
3042
- outline-offset: 2px;
3043
- }
3044
- .cf-analytics-chart-picker summary > svg:last-child {
3045
- width: 13px;
3046
- height: 13px;
3047
- flex: 0 0 13px;
3048
- margin-left: auto;
3049
- color: var(--cf-muted);
3050
- transition: transform .16s ease;
3051
- }
3052
- .cf-analytics-chart-picker[open] summary > svg:last-child { transform: rotate(180deg); }
3053
- .cf-analytics-chart-picker__current {
3054
- display: inline-flex;
3055
- min-width: 0;
3056
- align-items: center;
3057
- gap: 6px;
3058
- }
3059
- .cf-analytics-chart-picker__current > span {
3060
- overflow: hidden;
3061
- text-overflow: ellipsis;
3062
- white-space: nowrap;
3063
- }
3064
- .cf-chart-type-icon {
3065
- width: 17px;
3066
- height: 17px;
3067
- flex: 0 0 17px;
3068
- }
3069
- .cf-analytics-chart-picker__menu {
3070
- position: absolute;
3071
- top: calc(100% + 7px);
3072
- right: 0;
3073
- z-index: 60;
3074
- display: grid;
3075
- min-width: 196px;
3076
- padding: 6px;
3077
- border: 1px solid var(--cf-border);
3078
- border-radius: 12px;
3079
- background: var(--cf-bg);
3080
- box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
3081
- }
3082
- .cf-analytics-chart-picker__menu button {
3083
- display: flex;
3084
- width: 100%;
3085
- min-height: 46px;
3086
- align-items: flex-start;
3087
- gap: 8px;
3088
- border: 0;
3089
- border-radius: 9px;
3090
- background: transparent;
3091
- padding: 7px;
3092
- color: var(--cf-text);
3093
- font: inherit;
3094
- text-align: left;
3095
- cursor: pointer;
3096
- }
3097
- .cf-analytics-chart-picker__menu button:hover,
3098
- .cf-analytics-chart-picker__menu button.is-selected {
3099
- background: color-mix(in oklab, var(--cf-accent) 10%, var(--cf-bg));
3100
- color: var(--cf-accent);
3101
- }
3102
- .cf-analytics-chart-picker__menu button > svg:last-child {
3103
- width: 13px;
3104
- height: 13px;
3105
- flex: 0 0 13px;
3106
- margin-top: 4px;
3107
- }
3108
- .cf-analytics-chart-picker__icon {
3109
- display: inline-flex;
3110
- width: 30px;
3111
- height: 30px;
3112
- flex: 0 0 30px;
3113
- align-items: center;
3114
- justify-content: center;
3115
- border-radius: 9px;
3116
- background: var(--cf-bg-soft);
3117
- box-shadow: inset 0 0 0 1px var(--cf-border);
3118
- }
3119
- .cf-analytics-chart-picker__icon .cf-chart-type-icon {
3120
- width: 25px;
3121
- height: 25px;
3122
- flex-basis: 25px;
3123
- }
3124
- .cf-analytics-chart-picker__copy {
3125
- display: grid;
3126
- min-width: 0;
3127
- flex: 1;
3128
- gap: 2px;
3129
- }
3130
- .cf-analytics-chart-picker__copy strong {
3131
- font-size: 10px;
3132
- line-height: 1.25;
3133
- }
3134
- .cf-analytics-chart-picker__copy small {
3135
- color: var(--cf-muted);
3136
- font-size: 9px;
3137
- font-weight: 560;
3138
- line-height: 1.3;
3139
- }
3140
- .cf-analytics-visualization__title {
3141
- overflow: hidden;
3142
- color: var(--cf-muted);
3143
- font-size: 10px;
3144
- font-weight: 750;
3145
- letter-spacing: .08em;
3146
- text-overflow: ellipsis;
3147
- text-transform: uppercase;
3148
- white-space: nowrap;
3149
- }
3150
- .cf-analytics-meta {
3151
- display: flex;
3152
- flex-wrap: wrap;
3153
- align-items: center;
3154
- gap: 3px 7px;
3155
- margin-top: 4px;
3156
- color: var(--cf-muted);
3157
- font-size: 9px;
3158
- line-height: 1.35;
3159
- }
3160
- .cf-analytics-meta__dot {
3161
- display: inline-block;
3162
- width: 5px;
3163
- height: 5px;
3164
- margin-right: 4px;
3165
- border-radius: 999px;
3166
- background: var(--cf-accent);
3167
- }
3168
- .cf-analytics-visualization__download {
3169
- width: fit-content;
3170
- border: 1px solid var(--cf-border) !important;
3171
- border-radius: 8px;
3172
- background: var(--cf-surface) !important;
3173
- padding: 6px 9px;
3174
- color: var(--cf-text) !important;
3175
- font-size: 10px;
3176
- font-weight: 700;
3177
- }
3178
- .cf-analytics-visualization__download:hover {
3179
- border-color: var(--cf-accent) !important;
3180
- color: var(--cf-accent) !important;
3181
- }
3182
3097
  .cf-analytics-table-wrap {
3183
3098
  box-sizing: border-box;
3184
3099
  width: 100%;
@@ -3313,7 +3228,11 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
3313
3228
  font-weight: 650;
3314
3229
  }
3315
3230
  .cf-segment.is-active { background: var(--cf-accent) !important;color: var(--cf-accent-ink) !important; }
3316
- .cf-table-column-bar { display: flex;align-items: center;padding: 0 8px 7px; }
3231
+ .cf-table-column-bar { display: flex;align-items: center;flex-wrap: wrap;gap: 5px;padding: 0 8px 7px; }
3232
+ .cf-table-view-button { min-height: 27px;padding: 4px 6px;border: 1px solid var(--cf-border);border-radius: 7px;background: var(--cf-bg);color: var(--cf-text);cursor: pointer;font-size: 9px; }
3233
+ .cf-table-view-button[aria-pressed="true"] { background: var(--cf-surface); }
3234
+ .cf-table-filter-bar { display: flex;flex-wrap: wrap;gap: 4px;padding: 4px 8px; }
3235
+ .cf-table-filter-chip { padding: 4px 7px;border: 0;border-radius: 999px;background: var(--cf-surface);color: var(--cf-accent);cursor: pointer;font-size: 9px; }
3317
3236
  .cf-column-picker { position: relative; }
3318
3237
  .cf-column-picker > summary {
3319
3238
  min-height: 27px;
@@ -3342,6 +3261,10 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
3342
3261
  box-shadow: 0 10px 24px rgba(15,30,42,.16);
3343
3262
  }
3344
3263
  .cf-column-menu label { display: flex;align-items: center;gap: 7px;color: var(--cf-text);font-size: 9px; }
3264
+ .cf-column-picker-row { display: flex;align-items: center;gap: 3px; }
3265
+ .cf-column-picker-row label { min-width: 0;flex: 1; }
3266
+ .cf-column-picker-row button { width: 22px;height: 22px;border: 0;border-radius: 5px;background: transparent;color: var(--cf-muted);cursor: pointer; }
3267
+ .cf-column-picker-row button:disabled { opacity: .4;cursor: default; }
3345
3268
  .cf-table-wrap {
3346
3269
  position: relative;
3347
3270
  min-height: 0;
@@ -3354,6 +3277,30 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
3354
3277
  .cf-table { width: 100%;border-collapse: separate;border-spacing: 0;color: var(--cf-text);font-size: 10px; }
3355
3278
  .cf-table th { position: sticky;top: 0;z-index: 1;background: var(--cf-surface);color: var(--cf-muted);font-size: 9px;font-weight: 720;text-align: left; }
3356
3279
  .cf-table th,.cf-table td { padding: 8px 9px;border-bottom: 1px solid var(--cf-border);white-space: nowrap; }
3280
+ .cf-table.is-compact th,.cf-table.is-compact td { padding-top: 4px;padding-bottom: 4px; }
3281
+ .cf-table td.is-wrapped { min-width: 110px;max-width: 240px;white-space: normal;overflow-wrap: anywhere; }
3282
+ .cf-table th.is-pinned,.cf-table td.is-pinned { position: sticky;z-index: 2;background: var(--cf-bg);box-shadow: 3px 0 6px -5px var(--cf-muted); }
3283
+ .cf-table th.is-pinned { z-index: 4;background: var(--cf-surface); }
3284
+ .cf-table th:not(.cf-select-cell) { min-width: 100px; }
3285
+ .cf-table th:not(.cf-select-cell) .cf-table-sort { max-width: calc(100% - 18px); }
3286
+ .cf-table-column-menu { position: absolute;right: 3px;top: 4px; }
3287
+ .cf-table-column-menu > summary { display: flex;width: 17px;height: 17px;align-items: center;justify-content: center;border-radius: 4px;list-style: none;cursor: pointer; }
3288
+ .cf-table-column-menu > summary::-webkit-details-marker { display: none; }
3289
+ .cf-table-column-menu > summary:hover { background: var(--cf-surface); }
3290
+ .cf-table-column-panel { position: fixed;z-index: 2147483000;display: grid;gap: 4px;width: min(220px,calc(100vw - 20px));max-height: 65vh;overflow: auto;margin: 0;padding: 9px;border: 1px solid var(--cf-border);border-radius: 9px;background: var(--cf-bg);box-shadow: 0 12px 30px rgba(15,30,42,.2);color: var(--cf-text);text-align: left; }
3291
+ .cf-table-column-panel > strong { padding: 4px 6px;font-size: 10px; }
3292
+ .cf-table-column-panel > span { padding: 7px 6px 2px;border-top: 1px solid var(--cf-border);font-size: 9px;font-weight: 750;text-transform: uppercase; }
3293
+ .cf-table-column-panel input,.cf-table-column-panel select { min-width: 0;height: 27px;padding: 4px 6px;border: 1px solid var(--cf-border);border-radius: 6px;background: var(--cf-bg);color: var(--cf-text);font-size: 9px; }
3294
+ .cf-table-column-panel button { padding: 6px 7px;border: 0;border-radius: 6px;background: transparent;color: var(--cf-text);cursor: pointer;font-size: 9px;text-align: left; }
3295
+ .cf-table-column-panel button:hover { background: var(--cf-surface); }
3296
+ .cf-sdk-select { position: relative;min-width: 0; }
3297
+ .cf-sdk-select-trigger { display: flex;min-height: 27px;align-items: center;justify-content: space-between;gap: 7px;padding: 4px 7px;border: 1px solid var(--cf-border);border-radius: 6px;background: var(--cf-bg);color: var(--cf-text);cursor: pointer;list-style: none;font-size: 9px; }
3298
+ .cf-sdk-select-trigger::-webkit-details-marker { display: none; }
3299
+ .cf-sdk-select-trigger:focus-visible { outline: 2px solid var(--cf-accent);outline-offset: 2px; }
3300
+ .cf-sdk-select-list { position: fixed;z-index: 2147483000;display: none;max-height: 220px;overflow: auto;margin: 0;padding: 4px;border: 1px solid var(--cf-border);border-radius: 7px;background: var(--cf-bg);box-shadow: 0 12px 28px rgba(15,30,42,.2); }
3301
+ .cf-sdk-select-list:popover-open,.cf-sdk-select[open] > .cf-sdk-select-list:not(:popover-open) { display: grid; }
3302
+ .cf-sdk-select-list button { padding: 6px 8px;border: 0;border-radius: 5px;background: transparent;color: var(--cf-text);cursor: pointer;font-size: 9px;text-align: left; }
3303
+ .cf-sdk-select-list button:hover,.cf-sdk-select-list button[aria-selected="true"] { background: var(--cf-surface); }
3357
3304
  .cf-table .cf-select-cell { width: 28px;padding-right: 3px;text-align: center; }
3358
3305
  .cf-table input[type="checkbox"],.cf-column-menu input[type="checkbox"] { width: 13px;height: 13px;accent-color: var(--cf-accent); }
3359
3306
  .cf-table-sort { display: flex !important;width: 100%;align-items: center;gap: 5px;color: inherit !important;font: inherit;text-align: left; }
@@ -3369,150 +3316,6 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
3369
3316
  .cf-table-controls { grid-template-columns: 1fr; }
3370
3317
  .cf-table-summary span:last-child { display: none; }
3371
3318
  }
3372
- .cf-analytics-visualization__expand,
3373
- .cf-analytics-visualization__close {
3374
- display: grid;
3375
- width: 30px;
3376
- height: 30px;
3377
- flex: 0 0 auto;
3378
- place-items: center;
3379
- border: 1px solid var(--cf-border) !important;
3380
- border-radius: 9px;
3381
- background: var(--cf-bg) !important;
3382
- color: var(--cf-text) !important;
3383
- }
3384
- .cf-analytics-visualization__expand:hover,
3385
- .cf-analytics-visualization__close:hover { background: var(--cf-surface-2) !important; }
3386
- .cf-analytics-visualization__expand:focus-visible,
3387
- .cf-analytics-visualization__close:focus-visible {
3388
- outline: 2px solid var(--cf-accent);
3389
- outline-offset: 2px;
3390
- }
3391
- .cf-analytics-visualization__expand svg,
3392
- .cf-analytics-visualization__close svg { width: 15px; height: 15px; }
3393
- .cf-analytics-visualization__kpi {
3394
- padding: 8px 0 6px;
3395
- color: var(--cf-text);
3396
- font-size: 30px;
3397
- font-weight: 750;
3398
- letter-spacing: -.035em;
3399
- }
3400
- .cf-analytics-kpi {
3401
- padding: 9px 0 5px;
3402
- }
3403
- .cf-analytics-kpi__label {
3404
- color: var(--cf-muted);
3405
- font-size: 9px;
3406
- font-weight: 700;
3407
- letter-spacing: .06em;
3408
- text-transform: uppercase;
3409
- }
3410
- .cf-analytics-kpi__value {
3411
- margin-top: 5px;
3412
- color: var(--cf-text);
3413
- font-size: 30px;
3414
- font-weight: 750;
3415
- letter-spacing: -.035em;
3416
- line-height: 1;
3417
- }
3418
- .cf-analytics-empty {
3419
- margin-top: 8px;
3420
- border: 1px dashed var(--cf-border);
3421
- border-radius: 11px;
3422
- padding: 18px 14px;
3423
- color: var(--cf-text);
3424
- text-align: center;
3425
- }
3426
- .cf-analytics-empty p { margin: 0; }
3427
- .cf-analytics-empty p + p {
3428
- margin-top: 4px;
3429
- color: var(--cf-muted);
3430
- font-size: 10px;
3431
- }
3432
- .cf-analytics-echart {
3433
- position: relative;
3434
- width: 100%;
3435
- height: 196px;
3436
- min-width: 0;
3437
- }
3438
- .cf-analytics-visualization.is-expanded .cf-analytics-echart {
3439
- height: auto;
3440
- min-height: 310px;
3441
- flex: 1;
3442
- }
3443
- .cf-analytics-echart canvas:focus-visible {
3444
- outline: 2px solid var(--cf-accent);
3445
- outline-offset: -2px;
3446
- }
3447
- .cf-analytics-echart__fallback {
3448
- display: grid;
3449
- height: 100%;
3450
- place-items: center;
3451
- border: 1px dashed var(--cf-border);
3452
- border-radius: 9px;
3453
- padding: 16px;
3454
- color: var(--cf-muted);
3455
- text-align: center;
3456
- line-height: 1.5;
3457
- }
3458
- .cf-analytics-zoom {
3459
- display: flex;
3460
- min-width: 0;
3461
- align-items: center;
3462
- justify-content: space-between;
3463
- gap: 8px;
3464
- margin-top: 4px;
3465
- border-top: 1px solid var(--cf-border);
3466
- padding-top: 8px;
3467
- }
3468
- .cf-analytics-zoom__range {
3469
- min-width: 0;
3470
- overflow: hidden;
3471
- color: var(--cf-muted);
3472
- font-size: 10px;
3473
- font-weight: 650;
3474
- line-height: 1.3;
3475
- text-overflow: ellipsis;
3476
- white-space: nowrap;
3477
- }
3478
- .cf-analytics-zoom__controls {
3479
- display: inline-flex;
3480
- flex: 0 0 auto;
3481
- align-items: center;
3482
- overflow: hidden;
3483
- border: 1px solid var(--cf-border);
3484
- border-radius: 9px;
3485
- background: var(--cf-bg);
3486
- }
3487
- .cf-analytics-zoom__controls button {
3488
- display: grid;
3489
- min-width: 40px;
3490
- height: 40px;
3491
- place-items: center;
3492
- border: 0 !important;
3493
- border-radius: 0;
3494
- background: transparent !important;
3495
- color: var(--cf-text) !important;
3496
- font: inherit;
3497
- font-size: 16px;
3498
- font-weight: 700;
3499
- line-height: 1;
3500
- }
3501
- .cf-analytics-zoom__controls button + button { border-left: 1px solid var(--cf-border) !important; }
3502
- .cf-analytics-zoom__controls button:hover:not(:disabled) { background: var(--cf-surface-2) !important; }
3503
- .cf-analytics-zoom__controls button:focus-visible {
3504
- position: relative;
3505
- z-index: 1;
3506
- outline: 2px solid var(--cf-accent);
3507
- outline-offset: -2px;
3508
- }
3509
- .cf-analytics-zoom__controls button:disabled { cursor: not-allowed; opacity: .38; }
3510
- .cf-analytics-zoom__controls .cf-analytics-zoom__reset {
3511
- min-width: 56px;
3512
- padding: 0 10px;
3513
- font-size: 10px;
3514
- font-weight: 700;
3515
- }
3516
3319
  .cf-analytics-focus {
3517
3320
  height: 100%;
3518
3321
  min-height: 0;
@@ -3529,6 +3332,14 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
3529
3332
  .cf-panel--analytics-focus .cf-panel__video { height: 100%; }
3530
3333
  .cf-panel--analytics-focus .cf-panel__chat { display: none; }
3531
3334
  }
3335
+ .cf-analytics-expired {
3336
+ margin: 8px 0 0;
3337
+ padding: 8px 10px;
3338
+ border: 1px dashed var(--cf-border);
3339
+ border-radius: 10px;
3340
+ color: var(--cf-muted);
3341
+ font-size: 12.5px;
3342
+ }
3532
3343
  .cf-analytics-explanation {
3533
3344
  margin-top: 10px;
3534
3345
  overflow: hidden;
@@ -3536,222 +3347,14 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
3536
3347
  border-radius: 12px;
3537
3348
  background: var(--cf-surface);
3538
3349
  color: var(--cf-text);
3539
- font-size: 12px;
3540
- line-height: 1.55;
3541
- }
3542
- .cf-analytics-explanation h3,
3543
- .cf-analytics-explanation h4,
3544
- .cf-analytics-explanation p { margin: 0; }
3545
- .cf-analytics-explanation__lead {
3546
- border-bottom: 1px solid var(--cf-border);
3547
- padding: 12px;
3548
- }
3549
- .cf-analytics-explanation__lead-meta {
3550
- display: flex;
3551
- flex-wrap: wrap;
3552
- align-items: center;
3553
- gap: 5px 8px;
3554
- }
3555
- .cf-analytics-explanation__eyebrow {
3556
- color: var(--cf-accent);
3557
- font-size: 9px;
3558
- font-weight: 750;
3559
- letter-spacing: .1em;
3560
- text-transform: uppercase;
3561
- }
3562
- .cf-analytics-explanation__provenance {
3563
- display: inline-flex;
3564
- align-items: center;
3565
- gap: 5px;
3566
- color: var(--cf-muted);
3567
- font-size: 9px;
3568
- font-weight: 650;
3569
- }
3570
- .cf-analytics-explanation__provenance-dot {
3571
- width: 5px;
3572
- height: 5px;
3573
- border-radius: 999px;
3574
- background: var(--cf-accent);
3575
- }
3576
- .cf-analytics-explanation__headline {
3577
- margin-top: 8px !important;
3578
- color: var(--cf-text);
3579
- font-size: 15px;
3580
- font-weight: 750;
3581
- letter-spacing: -.012em;
3582
- line-height: 1.45;
3583
- }
3584
- .cf-analytics-explanation__summary {
3585
- margin-top: 5px !important;
3586
- color: var(--cf-muted);
3587
- font-size: 12px;
3588
- line-height: 1.6;
3589
- }
3590
- .cf-analytics-explanation__body {
3591
- display: grid;
3592
- gap: 14px;
3593
3350
  padding: 12px;
3594
3351
  }
3595
- .cf-analytics-explanation__status { color: var(--cf-muted); }
3596
- .cf-analytics-explanation__error {
3597
- border-radius: 8px;
3598
- background: color-mix(in srgb, #d97706 10%, var(--cf-surface));
3599
- padding: 9px 10px;
3600
- color: var(--cf-text);
3601
- }
3602
- .cf-analytics-explanation__heading {
3603
- color: var(--cf-text);
3604
- font-size: 12px;
3605
- font-weight: 750;
3606
- line-height: 1.45;
3607
- }
3608
- .cf-analytics-explanation__evidence {
3609
- display: grid;
3610
- gap: 7px;
3611
- margin: 8px 0 0;
3612
- padding: 0;
3613
- list-style: none;
3614
- color: var(--cf-muted);
3615
- }
3616
- .cf-analytics-explanation__evidence-item {
3617
- display: flex;
3618
- gap: 8px;
3619
- align-items: flex-start;
3620
- }
3621
- .cf-analytics-explanation__evidence-bullet {
3622
- width: 5px;
3623
- height: 5px;
3624
- flex: 0 0 auto;
3625
- margin-top: 7px;
3626
- border-radius: 999px;
3627
- background: var(--cf-accent);
3628
- }
3629
- .cf-analytics-explanation__meaning {
3630
- border-left: 2px solid var(--cf-accent);
3631
- border-radius: 0 8px 8px 0;
3632
- background: color-mix(in srgb, var(--cf-accent) 7%, var(--cf-surface));
3633
- padding: 10px 11px;
3634
- }
3635
- .cf-analytics-explanation__paragraph {
3636
- margin-top: 5px !important;
3637
- color: var(--cf-muted);
3638
- }
3639
- .cf-analytics-explanation__section-heading,
3640
- .cf-analytics-explanation__outlook-header {
3641
- display: flex;
3642
- flex-wrap: wrap;
3643
- align-items: baseline;
3644
- justify-content: space-between;
3645
- gap: 4px 8px;
3646
- }
3647
- .cf-analytics-explanation__hint,
3648
- .cf-analytics-explanation__outlook-badge {
3649
- color: var(--cf-muted);
3650
- font-size: 9px;
3651
- font-weight: 650;
3652
- }
3653
- .cf-analytics-explanation__outlook-badge {
3654
- color: var(--cf-accent);
3655
- letter-spacing: .06em;
3656
- text-transform: uppercase;
3657
- }
3658
- .cf-analytics-explanation__drivers,
3659
- .cf-analytics-explanation__recommendations {
3660
- display: grid;
3661
- gap: 7px;
3662
- margin-top: 8px;
3663
- }
3664
- .cf-analytics-explanation__driver {
3665
- border-radius: 8px;
3666
- background: var(--cf-bg);
3667
- padding: 9px 10px;
3668
- }
3669
- .cf-analytics-explanation__driver-title,
3670
- .cf-analytics-explanation__recommendation-title {
3671
- color: var(--cf-text);
3672
- font-weight: 750;
3673
- }
3674
- .cf-analytics-explanation__driver-body,
3675
- .cf-analytics-explanation__recommendation-body {
3676
- margin-top: 3px !important;
3677
- color: var(--cf-muted);
3678
- font-size: 11px;
3679
- }
3680
- .cf-analytics-explanation__driver-label { color: var(--cf-text); font-weight: 700; }
3681
- .cf-analytics-explanation__recommendation {
3682
- display: grid;
3683
- grid-template-columns: 22px minmax(0, 1fr);
3684
- gap: 8px;
3685
- border-radius: 8px;
3686
- background: var(--cf-bg);
3687
- padding: 9px 10px;
3688
- }
3689
- .cf-analytics-explanation__recommendation-index {
3690
- display: grid;
3691
- width: 22px;
3692
- height: 22px;
3693
- place-items: center;
3694
- border-radius: 999px;
3695
- background: color-mix(in srgb, var(--cf-accent) 12%, var(--cf-surface));
3696
- color: var(--cf-accent);
3697
- font-size: 10px;
3698
- font-weight: 750;
3699
- }
3700
- .cf-analytics-explanation__outlook {
3701
- border-radius: 8px;
3702
- background: var(--cf-bg);
3703
- padding: 10px 11px;
3704
- }
3705
- .cf-analytics-explanation__follow-up {
3706
- border-top: 1px solid var(--cf-border);
3707
- padding-top: 12px;
3708
- }
3709
- .cf-analytics-explanation__questions {
3710
- display: grid;
3711
- gap: 6px;
3712
- margin-top: 8px;
3713
- }
3714
- .cf-analytics-explanation__question {
3715
- width: 100%;
3716
- border: 1px solid var(--cf-border);
3717
- border-radius: 8px;
3718
- background: var(--cf-bg);
3719
- padding: 8px 9px;
3720
- color: var(--cf-text);
3721
- font: inherit;
3722
- text-align: left;
3723
- cursor: pointer;
3724
- }
3725
- .cf-analytics-explanation__question:hover {
3726
- border-color: color-mix(in srgb, var(--cf-accent) 45%, var(--cf-border));
3727
- background: color-mix(in srgb, var(--cf-accent) 6%, var(--cf-bg));
3728
- }
3729
- .cf-analytics-explanation__question:focus-visible,
3730
- .cf-analytics-explanation__limits-summary:focus-visible {
3731
- outline: 2px solid var(--cf-accent);
3732
- outline-offset: 2px;
3733
- }
3734
- .cf-analytics-explanation__limits {
3735
- border-top: 1px solid var(--cf-border);
3736
- padding-top: 10px;
3737
- }
3738
- .cf-analytics-explanation__limits-summary {
3739
- cursor: pointer;
3740
- color: var(--cf-text);
3741
- font-weight: 700;
3742
- }
3743
- .cf-analytics-explanation__limits-list {
3744
- margin: 8px 0 0;
3745
- padding-left: 17px;
3746
- color: var(--cf-muted);
3747
- }
3748
- .cf-analytics-explanation__source {
3749
- border-top: 1px solid var(--cf-border);
3750
- margin: 0;
3751
- padding: 9px 12px;
3752
- color: var(--cf-muted);
3753
- font-size: 10px;
3754
- }
3352
+ .cf-analytics-explanation.is-expanded { margin: 0; border: 0; border-radius: 0; background: transparent; padding: 0; }
3353
+ .cf-analytics-explanation .cf-xp { font-size: 12px; }
3354
+ .cf-analytics-explanation.is-expanded .cf-xp { font-size: 14px; }
3355
+ .cf-analytics-explanation .cf-xp__headline { font-size: 15px; }
3356
+ ${Cl("cf",{surface:"var(--cf-surface)",subtle:"var(--cf-bg)",text:"var(--cf-text)",muted:"var(--cf-muted)",border:"var(--cf-border)",accent:"var(--cf-accent)",warning:"var(--cf-warning)",danger:"var(--cf-danger)",success:"var(--cf-success)",onAccent:"var(--cf-accent-ink)"})}
3357
+ ${xc("cf",{bg:"var(--cf-bg)",surface:"var(--cf-surface)",surface2:"var(--cf-surface-2)",text:"var(--cf-text)",muted:"var(--cf-muted)",border:"var(--cf-border)",accent:"var(--cf-accent)",onAccent:"var(--cf-accent-ink)",chart:bc,chartDark:vc,darkSelector:".cf-root[data-theme='dark']"})}
3755
3358
 
3756
3359
  @media (max-width: 639px) {
3757
3360
  .cf-panel.cf-panel--analytics-focus {
@@ -3872,4 +3475,4 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
3872
3475
  max-height: calc(100dvh - 24px);
3873
3476
  }
3874
3477
  }
3875
- `,Ep="centrinfo-widget";class mO extends HTMLElement{constructor(){super(...arguments);se(this,"controls",null);se(this,"composerDraftStore",{value:""})}mountWith(r){const n=gO(r),a=this.shadowRoot??this.attachShadow({mode:"open"});if(this.style.zIndex=String(n.zIndex),"adoptedStyleSheets"in Document.prototype&&typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync=="function"){const o=new CSSStyleSheet;o.replaceSync(D1),a.adoptedStyleSheets=[o]}else{const o=document.createElement("style");n.styleNonce&&(o.nonce=n.styleNonce),o.textContent=D1,a.appendChild(o)}const i=n.demo?new gw:n.preview?new mw(new ev(n.apiBaseUrl,n.token,n.gifApiKey,n.analyticsContextToken,{agentName:n.agentName,agentAvatarUrl:n.agentAvatarUrl},n.identityToken,n.getIdentityToken,n.chatSurface),n.strings):new ev(n.apiBaseUrl,n.token,n.gifApiKey,n.analyticsContextToken,{agentName:n.agentName,agentAvatarUrl:n.agentAvatarUrl},n.identityToken,n.getIdentityToken,n.chatSurface);Jp(_(dO,{transport:i,config:n,bindControls:o=>this.controls=o,composerDraftStore:this.composerDraftStore}),a)}open(){this.controls?.open()}close(){this.controls?.close()}toggle(){this.controls?.toggle()}identify(r){this.controls?.identify(r)}clear(){this.controls?.startNew()}shutdown(){this.controls?.shutdown()}unmount(){this.shadowRoot&&Jp(null,this.shadowRoot)}}typeof customElements<"u"&&!customElements.get(Ep)&&customElements.define(Ep,mO);const yO=(t,e=document.body)=>{if(typeof document>"u")throw new Error("[centrinfo-widget] createWidget must run in a browser.");const r=document.createElement(Ep);return r.style.pointerEvents="none",r.style.position="fixed",r.style.inset="0",r.style.width="0",r.style.height="0",e.appendChild(r),r.mountWith(t),{open:()=>r.open(),close:()=>r.close(),toggle:()=>r.toggle(),show:()=>r.open(),hide:()=>r.close(),identify:n=>r.identify(n),update:n=>r.identify(n),clear:()=>r.clear(),shutdown:()=>r.shutdown(),logout:()=>r.shutdown(),destroy:()=>{r.unmount(),r.remove()}}},I1=t=>yO(t);let L1=null;const P1=t=>{L1?.destroy();const e=I1(t);return L1=e,e},_O=t=>t==="light"||t==="dark"||t==="auto"?t:void 0,_s=t=>{if(t==null||t.trim()==="")return;const e=Number(t);return Number.isFinite(e)?e:void 0},bO=t=>{if(t)try{const e=JSON.parse(t);return e&&typeof e=="object"?e:void 0}catch{return}},xO=t=>{const e=n=>t.getAttribute(n),r=e("data-token");return r?{token:r,apiBaseUrl:e("data-api-base")??void 0,accentColor:e("data-accent")??void 0,agentName:e("data-agent-name")??void 0,agentAvatarUrl:e("data-agent-avatar-url")??void 0,launcherIcon:e("data-launcher-icon")??void 0,gifApiKey:e("data-gif-api-key")??void 0,theme:_O(e("data-theme")),sound:e("data-sound")!=="false",openByDefault:e("data-open")==="true",demo:e("data-demo")==="true",preview:e("data-preview")==="true",alignment:e("data-alignment")==="left"?"left":void 0,horizontalPadding:_s(e("data-horizontal-padding")),verticalPadding:_s(e("data-vertical-padding")),hideDefaultLauncher:e("data-hide-launcher")==="true",styleNonce:(e("data-style-nonce")??t.nonce)||void 0,customLauncherSelector:e("data-custom-launcher-selector")??void 0,sessionDurationMinutes:_s(e("data-session-duration")),configRefreshSeconds:_s(e("data-config-refresh")),proactiveMessage:e("data-proactive-message")??void 0,proactiveDelaySeconds:_s(e("data-proactive-delay")),csat:e("data-csat")==="false"?!1:void 0,user:bO(e("data-user"))}:null},wO=t=>{typeof document>"u"||(document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t,{once:!0}))},SO=()=>{const t=document.currentScript??document.querySelector("script[data-token]");if(!t)return;const e=xO(t);e&&P1(e)};return wO(()=>{try{SO()}catch(t){console.error("[centrinfo-widget]",t)}}),Vr.createWidget=I1,Vr.init=P1,Object.defineProperty(Vr,Symbol.toStringTag,{value:"Module"}),Vr})({});
3478
+ `,Cr="centrinfo-widget";class rp extends HTMLElement{constructor(){super(...arguments);B(this,"controls",null);B(this,"composerDraftStore",{value:""})}mountWith(n){const a=ap(n),i=this.shadowRoot??this.attachShadow({mode:"open"});if(this.style.zIndex=String(a.zIndex),"adoptedStyleSheets"in Document.prototype&&typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync=="function"){const s=new CSSStyleSheet;s.replaceSync(Ro),i.adoptedStyleSheets=[s]}else{const s=document.createElement("style");a.styleNonce&&(s.nonce=a.styleNonce),s.textContent=Ro,i.appendChild(s)}const o=Lc(a);Jr(r(Qu,{transport:o,config:a,bindControls:s=>this.controls=s,composerDraftStore:this.composerDraftStore}),i)}open(){this.controls?.open()}close(){this.controls?.close()}toggle(){this.controls?.toggle()}identify(n){this.controls?.identify(n)}clear(){this.controls?.startNew()}shutdown(){this.controls?.shutdown()}unmount(){this.shadowRoot&&Jr(null,this.shadowRoot)}}typeof customElements<"u"&&!customElements.get(Cr)&&customElements.define(Cr,rp);const ip=(e,t=document.body)=>{if(typeof document>"u")throw new Error("[centrinfo-widget] createWidget must run in a browser.");const n=document.createElement(Cr);return n.style.pointerEvents="none",n.style.position="fixed",n.style.inset="0",n.style.width="0",n.style.height="0",t.appendChild(n),n.mountWith(e),{open:()=>n.open(),close:()=>n.close(),toggle:()=>n.toggle(),show:()=>n.open(),hide:()=>n.close(),identify:a=>n.identify(a),update:a=>n.identify(a),clear:()=>n.clear(),shutdown:()=>n.shutdown(),logout:()=>n.shutdown(),destroy:()=>{n.unmount(),n.remove()}}},Lo=e=>ip(e);let Do=null;const Po=e=>{Do?.destroy();const t=Lo(e);return Do=t,t},op=e=>e==="light"||e==="dark"||e==="auto"?e:void 0,Vn=e=>{if(e==null||e.trim()==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0},sp=e=>{if(e)try{const t=JSON.parse(e);return t&&typeof t=="object"?t:void 0}catch{return}},cp=e=>{const t=a=>e.getAttribute(a),n=t("data-token");return n?{token:n,apiBaseUrl:t("data-api-base")??void 0,accentColor:t("data-accent")??void 0,agentName:t("data-agent-name")??void 0,agentAvatarUrl:t("data-agent-avatar-url")??void 0,launcherIcon:t("data-launcher-icon")??void 0,gifApiKey:t("data-gif-api-key")??void 0,theme:op(t("data-theme")),sound:t("data-sound")!=="false",openByDefault:t("data-open")==="true",demo:t("data-demo")==="true",preview:t("data-preview")==="true",alignment:t("data-alignment")==="left"?"left":void 0,horizontalPadding:Vn(t("data-horizontal-padding")),verticalPadding:Vn(t("data-vertical-padding")),hideDefaultLauncher:t("data-hide-launcher")==="true",styleNonce:(t("data-style-nonce")??e.nonce)||void 0,customLauncherSelector:t("data-custom-launcher-selector")??void 0,sessionDurationMinutes:Vn(t("data-session-duration")),configRefreshSeconds:Vn(t("data-config-refresh")),proactiveMessage:t("data-proactive-message")??void 0,proactiveDelaySeconds:Vn(t("data-proactive-delay")),csat:t("data-csat")==="false"?!1:void 0,user:sp(t("data-user"))}:null},lp=document.currentScript?.src||document.querySelector('script[src*="centrinfo-widget"]')?.src||"",Oo=e=>new URL(e,lp||location.href).href;Fs(()=>import(Oo("centrinfo-widget-charts.js"))),Rc(()=>import(Oo("centrinfo-widget-dev.js")));const dp=e=>{typeof document>"u"||(document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",e,{once:!0}))},up=()=>{const e=document.currentScript??document.querySelector("script[data-token]");if(!e)return;const t=cp(e);t&&Po(t)};dp(()=>{try{up()}catch(e){console.error("[centrinfo-widget]",e)}});const Fo=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}));return St.createWidget=Lo,St.init=Po,Object.defineProperty(St,Symbol.toStringTag,{value:"Module"}),St})({});