stats.html 141 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  7. <title>RollUp Visualizer</title>
  8. <style>
  9. :root {
  10. --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
  11. "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  12. --background-color: #2b2d42;
  13. --text-color: #edf2f4;
  14. }
  15. html {
  16. box-sizing: border-box;
  17. }
  18. *,
  19. *:before,
  20. *:after {
  21. box-sizing: inherit;
  22. }
  23. html {
  24. background-color: var(--background-color);
  25. color: var(--text-color);
  26. font-family: var(--font-family);
  27. }
  28. body {
  29. padding: 0;
  30. margin: 0;
  31. }
  32. html,
  33. body {
  34. height: 100%;
  35. width: 100%;
  36. overflow: hidden;
  37. }
  38. body {
  39. display: flex;
  40. flex-direction: column;
  41. }
  42. svg {
  43. vertical-align: middle;
  44. width: 100%;
  45. height: 100%;
  46. max-height: 100vh;
  47. }
  48. main {
  49. flex-grow: 1;
  50. height: 100vh;
  51. padding: 20px;
  52. }
  53. .tooltip {
  54. position: absolute;
  55. z-index: 1070;
  56. border: 2px solid;
  57. border-radius: 5px;
  58. padding: 5px;
  59. white-space: nowrap;
  60. font-size: 0.875rem;
  61. background-color: var(--background-color);
  62. color: var(--text-color);
  63. }
  64. .tooltip-hidden {
  65. visibility: hidden;
  66. opacity: 0;
  67. }
  68. .sidebar {
  69. position: fixed;
  70. top: 0;
  71. left: 0;
  72. right: 0;
  73. display: flex;
  74. flex-direction: row;
  75. font-size: 0.7rem;
  76. align-items: center;
  77. margin: 0 50px;
  78. height: 20px;
  79. }
  80. .size-selectors {
  81. display: flex;
  82. flex-direction: row;
  83. align-items: center;
  84. }
  85. .size-selector {
  86. display: flex;
  87. flex-direction: row;
  88. align-items: center;
  89. justify-content: center;
  90. margin-right: 1rem;
  91. }
  92. .size-selector input {
  93. margin: 0 0.3rem 0 0;
  94. }
  95. .filters {
  96. flex: 1;
  97. display: flex;
  98. flex-direction: row;
  99. align-items: center;
  100. }
  101. .module-filters {
  102. display: flex;
  103. }
  104. .module-filter {
  105. display: flex;
  106. flex-direction: row;
  107. align-items: center;
  108. justify-content: center;
  109. flex: 1;
  110. }
  111. .module-filter input {
  112. flex: 1;
  113. height: 1rem;
  114. padding: 0.01rem;
  115. font-size: 0.7rem;
  116. margin-left: 0.3rem;
  117. }
  118. .module-filter + .module-filter {
  119. margin-left: 0.5rem;
  120. }
  121. </style>
  122. </head>
  123. <body>
  124. <main></main>
  125. <script>
  126. /*<!--*/
  127. var drawChart = (function (exports) {
  128. 'use strict';
  129. var n,l$1,u$1,t$1,o$2,r$1,f$1={},e$1=[],c$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$1(n,l){for(var u in l)n[u]=l[u];return n}function a$1(n){var l=n.parentNode;l&&l.removeChild(n);}function h$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$1(l,f,t,o,null)}function v$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function p$1(n){return n.children}function d$1(n,l){this.props=n,this.context=l;}function _$2(n,l){if(null==l)return n.__?_$2(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$2(n):null}function k$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$1(n)}}function b$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!g$1.__r++||o$2!==l$1.debounceRendering)&&((o$2=l$1.debounceRendering)||setTimeout)(g$1);}function g$1(){for(var n;g$1.__r=t$1.length;)n=t$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$1({},t)).__v=t.__v+1,j$1(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$2(t):o,t.__h),z$1(u,t),t.__e!=o&&k$1(t)));});}function w$1(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$1,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(p$1,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$1(n,k,d=d||f$1,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$1(k,s,n):s=A$1(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$2(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h]);}function m$1(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$1(i,l,u):A$1(u,i,i,t,i.__e,l));return l}function A$1(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$1(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$1.test(l)?u:u+"px";}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$1(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d$1(g,x),h.constructor=T,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$1({},h.__s)),s$1(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$1.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s$1(s$1({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p$1&&null==a.key?a.props.children:a,w$1(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l$1.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),h=(y=i.props||f$1).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$1(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$1(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$2(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$1(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1));}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$1(n.__e),n.__=n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$1(i,u=(!o&&t||i).__k=h$1(p$1,null,[u]),r||f$1,f$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$1(e,u);}function B$2(n,l){var u={__c:l="__cC"+r$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b$1);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,d$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$1({},this.state),"function"==typeof n&&(n=n(s$1({},u),this.props)),n&&s$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$1(this));},d$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$1(this));},d$1.prototype.render=p$1,t$1=[],g$1.__r=0,r$1=0;
  130. var _$1=0;function o$1(o,e,n,t,f){var l,s,u={};for(s in e)"ref"==s?l=e[s]:u[s]=e[s];var a={type:o,props:u,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--_$1,__source:f,__self:t};if("function"==typeof o&&(l=o.defaultProps))for(s in l)void 0===u[s]&&(u[s]=l[s]);return l$1.vnode&&l$1.vnode(a),a}
  131. function count$1(node) {
  132. var sum = 0,
  133. children = node.children,
  134. i = children && children.length;
  135. if (!i) sum = 1;
  136. else while (--i >= 0) sum += children[i].value;
  137. node.value = sum;
  138. }
  139. function node_count() {
  140. return this.eachAfter(count$1);
  141. }
  142. function node_each(callback, that) {
  143. let index = -1;
  144. for (const node of this) {
  145. callback.call(that, node, ++index, this);
  146. }
  147. return this;
  148. }
  149. function node_eachBefore(callback, that) {
  150. var node = this, nodes = [node], children, i, index = -1;
  151. while (node = nodes.pop()) {
  152. callback.call(that, node, ++index, this);
  153. if (children = node.children) {
  154. for (i = children.length - 1; i >= 0; --i) {
  155. nodes.push(children[i]);
  156. }
  157. }
  158. }
  159. return this;
  160. }
  161. function node_eachAfter(callback, that) {
  162. var node = this, nodes = [node], next = [], children, i, n, index = -1;
  163. while (node = nodes.pop()) {
  164. next.push(node);
  165. if (children = node.children) {
  166. for (i = 0, n = children.length; i < n; ++i) {
  167. nodes.push(children[i]);
  168. }
  169. }
  170. }
  171. while (node = next.pop()) {
  172. callback.call(that, node, ++index, this);
  173. }
  174. return this;
  175. }
  176. function node_find(callback, that) {
  177. let index = -1;
  178. for (const node of this) {
  179. if (callback.call(that, node, ++index, this)) {
  180. return node;
  181. }
  182. }
  183. }
  184. function node_sum(value) {
  185. return this.eachAfter(function(node) {
  186. var sum = +value(node.data) || 0,
  187. children = node.children,
  188. i = children && children.length;
  189. while (--i >= 0) sum += children[i].value;
  190. node.value = sum;
  191. });
  192. }
  193. function node_sort(compare) {
  194. return this.eachBefore(function(node) {
  195. if (node.children) {
  196. node.children.sort(compare);
  197. }
  198. });
  199. }
  200. function node_path(end) {
  201. var start = this,
  202. ancestor = leastCommonAncestor(start, end),
  203. nodes = [start];
  204. while (start !== ancestor) {
  205. start = start.parent;
  206. nodes.push(start);
  207. }
  208. var k = nodes.length;
  209. while (end !== ancestor) {
  210. nodes.splice(k, 0, end);
  211. end = end.parent;
  212. }
  213. return nodes;
  214. }
  215. function leastCommonAncestor(a, b) {
  216. if (a === b) return a;
  217. var aNodes = a.ancestors(),
  218. bNodes = b.ancestors(),
  219. c = null;
  220. a = aNodes.pop();
  221. b = bNodes.pop();
  222. while (a === b) {
  223. c = a;
  224. a = aNodes.pop();
  225. b = bNodes.pop();
  226. }
  227. return c;
  228. }
  229. function node_ancestors() {
  230. var node = this, nodes = [node];
  231. while (node = node.parent) {
  232. nodes.push(node);
  233. }
  234. return nodes;
  235. }
  236. function node_descendants() {
  237. return Array.from(this);
  238. }
  239. function node_leaves() {
  240. var leaves = [];
  241. this.eachBefore(function(node) {
  242. if (!node.children) {
  243. leaves.push(node);
  244. }
  245. });
  246. return leaves;
  247. }
  248. function node_links() {
  249. var root = this, links = [];
  250. root.each(function(node) {
  251. if (node !== root) { // Don’t include the root’s parent, if any.
  252. links.push({source: node.parent, target: node});
  253. }
  254. });
  255. return links;
  256. }
  257. function* node_iterator() {
  258. var node = this, current, next = [node], children, i, n;
  259. do {
  260. current = next.reverse(), next = [];
  261. while (node = current.pop()) {
  262. yield node;
  263. if (children = node.children) {
  264. for (i = 0, n = children.length; i < n; ++i) {
  265. next.push(children[i]);
  266. }
  267. }
  268. }
  269. } while (next.length);
  270. }
  271. function hierarchy(data, children) {
  272. if (data instanceof Map) {
  273. data = [undefined, data];
  274. if (children === undefined) children = mapChildren;
  275. } else if (children === undefined) {
  276. children = objectChildren;
  277. }
  278. var root = new Node$1(data),
  279. node,
  280. nodes = [root],
  281. child,
  282. childs,
  283. i,
  284. n;
  285. while (node = nodes.pop()) {
  286. if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
  287. node.children = childs;
  288. for (i = n - 1; i >= 0; --i) {
  289. nodes.push(child = childs[i] = new Node$1(childs[i]));
  290. child.parent = node;
  291. child.depth = node.depth + 1;
  292. }
  293. }
  294. }
  295. return root.eachBefore(computeHeight);
  296. }
  297. function node_copy() {
  298. return hierarchy(this).eachBefore(copyData);
  299. }
  300. function objectChildren(d) {
  301. return d.children;
  302. }
  303. function mapChildren(d) {
  304. return Array.isArray(d) ? d[1] : null;
  305. }
  306. function copyData(node) {
  307. if (node.data.value !== undefined) node.value = node.data.value;
  308. node.data = node.data.data;
  309. }
  310. function computeHeight(node) {
  311. var height = 0;
  312. do node.height = height;
  313. while ((node = node.parent) && (node.height < ++height));
  314. }
  315. function Node$1(data) {
  316. this.data = data;
  317. this.depth =
  318. this.height = 0;
  319. this.parent = null;
  320. }
  321. Node$1.prototype = hierarchy.prototype = {
  322. constructor: Node$1,
  323. count: node_count,
  324. each: node_each,
  325. eachAfter: node_eachAfter,
  326. eachBefore: node_eachBefore,
  327. find: node_find,
  328. sum: node_sum,
  329. sort: node_sort,
  330. path: node_path,
  331. ancestors: node_ancestors,
  332. descendants: node_descendants,
  333. leaves: node_leaves,
  334. links: node_links,
  335. copy: node_copy,
  336. [Symbol.iterator]: node_iterator
  337. };
  338. function required(f) {
  339. if (typeof f !== "function") throw new Error;
  340. return f;
  341. }
  342. function constantZero() {
  343. return 0;
  344. }
  345. function constant$1(x) {
  346. return function() {
  347. return x;
  348. };
  349. }
  350. function roundNode(node) {
  351. node.x0 = Math.round(node.x0);
  352. node.y0 = Math.round(node.y0);
  353. node.x1 = Math.round(node.x1);
  354. node.y1 = Math.round(node.y1);
  355. }
  356. function treemapDice(parent, x0, y0, x1, y1) {
  357. var nodes = parent.children,
  358. node,
  359. i = -1,
  360. n = nodes.length,
  361. k = parent.value && (x1 - x0) / parent.value;
  362. while (++i < n) {
  363. node = nodes[i], node.y0 = y0, node.y1 = y1;
  364. node.x0 = x0, node.x1 = x0 += node.value * k;
  365. }
  366. }
  367. Object.create(Node$1.prototype);
  368. function treemapSlice(parent, x0, y0, x1, y1) {
  369. var nodes = parent.children,
  370. node,
  371. i = -1,
  372. n = nodes.length,
  373. k = parent.value && (y1 - y0) / parent.value;
  374. while (++i < n) {
  375. node = nodes[i], node.x0 = x0, node.x1 = x1;
  376. node.y0 = y0, node.y1 = y0 += node.value * k;
  377. }
  378. }
  379. var phi = (1 + Math.sqrt(5)) / 2;
  380. function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
  381. var rows = [],
  382. nodes = parent.children,
  383. row,
  384. nodeValue,
  385. i0 = 0,
  386. i1 = 0,
  387. n = nodes.length,
  388. dx, dy,
  389. value = parent.value,
  390. sumValue,
  391. minValue,
  392. maxValue,
  393. newRatio,
  394. minRatio,
  395. alpha,
  396. beta;
  397. while (i0 < n) {
  398. dx = x1 - x0, dy = y1 - y0;
  399. // Find the next non-empty node.
  400. do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);
  401. minValue = maxValue = sumValue;
  402. alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
  403. beta = sumValue * sumValue * alpha;
  404. minRatio = Math.max(maxValue / beta, beta / minValue);
  405. // Keep adding nodes while the aspect ratio maintains or improves.
  406. for (; i1 < n; ++i1) {
  407. sumValue += nodeValue = nodes[i1].value;
  408. if (nodeValue < minValue) minValue = nodeValue;
  409. if (nodeValue > maxValue) maxValue = nodeValue;
  410. beta = sumValue * sumValue * alpha;
  411. newRatio = Math.max(maxValue / beta, beta / minValue);
  412. if (newRatio > minRatio) { sumValue -= nodeValue; break; }
  413. minRatio = newRatio;
  414. }
  415. // Position and record the row orientation.
  416. rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});
  417. if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
  418. else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
  419. value -= sumValue, i0 = i1;
  420. }
  421. return rows;
  422. }
  423. var squarify = (function custom(ratio) {
  424. function squarify(parent, x0, y0, x1, y1) {
  425. squarifyRatio(ratio, parent, x0, y0, x1, y1);
  426. }
  427. squarify.ratio = function(x) {
  428. return custom((x = +x) > 1 ? x : 1);
  429. };
  430. return squarify;
  431. })(phi);
  432. function treemap() {
  433. var tile = squarify,
  434. round = false,
  435. dx = 1,
  436. dy = 1,
  437. paddingStack = [0],
  438. paddingInner = constantZero,
  439. paddingTop = constantZero,
  440. paddingRight = constantZero,
  441. paddingBottom = constantZero,
  442. paddingLeft = constantZero;
  443. function treemap(root) {
  444. root.x0 =
  445. root.y0 = 0;
  446. root.x1 = dx;
  447. root.y1 = dy;
  448. root.eachBefore(positionNode);
  449. paddingStack = [0];
  450. if (round) root.eachBefore(roundNode);
  451. return root;
  452. }
  453. function positionNode(node) {
  454. var p = paddingStack[node.depth],
  455. x0 = node.x0 + p,
  456. y0 = node.y0 + p,
  457. x1 = node.x1 - p,
  458. y1 = node.y1 - p;
  459. if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
  460. if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
  461. node.x0 = x0;
  462. node.y0 = y0;
  463. node.x1 = x1;
  464. node.y1 = y1;
  465. if (node.children) {
  466. p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
  467. x0 += paddingLeft(node) - p;
  468. y0 += paddingTop(node) - p;
  469. x1 -= paddingRight(node) - p;
  470. y1 -= paddingBottom(node) - p;
  471. if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
  472. if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
  473. tile(node, x0, y0, x1, y1);
  474. }
  475. }
  476. treemap.round = function(x) {
  477. return arguments.length ? (round = !!x, treemap) : round;
  478. };
  479. treemap.size = function(x) {
  480. return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];
  481. };
  482. treemap.tile = function(x) {
  483. return arguments.length ? (tile = required(x), treemap) : tile;
  484. };
  485. treemap.padding = function(x) {
  486. return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
  487. };
  488. treemap.paddingInner = function(x) {
  489. return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$1(+x), treemap) : paddingInner;
  490. };
  491. treemap.paddingOuter = function(x) {
  492. return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
  493. };
  494. treemap.paddingTop = function(x) {
  495. return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$1(+x), treemap) : paddingTop;
  496. };
  497. treemap.paddingRight = function(x) {
  498. return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$1(+x), treemap) : paddingRight;
  499. };
  500. treemap.paddingBottom = function(x) {
  501. return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$1(+x), treemap) : paddingBottom;
  502. };
  503. treemap.paddingLeft = function(x) {
  504. return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$1(+x), treemap) : paddingLeft;
  505. };
  506. return treemap;
  507. }
  508. var treemapResquarify = (function custom(ratio) {
  509. function resquarify(parent, x0, y0, x1, y1) {
  510. if ((rows = parent._squarify) && (rows.ratio === ratio)) {
  511. var rows,
  512. row,
  513. nodes,
  514. i,
  515. j = -1,
  516. n,
  517. m = rows.length,
  518. value = parent.value;
  519. while (++j < m) {
  520. row = rows[j], nodes = row.children;
  521. for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;
  522. if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1);
  523. else treemapSlice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1);
  524. value -= row.value;
  525. }
  526. } else {
  527. parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);
  528. rows.ratio = ratio;
  529. }
  530. }
  531. resquarify.ratio = function(x) {
  532. return custom((x = +x) > 1 ? x : 1);
  533. };
  534. return resquarify;
  535. })(phi);
  536. const isModuleTree = (mod) => "children" in mod;
  537. let count = 0;
  538. class Id {
  539. constructor(id) {
  540. this._id = id;
  541. const url = new URL(window.location.href);
  542. url.hash = id;
  543. this._href = url.toString();
  544. }
  545. get id() {
  546. return this._id;
  547. }
  548. get href() {
  549. return this._href;
  550. }
  551. toString() {
  552. return `url(${this.href})`;
  553. }
  554. }
  555. function generateUniqueId(name) {
  556. count += 1;
  557. const id = ["O", name, count].filter(Boolean).join("-");
  558. return new Id(id);
  559. }
  560. const LABELS = {
  561. renderedLength: "Rendered",
  562. gzipLength: "Gzip",
  563. brotliLength: "Brotli",
  564. };
  565. const getAvailableSizeOptions = (options) => {
  566. const availableSizeProperties = ["renderedLength"];
  567. if (options.gzip) {
  568. availableSizeProperties.push("gzipLength");
  569. }
  570. if (options.brotli) {
  571. availableSizeProperties.push("brotliLength");
  572. }
  573. return availableSizeProperties;
  574. };
  575. var t,r,u,i,o=0,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function p(n){return o=1,y(B$1,n)}function y(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.u)){r.u=!0;var f=r.shouldComponentUpdate;r.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h(u,i){var o=d(t++,3);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o));}function s(u,i){var o=d(t++,4);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o));}function _(n){return o=5,F(function(){return {current:n}},[])}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){"function"!=typeof n.type||n.__m||null===n.__?n.__m||(n.__m=n.__&&n.__.__m?n.__.__m:""):n.__m=(n.__&&n.__.__m?n.__.__m:"")+(n.__&&n.__.__k?n.__.__k.indexOf(n):0),r=null,e&&e(n);},l$1.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[])),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));}function k(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function w(n){var t=r;n.__c=n.__(),r=t;}function z(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B$1(n,t){return "function"==typeof t?t(n):t}
  576. const SideBar = ({ availableSizeProperties, sizeProperty, setSizeProperty, onExcludeChange, onIncludeChange, }) => {
  577. const [includeValue, setIncludeValue] = p("");
  578. const [excludeValue, setExcludeValue] = p("");
  579. const handleSizePropertyChange = (sizeProp) => () => {
  580. if (sizeProp !== sizeProperty) {
  581. setSizeProperty(sizeProp);
  582. }
  583. };
  584. const handleIncludeChange = (event) => {
  585. const value = event.currentTarget.value;
  586. setIncludeValue(value);
  587. onIncludeChange(value);
  588. };
  589. const handleExcludeChange = (event) => {
  590. const value = event.currentTarget.value;
  591. setExcludeValue(value);
  592. onExcludeChange(value);
  593. };
  594. return (o$1("aside", Object.assign({ className: "sidebar" }, { children: [o$1("div", Object.assign({ className: "size-selectors" }, { children: availableSizeProperties.length > 1 &&
  595. availableSizeProperties.map((sizeProp) => {
  596. const id = `selector-${sizeProp}`;
  597. return (o$1("div", Object.assign({ className: "size-selector" }, { children: [o$1("input", { type: "radio", id: id, checked: sizeProp === sizeProperty, onChange: handleSizePropertyChange(sizeProp) }), o$1("label", Object.assign({ htmlFor: id }, { children: LABELS[sizeProp] }))] }), sizeProp));
  598. }) })), o$1("div", Object.assign({ className: "module-filters" }, { children: [o$1("div", Object.assign({ className: "module-filter" }, { children: [o$1("label", Object.assign({ htmlFor: "module-filter-exclude" }, { children: "Exclude" })), o$1("input", { type: "text", id: "module-filter-exclude", value: excludeValue, onInput: handleExcludeChange, placeholder: "RegExp" })] })), o$1("div", Object.assign({ className: "module-filter" }, { children: [o$1("label", Object.assign({ htmlFor: "module-filter-include" }, { children: "Include" })), o$1("input", { type: "text", id: "module-filter-include", value: includeValue, onInput: handleIncludeChange, placeholder: "RegExp" })] }))] }))] })));
  599. };
  600. const throttleFilter = (callback, limit) => {
  601. let waiting = false;
  602. return (val) => {
  603. if (!waiting) {
  604. callback(val);
  605. waiting = true;
  606. setTimeout(() => {
  607. waiting = false;
  608. }, limit);
  609. }
  610. };
  611. };
  612. const useFilter = () => {
  613. const [includeFilter, setIncludeFilter] = p("");
  614. const [excludeFilter, setExcludeFilter] = p("");
  615. const setIncludeFilterTrottled = F(() => throttleFilter(setIncludeFilter, 200), []);
  616. const setExcludeFilterTrottled = F(() => throttleFilter(setExcludeFilter, 200), []);
  617. const isModuleIncluded = F(() => {
  618. if (includeFilter === "") {
  619. return () => true;
  620. }
  621. try {
  622. const re = new RegExp(includeFilter);
  623. return ({ id }) => re.test(id);
  624. }
  625. catch (err) {
  626. return () => false;
  627. }
  628. }, [includeFilter]);
  629. const isModuleExcluded = F(() => {
  630. if (excludeFilter === "") {
  631. return () => false;
  632. }
  633. try {
  634. const re = new RegExp(excludeFilter);
  635. return ({ id }) => re.test(id);
  636. }
  637. catch (err) {
  638. return () => false;
  639. }
  640. }, [excludeFilter]);
  641. const isDefaultInclude = includeFilter === "";
  642. const getModuleFilterMultiplier = F(() => {
  643. return (data) => {
  644. if (isDefaultInclude) {
  645. return isModuleExcluded(data) ? 0 : 1;
  646. }
  647. return isModuleExcluded(data) && !isModuleIncluded(data) ? 0 : 1;
  648. };
  649. }, [isDefaultInclude, isModuleExcluded, isModuleIncluded]);
  650. return {
  651. getModuleFilterMultiplier,
  652. includeFilter,
  653. excludeFilter,
  654. setExcludeFilter: setExcludeFilterTrottled,
  655. setIncludeFilter: setIncludeFilterTrottled,
  656. };
  657. };
  658. function ascending(a, b) {
  659. return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
  660. }
  661. function descending(a, b) {
  662. return a == null || b == null ? NaN
  663. : b < a ? -1
  664. : b > a ? 1
  665. : b >= a ? 0
  666. : NaN;
  667. }
  668. function bisector(f) {
  669. let compare1, compare2, delta;
  670. // If an accessor is specified, promote it to a comparator. In this case we
  671. // can test whether the search value is (self-) comparable. We can’t do this
  672. // for a comparator (except for specific, known comparators) because we can’t
  673. // tell if the comparator is symmetric, and an asymmetric comparator can’t be
  674. // used to test whether a single value is comparable.
  675. if (f.length !== 2) {
  676. compare1 = ascending;
  677. compare2 = (d, x) => ascending(f(d), x);
  678. delta = (d, x) => f(d) - x;
  679. } else {
  680. compare1 = f === ascending || f === descending ? f : zero$1;
  681. compare2 = f;
  682. delta = f;
  683. }
  684. function left(a, x, lo = 0, hi = a.length) {
  685. if (lo < hi) {
  686. if (compare1(x, x) !== 0) return hi;
  687. do {
  688. const mid = (lo + hi) >>> 1;
  689. if (compare2(a[mid], x) < 0) lo = mid + 1;
  690. else hi = mid;
  691. } while (lo < hi);
  692. }
  693. return lo;
  694. }
  695. function right(a, x, lo = 0, hi = a.length) {
  696. if (lo < hi) {
  697. if (compare1(x, x) !== 0) return hi;
  698. do {
  699. const mid = (lo + hi) >>> 1;
  700. if (compare2(a[mid], x) <= 0) lo = mid + 1;
  701. else hi = mid;
  702. } while (lo < hi);
  703. }
  704. return lo;
  705. }
  706. function center(a, x, lo = 0, hi = a.length) {
  707. const i = left(a, x, lo, hi - 1);
  708. return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
  709. }
  710. return {left, center, right};
  711. }
  712. function zero$1() {
  713. return 0;
  714. }
  715. function number$1(x) {
  716. return x === null ? NaN : +x;
  717. }
  718. const ascendingBisect = bisector(ascending);
  719. const bisectRight = ascendingBisect.right;
  720. bisector(number$1).center;
  721. class InternMap extends Map {
  722. constructor(entries, key = keyof) {
  723. super();
  724. Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
  725. if (entries != null) for (const [key, value] of entries) this.set(key, value);
  726. }
  727. get(key) {
  728. return super.get(intern_get(this, key));
  729. }
  730. has(key) {
  731. return super.has(intern_get(this, key));
  732. }
  733. set(key, value) {
  734. return super.set(intern_set(this, key), value);
  735. }
  736. delete(key) {
  737. return super.delete(intern_delete(this, key));
  738. }
  739. }
  740. function intern_get({_intern, _key}, value) {
  741. const key = _key(value);
  742. return _intern.has(key) ? _intern.get(key) : value;
  743. }
  744. function intern_set({_intern, _key}, value) {
  745. const key = _key(value);
  746. if (_intern.has(key)) return _intern.get(key);
  747. _intern.set(key, value);
  748. return value;
  749. }
  750. function intern_delete({_intern, _key}, value) {
  751. const key = _key(value);
  752. if (_intern.has(key)) {
  753. value = _intern.get(key);
  754. _intern.delete(key);
  755. }
  756. return value;
  757. }
  758. function keyof(value) {
  759. return value !== null && typeof value === "object" ? value.valueOf() : value;
  760. }
  761. function identity$2(x) {
  762. return x;
  763. }
  764. function group(values, ...keys) {
  765. return nest(values, identity$2, identity$2, keys);
  766. }
  767. function nest(values, map, reduce, keys) {
  768. return (function regroup(values, i) {
  769. if (i >= keys.length) return reduce(values);
  770. const groups = new InternMap();
  771. const keyof = keys[i++];
  772. let index = -1;
  773. for (const value of values) {
  774. const key = keyof(value, ++index, values);
  775. const group = groups.get(key);
  776. if (group) group.push(value);
  777. else groups.set(key, [value]);
  778. }
  779. for (const [key, values] of groups) {
  780. groups.set(key, regroup(values, i));
  781. }
  782. return map(groups);
  783. })(values, 0);
  784. }
  785. var e10 = Math.sqrt(50),
  786. e5 = Math.sqrt(10),
  787. e2 = Math.sqrt(2);
  788. function ticks(start, stop, count) {
  789. var reverse,
  790. i = -1,
  791. n,
  792. ticks,
  793. step;
  794. stop = +stop, start = +start, count = +count;
  795. if (start === stop && count > 0) return [start];
  796. if (reverse = stop < start) n = start, start = stop, stop = n;
  797. if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
  798. if (step > 0) {
  799. let r0 = Math.round(start / step), r1 = Math.round(stop / step);
  800. if (r0 * step < start) ++r0;
  801. if (r1 * step > stop) --r1;
  802. ticks = new Array(n = r1 - r0 + 1);
  803. while (++i < n) ticks[i] = (r0 + i) * step;
  804. } else {
  805. step = -step;
  806. let r0 = Math.round(start * step), r1 = Math.round(stop * step);
  807. if (r0 / step < start) ++r0;
  808. if (r1 / step > stop) --r1;
  809. ticks = new Array(n = r1 - r0 + 1);
  810. while (++i < n) ticks[i] = (r0 + i) / step;
  811. }
  812. if (reverse) ticks.reverse();
  813. return ticks;
  814. }
  815. function tickIncrement(start, stop, count) {
  816. var step = (stop - start) / Math.max(0, count),
  817. power = Math.floor(Math.log(step) / Math.LN10),
  818. error = step / Math.pow(10, power);
  819. return power >= 0
  820. ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
  821. : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
  822. }
  823. function tickStep(start, stop, count) {
  824. var step0 = Math.abs(stop - start) / Math.max(0, count),
  825. step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
  826. error = step0 / step1;
  827. if (error >= e10) step1 *= 10;
  828. else if (error >= e5) step1 *= 5;
  829. else if (error >= e2) step1 *= 2;
  830. return stop < start ? -step1 : step1;
  831. }
  832. const TOP_PADDING = 20;
  833. const PADDING = 2;
  834. const Node = ({ node, onMouseOver, onClick, selected }) => {
  835. const { getModuleColor } = q(StaticContext);
  836. const { backgroundColor, fontColor } = getModuleColor(node);
  837. const { x0, x1, y1, y0, data, children = null } = node;
  838. const textRef = _(null);
  839. const textRectRef = _();
  840. const width = x1 - x0;
  841. const height = y1 - y0;
  842. const textProps = {
  843. "font-size": "0.7em",
  844. "dominant-baseline": "middle",
  845. "text-anchor": "middle",
  846. x: width / 2,
  847. };
  848. if (children != null) {
  849. textProps.y = (TOP_PADDING + PADDING) / 2;
  850. }
  851. else {
  852. textProps.y = height / 2;
  853. }
  854. s(() => {
  855. if (width == 0 || height == 0 || !textRef.current) {
  856. return;
  857. }
  858. if (textRectRef.current == null) {
  859. textRectRef.current = textRef.current.getBoundingClientRect();
  860. }
  861. let scale = 1;
  862. if (children != null) {
  863. scale = Math.min((width * 0.9) / textRectRef.current.width, Math.min(height, TOP_PADDING + PADDING) / textRectRef.current.height);
  864. scale = Math.min(1, scale);
  865. textRef.current.setAttribute("y", String(Math.min(TOP_PADDING + PADDING, height) / 2 / scale));
  866. textRef.current.setAttribute("x", String(width / 2 / scale));
  867. }
  868. else {
  869. scale = Math.min((width * 0.9) / textRectRef.current.width, (height * 0.9) / textRectRef.current.height);
  870. scale = Math.min(1, scale);
  871. textRef.current.setAttribute("y", String(height / 2 / scale));
  872. textRef.current.setAttribute("x", String(width / 2 / scale));
  873. }
  874. textRef.current.setAttribute("transform", `scale(${scale.toFixed(2)})`);
  875. }, [children, height, width]);
  876. if (width == 0 || height == 0) {
  877. return null;
  878. }
  879. return (o$1("g", Object.assign({ className: "node", transform: `translate(${x0},${y0})`, onClick: (event) => {
  880. event.stopPropagation();
  881. onClick(node);
  882. }, onMouseOver: (event) => {
  883. event.stopPropagation();
  884. onMouseOver(node);
  885. } }, { children: [o$1("rect", { fill: backgroundColor, rx: 2, ry: 2, width: x1 - x0, height: y1 - y0, stroke: selected ? "#fff" : undefined, "stroke-width": selected ? 2 : undefined }), o$1("text", Object.assign({ ref: textRef, fill: fontColor, onClick: (event) => {
  886. var _a;
  887. if (((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) !== "") {
  888. event.stopPropagation();
  889. }
  890. } }, textProps, { children: data.name }))] })));
  891. };
  892. const TreeMap = ({ root, onNodeHover, selectedNode, onNodeClick, }) => {
  893. const { width, height, getModuleIds } = q(StaticContext);
  894. console.time("layering");
  895. // this will make groups by height
  896. const nestedData = F(() => {
  897. const nestedDataMap = group(root.descendants(), (d) => d.height);
  898. const nestedData = Array.from(nestedDataMap, ([key, values]) => ({
  899. key,
  900. values,
  901. }));
  902. nestedData.sort((a, b) => b.key - a.key);
  903. return nestedData;
  904. }, [root]);
  905. console.timeEnd("layering");
  906. return (o$1("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}` }, { children: nestedData.map(({ key, values }) => {
  907. return (o$1("g", Object.assign({ className: "layer" }, { children: values.map((node) => {
  908. return (o$1(Node, { node: node, onMouseOver: onNodeHover, selected: selectedNode === node, onClick: onNodeClick }, getModuleIds(node.data).nodeUid.id));
  909. }) }), key));
  910. }) })));
  911. };
  912. var bytes$1 = {exports: {}};
  913. /*!
  914. * bytes
  915. * Copyright(c) 2012-2014 TJ Holowaychuk
  916. * Copyright(c) 2015 Jed Watson
  917. * MIT Licensed
  918. */
  919. /**
  920. * Module exports.
  921. * @public
  922. */
  923. bytes$1.exports = bytes;
  924. var format_1 = bytes$1.exports.format = format$1;
  925. bytes$1.exports.parse = parse;
  926. /**
  927. * Module variables.
  928. * @private
  929. */
  930. var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
  931. var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
  932. var map$1 = {
  933. b: 1,
  934. kb: 1 << 10,
  935. mb: 1 << 20,
  936. gb: 1 << 30,
  937. tb: Math.pow(1024, 4),
  938. pb: Math.pow(1024, 5),
  939. };
  940. var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
  941. /**
  942. * Convert the given value in bytes into a string or parse to string to an integer in bytes.
  943. *
  944. * @param {string|number} value
  945. * @param {{
  946. * case: [string],
  947. * decimalPlaces: [number]
  948. * fixedDecimals: [boolean]
  949. * thousandsSeparator: [string]
  950. * unitSeparator: [string]
  951. * }} [options] bytes options.
  952. *
  953. * @returns {string|number|null}
  954. */
  955. function bytes(value, options) {
  956. if (typeof value === 'string') {
  957. return parse(value);
  958. }
  959. if (typeof value === 'number') {
  960. return format$1(value, options);
  961. }
  962. return null;
  963. }
  964. /**
  965. * Format the given value in bytes into a string.
  966. *
  967. * If the value is negative, it is kept as such. If it is a float,
  968. * it is rounded.
  969. *
  970. * @param {number} value
  971. * @param {object} [options]
  972. * @param {number} [options.decimalPlaces=2]
  973. * @param {number} [options.fixedDecimals=false]
  974. * @param {string} [options.thousandsSeparator=]
  975. * @param {string} [options.unit=]
  976. * @param {string} [options.unitSeparator=]
  977. *
  978. * @returns {string|null}
  979. * @public
  980. */
  981. function format$1(value, options) {
  982. if (!Number.isFinite(value)) {
  983. return null;
  984. }
  985. var mag = Math.abs(value);
  986. var thousandsSeparator = (options && options.thousandsSeparator) || '';
  987. var unitSeparator = (options && options.unitSeparator) || '';
  988. var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
  989. var fixedDecimals = Boolean(options && options.fixedDecimals);
  990. var unit = (options && options.unit) || '';
  991. if (!unit || !map$1[unit.toLowerCase()]) {
  992. if (mag >= map$1.pb) {
  993. unit = 'PB';
  994. } else if (mag >= map$1.tb) {
  995. unit = 'TB';
  996. } else if (mag >= map$1.gb) {
  997. unit = 'GB';
  998. } else if (mag >= map$1.mb) {
  999. unit = 'MB';
  1000. } else if (mag >= map$1.kb) {
  1001. unit = 'KB';
  1002. } else {
  1003. unit = 'B';
  1004. }
  1005. }
  1006. var val = value / map$1[unit.toLowerCase()];
  1007. var str = val.toFixed(decimalPlaces);
  1008. if (!fixedDecimals) {
  1009. str = str.replace(formatDecimalsRegExp, '$1');
  1010. }
  1011. if (thousandsSeparator) {
  1012. str = str.split('.').map(function (s, i) {
  1013. return i === 0
  1014. ? s.replace(formatThousandsRegExp, thousandsSeparator)
  1015. : s
  1016. }).join('.');
  1017. }
  1018. return str + unitSeparator + unit;
  1019. }
  1020. /**
  1021. * Parse the string value into an integer in bytes.
  1022. *
  1023. * If no unit is given, it is assumed the value is in bytes.
  1024. *
  1025. * @param {number|string} val
  1026. *
  1027. * @returns {number|null}
  1028. * @public
  1029. */
  1030. function parse(val) {
  1031. if (typeof val === 'number' && !isNaN(val)) {
  1032. return val;
  1033. }
  1034. if (typeof val !== 'string') {
  1035. return null;
  1036. }
  1037. // Test if the string passed is valid
  1038. var results = parseRegExp.exec(val);
  1039. var floatValue;
  1040. var unit = 'b';
  1041. if (!results) {
  1042. // Nothing could be extracted from the given string
  1043. floatValue = parseInt(val, 10);
  1044. unit = 'b';
  1045. } else {
  1046. // Retrieve the value and the unit
  1047. floatValue = parseFloat(results[1]);
  1048. unit = results[4].toLowerCase();
  1049. }
  1050. if (isNaN(floatValue)) {
  1051. return null;
  1052. }
  1053. return Math.floor(map$1[unit] * floatValue);
  1054. }
  1055. const Tooltip_marginX = 10;
  1056. const Tooltip_marginY = 30;
  1057. const SOURCEMAP_RENDERED = (o$1("span", { children: [" ", o$1("b", { children: LABELS.renderedLength }), " is a number of characters in the file after individual and ", o$1("br", {}), " ", "whole bundle transformations according to sourcemap."] }));
  1058. const RENDRED = (o$1("span", { children: [o$1("b", { children: LABELS.renderedLength }), " is a byte size of individual file after transformations and treeshake."] }));
  1059. const COMPRESSED = (o$1("span", { children: [o$1("b", { children: LABELS.gzipLength }), " and ", o$1("b", { children: LABELS.brotliLength }), " is a byte size of individual file after individual transformations,", o$1("br", {}), " treeshake and compression."] }));
  1060. const Tooltip = ({ node, visible, root, sizeProperty, }) => {
  1061. const { availableSizeProperties, getModuleSize, data } = q(StaticContext);
  1062. const ref = _(null);
  1063. const [style, setStyle] = p({});
  1064. const content = F(() => {
  1065. if (!node)
  1066. return null;
  1067. const mainSize = getModuleSize(node.data, sizeProperty);
  1068. const percentageNum = (100 * mainSize) / getModuleSize(root.data, sizeProperty);
  1069. const percentage = percentageNum.toFixed(2);
  1070. const percentageString = percentage + "%";
  1071. const path = node
  1072. .ancestors()
  1073. .reverse()
  1074. .map((d) => d.data.name)
  1075. .join("/");
  1076. let dataNode = null;
  1077. if (!isModuleTree(node.data)) {
  1078. const mainUid = data.nodeParts[node.data.uid].mainUid;
  1079. dataNode = data.nodeMetas[mainUid];
  1080. }
  1081. return (o$1(p$1, { children: [o$1("div", { children: path }), availableSizeProperties.map((sizeProp) => {
  1082. if (sizeProp === sizeProperty) {
  1083. return (o$1("div", { children: [o$1("b", { children: [LABELS[sizeProp], ": ", format_1(mainSize)] }), " ", "(", percentageString, ")"] }, sizeProp));
  1084. }
  1085. else {
  1086. return (o$1("div", { children: [LABELS[sizeProp], ": ", format_1(getModuleSize(node.data, sizeProp))] }, sizeProp));
  1087. }
  1088. }), o$1("br", {}), dataNode && dataNode.importedBy.length > 0 && (o$1("div", { children: [o$1("div", { children: [o$1("b", { children: "Imported By" }), ":"] }), dataNode.importedBy.map(({ uid }) => {
  1089. const id = data.nodeMetas[uid].id;
  1090. return o$1("div", { children: id }, id);
  1091. })] })), o$1("br", {}), o$1("small", { children: data.options.sourcemap ? SOURCEMAP_RENDERED : RENDRED }), (data.options.gzip || data.options.brotli) && (o$1(p$1, { children: [o$1("br", {}), o$1("small", { children: COMPRESSED })] }))] }));
  1092. }, [availableSizeProperties, data, getModuleSize, node, root.data, sizeProperty]);
  1093. const updatePosition = (mouseCoords) => {
  1094. if (!ref.current)
  1095. return;
  1096. const pos = {
  1097. left: mouseCoords.x + Tooltip_marginX,
  1098. top: mouseCoords.y + Tooltip_marginY,
  1099. };
  1100. const boundingRect = ref.current.getBoundingClientRect();
  1101. if (pos.left + boundingRect.width > window.innerWidth) {
  1102. // Shifting horizontally
  1103. pos.left = window.innerWidth - boundingRect.width;
  1104. }
  1105. if (pos.top + boundingRect.height > window.innerHeight) {
  1106. // Flipping vertically
  1107. pos.top = mouseCoords.y - Tooltip_marginY - boundingRect.height;
  1108. }
  1109. setStyle(pos);
  1110. };
  1111. h(() => {
  1112. const handleMouseMove = (event) => {
  1113. updatePosition({
  1114. x: event.pageX,
  1115. y: event.pageY,
  1116. });
  1117. };
  1118. document.addEventListener("mousemove", handleMouseMove, true);
  1119. return () => {
  1120. document.removeEventListener("mousemove", handleMouseMove, true);
  1121. };
  1122. }, []);
  1123. return (o$1("div", Object.assign({ className: `tooltip ${visible ? "" : "tooltip-hidden"}`, ref: ref, style: style }, { children: content })));
  1124. };
  1125. const Chart = ({ root, sizeProperty, selectedNode, setSelectedNode, }) => {
  1126. const [showTooltip, setShowTooltip] = p(false);
  1127. const [tooltipNode, setTooltipNode] = p(undefined);
  1128. h(() => {
  1129. const handleMouseOut = () => {
  1130. setShowTooltip(false);
  1131. };
  1132. document.addEventListener("mouseover", handleMouseOut);
  1133. return () => {
  1134. document.removeEventListener("mouseover", handleMouseOut);
  1135. };
  1136. }, []);
  1137. return (o$1(p$1, { children: [o$1(TreeMap, { root: root, onNodeHover: (node) => {
  1138. setTooltipNode(node);
  1139. setShowTooltip(true);
  1140. }, selectedNode: selectedNode, onNodeClick: (node) => {
  1141. setSelectedNode(selectedNode === node ? undefined : node);
  1142. } }), o$1(Tooltip, { visible: showTooltip, node: tooltipNode, root: root, sizeProperty: sizeProperty })] }));
  1143. };
  1144. const Main = () => {
  1145. const { availableSizeProperties, rawHierarchy, getModuleSize, layout, data } = q(StaticContext);
  1146. const [sizeProperty, setSizeProperty] = p(availableSizeProperties[0]);
  1147. const [selectedNode, setSelectedNode] = p(undefined);
  1148. const { getModuleFilterMultiplier, setExcludeFilter, setIncludeFilter } = useFilter();
  1149. console.time("getNodeSizeMultiplier");
  1150. const getNodeSizeMultiplier = F(() => {
  1151. const rootSize = getModuleSize(rawHierarchy.data, sizeProperty);
  1152. const selectedSize = selectedNode ? getModuleSize(selectedNode.data, sizeProperty) : 1;
  1153. const multiplier = rootSize * 0.2 > selectedSize ? (rootSize * 0.2) / selectedSize : 3;
  1154. if (selectedNode === undefined) {
  1155. return () => 1;
  1156. }
  1157. else if (isModuleTree(selectedNode.data)) {
  1158. const leaves = new Set(selectedNode.leaves().map((d) => d.data));
  1159. return (node) => {
  1160. if (leaves.has(node)) {
  1161. return multiplier;
  1162. }
  1163. return 1;
  1164. };
  1165. }
  1166. else {
  1167. return (node) => {
  1168. if (node === selectedNode.data) {
  1169. return multiplier;
  1170. }
  1171. return 1;
  1172. };
  1173. }
  1174. }, [getModuleSize, rawHierarchy.data, selectedNode, sizeProperty]);
  1175. console.timeEnd("getNodeSizeMultiplier");
  1176. console.time("root hierarchy compute");
  1177. // root here always be the same as rawHierarchy even after layouting
  1178. const root = F(() => {
  1179. const rootWithSizesAndSorted = rawHierarchy
  1180. .sum((node) => {
  1181. if (isModuleTree(node))
  1182. return 0;
  1183. const ownSize = getModuleSize(node, sizeProperty);
  1184. const zoomMultiplier = getNodeSizeMultiplier(node);
  1185. const filterMultiplier = getModuleFilterMultiplier(data.nodeMetas[data.nodeParts[node.uid].mainUid]);
  1186. return ownSize * zoomMultiplier * filterMultiplier;
  1187. })
  1188. .sort((a, b) => getModuleSize(a.data, sizeProperty) - getModuleSize(b.data, sizeProperty));
  1189. return layout(rootWithSizesAndSorted);
  1190. }, [
  1191. data,
  1192. getModuleFilterMultiplier,
  1193. getModuleSize,
  1194. getNodeSizeMultiplier,
  1195. layout,
  1196. rawHierarchy,
  1197. sizeProperty,
  1198. ]);
  1199. console.timeEnd("root hierarchy compute");
  1200. return (o$1(p$1, { children: [o$1(SideBar, { sizeProperty: sizeProperty, availableSizeProperties: availableSizeProperties, setSizeProperty: setSizeProperty, onExcludeChange: setExcludeFilter, onIncludeChange: setIncludeFilter }), o$1(Chart, { root: root, sizeProperty: sizeProperty, selectedNode: selectedNode, setSelectedNode: setSelectedNode })] }));
  1201. };
  1202. function initRange(domain, range) {
  1203. switch (arguments.length) {
  1204. case 0: break;
  1205. case 1: this.range(domain); break;
  1206. default: this.range(range).domain(domain); break;
  1207. }
  1208. return this;
  1209. }
  1210. function initInterpolator(domain, interpolator) {
  1211. switch (arguments.length) {
  1212. case 0: break;
  1213. case 1: {
  1214. if (typeof domain === "function") this.interpolator(domain);
  1215. else this.range(domain);
  1216. break;
  1217. }
  1218. default: {
  1219. this.domain(domain);
  1220. if (typeof interpolator === "function") this.interpolator(interpolator);
  1221. else this.range(interpolator);
  1222. break;
  1223. }
  1224. }
  1225. return this;
  1226. }
  1227. function define(constructor, factory, prototype) {
  1228. constructor.prototype = factory.prototype = prototype;
  1229. prototype.constructor = constructor;
  1230. }
  1231. function extend(parent, definition) {
  1232. var prototype = Object.create(parent.prototype);
  1233. for (var key in definition) prototype[key] = definition[key];
  1234. return prototype;
  1235. }
  1236. function Color() {}
  1237. var darker = 0.7;
  1238. var brighter = 1 / darker;
  1239. var reI = "\\s*([+-]?\\d+)\\s*",
  1240. reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
  1241. reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
  1242. reHex = /^#([0-9a-f]{3,8})$/,
  1243. reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
  1244. reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
  1245. reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
  1246. reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
  1247. reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
  1248. reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
  1249. var named = {
  1250. aliceblue: 0xf0f8ff,
  1251. antiquewhite: 0xfaebd7,
  1252. aqua: 0x00ffff,
  1253. aquamarine: 0x7fffd4,
  1254. azure: 0xf0ffff,
  1255. beige: 0xf5f5dc,
  1256. bisque: 0xffe4c4,
  1257. black: 0x000000,
  1258. blanchedalmond: 0xffebcd,
  1259. blue: 0x0000ff,
  1260. blueviolet: 0x8a2be2,
  1261. brown: 0xa52a2a,
  1262. burlywood: 0xdeb887,
  1263. cadetblue: 0x5f9ea0,
  1264. chartreuse: 0x7fff00,
  1265. chocolate: 0xd2691e,
  1266. coral: 0xff7f50,
  1267. cornflowerblue: 0x6495ed,
  1268. cornsilk: 0xfff8dc,
  1269. crimson: 0xdc143c,
  1270. cyan: 0x00ffff,
  1271. darkblue: 0x00008b,
  1272. darkcyan: 0x008b8b,
  1273. darkgoldenrod: 0xb8860b,
  1274. darkgray: 0xa9a9a9,
  1275. darkgreen: 0x006400,
  1276. darkgrey: 0xa9a9a9,
  1277. darkkhaki: 0xbdb76b,
  1278. darkmagenta: 0x8b008b,
  1279. darkolivegreen: 0x556b2f,
  1280. darkorange: 0xff8c00,
  1281. darkorchid: 0x9932cc,
  1282. darkred: 0x8b0000,
  1283. darksalmon: 0xe9967a,
  1284. darkseagreen: 0x8fbc8f,
  1285. darkslateblue: 0x483d8b,
  1286. darkslategray: 0x2f4f4f,
  1287. darkslategrey: 0x2f4f4f,
  1288. darkturquoise: 0x00ced1,
  1289. darkviolet: 0x9400d3,
  1290. deeppink: 0xff1493,
  1291. deepskyblue: 0x00bfff,
  1292. dimgray: 0x696969,
  1293. dimgrey: 0x696969,
  1294. dodgerblue: 0x1e90ff,
  1295. firebrick: 0xb22222,
  1296. floralwhite: 0xfffaf0,
  1297. forestgreen: 0x228b22,
  1298. fuchsia: 0xff00ff,
  1299. gainsboro: 0xdcdcdc,
  1300. ghostwhite: 0xf8f8ff,
  1301. gold: 0xffd700,
  1302. goldenrod: 0xdaa520,
  1303. gray: 0x808080,
  1304. green: 0x008000,
  1305. greenyellow: 0xadff2f,
  1306. grey: 0x808080,
  1307. honeydew: 0xf0fff0,
  1308. hotpink: 0xff69b4,
  1309. indianred: 0xcd5c5c,
  1310. indigo: 0x4b0082,
  1311. ivory: 0xfffff0,
  1312. khaki: 0xf0e68c,
  1313. lavender: 0xe6e6fa,
  1314. lavenderblush: 0xfff0f5,
  1315. lawngreen: 0x7cfc00,
  1316. lemonchiffon: 0xfffacd,
  1317. lightblue: 0xadd8e6,
  1318. lightcoral: 0xf08080,
  1319. lightcyan: 0xe0ffff,
  1320. lightgoldenrodyellow: 0xfafad2,
  1321. lightgray: 0xd3d3d3,
  1322. lightgreen: 0x90ee90,
  1323. lightgrey: 0xd3d3d3,
  1324. lightpink: 0xffb6c1,
  1325. lightsalmon: 0xffa07a,
  1326. lightseagreen: 0x20b2aa,
  1327. lightskyblue: 0x87cefa,
  1328. lightslategray: 0x778899,
  1329. lightslategrey: 0x778899,
  1330. lightsteelblue: 0xb0c4de,
  1331. lightyellow: 0xffffe0,
  1332. lime: 0x00ff00,
  1333. limegreen: 0x32cd32,
  1334. linen: 0xfaf0e6,
  1335. magenta: 0xff00ff,
  1336. maroon: 0x800000,
  1337. mediumaquamarine: 0x66cdaa,
  1338. mediumblue: 0x0000cd,
  1339. mediumorchid: 0xba55d3,
  1340. mediumpurple: 0x9370db,
  1341. mediumseagreen: 0x3cb371,
  1342. mediumslateblue: 0x7b68ee,
  1343. mediumspringgreen: 0x00fa9a,
  1344. mediumturquoise: 0x48d1cc,
  1345. mediumvioletred: 0xc71585,
  1346. midnightblue: 0x191970,
  1347. mintcream: 0xf5fffa,
  1348. mistyrose: 0xffe4e1,
  1349. moccasin: 0xffe4b5,
  1350. navajowhite: 0xffdead,
  1351. navy: 0x000080,
  1352. oldlace: 0xfdf5e6,
  1353. olive: 0x808000,
  1354. olivedrab: 0x6b8e23,
  1355. orange: 0xffa500,
  1356. orangered: 0xff4500,
  1357. orchid: 0xda70d6,
  1358. palegoldenrod: 0xeee8aa,
  1359. palegreen: 0x98fb98,
  1360. paleturquoise: 0xafeeee,
  1361. palevioletred: 0xdb7093,
  1362. papayawhip: 0xffefd5,
  1363. peachpuff: 0xffdab9,
  1364. peru: 0xcd853f,
  1365. pink: 0xffc0cb,
  1366. plum: 0xdda0dd,
  1367. powderblue: 0xb0e0e6,
  1368. purple: 0x800080,
  1369. rebeccapurple: 0x663399,
  1370. red: 0xff0000,
  1371. rosybrown: 0xbc8f8f,
  1372. royalblue: 0x4169e1,
  1373. saddlebrown: 0x8b4513,
  1374. salmon: 0xfa8072,
  1375. sandybrown: 0xf4a460,
  1376. seagreen: 0x2e8b57,
  1377. seashell: 0xfff5ee,
  1378. sienna: 0xa0522d,
  1379. silver: 0xc0c0c0,
  1380. skyblue: 0x87ceeb,
  1381. slateblue: 0x6a5acd,
  1382. slategray: 0x708090,
  1383. slategrey: 0x708090,
  1384. snow: 0xfffafa,
  1385. springgreen: 0x00ff7f,
  1386. steelblue: 0x4682b4,
  1387. tan: 0xd2b48c,
  1388. teal: 0x008080,
  1389. thistle: 0xd8bfd8,
  1390. tomato: 0xff6347,
  1391. turquoise: 0x40e0d0,
  1392. violet: 0xee82ee,
  1393. wheat: 0xf5deb3,
  1394. white: 0xffffff,
  1395. whitesmoke: 0xf5f5f5,
  1396. yellow: 0xffff00,
  1397. yellowgreen: 0x9acd32
  1398. };
  1399. define(Color, color, {
  1400. copy(channels) {
  1401. return Object.assign(new this.constructor, this, channels);
  1402. },
  1403. displayable() {
  1404. return this.rgb().displayable();
  1405. },
  1406. hex: color_formatHex, // Deprecated! Use color.formatHex.
  1407. formatHex: color_formatHex,
  1408. formatHex8: color_formatHex8,
  1409. formatHsl: color_formatHsl,
  1410. formatRgb: color_formatRgb,
  1411. toString: color_formatRgb
  1412. });
  1413. function color_formatHex() {
  1414. return this.rgb().formatHex();
  1415. }
  1416. function color_formatHex8() {
  1417. return this.rgb().formatHex8();
  1418. }
  1419. function color_formatHsl() {
  1420. return hslConvert(this).formatHsl();
  1421. }
  1422. function color_formatRgb() {
  1423. return this.rgb().formatRgb();
  1424. }
  1425. function color(format) {
  1426. var m, l;
  1427. format = (format + "").trim().toLowerCase();
  1428. return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
  1429. : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
  1430. : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
  1431. : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
  1432. : null) // invalid hex
  1433. : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
  1434. : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
  1435. : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
  1436. : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
  1437. : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
  1438. : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
  1439. : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
  1440. : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
  1441. : null;
  1442. }
  1443. function rgbn(n) {
  1444. return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
  1445. }
  1446. function rgba(r, g, b, a) {
  1447. if (a <= 0) r = g = b = NaN;
  1448. return new Rgb(r, g, b, a);
  1449. }
  1450. function rgbConvert(o) {
  1451. if (!(o instanceof Color)) o = color(o);
  1452. if (!o) return new Rgb;
  1453. o = o.rgb();
  1454. return new Rgb(o.r, o.g, o.b, o.opacity);
  1455. }
  1456. function rgb$1(r, g, b, opacity) {
  1457. return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
  1458. }
  1459. function Rgb(r, g, b, opacity) {
  1460. this.r = +r;
  1461. this.g = +g;
  1462. this.b = +b;
  1463. this.opacity = +opacity;
  1464. }
  1465. define(Rgb, rgb$1, extend(Color, {
  1466. brighter(k) {
  1467. k = k == null ? brighter : Math.pow(brighter, k);
  1468. return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  1469. },
  1470. darker(k) {
  1471. k = k == null ? darker : Math.pow(darker, k);
  1472. return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  1473. },
  1474. rgb() {
  1475. return this;
  1476. },
  1477. clamp() {
  1478. return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
  1479. },
  1480. displayable() {
  1481. return (-0.5 <= this.r && this.r < 255.5)
  1482. && (-0.5 <= this.g && this.g < 255.5)
  1483. && (-0.5 <= this.b && this.b < 255.5)
  1484. && (0 <= this.opacity && this.opacity <= 1);
  1485. },
  1486. hex: rgb_formatHex, // Deprecated! Use color.formatHex.
  1487. formatHex: rgb_formatHex,
  1488. formatHex8: rgb_formatHex8,
  1489. formatRgb: rgb_formatRgb,
  1490. toString: rgb_formatRgb
  1491. }));
  1492. function rgb_formatHex() {
  1493. return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
  1494. }
  1495. function rgb_formatHex8() {
  1496. return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
  1497. }
  1498. function rgb_formatRgb() {
  1499. const a = clampa(this.opacity);
  1500. return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
  1501. }
  1502. function clampa(opacity) {
  1503. return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
  1504. }
  1505. function clampi(value) {
  1506. return Math.max(0, Math.min(255, Math.round(value) || 0));
  1507. }
  1508. function hex(value) {
  1509. value = clampi(value);
  1510. return (value < 16 ? "0" : "") + value.toString(16);
  1511. }
  1512. function hsla(h, s, l, a) {
  1513. if (a <= 0) h = s = l = NaN;
  1514. else if (l <= 0 || l >= 1) h = s = NaN;
  1515. else if (s <= 0) h = NaN;
  1516. return new Hsl(h, s, l, a);
  1517. }
  1518. function hslConvert(o) {
  1519. if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
  1520. if (!(o instanceof Color)) o = color(o);
  1521. if (!o) return new Hsl;
  1522. if (o instanceof Hsl) return o;
  1523. o = o.rgb();
  1524. var r = o.r / 255,
  1525. g = o.g / 255,
  1526. b = o.b / 255,
  1527. min = Math.min(r, g, b),
  1528. max = Math.max(r, g, b),
  1529. h = NaN,
  1530. s = max - min,
  1531. l = (max + min) / 2;
  1532. if (s) {
  1533. if (r === max) h = (g - b) / s + (g < b) * 6;
  1534. else if (g === max) h = (b - r) / s + 2;
  1535. else h = (r - g) / s + 4;
  1536. s /= l < 0.5 ? max + min : 2 - max - min;
  1537. h *= 60;
  1538. } else {
  1539. s = l > 0 && l < 1 ? 0 : h;
  1540. }
  1541. return new Hsl(h, s, l, o.opacity);
  1542. }
  1543. function hsl(h, s, l, opacity) {
  1544. return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
  1545. }
  1546. function Hsl(h, s, l, opacity) {
  1547. this.h = +h;
  1548. this.s = +s;
  1549. this.l = +l;
  1550. this.opacity = +opacity;
  1551. }
  1552. define(Hsl, hsl, extend(Color, {
  1553. brighter(k) {
  1554. k = k == null ? brighter : Math.pow(brighter, k);
  1555. return new Hsl(this.h, this.s, this.l * k, this.opacity);
  1556. },
  1557. darker(k) {
  1558. k = k == null ? darker : Math.pow(darker, k);
  1559. return new Hsl(this.h, this.s, this.l * k, this.opacity);
  1560. },
  1561. rgb() {
  1562. var h = this.h % 360 + (this.h < 0) * 360,
  1563. s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
  1564. l = this.l,
  1565. m2 = l + (l < 0.5 ? l : 1 - l) * s,
  1566. m1 = 2 * l - m2;
  1567. return new Rgb(
  1568. hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
  1569. hsl2rgb(h, m1, m2),
  1570. hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
  1571. this.opacity
  1572. );
  1573. },
  1574. clamp() {
  1575. return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
  1576. },
  1577. displayable() {
  1578. return (0 <= this.s && this.s <= 1 || isNaN(this.s))
  1579. && (0 <= this.l && this.l <= 1)
  1580. && (0 <= this.opacity && this.opacity <= 1);
  1581. },
  1582. formatHsl() {
  1583. const a = clampa(this.opacity);
  1584. return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
  1585. }
  1586. }));
  1587. function clamph(value) {
  1588. value = (value || 0) % 360;
  1589. return value < 0 ? value + 360 : value;
  1590. }
  1591. function clampt(value) {
  1592. return Math.max(0, Math.min(1, value || 0));
  1593. }
  1594. /* From FvD 13.37, CSS Color Module Level 3 */
  1595. function hsl2rgb(h, m1, m2) {
  1596. return (h < 60 ? m1 + (m2 - m1) * h / 60
  1597. : h < 180 ? m2
  1598. : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
  1599. : m1) * 255;
  1600. }
  1601. const radians = Math.PI / 180;
  1602. const degrees = 180 / Math.PI;
  1603. // https://observablehq.com/@mbostock/lab-and-rgb
  1604. const K = 18,
  1605. Xn = 0.96422,
  1606. Yn = 1,
  1607. Zn = 0.82521,
  1608. t0$1 = 4 / 29,
  1609. t1$1 = 6 / 29,
  1610. t2 = 3 * t1$1 * t1$1,
  1611. t3 = t1$1 * t1$1 * t1$1;
  1612. function labConvert(o) {
  1613. if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
  1614. if (o instanceof Hcl) return hcl2lab(o);
  1615. if (!(o instanceof Rgb)) o = rgbConvert(o);
  1616. var r = rgb2lrgb(o.r),
  1617. g = rgb2lrgb(o.g),
  1618. b = rgb2lrgb(o.b),
  1619. y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
  1620. if (r === g && g === b) x = z = y; else {
  1621. x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
  1622. z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
  1623. }
  1624. return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
  1625. }
  1626. function lab(l, a, b, opacity) {
  1627. return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
  1628. }
  1629. function Lab(l, a, b, opacity) {
  1630. this.l = +l;
  1631. this.a = +a;
  1632. this.b = +b;
  1633. this.opacity = +opacity;
  1634. }
  1635. define(Lab, lab, extend(Color, {
  1636. brighter(k) {
  1637. return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  1638. },
  1639. darker(k) {
  1640. return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  1641. },
  1642. rgb() {
  1643. var y = (this.l + 16) / 116,
  1644. x = isNaN(this.a) ? y : y + this.a / 500,
  1645. z = isNaN(this.b) ? y : y - this.b / 200;
  1646. x = Xn * lab2xyz(x);
  1647. y = Yn * lab2xyz(y);
  1648. z = Zn * lab2xyz(z);
  1649. return new Rgb(
  1650. lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
  1651. lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
  1652. lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
  1653. this.opacity
  1654. );
  1655. }
  1656. }));
  1657. function xyz2lab(t) {
  1658. return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$1;
  1659. }
  1660. function lab2xyz(t) {
  1661. return t > t1$1 ? t * t * t : t2 * (t - t0$1);
  1662. }
  1663. function lrgb2rgb(x) {
  1664. return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
  1665. }
  1666. function rgb2lrgb(x) {
  1667. return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
  1668. }
  1669. function hclConvert(o) {
  1670. if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
  1671. if (!(o instanceof Lab)) o = labConvert(o);
  1672. if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
  1673. var h = Math.atan2(o.b, o.a) * degrees;
  1674. return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
  1675. }
  1676. function hcl(h, c, l, opacity) {
  1677. return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
  1678. }
  1679. function Hcl(h, c, l, opacity) {
  1680. this.h = +h;
  1681. this.c = +c;
  1682. this.l = +l;
  1683. this.opacity = +opacity;
  1684. }
  1685. function hcl2lab(o) {
  1686. if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
  1687. var h = o.h * radians;
  1688. return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
  1689. }
  1690. define(Hcl, hcl, extend(Color, {
  1691. brighter(k) {
  1692. return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
  1693. },
  1694. darker(k) {
  1695. return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
  1696. },
  1697. rgb() {
  1698. return hcl2lab(this).rgb();
  1699. }
  1700. }));
  1701. var A = -0.14861,
  1702. B = +1.78277,
  1703. C = -0.29227,
  1704. D = -0.90649,
  1705. E = +1.97294,
  1706. ED = E * D,
  1707. EB = E * B,
  1708. BC_DA = B * C - D * A;
  1709. function cubehelixConvert(o) {
  1710. if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
  1711. if (!(o instanceof Rgb)) o = rgbConvert(o);
  1712. var r = o.r / 255,
  1713. g = o.g / 255,
  1714. b = o.b / 255,
  1715. l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
  1716. bl = b - l,
  1717. k = (E * (g - l) - C * bl) / D,
  1718. s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
  1719. h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;
  1720. return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
  1721. }
  1722. function cubehelix$1(h, s, l, opacity) {
  1723. return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
  1724. }
  1725. function Cubehelix(h, s, l, opacity) {
  1726. this.h = +h;
  1727. this.s = +s;
  1728. this.l = +l;
  1729. this.opacity = +opacity;
  1730. }
  1731. define(Cubehelix, cubehelix$1, extend(Color, {
  1732. brighter(k) {
  1733. k = k == null ? brighter : Math.pow(brighter, k);
  1734. return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  1735. },
  1736. darker(k) {
  1737. k = k == null ? darker : Math.pow(darker, k);
  1738. return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  1739. },
  1740. rgb() {
  1741. var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,
  1742. l = +this.l,
  1743. a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
  1744. cosh = Math.cos(h),
  1745. sinh = Math.sin(h);
  1746. return new Rgb(
  1747. 255 * (l + a * (A * cosh + B * sinh)),
  1748. 255 * (l + a * (C * cosh + D * sinh)),
  1749. 255 * (l + a * (E * cosh)),
  1750. this.opacity
  1751. );
  1752. }
  1753. }));
  1754. var constant = x => () => x;
  1755. function linear$1(a, d) {
  1756. return function(t) {
  1757. return a + t * d;
  1758. };
  1759. }
  1760. function exponential(a, b, y) {
  1761. return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
  1762. return Math.pow(a + t * b, y);
  1763. };
  1764. }
  1765. function hue(a, b) {
  1766. var d = b - a;
  1767. return d ? linear$1(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);
  1768. }
  1769. function gamma(y) {
  1770. return (y = +y) === 1 ? nogamma : function(a, b) {
  1771. return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
  1772. };
  1773. }
  1774. function nogamma(a, b) {
  1775. var d = b - a;
  1776. return d ? linear$1(a, d) : constant(isNaN(a) ? b : a);
  1777. }
  1778. var rgb = (function rgbGamma(y) {
  1779. var color = gamma(y);
  1780. function rgb(start, end) {
  1781. var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r),
  1782. g = color(start.g, end.g),
  1783. b = color(start.b, end.b),
  1784. opacity = nogamma(start.opacity, end.opacity);
  1785. return function(t) {
  1786. start.r = r(t);
  1787. start.g = g(t);
  1788. start.b = b(t);
  1789. start.opacity = opacity(t);
  1790. return start + "";
  1791. };
  1792. }
  1793. rgb.gamma = rgbGamma;
  1794. return rgb;
  1795. })(1);
  1796. function numberArray(a, b) {
  1797. if (!b) b = [];
  1798. var n = a ? Math.min(b.length, a.length) : 0,
  1799. c = b.slice(),
  1800. i;
  1801. return function(t) {
  1802. for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
  1803. return c;
  1804. };
  1805. }
  1806. function isNumberArray(x) {
  1807. return ArrayBuffer.isView(x) && !(x instanceof DataView);
  1808. }
  1809. function genericArray(a, b) {
  1810. var nb = b ? b.length : 0,
  1811. na = a ? Math.min(nb, a.length) : 0,
  1812. x = new Array(na),
  1813. c = new Array(nb),
  1814. i;
  1815. for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]);
  1816. for (; i < nb; ++i) c[i] = b[i];
  1817. return function(t) {
  1818. for (i = 0; i < na; ++i) c[i] = x[i](t);
  1819. return c;
  1820. };
  1821. }
  1822. function date(a, b) {
  1823. var d = new Date;
  1824. return a = +a, b = +b, function(t) {
  1825. return d.setTime(a * (1 - t) + b * t), d;
  1826. };
  1827. }
  1828. function interpolateNumber(a, b) {
  1829. return a = +a, b = +b, function(t) {
  1830. return a * (1 - t) + b * t;
  1831. };
  1832. }
  1833. function object(a, b) {
  1834. var i = {},
  1835. c = {},
  1836. k;
  1837. if (a === null || typeof a !== "object") a = {};
  1838. if (b === null || typeof b !== "object") b = {};
  1839. for (k in b) {
  1840. if (k in a) {
  1841. i[k] = interpolate(a[k], b[k]);
  1842. } else {
  1843. c[k] = b[k];
  1844. }
  1845. }
  1846. return function(t) {
  1847. for (k in i) c[k] = i[k](t);
  1848. return c;
  1849. };
  1850. }
  1851. var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
  1852. reB = new RegExp(reA.source, "g");
  1853. function zero(b) {
  1854. return function() {
  1855. return b;
  1856. };
  1857. }
  1858. function one(b) {
  1859. return function(t) {
  1860. return b(t) + "";
  1861. };
  1862. }
  1863. function string(a, b) {
  1864. var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
  1865. am, // current match in a
  1866. bm, // current match in b
  1867. bs, // string preceding current number in b, if any
  1868. i = -1, // index in s
  1869. s = [], // string constants and placeholders
  1870. q = []; // number interpolators
  1871. // Coerce inputs to strings.
  1872. a = a + "", b = b + "";
  1873. // Interpolate pairs of numbers in a & b.
  1874. while ((am = reA.exec(a))
  1875. && (bm = reB.exec(b))) {
  1876. if ((bs = bm.index) > bi) { // a string precedes the next number in b
  1877. bs = b.slice(bi, bs);
  1878. if (s[i]) s[i] += bs; // coalesce with previous string
  1879. else s[++i] = bs;
  1880. }
  1881. if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
  1882. if (s[i]) s[i] += bm; // coalesce with previous string
  1883. else s[++i] = bm;
  1884. } else { // interpolate non-matching numbers
  1885. s[++i] = null;
  1886. q.push({i: i, x: interpolateNumber(am, bm)});
  1887. }
  1888. bi = reB.lastIndex;
  1889. }
  1890. // Add remains of b.
  1891. if (bi < b.length) {
  1892. bs = b.slice(bi);
  1893. if (s[i]) s[i] += bs; // coalesce with previous string
  1894. else s[++i] = bs;
  1895. }
  1896. // Special optimization for only a single match.
  1897. // Otherwise, interpolate each of the numbers and rejoin the string.
  1898. return s.length < 2 ? (q[0]
  1899. ? one(q[0].x)
  1900. : zero(b))
  1901. : (b = q.length, function(t) {
  1902. for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
  1903. return s.join("");
  1904. });
  1905. }
  1906. function interpolate(a, b) {
  1907. var t = typeof b, c;
  1908. return b == null || t === "boolean" ? constant(b)
  1909. : (t === "number" ? interpolateNumber
  1910. : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string)
  1911. : b instanceof color ? rgb
  1912. : b instanceof Date ? date
  1913. : isNumberArray(b) ? numberArray
  1914. : Array.isArray(b) ? genericArray
  1915. : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
  1916. : interpolateNumber)(a, b);
  1917. }
  1918. function interpolateRound(a, b) {
  1919. return a = +a, b = +b, function(t) {
  1920. return Math.round(a * (1 - t) + b * t);
  1921. };
  1922. }
  1923. var epsilon2 = 1e-12;
  1924. function cosh(x) {
  1925. return ((x = Math.exp(x)) + 1 / x) / 2;
  1926. }
  1927. function sinh(x) {
  1928. return ((x = Math.exp(x)) - 1 / x) / 2;
  1929. }
  1930. function tanh(x) {
  1931. return ((x = Math.exp(2 * x)) - 1) / (x + 1);
  1932. }
  1933. ((function zoomRho(rho, rho2, rho4) {
  1934. // p0 = [ux0, uy0, w0]
  1935. // p1 = [ux1, uy1, w1]
  1936. function zoom(p0, p1) {
  1937. var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
  1938. ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
  1939. dx = ux1 - ux0,
  1940. dy = uy1 - uy0,
  1941. d2 = dx * dx + dy * dy,
  1942. i,
  1943. S;
  1944. // Special case for u0 ≅ u1.
  1945. if (d2 < epsilon2) {
  1946. S = Math.log(w1 / w0) / rho;
  1947. i = function(t) {
  1948. return [
  1949. ux0 + t * dx,
  1950. uy0 + t * dy,
  1951. w0 * Math.exp(rho * t * S)
  1952. ];
  1953. };
  1954. }
  1955. // General case.
  1956. else {
  1957. var d1 = Math.sqrt(d2),
  1958. b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
  1959. b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
  1960. r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
  1961. r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
  1962. S = (r1 - r0) / rho;
  1963. i = function(t) {
  1964. var s = t * S,
  1965. coshr0 = cosh(r0),
  1966. u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
  1967. return [
  1968. ux0 + u * dx,
  1969. uy0 + u * dy,
  1970. w0 * coshr0 / cosh(rho * s + r0)
  1971. ];
  1972. };
  1973. }
  1974. i.duration = S * 1000 * rho / Math.SQRT2;
  1975. return i;
  1976. }
  1977. zoom.rho = function(_) {
  1978. var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
  1979. return zoomRho(_1, _2, _4);
  1980. };
  1981. return zoom;
  1982. }))(Math.SQRT2, 2, 4);
  1983. function cubehelix(hue) {
  1984. return (function cubehelixGamma(y) {
  1985. y = +y;
  1986. function cubehelix(start, end) {
  1987. var h = hue((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h),
  1988. s = nogamma(start.s, end.s),
  1989. l = nogamma(start.l, end.l),
  1990. opacity = nogamma(start.opacity, end.opacity);
  1991. return function(t) {
  1992. start.h = h(t);
  1993. start.s = s(t);
  1994. start.l = l(Math.pow(t, y));
  1995. start.opacity = opacity(t);
  1996. return start + "";
  1997. };
  1998. }
  1999. cubehelix.gamma = cubehelixGamma;
  2000. return cubehelix;
  2001. })(1);
  2002. }
  2003. cubehelix(hue);
  2004. cubehelix(nogamma);
  2005. function constants(x) {
  2006. return function() {
  2007. return x;
  2008. };
  2009. }
  2010. function number(x) {
  2011. return +x;
  2012. }
  2013. var unit = [0, 1];
  2014. function identity$1(x) {
  2015. return x;
  2016. }
  2017. function normalize(a, b) {
  2018. return (b -= (a = +a))
  2019. ? function(x) { return (x - a) / b; }
  2020. : constants(isNaN(b) ? NaN : 0.5);
  2021. }
  2022. function clamper(a, b) {
  2023. var t;
  2024. if (a > b) t = a, a = b, b = t;
  2025. return function(x) { return Math.max(a, Math.min(b, x)); };
  2026. }
  2027. // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
  2028. // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
  2029. function bimap(domain, range, interpolate) {
  2030. var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
  2031. if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
  2032. else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
  2033. return function(x) { return r0(d0(x)); };
  2034. }
  2035. function polymap(domain, range, interpolate) {
  2036. var j = Math.min(domain.length, range.length) - 1,
  2037. d = new Array(j),
  2038. r = new Array(j),
  2039. i = -1;
  2040. // Reverse descending domains.
  2041. if (domain[j] < domain[0]) {
  2042. domain = domain.slice().reverse();
  2043. range = range.slice().reverse();
  2044. }
  2045. while (++i < j) {
  2046. d[i] = normalize(domain[i], domain[i + 1]);
  2047. r[i] = interpolate(range[i], range[i + 1]);
  2048. }
  2049. return function(x) {
  2050. var i = bisectRight(domain, x, 1, j) - 1;
  2051. return r[i](d[i](x));
  2052. };
  2053. }
  2054. function copy$1(source, target) {
  2055. return target
  2056. .domain(source.domain())
  2057. .range(source.range())
  2058. .interpolate(source.interpolate())
  2059. .clamp(source.clamp())
  2060. .unknown(source.unknown());
  2061. }
  2062. function transformer$1() {
  2063. var domain = unit,
  2064. range = unit,
  2065. interpolate$1 = interpolate,
  2066. transform,
  2067. untransform,
  2068. unknown,
  2069. clamp = identity$1,
  2070. piecewise,
  2071. output,
  2072. input;
  2073. function rescale() {
  2074. var n = Math.min(domain.length, range.length);
  2075. if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]);
  2076. piecewise = n > 2 ? polymap : bimap;
  2077. output = input = null;
  2078. return scale;
  2079. }
  2080. function scale(x) {
  2081. return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x)));
  2082. }
  2083. scale.invert = function(y) {
  2084. return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
  2085. };
  2086. scale.domain = function(_) {
  2087. return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
  2088. };
  2089. scale.range = function(_) {
  2090. return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
  2091. };
  2092. scale.rangeRound = function(_) {
  2093. return range = Array.from(_), interpolate$1 = interpolateRound, rescale();
  2094. };
  2095. scale.clamp = function(_) {
  2096. return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1;
  2097. };
  2098. scale.interpolate = function(_) {
  2099. return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1;
  2100. };
  2101. scale.unknown = function(_) {
  2102. return arguments.length ? (unknown = _, scale) : unknown;
  2103. };
  2104. return function(t, u) {
  2105. transform = t, untransform = u;
  2106. return rescale();
  2107. };
  2108. }
  2109. function continuous() {
  2110. return transformer$1()(identity$1, identity$1);
  2111. }
  2112. function formatDecimal(x) {
  2113. return Math.abs(x = Math.round(x)) >= 1e21
  2114. ? x.toLocaleString("en").replace(/,/g, "")
  2115. : x.toString(10);
  2116. }
  2117. // Computes the decimal coefficient and exponent of the specified number x with
  2118. // significant digits p, where x is positive and p is in [1, 21] or undefined.
  2119. // For example, formatDecimalParts(1.23) returns ["123", 0].
  2120. function formatDecimalParts(x, p) {
  2121. if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
  2122. var i, coefficient = x.slice(0, i);
  2123. // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
  2124. // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
  2125. return [
  2126. coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
  2127. +x.slice(i + 1)
  2128. ];
  2129. }
  2130. function exponent(x) {
  2131. return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
  2132. }
  2133. function formatGroup(grouping, thousands) {
  2134. return function(value, width) {
  2135. var i = value.length,
  2136. t = [],
  2137. j = 0,
  2138. g = grouping[0],
  2139. length = 0;
  2140. while (i > 0 && g > 0) {
  2141. if (length + g + 1 > width) g = Math.max(1, width - length);
  2142. t.push(value.substring(i -= g, i + g));
  2143. if ((length += g + 1) > width) break;
  2144. g = grouping[j = (j + 1) % grouping.length];
  2145. }
  2146. return t.reverse().join(thousands);
  2147. };
  2148. }
  2149. function formatNumerals(numerals) {
  2150. return function(value) {
  2151. return value.replace(/[0-9]/g, function(i) {
  2152. return numerals[+i];
  2153. });
  2154. };
  2155. }
  2156. // [[fill]align][sign][symbol][0][width][,][.precision][~][type]
  2157. var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
  2158. function formatSpecifier(specifier) {
  2159. if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
  2160. var match;
  2161. return new FormatSpecifier({
  2162. fill: match[1],
  2163. align: match[2],
  2164. sign: match[3],
  2165. symbol: match[4],
  2166. zero: match[5],
  2167. width: match[6],
  2168. comma: match[7],
  2169. precision: match[8] && match[8].slice(1),
  2170. trim: match[9],
  2171. type: match[10]
  2172. });
  2173. }
  2174. formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
  2175. function FormatSpecifier(specifier) {
  2176. this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
  2177. this.align = specifier.align === undefined ? ">" : specifier.align + "";
  2178. this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
  2179. this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
  2180. this.zero = !!specifier.zero;
  2181. this.width = specifier.width === undefined ? undefined : +specifier.width;
  2182. this.comma = !!specifier.comma;
  2183. this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
  2184. this.trim = !!specifier.trim;
  2185. this.type = specifier.type === undefined ? "" : specifier.type + "";
  2186. }
  2187. FormatSpecifier.prototype.toString = function() {
  2188. return this.fill
  2189. + this.align
  2190. + this.sign
  2191. + this.symbol
  2192. + (this.zero ? "0" : "")
  2193. + (this.width === undefined ? "" : Math.max(1, this.width | 0))
  2194. + (this.comma ? "," : "")
  2195. + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
  2196. + (this.trim ? "~" : "")
  2197. + this.type;
  2198. };
  2199. // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
  2200. function formatTrim(s) {
  2201. out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
  2202. switch (s[i]) {
  2203. case ".": i0 = i1 = i; break;
  2204. case "0": if (i0 === 0) i0 = i; i1 = i; break;
  2205. default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
  2206. }
  2207. }
  2208. return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
  2209. }
  2210. var prefixExponent;
  2211. function formatPrefixAuto(x, p) {
  2212. var d = formatDecimalParts(x, p);
  2213. if (!d) return x + "";
  2214. var coefficient = d[0],
  2215. exponent = d[1],
  2216. i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
  2217. n = coefficient.length;
  2218. return i === n ? coefficient
  2219. : i > n ? coefficient + new Array(i - n + 1).join("0")
  2220. : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
  2221. : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
  2222. }
  2223. function formatRounded(x, p) {
  2224. var d = formatDecimalParts(x, p);
  2225. if (!d) return x + "";
  2226. var coefficient = d[0],
  2227. exponent = d[1];
  2228. return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
  2229. : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
  2230. : coefficient + new Array(exponent - coefficient.length + 2).join("0");
  2231. }
  2232. var formatTypes = {
  2233. "%": (x, p) => (x * 100).toFixed(p),
  2234. "b": (x) => Math.round(x).toString(2),
  2235. "c": (x) => x + "",
  2236. "d": formatDecimal,
  2237. "e": (x, p) => x.toExponential(p),
  2238. "f": (x, p) => x.toFixed(p),
  2239. "g": (x, p) => x.toPrecision(p),
  2240. "o": (x) => Math.round(x).toString(8),
  2241. "p": (x, p) => formatRounded(x * 100, p),
  2242. "r": formatRounded,
  2243. "s": formatPrefixAuto,
  2244. "X": (x) => Math.round(x).toString(16).toUpperCase(),
  2245. "x": (x) => Math.round(x).toString(16)
  2246. };
  2247. function identity(x) {
  2248. return x;
  2249. }
  2250. var map = Array.prototype.map,
  2251. prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
  2252. function formatLocale$1(locale) {
  2253. var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
  2254. currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
  2255. currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
  2256. decimal = locale.decimal === undefined ? "." : locale.decimal + "",
  2257. numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
  2258. percent = locale.percent === undefined ? "%" : locale.percent + "",
  2259. minus = locale.minus === undefined ? "−" : locale.minus + "",
  2260. nan = locale.nan === undefined ? "NaN" : locale.nan + "";
  2261. function newFormat(specifier) {
  2262. specifier = formatSpecifier(specifier);
  2263. var fill = specifier.fill,
  2264. align = specifier.align,
  2265. sign = specifier.sign,
  2266. symbol = specifier.symbol,
  2267. zero = specifier.zero,
  2268. width = specifier.width,
  2269. comma = specifier.comma,
  2270. precision = specifier.precision,
  2271. trim = specifier.trim,
  2272. type = specifier.type;
  2273. // The "n" type is an alias for ",g".
  2274. if (type === "n") comma = true, type = "g";
  2275. // The "" type, and any invalid type, is an alias for ".12~g".
  2276. else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
  2277. // If zero fill is specified, padding goes after sign and before digits.
  2278. if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
  2279. // Compute the prefix and suffix.
  2280. // For SI-prefix, the suffix is lazily computed.
  2281. var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
  2282. suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
  2283. // What format function should we use?
  2284. // Is this an integer type?
  2285. // Can this type generate exponential notation?
  2286. var formatType = formatTypes[type],
  2287. maybeSuffix = /[defgprs%]/.test(type);
  2288. // Set the default precision if not specified,
  2289. // or clamp the specified precision to the supported range.
  2290. // For significant precision, it must be in [1, 21].
  2291. // For fixed precision, it must be in [0, 20].
  2292. precision = precision === undefined ? 6
  2293. : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
  2294. : Math.max(0, Math.min(20, precision));
  2295. function format(value) {
  2296. var valuePrefix = prefix,
  2297. valueSuffix = suffix,
  2298. i, n, c;
  2299. if (type === "c") {
  2300. valueSuffix = formatType(value) + valueSuffix;
  2301. value = "";
  2302. } else {
  2303. value = +value;
  2304. // Determine the sign. -0 is not less than 0, but 1 / -0 is!
  2305. var valueNegative = value < 0 || 1 / value < 0;
  2306. // Perform the initial formatting.
  2307. value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
  2308. // Trim insignificant zeros.
  2309. if (trim) value = formatTrim(value);
  2310. // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
  2311. if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
  2312. // Compute the prefix and suffix.
  2313. valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
  2314. valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
  2315. // Break the formatted value into the integer “value” part that can be
  2316. // grouped, and fractional or exponential “suffix” part that is not.
  2317. if (maybeSuffix) {
  2318. i = -1, n = value.length;
  2319. while (++i < n) {
  2320. if (c = value.charCodeAt(i), 48 > c || c > 57) {
  2321. valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
  2322. value = value.slice(0, i);
  2323. break;
  2324. }
  2325. }
  2326. }
  2327. }
  2328. // If the fill character is not "0", grouping is applied before padding.
  2329. if (comma && !zero) value = group(value, Infinity);
  2330. // Compute the padding.
  2331. var length = valuePrefix.length + value.length + valueSuffix.length,
  2332. padding = length < width ? new Array(width - length + 1).join(fill) : "";
  2333. // If the fill character is "0", grouping is applied after padding.
  2334. if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
  2335. // Reconstruct the final output based on the desired alignment.
  2336. switch (align) {
  2337. case "<": value = valuePrefix + value + valueSuffix + padding; break;
  2338. case "=": value = valuePrefix + padding + value + valueSuffix; break;
  2339. case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
  2340. default: value = padding + valuePrefix + value + valueSuffix; break;
  2341. }
  2342. return numerals(value);
  2343. }
  2344. format.toString = function() {
  2345. return specifier + "";
  2346. };
  2347. return format;
  2348. }
  2349. function formatPrefix(specifier, value) {
  2350. var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
  2351. e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
  2352. k = Math.pow(10, -e),
  2353. prefix = prefixes[8 + e / 3];
  2354. return function(value) {
  2355. return f(k * value) + prefix;
  2356. };
  2357. }
  2358. return {
  2359. format: newFormat,
  2360. formatPrefix: formatPrefix
  2361. };
  2362. }
  2363. var locale$1;
  2364. var format;
  2365. var formatPrefix;
  2366. defaultLocale$1({
  2367. thousands: ",",
  2368. grouping: [3],
  2369. currency: ["$", ""]
  2370. });
  2371. function defaultLocale$1(definition) {
  2372. locale$1 = formatLocale$1(definition);
  2373. format = locale$1.format;
  2374. formatPrefix = locale$1.formatPrefix;
  2375. return locale$1;
  2376. }
  2377. function precisionFixed(step) {
  2378. return Math.max(0, -exponent(Math.abs(step)));
  2379. }
  2380. function precisionPrefix(step, value) {
  2381. return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
  2382. }
  2383. function precisionRound(step, max) {
  2384. step = Math.abs(step), max = Math.abs(max) - step;
  2385. return Math.max(0, exponent(max) - exponent(step)) + 1;
  2386. }
  2387. function tickFormat(start, stop, count, specifier) {
  2388. var step = tickStep(start, stop, count),
  2389. precision;
  2390. specifier = formatSpecifier(specifier == null ? ",f" : specifier);
  2391. switch (specifier.type) {
  2392. case "s": {
  2393. var value = Math.max(Math.abs(start), Math.abs(stop));
  2394. if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
  2395. return formatPrefix(specifier, value);
  2396. }
  2397. case "":
  2398. case "e":
  2399. case "g":
  2400. case "p":
  2401. case "r": {
  2402. if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
  2403. break;
  2404. }
  2405. case "f":
  2406. case "%": {
  2407. if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
  2408. break;
  2409. }
  2410. }
  2411. return format(specifier);
  2412. }
  2413. function linearish(scale) {
  2414. var domain = scale.domain;
  2415. scale.ticks = function(count) {
  2416. var d = domain();
  2417. return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
  2418. };
  2419. scale.tickFormat = function(count, specifier) {
  2420. var d = domain();
  2421. return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
  2422. };
  2423. scale.nice = function(count) {
  2424. if (count == null) count = 10;
  2425. var d = domain();
  2426. var i0 = 0;
  2427. var i1 = d.length - 1;
  2428. var start = d[i0];
  2429. var stop = d[i1];
  2430. var prestep;
  2431. var step;
  2432. var maxIter = 10;
  2433. if (stop < start) {
  2434. step = start, start = stop, stop = step;
  2435. step = i0, i0 = i1, i1 = step;
  2436. }
  2437. while (maxIter-- > 0) {
  2438. step = tickIncrement(start, stop, count);
  2439. if (step === prestep) {
  2440. d[i0] = start;
  2441. d[i1] = stop;
  2442. return domain(d);
  2443. } else if (step > 0) {
  2444. start = Math.floor(start / step) * step;
  2445. stop = Math.ceil(stop / step) * step;
  2446. } else if (step < 0) {
  2447. start = Math.ceil(start * step) / step;
  2448. stop = Math.floor(stop * step) / step;
  2449. } else {
  2450. break;
  2451. }
  2452. prestep = step;
  2453. }
  2454. return scale;
  2455. };
  2456. return scale;
  2457. }
  2458. function linear() {
  2459. var scale = continuous();
  2460. scale.copy = function() {
  2461. return copy$1(scale, linear());
  2462. };
  2463. initRange.apply(scale, arguments);
  2464. return linearish(scale);
  2465. }
  2466. var t0 = new Date,
  2467. t1 = new Date;
  2468. function newInterval(floori, offseti, count, field) {
  2469. function interval(date) {
  2470. return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
  2471. }
  2472. interval.floor = function(date) {
  2473. return floori(date = new Date(+date)), date;
  2474. };
  2475. interval.ceil = function(date) {
  2476. return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
  2477. };
  2478. interval.round = function(date) {
  2479. var d0 = interval(date),
  2480. d1 = interval.ceil(date);
  2481. return date - d0 < d1 - date ? d0 : d1;
  2482. };
  2483. interval.offset = function(date, step) {
  2484. return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
  2485. };
  2486. interval.range = function(start, stop, step) {
  2487. var range = [], previous;
  2488. start = interval.ceil(start);
  2489. step = step == null ? 1 : Math.floor(step);
  2490. if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
  2491. do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
  2492. while (previous < start && start < stop);
  2493. return range;
  2494. };
  2495. interval.filter = function(test) {
  2496. return newInterval(function(date) {
  2497. if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
  2498. }, function(date, step) {
  2499. if (date >= date) {
  2500. if (step < 0) while (++step <= 0) {
  2501. while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
  2502. } else while (--step >= 0) {
  2503. while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
  2504. }
  2505. }
  2506. });
  2507. };
  2508. if (count) {
  2509. interval.count = function(start, end) {
  2510. t0.setTime(+start), t1.setTime(+end);
  2511. floori(t0), floori(t1);
  2512. return Math.floor(count(t0, t1));
  2513. };
  2514. interval.every = function(step) {
  2515. step = Math.floor(step);
  2516. return !isFinite(step) || !(step > 0) ? null
  2517. : !(step > 1) ? interval
  2518. : interval.filter(field
  2519. ? function(d) { return field(d) % step === 0; }
  2520. : function(d) { return interval.count(0, d) % step === 0; });
  2521. };
  2522. }
  2523. return interval;
  2524. }
  2525. var millisecond = newInterval(function() {
  2526. // noop
  2527. }, function(date, step) {
  2528. date.setTime(+date + step);
  2529. }, function(start, end) {
  2530. return end - start;
  2531. });
  2532. // An optimized implementation for this simple case.
  2533. millisecond.every = function(k) {
  2534. k = Math.floor(k);
  2535. if (!isFinite(k) || !(k > 0)) return null;
  2536. if (!(k > 1)) return millisecond;
  2537. return newInterval(function(date) {
  2538. date.setTime(Math.floor(date / k) * k);
  2539. }, function(date, step) {
  2540. date.setTime(+date + step * k);
  2541. }, function(start, end) {
  2542. return (end - start) / k;
  2543. });
  2544. };
  2545. millisecond.range;
  2546. const durationSecond = 1000;
  2547. const durationMinute = durationSecond * 60;
  2548. const durationHour = durationMinute * 60;
  2549. const durationDay = durationHour * 24;
  2550. const durationWeek = durationDay * 7;
  2551. var second = newInterval(function(date) {
  2552. date.setTime(date - date.getMilliseconds());
  2553. }, function(date, step) {
  2554. date.setTime(+date + step * durationSecond);
  2555. }, function(start, end) {
  2556. return (end - start) / durationSecond;
  2557. }, function(date) {
  2558. return date.getUTCSeconds();
  2559. });
  2560. second.range;
  2561. var minute = newInterval(function(date) {
  2562. date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
  2563. }, function(date, step) {
  2564. date.setTime(+date + step * durationMinute);
  2565. }, function(start, end) {
  2566. return (end - start) / durationMinute;
  2567. }, function(date) {
  2568. return date.getMinutes();
  2569. });
  2570. minute.range;
  2571. var hour = newInterval(function(date) {
  2572. date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
  2573. }, function(date, step) {
  2574. date.setTime(+date + step * durationHour);
  2575. }, function(start, end) {
  2576. return (end - start) / durationHour;
  2577. }, function(date) {
  2578. return date.getHours();
  2579. });
  2580. hour.range;
  2581. var day = newInterval(
  2582. date => date.setHours(0, 0, 0, 0),
  2583. (date, step) => date.setDate(date.getDate() + step),
  2584. (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
  2585. date => date.getDate() - 1
  2586. );
  2587. day.range;
  2588. function weekday(i) {
  2589. return newInterval(function(date) {
  2590. date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
  2591. date.setHours(0, 0, 0, 0);
  2592. }, function(date, step) {
  2593. date.setDate(date.getDate() + step * 7);
  2594. }, function(start, end) {
  2595. return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
  2596. });
  2597. }
  2598. var sunday = weekday(0);
  2599. var monday = weekday(1);
  2600. var tuesday = weekday(2);
  2601. var wednesday = weekday(3);
  2602. var thursday = weekday(4);
  2603. var friday = weekday(5);
  2604. var saturday = weekday(6);
  2605. sunday.range;
  2606. monday.range;
  2607. tuesday.range;
  2608. wednesday.range;
  2609. thursday.range;
  2610. friday.range;
  2611. saturday.range;
  2612. var month = newInterval(function(date) {
  2613. date.setDate(1);
  2614. date.setHours(0, 0, 0, 0);
  2615. }, function(date, step) {
  2616. date.setMonth(date.getMonth() + step);
  2617. }, function(start, end) {
  2618. return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
  2619. }, function(date) {
  2620. return date.getMonth();
  2621. });
  2622. month.range;
  2623. var year = newInterval(function(date) {
  2624. date.setMonth(0, 1);
  2625. date.setHours(0, 0, 0, 0);
  2626. }, function(date, step) {
  2627. date.setFullYear(date.getFullYear() + step);
  2628. }, function(start, end) {
  2629. return end.getFullYear() - start.getFullYear();
  2630. }, function(date) {
  2631. return date.getFullYear();
  2632. });
  2633. // An optimized implementation for this simple case.
  2634. year.every = function(k) {
  2635. return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
  2636. date.setFullYear(Math.floor(date.getFullYear() / k) * k);
  2637. date.setMonth(0, 1);
  2638. date.setHours(0, 0, 0, 0);
  2639. }, function(date, step) {
  2640. date.setFullYear(date.getFullYear() + step * k);
  2641. });
  2642. };
  2643. year.range;
  2644. var utcMinute = newInterval(function(date) {
  2645. date.setUTCSeconds(0, 0);
  2646. }, function(date, step) {
  2647. date.setTime(+date + step * durationMinute);
  2648. }, function(start, end) {
  2649. return (end - start) / durationMinute;
  2650. }, function(date) {
  2651. return date.getUTCMinutes();
  2652. });
  2653. utcMinute.range;
  2654. var utcHour = newInterval(function(date) {
  2655. date.setUTCMinutes(0, 0, 0);
  2656. }, function(date, step) {
  2657. date.setTime(+date + step * durationHour);
  2658. }, function(start, end) {
  2659. return (end - start) / durationHour;
  2660. }, function(date) {
  2661. return date.getUTCHours();
  2662. });
  2663. utcHour.range;
  2664. var utcDay = newInterval(function(date) {
  2665. date.setUTCHours(0, 0, 0, 0);
  2666. }, function(date, step) {
  2667. date.setUTCDate(date.getUTCDate() + step);
  2668. }, function(start, end) {
  2669. return (end - start) / durationDay;
  2670. }, function(date) {
  2671. return date.getUTCDate() - 1;
  2672. });
  2673. utcDay.range;
  2674. function utcWeekday(i) {
  2675. return newInterval(function(date) {
  2676. date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
  2677. date.setUTCHours(0, 0, 0, 0);
  2678. }, function(date, step) {
  2679. date.setUTCDate(date.getUTCDate() + step * 7);
  2680. }, function(start, end) {
  2681. return (end - start) / durationWeek;
  2682. });
  2683. }
  2684. var utcSunday = utcWeekday(0);
  2685. var utcMonday = utcWeekday(1);
  2686. var utcTuesday = utcWeekday(2);
  2687. var utcWednesday = utcWeekday(3);
  2688. var utcThursday = utcWeekday(4);
  2689. var utcFriday = utcWeekday(5);
  2690. var utcSaturday = utcWeekday(6);
  2691. utcSunday.range;
  2692. utcMonday.range;
  2693. utcTuesday.range;
  2694. utcWednesday.range;
  2695. utcThursday.range;
  2696. utcFriday.range;
  2697. utcSaturday.range;
  2698. var utcMonth = newInterval(function(date) {
  2699. date.setUTCDate(1);
  2700. date.setUTCHours(0, 0, 0, 0);
  2701. }, function(date, step) {
  2702. date.setUTCMonth(date.getUTCMonth() + step);
  2703. }, function(start, end) {
  2704. return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
  2705. }, function(date) {
  2706. return date.getUTCMonth();
  2707. });
  2708. utcMonth.range;
  2709. var utcYear = newInterval(function(date) {
  2710. date.setUTCMonth(0, 1);
  2711. date.setUTCHours(0, 0, 0, 0);
  2712. }, function(date, step) {
  2713. date.setUTCFullYear(date.getUTCFullYear() + step);
  2714. }, function(start, end) {
  2715. return end.getUTCFullYear() - start.getUTCFullYear();
  2716. }, function(date) {
  2717. return date.getUTCFullYear();
  2718. });
  2719. // An optimized implementation for this simple case.
  2720. utcYear.every = function(k) {
  2721. return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
  2722. date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
  2723. date.setUTCMonth(0, 1);
  2724. date.setUTCHours(0, 0, 0, 0);
  2725. }, function(date, step) {
  2726. date.setUTCFullYear(date.getUTCFullYear() + step * k);
  2727. });
  2728. };
  2729. utcYear.range;
  2730. function localDate(d) {
  2731. if (0 <= d.y && d.y < 100) {
  2732. var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
  2733. date.setFullYear(d.y);
  2734. return date;
  2735. }
  2736. return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
  2737. }
  2738. function utcDate(d) {
  2739. if (0 <= d.y && d.y < 100) {
  2740. var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
  2741. date.setUTCFullYear(d.y);
  2742. return date;
  2743. }
  2744. return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
  2745. }
  2746. function newDate(y, m, d) {
  2747. return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};
  2748. }
  2749. function formatLocale(locale) {
  2750. var locale_dateTime = locale.dateTime,
  2751. locale_date = locale.date,
  2752. locale_time = locale.time,
  2753. locale_periods = locale.periods,
  2754. locale_weekdays = locale.days,
  2755. locale_shortWeekdays = locale.shortDays,
  2756. locale_months = locale.months,
  2757. locale_shortMonths = locale.shortMonths;
  2758. var periodRe = formatRe(locale_periods),
  2759. periodLookup = formatLookup(locale_periods),
  2760. weekdayRe = formatRe(locale_weekdays),
  2761. weekdayLookup = formatLookup(locale_weekdays),
  2762. shortWeekdayRe = formatRe(locale_shortWeekdays),
  2763. shortWeekdayLookup = formatLookup(locale_shortWeekdays),
  2764. monthRe = formatRe(locale_months),
  2765. monthLookup = formatLookup(locale_months),
  2766. shortMonthRe = formatRe(locale_shortMonths),
  2767. shortMonthLookup = formatLookup(locale_shortMonths);
  2768. var formats = {
  2769. "a": formatShortWeekday,
  2770. "A": formatWeekday,
  2771. "b": formatShortMonth,
  2772. "B": formatMonth,
  2773. "c": null,
  2774. "d": formatDayOfMonth,
  2775. "e": formatDayOfMonth,
  2776. "f": formatMicroseconds,
  2777. "g": formatYearISO,
  2778. "G": formatFullYearISO,
  2779. "H": formatHour24,
  2780. "I": formatHour12,
  2781. "j": formatDayOfYear,
  2782. "L": formatMilliseconds,
  2783. "m": formatMonthNumber,
  2784. "M": formatMinutes,
  2785. "p": formatPeriod,
  2786. "q": formatQuarter,
  2787. "Q": formatUnixTimestamp,
  2788. "s": formatUnixTimestampSeconds,
  2789. "S": formatSeconds,
  2790. "u": formatWeekdayNumberMonday,
  2791. "U": formatWeekNumberSunday,
  2792. "V": formatWeekNumberISO,
  2793. "w": formatWeekdayNumberSunday,
  2794. "W": formatWeekNumberMonday,
  2795. "x": null,
  2796. "X": null,
  2797. "y": formatYear,
  2798. "Y": formatFullYear,
  2799. "Z": formatZone,
  2800. "%": formatLiteralPercent
  2801. };
  2802. var utcFormats = {
  2803. "a": formatUTCShortWeekday,
  2804. "A": formatUTCWeekday,
  2805. "b": formatUTCShortMonth,
  2806. "B": formatUTCMonth,
  2807. "c": null,
  2808. "d": formatUTCDayOfMonth,
  2809. "e": formatUTCDayOfMonth,
  2810. "f": formatUTCMicroseconds,
  2811. "g": formatUTCYearISO,
  2812. "G": formatUTCFullYearISO,
  2813. "H": formatUTCHour24,
  2814. "I": formatUTCHour12,
  2815. "j": formatUTCDayOfYear,
  2816. "L": formatUTCMilliseconds,
  2817. "m": formatUTCMonthNumber,
  2818. "M": formatUTCMinutes,
  2819. "p": formatUTCPeriod,
  2820. "q": formatUTCQuarter,
  2821. "Q": formatUnixTimestamp,
  2822. "s": formatUnixTimestampSeconds,
  2823. "S": formatUTCSeconds,
  2824. "u": formatUTCWeekdayNumberMonday,
  2825. "U": formatUTCWeekNumberSunday,
  2826. "V": formatUTCWeekNumberISO,
  2827. "w": formatUTCWeekdayNumberSunday,
  2828. "W": formatUTCWeekNumberMonday,
  2829. "x": null,
  2830. "X": null,
  2831. "y": formatUTCYear,
  2832. "Y": formatUTCFullYear,
  2833. "Z": formatUTCZone,
  2834. "%": formatLiteralPercent
  2835. };
  2836. var parses = {
  2837. "a": parseShortWeekday,
  2838. "A": parseWeekday,
  2839. "b": parseShortMonth,
  2840. "B": parseMonth,
  2841. "c": parseLocaleDateTime,
  2842. "d": parseDayOfMonth,
  2843. "e": parseDayOfMonth,
  2844. "f": parseMicroseconds,
  2845. "g": parseYear,
  2846. "G": parseFullYear,
  2847. "H": parseHour24,
  2848. "I": parseHour24,
  2849. "j": parseDayOfYear,
  2850. "L": parseMilliseconds,
  2851. "m": parseMonthNumber,
  2852. "M": parseMinutes,
  2853. "p": parsePeriod,
  2854. "q": parseQuarter,
  2855. "Q": parseUnixTimestamp,
  2856. "s": parseUnixTimestampSeconds,
  2857. "S": parseSeconds,
  2858. "u": parseWeekdayNumberMonday,
  2859. "U": parseWeekNumberSunday,
  2860. "V": parseWeekNumberISO,
  2861. "w": parseWeekdayNumberSunday,
  2862. "W": parseWeekNumberMonday,
  2863. "x": parseLocaleDate,
  2864. "X": parseLocaleTime,
  2865. "y": parseYear,
  2866. "Y": parseFullYear,
  2867. "Z": parseZone,
  2868. "%": parseLiteralPercent
  2869. };
  2870. // These recursive directive definitions must be deferred.
  2871. formats.x = newFormat(locale_date, formats);
  2872. formats.X = newFormat(locale_time, formats);
  2873. formats.c = newFormat(locale_dateTime, formats);
  2874. utcFormats.x = newFormat(locale_date, utcFormats);
  2875. utcFormats.X = newFormat(locale_time, utcFormats);
  2876. utcFormats.c = newFormat(locale_dateTime, utcFormats);
  2877. function newFormat(specifier, formats) {
  2878. return function(date) {
  2879. var string = [],
  2880. i = -1,
  2881. j = 0,
  2882. n = specifier.length,
  2883. c,
  2884. pad,
  2885. format;
  2886. if (!(date instanceof Date)) date = new Date(+date);
  2887. while (++i < n) {
  2888. if (specifier.charCodeAt(i) === 37) {
  2889. string.push(specifier.slice(j, i));
  2890. if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
  2891. else pad = c === "e" ? " " : "0";
  2892. if (format = formats[c]) c = format(date, pad);
  2893. string.push(c);
  2894. j = i + 1;
  2895. }
  2896. }
  2897. string.push(specifier.slice(j, i));
  2898. return string.join("");
  2899. };
  2900. }
  2901. function newParse(specifier, Z) {
  2902. return function(string) {
  2903. var d = newDate(1900, undefined, 1),
  2904. i = parseSpecifier(d, specifier, string += "", 0),
  2905. week, day$1;
  2906. if (i != string.length) return null;
  2907. // If a UNIX timestamp is specified, return it.
  2908. if ("Q" in d) return new Date(d.Q);
  2909. if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0));
  2910. // If this is utcParse, never use the local timezone.
  2911. if (Z && !("Z" in d)) d.Z = 0;
  2912. // The am-pm flag is 0 for AM, and 1 for PM.
  2913. if ("p" in d) d.H = d.H % 12 + d.p * 12;
  2914. // If the month was not specified, inherit from the quarter.
  2915. if (d.m === undefined) d.m = "q" in d ? d.q : 0;
  2916. // Convert day-of-week and week-of-year to day-of-year.
  2917. if ("V" in d) {
  2918. if (d.V < 1 || d.V > 53) return null;
  2919. if (!("w" in d)) d.w = 1;
  2920. if ("Z" in d) {
  2921. week = utcDate(newDate(d.y, 0, 1)), day$1 = week.getUTCDay();
  2922. week = day$1 > 4 || day$1 === 0 ? utcMonday.ceil(week) : utcMonday(week);
  2923. week = utcDay.offset(week, (d.V - 1) * 7);
  2924. d.y = week.getUTCFullYear();
  2925. d.m = week.getUTCMonth();
  2926. d.d = week.getUTCDate() + (d.w + 6) % 7;
  2927. } else {
  2928. week = localDate(newDate(d.y, 0, 1)), day$1 = week.getDay();
  2929. week = day$1 > 4 || day$1 === 0 ? monday.ceil(week) : monday(week);
  2930. week = day.offset(week, (d.V - 1) * 7);
  2931. d.y = week.getFullYear();
  2932. d.m = week.getMonth();
  2933. d.d = week.getDate() + (d.w + 6) % 7;
  2934. }
  2935. } else if ("W" in d || "U" in d) {
  2936. if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
  2937. day$1 = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
  2938. d.m = 0;
  2939. d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$1 + 5) % 7 : d.w + d.U * 7 - (day$1 + 6) % 7;
  2940. }
  2941. // If a time zone is specified, all fields are interpreted as UTC and then
  2942. // offset according to the specified time zone.
  2943. if ("Z" in d) {
  2944. d.H += d.Z / 100 | 0;
  2945. d.M += d.Z % 100;
  2946. return utcDate(d);
  2947. }
  2948. // Otherwise, all fields are in local time.
  2949. return localDate(d);
  2950. };
  2951. }
  2952. function parseSpecifier(d, specifier, string, j) {
  2953. var i = 0,
  2954. n = specifier.length,
  2955. m = string.length,
  2956. c,
  2957. parse;
  2958. while (i < n) {
  2959. if (j >= m) return -1;
  2960. c = specifier.charCodeAt(i++);
  2961. if (c === 37) {
  2962. c = specifier.charAt(i++);
  2963. parse = parses[c in pads ? specifier.charAt(i++) : c];
  2964. if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
  2965. } else if (c != string.charCodeAt(j++)) {
  2966. return -1;
  2967. }
  2968. }
  2969. return j;
  2970. }
  2971. function parsePeriod(d, string, i) {
  2972. var n = periodRe.exec(string.slice(i));
  2973. return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  2974. }
  2975. function parseShortWeekday(d, string, i) {
  2976. var n = shortWeekdayRe.exec(string.slice(i));
  2977. return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  2978. }
  2979. function parseWeekday(d, string, i) {
  2980. var n = weekdayRe.exec(string.slice(i));
  2981. return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  2982. }
  2983. function parseShortMonth(d, string, i) {
  2984. var n = shortMonthRe.exec(string.slice(i));
  2985. return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  2986. }
  2987. function parseMonth(d, string, i) {
  2988. var n = monthRe.exec(string.slice(i));
  2989. return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  2990. }
  2991. function parseLocaleDateTime(d, string, i) {
  2992. return parseSpecifier(d, locale_dateTime, string, i);
  2993. }
  2994. function parseLocaleDate(d, string, i) {
  2995. return parseSpecifier(d, locale_date, string, i);
  2996. }
  2997. function parseLocaleTime(d, string, i) {
  2998. return parseSpecifier(d, locale_time, string, i);
  2999. }
  3000. function formatShortWeekday(d) {
  3001. return locale_shortWeekdays[d.getDay()];
  3002. }
  3003. function formatWeekday(d) {
  3004. return locale_weekdays[d.getDay()];
  3005. }
  3006. function formatShortMonth(d) {
  3007. return locale_shortMonths[d.getMonth()];
  3008. }
  3009. function formatMonth(d) {
  3010. return locale_months[d.getMonth()];
  3011. }
  3012. function formatPeriod(d) {
  3013. return locale_periods[+(d.getHours() >= 12)];
  3014. }
  3015. function formatQuarter(d) {
  3016. return 1 + ~~(d.getMonth() / 3);
  3017. }
  3018. function formatUTCShortWeekday(d) {
  3019. return locale_shortWeekdays[d.getUTCDay()];
  3020. }
  3021. function formatUTCWeekday(d) {
  3022. return locale_weekdays[d.getUTCDay()];
  3023. }
  3024. function formatUTCShortMonth(d) {
  3025. return locale_shortMonths[d.getUTCMonth()];
  3026. }
  3027. function formatUTCMonth(d) {
  3028. return locale_months[d.getUTCMonth()];
  3029. }
  3030. function formatUTCPeriod(d) {
  3031. return locale_periods[+(d.getUTCHours() >= 12)];
  3032. }
  3033. function formatUTCQuarter(d) {
  3034. return 1 + ~~(d.getUTCMonth() / 3);
  3035. }
  3036. return {
  3037. format: function(specifier) {
  3038. var f = newFormat(specifier += "", formats);
  3039. f.toString = function() { return specifier; };
  3040. return f;
  3041. },
  3042. parse: function(specifier) {
  3043. var p = newParse(specifier += "", false);
  3044. p.toString = function() { return specifier; };
  3045. return p;
  3046. },
  3047. utcFormat: function(specifier) {
  3048. var f = newFormat(specifier += "", utcFormats);
  3049. f.toString = function() { return specifier; };
  3050. return f;
  3051. },
  3052. utcParse: function(specifier) {
  3053. var p = newParse(specifier += "", true);
  3054. p.toString = function() { return specifier; };
  3055. return p;
  3056. }
  3057. };
  3058. }
  3059. var pads = {"-": "", "_": " ", "0": "0"},
  3060. numberRe = /^\s*\d+/, // note: ignores next directive
  3061. percentRe = /^%/,
  3062. requoteRe = /[\\^$*+?|[\]().{}]/g;
  3063. function pad(value, fill, width) {
  3064. var sign = value < 0 ? "-" : "",
  3065. string = (sign ? -value : value) + "",
  3066. length = string.length;
  3067. return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
  3068. }
  3069. function requote(s) {
  3070. return s.replace(requoteRe, "\\$&");
  3071. }
  3072. function formatRe(names) {
  3073. return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
  3074. }
  3075. function formatLookup(names) {
  3076. return new Map(names.map((name, i) => [name.toLowerCase(), i]));
  3077. }
  3078. function parseWeekdayNumberSunday(d, string, i) {
  3079. var n = numberRe.exec(string.slice(i, i + 1));
  3080. return n ? (d.w = +n[0], i + n[0].length) : -1;
  3081. }
  3082. function parseWeekdayNumberMonday(d, string, i) {
  3083. var n = numberRe.exec(string.slice(i, i + 1));
  3084. return n ? (d.u = +n[0], i + n[0].length) : -1;
  3085. }
  3086. function parseWeekNumberSunday(d, string, i) {
  3087. var n = numberRe.exec(string.slice(i, i + 2));
  3088. return n ? (d.U = +n[0], i + n[0].length) : -1;
  3089. }
  3090. function parseWeekNumberISO(d, string, i) {
  3091. var n = numberRe.exec(string.slice(i, i + 2));
  3092. return n ? (d.V = +n[0], i + n[0].length) : -1;
  3093. }
  3094. function parseWeekNumberMonday(d, string, i) {
  3095. var n = numberRe.exec(string.slice(i, i + 2));
  3096. return n ? (d.W = +n[0], i + n[0].length) : -1;
  3097. }
  3098. function parseFullYear(d, string, i) {
  3099. var n = numberRe.exec(string.slice(i, i + 4));
  3100. return n ? (d.y = +n[0], i + n[0].length) : -1;
  3101. }
  3102. function parseYear(d, string, i) {
  3103. var n = numberRe.exec(string.slice(i, i + 2));
  3104. return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
  3105. }
  3106. function parseZone(d, string, i) {
  3107. var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
  3108. return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
  3109. }
  3110. function parseQuarter(d, string, i) {
  3111. var n = numberRe.exec(string.slice(i, i + 1));
  3112. return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
  3113. }
  3114. function parseMonthNumber(d, string, i) {
  3115. var n = numberRe.exec(string.slice(i, i + 2));
  3116. return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
  3117. }
  3118. function parseDayOfMonth(d, string, i) {
  3119. var n = numberRe.exec(string.slice(i, i + 2));
  3120. return n ? (d.d = +n[0], i + n[0].length) : -1;
  3121. }
  3122. function parseDayOfYear(d, string, i) {
  3123. var n = numberRe.exec(string.slice(i, i + 3));
  3124. return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
  3125. }
  3126. function parseHour24(d, string, i) {
  3127. var n = numberRe.exec(string.slice(i, i + 2));
  3128. return n ? (d.H = +n[0], i + n[0].length) : -1;
  3129. }
  3130. function parseMinutes(d, string, i) {
  3131. var n = numberRe.exec(string.slice(i, i + 2));
  3132. return n ? (d.M = +n[0], i + n[0].length) : -1;
  3133. }
  3134. function parseSeconds(d, string, i) {
  3135. var n = numberRe.exec(string.slice(i, i + 2));
  3136. return n ? (d.S = +n[0], i + n[0].length) : -1;
  3137. }
  3138. function parseMilliseconds(d, string, i) {
  3139. var n = numberRe.exec(string.slice(i, i + 3));
  3140. return n ? (d.L = +n[0], i + n[0].length) : -1;
  3141. }
  3142. function parseMicroseconds(d, string, i) {
  3143. var n = numberRe.exec(string.slice(i, i + 6));
  3144. return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
  3145. }
  3146. function parseLiteralPercent(d, string, i) {
  3147. var n = percentRe.exec(string.slice(i, i + 1));
  3148. return n ? i + n[0].length : -1;
  3149. }
  3150. function parseUnixTimestamp(d, string, i) {
  3151. var n = numberRe.exec(string.slice(i));
  3152. return n ? (d.Q = +n[0], i + n[0].length) : -1;
  3153. }
  3154. function parseUnixTimestampSeconds(d, string, i) {
  3155. var n = numberRe.exec(string.slice(i));
  3156. return n ? (d.s = +n[0], i + n[0].length) : -1;
  3157. }
  3158. function formatDayOfMonth(d, p) {
  3159. return pad(d.getDate(), p, 2);
  3160. }
  3161. function formatHour24(d, p) {
  3162. return pad(d.getHours(), p, 2);
  3163. }
  3164. function formatHour12(d, p) {
  3165. return pad(d.getHours() % 12 || 12, p, 2);
  3166. }
  3167. function formatDayOfYear(d, p) {
  3168. return pad(1 + day.count(year(d), d), p, 3);
  3169. }
  3170. function formatMilliseconds(d, p) {
  3171. return pad(d.getMilliseconds(), p, 3);
  3172. }
  3173. function formatMicroseconds(d, p) {
  3174. return formatMilliseconds(d, p) + "000";
  3175. }
  3176. function formatMonthNumber(d, p) {
  3177. return pad(d.getMonth() + 1, p, 2);
  3178. }
  3179. function formatMinutes(d, p) {
  3180. return pad(d.getMinutes(), p, 2);
  3181. }
  3182. function formatSeconds(d, p) {
  3183. return pad(d.getSeconds(), p, 2);
  3184. }
  3185. function formatWeekdayNumberMonday(d) {
  3186. var day = d.getDay();
  3187. return day === 0 ? 7 : day;
  3188. }
  3189. function formatWeekNumberSunday(d, p) {
  3190. return pad(sunday.count(year(d) - 1, d), p, 2);
  3191. }
  3192. function dISO(d) {
  3193. var day = d.getDay();
  3194. return (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
  3195. }
  3196. function formatWeekNumberISO(d, p) {
  3197. d = dISO(d);
  3198. return pad(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
  3199. }
  3200. function formatWeekdayNumberSunday(d) {
  3201. return d.getDay();
  3202. }
  3203. function formatWeekNumberMonday(d, p) {
  3204. return pad(monday.count(year(d) - 1, d), p, 2);
  3205. }
  3206. function formatYear(d, p) {
  3207. return pad(d.getFullYear() % 100, p, 2);
  3208. }
  3209. function formatYearISO(d, p) {
  3210. d = dISO(d);
  3211. return pad(d.getFullYear() % 100, p, 2);
  3212. }
  3213. function formatFullYear(d, p) {
  3214. return pad(d.getFullYear() % 10000, p, 4);
  3215. }
  3216. function formatFullYearISO(d, p) {
  3217. var day = d.getDay();
  3218. d = (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
  3219. return pad(d.getFullYear() % 10000, p, 4);
  3220. }
  3221. function formatZone(d) {
  3222. var z = d.getTimezoneOffset();
  3223. return (z > 0 ? "-" : (z *= -1, "+"))
  3224. + pad(z / 60 | 0, "0", 2)
  3225. + pad(z % 60, "0", 2);
  3226. }
  3227. function formatUTCDayOfMonth(d, p) {
  3228. return pad(d.getUTCDate(), p, 2);
  3229. }
  3230. function formatUTCHour24(d, p) {
  3231. return pad(d.getUTCHours(), p, 2);
  3232. }
  3233. function formatUTCHour12(d, p) {
  3234. return pad(d.getUTCHours() % 12 || 12, p, 2);
  3235. }
  3236. function formatUTCDayOfYear(d, p) {
  3237. return pad(1 + utcDay.count(utcYear(d), d), p, 3);
  3238. }
  3239. function formatUTCMilliseconds(d, p) {
  3240. return pad(d.getUTCMilliseconds(), p, 3);
  3241. }
  3242. function formatUTCMicroseconds(d, p) {
  3243. return formatUTCMilliseconds(d, p) + "000";
  3244. }
  3245. function formatUTCMonthNumber(d, p) {
  3246. return pad(d.getUTCMonth() + 1, p, 2);
  3247. }
  3248. function formatUTCMinutes(d, p) {
  3249. return pad(d.getUTCMinutes(), p, 2);
  3250. }
  3251. function formatUTCSeconds(d, p) {
  3252. return pad(d.getUTCSeconds(), p, 2);
  3253. }
  3254. function formatUTCWeekdayNumberMonday(d) {
  3255. var dow = d.getUTCDay();
  3256. return dow === 0 ? 7 : dow;
  3257. }
  3258. function formatUTCWeekNumberSunday(d, p) {
  3259. return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);
  3260. }
  3261. function UTCdISO(d) {
  3262. var day = d.getUTCDay();
  3263. return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
  3264. }
  3265. function formatUTCWeekNumberISO(d, p) {
  3266. d = UTCdISO(d);
  3267. return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
  3268. }
  3269. function formatUTCWeekdayNumberSunday(d) {
  3270. return d.getUTCDay();
  3271. }
  3272. function formatUTCWeekNumberMonday(d, p) {
  3273. return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);
  3274. }
  3275. function formatUTCYear(d, p) {
  3276. return pad(d.getUTCFullYear() % 100, p, 2);
  3277. }
  3278. function formatUTCYearISO(d, p) {
  3279. d = UTCdISO(d);
  3280. return pad(d.getUTCFullYear() % 100, p, 2);
  3281. }
  3282. function formatUTCFullYear(d, p) {
  3283. return pad(d.getUTCFullYear() % 10000, p, 4);
  3284. }
  3285. function formatUTCFullYearISO(d, p) {
  3286. var day = d.getUTCDay();
  3287. d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
  3288. return pad(d.getUTCFullYear() % 10000, p, 4);
  3289. }
  3290. function formatUTCZone() {
  3291. return "+0000";
  3292. }
  3293. function formatLiteralPercent() {
  3294. return "%";
  3295. }
  3296. function formatUnixTimestamp(d) {
  3297. return +d;
  3298. }
  3299. function formatUnixTimestampSeconds(d) {
  3300. return Math.floor(+d / 1000);
  3301. }
  3302. var locale;
  3303. var utcFormat;
  3304. var utcParse;
  3305. defaultLocale({
  3306. dateTime: "%x, %X",
  3307. date: "%-m/%-d/%Y",
  3308. time: "%-I:%M:%S %p",
  3309. periods: ["AM", "PM"],
  3310. days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  3311. shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  3312. months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  3313. shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  3314. });
  3315. function defaultLocale(definition) {
  3316. locale = formatLocale(definition);
  3317. locale.format;
  3318. locale.parse;
  3319. utcFormat = locale.utcFormat;
  3320. utcParse = locale.utcParse;
  3321. return locale;
  3322. }
  3323. var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
  3324. function formatIsoNative(date) {
  3325. return date.toISOString();
  3326. }
  3327. Date.prototype.toISOString
  3328. ? formatIsoNative
  3329. : utcFormat(isoSpecifier);
  3330. function parseIsoNative(string) {
  3331. var date = new Date(string);
  3332. return isNaN(date) ? null : date;
  3333. }
  3334. +new Date("2000-01-01T00:00:00.000Z")
  3335. ? parseIsoNative
  3336. : utcParse(isoSpecifier);
  3337. function transformer() {
  3338. var x0 = 0,
  3339. x1 = 1,
  3340. t0,
  3341. t1,
  3342. k10,
  3343. transform,
  3344. interpolator = identity$1,
  3345. clamp = false,
  3346. unknown;
  3347. function scale(x) {
  3348. return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));
  3349. }
  3350. scale.domain = function(_) {
  3351. return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
  3352. };
  3353. scale.clamp = function(_) {
  3354. return arguments.length ? (clamp = !!_, scale) : clamp;
  3355. };
  3356. scale.interpolator = function(_) {
  3357. return arguments.length ? (interpolator = _, scale) : interpolator;
  3358. };
  3359. function range(interpolate) {
  3360. return function(_) {
  3361. var r0, r1;
  3362. return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];
  3363. };
  3364. }
  3365. scale.range = range(interpolate);
  3366. scale.rangeRound = range(interpolateRound);
  3367. scale.unknown = function(_) {
  3368. return arguments.length ? (unknown = _, scale) : unknown;
  3369. };
  3370. return function(t) {
  3371. transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);
  3372. return scale;
  3373. };
  3374. }
  3375. function copy(source, target) {
  3376. return target
  3377. .domain(source.domain())
  3378. .interpolator(source.interpolator())
  3379. .clamp(source.clamp())
  3380. .unknown(source.unknown());
  3381. }
  3382. function sequential() {
  3383. var scale = linearish(transformer()(identity$1));
  3384. scale.copy = function() {
  3385. return copy(scale, sequential());
  3386. };
  3387. return initInterpolator.apply(scale, arguments);
  3388. }
  3389. const COLOR_BASE = "#cecece";
  3390. // https://www.w3.org/TR/WCAG20/#relativeluminancedef
  3391. const rc = 0.2126;
  3392. const gc = 0.7152;
  3393. const bc = 0.0722;
  3394. // low-gamma adjust coefficient
  3395. const lowc = 1 / 12.92;
  3396. function adjustGamma(p) {
  3397. return Math.pow((p + 0.055) / 1.055, 2.4);
  3398. }
  3399. function relativeLuminance(o) {
  3400. const rsrgb = o.r / 255;
  3401. const gsrgb = o.g / 255;
  3402. const bsrgb = o.b / 255;
  3403. const r = rsrgb <= 0.03928 ? rsrgb * lowc : adjustGamma(rsrgb);
  3404. const g = gsrgb <= 0.03928 ? gsrgb * lowc : adjustGamma(gsrgb);
  3405. const b = bsrgb <= 0.03928 ? bsrgb * lowc : adjustGamma(bsrgb);
  3406. return r * rc + g * gc + b * bc;
  3407. }
  3408. const createRainbowColor = (root) => {
  3409. const colorParentMap = new Map();
  3410. colorParentMap.set(root, COLOR_BASE);
  3411. if (root.children != null) {
  3412. const colorScale = sequential([0, root.children.length], (n) => hsl(360 * n, 0.3, 0.85));
  3413. root.children.forEach((c, id) => {
  3414. colorParentMap.set(c, colorScale(id).toString());
  3415. });
  3416. }
  3417. const colorMap = new Map();
  3418. const lightScale = linear().domain([0, root.height]).range([0.9, 0.3]);
  3419. const getBackgroundColor = (node) => {
  3420. const parents = node.ancestors();
  3421. const colorStr = parents.length === 1
  3422. ? colorParentMap.get(parents[0])
  3423. : colorParentMap.get(parents[parents.length - 2]);
  3424. const hslColor = hsl(colorStr);
  3425. hslColor.l = lightScale(node.depth);
  3426. return hslColor;
  3427. };
  3428. return (node) => {
  3429. if (!colorMap.has(node)) {
  3430. const backgroundColor = getBackgroundColor(node);
  3431. const l = relativeLuminance(backgroundColor.rgb());
  3432. const fontColor = l > 0.19 ? "#000" : "#fff";
  3433. colorMap.set(node, {
  3434. backgroundColor: backgroundColor.toString(),
  3435. fontColor,
  3436. });
  3437. }
  3438. return colorMap.get(node);
  3439. };
  3440. };
  3441. const StaticContext = B$2({});
  3442. const drawChart = (parentNode, data, width, height) => {
  3443. const availableSizeProperties = getAvailableSizeOptions(data.options);
  3444. console.time("layout create");
  3445. const layout = treemap()
  3446. .size([width, height])
  3447. .paddingOuter(PADDING)
  3448. .paddingTop(TOP_PADDING)
  3449. .paddingInner(PADDING)
  3450. .round(true)
  3451. .tile(treemapResquarify);
  3452. console.timeEnd("layout create");
  3453. console.time("rawHierarchy create");
  3454. const rawHierarchy = hierarchy(data.tree);
  3455. console.timeEnd("rawHierarchy create");
  3456. const nodeSizesCache = new Map();
  3457. const nodeIdsCache = new Map();
  3458. const getModuleSize = (node, sizeKey) => { var _a, _b; return (_b = (_a = nodeSizesCache.get(node)) === null || _a === void 0 ? void 0 : _a[sizeKey]) !== null && _b !== void 0 ? _b : 0; };
  3459. console.time("rawHierarchy eachAfter cache");
  3460. rawHierarchy.eachAfter((node) => {
  3461. var _a;
  3462. const nodeData = node.data;
  3463. nodeIdsCache.set(nodeData, {
  3464. nodeUid: generateUniqueId("node"),
  3465. clipUid: generateUniqueId("clip"),
  3466. });
  3467. const sizes = { renderedLength: 0, gzipLength: 0, brotliLength: 0 };
  3468. if (isModuleTree(nodeData)) {
  3469. for (const sizeKey of availableSizeProperties) {
  3470. sizes[sizeKey] = nodeData.children.reduce((acc, child) => getModuleSize(child, sizeKey) + acc, 0);
  3471. }
  3472. }
  3473. else {
  3474. for (const sizeKey of availableSizeProperties) {
  3475. sizes[sizeKey] = (_a = data.nodeParts[nodeData.uid][sizeKey]) !== null && _a !== void 0 ? _a : 0;
  3476. }
  3477. }
  3478. nodeSizesCache.set(nodeData, sizes);
  3479. });
  3480. console.timeEnd("rawHierarchy eachAfter cache");
  3481. const getModuleIds = (node) => nodeIdsCache.get(node);
  3482. console.time("color");
  3483. const getModuleColor = createRainbowColor(rawHierarchy);
  3484. console.timeEnd("color");
  3485. P(o$1(StaticContext.Provider, Object.assign({ value: {
  3486. data,
  3487. availableSizeProperties,
  3488. width,
  3489. height,
  3490. getModuleSize,
  3491. getModuleIds,
  3492. getModuleColor,
  3493. rawHierarchy,
  3494. layout,
  3495. } }, { children: o$1(Main, {}) })), parentNode);
  3496. };
  3497. exports.StaticContext = StaticContext;
  3498. exports.default = drawChart;
  3499. Object.defineProperty(exports, '__esModule', { value: true });
  3500. return exports;
  3501. })({});
  3502. //# sourceMappingURL=treemap.js.map
  3503. /*-->*/
  3504. </script>
  3505. <script>
  3506. /*<!--*/
  3507. const data = {"version":2,"tree":{"name":"root","children":[{"name":"tres.umd.cjs","children":[{"name":"src","children":[{"name":"core","children":[{"name":"useCamera/useCamera.ts","uid":"d36d-50"},{"name":"useCatalog/useCatalog.ts","uid":"d36d-52"},{"name":"useScene/useScene.ts","uid":"d36d-60"},{"name":"useInstanceCreator/useInstanceCreator.ts","uid":"d36d-62"},{"name":"useLoop/useLoop.ts","uid":"d36d-64"},{"name":"useLoader/useLoader.ts","uid":"d36d-66"},{"name":"useTexture/useTexture.ts","uid":"d36d-68"},{"name":"useTres/index.ts","uid":"d36d-70"},{"name":"useTweakPane/index.ts","uid":"d36d-82"},{"name":"useRenderer/useRenderer.ts","uid":"d36d-84"}]},{"name":"utils/normalize.ts","uid":"d36d-56"},{"name":"composables/useLogger.ts","uid":"d36d-58"},{"uid":"d36d-86","name":"keys.ts"},{"name":"components","children":[{"uid":"d36d-88","name":"TresCanvas.vue?vue&type=script&setup=true&lang.ts"},{"uid":"d36d-90","name":"TresCanvas.vue"}]},{"uid":"d36d-92","name":"index.ts"}]},{"name":"Users/x400048/Projects/github/tres/node_modules/.pnpm","children":[{"name":"@alvarosabu+utils@2.2.0/node_modules/@alvarosabu/utils/dist/as-utils.es.js","uid":"d36d-54"},{"name":"tweakpane@3.1.0/node_modules/tweakpane/dist/tweakpane.js","uid":"d36d-76"},{"name":"@tweakpane+plugin-essentials@0.1.5_tweakpane@3.1.0/node_modules/@tweakpane/plugin-essentials/dist/tweakpane-plugin-essentials.js","uid":"d36d-80"}]},{"uid":"d36d-72","name":"\u0000commonjsHelpers.js"},{"name":"\u0000/Users/x400048/Projects/github/tres/node_modules/.pnpm","children":[{"name":"tweakpane@3.1.0/node_modules/tweakpane/dist/tweakpane.js?commonjs-module","uid":"d36d-74"},{"name":"@tweakpane+plugin-essentials@0.1.5_tweakpane@3.1.0/node_modules/@tweakpane/plugin-essentials/dist/tweakpane-plugin-essentials.js?commonjs-module","uid":"d36d-78"}]}]}],"isRoot":true},"nodeParts":{"d36d-50":{"renderedLength":1908,"gzipLength":616,"brotliLength":523,"mainUid":"d36d-49"},"d36d-52":{"renderedLength":216,"gzipLength":152,"brotliLength":117,"mainUid":"d36d-51"},"d36d-54":{"renderedLength":355,"gzipLength":244,"brotliLength":190,"mainUid":"d36d-53"},"d36d-56":{"renderedLength":457,"gzipLength":209,"brotliLength":166,"mainUid":"d36d-55"},"d36d-58":{"renderedLength":387,"gzipLength":206,"brotliLength":177,"mainUid":"d36d-57"},"d36d-60":{"renderedLength":355,"gzipLength":192,"brotliLength":178,"mainUid":"d36d-59"},"d36d-62":{"renderedLength":3334,"gzipLength":979,"brotliLength":841,"mainUid":"d36d-61"},"d36d-64":{"renderedLength":625,"gzipLength":272,"brotliLength":233,"mainUid":"d36d-63"},"d36d-66":{"renderedLength":196,"gzipLength":117,"brotliLength":97,"mainUid":"d36d-65"},"d36d-68":{"renderedLength":1241,"gzipLength":439,"brotliLength":384,"mainUid":"d36d-67"},"d36d-70":{"renderedLength":280,"gzipLength":159,"brotliLength":141,"mainUid":"d36d-69"},"d36d-72":{"renderedLength":342,"gzipLength":223,"brotliLength":164,"mainUid":"d36d-71"},"d36d-74":{"renderedLength":32,"gzipLength":52,"brotliLength":36,"mainUid":"d36d-73"},"d36d-76":{"renderedLength":314633,"gzipLength":42397,"brotliLength":34116,"mainUid":"d36d-75"},"d36d-78":{"renderedLength":50,"gzipLength":70,"brotliLength":54,"mainUid":"d36d-77"},"d36d-80":{"renderedLength":163733,"gzipLength":25301,"brotliLength":19879,"mainUid":"d36d-79"},"d36d-82":{"renderedLength":703,"gzipLength":323,"brotliLength":272,"mainUid":"d36d-81"},"d36d-84":{"renderedLength":2420,"gzipLength":754,"brotliLength":659,"mainUid":"d36d-83"},"d36d-86":{"renderedLength":52,"gzipLength":57,"brotliLength":51,"mainUid":"d36d-85"},"d36d-88":{"renderedLength":3795,"gzipLength":1218,"brotliLength":1052,"mainUid":"d36d-87"},"d36d-90":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"d36d-89"},"d36d-92":{"renderedLength":298,"gzipLength":178,"brotliLength":154,"mainUid":"d36d-91"}},"nodeMetas":{"d36d-49":{"id":"/src/core/useCamera/useCamera.ts","moduleParts":{"tres.umd.cjs":"d36d-50"},"imported":[{"uid":"d36d-95"},{"uid":"d36d-96"},{"uid":"d36d-94"}],"importedBy":[{"uid":"d36d-93"},{"uid":"d36d-87"},{"uid":"d36d-61"}]},"d36d-51":{"id":"/src/core/useCatalog/useCatalog.ts","moduleParts":{"tres.umd.cjs":"d36d-52"},"imported":[{"uid":"d36d-95"}],"importedBy":[{"uid":"d36d-93"},{"uid":"d36d-61"}]},"d36d-53":{"id":"/Users/x400048/Projects/github/tres/node_modules/.pnpm/@alvarosabu+utils@2.2.0/node_modules/@alvarosabu/utils/dist/as-utils.es.js","moduleParts":{"tres.umd.cjs":"d36d-54"},"imported":[],"importedBy":[{"uid":"d36d-61"},{"uid":"d36d-67"}]},"d36d-55":{"id":"/src/utils/normalize.ts","moduleParts":{"tres.umd.cjs":"d36d-56"},"imported":[{"uid":"d36d-95"}],"importedBy":[{"uid":"d36d-87"},{"uid":"d36d-61"},{"uid":"d36d-83"}]},"d36d-57":{"id":"/src/composables/useLogger.ts","moduleParts":{"tres.umd.cjs":"d36d-58"},"imported":[],"importedBy":[{"uid":"d36d-97"}]},"d36d-59":{"id":"/src/core/useScene/useScene.ts","moduleParts":{"tres.umd.cjs":"d36d-60"},"imported":[{"uid":"d36d-95"},{"uid":"d36d-94"},{"uid":"d36d-97"}],"importedBy":[{"uid":"d36d-93"},{"uid":"d36d-87"},{"uid":"d36d-61"}]},"d36d-61":{"id":"/src/core/useInstanceCreator/useInstanceCreator.ts","moduleParts":{"tres.umd.cjs":"d36d-62"},"imported":[{"uid":"d36d-94"},{"uid":"d36d-53"},{"uid":"d36d-55"},{"uid":"d36d-51"},{"uid":"d36d-59"},{"uid":"d36d-97"},{"uid":"d36d-49"}],"importedBy":[{"uid":"d36d-93"}]},"d36d-63":{"id":"/src/core/useLoop/useLoop.ts","moduleParts":{"tres.umd.cjs":"d36d-64"},"imported":[{"uid":"d36d-95"},{"uid":"d36d-93"}],"importedBy":[{"uid":"d36d-93"}]},"d36d-65":{"id":"/src/core/useLoader/useLoader.ts","moduleParts":{"tres.umd.cjs":"d36d-66"},"imported":[{"uid":"d36d-95"},{"uid":"d36d-94"}],"importedBy":[{"uid":"d36d-93"},{"uid":"d36d-67"}]},"d36d-67":{"id":"/src/core/useTexture/useTexture.ts","moduleParts":{"tres.umd.cjs":"d36d-68"},"imported":[{"uid":"d36d-53"},{"uid":"d36d-95"},{"uid":"d36d-65"}],"importedBy":[{"uid":"d36d-93"}]},"d36d-69":{"id":"/src/core/useTres/index.ts","moduleParts":{"tres.umd.cjs":"d36d-70"},"imported":[{"uid":"d36d-94"}],"importedBy":[{"uid":"d36d-93"}]},"d36d-71":{"id":"\u0000commonjsHelpers.js","moduleParts":{"tres.umd.cjs":"d36d-72"},"imported":[],"importedBy":[{"uid":"d36d-75"},{"uid":"d36d-79"}]},"d36d-73":{"id":"\u0000/Users/x400048/Projects/github/tres/node_modules/.pnpm/tweakpane@3.1.0/node_modules/tweakpane/dist/tweakpane.js?commonjs-module","moduleParts":{"tres.umd.cjs":"d36d-74"},"imported":[],"importedBy":[{"uid":"d36d-75"}]},"d36d-75":{"id":"/Users/x400048/Projects/github/tres/node_modules/.pnpm/tweakpane@3.1.0/node_modules/tweakpane/dist/tweakpane.js","moduleParts":{"tres.umd.cjs":"d36d-76"},"imported":[{"uid":"d36d-71"},{"uid":"d36d-73"}],"importedBy":[{"uid":"d36d-81"}]},"d36d-77":{"id":"\u0000/Users/x400048/Projects/github/tres/node_modules/.pnpm/@tweakpane+plugin-essentials@0.1.5_tweakpane@3.1.0/node_modules/@tweakpane/plugin-essentials/dist/tweakpane-plugin-essentials.js?commonjs-module","moduleParts":{"tres.umd.cjs":"d36d-78"},"imported":[],"importedBy":[{"uid":"d36d-79"}]},"d36d-79":{"id":"/Users/x400048/Projects/github/tres/node_modules/.pnpm/@tweakpane+plugin-essentials@0.1.5_tweakpane@3.1.0/node_modules/@tweakpane/plugin-essentials/dist/tweakpane-plugin-essentials.js","moduleParts":{"tres.umd.cjs":"d36d-80"},"imported":[{"uid":"d36d-71"},{"uid":"d36d-77"}],"importedBy":[{"uid":"d36d-81"}]},"d36d-81":{"id":"/src/core/useTweakPane/index.ts","moduleParts":{"tres.umd.cjs":"d36d-82"},"imported":[{"uid":"d36d-94"},{"uid":"d36d-75"},{"uid":"d36d-79"},{"uid":"d36d-93"}],"importedBy":[{"uid":"d36d-93"}]},"d36d-83":{"id":"/src/core/useRenderer/useRenderer.ts","moduleParts":{"tres.umd.cjs":"d36d-84"},"imported":[{"uid":"d36d-96"},{"uid":"d36d-94"},{"uid":"d36d-95"},{"uid":"d36d-93"},{"uid":"d36d-55"},{"uid":"d36d-97"}],"importedBy":[{"uid":"d36d-93"},{"uid":"d36d-87"}]},"d36d-85":{"id":"/src/keys.ts","moduleParts":{"tres.umd.cjs":"d36d-86"},"imported":[],"importedBy":[{"uid":"d36d-91"},{"uid":"d36d-87"}]},"d36d-87":{"id":"/src/components/TresCanvas.vue?vue&type=script&setup=true&lang.ts","moduleParts":{"tres.umd.cjs":"d36d-88"},"imported":[{"uid":"d36d-94"},{"uid":"d36d-95"},{"uid":"d36d-49"},{"uid":"d36d-83"},{"uid":"d36d-59"},{"uid":"d36d-55"},{"uid":"d36d-93"},{"uid":"d36d-85"}],"importedBy":[{"uid":"d36d-89"}]},"d36d-89":{"id":"/src/components/TresCanvas.vue","moduleParts":{"tres.umd.cjs":"d36d-90"},"imported":[{"uid":"d36d-87"}],"importedBy":[{"uid":"d36d-91"}]},"d36d-91":{"id":"/src/index.ts","moduleParts":{"tres.umd.cjs":"d36d-92"},"imported":[{"uid":"d36d-89"},{"uid":"d36d-93"},{"uid":"d36d-85"}],"importedBy":[],"isEntry":true},"d36d-93":{"id":"/src/core/index.ts","moduleParts":{},"imported":[{"uid":"d36d-49"},{"uid":"d36d-51"},{"uid":"d36d-61"},{"uid":"d36d-63"},{"uid":"d36d-83"},{"uid":"d36d-59"},{"uid":"d36d-65"},{"uid":"d36d-67"},{"uid":"d36d-69"},{"uid":"d36d-81"}],"importedBy":[{"uid":"d36d-91"},{"uid":"d36d-87"},{"uid":"d36d-63"},{"uid":"d36d-83"},{"uid":"d36d-81"}]},"d36d-94":{"id":"vue","moduleParts":{},"imported":[],"importedBy":[{"uid":"d36d-87"},{"uid":"d36d-49"},{"uid":"d36d-61"},{"uid":"d36d-83"},{"uid":"d36d-59"},{"uid":"d36d-65"},{"uid":"d36d-69"},{"uid":"d36d-81"}],"isExternal":true},"d36d-95":{"id":"three","moduleParts":{},"imported":[],"importedBy":[{"uid":"d36d-87"},{"uid":"d36d-49"},{"uid":"d36d-51"},{"uid":"d36d-63"},{"uid":"d36d-83"},{"uid":"d36d-59"},{"uid":"d36d-65"},{"uid":"d36d-67"},{"uid":"d36d-55"}],"isExternal":true},"d36d-96":{"id":"@vueuse/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"d36d-49"},{"uid":"d36d-83"}],"isExternal":true},"d36d-97":{"id":"/src/composables/index.ts","moduleParts":{},"imported":[{"uid":"d36d-57"}],"importedBy":[{"uid":"d36d-61"},{"uid":"d36d-83"},{"uid":"d36d-59"}]}},"env":{"rollup":"2.79.1"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
  3508. const run = () => {
  3509. const width = window.innerWidth;
  3510. const height = window.innerHeight;
  3511. const chartNode = document.querySelector("main");
  3512. drawChart.default(chartNode, data, width, height);
  3513. };
  3514. window.addEventListener('resize', run);
  3515. document.addEventListener('DOMContentLoaded', run);
  3516. /*-->*/
  3517. </script>
  3518. </body>
  3519. </html>