/*! For license information please see 1464.31794191.js.LICENSE.txt */ (self.webpackChunk_coze_studio_app=self.webpackChunk_coze_studio_app||[]).push([["1464"],{50835:function(t,e,i){"use strict";var r=i(455069),n=i(805366);let s=(0,n.A)(function(t){return r.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.35 4.27c.68.47.86 1.4.38 2.08l-10 14.5a1.5 1.5 0 0 1-2.33.17l-6.5-7a1.5 1.5 0 0 1 2.2-2.04l5.23 5.63 8.94-12.96a1.5 1.5 0 0 1 2.08-.38Z",fill:"currentColor"}))},"tick");e.Z=s},450080:function(t,e,i){"use strict";i.d(e,{W8:()=>ti,ZP:()=>eM});var r=i("515680"),n=i("236476"),s=i("455069"),a=i("151064"),o={},l=(0,s.createContext)(o),h=(t,e)=>(0,r.Z)({},t,e),d=()=>(0,s.useContext)(l),u=(0,s.createContext)(()=>{});u.displayName="JVR.DispatchShowTools";function c(){return(0,s.useContext)(u)}var p=t=>{var{initial:e,dispatch:i,children:r}=t;return(0,a.jsx)(l.Provider,{value:e,children:(0,a.jsx)(u.Provider,{value:i,children:r})})};p.displayName="JVR.ShowTools";var f={},g=(0,s.createContext)(f),m=(t,e)=>(0,r.Z)({},t,e),v=()=>(0,s.useContext)(g),b=(0,s.createContext)(()=>{});b.displayName="JVR.DispatchExpands";var y=t=>{var{initial:e,dispatch:i,children:r}=t;return(0,a.jsx)(g.Provider,{value:e,children:(0,a.jsx)(b.Provider,{value:i,children:r})})};y.displayName="JVR.Expands";var x={Str:{as:"span","data-type":"string",style:{color:"var(--w-rjv-type-string-color, #cb4b16)"},className:"w-rjv-type",children:"string"},Url:{as:"a",style:{color:"var(--w-rjv-type-url-color, #0969da)"},"data-type":"url",className:"w-rjv-type",children:"url"},Undefined:{style:{color:"var(--w-rjv-type-undefined-color, #586e75)"},as:"span","data-type":"undefined",className:"w-rjv-type",children:"undefined"},Null:{style:{color:"var(--w-rjv-type-null-color, #d33682)"},as:"span","data-type":"null",className:"w-rjv-type",children:"null"},Map:{style:{color:"var(--w-rjv-type-map-color, #268bd2)",marginRight:3},as:"span","data-type":"map",className:"w-rjv-type",children:"Map"},Nan:{style:{color:"var(--w-rjv-type-nan-color, #859900)"},as:"span","data-type":"nan",className:"w-rjv-type",children:"NaN"},Bigint:{style:{color:"var(--w-rjv-type-bigint-color, #268bd2)"},as:"span","data-type":"bigint",className:"w-rjv-type",children:"bigint"},Int:{style:{color:"var(--w-rjv-type-int-color, #268bd2)"},as:"span","data-type":"int",className:"w-rjv-type",children:"int"},Set:{style:{color:"var(--w-rjv-type-set-color, #268bd2)",marginRight:3},as:"span","data-type":"set",className:"w-rjv-type",children:"Set"},Float:{style:{color:"var(--w-rjv-type-float-color, #859900)"},as:"span","data-type":"float",className:"w-rjv-type",children:"float"},True:{style:{color:"var(--w-rjv-type-boolean-color, #2aa198)"},as:"span","data-type":"bool",className:"w-rjv-type",children:"bool"},False:{style:{color:"var(--w-rjv-type-boolean-color, #2aa198)"},as:"span","data-type":"bool",className:"w-rjv-type",children:"bool"},Date:{style:{color:"var(--w-rjv-type-date-color, #268bd2)"},as:"span","data-type":"date",className:"w-rjv-type",children:"date"}},_=(0,s.createContext)(x),w=(t,e)=>(0,r.Z)({},t,e),A=()=>(0,s.useContext)(_),S=(0,s.createContext)(()=>{});S.displayName="JVR.DispatchTypes";function E(t){var{initial:e,dispatch:i,children:r}=t;return(0,a.jsx)(_.Provider,{value:e,children:(0,a.jsx)(S.Provider,{value:i,children:r})})}E.displayName="JVR.Types";var T=["style"];function C(t){var{style:e}=t,i=(0,n.Z)(t,T),s=(0,r.Z)({cursor:"pointer",height:"1em",width:"1em",userSelect:"none",display:"inline-flex"},e);return(0,a.jsx)("svg",(0,r.Z)({viewBox:"0 0 24 24",fill:"var(--w-rjv-arrow-color, currentColor)",style:s},i,{children:(0,a.jsx)("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})}))}C.displayName="JVR.TriangleArrow";var k={Arrow:{as:"span",className:"w-rjv-arrow",style:{transform:"rotate(0deg)",transition:"all 0.3s"},children:(0,a.jsx)(C,{})},Colon:{as:"span",style:{color:"var(--w-rjv-colon-color, var(--w-rjv-color))",marginLeft:0,marginRight:2},className:"w-rjv-colon",children:":"},Quote:{as:"span",style:{color:"var(--w-rjv-quotes-color, #236a7c)"},className:"w-rjv-quotes",children:'"'},ValueQuote:{as:"span",style:{color:"var(--w-rjv-quotes-string-color, #cb4b16)"},className:"w-rjv-quotes",children:'"'},BracketsLeft:{as:"span",style:{color:"var(--w-rjv-brackets-color, #236a7c)"},className:"w-rjv-brackets-start",children:"["},BracketsRight:{as:"span",style:{color:"var(--w-rjv-brackets-color, #236a7c)"},className:"w-rjv-brackets-end",children:"]"},BraceLeft:{as:"span",style:{color:"var(--w-rjv-curlybraces-color, #236a7c)"},className:"w-rjv-curlybraces-start",children:"{"},BraceRight:{as:"span",style:{color:"var(--w-rjv-curlybraces-color, #236a7c)"},className:"w-rjv-curlybraces-end",children:"}"}},M=(0,s.createContext)(k),B=(t,e)=>(0,r.Z)({},t,e),P=()=>(0,s.useContext)(M),R=(0,s.createContext)(()=>{});R.displayName="JVR.DispatchSymbols";var O=t=>{var{initial:e,dispatch:i,children:r}=t;return(0,a.jsx)(M.Provider,{value:e,children:(0,a.jsx)(R.Provider,{value:i,children:r})})};O.displayName="JVR.Symbols";var I={Copied:{className:"w-rjv-copied",style:{height:"1em",width:"1em",cursor:"pointer",verticalAlign:"middle",marginLeft:5}},CountInfo:{as:"span",className:"w-rjv-object-size",style:{color:"var(--w-rjv-info-color, #0000004d)",paddingLeft:8,fontStyle:"italic"}},CountInfoExtra:{as:"span",className:"w-rjv-object-extra",style:{paddingLeft:8}},Ellipsis:{as:"span",style:{cursor:"pointer",color:"var(--w-rjv-ellipsis-color, #cb4b16)",userSelect:"none"},className:"w-rjv-ellipsis",children:"..."},Row:{as:"div",className:"w-rjv-line"},KeyName:{as:"span",className:"w-rjv-object-key"}},L=(0,s.createContext)(I),D=(t,e)=>(0,r.Z)({},t,e),N=()=>(0,s.useContext)(L),j=(0,s.createContext)(()=>{});j.displayName="JVR.DispatchSection";var F=t=>{var{initial:e,dispatch:i,children:r}=t;return(0,a.jsx)(L.Provider,{value:e,children:(0,a.jsx)(j.Provider,{value:i,children:r})})};F.displayName="JVR.Section";var z={objectSortKeys:!1,indentWidth:15},H=(0,s.createContext)(z);H.displayName="JVR.Context";var G=(0,s.createContext)(()=>{});function U(t,e){return(0,r.Z)({},t,e)}G.displayName="JVR.DispatchContext";var V=()=>(0,s.useContext)(H),W=t=>{var{children:e,initialState:i,initialTypes:n}=t,[l,d]=(0,s.useReducer)(U,Object.assign({},z,i)),[u,c]=(0,s.useReducer)(h,o),[g,v]=(0,s.useReducer)(m,f),[b,_]=(0,s.useReducer)(w,x),[A,S]=(0,s.useReducer)(B,k),[T,C]=(0,s.useReducer)(D,I);return(0,s.useEffect)(()=>d((0,r.Z)({},i)),[i]),(0,a.jsx)(H.Provider,{value:l,children:(0,a.jsx)(G.Provider,{value:d,children:(0,a.jsx)(p,{initial:u,dispatch:c,children:(0,a.jsx)(y,{initial:g,dispatch:v,children:(0,a.jsx)(E,{initial:(0,r.Z)({},b,n),dispatch:_,children:(0,a.jsx)(O,{initial:A,dispatch:S,children:(0,a.jsx)(F,{initial:T,dispatch:C,children:e})})})})})})})};W.displayName="JVR.Provider";var Z=["isNumber","value","parentValue","keyName","keys"],$=["as","render"],Y=["as","render"],X=["as","render"],K=["as","style","render"],q=["as","render"],J=["as","render"],Q=["as","render"],tt=["as","render"],te=t=>{var{Quote:e={}}=P(),{isNumber:i,value:s,parentValue:o,keyName:l,keys:h}=t,d=(0,n.Z)(t,Z);if(i)return null;var{as:u,render:c}=e,p=(0,n.Z)(e,$),f=(0,r.Z)({},d,p),g=c&&"function"==typeof c&&c(f,{value:s,parentValue:o,keyName:l,keys:h||(l?[l]:[])});return g?g:(0,a.jsx)(u||"span",(0,r.Z)({},f))};te.displayName="JVR.Quote";var ti=t=>{var{ValueQuote:e={}}=P(),i=(0,r.Z)({},(function(t){if(null==t)throw TypeError("Cannot destructure "+t)}(t),t)),{as:s,render:o}=e,l=(0,n.Z)(e,Y),h=(0,r.Z)({},i,l),d=o&&"function"==typeof o&&o(h,{});return d?d:(0,a.jsx)(s||"span",(0,r.Z)({},h))};ti.displayName="JVR.ValueQuote";var tr=t=>{var{value:e,parentValue:i,keyName:s,keys:o}=t,{Colon:l={}}=P(),{as:h,render:d}=l,u=(0,n.Z)(l,X),c=d&&"function"==typeof d&&d(u,{value:e,parentValue:i,keyName:s,keys:o||(s?[s]:[])});return c?c:(0,a.jsx)(h||"span",(0,r.Z)({},u))};tr.displayName="JVR.Colon";var tn=t=>{var{Arrow:e={}}=P(),i=v(),{expandKey:s,style:o,value:l,parentValue:h,keyName:d,keys:u}=t,c=!!i[s],{as:p,style:f,render:g}=e,m=(0,n.Z)(e,K),b=(0,r.Z)({},m,{"data-expanded":c,style:(0,r.Z)({},f,o)}),y=g&&"function"==typeof g&&g(b,{value:l,parentValue:h,keyName:d,keys:u||(d?[d]:[])});return y?y:(0,a.jsx)(p||"span",(0,r.Z)({},m,{style:(0,r.Z)({},f,o)}))};tn.displayName="JVR.Arrow";var ts=t=>{var{isBrackets:e,value:i,parentValue:s,keyName:o,keys:l}=t,{BracketsLeft:h={},BraceLeft:d={}}=P(),u={value:i,parentValue:s,keyName:o,keys:l||(o?[o]:[])};if(e){var{as:c,render:p}=h,f=(0,n.Z)(h,q),g=p&&"function"==typeof p&&p(f,u);return g?g:(0,a.jsx)(c||"span",(0,r.Z)({},f))}var{as:m,render:v}=d,b=(0,n.Z)(d,J),y=v&&"function"==typeof v&&v(b,u);return y?y:(0,a.jsx)(m||"span",(0,r.Z)({},b))};ts.displayName="JVR.BracketsOpen";var ta=t=>{var{isBrackets:e,isVisiable:i,value:s,parentValue:o,keyName:l,keys:h}=t,d={value:s,parentValue:o,keyName:l,keys:h||(l?[l]:[])};if(!i)return null;var{BracketsRight:u={},BraceRight:c={}}=P();if(e){var{as:p,render:f}=u,g=(0,n.Z)(u,Q),m=f&&"function"==typeof f&&f(g,d);return m?m:(0,a.jsx)(p||"span",(0,r.Z)({},g))}var{as:v,render:b}=c,y=(0,n.Z)(c,tt),x=b&&"function"==typeof b&&b(y,d);return x?x:(0,a.jsx)(v||"span",(0,r.Z)({},y))};ta.displayName="JVR.BracketsClose";var to=t=>{var e,{value:i,expandKey:r,level:n,keys:s=[]}=t,o=v(),l=Array.isArray(i),{collapsed:h,shouldExpandNodeInitially:d}=V(),u=i instanceof Set,c=null!=(e=o[r])?e:"boolean"==typeof h?h:"number"==typeof h&&n>h,p=Object.keys(i).length;return void 0===o[r]&&d&&d(c,{value:i,keys:s,level:n})||c||0===p?null:(0,a.jsx)("div",{style:{paddingLeft:4},children:(0,a.jsx)(ta,{isBrackets:l||u,isVisiable:!0})})};to.displayName="JVR.NestedClose";var tl=["as","render"],th=["as","render"],td=["as","render"],tu=["as","render"],tc=["as","render"],tp=["as","render"],tf=["as","render"],tg=["as","render"],tm=["as","render"],tv=["as","render"],tb=["as","render"],ty=["as","render"],tx=["as","render"],t_=t=>{if(void 0===t)return"0n";if("string"==typeof t)try{t=BigInt(t)}catch(t){return"0n"}return t?t.toString()+"n":"0n"},tw=t=>{var{value:e,keyName:i}=t,{Set:s={},displayDataTypes:o}=A();if(!(e instanceof Set)||!o)return null;var{as:l,render:h}=s,d=(0,n.Z)(s,tl),u=h&&"function"==typeof h&&h(d,{type:"type",value:e,keyName:i});return u?u:(0,a.jsx)(l||"span",(0,r.Z)({},d))};tw.displayName="JVR.SetComp";var tA=t=>{var{value:e,keyName:i}=t,{Map:s={},displayDataTypes:o}=A();if(!(e instanceof Map)||!o)return null;var{as:l,render:h}=s,d=(0,n.Z)(s,th),u=h&&"function"==typeof h&&h(d,{type:"type",value:e,keyName:i});return u?u:(0,a.jsx)(l||"span",(0,r.Z)({},d))};tA.displayName="JVR.MapComp";var tS={opacity:.75,paddingRight:4},tE=t=>{var{children:e="",keyName:i}=t,{Str:o={},displayDataTypes:l}=A(),{shortenTextAfterLength:h=30,stringEllipsis:d="..."}=V(),{as:u,render:c}=o,p=(0,n.Z)(o,td),[f,g]=(0,s.useState)(h&&e.length>h);(0,s.useEffect)(()=>g(h&&e.length>h),[h]);var m=u||"span",v=(0,r.Z)({},tS,o.style||{});h>0&&(p.style=(0,r.Z)({},p.style,{cursor:e.length<=h?"initial":"pointer"}),e.length>h&&(p.onClick=()=>{g(!f)}));var b=f?""+e.slice(0,h)+d:e,y=c&&"function"==typeof c,x=y&&c((0,r.Z)({},p,{style:v}),{type:"type",value:e,keyName:i}),_=f?"w-rjv-value w-rjv-value-short":"w-rjv-value",w=y&&c((0,r.Z)({},p,{children:b,className:_}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(x||(0,a.jsx)(m,(0,r.Z)({},p,{style:v}))),w||(0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(ti,{}),(0,a.jsx)(m,(0,r.Z)({},p,{className:_,children:b})),(0,a.jsx)(ti,{})]})]})};tE.displayName="JVR.TypeString";var tT=t=>{var{children:e,keyName:i}=t,{True:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tu),c=h||"span",p=(0,r.Z)({},tS,o.style||{}),f=d&&"function"==typeof d,g=f&&d((0,r.Z)({},u,{style:p}),{type:"type",value:e,keyName:i}),m=f&&d((0,r.Z)({},u,{children:e,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(g||(0,a.jsx)(c,(0,r.Z)({},u,{style:p}))),m||(0,a.jsx)(c,(0,r.Z)({},u,{className:"w-rjv-value",children:null==e?void 0:e.toString()}))]})};tT.displayName="JVR.TypeTrue";var tC=t=>{var{children:e,keyName:i}=t,{False:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tc),c=h||"span",p=(0,r.Z)({},tS,o.style||{}),f=d&&"function"==typeof d,g=f&&d((0,r.Z)({},u,{style:p}),{type:"type",value:e,keyName:i}),m=f&&d((0,r.Z)({},u,{children:e,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(g||(0,a.jsx)(c,(0,r.Z)({},u,{style:p}))),m||(0,a.jsx)(c,(0,r.Z)({},u,{className:"w-rjv-value",children:null==e?void 0:e.toString()}))]})};tC.displayName="JVR.TypeFalse";var tk=t=>{var{children:e,keyName:i}=t,{Float:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tp),c=h||"span",p=(0,r.Z)({},tS,o.style||{}),f=d&&"function"==typeof d,g=f&&d((0,r.Z)({},u,{style:p}),{type:"type",value:e,keyName:i}),m=f&&d((0,r.Z)({},u,{children:e,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(g||(0,a.jsx)(c,(0,r.Z)({},u,{style:p}))),m||(0,a.jsx)(c,(0,r.Z)({},u,{className:"w-rjv-value",children:null==e?void 0:e.toString()}))]})};tk.displayName="JVR.TypeFloat";var tM=t=>{var{children:e,keyName:i}=t,{Int:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tf),c=h||"span",p=(0,r.Z)({},tS,o.style||{}),f=d&&"function"==typeof d,g=f&&d((0,r.Z)({},u,{style:p}),{type:"type",value:e,keyName:i}),m=f&&d((0,r.Z)({},u,{children:e,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(g||(0,a.jsx)(c,(0,r.Z)({},u,{style:p}))),m||(0,a.jsx)(c,(0,r.Z)({},u,{className:"w-rjv-value",children:null==e?void 0:e.toString()}))]})};tM.displayName="JVR.TypeInt";var tB=t=>{var{children:e,keyName:i}=t,{Bigint:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tg),c=h||"span",p=(0,r.Z)({},tS,o.style||{}),f=d&&"function"==typeof d,g=f&&d((0,r.Z)({},u,{style:p}),{type:"type",value:e,keyName:i}),m=f&&d((0,r.Z)({},u,{children:e,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(g||(0,a.jsx)(c,(0,r.Z)({},u,{style:p}))),m||(0,a.jsx)(c,(0,r.Z)({},u,{className:"w-rjv-value",children:t_(null==e?void 0:e.toString())}))]})};tB.displayName="JVR.TypeFloat";var tP=t=>{var{children:e,keyName:i}=t,{Url:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tm),c=(0,r.Z)({},tS,o.style),p=d&&"function"==typeof d,f=p&&d((0,r.Z)({},u,{style:c}),{type:"type",value:e,keyName:i}),g=p&&d((0,r.Z)({},u,{children:null==e?void 0:e.href,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(f||(0,a.jsx)(h||"span",(0,r.Z)({},u,{style:c}))),g||(0,a.jsxs)("a",(0,r.Z)({href:null==e?void 0:e.href,target:"_blank"},u,{className:"w-rjv-value",children:[(0,a.jsx)(ti,{}),null==e?void 0:e.href,(0,a.jsx)(ti,{})]}))]})};tP.displayName="JVR.TypeUrl";var tR=t=>{var{children:e,keyName:i}=t,{Date:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tv),c=h||"span",p=(0,r.Z)({},tS,o.style||{}),f=d&&"function"==typeof d,g=f&&d((0,r.Z)({},u,{style:p}),{type:"type",value:e,keyName:i}),m=e instanceof Date?e.toLocaleString():e,v=f&&d((0,r.Z)({},u,{children:m,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(g||(0,a.jsx)(c,(0,r.Z)({},u,{style:p}))),v||(0,a.jsx)(c,(0,r.Z)({},u,{className:"w-rjv-value",children:m}))]})};tR.displayName="JVR.TypeDate";var tO=t=>{var{children:e,keyName:i}=t,{Undefined:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tb),c=(0,r.Z)({},tS,o.style||{}),p=d&&"function"==typeof d,f=p&&d((0,r.Z)({},u,{style:c}),{type:"type",value:e,keyName:i}),g=p&&d((0,r.Z)({},u,{children:e,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(f||(0,a.jsx)(h||"span",(0,r.Z)({},u,{style:c}))),g]})};tO.displayName="JVR.TypeUndefined";var tI=t=>{var{children:e,keyName:i}=t,{Null:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,ty),c=(0,r.Z)({},tS,o.style||{}),p=d&&"function"==typeof d,f=p&&d((0,r.Z)({},u,{style:c}),{type:"type",value:e,keyName:i}),g=p&&d((0,r.Z)({},u,{children:e,className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(f||(0,a.jsx)(h||"span",(0,r.Z)({},u,{style:c}))),g]})};tI.displayName="JVR.TypeNull";var tL=t=>{var{children:e,keyName:i}=t,{Nan:o={},displayDataTypes:l}=A(),{as:h,render:d}=o,u=(0,n.Z)(o,tx),c=(0,r.Z)({},tS,o.style||{}),p=d&&"function"==typeof d,f=p&&d((0,r.Z)({},u,{style:c}),{type:"type",value:e,keyName:i}),g=p&&d((0,r.Z)({},u,{children:null==e?void 0:e.toString(),className:"w-rjv-value"}),{type:"value",value:e,keyName:i});return(0,a.jsxs)(s.Fragment,{children:[l&&(f||(0,a.jsx)(h||"span",(0,r.Z)({},u,{style:c}))),g]})};tL.displayName="JVR.TypeNan";var tD=t=>Number(t)===t&&t%1!=0||isNaN(t),tN=t=>{var{value:e,keyName:i}=t,n={keyName:i};if(e instanceof URL)return(0,a.jsx)(tP,(0,r.Z)({},n,{children:e}));if("string"==typeof e)return(0,a.jsx)(tE,(0,r.Z)({},n,{children:e}));if(!0===e)return(0,a.jsx)(tT,(0,r.Z)({},n,{children:e}));if(!1===e)return(0,a.jsx)(tC,(0,r.Z)({},n,{children:e}));if(null===e)return(0,a.jsx)(tI,(0,r.Z)({},n,{children:e}));if(void 0===e)return(0,a.jsx)(tO,(0,r.Z)({},n,{children:e}));if(e instanceof Date)return(0,a.jsx)(tR,(0,r.Z)({},n,{children:e}));if("number"==typeof e&&isNaN(e))return(0,a.jsx)(tL,(0,r.Z)({},n,{children:e}));if("number"==typeof e&&tD(e))return(0,a.jsx)(tk,(0,r.Z)({},n,{children:e}));if("bigint"==typeof e)return(0,a.jsx)(tB,(0,r.Z)({},n,{children:e}));else if("number"==typeof e)return(0,a.jsx)(tM,(0,r.Z)({},n,{children:e}));return null};function tj(t,e,i){var n=(0,s.useContext)(R),a=[t.className,e.className].filter(Boolean).join(" "),o=(0,r.Z)({},t,e,{className:a,style:(0,r.Z)({},t.style,e.style),children:e.children||t.children});(0,s.useEffect)(()=>n({[i]:o}),[e])}function tF(t,e,i){var n=(0,s.useContext)(S),a=[t.className,e.className].filter(Boolean).join(" "),o=(0,r.Z)({},t,e,{className:a,style:(0,r.Z)({},t.style,e.style),children:e.children||t.children});(0,s.useEffect)(()=>n({[i]:o}),[e])}function tz(t,e,i){var n=(0,s.useContext)(j),a=[t.className,e.className].filter(Boolean).join(" "),o=(0,r.Z)({},t,e,{className:a,style:(0,r.Z)({},t.style,e.style),children:e.children||t.children});(0,s.useEffect)(()=>n({[i]:o}),[e])}tN.displayName="JVR.Value";var tH=["as","render"],tG=t=>{var{KeyName:e={}}=N();return tz(e,t,"KeyName"),null};tG.displayName="JVR.KeyName";var tU=t=>{var{children:e,value:i,parentValue:s,keyName:o,keys:l}=t,h="number"==typeof e,{KeyName:d={}}=N(),{as:u,render:c}=d,p=(0,n.Z)(d,tH);p.style=(0,r.Z)({},p.style,{color:h?"var(--w-rjv-key-number, #268bd2)":"var(--w-rjv-key-string, #002b36)"});var f=c&&"function"==typeof c&&c((0,r.Z)({},p,{children:e}),{value:i,parentValue:s,keyName:o,keys:l||(o?[o]:[])});return f?f:(0,a.jsx)(u||"span",(0,r.Z)({},p,{children:e}))};tU.displayName="JVR.KeyNameComp";var tV=["children","value","parentValue","keyName","keys"],tW=["as","render","children"],tZ=t=>{var{Row:e={}}=N();return tz(e,t,"Row"),null};tZ.displayName="JVR.Row";var t$=t=>{var{children:e,value:i,parentValue:s,keyName:o,keys:l}=t,h=(0,n.Z)(t,tV),{Row:d={}}=N(),{as:u,render:c}=d,p=(0,n.Z)(d,tW),f=c&&"function"==typeof c&&c((0,r.Z)({},h,p,{children:e}),{value:i,keyName:o,parentValue:s,keys:l});return f?f:(0,a.jsx)(u||"div",(0,r.Z)({},h,p,{children:e}))};t$.displayName="JVR.RowComp";var tY=["keyName","value","parentValue","expandKey","keys"],tX=["as","render"],tK=t=>{var{keyName:e,value:i,parentValue:o,expandKey:l,keys:h}=t,u=(0,n.Z)(t,tY),{onCopied:c,enableClipboard:p}=V(),f=d()[l],[g,m]=(0,s.useState)(!1),{Copied:v={}}=N();if(!1===p||!f)return null;var b={style:{display:"inline-flex"},fill:g?"var(--w-rjv-copied-success-color, #28a745)":"var(--w-rjv-copied-color, currentColor)",onClick:t=>{t.stopPropagation();var e="";e="number"==typeof i&&i===1/0?"Infinity":"number"==typeof i&&isNaN(i)?"NaN":"bigint"==typeof i?t_(i):i instanceof Date?i.toLocaleString():JSON.stringify(i,(t,e)=>"bigint"==typeof e?t_(e):e,2),c&&c(e,i),m(!0),(navigator.clipboard||{writeText:t=>new Promise((e,i)=>{var r=document.createElement("textarea");r.style.position="absolute",r.style.opacity="0",r.style.left="-99999999px",r.value=t,document.body.appendChild(r),r.select(),document.execCommand("copy")?e():i(),r.remove()})}).writeText(e).then(()=>{var t=setTimeout(()=>{m(!1),clearTimeout(t)},3e3)}).catch(t=>{})}},{render:y}=v,x=(0,n.Z)(v,tX),_=(0,r.Z)({},x,u,b,{style:(0,r.Z)({},x.style,u.style,b.style)}),w=y&&"function"==typeof y&&y((0,r.Z)({},_,{"data-copied":g}),{value:i,keyName:e,keys:h,parentValue:o});return w?w:g?(0,a.jsx)("svg",(0,r.Z)({viewBox:"0 0 32 36"},_,{children:(0,a.jsx)("path",{d:"M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z"})})):(0,a.jsx)("svg",(0,r.Z)({viewBox:"0 0 32 36"},_,{children:(0,a.jsx)("path",{d:"M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z"})}))};function tq(){var t=(0,s.useRef)(null);return null===t.current&&(t.current="custom-id-"+Math.random().toString(36).substr(2,9)),t.current}tK.displayName="JVR.Copied";var tJ=t=>{var e,{value:i,expandKey:r="",level:n,keys:s=[]}=t,o=v(),{objectSortKeys:l,indentWidth:h,collapsed:d,shouldExpandNodeInitially:u}=V(),c=Array.isArray(i),p=null!=(e=o[r])?e:"boolean"==typeof d?d:"number"==typeof d&&n>d;if(void 0===o[r]&&u&&u(p,{value:i,keys:s,level:n})||p)return null;var f=c?Object.entries(i).map(t=>[Number(t[0]),t[1]]):Object.entries(i);return l&&(f=!0===l?f.sort((t,e)=>{var[i]=t,[r]=e;return"string"==typeof i&&"string"==typeof r?i.localeCompare(r):0}):f.sort((t,e)=>{var[i,r]=t,[n,s]=e;return"string"==typeof i&&"string"==typeof n?l(i,n,r,s):0})),(0,a.jsx)("div",{className:"w-rjv-wrap",style:{borderLeft:"var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)",paddingLeft:h,marginLeft:6},children:f.map((t,e)=>{var[r,o]=t;return(0,a.jsx)(t0,{parentValue:i,keyName:r,keys:[...s,r],value:o,level:n},e)})})};tJ.displayName="JVR.KeyValues";var tQ=t=>{var{keyName:e,parentValue:i,keys:n,value:o}=t,{highlightUpdates:l}=V(),h="number"==typeof e,d=(0,s.useRef)(null);!function(t){var e,i,{value:r,highlightUpdates:n,highlightContainer:a}=t;var o=(e=r,i=(0,s.useRef)(),(0,s.useEffect)(()=>{i.current=e}),i.current),l=(0,s.useMemo)(()=>{if(!n||void 0===o)return!1;if(typeof r!=typeof o)return!0;if("number"==typeof r)return!(isNaN(r)&&isNaN(o))&&r!==o;return Array.isArray(r)!==Array.isArray(o)||"object"!=typeof r&&"function"!=typeof r&&(r!==o||void 0)},[n,r]);(0,s.useEffect)(()=>{a&&a.current&&l&&"animate"in a.current&&a.current.animate([{backgroundColor:"var(--w-rjv-update-color, #ebcb8b)"},{backgroundColor:""}],{duration:1e3,easing:"ease-in"})},[l,r,a])}({value:o,highlightUpdates:l,highlightContainer:d});var u={keyName:e,value:o,keys:n,parentValue:i};return(0,a.jsxs)(s.Fragment,{children:[(0,a.jsxs)("span",{ref:d,children:[(0,a.jsx)(te,(0,r.Z)({isNumber:h,"data-placement":"left"},u)),(0,a.jsx)(tU,(0,r.Z)({},u,{children:e})),(0,a.jsx)(te,(0,r.Z)({isNumber:h,"data-placement":"right"},u))]}),(0,a.jsx)(tr,(0,r.Z)({},u))]})};tQ.displayName="JVR.KayName";var t0=t=>{var{keyName:e,value:i,parentValue:n,level:s=0,keys:o=[]}=t,l=c(),h=tq(),d=Array.isArray(i),u=i instanceof Set,p=i instanceof Map,f=i instanceof Date,g=i instanceof URL,m=i&&"object"==typeof i&&!d&&!u&&!p&&!f&&!g;if(m||d||u||p){var v=u?Array.from(i):p?Object.fromEntries(i):i;return(0,a.jsx)(en,{keyName:e,value:v,parentValue:n,initialValue:i,keys:o,level:s+1})}return(0,a.jsxs)(t$,(0,r.Z)({className:"w-rjv-line",value:i,keyName:e,keys:o,parentValue:n},{onMouseEnter:()=>l({[h]:!0}),onMouseLeave:()=>l({[h]:!1})},{children:[(0,a.jsx)(tQ,{keyName:e,value:i,keys:o,parentValue:n}),(0,a.jsx)(tN,{keyName:e,value:i}),(0,a.jsx)(tK,{keyName:e,value:i,keys:o,parentValue:n,expandKey:h})]}))};t0.displayName="JVR.KeyValuesItem";var t1=["value","keyName"],t2=["as","render"],t5=t=>{var{CountInfoExtra:e={}}=N();return tz(e,t,"CountInfoExtra"),null};t5.displayName="JVR.CountInfoExtra";var t3=t=>{var{value:e={},keyName:i}=t,s=(0,n.Z)(t,t1),{CountInfoExtra:o={}}=N(),{as:l,render:h}=o,d=(0,n.Z)(o,t2);if(!h&&!d.children)return null;var u=(0,r.Z)({},d,s),c=h&&"function"==typeof h&&h(u,{value:e,keyName:i});return c?c:(0,a.jsx)(l||"span",(0,r.Z)({},u))};t3.displayName="JVR.CountInfoExtraComps";var t4=["value","keyName"],t6=["as","render"],t8=t=>{var{CountInfo:e={}}=N();return tz(e,t,"CountInfo"),null};t8.displayName="JVR.CountInfo";var t7=t=>{var{value:e={},keyName:i}=t,s=(0,n.Z)(t,t4),{displayObjectSize:o}=V(),{CountInfo:l={}}=N();if(!o)return null;var{as:h,render:d}=l,u=(0,n.Z)(l,t6);u.style=(0,r.Z)({},u.style,t.style);var c=Object.keys(e).length;!u.children&&(u.children=c+" item"+(1===c?"":"s"));var p=(0,r.Z)({},u,s),f=d&&"function"==typeof d&&d((0,r.Z)({},p,{"data-length":c}),{value:e,keyName:i});return f?f:(0,a.jsx)(h||"span",(0,r.Z)({},p))};t7.displayName="JVR.CountInfoComp";var t9=["as","render"],et=t=>{var{Ellipsis:e={}}=N();return tz(e,t,"Ellipsis"),null};et.displayName="JVR.Ellipsis";var ee=t=>{var{isExpanded:e,value:i,keyName:s}=t,{Ellipsis:o={}}=N(),{as:l,render:h}=o,d=(0,n.Z)(o,t9),u=h&&"function"==typeof h&&h((0,r.Z)({},d,{"data-expanded":e}),{value:i,keyName:s});return u?u:e&&("object"!=typeof i||0!=Object.keys(i).length)?(0,a.jsx)(l||"span",(0,r.Z)({},d)):null};ee.displayName="JVR.EllipsisComp";var ei=t=>{var e,{keyName:i,expandKey:n,keys:o=[],initialValue:l,value:h,parentValue:d,level:u}=t,c=v(),p=(0,s.useContext)(b),{onExpand:f,collapsed:g,shouldExpandNodeInitially:m}=V(),y=Array.isArray(h),x=h instanceof Set,_="object"==typeof h,w=null!=(e=c[n])?e:"boolean"==typeof g?g:"number"==typeof g&&u>g,A=m&&m(w,{value:h,keys:o,level:u});void 0===c[n]&&void 0!==A&&(w=A);var S={transform:"rotate("+(w?"-90":"0")+"deg)",transition:"all 0.3s"},E=0!==Object.keys(h).length&&(y||x||_),T={style:{display:"inline-flex",alignItems:"center"}};E&&(T.onClick=()=>{var t={expand:!w,value:h,keyid:n,keyName:i};f&&f(t),p({[n]:t.expand})});var C={keyName:i,value:h,keys:o,parentValue:d};return(0,a.jsxs)("span",(0,r.Z)({},T,{children:[E&&(0,a.jsx)(tn,(0,r.Z)({style:S,expandKey:n},C)),(i||"number"==typeof i)&&(0,a.jsx)(tQ,(0,r.Z)({},C)),(0,a.jsx)(tw,{value:l,keyName:i}),(0,a.jsx)(tA,{value:l,keyName:i}),(0,a.jsx)(ts,(0,r.Z)({isBrackets:y||x},C)),(0,a.jsx)(ee,{keyName:i,value:h,isExpanded:w}),(0,a.jsx)(ta,(0,r.Z)({isVisiable:w||!E,isBrackets:y||x},C)),(0,a.jsx)(t7,{value:h,keyName:i}),(0,a.jsx)(t3,{value:h,keyName:i}),(0,a.jsx)(tK,{keyName:i,value:h,expandKey:n,parentValue:d,keys:o})]}))};ei.displayName="JVR.NestedOpen";var er=["className","children","parentValue","keyid","level","value","initialValue","keys","keyName"],en=(0,s.forwardRef)((t,e)=>{var{className:i="",parentValue:s,level:o=1,value:l,initialValue:h,keys:d,keyName:u}=t,p=(0,n.Z)(t,er),f=c(),g=tq(),m=[i,"w-rjv-inner"].filter(Boolean).join(" ");return(0,a.jsxs)("div",(0,r.Z)({className:m,ref:e},p,{onMouseEnter:()=>f({[g]:!0}),onMouseLeave:()=>f({[g]:!1})},{children:[(0,a.jsx)(ei,{expandKey:g,value:l,level:o,keys:d,parentValue:s,keyName:u,initialValue:h}),(0,a.jsx)(tJ,{expandKey:g,value:l,level:o,keys:d,parentValue:s,keyName:u}),(0,a.jsx)(to,{expandKey:g,value:l,level:o,keys:d})]}))});en.displayName="JVR.Container";var es=t=>{var{BraceLeft:e={}}=P();return tj(e,t,"BraceLeft"),null};es.displayName="JVR.BraceLeft";var ea=t=>{var{BraceRight:e={}}=P();return tj(e,t,"BraceRight"),null};ea.displayName="JVR.BraceRight";var eo=t=>{var{BracketsLeft:e={}}=P();return tj(e,t,"BracketsLeft"),null};eo.displayName="JVR.BracketsLeft";var el=t=>{var{BracketsRight:e={}}=P();return tj(e,t,"BracketsRight"),null};el.displayName="JVR.BracketsRight";var eh=t=>{var{Arrow:e={}}=P();return tj(e,t,"Arrow"),null};eh.displayName="JVR.Arrow";var ed=t=>{var{Colon:e={}}=P();return tj(e,t,"Colon"),null};ed.displayName="JVR.Colon";var eu=t=>{var{Quote:e={}}=P();return tj(e,t,"Quote"),null};eu.displayName="JVR.Quote";var ec=t=>{var{ValueQuote:e={}}=P();return tj(e,t,"ValueQuote"),null};ec.displayName="JVR.ValueQuote";var ep=t=>{var{Bigint:e={}}=A();return tF(e,t,"Bigint"),null};ep.displayName="JVR.Bigint";var ef=t=>{var{Date:e={}}=A();return tF(e,t,"Date"),null};ef.displayName="JVR.Date";var eg=t=>{var{False:e={}}=A();return tF(e,t,"False"),null};eg.displayName="JVR.False";var em=t=>{var{Float:e={}}=A();return tF(e,t,"Float"),null};em.displayName="JVR.Float";var ev=t=>{var{Int:e={}}=A();return tF(e,t,"Int"),null};ev.displayName="JVR.Int";var eb=t=>{var{Map:e={}}=A();return tF(e,t,"Map"),null};eb.displayName="JVR.Map";var ey=t=>{var{Nan:e={}}=A();return tF(e,t,"Nan"),null};ey.displayName="JVR.Nan";var ex=t=>{var{Null:e={}}=A();return tF(e,t,"Null"),null};ex.displayName="JVR.Null";var e_=t=>{var{Set:e={}}=A();return tF(e,t,"Set"),null};e_.displayName="JVR.Set";var ew=t=>{var{Str:e={}}=A();return tF(e,t,"Str"),null};ew.displayName="JVR.StringText";var eA=t=>{var{True:e={}}=A();return tF(e,t,"True"),null};eA.displayName="JVR.True";var eS=t=>{var{Undefined:e={}}=A();return tF(e,t,"Undefined"),null};eS.displayName="JVR.Undefined";var eE=t=>{var{Url:e={}}=A();return tF(e,t,"Url"),null};eE.displayName="JVR.Url";var eT=t=>{var{Copied:e={}}=N();return tz(e,t,"Copied"),null};eT.displayName="JVR.Copied";var eC=["className","style","value","children","collapsed","shouldExpandNodeInitially","indentWidth","displayObjectSize","shortenTextAfterLength","stringEllipsis","highlightUpdates","enableClipboard","displayDataTypes","objectSortKeys","onExpand","onCopied"],ek=(0,s.forwardRef)((t,e)=>{var{className:i="",style:s,value:o,children:l,collapsed:h,shouldExpandNodeInitially:d,indentWidth:u=15,displayObjectSize:c=!0,shortenTextAfterLength:p=30,stringEllipsis:f,highlightUpdates:g=!0,enableClipboard:m=!0,displayDataTypes:v=!0,objectSortKeys:b=!1,onExpand:y,onCopied:x}=t,_=(0,n.Z)(t,eC),w=(0,r.Z)({lineHeight:1.4,fontFamily:"var(--w-rjv-font-family, Menlo, monospace)",color:"var(--w-rjv-color, #002b36)",backgroundColor:"var(--w-rjv-background-color, #00000000)",fontSize:13},s),A=["w-json-view-container","w-rjv",i].filter(Boolean).join(" ");return(0,a.jsxs)(W,{initialState:{value:o,objectSortKeys:b,indentWidth:u,shouldExpandNodeInitially:d,displayObjectSize:c,collapsed:h,enableClipboard:m,shortenTextAfterLength:p,stringEllipsis:f,highlightUpdates:g,onCopied:x,onExpand:y},initialTypes:{displayDataTypes:v},children:[(0,a.jsx)(en,(0,r.Z)({value:o},_,{ref:e,className:A,style:w})),l]})});ek.Bigint=ep,ek.Date=ef,ek.False=eg,ek.Float=em,ek.Int=ev,ek.Map=eb,ek.Nan=ey,ek.Null=ex,ek.Set=e_,ek.String=ew,ek.True=eA,ek.Undefined=eS,ek.Url=eE,ek.ValueQuote=ec,ek.Arrow=eh,ek.Colon=ed,ek.Quote=eu,ek.Ellipsis=et,ek.BraceLeft=es,ek.BraceRight=ea,ek.BracketsLeft=eo,ek.BracketsRight=el,ek.Copied=eT,ek.CountInfo=t8,ek.CountInfoExtra=t5,ek.KeyName=tG,ek.Row=tZ,ek.displayName="JVR.JsonView";var eM=ek},261164:function(t,e,i){"use strict";let r,n,s,a,o,l,h,d;i.d(e,{G7x:()=>uL,Cmj:()=>tF,zHd:()=>tz});var u,c,p,f,g,m,v,b,y,x,_,w,A,S,E,T,C,k,M,B,P,R,O,I,L,D,N,j,F,z,H,G,U,V,W,Z,$,Y,X,K,q,J,Q,tt,te,ti,tr,tn,ts,ta,to,tl,th,td,tu,tc,tp,tf,tg,tm,tv,tb,ty,tx,t_,tw,tA,tS,tE,tT,tC,tk,tM,tB,tP,tR,tO,tI,tL,tD,tN,tj,tF,tz,tH,tG,tU,tV,tW,tZ,t$,tY,tX,tK,tq,tJ,tQ,t0,t1,t2,t5,t3,t4,t6,t8,t7,t9,et,ee,ei,er,en,es,ea,eo,el,eh={};i.r(eh),i.d(eh,{Color:()=>n_,DEFAULT_COLORS:()=>ng,RGB:()=>nw,hexToRgb:()=>cE,hslToRgb:()=>nu,interpolateRgb:()=>cC,rgbToHex:()=>cT,rgbToHsl:()=>nc});var ed={};i.r(ed),i.d(ed,{Color:()=>bM,DEFAULT_COLORS:()=>bS,RGB:()=>bB,hexToRgb:()=>bP,hslToRgb:()=>bx,interpolateRgb:()=>bO,rgbToHex:()=>bR,rgbToHsl:()=>b_});var eu=i("954446"),ec=i.n(eu),ep=i("200007"),ef=i("269658");let eg=!1;try{eg="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){eg=!1}eg=!1;var em=function(t,e,i){let r,n,s,a,o,l,h=0,d=!1,u=!1,c=!0,p=!e&&0!==e&⪚if("function"!=typeof t)throw TypeError("Expected a function");function f(e){let i=r,s=n;return r=n=void 0,h=e,a=t.apply(s,i)}function g(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){let i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=s}function v(){let t=Date.now();if(m(t))return b(t);o=g(v,function(t){let i=t-h,r=e-(t-l);return u?Math.min(r,s-i):r}(t))}function b(t){return o=void 0,c&&r?f(t):(r=n=void 0,a)}function y(...t){let i=Date.now(),s=m(i);if(r=t,n=this,l=i,s){if(void 0===o){var c;return h=c=l,o=g(v,e),d?f(c):a}if(u)return o=g(v,e),f(l)}return void 0===o&&(o=g(v,e)),a}return e=+e||0,(0,ep.Z)(i)&&(d=!!i.leading,(u="maxWait"in i)&&(s=Math.max((0,ef.Z)(i.maxWait)?i.maxWait:0,e)),c="trailing"in i?!!i.trailing:c),y.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,r=l=n=o=void 0},y.flush=function(){return void 0===o?a:b(Date.now())},y.pending=function(){return void 0!==o},y},ev=i("464283"),eb=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},ey=t=>null!=t;function ex(t){return ey(t)?(0,ev.Z)(t)?t:[t]:[]}function e_(t){if(eb(t))return t[t.length-1]}let ew=(t,e)=>{var i;if(0===t.length)return;let r=t[0];for(let n=1;n0)&&(r=s)}return r},eA=(t,e)=>{var i;if(0===t.length)return;let r=t[0];for(let n=1;n=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){let e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){let i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){let i=this._find(e,!1);if(i>=0){let r=this._keys.length;for(let t=i+1;t{var n,s,a,o,l,h,d,u;let c,p;n=e,s=0,a=r,o=t,l=eI,h=n,d=a.toString(),u=o,c={},eD.hasOwnMetadata(l,h)&&(c=eD.getMetadata(l,h)),void 0===(p=c[d])&&(p=[]),p.push(u),c[d]=p,eD.defineMetadata(l,c,h)}}function ez(t){return e=>(i,r,n)=>eF(new ej(t,e))(i,r,n)}let eH=ez(eR);function eG(t){return eF(new ej(eP,t))}let eU=Symbol("ContributionProvider");class eV{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function eW(t,e){t(eU).toDynamicValue(({container:t})=>new eV(e,t)).inSingletonScope().whenTargetNamed(e)}class eZ{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){let i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter(t=>t.name!==i&&(!e||t.fn===e)))}_parseOptions(t,e,i){let r;if("string"==typeof e)r={name:e.trim()};else if("object"!=typeof e||null===e)throw Error("Invalid tap options");if("string"!=typeof r.name||""===r.name)throw Error("Missing name for tap");return Object.assign({type:t,fn:i},r)}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let r=this.taps.length;for(;r>0;){r--;let t=this.taps[r];this.taps[r+1]=t;let n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){r++;break}}this.taps[r]=t}}class e$ extends eZ{call(...t){this.taps.map(t=>t.fn).forEach(e=>e(...t))}}let eY=Symbol.for("EnvContribution"),eX=Symbol.for("VGlobal");var eK=function(t,e){return function(i,r){e(i,r,t)}};let eq=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=eM.GenAutoIncrementId(),this.hooks={onSetEnv:new e$(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){let e=[];if(this.contributions.getContributions().forEach(i=>{let r=i.configure(this,t);r&&r.then&&e.push(r)}),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){let i=this._env;this._env=t;let r=this.bindContribution(e);if(r&&r.then)return r.then(()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)});this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};eq=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),eK(0,eH(eU)),eK(0,eG(eY)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],eq);var eJ=i("791228");function eQ(t){return Math.PI/180*t}function e0(t){return 180*t/Math.PI}let e1=(t=0)=>{if(t<0)for(;t<-eJ.BZ;)t+=eJ.BZ;else if(t>0)for(;t>eJ.BZ;)t-=eJ.BZ;return t};function e2(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function e5(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class e3{constructor(t=1,e=0,i=0,r=1,n=0,s=0){this.a=t,this.b=e,this.c=i,this.d=r,this.e=n,this.f=s}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,r,n,s){return!(this.e!==n||this.f!==s||this.a!==t||this.d!==r||this.b!==e||this.c!==i)}setValue(t,e,i,r,n,s){return this.a=t,this.b=e,this.c=i,this.d=r,this.e=n,this.f=s,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){let t=this.a,e=this.b,i=this.c,r=this.d,n=this.e,s=this.f,a=new e3,o=t*r-e*i;return a.a=r/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*s-r*n)/o,a.f=-(t*s-e*n)/o,a}rotate(t){let e=Math.cos(t),i=Math.sin(t),r=this.a*e+this.c*i,n=this.b*e+this.d*i,s=-(this.a*i)+this.c*e,a=-(this.b*i)+this.d*e;return this.a=r,this.b=n,this.c=s,this.d=a,this}rotateByCenter(t,e,i){let r=Math.cos(t),n=Math.sin(t),s=r*this.a-n*this.b,a=n*this.a+r*this.b,o=r*this.c-n*this.d,l=n*this.c+r*this.d,h=r*this.e-n*this.f+((1-r)*e+n*i),d=n*this.e+r*this.f+((1-r)*i-n*e);return this.a=s,this.b=a,this.c=o,this.d=l,this.e=h,this.f=d,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,r,n,s){return this.multiply(t,e,i,r,n,s),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){let{a:t,b:e,c:i,d:r,e:n,f:s}=this;return this.a=e,this.b=t,this.c=r,this.d=i,this.e=s,this.f=n,this}multiply(t,e,i,r,n,s){let a=this.a,o=this.b,l=this.c,h=this.d,d=a*n+l*s+this.e,u=o*n+h*s+this.f;return this.a=a*t+l*e,this.b=o*t+h*e,this.c=a*i+l*r,this.d=o*i+h*r,this.e=d,this.f=u,this}interpolate(t,e){let i=new e3;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){let{a:i,b:r,c:n,d:s,e:a,f:o}=this,l=i*s-r*n,{x:h,y:d}=t;e.x=s/l*h+-n/l*d+(n*o-s*a)/l,e.y=-r/l*h+i/l*d+-(i*o-r*a)/l}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new e3(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){let t=this.a,e=this.b,i=this.c,r=this.d,n=t*r-e*i,s={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){let a=Math.sqrt(t*t+e*e);s.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),s.scaleX=a,s.scaleY=n/a,s.skewX=(t*i+e*r)/n,s.skewY=0}else if(0!==i||0!==r){let a=Math.sqrt(i*i+r*r);s.rotateDeg=Math.PI/2-(r>0?Math.acos(-i/a):-Math.acos(i/a)),s.scaleX=n/a,s.scaleY=a,s.skewX=0,s.skewY=(t*i+e*r)/n}return s.rotateDeg=e0(s.rotateDeg),s}}let e4=eJ.BZ-1e-8;class e6{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,r,n,s){if(Math.abs(n-r)>e4)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,d=1/0,u=-Infinity,c=1/0,p=-Infinity;function f(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(f(r),f(n),n!==r){if((r%=eJ.BZ)<0&&(r+=eJ.BZ),(n%=eJ.BZ)<0&&(n+=eJ.BZ),nn;++o,a-=eJ.ou)f(a);else for(a=r-r%eJ.ou+eJ.ou,o=0;o<4&&a{let r=t.x1,n=t.x2,s=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,d=e.y2;return i&&(r>n&&([r,n]=[n,r]),s>a&&([s,a]=[a,s]),o>l&&([o,l]=[l,o]),h>d&&([h,d]=[d,h])),{x11:r,x12:n,y11:s,y12:a,x21:o,x22:l,y21:h,y22:d}};function it(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||nd||athis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return(0,ev.Z)(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){let r=this.rotatedPoints(t,e,i);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(t=0,e=0,i=0,r=0){let n=this.scalePoints(t,e,i,r);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ia(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){let{x1:r,y1:n,x2:s,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,d=i-e*l-i*o;return[o*r-l*n+h,l*r+o*n+d,o*r-l*a+h,l*r+o*a+d,o*s-l*n+h,l*s+o*n+d,o*s-l*a+h,l*s+o*a+d]}scalePoints(t,e,i,r){let{x1:n,y1:s,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*s+(1-e)*r,t*a+(1-t)*i,e*o+(1-e)*r]}}class il extends io{}class ih{constructor(){this.curves=[],this.bounds=new il}getCurveLengths(){return this.curves.map(t=>t.getLength())}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}let id=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,iu={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},ic={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};(om=oP||(oP={}))[om.NONE=0]="NONE",om[om.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",om[om.UPDATE_SHAPE=2]="UPDATE_SHAPE",om[om.CLEAR_SHAPE=253]="CLEAR_SHAPE",om[om.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",om[om.INIT=179]="INIT",om[om.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",om[om.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",om[om.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",om[om.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",om[om.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",om[om.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",om[om.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",om[om.CLEAR_LAYOUT=127]="CLEAR_LAYOUT",(ov=oR||(oR={}))[ov.GLOBAL=1]="GLOBAL",ov[ov.LOCAL=16]="LOCAL",ov[ov.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",ov[ov.LOCAL_ACCURATE=48]="LOCAL_ACCURATE",(ob=oO||(oO={}))[ob.INIT=0]="INIT",ob[ob.DEFAULT=1]="DEFAULT",ob[ob.STATE=2]="STATE",ob[ob.ANIMATE_BIND=10]="ANIMATE_BIND",ob[ob.ANIMATE_PLAY=11]="ANIMATE_PLAY",ob[ob.ANIMATE_START=12]="ANIMATE_START",ob[ob.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",ob[ob.ANIMATE_END=14]="ANIMATE_END",ob[ob.TRANSLATE=20]="TRANSLATE",ob[ob.TRANSLATE_TO=21]="TRANSLATE_TO",ob[ob.SCALE=22]="SCALE",ob[ob.SCALE_TO=23]="SCALE_TO",ob[ob.ROTATE=24]="ROTATE",ob[ob.ROTATE_TO=25]="ROTATE_TO",(oy=oI||(oI={}))[oy.INITIAL=0]="INITIAL",oy[oy.RUNNING=1]="RUNNING",oy[oy.PAUSED=2]="PAUSED",oy[oy.END=3]="END",(ox=oL||(oL={}))[ox.NORMAL=0]="NORMAL",ox[ox.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY",(o_=oD||(oD={})).wait="wait",o_.from="from",o_.to="to",o_.customAnimate="customAnimate",(ow=oN||(oN={}))[ow.ROW=1]="ROW",ow[ow.COLUMN=2]="COLUMN",(oA=oj||(oj={}))[oA.CubicBezierCurve=0]="CubicBezierCurve",oA[oA.QuadraticBezierCurve=1]="QuadraticBezierCurve",oA[oA.ArcCurve=2]="ArcCurve",oA[oA.LineCurve=3]="LineCurve",oA[oA.EllipseCurve=4]="EllipseCurve",oA[oA.MoveCurve=5]="MoveCurve",(oS=oF||(oF={}))[oS.beforeFillStroke=0]="beforeFillStroke",oS[oS.afterFillStroke=1]="afterFillStroke";function ip(t,e,i,r){let n=function(t,e,i,r,n,s,a,o,l){let h=eQ(a),d=Math.sin(h),u=Math.cos(h),c=u*(o-t)*.5+d*(l-e)*.5,p=u*(l-e)*.5-d*(o-t)*.5,f=c*c/((i=Math.abs(i))*i)+p*p/((r=Math.abs(r))*r);f>1&&(i*=f=Math.sqrt(f),r*=f);let g=u/i,m=d/i,v=-d/r,b=u/r,y=g*o+m*l,x=v*o+b*l,_=g*t+m*e,w=v*t+b*e,A=1/((_-y)*(_-y)+(w-x)*(w-x))-.25;A<0&&(A=0);let S=Math.sqrt(A);s===n&&(S=-S);let E=.5*(y+_)-S*(w-x),T=.5*(x+w)+S*(_-y),C=Math.atan2(x-T,y-E),k=Math.atan2(w-T,_-E)-C;k<0&&1===s?k+=eJ.BZ:k>0&&0===s&&(k-=eJ.BZ);let M=Math.ceil(Math.abs(k/(eJ.ou+.001))),B=[];for(let t=0;t{let o=4*Math.tan(Math.abs(i-e)/4)/3,l=ie.arc(t[1]*n+i,t[2]*s+r,t[3]*(n+s)/2,t[4],t[5],t[6],a),(t,e,i,r,n,s,a)=>e.arcTo(t[1]*n+i,t[2]*s+r,t[3]*n+i,t[4]*s+r,t[5]*(n+s)/2,a),(t,e,i,r,n,s,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*s+r,t[3]*n+i,t[4]*s+r,t[5]*n+i,t[6]*s+r,a),(t,e,i,r)=>e.closePath(),(t,e,i,r,n,s)=>e.ellipse(t[1]*n+i,t[2]*s+r,t[3]*n,t[4]*s,t[5],t[6],t[7],t[8]),(t,e,i,r,n,s,a)=>e.lineTo(t[1]*n+i,t[2]*s+r,a),(t,e,i,r,n,s,a)=>e.moveTo(t[1]*n+i,t[2]*s+r,a),(t,e,i,r,n,s,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*s+r,t[3]*n+i,t[4]*s+r,a),(t,e,i,r,n,s,a)=>e.rect(t[1]*n+i,t[2]*s+r,t[3]*n,t[4]*s,a)];function iv(t,e,i=0,r=0,n=1,s=1,a){for(let o=0;ot+e.getLength(),0)),this.length}}class iM extends ik{bezierCurveTo(t,e,i,r,n,s,a,o){return super.bezierCurveTo(e,t,r,i,s,n,a,o)}lineTo(t,e,i,r){return super.lineTo(e,t,i,r)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function iB(t,e,i=1){let r=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===r&&((r=!r)?t.lineStart():t.lineEnd()),r&&t.point(e[i])}function iP(t,e,i){let r=null!=e?e:(0,eJ.Wn)(i[i.length-1].x-i[0].x)>(0,eJ.Wn)(i[i.length-1].y-i[0].y)?oN.ROW:oN.COLUMN;return"monotoneY"===t?new iM(t,r):new ik(t,r)}class iR{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function iO(t,e={}){let{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;let n=iP("linear",i,t);return function(t,e){iB(t,e,1)}(new iR(n,r),t),n}function iI(t,e,i,r,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,r,t.lastPoint1)}class iL{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&iI(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:iI(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function iD(t,e={}){let{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return iO(t,e);let n=iP("basis",i,t);return iB(new iL(n,r),t,2),n}function iN(t){return t<0?-1:1}function ij(t,e,i){let r=t._x1-t._x0,n=e-t._x1,s=(t._y1-t._y0)/(r||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(r<0&&-0)),o=(s*n+a*r)/(r+n);return((s<0?-1:1)+(a<0?-1:1))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function iF(t,e){let i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function iz(t,e,i,r,n){let s=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-s)/3;t.context.bezierCurveTo(s+h,a+h*e,o-h,l-h*i,o,l,r,t.lastPoint1)}class iH{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:iz(this,this._t0,iF(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN,i=t.x,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,r,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,r,t);break;case 1:this._point=2;break;case 2:this._point=3,iz(this,iF(this,e=ij(this,i,r)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2,t);break;default:iz(this,this._t0,e=ij(this,i,r),!1!==this._lastDefined1&&!1!==this._lastDefined2,t)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=r,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class iG extends iH{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function iU(t,e={}){let{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return iO(t,e);let n=iP("monotoneX",i,t);return iB(new iH(n,r),t,2),n}function iV(t,e={}){let{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return iO(t,e);let n=iP("monotoneY",i,t);return iB(new iG(n,r),t,2),n}class iW{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){let e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{let r=this._x*(1-this._t)+e*this._t;this.context.lineTo(r,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(r,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function iZ(t,e,i={}){let{direction:r,startPoint:n}=i;if(t.length<2-Number(!!n))return null;let s=new ik("step",null!=r?r:(0,eJ.Wn)(t[t.length-1].x-t[0].x)>(0,eJ.Wn)(t[t.length-1].y-t[0].y)?oN.ROW:oN.COLUMN);return function(t,e){iB(t,e,1)}(new iW(s,e,n),t),s}class i$ extends iR{lineEnd(){this.context.closePath()}}function iY(t,e={}){let{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;let n=iP("linear",i,t);return function(t,e){iB(t,e,1)}(new i$(n,r),t),n}function iX(t,e,i){switch(e){case"linear":default:return iO(t,i);case"basis":return iD(t,i);case"monotoneX":return iU(t,i);case"monotoneY":return iV(t,i);case"step":return iZ(t,.5,i);case"stepBefore":return iZ(t,0,i);case"stepAfter":return iZ(t,1,i);case"linearClosed":return iY(t,i)}}class iK extends ih{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new e6(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([ic.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([ic.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,r){return this.commandList.push([ic.Q,t,e,i,r]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,r),this}bezierCurveTo(t,e,i,r,n,s){return this.commandList.push([ic.C,t,e,i,r,n,s]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,r,n,s),this}arcTo(t,e,i,r,n){return this.commandList.push([ic.AT,t,e,i,r,n]),this._ctx&&this._ctx.arcTo(t,e,i,r,n),this}ellipse(t,e,i,r,n,s,a,o){return this.commandList.push([ic.E,t,e,i,r,n,s,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,r,n,s,a,o),this}rect(t,e,i,r){return this.commandList.push([ic.R,t,e,i,r]),this._ctx&&this._ctx.rect(t,e,i,r),this}arc(t,e,i,r,n,s){return this.commandList.push([ic.A,t,e,i,r,n,s]),this._ctx&&this._ctx.arc(t,e,i,r,n,s),this}closePath(){return this.commandList.push([ic.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){let t=[];t[ic.M]=t=>`M${t[1]} ${t[2]}`,t[ic.L]=t=>`L${t[1]} ${t[2]}`,t[ic.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[ic.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[ic.A]=t=>{let e=[];ig(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[ic.Z]=t=>"Z",this.toStringCbList=t}let t=this.toStringCbList,e="";return this.commandList.forEach(i=>{e+=t[i[0]](i)}),e}fromString(t,e,i,l,h){this.clear();let d=function(t){let e,i;if(!t)return[];let l=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===l)return[];let h=[];for(let t=0,d=l.length;to){let t;for(let i=1,r=e.length;i{this.transformCbList[n[0]](n,t,e,i,r)}),this._updateBounds()}moveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i,t[5]=t[5]*r+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i,t[5]=t[5]*(r+n)/2}ellipseTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r,t[4]=t[4]*n}rectTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r,t[4]=t[4]*n}arcTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*(r+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,r=1,n=1){let s,a,o,l,h,d=null,u=0,c=0,p=0,f=0;for(let g=0,m=t.length;gt.slice())}_updateBounds(){this.bounds.clear(),iv(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===oN.COLUMN){if(!this.curves.length)return 0;let t=this.curves[0],e=this.curves[this.curves.length-1];return(0,eJ.Wn)(t.p0.y-e.p1.y)}if(this.direction===oN.ROW){if(!this.curves.length)return 0;let t=this.curves[0],e=this.curves[this.curves.length-1];return(0,eJ.Wn)(t.p0.x-e.p1.x)}return this.curves.reduce((t,e)=>t+e.getLength(),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let r=0;r=t)break;i+=n}let r=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(r),angle:e.getAngleAt(r)}}}let iq=["l",0,0,0,0,0,0,0],iJ={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new e3},iQ={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},i0={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},i1=Object.assign({outerBorder:Object.assign(Object.assign({},i0),{distance:0}),innerBorder:Object.assign(Object.assign({},i0),{distance:0})},i0),i2={text:"",maxLineWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0},i5=Object.assign(Object.assign(Object.assign(Object.assign({opacity:1,background:null,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,blur:0,cursor:null,html:null,react:null},iQ),i1),{alignSelf:"auto"}),{pickStrokeBuffer:0}),i3={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},i4=Object.assign(Object.assign(Object.assign({strokeSeg:null,pickable:!0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden"},{_debug_bounds:!1}),i5),iJ),i6=Object.assign(Object.assign({},i4),{startAngle:0,endAngle:eJ.f7,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),i8=Object.assign(Object.assign(Object.assign({},i4),i3),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1}),i7=Object.assign(Object.assign({},i4),{radius:1,startAngle:0,endAngle:eJ.f7}),i9=Object.assign(Object.assign({},i4),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start"}),rt=Object.assign(Object.assign({},i4),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),re=Object.assign(Object.assign(Object.assign({},i4),i3),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1}),ri=Object.assign(Object.assign({},i4),{path:new iK,customPath:()=>{ek.Y.getInstance().warn("空函数")}}),rr=Object.assign(Object.assign({},i4),{points:[],cornerRadius:0,closePath:!0}),rn=Object.assign(Object.assign({},i4),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0}),rs=Object.assign(Object.assign({},i4),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0}),ra=Object.assign(Object.assign({},i4),{symbolType:"circle",size:10,keepDirIn3d:!0}),ro=Object.assign(Object.assign(Object.assign({},i4),i2),{strokeBoundsBuffer:0,keepDirIn3d:!0}),rl=Object.assign(Object.assign(Object.assign({},i4),i2),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},i4),{fill:!0,cornerRadius:0}),rd=Object.assign(Object.assign({},rh),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1}),ru=new class t{},rc={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},rp={fill:!0,stroke:!1};String.fromCharCode(160);let rf=/\w|\(|\)|-/,rg=/[.?!,;:/,。?!、;:]/,rm=/\S/;function rv(t,e,i,r,n){if(!e||e<=0)return 0;let s=ru.graphicUtil.textMeasure,a=r,o=t.slice(0,a),l=Math.floor(s.measureText(o,i).width),h=t.slice(0,a+1),d=Math.floor(s.measureText(h,i).width);for(;l>e||d<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(s.measureText(o,i).width),h=t.slice(0,a+1),d=Math.floor(s.measureText(h,i).width)}return n&&(a=rb(t,a)),a}function rb(t,e){let i=e;for(;rf.test(t[i-1])&&rf.test(t[i])||rg.test(t[i]);)if(--i<=0)return e;return i}function ry(t,e){let i=ru.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(r.width=Math.floor(i.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(i.width),r.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),r.ascent=Math.floor(i.actualBoundingBoxAscent),r.descent=r.height-r.ascent),r}let rx=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,{fontSize:e=ro.fontSize}){let i=0,r=0;for(let e=0;et.charCodeAt(e)?i++:r++;return{width:~~(.8*i*e+r*e),height:e}}measureTextPixelHeight(t,e){var i;if(!this.context)return null!==(i=e.fontSize)&&void 0!==i?i:i2.fontSize;this.context.setTextStyleWithoutAlignBaseline(e);let r=this.context.measureText(t);return Math.abs(r.actualBoundingBoxAscent-r.actualBoundingBoxDescent)}measureTextBoundHieght(t,e){var i;if(!this.context)return null!==(i=e.fontSize)&&void 0!==i?i:i2.fontSize;this.context.setTextStyleWithoutAlignBaseline(e);let r=this.context.measureText(t);return Math.abs(r.fontBoundingBoxAscent-r.fontBoundingBoxDescent)}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,r){if(0===t.length)return{verticalList:t,width:0};let{fontSize:n=12}=e;t.forEach(t=>{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)});let s=[],a=0,o=0;for(;o1){let n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(r&&n.str!==t[o].text){let i="",r=0;for(let e=0;ei)return{str:"",width:0};let s=this._clipText(t,e,i,0,t.length-1,"end",!1);if(r&&s.str!==t){let i=rb(t,s.str.length);i!==s.str.length&&(s.str=t.substring(0,i),s.width=this.measureTextWidth(s.str,e))}return s}_clipText(t,e,i,r,n,s,a){let o;if("start"===s)o=this._clipTextStart(t,e,i,r,n),a&&(o.result=a+o.str);else if("middle"===s){let r=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:r.width,result:r.left+a+r.right}}else o=this._clipTextEnd(t,e,i,r,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,r,n){let s;let a=Math.floor((r+n)/2),o=t.substring(0,a+1),l=this.measureTextWidth(o,e);if(l>i){if(o.length<=1)return{str:"",width:0};let n=t.substring(0,a);return(s=this.measureTextWidth(n,e))<=i?{str:n,width:s}:this._clipTextEnd(t,e,i,r,a)}if(l=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};let r=t.substring(0,a+2);return(s=this.measureTextWidth(r,e))>=i?{str:o,width:l}:this._clipTextEnd(t,e,i,a,n)}return{str:o,width:l}}_clipTextStart(t,e,i,r,n){let s;let a=Math.ceil((r+n)/2),o=t.substring(a-1,t.length-1),l=this.measureTextWidth(o,e);if(l>i){if(o.length<=1)return{str:"",width:0};let r=t.substring(a,t.length-1);return(s=this.measureTextWidth(r,e))<=i?{str:r,width:s}:this._clipTextStart(t,e,i,a,t.length-1)}if(l=i?{str:o,width:l}:this._clipTextStart(t,e,i,r,a)}return{str:o,width:l}}_clipTextMiddle(t,e,i,r,n,s,a,o){let l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:r,right:n,width:s+a};let d=t.substring(t.length-o,t.length),u=this.measureTextWidth(d,e);return h+u>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,d,h,u,o+1)}clipTextWithSuffixVertical(t,e,i,r,n,s){let a;if(""===r)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};let o=this.clipTextVertical(t,e,i,n);if(o.verticalList.length===t.length&&o.verticalList[o.verticalList.length-1].width===t[t.length-1].width)return o;let l=this.measureTextWidth(r,e);if(l>i)return o;if(i-=l,"start"===s){let s=this.revertVerticalList(t);a=this.clipTextVertical(s,e,i,n);let o=this.revertVerticalList(a.verticalList);o.unshift({text:r,direction:1,width:l}),a.verticalList=o}else if("middle"===s){let s=this.clipTextVertical(t,e,i/2,n),o=this.revertVerticalList(t),h=this.clipTextVertical(o,e,i/2,n);s.verticalList.push({text:r,direction:1,width:l}),this.revertVerticalList(h.verticalList).forEach(t=>s.verticalList.push(t)),a={verticalList:s.verticalList,width:s.width+h.width}}else(a=this.clipTextVertical(t,e,i,n)).verticalList.push({text:r,direction:1,width:l});return a.width+=l,a}revertVerticalList(t){return t.reverse().map(t=>{let e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})})}clipTextWithSuffix(t,e,i,r,n,s){if(""===r)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};let a=this.measureTextWidth(t,e);if(a<=i)return{str:t,width:a};let o=this.measureTextWidth(r,e);if(o>i)return{str:"",width:0};i-=o;let l=this._clipText(t,e,i,0,t.length-1,s,r);if(n&&l.str!==t){let i=rb(t,l.str.length);i!==l.str.length&&(l.str=t.substring(0,i),l.width=this.measureTextWidth(l.str,e))}return l.str=l.result,l.width+=o,l}};rx=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],rx);let r_=Symbol.for("TextMeasureContribution"),rw=class extends rx{};rw=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],rw);var rA=i("373390"),rS=i("203459");class rE{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),ey(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=ey(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if((0,eC.Z)(this._canvas)&&(ey(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),(0,eC.Z)(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&ey(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),(0,eC.Z)(this._context)&&ey(this._canvas)){let t=this._canvas.getContext("2d");ey(t)&&(t.save(),t.font=(0,rS.U)(this.textSpec),this._contextSaved=!0,this._context=t)}return!(0,eC.Z)(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;let{defaultFontParams:r={}}=this._option,{fontStyle:n=r.fontStyle,fontVariant:s=r.fontVariant,fontWeight:a=null!==(t=r.fontWeight)&&void 0!==t?t:"normal",fontSize:o=null!==(e=r.fontSize)&&void 0!==e?e:12,fontFamily:l=null!==(i=r.fontFamily)&&void 0!==i?i:"sans-serif",align:h,textAlign:d=null!=h?h:"center",baseline:u,textBaseline:c=null!=u?u:"middle",ellipsis:p,limit:f}=this._userSpec,{lineHeight:g=o}=this._userSpec;return(0,eT.Z)(g)&&"%"===g[g.length-1]&&(g=o*(Number.parseFloat(g.substring(0,g.length-1))/100)),{fontStyle:n,fontVariant:s,fontFamily:l,fontSize:o,fontWeight:a,textAlign:d,textBaseline:c,ellipsis:p,limit:f,lineHeight:g}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){let e;if((0,eC.Z)(t))return{width:0,height:0};if((0,eC.Z)(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);let{fontFamily:i,fontSize:r,fontWeight:n,textAlign:s,textBaseline:a,ellipsis:o,limit:l,lineHeight:h}=this.textSpec;try{let d=this._option.getTextBounds({text:t,fontFamily:i,fontSize:r,fontWeight:n,textAlign:s,textBaseline:a,ellipsis:!!o,maxLineWidth:l||1/0,lineHeight:h});e={width:d.width(),height:d.height()}}catch(i){this._notSupportVRender=!0,e=this.measureWithNaiveCanvas(t)}return e}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);let e=this._context.measureText(t),{fontSize:i,lineHeight:r}=this.textSpec;return{width:e.width,height:null!=r?r:i}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){let e={width:0,height:0};for(let i=0;it.toString());return 0===s.length?n:1===s.length?e(s[0]):{width:s.reduce((t,i)=>Math.max(t,e(i).width),0),height:s.length*((null!=r?r:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if((0,eC.Z)(this._numberCharSize)){let t=this._standardMethod(rE.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/rE.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return(0,eC.Z)(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(rE.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if((0,eC.Z)(this._letterCharSize)){let t=this._standardMethod(rE.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/rE.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return ey(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){ey(this._canvas)&&(this._canvas=null),ey(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}rE.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",rE.NUMBERS_CHAR_SET="0123456789",rE.FULL_SIZE_CHAR="字";let rT={Singleton:"Singleton",Transient:"Transient"},rC={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid"};class rk{constructor(t,e){this.id=eM.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=rC.Invalid,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){let t=new rk(this.serviceIdentifier,this.scope);return t.activated=t.scope===rT.Singleton&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class rM{getConstructorMetadata(t){return{compilerGeneratedMetadata:eD.getMetadata(eL,t),userGeneratedMetadata:eD.getMetadata(eI,t)||{}}}getPropertiesMetadata(t){throw Error("暂未实现")}}let rB=(d=eP,t=>{let e=e=>{if(null==e)return!1;if(e.key===d&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;let i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t))}}let rO=new class t{constructor(t){let e=t||{};e.defaultScope=e.defaultScope||rT.Transient,this.options=e,this.id=eM.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new rM}load(t){let e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){let e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){let e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){let r=this._getNotAllArgs(t,!1,e,i);return this._get(r)}getNamed(t,e){return this.getTagged(t,eP,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){let e=new rk(t,this.options.defaultScope),i=this._bindingDictionary.get(t)||[];return i.push(e),this._bindingDictionary.set(t,i),new rR(e)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){let t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{let r=this.bind(i);return t(r,e),r},i=()=>t=>this.unbind(t),r=()=>t=>this.isBound(t),n=e=>i=>{let r=this.rebind(i);return t(r,e),r};return t=>({bindFunction:e(t),isboundFunction:r(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,r){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:r}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){let e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter(e=>e.constraint(t)).forEach(t=>{e.push(this._resolveFromBinding(t))}),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){let e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),r=Object.keys(i),n=[];for(let t=0;t{r[t.key]=t.value});let s={inject:r[eR],multiInject:r[eO]},a=s.inject||s.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter(t=>t.constraint(o))};n.push(l)}return n}_resolveFromBinding(t){let e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case rC.ConstantValue:case rC.Function:e=t.cache;break;case rC.Instance:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;let i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map(t=>t.bindings.length>1?t.bindings.map(t=>this._resolveFromBinding(t)):this._resolveFromBinding(t.bindings[0]))}_saveToScope(t,e){t.scope===rT.Singleton&&(t.cache=e,t.activated=!0)}},rI=Symbol.for("CanvasFactory"),rL=Symbol.for("Context2dFactory");function rD(t){return rO.getNamed(rI,ru.global.env)(t)}let rN=new class t{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){let e=rD(Object.assign({nativeCanvas:ru.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}let e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){let e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=rD(Object.assign({nativeCanvas:ru.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}let e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}},rj=Symbol.for("VWindow"),rF=Symbol.for("WindowHandlerContribution"),rz=class{get width(){if(this._handler){let t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){let t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new e$(["x","y","width","height"])},this.active=()=>{let t=this.global;t.env&&!this.actived&&(rO.getNamed(rF,t.env).configure(this,t),this.actived=!0)},this._uid=eM.GenAutoIncrementId(),this.global=ru.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);let r=this._handler.getWH();this._width=r.width,this._height=r.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,r,n,s){this._handler.setViewBoxTransform(t,e,i,r,n,s)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){let i=this._handler.getViewBox(),r={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},r),r.x-=i.x1,r.y-=i.y1,r}hasSubView(){let t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};rz=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],rz);var rH=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},rG=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rU=function(t,e){return function(i,r){e(i,r,t)}};let rV=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=ru.global,this.global.hooks.onSetEnv.tap("graphic-util",(t,e,i)=>{this.configured=!1,this.configure(i,e)})}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach(t=>{t.configure(this,e)}),this.configured=!0)}tryInitCanvas(){if(!this._canvas){let t=rN.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,i="native"){var r;this.configure(this.global,this.global.env);let n=this.global.measureTextMethod;this.global.measureTextMethod=i;let s={width:this._textMeasure.measureTextWidth(t,e),height:null!==(r=e.fontSize)&&void 0!==r?r:i2.fontSize};return this.global.measureTextMethod=n,s}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new rE(Object.assign({defaultFontParams:{fontFamily:i2.fontFamily,fontSize:i2.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+rE.ALPHABET_CHAR_SET+rE.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;let r=rO.get(rj),n=t.AABBBounds,s=n.width(),a=n.height(),o=-n.x1,l=-n.y1;r.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:s,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});let h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;let d=r.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}};rV=rH([eN(),rU(0,eH(eU)),rU(0,eG(r_)),rG("design:paramtypes",[Object])],rV),(oE=oz||(oz={}))[oE.transform=0]="transform",oE[oE.matrix=1]="matrix";let rW=new e3,rZ=class{constructor(){this.matrix=new e3}init(t){return this.mode=oz.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=oz.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){let r=this.outSourceMatrix;if(rW.setValue(r.a,r.b,r.c,r.d,r.e,r.f),this.outTargetMatrix.reset(),i){let{x:r,y:n}=i;this.outTargetMatrix.translate(r,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-r,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(rW.a,rW.b,rW.c,rW.d,rW.e,rW.f),this}rotateMatrix(t,e){let i=this.outSourceMatrix;if(rW.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){let{x:i,y:r}=e;this.outTargetMatrix.translate(i,r),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-r)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(rW.a,rW.b,rW.c,rW.d,rW.e,rW.f),this}scale(t,e,i){return this.mode===oz.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===oz.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){let i=this.outSourceMatrix;return rW.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(rW.a,rW.b,rW.c,rW.d,rW.e,rW.f),this}translate(t,e){return this.mode===oz.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===oz.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};rZ=rH([eN(),rG("design:paramtypes",[])],rZ);let r$={arc:i6,area:i8,circle:i7,line:re,path:ri,symbol:ra,text:ro,rect:rn,rect3d:rs,polygon:rr,richtext:rl,richtextIcon:rd,image:rh,group:i9,glyph:rt},rY=Object.keys(r$);function rX(t,e){Object.keys(e).forEach(i=>{t[i]=e[i]})}let rK={arc:Object.assign({},r$.arc),area:Object.assign({},r$.area),circle:Object.assign({},r$.circle),line:Object.assign({},r$.line),path:Object.assign({},r$.path),symbol:Object.assign({},r$.symbol),text:Object.assign({},r$.text),rect:Object.assign({},r$.rect),rect3d:Object.assign({},r$.rect3d),polygon:Object.assign({},r$.polygon),richtext:Object.assign({},r$.richtext),richtextIcon:Object.assign({},r$.richtextIcon),image:Object.assign({},r$.image),group:Object.assign({},r$.group),glyph:Object.assign({},r$.glyph)};class rq{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},rY.forEach(t=>{this._defaultTheme[t]=Object.create(rK[t])}),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t||!this.dirty)return this.combinedTheme;let e={},i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){let r=this.getParentWithTheme(t);if(r){let t=r.theme;(t.dirty||i)&&t.applyTheme(r,e,!0)}this.userTheme?this.doCombine(r&&r.theme.combinedTheme):(r?this.combinedTheme=r.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ek.Y.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){let e=this.userTheme,i=this.combinedTheme;rY.forEach(r=>{let n=Object.create(rK[r]);t&&t[r]&&rX(n,t[r]),i[r]&&rX(n,i[r]),e[r]&&rX(n,e[r]),this.combinedTheme[r]=n}),e.common&&rY.forEach(t=>{rX(this.combinedTheme[t],e.common)}),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach(e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])}):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren(t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))})}}let rJ=new rq;function rQ(t,e){return t.glyphHost?rQ(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):rJ.getTheme()}return null}(t)||t.attachedThemeGraphic&&rQ(t.attachedThemeGraphic)||rJ.getTheme()}let r0=Object.prototype.hasOwnProperty;var r1=(t,e)=>null!=t&&r0.call(t,e),r2=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),r5=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t),r3=i("876058"),r4=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||(0,r3.Z)(t,"Boolean"),r6=t=>"function"==typeof t;class r8 extends ec(){get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=eM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){var i,r,n,s;return i=this,r=void 0,n=void 0,s=function*(){if(e){let e=this._lastChild,i=0;for(;e;){let r=t(e,i++);if(r.then&&(r=yield r),r)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let r=t(e,i++);if(r.then&&(r=yield r),r)return;e=e._next}}},new(n||(n=Promise))(function(t,e){function a(t){try{l(s.next(t))}catch(t){e(t)}}function o(t){try{l(s.throw(t))}catch(t){e(t)}}function l(e){var i;e.done?t(e.value):((i=e.value)instanceof n?i:new n(function(t){t(i)})).then(a,o)}l((s=s.apply(i,r||[])).next())})}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ek.Y.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){let i;if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){let i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}this._nodeList[e]=t;for(let t=e-1;t>=0&&!(i=this._nodeList[t]);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;let r=this.insertInto(t,0);return this._ignoreWarn=!1,r}removeChild(t){if(!this._idMap||!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){let e=this._nodeList.findIndex(e=>e===t);e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;let e=this._firstChild;for(;e;){let t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren((e,r)=>!(e===this||!t(e,r))&&(i=e,!0)),e&&this.forEachChildren(e=>{if(e.isContainer){let r=e.find(t,!0);if(r)return i=r,!0}return!1}),i}findAll(t,e=!1){let i=[];return this.forEachChildren((e,r)=>{e!==this&&t(e,r)&&i.push(e)}),e&&this.forEachChildren(e=>{if(e.isContainer){let r=e.findAll(t,!0);r.length&&(i=i.concat(r))}}),i}getElementById(t){return this.find(e=>e.id===t,!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll(e=>e.name===t,!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll(e=>e.type===t,!0)}getChildByName(t,e=!1){return this.find(e=>e.name===t,e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1&&(t=1),function(e){return 0===t?e:t<0?e*(-(e*t)+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(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}static bounceIn(t){return 1-nt.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*nt.bounceIn(2*t):.5*nt.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;let r=e/eJ.f7*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*eJ.f7/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;let r=e/eJ.f7*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-r)*eJ.f7/e)+1}}static getElasticInOut(t,e){return function(i){let r=e/eJ.f7*Math.asin(1/t);return(i*=2)<1?-(t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*eJ.f7/e)*.5):t*Math.pow(2,-10*(i-=1))*Math.sin((i-r)*eJ.f7/e)*.5+1}}}nt.quadIn=nt.getPowIn(2),nt.quadOut=nt.getPowOut(2),nt.quadInOut=nt.getPowInOut(2),nt.cubicIn=nt.getPowIn(3),nt.cubicOut=nt.getPowOut(3),nt.cubicInOut=nt.getPowInOut(3),nt.quartIn=nt.getPowIn(4),nt.quartOut=nt.getPowOut(4),nt.quartInOut=nt.getPowInOut(4),nt.quintIn=nt.getPowIn(5),nt.quintOut=nt.getPowOut(5),nt.quintInOut=nt.getPowInOut(5),nt.backIn=nt.getBackIn(1.7),nt.backOut=nt.getBackOut(1.7),nt.backInOut=nt.getBackInOut(1.7),nt.elasticIn=nt.getElasticIn(1,.3),nt.elasticOut=nt.getElasticOut(1,.3),nt.elasticInOut=nt.getElasticInOut(1,.3*1.5);class ne{constructor(){this.id=eM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===oI.END?this.removeAnimate(e):e.status===oI.RUNNING||e.status===oI.INITIAL?(this.animateCount++,e.advance(t)):e.status===oI.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t,e=!0){t._onRemove&&t._onRemove.forEach(t=>t()),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}let ni=new ne;class nr{constructor(t,e,i,r,n){this.from=t,this.to=e,this.duration=i,this.easing=r,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;let e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();let t=this.step.getLastProps();Object.keys(t).forEach(e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])})}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class nn extends nr{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class ns{constructor(t=eM.GenAutoIncrementId(),e=ni){this.id=t,this.timeline=e,this.status=oI.INITIAL,this.tailAnimate=new na(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce((t,e)=>t+e.totalDuration,0)}after(t){let e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-Infinity;return t.forEach(t=>{e=(0,eJ.Fp)(t.getDuration(),e)}),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){ns.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){let t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t,e=ns.mode){t&&e&oL.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:oO.ANIMATE_PLAY})}runCb(t){let e=new nn(()=>{t(this,e.step.prev)});return this.tailAnimate.play(e),this}customInterpolate(t,e,i,r,n,s){let a=ns.interpolateMap.get(t)||ns.interpolateMap.get("");return!!a&&a(t,e,i,r,n,s)}pause(){this.status===oI.RUNNING&&(this.status=oI.PAUSED)}resume(){this.status===oI.PAUSED&&(this.status=oI.RUNNING)}to(t,e,i,r){if(this.tailAnimate.to(t,e,i,r),this.target){let t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,r){if(this.tailAnimate.from(t,e,i,r),this.target){let t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){let t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){let t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){let t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){let t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){let t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){let t=new na(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach(t=>this.preventAttr(t))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach(e=>{e.bind(t)}),this}advance(t){if(this._duringTimet())),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===oI.RUNNING&&(this.status=oI.END,this._onEnd&&this._onEnd.forEach(t=>t()))}setPosition(t){let e,i=0,r=this.rawPosition,n=this.subAnimates.reduce((t,e)=>t+e.totalDuration,0);t<0&&(t=0);let s=t>=n;if(s&&(t=n),t===r)return s;for(let r=0;r=t);r++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),s}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=oI.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}ns.mode=oL.NORMAL,ns.interpolateMap=new Map;class na{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new no(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);let i=t.easing,r="string"==typeof i?nt[i]:i,n=this._addStep(e,null,r);return n.type=oD.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,r){(null==e||e<0)&&(e=0);let n="string"==typeof i?nt[i]:i,s=this._addStep(e,null,n);return s.type=oD.to,this._appendProps(t,s,!!r&&r.tempProps),s.propKeys||(s.propKeys=Object.keys(s.props)),r&&r.noPreventAttrs||this.target.animates.forEach(t=>{t.id!==this.animate.id&&t.preventAttrs(s.propKeys)}),this}from(t,e,i,r){this.to(t,0,i,r);let n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach(t=>{n[t]=this.getLastPropByName(t,this.stepTail)}),this.to(n,e,i,r),this.stepTail.type=oD.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){let e=this._addStep(+t,null);e.type=oD.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){let r=new no(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(r),this.stepTail=r,r}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let r=e.prev,n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach(t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))});r.prev;)r.props&&(r.propKeys||(r.propKeys=Object.keys(r.props)),r.propKeys.forEach(t=>{void 0===n[t]&&(n[t]=r.props[t])})),e.propKeys=Object.keys(e.props),r=r.prev;let s=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach(t=>{if(void 0===s[t]){let e=this.animate.getStartProps();s[t]=e[t]=this.target.getComputedAttribute(t)}}),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;let i=this.duration,r=this.loop,n=this.rawPosition,s,a,o=!1,l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=r*i+i)&&(t=(a=i)*(s=r)+i),t===n)return o;let h=!this.reversed!=!(this.bounce&&s%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next,r=this.position,n=this.duration;if(this.target&&i){let s=i.next;for(;s&&s.position<=r;)s=(i=s).next;let a=t?0===n?1:r/n:(r-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach(t=>t(i,a))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e){if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){let e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return ek.Y.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class no{constructor(t,e,i,r){this.duration=e,this.position=t,this.props=i,this.easing=r}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}let nl={duration:200,easing:"cubicOut"},nh={duration:1e3,easing:"quadInOut"};var nd=function(t,e,i){return ti?i:t};function nu(t,e,i){e/=100;let r=(1-Math.abs(2*(i/=100)-1))*e,n=r*(1-Math.abs(t/60%2-1)),s=i-r/2,a=0,o=0,l=0;return 0<=t&&t<60?(a=r,o=n,l=0):60<=t&&t<120?(a=n,o=r,l=0):120<=t&&t<180?(a=0,o=r,l=n):180<=t&&t<240?(a=0,o=n,l=r):240<=t&&t<300?(a=n,o=0,l=r):300<=t&&t<360&&(a=r,o=0,l=n),{r:a=Math.round(255*(a+s)),g:o=Math.round(255*(o+s)),b:l=Math.round(255*(l+s))}}function nc(t,e,i){t/=255,e/=255;let r=Math.min(t,e,i/=255),n=Math.max(t,e,i),s=n-r,a=0,o=0,l=0;return(a=Math.round(60*(a=0===s?0:n===t?(e-i)/s%6:n===e?(i-t)/s+2:(t-e)/s+4)))<0&&(a+=360),l=(n+r)/2,o=+(100*(o=0===s?0:s/(1-Math.abs(2*l-1)))).toFixed(1),{h:a,s:o,l:l=+(100*l).toFixed(1)}}let np=/^#([0-9a-f]{3,8})$/,nf={transparent:0xffffff00},ng={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function nm(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function nv(t){return(0,ib.Z)(t)?new nw(t>>16,t>>8&255,255&t,1):(0,ev.Z)(t)?new nw(t[0],t[1],t[2]):new nw(255,255,255)}function nb(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ny(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let nx=(t,e)=>{let i=np.exec(t);if(e||i){let t=parseInt(i[1],16),e=i[1].length;return 3===e?new nw((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?nv(t):8===e?new nw(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class n_{static Brighter(t,e=1){return 1===e?t:new n_(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new n_(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){let i=t instanceof n_?t:new n_(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(ey(nf[t])){var e;return e=nf[t],(0,ib.Z)(e)?new nw(e>>>24,e>>>16&255,e>>>8&255,255&e):(0,ev.Z)(e)?new nw(e[0],e[1],e[2],e[3]):new nw(255,255,255,1)}if(ey(ng[t]))return nv(ng[t]);let i=`${t}`.trim().toLowerCase(),r=nx(i);if(void 0!==r)return r;if(/^(rgb|RGB|rgba|RGBA)/.test(i)){let t=i.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new nw(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(i)){let t=i.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),e=nu(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new nw(e.r,e.g,e.b,parseFloat(t[3]))}}constructor(t){let e=n_.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new nw(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){let{r:e,g:i,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t))),this}add(t){let{r:e,g:i,b:r}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,r+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){let{r:e,g:i,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){let r=this.color.opacity,n=nc(this.color.r,this.color.g,this.color.b),s=nu((0,eC.Z)(t)?n.h:nd(t,0,360),(0,eC.Z)(e)?n.s:e>=0&&e<=1?100*e:e,(0,eC.Z)(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new nw(s.r,s.g,s.b,r),this}setRGB(t,e,i){return(0,eC.Z)(t)||(this.color.r=t),(0,eC.Z)(e)||(this.color.g=e),(0,eC.Z)(i)||(this.color.b=i),this}setHex(t){let e=nx(`${t}`.trim().toLowerCase(),!0);return null!=e?e:this}setColorName(t){let e=ng[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new n_(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){let i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=nb(t.color.r),this.color.g=nb(t.color.g),this.color.b=nb(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ny(t.color.r),this.color.g=ny(t.color.g),this.color.b=ny(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class nw{constructor(t,e,i,r){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),ey(r)?this.opacity=isNaN(+r)?1:Math.max(0,Math.min(1,+r)):this.opacity=1}formatHex(){return`#${nm(this.r)+nm(this.g)+nm(this.b)+(1===this.opacity?"":nm(255*this.opacity))}`}formatRgb(){let t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){let t=this.opacity,{h:e,s:i,l:r}=nc(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${r}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}(oT=oH||(oH={}))[oT.Color255=0]="Color255",oT[oT.Color1=1]="Color1";class nA{static Get(t,e=oH.Color1,i=[0,0,0,1]){if(e===oH.Color1){let e=nA.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;let r=n_.parseColorString(t);if(r){let e=[r.r/255,r.g/255,r.b/255,r.opacity];nA.store1[t]=e,nA.store255[t]=[r.r,r.g,r.b,r.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}let r=nA.store255[t];if(r)return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i;let n=n_.parseColorString(t);return n&&(nA.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],nA.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===oH.Color1)!nA.store1[t]&&(nA.store1[t]=i,nA.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]);else{if(nA.store255[t])return;nA.store255[t]=i,nA.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function nS(t,e=!1){return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function nE(t,e,i,r,n){if(!t||!e)return t&&nS(t)||e&&nS(e)||!1;let s,a,o=!1,l=!1;if(Array.isArray(t)?s=t:"string"==typeof t?s=nA.Get(t,oH.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=nA.Get(e,oH.Color255):l=!0,o!==l){let s=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},s),{stops:s.stops.map(t=>Object.assign(Object.assign({},t),{color:nS(a)}))});return o?nE(s,l,i,r,n):nE(l,s,i,r,n)}if(o){if(t.gradient===e.gradient){let r=t.stops,n=e.stops;if(r.length!==n.length)return!1;if("linear"===t.gradient)return function(t,e,i){let r=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:Array(r.length).fill(0).map((t,e)=>({color:nk(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i}))}}(t,e,i);if("radial"===t.gradient)return function(t,e,i){let r=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:Array(r.length).fill(0).map((t,e)=>({color:nk(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i}))}}(t,e,i);if("conical"===t.gradient)return function(t,e,i){let r=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:Array(r.length).fill(0).map((t,e)=>({color:nk(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i}))}}(t,e,i)}return!1}return n&&n(s,a),nS(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(s,a,i),r)}nA.store255={},nA.store1={};let nT=[0,0,0,0],nC=[0,0,0,0];function nk(t,e,i){return nA.Get(t,oH.Color255,nT),nA.Get(e,oH.Color255,nC),`rgba(${Math.round(nT[0]+(nC[0]-nT[0])*i)},${Math.round(nT[1]+(nC[1]-nT[1])*i)},${Math.round(nT[2]+(nC[2]-nT[2])*i)},${nT[3]+(nC[3]-nT[3])*i})`}class nM{static GetImage(t,e){var i;let r=nM.cache.get(t);r?"fail"===r.loadState?ru.global.getRequestAnimationFrame()(()=>{e.imageLoadFail(t)}):"init"===r.loadState||"loading"===r.loadState?null===(i=r.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,r.data):nM.loadImage(t,e)}static GetSvg(t,e){var i;let r=nM.cache.get(t);r?"fail"===r.loadState?ru.global.getRequestAnimationFrame()(()=>{e.imageLoadFail(t)}):"init"===r.loadState||"loading"===r.loadState?null===(i=r.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,r.data):(r={type:"image",loadState:"init"},nM.cache.set(t,r),r.dataPromise=ru.global.loadSvg(t),r.dataPromise?(r.waitingMark=[e],r.dataPromise.then(e=>{var i;r.loadState=(null==e?void 0:e.data)?"success":"fail",r.data=null==e?void 0:e.data,null===(i=r.waitingMark)||void 0===i||i.map((i,n)=>{(null==e?void 0:e.data)?(r.loadState="success",r.data=e.data,i.imageLoadSuccess(t,e.data)):(r.loadState="fail",i.imageLoadFail(t))})})):(r.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=nM.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then(t=>t.data):Promise.resolve(i.data):(i={type:e,loadState:"init"},nM.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=ru.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=ru.global.loadBlob(t):"json"===e&&(i.dataPromise=ru.global.loadJson(t)),i.dataPromise.then(t=>t.data))}static loading(){setTimeout(()=>{if(!nM.isLoading&&nM.toLoadAueue.length){nM.isLoading=!0;let t=nM.toLoadAueue.splice(0,10),e=[];t.forEach(t=>{let{url:i,marks:r}=t,n={type:"image",loadState:"init"};if(nM.cache.set(i,n),n.dataPromise=ru.global.loadImage(i),n.dataPromise){n.waitingMark=r;let t=n.dataPromise.then(t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map((e,r)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})});e.push(t)}else n.loadState="fail",r.forEach(t=>t.imageLoadFail(i))}),Promise.all(e).then(()=>{nM.isLoading=!1,nM.loading()}).catch(t=>{console.error(t),nM.isLoading=!1,nM.loading()})}},0)}static loadImage(t,e){let i=nB(t,nM.toLoadAueue);if(-1!==i)return nM.toLoadAueue[i].marks.push(e),void nM.loading();nM.toLoadAueue.push({url:t,marks:[e]}),nM.loading()}static improveImageLoading(t){let e=nB(t,nM.toLoadAueue);if(-1!==e){let t=nM.toLoadAueue.splice(e,1);nM.toLoadAueue.unshift(t[0])}}}function nB(t,e){for(let i=0;i{this.animates.delete(e.id)}),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(ru.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!(0,eC.Z)(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,r){var n,s,a,o;if(i){let i;let l=Object.keys(t),h=this.getNoWorkAnimateAttr(),d={};r?l.forEach(e=>{h[e]?(i||(i={}),i[e]=t[e]):d[e]=void 0===t[e]?this.getDefaultAttribute(e):t[e]}):l.forEach(e=>{h[e]?(i||(i={}),i[e]=t[e]):d[e]=t[e]});let u=this.animate();u.stateNames=e,u.to(d,null!==(s=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==s?s:nl.duration,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:nl.easing),i&&this.setAttributes(i,!1,{type:oO.STATE})}else this.setAttributes(t,!1,{type:oO.STATE})}updateNormalAttrs(t){let e={};this.normalAttrs?(Object.keys(t).forEach(t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)}),Object.keys(this.normalAttrs).forEach(e=>{t[e]=this.normalAttrs[e]})):Object.keys(t).forEach(t=>{e[t]=this.getNormalAttribute(t)}),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach(i=>{if(i.stateNames){let r=i.getEndProps();r1(r,t)&&(e=r[t])}}),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){let i=this.currentStates.filter(e=>e!==t);this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){let i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var r;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;let n=e&&(null===(r=this.currentStates)||void 0===r?void 0:r.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if(!((null===(i=this.currentStates)||void 0===i?void 0:i.length)!==t.length||t.some((t,e)=>this.currentStates[e]!==t)))return;let r={};t.forEach(e=>{var i;let n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(r,n)}),this.updateNormalAttrs(r),this.currentStates=t,this.applyStateAttrs(r,t,e)}addUpdateBoundTag(){this._updateTag|=oP.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=oP.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=oP.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&oP.UPDATE_SHAPE_AND_BOUNDS)===oP.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=oP.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=oP.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=oP.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=oP.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=oP.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=oP.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=oP.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&oP.UPDATE_LAYOUT)}getAnchor(t,e){let i=[0,0],r=()=>{if(e.b)return e.b;let{scaleX:t,scaleY:i,angle:r}=this.attribute;return nR.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(nR),this.setAttributes({scaleX:t,scaleY:i,angle:r}),e.b};if("string"==typeof t[0]){let e=parseFloat(t[0])/100,n=r();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){let e=parseFloat(t[1])/100,n=r();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){let{x:t=iJ.x,y:e=iJ.y,scaleX:i=iJ.scaleX,scaleY:r=iJ.scaleY,angle:n=iJ.angle,scaleCenter:s,anchor:a,postMatrix:o}=this.attribute,l=[0,0],h={};if(a&&(l=this.getAnchor(a,h)),s&&(1!==i||1!==r)){let a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(s,h),ru.transformUtil.fromMatrix(a,a).scale(i,r,{x:l[0],y:l[1]})}else!function(t,e,i,r,n,s,a,o){let l,h;let d=e.a,u=e.b,c=e.c,p=e.d,f=e.e,g=e.f,m=(0,eJ.mC)(a),v=(0,eJ.O$)(a);o?(l=o[0],h=o[1]):(l=i,h=r);let b=l-i,y=h-r,x=d*m+c*v,_=u*m+p*v,w=c*m-d*v,A=p*m-u*v;t.a=n*x,t.b=n*_,t.c=s*w,t.d=s*A,t.e=f+d*l+c*h-x*b-w*y,t.f=g+u*l+p*h-_*b-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,r,n,a&&l);let d=this.getOffsetXY(iJ);if(this._transMatrix.e+=d.x,this._transMatrix.f+=d.y,o){let t=nP.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);let{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){let e=t.getTimeline();this.animates.forEach(t=>{t.setTimeline(e)})}this._onSetStage&&this._onSetStage(this,t,e),ru.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:oO.ANIMATE_END})}onStep(t,e,i,r,n){let s={};if(i.customAnimate)i.customAnimate.update(n,r,s);else{let a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,s,i,r,n,a,void 0,o,l)}this.setAttributes(s,!1,{type:oO.ANIMATE_UPDATE,animationState:{ratio:r,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,r,n,s,a,o,l,h){h||(h=Object.keys(a),r.propKeys=h),s?r.propKeys.forEach(t=>{e.validAttr(t)&&(i[t]=a[t])}):h.forEach(s=>{var h;let d;if(!e.validAttr(s))return;let u=a[s],c=null!==(h=o&&o[s])&&void 0!==h?h:t.getLastPropByName(s,r);if(null==u||null==c)return void(i[s]=u);(d=e.interpolateFunc&&e.interpolateFunc(s,n,c,u,i))||(d=e.customInterpolate(s,n,c,u,this,i))||this.defaultInterpolate(u,c,s,i,l,n)||this._interpolate(s,n,c,u,i)}),r.parsedProps=l}defaultInterpolate(t,e,i,r,n,s){if(Number.isFinite(t))return r[i]=e+(t-e)*s,!0;if("fill"===i){n||(n={});let a=n.fillColorArray,o=nE(e,null!=a?a:t,s,!1,(t,e)=>{n.fillColorArray=e});return o&&(r[i]=o),!0}if("stroke"===i){n||(n={});let a=n.strokeColorArray,o=nE(e,null!=a?a:t,s,!1,(t,e)=>{n.strokeColorArray=e});return o&&(r[i]=o),!0}if("shadowColor"===i){n||(n={});let a=n.shadowColorArray,o=nE(e,null!=a?a:t,s,!0,(t,e)=>{n.shadowColorArray=e});return o&&(r[i]=o),!0}return!1}_interpolate(t,e,i,r,n){}getDefaultAttribute(t){return rQ(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:ru.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map(t=>t.toJson())}}createPathProxy(t){return(0,eT.Z)(t,!0)?this.pathProxy=(new iK).fromString(t):this.pathProxy=new iK,this.pathProxy}loadImage(t,e=!1){if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;this.resources||(this.resources=new Map);let i={data:"init",state:null};this.resources.set(t,i),"string"==typeof t?(i.state="loading",t.startsWith("{t.stop()})}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren(e=>{e.stopAnimates(t)})}release(){this.releaseStatus="released",ru.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,r;if(this._events&&t in this._events){let n=new r9(t,e);n.bubbles=!1,n.manager=null===(r=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===r?void 0:r.manager,this.dispatchEvent(n)}}}nF.mixin({pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof r7))throw Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new r9(t,e))}}),(oC=oG||(oG={}))[oC.Top=1]="Top",oC[oC.Right=2]="Right",oC[oC.Bottom=4]="Bottom",oC[oC.Left=8]="Left",oC[oC.ALL=15]="ALL";let nz=[!1,!1,!1,!1],nH=t=>{var e;let i=!0;if(r4(t,!0)){for(let r=0;r<4;r++)nz[r]=t,i&&(i=!(null!==(e=nz[r])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)nz[e]=!!t[e],i&&(i=!!nz[e]);else nz[0]=!1,nz[1]=!1,nz[2]=!1,nz[3]=!1;return{isFullStroke:i,stroke:nz}},nG=[0,0,0,0],nU=t=>t?(0,ev.Z)(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(nG[0]=t[0],nG[2]=t[0],nG[1]=t[1],nG[3]=t[1],nG):t:t:0,nV=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],nW=[1,2,3,0,1,2,3,0];function nZ(t,e,i,r){for(;t>=eJ.f7;)t-=eJ.f7;for(;t<0;)t+=eJ.f7;for(;t>e;)e+=eJ.f7;nV[0].x=i,nV[1].y=i,nV[2].x=-i,nV[3].y=-i;let n=Math.ceil(t/eJ.ou)%4,s=Math.ceil(e/eJ.ou)%4;if(r.add((0,eJ.mC)(t)*i,(0,eJ.O$)(t)*i),r.add((0,eJ.mC)(e)*i,(0,eJ.O$)(e)*i),n!==s||e-t>eJ.pi){let t=!1;for(let e=0;ee.length){r=e.map(t=>{let e=new iy(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e});for(let n=0;n{let e=new iy(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e});for(let n=0;nnX.includes(t);function nq(t,e){if((0,ev.Z)(t)){let i;for(let r=0;r{this.appendDuration(Date.now()-this.lastDate),t(0)},this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce((t,e)=>t+e,0)/this.durations.length,1e3/60),1e3/30)}}nJ.TimeOut=1e3/60;let nQ=new nJ,n0=(t,e)=>(0,eT.Z)(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;function n1(t,e,i,r=0){return t.expand(e+(r/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let n2=0;function n5(){return n2++}function n3(t){let e=[],i=0,r="";for(let n=0;nt.codePointAt(0)&&(e=!0),e})(t[n])?i?r+=t[n]:(i=1,r=t[n]):(i&&(e.push({text:r,direction:oU.VERTICAL}),r="",i=0),e.push({text:t[n],direction:oU.HORIZONTAL}));return r&&e.push({text:r,direction:oU.VERTICAL}),e}(ok=oU||(oU={}))[ok.HORIZONTAL=0]="HORIZONTAL",ok[ok.VERTICAL=1]="VERTICAL";let n4=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach(t=>n4.set(t,!0));let n6=new Map;[""].forEach(t=>n6.set(t,!0));let n8=n5(),n7=n5(),n9=n5(),st=n5(),se=n5(),si=n5(),sr=n5(),sn=n5(),ss=n5(),sa=n5(),so=n5(),sl=n5(),sh=n5(),sd=n5(),su=n5(),sc=n5(),sp=Symbol.for("GraphicService"),sf=Symbol.for("GraphicCreator"),sg={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},sm=Object.keys(sg);(oM=oV||(oV={}))[oM.LESS_GROUP=0]="LESS_GROUP",oM[oM.MORE_GROUP=1]="MORE_GROUP";class sv extends nF{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=si,this._childUpdateTag=oP.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new rq),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new rq)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren(t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)})}showAll(){this.setAttribute("visible",!0),this.forEachChildren(t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)})}containsPoint(t,e,i){if(i===oR.GLOBAL){let i=new iy(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&oP.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;ru.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);let t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),ru.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){let{x:t=iJ.x,y:e=iJ.y,dx:i=iJ.dx,dy:r=iJ.dy,scaleX:n=iJ.scaleX,scaleY:s=iJ.scaleY,angle:a=iJ.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==r||1!==n||1!==s||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){let t=this.attribute,e=rQ(this).group;this._AABBBounds.clear();let i=ru.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:r=e.boundsPadding}=t,n=nU(r);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=oP.CLEAR_BOUNDS,this._childUpdateTag&=oP.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=oP.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&oP.UPDATE_BOUNDS||(this._childUpdateTag|=oP.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){let e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),ru.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),ru.graphicService.onClearIncremental(this,this.stage)}appendChild(t,e=!0){let i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){let i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){let i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){let i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){let e=super.removeChild(t);return t.stage=null,ru.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren(e=>{ru.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)}),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),ru.graphicService.onSetStage(this,t),this.forEachChildren(e=>{e.setStage(t,this.layer)}))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren(t=>{t.isContainer&&t.addUpdateGlobalPositionTag()})}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren(t=>{t.isContainer&&t.addUpdateGlobalPositionTag()})}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){let t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&oP.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find(e=>e.name===t,e)}createOrUpdateChild(t,e,i){let r=this._getChildByName(t);return r?r.setAttributes(e):((r=ru.graphicService.creator[i](e)).name=t,this.add(r)),r}clone(){return new sv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sv.NOWORK_ANIMATE_ATTR}}function sb(t){return new sv(t)}sv.NOWORK_ANIMATE_ATTR=nj;class sy extends sv{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,r){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=r.main,this.layerHandler=r.layerHandler,this.layerHandler.init(this,i,{main:r.main,canvasId:r.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=r.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new rq,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){let e=Array.from(this.subLayers.values()).sort((t,e)=>t.zIndex-e.zIndex);this.layerHandler.merge(e.map(e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler()))),t&&e.forEach(t=>{t.group&&(t.group.incremental=0)}),e.forEach(t=>{ru.layerService.releaseLayer(this.stage,t.layer)}),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach(i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)})}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach(t=>t(this)),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw Error("暂不支持")}setToFrame(t){throw Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach(t=>{ru.layerService.releaseLayer(this.stage,t.layer)})}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach(t=>t(this))}}let sx=Symbol.for("TransformUtil"),s_=Symbol.for("GraphicUtil"),sw=Symbol.for("LayerService"),sA=Symbol.for("StaticLayerHandlerContribution"),sS=Symbol.for("DynamicLayerHandlerContribution"),sE=Symbol.for("VirtualLayerHandlerContribution");let sT=oW=class{static GenerateLayerId(){return`${oW.idprefix}_${oW.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=ru.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return"static"===t?rO.get(sA):"dynamic"===t?rO.get(sS):rO.get(sE)}createLayer(t,e={main:!1}){var i;this.tryInit();let r=this.getRecommendedLayerType(e.layerMode);r=e.main||e.canvasId?"static":r;let n=this.getLayerHandler(r),s=new sy(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:r,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:oW.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(s),this.layerMap.set(t,a),this.staticLayerCountInEnv--,s}prepareStageLayer(t){let e;t.forEachChildren(t=>{let i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i).secondaryHandlers=[]})}releaseLayer(t,e){e.release();let i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter(t=>t!==e))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};sT.idprefix="visactor_layer",sT.prefix_count=0,sT=oW=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],sT);var sC=new eB(t=>{t(eX).to(eq).inSingletonScope(),t(rj).to(rz),t(s_).to(rV).inSingletonScope(),t(sx).to(rZ).inSingletonScope(),t(sw).to(sT).inSingletonScope()});let sk=Symbol.for("IncrementalDrawContribution"),sM=Symbol.for("ArcRender"),sB=Symbol.for("Arc3dRender"),sP=Symbol.for("AreaRender"),sR=Symbol.for("CircleRender"),sO=Symbol.for("GraphicRender"),sI=Symbol.for("GroupRender"),sL=Symbol.for("LineRender"),sD=Symbol.for("PathRender"),sN=Symbol.for("PolygonRender"),sj=Symbol.for("RectRender"),sF=Symbol.for("Rect3DRender"),sz=Symbol.for("SymbolRender"),sH=Symbol.for("TextRender"),sG=Symbol.for("RichTextRender"),sU=Symbol.for("Pyramid3dRender"),sV=Symbol.for("GlyphRender"),sW=Symbol.for("ImageRender");Symbol.for("RenderSelector");let sZ=Symbol.for("DrawContribution"),s$=Symbol.for("RenderService");Symbol.for("BeforeRenderConstribution");let sY=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach(e=>{this._prepare(e,t)})}_prepare(t,e){t.forEachChildren(t=>{this._prepare(t,e)}),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;let i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};sY=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(oZ=0,o$=eH(sZ),function(t,e){o$(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],sY);var sX=new eB(t=>{t(s$).to(sY).inSingletonScope()});Symbol.for("GraphicPicker");let sK=Symbol.for("PickerService");Symbol.for("BoundsPicker");let sq=Symbol.for("GlobalPickerService");function sJ(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}Symbol.for("MatrixAllocate"),Symbol.for("Mat4Allocate");class sQ{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return sJ();let t=this.pools.pop();return sQ.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():sJ();for(let i=0;i=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let s5=Symbol.for("PickItemInterceptor"),s3=class{constructor(){this.order=1}afterPickItem(t,e,i,r,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,r,n):null}beforePickItem(t,e,i,r,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,r,n):null}_pickItem(t,e,i,r,n){if(!t.shadowRoot)return null;let{parentMatrix:s}=n||{};if(!s)return null;let a=e.pickContext;a.highPerformanceSave();let o=t.shadowRoot,l=s0.allocateByObj(s),h=new iy(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),d=e.pickGroup(o,h,l,r);return a.highPerformanceRestore(),d}};s3=s2([eN()],s3);let s4=class{constructor(){this.order=1}beforePickItem(t,e,i,r,n){let s=t.baseGraphic;if(s&&s.parent){let t=new iy(i.x,i.y),n=e.pickContext;n.highPerformanceSave();let a=s.parent.globalTransMatrix;a.transformPoint(t,t);let o=s.isContainer?e.pickGroup(s,t.clone(),a,r):e.pickItem(s,t.clone(),a,r);return n.highPerformanceRestore(),o}return null}};s4=s2([eN()],s4);let s6=class{constructor(){this.order=1}beforePickItem(t,e,i,r,n){if(!t.in3dMode||r.in3dInterceptor)return null;let s=e.pickContext,a=t.stage;if(!s||!a)return null;if(r.in3dInterceptor=!0,s.save(),this.initCanvasCtx(s),s.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren(t=>!(o=t.numberType===n7)),t.forEachChildren(t=>!(l=!!t.findFace)),o){let s=t.getChildren(),o=[...s];o.sort((t,e)=>{var i,r,n,s;let a=(null!==(r=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==r?r:0)/2,o=(null!==(s=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==s?s:0)/2;for(;a<0;)a+=eJ.f7;for(;o<0;)o+=eJ.f7;return o-a}),o.forEach(t=>{t._next=null,t._prev=null}),t.removeAllChild(),t.update(),o.forEach(e=>{t.appendChild(e)}),r.hack_pieFace="outside",(a=e.pickGroup(t,i,n.parentMatrix,r)).graphic||(r.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,r)),a.graphic||(r.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,r)),t.removeAllChild(),s.forEach(t=>{t._next=null,t._prev=null}),s.forEach(e=>{t.appendChild(e)})}else if(l){let o=t.getChildren(),l=o.map(t=>({ave_z:t.findFace().vertices.map(e=>{var i;return s.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]}).reduce((t,e)=>t+e,0),g:t}));l.sort((t,e)=>e.ave_z-t.ave_z),t.removeAllChild(),l.forEach(t=>{t.g._next=null,t.g._prev=null}),t.update(),l.forEach(e=>{t.add(e.g)}),a=e.pickGroup(t,i,n.parentMatrix,r),t.removeAllChild(),o.forEach(t=>{t._next=null,t._prev=null}),t.update(),o.forEach(e=>{t.add(e)})}else a=e.pickGroup(t,i,n.parentMatrix,r);return s.camera=null,r.in3dInterceptor=!1,s.restore(),a}return s.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};s6=s2([eN()],s6);var s8=new eB((t,e,i)=>{i(sK)||(t(sq).toSelf(),t(sK).toService(sq)),t(s6).toSelf().inSingletonScope(),t(s5).toService(s6),t(s3).toSelf().inSingletonScope(),t(s5).toService(s3),t(s4).toSelf().inSingletonScope(),t(s5).toService(s4),eW(t,s5)});class s7{updateBounds(t,e,i,r){let{outerBorder:n,shadowBlur:s=e.shadowBlur}=t;if(n){let t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(r+(s+a)/2)}return i}}class s9 extends s7{updateBounds(t,e,i,r){let{outerBorder:n,shadowBlur:s=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){let t=e.outerBorder,{distance:r=t.distance,lineWidth:o=t.lineWidth}=n;n1(i,r+(s+o)/2,!0,a)}return i}}function at(t,e,i){let r,n,s,a,o,l,h,d,u,c,p,f;let g=i[0],m=i[1],v=i[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*v+e[12],t[13]=e[1]*g+e[5]*m+e[9]*v+e[13],t[14]=e[2]*g+e[6]*m+e[10]*v+e[14],t[15]=e[3]*g+e[7]*m+e[11]*v+e[15]):(r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=e[6],d=e[7],u=e[8],c=e[9],p=e[10],f=e[11],t[0]=r,t[1]=n,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=h,t[7]=d,t[8]=u,t[9]=c,t[10]=p,t[11]=f,t[12]=r*g+o*m+u*v+e[12],t[13]=n*g+l*m+c*v+e[13],t[14]=s*g+h*m+p*v+e[14],t[15]=a*g+d*m+f*v+e[15]),t}function ae(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function ai(t,e,i){let r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=e[6],d=e[7],u=e[8],c=e[9],p=e[10],f=e[11],g=e[12],m=e[13],v=e[14],b=e[15],y=i[0],x=i[1],_=i[2],w=i[3];return t[0]=y*r+x*o+_*u+w*g,t[1]=y*n+x*l+_*c+w*m,t[2]=y*s+x*h+_*p+w*v,t[3]=y*a+x*d+_*f+w*b,y=i[4],x=i[5],_=i[6],w=i[7],t[4]=y*r+x*o+_*u+w*g,t[5]=y*n+x*l+_*c+w*m,t[6]=y*s+x*h+_*p+w*v,t[7]=y*a+x*d+_*f+w*b,y=i[8],x=i[9],_=i[10],w=i[11],t[8]=y*r+x*o+_*u+w*g,t[9]=y*n+x*l+_*c+w*m,t[10]=y*s+x*h+_*p+w*v,t[11]=y*a+x*d+_*f+w*b,y=i[12],x=i[13],_=i[14],w=i[15],t[12]=y*r+x*o+_*u+w*g,t[13]=y*n+x*l+_*c+w*m,t[14]=y*s+x*h+_*p+w*v,t[15]=y*a+x*d+_*f+w*b,t}function ar(t,e,i){var r,n;let{x:s=i.x,y:a=i.y,z:o=i.z,dx:l=i.dx,dy:h=i.dy,dz:d=i.dz,scaleX:u=i.scaleX,scaleY:c=i.scaleY,scaleZ:p=i.scaleZ,alpha:f=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:v=e.attribute.anchor,anchor:b}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){let t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){let t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(r=v[2])&&void 0!==r?r:0}if((n=t)[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,at(t,t,[s+l,a+h,o+d]),at(t,t,[y[0],y[1],y[2]]),function(t,e,i){let r=Math.sin(i),n=Math.cos(i),s=e[4],a=e[5],o=e[6],l=e[7],h=e[8],d=e[9],u=e[10],c=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*n+h*r,t[5]=a*n+d*r,t[6]=o*n+u*r,t[7]=l*n+c*r,t[8]=h*n-s*r,t[9]=d*n-a*r,t[10]=u*n-o*r,t[11]=c*n-l*r}(t,t,g),function(t,e,i){let r=Math.sin(i),n=Math.cos(i),s=e[0],a=e[1],o=e[2],l=e[3],h=e[8],d=e[9],u=e[10],c=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n-h*r,t[1]=a*n-d*r,t[2]=o*n-u*r,t[3]=l*n-c*r,t[8]=s*r+h*n,t[9]=a*r+d*n,t[10]=o*r+u*n,t[11]=l*r+c*n}(t,t,f),at(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){let r=i[0],n=i[1],s=i[2];t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[u,c,p]),m){let i=s1.allocate(),r=[0,0];if(b){if("string"==typeof v[0]){let t=parseFloat(v[0])/100,i=e.AABBBounds;r[0]=i.x1+(i.x2-i.x1)*t}else r[0]=v[0];if("string"==typeof v[1]){let t=parseFloat(v[1])/100,i=e.AABBBounds;r[1]=i.x1+(i.x2-i.x1)*t}else r[1]=v[1]}at(i,i,[r[0],r[1],0]),function(t,e,i){let r=Math.sin(i),n=Math.cos(i),s=e[0],a=e[1],o=e[2],l=e[3],h=e[4],d=e[5],u=e[6],c=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n+h*r,t[1]=a*n+d*r,t[2]=o*n+u*r,t[3]=l*n+c*r,t[4]=h*n-s*r,t[5]=d*n-a*r,t[6]=u*n-o*r,t[7]=c*n-l*r}(i,i,m),at(i,i,[-r[0],-r[1],0]),ai(t,t,i)}}let an=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new e$(["graphic"]),onSetStage:new e$(["graphic","stage"]),onRemove:new e$(["graphic"]),onRelease:new e$(["graphic"]),onAddIncremental:new e$(["graphic","group","stage"]),onClearIncremental:new e$(["graphic","group","stage"]),beforeUpdateAABBBounds:new e$(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new e$(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new il,this.tempAABBBounds2=new il,this._rectBoundsContribitions=[new s7],this._symbolBoundsContribitions=[new s9],this._circleBoundsContribitions=[new s7],this._arcBoundsContribitions=[new s7],this._pathBoundsContribitions=[new s7]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,r){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,r)}afterUpdateAABBBounds(t,e,i,r,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,r,n)}updatePathProxyAABBBounds(t,e){let i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;let r=new e6(t);return iv(i.commandList,r,0,0),!0}updateRectAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;if(!this.updatePathProxyAABBBounds(i,r)){let{width:e,height:r}=t,{x1:n,y1:s,x:a,y:o}=t;e=null!=e?e:n-a,r=null!=r?r:s-o,i.set(0,0,e||0,r||0)}let n=this.tempAABBBounds1,s=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach(a=>{a.updateBounds(t,e,n,r),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2)}),this.transformAABBBounds(t,i,e,!1,r),i}updateGroupAABBBounds(t,e,i,r){let{width:n,height:s,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach(t=>{i.union(t.AABBBounds)}):null!=n&&null!=s&&i.set(0,0,n,s),o||r.forEachChildren(t=>{i.union(t.AABBBounds)});let l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}updateGlyphAABBBounds(t,e,i,r){return this._validCheck(t,e,i,r)&&r.getSubGraphic().forEach(t=>{i.union(t.AABBBounds)}),i}updateRichTextAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r)||!r)return i;let{width:n=e.width,height:s=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&s>0)i.set(0,0,n,s);else{let{width:t,height:e}=r.getFrameCache().getActualSize(),l=n||t||0,h=s||e||0;h="number"==typeof o&&h>o?o:h||0,l="number"==typeof a&&l>a?a:l||0,i.set(0,0,l,h)}let d=0;switch(h){case"top":d=0;break;case"middle":d=-i.height()/2;break;case"bottom":d=-i.height()}let u=0;switch(l){case"left":u=0;break;case"center":u=-i.width()/2;break;case"right":u=-i.width()}i.translate(u,d);let c=this.tempAABBBounds1,p=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}updateTextAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r)||!r)return i;let{text:n=e.text}=r.attribute;Array.isArray(n)?r.updateMultilineAABBBounds(n):r.updateSingallineAABBBounds(n);let s=this.tempAABBBounds1,a=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);let{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:d=e.strokeBoundsBuffer}=t;return h&&(n1(s,h/Math.abs(o+l),!0,d),i.union(s)),this.combindShadowAABBBounds(i,r),ia(i,i,r.transMatrix),i}updatePathAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;this.updatePathProxyAABBBounds(i,r)||this.updatePathAABBBoundsImprecise(t,e,i,r);let n=this.tempAABBBounds1,s=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach(a=>{a.updateBounds(t,e,n,r),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2)});let{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,r),i}updatePathAABBBoundsImprecise(t,e,i,r){if(!r)return i;let n=r.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,r){if(!r)return i;let n=r.stage;if(!n||!n.camera)return i;r.findFace().vertices.forEach(t=>{let e=t[0],r=t[1];i.add(e,r)});let s=this.tempAABBBounds1,a=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}updateArc3dAABBBounds(t,e,i,r){if(!r)return i;let n=r.stage;if(!n||!n.camera)return i;let{outerRadius:s=e.outerRadius,height:a=0}=t,o=s+a;i.setValue(-o,-o,o,o);let l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}updatePolygonAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;this.updatePathProxyAABBBounds(i,r)||this.updatePolygonAABBBoundsImprecise(t,e,i,r);let n=this.tempAABBBounds1,s=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2);let{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,r),i}updatePolygonAABBBoundsImprecise(t,e,i,r){let{points:n=e.points}=t;return n.forEach(t=>{i.add(t.x,t.y)}),i}updateLineAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;this.updatePathProxyAABBBounds(i,r)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,r):this.updateLineAABBBoundsByPoints(t,e,i,r));let n=this.tempAABBBounds1,s=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2);let{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,r),i}updateLineAABBBoundsByPoints(t,e,i,r){let{points:n=e.points}=t;return n.forEach(t=>{i.add(t.x,t.y)}),i}updateLineAABBBoundsBySegments(t,e,i,r){let{segments:n=e.segments}=t;return n.forEach(t=>{t.points.forEach(t=>{i.add(t.x,t.y)})}),i}updateAreaAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;this.updatePathProxyAABBBounds(i,r)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,r):this.updateAreaAABBBoundsByPoints(t,e,i,r));let n=this.tempAABBBounds1,s=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2);let{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,r),i}updateAreaAABBBoundsByPoints(t,e,i,r){let{points:n=e.points}=t;return n.forEach(t=>{var e,r;i.add(t.x,t.y),i.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(r=t.y1)&&void 0!==r?r:t.y)}),i}updateAreaAABBBoundsBySegments(t,e,i,r){let{segments:n=e.segments}=t;return n.forEach(t=>{t.points.forEach(t=>{var e,r;i.add(t.x,t.y),i.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(r=t.y1)&&void 0!==r?r:t.y)})}),i}updateCircleAABBBounds(t,e,i,r,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(r?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));let s=this.tempAABBBounds1,a=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach(r=>{r.updateBounds(t,e,s,n),i.union(s),s.setValue(a.x1,a.y1,a.x2,a.y2)}),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,r){let{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,r){let{startAngle:n=e.startAngle,endAngle:s=e.endAngle,radius:a=e.radius}=t;return s-n>eJ.f7-eJ.Ho?i.set(-a,-a,a,a):nZ(n,s,a,i),i}updateArcAABBBounds(t,e,i,r,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(r?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));let s=this.tempAABBBounds1,a=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach(r=>{r.updateBounds(t,e,s,n),i.union(s),s.setValue(a.x1,a.y1,a.x2,a.y2)});let{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,r){let{outerRadius:n=e.outerRadius,innerRadius:s=e.innerRadius}=t,{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return(n+=a)<(s-=o)&&(n=s),i.set(-n,-n,n,n),i}updateArcAABBBoundsAccurate(t,e,i,r){let{outerRadius:n=e.outerRadius,innerRadius:s=e.innerRadius}=t,{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;if((n+=a)<(s-=o)){let t=n;n=s,s=t}let{endAngle:l=e.endAngle,startAngle:h=e.startAngle}=t;if(h>l){let t=h;h=l,l=t}return n<=eJ.Ho?i.set(0,0,0,0):Math.abs(l-h)>eJ.f7-eJ.Ho?i.set(-n,-n,n,n):(nZ(h,l,n,i),nZ(h,l,s,i)),i}updateSymbolAABBBounds(t,e,i,r,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(r?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));let s=this.tempAABBBounds1,a=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach(r=>{r.updateBounds(t,e,s,n),i.union(s),s.setValue(a.x1,a.y1,a.x2,a.y2)});let{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,r){let{size:n=e.size}=t;if((0,ev.Z)(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{let t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,r){if(!r)return i;let{size:n=e.size}=t;return r.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;if(!this.updatePathProxyAABBBounds(i,r)){let{width:r=e.width,height:n=e.height}=t;i.set(0,0,r,n)}let n=this.tempAABBBounds1,s=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){let i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,r,n){if(!e.empty()){let{scaleX:n=i.scaleX,scaleY:s=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:d=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,c=this.tempAABBBounds2;if(a&&l&&(n1(u,(l+h)/Math.abs(n+s),r,d),e.union(u),u.setValue(c.x1,c.y1,c.x2,c.y2)),o){let{shadowOffsetX:r=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;n1(u,o/Math.abs(n+s)*2,!1,d+1),u.translate(r,a),e.union(u)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let s=!0,a=n.transMatrix;n&&n.isContainer&&(s=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),s&&ia(e,e,a)}_validCheck(t,e,i,r){if(!r)return!0;if(!r.valid)return i.clear(),!1;let{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};an=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(oY=0,oX=eH(sf),function(t,e){oX(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],an);let as=new class t{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){let i=this.store.get(t);return i?i(e):null}};var aa=new eB(t=>{t(sp).to(an).inSingletonScope(),t(sf).toConstantValue(as)});let ao=Symbol.for("AutoEnablePlugins"),al=Symbol.for("PluginService");var ah=function(t,e){return function(i,r){e(i,r,t)}};let ad=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;let{pluginList:i}=e;i&&rO.isBound(ao)&&this.autoEnablePlugins.getContributions().forEach(t=>{i.includes(t.name)&&this.register(t)})}findPluginsByName(t){let e=[];return this.onStartupFinishedPlugin.forEach(i=>{i.name===t&&e.push(i)}),this.onRegisterPlugin.forEach(i=>{i.name===t&&e.push(i)}),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach(t=>{t.deactivate(this)}),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach(t=>{t.deactivate(this)}),this.onRegisterPlugin=[]}};ad=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),ah(0,eH(eU)),ah(0,eG(ao)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],ad);var au=new eB(t=>{t(al).to(ad),function(t,e){t(eU).toDynamicValue(({container:t})=>new eV(e,t)).whenTargetNamed(e)}(t,ao)}),ac=new eB(t=>{eW(t,eY)}),ap=new eB(t=>{t(r_).to(rw).inSingletonScope(),eW(t,r_)});let af=class{constructor(){this.type="static",this.offscreen=!1,this.global=ru.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");let r=e.getContext().getCanvas().nativeCanvas,n=rD({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:r.offsetLeft,y:r.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var r;if(!this.main){let t=this.window.getContext().getCanvas().nativeCanvas;t&&(this.canvas.x!==t.offsetLeft||this.canvas.y!==t.offsetTop)&&(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(r=e.background)&&void 0!==r?r:"#ffffff"},e),i))}merge(t){t.forEach(t=>{let e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)})}prepare(t,e){}drawTo(t,e,i){var r;let n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(r=i.background)&&void 0!==r?r:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};af=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],af);let ag=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=ru.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var r;let n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(r=i.background)&&void 0!==r?r:"#fff":void 0}))}getContext(){return null}release(){}};ag=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],ag);let am=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=ru.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;let r=rD({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=r,this.context=r.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){let r=t.getContext(),n=t.dpr,{viewBox:s}=i,a=s.x1,o=s.y1,l=s.width(),h=s.height();r.nativeContext.save(),r.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&r.clearRect(a,o,l,h),r.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),r.nativeContext.restore()}merge(t){}};am=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],am);var av=new eB(t=>{t(af).toSelf(),t(am).toSelf(),t(ag).toSelf(),t(sA).toService(af),t(sS).toService(am),t(sE).toService(ag)});let ab=ez(eO);function ay(t,e,i,r=!1,n=!1){let s={},a=[],o=!1;if(n)o=!0;else{let i;t.forEachChildren((t,r)=>{let{zIndex:n=e}=t.attribute;if(0===r)i=n;else if(i!==n)return o=!0,!0;return!1},r)}if(o){t.forEachChildren(t=>{let{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],a.push(i))},r),a.sort((t,e)=>r?e-t:t-e);let o=!1;for(let t=0;t{var i,n;return(r?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))});for(let t=0;t0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,r,n),!1}beforeDrawItem(t,e,i,r,n){return t.attribute.shadowRootIdx<0&&this.drawItem(t,e,i,r,n),!1}drawItem(t,e,i,r,n){if(!t.shadowRoot)return!1;let{context:s}=i;if(s.highPerformanceSave(),s.transformFromMatrix(t.transMatrix,!0),r.dirtyBounds&&r.backupDirtyBounds){aw.copy(r.dirtyBounds);let e=t.globalTransMatrix.getInverse();r.dirtyBounds.copy(r.backupDirtyBounds).transformWithMatrix(e)}return r.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),s.highPerformanceRestore(),r.dirtyBounds&&r.backupDirtyBounds&&r.dirtyBounds.copy(aw),!0}}class aS{constructor(){this.order=1}afterDrawItem(t,e,i,r,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,r,n),!1}drawItem(t,e,i,r,n){if(!t.attribute._debug_bounds)return!1;let{context:s}=i;s.highPerformanceSave(),t.parent&&s.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&s.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);let a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(s,t),s.strokeRect(a.x1,a.y1,a.width(),a.height()),s.highPerformanceRestore(),!0}}let aE=class{constructor(){this.order=1,this.interceptors=[new aA,new aC,new aT,new aS]}afterDrawItem(t,e,i,r,n){for(let s=0;s=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],aE);class aT{constructor(){this.order=1}beforeDrawItem(t,e,i,r,n){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,r,n):this.beforeSetInteractive(t,e,i,r,n))}beforeSetInteractive(t,e,i,r,n){let s=t.interactiveGraphic;if(t.attribute.globalZIndex){s||(s=t.clone(),t.interactiveGraphic=s,s.baseGraphic=t),s.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();let e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).add(s),!0}if(s){i.stage.tryInitInteractiveLayer();let e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(s),t.interactiveGraphic=null,s.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,r,n){let s=t.baseGraphic;if(s){this.processing=!0;let{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(s.parent.globalTransMatrix,!0),s.isContainer?r.renderGroup(s,i,s.parent.globalTransMatrix):r.renderItem(s,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||((i=as.CreateGraphic("group",{})).id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class aC{constructor(){this.order=1}beforeDrawItem(t,e,i,r,n){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;let{context:s,stage:a}=e.drawParams;s.canvas,s.save(),this.initCanvasCtx(s),s.camera=a.camera;let o=s.currentMatrix;o.a/=s.dpr,o.b/=s.dpr,o.c/=s.dpr,o.d/=s.dpr,o.e/=s.dpr,o.f/=s.dpr;let l=s1.allocate();ae(l,o);let h=s.modelMatrix;if(h){if(l){let t=s1.allocate();s.modelMatrix=ai(t,h,l)}}else s.modelMatrix=l;if(s.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,n=!1;if(t.forEachChildren(t=>!(e=t.numberType===n7)),t.forEachChildren(t=>!(n=!!t.findFace)),e){let e=t.getChildren(),n=[...e];n.sort((t,e)=>{var i,r,n,s;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(r=t.attribute.endAngle)&&void 0!==r?r:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(s=e.attribute.endAngle)&&void 0!==s?s:0))/2;for(;a<0;)a+=eJ.f7;for(;o<0;)o+=eJ.f7;return o-a}),n.forEach(t=>{t._next=null,t._prev=null}),t.removeAllChild(),t.update(),n.forEach(e=>{t.appendChild(e)});let s=t.parent.globalTransMatrix;i.hack_pieFace="outside",r.renderGroup(t,i,s),i.hack_pieFace="inside",r.renderGroup(t,i,s),i.hack_pieFace="top",r.renderGroup(t,i,s),t.removeAllChild(),e.forEach(t=>{t._next=null,t._prev=null}),e.forEach(e=>{t.appendChild(e)})}else if(n){let e=t.getChildren(),n=e.map(t=>({ave_z:t.findFace().vertices.map(e=>{var i;return s.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]}).reduce((t,e)=>t+e,0),g:t}));n.sort((t,e)=>e.ave_z-t.ave_z),t.removeAllChild(),n.forEach(t=>{t.g._next=null,t.g._prev=null}),t.update(),n.forEach(e=>{t.add(e.g)}),r.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach(t=>{t._next=null,t._prev=null}),t.update(),e.forEach(e=>{t.add(e)})}else r.renderGroup(t,i,t.parent.globalTransMatrix)}else r.renderItem(t,i);return s.camera=null,s.restore(),s.modelMatrix!==h&&s1.free(s.modelMatrix),s.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}let ak=function(){let t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i},e="";function i(t){let i=Error(e+": "+t);throw i.source=e,i}function r(){return n("linear",t.linearGradient,s)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,r,n){return function(e,r){let n=v(e);if(n){v(t.startCall)||i("Missing (");let e=r(n);return v(t.endCall)||i("Missing )"),e}}(r,function(r){let s=n();return s&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:s,colorStops:c(p)}})}function s(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,r,n=l();return n&&((i=[]).push(n),r=e,v(t.comma)&&((n=l())?i.push(n):e=r)),i}function l(){let t=function(){let t=m("shape",/^(circle)/i,0);return t&&(t.style=g()||h()),t}()||function(){let t=m("shape",/^(ellipse)/i,0);return t&&(t.style=f()||h()),t}();if(t)t.at=d();else{let e=h();if(e){t=e;let i=d();i&&(t.at=i)}else{let e=u();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function d(){if(m("position",/^at/,0)){let t=u();return t||i("Missing positioning value"),t}}function u(){let t={x:f(),y:f()};if(t.x||t.y)return{type:"position",value:t}}function c(e){let r=e(),n=[];if(r)for(n.push(r);v(t.comma);)(r=e())?n.push(r):i("One extra comma");return n}function p(){let e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=f(),e}function f(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||g()}function g(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){let r=v(e);if(r)return{type:t,value:r[i]}}function v(t){let i=/^[\n\r\t\s]+/.exec(e);i&&b(i[0].length);let r=t.exec(e);return r&&b(r[0].length),r}function b(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){let t=c(r);return e.length>0&&i("Invalid input not EOF"),t}()}}();class aM{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(aM.IsGradientStr(t))try{let e=ak(t)[0];if(e){if("linear"===e.type)return aM.ParseLinear(e);if("radial"===e.type)return aM.ParseRadial(e);if("conic"===e.type)return aM.ParseConic(e)}}catch(t){}return t}static ParseConic(t){let{orientation:e,colorStops:i=[]}=t,r=eJ.pi/2,n=parseFloat(e.value)/180*eJ.pi-r;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+eJ.f7,stops:i.map(t=>({color:t.value,offset:parseFloat(t.length.value)/100}))}}static ParseRadial(t){let{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map(t=>({color:t.value,offset:parseFloat(t.length.value)/100}))}}static ParseLinear(t){let{orientation:e,colorStops:i=[]}=t,r=eJ.pi/2,n="angular"===e.type?parseFloat(e.value)/180*eJ.pi:0;for(;n<0;)n+=eJ.f7;for(;n>eJ.f7;)n-=eJ.f7;let s=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100}))}}}function aB(t,e,i){let r=e,{a:n,b:s,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+s*s),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:r=r/Math.abs(l+h)*2*i}function aP(t,e,i,r,n){let s,a;if(!e||!0===e)return"black";if((0,ev.Z)(e))for(let t=0;t{f.addColorStop(t.offset,t.color)}),f}(t,a,i,r,n):"conical"===a.gradient?s=function(t,e,i,r=0,n=0){var s,a;let o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,d=o.x1-r,u=o.y1-n;if(i.attribute){let{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,d/=t,u/=e}let c=t.createConicGradient(d+(null!==(s=e.x)&&void 0!==s?s:0)*l,u+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach(t=>{c.addColorStop(t.offset,t.color)}),c.GetPattern(l+d,h+u,void 0)}(t,a,i,r,n):"radial"===a.gradient&&(s=function(t,e,i,r=0,n=0){var s,a,o,l,h,d;let u=i.AABBBounds;if(!u)return;let c=u.x2-u.x1,p=u.y2-u.y1,f=u.x1-r,g=u.y1-n;if(i.attribute){let{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;f/=t,g/=e,c/=t,p/=e}let m=t.createRadialGradient(f+(null!==(s=e.x0)&&void 0!==s?s:.5)*c,g+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(c,p)*(null!==(o=e.r0)&&void 0!==o?o:0),f+(null!==(l=e.x1)&&void 0!==l?l:.5)*c,g+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(c,p)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach(t=>{m.addColorStop(t.offset,t.color)}),m}(t,a,i,r,n)),s||"orange")}Symbol.for("BoundsAllocate");let aR=new class t{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new il)}allocate(t,e,i,r){if(!this.pools.length)return(new il).setValue(t,e,i,r);let n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=r,n}allocateByObj(t){if(!this.pools.length)return new il(t);let e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};var aO=function(t,e){return function(i,r){e(i,r,t)}};let aI=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new io,this.backupDirtyBounds=new io,this.global=ru.global,this.layerService=ru.layerService,this.init()}init(){this.contributions.forEach(t=>{if(t.style){let e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)}),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort((t,e)=>t.order-e.order)}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;let{context:i,stage:r,viewBox:n,transMatrix:s}=e;if(!i)return;let a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(r.dirtyBounds&&!r.dirtyBounds.empty()){let t=function(t,e,i){if(null===t)return e;if(null===e)return t;let{x11:r,x12:n,y11:s,y12:a,x21:o,x22:l,y21:h,y22:d}=e9(t,e,i);return r>=l||n<=o||s>=d||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,o),y1:Math.max(s,h),x2:Math.min(n,l),y2:Math.min(a,d)}}(a,r.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}let o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(s.a,s.b,s.c,s.d,s.e,s.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),r.camera&&(this.dirtyBounds.setValue(-Infinity,-Infinity,1/0,1/0),this.backupDirtyBounds.setValue(-Infinity,-Infinity,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort((t,e)=>{var i,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:i4.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:i4.zIndex)}).forEach(t=>{t.isContainer?this.renderGroup(t,e,s0.allocate(1,0,0,1,0,0)):this.renderItem(t,e)}),i.restore(),i.draw(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1}doRegister(){throw Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){let t=function(t,e,i,r=!1){let n={},s=[],a=!1;t.forEachChildren((t,e)=>{let{zIndex:r=i}=t.attribute;if(0===e);else if(void 0!==r)return a=!0,!0;return!1},r);let o=null,l=!1;if(a){t.forEachChildren(t=>{let{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],s.push(e))},r),s.sort((t,e)=>r?e-t:t-e);let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1),r);return o}(e,i,i4.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,r){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!it(t.AABBBounds,this.dirtyBounds,!1))return;let n,s=i;if(this.useDirtyBounds){n=aR.allocateByObj(this.dirtyBounds);let e=t.transMatrix;s=s0.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;r?t.forEachChildren(t=>{e.break||(t.isContainer?this.renderGroup(t,e,s):this.renderItem(t,e))}):ay(t,i4.zIndex,t=>{e.break||(t.isContainer?this.renderGroup(t,e,s):this.renderItem(t,e))},!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),aR.free(n),s0.free(s))}_increaseRender(t,e){let{layer:i,stage:r}=e,{subLayers:n}=i,s=n.get(t._uid);s||(s={layer:this.layerService.createLayer(r),zIndex:n.size,group:t},n.set(t._uid,s));let a=s.layer.getNativeHandler().getContext(),o=s.drawContribution||rO.get(sk);o.dirtyBounds.setValue(-Infinity,-Infinity,1/0,1/0),o.backupDirtyBounds.setValue(-Infinity,-Infinity,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:s.layer,context:a,startAtId:t._uid,break:!1})),s.drawContribution=o;let l=this._findNextGraphic(t);if(l){if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(r),zIndex:n.size},n.set(l._uid,t));let i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let r=0;r=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),aO(0,ab(sO)),aO(1,eH(eU)),aO(1,eG(a_)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Array,Object])],aI);let aL=eJ.pi/2;function aD(t,e,i,r,n,s){let a;if(r<0&&(e+=r,r=-r),n<0&&(i+=n,n=-n),(0,ib.Z)(s,!0))a=[s=(0,eJ.Wn)(s),s,s,s];else if(Array.isArray(s)){let t,e;let i=s;switch(i.length){case 0:a=[0,0,0,0];break;case 1:a=[t=(0,eJ.Wn)(i[0]),t,t,t];break;case 2:case 3:t=(0,eJ.Wn)(i[0]),a=[t,e=(0,eJ.Wn)(i[1]),t,e];break;default:(a=i)[0]=(0,eJ.Wn)(a[0]),a[1]=(0,eJ.Wn)(a[1]),a[2]=(0,eJ.Wn)(a[2]),a[3]=(0,eJ.Wn)(a[3])}}else a=[0,0,0,0];if(r<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,r,n);let[o,l,h,d]=[[e,i],[e+r,i],[e+r,i+n],[e,i+n]],u=Math.min(r/2,n/2),c=[Math.min(u,a[0]),Math.min(u,a[1]),Math.min(u,a[2]),Math.min(u,a[3])],p=[o[0]+c[0],o[1]],f=[o[0],o[1]+c[0]],g=[l[0]-c[1],l[1]],m=[l[0],l[1]+c[1]],v=[h[0]-c[2],h[1]],b=[h[0],h[1]-c[2]],y=[d[0]+c[3],d[1]],x=[d[0],d[1]-c[3]];if(t.moveTo(p[0],p[1]),t.lineTo(g[0],g[1]),!eS(g,m)){let e=g[0],i=g[1]+c[1];t.arc(e,i,c[1],-aL,0,!1)}if(t.lineTo(b[0],b[1]),!eS(v,b)){let e=b[0]-c[2],i=b[1];t.arc(e,i,c[2],0,aL,!1)}if(t.lineTo(y[0],y[1]),!eS(y,x)){let e=y[0],i=y[1]-c[3];t.arc(e,i,c[3],aL,eJ.pi,!1)}if(t.lineTo(f[0],f[1]),!eS(p,f)){let e=p[0],i=p[1]+c[0];t.arc(e,i,c[0],eJ.pi,eJ.pi+aL,!1)}return t.closePath(),t}function aN(t,e){return!(!t&&!e)}function aj(t,e){return((0,ev.Z)(t)?t.some(t=>t||void 0===t):!!t)&&e>0}function aF(t,e,i){return i&&t*e>0}function az(t,e,i,r,n){return n&&t*e>0&&0!==i&&0!==r}function aH(t,e){return t*e>0}function aG(t,e,i,r){return t*e>0&&0!==i&&0!==r}function aU(t,e,i,r,n,s,a,o){let l=i-t,h=r-e,d=a-n,u=o-s,c=u*l-d*h;return c*cB*B+P*P&&(S=T,E=C),{cx:S,cy:E,x01:-d,y01:-u,x11:S*(n/_-1),y11:E*(n/_-1)}}function aW(t,e,i,r,n,s,a){let{startAngle:o,endAngle:l}=t.getParsedAngle(),h=(0,eJ.Wn)(l-o),d=l>o,u=!1;if(n=eJ.f7-eJ.Ho)e.moveTo(i+n*(0,eJ.mC)(o),r+n*(0,eJ.O$)(o)),e.arc(i,r,n,o,l,!d),s>eJ.Ho&&(e.moveTo(i+s*(0,eJ.mC)(l),r+s*(0,eJ.O$)(l)),e.arc(i,r,s,l,o,d));else{let c,p,f,g;let m=t.getParsedCornerRadius(),{outerDeltaAngle:v,innerDeltaAngle:b,outerStartAngle:y,outerEndAngle:x,innerEndAngle:_,innerStartAngle:w}=t.getParsePadAngle(o,l),A=Math.max(m,m),S=Math.max(m,m),E=A,T=S,C=n*(0,eJ.mC)(y),k=n*(0,eJ.O$)(y),M=s*(0,eJ.mC)(_),B=s*(0,eJ.O$)(_);if((S>eJ.Ho||A>eJ.Ho)&&(c=n*(0,eJ.mC)(x),p=n*(0,eJ.O$)(x),f=s*(0,eJ.mC)(w),g=s*(0,eJ.O$)(w),heJ.Ho){let t=(0,eJ.VV)(m,E),s=(0,eJ.VV)(m,E),o=aV(f,g,C,k,n,t,Number(d)),l=aV(c,p,M,B,n,s,Number(d));E0&&e.arc(i+o.cx,r+o.cy,t,(0,eJ.fv)(o.y01,o.x01),(0,eJ.fv)(o.y11,o.x11),!d),e.arc(i,r,n,(0,eJ.fv)(o.cy+o.y11,o.cx+o.x11),(0,eJ.fv)(l.cy+l.y11,l.cx+l.x11),!d),s>0&&e.arc(i+l.cx,r+l.cy,s,(0,eJ.fv)(l.y11,l.x11),(0,eJ.fv)(l.y01,l.x01),!d)):s>0?e.moveTo(i+l.cx+s*(0,eJ.mC)((0,eJ.fv)(l.y01,l.x01)),r+l.cy+s*(0,eJ.O$)((0,eJ.fv)(l.y01,l.x01))):e.moveTo(i+c,r+n*(0,eJ.O$)(x))}else!a||a[0]?(e.moveTo(i+C,r+k),e.arc(i,r,n,y,x,!d)):e.moveTo(i+n*(0,eJ.mC)(x),r+n*(0,eJ.O$)(x));if(!(s>eJ.Ho)||b<.001)!a||a[1]?e.lineTo(i+M,r+B):e.moveTo(i+M,r+B),u=!0;else if(T>eJ.Ho){let t=(0,eJ.VV)(m,T),n=(0,eJ.VV)(m,T),o=aV(M,B,c,p,s,-n,Number(d)),l=aV(C,k,f,g,s,-t,Number(d));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,r+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,r+o.cy+o.y01),T0&&e.arc(i+o.cx,r+o.cy,n,(0,eJ.fv)(o.y01,o.x01),(0,eJ.fv)(o.y11,o.x11),!d),e.arc(i,r,s,(0,eJ.fv)(o.cy+o.y11,o.cx+o.x11),(0,eJ.fv)(l.cy+l.y11,l.cx+l.x11),d),t>0&&e.arc(i+l.cx,r+l.cy,t,(0,eJ.fv)(l.y11,l.x11),(0,eJ.fv)(l.y01,l.x01),!d)):t>0?e.moveTo(i+l.cx+t*(0,eJ.mC)((0,eJ.fv)(l.y01,l.x01)),r+l.cy+t*(0,eJ.O$)((0,eJ.fv)(l.y01,l.x01))):e.moveTo(i+f,r+g)}else!a||a[1]?e.lineTo(i+M,r+B):e.moveTo(i+M,r+B),!a||a[2]?e.arc(i,r,s,_,w,d):e.moveTo(i+s*(0,eJ.mC)(w),r+s*(0,eJ.O$)(w))}return a?a[3]&&e.lineTo(i+n*(0,eJ.mC)(o),r+n*(0,eJ.O$)(o)):e.closePath(),u}let aZ=Symbol.for("ArcRenderContribution"),a$=Symbol.for("AreaRenderContribution"),aY=Symbol.for("CircleRenderContribution"),aX=Symbol.for("GroupRenderContribution"),aK=Symbol.for("ImageRenderContribution"),aq=Symbol.for("PathRenderContribution"),aJ=Symbol.for("PolygonRenderContribution"),aQ=Symbol.for("RectRenderContribution"),a0=Symbol.for("SymbolRenderContribution"),a1=Symbol.for("TextRenderContribution");Symbol.for("CommonRenderContribution");let a2=Symbol.for("InteractiveSubRenderContribution");var a5=function(t,e){return function(i,r){e(i,r,t)}};class a3{constructor(){this.time=oF.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,s,a,o,l,h,d,u,c){let{background:p,backgroundMode:f=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(p){if(t.backgroundImg&&t.resources){let n=t.resources.get(p);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){let i=rQ(t.parent).group,{scrollX:r=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(r,n)}e.clip();let s=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,r,l),this.doDrawImage(e,n.data,s,f,g),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,r,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}}doDrawImage(t,e,i,r,n){if("no-repeat"===r)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{let s=i.width(),a=i.height(),o=s,l=a;if(n&&"repeat"!==r&&(e.width||e.height)){let i=e.width,n=e.height;"repeat-x"===r?(o=a/n*i,l=a):"repeat-y"===r&&(l=s/i*n,o=s);let h=t.dpr,d=rN.allocate({width:o,height:l,dpr:h}),u=d.getContext("2d");u&&(u.inuse=!0,u.clearMatrix(),u.setTransformForCurrent(!0),u.clearRect(0,0,o,l),u.drawImage(e,0,0,o,l),e=d.nativeCanvas),rN.free(d)}let h=t.dpr,d=t.createPattern(e,r);d.setTransform&&d.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=d,t.translate(i.x1,i.y1),t.fillRect(0,0,s,a),t.translate(-i.x1,-i.y1)}}}let a4=new a3,a6=class{constructor(t){this.subRenderContribitions=t,this.time=oF.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,s,a,o,l,h,d,u,c){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach(p=>{p.render(t,e,i,r,n,s,a,o,l,h,d,u,c)})}};a6=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),a5(0,eH(eU)),a5(0,eG(a2)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],a6);let a8=new class t extends a3{constructor(){super(...arguments),this.time=oF.beforeFillStroke}drawShape(t,e,i,r,n,s,a,o,l,h,d,u){let{background:c,backgroundMode:p=l.backgroundMode,backgroundFit:f=l.backgroundFit}=t.attribute;if(c){if(t.backgroundImg&&t.resources){let i=t.resources.get(c);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);let r=t.AABBBounds;this.doDrawImage(e,i.data,r,p,f),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=c,e.fill(),e.highPerformanceRestore()}}};var a7=function(t,e){return function(i,r){e(i,r,t)}};let a9=class{constructor(t){this.groupRenderContribitions=t,this.numberType=si}drawShape(t,e,i,r,n,s,a,o){var l,h;let d=rQ(t,null==s?void 0:s.theme).group,{fill:u=d.fill,background:c,stroke:p=d.stroke,opacity:f=d.opacity,width:g=d.width,height:m=d.height,clip:v=d.clip,fillOpacity:b=d.fillOpacity,strokeOpacity:y=d.strokeOpacity,cornerRadius:x=d.cornerRadius,path:_=d.path,lineWidth:w=d.lineWidth,visible:A=d.visible}=t.attribute,S=az(f,b,g,m,u),E=aG(f,y,g,m),T=(l=u,h=c,!(!l&&!h)),C=aj(p,w);if(!t.valid||!A||!v&&(!T&&!C||!(S||E||a||o||c)))return;if(_&&_.length&&n.drawContribution){let t=e.disableFill,i=e.disableStroke,r=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,_.forEach(t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,s)}),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=r}else 0===x||(0,ev.Z)(x)&&x.every(t=>0===t)?(e.beginPath(),e.rect(i,r,g,m)):(e.beginPath(),aD(e,i,r,g,m,x));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(a8));let k={doFill:T,doStroke:C};this._groupRenderContribitions.forEach(s=>{s.time===oF.beforeFillStroke&&s.drawShape(t,e,i,r,T,C,S,E,d,n,a,o,k)}),v&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),k.doFill&&(a?a(e,t.attribute,d):S&&(e.setCommonStyle(t,t.attribute,i,r,d),e.fill())),k.doStroke&&(o?o(e,t.attribute,d):E&&(e.setStrokeStyle(t,t.attribute,i,r,d),e.stroke())),this._groupRenderContribitions.forEach(s=>{s.time===oF.afterFillStroke&&s.drawShape(t,e,i,r,T,C,S,E,d,n,a,o)})}draw(t,e,i,r){let n;let{context:s}=i;if(!s)return;let{clip:a}=t.attribute;a?s.save():s.highPerformanceSave();let o=rQ(t,null==r?void 0:r.theme).group,l=s.modelMatrix;if(s.camera){let e=s1.allocate(),i=s1.allocate();ar(i,t,o),ai(e,l||e,i),s.modelMatrix=e,s1.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),r.skipDraw?this.drawShape(t,s,0,0,i,r,()=>!1,()=>!1):this.drawShape(t,s,0,0,i);let{scrollX:h=o.scrollX,scrollY:d=o.scrollY}=t.attribute;(h||d)&&s.translate(h,d),r&&r.drawingCb&&(n=r.drawingCb()),s.modelMatrix!==l&&s1.free(s.modelMatrix),s.modelMatrix=l,n&&n.then?n.then(()=>{a?s.restore():s.highPerformanceRestore()}):a?s.restore():s.highPerformanceRestore()}};a9=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),a7(0,eH(eU)),a7(0,eG(aX)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],a9);let ot={x:0,y:0,z:0,lastModelMatrix:null};class oe{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach(t=>this._renderContribitions.push(t)),this._renderContribitions.length&&(this._renderContribitions.sort((t,e)=>e.order-t.order),this._beforeRenderContribitions=this._renderContribitions.filter(t=>t.time===oF.beforeFillStroke),this._afterRenderContribitions=this._renderContribitions.filter(t=>t.time===oF.afterFillStroke))}beforeRenderStep(t,e,i,r,n,s,a,o,l,h,d,u,c){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach(p=>{p.drawShape(t,e,i,r,n,s,a,o,l,h,d,u,c)})}afterRenderStep(t,e,i,r,n,s,a,o,l,h,d,u,c){this._afterRenderContribitions&&this._afterRenderContribitions.forEach(p=>{p.drawShape(t,e,i,r,n,s,a,o,l,h,d,u,c)})}valid(t,e,i,r){var n,s,a,o;let{fill:l=e.fill,background:h,stroke:d=e.stroke,opacity:u=e.opacity,fillOpacity:c=e.fillOpacity,lineWidth:p=e.lineWidth,strokeOpacity:f=e.strokeOpacity,visible:g=e.visible}=t.attribute,m=(n=u,s=c,l&&n*s>0),v=u*f>0,b=(a=l,o=h,!(!a&&!o)),y=aj(d,p);return!(!t.valid||!g)&&!(!b&&!y)&&!!(m||v||i||r||h)&&{fVisible:m,sVisible:v,doFill:b,doStroke:y}}transform(t,e,i,r=!1){let{x:n=e.x,y:s=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:d}=t.attribute,u=i.modelMatrix,c=i.camera;ot.x=n,ot.y=s,ot.z=a,ot.lastModelMatrix=u;let p=c&&(r||function(t){let{alpha:e,beta:i}=t.attribute;return e||i}(t)),f=p?t.transMatrix.onlyTranslate()&&!d:1===o&&1===l&&0===h&&!d;if(p){let r=s1.allocate(),n=s1.allocate();ar(n,t,e),ai(r,u||r,n),ot.x=0,ot.y=0,ot.z=0,i.modelMatrix=r,i.setTransform(1,0,0,1,0,0,!0),s1.free(n)}if(f&&!u){let r=t.getOffsetXY(e);ot.x+=r.x,ot.y+=r.y,ot.z=a,i.setTransformForCurrent()}else if(p)ot.x=0,ot.y=0,ot.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(c&&i.project){let r=t.getOffsetXY(e);ot.x+=r.x,ot.y+=r.y,this.transformWithoutTranslate(i,ot.x,ot.y,ot.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),ot.x=0,ot.y=0,ot.z=0;return ot}transformUseContext2d(t,e,i,r){let n=r.camera;if(this.camera=n,n){let e=t.AABBBounds,n=e.x2-e.x1,s=e.y2-e.y1,a=r.project(0,0,i),o=r.project(n,0,i),l=r.project(n,s,i),h={x:0,y:0},d={x:n,y:0},u={x:n,y:s};r.camera=null;let c=1/(h.x*(u.y-d.y)-d.x*u.y+u.x*d.y+(d.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-d.y*l.x+u.y*o.x+(d.y-u.y)*a.x)*c,f=(d.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-d.y)*a.y)*c,g=(h.x*(l.x-o.x)-d.x*l.x+u.x*o.x+(d.x-u.x)*a.x)*c,m=-(d.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-d.x)*a.y)*c,v=(h.x*(u.y*o.x-d.y*l.x)+h.y*(d.x*l.x-u.x*o.x)+(u.x*d.y-d.x*u.y)*a.x)*c,b=(h.x*(u.y*o.y-d.y*l.y)+h.y*(d.x*l.y-u.x*o.y)+(u.x*d.y-d.x*u.y)*a.y)*c;r.setTransform(p,f,g,m,v,b,!0)}}restoreTransformUseContext2d(t,e,i,r){this.camera&&(r.camera=this.camera)}transformWithoutTranslate(t,e,i,r,n,s,a){let o=t.project(e,i,r);t.translate(o.x,o.y,!1),t.scale(n,s,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,r,n){let{context:s}=r;if(!s)return;s.highPerformanceSave();let{x:a,y:o,z:l,lastModelMatrix:h}=this.transform(t,e,s,i);this.z=l,function(t,e,i,r,n,s,a,o){var l,h,d;if(!t.pathProxy)return!1;let u=rQ(t,null==s?void 0:s.theme)[t.type],{fill:c=u.fill,stroke:p=u.stroke,opacity:f=u.opacity,fillOpacity:g=u.fillOpacity,lineWidth:m=u.lineWidth,strokeOpacity:v=u.strokeOpacity,visible:b=u.visible}=t.attribute,y=(l=f,h=g,c&&l*h>0),x=f*v>0,_=!!c,w=aj(p,m);return!b||!_&&!w||!y&&!x&&!!1||(e.beginPath(),iv(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),w&&(o?o(e,t.attribute,u):x&&(e.setStrokeStyle(t,t.attribute,i,r,u),e.stroke())),_&&(a?a(e,t.attribute,u):y&&(e.setCommonStyle(t,t.attribute,i,r,u),e.fill())),!0)}(t,s,a,o,0,n)||(this.drawShape(t,s,a,o,r,n),this.z=0,s.modelMatrix!==h&&s1.free(s.modelMatrix),s.modelMatrix=h),s.highPerformanceRestore()}}function oi(t,e,i,r){if(!e.p1)return;let{offsetX:n=0,offsetY:s=0,offsetZ:a=0}=r||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,s+e.p1.y,n+e.p2.x,s+e.p2.y,n+e.p3.x,s+e.p3.y,a):t.lineTo(n+e.p1.x,s+e.p1.y,a);else if(e.p2&&e.p3){let[r]=iS(e,i);t.bezierCurveTo(n+r.p1.x,s+r.p1.y,n+r.p2.x,s+r.p2.y,n+r.p3.x,s+r.p3.y,a)}else{let r=e.getPointAt(i);t.lineTo(n+r.x,s+r.y,a)}}function or(t,e,i,r,n){var s;let a;let{offsetX:o=0,offsetY:l=0,offsetZ:h=0,mode:d="none",drawConnect:u=!1,zeroX:c=0,zeroY:p=0}=n||{};if(u&&"none"===d||!e)return;let f=!0,{curves:g}=e;if(i>=1){if(u){let e,i=!0;g.forEach((r,n)=>{var s;let a=r.p0;if(r.originP1!==r.originP2){if(e&&e.originP1===e.originP2&&(a=e.p0),r.defined)i||(t.lineTo(a.x+o,a.y+l,h),i=!i);else{let e;let{originP1:n,originP2:d}=r;if(n&&!1!==n.defined?e=a:n&&!1!==d.defined&&(e=null!==(s=r.p3)&&void 0!==s?s:r.p1),i){i=!i;let n=e?e.x:r.p0.x,s=e?e.y:r.p0.y;t.moveTo(n+o,s+l,h)}else e&&(i=!i,t.lineTo(e.x+o,e.y+l,h))}e=r}else e=r})}else g.forEach(e=>{e.defined?(f&&t.moveTo(e.p0.x+o,e.p0.y+l,h),oi(t,e,1,n),f=!1):f=!0});return}if(i<=0)return;"x"===r?a=oN.ROW:"y"===r?a=oN.COLUMN:"auto"===r&&(a=e.direction);let m=i*e.tryUpdateLength(a),v=0,b=!0,y=null;for(let e=0,i=g.length;et.defined)&&c.attribute.curveType&&c.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(c,a,o);let{x:_=0,x:w=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(c,a,_-d,w-u,o),t.fill())),!1!==r&&(f?f(t,a,o):s&&(t.setStrokeStyle(c,a,_-d,w-u,o),t.stroke()));let{connectedType:A,connectedX:S,connectedY:E,connectedStyle:T}=a;if((0,ev.Z)(o)?(A=null!==(m=null!=A?A:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,S=null!==(v=null!=S?S:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,E=null!==(b=null!=E?E:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,T=null!==(y=null!=T?T:o[0].connectedStyle)&&void 0!==y?y:o[1].connectedStyle):(A=null!=A?A:o.connectedType,S=null!=S?S:o.connectedX,E=null!=E?E:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),or(t.camera?t:t.nativeContext,e,l,h,{offsetX:d,offsetY:u,offsetZ:x,drawConnect:!0,mode:A,zeroX:S,zeroY:E});let g=[];(0,ev.Z)(o)?o.forEach(t=>g.push(t)):g.push(o),g.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(c,T,_-d,w-u,g),t.fill())),!1!==r&&(f?f(t,a,o):s&&(t.setStrokeStyle(c,T,_-d,w-u,g),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,r,n,s,a,o,l,h,d,u,c){var p;e.beginPath();let f=null!==(p=this.z)&&void 0!==p?p:0,{points:g}=t.attribute,m=g[0];e.moveTo(m.x+a,m.y+o,f);for(let t=1;t!1===t.defined)&&"linear"===m)return this.drawLinearLineHighPerformance(t,e,!!h,!!d,u,c,i,r,l,n,s,a,o);if(t.shouldUpdateShape()){let{points:e,segments:i}=t.attribute;if(i&&i.length){let e,r;if(t.cache=i.map((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(r={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:r.endX,y:r.endY,defined:r.curves[r.curves.length-1].defined}:i>1&&(e.x=r.endX,e.y=r.endY,e.defined=r.curves[r.curves.length-1].defined);let n=iX(t.points,m,{startPoint:e});return r=n,n}).filter(t=>!!t),"linearClosed"===m){let e;for(let i=0;it.points.length);if(1===n[0].points.length&&n.shift(),1===v){let s=!1;t.cache.forEach((p,f)=>{s||(s=this.drawSegmentItem(e,p,!!h,!!d,u,c,n[f],[l,t.attribute],v,b,i,r,t,a,o))})}else{let s=v*t.cache.reduce((t,e)=>t+e.getLength(),0),p=0,f=!1;t.cache.forEach((g,m)=>{if(f)return;let v=g.getLength(),y=(s-p)/v;p+=v,y>0&&(f=this.drawSegmentItem(e,g,!!h,!!d,u,c,n[m],[l,t.attribute],(0,eJ.VV)(y,1),b,i,r,t,a,o))})}}else this.drawSegmentItem(e,t.cache,!!h,!!d,u,c,t.attribute,l,v,b,i,r,t,a,o)}};on=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],on);let os=class extends on{constructor(){super(...arguments),this.numberType=sn}drawShape(t,e,i,r,n,s,a,o){if(t.incremental&&n.multiGraphicOptions){var l,h,d;let{startAtIdx:e,length:s}=n.multiGraphicOptions,{segments:u=[]}=t.attribute;if(e>u.length)return;let c=rQ(t).line,{fill:p=c.fill,stroke:f=c.stroke,opacity:g=c.opacity,fillOpacity:m=c.fillOpacity,strokeOpacity:v=c.strokeOpacity,lineWidth:b=c.lineWidth,visible:y=c.visible}=t.attribute,x=(l=g,h=m,p&&l*h>0),_=g*v>0,w=!!p,A=aj(f,b);if(!t.valid||!y||!w&&!A||!(x||_||a||o))return;let{context:S}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+s):t.moveTo(e.x+n,e.y+s)})}(e.nativeContext,i,r,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,s),e.setStrokeStyle(t,n,a,o,s),e.stroke())}};os=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],os);function oa(t,e,i,r){if(e.length<2)return;let{offsetX:n=0,offsetY:s=0,offsetZ:a=0,mode:o}=r||{},l=e[0];t.moveTo(l.p0.x+n,l.p0.y+s,a);let h=(l=e[e.length-1]).p3||l.p1;t.lineTo(h.x+n,h.y+s,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+s,a),h=(l=i[0]).p3||l.p1,t.lineTo(h.x+n,h.y+s,a),t.closePath()}function oo(t,e,i,r){let{offsetX:n=0,offsetY:s=0,offsetZ:a=0}=r||{},o=!0;e.forEach(e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+s,a),oi(t,e,1,r),o=!1):o=!0}),o=!0;for(let e=i.length-1;e>=0;e--){let l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+s,a),oi(t,l,1,r),o=!1):o=!0}t.closePath()}class ol{constructor(){this.time=oF.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,r,n){let s=(t-2*e)/2,a=r.dpr,o=rN.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(s,l);let h=r.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),rN.free(o),h}createCirclePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,(t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,eJ.f7),e.fill()})}createDiamondPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,(e,r)=>{let n=t/2;r.fillStyle=i,r.moveTo(n,n-e),r.lineTo(e+n,n),r.lineTo(n,n+e),r.lineTo(n-e,n),r.closePath(),r.fill()})}createRectPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,(t,r)=>{r.fillStyle=i,r.fillRect(e,e,2*t,2*t)})}createVerticalLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,(r,n)=>{n.fillStyle=i,n.fillRect(e,0,2*r,t)})}createHorizontalLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,(r,n)=>{n.fillStyle=i,n.fillRect(0,e,t,2*r)})}createBiasLRLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,(e,r)=>{r.strokeStyle=i,r.lineWidth=e,r.moveTo(0,0),r.lineTo(t,t);let n=t/2,s=-n;r.moveTo(n,s),r.lineTo(n+t,s+t),r.moveTo(-n,-s),r.lineTo(-n+t,-s+t),r.stroke()})}createBiasRLLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,(e,r)=>{r.strokeStyle=i,r.lineWidth=e,r.moveTo(t,0),r.lineTo(0,t);let n=t/2;r.moveTo(t+n,n),r.lineTo(n,n+t),r.moveTo(t-n,-n),r.lineTo(-n,-n+t),r.stroke()})}createGridPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,(t,r)=>{r.fillStyle=i,r.fillRect(e,e,t,t),r.fillRect(e+t,e+t,t,t)})}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,r,n,s,a,o,l,h,d,u,c){this.textureMap||this.initTextureMap(e,t.stage);let{texture:p=l.texture,textureColor:f=l.textureColor,textureSize:g=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,r,l,f,g,m)}drawTexture(t,e,i,r,n,s,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,r,n,s),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}let oh=new ol,od=new class t extends ol{constructor(){super(...arguments),this.time=oF.afterFillStroke}drawShape(t,e,i,r,n,s,a,o,l,h,d,u,c){var p,f,g,m;this.textureMap||this.initTextureMap(e,t.stage);let{attribute:v=t.attribute}=c||{},{texture:b=null!==(p=t.attribute.texture)&&void 0!==p?p:nq(l,"texture"),textureColor:y=null!==(f=t.attribute.textureColor)&&void 0!==f?f:nq(l,"textureColor"),textureSize:x=null!==(g=t.attribute.textureSize)&&void 0!==g?g:nq(l,"textureSize"),texturePadding:_=null!==(m=t.attribute.texturePadding)&&void 0!==m?m:nq(l,"texturePadding")}=v;b&&this.drawTexture(b,t,e,i,r,l,y,x,_)}};var ou=function(t,e){return function(i,r){e(i,r,t)}};function oc(t,e,i){switch(e){case"linear":default:return iO(t,i);case"basis":return iD(t,i);case"monotoneX":return iU(t,i);case"monotoneY":return iV(t,i);case"step":return iZ(t,.5,i);case"stepBefore":return iZ(t,0,i);case"stepAfter":return iZ(t,1,i);case"linearClosed":return iY(t,i)}}let op=class extends oe{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=n9,this.builtinContributions=[od,a4],this.init(t)}drawLinearAreaHighPerformance(t,e,i,r,n,s,a,o,l,h,d,u,c){var p,f,g,m,v;let{points:b}=t.attribute;if(b.length<2)return;e.beginPath();let y=null!==(p=this.z)&&void 0!==p?p:0,x=b[0];e.moveTo(x.x+a,x.y+o,y);for(let t=1;t=0;t--){let i=b[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(g=i.y1)&&void 0!==g?g:i.y)+o,y)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,u,null,{attribute:t.attribute});let{x:_=0,x:w=0}=t.attribute;if(!1!==i&&(u?u(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,_-a,w-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,u,null,{attribute:t.attribute}),r){let{stroke:i=l&&l.stroke}=t.attribute;if((0,ev.Z)(i)&&(i[0]||i[2])&&!1===i[1]){if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,y);for(let t=1;t=0;t--){let i=b[t];e.lineTo((null!==(m=i.x1)&&void 0!==m?m:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,y)}}}c?c(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,_-a,w-o,l),e.stroke())}}drawShape(t,e,i,r,n,s,a,o){var l,h,d,u,c,p;let f=rQ(t,null==s?void 0:s.theme).area,{fill:g=f.fill,stroke:m=f.stroke,fillOpacity:v=f.fillOpacity,z:b=f.z,strokeOpacity:y=f.strokeOpacity}=t.attribute,x=this.valid(t,f,a,o);if(!x)return;let{doFill:_,doStroke:w}=x,{clipRange:A=f.clipRange,closePath:S,points:E,segments:T}=t.attribute,{curveType:C=f.curveType}=t.attribute;if(S&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!E.some(t=>!1===t.defined)&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!g,w,v,y,i,r,f,n,s,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i,r;let n=T.map((t,r)=>{if(t.points.length<=1&&0===r)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===r?e={x:i.endX,y:i.endY}:r>1&&(e.x=i.endX,e.y=i.endY);let n=oc(t.points,C,{startPoint:e});return i=n,n}).filter(t=>!!t),s=[];for(let t=T.length-1;t>=0;t--){let e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){let e=T[t-1].points,r=e[e.length-1];r&&i.push({x:null!==(d=r.x1)&&void 0!==d?d:r.x,y:null!==(u=r.y1)&&void 0!==u?u:r.y})}i.length>1&&(r=oc(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C),s.unshift(r))}t.cacheArea=s.map((t,e)=>({top:n[e],bottom:t}))}else{if(!E||!E.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{let e=[];for(let t=E.length-1;t>=0;t--)e.push({x:null!==(c=E[t].x1)&&void 0!==c?c:E[t].x,y:null!==(p=E[t].y1)&&void 0!==p?p:E[t].y});let i=oc(E,C),r=oc(e,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C);t.cacheArea={top:i,bottom:r}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){let s=t.attribute.segments.filter(t=>t.points.length);if(1===s[0].points.length&&s.shift(),1===A){let l=!1;t.cacheArea.forEach((h,d)=>{l||(l=this.drawSegmentItem(e,h,_,v,w,y,s[d],[f,t.attribute],A,i,r,b,t,n,a,o))})}else{let l=A*t.cacheArea.reduce((t,e)=>t+e.top.getLength(),0),h=0,d=!1;t.cacheArea.forEach((u,c)=>{if(d)return;let p=u.top.getLength(),g=(l-h)/p;h+=p,g>0&&(d=this.drawSegmentItem(e,u,_,v,w,y,s[c],[f,t.attribute],(0,eJ.VV)(g,1),i,r,b,t,n,a,o))})}}else this.drawSegmentItem(e,t.cacheArea,_,v,w,y,t.attribute,f,A,i,r,b,t,n,a,o)}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).area;this._draw(t,n,!1,i,r)}drawSegmentItem(t,e,i,r,n,s,a,o,l,h,d,u,c,p,f,g){let m=!1;return(m=this._drawSegmentItem(t,e,i,r,n,s,a,o,l,h,d,u,c,p,!1,f,g))||this._drawSegmentItem(t,e,i,r,n,s,a,o,l,h,d,u,c,p,!0,f,g)}_drawSegmentItem(t,e,i,r,n,s,a,o,l,h,d,u,c,p,f,g,m){var v,b,y,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:_,connectedX:w,connectedY:A,connectedStyle:S}=a,E=[];if(f&&((0,ev.Z)(o)?(_=null!==(v=null!=_?_:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,w=null!==(b=null!=w?w:o[0].connectedX)&&void 0!==b?b:o[1].connectedX,A=null!==(y=null!=A?A:o[0].connectedY)&&void 0!==y?y:o[1].connectedY,S=null!==(x=null!=S?S:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(_=null!=_?_:o.connectedType,w=null!=w?w:o.connectedX,A=null!=A?A:o.connectedY,S=null!=S?S:o.connectedStyle),"connect"!==_&&"zero"!==_&&(_="none"),(0,ev.Z)(o)?o.forEach(t=>E.push(t)):E.push(o),E.push(a)),f&&"none"===_)return!1;t.beginPath();let{points:T,segments:C}=c.attribute,k,M,B=oN.ROW;if(C){let t=C[C.length-1];M=C[0].points[0],k=t.points[t.points.length-1]}else M=T[0],k=T[T.length-1];B=(0,eJ.Wn)(k.x-M.x)>(0,eJ.Wn)(k.y-M.y)?oN.ROW:oN.COLUMN,function(t,e,i,r){var n;let{drawConnect:s=!1,mode:a="none"}=r||{};if(s&&"none"===a)return;let{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){let e=[],i=[],n=!0;if(s){let n,s,a=!0,h=o.curves.length;o.curves.forEach((o,d)=>{let u=l.curves[h-d-1],c=o,p=u;if(o.originP1===o.originP2)return n=o,void(s=u);if(n&&n.originP1===n.originP2&&(c=n,p=s),o.defined)a||(e.push(c),i.push(p),oa(t,e,i,r),e.length=0,i.length=0,a=!a);else{let n,s;let{originP1:l,originP2:h}=o;l&&!1!==l.defined?(n=c,s=p):l&&!1!==h.defined&&(n=o,s=u),a?(a=!a,e.push(n||o),i.push(s||u)):n&&(a=!a,e.push(n||o),i.push(s||u),oa(t,e,i,r),e.length=0,i.length=0)}n=o}),oa(t,e,i,r)}else{for(let s=0,a=o.curves.length;sp?oN.ROW:oN.COLUMN,Number.isFinite(c)||(h=oN.COLUMN),Number.isFinite(p)||(h=oN.ROW);let f=i*(h===oN.ROW?c:p),g=0,m=!0,v=[],b=[],y,x,_=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),ou(0,eH(eU)),ou(0,eG(a$)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],op);let of=class extends op{constructor(){super(...arguments),this.numberType=n9}drawShape(t,e,i,r,n,s,a){if(t.incremental&&n.multiGraphicOptions){var o,l,h;let{startAtIdx:s,length:d}=n.multiGraphicOptions,{segments:u=[]}=t.attribute;if(s>u.length)return;let c=rQ(t).area,{fill:p=c.fill,fillOpacity:f=c.fillOpacity,opacity:g=c.opacity,visible:m=c.visible}=t.attribute,v=(o=g,l=f,p&&o*l>0),b=!!p;if(!!t.valid&&!!m&&!!b){if(v||a)for(let n=s;n{var a,o,l,h;let d=e&&0===r?e.points[e.points.length-1]:i[0];t.moveTo(d.x+n,d.y+s),i.forEach(e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+s):t.moveTo(e.x+n,e.y+s)});for(let e=i.length-1;e>=0;e--){let r=i[e];t.lineTo(null!==(a=r.x1)&&void 0!==a?a:r.x,null!==(o=r.y1)&&void 0!==o?o:r.y)}t.lineTo(null!==(l=d.x1)&&void 0!==l?l:d.x,null!==(h=d.y1)&&void 0!==h?h:d.y),t.closePath()})}(e.camera?e:e.nativeContext,i,r,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,s),e.setCommonStyle(t,n,a,o,s),e.fill())}};of=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],of);var og,om,ov,ob,oy,ox,o_,ow,oA,oS,oE,oT,oC,ok,oM,oB,oP,oR,oO,oI,oL,oD,oN,oj,oF,oz,oH,oG,oU,oV,oW,oZ,o$,oY,oX,oK,oq=function(t,e){return function(i,r){e(i,r,t)}},oJ=function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):((e=t.value)instanceof i?e:new i(function(t){t(e)})).then(a,o)}l((r=r.apply(t,e||[])).next())})};(u=oK||(oK={}))[u.NORMAL=0]="NORMAL",u[u.STOP=1]="STOP";let oQ=class extends aI{constructor(t,e,i,r){super(t,r),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=oK.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new e$([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return oJ(this,void 0,void 0,function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);let i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;let{context:r,viewBox:n}=e;r&&(r.inuse=!0,r.clearMatrix(),r.setTransformForCurrent(!0),r.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,r,e),r.translate(n.x1,n.y1,!0),r.save(),t.renderTreeRoots.sort((t,e)=>{var i,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:i4.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:i4.zIndex)}).forEach(t=>{this.renderGroup(t,e)}),this.hooks.completeDraw.tap("top-draw",()=>{r.restore(),r.restore(),r.draw(),r.inuse=!1,this.rendering=!1}))})}_increaseRender(t,e){return oJ(this,void 0,void 0,function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)})}_renderIncrementalGroup(t,e){return oJ(this,void 0,void 0,function*(){this.count=t.count,yield new Promise(i=>{this.renderItem(t,e,{drawingCb:()=>oJ(this,void 0,void 0,function*(){if(2!==t.count)yield ax(t,i4.zIndex,(i,r)=>{if(this.status===oK.STOP)return!0;if(i.isContainer||r{this.global.getRequestAnimationFrame()(()=>{t(!1)})})})}checkForDraw(t){return oJ(this,void 0,void 0,function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e})}forceStop(){return oJ(this,void 0,void 0,function*(){this.rendering&&(this.status=oK.STOP,yield new Promise(t=>{this.hooks.completeDraw.tap("stopCb",()=>{this.status=oK.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter(t=>"stopCb"!==t.name),t(!1)})}))})}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return oJ(this,void 0,void 0,function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise(i=>{this.renderItem(t,e,{drawingCb:()=>oJ(this,void 0,void 0,function*(){yield ax(t,i4.zIndex,t=>oJ(this,void 0,void 0,function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})),i(!1)})})}))})}};oQ=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),oq(0,ab(sO)),oq(1,eH(os)),oq(2,eH(of)),oq(3,eH(eU)),oq(3,eG(a_)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Array,Object,Object,Object])],oQ);var o0=new eB(t=>{t(a3).toSelf().inSingletonScope(),t(ol).toSelf().inSingletonScope(),t(sZ).to(aI),t(sk).to(oQ),t(sI).to(a9).inSingletonScope(),t(sO).toService(sI),eW(t,aX),t(a6).toSelf().inSingletonScope(),eW(t,a2),eW(t,sO),t(aE).toSelf().inSingletonScope(),t(a_).toService(aE),eW(t,a_)});function o1(){var t;o1.__loaded||(o1.__loaded=!0,rO.load(sC),rO.load(aa),rO.load(sX),rO.load(s8),rO.load(au),(t=rO).load(ac),t.load(ap),t.load(av),function(t){t.load(o0)}(rO))}o1.__loaded=!1,o1();let o2=rO.get(eX);ru.global=o2;let o5=rO.get(s_);ru.graphicUtil=o5;let o3=rO.get(sx);ru.transformUtil=o3;let o4=rO.get(sp);ru.graphicService=o4;let o6=rO.get(sw);function o8(t,e){return ex(t).reduce((t,i)=>{let r=(0,eT.Z)(i)?e.getGrammarById(i):i;return r&&t.push(r),t},[])}ru.layerService=o6;function o7(t,e){var i,r;if((0,eC.Z)(t))return[];if(r6(i=t)||!(null==i?void 0:i.signal)){;if(!r6(r=t)&&(null==r?void 0:r.callback))return o8(t.dependency,e)}else{let i=t.signal;if((0,eT.Z)(i))return ex(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}return[]}function o9(t){return r6(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function lt(t,e,i,r){if((0,eC.Z)(t))return t;if(r6(t))return r?t.call(null,i,r,e):t.call(null,i,e);if(t.signal){let i=t.signal;return(0,eT.Z)(i)?null==e?void 0:e[i]:i.output()}return t.callback?r?t.callback.call(null,i,r,e):t.callback.call(null,i,e):t}function le(t,e){return li(t)?t.output():e[t]}let li=t=>t&&!(0,eC.Z)(t.grammarType),lr=t=>r6(t)?t:e=>e[t],ln=t=>(0,eT.Z)(t)&&n_.parseColorString(t)?t:null,ls=(t,e)=>li(t)?t.output():t&&(0,ep.Z)(t)?r6(t.callback)?i=>t.callback(i,e):r6(t.value)?t.value(e):t:t,la=(t,e)=>t?(0,ep.Z)(t)?Object.keys(t).reduce((i,r)=>{let n=t[r];return i[r]=ls(n,e),i},{}):t.map(t=>ls(t,e)):t;(c=tN||(tN={})).enter="enter",c.update="update",c.exit="exit",c.group="group",c.connectNulls="connectNulls",(p=tj||(tj={})).enter="enter",p.update="update",p.exit="exit",p.unChange="unChange",(f=tF||(tF={})).arc="arc",f.arc3d="arc3d",f.area="area",f.image="image",f.line="line",f.path="path",f.rect="rect",f.rect3d="rect3d",f.rule="rule",f.shape="shape",f.symbol="symbol",f.text="text",f.richtext="richtext",f.polygon="polygon",f.pyramid3d="pyramid3d",f.circle="circle",f.cell="cell",f.interval="interval",f.group="group",f.glyph="glyph",f.component="component",f.largeRects="largeRects",f.largeSymbols="largeSymbols",(g=tz||(tz={})).axis="axis",g.grid="grid",g.legend="legend",g.slider="slider",g.label="label",g.datazoom="datazoom",g.player="player",g.title="title",g.scrollbar="scrollbar",(m=tH||(tH={}))[m.player=1]="player",m[m.rollUp=2]="rollUp",m[m.drillDown=3]="drillDown",m[m.slider=4]="slider",m[m.datazoom=5]="datazoom",m[m.legend=6]="legend",m[m.scrollbar=7]="scrollbar",m[m.brush=8]="brush",m[m.normal=9]="normal",(v=tG||(tG={})).lineAxis="lineAxis",v.circleAxis="circleAxis",(b=tU||(tU={})).lineAxisGrid="lineAxisGrid",b.circleAxisGrid="circleAxisGrid",(y=tV||(tV={})).discreteLegend="discreteLegend",y.colorLegend="colorLegend",y.sizeLegend="sizeLegend",(x=tW||(tW={})).lineCrosshair="lineCrosshair",x.rectCrosshair="rectCrosshair",x.sectorCrosshair="sectorCrosshair",x.circleCrosshair="circleCrosshair",x.polygonCrosshair="polygonCrosshair",x.ringCrosshair="ringCrosshair",(_=tZ||(tZ={})).symbolLabel="symbolLabel",_.rectLabel="rectLabel",_.lineLabel="lineLabel",_.dataLabel="dataLabel",(w=t$||(t$={})).continuousPlayer="continuousPlayer",w.discretePlayer="discretePlayer",(A=tY||(tY={})).before="before",A.layouting="layouting",A.reevaluate="reevaluate",A.after="after",(S=tX||(tX={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",S.AFTER_EVALUATE_DATA="afterEvaluateData",S.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",S.AFTER_EVALUATE_SCALE="afterEvaluateScale",S.BEFORE_PARSE_VIEW="beforeParseView",S.AFTER_PARSE_VIEW="afterParseView",S.BEFORE_TRANSFORM="beforeTransform",S.AFTER_TRANSFORM="afterTransform",S.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",S.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",S.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",S.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",S.BEFORE_STAGE_RESIZE="beforeStageResize",S.AFTER_STAGE_RESIZE="afterStageResize",S.BEFORE_VRENDER_DRAW="beforeVRenderDraw",S.AFTER_VRENDER_DRAW="afterVRenderDraw",S.BEFORE_MARK_JOIN="beforeMarkJoin",S.AFTER_MARK_JOIN="afterMarkJoin",S.BEFORE_MARK_UPDATE="beforeMarkUpdate",S.AFTER_MARK_UPDATE="afterMarkUpdate",S.BEFORE_MARK_STATE="beforeMarkState",S.AFTER_MARK_STATE="afterMarkState",S.BEFORE_MARK_ENCODE="beforeMarkEncode",S.AFTER_MARK_ENCODE="afterMarkEncode",S.BEFORE_DO_LAYOUT="beforeDoLayout",S.AFTER_DO_LAYOUT="afterDoLayout",S.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",S.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",S.BEFORE_DO_RENDER="beforeDoRender",S.AFTER_DO_RENDER="afterDoRender",S.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",S.AFTER_MARK_RENDER_END="afterMarkRenderEnd",S.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",S.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",S.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",S.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",S.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",S.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",S.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",S.BEFORE_ELEMENT_STATE="beforeElementState",S.AFTER_ELEMENT_STATE="afterElementState",S.BEFORE_ELEMENT_ENCODE="beforeElementEncode",S.AFTER_ELEMENT_ENCODE="afterElementEncode",S.ANIMATION_START="animationStart",S.ANIMATION_END="animationEnd",S.ELEMENT_ANIMATION_START="elementAnimationStart",S.ELEMENT_ANIMATION_END="elementAnimationEnd",S.ALL_ANIMATION_START="allAnimationStart",S.ALL_ANIMATION_END="allAnimationEnd",(E=tK||(tK={})).signal="signal",E.data="data",E.scale="scale",E.coordinate="coordinate",E.mark="mark",(T=tq||(tq={})).active="active",T.selected="selected",T.highlight="highlight",T.blur="blur";let lo=-1;class ll extends ec(){constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++lo}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){let t=ex(this.spec.dependency).map(t=>(0,eT.Z)(t)?this.view.getGrammarById(t):t);this.detach(t)}this.spec.dependency=t;let i=ex(t).map(t=>(0,eT.Z)(t)?this.view.getGrammarById(t):t);return this.attach(i),this.commit(),this}addEventListener(t,e,i){let r=e;return i&&!1===i.trap||((r=e).raw=e),i&&i.target&&(r.target=i.target),this.on(t,r),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t,...e){var i,r;return null===(r=null===(i=this.view)||void 0===i?void 0:i.emit)||void 0===r||r.call(i,t,...e),super.emit(t,...e)}emitGrammarEvent(t,...e){return super.emit(t,...e)}evaluateTransform(t,e,i){if(!t||!t.length)return e;let r=e,n=0,s=t.length;for(;n!(0,eC.Z)(t)).forEach(i=>{var r;(0,eC.Z)(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(r=this.references.get(i))&&void 0!==r?r:0)+e))}),this}detach(t,e=1){return ex(t).filter(t=>!(0,eC.Z)(t)).forEach(t=>{let i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter(t=>t!==this)))}),this}detachAll(){this.references.forEach((t,e)=>{this.detach(e,t)})}link(t){this.grammarSource=t}run(){var t;let e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){let t={};return this.references.forEach((e,i)=>{ey(i.id())&&(t[i.id()]=i.output())}),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return(0,eC.Z)(this.spec[e])||this.detach(o7(this.spec[e],this.view)),this.spec[e]=t,this.attach(o7(t,this.view)),this.commit(),this}}class lh{constructor(t,e,i,r){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(r)}getMarks(){return this.marks}registerChannelEncoder(t,e){return(0,eT.Z)(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=ex(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class ld{static registerPlotMarks(t,e){ld._plotMarks[t]=e}static createPlotMark(t,e){return ld._plotMarks[t]?new ld._plotMarks[t](e):null}static registerMark(t,e){ld._marks[t]=e}static createMark(t,e,i){return ld._marks[t]?new ld._marks[t](e,t,i):null}static hasMark(t){return!!ld._marks[t]}static registerComponent(t,e){ld._components[t]=e}static createComponent(t,e,i,r){let n=ld._components[t];return n?new n(e,i,r):null}static hasComponent(t){return!!ld._components[t]}static registerGraphicComponent(t,e){ld._graphicComponents[t]=e}static createGraphicComponent(t,e,i){let r=ld._graphicComponents[t];return r?r(e,i):null}static registerTransform(t,e,i){ld._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return ld._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(ld._transforms).forEach(t=>{ld._transforms[t]&&!ld._transforms[t].isBuiltIn&&(ld._transforms[t]=null)})}static registerGrammar(t,e,i){ld._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var r;let n=null===(r=ld._grammars[t])||void 0===r?void 0:r.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return ld._glyphs[t]}static createInteraction(t,e,i){let r=ld._interactions[t];return r?new r(e,i):null}static hasInteraction(t){return!!ld._interactions[t]}}ld._plotMarks={},ld._marks={},ld._components={},ld._graphicComponents={},ld._transforms={},ld._grammars={},ld._glyphs={},ld._animations={},ld._interactions={},ld._graphics={},ld.registerGlyph=(t,e,i,r,n)=>(ld._glyphs[t]=new lh(e,i,r,n),ld._glyphs[t]),ld.registerAnimationType=(t,e)=>{ld._animations[t]=e},ld.getAnimationType=t=>ld._animations[t],ld.registerInteraction=(t,e)=>{ld._interactions[t]=e},ld.registerGraphic=(t,e)=>{ld._graphics[t]=e},ld.getGraphicType=t=>ld._graphics[t],ld.createGraphic=(t,e)=>{let i=ld._graphics[t];return i?i(e):null};let lu=(t,e,i)=>{var r,n;if("callback"===t&&r6(e))return{references:[],value:{callback:e,dependency:[]}};if(!(0,eC.Z)(e.data)){let t=i.getDataById(e.data);return{references:[t],value:t}}if(!(0,eC.Z)(e.customized)){let t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!(0,eC.Z)(e.scale)){let t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){let t=o7(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(r=null==t?void 0:t[0])&&void 0!==r?r:e}}return{value:e}},lc=(t,e,i)=>{if((0,eC.Z)(e))return{value:e};if((0,ev.Z)(e)){let r=e.map(e=>lu(t,e,i));return{references:r.reduce((t,e)=>(e.references&&t.concat(e.references),t),[]),value:r.map(t=>t.value)}}return lu(t,e,i)},lp=(t,e)=>{let i=ld.getTransform(t.type);if(!i)return;let r={},n=[];return Object.keys(t).forEach(i=>{var s;if("type"===i)return;let a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(o8(a,e))));let o=lc(i,a,e);o&&((null===(s=o.references)||void 0===s?void 0:s.length)&&(n=n.concat(o.references)),r[i]=o.value)}),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:r,references:n}},lf=(t,e)=>{if(null==t?void 0:t.length){let i=[],r=[];return t.forEach(t=>{var n;let s=lp(t,e);s&&((null===(n=s.references)||void 0===n?void 0:n.length)&&(r=r.concat(s.references)),i.push(s))}),{transforms:i,refs:r}}return null};var lg=i("833693"),lm=i("315528"),lv=i("256706");(C=tJ||(tJ={})).DSV="dsv",C.TREE="tree",C.GEO="geo",C.BYTE="bytejson",C.HEX="hex",C.GRAPH="graph",C.TABLE="table",C.GEO_GRATICULE="geo-graticule";var lb=t=>(0,r3.Z)(t,"Date");function ly(t,e,i){let r;if(!ey(t)||"object"!=typeof t||e&&e(t))return t;let n=(0,ev.Z)(t),s=t.length;r=n?Array(s):"object"==typeof t?{}:r4(t)||(0,ib.Z)(t)||(0,eT.Z)(t)?t:lb(t)?new Date(+t):void 0;let a=n?void 0:Object.keys(Object(t)),o=-1;if(r)for(;++o<(a||t).length;){let n=a?a[o]:o,s=t[n];i&&i.includes(n.toString())?r[n]=s:r[n]=ly(s,e,i)}return r}let lx={delimiter:","};var l_=t=>"object"==typeof t&&null!==t,lw=function(t){if(!l_(t)||!(0,r3.Z)(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function lA(t,e,i=!1,r=!1){if(e&&t!==e&&ey(e)&&"object"==typeof e){let n=Object(e),s=[];for(let t in n)s.push(t);let{length:a}=s,o=-1;for(;a--;){let a=s[++o];!ey(n[a])||"object"!=typeof n[a]||r&&(0,ev.Z)(t[a])?lS(t,a,n[a]):function(t,e,i,r=!1,n=!1){let s=t[i],a=e[i],o=e[i],l=!0;if((0,ev.Z)(a)){if(r)o=[];else if((0,ev.Z)(s))o=s;else if(eb(s)){o=Array(s.length);let t=-1,e=s.length;for(;++t1e8&&(lT=0),t+"_"+lT++}let lk=(t,e)=>{var i,r;if(!(null==e?void 0:e.fields)||0===t.length)return t;let n=e.fields,s=t[0],a={},o=[];for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){let l;let h=n[e];if(!h.type){let r=s;e in s||(r=null!==(i=t.find(t=>e in t))&&void 0!==i?i:s),h.type="number"==typeof r[e]?"linear":"ordinal"}if("number"==typeof h.sortIndex&&(l={key:e,type:h.type,index:h.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===h.sortReverse},o.push(l)),(null===(r=h.domain)||void 0===r?void 0:r.length)>0){if("ordinal"===h.type){h._domainCache={},a[e]=h;let t={};h.domain.forEach((e,i)=>{t[e]=i,h._domainCache[e]=i}),l&&(l.sortIndex=t,l.sortIndexCount=h.domain.length)}else h.domain.length>=2&&(a[e]=h)}}return Object.keys(a).length>0&&(t=t.filter(t=>{for(let e in a){let i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index),t.sort((t,e)=>(function(t,e,i){for(let r=0;r(this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach(e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),this.isLastTransform(e)&&this.diffLastData()}),this.isRunning=!1,!1!==t.emitMessage&&this.target.emit("change",[]),this),this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:lC("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var r;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);let n=this.cloneParseData(t,e);if(null==e?void 0:e.type){let t=(null!==(r=this.dataSet.getParser(e.type))&&void 0!==r?r:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;let e=this.transformsArr.findIndex(e=>e.type===t.type);e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){let e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort((t,e)=>{var i,r;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(r=e.level)&&void 0!==r?r:0)})}executeTransform(t,e={pushHistory:!0,emitMessage:!0}){let{pushHistory:i,emitMessage:r}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==r&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData||!this.latestData.forEach||!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;let e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach(t=>{t[lM]=e,this._diffMap.set(this._diffKeys.reduce((e,i)=>e+t[i],""),t)}),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach(i=>{i[lM]=e,t=this._diffKeys.reduce((t,e)=>t+i[e],""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)}),this._diffMap.forEach((t,i)=>{t[lM]"fields"===t.type);!(0,eC.Z)(this._fields)&&(0,eC.Z)(i)?(this.dataSet.registerTransform("fields",lk),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class lP{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new(ec()),i=(null==t?void 0:t.name)?t.name:lC("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ek.Y.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let r=this._callMap.get(i);r||(r=()=>{t.some(t=>t.isRunning)||i()}),t.forEach(t=>{t.target.addListener(e,r)}),this._callMap.set(i,r)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){let r=this._callMap.get(i);r&&t.forEach(t=>{t.target.removeListener(e,r)}),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach(t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()}),t.forEach(t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)})}multipleDataViewUpdateInRawData(t){t.forEach(t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()}),t.forEach(t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)})}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}let lR={csv:(t,e={},i)=>(i.type=tJ.DSV,(0,lm.ue)(t)),dsv:(t,e={},i)=>{i.type=tJ.DSV;let{delimiter:r}=function(t,...e){return function(t,...e){t||(t={});let i=-1,r=e.length;for(;++i(i.type=tJ.DSV,(0,lv.tJ)(t)),json:(t,e={},i)=>{if(!(0,eT.Z)(t))return ex(t);try{return ex(JSON.parse(t))}catch(t){return[]}}},lO=(t,e)=>{if(!e||!lR[e.type])return ex(t);let i="dsv"===e.type?{delimiter:e.delimiter}:{};return lR[e.type](t,i,new lB(new lP))};class lI extends ll{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{let e=function(t,e){if((0,eC.Z)(t))return t;if(r6(t))return t.call(null,e);if(t.signal){let i=t.signal;return(0,eT.Z)(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=lO(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],(0,eC.Z)(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){let e=[],i=[],r=t.format?o7(t.format,this.view)[0]:null;if(r&&e.push(r),t.values){let r=o7(t.values,this.view)[0];r&&e.push(r),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){let n=o7(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=r?r:t.format}})}else if(t.source){let r=[];ex(t.source).forEach(t=>{let i=li(t)?t:this.view.getDataById(t);i&&(e.push(i),r.push(i))}),r.length&&(i.push({type:"relay",transform:this.relay,options:r}),this.grammarSource=r[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(tX.BEFORE_EVALUATE_DATA);let i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);let r=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(r,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(tX.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e,i=!0){let r=Object.assign({},this.spec,{values:t,format:e});return(0,eC.Z)(t)||(r.url=void 0,r.source=void 0),i?this.parseLoad(r):this}url(t,e,i=!0){let r=Object.assign({},this.spec,{url:t,format:e});return(0,eC.Z)(t)||(r.values=void 0,r.source=void 0),i?this.parseLoad(r):this}source(t,e,i=!0){let r=Object.assign({},this.spec,{source:t,format:e});return(0,eC.Z)(t)||(r.values=void 0,r.url=void 0),i?this.parseLoad(r):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;let e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=ex(t).map((t,e)=>{let i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i})}field(t){return this._values.map(e=>e[t])}transform(t){let e=lf(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;let i=lf(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(ex(t)),this._postFilters.sort((t,e)=>{var i,r;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(r=e.rank)&&void 0!==r?r:0)}),this}removeDataFilter(t){let e=ex(t);return this._postFilters=this._postFilters.filter(t=>!e.includes(t)),this}_evaluateFilter(t,e){return this._postFilters.reduce((t,i)=>i.filter(t,e),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}let lL="window",lD="view",lN={trap:!1},lj="width",lF="height",lz="viewWidth",lH="viewHeight",lG="padding",lU="viewBox",lV="autoFit";function lW(t,e,i,r){let n,s;let a=t[e];for(;e>i&&(n=t[s=Math.floor((e-1)/2)],a&&n&&0>r(a,n));)t[e]=n,e=s;return t[e]=a}function lZ(t,e,i,r){let n=e,s=null!=i?i:t.length,a=t[e],o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,lW(t,e,n,r)}class l${constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){let e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){let e=this.nodes.indexOf(t);return lW(this.nodes,e,0,this.compare),lZ(this.nodes,e,null,this.compare)}return this.nodes.push(t),lW(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){let e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),lW(this.nodes,e,0,this.compare),lZ(this.nodes,e,null,this.compare)}}pop(){let t;let e=this.nodes.pop();return this.nodes.length?(t=this.nodes[0],this.nodes[0]=e,lZ(this.nodes,0,null,this.compare)):t=e,t}clear(){this.nodes=[]}}let lY=(t,e,i)=>(t.fields=e||[],t.fname=i,t);var lX=(t,e,i)=>{let r=(0,eT.Z)(e)?e.split("."):e;for(let e=0;ee=>lX(e,t),lq=t=>{ek.Y.getInstance().error(t)},lJ=t=>{let e=[],i=t.length,r,n,s,a=null,o=0,l="";t+="";let h=()=>{e.push(l+t.substring(r,n)),l="",r=n+1};for(r=0,n=0;nr&&h(),o=r=n+1):"]"===s&&(o||lq("Access path missing open bracket: "+t),o>0&&h(),o=0,r=n+1):n>r?h():r=n+1}return o&&lq("Access path missing closing bracket: "+t),a&&lq("Access path missing closing quote: "+t),n>r&&(n+=1,h()),e},lQ=(t,e,i={})=>{if(r6(t))return t;let r=lJ(t),n=1===r.length?r[0]:t;return lY((i&&i.get||lK)(r),[n],e||n)},l0=(t,e,i={})=>{if((0,ev.Z)(t)){let r=t.map(t=>lQ(t,e,i));return t=>r.map(e=>e(t))}return lQ(t,e,i)};l0("id");let l1=lY(function(t){return t},[],"identity");lY(function(){return 0},[],"zero"),lY(function(){return 1},[],"one"),lY(function(){return!0},[],"true"),lY(function(){return!1},[],"false"),lY(function(){return{}},[],"emptyObject");class l2{constructor(t){this.list=[],this.ids={},this.idFunc=t||l1}add(t){let e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){let e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter(e=>e!==t)),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class l5{constructor(){this.grammars=[],this.logger=ek.Y.getInstance(),this._curRank=0,this._committed=new l2(t=>t.uid),this._heap=new l$((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter(e=>e!==t))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){let e=[t];for(;e.length;){let i=e.pop();this._setRankOfGrammar(i);let r=i.targets;r&&r.forEach(i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")})}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){let e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce((t,e,i)=>(0,eC.Z)(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`,"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach(t=>{t.targets.some(e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank))&&this._reRank(t)}),this._committed.forEach(t=>this._enqueue(t)),this._committed=new l2(t=>t.uid)}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach(t=>this._enqueue(t))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)(t=this._heap.pop())&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}let l3=(t,e,i,r,n)=>{let s=t=>{if(n||!t||r&&!r(t)||i.call(null,t),t.markType===tF.group){let i=t[e];i&&i.forEach(t=>{s(t)})}n&&t&&(!r||r(t))&&i.call(null,t)};s(t)},l4="__vgrammar_scene_item__",l6=[tF.line,tF.area],l8=[tF.arc3d,tF.rect3d,tF.pyramid3d],l7=[{}],l9=["key"],ht="VGRAMMAR_IMMEDIATE_ANIMATION",he="quintInOut",hi={stopWhenStateChange:!1,immediatelyApply:!0};var hr=t=>void 0===t;class hn extends r7{constructor(){super(...arguments),this.client={x:0,y:0},this.movement={x:0,y:0},this.offset={x:0,y:0},this.global={x:0,y:0},this.screen={x:0,y:0}}get clientX(){return this.client.x}get clientY(){return this.client.y}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,n,s,a,o,l,h,d,u,c,p,f){throw Error("Method not implemented.")}}class hs extends hn{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw Error("getPredictedEvents is not supported!")}clone(){var t,e,i;let r=new hs(this.manager);return r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.target=null,r.nativeEvent=this.nativeEvent,r.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,r),null===(e=this.manager)||void 0===e||e.copyMouseData(this,r),null===(i=this.manager)||void 0===i||i.copyData(this,r),r.target=this.target,r.path=this.composedPath().slice(),r.type=this.type,r}}class ha extends hn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;let r=new ha(this.manager);return r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.target=null,r.nativeEvent=this.nativeEvent,r.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,r),null===(e=this.manager)||void 0===e||e.copyMouseData(this,r),null===(i=this.manager)||void 0===i||i.copyData(this,r),r.target=this.target,r.path=this.composedPath().slice(),r.type=this.type,r}}ha.DOM_DELTA_PIXEL=0,ha.DOM_DELTA_LINE=1,ha.DOM_DELTA_PAGE=2;let ho="object"==typeof performance&&performance.now?performance:Date;function hl(t){return"mouse"===t||"pen"===t}class hh{constructor(t,e){this.dispatch=new(ec()),this.cursorTarget=null,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof hs))return void ek.Y.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");let i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(hl(i.pointerType)){let t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,r;if(!(t instanceof hs))return void ek.Y.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");let n=this.createPointerEvent(t,t.type,e),s=hl(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){let e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),s&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){let e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),s&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){let e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover");let r=null==o?void 0:o.parent;for(;r&&r!==this.rootTarget.parent&&r!==n.target;)r=r.parent;if(!r||r===this.rootTarget.parent){let t=this.clonePointerEvent(n,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),s&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),s&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(r=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===r?void 0:r.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,r;if(!(t instanceof hs))return void ek.Y.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");let n=this.trackingData(t.pointerId),s=this.createPointerEvent(t,t.type,e),a=hl(s.pointerType);this.dispatchEvent(s,"pointerover"),a&&this.dispatchEvent(s,"mouseover"),"mouse"===s.pointerType&&(this.cursorTarget=s.target,this.cursor=(null===(r=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===r?void 0:r.cursor)||this.rootTarget.getCursor());let o=this.clonePointerEvent(s,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof hs))return void ek.Y.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");let i=this.trackingData(t.pointerId);if(i.overTargets){let e=hl(t.pointerType),r=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",r||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(t,"pointerleave",r||void 0);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),e&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(s)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof hs))return void ek.Y.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");let r=ho.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(hl(n.pointerType)){let t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),a=this.findMountedTarget(s.pressTargetsByButton[t.button]),o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(hl(n.pointerType)){let t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],o=e}if(o){let e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:r});let a=s.clicksByButton[t.button];a.target===e.target&&r-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=r,e.detail=a.clickCount,hl(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof hs))return void ek.Y.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");let i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(r){let e=r;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):hl(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof ha))return void ek.Y.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");let i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((t,e)=>t.priority-e.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,r,n,s,a,o;let l;if(!this.rootTarget)return;let h=this.mappingTable[t.type],d=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[d])&&(null===(r=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[d])||void 0===r?void 0:r.stage)&&(null===(s=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[d])||void 0===s?void 0:s.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?l=this._prePointTargetCache[d]:(l=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[d]:l,stageRenderCount:null!==(o=null==l?void 0:l.stage.renderCount)&&void 0!==o?o:-1})),h)for(let e=0,i=h.length;e=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){let e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;let i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y}))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ho.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);let i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw Error("It is illegal to free an event not managed by this EventManager!");let i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){let i=t.currentTarget._events[e];if(i){if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let r=0,n=i.length;r{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;let e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(!t.cancelable&&"cancelable"in t||t.preventDefault());for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType||this.isEventOutsideOfTargetElement(t))return;let e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;let e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,r=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;let e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{let e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};let{targetElement:e,resolution:i,rootNode:r,global:n,autoPreventDefault:s=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new hh(r,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=s,this.eventsAdded=!1,this.rootPointerEvent=new hs,this.rootWheelEvent=new ha,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");let{applyStyles:i,domElement:r}=this;if(this.currentCursor===t)return;this.currentCursor=t;let n=this.cursorStyles[t];n?"string"==typeof n&&i?r.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(r.style,n):i&&(0,eT.Z)(t)&&!r1(this.cursorStyles,t)&&(r.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;let{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;let{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e;let i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;let{clientX:r,clientY:n}=t,s=this.domElement.getBoundingClientRect();return{x:r-s.left,y:n-s.top}}normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,r=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class hc{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=eM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,ru.graphicService.hooks.onAttributeUpdate.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}),ru.graphicService.hooks.onSetStage.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})}deactivate(t){ru.graphicService.hooks.onAttributeUpdate.taps=ru.graphicService.hooks.onAttributeUpdate.taps.filter(t=>t.name!==this.key),ru.graphicService.hooks.onSetStage.taps=ru.graphicService.hooks.onSetStage.taps.filter(t=>t.name!==this.key)}}class hp{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=eM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;let r=this.pluginService.stage;if(this.option3d||(this.option3d=r.option3d),this.option3d&&this.mousedown){if(this.pageX&&this.pageY){let n=t.page.x-this.pageX,s=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+n/100,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+s/100,r.set3dOptions(this.option3d),r.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}}activate(t){this.pluginService=t;let e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){let e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class hf{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=eM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,ru.graphicService.hooks.onAddIncremental.tap(this.key,(e,i,r)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))}),ru.graphicService.hooks.onClearIncremental.tap(this.key,(e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})}deactivate(t){ru.graphicService.hooks.onAddIncremental.taps=ru.graphicService.hooks.onAddIncremental.taps.filter(t=>t.name!==this.key),ru.graphicService.hooks.onClearIncremental.taps=ru.graphicService.hooks.onClearIncremental.taps.filter(t=>t.name!==this.key)}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,ru.global.getRequestAnimationFrame()(()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1}))}_doRenderInThisFrame(){let t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach(e=>{let i=e.layer;if(!i||!e.layer.subLayers)return;let r=e.layer.subLayers.get(e._uid);r&&r.drawContribution&&r.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:r.layer.getNativeHandler().getContext()},this.nextUserParams))}),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class hg{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=eM.GenAutoIncrementId(),this.key=this.name+this._uid,this.lastDomContainerSet=new Set,this.currentDomContainerSet=new Set}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}),ru.graphicService.hooks.onRemove.tap(this.key,t=>{this.removeDom(t)}),ru.graphicService.hooks.onRelease.tap(this.key,t=>{this.removeDom(t)})}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter(t=>t.name!==this.key),ru.graphicService.hooks.onRemove.unTap(this.key),ru.graphicService.hooks.onRelease.unTap(this.key),this.release()}drawHTML(t){"browser"===ru.global.env&&(t.renderTreeRoots.sort((t,e)=>{var i,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:i4.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:i4.zIndex)}).forEach(t=>{this.renderGroupHTML(t)}),this.lastDomContainerSet.forEach(t=>{this.currentDomContainerSet.has(t)||t.parentElement&&t.parentElement.removeChild(t)}),this.lastDomContainerSet=new Set(this.currentDomContainerSet),this.currentDomContainerSet.clear())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren(t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)})}removeDom(t){t.bindDom&&t.bindDom.size&&(t.bindDom.forEach(t=>{t.dom&&t.dom.parentElement.removeChild(t.dom)}),t.bindDom.clear())}renderGraphicHTML(t){let e,i;let{html:r}=t.attribute;if(!r)return void(t.bindDom&&t.bindDom.size&&(t.bindDom.forEach(t=>{t.dom&&t.dom.parentElement.removeChild(t.dom)}),t.bindDom.clear()));let n=t.stage;if(!n)return;let{dom:s,container:a,width:o,height:l,style:h,anchorType:d="boundsLeftTop",pointerEvents:u}=r;t.bindDom||(t.bindDom=new Map);let c=t.bindDom.get(s);if(!c||a&&a!==c.container){let r;t.bindDom.forEach(({wrapGroup:t})=>{ru.global.removeDom(t)}),"string"==typeof s?(r=(new DOMParser).parseFromString(s,"text/html").firstChild).lastChild&&(r=r.lastChild.firstChild):r=s;let d=a||(!0===n.params.enableHtmlAttribute?null:n.params.enableHtmlAttribute);i=d?"string"==typeof d?ru.global.getElementById(d):d:t.stage.window.getContainer(),(e=ru.global.createDom({tagName:"div",width:o,height:l,style:h,parent:i}))&&(e.appendChild(r),t.bindDom.set(s,{dom:r,container:a,wrapGroup:e}))}else i=(e=c.wrapGroup).parentNode;e.style.pointerEvents=u||"none",e.style.position||(e.style.position="absolute",i.style.position="relative");let p=0,f=0,g=t.globalAABBBounds;if("position"===d||g.empty()){let e=t.globalTransMatrix;p=e.e,f=e.f}else p=g.x1,f=g.y1;let m=ru.global.getElementTopLeft(i,!1),v=n.window.getTopLeft(!1),b=p+v.left-m.left,y=f+v.top-m.top;e.style.left=`${b}px`,e.style.top=`${y}px`,this.currentDomContainerSet.add(e)}release(){"browser"===ru.global.env&&(this.removeAllDom(this.pluginService.stage.defaultLayer),this.lastDomContainerSet.clear(),this.currentDomContainerSet.clear())}removeAllDom(t){this.removeDom(t),t.forEachChildren(e=>{e.isContainer&&this.removeAllDom(t)})}}let hm=new il;class hv{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=eM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}),ru.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,(t,e,i,r)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(hm.setValue(r.x1,r.y1,r.x2,r.y2),e.dirty(hm,t.parent&&t.parent.globalTransMatrix)))}),ru.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,(t,e,i,r,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(r.globalAABBBounds))}),ru.graphicService.hooks.onRemove.tap(this.key,t=>{let e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)})}deactivate(t){ru.graphicService.hooks.beforeUpdateAABBBounds.taps=ru.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(t=>t.name!==this.key),ru.graphicService.hooks.afterUpdateAABBBounds.taps=ru.graphicService.hooks.afterUpdateAABBBounds.taps.filter(t=>t.name!==this.key),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter(t=>t.name!==this.key),ru.graphicService.hooks.onRemove.taps=ru.graphicService.hooks.onRemove.taps.filter(t=>t.name!==this.key)}}let hb=new il;class hy{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=eM.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new il}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;let i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;let r=rQ(i).group,{display:n=r.display}=i.attribute;if("flex"!==n)return;let{flexDirection:s=r.flexDirection,flexWrap:a=r.flexWrap,alignItems:o=r.alignItems,clip:l=r.clip}=i.attribute,{alignContent:h=null!=o?o:r.alignContent}=i.attribute,{width:d,height:u,justifyContent:c=r.justifyContent}=i.attribute,p=i.getChildren();if(null==d||null==u){let t=0,e=0,i=0;if(p.forEach(r=>{let n=this.getAABBBounds(r);n.empty()||("column"===s||"column-reverse"===s?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)}),!isFinite(i))return;d=t,u=e}i.attribute.width=d,i.attribute.height=u,this.tempBounds.copy(i._AABBBounds);let f={main:{len:d,field:"x"},cross:{len:u,field:"y"}},g=f.main,m=f.cross;"column"!==s&&"column-reverse"!==s||(g.len=u,m.len=d,g.field="y",m.field="x"),"row-reverse"!==s&&"column-reverse"!==s||("flex-start"===c?c="flex-end":"flex-end"===c?c="flex-start":p.reverse());let v=0,b=0,y=[];p.forEach(t=>{let e=this.getAABBBounds(t);if(e.empty())return;let i="x"===g.field?e.width():e.height(),r="x"===m.field?e.width():e.height();y.push({mainLen:i,crossLen:r}),v+=i,b=Math.max(b,r)});let x=[];if(v>g.len&&"wrap"===a){let t=0,e=0;y.forEach(({mainLen:i,crossLen:r},n)=>{t+i>g.len?0===t?(x.push({idx:n,mainLen:t+i,crossLen:r}),t=0,e=0):(x.push({idx:n-1,mainLen:t,crossLen:r}),t=i,e=r):(t+=i,e=Math.max(e,r))}),x.push({idx:y.length-1,mainLen:t,crossLen:e})}else x.push({idx:y.length-1,mainLen:v,crossLen:b});let _=0;if(x.forEach(t=>{this.layoutMain(i,p,c,g,y,_,t),_=t.idx+1}),b=x.reduce((t,e)=>t+e.crossLen,0),1===x.length){let t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,y,x[0],0)}else if("flex-start"===h){_=0;let t=0;x.forEach((e,i)=>{let r={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,r,y,x[i],_),_=e.idx+1,t+=e.crossLen})}else if("center"===h){_=0;let t=Math.max(0,(m.len-b)/2);x.forEach((e,i)=>{let r={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,r,y,x[i],_),_=e.idx+1,t+=e.crossLen})}else if("space-around"===h){_=0;let t=Math.max(0,(m.len-b)/x.length/2),e=t;x.forEach((i,r)=>{let n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,y,x[r],_),_=i.idx+1,e+=i.crossLen+2*t})}else if("space-between"===h){_=0;let t=Math.max(0,(m.len-b)/(2*x.length-2)),e=0;x.forEach((i,r)=>{let n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,y,x[r],_),_=i.idx+1,e+=i.crossLen+2*t})}p.forEach((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()}),i.addUpdateLayoutTag();let w=this.getAABBBounds(i);l||this.tempBounds.equals(w)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;let e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,r,n,s,a){if("flex-start"===i){let t=0;for(let i=s;i<=a.idx;i++){let s=t+function(t,e){return 0}(e[i],r.field),a=this.getAABBBounds(e[i]);a.empty()||(e[i].attribute[r.field]=this.updateChildPos(s,e[i].attribute[r.field],a[`${r.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=r.len;for(let i=s;i<=a.idx;i++){let s=(t-=n[i].mainLen)+function(t,e){return 0}(e[i],r.field),a=this.getAABBBounds(e[i]);a.empty()||(e[i].attribute[r.field]=this.updateChildPos(s,e[i].attribute[r.field],a[`${r.field}1`]))}}else if("space-around"===i){if(a.mainLen>=r.len){let t=0;for(let i=s;i<=a.idx;i++){let s=t+function(t,e){return 0}(e[i],r.field),a=this.getAABBBounds(e[i]);a.empty()||(e[i].attribute[r.field]=this.updateChildPos(s,e[i].attribute[r.field],a[`${r.field}1`])),t+=n[i].mainLen}}else{let t=a.idx-s+1,i=(r.len-a.mainLen)/t/2,o=i;for(let t=s;t<=a.idx;t++){let s=o+function(t,e){return 0}(e[t],r.field),a=this.getAABBBounds(e[t]);a.empty()||(e[t].attribute[r.field]=this.updateChildPos(s,e[t].attribute[r.field],a[`${r.field}1`])),o+=n[t].mainLen+2*i}}}else if("space-between"===i){if(a.mainLen>=r.len){let t=0;for(let i=s;i<=a.idx;i++){let s=t+function(t,e){return 0}(e[i],r.field),a=this.getAABBBounds(e[i]);a.empty()||(e[i].attribute[r.field]=this.updateChildPos(s,e[i].attribute[r.field],a[`${r.field}1`])),t+=n[i].mainLen}}else{let t=a.idx-s+1,i=(r.len-a.mainLen)/(2*t-2),o=0;for(let t=s;t<=a.idx;t++){let s=o+function(t,e){return 0}(e[t],r.field),a=this.getAABBBounds(e[t]);a.empty()||(e[t].attribute[r.field]=this.updateChildPos(s,e[t].attribute[r.field],a[`${r.field}1`])),o+=n[t].mainLen+2*i}}}else if("center"===i){let t=(r.len-a.mainLen)/2;for(let i=s;i<=a.idx;i++){let s=t+function(t,e){return 0}(e[i],r.field),a=this.getAABBBounds(e[i]);a.empty()||(e[i].attribute[r.field]=this.updateChildPos(s,e[i].attribute[r.field],a[`${r.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,r,n,s,a){var o;for(let l=a;l<=s.idx;l++){let s=t[l],{alignSelf:a}=s.attribute;a&&"auto"!==a||(a=e);let h=this.getAABBBounds(s),d=null!==(o=r[a])&&void 0!==o?o:r["flex-start"];"flex-end"===a?h.empty()||(s.attribute[i.field]=this.updateChildPos(d-n[l].crossLen+function(t,e){return 0}(s,i.field),s.attribute[i.field],h[`${i.field}1`])):"center"===a?h.empty()||(s.attribute[i.field]=this.updateChildPos(d-n[l].crossLen/2+function(t,e){return 0}(s,i.field),s.attribute[i.field],h[`${i.field}1`])):h.empty()||(s.attribute[i.field]=this.updateChildPos(d+function(t,e){return 0}(s,i.field),s.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,ru.graphicService.hooks.onAttributeUpdate.tap(this.key,t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)}),ru.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,(t,e,i,r)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&hb.copy(r)}),ru.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,(t,e,i,r,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(hb.equals(i)||this.tryLayout(t,!1))}),ru.graphicService.hooks.onSetStage.tap(this.key,t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)})}deactivate(t){ru.graphicService.hooks.onAttributeUpdate.taps=ru.graphicService.hooks.onAttributeUpdate.taps.filter(t=>t.name!==this.key),ru.graphicService.hooks.beforeUpdateAABBBounds.taps=ru.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(t=>t.name!==this.key),ru.graphicService.hooks.afterUpdateAABBBounds.taps=ru.graphicService.hooks.afterUpdateAABBBounds.taps.filter(t=>t.name!==this.key),ru.graphicService.hooks.onSetStage.taps=ru.graphicService.hooks.onSetStage.taps.filter(t=>t.name!==this.key)}}function hx(t,e){return 0}class h_{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return h_.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class hw{static Avaliable(){return!0}avaliable(){return hw.Avaliable()}tick(t,e){this.timerId=setTimeout(()=>{e(this)},t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class hA{static Avaliable(){return!!ru.global.getRequestAnimationFrame()}avaliable(){return hA.Avaliable()}tick(t,e){ru.global.getRequestAnimationFrame()(()=>{this.released||e(this)})}release(){this.released=!0}getTime(){return Date.now()}}(k=tQ||(tQ={}))[k.INITIAL=0]="INITIAL",k[k.RUNNING=1]="RUNNING",k[k.PAUSE=2]="PAUSE";let hS=new class t{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(t=[]){this.handleTick=(t,e)=>{let{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{let e=this.tickerHandler.getTime(),i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===tQ.RUNNING&&(this.tickCounts++,this.timelines.forEach(t=>{t.tick(i)}))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=tQ.INITIAL,ru.global.hooks.onSetEnv.tap("default-ticker",()=>{this.initHandler()}),ru.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter(e=>e!==t)}initHandler(){if(this._mode)return null;let t=[{mode:"raf",cons:hA},{mode:"timeout",cons:hw},{mode:"manual",cons:h_}];for(let e=0;e{this.handleTick(t,{once:!0})})}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,t=>{this.handleTick(t,{once:!0})})}pause(){return this.status!==tQ.INITIAL&&(this.status=tQ.PAUSE,!0)}resume(){return this.status!==tQ.INITIAL&&(this.status=tQ.RUNNING,!0)}ifCanStop(){return!!this.autoStop&&(!this.timelines.length||0===this.timelines.reduce((t,e)=>t+e.animateCount,0))||!1}start(t=!1){return this.status!==tQ.RUNNING&&!!this.tickerHandler&&(!!t||this.status!==tQ.PAUSE&&!!this.timelines.length&&0!==this.timelines.reduce((t,e)=>t+e.animateCount,0))&&(this.status=tQ.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0)}stop(){this.status=tQ.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};hS.addTimeline(ni),hS.setFPS(60);class hE{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=nA.Get(e,oH.Color1),this.ambient=i;let r=(0,eJ._b)(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/r,t[1]/r,t[2]/r]}computeColor(t,e){let i;let r=this.formatedDir,n=(0,eJ.VV)((0,eJ.Fp)((t[0]*r[0]+t[1]*r[1]+t[2]*r[2])*(1-this.ambient/2),0)+this.ambient,1);i=(0,eT.Z)(e)?nA.Get(e,oH.Color1):e;let s=this.colorRgb;return`rgb(${s[0]*i[0]*n}, ${s[1]*i[1]*n}, ${s[2]*i[2]*n})`}}function hT(t,e,i){let r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=e[6],d=e[7],u=e[8],c=e[9],p=e[10],f=e[11],g=e[12],m=e[13],v=e[14],b=e[15],y=i[0],x=i[1],_=i[2],w=i[3];return t[0]=y*r+x*o+_*u+w*g,t[1]=y*n+x*l+_*c+w*m,t[2]=y*s+x*h+_*p+w*v,t[3]=y*a+x*d+_*f+w*b,y=i[4],x=i[5],_=i[6],w=i[7],t[4]=y*r+x*o+_*u+w*g,t[5]=y*n+x*l+_*c+w*m,t[6]=y*s+x*h+_*p+w*v,t[7]=y*a+x*d+_*f+w*b,y=i[8],x=i[9],_=i[10],w=i[11],t[8]=y*r+x*o+_*u+w*g,t[9]=y*n+x*l+_*c+w*m,t[10]=y*s+x*h+_*p+w*v,t[11]=y*a+x*d+_*f+w*b,y=i[12],x=i[13],_=i[14],w=i[15],t[12]=y*r+x*o+_*u+w*g,t[13]=y*n+x*l+_*c+w*m,t[14]=y*s+x*h+_*p+w*v,t[15]=y*a+x*d+_*f+w*b,t}function hC(t,e,i){let r=e[0],n=e[1],s=e[2],a=i[3]*r+i[7]*n+i[11]*s+i[15];return a=a||1,t[0]=(i[0]*r+i[4]*n+i[8]*s+i[12])/a,t[1]=(i[1]*r+i[5]*n+i[9]*s+i[13])/a,t[2]=(i[2]*r+i[6]*n+i[10]*s+i[14])/a,t}class hk{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=s1.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=s1.allocate());let{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,r){let n,s,a,o,l,h,d,u,c,p;let f=e[0],g=e[1],m=e[2],v=r[0],b=r[1],y=r[2],x=i[0],_=i[1],w=i[2];Math.abs(f-x){t.root&&t.root.unmount()}),t.bindDom.clear())}renderGraphicHTML(t){let e,i;let{react:r}=t.attribute;if(!r)return void(t.bindDom&&t.bindDom.size&&(t.bindDom.forEach(t=>{t.root&&t.root.unmount()}),t.bindDom.clear()));let n=t.stage;if(!n)return;let s=n.params.ReactDOM,{element:a,container:o,width:l,height:h,style:d,anchorType:u="boundsLeftTop",pointerEvents:c}=r;if(!(a&&s&&s.createRoot))return;t.bindDom||(t.bindDom=new Map);let p=t.bindDom.get(a);if(!p||o&&o!==p.container){t.bindDom.forEach(({wrapGroup:t})=>{ru.global.removeDom(t)});if(i=o?"string"==typeof o?ru.global.getElementById(o):o:t.stage.window.getContainer(),e=ru.global.createDom({tagName:"div",width:l,height:h,style:d,parent:i})){let i=s.createRoot(e);i.render(a),t.bindDom.set(a,{dom:a,container:o,wrapGroup:e,root:i})}}else i=(e=p.wrapGroup).parentNode;e.style.pointerEvents=c||"none",e.style.position||(e.style.position="absolute",i.style.position="relative");let f=0,g=0,m=t.globalAABBBounds;if("position"===u||m.empty()){let e=t.globalTransMatrix;f=e.e,g=e.f}else f=m.x1,g=m.y1;let v=ru.global.getElementTopLeft(i,!1),b=n.window.getTopLeft(!1),y=f+b.left-v.left,x=g+b.top-v.top;e.style.left=`${y}px`,e.style.top=`${x}px`}}let hR={BACKGROUND:"white"};class hO extends sv{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){let e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){let e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:hR.BACKGROUND}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(t={}){var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0)){if(t){if(this.dirtyBounds){let t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1}},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach(e=>e(t)),this._afterNextRenderCbs=null},this.params=t,this.theme=new rq,this.hooks={beforeRender:new e$(["stage"]),afterRender:new e$(["stage"])},this.global=ru.global,!this.global.env&&hB()&&this.global.setEnv("browser"),this.window=rO.get(rj),this.renderService=rO.get(s$),this.pluginService=rO.get(al),this.layerService=rO.get(sw),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:hR.BACKGROUND,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||hS,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new ne,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&(0,eT.Z)(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new hu(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-Infinity:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){let{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:r=0,beta:n=0,camera:s,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:r,beta:n,camera:s,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,r,n,s,a;this.option3d=t;let{light:o,center:l,camera:h,alpha:d,beta:u,fieldRatio:c,fieldDepth:p}=this.get3dOptions(t),{dir:f=[1,1,-1],color:g="white",ambient:m}=o,v=(null!==(e=l.x)&&void 0!==e?e:this.width/2)+(null!==(i=l.dx)&&void 0!==i?i:0),b=(null!==(r=l.y)&&void 0!==r?r:this.height/2)+(null!==(n=l.dy)&&void 0!==n?n:0),y=[v,b,(null!==(s=l.z)&&void 0!==s?s:0)+(null!==(a=l.dz)&&void 0!==a?a:0)],x=0,_=0,w=0;h||(x=Math.sin(d)+v,_=Math.sin(u)+b,w=Math.cos(d)*Math.cos(u)*1),this.light=new hE(f,g,m);let A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:c,fieldDepth:p,viewParams:{pos:[x,_,w],center:y,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new hk(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new hp))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hc))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new hf))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new io;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new hv,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new hy))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new hg))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new hP))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach(t=>{this.pluginService.unRegister(t)}))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){let t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw Error("暂不支持")}createLayer(t,e){let i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){let e=this.children;e.sort(t),this.removeAllChild(),e.forEach(t=>{this.appendChild(t)})}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){this.ticker.start(),this.timeline.resume();let i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach(t=>{this.nextFrameRenderLayerSet.add(t)}),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()(()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1}))}_doRenderInThisFrame(){this.timeline.resume(),this.ticker.start();let t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){let i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren(i=>{i.resize(t,e)}),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e,i=!0){this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren(i=>{i.resizeView(t,e)}),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,r,n){let s=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(s=!1)):(this.viewBox.setValue(t,e,t+i,e+r),!1===n&&(s=!1)),this.forEachChildren(t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())}),s&&this.render()}setDpr(t,e=!0){this.forEachChildren(e=>{e.setDpr(t)}),e&&this.render()}setOrigin(t,e){throw Error("暂不支持")}export(t){throw Error("暂不支持")}pick(t,e){this.pickerService||(this.pickerService=rO.get(sK));let i=this.pickerService.pick(this.children,new iy(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw Error("暂不支持")}setToFrame(t){throw Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach(t=>{t.release()}),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter(e=>e.name===t)[0]}renderTo(t){this.forEachChildren((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})})}renderToNewWindow(t=!0,e){let i=rO.get(rj),r=e?-e.x1:0,n=e?-e.y1:0,s=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:r,y1:n,x2:s,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){let i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}}class hI{constructor(t){this.onPointerDown=t=>{let e=t.target,i=this.rootNode,r=e===i;if(e&&!r){let s,a=!1;function n(t){if(a||(t.type="dragstart",null==e||e.dispatchEvent(t),a=!0),t.type="drag",null==e||e.dispatchEvent(t),!r){e.pickable=!1;let r=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==r&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),r&&(t.type="dragenter",t.target=r,r.dispatchEvent(t)),(s=r)&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",n);let o=function(){a&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),a=!1),null==i||i.removeEventListener("pointermove",n)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}let hL=(t,e)=>{let i=e.x-t.x,r=e.y-t.y;return Math.abs(i)>Math.abs(r)?i>0?"right":"left":r>0?"down":"up"},hD=(t,e)=>{let i=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y);return Math.sqrt(i*i+r*r)},hN=t=>{let e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,r=0,n=0;for(;n{this.reset(),this.startTime=ho.now();let{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"},this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();let{startPoints:e,cachedEvents:i}=this;if(!e.length)return;let r=t.clone(),{x:n,y:s,pointerId:a}=r;for(let t=0,e=i.length;t({x:t.x,y:t.y})),h=ho.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){let t=e[0],i=n-t.x,a=s-t.y,h=this.direction||hL(t,o);this.direction=h;let d=this.getEventType(o);return r.direction=h,r.deltaX=i,r.deltaY=a,r.points=l,this.triggerStartEvent(d,r),void this.triggerEvent(d,r)}let{startDistance:d}=this,u=hD(l[0],l[1]);r.scale=u/d,r.center=this.center,r.points=l,this.triggerStartEvent("pinch",r),this.triggerEvent("pinch",r)},this.onEnd=t=>{let e=t.clone(),{cachedEvents:i,startPoints:r}=this,n=i.map(t=>({x:t.x,y:t.y}));if(e.points=n,this.triggerEndEvent(e),1===i.length){let i=ho.now(),n=this.lastMoveTime;if(i-n<100){let t=n-(this.prevMoveTime||this.startTime);if(t>0){let i=this.prevMovePoint||r[0],n=this.lastMovePoint||r[0],s=hD(i,n),a=s/t;a>this.config.swipe.velocity&&s>this.config.swipe.threshold&&(e.velocity=a,e.direction=hL(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(r=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==r?r:251,threshold:null!==(s=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==s?s:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(u=null===(d=null==e?void 0:e.tap)||void 0===d?void 0:d.interval)&&void 0!==u?u:300}},this.initEvents()}initEvents(){let{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){let{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){let e;let{eventType:i,startTime:r,startPoints:n}=this;return i?i:(e=ho.now()-r>this.config.press.time&&hD(n[0],t){for(let t=0,e=r.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]})}emitEvent(t,e){let i=this.element._events["*"];if(i){if("fn"in i)i.fn.call(i.context,e,t);else for(let r=0,n=i.length;r{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(tX.AFTER_VRENDER_DRAW),this._view.emit(tX.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,r){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=r,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&(function(t){var e,i,r,n;return e=this,i=void 0,r=void 0,n=function*(){let e=[],i=t.getChildren();yield new Promise(t=>{ru.global.getRequestAnimationFrame()(()=>{t(null)})}),i.forEach(t=>{t.subLayers.size&&t.subLayers.forEach(t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise(e=>{t.drawContribution.hooks.completeDraw.tap("outWait",()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter(t=>"outWait"!==t.name),e(null)})}))})}),yield Promise.all(e)},new(r||(r=Promise))(function(t,s){function a(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(e){var i;e.done?t(e.value):((i=e.value)instanceof r?i:new r(function(t){t(i)})).then(a,o)}l((n=n.apply(e,i||[])).next())})})(this._stage).then(()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,r;return null===(r=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===r||r.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(tX.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(tX.AFTER_STAGE_RESIZE),this}setViewBox(t,e=!0){return this._stage&&(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e))),this}render(t=!1){return this._view.emit(tX.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(tX.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree(t=>{t.release()}),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,r,n;this._view.emit(tX.BEFORE_CREATE_VRENDER_STAGE);let s=this._viewOptions,a=null!==(t=s.stage)&&void 0!==t?t:new hO({width:this._width,height:this._height,renderStyle:s.renderStyle,viewBox:s.viewBox,dpr:s.dpr,canvas:s.renderCanvas,canvasControled:s.canvasControled,container:s.container,title:s.rendererTitle,beforeRender:s.beforeRender,afterRender:s.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:s.pluginList,enableHtmlAttribute:s.enableHtmlAttribute,optimize:s.optimize,ticker:s.ticker,supportsTouchEvents:s.supportsTouchEvents,supportsPointerEvents:s.supportsPointerEvents});(null===(e=s.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(s.options3d),a.enableIncrementalAutoRender(),this._viewBox=s.viewBox,this._view.emit(tX.AFTER_CREATE_VRENDER_STAGE),this._view.emit(tX.BEFORE_CREATE_VRENDER_LAYER);let o=null!==(i=s.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(tX.AFTER_CREATE_VRENDER_LAYER),(null===(r=this._eventConfig)||void 0===r?void 0:r.drag)&&(this._dragController=new hI(a)),null===(n=this._eventConfig)||void 0===n?void 0:n.gesture){let t=(0,ep.Z)(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new hj(a,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){let{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;let i=this._view.background();this.background(i)}}}function hz(t){return(0,eC.Z)(t.offsetX)?(0,eC.Z)(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function hH(t,e,i=!0){return(0,ef.Z)(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),(0,ef.Z)(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&(0,ef.Z)(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&(0,ef.Z)(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function hG(t,e,i,r,n){return n===lL&&!function(t){["touches","changedTouches","targetTouches"].forEach(e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach(t=>{hH(t,hz(t),!1)})});let e=hz(t);hH(t,e)}(e.changedTouches?e.changedTouches[0]:e),e.element=i,e}class hU extends ll{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?lt(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if((0,ev.Z)(t)&&(0,ev.Z)(this.value)&&t.length===this.value.length){for(let e=0;e{var r,n,s,a,o;return[{id:lj,value:null!==(r=t[lj])&&void 0!==r?r:0},{id:lF,value:null!==(n=t[lF])&&void 0!==n?n:0},{id:lG,value:h$(null!==(a=null!==(s=t[lG])&&void 0!==s?s:e[lG])&&void 0!==a?a:null==i?void 0:i.padding)},{id:lz,update:{callback:(t,e)=>{let i=h$(e[lG]);return e[lj]-i.left-i.right},dependency:[lj,lG]}},{id:lH,update:{callback:(t,e)=>{let i=h$(e[lG]);return e[lF]-i.top-i.bottom},dependency:[lF,lG]}},{id:lU,update:{callback:(t,e)=>{let i=h$(e[lG]);return(t||new io).setValue(i.left,i.top,i.left+e[lz],i.top+e[lH])},dependency:[lz,lH,lG]}},{id:lV,value:null!==(o=t[lV])&&void 0!==o?o:e[lV]}]},h$=t=>{var e,i,r,n;return(0,ib.Z)(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(r=null==t?void 0:t.left)&&void 0!==r?r:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},hY=t=>{var e;let i=(t,e)=>{var r,n;t.group=e;let s=null!==(r=t.id)&&void 0!==r?r:"VGRAMMAR_MARK_"+ ++hV;t.id=s,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach(t=>i(t,s))};return(null!==(e=t.marks)&&void 0!==e?e:[]).forEach(t=>i(t,"root")),t},hX=t=>{var e,i,r,n,s;let{reuse:a=!0,morph:o=!0,morphAll:l=!1,animation:h={},enableExitAnimation:d=!0}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:he,delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(r=h.duration)&&void 0!==r?r:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(s=h.splitPath)&&void 0!==s?s:null},enableExitAnimation:d}};var hK=function(t,e,i){let r=!0,n=!0;if("function"!=typeof t)throw TypeError("Expected a function");return(0,ep.Z)(i)&&(r="leading"in i?!!i.leading:r,n="trailing"in i?!!i.trailing:n),em(t,e,{leading:r,trailing:n,maxWait:e})};let hq=t=>!!tF[t];function hJ(t,e,i={}){var r;let n=ld.getGraphicType(e)?ld.createGraphic(e,i):ld.createGraphicComponent(e,i,{skipDefault:null===(r=null==t?void 0:t.spec)||void 0===r?void 0:r.skipTheme});return!n&&ek.Y.getInstance().error(`create ${e} graphic failed!`),n}let hQ=t=>{t&&(t[l4]=null,t.release(),t.parent&&t.parent.removeChild(t))},h0=t=>(0,eC.Z)(t.markId)?e=>e&&e.mark.id()===t.markId:(0,eC.Z)(t.markName)?e=>e&&e.mark.name()===t.markName:(0,eC.Z)(t.type)?e=>e&&e.mark.markType===t.type:()=>!0,h1=(t,e)=>e&&e.debounce?em(t,e.debounce):e&&e.throttle?hK(t,e.throttle):t,h2=(t,e=lD)=>{let i={},r=t.split(":");if(2===r.length){let[t,n]=r;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):hq(t)?(i.markType=t,i.source=e):i.source=t===lL?lL:e,i.type=n}else 1===r.length&&(i.type=t,i.source=e);return i};function h5(t,e){switch(e){case"line":return t.some(t=>["x","y","defined"].includes(t));case"area":return t.some(t=>["x","y","x1","y1","defined"].includes(t));case"largeRects":return t.some(t=>["x","y","width","y1"].includes(t));case"largeSymbols":return t.some(t=>["x","y"].includes(t))}return!1}let h3=["fillOpacity"],h4=(t,e,i)=>{var r;return"fillOpacity"===e?(t.fillOpacity=null!==(r=i.fillOpacity)&&void 0!==r?r:1,["fillOpacity"]):[]},h6={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var r,n,s,a,o,l,h,d,u,c,p,f;(0,ef.Z)(e.width)||!(0,ef.Z)(e.x1)&&(0,ef.Z)(i.width)?(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):(0,ef.Z)(e.x1)||!(0,ef.Z)(e.width)&&(0,ef.Z)(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),(0,ef.Z)(e.height)||!(0,ef.Z)(e.y1)&&(0,ef.Z)(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):(0,ef.Z)(e.y1)||!(0,ef.Z)(e.height)&&(0,ef.Z)(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(d=i.y1)&&void 0!==d?d:1/0),t.height=i.height),(0,ef.Z)(e.length)||!(0,ef.Z)(e.z1)&&(0,ef.Z)(i.length)?(t.z=Math.min(null!==(u=i.z)&&void 0!==u?u:0,null!==(c=i.z1)&&void 0!==c?c:1/0),t.length=i.length):(0,ef.Z)(e.z1)||!(0,ef.Z)(e.length)&&(0,ef.Z)(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(f=i.z1)&&void 0!==f?f:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[tF.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var r,n;let s=null!==(r=i.limit)&&void 0!==r?r:1/0,a=Math.min(s,null!==(n=i.autoLimit)&&void 0!==n?n:1/0),o=lw(i.text)&&!(0,eC.Z)(i.text.text),l=o?i.text.text:i.text;Array.isArray(l),t.maxLineWidth=a===1/0?i.maxLineWidth:a,(o||i.textType)&&("rich"===i.text.type||"rich"===i.textType)?t.textConfig=l:t.text=l},storedAttrs:"limitAttrs"}],[tF.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{let r=function(t){let{x:e,y:i,x1:r,y1:n}=t;return(0,ef.Z)(e)&&(0,ef.Z)(i)&&(0,ef.Z)(r)&&(0,ef.Z)(n)?[{x:e,y:i},{x:r,y:n}]:[]}(i);t.points=r,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[tF.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var r;t.symbolType=null!==(r=e.shape)&&void 0!==r?r:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]},h8=(t,e,i,r)=>{let n={},s=e?Object.keys(e):[],a=(0,eT.Z)(t)?h6[t]:t;if(a&&a.length){let t=[];s.forEach(s=>{let o=!1;a.forEach((a,l)=>{if(a.channels.includes(s)){if(!t[l]){if(a.storedAttrs){let t=function(t,e,i,r,n,s){let a=n.getGraphicAttribute(t,!1,s);if(a)return e.forEach(t=>{t in r&&(a[t]=r[t])}),a;let o={};return e.forEach(t=>{o[t]=r[t]}),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,r);a.transform(n,e,t)}else a.transform(n,e,null)}t[l]=!0,o=!0}}),o||(h3.includes(s)?h4(n,s,e):n[s]=e[s])})}else s.forEach(t=>{h3.includes(t)?h4(n,t,e):n[t]=e[t]});return n};function h7(t){return Object.prototype.toString.call(t)}function h9(t){return Object.keys(t)}var dt=t=>({}).toString.call(t).replace(/^\[object /,"").replace(/]$/,"");let de=Object.prototype;var di=function(t){let e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||de)};let dr=Object.prototype.hasOwnProperty;var dn=function(t){if((0,eC.Z)(t))return!0;if(eb(t))return!t.length;let e=dt(t);if("Map"===e||"Set"===e)return!t.size;if(di(t))return!Object.keys(t).length;for(let e in t)if(dr.call(t,e))return!1;return!0};let ds=(t,e,i,r=!0)=>{if(e===i)return!0;if((0,eC.Z)(e)||(0,eC.Z)(i))return(0,eC.Z)(e)&&(0,eC.Z)(i);if(!l_(e)&&!l_(i))return e===i;let n=(0,ev.Z)(e)?e:e[t],s=(0,ev.Z)(i)?i:i[t];return n===s||!1!==r&&((0,ev.Z)(s)?!(!(0,ev.Z)(n)||s.length!==n.length||!s.every((t,e)=>t===n[e])):!!(0,ep.Z)(s)&&!(!(0,ep.Z)(n)||Object.keys(s).length!==Object.keys(n).length||!Object.keys(s).every(t=>ds(t,s,n))))};function da(t){return!!(null==t?void 0:t.scale)}function dl(t){return!!(null==t?void 0:t.field)}function dh(t,e){if(!t)return[];let i=[];return t.scale&&(i=li(t.scale)?[t.scale]:ex(e.getScaleById(t.scale))),i.concat(o7(t,e))}function dd(t,e,i,r,n){i&&(o9(i)?e.forEach(e=>{let n=lt(i,r,e.datum,t);Object.assign(e.nextAttrs,n)}):Object.keys(i).forEach(s=>{var a,o;let l=i[s],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case tF.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case tF.group:case tF.rect:case tF.image:return["width","height","y1"].includes(e);case tF.path:case tF.shape:return["path","customPath"].includes(e);case tF.line:return"defined"===e;case tF.area:return["x1","y1","defined"].includes(e);case tF.rule:return["x1","y1"].includes(e);case tF.symbol:return"size"===e;case tF.polygon:return"points"===e;case tF.text:return"text"===e}return!1}(t.mark.markType,s)?[e[0]]:e;if(da(l)){let t=le(l.scale,r),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!(0,eC.Z)(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=(0,eT.Z)(null==l?void 0:l.field),d=n?l0(l.field):null,u=n?null:(0,eC.Z)(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach(r=>{var a;n&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(r.datum))),r.nextAttrs[s]=(0,ib.Z)(u)||(0,ib.Z)(i)?u+e+i:u})}else if(dl(l)){let t=l0(l.field);h.forEach(e=>{e.nextAttrs[s]=t(e.datum)})}else h.forEach(e=>{e.nextAttrs[s]=lt(l,r,e.datum,t)})}))}function du(t,e,i,r){if(!t)return null;if(o9(t))return lt(t,r,e,i);let n={};return Object.keys(t).forEach(s=>{var a,o,l;let h=t[s];if(da(h)){let t=le(h.scale,r),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,d=!(0,eC.Z)(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,u=(0,eT.Z)(null==h?void 0:h.field),c=u?l0(h.field):null,p=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,c(e)):(0,eC.Z)(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[s]=(0,ib.Z)(p)||(0,ib.Z)(d)?p+i+d:p}else if(dl(h)){let t=l0(h.field);n[s]=t(e)}else n[s]=lt(h,r,e,i)}),n}let dc=(t,e)=>{var i,r;if(t===e)return!0;let n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(r=e&&e.length)&&void 0!==r?r:0)&&0!==n&&t.every((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset)},dp=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e||(0,eT.Z)(t)||t.gradient!==e.gradient)return!1;let i=Object.keys(t),r=Object.keys(e);return i.length===r.length&&i.every(i=>"stops"===i?dc(t[i],e[i]):t[i]===e[i])},df=(t,e)=>t.length===e.length&&t.join("-")===e.join("-"),dg=(t,e,i)=>!(!(0,eC.Z)(t)||!(0,eC.Z)(e))||!(0,eC.Z)(t)&&!(0,eC.Z)(e)&&("lineDash"===i?df(t,e):"stroke"===i||"fill"===i?dp(t,e):t===e),dm=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],dv=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(dm);function db(t,e,i){var r;if(!t||t.length<=1)return null;let n="area"===(null===(r=null==i?void 0:i.mark)||void 0===r?void 0:r.markType)?dv:dm,s=[],a=null;return t.forEach((t,e)=>{a&&n.every(e=>dg(a[e],t[e],e))||(s.length&&(s[s.length-1].endIndex=e),a=t,s.push({attrs:a,startIndex:e}))}),s.length>=2?s.map(t=>{let i=dy(t.attrs);return i.points=e.slice(t.startIndex,(0,eC.Z)(t.endIndex)?e.length:t.endIndex),i}):null}function dy(t){let e={};return t&&Object.keys(t).forEach(i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])}),e}class dx{constructor(t){this.data=null,this.states=[],this.diffState=tj.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,r,n;let s=!(0,eC.Z)(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=s?this.runtimeStatesEncoder[t]:null===(r=this.mark.getSpec().encode)||void 0===r?void 0:r[t];if(!a)return{};if(r6(a))return a(this.getDatum(),this,t,e);if(!s&&(null===(n=this.graphicItem.states)||void 0===n?void 0:n[t]))return this.graphicItem.states[t];let o=this.items.map(t=>Object.assign({},t,{nextAttrs:{}}));dd(this,o,a,this.mark.parameters());let l=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=l):this.graphicItem.states={[t]:l},l},this.mark=t}initGraphicItem(t={}){if(this.graphicItem)return;let e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?h8(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[l4]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?h8(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===tj.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;let t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,t=>t.stop())),this.graphicItem&&(hQ(this.graphicItem),this.graphicItem[l4]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var r;this.mark.emit(tX.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;let n=lr(i);return this.items=e.map(t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}})),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(r=this.items)||void 0===r?void 0:r[0].key,this.mark.emit(tX.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;let r=this.mark.isCollectionMark(),n=this.states,s=ex(lt(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&s.length&&s.sort(a);let o=s.length!==n.length||s.some((t,e)=>t!==n[e]);this.states=s,!r&&o&&this.diffState===tj.unChange&&(this.diffState=tj.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);let e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),(this.diffState===tj.enter||this.diffState===tj.update)&&this.states.length&&this.useStates(this.states),this.mark.markType===tF.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach(t=>{t.nextAttrs={}}),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;let e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new iK))}encodeItems(t,e,i=!1,r){let n=this.mark.isCollectionMark(),s=e[tN.update],a=e[tN.enter],o=e[tN.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===tj.enter?(a&&dd(this,t,a,r,l),s&&dd(this,t,s,r,l)):this.diffState===tj.update?((n&&a||i)&&dd(this,t,a,r,l),s&&dd(this,t,s,r,l)):this.diffState===tj.exit&&o&&(i&&dd(this,t,a,r,l),dd(this,t,o,r,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;let e=this.mark.coord.output();t.forEach(t=>{let i=t.nextAttrs,r=e.convert(i);Object.assign(i,r)})}clearStates(t){let e=r4(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&(0,eT.Z)(t)&&!function t(e,i,r){if(e===i)return!0;if(typeof e!=typeof i||null==e||null==i)return!1;if(Number.isNaN(e)&&Number.isNaN(i))return!0;if(h7(e)!==h7(i))return!1;if(r6(e))return!!(null==r?void 0:r.skipFunction);if("object"!=typeof e)return!1;if((0,ev.Z)(e)){if(e.length!==i.length)return!1;for(let n=e.length-1;n>=0;n--)if(!t(e[n],i[n],r))return!1;return!0}if(!lw(e))return!1;let n=h9(e),s=h9(i);if(n.length!==s.length)return!1;n.sort(),s.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=s[t])return!1;for(let s=n.length-1;s>=0;s--){let a=n[s];if(!t(e[a],i[a],r))return!1}return!0}(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){let i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}let r=this.mark.getSpec().encode,n=ex(t).reduce((t,e)=>(e&&!t.includes(e)&&(null==r?void 0:r[e])&&t.push(e),t),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;let e=ex(t);if(!e.length)return!1;let i=this.states.filter(t=>!e.includes(t));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach(t=>{this.runtimeStatesEncoder[t]=null}),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(tX.BEFORE_ELEMENT_STATE,{states:t},this);let r=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;r&&t.sort(r),this.states=t;let n=r4(e)?e:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(tX.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){let e={},i=this.getFinalGraphicAttributes();for(let r in t)ds(r,i,t)&&r1(i,r)||(e[r]=t[r]);return e}transformElementItems(t,e,i){var r,n,s,a,o,l,h,d,u,c,p;let f=t[0];if(!f.nextAttrs||0===Object.keys(f.nextAttrs).length)return{};let g=f.nextAttrs;if(l=e,[tF.line,tF.area,tF.largeRects,tF.largeSymbols].includes(l)&&t&&t.length&&(0,eC.Z)(null===(r=f.nextAttrs)||void 0===r?void 0:r.points)&&(!0===i||h5(Object.keys(f.nextAttrs),this.mark.markType))){let i=this.mark.getSpec(),r=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),f=i.enableSegments,m=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[tN.connectNulls],v=t.map(t=>t.nextAttrs),b=this.mark.isProgressive();if(g=dy(g),e===tF.line||e===tF.area){;let i=(h=t,d=!0,u=r,c=e===tF.area,h&&h.length&&(1!==h.length||d)?h.some(t=>h5(Object.keys(t.nextAttrs),"line"))?h.map((t,e)=>{var i;let r=t.nextAttrs,{x:n,y:s,x1:a,y1:o,defined:l}=null!==(i=null==u?void 0:u[e])&&void 0!==i?i:{};return(0,eC.Z)(r.x)&&(r.x=n),(0,eC.Z)(r.y)&&(r.y=s),(0,eC.Z)(r.defined)&&!1===l&&(r.defined=!1),r.context=t.key,c&&((0,eC.Z)(r.x1)&&(r.x1=a),(0,eC.Z)(r.y1)&&(r.y1=o)),r}):null!=u?u:[]:[]);if(b)g.segments=(null!==(o=null===(a=null===(s=this.graphicItem)||void 0===s?void 0:s.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(m){if(g.segments=function(t,e,i){if(!t||t.length<=1)return null;let r=!!i&&i.mark.getSpec().enableSegments,n,s,a=[],o=null;if(t.forEach((t,i)=>{(o=e[i])&&!1!==o.defined?(n||(s={items:[],points:[]},a.push(s)),s.points.push(o),s.items.push(t),!1===n&&(s.isConnect=!0,s={items:[],points:[]},a.push(s)),n=!0):n=!1}),(a=a.filter(t=>t.points.length>0)).length>=2){let t=[];return a.forEach(e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(r){let r=db(e.items,e.points,i);if(r)return void r.forEach(e=>{t.push(e)})}let n=dy(e.items[0]);n.points=e.points,t.push(n)}),t}return r?db(t,e,i):null}(v,i,this),g.segments&&g.segments.some(t=>t.isConnect)){let t=du(m,this.getDatum(),this,this.mark.parameters());t&&g.segments.forEach(e=>{e.isConnect&&Object.assign(e,t)})}g.points=i}else if(f){;let t=i&&0!==i.length?i:(p=l)?p.reduce((t,e)=>t.concat(e.points),[]):null,e=db(v,t,this);e?(g.segments=e,g.points=null):(g.segments=null,g.points=t)}else g.points=i,g.segments=null}else e===tF.largeRects?g.points=function(t,e,i=[]){if(!t||!t.length||1===t.length&&!e)return[];let r=new Float32Array(4*t.length);return t.forEach((t,e)=>{var n,s,a,o;let l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],d=null!==(s=l.y)&&void 0!==s?s:i[4*e+1],u=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],c=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];r[4*e]=h,r[4*e+1]=d,r[4*e+2]=u,r[4*e+3]=c-d}),r}(t,!0,r):e===tF.largeSymbols&&(g.points=function(t,e,i=[]){if(!t||!t.length||1===t.length&&!e)return[];let r=new Float32Array(2*t.length);return t.forEach((t,e)=>{var n,s;let a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(s=a.y)&&void 0!==s?s:i[2*e+1];r[2*e]=o,r[2*e+1]=l}),r}(t,!0,r))}return g}applyGraphicAttributes(t){var e,i;if(!dn(t)){if(this.mark.needAnimate()){let r=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},s=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(r).forEach(t=>{n[t]=this.getGraphicAttribute(t),s[t]=r[t]}),this.setNextGraphicAttributes(r),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(s);let a=Object.assign({},this.mark.animate.getElementAnimators(this).reduce((t,e)=>Object.assign(t,e.getEndAttributes()),{}),s);this.graphicItem.setAttributes(a)}else this.graphicItem.setAttributes(t)}}getGraphicAttribute(t,e=!1){var i;if(!this.graphicItem)return;if(e){let e;let i=this.getPrevGraphicAttributes();if(!(0,eC.Z)(e=lX(i,t)))return e}let r=this.mark.getAttributeTransforms(),n=[t];if(r&&r.length){let e=r.find(e=>e.storedAttrs&&e.channels.includes(t));e&&(n=[e.storedAttrs,t])}return lX(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e,i=!0){if(!this.graphicItem)return;let r=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&r&&(r[t]=e),n&&!r1(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t,e=!0){if(!this.graphicItem)return;let i=this.getFinalGraphicAttributes(),r=this.getPrevGraphicAttributes();Object.keys(t).forEach(n=>{i&&e&&(i[n]=t[n]),r&&!r1(r,n)&&(r[n]=this.graphicItem.attribute[n])}),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(hQ(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?(0,eC.Z)(t)?this.items.map(t=>t.nextAttrs):this.items.map(e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]}):(0,eC.Z)(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?(0,ev.Z)(t)&&this.items.forEach((e,i)=>{Object.assign(e.nextAttrs,t[i])}):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class d_ extends dx{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,r,n;let s=!(0,eC.Z)(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=s?this.runtimeStatesEncoder[t]:null===(r=this.mark.getSpec().encode)||void 0===r?void 0:r[t],o={};if(!a)return o;if(r6(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(!s&&(null===(n=this.graphicItem.glyphStates)||void 0===n?void 0:n[t]))return this.graphicItem.glyphStates[t];if(a){let e=[Object.assign({},this.items[0],{nextAttrs:{}})];return dd(this,e,a,this.mark.parameters()),this.coordinateTransformEncode(e),o.attributes=e[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(t={}){if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[l4]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);let e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach(t=>{let i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?h8(i,e,this,t.name):e}),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(tX.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();let i=r4(e)?e:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(tX.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);let t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===tj.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),(this.diffState===tj.enter||this.diffState===tj.update)&&this.states.length&&(Object.values(this.glyphGraphicItems).forEach(t=>{t.states={}}),this.useStates(this.states)),this.items.map(t=>{t.nextAttrs={}})}encodeCustom(t){var e;let i={},r=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),r){let e;Object.keys(r).forEach(n=>{var s;if(!(0,eC.Z)(t[n])){e||(e=Object.assign({},null===(s=this.graphicItem)||void 0===s?void 0:s.attribute,t));let a=r[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach(t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])})}})}return i}encodeDefault(){let t={};return this.diffState===tj.enter&&this.glyphMeta.getDefaultEncoder()&&Object.assign(t,this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig())),t}_onGlyphAttributeUpdate(t=!1){return e=>{if(!this.mark)return e;let i=this.glyphMeta.getMarks(),r=h8(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,s=this.encodeCustom(e);return Object.keys(i).forEach(r=>{var a,o,l;let h=i[r],d=this.glyphGraphicItems[r],u=Object.assign({},null==s?void 0:s[r]);if(t){let t=null==n?void 0:n[r];Object.keys(null!=t?t:{}).forEach(e=>{r1(this.items[0].nextAttrs,e)||r1(u,e)||(u[e]=t[e])})}let c=Object.assign({},(a=h,o=e,(null!==(l=h6[a])&&void 0!==l?l:[]).reduce((t,e)=>(e.channels.forEach(e=>{r1(o,e)&&(t[e]=o[e])}),t),{})),u),p=this._generateGlyphItems(h,this.items,c);this.coordinateTransformEncode(p);let f=this.transformElementItems(p,h);this.applyGlyphGraphicAttributes(f,r,d),h===tF.shape&&(d.datum=p[0].datum)}),r}}_generateGlyphItems(t,e,i){let r=e.map(t=>Object.assign({},t,{nextAttrs:i}));return l6.includes(t)&&this.mark.getSpec().enableSegments&&r.forEach((t,r)=>{t.nextAttrs=Object.assign({},e[r].nextAttrs,i)}),r}getGraphicAttribute(t,e=!1,i){if(!this.graphicItem)return;let r=this.getPrevGraphicAttributes(i);return e&&r1(r,t)?r[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e,i=!0,r){if(!this.graphicItem)return;let n=r?this.glyphGraphicItems[r]:this.graphicItem,s=this.getFinalGraphicAttributes(r),a=this.getPrevGraphicAttributes(r);i&&(s[t]=e),r1(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t,e=!0,i){if(!this.graphicItem)return;let r=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),s=this.getPrevGraphicAttributes(i);Object.keys(t).forEach(i=>{e&&(n[i]=t[i]),r1(s,i)||(s[i]=r.attribute[i])}),r.setAttributes(t)}diffAttributes(t,e){let i={},r=this.getFinalGraphicAttributes(e);for(let e in t)ds(e,r,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var r,n;if(this.mark.needAnimate()){let s=this.diffAttributes(t,e),a=null!==(r=this.getPrevGraphicAttributes(e))&&void 0!==r?r:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(s).forEach(t=>{a[t]=i.attribute[t],o[t]=s[t]}),this.setNextGraphicAttributes(s,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(s)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach(t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)})}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach(t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)})}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach(t=>{t[l4]=null}),this.glyphGraphicItems=null),super.release()}}let dw=t=>t.markType===tF.glyph?new d_(t):new dx(t);function dA(t,e,i){let r=new Map;if(!t||0===t.length)return{keys:[],data:r};if(!e)return r.set("key",i?t.slice().sort(i):t.slice()),{keys:l9,data:r};let n=lr(e);if(1===t.length){let e=n(t[0]);return r.set(e,[t[0]]),{keys:[e],data:r}}let s=new Set;return t.forEach(t=>{var e;let i=n(t),a=null!==(e=r.get(i))&&void 0!==e?e:[];a.push(t),r.set(i,a),s.add(i)}),i&&s.forEach(t=>{r.get(t).sort(i)}),{keys:Array.from(s),data:r}}class dS{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?dA(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback){if(this.currentData&&this.prevData){let t=new Map(this.prevData.data);this.currentData.keys.forEach(e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)}),this.prevData.keys.forEach(e=>{t.has(e)&&this.callback(e,null,t.get(e))})}else this.currentData?this.currentData.keys.forEach(t=>{this.callback(t,this.currentData.data.get(t),null)}):this.prevData&&this.prevData.keys.forEach(t=>{this.callback(t,null,this.prevData.data.get(t))})}}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class dE extends nr{constructor(t,e,i,r,n){super(t,e,i,r,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,r,n,s,a,o;this.fromNumber=(0,ib.Z)(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=(0,ib.Z)(null===(r=this.to)||void 0===r?void 0:r.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(s=this.to)||void 0===s?void 0:s.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max((0,eJ.i4)(this.fromNumber),(0,eJ.i4)(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}(M=t0||(t0={}))[M.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",M[M.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",M[M.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",M[M.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",M[M.STROKE=4]="STROKE";class dT extends nr{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach(t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target})}getEndProps(){let t={};return this.customAnimates.forEach(e=>{Object.assign(t,e.getEndProps())}),t}onBind(){this.initAnimates(),this.customAnimates.forEach(t=>{t.onBind()})}onEnd(){this.customAnimates.forEach(t=>{t.onEnd()})}onStart(){this.customAnimates.forEach(t=>{t.onStart()})}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach(r=>{let n=r.easing;e=("string"==typeof n?nt[n]:n)(e),r.onUpdate(t,e,i)}),this.updating=!1)}}let dC=(t,e)=>{if(!t)return null;if(t.from){let i=t.from,r=Object.keys(i);r.forEach(t=>{(0,eC.Z)(i[t])&&delete i[t]});let n=h5(r,e.mark.markType)&&!ey(i.segments);if(n){let r=e.items.map(t=>Object.assign({},t,{nextAttrs:Object.assign({},i)}));t.from=e.transformElementItems(r,e.mark.markType,n)}}if(t.to){let i=t.to,r=Object.keys(i);r.forEach(t=>{(0,eC.Z)(i[t])&&delete i[t]});let n=h5(r,e.mark.markType)&&!ey(i.segments);if(n){let r=e.items.map(t=>Object.assign({},t,{nextAttrs:Object.assign({},i)}));t.to=e.transformElementItems(r,e.mark.markType,n)}}return t},dk=(t,e,i,r,n)=>r6(i)?i(t.getDatum(),t,n):i;class dM extends nr{constructor(t,e,i,r,n){super(t,e,i,r,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class dB extends nr{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){var t;let e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:nj,i=Object.keys(e).filter(t=>0!==e[t]);this.subAnimate.animate.preventAttrs(i);let r=Object.assign({},this.from),n=Object.assign({},this.to),s=[];Object.keys(n).forEach(t=>{i.includes(t)?(r[t]=n[t],this.from[t]=n[t]):(0,eC.Z)(r[t])?r[t]=this.target.getComputedAttribute(t):s.push(t)}),this.target.animates.forEach(t=>{t!==this.subAnimate.animate&&t.preventAttrs(s)}),this.target.setAttributes(r,!1,{type:oO.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=r,this._toAttribute=n}onEnd(){if(this._toAttribute){let t={};Object.keys(this._toAttribute).forEach(e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])}),this.target.setAttributes(t,!1,{type:oO.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;let r=this.step.getLastProps();Object.keys(r).forEach(t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=r[t])}),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}ns.mode|=oL.SET_ATTR_IMMEDIATELY;let dP=0,dR=t=>!(0,eC.Z)(t)&&t.prototype instanceof nr;class dO{constructor(t,e,i){this.id=dP++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(t="end",e=!0){return this.runnings.forEach(e=>e.stop(t)),this.animationEnd(e),this}pause(){return this.runnings.forEach(t=>t.pause()),this}resume(){return this.runnings.forEach(t=>t.resume()),this}startAt(t){return this.runnings.forEach(e=>{let i=this.unit.initialDelay;e.startAt(i+t)}),this}getTotalAnimationTime(){var t;let e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce((t,e)=>Object.assign(t,e.getEndProps()),{})}animationEnd(t=!0){var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){let i=this.element.getGraphicItem();if(!i)return;let r=i.animate();this.runnings.push(r),r.startAt(this.unit.initialDelay),r.wait(this.unit.loopDelay),this.unit.timeSlices.forEach(i=>{this.animateTimeSlice(r,i,t,e)}),r.wait(this.unit.loopDelayAfter),r.loop(this.unit.loopCount-1),(0,ef.Z)(this.unit.totalTime)&&setTimeout(()=>{r&&r.stop("end")},this.unit.totalTime),r.onEnd(()=>{this.runnings=this.runnings.filter(t=>t!==r),0===this.runnings.length&&this.animationEnd()})}animateTimeSlice(t,e,i,r){let n=e.delay,s=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{let e=o.map((t,e)=>{var n;let s=null!==(n=t.type?function(t,e,i,r){let n=r6(e.options)?e.options.call(null,t.getDatum(),t,r):e.options;return e.type&&ld.getAnimationType(e.type)?dC(ld.getAnimationType(e.type)(t,n,i),t):null}(this.element,t,i,r):t.channel?function(t,e,i,r){let n=e.channel,s=null;return(0,ev.Z)(n)?s=n.reduce((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e),{from:{},to:{}}):(0,ep.Z)(n)&&(s=Object.keys(n).reduce((e,i)=>{var s,a;let o=!(0,eC.Z)(null===(s=n[i])||void 0===s?void 0:s.from),l=!(0,eC.Z)(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?dk(t,0,n[i].from,0,r):void 0,e.to[i]=l?dk(t,0,n[i].to,0,r):t.getGraphicAttribute(i,!1)),e},{from:{},to:{}})),dC(s,t)}(this.element,t,0,r):void 0)&&void 0!==n?n:{},o=s.custom||(null==t?void 0:t.custom),l=(null==s?void 0:s.customParameters)||(null==t?void 0:t.customParameters);s.from&&Object.keys(s.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(s.from);let h=dR(o);return(0,eC.Z)(o)||dR(o)?h?new o(s.from,s.to,a,t.easing,l):s.to?new dB(s.from,s.to,a,t.easing):void 0:new dM(s.from,s.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})}).filter(t=>!(0,eC.Z)(t));1===e.length?t.play(e[0]):e.length>1&&t.play(new dT(a,e))}s>0&&t.wait(s)}}function dI(t){let e=[];return Object.keys(t).forEach(i=>{e=e.concat(dL(i,t[i]))}),e}function dL(t,e,i=0){let r=[],n=i;return ex(e).forEach(e=>{var i;let s=function(t){var e,i,r,n,s,a,o,l,h,d,u,c;if((0,eC.Z)(t.timeSlices))return{startTime:null!==(e=t.startTime)&&void 0!==e?e:0,totalTime:t.totalTime,oneByOne:null!==(i=t.oneByOne)&&void 0!==i&&i,loop:null!==(r=t.loop)&&void 0!==r&&r,controlOptions:lE({},hi,null!==(n=t.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(s=t.duration)&&void 0!==s?s:1e3,delay:null!==(a=t.delay)&&void 0!==a?a:0,delayAfter:null!==(o=t.delayAfter)&&void 0!==o?o:0,effects:[{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(l=t.easing)&&void 0!==l?l:he,customParameters:t.customParameters,options:t.options}]}]};let p=ex(t.timeSlices).filter(t=>t.effects&&ex(t.effects).filter(t=>t.channel||t.type).length);if(p.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:0,totalTime:t.totalTime,oneByOne:null!==(d=t.oneByOne)&&void 0!==d&&d,loop:null!==(u=t.loop)&&void 0!==u&&u,controlOptions:lE({},hi,null!==(c=t.controlOptions)&&void 0!==c?c:{}),timeSlices:p.map(t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:0,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:0,effects:ex(t.effects).filter(t=>t.channel||t.type).map(t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:he,customParameters:t.customParameters,options:t.options}})}}),partitioner:t.partitioner,sort:t.sort}}(e);s&&(r.push({state:t,id:null!==(i=s.id)&&void 0!==i?i:`${t}-${n}`,timeline:s,originConfig:e}),n+=1)}),r}function dD(t,e,i){return r6(t)?t.call(null,e.getDatum(),e,i):t}class dN{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter(t=>!(0,eC.Z)(t)),this.totalTime=this.animators.reduce((t,e)=>Math.max(t,e.getTotalAnimationTime()),0)}parallel(t){let e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach(t=>{t.parallelArrangers=e}),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){let t=this.parallelArrangers.reduce((t,e)=>Math.max(t,e.totalTime),this.totalTime),e=this.parallelArrangers.reduce((t,e)=>{var i,r;return Math.max(t,null!==(r=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==r?r:0)},0);this.parallelArrangers.forEach(i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach(t=>{t.startAt(e)})})}}class dj{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=dI(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter(e=>e.state===t):[]}updateConfig(t){this.configs=dI(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;let t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach(t=>{var e;t.isReserved&&t.diffState!==tj.exit&&(t.isReserved=!1);let i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some(e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange)&&this.clearElementAnimation(t,!1)}),this.configs.forEach(i=>{this.animateByTimeline(i,t,e)}),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;let e=this.configs.filter(e=>e.state===t),i=this.mark.getAllElements(),r=this.mark.parameters();return new dN(e.reduce((t,e)=>t.concat(this.animateByTimeline(e,i,r,!0)),[]))}stopAnimationByState(t){let e=this.animators.get(t);return e&&e.forEach(t=>t.stop()),this}pauseAnimationByState(t){let e=this.animators.get(t);return e&&e.forEach(t=>t.pause()),this}resumeAnimationByState(t){let e=this.animators.get(t);return e&&e.forEach(t=>t.resume()),this}run(t){if(!this.isEnabled)return;let e=dL(ht,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);let i=this.mark.getAllElements(),r=this.mark.parameters();return new dN(e.reduce((t,e)=>t.concat(this.animateByTimeline(e,i,r,!0)),[]))}stop(){return this.animators.forEach(t=>{t.forEach(t=>t.stop())}),this}pause(){return this.animators.forEach(t=>t.forEach(t=>t.pause())),this}resume(){return this.animators.forEach(t=>t.forEach(t=>t.resume())),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach(e=>{t=t||e.some(t=>t.isAnimating)}),t}isElementAnimating(t){var e;let i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return(0,eC.Z)(i)||Object.values(i).every(t=>0===t)}getAnimatorCount(){let t=0;return this.animators.forEach(e=>t+=e.length),t}getAllAnimators(){let t=[];return this.animators.forEach(e=>{t.push(...e)}),t}getElementAnimators(t,e){var i;let r=ex(t),n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach(t=>{n=n.concat(t)}),n.filter(t=>r.includes(t.element))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){let e=ex(t);return this.disabledStates=this.disabledStates.filter(t=>!e.includes(t)),this}disableAnimationState(t){let e=ex(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i,r=!1){var n;let s=[],a=e.filter(e=>{let n=!(e.isReserved&&e.diffState===tj.exit),s=this.getAnimationState(e),a=!this.disabledStates.includes(s),o=r||s===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l});if(a.length){(0,eC.Z)(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort((e,r)=>t.timeline.sort(e.getDatum(),r.getDatum(),e,r,i));let e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach((r,n)=>{e.elementIndex=n;let o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,r,n,a.length,o);s.push(this.animateElement(t,l,r,e,o))})}return s}animateElement(t,e,i,r,n){var s,a;let o=new dO(i,e,t);if(o.animate(r,n),!o.isAnimating)return;i.diffState===tj.exit&&(i.isReserved=!0);let l=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;let h=null!==(s=this.elementRecorder.get(i))&&void 0!==s?s:{prevState:t.state,count:{}};h.prevState=t.state,h.count[t.state]=(null!==(a=h.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,h);let d=this.animators.get(t.state);d?d.push(o):this.animators.set(t.state,[o]),o.callback(()=>{this.handleAnimatorEnd(o)});let u={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return l&&this.mark.emit(tX.ANIMATION_START,u),this.mark.emit(tX.ELEMENT_ANIMATION_START,u,i),o}getAnimationState(t){let e=lt(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,r,n){let s=[],a=dD(t.startTime,e,n),o=dD(t.totalTime,e,n),l=dD(t.oneByOne,e,n),h=dD(t.loop,e,n),d=0;t.timeSlices.forEach(t=>{var i;let a=dD(t.delay,e,n),l=dD(t.delayAfter,e,n),h=null!==(i=dD(t.duration,e,n))&&void 0!==i?i:o/r,u=ex(t.effects).map(t=>Object.assign({},t,{customParameters:dD(t.customParameters,e,n)}));s.push({effects:u,duration:h,delay:a,delayAfter:l}),d+=a+h+l});let u=(0,ib.Z)(l)?l:!0===l?d:0;return{initialDelay:a,loopCount:(0,ib.Z)(h)?h:!0===h?1/0:1,loopDelay:u*i,loopDelayAfter:u*(r-i-1),loopAnimateDuration:d,loopDuration:d+u*(r-1),totalTime:o,timeSlices:s}}clearElementAnimation(t,e=!0){this.animators.forEach(i=>{i.forEach(i=>{i.element===t&&(i.animationOptions.state===tj.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))})}),this.elementRecorder.delete(t)}clearAllElements(){let t=this.mark.getAllElements();t&&t.forEach((e,i)=>{this.clearElement(e,i===t.length-1)})}clearElement(t,e=!0){this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===tj.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t,e=!0){let i=t.element,r=t.animationOptions,n=r.state,s=n===ht,a=this.elementRecorder.get(i).count;a[n]-=1,this.animators.set(n,this.animators.get(n).filter(e=>e!==t)),0===this.animators.get(n).length&&this.animators.delete(n),this.timelineCount[r.id]-=1;let o=0===this.timelineCount[r.id],l=s?this.immediateConfigs.find(t=>t.id===r.id).originConfig:this.configs.find(t=>t.id===r.id).originConfig;o&&(delete this.timelineCount[r.id],s&&(this.immediateConfigs=this.immediateConfigs.filter(t=>t.id!==r.id))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():n===tj.exit&&0===a[tj.exit]&&this.clearElement(i));let h={mark:this.mark,animationState:n,animationConfig:l};o&&this.mark.emit(tX.ANIMATION_END,h),this.mark.emit(tX.ELEMENT_ANIMATION_END,h,i)}}class dF extends ll{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new dj(this,{}),this.differ=new dS([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,r;if(super.parse(t),this.spec.group){let t=(0,eT.Z)(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}let n=(0,eT.Z)(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach(t=>{this.encodeState(t,{},!0)}),Object.keys(null!==(r=t.encode)&&void 0!==r?r:{}).forEach(e=>{this.encodeState(e,t.encode[e])}),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){return t.grammarType!==this.grammarType?this:(this.markType=t.markType,this.coord=t.coord,this.elementMap=t.elementMap,this.elements=t.elements,this.elementMap.forEach(t=>t.mark=this),this.differ=t.differ,this.animate=t.animate,this.animate.mark=this,this._context=t._context,this.graphicItem=t.graphicItem,this.graphicIndex=t.graphicIndex,this.graphicParent=t.graphicParent,this.needClear=t.needClear,this.isUpdated=t.isUpdated,this)}needLayout(){return!(0,eC.Z)(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach(t=>{t.diffState===tj.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()}),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===tY.before)return this;let r=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(r,e);let n=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:l7,e),s=(null==n?void 0:n.progressive)?t:n;return this.evaluateGroup(s),this.renderContext=this.parseRenderContext(s,e),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==n?void 0:n.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=n.progressive,s=n.progressive.output()),this.emit(tX.BEFORE_MARK_JOIN),this.evaluateJoin(s),this.emit(tX.AFTER_MARK_JOIN),this.emit(tX.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(tX.AFTER_MARK_STATE),this.emit(tX.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(tX.AFTER_MARK_ENCODE)),this.emit(tX.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(tX.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===tF.group)return;let e=dA(null!=t?t:l7,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter(t=>"afterEncodeItems"===t.markPhase)}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter(t=>(0,eC.Z)(t.markPhase)||"afterEncode"===t.markPhase)}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter(t=>"beforeJoin"===t.markPhase):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,r,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,(0,eC.Z)(t)||((0,eT.Z)(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=r,this.spec.groupSort=n,this.commit(),this}coordinate(t){return(0,eT.Z)(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(tj.update,t,e,i)}encodeState(t,e,i,r){if(t===tj.enter&&(this._isReentered=!0),this.spec.encode[t]){let n=this.spec.encode[t];if(o9(n))this.detach(dh(n,this.view));else{let s=(0,eT.Z)(e);s&&r||!s&&i?(Object.keys(n).forEach(t=>{this.detach(dh(n[t],this.view))}),this.spec.encode[t]={}):s?this.detach(dh(n[e],this.view)):Object.keys(e).forEach(t=>{this.detach(dh(n[t],this.view))})}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),(0,eT.Z)(e)?(this.spec.encode[t][e]=i,this.attach(dh(i,this.view))):o9(e)?(this.spec.encode[t]=e,this.attach(dh(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach(t=>{this.attach(dh(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){let e=lf(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);let i=lf(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){let e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?e.forEach(t=>{(0,eC.Z)(this.spec[t])||(this.spec[t]=void 0)}):e.forEach(e=>{(0,eC.Z)(t[e])||(this.spec[e]=t[e])}),this}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return l6.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!(0,eC.Z)(this.spec.animation)}getAllElements(){let t=this.elements.slice();return this.elementMap.forEach(e=>{e.diffState!==tj.exit||t.includes(e)||t.push(e)}),this.spec.sort&&t.sort((t,e)=>this.spec.sort(t.getDatum(),e.getDatum())),t}getScales(){let t={};return this.references.forEach((e,i)=>{i.grammarType===tK.scale&&(t[i.id()]=i.output())}),t}getScalesByChannel(){let t=this.spec.encode;if(!t)return{};let e={},i=this.parameters();return Object.keys(t).forEach(r=>{let n=t[r];n&&!o9(n)&&Object.keys(n).forEach(t=>{da(n[t])&&(e[t]=le(n[t].scale,i))})}),e}getFieldsByChannel(){let t=this.spec.encode;if(!t)return{};let e={};return Object.keys(t).forEach(i=>{let r=t[i];o9(r)||Object.keys(r).forEach(t=>{dl(r[t])&&(e[t]=r[t].field)})}),e}init(t,e){var i,r,n,s;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;let r=null===(i=t.target)||void 0===i?void 0:i[l4];if((null==r?void 0:r.mark)===this){let i=hG(this.view,t,r,e,lD);this.emitGrammarEvent(e,i,r)}},this.initEvent()),this.animate||(this.animate=new dj(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){let t=le(this.spec.group,e);this.group=t,t&&t.appendChild(this)}let a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(r=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===r?void 0:r.indexOf(this))&&void 0!==n?n:0;if(this.markType!==tF.group){if(!this.graphicItem){let t=hJ(this,tF.group,{pickable:!1,zIndex:null!==(s=this.spec.zIndex)&&void 0!==s?s:0});(this.spec.support3d||l8.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,a&&(this.graphicIndex!==o||this.graphicItem.parent!==a)&&a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==tF.group?((0,eC.Z)(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),(0,eC.Z)(t.clip)||this.graphicItem.setAttribute("clip",t.clip),(0,eC.Z)(t.clipPath)||this.graphicItem.setAttribute("path",(0,ev.Z)(t.clipPath)?t.clipPath:t.clipPath(this.elements)),this.elementMap.forEach(t=>{t.updateGraphicItem()})):this.elementMap.forEach(t=>{t.updateGraphicItem()})}evaluateJoin(t){var e,i,r,n;this.needClear=!0;let s=lr(null!==(r=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==r?r:()=>"key"),a=lr(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>"key"),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter(t=>t.diffState===tj.enter)),d=[];this.differ.setCallback((t,e,i)=>{let r;if((0,eC.Z)(e))(r=this.elementMap.get(t))&&(r.diffState=tj.exit);else if((0,eC.Z)(i)){(r=this.elementMap.has(t)?this.elementMap.get(t):dw(this)).diffState===tj.exit&&(r.diffState=tj.enter,this.animate.getElementAnimators(r,tj.exit).forEach(t=>t.stop("start"))),r.diffState=tj.enter;let i=l?t:a(e[0]);r.updateData(i,e,s,this.view),this.elementMap.set(t,r),d.push(r)}else if(r=this.elementMap.get(t)){r.diffState=tj.update;let i=l?t:a(e[0]);r.updateData(i,e,s,this.view),d.push(r)}h.delete(r)});let u=null!=t?t:l7;l||this.differ.setCurrentData(dA(u,t=>`${a(t)}-${s(t)}`,void 0)),this.differ.doDiff(),h.forEach(t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()}),this.elements=d,o&&this.elements.length>=2&&this.elements.sort((t,e)=>o(t.getDatum(),e.getDatum()))}evaluateState(t,e,i){e&&t.forEach(t=>{t.state(e,i)})}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;let r={};return this._groupKeys.forEach(n=>{let s=t.find(t=>t.groupKey===n);s&&(r[n]=du(e,s.items&&s.items[0]&&s.items[0].datum,s,i))}),this._groupEncodeResult=r,r}getChannelsFromConfig(t){let e=this.spec;return(0,eC.Z)(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,r){let n=this.getChannelsFromConfig();if(e){this.emit(tX.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);let s=r?null:this.evaluateGroupEncode(t,e[tN.group],i);t.forEach(t=>{this.markType===tF.glyph&&this._groupEncodeResult?t.items.forEach(e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])}):(null==s?void 0:s[t.groupKey])&&!this.isCollectionMark()?t.items.forEach(e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,s[t.groupKey])}):n&&t.items.forEach(t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)}),t.encodeItems(t.items,e,this._isReentered,i)}),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach(t=>{t.encodeGraphic(this.isCollectionMark()?null==s?void 0:s[t.groupKey]:null)}),this.emit(tX.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach(t=>{t.initGraphicItem(n)})}addGraphicItem(t,e,i){var r;let n=null!=i?i:hJ(this,this.markType,t);if(n){if(null===(r=this.renderContext)||void 0===r?void 0:r.progressive){let t;if(this._groupKeys){let i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){let i=this.markType!==tF.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){let i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some(t=>i.data.get(t).length>this.spec.progressiveThreshold)?{large:r,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t),1),groupedData:i.data}}:{large:r}}return{large:r}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()}),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;let r=this.renderContext.progressive.currentIndex,n=lr(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>"key"),s=[];if(this.isCollectionMark())return this._groupKeys.forEach((t,e)=>{let i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(r*a,(r+1)*a);if(0===r){let e=dw(this);e.diffState=tj.enter,e.updateData(t,o,n,this.view),s.push(e)}else{let i=this.elements[e];i.updateData(t,o,n,this.view),s.push(i)}}),s;let a={};return this._groupKeys.forEach(t=>{let e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(r*i,(r+1)*i),l=[];o.forEach(e=>{let i=dw(this);i.diffState=tj.enter,i.updateData(t,[e],n,this.view),l.push(i),s.push(i)}),a[t]=l}),{groupElements:a,elements:s}}evaluateEncodeProgressive(t,e,i){let r=this.renderContext.progressive.currentIndex;if(0===r){if(this.evaluateEncode(t,e,i),0===r&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==tF.glyph){let e=t[0],i=e.getGraphicItem(),r=null==i?void 0:i.parent;r&&this._groupEncodeResult[e.groupKey]&&r.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();let t=this.renderContext.beforeTransformProgressive.output();return this.emit(tX.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(tX.AFTER_MARK_JOIN),this.emit(tX.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(tX.AFTER_MARK_STATE),this.emit(tX.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(tX.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;let r=this.renderContext.parameters;this.emit(tX.BEFORE_MARK_JOIN);let n=this.evaluateJoinProgressive(),s=Array.isArray(n)?n:n.elements;if(this.emit(tX.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach(t=>{let e=hJ(this,tF.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)}),this.elements=s):this.elements=this.elements.concat(s),this.emit(tX.BEFORE_MARK_STATE),this.evaluateState(s,this.spec.state,r),this.emit(tX.AFTER_MARK_STATE),this.emit(tX.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(s,this._getEncoders(),r);else{let t=n.groupElements;Object.keys(t).forEach(e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),r)})}this.emit(tX.AFTER_MARK_ENCODE);let a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter(t=>!0===t.canProgressive);(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,r),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach((t,e)=>{t.diffState!==tj.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())})}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:h6[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){let t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){let t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach(t=>t.diffState=tj.exit),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach(t=>t.release()),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&hQ(this.graphicItem),this.detachAll(),super.release()}}class dz extends dF{constructor(t,e){super(t,tF.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter(e=>e!==t),this}includesChild(t,e=!0){return!!this.children.includes(t)||!!e&&this.children.some(e=>e.markType===tF.group&&e.includesChild(t,!0))}updateLayoutChildren(){return this.children.length&&(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter(t=>t.needLayout())),this}getAttributeTransforms(){return h6.rect}evaluateJoin(t){if(!this.elements.length){let t=dw(this);t.updateData("key",l7,()=>"",this.view),this.elements=[t],this.elementMap.set("key",t)}}getChannelsFromConfig(t){let e=this.spec,i={};return(0,eC.Z)(e.clip)||(i.clip=e.clip),(0,eC.Z)(e.zIndex)||(i.zIndex=e.zIndex),(0,eC.Z)(e.clipPath)||(i.path=r6(e.clipPath)?e.clipPath([t]):e.clipPath),(0,eC.Z)(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var r;let n=this.elements[0],s={},a=[Object.assign({},null===(r=n.items)||void 0===r?void 0:r[0],{nextAttrs:s})];return dd(n,a,e,i),this._groupEncodeResult=s,s}evaluateEncode(t,e,i,r){let n=this.getChannelsFromConfig();if(e){this.emit(tX.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);let s=r?null:this.evaluateGroupEncode(t,e[tN.group],i);t.forEach(t=>{t.items.forEach(t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,s)}),t.encodeItems(t.items,e,this._isReentered,i)}),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach(t=>{t.encodeGraphic()}),this.emit(tX.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach(t=>{t.initGraphicItem(n)})}addGraphicItem(t,e,i){let r=null!=i?i:hJ(this,this.markType,t);if(r)return this.emit(tX.BEFORE_ADD_VRENDER_MARK,{graphicItem:r}),r.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(r,this.graphicIndex),this.emit(tX.AFTER_ADD_VRENDER_MARK,{graphicItem:r}),r}}function dH(t,e){if((0,ef.Z)(t))return t;let i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){let t=parseFloat(i.substring(0,i.length-1));return(0,ef.Z)(t)?t*e:0}return 0}function dG(t,e){return Math.min(t<0?t+e:t-1,e)}function dU(t,e,i){let r=dG(t,i),n=dG(e,i);if((0,ef.Z)(t)||(0,ef.Z)(e)?(0,ef.Z)(t)?(0,ef.Z)(e)||(r=dG(Math.max(0,n-1),i)):n=dG(r+1,i):(r=1,n=2),r>n){let t=n;n=r,r=t}return{start:r,end:n}}let dV=(t,e,i,r)=>{let n=function(t,e,i){var r,n,s,a;let o=null!==(r=t.gridTemplateRows)&&void 0!==r?r:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(s=t.gridRowGap)&&void 0!==s?s:0,d=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,u=o.map(t=>dH(t,i)),c=l.map(t=>dH(t,e)),p=Math.max(0,u.reduce((t,e)=>t-e,i)-u.length*h)/o.filter(t=>"auto"===t).length,f=Math.max(0,c.reduce((t,e)=>t-e,e)-c.length*d)/l.filter(t=>"auto"===t).length,g=0,m=u.map((t,e)=>{let i="auto"===o[e]?p:t,r=g;return g+=i+h,r});m.push(g);let v=0,b=c.map((t,e)=>{let i="auto"===l[e]?f:t,r=v;return v+=i+d,r});return b.push(v),{rows:m,columns:b,rowGap:h,columnGap:d}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach(t=>{let e=t.getSpec().layout;t.layoutBounds=function(t,e,i,r,n){let s=t.rows.length,a=t.columns.length,{start:o,end:l}=dU(e,i,s),{start:h,end:d}=dU(r,n,a),u=t.columns[o],c=t.columns[l]-(d===a?0:t.columnGap),p=t.rows[h],f=t.rows[d]-(l===s?0:t.rowGap);return(new io).set(u,p,c,f)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()})},dW=(t,e)=>(0,eC.Z)(t)?e:(0,eT.Z)(t)?e*parseFloat(t)/100:t,dZ={[tz.axis]:0,[tz.legend]:1,[tz.slider]:2,[tz.player]:3,[tz.datazoom]:4},d$=t=>{var e,i,r;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(r=dZ[t.componentType])&&void 0!==r?r:1/0},dY=(t,e,i,r)=>{let n=i.clone(),s=t.getSpec().layout,a=dW(s.maxChildWidth,n.width()),o=dW(s.maxChildHeight,n.width()),l=0,h=0,d=0,u=0;e.forEach(t=>{let e=t.getSpec().layout,s=h$(e.padding),c=r.parseMarkBounds?r.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){let t=Math.min(c.height()+s.top+s.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,c.x1i.x2&&(h=Math.max(h,c.x2-i.x2))}if("left"===e.position||"right"===e.position){let t=Math.min(c.width()+s.left+s.right,a);"left"===e.position?n.x1+=t:n.x2-=t,c.y1i.y2&&(u=Math.max(u,c.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-c.x1,0)+s.left,n.x2-=Math.max(c.x2-i.x2,0)+s.right,n.y1+=Math.max(i.y1-c.y1,0)+s.top,n.y2-=Math.max(c.y2-i.y2)+s.bottom)}),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&di.y2-n.y2&&ud$(t)-d$(e));for(let t=0,e=m.length;t{null==t||t.forEach(t=>{var r;if(t.markType!==tF.group)return;let n=t.layoutChildren,s=t.getSpec().layout,a=null!==(r=t.layoutBounds)&&void 0!==r?r:t.getBounds();if(a){if(r6(s))s.call(null,t,n,a,e);else if(r6(s.callback))s.callback.call(null,t,n,a,e);else if("relative"===s.display){if(s.updateViewSignals){let r=i.getViewBox();r&&a.intersect(r);let s=dY(t,n,a,e),o=s.width(),l=s.height(),h={top:s.y1,right:i.width()-s.x2,left:s.x1,bottom:i.height()-s.y2};i.updateSignal(lz,o),i.updateSignal(lH,l),i.updateSignal(lG,h)}else dY(t,n,a,e)}else"grid"===s.display&&dV(t,n,a,e);dX(n,e,i)}})};class dK extends dF{constructor(t,e,i){super(t,tF.glyph,i),this.glyphType=e,this.glyphMeta=ld.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){let i=function(t,e,i={}){if(!ld.getGraphicType(tF.glyph))return;let r=ld.createGraphic(tF.glyph,i),n=e.getMarks(),s=Object.keys(n).map(t=>{if(ld.getGraphicType(n[t])){let e=ld.createGraphic(n[t]);if(e)return e.name=t,e}});return r.setSubGraphic(s),r}(0,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}function dq(t,e,i=1e-10,r=1e-10){let n=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(r,n)}function dJ(t,e,i,r){return t>e&&!dq(t,e,i,r)}function dQ(t,e,i,r){return t{dq(e,r)&&dq(i,n)||t.push(e,i,r,n,r,n)};function d3(t){let e,i,r,n;let s=t.commandList,a=[],o,l=0,h=0,d=0,u=0,c=(t,e)=>{o&&o.length>2&&a.push(o),o=[t,e]};for(let t=0,a=s.length;tf:em:e2&&a.push(o),a}function d4(t,e){for(let i=0;i{if(!t)return{x:0,y:0,width:0,height:0};let e=(0,eC.Z)(t.width)?t.x1-t.x:t.width,i=(0,eC.Z)(t.height)?t.y1-t.y:t.height,r=0,n=0;return e<0?(r=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:r,y:n,width:e,height:i}};function d8(t,e,i){let r,n;let s=t/e;t>=e?(n=Math.ceil(Math.sqrt(i*s)),0===(r=Math.floor(i/n))&&(r=1,n=i)):(r=Math.ceil(Math.sqrt(i/s)),0===(n=Math.floor(i/r))&&(n=1,r=i));let a=[];for(let t=0;t0)for(let t=0;t{let{width:i,height:r}=d6(t.attribute),n=d8(i,r,e),s=[],a=r/n.length;for(let t=0,e=n.length;t{let i=t.getParsedAngle(),r=i.startAngle,n=i.endAngle,s=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(r-n),l=Math.abs(a-s),h=d8(o*(s+a)/2,l,e),d=[],u=l/h.length,c=a>=s?1:-1,p=n>=r?1:-1;for(let t=0,e=h.length;t{let i=t.getComputedAttribute("startAngle"),r=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),s=Math.abs(i-r),a=d8(s*n,n,e),o=[],l=s/a[0],h=n/a.length,d=r>=i?1:-1;for(let t=0,e=a.length;t{let i=t.filter(t=>!1!==t.defined&&(0,ib.Z)(t.x)&&(0,ib.Z)(t.y));if(0===i.length)return[];if(1===i.length)return Array(e).fill(0).map(t=>i[0]);let r=[];if(e<=i.length){let t=i.length/e,n=0,s=0;for(;n{var i,r;let n=t.attribute,s=n.points,a=n.segments;s||(s=a.reduce((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])},[]));let o=s.filter(t=>!1!==t.defined&&(0,ib.Z)(t.x)&&(0,ib.Z)(t.y));if(!o.length)return[];let l=[];o.forEach(t=>{l.push({x:t.x,y:t.y})});for(let t=o.length-1;t>=0;t--){let e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y})}let h=[];return uo(s,e,h),h},ur=(t,e)=>{let i=t.attribute,r=i.points;return r?ue(r,e):i.segments?ue(i.segments.reduce((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])},[]),e):[]},un=t=>t.map(t=>({x:t.x,y:t.y})),us=(t,e,i)=>{let r=t.length,n=[];for(let o=0;o=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}([e.x,e.y],[i.x,i.y],[l.x,l.y],[h.x,h.y]);d&&"boolean"!=typeof d&&n.push({dot:(s=[d[0]-e.x,d[1]-e.x],a=[i.x-e.x,i.y-e.x],s[0]*a[1]-s[1]*a[0]),point:{x:d[0],y:d[1]},edgeIndex:o})}if(n.length<2)return[un(t),un(t)];n.sort((t,e)=>t.dot-e.dot);let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);let h=o.point,d=l.point,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:d.x,y:d.y});let c=[{x:d.x,y:d.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+r;e<=i;e++){let i=t[e%r];c.push({x:i.x,y:i.y})}return c.push({x:h.x,y:h.y}),[u,c]},ua=t=>{let e=new io;t.forEach(t=>{e.add(t.x,t.y)});let i=e.width(),r=e.height();if(i>=r){let r=e.x1+i/2;return us(t,{x:r,y:e.y1},{x:r,y:e.y2})}let n=e.y1+r/2;return us(t,{x:e.x1,y:n},{x:e.x2,y:n})},uo=(t,e,i)=>{if(1===e)i.push({points:t});else{let r=Math.floor(e/2),n=ua(t);uo(n[0],r,i),uo(n[1],e-r,i)}},ul=(t,e)=>{let i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:un(i)}];let r=[];return uo(i,e,r),r},uh=(t,e)=>{let i=d3(t.getParsedPathShape());if(!i.length||e<0)return[];let r=i.length;if(i.length>=e){let t=[],n=Math.floor(i.length/e);for(let s=0;s2){e.moveTo(r[0],r[1]);for(let t=2;t{t.forEach(t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){let r=nE(t.from,t.to,i,!1);r&&(e[t.key]=r)}})},uu=(t,e,i)=>{let r=[],n=[];e.clear();for(let s=0;s{let r=t?d3(t):[],n=d3(e);i&&r&&(i.fromTransform&&d4(r,i.fromTransform.clone().getInverse()),d4(r,i.toTransfrom));let[s,a]=function(t,e){let i,r;let n=[],s=[];for(let a=0;a({from:s[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0}))},up=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],uf=(t,e)=>{if(!t||!e)return null;let i=[],r=!1;return Object.keys(t).forEach(n=>{if(!up.includes(n))return;let s=e[n];(0,eC.Z)(s)||(0,eC.Z)(t[n])||s===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?nA.Get(t[n],oH.Color255):t[n],to:"string"==typeof s?nA.Get(s,oH.Color255):s,key:n}):i.push({from:t[n],to:s,key:n}),r=!0)}),r?i:null};class ug extends nr{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){let r=this.target,n="function"==typeof r.pathProxy?r.pathProxy(r.attribute):r.pathProxy;uu(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&ud(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}let um=(t,e,i,r)=>{var n,s,a;if(t&&(!t.valid||!t.toCustomPath))return __DEV__&&console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return __DEV__&&console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;r&&o&&(o=r.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));let l=uc(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=uf(null==t?void 0:t.attribute,e.attribute),d=e.animate(i);return(null==i?void 0:i.delay)&&d.wait(i.delay),d.play(new ug({morphingData:l,otherAttrs:h},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:nh.duration,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:nh.easing)),d},uv=(t,e,i)=>{var r;let n=e.filter(t=>t&&t.toCustomPath&&t.valid);n.length||__DEV__&&console.error(n," is not validate"),t.valid&&t.toCustomPath||__DEV__&&console.error(t," is not validate");let s=("clone"===(null==i?void 0:i.splitPath)?u_:null!==(r=null==i?void 0:i.splitPath)&&void 0!==r?r:uw)(t,n.length,!1),a=null==i?void 0:i.onEnd,o=n.length,l=()=>{0==--o&&a&&a()};n.forEach((e,r)=>{var a;let o=s[r],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(r,n.length,o,e):0);um(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)})};class ub extends nr{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren(t=>{t.createPathProxy()}),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren(t=>{t.pathProxy=null})}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren((t,i)=>{var r;uu(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(r=this.otherAttrs)||void 0===r?void 0:r[i])&&this.otherAttrs[i].length&&ud(this.otherAttrs[i],t.attribute,e)}),t&&(this.clearPathProxy(),this.morphingData=null)}}let uy=t=>{let e={};return Object.keys(t).forEach(i=>{nK(i)||(e[i]=t[i])}),e},ux=(t,e,i)=>{let r=uy(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:r}),e.forEach(t=>{n.appendChild(t)});else{let s=t.AABBBounds,a=s.width(),o=s.height();n.setTheme({rect:r}),Array(i).fill(0).forEach(t=>{let i=ru.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)})}},u_=(t,e,i)=>{let r=[],n=i?null:uy(t.attribute),s=t.toCustomPath();for(let t=0;t{let r=[],n=i?null:uy(t.attribute);if("rect"===t.type)d7(t,e).forEach(t=>{r.push(ru.graphicService.creator.rect(i?t:Object.assign({},n,t)))});else if("arc"===t.type)d9(t,e).forEach(t=>{r.push(ru.graphicService.creator.arc(i?t:Object.assign({},n,t)))});else if("circle"===t.type)ut(t,e).forEach(t=>{r.push(ru.graphicService.creator.arc(i?t:Object.assign({},n,t)))});else if("line"===t.type){let s=ur(t,e),a={size:10,symbolType:"circle"};s.forEach(t=>{r.push(ru.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))})}else"polygon"===t.type?ul(t,e).forEach(t=>{r.push(ru.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}):"area"===t.type?ui(t,e).forEach(t=>{r.push(ru.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}):"path"===t.type&&uh(t,e).forEach(t=>{"path"in t?r.push(ru.graphicService.creator.path(i?t:Object.assign({},n,t))):r.push(ru.graphicService.creator.polygon(i?t:Object.assign({},n,t)))});return i&&ux(t,r,e),r},uA=(t,e,i)=>{var r,n,s;let a=t.filter(t=>t.toCustomPath&&t.valid);a.length||__DEV__&&console.error(t," is not validate"),e.valid&&e.toCustomPath||__DEV__&&console.error(e," is not validate");let o=("clone"===(null==i?void 0:i.splitPath)?u_:null!==(r=null==i?void 0:i.splitPath)&&void 0!==r?r:uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);let h=a.map((t,e)=>uc(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix})),d=a.map((t,e)=>uf(t.attribute,l));if(null==i?void 0:i.individualDelay){let r=i.onEnd,n=a.length,s=()=>{0==--n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:oO.ANIMATE_END}),e.detachShadow(),r&&r())};o.forEach((e,r)=>{var n,o,l;let u=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(r,a.length,t[r],e),c=e.animate(Object.assign({},i,{onEnd:s}));c.wait(u),c.play(new ug({morphingData:h[r],saveOnEnd:!0,otherAttrs:d[r]},null!==(o=i.duration)&&void 0!==o?o:nh.duration,null!==(l=i.easing)&&void 0!==l?l:nh.easing))})}else{let t=null==i?void 0:i.onEnd,r=i?Object.assign({},i):{};r.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:oO.ANIMATE_END}),e.detachShadow(),t&&t()};let a=e.animate(r);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new ub({morphingData:h,otherAttrs:d},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:nh.duration,null!==(s=null==i?void 0:i.easing)&&void 0!==s?s:nh.easing))}},uS=Symbol.for("key");class uE{diffGrammar(t,e){return function(t,e,i){let r={enter:[],exit:[],update:[]},n=new dS(t,i);return n.setCallback((t,e,i)=>{(0,eC.Z)(e)?r.exit.push({prev:i[0]}):(0,eC.Z)(i)?r.enter.push({next:e[0]}):r.update.push({next:e[0],prev:i[0]})}),n.setCurrentData(dA(e,i)),n.doDiff(),r}(t,e,t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()})}diffMark(t,e,i){let r={enter:[],exit:[],update:[]},n=[],s=[];t.forEach(t=>{t.markType!==tF.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):r.exit.push({prev:[t]})}),e.forEach(t=>{t.markType!==tF.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):r.enter.push({next:[t]})});let a=this.diffUpdateByGroup(n,s,t=>t.getMorphConfig().morphKey,t=>t.getMorphConfig().morphKey);n=a.prev,s=a.next,r.update=r.update.concat(a.update);let o=this.diffUpdateByGroup(n,s,t=>t.id(),t=>t.id());n=o.prev,s=o.next,r.update=r.update.concat(o.update);let l=dA(n,t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}),h=dA(s,t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)});return Object.keys(h).forEach(t=>{let e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t)),s=s.filter(t=>!i.includes(t))}}),n.forEach(t=>r.exit.push({prev:[t]})),s.forEach(t=>r.enter.push({next:[t]})),r}_appendMorphKeyToElements(t){let e=t.getMorphConfig();if(!(0,eC.Z)(e.morphElementKey)){let i=lr(e.morphElementKey);t.elements&&t.elements.forEach(t=>{t.morphKey=i(t.getDatum())})}}morph(t,e,i){let r=t.reduce((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements)),[]),n=function(t,e,i){let r={enter:[],exit:[],update:[]},n=new dS(t,i);return n.setCallback((t,e,i)=>{(0,eC.Z)(e)?r.exit.push({prev:i}):(0,eC.Z)(i)?r.enter.push({next:e}):r.update.push({next:e,prev:i})}),n.setCurrentData(dA(e,i)),n.doDiff(),r}(r,e.reduce((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements)),[]),t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key});t.forEach(t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}),e.forEach(t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)});let s=t.concat(e).reduce((t,e)=>(Object.assign(t,e.parameters()),t),{}),a=0,o=()=>{0==(a-=1)&&e.forEach(t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})};n.enter.forEach(t=>{t.next.forEach(t=>{this.doMorph([],[t],i,o,s)}),a+=1}),n.update.forEach(t=>{let e=Math.min(t.prev.length,t.next.length),r=this.divideElements(t.prev,e),n=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:uS}),s=dA(e,t=>{var e;return null!==(e=r(t))&&void 0!==e?e:uS}),a=t,o=e,l=[];return s.keys.forEach(t=>{if(t!==uS){let e=n.data.get(t),i=s.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter(t=>!e.includes(t)),o=o.filter(t=>!i.includes(t)))}}),{prev:a,next:o,update:l}}doMorph(t,e,i,r,n){var s,a;let o={prev:t.map(t=>t.getDatum()),next:e.map(t=>t.getDatum())},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,d=lt(i.animation.delay,n,o,l),u=lt(i.animation.duration,n,o,l),c=lt(i.animation.oneByOne,n,o,l),p=lt(i.animation.splitPath,n,o,l),f=(0,ef.Z)(c)&&c>0?t=>(0,ib.Z)(c)?t*c:!0===c?t*u:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?uv(t[0].getGraphicItem(),e.map(t=>t.getGraphicItem()),{delay:d,duration:u,easing:h,onEnd:r,individualDelay:f,splitPath:p}):t.length>1&&1===e.length&&uA(t.map(t=>t.getGraphicItem()),e[0].getGraphicItem(),{delay:d,duration:u,easing:h,onEnd:r,individualDelay:f,splitPath:p}):um(null===(a=null===(s=t[0])||void 0===s?void 0:s.getGraphicItem)||void 0===a?void 0:a.call(s),e[0].getGraphicItem(),{delay:d,duration:u,easing:h,onEnd:r})}divideElements(t,e){let i=Math.floor(t.length/e);return Array(e).fill(0).map((r,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1)))}}class uT{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=(0,eT.Z)(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;let r=t.grammarType,n=this._mapKey(t);return this._grammarMap[r]?(this._grammars[r].push(t),(0,eC.Z)(n)||(this._grammarMap[r][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[r][n]=t)):(this._grammars.customized.push(t),(0,eC.Z)(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){let e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter(e=>e!==t),(0,eC.Z)(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter(e=>e!==t),(0,eC.Z)(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach(e=>(null!=e?e:[]).forEach(e=>{t.call(null,e)}))}find(t){let e=null;return this.traverse(i=>!0===t.call(null,i)&&(e=i,!0)),e}filter(t){let e=[];return this.traverse(i=>{!0===t.call(null,i)&&e.push(i)}),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class uC extends uT{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){let e={mark:t,parent:null,children:[]};this._markNodes.forEach(i=>{let r=i.mark;r.markType===tF.group&&r.includesChild(t,!1)?(i.children.push(e),e.parent=i):t.markType===tF.group&&t.includesChild(r,!1)&&(e.children.push(i),i.parent=e)}),this._markNodes.push(e)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){let e=this._markNodes.find(e=>e.mark===t);this._markNodes.forEach(i=>{let r=i.mark;r.markType===tF.group&&r.includesChild(t,!1)?(i.children=i.children.filter(t=>t!==e),e.parent=null):t.markType===tF.group&&t.includesChild(r,!1)&&(e.children=e.children.filter(t=>t!==i),i.parent=null)}),this._markNodes=this._markNodes.filter(t=>t!==e)}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class uk{constructor(t){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter(t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()}),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(tX.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter(t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()}),this._animations=this._animations.filter(e=>e.config!==t.animationConfig||e.mark!==t.mark),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(tX.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(tX.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(tX.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree(t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))}),this._additionalAnimateMarks.forEach(t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))}),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree(t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))}),this._additionalAnimateMarks.forEach(t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))}),this}resume(){return this._view.traverseMarkTree(t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))}),this._additionalAnimateMarks.forEach(t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))}),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree(t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))}),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree(t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))}),this._additionalAnimateMarks.forEach(t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))}),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree(e=>{var i,r;e.animate&&(null===(r=(i=e.animate).enableAnimationState)||void 0===r||r.call(i,t))}),this}disableAnimationState(t){return this._view.traverseMarkTree(e=>{var i,r;e.animate&&(null===(r=(i=e.animate).disableAnimationState)||void 0===r||r.call(i,t))}),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some(t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1})}animate(){return this.isEnabled&&this._view.traverseMarkTree(t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1},null,!0),this}animateAddition(t){let e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(tX.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(tX.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class uM extends dF{addGraphicItem(t,e){let i=t&&t.limitAttrs,r=hJ(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?tF.richtext:tF.text,t);return super.addGraphicItem(t,e,r)}release(){super.release()}}uM.markType=tF.text;let uB={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},uP={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},uR=Object.assign({},uB);uR.axis=Object.assign({},uR.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uR.circleAxis=Object.assign({},uR.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uR.grid=Object.assign({},uR.grid,{style:{stroke:"#404349"}}),uR.circleGrid=Object.assign({},uR.circleGrid,{style:{stroke:"#404349"}}),uR.rectLabel=Object.assign({},uR.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uR.lineLabel=Object.assign({},uR.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uR.symbolLabel=Object.assign({},uR.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uR.title=Object.assign({},uR.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});class uO{static registerTheme(t,e){t&&uO._themes.set(t,e)}static unregisterTheme(t){uO._themes.delete(t)}static getTheme(t){return uO._themes.get(t)}static getDefaultTheme(){return uO.getTheme("default")}}uO._themes=new Map,uO.registerTheme("default",{name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:uP,components:uB}),uO.registerTheme("dark",{name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:uP,components:uR});class uI extends dF{constructor(t,e,i,r){super(t,tF.component,i),this._componentDatum={key:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=r,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){let r=null!=i?i:ld.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return this.emit(tX.BEFORE_ADD_VRENDER_MARK,{graphicItem:r}),this.graphicParent.appendChild(r),this.emit(tX.AFTER_ADD_VRENDER_MARK,{graphicItem:r}),r}join(t){return super.join(t,"key")}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum.key+=1}evaluateJoin(t){return this.spec.key="key",t?(t.key=this._componentDatum.key,this._componentDatum=t):this._componentDatum={key:this._componentDatum.key},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uL extends ec(){static useRegisters(t){t.forEach(t=>{t()})}constructor(t={},e={}){super(),this._observer=null,this._onResize=em((...t)=>{let e=this._getContainerSize();e&&this.resize(e.width,e.height)},100),this.delegateEvent=(t,e)=>{var i;let r=null===(i=t.target)||void 0===i?void 0:i[l4],n=hG(this,t,r,e,lD);this.emit(e,n,r)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach(t=>{t.isDoingProgressive()&&t.evaluateProgressive()}),this.doPreProgressive()},this._config=e,this._options=Object.assign({mode:"browser"},t),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter(e=>e.name()===t)}getGrammarsByType(t){return this.grammars.filter(e=>e.grammarType===t)}getMarksByType(t){return this.grammars.getAllMarks().filter(e=>e.markType===t)}getMarksByName(t){return this.grammars.getAllMarks().filter(e=>e.name()===t)}getMarksBySelector(t){if(!t)return null;let e=ex(t),i=[];return e.forEach(t=>{if(li(t))return void i.push(t);if("#"===t[0]){let e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}let e="@"===t[0]?this.getMarksByName(t.slice(1)):hq(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach(t=>{i.push(t)})}),i}updateSignal(t,e){(0,eT.Z)(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){let i=new hU(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){let e=new lI(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){let e=ld.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){let e=ld.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){let r;let n=(0,eT.Z)(e)?this.getMarkById(e):e;switch(t){case tF.group:r=new dz(this,n);break;case tF.glyph:r=new dK(this,null==i?void 0:i.glyphType,n);break;case tF.component:r=ld.hasComponent(null==i?void 0:i.componentType)?ld.createComponent(null==i?void 0:i.componentType,this,n,null==i?void 0:i.mode):new uI(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case tF.text:r=new uM(this,t,n);break;default:r=ld.hasMark(t)?ld.createMark(t,this,n):new dF(this,t,n)}return this.grammars.record(r),this._dataflow.add(r),r}group(t){return this.mark(tF.group,t)}glyph(t,e){return this.mark(tF.glyph,e,{glyphType:t})}component(t,e,i="2d"){return this.mark(tF.component,e,{componentType:t,mode:i})}axis(t,e="2d"){return this.mark(tF.component,t,{componentType:tz.axis,mode:e})}grid(t,e="2d"){return this.mark(tF.component,t,{componentType:tz.grid,mode:e})}legend(t){return this.mark(tF.component,t,{componentType:tz.legend})}slider(t){return this.mark(tF.component,t,{componentType:tz.slider})}label(t){return this.mark(tF.component,t,{componentType:tz.label})}datazoom(t){return this.mark(tF.component,t,{componentType:tz.datazoom})}player(t){return this.mark(tF.component,t,{componentType:tz.player})}title(t){return this.mark(tF.component,t,{componentType:tz.title})}scrollbar(t){return this.mark(tF.component,t,{componentType:tz.scrollbar})}customized(t,e){let i=ld.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find(e=>e.uid===t.uid)||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){let e=(0,eT.Z)(t)?this.getGrammarById(t):t;return e&&this.grammars.find(t=>t.uid===e.uid)&&("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0),this}removeAllGrammars(){return this.grammars.traverse(t=>{"signal"===t.grammarType&&hW.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)}),this}removeAllGraphicItems(){return this.traverseMarkTree(t=>{t.graphicItem&&(hQ(t.graphicItem),t.elementMap.forEach(t=>{t.resetGraphicItem()}),t.graphicItem=null)}),this}parseSpec(t){var e,i,r,n,s,a;if(this.emit(tX.BEFORE_PARSE_VIEW),this._spec=t,hY(t),t.theme?this.theme(t.theme):this.theme(uO.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){let t=this._getContainerSize();t&&(this.updateSignal(lj,t.width),this.updateSignal(lF,t.height))}(null===(r=t.signals)||void 0===r?void 0:r.length)&&t.signals.forEach(t=>{this.signal().parse(t)}),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach(t=>{this.data(null).parse(t)}),(null===(s=t.coordinates)||void 0===s?void 0:s.length)&&t.coordinates.forEach(t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)}),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach(t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)});let o=ld.getGrammars();return Object.keys(o).forEach(e=>{let{specKey:i}=o[e];t[i]&&t[i].length&&t[i].forEach(t=>{this.customized(e,t)})}),t.marks&&t.marks.length&&t.marks.forEach(t=>{this.parseMarkSpec(t)}),t.events&&t.events.length&&t.events.forEach(t=>{this.event(t)}),t.interactions&&t.interactions.length&&t.interactions.forEach(t=>{this.interaction(t.type,t)}),!1===t.animation?this.animate.disable():this.animate.enable(),this.emit(tX.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=tY.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){hZ(this._options,this._config,this.getCurrentTheme()).forEach(t=>{let e=this.signal().parse(t);t.value&&e.set(t.value)}),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;let i=t.type===tF.glyph?{glyphType:t.glyphType}:t.type===tF.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach(t=>{this.parseMarkSpec(t)})}theme(t){var e,i,r,n,s,a;(0,eT.Z)(t)?this._theme=null!==(e=uO.getTheme(t))&&void 0!==e?e:uO.getDefaultTheme():this._theme=t;let{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(r=null!=o?o:this._options.background)&&void 0!==r?r:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(s=this.renderer.stage())||void 0===s?void 0:s.setTheme)||void 0===a||a.call(s,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t,e=!0){return this.theme(t),this.grammars.getAllMarks().forEach(t=>{t.commit()}),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){let e=this.getSignalById(lj);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){let e=this.getSignalById(lF);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){let e=this.getSignalById(lz);if(arguments.length){let e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){let e=this.getSignalById(lH);if(arguments.length){let e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){let e=this.getSignalById(lG);if(arguments.length){let i=h$(t);return this.updateSignal(e,i),i}return h$(e.output())}autoFit(t){let e=this.getSignalById(lV);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){let t=this.getSignalById(lU);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=tY.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){let t={},e=[];this.traverseMarkTree(i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===tF.group&&i.updateLayoutChildren()},t=>t.needLayout()),this._layoutMarks=e}doLayout(){var t;let e=this._options.doLayout||dX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(tX.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(tX.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(tX.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach(t=>{l3(t,"layoutChildren",t=>{t.handleLayoutEnd()},e=>e!==t)}),this.emit(tX.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(tX.BEFORE_MARK_RENDER_END),l3(this.rootMark,"children",t=>{t.handleRenderEnd()}),this.emit(tX.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(tX.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(tX.AFTER_DO_RENDER)}evaluate(t){var e,i;let r=hX(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(r),this.detachCachedGrammar());let s=this._resizeRenderer(),a=this._dataflow.hasCommitted();return(n||a||this._layoutState||s)&&(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=tY.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=tY.reevaluate,this._dataflow.evaluate()),this._layoutState=tY.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach(t=>{this._morph.morph(t.prev,t.next,r)}),this._willMorphMarks=null,this.releaseCachedGrammars(r),this.doRender(!0),this.doPreProgressive()),this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){let t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter(t=>!hW.includes(t.id()))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter(t=>"root"!==t.id()),t).update.forEach(e=>{let i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,r=e.prev.every(t=>t.getMorphConfig().morph)&&e.next.every(t=>t.getMorphConfig().morph);i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&r||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})})}detachCachedGrammar(){this._cachedGrammars.traverse(t=>{var e,i;t.detachAll(),"mark"===t.grammarType&&(null===(i=null===(e=t.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,t))})}releaseCachedGrammars(t){this._cachedGrammars.traverse(t=>{"mark"!==t.grammarType&&t.release()});let e=this._cachedGrammars.getAllMarkNodes();e.forEach(e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)});let i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();let e=t.parent;e&&(t.parent.children=t.parent.children.filter(e=>e!==t),t.parent=null,i(e))}};e.forEach(t=>{let e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",()=>{0===e.animate.getAnimatorCount()&&i(t)})}),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter(()=>{t.call(null,this)}),this}runBefore(t){return this._dataflow.runBefore(()=>{t.call(null,this)}),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(TypeError("getImageBuffer() now only support node environment."));let i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return l3(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,r,n,s;if(this.autoFit()){let a=null===(n=null===(r=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===r?void 0:r.getContainer)||void 0===n?void 0:n.call(r);if(a){let t=window.ResizeObserver;this._observer=new t(this._onResize),null===(s=this._observer)||void 0===s||s.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,r,n,s,a,o,l,h,d;let u=null===(n=null===(r=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===r?void 0:r.getContainer)||void 0===n?void 0:n.call(r);if(u){let{width:t,height:e}=function(t,e=0,i=0){let r;if(!t)return{width:e,height:i};try{r=null==window?void 0:window.getComputedStyle}catch(t){r=()=>({})}let n=r(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){let r=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,s=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:r<=0?e:r,height:s<=0?i:s}}return{width:e,height:i}}(u);return{width:null!==(o=null!==(a=null===(s=this._spec)||void 0===s?void 0:s.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(d=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==d?d:e}}return null}resize(t,e,i=!0){let r=!1;return t!==this.width()&&(r=!0,this.updateSignal(lj,t)),e!==this.height()&&(r=!0,this.updateSignal(lF,e)),r&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){let t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;let{type:e,filter:i,callback:r,throttle:n,debounce:s,consume:a,target:o,dependency:l}=t,h=h2(e);if(!h)return;let{source:d,type:u}=h,c=h0(h),p=(Array.isArray(o)&&o.length?o.map(t=>({signal:this.getSignalById(t.target),callback:t.callback})):[{signal:(0,eT.Z)(o)?this.getSignalById(o):null,callback:r}]).filter(t=>t.signal||t.callback),f=o8(l,this),g=h1((t,e)=>{let r=d===lD&&function(t,e){let i=t.defaults,r=i.prevent,n=i.allow;return!1!==r&&!0!==n&&(!0===r||!1===n||(r?r[e]:!!n&&!n[e]))}(this._eventConfig,u)||a&&(void 0===t.cancelable||t.cancelable);d===lL&&(t=hG(this,t,e,u,lL));let n=!1;if((!i||i(t))&&(!c||c(e))&&p.length){let e=f.reduce((t,e)=>(t[e.id()]=e.output(),t),{});p.forEach(i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)})}r&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()},{throttle:n,debounce:s});if(d===lD){if(function(t,e,i){let r=null==t?void 0:t[e];return!(!1===r||(0,ep.Z)(r)&&!r[i])}(this._eventConfig,lD,u))return this.addEventListener(u,g,lN),()=>{this.removeEventListener(u,g)}}else if(d===lL)return o2.addEventListener(u,g),this._eventListeners.push({type:u,source:o2,handler:g}),()=>{o2.removeEventListener(u,g);let t=this._eventListeners.findIndex(t=>t.type===u&&t.source===o2&&t.handler===g);t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){let e;let[i,r]=t.between,n=`${i.type}-${t.type}-${r.type}`;this.bindEvents(Object.assign({},i,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){let e=this.bindEvents(t);this._eventCache[n]=e}e||(e=this.bindEvents(Object.assign({},r,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach(e=>{let i=Object.assign({},t);(0,eT.Z)(e)?i.type=e:(0,ep.Z)(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)}):this.bindEvents(t)}interaction(t,e){let i=ld.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){let i=this._boundInteractions.filter(i=>{var r;return(0,eC.Z)(e)?(0,eT.Z)(t)?i.type===t:t?i===t:void 0:(null===(r=i.options)||void 0===r?void 0:r.id)===e});i.length&&i.forEach(t=>{t.unbind()})}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach(t=>{t.unbind()}),this._boundInteractions=null),this}initEvent(){let t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){let t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let r=e;return i&&!1===i.trap||((r=e).raw=e),i&&i.target&&(r.target=i.target),this.on(t,r),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){let t=this._options.width,e=this._options.height;this.renderer=new hF(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new uT(t=>t.id(),(t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e)),this._cachedGrammars=new uC(t=>t.id()),this._options.logger&&ek.Y.setInstance(this._options.logger),this.logger=ek.Y.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new l5,this.animate=new uk(this),this._morph=new uE,this._options.hooks&&(Object.keys(this._options.hooks).forEach(t=>{this.on(t,this._options.hooks[t])}),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){let e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach(e=>{(0,ev.Z)(t[e])&&(t[e]=t[e].reduce((t,e)=>(t[e]=!0,t),{}))})};return i(e.defaults,["prevent","allow"]),i(e,[lD,lL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:uO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&o2.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=tY.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){let t=[];return this.traverseMarkTree(e=>{t.push(e)},t=>t.markType!==tF.group&&t.isProgressive()),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some(t=>t.isDoingProgressive())){let t=o2.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&o2.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach(t=>{t.clearProgressive()}),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),ld.unregisterRuntimeTransforms(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach(t=>{t.source.removeEventListener(t.type,t.handler)}),this._eventListeners=null}}(B=t1||(t1={})).Identity="identity",B.Linear="linear",B.Log="log",B.Pow="pow",B.Sqrt="sqrt",B.Symlog="symlog",B.Time="time",B.Quantile="quantile",B.Quantize="quantize",B.Threshold="threshold",B.Ordinal="ordinal",B.Point="point",B.Band="band";let uD={};function uN(t){switch(t){case t1.Linear:case t1.Log:case t1.Pow:case t1.Sqrt:case t1.Symlog:case t1.Time:return!0;default:return!1}}function uj(t){switch(t){case t1.Ordinal:case t1.Point:case t1.Band:return!0;default:return!1}}Object.values(t1).forEach(t=>{uD[t]=!0});function uF(t){return Number(t)}function uz(t,e){return te?1:t>=e?0:NaN}function uH(t,e,i=0,r){for((0,eC.Z)(r)&&(r=t.length);i>>1;uz(t[n],e)>0?r=n:i=n+1}return i}function uG(t){return t}let uU=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t),uV=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),uW=t=>t<0?-t*t:t*t,uZ=t=>-Math.log(-t),u$=t=>-Math.exp(-t),uY=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,uX=t=>10===t?uY:t===Math.E?Math.exp:e=>Math.pow(t,e),uK=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),uq=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),uJ=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function uQ(t,e){if(t=Number(t),e=Number(e)-t)return i=>(i-t)/e;let i=Number.isNaN(e)?NaN:.5;return()=>i}function u0(t,e,i){let r,n;let s=t[0],a=t[1],o=e[0],l=e[1];return an(r(t))}function u1(t,e,i){let r;return r=1===t?t+2*i:t-e+2*i,t?r>0?r:1:0}function u2(t,e){let i=(t[1]-t[0])/(e[1]-e[0]),r=t[0]-i*e[0];return[r,i+r]}function u5(t,e,i){let r=Math.min(t.length,e.length)-1,n=Array(r),s=Array(r),a=-1;for(t[r]{let i=t.slice(),r=0,n=i.length-1,s=i[r],a=i[n];return a{let i=Math.floor(Math.log10(t)),r=t/Math.pow(10,i);return(e?r<1.5?1:r<3?2:r<7?5:10:r<=1?1:r<=2?2:r<=5?5:10)*Math.pow(10,i)},u6=(t,e)=>{let i,r;return e[0]t>=0&&t<=1)&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):ey(this._rangeFactorStart)&&ey(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return(0,eC.Z)(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0===t&&((0,eC.Z)(this._rangeFactorEnd)||1===this._rangeFactorEnd)?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1)),this)}rangeFactorEnd(t,e){var i;return(0,eC.Z)(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0===t&&((0,eC.Z)(this._rangeFactorStart)||0===this._rangeFactorStart)?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);let{distortion:e=2,radiusRatio:i=.1,radius:r}=this._fishEyeOptions,n=this.range(),s=n[0],a=n[n.length-1],o=Math.min(s,a),l=Math.max(s,a),h=nd(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),d=(0,eC.Z)(r)?(l-o)*i:r,u=Math.exp(e);u=u/(u-1)*d;let c=e/d;this._fishEyeTransform=t=>{let e=Math.abs(t-h);return e>=d?t:e<=1e-6?h:h+(t-h)*(u*(1-Math.exp(-e*c))/e*.75+.25)}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}let u7=Symbol("implicit");class u9 extends u8{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=t1.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=u7}clone(){let t=(new u9).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return ey(this._rangeFactorStart)&&ey(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){let e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let r=this._index.get(e);if(!r){if(this._unknown!==u7)return this._unknown;r=this._domain.push(t),this._index.set(e,r)}let n=this._ordinalRange[(r-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ee&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}function ce(t,e,i,r){let n=[],s=t;for(;s<=e;)n.push(s),s+=i;return r&&n.reverse(),n}function ci(t,e,i,r){let n,s;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(n=ei&&a>1;)a-=1,s=Math.floor((e-t)/a);return ce(t,e,s,n)}class cr extends u9{constructor(t){super(),this.type=t1.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;let i=this._calculateWholeRange(this._range,e),r=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=h,this._isFixed=!1)}if(this.isBandwidthFixed()){;let i=(o=super.domain().length,l=this._bandwidth,h=this._paddingInner,d=this._paddingOuter,1===h&&(h=0),u1(o,h,d)*(l/(1-h))*Math.sign(t[1]-t[0])),r=Math.min((t[1]-t[0])/i,1);if(ey(this._rangeFactorStart)&&ey(this._rangeFactorEnd)){if(i>0){let e=t[0]-i*this._rangeFactorStart;this._wholeRange=[e,e+i]}else{let e=t[1]+i*(1-this._rangeFactorEnd);this._wholeRange=[e-i,e]}let n=this._rangeFactorStart+r<=1,s=this._rangeFactorEnd-r>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+r:"rangeFactorEnd"===e&&s?this._rangeFactorStart=this._rangeFactorEnd-r:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+r:s?this._rangeFactorStart=this._rangeFactorEnd-r:(this._rangeFactorStart=0,this._rangeFactorEnd=r):s?this._rangeFactorStart=this._rangeFactorEnd-r:n?this._rangeFactorEnd=this._rangeFactorStart+r:(this._rangeFactorStart=1-r,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=r,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){let t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){let e=this._domain;if(ey(this._rangeFactorStart)&&ey(this._rangeFactorEnd)&&e.length){let i=this._getInvertIndex(t[0]),r=this._getInvertIndex(t[1]);return e.slice(Math.min(i,r),Math.max(i,r)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[uF(t[0]),uF(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[uF(t[0]),uF(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){let e=this.calculateVisibleDomain(this._range);return -1===t?e:ci(0,e.length-1,t,!1).map(t=>e[t])}tickData(t=10){return this.ticks(t).map((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])}))}forceTicks(t=10){let e=this.calculateVisibleDomain(this._range);return ci(0,e.length-1,t,!0).filter(t=>te[t])}stepTicks(t){let e=this.calculateVisibleDomain(this._range);return(function(t,e,i){let r;if(i=ct(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),r=ee[t])}_getInvertIndex(t){let e=0,i=this.step()/2,r=this.bandwidth()/2,n=this._domain.length,s=this.range(),a=s[0]>s[s.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return(0,eC.Z)(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return(0,eC.Z)(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&(0,ib.Z)(this._userBandwidth)}clone(){var t,e,i;return new cr(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}function cn(t,e,i){ey(e)||(e=t,t=0),ey(i)||(i=1);let r=-1,n=0|Math.max(0,Math.ceil((e-t)/i)),s=Array(n);for(;++r{let e=null,i=null;return(...r)=>(e&&r.every((t,i)=>t===e[i])||(e=r,i=t(...r)),i)},ca=Math.sqrt(50),co=Math.sqrt(10),cl=Math.sqrt(2),ch=[1,2,5,10],cd=(t,e,i)=>{let r=1,n=t,s=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?r=cg(a).step:(i||a>1)&&(n=Math.floor(t)-s*r),r>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*r)),cn(0,e).map(t=>n+t*r)):t>0?cc(0,-(e-1)/r,r):cc((e-1)/r,0,r)},cu=cs((t,e,i,r)=>{let n,s,a,o,l=-1;if(i=+i,(t=+t)==(e=+e)||Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),r=Math.round(e/o);for(i*oe&&--r,a=Array(s=r-i+1);++le&&--r,a=Array(s=r-i+1);++l{let r,n,s=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=Array(r=o-a+1);++se&&--o,n=Array(r=o-a+1);++s{let r;let n=t[0],s=t[t.length-1],a=e-t.length;if(s<=0){let e=[];for(r=a;r>=1;r--)e.push(n-r*i);return e.concat(t)}if(n>=0){for(r=1;r<=a;r++)t.push(s+r*i);return t}let o=[],l=[];for(r=1;r<=a;r++)r%2==0?o=[n-Math.floor(r/2)*i].concat(o):l.push(s+Math.ceil(r/2)*i);return o.concat(t).concat(l)},cf=cs((t,e,i,r)=>{let n,s,a;if(i=+i,(t=+t)==(e=+e)||Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cd(t,i,null==r?void 0:r.noDecimals);(n=e0){let r=1,{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;r<=5&&(s=cc(t,e,l)).length>i+1&&i>2;)l+=h,r+=1;i>2&&s.length{let e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e,r=1;return i>=ca?r=10:i>=co?r=5:i>=cl&&(r=2),e>=0?{step:r*10**e,gap:r,power:e}:{step:-(10**-e)/r,gap:r,power:e}};function cm(t,e,i){return cg((e-t)/Math.max(0,i))}function cv(t,e,i){let r;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(r=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(r))return[];let n=Array(i);for(let e=0;e0;){if((r=cm(a,o,e).step)===i)return t[n]=a,t[s]=o,t;if(r>0)a=Math.floor(a/r)*r,o=Math.ceil(o/r)*r;else{if(!(r<0))break;a=Math.ceil(a*r)/r,o=Math.floor(o*r)/r}i=r}}function cx(t,e){let i=(0,ib.Z)(e.forceMin),r=(0,ib.Z)(e.forceMax),n=null,s=[],a=null,o=i&&r?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:r?t=>t<=e.forceMax:null;return i?s[0]=e.forceMin:(0,ib.Z)(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(s[0]=e.min),r?s[1]=e.forceMax:(0,ib.Z)(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(s[1]=e.max),(0,ib.Z)(s[0])&&(0,ib.Z)(s[1])?((a=t.slice())[0]=s[0],a[a.length-1]=s[1]):n=(0,ib.Z)(s[0])||(0,ib.Z)(s[1])?(0,ib.Z)(s[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:s,domainValidator:o}}let c_=(t,e,i)=>1>Math.abs(e-t)?+i.toFixed(1):Math.round(+i),cw=cs((t,e,i,r,n,s,a)=>{let o=t,l=e,h=l0){for(;c<=p;++c)for(d=1;dl)break;f.push(u)}}else for(;c<=p;++c)for(d=r-1;d>=1;--d)if(!((u=c>0?d/s(-c):d*s(c))l)break;f.push(u)}2*f.length0!==t),(null==a?void 0:a.noDecimals)&&(f=Array.from(new Set(f.map(t=>Math.floor(t))))),h?f.reverse():f}),cA=cs((t,e,i,r,n,s)=>{let a=[],o={},l=n(t),h=n(e),d=[];if(Number.isInteger(r))d=cf(l,h,i);else{let t=(h-l)/(i-1);for(let e=0;e{let n=s(i),l=Number.isInteger(r)?c_(t,e,n):c_(t,e,u4(n)),h=c_(t,e,u6(l,[t,e]));o[h]||isNaN(h)||!(d.length>1)||(o[h]=1,a.push(h))}),a}),cS=cs((t,e,i,r,n)=>cv(r(t),r(e),i).map(t=>u4(n(t))));function cE(t){let e="",i="",r="",n="#"===t[0]?1:0;for(let s=n;snew nw(Math.round(i*(1-t)+r*t),Math.round(n*(1-t)+s*t),Math.round(a*(1-t)+o*t),l*(1-t)+h*t)}function ck(t,e){return i=>t*(1-i)+e*i}function cM(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}cs((t,e,i,r,n)=>cb(r(t),r(e),i).map(t=>u4(n(t))));RegExp(/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g.source,"g");let{interpolateRgb:cB}=eh;function cP(t,e){let i;let r=typeof e;if((0,eC.Z)(e)||"boolean"===r)return()=>e;if("number"===r)return ck(t,e);if("string"===r){if(i=n_.parseColorString(e)){let e=cB(n_.parseColorString(t),i);return t=>e(t).formatRgb()}return ck(Number(t),Number(e))}return e instanceof nw?cB(t,e):e instanceof n_?cB(t.color,e.color):e instanceof Date?function(t,e){let i=t.valueOf(),r=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+r*t),n)}(t,e):ck(Number(t),Number(e))}class cR extends u8{constructor(t=uG,e=uG){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=uG,this._piecewise=u0,this._interpolate=cP}calculateVisibleDomain(t){var e;return ey(this._rangeFactorStart)&&ey(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(Number.isNaN(t=Number(t))||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));let i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),ck)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;let r=Array.from(t,uF);return this._domain=r,this.rescale(e)}range(t,e){if(!t)return this._range.slice();let i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){let i=Array.from(t);return this._range=i,this._interpolate=cM,this.rescale(e)}rescale(t){var e;if(t)return this;let i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,r=i.length,n=this._range.length,s=Math.min(r,n);if(r&&r=2?(e-i[r-2])/t:0;for(let n=1;n<=t;n++)i[r-2+n]=e-a*(t-n);s=n}return this._autoClamp&&(this._clamp=ct(i[0],i[s-1])),this._piecewise=s>2?u5:u0,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:uG),this.rescale(i)):this._clamp!==uG}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){let e=this.ticks(t);return(null!=e?e:[]).map((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])}))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return(0,eC.Z)(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return(0,eC.Z)(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}class cO extends cR{constructor(){super(...arguments),this.type=t1.Linear}clone(){return(new cO).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(t=10,e){let i=this.calculateVisibleDomain(this._range);return cu(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(r6(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(ey(this._rangeFactorStart)&&ey(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);let r=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,s=r[0],a=r[r.length-1],o=cf(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==s||o[o.length-1]!==a)&&this._niceType){let t=r.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==s?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){let e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter(t=>t>=e&&t<=i)}}return o}forceTicks(t=10){let e=this.calculateVisibleDomain(this._range);return cv(e[0],e[e.length-1],t)}stepTicks(t){let e=this.calculateVisibleDomain(this._range);return cb(e[0],e[e.length-1],t)}nice(t=10,e){var i,r;let n=this._domain,s=[];if(e){let t=cx(n,e);if(s=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){let e=cy(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=s[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(r=s[0])&&void 0!==r?r:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(t=10){this._niceType="min";let e=this._domain[this._domain.length-1],i=cy(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(t=10){this._niceType="max";let e=this._domain[0],i=cy(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function cI(t,e,i=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){let r=Object.getOwnPropertyNames(e);for(let n=0;nMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(s=o[0])&&void 0!==s?s:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){let t=this._domain[this._domain.length-1];this.nice();let e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){let t=this._domain[0];this.nice();let e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function cD(t){return e=>-t(-e)}function cN(t=Number.EPSILON){return e=>Math.max(e,t)}class cj extends cR{constructor(){super(uK(10),uX(10)),this.type=t1.Log,this._limit=cN(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new cj).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e,i,r;if(t)return this;super.rescale();let n=uK(this._base),s=uX(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=(i=n,t=>-i(-t)),this._pows=(r=s,t=>-r(-t)),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=uZ,this.untransformer=u$):(this._logs=n,this._pows=s,this._limit=cN(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(Number.isNaN(t=Number(t))||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));let i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return uG}d3Ticks(t=10,e){let i=this.domain(),r=this._limit(i[0]);return cw(r,this._limit(i[i.length-1]),t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){let e=this.calculateVisibleDomain(this._range);return cA(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){let e=this.calculateVisibleDomain(this._range);return cS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){let e=this.calculateVisibleDomain(this._range);return cS(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}cI(cj,cL);class cF extends cr{constructor(t){super(!1),this.type=t1.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class cz extends cO{constructor(){super(),this.type=t1.Pow,this._exponent=1}clone(){return(new cz).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=uG,this.untransformer=uG):.5===this._exponent?(this.transformer=uV,this.untransformer=uW):(this.transformer=uU(this._exponent),this.untransformer=uU(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function cH(t,e,i=uF){let r=t.length;if(!r)return;if(e<=0||r<2)return i(t[0],0,t);if(e>=1)return i(t[r-1],r-1,t);let n=(r-1)*e,s=Math.floor(n),a=i(t[s],s,t);return a+(i(t[s+1],s+1,t)-a)*(n-s)}class cG{constructor(){this.type=t1.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0,i=Math.max(1,this._range.length);for(this._thresholds=Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];let i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();let i=Array.from(t);return eS(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new cU).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(t=10){let e=this.domain();return cf(e[0],e[e.length-1],t)}forceTicks(t=10){let e=this.domain();return cv(e[0],e[e.length-1],t)}stepTicks(t){let e=this.domain();return cb(e[0],e[e.length-1],t)}nice(t=10){let e=cy(this.domain(),t);return e?this.domain(e):this}niceMin(t=10){let e=this._domain[this._domain.length-1],i=cy(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(t=10){let e=this._domain[0],i=cy(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class cV extends cO{constructor(){super(uV,uW),this.type=t1.Sqrt}clone(){return(new cV).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class cW extends cO{constructor(){super(uq(1),uJ(1)),this.type=t1.Symlog,this._const=1}clone(){return(new cW).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=uq(t),this.untransformer=uJ(t),this.rescale(e)):this._const}d3Ticks(t=10,e){let i=this.domain(),r=i[0];return cw(r,i[i.length-1],t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){let e=this.calculateVisibleDomain(this._range);return cA(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){let e=this.calculateVisibleDomain(this._range);return cS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){let e=this.calculateVisibleDomain(this._range);return cS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}cI(cW,cL);class cZ{constructor(){this.type=t1.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!(0,eC.Z)(t)&&(0,ef.Z)(+t)?this._range[uH(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){let e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new cZ).domain(this._domain).range(this._range).unknown(this._unknown)}}var c$=i("824100"),cY=i("11959"),cX=i("156597");let cK=Math.sqrt(50),cq=Math.sqrt(10),cJ=Math.sqrt(2);function cQ(t,e,i){let r=Math.abs(e-t)/Math.max(0,i),n=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),s=r/n;return s>=cK?n*=10:s>=cq?n*=5:s>=cJ&&(n*=2),et[2]),n);if(s===c0.length){let n=Math.max(cQ(+t/cX.oP,+e/cX.oP,i),1),s=t=>(t[(0,cY.xL)(r)](Math.floor(t[(0,cY.sx)(r)]()/n)*n),t[(0,cY.vh)(r)](0,1),t[(0,cY.En)(r)](0,0,0,0),t),a=(t,e)=>(t[(0,cY.xL)(r)](t[(0,cY.sx)(r)]()+e*n),t);return{floor:s,offset:a,ceil:(0,cX.OU)(s,a)}}if(0===s){let r=Math.max(cQ(+t,+e,i),1),n=t=>(t.setTime(Math.floor(+t/r)*r),t),s=(t,e)=>(t.setTime(+t+e*r),t);return{floor:n,offset:s,ceil:(0,cX.OU)(n,s)}}let[a,o]=c0[n/c0[s-1][2]{let r=c7(t,e);r.length&&i.push(r[0])}),i}return[]}(t,e):pt(t)?function(t,e){var i;if((0,eT.Z)(t.coordinate)){let i=e.getCoordinateById(t.coordinate);return i?[i]:[]}return"coordinate"===(null===(i=t.coordinate)||void 0===i?void 0:i.grammarType)?[t.coordinate]:[]}(t,e):o7(t,e)}function pn(t,e,i){var r,n,s,a,o,l,h,d,u,c,p,f;if((0,eC.Z)(e))return[];let g=o7(e.unknown,i);switch(t){case"linear":case"sqrt":return g.concat(pe(e,i));case"ordinal":;return g.concat((r=0,n=0,[]));case"band":;return g.concat(pi(s=e,a=i).concat(o7(s.paddingInner,a)));case"point":return g.concat(pi(e,i));case"pow":;return g.concat(pe(o=e,l=i).concat(o7(o.exponent,l)));case"log":case"time":case"utc":;let m;return g.concat((h=e,d=i,(m=(m=(m=(m=(m=[]).concat(o7(h.nice,d))).concat(o7(h.min,d))).concat(o7(h.max,d))).concat(o7(h.zero,d))).concat(o7(h.roundRange,d))));case"symlog":;return g.concat(pe(u=e,c=i).concat(o7(u.constant,c)));case"quantize":;let v;return g.concat((p=e,f=i,(v=(v=(v=(v=(v=(v=[]).concat(o7(p.nice,f))).concat(o7(p.niceMin,f))).concat(o7(p.niceMax,f))).concat(o7(p.min,f))).concat(o7(p.max,f))).concat(o7(p.zero,f))))}return g}function ps(t,e,i){let r=lt(t.nice,i,e);!0===r?e.nice():(0,ef.Z)(r)&&e.nice(r)}function pa(t,e,i){let r=lt(t.niceMax,i,e);!0===r?e.niceMax():(0,ef.Z)(r)&&e.niceMax(r);let n=lt(t.niceMin,i,e);!0===n?e.niceMin():(0,ef.Z)(n)&&e.niceMin(n)}function po(t,e,i){let r=lt(t.min,i,e),n=lt(t.max,i,e),s=lt(t.zero,i,e),a=(0,ef.Z)(r),o=(0,ef.Z)(n),l=e.domain();if(2===l.length&&(a||o||s)){let t=Math.min(l[0],l[l.length-1]),i=Math.max(l[0],l[l.length-1]);s&&t>0?t=0:a&&(t=Math.min(t,r)),s&&i<0?i=0:o&&(i=Math.max(i,n)),e.domain([t,i],!0)}}function pl(t,e,i){var r;lt(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);let{interpolate:n,clamp:s}=null!==(r=lt(t.config,i,e))&&void 0!==r?r:{};n&&e.interpolate(n,!0),(0,eC.Z)(s)||(r6(s)?e.clamp(!0,s,!0):e.clamp(s,void 0,!0));let a=lt(t.tickCount,i,e);a&&e.tickData(a)}function ph(t,e,i){ps(t,e,i),pa(t,e,i),po(t,e,i),pl(t,e,i)}function pd(t,e,i){t.round&&e.round(lt(t.round,i,e),!0),t.padding&&e.padding(lt(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(lt(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(lt(t.paddingOuter,i,e),!0),t.align&&e.align(lt(t.align,i,e),!0)}function pu(t,e){let i=t.field,r=le(t.data,e),n=[];if((0,ev.Z)(i))i.forEach(t=>{let e=l0(t);r&&r.forEach(t=>{n.push(e(t))})});else{let t=l0(i);r&&r.forEach(e=>{n.push(t(e))})}return n}function pc(t,e){let i=[];return t.datas.forEach(t=>{i=i.concat(pu(t,e))}),i}function pp(t,e,i,r){return i&&t.sort(i),uN(e.type)?(r&&t.filter(t=>(0,ib.Z)(t)),[eA(t),ew(t)]):t}class pf extends ll{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=c6(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.view.emit(tX.BEFORE_EVALUATE_SCALE),this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=c6(this.spec.type)),function(t,e,i){var r,n,s,a,o,l;if(c8(t.domain)?e.domain(pp(pu(t.domain,i),e,t.domain.sort,!0),!0):c9(t.domain)?e.domain(pp(pc(t.domain,i),e,t.domain.sort,!0),!0):e.domain(lt(t.domain,i,e),!0),"identity"!==t.type){if(c8(t.range))e.range(pp(pu(t.range,i),e),!0);else if(c9(t.range))e.range(pp(pc(t.range,i),e),!0);else if(pt(t.range)){let r=le(t.range.coordinate,i);!function(t){switch(t){case t1.Quantile:case t1.Quantize:case t1.Threshold:return!0;default:return!1}}(e.type)&&r&&e.range(r.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(lt(t.range,i,e),!0)}switch((0,eC.Z)(t.unknown)||e.unknown(lt(t.unknown,i,e)),t.type){case"linear":ph(t,e,i),e.rescale();break;case"band":pd(t,e,i),e.rescale();break;case"point":pd(t,e,i),e.rescale();break;case"pow":(function(t,e,i){ph(t,e,i);let r=lt(t.exponent,i,e);r>0&&e.exponent(r)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){ps(t,e,i),po(t,e,i);let r=lt(t.base,i,e);r>0&&e.base(r),pl(t,e,i)})(t,e,i),e.rescale();break;case"sqrt":ph(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){ph(t,e,i);let r=lt(t.constant,i,e);(0,ef.Z)(r)&&e.constant(r)})(t,e,i),e.rescale();break;case"time":case"utc":;ps(r=t,n=e,s=i),po(r,n,s),pl(r,n,s),e.rescale();break;case"quantize":;ps(a=t,o=e,l=i),pa(a,o,l),po(a,o,l),e.rescale();break;case"quantile":e.rescale()}}(this.spec,this.scale,e),this.scale&&function(t){switch(t){case t1.Linear:case t1.Log:case t1.Pow:case t1.Sqrt:case t1.Symlog:case t1.Time:case t1.Band:case t1.Point:return!0;default:return!1}}(this.scale.type)&&(this._rangeFactor?this.scale.rangeFactor(this._rangeFactor):this.scale.rangeFactor()&&this.scale.rangeFactor(null,!1,!0),this._fishEyeOptions?this.scale.fishEye(this._fishEyeOptions):this.scale.fishEye()&&this.scale.fishEye(null,!1,!0)),this.view.emit(tX.BEFORE_EVALUATE_SCALE),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,r;return null!==(r=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==r?r:[]}domain(t){return(0,eC.Z)(this.spec.domain)||this.detach(pr(this.spec.domain,this.view)),this.spec.domain=t,this.attach(pr(t,this.view)),this.commit(),this}range(t){return(0,eC.Z)(this.spec.range)||this.detach(pr(this.spec.range,this.view)),this.spec.range=t,this.attach(pr(t,this.view)),this.commit(),this}tickCount(t){return this.setFunctionSpec(t,"tickCount")}setRangeFactor(t){return this._rangeFactor=t,this}getRangeFactor(){return this._rangeFactor}setFishEye(t){return this._fishEyeOptions=t,this}getFishEye(){return this._fishEyeOptions}getCoordinateAxisPosition(){let t=this.spec.range,e=null==t?void 0:t.coordinate;if(!(0,eC.Z)(e)){let i=t.dimension,r=t.isSubshaft,n=t.reversed,s=this.parameters()[e];return null==s?void 0:s.getVisualPositionByDimension(i,r,n)}return null}getCoordinateAxisPoints(t){let e=this.spec.range,i=null==e?void 0:e.coordinate;if(!(0,eC.Z)(i)){let r=e.dimension,n=e.isSubshaft,s=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(r,n,s,t)}return null}getCoordinate(){let t=this.spec.range,e=null==t?void 0:t.coordinate;return(0,eC.Z)(e)?null:this.parameters()[e]}configure(t){return this.detach(pn(this.spec.type,t,this.view)),(0,eC.Z)(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(pn(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}class pg{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return(0,eC.Z)(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return(0,eC.Z)(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){let i={x:0,y:0};return(0,ev.Z)(t)?(i.x=t[0],i.y=t[1]):(0,ib.Z)(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter(t=>"transpose"===t.type).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new e3,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach(t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}}),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}}class pm extends pg{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if((0,ef.Z)(t.x1)||(0,ef.Z)(t.y1)){let r=this.convertPoint(t),n=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return r.x1=n.x,r.y1=n.y,r}return this.convertPoint(t)}invert(t){var e,i;if((0,ef.Z)(t.x1)||(0,ef.Z)(t.y1)){let r=this.invertPoint(t),n=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return r.x1=n.x,r.y1=n.y,r}return this.invertPoint(t)}getRangeByDimension(t,e,i){let r=this.start(),n=this.end(),s=this.isMainDimension(t)?[r.x,n.x]:[n.y,r.y];return i?[s[1],s[0]]:s}getVisualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,r){let n=this.start(),s=this.end();if(this.isMainDimension(t)){let t=(0,eC.Z)(r)?e?[{x:n.x,y:n.y},{x:s.x,y:n.y}]:[{x:n.x,y:s.y},{x:s.x,y:s.y}]:[{x:n.x,y:r},{x:s.x,y:r}];return i?[t[1],t[0]]:t}let a=(0,eC.Z)(r)?e?[{x:s.x,y:s.y},{x:s.x,y:n.y}]:[{x:n.x,y:s.y},{x:n.x,y:n.y}]:[{x:r,y:s.y},{x:r,y:n.y}];return i?[a[1],a[0]]:a}convertPoint(t){let e=(0,ev.Z)(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){let e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class pv extends pg{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){let t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),r=2*e/Math.PI,n=2*i/Math.PI,s=[e,i],a=Math.ceil(r);for(;a<=n;)s.push(a*Math.PI/2),a++;let o=s.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI)>=2*Math.PI&&(n-=2*Math.PI),n=e1(n);let s=dq(r,0)?i/Math.cos(n):r/Math.sin(n),a=this.isTransposed()?{r:n,theta:s}:{r:s,theta:n};return!1===e.defined&&(a.defined=!1),a}}function pb(t){switch(t){case"cartesian":default:return new pm;case"polar":return new pv}}class py extends ll{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=pb(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=pb(this.spec.type)),function(t,e,i){var r,n,s,a,o,l,h;(0,eC.Z)(t.start)||e.start(null!==(r=lt(t.start,i))&&void 0!==r?r:[0,0]),(0,eC.Z)(t.end)||e.end(null!==(n=lt(t.end,i))&&void 0!==n?n:[0,0]),(0,eC.Z)(t.origin)||e.origin(null!==(s=lt(t.origin,i))&&void 0!==s?s:[0,0]);let d=[];if(!(0,eC.Z)(t.translate)){let e=lt(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!(0,eC.Z)(t.rotate)){let e=lt(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!(0,eC.Z)(t.scale)){let e=lt(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(h=null==e?void 0:e[1])&&void 0!==h?h:1}})}!(0,eC.Z)(t.transpose)&<(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}function px(t){return t&&(t.type===t1.Band||t.type===t1.Point)}function p_(t){if(t)return t.type===t1.Band?t.bandwidth():t.type===t1.Point?t.step():void 0}function pw(t,e){let i=t.range();return(t.scale(e)-i[0])/(i[i.length-1]-i[0])}class pA extends dF{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});let e=this.spec.encode[t];if(e&&"update"===t){let i=this.parameters(),r=o9(e)?null:Object.keys(e).reduce((t,r)=>(da(e[r])&&(t[r]=le(e[r].scale,i)),t),{});this._encoders[t]={callback:(t,i,n)=>{let s=du(e,t,i,n);if((0,eC.Z)(s.size)){let t=r.x?p_(r.x):void 0,e=r.y?p_(r.y):void 0;(0,eC.Z)(t)&&(0,eC.Z)(e)?s.size=10:(0,eC.Z)(t)?s.size=e:(0,eC.Z)(e)&&(s.size=t),s.size=[t,e]}return(0,eC.Z)(s.shape)&&(s.shape="rect"),s}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if((0,ib.Z)(i.padding)&&i.padding>0)t.size=(0,ev.Z)(i.size)?i.size.map(t=>Math.max(t-i.padding,1)):Math.max(i.size-i.padding,1);else if((0,ev.Z)(i.padding)&&2===i.padding.length){let e=(0,ev.Z)(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(h6.symbol)}release(){super.release(),this._encoders=null}}pA.markType=tF.cell;class pS extends dF{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});let e=this.spec.encode[t];if(e&&"update"===t){let i=this.parameters(),r=o9(e)?null:Object.keys(e).reduce((t,r)=>(da(e[r])&&(t[r]=le(e[r].scale,i)),t),{});this._encoders[t]={callback:(t,i,n)=>{var s,a,o;let l=du(e,t,i,n);if(this.disableCoordinateTransform=!1,r&&r.x&&r.x.type===t1.Band){if(!(0,eC.Z)(r.y)){let t=r.y.domain(),e=eA(t),i=ew(t);l.y1=r.y.scale(e>0?e:i<0?i:0)}let t=r.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(r&&r.y&&r.y.type===t1.Band){if(!(0,eC.Z)(r.x)){let t=r.x.domain(),e=eA(t),i=ew(t);l.x1=r.x.scale(e>0?e:i<0?i:0)}let t=r.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(r){let t=(null!==(a=this.view.getScaleById(null===(s=e.x)||void 0===s?void 0:s.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;let e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:h6.rect}addGraphicItem(t,e){let i=hJ(this,this.coord&&"polar"===this.coord.output().type?tF.arc:tF.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}pS.markType=tF.interval;var pE=i("510227");let pT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class pC extends sv{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(()=>{this.render(),this.bindEvents()})}setAttribute(t,e,i){lw(this.attribute[t])&&lw(e)&&!r6(this.attribute[t])&&!r6(e)?lE(this.attribute[t],e):this.attribute[t]=e,pT.includes(t)||this.render(),this.valid=this.isValid(),!this.updateShapeAndBoundsTagSetted()&&(i||this.needUpdateTag(t))?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){let i=Object.keys(t);this._mergeAttributes(t,i),i.every(t=>pT.includes(t))||this.render(),this.valid=this.isValid(),!this.updateShapeAndBoundsTagSetted()&&(e||this.needUpdateTags(i))?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){(0,eC.Z)(e)&&(e=Object.keys(t));for(let i=0;i{if(t&&t.length){let i=!0;t.forEach(t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)})}};return i&&i.length?i.forEach(t=>{r(t.points)}):t.points&&r(t.points),e}clone(){return new pB(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return pB.NOWORK_ANIMATE_ATTR}}function pP(t){return new pB(t)}pB.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},nj);let pR=!1,pO=new eB(t=>{pR||(pR=!0,t(on).toSelf().inSingletonScope(),t(os).toSelf().inSingletonScope(),t(sL).to(on).inSingletonScope(),t(sO).toService(sL))}),pI=hB(),pL=Symbol.for("MathPickerContribution"),pD=Symbol.for("MathArcPicker"),pN=Symbol.for("MathAreaPicker"),pj=Symbol.for("MathCirclePicker"),pF=Symbol.for("MathImagePicker"),pz=Symbol.for("MathLinePicker"),pH=Symbol.for("MathPathPicker"),pG=Symbol.for("MathRectPicker"),pU=Symbol.for("MathSymbolPicker"),pV=Symbol.for("MathTextPicker"),pW=Symbol.for("MathPolygonPicker"),pZ=Symbol.for("MathGlyphPicker"),p$=Symbol.for("CanvasArcPicker"),pY=Symbol.for("CanvasArc3dPicker"),pX=Symbol.for("CanvasAreaPicker"),pK=Symbol.for("CanvasCirclePicker"),pq=Symbol.for("CanvasImagePicker"),pJ=Symbol.for("CanvasLinePicker"),pQ=Symbol.for("CanvasPathPicker"),p0=Symbol.for("CanvasRectPicker"),p1=Symbol.for("CanvasRect3dPicker"),p2=Symbol.for("CanvasSymbolPicker"),p5=Symbol.for("CanvasTextPicker"),p3=Symbol.for("CanvasPolygonPicker"),p4=Symbol.for("CanvasPyramid3dPicker"),p6=Symbol.for("CanvasRichTextPicker"),p8=Symbol.for("CanvasGlyphPicker"),p7=Symbol.for("CanvasGroupPicker"),p9=Symbol.for("CanvasPickerContribution"),ft=class extends oe{};ft=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],ft);let fe=class extends ft{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=sn}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;r.highPerformanceSave();let n=rQ(t).line,{x:s,y:a,z:o,lastModelMatrix:l}=this.transform(t,n,r),h=e;if(r.camera){h=e.clone();let i=t.parent.globalTransMatrix;h.x=i.a*e.x+i.c*e.y+i.e,h.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=o;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,t=>!!d||(d=t.isPointInPath(h.x,h.y)),(t,e,i)=>{if(d)return!0;let n=e.lineWidth||i.lineWidth,s=e.pickStrokeBuffer||i.pickStrokeBuffer;return r.lineWidth=aB(r,n+s,r.dpr),d=t.isPointInStroke(h.x,h.y)}),this.canvasRenderer.z=0,r.modelMatrix!==l&&s1.free(r.modelMatrix),r.modelMatrix=l,r.highPerformanceRestore(),d}};fe=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(P=0,R=eH(sL),function(t,e){R(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],fe);let fi=!1,fr=new eB((t,e,i,r)=>{fi||(fi=!0,t(pJ).to(fe).inSingletonScope(),t(p9).toService(pJ))}),fn=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=sn}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).line,{x:s=n.x,y:a=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,t=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=s+a,o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};fn=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(O=0,I=eH(sL),function(t,e){I(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],fn);let fs=!1,fa=new eB((t,e,i,r)=>{fs||(fs=!0,t(pz).to(fn).inSingletonScope(),t(pL).toService(pz))});function fo(){fo.__loaded||(fo.__loaded=!0,as.RegisterGraphicCreator("line",pP),rO.load(pO),rO.load(pI?fr:fa))}fo.__loaded=!1;let fl=["points","cornerRadius",...nO];class fh extends nF{constructor(t){super(t),this.type="polygon",this.numberType=sa}isValid(){return super.isValid()&&this._isValid()}_isValid(){let{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){let t=rQ(this).polygon;this._AABBBounds.clear();let e=this.attribute,i=ru.graphicService.updatePolygonAABBBounds(e,rQ(this).polygon,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=nU(r);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw Error("暂不支持")}_interpolate(t,e,i,r,n){"points"===t&&(n.points=nY(i,r,e))}getDefaultAttribute(t){return rQ(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,fl)}needUpdateTag(t){return super.needUpdateTag(t,fl)}toCustomPath(){let t=this.attribute.points,e=new iK;return t.forEach((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)}),e.closePath(),e}clone(){return new fh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fh.NOWORK_ANIMATE_ATTR}}function fd(t){return new fh(t)}fh.NOWORK_ANIMATE_ATTR=nj;function fu(t,e,i,r){t.moveTo(e[0].x+i,e[0].y+r);for(let n=1;n0===t)?fu(e.camera?e:e.nativeContext,h,i,r):function(t,e,i,r,n,s=!0){var a;if(e.length<3)return void fu(t,e,i,r);let o=0,l=e.length-1;s||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+r));for(let s=o;s<=l;s++){let o=e[0===s?l:(s-1)%e.length],h=e[s%e.length],d=e[(s+1)%e.length],u=h.x-o.x,c=h.y-o.y,p=h.x-d.x,f=h.y-d.y,g=Math.abs(Math.tan((Math.atan2(c,u)-Math.atan2(f,p))/2)),m=Array.isArray(n)?null!==(a=n[s%e.length])&&void 0!==a?a:0:n,v=m/g,b=fc(u,c),y=fc(p,f),x=Math.min(b,y);v>x&&(v=x,m=x*g);let _=fp(h,v,b,u,c),w=fp(h,v,y,p,f),A=2*h.x-_.x-w.x,S=2*h.y-_.y-w.y,E=fc(A,S),T=fp(h,fc(v,m),E,A,S),C=Math.atan2(_.y-T.y,_.x-T.x),k=Math.atan2(w.y-T.y,w.x-T.x),M=k-C;M<0&&(C=k,M=-M),M>Math.PI&&(M-=Math.PI),0===s?t.moveTo(_.x+i,_.y+r):t.lineTo(_.x+i,_.y+r),M&&t.arcTo(h.x+i,h.y+r,w.x+i,w.y+r,m),t.lineTo(w.x+i,w.y+r)}s||t.lineTo(e[l+1].x+i,e[l+1].y+r)}(e.camera?e:e.nativeContext,h,i,r,d,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,v,b,g,m,l,n,a,o),v&&(a?a(e,t.attribute,l):g&&(e.setCommonStyle(t,t.attribute,u-i,c-r,l),e.fill())),b&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,u-i,c-r,l),e.stroke())),this.afterRenderStep(t,e,i,r,v,b,g,m,l,n,a,o)}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).polygon;this._draw(t,n,!1,i,r)}};fg=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),ff(0,eH(eU)),ff(0,eG(aJ)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],fg);let fm=!1,fv=new eB(t=>{fm||(fm=!0,t(sN).to(fg).inSingletonScope(),t(sO).toService(sN),t(aJ).toService(a6),eW(t,aJ))}),fb=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=sa}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).polygon,{x:s=n.x,y:a=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=aB(r,s+a,r.dpr),o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};fb=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(L=0,D=eH(sN),function(t,e){D(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],fb);let fy=!1,fx=new eB((t,e,i,r)=>{fy||(fy=!0,t(p3).to(fb).inSingletonScope(),t(p9).toService(p3))}),f_=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=sa}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).polygon,{x:s=n.x,y:a=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=s+a,o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};f_=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(N=0,j=eH(sN),function(t,e){j(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],f_);let fw=!1,fA=new eB((t,e,i,r)=>{fw||(fw=!0,t(pW).to(f_).inSingletonScope(),t(pL).toService(pW))});function fS(){fS.__loaded||(fS.__loaded=!0,as.RegisterGraphicCreator("polygon",fd),rO.load(fv),rO.load(pI?fx:fA))}fS.__loaded=!1;class fE{bounds(t,e){if((0,ib.Z)(t)){let i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function fT(t,e,i,r,n){return n?t.arc(i,r,e,0,eJ.BZ,!1,n):t.arc(i,r,e,0,eJ.BZ),!1}var fC=new class t extends fE{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,r,n){return fT(t,e/2,i,r,n)}drawOffset(t,e,i,r,n,s){return fT(t,e/2+n,i,r,s)}drawToSvgPath(t,e,i,r){let n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}},fk=new class t extends fE{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,r,n){var s,a,o,l,h;return s=t,a=e/6,o=i,l=r,h=n,s.moveTo(-3*a+o,-a+l,h),s.lineTo(-a+o,-a+l,h),s.lineTo(-a+o,-3*a+l,h),s.lineTo(a+o,-3*a+l,h),s.lineTo(a+o,-a+l,h),s.lineTo(3*a+o,-a+l,h),s.lineTo(3*a+o,a+l,h),s.lineTo(a+o,a+l,h),s.lineTo(a+o,3*a+l,h),s.lineTo(-a+o,3*a+l,h),s.lineTo(-a+o,a+l,h),s.lineTo(-3*a+o,a+l,h),s.closePath(),!0}drawOffset(t,e,i,r,n,s){var a,o,l,h,d,u;return a=t,o=e/6,l=i,h=r,d=n,u=s,a.moveTo(-3*o+l-d,-o+h-d,u),a.lineTo(-o+l-d,-o+h-d,u),a.lineTo(-o+l-d,-3*o+h-d,u),a.lineTo(o+l+d,-3*o+h-d,u),a.lineTo(o+l+d,-o+h-d,u),a.lineTo(3*o+l+d,-o+h-d,u),a.lineTo(3*o+l+d,o+h+d,u),a.lineTo(o+l+d,o+h+d,u),a.lineTo(o+l+d,3*o+h+d,u),a.lineTo(-o+l-d,3*o+h+d,u),a.lineTo(-o+l-d,o+h+d,u),a.lineTo(-3*o+l-d,o+h+d,u),a.closePath(),!0}};function fM(t,e,i,r,n){return t.moveTo(i,r-e,n),t.lineTo(e+i,r,n),t.lineTo(i,r+e,n),t.lineTo(i-e,r,n),t.closePath(),!0}var fB=new class t extends fE{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,r,n){return fM(t,e/2,i,r,n)}drawFitDir(t,e,i,r,n){return fM(t,e/2,i,r,n)}drawOffset(t,e,i,r,n,s){return fM(t,e/2+n,i,r,s)}};function fP(t,e,i,r){let n=2*e;return t.rect(i-e,r-e,n,n),!1}var fR=new class t extends fE{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,r){return fP(t,e/2,i,r)}drawOffset(t,e,i,r,n){return fP(t,e/2+n,i,r)}};class fO extends fE{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,r){var n,s,a,o;return n=t,s=e/2,a=i,o=r,n.moveTo(a+s,s+o),n.lineTo(a-s,s+o),n.lineTo(a,o-s),n.closePath(),!0}drawOffset(t,e,i,r,n){var s,a,o,l,h;return s=t,a=e/2,o=i,l=r,h=n,s.moveTo(o+a+2*h,a+l+h),s.lineTo(o-a-2*h,a+l+h),s.lineTo(o,l-a-2*h),s.closePath(),!0}}var fI=new fO,fL=new class t extends fO{constructor(){super(...arguments),this.type="triangle"}};let fD=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),fN=Math.sin(eJ.BZ/10)*fD,fj=-Math.cos(eJ.BZ/10)*fD;function fF(t,e,i,r){let n=fN*e,s=fj*e;t.moveTo(i,-e+r),t.lineTo(n+i,s+r);for(let a=1;a<5;++a){let o=eJ.BZ*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+r),t.lineTo(l*n-h*s+i,h*n+l*s+r)}return t.closePath(),!0}var fz=new class t extends fE{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,r){return fF(t,e/2,i,r)}drawOffset(t,e,i,r,n){return fF(t,e/2+n,i,r)}};let fH=(0,eJ._b)(3);function fG(t,e,i,r){let n=e/fH,s=n/5;return t.moveTo(0+i,-e+r),t.lineTo(n/2+i,r),t.lineTo(s/2+i,r),t.lineTo(s/2+i,e+r),t.lineTo(-s/2+i,e+r),t.lineTo(-s/2+i,r),t.lineTo(-n/2+i,r),t.closePath(),!0}var fU=new class t extends fE{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,r){return fG(t,e/2,i,r)}drawOffset(t,e,i,r,n){return fG(t,e/2+n,i,r)}};function fV(t,e,i,r){let n=2*e;return t.moveTo(i,-e+r),t.lineTo(n/3/2+i,e+r),t.lineTo(-n/3/2+i,e+r),t.closePath(),!0}var fW=new class t extends fE{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,r){return fV(t,e/2,i,r)}drawOffset(t,e,i,r,n){return fV(t,e/2+n,i,r)}};function fZ(t,e,i,r){return t.moveTo(-e+i,r),t.lineTo(i,e+r),!1}var f$=new class t extends fE{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,r){return fZ(t,e/2,i,r)}drawOffset(t,e,i,r,n){return fZ(t,e/2+n,i,r)}};let fY=(0,eJ._b)(3)/2,fX=1/(0,eJ._b)(12);function fK(t,e,i,r){let n=e/2,s=e*fX,a=e*fX+e,o=-n;return t.moveTo(n+i,s+r),t.lineTo(n+i,a+r),t.lineTo(o+i,a+r),t.lineTo(-.5*n-fY*s+i,fY*n+-.5*s+r),t.lineTo(-.5*n-fY*a+i,fY*n+-.5*a+r),t.lineTo(-.5*o-fY*a+i,fY*o+-.5*a+r),t.lineTo(-.5*n+fY*s+i,-.5*s-fY*n+r),t.lineTo(-.5*n+fY*a+i,-.5*a-fY*n+r),t.lineTo(-.5*o+fY*a+i,-.5*a-fY*o+r),t.closePath(),!1}var fq=new class t extends fE{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,r){return fK(t,e/2,i,r)}drawOffset(t,e,i,r,n){return fK(t,e/2+n,i,r)}},fJ=new class t extends fE{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,r){var n,s,a,o;return n=t,s=e/2,a=i,o=r,n.moveTo(-s+a,o),n.lineTo(s+a,s+o),n.lineTo(s+a,o-s),n.closePath(),!0}drawOffset(t,e,i,r,n){var s,a,o,l,h;return s=t,a=e/2,o=i,l=r,h=n,s.moveTo(-a+o-2*h,l),s.lineTo(a+o+h,a+l+2*h),s.lineTo(a+o+h,l-a-2*h),s.closePath(),!0}},fQ=new class t extends fE{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,r){var n,s,a,o;return n=t,s=e/2,a=i,o=r,n.moveTo(a-s,s+o),n.lineTo(s+a,o),n.lineTo(a-s,o-s),n.closePath(),!0}drawOffset(t,e,i,r,n){var s,a,o,l,h;return s=t,a=e/2,o=i,l=r,h=n,s.moveTo(o-a-h,a+l+2*h),s.lineTo(a+o+2*h,l),s.lineTo(o-a-h,l-a-2*h),s.closePath(),!0}},f0=new class t extends fE{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,r){var n,s,a,o;return n=t,s=e/2,a=i,o=r,n.moveTo(a-s,o-s),n.lineTo(a+s,o-s),n.lineTo(a,o+s),n.closePath(),!0}drawOffset(t,e,i,r,n){var s,a,o,l,h;return s=t,a=e/2,o=i,l=r,h=n,s.moveTo(o-a-2*h,l-a-h),s.lineTo(o+a+2*h,l-a-h),s.lineTo(o,l+a+2*h),s.closePath(),!0}};let f1=(0,eJ._b)(3);function f2(t,e,i,r){let n=e*f1;return t.moveTo(i,r+-n/3*2),t.lineTo(e+i,r+n),t.lineTo(i-e,r+n),t.closePath(),!0}var f5=new class t extends fO{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,r){return f2(t,e/2/f1,i,r)}drawOffset(t,e,i,r,n){return f2(t,e/2/f1+n,i,r)}};function f3(t,e,i,r){let n=2*e;return t.moveTo(e+i,r-n),t.lineTo(i-e,r),t.lineTo(e+i,n+r),!0}var f4=new class t extends fE{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,r){return f3(t,e/4,i,r)}drawOffset(t,e,i,r,n){return f3(t,e/4+n,i,r)}};function f6(t,e,i,r){let n=2*e;return t.moveTo(i-e,r-n),t.lineTo(i+e,r),t.lineTo(i-e,n+r),!0}var f8=new class t extends fE{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,r){return f6(t,e/4,i,r)}drawOffset(t,e,i,r,n){return f6(t,e/4+n,i,r)}};function f7(t,e,i,r){let n=2*e;return t.moveTo(i-n,r+e),t.lineTo(i,r-e),t.lineTo(i+n,r+e),!0}var f9=new class t extends fE{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,r){return f7(t,e/4,i,r)}drawOffset(t,e,i,r,n){return f7(t,e/4+n,i,r)}};function gt(t,e,i,r){let n=2*e;return t.moveTo(i-n,r-e),t.lineTo(i,r+e),t.lineTo(i+n,r-e),!0}var ge=new class t extends fE{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,r){return gt(t,e/4,i,r)}drawOffset(t,e,i,r,n){return gt(t,e/4+n,i,r)}};function gi(t,e,i,r,n){return t.moveTo(i,r-e),t.lineTo(i,r+e),!0}var gr=new class t extends fE{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,r,n){return gi(t,e/2,i,r,n)}drawOffset(t,e,i,r,n,s){return gi(t,e/2+n,i,r,s)}drawToSvgPath(t,e,i,r){let n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function gn(t,e,i,r,n){return t.moveTo(i-e,r),t.lineTo(i+e,r),!0}var gs=new class t extends fE{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,r,n){return gn(t,e/2,i,r,n)}drawOffset(t,e,i,r,n,s){return gn(t,e/2+n,i,r,s)}drawToSvgPath(t,e,i,r){let n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function ga(t,e,i,r,n){return t.moveTo(i-e,r-e),t.lineTo(i+e,r+e),t.moveTo(i+e,r-e),t.lineTo(i-e,r+e),!0}var go=new class t extends fE{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,r,n){return ga(t,e/2,i,r,n)}drawOffset(t,e,i,r,n,s){return ga(t,e/2+n,i,r,s)}drawToSvgPath(t,e,i,r){let n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function gl(t,e,i,r){return t.rect(i-e[0]/2,r-e[1]/2,e[0],e[1]),!1}function gh(t,e,i,r){let n=e/2;return t.rect(i-e/2,r-n/2,e,n),!1}var gd=new class t extends fE{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,r){return(0,ib.Z)(e)?gh(t,e,i,r):gl(t,e,i,r)}drawOffset(t,e,i,r,n){return(0,ib.Z)(e)?gh(t,e+2*n,i,r):gl(t,[e[0]+2*n,e[1]+2*n],i,r)}};let gu={};[fC,fk,fB,fR,f5,fL,fz,fU,fW,f$,fq,fJ,fQ,fI,f0,f4,f8,f9,ge,gd,gr,gs,go].forEach(t=>{gu[t.type]=t});let gc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},gp=new il;class gf{constructor(t,e,i=!1){this.pathStr="",this.type=t,(0,ev.Z)(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,r,n,s,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach(n=>{t.beginPath(),iv(n.path.commandList,t,i,r,e,e),a&&a(n.path,n.attribute)}),!1):(iv(this.path.commandList,t,i,r,e+n,e+n),!1)}draw(t,e,i,r,n,s){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach(n=>{t.beginPath(),iv(n.path.commandList,t,i,r,e,e),s&&s(n.path,n.attribute)}),!1):(iv(this.path.commandList,t,i,r,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach(({path:i})=>{gp.x1=i.bounds.x1*t,gp.y1=i.bounds.y1*t,gp.x2=i.bounds.x2*t,gp.y2=i.bounds.y2*t,e.union(gp)})}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}class gg{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function gm(t,e,i,r){let n=t.indexOf(e,i);if(-1===n)throw Error(r);return n+e.length-1}function gv(t,e,i,r=">"){let n=function(t,e,i=">"){let r,n="";for(let s=e;s",s,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),(i=this.tagsNodeStack.pop())&&i.child&&r&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=r),r="",s=e}else if("?"===t[s+1])s=gv(t,s,!1,"?>").closeIndex+1;else if("!--"===t.substr(s+1,3))s=gm(t,"--\x3e",s+4,"Comment is not closed.");else{let a=gv(t,s,!1),o=a.tagName,l=a.tagExp,h=a.attrExpPresent,d=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);let t=new gg(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{let t=new gg(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}r="",s=d}}else r+=t[s];return e.child}}class gx{constructor(t){this.options=Object.assign({},gx.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){var e,i;if(!this.valid)return!1;return e=new gy(this.options).parseXml(t),i=this.options,function t(e,i){let r={};for(let n=0;n{let e=(new iK).fromString(t.d),i={};sm.forEach(e=>{t[e]&&(i[sg[e]]=t[e])}),r.push({path:e,attribute:i}),g_.union(e.bounds)});let n=g_.width(),s=g_.height(),a=1/(0,eJ.Fp)(n,s);return r.forEach(t=>t.path.transform(0,0,a,a)),this._parsedPath=new gf(i,r,!0),gA.userSymbolMap[i]=this._parsedPath,this._parsedPath}let n=(new iK).fromString(i),s=n.bounds.width(),a=n.bounds.height(),o=1/(0,eJ.Fp)(s,a);return n.transform(0,0,o,o),this._parsedPath=new gf(i,n),gA.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){let e=rQ(this).symbol;this._AABBBounds.clear();let i=this.attribute,r=ru.graphicService.updateSymbolAABBBounds(i,rQ(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,s=nU(n);return s&&r.expand(s),this.clearUpdateBoundTag(),r}tryUpdateOBBBounds(){throw Error("暂不支持")}getDefaultAttribute(t){return rQ(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,gw)}needUpdateTag(t){return super.needUpdateTag(t,gw)}toCustomPath(){let t=this.getParsedPath(),e=this.attribute.size,i=(0,ev.Z)(e)?e:[e,e];return t.path?(new iK).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new iK).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new gA(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gA.NOWORK_ANIMATE_ATTR}}function gS(t){return new gA(t)}gA.userSymbolMap={},gA.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},nj);let gE=new class t{constructor(){this.time=oF.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,s,a,o,l,h,d,u){let c=t.getParsedPath();if(!c)return;let{outerBorder:p,innerBorder:f}=t.attribute,g=p&&!1!==p.visible,m=f&&!1!==f.visible;if(!g&&!m)return;let{size:v=l.size,opacity:b=l.opacity,x:y=l.x,y:x=l.y,scaleX:_=l.scaleX,scaleY:w=l.scaleY}=t.attribute,A=!(!p||!p.stroke),S=!(!f||!f.stroke);if(g){let{distance:n=l.outerBorder.distance}=p,s=aB(e,n,e.dpr);if(e.beginPath(),!1===c.drawOffset(e,v,i,r,s)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,p,l.outerBorder);else if(A){let n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,p,(y-i)/_,(x-r)/w,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){let{distance:n=l.innerBorder.distance}=f,s=aB(e,n,e.dpr);if(e.beginPath(),!1===c.drawOffset(e,v,i,r,-s)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,f,l.innerBorder);else if(S){let n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,f,(y-i)/_,(x-r)/w,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}};var gT=function(t,e){return function(i,r){e(i,r,t)}};let gC=class extends oe{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=su,this.builtinContributions=[gE,a4,oh],this.init(t)}drawShape(t,e,i,r,n,s,a,o){var l;let h=rQ(t,null==s?void 0:s.theme).symbol,{size:d=h.size,x:u=h.x,y:c=h.y,scaleX:p=h.scaleX,scaleY:f=h.scaleY}=t.attribute,g=this.valid(t,h,a,o);if(!g)return;let{fVisible:m,sVisible:v,doFill:b,doStroke:y}=g,x=t.getParsedPath();if(!x)return;let{keepDirIn3d:_=h.keepDirIn3d}=t.attribute,w=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),_&&e.camera&&e.project){let n=e.project(i,r,w),s=e.camera;e.camera=null,!1===x.draw(e,(0,ev.Z)(d)?[d[0]*p,d[1]*f]:d*p,n.x,n.y,void 0,(n,s)=>{var l,d,g;if(t._parsedPath.svgCache){let e=Object.assign({},s);e.fill=null!==(l=s.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(d=s.fill)&&void 0!==d?d:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(g=s.stroke)&&void 0!==g?g:t.attribute.stroke,s=e}s.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,s,u-i,c-r,h),e.fill())),s.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,s,(u-i)/p,(c-r)/f,h),e.stroke()))})&&e.closePath(),e.camera=s}else!1===x.draw(e,d,i,r,w,(n,s)=>{var l,d,g;if(t._parsedPath.svgCache){let e=Object.assign({},s);e.fill=null!==(l=s.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(d=s.opacity)&&void 0!==d?d:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(g=s.stroke)&&void 0!==g?g:t.attribute.stroke,s=e}s.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,s,u-i,c-r,h),e.fill())),s.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,s,(u-i)/p,(c-r)/f,h),e.stroke()))})&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,r,b,y,m,v,h,n,a,o),b&&!x.isSvg&&(a?a(e,t.attribute,h):m&&(e.setCommonStyle(t,t.attribute,u-i,c-r,h),e.fill())),y&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(u-i)/p,(c-r)/f,h),e.stroke())),this.afterRenderStep(t,e,i,r,b,y,m,v,h,n,a,o)}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).symbol;this._draw(t,n,!1,i,r)}};gC=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),gT(0,eH(eU)),gT(0,eG(a0)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],gC);let gk=!1,gM=new eB(t=>{gk||(gk=!0,t(gC).toSelf().inSingletonScope(),t(sz).to(gC).inSingletonScope(),t(sO).toService(sz),t(a0).toService(a6),eW(t,a0))}),gB=class extends ft{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=su}contains(t,e,i){let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=t.getParsedPath();if(!r.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}r.highPerformanceSave();let s=rQ(t).symbol,{x:a,y:o,z:l,lastModelMatrix:h}=this.transform(t,s,r),d=e;if(r.camera){d=e.clone();let i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,r,a,o,{},null,(t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y)),(t,e,i)=>{if(u)return!0;let n=e.lineWidth||i.lineWidth,s=e.pickStrokeBuffer||i.pickStrokeBuffer;return r.lineWidth=aB(r,n+s,r.dpr),u=t.isPointInStroke(d.x,d.y)}),this.canvasRenderer.z=0,r.modelMatrix!==h&&s1.free(r.modelMatrix),r.modelMatrix=h,r.highPerformanceRestore(),u}};gB=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(F=0,z=eH(sz),function(t,e){z(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],gB);let gP=!1,gR=new eB((t,e,i,r)=>{gP||(gP=!0,t(p2).to(gB).inSingletonScope(),t(p9).toService(p2))}),gO=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=su}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).symbol,{x:s=n.x,y:a=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=s+a,o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};gO=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(H=0,G=eH(sz),function(t,e){G(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],gO);let gI=!1,gL=new eB((t,e,i,r)=>{gI||(gI=!0,t(pU).to(gO).inSingletonScope(),t(pL).toService(pU))});function gD(){gD.__loaded||(gD.__loaded=!0,as.RegisterGraphicCreator("symbol",gS),rO.load(gM),rO.load(pI?gR:gL))}gD.__loaded=!1;pk(),fo(),fS(),gD();class gN extends pC{getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},gN.defaultAttributes,t)),this.name="segment"}render(){this.removeAllChild(!0),this._reset();let{startSymbol:t,endSymbol:e,lineStyle:i,state:r,visible:n=!0,multiSegment:s,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();let o=this._renderSymbol(t,"start"),l=this._renderSymbol(e,"end");if(this.startSymbol=o,this.endSymbol=l,s){let t=[...this.attribute.points];if((0,ef.Z)(a))t[a]=this._clipPoints(t[a]);else{let e=this._clipPoints(eE(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach((t,e)=>{var n,s;let a=as.line(Object.assign(Object.assign({points:t},(0,ev.Z)(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),dn(null==r?void 0:r.line)||(a.states=(0,ev.Z)(r.line)?null!==(s=r.line[e])&&void 0!==s?s:r.line[r.line.length-1]:r.line),this.add(a)})}else{let t=as.polygon(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},ex(i)[0]),{fill:!1,closePath:!1}));t.name=`${this.name}-line`,t.id=this._getNodeId("line"),dn(null==r?void 0:r.line)||(t.states=[].concat(r.line)[0]),this.add(t)}}_renderSymbol(t,e){let i;let r=this._getMainSegmentPoints();if(!r.length)return;let{autoRotate:n=!0}=t;if(t&&t.visible){let s,a;let o=this._startAngle,l=this._endAngle,{state:h}=this.attribute,d=r[0],u=r[r.length-1],{refX:c=0,refY:p=0,refAngle:f=0,style:g,symbolType:m,size:v=12}=t;"start"===e?(s={x:d.x+((0,ef.Z)(o)?c*Math.cos(o)+p*Math.cos(o-Math.PI/2):0),y:d.y+((0,ef.Z)(o)?c*Math.sin(o)+p*Math.sin(o-Math.PI/2):0)},a=o+Math.PI/2):(s={x:u.x+((0,ef.Z)(l)?c*Math.cos(l)+p*Math.cos(l-Math.PI/2):0),y:u.y+((0,ef.Z)(l)?c*Math.sin(l)+p*Math.sin(l-Math.PI/2):0)},a=l+Math.PI/2),(i=as.symbol(Object.assign(Object.assign(Object.assign({},s),{symbolType:m,size:v,angle:n?a+f:0,strokeBoundsBuffer:0}),g))).name=`${this.name}-${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),dn(null==h?void 0:h.symbol)||(i.states=h.symbol),this.add(i)}return i}_getMainSegmentPoints(){let t;if(this._mainSegmentPoints)return this._mainSegmentPoints;let{points:e,multiSegment:i,mainSegmentIndex:r}=this.attribute;return t=i?(0,ef.Z)(r)?e[r]:eE(e):e,this._mainSegmentPoints=t,t}_clipPoints(t){let{startSymbol:e={},endSymbol:i={}}=this.attribute,r=t;if(e.visible){let i=e.clip?e.size||10:0;r=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...r.slice(1)]}if(i.visible){let e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};r=[...r.slice(0,r.length-1),n]}return r}_computeLineAngle(){let t=this._getMainSegmentPoints();if(t.length<=1)return;let e=t[0],i=t[1],r=t[t.length-2],n=t[t.length-1],s=[e.x-i.x,e.y-i.y],a=Math.atan2(s[1],s[0]),o=[n.x-r.x,n.y-r.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}function gj(t,e){return[t[0]*e,t[1]*e]}gN.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}};function gF(t,e){t.forEachChildren(t=>{let i=e(t);t.isContainer&&!i&&gF(t,e)})}let gz=t=>!(0,eC.Z)(t)&&!1!==t.visible;function gH(t){return h||(h=as.CreateGraphic("text",{})),h.initAttributes(t),h.AABBBounds}let gG=-.5*Math.PI,gU=1.5*Math.PI,gV="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";(U=t2||(t2={})).selected="selected",U.selectedReverse="selected_reverse",U.hover="hover",U.hoverReverse="hover_reverse";let gW={[t2.selectedReverse]:{},[t2.selected]:{},[t2.hover]:{},[t2.hoverReverse]:{}},gZ={container:"",width:30,height:30,style:{}},g$=(t,e,i)=>new rE(Object.assign({defaultFontParams:{fontFamily:gV,fontSize:11},getTextBounds:i?void 0:gH,specialCharSet:"-/: .,@%'\"~"+rE.ALPHABET_CHAR_SET+rE.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gY(t,e,i=gV){var r,n;if(!t)return{width:0,height:0};let s=gH({text:t,fontFamily:null!==(r=e.fontFamily)&&void 0!==r?r:i,fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}function gX(t,e="type"){return e in t&&"rich"===t[e]||(0,ep.Z)(t.text)&&"rich"===t.text.type}function gK(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}(V=t5||(t5={})).innerView="inner-view",V.axisContainer="axis-container",V.labelContainer="axis-label-container",V.tickContainer="axis-tick-container",V.tick="axis-tick",V.subTick="axis-sub-tick",V.label="axis-label",V.title="axis-title",V.gridContainer="axis-grid-container",V.grid="axis-grid",V.gridRegion="axis-grid-region",V.line="axis-line",V.background="axis-background",V.axisLabelBackground="axis-label-background",(W=t3||(t3={})).selected="selected",W.selectedReverse="selected_reverse",W.hover="hover",W.hoverReverse="hover_reverse";let gq={[t3.selectedReverse]:{},[t3.selected]:{},[t3.hover]:{},[t3.hoverReverse]:{}},gJ={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},gQ=["width","x1","y1","height","cornerRadius",...nO];class g0 extends nF{constructor(t){super(t),this.type="rect",this.numberType=sl}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){let t=rQ(this).rect;this._AABBBounds.clear();let e=this.attribute,i=ru.graphicService.updateRectAABBBounds(e,rQ(this).rect,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=nU(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw Error("暂不支持")}getDefaultAttribute(t){return rQ(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,gQ)}needUpdateTag(t){return super.needUpdateTag(t,gQ)}toCustomPath(){let{x:t,y:e,width:i,height:r}=d6(this.attribute),n=new iK;return n.moveTo(t,e),n.rect(t,e,i,r),n}clone(){return new g0(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return g0.NOWORK_ANIMATE_ATTR}}function g1(t){return new g0(t)}g0.NOWORK_ANIMATE_ATTR=nj;var g2=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let g5=class{constructor(){this.time=oF.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,s,a,o,l,h,d,u,c){let{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some(t=>!1===t)&&(c.doStroke=!1)}};g5=g2([eN()],g5);let g3=class{constructor(){this.time=oF.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,s,a,o,l,h,d,u){let{width:c=l.width,height:p=l.height,stroke:f=l.stroke}=t.attribute;if(Array.isArray(f)&&f.some(t=>!1===t)){if(e.setStrokeStyle(t,t.attribute,i,r,l),e.beginPath(),e.moveTo(i,r),f[0]?e.lineTo(i+c,r):e.moveTo(i+c,r),f[1]?e.lineTo(i+c,r+p):e.moveTo(i+c,r+p),f[2]?e.lineTo(i,r+p):e.moveTo(i,r+p),f[3]){let t=f[0]?r-e.lineWidth/2:r;e.lineTo(i,t)}else e.moveTo(i,r);e.stroke()}}};g3=g2([eN()],g3);let g4=new class t{constructor(){this.time=oF.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,s,a,o,l,h,d,u){let{outerBorder:c,innerBorder:p}=t.attribute,f=c&&!1!==c.visible,g=p&&!1!==p.visible;if(!f&&!g)return;let{cornerRadius:m=l.cornerRadius,opacity:v=l.opacity,x:b=l.x,y:y=l.y,scaleX:x=l.scaleX,scaleY:_=l.scaleY,x1:w,y1:A}=t.attribute,{width:S,height:E}=t.attribute;S=(null!=S?S:w-i)||0,E=(null!=E?E:A-r)||0;let T=!(!c||!c.stroke),C=!(!p||!p.stroke);if(f){let{distance:n=l.outerBorder.distance}=c,s=aB(e,n,e.dpr),a=i-s,o=r-s,h=2*s;if(0===m||(0,ev.Z)(m)&&m.every(t=>0===t)?(e.beginPath(),e.rect(a,o,S+h,E+h)):(e.beginPath(),aD(e,a,o,S+h,E+h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,c,l.outerBorder);else if(T){let n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,c,(b-i)/x,(y-r)/_,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(g){let{distance:n=l.innerBorder.distance}=p,s=aB(e,n,e.dpr),a=i+s,o=r+s,h=2*s;if(0===m||(0,ev.Z)(m)&&m.every(t=>0===t)?(e.beginPath(),e.rect(a,o,S-h,E-h)):(e.beginPath(),aD(e,a,o,S-h,E-h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,p,l.innerBorder);else if(C){let n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(b-i)/x,(y-r)/_,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}};var g6=function(t,e){return function(i,r){e(i,r,t)}};let g8=class extends oe{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=sl,this.builtinContributions=[g4,a4,oh],this.init(t)}drawShape(t,e,i,r,n,s,a,o){var l,h,d;let u=null!==(l=this.tempTheme)&&void 0!==l?l:rQ(t,null==s?void 0:s.theme).rect,{fill:c=u.fill,background:p,stroke:f=u.stroke,cornerRadius:g=u.cornerRadius,opacity:m=u.opacity,fillOpacity:v=u.fillOpacity,lineWidth:b=u.lineWidth,strokeOpacity:y=u.strokeOpacity,visible:x=u.visible,x1:_,y1:w,x:A=u.x,y:S=u.y}=t.attribute,{width:E,height:T}=t.attribute;E=(null!=E?E:_-A)||0;let C=az(m,v,E,T=(null!=T?T:w-S)||0,c),k=aG(m,y,E,T),M=(h=c,d=p,!(!h&&!d)),B=aj(f,b);if(!t.valid||!x||!M&&!B||!(C||k||a||o||p))return;0===g||(0,ev.Z)(g)&&g.every(t=>0===t)?(e.beginPath(),e.rect(i,r,E,T)):(e.beginPath(),aD(e,i,r,E,T,g));let P={doFill:M,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,r,M,B,C,k,u,n,a,o,P),P.doFill&&(a?a(e,t.attribute,u):C&&(e.setCommonStyle(t,t.attribute,A-i,S-r,u),e.fill())),P.doStroke&&(o?o(e,t.attribute,u):k&&(e.setStrokeStyle(t,t.attribute,A-i,S-r,u),e.stroke())),this.afterRenderStep(t,e,i,r,M,B,C,k,u,n,a,o)}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,r),this.tempTheme=null}};g8=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),g6(0,eH(eU)),g6(0,eG(aQ)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],g8);let g7=!1,g9=new eB(t=>{g7||(g7=!0,t(g8).toSelf().inSingletonScope(),t(sj).to(g8).inSingletonScope(),t(sO).toService(sj),t(g3).toSelf(),t(g5).toSelf(),t(aQ).toService(g3),t(aQ).toService(g5),t(aQ).toService(a6),eW(t,aQ))}),mt=new il,me=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=sl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).rect,{cornerRadius:s=n.cornerRadius}=t.attribute,{x:a=n.x,y:o=n.y}=t.attribute;r.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);a+=e.x,o+=e.y,r.setTransformForCurrent()}else a=0,o=0,l=!1,r.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||(0,ib.Z)(s,!0)&&0!==s||(0,ev.Z)(s)&&s.some(t=>0!==t))h=!1,this.canvasRenderer.drawShape(t,r,a,o,{},null,(t,i,r)=>!!h||(h=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(h)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=aB(r,s+a,r.dpr),h=t.isPointInStroke(e.x,e.y)});else{let{fill:i=n.fill,stroke:r=n.stroke,lineWidth:s=n.lineWidth}=t.attribute;if(i)h=!0;else if(r){let i=t.AABBBounds;mt.setValue(i.x1,i.y1,i.x2,i.y2),mt.expand(-s/2),h=!mt.containsPoint(e)}}return r.highPerformanceRestore(),h}};me=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(Z=0,$=eH(sj),function(t,e){$(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],me);let mi=!1,mr=new eB((t,e,i,r)=>{mi||(mi=!0,t(p0).to(me).inSingletonScope(),t(p9).toService(p0))}),mn=new il,ms=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=sl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).rect,{cornerRadius:s=n.cornerRadius}=t.attribute,{x:a=n.x,y:o=n.y}=t.attribute;r.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);a+=e.x,o+=e.y,r.setTransformForCurrent()}else a=0,o=0,l=!1,r.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||(0,ib.Z)(s,!0)&&0!==s||(0,ev.Z)(s)&&s.some(t=>0!==t))h=!1,this.canvasRenderer.drawShape(t,r,a,o,{},null,(t,i,r)=>!!h||(h=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(h)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=s+a,h=t.isPointInStroke(e.x,e.y)});else if(h){let{fill:i=n.fill,stroke:r=n.stroke,lineWidth:s=n.lineWidth}=t.attribute;if(i)h=!0;else if(r){let i=t.AABBBounds;mn.setValue(i.x1,i.y1,i.x2,i.y2),mn.expand(-s/2),h=!mn.containsPoint(e)}}return r.highPerformanceRestore(),h}};ms=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(Y=0,X=eH(sj),function(t,e){X(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],ms);let ma=!1,mo=new eB((t,e,i,r)=>{ma||(ma=!0,t(pG).to(ms).inSingletonScope(),t(pL).toService(pG))});function ml(){ml.__loaded||(ml.__loaded=!0,as.RegisterGraphicCreator("rect",g1),rO.load(g9),rO.load(pI?mr:mo))}ml.__loaded=!1;class mh{constructor(t,e,i,r,n,s,a,o,l,h,d,u,c,p){this.left=t,this.top=e,this.width=i,this.height=r,this.actualHeight=0,this.bottom=e+r,this.right=t+i,this.ellipsis=n,this.wordBreak=s,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=rc[this.layoutDirection],this.isWidthMax=d,this.isHeightMax=u,this.singleLine=c,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){let{width:i,height:r}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0,s=this.isHeightMax?Math.min(this.height,r):this.height||r||0;s=Math.min(s,r);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-s/2;break;case"bottom":a=-s}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection){if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)break;let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}else{let i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||sthis[this.directionKey.top]+l)return h;{let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=r.actualWidth),e+=r.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0,{width:i,height:r}=this.getRawActualSize();this.width;let n=this.height||r||0;n=Math.min(n,r);let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection){if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){let r=this.lines[i].getWidthWithEllips();r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{this.actualHeight;for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+n>this[this.directionKey.top]+s||at&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(r+nthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){let r=this.lines[i].getWidthWithEllips();r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class md{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";let r=n0(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof r?r>this.fontSize?r:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;let{ascent:n,height:s,descent:a,width:o}=ry(t,i),l=0,h=0,d=0;this.height>s&&(h=Math.ceil(l=(this.height-s)/2),d=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=s-l):"bottom"===this.textBaseline?(this.ascent=s-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+d),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){let{width:t}=ry(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,r,n){let s=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)s="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)s+="...","right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){let t=rv(s,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,s.length-1);if(s=s.slice(0,t)+"...","right"===n||"end"===n){let{width:e}=ry(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){let i=e&&e.stroke||rp.stroke;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(s,a,e)),function(t,e){let i=e&&e.fill||rp.fill;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(s,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text,i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){let t=rv(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t)+"...";let{width:r}=ry(this.text.slice(t),this.character);return i+this.ellipsisWidth-r}return i}}let mu=["width","height","image",...nO];class mc extends nF{constructor(t){super(t),this.type="image",this.numberType=sr,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,()=>{this.successCallback&&this.successCallback()})}imageLoadFail(t,e){super.imageLoadFail(t,()=>{this.failCallback&&this.failCallback()})}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,r){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,r)}doUpdateAABBBounds(){let t=rQ(this).image;this._AABBBounds.clear();let e=this.attribute,i=ru.graphicService.updateImageAABBBounds(e,rQ(this).image,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=nU(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw Error("暂不支持")}getDefaultAttribute(t){return rh[t]}needUpdateTags(t){return super.needUpdateTags(t,mu)}needUpdateTag(t){return super.needUpdateTag(t,mu)}clone(){return new mc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mc.NOWORK_ANIMATE_ATTR}}function mp(t){return new mc(t)}mc.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},nj);class mf extends mc{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){let e=nU(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if((0,ev.Z)(i)&&-1!==i.indexOf("margin")||"margin"===i){if(e.margin){let t=nU(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();let{width:t=rh.width,height:e=rh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:r=e}=this.attribute;return this._AABBBounds.expand([0,(i-t)/2*2,(r-e)/2*2,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class mg{constructor(t,e,i,r,n,s,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=r,this.descent=n,this.top=i-r,this.paragraphs=s.map(t=>t),this.textAlign=(this.paragraphs[0]instanceof mf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=rc[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach((t,e)=>{if(0===e&&t instanceof md){let e=rm.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)}),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){let i=this.directionKey,r=this.height,n=this.left,s=0;this.actualWidth=0;e--){let i=this.paragraphs[e];if(i instanceof mf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}let{width:r}=ry("...",i.character),n=r||0;if(n<=this.blankWidth+t){i.ellipsis="add";break}if(n<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=n,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map((e,s)=>{if(e instanceof mf)return e.setAttributes({x:i+e._x,y:r+e._y}),void n(e,t,i+e._x,r+e._y,this.ascent);e.draw(t,r+this.ascent,i,0===s,this.textAlign)})}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){let i=this.paragraphs[e];if(i instanceof mf)break;let{width:r}=ry("...",i.character),n=r||0;if(n<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=n;break}if(n<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=n,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map((t,i)=>{e+=t instanceof mf?t.width:t.getWidthWithEllips(this.direction)}),e}}class mm{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=rc[this.direction]}store(t){if(t instanceof mf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;let t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new mg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof mf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){let e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,r=rv(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==r){let[e,i]=function(t,e){let i=t.text.slice(0,e),r=t.text.slice(e);return[new md(i,t.newLine,t.character),new md(r,!0,t.character)]}(t,r);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let mv=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...nO];class mb extends nF{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=sd}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:rl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:rl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:rl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:rl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:rl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:rl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:rl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:rl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){let t=rQ(this).richtext;this._AABBBounds.clear();let e=this.attribute,i=ru.graphicService.updateRichTextAABBBounds(e,rQ(this).richtext,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=nU(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw Error("暂不支持")}getDefaultAttribute(t){return rl[t]}needUpdateTags(t){return super.needUpdateTags(t,mv)}needUpdateTag(t){return super.needUpdateTag(t,mv)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){let{fill:e,stroke:i,fontSize:r,fontFamily:n,fontStyle:s,fontWeight:a,lineWidth:o}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:r,fontFamily:n,fontStyle:s,fontWeight:a,lineWidth:o},t)}doUpdateFrameCache(){var t;let{textConfig:e=[],maxWidth:i,maxHeight:r,width:n,height:s,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:d,layoutDirection:u,singleLine:c}=this.attribute,p=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else{let i=this.combinedStyleToCharacter(e[t]);if((0,ib.Z)(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){let t=i.text.split("\n");for(let e=0;e0,g="number"==typeof r&&Number.isFinite(r)&&r>0,m="number"==typeof n&&Number.isFinite(n)&&n>0&&(!f||n<=i),v="number"==typeof s&&Number.isFinite(s)&&s>0&&(!g||s<=r),b=new mh(0,0,(m?n:f?i:0)||0,(v?s:g?r:0)||0,a,o,l,h,d,u||"horizontal",!m&&f,!v&&g,c||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),y=new mm(b);for(let t=0;t{i.setStage(t,e)})}bindIconEvent(){this.addEventListener("pointermove",t=>{var e,i,r,n,s;let a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(r=this.stage)||void 0===r||r.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(s=this.stage)||void 0===s||s.renderNextFrame()))}),this.addEventListener("pointerleave",t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())})}pickIcon(t){let e;let i=this.getFrameCache(),{e:r,f:n}=this.globalTransMatrix;return i.icons.forEach(i=>{var s,a;i.AABBBounds.containsPoint({x:t.x-r,y:t.y-n})&&((e=i).globalX=(null!==(s=e.attribute.x)&&void 0!==s?s:0)+r,e.globalY=(null!==(a=e.attribute.y)&&void 0!==a?a:0)+n)}),e}getNoWorkAnimateAttr(){return mb.NOWORK_ANIMATE_ATTR}}function my(t){return new mb(t)}mb.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},nj);let mx=new class t extends a3{constructor(){super(...arguments),this.time=oF.beforeFillStroke}drawShape(t,e,i,r,n,s,a,o,l,h,d,u){var c,p,f,g,m,v,b,y,x,_;let{backgroundMode:w=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute,S,{background:E}=t.attribute;if(!E)return;let T=(0,ep.Z)(E)&&E.background,C=t.transMatrix.onlyTranslate();if(T){let e=t.AABBBounds,i=(null!==(c=E.x)&&void 0!==c?c:e.x1)+(null!==(p=E.dx)&&void 0!==p?p:0),r=(null!==(f=E.y)&&void 0!==f?f:e.y1)+(null!==(g=E.dy)&&void 0!==g?g:0),n=null!==(m=E.width)&&void 0!==m?m:e.width(),s=null!==(v=E.height)&&void 0!==v?v:e.height();if(S=aR.allocate(i,r,i+n,r+s),E=E.background,!C){let t=S.width(),e=S.height();S.set((null!==(b=E.x)&&void 0!==b?b:0)+(null!==(y=E.dx)&&void 0!==y?y:0),(null!==(x=E.y)&&void 0!==x?x:0)+(null!==(_=E.dy)&&void 0!==_?_:0),t,e)}}else S=t.AABBBounds,C||(S=gH(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){let n=t.resources.get(E);if("success"!==n.state||!n.data)return;e.highPerformanceSave(),C&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,r,l),this.doDrawImage(e,n.data,S,w,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{let{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,r,l),e.fillStyle=E,n?(aD(e,S.x1,S.y1,S.width(),S.height(),n),e.fill()):e.fillRect(S.x1,S.y1,S.width(),S.height()),e.highPerformanceRestore()}T&&aR.free(S)}},m_=class extends oe{constructor(){super(),this.numberType=sd,this.builtinContributions=[mx],this.init()}drawShape(t,e,i,r,n){var s,a,o,l;let h=rQ(t).richtext,{strokeOpacity:d=h.strokeOpacity,opacity:u=h.opacity,fillOpacity:c=h.fillOpacity,visible:p=h.visible}=t.attribute;if(!t.valid||!p)return;let f=(s=u,a=c,s*a>0),g=(o=u,l=d,o*l>0);f&&(e.translate(i,r),this.beforeRenderStep(t,e,i,r,f,g,f,g,h,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,r,f,g,f,g,h,n))}drawIcon(t,e,i,r,n){var s;let a=rQ(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:d,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:c=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:f=a.backgroundStrokeOpacity,backgroundRadius:g=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:b=l}=t.attribute;if(m&&(i+=t._marginArray[3],r+=t._marginArray[0]),t._hovered){let t=(v-o)/2,n=(b-l)/2;0===g?(e.beginPath(),e.rect(i-t,r-n,v,b)):(e.beginPath(),aD(e,i-t,r-n,v,b,g)),u&&(e.globalAlpha=c,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=f,e.strokeStyle=p,e.stroke())}let y=d&&(null===(s=null==t?void 0:t.resources)||void 0===s?void 0:s.get(d));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,r,o,l))}draw(t,e,i){let r=rQ(t).richtext;this._draw(t,r,!1,i)}};m_=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],m_);let mw=!1,mA=new eB(t=>{mw||(mw=!0,t(sG).to(m_).inSingletonScope(),t(sO).toService(sG))}),mS=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=sd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};mS=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(K=0,q=eH(sG),function(t,e){q(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],mS);let mE=!1,mT=new eB((t,e,i,r)=>{mE||(mE=!0,t(p6).to(mS).inSingletonScope(),t(p9).toService(p6))}),mC=class{constructor(){this.type="image",this.numberType=sr}contains(t,e,i){let{pickContext:r}=null!=i?i:{};return!!r&&!!t.AABBBounds.containsPoint(e)}};mC=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],mC);let mk=!1,mM=new eB((t,e,i,r)=>{mk||(mk=!0,t(pF).to(mC).inSingletonScope(),t(mC).toService(pF))});function mB(){mB.__loaded||(mB.__loaded=!0,as.RegisterGraphicCreator("richtext",my),rO.load(mA),rO.load(pI?mT:mM))}mB.__loaded=!1;function mP(t,e={},i){i||(i=1);let{fontStyle:r=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(r?r+" ":"")+(n?n+" ":"")+(s?s+" ":"")+a*i+"px "+(o||"sans-serif")}function mR(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function mO(t,e,i,r=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?r-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class mI{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=-(t.width/2);else{if("right"!==e&&"end"!==e)throw Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?-(t.height/2):"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,r,n,s,a,o,l){let h=[],d=[e,i],u=[0,0];for(;t.length>0;){let{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===r||"start"===r||("center"===r?u[0]=-(d[0]/2):"right"!==r&&"end"!==r||(u[0]=-d[0])),"top"===n||("middle"===n?u[1]=-(d[1]/2):"bottom"===n&&(u[1]=-d[1]));let c={xOffset:u[0],yOffset:u[1],width:d[0],height:d[1]};return this.layoutWithBBox(c,h,r,n,s)}GetLayoutByLines(t,e,i,r,n="",s,a,o="end"){t=t.map(t=>t.toString());let l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,r=t.length;iMath.max(t,e.width),0);let d={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(d,e,i),this.layoutWithBBox(d,l,e,i,r)}layoutWithBBox(t,e,i,r,n){let s=[0,0],a=e.length*n;"top"===r||("middle"===r?s[1]=(t.height-a)/2:"bottom"===r&&(s[1]=t.height-a));for(let a=0;at.text).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=sc,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){let{text:t}=this.attribute;return(0,ev.Z)(t)?!t.every(t=>null==t||""===t):null!=t&&""!==t}doUpdateAABBBounds(){let t=rQ(this).text;this._AABBBounds.clear();let e=this.attribute,i=ru.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=this.attribute,n=nU(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,r,n;let s=rQ(this).text,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:c=s.stroke,lineWidth:p=s.lineWidth,wordBreak:f=s.wordBreak,fontWeight:g=s.fontWeight,ignoreBuf:m=s.ignoreBuf,suffixPosition:v=s.suffixPosition,heightLimit:b=0,lineClamp:y}=this.attribute,x=null!==(e=n0(this.attribute.lineHeight,this.attribute.fontSize||s.fontSize))&&void 0!==e?e:this.attribute.fontSize||s.fontSize;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){let t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(p/2),this._AABBBounds}let _=new mI(a,{fontSize:h,fontWeight:g,fontFamily:a},ru.graphicUtil.textMeasure),w=(0,ev.Z)(t)?t.map(t=>t.toString()):[t.toString()],A=[],S=[0,0],E=1/0;if(b>0&&(E=Math.max(Math.floor(b/x),1)),y&&(E=Math.min(E,y)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)}),S[0]=t}else{let t,e,i=0;for(let r=0,n=w.length;r{let e=t.direction===oU.HORIZONTAL?u:a.measureTextWidth(t.text,{fontSize:u,fontWeight:c,fontFamily:p});n+=e,t.width=e}),this.cache.verticalList=_,this.cache.clipedWidth=n;this.clearUpdateShapeTag();let w=mR(y,n),A=mO(x,b,u);return this._AABBBounds.set(A,w,A+b,w+n),f&&this._AABBBounds.expand(g/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;let r=rQ(this).text,{wrap:n=r.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);let s=this.attribute,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,fontWeight:d=r.fontWeight,ellipsis:u=r.ellipsis,maxLineWidth:c,stroke:p=r.stroke,lineWidth:f=r.lineWidth,whiteSpace:g=r.whiteSpace,suffixPosition:m=r.suffixPosition}=s,v=null!==(e=n0(s.lineHeight,s.fontSize||r.fontSize))&&void 0!==e?e:s.fontSize||r.fontSize;if("normal"===g)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){let t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(f/2),this._AABBBounds}let b=new mI(a,{fontSize:h,fontWeight:d,fontFamily:a},ru.graphicUtil.textMeasure).GetLayoutByLines(t,o,l,v,!0===u?r.ellipsis:u||void 0,!1,c,m),{bbox:y}=b;return this.cache.layoutData=b,this.clearUpdateShapeTag(),this._AABBBounds.set(y.xOffset,y.yOffset,y.xOffset+y.width,y.yOffset+y.height),p&&this._AABBBounds.expand(f/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,i,r;let n;let s=rQ(this).text,a=ru.graphicUtil.textMeasure,o=this.attribute,{ignoreBuf:l=s.ignoreBuf}=o,{maxLineWidth:h=s.maxLineWidth,ellipsis:d=s.ellipsis,fontFamily:u=s.fontFamily,fontSize:c=s.fontSize,fontWeight:p=s.fontWeight,stroke:f=s.stroke,lineWidth:g=s.lineWidth,verticalMode:m=s.verticalMode,suffixPosition:v=s.suffixPosition}=o,b=null!==(e=n0(o.lineHeight,o.fontSize||s.fontSize))&&void 0!==e?e:(o.fontSize||s.fontSize)+(l?0:2),{textAlign:y=s.textAlign,textBaseline:x=s.textBaseline}=o;if(!m){let t=y;y=null!==(i=mD.baselineMapAlign[x])&&void 0!==i?i:"left",x=null!==(r=mD.alignMapBaseline[t])&&void 0!==r?r:"top"}if(n=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach(t=>{let e=t.reduce((t,e)=>t+e.width,0);n=(0,eJ.Fp)(e,n)});let t=mR(y,n),e=this.cache.verticalList.length*b,i=mO(x,e,c);return this._AABBBounds.set(i,t,i+e,t+n),f&&this._AABBBounds.expand(g/2),this._AABBBounds}let _=t.map(t=>n3(t.toString()));_.forEach((t,e)=>{if(Number.isFinite(h)){if(d){let i=!0===d?s.ellipsis:d,r=a.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:p,fontFamily:u},h,i,!1,v);_[e]=r.verticalList,n=r.width}else{let i=a.clipTextVertical(t,{fontSize:c,fontWeight:p,fontFamily:u},h,!1);_[e]=i.verticalList,n=i.width}}else n=0,t.forEach(t=>{let e=t.direction===oU.HORIZONTAL?c:a.measureTextWidth(t.text,{fontSize:c,fontWeight:p,fontFamily:u});n+=e,t.width=e})}),this.cache.verticalList=_,this.clearUpdateShapeTag(),this.cache.verticalList.forEach(t=>{let e=t.reduce((t,e)=>t+e.width,0);n=(0,eJ.Fp)(e,n)});let w=mR(y,n),A=this.cache.verticalList.length*b,S=mO(x,A,c);return this._AABBBounds.set(S,w,S+A,w+n),f&&this._AABBBounds.expand(g/2),this._AABBBounds}tryUpdateOBBBounds(){throw Error("暂不支持")}getDefaultAttribute(t){return rQ(this).text[t]}needUpdateTags(t,e=mL){return super.needUpdateTags(t,e)}needUpdateTag(t,e=mL){return super.needUpdateTag(t,e)}clone(){return new mD(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mD.NOWORK_ANIMATE_ATTR}}function mN(t){return new mD(t)}mD.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},nj),mD.baselineMapAlign={top:"left",bottom:"right",middle:"center"},mD.alignMapBaseline={left:"top",right:"bottom",center:"middle"};var mj=function(t,e){return function(i,r){e(i,r,t)}};let mF=class extends oe{constructor(t){super(),this.textRenderContribitions=t,this.numberType=sc,this.builtinContributions=[mx],this.init(t)}drawShape(t,e,i,r,n,s,a,o){var l,h,d;let u=rQ(t,null==s?void 0:s.theme).text,{text:c,underline:p=u.underline,lineThrough:f=u.lineThrough,keepDirIn3d:g=u.keepDirIn3d,direction:m=u.direction,whiteSpace:v=u.whiteSpace,fontSize:b=u.fontSize,verticalMode:y=u.verticalMode,x:x=u.x,y:_=u.y}=t.attribute,{textAlign:w=u.textAlign,textBaseline:A=u.textBaseline}=t.attribute;if(!y&&"vertical"===m){let e=w;w=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}let S=null!==(d=n0(t.attribute.lineHeight,b))&&void 0!==d?d:b,E=this.valid(t,u,a,o);if(!E)return;let{fVisible:T,sVisible:C,doFill:k,doStroke:M}=E,B=!g,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,r,k,M,T,C,u,n,a,o),B&&this.transformUseContext2d(t,u,P,e);let R=(n,s,l,h)=>{let d=i+s,c=r+l;if(h){e.highPerformanceSave(),d+=b;let t=s0.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,c),e.transformFromMatrix(t,!0),s0.free(t)}M&&(o?o(e,t.attribute,u):C&&(e.setStrokeStyle(t,t.attribute,x-i,_-r,u),e.strokeText(n,d,c,P))),k&&(a?a(e,t.attribute,u):T&&(e.setCommonStyle(t,t.attribute,x-i,_-r,u),e.fillText(n,d,c,P),this.drawUnderLine(p,f,t,d,c,P,u,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine){if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,P),"horizontal"===m){let{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();let{xOffset:s,yOffset:l}=n.bbox;M&&(o?o(e,t.attribute,u):C&&(e.setStrokeStyle(t,t.attribute,x-i,_-r,u),n.lines.forEach(t=>{e.strokeText(t.str,(t.leftOffset||0)+s+i,(t.topOffset||0)+l+r,P)}))),k&&(a?a(e,t.attribute,u):T&&(e.setCommonStyle(t,t.attribute,x-i,_-r,u),n.lines.forEach(n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+s+i,(n.topOffset||0)+l+r,P),this.drawMultiUnderLine(p,f,t,(n.leftOffset||0)+i,(n.topOffset||0)+l+r-(a="bottom",o=b,"top"===a?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*b,P,n.width,u,e)})))}else{t.tryUpdateAABBBounds();let{verticalList:i}=t.cache;e.textAlign="left",e.textBaseline="top";let r=S*i.length,n=0;i.forEach(t=>{let e=t.reduce((t,e)=>t+(e.width||0),0);n=(0,eJ.Fp)(e,n)});let s=0,a=0;"bottom"===A?a=-r:"middle"===A&&(a=-r/2),"center"===w?s-=n/2:"right"===w&&(s-=n),i.forEach((t,e)=>{let i=t.reduce((t,e)=>t+(e.width||0),0),o=n-i,l=s;"center"===w?l+=o/2:"right"===w&&(l+=o),t.forEach(t=>{let{text:i,width:n,direction:s}=t;R(i,r-(e+1)*S+a,l,s),l+=n})})}}else if("horizontal"===m){e.setTextStyle(t.attribute,u,P);let i=t.clipedText,r=0;S!==b&&("top"===A?r=(S-b)/2:"middle"===A||"bottom"===A&&(r=-(S-b)/2)),R(i,0,r,0)}else{t.tryUpdateAABBBounds();let i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,u,P);let{verticalList:r}=i,n=0,s=r[0].reduce((t,e)=>t+(e.width||0),0),a=0;"bottom"===A?a=-S:"middle"===A&&(a=-S/2),"center"===w?n-=s/2:"right"===w&&(n-=s),e.textAlign="left",e.textBaseline="top",r[0].forEach(t=>{let{text:e,width:i,direction:r}=t;R(e,a,n,r),n+=i})}}B&&this.restoreTransformUseContext2d(t,u,P,e),this.afterRenderStep(t,e,i,r,k,M,T,C,u,n,a,o)}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).text,{keepDirIn3d:s=n.keepDirIn3d}=t.attribute;this._draw(t,n,!s,i,r)}drawUnderLine(t,e,i,r,n,s,a,o){if(e+t<=0)return;let{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,fill:u=a.fill,opacity:c=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:g=a.fillOpacity}=i.attribute,m=i.clipedWidth,v=mR(l,m),b=mO(h,d,d),y={lineWidth:0,stroke:u,opacity:c,strokeOpacity:g};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,r,n,a),o.setLineDash(f),o.beginPath();let e=n+b+d+p;o.moveTo(r+v,e,s),o.lineTo(r+v+m,e,s),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,r,n,a),o.beginPath();let t=n+b+d/2;o.moveTo(r+v,t,s),o.lineTo(r+v+m,t,s),o.stroke()}}drawMultiUnderLine(t,e,i,r,n,s,a,o,l){if(e+t<=0)return;let{textAlign:h=o.textAlign,fontSize:d=o.fontSize,fill:u=o.fill,opacity:c=o.opacity,underlineOffset:p=o.underlineOffset,underlineDash:f=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=mR(h,a),v=mO("alphabetic",d,d),b={lineWidth:0,stroke:u,opacity:c,strokeOpacity:g},y=-3;if(t){b.lineWidth=t,l.setStrokeStyle(i,b,r,n,o),l.setLineDash(f),l.beginPath();let e=n+v+d+y+p;l.moveTo(r+m,e,s),l.lineTo(r+m+a,e,s),l.stroke()}if(y=-1,e){b.lineWidth=e,l.setStrokeStyle(i,b,r,n,o),l.beginPath();let t=n+v+d/2+y;l.moveTo(r+m,t,s),l.lineTo(r+m+a,t,s),l.stroke()}}};mF=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),mj(0,eH(eU)),mj(0,eG(a1)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],mF);let mz=!1,mH=new eB(t=>{mz||(mz=!0,t(sH).to(mF).inSingletonScope(),t(sO).toService(sH),t(a1).toService(a6),eW(t,a1))}),mG=class extends ft{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=sc}contains(t,e,i){let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=t.AABBBounds;if(!r.camera)return!!n.containsPoint(e);r.highPerformanceSave();let s=rQ(t).text,{keepDirIn3d:a=s.keepDirIn3d}=t.attribute,{x:o,y:l,z:h,lastModelMatrix:d}=this.transform(t,s,r,!a);this.canvasRenderer.z=h;let u=e;if(r.camera){u=e.clone();let i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}let c=!1;return this.canvasRenderer.drawShape(t,r,o,l,{},null,(e,i,r)=>{if(c)return!0;let{fontSize:n=s.fontSize,textBaseline:a=s.textBaseline,textAlign:d=s.textAlign}=t.attribute,p=t.AABBBounds,f=p.height(),g=p.width(),m=mO(a,f,n),v=mR(d,g);return e.rect(v+o,m+l,g,f,h),c=e.isPointInPath(u.x,u.y)},(t,e,i)=>c),this.canvasRenderer.z=0,r.modelMatrix!==d&&s1.free(r.modelMatrix),r.modelMatrix=d,r.highPerformanceRestore(),c}};mG=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(J=0,Q=eH(sH),function(t,e){Q(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],mG);let mU=!1,mV=new eB((t,e,i,r)=>{mU||(mU=!0,t(p5).to(mG).inSingletonScope(),t(p9).toService(p5))}),mW=class{constructor(){this.type="text",this.numberType=sc}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};mW=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],mW);let mZ=!1,m$=new eB((t,e,i,r)=>{mZ||(mZ=!0,t(pV).to(mW).inSingletonScope(),t(pL).toService(pV))});function mY(){mY.__loaded||(mY.__loaded=!0,as.RegisterGraphicCreator("text",mN),rO.load(mH),rO.load(pI?mV:m$))}mY.__loaded=!1;function mX(){pk(),ml(),gD(),mB(),mY()}var mK=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);ne.indexOf(r[n])&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};mX();class mq extends pC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},mq.defaultAttributes,t)),this.name="tag"}render(){var t,e;let i;let{text:r="",textStyle:n={},shape:s={},panel:a={},space:o=4,minWidth:l,maxWidth:h,padding:d=4,visible:u,state:c,type:p,textAlwaysCenter:f}=this.attribute,g=(0,pE.o)(d),m=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group"),v,b=g[1]+g[3],y=g[0]+g[2],x=0,_=0,{visible:w}=s,A=mK(s,["visible"]);if(r4(w)){let t=(null==A?void 0:A.size)||10,e=(0,ib.Z)(t)?t:Math.max(t[0],t[1]);v=m.createOrUpdateChild("tag-shape",Object.assign(Object.assign({symbolType:"circle",size:t,strokeBoundsBuffer:0},A),{visible:w,x:e/2,y:e/2}),"symbol"),dn(null==c?void 0:c.shape)||(v.states=c.shape),w&&(_=e+o)}if(b+=_,x+=_,gX({text:r})||"rich"===p){let t=Object.assign(Object.assign(Object.assign({},gK(Object.assign({type:p,text:r},n))),n),{visible:ey(r)&&!1!==u,x:x,y:0});i=m.createOrUpdateChild("tag-text",t,"richtext");let{visible:e}=a,s=mK(a,["visible"]);if(u&&r4(e)){let t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},s),{visible:e&&!!r,x:i.AABBBounds.x1,y:i.AABBBounds.y1,width:i.AABBBounds.width(),height:i.AABBBounds.height()}),"rect");dn(null==c?void 0:c.panel)||(t.states=c.panel)}}else{let o=Object.assign(Object.assign({text:(0,ep.Z)(r)&&"type"in r&&"text"===r.type?r.text:r,visible:ey(r)&&!1!==u,lineHeight:null==n?void 0:n.fontSize},n),{x:x,y:0});(0,eC.Z)(o.lineHeight)&&(o.lineHeight=n.fontSize),i=m.createOrUpdateChild("tag-text",o,"text"),dn(null==c?void 0:c.text)||(i.states=c.text);let d=gY(o.text,n,null===(t=this.stage)||void 0===t?void 0:t.getTheme().text.fontFamily),p=d.width,w=d.height;b+=p;let A=null!==(e=s.size)&&void 0!==e?e:10,S=(0,ib.Z)(A)?A:Math.max(A[0],A[1]);y+=Math.max(w,s.visible?S:0);let{textAlign:E,textBaseline:T}=n;(ey(l)||ey(h))&&(ey(l)&&bh&&(b=h,i.setAttribute("maxLineWidth",h-g[1]-g[2])));let C=0,k=0,M=0;if("left"===E||"start"===E?M=1:"right"===E||"end"===E?M=-1:"center"===E&&(M=0),M?M<0?(C-=b,v&&v.setAttribute("x",(v.attribute.x||0)-p),m.setAttribute("x",-g[1]-_)):M>0&&m.setAttribute("x",g[3]):(C-=b/2,v&&v.setAttribute("x",(v.attribute.x||0)-p/2),m.setAttribute("x",-_/2)),f&&M){let t=b-g[1]-g[3],e=p+_,r=(t-e)/2+_+p/2;i.setAttributes({x:r*M,textAlign:"center"}),null==v||v.setAttributes({x:((t-e)/2+S/2)*M}),m.setAttribute("x",g[2+M]*M)}"middle"===T?(k-=y/2,v&&v.setAttribute("y",0)):"bottom"===T?(k-=y,v&&v.setAttribute("y",-w/2),m.setAttribute("y",-g[2])):"top"===T&&(m.setAttribute("y",g[0]),v&&v.setAttribute("y",w/2));let{visible:B}=a,P=mK(a,["visible"]);if(u&&r4(B)){let t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},P),{visible:B&&!!r,x:C,y:k,width:b,height:y}),"rect");dn(null==c?void 0:c.panel)||(t.states=c.panel)}}}}mq.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};let mJ=(t=0)=>{if(t<0)for(;t<0;)t+=eJ.BZ;else if(t>0)for(;t>eJ.BZ;)t-=eJ.BZ;return t};function mQ(t,e,i){return!dQ(t,e,0,1e-6)&&!dJ(t,i,0,1e-6)}function m0(t){let e={};return gF(t,t=>{"group"!==t.type&&t.id&&(e[t.id]=t)}),e}class m1 extends pC{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{let e=t.target;e!==this._lastHover&&e.name&&!dn(e.states)&&(e.addState(t2.hover,!0),gF(this.axisContainer,t=>{t!==e&&t.name&&!dn(t.states)&&t.addState(t2.hoverReverse,!0)}),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(gF(this.axisContainer,t=>{t.name&&!dn(t.states)&&(t.removeState(t2.hoverReverse),t.removeState(t2.hover))}),this._lastHover=null)},this._onClick=t=>{let e=t.target;if(this._lastSelect===e&&e.hasState(t2.selected))return this._lastSelect=null,void gF(this.axisContainer,t=>{t.name&&!dn(t.states)&&(t.removeState(t2.selectedReverse),t.removeState(t2.selected))});e.name&&!dn(e.states)&&(e.addState(t2.selected,!0),gF(this.axisContainer,t=>{t!==e&&t.name&&!dn(t.states)&&t.addState(t2.selectedReverse,!0)}),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){let e=ly(this.attribute);lE(this.attribute,t);let i=as.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&m0(this._innerView),this.removeAllChild(!0),this._innerView=as.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;let{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){let{title:e,label:i,tick:r,line:n,items:s}=this.attribute,a=as.group({x:0,y:0,zIndex:1});if(a.name=t5.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),s&&s.length&&(this.data=this._transformItems(s[0]),r&&r.visible&&this.renderTicks(a),i&&i.visible)){let t=as.group({x:0,y:0,pickable:!1});t.name=t5.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),s.forEach((e,i)=>{let r=this.renderLabels(t,e,i),n=r.getChildren();this.beforeLabelsOverlap(n,e,r,i,s.length),this.handleLabelsOverlap(n,e,r,i,s.length),this.afterLabelsOverlap(n,e,r,i,s.length);let a=0,o=0,l="center",h="middle";n.forEach(t=>{var e;let i=t.attribute,r=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds,s=n.width(),d=n.height();r&&(s=Math.abs(s*Math.cos(r)),d=Math.abs(d*Math.sin(r))),a=Math.max(a,s),o=Math.max(o,d),l=i.textAlign,h=i.textBaseline}),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}})}e&&e.visible&&this.renderTitle(a)}renderTicks(t){let e=this.getTickLineItems(),i=as.group({x:0,y:0,pickable:!1});i.name=t5.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach((t,r)=>{var n;let s=as.line(Object.assign({},this._getTickLineAttribute("tick",t,r,e)));if(s.name=t5.tick,s.id=this._getNodeId(t.id),dn(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))s.states=gW;else{let t=this.data[r],e=lE({},gW,this.attribute.tick.state);Object.keys(e).forEach(i=>{r6(e[i])&&(e[i]=e[i](t.rawValue,r,t,this.data))}),s.states=e}i.add(s)}),this.tickLineItems=e;let{subTick:r}=this.attribute;if(r&&r.visible){let t=this.getSubTickLineItems();t.length&&t.forEach((t,n)=>{let s=as.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(s.name=t5.subTick,s.id=this._getNodeId(`${n}`),dn(r.state))s.states=gW;else{let i=lE({},gW,r.state);Object.keys(i).forEach(r=>{r6(i[r])&&(i[r]=i[r](t.value,n,t,e))}),s.states=i}i.add(s)}),this.subTickLineItems=t}}renderLabels(t,e,i){let{dataFilter:r}=this.attribute.label;r&&r6(r)&&(e=r(e,i));let n=this._transformItems(e),s=as.group({x:0,y:0,pickable:!1});return s.name=`${t5.labelContainer}-layer-${i}`,s.id=this._getNodeId(`label-container-layer-${i}`),t.add(s),n.forEach((t,e)=>{var r;let a;let o=this._getLabelAttribute(t,e,n,i);if((a=gX(o)?as.richtext(gK(o)):as.text(o)).name=t5.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),dn(null===(r=this.attribute.label)||void 0===r?void 0:r.state))a.states=gW;else{let r=lE({},gW,this.attribute.label.state);Object.keys(r).forEach(s=>{r6(r[s])&&(r[s]=r[s](t,e,n,i))}),a.states=r}s.add(a)}),s}renderTitle(t){let e=new mq(Object.assign({},this.getTitleAttribute()));e.name=t5.title,e.id=this._getNodeId("title"),t.add(e)}getVerticalCoord(t,e,i){let r=this.getVerticalVector(e,i,t);return{x:t.x+r[0],y:t.y+r[1]}}getTextAlign(t){let e="center";return dq(t[0],0)?dq(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){let{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:r,inside:n=!1,length:s,dataFilter:a}=t,o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&r6(a)?a(e):e).forEach(t=>{let e=t.point,a=t.value;if(!r){let i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}let l=this.getVerticalCoord(e,s,n);if("3d"===this.mode){let r=this.getVerticalVector(s,n,e),o=0,h=0;(0,eJ.Wn)(r[0])>(0,eJ.Wn)(r[1])?o=eJ.pi/2*(l.x>e.x?1:-1):h=eJ.pi/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})}),i}getSubTickLineItems(){let{subTick:t}=this.attribute,e=[],{count:i=4,inside:r=!1,length:n=2}=t,s=this.tickLineItems,a=s.length;if(a>=2)for(let t=0;t0&&(0===p[1]?u+=(this.axisLabelLayerSize[r-1].height+lX(this.attribute,"label.space",4))*r:u+=(this.axisLabelLayerSize[r-1].width+lX(this.attribute,"label.space",4))*r);let f=this.getVerticalCoord(t.point,u,o),g=this.getVerticalVector(u||1,o,f),m=l?l(`${t.label}`,t,e,i,r):t.label,{style:v}=this.attribute.label;return v=r6(v)?lE({},gJ.label.style,v(t,e,i,r)):v,r6((v=lE(this.getLabelAlign(g,o,v.angle),v)).text)&&(v.text=v.text({label:t.label,value:t.rawValue,index:t.index,layer:r})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,g,m,v)),{text:null!=d?d:m,lineHeight:null==v?void 0:v.fontSize,type:h}),v)}getLabelPosition(t,e,i,r){return t}_transformItems(t){let e=[];return t.forEach(t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))}),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function m2(t){t.forEach(t=>{var e,i,r,n,s;if(t.rotatedBounds||!t.attribute.angle)return;let a=function(t){let e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),o=(e=a.centerX,i=a.centerY,r=a.angle,n=t.attribute.x,{x:(e-n)*Math.cos(r)+(i-(s=t.attribute.y))*Math.sin(r)+n,y:(e-n)*Math.sin(r)+(s-i)*Math.cos(r)+s}),l=o.x-a.centerX,h=o.y-a.centerY;a.x1+=l,a.x2+=l,a.y1+=h,a.y2+=h,a.centerX+=l,a.centerY+=h,t.rotatedBounds=a})}let m5={parity:function(t){return t.filter((t,e)=>e%2?t.setAttribute("opacity",0):1)},greedy:function(t,e){let i;return t.filter((t,r)=>r&&m3(i,t,e)?t.setAttribute("opacity",0):(i=t,1))}};function m3(t,e,i){let r=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-r.x2,r.x1-n.x2,n.y1-r.y2,r.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function m4(t,e){for(let i,r=1,n=t.length,s=t[0];r1&&e.height()>1}function m8(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function m7(t,e=0){let i,r=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(r=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);let s=(e=m8(e))/(.5*Math.PI);return{textAlign:r[i=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1],textBaseline:n[i]}}function m9(t,e=0){let i,r=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(r=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);let s=(e=m8(e))/(.5*Math.PI);return{textAlign:r[i=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1],textBaseline:n[i]}}class vt{isInValidValue(t){return t<0||t>1}getTickCoord(t){let{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){let{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){let{verticalFactor:r=1}=this.attribute,n=function(t){let[e,i]=t,r=e*e+i*i;return r>0&&(r=1/Math.sqrt(r)),[t[0]*r,t[1]*r]}(this.getRelativeVector());return gj([n[1],-1*n[0]],t*(e?1:-1)*r)}}let ve=["radius","startAngle","endAngle",...nO];class vi extends nF{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=st}isValid(){return super.isValid()&&this._isValid()}_isValid(){let{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){let e=rQ(this).circle;this._AABBBounds.clear();let i=this.attribute,r=ru.graphicService.updateCircleAABBBounds(i,rQ(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,s=nU(n);return s&&r.expand(s),this.clearUpdateBoundTag(),r}tryUpdateOBBBounds(){throw Error("暂不支持")}getDefaultAttribute(t){return rQ(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,ve)}needUpdateTag(t){return super.needUpdateTag(t,ve)}toCustomPath(){var t,e,i;let r=this.attribute,n=null!==(t=r.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),s=null!==(e=r.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=r.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new iK;return o.arc(0,0,n,s,a),o}clone(){return new vi(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vi.NOWORK_ANIMATE_ATTR}}function vr(t){return new vi(t)}vi.NOWORK_ANIMATE_ATTR=nj;let vn=new class t{constructor(){this.time=oF.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,s,a,o,l,h,d,u){let{outerBorder:c,innerBorder:p}=t.attribute,f=c&&!1!==c.visible,g=p&&!1!==p.visible;if(!f&&!g)return;let{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:b=l.endAngle,opacity:y=l.opacity,x:x=l.x,y:_=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,S=!(!c||!c.stroke),E=!(!p||!p.stroke);if(f){let{distance:n=l.outerBorder.distance}=c,s=aB(e,n,e.dpr);if(e.beginPath(),e.arc(i,r,m+s,v,b),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,c,l.outerBorder);else if(S){let n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,c,(x-i)/w,(_-r)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(g){let{distance:n=l.innerBorder.distance}=p,s=aB(e,n,e.dpr);if(e.beginPath(),e.arc(i,r,m-s,v,b),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,p,l.innerBorder);else if(E){let n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(x-i)/w,(_-r)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}};var vs=function(t,e){return function(i,r){e(i,r,t)}};let va=class extends oe{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=st,this.builtinContributions=[vn,a4,oh],this.init(t)}drawShape(t,e,i,r,n,s,a,o){let l=rQ(t,null==s?void 0:s.theme).circle,{radius:h=l.radius,startAngle:d=l.startAngle,endAngle:u=l.endAngle,x:c=l.x,y:p=l.y}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;let{fVisible:g,sVisible:m,doFill:v,doStroke:b}=f;e.beginPath(),e.arc(i,r,h,d,u),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,v,b,g,m,l,n,a,o),v&&(a?a(e,t.attribute,l):g&&(e.setCommonStyle(t,t.attribute,c-i,p-r,l),e.fill())),b&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,c-i,p-r,l),e.stroke())),this.afterRenderStep(t,e,i,r,v,b,g,m,l,n,a,o)}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).circle;this._draw(t,n,!1,i,r)}};va=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),vs(0,eH(eU)),vs(0,eG(aY)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],va);let vo=!1,vl=new eB(t=>{vo||(vo=!0,t(va).toSelf().inSingletonScope(),t(sR).to(va).inSingletonScope(),t(sO).toService(sR),t(aY).toService(a6),eW(t,aY))}),vh=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=st}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).circle,{x:s=n.x,y:a=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=aB(r,s+a,r.dpr),o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};vh=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tt=0,te=eH(sR),function(t,e){te(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],vh);let vd=!1,vu=new eB((t,e,i,r)=>{vd||(vd=!0,t(pK).to(vh).inSingletonScope(),t(p9).toService(pK))}),vc=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=st}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).circle,{x:s=n.x,y:a=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=s+a,o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};vc=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(ti=0,tr=eH(sR),function(t,e){tr(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],vc);let vp=!1,vf=new eB((t,e,i,r)=>{vp||(vp=!0,t(pj).to(vc).inSingletonScope(),t(pL).toService(pj))});function vg(){vg.__loaded||(vg.__loaded=!0,as.RegisterGraphicCreator("circle",vr),rO.load(vl),rO.load(pI?vu:vf))}vg.__loaded=!1;let vm=["path","customPath",...nO];class vv extends nF{constructor(t){super(t),this.type="path",this.numberType=ss}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){let{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){let t=rQ(this).path;if(!this.valid)return t.path;let e=this.attribute;return e.path instanceof iK?e.path:((0,eC.Z)(this.cache)&&this.doUpdatePathShape(),this.cache instanceof iK?this.cache:t.path)}doUpdateAABBBounds(){let t=rQ(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();let e=this.attribute,i=ru.graphicService.updatePathAABBBounds(e,rQ(this).path,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=nU(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){let t=this.attribute;(0,eT.Z)(t.path,!0)?this.cache=(new iK).fromString(t.path):t.customPath&&(this.cache=new iK,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw Error("暂不支持")}getDefaultAttribute(t){return rQ(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,vm)}needUpdateTag(t){return super.needUpdateTag(t,vm)}toCustomPath(){return(new iK).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new vv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vv.NOWORK_ANIMATE_ATTR}}function vb(t){return new vv(t)}vv.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},nj);var vy=function(t,e){return function(i,r){e(i,r,t)}};let vx=class extends oe{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=ss,this.builtinContributions=[a4,oh],this.init(t)}drawShape(t,e,i,r,n,s,a,o){var l,h,d;let u=null!==(l=this.tempTheme)&&void 0!==l?l:rQ(t,null==s?void 0:s.theme).path,{x:c=u.x,y:p=u.y}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,g=this.valid(t,u,a,o);if(!g)return;let{fVisible:m,sVisible:v,doFill:b,doStroke:y}=g;(e.beginPath(),t.pathShape)?iv(t.pathShape.commandList,e,i,r,1,1,f):iv((null!==(d=t.attribute.path)&&void 0!==d?d:u.path).commandList,e,i,r,1,1,f),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,r,b,y,m,v,u,n,a,o),y&&(o?o(e,t.attribute,u):v&&(e.setStrokeStyle(t,t.attribute,c-i,p-r,u),e.stroke())),b&&(a?a(e,t.attribute,u):m&&(e.setCommonStyle(t,t.attribute,c-i,p-r,u),e.fill())),this.afterRenderStep(t,e,i,r,b,y,m,v,u,n,a,o)}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,r),this.tempTheme=null}};vx=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),vy(0,eH(eU)),vy(0,eG(aq)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],vx);let v_=!1,vw=new eB(t=>{v_||(v_=!0,t(vx).toSelf().inSingletonScope(),t(sD).to(vx).inSingletonScope(),t(sO).toService(sD),t(aq).toService(a6),eW(t,aq))}),vA=class extends ft{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ss}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).path;r.highPerformanceSave();let{x:s,y:a,z:o,lastModelMatrix:l}=this.transform(t,n,r),h=e;if(r.camera){h=e.clone();let i=t.parent.globalTransMatrix;h.x=i.a*e.x+i.c*e.y+i.e,h.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=o;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,e,i)=>!!d||(d=t.isPointInPath(h.x,h.y)),(t,e,i)=>{if(d)return!0;let n=e.lineWidth||i.lineWidth,s=e.pickStrokeBuffer||i.pickStrokeBuffer;return r.lineWidth=aB(r,n+s,r.dpr),d=t.isPointInStroke(h.x,h.y)}),this.canvasRenderer.z=0,r.modelMatrix!==l&&s1.free(r.modelMatrix),r.modelMatrix=l,r.highPerformanceRestore(),d}};vA=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tn=0,ts=eH(sD),function(t,e){ts(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],vA);let vS=!1,vE=new eB((t,e,i,r)=>{vS||(vS=!0,t(pQ).to(vA).inSingletonScope(),t(p9).toService(pQ))}),vT=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=ss}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).path,{x:s=n.x,y:a=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=s+a,o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};vT=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(ta=0,to=eH(sD),function(t,e){to(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],vT);let vC=!1,vk=new eB((t,e,i,r)=>{vC||(vC=!0,t(pH).to(vT).inSingletonScope(),t(pL).toService(pH))});function vM(){vM.__loaded||(vM.__loaded=!0,as.RegisterGraphicCreator("path",vb),rO.load(vw),rO.load(pI?vE:vk))}vM.__loaded=!1;function vB(){pk(),fo(),mB(),mY()}var vP=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);ne.indexOf(r[n])&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};vB(),ml();class vR extends m1{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},vR.defaultAttributes,t),e)}_renderInner(t){var e;super._renderInner(t);let{panel:i}=this.attribute;if(i&&i.visible){let t=this.axisContainer,r=t.AABBBounds,n=as.rect(Object.assign({x:r.x1,y:r.y1,width:r.width(),height:r.height()},i.style));n.name=t5.background,n.id=this._getNodeId("background"),n.states=lE({},gq,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){let{start:e,end:i,line:r}=this.attribute,{startSymbol:n,endSymbol:s,style:a,breakRange:o,breakShape:l,breakShapeStyle:h,state:d}=r,u=Object.assign({points:[e,i],startSymbol:n,endSymbol:s,lineStyle:a},vP(r,["startSymbol","endSymbol","style","breakRange","breakShape","breakShapeStyle","state"]));dn(d)||(u.state={line:lE({},gq,d),symbol:lE({},gq,d)});let c=new gN(u);c.name=t5.line,c.id=this._getNodeId("line"),t.add(c)}getTitleAttribute(){var t,e,i;let r=this.attribute.title,{position:n="middle",space:s=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:d={},maxWidth:u}=r,c=vP(r,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]),p=.5;"start"===n?p=0:"end"===n&&(p=1);let{verticalFactor:f=1}=this.attribute,g=this.getTickCoord(p),m=this.getRelativeVector(),v=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){let t=+lX(this.attribute,"label.space",4);v+=t;let e=Object.keys(this.axisLabelLayerSize).length;if(0===m[1]){let i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?v+=i+(e-1)*t:v=0}else{if(0===m[0]){let i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.width():0;isFinite(i)?v+=i+(e-1)*t:v=0}else Object.keys(this.axisLabelLayerSize).forEach((e,i)=>{v+=this.axisLabelLayerSize[e].width+(i>0?t:0)});let i=this.axisLabelLayerSize[0].textAlign,r="start"===i||"left"===i,n="center"===i,s=m[1]>0;v=1==-1*f?s?r?v:n?v/2:t:r?t:n?v/2:v:s?r?t:n?v/2:v:r?v:n?v/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));let y=b+v+s,x=this.getVerticalCoord(g,y,!1),_=this.getVerticalVector(y,!1,{x:0,y:0}),w,A,{angle:S}=c;if(w="start"===n?"start":"end"===n?"end":"center",(0,eC.Z)(S)&&o){S=function(t,e,i){var r,n;let s=function(t,e){let[i,r]=t,[n,s]=e,a=Math.sqrt((i*i+r*r)*(n*n+s*s));return Math.acos(Math.min(Math.max(a&&(i*n+r*s)/a,-1),1))}(t,e),a=(r=t,n=e,r[0]*n[1]-n[0]*r[1]>=0);return i?a?2*Math.PI-s:s:a?s:2*Math.PI-s}(m,[1,0],!0);let{verticalFactor:t=1}=this.attribute;A=1==-1*t?"bottom":"top"}else w=this.getTextAlign(_),A=this.getTextBaseline(_,!1);let E=u;if((0,eC.Z)(E)){let{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,r=Math.min(t||1/0,e||1/0);if((0,ef.Z)(r)){if("bottom"===i||"top"===i){if(S!==Math.PI/2){let t=Math.abs(Math.cos(null!=S?S:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=r-y}else if(S&&0!==S){let t=Math.abs(Math.sin(S));E=t<1e-6?1/0:this.attribute.end.y/t}else E=r-y}}let T=Object.assign(Object.assign(Object.assign({},x),c),{maxWidth:E,textStyle:Object.assign({textAlign:w,textBaseline:A},a),state:{text:lE({},gq,d.text),shape:lE({},gq,d.shape),panel:lE({},gq,d.background)}});return T.angle=S,l&&l.visible&&(T.shape=Object.assign({visible:!0},l.style),l.space&&(T.space=l.space)),h&&h.visible&&(T.panel=Object.assign({visible:!0},h.style)),T}getTextBaseline(t,e){let i="middle",{verticalFactor:r=1}=this.attribute;return dq(t[1],0)?i=!dq(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1==(e?1:-1)*r?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){let r=this.attribute.orient;if((0,ef.Z)(i)||0===t[0]&&0===t[1]){if("top"===r||"bottom"===r)return m7(r,i);if("left"===r||"right"===r)return m9(r,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,r,n){var s,a,o,l;let{flush:h=!1}=this.attribute.label||{};if(h&&t.length){let{orient:e,start:i,end:r}=this.attribute,n="bottom"===e||"top"===e,h=t[0],d=e_(t),u=n?h.attribute.x>d.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-c}):e.setAttributes({x:o,textAlign:"right"}))}else{let t=u?d:h,e=u?h:d,n=t.AABBBounds.y2,s=e.AABBBounds.y1,a=i.y,c=r.y;sc&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+c-n}):t.setAttributes({y:c,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,r,n){if(dn(t))return;let{verticalLimitSize:s,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(s,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:c,limitEllipsis:p,autoHide:f,autoHideMethod:g,autoHideSeparation:m,lastVisible:v}=a;if(r6(h))h(t,e,r,this);else{if(d&&function(t,e){if(dn(t))return;let{orient:i,labelRotateAngle:r=[0,45,90]}=e;if(0===r.length||t.some(t=>!!t.attribute.angle))return;let n=0,s=0;for(r&&r.length>0&&(s=r.length);n{t.attribute.angle=eQ(e)}),function(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach(e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},m7(t,e.attribute.angle)),{angle:m8(e.attribute.angle)}))})}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},m9(t,e.attribute.angle)),{angle:m8(e.attribute.angle)}))})}(t,e),m2(e)}(i,t),!function(t){for(let r=1;r[e.x-t.x,e.y-t.y],o=ir(t),l=ir(e);r&&r.fillRect(o.x,o.y,2,2),r&&r.fillRect(l.x,l.y,2,2);let h=a(o,l),d=a(n[0],n[1]),u=a(n[1],n[2]),c=a(s[0],s[1]),p=a(s[1],s[2]),f=i?eQ(t.angle):t.angle,g=i?eQ(90-t.angle):t.angle+eJ.ou,m=i?eQ(e.angle):e.angle,v=i?eQ(90-e.angle):e.angle+eJ.ou;g>eJ.f7&&(g-=eJ.f7),v>eJ.f7&&(v-=eJ.f7);let b=(t,e,i,r)=>{let n=[Math.cos(e),Math.sin(e)];return t+(ie(n,i)+ie(n,r))/2>ie(n,h)};return b((t.x2-t.x1)/2,f,c,p)&&b((t.y2-t.y1)/2,g,c,p)&&b((e.x2-e.x1)/2,m,d,u)&&b((e.y2-e.y1)/2,v,d,u)}(e.rotatedBounds,i.rotatedBounds,!0)))return!0}return!1}(t))break}}(t,{labelRotateAngle:u,orient:o}),c&&(0,ef.Z)(l)&&l>0){let e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),r=e?i/t.length:f||d?1/0:i/t.length;!function(t,e){let{limitLength:i,verticalLimitLength:r,ellipsis:n="...",orient:s,axisLength:a}=e;!dn(t)&&(0,ef.Z)(i)&&t.forEach(t=>{var e;let o=t.attribute.angle,l=!(0,eC.Z)(o),h=!l||0===o||o===Math.PI,d=l&&(o===Math.PI/2||o===2*Math.PI/3),u="top"===s||"bottom"===s;if(u&&(d&&Math.floor(t.AABBBounds.height())<=i||h&&Math.floor(t.AABBBounds.width())<=r))return;let c=t.attribute.direction;if(!u&&("vertical"===c&&Math.floor(t.AABBBounds.height())<=r||"vertical"!==c&&(h&&Math.floor(t.AABBBounds.width())<=i||d&&Math.floor(t.AABBBounds.height())<=r)))return;let p=null;if(h||d)p=u||"vertical"===c?r:i;else{let{x1:e,y1:r}=t.AABBBounds,n=function(t,e,i){if(e.xt.left+t.width||e.yt.top+t.height)return null;let r=Math.cos(i),n=Math.sin(i);if(r<1e-16){let i=(t.left-e.x)*n/r+e.y;if(i>=t.top&&i<=t.top+t.height)return{x:t.left,y:i}}if(r>1e-16){let i=(t.left+t.width-e.x)*n/r+e.y;if(i>=t.top&&i<=t.top+t.height)return{x:t.left+t.width,y:i}}if(n<1e-16){let i=(t.top-e.y)*r/n+e.x;if(i>=t.left&&i<=t.left+t.width)return{x:i,y:t.top}}if(n>1e-16){let i=(t.top+t.height-e.y)*r/n+e.x;if(i>=t.left&&i<=t.left+t.width)return{x:i,y:t.top+t.height}}return null}({width:u?a:i,height:u?i:a,left:0,top:0},{x:e,y:r},t.attribute.angle);if(n){let{x:t,y:i}=n;p=Math.floor(Math.sqrt((t-e)**2+(i-r)**2))}else p=Math.abs(i/Math.sin(o))}(0,ef.Z)(t.attribute.maxLineWidth)&&(p=(0,ef.Z)(p)?Math.min(t.attribute.maxLineWidth,p):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:p,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})})}(t,{limitLength:l,verticalLimitLength:r,ellipsis:p,orient:o,axisLength:i})}f&&function(t,e){var i;let r;if(dn(t))return;let n=t.filter(m6);if(dn(n))return;(i=n).forEach(t=>t.setAttribute("opacity",1)),m2(r=i);let{method:s="parity",separation:a=0}=e,o=r6(s)?s:m5[s]||m5.parity;if(r.length>=3&&m4(r,a)){do r=o(r,a);while(r.length>=3&&m4(r,a));if(r.length<3||e.lastVisible){let t=e_(n);if(!t.attribute.opacity){let e=r.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&m3(r[i],t,a);i--)r[i].setAttribute("opacity",0)}}}}n.forEach(t=>{t.setAttribute("visible",!!t.attribute.opacity)})}(t,{orient:o,method:g,separation:m,lastVisible:v})}}afterLabelsOverlap(t,e,i,r,n){let{verticalLimitSize:s,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds,h=o?l.height():l.width(),{verticalMinSize:d}=this.attribute;if((0,ef.Z)(d)&&(!(0,ef.Z)(s)||d<=s)){let t,e;h=Math.max(h,this._getAxisLabelLimitLength(d,n)),"left"===a?(t=l.x2-h,e=l.y1):"right"===a?(t=l.x1,e=l.y1):"top"===a?(t=l.x1,e=l.y2-h):"bottom"===a&&(t=l.x1,e=l.y1);let r=as.rect({x:t,y:e,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=t5.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(ey(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,r,n){if("right"===r||"left"===r){if("left"===n){let n="right"===r?0:-1;t.forEach(t=>{t.setAttributes({x:e+i*n,textAlign:"left"})})}else if("right"===n){let n="right"===r?1:0;t.forEach(t=>{t.setAttributes({x:e+i*n,textAlign:"right"})})}else if("center"===n){let n="right"===r?1:-1;t.forEach(t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})})}}else if("bottom"===r||"top"===r){if("top"===n){let n="bottom"===r?0:-1;t.forEach(t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})})}else if("bottom"===n){let n="bottom"===r?1:0;t.forEach(t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})})}else if("middle"===n){let n="bottom"===r?1:-1;t.forEach(t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})})}}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,r,n,s;let{label:a,title:o,line:l,tick:h}=this.attribute,d=null!==(i=a.space)&&void 0!==i?i:4,u=t,c=0,p=0,f=l&&l.visible?null!==(r=l.style.lineWidth)&&void 0!==r?r:1:0,g=h&&h.visible?null!==(n=h.length)&&void 0!==n?n:4:0;if(o&&o.visible&&"string"==typeof o.text){c=gY(o.text,o.textStyle,null===(s=this.stage)||void 0===s?void 0:s.getTheme().text.fontFamily).height;let t=(0,pE.o)(o.padding);p=o.space+t[0]+t[2]}return u&&(u=(u-d-p-c-f-g)/e),u}}vR.defaultAttributes=gJ,cI(vR,vt);class vO{isInValidValue(t){let{startAngle:e=gG,endAngle:i=gU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){let{startAngle:e=gG,endAngle:i=gU,center:r,radius:n,inside:s=!1,innerRadius:a=0}=this.attribute;return e2(r,s&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){let{inside:r=!1}=this.attribute,{center:n}=this.attribute,s=[i.x-n.x,i.y-n.y];return gj(s,(e?-1:1)*(r?-1:1)*t/function(t){let[e,i]=t;return Math.sqrt(e*e+i*i)}(s))}getRelativeVector(t){let{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var vI=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);ne.indexOf(r[n])&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};vB(),vg();class vL extends m1{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},vL.defaultAttributes,t))}renderLine(t){let{startAngle:e=gG,endAngle:i=gU,radius:r,center:n,innerRadius:s=0,line:a={},inside:o=!1}=this.attribute,l=r,h=s;o&&s>0&&(l=s,h=0);let d=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),a.style),u=as.circle(d);u.name=t5.line,u.id=this._getNodeId("line"),dn(a.state)||(u.states=lE({},gq,a.state)),t.add(u)}getTitleAttribute(){var t,e,i;let{center:r,radius:n,innerRadius:s=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:d,state:u={}}=a,c=vI(a,["space","textStyle","shape","background","state"]),p=r,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=lX(this.attribute.label,"style.fontSize",12)+lX(this.attribute.label,"space",4));let g=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(g=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(g=Math.max(g,this.attribute.subTick.length||2));let m=n+g+f+o,v="middle",{position:b}=this.attribute.title;(0,eC.Z)(b)&&(b=0===s?"end":"middle"),"start"===b?(v="bottom",p={x:r.x,y:r.y-m}):"end"===b&&(v="top",p={x:r.x,y:r.y+m});let y=Object.assign(Object.assign(Object.assign({},p),c),{textStyle:Object.assign({textBaseline:v,textAlign:"center"},l),state:{text:lE({},gq,u.text),shape:lE({},gq,u.shape),panel:lE({},gq,u.background)}}),{angle:x}=c;return y.angle=x,h&&h.visible&&(y.shape=Object.assign({visible:!0},h.style),h.space&&(y.space=h.space)),d&&d.visible&&(y.panel=Object.assign({visible:!0},d.style)),y}getSubTickLineItems(){var t,e;let{subTick:i}=this.attribute,r=[],{count:n=4,inside:s=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){let i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,r,n){}handleLabelsOverlap(t,e,i,r,n){}afterLabelsOverlap(t,e,i,r,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,r){return function(t,e,i,r){let n=gH(Object.assign({text:i},r)),s=n.width(),a=n.height(),o=mJ(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,d=Math.PI/2,u=t.x,c=0,p=u-(c=mQ(o,-l,-h)?((o+l)/d-.5)*s:mQ(o,h,l)?(.5-(o-h)/d)*s:Math.cos(o)>=0?.5*s:-(.5*s)),f=t.y,g=0;return{x:p,y:f-(g=mQ(o,-l,-h)?-(.5*a):mQ(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/d)*a:(.5-mJ(o-l)/d)*a)}}(t,e,i,r)}}vL.defaultAttributes=gJ,cI(vL,vO);class vD extends uI{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){let t=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}let e=(0,eT.Z)(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}let vN=(t,e,i,r)=>{var n,s,a,o;let l=null!==(s=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==s?s:{};return t?lE({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,r))&&void 0!==o?o:[]).map(t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick}))]},null!=i?i:{}):lE({},l,null!=i?i:{})},vj=(t,e,i,r)=>{var n,s,a,o;let l=null!==(s=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==s?s:{};return t?lE({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,r))&&void 0!==o?o:[]).map(t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick}))]},null!=i?i:{}):lE({},l,null!=i?i:{})},vF=(t,e,i,r,n,s)=>{var a;let o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);let l=t.getCoordinateAxisPoints(r);if(l){let r={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(s&&"polar"===e.type){let t=e.angle();r.center=e.origin(),r.startAngle=t[0],r.endAngle=t[1]}return r}let h=e.radius(),d=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:d[0],endAngle:d[1]}};class vz extends vD{constructor(t,e,i){super(t,tz.axis,e),this.spec.componentType=tz.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){let i=lE({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),r=ld.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,r)}tickCount(t){let e=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){let t=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce((i,r)=>{let n=e[r];return n&&(i[r]={callback:(e,i,r)=>{var s,a;let o=this.spec.skipTheme?null:this.view.getCurrentTheme(),l=du(n,e,i,r),h=lt(this.spec.inside,r,e,i),d=lt(this.spec.baseValue,r,e,i),u=null===(s=null==t?void 0:t.getCoordinate)||void 0===s?void 0:s.call(t);u&&(l=Object.assign(vF(t,u,h,d,this.spec.layout),l));let c=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=lt(this.spec.tickCount,r,e,i);switch(this._getAxisComponentType()){case tG.lineAxis:return vN(c,o,l,p);case tG.circleAxis:return vj(c,o,l,p)}return l}}),i},{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if((0,eC.Z)(e)){let i=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?tG.circleAxis:tG.lineAxis,this._axisComponentType}}vz.componentType=tz.axis;(tl=t4||(t4={})).selected="selected",tl.unSelected="unSelected",tl.selectedHover="selectedHover",tl.unSelectedHover="unSelectedHover",tl.focus="focus",(th=t6||(t6={})).legendItemHover="legendItemHover",th.legendItemUnHover="legendItemUnHover",th.legendItemClick="legendItemClick",th.legendItemAttributeUpdate="legendItemAttributeUpdate",(td=t8||(t8={})).innerView="innerView",td.title="legendTitle",td.item="legendItem",td.itemShape="legendItemShape",td.itemLabel="legendItemLabel",td.itemValue="legendItemValue",td.focus="legendItemFocus";class vH extends pC{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild(!0);let{interactive:t=!0,title:e,padding:i=0}=this.attribute,r=(0,pE.o)(i),n=as.group({x:r[3],y:r[0],pickable:t,childrenPickable:t});n.name=t8.innerView,this.add(n),this._innerView=n,(null==e?void 0:e.visible)&&this._renderTitle(e),this._renderContent(),this._adjustLayout(),t&&this._bindEvents();let s=this._innerView.AABBBounds;this.attribute.width=s.width()+r[1]+r[3],this.attribute.height=s.height()+r[0]+r[2]}_renderTitle(t){let{text:e="",textStyle:i,padding:r=0,background:n,minWidth:s,maxWidth:a,shape:o}=t,l={x:0,y:0,text:e,textStyle:i,padding:(0,pE.o)(r),minWidth:s,maxWidth:a};o&&o.visible&&(l.shape=Object.assign({visible:!0},o.style),ey(o.space)&&(l.space=o.space)),n&&n.visible&&(l.panel=Object.assign({visible:!0},n.style));let h=new mq(l);h.name=t8.title,this._title=h,this._innerView.add(h)}_adjustLayout(){var t;if(this._title){let e=this._innerView.AABBBounds.width(),i=this._title.AABBBounds.width(),r=null===(t=this.attribute.title)||void 0===t?void 0:t.align;"center"===r?this._title.setAttribute("x",(e-i)/2):"end"===r&&this._title.setAttribute("x",e-i)}}}function vG(){pk(),gD(),mY()}let vU={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};vG();class vV extends pC{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},vV.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{let e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{let e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{let[r,n]=t;n=i-e?[e,i]:[r=Math.min(Math.max(r,e),i-s),r+s]};let vX={debounce:em,throttle:hK};pk(),ml();class vK extends pC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},vK.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{let e;let{viewX:i,viewY:r}=t,{direction:n,width:s,height:a,range:o}=this.attribute,l=this._sliderSize,[h,d]=this._getScrollRange();if("vertical"===n){let t=r-this._viewPosition.y,i=nd(t-l/2,h,d);e=t/a,this._slider.setAttribute("y",i,!0)}else{let t=i-this._viewPosition.x,r=nd(t-l/2,h,d);e=t/s,this._slider.setAttribute("x",r,!0)}this.setScrollRange([e-(o[1]-o[0])/2,e+(o[1]-o[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();let{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===o2.env?(o2.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),o2.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{let{direction:e}=this.attribute,i,r,n=0,{width:s,height:a}=this._getSliderRenderBounds();return i="vertical"===e?(n=(r=t.clientY)-this._prePos)/a:(n=(r=t.clientX)-this._prePos)/s,[r,i]},this._onSliderPointerMove=t=>{t.stopPropagation();let e=this.getScrollRange(),[i,r]=this._computeScrollValue(t);this.setScrollRange([e[0]+r,e[1]+r],!0),this._prePos=i},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:vX[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();let{realTime:e=!0,range:i,limitRange:r=[0,1]}=this.attribute,n=this.getScrollRange(),[s,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:vY(o,r[0],r[1])}),"browser"===o2.env?(o2.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),o2.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t,e=!0){let{direction:i="horizontal",limitRange:r=[0,1],range:n,realTime:s=!0}=this.attribute,a=vY(t,r[0],r[1]);if(e){let t=this._getSliderPos(a);if(this._slider){let e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,s&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;let{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",vX[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){let t;this._reset();let{direction:e="horizontal",width:i,height:r,range:n,limitRange:s=[0,1],railStyle:a,sliderStyle:o,padding:l=2}=this.attribute,h=this.createOrUpdateChild("scrollbar-container",{},"group"),d=h.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:i,height:r},a),"rect");this._rail=d;let u=this._getSliderRenderBounds(),c=this._getSliderPos(vY(n,s[0],s[1])),p=c[1]-c[0];this._sliderSize=p,t="horizontal"===e?{x:c[0],y:u.y1,width:p,height:u.height}:{x:u.x1,y:c[0],width:u.width,height:p};let f=h.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},t),{cornerRadius:this._getDefaultSliderCornerRadius()}),o),{boundsPadding:(0,pE.o)(l),pickMode:"imprecise"}),"rect");this._slider=f,this._container=h;let g=this._container.AABBBounds;this._viewPosition={x:g.x1,y:g.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;let{width:t,height:e,padding:i=2}=this.attribute,[r,n,s,a]=(0,pE.o)(i),o={x1:a,y1:r,x2:t-n,y2:e-s,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(r+s))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){let{direction:t,round:e}=this.attribute;if(e){let{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){let{direction:e}=this.attribute,{width:i,height:r,x1:n,y1:s}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[r*t[0]+s,r*t[1]+s]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;let{limitRange:t=[0,1],direction:e}=this.attribute,[i,r]=vY(t,0,1),{width:n,height:s,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vY([a+i*n,a+r*n],a,n-l):vY([o+i*s,o+r*s],o,s-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}vK.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};var vq=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);ne.indexOf(r[n])&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};let vJ={[t4.focus]:{},[t4.selected]:{},[t4.selectedHover]:{},[t4.unSelected]:{},[t4.unSelectedHover]:{}};v$(),vG(),pk(),ml();class vQ extends vH{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},vQ.defaultAttributes,t)),this.name="discreteLegend",this._itemsContainer=null,this._itemHeightByUser=void 0,this._itemHeight=0,this._itemMaxWidth=0,this._onHover=t=>{let e=t.target;if(e&&e.name&&e.name.startsWith(t8.item)){let i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,r,n;let s=t.target;if(s&&s.name&&s.name.startsWith(t8.item)){let a=s.delegate;if(s.name===t8.focus){let r=a.hasState(t4.focus);a.toggleState(t4.focus),r?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach(e=>{this._removeLegendItemState(e,[t4.unSelected,t4.unSelectedHover,t4.focus],t),this._setLegendItemState(e,t4.selected,t)}):(this._setLegendItemState(a,t4.selected,t),this._removeLegendItemState(a,[t4.unSelected,t4.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach(e=>{a!==e&&(this._removeLegendItemState(e,[t4.selected,t4.selectedHover,t4.focus],t),this._setLegendItemState(e,t4.unSelected,t))}))}else{null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach(t=>{t.removeState(t4.focus)});let{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,s=a.hasState(t4.selected),o=this._getSelectedLegends();if("multiple"===e){if(!1===i&&s&&1===o.length)return void this._dispatchLegendEvent(t6.legendItemClick,a,t);s?(this._removeLegendItemState(a,[t4.selected,t4.selectedHover],t),this._setLegendItemState(a,t4.unSelected,t)):(this._setLegendItemState(a,t4.selected,t),this._removeLegendItemState(a,[t4.unSelected,t4.unSelectedHover],t))}else this._setLegendItemState(a,t4.selected,t),this._removeLegendItemState(a,[t4.unSelected,t4.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach(e=>{a!==e&&(this._removeLegendItemState(e,[t4.selected,t4.selectedHover],t),this._setLegendItemState(e,t4.unSelected,t))})}this._dispatchLegendEvent(t6.legendItemClick,a,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach(e=>{let i=e.data;t.includes(i.label)?(this._setLegendItemState(e,t4.selected),this._removeLegendItemState(e,[t4.unSelected,t4.unSelectedHover])):(this._removeLegendItemState(e,[t4.selected,t4.selectedHover]),this._setLegendItemState(e,t4.unSelected))})}_renderItems(){let{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:r,maxHeight:n,defaultSelected:s=[],lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=16,spaceRow:h=8}=t,d=this._itemsContainer,{items:u,isHorizontal:c,startIndex:p,isScrollbar:f}=this._itemContext,g=f?1:c?i:e,m,{doWrap:v,maxWidthInCol:b,startX:y,startY:x,pages:_}=this._itemContext;for(let t=p,e=u.length;tthis._itemContext.currentPage*g);t++){a&&(this._itemContext.startIndex=t+1),(m=u[t]).id||(m.id=m.label),m.index=t;let e=this._renderEachItem(m,!!dn(s)||(null==s?void 0:s.includes(m.label)),t,u),i=e.attribute.width,p=e.attribute.height;this._itemHeight=Math.max(this._itemHeight,p),b=Math.max(i,b),this._itemMaxWidth=Math.max(i,this._itemMaxWidth),c?(ey(r)&&(f&&o?v=(_=Math.ceil((y+i)/r))>1:y+i>r&&(v=!0,y>0&&(_+=1,y=0,x+=p+h))),0===y&&0===x||e.setAttributes({x:y,y:x}),y+=l+i):(ey(n)&&(f&&o?v=(_=Math.ceil((x+p)/n))>1:nthis._itemContext.maxPages&&(p=this._renderPagerComponent()),p||(s.setAttribute("y",this._title?this._title.AABBBounds.height()+lX(this.attribute,"title.space",8):0),this._innerView.add(s))}_bindEvents(){if(this.attribute.disableTriggerEvent||!this._itemsContainer)return;let{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,r){var n,s;let{label:a,value:o}=this.attribute.item,l=r.AABBBounds,h=i.AABBBounds,d=l.width(),u=h.width(),c=!1;"labelFirst"===t?u>e?c=!0:r.setAttribute("maxLineWidth",e-u):"valueFirst"===t?d>e?c=!0:i.setAttribute("maxLineWidth",e-d):d+u>e&&(c=!0),c&&(r.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-u)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(s=o.widthRatio)&&void 0!==s?s:.5),e-d)))}_renderEachItem(t,e,i,r){var n,s;let a;let{id:o,label:l,value:h,shape:d}=t,{padding:u=0,focus:c,focusIconStyle:p,align:f,autoEllipsisStrategy:g}=this.attribute.item,{shape:m,label:v,value:b,background:y}=this.attribute.item,x=this._handleStyle(m,t,e,i,r),_=this._handleStyle(v,t,e,i,r),w=this._handleStyle(b,t,e,i,r),A=this._handleStyle(y,t,e,i,r),S=(0,pE.o)(u);!1===y.visible?(a=as.group({x:0,y:0,cursor:null===(n=A.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(a,t8.item,t,a)):(a=as.group(Object.assign({x:0,y:0},A.style)),this._appendDataToShape(a,t8.item,t,a,A.state)),a.id=`${null!=o?o:l}-${i}`,a.addState(e?t4.selected:t4.unSelected);let E=as.group({x:0,y:0,pickable:!1});a.add(E);let T,C=0,k=0,M=0;if(m&&!1!==m.visible){let i=lX(x,"style.size",10);k=(0,ev.Z)(i)?i[0]||0:i,M=lX(m,"space",8);let r=as.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},d),x.style));Object.keys(x.state||{}).forEach(t=>{let e=x.state[t].fill||x.state[t].stroke;d.fill&&(0,eC.Z)(x.state[t].fill)&&e&&(x.state[t].fill=e),d.stroke&&(0,eC.Z)(x.state[t].stroke)&&e&&(x.state[t].stroke=e)}),this._appendDataToShape(r,t8.itemShape,t,a,x.state),r.addState(e?t4.selected:t4.unSelected),E.add(r)}let B,P=0;if(c){let e=lX(p,"size",10);T=as.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},p),{visible:!0,pickMode:"imprecise",boundsPadding:S})),this._appendDataToShape(T,t8.focus,t,a),P=e}let R=v.formatMethod?v.formatMethod(l,t,i):l,O=Object.assign(Object.assign({x:k/2+M,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(s=_.style)||void 0===s?void 0:s.fontSize},_.style),{text:R});B=gX(O)?as.richtext(gK(O)):as.text(O),this._appendDataToShape(B,t8.itemLabel,t,a,_.state),B.addState(e?t4.selected:t4.unSelected),E.add(B);let I=lX(v,"space",8);if(ey(h)){let r;let n=lX(b,"space",c?8:0),s=b.formatMethod?b.formatMethod(h,t,i):h,o=Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:w.style.fontSize},w.style),{text:s});if(r=gX(o)?as.richtext(gK(o)):as.text(o),this._appendDataToShape(r,t8.itemValue,t,a,w.state),r.addState(e?t4.selected:t4.unSelected),this._itemWidthByUser){let t=this._itemWidthByUser-S[1]-S[3]-k-M-I-P-n;this._autoEllipsis(g,t,B,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-k/2-S[1]-S[3]-P-n}):r.setAttribute("x",n+(B.AABBBounds.empty()?0:B.AABBBounds.x2))}else r.setAttribute("x",n+(B.AABBBounds.empty()?0:B.AABBBounds.x2));C=n+(r.AABBBounds.empty()?0:r.AABBBounds.x2),E.add(r)}else this._itemWidthByUser&&B.setAttribute("maxLineWidth",this._itemWidthByUser-S[1]-S[3]-k-M-P),C=I+(B.AABBBounds.empty()?0:B.AABBBounds.x2);T&&(T.setAttribute("x",C),E.add(T));let L=E.AABBBounds,D=L.width();if("right"===f){let t=L.x2,e=L.x1;E.forEachChildren((i,r)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===T?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)})}let N=L.height(),j=ey(this.attribute.item.width)?this.attribute.item.width:D+S[1]+S[3],F=this._itemHeightByUser||N+S[0]+S[2];return a.attribute.width=j,a.attribute.height=F,T&&T.setAttribute("visible",!1),E.translateTo(-L.x1+S[3],-L.y1+S[0]),a}_createPager(t){var e,i;let{disableTriggerEvent:r,maxRow:n}=this.attribute;return new vV(this._itemContext.isHorizontal?Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:99},lE({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:r}):Object.assign({layout:"horizontal",total:99,disableTriggerEvent:r,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){let{disableTriggerEvent:i}=this.attribute;return new vK(this._itemContext.isHorizontal?Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e}):Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,r,n){let{maxHeight:s,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?r-this._pagerComponent.AABBBounds.width():(r-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:s-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){let{currentPage:r,totalPage:n,isHorizontal:s}=this._itemContext;this._pagerComponent.setScrollRange([(r-1)/n,r/n]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){let i=this.attribute.pager||{},{animation:r=!0,animationDuration:n=450,animationEasing:s="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{let{value:e}=t.detail,r=e[0]*this._itemContext.totalPage;return i.scrollByPosition?r+=1:r=Math.floor(r)+1,r}:t=>t.detail.current,o=i=>{let o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{let{width:i,height:r}=t.attribute;v0&&t.setAttributes({x:y,y:x}),y+=o+i}),this._itemContext.startX=y,this._itemContext.startY=x,this._itemContext.pages=_;let i=Math.ceil(_/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,b,t,g,m)}else{if(g=this._itemMaxWidth*r+(r-1)*o,m=i,v=g,f=this._createPager(c),this._pagerComponent=f,this._innerView.add(f),(b=i-f.AABBBounds.height()-d-t)<=0)return this._innerView.removeChild(f),!1;h.getChildren().forEach((t,e)=>{let{height:i}=t.attribute;b0&&t.setAttributes({x:y,y:x}),x+=l+i});let e=Math.ceil(_/r);this._itemContext.totalPage=e,this._updatePositionOfPager(v,b,t,g,m)}u>1&&(p?h.setAttribute("y",-(u-1)*(m+l)):h.setAttribute("x",-(u-1)*(g+o)));let w=as.group({x:0,y:t,width:p?v:g,height:p?m:b,clip:!0,pickable:!1});return w.add(h),this._innerView.add(w),this._bindEventsOfPager(p?m+l:g+o,p?"y":"x"),!0}_renderScrollbar(){let t=this._title?this._title.AABBBounds.height()+lX(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:r={},pager:n={}}=this.attribute,{spaceCol:s=16,spaceRow:a=8}=r,o=this._itemsContainer,{space:l=12,defaultCurrent:h=1}=n,d=vq(n,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,c,p=0,f=0,g=0,m=0,v=1;if(u)p=e,f=e,g=this._itemHeight,c=this._createScrollbar(d,p),this._pagerComponent=c,this._innerView.add(c),this._updatePositionOfScrollbar(f,g,t);else{if(p=i,c=this._createScrollbar(d,p),this._pagerComponent=c,this._innerView.add(c),g=i-t,f=this._itemMaxWidth,g<=0)return this._innerView.removeChild(c),!1;o.getChildren().forEach((t,e)=>{let{height:i}=t.attribute;v=Math.floor((m+i)/g)+1,m+=a+i}),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(f,g,t)}h>1&&(u?o.setAttribute("x",-(h-1)*(f+s)):o.setAttribute("y",-(h-1)*(g+a)));let b=as.group({x:0,y:t,width:f,height:g,clip:!0,pickable:!1});return b.add(o),this._innerView.add(b),this._bindEventsOfPager(u?f:g,u?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(t4.selected)?this._setLegendItemState(t,t4.selectedHover,e):this._setLegendItemState(t,t4.unSelectedHover,e);let i=t.getChildren()[0].find(t=>t.name===t8.focus,!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(t6.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(t4.unSelectedHover)||t.hasState(t4.selectedHover))&&(i=!0),t.removeState(t4.unSelectedHover),t.removeState(t4.selectedHover),t.getChildren()[0].getChildren().forEach(t=>{!i&&(t.hasState(t4.unSelectedHover)||t.hasState(t4.selectedHover))&&(i=!0),t.removeState(t4.unSelectedHover),t.removeState(t4.selectedHover)});let r=t.getChildren()[0].find(t=>t.name===t8.focus,!1);r&&r.setAttribute("visible",!1),i&&this._dispatchLegendEvent(t6.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(t6.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let r=!1;t.hasState(e)||(r=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach(t=>{t.name!==t8.focus&&(r||t.hasState(e)||(r=!0),t.addState(e,!0))}),r&&this._dispatchLegendEvent(t6.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let r=!1;e.forEach(e=>{!r&&t.hasState(e)&&(r=!0),t.removeState(e)}),t.getChildren()[0].getChildren().forEach(t=>{t.name!==t8.focus&&e.forEach(e=>{!r&&t.hasState(e)&&(r=!0),t.removeState(e)})}),r&&this._dispatchLegendEvent(t6.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;let e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach(t=>{t.hasState(t4.selected)&&e.push(t.data)}),e}_appendDataToShape(t,e,i,r,n={}){t.name=e,t.data=i,t.delegate=r,t.states=lE({},vJ,n)}_dispatchLegendEvent(t,e,i){let r=this._getSelectedLegends();r.sort((t,e)=>t.index-e.index);let n=r.map(t=>t.label);this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(t4.selected),currentSelectedItems:r,currentSelected:n,event:i})}_handleStyle(t,e,i,r,n){let s={};return t.style&&(r6(t.style)?s.style=t.style(e,i,r,n):s.style=t.style),t.state&&(s.state={},Object.keys(t.state).forEach(a=>{t.state[a]&&(r6(t.state[a])?s.state[a]=t.state[a](e,i,r,n):s.state[a]=t.state[a])})),s}}vQ.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:16,spaceRow:8,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},(tu=t7||(t7={})).Identity="identity",tu.Linear="linear",tu.Log="log",tu.Pow="pow",tu.Sqrt="sqrt",tu.Symlog="symlog",tu.Time="time",tu.Quantile="quantile",tu.Quantize="quantize",tu.Threshold="threshold",tu.Ordinal="ordinal",tu.Point="point",tu.Band="band";let v0={};Object.values(t7).forEach(t=>{v0[t]=!0});var v1=t=>null!=t;let v2=t=>{let e=null,i=null;return(...r)=>(e&&r.every((t,i)=>t===e[i])||(e=r,i=t(...r)),i)};var v5=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,v3=(t,e=!1)=>{let i=typeof t;return e?"number"===i:"number"===i||v5(t,"Number")},v4=t=>null==t;function v6(t){return t}function v8(t,e){if(t=Number(t),e=Number(e)-t)return i=>(i-t)/e;let i=Number.isNaN(e)?NaN:.5;return()=>i}function v7(t,e,i){let r,n;let s=t[0],a=t[1],o=e[0],l=e[1];return an(r(t))}function v9(t,e,i){let r=Math.min(t.length,e.length)-1,n=Array(r),s=Array(r),a=-1;for(t[r]>>1;(n=t[a],(n<(s=e)?-1:n>s?1:n>=s?0:NaN)>0)?r=a:i=a+1}return i}(t,e,1,r)-1;return s[i](n[i](e))}}let bt=(t,e=!1)=>{let i=Math.floor(Math.log10(t)),r=t/Math.pow(10,i);return(e?r<1.5?1:r<3?2:r<7?5:10:r<=1?1:r<=2?2:r<=5?5:10)*Math.pow(10,i)},be=(t,e)=>{let i,r;return e[0]{let r=1,n=t,s=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?r=bu(a).step:(i||a>1)&&(n=Math.floor(t)-s*r),r>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*r)),(function(t,e,i){v1(e)||(e=t,t=0),v1(i)||(i=1);let r=-1,n=0|Math.max(0,Math.ceil((e-t)/i)),s=Array(n);for(;++rn+t*r)):t>0?bl(0,-(e-1)/r,r):bl((e-1)/r,0,r)},bo=v2((t,e,i,r)=>{let n,s,a,o,l=-1;if(i=+i,(t=+t)==(e=+e)||Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),r=Math.round(e/o);for(i*oe&&--r,a=Array(s=r-i+1);++le&&--r,a=Array(s=r-i+1);++l{let r,n,s=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=Array(r=o-a+1);++se&&--o,n=Array(r=o-a+1);++s{let r;let n=t[0],s=t[t.length-1],a=e-t.length;if(s<=0){let e=[];for(r=a;r>=1;r--)e.push(n-r*i);return e.concat(t)}if(n>=0){for(r=1;r<=a;r++)t.push(s+r*i);return t}let o=[],l=[];for(r=1;r<=a;r++)r%2==0?o=[n-Math.floor(r/2)*i].concat(o):l.push(s+Math.ceil(r/2)*i);return o.concat(t).concat(l)},bd=v2((t,e,i,r)=>{let n,s,a;if(i=+i,(t=+t)==(e=+e)||Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return ba(t,i,null==r?void 0:r.noDecimals);(n=e0){let r=1,{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;r<=5&&(s=bl(t,e,l)).length>i+1&&i>2;)l+=h,r+=1;i>2&&s.length{let e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e,r=1;return i>=bi?r=10:i>=br?r=5:i>=bn&&(r=2),e>=0?{step:r*10**e,gap:r,power:e}:{step:-(10**-e)/r,gap:r,power:e}};function bc(t,e,i){return bu((e-t)/Math.max(0,i))}function bp(t,e,i){let r;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(r=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(r))return[];let n=Array(i);for(let e=0;e0;){if((r=bc(a,o,e).step)===i)return t[n]=a,t[s]=o,t;if(r>0)a=Math.floor(a/r)*r,o=Math.ceil(o/r)*r;else{if(!(r<0))break;a=Math.ceil(a*r)/r,o=Math.floor(o*r)/r}i=r}}let bm=(t,e,i)=>1>Math.abs(e-t)?+i.toFixed(1):Math.round(+i);v2((t,e,i,r,n,s,a)=>{let o=t,l=e,h=l0){for(;c<=p;++c)for(d=1;dl)break;f.push(u)}}else for(;c<=p;++c)for(d=r-1;d>=1;--d)if(!((u=c>0?d/s(-c):d*s(c))l)break;f.push(u)}2*f.length0!==t),(null==a?void 0:a.noDecimals)&&(f=Array.from(new Set(f.map(t=>Math.floor(t))))),h?f.reverse():f}),v2((t,e,i,r,n,s)=>{let a=[],o={},l=n(t),h=n(e),d=[];if(Number.isInteger(r))d=bd(l,h,i);else{let t=(h-l)/(i-1);for(let e=0;e{let n=s(i),l=Number.isInteger(r)?bm(t,e,n):bm(t,e,bt(n)),h=bm(t,e,be(l,[t,e]));o[h]||isNaN(h)||!(d.length>1)||(o[h]=1,a.push(h))}),a}),v2((t,e,i,r,n)=>bp(r(t),r(e),i).map(t=>bt(n(t)))),v2((t,e,i,r,n)=>bf(r(t),r(e),i).map(t=>bt(n(t))));var bv=function(t,e,i){return ti?i:t};class bb{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:v1(this._rangeFactorStart)&&v1(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=function(t,e){let i=(t[1]-t[0])/(e[1]-e[0]),r=t[0]-i*e[0];return[r,i+r]}(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every(t=>t>=0&&t<=1)&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):v1(this._rangeFactorStart)&&v1(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return v4(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0===t&&(v4(this._rangeFactorEnd)||1===this._rangeFactorEnd)?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1)),this)}rangeFactorEnd(t,e){var i;return v4(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0===t&&(v4(this._rangeFactorStart)||0===this._rangeFactorStart)?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);let{distortion:e=2,radiusRatio:i=.1,radius:r}=this._fishEyeOptions,n=this.range(),s=n[0],a=n[n.length-1],o=Math.min(s,a),l=Math.max(s,a),h=bv(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),d=v4(r)?(l-o)*i:r,u=Math.exp(e);u=u/(u-1)*d;let c=e/d;this._fishEyeTransform=t=>{let e=Math.abs(t-h);return e>=d?t:e<=1e-6?h:h+(t-h)*(u*(1-Math.exp(-e*c))/e*.75+.25)}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}var by=t=>Array.isArray?Array.isArray(t):v5(t,"Array");function bx(t,e,i){e/=100;let r=(1-Math.abs(2*(i/=100)-1))*e,n=r*(1-Math.abs(t/60%2-1)),s=i-r/2,a=0,o=0,l=0;return 0<=t&&t<60?(a=r,o=n,l=0):60<=t&&t<120?(a=n,o=r,l=0):120<=t&&t<180?(a=0,o=r,l=n):180<=t&&t<240?(a=0,o=n,l=r):240<=t&&t<300?(a=n,o=0,l=r):300<=t&&t<360&&(a=r,o=0,l=n),{r:a=Math.round(255*(a+s)),g:o=Math.round(255*(o+s)),b:l=Math.round(255*(l+s))}}function b_(t,e,i){t/=255,e/=255;let r=Math.min(t,e,i/=255),n=Math.max(t,e,i),s=n-r,a=0,o=0,l=0;return(a=Math.round(60*(a=0===s?0:n===t?(e-i)/s%6:n===e?(i-t)/s+2:(t-e)/s+4)))<0&&(a+=360),l=(n+r)/2,o=+(100*(o=0===s?0:s/(1-Math.abs(2*l-1)))).toFixed(1),{h:a,s:o,l:l=+(100*l).toFixed(1)}}let bw=/^#([0-9a-f]{3,8})$/,bA={transparent:0xffffff00},bS={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function bE(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function bT(t){return v3(t)?new bB(t>>16,t>>8&255,255&t,1):by(t)?new bB(t[0],t[1],t[2]):new bB(255,255,255)}function bC(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function bk(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class bM{static Brighter(t,e=1){return 1===e?t:new bM(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new bM(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){let i=t instanceof bM?t:new bM(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(v1(bA[t])){var e;return v3(e=bA[t])?new bB(e>>>24,e>>>16&255,e>>>8&255,255&e):by(e)?new bB(e[0],e[1],e[2],e[3]):new bB(255,255,255,1)}if(v1(bS[t]))return bT(bS[t]);let i=`${t}`.trim().toLowerCase(),r=bw.exec(i);if(r){let t=parseInt(r[1],16),e=r[1].length;return 3===e?new bB((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?bT(t):8===e?new bB(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(i)){let t=i.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new bB(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(i)){let t=i.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),e=bx(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new bB(e.r,e.g,e.b,parseFloat(t[3]))}}constructor(t){let e=bM.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new bB(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){let{r:e,g:i,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t))),this}add(t){let{r:e,g:i,b:r}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,r+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){let{r:e,g:i,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){let r=this.color.opacity,n=b_(this.color.r,this.color.g,this.color.b),s=bx(v4(t)?n.h:bv(t,0,360),v4(e)?n.s:e>=0&&e<=1?100*e:e,v4(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new bB(s.r,s.g,s.b,r),this}setRGB(t,e,i){return v4(t)||(this.color.r=t),v4(e)||(this.color.g=e),v4(i)||(this.color.b=i),this}setHex(t){let e=`${t}`.trim().toLowerCase(),i=bw.exec(e),r=parseInt(i[1],16),n=i[1].length;return 3===n?new bB((r>>8&15)+((r>>8&15)<<4),(r>>4&15)+((r>>4&15)<<4),(15&r)+((15&r)<<4),1):6===n?bT(r):8===n?new bB(r>>24&255,r>>16&255,r>>8&255,(255&r)/255):this}setColorName(t){let e=bS[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new bM(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){let i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=bC(t.color.r),this.color.g=bC(t.color.g),this.color.b=bC(t.color.b),this}copyLinearToSRGB(t){return this.color.r=bk(t.color.r),this.color.g=bk(t.color.g),this.color.b=bk(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class bB{constructor(t,e,i,r){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),v1(r)?this.opacity=isNaN(+r)?1:Math.max(0,Math.min(1,+r)):this.opacity=1}formatHex(){return`#${bE(this.r)+bE(this.g)+bE(this.b)+(1===this.opacity?"":bE(255*this.opacity))}`}formatRgb(){let t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){let t=this.opacity,{h:e,s:i,l:r}=b_(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${r}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function bP(t){let e="",i="",r="",n="#"===t[0]?1:0;for(let s=n;snew bB(Math.round(i*(1-t)+r*t),Math.round(n*(1-t)+s*t),Math.round(a*(1-t)+o*t),l*(1-t)+h*t)}function bI(t,e){return i=>t*(1-i)+e*i}function bL(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}RegExp(/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g.source,"g");let{interpolateRgb:bD}=ed;function bN(t,e){let i;let r=typeof e;if(v4(e)||"boolean"===r)return()=>e;if("number"===r)return bI(t,e);if("string"===r){if(i=bM.parseColorString(e)){let e=bD(bM.parseColorString(t),i);return t=>e(t).formatRgb()}return bI(Number(t),Number(e))}return e instanceof bB?bD(t,e):e instanceof bM?bD(t.color,e.color):e instanceof Date?function(t,e){let i=t.valueOf(),r=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+r*t),n)}(t,e):bI(Number(t),Number(e))}function bj(t){return Number(t)}class bF extends bb{constructor(t=v6,e=v6){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=v6,this._piecewise=v7,this._interpolate=bN}calculateVisibleDomain(t){var e;return v1(this._rangeFactorStart)&&v1(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(Number.isNaN(t=Number(t))||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));let i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),bI)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;let r=Array.from(t,bj);return this._domain=r,this.rescale(e)}range(t,e){if(!t)return this._range.slice();let i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){let i=Array.from(t);return this._range=i,this._interpolate=bL,this.rescale(e)}rescale(t){var e,i,r;let n;if(t)return this;let s=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,a=s.length,o=this._range.length,l=Math.min(a,o);if(a&&a=2?(e-s[a-2])/t:0;for(let r=1;r<=t;r++)s[a-2+r]=e-i*(t-r);l=o}return this._autoClamp&&(this._clamp=(i=s[0],r=s[l-1],i>r&&(n=i,i=r,r=n),t=>Math.max(i,Math.min(r,t)))),this._piecewise=l>2?v9:v7,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:v6),this.rescale(i)):this._clamp!==v6}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){let e=this.ticks(t);return(null!=e?e:[]).map((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])}))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return v4(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return v4(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}class bz extends bF{constructor(){super(...arguments),this.type=t7.Linear}clone(){return(new bz).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(t=10,e){let i=this.calculateVisibleDomain(this._range);return bo(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(v1(this._rangeFactorStart)&&v1(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);let r=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,s=r[0],a=r[r.length-1],o=bd(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==s||o[o.length-1]!==a)&&this._niceType){let t=r.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==s?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){let e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter(t=>t>=e&&t<=i)}}return o}forceTicks(t=10){let e=this.calculateVisibleDomain(this._range);return bp(e[0],e[e.length-1],t)}stepTicks(t){let e=this.calculateVisibleDomain(this._range);return bf(e[0],e[e.length-1],t)}nice(t=10,e){var i,r;let n=this._domain,s=[];if(e){let t=function(t,e){let i=v3(e.forceMin),r=v3(e.forceMax),n=null,s=[],a=null,o=i&&r?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:r?t=>t<=e.forceMax:null;return i?s[0]=e.forceMin:v3(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(s[0]=e.min),r?s[1]=e.forceMax:v3(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(s[1]=e.max),v3(s[0])&&v3(s[1])?((a=t.slice())[0]=s[0],a[a.length-1]=s[1]):n=v3(s[0])||v3(s[1])?v3(s[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:s,domainValidator:o}}(n,e);if(s=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){let e=bg(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=s[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(r=s[0])&&void 0!==r?r:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(t=10){this._niceType="min";let e=this._domain[this._domain.length-1],i=bg(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(t=10){this._niceType="max";let e=this._domain[0],i=bg(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function bH(t){return(0,ev.Z)(t)?t:[t,t]}function bG(t){return t?"ew-resize":"ns-resize"}(tc=t9||(t9={})).innerView="innerView",tc.railContainer="sliderRailContainer",tc.rail="sliderRail",tc.startText="sliderStartText",tc.endText="sliderEndText",tc.startHandler="sliderStartHandler",tc.startHandlerText="startHandlerText",tc.endHandler="sliderEndHandler",tc.endHandlerText="sliderEndHandlerText",tc.track="sliderTrack",tc.trackContainer="sliderTrackContainer",vW();class bU extends pC{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},bU.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;let{min:e,max:i}=this.attribute,r=nd(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/this._rail.globalAABBBounds.width():(t.viewY-this._rail.globalAABBBounds.y1)/this._rail.globalAABBBounds.height(),0,1);r!==this._tooltipState.pos&&(this._tooltipState.pos=r,this._tooltipState.value=e+(i-e)*r,this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{let{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0,this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===o2.env?(o2.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),o2.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;let{railWidth:r,railHeight:n,min:s,max:a}=this.attribute;if(a===s)return;let o,l,h,d=0;this._isHorizontal?(d=(o=t.clientX)-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=r):(d=(o=t.clientY)-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=n);let u=nd(l+d,0,h),c=u/h*(a-s)+s;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,u,c):this._updateHandler(this._currentHandler,u,c),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===o2.env?(o2.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),o2.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===o2.env?(o2.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),o2.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{let e,i,r;t.stopPropagation(),this._isChanging=!0;let{railWidth:n,railHeight:s,min:a,max:o}=this.attribute;if(o===a)return;let{startHandler:l,endHandler:h}=this._getHandlers();this._isHorizontal?(e=t.clientX,i=this._track.attribute.width,r=n):(e=t.clientY,i=this._track.attribute.height,r=s);let d=e-this._prePos;if(l){let t=nd((this._isHorizontal?l.attribute.x:l.attribute.y)+d,0,r-i),e=t/r*(o-a)+a;this._updateHandler(l,t,e)}if(h){let t=nd((this._isHorizontal?h.attribute.x:h.attribute.y)+d,i,r),e=t/r*(o-a)+a,n=null==l?void 0:l.attribute;this._updateHandler(h,t,e),this._track.setAttributes(this._isHorizontal?{x:Math.min(n.x,h.attribute.x),width:Math.abs(n.x-h.attribute.x)}:{y:Math.min(n.y,h.attribute.y),height:Math.abs(n.y-h.attribute.y)})}this._prePos=e,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===o2.env?(o2.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),o2.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{let e,i,r,n;t.stopPropagation(),this._isChanging=!0;let{railWidth:s,railHeight:a,min:o,max:l}=this.attribute;if(l===o)return;let h=this._startHandler,d=this._endHandler;this._isHorizontal?(e=t.viewX-this._rail.globalAABBBounds.x1,i=null==h?void 0:h.attribute.x,r=null==d?void 0:d.attribute.x,n=s):(e=t.viewY-this._rail.globalAABBBounds.y1,i=null==h?void 0:h.attribute.y,r=null==d?void 0:d.attribute.y,n=a);let u=e/n*(l-o)+o;if(ey(r)){let t=Math.abs(e-i)>Math.abs(e-r)?d:h;this._updateHandler(t,e,u)}else this._updateHandler(h,e,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){let{layout:e,railWidth:i,railHeight:r,min:n,max:s}=this.attribute;if(s===n)return;let[a,o]=ex(t),{startHandler:l,endHandler:h}=this._getHandlers(),d="vertical"===e?r:i;l&&this._updateHandler(l,(a-n)/(s-n)*d,a),h&&this._updateHandler(h,(o-n)/(s-n)*d,o),this._updateTrack()}render(){var t,e;let i;this.removeAllChild(!0);let{layout:r="horizontal",railWidth:n,railHeight:s,startText:a,endText:o,min:l,max:h,showHandler:d=!0,showTooltip:u}=this.attribute,{value:c}=this.attribute;(0,eC.Z)(c)&&(c=[l,h]),this._currentValue={startValue:bH(c)[0],endValue:bH(c)[1]};let p="horizontal"===r;this._isHorizontal=p;let f=as.group({x:0,y:0});f.name=t9.innerView,this.add(f),this._innerView=f;let g,m=0;if(a&&a.visible){(g=as.text(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(t=a.style)||void 0===t?void 0:t.fontSize},a.style))).name=t9.startText,f.add(g);let e=ey(a.space)?a.space:0;m+=(p?g.AABBBounds.width():g.AABBBounds.height())+e}let v=as.group({x:p?m:0,y:p?0:m});f.add(v);let b=as.group({x:0,y:0});if(b.name=t9.railContainer,this._railContainer=b,v.add(b),this._mainContainer=v,this._renderRail(b),m+=p?n:s,o&&o.visible){let t=ey(o.space)?o.space:0;(i=as.text(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:o.text,lineHeight:null===(e=o.style)||void 0===e?void 0:e.fontSize},o.style))).name=t9.endText,f.add(i)}this._renderTrack(b),d&&(this._renderHandlers(v),this._bindEvents()),u&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){let{railWidth:e,railHeight:i,railStyle:r,slidable:n}=this.attribute,s="default";!1!==n&&(s="pointer");let a=as.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:s},r));return a.name=t9.rail,t.add(a),this._rail=a,a}_renderHandlers(t){let{range:e,min:i,max:r,handlerSize:n=14,handlerStyle:s,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute,{value:d}=this.attribute;(0,eC.Z)(d)&&(d=[i,r]);let u=a&&a.visible,c=this._isHorizontal,p=c?l:o,[f,g]=bH(d),m=r===i?e?0:p:(f-i)/(r-i)*p,v=this._renderHandler(Object.assign({x:c?m:l/2,y:c?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":bG(c)},s));if(v.name=t9.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){let i=this._renderHandlerText(f,e?"start":"end");i.name=t9.startHandlerText,t.add(i),this._startHandlerText=i}if(e){let e=r===i?p:(g-i)/(r-i)*p,a=this._renderHandler(Object.assign({x:c?e:l/2,y:c?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":bG(c)},s));if(a.name=t9.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){let e=this._renderHandlerText(g,"end");e.name=t9.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){let e,i,r;let{range:n,min:s,max:a,railHeight:o,railWidth:l,trackStyle:h,railStyle:d,slidable:u,value:c}=this.attribute;if((0,eC.Z)(c))n?(e=s,i=a):e=i=s;else if(n){let t=vY(c,s,a);e=t[0],i=t[1]}else e=s,i=nd(c,s,a);let p=this._isHorizontal,f=p?l:o;n||(e=s);let g=as.group({x:0,y:0,width:l,height:o,cornerRadius:null==d?void 0:d.cornerRadius,clip:!0,pickable:!1});g.name=t9.trackContainer;let m=(0,ep.Z)(n)&&!0===n.draggableTrack;r=!1===u?"default":!1===n||!1===m?"pointer":bG(p);let v=a===s?f:(i-e)/(a-s)*f,b=a===s?0:(e-s)/(a-s)*f,y=as.rect(Object.assign({x:p?b:0,y:p?0:b,width:p?v:l,height:p?o:v,cursor:r},h));y.name=t9.track,this._track=y,g.add(y),t.add(g)}_renderHandler(t){return as.symbol(t)}_renderHandlerText(t,e){var i,r,n;let{align:s,min:a,max:o,handlerSize:l=14,handlerText:h={},railHeight:d,railWidth:u,slidable:c}=this.attribute,p=this._isHorizontal,f=p?u:d,g=o===a?"start"===e?0:f:(t-a)/(o-a)*f,m=null!==(i=h.space)&&void 0!==i?i:4,v={text:h.formatter?h.formatter(t):t.toFixed(null!==(r=h.precision)&&void 0!==r?r:0),lineHeight:null===(n=h.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":bG(p)};return p?"top"===s?(v.textBaseline="bottom",v.textAlign="center",v.x=g,v.y=(d-l)/2-m):(v.textBaseline="top",v.textAlign="center",v.x=g,v.y=(d+l)/2+m):("left"===s?(v.textBaseline="middle",v.textAlign="end",v.x=(u-l)/2-m):(v.textBaseline="middle",v.textAlign="start",v.x=(u+l)/2+m),v.y=g),as.text(Object.assign(Object.assign({},v),h.style))}_renderTooltip(){var t;let{tooltip:e,railHeight:i,railWidth:r,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;let s=this._isHorizontal?0:r/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){let t=as.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:s,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}let o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=s,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?s-r/2-l:a+r/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");let d=as.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(d),this._tooltipText=d,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;let i=this._isHorizontal?this._tooltipState.pos*this.attribute.railWidth:this._tooltipState.pos*this.attribute.railHeight,r=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[r]:i});let{align:n}=this.attribute;if(this._tooltipText){let s=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[r]:i,text:s.formatter?s.formatter(this._tooltipState.value):this._isHorizontal||"left"!==n?`≈ ${this._tooltipState.value.toFixed(null!==(e=s.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=s.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;let{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),(0,ep.Z)(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){let t=this._startHandler,e=this._endHandler;if(this._isHorizontal){let i=null==t?void 0:t.attribute.x;if(e){let t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{let i=null==t?void 0:t.attribute.y;if(e){let t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var r;let n=this._isHorizontal;t.setAttribute(n?"x":"y",e);let s=t.name===t9.startHandler?this._startHandlerText:this._endHandlerText;if(s){let{handlerText:t={}}=this.attribute;s.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(r=t.precision)&&void 0!==r?r:0),[n?"x":"y"]:e})}t.name===t9.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var r;let n=this._isHorizontal,{handlerText:s={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:s.formatter?s.formatter(i):i.toFixed(null!==(r=s.precision)&&void 0!==r?r:0)});let a=t.name===t9.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===t9.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){let t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}}bU.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},v$(),vW();class bV extends vH{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},bV.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{let e=this._slider.tooltipShape;if(e&&t.detail&&!(0,eC.Z)(t.detail.value)){let i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){let{colors:t,slidable:e,layout:i,align:r,min:n,max:s,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:d,handlerStyle:u,railStyle:c,trackStyle:p,startText:f,endText:g,handlerText:m,showTooltip:v,tooltip:b,disableTriggerEvent:y}=this.attribute,x=[],_=(s-n)/(t.length-1);for(let e=0;e1){let t=this._color.stops,e=Math.min(h,d)/p,i=Math.max(h,d)/p,r=i-e,n=t.filter(t=>t.offset>e&&t.offset{g.push({offset:(t.offset-e)/r,color:t.color})}),g.push({offset:1,color:f}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:g}))}}}bV.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}};v$(),vW(),vM();class bW extends vH{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},bW.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){let{slidable:t,layout:e,align:i,min:r,max:n,value:s,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:d,railStyle:u,trackStyle:c,startText:p,endText:f,handlerText:g,showTooltip:m,tooltip:v,sizeBackground:b,disableTriggerEvent:y}=this.attribute,x=as.group({x:0,y:0});this._innerView.add(x);let _=new bU({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:r,max:n,value:s,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:function(t="bottom"){let e=0;return"top"===t?` M${e},-6L${e-3.5},-2.5 v5 h7 v-5 Z `:"left"===t?(e=1,` M${e-6},0L${e-6+2.5},-3.5 h5 v7 h-5 Z `):"right"===t?(e=-1,` M${e+6},0L${e+6-2.5},-3.5 h-5 v7 h5 Z `):` M${e},6L${e-3.5},2.5 v-5 h7 v5 Z `}(i)},d),railStyle:u,trackStyle:c,startText:p,endText:f,handlerText:g,showTooltip:m,tooltip:v,disableTriggerEvent:y});x.add(_);let w,A=0;"horizontal"===e?"top"===i?(w=`M0,0L${a},0L${a},12Z`,A=o):(w=`M0,12L${a},12L${a},0Z`,_.setAttribute("y",12)):"left"===i?w=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(w=`M0,${o}L12,${o}L12,0Z`,_.setAttribute("x",12));let S=as.path(Object.assign(Object.assign({x:0,y:A,path:w},b),{zIndex:0}));x.add(S);let E=this._title?this._title.AABBBounds.height()+lX(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,E-x.AABBBounds.y1),this._slider=_}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}bW.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};class bZ{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}depend(t){this.references.clear(),ex(t).map(t=>(0,eT.Z)(t)?this.view.getGrammarById(t):t).filter(t=>!(0,eC.Z)(t)).forEach(t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)})}parameters(){let t={};return this.references.forEach((e,i)=>{ey(i.id())&&(t[i.id()]=i.output())}),t}bind(){let t=this.getEvents();(null!=t?t:[]).forEach(t=>{t.type&&t.handler&&((0,ev.Z)(t.type)?t.type.forEach(e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)}):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))})}unbind(){let t=this.getEvents();(null!=t?t:[]).forEach(t=>{t.type&&t.handler&&((0,ev.Z)(t.type)?t.type.forEach(e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)}):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))})}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}class b${_filterData(t,e,i,r,n,s){let a=(0,eT.Z)(t)?this.view.getDataById(t):t;return a&&(this.handleFilter=t=>{let i=null==t?void 0:t.element;a&&(!e||i&&i.mark===e)&&(r&&(this._filterValue=r(t)),a.commit(),this.view.run())},this._dataFilter={source:e?`${e.uid}`:null,rank:i,filter:t=>{if(!this._filterValue)return t;let e=n?t.filter(t=>n(t,this._filterValue)):t;return s?s(e,this._filterValue):e}},a.addDataFilter(this._dataFilter)),this}}class bY extends bZ{constructor(t,e){super(t,e),e.target&&(this._data=(0,eT.Z)(e.target.data)?t.getDataById(e.target.data):e.target.data)}}bY.defaultOptions={};class bX extends bY{constructor(t,e){super(t,e),this.type=bX.type,this.options=Object.assign({},bX.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.source).filter(t=>t.markType===tF.component&&"legend"===t.componentType),this._data=(0,eT.Z)(this.options.target.data)?t.getDataById(this.options.target.data):this.options.target.data}getEvents(){if(!this._marks||0===this._marks.length)return[];let t=this._marks[0];if(!this._data||!t)return[];let e=t.isContinuousLegend(),i=this.options.target.filter,r=this.options.target.transform,n=(0,eT.Z)(i)?e?(t,e)=>t[i]>=e.start&&t[i]<=e.end:(t,e)=>e.includes(t[i]):i;return this._filterData(this._data,t,tH.legend,t=>e?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected,n,r),[{type:e?"change":t6.legendItemClick,handler:this.handleFilter}]}}bX.type="legend-filter",bX.defaultOptions={};let bK=(t,e,i,r)=>{var n;let s=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.discreteLegend;if(!t)return lE({},s,null!=i?i:{});let a=Array.from(new Set(ex(t.domain()))).map((e,i)=>{var n,a,o,l,h,d;let u=ln(t.scale(e)),c=u?Object.assign(Object.assign({},null!==(o=null===(a=null===(n=null==s?void 0:s.items)||void 0===n?void 0:n[0])||void 0===a?void 0:a.shape)&&void 0!==o?o:{}),{fill:u,stroke:u}):null!==(d=null===(h=null===(l=null==s?void 0:s.items)||void 0===l?void 0:l[0])||void 0===h?void 0:h.shape)&&void 0!==d?d:{};return r&&Object.assign(c,{symbolType:r.scale(e)}),{label:e.toString(),id:e,shape:c,index:i}});return lE({},s,{items:a},null!=i?i:{})},bq=(t,e,i)=>{var r;let n=null===(r=null==e?void 0:e.components)||void 0===r?void 0:r.colorLegend;if(!t)return lE({},n,null!=i?i:{});let s=t.domain();return lE({},n,{colors:t.range().slice(),min:s[0],max:e_(s)},null!=i?i:{})},bJ=(t,e,i)=>{var r;let n=null===(r=null==e?void 0:e.components)||void 0===r?void 0:r.sizeLegend;if(!t)return lE({},n,null!=i?i:{});let s=t.domain();return lE({},n,{min:s[0],max:s[s.length-1],value:[s[0],s[s.length-1]]},null!=i?i:{})};class bQ extends vD{constructor(t,e){super(t,tz.legend,e),this.spec.componentType=tz.legend,this.spec.legendType="auto"}parseAddition(t){return this.shapeScale(t.shapeScale),super.parseAddition(t),this.legendType(t.legendType),this}scale(t){return super.scale(t),this._legendComponentType=null,this}shapeScale(t){if(this.spec.shapeScale){let t=(0,eT.Z)(this.spec.shapeScale)?this.view.getScaleById(this.spec.shapeScale):this.spec.shapeScale;this.detach(t),this.spec.shapeScale=void 0}let e=(0,eT.Z)(t)?this.view.getScaleById(t):t;return this.spec.shapeScale=e,this.attach(e),this.commit(),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==tV.discreteLegend}setSelected(t){return this.getGroupGraphicItem().setSelected(t),this}addGraphicItem(t,e){let i=ld.createGraphicComponent(this._getLegendComponentType(),t,{skipDefault:this.spec.skipTheme});return super.addGraphicItem(t,e,i)}_updateComponentEncoders(){let t=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=(0,eT.Z)(this.spec.shapeScale)?this.view.getScaleById(this.spec.shapeScale):this.spec.shapeScale,i=Object.assign({update:{}},this.spec.encode),r=Object.keys(i).reduce((r,n)=>{let s=i[n];return s&&(r[n]={callback:(i,r,n)=>{var a,o;let l=this.spec.skipTheme?null:this.view.getCurrentTheme(),h=du(s,i,r,n),d=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t);switch(this._getLegendComponentType()){case tV.discreteLegend:return bK(d,l,h,null===(o=null==e?void 0:e.getScale)||void 0===o?void 0:o.call(e));case tV.colorLegend:return bq(d,l,h);case tV.sizeLegend:return bJ(d,l,h)}return h}}),r},{});this._encoders=r}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{let e=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&uN(i)){let t=e.getScale().range();ln(null==t?void 0:t[0])?this._legendComponentType=tV.colorLegend:this._legendComponentType=tV.sizeLegend}else this._legendComponentType=tV.discreteLegend}return this._legendComponentType}}bQ.componentType=tz.legend;class b0 extends bY{constructor(t,e){super(t,e),this.type=b0.type,this.options=Object.assign({},b0.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.source).filter(t=>t.markType===tF.component&&"slider"===t.componentType),this._data=(0,eT.Z)(this.options.target.data)?t.getDataById(this.options.target.data):this.options.target.data}getEvents(){if(!this._marks||0===this._marks.length)return[];let t=this._marks[0];if(!this._data||!t)return[];let e=this.options.target.filter,i=this.options.target.transform,r=(0,eT.Z)(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(this._data,t,tH.slider,t=>({start:t.detail.value[0],end:t.detail.value[1]}),r,i),[{type:"change",handler:this.handleFilter}]}}b0.type="slider-filter",b0.defaultOptions={};let b1=(t,e,i,r)=>{var n;return lE({},null===(n=null==i?void 0:i.components)||void 0===n?void 0:n.slider,{min:t,max:e,value:[t,e]},null!=r?r:{})};class b2 extends uI{constructor(t,e){super(t,tz.slider,e),this.spec.componentType=tz.slider}parseAddition(t){return super.parseAddition(t),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}setStartEndValue(t,e){return this.getGroupGraphicItem().setValue([t,e]),this}_updateComponentEncoders(){let t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce((e,i)=>{let r=t[i];return r&&(e[i]={callback:(t,e,i)=>{let n=(0,eC.Z)(this.spec.min)?0:lt(this.spec.min,i,t,e),s=(0,eC.Z)(this.spec.max)?1:lt(this.spec.max,i,t,e),a=this.spec.skipTheme?null:this.view.getCurrentTheme();return b1(n,s,a,du(r,t,e,i))}}),e},{});this._encoders=e}}b2.componentType=tz.slider;let b5=new Uint32Array(33),b3=new Uint32Array(33);b3[0]=0,b5[0]=~b3[0];for(let t=1;t<=32;++t)b3[t]=b3[t-1]<<1|1,b5[t]=~b3[t];function b4(t,e,i={top:0,left:0,right:0,bottom:0}){let{top:r=0,left:n=0,right:s=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+s+o)/o),h=~~((e+r+a+o)/o),d=t=>~~(t/o);return d.bitmap=()=>(function(t,e){let i=new Uint32Array(~~((t*e+32)/32));function r(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,r)=>{let n=r*t+e;return i[n>>>5]&1<<(31&n)},set:(e,r)=>{var n,s;let a=r*t+e;n=a>>>5,s=1<<(31&a),i[n]|=s},clear:(e,r)=>{var n,s;let a=r*t+e;n=a>>>5,s=~(1<<(31&a)),i[n]&=s},getRange:({x1:r,y1:n,x2:s,y2:a})=>{if(s<0||a<0||r>t||n>e)return!0;let o,l,h,d,u=a;for(;u>=n;--u)if(o=u*t+r,l=u*t+s,(h=o>>>5)==(d=l>>>5)){if(i[h]&b5[31&o]&b3[1+(31&l)])return!0}else{if(i[h]&b5[31&o]||i[d]&b3[1+(31&l)])return!0;for(let t=h+1;t{var o,l,h,d,u,c,p;let f,g,m,v,b;if(!(s<0)&&!(a<0)&&!(r>t)&&!(n>e))for(;n<=a;++n)if(f=n*t+r,g=n*t+s,(m=f>>>5)==(v=g>>>5)){;o=m,l=b5[31&f]&b3[1+(31&g)],i[o]|=l}else{;for(h=m,d=b5[31&f],i[h]|=d,u=v,c=b3[1+(31&g)],i[u]|=c,b=m+1;b{var a,o,l,h,d,u,c;let p,f,g,m,v;for(;r<=s;++r)if(p=r*t+e,f=r*t+n,(g=p>>>5)==(m=f>>>5)){;a=g,o=b3[31&p]|b5[1+(31&f)],i[a]&=o}else{;for(l=g,h=b3[31&p],i[l]&=h,d=m,u=b5[1+(31&f)],i[d]&=u,v=g+1;vi<0||r<0||s>=e||n>=t,toImageData:r=>{let n=r.createImageData(t,e),s=n.data;for(let r=0;r>>5]&1<<(31&n);s[a+0]=255*o,s[a+1]=255*o,s[a+2]=255*o,s[a+3]=31}return n}}})(l,h),d.x=t=>~~((t+n)/o),d.y=t=>~~((t+r)/o),d.ratio=o,d.padding=i,d.width=t,d.height=e,d}function b6(t,e,i=!1){if(i){let{x1:i,x2:r,y1:n,y2:s}=e,a=nd(i,0,t.width),o=nd(r,0,t.width),l=nd(n,0,t.height),h=nd(s,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}let b8=["#ffffff","#000000"];function b7(t,e,i,r,n,s){if("string"!=typeof t||"string"!=typeof e)return t;let a=new n_(t).toHex(),o=new n_(e).toHex();return b9(a,o,i,r,s)?a:function(t,e,i,r,n,s){let a=[];for(let o of(n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...b8),a))if(t!==o&&b9(o,e,i,r,s))return o}(a,o,i,r,n,s)}function b9(t,e,i,r,n){if("lightness"===n){let i=n_.getColorBrightness(new n_(e));return .5>n_.getColorBrightness(new n_(t))?i>=.5:i<.5}return r?yt(t,e)>r:"largeText"===i?yt(t,e)>3:yt(t,e)>4.5}function yt(t,e){let i=ye(t),r=ye(e);return((i>r?i:r)+.05)/((i>r?r:i)+.05)}function ye(t){let e,i;let r=cE(t),n=r[0]/255,s=r[1]/255,a=r[2]/255;return e=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),i=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*e+.7152*i+.0722*(a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4))}function yi(t,e,i,r){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=r}return n}function yr(t,e,i,r=!0,n=0){let s=i;return n>0&&(s={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),s=b6(t,s),!(r&&e.outOfBounds(s))&&!e.getRange(s)}function yn(t,e,i,r=[],n=!0,s=0){let a=r.filter(t=>ey(t));for(let r=0;r{var e,i,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(r=t.strokeOpacity)&&void 0!==r?r:1}}},fadeOut:(t={})=>{var e,i,r;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(r=t.strokeOpacity)&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function yl(t,e){var i,r;return null!==(r=null===(i=yo[e])||void 0===i?void 0:i.call(yo,t))&&void 0!==r?r:{from:{},to:{}}}let yh=(t,e,i,r)=>{let n=Object.assign({},t.attribute),s=Object.assign({},e.attribute);return ex(null==r?void 0:r.excludeChannels).forEach(t=>{delete s[t]}),Object.keys(s).forEach(t=>{i&&!i.includes(t)&&delete s[t]}),{from:n,to:s}};function yd(t,e,i,r){t.attribute.text!==e.attribute.text&&(0,ef.Z)(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new dE({text:t.attribute.text},{text:e.attribute.text},i,r))}let yu={mode:"same-time",duration:300,easing:"linear"};function yc(t,e,i,r){var n;let s=(n={radius:i,angle:r}).radius?{x:Math.cos(n.angle)*n.radius,y:Math.sin(n.angle)*n.radius}:{x:0,y:0};return{x:t+s.x,y:e+s.y}}function yp(t){return 3===t||4===t}let yf=(t,e,i="top",r=0)=>{if(!t)return;let{x1:n,y1:s,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-s),d=(e.x1+e.x2)/2,u=(e.y1+e.y2)/2,c=0,p=0,f=0,g=0;e&&(f=Math.abs(e.x1-e.x2)/2,g=Math.abs(e.y1-e.y2)/2);let m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":c=-1;break;case"right":c=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":c=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":c=0,p=0}return{x:d+c*(r+f)+l/2*Math.sign(c),y:u+p*(r+g)+h/2*Math.sign(p)}},yg=t=>{if(!t||!t.attribute)return[];let{points:e,segments:i}=t.attribute;if(i&&i.length){let t=[];return i.forEach(e=>{e.points.forEach(e=>{t.push(e)})}),t}return e};function ym(t,e,i="end",r=0){if(!t||!e)return{x:1/0,y:1/0};let{x1:n,x2:s}=t,a=Math.abs(s-n),o=e.x1,l=o;return"end"===i?l=o+a/2+r:"start"===i&&(l=o-a/2-r),{x:l,y:e.y1}}function yv(t,e,i,r,n,s){return Math.abs(e/t)0?n:-n),y:r+e*n/Math.abs(t)}:{x:i+t*s/Math.abs(e),y:r+(e>0?s:-s)}}pk(),mY(),mB(),fo();class yb extends pC{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},yb.defaultAttributes,t)),this.name="label",this._onHover=t=>{let e=t.target;e===this._lastHover||dn(e.states)||(e.addState(t2.hover,!0),gF(this,t=>{t===e||dn(t.states)||t.addState(t2.hoverReverse,!0)}),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(gF(this,t=>{dn(t.states)||(t.removeState(t2.hoverReverse),t.removeState(t2.hover))}),this._lastHover=null)},this._onClick=t=>{let e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void gF(this,t=>{dn(t.states)||(t.removeState(t2.selectedReverse),t.removeState(t2.selected))});dn(e.states)||(e.addState(t2.selected,!0),gF(this,t=>{t===e||dn(t.states)||t.addState(t2.selectedReverse,!0)}),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,r,n,s;if((null===(e=t.detail)||void 0===e?void 0:e.type)===oO.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===oO.ANIMATE_UPDATE&&(null===(r=t.detail.animationState)||void 0===r?void 0:r.isFirstFrameOfStep)){let e=null!==(s=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==s?s:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach(t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))})}}}labeling(t,e,i,r){}_createLabelLine(t,e){let i=function(t,e){if(!t||!e||it(t,e,!0))return;let i=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),s=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-r)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-s)/2,d=i+a,u=r+o,c=n+l,p=s+h,f=c-d,g=p-u;return[yv(f,g,d,u,a,o),yv(-f,-g,c,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){let t=as.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!dn(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}render(){if(this._prepare(),(0,eC.Z)(this._idToGraphic)||this._isCollectionBase&&(0,eC.Z)(this._idToPoint))return;let{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:r,customOverlapFunc:n}=this.attribute,s=this.attribute.data;r6(i)&&(s=i(s));let a=this._initText(s);a=r6(r)?r(s,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),r6(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),a&&a.length&&a.forEach(t=>{this._bindEvent(t),this._setStatesOfText(t)}),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent||!t)return;let{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;let e=this.attribute.state;e&&!dn(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;let e=this.attribute.labelLineState;e&&!dn(e)&&(t.states=e)}_createLabelText(t){return gX(t,"textType")?as.richtext(gK(t)):as.text(t)}_prepare(){var t,e,i,r,n;let s=[];if((r6(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];let i=t.find(t=>t.name===e,!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName)).forEach(t=>{"willRelease"!==t.releaseStatus&&s.push(t)}),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=s,this._isCollectionBase="line-data"===this.attribute.type,!s||0===s.length)return;let{data:a}=this.attribute;if(a&&0!==a.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t):s.attribute.stroke:s.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){let{position:e,offset:i}=this.attribute;for(let r=0;r"bound"===t.type);h&&(null===(n=this._baseMarks)||void 0===n||n.forEach(t=>{t.AABBBounds&&m.setRange(b6(g,t.AABBBounds,!0))})),p.length>0&&p.forEach(t=>{(0,eT.Z)(t)?(function(t,e){if(!e)return[];let i=t.find(t=>t.name===e,!0);return i?i.findAll(t=>"group"!==t.type,!0):[]})(this.getRootNode(),t).forEach(t=>{t.AABBBounds&&m.setRange(b6(g,t.AABBBounds,!0))}):t.AABBBounds&&m.setRange(b6(g,t.AABBBounds,!0))});for(let e=0;ea(n.AABBBounds,s,t,r.offset));return yn(t,e,n,o,h,d)}return!1}if("moveY"===i.type){let r=(i.offset?r6(i.offset)?i.offset(n.attribute):i.offset:[]).map(t=>({x:n.attribute.x,y:n.attribute.y+t}));return yn(t,e,n,r,h,d)}if("moveX"===i.type){let r=(i.offset?r6(i.offset)?i.offset(n.attribute):i.offset:[]).map(t=>({x:n.attribute.x+t,y:n.attribute.y}));return yn(t,e,n,r,h,d)}return!1}(g,m,d[s],this.attribute,i,this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t[e].attribute.id)):this.getGraphicBounds(r,t[e].attribute),this.labeling))){i.setAttributes({x:n.x,y:n.y}),a.push(i);break}if(!n&&c){let{dx:t=0,dy:e=0}=function(t,e,i){let{x1:r,x2:n,y1:s,y2:a}=t.AABBBounds,o=Math.min(r,n),l=Math.max(r,n),h=Math.min(s,a),d=Math.max(s,a),u=0,c=0;return o<0&&l-o<=e?u=-o:l>e&&o-(l-e)>=0&&(u=e-l),h<0&&d-h<=i?c=-h:d>i&&h-(d-i)>=0&&(c=i-d),{dx:u,dy:c}}(i,g.width,g.height);if(0===t&&0===e){if(yr(g,m,i.AABBBounds)){m.setRange(b6(g,i.AABBBounds,!0)),a.push(i);continue}}else if(yr(g,m,{x1:i.AABBBounds.x1+t,x2:i.AABBBounds.x2+t,y1:i.AABBBounds.y1+e,y2:i.AABBBounds.y2+e})){i.setAttributes({x:i.attribute.x+t,y:i.attribute.y+e}),m.setRange(b6(g,i.AABBBounds,!0)),a.push(i);continue}}n||u||a.push(i)}return r6(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(m),a}getBaseMarkGroup(){let{baseMarkGroupName:t}=this.attribute;if(t)return this.getRootNode().find(e=>e.name===t,!0)}getGraphicBounds(t,e={}){if(t){if(!1!==t.attribute.visible)return t.AABBBounds;let{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}let{x:i,y:r}=e;return{x1:i,x2:i,y1:r,y2:r}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;let i=new Map,r=this._graphicToText||new Map,n=[],s=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t.forEach((t,e)=>{let o;let l=this.getRelatedGraphic(t.attribute),h=t.attribute.id,d=this._isCollectionBase?h:l,u=(null==r?void 0:r.get(d))?"update":"enter";if(a&&(o=this._createLabelLine(t,l)),"enter"===u){if(n.push(t),i.set(d,o?{text:t,labelLine:o}:{text:t}),l){let{from:i,to:r}=yl(t.attribute,"fadeIn");this.add(t),o&&(s.push(o),this.add(o)),this._syncStateWithRelatedGraphic(l),this._animationConfig.enter.duration>0&&l.once("animate-bind",a=>{t.setAttributes(i),o&&o.setAttributes(i);let h=this._afterRelatedGraphicAttributeUpdate(t,n,o,s,e,l,r,this._animationConfig.enter);l.on("afterAttributeUpdate",h)})}}else if("update"===u){let e=r.get(d);r.delete(d),i.set(d,e);let n=e.text,{duration:s,easing:a}=this._animationConfig.update;(function(t,e,i){if(!(0,ev.Z)(i)){let{duration:r,easing:n,increaseEffect:s=!0}=i;return t.animate().to(e.attribute,r,n),void(s&&yd(t,e,r,n))}i.forEach((i,r)=>{let{duration:n,easing:s,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=yh(t,e,o,i.options);dn(h)||t.animate().to(h,n,s),"text"in l&&"text"in h&&a&&yd(t,e,n,s)})})(n,t,this._animationConfig.update),e.labelLine&&o&&e.labelLine.animate().to(o.attribute,s,a)}}),r.forEach(t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(yl(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd(()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})}),this._graphicToText=i}_renderWithOutAnimation(t){var e;let i=new Map,r=this._graphicToText||new Map,n=[],{visible:s}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t.forEach(t=>{let e;let a=this.getRelatedGraphic(t.attribute),o=(null==r?void 0:r.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;if(s&&(e=this._createLabelLine(t,a)),"enter"===o)n.push(t),i.set(l,e?{text:t,labelLine:e}:{text:t}),this.add(t),e&&this.add(e),this._syncStateWithRelatedGraphic(a);else if("update"===o){let n=r.get(l);r.delete(l),i.set(l,n),n.text.setAttributes(t.attribute),n.labelLine&&e&&n.labelLine.setAttributes(e.attribute)}}),r.forEach(t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}),this._graphicToText=i}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,r,n,s,a,{mode:o,duration:l,easing:h,delay:d}){let u=c=>{var p,f,g;let{detail:m}=c;if(!m)return{};let v=null===(p=m.animationState)||void 0===p?void 0:p.step;if(!(m.type===oO.ANIMATE_UPDATE&&v&&!("wait"===v.type&&null==(null===(f=v.prev)||void 0===f?void 0:f.type))))return{};if(m.type===oO.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));let b=()=>{s&&(s.onAnimateBind=void 0,s.removeEventListener("afterAttributeUpdate",u))};switch(o){case"after":m.animationState.end&&(t.animate({onStart:b}).wait(d).to(a,l,h),i&&i.animate().wait(d).to(a,l,h));break;case"after-all":n===e.length-1&&m.animationState.end&&(e.forEach(t=>{t.animate({onStart:b}).wait(d).to(a,l,h)}),r.forEach(t=>{t.animate().wait(d).to(a,l,h)}));break;default:if(this._isCollectionBase){let e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!s.containsPoint(e.x,e.y,oR.LOCAL,null===(g=this.stage)||void 0===g?void 0:g.pickerService)||(t.animate({onStart:b}).wait(d).to(a,l,h),i&&i.animate().wait(d).to(a,l,h))}else m.animationState.isFirstFrameOfStep&&(t.animate({onStart:b}).wait(d).to(a,l,h),i&&i.animate().wait(d).to(a,l,h))}};return u}_smartInvert(t){var e,i,r,n,s;let a=(0,ep.Z)(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:d}=a,u=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",c=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(r=a.brightColor)&&void 0!==r?r:"#ffffff",f=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",g=null!==(s=a.outsideEnable)&&void 0!==s&&s;if("null"!==u||"null"!==c)for(let e=0;ethis.getGraphicBounds(t)),r=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"}),n=this._createLabelText(r),s=this.getGraphicBounds(n),a=s.x2-s.x1,o=e.map(t=>t.attribute),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id});if(r){let i={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,maxLineWidth:r.labelLimit,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,r,n,s){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=s;let a=0;i.forEach(t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}),r.forEach((t,i)=>{var s,o,l,h;let d=this._idToGraphic.get(t.id).attribute,u={x:null!==(s=null==d?void 0:d.x)&&void 0!==s?s:0,y:null!==(o=null==d?void 0:d.y)&&void 0!==o?o:0};if(!(0,eC.Z)(r[i])&&!(0,eC.Z)(n[i])){;let t=r[i]?r[i]:null,s=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(d.startAngle+d.endAngle)/2,c=d.endAngle-d.startAngle,p=(l=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(l=d.endAngle-c/2))>0&&l<=Math.PI/2?2:l>Math.PI/2&&l<=Math.PI?3:l>Math.PI&&l<=3*Math.PI/2?4:1,f=yc(u.x,u.y,d.outerRadius,o),g=new y_(t,f,yc(u.x,u.y,a+e.line.line1MinLength,o),p,c,o,d.innerRadius,d.outerRadius,u);g.pointA=yc(u.x,u.y,this.computeDatumRadius(2*u.x,2*u.y,d.outerRadius),g.middleAngle),g.labelSize={width:s.x2-s.x1,height:s.y2-s.y1},1===(h=g.quadrant)||2===h?this._arcRight.set(g.refDatum,g):yp(g.quadrant)&&this._arcLeft.set(g.refDatum,g)}});let o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var r,n;let s=e.spaceWidth,a=null!==(r=e.position)&&void 0!==r?r:"inside",o=null!==(n=e.offsetRadius)&&void 0!==n?n:-s;return t.forEach(t=>{var i,r,n,l,h;let d;let{labelSize:u,radian:c}=t,p=t.innerRadius,f=t.outerRadius;if(c<(l=f,(h=u.height)>2*l?NaN:2*Math.asin(h/2/l)))d=0;else d=f-(c>=Math.PI?p:Math.max(p,u.height/2/Math.tan(c/2)))-s;!0!==e.rotate&&(d=f-s);let g=this._getFormatLabelText(t.refDatum,d);t.labelText=g;let m=Math.min(d,t.labelSize.width),v=this._computeAlign(t,e),b,y=0;"inside"===a&&(y="left"===v?m:"right"===v?0:m/2),b="inside-inner"===a?p-o+y:f+o-y,t.labelPosition=yc(t.circleCenter.x,t.circleCenter.y,b,t.middleAngle),t.labelLimit=m,dJ(m,0)||(t.labelVisible=!1),t.angle=null!==(r=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==r?r:t.middleAngle;let x=null!==(n=e.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(a)&&(x+=Math.PI/2),t.angle+=x}),t}_layoutOutsideLabels(t,e,i){var r,n,s;let a=null!==(r=i[0].attribute.x)&&void 0!==r?r:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,d=e.spaceWidth;if(t.forEach(t=>{let e=yp(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+d),y:t.outerCenter.y}}),t.sort((t,e)=>t.labelPosition.y-e.labelPosition.y),!1!==e.coverEnable||"none"===h.strategy){for(let r of t){let{labelPosition:t,labelSize:n}=r;r.labelLimit=n.width,r.pointB=yp(r.quadrant)?{x:t.x+n.width/2+l+d,y:t.y}:{x:t.x-n.width/2-l-d,y:t.y},this._computeX(r,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{let r=o/((null===(s=e.textStyle)||void 0===s?void 0:s.fontSize)||16);this._adjustY(t,r,e,i);let{minY:n,maxY:a}=t.reduce((t,e)=>{let{y1:i,y2:r}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(r,t.maxY)),t},{minY:1/0,maxY:-Infinity}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(let r of t)this._computePointB(r,h,e,i),this._computeX(r,e,i)}let u=2*a;return t.forEach(t=>{var i,r;t.labelVisible&&(dQ(t.pointB.x,l+d)||dJ(t.pointB.x,u-l-d))&&(t.labelVisible=!1),t.angle=null!==(r=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==r?r:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)}),t}_computeX(t,e,i){var r;let n=t.circleCenter,s=2*n.x;n.y;let a=0;i.forEach(t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)});let o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,d=null===(r=e.layout)||void 0===r?void 0:r.align,u=e.spaceWidth,{labelPosition:c,quadrant:p,pointB:f}=t;(0,ef.Z)(f.x*f.y)||(t.pointC={x:NaN,y:NaN},c.x=NaN,t.labelLimit=0);let g=this.computeRadius(o,e.width,e.height),m=yp(p)?-1:1,v=0,b=(m>0?s-f.x:f.x)-h-u;"labelLine"===d&&(v=(g+l+h)*m+n.x,b=(m>0?s-v:v)-u);let y=this._getFormatLabelText(t.refDatum,b);t.labelText=y;let x=Math.min(b,t.labelSize.width);switch(d){case"labelLine":break;case"edge":v=m>0?s-x-u:x+u;break;default:v=f.x+m*h}x=Math.max(this._ellipsisWidth,x),t.labelLimit=x,t.pointC={x:v,y:c.y};let _=.5*(t.labelLimit0?s+0:0)-m*_:c.x=v+0+m*(u+_)}_computeAlign(t,e){var i,r,n,s,a,o;let l=null!==(r=null===(i=e.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==r?r:null===(n=e.textStyle)||void 0===n?void 0:n.align,h=null!==(a=null===(s=e.layout)||void 0===s?void 0:s.textAlign)&&void 0!==a?a:null===(o=e.layout)||void 0===o?void 0:o.align;return"inside"!==e.position?(0,eC.Z)(l)||"auto"===l?"edge"===h?yp(t.quadrant)?"left":"right":yp(t.quadrant)?"right":"left":l:(0,eC.Z)(l)||"auto"===l?"center":l}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,r){var n,s;r[0].attribute.x;let a=2*(null!==(s=r[0].attribute.y)&&void 0!==s?s:0),o=i.layout;if("vertical"===o.strategy){let e,i=0,r=t.length;if(r<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>a;e--)t[e].labelVisible=!1}else if("none"!==o.strategy){let n=t.map((t,e)=>({arc:t,originIndex:e,priorityIndex:0}));n.sort((t,e)=>e.arc.radian-t.arc.radian),n.forEach((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1});let s=1/0,l=-Infinity;for(let h=0;he?d.labelPosition.y=e-g.labelSize.height/2-d.labelSize.height/2:this._twoWayShift(t,d,g,p)}else if(-1!==c&&-1===p){let e=f.labelPosition.y;ui?(d.labelPosition.y=i-g.labelSize.height/2-d.labelSize.height/2,this._twoWayShift(t,f,d,n[h].originIndex)):(u=0&&e0&&ro)return s}s=e}return i}_findNextVisibleIndex(t,e,i,r){let n=(i-e)*r;for(let i=1;i<=n;i++){let n=e+i*r;if(t[n].labelVisible)return n}return -1}_computePointB(t,e,i,r){let n=0;r.forEach(t=>{t.attribute.outerRadius>n&&(n=t.attribute.outerRadius)});let s=this.computeLayoutOuterRadius(n,i.width,i.height),a=i.line.line1MinLength;if("none"===i.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{let r=t.circleCenter,n=this.computeRadius(s,i.width,i.height),{labelPosition:o,quadrant:l}=t,h=e-Math.max(n+a,t.outerRadius),d=Math.sqrt(e**2-Math.abs(r.y-o.y)**2)-h;(0,ef.Z)(d)?t.pointB={x:r.x+d*(yp(l)?-1:1),y:o.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(let e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){let r,n,s,a,o;let l=t.circleCenter,h={width:2*l.x,height:2*l.y},d=0;i.forEach(t=>{t.attribute.outerRadius>d&&(d=t.attribute.outerRadius)});let u=this.computeLayoutOuterRadius(d,e.width,e.height),c=e.line.line1MinLength,{width:p,height:f}=h,g=this.computeRadius(u,e.width,e.height),m=this._computeLayoutRadius(f/2,e,i),v=Math.abs(t.center.x-p/2),b=t.center.y-f/2;if(dq(p/2,v))r=0,n=1,s=-b;else if(dq(f/2,b))r=1,n=0,s=-v;else{let t=-1/(b/v);r=t,n=-1,s=b-t*v}let y=function(t,e,i,r,n,s){if(0===t&&0===e||s<=0)return[];if(0===t){let t=-i/e,n=s**2-(t-0)**2;return n<0?[]:0===n?[{x:r,y:t}]:[{x:Math.sqrt(n)+r,y:t},{x:-Math.sqrt(n)+r,y:t}]}if(0===e){let e=-i/t,a=s**2-(e-r)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}let a=(e/t)**2+1,o=2*(e/t*(i/t+r)-n),l=o**2-4*a*((i/t+r)**2+n**2-s**2);if(l<0)return[];let h=(-o+Math.sqrt(l))/(2*a),d=(-o-Math.sqrt(l))/(2*a),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*d+i)/t,y:d}]}(r,n,s,c+g-m,0,m);!(y.length<2)&&(y[0].x>y[1].x&&y.reverse(),y[0].x<0?dq(y[0].y,y[1].y)?dJ(t.middleAngle,-Math.PI)&&dQ(t.middleAngle,0)||dJ(t.middleAngle,Math.PI)&&dQ(t.middleAngle,2*Math.PI)?(a=0,o=y[1].y+f/2):(a=y[1].y+f/2,o=f):y[0].y{t.attribute.outerRadius>s&&(s=t.attribute.outerRadius)});let a=this.computeLayoutOuterRadius(s,e.width,e.height),o=this.computeRadius(a,e.width,e.height)+n,l=o-r;return Math.max((l**2+t**2)/(2*l),o)}_findNeighborIndex(t,e){let i=e.originIndex,r=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){r=e;break}for(let e=i+1;e=l&&n>=l||r<=o&&s<=o||r>=h&&s>=h)}(e,r)?e=r:t[i].labelVisible=!1}}_createLabelLine(t,e){var i,r,n,s,a,o,l;let{points:h,line:d={},visible:u,fill:c}=t.attribute,p=t.attribute.points?as.line({visible:null===(n=null!==(i=d.visible&&u)&&void 0!==i?i:null===(r=t.attribute)||void 0===r?void 0:r.visible)||void 0===n||n,stroke:null!==(a=null===(s=d.style)||void 0===s?void 0:s.stroke)&&void 0!==a?a:c,lineWidth:null!==(l=null===(o=d.style)||void 0===o?void 0:o.lineWidth)&&void 0!==l?l:1,points:h,curveType:d.smooth?"basis":null}):void 0;return p&&this._setStatesOfLabelLine(p),p}computeRadius(t,e,i,r){return this.computeLayoutRadius(e||0,i||0)*t*((0,eC.Z)(r)?1:r)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){let r=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*r}}yw.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class yA extends yb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},yA.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e,i="top",r=0){return yf(t,e,i,r)}}yA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class yS extends yb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},yS.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t,e={},i="end"){if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);let r=t.attribute.points||[e],n="start"===i?0:r.length-1;return r[n]?{x1:r[n].x,x2:r[n].x,y1:r[n].y,y2:r[n].y}:void 0}labeling(t,e,i="end",r=0){return ym(t,e,i,r)}}yS.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class yE extends yb{constructor(t){super(lE({},yE.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t,e={},i="end"){var r;if("area"!==t.type)return super.getGraphicBounds(t,e);let n=(null===(r=null==t?void 0:t.attribute)||void 0===r?void 0:r.points)||[e],s="start"===i?0:n.length-1;return{x1:n[s].x,x2:n[s].x,y1:n[s].y,y2:n[s].y}}labeling(t,e,i="end",r=0){return ym(t,e,i,r)}}yE.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};let yT={rect:yy,symbol:yx,arc:yw,line:yS,area:yE,"line-data":yA};class yC extends pC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},yC.defaultAttributes,t)),this.name="data-label"}render(){var t;let{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;let{width:r=0,height:n=0,padding:s}=i||{};if(!r||!n||!(0,ef.Z)(n*r))return;this._componentMap||(this._componentMap=new Map);let a=b4(r,n,s),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)}),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach(t=>{t.disableAnimation()})}enableAnimation(){this._componentMap.forEach(t=>{t.enableAnimation()})}}yC.defaultAttributes={pickable:!1};let yk=(t,e,i,r,n,s={})=>{var a;let o=null===(a=s.components)||void 0===a?void 0:a.dataLabel,l=t.map((t,e)=>{var a,o,l,h,d;let u=Object.assign(Object.assign({},n),{labelIndex:e}),c=null!==(a=lt(r,u,t))&&void 0!==a?a:{},{components:p={}}=s,f={};switch(t.markType){case tF.line:case tF.area:f="line"===c.type?p.lineLabel:"area"===c.type?p.areaLabel:p.lineDataLabel;break;case tF.rect:case tF.rect3d:case tF.interval:f=p.rectLabel;break;case tF.symbol:case tF.circle:case tF.cell:f=p.symbolLabel;break;case tF.arc:case tF.arc3d:f=p.arcLabel;break;case tF.polygon:case tF.path:default:f=p.pointLabel}let g=null!==(o=c.data)&&void 0!==o?o:[],m=null!==(h=null===(l=null==f?void 0:f.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};return g&&g.length>0?g.forEach((e,r)=>{if(t.elements[r]){let n=du(i,e,t.elements[r],u);lE(e,m,n)}}):t.elements.forEach(e=>{if("willRelease"!==e.getGraphicItem().releaseStatus){if(t.isCollectionMark())e.getDatum().forEach(t=>{let r=du(i,t,e,u);g.push(lE({},m,r))});else{let t=lE({},m,du(i,e.getDatum(),e,u));g.push(t)}}}),lE({},f,{data:g,baseMarkGroupName:null===(d=t.graphicItem)||void 0===d?void 0:d.name,getBaseMarks:()=>t.elements.map(t=>t.getGraphicItem())},null!=c?c:{})}).filter(t=>!(0,eC.Z)(t));return lE({},o,{size:e,dataLabels:l})};class yM extends uI{constructor(t,e){super(t,tz.label,e),this.spec.componentType=tz.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){let t=ex(this.spec.target).map(t=>(0,eT.Z)(t)?this.view.getMarkById(t):t);this.detach(t)}if(this.spec.target=t,t){let e=ex(t).map(t=>(0,eT.Z)(t)?this.view.getMarkById(t):t);this.attach(e)}return this.commit(),this}_updateComponentEncoders(){let t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce((e,i)=>{let r=t[i];return r&&(e[i]={callback:(t,e,i)=>{var n,s,a,o;let l=ex(this.spec.target).map(t=>(0,eT.Z)(t)?this.view.getMarkById(t):t),h=null===(s=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===s?void 0:s.call(n),d=lt(this.spec.size,i);d||(d=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});let u=this.spec.skipTheme?null:this.view.getCurrentTheme();return yk(l,d,r,this.spec.labelStyle,i,u)}}),e},{});this._encoders=e}}yM.componentType=tz.label;let yB="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",yP={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};(tp=et||(et={})).startHandler="startHandler",tp.endHandler="endHandler",tp.middleHandler="middleHandler",tp.background="background";let yR=["segments","points","curveType",...nO];class yO extends nF{constructor(t){super(t),this.type="area",this.numberType=n9}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;let{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){let t=rQ(this).area;this._AABBBounds.clear();let e=this.attribute,i=ru.graphicService.updateAreaAABBBounds(e,rQ(this).area,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=nU(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw Error("暂不支持")}_interpolate(t,e,i,r,n){"points"===t&&(n.points=nY(i,r,e))}getDefaultAttribute(t){return rQ(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,yR)}needUpdateTag(t){return super.needUpdateTag(t,yR)}toCustomPath(){let t=new iK,e=this.attribute,i=e.segments,r=e=>{if(e&&e.length){let i=!0,r=[];if(e.forEach(e=>{var n,s;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),r.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y}),i=!1)}),r.length){for(let e=r.length-1;e>=0;e--)t.lineTo(r[e].x,r[e].y);t.closePath()}}};return e.points?r(e.points):i&&i.length&&i.forEach(t=>{r(t.points)}),t}clone(){return new yO(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yO.NOWORK_ANIMATE_ATTR}}function yI(t){return new yO(t)}yO.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},nj);let yL=!1,yD=new eB(t=>{yL||(yL=!0,t(op).toSelf().inSingletonScope(),t(sP).to(op).inSingletonScope(),t(sO).toService(sP),t(a$).toService(a6),eW(t,a$),t(of).toSelf().inSingletonScope())}),yN=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=n9}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).area,{x:s=n.x,y:a=n.y}=t.attribute,{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(h)return!0;if(!l)return!1;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=aB(r,s+a,r.dpr),h=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),h}};yN=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tf=0,tg=eH(sP),function(t,e){tg(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],yN);let yj=!1,yF=new eB((t,e,i,r)=>{yj||(yj=!0,t(pX).to(yN).inSingletonScope(),t(p9).toService(pX))}),yz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=n9}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).area,{x:s=n.x,y:a=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,t=>!!o||(o=t.isPointInPath(e.x,e.y))),r.highPerformanceRestore(),o}};yz=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tm=0,tv=eH(sP),function(t,e){tv(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],yz);let yH=!1,yG=new eB((t,e,i,r)=>{yH||(yH=!0,t(pN).to(yz).inSingletonScope(),t(pL).toService(pN))});function yU(){yU.__loaded||(yU.__loaded=!0,as.RegisterGraphicCreator("area",yI),rO.load(yD),rO.load(pI?yF:yG))}yU.__loaded=!1;var yV=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);ne.indexOf(r[n])&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};let yW={debounce:em,throttle:hK};mX(),ml(),gD(),yU(),fo();class yZ extends pC{setPropsFromAttrs(){let{start:t,end:e,orient:i,previewData:r,previewPointsX:n,previewPointsY:s,previewPointsX1:a,previewPointsY1:o}=this.attribute;t&&(this.state.start=t),e&&(this.state.end=e);let{width:l,height:h}=this.getLayoutAttrFromConfig();this._spanCache=this.state.end-this.state.start,this._isHorizontal="top"===i||"bottom"===i,this._layoutCache.max=this._isHorizontal?l:h,this._layoutCache.attPos=this._isHorizontal?"x":"y",this._layoutCache.attSize=this._isHorizontal?"width":"height",r&&(this._previewData=r),r6(n)&&(this._previewPointsX=n),r6(s)&&(this._previewPointsY=s),r6(a)&&(this._previewPointsX1=a),r6(o)&&(this._previewPointsY1=o)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},yZ.defaultAttributes,t)),this.name="dataZoom",this._previewData=[],this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",max:0},this.state={start:0,end:1},this._statePointToData=t=>t,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=et.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=et.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=et.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=et.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=et.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===o2.env&&(o2.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),o2.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();let{start:e,end:i,brushSelect:r,realTime:n=!0}=this.attribute,s=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(s[a]-this._activeCache.lastPos[a])/o,{start:h,end:d}=this.state;this._activeState&&(this._activeTag===et.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===et.startHandler?h+l>d?(d=(h=d)+l,this._activeTag=et.endHandler):h+=l:this._activeTag===et.endHandler&&(d+l{t.preventDefault();let{start:e,end:i,brushSelect:r,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===et.background){let e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,r&&this.renderDragMask(),e===this.state.start&&i===this.state.end||this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),"browser"===o2.env&&(o2.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),o2.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};let{position:i,showDetail:r}=t;this._activeCache.startPos=i,this._activeCache.lastPos=i,this._showText="auto"!==r&&r,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return;let{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",t=>this._onHandlerPointerDown(t,"start")),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",t=>this._onHandlerPointerDown(t,"end")),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",t=>this._onHandlerPointerDown(t,"middleSymbol")),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",t=>this._onHandlerPointerDown(t,"middleRect"));let i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",t=>this._onHandlerPointerDown(t,i)),e&&this._background&&this._background.addEventListener("pointerdown",t=>this._onHandlerPointerDown(t,"background")),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",t=>this._onHandlerPointerDown(t,"background")),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",t=>this._onHandlerPointerDown(t,i)),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){let{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){let{zoomLock:r=!1,minSpan:n=0,maxSpan:s=1}=this.attribute,a=e-t;a!==this._spanCache&&(r||as)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){var e,i,r,n,s,a;let{x:o,y:l}=o2.mapToCanvasPoint(t,null===(n=null===(r=null===(i=null===(e=this.stage)||void 0===e?void 0:e.window)||void 0===i?void 0:i.getContext())||void 0===r?void 0:r.canvas)||void 0===n?void 0:n.nativeCanvas);return{x:o-((null===(s=this.stage)||void 0===s?void 0:s.x)||0),y:l-((null===(a=this.stage)||void 0===a?void 0:a.y)||0)}}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){let{attPos:i,max:r}=this._layoutCache,{position:n}=this.attribute,s=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(s,a)/r,0),1),l=Math.min(Math.max(Math.max(s,a)/r,0),1);.01>Math.abs(o-l)?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){let{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:r}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:nd(0>this.dragMaskSize()?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===et.background&&Math.abs(this.dragMaskSize())||0,height:r},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:nd(0>this.dragMaskSize()?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+r),width:i,height:this._activeState&&this._activeTag===et.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){let i,r,n,s;let{startTextStyle:a,endTextStyle:o}=this.attribute,{formatMethod:l}=a,h=yV(a,["formatMethod"]),{formatMethod:d}=o,u=yV(o,["formatMethod"]),{start:c,end:p}=this.state;this._startValue=this._statePointToData(c),this._endValue=this._statePointToData(p);let{position:f,width:g,height:m}=this.getLayoutAttrFromConfig(),v=l?l(this._startValue):this._startValue,b=d?d(this._endValue):this._endValue,y={x1:f.x,y1:f.y,x2:f.x+g,y2:f.y+m};this._isHorizontal?(i={x:f.x+c*g,y:f.y+m/2},r={x:f.x+p*g,y:f.y+m/2},n={textAlign:this.isTextOverflow(y,t,"start")?"left":"right",textBaseline:"middle"},s={textAlign:this.isTextOverflow(y,e,"end")?"right":"left",textBaseline:"middle"}):(i={x:f.x+g/2,y:f.y+c*m},r={x:f.x+g/2,y:f.y+p*m},n={textAlign:"center",textBaseline:this.isTextOverflow(y,t,"start")?"top":"bottom"},s={textAlign:"center",textBaseline:this.isTextOverflow(y,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,lE({},h,{text:v,x:i.x,y:i.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:n}),`data-zoom-start-text-${f}`),this._endText=this.maybeAddLabel(this._container,lE({},u,{text:b,x:r.x,y:r.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:s}),`data-zoom-end-text-${f}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;let{x1:i,x2:r,y1:n,y2:s}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new io).set(i,n,r,s).intersects(e)){let t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,r,n,s;let a,o,l;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;let{position:h,size:d,orient:u,middleHandlerStyle:c={},startHandlerStyle:p={},endHandlerStyle:f={},backgroundStyle:g={}}=this.attribute,{width:m,height:v}=d,b=null!==(e=null===(t=c.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;c.visible?this._isHorizontal?(a=m,o=v-b,l={x:h.x,y:h.y+b}):(a=m-b,o=v,l={x:h.x+("left"===u?b:0),y:h.y}):(a=m,o=v,l=h);let y=null!==(i=p.size)&&void 0!==i?i:this._isHorizontal?o:a,x=null!==(r=f.size)&&void 0!==r?r:this._isHorizontal?o:a;return p.visible&&(this._isHorizontal?(a-=(y+x)/2,l={x:l.x+y/2,y:l.y}):(o-=(y+x)/2,l={x:l.x,y:l.y+y/2})),o+=(n=g.lineWidth/2,n),a+=(s=g.lineWidth/2,s),this._layoutAttrFromConfig={position:l,width:a,height:o},this._layoutAttrFromConfig}render(){var t,e,i,r,n,s,a,o,l,h,d,u,c,p,f,g,m,v,b,y,x,_,w,A,S,E,T,C,k,M,B,P,R,O;this._layoutAttrFromConfig=null;let{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:N={},selectedBackgroundChartStyle:j={},middleHandlerStyle:F={},startHandlerStyle:z={},endHandlerStyle:H={},brushSelect:G,zoomLock:U}=this.attribute,{start:V,end:W}=this.state,{position:Z,width:$,height:Y}=this.getLayoutAttrFromConfig(),X=null!==(t=z.triggerMinSize)&&void 0!==t?t:40,K=null!==(e=H.triggerMinSize)&&void 0!==e?e:40,q=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=q,this._background=q.createOrUpdateChild("background",Object.assign(Object.assign({x:Z.x,y:Z.y,width:$,height:Y,cursor:G?"crosshair":"auto"},L),{pickable:!U&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(r=D.line)||void 0===r?void 0:r.visible)&&this.setPreviewAttributes("line",q),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",q),G&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=q.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Z.x+V*$,y:Z.y,width:(W-V)*$,height:Y,cursor:G?"crosshair":"move"},N),{pickable:!U&&(null===(s=j.pickable)||void 0===s||s)}),"rect"):this._selectedBackground=q.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Z.x,y:Z.y+V*Y,width:$,height:(W-V)*Y,cursor:G?"crosshair":"move"},N),{pickable:!U&&(null===(a=N.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",q),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",q),this._isHorizontal){if(F.visible){let t=(null===(h=F.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=q.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Z.x+V*$,y:Z.y-t,width:(W-V)*$,height:t},null===(d=F.background)||void 0===d?void 0:d.style),{pickable:!U&&(null===(p=null===(c=null===(u=F.background)||void 0===u?void 0:u.style)||void 0===c?void 0:c.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=q.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Z.x+(V+W)/2*$,y:Z.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(g=null===(f=F.icon)||void 0===f?void 0:f.symbolType)&&void 0!==g?g:"square"},F.icon),{pickable:!U&&(null===(m=F.icon.pickable)||void 0===m||m)}),"symbol")}this._startHandler=q.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Z.x+V*$,y:Z.y+Y/2,size:Y,symbolType:null!==(v=z.symbolType)&&void 0!==v?v:"square"},yP.horizontal),z),{pickable:!U&&(null===(b=z.pickable)||void 0===b||b)}),"symbol"),this._endHandler=q.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Z.x+W*$,y:Z.y+Y/2,size:Y,symbolType:null!==(y=H.symbolType)&&void 0!==y?y:"square"},yP.horizontal),H),{pickable:!U&&(null===(x=H.pickable)||void 0===x||x)}),"symbol");let t=Math.max(this._startHandler.AABBBounds.width(),X),e=Math.max(this._startHandler.AABBBounds.height(),X),i=Math.max(this._endHandler.AABBBounds.width(),K),r=Math.max(this._endHandler.AABBBounds.height(),K);this._startHandlerMask=q.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Z.x+V*$-t/2,y:Z.y+Y/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},yP.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=q.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Z.x+W*$-i/2,y:Z.y+Y/2-r/2,width:i,height:r,fill:"white",fillOpacity:0,zIndex:999},yP.horizontal),{pickable:!U}),"rect")}else{if(F.visible){let t=(null===(_=F.background)||void 0===_?void 0:_.size)||10;this._middleHandlerRect=q.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===I?Z.x-t:Z.x+$,y:Z.y+V*Y,width:t,height:(W-V)*Y},null===(w=F.background)||void 0===w?void 0:w.style),{pickable:!U&&(null===(E=null===(S=null===(A=F.background)||void 0===A?void 0:A.style)||void 0===S?void 0:S.pickable)||void 0===E||E)}),"rect"),this._middleHandlerSymbol=q.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===I?Z.x-t/2:Z.x+$+t/2,y:Z.y+(V+W)/2*Y,angle:Math.PI/180*90,symbolType:null!==(C=null===(T=F.icon)||void 0===T?void 0:T.symbolType)&&void 0!==C?C:"square",strokeBoundsBuffer:0},F.icon),{pickable:!U&&(null===(M=null===(k=F.icon)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"symbol")}this._startHandler=q.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Z.x+$/2,y:Z.y+V*Y,size:$,symbolType:null!==(B=z.symbolType)&&void 0!==B?B:"square"},yP.vertical),z),{pickable:!U&&(null===(P=z.pickable)||void 0===P||P)}),"symbol"),this._endHandler=q.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Z.x+$/2,y:Z.y+W*Y,size:$,symbolType:null!==(R=H.symbolType)&&void 0!==R?R:"square"},yP.vertical),H),{pickable:!U&&(null===(O=H.pickable)||void 0===O||O)}),"symbol");let t=Math.max(this._startHandler.AABBBounds.width(),X),e=Math.max(this._startHandler.AABBBounds.height(),X),i=Math.max(this._endHandler.AABBBounds.width(),K),r=Math.max(this._endHandler.AABBBounds.height(),K);this._startHandlerMask=q.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Z.x+$/2+t/2,y:Z.y+V*Y-e/2,width:r,height:i,fill:"white",fillOpacity:0,zIndex:999},yP.vertical),{pickable:!U}),"rect"),this._endHandlerMask=q.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Z.x+$/2+i/2,y:Z.y+W*Y-r/2,width:r,height:i,fill:"white",fillOpacity:0,zIndex:999},yP.vertical),{pickable:!U}),"rect")}this._showText&&this.renderText()}computeBasePoints(){let t,e;let{orient:i}=this.attribute,{position:r,width:n,height:s}=this.getLayoutAttrFromConfig();return this._isHorizontal?(t=[{x:r.x,y:r.y+s}],e=[{x:r.x+n,y:r.y+s}]):"left"===i?(t=[{x:r.x+n,y:r.y}],e=[{x:r.x+n,y:r.y+s}]):(t=[{x:r.x,y:r.y+s}],e=[{x:r.x,y:r.y}]),{basePointStart:t,basePointEnd:e}}simplifyPoints(t){var e;return t.length>1e4?function(t,e,i){if(t.length<=10)return t;let r=void 0!==e?e*e:1;return t=function(t,e){let i=t.length-1,r=[t[0]];return function t(e,i,r,n,s){let a,o,l,h=n,d=i,u=e[i].x,c=e[i].y,p=e[r].x-u,f=e[r].y-c,g=p*p+f*f;for(let t=i+1,n=r-1;th&&(h=o,d=t);h>n&&(d-i>2&&t(e,i,d,n,s),s.push(e[d],e[d+1]),r-d>2&&t(e,d,r,n,s))}(t,0,i,e,r),r.push(t[i]),r}(t=i?t:function(t,e){let i,r,n=t[0].x,s=t[0].y,a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,s=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===s||a.push(t[t.length-1]),a}(t,r),r)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1):t}getPreviewLinePoints(){let t=this._previewData.map(t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)}));if(0===t.length)return t;t=this.simplifyPoints(t);let{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map(t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)}));if(0===t.length)return t;t=this.simplifyPoints(t);let{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");let{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");let{selectedBackgroundChartStyle:i={}}=this.attribute,{start:r,end:n}=this.state,{position:s,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?s.x+r*a:s.x,y:this._isHorizontal?s.y:s.y+r*o,width:this._isHorizontal?(n-r)*a:a,height:this._isHorizontal?o:(n-r)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?s.x+r*a:s.x),y:-(this._isHorizontal?s.y:s.y+r*o),width:this._isHorizontal?(n-r)*a:a,height:this._isHorizontal?o:(n-r)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let r=this.find(t=>t.name===i,!0);return r?r.setAttributes(e):(r=new mq(e)).name=i,t.add(r),r}setStartAndEnd(t,e){let{start:i,end:r}=this.attribute;ey(t)&&ey(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&r===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,r;let{middleHandlerStyle:n={}}=this.attribute,s=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;return Math.max(s,...ex(null!==(r=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==r?r:10))}setPreviewPointsX(t){r6(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){r6(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){r6(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){r6(t)&&(this._previewPointsY1=t)}setStatePointToData(t){r6(t)&&(this._statePointToData=t)}}yZ.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:yB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:yB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}};class y$ extends bY{constructor(t,e){super(t,e),this.type=y$.type,this.options=Object.assign({},y$.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.source).filter(t=>t.markType===tF.component&&"datazoom"===t.componentType),this._data=(0,eT.Z)(this.options.target.data)?t.getDataById(this.options.target.data):this.options.target.data}getEvents(){if(!this._marks||0===this._marks.length)return[];let t=this._marks[0];if(!this._data||!t)return[];let e=this.options.target.filter,i=this.options.target.transform,r=(0,eT.Z)(e)?(i,r)=>{if((0,eC.Z)(r.start)||(0,eC.Z)(r.end))return!0;let n=pw(t.getDatazoomMainScale(),i[e]);return r.startRatio<=n&&r.endRatio>=n}:e;return this._filterData(this._data,t,tH.datazoom,e=>{let i=e.detail.start,r=e.detail.end;return{startRatio:i,endRatio:r,start:t.invertDatazoomRatio(i),end:t.invertDatazoomRatio(r)}},r,i),[{type:"change",handler:this.handleFilter}]}}y$.type="datazoom-filter",y$.defaultOptions={};let yY=(t,e,i)=>{var r;let n=null===(r=null==e?void 0:e.components)||void 0===r?void 0:r.datazoom;return t?lE({},n,{previewData:t},null!=i?i:{}):lE({},n,null!=i?i:{})};class yX extends uI{constructor(t,e){super(t,tz.datazoom,e),this.spec.componentType=tz.datazoom}parseAddition(t){var e;super.parseAddition(t);let{data:i,x:r,y:n,x1:s,y1:a}=null!==(e=t.preview)&&void 0!==e?e:{};return this.preview(i,r,n,s,a),this._updateComponentEncoders(),this}preview(t,e,i,r,n){if(!(0,eC.Z)(this.spec.preview)){let t=this.spec.preview.data,e=(0,eT.Z)(t)?this.view.getDataById(t):t;this.detach(e),this.detach(dh(this.spec.preview.x,this.view)),this.detach(dh(this.spec.preview.y,this.view)),this.detach(dh(this.spec.preview.x1,this.view)),this.detach(dh(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:r,y1:n};let s=(0,eT.Z)(t)?this.view.getDataById(t):t;this.attach(s),this.attach(dh(e,this.view)),this.attach(dh(i,this.view)),this.attach(dh(r,this.view)),this.attach(dh(n,this.view))}return this._updateComponentEncoders(),this.commit(),this}setStartEndValue(t,e){let i=this.getGroupGraphicItem();return i&&i.setStartAndEnd&&i.setStartAndEnd(t,e),this}getStartEndValue(){let t=this.getGroupGraphicItem();if(t){let e=t.state;return{start:e.start,end:e.end}}return null}addGraphicItem(t,e){var i;let r=this.spec.skipTheme?null:this.view.getCurrentTheme(),n=Object.assign({},null===(i=null==r?void 0:r.components)||void 0===i?void 0:i.datazoom,t),s=ld.createGraphicComponent(this.componentType,n,{skipDefault:this.spec.skipTheme});return this.setDatazoomHandlers(s),super.addGraphicItem(n,e,s)}reuse(t){return super.reuse(t),this.setDatazoomHandlers(),this}_updateComponentEncoders(){var t;let e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=(0,eT.Z)(e)?this.view.getDataById(e):e,r=Object.assign({update:{}},this.spec.encode),n=Object.keys(r).reduce((t,e)=>{let n=r[e];return n&&(t[e]={callback:(t,e,r)=>{var s;let a=this.spec.skipTheme?null:this.view.getCurrentTheme(),o=du(n,t,e,r);return yY(null===(s=null==i?void 0:i.getValue)||void 0===s?void 0:s.call(i),a,o)}}),t},{});this._encoders=n}invertDatazoomRatio(t){let e=this.getDatazoomMainScale();if(e){let i=e.range(),r=(i[i.length-1]-i[0])*t+i[0];return e.invert(r)}return null}getDatazoomMainScale(){var t,e;let i=this.getGroupGraphicItem();if(i&&this.spec.preview){let r="top"===i.attribute.orient||"bottom"===i.attribute.orient?null===(t=this.spec.preview.x)||void 0===t?void 0:t.scale:null===(e=this.spec.preview.y)||void 0===e?void 0:e.scale,n=(0,eT.Z)(r)?this.view.getScaleById(r):r;return null==n?void 0:n.getScale()}return null}setDatazoomHandlers(t){var e;let i=null!=t?t:this.getGroupGraphicItem();i.setStatePointToData(t=>{var e;return this.spec.preview&&null!==(e=this.invertDatazoomRatio(t))&&void 0!==e?e:t});let{data:r,x:n,y:s,x1:a,y1:o}=null!==(e=this.spec.preview)&&void 0!==e?e:{};i.setPreviewPointsX(t=>{if(n&&r)return du({x:n},t,this.elements[0],this.parameters()).x}),i.setPreviewPointsY(t=>{if(s&&r)return du({y:s},t,this.elements[0],this.parameters()).y}),i.setPreviewPointsX1(t=>{if(a&&r)return du({x1:a},t,this.elements[0],this.parameters()).x1}),i.setPreviewPointsY1(t=>{if(o&&r)return du({y1:o},t,this.elements[0],this.parameters()).y1})}}yX.componentType=tz.datazoom;class yK extends gA{constructor(t){super(t)}}(tb=ee||(ee={})).OnPlay="onPlay",tb.OnPause="onPause",tb.OnForward="onForward",tb.OnBackward="onBackward",(ty=ei||(ei={})).Start="start",ty.Pause="pause",ty.Forward="forward",ty.Backward="backward";class yq extends pC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},yq.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},yq.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},yq.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},yq.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},yq.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,r;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(r=this._forwardAttr.style.symbolType)&&void 0!==r?r:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{(0,eC.Z)(this._playController)&&(this._playController=new yK(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{(0,eC.Z)(this._backwardController)&&(this._backwardController=new yK(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{(0,eC.Z)(this._forwardController)&&(this._forwardController=new yK(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()}),this._backwardController.addEventListener("pointerdown",t=>{t.stopPropagation(),this.backward()}),this._forwardController.addEventListener("pointerdown",t=>{t.stopPropagation(),this.forward()}))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent("ControllerEventEnum.OnPlay")},this.pause=()=>{this._dispatchEvent("ControllerEventEnum.OnPause")},this.forward=()=>{this._dispatchEvent("ControllerEventEnum.OnForward")},this.backward=()=>{this._dispatchEvent("ControllerEventEnum.OnBackward")},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}yq.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},yq.defaultAttributes={[ei.Start]:{},[ei.Pause]:{},[ei.Backward]:{},[ei.Forward]:{}};let yJ={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},yQ=[200,10];(tx=er||(er={})).Default="default",tx.Reverse="reverse";let y0=({direction:t,maxIndex:e,dataIndex:i})=>t===er.Default&&i===e,y1=({direction:t,minIndex:e,dataIndex:i})=>t===er.Reverse&&i===e,y2=({direction:t,maxIndex:e,minIndex:i,dataIndex:r})=>y0({direction:t,maxIndex:e,dataIndex:r})||y1({direction:t,minIndex:i,dataIndex:r}),y5=({direction:t,minIndex:e,dataIndex:i})=>t===er.Default&&i===e,y3=({direction:t,maxIndex:e,dataIndex:i})=>t===er.Reverse&&i===e,y4=({direction:t,maxIndex:e,minIndex:i,dataIndex:r})=>y5({direction:t,minIndex:i,dataIndex:r})||y3({direction:t,maxIndex:e,dataIndex:r}),y6=t=>"top"===t||"bottom"===t,y8=(t,e,i,r)=>"default"===t?Math.min(e+1,r):Math.max(e-1,i);class y7 extends pC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},y7.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let r;(0,ef.Z)(this._handlerStyle.size)?r=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(r=(0,eJ.Fp)(this._handlerStyle.size[0],this._handlerStyle.size[1]));let n={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:(0,ef.Z)(r)?r:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(y6(this._orient)){let t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:yQ["1"];n.layout="horizontal",n.railHeight=i,n.railWidth=t,n.x=this._layoutInfo.slider.x,n.y=this._layoutInfo.slider.y}else{let t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:yQ["1"];n.layout="vertical",n.railWidth=e,n.railHeight=t,n.x=this._layoutInfo.slider.x,n.y=this._layoutInfo.slider.y}return n},this._initSlider=()=>{let t=this._updateSliderAttrs();this._slider=new bU(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{let t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return y6(this._orient)?t.layout="horizontal":t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{let t=this._updateControllerAttrs();this._controller=new yq(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;let{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initLayoutInfo(){var t,e,i;let r=[this._start,this._backward,this._forward].sort((t,e)=>t.order-e.order),n=r.filter(t=>"end"!==t.position),s=r.filter(t=>"end"===t.position),a=null!==(t=y6(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:yQ["1"],o=r.reduce((t,e)=>{let i=e.style.size,r=(0,ib.Z)(i)?i:(0,eJ.Fp)(i[0],i[1]);return t+e.space+r},0),l=this._sliderVisible?(y6(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,d=n.reduce((t,e)=>{let{key:i,space:r,style:{size:n}}=e,s=(0,ib.Z)(n)?n:(0,eJ.Fp)(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:s,x:y6(this._orient)?t+r:(this._size.width-s)/2,y:y6(this._orient)?(this._size.height-s)/2:t+r}),t+r+s},0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:y6(this._orient)?d+this.attribute.slider.space:(this._size.width-a)/2,y:y6(this._orient)?(this._size.height-a)/2:d+this.attribute.slider.space}),s.reduce((t,e)=>{let{key:i,space:r,style:{size:n}}=e,s=(0,ib.Z)(n)?n:(0,eJ.Fp)(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:s,x:y6(this._orient)?t+r:(this._size.width-s)/2,y:y6(this._orient)?(this._size.height-s)/2:t+r}),t+r+s},d+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){let t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){let t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function y9(){vW(),pk(),gD()}y7.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},yJ),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},yJ),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},yJ),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},yJ),{key:"backward",position:"start"})}},(t_=en||(en={})).change="change",t_.play="play",t_.pause="pause",t_.backward="backward",t_.forward="forward",t_.end="end",t_.OnChange="change",t_.OnPlay="play",t_.OnPause="pause",t_.OnBackward="backward",t_.OnForward="forward",t_.OnEnd="end";y9();class xt extends y7{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;let i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(ee.OnPlay,t=>{t.stopPropagation(),this.play()}),this._controller.addEventListener(ee.OnPause,t=>{t.stopPropagation(),this.pause()}),this._controller.addEventListener(ee.OnForward,t=>{t.stopPropagation(),this.forward()}),this._controller.addEventListener(ee.OnBackward,t=>{t.stopPropagation(),this.backward()}),this._slider.addEventListener("change",t=>{var e;t.stopPropagation();let i=null===(e=t.detail)||void 0===e?void 0:e.value,r=i/this._maxIndex;this._elapsed=r*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>Math.min(this._elapsed/this._totalDuration*this._maxIndex,this._maxIndex),this._updateSlider=()=>{let t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{let e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(en.change))},this.play=()=>{var t,e,i,r;return t=this,e=void 0,i=void 0,r=function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(en.play),this._rafId=o2.getRequestAnimationFrame()(this._play.bind(this)))},new(i||(i=Promise))(function(n,s){function a(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):((e=t.value)instanceof i?e:new i(function(t){t(e)})).then(a,o)}l((r=r.apply(t,e||[])).next())})},this._play=()=>{this._elapsed=Date.now()-this._startTime;let t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=o2.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,o2.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(en.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,o2.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(en.pause))},this.backward=()=>{let t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(en.backward)},this.forward=()=>{let t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(en.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}y9();class xe extends y7{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,r;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:er.Default,this._dataIndex=(0,eC.Z)(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(r=this.attribute.dataIndex)&&void 0!==r?r:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(ee.OnPlay,t=>{t.stopPropagation(),this.play()}),this._controller.addEventListener(ee.OnPause,t=>{t.stopPropagation(),this.pause()}),this._controller.addEventListener(ee.OnForward,t=>{t.stopPropagation(),this.forward()}),this._controller.addEventListener(ee.OnBackward,t=>{t.stopPropagation(),this.backward()}),this._slider.addEventListener("change",t=>{let e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(en.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(y2({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||y4({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===er.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(en.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=o2.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{let e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(en.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(y8(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(en.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=o2.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),o2.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(en.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,o2.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(en.pause))},this.backward=()=>{let t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(en.change),this.dispatchCustomEvent(en.backward)},this.forward=()=>{let t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(en.change),this.dispatchCustomEvent(en.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}class xi extends bY{constructor(t,e){super(t,e),this.type=xi.type,this.options=Object.assign({},xi.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.source).filter(t=>t.markType===tF.component&&"player"===t.componentType),this._data=(0,eT.Z)(this.options.target.data)?t.getDataById(this.options.target.data):this.options.target.data}getEvents(){if(!this._marks||0===this._marks.length)return[];let t=this._marks[0];if(!this._data||!t)return[];let e=this.options.target.transform;return this._filterData(this._data,t,tH.player,t=>({index:t.detail.index,value:t.detail.value}),void 0,(t,i)=>e?e(t,i):i.value),[{type:en.OnChange,handler:this.handleFilter}]}}xi.type="player-filter",xi.defaultOptions={};let xr=(t,e,i)=>{var r;return lE({},null===(r=null==e?void 0:e.components)||void 0===r?void 0:r.continuousPlayer,{data:t,dataIndex:0},null!=i?i:{})},xn=(t,e,i)=>{var r;return lE({},null===(r=null==e?void 0:e.components)||void 0===r?void 0:r.discretePlayer,{data:t,dataIndex:0},null!=i?i:{})};class xs extends uI{constructor(t,e){super(t,tz.player,e),this.spec.componentType=tz.player,this.spec.playerType="auto"}parseAddition(t){return super.parseAddition(t),this.playerType(t.playerType),this.source(t.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}source(t){var e;if(this.spec.source){let t=null===(e=this.spec)||void 0===e?void 0:e.source,i=(0,ev.Z)(t)?null:(0,eT.Z)(t)?this.view.getDataById(t):t;this.detach(i)}this.spec.source=t;let i=(0,ev.Z)(t)?null:(0,eT.Z)(t)?this.view.getDataById(t):t;return this.attach(i),this.commit(),this}play(){return this.getGroupGraphicItem().play(),this}pause(){return this.getGroupGraphicItem().pause(),this}backward(){return this.getGroupGraphicItem().backward(),this}forward(){return this.getGroupGraphicItem().forward(),this}addGraphicItem(t,e,i){let r=lE({slider:{handlerStyle:{size:16}}},t),n=null!=i?i:ld.createGraphicComponent(this._getPlayerComponentType(),r,{skipDefault:this.spec.skipTheme});return super.addGraphicItem(r,e,n)}_updateComponentEncoders(){let t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce((e,i)=>{let r=t[i];return r&&(e[i]={callback:(t,e,i)=>{var n;let s=this.spec.skipTheme?null:this.view.getCurrentTheme(),a=du(r,t,e,i),o=this.spec.source,l=(0,ev.Z)(o)?null:(0,eT.Z)(o)?this.view.getDataById(o):o,h=(0,ev.Z)(o)?o:null!==(n=null==l?void 0:l.getValue())&&void 0!==n?n:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return xr(h,s,a);case"discretePlayer":return xn(h,s,a)}}}),e},{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}}xs.componentType=tz.player;let xa=["heightLimit","lineClamp"];class xo extends mD{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){let{text:t}=this.attribute;return(0,ev.Z)(t)?!t.every(t=>null==t||""===t):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,r,n;let s=rQ(this).text,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:c=s.stroke,lineWidth:p=s.lineWidth,wordBreak:f=s.wordBreak,fontWeight:g=s.fontWeight,ignoreBuf:m=s.ignoreBuf,heightLimit:v=0,suffixPosition:b=s.suffixPosition,lineClamp:y}=this.attribute,x=null!==(e=n0(this.attribute.lineHeight,this.attribute.fontSize||s.fontSize))&&void 0!==e?e:this.attribute.fontSize||s.fontSize;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){let t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(p/2),this._AABBBounds}let _=new mI(a,{fontSize:h,fontWeight:g,fontFamily:a},ru.graphicUtil.textMeasure),w=t.map(t=>t.toString()),A=[],S=[0,0],E=1/0;if(v>0&&(E=Math.max(Math.floor(v/x),1)),y&&(E=Math.min(E,y)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)}),S[0]=t}else{let t,e,i=0;for(let r=0,n=w.length;rq&&(th=q)),ey(J)&&tdQ&&(td=Q)),tn.attribute.width=th,tn.attribute.height=td,tn.attribute.boundsPadding=tr,this._mainTitle){if(ey(tt)||ey(W.align)){let t=W.align?W.align:tt,e=null!==(F=W.width)&&void 0!==F?F:ta;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(ey(te)||ey(W.verticalAlign)){let t=W.verticalAlign?W.verticalAlign:te,e=W.height?W.height:td;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(ey(tt)||ey($.align)){let t=$.align?$.align:tt,e=null!==(z=$.width)&&void 0!==z?z:tl;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(ey(te)||ey(W.verticalAlign)){let t=$.verticalAlign?$.verticalAlign:te,e=null!==(H=$.height)&&void 0!==H?H:0;"top"===t?(this._subTitle.setAttribute("y",ts),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",ts+e/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",ts+e),this._subTitle.setAttribute("textBaseline","bottom"))}}}}xd.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};let xu=(t,e,i,r)=>{var n;let s=null===(n=null==i?void 0:i.components)||void 0===n?void 0:n.title,a={};return ey(t)&&(a.text=t),ey(e)&&(a.subtext=e),lE({},s,a,null!=r?r:{})};class xc extends uI{constructor(t,e){super(t,tz.title,e),this.spec.componentType=tz.title}parseAddition(t){return super.parseAddition(t),this.title(t.title),this.subTitle(t.subTitle),this}title(t){return this.setFunctionSpec(t,"title")}subTitle(t){return this.setFunctionSpec(t,"subTitle")}_updateComponentEncoders(){let t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce((e,i)=>{let r=t[i];return r&&(e[i]={callback:(t,e,i)=>{let n=this.spec.skipTheme?null:this.view.getCurrentTheme(),s=lt(this.spec.title,i,t,e),a=lt(this.spec.subTitle,i,t,e);return xu(s,a,n,du(r,t,e,i))}}),e},{});this._encoders=e}}xc.componentType=tz.title;function xp(t,e){let i="";return 0===t.length||(t.forEach((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`}),e&&(i+="Z")),i}function xf(t,e,i,r){let n="";if(!t||0===e.length)return n;let s=e[0],a=ix.distancePP(t,s),o=i?0:1;return r?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`}),n}class xg extends pC{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&m0(this._innerView),this.removeAllChild(!0),this._innerView=as.group({x:0,y:0,pickable:!1}),this.add(this._innerView);let{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){let r=this.getVerticalVector(e,i,t);return{x:t.x+r[0],y:t.y+r[1]}}_transformItems(t){let e=[];return t.forEach(t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))}),e}_renderGrid(t){let{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){let i=lE({},this.attribute,this.getGridAttribute(t)),{type:r,items:n,style:s,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${t5.grid}-sub`:`${t5.grid}`;if(n.forEach((t,i)=>{let{id:n,points:o}=t,d="";if("line"===r||"polygon"===r)d=xp(o,!!a);else if("circle"===r){let{center:t}=this.attribute;d=xf(t,o,!1,!!a)}let u=as.path(Object.assign({path:d,z:l},r6(s)?lE({},this.skipDefault?null:xg.defaultAttributes.style,s(t,i)):s));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)}),l&&"line"===r&&n.forEach((t,i)=>{let{id:r,points:n}=t,o=[];o.push(n[0]);let d=n[1].x-n[0].x,u=n[1].y-n[0].y,c=l/Math.sqrt(d*d+u*u);o.push({x:n[0].x+d*c,y:n[0].y+u*c});let p=xp(o,!!a),f=(0,eJ.Wn)(o[0].x-o[1].x),g=(0,eJ.Wn)(o[0].y-o[1].y),m=as.path(Object.assign({path:p,z:0,alpha:f>g?(n[1].x-n[0].x>0?-1:1)*eJ.pi/2:0,beta:fg?[o[0].x,0]:[0,o[0].y]},r6(s)?lE({},this.skipDefault?null:xg.defaultAttributes.style,s(t,i)):s));m.name=`${h}-line`,m.id=this._getNodeId(`${h}-path-${r}`),e.add(m)}),n.length>1&&o){let t=(0,ev.Z)(o)?o:[o,"transparent"],r=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let s=[];if(t){e=lE({},this.attribute,this.attribute.subGrid);let t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){let e=[];this.data.forEach(t=>{let i=t.value;if(!r){let e=t.value-n/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})});for(let r=0;r{let{point:s}=e;if(!r){let t=e.value-n/2;if(this.isInValidValue(t))return;s=this.getTickCoord(t)}t.push({id:e.label,datum:e,points:this._getGridPoint(i,s)})}),s=t}return Object.assign(Object.assign({},e),{items:s})}}cI(xm,vt);var xv=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);ne.indexOf(r[n])&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};pk(),vM();class xb extends xg{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},xg.defaultAttributes,t),e)}getGridAttribute(t){let e,i=[],r=this.attribute,{radius:n,innerRadius:s=0,startAngle:a=gG,endAngle:o=gU,center:l,subGrid:h}=r,d=xv(r,["radius","innerRadius","startAngle","endAngle","center","subGrid"]),{alignWithLabel:u=!0}=d||{},c=n-s,p=1;if(this.data.length>=2&&(p=this.data[1].value-this.data[0].value),t){e=lE({},d,h);let t=[],{count:r=4}=h||{},n=this.data.length;if(n>=2){let e=[];this.data.forEach(t=>{let i=t.value;if(!u){let e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})});for(let i=0;i{let{point:i}=e;if(!u){let t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}let r=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,r],datum:e})}),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}cI(xb,vO);let xy=(t,e,i,r)=>{var n,s,a,o;let l=null!==(s=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==s?s:{};return t?lE({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,r))&&void 0!==o?o:[]).map(t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick}))},null!=i?i:{}):lE({},l,null!=i?i:{})},xx=(t,e,i,r)=>{var n,s,a,o;let l=null!==(s=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==s?s:{};return t?lE({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,r))&&void 0!==o?o:[]).map(t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick}))},null!=i?i:{}):lE({},l,null!=i?i:{})};class x_ extends vD{constructor(t,e,i){super(t,tz.grid,e),this.spec.componentType=tz.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){let t=(0,eT.Z)(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;let e=(0,eT.Z)(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){let e=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){let i=lE({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),r=ld.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,r)}_updateComponentEncoders(){let t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce((e,i)=>{let r=t[i];return r&&(e[i]={callback:(t,e,i)=>{var n,s,a,o;let l=this.spec.skipTheme?null:this.view.getCurrentTheme(),h,d=du(r,t,e,i),u=lt(this.spec.baseValue,i,t,e);if(this._targetAxis){let t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=(0,eT.Z)(t)?this.view.getScaleById(t):t;let e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case tU.lineAxisGrid:d=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(s=e.getGraphicAttribute("verticalFactor"))&&void 0!==s?s:1},d);break;case tU.circleAxisGrid:d=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},d)}}else{h=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;let r=lt(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(d=Object.assign(vF(h,n,r,u,this.spec.layout,!0),d))}this._getGridComponentType()===tU.lineAxisGrid&&(d="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:d.start,closed:!0},d,{type:this.spec.gridShape}):Object.assign({},d,{type:"line"}));let c=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=lt(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case tU.lineAxisGrid:return xy(c,l,d,p);case tU.circleAxisGrid:return xx(c,l,d,p)}return d}}),e},{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=tU.circleAxisGrid:this._gridComponentType=tU.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case tG.circleAxis:this._gridComponentType=tU.circleAxisGrid;break;case tG.lineAxis:default:this._gridComponentType=tU.lineAxisGrid}else if(this.spec.scale){let e=(0,eT.Z)(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?tU.lineAxisGrid:tU.circleAxisGrid:tU.lineAxisGrid}else this._gridComponentType=tU.lineAxisGrid;return this._gridComponentType}}x_.componentType=tz.grid;class xw extends bY{constructor(t,e){super(t,e),this.type=xw.type,this.options=Object.assign({},xw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.source).filter(t=>t.markType===tF.component&&"scrollbar"===t.componentType),this._data=(0,eT.Z)(this.options.target.data)?t.getDataById(this.options.target.data):this.options.target.data}getEvents(){if(!this._marks||0===this._marks.length)return[];let t=this._marks[0];if(!this._data||!t)return[];let e=this.options.target.filter,i=this.options.target.transform,r=(0,eT.Z)(e)?(i,r)=>{let n=t.getScale().getScale(),s=n.range(),a=(n.scale(i[e])-s[0])/(s[s.length-1]-s[0]);return r.startRatio<=a&&r.endRatio>=a}:e;return this._filterData(this._data,t,tH.scrollbar,i=>{if((0,eT.Z)(e)){let e=i.detail.value,r=t.getScale();if(r){let t=r.getScale(),i=t.range();return{start:t.invert(e[0]*(i[1]-i[0])+i[0]),end:t.invert(e[1]*(i[1]-i[0])+i[0]),startRatio:e[0],endRatio:e[1]}}return{startRatio:e[0],endRatio:e[1]}}return{startRatio:i.detail.value[0],endRatio:i.detail.value[1]}},r,i),[{type:"scrollUp",handler:this.handleFilter},{type:"scrollDrag",handler:this.handleFilter}]}}function xA(t){return"horizontal"===t}xw.type="scrollbar-filter",xw.defaultOptions={};function xS(t){return"vertical"===t||"horizontal"===t}function xE(t){return"top"===t||"bottom"===t||"left"===t||"right"===t}function xT(t){return"top"===t||"bottom"===t}let xC=(t,e,i,r,n)=>{var s,a,o,l,h;let d=null===(s=null==r?void 0:r.components)||void 0===s?void 0:s.scrollbar,u="horizontal",c="bottom";xS(e)||xE(i)?!xS(e)&&xE(i)?(u=xT(i)?"horizontal":"vertical",c=i):xS(e)&&!xE(i)?(u=e,c=xA(e)?"bottom":"right"):(u=e,c=xA(e)&&!xT(i)?"bottom":"vertical"===e&&xT(i)?"right":i):(u="horizontal",c="bottom");let p={direction:u};if(xA(u)){let e=null!==(o=null!==(a=n.height)&&void 0!==a?a:null==d?void 0:d.height)&&void 0!==o?o:12;"top"===c?Object.assign(p,{width:t.width,height:e,x:0,y:0}):Object.assign(p,{width:t.width,height:e,x:0,y:t.height-e})}else{let e=null!==(h=null!==(l=n.width)&&void 0!==l?l:null==d?void 0:d.width)&&void 0!==h?h:12;"left"===c?Object.assign(p,{width:e,height:t.height,x:0,y:0}):Object.assign(p,{width:e,height:t.height,x:t.width-e,y:0})}return lE({},d,p,null!=n?n:{})};class xk extends vD{constructor(t,e){super(t,tz.scrollbar,e),this.spec.componentType=tz.scrollbar}parseAddition(t){return super.parseAddition(t),this.container(t.container),this.direction(t.direction),this.position(t.position),this}container(t){if(this.spec.container){let t=(0,eT.Z)(this.spec.container)?this.view.getMarkById(this.spec.container):this.spec.container;this.detach(t)}if(this.spec.container=t,t){let e=(0,eT.Z)(t)?this.view.getMarkById(t):t;this.attach(e)}return this.commit(),this}direction(t){return this.setFunctionSpec(t,"direction")}position(t){return this.setFunctionSpec(t,"position")}setScrollStart(t){var e;let i=this.getGroupGraphicItem(),r=null===(e=null==i?void 0:i.attribute)||void 0===e?void 0:e.range;if(i&&r){let e=[t,r[1]-r[0]+t];i.setScrollRange(e)}return this}getScrollRange(){let t=this.getGroupGraphicItem();if(t)return t.getScrollRange()}addGraphicItem(t,e){let i=lE({range:[0,1]},t),r=ld.createGraphicComponent(tz.scrollbar,i,{skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,r)}_updateComponentEncoders(){let t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce((e,i)=>{let r=t[i];return r&&(e[i]={callback:(t,e,i)=>{var n,s;let a=this.spec.skipTheme?null:this.view.getCurrentTheme(),o=lt(this.spec.direction,i,t,e),l=lt(this.spec.position,i,t,e),h=du(r,t,e,i),d=this.spec.container?(0,eT.Z)(this.spec.container)?this.view.getMarkById(this.spec.container):this.spec.container:null,u=(d&&d.markType===tF.group?d:this.group).getGroupGraphicItem();return xC(u?{width:null!==(n=u.attribute.width)&&void 0!==n?n:u.AABBBounds.width(),height:null!==(s=u.attribute.height)&&void 0!==s?s:u.AABBBounds.height()}:{width:this.view.width(),height:this.view.height()},o,l,a,h)}}),e},{});this._encoders=e}}xk.componentType=tz.scrollbar;let xM=(t,e)=>{if(!e||0===e.length)return e;let{extent:i,step:r}=t,n=ey(t.bins)?Math.max(t.bins,1):10,s=i[1]-i[0],a=ey(r)?r:s/n;return e.map(e=>{var r,n,s,o;let l=Object.assign({},e),h=Math.floor((e[t.field]-i[0])/a),d=i[0]+h*a,u=Math.min(i[1],i[0]+(h+1)*a);return l[null!==(n=null===(r=t.as)||void 0===r?void 0:r[0])&&void 0!==n?n:"binStart"]=d,l[null!==(o=null===(s=t.as)||void 0===s?void 0:s[1])&&void 0!==o?o:"binEnd"]=u,l})},xB=(t,e,i,r,n,s)=>{let a=[i[0]>=s?1:0,i[1]>=s?1:0,i[2]>=s?1:0,i[3]>=s?1:0],o=[];a[0]!==a[1]&&o.push({id:`${t}-${e-1}-${t}-${e}`,currentCell:e*n+t,nextCell:(e-1)*n+t,point:{x:t+(s-i[0])/(i[1]-i[0]),y:e},siblingPoint:null}),a[1]!==a[2]&&o.push({id:`${t}-${e}-${t+1}-${e}`,currentCell:e*n+t,nextCell:e*n+t+1,point:{x:t+1,y:e+(s-i[1])/(i[2]-i[1])},siblingPoint:null}),a[2]!==a[3]&&o.push({id:`${t}-${e}-${t}-${e+1}`,currentCell:e*n+t,nextCell:(e+1)*n+t,point:{x:t+(s-i[3])/(i[2]-i[3]),y:e+1},siblingPoint:null}),a[3]!==a[0]&&o.push({id:`${t-1}-${e}-${t}-${e}`,currentCell:e*n+t,nextCell:e*n+t-1,point:{x:t,y:e+(s-i[0])/(i[3]-i[0])},siblingPoint:null});let l=(8&a[0])+(4&a[1])+(2&a[2])+(1&a[3]);return 6===l||9===l?(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0],o[2].siblingPoint=o[3],o[3].siblingPoint=o[2]):2===o.length&&(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0]),o},xP=(t,e)=>{let i=t.siblingPoint,r=xR(t,e);return"loop"===r.result?r.points:xR(i,e).points.reverse().concat(r.points)},xR=(t,e)=>{let i=[t],r=t,n=t=>t.id===r.id,s="break";do{let t=e[r.nextCell],a=null==t?void 0:t.find(n);if(a){if(r=a.siblingPoint,i.includes(r)){s="loop",i.push(r);break}if(!r)break;i.push(r)}else r=null}while(r);return{points:i,result:s}},xO=(t,e)=>{var i;if(!e||0===e.length)return e;let r=t.row,n=t.column,s=r-1,a=n-1,o=e.map(e=>e[t.field]),l=[eA(o),ew(o)],h=null!==(i=t.thresholds)&&void 0!==i?i:[];if(!ey(t.thresholds)&&(0,ef.Z)(t.levels)){let e=(l[1]-l[0])/t.levels;for(let i=1;i{var i,o;let l=[],h=[];for(let t=0;tt.id);c=c.filter(t=>!a.includes(t.id));let l={[null!==(i=t.asThreshold)&&void 0!==i?i:"threshold"]:e,[null!==(o=t.asPoints)&&void 0!==o?o:"points"]:s.map(t=>({x:t.point.x/r,y:t.point.y/n}))};u.push(l)}}while(c.length>0)}),u},xI=(t,e)=>{if((te||(0,eC.Z)(e))&&!(0,eC.Z)(t))return 1;let i=e instanceof Date?+e:e,r=t instanceof Date?+t:t;return Number.isNaN(r)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(r)?1:0},xL=(t,e,i)=>(e.push(0),(r,n)=>{let s,a=0,o=-1;for(;0===a&&o+1{var i,r;return 1===t.length?(i=t[0],r=e[0],(t,e)=>xI(i(t),i(e))*r):xL(t,e,t.length)},xN=(t,e,i={})=>{let r=ex(e)||[],n=[],s=[],a={},o=i.comparator||xD;return ex(t).forEach((t,e)=>{var o;if((0,eC.Z)(t))return;n.push("desc"===r[e]?-1:1);let l=r6(t)?t:l0(t,null,i);s.push(l),(o=l,((0,eC.Z)(o)?null:o.fields)||[]).forEach(t=>{a[t]=1})}),0===s.length?null:lY(o(s,n),Object.keys(a))},xj=(t,e)=>{let i=t.sort;if(i&&e){let t=r6(i)?i:xN(i.field,i.order);e.sort((e,i)=>t(e,i))}return e},xF=(t,e,i)=>e.filter(e=>t.callback(e,i)),xz=(t,e,i)=>{let r=t.callback,n=t.as;if(!t.all)return e.forEach(t=>{let e=r(t,i);if(!(0,eC.Z)(n)){if((0,eC.Z)(t))return;t[n]=e}return e}),e;let s=r(e,i);return(0,eC.Z)(n)||(0,eC.Z)(e)?s:(e[n]=s,e)},xH=["x","kde"],xG=["x","y","kde"],xU=Math.sqrt(2*Math.PI),xV=Math.sqrt((2*Math.PI)**2),xW=(t,e=1)=>Math.exp(-(t**2)/2)/(1===e?xU:2===e?xV:Math.sqrt((2*Math.PI)**e)),xZ=(t,e=1)=>{let i=t.length,r=t.reduce((t,e)=>t+e.x,0)/i,n=Math.sqrt(t.reduce((t,e)=>t+(e.x-r)**2,0)/i),s=t.sort((t,e)=>t.x-e.x).map(t=>t.x),a=cH(s,.25);return .9*Math.min(n,(cH(s,.75)-a)/1.34)*i**-.2},x$=(t,e=1)=>t.length**(-1/(e+4)),xY=(t,e,i)=>{let r=e.length;return e.reduce((e,r)=>e+xW(Math.abs(t.x-r.x)/i,1),0)/(r*i)},xX=(t,e,i)=>{let r=e.length;return e.reduce((e,r)=>e+xW(ix.distancePP(t,r)/i**2,1),0)/(r*i**2)},xK=(t,e)=>{var i,r,n,s,a,o,l,h,d,u,c,p,f,g,m,v,b,y,x,_,w;if(!e||0===e.length)return e;let A=null!==(i=t.dimension)&&void 0!==i?i:"1d",S=ex(t.field),E=ex(null!==(r=t.bins)&&void 0!==r?r:256),T=ex(t.as);if("1d"===A){let i=e.map(t=>({x:t[S[0]]})),r=null!==(n=t.bandwidth)&&void 0!==n?n:xZ(i),u=i.reduce((t,e)=>Math.min(t,e.x),i[0].x),c=i.reduce((t,e)=>Math.max(t,e.x),i[0].x),p=null!==(a=null===(s=t.extent)||void 0===s?void 0:s[0])&&void 0!==a?a:u,f=null!==(l=null===(o=t.extent)||void 0===o?void 0:o[1])&&void 0!==l?l:c,g=[(0,ib.Z)(p)?p:null!==(h=p.x)&&void 0!==h?h:u,(0,ib.Z)(f)?f:null!==(d=f.x)&&void 0!==d?d:c],m=(g[1]-g[0])/E[0];return Array(E[0]).fill(0).map((t,e)=>{var n,s;let a=Math.min(g[0]+m*(e+.5),g[1]);return{[null!==(n=T[0])&&void 0!==n?n:"x"]:a,[null!==(s=T[1])&&void 0!==s?s:"x"]:xY({x:a},i,r)}})}if("2d"===A){let i=e.map(t=>({x:t[S[0]],y:t[S[1]]})),r=t.bandwidth||x$(i,2),n=i.reduce((t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)}),i[0]),s=i.reduce((t,e)=>({x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)}),i[0]),a=null!==(c=null===(u=t.extent)||void 0===u?void 0:u[0])&&void 0!==c?c:n,o=null!==(f=null===(p=t.extent)||void 0===p?void 0:p[1])&&void 0!==f?f:s,l=[(0,ib.Z)(a)?{x:a,y:a}:{x:null!==(g=a.x)&&void 0!==g?g:n.x,y:null!==(m=a.y)&&void 0!==m?m:n.y},(0,ib.Z)(o)?{x:o,y:o}:{x:null!==(v=o.x)&&void 0!==v?v:s.x,y:null!==(b=o.y)&&void 0!==b?b:s.y}],h=E[0],d=null!==(y=E[1])&&void 0!==y?y:E[0],A=(l[1].x-l[0].x)/h,C=(l[1].y-l[0].y)/d,k=[];for(let t=0;t{let i=ek.Y.getInstance(),r=t.as,{fields:n,from:s,key:a,values:o}=t,l=l0(a),h=(s||[]).reduce((t,e)=>(t[l(e)]=e,t),{}),d=(0,eC.Z)(t.default)?null:t.default,u=n.map(t=>l0(t));if(o){n.length>1&&!r&&i.error('Multi-field lookup requires explicit "as" parameter.'),r&&r.length!==n.length*o.length&&i.error('The "as" parameter has too few output field names.'),(0,eC.Z)(r)&&(r=o);let t=o.map(t=>l0(t));return e.map(e=>u.reduce((i,n,s)=>{let a=h[n(e)],l=o.length;return((0,eC.Z)(a)?t.map(t=>d):t.map(t=>t(a))).reduce((t,e,i)=>(t[r[s*l+i]]=e,t),i)},e))}return r||i.error("Missing output field names."),e.map(t=>u.reduce((e,i,n)=>{let s=h[i(t)];return e[r[n]]=(0,eC.Z)(s)?d:s,e},t))};function xJ(t){return t.reduce((t,e)=>t+e,0)}let xQ=(t,e)=>{var i,r;let{fields:n=[]}=t,s=(i=n,r=t.as||[],i?i.map((t,e)=>{var i,n;return null!==(i=r[e])&&void 0!==i?i:(0,eT.Z)(t)?t:(n=t,(0,eC.Z)(n)?null:n.fname)}):null),a=n.map(t=>(0,eT.Z)(t)?l0(t):t);return a.length?e.map((t,e)=>{var i,r,n;return i=t,r=a,n=s,r.reduce((t,e,r)=>(t[n[r]]=e(i),t),{})}):e.map((t,e)=>({}))},x0=t=>{let{start:e,stop:i,step:r=1,as:n="data"}=t;return cn(e,i,r).map(t=>({[n]:t}))},x1=(t,e)=>{var i;let r=new Map,n=new Map,s=null!==(i=t.offset)&&void 0!==i?i:"diverging";return e.map(e=>{var i;let a=e[t.dimensionField],o="diverging"===s?e[t.stackField]:Math.abs(e[t.stackField]),l=o>=0?r:n,h=null!==(i=l.get(a))&&void 0!==i?i:0,d=o+h;return l.set(a,d),{dimension:a,value:o,stack:d,prevStack:h,datum:e}})},x2=(t,e)=>{if(!e||0===e.length)return e;let i=dA(e,l0("dimension"));return i.keys.forEach(t=>{let e=i.data.get(t);if(!e||e.length<=0)return 0;let r=-e.reduce((t,e)=>t+e.value,0)/2;e.forEach(t=>{t.stack=t.stack+r,t.prevStack=t.prevStack+r})}),e},x5=(t,e)=>{if(!e||0===e.length)return e;let i=dA(e,l0("dimension"));return i.keys.forEach(t=>{let e=i.data.get(t);if(!e||e.length<=0)return 0;let r=e.length,n=-1/(r+1)*e.reduce((t,e,i)=>e.value*(r-i+1),0);e.forEach(t=>{t.stack=t.stack+n,t.prevStack=t.prevStack+n})}),e},x3=(t,e)=>{if(!(t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum))return e.map(e=>{var i;let{stack:r,prevStack:n,datum:s}=e,a=Object.assign({},s);return a[null!==(i=t.asStack)&&void 0!==i?i:t.stackField]=r,t.asPrevStack&&(a[t.asPrevStack]=n),a});let i=new Map,r=new Map;return e.forEach(t=>{var e;let{dimension:n,value:s}=t,a=s>=0?i:r;a.set(n,(null!==(e=a.get(n))&&void 0!==e?e:0)+s)}),e.map(e=>{var n,s;let{dimension:a,value:o,stack:l,prevStack:h,datum:d}=e,u=Object.assign({},d),c=null!==(n=(o>=0?i:r).get(a))&&void 0!==n?n:0;return u[null!==(s=t.asStack)&&void 0!==s?s:t.stackField]=l,t.asPrevStack&&(u[t.asPrevStack]=h),t.asSum&&(u[t.asSum]=c),t.asPercent&&(u[t.asPercent]=0===c?0:o/c),t.asPercentStack&&(u[t.asPercentStack]=0===c?0:l/c),t.asPrevPercentStack&&(u[t.asPrevPercentStack]=0===c?0:h/c),u})},x4=(t,e)=>{var i;let r=null!==(i=t.offset)&&void 0!==i?i:"diverging",n="negative"===t.order?e.slice().reverse():e,s=x1(t,n);"silhouette"===r?x2(0,s):"wiggle"===r&&x5(0,s);let a=x3(t,s);return"negative"===t.order?a.reverse():a},x6=(t,e)=>{if(!e||!e.length)return[];let{fields:i,asKey:r="key",asValue:n="value",retains:s}=t,a=[];for(let t=0,o=e.length;t{let e={};if(s)s.forEach(t=>{e[t]=o[t]});else for(let t in o)-1===i.indexOf(t)&&(e[t]=o[t]);e[r]=t,e[n]=o[t],a.push(e)})}return a},x8={sum:t=>t.reduce((t,e)=>t+e,0),min:t=>eA(t),max:t=>ew(t),count:t=>t.length,mean:t=>t.reduce((t,e)=>t+e,0)/t.length},x7=(t,e)=>{var i;if(!e||!e.length)return[];let r=[],n={},s=t.keyField,a=t.valueField,o=x8[null!==(i=t.aggregateType)&&void 0!==i?i:"sum"];if(t.groupBy){let i=ex(t.groupBy);e.forEach(t=>{if(!t)return;let e={},r=[];i.forEach(i=>{e[i]=t[i],r.push(t[i])});let o=r.join("~");n[o]?n[o].values[t[s]]?n[o].values[t[s]].push(t[a]):n[o].values[t[s]]=[t[a]]:n[o]={datum:e,values:{[t[s]]:[t[a]]}}})}else n[0]={datum:{},values:{}},e.forEach(t=>{t&&(n[0].values[t[s]]?n[0].values[t[s]].push(t[a]):n[0].values[t[s]]=[t[a]])});return Object.keys(n).forEach(t=>{let e=n[t].datum,i=n[t].values;Object.keys(i).forEach(t=>{let r=i[t];e[t]=o(r)}),r.push(e)}),r},x9=(t,e)=>{var i,r;let{field:n,asTransformRatio:s,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:d,asLastValue:u,asCurrentValue:c,asNextValue:p,heightVisual:f=!1,isCone:g=!0,range:m}=t,v=e.reduce((t,e)=>Math.max(t,Number.parseFloat(e[n])||-Infinity),-Infinity),b=e.reduce((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0),1/0),y=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:b,null!==(r=null==m?void 0:m.max)&&void 0!==r?r:v];return e.map((t,i)=>{var r,m;let v=Object.assign({},t),b=Number.parseFloat(v[n]),x=Number.parseFloat(null===(r=e[i-1])||void 0===r?void 0:r[n]),_=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[n]),w=(0,ef.Z)(_*b)?_/b:null,A=(0,ef.Z)(b*b)?b/x:null;return u&&(v[u]=x),p&&(v[p]=_),s&&(v[s]=w),a&&(v[a]=0===i?1:A),o&&(v[o]=!0===f?w:1/e.length),l&&(v[l]=b/y[1]),h&&(v[h]=i===e.length-1?g?0:v[l]:_/y[1]),d&&(v[d]=0===i?1:x/y[1]),c&&(v[c]=b),v})},_t=(t,e)=>{var i,r;if(!e||0===e.length)return e;let n=t.field,s=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(r=t.endAngle)&&void 0!==r?r:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:d,asRatio:u,asQuadrant:c,asK:p}=t,f=e.reduce((t,e)=>Number.parseFloat(e[n])+t,0),g=e.reduce((t,e)=>Math.max(t,Number.parseFloat(e[n])),-Infinity),m=a-s,v=s,b=e.map(t=>{var e;let i=Object.assign({},t),r=Number.parseFloat(i[n])/f,s=r*m;return u&&(i[u]=r),o&&(i[o]=v),l&&(i[l]=v+s),h&&(i[h]=v+s/2),d&&(i[d]=s),c&&(i[c]=(e=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(e=v+s/2))>0&&e<=Math.PI/2?2:e>Math.PI/2&&e<=Math.PI?3:e>Math.PI&&e<=3*Math.PI/2?4:1),p&&(i[p]=Number.parseFloat(i[n])/g),v=i[l],i});return b[b.length-1][l]=a,b},_e=t=>"width"in t?{x0:0,x1:t.width,y0:0,y1:t.height,width:t.width,height:t.height}:{x0:Math.min(t.x0,t.x1),x1:Math.max(t.x0,t.x1),y0:Math.min(t.y0,t.y1),y1:Math.max(t.y0,t.y1),width:Math.abs(t.x1-t.x0),height:Math.abs(t.y1-t.y0)},_i=(t,e)=>{let i,r;let n=r6(e)?e:t=>t;if(t&&t.length){let e=t.length;for(let s=0;s{var i,r,n,s,a,o,l,h,d,u,c,p,f,g,m;if(!e||0===e.length)return[];let v=_e(t),b=null!==(i=t.startAngle)&&void 0!==i?i:0,y=null!==(r=t.endAngle)&&void 0!==r?r:2*Math.PI,x=Math.max(v.width/2,v.height/2),_=dW(null!==(n=t.innerRadius)&&void 0!==n?n:0,x),w=dW(t.outerRadius,x),A=[(0,ib.Z)(null===(s=t.center)||void 0===s?void 0:s[0])?t.center[0]:v.x0+dW(null!==(o=null===(a=t.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",v.width),(0,ib.Z)(null===(l=t.center)||void 0===l?void 0:l[1])?t.center[1]:v.y0+dW(null!==(d=null===(h=t.center)||void 0===h?void 0:h[1])&&void 0!==d?d:"50%",v.height)],S=l0(t.field),E=e.map(S),[T,C]=_i(E),k=T===C?t=>(_+w)/2:t=>_+(w-_)*(t-T)/(C-T),M=(0,eC.Z)(t.radiusField)?S:l0(t.radiusField),B=null!==(c=null===(u=null==t?void 0:t.radiusRange)||void 0===u?void 0:u[1])&&void 0!==c?c:5,P=t=>B;if(M){let[i,r]=M!==S?_i(e.map(M)):[T,C],n=null!==(f=null===(p=t.radiusRange)||void 0===p?void 0:p[0])&&void 0!==f?f:5,s=null!==(m=null===(g=t.radiusRange)||void 0===g?void 0:g[1])&&void 0!==m?m:5;i!==r&&(P=t=>n+(s-n)*(M(t)-i)/(r-i))}let R=Math.min(b,y),O=Math.max(b,y),I=_n(R,O,e.length),L=[],D=(O-R)/60;return e.forEach((t,e)=>{let i=k(E[e]),r=P(t),n,s,a=I[e];for(let t=0;t<60&&(n=A[0]+i*Math.cos(a),_s({x:n,y:s=A[1]+i*Math.sin(a),radius:r},L)||n-rv.x1||s-rv.y1);t++)t<59&&((a+=D)>O?a=R:a{let r=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),s=(e-t)/n,a=0,o=1,l=0,h=0,d=[],u=t;for(;l=2&&(s/=2,n*=2));return d},_s=(t,e)=>!(!e||!e.length)&&e.some(e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)o&&(o=l,h=t)}s[u++]=h,d=h}return s[u-1]!==a-1&&(s[u++]=a-1),s.map(t=>i?e[t].i:t)}function _l(t,e,i,r,n){let s=Math.floor(e.length/t),a=[],o=e.length,l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(s=o-t,h.length=s),h=[];for(let i=0;ii?e[t].i:t)}function _h(t,e,i,r){return _l(t,e,i,"min",r)}function _d(t,e,i,r){return _l(t,e,i,"max",r)}function _u(t,e,i,r){return _l(t,e,i,"average",r)}function _c(t,e,i,r){return _l(t,e,i,"sum",r)}let _p=(t,e)=>{let i=t.size,r=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),(i*=r)<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);let{mode:n,yfield:s,groupBy:a}=t,o=null!=s?s:"y",l=_o;if("min"===n?l=_h:"max"===n?l=_d:"average"===n?l=_u:"sum"===n&&(l=_c),e.length){let t={};if(a){for(let i=0,r=e.length;i{let s=t[n];if(s.length<=i){let t=s.map(t=>t.i);r=r.concat(t)}else{let t=l(i,s,!0,o);r=r.concat(t),s.forEach(t=>e[t.i][o]=t[o])}}),r.sort((t,e)=>t-e),r.map(t=>e[t])}return l(i,e,!1,o).map(t=>e[t])}return[]},_f="_mo_hide_",_g=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;(0,eC.Z)(i)&&"symbol"===e[0].mark.markType&&(i=!0);let{direction:r,delta:n,deltaMul:s=1,groupBy:a}=t,o=e=>{var a;(a=e).forEach(t=>{t.getGraphicAttribute(_f)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(_f,!1))});let o=t.sort?e.slice().sort((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")):e;0===r?function(t,e,i,r){if(r){let r=-Infinity,n=-Infinity,s=0,a=0,o=(0,eC.Z)(e),l=e;t.forEach(t=>{if(!1===t.getGraphicAttribute("visible"))return;let e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),d=t.getGraphicAttribute("y");o&&(l=(e+s)*i),(a=(r-h)**2+(n-d)**2)<(l+s+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(_f,!0),t.setGraphicAttribute("visible",!1)):n=d,s=e})}}(o,n,s,i):1===r?function(t,e,i,r){if(r){let r=-Infinity,n=0,s=(0,eC.Z)(e),a=e;t.forEach(t=>{if(!1===t.getGraphicAttribute("visible"))return;let e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");s&&(a=(e+n)*i),Math.abs(o-r){if(!1===t.getGraphicAttribute("visible"))return;let e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");s&&(a=(e+n)*i),Math.abs(o-r){let i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t},{});Object.keys(t).forEach(e=>{o(t[e])})}else o(e);return e},_m=":vGrammar_identifier:",_v=(t,e,i,r)=>{(0,eC.Z)(r[_m])&&(r[_m]=0);let n=r[_m],s=t.as;return e.forEach(t=>{t&&(0,eC.Z)(t[s])&&(n+=1,t[s]=n)}),r[_m]=n,n},_b=(t,e)=>{var i,r,n;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;let s=e[0].mark,a=Object.values(s.getScales()).find(px);if(!a)return e;let o=s.getScalesByChannel(),l=p_(a),h=(0,eC.Z)(t.dodgeChannel)?o.y===a||o.y1===a||o.x&&!px(o.x)||o.x1&&!px(o.x1)?"y":"x":t.dodgeChannel;if(l>0){let i=null!==(r=t.innerGap)&&void 0!==r?r:0,a=null!==(n=t.categoryGap)&&void 0!==n?n:"20%",o=t=>t.groupKey;if(!(0,eC.Z)(t.dodgeBy)){let e=lK(ex(t.dodgeBy));o=t=>e(t.getDatum())}let d=[];e.forEach(t=>{let e=o(t);d.includes(e)||d.push(e)});let u=d.length;if(u<1)return e;let c=dW(a,l),p=c>=l?l:l-c,f=dW(i,p),g=(p-Math.max(u-1,0)*f)/u;g>t.maxWidth?(p-=(g-t.maxWidth)*u,g=t.maxWidth):g{m[t]=-p/2+e*(g+f)});let v=s.markType;"rect"===v||"interval"===v||"arc"===v?e.forEach(t=>{let e=m[o(t)],i=t.getItemAttribute();if("x"===h){let r={x:((0,eC.Z)(i.width)&&!(0,eC.Z)(i.x1)?Math.min(i.x,i.x1):i.x)+((0,eC.Z)(i.width)?(0,eC.Z)(i.x1)?l:Math.abs(i.x1-i.x):i.width)/2+e};(0,eC.Z)(i.width)?r.x1=r.x+g:r.width=g,t.setItemAttributes(r)}else if("y"===h){let r={y:((0,eC.Z)(i.height)&&!(0,eC.Z)(i.y1)?Math.min(i.y,i.y1):i.y)+((0,eC.Z)(i.height)?(0,eC.Z)(i.y1)?l:Math.abs(i.y1-i.y):i.height)/2+e};(0,eC.Z)(i.height)?r.y1=r.y+g:r.height=g,t.setItemAttributes(r)}}):e.forEach(t=>{let e=m[o(t)];if("x"===h){let i=t.getItemAttribute("x")+l/2+e+g/2;t.setItemAttributes({x:i}),"rule"===v&&t.setItemAttributes({x1:i})}else if("y"===h){let i=t.getItemAttribute("y")+l/2+e+g/2;t.setItemAttributes({y:i}),"rule"===v&&t.setItemAttributes({y1:i})}})}return e},_y=(t,e,i)=>{var r,n,s,a;let o=e[0].mark,l=null===(r=o.getScalesByChannel())||void 0===r?void 0:r[i],h=null!==(n=t.random)&&void 0!==n?n:Math.random,d=Math.min(null!==(s="x"===i?t.widthRatio:t.heightRatio)&&void 0!==s?s:.4,.5),u=null!==(a="x"===i?t.bandWidth:t.bandHeight)&&void 0!==a?a:p_(l);if((0,eC.Z)(u)){let t=_i(e,t=>t.getItemAttribute(i));if((0,eC.Z)(t[0])||(0,eC.Z)(t[1])||t[0]===t[1]){let e=o.view.getViewBox();t="x"===i?[e.x1,e.x2]:[e.y1,e.y2]}let r=e.length;e.forEach((e,n)=>{e.setItemAttributes({[i]:t[0]+(t[1]-t[0])*h(n,r)})})}else{let t=e.length;e.forEach((e,r)=>{let n=e.getItemAttribute(i),s=[n-d*u,n+d*u];e.setItemAttributes({[i]:s[0]+(s[1]-s[0])*h(r,t)})})}},_x=(t,e)=>{var i;return e&&0!==e.length&&(null===(i=e[0])||void 0===i?void 0:i.mark)?_y(t,e,"y"):e},__=(t,e)=>{var i;return e&&0!==e.length&&(null===(i=e[0])||void 0===i?void 0:i.mark)?_y(t,e,"x"):e},_w=(t,e)=>{var i;return e&&0!==e.length&&(null===(i=e[0])||void 0===i?void 0:i.mark)&&(_y(t,e,"x"),_y(t,e,"y")),e},_A=(t,e,i)=>{let r=`${e}1`,n=t.some(t=>!(0,eC.Z)(t.getItemAttribute(r))),s=n?t.map(t=>(t.getItemAttribute(r)+t.getItemAttribute(e))/2):t.map(t=>t.getItemAttribute(e)),a="min"===i?eA(s):ew(s);return(0,ef.Z)(a)&&t.forEach((t,i)=>{let o=a-s[i];n?t.setItemAttributes({[r]:t.getItemAttribute(r)+o,[e]:t.getItemAttribute(e)+o}):t.setItemAttributes({[e]:t.getItemAttribute(e)+o})}),t},_S=(t,e)=>{var i,r;return e&&0!==e.length&&(null===(i=e[0])||void 0===i?void 0:i.mark)?_A(e,null!==(r=t.channel)&&void 0!==r?r:"y",t.align):e},_E=(t,e,i)=>{var r;let n=t.getGraphicAttribute("clipRangeByDimension",!1),s=null!==(r=t.getGraphicAttribute("clipRange",!1))&&void 0!==r?r:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:s,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:s}}},_T=(t,e,i)=>{var r;let n=t.getGraphicAttribute("clipRangeByDimension",!0),s=null!==(r=t.getGraphicAttribute("clipRange",!0))&&void 0!==r?r:1;return e&&e.clipDimension?{from:{clipRange:s,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:s},to:{clipRange:0}}},_C=(t,e,i)=>{var r,n,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(r=t.getGraphicAttribute("opacity",!1))&&void 0!==r?r:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==n?n:1,strokeOpacity:null!==(s=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==s?s:1}}},_k=(t,e,i)=>{var r,n,s;return{from:{opacity:null!==(r=t.getGraphicAttribute("opacity",!0))&&void 0!==r?r:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(s=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},_M=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{let e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);return{from:ey(r)?{x:e+r/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:r}}}case"y":{let e=t.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);return{from:ey(r)?{y:e+r/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:r}}}default:{let e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),o={};return ey(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),ey(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+s)/2,o.y1=(n+s)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:s,width:r,height:a}}}}},_B=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{let e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);return{to:ey(r)?{x:e+r/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{let e=t.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);return{to:ey(r)?{y:e+r/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{let e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),o={};return ey(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+r)/2,o.x1=(e+r)/2,o.width=void 0),ey(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}},_P=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?function(t,e,i){var r;let n;let s=t.getGraphicAttribute("x",!1),a=t.getGraphicAttribute("x1",!1),o=t.getGraphicAttribute("width",!1);return e&&"negative"===e.orient?(0,ib.Z)(e.overall)?n=e.overall:i.group?(n=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=n):n=i.width:n=(0,ib.Z)(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:n,x1:(0,eC.Z)(a)?void 0:n,width:(0,eC.Z)(o)?void 0:0},to:{x:s,x1:a,width:o}}}(t,e,i):function(t,e,i){let r=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);if(e&&"negative"===e.orient){let t=ey(s)?Math.max(r,r+s):Math.max(r,n);return{from:{x:t,x1:(0,eC.Z)(n)?void 0:t,width:(0,eC.Z)(s)?void 0:0},to:{x:r,x1:n,width:s}}}let a=ey(s)?Math.min(r,r+s):Math.min(r,n);return{from:{x:a,x1:(0,eC.Z)(n)?void 0:a,width:(0,eC.Z)(s)?void 0:0},to:{x:r,x1:n,width:s}}}(t,e,0)},_R=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?function(t,e,i){var r;let n;let s=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);return e&&"negative"===e.orient?(0,ib.Z)(e.overall)?n=e.overall:i.group?(n=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=n):n=i.width:n=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0,{to:{x:n,x1:(0,eC.Z)(s)?void 0:n,width:(0,eC.Z)(a)?void 0:0}}}(t,e,i):function(t,e,i){let r=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);if(e&&"negative"===e.orient){let t=ey(s)?Math.max(r,r+s):Math.max(r,n);return{to:{x:t,x1:(0,eC.Z)(n)?void 0:t,width:(0,eC.Z)(s)?void 0:0}}}let a=ey(s)?Math.min(r,r+s):Math.min(r,n);return{to:{x:a,x1:(0,eC.Z)(n)?void 0:a,width:(0,eC.Z)(s)?void 0:0}}}(t,e,0)},_O=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?function(t,e,i){var r;let n;let s=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("height",!1);return e&&"negative"===e.orient?(0,ib.Z)(e.overall)?n=e.overall:i.group?(n=null!==(r=i.groupHeight)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=n):n=i.height:n=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0,{from:{y:n,y1:(0,eC.Z)(a)?void 0:n,height:(0,eC.Z)(o)?void 0:0},to:{y:s,y1:a,height:o}}}(t,e,i):function(t,e,i){let r=t.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);if(e&&"negative"===e.orient){let t=ey(s)?Math.max(r,r+s):Math.max(r,n);return{from:{y:t,y1:(0,eC.Z)(n)?void 0:t,height:(0,eC.Z)(s)?void 0:0},to:{y:r,y1:n,height:s}}}let a=ey(s)?Math.min(r,r+s):Math.min(r,n);return{from:{y:a,y1:(0,eC.Z)(n)?void 0:a,height:(0,eC.Z)(s)?void 0:0},to:{y:r,y1:n,height:s}}}(t,e,0)},_I=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?function(t,e,i){var r;let n;let s=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);return e&&"negative"===e.orient?(0,ib.Z)(e.overall)?n=e.overall:i.group?(n=null!==(r=i.groupHeight)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=n):n=i.height:n=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0,{to:{y:n,y1:(0,eC.Z)(s)?void 0:n,height:(0,eC.Z)(a)?void 0:0}}}(t,e,i):function(t,e,i){let r=t.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);if(e&&"negative"===e.orient){let t=ey(s)?Math.max(r,r+s):Math.max(r,n);return{to:{y:t,y1:(0,eC.Z)(n)?void 0:t,height:(0,eC.Z)(s)?void 0:0}}}let a=ey(s)?Math.min(r,r+s):Math.min(r,n);return{to:{y:a,y1:(0,eC.Z)(n)?void 0:a,height:(0,eC.Z)(s)?void 0:0}}}(t,e,0)},_L=(t,e,i)=>e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}},_D=(t,e,i)=>{if(e&&"anticlockwise"===e.orient){let i=(0,ib.Z)(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}let r=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:r,endAngle:r},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}},_N=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?_D(t,e):_L(t,e)},_j=(t,e,i)=>e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}},_F=(t,e,i)=>{if(e&&"anticlockwise"===e.orient){let i=(0,ib.Z)(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}let r=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:r,endAngle:r}}},_z=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?_F(t,e):_j(t,e)},_H=(t,e,i)=>e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}},_G=(t,e,i)=>{let r=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:r,outerRadius:r},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}},_U=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?_G(t,e):_H(t,e)},_V=(t,e,i)=>e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}},_W=(t,e,i)=>{let r=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:r,outerRadius:r}}},_Z=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?_W(t,e):_V(t,e)},_$=(t,e,i)=>{let r=t.getGraphicAttribute("points",!1),n={x:0,y:0};return r.forEach(t=>{n.x+=t.x,n.y+=t.y}),n.x/=r.length,n.y/=r.length,e&&e.center&&((0,ef.Z)(e.center.x)&&(n.x=e.center.x),(0,ef.Z)(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),r.map(()=>Object.assign(n))},_Y=(t,e,i)=>({from:{points:_$(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),_X=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_$(t,e)}}),_K=(t,e,i)=>t.getGraphicAttribute("points",!1).map(t=>{var r;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=e),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}}),_q=(t,e,i)=>({from:{points:_K(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),_J=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_K(t,e,i)}}),_Q=(t,e,i)=>t.getGraphicAttribute("points",!1).map(t=>{var r;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(r=i.groupHeight)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=e),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}),_0=(t,e,i)=>({from:{points:_Q(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),_1=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_Q(t,e,i)}}),_2=(t,e,i)=>{var r,n;let s=null===(n=null===(r=t.mark)||void 0===r?void 0:r.coord)||void 0===n?void 0:n.output(),a=s.isTransposed(),o="polar"===s.type,l={orient:"negative",direction:a&&!o?"x":"y"};return e&&!0!==e.overall?function(t,e,i){if(e&&"x"===e.direction){let i=t.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1);return"negative"===e.orient?{from:{x:r,x1:r},to:{x:i,x1:r}}:{from:{x:i,x1:i},to:{x:i,y1:r}}}let r=t.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1);return e&&"negative"===e.orient?{from:{y:n,y1:n},to:{y:r,y1:n}}:{from:{y:r,y1:r},to:{y:r,y1:n}}}(t,l,0):function(t,e,i){var r,n;let s;if(e&&"x"===e.direction){let n;let s=t.getGraphicAttribute("x",!1),a=t.getGraphicAttribute("x1",!1);return"negative"===e.orient?(0,ib.Z)(e.overall)?n=e.overall:i.group?(n=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=n):n=i.width:n=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0,{from:{x:n,x1:n},to:{x:s,y1:a}}}let a=t.getGraphicAttribute("y",!1),o=t.getGraphicAttribute("y1",!1);return e&&"negative"===e.orient?(0,ib.Z)(e.overall)?s=e.overall:i.group?(s=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=s):s=i.height:s=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0,{from:{y:s,y1:s},to:{y:a,y1:o}}}(t,l,i)},_5=(t,e,i)=>{var r,n;let s=null===(n=null===(r=t.mark)||void 0===r?void 0:r.coord)||void 0===n?void 0:n.output(),a=s.isTransposed(),o="polar"===s.type,l={orient:"negative",direction:a&&!o?"x":"y"};return e&&!0!==e.overall?function(t,e,i){if(e&&"x"===e.direction){let i=t.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);return"negative"===e.orient?{from:{x:n,x1:s},to:{x:r,x1:r}}:{from:{x:n,x1:s},to:{x:i,x1:i}}}let r=t.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return e&&"negative"===e.orient?{from:{y:s,y1:a},to:{y:n,y1:n}}:{from:{y:s,y1:a},to:{y:r,y1:r}}}(t,l,0):function(t,e,i){var r,n;let s;if(e&&"x"===e.direction){let n;let s=t.getGraphicAttribute("x",!0),a=t.getGraphicAttribute("x1",!0);return"negative"===e.orient?(0,ib.Z)(e.overall)?n=e.overall:i.group?(n=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=n):n=i.width:n=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0,{from:{x:s,x1:a},to:{x:n,x1:n}}}let a=t.getGraphicAttribute("y",!0),o=t.getGraphicAttribute("y1",!0);return e&&"negative"===e.orient?(0,ib.Z)(e.overall)?s=e.overall:i.group?(s=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=s):s=i.height:s=(0,ib.Z)(null==e?void 0:e.overall)?e.overall:0,{from:{y:a,y1:o},to:{y:s,y1:s}}}(t,l,i)},_3=(t,e,i)=>{var r,n;let{offset:s=0,orient:a,direction:o,point:l}=null!=e?e:{},h=0,d=0;"negative"===a&&(i.group?(h=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),d=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=d):(h=i.width,d=i.height)),h+=s,d+=s;let u=r6(l)?l.call(null,t.getDatum(),t,i):l,c=u&&(0,ef.Z)(u.x)?u.x:h,p=u&&(0,ef.Z)(u.y)?u.y:d;switch(o){case"x":return{from:{x:c},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:p},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:c,y:p},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},_4=(t,e,i)=>{var r,n;let{offset:s=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,d=null!==(r=null==h?void 0:h.width())&&void 0!==r?r:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,c=r6(l)?l.call(null,t.getDatum(),t,i):l,p=c&&(0,ef.Z)(c.x)?c.x:("negative"===a?d:0)+s,f=c&&(0,ef.Z)(c.y)?c.y:("negative"===a?u:0)+s;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:p}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:p,y:f}}}},_6=(t,e,i)=>{var r,n,s,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!1))&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!1))&&void 0!==s?s:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},_8=(t,e,i)=>{var r,n,s,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},_7={symbol:["_mo_hide_","visible"]},_9=(t,e,i)=>{let r;let n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return e&&ex(e.excludeChannels).forEach(t=>{delete n[t],delete s[t]}),t.mark&&t.mark.markType&&(r=_7[t.mark.markType])&&r.forEach(t=>{delete n[t],delete s[t]}),Object.keys(s).forEach(t=>{ds(t,n,s)&&(delete n[t],delete s[t])}),{from:n,to:s}},wt=(t,e,i)=>{var r;let n=null!==(r=t.getGraphicAttribute("angle",!1))&&void 0!==r?r:0,s=0;return{from:{angle:s=dq(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:(0,ef.Z)(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2},to:{angle:n}}},we=(t,e,i)=>{var r;let n=null!==(r=t.getGraphicAttribute("angle",!0))&&void 0!==r?r:0,s=0;return s=dq(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:(0,ef.Z)(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}};class wi extends bZ{constructor(t,e){super(t,e),this.type=wi.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},wi.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector)}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}start(t){t&&this._marks&&this._marks.includes(t.mark)&&t.addState(this.options.state)}reset(t){t&&this._marks&&this._marks.includes(t.mark)&&t.removeState(this.options.state)}}wi.type="element-active",wi.defaultOptions={state:tq.active,trigger:"pointerover",triggerOff:"pointerout"};let wr=t=>t.filterField?e=>{var i;return null===(i=e.getDatum())||void 0===i?void 0:i[t.filterField]}:e=>e[t.filterType],wn=(t,e)=>{if(!e||!t)return null;let i={};return t.forEach(t=>{let r=t&&t.getSpec(),n=r&&r.encode;n&&e.forEach(e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))})}),i};class ws extends bZ{constructor(t,e){super(t,e),this.type=ws.type,this.clearPrevElements=()=>{let{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},ws.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=wn(this._marks,[this.options.state,this.options.reverseState])}getEvents(){let t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],r=t;return"empty"===t?(r=e,this._resetType="view"):"none"===t?(r=null,this._resetType=null):(0,eT.Z)(t)?t.includes("view:")?(r=t.replace("view:",""),this._resetType="view"):(r=t,this._resetType="self"):(0,ib.Z)(t)?(r=null,this._resetType="timeout"):this._resetType=null,r&&r!==e&&i.push({type:r,handler:this.handleReset}),i}start(t){let{state:e,reverseState:i,isMultiple:r}=this.options;t&&this._marks&&this._marks.includes(t.mark)?t.hasState(e)?"self"===this._resetType&&(this._statedElements=this.updateStates(this._statedElements&&this._statedElements.filter(e=>e!==t),this._statedElements,e,i)):(this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(r&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),"timeout"===this._resetType&&(this._timer=setTimeout(()=>{this.clearPrevElements()},this.options.triggerOff))):"view"===this._resetType&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;let e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}ws.type="element-select",ws.defaultOptions={state:tq.selected,trigger:"click"};class wa extends bZ{constructor(t,e){super(t,e),this.type=wa.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},wa.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=wn(this._marks,[this.options.highlightState,this.options.blurState])}getEvents(){let t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}],i=t;return(0,eT.Z)(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){let{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){let{highlightState:e,blurState:i}=this.options;this._lastElement!==t&&(this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options}))}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;let e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}wa.type="element-highlight",wa.defaultOptions={highlightState:tq.highlight,blurState:tq.blur,trigger:"pointerover",triggerOff:"pointerout"};class wo extends bZ{constructor(t,e){super(t,e),this.type=wo.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{t.element&&this._marks&&this._marks.includes(t.element.mark)&&this.clearPrevElements()},this.options=Object.assign({},wo.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector)}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}clearPrevElements(){this._marks.forEach(t=>{t.elements.forEach(t=>{t.removeState(this.options.highlightState),t.removeState(this.options.blurState)})})}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){let e=t.key;!(0,eC.Z)(e)&&this._marks.forEach(t=>{t.elements.forEach(t=>{t.key===e?(t.removeState(this.options.blurState),t.addState(this.options.highlightState)):(t.removeState(this.options.highlightState),t.addState(this.options.blurState))})})}}reset(t){if(t&&this._marks&&this._marks.includes(t.mark)){let e=t.key;!(0,eC.Z)(e)&&this._marks.forEach(t=>{t.elements.forEach(t=>{t.key===e?(t.removeState(this.options.blurState),t.addState(this.options.highlightState)):(t.removeState(this.options.highlightState),t.addState(this.options.blurState))})})}}}wo.type="element-highlight-by-key",wo.defaultOptions={highlightState:tq.highlight,blurState:tq.blur,trigger:"pointerover",triggerOff:"pointerout"};class wl extends bZ{constructor(t,e){super(t,e),this.type=wl.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},wl.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector)}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}clearPrevElements(){this._marks.forEach(t=>{t.elements.forEach(t=>{t.removeState(this.options.highlightState),t.removeState(this.options.blurState)})})}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){let e=t.groupKey;!(0,eC.Z)(e)&&this._marks.forEach(t=>{t.elements.forEach(t=>{t.groupKey===e?(t.removeState(this.options.blurState),t.addState(this.options.highlightState)):(t.removeState(this.options.highlightState),t.addState(this.options.blurState))})})}}reset(t){t&&this._marks&&this._marks.includes(t.mark)&&this.clearPrevElements()}}wl.type="element-highlight-by-group",wl.defaultOptions={highlightState:tq.highlight,blurState:tq.blur,trigger:"pointerover",triggerOff:"pointerout"};class wh extends bZ{constructor(t,e){super(t,e),this.type=wh.type,this.handleStart=t=>{var e,i;this.start(null===(i=null===(e=t.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.reset()},this.options=Object.assign({},wh.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector)}getEvents(){return[{type:t6.legendItemHover,handler:this.handleStart},{type:t6.legendItemUnHover,handler:this.handleReset}]}start(t){if((0,eC.Z)(t))return;let e=wr(this.options);this._marks.forEach(i=>{i.elements.forEach(i=>{e(i)===t?i.addState(this.options.state):i.removeState(this.options.state)})})}reset(){this._marks.forEach(t=>{t.elements.forEach(t=>{t.removeState(this.options.state)})})}}wh.type="element-active-by-legend",wh.defaultOptions={state:tq.active,filterType:"groupKey"};class wd extends bZ{constructor(t,e){super(t,e),this.type=wd.type,this.handleStart=(t,e)=>{var i,r;this.start(null===(r=null===(i=t.detail)||void 0===i?void 0:i.data)||void 0===r?void 0:r.id)},this.handleReset=t=>{this.reset()},this.options=Object.assign({},wd.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector)}getEvents(){return[{type:t6.legendItemHover,handler:this.handleStart},{type:t6.legendItemUnHover,handler:this.handleReset}]}start(t){if((0,eC.Z)(t))return;let e=wr(this.options);this._marks.forEach(i=>{i.elements.forEach(i=>{e(i)===t?(i.removeState(this.options.blurState),i.addState(this.options.highlightState)):(i.removeState(this.options.highlightState),i.addState(this.options.blurState))})})}reset(){this._marks.forEach(t=>{t.elements.forEach(t=>{t.removeState(this.options.blurState),t.removeState(this.options.highlightState)})})}}wd.type="element-highlight-by-legend",wd.defaultOptions={highlightState:tq.highlight,blurState:tq.blur,filterType:"groupKey"};class wu extends bZ{constructor(t,e){super(t,e),this.type=wu.type,this.handleStart=(t,e)=>{if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){let i=this._parseTargetKey(t,e);this.start(i)}},this.handleReset=t=>{(this.options.shouldReset?this.options.shouldReset(t):this._filterByName(t))&&this.reset()},this.options=Object.assign({},wu.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector)}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}_filterByName(t){var e;let i=ex(this.options.graphicName);return(null===(e=null==t?void 0:t.target)||void 0===e?void 0:e.name)&&i.includes(t.target.name)}_parseTargetKey(t,e){return this.options.parseData?this.options.parseData(t):"text"===t.target.type?t.target.attribute.text:null}start(t){if((0,eC.Z)(t))return;let e=wr(this.options);this._marks.forEach(i=>{i.elements.forEach(i=>{e(i)===t?(i.removeState(this.options.blurState),i.addState(this.options.highlightState)):(i.removeState(this.options.highlightState),i.addState(this.options.blurState))})})}reset(){this._marks.forEach(t=>{t.elements.forEach(t=>{t.removeState(this.options.blurState),t.removeState(this.options.highlightState)})})}}wu.type="element-highlight-by-name",wu.defaultOptions={trigger:"pointerover",triggerOff:"pointerout",highlightState:tq.highlight,blurState:tq.blur,filterType:"groupKey"};function wc(t,e,i){let r=0,n=t[0];if(!n)return!1;for(let s=1;se&&s>r||sn?o:0}function wf(t,e){return 1e-8>Math.abs(t-e)}(tw=es||(es={})).drawStart="drawStart",tw.drawEnd="drawEnd",tw.drawing="drawing",tw.moving="moving",tw.moveStart="moveStart",tw.moveEnd="moveEnd",tw.brushClear="brushClear";let wg={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-Infinity,y2:1/0,x1:-Infinity,x2:1/0}},wm={debounce:em,throttle:hK};pk(),fS();class wv extends pC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},wv.defaultAttributes,t)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-Infinity,1/0],this._operatingMaskMoveRangeY=[-Infinity,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();let i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:wm[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{t.preventDefault();let{removeOnClick:e=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&e?(this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={},this._dispatchEvent(es.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})):(this._activeDrawState&&this._dispatchEvent(es.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(es.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;let{trigger:t=wg.trigger,updateTrigger:e=wg.updateTrigger,endTrigger:i=wg.endTrigger,resetTrigger:r=wg.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(r,this._onBrushEnd)}_isPosInBrushMask(t){let e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+s})),e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){let{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(es.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;let{interactiveRange:r}=this.attribute,{minY:n=-Infinity,maxY:s=1/0,minX:a=-Infinity,maxX:o=1/0}=r,{x1:l,x2:h,y1:d,y2:u}=this._operatingMask.globalAABBBounds;this._operatingMaskMoveRangeX=[a-l,o-h],this._operatingMaskMoveRangeY=[n-d,s-u],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(es.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;let r=this.eventPosToStagePos(t),{x1:n=0,x2:s=0,y1:a=0,y2:o=0}=null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds,{sizeThreshold:l=5,brushType:h}=this.attribute,d=this._cacheDrawPoints.length;if(this._isDrawedBeforeEnd=!!(Math.abs(s-n)>l||Math.abs(a-o)>l),d>0){let t=null!==(i=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==i?i:{};if(r.x===t.x&&r.y===t.y)return}"polygon"===h||d<=1?this._cacheDrawPoints.push(r):this._cacheDrawPoints[d-1]=r;let u=this._computeMaskPoints();this._operatingMask.setAttribute("points",u),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(es.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_moving(t){let e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;let r=i.x-e.x,n=i.y-e.y,s=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],r))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:s,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(es.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){let{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute,r=[],n=this._cacheDrawPoints[0],s=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return"rect"===t?[n,{x:s.x,y:n.y},s,{x:n.x,y:s.y}]:"x"===t?[{x:n.x,y:i[0]},{x:s.x,y:i[0]},{x:s.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:s.y},{x:e[1],y:s.y},{x:e[1],y:n.y}]:ly(this._cacheDrawPoints)}_addBrushMask(){var t;let{brushStyle:e,hasMask:i}=this.attribute,r=as.polygon(Object.assign(Object.assign({points:ly(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));r.name=`brush-${Date.now()}`,this._operatingMask=r,this._container.add(r),this._brushMaskAABBBoundsDict[r.name]=r.AABBBounds}_outOfInteractiveRange(t){let{interactiveRange:e}=this.attribute,{minY:i=-Infinity,maxY:r=1/0,minX:n=-Infinity,maxX:s=1/0}=e,a=this.eventPosToStagePos(t);return a.x>s||a.xr||a.y{var t,e,i,r;let n=this.view.renderer.stage();if(this._brushComp||!n)return;let s=this.view.getViewBox();this._brushComp=new wv({interactiveRange:null!==(t=this.options.interactiveRange)&&void 0!==t?t:{minX:s.x1,maxX:s.x2,minY:s.y1,maxY:s.y2},xRange:null!==(e=this.options.xRange)&&void 0!==e?e:[s.x1,s.x2],yRange:null!==(i=this.options.yRange)&&void 0!==i?i:[s.y1,s.y2],brushMode:null!==(r=this.options.brushMode)&&void 0!==r?r:"single",brushType:this.options.brushType,brushStyle:this.options.brushStyle,brushMoved:this.options.brushMoved,removeOnClick:this.options.removeOnClick,sizeThreshold:this.options.sizeThreshold,delayType:this.options.delayType,delayTime:this.options.delayTime}),this._brushComp.addEventListener(es.brushClear,this.handleBrushUpdate),this._brushComp.addEventListener(es.moveEnd,this.handleBrushUpdate),this._brushComp.addEventListener(es.drawEnd,this.handleBrushUpdate),this._brushComp.addEventListener(es.drawStart,this.handleBrushUpdate),this._brushComp.addEventListener(es.moveStart,this.handleBrushUpdate),this._brushComp.addEventListener(es.drawing,this.handleBrushUpdate),this._brushComp.addEventListener(es.moving,this.handleBrushUpdate),n.defaultLayer.appendChild(this._brushComp)},this.options=e,this._marks=t.getMarksBySelector(this.options.selector)}getEvents(){return[{type:tX.BEFORE_DO_RENDER,handler:this.handleAfterDraw}]}isPolygonBrushContainGraphicItem(t,e,i){let r=t.attribute.points,{a:n,b:s,c:a,d:o,e:l,f:h}=t.globalTransMatrix,{x:d=0,y:u=0}=null!=i?i:{},c=r.map(t=>({x:n*t.x+a*t.y+l+d,y:s*t.x+o*t.y+h+u})),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+d,t.globalAABBBounds.y1+u,t.globalAABBBounds.x2+d,t.globalAABBBounds.y2+u),f=e.globalTransMatrix.e,g=e.globalTransMatrix.f;if("symbol"===e.type||"circle"===e.type)return p.contains(f,g)&&wc(c,f,g);if("rect"===e.type){let{width:t=0,height:i=0}=null==e?void 0:e.attribute;return function(t,e){for(let i=0;i0&&function(t,e,i,r,n){for(let s=0,a=n[n.length-1];s{let e=[];t.type===es.brushClear?this._marks.forEach(t=>{t.elements.forEach(t=>{t.removeState(this.options.blurState),t.removeState(this.options.highlightState)})}):this._marks.forEach(i=>{i.elements.forEach(i=>{this.isBrushContainGraphicItem(t.detail.operateMask,i.getGraphicItem())?(e.push(i),i.removeState(this.options.blurState),i.addState(this.options.highlightState)):(i.removeState(this.options.highlightState),i.addState(this.options.blurState))})}),this._dispatchEvent(t,e)}}}wy.type="brush-highlight",wy.defaultOptions={highlightState:tq.highlight,blurState:tq.blur};class wx extends wb{constructor(t,e){super(t,Object.assign({},wx.defaultOptions,e)),this.type=wx.type,this.handleBrushUpdate=t=>{let e=[];this._marks.forEach(i=>{i.elements.forEach(i=>{this.isBrushContainGraphicItem(t.detail.operateMask,i.getGraphicItem())?(e.push(i),i.addState(this.options.state)):i.removeState(this.options.state)})}),this._dispatchEvent(t,e)}}}wx.type="brush-active",wx.defaultOptions={state:tq.active};class w_ extends wb{constructor(t,e){super(t,Object.assign({},w_.defaultOptions,e)),this.type=w_.type,this.handleBrushUpdate=t=>{let e=[],i=[];this._marks.forEach(r=>{r.elements.forEach(r=>{this.isBrushContainGraphicItem(t.detail.operateMask,r.getGraphicItem())&&(e.push(r),i=i.concat(ex(r.getDatum())))})}),this._data&&(i=Array.from(new Set(i)),this._filterValue&&i.length===this._filterValue.length&&!i.some(t=>!this._filterValue.includes(t))||(this._filterValue=i,this.handleFilter())),this._dispatchEvent(t,e)},this._data=(0,eT.Z)(this.options.target.data)?t.getDataById(this.options.target.data):this.options.target.data}getEvents(){if(!this._data)return[];let t=this.options.target.transform;return this._filterData(this._data,null,tH.brush,null,void 0,(e,i)=>{let r=i||e;return t?t(e,i):r}),super.getEvents()}}w_.type="brush-filter",w_.defaultOptions={};class ww extends wb{constructor(t,e){super(t,Object.assign({},ww.defaultOptions,e)),this.type=ww.type,this.handleBrushUpdate=t=>{let e=[],i=[];this._marks.forEach(r=>{r.elements.forEach(r=>{this.isBrushContainGraphicItem(t.detail.operateMask,r.getGraphicItem())&&(e.push(r),i=i.concat(ex(r.getDatum())))})}),this._data&&(i=Array.from(new Set(i)),this._filterValue&&i.length===this._filterValue.length&&!i.some(t=>!this._filterValue.includes(t))||(this._filterValue=i,this.handleFilter())),this._dispatchEvent(t,e)},this.handleTrigger=t=>{let e=t.element;if(e&&this._marks&&this._marks.includes(e.mark)){let t=ex(e.getDatum());this._filterValue&&t.length===this._filterValue.length&&!t.some(t=>!this._filterValue.includes(t))||(this._filterValue=t,this.handleFilter())}},this._data=(0,eT.Z)(this.options.target.data)?t.getDataById(this.options.target.data):this.options.target.data}getEvents(){if(!this._data)return[];let t=this.options.target.transform;return this._filterData(this._data,null,tH.drillDown,null,void 0,(e,i)=>{let r=i||e;return t?t(e,i):r}),this.options.brush?super.getEvents():[{type:this.options.trigger,handler:this.handleTrigger}]}}ww.type="drill-down",ww.defaultOptions={brush:!1,trigger:"click"};class wA extends bY{constructor(t,e){super(t,e),this.type=wA.type,this._isToggle=!1,this.handleStart=t=>{var e,i;let r=t.element;if(r&&this._marks&&this._marks.includes(r.mark)){let r=null===(i=null===(e=t.element)||void 0===e?void 0:e.getDatum)||void 0===i?void 0:i.call(e);r===this._filterData||(0,ev.Z)(r)&&(0,ev.Z)(this._filterValue)&&r.length===this._filterValue.length&&r.every(t=>!this._filterValue.includes(t))?this._isToggle&&(this._filterValue=null,this.handleFilter(t)):this.handleFilter(t)}},this.handleReset=t=>{this._filterValue&&(this._filterValue=null,this.handleFilter(t))},this.options=Object.assign({},wA.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.source),this._data=(0,eT.Z)(this.options.target.data)?t.getDataById(this.options.target.data):this.options.target.data}getEvents(){if(!this._marks||0===this._marks.length||!this._data)return[];let t=this.options.target.transform;this._filterData(this._data,null,tH.rollUp,t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.getDatum)||void 0===i?void 0:i.call(e)},void 0,(e,i)=>t(e,i));let e=[{type:this.options.trigger,handler:this.handleStart}],i="empty"===this.options.triggerOff?this.options.trigger:this.options.triggerOff.includes("view:")?this.options.triggerOff.replace("view:",""):this.options.triggerOff;return i!==this.options.trigger?(e.push({type:i,handler:this.handleReset}),this._isToggle=!1):this._isToggle=!0,e}}wA.type="roll-up",wA.defaultOptions={trigger:"click",triggerOff:"empty"};let wS=(t,...e)=>{let i=[t.shape,...e.map(t=>null==t?void 0:t.shape)],r=[t.key,...e.map(t=>null==t?void 0:t.key)],n=[t.value,...e.map(t=>null==t?void 0:t.value)];return lE(t,...e,{shape:i.every(eC.Z)?void 0:lE({},...i),key:r.every(eC.Z)?void 0:lE({},...r),value:n.every(eC.Z)?void 0:lE({},...n)})},wE=t=>{let{width:e,height:i,wordBreak:r="break-word",textAlign:n,textBaseline:s,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:r,textAlign:n,textBaseline:s,singleLine:!1,textConfig:ex(a).map(e=>Object.assign(Object.assign({},t),{text:e}))}:{width:e,height:i,wordBreak:r,textAlign:n,textBaseline:s,singleLine:!1,textConfig:a.text}},wT={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:gV,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:gV,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:gV,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new il).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},wC=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];pk(),ml(),gD(),mY(),mB();class wk extends pC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},wk.defaultAttributes,t),e),this.name="tooltip"}render(){var t;let{visible:e,content:i,panel:r,keyWidth:n,valueWidth:s,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&wk.measureTooltip(this.attribute),o&&wk.calculateTooltipPosition(this.attribute);let h=(0,pE.o)(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},r),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");let d=wk.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",lE({symbolType:"circle"},d.shape,{visible:gz(d)&&gz(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:gz(d)&&gz(d.value)},wE(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(t=d.value.text)&&void 0!==t?t:"",visible:gz(d)&&gz(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:gz(d)&&gz(d.value)},wE(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},gZ),d.value),visible:gz(d)&&gz(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));let u=gz(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:c,textBaseline:p}=d.value,f=r.width-h[3]-h[0]-u;"center"===c?this._tooltipTitle.setAttribute("x",u+f/2):"right"===c||"end"===c?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===p?this._tooltipTitle.setAttribute("y",d.height):"middle"===p?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);let g=gz(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),i&&i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+g);let t=0;i.forEach((e,i)=>{var r,o,l;let h=wk.getContentAttr(this.attribute,i);if(!gz(h))return;let d=`tooltip-content-${i}`,u=this._tooltipContent.createOrUpdateChild(d,{visible:!0,x:0,y:t},"group"),c=0;if(gz(h.shape)&&u.createOrUpdateChild(`${d}-shape`,Object.assign({visible:!0,x:h.shape.size/2,y:h.shape.size/2+((null!==(r=n0(h.key.lineHeight,h.key.fontSize))&&void 0!==r?r:h.key.fontSize)-h.shape.size)/2},h.shape),"symbol"),a&&(c+=h.shape.size+h.shape.spacing),gz(h.key)){let t;t=h.key.multiLine?u.createOrUpdateChild(`${d}-key`,Object.assign(Object.assign({visible:!0},wE(h.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof h.key.text||null===h.key.text||"rich"!==h.key.text.type&&"html"!==h.key.text.type?u.createOrUpdateChild(`${d}-key`,Object.assign(Object.assign({visible:!0,text:null!==(o=h.key.text)&&void 0!==o?o:""},h.key),{textBaseline:"top"}),"text"):"rich"===h.key.text.type?u.createOrUpdateChild(`${d}-value`,Object.assign(Object.assign({visible:!0},wE(h.key)),{textBaseline:"top"}),"richtext"):u.createOrUpdateChild(`${d}-value`,{html:Object.assign(Object.assign({dom:h.key.text.text},gZ),h.key)},"richtext");let{textAlign:e}=h.key;"center"===e?t.setAttribute("x",c+n/2):"right"===e||"end"===e?t.setAttribute("x",c+n):t.setAttribute("x",c),t.setAttribute("y",0),c+=n+h.key.spacing}if(gz(h.value)){let t;t=h.value.multiLine?u.createOrUpdateChild(`${d}-value`,Object.assign(Object.assign({visible:!0},wE(h.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof h.value.text||null===h.value.text||"rich"!==h.value.text.type&&"html"!==h.value.text.type?u.createOrUpdateChild(`${d}-value`,Object.assign(Object.assign({visible:!0,text:null!==(l=h.value.text)&&void 0!==l?l:""},h.value),{textBaseline:"top"}),"text"):"rich"===h.value.text.type?u.createOrUpdateChild(`${d}-value`,Object.assign(Object.assign({visible:!0},wE(h.value)),{textBaseline:"top"}),"richtext"):u.createOrUpdateChild(`${d}-value`,{html:Object.assign({dom:h.value.text.text,container:"",width:30,height:30,style:{}},h.value)},"richtext");let e="right";ey(h.value.textAlign)?e=h.value.textAlign:gz(h.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",c+s/2):"right"===e||"end"===e?t.setAttribute("x",c+s):t.setAttribute("x",c),c+=s,t.setAttribute("y",0),u.add(t)}t+=h.height+h.spaceRow})}}setAttributes(t,e){let i=Object.keys(t);this.attribute.autoCalculatePosition&&i.every(t=>wC.includes(t))?(this._mergeAttributes(t,i),(0,eC.Z)(this.attribute.panel.width)&&this.attribute.autoMeasure&&wk.measureTooltip(this.attribute),wk.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},e)):super.setAttributes(t,e)}static calculateTooltipPosition(t){let{width:e=0,height:i=0}=t.panel,{offsetX:r,offsetY:n,pointerX:s,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t,d=s,u=a;return"left"===o?d-=e+r:"center"===o?d-=e/2:d+=r,"top"===l?u-=i+n:"middle"===l?u-=i/2:u+=n,d+e>h.x2&&(d-=e+r),u+i>h.y2&&(u-=i+n),d{let n=wk.getContentAttr(t,i);(e.key||e.value)&&gz(n)&&r.push([e,n])}),r.length){let n=!1,o=[],l=[],h=[];r.forEach(([t,e],s)=>{var d;let{key:u,value:c,shape:p,spaceRow:f}=e,g=gz(p),m=null!==(d=null==p?void 0:p.symbolType)&&void 0!==d?d:"",v=g$(u),b=g$(c),y=0;if(gz(u)){let{width:t,height:e}=v.quickMeasure(u.text);l.push(t),y=Math.max(y,e)}if(gz(c)){let{width:t,height:e}=b.quickMeasure(c.text);h.push(t),y=Math.max(y,e)}g&&gu[m]&&(n=!0,o.push(p.size),y=Math.max(p.size,y)),t.height=y,a+=y,s{t.width=s}),t.hasContentShape=n,t.keyWidth=u,t.valueWidth=c}}return t.panel.width=s+r[1]+r[3],t.panel.height=a,t}static getTitleAttr(t){return wS({},wk.defaultAttributes.titleStyle,wk.defaultAttributes.title,t.titleStyle,t.title)}static getContentAttr(t,e){return wS({},wk.defaultAttributes.contentStyle,t.contentStyle,t.content[e])}}wk.defaultAttributes=wT;let wM=(t,e,i,r,n,s)=>{var a;return lE({},null===(a=null==n?void 0:n.components)||void 0===a?void 0:a.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:r},null!=s?s:{})};class wB extends bZ{constructor(t,e){super(t,e),this._marks=t.getMarksBySelector(e.selector)}bind(){super.bind();let t=this.view.renderer.stage();!this._tooltipComponent&&t&&(this._tooltipComponent=new wk({}),t.defaultLayer.appendChild(this._tooltipComponent))}unbind(){super.unbind();let t=this.view.renderer.stage();this._tooltipComponent&&t&&(t.defaultLayer.removeChild(this._tooltipComponent),this._tooltipComponent.release(),this._tooltipComponent=null)}_computeTooltipRow(t,e){let i,r,n,s=lt(t.visible,this.parameters(),e);return s=!!(0,eC.Z)(s)||!!s,i=dl(t.key)?l0(t.key.field)(e):lt(t.key,this.parameters(),e),i=(0,eC.Z)(i)?void 0:l_(i)?i:{text:i},r=dl(t.value)?l0(t.value.field)(e):lt(t.value,this.parameters(),e),r=(0,eC.Z)(r)?void 0:l_(r)?r:{text:r},n=dl(t.symbol)?l0(t.symbol.field)(e):lt(t.symbol,this.parameters(),e),{visible:s,key:i,value:r,shape:n=(0,eC.Z)(n)?void 0:l_(n)?n:{symbolType:n}}}_computeTitleContent(t){let e=ey(this.options.title)?r6(this.options.title)?this.options.title.call(null,t,null,{}):this._computeTooltipRow((0,eT.Z)(this.options.title)?{value:this.options.title}:this.options.title,t):void 0,i=ey(this.options.content)?r6(this.options.content)?ex(this.options.content.call(null,t,null,{})):ex(t).reduce((t,e)=>t.concat(ex(this.options.content).map(t=>this._computeTooltipRow(t,e))),[]):void 0;return{title:(0,ev.Z)(e)?e[0]:e,content:i}}}class wP extends wB{constructor(t,e){super(t,e),this.type=wP.type,this.handleTooltipShow=hK(t=>{if(!this._tooltipComponent)return;let e=t.element;if(!this._marks.includes(null==e?void 0:e.mark))return void this._tooltipComponent.hideAll();this._tooltipComponent.showAll();let i=this.view.rootMark.getGroupGraphicItem(),r={x:0,y:0};if(i.globalTransMatrix.transformPoint(t.canvas,r),e===this._lastElement)return void this._tooltipComponent.setAttributes({pointerX:r.x,pointerY:r.y});let n={x:0,y:0};i.globalTransMatrix.transformPoint({x:0,y:0},n);let s={x:0,y:0};i.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},s);let a=(new il).set(n.x,n.y,s.x,s.y),{title:o,content:l}=this._computeTitleContent(e.getDatum()),h=this.view.getCurrentTheme(),d=wM(r,o,l,a,h,lt(this.options.attributes,this.parameters(),e.getDatum()));this._tooltipComponent.setAttributes(d)},10),this.handleTooltipHide=t=>{this._tooltipComponent&&this._tooltipComponent.hideAll()},this.options=Object.assign({},wP.defaultOptions,e)}getEvents(){return[{type:this.options.trigger,handler:this.handleTooltipShow},{type:this.options.triggerOff,handler:this.handleTooltipHide}]}}wP.type="tooltip",wP.defaultOptions={trigger:"pointermove",triggerOff:"pointerleave"};let wR=(t,e)=>{let i=ex(t),r=ex(e);return i.length===r.length&&i.every(t=>r.includes(t))&&r.every(t=>i.includes(t))},wO=(t,e,i,r,n)=>{if("x"===i)return e.invert(t.x);if("y"===i)return e.invert(t.y);if("radius"===i){let i=null!=n?n:{x:r.width/2,y:r.height/2},s=Math.sqrt((i.x-t.x)**2+(i.y-t.y)**2);return e.invert(s)}if("angle"===i){let i=e5(null!=n?n:{x:r.width/2,y:r.height/2},t);return e.invert(i<0?i+2*Math.PI:i)}return e.invert(t.x)};class wI extends wB{constructor(t,e){var i,r,n;super(t,e),this.type=wI.type,this._avoidMarks=[],this._tooltipDataFilter=null,this.handleTooltipShow=hK(t=>{var e,i,r;if(!this._tooltipComponent)return;let n=((0,eT.Z)(this.options.scale)?this.view.getScaleById(this.options.scale):this.options.scale).getScale(),s=this._container.getGroupGraphicItem(),a={x:0,y:0};s.globalTransMatrix.transformPoint(t.canvas,a);let o={width:s.attribute.width,height:s.attribute.height};if(a.x<0||a.x>s.attribute.width||a.y<0||a.y>s.attribute.height)return void this._tooltipComponent.hideAll();let l=null===(i=null===(e=t.target)||void 0===e?void 0:e[l4])||void 0===i?void 0:i.mark;if(this._avoidMarks.includes(l))return void this._tooltipComponent.hideAll();let h=null===(r=this.options.target)||void 0===r?void 0:r.data,d=h?(0,eT.Z)(h)?this.view.getDataById(h):h:null,u=d?d.getValue():[],c=wO(a,n,this.options.tooltipType,o,this.options.center),p=this._tooltipDataFilter?u.filter(t=>this._tooltipDataFilter(t,c)):[];if(this._tooltipComponent.showAll(),wR(p,this._lastDatum))return void this._tooltipComponent.setAttributes({pointerX:a.x,pointerY:a.y});this._lastDatum=p;let f={x:0,y:0};s.globalTransMatrix.transformPoint({x:0,y:0},f);let g={x:0,y:0};s.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},g);let m=(new il).set(f.x,f.y,g.x,g.y),{title:v,content:b}=this._computeTitleContent(p),y=this.view.getCurrentTheme(),x=wM(a,v,b,m,y,lt(this.options.attributes,this.parameters(),{}));this._tooltipComponent.setAttributes(x)},10),this.handleTooltipHide=t=>{this._tooltipComponent&&this._tooltipComponent.hideAll()},this.options=Object.assign({},wI.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._avoidMarks=null!==(i=t.getMarksBySelector(this.options.avoidMark))&&void 0!==i?i:[],this._container=null!==(n=null===(r=t.getMarksBySelector(this.options.container))||void 0===r?void 0:r[0])&&void 0!==n?n:t.rootMark}getEvents(){let t=this.options.target.filter;return this._tooltipDataFilter=(0,eT.Z)(t)?(e,i)=>i===e[t]:t,[{type:this.options.trigger,handler:this.handleTooltipShow},{type:this.options.triggerOff,handler:this.handleTooltipHide}]}}wI.type="dimension-tooltip",wI.defaultOptions={trigger:"pointermove",triggerOff:"pointerleave"};class wL extends pC{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}let wD=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...nO];class wN extends nF{constructor(t){super(t),this.type="arc",this.numberType=n8}isValid(){return super.isValid()&&this._isValid()}_isValid(){let{startAngle:t,endAngle:e,outerRadius:i,innerRadius:r}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(r)}getParsedCornerRadius(){let t=rQ(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:r=t.outerPadding}=this.attribute,{outerRadius:n=t.outerRadius,innerRadius:s=t.innerRadius}=this.attribute;if(n+=r,s-=i,0===e||"0%"===e)return 0;let a=Math.abs(n-s);return Math.min((0,ib.Z)(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){let t=rQ(this).arc,{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute,{cap:r=t.cap}=this.attribute,n=i-e>=0?1:-1,s=i-e;if(i=(e=e1(e))+s,r&&(0,eJ.Wn)(s)eJ.Ho&&o>eJ.Ho)return{startAngle:e-n*c*s,endAngle:i+n*c*a,sc:n*c*s,ec:n*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){let i=rQ(this).arc,{innerPadding:r=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:s=i.padAngle}=this.attribute,{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=r;let{padRadius:l=(0,eJ._b)(a*a+o*o)}=this.attribute,h=(0,eJ.Wn)(e-t),d=t,u=e,c=t,p=e,f=s/2,g=h,m=h;if(f>eJ.Ho&&l>eJ.Ho){let i=e>t?1:-1,r=(0,eJ.ZR)(Number(l)/o*(0,eJ.O$)(f)),n=(0,eJ.ZR)(Number(l)/a*(0,eJ.O$)(f));return(g-=2*r)>eJ.Ho?(r*=i,c+=r,p-=r):(g=0,c=p=(t+e)/2),(m-=2*n)>eJ.Ho?(n*=i,d+=n,u-=n):(m=0,d=u=(t+e)/2),{outerStartAngle:d,outerEndAngle:u,innerStartAngle:c,innerEndAngle:p,innerDeltaAngle:g,outerDeltaAngle:m}}return{outerStartAngle:d,outerEndAngle:u,innerStartAngle:c,innerEndAngle:p,innerDeltaAngle:g,outerDeltaAngle:m}}doUpdateAABBBounds(t){let e=rQ(this).arc;this._AABBBounds.clear();let i=this.attribute,r=ru.graphicService.updateArcAABBBounds(i,rQ(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,s=nU(n);return s&&r.expand(s),this.clearUpdateBoundTag(),r}tryUpdateOBBBounds(){throw Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,wD)}needUpdateTag(t){return super.needUpdateTag(t,wD)}getDefaultAttribute(t){return rQ(this).arc[t]}toCustomPath(){let t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle(),r=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0),s=(0,eJ.Wn)(i-e),a=i>e;if(n=eJ.f7-eJ.Ho)o.moveTo(0+n*(0,eJ.mC)(e),0+n*(0,eJ.O$)(e)),o.arc(0,0,n,e,i,!a),r>eJ.Ho&&(o.moveTo(0+r*(0,eJ.mC)(i),0+r*(0,eJ.O$)(i)),o.arc(0,0,r,i,e,a));else{let t=n*(0,eJ.mC)(e),s=n*(0,eJ.O$)(e),l=r*(0,eJ.mC)(i),h=r*(0,eJ.O$)(i);o.moveTo(0+t,0+s),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,r,i,e,a),o.closePath()}return o}clone(){return new wN(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return wN.NOWORK_ANIMATE_ATTR}}function wj(t){return new wN(t)}wN.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},nj);var wF=i("408345");class wz{static GetCanvas(){try{return wz.canvas||(wz.canvas=ru.global.createCanvas({})),wz.canvas}catch(t){return null}}static GetCtx(){if(!wz.ctx){let t=wz.GetCanvas();wz.ctx=t.getContext("2d")}return wz.ctx}}class wH extends wF.L{static getInstance(){return wH._instance||(wH._instance=new wH),wH._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;let i=wz.GetCanvas(),r=wz.GetCtx();if(i.width=e,i.height=1,!r)return;if(r.translate(0,0),!r)throw Error("获取ctx发生错误");let n=r.createLinearGradient(0,0,e,0);t.forEach(t=>{n.addColorStop(t[0],t[1])}),r.fillStyle=n,r.fillRect(0,0,e,1),this.rgbaSet=r.getImageData(0,0,e,1).data}getColor(t){let e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,r,n=[],s=100){let a=`${t}${e}${i}${r}`;n.forEach(t=>a+=t.join()),a+=s;let o=this.dataMap.get(a);return!o&&(o={data:new wH(n,s),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class wG{static GetSize(t){for(let e=0;e=t)return wG.ImageSize[e];return t}static Get(t,e,i,r,n,s,a){let o=wG.GenKey(t,e,i,r,n),l=wG.cache[o];if(!l||0===l.length)return null;for(let t=0;t=s&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,r,n,s,a,o){let l=wG.GenKey(t,e,i,r,n);wG.cache[l]?wG.cache[l].push({width:a,height:o,pattern:s}):wG.cache[l]=[{width:a,height:o,pattern:s}]}static GenKey(t,e,i,r,n){return`${e},${i},${r},${n},${t.join()}`}}wG.cache={},wG.ImageSize=[20,40,80,160,320,640,1280,2560];let wU=new class t{constructor(){this.time=oF.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,s,a,o,l,h,d,u){let{outerBorder:c,innerBorder:p}=t.attribute,f=c&&!1!==c.visible,g=p&&!1!==p.visible;if(!f&&!g)return;let{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:b=l.startAngle,endAngle:y=l.endAngle,opacity:x=l.opacity,x:_=l.x,y:w=l.y,scaleX:A=l.scaleX,scaleY:S=l.scaleY}=t.attribute,{innerRadius:E=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,E-=m;let C=!(!c||!c.stroke),k=!(!p||!p.stroke);if(f){let{distance:n=l.outerBorder.distance}=c,s=aB(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+s,innerRadius:E-s,startAngle:b-a,endAngle:y+a}),e.beginPath(),aW(t,e,i,r,T+s,E-s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,c,l.outerBorder);else if(C){let n=l.outerBorder.opacity;l.outerBorder.opacity=x,e.setStrokeStyle(t,c,(_-i)/A,(w-r)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(g){let{distance:n=l.innerBorder.distance}=p,s=aB(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-s,innerRadius:E+s,startAngle:b+a,endAngle:y-a}),e.beginPath(),aW(t,e,i,r,T-s,E+s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,p,l.innerBorder);else if(k){let n=l.innerBorder.opacity;l.innerBorder.opacity=x,e.setStrokeStyle(t,p,(_-i)/A,(w-r)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:E,startAngle:b,endAngle:y})}};var wV=function(t,e){return function(i,r){e(i,r,t)}};let wW=class extends oe{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=n8,this.builtinContributions=[wU,a4,oh],this.init(t)}drawArcTailCapPath(t,e,i,r,n,s,a,o){let l,h,d,u;let c=o-a,p=t.getParsedAngle(),f=p.startAngle,g=p.endAngle;g=o;let m=(0,eJ.Wn)(g-f),v=g>f,b=!1;if(neJ.Ho||T>eJ.Ho)&&(l=n*(0,eJ.mC)(A),h=n*(0,eJ.O$)(A),d=s*(0,eJ.mC)(E),u=s*(0,eJ.O$)(E),meJ.Ho){let t=(0,eJ.VV)(y,k),s=(0,eJ.VV)(y,k),a=aV(d,u,B,P,n,t,Number(v)),o=aV(l,h,R,O,n,s,Number(v));if(k0&&e.arc(i+o.cx,r+o.cy,s,(0,eJ.fv)(o.y11,o.x11),(0,eJ.fv)(o.y01,o.x01),!v)}}else e.moveTo(i+B,r+P);if(!(s>eJ.Ho)||_<.001)e.lineTo(i+R,r+O),b=!0;else if(M>eJ.Ho){let t=(0,eJ.VV)(y,M),n=(0,eJ.VV)(y,M),a=aV(R,O,l,h,s,-n,Number(v)),o=aV(B,P,d,u,s,-t,Number(v));if(e.lineTo(i+a.cx+a.x01,r+a.cy+a.y01),M0&&e.arc(i+a.cx,r+a.cy,n,(0,eJ.fv)(a.y01,a.x01),(0,eJ.fv)(a.y11,a.x11),!v);let t=(0,eJ.fv)(a.cy+a.y11,a.cx+a.x11),o=g-c-.03;e.arc(i,r,s,t,o,v)}}else e.lineTo(i+s*(0,eJ.mC)(E),r+s*(0,eJ.O$)(E));return b}drawShape(t,e,i,r,n,s,a,o){let l=rQ(t,null==s?void 0:s.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:c=l.y}=t.attribute,p=this.valid(t,l,a,o);if(!p)return;let{fVisible:f,sVisible:g,doFill:m,doStroke:v}=p,{outerPadding:b=l.outerPadding,innerPadding:y=l.innerPadding,cap:x=l.cap,forceShowCap:_=l.forceShowCap}=t.attribute,{outerRadius:w=l.outerRadius,innerRadius:A=l.innerRadius}=t.attribute;w+=b,A-=y;let S=0,E=(r4(x)&&x||x[0])&&"conical"===h.gradient;if(E){let{sc:e,startAngle:i,endAngle:r}=t.getParsedAngle();(0,eJ.Wn)(r-i)=eJ.f7-eJ.Ho){e.beginPath();let s=Math.abs(w-A)/2/w,{endAngle:h=l.endAngle,fill:d=l.fill}=t.attribute;if(this.drawArcTailCapPath(t,e,i,r,w,A,h,h+s),T||this.beforeRenderStep(t,e,i,r,m,v,f,g,l,n,a,o),m&&"conical"===d.gradient){let n=function(t,e,i,r){let{stops:n,startAngle:s,endAngle:a}=r;for(;i<0;)i+=eJ.f7;for(;i>eJ.f7;)i-=eJ.f7;if(ia)return n[0].color;let o,l,h=(i-s)/(a-s);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),nE(o.color,l.color,h,!1)}(0,0,h,d);a||aF&&(e.setCommonStyle(t,t.attribute,i,r,l),e.fillStyle=n,e.fill())}v&&(o||g&&(e.setStrokeStyle(t,t.attribute,i,r,l),e.stroke()))}}this.afterRenderStep(t,e,i,r,m,v,f,g,l,n,a,o),E&&(h.startAngle+=S,h.endAngle+=S)}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).arc;this._draw(t,n,!1,i,r)}};wW=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),wV(0,eH(eU)),wV(0,eG(aZ)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],wW);let wZ=!1,w$=new eB(t=>{wZ||(wZ=!0,t(wW).toSelf().inSingletonScope(),t(sM).to(wW).inSingletonScope(),t(sO).toService(sM),t(aZ).toService(a6),eW(t,aZ))}),wY=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=n8}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).arc;r.highPerformanceSave();let{x:s=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=aB(r,s+a,r.dpr),o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};wY=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tA=0,tS=eH(sM),function(t,e){tS(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],wY);let wX=!1,wK=new eB((t,e,i,r)=>{wX||(wX=!0,t(p$).to(wY).inSingletonScope(),t(p9).toService(p$))}),wq=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=n8}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).arc;r.highPerformanceSave();let{x:s=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){let e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y)),(t,i,n)=>{if(o)return!0;let s=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=s+a,o=t.isPointInStroke(e.x,e.y)}),r.highPerformanceRestore(),o}};wq=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tE=0,tT=eH(sM),function(t,e){tT(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],wq);let wJ=!1,wQ=new eB((t,e,i,r)=>{wJ||(wJ=!0,t(pD).to(wq).inSingletonScope(),t(pL).toService(pD))});function w0(){w0.__loaded||(w0.__loaded=!0,as.RegisterGraphicCreator("arc",wj),rO.load(w$),rO.load(pI?wK:wQ))}w0.__loaded=!1;pk(),fo();class w1 extends wL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},w1.defaultAttributes,t))}renderCrosshair(t){let{start:e,end:i,lineStyle:r}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},r),"line")}setLocation(t){let{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}w1.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pk(),ml();class w2 extends wL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},w2.defaultAttributes,t))}renderCrosshair(t){let{start:e,end:i,rectStyle:r}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},r),"rect")}setLocation(t){let{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}w2.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},pk(),w0();class w5 extends wL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},w5.defaultAttributes,t))}renderCrosshair(t){let{center:e,radius:i,innerRadius:r=0,sectorStyle:n}=this.attribute,{startAngle:s,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:r,startAngle:s,endAngle:a}),n),"arc")}setLocation(t){let{center:e,startAngle:i=gG,endAngle:r=gU}=this.attribute,n=r-i,s=e0(e5(e,t));this.setAttributes({startAngle:s-n/2,endAngle:s+n/2})}}w5.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},pk(),w0();class w3 extends wL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},w3.defaultAttributes,t))}renderCrosshair(t){let{center:e,radius:i,lineStyle:r}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),r),"arc")}setLocation(t){let{center:e}=this.attribute,i=ix.distancePP(t,e);this.setAttribute("radius",i)}}w3.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},pk(),vM();class w4 extends wL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:lE({},w4.defaultAttributes,t))}renderCrosshair(t){let e;let{center:i,radius:r,sides:n=6,lineStyle:s}=this.attribute,{startAngle:a,endAngle:o}=this.attribute,l=(o-a)%(2*Math.PI)==0,h=(o-a)/n;for(let t=0;t<=n;t++){let s=e2(i,r,a+h*t);0===t?e=`M${s.x},${s.y}`:e+=`L${s.x},${s.y}`,t===n&&l&&(e+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:e},s),"path")}setLocation(t){let{center:e}=this.attribute,i=ix.distancePP(t,e);this.setAttribute("radius",i)}}w4.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};let w6=(t,e,i,r,n,s=0)=>{var a,o;let l={x:0,y:0},h={x:0,y:0},d="angle"===i?null!==(a=null==n?void 0:n.radius)&&void 0!==a?a:Math.min(r.width,r.height)/2:null,u="angle"===i?null!==(o=null==n?void 0:n.center)&&void 0!==o?o:{x:r.width/2,y:r.height/2}:null,c=0;if(uj(e.type)){if("x"===i)c=e.scale(e.invert(t.x));else if("y"===i)c=e.scale(e.invert(t.y));else if("angle"===i){let i=e1(e5(u,t)+2*Math.PI);c=e.scale(e.invert(i))}}else uN(e.type)&&("x"===i?c=t.x:"y"===i?c=t.y:"angle"===i&&(c=e5(u,t)));switch(c+=s,i){case"x":l.x=c,l.y=0,h.x=c,h.y=r.height;break;case"y":l.x=0,l.y=c,h.x=r.width,h.y=c;break;case"angle":l.x=u.x,l.y=u.y,h.x=u.x+d*Math.cos(c),h.y=u.y+d*Math.sin(c)}return{start:l,end:h}},w8=(t,e,i,r,n,s)=>{var a,o,l;let h=null!==(o=null!==(a=null==s?void 0:s.center)&&void 0!==a?a:null==n?void 0:n.center)&&void 0!==o?o:{x:r.width/2,y:r.height/2},d=0;if(uj(e.type)){let i="band"===e.type?e.bandwidth()/2:0,r=Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2);d=e.scale(e.invert(r))+i}else uN(e.type)&&(d=Math.min(null!==(l=null==n?void 0:n.radius)&&void 0!==l?l:Math.min(r.width,r.height)/2,Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2)));return{radius:d,center:h}},w7=(t,e,i,r,n,s,a)=>{var o,l,h;let d=null===(o=null==s?void 0:s.components)||void 0===o?void 0:o.lineCrosshair,u="band"===e.type?e.bandwidth()/2:0;return lE({},d,w6(t,e,i,r,{radius:null!==(l=null==a?void 0:a.radius)&&void 0!==l?l:null==n?void 0:n.radius,center:null!==(h=null==a?void 0:a.center)&&void 0!==h?h:null==n?void 0:n.center},u),null!=a?a:{})},w9=(t,e,i,r,n,s,a)=>{var o,l,h;let d=null===(o=null==s?void 0:s.components)||void 0===o?void 0:o.rectCrosshair,u="band"===e.type||"point"===e.type?e.step():void 0,c=null==a?void 0:a.rectStyle,p=null!=u?u:"y"===i?null!==(l=null==c?void 0:c.width)&&void 0!==l?l:d.rectStyle.width:null!==(h=null==c?void 0:c.height)&&void 0!==h?h:d.rectStyle.height,f=w6(t,e,i,r,n,"band"===e.type?0:-p/2),g={};"x"===i?g.width=p:g.height=p;let m=lE({},d,{start:f.start,end:f.end,rectStyle:g},null!=a?a:{});return"x"===i?m.rectStyle.height=m.end.y-m.start.y:m.rectStyle.width=m.end.x-m.start.x,m},At=(t,e,i,r,n,s,a)=>{var o;let l=null===(o=null==s?void 0:s.components)||void 0===o?void 0:o.circleCrosshair,{center:h,radius:d}=w8(t,e,0,r,n,a),u=l.startAngle,c=l.endAngle,p="band"===e.type||"point"===e.type?e.step():0;return lE({},l,{center:h,innerRadius:d-p/2,radius:d+p/2,startAngle:u,endAngle:c},null!=a?a:{})},Ae=(t,e,i,r,n,s,a)=>{var o,l,h,d,u;let c=null===(o=null==s?void 0:s.components)||void 0===o?void 0:o.sectorCrosshair,p=null!==(h=null!==(l=null==a?void 0:a.radius)&&void 0!==l?l:null==n?void 0:n.radius)&&void 0!==h?h:Math.min(r.width,r.height)/2,f=null!==(u=null!==(d=null==a?void 0:a.center)&&void 0!==d?d:null==n?void 0:n.center)&&void 0!==u?u:{x:r.width/2,y:r.height/2},g=c.endAngle-c.startAngle,m="band"===e.type||"point"===e.type?e.step():g,v=0;if(uj(e.type)){let i=e1(e5(f,t)+2*Math.PI);v=e.scale(e.invert(i))+("band"===e.type?e.bandwidth()/2:0)}else uN(e.type)&&(v=e5(f,t));return lE({},c,{center:f,radius:p,startAngle:v-m/2,endAngle:v+m/2},null!=a?a:{})},Ai=(t,e,i,r,n,s,a)=>{var o;let l=null===(o=null==s?void 0:s.components)||void 0===o?void 0:o.circleCrosshair,{center:h,radius:d}=w8(t,e,0,r,n,a),u=l.startAngle,c=l.endAngle;return lE({},l,{center:h,radius:d,startAngle:u,endAngle:c},null!=a?a:{})},Ar=(t,e,i,r,n,s,a)=>{var o;let l=null===(o=null==s?void 0:s.components)||void 0===o?void 0:o.circleCrosshair,{center:h,radius:d}=w8(t,e,0,r,n,a),u=l.startAngle,c=l.endAngle;return lE({},l,{center:h,radius:d,startAngle:u,endAngle:c},null!=a?a:{})};class An extends bZ{constructor(t,e){var i,r;super(t,e),this.type=An.type,this.handleCrosshairShow=t=>{var e;if(!this._crosshairComponent)return;let i=this._container.getGroupGraphicItem(),r={x:0,y:0},n=i.globalTransMatrix,s={x:n.e,y:n.f};if(n.transformPoint(t.canvas,r),r.x<0||r.x>i.attribute.width||r.y<0||r.y>i.attribute.height)return void this._crosshairComponent.hideAll();let a=null!==(e=this.options.crosshairType)&&void 0!==e?e:"x",o={width:i.attribute.width,height:i.attribute.height},l=((0,eT.Z)(this.options.scale)?this.view.getScaleById(this.options.scale):this.options.scale).getScale(),h={center:this.options.center,radius:this.options.radius},d=this.view.getCurrentTheme(),u=lt(this.options.attributes,this.parameters(),{},{}),c={};switch(this.getCrosshairComponentType()){case tW.lineCrosshair:c=w7(r,l,a,o,h,d,u);break;case tW.rectCrosshair:c=w9(r,l,a,o,h,d,u);break;case tW.sectorCrosshair:c=Ae(r,l,0,o,h,d,u);break;case tW.circleCrosshair:c=Ai(r,l,0,o,h,d,u);break;case tW.polygonCrosshair:c=Ar(r,l,0,o,h,d,u);break;case tW.ringCrosshair:c=At(r,l,0,o,h,d,u)}this.getCrosshairComponentType()!==tW.circleCrosshair&&(c.x=s.x,c.y=s.y),this._crosshairComponent.showAll(),this._crosshairComponent.setAttributes(c)},this.handleCrosshairHide=()=>{this._crosshairComponent&&this._crosshairComponent.hideAll()},this.options=Object.assign({},An.defaultOptions,e),this._container=null!==(r=null===(i=t.getMarksBySelector(this.options.container))||void 0===i?void 0:i[0])&&void 0!==r?r:t.rootMark}getEvents(){return[{type:this.options.trigger,handler:this.handleCrosshairShow},{type:this.options.triggerOff,handler:this.handleCrosshairHide}]}getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;let i=null!==(t=this.options.crosshairShape)&&void 0!==t?t:"line",r=null!==(e=this.options.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===r?tW.sectorCrosshair:"radius"===r?tW.ringCrosshair:"radius-polygon"===r?tW.polygonCrosshair:tW.rectCrosshair:"radius"===r?tW.circleCrosshair:"radius-polygon"===r?tW.polygonCrosshair:tW.lineCrosshair,this._crosshairComponentType}getDefaultCrosshairAttribute(){var t;let e=null!==(t=this.options.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0},zIndex:-1}:{start:{x:0,y:0},end:{x:0,y:0},zIndex:-1}}bind(){super.bind();let t=this.view.renderer.stage();if(!this._crosshairComponent&&t){switch(this.getCrosshairComponentType()){case tW.lineCrosshair:this._crosshairComponent=new w1(this.getDefaultCrosshairAttribute());break;case tW.rectCrosshair:this._crosshairComponent=new w2(this.getDefaultCrosshairAttribute());break;case tW.sectorCrosshair:this._crosshairComponent=new w5(this.getDefaultCrosshairAttribute());break;case tW.circleCrosshair:this._crosshairComponent=new w3(this.getDefaultCrosshairAttribute());break;case tW.polygonCrosshair:this._crosshairComponent=new w4(this.getDefaultCrosshairAttribute());break;case tW.ringCrosshair:this._crosshairComponent=new w5(this.getDefaultCrosshairAttribute())}t.defaultLayer.appendChild(this._crosshairComponent)}}unbind(){super.unbind();let t=this.view.renderer.stage();this._crosshairComponent&&t&&(t.defaultLayer.removeChild(this._crosshairComponent),this._crosshairComponent.release(),this._crosshairComponent=null)}}An.type="crosshair",An.defaultOptions={trigger:"pointermove",triggerOff:"pointerleave",crosshairType:"x",crosshairShape:"line"};class As extends bZ{constructor(t,e){super(t,e),this.options=e}_parseLinkedComponent(t){if(!t)return null;let e=(0,eT.Z)(t)?this.view.getMarkById(t):t;return e&&e.markType===tF.component&&(e.componentType===tz.datazoom||e.componentType===tz.scrollbar)?e:null}_initStateByDim(t,e,i,r,n){let s=this._parseLinkedComponent(e);if(s)return void(this._state[t]={linkedComponent:s});let a=(0,eC.Z)(i)?null:(0,eT.Z)(i)?this.view.getScaleById(i):i,o=(0,eC.Z)(null==r?void 0:r.data)?null:(0,eT.Z)(r.data)?this.view.getDataById(r.data):r.data;if(!a||!o)return this._state[t]={data:o,scale:a},void((0,ev.Z)(n)?(this._state[t].rangeFactor=n,this._state[t].initRangeFactor=n):r6(n)?this._state[t].getCurrentRange=n:a&&a.getRangeFactor()&&(this._state[t].rangeFactor=a.getRangeFactor(),this._state[t].initRangeFactor=a.getRangeFactor()));o.attach(a);let l=(0,eT.Z)(r.filter)?(t,e)=>{let i=pw(a.getScale(),t[r.filter]);return i>=e[0]&&i<=e[1]}:r.filter,h={source:`${a.uid}`,rank:tH.normal,filter:e=>{var i,n,s,a;let o="x"===t?null===(n=null===(i=this._state)||void 0===i?void 0:i.x)||void 0===n?void 0:n.filterValue:null===(a=null===(s=this._state)||void 0===s?void 0:s.y)||void 0===a?void 0:a.filterValue;if(!o)return e;let h=e.filter(t=>l(t,o));return r.transform?r.transform(h,o):h}};"x"===t?this._dataFilterX=h:this._dataFilterY=h,o.addDataFilter(h),this._state[t]={data:o,scale:a}}_initGrammars(){let{enableX:t,enableY:e,scaleX:i,scaleY:r,dataTargetX:n,dataTargetY:s,linkedComponentX:a,linkedComponentY:o,rangeX:l,rangeY:h}=this.options;this._state={},!1!==t&&this._initStateByDim("x",a,i,n,l),!1!==e&&this._initStateByDim("y",o,r,s,h),this._inited=!0}_updateLinkedComponent(t,e){t.componentType===tz.datazoom?t.setStartEndValue(e[0],e[1]):t.setScrollStart(e[0])}updateView(t,e,i,r){var n,s,a,o;e&&e.x&&(null===(s=null===(n=this._state)||void 0===n?void 0:n.x)||void 0===s?void 0:s.linkedComponent)&&this._updateLinkedComponent(this._state.x.linkedComponent,e.x),e&&e.y&&(null===(o=null===(a=this._state)||void 0===a?void 0:a.y)||void 0===o?void 0:o.linkedComponent)&&this._updateLinkedComponent(this._state.y.linkedComponent,e.y),e&&e.needUpdate&&this.view.run(),this.dispatchEvent(t,{viewRange:e,event:r,eventType:i})}unbind(){super.unbind(),this._state&&Object.keys(this._state).forEach(t=>{let{data:e,scale:i}=this._state[t];e&&i?(e.detach(i),e.removeDataFilter("x"===t?this._dataFilterX:this._dataFilterY)):i&&(i.setRangeFactor(null),i.commit())}),this._state=null}}class Aa extends As{constructor(t,e){super(t,Object.assign({},Aa.defaultOptions,e)),this.type=Aa.type,this.handleStartInner=t=>{this.formatZoomEvent(t),t&&(!this.options.shouldStart||this.options.shouldStart(t))&&(this._inited||this._initGrammars(),this._isStarted=!0,this.updateView("start",this.handleZoomStart(t,this._state,{rate:this.options.rate,focus:this.options.focus}),"zoom",t))},this.handleEnd=t=>{this._isStarted&&(this.formatZoomEvent(t),t&&(!this.options.shouldEnd||this.options.shouldEnd(t))&&this.updateView("end",this.handleZoomEnd(t,this._state,{rate:this.options.rate,focus:this.options.focus}),"zoom",t))},this.handleReset=t=>{this._isStarted&&t&&(!this.options.shouldReset||this.options.shouldReset(t))&&(this.updateView("reset",this.handleZoomReset(t,this._state,{rate:this.options.rate,focus:this.options.focus}),"zoom",t),this._isStarted=!1)},this.handleStart=hK(this.handleStartInner,this.options.throttle)}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.endTrigger,handler:this.handleEnd},{type:this.options.triggerOff,handler:this.handleReset}]}}Aa.type="view-zoom",Aa.defaultOptions={realtime:!0,focus:!0,trigger:"wheel",endTrigger:"pointerup",triggerOff:"dblclick",rate:1,throttle:100};class Ao extends As{constructor(t,e){super(t,Object.assign({},Ao.defaultOptions,e)),this.type=Ao.type,this.handleStartInner=t=>{this.formatScrollEvent(t),t&&(!this.options.shouldStart||this.options.shouldStart(t))&&(this._isStarted=!0,this._inited||this._initGrammars(),this.updateView("start",this.handleScrollStart(t,this._state,this.options),"scroll",t))},this.handleEnd=t=>{this._isStarted&&(this.formatScrollEvent(t),t&&(!this.options.shouldEnd||this.options.shouldEnd(t))&&(this.updateView("end",this.handleScrollEnd(t,this._state,this.options),"scroll",t),this._isStarted=!1))},this.handleStart=hK(this.handleStartInner,this.options.throttle)}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.endTrigger,handler:this.handleEnd}]}}Ao.type="view-scroll",Ao.defaultOptions={realtime:!0,reversed:!1,trigger:"wheel",endTrigger:"pointerup",throttle:100};class Al extends As{constructor(t,e){super(t,Object.assign({},Al.defaultOptions,e)),this.type=Al.type,this.handleStart=t=>{t&&(!this.options.shouldStart||this.options.shouldStart(t))&&(this._isStarted=!0,this._inited||this._initGrammars(),this.updateView("start",this.handleDragStart(t,this._state,{reversed:this.options.reversed}),"drag",t))},this.handleUpdateInner=t=>{this._isStarted&&t&&(!this.options.shouldUpdate||this.options.shouldUpdate(t))&&this.updateView("update",this.handleDragUpdate(t,this._state,{reversed:this.options.reversed}),"drag",t)},this.handleEnd=t=>{this._isStarted&&t&&(!this.options.shouldEnd||this.options.shouldEnd(t))&&(this.updateView("end",this.handleDragEnd(t,this._state,{reversed:this.options.reversed}),"drag",t),this._isStarted=!1)},this.handleUpdate=hK(this.handleUpdateInner,this.options.throttle)}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.endTrigger,handler:this.handleEnd},{type:this.options.updateTrigger,handler:this.handleUpdate}]}}Al.type="view-drag",Al.defaultOptions={realtime:!0,reversed:!1,trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",throttle:100};let Ah=t=>{if(t.componentType===tz.datazoom){let e=t.getStartEndValue();return e?[e.start,e.end]:null}return t.getScrollRange()},Ad=(t,e)=>{let i=t.getBounds();if(i&&!i.empty())return"y"===e?[i.y1,i.y2]:[i.x1,i.x2]},Au=(t=[0,1],e,i=0,r)=>{if(.001>Math.abs(i)||Math.abs(t[1]-t[0])>=1)return;let n=Math.abs(e[e.length-1]-e[0]);if(n<=0||Number.isNaN(n))return;let s=(r.reversed?-1:1)*i;if(s>0&&t[1]<1){let e=Math.min(1-t[1],s/n);return[t[0]+e,t[1]+e]}if(s<0&&t[0]>0){let e=Math.max(-t[0],s/n);return[t[0]+e,t[1]+e]}},Ac=(t,e,i)=>{let r={needUpdate:!1};return e&&Object.keys(e).forEach(n=>{let{scale:s,data:a,linkedComponent:o,rangeFactor:l,getCurrentRange:h}=e[n];if(o)r[n]=Au(Ah(o),Ad(o,n),t[n],i);else if(s){let o=s.getScale(),h=Au(s.getRangeFactor()||l,o.range(),t[n],i);h&&(e[n].rangeFactor=h,a?(e[n].filterValue=h,a.commit()):(s.setRangeFactor(h),s.commit()),r.needUpdate=!0,r[n]=h)}else{let e=(h?h():l)||[0,1],s=Au(e,[0,1],t[n],i);r[n]=s||e}}),r};class Ap{_formatPinchZoom(t){let e=t.scale;if((0,eC.Z)(this._lastScale))return this._lastScale=e,t;let i=e/this._lastScale;this._lastScale=e;let r=t.center;return t.zoomDelta=i,t.zoomX=r.x,t.zoomY=r.y,t}_formatWheelZoom(t){if(!t.ctrlKey)return t.zoomDelta=null,t.zoomX=null,t.zoomY=null,t;let e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}formatZoomEvent(t){return t?"pinch"===t.type?this._formatPinchZoom(t):this._formatWheelZoom(t):t}updateZoomRange(t=[0,1],e,i,r){var n;let{zoomDelta:s}=i,a=Math.abs(t[1]-t[0]);if(a>=1&&s>=1||a<=.001&&s<=1)return;let o=a*(s-1)*(null!==(n=r.rate)&&void 0!==n?n:1)/2,l=nd(t[0]-o,0,1),h=nd(t[1]+o,0,1);return[Math.min(l,h),Math.max(l,h)]}_handleZooming(t,e,i){let r={needUpdate:!1};return e&&Object.keys(e).forEach(n=>{let{scale:s,data:a,linkedComponent:o,rangeFactor:l,getCurrentRange:h}=e[n];if(o)r[n]=this.updateZoomRange(Ah(o),null,t,i);else if(s){let o=s.getScale(),h=this.updateZoomRange(l,o,t,i);h&&(e[n].rangeFactor=h,a?(e[n].filterValue=h,a.commit()):(s.setRangeFactor(h),s.commit()),r.needUpdate=!0,r[n]=h)}else{let e=(h?h():l)||[0,1],s=this.updateZoomRange(e,null,t,i);r[n]=s||e}}),r}handleZoomStart(t,e,i){if(!(0,eC.Z)(t.zoomDelta))return t.stopPropagation(),t.preventDefault(),i&&i.realtime?this._handleZooming(t,e,i):((0,eC.Z)(this._zoomPos)?this._zoomPos={zoomDelta:t.zoomDelta,zoomX:t.zoomX,zoomY:t.zoomY}:this._zoomPos.zoomDelta*=t.zoomDelta,null)}handleZoomEnd(t,e,i){this._lastScale=null;let r=i&&!1===i.realtime&&this._zoomPos?this._handleZooming(this._zoomPos,e,i):null;return this._zoomPos=null,r}handleZoomReset(t,e,i){let r={needUpdate:!1};return e&&Object.keys(e).forEach(t=>{let{scale:i,data:n,linkedComponent:s}=e[t],a=[0,1];s?r[t]=a:i?(e[t].rangeFactor=null,n?(e[t].filterValue=null,n.commit()):(i.setRangeFactor(a),i.commit()),r.needUpdate=!0,r[t]=a):(e[t].rangeFactor=e[t].initRangeFactor,r[t]=e[t].initRangeFactor)}),r}}class Af{formatPanScroll(t){return t}formatWheelScroll(t){return t.ctrlKey||0===t.deltaY&&0===t.deltaX||(t.scrollX=t.deltaX,t.scrollY=t.deltaY),t}formatScrollEvent(t){return t?"pan"===t.type?this.formatPanScroll(t):"wheel"===t.type?this.formatWheelScroll(t):t:t}handleScrollStart(t,e,i){if(t.stopPropagation(),t.preventDefault(),!(0,eC.Z)(t.scrollX)||!(0,eC.Z)(t.scrollY)){if(i&&i.realtime)return Ac({x:t.scrollX,y:t.scrollY},e,i);(0,eC.Z)(t.scrollX)||(this._scrollX=(0,eC.Z)(this._scrollX)?t.scrollX:this._scrollX+t.scrollX),(0,eC.Z)(t.scrollY)||(this._scrollY=(0,eC.Z)(this._scrollY)?t.scrollY:this._scrollY+t.scrollY)}}handleScrollEnd(t,e,i){if(!1===(null==i?void 0:i.realtime)&&((0,eC.Z)(this._scrollX)||(0,eC.Z)(this._scrollY))){let t=Ac({x:this._scrollX,y:this._scrollY},e,i);return this._scrollX=null,this._scrollY=null,t}return null}}class Ag{_shouldTriggerDragByPointer(t){if(!(0,eC.Z)(t.pointerId)){let e=(0,eC.Z)(this._pointerId)||this._pointerId===t.pointerId;return this._pointerId=t.pointerId,e}return!0}_shouldStart(t){return this._shouldTriggerDragByPointer(t)}_shouldUpdate(t){return this._shouldTriggerDragByPointer(t)}handleDragStart(t,e,i){if(this._shouldStart(t))return this._dragStart={x:t.canvasX,y:t.canvasY},null}handleDragUpdate(t,e,i){if(this._dragStart&&this._shouldUpdate(t)){if(null==i?void 0:i.realtime){let r=t.canvasX-this._dragStart.x;return Ac({x:r,y:t.canvasY-this._dragStart.y},e,i)}return null}}handleDragEnd(t,e,i){if(!this._dragStart)return;let r=!1===(null==i?void 0:i.realtime)?Ac({x:t.canvasX-this._dragStart.x,y:t.canvasY-this._dragStart.y},e,i):null;return this._pointerId=null,this._dragStart=null,r}}class Am extends As{constructor(t,e){super(t,lE({},Am.defaultOptions,e)),this.type=Am.type,this.handleRoamZoomStartInner=t=>{this.formatZoomEvent(t),t&&(!this.options.shouldStart||this.options.shouldStart(t))&&(this._inited||this._initGrammars(),this._isZoomStarted=!0,this.updateView("start",this.handleZoomStart(t,this._state,this.options.zoom),"zoom",t))},this.handleRoamZoomEnd=t=>{this._isZoomStarted&&(this.formatZoomEvent(t),t&&(!this.options.shouldEnd||this.options.shouldEnd(t))&&(this.updateView("end",this.handleZoomEnd(t,this._state,this.options.zoom),"zoom",t),this._isZoomStarted=!1))},this.handleRoamZoomReset=t=>{this._isZoomStarted&&t&&(!this.options.shouldReset||this.options.shouldReset(t))&&(this.updateView("reset",this.handleZoomReset(t,this._state,this.options.zoom),"zoom",t),this._isZoomStarted=!1)},this.handleRoamDragStart=t=>{t&&(!this.options.shouldStart||this.options.shouldStart(t))&&(this._inited||this._initGrammars(),this._isDragStarted=!0,this.updateView("start",this.handleDragStart(t,this._state,this.options.drag),"drag",t))},this.handleRoamDragUpdateInner=t=>{this._isDragStarted&&t&&(!this.options.shouldUpdate||this.options.shouldUpdate(t))&&this.updateView("update",this.handleDragUpdate(t,this._state,this.options.drag),"drag",t)},this.handleRoamDragEnd=t=>{this._isDragStarted&&t&&(!this.options.shouldEnd||this.options.shouldEnd(t))&&(this.updateView("end",this.handleDragEnd(t,this._state,this.options.drag),"drag",t),this._isDragStarted=!1)},this.handleRoamScrollStartInner=t=>{this.formatScrollEvent(t),t&&(!this.options.shouldStart||this.options.shouldStart(t))&&(this._inited||this._initGrammars(),this._isScrollStarted=!0,this.updateView("start",this.handleScrollStart(t,this._state,this.options.scroll),"scroll",t))},this.handleRoamScrollEnd=t=>{this._isScrollStarted&&(this.formatScrollEvent(t),t&&(!this.options.shouldEnd||this.options.shouldEnd(t))&&(this.updateView("end",this.handleScrollEnd(t,this._state,this.options.scroll),"scroll",t),this._isScrollStarted=!0))},this.handleRoamZoomStart=hK(this.handleRoamZoomStartInner,this.options.throttle),this.handleRoamDragUpdate=hK(this.handleRoamDragUpdateInner,this.options.throttle),this.handleRoamScrollStart=hK(this.handleRoamScrollStartInner,this.options.throttle)}getEvents(){var t,e,i;let r=[];return(null===(t=this.options.zoom)||void 0===t?void 0:t.enable)&&(this.options.zoom.trigger&&r.push({type:this.options.zoom.trigger,handler:this.handleRoamZoomStart}),this.options.zoom.endTrigger&&r.push({type:this.options.zoom.endTrigger,handler:this.handleRoamZoomEnd}),this.options.zoom.triggerOff&&r.push({type:this.options.zoom.triggerOff,handler:this.handleRoamZoomReset})),(null===(e=this.options.scroll)||void 0===e?void 0:e.enable)&&(this.options.scroll.trigger&&r.push({type:this.options.scroll.trigger,handler:this.handleRoamScrollStart}),this.options.scroll.trigger&&r.push({type:this.options.scroll.endTrigger,handler:this.handleRoamScrollEnd})),(null===(i=this.options.drag)||void 0===i?void 0:i.enable)&&(this.options.drag.trigger&&r.push({type:this.options.drag.trigger,handler:this.handleRoamDragStart}),this.options.drag.updateTrigger&&r.push({type:this.options.drag.updateTrigger,handler:this.handleRoamDragUpdate}),this.options.drag.endTrigger&&r.push({type:this.options.drag.endTrigger,handler:this.handleRoamDragEnd})),r}}Am.type="view-roam",Am.defaultOptions={zoom:{realtime:!0,enable:!0,focus:!0,trigger:"wheel",endTrigger:"pointerup",triggerOff:"dblclick",rate:1},scroll:{realtime:!0,enable:!1,reversed:!1,trigger:"wheel",endTrigger:"pointerup"},drag:{realtime:!0,enable:!0,reversed:!1,trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup"},throttle:100};class Av extends bZ{constructor(t,e){super(t,e),this.type=Av.type,this.handleStart=t=>{t&&(this.options.shouldStart?this.options.shouldStart(t):this.shouldHandle(t))&&(this._inited||this._initGrammars(),this._isActive||(this._isActive=!0,this.updateView({x:t.canvasX,y:t.canvasY},t)))},this.handleUpdateInner=t=>{t&&(this.options.shouldUpdate?this.options.shouldUpdate(t):this.shouldUpdate(t))&&this._isActive&&this.updateView({x:t.canvasX,y:t.canvasY},t)},this.handleEnd=t=>{t&&(this.options.shouldEnd?this.options.shouldEnd(t):this.shouldHandle(t))&&!this.options.triggerOff&&this._isActive&&(this._isActive=!1,this.updateView(null,t))},this.handleReset=t=>{t&&(this.options.shouldReset?this.options.shouldReset(t):this.shouldHandle(t))&&this._isActive&&(this.updateView(null,t),this._isActive=!1)},this.options=Object.assign({},Av.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this.handleUpdate=hK(this.handleUpdateInner,this.options.throttle)}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.updateTrigger,handler:this.handleUpdate},{type:this.options.endTrigger,handler:this.handleEnd},{type:this.options.triggerOff,handler:this.handleReset}]}_initStateByDim(t,e,i,r,n){let s=(0,eC.Z)(i)?null:(0,eT.Z)(i)?this.view.getScaleById(i):i;this._state[t]={scale:s,distortion:e,radius:r,radiusRatio:n}}_initGrammars(){let{enableX:t,enableY:e,scaleX:i,scaleY:r,distortionX:n,distortionY:s,radiusRatioX:a,radiusRatioY:o,radiusX:l,radiusY:h}=this.options;this._state={},!1!==t&&this._initStateByDim("x",n,i,l,a),!1!==e&&this._initStateByDim("y",s,r,h,o),this._inited=!0}updateView(t,e){let i=!1;t?Object.keys(this._state).forEach(e=>{let r=this._state[e];r.scale&&r.focus!==t[e]&&(i=!0,r.focus=t[e],r.scale.setFishEye({distortion:r.distortion,radius:r.radius,radiusRatio:r.radiusRatio,focus:t[e]}),r.scale.commit())}):Object.keys(this._state).forEach(t=>{let e=this._state[t];e.scale&&!(0,eC.Z)(e.focus)&&(i=!0,e.focus=null,e.scale.setFishEye(null),e.scale.commit())}),i&&this.view.run()}shouldHandle(t){var e,i,r;return this._marks?t.element&&this._marks&&this._marks.includes(t.element.mark):t.target===(null===(r=null===(i=null===(e=this.view)||void 0===e?void 0:e.renderer)||void 0===i?void 0:i.stage)||void 0===r?void 0:r.call(i))}shouldUpdate(t){if(this._marks)return t.element&&this._marks&&this._marks.includes(t.element.mark);let e=this.view.getViewBox();return t.canvasX>=e.x1&&t.canvasX<=e.x2&&t.canvasY>=e.y1&&t.canvasY<=e.y2}unbind(){super.unbind(),this._state&&Object.keys(this._state).forEach(t=>{let{scale:e}=this._state[t];e&&(e.setRangeFactor(null),e.commit())}),this._state=null}}Av.type="fish-eye",Av.defaultOptions={trigger:"pointerenter",updateTrigger:"pointermove",endTrigger:"pointerleave",distortionX:2,distortionY:2,throttle:100};class Ab{updateStates(t,e,i,r){return t&&t.length?(i&&r?e&&e.length?(this.toggleReverseStateOfElements(t,e,r),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,r):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach(t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}),t.forEach(t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})}toggleStateOfElements(t,e,i){e.forEach(t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}),t.forEach(t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})}addBothStateOfElements(t,e,i){this._marks.forEach(r=>{let n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(r),s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(r);(n||s)&&r.elements.forEach(r=>{t&&t.includes(r)?s&&r.addState(e):n&&r.addState(i)})})}addStateOfElements(t,e){this._marks.forEach(i=>{let r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);r&&i.elements.forEach(i=>{t&&t.includes(i)&&r&&i.addState(e)})})}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach(i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach(t=>{t.removeState(e)}),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach(e=>{this._statedElements.includes(e)&&e.removeState(t)})})}}class Ay extends sv{constructor(t){super(t),this.attribute=t,this.onSetStage(()=>{this.render()})}render(){var t;let e,i,r,n;let s=this.createOrUpdateChild("large-path",{},"path"),a=this.attribute.points,o=null!==(t=s.attribute.path)&&void 0!==t?t:new iK;o.clear();for(let t=0,s=a.length;t{this.render()})}render(){var t,e;let i,r;let n=this.createOrUpdateChild("large-path",{},"path"),s=this.attribute.points,a=null!==(t=this.attribute.size)&&void 0!==t?t:ra.size,o=null!==(e=n.attribute.path)&&void 0!==e?e:new iK;o.clear();let l=(0,ib.Z)(a)?a:(0,eJ.Fp)(a[0],a[1]);for(let t=0,e=s.length;to,u=!1;if(s=eJ.f7-eJ.Ho)e.moveTo(i+s*(0,eJ.mC)(o),r+s*(0,eJ.O$)(o),n),e.arc(i,r,s,o,l,!d,n),a>eJ.Ho&&(e.moveTo(i+a*(0,eJ.mC)(l),r+a*(0,eJ.O$)(l),n),e.arc(i,r,a,l,o,d,n));else{let{outerDeltaAngle:h,innerDeltaAngle:c,outerStartAngle:p,outerEndAngle:f,innerEndAngle:g,innerStartAngle:m}=t.getParsePadAngle(o,l),v=s*(0,eJ.mC)(p),b=s*(0,eJ.O$)(p),y=a*(0,eJ.mC)(g),x=a*(0,eJ.O$)(g);h<.001?u=!0:(e.moveTo(i+v,r+b,n),e.arc(i,r,s,p,f,!d,n)),!(a>eJ.Ho)||c<.001?(e.lineTo(i+y,r+x,n),u=!0):(e.lineTo(i+y,r+x,n),e.arc(i,r,a,g,m,d,n))}e.closePath()}(t,e,i,r,E[S],x,_),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),f&&(a?a(e,t.attribute,h):c&&(e.setCommonStyle(t,t.attribute,i,r,h),e.fillStyle=A?A.computeColor(T[S],w):d,e.fill())),g&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,r,h),e.stroke()))):"outside"!==S&&"inside"!==S||("inside"===S&&(e.save(),e.beginPath(),e.arc(i,r,_,0,eJ.f7,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,r,n,s,a,o){let{startAngle:l,endAngle:h}=t.getParsedAngle(),d=(0,eJ.Wn)(h-l),u=h>l,c=!1;if(a<=eJ.Ho)e.moveTo(i,r,n);else if(d>=eJ.f7-eJ.Ho)e.moveTo(i+a*(0,eJ.mC)(l),r+a*(0,eJ.O$)(l),n),e.arc(i,r,a,l,h,!u,n),e.lineTo(i+a*(0,eJ.mC)(h),r+a*(0,eJ.O$)(h),s),e.arc(i,r,a,h,l,u,s);else{let{innerouterDeltaAngle:t,innerouterStartAngle:d,innerouterEndAngle:p}=o(l,h),f=a*(0,eJ.mC)(d),g=a*(0,eJ.O$)(d),m=a*(0,eJ.mC)(p),v=a*(0,eJ.O$)(p);t<.001?c=!0:(e.moveTo(i+f,r+g,n),e.arc(i,r,a,d,p,!u,n),e.lineTo(i+m,r+v,s),e.arc(i,r,a,p,d,u,s))}e.closePath()}(t,e,i,r,E.top,E.bottom,"outside"===S?x:_,(e,i)=>{let{outerDeltaAngle:r,innerDeltaAngle:n,outerStartAngle:s,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===S?{innerouterDeltaAngle:r,innerouterEndAngle:a,innerouterStartAngle:s}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),f&&(a?a(e,t.attribute,h):c&&(e.setCommonStyle(t,t.attribute,i,r,h),e.fillStyle=A?A.computeColor(T[S],w):d,e.fill())),g&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,r,h),e.stroke())),"inside"===S&&e.restore())}draw(t,e,i,r){let n=rQ(t,null==r?void 0:r.theme).arc;this._draw(t,n,!1,i,r)}};AT=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],AT);let AC=!1,Ak=new eB(t=>{AC||(AC=!0,t(sB).to(AT).inSingletonScope(),t(sO).toService(sB))}),AM=class extends ft{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=n7}contains(t,e,i){let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).arc;r.highPerformanceSave();let{x:s,y:a,z:o,lastModelMatrix:l}=this.transform(t,n,r),h=e;if(r.camera){h=e.clone();let i=t.parent.globalTransMatrix;h.x=i.a*e.x+i.c*e.y+i.e,h.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=o;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,i,null,(t,e,i)=>!!d||(d=t.isPointInPath(h.x,h.y))),this.canvasRenderer.z=0,r.modelMatrix!==l&&s1.free(r.modelMatrix),r.modelMatrix=l,r.highPerformanceRestore(),d}};AM=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tC=0,tk=eH(sB),function(t,e){tk(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],AM);let AB=!1,AP=new eB((t,e,i,r)=>{AB||(AB=!0,t(pY).to(AM).inSingletonScope(),t(p9).toService(pY))});function AR(){AR.__loaded||(AR.__loaded=!0,as.RegisterGraphicCreator("arc3d",AE),rO.load(Ak),rO.load(AP))}AR.__loaded=!1;class AO extends fh{constructor(t){super(t),this.type="pyramid3d",this.numberType=so}doUpdateAABBBounds(){let t=rQ(this).polygon;this._AABBBounds.clear();let e=this.attribute,i=ru.graphicService.updatePyramid3dAABBBounds(e,rQ(this).polygon,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=nU(r);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){let{points:t}=this.attribute,e=t.map((e,i)=>{let r=3===i?t[0]:t[i+1],n=e.x-r.x;return 0===n?0:(e.y-r.y)/n}),i=t.map(t=>({p:t,d:0})),r=!1,n=0;for(let t=0;t=0;e--){let r=t[e];i.unshift({p:r,d:0})}for(let e=0;e{s.vertices.push([t.p.x,t.p.y,t.d])}),s.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),s.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),s.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),s.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),s.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),s.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),s.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],s}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return AO.NOWORK_ANIMATE_ATTR}}function AI(t){return new AO(t)}AO.NOWORK_ANIMATE_ATTR=nj;let AL=class extends oe{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=so}drawShape(t,e,i,r,n,s,a,o){var l;let h=rQ(t,null==s?void 0:s.theme).polygon,{fill:d=h.fill,stroke:u=h.stroke,face:c=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;let{light:f,camera:g}=n.stage||{},m=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,r,h);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,r,p,m,c,n,e,f,g,t,h,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,r,h),this.stroke(i,r,p,m,e))}stroke(t,e,i,r,n){let s=r.vertices;r.edges.forEach(r=>{let a=s[r[0]],o=s[r[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};n.beginPath(),n.moveTo(l.x,l.y,l.z),n.lineTo(h.x,h.y,h.z),n.stroke()})}fill(t,e,i,r,n,s,a,o,l,h,d,u){let c=nA.Get(s,oH.Color255),p=r.vertices,f=p.map(t=>a.view(t[0],t[1],t[2])[2]),g=[];r.polygons.forEach((t,e)=>{if(!n[e])return;g.push({faceIdx:e,polygon:t});let{polygon:i,normal:r}=t,s=f[i[0]],a=f[i[1]],o=f[i[2]],l=f[i[3]];t.ave_z=s+a+o+l}),g.sort((t,e)=>e.polygon.ave_z-t.polygon.ave_z),g.forEach(r=>{let{polygon:n,normal:l}=r.polygon,f=p[n[0]],g=p[n[1]],m=p[n[2]],v=p[n[3]],b={x:t+f[0],y:e+f[1],z:i+f[2]},y={x:t+g[0],y:e+g[1],z:i+g[2]},x={x:t+m[0],y:e+m[1],z:i+m[2]},_={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(b.x,b.y,b.z),a.lineTo(y.x,y.y,y.z),a.lineTo(x.x,x.y,x.z),a.lineTo(_.x,_.y,_.z),a.closePath(),u?u(a,h.attribute,d):(a.fillStyle=o?o.computeColor(l,c):s,a.fill())})}draw(t,e,i){let r=rQ(t).polygon;this._draw(t,r,!1,i)}};AL=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],AL);let AD=!1,AN=new eB(t=>{AD||(AD=!0,t(sU).to(AL).inSingletonScope(),t(sO).toService(sU))}),Aj=class extends ft{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=so}contains(t,e,i){let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).polygon;r.highPerformanceSave();let{x:s,y:a,z:o,lastModelMatrix:l}=this.transform(t,n,r),h=e;if(r.camera){h=e.clone();let i=t.parent.globalTransMatrix;h.x=i.a*e.x+i.c*e.y+i.e,h.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=o;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t,e,i)=>!!d||(d=t.isPointInPath(h.x,h.y)),(t,e,i)=>!1),this.canvasRenderer.z=0,r.modelMatrix!==l&&s1.free(r.modelMatrix),r.modelMatrix=l,r.highPerformanceRestore(),d}};Aj=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tM=0,tB=eH(sU),function(t,e){tB(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],Aj);let AF=!1,Az=new eB((t,e,i,r)=>{AF||(AF=!0,t(p4).to(Aj).inSingletonScope(),t(p9).toService(p4))});function AH(){AH.__loaded||(AH.__loaded=!0,as.RegisterGraphicCreator("pyramid3d",AI),rO.load(AN),rO.load(Az))}AH.__loaded=!1;let AG=new class t extends a3{constructor(){super(...arguments),this.time=oF.beforeFillStroke}drawShape(t,e,i,r,n,s,a,o,l,h,d,u){let{background:c,backgroundMode:p=l.backgroundMode,backgroundFit:f=l.backgroundFit}=t.attribute;if(c){if(t.backgroundImg){let i=t.resources.get(c);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){let i=rQ(t.parent).group,{scrollX:r=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(r,n)}let r=t.AABBBounds;this.doDrawImage(e,i.data,r,p,f),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if((0,ep.Z)(c)){let{stroke:i,fill:r,lineWidth:n=1,cornerRadius:s=0,expandX:a=0,expandY:o=0}=c;if(!i&&!r)return;e.beginPath();let{x:l,y:h,width:d,height:u}=function(t){let e=nU(t.attribute.boundsPadding),i=t.AABBBounds,r=i.x1,n=i.y1,s=i.width(),a=i.height();return(0,ib.Z)(e)?(r+=e,n+=e,s-=2*e,a-=2*e):(r+=e[3],n+=e[0],s-=e[1]+e[3],a-=e[0]+e[2]),{x:r,y:n,width:s,height:a}}(t);s?aD(e,l-a,h-o,d+2*a,u+2*o,s):e.rect(l-a,h-o,d+2*a,u+2*o),e.globalAlpha=1,r&&(e.fillStyle=r,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();let n=t.AABBBounds;e.rect(i,r,n.width(),n.height()),e.fillStyle=c,e.globalAlpha=1,e.fill()}}}};var AU=function(t,e){return function(i,r){e(i,r,t)}};let AV=["","repeat-x","repeat-y","repeat"],AW=class extends oe{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=sr,this.builtinContributions=[AG],this.init(t)}drawShape(t,e,i,r,n,s,a){let o=rQ(t).image,{width:l=o.width,height:h=o.height,repeatX:d=o.repeatX,repeatY:u=o.repeatY,cornerRadius:c=o.cornerRadius,image:p}=t.attribute,f=this.valid(t,o,a);if(!f)return;let{fVisible:g,sVisible:m,doFill:v,doStroke:b}=f;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,o),this.beforeRenderStep(t,e,i,r,v,!1,g,!1,o,n,a),v){if(a)a(e,t.attribute,o);else if(g){if(!p||!t.resources)return;let n=t.resources.get(p);if("success"!==n.state)return;let s=!1;0===c||(0,ev.Z)(c)&&c.every(t=>0===t)||(e.beginPath(),aD(e,i,r,l,h,c),e.save(),e.clip(),s=!0),e.setCommonStyle(t,t.attribute,i,r,o);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){let t=e.createPattern(n.data,AV[a]);e.fillStyle=t,e.translate(i,r,!0),e.fillRect(0,0,l,h),e.translate(-i,-r,!0)}else e.drawImage(n.data,i,r,l,h);s&&e.restore()}}this.afterRenderStep(t,e,i,r,v,!1,g,!1,o,n,a)}draw(t,e,i){let{image:r}=t.attribute;if(!r||!t.resources)return;let n=t.resources.get(r);if("loading"===n.state&&(0,eT.Z)(r))return void nM.improveImageLoading(r);if("success"!==n.state)return;let{context:s}=e.drawParams;if(!s)return;let a=rQ(t).image;this._draw(t,a,!1,i)}};AW=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),AU(0,eH(eU)),AU(0,eG(aK)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],AW);let AZ=!1,A$=new eB(t=>{AZ||(AZ=!0,t(sW).to(AW).inSingletonScope(),t(sO).toService(sW),t(aK).toService(a6),eW(t,aK))}),AY=class{constructor(){this.type="image",this.numberType=sr}contains(t,e,i){let{pickContext:r}=null!=i?i:{};return!!r&&!!t.AABBBounds.containsPoint(e)}};AY=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],AY);let AX=!1,AK=new eB((t,e,i,r)=>{AX||(AX=!0,t(pq).to(AY).inSingletonScope(),t(p9).toService(pq))}),Aq=!1,AJ=new eB((t,e,i,r)=>{Aq||(Aq=!0,t(pF).to(mC).inSingletonScope(),t(mC).toService(pF))});function AQ(){AQ.__loaded||(AQ.__loaded=!0,as.RegisterGraphicCreator("image",mp),rO.load(A$),rO.load(pI?AK:AJ))}AQ.__loaded=!1;let A0=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class A1 extends g0{constructor(t){super(t),this.type="rect3d",this.numberType=sh}findFace(){let t={polygons:[],vertices:[],edges:[]},e=rQ(this).rect3d,{x1:i,y1:r,x:n,y:s,length:a=(0,eJ.VV)(e.width,e.height)}=this.attribute,{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:r-s;for(let e=0;e{let a=s[r[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=s[r[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()})}fill(t,e,i,r,n,s,a,o){let l=nA.Get(n,oH.Color255),h=r.vertices,d=h.map(t=>s.view(t[0],t[1],t[2])[2]),u=[];r.polygons.forEach((t,e)=>{u.push({faceIdx:e,polygon:t});let{polygon:i,normal:r}=t,n=d[i[0]],s=d[i[1]],a=d[i[2]],o=d[i[3]];t.ave_z=n+s+a+o}),u.sort((t,e)=>e.polygon.ave_z-t.polygon.ave_z),u.forEach(r=>{let{polygon:d,normal:u}=r.polygon,c=h[d[0]],p=h[d[1]],f=h[d[2]],g=h[d[3]],m={x:t+c[0],y:e+c[1],z:i+c[2]},v={x:t+p[0],y:e+p[1],z:i+p[2]},b={x:t+f[0],y:e+f[1],z:i+f[2]},y={x:t+g[0],y:e+g[1],z:i+g[2]};s.beginPath(),s.moveTo(m.x,m.y,m.z),s.lineTo(v.x,v.y,v.z),s.lineTo(b.x,b.y,b.z),s.lineTo(y.x,y.y,y.z),s.closePath(),o?o(s,null,null):(s.fillStyle=a?a.computeColor(u,l):n,s.fill())})}draw(t,e,i){let r=rQ(t).rect;this._draw(t,r,!1,i)}};A5=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],A5);let A3=!1,A4=new eB(t=>{A3||(A3=!0,t(sF).to(A5).inSingletonScope(),t(sO).toService(sF))});new il;let A6=class extends ft{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=sh}contains(t,e,i){let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=rQ(t).rect;r.highPerformanceSave();let{x:s,y:a,z:o,lastModelMatrix:l}=this.transform(t,n,r),h=e;if(r.camera){h=e.clone();let i=t.parent.globalTransMatrix;h.x=i.a*e.x+i.c*e.y+i.e,h.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=o;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,i,null,(t,e,i)=>!!d||(d=t.isPointInPath(h.x,h.y))),this.canvasRenderer.z=0,r.modelMatrix!==l&&s1.free(r.modelMatrix),r.modelMatrix=l,r.highPerformanceRestore(),d}};A6=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tP=0,tR=eH(sF),function(t,e){tR(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],A6);let A8=!1,A7=new eB((t,e,i,r)=>{A8||(A8=!0,t(p1).to(A6).inSingletonScope(),t(p9).toService(p1))});function A9(){A9.__loaded||(A9.__loaded=!0,as.RegisterGraphicCreator("rect3d",A2),rO.load(A4),rO.load(A7))}A9.__loaded=!1;class St extends nF{constructor(t){super(t),this.type="glyph",this.numberType=se,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach(t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)}),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach(t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})})}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,r){super.setAttribute(t,e,i,r),this.subGraphic.forEach(t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()})}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach(t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()})}translate(t,e){return super.translate(t,e),this.subGraphic.forEach(t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()}),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach(t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()}),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach(t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()}),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach(t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()}),this}rotate(t){return super.rotate(t),this.subGraphic.forEach(t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()}),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach(t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()}),this}doUpdateAABBBounds(){this._AABBBounds.clear();let t=ru.graphicService.updateGlyphAABBBounds(this.attribute,rQ(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if(!((null===(i=this.currentStates)||void 0===i?void 0:i.length)!==t.length||t.some((t,e)=>this.currentStates[e]!==t)))return;let r={},n=this.subGraphic.map(()=>({}));t.forEach(e=>{var i;let s=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];s&&(Object.assign(r,s.attributes),(null===(i=s.subAttributes)||void 0===i?void 0:i.length)&&n.forEach((t,e)=>{Object.assign(t,s.subAttributes[e])}))}),this.subGraphic.forEach((i,r)=>{i.updateNormalAttrs(n[r]),i.applyStateAttrs(n[r],t,e)}),this.updateNormalAttrs(r),this.currentStates=t,this.applyStateAttrs(r,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach(e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null}),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){let t=new St(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map(t=>t.clone())),t}getNoWorkAnimateAttr(){return St.NOWORK_ANIMATE_ATTR}}function Se(t){return new St(t)}St.NOWORK_ANIMATE_ATTR=nj;let Si=class{constructor(){this.numberType=se}drawShape(t,e,i,r,n,s,a,o){n.drawContribution&&t.getSubGraphic().forEach(t=>{let l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,r,n,s,a,o)})}draw(t,e,i,r){let{context:n}=i;if(!n||(n.highPerformanceSave(),!i.drawContribution))return;let s=rQ(t),a=t.getSubGraphic();a.length&&a.forEach(t=>{i.drawContribution.renderItem(t,i,{theme:s})}),n.highPerformanceRestore()}};Si=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],Si);let Sr=!1,Sn=new eB(t=>{Sr||(Sr=!0,t(sV).to(Si).inSingletonScope(),t(sO).toService(sV))}),Ss=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=se}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=null==i?void 0:i.pickerService;if(n){let r=!1;return t.getSubGraphic().forEach(t=>{if(r)return;let s=n.pickItem(t,e,null,i);r=!(!s||!s.graphic)}),r}return!1}};Ss=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tO=0,tI=eH(sV),function(t,e){tI(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],Ss);let Sa=!1,So=new eB((t,e,i,r)=>{Sa||(Sa=!0,t(p8).to(Ss).inSingletonScope(),t(p9).toService(p8))}),Sl=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=se}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;let{pickContext:r}=null!=i?i:{};if(!r)return!1;let n=null==i?void 0:i.pickerService;if(n){let r=!1;return t.getSubGraphic().forEach(t=>{r||(r=!!n.pickItem(t,e,null,i))}),r}return!1}};Sl=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(tL=0,tD=eH(sV),function(t,e){tD(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],Sl);let Sh=!1,Sd=new eB((t,e,i,r)=>{Sh||(Sh=!0,t(pZ).to(Sl).inSingletonScope(),t(Sl).toService(pZ))});function Su(){Su.__loaded||(Su.__loaded=!0,as.RegisterGraphicCreator("glyph",Se),rO.load(Sn),rO.load(pI?So:Sd))}Su.__loaded=!1;let Sc=500,Sp=500,Sf=1,Sg=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;let{nativeCanvas:i,width:r=Sc,height:n=Sp,dpr:s=Sf,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=r*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=r,this._displayHeight=n,this._dpr=s,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,r){return this._context.getImageData(t,e,i,r)}convertToBlob(t){throw Error("暂未实现")}transferToImageBitmap(){throw Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};Sg.env="browser",Sg=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],Sg);let Sm=[0,0,0],Sv=(t,e,i,r,n,s,a,o)=>{if(o)for(;i>e;)i-=eJ.f7;else for(;ie?1:-1),h=e,d=h;for(;d!==i;){let e=4*Math.tan(Math.abs((d=l>0?Math.min(d+l,i):Math.max(d+l,i))-h)/4)/3,o=d0&&(s0.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(s0.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){let t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){let t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,r,n=!0){this.translate(i,r,!1),this.scale(t,e,!1),this.translate(-i,-r,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,r,n,s,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*r,o*n,o*s),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,r,n,s,a=!0){this.matrix.multiply(t,e,i,r,n,s),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){let i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,r=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),r&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,r=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),r&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,r,n,s,a){if(a=a||0,this.camera){let o=[];Sv(o,r,n,t,e,i,i,s);for(let t=0;ta);t++){let e=b.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(g,-2*y),u.lineTo(g,0),u.fillStyle=e,u.closePath(),u.fill()}let x=u.getImageData(0,0,c,p);return d.width=x.width,d.height=x.height,u.putImageData(x,0,0),(f=t.createPattern(d,"no-repeat"))&&wG.Set(e,i,r,s,a,f,c,p),f}(a,this.stops,t,e,h,i,r,o,l),s=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,r){this.nativeContext.fillRect(t,e,i,r)}clearRect(t,e,i,r){this.nativeContext.clearRect(t,e,i,r)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(hC(Sm,[t,e,i],this.modelMatrix),t=Sm[0],e=Sm[1],i=Sm[2]);let r=this.camera.vp(t,e,i);t=r.x,e=r.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(hC(Sm,[t,e,i],this.modelMatrix),t=Sm[0],e=Sm[1],i=Sm[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,r){if(r=r||0,this.camera){this.modelMatrix&&(hC(Sm,[e,i,r],this.modelMatrix),e=Sm[0],i=Sm[1],r=Sm[2]);let t=this.camera.vp(e,i,r);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,r){return this.nativeContext.getImageData(t,e,i,r)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,e=ru.global.measureTextMethod){var i,r;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=ru.graphicUtil.createTextMeasureInstance({},{},()=>this.canvas.nativeCanvas));let n=null!==(i=this.fontFamily)&&void 0!==i?i:i2.fontFamily,s=null!==(r=this.fontSize)&&void 0!==r?r:i2.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===s||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=s,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){let e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,r){this.nativeContext.strokeRect(t,e,i,r)}strokeText(t,e,i,r){if(r=r||0,this.camera){this.modelMatrix&&(hC(Sm,[e,i,r],this.modelMatrix),e=Sm[0],i=Sm[1],r=Sm[2]);let t=this.camera.vp(e,i,r);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){let t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,r,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,r,n[0]);let s=Object.create(n[0]);return n.forEach((t,e)=>{0!==e&&Object.assign(s,t)}),this._setCommonStyle(t,e,i,r,s)}return this._setCommonStyle(t,e,i,r,n)}_setCommonStyle(t,e,i,r,n){let s=this.nativeContext;n||(n=this.fillAttributes);let{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12?(s.globalAlpha=a*o,s.fillStyle=aP(this,l,t,i,r)):s.globalAlpha=a*o}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);let r=Object.create(i[0]);return i.forEach((t,e)=>{0!==e&&Object.assign(r,t)}),this._setShadowBlendStyle(t,e,r)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){let r=this.nativeContext;i||(i=this.fillAttributes);let{opacity:n=i.opacity,shadowBlur:s=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:d=i.globalCompositeOperation}=e;n<=1e-12||(s||o||l?(r.shadowBlur=s*this.dpr,r.shadowColor=a,r.shadowOffsetX=o*this.dpr,r.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(r.shadowBlur=0,r.shadowOffsetX=0,r.shadowOffsetY=0),h?(r.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(r.filter="blur(0px)",this._clearFilterStyle=!1),d?(r.globalCompositeOperation=d,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(r.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,r,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,r,n[0]);let s=Object.create(n[0]);return n.forEach((t,e)=>{0!==e&&Object.assign(s,t)}),this._setStrokeStyle(t,e,i,r,s)}return this._setStrokeStyle(t,e,i,r,n)}_setStrokeStyle(t,e,i,r,n){let s=this.nativeContext;n||(n=this.strokeAttributes);let{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){let{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:d=n.lineJoin,lineDash:u=n.lineDash,lineCap:c=n.lineCap,miterLimit:p=n.miterLimit}=e;s.globalAlpha=a*o,s.lineWidth=aB(this,l,this.dpr),s.strokeStyle=aP(this,h,t,i,r),s.lineJoin=d,s.setLineDash(u),s.lineCap=c,s.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){let r=this.nativeContext;e||(e=this.textAttributes);let{scaleIn3d:n=e.scaleIn3d}=t;t.font?r.font=t.font:r.font=mP(t,e,n&&this.camera&&this.camera.getProjectionScale(i));let{fontFamily:s=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=s,this.fontSize=a,r.textAlign="left",r.textBaseline="alphabetic"}setTextStyle(t,e,i){var r,n;let s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=mP(t,e,this.camera&&this.camera.getProjectionScale(i));let{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign=null!==(r=t.textAlign)&&void 0!==r?r:e.textAlign,s.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,r,n,s){this._clearMatrix.setValue(t,e,i,r,n,s)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach(t=>s0.free(t)),this.stack.length=0}};Sb.env="browser",Sb=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object,Number])],Sb);let Sy=class extends Sg{constructor(t){super(t)}init(t){let{container:e}=t;if("string"==typeof e){let t=ru.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Sb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;let{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,t.style&&this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){let t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;let{width:e=this._displayWidth,height:i=this._displayHeight,dpr:r=this._dpr,x:n=this._x,y:s=this._y}=t,{nativeCanvas:a}=this;a.width=e*r,a.height=i*r,a.style&&this.setCanvasStyle(a,n,s,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,r,n){this.controled&&(t.style.width=`${r}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Sx(t,e){return new eB(i=>{i(rI).toDynamicValue(()=>e=>new t(e)).whenTargetNamed(t.env),i(rL).toDynamicValue(()=>(t,i)=>new e(t,i)).whenTargetNamed(e.env)})}Sy.env="browser";let S_=Sx(Sy=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],Sy),Sb);var Sw=function(t,e){return function(i,r){e(i,r,t)}};let SA=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=ru.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort((t,e)=>t.order-e.order)}pick(t,e,i){let r,n={graphic:null,group:null};i.pickerService=this;let s=i.bounds.width(),a=i.bounds.height();if(!(new il).setValue(0,0,s,a).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);let o=new e3(1,0,0,1,0,0);for(let s=t.length-1;s>=0&&!(n=t[s].isContainer?this.pickGroup(t[s],e,o,i):this.pickItem(t[s],e,o,i)).graphic;s--)r||(r=n.group);if(n.graphic||(n.group=r),this.pickContext&&(this.pickContext.inuse=!1),n.graphic){let t=n.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(n.params={shadowTarget:n.graphic},n.graphic=t.shadowHost)}return n}containsPoint(t,e,i){var r;return!!(null===(r=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===r?void 0:r.graphic)}pickGroup(t,e,i,r){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;let s=r.pickContext,a=s.modelMatrix;if(s.camera){let e=t.transMatrix,i=s1.allocate();if(ae(i,e),a){if(i){let t=s1.allocate();s.modelMatrix=ai(t,a,i),s1.free(i)}}else ae(i,t.globalTransMatrix),s.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(s.isContainer){let i=new iy(e.x,e.y),a=rQ(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(s,i,l,r)}else{let a=new iy(e.x,e.y);l.transformPoint(a,a);let o=rQ(t).group,{scrollX:h=o.scrollX,scrollY:d=o.scrollY}=t.attribute;a.x-=h,a.y-=d;let u=this.pickItem(s,a,i,r);u&&u.graphic&&(n.graphic=u.graphic,n.params=u.params)}return!!n.graphic||!!n.group},!0,!!s.camera),s.modelMatrix!==a&&s1.free(s.modelMatrix),s.modelMatrix=a,n.graphic||n.group||!c||t.stage.camera||(n.group=t),s0.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};SA=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),Sw(0,eH(eU)),Sw(0,eG(s5)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],SA);var SS=function(t,e){return function(i,r){e(i,r,t)}};let SE=class extends SA{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",(t,e,i)=>{this.configure(i,e)}),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach(t=>{this.pickerMap.set(t.numberType,t)}),super._init()}configure(t,e){this.pickCanvas=rN.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,r){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),SS(0,eH(eU)),SS(0,eG(p9)),SS(1,eH(sZ)),SS(2,eH(eU)),SS(2,eG(s5)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object,Object,Object])],SE);let ST=class{constructor(){this.type="group",this.numberType=si}contains(t,e,i){return!1}};ST=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],ST);let SC=new eB((t,e,i,r)=>{SC.__vloaded||(SC.__vloaded=!0,t(p7).to(ST).inSingletonScope(),t(p9).toService(p7),eW(t,p9))});SC.__vloaded=!1;let Sk=new eB((t,e,i,r)=>{i(SE)||t(SE).toSelf().inSingletonScope(),i(sK)?r(sK).toService(SE):t(sK).toService(SE)}),SM=class{constructor(){this._uid=eM.GenAutoIncrementId(),this.viewBox=new il,this.modelMatrix=new e3(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,r,n,s){this.modelMatrix.setValue(t,e,i,r,n,s)}getViewBoxTransform(){return this.modelMatrix}};SM=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],SM);let SB=ea=class extends SM{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${ea.idprefix}_${ea.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=ru.global,this.viewBox=new il,this.modelMatrix=new e3(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){let e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>r)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);let t=new IntersectionObserver((t,e)=>{t.forEach(t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting})});t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){let e;let i=this.global.createCanvas({width:t.width,height:t.height});if(!(e="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement()))throw Error("发生错误,containerId可能传入有误");t.offscreen?e=null:e.appendChild(i);let r={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,container:e,id:ea.GenerateCanvasId(),canvasControled:!0};this.canvas=new Sy(r)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(!(i=this.global.getElementById(t.canvas)))throw Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw Error("发生错误,传入的canvas不正确");let r=t.width,n=t.height;if(null==r||null==n||!t.canvasControled){let t=i.getBoundingClientRect();r=t.width,n=t.height}let s=t.dpr;null==s&&(s=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/r),this.canvas=new Sy({width:r,height:n,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){let t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){let e=this.viewBox,i=this.getContext(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};SB.env="browser",SB.idprefix="visactor_window",SB.prefix_count=0,SB=ea=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],SB);let SP=new eB(t=>{t(SB).toSelf(),t(rF).toDynamicValue(t=>t.container.get(SB)).whenTargetNamed(SB.env)}),SR=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new il}removeDom(t){return!1}createDom(t){return null}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){let e=fetch(t).then(t=>t.json());return e.then(t=>({data:t,state:"success"})).catch(()=>({data:null,state:"fail"})),e}loadArrayBuffer(t){return fetch(t).then(t=>t.arrayBuffer()).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadBlob(t){return fetch(t).then(t=>t.blob()).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};SR=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],SR);class SO{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function SI(t,e=!1){let i=document.createElement("img");if(i.crossOrigin="anonymous",e){let e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return(i.src=t,i.complete)?Promise.resolve(i):new Promise((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(Error("加载失败"))}})}let SL=class extends SR{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){let r,n;let{clientX:s,clientY:a}=t,o=e.getBoundingClientRect(),l=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;return l&&(r=o.width/l.offsetWidth,n=o.height/l.offsetHeight),{x:(s-o.left)/((0,ef.Z)(r)?r:1),y:(a-o.top)/((0,ef.Z)(n)?n:1)}}return{x:t.offsetX,y:t.offsetY}}getNativeAABBBounds(t){let e=t;return("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild).lastChild&&(e=e.lastChild.firstChild),e.getBoundingClientRect)?new SO(e.getBoundingClientRect()):new il}removeDom(t){return t.parentElement.removeChild(t),!0}createDom(t){let{tagName:e="div",width:i,height:r,style:n,parent:s}=t,a=document.createElement(e);if(n&&((0,eT.Z)(n)?a.setAttribute("style",n):Object.keys(n).forEach(t=>{a.setAttribute(t,n[t])})),null!=i&&(a.style.width=`${i}px`),null!=r&&(a.style.height=`${r}px`),s){let t=(0,eT.Z)(s)?this.getElementById(s):s;t&&t.appendChild&&t.appendChild(a)}return a}loadImage(t){return SI(t,!1).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadSvg(t){return SI(t,!0).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}createCanvas(t){var e,i;let r=document.createElement("canvas");t.id&&(r.id=null!==(e=t.id)&&void 0!==e?e:eM.GenAutoIncrementId().toString());let n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.width=t.width*n,r.height=t.height*n),r}createOffscreenCanvas(t){var e;let i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;(e="string"==typeof t?document.getElementById(t):t)&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,r=t.offsetParent;for(;null!==r;)i+=r.offsetTop,r=r.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,r=t.offsetParent;for(;null!==r;)i+=r.offsetLeft,r=r.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,r=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent;return{top:i,left:r}}};SL=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[])],SL);let SD=new eB(t=>{SD.isBrowserBound||(SD.isBrowserBound=!0,t(SL).toSelf().inSingletonScope(),t(eY).toService(SL))});function SN(t,e=!0){var i;SN.__loaded||(SN.__loaded=!0,t.load(SD),t.load(S_),t.load(SP),e&&((i=t).load(SC),i.load(Sk)))}SD.isBrowserBound=!1,SN.__loaded=!1;let Sj=class extends Sb{constructor(t,e){super(t,e);let i=t.nativeCanvas.getContext("2d");if(!i)throw Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new e3(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};Sj.env="node",Sj=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object,Number])],Sj);let SF=class extends Sg{constructor(t){super(t)}init(){this._context=new Sj(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&r6(this._nativeCanvas.release)&&this._nativeCanvas.release()}};SF.env="node";let Sz=Sx(SF=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],SF),Sj),SH=class extends SM{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){let e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:eM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new SF(i)}createWindowByCanvas(t){let e=t.canvas,i=t.width,r=t.height;null!=i&&null!=r&&t.canvasControled||(i=e.width,r=e.height),this.canvas=new SF({width:i,height:r,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};SH.env="node",SH=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN(),(eo=0,el=eH(eX),function(t,e){el(t,e,0)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],SH);let SG=new eB(t=>{t(SH).toSelf(),t(rF).toDynamicValue(t=>t.container.get(SH)).whenTargetNamed(SH.env)}),SU=class extends SR{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){let e=fetch(t).then(t=>t.json());return e.then(t=>({data:t,state:"success"})).catch(()=>({data:null,state:"fail"})),e}loadArrayBuffer(t){return fetch(t).then(t=>t.arrayBuffer()).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadImage(t){let{loadImage:e}=this.pkg;return e?e(t).then(t=>({loadState:t?"success":"fail",data:t})).catch(()=>({loadState:"fail",data:null})):Promise.reject(Error("node-canvas loadImage could not be found!"))}loadSvg(t){let e=this.pkg.Resvg;if(!e)return Promise.reject(Error("@resvg/resvg-js svgParser could not be found!"));let i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return nQ.call(t)}}getCancelAnimationFrame(){return t=>{nQ.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};SU=function(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}([eN()],SU);let SV=new eB(t=>{SV.isNodeBound||(SV.isNodeBound=!0,t(SU).toSelf().inSingletonScope(),t(eY).toService(SU))});function SW(t,e=!0){SW.__loaded||(SW.__loaded=!0,t.load(SV),t.load(Sz),t.load(SG))}SV.isNodeBound=!1,SW.__loaded=!1;uL.useRegisters([()=>{ld.registerGrammar("scale",pf,"scales")},()=>{ld.registerGrammar("coordinate",py,"coordinates")},()=>{ld.registerMark(tF.cell,pA)},()=>{ld.registerMark(tF.interval,pS)},()=>{ld.registerGraphicComponent(tG.lineAxis,(t,e)=>new vR(t,e)),ld.registerGraphicComponent(tG.circleAxis,t=>new vL(t)),ld.registerComponent(tz.axis,vz)},()=>{ld.registerGraphicComponent(tV.discreteLegend,t=>new vQ(t)),ld.registerGraphicComponent(tV.colorLegend,t=>new bV(t)),ld.registerGraphicComponent(tV.sizeLegend,t=>new bW(t)),ld.registerComponent(tz.legend,bQ),cI(bY,b$),ld.registerInteraction(bX.type,bX)},()=>{ld.registerGraphicComponent(tz.slider,t=>new bU(t)),ld.registerComponent(tz.slider,b2),cI(bY,b$),ld.registerInteraction(b0.type,b0)},()=>{ld.registerGraphicComponent(tz.label,t=>new yC(t)),ld.registerComponent(tz.label,yM)},()=>{ld.registerGraphicComponent(tz.datazoom,t=>new yZ(t)),ld.registerComponent(tz.datazoom,yX),cI(bY,b$),ld.registerInteraction(y$.type,y$)},()=>{ld.registerGraphicComponent(t$.continuousPlayer,t=>new xt(t)),ld.registerGraphicComponent(t$.discretePlayer,t=>new xe(t)),ld.registerComponent(tz.player,xs),cI(bY,b$),ld.registerInteraction(xi.type,xi)},()=>{ld.registerGraphicComponent(tz.title,t=>new xd(t)),ld.registerComponent(tz.title,xc)},()=>{ld.registerGraphicComponent(tU.lineAxisGrid,(t,e)=>new xm(t,e)),ld.registerGraphicComponent(tU.circleAxisGrid,(t,e)=>new xb(t,e)),ld.registerComponent(tz.grid,x_)},()=>{ld.registerGraphicComponent(tz.scrollbar,t=>new vK(t)),ld.registerComponent(tz.scrollbar,xk),cI(bY,b$),ld.registerInteraction(xw.type,xw)},()=>{ld.registerTransform("bin",{transform:xM,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("contour",{transform:xO,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("sort",{transform:xj,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("filter",{transform:xF,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("join",{transform:xq,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("kde",{transform:xK,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("map",{transform:xz,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("pick",{transform:xQ,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("range",{transform:x0,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("stack",{transform:x4,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("funnel",{transform:x9,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("pie",{transform:_t,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("circularRelation",{transform:_r,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("fold",{transform:x6,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("unfold",{transform:x7,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("identifier",{transform:_v,markPhase:"beforeJoin"},!0)},()=>{ld.registerTransform("sampling",{transform:_p,markPhase:"afterEncode"},!0)},()=>{ld.registerTransform("markoverlap",{transform:_g,markPhase:"afterEncode"},!0)},()=>{ld.registerTransform("dodge",{transform:_b,markPhase:"afterEncodeItems"},!0)},()=>{ld.registerTransform("jitter",{transform:_w,markPhase:"afterEncodeItems"},!0)},()=>{ld.registerTransform("jitterX",{transform:__,markPhase:"afterEncodeItems"},!0)},()=>{ld.registerTransform("jitterY",{transform:_x,markPhase:"afterEncodeItems"},!0)},()=>{ld.registerTransform("symmetry",{transform:_S,markPhase:"afterEncodeItems"},!0)},()=>{ld.registerAnimationType("clipIn",_E)},()=>{ld.registerAnimationType("clipOut",_T)},()=>{ld.registerAnimationType("fadeIn",_C)},()=>{ld.registerAnimationType("fadeOut",_k)},()=>{ld.registerAnimationType("growAngleIn",_N)},()=>{ld.registerAnimationType("growAngleOut",_z)},()=>{ld.registerAnimationType("growCenterIn",_M)},()=>{ld.registerAnimationType("growCenterOut",_B)},()=>{ld.registerAnimationType("growHeightIn",_O)},()=>{ld.registerAnimationType("growHeightOut",_I)},()=>{ld.registerAnimationType("growIntervalIn",_2)},()=>{ld.registerAnimationType("growIntervalOut",_5)},()=>{ld.registerAnimationType("growPointsIn",_Y)},()=>{ld.registerAnimationType("growPointsOut",_X)},()=>{ld.registerAnimationType("growPointsXIn",_q)},()=>{ld.registerAnimationType("growPointsXOut",_J)},()=>{ld.registerAnimationType("growPointsYIn",_0)},()=>{ld.registerAnimationType("growPointsYOut",_1)},()=>{ld.registerAnimationType("growRadiusIn",_U)},()=>{ld.registerAnimationType("growRadiusOut",_Z)},()=>{ld.registerAnimationType("growWidthIn",_P)},()=>{ld.registerAnimationType("growWidthOut",_R)},()=>{ld.registerAnimationType("moveIn",_3)},()=>{ld.registerAnimationType("moveOut",_4)},()=>{ld.registerAnimationType("rotateIn",wt)},()=>{ld.registerAnimationType("rotateOut",we)},()=>{ld.registerAnimationType("scaleIn",_6)},()=>{ld.registerAnimationType("scaleOut",_8)},()=>{ld.registerAnimationType("update",_9)},()=>{ld.registerInteraction(wi.type,wi)},()=>{cI(ws,Ab),ld.registerInteraction(ws.type,ws)},()=>{cI(wa,Ab),ld.registerInteraction(wa.type,wa)},()=>{ld.registerInteraction(wo.type,wo)},()=>{ld.registerInteraction(wl.type,wl)},()=>{ld.registerInteraction(wh.type,wh)},()=>{ld.registerInteraction(wd.type,wd)},()=>{ld.registerInteraction(wu.type,wu)},()=>{ld.registerInteraction(wy.type,wy)},()=>{ld.registerInteraction(wx.type,wx)},()=>{cI(w_,b$),ld.registerInteraction(w_.type,w_)},()=>{cI(ww,b$),ld.registerInteraction(ww.type,ww)},()=>{ld.registerInteraction(wA.type,wA)},()=>{ld.registerInteraction(wP.type,wP)},()=>{ld.registerInteraction(wI.type,wI)},()=>{ld.registerInteraction(An.type,An)},()=>{cI(Aa,Ap),ld.registerInteraction(Aa.type,Aa)},()=>{cI(Ao,Af),ld.registerInteraction(Ao.type,Ao)},()=>{cI(Al,Ag),ld.registerInteraction(Al.type,Al)},()=>{cI(Am,Ap),cI(Am,Ag),cI(Am,Af),ld.registerInteraction(Am.type,Am)},()=>{ld.registerInteraction(Av.type,Av)},()=>{AA(),vg(),ld.registerGraphic(tF.circle,vr)},()=>{AA(),w0(),ld.registerGraphic(tF.arc,wj)},()=>{AA(),AR(),ld.registerGraphic(tF.arc3d,AE)},()=>{AA(),AH(),ld.registerGraphic(tF.pyramid3d,AI)},()=>{AA(),yU(),ld.registerGraphic(tF.area,yI)},()=>{AA(),pk(),ld.registerGraphic(tF.group,sb)},()=>{AA(),AQ(),ld.registerGraphic(tF.image,mp)},()=>{AA(),A9(),ld.registerGraphic(tF.rect3d,A2)},()=>{AA(),fo(),ld.registerGraphic(tF.line,pP)},()=>{AA(),vM(),ld.registerGraphic(tF.path,vb)},()=>{AA(),ml(),ld.registerGraphic(tF.rect,g1)},()=>{AA(),fo(),ld.registerGraphic(tF.rule,pP)},()=>{AA(),vM(),ld.registerGraphic(tF.shape,vb)},()=>{AA(),gD(),ld.registerGraphic(tF.symbol,gS)},()=>{AA(),mY(),mB(),ld.registerGraphic(tF.text,mN)},()=>{AA(),fS(),ld.registerGraphic(tF.polygon,fd)},()=>{AA(),mB(),ld.registerGraphic(tF.richtext,my)},()=>{AA(),gD(),ld.registerGraphic(tF.cell,gS)},()=>{AA(),ml(),w0(),ld.registerGraphic(tF.interval,g1)},()=>{AA(),Su(),ld.registerGraphic(tF.glyph,Se)},()=>{AA(),vM(),ld.registerGraphic(tF.largeRects,t=>new Ay(t))},()=>{AA(),vM(),ld.registerGraphic(tF.largeSymbols,t=>new Ax(t))}]),hB()?SN(rO):function(){hM();let t=ru.global&&ru.global.env;return t?"node"===t:!l}()&&SW(rO)},464283:function(t,e,i){"use strict";var r=i(876058);e.Z=t=>Array.isArray?Array.isArray(t):(0,r.Z)(t,"Array")},843020:function(t,e){"use strict";e.Z=t=>null==t},131045:function(t,e,i){"use strict";var r=i(876058);e.Z=(t,e=!1)=>{let i=typeof t;return e?"number"===i:"number"===i||(0,r.Z)(t,"Number")}},200007:function(t,e){"use strict";e.Z=t=>{let e=typeof t;return null!==t&&"object"===e||"function"===e}},681747:function(t,e,i){"use strict";var r=i(876058);e.Z=(t,e=!1)=>{let i=typeof t;return e?"string"===i:"string"===i||(0,r.Z)(t,"String")}},876058:function(t,e){"use strict";e.Z=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`},269658:function(t,e,i){"use strict";var r=i(131045);e.Z=t=>(0,r.Z)(t)&&Number.isFinite(t)},906324:function(t,e){"use strict";let i=(t,e=0)=>{let i="",r=e-1;for(;r>=0;)i=`${i}${t}`,r-=1;return i};e.Z=(t,e,r=" ",n="right")=>{let s=t+"",a=e-s.length;return a<=0?s:"left"===n?i(r,a)+s:"center"===n?i(r,Math.floor(a/2))+s+i(r,Math.ceil(a/2)):s+i(r,a)}},824100:function(t,e,i){"use strict";i.d(e,{Z:function(){return a}});var r=i(843020),n=i(681747);let s=/^(?:(\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 a(t){if(t instanceof Date)return t;if((0,n.Z)(t)){let e=s.exec(t);if(!e)return new Date(NaN);if(!e[8])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);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return new Date((0,r.Z)(t)?NaN:Math.round(t))}},203459:function(t,e,i){"use strict";function r(t,e={},i){i||(i=1);let{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:a=e.fontWeight,fontSize:o=e.fontSize,fontFamily:l=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(a?a+" ":"")+o*i+"px "+(l||"sans-serif")}i.d(e,{U:function(){return r}})},373390:function(t,e,i){"use strict";i.d(e,{F:function(){return r}});let r=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,r=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,r=(e<<10|i)+65536),12288===r||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":8361===r||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||172===r||175===r||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":161===r||164===r||167<=r&&r<=168||170===r||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||198===r||208===r||215<=r&&r<=216||222<=r&&r<=225||230===r||232<=r&&r<=234||236<=r&&r<=237||240===r||242<=r&&r<=243||247<=r&&r<=250||252===r||254===r||257===r||273===r||275===r||283===r||294<=r&&r<=295||299===r||305<=r&&r<=307||312===r||319<=r&&r<=322||324===r||328<=r&&r<=331||333===r||338<=r&&r<=339||358<=r&&r<=359||363===r||462===r||464===r||466===r||468===r||470===r||472===r||474===r||476===r||593===r||609===r||708===r||711===r||713<=r&&r<=715||717===r||720===r||728<=r&&r<=731||733===r||735===r||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||1025===r||1040<=r&&r<=1103||1105===r||8208===r||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||8240===r||8242<=r&&r<=8243||8245===r||8251===r||8254===r||8308===r||8319===r||8321<=r&&r<=8324||8364===r||8451===r||8453===r||8457===r||8467===r||8470===r||8481<=r&&r<=8482||8486===r||8491===r||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||8585===r||8592<=r&&r<=8601||8632<=r&&r<=8633||8658===r||8660===r||8679===r||8704===r||8706<=r&&r<=8707||8711<=r&&r<=8712||8715===r||8719===r||8721===r||8725===r||8730===r||8733<=r&&r<=8736||8739===r||8741===r||8743<=r&&r<=8748||8750===r||8756<=r&&r<=8759||8764<=r&&r<=8765||8776===r||8780===r||8786===r||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||8853===r||8857===r||8869===r||8895===r||8978===r||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||9675===r||9678<=r&&r<=9681||9698<=r&&r<=9701||9711===r||9733<=r&&r<=9734||9737===r||9742<=r&&r<=9743||9748<=r&&r<=9749||9756===r||9758===r||9792===r||9794===r||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||9839===r||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||9955===r||9960<=r&&r<=9983||10045===r||10071===r||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||65533===r||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"}},780114:function(t,e,i){"use strict";i.d(e,{Y:function(){return l}});var r,n,s=i(131045);let a="undefined"!=typeof console;function o(t,e,i){let r=[e].concat([].slice.call(i));a&&console[t].apply(console,r)}(r=n||(n={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class l{static getInstance(t,e){return l._instance&&(0,s.Z)(t)?l._instance.level(t):l._instance||(l._instance=new l(t,e)),l._instance}static setInstance(t){return l._instance=t}static setInstanceLevel(t){l._instance?l._instance.level(t):l._instance=new l(t)}static clearInstance(){l._instance=null}constructor(t=n.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find(e=>e===t)||this._onErrorHandler.push(t)}removeErrorHandler(t){let e=this._onErrorHandler.findIndex(e=>e===t);e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach(e=>e(...t))}canLogInfo(){return this._level>=n.Info}canLogDebug(){return this._level>=n.Debug}canLogError(){return this._level>=n.Error}canLogWarn(){return this._level>=n.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=n.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):o(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=n.Warn&&o(this._method||"warn","WARN",t),this}info(...t){return this._level>=n.Info&&o(this._method||"log","INFO",t),this}debug(...t){return this._level>=n.Debug&&o(this._method||"log","DEBUG",t),this}}l._instance=null},408345:function(t,e,i){"use strict";i.d(e,{L:function(){return r}});class r{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){let{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{s++,t.delete(e)},o=Date.now();return t.forEach((t,e)=>{if(t.timestamp.length=n););if(ir;)t.timestamp.shift()}),s}addLimitedTimestamp(t,e,i){let{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>r&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){let{L_TIME:i=this.L_TIME}=e,r=Date.now();t.forEach(t=>{for(;r-t.timestamp[0]>i;)t.timestamp.shift()})}clearItemTimestamp(t,e){let{L_TIME:i=this.L_TIME}=e,r=Date.now();for(;r-t.timestamp[0]>i;)t.timestamp.shift()}}},791228:function(t,e,i){"use strict";i.d(e,{BZ:function(){return a},Bw:function(){return x},Fp:function(){return u},Ho:function(){return r},KU:function(){return b},Kh:function(){return m},O$:function(){return p},VV:function(){return c},Wn:function(){return l},ZR:function(){return v},_b:function(){return f},f7:function(){return o},fv:function(){return h},i4:function(){return _},ir:function(){return y},mC:function(){return d},ou:function(){return s},pi:function(){return n},sQ:function(){return g}});let r=1e-12,n=Math.PI,s=n/2,a=2*n,o=2*Math.PI,l=Math.abs,h=Math.atan2,d=Math.cos,u=Math.max,c=Math.min,p=Math.sin,f=Math.sqrt,g=Math.pow;function m(t){return t>1?0:t<-1?n:Math.acos(t)}function v(t){return t>=1?s:t<=-1?-s:Math.asin(t)}function b(t,e,i,r,n){let s=i,a=r;return"number"==typeof t&&"number"==typeof i&&(s=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof r&&(a=(1-n)*e+n*r),{x:s,y:a}}function y(t,e){return t[0]*e[1]-t[1]*e[0]}function x(t,e){return l(t[0]-e[0])+l(t[1]-e[1])<1e-12}function _(t){let e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}},510227:function(t,e,i){"use strict";i.d(e,{o:function(){return a}});var r=i(269658),n=i(464283),s=i(200007);function a(t){if((0,r.Z)(t))return[t,t,t,t];if((0,n.Z)(t)){let e=t.length;if(1===e){let e=t[0];return[e,e,e,e]}if(2===e){let[e,i]=t;return[e,i,e,i]}if(3===e){let[e,i,r]=t;return[e,i,r,i]}if(4===e)return t}if((0,s.Z)(t)){let{top:e=0,right:i=0,bottom:r=0,left:n=0}=t;return[e,i,r,n]}return[0,0,0,0]}},11959:function(t,e,i){"use strict";i.d(e,{En:function(){return f},Hr:function(){return g},bt:function(){return m},sx:function(){return s},vh:function(){return p},xL:function(){return c}});var r=i(906324),n=i(824100);function s(t){return t?"getUTCFullYear":"getFullYear"}function a(t){return t?"getUTCMonth":"getMonth"}function o(t){return t?"getUTCDate":"getDate"}function l(t){return t?"getUTCHours":"getHours"}function h(t){return t?"getUTCMinutes":"getMinutes"}function d(t){return t?"getUTCSeconds":"getSeconds"}function u(t){return t?"getUTCMilliseconds":"getMilliseconds"}function c(t){return t?"setUTCFullYear":"setFullYear"}function p(t){return t?"setUTCMonth":"setMonth"}function f(t){return t?"setUTCHours":"setHours"}function g(t,e){let i=(0,n.Z)(t),r=i[a(e)]()+1,s=i[o(e)](),c=i[l(e)](),p=i[h(e)](),f=i[d(e)](),g=0===i[u(e)](),m=g&&0===f,v=m&&0===p,b=v&&0===c,y=b&&1===s;return y&&1===r?"YYYY":y?"YYYY-MM":b?"YYYY-MM-DD":v?"HH":m?"HH:mm":g?"HH:mm:ss":"HH:mm:ss SSS"}function m(t,e){return i=>{let c=(0,n.Z)(i),p=c[s(e)](),f=c[a(e)]()+1,g=Math.floor((f-1)/3)+1,m=c[o(e)](),v=c["get"+(e?"UTC":"")+"Day"](),b=c[l(e)](),y=(b-1)%12+1,x=c[h(e)](),_=c[d(e)](),w=c[u(e)]();return(t||"").replace(/YYYY/g,(0,r.Z)(p+"",4,"0","left")).replace(/yyyy/g,p+"").replace(/yy/g,p%100+"").replace(/Q/g,g+"").replace(/MM/g,(0,r.Z)(f,2,"0","left")).replace(/M/g,f+"").replace(/dd/g,(0,r.Z)(m,2,"0","left")).replace(/d/g,m+"").replace(/e/g,v+"").replace(/HH/g,(0,r.Z)(b,2,"0","left")).replace(/H/g,b+"").replace(/hh/g,(0,r.Z)(y+"",2,"0","left")).replace(/h/g,y+"").replace(/mm/g,(0,r.Z)(x,2,"0","left")).replace(/m/g,x+"").replace(/ss/g,(0,r.Z)(_,2,"0","left")).replace(/s/g,_+"").replace(/SSS/g,(0,r.Z)(w,3,"0","left")).replace(/S/g,w+"")}}},156597:function(t,e,i){"use strict";i.d(e,{EB:function(){return n},OU:function(){return tr},Rd:function(){return ta},fQ:function(){return ts},kr:function(){return s},oP:function(){return l},sh:function(){return r},vc:function(){return o},x4:function(){return a}});let r=1e3,n=6e4,s=36e5,a=864e5,o=26784e5,l=31536e6,h=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),d=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),u=(t,e)=>e.getFullYear()-t.getFullYear(),c=t=>t.getFullYear(),p=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),f=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),g=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),m=t=>t.getUTCFullYear(),v=t=>(t.setDate(1),t.setHours(0,0,0,0),t),b=(t,e)=>(t.setMonth(t.getMonth()+e),t),y=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),x=t=>t.getMonth(),_=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),w=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),A=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),S=t=>t.getUTCMonth(),E=t=>(t.setHours(0,0,0,0),t),T=(t,e)=>(t.setDate(t.getDate()+e),t),C=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/a,k=t=>t.getDate()-1,M=t=>(t.setUTCHours(0,0,0,0),t),B=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),P=(t,e)=>(+e-+t)/a,R=t=>t.getUTCDate()-1,O=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),I=(t,e)=>(t.setHours(t.getHours()+e),t),L=(t,e)=>(+e-+t)/s,D=t=>t.getHours(),N=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),j=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),F=t=>t.getUTCHours(),z=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),H=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),G=(t,e)=>(+e-+t)/6e4,U=t=>t.getMinutes(),V=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),W=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Z=t=>t.getUTCMinutes(),$=t=>(t.setTime(+t-t.getMilliseconds()),t),Y=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),X=(t,e)=>(+e-+t)/1e3,K=t=>t.getSeconds(),q=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),J=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Q=t=>t.getUTCSeconds(),tt=t=>t,te=(t,e)=>(t.setTime(+t+e),t),ti=(t,e)=>+e-+t,tr=(t,e)=>i=>{let r=new Date(+i-1);return e(r,1),t(r),r},tn=(t,e)=>(i,r)=>{let n=new Date,s=new Date;return n.setTime(+i),s.setTime(+r),t(n),t(s),Math.floor(e(n,s))},ts=(t,{floor:e,offset:i,field:r,count:n})=>{let s=Math.floor(t);if(!Number.isFinite(s)||s<=0)return null;if(s<=1)return{floor:e,offset:i,ceil:tr(e,i)};let a=tn(e,n),o=r?t=>r(t)%s==0:t=>a(0,t)%s==0,l=t=>{if(!Number.isNaN(+t))for(e(t);!o(t);)t.setTime(+t-1),e(t);return t},h=(t,e)=>{if(!Number.isNaN(+t)){if(s<0)for(;++e<=0;)for(i(t,-1);!o(t);)i(t,-1);else for(;--e>=0;)for(i(t,1);!o(t);)i(t,1)}return t};return{floor:l,offset:h,ceil:tr(l,h)}},ta=(t,e)=>"year"===t&&e?{floor:p,offset:f,count:g,field:m}:"month"===t&&e?{floor:_,offset:w,count:A,field:S}:"day"===t&&e?{floor:M,offset:B,count:P,field:R}:"hour"===t&&e?{floor:N,offset:j,count:L,field:F}:"minute"===t&&e?{floor:V,offset:W,count:G,field:Z}:"second"===t&&e?{floor:q,offset:J,count:X,field:Q}:"year"===t?{floor:h,offset:d,count:u,field:c}:"month"===t?{floor:v,offset:b,count:y,field:x}:"day"===t?{floor:E,offset:T,count:C,field:k}:"hour"===t?{floor:O,offset:I,count:L,field:D}:"minute"===t?{floor:z,offset:H,count:G,field:U}:"second"===t?{floor:$,offset:Y,count:X,field:K}:{floor:tt,offset:te,count:ti}},989957:function(t,e,i){"use strict";var r=i(130001),n=i(455069),s=i(750274);e.Z=function(t,e){(0,n.useEffect)(function(){var e=t(),i=!1;return!function(){(0,r.mG)(this,void 0,void 0,function(){return(0,r.Jh)(this,function(t){switch(t.label){case 0:var r;if(r=e,!(0,s.mf)(r[Symbol.asyncIterator]))return[3,4];t.label=1;case 1:return[4,e.next()];case 2:if(t.sent().done||i)return[3,3];return[3,1];case 3:return[3,6];case 4:return[4,e];case 5:t.sent(),t.label=6;case 6:return[2]}})})}(),function(){i=!0}},e)}},248029:function(t,e,i){"use strict";var r=i(130001),n=i(455069),s=i(810981);e.Z=function(t,e){var i=(0,r.CR)((0,n.useState)(t),2),a=i[0],o=i[1],l=(0,s.Z)(function(){o(t)},e).run;return(0,n.useEffect)(function(){l()},[t]),a}},315528:function(t,e,i){"use strict";i.d(e,{ue:function(){return n}});var r=(0,i(833693).Z)(","),n=r.parse;r.parseRows,r.format,r.formatBody,r.formatRows,r.formatRow,r.formatValue},833693:function(t,e,i){"use strict";i.d(e,{Z:function(){return l}});var r={},n={};function s(t){return Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function a(t){var e=Object.create(null),i=[];return t.forEach(function(t){for(var r in t)!(r in e)&&i.push(e[r]=r)}),i}function o(t,e){var i=t+"",r=i.length;return r=o?d=!0:10===(s=t.charCodeAt(l++))?u=!0:13===s&&(u=!0,10===t.charCodeAt(l)&&++l),t.slice(a+1,e-1).replace(/""/g,'"')}for(;l9999?"+"+o(l,6):o(l,4))+"-"+o(i.getUTCMonth()+1,2)+"-"+o(i.getUTCDate(),2)+(a?"T"+o(r,2)+":"+o(n,2)+":"+o(s,2)+"."+o(a,3)+"Z":s?"T"+o(r,2)+":"+o(n,2)+":"+o(s,2)+"Z":n||r?"T"+o(r,2)+":"+o(n,2)+"Z":""))):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var i,r,n=l(t,function(t,n){var a,o,l;if(i)return i(t,n-1);r=t,i=e?(a=t,o=e,l=s(a),function(t,e){return o(l(t),e,a)}):s(t)});return n.columns=r||[],n},parseRows:l,format:function(e,i){return null==i&&(i=a(e)),[i.map(u).join(t)].concat(h(e,i)).join("\n")},formatBody:function(t,e){return null==e&&(e=a(t)),h(t,e).join("\n")},formatRows:function(t){return t.map(d).join("\n")},formatRow:d,formatValue:u}}},256706:function(t,e,i){"use strict";i.d(e,{tJ:function(){return n}});var r=(0,i(833693).Z)(" "),n=r.parse;r.parseRows,r.format,r.formatBody,r.formatRows,r.formatRow,r.formatValue},954446:function(t){"use strict";var e=Object.prototype.hasOwnProperty,i="~";function r(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function s(t,e,r,s,a){if("function"!=typeof r)throw TypeError("The listener must be a function");var o=new n(r,s||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),!new r().__proto__&&(i=!1)),o.prototype.eventNames=function(){var t,r,n=[];if(0===this._eventsCount)return n;for(r in t=this._events)e.call(t,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,s=r.length,a=Array(s);n="0"&&o<="9";)n+=o,c();if("."===o)for(n+=".";c()&&o>="0"&&o<="9";)n+=o;if("e"===o||"E"===o)for(n+=o,c(),("-"===o||"+"===o)&&(n+=o,c());o>="0"&&o<="9";)n+=o,c();if(isFinite(t=+n))return(null==r&&(r=i(227997)),n.length>15)?e.storeAsString?n:e.useNativeBigInt?BigInt(n):new r(n):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(t):new r(t):t;u("Bad number")},f=function(){var t,e,i,r="";if('"'===o){for(var n=a;c();){if('"'===o)return a-1>n&&(r+=l.substring(n,a-1)),c(),r;if("\\"===o){if(a-1>n&&(r+=l.substring(n,a-1)),c(),"u"===o){for(e=0,i=0;e<4&&isFinite(t=parseInt(c(),16));e+=1){;i=16*i+t}r+=String.fromCharCode(i)}else if("string"==typeof d[o])r+=d[o];else break;n=a}}}u("Bad string")},g=function(){for(;o&&o<=" ";)c()},m=function(){switch(o){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}u("Unexpected '"+o+"'")},v=function(){var t=[];if("["===o){if(c("["),g(),"]"===o)return c("]"),t;for(;o;){if(t.push(h()),g(),"]"===o)return c("]"),t;c(","),g()}}u("Bad array")},b=function(){var t,i=Object.create(null);if("{"===o){if(c("{"),g(),"}"===o)return c("}"),i;for(;o;){if(t=f(),g(),c(":"),!0===e.strict&&Object.hasOwnProperty.call(i,t)&&u('Duplicate key "'+t+'"'),!0===n.test(t)?"error"===e.protoAction?u("Object contains forbidden prototype property"):"ignore"===e.protoAction?h():i[t]=h():!0===s.test(t)?"error"===e.constructorAction?u("Object contains forbidden constructor property"):"ignore"===e.constructorAction?h():i[t]=h():i[t]=h(),g(),"}"===o)return c("}"),i;c(","),g()}}u("Bad object")};return h=function(){switch(g(),o){case"{":return b();case"[":return v();case'"':return f();case"-":return p();default:return o>="0"&&o<="9"?p():m()}},function(t,e){var i;return l=t+"",a=0,o=" ",i=h(),g(),o&&u("Syntax error"),"function"==typeof e?function t(i,r){var n,s=i[r];return s&&"object"==typeof s&&Object.keys(s).forEach(function(e){void 0!==(n=t(s,e))?s[e]=n:delete s[e]}),e.call(i,r,s)}({"":i},""):i}}},64908:function(t,e,i){var r=i(227997),n=t.exports;!function(){"use strict";var t,e,i,s=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function o(t){return s.lastIndex=0,s.test(t)?'"'+t.replace(s,function(t){var e=a[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}"function"!=typeof n.stringify&&(n.stringify=function(n,s,a){var l;if(t="",e="","number"==typeof a)for(l=0;lT});var r,n,s=i("455069"),a=i("921463");var o=(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),l=function(){return(l=Object.assign||function(t){for(var e,i=1,r=arguments.length;i=e.length?{value:void 0,done:!0}:(t=r(e,i),this._i+=t.length,{value:t,done:!1})})},function(t,e){var i=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:i)(t)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var r=i(11);t.exports=function(t,e){var i,n;if(!r(t))return t;if(e&&"function"==typeof(i=t.toString)&&!r(n=i.call(t))||"function"==typeof(i=t.valueOf)&&!r(n=i.call(t))||!e&&"function"==typeof(i=t.toString)&&!r(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e,i){var r=i(26)("keys"),n=i(17);t.exports=function(t){return r[t]||(r[t]=n(t))}},function(t,e,i){var r=i(1),n=i(3),s=n["__core-js_shared__"]||(n["__core-js_shared__"]={});(t.exports=function(t,e){return s[t]||(s[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:i(14)?"pure":"global",copyright:"\xa9 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,i){var r=i(7).f,n=i(5),s=i(2)("toStringTag");t.exports=function(t,e,i){t&&!n(t=i?t:t.prototype,s)&&r(t,s,{configurable:!0,value:e})}},function(t,e,i){i(62);for(var r=i(3),n=i(6),s=i(12),a=i(2)("toStringTag"),o="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),l=0;ldocument.F=Object<\/script>"),t.close(),l=t.F;r--;)delete l.prototype[s[r]];return l()};t.exports=Object.create||function(t,e){var i;return null!==t?(o.prototype=r(t),i=new o,o.prototype=null,i[a]=t):i=l(),void 0===e?i:n(i,e)}},function(t,e,i){var r=i(5),n=i(9),s=i(57)(!1),a=i(25)("IE_PROTO");t.exports=function(t,e){var i,o=n(t),l=0,h=[];for(i in o)i!=a&&r(o,i)&&h.push(i);for(;e.length>l;)r(o,i=e[l++])&&(~s(h,i)||h.push(i));return h}},function(t,e,i){var r=i(24);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,i){var r=i(39),n=i(27).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,n)}},function(t,e,i){var r=i(24),n=i(2)("toStringTag"),s="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,i,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),n))?i:s?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e){var i=/-?\d+(\.\d+)?%?/g;t.exports=function(t){return t.match(i)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBase16Theme=e.createStyling=e.invertTheme=void 0;var r=p(i(49)),n=p(i(76)),s=p(i(81)),a=p(i(89)),o=p(i(93)),l=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}(i(94)),h=p(i(132)),d=p(i(133)),u=p(i(138)),c=i(139);function p(t){return t&&t.__esModule?t:{default:t}}var f=l.default,g=(0,a.default)(f),m=(0,u.default)(d.default,c.rgb2yuv,function(t){var e=(0,s.default)(t,3),i=e[0];return[i<.25?1:i<.5?.9-i:1.1-i,e[1],e[2]]},c.yuv2rgb,h.default),v=function(t){return function(e){return{className:[e.className,t.className].filter(Boolean).join(" "),style:(0,n.default)({},e.style||{},t.style||{})}}},b=function(t,e){var i=(0,a.default)(e);for(var s in t)-1===i.indexOf(s)&&i.push(s);return i.reduce(function(i,s){return i[s]=function(t,e){if(void 0===t)return e;if(void 0===e)return t;var i=void 0===t?"undefined":(0,r.default)(t),s=void 0===e?"undefined":(0,r.default)(e);switch(i){case"string":switch(s){case"string":return[e,t].filter(Boolean).join(" ");case"object":return v({className:t,style:e});case"function":return function(i){for(var r=arguments.length,n=Array(r>1?r-1:0),s=1;s1?r-1:0),s=1;s1?r-1:0),s=1;s1?r-1:0),s=1;s1?r-1:0),s=1;s2?i-2:0),o=2;o3?e-3:0),r=3;r1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},h=s.defaultBase16,d=void 0===h?f:h,u=s.base16Themes,c=_(l,void 0===u?null:u);c&&(l=(0,n.default)({},c,l));var p=g.reduce(function(t,e){return t[e]=l[e]||d[e],t},{}),m=b((0,a.default)(l).reduce(function(t,e){return -1===g.indexOf(e)&&(t[e]=l[e]),t},{}),t(p));return(0,o.default)(y,2).apply(void 0,[m].concat(i))},3),e.getBase16Theme=function(t,e){if(t&&t.extend&&(t=t.extend),"string"==typeof t){var i=t.split(":"),r=(0,s.default)(i,2),n=r[0],a=r[1];t=(e||{})[n]||l[n],"inverted"===a&&(t=x(t))}return t&&t.hasOwnProperty("base00")?t:void 0})},function(t,e,i){"use strict";var r,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)};r=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise(function(i,r){var n;function s(){void 0!==n&&t.removeListener("error",n),i([].slice.call(arguments))}"error"!==e&&(n=function(i){t.removeListener(e,s),r(i)},t.once("error",n)),t.once(e,s)})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var l=10;function h(t){if("function"!=typeof t)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function d(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function u(t,e,i,r){var n,s,a;if(h(i),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),s=t._events),a=s[e]),void 0===a)a=s[e]=i,++t._eventsCount;else if("function"==typeof a?a=s[e]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),(n=d(t))>0&&a.length>n&&!a.warned){a.warned=!0;var o=Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=t,o.type=e,o.count=a.length,console&&console.warn&&console.warn(o)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,i){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},n=c.bind(r);return n.listener=i,r.wrapFn=n,n}function f(t,e,i){var r=t._events;if(void 0===r)return[];var n=r[e];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(t){for(var e=Array(t.length),i=0;i0&&(a=e[0]),a instanceof Error)throw a;var a,o=Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var l=n[t];if(void 0===l)return!1;if("function"==typeof l)s(l,this,e);else{var h=l.length,d=m(l,h);for(i=0;i=0;s--)if(i[s]===e||i[s].listener===e){a=i[s].listener,n=s;break}if(n<0)return this;0===n?i.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,i){t.exports.Dispatcher=i(140)},function(t,e,i){t.exports=i(142)},function(t,e,i){"use strict";e.__esModule=!0;var r=a(i(50)),n=a(i(65)),s="function"==typeof n.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof n.default&&t.constructor===n.default&&t!==n.default.prototype?"symbol":typeof t};function a(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof n.default&&"symbol"===s(r.default)?function(t){return void 0===t?"undefined":s(t)}:function(t){return t&&"function"==typeof n.default&&t.constructor===n.default&&t!==n.default.prototype?"symbol":void 0===t?"undefined":s(t)}},function(t,e,i){t.exports={default:i(51),__esModule:!0}},function(t,e,i){i(20),i(29),t.exports=i(30).f("iterator")},function(t,e,i){var r=i(21),n=i(22);t.exports=function(t){return function(e,i){var s,a,o=String(n(e)),l=r(i),h=o.length;return l<0||l>=h?t?"":void 0:(s=o.charCodeAt(l))<55296||s>56319||l+1===h||(a=o.charCodeAt(l+1))<56320||a>57343?t?o.charAt(l):s:t?o.slice(l,l+2):a-56320+(s-55296<<10)+65536}}},function(t,e,i){var r=i(54);t.exports=function(t,e,i){if(r(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,r){return t.call(e,i,r)};case 3:return function(i,r,n){return t.call(e,i,r,n)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){"use strict";var r=i(38),n=i(16),s=i(28),a={};i(6)(a,i(2)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=r(a,{next:n(1,i)}),s(t,e+" Iterator")}},function(t,e,i){var r=i(7),n=i(10),s=i(13);t.exports=i(4)?Object.defineProperties:function(t,e){n(t);for(var i,a=s(e),o=a.length,l=0;o>l;)r.f(t,i=a[l++],e[i]);return t}},function(t,e,i){var r=i(9),n=i(58),s=i(59);t.exports=function(t){return function(e,i,a){var o,l=r(e),h=n(l.length),d=s(a,h);if(t&&i!=i){for(;h>d;)if((o=l[d++])!=o)return!0}else for(;h>d;d++)if((t||d in l)&&l[d]===i)return t||d||0;return!t&&-1}}},function(t,e,i){var r=i(21),n=Math.min;t.exports=function(t){return t>0?n(r(t),0x1fffffffffffff):0}},function(t,e,i){var r=i(21),n=Math.max,s=Math.min;t.exports=function(t,e){return(t=r(t))<0?n(t+e,0):s(t,e)}},function(t,e,i){var r=i(3).document;t.exports=r&&r.documentElement},function(t,e,i){var r=i(5),n=i(18),s=i(25)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return r(t=n(t),s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e,i){"use strict";var r=i(63),n=i(64),s=i(12),a=i(9);t.exports=i(34)(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,i=this._i++;return!t||i>=t.length?(this._t=void 0,n(1)):n(0,"keys"==e?i:"values"==e?t[i]:[i,t[i]])},"values"),s.Arguments=s.Array,r("keys"),r("values"),r("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,i){t.exports={default:i(66),__esModule:!0}},function(t,e,i){i(67),i(73),i(74),i(75),t.exports=i(1).Symbol},function(t,e,i){"use strict";var r=i(3),n=i(5),s=i(4),a=i(15),o=i(37),l=i(68).KEY,h=i(8),d=i(26),u=i(28),c=i(17),p=i(2),f=i(30),g=i(31),m=i(69),v=i(70),b=i(10),y=i(11),x=i(18),_=i(9),w=i(23),A=i(16),S=i(38),E=i(71),T=i(72),C=i(32),k=i(7),M=i(13),B=T.f,P=k.f,R=E.f,O=r.Symbol,I=r.JSON,L=I&&I.stringify,D=p("_hidden"),N=p("toPrimitive"),j={}.propertyIsEnumerable,F=d("symbol-registry"),z=d("symbols"),H=d("op-symbols"),G=Object.prototype,U="function"==typeof O&&!!C.f,V=r.QObject,W=!V||!V.prototype||!V.prototype.findChild,Z=s&&h(function(){return 7!=S(P({},"a",{get:function(){return P(this,"a",{value:7}).a}})).a})?function(t,e,i){var r=B(G,e);r&&delete G[e],P(t,e,i),r&&t!==G&&P(G,e,r)}:P,$=function(t){var e=z[t]=S(O.prototype);return e._k=t,e},Y=U&&"symbol"==typeof O.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof O},X=function(t,e,i){return t===G&&X(H,e,i),b(t),e=w(e,!0),b(i),n(z,e)?(i.enumerable?(n(t,D)&&t[D][e]&&(t[D][e]=!1),i=S(i,{enumerable:A(0,!1)})):(n(t,D)||P(t,D,A(1,{})),t[D][e]=!0),Z(t,e,i)):P(t,e,i)},K=function(t,e){b(t);for(var i,r=m(e=_(e)),n=0,s=r.length;s>n;)X(t,i=r[n++],e[i]);return t},q=function(t){var e=j.call(this,t=w(t,!0));return!(this===G&&n(z,t)&&!n(H,t))&&(!(e||!n(this,t)||!n(z,t)||n(this,D)&&this[D][t])||e)},J=function(t,e){if(t=_(t),e=w(e,!0),t!==G||!n(z,e)||n(H,e)){var i=B(t,e);return!i||!n(z,e)||n(t,D)&&t[D][e]||(i.enumerable=!0),i}},Q=function(t){for(var e,i=R(_(t)),r=[],s=0;i.length>s;)n(z,e=i[s++])||e==D||e==l||r.push(e);return r},tt=function(t){for(var e,i=t===G,r=R(i?H:_(t)),s=[],a=0;r.length>a;)n(z,e=r[a++])&&(!i||n(G,e))&&s.push(z[e]);return s};U||(o((O=function(){if(this instanceof O)throw TypeError("Symbol is not a constructor!");var t=c(arguments.length>0?arguments[0]:void 0),e=function(i){this===G&&e.call(H,i),n(this,D)&&n(this[D],t)&&(this[D][t]=!1),Z(this,t,A(1,i))};return s&&W&&Z(G,t,{configurable:!0,set:e}),$(t)}).prototype,"toString",function(){return this._k}),T.f=J,k.f=X,i(41).f=E.f=Q,i(19).f=q,C.f=tt,s&&!i(14)&&o(G,"propertyIsEnumerable",q,!0),f.f=function(t){return $(p(t))}),a(a.G+a.W+!U*a.F,{Symbol:O});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ti=0;te.length>ti;)p(te[ti++]);for(var tr=M(p.store),tn=0;tr.length>tn;)g(tr[tn++]);a(a.S+!U*a.F,"Symbol",{for:function(t){return n(F,t+="")?F[t]:F[t]=O(t)},keyFor:function(t){if(!Y(t))throw TypeError(t+" is not a symbol!");for(var e in F)if(F[e]===t)return e},useSetter:function(){W=!0},useSimple:function(){W=!1}}),a(a.S+!U*a.F,"Object",{create:function(t,e){return void 0===e?S(t):K(S(t),e)},defineProperty:X,defineProperties:K,getOwnPropertyDescriptor:J,getOwnPropertyNames:Q,getOwnPropertySymbols:tt});var ts=h(function(){C.f(1)});a(a.S+a.F*ts,"Object",{getOwnPropertySymbols:function(t){return C.f(x(t))}}),I&&a(a.S+a.F*(!U||h(function(){var t=O();return"[null]"!=L([t])||"{}"!=L({a:t})||"{}"!=L(Object(t))})),"JSON",{stringify:function(t){for(var e,i,r=[t],n=1;arguments.length>n;)r.push(arguments[n++]);if(i=e=r[1],(y(e)||void 0!==t)&&!Y(t))return v(e)||(e=function(t,e){if("function"==typeof i&&(e=i.call(this,t,e)),!Y(e))return e}),r[1]=e,L.apply(I,r)}}),O.prototype[N]||i(6)(O.prototype,N,O.prototype.valueOf),u(O,"Symbol"),u(Math,"Math",!0),u(r.JSON,"JSON",!0)},function(t,e,i){var r=i(17)("meta"),n=i(11),s=i(5),a=i(7).f,o=0,l=Object.isExtensible||function(){return!0},h=!i(8)(function(){return l(Object.preventExtensions({}))}),d=function(t){a(t,r,{value:{i:"O"+ ++o,w:{}}})},u=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!n(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!s(t,r)){if(!l(t))return"F";if(!e)return"E";d(t)}return t[r].i},getWeak:function(t,e){if(!s(t,r)){if(!l(t))return!0;if(!e)return!1;d(t)}return t[r].w},onFreeze:function(t){return h&&u.NEED&&l(t)&&!s(t,r)&&d(t),t}}},function(t,e,i){var r=i(13),n=i(32),s=i(19);t.exports=function(t){var e=r(t),i=n.f;if(i)for(var a,o=i(t),l=s.f,h=0;o.length>h;)l.call(t,a=o[h++])&&e.push(a);return e}},function(t,e,i){var r=i(24);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,i){var r=i(9),n=i(41).f,s={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==s.call(t)?function(t){try{return n(t)}catch(t){return a.slice()}}(t):n(r(t))}},function(t,e,i){var r=i(19),n=i(16),s=i(9),a=i(23),o=i(5),l=i(35),h=Object.getOwnPropertyDescriptor;e.f=i(4)?h:function(t,e){if(t=s(t),e=a(e,!0),l)try{return h(t,e)}catch(t){}if(o(t,e))return n(!r.f.call(t,e),t[e])}},function(t,e){},function(t,e,i){i(31)("asyncIterator")},function(t,e,i){i(31)("observable")},function(t,e,i){"use strict";e.__esModule=!0;var r=i(77),n=r&&r.__esModule?r:{default:r};e.default=n.default||function(t){for(var e=1;ed;)for(var p,f=l(arguments[d++]),g=u?n(f).concat(u(f)):n(f),m=g.length,v=0;m>v;)p=g[v++],r&&!c.call(f,p)||(i[p]=f[p]);return i}:h},function(t,e,i){"use strict";e.__esModule=!0;var r=s(i(82)),n=s(i(85));function s(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if(Array.isArray(t))return t;if((0,r.default)(Object(t)))return function(t,e){var i=[],r=!0,s=!1,a=void 0;try{for(var o,l=(0,n.default)(t);!(r=(o=l.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){s=!0,a=t}finally{try{!r&&l.return&&l.return()}finally{if(s)throw a}}return i}(t,e);throw TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,i){t.exports={default:i(83),__esModule:!0}},function(t,e,i){i(29),i(20),t.exports=i(84)},function(t,e,i){var r=i(42),n=i(2)("iterator"),s=i(12);t.exports=i(1).isIterable=function(t){var e=Object(t);return void 0!==e[n]||"@@iterator"in e||s.hasOwnProperty(r(e))}},function(t,e,i){t.exports={default:i(86),__esModule:!0}},function(t,e,i){i(29),i(20),t.exports=i(87)},function(t,e,i){var r=i(10),n=i(88);t.exports=i(1).getIterator=function(t){var e=n(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return r(e.call(t))}},function(t,e,i){var r=i(42),n=i(2)("iterator"),s=i(12);t.exports=i(1).getIteratorMethod=function(t){if(null!=t)return t[n]||t["@@iterator"]||s[r(t)]}},function(t,e,i){t.exports={default:i(90),__esModule:!0}},function(t,e,i){i(91),t.exports=i(1).Object.keys},function(t,e,i){var r=i(18),n=i(13);i(92)("keys",function(){return function(t){return n(r(t))}})},function(t,e,i){var r=i(15),n=i(1),s=i(8);t.exports=function(t,e){var i=(n.Object||{})[t]||Object[t],a={};a[t]=e(i),r(r.S+r.F*s(function(){i(1)}),"Object",a)}},function(t,e,i){(function(e){var i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],r=/^\s+|\s+$/g,n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,s=/\{\n\/\* \[wrapped with (.+)\] \*/,a=/,? & /,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,h=/^\[object .+?Constructor\]$/,d=/^0o[0-7]+$/i,u=/^(?:0|[1-9]\d*)$/,c=parseInt,p="object"==typeof e&&e&&e.Object===Object&&e,f="object"==typeof self&&self&&self.Object===Object&&self,g=p||f||Function("return this")();function m(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function v(t){return t!=t}function b(t,e){for(var i=-1,r=t.length,n=0,s=[];++i2?x:void 0);function I(t){return function(){var e,i=arguments;switch(i.length){case 0:return new t;case 1:return new t(i[0]);case 2:return new t(i[0],i[1]);case 3:return new t(i[0],i[1],i[2]);case 4:return new t(i[0],i[1],i[2],i[3]);case 5:return new t(i[0],i[1],i[2],i[3],i[4]);case 6:return new t(i[0],i[1],i[2],i[3],i[4],i[5]);case 7:return new t(i[0],i[1],i[2],i[3],i[4],i[5],i[6])}var r=H(e=t.prototype)?B(e):{},n=t.apply(r,i);return H(n)?n:r}}function L(t,e,i,r,n,s,a,o,l,h){var d=128&e,c=1&e,p=2&e,f=24&e,m=512&e,v=p?void 0:I(t);return function y(){for(var x=arguments.length,_=Array(x),w=x;w--;)_[w]=arguments[w];if(f)var A=N(y),S=function(t,e){for(var i=t.length,r=0;i--;)t[i]===e&&r++;return r}(_,A);if(r&&(_=function(t,e,i,r){for(var n=-1,s=t.length,a=i.length,o=-1,l=e.length,h=P(s-a,0),d=Array(l+h),u=!r;++o-1&&s%1==0&&s1&&_.reverse(),d&&l-1)||t.push(s)}),t.sort()}((o=p.match(s))?o[1].split(a):[],r)).length)-1,h[u]=(d>1?"& ":"")+h[u],h=h.join(d>2?", ":" "),c=l.replace(n,"{\n/* [wrapped with "+h+"] */\n"),function(){return c})})}:function(t){return t};function z(t,e,i){var r=function(t,e,i,r,n,s,a,o){var l=2&e;if(!l&&"function"!=typeof t)throw TypeError("Expected a function");var h=r?r.length:0;if(h||(e&=-97,r=n=void 0),a=void 0===a?a:P(G(a),0),o=void 0===o?o:G(o),h-=n?n.length:0,64&e){var d=r,u=n;r=n=void 0}var c=[t,e,i,r,n,d,u,s,a,o];if(t=c[0],e=c[1],i=c[2],r=c[3],n=c[4],(o=c[9]=null==c[9]?l?0:t.length:P(c[9]-h,0))||!(24&e)||(e&=-25),e&&1!=e){;R=8==e||16==e?(p=t,f=e,v=o,y=I(p),function t(){for(var e=arguments.length,i=Array(e),r=e,n=N(t);r--;)i[r]=arguments[r];var s=e<3&&i[0]!==n&&i[e-1]!==n?[]:b(i,n);return(e-=s.length)1&&r--,s=6*r<1?e+6*(i-e)*r:2*r<1?i:3*r<2?e+(i-e)*(2/3-r)*6:e,n[h]=255*s;return n}},function(t,e,i){(function(e){var i="object"==typeof e&&e&&e.Object===Object&&e,r="object"==typeof self&&self&&self.Object===Object&&self,n=i||r||Function("return this")(),s=Object.prototype,a=s.hasOwnProperty,o=s.toString,l=n.Symbol,h=s.propertyIsEnumerable,d=l?l.isConcatSpreadable:void 0,u=Math.max;function c(t){var e,i,r,n,s,l,u,c,f;return p(t)||!!(r=i=e=t)&&"object"==typeof r&&null!=(n=i)&&"number"==typeof(s=n.length)&&s>-1&&s%1==0&&s<=0x1fffffffffffff&&!("[object Function]"==(c=typeof(u=l=n),f=u&&("object"==c||"function"==c)?o.call(l):"")||"[object GeneratorFunction]"==f)&&a.call(e,"callee")&&(!h.call(e,"callee")||"[object Arguments]"==o.call(e))||!!(d&&t&&t[d])}var p=Array.isArray,f,g,m,v=(g=function(t){var e=(t=function t(e,i,r,n,s){var a=-1,o=e.length;for(r||(r=c),s||(s=[]);++a0&&r(l)?i>1?t(l,i-1,r,n,s):function(t,e){for(var i=-1,r=e.length,n=t.length;++i2?n-2:0),a=2;a=0||(n[i]=t[i]);return n}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(n[i]=t[i])}return n}function _(t){var e,i=(e=t,({}).toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase());return"number"===i&&(i=isNaN(t)?"nan":(0|t)!=t?"float":"integer"),i}m.__suppressDeprecationWarning=!0,v.__suppressDeprecationWarning=!0,b.__suppressDeprecationWarning=!0;var w={scheme:"rjv-default",author:"mac gainor",base00:"rgba(0, 0, 0, 0)",base01:"rgb(245, 245, 245)",base02:"rgb(235, 235, 235)",base03:"#93a1a1",base04:"rgba(0, 0, 0, 0.3)",base05:"#586e75",base06:"#073642",base07:"#002b36",base08:"#d33682",base09:"#cb4b16",base0A:"#dc322f",base0B:"#859900",base0C:"#6c71c4",base0D:"#586e75",base0E:"#2aa198",base0F:"#268bd2"},A={scheme:"rjv-grey",author:"mac gainor",base00:"rgba(1, 1, 1, 0)",base01:"rgba(1, 1, 1, 0.1)",base02:"rgba(0, 0, 0, 0.2)",base03:"rgba(1, 1, 1, 0.3)",base04:"rgba(0, 0, 0, 0.4)",base05:"rgba(1, 1, 1, 0.5)",base06:"rgba(1, 1, 1, 0.6)",base07:"rgba(1, 1, 1, 0.7)",base08:"rgba(1, 1, 1, 0.8)",base09:"rgba(1, 1, 1, 0.8)",base0A:"rgba(1, 1, 1, 0.8)",base0B:"rgba(1, 1, 1, 0.8)",base0C:"rgba(1, 1, 1, 0.8)",base0D:"rgba(1, 1, 1, 0.8)",base0E:"rgba(1, 1, 1, 0.8)",base0F:"rgba(1, 1, 1, 0.8)"},S={white:"#fff",black:"#000",transparent:"rgba(1, 1, 1, 0)",globalFontFamily:"monospace",globalCursor:"default",indentBlockWidth:"5px",braceFontWeight:"bold",braceCursor:"pointer",ellipsisFontSize:"18px",ellipsisLineHeight:"10px",ellipsisCursor:"pointer",keyMargin:"0px 5px",keyLetterSpacing:"0.5px",keyFontStyle:"none",keyBorderRadius:"3px",keyColonWeight:"bold",keyVerticalAlign:"top",keyOpacity:"0.85",keyOpacityHover:"1",keyValPaddingTop:"3px",keyValPaddingBottom:"3px",keyValPaddingRight:"5px",keyValBorderLeft:"1px solid",keyValBorderHover:"2px solid",keyValPaddingHover:"3px 5px 3px 4px",pushedContentMarginLeft:"6px",variableValuePaddingRight:"6px",nullFontSize:"11px",nullFontWeight:"bold",nullPadding:"1px 2px",nullBorderRadius:"3px",nanFontSize:"11px",nanFontWeight:"bold",nanPadding:"1px 2px",nanBorderRadius:"3px",undefinedFontSize:"11px",undefinedFontWeight:"bold",undefinedPadding:"1px 2px",undefinedBorderRadius:"3px",dataTypeFontSize:"11px",dataTypeMarginRight:"4px",datatypeOpacity:"0.8",objectSizeBorderRadius:"3px",objectSizeFontStyle:"italic",objectSizeMargin:"0px 6px 0px 0px",clipboardCursor:"pointer",clipboardCheckMarginLeft:"-12px",metaDataPadding:"0px 0px 0px 10px",arrayGroupMetaPadding:"0px 0px 0px 4px",iconContainerWidth:"17px",tooltipPadding:"4px",editInputMinWidth:"130px",editInputBorderRadius:"2px",editInputPadding:"5px",editInputMarginRight:"4px",editInputFontFamily:"monospace",iconCursor:"pointer",iconFontSize:"15px",iconPaddingRight:"1px",dateValueMarginLeft:"2px",iconMarginRight:"3px",detectedRowPaddingTop:"3px",addKeyCoverBackground:"rgba(255, 255, 255, 0.3)",addKeyCoverPosition:"absolute",addKeyCoverPositionPx:"0px",addKeyModalWidth:"200px",addKeyModalMargin:"auto",addKeyModalPadding:"10px",addKeyModalRadius:"3px"},E=i(45),T=function(t){var e,i={backgroundColor:(e=t).base00,ellipsisColor:e.base09,braceColor:e.base07,expandedIcon:e.base0D,collapsedIcon:e.base0E,keyColor:e.base07,arrayKeyColor:e.base0C,objectSize:e.base04,copyToClipboard:e.base0F,copyToClipboardCheck:e.base0D,objectBorder:e.base02,dataTypes:{boolean:e.base0E,date:e.base0D,float:e.base0B,function:e.base0D,integer:e.base0F,string:e.base09,nan:e.base08,null:e.base0A,undefined:e.base05,regexp:e.base0A,background:e.base02},editVariable:{editIcon:e.base0E,cancelIcon:e.base09,removeIcon:e.base09,addIcon:e.base0E,checkIcon:e.base0E,background:e.base01,color:e.base0A,border:e.base07},addKeyModal:{background:e.base05,border:e.base04,color:e.base0A,labelColor:e.base01},validationFailure:{background:e.base09,iconColor:e.base01,fontColor:e.base01}};return{"app-container":{fontFamily:S.globalFontFamily,cursor:S.globalCursor,backgroundColor:i.backgroundColor,position:"relative"},ellipsis:{display:"inline-block",color:i.ellipsisColor,fontSize:S.ellipsisFontSize,lineHeight:S.ellipsisLineHeight,cursor:S.ellipsisCursor},"brace-row":{display:"inline-block",cursor:"pointer"},brace:{display:"inline-block",cursor:S.braceCursor,fontWeight:S.braceFontWeight,color:i.braceColor},"expanded-icon":{color:i.expandedIcon},"collapsed-icon":{color:i.collapsedIcon},colon:{display:"inline-block",margin:S.keyMargin,color:i.keyColor,verticalAlign:"top"},objectKeyVal:function(t,e){return{style:n({paddingTop:S.keyValPaddingTop,paddingRight:S.keyValPaddingRight,paddingBottom:S.keyValPaddingBottom,borderLeft:S.keyValBorderLeft+" "+i.objectBorder,":hover":{paddingLeft:e.paddingLeft-1+"px",borderLeft:S.keyValBorderHover+" "+i.objectBorder}},e)}},"object-key-val-no-border":{padding:S.keyValPadding},"pushed-content":{marginLeft:S.pushedContentMarginLeft},variableValue:function(t,e){return{style:n({display:"inline-block",paddingRight:S.variableValuePaddingRight,position:"relative"},e)}},"object-name":{display:"inline-block",color:i.keyColor,letterSpacing:S.keyLetterSpacing,fontStyle:S.keyFontStyle,verticalAlign:S.keyVerticalAlign,opacity:S.keyOpacity,":hover":{opacity:S.keyOpacityHover}},"array-key":{display:"inline-block",color:i.arrayKeyColor,letterSpacing:S.keyLetterSpacing,fontStyle:S.keyFontStyle,verticalAlign:S.keyVerticalAlign,opacity:S.keyOpacity,":hover":{opacity:S.keyOpacityHover}},"object-size":{color:i.objectSize,borderRadius:S.objectSizeBorderRadius,fontStyle:S.objectSizeFontStyle,margin:S.objectSizeMargin,cursor:"default"},"data-type-label":{fontSize:S.dataTypeFontSize,marginRight:S.dataTypeMarginRight,opacity:S.datatypeOpacity},boolean:{display:"inline-block",color:i.dataTypes.boolean},date:{display:"inline-block",color:i.dataTypes.date},"date-value":{marginLeft:S.dateValueMarginLeft},float:{display:"inline-block",color:i.dataTypes.float},function:{display:"inline-block",color:i.dataTypes.function,cursor:"pointer",whiteSpace:"pre-line"},"function-value":{fontStyle:"italic"},integer:{display:"inline-block",color:i.dataTypes.integer},string:{display:"inline-block",color:i.dataTypes.string},nan:{display:"inline-block",color:i.dataTypes.nan,fontSize:S.nanFontSize,fontWeight:S.nanFontWeight,backgroundColor:i.dataTypes.background,padding:S.nanPadding,borderRadius:S.nanBorderRadius},null:{display:"inline-block",color:i.dataTypes.null,fontSize:S.nullFontSize,fontWeight:S.nullFontWeight,backgroundColor:i.dataTypes.background,padding:S.nullPadding,borderRadius:S.nullBorderRadius},undefined:{display:"inline-block",color:i.dataTypes.undefined,fontSize:S.undefinedFontSize,padding:S.undefinedPadding,borderRadius:S.undefinedBorderRadius,backgroundColor:i.dataTypes.background},regexp:{display:"inline-block",color:i.dataTypes.regexp},"copy-to-clipboard":{cursor:S.clipboardCursor},"copy-icon":{color:i.copyToClipboard,fontSize:S.iconFontSize,marginRight:S.iconMarginRight,verticalAlign:"top"},"copy-icon-copied":{color:i.copyToClipboardCheck,marginLeft:S.clipboardCheckMarginLeft},"array-group-meta-data":{display:"inline-block",padding:S.arrayGroupMetaPadding},"object-meta-data":{display:"inline-block",padding:S.metaDataPadding},"icon-container":{display:"inline-block",width:S.iconContainerWidth},tooltip:{padding:S.tooltipPadding},removeVarIcon:{verticalAlign:"top",display:"inline-block",color:i.editVariable.removeIcon,cursor:S.iconCursor,fontSize:S.iconFontSize,marginRight:S.iconMarginRight},addVarIcon:{verticalAlign:"top",display:"inline-block",color:i.editVariable.addIcon,cursor:S.iconCursor,fontSize:S.iconFontSize,marginRight:S.iconMarginRight},editVarIcon:{verticalAlign:"top",display:"inline-block",color:i.editVariable.editIcon,cursor:S.iconCursor,fontSize:S.iconFontSize,marginRight:S.iconMarginRight},"edit-icon-container":{display:"inline-block",verticalAlign:"top"},"check-icon":{display:"inline-block",cursor:S.iconCursor,color:i.editVariable.checkIcon,fontSize:S.iconFontSize,paddingRight:S.iconPaddingRight},"cancel-icon":{display:"inline-block",cursor:S.iconCursor,color:i.editVariable.cancelIcon,fontSize:S.iconFontSize,paddingRight:S.iconPaddingRight},"edit-input":{display:"inline-block",minWidth:S.editInputMinWidth,borderRadius:S.editInputBorderRadius,backgroundColor:i.editVariable.background,color:i.editVariable.color,padding:S.editInputPadding,marginRight:S.editInputMarginRight,fontFamily:S.editInputFontFamily},"detected-row":{paddingTop:S.detectedRowPaddingTop},"key-modal-request":{position:S.addKeyCoverPosition,top:S.addKeyCoverPositionPx,left:S.addKeyCoverPositionPx,right:S.addKeyCoverPositionPx,bottom:S.addKeyCoverPositionPx,backgroundColor:S.addKeyCoverBackground},"key-modal":{width:S.addKeyModalWidth,backgroundColor:i.addKeyModal.background,marginLeft:S.addKeyModalMargin,marginRight:S.addKeyModalMargin,padding:S.addKeyModalPadding,borderRadius:S.addKeyModalRadius,marginTop:"15px",position:"relative"},"key-modal-label":{color:i.addKeyModal.labelColor,marginLeft:"2px",marginBottom:"5px",fontSize:"11px"},"key-modal-input-container":{overflow:"hidden"},"key-modal-input":{width:"100%",padding:"3px 6px",fontFamily:"monospace",color:i.addKeyModal.color,border:"none",boxSizing:"border-box",borderRadius:"2px"},"key-modal-cancel":{backgroundColor:i.editVariable.removeIcon,position:"absolute",top:"0px",right:"0px",borderRadius:"0px 3px 0px 3px",cursor:"pointer"},"key-modal-cancel-icon":{color:i.addKeyModal.labelColor,fontSize:S.iconFontSize,transform:"rotate(45deg)"},"key-modal-submit":{color:i.editVariable.addIcon,fontSize:S.iconFontSize,position:"absolute",right:"2px",top:"3px",cursor:"pointer"},"function-ellipsis":{display:"inline-block",color:i.ellipsisColor,fontSize:S.ellipsisFontSize,lineHeight:S.ellipsisLineHeight,cursor:S.ellipsisCursor},"validation-failure":{float:"right",padding:"3px 6px",borderRadius:"2px",cursor:"pointer",color:i.validationFailure.fontColor,backgroundColor:i.validationFailure.background},"validation-failure-label":{marginRight:"6px"},"validation-failure-clear":{position:"relative",verticalAlign:"top",cursor:"pointer",color:i.validationFailure.iconColor,fontSize:S.iconFontSize,transform:"rotate(45deg)"}}};function C(t,e,i){var r,n;return t||console.error("theme has not been set"),(r=t,n=w,!1!==r&&"none"!==r||(n=A),Object(E.createStyling)(T,{defaultBase16:n})(r))(e,i)}var k=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=(t.rjvId,t.type_name),i=t.displayDataTypes,r=t.theme;return i?g.a.createElement("span",Object.assign({className:"data-type-label"},C(r,"data-type-label")),e):null}}]),i}(g.a.PureComponent),M=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props;return g.a.createElement("div",C(t.theme,"boolean"),g.a.createElement(k,Object.assign({type_name:"bool"},t)),t.value?"true":"false")}}]),i}(g.a.PureComponent),B=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props;return g.a.createElement("div",C(t.theme,"date"),g.a.createElement(k,Object.assign({type_name:"date"},t)),g.a.createElement("span",Object.assign({className:"date-value"},C(t.theme,"date-value")),t.value.toLocaleTimeString("en-us",{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})))}}]),i}(g.a.PureComponent),P=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props;return g.a.createElement("div",C(t.theme,"float"),g.a.createElement(k,Object.assign({type_name:"float"},t)),this.props.value)}}]),i}(g.a.PureComponent);function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,s,a=!0,o=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){o=!0,s=t},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}(n);try{for(u.s();!(o=u.n()).done;)d=d[o.value]}catch(t){u.e(t)}finally{u.f()}return a?"array"==_(d)?d.splice(r,1):delete d[r]:null!==r?d[r]=s:h=s,t.set(e,"global","src",h),h},t.deepCopy=function(e,i){var r,s=_(e),a=i.shift();return"array"==s?r=I(e):"object"==s&&(r=n({},e)),void 0!==a&&(r[a]=t.deepCopy(e[a],i)),r},t}return i}(L.EventEmitter));D.register(N.handleAction.bind(N));var j=function(t){h(i,t);var e=p(i);function i(t){var r;return s(this,i),(r=e.call(this,t)).toggleCollapsed=function(){r.setState({collapsed:!r.state.collapsed},function(){N.set(r.props.rjvId,r.props.namespace,"collapsed",r.state.collapsed)})},r.getFunctionDisplay=function(t){var e=c(r).props;return t?g.a.createElement("span",null,r.props.value.toString().slice(9,-1).replace(/\{[\s\S]+/,""),g.a.createElement("span",{className:"function-collapsed",style:{fontWeight:"bold"}},g.a.createElement("span",null,"{"),g.a.createElement("span",C(e.theme,"ellipsis"),"..."),g.a.createElement("span",null,"}"))):r.props.value.toString().slice(9,-1)},r.state={collapsed:N.get(t.rjvId,t.namespace,"collapsed",!0)},r}return o(i,[{key:"render",value:function(){var t=this.props,e=this.state.collapsed;return g.a.createElement("div",C(t.theme,"function"),g.a.createElement(k,Object.assign({type_name:"function"},t)),g.a.createElement("span",Object.assign({},C(t.theme,"function-value"),{className:"rjv-function-container",onClick:this.toggleCollapsed}),this.getFunctionDisplay(e)))}}]),i}(g.a.PureComponent),F=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){return g.a.createElement("div",C(this.props.theme,"nan"),"NaN")}}]),i}(g.a.PureComponent),z=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){return g.a.createElement("div",C(this.props.theme,"null"),"NULL")}}]),i}(g.a.PureComponent),H=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props;return g.a.createElement("div",C(t.theme,"integer"),g.a.createElement(k,Object.assign({type_name:"int"},t)),this.props.value)}}]),i}(g.a.PureComponent),G=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props;return g.a.createElement("div",C(t.theme,"regexp"),g.a.createElement(k,Object.assign({type_name:"regexp"},t)),this.props.value.toString())}}]),i}(g.a.PureComponent),U=function(t){h(i,t);var e=p(i);function i(t){var r;return s(this,i),(r=e.call(this,t)).toggleCollapsed=function(){r.setState({collapsed:!r.state.collapsed},function(){N.set(r.props.rjvId,r.props.namespace,"collapsed",r.state.collapsed)})},r.state={collapsed:N.get(t.rjvId,t.namespace,"collapsed",!0)},r}return o(i,[{key:"render",value:function(){this.state.collapsed;var t=this.props,e=t.collapseStringsAfterLength,i=t.theme,r=t.value,n={style:{cursor:"default"}};return"integer"===_(e)&&r.length>e&&(n.style.cursor="pointer",this.state.collapsed&&(r=g.a.createElement("span",null,r.substring(0,e),g.a.createElement("span",C(i,"ellipsis")," ...")))),g.a.createElement("div",C(i,"string"),g.a.createElement(k,Object.assign({type_name:"string"},t)),g.a.createElement("span",Object.assign({className:"string-value"},n,{onClick:this.toggleCollapsed}),'"',r,'"'))}}]),i}(g.a.PureComponent),V=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){return g.a.createElement("div",C(this.props.theme,"undefined"),"undefined")}}]),i}(g.a.PureComponent);function W(){return(W=Object.assign||function(t){for(var e=1;e=0||(n[i]=t[i]);return n}(t,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]),d,u=void 0!==h.value,c=Object(f.useRef)(null),p=X(c,e),g=Object(f.useRef)(0),m=Object(f.useRef)(),v=function(){var t=c.current,e=i&&m.current?m.current:function(t){var e=window.getComputedStyle(t);if(null===e)return null;var i=tt.reduce(function(t,i){return t[i]=e[i],t},{}),r=i.boxSizing;return""===r?null:(te&&"border-box"===r&&(i.width=parseFloat(i.width)+parseFloat(i.borderRightWidth)+parseFloat(i.borderLeftWidth)+parseFloat(i.paddingRight)+parseFloat(i.paddingLeft)+"px"),{sizingStyle:i,paddingSize:parseFloat(i.paddingBottom)+parseFloat(i.paddingTop),borderSize:parseFloat(i.borderBottomWidth)+parseFloat(i.borderTopWidth)})}(t);if(e){m.current=e;var s,a,o,h,d,u,p,f,v,b,y,x,_,w,A,S=(s=e,a=t.value||t.placeholder||"x",void 0===(o=n)&&(o=1),void 0===(h=r)&&(h=1/0),J||((J=document.createElement("textarea")).setAttribute("tab-index","-1"),J.setAttribute("aria-hidden","true"),q(J)),null===J.parentNode&&document.body.appendChild(J),d=s.paddingSize,u=s.borderSize,f=(p=s.sizingStyle).boxSizing,Object.keys(p).forEach(function(t){J.style[t]=p[t]}),q(J),J.value=a,x=(v=J,b=s,y=v.scrollHeight,"border-box"===b.sizingStyle.boxSizing?y+b.borderSize:y-b.paddingSize),J.value="x",w=(_=J.scrollHeight-d)*o,"border-box"===f&&(w=w+d+u),x=Math.max(w,x),A=_*h,"border-box"===f&&(A=A+d+u),[x=Math.min(A,x),_]),E=S[0],T=S[1];g.current!==E&&(g.current=E,t.style.setProperty("height",E+"px","important"),l(E,{rowHeight:T}))}};return Object(f.useLayoutEffect)(v),d=$(v),Object(f.useLayoutEffect)(function(){var t=function(t){d.current(t)};return window.addEventListener("resize",t),function(){window.removeEventListener("resize",t)}},[]),Object(f.createElement)("textarea",W({},h,{onChange:function(t){u||v(),a(t)},ref:p}))});function tr(t){t=t.trim();try{if("["===(t=JSON.stringify(JSON.parse(t)))[0])return tn("array",JSON.parse(t));if("{"===t[0])return tn("object",JSON.parse(t));if(t.match(/\-?\d+\.\d+/)&&t.match(/\-?\d+\.\d+/)[0]===t)return tn("float",parseFloat(t));if(t.match(/\-?\d+e-\d+/)&&t.match(/\-?\d+e-\d+/)[0]===t)return tn("float",Number(t));if(t.match(/\-?\d+/)&&t.match(/\-?\d+/)[0]===t)return tn("integer",parseInt(t));if(t.match(/\-?\d+e\+\d+/)&&t.match(/\-?\d+e\+\d+/)[0]===t)return tn("integer",Number(t))}catch(t){}switch(t=t.toLowerCase()){case"undefined":return tn("undefined",void 0);case"nan":return tn("nan",NaN);case"null":return tn("null",null);case"true":return tn("boolean",!0);case"false":return tn("boolean",!1);default:if(t=Date.parse(t))return tn("date",new Date(t))}return tn(!1,null)}function tn(t,e){return{type:t,value:e}}var ts=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",Object.assign({},tv(e),{viewBox:"0 0 24 24",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),g.a.createElement("path",{d:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M7,13H17V11H7"})))}}]),i}(g.a.PureComponent),ta=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",Object.assign({},tv(e),{viewBox:"0 0 24 24",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),g.a.createElement("path",{d:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z"})))}}]),i}(g.a.PureComponent),to=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]),r=tv(e).style;return g.a.createElement("span",i,g.a.createElement("svg",{fill:r.color,width:r.height,height:r.width,style:r,viewBox:"0 0 1792 1792"},g.a.createElement("path",{d:"M1344 800v64q0 14-9 23t-23 9h-832q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h832q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"})))}}]),i}(g.a.PureComponent),tl=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]),r=tv(e).style;return g.a.createElement("span",i,g.a.createElement("svg",{fill:r.color,width:r.height,height:r.width,style:r,viewBox:"0 0 1792 1792"},g.a.createElement("path",{d:"M1344 800v64q0 14-9 23t-23 9h-352v352q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-352h-352q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h352v-352q0-14 9-23t23-9h64q14 0 23 9t9 23v352h352q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"})))}}]),i}(g.a.PureComponent),th=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",{style:n(n({},tv(e).style),{},{paddingLeft:"2px",verticalAlign:"top"}),viewBox:"0 0 15 15",fill:"currentColor"},g.a.createElement("path",{d:"M0 14l6-6-6-6z"})))}}]),i}(g.a.PureComponent),td=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",{style:n(n({},tv(e).style),{},{paddingLeft:"2px",verticalAlign:"top"}),viewBox:"0 0 15 15",fill:"currentColor"},g.a.createElement("path",{d:"M0 5l6 6 6-6z"})))}}]),i}(g.a.PureComponent),tu=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",Object.assign({},tv(e),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),g.a.createElement("g",null,g.a.createElement("path",{d:"m30 35h-25v-22.5h25v7.5h2.5v-12.5c0-1.4-1.1-2.5-2.5-2.5h-7.5c0-2.8-2.2-5-5-5s-5 2.2-5 5h-7.5c-1.4 0-2.5 1.1-2.5 2.5v27.5c0 1.4 1.1 2.5 2.5 2.5h25c1.4 0 2.5-1.1 2.5-2.5v-5h-2.5v5z m-20-27.5h2.5s2.5-1.1 2.5-2.5 1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5 1.3 2.5 2.5 2.5h2.5s2.5 1.1 2.5 2.5h-20c0-1.5 1.1-2.5 2.5-2.5z m-2.5 20h5v-2.5h-5v2.5z m17.5-5v-5l-10 7.5 10 7.5v-5h12.5v-5h-12.5z m-17.5 10h7.5v-2.5h-7.5v2.5z m12.5-17.5h-12.5v2.5h12.5v-2.5z m-7.5 5h-5v2.5h5v-2.5z"}))))}}]),i}(g.a.PureComponent),tc=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",Object.assign({},tv(e),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),g.a.createElement("g",null,g.a.createElement("path",{d:"m28.6 25q0-0.5-0.4-1l-4-4 4-4q0.4-0.5 0.4-1 0-0.6-0.4-1.1l-2-2q-0.4-0.4-1-0.4-0.6 0-1 0.4l-4.1 4.1-4-4.1q-0.4-0.4-1-0.4-0.6 0-1 0.4l-2 2q-0.5 0.5-0.5 1.1 0 0.5 0.5 1l4 4-4 4q-0.5 0.5-0.5 1 0 0.7 0.5 1.1l2 2q0.4 0.4 1 0.4 0.6 0 1-0.4l4-4.1 4.1 4.1q0.4 0.4 1 0.4 0.6 0 1-0.4l2-2q0.4-0.4 0.4-1z m8.7-5q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),i}(g.a.PureComponent),tp=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",Object.assign({},tv(e),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),g.a.createElement("g",null,g.a.createElement("path",{d:"m30.1 21.4v-2.8q0-0.6-0.4-1t-1-0.5h-5.7v-5.7q0-0.6-0.4-1t-1-0.4h-2.9q-0.6 0-1 0.4t-0.4 1v5.7h-5.7q-0.6 0-1 0.5t-0.5 1v2.8q0 0.6 0.5 1t1 0.5h5.7v5.7q0 0.5 0.4 1t1 0.4h2.9q0.6 0 1-0.4t0.4-1v-5.7h5.7q0.6 0 1-0.5t0.4-1z m7.2-1.4q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),i}(g.a.PureComponent),tf=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",Object.assign({},tv(e),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),g.a.createElement("g",null,g.a.createElement("path",{d:"m31.6 21.6h-10v10h-3.2v-10h-10v-3.2h10v-10h3.2v10h10v3.2z"}))))}}]),i}(g.a.PureComponent),tg=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",Object.assign({},tv(e),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),g.a.createElement("g",null,g.a.createElement("path",{d:"m19.8 26.4l2.6-2.6-3.4-3.4-2.6 2.6v1.3h2.2v2.1h1.2z m9.8-16q-0.3-0.4-0.7 0l-7.8 7.8q-0.4 0.4 0 0.7t0.7 0l7.8-7.8q0.4-0.4 0-0.7z m1.8 13.2v4.3q0 2.6-1.9 4.5t-4.5 1.9h-18.6q-2.6 0-4.5-1.9t-1.9-4.5v-18.6q0-2.7 1.9-4.6t4.5-1.8h18.6q1.4 0 2.6 0.5 0.3 0.2 0.4 0.5 0.1 0.4-0.2 0.7l-1.1 1.1q-0.3 0.3-0.7 0.1-0.5-0.1-1-0.1h-18.6q-1.4 0-2.5 1.1t-1 2.5v18.6q0 1.4 1 2.5t2.5 1h18.6q1.5 0 2.5-1t1.1-2.5v-2.9q0-0.2 0.2-0.4l1.4-1.5q0.3-0.3 0.8-0.1t0.4 0.6z m-2.1-16.5l6.4 6.5-15 15h-6.4v-6.5z m9.9 3l-2.1 2-6.4-6.4 2.1-2q0.6-0.7 1.5-0.7t1.5 0.7l3.4 3.4q0.6 0.6 0.6 1.5t-0.6 1.5z"}))))}}]),i}(g.a.PureComponent),tm=function(t){h(i,t);var e=p(i);function i(){return s(this,i),e.apply(this,arguments)}return o(i,[{key:"render",value:function(){var t=this.props,e=t.style,i=x(t,["style"]);return g.a.createElement("span",i,g.a.createElement("svg",Object.assign({},tv(e),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),g.a.createElement("g",null,g.a.createElement("path",{d:"m31.7 16.4q0-0.6-0.4-1l-2.1-2.1q-0.4-0.4-1-0.4t-1 0.4l-9.1 9.1-5-5q-0.5-0.4-1-0.4t-1 0.4l-2.1 2q-0.4 0.4-0.4 1 0 0.6 0.4 1l8.1 8.1q0.4 0.4 1 0.4 0.6 0 1-0.4l12.2-12.1q0.4-0.4 0.4-1z m5.6 3.6q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),i}(g.a.PureComponent);function tv(t){return t||(t={}),{style:n(n({verticalAlign:"middle"},t),{},{color:t.color?t.color:"#000000",height:"1em",width:"1em"})}}var tb=function(t){h(i,t);var e=p(i);function i(t){var r;return s(this,i),(r=e.call(this,t)).copiedTimer=null,r.handleCopy=function(){var t=document.createElement("textarea"),e=r.props,i=e.clickCallback,n=e.src,s=e.namespace;t.innerHTML=JSON.stringify(r.clipboardValue(n),null," "),document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),r.copiedTimer=setTimeout(function(){r.setState({copied:!1})},5500),r.setState({copied:!0},function(){"function"==typeof i&&i({src:n,namespace:s,name:s[s.length-1]})})},r.getClippyIcon=function(){var t=r.props.theme;return r.state.copied?g.a.createElement("span",null,g.a.createElement(tu,Object.assign({className:"copy-icon"},C(t,"copy-icon"))),g.a.createElement("span",C(t,"copy-icon-copied"),"✔")):g.a.createElement(tu,Object.assign({className:"copy-icon"},C(t,"copy-icon")))},r.clipboardValue=function(t){switch(_(t)){case"function":case"regexp":return t.toString();default:return t}},r.state={copied:!1},r}return o(i,[{key:"componentWillUnmount",value:function(){this.copiedTimer&&(clearTimeout(this.copiedTimer),this.copiedTimer=null)}},{key:"render",value:function(){var t=this.props,e=(t.src,t.theme),i=t.hidden,r=t.rowHovered,s=C(e,"copy-to-clipboard").style,a="inline";return i&&(a="none"),g.a.createElement("span",{className:"copy-to-clipboard-container",title:"Copy to clipboard",style:{verticalAlign:"top",display:r?"inline-block":"none"}},g.a.createElement("span",{style:n(n({},s),{},{display:a}),onClick:this.handleCopy},this.getClippyIcon()))}}]),i}(g.a.PureComponent),ty=function(t){h(i,t);var e=p(i);function i(t){var r;return s(this,i),(r=e.call(this,t)).getEditIcon=function(){var t=r.props,e=t.variable,i=t.theme;return g.a.createElement("div",{className:"click-to-edit",style:{verticalAlign:"top",display:r.state.hovered?"inline-block":"none"}},g.a.createElement(tg,Object.assign({className:"click-to-edit-icon"},C(i,"editVarIcon"),{onClick:function(){r.prepopInput(e)}})))},r.prepopInput=function(t){if(!1!==r.props.onEdit){var e=function(t){var e;switch(_(t)){case"undefined":e="undefined";break;case"nan":e="NaN";break;case"string":e=t;break;case"date":case"function":case"regexp":e=t.toString();break;default:try{e=JSON.stringify(t,null," ")}catch(t){e=""}}return e}(t.value),i=tr(e);r.setState({editMode:!0,editValue:e,parsedInput:{type:i.type,value:i.value}})}},r.getRemoveIcon=function(){var t=r.props,e=t.variable,i=t.namespace,n=t.theme,s=t.rjvId;return g.a.createElement("div",{className:"click-to-remove",style:{verticalAlign:"top",display:r.state.hovered?"inline-block":"none"}},g.a.createElement(tc,Object.assign({className:"click-to-remove-icon"},C(n,"removeVarIcon"),{onClick:function(){D.dispatch({name:"VARIABLE_REMOVED",rjvId:s,data:{name:e.name,namespace:i,existing_value:e.value,variable_removed:!0}})}})))},r.getValue=function(t,e){var i=!e&&t.type,n=c(r).props;switch(i){case!1:return r.getEditInput();case"string":return g.a.createElement(U,Object.assign({value:t.value},n));case"integer":return g.a.createElement(H,Object.assign({value:t.value},n));case"float":return g.a.createElement(P,Object.assign({value:t.value},n));case"boolean":return g.a.createElement(M,Object.assign({value:t.value},n));case"function":return g.a.createElement(j,Object.assign({value:t.value},n));case"null":return g.a.createElement(z,n);case"nan":return g.a.createElement(F,n);case"undefined":return g.a.createElement(V,n);case"date":return g.a.createElement(B,Object.assign({value:t.value},n));case"regexp":return g.a.createElement(G,Object.assign({value:t.value},n));default:return g.a.createElement("div",{className:"object-value"},JSON.stringify(t.value))}},r.getEditInput=function(){var t=r.props.theme,e=r.state.editValue;return g.a.createElement("div",null,g.a.createElement(ti,Object.assign({type:"text",inputRef:function(t){return t&&t.focus()},value:e,className:"variable-editor",onChange:function(t){var e=t.target.value,i=tr(e);r.setState({editValue:e,parsedInput:{type:i.type,value:i.value}})},onKeyDown:function(t){switch(t.key){case"Escape":r.setState({editMode:!1,editValue:""});break;case"Enter":(t.ctrlKey||t.metaKey)&&r.submitEdit(!0)}t.stopPropagation()},placeholder:"update this value",minRows:2},C(t,"edit-input"))),g.a.createElement("div",C(t,"edit-icon-container"),g.a.createElement(tc,Object.assign({className:"edit-cancel"},C(t,"cancel-icon"),{onClick:function(){r.setState({editMode:!1,editValue:""})}})),g.a.createElement(tm,Object.assign({className:"edit-check string-value"},C(t,"check-icon"),{onClick:function(){r.submitEdit()}})),g.a.createElement("div",null,r.showDetected())))},r.submitEdit=function(t){var e=r.props,i=e.variable,n=e.namespace,s=e.rjvId,a=r.state,o=a.editValue,l=a.parsedInput,h=o;t&&l.type&&(h=l.value),r.setState({editMode:!1}),D.dispatch({name:"VARIABLE_UPDATED",rjvId:s,data:{name:i.name,namespace:n,existing_value:i.value,new_value:h,variable_removed:!1}})},r.showDetected=function(){var t=r.props,e=t.theme,i=(t.variable,t.namespace,t.rjvId,r.state.parsedInput),s=(i.type,i.value,r.getDetectedInput());if(s)return g.a.createElement("div",null,g.a.createElement("div",C(e,"detected-row"),s,g.a.createElement(tm,{className:"edit-check detected",style:n({verticalAlign:"top",paddingLeft:"3px"},C(e,"check-icon").style),onClick:function(){r.submitEdit(!0)}})))},r.getDetectedInput=function(){var t=r.state.parsedInput,e=t.type,i=t.value,s=c(r).props,a=s.theme;if(!1!==e)switch(e.toLowerCase()){case"object":return g.a.createElement("span",null,g.a.createElement("span",{style:n(n({},C(a,"brace").style),{},{cursor:"default"})},"{"),g.a.createElement("span",{style:n(n({},C(a,"ellipsis").style),{},{cursor:"default"})},"..."),g.a.createElement("span",{style:n(n({},C(a,"brace").style),{},{cursor:"default"})},"}"));case"array":return g.a.createElement("span",null,g.a.createElement("span",{style:n(n({},C(a,"brace").style),{},{cursor:"default"})},"["),g.a.createElement("span",{style:n(n({},C(a,"ellipsis").style),{},{cursor:"default"})},"..."),g.a.createElement("span",{style:n(n({},C(a,"brace").style),{},{cursor:"default"})},"]"));case"string":return g.a.createElement(U,Object.assign({value:i},s));case"integer":return g.a.createElement(H,Object.assign({value:i},s));case"float":return g.a.createElement(P,Object.assign({value:i},s));case"boolean":return g.a.createElement(M,Object.assign({value:i},s));case"function":return g.a.createElement(j,Object.assign({value:i},s));case"null":return g.a.createElement(z,s);case"nan":return g.a.createElement(F,s);case"undefined":return g.a.createElement(V,s);case"date":return g.a.createElement(B,Object.assign({value:new Date(i)},s))}},r.state={editMode:!1,editValue:"",hovered:!1,renameKey:!1,parsedInput:{type:!1,value:null}},r}return o(i,[{key:"render",value:function(){var t=this,e=this.props,i=e.variable,r=e.singleIndent,s=e.type,a=e.theme,o=e.namespace,l=e.indentWidth,h=e.enableClipboard,d=e.onEdit,u=e.onDelete,c=e.onSelect,p=e.displayArrayKey,f=e.quotesOnKeys,m=this.state.editMode;return g.a.createElement("div",Object.assign({},C(a,"objectKeyVal",{paddingLeft:l*r}),{onMouseEnter:function(){return t.setState(n(n({},t.state),{},{hovered:!0}))},onMouseLeave:function(){return t.setState(n(n({},t.state),{},{hovered:!1}))},className:"variable-row",key:i.name}),"array"==s?p?g.a.createElement("span",Object.assign({},C(a,"array-key"),{key:i.name+"_"+o}),i.name,g.a.createElement("div",C(a,"colon"),":")):null:g.a.createElement("span",null,g.a.createElement("span",Object.assign({},C(a,"object-name"),{className:"object-key",key:i.name+"_"+o}),!!f&&g.a.createElement("span",{style:{verticalAlign:"top"}},'"'),g.a.createElement("span",{style:{display:"inline-block"}},i.name),!!f&&g.a.createElement("span",{style:{verticalAlign:"top"}},'"')),g.a.createElement("span",C(a,"colon"),":")),g.a.createElement("div",Object.assign({className:"variable-value",onClick:!1===c&&!1===d?null:function(e){var r=I(o);(e.ctrlKey||e.metaKey)&&!1!==d?t.prepopInput(i):!1!==c&&(r.shift(),c(n(n({},i),{},{namespace:r})))}},C(a,"variableValue",{cursor:!1===c?"default":"pointer"})),this.getValue(i,m)),h?g.a.createElement(tb,{rowHovered:this.state.hovered,hidden:m,src:i.value,clickCallback:h,theme:a,namespace:[].concat(I(o),[i.name])}):null,!1!==d&&0==m?this.getEditIcon():null,!1!==u&&0==m?this.getRemoveIcon():null)}}]),i}(g.a.PureComponent),tx=function(t){h(i,t);var e=p(i);function i(){var t;s(this,i);for(var r=arguments.length,a=Array(r),o=0;o0?a:null,namespace:s.splice(0,s.length-1),existing_value:o,variable_removed:!1,key_name:null};"object"===_(o)?D.dispatch({name:"ADD_VARIABLE_KEY_REQUEST",rjvId:l,data:t}):D.dispatch({name:"VARIABLE_ADDED",rjvId:l,data:n(n({},t),{},{new_value:[].concat(I(o),[null])})})}})))},t.getRemoveObject=function(e){var i=t.props,r=i.theme,n=(i.hover,i.namespace),s=i.name,a=i.src,o=i.rjvId;if(1!==n.length)return g.a.createElement("span",{className:"click-to-remove",style:{display:e?"inline-block":"none"}},g.a.createElement(tc,Object.assign({className:"click-to-remove-icon"},C(r,"removeVarIcon"),{onClick:function(){D.dispatch({name:"VARIABLE_REMOVED",rjvId:o,data:{name:s,namespace:n.splice(0,n.length-1),existing_value:a,variable_removed:!0}})}})))},t.render=function(){var e=t.props,i=e.theme,r=e.onDelete,n=e.onAdd,s=e.enableClipboard,a=e.src,o=e.namespace,l=e.rowHovered;return g.a.createElement("div",Object.assign({},C(i,"object-meta-data"),{className:"object-meta-data",onClick:function(t){t.stopPropagation()}}),t.getObjectSize(),s?g.a.createElement(tb,{rowHovered:l,clickCallback:s,src:a,theme:i,namespace:o}):null,!1!==n?t.getAddAttribute(l):null,!1!==r?t.getRemoveObject(l):null)},t}return i}(g.a.PureComponent);function t_(t){var e=t.parent_type,i=t.namespace,r=t.quotesOnKeys,n=t.theme,s=t.jsvRoot,a=t.name,o=t.displayArrayKey,l=t.name?t.name:"";return s&&(!1===a||null===a)?g.a.createElement("span",null):"array"==e?o?g.a.createElement("span",Object.assign({},C(n,"array-key"),{key:i}),g.a.createElement("span",{className:"array-key"},l),g.a.createElement("span",C(n,"colon"),":")):g.a.createElement("span",null):g.a.createElement("span",Object.assign({},C(n,"object-name"),{key:i}),g.a.createElement("span",{className:"object-key"},r&&g.a.createElement("span",{style:{verticalAlign:"top"}},'"'),g.a.createElement("span",null,l),r&&g.a.createElement("span",{style:{verticalAlign:"top"}},'"')),g.a.createElement("span",C(n,"colon"),":"))}function tw(t){var e=t.theme;switch(t.iconStyle){case"triangle":return g.a.createElement(td,Object.assign({},C(e,"expanded-icon"),{className:"expanded-icon"}));case"square":return g.a.createElement(to,Object.assign({},C(e,"expanded-icon"),{className:"expanded-icon"}));default:return g.a.createElement(ts,Object.assign({},C(e,"expanded-icon"),{className:"expanded-icon"}))}}function tA(t){var e=t.theme;switch(t.iconStyle){case"triangle":return g.a.createElement(th,Object.assign({},C(e,"collapsed-icon"),{className:"collapsed-icon"}));case"square":return g.a.createElement(tl,Object.assign({},C(e,"collapsed-icon"),{className:"collapsed-icon"}));default:return g.a.createElement(ta,Object.assign({},C(e,"collapsed-icon"),{className:"collapsed-icon"}))}}var tS=function(t){h(i,t);var e=p(i);function i(t){var r;return s(this,i),(r=e.call(this,t)).toggleCollapsed=function(t){var e=[];for(var i in r.state.expanded)e.push(r.state.expanded[i]);e[t]=!e[t],r.setState({expanded:e})},r.state={expanded:[]},r}return o(i,[{key:"getExpandedIcon",value:function(t){var e=this.props,i=e.theme,r=e.iconStyle;return this.state.expanded[t]?g.a.createElement(tw,{theme:i,iconStyle:r}):g.a.createElement(tA,{theme:i,iconStyle:r})}},{key:"render",value:function(){var t=this,e=this.props,i=e.src,r=e.groupArraysAfterLength,n=(e.depth,e.name),s=e.theme,a=e.jsvRoot,o=e.namespace,l=(e.parent_type,x(e,["src","groupArraysAfterLength","depth","name","theme","jsvRoot","namespace","parent_type"])),h=0,d=5*this.props.indentWidth;a||(h=5*this.props.indentWidth);var u=Math.ceil(i.length/r);return g.a.createElement("div",Object.assign({className:"object-key-val"},C(s,a?"jsv-root":"objectKeyVal",{paddingLeft:h})),g.a.createElement(t_,this.props),g.a.createElement("span",null,g.a.createElement(tx,Object.assign({size:i.length},this.props))),I(Array(u)).map(function(e,a){return g.a.createElement("div",Object.assign({key:a,className:"object-key-val array-group"},C(s,"objectKeyVal",{marginLeft:6,paddingLeft:d})),g.a.createElement("span",C(s,"brace-row"),g.a.createElement("div",Object.assign({className:"icon-container"},C(s,"icon-container"),{onClick:function(e){t.toggleCollapsed(a)}}),t.getExpandedIcon(a)),t.state.expanded[a]?g.a.createElement(tC,Object.assign({key:n+a,depth:0,name:!1,collapsed:!1,groupArraysAfterLength:r,index_offset:a*r,src:i.slice(a*r,a*r+r),namespace:o,type:"array",parent_type:"array_group",theme:s},l)):g.a.createElement("span",Object.assign({},C(s,"brace"),{onClick:function(e){t.toggleCollapsed(a)},className:"array-group-brace"}),"[",g.a.createElement("div",Object.assign({},C(s,"array-group-meta-data"),{className:"array-group-meta-data"}),g.a.createElement("span",Object.assign({className:"object-size"},C(s,"object-size")),a*r," - ",a*r+r>i.length?i.length:a*r+r)),"]")))}))}}]),i}(g.a.PureComponent),tE=function(t){h(i,t);var e=p(i);function i(t){s(this,i),(r=e.call(this,t)).toggleCollapsed=function(){r.setState({expanded:!r.state.expanded},function(){N.set(r.props.rjvId,r.props.namespace,"expanded",r.state.expanded)})},r.getObjectContent=function(t,e,i){return g.a.createElement("div",{className:"pushed-content object-container"},g.a.createElement("div",Object.assign({className:"object-content"},C(r.props.theme,"pushed-content")),r.renderObjectContents(e,i)))},r.getEllipsis=function(){return 0===r.state.size?null:g.a.createElement("div",Object.assign({},C(r.props.theme,"ellipsis"),{className:"node-ellipsis",onClick:r.toggleCollapsed}),"...")},r.getObjectMetaData=function(t){var e=r.props,i=(e.rjvId,e.theme,r.state),n=i.size,s=i.hovered;return g.a.createElement(tx,Object.assign({rowHovered:s,size:n},r.props))},r.renderObjectContents=function(t,e){var i,n=r.props,s=n.depth,a=n.parent_type,o=n.index_offset,l=n.groupArraysAfterLength,h=n.namespace,d=r.state.object_type,u=[],c=Object.keys(t||{});return r.props.sortKeys&&"array"!==d&&(c=c.sort()),c.forEach(function(n){if(i=new tT(n,t[n]),"array_group"===a&&o&&(i.name=parseInt(i.name)+o),t.hasOwnProperty(n)){if("object"===i.type)u.push(g.a.createElement(tC,Object.assign({key:i.name,depth:s+1,name:i.name,src:i.value,namespace:h.concat(i.name),parent_type:d},e)));else if("array"===i.type){var c=tC;l&&i.value.length>l&&(c=tS),u.push(g.a.createElement(c,Object.assign({key:i.name,depth:s+1,name:i.name,src:i.value,namespace:h.concat(i.name),type:"array",parent_type:d},e)))}else u.push(g.a.createElement(ty,Object.assign({key:i.name+"_"+h,variable:i,singleIndent:5,namespace:h,type:r.props.type},e)))}}),u};var r,a=i.getState(t);return r.state=n(n({},a),{},{prevProps:{}}),r}return o(i,[{key:"getBraceStart",value:function(t,e){var i=this,r=this.props,n=r.src,s=r.theme,a=r.iconStyle;return"array_group"===r.parent_type?g.a.createElement("span",null,g.a.createElement("span",C(s,"brace"),"array"===t?"[":"{"),e?this.getObjectMetaData(n):null):g.a.createElement("span",null,g.a.createElement("span",Object.assign({onClick:function(t){i.toggleCollapsed()}},C(s,"brace-row")),g.a.createElement("div",Object.assign({className:"icon-container"},C(s,"icon-container")),g.a.createElement(e?tw:tA,{theme:s,iconStyle:a})),g.a.createElement(t_,this.props),g.a.createElement("span",C(s,"brace"),"array"===t?"[":"{")),e?this.getObjectMetaData(n):null)}},{key:"render",value:function(){var t=this,e=this.props,i=e.depth,r=e.src,s=(e.namespace,e.name,e.type,e.parent_type),a=e.theme,o=e.jsvRoot,l=e.iconStyle,h=x(e,["depth","src","namespace","name","type","parent_type","theme","jsvRoot","iconStyle"]),d=this.state,u=d.object_type,c=d.expanded,p={};return o||"array_group"===s?"array_group"===s&&(p.borderLeft=0,p.display="inline"):p.paddingLeft=5*this.props.indentWidth,g.a.createElement("div",Object.assign({className:"object-key-val",onMouseEnter:function(){return t.setState(n(n({},t.state),{},{hovered:!0}))},onMouseLeave:function(){return t.setState(n(n({},t.state),{},{hovered:!1}))}},C(a,o?"jsv-root":"objectKeyVal",p)),this.getBraceStart(u,c),c?this.getObjectContent(i,r,n({theme:a,iconStyle:l},h)):this.getEllipsis(),g.a.createElement("span",{className:"brace-row"},g.a.createElement("span",{style:n(n({},C(a,"brace").style),{},{paddingLeft:c?"3px":"0px"})},"array"===u?"]":"}"),c?null:this.getObjectMetaData(r)))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var r=e.prevProps;return t.src!==r.src||t.collapsed!==r.collapsed||t.name!==r.name||t.namespace!==r.namespace||t.rjvId!==r.rjvId?n(n({},i.getState(t)),{},{prevProps:t}):null}}]),i}(g.a.PureComponent);tE.getState=function(t){var e=Object.keys(t.src).length,i=(!1===t.collapsed||!0!==t.collapsed&&t.collapsed>t.depth)&&(!t.shouldCollapse||!1===t.shouldCollapse({name:t.name,src:t.src,type:_(t.src),namespace:t.namespace}))&&0!==e;return{expanded:N.get(t.rjvId,t.namespace,"expanded",i),object_type:"array"===t.type?"array":"object",parent_type:"array"===t.type?"array":"object",size:e,hovered:!1}};var tT=function t(e,i){s(this,t),this.name=e,this.value=i,this.type=_(i)};y(tE);var tC=tE,tk=function(t){h(i,t);var e=p(i);function i(){var t;s(this,i);for(var r=arguments.length,n=Array(r),a=0;ae.groupArraysAfterLength&&(r=tS),g.a.createElement("div",{className:"pretty-json-container object-container"},g.a.createElement("div",{className:"object-content"},g.a.createElement(r,Object.assign({namespace:i,depth:0,jsvRoot:!0},e))))},t}return i}(g.a.PureComponent),tM=function(t){h(i,t);var e=p(i);function i(t){var r;return s(this,i),(r=e.call(this,t)).closeModal=function(){D.dispatch({rjvId:r.props.rjvId,name:"RESET"})},r.submit=function(){r.props.submit(r.state.input)},r.state={input:t.input?t.input:""},r}return o(i,[{key:"render",value:function(){var t=this,e=this.props,i=e.theme,r=e.rjvId,n=e.isValid,s=this.state.input,a=n(s);return g.a.createElement("div",Object.assign({className:"key-modal-request"},C(i,"key-modal-request"),{onClick:this.closeModal}),g.a.createElement("div",Object.assign({},C(i,"key-modal"),{onClick:function(t){t.stopPropagation()}}),g.a.createElement("div",C(i,"key-modal-label"),"Key Name:"),g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("input",Object.assign({},C(i,"key-modal-input"),{className:"key-modal-input",ref:function(t){return t&&t.focus()},spellCheck:!1,value:s,placeholder:"...",onChange:function(e){t.setState({input:e.target.value})},onKeyPress:function(e){a&&"Enter"===e.key?t.submit():"Escape"===e.key&&t.closeModal()}})),a?g.a.createElement(tm,Object.assign({},C(i,"key-modal-submit"),{className:"key-modal-submit",onClick:function(e){return t.submit()}})):null),g.a.createElement("span",C(i,"key-modal-cancel"),g.a.createElement(tf,Object.assign({},C(i,"key-modal-cancel-icon"),{className:"key-modal-cancel",onClick:function(){D.dispatch({rjvId:r,name:"RESET"})}})))))}}]),i}(g.a.PureComponent),tB=function(t){h(i,t);var e=p(i);function i(){var t;s(this,i);for(var r=arguments.length,a=Array(r),o=0;ot.edge(e).weight}(t)):function(t){var e=[],i={},r={};return t.nodes().forEach(function n(s){if(!Object.hasOwn(r,s))r[s]=!0,i[s]=!0,t.outEdges(s).forEach(t=>{Object.hasOwn(i,t.w)?e.push(t):n(t.w)}),delete i[s]}),e}(t)).forEach(e=>{var i=t.edge(e);t.removeEdge(e),i.forwardName=e.name,i.reversed=!0,t.setEdge(e.w,e.v,i,n("rev"))})},undo:function(t){t.edges().forEach(e=>{var i=t.edge(e);if(i.reversed){t.removeEdge(e);var r=i.forwardName;delete i.reversed,delete i.forwardName,t.setEdge(e.w,e.v,i,r)}})}}},517329:function(t,e,i){var r=i(150726);t.exports=function(t){t.children().forEach(function e(i){var r=t.children(i),s=t.node(i);if(r.length&&r.forEach(e),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,o=s.maxRank+1;ar(t.node(e))),t.edges().forEach(e=>{var i=t.edge(e);i.points.forEach(r),Object.hasOwn(i,"y")&&r(i)})}(t),("lr"===i||"rl"===i)&&(function(t){t.nodes().forEach(e=>n(t.node(e))),t.edges().forEach(e=>{var i=t.edge(e);i.points.forEach(n),Object.hasOwn(i,"x")&&n(i)})}(t),e(t))}};function e(t){t.nodes().forEach(e=>i(t.node(e))),t.edges().forEach(e=>i(t.edge(e)))}function i(t){var e=t.width;t.width=t.height,t.height=e}function r(t){t.y=-t.y}function n(t){var e=t.x;t.x=t.y,t.y=e}},220357:function(t){function e(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function i(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=class t{dequeue(){var t=this._sentinel,i=t._prev;if(i!==t)return e(i),i}enqueue(t){var i=this._sentinel;t._prev&&t._next&&e(t),t._next=i._next,i._next._prev=t,i._next=t,t._prev=i}toString(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,i)),r=r._prev;return"["+t.join(", ")+"]"}constructor(){var t={};t._next=t._prev=t,this._sentinel=t}}},584725:function(t,e,i){var r=i(150726),n=i(976107).Graph;t.exports={debugOrdering:function(t){var e=r.buildLayerMatrix(t),i=new n({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(e=>{i.setNode(e,{label:e}),i.setParent(e,"layer"+t.node(e).rank)}),t.edges().forEach(t=>i.setEdge(t.v,t.w,{},t.name)),e.forEach((t,e)=>{i.setNode("layer"+e,{rank:"same"}),t.reduce((t,e)=>(i.setEdge(t,e,{style:"invis"}),e))}),i}}},510484:function(t,e,i){var r=i(976107).Graph,n=i(220357);t.exports=function(t,e){if(1>=t.nodeCount())return[];var i=function(t,e){var i=new r,s=0,a=0;t.nodes().forEach(t=>{i.setNode(t,{v:t,in:0,out:0})}),t.edges().forEach(t=>{var r=i.edge(t.v,t.w)||0,n=e(t);i.setEdge(t.v,t.w,r+n),a=Math.max(a,i.node(t.v).out+=n),s=Math.max(s,i.node(t.w).in+=n)});var l=(function(t){for(var e=[],i=0;inew n),h=s+1;return i.nodes().forEach(t=>{o(l,h,i.node(t))}),{graph:i,buckets:l,zeroIdx:h}}(t,e||s);return(function(t,e,i){for(var r,n=[],s=e[e.length-1],o=e[0];t.nodeCount();){for(;r=o.dequeue();)a(t,e,i,r);for(;r=s.dequeue();)a(t,e,i,r);if(t.nodeCount()){for(var l=e.length-2;l>0;--l)if(r=e[l].dequeue()){n=n.concat(a(t,e,i,r,!0));break}}}return n})(i.graph,i.buckets,i.zeroIdx).flatMap(e=>t.outEdges(e.v,e.w))};var s=()=>1;function a(t,e,i,r,n){var s=n?[]:void 0;return t.inEdges(r.v).forEach(r=>{var a=t.edge(r),l=t.node(r.v);n&&s.push({v:r.v,w:r.w}),l.out-=a,o(e,i,l)}),t.outEdges(r.v).forEach(r=>{var n=t.edge(r),s=r.w,a=t.node(s);a.in-=n,o(e,i,a)}),t.removeNode(r.v),s}function o(t,e,i){i.out?i.in?t[i.out-i.in+e].enqueue(i):t[t.length-1].enqueue(i):t[0].enqueue(i)}},544752:function(t,e,i){"use strict";var r=i(749700),n=i(769702),s=i(580874),a=i(150726).normalizeRanks,o=i(978739),l=i(150726).removeEmptyRanks,h=i(946140),d=i(517329),u=i(630198),c=i(853018),p=i(545483),f=i(150726),g=i(976107).Graph;t.exports=function(t,e){var i=e&&e.debugTiming?f.time:f.notime;i("layout",()=>{var T=i(" buildLayoutGraph",()=>(function(t){var e=new g({multigraph:!0,compound:!0}),i=E(t.graph());return e.setGraph(Object.assign({},v,S(i,m),f.pick(i,b))),t.nodes().forEach(i=>{var r=S(E(t.node(i)),y);Object.keys(x).forEach(t=>{void 0===r[t]&&(r[t]=x[t])}),e.setNode(i,r),e.setParent(i,t.parent(i))}),t.edges().forEach(i=>{var r=E(t.edge(i));e.setEdge(i,Object.assign({},w,S(r,_),f.pick(r,A)))}),e})(t));i(" runLayout",()=>(function(t,e,i){e(" makeSpaceForEdgeLabels",()=>(function(t){var e=t.graph();e.ranksep/=2,t.edges().forEach(i=>{var r=t.edge(i);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})})(t)),e(" removeSelfEdges",()=>(function(t){t.edges().forEach(e=>{if(e.v===e.w){var i=t.node(e.v);!i.selfEdges&&(i.selfEdges=[]),i.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})})(t)),e(" acyclic",()=>r.run(t)),e(" nestingGraph.run",()=>h.run(t)),e(" rank",()=>s(f.asNonCompoundGraph(t))),e(" injectEdgeLabelProxies",()=>(function(t){t.edges().forEach(e=>{var i=t.edge(e);if(i.width&&i.height){var r=t.node(e.v),n={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};f.addDummyNode(t,"edge-proxy",n,"_ep")}})})(t)),e(" removeEmptyRanks",()=>l(t)),e(" nestingGraph.cleanup",()=>h.cleanup(t)),e(" normalizeRanks",()=>a(t)),e(" assignRankMinMax",()=>(function(t){var e=0;t.nodes().forEach(i=>{var r=t.node(i);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e})(t)),e(" removeEdgeLabelProxies",()=>(function(t){t.nodes().forEach(e=>{var i=t.node(e);"edge-proxy"===i.dummy&&(t.edge(i.e).labelRank=i.rank,t.removeNode(e))})})(t)),e(" normalize.run",()=>n.run(t)),e(" parentDummyChains",()=>o(t)),e(" addBorderSegments",()=>d(t)),e(" order",()=>c(t,i)),e(" insertSelfEdges",()=>(function(t){f.buildLayerMatrix(t).forEach(e=>{var i=0;e.forEach((e,r)=>{var n=t.node(e);n.order=r+i,(n.selfEdges||[]).forEach(e=>{f.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:n.rank,order:r+ ++i,e:e.e,label:e.label},"_se")}),delete n.selfEdges})})})(t)),e(" adjustCoordinateSystem",()=>u.adjust(t)),e(" position",()=>p(t)),e(" positionSelfEdges",()=>(function(t){t.nodes().forEach(e=>{var i=t.node(e);if("selfedge"===i.dummy){var r=t.node(i.e.v),n=r.x+r.width/2,s=r.y,a=i.x-n,o=r.height/2;t.setEdge(i.e,i.label),t.removeNode(e),i.label.points=[{x:n+2*a/3,y:s-o},{x:n+5*a/6,y:s-o},{x:n+a,y:s},{x:n+5*a/6,y:s+o},{x:n+2*a/3,y:s+o}],i.label.x=i.x,i.label.y=i.y}})})(t)),e(" removeBorderNodes",()=>(function(t){t.nodes().forEach(e=>{if(t.children(e).length){var i=t.node(e),r=t.node(i.borderTop),n=t.node(i.borderBottom),s=t.node(i.borderLeft[i.borderLeft.length-1]),a=t.node(i.borderRight[i.borderRight.length-1]);i.width=Math.abs(a.x-s.x),i.height=Math.abs(n.y-r.y),i.x=s.x+i.width/2,i.y=r.y+i.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})})(t)),e(" normalize.undo",()=>n.undo(t)),e(" fixupEdgeLabelCoords",()=>(function(t){t.edges().forEach(e=>{var i=t.edge(e);if(Object.hasOwn(i,"x"))switch(("l"===i.labelpos||"r"===i.labelpos)&&(i.width-=i.labeloffset),i.labelpos){case"l":i.x-=i.width/2+i.labeloffset;break;case"r":i.x+=i.width/2+i.labeloffset}})})(t)),e(" undoCoordinateSystem",()=>u.undo(t)),e(" translateGraph",()=>(function(t){var e=Number.POSITIVE_INFINITY,i=0,r=Number.POSITIVE_INFINITY,n=0,s=t.graph(),a=s.marginx||0,o=s.marginy||0;function l(t){var s=t.x,a=t.y,o=t.width,l=t.height;e=Math.min(e,s-o/2),i=Math.max(i,s+o/2),r=Math.min(r,a-l/2),n=Math.max(n,a+l/2)}t.nodes().forEach(e=>l(t.node(e))),t.edges().forEach(e=>{var i=t.edge(e);Object.hasOwn(i,"x")&&l(i)}),e-=a,r-=o,t.nodes().forEach(i=>{var n=t.node(i);n.x-=e,n.y-=r}),t.edges().forEach(i=>{var n=t.edge(i);n.points.forEach(t=>{t.x-=e,t.y-=r}),Object.hasOwn(n,"x")&&(n.x-=e),Object.hasOwn(n,"y")&&(n.y-=r)}),s.width=i-e+a,s.height=n-r+o})(t)),e(" assignNodeIntersects",()=>(function(t){t.edges().forEach(e=>{var i,r,n=t.edge(e),s=t.node(e.v),a=t.node(e.w);n.points?(i=n.points[0],r=n.points[n.points.length-1]):(n.points=[],i=a,r=s),n.points.unshift(f.intersectRect(s,i)),n.points.push(f.intersectRect(a,r))})})(t)),e(" reversePoints",()=>(function(t){t.edges().forEach(e=>{var i=t.edge(e);i.reversed&&i.points.reverse()})})(t)),e(" acyclic.undo",()=>r.undo(t))})(T,i,e)),i(" updateInputGraph",()=>(function(t,e){t.nodes().forEach(i=>{var r=t.node(i),n=e.node(i);r&&(r.x=n.x,r.y=n.y,r.rank=n.rank,e.children(i).length&&(r.width=n.width,r.height=n.height))}),t.edges().forEach(i=>{var r=t.edge(i),n=e.edge(i);r.points=n.points,Object.hasOwn(n,"x")&&(r.x=n.x,r.y=n.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height})(t,T))})};var m=["nodesep","edgesep","ranksep","marginx","marginy"],v={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],y=["width","height","rank"],x={width:0,height:0},_=["minlen","weight","width","height","labeloffset"],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},A=["labelpos"];function S(t,e){return f.mapValues(f.pick(t,e),Number)}function E(t){var e={};return t&&Object.entries(t).forEach(t=>{var[i,r]=t;"string"==typeof i&&(i=i.toLowerCase()),e[i]=r}),e}},946140:function(t,e,i){var r=i(150726);t.exports={run:function(t){var e=r.addDummyNode(t,"root",{},"_root"),i=function(t){var e={};return t.children().forEach(i=>(function i(r,n){var s=t.children(r);s&&s.length&&s.forEach(t=>i(t,n+1)),e[r]=n})(i,1)),e}(t),n=Object.values(i),s=r.applyWithChunking(Math.max,n)-1,a=2*s+1;t.graph().nestingRoot=e,t.edges().forEach(e=>t.edge(e).minlen*=a);var o=function(t){return t.edges().reduce((e,i)=>e+t.edge(i).weight,0)}(t)+1;t.children().forEach(n=>(function t(e,i,n,s,a,o,l){var h=e.children(l);if(!h.length){l!==i&&e.setEdge(i,l,{weight:0,minlen:n});return}var d=r.addBorderNode(e,"_bt"),u=r.addBorderNode(e,"_bb"),c=e.node(l);e.setParent(d,l),c.borderTop=d,e.setParent(u,l),c.borderBottom=u,h.forEach(r=>{t(e,i,n,s,a,o,r);var h=e.node(r),c=h.borderTop?h.borderTop:r,p=h.borderBottom?h.borderBottom:r,f=h.borderTop?s:2*s,g=c!==p?1:a-o[l]+1;e.setEdge(d,c,{weight:f,minlen:g,nestingEdge:!0}),e.setEdge(p,u,{weight:f,minlen:g,nestingEdge:!0})}),!e.parent(l)&&e.setEdge(i,d,{weight:0,minlen:a+o[l]})})(t,e,a,o,s,i,n)),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(e=>{t.edge(e).nestingEdge&&t.removeEdge(e)})}}},769702:function(t,e,i){"use strict";var r=i(150726);t.exports={run:function(t){t.graph().dummyChains=[],t.edges().forEach(e=>(function(t,e){var i,n,s,a=e.v,o=t.node(a).rank,l=e.w,h=t.node(l).rank,d=e.name,u=t.edge(e),c=u.labelRank;if(h!==o+1){for(t.removeEdge(e),s=0,++o;o{var i,r=t.node(e),n=r.edgeLabel;for(t.setEdge(r.edgeObj,n);r.dummy;)i=t.successors(e)[0],t.removeNode(e),n.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),e=i,r=t.node(e)})}}},256834:function(t){t.exports=function(t,e,i){var r,n={};i.forEach(i=>{for(var s,a,o=t.parent(i);o;){if((s=t.parent(o))?(a=n[s],n[s]=o):(a=r,r=o),a&&a!==o){e.setEdge(a,o);return}o=s}})}},64921:function(t){t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.map(e=>{var i=t.inEdges(e);if(!i.length)return{v:e};var r=i.reduce((e,i)=>{var r=t.edge(i),n=t.node(i.v);return{sum:e.sum+r.weight*n.order,weight:e.weight+r.weight}},{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}})}},506035:function(t,e,i){var r=i(976107).Graph,n=i(150726);t.exports=function(t,e,i){var s=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),a=new r({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(e=>t.node(e));return t.nodes().forEach(r=>{var n=t.node(r),o=t.parent(r);(n.rank===e||n.minRank<=e&&e<=n.maxRank)&&(a.setNode(r),a.setParent(r,o||s),t[i](r).forEach(e=>{var i=e.v===r?e.w:e.v,n=a.edge(i,r),s=void 0!==n?n.weight:0;a.setEdge(i,r,{weight:t.edge(e).weight+s})}),Object.hasOwn(n,"minRank")&&a.setNode(r,{borderLeft:n.borderLeft[e],borderRight:n.borderRight[e]}))}),a}},572979:function(t,e,i){"use strict";var r=i(150726).zipObject;t.exports=function(t,e){for(var i=0,n=1;ne)),s=e.flatMap(e=>t.outEdges(e).map(e=>({pos:n[e.w],weight:t.edge(e).weight})).sort((t,e)=>t.pos-e.pos)),a=1;a{var e=t.pos+a;l[e]+=t.weight;for(var i=0;e>0;)e%2&&(i+=l[e+1]),e=e-1>>1,l[e]+=t.weight;h+=t.weight*i}),h}(t,e[n-1],e[n]);return i}},853018:function(t,e,i){"use strict";var r=i(848842),n=i(572979),s=i(322486),a=i(506035),o=i(256834),l=i(976107).Graph,h=i(150726);t.exports=function t(e,i){if(i&&"function"==typeof i.customOrder){i.customOrder(e,t);return}var a=h.maxRank(e),c=d(e,h.range(1,a+1),"inEdges"),p=d(e,h.range(a-1,-1,-1),"outEdges"),f=r(e);if(u(e,f),!i||!i.disableOptimalOrderHeuristic){for(var g,m=Number.POSITIVE_INFINITY,v=0,b=0;b<4;++v,++b){(function(t,e){var i=new l;t.forEach(function(t){var r=t.graph().root,n=s(t,r,i,e);n.vs.forEach((e,i)=>t.node(e).order=i),o(t,i,n.vs)})})(v%2?c:p,v%4>=2),f=h.buildLayerMatrix(e);var y=n(e,f);ye.forEach((e,i)=>t.node(e).order=i))}},848842:function(t,e,i){"use strict";var r=i(150726);t.exports=function(t){var e={},i=t.nodes().filter(e=>!t.children(e).length),n=i.map(e=>t.node(e).rank),s=r.applyWithChunking(Math.max,n),a=r.range(s+1).map(()=>[]);return i.sort((e,i)=>t.node(e).rank-t.node(i).rank).forEach(function i(r){!e[r]&&(e[r]=!0,a[t.node(r).rank].push(r),t.successors(r).forEach(i))}),a}},511257:function(t,e,i){"use strict";var r=i(150726);t.exports=function(t,e){var i={};return t.forEach((t,e)=>{var r=i[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)}),e.edges().forEach(t=>{var e=i[t.v],r=i[t.w];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.w]))}),function(t){for(var e=[];t.length;){var i=t.pop();e.push(i),i.in.reverse().forEach(function(t){return e=>{if(!e.merged)(void 0===e.barycenter||void 0===t.barycenter||e.barycenter>=t.barycenter)&&function(t,e){var i=0,r=0;t.weight&&(i+=t.barycenter*t.weight,r+=t.weight),e.weight&&(i+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=i/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}(i)),i.out.forEach(function(e){return i=>{i.in.push(e),0==--i.indegree&&t.push(i)}}(i))}return e.filter(t=>!t.merged).map(t=>r.pick(t,["vs","i","barycenter","weight"]))}(Object.values(i).filter(t=>!t.indegree))}},322486:function(t,e,i){var r=i(64921),n=i(511257),s=i(561447);t.exports=function t(e,i,a,o){var l=e.children(i),h=e.node(i),d=h?h.borderLeft:void 0,u=h?h.borderRight:void 0,c={};d&&(l=l.filter(t=>t!==d&&t!==u));var p=r(e,l);p.forEach(i=>{if(e.children(i.v).length){var r=t(e,i.v,a,o);c[i.v]=r,Object.hasOwn(r,"barycenter")&&function(t,e){void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)}(i,r)}});var f=n(p,a);(function(t,e){t.forEach(t=>{t.vs=t.vs.flatMap(t=>e[t]?e[t].vs:t)})})(f,c);var g=s(f,o);if(d&&(g.vs=[d,g.vs,u].flat(!0),e.predecessors(d).length)){var m=e.node(e.predecessors(d)[0]),v=e.node(e.predecessors(u)[0]);!Object.hasOwn(g,"barycenter")&&(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+m.order+v.order)/(g.weight+2),g.weight+=2}return g}},561447:function(t,e,i){var r=i(150726);t.exports=function(t,e){var i=r.partition(t,t=>Object.hasOwn(t,"barycenter")),s=i.lhs,a=i.rhs.sort((t,e)=>e.i-t.i),o=[],l=0,h=0,d=0;s.sort(function(t){return(e,i)=>e.barycenteri.barycenter?1:t?i.i-e.i:e.i-i.i}(!!e)),d=n(o,a,d),s.forEach(t=>{d+=t.vs.length,o.push(t.vs),l+=t.barycenter*t.weight,h+=t.weight,d=n(o,a,d)});var u={vs:o.flat(!0)};return h&&(u.barycenter=l/h,u.weight=h),u};function n(t,e,i){for(var r;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),t.push(r.vs),i++;return i}},978739:function(t){t.exports=function(t){var e=function(t){var e={},i=0;return t.children().forEach(function r(n){var s=i;t.children(n).forEach(r),e[n]={low:s,lim:i++}}),e}(t);t.graph().dummyChains.forEach(i=>{for(var r=t.node(i),n=r.edgeObj,s=function(t,e,i,r){var n,s,a=[],o=[],l=Math.min(e[i].low,e[r].low),h=Math.max(e[i].lim,e[r].lim);n=i;do n=t.parent(n),a.push(n);while(n&&(e[n].low>l||h>e[n].lim));for(s=n,n=r;(n=t.parent(n))!==s;)o.push(n);return{path:a.concat(o.reverse()),lca:s}}(t,e,n.v,n.w),a=s.path,o=s.lca,l=0,h=a[0],d=!0;i!==n.w;){if(r=t.node(i),d){for(;(h=a[l])!==o&&t.node(h).maxRank{var d=function(t,e){if(t.node(e).dummy)return t.predecessors(e).find(e=>t.node(e).dummy)}(t,e),u=d?t.node(d).order:a;(d||e===l)&&(r.slice(s,h+1).forEach(e=>{t.predecessors(e).forEach(r=>{var s=t.node(r),a=s.order;(a{h=e[r],t.node(h).dummy&&t.predecessors(h).forEach(e=>{var r=t.node(e);r.dummy&&(r.orderl)&&o(i,e,h)})})}return e.length&&e.reduce(function(e,i){var n,s=-1,a=0;return i.forEach((o,l)=>{if("border"===t.node(o).dummy){var h=t.predecessors(o);h.length&&(n=t.node(h[0]).order,r(i,a,l,s,n),a=l,s=n)}r(i,a,i.length,n,e.length)}),i}),i}t.exports={positionX:function(t){var e,i=n.buildLayerMatrix(t),r=Object.assign(s(t,i),a(t,i)),o={};["u","d"].forEach(s=>{e="u"===s?i:Object.values(i).reverse(),["l","r"].forEach(i=>{"r"===i&&(e=e.map(t=>Object.values(t).reverse()));var a=("u"===s?t.predecessors:t.successors).bind(t),l=h(t,e,r,a),u=d(t,e,l.root,l.align,"r"===i);"r"===i&&(u=n.mapValues(u,t=>-t)),o[s+i]=u})});var l=u(t,o);return c(o,l),p(o,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:o,hasConflict:l,verticalAlignment:h,horizontalCompaction:d,alignCoordinates:c,findSmallestWidthAlignment:u,balance:p};function o(t,e,i){if(e>i){var r=e;e=i,i=r}var n=t[e];!n&&(t[e]=n={}),n[i]=!0}function l(t,e,i){if(e>i){var r=e;e=i,i=r}return!!t[e]&&Object.hasOwn(t[e],i)}function h(t,e,i,r){var n={},s={},a={};return e.forEach(t=>{t.forEach((t,e)=>{n[t]=t,s[t]=t,a[t]=e})}),e.forEach(t=>{var e=-1;t.forEach(t=>{var o=r(t);if(o.length){for(var h=((o=o.sort((t,e)=>a[t]-a[e])).length-1)/2,d=Math.floor(h),u=Math.ceil(h);d<=u;++d){var c=o[d];s[t]===t&&e{var a,o,l=r.node(n),h=r.node(s);if(a=0+l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":o=-l.width/2;break;case"r":o=l.width/2}if(o&&(a+=i?o:-o),o=0,a+=(l.dummy?e:t)/2,a+=(h.dummy?e:t)/2,a+=h.width/2,Object.hasOwn(h,"labelpos"))switch(h.labelpos.toLowerCase()){case"l":o=h.width/2;break;case"r":o=-h.width/2}return o&&(a+=i?o:-o),o=0,a}}(a.nodesep,a.edgesep,n);return e.forEach(e=>{var r;e.forEach(e=>{var n=i[e];if(s.setNode(n),r){var a=i[r],l=s.edge(a,n);s.setEdge(a,n,Math.max(o(t,e,r),l||0))}r=e})}),s}(t,e,i,s),l=s?"borderLeft":"borderRight";function h(t,e){for(var i=o.nodes(),r=i.pop(),n={};r;)n[r]?t(r):(n[r]=!0,i.push(r),i=i.concat(e(r))),r=i.pop()}return h(function(t){a[t]=o.inEdges(t).reduce((t,e)=>Math.max(t,a[e.v]+o.edge(e)),0)},o.predecessors.bind(o)),h(function(e){var i=o.outEdges(e).reduce((t,e)=>Math.min(t,a[e.w]-o.edge(e)),Number.POSITIVE_INFINITY),r=t.node(e);i!==Number.POSITIVE_INFINITY&&r.borderType!==l&&(a[e]=Math.max(a[e],i))},o.successors.bind(o)),Object.keys(n).forEach(t=>a[t]=a[i[t]]),a}function u(t,e){return Object.values(e).reduce((e,i)=>{var r=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY;Object.entries(i).forEach(e=>{var[i,s]=e,a=function(t,e){return t.node(e).width}(t,i)/2;r=Math.max(s+a,r),n=Math.min(s-a,n)});var s=r-n;return s{["l","r"].forEach(a=>{var o=i+a,l=t[o];if(l!==e){var h=Object.values(l),d=r-n.applyWithChunking(Math.min,h);"l"!==a&&(d=s-n.applyWithChunking(Math.max,h)),d&&(t[o]=n.mapValues(l,t=>t+d))}})})}function p(t,e){return n.mapValues(t.ul,(i,r)=>{if(e)return t[e.toLowerCase()][r];var n=Object.values(t).map(t=>t[r]).sort((t,e)=>t-e);return(n[1]+n[2])/2})}},545483:function(t,e,i){"use strict";var r=i(150726),n=i(964179).positionX;t.exports=function(t){(function(t){var e=r.buildLayerMatrix(t),i=t.graph().ranksep,n=0;e.forEach(e=>{var r=e.reduce((e,i)=>{var r=t.node(i).height;return e>r?e:r},0);e.forEach(e=>t.node(e).y=n+r/2),n+=r+i})})(t=r.asNonCompoundGraph(t)),Object.entries(n(t)).forEach(e=>{var[i,r]=e;return t.node(i).x=r})}},797377:function(t,e,i){"use strict";var r=i(976107).Graph,n=i(117737).slack;t.exports=function(t){var e,i,s=new r({directed:!1}),a=t.nodes()[0],o=t.nodeCount();for(s.setNode(a,{});function(t,e){return t.nodes().forEach(function i(r){e.nodeEdges(r).forEach(s=>{var a=s.v,o=r===a?s.w:a;!t.hasNode(o)&&!n(e,s)&&(t.setNode(o,{}),t.setEdge(r,o,{}),i(o))})}),t.nodeCount()}(s,t){var s=Number.POSITIVE_INFINITY;return(t.hasNode(r.v)!==t.hasNode(r.w)&&(s=n(e,r)),se.node(t).rank+=i)}(s,t,i);return s}},580874:function(t,e,i){"use strict";var r=i(117737).longestPath,n=i(797377),s=i(199957);t.exports=function(t){var e=t.graph().ranker;if(e instanceof Function)return e(t);switch(t.graph().ranker){case"network-simplex":default:o(t);break;case"tight-tree":(function(t){r(t),n(t)})(t);break;case"longest-path":a(t);case"none":}};var a=r;function o(t){s(t)}},199957:function(t,e,i){"use strict";var r=i(797377),n=i(117737).slack,s=i(117737).longestPath,a=i(976107).alg.preorder,o=i(976107).alg.postorder,l=i(150726).simplify;function h(t){s(t=l(t));var e,i,n=r(t);for(c(n),d(n,t);e=p(n);)i=f(n,t,e),g(n,t,e,i)}function d(t,e){var i=o(t,t.nodes());(i=i.slice(0,i.length-1)).forEach(i=>(function(t,e,i){var r=t.node(i).parent;t.edge(i,r).cutvalue=u(t,e,i)})(t,e,i))}t.exports=h,h.initLowLimValues=c,h.initCutValues=d,h.calcCutValue=u,h.leaveEdge=p,h.enterEdge=f,h.exchangeEdges=g;function u(t,e,i){var r=t.node(i).parent,n=!0,s=e.edge(i,r),a=0;return!s&&(n=!1,s=e.edge(r,i)),a=s.weight,e.nodeEdges(i).forEach(s=>{var o=s.v===i,l=o?s.w:s.v;if(l!==r){var h=o===n,d=e.edge(s).weight;if(a+=h?d:-d,function(t,e,i){return t.hasEdge(e,i)}(t,i,l)){var u=t.edge(i,l).cutvalue;a+=h?-u:u}}}),a}function c(t,e){arguments.length<2&&(e=t.nodes()[0]),function t(e,i,r,n,s){var a=r,o=e.node(n);return i[n]=!0,e.neighbors(n).forEach(s=>{!Object.hasOwn(i,s)&&(r=t(e,i,r,s,n))}),o.low=a,o.lim=r++,s?o.parent=s:delete o.parent,r}(t,{},1,e)}function p(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function f(t,e,i){var r=i.v,s=i.w;!e.hasEdge(r,s)&&(r=i.w,s=i.v);var a=t.node(r),o=t.node(s),l=a,h=!1;return a.lim>o.lim&&(l=o,h=!0),e.edges().filter(e=>h===m(t,t.node(e.v),l)&&h!==m(t,t.node(e.w),l)).reduce((t,i)=>n(e,i)!e.node(t).parent),r=a(t,i);(r=r.slice(1)).forEach(i=>{var r=t.node(i).parent,n=e.edge(i,r),s=!1;!n&&(n=e.edge(r,i),s=!0),e.node(i).rank=e.node(r).rank+(s?n.minlen:-n.minlen)})}(t,e)}function m(t,e,i){return i.low<=e.lim&&e.lim<=i.lim}},117737:function(t,e,i){"use strict";var{applyWithChunking:r}=i(150726);t.exports={longestPath:function(t){var e={};t.sources().forEach(function i(n){var s=t.node(n);if(Object.hasOwn(e,n))return s.rank;e[n]=!0;var a=r(Math.min,t.outEdges(n).map(e=>null==e?Number.POSITIVE_INFINITY:i(e.w)-t.edge(e).minlen));return a===Number.POSITIVE_INFINITY&&(a=0),s.rank=a})},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},150726:function(t,e,i){"use strict";var r=i(976107).Graph;function n(t,e,i,r){for(var n=r;t.hasNode(n);)n=h(r);return i.dummy=e,t.setNode(n,i),n}t.exports={addBorderNode:function(t,e,i,r){var s={width:0,height:0};return arguments.length>=4&&(s.rank=i,s.order=r),n(t,"border",s,e)},addDummyNode:n,applyWithChunking:a,asNonCompoundGraph:function(t){var e=new r({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(i=>{!t.children(i).length&&e.setNode(i,t.node(i))}),t.edges().forEach(i=>{e.setEdge(i,t.edge(i))}),e},buildLayerMatrix:function(t){var e=d(o(t)+1).map(()=>[]);return t.nodes().forEach(i=>{var r=t.node(i),n=r.rank;void 0!==n&&(e[n][r.order]=i)}),e},intersectRect:function(t,e){var i,r,n=t.x,s=t.y,a=e.x-n,o=e.y-s,l=t.width/2,h=t.height/2;if(!a&&!o)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(o)*l>Math.abs(a)*h?(o<0&&(h=-h),i=h*a/o,r=h):(a<0&&(l=-l),i=l,r=l*o/a),{x:n+i,y:s+r}},mapValues:function(t,e){var i=e;return"string"==typeof e&&(i=t=>t[e]),Object.entries(t).reduce((t,e)=>{var[r,n]=e;return t[r]=i(n,r),t},{})},maxRank:o,normalizeRanks:function(t){var e=a(Math.min,t.nodes().map(e=>{var i=t.node(e).rank;return void 0===i?Number.MAX_VALUE:i}));t.nodes().forEach(i=>{var r=t.node(i);Object.hasOwn(r,"rank")&&(r.rank-=e)})},notime:function(t,e){return e()},partition:function(t,e){var i={lhs:[],rhs:[]};return t.forEach(t=>{e(t)?i.lhs.push(t):i.rhs.push(t)}),i},pick:function(t,e){var i={};for(var r of e)void 0!==t[r]&&(i[r]=t[r]);return i},predecessorWeights:function(t){var e=t.nodes().map(e=>{var i={};return t.inEdges(e).forEach(e=>{i[e.v]=(i[e.v]||0)+t.edge(e).weight}),i});return u(t.nodes(),e)},range:d,removeEmptyRanks:function(t){var e=a(Math.min,t.nodes().map(e=>t.node(e).rank)),i=[];t.nodes().forEach(r=>{var n=t.node(r).rank-e;!i[n]&&(i[n]=[]),i[n].push(r)});var r=0,n=t.graph().nodeRankFactor;Array.from(i).forEach((e,i)=>{void 0===e&&i%n!=0?--r:void 0!==e&&r&&e.forEach(e=>t.node(e).rank+=r)})},simplify:function(t){var e=new r().setGraph(t.graph());return t.nodes().forEach(i=>e.setNode(i,t.node(i))),t.edges().forEach(i=>{var r=e.edge(i.v,i.w)||{weight:0,minlen:1},n=t.edge(i);e.setEdge(i.v,i.w,{weight:r.weight+n.weight,minlen:Math.max(r.minlen,n.minlen)})}),e},successorWeights:function(t){var e=t.nodes().map(e=>{var i={};return t.outEdges(e).forEach(e=>{i[e.w]=(i[e.w]||0)+t.edge(e).weight}),i});return u(t.nodes(),e)},time:function(t,e){var i=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-i)+"ms")}},uniqueId:h,zipObject:u};var s=65535;function a(t,e){if(!(e.length>s))return t.apply(null,e);var i=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,i=[],r=0;rt.apply(null,e)))}function o(t){return a(Math.max,t.nodes().map(e=>{var i=t.node(e).rank;return void 0===i?Number.MIN_VALUE:i}))}var l=0;function h(t){return t+""+ ++l}function d(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;null==e&&(e=t,t=0);var r=t=>te(t[i]=e[r],t),{})}},183117:function(t){t.exports="1.1.5"},976107:function(t,e,i){var r=i(353098);t.exports={Graph:r.Graph,json:i(25659),alg:i(866986),version:r.version}},121585:function(t){t.exports=function(t){var e,i={},r=[];return t.nodes().forEach(function(n){e=[],!function r(n){!Object.hasOwn(i,n)&&(i[n]=!0,e.push(n),t.successors(n).forEach(r),t.predecessors(n).forEach(r))}(n),e.length&&r.push(e)}),r}},725671:function(t){t.exports=function(t,r,n){!Array.isArray(r)&&(r=[r]);var s=t.isDirected()?e=>t.successors(e):e=>t.neighbors(e),a="post"===n?e:i,o=[],l={};return r.forEach(e=>{if(!t.hasNode(e))throw Error("Graph does not have node: "+e);a(e,s,l,o)}),o};function e(t,e,i,n){for(var s=[[t,!1]];s.length>0;){var a=s.pop();a[1]?n.push(a[0]):!Object.hasOwn(i,a[0])&&(i[a[0]]=!0,s.push([a[0],!0]),r(e(a[0]),t=>s.push([t,!1])))}}function i(t,e,i,n){for(var s=[t];s.length>0;){var a=s.pop();!Object.hasOwn(i,a)&&(i[a]=!0,n.push(a),r(e(a),t=>s.push(t)))}}function r(t,e){for(var i=t.length;i--;)e(t[i],i,t);return t}},890043:function(t,e,i){var r=i(892961);t.exports=function(t,e,i){return t.nodes().reduce(function(n,s){return n[s]=r(t,s,e,i),n},{})}},892961:function(t,e,i){var r=i(103573);t.exports=function(t,e,i,s){return function(t,e,i,n){var s,a,o={},l=new r,h=function(t){var e=t.v!==s?t.v:t.w,r=o[e],n=i(t),h=a.distance+n;if(n<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+n);h0&&(a=o[s=l.removeMin()]).distance!==Number.POSITIVE_INFINITY;){;n(s).forEach(h)}return o}(t,String(e),i||n,s||function(e){return t.outEdges(e)})};var n=()=>1},84365:function(t,e,i){var r=i(827458);t.exports=function(t){return r(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})}},635814:function(t){t.exports=function(t,i,r){return function(t,e,i){var r={},n=t.nodes();return n.forEach(function(t){r[t]={},r[t][t]={distance:0},n.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),i(t).forEach(function(i){var n=i.v===t?i.w:i.v,s=e(i);r[t][n]={distance:s,predecessor:t}})}),n.forEach(function(t){var e=r[t];n.forEach(function(i){var s=r[i];n.forEach(function(i){var r=s[t],n=e[i],a=s[i],o=r.distance+n.distance;o1},866986:function(t,e,i){t.exports={components:i(121585),dijkstra:i(892961),dijkstraAll:i(890043),findCycles:i(84365),floydWarshall:i(635814),isAcyclic:i(311548),postorder:i(222848),preorder:i(252538),prim:i(110234),tarjan:i(827458),topsort:i(563739)}},311548:function(t,e,i){var r=i(563739);t.exports=function(t){try{r(t)}catch(t){if(t instanceof r.CycleException)return!1;throw t}return!0}},222848:function(t,e,i){var r=i(725671);t.exports=function(t,e){return r(t,e,"post")}},252538:function(t,e,i){var r=i(725671);t.exports=function(t,e){return r(t,e,"pre")}},110234:function(t,e,i){var r=i(577372),n=i(103573);t.exports=function(t,e){var i,s=new r,a={},o=new n;function l(t){var r=t.v===i?t.w:t.v,n=o.priority(r);if(void 0!==n){var s=e(t);s0;){if(Object.hasOwn(a,i=o.removeMin()))s.setEdge(i,a[i]);else if(h)throw Error("Input graph is not connected: "+t);else h=!0;t.nodeEdges(i).forEach(l)}return s}},827458:function(t){t.exports=function(t){var e=0,i=[],r={},n=[];return t.nodes().forEach(function(s){!Object.hasOwn(r,s)&&!function s(a){var o=r[a]={onStack:!0,lowlink:e,index:e++};if(i.push(a),t.successors(a).forEach(function(t){Object.hasOwn(r,t)?r[t].onStack&&(o.lowlink=Math.min(o.lowlink,r[t].index)):(s(t),o.lowlink=Math.min(o.lowlink,r[t].lowlink))}),o.lowlink===o.index){var l,h=[];do r[l=i.pop()].onStack=!1,h.push(l);while(a!==l);n.push(h)}}(s)}),n}},563739:function(t){function e(t){var e={},r={},n=[];if(t.sinks().forEach(function s(a){if(Object.hasOwn(r,a))throw new i;!Object.hasOwn(e,a)&&(r[a]=!0,e[a]=!0,t.predecessors(a).forEach(s),delete r[a],n.push(a))}),Object.keys(e).length!==t.nodeCount())throw new i;return n}class i extends Error{constructor(){super(...arguments)}}t.exports=e,e.CycleException=i},103573:function(t){t.exports=class t{size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority}min(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key}add(t,e){var i=this._keyIndices;if(!Object.hasOwn(i,t=String(t))){var r=this._arr,n=r.length;return i[t]=n,r.push({key:t,priority:e}),this._decrease(n),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var i=this._keyIndices[t];if(e>this._arr[i].priority)throw Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[i].priority+" New: "+e);this._arr[i].priority=e,this._decrease(i)}_heapify(t){var e=this._arr,i=2*t,r=i+1,n=t;i>1].prioritys){var a=n;n=s,s=a}return n+"\x01"+s+"\x01"+(void 0===r?"\0":r)}function n(t,e){return r(t,e.v,e.w,e.name)}t.exports=class t{isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return this._defaultNodeLabelFn=t,"function"!=typeof t&&(this._defaultNodeLabelFn=()=>t),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._in[e]).length)}sinks(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._out[e]).length)}setNodes(t,e){var i=arguments,r=this;return t.forEach(function(t){i.length>1?r.setNode(t,e):r.setNode(t)}),this}setNode(t,e){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.hasOwn(this._nodes,t)}removeNode(t){var e=this;if(Object.hasOwn(this._nodes,t)){var i=t=>e.removeEdge(e._edgeObjs[t]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(function(t){e.setParent(t)}),delete this._children[t]),Object.keys(this._in[t]).forEach(i),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(i),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(void 0===e)e="\0";else{e+="";for(var i=e;void 0!==i;i=this.parent(i))if(i===t)throw Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if("\0"!==e)return e}}children(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"\0";if(this._isCompound){var e=this._children[t];if(e)return Object.keys(e)}else if("\0"===t)return this.nodes();else if(this.hasNode(t))return[]}predecessors(t){var e=this._preds[t];if(e)return Object.keys(e)}successors(t){var e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){var e=this.predecessors(t);if(e){var i=new Set(e);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var e;return 0===(e=this.isDirected()?this.successors(t):this.neighbors(t)).length}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var i=this;Object.entries(this._nodes).forEach(function(i){var[r,n]=i;t(r)&&e.setNode(r,n)}),Object.values(this._edgeObjs).forEach(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,i.edge(t))});var r={};return this._isCompound&&e.nodes().forEach(t=>e.setParent(t,function t(n){var s=i.parent(n);return void 0===s||e.hasNode(s)?(r[n]=s,s):s in r?r[s]:t(s)}(t))),e}setDefaultEdgeLabel(t){return this._defaultEdgeLabelFn=t,"function"!=typeof t&&(this._defaultEdgeLabelFn=()=>t),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){var i=this,r=arguments;return t.reduce(function(t,n){return r.length>1?i.setEdge(t,n,e):i.setEdge(t,n),n}),this}setEdge(){var t,i,n,s,a=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,i=o.w,n=o.name,2==arguments.length&&(s=arguments[1],a=!0)):(t=o,i=arguments[1],n=arguments[3],arguments.length>2&&(s=arguments[2],a=!0)),t=""+t,i=""+i,void 0!==n&&(n=""+n);var l=r(this._isDirected,t,i,n);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=s),this;if(void 0!==n&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(i),this._edgeLabels[l]=a?s:this._defaultEdgeLabelFn(t,i,n);var h=function(t,e,i,r){var n=""+e,s=""+i;if(!t&&n>s){var a=n;n=s,s=a}var o={v:n,w:s};return r&&(o.name=r),o}(this._isDirected,t,i,n);return t=h.v,i=h.w,Object.freeze(h),this._edgeObjs[l]=h,e(this._preds[i],t),e(this._sucs[t],i),this._in[i][l]=h,this._out[t][l]=h,this._edgeCount++,this}edge(t,e,i){var s=1==arguments.length?n(this._isDirected,arguments[0]):r(this._isDirected,t,e,i);return this._edgeLabels[s]}edgeAsObj(){var t=this.edge(...arguments);return"object"!=typeof t?{label:t}:t}hasEdge(t,e,i){var s=1==arguments.length?n(this._isDirected,arguments[0]):r(this._isDirected,t,e,i);return Object.hasOwn(this._edgeLabels,s)}removeEdge(t,e,s){var a=1==arguments.length?n(this._isDirected,arguments[0]):r(this._isDirected,t,e,s),o=this._edgeObjs[a];return o&&(t=o.v,e=o.w,delete this._edgeLabels[a],delete this._edgeObjs[a],i(this._preds[e],t),i(this._sucs[t],e),delete this._in[e][a],delete this._out[t][a],this._edgeCount--),this}inEdges(t,e){var i=this._in[t];if(i){var r=Object.values(i);return e?r.filter(t=>t.v===e):r}}outEdges(t,e){var i=this._out[t];if(i){var r=Object.values(i);return e?r.filter(t=>t.w===e):r}}nodeEdges(t,e){var i=this.inEdges(t,e);if(i)return i.concat(this.outEdges(t,e))}constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._defaultNodeLabelFn=()=>void 0,this._defaultEdgeLabelFn=()=>void 0,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,t&&(this._isDirected=!Object.hasOwn(t,"directed")||t.directed,this._isMultigraph=!!Object.hasOwn(t,"multigraph")&&t.multigraph,this._isCompound=!!Object.hasOwn(t,"compound")&&t.compound),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}}},353098:function(t,e,i){t.exports={Graph:i(577372),version:i(110544)}},25659:function(t,e,i){var r=i(577372);t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:function(t){return t.nodes().map(function(e){var i=t.node(e),r=t.parent(e),n={v:e};return void 0!==i&&(n.value=i),void 0!==r&&(n.parent=r),n})}(t),edges:function(t){return t.edges().map(function(e){var i=t.edge(e),r={v:e.v,w:e.w};return void 0!==e.name&&(r.name=e.name),void 0!==i&&(r.value=i),r})}(t)};return void 0!==t.graph()&&(e.value=structuredClone(t.graph())),e},read:function(t){var e=new r(t.options).setGraph(t.value);return t.nodes.forEach(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),t.edges.forEach(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}}},110544:function(t){t.exports="2.2.4"},892550:function(t,e,i){"use strict";var r=i(125161),n=i.n(r),s=i(404442),a=i.n(s)()(n());a.push([t.id,".react-flow{direction:ltr}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus{outline:none}.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus{outline:none}.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path{stroke:#555}.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab;position:absolute}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background:#1a192b;border:1px solid #fff;border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:-4px;left:50%;transform:translate(-50%)}.react-flow__handle-top{top:-4px;left:50%;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{top:50%;right:-4px;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{background:rgba(255,255,255,.5);margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus{outline:none}.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{color:#222;text-align:center;background-color:#fff;border:1px solid #1a192b;border-radius:3px;width:150px;padding:10px;font-size:12px}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px rgba(0,0,0,.08)}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-default.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-input.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-output.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:rgba(240,240,240,.25)}.react-flow__nodesselection-rect,.react-flow__selection{background:rgba(0,89,220,.08);border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__selection:focus{outline:none}.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px rgba(0,0,0,.08)}.react-flow__controls-button{box-sizing:content-box;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#fefefe;border:none;border-bottom:1px solid #eee;justify-content:center;align-items:center;width:16px;height:16px;padding:5px;display:flex}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:#3367d9;border:1px solid #fff;border-radius:1px;width:4px;height:4px;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border:0 solid #3367d9}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}",""]),e.Z=a},832479:function(t,e,i){"use strict";var r=i(407821),n=i.n(r),s=i(472772),a=i.n(s),o=i(395245),l=i.n(o),h=i(297998),d=i.n(h),u=i(646576),c=i.n(u),p=i(606121),f=i.n(p),g=i(892550),m={};m.styleTagTransform=f(),m.setAttributes=d(),m.insert=l().bind(null,"head"),m.domAPI=a(),m.insertStyleElement=c(),n()(g.Z,m),g.Z&&g.Z.locals&&g.Z.locals},133724:function(t,e,i){"use strict";i.d(e,{XQ:()=>n9,x$:()=>n8,QZ:()=>f,Ly:()=>g,_K:()=>rU,Bn:()=>st,u5:()=>iT,tV:()=>nQ,AC:()=>e7,HH:()=>ro,OQ:()=>iG});var r,n,s,a,o,l,h,d,u,c,p,f,g,m=i("455069");function v(t){if("string"==typeof t||"number"==typeof t)return""+t;let e="";if(Array.isArray(t))for(let i=0,r;i{}};function _(){for(var t,e=0,i=arguments.length,r={};e=0&&(e=t.slice(i+1),t=t.slice(0,i)),t&&!r.hasOwnProperty(t))throw Error("unknown type: "+t);return{type:t,name:e}})),o=-1,l=a.length;if(arguments.length<2){for(;++o0)for(var i,r,n=Array(i),s=0;se?1:t>=e?0:NaN}var z="http://www.w3.org/1999/xhtml",H={svg:"http://www.w3.org/2000/svg",xhtml:z,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function G(t){var e=t+="",i=e.indexOf(":");return i>=0&&"xmlns"!==(e=t.slice(0,i))&&(t=t.slice(i+1)),H.hasOwnProperty(e)?{space:H[e],local:t}:t}function U(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function V(t,e){return t.style.getPropertyValue(e)||U(t).getComputedStyle(t,null).getPropertyValue(e)}function W(t){return t.trim().split(/^|\s+/)}function Z(t){return t.classList||new $(t)}function $(t){this._node=t,this._names=W(t.getAttribute("class")||"")}function Y(t,e){for(var i=Z(t),r=-1,n=e.length;++rthis._names.indexOf(t)&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function K(){this.textContent=""}function q(){this.innerHTML=""}function J(){this.nextSibling&&this.parentNode.appendChild(this)}function Q(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tt(t){var e=G(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===z&&e.documentElement.namespaceURI===z?e.createElement(t):e.createElementNS(i,t)}})(e)}function te(){return null}function ti(){var t=this.parentNode;t&&t.removeChild(this)}function tr(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tn(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ts(t){return function(){var e=this.__on;if(e){for(var i,r=0,n=-1,s=e.length;r=_&&(_=x+1);!(y=m[_])&&++_=0;)(r=n[s])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,i){return e&&i?t(e.__data__,i.__data__):!e-!i}!t&&(t=F);for(var i=this._groups,r=i.length,n=Array(r),s=0;s1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,i){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,i)}}:function(t,e,i){return function(){this.style.setProperty(t,e,i)}})(t,e,null==i?"":i)):V(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var i=e.apply(this,arguments);null==i?delete this[t]:this[t]=i}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var i=W(t+"");if(arguments.length<2){for(var r=Z(this.node()),n=-1,s=i.length;++n=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}}),a=s.length;if(arguments.length<2){var o=this.node().__on;if(o){for(var l,h=0,d=o.length;h=0&&e._call.call(void 0,t),e=e._next;--tA}()}finally{tA=0,function(){for(var t,e,i=t_,r=1/0;i;)i._call?(r>i._time&&(r=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:t_=e);tw=t,tN(r)}(),tC=0}}function tD(){var t=tM.now(),e=t-tT;e>1e3&&(tk-=e,tT=t)}function tN(t){!tA&&(tS&&(tS=clearTimeout(tS)),t-tC>24?(t<1/0&&(tS=setTimeout(tL,t-tM.now()-tk)),tE&&(tE=clearInterval(tE))):(!tE&&(tT=tM.now(),tE=setInterval(tD,1e3)),tA=1,tB(tL)))}function tj(t,e,i){var r=new tO;return e=null==e?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,i),r}var tF=_("start","end","cancel","interrupt"),tz=[];function tH(t,e,i,r,n,s){var a=t.__transition;if(a){if(i in a)return}else t.__transition={};(function(t,e,i){var r,n=t.__transition;n[e]=i,i.timer=tI(function(t){i.state=1,i.timer.restart(s,i.delay,i.time),i.delay<=t&&s(t-i.delay)},0,i.time);function s(l){var h,d,u,c;if(1!==i.state)return o();for(h in n)if((c=n[h]).name===i.name){if(3===c.state)return tj(s);4===c.state?(c.state=6,c.timer.stop(),c.on.call("interrupt",t,t.__data__,c.index,c.group),delete n[h]):+h0)throw Error("too late; already scheduled");return i}function tU(t,e){var i=tV(t,e);if(i.state>3)throw Error("too late; already running");return i}function tV(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw Error("transition not found");return i}function tW(t,e){var i,r,n,s=t.__transition,a=!0;if(s){for(n in e=null==e?null:e+"",s){if((i=s[n]).name!==e){a=!1;continue}r=i.state>2&&i.state<5,i.state=6,i.timer.stop(),i.on.call(r?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete s[n]}a&&delete t.__transition}}function tZ(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}var t$=180/Math.PI,tY={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function tX(t,e,i,r,n,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*i+e*r)&&(i-=t*l,r-=e*l),(o=Math.sqrt(i*i+r*r))&&(i/=o,r/=o,l/=o),t*r180?l+=360:l-o>180&&(o+=360),d.push({i:h.push(n(h)+"rotate(",null,r)-2,x:tZ(o,l)})):l&&h.push(n(h)+"rotate("+l+r),u=s.skewX,c=a.skewX,p=g,f=m,u!==c?f.push({i:p.push(n(p)+"skewX(",null,r)-2,x:tZ(u,c)}):c&&p.push(n(p)+"skewX("+c+r),!function(t,e,i,r,s,a){if(t!==i||e!==r){var o=s.push(n(s)+"scale(",null,",",null,")");a.push({i:o-4,x:tZ(t,i)},{i:o-2,x:tZ(e,r)})}else(1!==i||1!==r)&&s.push(n(s)+"scale("+i+","+r+")")}(s.scaleX,s.scaleY,a.scaleX,a.scaleY,g,m),s=a=null,function(t){for(var e,i=-1,r=m.length;++i>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===i?eh(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===i?eh(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=t7.exec(t))?new eu(e[1],e[2],e[3],1):(e=t9.exec(t))?new eu(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=et.exec(t))?eh(e[1],e[2],e[3],e[4]):(e=ee.exec(t))?eh(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ei.exec(t))?ev(e[1],e[2]/100,e[3]/100,1):(e=er.exec(t))?ev(e[1],e[2]/100,e[3]/100,e[4]):en.hasOwnProperty(t)?el(en[t]):"transparent"===t?new eu(NaN,NaN,NaN,0):null}function el(t){return new eu(t>>16&255,t>>8&255,255&t,1)}function eh(t,e,i,r){return r<=0&&(t=e=i=NaN),new eu(t,e,i,r)}function ed(t,e,i,r){var n;return 1==arguments.length?(!((n=t)instanceof t2)&&(n=eo(n)),n)?new eu((n=n.rgb()).r,n.g,n.b,n.opacity):new eu:new eu(t,e,i,null==r?1:r)}function eu(t,e,i,r){this.r=+t,this.g=+e,this.b=+i,this.opacity=+r}function ec(){return`#${em(this.r)}${em(this.g)}${em(this.b)}`}t0(eu,ed,t1(t2,{brighter(t){return t=null==t?t5:Math.pow(t5,t),new eu(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new eu(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new eu(eg(this.r),eg(this.g),eg(this.b),ef(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ec,formatHex:ec,formatHex8:function(){return`#${em(this.r)}${em(this.g)}${em(this.b)}${em((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:ep,toString:ep}));function ep(){let t=ef(this.opacity);return`${1===t?"rgb(":"rgba("}${eg(this.r)}, ${eg(this.g)}, ${eg(this.b)}${1===t?")":`, ${t})`}`}function ef(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function eg(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function em(t){return((t=eg(t))<16?"0":"")+t.toString(16)}function ev(t,e,i,r){return r<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new ey(t,e,i,r)}function eb(t){if(t instanceof ey)return new ey(t.h,t.s,t.l,t.opacity);if(!(t instanceof t2)&&(t=eo(t)),!t)return new ey;if(t instanceof ey)return t;var e=(t=t.rgb()).r/255,i=t.g/255,r=t.b/255,n=Math.min(e,i,r),s=Math.max(e,i,r),a=NaN,o=s-n,l=(s+n)/2;return o?(a=e===s?(i-r)/o+(i0&&l<1?0:a,new ey(a,o,l,t.opacity)}function ey(t,e,i,r){this.h=+t,this.s=+e,this.l=+i,this.opacity=+r}function ex(t){return(t=(t||0)%360)<0?t+360:t}function e_(t){return Math.max(0,Math.min(1,t||0))}function ew(t,e,i){return(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)*255}function eA(t,e,i,r,n){var s=t*t,a=s*t;return((1-3*t+3*s-a)*e+(4-6*s+3*a)*i+(1+3*t+3*s-3*a)*r+a*n)/6}t0(ey,function(t,e,i,r){return 1==arguments.length?eb(t):new ey(t,e,i,null==r?1:r)},t1(t2,{brighter(t){return t=null==t?t5:Math.pow(t5,t),new ey(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new ey(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,i=this.l,r=i+(i<.5?i:1-i)*e,n=2*i-r;return new eu(ew(t>=240?t-240:t+120,n,r),ew(t,n,r),ew(t<120?t+240:t-120,n,r),this.opacity)},clamp(){return new ey(ex(this.h),e_(this.s),e_(this.l),ef(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=ef(this.opacity);return`${1===t?"hsl(":"hsla("}${ex(this.h)}, ${100*e_(this.s)}%, ${100*e_(this.l)}%${1===t?")":`, ${t})`}`}}));var eS=t=>()=>t;function eE(t,e){var i,r,n=e-t;return n?(i=t,r=n,function(t){return i+t*r}):eS(isNaN(t)?e:t)}var eT=function t(e){var i,r=1==(i=+(i=e))?eE:function(t,e){var r,n,s;return e-t?(r=t,n=e,r=Math.pow(r,s=i),n=Math.pow(n,s)-r,s=1/s,function(t){return Math.pow(r+t*n,s)}):eS(isNaN(t)?e:t)};function n(t,e){var i=r((t=ed(t)).r,(e=ed(e)).r),n=r(t.g,e.g),s=r(t.b,e.b),a=eE(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=n(e),t.b=s(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function eC(t){return function(e){var i,r,n=e.length,s=Array(n),a=Array(n),o=Array(n);for(i=0;i=1?(i=1,e-1):Math.floor(i*e),n=t[r],s=t[r+1],a=r>0?t[r-1]:2*n-s,o=ro&&(a=e.slice(o,a),h[l]?h[l]+=a:h[++l]=a),(n=n[0])===(s=s[0])?h[l]?h[l]+=s:h[++l]=s:(h[++l]=null,d.push({i:l,x:tZ(n,s)})),o=eM.lastIndex;return o=0&&(t=t.slice(0,e)),!t||"start"===t})?tG:tU;return function(){var a=s(this,t),o=a.on;o!==r&&(n=(r=o).copy()).on(e,i),a.on=n}}(i,t,e))},attr:function(t,e){var i=G(t),r="transform"===i?tJ:eB;return this.attrTween(t,"function"==typeof e?(i.local?function(t,e,i){var r,n,s;return function(){var a,o,l=i(this);return null==l?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),a===(o=l+"")?null:a===r&&o===n?s:(n=o,s=e(r=a,l)))}}:function(t,e,i){var r,n,s;return function(){var a,o,l=i(this);return null==l?void this.removeAttribute(t):(a=this.getAttribute(t),a===(o=l+"")?null:a===r&&o===n?s:(n=o,s=e(r=a,l)))}})(i,r,tQ(this,"attr."+t,e)):null==e?(i.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(i):(i.local?function(t,e,i){var r,n,s=i+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===s?null:a===r?n:n=e(r=a,i)}}:function(t,e,i){var r,n,s=i+"";return function(){var a=this.getAttribute(t);return a===s?null:a===r?n:n=e(r=a,i)}})(i,r,e))},attrTween:function(t,e){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!=typeof e)throw Error();var r=G(t);return this.tween(i,(r.local?function(t,e){var i,r;function n(){var n,s,a=e.apply(this,arguments);if(a!==r){;i=(r=a)&&(n=t,s=a,function(t){this.setAttributeNS(n.space,n.local,s.call(this,t))})}return i}return n._value=e,n}:function(t,e){var i,r;function n(){var n,s,a=e.apply(this,arguments);if(a!==r){;i=(r=a)&&(n=t,s=a,function(t){this.setAttribute(n,s.call(this,t))})}return i}return n._value=e,n})(r,e))},style:function(t,e,i){var r,n,s,a,o,l,h,d,u,c,p,f,g,m,v,b,y,x,_,w,A,S,E,T,C,k="transform"==(t+="")?tq:eB;return null==e?this.styleTween(t,(r=t,n=k,function(){var t=V(this,r),e=(this.style.removeProperty(r),V(this,r));return t===e?null:t===s&&e===a?o:o=n(s=t,a=e)})).on("end.style."+t,eR(t)):"function"==typeof e?this.styleTween(t,(l=t,h=k,d=tQ(this,"style."+t,e),function(){var t=V(this,l),e=d(this),i=e+"";return null==e&&(this.style.removeProperty(l),i=e=V(this,l)),t===i?null:t===u&&i===c?p:(c=i,p=h(u=t,e))})).each((f=this._id,_="end."+(x="style."+(g=t)),function(){var t=tU(this,f),e=t.on,i=null==t.value[x]?y||(y=eR(g)):void 0;(e!==m||b!==i)&&(v=(m=e).copy()).on(_,b=i),t.on=v})):this.styleTween(t,(w=t,A=k,C=(S=e)+"",function(){var t=V(this,w);return t===C?null:t===E?T:T=A(E=t,S)}),i).on("end.style."+t,null)},styleTween:function(t,e,i){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw Error();return this.tween(r,function(t,e,i){var r,n;function s(){var s,a,o,l=e.apply(this,arguments);if(l!==n){;r=(n=l)&&(s=t,a=l,o=i,function(t){this.style.setProperty(s,a.call(this,t),o)})}return r}return s._value=e,s}(t,e,null==i?"":i))},text:function(t){var e,i;return this.tween("text","function"==typeof t?(e=tQ(this,"text",t),function(){var t=e(this);this.textContent=null==t?"":t}):(i=null==t?"":t+"",function(){this.textContent=i}))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw Error();return this.tween(e,function(t){var e,i;function r(){var r,n=t.apply(this,arguments);if(n!==i){;e=(i=n)&&(r=n,function(t){this.textContent=r.call(this,t)})}return e}return r._value=t,r}(t))},remove:function(){var t;return this.on("end.remove",(t=this._id,function(){var e=this.parentNode;for(var i in this.__transition)if(+i!==t)return;e&&e.removeChild(this)}))},tween:function(t,e){var i=this._id;if(t+="",arguments.length<2){for(var r,n=tV(this.node(),i).tween,s=0,a=n.length;s()=>t;function eF(t,{sourceEvent:e,target:i,transform:r,dispatch:n}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:n}})}function ez(t,e,i){this.k=t,this.x=e,this.y=i}ez.prototype={constructor:ez,scale:function(t){return 1===t?this:new ez(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new ez(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var eH=new ez(1,0,0);(function(t){for(;!t.__zoom;)if(!(t=t.parentNode))return eH;return t.__zoom}).prototype=ez.prototype;function eG(t){t.stopImmediatePropagation()}function eU(t){t.preventDefault(),t.stopImmediatePropagation()}function eV(t){return(!t.ctrlKey||"wheel"===t.type)&&!t.button}function eW(){var t=this;if(t instanceof SVGElement)return(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]];return[[0,0],[t.clientWidth,t.clientHeight]]}function eZ(){return this.__zoom||eH}function e$(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function eY(){return navigator.maxTouchPoints||"ontouchstart"in this}function eX(t,e,i){var r=t.invertX(e[0][0])-i[0][0],n=t.invertX(e[1][0])-i[1][0],s=t.invertY(e[0][1])-i[0][1],a=t.invertY(e[1][1])-i[1][1];return t.translate(n>r?(r+n)/2:Math.min(0,r)||Math.max(0,n),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}var eK=t=>()=>t;function eq(t,{sourceEvent:e,subject:i,target:r,identifier:n,active:s,x:a,y:o,dx:l,dy:h,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:d}})}function eJ(t){return!t.ctrlKey&&!t.button}function eQ(){return this.parentNode}function e0(t,e){return null==e?{x:t.x,y:t.y}:e}function e1(){return navigator.maxTouchPoints||"ontouchstart"in this}eq.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var e2=i("921463");let e5=(0,m.createContext)(null),e3=e5.Provider,e4={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},e6=e4.error001();function e8(t,e){let i=(0,m.useContext)(e5);if(null===i)throw Error(e6);return(0,b.s)(i,t,e)}let e7=()=>{let t=(0,m.useContext)(e5);if(null===t)throw Error(e6);return(0,m.useMemo)(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},e9=t=>t.userSelectionActive?"none":"all";function it({position:t,children:e,className:i,style:r,...n}){let s=e8(e9),a=`${t}`.split("-");return m.createElement("div",{className:v(["react-flow__panel",i,...a]),style:{...r,pointerEvents:s},...n},e)}function ie({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:m.createElement(it,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},m.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var ii=(0,m.memo)(({x:t,y:e,label:i,labelStyle:r={},labelShowBg:n=!0,labelBgStyle:s={},labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:l,className:h,...d})=>{let u=(0,m.useRef)(null),[c,p]=(0,m.useState)({x:0,y:0,width:0,height:0}),f=v(["react-flow__edge-textwrapper",h]);return((0,m.useEffect)(()=>{if(u.current){let t=u.current.getBBox();p({x:t.x,y:t.y,width:t.width,height:t.height})}},[i]),void 0!==i&&i)?m.createElement("g",{transform:`translate(${t-c.width/2} ${e-c.height/2})`,className:f,visibility:c.width?"visible":"hidden",...d},n&&m.createElement("rect",{width:c.width+2*a[0],x:-a[0],y:-a[1],height:c.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:o,ry:o}),m.createElement("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:u,style:r},i),l):null});let ir=t=>({width:t.offsetWidth,height:t.offsetHeight}),is=(t,e=0,i=1)=>Math.min(Math.max(t,e),i),ia=(t={x:0,y:0},e)=>({x:is(t.x,e[0][0],e[1][0]),y:is(t.y,e[0][1],e[1][1])}),io=(t,e,i)=>ti?-is(Math.abs(t-i),1,50)/50:0,il=(t,e)=>{let i=20*io(t.x,35,e.width-35);return[i,20*io(t.y,35,e.height-35)]},ih=t=>t.getRootNode?.()||window?.document,id=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),iu=({x:t,y:e,width:i,height:r})=>({x:t,y:e,x2:t+i,y2:e+r}),ic=({x:t,y:e,x2:i,y2:r})=>({x:t,y:e,width:i-t,height:r-e}),ip=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),ig=(t,e)=>{let i=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x));return Math.ceil(i*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y)))},im=t=>iv(t.width)&&iv(t.height)&&iv(t.x)&&iv(t.y),iv=t=>!isNaN(t)&&isFinite(t),ib=Symbol.for("internals"),iy=["Enter"," ","Escape"],ix=(t,e)=>{},i_=t=>"nativeEvent"in t;function iw(t){let e=i_(t)?t.nativeEvent:t,i=e.composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(i?.nodeName)||i?.hasAttribute("contenteditable")||!!i?.closest(".nokey")}let iA=t=>"clientX"in t,iS=(t,e)=>{let i=iA(t),r=i?t.clientX:t.touches?.[0].clientX,n=i?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:n-(e?.top??0)}},iE=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0,iT=({id:t,path:e,labelX:i,labelY:r,label:n,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:h,style:d,markerEnd:u,markerStart:c,interactionWidth:p=20})=>m.createElement(m.Fragment,null,m.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:u,markerStart:c}),p&&m.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),n&&iv(i)&&iv(r)?m.createElement(ii,{x:i,y:r,label:n,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:h}):null);function iC(t,e,i){return void 0===i?i:r=>{let n=e().edges.find(e=>e.id===t);n&&i(r,{...n})}}function ik({sourceX:t,sourceY:e,targetX:i,targetY:r}){let n=Math.abs(i-t)/2,s=Math.abs(r-e)/2;return[i{let[b,y,x]=iP({sourceX:t,sourceY:e,sourcePosition:n,targetX:i,targetY:r,targetPosition:s});return m.createElement(iT,{path:b,labelX:y,labelY:x,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:h,labelBgPadding:d,labelBgBorderRadius:u,style:c,markerEnd:p,markerStart:f,interactionWidth:v})});iR.displayName="SimpleBezierEdge";let iO={[g.Left]:{x:-1,y:0},[g.Right]:{x:1,y:0},[g.Top]:{x:0,y:-1},[g.Bottom]:{x:0,y:1}},iI=({source:t,sourcePosition:e=g.Bottom,target:i})=>e===g.Left||e===g.Right?t.xMath.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function iD({sourceX:t,sourceY:e,sourcePosition:i=g.Bottom,targetX:r,targetY:n,targetPosition:s=g.Top,borderRadius:a=5,centerX:o,centerY:l,offset:h=20}){let[d,u,c,p,f]=function({source:t,sourcePosition:e=g.Bottom,target:i,targetPosition:r=g.Top,center:n,offset:s}){let a,o;let l=iO[e],h=iO[r],d={x:t.x+l.x*s,y:t.y+l.y*s},u={x:i.x+h.x*s,y:i.y+h.y*s},c=iI({source:d,sourcePosition:e,target:u}),p=0!==c.x?"x":"y",f=c[p],m=[],v={x:0,y:0},b={x:0,y:0},[y,x,_,w]=ik({sourceX:t.x,sourceY:t.y,targetX:i.x,targetY:i.y});if(l[p]*h[p]==-1){a=n.x??y,o=n.y??x;let t=[{x:a,y:d.y},{x:a,y:u.y}],e=[{x:d.x,y:o},{x:u.x,y:o}];m=l[p]===f?"x"===p?t:e:"x"===p?e:t}else{let n=[{x:d.x,y:u.y}],c=[{x:u.x,y:d.y}];if(m="x"===p?l.x===f?c:n:l.y===f?n:c,e===r){let e=Math.abs(t[p]-i[p]);if(e<=s){let r=Math.min(s-1,s-e);l[p]===f?v[p]=(d[p]>t[p]?-1:1)*r:b[p]=(u[p]>i[p]?-1:1)*r}}if(e!==r){let t="x"===p?"y":"x",e=l[p]===h[t],i=d[t]>u[t],r=d[t]=Math.max(Math.abs(g.y-m[0].y),Math.abs(y.y-m[0].y))?(a=(g.x+y.x)/2,o=m[0].y):(a=m[0].x,o=(g.y+y.y)/2)}return[[t,{x:d.x+v.x,y:d.y+v.y},...m,{x:u.x+b.x,y:u.y+b.y},i],a,o,_,w]}({source:{x:t,y:e},sourcePosition:i,target:{x:r,y:n},targetPosition:s,center:{x:o,y:l},offset:h});return[d.reduce((t,e,i)=>{let r="";return t+=r=i>0&&i{let[y,x,_]=iD({sourceX:t,sourceY:e,sourcePosition:u,targetX:i,targetY:r,targetPosition:c,borderRadius:v?.borderRadius,offset:v?.offset});return m.createElement(iT,{path:y,labelX:x,labelY:_,label:n,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:h,style:d,markerEnd:p,markerStart:f,interactionWidth:b})});iN.displayName="SmoothStepEdge";let ij=(0,m.memo)(t=>m.createElement(iN,{...t,pathOptions:(0,m.useMemo)(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));ij.displayName="StepEdge";let iF=(0,m.memo)(({sourceX:t,sourceY:e,targetX:i,targetY:r,label:n,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:h,style:d,markerEnd:u,markerStart:c,interactionWidth:p})=>{let[f,g,v]=function({sourceX:t,sourceY:e,targetX:i,targetY:r}){let[n,s,a,o]=ik({sourceX:t,sourceY:e,targetX:i,targetY:r});return[`M ${t},${e}L ${i},${r}`,n,s,a,o]}({sourceX:t,sourceY:e,targetX:i,targetY:r});return m.createElement(iT,{path:f,labelX:g,labelY:v,label:n,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:h,style:d,markerEnd:u,markerStart:c,interactionWidth:p})});function iz(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function iH({pos:t,x1:e,y1:i,x2:r,y2:n,c:s}){switch(t){case g.Left:return[e-iz(e-r,s),i];case g.Right:return[e+iz(r-e,s),i];case g.Top:return[e,i-iz(i-n,s)];case g.Bottom:return[e,i+iz(n-i,s)]}}function iG({sourceX:t,sourceY:e,sourcePosition:i=g.Bottom,targetX:r,targetY:n,targetPosition:s=g.Top,curvature:a=.25}){let[o,l]=iH({pos:i,x1:t,y1:e,x2:r,y2:n,c:a}),[h,d]=iH({pos:s,x1:r,y1:n,x2:t,y2:e,c:a}),[u,c,p,f]=iM({sourceX:t,sourceY:e,targetX:r,targetY:n,sourceControlX:o,sourceControlY:l,targetControlX:h,targetControlY:d});return[`M${t},${e} C${o},${l} ${h},${d} ${r},${n}`,u,c,p,f]}iF.displayName="StraightEdge";let iU=(0,m.memo)(({sourceX:t,sourceY:e,targetX:i,targetY:r,sourcePosition:n=g.Bottom,targetPosition:s=g.Top,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:h,labelBgPadding:d,labelBgBorderRadius:u,style:c,markerEnd:p,markerStart:f,pathOptions:v,interactionWidth:b})=>{let[y,x,_]=iG({sourceX:t,sourceY:e,sourcePosition:n,targetX:i,targetY:r,targetPosition:s,curvature:v?.curvature});return m.createElement(iT,{path:y,labelX:x,labelY:_,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:h,labelBgPadding:d,labelBgBorderRadius:u,style:c,markerEnd:p,markerStart:f,interactionWidth:b})});iU.displayName="BezierEdge";let iV=(0,m.createContext)(null),iW=iV.Provider;iV.Consumer;let iZ=()=>(0,m.useContext)(iV),i$=t=>"id"in t&&"source"in t&&"target"in t,iY=({source:t,sourceHandle:e,target:i,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${i}${r||""}`,iX=(t,e)=>{if(void 0===t)return"";if("string"==typeof t)return t;let i=e?`${e}__`:"";return`${i}${Object.keys(t).sort().map(e=>`${e}=${t[e]}`).join("&")}`},iK=(t,e)=>e.some(e=>e.source===t.source&&e.target===t.target&&(e.sourceHandle===t.sourceHandle||!e.sourceHandle&&!t.sourceHandle)&&(e.targetHandle===t.targetHandle||!e.targetHandle&&!t.targetHandle)),iq=(t,e)=>{let i;return t.source&&t.target?iK(i=i$(t)?{...t}:{...t,id:iY(t)},e)?e:e.concat(i):(ix("006",e4.error006()),e)},iJ=({x:t,y:e},[i,r,n],s,[a,o])=>{let l={x:(t-i)/n,y:(e-r)/n};return s?{x:a*Math.round(l.x/a),y:o*Math.round(l.y/o)}:l},iQ=({x:t,y:e},[i,r,n])=>({x:t*n+i,y:e*n+r}),i0=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};let i=(t.width??0)*e[0],r=(t.height??0)*e[1],n={x:t.position.x-i,y:t.position.y-r};return{...n,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-i,y:t.positionAbsolute.y-r}:n}},i1=(t,e=[0,0])=>0===t.length?{x:0,y:0,width:0,height:0}:ic(t.reduce((t,i)=>{let{x:r,y:n}=i0(i,e).positionAbsolute;return id(t,iu({x:r,y:n,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),i2=(t,e,[i,r,n]=[0,0,1],s=!1,a=!1,o=[0,0])=>{let l={x:(e.x-i)/n,y:(e.y-r)/n,width:e.width/n,height:e.height/n},h=[];return t.forEach(t=>{let{width:e,height:i,selectable:r=!0,hidden:n=!1}=t;if(a&&!r||n)return!1;let{positionAbsolute:d}=i0(t,o),u=ig(l,{x:d.x,y:d.y,width:e||0,height:i||0}),c=void 0===e||void 0===i||null===e||null===i,p=(e||0)*(i||0);(c||s&&u>0||u>=p||t.dragging)&&h.push(t)}),h},i5=(t,e)=>{let i=t.map(t=>t.id);return e.filter(t=>i.includes(t.source)||i.includes(t.target))},i3=(t,e,i,r,n,s=.1)=>{let a=e/(t.width*(1+s)),o=is(Math.min(a,i/(t.height*(1+s))),r,n),l=t.x+t.width/2,h=t.y+t.height/2;return{x:e/2-l*o,y:i/2-h*o,zoom:o}},i4=(t,e=0)=>t.transition().duration(e);function i6(t,e,i,r){return(e[i]||[]).reduce((e,n)=>(`${t.id}-${n.id}-${i}`!==r&&e.push({id:n.id||null,type:i,nodeId:t.id,x:(t.positionAbsolute?.x??0)+n.x+n.width/2,y:(t.positionAbsolute?.y??0)+n.y+n.height/2}),e),[])}let i8={source:null,target:null,sourceHandle:null,targetHandle:null},i7=()=>({handleDomNode:null,isValid:!1,connection:i8,endHandle:null});function i9(t,e,i,r,n,s,a){let o="target"===n,l=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),h={...i7(),handleDomNode:l};if(l){let t=rt(void 0,l),n=l.getAttribute("data-nodeid"),a=l.getAttribute("data-handleid"),u=l.classList.contains("connectable"),c=l.classList.contains("connectableend"),p={source:o?n:i,sourceHandle:o?a:r,target:o?i:n,targetHandle:o?r:a};h.connection=p;u&&c&&(e===d.Strict?o&&"source"===t||!o&&"target"===t:n!==i||a!==r)&&(h.endHandle={nodeId:n,handleId:a,type:t},h.isValid=s(p))}return h}function rt(t,e){if(t)return t;if(e?.classList.contains("target"))return"target";if(e?.classList.contains("source"))return"source";return null}function re(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function ri({event:t,handleId:e,nodeId:i,onConnect:r,isTarget:n,getState:s,setState:a,isValidConnection:o,edgeUpdaterType:l,onReconnectEnd:h}){let d,u;let c=ih(t.target),{connectionMode:p,domNode:f,autoPanOnConnect:g,connectionRadius:m,onConnectStart:v,panBy:b,getNodes:y,cancelConnection:x}=s(),_=0,{x:w,y:A}=iS(t),S=rt(l,c?.elementFromPoint(w,A)),E=f?.getBoundingClientRect();if(!E||!S)return;let T=iS(t,E),C=!1,k=null,M=!1,B=null,P=function({nodes:t,nodeId:e,handleId:i,handleType:r}){return t.reduce((t,n)=>{if(n[ib]){let{handleBounds:s}=n[ib],a=[],o=[];s&&(a=i6(n,s,"source",`${e}-${i}-${r}`),o=i6(n,s,"target",`${e}-${i}-${r}`)),t.push(...a,...o)}return t},[])}({nodes:y(),nodeId:i,handleId:e,handleType:S}),R=()=>{if(!g)return;let[t,e]=il(T,E);b({x:t,y:e}),_=requestAnimationFrame(R)};function O(t){var r,l;let h,{transform:f}=s();T=iS(t,E);let{handle:g,validHandleResult:v}=function(t,e,i,r,n,s){let{x:a,y:o}=iS(t),l=e.elementsFromPoint(a,o).find(t=>t.classList.contains("react-flow__handle"));if(l){let t=l.getAttribute("data-nodeid");if(t){let e=rt(void 0,l),r=l.getAttribute("data-handleid"),a=s({nodeId:t,id:r,type:e});if(a){let s=n.find(i=>i.nodeId===t&&i.type===e&&i.id===r);return{handle:{id:r,type:e,nodeId:t,x:s?.x||i.x,y:s?.y||i.y},validHandleResult:a}}}}let h=[],d=1/0;if(n.forEach(t=>{let e=Math.sqrt((t.x-i.x)**2+(t.y-i.y)**2);if(e<=r){let i=s(t);e<=d&&(et.isValid),c=h.some(({handle:t})=>"target"===t.type);return h.find(({handle:t,validHandleResult:e})=>c?"target"===t.type:!u||e.isValid)||h[0]}(t,c,iJ(T,f,!1,[1,1]),m,P,t=>i9(t,p,i,e,n?"target":"source",o,c));d=g,!C&&(R(),C=!0),B=v.handleDomNode,k=v.connection,M=v.isValid;if(a({connectionPosition:d&&M?iQ({x:d.x,y:d.y},f):T,connectionStatus:(r=!!d,h=null,(l=M)?h="valid":r&&!l&&(h="invalid"),h),connectionEndHandle:v.endHandle}),!d&&!M&&!B)return re(u);k.source!==k.target&&B&&(re(u),u=B,B.classList.add("connecting","react-flow__handle-connecting"),B.classList.toggle("valid",M),B.classList.toggle("react-flow__handle-valid",M))}function I(t){(d||B)&&k&&M&&r?.(k),s().onConnectEnd?.(t),l&&h?.(t),re(u),x(),cancelAnimationFrame(_),C=!1,M=!1,k=null,B=null,c.removeEventListener("mousemove",O),c.removeEventListener("mouseup",I),c.removeEventListener("touchmove",O),c.removeEventListener("touchend",I)}a({connectionPosition:T,connectionStatus:null,connectionNodeId:i,connectionHandleId:e,connectionHandleType:S,connectionStartHandle:{nodeId:i,handleId:e,type:S},connectionEndHandle:null}),v?.(t,{nodeId:i,handleId:e,handleType:S}),c.addEventListener("mousemove",O),c.addEventListener("mouseup",I),c.addEventListener("touchmove",O),c.addEventListener("touchend",I)}let rr=()=>!0,rn=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),rs=(t,e,i)=>r=>{let{connectionStartHandle:n,connectionEndHandle:s,connectionClickStartHandle:a}=r;return{connecting:n?.nodeId===t&&n?.handleId===e&&n?.type===i||s?.nodeId===t&&s?.handleId===e&&s?.type===i,clickConnecting:a?.nodeId===t&&a?.handleId===e&&a?.type===i}},ra=(0,m.forwardRef)(({type:t="source",position:e=g.Top,isValidConnection:i,isConnectable:r=!0,isConnectableStart:n=!0,isConnectableEnd:s=!0,id:a,onConnect:o,children:l,className:h,onMouseDown:d,onTouchStart:u,...c},p)=>{let f=a||null,b="target"===t,x=e7(),_=iZ(),{connectOnClick:w,noPanClassName:A}=e8(rn,y.X),{connecting:S,clickConnecting:E}=e8(rs(_,f,t),y.X);!_&&x.getState().onError?.("010",e4.error010());let T=t=>{let{defaultEdgeOptions:e,onConnect:i,hasDefaultEdges:r}=x.getState(),n={...e,...t};if(r){let{edges:t,setEdges:e}=x.getState();e(iq(n,t))}i?.(n),o?.(n)},C=t=>{if(!_)return;let e=iA(t);n&&(e&&0===t.button||!e)&&ri({event:t,handleId:f,nodeId:_,onConnect:T,isTarget:b,getState:x.getState,setState:x.setState,isValidConnection:i||x.getState().isValidConnection||rr}),e?d?.(t):u?.(t)};return m.createElement("div",{"data-handleid":f,"data-nodeid":_,"data-handlepos":e,"data-id":`${_}-${f}-${t}`,className:v(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",A,h,{source:!b,target:b,connectable:r,connectablestart:n,connectableend:s,connecting:E,connectionindicator:r&&(n&&!S||s&&S)}]),onMouseDown:C,onTouchStart:C,onClick:w?e=>{let{onClickConnectStart:r,onClickConnectEnd:s,connectionClickStartHandle:a,connectionMode:o,isValidConnection:l}=x.getState();if(!_||!a&&!n)return;if(!a){r?.(e,{nodeId:_,handleId:f,handleType:t}),x.setState({connectionClickStartHandle:{nodeId:_,type:t,handleId:f}});return}let h=ih(e.target),d=i||l||rr,{connection:u,isValid:c}=i9({nodeId:_,id:f,type:t},o,a.nodeId,a.handleId||null,a.type,d,h);c&&T(u),s?.(e),x.setState({connectionClickStartHandle:null})}:void 0,ref:p,...c},l)});ra.displayName="Handle";var ro=(0,m.memo)(ra);let rl=({data:t,isConnectable:e,targetPosition:i=g.Top,sourcePosition:r=g.Bottom})=>m.createElement(m.Fragment,null,m.createElement(ro,{type:"target",position:i,isConnectable:e}),t?.label,m.createElement(ro,{type:"source",position:r,isConnectable:e}));rl.displayName="DefaultNode";var rh=(0,m.memo)(rl);let rd=({data:t,isConnectable:e,sourcePosition:i=g.Bottom})=>m.createElement(m.Fragment,null,t?.label,m.createElement(ro,{type:"source",position:i,isConnectable:e}));rd.displayName="InputNode";var ru=(0,m.memo)(rd);let rc=({data:t,isConnectable:e,targetPosition:i=g.Top})=>m.createElement(m.Fragment,null,m.createElement(ro,{type:"target",position:i,isConnectable:e}),t?.label);rc.displayName="OutputNode";var rp=(0,m.memo)(rc);let rf=()=>null;rf.displayName="GroupNode";let rg=t=>({selectedNodes:t.getNodes().filter(t=>t.selected),selectedEdges:t.edges.filter(t=>t.selected).map(t=>({...t}))}),rm=t=>t.id;function rv(t,e){return(0,y.X)(t.selectedNodes.map(rm),e.selectedNodes.map(rm))&&(0,y.X)(t.selectedEdges.map(rm),e.selectedEdges.map(rm))}let rb=(0,m.memo)(({onSelectionChange:t})=>{let e=e7(),{selectedNodes:i,selectedEdges:r}=e8(rg,rv);return(0,m.useEffect)(()=>{let n={nodes:i,edges:r};t?.(n),e.getState().onSelectionChange.forEach(t=>t(n))},[i,r,t]),null});rb.displayName="SelectionListener";let ry=t=>!!t.onSelectionChange;function rx({onSelectionChange:t}){let e=e8(ry);return t||e?m.createElement(rb,{onSelectionChange:t}):null}let r_=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function rw(t,e){(0,m.useEffect)(()=>{void 0!==t&&e(t)},[t])}function rA(t,e,i){(0,m.useEffect)(()=>{void 0!==e&&i({[t]:e})},[e])}let rS=({nodes:t,edges:e,defaultNodes:i,defaultEdges:r,onConnect:n,onConnectStart:s,onConnectEnd:a,onClickConnectStart:o,onClickConnectEnd:l,nodesDraggable:h,nodesConnectable:d,nodesFocusable:u,edgesFocusable:c,edgesUpdatable:p,elevateNodesOnSelect:f,minZoom:g,maxZoom:v,nodeExtent:b,onNodesChange:x,onEdgesChange:_,elementsSelectable:w,connectionMode:A,snapGrid:S,snapToGrid:E,translateExtent:T,connectOnClick:C,defaultEdgeOptions:k,fitView:M,fitViewOptions:B,onNodesDelete:P,onEdgesDelete:R,onNodeDrag:O,onNodeDragStart:I,onNodeDragStop:L,onSelectionDrag:D,onSelectionDragStart:N,onSelectionDragStop:j,noPanClassName:F,nodeOrigin:z,rfId:H,autoPanOnConnect:G,autoPanOnNodeDrag:U,onError:V,connectionRadius:W,isValidConnection:Z,nodeDragThreshold:$})=>{let{setNodes:Y,setEdges:X,setDefaultNodesAndEdges:K,setMinZoom:q,setMaxZoom:J,setTranslateExtent:Q,setNodeExtent:tt,reset:te}=e8(r_,y.X),ti=e7();return(0,m.useEffect)(()=>(K(i,r?.map(t=>({...t,...k}))),()=>{te()}),[]),rA("defaultEdgeOptions",k,ti.setState),rA("connectionMode",A,ti.setState),rA("onConnect",n,ti.setState),rA("onConnectStart",s,ti.setState),rA("onConnectEnd",a,ti.setState),rA("onClickConnectStart",o,ti.setState),rA("onClickConnectEnd",l,ti.setState),rA("nodesDraggable",h,ti.setState),rA("nodesConnectable",d,ti.setState),rA("nodesFocusable",u,ti.setState),rA("edgesFocusable",c,ti.setState),rA("edgesUpdatable",p,ti.setState),rA("elementsSelectable",w,ti.setState),rA("elevateNodesOnSelect",f,ti.setState),rA("snapToGrid",E,ti.setState),rA("snapGrid",S,ti.setState),rA("onNodesChange",x,ti.setState),rA("onEdgesChange",_,ti.setState),rA("connectOnClick",C,ti.setState),rA("fitViewOnInit",M,ti.setState),rA("fitViewOnInitOptions",B,ti.setState),rA("onNodesDelete",P,ti.setState),rA("onEdgesDelete",R,ti.setState),rA("onNodeDrag",O,ti.setState),rA("onNodeDragStart",I,ti.setState),rA("onNodeDragStop",L,ti.setState),rA("onSelectionDrag",D,ti.setState),rA("onSelectionDragStart",N,ti.setState),rA("onSelectionDragStop",j,ti.setState),rA("noPanClassName",F,ti.setState),rA("nodeOrigin",z,ti.setState),rA("rfId",H,ti.setState),rA("autoPanOnConnect",G,ti.setState),rA("autoPanOnNodeDrag",U,ti.setState),rA("onError",V,ti.setState),rA("connectionRadius",W,ti.setState),rA("isValidConnection",Z,ti.setState),rA("nodeDragThreshold",$,ti.setState),rw(t,Y),rw(e,X),rw(g,q),rw(v,J),rw(T,Q),rw(b,tt),null},rE={display:"none"},rT={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},rC="react-flow__node-desc",rk="react-flow__edge-desc",rM=t=>t.ariaLiveMessage;function rB({rfId:t}){let e=e8(rM);return m.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:rT},e)}function rP({rfId:t,disableKeyboardA11y:e}){return m.createElement(m.Fragment,null,m.createElement("div",{id:`${rC}-${t}`,style:rE},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),m.createElement("div",{id:`${rk}-${t}`,style:rE},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&m.createElement(rB,{rfId:t}))}var rR=(t=null,e={actInsideInputWithModifier:!0})=>{let[i,r]=(0,m.useState)(!1),n=(0,m.useRef)(!1),s=(0,m.useRef)(new Set([])),[a,o]=(0,m.useMemo)(()=>{if(null!==t){let e=(Array.isArray(t)?t:[t]).filter(t=>"string"==typeof t).map(t=>t.split("+")),i=e.reduce((t,e)=>t.concat(...e),[]);return[e,i]}return[[],[]]},[t]);return(0,m.useEffect)(()=>{let i="undefined"!=typeof document?document:null,l=e?.target||i;if(null!==t){let t=t=>{if(n.current=t.ctrlKey||t.metaKey||t.shiftKey,(!n.current||n.current&&!e.actInsideInputWithModifier)&&iw(t))return!1;let i=rI(t.code,o);s.current.add(t[i]),rO(a,s.current,!1)&&(t.preventDefault(),r(!0))},i=t=>{if((!n.current||n.current&&!e.actInsideInputWithModifier)&&iw(t))return!1;let i=rI(t.code,o);rO(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(t[i]),"Meta"===t.key&&s.current.clear(),n.current=!1},h=()=>{s.current.clear(),r(!1)};return l?.addEventListener("keydown",t),l?.addEventListener("keyup",i),window.addEventListener("blur",h),()=>{l?.removeEventListener("keydown",t),l?.removeEventListener("keyup",i),window.removeEventListener("blur",h)}}},[t,r]),i};function rO(t,e,i){return t.filter(t=>i||t.length===e.size).some(t=>t.every(t=>e.has(t)))}function rI(t,e){return e.includes(t)?"code":"key"}function rL(t,e,i){t.forEach(r=>{let n=r.parentNode||r.parentId;if(n&&!t.has(n))throw Error(`Parent node ${n} not found`);if(n||i?.[r.id]){let{x:n,y:s,z:a}=function t(e,i,r,n){let s=e.parentNode||e.parentId;if(!s)return r;let a=i.get(s),o=i0(a,n);return t(a,i,{x:(r.x??0)+o.x,y:(r.y??0)+o.y,z:(a[ib]?.z??0)>(r.z??0)?a[ib]?.z??0:r.z??0},n)}(r,t,{...r.position,z:r[ib]?.z??0},e);r.positionAbsolute={x:n,y:s},r[ib].z=a,i?.[r.id]&&(r[ib].isParent=!0)}})}function rD(t,e,i,r){let n=new Map,s={},a=r?1e3:0;return t.forEach(t=>{let i=(iv(t.zIndex)?t.zIndex:0)+(t.selected?a:0),r=e.get(t.id),o={...t,positionAbsolute:{x:t.position.x,y:t.position.y}},l=t.parentNode||t.parentId;l&&(s[l]=!0),Object.defineProperty(o,ib,{enumerable:!1,value:{handleBounds:r?.type&&r?.type!==t.type?void 0:r?.[ib]?.handleBounds,z:i}}),n.set(t.id,o)}),rL(n,i,s),n}function rN(t,e={}){let{getNodes:i,width:r,height:n,minZoom:s,maxZoom:a,d3Zoom:o,d3Selection:l,fitViewOnInitDone:h,fitViewOnInit:d,nodeOrigin:u}=t(),c=e.initial&&!h&&d;if(o&&l&&(c||!e.initial)){let t=i().filter(t=>{let i=e.includeHiddenNodes?t.width&&t.height:!t.hidden;return e.nodes?.length?i&&e.nodes.some(e=>e.id===t.id):i}),h=t.every(t=>t.width&&t.height);if(t.length>0&&h){let{x:i,y:h,zoom:d}=i3(i1(t,u),r,n,e.minZoom??s,e.maxZoom??a,e.padding??.1),c=eH.translate(i,h).scale(d);return"number"==typeof e.duration&&e.duration>0?o.transform(i4(l,e.duration),c):o.transform(l,c),!0}}return!1}function rj({changedNodes:t,changedEdges:e,get:i,set:r}){var n,s,a;let{nodeInternals:o,edges:l,onNodesChange:h,onEdgesChange:d,hasDefaultNodes:u,hasDefaultEdges:c}=i();if(t?.length){if(u){;r({nodeInternals:(n=t,s=o,n.forEach(t=>{let e=s.get(t.id);e&&s.set(e.id,{...e,[ib]:e[ib],selected:t.selected})}),new Map(s))})}h?.(t)}if(e?.length){if(c){;r({edges:(a=e,l.map(t=>{let e=a.find(e=>e.id===t.id);return e&&(t.selected=e.selected),t}))})}d?.(e)}}let rF=()=>{},rz={zoomIn:rF,zoomOut:rF,zoomTo:rF,getZoom:()=>1,setViewport:rF,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:rF,fitBounds:rF,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},rH=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),rG=()=>{let t=e7(),{d3Zoom:e,d3Selection:i}=e8(rH,y.X);return(0,m.useMemo)(()=>i&&e?{zoomIn:t=>e.scaleBy(i4(i,t?.duration),1.2),zoomOut:t=>e.scaleBy(i4(i,t?.duration),1/1.2),zoomTo:(t,r)=>e.scaleTo(i4(i,r?.duration),t),getZoom:()=>t.getState().transform[2],setViewport:(r,n)=>{let[s,a,o]=t.getState().transform,l=eH.translate(r.x??s,r.y??a).scale(r.zoom??o);e.transform(i4(i,n?.duration),l)},getViewport:()=>{let[e,i,r]=t.getState().transform;return{x:e,y:i,zoom:r}},fitView:e=>rN(t.getState,e),setCenter:(r,n,s)=>{let{width:a,height:o,maxZoom:l}=t.getState(),h=void 0!==s?.zoom?s.zoom:l,d=a/2-r*h,u=o/2-n*h,c=eH.translate(d,u).scale(h);e.transform(i4(i,s?.duration),c)},fitBounds:(r,n)=>{let{width:s,height:a,minZoom:o,maxZoom:l}=t.getState(),{x:h,y:d,zoom:u}=i3(r,s,a,o,l,n?.padding??.1),c=eH.translate(h,d).scale(u);e.transform(i4(i,n?.duration),c)},project:e=>{let{transform:i,snapToGrid:r,snapGrid:n}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),iJ(e,i,r,n)},screenToFlowPosition:e=>{let{transform:i,snapToGrid:r,snapGrid:n,domNode:s}=t.getState();if(!s)return e;let{x:a,y:o}=s.getBoundingClientRect();return iJ({x:e.x-a,y:e.y-o},i,r,n)},flowToScreenPosition:e=>{let{transform:i,domNode:r}=t.getState();if(!r)return e;let{x:n,y:s}=r.getBoundingClientRect(),a=iQ(e,i);return{x:a.x+n,y:a.y+s}},viewportInitialized:!0}:rz,[e,i])};function rU(){let t=rG(),e=e7(),i=(0,m.useCallback)(()=>e.getState().getNodes().map(t=>({...t})),[]),r=(0,m.useCallback)(t=>e.getState().nodeInternals.get(t),[]),n=(0,m.useCallback)(()=>{let{edges:t=[]}=e.getState();return t.map(t=>({...t}))},[]),s=(0,m.useCallback)(t=>{let{edges:i=[]}=e.getState();return i.find(e=>e.id===t)},[]),a=(0,m.useCallback)(t=>{let{getNodes:i,setNodes:r,hasDefaultNodes:n,onNodesChange:s}=e.getState(),a=i(),o="function"==typeof t?t(a):t;n?r(o):s&&s(0===o.length?a.map(t=>({type:"remove",id:t.id})):o.map(t=>({item:t,type:"reset"})))},[]),o=(0,m.useCallback)(t=>{let{edges:i=[],setEdges:r,hasDefaultEdges:n,onEdgesChange:s}=e.getState(),a="function"==typeof t?t(i):t;n?r(a):s&&s(0===a.length?i.map(t=>({type:"remove",id:t.id})):a.map(t=>({item:t,type:"reset"})))},[]),l=(0,m.useCallback)(t=>{let i=Array.isArray(t)?t:[t],{getNodes:r,setNodes:n,hasDefaultNodes:s,onNodesChange:a}=e.getState();s?n([...r(),...i]):a&&a(i.map(t=>({item:t,type:"add"})))},[]),h=(0,m.useCallback)(t=>{let i=Array.isArray(t)?t:[t],{edges:r=[],setEdges:n,hasDefaultEdges:s,onEdgesChange:a}=e.getState();s?n([...r,...i]):a&&a(i.map(t=>({item:t,type:"add"})))},[]),d=(0,m.useCallback)(()=>{let{getNodes:t,edges:i=[],transform:r}=e.getState(),[n,s,a]=r;return{nodes:t().map(t=>({...t})),edges:i.map(t=>({...t})),viewport:{x:n,y:s,zoom:a}}},[]),u=(0,m.useCallback)(({nodes:t,edges:i})=>{let{nodeInternals:r,getNodes:n,edges:s,hasDefaultNodes:a,hasDefaultEdges:o,onNodesDelete:l,onEdgesDelete:h,onNodesChange:d,onEdgesChange:u}=e.getState(),c=(t||[]).map(t=>t.id),p=(i||[]).map(t=>t.id),f=n().reduce((t,e)=>{let i=e.parentNode||e.parentId,r=!c.includes(e.id)&&i&&t.find(t=>t.id===i);return("boolean"!=typeof e.deletable||e.deletable)&&(c.includes(e.id)||r)&&t.push(e),t},[]),g=s.filter(t=>"boolean"!=typeof t.deletable||t.deletable),m=g.filter(t=>p.includes(t.id));if(f||m){let t=[...m,...i5(f,g)],i=t.reduce((t,e)=>(!t.includes(e.id)&&t.push(e.id),t),[]);(o||a)&&(o&&e.setState({edges:s.filter(t=>!i.includes(t.id))}),a&&(f.forEach(t=>{r.delete(t.id)}),e.setState({nodeInternals:new Map(r)}))),i.length>0&&(h?.(t),u&&u(i.map(t=>({id:t,type:"remove"})))),f.length>0&&(l?.(f),d&&d(f.map(t=>({id:t.id,type:"remove"}))))}},[]),c=(0,m.useCallback)(t=>{let i=im(t),r=i?null:e.getState().nodeInternals.get(t.id);return i||r?[i?t:ip(r),r,i]:[null,null,i]},[]),p=(0,m.useCallback)((t,i=!0,r)=>{let[n,s,a]=c(t);return n?(r||e.getState().getNodes()).filter(t=>{if(!a&&(t.id===s.id||!t.positionAbsolute))return!1;let e=ig(ip(t),n);return i&&e>0||e>=n.width*n.height}):[]},[]),f=(0,m.useCallback)((t,e,i=!0)=>{let[r]=c(t);if(!r)return!1;let n=ig(r,e);return i&&n>0||n>=r.width*r.height},[]);return(0,m.useMemo)(()=>({...t,getNodes:i,getNode:r,getEdges:n,getEdge:s,setNodes:a,setEdges:o,addNodes:l,addEdges:h,toObject:d,deleteElements:u,getIntersectingNodes:p,isNodeIntersecting:f}),[t,i,r,n,s,a,o,l,h,d,u,p,f])}let rV={actInsideInputWithModifier:!1};var rW=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{let i=e7(),{deleteElements:r}=rU(),n=rR(t,rV),s=rR(e);(0,m.useEffect)(()=>{if(n){let{edges:t,getNodes:e}=i.getState(),n=e().filter(t=>t.selected);r({nodes:n,edges:t.filter(t=>t.selected)}),i.setState({nodesSelectionActive:!1})}},[n]),(0,m.useEffect)(()=>{i.setState({multiSelectionActive:s})},[s])};let rZ={position:"absolute",width:"100%",height:"100%",top:0,left:0},r$=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,rY=t=>({x:t.x,y:t.y,zoom:t.k}),rX=(t,e)=>t.target.closest(`.${e}`),rK=(t,e)=>2===e&&Array.isArray(t)&&t.includes(2),rq=t=>{let e=t.ctrlKey&&iE()?10:1;return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*e},rJ=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),rQ=({onMove:t,onMoveStart:e,onMoveEnd:i,onPaneContextMenu:r,zoomOnScroll:n=!0,zoomOnPinch:s=!0,panOnScroll:a=!1,panOnScrollSpeed:o=.5,panOnScrollMode:l=u.Free,zoomOnDoubleClick:h=!0,elementsSelectable:d,panOnDrag:c=!0,defaultViewport:p,translateExtent:f,minZoom:g,maxZoom:v,zoomActivationKeyCode:b,preventScrolling:x=!0,children:w,noWheelClassName:A,noPanClassName:S})=>{let E=(0,m.useRef)(),T=e7(),C=(0,m.useRef)(!1),k=(0,m.useRef)(!1),M=(0,m.useRef)(null),B=(0,m.useRef)({x:0,y:0,zoom:0}),{d3Zoom:P,d3Selection:R,d3ZoomHandler:O,userSelectionActive:I}=e8(rJ,y.X),L=rR(b),D=(0,m.useRef)(0),N=(0,m.useRef)(!1),j=(0,m.useRef)();return!function(t){let e=e7();(0,m.useEffect)(()=>{let i;let r=()=>{if(!t.current)return;let i=ir(t.current);(0===i.height||0===i.width)&&e.getState().onError?.("004",e4.error004()),e.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),t.current&&(i=new ResizeObserver(()=>r())).observe(t.current),()=>{window.removeEventListener("resize",r),i&&t.current&&i.unobserve(t.current)}},[])}(M),(0,m.useEffect)(()=>{if(M.current){let t=M.current.getBoundingClientRect(),e=(function(){var t,e,i,r=eV,n=eW,s=eX,a=e$,o=eY,l=[0,1/0],h=[[-1/0,-1/0],[1/0,1/0]],d=250,u=ty,c=_("start","zoom","end"),p=0,f=10;function g(t){t.property("__zoom",eZ).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",E).filter(o).on("touchstart.zoom",T).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new ez(e,t.x,t.y)}function v(t,e,i){var r=e[0]-i[0]*t.k,n=e[1]-i[1]*t.k;return r===t.x&&n===t.y?t:new ez(t.k,r,n)}function b(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function y(t,e,i,r){t.on("start.zoom",function(){x(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(r).end()}).tween("zoom",function(){var t=arguments,s=x(this,t).event(r),a=n.apply(this,t),o=null==i?b(a):"function"==typeof i?i.apply(this,t):i,l=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),h=this.__zoom,d="function"==typeof e?e.apply(this,t):e,c=u(h.invert(o).concat(l/h.k),d.invert(o).concat(l/d.k));return function(t){if(1===t)t=d;else{var e=c(t),i=l/e[2];t=new ez(i,o[0]-e[0]*i,o[1]-e[1]*i)}s.zoom(null,t)}})}function x(t,e,i){return!i&&t.__zooming||new w(t,e)}function w(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=n.apply(t,e),this.taps=0}function A(t,...e){if(r.apply(this,arguments)){var i=x(this,e).event(t),n=this.__zoom,o=Math.max(l[0],Math.min(l[1],n.k*Math.pow(2,a.apply(this,arguments)))),d=tx(t);if(i.wheel)(i.mouse[0][0]!==d[0]||i.mouse[0][1]!==d[1])&&(i.mouse[1]=n.invert(i.mouse[0]=d)),clearTimeout(i.wheel);else{if(n.k===o)return;i.mouse=[d,n.invert(d)],tW(this),i.start()}eU(t),i.wheel=setTimeout(function(){i.wheel=null,i.end()},150),i.zoom("mouse",s(v(m(n,o),i.mouse[0],i.mouse[1]),i.extent,h))}}function S(t,...e){if(!i&&r.apply(this,arguments)){var n=t.currentTarget,a=x(this,e,!0).event(t),o=tu(t.view).on("mousemove.zoom",function(t){if(eU(t),!a.moved){var e=t.clientX-d,i=t.clientY-u;a.moved=e*e+i*i>p}a.event(t).zoom("mouse",s(v(a.that.__zoom,a.mouse[0]=tx(t,n),a.mouse[1]),a.extent,h))},!0).on("mouseup.zoom",function(t){o.on("mousemove.zoom mouseup.zoom",null),tv(t.view,a.moved),eU(t),a.event(t).end()},!0),l=tx(t,n),d=t.clientX,u=t.clientY;tm(t.view),eG(t),a.mouse=[l,this.__zoom.invert(l)],tW(this),a.start()}}function E(t,...e){if(r.apply(this,arguments)){var i=this.__zoom,a=tx(t.changedTouches?t.changedTouches[0]:t,this),o=i.invert(a),l=i.k*(t.shiftKey?.5:2),u=s(v(m(i,l),a,o),n.apply(this,e),h);eU(t),d>0?tu(this).transition().duration(d).call(y,u,a,t):tu(this).call(g.transform,u,a,t)}}function T(i,...n){if(r.apply(this,arguments)){var s,a,o,l,h=i.touches,d=h.length,u=x(this,n,i.changedTouches.length===d).event(i);for(eG(i),a=0;a{R&&P&&(!a||L||I?void 0!==O&&R.on("wheel.zoom",function(t,e){if(!x&&"wheel"===t.type&&!t.ctrlKey||rX(t,A))return null;t.preventDefault(),O.call(this,t,e)},{passive:!1}):R.on("wheel.zoom",r=>{if(rX(r,A))return!1;r.preventDefault(),r.stopImmediatePropagation();let n=R.property("__zoom").k||1;if(r.ctrlKey&&s){let t=tx(r),e=n*Math.pow(2,rq(r));P.scaleTo(R,e,t,r);return}let a=1===r.deltaMode?20:1,h=l===u.Vertical?0:r.deltaX*a,d=l===u.Horizontal?0:r.deltaY*a;!iE()&&r.shiftKey&&l!==u.Vertical&&(h=r.deltaY*a,d=0),P.translateBy(R,-(h/n)*o,-(d/n)*o,{internal:!0});let c=rY(R.property("__zoom")),{onViewportChangeStart:p,onViewportChange:f,onViewportChangeEnd:g}=T.getState();clearTimeout(j.current),!N.current&&(N.current=!0,e?.(r,c),p?.(c)),N.current&&(t?.(r,c),f?.(c),j.current=setTimeout(()=>{i?.(r,c),g?.(c),N.current=!1},150))},{passive:!1}))},[I,a,l,R,P,O,L,s,x,A,e,t,i]),(0,m.useEffect)(()=>{P&&P.on("start",t=>{if(!t.sourceEvent||t.sourceEvent.internal)return null;D.current=t.sourceEvent?.button;let{onViewportChangeStart:i}=T.getState(),r=rY(t.transform);C.current=!0,B.current=r,t.sourceEvent?.type==="mousedown"&&T.setState({paneDragging:!0}),i?.(r),e?.(t.sourceEvent,r)})},[P,e]),(0,m.useEffect)(()=>{P&&(I&&!C.current?P.on("zoom",null):!I&&P.on("zoom",e=>{let{onViewportChange:i}=T.getState();if(T.setState({transform:[e.transform.x,e.transform.y,e.transform.k]}),k.current=!!(r&&rK(c,D.current??0)),(t||i)&&!e.sourceEvent?.internal){let r=rY(e.transform);i?.(r),t?.(e.sourceEvent,r)}}))},[I,P,t,c,r]),(0,m.useEffect)(()=>{P&&P.on("end",t=>{if(!t.sourceEvent||t.sourceEvent.internal)return null;let{onViewportChangeEnd:e}=T.getState();if(C.current=!1,T.setState({paneDragging:!1}),r&&rK(c,D.current??0)&&!k.current&&r(t.sourceEvent),k.current=!1,(i||e)&&r$(B.current,t.transform)){let r=rY(t.transform);B.current=r,clearTimeout(E.current),E.current=setTimeout(()=>{e?.(r),i?.(t.sourceEvent,r)},a?150:0)}})},[P,a,c,i,r]),(0,m.useEffect)(()=>{P&&P.filter(t=>{let e=L||n,i=s&&t.ctrlKey;if((!0===c||Array.isArray(c)&&c.includes(1))&&1===t.button&&"mousedown"===t.type&&(rX(t,"react-flow__node")||rX(t,"react-flow__edge")))return!0;if(!c&&!e&&!a&&!h&&!s||I||!h&&"dblclick"===t.type||rX(t,A)&&"wheel"===t.type||rX(t,S)&&("wheel"!==t.type||a&&"wheel"===t.type&&!L)||!s&&t.ctrlKey&&"wheel"===t.type||!e&&!a&&!i&&"wheel"===t.type||!c&&("mousedown"===t.type||"touchstart"===t.type)||Array.isArray(c)&&!c.includes(t.button)&&"mousedown"===t.type)return!1;let r=Array.isArray(c)&&c.includes(t.button)||!t.button||t.button<=1;return(!t.ctrlKey||"wheel"===t.type)&&r})},[I,P,n,s,a,h,c,d,L]),m.createElement("div",{className:"react-flow__renderer",ref:M,style:rZ},w)},r0=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function r1(){let{userSelectionActive:t,userSelectionRect:e}=e8(r0,y.X);return t&&e?m.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function r2(t,e){let i=e.parentNode||e.parentId,r=t.find(t=>t.id===i);if(r){let t=e.position.x+e.width-r.width,i=e.position.y+e.height-r.height;if(t>0||i>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,t>0&&(r.style.width+=t),i>0&&(r.style.height+=i),e.position.x<0){let t=Math.abs(e.position.x);r.position.x=r.position.x-t,r.style.width+=t,e.position.x=0}if(e.position.y<0){let t=Math.abs(e.position.y);r.position.y=r.position.y-t,r.style.height+=t,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function r5(t,e){if(t.some(t=>"reset"===t.type))return t.filter(t=>"reset"===t.type).map(t=>t.item);let i=t.filter(t=>"add"===t.type).map(t=>t.item);return e.reduce((e,i)=>{let r=t.filter(t=>t.id===i.id);if(0===r.length)return e.push(i),e;let n={...i};for(let t of r)if(t)switch(t.type){case"select":n.selected=t.selected;break;case"position":void 0!==t.position&&(n.position=t.position),void 0!==t.positionAbsolute&&(n.positionAbsolute=t.positionAbsolute),void 0!==t.dragging&&(n.dragging=t.dragging),n.expandParent&&r2(e,n);break;case"dimensions":void 0!==t.dimensions&&(n.width=t.dimensions.width,n.height=t.dimensions.height),void 0!==t.updateStyle&&(n.style={...n.style||{},...t.dimensions}),"boolean"==typeof t.resizing&&(n.resizing=t.resizing),n.expandParent&&r2(e,n);break;case"remove":return e}return e.push(n),e},i)}function r3(t,e){return r5(t,e)}let r4=(t,e)=>({id:t,type:"select",selected:e});function r6(t,e){return t.reduce((t,i)=>{let r=e.includes(i.id);return!i.selected&&r?(i.selected=!0,t.push(r4(i.id,!0))):i.selected&&!r&&(i.selected=!1,t.push(r4(i.id,!1))),t},[])}let r8=(t,e)=>i=>{if(i.target===e.current)t?.(i)},r7=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),r9=(0,m.memo)(({isSelecting:t,selectionMode:e=c.Full,panOnDrag:i,onSelectionStart:r,onSelectionEnd:n,onPaneClick:s,onPaneContextMenu:a,onPaneScroll:o,onPaneMouseEnter:l,onPaneMouseMove:h,onPaneMouseLeave:d,children:u})=>{let p=(0,m.useRef)(null),f=e7(),g=(0,m.useRef)(0),b=(0,m.useRef)(0),x=(0,m.useRef)(),{userSelectionActive:_,elementsSelectable:w,dragging:A}=e8(r7,y.X),S=()=>{f.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,b.current=0},E=t=>{s?.(t),f.getState().resetSelectedElements(),f.setState({nodesSelectionActive:!1})},T=w&&(t||_);return m.createElement("div",{className:v(["react-flow__pane",{dragging:A,selection:t}]),onClick:T?void 0:r8(E,p),onContextMenu:r8(t=>{if(Array.isArray(i)&&i?.includes(2)){t.preventDefault();return}a?.(t)},p),onWheel:r8(o?t=>o(t):void 0,p),onMouseEnter:T?void 0:l,onMouseDown:T?e=>{let{resetSelectedElements:i,domNode:n}=f.getState();if(x.current=n?.getBoundingClientRect(),!w||!t||0!==e.button||e.target!==p.current||!x.current)return;let{x:s,y:a}=iS(e,x.current);i(),f.setState({userSelectionRect:{width:0,height:0,startX:s,startY:a,x:s,y:a}}),r?.(e)}:void 0,onMouseMove:T?i=>{let{userSelectionRect:r,nodeInternals:n,edges:s,transform:a,onNodesChange:o,onEdgesChange:l,nodeOrigin:h,getNodes:d}=f.getState();if(!t||!x.current||!r)return;f.setState({userSelectionActive:!0,nodesSelectionActive:!1});let u=iS(i,x.current),p=r.startX??0,m=r.startY??0,v={...r,x:u.xt.id),A=_.map(t=>t.id);if(g.current!==A.length){g.current=A.length;let t=r6(y,A);t.length&&o?.(t)}if(b.current!==w.length){b.current=w.length;let t=r6(s,w);t.length&&l?.(t)}f.setState({userSelectionRect:v})}:h,onMouseUp:T?t=>{if(0!==t.button)return;let{userSelectionRect:e}=f.getState();!_&&e&&t.target===p.current&&E?.(t),f.setState({nodesSelectionActive:g.current>0}),S(),n?.(t)}:void 0,onMouseLeave:T?t=>{_&&(f.setState({nodesSelectionActive:g.current>0}),n?.(t)),S()}:d,ref:p,style:rZ},u,m.createElement(r1,null))});r9.displayName="Pane";function nt(t,e,i){let r=t;do{if(r?.matches(e))return!0;if(r===i.current)break;r=r.parentElement}while(r);return!1}function ne(t,e,i,r,n=[0,0],s){var a,o;let l=(a=t,(o=t.extent||r)&&"parent"!==o?[o[0],[o[1][0]-(a.width||0),o[1][1]-(a.height||0)]]:o),h=l,d=t.parentNode||t.parentId;if("parent"!==t.extent||t.expandParent){if(t.extent&&d&&"parent"!==t.extent){let{x:e,y:r}=i0(i.get(d),n).positionAbsolute;h=[[t.extent[0][0]+e,t.extent[0][1]+r],[t.extent[1][0]+e,t.extent[1][1]+r]]}}else if(d&&t.width&&t.height){let e=i.get(d),{x:r,y:s}=i0(e,n).positionAbsolute;h=e&&iv(r)&&iv(s)&&iv(e.width)&&iv(e.height)?[[r+t.width*n[0],s+t.height*n[1]],[r+e.width-t.width+t.width*n[0],s+e.height-t.height+t.height*n[1]]]:h}else s?.("005",e4.error005()),h=l;let u={x:0,y:0};d&&(u=i0(i.get(d),n).positionAbsolute);let c=h&&"parent"!==h?ia(e,h):e;return{position:{x:c.x-u.x,y:c.y-u.y},positionAbsolute:c}}function ni({nodeId:t,dragItems:e,nodeInternals:i}){let r=e.map(t=>({...i.get(t.id),position:t.position,positionAbsolute:t.positionAbsolute}));return[t?r.find(e=>e.id===t):r[0],r]}let nr=(t,e,i,r)=>{let n=e.querySelectorAll(t);if(!n||!n.length)return null;let s=Array.from(n),a=e.getBoundingClientRect(),o={x:a.width*r[0],y:a.height*r[1]};return s.map(t=>{let e=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),position:t.getAttribute("data-handlepos"),x:(e.left-a.left-o.x)/i,y:(e.top-a.top-o.y)/i,...ir(t)}})};function nn(t,e,i){return void 0===i?i:r=>{let n=e().nodeInternals.get(t);n&&i(r,{...n})}}function ns({id:t,store:e,unselect:i=!1,nodeRef:r}){let{addSelectedNodes:n,unselectNodesAndEdges:s,multiSelectionActive:a,nodeInternals:o,onError:l}=e.getState(),h=o.get(t);if(!h){l?.("012",e4.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(i||h.selected&&a)&&(s({nodes:[h],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):n([t])}function na(t){return(e,i,r)=>t?.(e,r)}function no({nodeRef:t,disabled:e=!1,noDragClassName:i,handleSelector:r,nodeId:n,isSelectable:s,selectNodesOnDrag:a}){let o=e7(),[l,h]=(0,m.useState)(!1),d=(0,m.useRef)([]),u=(0,m.useRef)({x:null,y:null}),c=(0,m.useRef)(0),p=(0,m.useRef)(null),f=(0,m.useRef)({x:0,y:0}),g=(0,m.useRef)(null),v=(0,m.useRef)(!1),b=(0,m.useRef)(!1),y=(0,m.useRef)(!1),x=function(){let t=e7();return(0,m.useCallback)(({sourceEvent:e})=>{let{transform:i,snapGrid:r,snapToGrid:n}=t.getState(),s=e.touches?e.touches[0].clientX:e.clientX,a=e.touches?e.touches[0].clientY:e.clientY,o={x:(s-i[0])/i[2],y:(a-i[1])/i[2]};return{xSnapped:n?r[0]*Math.round(o.x/r[0]):o.x,ySnapped:n?r[1]*Math.round(o.y/r[1]):o.y,...o}},[])}();return(0,m.useEffect)(()=>{if(t?.current){let l=tu(t.current),m=({x:t,y:e})=>{let{nodeInternals:i,onNodeDrag:r,onSelectionDrag:s,updateNodePositions:a,nodeExtent:l,snapGrid:c,snapToGrid:p,nodeOrigin:f,onError:m}=o.getState();u.current={x:t,y:e};let v=!1,b={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&l&&(b=iu(i1(d.current,f))),d.current=d.current.map(r=>{let n={x:t-r.distance.x,y:e-r.distance.y};p&&(n.x=c[0]*Math.round(n.x/c[0]),n.y=c[1]*Math.round(n.y/c[1]));let s=[[l[0][0],l[0][1]],[l[1][0],l[1][1]]];d.current.length>1&&l&&!r.extent&&(s[0][0]=r.positionAbsolute.x-b.x+l[0][0],s[1][0]=r.positionAbsolute.x+(r.width??0)-b.x2+l[1][0],s[0][1]=r.positionAbsolute.y-b.y+l[0][1],s[1][1]=r.positionAbsolute.y+(r.height??0)-b.y2+l[1][1]);let a=ne(r,n,i,s,f,m);return v=v||r.position.x!==a.position.x||r.position.y!==a.position.y,r.position=a.position,r.positionAbsolute=a.positionAbsolute,r}),!v)return;a(d.current,!0,!0),h(!0);let y=n?r:na(s);if(y&&g.current){let[t,e]=ni({nodeId:n,dragItems:d.current,nodeInternals:i});y(g.current,t,e)}},w=()=>{if(!p.current)return;let[t,e]=il(f.current,p.current);if(0!==t||0!==e){let{transform:i,panBy:r}=o.getState();u.current.x=(u.current.x??0)-t/i[2],u.current.y=(u.current.y??0)-e/i[2],r({x:t,y:e})&&m(u.current)}c.current=requestAnimationFrame(w)},A=e=>{var i,r,l,h;let{nodeInternals:c,multiSelectionActive:p,nodesDraggable:f,unselectNodesAndEdges:g,onNodeDragStart:m,onSelectionDragStart:v}=o.getState();b.current=!0;let y=n?m:na(v);(!a||!s)&&!p&&n&&!c.get(n)?.selected&&g(),n&&s&&a&&ns({id:n,store:o,nodeRef:t});let _=x(e);if(u.current=_,d.current=(i=c,r=f,l=_,h=n,Array.from(i.values()).filter(t=>(t.selected||t.id===h)&&(!t.parentNode||t.parentId||!function t(e,i){let r=e.parentNode||e.parentId;if(!r)return!1;let n=i.get(r);return!!n&&(!!n.selected||t(n,i))}(t,i))&&(t.draggable||r&&void 0===t.draggable)).map(t=>({id:t.id,position:t.position||{x:0,y:0},positionAbsolute:t.positionAbsolute||{x:0,y:0},distance:{x:l.x-(t.positionAbsolute?.x??0),y:l.y-(t.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:t.extent,parentNode:t.parentNode||t.parentId,parentId:t.parentNode||t.parentId,width:t.width,height:t.height,expandParent:t.expandParent}))),y&&d.current){let[t,i]=ni({nodeId:n,dragItems:d.current,nodeInternals:c});y(e.sourceEvent,t,i)}};if(e)l.on(".drag",null);else{let e=(function(){var t,e,i,r,n=eJ,s=eQ,a=e0,o=e1,l={},h=_("start","drag","end"),d=0,u=0;function c(t){t.on("mousedown.drag",p).filter(o).on("touchstart.drag",m).on("touchmove.drag",v,tc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(a,o){if(!r&&!!n.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&(tu(a.view).on("mousemove.drag",f,tp).on("mouseup.drag",g,tp),tm(a.view),tf(a),i=!1,t=a.clientX,e=a.clientY,l("start",a))}}function f(r){if(tg(r),!i){var n=r.clientX-t,s=r.clientY-e;i=n*n+s*s>u}l.mouse("drag",r)}function g(t){tu(t.view).on("mousemove.drag mouseup.drag",null),tv(t.view,i),tg(t),l.mouse("end",t)}function m(t,e){if(n.call(this,t,e)){var i,r,a=t.changedTouches,o=s.call(this,t,e),l=a.length;for(i=0;i{let{domNode:e,nodeDragThreshold:i}=o.getState();0===i&&A(t),y.current=!1;let r=x(t);u.current=r,p.current=e?.getBoundingClientRect()||null,f.current=iS(t.sourceEvent,p.current)}).on("drag",t=>{let e=x(t),{autoPanOnNodeDrag:i,nodeDragThreshold:r}=o.getState();if("touchmove"===t.sourceEvent.type&&t.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&b.current&&i&&(v.current=!0,w()),!b.current){let i=e.xSnapped-(u?.current?.x??0),n=e.ySnapped-(u?.current?.y??0);Math.sqrt(i*i+n*n)>r&&A(t)}(u.current.x!==e.xSnapped||u.current.y!==e.ySnapped)&&d.current&&b.current&&(g.current=t.sourceEvent,f.current=iS(t.sourceEvent,p.current),m(e))}}).on("end",t=>{if(!!b.current&&!y.current){if(h(!1),v.current=!1,b.current=!1,cancelAnimationFrame(c.current),d.current){let{updateNodePositions:e,nodeInternals:i,onNodeDragStop:r,onSelectionDragStop:s}=o.getState(),a=n?r:na(s);if(e(d.current,!1,!1),a){let[e,r]=ni({nodeId:n,dragItems:d.current,nodeInternals:i});a(t.sourceEvent,e,r)}}}}).filter(e=>{let n=e.target;return!e.button&&(!i||!nt(n,`.${i}`,t))&&(!r||nt(n,r,t))});return l.call(e),()=>{l.on(".drag",null)}}}},[t,e,i,r,s,o,n,a,x]),l}function nl(){let t=e7();return(0,m.useCallback)(e=>{let{nodeInternals:i,nodeExtent:r,updateNodePositions:n,getNodes:s,snapToGrid:a,snapGrid:o,onError:l,nodesDraggable:h}=t.getState(),d=s().filter(t=>t.selected&&(t.draggable||h&&void 0===t.draggable)),u=a?o[0]:5,c=a?o[1]:5,p=e.isShiftPressed?4:1,f=e.x*u*p,g=e.y*c*p;n(d.map(t=>{if(t.positionAbsolute){let e={x:t.positionAbsolute.x+f,y:t.positionAbsolute.y+g};a&&(e.x=o[0]*Math.round(e.x/o[0]),e.y=o[1]*Math.round(e.y/o[1]));let{positionAbsolute:n,position:s}=ne(t,e,i,r,void 0,l);t.position=s,t.positionAbsolute=n}return t}),!0,!1)},[])}let nh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var nd=t=>{let e=({id:e,type:i,data:r,xPos:n,yPos:s,xPosOrigin:a,yPosOrigin:o,selected:l,onClick:h,onMouseEnter:d,onMouseMove:u,onMouseLeave:c,onContextMenu:p,onDoubleClick:f,style:g,className:b,isDraggable:y,isSelectable:x,isConnectable:_,isFocusable:w,selectNodesOnDrag:A,sourcePosition:S,targetPosition:E,hidden:T,resizeObserver:C,dragHandle:k,zIndex:M,isParent:B,noDragClassName:P,noPanClassName:R,initialized:O,disableKeyboardA11y:I,ariaLabel:L,rfId:D,hasHandleBounds:N})=>{let j=e7(),F=(0,m.useRef)(null),z=(0,m.useRef)(null),H=(0,m.useRef)(S),G=(0,m.useRef)(E),U=(0,m.useRef)(i),V=x||y||h||d||u||c,W=nl(),Z=nn(e,j.getState,d),$=nn(e,j.getState,u),Y=nn(e,j.getState,c),X=nn(e,j.getState,p),K=nn(e,j.getState,f);(0,m.useEffect)(()=>()=>{z.current&&(C?.unobserve(z.current),z.current=null)},[]),(0,m.useEffect)(()=>{if(F.current&&!T){let t=F.current;(!O||!N||z.current!==t)&&(z.current&&C?.unobserve(z.current),C?.observe(t),z.current=t)}},[T,O,N]),(0,m.useEffect)(()=>{let t=U.current!==i,r=H.current!==S,n=G.current!==E;F.current&&(t||r||n)&&(t&&(U.current=i),r&&(H.current=S),n&&(G.current=E),j.getState().updateNodeDimensions([{id:e,nodeElement:F.current,forceUpdate:!0}]))},[e,i,S,E]);let q=no({nodeRef:F,disabled:T||!y,noDragClassName:P,handleSelector:k,nodeId:e,isSelectable:x,selectNodesOnDrag:A});return T?null:m.createElement("div",{className:v(["react-flow__node",`react-flow__node-${i}`,{[R]:y},b,{selected:l,selectable:x,parent:B,dragging:q}]),ref:F,style:{zIndex:M,transform:`translate(${a}px,${o}px)`,pointerEvents:V?"all":"none",visibility:O?"visible":"hidden",...g},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Z,onMouseMove:$,onMouseLeave:Y,onContextMenu:X,onClick:t=>{let{nodeDragThreshold:i}=j.getState();if(x&&(!A||!y||i>0)&&ns({id:e,store:j,nodeRef:F}),h){let i=j.getState().nodeInternals.get(e);i&&h(t,{...i})}},onDoubleClick:K,onKeyDown:w?t=>{if(!iw(t)&&!I)iy.includes(t.key)&&x?ns({id:e,store:j,unselect:"Escape"===t.key,nodeRef:F}):y&&l&&Object.prototype.hasOwnProperty.call(nh,t.key)&&(j.setState({ariaLiveMessage:`Moved selected node ${t.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~n}, y: ${~~s}`}),W({x:nh[t.key].x,y:nh[t.key].y,isShiftPressed:t.shiftKey}))}:void 0,tabIndex:w?0:void 0,role:w?"button":void 0,"aria-describedby":I?void 0:`${rC}-${D}`,"aria-label":L},m.createElement(iW,{value:e},m.createElement(t,{id:e,data:r,type:i,xPos:n,yPos:s,selected:l,isConnectable:_,sourcePosition:S,targetPosition:E,dragging:q,dragHandle:k,zIndex:M})))};return e.displayName="NodeWrapper",(0,m.memo)(e)};let nu=t=>({...i1(t.getNodes().filter(t=>t.selected),t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive});var nc=(0,m.memo)(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:i}){let r=e7(),{width:n,height:s,x:a,y:o,transformString:l,userSelectionActive:h}=e8(nu,y.X),d=nl(),u=(0,m.useRef)(null);if((0,m.useEffect)(()=>{!i&&u.current?.focus({preventScroll:!0})},[i]),no({nodeRef:u}),h||!n||!s)return null;let c=t?e=>{t(e,r.getState().getNodes().filter(t=>t.selected))}:void 0;return m.createElement("div",{className:v(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},m.createElement("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:i?void 0:-1,onKeyDown:i?void 0:t=>{Object.prototype.hasOwnProperty.call(nh,t.key)&&d({x:nh[t.key].x,y:nh[t.key].y,isShiftPressed:t.shiftKey})},style:{width:n,height:s,top:o,left:a}}))});let np=t=>t.nodesSelectionActive,nf=({children:t,onPaneClick:e,onPaneMouseEnter:i,onPaneMouseMove:r,onPaneMouseLeave:n,onPaneContextMenu:s,onPaneScroll:a,deleteKeyCode:o,onMove:l,onMoveStart:h,onMoveEnd:d,selectionKeyCode:u,selectionOnDrag:c,selectionMode:p,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:x,zoomOnScroll:_,zoomOnPinch:w,panOnScroll:A,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:T,panOnDrag:C,defaultViewport:k,translateExtent:M,minZoom:B,maxZoom:P,preventScrolling:R,onSelectionContextMenu:O,noWheelClassName:I,noPanClassName:L,disableKeyboardA11y:D})=>{let N=e8(np),j=rR(u),F=rR(b),z=F||C,H=F||A,G=j||c&&!0!==z;return rW({deleteKeyCode:o,multiSelectionKeyCode:v}),m.createElement(rQ,{onMove:l,onMoveStart:h,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:_,zoomOnPinch:w,panOnScroll:H,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:T,panOnDrag:!j&&z,defaultViewport:k,translateExtent:M,minZoom:B,maxZoom:P,zoomActivationKeyCode:y,preventScrolling:R,noWheelClassName:I,noPanClassName:L},m.createElement(r9,{onSelectionStart:f,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:i,onPaneMouseMove:r,onPaneMouseLeave:n,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:z,isSelecting:!!G,selectionMode:p},t,N&&m.createElement(nc,{onSelectionContextMenu:O,noPanClassName:L,disableKeyboardA11y:D})))};nf.displayName="FlowRenderer";var ng=(0,m.memo)(nf);function nm(t){let e={input:nd(t.input||ru),default:nd(t.default||rh),output:nd(t.output||rp),group:nd(t.group||rf)},i=Object.keys(t).filter(t=>!["input","default","output","group"].includes(t)).reduce((e,i)=>(e[i]=nd(t[i]||rh),e),{});return{...e,...i}}let nv=({x:t,y:e,width:i,height:r,origin:n})=>!i||!r||n[0]<0||n[1]<0||n[0]>1||n[1]>1?{x:t,y:e}:{x:t-i*n[0],y:e-r*n[1]},nb=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),ny=t=>{var e;let{nodesDraggable:i,nodesConnectable:r,nodesFocusable:n,elementsSelectable:s,updateNodeDimensions:a,onError:o}=e8(nb,y.X);let l=(e=t.onlyRenderVisibleElements,e8((0,m.useCallback)(t=>e?i2(t.nodeInternals,{x:0,y:0,width:t.width,height:t.height},t.transform,!0):t.getNodes(),[e]))),h=(0,m.useRef)(),d=(0,m.useMemo)(()=>{if("undefined"==typeof ResizeObserver)return null;let t=new ResizeObserver(t=>{a(t.map(t=>({id:t.target.getAttribute("data-id"),nodeElement:t.target,forceUpdate:!0})))});return h.current=t,t},[]);return(0,m.useEffect)(()=>()=>{h?.current?.disconnect()},[]),m.createElement("div",{className:"react-flow__nodes",style:rZ},l.map(e=>{let a=e.type||"default";!t.nodeTypes[a]&&(o?.("003",e4.error003(a)),a="default");let l=t.nodeTypes[a]||t.nodeTypes.default,h=!!(e.draggable||i&&void 0===e.draggable),u=!!(e.selectable||s&&void 0===e.selectable),c=!!(e.connectable||r&&void 0===e.connectable),p=!!(e.focusable||n&&void 0===e.focusable),f=t.nodeExtent?ia(e.positionAbsolute,t.nodeExtent):e.positionAbsolute,v=f?.x??0,b=f?.y??0,y=nv({x:v,y:b,width:e.width??0,height:e.height??0,origin:t.nodeOrigin});return m.createElement(l,{key:e.id,id:e.id,className:e.className,style:e.style,type:a,data:e.data,sourcePosition:e.sourcePosition||g.Bottom,targetPosition:e.targetPosition||g.Top,hidden:e.hidden,xPos:v,yPos:b,xPosOrigin:y.x,yPosOrigin:y.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!e.selected,isDraggable:h,isSelectable:u,isConnectable:c,isFocusable:p,resizeObserver:d,dragHandle:e.dragHandle,zIndex:e[ib]?.z??0,isParent:!!e[ib]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!e.width&&!!e.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:e.ariaLabel,hasHandleBounds:!!e[ib]?.handleBounds})}))};ny.displayName="NodeRenderer";var nx=(0,m.memo)(ny);let n_=(t,e,i)=>i===g.Left?t-e:i===g.Right?t+e:t,nw=(t,e,i)=>i===g.Top?t-e:i===g.Bottom?t+e:t,nA="react-flow__edgeupdater",nS=({position:t,centerX:e,centerY:i,radius:r=10,onMouseDown:n,onMouseEnter:s,onMouseOut:a,type:o})=>m.createElement("circle",{onMouseDown:n,onMouseEnter:s,onMouseOut:a,className:v([nA,`${nA}-${o}`]),cx:n_(e,r,t),cy:nw(i,r,t),r:r,stroke:"transparent",fill:"transparent"}),nE=()=>!0;var nT=t=>{let e=({id:e,className:i,type:r,data:n,onClick:s,onEdgeDoubleClick:a,selected:o,animated:l,label:h,labelStyle:d,labelShowBg:u,labelBgStyle:c,labelBgPadding:p,labelBgBorderRadius:f,style:g,source:b,target:y,sourceX:x,sourceY:_,targetX:w,targetY:A,sourcePosition:S,targetPosition:E,elementsSelectable:T,hidden:C,sourceHandleId:k,targetHandleId:M,onContextMenu:B,onMouseEnter:P,onMouseMove:R,onMouseLeave:O,reconnectRadius:I,onReconnect:L,onReconnectStart:D,onReconnectEnd:N,markerEnd:j,markerStart:F,rfId:z,ariaLabel:H,isFocusable:G,isReconnectable:U,pathOptions:V,interactionWidth:W,disableKeyboardA11y:Z})=>{let $=(0,m.useRef)(null),[Y,X]=(0,m.useState)(!1),[K,q]=(0,m.useState)(!1),J=e7(),Q=(0,m.useMemo)(()=>`url('#${iX(F,z)}')`,[F,z]),tt=(0,m.useMemo)(()=>`url('#${iX(j,z)}')`,[j,z]);if(C)return null;let te=iC(e,J.getState,a),ti=iC(e,J.getState,B),tr=iC(e,J.getState,P),tn=iC(e,J.getState,R),ts=iC(e,J.getState,O),ta=(t,i)=>{if(0!==t.button)return;let{edges:r,isValidConnection:n}=J.getState(),s=i?y:b,a=(i?M:k)||null,o=i?"target":"source",l=n||nE,h=r.find(t=>t.id===e);q(!0),D?.(t,h,o);ri({event:t,handleId:a,nodeId:s,onConnect:t=>L?.(h,t),isTarget:i,getState:J.getState,setState:J.setState,isValidConnection:l,edgeUpdaterType:o,onReconnectEnd:t=>{q(!1),N?.(t,h,o)}})},to=()=>X(!0),tl=()=>X(!1),th=!T&&!s;return m.createElement("g",{className:v(["react-flow__edge",`react-flow__edge-${r}`,i,{selected:o,animated:l,inactive:th,updating:Y}]),onClick:t=>{let{edges:i,addSelectedEdges:r,unselectNodesAndEdges:n,multiSelectionActive:a}=J.getState(),o=i.find(t=>t.id===e);if(!!o)T&&(J.setState({nodesSelectionActive:!1}),o.selected&&a?(n({nodes:[],edges:[o]}),$.current?.blur()):r([e])),s&&s(t,o)},onDoubleClick:te,onContextMenu:ti,onMouseEnter:tr,onMouseMove:tn,onMouseLeave:ts,onKeyDown:G?t=>{if(!Z&&iy.includes(t.key)&&T){let{unselectNodesAndEdges:i,addSelectedEdges:r,edges:n}=J.getState();"Escape"===t.key?($.current?.blur(),i({edges:[n.find(t=>t.id===e)]})):r([e])}}:void 0,tabIndex:G?0:void 0,role:G?"button":"img","data-testid":`rf__edge-${e}`,"aria-label":null===H?void 0:H||`Edge from ${b} to ${y}`,"aria-describedby":G?`${rk}-${z}`:void 0,ref:$},!K&&m.createElement(t,{id:e,source:b,target:y,selected:o,animated:l,label:h,labelStyle:d,labelShowBg:u,labelBgStyle:c,labelBgPadding:p,labelBgBorderRadius:f,data:n,style:g,sourceX:x,sourceY:_,targetX:w,targetY:A,sourcePosition:S,targetPosition:E,sourceHandleId:k,targetHandleId:M,markerStart:Q,markerEnd:tt,pathOptions:V,interactionWidth:W}),U&&m.createElement(m.Fragment,null,("source"===U||!0===U)&&m.createElement(nS,{position:S,centerX:x,centerY:_,radius:I,onMouseDown:t=>ta(t,!0),onMouseEnter:to,onMouseOut:tl,type:"source"}),("target"===U||!0===U)&&m.createElement(nS,{position:E,centerX:w,centerY:A,radius:I,onMouseDown:t=>ta(t,!1),onMouseEnter:to,onMouseOut:tl,type:"target"})))};return e.displayName="EdgeWrapper",(0,m.memo)(e)};function nC(t){let e={default:nT(t.default||iU),straight:nT(t.bezier||iF),step:nT(t.step||ij),smoothstep:nT(t.step||iN),simplebezier:nT(t.simplebezier||iR)},i=Object.keys(t).filter(t=>!["default","bezier"].includes(t)).reduce((e,i)=>(e[i]=nT(t[i]||iU),e),{});return{...e,...i}}function nk(t,e,i=null){let r=(i?.x||0)+e.x,n=(i?.y||0)+e.y,s=i?.width||e.width,a=i?.height||e.height;switch(t){case g.Top:return{x:r+s/2,y:n};case g.Right:return{x:r+s,y:n+a/2};case g.Bottom:return{x:r+s/2,y:n+a};case g.Left:return{x:r,y:n+a/2}}}function nM(t,e){return t?1!==t.length&&e?e&&t.find(t=>t.id===e)||null:t[0]:null}let nB=(t,e,i,r,n,s)=>{let a=nk(i,t,e),o=nk(s,r,n);return{sourceX:a.x,sourceY:a.y,targetX:o.x,targetY:o.y}};function nP(t){let e=t?.[ib]?.handleBounds||null,i=e&&t?.width&&t?.height&&void 0!==t?.positionAbsolute?.x&&void 0!==t?.positionAbsolute?.y;return[{x:t?.positionAbsolute?.x||0,y:t?.positionAbsolute?.y||0,width:t?.width||0,height:t?.height||0},e,!!i]}let nR=[{level:0,isMaxLevel:!0,edges:[]}],nO={[f.Arrow]:({color:t="none",strokeWidth:e=1})=>m.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[f.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>m.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},nI=({id:t,type:e,color:i,width:r=12.5,height:n=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{let l=function(t){let e=e7();return(0,m.useMemo)(()=>Object.prototype.hasOwnProperty.call(nO,t)?nO[t]:(e.getState().onError?.("009",e4.error009(t)),null),[t])}(e);return l?m.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${n}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:o,refX:"0",refY:"0"},m.createElement(l,{color:i,strokeWidth:a})):null},nL=({defaultColor:t,rfId:e})=>i=>{let r=[];return i.edges.reduce((i,n)=>([n.markerStart,n.markerEnd].forEach(n=>{if(n&&"object"==typeof n){let s=iX(n,e);!r.includes(s)&&(i.push({id:s,color:n.color||t,...n}),r.push(s))}}),i),[]).sort((t,e)=>t.id.localeCompare(e.id))},nD=({defaultColor:t,rfId:e})=>{let i=e8((0,m.useCallback)(nL({defaultColor:t,rfId:e}),[t,e]),(t,e)=>!(t.length!==e.length||t.some((t,i)=>t.id!==e[i].id)));return m.createElement("defs",null,i.map(t=>m.createElement(nI,{id:t.id,key:t.id,type:t.type,color:t.color,width:t.width,height:t.height,markerUnits:t.markerUnits,strokeWidth:t.strokeWidth,orient:t.orient})))};nD.displayName="MarkerDefinitions";var nN=(0,m.memo)(nD);let nj=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),nF=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:i,rfId:r,edgeTypes:n,noPanClassName:s,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:l,onEdgeMouseLeave:h,onEdgeClick:u,onEdgeDoubleClick:c,onReconnect:p,onReconnectStart:f,onReconnectEnd:b,reconnectRadius:x,children:_,disableKeyboardA11y:w})=>{var A,S,E;let{edgesFocusable:T,edgesUpdatable:C,elementsSelectable:k,width:M,height:B,connectionMode:P,nodeInternals:R,onError:O}=e8(nj,y.X);let I=(A=e,S=R,E=i,function(t,e,i=!1){let r=-1,n=Object.entries(t.reduce((t,n)=>{let s=iv(n.zIndex),a=s?n.zIndex:0;if(i){let t=e.get(n.target),i=e.get(n.source),r=n.selected||t?.selected||i?.selected,o=Math.max(i?.[ib]?.z||0,t?.[ib]?.z||0,1e3);a=(s?n.zIndex:0)+(r?o:0)}return t[a]?t[a].push(n):t[a]=[n],r=a>r?a:r,t},{})).map(([t,e])=>{let i=+t;return{edges:e,level:i,isMaxLevel:i===r}});return 0===n.length?nR:n}(e8((0,m.useCallback)(t=>A?t.edges.filter(e=>{let i=S.get(e.source),r=S.get(e.target);return i?.width&&i?.height&&r?.width&&r?.height&&function({sourcePos:t,targetPos:e,sourceWidth:i,sourceHeight:r,targetWidth:n,targetHeight:s,width:a,height:o,transform:l}){let h={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+i,e.x+n),y2:Math.max(t.y+r,e.y+s)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);let d=iu({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:o/l[2]}),u=Math.max(0,Math.min(d.x2,h.x2)-Math.max(d.x,h.x));return Math.ceil(u*Math.max(0,Math.min(d.y2,h.y2)-Math.max(d.y,h.y)))>0}({sourcePos:i.positionAbsolute||{x:0,y:0},targetPos:r.positionAbsolute||{x:0,y:0},sourceWidth:i.width,sourceHeight:i.height,targetWidth:r.width,targetHeight:r.height,width:t.width,height:t.height,transform:t.transform})}):t.edges,[A,S])),S,E));return M?m.createElement(m.Fragment,null,I.map(({level:e,edges:i,isMaxLevel:y})=>m.createElement("svg",{key:e,style:{zIndex:e},width:M,height:B,className:"react-flow__edges react-flow__container"},y&&m.createElement(nN,{defaultColor:t,rfId:r}),m.createElement("g",null,i.map(t=>{let[e,i,y]=nP(R.get(t.source)),[_,A,S]=nP(R.get(t.target));if(!y||!S)return null;let E=t.type||"default";!n[E]&&(O?.("011",e4.error011(E)),E="default");let M=n[E]||n.default,B=P===d.Strict?A.target:(A.target??[]).concat(A.source??[]),I=nM(i.source,t.sourceHandle),L=nM(B,t.targetHandle),D=I?.position||g.Bottom,N=L?.position||g.Top,j=!!(t.focusable||T&&void 0===t.focusable),F=t.reconnectable||t.updatable;if(!I||!L)return O?.("008",e4.error008(I,t)),null;let{sourceX:z,sourceY:H,targetX:G,targetY:U}=nB(e,I,D,_,L,N);return m.createElement(M,{key:t.id,id:t.id,className:v([t.className,s]),type:E,data:t.data,selected:!!t.selected,animated:!!t.animated,hidden:!!t.hidden,label:t.label,labelStyle:t.labelStyle,labelShowBg:t.labelShowBg,labelBgStyle:t.labelBgStyle,labelBgPadding:t.labelBgPadding,labelBgBorderRadius:t.labelBgBorderRadius,style:t.style,source:t.source,target:t.target,sourceHandleId:t.sourceHandle,targetHandleId:t.targetHandle,markerEnd:t.markerEnd,markerStart:t.markerStart,sourceX:z,sourceY:H,targetX:G,targetY:U,sourcePosition:D,targetPosition:N,elementsSelectable:k,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:h,onClick:u,onEdgeDoubleClick:c,onReconnect:p,onReconnectStart:f,onReconnectEnd:b,reconnectRadius:x,rfId:r,ariaLabel:t.ariaLabel,isFocusable:j,isReconnectable:void 0!==p&&(F||C&&void 0===F),pathOptions:"pathOptions"in t?t.pathOptions:void 0,interactionWidth:t.interactionWidth,disableKeyboardA11y:w})})))),_):null};nF.displayName="EdgeRenderer";var nz=(0,m.memo)(nF);let nH=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function nG({children:t}){let e=e8(nH);return m.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}let nU={[g.Left]:g.Right,[g.Right]:g.Left,[g.Top]:g.Bottom,[g.Bottom]:g.Top},nV=({nodeId:t,handleType:e,style:i,type:r=p.Bezier,CustomComponent:n,connectionStatus:s})=>{let{fromNode:a,handleId:o,toX:l,toY:h,connectionMode:u}=e8((0,m.useCallback)(e=>({fromNode:e.nodeInternals.get(t),handleId:e.connectionHandleId,toX:(e.connectionPosition.x-e.transform[0])/e.transform[2],toY:(e.connectionPosition.y-e.transform[1])/e.transform[2],connectionMode:e.connectionMode}),[t]),y.X),c=a?.[ib]?.handleBounds,f=c?.[e];if(u===d.Loose&&(f=f||c?.["source"===e?"target":"source"]),!a||!f)return null;let g=o?f.find(t=>t.id===o):f[0],v=g?g.x+g.width/2:(a.width??0)/2,b=g?g.y+g.height/2:a.height??0,x=(a.positionAbsolute?.x??0)+v,_=(a.positionAbsolute?.y??0)+b,w=g?.position,A=w?nU[w]:null;if(!w||!A)return null;if(n)return m.createElement(n,{connectionLineType:r,connectionLineStyle:i,fromNode:a,fromHandle:g,fromX:x,fromY:_,toX:l,toY:h,fromPosition:w,toPosition:A,connectionStatus:s});let S="",E={sourceX:x,sourceY:_,sourcePosition:w,targetX:l,targetY:h,targetPosition:A};return r===p.Bezier?[S]=iG(E):r===p.Step?[S]=iD({...E,borderRadius:0}):r===p.SmoothStep?[S]=iD(E):r===p.SimpleBezier?[S]=iP(E):S=`M${x},${_} ${l},${h}`,m.createElement("path",{d:S,fill:"none",className:"react-flow__connection-path",style:i})};nV.displayName="ConnectionLine";let nW=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function nZ({containerStyle:t,style:e,type:i,component:r}){let{nodeId:n,handleType:s,nodesConnectable:a,width:o,height:l,connectionStatus:h}=e8(nW,y.X);return n&&s&&o&&a?m.createElement("svg",{style:t,width:o,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},m.createElement("g",{className:v(["react-flow__connection",h])},m.createElement(nV,{nodeId:n,handleType:s,style:e,type:i,CustomComponent:r,connectionStatus:h}))):null}function n$(t,e){return(0,m.useRef)(null),e7(),(0,m.useMemo)(()=>e(t),[t])}let nY=({nodeTypes:t,edgeTypes:e,onMove:i,onMoveStart:r,onMoveEnd:n,onInit:s,onNodeClick:a,onEdgeClick:o,onNodeDoubleClick:l,onEdgeDoubleClick:h,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:c,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:v,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:_,selectionKeyCode:w,selectionOnDrag:A,selectionMode:S,multiSelectionKeyCode:E,panActivationKeyCode:T,zoomActivationKeyCode:C,deleteKeyCode:k,onlyRenderVisibleElements:M,elementsSelectable:B,selectNodesOnDrag:P,defaultViewport:R,translateExtent:O,minZoom:I,maxZoom:L,preventScrolling:D,defaultMarkerColor:N,zoomOnScroll:j,zoomOnPinch:F,panOnScroll:z,panOnScrollSpeed:H,panOnScrollMode:G,zoomOnDoubleClick:U,panOnDrag:V,onPaneClick:W,onPaneMouseEnter:Z,onPaneMouseMove:$,onPaneMouseLeave:Y,onPaneScroll:X,onPaneContextMenu:K,onEdgeContextMenu:q,onEdgeMouseEnter:J,onEdgeMouseMove:Q,onEdgeMouseLeave:tt,onReconnect:te,onReconnectStart:ti,onReconnectEnd:tr,reconnectRadius:tn,noDragClassName:ts,noWheelClassName:ta,noPanClassName:to,elevateEdgesOnSelect:tl,disableKeyboardA11y:th,nodeOrigin:td,nodeExtent:tu,rfId:tc})=>{let tp=n$(t,nm),tf=n$(e,nC);return!function(t){let e=rU(),i=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!i.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),i.current=!0)},[t,e.viewportInitialized])}(s),m.createElement(ng,{onPaneClick:W,onPaneMouseEnter:Z,onPaneMouseMove:$,onPaneMouseLeave:Y,onPaneContextMenu:K,onPaneScroll:X,deleteKeyCode:k,selectionKeyCode:w,selectionOnDrag:A,selectionMode:S,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:E,panActivationKeyCode:T,zoomActivationKeyCode:C,elementsSelectable:B,onMove:i,onMoveStart:r,onMoveEnd:n,zoomOnScroll:j,zoomOnPinch:F,zoomOnDoubleClick:U,panOnScroll:z,panOnScrollSpeed:H,panOnScrollMode:G,panOnDrag:V,defaultViewport:R,translateExtent:O,minZoom:I,maxZoom:L,onSelectionContextMenu:f,preventScrolling:D,noDragClassName:ts,noWheelClassName:ta,noPanClassName:to,disableKeyboardA11y:th},m.createElement(nG,null,m.createElement(nz,{edgeTypes:tf,onEdgeClick:o,onEdgeDoubleClick:h,onlyRenderVisibleElements:M,onEdgeContextMenu:q,onEdgeMouseEnter:J,onEdgeMouseMove:Q,onEdgeMouseLeave:tt,onReconnect:te,onReconnectStart:ti,onReconnectEnd:tr,reconnectRadius:tn,defaultMarkerColor:N,noPanClassName:to,elevateEdgesOnSelect:!!tl,disableKeyboardA11y:th,rfId:tc},m.createElement(nZ,{style:y,type:b,component:x,containerStyle:_})),m.createElement("div",{className:"react-flow__edgelabel-renderer"}),m.createElement(nx,{nodeTypes:tp,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:c,onNodeContextMenu:p,selectNodesOnDrag:P,onlyRenderVisibleElements:M,noPanClassName:to,noDragClassName:ts,disableKeyboardA11y:th,nodeOrigin:td,nodeExtent:tu,rfId:tc})))};nY.displayName="GraphView";var nX=(0,m.memo)(nY);let nK=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nq={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:nK,nodeExtent:nK,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:d.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:ix,isValidConnection:void 0},nJ=()=>(0,b.F)((t,e)=>({...nq,setNodes:i=>{let{nodeInternals:r,nodeOrigin:n,elevateNodesOnSelect:s}=e();t({nodeInternals:rD(i,r,n,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:i=>{let{defaultEdgeOptions:r={}}=e();t({edges:i.map(t=>({...r,...t}))})},setDefaultNodesAndEdges:(i,r)=>{let n=void 0!==i,s=void 0!==r,a=n?rD(i,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:s?r:[],hasDefaultNodes:n,hasDefaultEdges:s})},updateNodeDimensions:i=>{let{onNodesChange:r,nodeInternals:n,fitViewOnInit:s,fitViewOnInitDone:a,fitViewOnInitOptions:o,domNode:l,nodeOrigin:h}=e(),d=l?.querySelector(".react-flow__viewport");if(!d)return;let u=window.getComputedStyle(d),{m22:c}=new window.DOMMatrixReadOnly(u.transform),p=i.reduce((t,e)=>{let i=n.get(e.id);if(i?.hidden)n.set(i.id,{...i,[ib]:{...i[ib],handleBounds:void 0}});else if(i){let r=ir(e.nodeElement);r.width&&r.height&&(i.width!==r.width||i.height!==r.height||e.forceUpdate)&&(n.set(i.id,{...i,[ib]:{...i[ib],handleBounds:{source:nr(".source",e.nodeElement,c,h),target:nr(".target",e.nodeElement,c,h)}},...r}),t.push({id:i.id,type:"dimensions",dimensions:r}))}return t},[]);rL(n,h);let f=a||s&&!a&&rN(e,{initial:!0,...o});t({nodeInternals:new Map(n),fitViewOnInitDone:f}),p?.length>0&&r?.(p)},updateNodePositions:(t,i=!0,r=!1)=>{let{triggerNodeChanges:n}=e();n(t.map(t=>{let e={id:t.id,type:"position",dragging:r};return i&&(e.positionAbsolute=t.positionAbsolute,e.position=t.position),e}))},triggerNodeChanges:i=>{let{onNodesChange:r,nodeInternals:n,hasDefaultNodes:s,nodeOrigin:a,getNodes:o,elevateNodesOnSelect:l}=e();i?.length&&(s&&t({nodeInternals:rD(r3(i,o()),n,a,l)}),r?.(i))},addSelectedNodes:i=>{let r;let{multiSelectionActive:n,edges:s,getNodes:a}=e(),o=null;n?r=i.map(t=>r4(t,!0)):(r=r6(a(),i),o=r6(s,[])),rj({changedNodes:r,changedEdges:o,get:e,set:t})},addSelectedEdges:i=>{let r;let{multiSelectionActive:n,edges:s,getNodes:a}=e(),o=null;n?r=i.map(t=>r4(t,!0)):(r=r6(s,i),o=r6(a(),[])),rj({changedNodes:o,changedEdges:r,get:e,set:t})},unselectNodesAndEdges:({nodes:i,edges:r}={})=>{let{edges:n,getNodes:s}=e(),a=i||s(),o=a.map(t=>(t.selected=!1,r4(t.id,!1)));rj({changedNodes:o,changedEdges:(r||n).map(t=>r4(t.id,!1)),get:e,set:t})},setMinZoom:i=>{let{d3Zoom:r,maxZoom:n}=e();r?.scaleExtent([i,n]),t({minZoom:i})},setMaxZoom:i=>{let{d3Zoom:r,minZoom:n}=e();r?.scaleExtent([n,i]),t({maxZoom:i})},setTranslateExtent:i=>{e().d3Zoom?.translateExtent(i),t({translateExtent:i})},resetSelectedElements:()=>{let{edges:i,getNodes:r}=e(),n=r().filter(t=>t.selected).map(t=>r4(t.id,!1));rj({changedNodes:n,changedEdges:i.filter(t=>t.selected).map(t=>r4(t.id,!1)),get:e,set:t})},setNodeExtent:i=>{let{nodeInternals:r}=e();r.forEach(t=>{t.positionAbsolute=ia(t.position,i)}),t({nodeExtent:i,nodeInternals:new Map(r)})},panBy:t=>{let{transform:i,width:r,height:n,d3Zoom:s,d3Selection:a,translateExtent:o}=e();if(!s||!a||!t.x&&!t.y)return!1;let l=eH.translate(i[0]+t.x,i[1]+t.y).scale(i[2]),h=s?.constrain()(l,[[0,0],[r,n]],o);return s.transform(a,h),i[0]!==h.x||i[1]!==h.y||i[2]!==h.k},cancelConnection:()=>t({connectionNodeId:nq.connectionNodeId,connectionHandleId:nq.connectionHandleId,connectionHandleType:nq.connectionHandleType,connectionStatus:nq.connectionStatus,connectionStartHandle:nq.connectionStartHandle,connectionEndHandle:nq.connectionEndHandle}),reset:()=>t({...nq})}),Object.is),nQ=({children:t})=>{let e=(0,m.useRef)(null);return!e.current&&(e.current=nJ()),m.createElement(e3,{value:e.current},t)};nQ.displayName="ReactFlowProvider";let n0=({children:t})=>(0,m.useContext)(e5)?m.createElement(m.Fragment,null,t):m.createElement(nQ,null,t);n0.displayName="ReactFlowWrapper";let n1={input:ru,default:rh,output:rp,group:rf},n2={default:iU,straight:iF,step:ij,smoothstep:iN,simplebezier:iR},n5=[0,0],n3=[15,15],n4={x:0,y:0,zoom:1},n6={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},n8=(0,m.forwardRef)(({nodes:t,edges:e,defaultNodes:i,defaultEdges:r,className:n,nodeTypes:s=n1,edgeTypes:a=n2,onNodeClick:o,onEdgeClick:l,onInit:h,onMove:f,onMoveStart:g,onMoveEnd:b,onConnect:y,onConnectStart:x,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:A,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:T,onNodeContextMenu:C,onNodeDoubleClick:k,onNodeDragStart:M,onNodeDrag:B,onNodeDragStop:P,onNodesDelete:R,onEdgesDelete:O,onSelectionChange:I,onSelectionDragStart:L,onSelectionDrag:D,onSelectionDragStop:N,onSelectionContextMenu:j,onSelectionStart:F,onSelectionEnd:z,connectionMode:H=d.Strict,connectionLineType:G=p.Bezier,connectionLineStyle:U,connectionLineComponent:V,connectionLineContainerStyle:W,deleteKeyCode:Z="Backspace",selectionKeyCode:$="Shift",selectionOnDrag:Y=!1,selectionMode:X=c.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:q=iE()?"Meta":"Control",zoomActivationKeyCode:J=iE()?"Meta":"Control",snapToGrid:Q=!1,snapGrid:tt=n3,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:ti=!0,nodesDraggable:tr,nodesConnectable:tn,nodesFocusable:ts,nodeOrigin:ta=n5,edgesFocusable:to,edgesUpdatable:tl,elementsSelectable:th,defaultViewport:td=n4,minZoom:tu=.5,maxZoom:tc=2,translateExtent:tp=nK,preventScrolling:tf=!0,nodeExtent:tg,defaultMarkerColor:tm="#b1b1b7",zoomOnScroll:tv=!0,zoomOnPinch:tb=!0,panOnScroll:ty=!1,panOnScrollSpeed:tx=.5,panOnScrollMode:t_=u.Free,zoomOnDoubleClick:tw=!0,panOnDrag:tA=!0,onPaneClick:tS,onPaneMouseEnter:tE,onPaneMouseMove:tT,onPaneMouseLeave:tC,onPaneScroll:tk,onPaneContextMenu:tM,children:tB,onEdgeContextMenu:tP,onEdgeDoubleClick:tR,onEdgeMouseEnter:tO,onEdgeMouseMove:tI,onEdgeMouseLeave:tL,onEdgeUpdate:tD,onEdgeUpdateStart:tN,onEdgeUpdateEnd:tj,onReconnect:tF,onReconnectStart:tz,onReconnectEnd:tH,reconnectRadius:tG=10,edgeUpdaterRadius:tU=10,onNodesChange:tV,onEdgesChange:tW,noDragClassName:tZ="nodrag",noWheelClassName:t$="nowheel",noPanClassName:tY="nopan",fitView:tX=!1,fitViewOptions:tK,connectOnClick:tq=!0,attributionPosition:tJ,proOptions:tQ,defaultEdgeOptions:t0,elevateNodesOnSelect:t1=!0,elevateEdgesOnSelect:t2=!1,disableKeyboardA11y:t5=!1,autoPanOnConnect:t3=!0,autoPanOnNodeDrag:t4=!0,connectionRadius:t6=20,isValidConnection:t8,onError:t7,style:t9,id:et,nodeDragThreshold:ee,...ei},er)=>{let en=et||"1";return m.createElement("div",{...ei,style:{...t9,...n6},ref:er,className:v(["react-flow",n]),"data-testid":"rf__wrapper",id:et},m.createElement(n0,null,m.createElement(nX,{onInit:h,onMove:f,onMoveStart:g,onMoveEnd:b,onNodeClick:o,onEdgeClick:l,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:T,onNodeContextMenu:C,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:a,connectionLineType:G,connectionLineStyle:U,connectionLineComponent:V,connectionLineContainerStyle:W,selectionKeyCode:$,selectionOnDrag:Y,selectionMode:X,deleteKeyCode:Z,multiSelectionKeyCode:q,panActivationKeyCode:K,zoomActivationKeyCode:J,onlyRenderVisibleElements:te,selectNodesOnDrag:ti,defaultViewport:td,translateExtent:tp,minZoom:tu,maxZoom:tc,preventScrolling:tf,zoomOnScroll:tv,zoomOnPinch:tb,zoomOnDoubleClick:tw,panOnScroll:ty,panOnScrollSpeed:tx,panOnScrollMode:t_,panOnDrag:tA,onPaneClick:tS,onPaneMouseEnter:tE,onPaneMouseMove:tT,onPaneMouseLeave:tC,onPaneScroll:tk,onPaneContextMenu:tM,onSelectionContextMenu:j,onSelectionStart:F,onSelectionEnd:z,onEdgeContextMenu:tP,onEdgeDoubleClick:tR,onEdgeMouseEnter:tO,onEdgeMouseMove:tI,onEdgeMouseLeave:tL,onReconnect:tF??tD,onReconnectStart:tz??tN,onReconnectEnd:tH??tj,reconnectRadius:tG??tU,defaultMarkerColor:tm,noDragClassName:tZ,noWheelClassName:t$,noPanClassName:tY,elevateEdgesOnSelect:t2,rfId:en,disableKeyboardA11y:t5,nodeOrigin:ta,nodeExtent:tg}),m.createElement(rS,{nodes:t,edges:e,defaultNodes:i,defaultEdges:r,onConnect:y,onConnectStart:x,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:A,nodesDraggable:tr,nodesConnectable:tn,nodesFocusable:ts,edgesFocusable:to,edgesUpdatable:tl,elementsSelectable:th,elevateNodesOnSelect:t1,minZoom:tu,maxZoom:tc,nodeExtent:tg,onNodesChange:tV,onEdgesChange:tW,snapToGrid:Q,snapGrid:tt,connectionMode:H,translateExtent:tp,connectOnClick:tq,defaultEdgeOptions:t0,fitView:tX,fitViewOptions:tK,onNodesDelete:R,onEdgesDelete:O,onNodeDragStart:M,onNodeDrag:B,onNodeDragStop:P,onSelectionDrag:D,onSelectionDragStart:L,onSelectionDragStop:N,noPanClassName:tY,nodeOrigin:ta,rfId:en,autoPanOnConnect:t3,autoPanOnNodeDrag:t4,onError:t7,connectionRadius:t6,isValidConnection:t8,nodeDragThreshold:ee}),m.createElement(rx,{onSelectionChange:I}),tB,m.createElement(ie,{proOptions:tQ,position:tJ}),m.createElement(rP,{rfId:en,disableKeyboardA11y:t5})))});n8.displayName="ReactFlow";let n7=t=>t.domNode?.querySelector(".react-flow__edgelabel-renderer");function n9({children:t}){let e=e8(n7);return e?(0,e2.createPortal)(t,e):null}function st(){let t=e7();return(0,m.useCallback)(e=>{let{domNode:i,updateNodeDimensions:r}=t.getState(),n=(Array.isArray(e)?e:[e]).reduce((t,e)=>{let r=i?.querySelector(`.react-flow__node[data-id="${e}"]`);return r&&t.push({id:e,nodeElement:r,forceUpdate:!0}),t},[]);requestAnimationFrame(()=>r(n))},[])}function se(t){return e=>{let[i,r]=(0,m.useState)(e),n=(0,m.useCallback)(e=>r(i=>t(e,i)),[]);return[i,r,n]}}se(r3),se(function(t,e){return r5(t,e)})},936010:function(t,e,i){"use strict";let r;i.d(e,{Me:function(){return iZ},Tu:function(){return iW}});var n={};n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var s=globalThis.pdfjsLib={};n.d(s,{AbortException:()=>D,AnnotationEditorLayer:()=>iU,AnnotationEditorParamsType:()=>c,AnnotationEditorType:()=>u,AnnotationEditorUIManager:()=>tM,AnnotationLayer:()=>iP,AnnotationMode:()=>d,CMapCompressionType:()=>y,ColorPicker:()=>iF,DOMSVGFactory:()=>tn,DrawLayer:()=>iV,FeatureTest:()=>z,GlobalWorkerOptions:()=>ee,ImageKind:()=>g,InvalidPDFException:()=>R,MissingPDFException:()=>O,OPS:()=>x,Outliner:()=>iI,PDFDataRangeTransport:()=>e$,PDFDateString:()=>tg,PDFWorker:()=>eJ,PasswordResponses:()=>_,PermissionFlag:()=>p,PixelsPerInch:()=>tt,RenderingCancelledException:()=>ta,TextLayer:()=>eD,UnexpectedResponseException:()=>I,Util:()=>G,VerbosityLevel:()=>b,XfaLayer:()=>e9,build:()=>e4,createValidAbsoluteUrl:()=>C,fetchData:()=>te,getDocument:()=>eV,getFilenameFromUrl:()=>th,getPdfFilenameFromUrl:()=>td,getXfaPageViewport:()=>tm,isDataScheme:()=>to,isPdfFile:()=>tl,noContextMenu:()=>tp,normalizeUnicode:()=>W,renderTextLayer:()=>eN,setLayerDimensions:()=>tx,shadow:()=>k,updateTextLayer:()=>ej,version:()=>e3});let a="object"==typeof process&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),o=[1,0,0,1,0,0],l=[.001,0,0,.001,0,0],h={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},d={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},u={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},c={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},p={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},f={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},g={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},m={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},v={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},b={ERRORS:0,WARNINGS:1,INFOS:5},y={NONE:0,BINARY:1},x={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},_={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},w=b.WARNINGS;function A(t){w>=b.INFOS&&console.log(`Info: ${t}`)}function S(t){w>=b.WARNINGS&&console.log(`Warning: ${t}`)}function E(t){throw Error(t)}function T(t,e){!t&&E(e)}function C(t,e=null,i=null){if(!t)return null;try{if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){let e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=function(t){return decodeURIComponent(escape(t))}(t)}catch{}}let r=e?new URL(t,e):new URL(t);if(function(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch{}return null}function k(t,e,i,r=!1){return Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}let M=function(){function t(e,i){this.constructor===t&&E("Cannot initialize BaseException."),this.message=e,this.name=i}return t.prototype=Error(),t.constructor=t,t}();class B extends M{constructor(t,e){super(t,"PasswordException"),this.code=e}}class P extends M{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class R extends M{constructor(t){super(t,"InvalidPDFException")}}class O extends M{constructor(t){super(t,"MissingPDFException")}}class I extends M{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class L extends M{constructor(t){super(t,"FormatError")}}class D extends M{constructor(t){super(t,"AbortException")}}function N(t){("object"!=typeof t||t?.length===void 0)&&E("Invalid argument for bytesToString");let e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);let i=[];for(let r=0;rt.toString(16).padStart(2,"0"));class G{static makeHexColor(t,e,i){return`#${H[t]}${H[e]}${H[i]}`}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){let i=t[0]*e[0]+t[1]*e[2]+e[4];return[i,t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){let i=e[0]*e[3]-e[1]*e[2],r=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i;return[r,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){let i=this.applyTransform(t,e),r=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),s=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],r[0],n[0],s[0]),Math.min(i[1],r[1],n[1],s[1]),Math.max(i[0],r[0],n[0],s[0]),Math.max(i[1],r[1],n[1],s[1])]}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){let e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],r=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],s=t[2]*e[1]+t[3]*e[3],a=(i+s)/2,o=Math.sqrt((i+s)**2-4*(i*s-n*r))/2;return[Math.sqrt(a+o||1),Math.sqrt(a-o||1)]}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),r=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>r)return null;let n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>s?null:[i,n,r,s]}static #t(t,e,i,r,n,s,a,o,l,h){if(l<=0||l>=1)return;let d=1-l,u=l*l,c=u*l,p=d*(d*(d*t+3*l*e)+3*u*i)+c*r,f=d*(d*(d*n+3*l*s)+3*u*a)+c*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],f),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],f)}static #e(t,e,i,r,n,s,a,o,l,h,d,u){if(1e-12>Math.abs(l)){Math.abs(h)>=1e-12&&this.#t(t,e,i,r,n,s,a,o,-d/h,u);return}let c=h**2-4*d*l;if(c<0)return;let p=Math.sqrt(c),f=2*l;this.#t(t,e,i,r,n,s,a,o,(-h+p)/f,u),this.#t(t,e,i,r,n,s,a,o,(-h-p)/f,u)}static bezierBoundingBox(t,e,i,r,n,s,a,o,l){return l?(l[0]=Math.min(l[0],t,a),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,a),l[3]=Math.max(l[3],e,o)):l=[Math.min(t,a),Math.min(e,o),Math.max(t,a),Math.max(e,o)],this.#e(t,i,n,a,e,r,s,o,3*(-t+3*(i-n)+a),6*(t-2*i+n),3*(i-t),l),this.#e(t,i,n,a,e,r,s,o,3*(-e+3*(r-s)+o),6*(e-2*r+s),3*(r-e),l),l}}let U=null,V=null;function W(t){return!U&&(U=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,V=new Map([["ſt","ſt"]])),t.replaceAll(U,(t,e,i)=>e?e.normalize("NFKC"):V.get(i))}let Z="pdfjs_internal_id_",$={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};class Y{constructor(){this.constructor===Y&&E("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,r,n){return"none"}destroy(t=!1){}}class X{constructor(){this.constructor===X&&E("Cannot initialize BaseCanvasFactory.")}create(t,e){if(t<=0||e<=0)throw Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d")}}reset(t,e,i){if(!t.canvas)throw Error("Canvas is not specified");if(e<=0||i<=0)throw Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){E("Abstract method `_createCanvas` called.")}}class K{constructor({baseUrl:t=null,isCompressed:e=!0}){this.constructor===K&&E("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw Error("CMap name must be specified.");let e=this.baseUrl+t+(this.isCompressed?".bcmap":""),i=this.isCompressed?y.BINARY:y.NONE;return this._fetchData(e,i).catch(t=>{throw Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}_fetchData(t,e){E("Abstract method `_fetchData` called.")}}class q{constructor({baseUrl:t=null}){this.constructor===q&&E("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw Error("Font filename must be specified.");let e=`${this.baseUrl}${t}`;return this._fetchData(e).catch(t=>{throw Error(`Unable to load font data at: ${e}`)})}_fetchData(t){E("Abstract method `_fetchData` called.")}}class J{constructor(){this.constructor===J&&E("Cannot initialize BaseSVGFactory.")}create(t,e,i=!1){if(t<=0||e<=0)throw Error("Invalid SVG dimensions");let r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),!i&&(r.setAttribute("width",`${t}px`),r.setAttribute("height",`${e}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${t} ${e}`),r}createElement(t){if("string"!=typeof t)throw Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){E("Abstract method `_createSVG` called.")}}let Q="http://www.w3.org/2000/svg";class tt{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function te(t,e="text"){if(tc(t,document.baseURI)){let i=await fetch(t);if(!i.ok)throw Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,r)=>{let n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(200===n.status||0===n.status){switch(e){case"arraybuffer":case"blob":case"json":i(n.response);return}i(n.responseText);return}r(Error(n.statusText))}},n.send(null)})}class ti extends K{_fetchData(t,e){return te(t,this.isCompressed?"arraybuffer":"text").then(t=>({cMapData:t instanceof ArrayBuffer?new Uint8Array(t):j(t),compressionType:e}))}}class tr extends q{_fetchData(t){return te(t,"arraybuffer").then(t=>new Uint8Array(t))}}class tn extends J{_createSVG(t){return document.createElementNS(Q,t)}}class ts{constructor({viewBox:t,scale:e,rotation:i,offsetX:r=0,offsetY:n=0,dontFlip:s=!1}){let a,o,l,h,d,u,c,p;this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=r,this.offsetY=n;let f=(t[2]+t[0])/2,g=(t[3]+t[1])/2;switch((i%=360)<0&&(i+=360),i){case 180:a=-1,o=0,l=0,h=1;break;case 90:a=0,o=1,l=1,h=0;break;case 270:a=0,o=-1,l=-1,h=0;break;case 0:a=1,o=0,l=0,h=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}s&&(l=-l,h=-h),0===a?(d=Math.abs(g-t[1])*e+r,u=Math.abs(f-t[0])*e+n,c=(t[3]-t[1])*e,p=(t[2]-t[0])*e):(d=Math.abs(f-t[0])*e+r,u=Math.abs(g-t[1])*e+n,c=(t[2]-t[0])*e,p=(t[3]-t[1])*e),this.transform=[a*e,o*e,l*e,h*e,d-a*e*f-l*e*g,u-o*e*f-h*e*g],this.width=c,this.height=p}get rawDims(){let{viewBox:t}=this;return k(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:r=this.offsetY,dontFlip:n=!1}={}){return new ts({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:r,dontFlip:n})}convertToViewportPoint(t,e){return G.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){let e=G.applyTransform([t[0],t[1]],this.transform),i=G.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return G.applyInverseTransform([t,e],this.transform)}}class ta extends M{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function to(t){let e=t.length,i=0;for(;i=1&&n<=12?n-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;let h=e[7]||"Z",d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===h?(a+=d,o+=u):"+"===h&&(a-=d,o-=u),new Date(Date.UTC(i,n,s,a,o,l))}}function tm(t,{scale:e=1,rotation:i=0}){let{width:r,height:n}=t.attributes.style;return new ts({viewBox:[0,0,parseInt(r),parseInt(n)],scale:e,rotation:i})}function tv(t){if(t.startsWith("#")){let e=parseInt(t.slice(1),16);return[(0xff0000&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(S(`Not a valid color format: "${t}"`),[0,0,0])}function tb(t){let{a:e,b:i,c:r,d:n,e:s,f:a}=t.getTransform();return[e,i,r,n,s,a]}function ty(t){let{a:e,b:i,c:r,d:n,e:s,f:a}=t.getTransform().invertSelf();return[e,i,r,n,s,a]}function tx(t,e,i=!1,r=!0){if(e instanceof ts){let{pageWidth:r,pageHeight:n}=e.rawDims,{style:s}=t,a=z.isCSSRoundSupported,o=`var(--scale-factor) * ${r}px`,l=`var(--scale-factor) * ${n}px`,h=a?`round(${o}, 1px)`:`calc(${o})`,d=a?`round(${l}, 1px)`:`calc(${l})`;i&&e.rotation%180!=0?(s.width=d,s.height=h):(s.width=h,s.height=d)}r&&t.setAttribute("data-main-rotation",e.rotation)}class t_{#i=null;#r=null;#n;#s=null;constructor(t){this.#n=t}render(){let t=this.#i=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",tp),t.addEventListener("pointerdown",t_.#a);let e=this.#s=document.createElement("div");e.className="buttons",t.append(e);let i=this.#n.toolbarPosition;if(i){let{style:e}=t,r="ltr"===this.#n._uiManager.direction?1-i[0]:i[0];e.insetInlineEnd=`${100*r}%`,e.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return this.#o(),t}static #a(t){t.stopPropagation()}#l(t){this.#n._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#h(t){this.#n._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#d(t){t.addEventListener("focusin",this.#l.bind(this),{capture:!0}),t.addEventListener("focusout",this.#h.bind(this),{capture:!0}),t.addEventListener("contextmenu",tp)}hide(){this.#i.classList.add("hidden"),this.#r?.hideDropdown()}show(){this.#i.classList.remove("hidden")}#o(){let t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#n.editorType}-button`),this.#d(t),t.addEventListener("click",t=>{this.#n._uiManager.delete()}),this.#s.append(t)}get #u(){let t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#d(t),this.#s.prepend(t,this.#u)}addColorPicker(t){this.#r=t;let e=t.renderButton();this.#d(e),this.#s.prepend(e,this.#u)}remove(){this.#i.remove(),this.#r?.destroy(),this.#r=null}}class tw{#s=null;#i=null;#c;constructor(t){this.#c=t}#p(){let t=this.#i=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",tp);let e=this.#s=document.createElement("div");return e.className="buttons",t.append(e),this.#f(),t}#g(t,e){let i=0,r=0;for(let n of t){let t=n.y+n.height;if(ti){r=s,i=t;continue}e?s>r&&(r=s):s{this.#c.highlightSelection("floating_button")}),this.#s.append(t)}}function tA(t,e,i){for(let r of i)e.addEventListener(r,t[r].bind(t))}class tS{#m=0;get id(){return`pdfjs_internal_editor_${this.#m++}`}}class tE{#v=(function(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();let t=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<32;e++)t[e]=Math.floor(255*Math.random());return N(t)})();#m=0;#b=null;static get _isSVGFittingCanvas(){let t=new OffscreenCanvas(1,3).getContext("2d"),e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,',k(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async #y(t,e){this.#b||=new Map;let i=this.#b.get(t);if(null===i)return null;if(i?.bitmap)return i.refCounter+=1,i;try{let t;if(i||={bitmap:null,id:`image_${this.#v}_${this.#m++}`,refCounter:0,isSvg:!1},"string"==typeof e?(i.url=e,t=await te(e,"blob")):t=i.file=e,"image/svg+xml"===t.type){let e=tE._isSVGFittingCanvas,r=new FileReader,n=new Image,s=new Promise((t,s)=>{n.onload=()=>{i.bitmap=n,i.isSvg=!0,t()},r.onload=async()=>{let t=i.svgUrl=r.result;n.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},n.onerror=r.onerror=s});r.readAsDataURL(t),await s}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(t){console.error(t),i=null}return this.#b.set(t,i),i&&this.#b.set(i.id,i),i}async getFromFile(t){let{lastModified:e,name:i,size:r,type:n}=t;return this.#y(`${e}_${i}_${r}_${n}`,t)}async getFromUrl(t){return this.#y(t,t)}async getFromId(t){this.#b||=new Map;let e=this.#b.get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){let e=this.#b.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#b||=new Map;let e=this.#b.get(t);if(!e)return;if(e.refCounter-=1,0===e.refCounter)e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#v}_`)}}class tT{#x=[];#_=!1;#w;#A=-1;constructor(t=128){this.#w=t}add({cmd:t,undo:e,post:i,mustExec:r,type:n=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}){if(r&&t(),this.#_)return;let o={cmd:t,undo:e,post:i,type:n};if(-1===this.#A){this.#x.length>0&&(this.#x.length=0),this.#A=0,this.#x.push(o);return}if(s&&this.#x[this.#A].type===n){a&&(o.undo=this.#x[this.#A].undo),this.#x[this.#A]=o;return}let l=this.#A+1;l===this.#w?this.#x.splice(0,1):(this.#A=l,lt===e[i]))return tk._colorsMapping.get(t);return e}getHexCode(t){let e=this._colors.get(t);return e?G.makeHexColor(...e):t}}class tM{#E=null;#T=new Map;#C=new Map;#k=null;#M=null;#B=null;#P=new tT;#R=0;#O=new Set;#I=null;#L=null;#D=new Set;#N=!1;#j=null;#F=null;#z=null;#H=!1;#G=null;#U=new tS;#V=!1;#W=!1;#Z=null;#$=null;#Y=null;#X=u.NONE;#K=new Set;#q=null;#J=null;#Q=null;#tt=this.blur.bind(this);#te=this.focus.bind(this);#ti=this.copy.bind(this);#tr=this.cut.bind(this);#tn=this.paste.bind(this);#ts=this.keydown.bind(this);#ta=this.keyup.bind(this);#to=this.onEditingAction.bind(this);#tl=this.onPageChanging.bind(this);#th=this.onScaleChanging.bind(this);#td=this.#tu.bind(this);#tc=this.onRotationChanging.bind(this);#tp={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#tf=[0,0];#tg=null;#tm=null;#tv=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=tM.prototype,e=t=>t.#tm.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,{target:e})=>{if(e instanceof HTMLInputElement){let{type:t}=e;return"text"!==t&&"number"!==t}return!0},r=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return k(this,"_keyboardManager",new tC([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#tm.contains(e)&&!t.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#tm.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}constructor(t,e,i,r,n,s,a,o,l){this.#tm=t,this.#tv=e,this.#k=i,this._eventBus=r,this._eventBus._on("editingaction",this.#to),this._eventBus._on("pagechanging",this.#tl),this._eventBus._on("scalechanging",this.#th),this._eventBus._on("rotationchanging",this.#tc),this.#tb(),this.#ty(),this.#M=n.annotationStorage,this.#j=n.filterFactory,this.#J=s,this.#z=a||null,this.#N=o,this.#Y=l||null,this.viewParameters={realScale:tt.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){for(let t of(this.#tx(),this.#t_(),this._eventBus._off("editingaction",this.#to),this._eventBus._off("pagechanging",this.#tl),this._eventBus._off("scalechanging",this.#th),this._eventBus._off("rotationchanging",this.#tc),this.#C.values()))t.destroy();this.#C.clear(),this.#T.clear(),this.#D.clear(),this.#E=null,this.#K.clear(),this.#P.destroy(),this.#k?.destroy(),this.#G?.hide(),this.#G=null,this.#F&&(clearTimeout(this.#F),this.#F=null),this.#tg&&(clearTimeout(this.#tg),this.#tg=null),this.#tw()}async mlGuess(t){return this.#Y?.guess(t)||null}get hasMLManager(){return!!this.#Y}get hcmFilter(){return k(this,"hcmFilter",this.#J?this.#j.addHCMFilter(this.#J.foreground,this.#J.background):"none")}get direction(){return k(this,"direction",getComputedStyle(this.#tm).direction)}get highlightColors(){return k(this,"highlightColors",this.#z?new Map(this.#z.split(",").map(t=>t.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return k(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#$=t}editAltText(t){this.#k?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#R=t-1}focusMainContainer(){this.#tm.focus()}findParent(t,e){for(let i of this.#C.values()){let{x:r,y:n,width:s,height:a}=i.div.getBoundingClientRect();if(t>=r&&t<=r+s&&e>=n&&e<=n+a)return i}return null}disableUserSelect(t=!1){this.#tv.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#D.add(t)}removeShouldRescale(t){this.#D.delete(t)}onScaleChanging({scale:t}){for(let e of(this.commitOrRemove(),this.viewParameters.realScale=t*tt.PDF_TO_CSS_UNITS,this.#D))e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#tA({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}highlightSelection(t=""){let e=document.getSelection();if(!e||e.isCollapsed)return;let{anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:s}=e,a=e.toString(),o=this.#tA(e).closest(".textLayer"),l=this.getSelectionBoxes(o);if(!!l){for(let h of(e.empty(),this.#X===u.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:u.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0)),this.#C.values()))if(h.hasTextLayer(o)){h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:l,anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:s,text:a});break}}}#tS(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=this.#tA(t).closest(".textLayer"),i=this.getSelectionBoxes(e);if(!!i)this.#G||=new tw(this),this.#G.show(e,i,"ltr"===this.direction)}addToAnnotationStorage(t){!t.isEmpty()&&this.#M&&!this.#M.has(t.id)&&this.#M.setValue(t.id,t)}#tu(){let t=document.getSelection();if(!t||t.isCollapsed){this.#q&&(this.#G?.hide(),this.#q=null,this.#tE({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===this.#q)return;if(!this.#tA(t).closest(".textLayer")){this.#q&&(this.#G?.hide(),this.#q=null,this.#tE({hasSelectedText:!1}));return}if(this.#G?.hide(),this.#q=e,this.#tE({hasSelectedText:!0}),this.#X===u.HIGHLIGHT||this.#X===u.NONE){if(this.#X===u.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#H=this.isShiftKeyDown,!this.isShiftKeyDown){let t=e=>{if("pointerup"!==e.type||0===e.button)window.removeEventListener("pointerup",t),window.removeEventListener("blur",t),"pointerup"===e.type&&this.#tT("main_toolbar")};window.addEventListener("pointerup",t),window.addEventListener("blur",t)}}}#tT(t=""){this.#X===u.HIGHLIGHT?this.highlightSelection(t):this.#N&&this.#tS()}#tb(){document.addEventListener("selectionchange",this.#td)}#tw(){document.removeEventListener("selectionchange",this.#td)}#tC(){window.addEventListener("focus",this.#te),window.addEventListener("blur",this.#tt)}#t_(){window.removeEventListener("focus",this.#te),window.removeEventListener("blur",this.#tt)}blur(){if(this.isShiftKeyDown=!1,this.#H&&(this.#H=!1,this.#tT("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#K)if(e.div.contains(t)){this.#Z=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#Z)return;let[t,e]=this.#Z;this.#Z=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus()}#ty(){window.addEventListener("keydown",this.#ts),window.addEventListener("keyup",this.#ta)}#tx(){window.removeEventListener("keydown",this.#ts),window.removeEventListener("keyup",this.#ta)}#tk(){document.addEventListener("copy",this.#ti),document.addEventListener("cut",this.#tr),document.addEventListener("paste",this.#tn)}#tM(){document.removeEventListener("copy",this.#ti),document.removeEventListener("cut",this.#tr),document.removeEventListener("paste",this.#tn)}addEditListeners(){this.#ty(),this.#tk()}removeEditListeners(){this.#tx(),this.#tM()}copy(t){if(t.preventDefault(),this.#E?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let t of this.#K){let i=t.serialize(!0);i&&e.push(i)}if(0!==e.length)t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();let{clipboardData:e}=t;for(let t of e.items)for(let e of this.#L)if(e.isHandlingMimeForPasting(t.type)){e.paste(t,this.currentLayer);return}let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(t){S(`paste: "${t.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();let r=this.currentLayer;try{let t=[];for(let e of i){let i=r.deserialize(e);if(!i)return;t.push(i)}this.addCommands({cmd:()=>{for(let e of t)this.#tB(e);this.#tP(t)},undo:()=>{for(let e of t)e.remove()},mustExec:!0})}catch(t){S(`paste: "${t.message}".`)}}keydown(t){!this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!0),this.#X!==u.NONE&&!this.isEditorHandlingKeyboard&&tM._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#H&&(this.#H=!1,this.#tT("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#tE(t){Object.entries(t).some(([t,e])=>this.#tp[t]!==e)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#tp,t)}),this.#X===u.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#tR([[c.HIGHLIGHT_FREE,!0]]))}#tR(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#tC(),this.#tk(),this.#tE({isEditing:this.#X!==u.NONE,isEmpty:this.#tO(),hasSomethingToUndo:this.#P.hasSomethingToUndo(),hasSomethingToRedo:this.#P.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#t_(),this.#tM(),this.#tE({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#L)for(let e of(this.#L=t,this.#L))this.#tR(e.defaultPropertiesToUpdate)}getId(){return this.#U.id}get currentLayer(){return this.#C.get(this.#R)}getLayer(t){return this.#C.get(t)}get currentPageIndex(){return this.#R}addLayer(t){this.#C.set(t.pageIndex,t),this.#V?t.enable():t.disable()}removeLayer(t){this.#C.delete(t.pageIndex)}updateMode(t,e=null,i=!1){if(this.#X===t)return;if(this.#X=t,t===u.NONE){this.setEditingState(!1),this.#tI();return}for(let e of(this.setEditingState(!0),this.#tL(),this.unselectAll(),this.#C.values()))e.updateMode(t);if(!e&&i){this.addNewEditorFromKeyboard();return}if(!!e){for(let t of this.#T.values())if(t.annotationElementId===e){this.setSelected(t),t.enterInEditMode();break}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){if(t!==this.#X)this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if(!!this.#L){switch(t){case c.CREATE:this.currentLayer.addNewEditor();return;case c.HIGHLIGHT_DEFAULT_COLOR:this.#$?.updateColor(e);break;case c.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#Q||=new Map).set(t,e),this.showAllEditors("highlight",e)}for(let i of this.#K)i.updateParams(t,e);for(let i of this.#L)i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let i of this.#T.values())i.editorType===t&&i.show(e);(this.#Q?.get(c.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#tR([[c.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#W!==t)for(let e of(this.#W=t,this.#C.values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}#tL(){if(!this.#V){for(let t of(this.#V=!0,this.#C.values()))t.enable();for(let t of this.#T.values())t.enable()}}#tI(){if(this.unselectAll(),this.#V){for(let t of(this.#V=!1,this.#C.values()))t.disable();for(let t of this.#T.values())t.disable()}}getEditors(t){let e=[];for(let i of this.#T.values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return this.#T.get(t)}addEditor(t){this.#T.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#F&&clearTimeout(this.#F),this.#F=setTimeout(()=>{this.focusMainContainer(),this.#F=null},0)),this.#T.delete(t.id),this.unselect(t),(!t.annotationElementId||!this.#O.has(t.annotationElementId))&&this.#M?.remove(t.id)}addDeletedAnnotationElement(t){this.#O.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#O.has(t)}removeDeletedAnnotationElement(t){this.#O.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#tB(t){let e=this.#C.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){if(this.#E!==t)this.#E=t,t&&this.#tR(t.propertiesToUpdate)}get #tD(){let t=null;for(t of this.#K);return t}updateUI(t){this.#tD===t&&this.#tR(t.propertiesToUpdate)}toggleSelected(t){if(this.#K.has(t)){this.#K.delete(t),t.unselect(),this.#tE({hasSelectedEditor:this.hasSelection});return}this.#K.add(t),t.select(),this.#tR(t.propertiesToUpdate),this.#tE({hasSelectedEditor:!0})}setSelected(t){for(let e of this.#K)e!==t&&e.unselect();this.#K.clear(),this.#K.add(t),t.select(),this.#tR(t.propertiesToUpdate),this.#tE({hasSelectedEditor:!0})}isSelected(t){return this.#K.has(t)}get firstSelectedEditor(){return this.#K.values().next().value}unselect(t){t.unselect(),this.#K.delete(t),this.#tE({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#K.size}get isEnterHandled(){return 1===this.#K.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#P.undo(),this.#tE({hasSomethingToUndo:this.#P.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#tO()})}redo(){this.#P.redo(),this.#tE({hasSomethingToUndo:!0,hasSomethingToRedo:this.#P.hasSomethingToRedo(),isEmpty:this.#tO()})}addCommands(t){this.#P.add(t),this.#tE({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#tO()})}#tO(){if(0===this.#T.size)return!0;if(1===this.#T.size)for(let t of this.#T.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let t=[...this.#K];this.addCommands({cmd:()=>{for(let e of t)e.remove()},undo:()=>{for(let e of t)this.#tB(e)},mustExec:!0})}commitOrRemove(){this.#E?.commitOrRemove()}hasSomethingToControl(){return this.#E||this.hasSelection}#tP(t){for(let t of this.#K)t.unselect();for(let e of(this.#K.clear(),t)){if(!e.isEmpty())this.#K.add(e),e.select()}this.#tE({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#K)t.commit();this.#tP(this.#T.values())}unselectAll(){if((!this.#E||(this.#E.commitOrRemove(),this.#X===u.NONE))&&!!this.hasSelection){for(let t of this.#K)t.unselect();this.#K.clear(),this.#tE({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(!i&&this.commitOrRemove(),!this.hasSelection)return;this.#tf[0]+=t,this.#tf[1]+=e;let[r,n]=this.#tf,s=[...this.#K];for(let i of(this.#tg&&clearTimeout(this.#tg),this.#tg=setTimeout(()=>{this.#tg=null,this.#tf[0]=this.#tf[1]=0,this.addCommands({cmd:()=>{for(let t of s)this.#T.has(t.id)&&t.translateInPage(r,n)},undo:()=>{for(let t of s)this.#T.has(t.id)&&t.translateInPage(-r,-n)},mustExec:!1})},1e3),s))i.translateInPage(t,e)}setUpDragSession(){if(!!this.hasSelection)for(let t of(this.disableUserSelect(!0),this.#I=new Map,this.#K))this.#I.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#I)return!1;this.disableUserSelect(!1);let t=this.#I;this.#I=null;let e=!1;for(let[{x:i,y:r,pageIndex:n},s]of t)s.newX=i,s.newY=r,s.newPageIndex=n,e||=i!==s.savedX||r!==s.savedY||n!==s.savedPageIndex;if(!e)return!1;let i=(t,e,i,r)=>{if(this.#T.has(t.id)){let n=this.#C.get(r);n?t._setParentAndPosition(n,e,i):(t.pageIndex=r,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(let[e,{newX:r,newY:n,newPageIndex:s}]of t)i(e,r,n,s)},undo:()=>{for(let[e,{savedX:r,savedY:n,savedPageIndex:s}]of t)i(e,r,n,s)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(!!this.#I)for(let i of this.#I.keys())i.drag(t,e)}rebuild(t){if(null===t.parent){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#K.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#E===t}getActive(){return this.#E}getMode(){return this.#X}get imageManager(){return k(this,"imageManager",new tE)}getSelectionBoxes(t){let e;if(!t)return null;let i=document.getSelection();for(let e=0,r=i.rangeCount;e({x:(e-n)/a,y:1-(t+i-r)/s,width:o/a,height:i/s});break;case"180":e=(t,e,i,o)=>({x:1-(t+i-r)/s,y:1-(e+o-n)/a,width:i/s,height:o/a});break;case"270":e=(t,e,i,o)=>({x:1-(e+o-n)/a,y:(t-r)/s,width:o/a,height:i/s});break;default:e=(t,e,i,o)=>({x:(t-r)/s,y:(e-n)/a,width:i/s,height:o/a})}let o=[];for(let t=0,r=i.rangeCount;tt.stopPropagation());let i=t=>{t.preventDefault(),this.#n._uiManager.editAltText(this.#n)};return t.addEventListener("click",i,{capture:!0}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#tG=!0,i(e))}),await this.#tU(),t}finish(){if(!!this.#tF)this.#tF.focus({focusVisible:this.#tG}),this.#tG=!1}isEmpty(){return!this.#tN&&!this.#tj}get data(){return{altText:this.#tN,decorative:this.#tj}}set data({altText:t,decorative:e}){if(this.#tN!==t||this.#tj!==e)this.#tN=t,this.#tj=e,this.#tU()}toggle(t=!1){if(!!this.#tF)!t&&this.#tH&&(clearTimeout(this.#tH),this.#tH=null),this.#tF.disabled=!t}destroy(){this.#tF?.remove(),this.#tF=null,this.#tz=null}async #tU(){let t=this.#tF;if(!t)return;if(!this.#tN&&!this.#tj){t.classList.remove("done"),this.#tz?.remove();return}t.classList.add("done"),tB._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(e=>{t.setAttribute("aria-label",e)});let e=this.#tz;if(!e){this.#tz=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip");let i=e.id=`alt-text-tooltip-${this.#n.id}`;t.setAttribute("aria-describedby",i);t.addEventListener("mouseenter",()=>{this.#tH=setTimeout(()=>{this.#tH=null,this.#tz.classList.add("show"),this.#n._reportTelemetry({action:"alt_text_tooltip"})},100)}),t.addEventListener("mouseleave",()=>{this.#tH&&(clearTimeout(this.#tH),this.#tH=null),this.#tz?.classList.remove("show")})}e.innerText=this.#tj?await tB._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#tN,!e.parentNode&&t.append(e);let i=this.#n.getImageForAltText();i?.setAttribute("aria-describedby",e.id)}}class tP{#tV=null;#tN=null;#tW=!1;#tZ=!1;#t$=null;#tY=null;#tX=this.focusin.bind(this);#tK=this.focusout.bind(this);#tq=null;#tJ="";#tQ=!1;#t0=null;#t1=!1;#t2=!1;#t5=!1;#t3=null;#t4=0;#t6=0;#t8=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#t7=!1;#t9=tP._zIndex++;static _borderLineWidth=-1;static _colorManager=new tk;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=tP.prototype._resizeWithKeyboard,e=tM.TRANSLATE_SMALL,i=tM.TRANSLATE_BIG;return k(this,"_resizerKeyboardManager",new tC([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],tP.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===tP&&E("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;let{rotation:e,rawDims:{pageWidth:i,pageHeight:r,pageX:n,pageY:s}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,r],this.pageTranslation=[n,s];let[a,o]=this.parentDimensions;this.x=t.x/a,this.y=t.y/o,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return k(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new tR({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e,i){if(tP._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(e=>[e,t.get(e.replaceAll(/([A-Z])/g,t=>`-${t.toLowerCase()}`))])),i?.strings)for(let e of i.strings)tP._l10nPromise.set(e,t.get(e));if(-1!==tP._borderLineWidth)return;let r=getComputedStyle(document.documentElement);tP._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){E("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#t7}set _isDraggable(t){this.#t7=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#t9}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#et(),this.parent=t}focusin(t){if(!!this._focusEventsAllowed)this.#tQ?this.#tQ=!1:this.parent.setSelected(this)}focusout(t){if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let e=t.relatedTarget;if(!e?.closest(`#${this.id}`))t.preventDefault(),!this.parent?.isMultipleSelection&&this.commitOrRemove()}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,r){let[n,s]=this.parentDimensions;[i,r]=this.screenToPageTranslation(i,r),this.x=(t+i)/n,this.y=(e+r)/s,this.fixAndSetPosition()}#ee([t,e],i,r){[i,r]=this.screenToPageTranslation(i,r),this.x+=i/t,this.y+=r/e,this.fixAndSetPosition()}translate(t,e){this.#ee(this.parentDimensions,t,e)}translateInPage(t,e){this.#t0||=[this.x,this.y],this.#ee(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){this.#t0||=[this.x,this.y];let[i,r]=this.parentDimensions;if(this.x+=t/i,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:s}=this,[a,o]=this.getBaseTranslation();n+=a,s+=o,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*s).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#t0&&(this.#t0[0]!==this.x||this.#t0[1]!==this.y)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=tP,r=i/t,n=i/e;switch(this.rotation){case 90:return[-r,n];case 180:return[r,n];case 270:return[r,-n];default:return[-r,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let[e,i]=this.pageDimensions,{x:r,y:n,width:s,height:a}=this;if(s*=e,a*=i,r*=e,n*=i,this._mustFixPosition)switch(t){case 0:r=Math.max(0,Math.min(e-s,r)),n=Math.max(0,Math.min(i-a,n));break;case 90:r=Math.max(0,Math.min(e-a,r)),n=Math.min(i,Math.max(s,n));break;case 180:r=Math.min(e,Math.max(s,r)),n=Math.min(i,Math.max(a,n));break;case 270:r=Math.min(e,Math.max(a,r)),n=Math.max(0,Math.min(i-s,n))}this.x=r/=e,this.y=n/=i;let[o,l]=this.getBaseTranslation();r+=o,n+=l;let{style:h}=this.div;h.left=`${(100*r).toFixed(2)}%`,h.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static #ei(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return tP.#ei(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return tP.#ei(t,e,360-this.parentRotation)}#er(t){switch(t){case 90:{let[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{let[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this,r=e*t,n=i*t;return z.isCSSRoundSupported?[Math.round(r),Math.round(n)]:[r,n]}setDims(t,e){let[i,r]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,!this.#tZ&&(this.div.style.height=`${(100*e/r).toFixed(2)}%`)}fixDims(){let{style:t}=this.div,{height:e,width:i}=t,r=i.endsWith("%"),n=!this.#tZ&&e.endsWith("%");if(r&&n)return;let[s,a]=this.parentDimensions;!r&&(t.width=`${(100*parseFloat(i)/s).toFixed(2)}%`),!this.#tZ&&!n&&(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#en(){if(!this.#t$){for(let t of(this.#t$=document.createElement("div"),this.#t$.classList.add("resizers"),this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"])){let e=document.createElement("div");this.#t$.append(e),e.classList.add("resizer",t),e.setAttribute("data-resizer-name",t),e.addEventListener("pointerdown",this.#es.bind(this,t)),e.addEventListener("contextmenu",tp),e.tabIndex=-1}this.div.prepend(this.#t$)}}#es(t,e){e.preventDefault();let{isMac:i}=z.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#tN?.toggle(!1);let r=this.#ea.bind(this,t),n=this._isDraggable;this._isDraggable=!1;let s={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",r,s),window.addEventListener("contextmenu",tp);let a=this.x,o=this.y,l=this.width,h=this.height,d=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let c=()=>{this.parent.togglePointerEvents(!0),this.#tN?.toggle(!0),this._isDraggable=n,window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),window.removeEventListener("pointermove",r,s),window.removeEventListener("contextmenu",tp),this.parent.div.style.cursor=d,this.div.style.cursor=u,this.#eo(a,o,l,h)};window.addEventListener("pointerup",c),window.addEventListener("blur",c)}#eo(t,e,i,r){let n=this.x,s=this.y,a=this.width,o=this.height;if(n!==t||s!==e||a!==i||o!==r)this.addCommands({cmd:()=>{this.width=a,this.height=o,this.x=n,this.y=s;let[t,e]=this.parentDimensions;this.setDims(t*a,e*o),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=r,this.x=t,this.y=e;let[n,s]=this.parentDimensions;this.setDims(n*i,s*r),this.fixAndSetPosition()},mustExec:!0})}#ea(t,e){let i,r,n,s;let[a,o]=this.parentDimensions,l=this.x,h=this.y,d=this.width,u=this.height,c=tP.MIN_SIZE/a,p=tP.MIN_SIZE/o,f=t=>Math.round(1e4*t)/1e4,g=this.#er(this.rotation),m=(t,e)=>[g[0]*t+g[2]*e,g[1]*t+g[3]*e],v=this.#er(360-this.rotation),b=!1,y=!1;switch(t){case"topLeft":b=!0,i=(t,e)=>[0,0],r=(t,e)=>[t,e];break;case"topMiddle":i=(t,e)=>[t/2,0],r=(t,e)=>[t/2,e];break;case"topRight":b=!0,i=(t,e)=>[t,0],r=(t,e)=>[0,e];break;case"middleRight":y=!0,i=(t,e)=>[t,e/2],r=(t,e)=>[0,e/2];break;case"bottomRight":b=!0,i=(t,e)=>[t,e],r=(t,e)=>[0,0];break;case"bottomMiddle":i=(t,e)=>[t/2,e],r=(t,e)=>[t/2,0];break;case"bottomLeft":b=!0,i=(t,e)=>[0,e],r=(t,e)=>[t,0];break;case"middleLeft":y=!0,i=(t,e)=>[0,e/2],r=(t,e)=>[t,e/2]}let x=i(d,u),_=r(d,u),w=m(..._),A=f(l+w[0]),S=f(h+w[1]),E=1,T=1,[C,k]=this.screenToPageTranslation(e.movementX,e.movementY);if([C,k]=(n=C/a,s=k/o,[v[0]*n+v[2]*s,v[1]*n+v[3]*s]),b){let t=Math.hypot(d,u);E=T=Math.max(Math.min(Math.hypot(_[0]-x[0]-C,_[1]-x[1]-k)/t,1/d,1/u),c/d,p/u)}else y?E=Math.max(c,Math.min(1,Math.abs(_[0]-x[0]-C)))/d:T=Math.max(p,Math.min(1,Math.abs(_[1]-x[1]-k)))/u;let M=f(d*E),B=f(u*T),P=A-(w=m(...r(M,B)))[0],R=S-w[1];this.width=M,this.height=B,this.x=P,this.y=R,this.setDims(a*M,o*B),this.fixAndSetPosition()}altTextFinish(){this.#tN?.finish()}async addEditToolbar(){return this.#tq||this.#t2?this.#tq:(this.#tq=new t_(this),this.div.append(this.#tq.render()),this.#tN&&this.#tq.addAltTextButton(await this.#tN.render()),this.#tq)}removeEditToolbar(){if(!!this.#tq)this.#tq.remove(),this.#tq=null,this.#tN?.destroy()}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){if(!this.#tN)tB.initialize(tP._l10nPromise),this.#tN=new tB(this),await this.addEditToolbar()}get altTextData(){return this.#tN?.data}set altTextData(t){if(!!this.#tN)this.#tN.data=t}hasAltText(){return!this.#tN?.isEmpty()}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#tW?-1:0,!this._isVisible&&this.div.classList.add("hidden"),this.setInForeground(),this.div.addEventListener("focusin",this.#tX),this.div.addEventListener("focusout",this.#tK);let[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);let[i,r]=this.getInitialTranslation();return this.translate(i,r),tA(this,this.div,["pointerdown"]),this.div}pointerdown(t){let{isMac:e}=z.platform;if(0!==t.button||t.ctrlKey&&e){t.preventDefault();return}if(this.#tQ=!0,this._isDraggable){this.#el(t);return}this.#eh(t)}#eh(t){let{isMac:e}=z.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#el(t){let e,i;let r=this._uiManager.isSelected(this);this._uiManager.setUpDragSession(),r&&(this.div.classList.add("moving"),e={passive:!0,capture:!0},this.#t4=t.clientX,this.#t6=t.clientY,i=t=>{let{clientX:e,clientY:i}=t,[r,n]=this.screenToPageTranslation(e-this.#t4,i-this.#t6);this.#t4=e,this.#t6=i,this._uiManager.dragSelectedEditors(r,n)},window.addEventListener("pointermove",i,e));let n=()=>{window.removeEventListener("pointerup",n),window.removeEventListener("blur",n),r&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",i,e)),this.#tQ=!1,!this._uiManager.endDragSession()&&this.#eh(t)};window.addEventListener("pointerup",n),window.addEventListener("blur",n)}moveInDOM(){this.#t3&&clearTimeout(this.#t3),this.#t3=setTimeout(()=>{this.#t3=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e,i=this.rotation){let r=this.parentScale,[n,s]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/r,h=e/r,d=this.x*n,u=this.y*s,c=this.width*n,p=this.height*s;switch(i){case 0:return[d+l+a,s-u-h-p+o,d+l+c+a,s-u-h+o];case 90:return[d+h+a,s-u+l+o,d+h+p+a,s-u+l+c+o];case 180:return[d-l-c+a,s-u+h+o,d-l+a,s-u+h+p+o];case 270:return[d-h-p+a,s-u-l-c+o,d-h+a,s-u-l+o];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,r,n,s]=t,a=n-i,o=s-r;switch(this.rotation){case 0:return[i,e-s,a,o];case 90:return[i,e-r,o,a];case 180:return[n,e-r,a,o];case 270:return[n,e-s,o,a];default:throw Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#t2=!0}disableEditMode(){this.#t2=!1}isInEditMode(){return this.#t2}shouldGetKeyboardEvents(){return this.#t5}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#tX),this.div?.addEventListener("focusout",this.#tK)}rotate(t){}serialize(t=!1,e=null){E("An editor must be serializable")}static deserialize(t,e,i){let r=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});r.rotation=t.rotation;let[n,s]=r.pageDimensions,[a,o,l,h]=r.getRectInCurrentCoords(t.rect,s);return r.x=a/n,r.y=o/s,r.width=l/n,r.height=h/s,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.div.removeEventListener("focusin",this.#tX),this.div.removeEventListener("focusout",this.#tK),!this.isEmpty()&&this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#t3&&(clearTimeout(this.#t3),this.#t3=null),this.#et(),this.removeEditToolbar(),this.#t8){for(let t of this.#t8.values())clearTimeout(t);this.#t8=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#en(),this.#t$.classList.remove("hidden"),tA(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#tY={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#t$.children;if(!this.#tV){this.#tV=Array.from(e);let t=this.#ed.bind(this),i=this.#eu.bind(this);for(let e of this.#tV){let r=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t),e.addEventListener("blur",i),e.addEventListener("focus",this.#ec.bind(this,r)),tP._l10nPromise.get(`pdfjs-editor-resizer-label-${r}`).then(t=>e.setAttribute("aria-label",t))}}let i=this.#tV[0],r=0;for(let t of e){if(t===i)break;r++}let n=(360-this.rotation+this.parentRotation)%360/90*(this.#tV.length/4);if(n!==r){if(nr)for(let t=0;ti.setAttribute("aria-label",t))}}this.#ep(0),this.#t5=!0,this.#t$.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#ed(t){tP._resizerKeyboardManager.exec(this,t)}#eu(t){this.#t5&&t.relatedTarget?.parentNode!==this.#t$&&this.#et()}#ec(t){this.#tJ=this.#t5?t:""}#ep(t){if(!!this.#tV)for(let e of this.#tV)e.tabIndex=t}_resizeWithKeyboard(t,e){if(!!this.#t5)this.#ea(this.#tJ,{movementX:t,movementY:e})}#et(){if(this.#t5=!1,this.#ep(-1),this.#tY){let{savedX:t,savedY:e,savedWidth:i,savedHeight:r}=this.#tY;this.#eo(t,e,i,r),this.#tY=null}}_stopResizingWithKeyboard(){this.#et(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#tq){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#tq?.show()});return}this.#tq?.show()}unselect(){this.#t$?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#tq?.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#t1}set isEditing(t){if(this.#t1=t,!!this.parent)t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}setAspectRatio(t,e){this.#tZ=!0;let{style:i}=this.div;i.aspectRatio=t/e,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){this.#t8||=new Map;let{action:e}=t,i=this.#t8.get(e);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),this.#t8.delete(e),0===this.#t8.size&&(this.#t8=null)},tP._telemetryTimeout),this.#t8.set(e,i);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#tW=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#tW=!0}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){let t=e;(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.before(e)}}else(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){let{firstChild:e}=t.container;"DIV"===e.nodeName&&e.classList.contains("annotationContent")&&e.remove()}}class tR extends tP{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}class tO{constructor(t){this.h1=t?0xffffffff&t:0xc3d2e1f0,this.h2=t?0xffffffff&t:0xc3d2e1f0}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let r=0,n=t.length;r>>8,e[i++]=255&n)}}else if(ArrayBuffer.isView(t))i=(e=t.slice()).byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let r=i>>2,n=i-4*r,s=new Uint32Array(e.buffer,0,r),a=0,o=0,l=this.h1,h=this.h2,d=11601,u=13715;for(let t=0;t>>17)&0xffff0000|a*u&65535,l=5*(l=l<<13|l>>>19)+0xe6546b64):(h^=o=0x1b873593*(o=(o=0xcc9e2d51*(o=s[t])&0xffff0000|o*d&65535)<<15|o>>>17)&0xffff0000|o*u&65535,h=5*(h=h<<13|h>>>19)+0xe6546b64);switch(a=0,n){case 3:a^=e[4*r+2]<<16;case 2:a^=e[4*r+1]<<8;case 1:a^=e[4*r],a=0x1b873593*(a=(a=0xcc9e2d51*a&0xffff0000|a*d&65535)<<15|a>>>17)&0xffff0000|a*u&65535,1&r?l^=a:h^=a}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,e=0xff51afd7*e&0xffff0000|((e<<16|(t=0xed558ccd*t&0xffff0000|36045*t&65535)>>>16)*0xafd7ed55&0xffff0000)>>>16,t^=e>>>1,e=0xc4ceb9fe*e&0xffff0000|((e<<16|(t=0x1a85ec53*t&0xffff0000|60499*t&65535)>>>16)*0xb9fe1a85&0xffff0000)>>>16,((t^=e>>>1)>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}let tI=Object.freeze({map:null,hash:"",transfer:void 0});class tL{#ef=!1;#eg=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){let i=this.#eg.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#eg.get(t)}remove(t){if(this.#eg.delete(t),0===this.#eg.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let t of this.#eg.values())if(t instanceof tP)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=this.#eg.get(t),r=!1;if(void 0!==i)for(let[t,n]of Object.entries(e))i[t]!==n&&(r=!0,i[t]=n);else r=!0,this.#eg.set(t,e);r&&this.#em(),e instanceof tP&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#eg.has(t)}getAll(){return this.#eg.size>0?F(this.#eg):null}setAll(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return this.#eg.size}#em(){!this.#ef&&(this.#ef=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#ef&&(this.#ef=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new tD(this)}get serializable(){if(0===this.#eg.size)return tI;let t=new Map,e=new tO,i=[],r=Object.create(null),n=!1;for(let[i,s]of this.#eg){let a=s instanceof tP?s.serialize(!1,r):s;a&&(t.set(i,a),e.update(`${i}:${JSON.stringify(a)}`),n||=!!a.bitmap)}if(n)for(let e of t.values())e.bitmap&&i.push(e.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:tI}get editorStats(){let t=null,e=new Map;for(let i of this.#eg.values()){if(!(i instanceof tP))continue;let r=i.telemetryFinalData;if(!r)continue;let{type:n}=r;!e.has(n)&&e.set(n,Object.getPrototypeOf(i).constructor),t||=Object.create(null);let s=t[n]||=new Map;for(let[t,e]of Object.entries(r)){if("type"===t)continue;let i=s.get(t);!i&&(i=new Map,s.set(t,i));let r=i.get(e)??0;i.set(e,r+1)}}for(let[i,r]of e)t[i]=r.computeTelemetryFinalData(t[i]);return t}}class tD extends tL{#ev;constructor(t){super();let{map:e,hash:i,transfer:r}=t.serializable,n=structuredClone(e,r?{transfer:r}:null);this.#ev={map:n,hash:i,transfer:r}}get print(){E("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#ev}}class tN{#eb=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){!this.styleElement&&(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#eb.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(!(!t||this.#eb.has(t.loadedName))){if(T(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:i,src:r,style:n}=t,s=new FontFace(i,r,n);this.addNativeFontFace(s);try{await s.load(),this.#eb.add(i),e?.(t)}catch{S(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(s)}return}E("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){let e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw S(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{let i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){return k(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let t=!1;return a?t=!0:"undefined"!=typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)&&(t=!0),k(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){let{loadingRequests:e}=this,i={done:!1,complete:function(){for(T(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;)setTimeout(e.shift().callback,0)},callback:t};return e.push(i),i}get _loadTestFont(){return k(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){var i;let r,n;function s(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function a(t,e,i,r){let n=t.substring(0,e);return n+r+t.substring(e+i)}let o=this._document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d"),h=0,d=`lt${Date.now()}${this.loadTestFontId++}`,u=this._loadTestFont;u=a(u,976,d.length,d);let c=s(u,16);for(r=0,n=d.length-3;r>24&255,i>>16&255,i>>8&255,255&i));let p=`url(data:font/opentype;base64,${btoa(u)});`,f=`@font-face {font-family:"${d}";src:${p}}`;this.insertRule(f);let g=this._document.createElement("div");for(let e of(g.style.visibility="hidden",g.style.width=g.style.height="10px",g.style.position="absolute",g.style.top=g.style.left="0px",[t.loadedName,d])){let t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,g.append(t)}this._document.body.append(g),!function t(e,i){if(++h>30){S("Load test font never loaded."),i();return}if(l.font="30px "+e,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){i();return}setTimeout(t.bind(null,e,i))}(d,()=>{g.remove(),e.complete()})}}class tj{constructor(t,{disableFontFace:e=!1,inspectFont:i=null}){for(let e in this.compiledGlyphs=Object.create(null),t)this[e]=t[e];this.disableFontFace=!0===e,this._inspectFont=i}createNativeFontFace(){let t;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),t}createFontFaceRule(){let t;if(!this.data||this.disableFontFace)return null;let e=N(this.data),i=`url(data:${this.mimetype};base64,${btoa(e)});`;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${i}}`}else t=`@font-face {font-family:"${this.loadedName}";src:${i}}`;return this._inspectFont?.(this,i),t}getPathGenerator(t,e){let i;if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];try{i=t.get(this.loadedName+"_path_"+e)}catch(t){S(`getPathGenerator - ignoring character: "${t}".`)}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(t,e){};let r=[];for(let t=0,e=i.length;tt.bezierCurveTo(e,n,s,a,o,l)),t+=6}break;case $.MOVE_TO:{let[e,n]=i.slice(t,t+2);r.push(t=>t.moveTo(e,n)),t+=2}break;case $.LINE_TO:{let[e,n]=i.slice(t,t+2);r.push(t=>t.lineTo(e,n)),t+=2}break;case $.QUADRATIC_CURVE_TO:{let[e,n,s,a]=i.slice(t,t+4);r.push(t=>t.quadraticCurveTo(e,n,s,a)),t+=4}break;case $.RESTORE:r.push(t=>t.restore());break;case $.SAVE:r.push(t=>t.save());break;case $.SCALE:T(2===r.length,"Scale command is only valid at the third position.");break;case $.TRANSFORM:{let[e,n,s,a,o,l]=i.slice(t,t+6);r.push(t=>t.transform(e,n,s,a,o,l)),t+=6}break;case $.TRANSLATE:{let[e,n]=i.slice(t,t+2);r.push(t=>t.translate(e,n)),t+=2}}return this.compiledGlyphs[e]=function(t,e){r[0](t),r[1](t),t.scale(e,-e);for(let e=2,i=r.length;e{let t,e;let i=await import("fs"),r=await import("http"),n=await import("https");return new Map(Object.entries({fs:i,http:r,https:n,url:await import("url"),canvas:t,path2d:e}))})().then(t=>{tz=t,tF.resolve()},t=>{S(`loadPackages: ${t}`),tz=new Map,tF.resolve()})}class tH{static get promise(){return tF.promise}static get(t){return tz?.get(t)}}let tG=function(t){return tH.get("fs").promises.readFile(t).then(t=>new Uint8Array(t))},tU={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function tV(t,e){if(!e)return;let i=e[2]-e[0],r=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],i,r),t.clip(n)}class tW{constructor(){this.constructor===tW&&E("Cannot initialize BaseShadingPattern.")}getPattern(){E("Abstract method `getPattern` called.")}}class tZ extends tW{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;for(let i of("axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1)),this._colorStops))e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,r){let n;if(r===tU.STROKE||r===tU.FILL){let s=e.current.getClippedPathBoundingBox(r,tb(t))||[0,0,0,0],a=Math.ceil(s[2]-s[0])||1,o=Math.ceil(s[3]-s[1])||1,l=e.cachedCanvases.getCanvas("pattern",a,o,!0),h=l.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-s[0],-s[1]),i=G.transform(i,[1,0,0,1,s[0],s[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),tV(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),n=t.createPattern(l.canvas,"no-repeat");let d=new DOMMatrix(i);n.setTransform(d)}else tV(t,this._bbox),n=this._createGradient(t);return n}}function t$(t,e,i,r,n,s,a,o){let l,h,d,u,c,p,f,g,m;let v=e.coords,b=e.colors,y=t.data,x=4*t.width;v[i+1]>v[r+1]&&(l=i,i=r,r=l,l=s,s=a,a=l),v[r+1]>v[n+1]&&(l=r,r=n,n=l,l=a,a=o,o=l),v[i+1]>v[r+1]&&(l=i,i=r,r=l,l=s,s=a,a=l);let _=(v[i]+e.offsetX)*e.scaleX,w=(v[i+1]+e.offsetY)*e.scaleY,A=(v[r]+e.offsetX)*e.scaleX,S=(v[r+1]+e.offsetY)*e.scaleY,E=(v[n]+e.offsetX)*e.scaleX,T=(v[n+1]+e.offsetY)*e.scaleY;if(w>=T)return;let C=b[s],k=b[s+1],M=b[s+2],B=b[a],P=b[a+1],R=b[a+2],O=b[o],I=b[o+1],L=b[o+2],D=Math.round(w),N=Math.round(T);for(let t=D;t<=N;t++){let e;if(tT?1:S===T?0:(S-t)/(S-T)),d=B-(B-O)*e,u=P-(P-I)*e,c=R-(R-L)*e}p=_-(_-E)*(e=tT?1:(w-t)/(w-T)),f=C-(C-O)*e,g=k-(k-I)*e,m=M-(M-L)*e;let i=Math.round(Math.min(h,p)),r=Math.round(Math.max(h,p)),n=x*t+4*i;for(let t=i;t<=r;t++)(e=(h-t)/(h-p))<0?e=0:e>1&&(e=1),y[n++]=d-(d-f)*e|0,y[n++]=u-(u-g)*e|0,y[n++]=c-(c-m)*e|0,y[n++]=255}}class tY extends tW{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,i){let r=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-r,a=Math.ceil(this._bounds[3])-n,o=Math.min(Math.ceil(Math.abs(s*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),h=s/o,d=a/l,u={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-n,scaleX:1/h,scaleY:1/d},c=o+4,p=l+4,f=i.getCanvas("mesh",c,p,!1),g=f.context,m=g.createImageData(o,l);if(e){let t=m.data;for(let i=0,r=t.length;i=r?n=r:i=n/t,{scale:i,size:n}}clipBbox(t,e,i,r,n){let s=r-e,a=n-i;t.ctx.rect(e,i,s,a),t.current.updateRectMinMax(tb(t.ctx),[e,i,r,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let r=t.ctx,n=t.current;switch(e){case tK.COLORED:let s=this.ctx;r.fillStyle=s.fillStyle,r.strokeStyle=s.strokeStyle,n.fillColor=s.fillStyle,n.strokeColor=s.strokeStyle;break;case tK.UNCOLORED:let a=G.makeHexColor(i[0],i[1],i[2]);r.fillStyle=a,r.strokeStyle=a,n.fillColor=a,n.strokeColor=a;break;default:throw new L(`Unsupported paint type: ${e}`)}}getPattern(t,e,i,r){let n=i;r!==tU.SHADING&&(n=G.transform(n,e.baseTransform),this.matrix&&(n=G.transform(n,this.matrix)));let s=this.createPatternCanvas(e),a=new DOMMatrix(n);a=(a=a.translate(s.offsetX,s.offsetY)).scale(1/s.scaleX,1/s.scaleY);let o=t.createPattern(s.canvas,"repeat");return o.setTransform(a),o}}class tJ{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let r;return void 0!==this.cache[t]?(r=this.cache[t],this.canvasFactory.reset(r,e,i)):(r=this.canvasFactory.create(e,i),this.cache[t]=r),r}delete(t){delete this.cache[t]}clear(){for(let t in this.cache){let e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function tQ(t,e,i,r,n,s,a,o,l,h){let[d,u,c,p,f,g]=tb(t);if(0===u&&0===c){let m=Math.round(a*d+f),v=Math.round(o*p+g),b=Math.abs(Math.round((a+l)*d+f)-m)||1,y=Math.abs(Math.round((o+h)*p+g)-v)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),m,v),t.drawImage(e,i,r,n,s,0,0,b,y),t.setTransform(d,u,c,p,f,g),[b,y]}if(0===d&&0===p){let m=Math.round(o*c+f),v=Math.round(a*u+g),b=Math.abs(Math.round((o+h)*c+f)-m)||1,y=Math.abs(Math.round((a+l)*u+g)-v)||1;return t.setTransform(0,Math.sign(u),Math.sign(c),0,m,v),t.drawImage(e,i,r,n,s,0,0,y,b),t.setTransform(d,u,c,p,f,g),[y,b]}return t.drawImage(e,i,r,n,s,a,o,l,h),[Math.hypot(d,u)*l,Math.hypot(c,p)*h]}class t0{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=o,this.textMatrixScale=1,this.fontMatrix=l,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=f.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,i){[e,i]=G.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){let i=G.applyTransform(e,t),r=G.applyTransform(e.slice(2),t),n=G.applyTransform([e[0],e[3]],t),s=G.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],r[0],n[0],s[0]),this.minY=Math.min(this.minY,i[1],r[1],n[1],s[1]),this.maxX=Math.max(this.maxX,i[0],r[0],n[0],s[0]),this.maxY=Math.max(this.maxY,i[1],r[1],n[1],s[1])}updateScalingPathMinMax(t,e){G.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,i,r,n,s,a,o,l,h){let d=G.bezierBoundingBox(e,i,r,n,s,a,o,l,h);if(!h)this.updateRectMinMax(t,d)}getPathBoundingBox(t=tU.FILL,e=null){let i=[this.minX,this.minY,this.maxX,this.maxY];if(t===tU.STROKE){!e&&E("Stroke bounding box must include transform.");let t=G.singularValueDecompose2dScale(e),r=t[0]*this.lineWidth/2,n=t[1]*this.lineWidth/2;i[0]-=r,i[1]-=n,i[2]+=r,i[3]+=n}return i}updateClipFromPath(){let t=G.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=tU.FILL,e=null){return G.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function t1(t,e){let i,r,n,s;if("undefined"!=typeof ImageData&&e instanceof ImageData){t.putImageData(e,0,0);return}let a=e.height,o=e.width,l=a%16,h=(a-l)/16,d=0===l?h:h+1,u=t.createImageData(o,16),c=0,p,f=e.data,m=u.data;if(e.kind===g.GRAYSCALE_1BPP){let e=f.byteLength,s=new Uint32Array(m.buffer,0,m.byteLength>>2),a=s.length,g=o+7>>3,v=z.isLittleEndian?0xff000000:255;for(i=0;ig?o:8*t-7,n=-8&r,a=0,l=0;for(;i>=1}for(;p=h&&(s=o*(n=l)),p=0,r=s;r--;)m[p++]=f[c++],m[p++]=f[c++],m[p++]=f[c++],m[p++]=255;t.putImageData(u,0,16*i)}else throw Error(`bad image kind: ${e.kind}`)}function t2(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}let i=e.height,r=e.width,n=i%16,s=(i-n)/16,a=0===n?s:s+1,o=t.createImageData(r,16),l=0,h=e.data,d=o.data;for(let e=0;e>3,u=7&r,c=t.length;i=new Uint32Array(i.buffer);let p=0;for(let r=0;r10&&"function"==typeof i,d=h?Date.now()+15:0,u=0,c=this.commonObjs,p=this.objs;for(;;){if(void 0!==r&&o===r.nextBreakPoint)return r.breakIt(o,i),o;if((n=a[o])!==x.dependency)this[n].apply(this,s[o]);else for(let t of s[o]){let e=t.startsWith("g_")?c:p;if(!e.has(t))return e.get(t,i),o}if(++o===l)return o;if(h&&++u>10){if(Date.now()>d)return i(),o;u=0}}}#ey(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){for(let t of(this.#ey(),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#ex()}#ex(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){let i,r;let n=t.width,s=t.height,a=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=n,h=s,d="prescale1";for(;a>2&&l>1||o>2&&h>1;){let e=l,n=h;a>2&&l>1&&(e=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),a/=l/e),o>2&&h>1&&(n=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/n),(r=(i=this.cachedCanvases.getCanvas(d,e,n)).context).clearRect(0,0,e,n),r.drawImage(t,0,0,l,h,0,0,e,n),t=i.canvas,l=e,h=n,d="prescale1"===d?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t){let e,i,r,n;let s=this.ctx,{width:a,height:o}=t,l=this.current.fillColor,h=this.current.patternFill,d=tb(s);if((t.bitmap||t.data)&&t.count>1){let n=t.bitmap||t.data.buffer;i=JSON.stringify(h?d:[d.slice(0,4),l]),!(e=this._cachedBitmapsMap.get(n))&&(e=new Map,this._cachedBitmapsMap.set(n,e));let s=e.get(i);if(s&&!h){let t=Math.round(Math.min(d[0],d[2])+d[4]);return{canvas:s,offsetX:t,offsetY:Math.round(Math.min(d[1],d[3])+d[5])}}r=s}!r&&t2((n=this.cachedCanvases.getCanvas("maskCanvas",a,o)).context,t);let u=G.transform(d,[1/a,0,0,-1/o,0,0]);u=G.transform(u,[1,0,0,1,0,-o]);let[c,p,f,g]=G.getAxialAlignedBoundingBox([0,0,a,o],u),m=Math.round(f-c)||1,v=Math.round(g-p)||1,b=this.cachedCanvases.getCanvas("fillCanvas",m,v),y=b.context;y.translate(-c,-p),y.transform(...u),!r&&(r=(r=this._scaleImage(n.canvas,ty(y))).img,e&&h&&e.set(i,r)),y.imageSmoothingEnabled=t4(tb(y),t.interpolate),tQ(y,r,0,0,r.width,r.height,0,0,a,o),y.globalCompositeOperation="source-in";let x=G.transform(ty(y),[1,0,0,1,-c,-p]);return y.fillStyle=h?l.getPattern(s,this,x,tU.FILL):l,y.fillRect(0,0,a,o),e&&!h&&(this.cachedCanvases.delete("fillCanvas"),e.set(i,b.canvas)),{canvas:b.canvas,offsetX:Math.round(c),offsetY:Math.round(p)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=t6[t]}setLineJoin(t){this.ctx.lineJoin=t8[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){let i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(let[e,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let t=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=r.context;let n=this.ctx;n.setTransform(...tb(this.suspendedCtx)),t5(this.suspendedCtx,n),!function(t,e){if(t._removeMirroring)throw Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,r,n,s,a){e.transform(t,i,r,n,s,a),this.__originalTransform(t,i,r,n,s,a)},t.setTransform=function(t,i,r,n,s,a){e.setTransform(t,i,r,n,s,a),this.__originalSetTransform(t,i,r,n,s,a)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,r,n,s,a){e.bezierCurveTo(t,i,r,n,s,a),this.__originalBezierCurveTo(t,i,r,n,s,a)},t.rect=function(t,i,r,n){e.rect(t,i,r,n),this.__originalRect(t,i,r,n)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),t5(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,r){let n=r[0],s=r[1],a=r[2]-n,o=r[3]-s;if(0!==a&&0!==o)this.genericComposeSMask(e.context,i,a,o,e.subtype,e.backdrop,e.transferMap,n,s,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore()}genericComposeSMask(t,e,i,r,n,s,a,o,l,h,d){let u=t.canvas,c=o-h,p=l-d;if(s){if(c<0||p<0||c+i>u.width||p+r>u.height){let t=this.cachedCanvases.getCanvas("maskExtension",i,r),e=t.context;e.drawImage(u,-c,-p),s.some(t=>0!==t)&&(e.globalCompositeOperation="destination-atop",e.fillStyle=G.makeHexColor(...s),e.fillRect(0,0,i,r),e.globalCompositeOperation="source-over"),u=t.canvas,c=p=0}else if(s.some(t=>0!==t)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let e=new Path2D;e.rect(c,p,i,r),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=G.makeHexColor(...s),t.fillRect(c,p,i,r),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===n&&a?e.filter=this.filterFactory.addAlphaFilter(a):"Luminosity"===n&&(e.filter=this.filterFactory.addLuminosityFilter(a));let f=new Path2D;f.rect(o,l,i,r),e.clip(f),e.globalCompositeOperation="destination-in",e.drawImage(u,c,p,i,r,o,l,i,r),e.restore()}save(){this.inSMaskMode?(t5(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),t5(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,r,n,s){this.ctx.transform(t,e,i,r,n,s),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){let r,n;let s=this.ctx,a=this.current,o=a.x,l=a.y,h=tb(s),d=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],u=d?i.slice(0):null;for(let i=0,c=0,p=t.length;i100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font=`${o} ${a} ${h}px ${s}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,r,n,s){this.current.textMatrix=[t,e,i,r,n,s],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,r){let n;let s=this.ctx,a=this.current,o=a.font,l=a.textRenderingMode,h=a.fontSize/a.fontSizeScale,d=l&f.FILL_STROKE_MASK,u=!!(l&f.ADD_TO_PATH_FLAG),c=a.patternFill&&!o.missingFile;(o.disableFontFace||u||c)&&(n=o.getPathGenerator(this.commonObjs,t)),o.disableFontFace||c?(s.save(),s.translate(e,i),s.beginPath(),n(s,h),r&&s.setTransform(...r),(d===f.FILL||d===f.FILL_STROKE)&&s.fill(),(d===f.STROKE||d===f.FILL_STROKE)&&s.stroke(),s.restore()):((d===f.FILL||d===f.FILL_STROKE)&&s.fillText(t,e,i),(d===f.STROKE||d===f.FILL_STROKE)&&s.strokeText(t,e,i)),u&&(this.pendingTextPaths||=[]).push({transform:tb(s),x:e,y:i,fontSize:h,addToPath:n})}get isFontSubpixelAAEnabled(){let{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);let e=t.getImageData(0,0,10,10).data,i=!1;for(let t=3;t0&&e[t]<255){i=!0;break}return k(this,"isFontSubpixelAAEnabled",i)}showText(t){let e;let i=this.current,r=i.font;if(r.isType3Font)return this.showType3Text(t);let n=i.fontSize;if(0===n)return;let s=this.ctx,a=i.fontSizeScale,o=i.charSpacing,l=i.wordSpacing,h=i.fontDirection,d=i.textHScale*h,u=t.length,c=r.vertical,p=c?1:-1,g=r.defaultVMetrics,m=n*i.fontMatrix[0],v=i.textRenderingMode===f.FILL&&!r.disableFontFace&&!i.patternFill;if(s.save(),s.transform(...i.textMatrix),s.translate(i.x,i.y+i.textRise),h>0?s.scale(d,-1):s.scale(d,1),i.patternFill){s.save();let t=i.fillColor.getPattern(s,this,ty(s),tU.FILL);e=tb(s),s.restore(),s.fillStyle=t}let b=i.lineWidth,y=i.textMatrixScale;if(0===y||0===b){let t=i.textRenderingMode&f.FILL_STROKE_MASK;(t===f.STROKE||t===f.FILL_STROKE)&&(b=this.getSinglePixelWidth())}else b/=y;if(1!==a&&(s.scale(a,a),b/=a),s.lineWidth=b,r.isInvalidPDFjsFont){let e=[],r=0;for(let i of t)e.push(i.unicode),r+=i.width;s.fillText(e.join(""),0,0),i.x+=r*m*d,s.restore(),this.compose();return}let x=0,_;for(_=0;_0){let t=1e3*s.measureText(y).width/n*a;if(Anew et(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},r)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){let r=G.makeHexColor(t,e,i);this.ctx.strokeStyle=r,this.current.strokeColor=r}setFillRGBColor(t,e,i){let r=G.makeHexColor(t,e,i);this.ctx.fillStyle=r,this.current.fillColor=r,this.current.patternFill=!1}_getPattern(t,e=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=function(t){switch(t[0]){case"RadialAxial":return new tZ(t);case"Mesh":return new tY(t);case"Dummy":return new tX}throw Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t)),this.cachedPatterns.set(t,i)),e&&(i.matrix=e),i}shadingFill(t){if(!this.contentVisible)return;let e=this.ctx;this.save();let i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,ty(e),tU.SHADING);let r=ty(e);if(r){let{width:t,height:i}=e.canvas,[n,s,a,o]=G.getAxialAlignedBoundingBox([0,0,t,i],r);this.ctx.fillRect(n,s,a-n,o-s)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){E("Should not call beginInlineImage")}beginImageData(){E("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(!!this.contentVisible){if(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=tb(this.ctx),e){let t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax(tb(this.ctx),e),this.clip(),this.endPath()}}}paintFormXObjectEnd(){if(!!this.contentVisible)this.restore(),this.baseTransform=this.baseTransformStack.pop()}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let e=this.ctx;!t.isolated&&A("TODO: Support non-isolated groups."),t.knockout&&S("Knockout groups not supported.");let i=tb(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw Error("Bounding box is required.");let r=G.getAxialAlignedBoundingBox(t.bbox,tb(e)),n=[0,0,e.canvas.width,e.canvas.height],s=Math.floor((r=G.intersect(r,n)||[0,0,0,0])[0]),a=Math.floor(r[1]),o=Math.max(Math.ceil(r[2])-s,1),l=Math.max(Math.ceil(r[3])-a,1);this.current.startNewPathAndClipBox([0,0,o,l]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);let d=this.cachedCanvases.getCanvas(h,o,l),u=d.context;u.translate(-s,-a),u.transform(...i),t.smask?this.smaskStack.push({canvas:d.canvas,context:u,offsetX:s,offsetY:a,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(s,a),e.save()),t5(e,u),this.ctx=u,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;let e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let t=tb(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);let i=G.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,r,n){if(this.#ey(),t3(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){let r=e[2]-e[0],s=e[3]-e[1];if(n&&this.annotationCanvasMap){i=i.slice(),i[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=r,e[3]=s;let[n,a]=G.singularValueDecompose2dScale(tb(this.ctx)),{viewportScale:o}=this,l=Math.ceil(r*this.outputScaleX*o),h=Math.ceil(s*this.outputScaleY*o);this.annotationCanvas=this.canvasFactory.create(l,h);let{canvas:d,context:u}=this.annotationCanvas;this.annotationCanvasMap.set(t,d),this.annotationCanvas.savedCtx=this.ctx,this.ctx=u,this.ctx.save(),this.ctx.setTransform(n,0,0,-a,0,s*a),t3(this.ctx)}else t3(this.ctx),this.ctx.rect(e[0],e[1],r,s),this.ctx.clip(),this.endPath()}this.current=new t0(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...r)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#ex(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;let e=t.count;(t=this.getObject(t.data,t)).count=e;let i=this.ctx,r=this.processingType3;if(r&&(void 0===r.compiled&&(r.compiled=function(t){let e,i,r;let{width:n,height:s}=t;if(n>1e3||s>1e3)return null;let a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),o=n+1,l=new Uint8Array(o*(s+1)),h=n+7&-8,d=new Uint8Array(h*s),u=0;for(let e of t.data){let t=128;for(;t>0;)d[u++]=e&t?0:255,t>>=1}let c=0;for(0!==d[u=0]&&(l[0]=1,++c),i=1;i>2)+(d[u+1]?4:0)+(d[u-h+1]?8:0)]&&(l[r+i]=a[t],++c),u++;if(d[u-h]!==d[u]&&(l[r+i]=d[u]?2:4,++c),c>1e3)return null}for(u=h*(s-1),r=e*o,0!==d[u]&&(l[r]=8,++c),i=1;i1e3)return null;let p=new Int32Array([0,o,-1,0,-o,0,0,0,1]),f=new Path2D;for(e=0;c&&e<=s;e++){let t=e*o,i=t+n;for(;t>4,l[t]&=s>>2|s<<2),f.lineTo(t%o,t/o|0),!l[t]&&--c}while(r!==t);--e}return d=null,l=null,function(t){t.save(),t.scale(1/n,-1/s),t.translate(0,-s),t.fill(f),t.beginPath(),t.restore()}}(t)),r.compiled)){r.compiled(i);return}let n=this._createMaskCanvas(t),s=n.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(s,n.offsetX,n.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i=0,r=0,n,s){if(!this.contentVisible)return;t=this.getObject(t.data,t);let a=this.ctx;a.save();let o=tb(a);a.transform(e,i,r,n,0,0);let l=this._createMaskCanvas(t);a.setTransform(1,0,0,1,l.offsetX-o[4],l.offsetY-o[5]);for(let t=0,h=s.length;tr?h/r:1,e=l>r?l/r:1}}this._cachedScaleForStroking[0]=t,this._cachedScaleForStroking[1]=e}return this._cachedScaleForStroking}rescaleAndStroke(t){let{ctx:e}=this,{lineWidth:i}=this.current,[r,n]=this.getScaleForStroking();if(e.lineWidth=i||1,1===r&&1===n){e.stroke();return}let s=e.getLineDash();if(t&&e.save(),e.scale(r,n),s.length>0){let t=Math.max(r,n);e.setLineDash(s.map(e=>e/t)),e.lineDashOffset/=t}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(let t in x)void 0!==et.prototype[t]&&(et.prototype[x[t]]=et.prototype[t]);class ee{static #e_=null;static #ew="";static get workerPort(){return this.#e_}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");this.#e_=t}static get workerSrc(){return this.#ew}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");this.#ew=t}}let ei={DATA:1,ERROR:2},er={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function en(t){switch(!(t instanceof Error||"object"==typeof t&&null!==t)&&E('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new D(t.message);case"MissingPDFException":return new O(t.message);case"PasswordException":return new B(t.message,t.code);case"UnexpectedResponseException":return new I(t.message,t.status);case"UnknownErrorException":return new P(t.message,t.details);default:return new P(t.message,t.toString())}}class es{constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=t=>{let e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream){this.#eA(e);return}if(e.callback){let t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===ei.DATA)i.resolve(e.data);else if(e.callback===ei.ERROR)i.reject(en(e.reason));else throw Error("Unexpected callback case");return}let r=this.actionHandler[e.action];if(!r)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let t=this.sourceName,n=e.sourceName;new Promise(function(t){t(r(e.data))}).then(function(r){i.postMessage({sourceName:t,targetName:n,callback:ei.DATA,callbackId:e.callbackId,data:r})},function(r){i.postMessage({sourceName:t,targetName:n,callback:ei.ERROR,callbackId:e.callbackId,reason:en(r)})});return}if(e.streamId){this.#eS(e);return}r(e.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){let i=this.actionHandler;if(i[t])throw Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){let r=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[r]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:r,data:e},i)}catch(t){n.reject(t)}return n.promise}sendWithStream(t,e,i,r){let n=this.streamId++,s=this.sourceName,a=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{let l=Promise.withResolvers();return this.streamControllers[n]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:s,targetName:a,action:t,streamId:n,data:e,desiredSize:i.desiredSize},r),l.promise},pull:t=>{let e=Promise.withResolvers();return this.streamControllers[n].pullCall=e,o.postMessage({sourceName:s,targetName:a,stream:er.PULL,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{T(t instanceof Error,"cancel must have a valid reason");let e=Promise.withResolvers();return this.streamControllers[n].cancelCall=e,this.streamControllers[n].isClosed=!0,o.postMessage({sourceName:s,targetName:a,stream:er.CANCEL,streamId:n,reason:en(t)}),e.promise}},i)}#eS(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,n=this.comObj,s=this,a=this.actionHandler[t.action],o={enqueue(t,s=1,a){if(this.isCancelled)return;let o=this.desiredSize;this.desiredSize-=s,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:r,stream:er.ENQUEUE,streamId:e,chunk:t},a)},close(){if(!this.isCancelled)this.isCancelled=!0,n.postMessage({sourceName:i,targetName:r,stream:er.CLOSE,streamId:e}),delete s.streamSinks[e]},error(t){if(T(t instanceof Error,"error must have a valid reason"),!this.isCancelled)this.isCancelled=!0,n.postMessage({sourceName:i,targetName:r,stream:er.ERROR,streamId:e,reason:en(t)})},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,new Promise(function(e){e(a(t.data,o))}).then(function(){n.postMessage({sourceName:i,targetName:r,stream:er.START_COMPLETE,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:er.START_COMPLETE,streamId:e,reason:en(t)})})}#eA(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,n=this.comObj,s=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case er.START_COMPLETE:t.success?s.startCall.resolve():s.startCall.reject(en(t.reason));break;case er.PULL_COMPLETE:t.success?s.pullCall.resolve():s.pullCall.reject(en(t.reason));break;case er.PULL:if(!a){n.postMessage({sourceName:i,targetName:r,stream:er.PULL_COMPLETE,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,new Promise(function(t){t(a.onPull?.())}).then(function(){n.postMessage({sourceName:i,targetName:r,stream:er.PULL_COMPLETE,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:er.PULL_COMPLETE,streamId:e,reason:en(t)})});break;case er.ENQUEUE:if(T(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(t.chunk);break;case er.CLOSE:if(T(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),this.#eE(s,e);break;case er.ERROR:T(s,"error should have stream controller"),s.controller.error(en(t.reason)),this.#eE(s,e);break;case er.CANCEL_COMPLETE:t.success?s.cancelCall.resolve():s.cancelCall.reject(en(t.reason)),this.#eE(s,e);break;case er.CANCEL:if(!a)break;new Promise(function(e){e(a.onCancel?.(en(t.reason)))}).then(function(){n.postMessage({sourceName:i,targetName:r,stream:er.CANCEL_COMPLETE,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:er.CANCEL_COMPLETE,streamId:e,reason:en(t)})}),a.sinkCapability.reject(en(t.reason)),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async #eE(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class ea{#eT;#eC;constructor({parsedData:t,rawData:e}){this.#eT=t,this.#eC=e}getRaw(){return this.#eC}get(t){return this.#eT.get(t)??null}getAll(){return F(this.#eT)}has(t){return this.#eT.has(t)}}let eo=Symbol("INTERNAL");class el{#ek=!1;#eM=!1;#eB=!1;#eP=!0;constructor(t,{name:e,intent:i,usage:r}){this.#ek=!!(t&h.DISPLAY),this.#eM=!!(t&h.PRINT),this.name=e,this.intent=i,this.usage=r}get visible(){if(this.#eB)return this.#eP;if(!this.#eP)return!1;let{print:t,view:e}=this.usage;return this.#ek?e?.viewState!=="OFF":!this.#eM||t?.printState!=="OFF"}_setVisible(t,e,i=!1){t!==eo&&E("Internal method `_setVisible` called."),this.#eB=i,this.#eP=e}}class eh{#eR=null;#eO=new Map;#eI=null;#eL=null;constructor(t,e=h.DISPLAY){if(this.renderingIntent=e,this.name=null,this.creator=null,null===t)return;for(let i of(this.name=t.name,this.creator=t.creator,this.#eL=t.order,t.groups))this.#eO.set(i.id,new el(e,i));if("OFF"===t.baseState)for(let t of this.#eO.values())t._setVisible(eo,!1);for(let e of t.on)this.#eO.get(e)._setVisible(eo,!0);for(let e of t.off)this.#eO.get(e)._setVisible(eo,!1);this.#eI=this.getHash()}#eD(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let r=1;r0?F(this.#eO):null}getGroup(t){return this.#eO.get(t)||null}getHash(){if(null!==this.#eR)return this.#eR;let t=new tO;for(let[e,i]of this.#eO)t.update(`${e}:${i.visible}`);return this.#eR=t.hexdigest()}}class ed{constructor(t,{disableRange:e=!1,disableStream:i=!1}){T(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:r,initialData:n,progressiveDone:s,contentDispositionFilename:a}=t;if(this._queuedChunks=[],this._progressiveDone=s,this._contentDispositionFilename=a,n?.length>0){let t=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=r,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){let i=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;void 0===t?this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i):T(this._rangeReaders.some(function(e){return e._begin===t&&(e._enqueue(i),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){void 0===t.total?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){let e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){T(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let t=this._queuedChunks;return this._queuedChunks=null,new eu(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new ec(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeReaders.slice(0)))e.cancel(t);this._pdfDataRangeTransport.abort()}}class eu{constructor(t,e,i=!1,r=null){for(let n of(this._stream=t,this._done=i||!1,this._filename=tl(r)?r:null,this._queuedChunks=e||[],this._loaded=0,this._queuedChunks))this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done)this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){if(!this._done)this._done=!0}}class ec{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{for(let e of(this._requests.shift().resolve({value:t,done:!1}),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function ep({getResponseHeader:t,isHttp:e,rangeChunkSize:i,disableRange:r}){let n={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(t("Content-Length"),10);return Number.isInteger(s)?(n.suggestedLength=s,s<=2*i||r||!e||"bytes"!==t("Accept-Ranges")||"identity"!==(t("Content-Encoding")||"identity"))?n:(n.allowRangeRequests=!0,n):n}function ef(t){let e=t("Content-Disposition");if(e){let t=function(t){let e=!0,i=r("filename\\*","i").exec(t);if(i){let t=a(i=i[1]);return s(t=l(t=o(t=unescape(t))))}if(i=function(t){let e;let i=[],n=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(e=n.exec(t));){let[,t,r,n]=e;if((t=parseInt(t,10))in i){if(0===t)break;continue}i[t]=[r,n]}let s=[];for(let t=0;t{if(!em(t.status))throw eg(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();let e=e=>t.headers.get(e),{allowRangeRequests:r,suggestedLength:n}=ep({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=n||this._contentLength,this._filename=ef(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new D("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:ey(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class ew{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;let r=t.source;this._withCredentials=r.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!r.disableStream,this._abortController=new AbortController,this._headers=eb(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${i-1}`);let n=r.url;fetch(n,ev(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!em(t.status))throw eg(t.status,n);this._readCapability.resolve(),this._reader=t.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:ey(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class eA{constructor(t,e={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null),this.withCredentials=e.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,i){let r={begin:t,end:e};for(let t in i)r[t]=i[t];return this.request(r)}requestFull(t){return this.request(t)}request(t){let e=new XMLHttpRequest,i=this.currXhrId++,r=this.pendingRequests[i]={xhr:e};for(let t in e.open("GET",this.url),e.withCredentials=this.withCredentials,this.httpHeaders){let i=this.httpHeaders[t];if(void 0!==i)e.setRequestHeader(t,i)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),r.expectedStatus=206):r.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(i){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),r.onHeadersReceived=t.onHeadersReceived,r.onDone=t.onDone,r.onError=t.onError,r.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){let i=this.pendingRequests[t];if(!!i)i.onProgress?.(e)}onStateChange(t,e){let i=this.pendingRequests[t];if(!i)return;let r=i.xhr;if(r.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==r.readyState||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===r.status&&this.isHttp){i.onError?.(r.status);return}let n=r.status||200;if(!(200===n&&206===i.expectedStatus)&&n!==i.expectedStatus){i.onError?.(r.status);return}let s=function(t){let e=t.response;return"string"!=typeof e?e:j(e).buffer}(r);if(206===n){let t=r.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);i.onDone({begin:parseInt(e[1],10),chunk:s})}else s?i.onDone({begin:0,chunk:s}):i.onError?.(r.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class eS{constructor(t){this._source=t,this._manager=new eA(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){let e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return T(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new eE(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){let i=new eT(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeRequestReaders.slice(0)))e.cancel(t)}}class eE{constructor(t,e){this._manager=t;let i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(i),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){let t=this._fullRequestId,e=this._manager.getRequestXhr(t),i=t=>e.getResponseHeader(t),{allowRangeRequests:r,suggestedLength:n}=ep({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=ef(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){for(let e of(this._storedError=eg(t,this._url),this._headersReceivedCapability.reject(this._storedError),this._requests))e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let e of(this._done=!0,this._headersReceivedCapability.reject(t),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class eT{constructor(t,e,i){this._manager=t;let r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,r),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){let e=t.chunk;for(let t of(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){for(let e of(this._storedError=eg(t,this._url),this._requests))e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){!this.isStreamingSupported&&this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}let eC=/^file:\/\/\/[a-zA-Z]:\//;class ek{constructor(t){this.source=t,this.url=function(t){let e=tH.get("url"),i=e.parse(t);return"file:"===i.protocol||i.host?i:/^[a-z]:[/\\]/i.test(t)?e.parse(`file:///${t}`):(!i.host&&(i.protocol="file:"),i)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return T(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new eI(this):new eR(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=this.isFsUrl?new eL(this,t,e):new eO(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeRequestReaders.slice(0)))e.cancel(t)}}class eM{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;let e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return null===t?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new D("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class eB{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();let e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return null===t?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function eP(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class eR extends eM{constructor(t){super(t);let e=e=>{if(404===e.statusCode){let t=new O(`Missing PDF "${this._url}".`);this._storedError=t,this._headersCapability.reject(t);return}this._headersCapability.resolve(),this._setReadableStream(e);let i=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:r,suggestedLength:n}=ep({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=n||this._contentLength,this._filename=ef(i)};if(this._request=null,"http:"===this._url.protocol){let i=tH.get("http");this._request=i.request(eP(this._url,t.httpHeaders),e)}else{let i=tH.get("https");this._request=i.request(eP(this._url,t.httpHeaders),e)}this._request.on("error",t=>{this._storedError=t,this._headersCapability.reject(t)}),this._request.end()}}class eO extends eB{constructor(t,e,i){for(let e in super(t),this._httpHeaders={},t.httpHeaders){let i=t.httpHeaders[e];if(void 0!==i)this._httpHeaders[e]=i}this._httpHeaders.Range=`bytes=${e}-${i-1}`;let r=t=>{if(404===t.statusCode){let t=new O(`Missing PDF "${this._url}".`);this._storedError=t;return}this._setReadableStream(t)};if(this._request=null,"http:"===this._url.protocol){let t=tH.get("http");this._request=t.request(eP(this._url,this._httpHeaders),r)}else{let t=tH.get("https");this._request=t.request(eP(this._url,this._httpHeaders),r)}this._request.on("error",t=>{this._storedError=t}),this._request.end()}}class eI extends eM{constructor(t){super(t);let e=decodeURIComponent(this._url.path);eC.test(this._url.href)&&(e=e.replace(/^\//,""));let i=tH.get("fs");i.promises.lstat(e).then(t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(e)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=new O(`Missing PDF "${e}".`)),this._storedError=t,this._headersCapability.reject(t)})}}class eL extends eB{constructor(t,e,i){super(t);let r=decodeURIComponent(this._url.path);eC.test(this._url.href)&&(r=r.replace(/^\//,""));let n=tH.get("fs");this._setReadableStream(n.createReadStream(r,{start:e,end:i-1}))}}class eD{#eN=Promise.withResolvers();#tm=null;#ej=!1;#eF=!!globalThis.FontInspector?.enabled;#ez=null;#eH=null;#eG=0;#eU=0;#eV=null;#eW=null;#eZ=0;#e$=0;#eY=Object.create(null);#eX=[];#eK=null;#eq=[];#eJ=new WeakMap;#eQ=null;static #e0=new Map;static #e1=new Map;static #e2=new Set;constructor({textContentSource:t,container:e,viewport:i}){if(t instanceof ReadableStream)this.#eK=t;else if("object"==typeof t)this.#eK=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error('No "textContentSource" parameter specified.');this.#tm=this.#eW=e,this.#e$=i.scale*(globalThis.devicePixelRatio||1),this.#eZ=i.rotation,this.#eH={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null};let{pageWidth:r,pageHeight:n,pageX:s,pageY:a}=i.rawDims;this.#eQ=[1,0,0,-1,-s,a+n],this.#eU=r,this.#eG=n,tx(e,i),this.#eN.promise.catch(()=>{}).then(()=>{eD.#e2.delete(this),this.#eH=null,this.#eY=null})}render(){let t=()=>{this.#eV.read().then(({value:e,done:i})=>{if(i){this.#eN.resolve();return}this.#ez??=e.lang,Object.assign(this.#eY,e.styles),this.#e5(e.items),t()},this.#eN.reject)};return this.#eV=this.#eK.getReader(),eD.#e2.add(this),t(),this.#eN.promise}update({viewport:t,onBefore:e=null}){let i=t.scale*(globalThis.devicePixelRatio||1),r=t.rotation;if(r!==this.#eZ&&(e?.(),this.#eZ=r,tx(this.#eW,{rotation:r})),i!==this.#e$){e?.(),this.#e$=i;let t={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:eD.#e3(this.#ez)};for(let e of this.#eq)t.properties=this.#eJ.get(e),t.div=e,this.#e4(t)}}cancel(){let t=new D("TextLayer task cancelled.");this.#eV?.cancel(t).catch(()=>{}),this.#eV=null,this.#eN.reject(t)}get textDivs(){return this.#eq}get textContentItemsStr(){return this.#eX}#e5(t){if(this.#ej)return;this.#eH.ctx||=eD.#e3(this.#ez);let e=this.#eq,i=this.#eX;for(let r of t){if(e.length>1e5){S("Ignoring additional textDivs for performance reasons."),this.#ej=!0;return}if(void 0===r.str){if("beginMarkedContentProps"===r.type||"beginMarkedContent"===r.type){let t=this.#tm;this.#tm=document.createElement("span"),this.#tm.classList.add("markedContent"),null!==r.id&&this.#tm.setAttribute("id",`${r.id}`),t.append(this.#tm)}else"endMarkedContent"===r.type&&(this.#tm=this.#tm.parentNode);continue}i.push(r.str),this.#e6(r)}}#e6(t){let e,i;let r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#eq.push(r);let s=G.transform(this.#eQ,t.transform),a=Math.atan2(s[1],s[0]),o=this.#eY[t.fontName];o.vertical&&(a+=Math.PI/2);let l=this.#eF&&o.fontSubstitution||o.fontFamily,h=Math.hypot(s[2],s[3]),d=h*eD.#e8(l,this.#ez);0===a?(e=s[4],i=s[5]-d):(e=s[4]+d*Math.sin(a),i=s[5]-d*Math.cos(a));let u="calc(var(--scale-factor)*",c=r.style;this.#tm===this.#eW?(c.left=`${(100*e/this.#eU).toFixed(2)}%`,c.top=`${(100*i/this.#eG).toFixed(2)}%`):(c.left=`${u}${e.toFixed(2)}px)`,c.top=`${u}${i.toFixed(2)}px)`),c.fontSize=`${u}${h.toFixed(2)}px)`,c.fontFamily=l,n.fontSize=h,r.setAttribute("role","presentation"),r.textContent=t.str,r.dir=t.dir,this.#eF&&(r.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),0!==a&&(n.angle=180/Math.PI*a);let p=!1;if(t.str.length>1)p=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(p=!0)}if(p&&(n.canvasWidth=o.vertical?t.height:t.width),this.#eJ.set(r,n),this.#eH.div=r,this.#eH.properties=n,this.#e4(this.#eH),n.hasText&&this.#tm.append(r),n.hasEOL){let t=document.createElement("br");t.setAttribute("role","presentation"),this.#tm.append(t)}}#e4(t){let{div:e,properties:i,ctx:r,prevFontSize:n,prevFontFamily:s}=t,{style:a}=e,o="";if(0!==i.canvasWidth&&i.hasText){let{fontFamily:l}=a,{canvasWidth:h,fontSize:d}=i;(n!==d||s!==l)&&(r.font=`${d*this.#e$}px ${l}`,t.prevFontSize=d,t.prevFontFamily=l);let{width:u}=r.measureText(e.textContent);u>0&&(o=`scaleX(${h*this.#e$/u})`)}0!==i.angle&&(o=`rotate(${i.angle}deg) ${o}`),o.length>0&&(a.transform=o)}static cleanup(){if(!(this.#e2.size>0)){for(let{canvas:t}of(this.#e0.clear(),this.#e1.values()))t.remove();this.#e1.clear()}}static #e3(t=null){let e=this.#e1.get(t||="");if(!e){let i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1}),this.#e1.set(t,e)}return e}static #e8(t,e){let i=this.#e0.get(t);if(i)return i;let r=this.#e3(e),n=r.font;r.canvas.width=r.canvas.height=30,r.font=`30px ${t}`;let s=r.measureText(""),a=s.fontBoundingBoxAscent,o=Math.abs(s.fontBoundingBoxDescent);if(a){let e=a/(a+o);return this.#e0.set(t,e),r.canvas.width=r.canvas.height=0,r.font=n,e}r.strokeStyle="red",r.clearRect(0,0,30,30),r.strokeText("g",0,0);let l=r.getImageData(0,0,30,30).data;o=0;for(let t=l.length-1-3;t>=0;t-=4)if(l[t]>0){o=Math.ceil(t/4/30);break}r.clearRect(0,0,30,30),r.strokeText("A",0,30),l=r.getImageData(0,0,30,30).data,a=0;for(let t=0,e=l.length;t0){a=30-Math.floor(t/4/30);break}r.canvas.width=r.canvas.height=0,r.font=n;let h=a?a/(a+o):.8;return this.#e0.set(t,h),h}}function eN(){tf("`renderTextLayer`, please use `TextLayer` instead.");let{textContentSource:t,container:e,viewport:i,...r}=arguments[0],n=Object.keys(r);n.length>0&&S("Ignoring `renderTextLayer` parameters: "+n.join(", "));let s=new eD({textContentSource:t,container:e,viewport:i}),{textDivs:a,textContentItemsStr:o}=s;return{promise:s.render(),textDivs:a,textContentItemsStr:o}}function ej(){tf("`updateTextLayer`, please use `TextLayer` instead.")}class eF{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};return!function t(i){if(!i)return;let r=null,n=i.name;if("#text"===n)r=i.value;else{if(!eF.shouldBuildText(n))return;i?.attributes?.textContent?r=i.attributes.textContent:i.value&&(r=i.value)}if(null!==r&&e.push({str:r}),!!i.children)for(let e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}let ez=a?class t extends X{_createCanvas(t,e){return tH.get("canvas").createCanvas(t,e)}}:class t extends X{constructor({ownerDocument:t=globalThis.document}={}){super(),this._document=t}_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},eH=a?class t extends K{_fetchData(t,e){return tG(t).then(t=>({cMapData:t,compressionType:e}))}}:ti,eG=a?class t extends Y{}:class t extends Y{#e7;#e9;#it;#ie;#ii;#m=0;constructor({docId:t,ownerDocument:e=globalThis.document}={}){super(),this.#it=t,this.#ie=e}get #b(){return this.#e7||=new Map}get #ir(){return this.#ii||=new Map}get #is(){if(!this.#e9){let t=this.#ie.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let i=this.#ie.createElementNS(Q,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#e9=this.#ie.createElementNS(Q,"defs"),t.append(i),i.append(this.#e9),this.#ie.body.append(t)}return this.#e9}#ia(t){if(1===t.length){let e=t[0],i=Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;let r=i.join(",");return[r,r,r]}let[e,i,r]=t,n=Array(256),s=Array(256),a=Array(256);for(let t=0;t<256;t++)n[t]=e[t]/255,s[t]=i[t]/255,a[t]=r[t]/255;return[n.join(","),s.join(","),a.join(",")]}addFilter(t){if(!t)return"none";let e=this.#b.get(t);if(e)return e;let[i,r,n]=this.#ia(t),s=1===t.length?i:`${i}${r}${n}`;if(e=this.#b.get(s))return this.#b.set(t,e),e;let a=`g_${this.#it}_transfer_map_${this.#m++}`,o=`url(#${a})`;this.#b.set(t,o),this.#b.set(s,o);let l=this.#io(a);return this.#il(i,r,n,l),o}addHCMFilter(t,e){let i=`${t}-${e}`,r="base",n=this.#ir.get(r);if(n?.key===i)return n.url;if(n?(n.filter?.remove(),n.key=i,n.url="none",n.filter=null):(n={key:i,url:"none",filter:null},this.#ir.set(r,n)),!t||!e)return n.url;let s=this.#ih(t);t=G.makeHexColor(...s);let a=this.#ih(e);if(e=G.makeHexColor(...a),this.#is.style.color="","#000000"===t&&"#ffffff"===e||t===e)return n.url;let o=Array(256);for(let t=0;t<=255;t++){let e=t/255;o[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}let l=o.join(","),h=`g_${this.#it}_hcm_filter`,d=n.filter=this.#io(h);this.#il(l,l,l,d),this.#id(d);let u=(t,e)=>{let i=s[t]/255,r=a[t]/255,n=Array(e+1);for(let t=0;t<=e;t++)n[t]=i+t/e*(r-i);return n.join(",")};return this.#il(u(0,5),u(1,5),u(2,5),d),n.url=`url(#${h})`,n.url}addAlphaFilter(t){let e=this.#b.get(t);if(e)return e;let[i]=this.#ia([t]),r=`alpha_${i}`;if(e=this.#b.get(r))return this.#b.set(t,e),e;let n=`g_${this.#it}_alpha_map_${this.#m++}`,s=`url(#${n})`;this.#b.set(t,s),this.#b.set(r,s);let a=this.#io(n);return this.#iu(i,a),s}addLuminosityFilter(t){let e,i,r=this.#b.get(t||"luminosity");if(r)return r;if(t?([e]=this.#ia([t]),i=`luminosity_${e}`):i="luminosity",r=this.#b.get(i))return this.#b.set(t,r),r;let n=`g_${this.#it}_luminosity_map_${this.#m++}`,s=`url(#${n})`;this.#b.set(t,s),this.#b.set(i,s);let a=this.#io(n);return this.#ic(a),t&&this.#iu(e,a),s}addHighlightHCMFilter(t,e,i,r,n){let s=`${e}-${i}-${r}-${n}`,a=this.#ir.get(t);if(a?.key===s)return a.url;if(a?(a.filter?.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},this.#ir.set(t,a)),!e||!i)return a.url;let[o,l]=[e,i].map(this.#ih.bind(this)),h=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[u,c]=[r,n].map(this.#ih.bind(this));d{let r=Array(256),n=(d-h)/i,s=t/255,a=(e-t)/(255*i),o=0;for(let t=0;t<=i;t++){let e=Math.round(h+t*n),i=s+t*a;for(let t=o;t<=e;t++)r[t]=i;o=e+1}for(let t=o;t<256;t++)r[t]=r[o-1];return r.join(",")},f=`g_${this.#it}_hcm_${t}_filter`,g=a.filter=this.#io(f);return this.#id(g),this.#il(p(u[0],c[0],5),p(u[1],c[1],5),p(u[2],c[2],5),g),a.url=`url(#${f})`,a.url}destroy(t=!1){if(!t||0===this.#ir.size)this.#e9&&(this.#e9.parentNode.parentNode.remove(),this.#e9=null),this.#e7&&(this.#e7.clear(),this.#e7=null),this.#m=0}#ic(t){let e=this.#ie.createElementNS(Q,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}#id(t){let e=this.#ie.createElementNS(Q,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}#io(t){let e=this.#ie.createElementNS(Q,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#is.append(e),e}#ip(t,e,i){let r=this.#ie.createElementNS(Q,e);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),t.append(r)}#il(t,e,i,r){let n=this.#ie.createElementNS(Q,"feComponentTransfer");r.append(n),this.#ip(n,"feFuncR",t),this.#ip(n,"feFuncG",e),this.#ip(n,"feFuncB",i)}#iu(t,e){let i=this.#ie.createElementNS(Q,"feComponentTransfer");e.append(i),this.#ip(i,"feFuncA",t)}#ih(t){return this.#is.style.color=t,tv(getComputedStyle(this.#is).getPropertyValue("color"))}},eU=a?class t extends q{_fetchData(t){return tG(t)}}:tr;function eV(t){var e;if("string"==typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t}),"object"!=typeof t)throw Error("Invalid parameter in getDocument, need parameter object.");if(!t.url&&!t.data&&!t.range)throw Error("Invalid parameter object: need either .data, .range or .url");let i=new eZ,{docId:r}=i,n=t.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(a&&"string"==typeof t)return t}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,s=t.data?function(t){if(a&&"undefined"!=typeof Buffer&&t instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return j(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(t.data):null,o=t.httpHeaders||null,l=!0===t.withCredentials,h=t.password??null,d=t.range instanceof e$?t.range:null,u=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:65536,c=t.worker instanceof eJ?t.worker:null,p=t.verbosity,f="string"!=typeof t.docBaseUrl||to(t.docBaseUrl)?null:t.docBaseUrl,g="string"==typeof t.cMapUrl?t.cMapUrl:null,m=!1!==t.cMapPacked,v=t.CMapReaderFactory||eH,b="string"==typeof t.standardFontDataUrl?t.standardFontDataUrl:null,y=t.StandardFontDataFactory||eU,x=!0!==t.stopAtErrors,_=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,A=!1!==t.isEvalSupported,S="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!a,E=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,T="boolean"==typeof t.disableFontFace?t.disableFontFace:a,C=!0===t.fontExtraProperties,k=!0===t.enableXfa,M=t.ownerDocument||globalThis.document,B=!0===t.disableRange,P=!0===t.disableStream,R=!0===t.disableAutoFetch,O=!0===t.pdfBug,I=d?d.length:t.length??NaN,L="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!a&&!T,D="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:v===ti&&y===tr&&g&&b&&tc(g,document.baseURI)&&tc(b,document.baseURI),N=t.canvasFactory||new ez({ownerDocument:M}),F=t.filterFactory||new eG({docId:r,ownerDocument:M});Number.isInteger(e=p)&&(w=e);let z={canvasFactory:N,filterFactory:F};if(!D&&(z.cMapReaderFactory=new v({baseUrl:g,isCompressed:m}),z.standardFontDataFactory=new y({baseUrl:b})),!c){let t={verbosity:p,port:ee.workerPort};c=t.port?eJ.fromPort(t):new eJ(t),i._worker=c}let H={docId:r,apiVersion:"4.3.136",data:s,password:h,disableAutoFetch:R,rangeChunkSize:u,length:I,docBaseUrl:f,enableXfa:k,evaluatorOptions:{maxImageSize:_,disableFontFace:T,ignoreErrors:x,isEvalSupported:A,isOffscreenCanvasSupported:S,canvasMaxAreaInBytes:E,fontExtraProperties:C,useSystemFonts:L,cMapUrl:D?g:null,standardFontDataUrl:D?b:null}},G={disableFontFace:T,fontExtraProperties:C,ownerDocument:M,pdfBug:O,styleElement:null,loadingParams:{disableAutoFetch:R,enableXfa:k}};return c.promise.then(function(){let t;if(i.destroyed)throw Error("Loading aborted");if(c.destroyed)throw Error("Worker was destroyed");let e=c.messageHandler.sendWithPromise("GetDocRequest",H,s?[s.buffer]:null);if(d)t=new ed(d,{disableRange:B,disableStream:P});else if(!s){var h;h={url:n,length:I,httpHeaders:o,withCredentials:l,rangeChunkSize:u,disableRange:B,disableStream:P},t=a?"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&tc(h.url)?new ex(h):new ek(h):tc(h.url)?new ex(h):new eS(h)}return e.then(e=>{if(i.destroyed)throw Error("Loading aborted");if(c.destroyed)throw Error("Worker was destroyed");let n=new es(r,e,c.port),s=new eQ(n,i,t,G,z);i._transport=s,n.send("Ready",null)})}).catch(i._capability.reject),i}function eW(t){return"object"==typeof t&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0}class eZ{static #it=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${eZ.#it++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}class e${constructor(t,e,i=!1,r=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(let i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(let i of this._progressListeners)i(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(let e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){E("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class eY{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return k(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class eX{#ig=null;#im=!1;constructor(t,e,i,r=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=r?new tu:null,this._pdfBug=r,this.commonObjs=i.commonObjs,this.objs=new e1,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:r=0,dontFlip:n=!1}={}){return new ts({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:r,dontFlip:n})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return k(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:e,intent:i="display",annotationMode:r=d.ENABLE,transform:n=null,background:s=null,optionalContentConfigPromise:a=null,annotationCanvasMap:o=null,pageColors:l=null,printAnnotationStorage:u=null}){this._stats?.time("Overall");let c=this._transport.getRenderingIntent(i,r,u),{renderingIntent:p,cacheKey:f}=c;this.#im=!1,this.#iv(),a||=this._transport.getOptionalContentConfig(p);let g=this._intentStates.get(f);!g&&(g=Object.create(null),this._intentStates.set(f,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);let m=!!(p&h.PRINT);!g.displayReadyCapability&&(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(c));let v=t=>{g.renderTasks.delete(b),(this._maybeCleanupAfterRender||m)&&(this.#im=!0),this.#ib(!m),t?(b.capability.reject(t),this._abortOperatorList({intentState:g,reason:t instanceof Error?t:Error(t)})):b.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},b=new e5({callback:v,params:{canvasContext:t,viewport:e,transform:n,background:s},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:o,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:l});(g.renderTasks||=new Set).add(b);let y=b.task;return Promise.all([g.displayReadyCapability.promise,a]).then(([t,e])=>{if(this.destroyed){v();return}if(this._stats?.time("Rendering"),!(e.renderingIntent&p))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");b.initializeGraphics({transparency:t,optionalContentConfig:e}),b.operatorListChanged()}).catch(v),y}getOperatorList({intent:t="display",annotationMode:e=d.ENABLE,printAnnotationStorage:i=null}={}){let r;let n=this._transport.getRenderingIntent(t,e,i,!0),s=this._intentStates.get(n.cacheKey);return!s&&(s=Object.create(null),this._intentStates.set(n.cacheKey,s)),!s.opListReadCapability&&((r=Object.create(null)).operatorListChanged=function(){s.operatorList.lastChunk&&(s.opListReadCapability.resolve(s.operatorList),s.renderTasks.delete(r))},s.opListReadCapability=Promise.withResolvers(),(s.renderTasks||=new Set).add(r),s.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),s.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(t=>eF.textContent(t));let e=this.streamTextContent(t);return new Promise(function(t,i){let r=e.getReader(),n={items:[],styles:Object.create(null),lang:null};!function e(){r.read().then(function({value:i,done:r}){if(r){t(n);return}n.lang??=i.lang,Object.assign(n.styles,i.styles),n.items.push(...i.items),e()},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values()){if(this._abortOperatorList({intentState:e,reason:Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel()}return this.objs.clear(),this.#im=!1,this.#iv(),Promise.all(t)}cleanup(t=!1){this.#im=!0;let e=this.#ib(!1);return t&&e&&(this._stats&&=new tu),e}#ib(t=!1){if(this.#iv(),!this.#im||this.destroyed)return!1;if(t)return this.#ig=setTimeout(()=>{this.#ig=null,this.#ib(!1)},5e3),!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#im=!1,!0}#iv(){this.#ig&&(clearTimeout(this.#ig),this.#ig=null)}_startRenderPage(t,e){let i=this._intentStates.get(e);if(!!i)this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t)}_renderPageChunk(t,e){for(let i=0,r=t.length;i{s.read().then(({value:t,done:e})=>{if(e){a.streamReader=null;return}if(!this._transport.destroyed)this._renderPageChunk(t,a),o()},t=>{if(a.streamReader=null,!this._transport.destroyed){if(a.operatorList){for(let t of(a.operatorList.lastChunk=!0,a.renderTasks))t.operatorListChanged();this.#ib(!0)}if(a.displayReadyCapability)a.displayReadyCapability.reject(t);else if(a.opListReadCapability)a.opListReadCapability.reject(t);else throw t}})};o()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(!t.streamReader)return;if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof ta){let i=100;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new D(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}get stats(){return this._stats}}class eK{#iy=new Set;#ix=Promise.resolve();postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};this.#ix.then(()=>{for(let t of this.#iy)t.call(this,i)})}addEventListener(t,e){this.#iy.add(e)}removeEventListener(t,e){this.#iy.delete(e)}terminate(){this.#iy.clear()}}let eq={isWorkerDisabled:!1,fakeWorkerId:0};a&&(eq.isWorkerDisabled=!0,ee.workerSrc||="./pdf.worker.mjs"),eq.isSameOrigin=function(t,e){let i;try{if(!(i=new URL(t)).origin||"null"===i.origin)return!1}catch{return!1}let r=new URL(e,i);return i.origin===r.origin},eq.createCDNWrapper=function(t){let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};class eJ{static #i_;constructor({name:t=null,port:e=null,verbosity:i=w}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if(eJ.#i_?.has(e))throw Error("Cannot use more than one PDFWorker per port.");(eJ.#i_||=new WeakMap).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return a?Promise.all([tH.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new es("main","worker",t),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!eq.isWorkerDisabled&&!eJ.#iw){let{workerSrc:t}=eJ;try{!eq.isSameOrigin(window.location.href,t)&&(t=eq.createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new es("main","worker",e),r=()=>{e.removeEventListener("error",n),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},n=()=>{!this._webWorker&&r()};e.addEventListener("error",n),i.on("test",t=>{if(e.removeEventListener("error",n),this.destroyed){r();return}t?(this._messageHandler=i,this._port=e,this._webWorker=e,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),i.destroy(),e.terminate())}),i.on("ready",t=>{if(e.removeEventListener("error",n),this.destroyed){r();return}try{s()}catch{this._setupFakeWorker()}});let s=()=>{let t=new Uint8Array;i.send("test",t,[t.buffer])};s();return}catch{A("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){!eq.isWorkerDisabled&&(S("Setting up fake worker."),eq.isWorkerDisabled=!0),eJ._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(Error("Worker was destroyed"));return}let e=new eK;this._port=e;let i=`fake${eq.fakeWorkerId++}`,r=new es(i+"_worker",i,e);t.setup(r,e);let n=new es(i,i+"_worker",e);this._messageHandler=n,this._readyCapability.resolve(),n.send("configure",{verbosity:this.verbosity})}).catch(t=>{this._readyCapability.reject(Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),eJ.#i_?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw Error("PDFWorker.fromPort - invalid method signature.");let e=this.#i_?.get(t.port);if(e){if(e._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new eJ(t)}static get workerSrc(){if(ee.workerSrc)return ee.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get #iw(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return k(this,"_setupFakeWorkerGlobal",(async()=>this.#iw?this.#iw:(await import(this.workerSrc)).WorkerMessageHandler)())}}class eQ{#iA=new Map;#iS=new Map;#iE=new Map;#iT=new Map;#iC=null;constructor(t,e,i,r,n){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new e1,this.fontLoader=new tN({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#ik(t,e=null){let i=this.#iA.get(t);if(i)return i;let r=this.messageHandler.sendWithPromise(t,e);return this.#iA.set(t,r),r}get annotationStorage(){return k(this,"annotationStorage",new tL)}getRenderingIntent(t,e=d.ENABLE,i=null,r=!1){let n=h.DISPLAY,s=tI;switch(t){case"any":n=h.ANY;break;case"display":break;case"print":n=h.PRINT;break;default:S(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case d.DISABLE:n+=h.ANNOTATIONS_DISABLE;break;case d.ENABLE:break;case d.ENABLE_FORMS:n+=h.ANNOTATIONS_FORMS;break;case d.ENABLE_STORAGE:s=((n+=h.ANNOTATIONS_STORAGE)&h.PRINT&&i instanceof tD?i:this.annotationStorage).serializable;break;default:S(`getRenderingIntent - invalid annotationMode: ${e}`)}return r&&(n+=h.OPLIST),{renderingIntent:n,cacheKey:`${n}_${s.hash}`,annotationStorageSerializable:s}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#iC?.reject(Error("Worker was destroyed during onPassword callback"));let t=[];for(let e of this.#iS.values())t.push(e._destroy());this.#iS.clear(),this.#iE.clear(),this.#iT.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#iA.clear(),this.filterFactory.destroy(),eD.cleanup(),this._networkStream?.cancelAllRequests(new D("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{T(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function({value:t,done:i}){if(i){e.close();return}T(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t])}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",t=>{let i=Promise.withResolvers(),r=this._fullReader;return r.headersReady.then(()=>{(!r.isStreamingSupported||!r.isRangeSupported)&&(this._lastProgress&&e.onProgress?.(this._lastProgress),r.onProgress=t=>{e.onProgress?.({loaded:t.loaded,total:t.total})}),i.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})},i.reject),i.promise}),t.on("GetRangeReader",(t,e)=>{T(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let i=this._networkStream.getRangeReader(t.begin,t.end);if(!i){e.close();return}e.onPull=()=>{i.read().then(function({value:t,done:i}){if(i){e.close();return}T(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t])}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("GetDoc",({pdfInfo:t})=>{this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new eY(t,this))}),t.on("DocException",function(t){let i;switch(t.name){case"PasswordException":i=new B(t.message,t.code);break;case"InvalidPDFException":i=new R(t.message);break;case"MissingPDFException":i=new O(t.message);break;case"UnexpectedResponseException":i=new I(t.message,t.status);break;case"UnknownErrorException":i=new P(t.message,t.details);break;default:E("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",t=>{if(this.#iC=Promise.withResolvers(),e.onPassword)try{e.onPassword(t=>{t instanceof Error?this.#iC.reject(t):this.#iC.resolve({password:t})},t.code)}catch(t){this.#iC.reject(t)}else this.#iC.reject(new B(t.message,t.code));return this.#iC.promise}),t.on("DataLoaded",t=>{e.onProgress?.({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{if(!this.destroyed)this.#iS.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",([e,i,r])=>{if(this.destroyed||this.commonObjs.has(e))return null;switch(i){case"Font":let{disableFontFace:n,fontExtraProperties:s,pdfBug:a}=this._params;if("error"in r){let t=r.error;S(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}let o=new tj(r,{disableFontFace:n,inspectFont:a&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null});this.fontLoader.bind(o).catch(()=>t.sendWithPromise("FontFallback",{id:e})).finally(()=>{!s&&o.data&&(o.data=null),this.commonObjs.resolve(e,o)});break;case"CopyLocalImage":let{imageRef:l}=r;for(let t of(T(l,"The imageRef must be defined."),this.#iS.values()))for(let[,i]of t.objs){if(i?.ref===l){if(!i.dataLen)return null;return this.commonObjs.resolve(e,structuredClone(i)),i.dataLen}}break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(e,r);break;default:throw Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([t,e,i,r])=>{if(this.destroyed)return;let n=this.#iS.get(e);if(!n.objs.has(t)){if(0===n._intentStates.size){r?.bitmap?.close();return}switch(i){case"Image":n.objs.resolve(t,r),r?.dataLen>1e7&&(n._maybeCleanupAfterRender=!0);break;case"Pattern":n.objs.resolve(t,r);break;default:throw Error(`Got unknown object type ${i}`)}}}),t.on("DocProgress",t=>{if(!this.destroyed)e.onProgress?.({loaded:t.loaded,total:t.total})}),t.on("FetchBuiltInCMap",t=>this.destroyed?Promise.reject(Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(t):Promise.reject(Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",t=>this.destroyed?Promise.reject(Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(t):Promise.reject(Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&S("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(Error("Invalid page request."));let e=t-1,i=this.#iE.get(e);if(i)return i;let r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw Error("Transport destroyed");i.refStr&&this.#iT.set(i.refStr,t);let r=new eX(e,i,this,this._params.pdfBug);return this.#iS.set(e,r),r});return this.#iE.set(e,r),r}getPageIndex(t){return eW(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#ik("GetFieldObjects")}hasJSActions(){return this.#ik("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#ik("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#ik("GetOptionalContentConfig").then(e=>new eh(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=this.#iA.get(t);if(e)return e;let i=this.messageHandler.sendWithPromise(t,null).then(t=>({info:t[0],metadata:t[1]?new ea(t[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#iA.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){for(let t of(await this.messageHandler.sendWithPromise("Cleanup",null),this.#iS.values()))if(!t.cleanup())throw Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),!t&&this.fontLoader.clear(),this.#iA.clear(),this.filterFactory.destroy(!0),eD.cleanup()}}cachedPageNumber(t){if(!eW(t))return null;let e=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;return this.#iT.get(e)??null}}let e0=Symbol("INITIAL_DATA");class e1{#iM=Object.create(null);#iB(t){return this.#iM[t]||={...Promise.withResolvers(),data:e0}}get(t,e=null){if(e){let i=this.#iB(t);return i.promise.then(()=>e(i.data)),null}let i=this.#iM[t];if(!i||i.data===e0)throw Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=this.#iM[t];return!!e&&e.data!==e0}resolve(t,e=null){let i=this.#iB(t);i.data=e,i.resolve()}clear(){for(let t in this.#iM){let{data:e}=this.#iM[t];e?.bitmap?.close()}this.#iM=Object.create(null)}*[Symbol.iterator](){for(let t in this.#iM){let{data:e}=this.#iM[t];if(e!==e0)yield[t,e]}}}class e2{#iP=null;constructor(t){this.#iP=t,this.onContinue=null}get promise(){return this.#iP.capability.promise}cancel(t=0){this.#iP.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this.#iP.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this.#iP;return t.form||t.canvas&&e?.size>0}}class e5{static #iR=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:r,annotationCanvasMap:n,operatorList:s,pageIndex:a,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:u=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=r,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=d,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new e2(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(e5.#iR.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");e5.#iR.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:i,viewport:r,transform:n,background:s}=this.params;this.gfx=new et(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:r,transparency:t,background:s}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),e5.#iR.delete(this._canvas),this.callback(t||new ta(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}if(this.stepper?.updateOperatorList(this.operatorList),!this.running)this._continue()}_continue(){if(this.running=!0,!this.cancelled)this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext()}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){if(!this.cancelled)this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),e5.#iR.delete(this._canvas),this.callback()))}}let e3="4.3.136",e4="0cec64437";function e6(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function e8(t){return Math.max(0,Math.min(255,255*t))}class e7{static CMYK_G([t,e,i,r]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+r)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return[t=e8(t),t,t]}static G_HTML([t]){let e=e6(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(e8)}static RGB_HTML(t){return`#${t.map(e6).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,r]){return["RGB",1-Math.min(1,t+r),1-Math.min(1,i+r),1-Math.min(1,e+r)]}static CMYK_rgb([t,e,i,r]){return[e8(1-Math.min(1,t+r)),e8(1-Math.min(1,i+r)),e8(1-Math.min(1,e+r))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){let r=1-t,n=1-e,s=1-i,a=Math.min(r,n,s);return["CMYK",r,n,s,a]}}class e9{static setupStorage(t,e,i,r,n){let s=r.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==s.value&&(t.textContent=s.value),"print"===n)break;t.addEventListener("input",t=>{r.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(s.value===i.attributes.xfaOn?t.setAttribute("checked",!0):s.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===n)break;t.addEventListener("change",t=>{r.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==s.value&&t.setAttribute("value",s.value),"print"===n)break;t.addEventListener("input",t=>{r.setValue(e,{value:t.target.value})})}break;case"select":if(null!==s.value)for(let e of(t.setAttribute("value",s.value),i.children))e.attributes.value===s.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected;t.addEventListener("input",t=>{let i=t.target.options,n=-1===i.selectedIndex?"":i[i.selectedIndex].value;r.setValue(e,{value:n})})}}static setAttributes({html:t,element:e,storage:i=null,intent:r,linkService:n}){let{attributes:s}=e,a=t instanceof HTMLAnchorElement;for(let[e,i]of("radio"===s.type&&(s.name=`${s.name}-${r}`),Object.entries(s))){if(null!=i)switch(e){case"class":i.length&&t.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",i);break;case"style":Object.assign(t.style,i);break;case"textContent":t.textContent=i;break;default:(!a||"href"!==e&&"newWindow"!==e)&&t.setAttribute(e,i)}}a&&n.addLinkAttributes(t,s.href,s.newWindow),i&&s.dataId&&this.setupStorage(t,s.dataId,e,i)}static render(t){let e=t.annotationStorage,i=t.linkService,r=t.xfaHtml,n=t.intent||"display",s=document.createElement(r.name);r.attributes&&this.setAttributes({html:s,element:r,intent:n,linkService:i});let a="richText"!==n,o=t.div;if(o.append(s),t.viewport){let e=`matrix(${t.viewport.transform.join(",")})`;o.style.transform=e}a&&o.setAttribute("class","xfaLayer xfaFont");let l=[];if(0===r.children.length){if(r.value){let t=document.createTextNode(r.value);s.append(t),a&&eF.shouldBuildText(r.name)&&l.push(t)}return{textDivs:l}}let h=[[r,-1,s]];for(;h.length>0;){let[t,r,s]=h.at(-1);if(r+1===t.children.length){h.pop();continue}let o=t.children[++h.at(-1)[1]];if(null===o)continue;let{name:d}=o;if("#text"===d){let t=document.createTextNode(o.value);l.push(t),s.append(t);continue}let u=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,d):document.createElement(d);if(s.append(u),o.attributes&&this.setAttributes({html:u,element:o,storage:e,intent:n,linkService:i}),o.children?.length>0)h.push([o,-1,u]);else if(o.value){let t=document.createTextNode(o.value);a&&eF.shouldBuildText(d)&&l.push(t),u.append(t)}}for(let t of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}let it=new WeakSet;function ie(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class ii{static create(t){switch(t.data.annotationType){case m.LINK:return new is(t);case m.TEXT:return new ia(t);case m.WIDGET:switch(t.data.fieldType){case"Tx":return new il(t);case"Btn":if(t.data.radioButton)return new iu(t);if(t.data.checkBox)return new id(t);return new ic(t);case"Ch":return new ip(t);case"Sig":return new ih(t)}return new io(t);case m.POPUP:return new ig(t);case m.FREETEXT:return new iv(t);case m.LINE:return new ib(t);case m.SQUARE:return new iy(t);case m.CIRCLE:return new ix(t);case m.POLYLINE:return new i_(t);case m.CARET:return new iA(t);case m.INK:return new iS(t);case m.POLYGON:return new iw(t);case m.HIGHLIGHT:return new iE(t);case m.UNDERLINE:return new iT(t);case m.SQUIGGLY:return new iC(t);case m.STRIKEOUT:return new ik(t);case m.STAMP:return new iM(t);case m.FILEATTACHMENT:return new iB(t);default:return new ir(t)}}}class ir{#iO=null;#iI=!1;#iL=null;constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),r&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:i}){return!!(t?.str||e?.str||i?.str)}get hasPopupData(){return ir._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#iO||={rect:this.data.rect.slice(0)};let{rect:e}=t;e&&this.#iD(e),this.#iL?.popup.updateEdited(t)}resetEdited(){if(!!this.#iO)this.#iD(this.#iO.rect),this.#iL?.popup.resetEdited(),this.#iO=null}#iD(t){let{container:{style:e},data:{rect:i,rotation:r},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:s,pageX:a,pageY:o}}}}=this;i?.splice(0,4,...t);let{width:l,height:h}=ie(t);e.left=`${100*(t[0]-a)/n}%`,e.top=`${100*(s-t[3]+o)/s}%`,0===r?(e.width=`${100*l/n}%`,e.height=`${100*h/s}%`):this.setRotation(r)}_createContainer(t){let{data:e,parent:{page:i,viewport:r}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),!(this instanceof io)&&(n.tabIndex=1e3);let{style:s}=n;if(s.zIndex=this.parent.zIndex++,e.popupRef&&n.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof ig){let{rotation:t}=e;return!e.hasOwnCanvas&&0!==t&&this.setRotation(t,n),n}let{width:a,height:o}=ie(e.rect);if(!t&&e.borderStyle.width>0){s.borderWidth=`${e.borderStyle.width}px`;let t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){let e=`calc(${t}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;s.borderRadius=e}else if(this instanceof iu){let t=`calc(${a}px * var(--scale-factor)) / calc(${o}px * var(--scale-factor))`;s.borderRadius=t}switch(e.borderStyle.style){case v.SOLID:s.borderStyle="solid";break;case v.DASHED:s.borderStyle="dashed";break;case v.BEVELED:S("Unimplemented border style: beveled");break;case v.INSET:S("Unimplemented border style: inset");break;case v.UNDERLINE:s.borderBottomStyle="solid"}let r=e.borderColor||null;r?(this.#iI=!0,s.borderColor=G.makeHexColor(0|r[0],0|r[1],0|r[2])):s.borderWidth=0}let l=G.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:d,pageX:u,pageY:c}=r.rawDims;s.left=`${100*(l[0]-u)/h}%`,s.top=`${100*(l[1]-c)/d}%`;let{rotation:p}=e;return e.hasOwnCanvas||0===p?(s.width=`${100*a/h}%`,s.height=`${100*o/d}%`):this.setRotation(p,n),n}setRotation(t,e=this.container){let i,r;if(!this.data.rect)return;let{pageWidth:n,pageHeight:s}=this.parent.viewport.rawDims,{width:a,height:o}=ie(this.data.rect);t%180==0?(i=100*a/n,r=100*o/s):(i=100*o/n,r=100*a/s),e.style.width=`${i}%`,e.style.height=`${r}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(t,e,i)=>{let r=i.detail[t],n=r[0],s=r.slice(1);i.target.style[e]=e7[`${n}_HTML`](s),this.annotationStorage.setValue(this.data.id,{[e]:e7[`${n}_rgb`](s)})};return k(this,"_commonActions",{display:t=>{let{display:e}=t.detail,i=e%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{let{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{let e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let r of Object.keys(e.detail)){let n=t[r]||i[r];n?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let i=this._commonActions;for(let[r,n]of Object.entries(e)){let s=i[r];s&&(s({detail:{[r]:n},target:t}),delete e[r])}}_createQuadrilaterals(){let t;if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[i,r,n,s]=this.data.rect;if(1===e.length){let[,{x:t,y:a},{x:o,y:l}]=e[0];if(n===t&&s===a&&i===o&&r===l)return}let{style:a}=this.container;if(this.#iI){let{borderColor:e,borderWidth:i}=a;a.borderWidth=0,t=["url('data:image/svg+xml;utf8,",'',``],this.container.classList.add("hasBorder")}let o=n-i,l=s-r,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);let u=h.createElement("defs");d.append(u);let c=h.createElement("clipPath"),p=`clippath_${this.data.id}`;for(let[,{x:r,y:n},{x:a,y:d}]of(c.setAttribute("id",p),c.setAttribute("clipPathUnits","objectBoundingBox"),u.append(c),e)){let e=h.createElement("rect"),u=(a-i)/o,p=(s-n)/l,f=(r-a)/o,g=(n-d)/l;e.setAttribute("x",u),e.setAttribute("y",p),e.setAttribute("width",f),e.setAttribute("height",g),c.append(e),t?.push(``)}this.#iI&&(t.push("')"),a.backgroundImage=t.join("")),this.container.append(d),this.container.style.clipPath=`url(#${p})`}_createPopup(){let{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");let i=this.#iL=new ig({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(i.render())}render(){E("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let i=[];if(this._fieldObjects){let r=this._fieldObjects[t];if(r)for(let{page:t,id:n,exportValues:s}of r){if(-1===t||n===e)continue;let r="string"==typeof s?s:null,a=document.querySelector(`[data-element-id="${n}"]`);if(a&&!it.has(a)){S(`_getElementsByName - element not allowed: ${n}`);continue}i.push({id:n,exportValue:r,domElement:a})}return i}for(let r of document.getElementsByName(t)){let{exportValue:t}=r,n=r.getAttribute("data-element-id");if(n!==e&&!!it.has(r))i.push({id:n,exportValue:t,domElement:r})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}}class is extends ir{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){let{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let r=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),r=!0):t.action?(this._bindNamedAction(i,t.action),r=!0):t.attachment?(this.#iN(i,t.attachment,t.attachmentDest),r=!0):t.setOCGState?(this.#ij(i,t.setOCGState),r=!0):t.dest?(this._bindLink(i,t.dest),r=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),r=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(i,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&this.container.append(i),this.container}#iF(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&this.#iF()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#iF()}#iN(t,e,i=null){t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#iF()}#ij(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#iF()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let r of Object.keys(e.actions)){let n=i.get(r);if(!!n)t[n]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:r}}),!1)}!t.onclick&&(t.onclick=()=>!1),this.#iF()}_bindResetFormAction(t,e){let i=t.onclick;if(!i&&(t.href=this.linkService.getAnchorUrl("")),this.#iF(),!this._fieldObjects){S('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),!i&&(t.onclick=()=>!1);return}t.onclick=()=>{i?.();let{fields:t,refs:r,include:n}=e,s=[];if(0!==t.length||0!==r.length){let e=new Set(r);for(let i of t)for(let{id:t}of this._fieldObjects[i]||[])e.add(t);for(let t of Object.values(this._fieldObjects))for(let i of t)e.has(i.id)===n&&s.push(i)}else for(let t of Object.values(this._fieldObjects))s.push(...t);let a=this.annotationStorage,o=[];for(let t of s){let{id:e}=t;switch(o.push(e),t.type){case"text":{let i=t.defaultValue||"";a.setValue(e,{value:i});break}case"checkbox":case"radiobutton":{let i=t.defaultValue===t.exportValues;a.setValue(e,{value:i});break}case"combobox":case"listbox":{let i=t.defaultValue||"";a.setValue(e,{value:i});break}default:continue}let i=document.querySelector(`[data-element-id="${e}"]`);if(!!i){if(!it.has(i)){S(`_bindResetFormAction - element not allowed: ${e}`);continue}i.dispatchEvent(new Event("resetform"))}}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}),!1}}}class ia extends ir{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class io extends ir{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return z.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,r,n){i.includes("mouse")?t.addEventListener(i,t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}if(!!n)this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:n(t)}})})}_setEventListeners(t,e,i,r){for(let[n,s]of i)("Action"===s||this.data.actions?.[s])&&(("Focus"===s||"Blur"===s)&&(e||={focused:!1}),this._setEventListener(t,e,n,s,r),"Focus"!==s||this.data.actions?.Blur?"Blur"===s&&!this.data.actions?.Focus&&this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":G.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e;let{fontColor:i}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||9,n=t.style,s=t=>Math.round(10*t)/10;if(this.data.multiLine){let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),i=Math.round(t/(1.35*r))||1;e=Math.min(r,s(t/i/1.35))}else e=Math.min(r,s(Math.abs(this.data.rect[3]-this.data.rect[1]-2)/1.35));n.fontSize=`calc(${e}px * var(--scale-factor))`,n.color=G.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(n.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class il extends io{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,r){let n=this.annotationStorage;for(let s of this._getElementsByName(t.name,t.id))s.domElement&&(s.domElement[e]=i),n.setValue(s.id,{[r]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let r=t.getValue(e,{value:this.data.fieldValue}),n=r.value||"",s=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;s&&n.length>s&&(n=n.slice(0,s));let a=r.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));let o={userValue:n,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((i=document.createElement("textarea")).textContent=a??n,this.data.doNotScroll&&(i.style.overflowY="hidden")):((i=document.createElement("input")).type="text",i.setAttribute("value",a??n),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),it.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=1e3,this._setRequired(i,this.data.required),s&&(i.maxLength=s),i.addEventListener("input",r=>{t.setValue(e,{value:r.target.value}),this.setPropertyOnSiblings(i,"value",r.target.value,"value"),o.formattedValue=null}),i.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null});let l=t=>{let{formattedValue:e}=o;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",t=>{if(o.focused)return;let{target:e}=t;o.userValue&&(e.value=o.userValue),o.lastCommittedValue=e.value,o.commitKey=1,!this.data.actions?.Focus&&(o.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target);this._dispatchEventFromSandbox({value(i){o.userValue=i.detail.value??"",t.setValue(e,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){let{formattedValue:r}=i.detail;o.formattedValue=r,null!=r&&i.target!==document.activeElement&&(i.target.value=r),t.setValue(e,{formattedValue:r})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{let{charLimit:r}=i.detail,{target:n}=i;if(0===r){n.removeAttribute("maxLength");return}n.setAttribute("maxLength",r);let s=o.userValue;if(!!s&&!(s.length<=r))s=s.slice(0,r),n.value=o.userValue=s,t.setValue(e,{value:s}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:1,selStart:n.selectionStart,selEnd:n.selectionEnd}})}},i)}),i.addEventListener("keydown",t=>{o.commitKey=1;let i=-1;if("Escape"===t.key?i=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(o.commitKey=3):i=2,-1===i)return;let{value:r}=t.target;if(o.lastCommittedValue!==r)o.lastCommittedValue=r,o.userValue=r,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})});let r=l;l=null,i.addEventListener("blur",t=>{if(!o.focused||!t.relatedTarget)return;!this.data.actions?.Blur&&(o.focused=!1);let{value:i}=t.target;o.userValue=i,o.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:i,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}),r(t)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",t=>{o.lastCommittedValue=null;let{data:i,target:r}=t,{value:n,selectionStart:s,selectionEnd:a}=r,l=s,h=a;switch(t.inputType){case"deleteWordBackward":{let t=n.substring(0,s).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{let t=n.substring(s).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":s===a&&(l-=1);break;case"deleteContentForward":s===a&&(h+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,change:i||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(l&&i.addEventListener("blur",l),this.data.comb){let t=(this.data.rect[2]-this.data.rect[0])/s;i.classList.add("comb"),i.style.letterSpacing=`calc(${t}px * var(--scale-factor) - 1ch)`}}else(i=document.createElement("div")).textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class ih extends io{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class id extends io{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,i=e.id,r=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof r&&(r="Off"!==r,t.setValue(i,{value:r})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let n=document.createElement("input");return it.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,r&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=1e3,n.addEventListener("change",r=>{let{name:n,checked:s}=r.target;for(let r of this._getElementsByName(n,i)){let i=s&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:s})}),n.addEventListener("resetform",t=>{let i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class iu extends io{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,i=e.id,r=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof r&&(r=r!==e.buttonValue,t.setValue(i,{value:r})),r)for(let r of this._getElementsByName(e.fieldName,i))t.setValue(r.id,{value:!1});let n=document.createElement("input");if(it.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,r&&n.setAttribute("checked",!0),n.tabIndex=1e3,n.addEventListener("change",e=>{let{name:r,checked:n}=e.target;for(let e of this._getElementsByName(r,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:n})}),n.addEventListener("resetform",t=>{let i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){let r=e.buttonValue;n.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value:e=>{let n=r===e.detail.value;for(let r of this._getElementsByName(e.target.name)){let e=n&&r.id===i;r.domElement&&(r.domElement.checked=e),t.setValue(r.id,{value:e})}}},e)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class ic extends is{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class ip extends io{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),r=document.createElement("select");it.add(r),r.setAttribute("data-element-id",e),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=1e3;let n=this.data.combo&&this.data.options.length>0;for(let t of(!this.data.combo&&(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue;for(let t of r.options)t.selected=t.value===e}),this.data.options)){let e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),n=!1),r.append(e)}let s=null;if(n){let t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),r.prepend(t),s=()=>{t.remove(),r.removeEventListener("input",s),s=null},r.addEventListener("input",s)}let a=t=>{let e=t?"value":"textContent",{options:i,multiple:n}=r;return n?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]},o=a(!1),l=t=>{let e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({value(i){s?.();let n=i.detail.value,l=new Set(Array.isArray(n)?n:[n]);for(let t of r.options)t.selected=l.has(t.value);t.setValue(e,{value:a(!0)}),o=a(!1)},multipleSelection(t){r.multiple=!0},remove(i){let n=r.options,s=i.detail.remove;n[s].selected=!1,r.remove(s),n.length>0&&-1===Array.prototype.findIndex.call(n,t=>t.selected)&&(n[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},clear(i){for(;0!==r.length;)r.remove(0);t.setValue(e,{value:null,items:[]}),o=a(!1)},insert(i){let{index:n,displayValue:s,exportValue:h}=i.detail.insert,d=r.children[n],u=document.createElement("option");u.textContent=s,u.value=h,d?d.before(u):r.append(u),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},items(i){let{items:n}=i.detail;for(;0!==r.length;)r.remove(0);for(let t of n){let{displayValue:e,exportValue:i}=t,n=document.createElement("option");n.textContent=e,n.value=i,r.append(n)}r.options.length>0&&(r.options[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},indices(i){let r=new Set(i.detail.indices);for(let t of i.target.options)t.selected=r.has(t.index);t.setValue(e,{value:a(!0)}),o=a(!1)},editable(t){t.target.disabled=!t.detail.editable}},i)}),r.addEventListener("input",i=>{let r=a(!0),n=a(!1);t.setValue(e,{value:r}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:n,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):r.addEventListener("input",function(i){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class ig extends ir{constructor(t){let{data:e,elements:i}=t;super(t,{isRenderable:ir._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");let t=this.popup=new im({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(let i of this.elements)i.popup=t,e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(t=>`${Z}${t}`).join(",")),this.container}}class im{#iz=this.#iH.bind(this);#iG=this.#iU.bind(this);#iV=this.#iW.bind(this);#iZ=this.#i$.bind(this);#iY=null;#tm=null;#iX=null;#iK=null;#iq=null;#iJ=null;#iQ=null;#i0=!1;#i1=null;#A=null;#i2=null;#i5=null;#i3=null;#iO=null;#i4=!1;constructor({container:t,color:e,elements:i,titleObj:r,modificationDate:n,contentsObj:s,richText:a,parent:o,rect:l,parentRect:h,open:d}){for(let d of(this.#tm=t,this.#i3=r,this.#iX=s,this.#i5=a,this.#iJ=o,this.#iY=e,this.#i2=l,this.#iQ=h,this.#iq=i,this.#iK=tg.toDateObject(n),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),this.trigger))d.addEventListener("click",this.#iZ),d.addEventListener("mouseenter",this.#iV),d.addEventListener("mouseleave",this.#iG),d.classList.add("popupTriggerArea");for(let t of i)t.container?.addEventListener("keydown",this.#iz);this.#tm.hidden=!0,d&&this.#i$()}render(){if(this.#i1)return;let t=this.#i1=document.createElement("div");if(t.className="popup",this.#iY){let e=t.style.outlineColor=G.makeHexColor(...this.#iY);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`:t.style.backgroundColor=G.makeHexColor(...this.#iY.map(t=>Math.floor(.7*(255-t)+t)))}let e=document.createElement("span");e.className="header";let i=document.createElement("h1");if(e.append(i),{dir:i.dir,str:i.textContent}=this.#i3,t.append(e),this.#iK){let t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),t.setAttribute("data-l10n-args",JSON.stringify({date:this.#iK.toLocaleDateString(),time:this.#iK.toLocaleTimeString()})),e.append(t)}let r=this.#i6;if(r)e9.render({xfaHtml:r,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{let e=this._formatContents(this.#iX);t.append(e)}this.#tm.append(t)}get #i6(){let t=this.#i5,e=this.#iX;return t?.str&&(!e?.str||e.str===t.str)&&this.#i5.html||null}get #i8(){return this.#i6?.attributes?.style?.fontSize||0}get #i7(){return this.#i6?.attributes?.style?.color||null}#i9(t){let e=[],i={style:{color:this.#i7,fontSize:this.#i8?`calc(${this.#i8}px * var(--scale-factor))`:""}};for(let r of t.split("\n"))e.push({name:"span",value:r,attributes:i});return{str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}}}_formatContents({str:t,dir:e}){let i=document.createElement("p");i.classList.add("popupContent"),i.dir=e;let r=t.split(/(?:\r\n?|\n)/);for(let t=0,e=r.length;t{"Enter"===t.key&&(r?t.metaKey:t.ctrlKey)&&this.#ro()}),!i.popupRef&&this.hasPopupData?this._createPopup():t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return this.#ra}addHighlightArea(){this.container.classList.add("highlightArea")}#ro(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class iP{#rl=null;#rh=null;#rd=new Map;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:r,page:n,viewport:s}){this.div=t,this.#rl=e,this.#rh=i,this.page=n,this.viewport=s,this.zIndex=0,this._annotationEditorUIManager=r}#ru(t,e){let i=t.firstChild||t;i.id=`${Z}${e}`,this.div.append(t),this.#rl?.moveElementInDOM(this.div,t,i,!1)}async render(t){let{annotations:e}=t,i=this.div;tx(i,this.viewport);let r=new Map,n={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new tn,annotationStorage:t.annotationStorage||new tL,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let t of e){if(t.noHTML)continue;let e=t.annotationType===m.POPUP;if(e){let e=r.get(t.id);if(!e)continue;n.elements=e}else{let{width:e,height:i}=ie(t.rect);if(e<=0||i<=0)continue}n.data=t;let i=ii.create(n);if(!i.isRenderable)continue;if(!e&&t.popupRef){let e=r.get(t.popupRef);e?e.push(i):r.set(t.popupRef,[i])}let s=i.render();t.hidden&&(s.style.visibility="hidden"),this.#ru(s,t.id),i.annotationEditorType>0&&(this.#rd.set(i.data.id,i),this._annotationEditorUIManager?.renderAnnotationElement(i))}this.#rc()}update({viewport:t}){let e=this.div;this.viewport=t,tx(e,{rotation:t.rotation}),this.#rc(),e.hidden=!1}#rc(){if(!this.#rh)return;let t=this.div;for(let[e,i]of this.#rh){let r=t.querySelector(`[data-annotation-id="${e}"]`);if(!r)continue;i.className="annotationContent";let{firstChild:n}=r;n?"CANVAS"===n.nodeName?n.replaceWith(i):n.classList.contains("annotationContent")?n.after(i):n.before(i):r.append(i)}this.#rh.clear()}getEditableAnnotations(){return Array.from(this.#rd.values())}getEditableAnnotation(t){return this.#rd.get(t)}}let iR=/\r\n?|\n/g;class iO extends tP{#rp=this.editorDivBlur.bind(this);#rf=this.editorDivFocus.bind(this);#rg=this.editorDivInput.bind(this);#rm=this.editorDivKeydown.bind(this);#rv=this.editorDivPaste.bind(this);#iY;#rb="";#ry=`${this.id}-editor`;#i8;#rx=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=iO.prototype,e=t=>t.isEmpty(),i=tM.TRANSLATE_SMALL,r=tM.TRANSLATE_BIG;return k(this,"_keyboardManager",new tC([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,r],checker:e}]]))}static _type="freetext";static _editorType=u.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#iY=t.color||iO._defaultColor||tP._defaultLineColor,this.#i8=t.fontSize||iO._defaultFontSize}static initialize(t,e){tP.initialize(t,e,{strings:["pdfjs-free-text-default-content"]});let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case c.FREETEXT_SIZE:iO._defaultFontSize=e;break;case c.FREETEXT_COLOR:iO._defaultColor=e}}updateParams(t,e){switch(t){case c.FREETEXT_SIZE:this.#r_(e);break;case c.FREETEXT_COLOR:this.#rw(e)}}static get defaultPropertiesToUpdate(){return[[c.FREETEXT_SIZE,iO._defaultFontSize],[c.FREETEXT_COLOR,iO._defaultColor||tP._defaultLineColor]]}get propertiesToUpdate(){return[[c.FREETEXT_SIZE,this.#i8],[c.FREETEXT_COLOR,this.#iY]]}#r_(t){let e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-this.#i8)*this.parentScale),this.#i8=t,this.#rA()},i=this.#i8;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:c.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#rw(t){let e=t=>{this.#iY=this.editorDiv.style.color=t},i=this.#iY;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:c.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-iO._internalPadding*t,-(iO._internalPadding+this.#i8)*t]}rebuild(){if(!this.parent)return;if(super.rebuild(),null!==this.div)!this.isAttachedToDOM&&this.parent.add(this)}enableEditMode(){if(!this.isInEditMode())this.parent.setEditingState(!1),this.parent.updateToolbar(u.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",this.#rm),this.editorDiv.addEventListener("focus",this.#rf),this.editorDiv.addEventListener("blur",this.#rp),this.editorDiv.addEventListener("input",this.#rg),this.editorDiv.addEventListener("paste",this.#rv)}disableEditMode(){if(!!this.isInEditMode())this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#ry),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#rm),this.editorDiv.removeEventListener("focus",this.#rf),this.editorDiv.removeEventListener("blur",this.#rp),this.editorDiv.removeEventListener("input",this.#rg),this.editorDiv.removeEventListener("paste",this.#rv),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing")}focusin(t){if(!!this._focusEventsAllowed)super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){if(!this.width)this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#rS(){let t=[];for(let e of(this.editorDiv.normalize(),this.editorDiv.childNodes))t.push(iO.#rE(e));return t.join("\n")}#rA(){let t;let[e,i]=this.parentDimensions;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{let{currentLayer:e,div:i}=this,r=i.style.display,n=i.classList.contains("hidden");i.classList.remove("hidden"),i.style.display="hidden",e.div.append(this.div),t=i.getBoundingClientRect(),i.remove(),i.style.display=r,i.classList.toggle("hidden",n)}this.rotation%180==this.parentRotation%180?(this.width=t.width/e,this.height=t.height/i):(this.width=t.height/e,this.height=t.width/i),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#rb,e=this.#rb=this.#rS().trimEnd();if(t===e)return;let i=t=>{if(this.#rb=t,!t){this.remove();return}this.#rT(),this._uiManager.rebuild(this),this.#rA()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#rA()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){iO._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#ry),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),tP._l10nPromise.get("pdfjs-free-text-default-content").then(t=>this.editorDiv?.setAttribute("default-content",t)),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#i8}px * var(--scale-factor))`,i.color=this.#iY,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),tA(this,this.div,["dblclick","keydown"]),this.width){let[i,r]=this.parentDimensions;if(this.annotationElementId){let n,s;let{position:a}=this.#rx,[o,l]=this.getInitialTranslation();[o,l]=this.pageTranslationToScreen(o,l);let[h,d]=this.pageDimensions,[u,c]=this.pageTranslation;switch(this.rotation){case 0:n=t+(a[0]-u)/h,s=e+this.height-(a[1]-c)/d;break;case 90:n=t+(a[0]-u)/h,s=e-(a[1]-c)/d,[o,l]=[l,-o];break;case 180:n=t-this.width+(a[0]-u)/h,s=e-(a[1]-c)/d,[o,l]=[-o,-l];break;case 270:n=t+(a[0]-u-this.height*d)/h,s=e+(a[1]-c-this.width*h)/d,[o,l]=[-l,o]}this.setAt(n*i,s*r,o,l)}else this.setAt(t*i,e*r,this.width*i,this.height*r);this.#rT(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static #rE(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(iR,"")}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();let r=iO.#rC(e.getData("text")||"").replaceAll(iR,"\n");if(!r)return;let n=window.getSelection();if(!n.rangeCount)return;this.editorDiv.normalize(),n.deleteFromDocument();let s=n.getRangeAt(0);if(!r.includes("\n")){s.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),n.collapseToStart();return}let{startContainer:a,startOffset:o}=s,l=[],h=[];if(a.nodeType===Node.TEXT_NODE){let t=a.parentElement;if(h.push(a.nodeValue.slice(o).replaceAll(iR,"")),t!==this.editorDiv){let e=l;for(let i of this.editorDiv.childNodes){if(i===t){e=h;continue}e.push(iO.#rE(i))}}l.push(a.nodeValue.slice(0,o).replaceAll(iR,""))}else if(a===this.editorDiv){let t=l,e=0;for(let i of this.editorDiv.childNodes)e++===o&&(t=h),t.push(iO.#rE(i))}this.#rb=`${l.join("\n")}${r}${h.join("\n")}`,this.#rT();let d=new Range,u=l.reduce((t,e)=>t+e.length,0);for(let{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){let e=t.nodeValue.length;if(u<=e){d.setStart(t,u),d.setEnd(t,u);break}u-=e}n.removeAllRanges(),n.addRange(d)}#rT(){if(this.editorDiv.replaceChildren(),!!this.#rb)for(let t of this.#rb.split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#rk(){return this.#rb.replaceAll("\xa0"," ")}static #rC(t){return t.replaceAll(" ","\xa0")}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){let r=null;if(t instanceof iv){let{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:n,rotation:s,id:a},textContent:o,textPosition:l,parent:{page:{pageNumber:h}}}=t;if(!o||0===o.length)return null;r=t={annotationType:u.FREETEXT,color:Array.from(i),fontSize:e,value:o.join("\n"),position:l,pageIndex:h-1,rect:n.slice(0),rotation:s,id:a,deleted:!1}}let n=super.deserialize(t,e,i);return n.#i8=t.fontSize,n.#iY=G.makeHexColor(...t.color),n.#rb=iO.#rC(t.value),n.annotationElementId=t.id||null,n.#rx=r,n}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};let e=iO._internalPadding*this.parentScale,i=this.getRect(e,e),r=tP._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#iY),n={annotationType:u.FREETEXT,color:r,fontSize:this.#i8,value:this.#rk(),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!this.#rM(n)?null:(n.id=this.annotationElementId,n)}#rM(t){let{value:e,fontSize:i,color:r,pageIndex:n}=this.#rx;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==r[e])||t.pageIndex!==n}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(this.deleted)return e;let{style:i}=e;for(let t of(i.fontSize=`calc(${this.#i8}px * var(--scale-factor))`,i.color=this.#iY,e.replaceChildren(),this.#rb.split("\n"))){let i=document.createElement("div");i.append(t?document.createTextNode(t):document.createElement("br")),e.append(i)}let r=iO._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(r,r),popupContent:this.#rb}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class iI{#rB;#rP=[];#rR=[];constructor(t,e=0,i=0,r=!0){let n=1/0,s=-1/0,a=1/0,o=-1/0;for(let{x:i,y:r,width:l,height:h}of t){let t=1e-4*Math.floor((i-e)/1e-4),d=1e-4*Math.ceil((i+l+e)/1e-4),u=1e-4*Math.floor((r-e)/1e-4),c=1e-4*Math.ceil((r+h+e)/1e-4),p=[t,u,c,!0],f=[d,u,c,!1];this.#rP.push(p,f),n=Math.min(n,t),s=Math.max(s,d),a=Math.min(a,u),o=Math.max(o,c)}let l=s-n+2*i,h=o-a+2*i,d=n-i,u=a-i,c=this.#rP.at(r?-1:-2),p=[c[0],c[2]];for(let t of this.#rP){let[e,i,r]=t;t[0]=(e-d)/l,t[1]=(i-u)/h,t[2]=(r-u)/h}this.#rB={x:d,y:u,width:l,height:h,lastPoint:p}}getOutlines(){this.#rP.sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of this.#rP)e[3]?(t.push(...this.#rO(e)),this.#rI(e)):(this.#rL(e),t.push(...this.#rO(e)));return this.#rD(t)}#rD(t){let e;let i=[],r=new Set;for(let e of t){let[t,r,n]=e;i.push([t,r,e],[t,n,e])}i.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let t=0,e=i.length;t0;){let t=r.values().next().value,[i,s,a,o,l]=t;r.delete(t);let h=i,d=s;for(e=[i,a],n.push(e);;){let t;if(r.has(o))t=o;else if(r.has(l))t=l;else break;r.delete(t),[i,s,a,o,l]=t,h!==i&&(e.push(h,d,i,d===s?s:a),h=i),d=d===s?a:s}e.push(h,d)}return new iD(n,this.#rB)}#rN(t){let e=this.#rR,i=0,r=e.length-1;for(;i<=r;){let n=i+r>>1,s=e[n][0];if(s===t)return n;s=0;r--){let[i,n]=this.#rR[r];if(i!==t)break;if(i===t&&n===e){this.#rR.splice(r,1);return}}}#rO(t){let[e,i,r]=t,n=[[e,i,r]],s=this.#rN(r);for(let t=0;t=i){if(o>r)n[t][1]=r;else{if(1===s)return[];n.splice(t,1),t--,s--}continue}n[t][2]=i,o>r&&n.push([e,r,o])}}}return n}}class iL{toSVGPath(){throw Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof ij}}class iD extends iL{#rB;#rj;constructor(t,e){super(),this.#rj=t,this.#rB=e}toSVGPath(){let t=[];for(let e of this.#rj){let[i,r]=e;t.push(`M${i} ${r}`);for(let n=2;n=6;t-=6)isNaN(e[t])?c.push(`L${e[t+4]} ${e[t+5]}`):c.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);return c.push(`L${e[4]} ${e[5]} Z`),c.join(" ")}getOutlines(){let t=this.#rG,e=this.#rF,i=this.#rU,r=i.subarray(4,6),n=i.subarray(16,18),[s,a,o,l]=this.#rB,h=new Float64Array((this.#rK?.length??0)+2);for(let t=0,e=h.length-2;t=6;t-=6)for(let i=0;i<6;i+=2){if(isNaN(e[t+i])){f[g]=f[g+1]=NaN,g+=2;continue}f[g]=e[t+i],f[g+1]=e[t+i+1],g+=2}return f.set([NaN,NaN,NaN,NaN,e[4],e[5]],g),new ij(f,h,this.#rB,this.#rY,this.#rz,this.#rH)}}class ij extends iL{#rB;#r1=null;#rz;#rH;#rK;#rY;#r2;constructor(t,e,i,r,n,s){super(),this.#r2=t,this.#rK=e,this.#rB=i,this.#rY=r,this.#rz=n,this.#rH=s,this.#r5(s);let{x:a,y:o,width:l,height:h}=this.#r1;for(let e=0,i=t.length;e-1?(this.#nb=!0,this.#nE(t),this.#nT()):(this.#nh=t.anchorNode,this.#nd=t.anchorOffset,this.#nf=t.focusNode,this.#ng=t.focusOffset,this.#nC(),this.#nT(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#nb?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#rX,methodOfCreation:this.#nS}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#nC(){let t=new iI(this.#nu,.001);this.#nv=t.getOutlines(),{x:this.x,y:this.y,width:this.width,height:this.height}=this.#nv.box;let e=new iI(this.#nu,.0025,.001,"ltr"===this._uiManager.direction);this.#np=e.getOutlines();let{lastPoint:i}=this.#np.box;this.#nx=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#nE({highlightOutlines:t,highlightId:e,clipPathId:i}){this.#nv=t;if(this.#np=t.getNewOutline(this.#rX/2+1.5,.0025),e>=0)this.#m=e,this.#nc=i,this.parent.drawLayer.finalizeLine(e,t),this.#nw=this.parent.drawLayer.highlightOutline(this.#np);else if(this.parent){let e=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#m,t),this.parent.drawLayer.updateBox(this.#m,iz.#nk(this.#nv.box,(e-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#nw,this.#np),this.parent.drawLayer.updateBox(this.#nw,iz.#nk(this.#np.box,e))}let{x:r,y:n,width:s,height:a}=t.box;switch(this.rotation){case 0:this.x=r,this.y=n,this.width=s,this.height=a;break;case 90:{let[t,e]=this.parentDimensions;this.x=n,this.y=1-r,this.width=s*e/t,this.height=a*t/e;break}case 180:this.x=1-r,this.y=1-n,this.width=s,this.height=a;break;case 270:{let[t,e]=this.parentDimensions;this.x=1-n,this.y=r,this.width=s*e/t,this.height=a*t/e}}let{lastPoint:o}=this.#np.box;this.#nx=[(o[0]-r)/s,(o[1]-n)/a]}static initialize(t,e){tP.initialize(t,e),iz._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case c.HIGHLIGHT_DEFAULT_COLOR:iz._defaultColor=e;break;case c.HIGHLIGHT_THICKNESS:iz._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#nx}updateParams(t,e){switch(t){case c.HIGHLIGHT_COLOR:this.#rw(e);break;case c.HIGHLIGHT_THICKNESS:this.#nM(e)}}static get defaultPropertiesToUpdate(){return[[c.HIGHLIGHT_DEFAULT_COLOR,iz._defaultColor],[c.HIGHLIGHT_THICKNESS,iz._defaultThickness]]}get propertiesToUpdate(){return[[c.HIGHLIGHT_COLOR,this.color||iz._defaultColor],[c.HIGHLIGHT_THICKNESS,this.#rX||iz._defaultThickness],[c.HIGHLIGHT_FREE,this.#nb]]}#rw(t){let e=t=>{this.color=t,this.parent?.drawLayer.changeColor(this.#m,t),this.#r?.updateColor(t)},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:c.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#nM(t){let e=this.#rX,i=t=>{this.#rX=t,this.#nB(t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:c.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}async addEditToolbar(){let t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#r=new iF({editor:this}),t.addColorPicker(this.#r)),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#nP())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#nP())}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#nR(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){if(!this.parent)return;if(super.rebuild(),null!==this.div)this.#nT(),!this.isAttachedToDOM&&this.parent.add(this)}setParent(t){let e=!1;this.parent&&!t?this.#nR():t&&(this.#nT(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#nB(t){if(!this.#nb)return;this.#nE({highlightOutlines:this.#nv.getNewOutline(t/2)}),this.fixAndSetPosition();let[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}#nR(){if(null!==this.#m&&!!this.parent)this.parent.drawLayer.remove(this.#m),this.#m=null,this.parent.drawLayer.remove(this.#nw),this.#nw=null}#nT(t=this.parent){if(null===this.#m)({id:this.#m,clipPathId:this.#nc}=t.drawLayer.highlight(this.#nv,this.color,this.#n_)),this.#nw=t.drawLayer.highlightOutline(this.#np),this.#nm&&(this.#nm.style.clipPath=this.#nc)}static #nk({x:t,y:e,width:i,height:r},n){switch(n){case 90:return{x:1-e-r,y:t,width:r,height:i};case 180:return{x:1-t-i,y:1-e-r,width:i,height:r};case 270:return{x:e,y:1-t-i,width:r,height:i}}return{x:t,y:e,width:i,height:r}}rotate(t){let e;let{drawLayer:i}=this.parent;this.#nb?(t=(t-this.rotation+360)%360,e=iz.#nk(this.#nv.box,t)):e=iz.#nk(this,t),i.rotate(this.#m,t),i.rotate(this.#nw,t),i.updateBox(this.#m,e),i.updateBox(this.#nw,iz.#nk(this.#np.box,t))}render(){if(this.div)return this.div;let t=super.render();this.#nA&&(t.setAttribute("aria-label",this.#nA),t.setAttribute("role","mark")),this.#nb?t.classList.add("free"):this.div.addEventListener("keydown",this.#ts);let e=this.#nm=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#nc;let[i,r]=this.parentDimensions;return this.setDims(this.width*i,this.height*r),tA(this,this.#nm,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(this.#nw,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#nw,"hovered")}#ny(t){iz._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#nO(!0);break;case 1:case 3:this.#nO(!1)}}#nO(t){if(!this.#nh)return;let e=window.getSelection();t?e.setPosition(this.#nh,this.#nd):e.setPosition(this.#nf,this.#ng)}select(){if(super.select(),!!this.#nw)this.parent?.drawLayer.removeClass(this.#nw,"hovered"),this.parent?.drawLayer.addClass(this.#nw,"selected")}unselect(){if(super.unselect(),!!this.#nw)this.parent?.drawLayer.removeClass(this.#nw,"selected"),!this.#nb&&this.#nO(!1)}get _mustFixPosition(){return!this.#nb}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#m,t),this.parent.drawLayer.show(this.#nw,t))}#nP(){return this.#nb?this.rotation:0}#nI(){if(this.#nb)return null;let[t,e]=this.pageDimensions,i=this.#nu,r=Array(8*i.length),n=0;for(let{x:s,y:a,width:o,height:l}of i){let i=s*t,h=(1-a-l)*e;r[n]=r[n+4]=i,r[n+1]=r[n+3]=h,r[n+2]=r[n+6]=i+o*t,r[n+5]=r[n+7]=h+l*e,n+=8}return r}#nL(t){return this.#nv.serialize(t,this.#nP())}static startHighlighting(t,e,{target:i,x:r,y:n}){let{x:s,y:a,width:o,height:l}=i.getBoundingClientRect(),h=e=>{this.#nD(t,e)},d={capture:!0,passive:!1},u=t=>{t.preventDefault(),t.stopPropagation()},c=e=>{i.removeEventListener("pointermove",h),window.removeEventListener("blur",c),window.removeEventListener("pointerup",c),window.removeEventListener("pointerdown",u,d),window.removeEventListener("contextmenu",tp),this.#nN(t,e)};window.addEventListener("blur",c),window.addEventListener("pointerup",c),window.addEventListener("pointerdown",u,d),window.addEventListener("contextmenu",tp),i.addEventListener("pointermove",h),this._freeHighlight=new iN({x:r,y:n},[s,a,o,l],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static #nD(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static #nN(t,e){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static deserialize(t,e,i){let r=super.deserialize(t,e,i),{rect:[n,s,a,o],color:l,quadPoints:h}=t;r.color=G.makeHexColor(...l),r.#n_=t.opacity;let[d,u]=r.pageDimensions;r.width=(a-n)/d,r.height=(o-s)/u;let c=r.#nu=[];for(let t=0;t{this.thickness=t,this.#n0()},i=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:c.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#rw(t){let e=t=>{this.color=t,this.#n1()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:c.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#nQ(t){let e=t=>{this.opacity=t,this.#n1()};t/=100;let i=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:c.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){if(!this.parent)return;if(super.rebuild(),null!==this.div)!this.canvas&&(this.#n2(),this.#n5()),!this.isAttachedToDOM&&(this.parent.add(this),this.#n3()),this.#n0()}remove(){if(null!==this.canvas)!this.isEmpty()&&this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#nV&&(clearTimeout(this.#nV),this.#nV=null),this.#nX.disconnect(),this.#nX=null,super.remove()}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){let[t,e]=this.parentDimensions,i=this.width*t,r=this.height*e;this.setDimensions(i,r)}enableEditMode(){if(!this.#nZ&&null!==this.canvas)super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#nU)}disableEditMode(){if(!!this.isInEditMode()&&null!==this.canvas)super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#nU)}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#n4(){let{parentRotation:t,parentDimensions:[e,i]}=this;switch(t){case 90:return[0,i,i,e];case 180:return[e,i,e,i];case 270:return[e,0,i,e];default:return[0,0,e,i]}}#n6(){let{ctx:t,color:e,opacity:i,thickness:r,parentScale:n,scaleFactor:s}=this;t.lineWidth=r*n/s,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${Math.round(Math.min(255,Math.max(1,255*i))).toString(16).padStart(2,"0")}`}#n8(t,e){this.canvas.addEventListener("contextmenu",tp),this.canvas.addEventListener("pointerleave",this.#nH),this.canvas.addEventListener("pointermove",this.#nz),this.canvas.addEventListener("pointerup",this.#nG),this.canvas.removeEventListener("pointerdown",this.#nU),this.isEditing=!0,!this.#nY&&(this.#nY=!0,this.#n3(),this.thickness||=iH._defaultThickness,this.color||=iH._defaultColor||tP._defaultLineColor,this.opacity??=iH._defaultOpacity),this.currentPath.push([t,e]),this.#n$=!1,this.#n6(),this.#nJ=()=>{this.#n7(),this.#nJ&&window.requestAnimationFrame(this.#nJ)},window.requestAnimationFrame(this.#nJ)}#n9(t,e){let[i,r]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===r)return;let n=this.currentPath,s=this.#nW;if(n.push([t,e]),this.#n$=!0,n.length<=2){s.moveTo(...n[0]),s.lineTo(t,e);return}3===n.length&&(this.#nW=s=new Path2D,s.moveTo(...n[0])),this.#st(s,...n.at(-3),...n.at(-2),t,e)}#se(){if(0===this.currentPath.length)return;let t=this.currentPath.at(-1);this.#nW.lineTo(...t)}#si(t,e){let i;if(this.#nJ=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#n9(t,e),this.#se(),1!==this.currentPath.length)i=this.#sr();else{let r=[t,e];i=[[r,r.slice(),r.slice(),r]]}let r=this.#nW,n=this.currentPath;this.currentPath=[],this.#nW=new Path2D;this.addCommands({cmd:()=>{this.allRawPaths.push(n),this.paths.push(i),this.bezierPath2D.push(r),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(!this.canvas&&(this.#n2(),this.#n5()),this.#n0())},mustExec:!0})}#n7(){if(!this.#n$)return;this.#n$=!1,this.thickness,this.parentScale;let t=this.currentPath.slice(-3);t.map(t=>t[0]),t.map(t=>t[1]);let{ctx:e}=this;for(let t of(e.save(),e.clearRect(0,0,this.canvas.width,this.canvas.height),this.bezierPath2D))e.stroke(t);e.stroke(this.#nW),e.restore()}#st(t,e,i,r,n,s,a){let o=(e+r)/2,l=(i+n)/2,h=(r+s)/2,d=(n+a)/2;t.bezierCurveTo(o+2*(r-o)/3,l+2*(n-l)/3,h+2*(r-h)/3,d+2*(n-d)/3,h,d)}#sr(){let t;let e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];let i=[],[r,n]=e[0];for(t=1;t{this.#nV=null,this.canvas.removeEventListener("contextmenu",tp)},10),this.#si(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#n2(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#n5(){this.#nX=new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}),this.#nX.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#nZ}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");let[i,r,n,s]=this.#n4();if(this.setAt(i,r,0,0),this.setDims(n,s),this.#n2(),this.width){let[i,r]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*r),this.setAt(t*i,e*r,this.width*i,this.height*r),this.#nY=!0,this.#n3(),this.setDims(this.width*i,this.height*r),this.#n1(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#n5(),this.div}#n3(){if(!this.#nY)return;let[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#sn()}setDimensions(t,e){let i=Math.round(t),r=Math.round(e);if(this.#nK===i&&this.#nq===r)return;this.#nK=i,this.#nq=r,this.canvas.style.visibility="hidden";let[n,s]=this.parentDimensions;this.width=t/n,this.height=e/s,this.fixAndSetPosition(),this.#nZ&&this.#sa(t,e),this.#n3(),this.#n1(),this.canvas.style.visibility="visible",this.fixDims()}#sa(t,e){let i=this.#so(),r=(t-i)/this.#nF,n=(e-i)/this.#nj;this.scaleFactor=Math.min(r,n)}#sn(){let t=this.#so()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static #sl(t){let e=new Path2D;for(let i=0,r=t.length;i`image/${t}`))}static get supportedTypesStr(){return k(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(u.STAMP,{bitmapFile:t.getAsFile()})}#sA(t,e=!1){if(!t){this.remove();return}this.#sp=t.bitmap,!e&&(this.#sf=t.id,this.#s_=t.isSvg),t.file&&(this.#sb=t.file.name),this.#n2()}#sS(){this.#sg=null,this._uiManager.enableWaiting(!1),this.#sy&&this.div.focus()}#sE(){if(this.#sf){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#sf).then(t=>this.#sA(t,!0)).finally(()=>this.#sS());return}if(this.#sm){let t=this.#sm;this.#sm=null,this._uiManager.enableWaiting(!0),this.#sg=this._uiManager.imageManager.getFromUrl(t).then(t=>this.#sA(t)).finally(()=>this.#sS());return}if(this.#sv){let t=this.#sv;this.#sv=null,this._uiManager.enableWaiting(!0),this.#sg=this._uiManager.imageManager.getFromFile(t).then(t=>this.#sA(t)).finally(()=>this.#sS());return}let t=document.createElement("input");t.type="file",t.accept=iG.supportedTypesStr,this.#sg=new Promise(e=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);let e=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#sA(e)}else this.remove();e()}),t.addEventListener("cancel",()=>{this.remove(),e()})}).finally(()=>this.#sS()),t.click()}remove(){this.#sf&&(this.#sp=null,this._uiManager.imageManager.deleteId(this.#sf),this.#sy?.remove(),this.#sy=null,this.#nX?.disconnect(),this.#nX=null,this.#sx&&(clearTimeout(this.#sx),this.#sx=null)),super.remove()}rebuild(){if(!this.parent){this.#sf&&this.#sE();return}if(super.rebuild(),null!==this.div)this.#sf&&null===this.#sy&&this.#sE(),!this.isAttachedToDOM&&this.parent.add(this)}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#sg||this.#sp||this.#sm||this.#sv||this.#sf)}get isResizable(){return!0}render(){let t,e;if(this.div)return this.div;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),this.#sp?this.#n2():this.#sE(),this.width){let[i,r]=this.parentDimensions;this.setAt(t*i,e*r,this.width*i,this.height*r)}return this.div}#n2(){let{div:t}=this,{width:e,height:i}=this.#sp,[r,n]=this.pageDimensions;if(this.width)e=this.width*r,i=this.height*n;else if(e>.75*r||i>.75*n){let t=Math.min(.75*r/e,.75*n/i);e*=t,i*=t}let[s,a]=this.parentDimensions;this.setDims(e*s/r,i*a/n),this._uiManager.enableWaiting(!1);let o=this.#sy=document.createElement("canvas");t.append(o),t.hidden=!1,this.#sT(e,i),this.#n5(),!this.#sw&&(this.parent.addUndoableEditor(this),this.#sw=!0),this._reportTelemetry({action:"inserted_image"}),this.#sb&&o.setAttribute("aria-label",this.#sb)}#sC(t,e){let[i,r]=this.parentDimensions;this.width=t/i,this.height=e/r,this.setDims(t,e),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#sx&&clearTimeout(this.#sx);this.#sx=setTimeout(()=>{this.#sx=null,this.#sT(t,e)},200)}#sk(t,e){let{width:i,height:r}=this.#sp,n=i,s=r,a=this.#sp;for(;n>2*t||s>2*e;){let i=n,r=s;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2));let o=new OffscreenCanvas(n,s);o.getContext("2d").drawImage(a,0,0,i,r,0,0,n,s),a=o.transferToImageBitmap()}return a}#sT(t,e){t=Math.ceil(t),e=Math.ceil(e);let i=this.#sy;if(!i||i.width===t&&i.height===e)return;i.width=t,i.height=e;let r=this.#s_?this.#sp:this.#sk(t,e);if(this._uiManager.hasMLManager&&!this.hasAltText()){let i=new OffscreenCanvas(t,e).getContext("2d");i.drawImage(r,0,0,r.width,r.height,0,0,t,e),this._uiManager.mlGuess({service:"image-to-text",request:{data:i.getImageData(0,0,t,e).data,width:t,height:e,channels:4}}).then(t=>{let e=t?.output||"";this.parent&&e&&!this.hasAltText()&&(this.altTextData={altText:e,decorative:!1})})}let n=i.getContext("2d");n.filter=this._uiManager.hcmFilter,n.drawImage(r,0,0,r.width,r.height,0,0,t,e)}getImageForAltText(){return this.#sy}#sM(t){if(t){if(this.#s_){let t=this._uiManager.imageManager.getSvgUrl(this.#sf);if(t)return t}let t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#sp,t.getContext("2d").drawImage(this.#sp,0,0),t.toDataURL()}if(this.#s_){let[t,e]=this.pageDimensions,i=Math.round(this.width*t*tt.PDF_TO_CSS_UNITS),r=Math.round(this.height*e*tt.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,r);return n.getContext("2d").drawImage(this.#sp,0,0,this.#sp.width,this.#sp.height,0,0,i,r),n.transferToImageBitmap()}return structuredClone(this.#sp)}#n5(){this.#nX=new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.#sC(e.width,e.height)}),this.#nX.observe(this.div)}static deserialize(t,e,i){if(t instanceof iM)return null;let r=super.deserialize(t,e,i),{rect:n,bitmapUrl:s,bitmapId:a,isSvg:o,accessibilityData:l}=t;a&&i.imageManager.isValidId(a)?r.#sf=a:r.#sm=s,r.#s_=o;let[h,d]=r.pageDimensions;return r.width=(n[2]-n[0])/h,r.height=(n[3]-n[1])/d,l&&(r.altTextData=l),r}serialize(t=!1,e=null){if(this.isEmpty())return null;let i={annotationType:u.STAMP,bitmapId:this.#sf,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#s_,structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=this.#sM(!0),i.accessibilityData=this.altTextData,i;let{decorative:r,altText:n}=this.altTextData;if(!r&&n&&(i.accessibilityData={type:"Figure",alt:n}),null===e)return i;e.stamps||=new Map;let s=this.#s_?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#sf)){if(this.#s_){let t=e.stamps.get(this.#sf);s>t.area&&(t.area=s,t.serialized.bitmap.close(),t.serialized.bitmap=this.#sM(!1))}}else e.stamps.set(this.#sf,{area:s,serialized:i}),i.bitmap=this.#sM(!1);return i}}class iU{#rl;#sB=!1;#sP=null;#sR=null;#sO=null;#sI=null;#sL=null;#sD=new Map;#sN=!1;#sj=!1;#sF=!1;#sz=null;#c;static _initialized=!1;static #L=new Map([iO,iH,iG,iz].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:i,accessibilityManager:r,annotationLayer:n,drawLayer:s,textLayer:a,viewport:o,l10n:l}){let h=[...iU.#L.values()];if(!iU._initialized)for(let e of(iU._initialized=!0,h))e.initialize(l,t);t.registerEditorTypes(h),this.#c=t,this.pageIndex=e,this.div=i,this.#rl=r,this.#sP=n,this.viewport=o,this.#sz=a,this.drawLayer=s,this.#c.addLayer(this)}get isEmpty(){return 0===this.#sD.size}get isInvisible(){return this.isEmpty&&this.#c.getMode()===u.NONE}updateToolbar(t){this.#c.updateToolbar(t)}updateMode(t=this.#c.getMode()){switch(this.#sH(),t){case u.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case u.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case u.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;for(let i of iU.#L.values())e.toggle(`${i._type}Editing`,t===i._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#sz?.div}addInkEditorIfNeeded(t){if(this.#c.getMode()===u.INK){if(!t){for(let t of this.#sD.values())if(t.isEmpty()){t.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){this.#c.setEditingState(t)}addCommands(t){this.#c.addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#sP?.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);let t=new Set;for(let e of this.#sD.values())e.enableEditing(),e.show(!0),e.annotationElementId&&(this.#c.removeChangedExistingAnnotation(e),t.add(e.annotationElementId));if(!!this.#sP)for(let e of this.#sP.getEditableAnnotations()){if(e.hide(),this.#c.isDeletedAnnotationElement(e.data.id)||t.has(e.data.id))continue;let i=this.deserialize(e);if(!!i)this.addOrRebuild(i),i.enableEditing()}}disable(){this.#sF=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);let t=new Map,e=new Map;for(let i of this.#sD.values()){if(i.disableEditing(),!!i.annotationElementId){if(null!==i.serialize()){t.set(i.annotationElementId,i);continue}e.set(i.annotationElementId,i);this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()}}if(this.#sP)for(let i of this.#sP.getEditableAnnotations()){let{id:r}=i.data;if(this.#c.isDeletedAnnotationElement(r))continue;let n=e.get(r);if(n){n.resetAnnotationElement(i),n.show(!1),i.show();continue}(n=t.get(r))&&(this.#c.addChangedExistingAnnotation(n),n.renderAnnotationElement(i),n.show(!1)),i.show()}this.#sH(),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let t of iU.#L.values())i.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#sF=!1}getEditableAnnotation(t){return this.#sP?.getEditableAnnotation(t)||null}setActiveEditor(t){if(this.#c.getActive()!==t)this.#c.setActiveEditor(t)}enableTextSelection(){this.div.tabIndex=-1,this.#sz?.div&&!this.#sI&&(this.#sI=this.#sG.bind(this),this.#sz.div.addEventListener("pointerdown",this.#sI),this.#sz.div.classList.add("highlighting"))}disableTextSelection(){this.div.tabIndex=0,this.#sz?.div&&this.#sI&&(this.#sz.div.removeEventListener("pointerdown",this.#sI),this.#sI=null,this.#sz.div.classList.remove("highlighting"))}#sG(t){if(this.#c.unselectAll(),t.target===this.#sz.div){let{isMac:e}=z.platform;if(0===t.button&&(!t.ctrlKey||!e))this.#c.showAllEditors("highlight",!0,!0),this.#sz.div.classList.add("free"),iz.startHighlighting(this,"ltr"===this.#c.direction,t),this.#sz.div.addEventListener("pointerup",()=>{this.#sz.div.classList.remove("free")},{once:!0}),t.preventDefault()}}enableClick(){if(!this.#sO)this.#sO=this.pointerdown.bind(this),this.#sR=this.pointerup.bind(this),this.div.addEventListener("pointerdown",this.#sO),this.div.addEventListener("pointerup",this.#sR)}disableClick(){if(!!this.#sO)this.div.removeEventListener("pointerdown",this.#sO),this.div.removeEventListener("pointerup",this.#sR),this.#sO=null,this.#sR=null}attach(t){this.#sD.set(t.id,t);let{annotationElementId:e}=t;e&&this.#c.isDeletedAnnotationElement(e)&&this.#c.removeDeletedAnnotationElement(t)}detach(t){this.#sD.delete(t.id),this.#rl?.removePointerInTextLayer(t.contentDiv),!this.#sF&&t.annotationElementId&&this.#c.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#c.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,!this.#sj&&this.addInkEditorIfNeeded(!1)}changeParent(t){if(t.parent!==this)t.parent&&t.annotationElementId&&(this.#c.addDeletedAnnotationElement(t.annotationElementId),tP.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),this.#c.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#c.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!this.#sL&&(t._focusEventsAllowed=!1,this.#sL=setTimeout(()=>{this.#sL=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus())},0)),t._structTreeParentId=this.#rl?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#c.getId()}get #sU(){return iU.#L.get(this.#c.getMode())}#sV(t){let e=this.#sU;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#sU?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#c.updateToolbar(t),this.#c.updateMode(t);let{offsetX:i,offsetY:r}=this.#sW(),n=this.getNextId(),s=this.#sV({parent:this,id:n,x:i,y:r,uiManager:this.#c,isCentered:!0,...e});s&&this.add(s)}deserialize(t){return iU.#L.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#c)||null}createAndAddNewEditor(t,e,i={}){let r=this.getNextId(),n=this.#sV({parent:this,id:r,x:t.offsetX,y:t.offsetY,uiManager:this.#c,isCentered:e,...i});return n&&this.add(n),n}#sW(){let{x:t,y:e,width:i,height:r}=this.div.getBoundingClientRect(),n=Math.max(0,t),s=Math.max(0,e),a=Math.min(window.innerWidth,t+i),o=Math.min(window.innerHeight,e+r),l=(n+a)/2-t,h=(s+o)/2-e,[d,u]=this.viewport.rotation%180==0?[l,h]:[h,l];return{offsetX:d,offsetY:u}}addNewEditor(){this.createAndAddNewEditor(this.#sW(),!0)}setSelected(t){this.#c.setSelected(t)}toggleSelected(t){this.#c.toggleSelected(t)}isSelected(t){return this.#c.isSelected(t)}unselect(t){this.#c.unselect(t)}pointerup(t){let{isMac:e}=z.platform;if(0===t.button&&(!t.ctrlKey||!e)&&t.target===this.div&&!!this.#sN){if(this.#sN=!1,!this.#sB){this.#sB=!0;return}if(this.#c.getMode()===u.STAMP){this.#c.unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(this.#c.getMode()===u.HIGHLIGHT&&this.enableTextSelection(),this.#sN){this.#sN=!1;return}let{isMac:e}=z.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div)return;this.#sN=!0;let i=this.#c.getActive();this.#sB=!i||i.isEmpty()}findNewParent(t,e,i){let r=this.#c.findParent(e,i);return null!==r&&r!==this&&(r.changeParent(t),!0)}destroy(){for(let t of(this.#c.getActive()?.parent===this&&(this.#c.commitOrRemove(),this.#c.setActiveEditor(null)),this.#sL&&(clearTimeout(this.#sL),this.#sL=null),this.#sD.values()))this.#rl?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#sD.clear(),this.#c.removeLayer(this)}#sH(){for(let t of(this.#sj=!0,this.#sD.values()))t.isEmpty()&&t.remove();this.#sj=!1}render({viewport:t}){for(let e of(this.viewport=t,tx(this.div,t),this.#c.getEditors(this.pageIndex)))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#c.commitOrRemove(),this.#sH();let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,tx(this.div,{rotation:i}),e!==i)for(let t of this.#sD.values())t.rotate(i);this.addInkEditorIfNeeded(!1)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#c.viewParameters.realScale}}class iV{#iJ=null;#m=0;#sZ=new Map;#s$=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(!this.#iJ){this.#iJ=t;return}if(this.#iJ!==t){if(this.#sZ.size>0)for(let e of this.#sZ.values())e.remove(),t.append(e);this.#iJ=t}}static get _svgFactory(){return k(this,"_svgFactory",new tn)}static #sY(t,{x:e=0,y:i=0,width:r=1,height:n=1}={}){let{style:s}=t;s.top=`${100*i}%`,s.left=`${100*e}%`,s.width=`${100*r}%`,s.height=`${100*n}%`}#sX(t){let e=iV._svgFactory.create(1,1,!0);return this.#iJ.append(e),e.setAttribute("aria-hidden",!0),iV.#sY(e,t),e}#sK(t,e){let i=iV._svgFactory.createElement("clipPath");t.append(i);let r=`clip_${e}`;i.setAttribute("id",r),i.setAttribute("clipPathUnits","objectBoundingBox");let n=iV._svgFactory.createElement("use");return i.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),r}highlight(t,e,i,r=!1){let n=this.#m++,s=this.#sX(t.box);s.classList.add("highlight"),t.free&&s.classList.add("free");let a=iV._svgFactory.createElement("defs");s.append(a);let o=iV._svgFactory.createElement("path");a.append(o);let l=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",l),o.setAttribute("d",t.toSVGPath()),r&&this.#s$.set(n,o);let h=this.#sK(a,l),d=iV._svgFactory.createElement("use");return s.append(d),s.setAttribute("fill",e),s.setAttribute("fill-opacity",i),d.setAttribute("href",`#${l}`),this.#sZ.set(n,s),{id:n,clipPathId:`url(#${h})`}}highlightOutline(t){let e;let i=this.#m++,r=this.#sX(t.box);r.classList.add("highlightOutline");let n=iV._svgFactory.createElement("defs");r.append(n);let s=iV._svgFactory.createElement("path");n.append(s);let a=`path_p${this.pageIndex}_${i}`;if(s.setAttribute("id",a),s.setAttribute("d",t.toSVGPath()),s.setAttribute("vector-effect","non-scaling-stroke"),t.free){r.classList.add("free");let t=iV._svgFactory.createElement("mask");n.append(t),e=`mask_p${this.pageIndex}_${i}`,t.setAttribute("id",e),t.setAttribute("maskUnits","objectBoundingBox");let s=iV._svgFactory.createElement("rect");t.append(s),s.setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","white");let o=iV._svgFactory.createElement("use");t.append(o),o.setAttribute("href",`#${a}`),o.setAttribute("stroke","none"),o.setAttribute("fill","black"),o.setAttribute("fill-rule","nonzero"),o.classList.add("mask")}let o=iV._svgFactory.createElement("use");r.append(o),o.setAttribute("href",`#${a}`),e&&o.setAttribute("mask",`url(#${e})`);let l=o.cloneNode();return r.append(l),o.classList.add("mainOutline"),l.classList.add("secondaryOutline"),this.#sZ.set(i,r),i}finalizeLine(t,e){let i=this.#s$.get(t);this.#s$.delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){this.#sZ.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),this.#s$.delete(t)}updatePath(t,e){this.#s$.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){iV.#sY(this.#sZ.get(t),e)}show(t,e){this.#sZ.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#sZ.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#sZ.get(t).setAttribute("fill",e)}changeOpacity(t,e){this.#sZ.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#sZ.get(t).classList.add(e)}removeClass(t,e){this.#sZ.get(t).classList.remove(e)}remove(t){if(null!==this.#iJ)this.#sZ.get(t).remove(),this.#sZ.delete(t)}destroy(){for(let t of(this.#iJ=null,this.#sZ.values()))t.remove();this.#sZ.clear()}}s.AbortException,s.AnnotationEditorLayer,s.AnnotationEditorParamsType,s.AnnotationEditorType,s.AnnotationEditorUIManager,s.AnnotationLayer,s.AnnotationMode,s.CMapCompressionType,s.ColorPicker,s.DOMSVGFactory,s.DrawLayer,s.FeatureTest;var iW=s.GlobalWorkerOptions;s.ImageKind,s.InvalidPDFException,s.MissingPDFException,s.OPS,s.Outliner,s.PDFDataRangeTransport,s.PDFDateString,s.PDFWorker,s.PasswordResponses,s.PermissionFlag,s.PixelsPerInch,s.RenderingCancelledException,s.TextLayer,s.UnexpectedResponseException,s.Util,s.VerbosityLevel,s.XfaLayer,s.build,s.createValidAbsoluteUrl,s.fetchData;var iZ=s.getDocument;s.getFilenameFromUrl,s.getPdfFilenameFromUrl,s.getXfaPageViewport,s.isDataScheme,s.isPdfFile,s.noContextMenu,s.normalizeUnicode,s.renderTextLayer,s.setLayerDimensions,s.shadow,s.updateTextLayer,s.version}}]); //# sourceMappingURL=1464.31794191.js.map