mat.js 495 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620
  1. // node_modules/d3-array/src/ascending.js
  2. function ascending(a, b) {
  3. return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
  4. }
  5. // node_modules/d3-array/src/descending.js
  6. function descending(a, b) {
  7. return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
  8. }
  9. // node_modules/d3-array/src/bisector.js
  10. function bisector(f) {
  11. let compare1, compare2, delta;
  12. if (f.length !== 2) {
  13. compare1 = ascending;
  14. compare2 = (d, x) => ascending(f(d), x);
  15. delta = (d, x) => f(d) - x;
  16. } else {
  17. compare1 = f === ascending || f === descending ? f : zero;
  18. compare2 = f;
  19. delta = f;
  20. }
  21. function left(a, x, lo = 0, hi = a.length) {
  22. if (lo < hi) {
  23. if (compare1(x, x) !== 0)
  24. return hi;
  25. do {
  26. const mid = lo + hi >>> 1;
  27. if (compare2(a[mid], x) < 0)
  28. lo = mid + 1;
  29. else
  30. hi = mid;
  31. } while (lo < hi);
  32. }
  33. return lo;
  34. }
  35. function right(a, x, lo = 0, hi = a.length) {
  36. if (lo < hi) {
  37. if (compare1(x, x) !== 0)
  38. return hi;
  39. do {
  40. const mid = lo + hi >>> 1;
  41. if (compare2(a[mid], x) <= 0)
  42. lo = mid + 1;
  43. else
  44. hi = mid;
  45. } while (lo < hi);
  46. }
  47. return lo;
  48. }
  49. function center(a, x, lo = 0, hi = a.length) {
  50. const i = left(a, x, lo, hi - 1);
  51. return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
  52. }
  53. return { left, center, right };
  54. }
  55. function zero() {
  56. return 0;
  57. }
  58. // node_modules/d3-array/src/number.js
  59. function number(x) {
  60. return x === null ? NaN : +x;
  61. }
  62. function* numbers(values, valueof) {
  63. if (valueof === undefined) {
  64. for (let value of values) {
  65. if (value != null && (value = +value) >= value) {
  66. yield value;
  67. }
  68. }
  69. } else {
  70. let index = -1;
  71. for (let value of values) {
  72. if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
  73. yield value;
  74. }
  75. }
  76. }
  77. }
  78. // node_modules/d3-array/src/bisect.js
  79. var ascendingBisect = bisector(ascending);
  80. var bisectRight = ascendingBisect.right;
  81. var bisectLeft = ascendingBisect.left;
  82. var bisectCenter = bisector(number).center;
  83. var bisect_default = bisectRight;
  84. // node_modules/d3-array/src/cross.js
  85. function length(array) {
  86. return array.length | 0;
  87. }
  88. function empty(length2) {
  89. return !(length2 > 0);
  90. }
  91. function arrayify(values) {
  92. return typeof values !== "object" || "length" in values ? values : Array.from(values);
  93. }
  94. function reducer(reduce) {
  95. return (values) => reduce(...values);
  96. }
  97. function cross(...values) {
  98. const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop());
  99. values = values.map(arrayify);
  100. const lengths = values.map(length);
  101. const j = values.length - 1;
  102. const index = new Array(j + 1).fill(0);
  103. const product = [];
  104. if (j < 0 || lengths.some(empty))
  105. return product;
  106. while (true) {
  107. product.push(index.map((j2, i2) => values[i2][j2]));
  108. let i = j;
  109. while (++index[i] === lengths[i]) {
  110. if (i === 0)
  111. return reduce ? product.map(reduce) : product;
  112. index[i--] = 0;
  113. }
  114. }
  115. }
  116. // node_modules/d3-array/src/cumsum.js
  117. function cumsum(values, valueof) {
  118. var sum = 0, index = 0;
  119. return Float64Array.from(values, valueof === undefined ? (v) => sum += +v || 0 : (v) => sum += +valueof(v, index++, values) || 0);
  120. }
  121. // node_modules/d3-array/src/variance.js
  122. function variance(values, valueof) {
  123. let count = 0;
  124. let delta;
  125. let mean = 0;
  126. let sum = 0;
  127. if (valueof === undefined) {
  128. for (let value of values) {
  129. if (value != null && (value = +value) >= value) {
  130. delta = value - mean;
  131. mean += delta / ++count;
  132. sum += delta * (value - mean);
  133. }
  134. }
  135. } else {
  136. let index = -1;
  137. for (let value of values) {
  138. if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
  139. delta = value - mean;
  140. mean += delta / ++count;
  141. sum += delta * (value - mean);
  142. }
  143. }
  144. }
  145. if (count > 1)
  146. return sum / (count - 1);
  147. }
  148. // node_modules/d3-array/src/deviation.js
  149. function deviation(values, valueof) {
  150. const v = variance(values, valueof);
  151. return v ? Math.sqrt(v) : v;
  152. }
  153. // node_modules/d3-array/src/extent.js
  154. function extent(values, valueof) {
  155. let min;
  156. let max;
  157. if (valueof === undefined) {
  158. for (const value of values) {
  159. if (value != null) {
  160. if (min === undefined) {
  161. if (value >= value)
  162. min = max = value;
  163. } else {
  164. if (min > value)
  165. min = value;
  166. if (max < value)
  167. max = value;
  168. }
  169. }
  170. }
  171. } else {
  172. let index = -1;
  173. for (let value of values) {
  174. if ((value = valueof(value, ++index, values)) != null) {
  175. if (min === undefined) {
  176. if (value >= value)
  177. min = max = value;
  178. } else {
  179. if (min > value)
  180. min = value;
  181. if (max < value)
  182. max = value;
  183. }
  184. }
  185. }
  186. }
  187. return [min, max];
  188. }
  189. // node_modules/d3-array/src/fsum.js
  190. class Adder {
  191. constructor() {
  192. this._partials = new Float64Array(32);
  193. this._n = 0;
  194. }
  195. add(x) {
  196. const p = this._partials;
  197. let i = 0;
  198. for (let j = 0;j < this._n && j < 32; j++) {
  199. const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
  200. if (lo)
  201. p[i++] = lo;
  202. x = hi;
  203. }
  204. p[i] = x;
  205. this._n = i + 1;
  206. return this;
  207. }
  208. valueOf() {
  209. const p = this._partials;
  210. let n = this._n, x, y, lo, hi = 0;
  211. if (n > 0) {
  212. hi = p[--n];
  213. while (n > 0) {
  214. x = hi;
  215. y = p[--n];
  216. hi = x + y;
  217. lo = y - (hi - x);
  218. if (lo)
  219. break;
  220. }
  221. if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) {
  222. y = lo * 2;
  223. x = hi + y;
  224. if (y == x - hi)
  225. hi = x;
  226. }
  227. }
  228. return hi;
  229. }
  230. }
  231. // node_modules/internmap/src/index.js
  232. class InternMap extends Map {
  233. constructor(entries, key = keyof) {
  234. super();
  235. Object.defineProperties(this, { _intern: { value: new Map }, _key: { value: key } });
  236. if (entries != null)
  237. for (const [key2, value] of entries)
  238. this.set(key2, value);
  239. }
  240. get(key) {
  241. return super.get(intern_get(this, key));
  242. }
  243. has(key) {
  244. return super.has(intern_get(this, key));
  245. }
  246. set(key, value) {
  247. return super.set(intern_set(this, key), value);
  248. }
  249. delete(key) {
  250. return super.delete(intern_delete(this, key));
  251. }
  252. }
  253. class InternSet extends Set {
  254. constructor(values, key = keyof) {
  255. super();
  256. Object.defineProperties(this, { _intern: { value: new Map }, _key: { value: key } });
  257. if (values != null)
  258. for (const value of values)
  259. this.add(value);
  260. }
  261. has(value) {
  262. return super.has(intern_get(this, value));
  263. }
  264. add(value) {
  265. return super.add(intern_set(this, value));
  266. }
  267. delete(value) {
  268. return super.delete(intern_delete(this, value));
  269. }
  270. }
  271. function intern_get({ _intern, _key }, value) {
  272. const key = _key(value);
  273. return _intern.has(key) ? _intern.get(key) : value;
  274. }
  275. function intern_set({ _intern, _key }, value) {
  276. const key = _key(value);
  277. if (_intern.has(key))
  278. return _intern.get(key);
  279. _intern.set(key, value);
  280. return value;
  281. }
  282. function intern_delete({ _intern, _key }, value) {
  283. const key = _key(value);
  284. if (_intern.has(key)) {
  285. value = _intern.get(key);
  286. _intern.delete(key);
  287. }
  288. return value;
  289. }
  290. function keyof(value) {
  291. return value !== null && typeof value === "object" ? value.valueOf() : value;
  292. }
  293. // node_modules/d3-array/src/identity.js
  294. function identity(x) {
  295. return x;
  296. }
  297. // node_modules/d3-array/src/group.js
  298. function group(values, ...keys) {
  299. return nest(values, identity, identity, keys);
  300. }
  301. function rollup(values, reduce, ...keys) {
  302. return nest(values, identity, reduce, keys);
  303. }
  304. function rollups(values, reduce, ...keys) {
  305. return nest(values, Array.from, reduce, keys);
  306. }
  307. function nest(values, map, reduce, keys) {
  308. return function regroup(values2, i) {
  309. if (i >= keys.length)
  310. return reduce(values2);
  311. const groups = new InternMap;
  312. const keyof2 = keys[i++];
  313. let index = -1;
  314. for (const value of values2) {
  315. const key = keyof2(value, ++index, values2);
  316. const group2 = groups.get(key);
  317. if (group2)
  318. group2.push(value);
  319. else
  320. groups.set(key, [value]);
  321. }
  322. for (const [key, values3] of groups) {
  323. groups.set(key, regroup(values3, i));
  324. }
  325. return map(groups);
  326. }(values, 0);
  327. }
  328. // node_modules/d3-array/src/permute.js
  329. function permute(source, keys) {
  330. return Array.from(keys, (key) => source[key]);
  331. }
  332. // node_modules/d3-array/src/sort.js
  333. function sort(values, ...F) {
  334. if (typeof values[Symbol.iterator] !== "function")
  335. throw new TypeError("values is not iterable");
  336. values = Array.from(values);
  337. let [f] = F;
  338. if (f && f.length !== 2 || F.length > 1) {
  339. const index = Uint32Array.from(values, (d, i) => i);
  340. if (F.length > 1) {
  341. F = F.map((f2) => values.map(f2));
  342. index.sort((i, j) => {
  343. for (const f2 of F) {
  344. const c = ascendingDefined(f2[i], f2[j]);
  345. if (c)
  346. return c;
  347. }
  348. });
  349. } else {
  350. f = values.map(f);
  351. index.sort((i, j) => ascendingDefined(f[i], f[j]));
  352. }
  353. return permute(values, index);
  354. }
  355. return values.sort(compareDefined(f));
  356. }
  357. function compareDefined(compare = ascending) {
  358. if (compare === ascending)
  359. return ascendingDefined;
  360. if (typeof compare !== "function")
  361. throw new TypeError("compare is not a function");
  362. return (a, b) => {
  363. const x = compare(a, b);
  364. if (x || x === 0)
  365. return x;
  366. return (compare(b, b) === 0) - (compare(a, a) === 0);
  367. };
  368. }
  369. function ascendingDefined(a, b) {
  370. return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
  371. }
  372. // node_modules/d3-array/src/groupSort.js
  373. function groupSort(values, reduce, key) {
  374. return (reduce.length !== 2 ? sort(rollup(values, reduce, key), ([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)) : sort(group(values, key), ([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk))).map(([key2]) => key2);
  375. }
  376. // node_modules/d3-array/src/ticks.js
  377. var e10 = Math.sqrt(50);
  378. var e5 = Math.sqrt(10);
  379. var e2 = Math.sqrt(2);
  380. function tickSpec(start, stop, count) {
  381. const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
  382. let i1, i2, inc;
  383. if (power < 0) {
  384. inc = Math.pow(10, -power) / factor;
  385. i1 = Math.round(start * inc);
  386. i2 = Math.round(stop * inc);
  387. if (i1 / inc < start)
  388. ++i1;
  389. if (i2 / inc > stop)
  390. --i2;
  391. inc = -inc;
  392. } else {
  393. inc = Math.pow(10, power) * factor;
  394. i1 = Math.round(start / inc);
  395. i2 = Math.round(stop / inc);
  396. if (i1 * inc < start)
  397. ++i1;
  398. if (i2 * inc > stop)
  399. --i2;
  400. }
  401. if (i2 < i1 && 0.5 <= count && count < 2)
  402. return tickSpec(start, stop, count * 2);
  403. return [i1, i2, inc];
  404. }
  405. function ticks(start, stop, count) {
  406. stop = +stop, start = +start, count = +count;
  407. if (!(count > 0))
  408. return [];
  409. if (start === stop)
  410. return [start];
  411. const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
  412. if (!(i2 >= i1))
  413. return [];
  414. const n = i2 - i1 + 1, ticks2 = new Array(n);
  415. if (reverse) {
  416. if (inc < 0)
  417. for (let i = 0;i < n; ++i)
  418. ticks2[i] = (i2 - i) / -inc;
  419. else
  420. for (let i = 0;i < n; ++i)
  421. ticks2[i] = (i2 - i) * inc;
  422. } else {
  423. if (inc < 0)
  424. for (let i = 0;i < n; ++i)
  425. ticks2[i] = (i1 + i) / -inc;
  426. else
  427. for (let i = 0;i < n; ++i)
  428. ticks2[i] = (i1 + i) * inc;
  429. }
  430. return ticks2;
  431. }
  432. function tickIncrement(start, stop, count) {
  433. stop = +stop, start = +start, count = +count;
  434. return tickSpec(start, stop, count)[2];
  435. }
  436. function tickStep(start, stop, count) {
  437. stop = +stop, start = +start, count = +count;
  438. const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
  439. return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
  440. }
  441. // node_modules/d3-array/src/max.js
  442. function max(values, valueof) {
  443. let max2;
  444. if (valueof === undefined) {
  445. for (const value of values) {
  446. if (value != null && (max2 < value || max2 === undefined && value >= value)) {
  447. max2 = value;
  448. }
  449. }
  450. } else {
  451. let index = -1;
  452. for (let value of values) {
  453. if ((value = valueof(value, ++index, values)) != null && (max2 < value || max2 === undefined && value >= value)) {
  454. max2 = value;
  455. }
  456. }
  457. }
  458. return max2;
  459. }
  460. // node_modules/d3-array/src/maxIndex.js
  461. function maxIndex(values, valueof) {
  462. let max2;
  463. let maxIndex2 = -1;
  464. let index = -1;
  465. if (valueof === undefined) {
  466. for (const value of values) {
  467. ++index;
  468. if (value != null && (max2 < value || max2 === undefined && value >= value)) {
  469. max2 = value, maxIndex2 = index;
  470. }
  471. }
  472. } else {
  473. for (let value of values) {
  474. if ((value = valueof(value, ++index, values)) != null && (max2 < value || max2 === undefined && value >= value)) {
  475. max2 = value, maxIndex2 = index;
  476. }
  477. }
  478. }
  479. return maxIndex2;
  480. }
  481. // node_modules/d3-array/src/min.js
  482. function min(values, valueof) {
  483. let min2;
  484. if (valueof === undefined) {
  485. for (const value of values) {
  486. if (value != null && (min2 > value || min2 === undefined && value >= value)) {
  487. min2 = value;
  488. }
  489. }
  490. } else {
  491. let index = -1;
  492. for (let value of values) {
  493. if ((value = valueof(value, ++index, values)) != null && (min2 > value || min2 === undefined && value >= value)) {
  494. min2 = value;
  495. }
  496. }
  497. }
  498. return min2;
  499. }
  500. // node_modules/d3-array/src/minIndex.js
  501. function minIndex(values, valueof) {
  502. let min2;
  503. let minIndex2 = -1;
  504. let index = -1;
  505. if (valueof === undefined) {
  506. for (const value of values) {
  507. ++index;
  508. if (value != null && (min2 > value || min2 === undefined && value >= value)) {
  509. min2 = value, minIndex2 = index;
  510. }
  511. }
  512. } else {
  513. for (let value of values) {
  514. if ((value = valueof(value, ++index, values)) != null && (min2 > value || min2 === undefined && value >= value)) {
  515. min2 = value, minIndex2 = index;
  516. }
  517. }
  518. }
  519. return minIndex2;
  520. }
  521. // node_modules/d3-array/src/quickselect.js
  522. function quickselect(array, k, left = 0, right = Infinity, compare) {
  523. k = Math.floor(k);
  524. left = Math.floor(Math.max(0, left));
  525. right = Math.floor(Math.min(array.length - 1, right));
  526. if (!(left <= k && k <= right))
  527. return array;
  528. compare = compare === undefined ? ascendingDefined : compareDefined(compare);
  529. while (right > left) {
  530. if (right - left > 600) {
  531. const n = right - left + 1;
  532. const m = k - left + 1;
  533. const z = Math.log(n);
  534. const s = 0.5 * Math.exp(2 * z / 3);
  535. const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
  536. const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
  537. const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
  538. quickselect(array, k, newLeft, newRight, compare);
  539. }
  540. const t = array[k];
  541. let i = left;
  542. let j = right;
  543. swap(array, left, k);
  544. if (compare(array[right], t) > 0)
  545. swap(array, left, right);
  546. while (i < j) {
  547. swap(array, i, j), ++i, --j;
  548. while (compare(array[i], t) < 0)
  549. ++i;
  550. while (compare(array[j], t) > 0)
  551. --j;
  552. }
  553. if (compare(array[left], t) === 0)
  554. swap(array, left, j);
  555. else
  556. ++j, swap(array, j, right);
  557. if (j <= k)
  558. left = j + 1;
  559. if (k <= j)
  560. right = j - 1;
  561. }
  562. return array;
  563. }
  564. function swap(array, i, j) {
  565. const t = array[i];
  566. array[i] = array[j];
  567. array[j] = t;
  568. }
  569. // node_modules/d3-array/src/greatest.js
  570. function greatest(values, compare = ascending) {
  571. let max2;
  572. let defined = false;
  573. if (compare.length === 1) {
  574. let maxValue;
  575. for (const element of values) {
  576. const value = compare(element);
  577. if (defined ? ascending(value, maxValue) > 0 : ascending(value, value) === 0) {
  578. max2 = element;
  579. maxValue = value;
  580. defined = true;
  581. }
  582. }
  583. } else {
  584. for (const value of values) {
  585. if (defined ? compare(value, max2) > 0 : compare(value, value) === 0) {
  586. max2 = value;
  587. defined = true;
  588. }
  589. }
  590. }
  591. return max2;
  592. }
  593. // node_modules/d3-array/src/quantile.js
  594. function quantile(values, p, valueof) {
  595. values = Float64Array.from(numbers(values, valueof));
  596. if (!(n = values.length) || isNaN(p = +p))
  597. return;
  598. if (p <= 0 || n < 2)
  599. return min(values);
  600. if (p >= 1)
  601. return max(values);
  602. var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1));
  603. return value0 + (value1 - value0) * (i - i0);
  604. }
  605. function quantileSorted(values, p, valueof = number) {
  606. if (!(n = values.length) || isNaN(p = +p))
  607. return;
  608. if (p <= 0 || n < 2)
  609. return +valueof(values[0], 0, values);
  610. if (p >= 1)
  611. return +valueof(values[n - 1], n - 1, values);
  612. var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values);
  613. return value0 + (value1 - value0) * (i - i0);
  614. }
  615. // node_modules/d3-array/src/mean.js
  616. function mean(values, valueof) {
  617. let count = 0;
  618. let sum = 0;
  619. if (valueof === undefined) {
  620. for (let value of values) {
  621. if (value != null && (value = +value) >= value) {
  622. ++count, sum += value;
  623. }
  624. }
  625. } else {
  626. let index = -1;
  627. for (let value of values) {
  628. if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
  629. ++count, sum += value;
  630. }
  631. }
  632. }
  633. if (count)
  634. return sum / count;
  635. }
  636. // node_modules/d3-array/src/median.js
  637. function median(values, valueof) {
  638. return quantile(values, 0.5, valueof);
  639. }
  640. // node_modules/d3-array/src/merge.js
  641. function* flatten(arrays) {
  642. for (const array of arrays) {
  643. yield* array;
  644. }
  645. }
  646. function merge(arrays) {
  647. return Array.from(flatten(arrays));
  648. }
  649. // node_modules/d3-array/src/mode.js
  650. function mode(values, valueof) {
  651. const counts = new InternMap;
  652. if (valueof === undefined) {
  653. for (let value of values) {
  654. if (value != null && value >= value) {
  655. counts.set(value, (counts.get(value) || 0) + 1);
  656. }
  657. }
  658. } else {
  659. let index = -1;
  660. for (let value of values) {
  661. if ((value = valueof(value, ++index, values)) != null && value >= value) {
  662. counts.set(value, (counts.get(value) || 0) + 1);
  663. }
  664. }
  665. }
  666. let modeValue;
  667. let modeCount = 0;
  668. for (const [value, count] of counts) {
  669. if (count > modeCount) {
  670. modeCount = count;
  671. modeValue = value;
  672. }
  673. }
  674. return modeValue;
  675. }
  676. // node_modules/d3-array/src/pairs.js
  677. function pairs(values, pairof = pair) {
  678. const pairs2 = [];
  679. let previous;
  680. let first = false;
  681. for (const value of values) {
  682. if (first)
  683. pairs2.push(pairof(previous, value));
  684. previous = value;
  685. first = true;
  686. }
  687. return pairs2;
  688. }
  689. function pair(a, b) {
  690. return [a, b];
  691. }
  692. // node_modules/d3-array/src/range.js
  693. function range(start, stop, step) {
  694. start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
  695. var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n);
  696. while (++i < n) {
  697. range2[i] = start + i * step;
  698. }
  699. return range2;
  700. }
  701. // node_modules/d3-array/src/sum.js
  702. function sum(values, valueof) {
  703. let sum2 = 0;
  704. if (valueof === undefined) {
  705. for (let value of values) {
  706. if (value = +value) {
  707. sum2 += value;
  708. }
  709. }
  710. } else {
  711. let index = -1;
  712. for (let value of values) {
  713. if (value = +valueof(value, ++index, values)) {
  714. sum2 += value;
  715. }
  716. }
  717. }
  718. return sum2;
  719. }
  720. // node_modules/d3-array/src/reverse.js
  721. function reverse(values) {
  722. if (typeof values[Symbol.iterator] !== "function")
  723. throw new TypeError("values is not iterable");
  724. return Array.from(values).reverse();
  725. }
  726. // node_modules/d3-axis/src/identity.js
  727. function identity_default(x) {
  728. return x;
  729. }
  730. // node_modules/d3-axis/src/axis.js
  731. var top = 1;
  732. var right = 2;
  733. var bottom = 3;
  734. var left = 4;
  735. var epsilon = 0.000001;
  736. function translateX(x) {
  737. return "translate(" + x + ",0)";
  738. }
  739. function translateY(y) {
  740. return "translate(0," + y + ")";
  741. }
  742. function number2(scale) {
  743. return (d) => +scale(d);
  744. }
  745. function center(scale, offset) {
  746. offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
  747. if (scale.round())
  748. offset = Math.round(offset);
  749. return (d) => +scale(d) + offset;
  750. }
  751. function entering() {
  752. return !this.__axis;
  753. }
  754. function axis(orient, scale) {
  755. var tickArguments = [], tickValues = null, tickFormat = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k = orient === top || orient === left ? -1 : 1, x = orient === left || orient === right ? "x" : "y", transform = orient === top || orient === bottom ? translateX : translateY;
  756. function axis2(context) {
  757. var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format = tickFormat == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity_default : tickFormat, spacing = Math.max(tickSizeInner, 0) + tickPadding, range2 = scale.range(), range0 = +range2[0] + offset, range1 = +range2[range2.length - 1] + offset, position = (scale.bandwidth ? center : number2)(scale.copy(), offset), selection = context.selection ? context.selection() : context, path = selection.selectAll(".domain").data([null]), tick = selection.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line = tick.select("line"), text = tick.select("text");
  758. path = path.merge(path.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor"));
  759. tick = tick.merge(tickEnter);
  760. line = line.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x + "2", k * tickSizeInner));
  761. text = text.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x, k * spacing).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
  762. if (context !== selection) {
  763. path = path.transition(context);
  764. tick = tick.transition(context);
  765. line = line.transition(context);
  766. text = text.transition(context);
  767. tickExit = tickExit.transition(context).attr("opacity", epsilon).attr("transform", function(d) {
  768. return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform");
  769. });
  770. tickEnter.attr("opacity", epsilon).attr("transform", function(d) {
  771. var p = this.parentNode.__axis;
  772. return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset);
  773. });
  774. }
  775. tickExit.remove();
  776. path.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1);
  777. tick.attr("opacity", 1).attr("transform", function(d) {
  778. return transform(position(d) + offset);
  779. });
  780. line.attr(x + "2", k * tickSizeInner);
  781. text.attr(x, k * spacing).text(format);
  782. selection.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");
  783. selection.each(function() {
  784. this.__axis = position;
  785. });
  786. }
  787. axis2.scale = function(_) {
  788. return arguments.length ? (scale = _, axis2) : scale;
  789. };
  790. axis2.ticks = function() {
  791. return tickArguments = Array.from(arguments), axis2;
  792. };
  793. axis2.tickArguments = function(_) {
  794. return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis2) : tickArguments.slice();
  795. };
  796. axis2.tickValues = function(_) {
  797. return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis2) : tickValues && tickValues.slice();
  798. };
  799. axis2.tickFormat = function(_) {
  800. return arguments.length ? (tickFormat = _, axis2) : tickFormat;
  801. };
  802. axis2.tickSize = function(_) {
  803. return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis2) : tickSizeInner;
  804. };
  805. axis2.tickSizeInner = function(_) {
  806. return arguments.length ? (tickSizeInner = +_, axis2) : tickSizeInner;
  807. };
  808. axis2.tickSizeOuter = function(_) {
  809. return arguments.length ? (tickSizeOuter = +_, axis2) : tickSizeOuter;
  810. };
  811. axis2.tickPadding = function(_) {
  812. return arguments.length ? (tickPadding = +_, axis2) : tickPadding;
  813. };
  814. axis2.offset = function(_) {
  815. return arguments.length ? (offset = +_, axis2) : offset;
  816. };
  817. return axis2;
  818. }
  819. function axisBottom(scale) {
  820. return axis(bottom, scale);
  821. }
  822. // node_modules/d3-dispatch/src/dispatch.js
  823. var noop = { value: () => {} };
  824. function dispatch() {
  825. for (var i = 0, n = arguments.length, _ = {}, t;i < n; ++i) {
  826. if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t))
  827. throw new Error("illegal type: " + t);
  828. _[t] = [];
  829. }
  830. return new Dispatch(_);
  831. }
  832. function Dispatch(_) {
  833. this._ = _;
  834. }
  835. function parseTypenames(typenames, types) {
  836. return typenames.trim().split(/^|\s+/).map(function(t) {
  837. var name = "", i = t.indexOf(".");
  838. if (i >= 0)
  839. name = t.slice(i + 1), t = t.slice(0, i);
  840. if (t && !types.hasOwnProperty(t))
  841. throw new Error("unknown type: " + t);
  842. return { type: t, name };
  843. });
  844. }
  845. Dispatch.prototype = dispatch.prototype = {
  846. constructor: Dispatch,
  847. on: function(typename, callback) {
  848. var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length;
  849. if (arguments.length < 2) {
  850. while (++i < n)
  851. if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name)))
  852. return t;
  853. return;
  854. }
  855. if (callback != null && typeof callback !== "function")
  856. throw new Error("invalid callback: " + callback);
  857. while (++i < n) {
  858. if (t = (typename = T[i]).type)
  859. _[t] = set(_[t], typename.name, callback);
  860. else if (callback == null)
  861. for (t in _)
  862. _[t] = set(_[t], typename.name, null);
  863. }
  864. return this;
  865. },
  866. copy: function() {
  867. var copy = {}, _ = this._;
  868. for (var t in _)
  869. copy[t] = _[t].slice();
  870. return new Dispatch(copy);
  871. },
  872. call: function(type, that) {
  873. if ((n = arguments.length - 2) > 0)
  874. for (var args = new Array(n), i = 0, n, t;i < n; ++i)
  875. args[i] = arguments[i + 2];
  876. if (!this._.hasOwnProperty(type))
  877. throw new Error("unknown type: " + type);
  878. for (t = this._[type], i = 0, n = t.length;i < n; ++i)
  879. t[i].value.apply(that, args);
  880. },
  881. apply: function(type, that, args) {
  882. if (!this._.hasOwnProperty(type))
  883. throw new Error("unknown type: " + type);
  884. for (var t = this._[type], i = 0, n = t.length;i < n; ++i)
  885. t[i].value.apply(that, args);
  886. }
  887. };
  888. function get(type, name) {
  889. for (var i = 0, n = type.length, c;i < n; ++i) {
  890. if ((c = type[i]).name === name) {
  891. return c.value;
  892. }
  893. }
  894. }
  895. function set(type, name, callback) {
  896. for (var i = 0, n = type.length;i < n; ++i) {
  897. if (type[i].name === name) {
  898. type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
  899. break;
  900. }
  901. }
  902. if (callback != null)
  903. type.push({ name, value: callback });
  904. return type;
  905. }
  906. var dispatch_default = dispatch;
  907. // node_modules/d3-selection/src/namespaces.js
  908. var xhtml = "http://www.w3.org/1999/xhtml";
  909. var namespaces_default = {
  910. svg: "http://www.w3.org/2000/svg",
  911. xhtml,
  912. xlink: "http://www.w3.org/1999/xlink",
  913. xml: "http://www.w3.org/XML/1998/namespace",
  914. xmlns: "http://www.w3.org/2000/xmlns/"
  915. };
  916. // node_modules/d3-selection/src/namespace.js
  917. function namespace_default(name) {
  918. var prefix = name += "", i = prefix.indexOf(":");
  919. if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns")
  920. name = name.slice(i + 1);
  921. return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
  922. }
  923. // node_modules/d3-selection/src/creator.js
  924. function creatorInherit(name) {
  925. return function() {
  926. var document2 = this.ownerDocument, uri = this.namespaceURI;
  927. return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
  928. };
  929. }
  930. function creatorFixed(fullname) {
  931. return function() {
  932. return this.ownerDocument.createElementNS(fullname.space, fullname.local);
  933. };
  934. }
  935. function creator_default(name) {
  936. var fullname = namespace_default(name);
  937. return (fullname.local ? creatorFixed : creatorInherit)(fullname);
  938. }
  939. // node_modules/d3-selection/src/selector.js
  940. function none() {}
  941. function selector_default(selector) {
  942. return selector == null ? none : function() {
  943. return this.querySelector(selector);
  944. };
  945. }
  946. // node_modules/d3-selection/src/selection/select.js
  947. function select_default(select) {
  948. if (typeof select !== "function")
  949. select = selector_default(select);
  950. for (var groups2 = this._groups, m = groups2.length, subgroups = new Array(m), j = 0;j < m; ++j) {
  951. for (var group2 = groups2[j], n = group2.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0;i < n; ++i) {
  952. if ((node = group2[i]) && (subnode = select.call(node, node.__data__, i, group2))) {
  953. if ("__data__" in node)
  954. subnode.__data__ = node.__data__;
  955. subgroup[i] = subnode;
  956. }
  957. }
  958. }
  959. return new Selection(subgroups, this._parents);
  960. }
  961. // node_modules/d3-selection/src/array.js
  962. function array(x) {
  963. return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
  964. }
  965. // node_modules/d3-selection/src/selectorAll.js
  966. function empty2() {
  967. return [];
  968. }
  969. function selectorAll_default(selector) {
  970. return selector == null ? empty2 : function() {
  971. return this.querySelectorAll(selector);
  972. };
  973. }
  974. // node_modules/d3-selection/src/selection/selectAll.js
  975. function arrayAll(select) {
  976. return function() {
  977. return array(select.apply(this, arguments));
  978. };
  979. }
  980. function selectAll_default(select) {
  981. if (typeof select === "function")
  982. select = arrayAll(select);
  983. else
  984. select = selectorAll_default(select);
  985. for (var groups2 = this._groups, m = groups2.length, subgroups = [], parents = [], j = 0;j < m; ++j) {
  986. for (var group2 = groups2[j], n = group2.length, node, i = 0;i < n; ++i) {
  987. if (node = group2[i]) {
  988. subgroups.push(select.call(node, node.__data__, i, group2));
  989. parents.push(node);
  990. }
  991. }
  992. }
  993. return new Selection(subgroups, parents);
  994. }
  995. // node_modules/d3-selection/src/matcher.js
  996. function matcher_default(selector) {
  997. return function() {
  998. return this.matches(selector);
  999. };
  1000. }
  1001. function childMatcher(selector) {
  1002. return function(node) {
  1003. return node.matches(selector);
  1004. };
  1005. }
  1006. // node_modules/d3-selection/src/selection/selectChild.js
  1007. var find = Array.prototype.find;
  1008. function childFind(match) {
  1009. return function() {
  1010. return find.call(this.children, match);
  1011. };
  1012. }
  1013. function childFirst() {
  1014. return this.firstElementChild;
  1015. }
  1016. function selectChild_default(match) {
  1017. return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
  1018. }
  1019. // node_modules/d3-selection/src/selection/selectChildren.js
  1020. var filter = Array.prototype.filter;
  1021. function children() {
  1022. return Array.from(this.children);
  1023. }
  1024. function childrenFilter(match) {
  1025. return function() {
  1026. return filter.call(this.children, match);
  1027. };
  1028. }
  1029. function selectChildren_default(match) {
  1030. return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
  1031. }
  1032. // node_modules/d3-selection/src/selection/filter.js
  1033. function filter_default(match) {
  1034. if (typeof match !== "function")
  1035. match = matcher_default(match);
  1036. for (var groups2 = this._groups, m = groups2.length, subgroups = new Array(m), j = 0;j < m; ++j) {
  1037. for (var group2 = groups2[j], n = group2.length, subgroup = subgroups[j] = [], node, i = 0;i < n; ++i) {
  1038. if ((node = group2[i]) && match.call(node, node.__data__, i, group2)) {
  1039. subgroup.push(node);
  1040. }
  1041. }
  1042. }
  1043. return new Selection(subgroups, this._parents);
  1044. }
  1045. // node_modules/d3-selection/src/selection/sparse.js
  1046. function sparse_default(update) {
  1047. return new Array(update.length);
  1048. }
  1049. // node_modules/d3-selection/src/selection/enter.js
  1050. function enter_default() {
  1051. return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
  1052. }
  1053. function EnterNode(parent, datum) {
  1054. this.ownerDocument = parent.ownerDocument;
  1055. this.namespaceURI = parent.namespaceURI;
  1056. this._next = null;
  1057. this._parent = parent;
  1058. this.__data__ = datum;
  1059. }
  1060. EnterNode.prototype = {
  1061. constructor: EnterNode,
  1062. appendChild: function(child) {
  1063. return this._parent.insertBefore(child, this._next);
  1064. },
  1065. insertBefore: function(child, next) {
  1066. return this._parent.insertBefore(child, next);
  1067. },
  1068. querySelector: function(selector) {
  1069. return this._parent.querySelector(selector);
  1070. },
  1071. querySelectorAll: function(selector) {
  1072. return this._parent.querySelectorAll(selector);
  1073. }
  1074. };
  1075. // node_modules/d3-selection/src/constant.js
  1076. function constant_default(x) {
  1077. return function() {
  1078. return x;
  1079. };
  1080. }
  1081. // node_modules/d3-selection/src/selection/data.js
  1082. function bindIndex(parent, group2, enter, update, exit, data) {
  1083. var i = 0, node, groupLength = group2.length, dataLength = data.length;
  1084. for (;i < dataLength; ++i) {
  1085. if (node = group2[i]) {
  1086. node.__data__ = data[i];
  1087. update[i] = node;
  1088. } else {
  1089. enter[i] = new EnterNode(parent, data[i]);
  1090. }
  1091. }
  1092. for (;i < groupLength; ++i) {
  1093. if (node = group2[i]) {
  1094. exit[i] = node;
  1095. }
  1096. }
  1097. }
  1098. function bindKey(parent, group2, enter, update, exit, data, key) {
  1099. var i, node, nodeByKeyValue = new Map, groupLength = group2.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
  1100. for (i = 0;i < groupLength; ++i) {
  1101. if (node = group2[i]) {
  1102. keyValues[i] = keyValue = key.call(node, node.__data__, i, group2) + "";
  1103. if (nodeByKeyValue.has(keyValue)) {
  1104. exit[i] = node;
  1105. } else {
  1106. nodeByKeyValue.set(keyValue, node);
  1107. }
  1108. }
  1109. }
  1110. for (i = 0;i < dataLength; ++i) {
  1111. keyValue = key.call(parent, data[i], i, data) + "";
  1112. if (node = nodeByKeyValue.get(keyValue)) {
  1113. update[i] = node;
  1114. node.__data__ = data[i];
  1115. nodeByKeyValue.delete(keyValue);
  1116. } else {
  1117. enter[i] = new EnterNode(parent, data[i]);
  1118. }
  1119. }
  1120. for (i = 0;i < groupLength; ++i) {
  1121. if ((node = group2[i]) && nodeByKeyValue.get(keyValues[i]) === node) {
  1122. exit[i] = node;
  1123. }
  1124. }
  1125. }
  1126. function datum(node) {
  1127. return node.__data__;
  1128. }
  1129. function data_default(value, key) {
  1130. if (!arguments.length)
  1131. return Array.from(this, datum);
  1132. var bind = key ? bindKey : bindIndex, parents = this._parents, groups2 = this._groups;
  1133. if (typeof value !== "function")
  1134. value = constant_default(value);
  1135. for (var m = groups2.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0;j < m; ++j) {
  1136. var parent = parents[j], group2 = groups2[j], groupLength = group2.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength);
  1137. bind(parent, group2, enterGroup, updateGroup, exitGroup, data, key);
  1138. for (var i0 = 0, i1 = 0, previous, next;i0 < dataLength; ++i0) {
  1139. if (previous = enterGroup[i0]) {
  1140. if (i0 >= i1)
  1141. i1 = i0 + 1;
  1142. while (!(next = updateGroup[i1]) && ++i1 < dataLength)
  1143. ;
  1144. previous._next = next || null;
  1145. }
  1146. }
  1147. }
  1148. update = new Selection(update, parents);
  1149. update._enter = enter;
  1150. update._exit = exit;
  1151. return update;
  1152. }
  1153. function arraylike(data) {
  1154. return typeof data === "object" && "length" in data ? data : Array.from(data);
  1155. }
  1156. // node_modules/d3-selection/src/selection/exit.js
  1157. function exit_default() {
  1158. return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
  1159. }
  1160. // node_modules/d3-selection/src/selection/join.js
  1161. function join_default(onenter, onupdate, onexit) {
  1162. var enter = this.enter(), update = this, exit = this.exit();
  1163. if (typeof onenter === "function") {
  1164. enter = onenter(enter);
  1165. if (enter)
  1166. enter = enter.selection();
  1167. } else {
  1168. enter = enter.append(onenter + "");
  1169. }
  1170. if (onupdate != null) {
  1171. update = onupdate(update);
  1172. if (update)
  1173. update = update.selection();
  1174. }
  1175. if (onexit == null)
  1176. exit.remove();
  1177. else
  1178. onexit(exit);
  1179. return enter && update ? enter.merge(update).order() : update;
  1180. }
  1181. // node_modules/d3-selection/src/selection/merge.js
  1182. function merge_default(context) {
  1183. var selection = context.selection ? context.selection() : context;
  1184. for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0;j < m; ++j) {
  1185. for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge2 = merges[j] = new Array(n), node, i = 0;i < n; ++i) {
  1186. if (node = group0[i] || group1[i]) {
  1187. merge2[i] = node;
  1188. }
  1189. }
  1190. }
  1191. for (;j < m0; ++j) {
  1192. merges[j] = groups0[j];
  1193. }
  1194. return new Selection(merges, this._parents);
  1195. }
  1196. // node_modules/d3-selection/src/selection/order.js
  1197. function order_default() {
  1198. for (var groups2 = this._groups, j = -1, m = groups2.length;++j < m; ) {
  1199. for (var group2 = groups2[j], i = group2.length - 1, next = group2[i], node;--i >= 0; ) {
  1200. if (node = group2[i]) {
  1201. if (next && node.compareDocumentPosition(next) ^ 4)
  1202. next.parentNode.insertBefore(node, next);
  1203. next = node;
  1204. }
  1205. }
  1206. }
  1207. return this;
  1208. }
  1209. // node_modules/d3-selection/src/selection/sort.js
  1210. function sort_default(compare) {
  1211. if (!compare)
  1212. compare = ascending2;
  1213. function compareNode(a, b) {
  1214. return a && b ? compare(a.__data__, b.__data__) : !a - !b;
  1215. }
  1216. for (var groups2 = this._groups, m = groups2.length, sortgroups = new Array(m), j = 0;j < m; ++j) {
  1217. for (var group2 = groups2[j], n = group2.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0;i < n; ++i) {
  1218. if (node = group2[i]) {
  1219. sortgroup[i] = node;
  1220. }
  1221. }
  1222. sortgroup.sort(compareNode);
  1223. }
  1224. return new Selection(sortgroups, this._parents).order();
  1225. }
  1226. function ascending2(a, b) {
  1227. return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
  1228. }
  1229. // node_modules/d3-selection/src/selection/call.js
  1230. function call_default() {
  1231. var callback = arguments[0];
  1232. arguments[0] = this;
  1233. callback.apply(null, arguments);
  1234. return this;
  1235. }
  1236. // node_modules/d3-selection/src/selection/nodes.js
  1237. function nodes_default() {
  1238. return Array.from(this);
  1239. }
  1240. // node_modules/d3-selection/src/selection/node.js
  1241. function node_default() {
  1242. for (var groups2 = this._groups, j = 0, m = groups2.length;j < m; ++j) {
  1243. for (var group2 = groups2[j], i = 0, n = group2.length;i < n; ++i) {
  1244. var node = group2[i];
  1245. if (node)
  1246. return node;
  1247. }
  1248. }
  1249. return null;
  1250. }
  1251. // node_modules/d3-selection/src/selection/size.js
  1252. function size_default() {
  1253. let size = 0;
  1254. for (const node of this)
  1255. ++size;
  1256. return size;
  1257. }
  1258. // node_modules/d3-selection/src/selection/empty.js
  1259. function empty_default() {
  1260. return !this.node();
  1261. }
  1262. // node_modules/d3-selection/src/selection/each.js
  1263. function each_default(callback) {
  1264. for (var groups2 = this._groups, j = 0, m = groups2.length;j < m; ++j) {
  1265. for (var group2 = groups2[j], i = 0, n = group2.length, node;i < n; ++i) {
  1266. if (node = group2[i])
  1267. callback.call(node, node.__data__, i, group2);
  1268. }
  1269. }
  1270. return this;
  1271. }
  1272. // node_modules/d3-selection/src/selection/attr.js
  1273. function attrRemove(name) {
  1274. return function() {
  1275. this.removeAttribute(name);
  1276. };
  1277. }
  1278. function attrRemoveNS(fullname) {
  1279. return function() {
  1280. this.removeAttributeNS(fullname.space, fullname.local);
  1281. };
  1282. }
  1283. function attrConstant(name, value) {
  1284. return function() {
  1285. this.setAttribute(name, value);
  1286. };
  1287. }
  1288. function attrConstantNS(fullname, value) {
  1289. return function() {
  1290. this.setAttributeNS(fullname.space, fullname.local, value);
  1291. };
  1292. }
  1293. function attrFunction(name, value) {
  1294. return function() {
  1295. var v = value.apply(this, arguments);
  1296. if (v == null)
  1297. this.removeAttribute(name);
  1298. else
  1299. this.setAttribute(name, v);
  1300. };
  1301. }
  1302. function attrFunctionNS(fullname, value) {
  1303. return function() {
  1304. var v = value.apply(this, arguments);
  1305. if (v == null)
  1306. this.removeAttributeNS(fullname.space, fullname.local);
  1307. else
  1308. this.setAttributeNS(fullname.space, fullname.local, v);
  1309. };
  1310. }
  1311. function attr_default(name, value) {
  1312. var fullname = namespace_default(name);
  1313. if (arguments.length < 2) {
  1314. var node = this.node();
  1315. return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
  1316. }
  1317. return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
  1318. }
  1319. // node_modules/d3-selection/src/window.js
  1320. function window_default(node) {
  1321. return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
  1322. }
  1323. // node_modules/d3-selection/src/selection/style.js
  1324. function styleRemove(name) {
  1325. return function() {
  1326. this.style.removeProperty(name);
  1327. };
  1328. }
  1329. function styleConstant(name, value, priority) {
  1330. return function() {
  1331. this.style.setProperty(name, value, priority);
  1332. };
  1333. }
  1334. function styleFunction(name, value, priority) {
  1335. return function() {
  1336. var v = value.apply(this, arguments);
  1337. if (v == null)
  1338. this.style.removeProperty(name);
  1339. else
  1340. this.style.setProperty(name, v, priority);
  1341. };
  1342. }
  1343. function style_default(name, value, priority) {
  1344. return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
  1345. }
  1346. function styleValue(node, name) {
  1347. return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
  1348. }
  1349. // node_modules/d3-selection/src/selection/property.js
  1350. function propertyRemove(name) {
  1351. return function() {
  1352. delete this[name];
  1353. };
  1354. }
  1355. function propertyConstant(name, value) {
  1356. return function() {
  1357. this[name] = value;
  1358. };
  1359. }
  1360. function propertyFunction(name, value) {
  1361. return function() {
  1362. var v = value.apply(this, arguments);
  1363. if (v == null)
  1364. delete this[name];
  1365. else
  1366. this[name] = v;
  1367. };
  1368. }
  1369. function property_default(name, value) {
  1370. return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
  1371. }
  1372. // node_modules/d3-selection/src/selection/classed.js
  1373. function classArray(string) {
  1374. return string.trim().split(/^|\s+/);
  1375. }
  1376. function classList(node) {
  1377. return node.classList || new ClassList(node);
  1378. }
  1379. function ClassList(node) {
  1380. this._node = node;
  1381. this._names = classArray(node.getAttribute("class") || "");
  1382. }
  1383. ClassList.prototype = {
  1384. add: function(name) {
  1385. var i = this._names.indexOf(name);
  1386. if (i < 0) {
  1387. this._names.push(name);
  1388. this._node.setAttribute("class", this._names.join(" "));
  1389. }
  1390. },
  1391. remove: function(name) {
  1392. var i = this._names.indexOf(name);
  1393. if (i >= 0) {
  1394. this._names.splice(i, 1);
  1395. this._node.setAttribute("class", this._names.join(" "));
  1396. }
  1397. },
  1398. contains: function(name) {
  1399. return this._names.indexOf(name) >= 0;
  1400. }
  1401. };
  1402. function classedAdd(node, names) {
  1403. var list = classList(node), i = -1, n = names.length;
  1404. while (++i < n)
  1405. list.add(names[i]);
  1406. }
  1407. function classedRemove(node, names) {
  1408. var list = classList(node), i = -1, n = names.length;
  1409. while (++i < n)
  1410. list.remove(names[i]);
  1411. }
  1412. function classedTrue(names) {
  1413. return function() {
  1414. classedAdd(this, names);
  1415. };
  1416. }
  1417. function classedFalse(names) {
  1418. return function() {
  1419. classedRemove(this, names);
  1420. };
  1421. }
  1422. function classedFunction(names, value) {
  1423. return function() {
  1424. (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
  1425. };
  1426. }
  1427. function classed_default(name, value) {
  1428. var names = classArray(name + "");
  1429. if (arguments.length < 2) {
  1430. var list = classList(this.node()), i = -1, n = names.length;
  1431. while (++i < n)
  1432. if (!list.contains(names[i]))
  1433. return false;
  1434. return true;
  1435. }
  1436. return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
  1437. }
  1438. // node_modules/d3-selection/src/selection/text.js
  1439. function textRemove() {
  1440. this.textContent = "";
  1441. }
  1442. function textConstant(value) {
  1443. return function() {
  1444. this.textContent = value;
  1445. };
  1446. }
  1447. function textFunction(value) {
  1448. return function() {
  1449. var v = value.apply(this, arguments);
  1450. this.textContent = v == null ? "" : v;
  1451. };
  1452. }
  1453. function text_default(value) {
  1454. return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
  1455. }
  1456. // node_modules/d3-selection/src/selection/html.js
  1457. function htmlRemove() {
  1458. this.innerHTML = "";
  1459. }
  1460. function htmlConstant(value) {
  1461. return function() {
  1462. this.innerHTML = value;
  1463. };
  1464. }
  1465. function htmlFunction(value) {
  1466. return function() {
  1467. var v = value.apply(this, arguments);
  1468. this.innerHTML = v == null ? "" : v;
  1469. };
  1470. }
  1471. function html_default(value) {
  1472. return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
  1473. }
  1474. // node_modules/d3-selection/src/selection/raise.js
  1475. function raise() {
  1476. if (this.nextSibling)
  1477. this.parentNode.appendChild(this);
  1478. }
  1479. function raise_default() {
  1480. return this.each(raise);
  1481. }
  1482. // node_modules/d3-selection/src/selection/lower.js
  1483. function lower() {
  1484. if (this.previousSibling)
  1485. this.parentNode.insertBefore(this, this.parentNode.firstChild);
  1486. }
  1487. function lower_default() {
  1488. return this.each(lower);
  1489. }
  1490. // node_modules/d3-selection/src/selection/append.js
  1491. function append_default(name) {
  1492. var create = typeof name === "function" ? name : creator_default(name);
  1493. return this.select(function() {
  1494. return this.appendChild(create.apply(this, arguments));
  1495. });
  1496. }
  1497. // node_modules/d3-selection/src/selection/insert.js
  1498. function constantNull() {
  1499. return null;
  1500. }
  1501. function insert_default(name, before) {
  1502. var create = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
  1503. return this.select(function() {
  1504. return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
  1505. });
  1506. }
  1507. // node_modules/d3-selection/src/selection/remove.js
  1508. function remove() {
  1509. var parent = this.parentNode;
  1510. if (parent)
  1511. parent.removeChild(this);
  1512. }
  1513. function remove_default() {
  1514. return this.each(remove);
  1515. }
  1516. // node_modules/d3-selection/src/selection/clone.js
  1517. function selection_cloneShallow() {
  1518. var clone = this.cloneNode(false), parent = this.parentNode;
  1519. return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
  1520. }
  1521. function selection_cloneDeep() {
  1522. var clone = this.cloneNode(true), parent = this.parentNode;
  1523. return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
  1524. }
  1525. function clone_default(deep) {
  1526. return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
  1527. }
  1528. // node_modules/d3-selection/src/selection/datum.js
  1529. function datum_default(value) {
  1530. return arguments.length ? this.property("__data__", value) : this.node().__data__;
  1531. }
  1532. // node_modules/d3-selection/src/selection/on.js
  1533. function contextListener(listener) {
  1534. return function(event) {
  1535. listener.call(this, event, this.__data__);
  1536. };
  1537. }
  1538. function parseTypenames2(typenames) {
  1539. return typenames.trim().split(/^|\s+/).map(function(t) {
  1540. var name = "", i = t.indexOf(".");
  1541. if (i >= 0)
  1542. name = t.slice(i + 1), t = t.slice(0, i);
  1543. return { type: t, name };
  1544. });
  1545. }
  1546. function onRemove(typename) {
  1547. return function() {
  1548. var on = this.__on;
  1549. if (!on)
  1550. return;
  1551. for (var j = 0, i = -1, m = on.length, o;j < m; ++j) {
  1552. if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
  1553. this.removeEventListener(o.type, o.listener, o.options);
  1554. } else {
  1555. on[++i] = o;
  1556. }
  1557. }
  1558. if (++i)
  1559. on.length = i;
  1560. else
  1561. delete this.__on;
  1562. };
  1563. }
  1564. function onAdd(typename, value, options) {
  1565. return function() {
  1566. var on = this.__on, o, listener = contextListener(value);
  1567. if (on)
  1568. for (var j = 0, m = on.length;j < m; ++j) {
  1569. if ((o = on[j]).type === typename.type && o.name === typename.name) {
  1570. this.removeEventListener(o.type, o.listener, o.options);
  1571. this.addEventListener(o.type, o.listener = listener, o.options = options);
  1572. o.value = value;
  1573. return;
  1574. }
  1575. }
  1576. this.addEventListener(typename.type, listener, options);
  1577. o = { type: typename.type, name: typename.name, value, listener, options };
  1578. if (!on)
  1579. this.__on = [o];
  1580. else
  1581. on.push(o);
  1582. };
  1583. }
  1584. function on_default(typename, value, options) {
  1585. var typenames = parseTypenames2(typename + ""), i, n = typenames.length, t;
  1586. if (arguments.length < 2) {
  1587. var on = this.node().__on;
  1588. if (on)
  1589. for (var j = 0, m = on.length, o;j < m; ++j) {
  1590. for (i = 0, o = on[j];i < n; ++i) {
  1591. if ((t = typenames[i]).type === o.type && t.name === o.name) {
  1592. return o.value;
  1593. }
  1594. }
  1595. }
  1596. return;
  1597. }
  1598. on = value ? onAdd : onRemove;
  1599. for (i = 0;i < n; ++i)
  1600. this.each(on(typenames[i], value, options));
  1601. return this;
  1602. }
  1603. // node_modules/d3-selection/src/selection/dispatch.js
  1604. function dispatchEvent(node, type, params) {
  1605. var window2 = window_default(node), event = window2.CustomEvent;
  1606. if (typeof event === "function") {
  1607. event = new event(type, params);
  1608. } else {
  1609. event = window2.document.createEvent("Event");
  1610. if (params)
  1611. event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
  1612. else
  1613. event.initEvent(type, false, false);
  1614. }
  1615. node.dispatchEvent(event);
  1616. }
  1617. function dispatchConstant(type, params) {
  1618. return function() {
  1619. return dispatchEvent(this, type, params);
  1620. };
  1621. }
  1622. function dispatchFunction(type, params) {
  1623. return function() {
  1624. return dispatchEvent(this, type, params.apply(this, arguments));
  1625. };
  1626. }
  1627. function dispatch_default2(type, params) {
  1628. return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type, params));
  1629. }
  1630. // node_modules/d3-selection/src/selection/iterator.js
  1631. function* iterator_default() {
  1632. for (var groups2 = this._groups, j = 0, m = groups2.length;j < m; ++j) {
  1633. for (var group2 = groups2[j], i = 0, n = group2.length, node;i < n; ++i) {
  1634. if (node = group2[i])
  1635. yield node;
  1636. }
  1637. }
  1638. }
  1639. // node_modules/d3-selection/src/selection/index.js
  1640. var root = [null];
  1641. function Selection(groups2, parents) {
  1642. this._groups = groups2;
  1643. this._parents = parents;
  1644. }
  1645. function selection() {
  1646. return new Selection([[document.documentElement]], root);
  1647. }
  1648. function selection_selection() {
  1649. return this;
  1650. }
  1651. Selection.prototype = selection.prototype = {
  1652. constructor: Selection,
  1653. select: select_default,
  1654. selectAll: selectAll_default,
  1655. selectChild: selectChild_default,
  1656. selectChildren: selectChildren_default,
  1657. filter: filter_default,
  1658. data: data_default,
  1659. enter: enter_default,
  1660. exit: exit_default,
  1661. join: join_default,
  1662. merge: merge_default,
  1663. selection: selection_selection,
  1664. order: order_default,
  1665. sort: sort_default,
  1666. call: call_default,
  1667. nodes: nodes_default,
  1668. node: node_default,
  1669. size: size_default,
  1670. empty: empty_default,
  1671. each: each_default,
  1672. attr: attr_default,
  1673. style: style_default,
  1674. property: property_default,
  1675. classed: classed_default,
  1676. text: text_default,
  1677. html: html_default,
  1678. raise: raise_default,
  1679. lower: lower_default,
  1680. append: append_default,
  1681. insert: insert_default,
  1682. remove: remove_default,
  1683. clone: clone_default,
  1684. datum: datum_default,
  1685. on: on_default,
  1686. dispatch: dispatch_default2,
  1687. [Symbol.iterator]: iterator_default
  1688. };
  1689. var selection_default = selection;
  1690. // node_modules/d3-selection/src/select.js
  1691. function select_default2(selector) {
  1692. return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
  1693. }
  1694. // node_modules/d3-selection/src/sourceEvent.js
  1695. function sourceEvent_default(event) {
  1696. let sourceEvent;
  1697. while (sourceEvent = event.sourceEvent)
  1698. event = sourceEvent;
  1699. return event;
  1700. }
  1701. // node_modules/d3-selection/src/pointer.js
  1702. function pointer_default(event, node) {
  1703. event = sourceEvent_default(event);
  1704. if (node === undefined)
  1705. node = event.currentTarget;
  1706. if (node) {
  1707. var svg = node.ownerSVGElement || node;
  1708. if (svg.createSVGPoint) {
  1709. var point = svg.createSVGPoint();
  1710. point.x = event.clientX, point.y = event.clientY;
  1711. point = point.matrixTransform(node.getScreenCTM().inverse());
  1712. return [point.x, point.y];
  1713. }
  1714. if (node.getBoundingClientRect) {
  1715. var rect = node.getBoundingClientRect();
  1716. return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
  1717. }
  1718. }
  1719. return [event.pageX, event.pageY];
  1720. }
  1721. // node_modules/d3-color/src/define.js
  1722. function define_default(constructor, factory, prototype) {
  1723. constructor.prototype = factory.prototype = prototype;
  1724. prototype.constructor = constructor;
  1725. }
  1726. function extend(parent, definition) {
  1727. var prototype = Object.create(parent.prototype);
  1728. for (var key in definition)
  1729. prototype[key] = definition[key];
  1730. return prototype;
  1731. }
  1732. // node_modules/d3-color/src/color.js
  1733. function Color() {}
  1734. var darker = 0.7;
  1735. var brighter = 1 / darker;
  1736. var reI = "\\s*([+-]?\\d+)\\s*";
  1737. var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
  1738. var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
  1739. var reHex = /^#([0-9a-f]{3,8})$/;
  1740. var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
  1741. var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
  1742. var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
  1743. var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
  1744. var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
  1745. var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
  1746. var named = {
  1747. aliceblue: 15792383,
  1748. antiquewhite: 16444375,
  1749. aqua: 65535,
  1750. aquamarine: 8388564,
  1751. azure: 15794175,
  1752. beige: 16119260,
  1753. bisque: 16770244,
  1754. black: 0,
  1755. blanchedalmond: 16772045,
  1756. blue: 255,
  1757. blueviolet: 9055202,
  1758. brown: 10824234,
  1759. burlywood: 14596231,
  1760. cadetblue: 6266528,
  1761. chartreuse: 8388352,
  1762. chocolate: 13789470,
  1763. coral: 16744272,
  1764. cornflowerblue: 6591981,
  1765. cornsilk: 16775388,
  1766. crimson: 14423100,
  1767. cyan: 65535,
  1768. darkblue: 139,
  1769. darkcyan: 35723,
  1770. darkgoldenrod: 12092939,
  1771. darkgray: 11119017,
  1772. darkgreen: 25600,
  1773. darkgrey: 11119017,
  1774. darkkhaki: 12433259,
  1775. darkmagenta: 9109643,
  1776. darkolivegreen: 5597999,
  1777. darkorange: 16747520,
  1778. darkorchid: 10040012,
  1779. darkred: 9109504,
  1780. darksalmon: 15308410,
  1781. darkseagreen: 9419919,
  1782. darkslateblue: 4734347,
  1783. darkslategray: 3100495,
  1784. darkslategrey: 3100495,
  1785. darkturquoise: 52945,
  1786. darkviolet: 9699539,
  1787. deeppink: 16716947,
  1788. deepskyblue: 49151,
  1789. dimgray: 6908265,
  1790. dimgrey: 6908265,
  1791. dodgerblue: 2003199,
  1792. firebrick: 11674146,
  1793. floralwhite: 16775920,
  1794. forestgreen: 2263842,
  1795. fuchsia: 16711935,
  1796. gainsboro: 14474460,
  1797. ghostwhite: 16316671,
  1798. gold: 16766720,
  1799. goldenrod: 14329120,
  1800. gray: 8421504,
  1801. green: 32768,
  1802. greenyellow: 11403055,
  1803. grey: 8421504,
  1804. honeydew: 15794160,
  1805. hotpink: 16738740,
  1806. indianred: 13458524,
  1807. indigo: 4915330,
  1808. ivory: 16777200,
  1809. khaki: 15787660,
  1810. lavender: 15132410,
  1811. lavenderblush: 16773365,
  1812. lawngreen: 8190976,
  1813. lemonchiffon: 16775885,
  1814. lightblue: 11393254,
  1815. lightcoral: 15761536,
  1816. lightcyan: 14745599,
  1817. lightgoldenrodyellow: 16448210,
  1818. lightgray: 13882323,
  1819. lightgreen: 9498256,
  1820. lightgrey: 13882323,
  1821. lightpink: 16758465,
  1822. lightsalmon: 16752762,
  1823. lightseagreen: 2142890,
  1824. lightskyblue: 8900346,
  1825. lightslategray: 7833753,
  1826. lightslategrey: 7833753,
  1827. lightsteelblue: 11584734,
  1828. lightyellow: 16777184,
  1829. lime: 65280,
  1830. limegreen: 3329330,
  1831. linen: 16445670,
  1832. magenta: 16711935,
  1833. maroon: 8388608,
  1834. mediumaquamarine: 6737322,
  1835. mediumblue: 205,
  1836. mediumorchid: 12211667,
  1837. mediumpurple: 9662683,
  1838. mediumseagreen: 3978097,
  1839. mediumslateblue: 8087790,
  1840. mediumspringgreen: 64154,
  1841. mediumturquoise: 4772300,
  1842. mediumvioletred: 13047173,
  1843. midnightblue: 1644912,
  1844. mintcream: 16121850,
  1845. mistyrose: 16770273,
  1846. moccasin: 16770229,
  1847. navajowhite: 16768685,
  1848. navy: 128,
  1849. oldlace: 16643558,
  1850. olive: 8421376,
  1851. olivedrab: 7048739,
  1852. orange: 16753920,
  1853. orangered: 16729344,
  1854. orchid: 14315734,
  1855. palegoldenrod: 15657130,
  1856. palegreen: 10025880,
  1857. paleturquoise: 11529966,
  1858. palevioletred: 14381203,
  1859. papayawhip: 16773077,
  1860. peachpuff: 16767673,
  1861. peru: 13468991,
  1862. pink: 16761035,
  1863. plum: 14524637,
  1864. powderblue: 11591910,
  1865. purple: 8388736,
  1866. rebeccapurple: 6697881,
  1867. red: 16711680,
  1868. rosybrown: 12357519,
  1869. royalblue: 4286945,
  1870. saddlebrown: 9127187,
  1871. salmon: 16416882,
  1872. sandybrown: 16032864,
  1873. seagreen: 3050327,
  1874. seashell: 16774638,
  1875. sienna: 10506797,
  1876. silver: 12632256,
  1877. skyblue: 8900331,
  1878. slateblue: 6970061,
  1879. slategray: 7372944,
  1880. slategrey: 7372944,
  1881. snow: 16775930,
  1882. springgreen: 65407,
  1883. steelblue: 4620980,
  1884. tan: 13808780,
  1885. teal: 32896,
  1886. thistle: 14204888,
  1887. tomato: 16737095,
  1888. turquoise: 4251856,
  1889. violet: 15631086,
  1890. wheat: 16113331,
  1891. white: 16777215,
  1892. whitesmoke: 16119285,
  1893. yellow: 16776960,
  1894. yellowgreen: 10145074
  1895. };
  1896. define_default(Color, color, {
  1897. copy(channels) {
  1898. return Object.assign(new this.constructor, this, channels);
  1899. },
  1900. displayable() {
  1901. return this.rgb().displayable();
  1902. },
  1903. hex: color_formatHex,
  1904. formatHex: color_formatHex,
  1905. formatHex8: color_formatHex8,
  1906. formatHsl: color_formatHsl,
  1907. formatRgb: color_formatRgb,
  1908. toString: color_formatRgb
  1909. });
  1910. function color_formatHex() {
  1911. return this.rgb().formatHex();
  1912. }
  1913. function color_formatHex8() {
  1914. return this.rgb().formatHex8();
  1915. }
  1916. function color_formatHsl() {
  1917. return hslConvert(this).formatHsl();
  1918. }
  1919. function color_formatRgb() {
  1920. return this.rgb().formatRgb();
  1921. }
  1922. function color(format) {
  1923. var m, l;
  1924. format = (format + "").trim().toLowerCase();
  1925. return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
  1926. }
  1927. function rgbn(n) {
  1928. return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
  1929. }
  1930. function rgba(r, g, b, a) {
  1931. if (a <= 0)
  1932. r = g = b = NaN;
  1933. return new Rgb(r, g, b, a);
  1934. }
  1935. function rgbConvert(o) {
  1936. if (!(o instanceof Color))
  1937. o = color(o);
  1938. if (!o)
  1939. return new Rgb;
  1940. o = o.rgb();
  1941. return new Rgb(o.r, o.g, o.b, o.opacity);
  1942. }
  1943. function rgb(r, g, b, opacity) {
  1944. return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
  1945. }
  1946. function Rgb(r, g, b, opacity) {
  1947. this.r = +r;
  1948. this.g = +g;
  1949. this.b = +b;
  1950. this.opacity = +opacity;
  1951. }
  1952. define_default(Rgb, rgb, extend(Color, {
  1953. brighter(k) {
  1954. k = k == null ? brighter : Math.pow(brighter, k);
  1955. return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  1956. },
  1957. darker(k) {
  1958. k = k == null ? darker : Math.pow(darker, k);
  1959. return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  1960. },
  1961. rgb() {
  1962. return this;
  1963. },
  1964. clamp() {
  1965. return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
  1966. },
  1967. displayable() {
  1968. return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
  1969. },
  1970. hex: rgb_formatHex,
  1971. formatHex: rgb_formatHex,
  1972. formatHex8: rgb_formatHex8,
  1973. formatRgb: rgb_formatRgb,
  1974. toString: rgb_formatRgb
  1975. }));
  1976. function rgb_formatHex() {
  1977. return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
  1978. }
  1979. function rgb_formatHex8() {
  1980. return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
  1981. }
  1982. function rgb_formatRgb() {
  1983. const a = clampa(this.opacity);
  1984. return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
  1985. }
  1986. function clampa(opacity) {
  1987. return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
  1988. }
  1989. function clampi(value) {
  1990. return Math.max(0, Math.min(255, Math.round(value) || 0));
  1991. }
  1992. function hex(value) {
  1993. value = clampi(value);
  1994. return (value < 16 ? "0" : "") + value.toString(16);
  1995. }
  1996. function hsla(h, s, l, a) {
  1997. if (a <= 0)
  1998. h = s = l = NaN;
  1999. else if (l <= 0 || l >= 1)
  2000. h = s = NaN;
  2001. else if (s <= 0)
  2002. h = NaN;
  2003. return new Hsl(h, s, l, a);
  2004. }
  2005. function hslConvert(o) {
  2006. if (o instanceof Hsl)
  2007. return new Hsl(o.h, o.s, o.l, o.opacity);
  2008. if (!(o instanceof Color))
  2009. o = color(o);
  2010. if (!o)
  2011. return new Hsl;
  2012. if (o instanceof Hsl)
  2013. return o;
  2014. o = o.rgb();
  2015. var r = o.r / 255, g = o.g / 255, b = o.b / 255, min2 = Math.min(r, g, b), max2 = Math.max(r, g, b), h = NaN, s = max2 - min2, l = (max2 + min2) / 2;
  2016. if (s) {
  2017. if (r === max2)
  2018. h = (g - b) / s + (g < b) * 6;
  2019. else if (g === max2)
  2020. h = (b - r) / s + 2;
  2021. else
  2022. h = (r - g) / s + 4;
  2023. s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2;
  2024. h *= 60;
  2025. } else {
  2026. s = l > 0 && l < 1 ? 0 : h;
  2027. }
  2028. return new Hsl(h, s, l, o.opacity);
  2029. }
  2030. function hsl(h, s, l, opacity) {
  2031. return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
  2032. }
  2033. function Hsl(h, s, l, opacity) {
  2034. this.h = +h;
  2035. this.s = +s;
  2036. this.l = +l;
  2037. this.opacity = +opacity;
  2038. }
  2039. define_default(Hsl, hsl, extend(Color, {
  2040. brighter(k) {
  2041. k = k == null ? brighter : Math.pow(brighter, k);
  2042. return new Hsl(this.h, this.s, this.l * k, this.opacity);
  2043. },
  2044. darker(k) {
  2045. k = k == null ? darker : Math.pow(darker, k);
  2046. return new Hsl(this.h, this.s, this.l * k, this.opacity);
  2047. },
  2048. rgb() {
  2049. var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
  2050. return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
  2051. },
  2052. clamp() {
  2053. return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
  2054. },
  2055. displayable() {
  2056. return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
  2057. },
  2058. formatHsl() {
  2059. const a = clampa(this.opacity);
  2060. return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
  2061. }
  2062. }));
  2063. function clamph(value) {
  2064. value = (value || 0) % 360;
  2065. return value < 0 ? value + 360 : value;
  2066. }
  2067. function clampt(value) {
  2068. return Math.max(0, Math.min(1, value || 0));
  2069. }
  2070. function hsl2rgb(h, m1, m2) {
  2071. return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
  2072. }
  2073. // node_modules/d3-color/src/math.js
  2074. var radians = Math.PI / 180;
  2075. var degrees = 180 / Math.PI;
  2076. // node_modules/d3-color/src/lab.js
  2077. var K = 18;
  2078. var Xn = 0.96422;
  2079. var Yn = 1;
  2080. var Zn = 0.82521;
  2081. var t0 = 4 / 29;
  2082. var t1 = 6 / 29;
  2083. var t2 = 3 * t1 * t1;
  2084. var t3 = t1 * t1 * t1;
  2085. function labConvert(o) {
  2086. if (o instanceof Lab)
  2087. return new Lab(o.l, o.a, o.b, o.opacity);
  2088. if (o instanceof Hcl)
  2089. return hcl2lab(o);
  2090. if (!(o instanceof Rgb))
  2091. o = rgbConvert(o);
  2092. var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
  2093. if (r === g && g === b)
  2094. x = z = y;
  2095. else {
  2096. x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
  2097. z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
  2098. }
  2099. return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
  2100. }
  2101. function lab(l, a, b, opacity) {
  2102. return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
  2103. }
  2104. function Lab(l, a, b, opacity) {
  2105. this.l = +l;
  2106. this.a = +a;
  2107. this.b = +b;
  2108. this.opacity = +opacity;
  2109. }
  2110. define_default(Lab, lab, extend(Color, {
  2111. brighter(k) {
  2112. return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  2113. },
  2114. darker(k) {
  2115. return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  2116. },
  2117. rgb() {
  2118. var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200;
  2119. x = Xn * lab2xyz(x);
  2120. y = Yn * lab2xyz(y);
  2121. z = Zn * lab2xyz(z);
  2122. return new Rgb(lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.033454 * z), lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity);
  2123. }
  2124. }));
  2125. function xyz2lab(t) {
  2126. return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
  2127. }
  2128. function lab2xyz(t) {
  2129. return t > t1 ? t * t * t : t2 * (t - t0);
  2130. }
  2131. function lrgb2rgb(x) {
  2132. return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
  2133. }
  2134. function rgb2lrgb(x) {
  2135. return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
  2136. }
  2137. function hclConvert(o) {
  2138. if (o instanceof Hcl)
  2139. return new Hcl(o.h, o.c, o.l, o.opacity);
  2140. if (!(o instanceof Lab))
  2141. o = labConvert(o);
  2142. if (o.a === 0 && o.b === 0)
  2143. return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
  2144. var h = Math.atan2(o.b, o.a) * degrees;
  2145. return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
  2146. }
  2147. function hcl(h, c, l, opacity) {
  2148. return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
  2149. }
  2150. function Hcl(h, c, l, opacity) {
  2151. this.h = +h;
  2152. this.c = +c;
  2153. this.l = +l;
  2154. this.opacity = +opacity;
  2155. }
  2156. function hcl2lab(o) {
  2157. if (isNaN(o.h))
  2158. return new Lab(o.l, 0, 0, o.opacity);
  2159. var h = o.h * radians;
  2160. return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
  2161. }
  2162. define_default(Hcl, hcl, extend(Color, {
  2163. brighter(k) {
  2164. return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
  2165. },
  2166. darker(k) {
  2167. return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
  2168. },
  2169. rgb() {
  2170. return hcl2lab(this).rgb();
  2171. }
  2172. }));
  2173. // node_modules/d3-color/src/cubehelix.js
  2174. var A = -0.14861;
  2175. var B = 1.78277;
  2176. var C = -0.29227;
  2177. var D = -0.90649;
  2178. var E = 1.97294;
  2179. var ED = E * D;
  2180. var EB = E * B;
  2181. var BC_DA = B * C - D * A;
  2182. function cubehelixConvert(o) {
  2183. if (o instanceof Cubehelix)
  2184. return new Cubehelix(o.h, o.s, o.l, o.opacity);
  2185. if (!(o instanceof Rgb))
  2186. o = rgbConvert(o);
  2187. var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;
  2188. return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
  2189. }
  2190. function cubehelix(h, s, l, opacity) {
  2191. return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
  2192. }
  2193. function Cubehelix(h, s, l, opacity) {
  2194. this.h = +h;
  2195. this.s = +s;
  2196. this.l = +l;
  2197. this.opacity = +opacity;
  2198. }
  2199. define_default(Cubehelix, cubehelix, extend(Color, {
  2200. brighter(k) {
  2201. k = k == null ? brighter : Math.pow(brighter, k);
  2202. return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  2203. },
  2204. darker(k) {
  2205. k = k == null ? darker : Math.pow(darker, k);
  2206. return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  2207. },
  2208. rgb() {
  2209. var h = isNaN(this.h) ? 0 : (this.h + 120) * radians, l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h);
  2210. return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
  2211. }
  2212. }));
  2213. // node_modules/d3-interpolate/src/basis.js
  2214. function basis(t12, v0, v1, v2, v3) {
  2215. var t22 = t12 * t12, t32 = t22 * t12;
  2216. return ((1 - 3 * t12 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t12 + 3 * t22 - 3 * t32) * v2 + t32 * v3) / 6;
  2217. }
  2218. function basis_default(values) {
  2219. var n = values.length - 1;
  2220. return function(t) {
  2221. var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
  2222. return basis((t - i / n) * n, v0, v1, v2, v3);
  2223. };
  2224. }
  2225. // node_modules/d3-interpolate/src/basisClosed.js
  2226. function basisClosed_default(values) {
  2227. var n = values.length;
  2228. return function(t) {
  2229. var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n];
  2230. return basis((t - i / n) * n, v0, v1, v2, v3);
  2231. };
  2232. }
  2233. // node_modules/d3-interpolate/src/constant.js
  2234. var constant_default2 = (x) => () => x;
  2235. // node_modules/d3-interpolate/src/color.js
  2236. function linear(a, d) {
  2237. return function(t) {
  2238. return a + t * d;
  2239. };
  2240. }
  2241. function exponential(a, b, y) {
  2242. return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
  2243. return Math.pow(a + t * b, y);
  2244. };
  2245. }
  2246. function hue(a, b) {
  2247. var d = b - a;
  2248. return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant_default2(isNaN(a) ? b : a);
  2249. }
  2250. function gamma(y) {
  2251. return (y = +y) === 1 ? nogamma : function(a, b) {
  2252. return b - a ? exponential(a, b, y) : constant_default2(isNaN(a) ? b : a);
  2253. };
  2254. }
  2255. function nogamma(a, b) {
  2256. var d = b - a;
  2257. return d ? linear(a, d) : constant_default2(isNaN(a) ? b : a);
  2258. }
  2259. // node_modules/d3-interpolate/src/rgb.js
  2260. var rgb_default = function rgbGamma(y) {
  2261. var color2 = gamma(y);
  2262. function rgb2(start, end) {
  2263. var r = color2((start = rgb(start)).r, (end = rgb(end)).r), g = color2(start.g, end.g), b = color2(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
  2264. return function(t) {
  2265. start.r = r(t);
  2266. start.g = g(t);
  2267. start.b = b(t);
  2268. start.opacity = opacity(t);
  2269. return start + "";
  2270. };
  2271. }
  2272. rgb2.gamma = rgbGamma;
  2273. return rgb2;
  2274. }(1);
  2275. function rgbSpline(spline) {
  2276. return function(colors) {
  2277. var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color2;
  2278. for (i = 0;i < n; ++i) {
  2279. color2 = rgb(colors[i]);
  2280. r[i] = color2.r || 0;
  2281. g[i] = color2.g || 0;
  2282. b[i] = color2.b || 0;
  2283. }
  2284. r = spline(r);
  2285. g = spline(g);
  2286. b = spline(b);
  2287. color2.opacity = 1;
  2288. return function(t) {
  2289. color2.r = r(t);
  2290. color2.g = g(t);
  2291. color2.b = b(t);
  2292. return color2 + "";
  2293. };
  2294. };
  2295. }
  2296. var rgbBasis = rgbSpline(basis_default);
  2297. var rgbBasisClosed = rgbSpline(basisClosed_default);
  2298. // node_modules/d3-interpolate/src/numberArray.js
  2299. function numberArray_default(a, b) {
  2300. if (!b)
  2301. b = [];
  2302. var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i;
  2303. return function(t) {
  2304. for (i = 0;i < n; ++i)
  2305. c[i] = a[i] * (1 - t) + b[i] * t;
  2306. return c;
  2307. };
  2308. }
  2309. function isNumberArray(x) {
  2310. return ArrayBuffer.isView(x) && !(x instanceof DataView);
  2311. }
  2312. // node_modules/d3-interpolate/src/array.js
  2313. function genericArray(a, b) {
  2314. var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i;
  2315. for (i = 0;i < na; ++i)
  2316. x[i] = value_default(a[i], b[i]);
  2317. for (;i < nb; ++i)
  2318. c[i] = b[i];
  2319. return function(t) {
  2320. for (i = 0;i < na; ++i)
  2321. c[i] = x[i](t);
  2322. return c;
  2323. };
  2324. }
  2325. // node_modules/d3-interpolate/src/date.js
  2326. function date_default(a, b) {
  2327. var d = new Date;
  2328. return a = +a, b = +b, function(t) {
  2329. return d.setTime(a * (1 - t) + b * t), d;
  2330. };
  2331. }
  2332. // node_modules/d3-interpolate/src/number.js
  2333. function number_default(a, b) {
  2334. return a = +a, b = +b, function(t) {
  2335. return a * (1 - t) + b * t;
  2336. };
  2337. }
  2338. // node_modules/d3-interpolate/src/object.js
  2339. function object_default(a, b) {
  2340. var i = {}, c = {}, k;
  2341. if (a === null || typeof a !== "object")
  2342. a = {};
  2343. if (b === null || typeof b !== "object")
  2344. b = {};
  2345. for (k in b) {
  2346. if (k in a) {
  2347. i[k] = value_default(a[k], b[k]);
  2348. } else {
  2349. c[k] = b[k];
  2350. }
  2351. }
  2352. return function(t) {
  2353. for (k in i)
  2354. c[k] = i[k](t);
  2355. return c;
  2356. };
  2357. }
  2358. // node_modules/d3-interpolate/src/string.js
  2359. var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
  2360. var reB = new RegExp(reA.source, "g");
  2361. function zero2(b) {
  2362. return function() {
  2363. return b;
  2364. };
  2365. }
  2366. function one(b) {
  2367. return function(t) {
  2368. return b(t) + "";
  2369. };
  2370. }
  2371. function string_default(a, b) {
  2372. var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];
  2373. a = a + "", b = b + "";
  2374. while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
  2375. if ((bs = bm.index) > bi) {
  2376. bs = b.slice(bi, bs);
  2377. if (s[i])
  2378. s[i] += bs;
  2379. else
  2380. s[++i] = bs;
  2381. }
  2382. if ((am = am[0]) === (bm = bm[0])) {
  2383. if (s[i])
  2384. s[i] += bm;
  2385. else
  2386. s[++i] = bm;
  2387. } else {
  2388. s[++i] = null;
  2389. q.push({ i, x: number_default(am, bm) });
  2390. }
  2391. bi = reB.lastIndex;
  2392. }
  2393. if (bi < b.length) {
  2394. bs = b.slice(bi);
  2395. if (s[i])
  2396. s[i] += bs;
  2397. else
  2398. s[++i] = bs;
  2399. }
  2400. return s.length < 2 ? q[0] ? one(q[0].x) : zero2(b) : (b = q.length, function(t) {
  2401. for (var i2 = 0, o;i2 < b; ++i2)
  2402. s[(o = q[i2]).i] = o.x(t);
  2403. return s.join("");
  2404. });
  2405. }
  2406. // node_modules/d3-interpolate/src/value.js
  2407. function value_default(a, b) {
  2408. var t = typeof b, c;
  2409. return b == null || t === "boolean" ? constant_default2(b) : (t === "number" ? number_default : t === "string" ? (c = color(b)) ? (b = c, rgb_default) : string_default : b instanceof color ? rgb_default : b instanceof Date ? date_default : isNumberArray(b) ? numberArray_default : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object_default : number_default)(a, b);
  2410. }
  2411. // node_modules/d3-interpolate/src/round.js
  2412. function round_default(a, b) {
  2413. return a = +a, b = +b, function(t) {
  2414. return Math.round(a * (1 - t) + b * t);
  2415. };
  2416. }
  2417. // node_modules/d3-interpolate/src/transform/decompose.js
  2418. var degrees2 = 180 / Math.PI;
  2419. var identity2 = {
  2420. translateX: 0,
  2421. translateY: 0,
  2422. rotate: 0,
  2423. skewX: 0,
  2424. scaleX: 1,
  2425. scaleY: 1
  2426. };
  2427. function decompose_default(a, b, c, d, e, f) {
  2428. var scaleX, scaleY, skewX;
  2429. if (scaleX = Math.sqrt(a * a + b * b))
  2430. a /= scaleX, b /= scaleX;
  2431. if (skewX = a * c + b * d)
  2432. c -= a * skewX, d -= b * skewX;
  2433. if (scaleY = Math.sqrt(c * c + d * d))
  2434. c /= scaleY, d /= scaleY, skewX /= scaleY;
  2435. if (a * d < b * c)
  2436. a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
  2437. return {
  2438. translateX: e,
  2439. translateY: f,
  2440. rotate: Math.atan2(b, a) * degrees2,
  2441. skewX: Math.atan(skewX) * degrees2,
  2442. scaleX,
  2443. scaleY
  2444. };
  2445. }
  2446. // node_modules/d3-interpolate/src/transform/parse.js
  2447. var svgNode;
  2448. function parseCss(value) {
  2449. const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
  2450. return m.isIdentity ? identity2 : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f);
  2451. }
  2452. function parseSvg(value) {
  2453. if (value == null)
  2454. return identity2;
  2455. if (!svgNode)
  2456. svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
  2457. svgNode.setAttribute("transform", value);
  2458. if (!(value = svgNode.transform.baseVal.consolidate()))
  2459. return identity2;
  2460. value = value.matrix;
  2461. return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
  2462. }
  2463. // node_modules/d3-interpolate/src/transform/index.js
  2464. function interpolateTransform(parse, pxComma, pxParen, degParen) {
  2465. function pop(s) {
  2466. return s.length ? s.pop() + " " : "";
  2467. }
  2468. function translate(xa, ya, xb, yb, s, q) {
  2469. if (xa !== xb || ya !== yb) {
  2470. var i = s.push("translate(", null, pxComma, null, pxParen);
  2471. q.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });
  2472. } else if (xb || yb) {
  2473. s.push("translate(" + xb + pxComma + yb + pxParen);
  2474. }
  2475. }
  2476. function rotate(a, b, s, q) {
  2477. if (a !== b) {
  2478. if (a - b > 180)
  2479. b += 360;
  2480. else if (b - a > 180)
  2481. a += 360;
  2482. q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number_default(a, b) });
  2483. } else if (b) {
  2484. s.push(pop(s) + "rotate(" + b + degParen);
  2485. }
  2486. }
  2487. function skewX(a, b, s, q) {
  2488. if (a !== b) {
  2489. q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number_default(a, b) });
  2490. } else if (b) {
  2491. s.push(pop(s) + "skewX(" + b + degParen);
  2492. }
  2493. }
  2494. function scale(xa, ya, xb, yb, s, q) {
  2495. if (xa !== xb || ya !== yb) {
  2496. var i = s.push(pop(s) + "scale(", null, ",", null, ")");
  2497. q.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });
  2498. } else if (xb !== 1 || yb !== 1) {
  2499. s.push(pop(s) + "scale(" + xb + "," + yb + ")");
  2500. }
  2501. }
  2502. return function(a, b) {
  2503. var s = [], q = [];
  2504. a = parse(a), b = parse(b);
  2505. translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
  2506. rotate(a.rotate, b.rotate, s, q);
  2507. skewX(a.skewX, b.skewX, s, q);
  2508. scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
  2509. a = b = null;
  2510. return function(t) {
  2511. var i = -1, n = q.length, o;
  2512. while (++i < n)
  2513. s[(o = q[i]).i] = o.x(t);
  2514. return s.join("");
  2515. };
  2516. };
  2517. }
  2518. var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
  2519. var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
  2520. // node_modules/d3-interpolate/src/hsl.js
  2521. function hsl2(hue2) {
  2522. return function(start, end) {
  2523. var h = hue2((start = hsl(start)).h, (end = hsl(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);
  2524. return function(t) {
  2525. start.h = h(t);
  2526. start.s = s(t);
  2527. start.l = l(t);
  2528. start.opacity = opacity(t);
  2529. return start + "";
  2530. };
  2531. };
  2532. }
  2533. var hsl_default = hsl2(hue);
  2534. var hslLong = hsl2(nogamma);
  2535. // node_modules/d3-interpolate/src/lab.js
  2536. function lab2(start, end) {
  2537. var l = nogamma((start = lab(start)).l, (end = lab(end)).l), a = nogamma(start.a, end.a), b = nogamma(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
  2538. return function(t) {
  2539. start.l = l(t);
  2540. start.a = a(t);
  2541. start.b = b(t);
  2542. start.opacity = opacity(t);
  2543. return start + "";
  2544. };
  2545. }
  2546. // node_modules/d3-interpolate/src/hcl.js
  2547. function hcl2(hue2) {
  2548. return function(start, end) {
  2549. var h = hue2((start = hcl(start)).h, (end = hcl(end)).h), c = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);
  2550. return function(t) {
  2551. start.h = h(t);
  2552. start.c = c(t);
  2553. start.l = l(t);
  2554. start.opacity = opacity(t);
  2555. return start + "";
  2556. };
  2557. };
  2558. }
  2559. var hcl_default = hcl2(hue);
  2560. var hclLong = hcl2(nogamma);
  2561. // node_modules/d3-interpolate/src/cubehelix.js
  2562. function cubehelix2(hue2) {
  2563. return function cubehelixGamma(y) {
  2564. y = +y;
  2565. function cubehelix3(start, end) {
  2566. var h = hue2((start = cubehelix(start)).h, (end = cubehelix(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);
  2567. return function(t) {
  2568. start.h = h(t);
  2569. start.s = s(t);
  2570. start.l = l(Math.pow(t, y));
  2571. start.opacity = opacity(t);
  2572. return start + "";
  2573. };
  2574. }
  2575. cubehelix3.gamma = cubehelixGamma;
  2576. return cubehelix3;
  2577. }(1);
  2578. }
  2579. var cubehelix_default = cubehelix2(hue);
  2580. var cubehelixLong = cubehelix2(nogamma);
  2581. // node_modules/d3-interpolate/src/piecewise.js
  2582. function piecewise(interpolate, values) {
  2583. if (values === undefined)
  2584. values = interpolate, interpolate = value_default;
  2585. var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
  2586. while (i < n)
  2587. I[i] = interpolate(v, v = values[++i]);
  2588. return function(t) {
  2589. var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
  2590. return I[i2](t - i2);
  2591. };
  2592. }
  2593. // node_modules/d3-interpolate/src/quantize.js
  2594. function quantize_default(interpolator, n) {
  2595. var samples = new Array(n);
  2596. for (var i = 0;i < n; ++i)
  2597. samples[i] = interpolator(i / (n - 1));
  2598. return samples;
  2599. }
  2600. // node_modules/d3-timer/src/timer.js
  2601. var frame = 0;
  2602. var timeout = 0;
  2603. var interval = 0;
  2604. var pokeDelay = 1000;
  2605. var taskHead;
  2606. var taskTail;
  2607. var clockLast = 0;
  2608. var clockNow = 0;
  2609. var clockSkew = 0;
  2610. var clock = typeof performance === "object" && performance.now ? performance : Date;
  2611. var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) {
  2612. setTimeout(f, 17);
  2613. };
  2614. function now() {
  2615. return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
  2616. }
  2617. function clearNow() {
  2618. clockNow = 0;
  2619. }
  2620. function Timer() {
  2621. this._call = this._time = this._next = null;
  2622. }
  2623. Timer.prototype = timer.prototype = {
  2624. constructor: Timer,
  2625. restart: function(callback, delay, time) {
  2626. if (typeof callback !== "function")
  2627. throw new TypeError("callback is not a function");
  2628. time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
  2629. if (!this._next && taskTail !== this) {
  2630. if (taskTail)
  2631. taskTail._next = this;
  2632. else
  2633. taskHead = this;
  2634. taskTail = this;
  2635. }
  2636. this._call = callback;
  2637. this._time = time;
  2638. sleep();
  2639. },
  2640. stop: function() {
  2641. if (this._call) {
  2642. this._call = null;
  2643. this._time = Infinity;
  2644. sleep();
  2645. }
  2646. }
  2647. };
  2648. function timer(callback, delay, time) {
  2649. var t = new Timer;
  2650. t.restart(callback, delay, time);
  2651. return t;
  2652. }
  2653. function timerFlush() {
  2654. now();
  2655. ++frame;
  2656. var t = taskHead, e;
  2657. while (t) {
  2658. if ((e = clockNow - t._time) >= 0)
  2659. t._call.call(undefined, e);
  2660. t = t._next;
  2661. }
  2662. --frame;
  2663. }
  2664. function wake() {
  2665. clockNow = (clockLast = clock.now()) + clockSkew;
  2666. frame = timeout = 0;
  2667. try {
  2668. timerFlush();
  2669. } finally {
  2670. frame = 0;
  2671. nap();
  2672. clockNow = 0;
  2673. }
  2674. }
  2675. function poke() {
  2676. var now2 = clock.now(), delay = now2 - clockLast;
  2677. if (delay > pokeDelay)
  2678. clockSkew -= delay, clockLast = now2;
  2679. }
  2680. function nap() {
  2681. var t02, t12 = taskHead, t22, time = Infinity;
  2682. while (t12) {
  2683. if (t12._call) {
  2684. if (time > t12._time)
  2685. time = t12._time;
  2686. t02 = t12, t12 = t12._next;
  2687. } else {
  2688. t22 = t12._next, t12._next = null;
  2689. t12 = t02 ? t02._next = t22 : taskHead = t22;
  2690. }
  2691. }
  2692. taskTail = t02;
  2693. sleep(time);
  2694. }
  2695. function sleep(time) {
  2696. if (frame)
  2697. return;
  2698. if (timeout)
  2699. timeout = clearTimeout(timeout);
  2700. var delay = time - clockNow;
  2701. if (delay > 24) {
  2702. if (time < Infinity)
  2703. timeout = setTimeout(wake, time - clock.now() - clockSkew);
  2704. if (interval)
  2705. interval = clearInterval(interval);
  2706. } else {
  2707. if (!interval)
  2708. clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
  2709. frame = 1, setFrame(wake);
  2710. }
  2711. }
  2712. // node_modules/d3-timer/src/timeout.js
  2713. function timeout_default(callback, delay, time) {
  2714. var t = new Timer;
  2715. delay = delay == null ? 0 : +delay;
  2716. t.restart((elapsed) => {
  2717. t.stop();
  2718. callback(elapsed + delay);
  2719. }, delay, time);
  2720. return t;
  2721. }
  2722. // node_modules/d3-transition/src/transition/schedule.js
  2723. var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
  2724. var emptyTween = [];
  2725. var CREATED = 0;
  2726. var SCHEDULED = 1;
  2727. var STARTING = 2;
  2728. var STARTED = 3;
  2729. var RUNNING = 4;
  2730. var ENDING = 5;
  2731. var ENDED = 6;
  2732. function schedule_default(node, name, id, index2, group2, timing) {
  2733. var schedules = node.__transition;
  2734. if (!schedules)
  2735. node.__transition = {};
  2736. else if (id in schedules)
  2737. return;
  2738. create(node, id, {
  2739. name,
  2740. index: index2,
  2741. group: group2,
  2742. on: emptyOn,
  2743. tween: emptyTween,
  2744. time: timing.time,
  2745. delay: timing.delay,
  2746. duration: timing.duration,
  2747. ease: timing.ease,
  2748. timer: null,
  2749. state: CREATED
  2750. });
  2751. }
  2752. function init(node, id) {
  2753. var schedule = get2(node, id);
  2754. if (schedule.state > CREATED)
  2755. throw new Error("too late; already scheduled");
  2756. return schedule;
  2757. }
  2758. function set2(node, id) {
  2759. var schedule = get2(node, id);
  2760. if (schedule.state > STARTED)
  2761. throw new Error("too late; already running");
  2762. return schedule;
  2763. }
  2764. function get2(node, id) {
  2765. var schedule = node.__transition;
  2766. if (!schedule || !(schedule = schedule[id]))
  2767. throw new Error("transition not found");
  2768. return schedule;
  2769. }
  2770. function create(node, id, self) {
  2771. var schedules = node.__transition, tween;
  2772. schedules[id] = self;
  2773. self.timer = timer(schedule, 0, self.time);
  2774. function schedule(elapsed) {
  2775. self.state = SCHEDULED;
  2776. self.timer.restart(start, self.delay, self.time);
  2777. if (self.delay <= elapsed)
  2778. start(elapsed - self.delay);
  2779. }
  2780. function start(elapsed) {
  2781. var i, j, n, o;
  2782. if (self.state !== SCHEDULED)
  2783. return stop();
  2784. for (i in schedules) {
  2785. o = schedules[i];
  2786. if (o.name !== self.name)
  2787. continue;
  2788. if (o.state === STARTED)
  2789. return timeout_default(start);
  2790. if (o.state === RUNNING) {
  2791. o.state = ENDED;
  2792. o.timer.stop();
  2793. o.on.call("interrupt", node, node.__data__, o.index, o.group);
  2794. delete schedules[i];
  2795. } else if (+i < id) {
  2796. o.state = ENDED;
  2797. o.timer.stop();
  2798. o.on.call("cancel", node, node.__data__, o.index, o.group);
  2799. delete schedules[i];
  2800. }
  2801. }
  2802. timeout_default(function() {
  2803. if (self.state === STARTED) {
  2804. self.state = RUNNING;
  2805. self.timer.restart(tick, self.delay, self.time);
  2806. tick(elapsed);
  2807. }
  2808. });
  2809. self.state = STARTING;
  2810. self.on.call("start", node, node.__data__, self.index, self.group);
  2811. if (self.state !== STARTING)
  2812. return;
  2813. self.state = STARTED;
  2814. tween = new Array(n = self.tween.length);
  2815. for (i = 0, j = -1;i < n; ++i) {
  2816. if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
  2817. tween[++j] = o;
  2818. }
  2819. }
  2820. tween.length = j + 1;
  2821. }
  2822. function tick(elapsed) {
  2823. var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1), i = -1, n = tween.length;
  2824. while (++i < n) {
  2825. tween[i].call(node, t);
  2826. }
  2827. if (self.state === ENDING) {
  2828. self.on.call("end", node, node.__data__, self.index, self.group);
  2829. stop();
  2830. }
  2831. }
  2832. function stop() {
  2833. self.state = ENDED;
  2834. self.timer.stop();
  2835. delete schedules[id];
  2836. for (var i in schedules)
  2837. return;
  2838. delete node.__transition;
  2839. }
  2840. }
  2841. // node_modules/d3-transition/src/interrupt.js
  2842. function interrupt_default(node, name) {
  2843. var schedules = node.__transition, schedule, active, empty3 = true, i;
  2844. if (!schedules)
  2845. return;
  2846. name = name == null ? null : name + "";
  2847. for (i in schedules) {
  2848. if ((schedule = schedules[i]).name !== name) {
  2849. empty3 = false;
  2850. continue;
  2851. }
  2852. active = schedule.state > STARTING && schedule.state < ENDING;
  2853. schedule.state = ENDED;
  2854. schedule.timer.stop();
  2855. schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
  2856. delete schedules[i];
  2857. }
  2858. if (empty3)
  2859. delete node.__transition;
  2860. }
  2861. // node_modules/d3-transition/src/selection/interrupt.js
  2862. function interrupt_default2(name) {
  2863. return this.each(function() {
  2864. interrupt_default(this, name);
  2865. });
  2866. }
  2867. // node_modules/d3-transition/src/transition/tween.js
  2868. function tweenRemove(id, name) {
  2869. var tween0, tween1;
  2870. return function() {
  2871. var schedule = set2(this, id), tween = schedule.tween;
  2872. if (tween !== tween0) {
  2873. tween1 = tween0 = tween;
  2874. for (var i = 0, n = tween1.length;i < n; ++i) {
  2875. if (tween1[i].name === name) {
  2876. tween1 = tween1.slice();
  2877. tween1.splice(i, 1);
  2878. break;
  2879. }
  2880. }
  2881. }
  2882. schedule.tween = tween1;
  2883. };
  2884. }
  2885. function tweenFunction(id, name, value) {
  2886. var tween0, tween1;
  2887. if (typeof value !== "function")
  2888. throw new Error;
  2889. return function() {
  2890. var schedule = set2(this, id), tween = schedule.tween;
  2891. if (tween !== tween0) {
  2892. tween1 = (tween0 = tween).slice();
  2893. for (var t = { name, value }, i = 0, n = tween1.length;i < n; ++i) {
  2894. if (tween1[i].name === name) {
  2895. tween1[i] = t;
  2896. break;
  2897. }
  2898. }
  2899. if (i === n)
  2900. tween1.push(t);
  2901. }
  2902. schedule.tween = tween1;
  2903. };
  2904. }
  2905. function tween_default(name, value) {
  2906. var id = this._id;
  2907. name += "";
  2908. if (arguments.length < 2) {
  2909. var tween = get2(this.node(), id).tween;
  2910. for (var i = 0, n = tween.length, t;i < n; ++i) {
  2911. if ((t = tween[i]).name === name) {
  2912. return t.value;
  2913. }
  2914. }
  2915. return null;
  2916. }
  2917. return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
  2918. }
  2919. function tweenValue(transition, name, value) {
  2920. var id = transition._id;
  2921. transition.each(function() {
  2922. var schedule = set2(this, id);
  2923. (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
  2924. });
  2925. return function(node) {
  2926. return get2(node, id).value[name];
  2927. };
  2928. }
  2929. // node_modules/d3-transition/src/transition/interpolate.js
  2930. function interpolate_default(a, b) {
  2931. var c;
  2932. return (typeof b === "number" ? number_default : b instanceof color ? rgb_default : (c = color(b)) ? (b = c, rgb_default) : string_default)(a, b);
  2933. }
  2934. // node_modules/d3-transition/src/transition/attr.js
  2935. function attrRemove2(name) {
  2936. return function() {
  2937. this.removeAttribute(name);
  2938. };
  2939. }
  2940. function attrRemoveNS2(fullname) {
  2941. return function() {
  2942. this.removeAttributeNS(fullname.space, fullname.local);
  2943. };
  2944. }
  2945. function attrConstant2(name, interpolate, value1) {
  2946. var string00, string1 = value1 + "", interpolate0;
  2947. return function() {
  2948. var string0 = this.getAttribute(name);
  2949. return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
  2950. };
  2951. }
  2952. function attrConstantNS2(fullname, interpolate, value1) {
  2953. var string00, string1 = value1 + "", interpolate0;
  2954. return function() {
  2955. var string0 = this.getAttributeNS(fullname.space, fullname.local);
  2956. return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
  2957. };
  2958. }
  2959. function attrFunction2(name, interpolate, value) {
  2960. var string00, string10, interpolate0;
  2961. return function() {
  2962. var string0, value1 = value(this), string1;
  2963. if (value1 == null)
  2964. return void this.removeAttribute(name);
  2965. string0 = this.getAttribute(name);
  2966. string1 = value1 + "";
  2967. return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
  2968. };
  2969. }
  2970. function attrFunctionNS2(fullname, interpolate, value) {
  2971. var string00, string10, interpolate0;
  2972. return function() {
  2973. var string0, value1 = value(this), string1;
  2974. if (value1 == null)
  2975. return void this.removeAttributeNS(fullname.space, fullname.local);
  2976. string0 = this.getAttributeNS(fullname.space, fullname.local);
  2977. string1 = value1 + "";
  2978. return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
  2979. };
  2980. }
  2981. function attr_default2(name, value) {
  2982. var fullname = namespace_default(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
  2983. return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i, value));
  2984. }
  2985. // node_modules/d3-transition/src/transition/attrTween.js
  2986. function attrInterpolate(name, i) {
  2987. return function(t) {
  2988. this.setAttribute(name, i.call(this, t));
  2989. };
  2990. }
  2991. function attrInterpolateNS(fullname, i) {
  2992. return function(t) {
  2993. this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
  2994. };
  2995. }
  2996. function attrTweenNS(fullname, value) {
  2997. var t02, i0;
  2998. function tween() {
  2999. var i = value.apply(this, arguments);
  3000. if (i !== i0)
  3001. t02 = (i0 = i) && attrInterpolateNS(fullname, i);
  3002. return t02;
  3003. }
  3004. tween._value = value;
  3005. return tween;
  3006. }
  3007. function attrTween(name, value) {
  3008. var t02, i0;
  3009. function tween() {
  3010. var i = value.apply(this, arguments);
  3011. if (i !== i0)
  3012. t02 = (i0 = i) && attrInterpolate(name, i);
  3013. return t02;
  3014. }
  3015. tween._value = value;
  3016. return tween;
  3017. }
  3018. function attrTween_default(name, value) {
  3019. var key = "attr." + name;
  3020. if (arguments.length < 2)
  3021. return (key = this.tween(key)) && key._value;
  3022. if (value == null)
  3023. return this.tween(key, null);
  3024. if (typeof value !== "function")
  3025. throw new Error;
  3026. var fullname = namespace_default(name);
  3027. return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
  3028. }
  3029. // node_modules/d3-transition/src/transition/delay.js
  3030. function delayFunction(id, value) {
  3031. return function() {
  3032. init(this, id).delay = +value.apply(this, arguments);
  3033. };
  3034. }
  3035. function delayConstant(id, value) {
  3036. return value = +value, function() {
  3037. init(this, id).delay = value;
  3038. };
  3039. }
  3040. function delay_default(value) {
  3041. var id = this._id;
  3042. return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get2(this.node(), id).delay;
  3043. }
  3044. // node_modules/d3-transition/src/transition/duration.js
  3045. function durationFunction(id, value) {
  3046. return function() {
  3047. set2(this, id).duration = +value.apply(this, arguments);
  3048. };
  3049. }
  3050. function durationConstant(id, value) {
  3051. return value = +value, function() {
  3052. set2(this, id).duration = value;
  3053. };
  3054. }
  3055. function duration_default(value) {
  3056. var id = this._id;
  3057. return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get2(this.node(), id).duration;
  3058. }
  3059. // node_modules/d3-transition/src/transition/ease.js
  3060. function easeConstant(id, value) {
  3061. if (typeof value !== "function")
  3062. throw new Error;
  3063. return function() {
  3064. set2(this, id).ease = value;
  3065. };
  3066. }
  3067. function ease_default(value) {
  3068. var id = this._id;
  3069. return arguments.length ? this.each(easeConstant(id, value)) : get2(this.node(), id).ease;
  3070. }
  3071. // node_modules/d3-transition/src/transition/easeVarying.js
  3072. function easeVarying(id, value) {
  3073. return function() {
  3074. var v = value.apply(this, arguments);
  3075. if (typeof v !== "function")
  3076. throw new Error;
  3077. set2(this, id).ease = v;
  3078. };
  3079. }
  3080. function easeVarying_default(value) {
  3081. if (typeof value !== "function")
  3082. throw new Error;
  3083. return this.each(easeVarying(this._id, value));
  3084. }
  3085. // node_modules/d3-transition/src/transition/filter.js
  3086. function filter_default2(match) {
  3087. if (typeof match !== "function")
  3088. match = matcher_default(match);
  3089. for (var groups2 = this._groups, m = groups2.length, subgroups = new Array(m), j = 0;j < m; ++j) {
  3090. for (var group2 = groups2[j], n = group2.length, subgroup = subgroups[j] = [], node, i = 0;i < n; ++i) {
  3091. if ((node = group2[i]) && match.call(node, node.__data__, i, group2)) {
  3092. subgroup.push(node);
  3093. }
  3094. }
  3095. }
  3096. return new Transition(subgroups, this._parents, this._name, this._id);
  3097. }
  3098. // node_modules/d3-transition/src/transition/merge.js
  3099. function merge_default2(transition) {
  3100. if (transition._id !== this._id)
  3101. throw new Error;
  3102. for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0;j < m; ++j) {
  3103. for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge2 = merges[j] = new Array(n), node, i = 0;i < n; ++i) {
  3104. if (node = group0[i] || group1[i]) {
  3105. merge2[i] = node;
  3106. }
  3107. }
  3108. }
  3109. for (;j < m0; ++j) {
  3110. merges[j] = groups0[j];
  3111. }
  3112. return new Transition(merges, this._parents, this._name, this._id);
  3113. }
  3114. // node_modules/d3-transition/src/transition/on.js
  3115. function start(name) {
  3116. return (name + "").trim().split(/^|\s+/).every(function(t) {
  3117. var i = t.indexOf(".");
  3118. if (i >= 0)
  3119. t = t.slice(0, i);
  3120. return !t || t === "start";
  3121. });
  3122. }
  3123. function onFunction(id, name, listener) {
  3124. var on0, on1, sit = start(name) ? init : set2;
  3125. return function() {
  3126. var schedule = sit(this, id), on = schedule.on;
  3127. if (on !== on0)
  3128. (on1 = (on0 = on).copy()).on(name, listener);
  3129. schedule.on = on1;
  3130. };
  3131. }
  3132. function on_default2(name, listener) {
  3133. var id = this._id;
  3134. return arguments.length < 2 ? get2(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
  3135. }
  3136. // node_modules/d3-transition/src/transition/remove.js
  3137. function removeFunction(id) {
  3138. return function() {
  3139. var parent = this.parentNode;
  3140. for (var i in this.__transition)
  3141. if (+i !== id)
  3142. return;
  3143. if (parent)
  3144. parent.removeChild(this);
  3145. };
  3146. }
  3147. function remove_default2() {
  3148. return this.on("end.remove", removeFunction(this._id));
  3149. }
  3150. // node_modules/d3-transition/src/transition/select.js
  3151. function select_default3(select) {
  3152. var name = this._name, id = this._id;
  3153. if (typeof select !== "function")
  3154. select = selector_default(select);
  3155. for (var groups2 = this._groups, m = groups2.length, subgroups = new Array(m), j = 0;j < m; ++j) {
  3156. for (var group2 = groups2[j], n = group2.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0;i < n; ++i) {
  3157. if ((node = group2[i]) && (subnode = select.call(node, node.__data__, i, group2))) {
  3158. if ("__data__" in node)
  3159. subnode.__data__ = node.__data__;
  3160. subgroup[i] = subnode;
  3161. schedule_default(subgroup[i], name, id, i, subgroup, get2(node, id));
  3162. }
  3163. }
  3164. }
  3165. return new Transition(subgroups, this._parents, name, id);
  3166. }
  3167. // node_modules/d3-transition/src/transition/selectAll.js
  3168. function selectAll_default2(select) {
  3169. var name = this._name, id = this._id;
  3170. if (typeof select !== "function")
  3171. select = selectorAll_default(select);
  3172. for (var groups2 = this._groups, m = groups2.length, subgroups = [], parents = [], j = 0;j < m; ++j) {
  3173. for (var group2 = groups2[j], n = group2.length, node, i = 0;i < n; ++i) {
  3174. if (node = group2[i]) {
  3175. for (var children2 = select.call(node, node.__data__, i, group2), child, inherit = get2(node, id), k = 0, l = children2.length;k < l; ++k) {
  3176. if (child = children2[k]) {
  3177. schedule_default(child, name, id, k, children2, inherit);
  3178. }
  3179. }
  3180. subgroups.push(children2);
  3181. parents.push(node);
  3182. }
  3183. }
  3184. }
  3185. return new Transition(subgroups, parents, name, id);
  3186. }
  3187. // node_modules/d3-transition/src/transition/selection.js
  3188. var Selection2 = selection_default.prototype.constructor;
  3189. function selection_default2() {
  3190. return new Selection2(this._groups, this._parents);
  3191. }
  3192. // node_modules/d3-transition/src/transition/style.js
  3193. function styleNull(name, interpolate) {
  3194. var string00, string10, interpolate0;
  3195. return function() {
  3196. var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
  3197. return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
  3198. };
  3199. }
  3200. function styleRemove2(name) {
  3201. return function() {
  3202. this.style.removeProperty(name);
  3203. };
  3204. }
  3205. function styleConstant2(name, interpolate, value1) {
  3206. var string00, string1 = value1 + "", interpolate0;
  3207. return function() {
  3208. var string0 = styleValue(this, name);
  3209. return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
  3210. };
  3211. }
  3212. function styleFunction2(name, interpolate, value) {
  3213. var string00, string10, interpolate0;
  3214. return function() {
  3215. var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
  3216. if (value1 == null)
  3217. string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
  3218. return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
  3219. };
  3220. }
  3221. function styleMaybeRemove(id, name) {
  3222. var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
  3223. return function() {
  3224. var schedule = set2(this, id), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : undefined;
  3225. if (on !== on0 || listener0 !== listener)
  3226. (on1 = (on0 = on).copy()).on(event, listener0 = listener);
  3227. schedule.on = on1;
  3228. };
  3229. }
  3230. function style_default2(name, value, priority) {
  3231. var i = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
  3232. return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i, value), priority).on("end.style." + name, null);
  3233. }
  3234. // node_modules/d3-transition/src/transition/styleTween.js
  3235. function styleInterpolate(name, i, priority) {
  3236. return function(t) {
  3237. this.style.setProperty(name, i.call(this, t), priority);
  3238. };
  3239. }
  3240. function styleTween(name, value, priority) {
  3241. var t, i0;
  3242. function tween() {
  3243. var i = value.apply(this, arguments);
  3244. if (i !== i0)
  3245. t = (i0 = i) && styleInterpolate(name, i, priority);
  3246. return t;
  3247. }
  3248. tween._value = value;
  3249. return tween;
  3250. }
  3251. function styleTween_default(name, value, priority) {
  3252. var key = "style." + (name += "");
  3253. if (arguments.length < 2)
  3254. return (key = this.tween(key)) && key._value;
  3255. if (value == null)
  3256. return this.tween(key, null);
  3257. if (typeof value !== "function")
  3258. throw new Error;
  3259. return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
  3260. }
  3261. // node_modules/d3-transition/src/transition/text.js
  3262. function textConstant2(value) {
  3263. return function() {
  3264. this.textContent = value;
  3265. };
  3266. }
  3267. function textFunction2(value) {
  3268. return function() {
  3269. var value1 = value(this);
  3270. this.textContent = value1 == null ? "" : value1;
  3271. };
  3272. }
  3273. function text_default2(value) {
  3274. return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
  3275. }
  3276. // node_modules/d3-transition/src/transition/textTween.js
  3277. function textInterpolate(i) {
  3278. return function(t) {
  3279. this.textContent = i.call(this, t);
  3280. };
  3281. }
  3282. function textTween(value) {
  3283. var t02, i0;
  3284. function tween() {
  3285. var i = value.apply(this, arguments);
  3286. if (i !== i0)
  3287. t02 = (i0 = i) && textInterpolate(i);
  3288. return t02;
  3289. }
  3290. tween._value = value;
  3291. return tween;
  3292. }
  3293. function textTween_default(value) {
  3294. var key = "text";
  3295. if (arguments.length < 1)
  3296. return (key = this.tween(key)) && key._value;
  3297. if (value == null)
  3298. return this.tween(key, null);
  3299. if (typeof value !== "function")
  3300. throw new Error;
  3301. return this.tween(key, textTween(value));
  3302. }
  3303. // node_modules/d3-transition/src/transition/transition.js
  3304. function transition_default() {
  3305. var name = this._name, id0 = this._id, id1 = newId();
  3306. for (var groups2 = this._groups, m = groups2.length, j = 0;j < m; ++j) {
  3307. for (var group2 = groups2[j], n = group2.length, node, i = 0;i < n; ++i) {
  3308. if (node = group2[i]) {
  3309. var inherit = get2(node, id0);
  3310. schedule_default(node, name, id1, i, group2, {
  3311. time: inherit.time + inherit.delay + inherit.duration,
  3312. delay: 0,
  3313. duration: inherit.duration,
  3314. ease: inherit.ease
  3315. });
  3316. }
  3317. }
  3318. }
  3319. return new Transition(groups2, this._parents, name, id1);
  3320. }
  3321. // node_modules/d3-transition/src/transition/end.js
  3322. function end_default() {
  3323. var on0, on1, that = this, id = that._id, size = that.size();
  3324. return new Promise(function(resolve, reject) {
  3325. var cancel = { value: reject }, end = { value: function() {
  3326. if (--size === 0)
  3327. resolve();
  3328. } };
  3329. that.each(function() {
  3330. var schedule = set2(this, id), on = schedule.on;
  3331. if (on !== on0) {
  3332. on1 = (on0 = on).copy();
  3333. on1._.cancel.push(cancel);
  3334. on1._.interrupt.push(cancel);
  3335. on1._.end.push(end);
  3336. }
  3337. schedule.on = on1;
  3338. });
  3339. if (size === 0)
  3340. resolve();
  3341. });
  3342. }
  3343. // node_modules/d3-transition/src/transition/index.js
  3344. var id = 0;
  3345. function Transition(groups2, parents, name, id2) {
  3346. this._groups = groups2;
  3347. this._parents = parents;
  3348. this._name = name;
  3349. this._id = id2;
  3350. }
  3351. function transition(name) {
  3352. return selection_default().transition(name);
  3353. }
  3354. function newId() {
  3355. return ++id;
  3356. }
  3357. var selection_prototype = selection_default.prototype;
  3358. Transition.prototype = transition.prototype = {
  3359. constructor: Transition,
  3360. select: select_default3,
  3361. selectAll: selectAll_default2,
  3362. selectChild: selection_prototype.selectChild,
  3363. selectChildren: selection_prototype.selectChildren,
  3364. filter: filter_default2,
  3365. merge: merge_default2,
  3366. selection: selection_default2,
  3367. transition: transition_default,
  3368. call: selection_prototype.call,
  3369. nodes: selection_prototype.nodes,
  3370. node: selection_prototype.node,
  3371. size: selection_prototype.size,
  3372. empty: selection_prototype.empty,
  3373. each: selection_prototype.each,
  3374. on: on_default2,
  3375. attr: attr_default2,
  3376. attrTween: attrTween_default,
  3377. style: style_default2,
  3378. styleTween: styleTween_default,
  3379. text: text_default2,
  3380. textTween: textTween_default,
  3381. remove: remove_default2,
  3382. tween: tween_default,
  3383. delay: delay_default,
  3384. duration: duration_default,
  3385. ease: ease_default,
  3386. easeVarying: easeVarying_default,
  3387. end: end_default,
  3388. [Symbol.iterator]: selection_prototype[Symbol.iterator]
  3389. };
  3390. // node_modules/d3-ease/src/cubic.js
  3391. function cubicInOut(t) {
  3392. return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
  3393. }
  3394. // node_modules/d3-transition/src/selection/transition.js
  3395. var defaultTiming = {
  3396. time: null,
  3397. delay: 0,
  3398. duration: 250,
  3399. ease: cubicInOut
  3400. };
  3401. function inherit(node, id2) {
  3402. var timing;
  3403. while (!(timing = node.__transition) || !(timing = timing[id2])) {
  3404. if (!(node = node.parentNode)) {
  3405. throw new Error(`transition ${id2} not found`);
  3406. }
  3407. }
  3408. return timing;
  3409. }
  3410. function transition_default2(name) {
  3411. var id2, timing;
  3412. if (name instanceof Transition) {
  3413. id2 = name._id, name = name._name;
  3414. } else {
  3415. id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
  3416. }
  3417. for (var groups2 = this._groups, m = groups2.length, j = 0;j < m; ++j) {
  3418. for (var group2 = groups2[j], n = group2.length, node, i = 0;i < n; ++i) {
  3419. if (node = group2[i]) {
  3420. schedule_default(node, name, id2, i, group2, timing || inherit(node, id2));
  3421. }
  3422. }
  3423. }
  3424. return new Transition(groups2, this._parents, name, id2);
  3425. }
  3426. // node_modules/d3-transition/src/selection/index.js
  3427. selection_default.prototype.interrupt = interrupt_default2;
  3428. selection_default.prototype.transition = transition_default2;
  3429. // node_modules/d3-brush/src/brush.js
  3430. function number1(e) {
  3431. return [+e[0], +e[1]];
  3432. }
  3433. function number22(e) {
  3434. return [number1(e[0]), number1(e[1])];
  3435. }
  3436. var X = {
  3437. name: "x",
  3438. handles: ["w", "e"].map(type),
  3439. input: function(x, e) {
  3440. return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]];
  3441. },
  3442. output: function(xy) {
  3443. return xy && [xy[0][0], xy[1][0]];
  3444. }
  3445. };
  3446. var Y = {
  3447. name: "y",
  3448. handles: ["n", "s"].map(type),
  3449. input: function(y, e) {
  3450. return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]];
  3451. },
  3452. output: function(xy) {
  3453. return xy && [xy[0][1], xy[1][1]];
  3454. }
  3455. };
  3456. var XY = {
  3457. name: "xy",
  3458. handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
  3459. input: function(xy) {
  3460. return xy == null ? null : number22(xy);
  3461. },
  3462. output: function(xy) {
  3463. return xy;
  3464. }
  3465. };
  3466. function type(t) {
  3467. return { type: t };
  3468. }
  3469. // node_modules/d3-path/src/path.js
  3470. var pi = Math.PI;
  3471. var tau = 2 * pi;
  3472. var epsilon2 = 0.000001;
  3473. var tauEpsilon = tau - epsilon2;
  3474. function append(strings) {
  3475. this._ += strings[0];
  3476. for (let i = 1, n = strings.length;i < n; ++i) {
  3477. this._ += arguments[i] + strings[i];
  3478. }
  3479. }
  3480. function appendRound(digits) {
  3481. let d = Math.floor(digits);
  3482. if (!(d >= 0))
  3483. throw new Error(`invalid digits: ${digits}`);
  3484. if (d > 15)
  3485. return append;
  3486. const k = 10 ** d;
  3487. return function(strings) {
  3488. this._ += strings[0];
  3489. for (let i = 1, n = strings.length;i < n; ++i) {
  3490. this._ += Math.round(arguments[i] * k) / k + strings[i];
  3491. }
  3492. };
  3493. }
  3494. class Path {
  3495. constructor(digits) {
  3496. this._x0 = this._y0 = this._x1 = this._y1 = null;
  3497. this._ = "";
  3498. this._append = digits == null ? append : appendRound(digits);
  3499. }
  3500. moveTo(x, y) {
  3501. this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
  3502. }
  3503. closePath() {
  3504. if (this._x1 !== null) {
  3505. this._x1 = this._x0, this._y1 = this._y0;
  3506. this._append`Z`;
  3507. }
  3508. }
  3509. lineTo(x, y) {
  3510. this._append`L${this._x1 = +x},${this._y1 = +y}`;
  3511. }
  3512. quadraticCurveTo(x1, y1, x, y) {
  3513. this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
  3514. }
  3515. bezierCurveTo(x1, y1, x2, y2, x, y) {
  3516. this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
  3517. }
  3518. arcTo(x1, y1, x2, y2, r) {
  3519. x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
  3520. if (r < 0)
  3521. throw new Error(`negative radius: ${r}`);
  3522. let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
  3523. if (this._x1 === null) {
  3524. this._append`M${this._x1 = x1},${this._y1 = y1}`;
  3525. } else if (!(l01_2 > epsilon2))
  3526. ;
  3527. else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon2) || !r) {
  3528. this._append`L${this._x1 = x1},${this._y1 = y1}`;
  3529. } else {
  3530. let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
  3531. if (Math.abs(t01 - 1) > epsilon2) {
  3532. this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
  3533. }
  3534. this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
  3535. }
  3536. }
  3537. arc(x, y, r, a0, a1, ccw) {
  3538. x = +x, y = +y, r = +r, ccw = !!ccw;
  3539. if (r < 0)
  3540. throw new Error(`negative radius: ${r}`);
  3541. let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
  3542. if (this._x1 === null) {
  3543. this._append`M${x0},${y0}`;
  3544. } else if (Math.abs(this._x1 - x0) > epsilon2 || Math.abs(this._y1 - y0) > epsilon2) {
  3545. this._append`L${x0},${y0}`;
  3546. }
  3547. if (!r)
  3548. return;
  3549. if (da < 0)
  3550. da = da % tau + tau;
  3551. if (da > tauEpsilon) {
  3552. this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
  3553. } else if (da > epsilon2) {
  3554. this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
  3555. }
  3556. }
  3557. rect(x, y, w, h) {
  3558. this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
  3559. }
  3560. toString() {
  3561. return this._;
  3562. }
  3563. }
  3564. function path() {
  3565. return new Path;
  3566. }
  3567. path.prototype = Path.prototype;
  3568. function pathRound(digits = 3) {
  3569. return new Path(+digits);
  3570. }
  3571. // node_modules/d3-format/src/formatDecimal.js
  3572. function formatDecimal_default(x) {
  3573. return Math.abs(x = Math.round(x)) >= 1000000000000000000000 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
  3574. }
  3575. function formatDecimalParts(x, p) {
  3576. if (!isFinite(x) || x === 0)
  3577. return null;
  3578. var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
  3579. return [
  3580. coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
  3581. +x.slice(i + 1)
  3582. ];
  3583. }
  3584. // node_modules/d3-format/src/exponent.js
  3585. function exponent_default(x) {
  3586. return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
  3587. }
  3588. // node_modules/d3-format/src/formatGroup.js
  3589. function formatGroup_default(grouping, thousands) {
  3590. return function(value, width) {
  3591. var i = value.length, t = [], j = 0, g = grouping[0], length2 = 0;
  3592. while (i > 0 && g > 0) {
  3593. if (length2 + g + 1 > width)
  3594. g = Math.max(1, width - length2);
  3595. t.push(value.substring(i -= g, i + g));
  3596. if ((length2 += g + 1) > width)
  3597. break;
  3598. g = grouping[j = (j + 1) % grouping.length];
  3599. }
  3600. return t.reverse().join(thousands);
  3601. };
  3602. }
  3603. // node_modules/d3-format/src/formatNumerals.js
  3604. function formatNumerals_default(numerals) {
  3605. return function(value) {
  3606. return value.replace(/[0-9]/g, function(i) {
  3607. return numerals[+i];
  3608. });
  3609. };
  3610. }
  3611. // node_modules/d3-format/src/formatSpecifier.js
  3612. var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
  3613. function formatSpecifier(specifier) {
  3614. if (!(match = re.exec(specifier)))
  3615. throw new Error("invalid format: " + specifier);
  3616. var match;
  3617. return new FormatSpecifier({
  3618. fill: match[1],
  3619. align: match[2],
  3620. sign: match[3],
  3621. symbol: match[4],
  3622. zero: match[5],
  3623. width: match[6],
  3624. comma: match[7],
  3625. precision: match[8] && match[8].slice(1),
  3626. trim: match[9],
  3627. type: match[10]
  3628. });
  3629. }
  3630. formatSpecifier.prototype = FormatSpecifier.prototype;
  3631. function FormatSpecifier(specifier) {
  3632. this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
  3633. this.align = specifier.align === undefined ? ">" : specifier.align + "";
  3634. this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
  3635. this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
  3636. this.zero = !!specifier.zero;
  3637. this.width = specifier.width === undefined ? undefined : +specifier.width;
  3638. this.comma = !!specifier.comma;
  3639. this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
  3640. this.trim = !!specifier.trim;
  3641. this.type = specifier.type === undefined ? "" : specifier.type + "";
  3642. }
  3643. FormatSpecifier.prototype.toString = function() {
  3644. return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
  3645. };
  3646. // node_modules/d3-format/src/formatTrim.js
  3647. function formatTrim_default(s) {
  3648. out:
  3649. for (var n = s.length, i = 1, i0 = -1, i1;i < n; ++i) {
  3650. switch (s[i]) {
  3651. case ".":
  3652. i0 = i1 = i;
  3653. break;
  3654. case "0":
  3655. if (i0 === 0)
  3656. i0 = i;
  3657. i1 = i;
  3658. break;
  3659. default:
  3660. if (!+s[i])
  3661. break out;
  3662. if (i0 > 0)
  3663. i0 = 0;
  3664. break;
  3665. }
  3666. }
  3667. return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
  3668. }
  3669. // node_modules/d3-format/src/formatPrefixAuto.js
  3670. var prefixExponent;
  3671. function formatPrefixAuto_default(x, p) {
  3672. var d = formatDecimalParts(x, p);
  3673. if (!d)
  3674. return prefixExponent = undefined, x.toPrecision(p);
  3675. var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
  3676. return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
  3677. }
  3678. // node_modules/d3-format/src/formatRounded.js
  3679. function formatRounded_default(x, p) {
  3680. var d = formatDecimalParts(x, p);
  3681. if (!d)
  3682. return x + "";
  3683. var coefficient = d[0], exponent = d[1];
  3684. return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
  3685. }
  3686. // node_modules/d3-format/src/formatTypes.js
  3687. var formatTypes_default = {
  3688. "%": (x, p) => (x * 100).toFixed(p),
  3689. b: (x) => Math.round(x).toString(2),
  3690. c: (x) => x + "",
  3691. d: formatDecimal_default,
  3692. e: (x, p) => x.toExponential(p),
  3693. f: (x, p) => x.toFixed(p),
  3694. g: (x, p) => x.toPrecision(p),
  3695. o: (x) => Math.round(x).toString(8),
  3696. p: (x, p) => formatRounded_default(x * 100, p),
  3697. r: formatRounded_default,
  3698. s: formatPrefixAuto_default,
  3699. X: (x) => Math.round(x).toString(16).toUpperCase(),
  3700. x: (x) => Math.round(x).toString(16)
  3701. };
  3702. // node_modules/d3-format/src/identity.js
  3703. function identity_default2(x) {
  3704. return x;
  3705. }
  3706. // node_modules/d3-format/src/locale.js
  3707. var map = Array.prototype.map;
  3708. var prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
  3709. function locale_default(locale) {
  3710. var group2 = locale.grouping === undefined || locale.thousands === undefined ? identity_default2 : formatGroup_default(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? identity_default2 : formatNumerals_default(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "−" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + "";
  3711. function newFormat(specifier, options) {
  3712. specifier = formatSpecifier(specifier);
  3713. var { fill, align, sign, symbol, zero: zero3, width, comma, precision, trim, type: type2 } = specifier;
  3714. if (type2 === "n")
  3715. comma = true, type2 = "g";
  3716. else if (!formatTypes_default[type2])
  3717. precision === undefined && (precision = 12), trim = true, type2 = "g";
  3718. if (zero3 || fill === "0" && align === "=")
  3719. zero3 = true, fill = "0", align = "=";
  3720. var prefix = (options && options.prefix !== undefined ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "") + (options && options.suffix !== undefined ? options.suffix : "");
  3721. var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
  3722. precision = precision === undefined ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
  3723. function format(value) {
  3724. var valuePrefix = prefix, valueSuffix = suffix, i, n, c;
  3725. if (type2 === "c") {
  3726. valueSuffix = formatType(value) + valueSuffix;
  3727. value = "";
  3728. } else {
  3729. value = +value;
  3730. var valueNegative = value < 0 || 1 / value < 0;
  3731. value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
  3732. if (trim)
  3733. value = formatTrim_default(value);
  3734. if (valueNegative && +value === 0 && sign !== "+")
  3735. valueNegative = false;
  3736. valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
  3737. valueSuffix = (type2 === "s" && !isNaN(value) && prefixExponent !== undefined ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
  3738. if (maybeSuffix) {
  3739. i = -1, n = value.length;
  3740. while (++i < n) {
  3741. if (c = value.charCodeAt(i), 48 > c || c > 57) {
  3742. valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
  3743. value = value.slice(0, i);
  3744. break;
  3745. }
  3746. }
  3747. }
  3748. }
  3749. if (comma && !zero3)
  3750. value = group2(value, Infinity);
  3751. var length2 = valuePrefix.length + value.length + valueSuffix.length, padding = length2 < width ? new Array(width - length2 + 1).join(fill) : "";
  3752. if (comma && zero3)
  3753. value = group2(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
  3754. switch (align) {
  3755. case "<":
  3756. value = valuePrefix + value + valueSuffix + padding;
  3757. break;
  3758. case "=":
  3759. value = valuePrefix + padding + value + valueSuffix;
  3760. break;
  3761. case "^":
  3762. value = padding.slice(0, length2 = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length2);
  3763. break;
  3764. default:
  3765. value = padding + valuePrefix + value + valueSuffix;
  3766. break;
  3767. }
  3768. return numerals(value);
  3769. }
  3770. format.toString = function() {
  3771. return specifier + "";
  3772. };
  3773. return format;
  3774. }
  3775. function formatPrefix(specifier, value) {
  3776. var e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), { suffix: prefixes[8 + e / 3] });
  3777. return function(value2) {
  3778. return f(k * value2);
  3779. };
  3780. }
  3781. return {
  3782. format: newFormat,
  3783. formatPrefix
  3784. };
  3785. }
  3786. // node_modules/d3-format/src/defaultLocale.js
  3787. var locale;
  3788. var format;
  3789. var formatPrefix;
  3790. defaultLocale({
  3791. thousands: ",",
  3792. grouping: [3],
  3793. currency: ["$", ""]
  3794. });
  3795. function defaultLocale(definition) {
  3796. locale = locale_default(definition);
  3797. format = locale.format;
  3798. formatPrefix = locale.formatPrefix;
  3799. return locale;
  3800. }
  3801. // node_modules/d3-format/src/precisionFixed.js
  3802. function precisionFixed_default(step) {
  3803. return Math.max(0, -exponent_default(Math.abs(step)));
  3804. }
  3805. // node_modules/d3-format/src/precisionPrefix.js
  3806. function precisionPrefix_default(step, value) {
  3807. return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
  3808. }
  3809. // node_modules/d3-format/src/precisionRound.js
  3810. function precisionRound_default(step, max2) {
  3811. step = Math.abs(step), max2 = Math.abs(max2) - step;
  3812. return Math.max(0, exponent_default(max2) - exponent_default(step)) + 1;
  3813. }
  3814. // node_modules/d3-geo/src/math.js
  3815. var epsilon3 = 0.000001;
  3816. var epsilon22 = 0.000000000001;
  3817. var pi2 = Math.PI;
  3818. var halfPi = pi2 / 2;
  3819. var quarterPi = pi2 / 4;
  3820. var tau2 = pi2 * 2;
  3821. var degrees3 = 180 / pi2;
  3822. var radians2 = pi2 / 180;
  3823. var abs = Math.abs;
  3824. var atan = Math.atan;
  3825. var atan2 = Math.atan2;
  3826. var cos = Math.cos;
  3827. var exp = Math.exp;
  3828. var log = Math.log;
  3829. var pow = Math.pow;
  3830. var sin = Math.sin;
  3831. var sign = Math.sign || function(x) {
  3832. return x > 0 ? 1 : x < 0 ? -1 : 0;
  3833. };
  3834. var sqrt = Math.sqrt;
  3835. var tan = Math.tan;
  3836. function acos(x) {
  3837. return x > 1 ? 0 : x < -1 ? pi2 : Math.acos(x);
  3838. }
  3839. function asin(x) {
  3840. return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
  3841. }
  3842. // node_modules/d3-geo/src/noop.js
  3843. function noop2() {}
  3844. // node_modules/d3-geo/src/stream.js
  3845. function streamGeometry(geometry, stream) {
  3846. if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
  3847. streamGeometryType[geometry.type](geometry, stream);
  3848. }
  3849. }
  3850. var streamObjectType = {
  3851. Feature: function(object, stream) {
  3852. streamGeometry(object.geometry, stream);
  3853. },
  3854. FeatureCollection: function(object, stream) {
  3855. var features = object.features, i = -1, n = features.length;
  3856. while (++i < n)
  3857. streamGeometry(features[i].geometry, stream);
  3858. }
  3859. };
  3860. var streamGeometryType = {
  3861. Sphere: function(object, stream) {
  3862. stream.sphere();
  3863. },
  3864. Point: function(object, stream) {
  3865. object = object.coordinates;
  3866. stream.point(object[0], object[1], object[2]);
  3867. },
  3868. MultiPoint: function(object, stream) {
  3869. var coordinates = object.coordinates, i = -1, n = coordinates.length;
  3870. while (++i < n)
  3871. object = coordinates[i], stream.point(object[0], object[1], object[2]);
  3872. },
  3873. LineString: function(object, stream) {
  3874. streamLine(object.coordinates, stream, 0);
  3875. },
  3876. MultiLineString: function(object, stream) {
  3877. var coordinates = object.coordinates, i = -1, n = coordinates.length;
  3878. while (++i < n)
  3879. streamLine(coordinates[i], stream, 0);
  3880. },
  3881. Polygon: function(object, stream) {
  3882. streamPolygon(object.coordinates, stream);
  3883. },
  3884. MultiPolygon: function(object, stream) {
  3885. var coordinates = object.coordinates, i = -1, n = coordinates.length;
  3886. while (++i < n)
  3887. streamPolygon(coordinates[i], stream);
  3888. },
  3889. GeometryCollection: function(object, stream) {
  3890. var geometries = object.geometries, i = -1, n = geometries.length;
  3891. while (++i < n)
  3892. streamGeometry(geometries[i], stream);
  3893. }
  3894. };
  3895. function streamLine(coordinates, stream, closed) {
  3896. var i = -1, n = coordinates.length - closed, coordinate;
  3897. stream.lineStart();
  3898. while (++i < n)
  3899. coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);
  3900. stream.lineEnd();
  3901. }
  3902. function streamPolygon(coordinates, stream) {
  3903. var i = -1, n = coordinates.length;
  3904. stream.polygonStart();
  3905. while (++i < n)
  3906. streamLine(coordinates[i], stream, 1);
  3907. stream.polygonEnd();
  3908. }
  3909. function stream_default(object, stream) {
  3910. if (object && streamObjectType.hasOwnProperty(object.type)) {
  3911. streamObjectType[object.type](object, stream);
  3912. } else {
  3913. streamGeometry(object, stream);
  3914. }
  3915. }
  3916. // node_modules/d3-geo/src/cartesian.js
  3917. function spherical(cartesian) {
  3918. return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];
  3919. }
  3920. function cartesian(spherical2) {
  3921. var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
  3922. return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
  3923. }
  3924. function cartesianDot(a, b) {
  3925. return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  3926. }
  3927. function cartesianCross(a, b) {
  3928. return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
  3929. }
  3930. function cartesianAddInPlace(a, b) {
  3931. a[0] += b[0], a[1] += b[1], a[2] += b[2];
  3932. }
  3933. function cartesianScale(vector, k) {
  3934. return [vector[0] * k, vector[1] * k, vector[2] * k];
  3935. }
  3936. function cartesianNormalizeInPlace(d) {
  3937. var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
  3938. d[0] /= l, d[1] /= l, d[2] /= l;
  3939. }
  3940. // node_modules/d3-geo/src/compose.js
  3941. function compose_default(a, b) {
  3942. function compose(x, y) {
  3943. return x = a(x, y), b(x[0], x[1]);
  3944. }
  3945. if (a.invert && b.invert)
  3946. compose.invert = function(x, y) {
  3947. return x = b.invert(x, y), x && a.invert(x[0], x[1]);
  3948. };
  3949. return compose;
  3950. }
  3951. // node_modules/d3-geo/src/rotation.js
  3952. function rotationIdentity(lambda, phi) {
  3953. if (abs(lambda) > pi2)
  3954. lambda -= Math.round(lambda / tau2) * tau2;
  3955. return [lambda, phi];
  3956. }
  3957. rotationIdentity.invert = rotationIdentity;
  3958. function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
  3959. return (deltaLambda %= tau2) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
  3960. }
  3961. function forwardRotationLambda(deltaLambda) {
  3962. return function(lambda, phi) {
  3963. lambda += deltaLambda;
  3964. if (abs(lambda) > pi2)
  3965. lambda -= Math.round(lambda / tau2) * tau2;
  3966. return [lambda, phi];
  3967. };
  3968. }
  3969. function rotationLambda(deltaLambda) {
  3970. var rotation = forwardRotationLambda(deltaLambda);
  3971. rotation.invert = forwardRotationLambda(-deltaLambda);
  3972. return rotation;
  3973. }
  3974. function rotationPhiGamma(deltaPhi, deltaGamma) {
  3975. var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
  3976. function rotation(lambda, phi) {
  3977. var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;
  3978. return [
  3979. atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),
  3980. asin(k * cosDeltaGamma + y * sinDeltaGamma)
  3981. ];
  3982. }
  3983. rotation.invert = function(lambda, phi) {
  3984. var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;
  3985. return [
  3986. atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),
  3987. asin(k * cosDeltaPhi - x * sinDeltaPhi)
  3988. ];
  3989. };
  3990. return rotation;
  3991. }
  3992. function rotation_default(rotate) {
  3993. rotate = rotateRadians(rotate[0] * radians2, rotate[1] * radians2, rotate.length > 2 ? rotate[2] * radians2 : 0);
  3994. function forward(coordinates) {
  3995. coordinates = rotate(coordinates[0] * radians2, coordinates[1] * radians2);
  3996. return coordinates[0] *= degrees3, coordinates[1] *= degrees3, coordinates;
  3997. }
  3998. forward.invert = function(coordinates) {
  3999. coordinates = rotate.invert(coordinates[0] * radians2, coordinates[1] * radians2);
  4000. return coordinates[0] *= degrees3, coordinates[1] *= degrees3, coordinates;
  4001. };
  4002. return forward;
  4003. }
  4004. // node_modules/d3-geo/src/circle.js
  4005. function circleStream(stream, radius, delta, direction, t02, t12) {
  4006. if (!delta)
  4007. return;
  4008. var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
  4009. if (t02 == null) {
  4010. t02 = radius + direction * tau2;
  4011. t12 = radius - step / 2;
  4012. } else {
  4013. t02 = circleRadius(cosRadius, t02);
  4014. t12 = circleRadius(cosRadius, t12);
  4015. if (direction > 0 ? t02 < t12 : t02 > t12)
  4016. t02 += direction * tau2;
  4017. }
  4018. for (var point, t = t02;direction > 0 ? t > t12 : t < t12; t -= step) {
  4019. point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);
  4020. stream.point(point[0], point[1]);
  4021. }
  4022. }
  4023. function circleRadius(cosRadius, point) {
  4024. point = cartesian(point), point[0] -= cosRadius;
  4025. cartesianNormalizeInPlace(point);
  4026. var radius = acos(-point[1]);
  4027. return ((-point[2] < 0 ? -radius : radius) + tau2 - epsilon3) % tau2;
  4028. }
  4029. // node_modules/d3-geo/src/clip/buffer.js
  4030. function buffer_default() {
  4031. var lines = [], line;
  4032. return {
  4033. point: function(x, y, m) {
  4034. line.push([x, y, m]);
  4035. },
  4036. lineStart: function() {
  4037. lines.push(line = []);
  4038. },
  4039. lineEnd: noop2,
  4040. rejoin: function() {
  4041. if (lines.length > 1)
  4042. lines.push(lines.pop().concat(lines.shift()));
  4043. },
  4044. result: function() {
  4045. var result = lines;
  4046. lines = [];
  4047. line = null;
  4048. return result;
  4049. }
  4050. };
  4051. }
  4052. // node_modules/d3-geo/src/pointEqual.js
  4053. function pointEqual_default(a, b) {
  4054. return abs(a[0] - b[0]) < epsilon3 && abs(a[1] - b[1]) < epsilon3;
  4055. }
  4056. // node_modules/d3-geo/src/clip/rejoin.js
  4057. function Intersection(point, points, other, entry) {
  4058. this.x = point;
  4059. this.z = points;
  4060. this.o = other;
  4061. this.e = entry;
  4062. this.v = false;
  4063. this.n = this.p = null;
  4064. }
  4065. function rejoin_default(segments, compareIntersection, startInside, interpolate, stream) {
  4066. var subject = [], clip = [], i, n;
  4067. segments.forEach(function(segment) {
  4068. if ((n2 = segment.length - 1) <= 0)
  4069. return;
  4070. var n2, p0 = segment[0], p1 = segment[n2], x;
  4071. if (pointEqual_default(p0, p1)) {
  4072. if (!p0[2] && !p1[2]) {
  4073. stream.lineStart();
  4074. for (i = 0;i < n2; ++i)
  4075. stream.point((p0 = segment[i])[0], p0[1]);
  4076. stream.lineEnd();
  4077. return;
  4078. }
  4079. p1[0] += 2 * epsilon3;
  4080. }
  4081. subject.push(x = new Intersection(p0, segment, null, true));
  4082. clip.push(x.o = new Intersection(p0, null, x, false));
  4083. subject.push(x = new Intersection(p1, segment, null, false));
  4084. clip.push(x.o = new Intersection(p1, null, x, true));
  4085. });
  4086. if (!subject.length)
  4087. return;
  4088. clip.sort(compareIntersection);
  4089. link(subject);
  4090. link(clip);
  4091. for (i = 0, n = clip.length;i < n; ++i) {
  4092. clip[i].e = startInside = !startInside;
  4093. }
  4094. var start2 = subject[0], points, point;
  4095. while (true) {
  4096. var current = start2, isSubject = true;
  4097. while (current.v)
  4098. if ((current = current.n) === start2)
  4099. return;
  4100. points = current.z;
  4101. stream.lineStart();
  4102. do {
  4103. current.v = current.o.v = true;
  4104. if (current.e) {
  4105. if (isSubject) {
  4106. for (i = 0, n = points.length;i < n; ++i)
  4107. stream.point((point = points[i])[0], point[1]);
  4108. } else {
  4109. interpolate(current.x, current.n.x, 1, stream);
  4110. }
  4111. current = current.n;
  4112. } else {
  4113. if (isSubject) {
  4114. points = current.p.z;
  4115. for (i = points.length - 1;i >= 0; --i)
  4116. stream.point((point = points[i])[0], point[1]);
  4117. } else {
  4118. interpolate(current.x, current.p.x, -1, stream);
  4119. }
  4120. current = current.p;
  4121. }
  4122. current = current.o;
  4123. points = current.z;
  4124. isSubject = !isSubject;
  4125. } while (!current.v);
  4126. stream.lineEnd();
  4127. }
  4128. }
  4129. function link(array2) {
  4130. if (!(n = array2.length))
  4131. return;
  4132. var n, i = 0, a = array2[0], b;
  4133. while (++i < n) {
  4134. a.n = b = array2[i];
  4135. b.p = a;
  4136. a = b;
  4137. }
  4138. a.n = b = array2[0];
  4139. b.p = a;
  4140. }
  4141. // node_modules/d3-geo/src/polygonContains.js
  4142. function longitude(point) {
  4143. return abs(point[0]) <= pi2 ? point[0] : sign(point[0]) * ((abs(point[0]) + pi2) % tau2 - pi2);
  4144. }
  4145. function polygonContains_default(polygon, point) {
  4146. var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle = 0, winding = 0;
  4147. var sum2 = new Adder;
  4148. if (sinPhi === 1)
  4149. phi = halfPi + epsilon3;
  4150. else if (sinPhi === -1)
  4151. phi = -halfPi - epsilon3;
  4152. for (var i = 0, n = polygon.length;i < n; ++i) {
  4153. if (!(m = (ring = polygon[i]).length))
  4154. continue;
  4155. var ring, m, point0 = ring[m - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + quarterPi, sinPhi0 = sin(phi0), cosPhi0 = cos(phi0);
  4156. for (var j = 0;j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
  4157. var point1 = ring[j], lambda1 = longitude(point1), phi1 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi1), cosPhi1 = cos(phi1), delta = lambda1 - lambda0, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi2, k = sinPhi0 * sinPhi1;
  4158. sum2.add(atan2(k * sign2 * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta)));
  4159. angle += antimeridian ? delta + sign2 * tau2 : delta;
  4160. if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
  4161. var arc = cartesianCross(cartesian(point0), cartesian(point1));
  4162. cartesianNormalizeInPlace(arc);
  4163. var intersection = cartesianCross(normal, arc);
  4164. cartesianNormalizeInPlace(intersection);
  4165. var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
  4166. if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
  4167. winding += antimeridian ^ delta >= 0 ? 1 : -1;
  4168. }
  4169. }
  4170. }
  4171. }
  4172. return (angle < -epsilon3 || angle < epsilon3 && sum2 < -epsilon22) ^ winding & 1;
  4173. }
  4174. // node_modules/d3-geo/src/clip/index.js
  4175. function clip_default(pointVisible, clipLine, interpolate, start2) {
  4176. return function(sink) {
  4177. var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon, segments, ring;
  4178. var clip = {
  4179. point,
  4180. lineStart,
  4181. lineEnd,
  4182. polygonStart: function() {
  4183. clip.point = pointRing;
  4184. clip.lineStart = ringStart;
  4185. clip.lineEnd = ringEnd;
  4186. segments = [];
  4187. polygon = [];
  4188. },
  4189. polygonEnd: function() {
  4190. clip.point = point;
  4191. clip.lineStart = lineStart;
  4192. clip.lineEnd = lineEnd;
  4193. segments = merge(segments);
  4194. var startInside = polygonContains_default(polygon, start2);
  4195. if (segments.length) {
  4196. if (!polygonStarted)
  4197. sink.polygonStart(), polygonStarted = true;
  4198. rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
  4199. } else if (startInside) {
  4200. if (!polygonStarted)
  4201. sink.polygonStart(), polygonStarted = true;
  4202. sink.lineStart();
  4203. interpolate(null, null, 1, sink);
  4204. sink.lineEnd();
  4205. }
  4206. if (polygonStarted)
  4207. sink.polygonEnd(), polygonStarted = false;
  4208. segments = polygon = null;
  4209. },
  4210. sphere: function() {
  4211. sink.polygonStart();
  4212. sink.lineStart();
  4213. interpolate(null, null, 1, sink);
  4214. sink.lineEnd();
  4215. sink.polygonEnd();
  4216. }
  4217. };
  4218. function point(lambda, phi) {
  4219. if (pointVisible(lambda, phi))
  4220. sink.point(lambda, phi);
  4221. }
  4222. function pointLine(lambda, phi) {
  4223. line.point(lambda, phi);
  4224. }
  4225. function lineStart() {
  4226. clip.point = pointLine;
  4227. line.lineStart();
  4228. }
  4229. function lineEnd() {
  4230. clip.point = point;
  4231. line.lineEnd();
  4232. }
  4233. function pointRing(lambda, phi) {
  4234. ring.push([lambda, phi]);
  4235. ringSink.point(lambda, phi);
  4236. }
  4237. function ringStart() {
  4238. ringSink.lineStart();
  4239. ring = [];
  4240. }
  4241. function ringEnd() {
  4242. pointRing(ring[0][0], ring[0][1]);
  4243. ringSink.lineEnd();
  4244. var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point2;
  4245. ring.pop();
  4246. polygon.push(ring);
  4247. ring = null;
  4248. if (!n)
  4249. return;
  4250. if (clean & 1) {
  4251. segment = ringSegments[0];
  4252. if ((m = segment.length - 1) > 0) {
  4253. if (!polygonStarted)
  4254. sink.polygonStart(), polygonStarted = true;
  4255. sink.lineStart();
  4256. for (i = 0;i < m; ++i)
  4257. sink.point((point2 = segment[i])[0], point2[1]);
  4258. sink.lineEnd();
  4259. }
  4260. return;
  4261. }
  4262. if (n > 1 && clean & 2)
  4263. ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
  4264. segments.push(ringSegments.filter(validSegment));
  4265. }
  4266. return clip;
  4267. };
  4268. }
  4269. function validSegment(segment) {
  4270. return segment.length > 1;
  4271. }
  4272. function compareIntersection(a, b) {
  4273. return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon3 : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon3 : halfPi - b[1]);
  4274. }
  4275. // node_modules/d3-geo/src/clip/antimeridian.js
  4276. var antimeridian_default = clip_default(function() {
  4277. return true;
  4278. }, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi2, -halfPi]);
  4279. function clipAntimeridianLine(stream) {
  4280. var lambda0 = NaN, phi0 = NaN, sign0 = NaN, clean;
  4281. return {
  4282. lineStart: function() {
  4283. stream.lineStart();
  4284. clean = 1;
  4285. },
  4286. point: function(lambda1, phi1) {
  4287. var sign1 = lambda1 > 0 ? pi2 : -pi2, delta = abs(lambda1 - lambda0);
  4288. if (abs(delta - pi2) < epsilon3) {
  4289. stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);
  4290. stream.point(sign0, phi0);
  4291. stream.lineEnd();
  4292. stream.lineStart();
  4293. stream.point(sign1, phi0);
  4294. stream.point(lambda1, phi0);
  4295. clean = 0;
  4296. } else if (sign0 !== sign1 && delta >= pi2) {
  4297. if (abs(lambda0 - sign0) < epsilon3)
  4298. lambda0 -= sign0 * epsilon3;
  4299. if (abs(lambda1 - sign1) < epsilon3)
  4300. lambda1 -= sign1 * epsilon3;
  4301. phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
  4302. stream.point(sign0, phi0);
  4303. stream.lineEnd();
  4304. stream.lineStart();
  4305. stream.point(sign1, phi0);
  4306. clean = 0;
  4307. }
  4308. stream.point(lambda0 = lambda1, phi0 = phi1);
  4309. sign0 = sign1;
  4310. },
  4311. lineEnd: function() {
  4312. stream.lineEnd();
  4313. lambda0 = phi0 = NaN;
  4314. },
  4315. clean: function() {
  4316. return 2 - clean;
  4317. }
  4318. };
  4319. }
  4320. function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
  4321. var cosPhi0, cosPhi1, sinLambda0Lambda1 = sin(lambda0 - lambda1);
  4322. return abs(sinLambda0Lambda1) > epsilon3 ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1) - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2;
  4323. }
  4324. function clipAntimeridianInterpolate(from, to, direction, stream) {
  4325. var phi;
  4326. if (from == null) {
  4327. phi = direction * halfPi;
  4328. stream.point(-pi2, phi);
  4329. stream.point(0, phi);
  4330. stream.point(pi2, phi);
  4331. stream.point(pi2, 0);
  4332. stream.point(pi2, -phi);
  4333. stream.point(0, -phi);
  4334. stream.point(-pi2, -phi);
  4335. stream.point(-pi2, 0);
  4336. stream.point(-pi2, phi);
  4337. } else if (abs(from[0] - to[0]) > epsilon3) {
  4338. var lambda = from[0] < to[0] ? pi2 : -pi2;
  4339. phi = direction * lambda / 2;
  4340. stream.point(-lambda, phi);
  4341. stream.point(0, phi);
  4342. stream.point(lambda, phi);
  4343. } else {
  4344. stream.point(to[0], to[1]);
  4345. }
  4346. }
  4347. // node_modules/d3-geo/src/clip/circle.js
  4348. function circle_default(radius) {
  4349. var cr = cos(radius), delta = 2 * radians2, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon3;
  4350. function interpolate(from, to, direction, stream) {
  4351. circleStream(stream, radius, delta, direction, from, to);
  4352. }
  4353. function visible(lambda, phi) {
  4354. return cos(lambda) * cos(phi) > cr;
  4355. }
  4356. function clipLine(stream) {
  4357. var point0, c0, v0, v00, clean;
  4358. return {
  4359. lineStart: function() {
  4360. v00 = v0 = false;
  4361. clean = 1;
  4362. },
  4363. point: function(lambda, phi) {
  4364. var point1 = [lambda, phi], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi2 : -pi2), phi) : 0;
  4365. if (!point0 && (v00 = v0 = v))
  4366. stream.lineStart();
  4367. if (v !== v0) {
  4368. point2 = intersect(point0, point1);
  4369. if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
  4370. point1[2] = 1;
  4371. }
  4372. if (v !== v0) {
  4373. clean = 0;
  4374. if (v) {
  4375. stream.lineStart();
  4376. point2 = intersect(point1, point0);
  4377. stream.point(point2[0], point2[1]);
  4378. } else {
  4379. point2 = intersect(point0, point1);
  4380. stream.point(point2[0], point2[1], 2);
  4381. stream.lineEnd();
  4382. }
  4383. point0 = point2;
  4384. } else if (notHemisphere && point0 && smallRadius ^ v) {
  4385. var t;
  4386. if (!(c & c0) && (t = intersect(point1, point0, true))) {
  4387. clean = 0;
  4388. if (smallRadius) {
  4389. stream.lineStart();
  4390. stream.point(t[0][0], t[0][1]);
  4391. stream.point(t[1][0], t[1][1]);
  4392. stream.lineEnd();
  4393. } else {
  4394. stream.point(t[1][0], t[1][1]);
  4395. stream.lineEnd();
  4396. stream.lineStart();
  4397. stream.point(t[0][0], t[0][1], 3);
  4398. }
  4399. }
  4400. }
  4401. if (v && (!point0 || !pointEqual_default(point0, point1))) {
  4402. stream.point(point1[0], point1[1]);
  4403. }
  4404. point0 = point1, v0 = v, c0 = c;
  4405. },
  4406. lineEnd: function() {
  4407. if (v0)
  4408. stream.lineEnd();
  4409. point0 = null;
  4410. },
  4411. clean: function() {
  4412. return clean | (v00 && v0) << 1;
  4413. }
  4414. };
  4415. }
  4416. function intersect(a, b, two) {
  4417. var pa = cartesian(a), pb = cartesian(b);
  4418. var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
  4419. if (!determinant)
  4420. return !two && a;
  4421. var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A2 = cartesianScale(n1, c1), B2 = cartesianScale(n2, c2);
  4422. cartesianAddInPlace(A2, B2);
  4423. var u = n1xn2, w = cartesianDot(A2, u), uu = cartesianDot(u, u), t22 = w * w - uu * (cartesianDot(A2, A2) - 1);
  4424. if (t22 < 0)
  4425. return;
  4426. var t = sqrt(t22), q = cartesianScale(u, (-w - t) / uu);
  4427. cartesianAddInPlace(q, A2);
  4428. q = spherical(q);
  4429. if (!two)
  4430. return q;
  4431. var lambda0 = a[0], lambda1 = b[0], phi0 = a[1], phi1 = b[1], z;
  4432. if (lambda1 < lambda0)
  4433. z = lambda0, lambda0 = lambda1, lambda1 = z;
  4434. var delta2 = lambda1 - lambda0, polar = abs(delta2 - pi2) < epsilon3, meridian = polar || delta2 < epsilon3;
  4435. if (!polar && phi1 < phi0)
  4436. z = phi0, phi0 = phi1, phi1 = z;
  4437. if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon3 ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta2 > pi2 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
  4438. var q1 = cartesianScale(u, (-w + t) / uu);
  4439. cartesianAddInPlace(q1, A2);
  4440. return [q, spherical(q1)];
  4441. }
  4442. }
  4443. function code(lambda, phi) {
  4444. var r = smallRadius ? radius : pi2 - radius, code2 = 0;
  4445. if (lambda < -r)
  4446. code2 |= 1;
  4447. else if (lambda > r)
  4448. code2 |= 2;
  4449. if (phi < -r)
  4450. code2 |= 4;
  4451. else if (phi > r)
  4452. code2 |= 8;
  4453. return code2;
  4454. }
  4455. return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi2, radius - pi2]);
  4456. }
  4457. // node_modules/d3-geo/src/clip/line.js
  4458. function line_default(a, b, x0, y0, x1, y1) {
  4459. var ax = a[0], ay = a[1], bx = b[0], by = b[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r;
  4460. r = x0 - ax;
  4461. if (!dx && r > 0)
  4462. return;
  4463. r /= dx;
  4464. if (dx < 0) {
  4465. if (r < t02)
  4466. return;
  4467. if (r < t12)
  4468. t12 = r;
  4469. } else if (dx > 0) {
  4470. if (r > t12)
  4471. return;
  4472. if (r > t02)
  4473. t02 = r;
  4474. }
  4475. r = x1 - ax;
  4476. if (!dx && r < 0)
  4477. return;
  4478. r /= dx;
  4479. if (dx < 0) {
  4480. if (r > t12)
  4481. return;
  4482. if (r > t02)
  4483. t02 = r;
  4484. } else if (dx > 0) {
  4485. if (r < t02)
  4486. return;
  4487. if (r < t12)
  4488. t12 = r;
  4489. }
  4490. r = y0 - ay;
  4491. if (!dy && r > 0)
  4492. return;
  4493. r /= dy;
  4494. if (dy < 0) {
  4495. if (r < t02)
  4496. return;
  4497. if (r < t12)
  4498. t12 = r;
  4499. } else if (dy > 0) {
  4500. if (r > t12)
  4501. return;
  4502. if (r > t02)
  4503. t02 = r;
  4504. }
  4505. r = y1 - ay;
  4506. if (!dy && r < 0)
  4507. return;
  4508. r /= dy;
  4509. if (dy < 0) {
  4510. if (r > t12)
  4511. return;
  4512. if (r > t02)
  4513. t02 = r;
  4514. } else if (dy > 0) {
  4515. if (r < t02)
  4516. return;
  4517. if (r < t12)
  4518. t12 = r;
  4519. }
  4520. if (t02 > 0)
  4521. a[0] = ax + t02 * dx, a[1] = ay + t02 * dy;
  4522. if (t12 < 1)
  4523. b[0] = ax + t12 * dx, b[1] = ay + t12 * dy;
  4524. return true;
  4525. }
  4526. // node_modules/d3-geo/src/clip/rectangle.js
  4527. var clipMax = 1e9;
  4528. var clipMin = -clipMax;
  4529. function clipRectangle(x0, y0, x1, y1) {
  4530. function visible(x, y) {
  4531. return x0 <= x && x <= x1 && y0 <= y && y <= y1;
  4532. }
  4533. function interpolate(from, to, direction, stream) {
  4534. var a = 0, a1 = 0;
  4535. if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
  4536. do
  4537. stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
  4538. while ((a = (a + direction + 4) % 4) !== a1);
  4539. } else {
  4540. stream.point(to[0], to[1]);
  4541. }
  4542. }
  4543. function corner(p, direction) {
  4544. return abs(p[0] - x0) < epsilon3 ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < epsilon3 ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < epsilon3 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
  4545. }
  4546. function compareIntersection2(a, b) {
  4547. return comparePoint(a.x, b.x);
  4548. }
  4549. function comparePoint(a, b) {
  4550. var ca = corner(a, 1), cb = corner(b, 1);
  4551. return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
  4552. }
  4553. return function(stream) {
  4554. var activeStream = stream, bufferStream = buffer_default(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean;
  4555. var clipStream = {
  4556. point,
  4557. lineStart,
  4558. lineEnd,
  4559. polygonStart,
  4560. polygonEnd
  4561. };
  4562. function point(x, y) {
  4563. if (visible(x, y))
  4564. activeStream.point(x, y);
  4565. }
  4566. function polygonInside() {
  4567. var winding = 0;
  4568. for (var i = 0, n = polygon.length;i < n; ++i) {
  4569. for (var ring2 = polygon[i], j = 1, m = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1];j < m; ++j) {
  4570. a0 = b0, a1 = b1, point2 = ring2[j], b0 = point2[0], b1 = point2[1];
  4571. if (a1 <= y1) {
  4572. if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0))
  4573. ++winding;
  4574. } else {
  4575. if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0))
  4576. --winding;
  4577. }
  4578. }
  4579. }
  4580. return winding;
  4581. }
  4582. function polygonStart() {
  4583. activeStream = bufferStream, segments = [], polygon = [], clean = true;
  4584. }
  4585. function polygonEnd() {
  4586. var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments = merge(segments)).length;
  4587. if (cleanInside || visible2) {
  4588. stream.polygonStart();
  4589. if (cleanInside) {
  4590. stream.lineStart();
  4591. interpolate(null, null, 1, stream);
  4592. stream.lineEnd();
  4593. }
  4594. if (visible2) {
  4595. rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
  4596. }
  4597. stream.polygonEnd();
  4598. }
  4599. activeStream = stream, segments = polygon = ring = null;
  4600. }
  4601. function lineStart() {
  4602. clipStream.point = linePoint;
  4603. if (polygon)
  4604. polygon.push(ring = []);
  4605. first = true;
  4606. v_ = false;
  4607. x_ = y_ = NaN;
  4608. }
  4609. function lineEnd() {
  4610. if (segments) {
  4611. linePoint(x__, y__);
  4612. if (v__ && v_)
  4613. bufferStream.rejoin();
  4614. segments.push(bufferStream.result());
  4615. }
  4616. clipStream.point = point;
  4617. if (v_)
  4618. activeStream.lineEnd();
  4619. }
  4620. function linePoint(x, y) {
  4621. var v = visible(x, y);
  4622. if (polygon)
  4623. ring.push([x, y]);
  4624. if (first) {
  4625. x__ = x, y__ = y, v__ = v;
  4626. first = false;
  4627. if (v) {
  4628. activeStream.lineStart();
  4629. activeStream.point(x, y);
  4630. }
  4631. } else {
  4632. if (v && v_)
  4633. activeStream.point(x, y);
  4634. else {
  4635. var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];
  4636. if (line_default(a, b, x0, y0, x1, y1)) {
  4637. if (!v_) {
  4638. activeStream.lineStart();
  4639. activeStream.point(a[0], a[1]);
  4640. }
  4641. activeStream.point(b[0], b[1]);
  4642. if (!v)
  4643. activeStream.lineEnd();
  4644. clean = false;
  4645. } else if (v) {
  4646. activeStream.lineStart();
  4647. activeStream.point(x, y);
  4648. clean = false;
  4649. }
  4650. }
  4651. }
  4652. x_ = x, y_ = y, v_ = v;
  4653. }
  4654. return clipStream;
  4655. };
  4656. }
  4657. // node_modules/d3-geo/src/identity.js
  4658. var identity_default3 = (x) => x;
  4659. // node_modules/d3-geo/src/path/area.js
  4660. var areaSum = new Adder;
  4661. var areaRingSum = new Adder;
  4662. var x00;
  4663. var y00;
  4664. var x0;
  4665. var y0;
  4666. var areaStream = {
  4667. point: noop2,
  4668. lineStart: noop2,
  4669. lineEnd: noop2,
  4670. polygonStart: function() {
  4671. areaStream.lineStart = areaRingStart;
  4672. areaStream.lineEnd = areaRingEnd;
  4673. },
  4674. polygonEnd: function() {
  4675. areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop2;
  4676. areaSum.add(abs(areaRingSum));
  4677. areaRingSum = new Adder;
  4678. },
  4679. result: function() {
  4680. var area = areaSum / 2;
  4681. areaSum = new Adder;
  4682. return area;
  4683. }
  4684. };
  4685. function areaRingStart() {
  4686. areaStream.point = areaPointFirst;
  4687. }
  4688. function areaPointFirst(x, y) {
  4689. areaStream.point = areaPoint;
  4690. x00 = x0 = x, y00 = y0 = y;
  4691. }
  4692. function areaPoint(x, y) {
  4693. areaRingSum.add(y0 * x - x0 * y);
  4694. x0 = x, y0 = y;
  4695. }
  4696. function areaRingEnd() {
  4697. areaPoint(x00, y00);
  4698. }
  4699. var area_default = areaStream;
  4700. // node_modules/d3-geo/src/path/bounds.js
  4701. var x02 = Infinity;
  4702. var y02 = x02;
  4703. var x1 = -x02;
  4704. var y1 = x1;
  4705. var boundsStream = {
  4706. point: boundsPoint,
  4707. lineStart: noop2,
  4708. lineEnd: noop2,
  4709. polygonStart: noop2,
  4710. polygonEnd: noop2,
  4711. result: function() {
  4712. var bounds = [[x02, y02], [x1, y1]];
  4713. x1 = y1 = -(y02 = x02 = Infinity);
  4714. return bounds;
  4715. }
  4716. };
  4717. function boundsPoint(x, y) {
  4718. if (x < x02)
  4719. x02 = x;
  4720. if (x > x1)
  4721. x1 = x;
  4722. if (y < y02)
  4723. y02 = y;
  4724. if (y > y1)
  4725. y1 = y;
  4726. }
  4727. var bounds_default = boundsStream;
  4728. // node_modules/d3-geo/src/path/centroid.js
  4729. var X0 = 0;
  4730. var Y0 = 0;
  4731. var Z0 = 0;
  4732. var X1 = 0;
  4733. var Y1 = 0;
  4734. var Z1 = 0;
  4735. var X2 = 0;
  4736. var Y2 = 0;
  4737. var Z2 = 0;
  4738. var x002;
  4739. var y002;
  4740. var x03;
  4741. var y03;
  4742. var centroidStream = {
  4743. point: centroidPoint,
  4744. lineStart: centroidLineStart,
  4745. lineEnd: centroidLineEnd,
  4746. polygonStart: function() {
  4747. centroidStream.lineStart = centroidRingStart;
  4748. centroidStream.lineEnd = centroidRingEnd;
  4749. },
  4750. polygonEnd: function() {
  4751. centroidStream.point = centroidPoint;
  4752. centroidStream.lineStart = centroidLineStart;
  4753. centroidStream.lineEnd = centroidLineEnd;
  4754. },
  4755. result: function() {
  4756. var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
  4757. X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
  4758. return centroid;
  4759. }
  4760. };
  4761. function centroidPoint(x, y) {
  4762. X0 += x;
  4763. Y0 += y;
  4764. ++Z0;
  4765. }
  4766. function centroidLineStart() {
  4767. centroidStream.point = centroidPointFirstLine;
  4768. }
  4769. function centroidPointFirstLine(x, y) {
  4770. centroidStream.point = centroidPointLine;
  4771. centroidPoint(x03 = x, y03 = y);
  4772. }
  4773. function centroidPointLine(x, y) {
  4774. var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
  4775. X1 += z * (x03 + x) / 2;
  4776. Y1 += z * (y03 + y) / 2;
  4777. Z1 += z;
  4778. centroidPoint(x03 = x, y03 = y);
  4779. }
  4780. function centroidLineEnd() {
  4781. centroidStream.point = centroidPoint;
  4782. }
  4783. function centroidRingStart() {
  4784. centroidStream.point = centroidPointFirstRing;
  4785. }
  4786. function centroidRingEnd() {
  4787. centroidPointRing(x002, y002);
  4788. }
  4789. function centroidPointFirstRing(x, y) {
  4790. centroidStream.point = centroidPointRing;
  4791. centroidPoint(x002 = x03 = x, y002 = y03 = y);
  4792. }
  4793. function centroidPointRing(x, y) {
  4794. var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
  4795. X1 += z * (x03 + x) / 2;
  4796. Y1 += z * (y03 + y) / 2;
  4797. Z1 += z;
  4798. z = y03 * x - x03 * y;
  4799. X2 += z * (x03 + x);
  4800. Y2 += z * (y03 + y);
  4801. Z2 += z * 3;
  4802. centroidPoint(x03 = x, y03 = y);
  4803. }
  4804. var centroid_default = centroidStream;
  4805. // node_modules/d3-geo/src/path/context.js
  4806. function PathContext(context) {
  4807. this._context = context;
  4808. }
  4809. PathContext.prototype = {
  4810. _radius: 4.5,
  4811. pointRadius: function(_) {
  4812. return this._radius = _, this;
  4813. },
  4814. polygonStart: function() {
  4815. this._line = 0;
  4816. },
  4817. polygonEnd: function() {
  4818. this._line = NaN;
  4819. },
  4820. lineStart: function() {
  4821. this._point = 0;
  4822. },
  4823. lineEnd: function() {
  4824. if (this._line === 0)
  4825. this._context.closePath();
  4826. this._point = NaN;
  4827. },
  4828. point: function(x, y) {
  4829. switch (this._point) {
  4830. case 0: {
  4831. this._context.moveTo(x, y);
  4832. this._point = 1;
  4833. break;
  4834. }
  4835. case 1: {
  4836. this._context.lineTo(x, y);
  4837. break;
  4838. }
  4839. default: {
  4840. this._context.moveTo(x + this._radius, y);
  4841. this._context.arc(x, y, this._radius, 0, tau2);
  4842. break;
  4843. }
  4844. }
  4845. },
  4846. result: noop2
  4847. };
  4848. // node_modules/d3-geo/src/path/measure.js
  4849. var lengthSum = new Adder;
  4850. var lengthRing;
  4851. var x003;
  4852. var y003;
  4853. var x04;
  4854. var y04;
  4855. var lengthStream = {
  4856. point: noop2,
  4857. lineStart: function() {
  4858. lengthStream.point = lengthPointFirst;
  4859. },
  4860. lineEnd: function() {
  4861. if (lengthRing)
  4862. lengthPoint(x003, y003);
  4863. lengthStream.point = noop2;
  4864. },
  4865. polygonStart: function() {
  4866. lengthRing = true;
  4867. },
  4868. polygonEnd: function() {
  4869. lengthRing = null;
  4870. },
  4871. result: function() {
  4872. var length2 = +lengthSum;
  4873. lengthSum = new Adder;
  4874. return length2;
  4875. }
  4876. };
  4877. function lengthPointFirst(x, y) {
  4878. lengthStream.point = lengthPoint;
  4879. x003 = x04 = x, y003 = y04 = y;
  4880. }
  4881. function lengthPoint(x, y) {
  4882. x04 -= x, y04 -= y;
  4883. lengthSum.add(sqrt(x04 * x04 + y04 * y04));
  4884. x04 = x, y04 = y;
  4885. }
  4886. var measure_default = lengthStream;
  4887. // node_modules/d3-geo/src/path/string.js
  4888. var cacheDigits;
  4889. var cacheAppend;
  4890. var cacheRadius;
  4891. var cacheCircle;
  4892. class PathString {
  4893. constructor(digits) {
  4894. this._append = digits == null ? append2 : appendRound2(digits);
  4895. this._radius = 4.5;
  4896. this._ = "";
  4897. }
  4898. pointRadius(_) {
  4899. this._radius = +_;
  4900. return this;
  4901. }
  4902. polygonStart() {
  4903. this._line = 0;
  4904. }
  4905. polygonEnd() {
  4906. this._line = NaN;
  4907. }
  4908. lineStart() {
  4909. this._point = 0;
  4910. }
  4911. lineEnd() {
  4912. if (this._line === 0)
  4913. this._ += "Z";
  4914. this._point = NaN;
  4915. }
  4916. point(x, y) {
  4917. switch (this._point) {
  4918. case 0: {
  4919. this._append`M${x},${y}`;
  4920. this._point = 1;
  4921. break;
  4922. }
  4923. case 1: {
  4924. this._append`L${x},${y}`;
  4925. break;
  4926. }
  4927. default: {
  4928. this._append`M${x},${y}`;
  4929. if (this._radius !== cacheRadius || this._append !== cacheAppend) {
  4930. const r = this._radius;
  4931. const s = this._;
  4932. this._ = "";
  4933. this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;
  4934. cacheRadius = r;
  4935. cacheAppend = this._append;
  4936. cacheCircle = this._;
  4937. this._ = s;
  4938. }
  4939. this._ += cacheCircle;
  4940. break;
  4941. }
  4942. }
  4943. }
  4944. result() {
  4945. const result = this._;
  4946. this._ = "";
  4947. return result.length ? result : null;
  4948. }
  4949. }
  4950. function append2(strings) {
  4951. let i = 1;
  4952. this._ += strings[0];
  4953. for (const j = strings.length;i < j; ++i) {
  4954. this._ += arguments[i] + strings[i];
  4955. }
  4956. }
  4957. function appendRound2(digits) {
  4958. const d = Math.floor(digits);
  4959. if (!(d >= 0))
  4960. throw new RangeError(`invalid digits: ${digits}`);
  4961. if (d > 15)
  4962. return append2;
  4963. if (d !== cacheDigits) {
  4964. const k = 10 ** d;
  4965. cacheDigits = d;
  4966. cacheAppend = function append3(strings) {
  4967. let i = 1;
  4968. this._ += strings[0];
  4969. for (const j = strings.length;i < j; ++i) {
  4970. this._ += Math.round(arguments[i] * k) / k + strings[i];
  4971. }
  4972. };
  4973. }
  4974. return cacheAppend;
  4975. }
  4976. // node_modules/d3-geo/src/path/index.js
  4977. function path_default(projection, context) {
  4978. let digits = 3, pointRadius = 4.5, projectionStream, contextStream;
  4979. function path2(object) {
  4980. if (object) {
  4981. if (typeof pointRadius === "function")
  4982. contextStream.pointRadius(+pointRadius.apply(this, arguments));
  4983. stream_default(object, projectionStream(contextStream));
  4984. }
  4985. return contextStream.result();
  4986. }
  4987. path2.area = function(object) {
  4988. stream_default(object, projectionStream(area_default));
  4989. return area_default.result();
  4990. };
  4991. path2.measure = function(object) {
  4992. stream_default(object, projectionStream(measure_default));
  4993. return measure_default.result();
  4994. };
  4995. path2.bounds = function(object) {
  4996. stream_default(object, projectionStream(bounds_default));
  4997. return bounds_default.result();
  4998. };
  4999. path2.centroid = function(object) {
  5000. stream_default(object, projectionStream(centroid_default));
  5001. return centroid_default.result();
  5002. };
  5003. path2.projection = function(_) {
  5004. if (!arguments.length)
  5005. return projection;
  5006. projectionStream = _ == null ? (projection = null, identity_default3) : (projection = _).stream;
  5007. return path2;
  5008. };
  5009. path2.context = function(_) {
  5010. if (!arguments.length)
  5011. return context;
  5012. contextStream = _ == null ? (context = null, new PathString(digits)) : new PathContext(context = _);
  5013. if (typeof pointRadius !== "function")
  5014. contextStream.pointRadius(pointRadius);
  5015. return path2;
  5016. };
  5017. path2.pointRadius = function(_) {
  5018. if (!arguments.length)
  5019. return pointRadius;
  5020. pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
  5021. return path2;
  5022. };
  5023. path2.digits = function(_) {
  5024. if (!arguments.length)
  5025. return digits;
  5026. if (_ == null)
  5027. digits = null;
  5028. else {
  5029. const d = Math.floor(_);
  5030. if (!(d >= 0))
  5031. throw new RangeError(`invalid digits: ${_}`);
  5032. digits = d;
  5033. }
  5034. if (context === null)
  5035. contextStream = new PathString(digits);
  5036. return path2;
  5037. };
  5038. return path2.projection(projection).digits(digits).context(context);
  5039. }
  5040. // node_modules/d3-geo/src/transform.js
  5041. function transform_default(methods) {
  5042. return {
  5043. stream: transformer(methods)
  5044. };
  5045. }
  5046. function transformer(methods) {
  5047. return function(stream) {
  5048. var s = new TransformStream;
  5049. for (var key in methods)
  5050. s[key] = methods[key];
  5051. s.stream = stream;
  5052. return s;
  5053. };
  5054. }
  5055. function TransformStream() {}
  5056. TransformStream.prototype = {
  5057. constructor: TransformStream,
  5058. point: function(x, y) {
  5059. this.stream.point(x, y);
  5060. },
  5061. sphere: function() {
  5062. this.stream.sphere();
  5063. },
  5064. lineStart: function() {
  5065. this.stream.lineStart();
  5066. },
  5067. lineEnd: function() {
  5068. this.stream.lineEnd();
  5069. },
  5070. polygonStart: function() {
  5071. this.stream.polygonStart();
  5072. },
  5073. polygonEnd: function() {
  5074. this.stream.polygonEnd();
  5075. }
  5076. };
  5077. // node_modules/d3-geo/src/projection/fit.js
  5078. function fit(projection, fitBounds, object) {
  5079. var clip = projection.clipExtent && projection.clipExtent();
  5080. projection.scale(150).translate([0, 0]);
  5081. if (clip != null)
  5082. projection.clipExtent(null);
  5083. stream_default(object, projection.stream(bounds_default));
  5084. fitBounds(bounds_default.result());
  5085. if (clip != null)
  5086. projection.clipExtent(clip);
  5087. return projection;
  5088. }
  5089. function fitExtent(projection, extent2, object) {
  5090. return fit(projection, function(b) {
  5091. var w = extent2[1][0] - extent2[0][0], h = extent2[1][1] - extent2[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent2[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent2[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
  5092. projection.scale(150 * k).translate([x, y]);
  5093. }, object);
  5094. }
  5095. function fitSize(projection, size, object) {
  5096. return fitExtent(projection, [[0, 0], size], object);
  5097. }
  5098. function fitWidth(projection, width, object) {
  5099. return fit(projection, function(b) {
  5100. var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1];
  5101. projection.scale(150 * k).translate([x, y]);
  5102. }, object);
  5103. }
  5104. function fitHeight(projection, height, object) {
  5105. return fit(projection, function(b) {
  5106. var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2;
  5107. projection.scale(150 * k).translate([x, y]);
  5108. }, object);
  5109. }
  5110. // node_modules/d3-geo/src/projection/resample.js
  5111. var maxDepth = 16;
  5112. var cosMinDistance = cos(30 * radians2);
  5113. function resample_default(project, delta2) {
  5114. return +delta2 ? resample(project, delta2) : resampleNone(project);
  5115. }
  5116. function resampleNone(project) {
  5117. return transformer({
  5118. point: function(x, y) {
  5119. x = project(x, y);
  5120. this.stream.point(x[0], x[1]);
  5121. }
  5122. });
  5123. }
  5124. function resample(project, delta2) {
  5125. function resampleLineTo(x05, y05, lambda0, a0, b0, c0, x12, y12, lambda1, a1, b1, c1, depth, stream) {
  5126. var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
  5127. if (d2 > 4 * delta2 && depth--) {
  5128. var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = sqrt(a * a + b * b + c * c), phi2 = asin(c /= m), lambda2 = abs(abs(c) - 1) < epsilon3 || abs(lambda0 - lambda1) < epsilon3 ? (lambda0 + lambda1) / 2 : atan2(b, a), p = project(lambda2, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x05, dy2 = y2 - y05, dz = dy * dx2 - dx * dy2;
  5129. if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
  5130. resampleLineTo(x05, y05, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);
  5131. stream.point(x2, y2);
  5132. resampleLineTo(x2, y2, lambda2, a, b, c, x12, y12, lambda1, a1, b1, c1, depth, stream);
  5133. }
  5134. }
  5135. }
  5136. return function(stream) {
  5137. var lambda00, x004, y004, a00, b00, c00, lambda0, x05, y05, a0, b0, c0;
  5138. var resampleStream = {
  5139. point,
  5140. lineStart,
  5141. lineEnd,
  5142. polygonStart: function() {
  5143. stream.polygonStart();
  5144. resampleStream.lineStart = ringStart;
  5145. },
  5146. polygonEnd: function() {
  5147. stream.polygonEnd();
  5148. resampleStream.lineStart = lineStart;
  5149. }
  5150. };
  5151. function point(x, y) {
  5152. x = project(x, y);
  5153. stream.point(x[0], x[1]);
  5154. }
  5155. function lineStart() {
  5156. x05 = NaN;
  5157. resampleStream.point = linePoint;
  5158. stream.lineStart();
  5159. }
  5160. function linePoint(lambda, phi) {
  5161. var c = cartesian([lambda, phi]), p = project(lambda, phi);
  5162. resampleLineTo(x05, y05, lambda0, a0, b0, c0, x05 = p[0], y05 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
  5163. stream.point(x05, y05);
  5164. }
  5165. function lineEnd() {
  5166. resampleStream.point = point;
  5167. stream.lineEnd();
  5168. }
  5169. function ringStart() {
  5170. lineStart();
  5171. resampleStream.point = ringPoint;
  5172. resampleStream.lineEnd = ringEnd;
  5173. }
  5174. function ringPoint(lambda, phi) {
  5175. linePoint(lambda00 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
  5176. resampleStream.point = linePoint;
  5177. }
  5178. function ringEnd() {
  5179. resampleLineTo(x05, y05, lambda0, a0, b0, c0, x004, y004, lambda00, a00, b00, c00, maxDepth, stream);
  5180. resampleStream.lineEnd = lineEnd;
  5181. lineEnd();
  5182. }
  5183. return resampleStream;
  5184. };
  5185. }
  5186. // node_modules/d3-geo/src/projection/index.js
  5187. var transformRadians = transformer({
  5188. point: function(x, y) {
  5189. this.stream.point(x * radians2, y * radians2);
  5190. }
  5191. });
  5192. function transformRotate(rotate) {
  5193. return transformer({
  5194. point: function(x, y) {
  5195. var r = rotate(x, y);
  5196. return this.stream.point(r[0], r[1]);
  5197. }
  5198. });
  5199. }
  5200. function scaleTranslate(k, dx, dy, sx, sy) {
  5201. function transform(x, y) {
  5202. x *= sx;
  5203. y *= sy;
  5204. return [dx + k * x, dy - k * y];
  5205. }
  5206. transform.invert = function(x, y) {
  5207. return [(x - dx) / k * sx, (dy - y) / k * sy];
  5208. };
  5209. return transform;
  5210. }
  5211. function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
  5212. if (!alpha)
  5213. return scaleTranslate(k, dx, dy, sx, sy);
  5214. var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k;
  5215. function transform(x, y) {
  5216. x *= sx;
  5217. y *= sy;
  5218. return [a * x - b * y + dx, dy - b * x - a * y];
  5219. }
  5220. transform.invert = function(x, y) {
  5221. return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];
  5222. };
  5223. return transform;
  5224. }
  5225. function projection(project) {
  5226. return projectionMutator(function() {
  5227. return project;
  5228. })();
  5229. }
  5230. function projectionMutator(projectAt) {
  5231. var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = antimeridian_default, x05 = null, y05, x12, y12, postclip = identity_default3, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;
  5232. function projection2(point) {
  5233. return projectRotateTransform(point[0] * radians2, point[1] * radians2);
  5234. }
  5235. function invert(point) {
  5236. point = projectRotateTransform.invert(point[0], point[1]);
  5237. return point && [point[0] * degrees3, point[1] * degrees3];
  5238. }
  5239. projection2.stream = function(stream) {
  5240. return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
  5241. };
  5242. projection2.preclip = function(_) {
  5243. return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;
  5244. };
  5245. projection2.postclip = function(_) {
  5246. return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
  5247. };
  5248. projection2.clipAngle = function(_) {
  5249. return arguments.length ? (preclip = +_ ? circle_default(theta = _ * radians2) : (theta = null, antimeridian_default), reset()) : theta * degrees3;
  5250. };
  5251. projection2.clipExtent = function(_) {
  5252. return arguments.length ? (postclip = _ == null ? (x05 = y05 = x12 = y12 = null, identity_default3) : clipRectangle(x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
  5253. };
  5254. projection2.scale = function(_) {
  5255. return arguments.length ? (k = +_, recenter()) : k;
  5256. };
  5257. projection2.translate = function(_) {
  5258. return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
  5259. };
  5260. projection2.center = function(_) {
  5261. return arguments.length ? (lambda = _[0] % 360 * radians2, phi = _[1] % 360 * radians2, recenter()) : [lambda * degrees3, phi * degrees3];
  5262. };
  5263. projection2.rotate = function(_) {
  5264. return arguments.length ? (deltaLambda = _[0] % 360 * radians2, deltaPhi = _[1] % 360 * radians2, deltaGamma = _.length > 2 ? _[2] % 360 * radians2 : 0, recenter()) : [deltaLambda * degrees3, deltaPhi * degrees3, deltaGamma * degrees3];
  5265. };
  5266. projection2.angle = function(_) {
  5267. return arguments.length ? (alpha = _ % 360 * radians2, recenter()) : alpha * degrees3;
  5268. };
  5269. projection2.reflectX = function(_) {
  5270. return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
  5271. };
  5272. projection2.reflectY = function(_) {
  5273. return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
  5274. };
  5275. projection2.precision = function(_) {
  5276. return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
  5277. };
  5278. projection2.fitExtent = function(extent2, object) {
  5279. return fitExtent(projection2, extent2, object);
  5280. };
  5281. projection2.fitSize = function(size, object) {
  5282. return fitSize(projection2, size, object);
  5283. };
  5284. projection2.fitWidth = function(width, object) {
  5285. return fitWidth(projection2, width, object);
  5286. };
  5287. projection2.fitHeight = function(height, object) {
  5288. return fitHeight(projection2, height, object);
  5289. };
  5290. function recenter() {
  5291. var center2 = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform = scaleTranslateRotate(k, x - center2[0], y - center2[1], sx, sy, alpha);
  5292. rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
  5293. projectTransform = compose_default(project, transform);
  5294. projectRotateTransform = compose_default(rotate, projectTransform);
  5295. projectResample = resample_default(projectTransform, delta2);
  5296. return reset();
  5297. }
  5298. function reset() {
  5299. cache = cacheStream = null;
  5300. return projection2;
  5301. }
  5302. return function() {
  5303. project = projectAt.apply(this, arguments);
  5304. projection2.invert = project.invert && invert;
  5305. return recenter();
  5306. };
  5307. }
  5308. // node_modules/d3-geo/src/projection/conic.js
  5309. function conicProjection(projectAt) {
  5310. var phi0 = 0, phi1 = pi2 / 3, m = projectionMutator(projectAt), p = m(phi0, phi1);
  5311. p.parallels = function(_) {
  5312. return arguments.length ? m(phi0 = _[0] * radians2, phi1 = _[1] * radians2) : [phi0 * degrees3, phi1 * degrees3];
  5313. };
  5314. return p;
  5315. }
  5316. // node_modules/d3-geo/src/projection/cylindricalEqualArea.js
  5317. function cylindricalEqualAreaRaw(phi0) {
  5318. var cosPhi0 = cos(phi0);
  5319. function forward(lambda, phi) {
  5320. return [lambda * cosPhi0, sin(phi) / cosPhi0];
  5321. }
  5322. forward.invert = function(x, y) {
  5323. return [x / cosPhi0, asin(y * cosPhi0)];
  5324. };
  5325. return forward;
  5326. }
  5327. // node_modules/d3-geo/src/projection/conicEqualArea.js
  5328. function conicEqualAreaRaw(y05, y12) {
  5329. var sy0 = sin(y05), n = (sy0 + sin(y12)) / 2;
  5330. if (abs(n) < epsilon3)
  5331. return cylindricalEqualAreaRaw(y05);
  5332. var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;
  5333. function project(x, y) {
  5334. var r = sqrt(c - 2 * n * sin(y)) / n;
  5335. return [r * sin(x *= n), r0 - r * cos(x)];
  5336. }
  5337. project.invert = function(x, y) {
  5338. var r0y = r0 - y, l = atan2(x, abs(r0y)) * sign(r0y);
  5339. if (r0y * n < 0)
  5340. l -= pi2 * sign(x) * sign(r0y);
  5341. return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];
  5342. };
  5343. return project;
  5344. }
  5345. function conicEqualArea_default() {
  5346. return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]);
  5347. }
  5348. // node_modules/d3-geo/src/projection/albers.js
  5349. function albers_default() {
  5350. return conicEqualArea_default().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]);
  5351. }
  5352. // node_modules/d3-geo/src/projection/albersUsa.js
  5353. function multiplex(streams) {
  5354. var n = streams.length;
  5355. return {
  5356. point: function(x, y) {
  5357. var i = -1;
  5358. while (++i < n)
  5359. streams[i].point(x, y);
  5360. },
  5361. sphere: function() {
  5362. var i = -1;
  5363. while (++i < n)
  5364. streams[i].sphere();
  5365. },
  5366. lineStart: function() {
  5367. var i = -1;
  5368. while (++i < n)
  5369. streams[i].lineStart();
  5370. },
  5371. lineEnd: function() {
  5372. var i = -1;
  5373. while (++i < n)
  5374. streams[i].lineEnd();
  5375. },
  5376. polygonStart: function() {
  5377. var i = -1;
  5378. while (++i < n)
  5379. streams[i].polygonStart();
  5380. },
  5381. polygonEnd: function() {
  5382. var i = -1;
  5383. while (++i < n)
  5384. streams[i].polygonEnd();
  5385. }
  5386. };
  5387. }
  5388. function albersUsa_default() {
  5389. var cache, cacheStream, lower48 = albers_default(), lower48Point, alaska = conicEqualArea_default().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, hawaii = conicEqualArea_default().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, point, pointStream = { point: function(x, y) {
  5390. point = [x, y];
  5391. } };
  5392. function albersUsa(coordinates) {
  5393. var x = coordinates[0], y = coordinates[1];
  5394. return point = null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point);
  5395. }
  5396. albersUsa.invert = function(coordinates) {
  5397. var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k;
  5398. return (y >= 0.12 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates);
  5399. };
  5400. albersUsa.stream = function(stream) {
  5401. return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);
  5402. };
  5403. albersUsa.precision = function(_) {
  5404. if (!arguments.length)
  5405. return lower48.precision();
  5406. lower48.precision(_), alaska.precision(_), hawaii.precision(_);
  5407. return reset();
  5408. };
  5409. albersUsa.scale = function(_) {
  5410. if (!arguments.length)
  5411. return lower48.scale();
  5412. lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);
  5413. return albersUsa.translate(lower48.translate());
  5414. };
  5415. albersUsa.translate = function(_) {
  5416. if (!arguments.length)
  5417. return lower48.translate();
  5418. var k = lower48.scale(), x = +_[0], y = +_[1];
  5419. lower48Point = lower48.translate(_).clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]).stream(pointStream);
  5420. alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon3, y + 0.12 * k + epsilon3], [x - 0.214 * k - epsilon3, y + 0.234 * k - epsilon3]]).stream(pointStream);
  5421. hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon3, y + 0.166 * k + epsilon3], [x - 0.115 * k - epsilon3, y + 0.234 * k - epsilon3]]).stream(pointStream);
  5422. return reset();
  5423. };
  5424. albersUsa.fitExtent = function(extent2, object) {
  5425. return fitExtent(albersUsa, extent2, object);
  5426. };
  5427. albersUsa.fitSize = function(size, object) {
  5428. return fitSize(albersUsa, size, object);
  5429. };
  5430. albersUsa.fitWidth = function(width, object) {
  5431. return fitWidth(albersUsa, width, object);
  5432. };
  5433. albersUsa.fitHeight = function(height, object) {
  5434. return fitHeight(albersUsa, height, object);
  5435. };
  5436. function reset() {
  5437. cache = cacheStream = null;
  5438. return albersUsa;
  5439. }
  5440. return albersUsa.scale(1070);
  5441. }
  5442. // node_modules/d3-geo/src/projection/azimuthal.js
  5443. function azimuthalRaw(scale) {
  5444. return function(x, y) {
  5445. var cx = cos(x), cy = cos(y), k = scale(cx * cy);
  5446. if (k === Infinity)
  5447. return [2, 0];
  5448. return [
  5449. k * cy * sin(x),
  5450. k * sin(y)
  5451. ];
  5452. };
  5453. }
  5454. function azimuthalInvert(angle) {
  5455. return function(x, y) {
  5456. var z = sqrt(x * x + y * y), c = angle(z), sc = sin(c), cc = cos(c);
  5457. return [
  5458. atan2(x * sc, z * cc),
  5459. asin(z && y * sc / z)
  5460. ];
  5461. };
  5462. }
  5463. // node_modules/d3-geo/src/projection/azimuthalEqualArea.js
  5464. var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {
  5465. return sqrt(2 / (1 + cxcy));
  5466. });
  5467. azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {
  5468. return 2 * asin(z / 2);
  5469. });
  5470. function azimuthalEqualArea_default() {
  5471. return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 0.001);
  5472. }
  5473. // node_modules/d3-geo/src/projection/azimuthalEquidistant.js
  5474. var azimuthalEquidistantRaw = azimuthalRaw(function(c) {
  5475. return (c = acos(c)) && c / sin(c);
  5476. });
  5477. azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {
  5478. return z;
  5479. });
  5480. function azimuthalEquidistant_default() {
  5481. return projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 0.001);
  5482. }
  5483. // node_modules/d3-geo/src/projection/mercator.js
  5484. function mercatorRaw(lambda, phi) {
  5485. return [lambda, log(tan((halfPi + phi) / 2))];
  5486. }
  5487. mercatorRaw.invert = function(x, y) {
  5488. return [x, 2 * atan(exp(y)) - halfPi];
  5489. };
  5490. function mercator_default() {
  5491. return mercatorProjection(mercatorRaw).scale(961 / tau2);
  5492. }
  5493. function mercatorProjection(project) {
  5494. var m = projection(project), center2 = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x05 = null, y05, x12, y12;
  5495. m.scale = function(_) {
  5496. return arguments.length ? (scale(_), reclip()) : scale();
  5497. };
  5498. m.translate = function(_) {
  5499. return arguments.length ? (translate(_), reclip()) : translate();
  5500. };
  5501. m.center = function(_) {
  5502. return arguments.length ? (center2(_), reclip()) : center2();
  5503. };
  5504. m.clipExtent = function(_) {
  5505. return arguments.length ? (_ == null ? x05 = y05 = x12 = y12 = null : (x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
  5506. };
  5507. function reclip() {
  5508. var k = pi2 * scale(), t = m(rotation_default(m.rotate()).invert([0, 0]));
  5509. return clipExtent(x05 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x05), y05], [Math.min(t[0] + k, x12), y12]] : [[x05, Math.max(t[1] - k, y05)], [x12, Math.min(t[1] + k, y12)]]);
  5510. }
  5511. return reclip();
  5512. }
  5513. // node_modules/d3-geo/src/projection/conicConformal.js
  5514. function tany(y) {
  5515. return tan((halfPi + y) / 2);
  5516. }
  5517. function conicConformalRaw(y05, y12) {
  5518. var cy0 = cos(y05), n = y05 === y12 ? sin(y05) : log(cy0 / cos(y12)) / log(tany(y12) / tany(y05)), f = cy0 * pow(tany(y05), n) / n;
  5519. if (!n)
  5520. return mercatorRaw;
  5521. function project(x, y) {
  5522. if (f > 0) {
  5523. if (y < -halfPi + epsilon3)
  5524. y = -halfPi + epsilon3;
  5525. } else {
  5526. if (y > halfPi - epsilon3)
  5527. y = halfPi - epsilon3;
  5528. }
  5529. var r = f / pow(tany(y), n);
  5530. return [r * sin(n * x), f - r * cos(n * x)];
  5531. }
  5532. project.invert = function(x, y) {
  5533. var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy), l = atan2(x, abs(fy)) * sign(fy);
  5534. if (fy * n < 0)
  5535. l -= pi2 * sign(x) * sign(fy);
  5536. return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi];
  5537. };
  5538. return project;
  5539. }
  5540. function conicConformal_default() {
  5541. return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]);
  5542. }
  5543. // node_modules/d3-geo/src/projection/equirectangular.js
  5544. function equirectangularRaw(lambda, phi) {
  5545. return [lambda, phi];
  5546. }
  5547. equirectangularRaw.invert = equirectangularRaw;
  5548. function equirectangular_default() {
  5549. return projection(equirectangularRaw).scale(152.63);
  5550. }
  5551. // node_modules/d3-geo/src/projection/conicEquidistant.js
  5552. function conicEquidistantRaw(y05, y12) {
  5553. var cy0 = cos(y05), n = y05 === y12 ? sin(y05) : (cy0 - cos(y12)) / (y12 - y05), g = cy0 / n + y05;
  5554. if (abs(n) < epsilon3)
  5555. return equirectangularRaw;
  5556. function project(x, y) {
  5557. var gy = g - y, nx = n * x;
  5558. return [gy * sin(nx), g - gy * cos(nx)];
  5559. }
  5560. project.invert = function(x, y) {
  5561. var gy = g - y, l = atan2(x, abs(gy)) * sign(gy);
  5562. if (gy * n < 0)
  5563. l -= pi2 * sign(x) * sign(gy);
  5564. return [l / n, g - sign(n) * sqrt(x * x + gy * gy)];
  5565. };
  5566. return project;
  5567. }
  5568. function conicEquidistant_default() {
  5569. return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]);
  5570. }
  5571. // node_modules/d3-geo/src/projection/equalEarth.js
  5572. var A1 = 1.340264;
  5573. var A2 = -0.081106;
  5574. var A3 = 0.000893;
  5575. var A4 = 0.003796;
  5576. var M = sqrt(3) / 2;
  5577. var iterations = 12;
  5578. function equalEarthRaw(lambda, phi) {
  5579. var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2;
  5580. return [
  5581. lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))),
  5582. l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))
  5583. ];
  5584. }
  5585. equalEarthRaw.invert = function(x, y) {
  5586. var l = y, l2 = l * l, l6 = l2 * l2 * l2;
  5587. for (var i = 0, delta, fy, fpy;i < iterations; ++i) {
  5588. fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;
  5589. fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);
  5590. l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;
  5591. if (abs(delta) < epsilon22)
  5592. break;
  5593. }
  5594. return [
  5595. M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l),
  5596. asin(sin(l) / M)
  5597. ];
  5598. };
  5599. function equalEarth_default() {
  5600. return projection(equalEarthRaw).scale(177.158);
  5601. }
  5602. // node_modules/d3-geo/src/projection/gnomonic.js
  5603. function gnomonicRaw(x, y) {
  5604. var cy = cos(y), k = cos(x) * cy;
  5605. return [cy * sin(x) / k, sin(y) / k];
  5606. }
  5607. gnomonicRaw.invert = azimuthalInvert(atan);
  5608. function gnomonic_default() {
  5609. return projection(gnomonicRaw).scale(144.049).clipAngle(60);
  5610. }
  5611. // node_modules/d3-geo/src/projection/orthographic.js
  5612. function orthographicRaw(x, y) {
  5613. return [cos(y) * sin(x), sin(y)];
  5614. }
  5615. orthographicRaw.invert = azimuthalInvert(asin);
  5616. function orthographic_default() {
  5617. return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon3);
  5618. }
  5619. // node_modules/d3-geo/src/projection/stereographic.js
  5620. function stereographicRaw(x, y) {
  5621. var cy = cos(y), k = 1 + cos(x) * cy;
  5622. return [cy * sin(x) / k, sin(y) / k];
  5623. }
  5624. stereographicRaw.invert = azimuthalInvert(function(z) {
  5625. return 2 * atan(z);
  5626. });
  5627. function stereographic_default() {
  5628. return projection(stereographicRaw).scale(250).clipAngle(142);
  5629. }
  5630. // node_modules/d3-geo/src/projection/transverseMercator.js
  5631. function transverseMercatorRaw(lambda, phi) {
  5632. return [log(tan((halfPi + phi) / 2)), -lambda];
  5633. }
  5634. transverseMercatorRaw.invert = function(x, y) {
  5635. return [-y, 2 * atan(exp(x)) - halfPi];
  5636. };
  5637. function transverseMercator_default() {
  5638. var m = mercatorProjection(transverseMercatorRaw), center2 = m.center, rotate = m.rotate;
  5639. m.center = function(_) {
  5640. return arguments.length ? center2([-_[1], _[0]]) : (_ = center2(), [_[1], -_[0]]);
  5641. };
  5642. m.rotate = function(_) {
  5643. return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);
  5644. };
  5645. return rotate([0, 0, 90]).scale(159.155);
  5646. }
  5647. // node_modules/d3-scale/src/init.js
  5648. function initRange(domain, range2) {
  5649. switch (arguments.length) {
  5650. case 0:
  5651. break;
  5652. case 1:
  5653. this.range(domain);
  5654. break;
  5655. default:
  5656. this.range(range2).domain(domain);
  5657. break;
  5658. }
  5659. return this;
  5660. }
  5661. function initInterpolator(domain, interpolator) {
  5662. switch (arguments.length) {
  5663. case 0:
  5664. break;
  5665. case 1: {
  5666. if (typeof domain === "function")
  5667. this.interpolator(domain);
  5668. else
  5669. this.range(domain);
  5670. break;
  5671. }
  5672. default: {
  5673. this.domain(domain);
  5674. if (typeof interpolator === "function")
  5675. this.interpolator(interpolator);
  5676. else
  5677. this.range(interpolator);
  5678. break;
  5679. }
  5680. }
  5681. return this;
  5682. }
  5683. // node_modules/d3-scale/src/ordinal.js
  5684. var implicit = Symbol("implicit");
  5685. function ordinal() {
  5686. var index2 = new InternMap, domain = [], range2 = [], unknown = implicit;
  5687. function scale(d) {
  5688. let i = index2.get(d);
  5689. if (i === undefined) {
  5690. if (unknown !== implicit)
  5691. return unknown;
  5692. index2.set(d, i = domain.push(d) - 1);
  5693. }
  5694. return range2[i % range2.length];
  5695. }
  5696. scale.domain = function(_) {
  5697. if (!arguments.length)
  5698. return domain.slice();
  5699. domain = [], index2 = new InternMap;
  5700. for (const value of _) {
  5701. if (index2.has(value))
  5702. continue;
  5703. index2.set(value, domain.push(value) - 1);
  5704. }
  5705. return scale;
  5706. };
  5707. scale.range = function(_) {
  5708. return arguments.length ? (range2 = Array.from(_), scale) : range2.slice();
  5709. };
  5710. scale.unknown = function(_) {
  5711. return arguments.length ? (unknown = _, scale) : unknown;
  5712. };
  5713. scale.copy = function() {
  5714. return ordinal(domain, range2).unknown(unknown);
  5715. };
  5716. initRange.apply(scale, arguments);
  5717. return scale;
  5718. }
  5719. // node_modules/d3-scale/src/band.js
  5720. function band() {
  5721. var scale = ordinal().unknown(undefined), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5;
  5722. delete scale.unknown;
  5723. function rescale() {
  5724. var n = domain().length, reverse2 = r1 < r0, start2 = reverse2 ? r1 : r0, stop = reverse2 ? r0 : r1;
  5725. step = (stop - start2) / Math.max(1, n - paddingInner + paddingOuter * 2);
  5726. if (round)
  5727. step = Math.floor(step);
  5728. start2 += (stop - start2 - step * (n - paddingInner)) * align;
  5729. bandwidth = step * (1 - paddingInner);
  5730. if (round)
  5731. start2 = Math.round(start2), bandwidth = Math.round(bandwidth);
  5732. var values = range(n).map(function(i) {
  5733. return start2 + step * i;
  5734. });
  5735. return ordinalRange(reverse2 ? values.reverse() : values);
  5736. }
  5737. scale.domain = function(_) {
  5738. return arguments.length ? (domain(_), rescale()) : domain();
  5739. };
  5740. scale.range = function(_) {
  5741. return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
  5742. };
  5743. scale.rangeRound = function(_) {
  5744. return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
  5745. };
  5746. scale.bandwidth = function() {
  5747. return bandwidth;
  5748. };
  5749. scale.step = function() {
  5750. return step;
  5751. };
  5752. scale.round = function(_) {
  5753. return arguments.length ? (round = !!_, rescale()) : round;
  5754. };
  5755. scale.padding = function(_) {
  5756. return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
  5757. };
  5758. scale.paddingInner = function(_) {
  5759. return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
  5760. };
  5761. scale.paddingOuter = function(_) {
  5762. return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
  5763. };
  5764. scale.align = function(_) {
  5765. return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
  5766. };
  5767. scale.copy = function() {
  5768. return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
  5769. };
  5770. return initRange.apply(rescale(), arguments);
  5771. }
  5772. function pointish(scale) {
  5773. var copy = scale.copy;
  5774. scale.padding = scale.paddingOuter;
  5775. delete scale.paddingInner;
  5776. delete scale.paddingOuter;
  5777. scale.copy = function() {
  5778. return pointish(copy());
  5779. };
  5780. return scale;
  5781. }
  5782. function point() {
  5783. return pointish(band.apply(null, arguments).paddingInner(1));
  5784. }
  5785. // node_modules/d3-scale/src/constant.js
  5786. function constants(x) {
  5787. return function() {
  5788. return x;
  5789. };
  5790. }
  5791. // node_modules/d3-scale/src/number.js
  5792. function number3(x) {
  5793. return +x;
  5794. }
  5795. // node_modules/d3-scale/src/continuous.js
  5796. var unit = [0, 1];
  5797. function identity3(x) {
  5798. return x;
  5799. }
  5800. function normalize(a, b) {
  5801. return (b -= a = +a) ? function(x) {
  5802. return (x - a) / b;
  5803. } : constants(isNaN(b) ? NaN : 0.5);
  5804. }
  5805. function clamper(a, b) {
  5806. var t;
  5807. if (a > b)
  5808. t = a, a = b, b = t;
  5809. return function(x) {
  5810. return Math.max(a, Math.min(b, x));
  5811. };
  5812. }
  5813. function bimap(domain, range2, interpolate) {
  5814. var d0 = domain[0], d1 = domain[1], r0 = range2[0], r1 = range2[1];
  5815. if (d1 < d0)
  5816. d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
  5817. else
  5818. d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
  5819. return function(x) {
  5820. return r0(d0(x));
  5821. };
  5822. }
  5823. function polymap(domain, range2, interpolate) {
  5824. var j = Math.min(domain.length, range2.length) - 1, d = new Array(j), r = new Array(j), i = -1;
  5825. if (domain[j] < domain[0]) {
  5826. domain = domain.slice().reverse();
  5827. range2 = range2.slice().reverse();
  5828. }
  5829. while (++i < j) {
  5830. d[i] = normalize(domain[i], domain[i + 1]);
  5831. r[i] = interpolate(range2[i], range2[i + 1]);
  5832. }
  5833. return function(x) {
  5834. var i2 = bisect_default(domain, x, 1, j) - 1;
  5835. return r[i2](d[i2](x));
  5836. };
  5837. }
  5838. function copy(source, target) {
  5839. return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
  5840. }
  5841. function transformer2() {
  5842. var domain = unit, range2 = unit, interpolate = value_default, transform, untransform, unknown, clamp = identity3, piecewise2, output, input;
  5843. function rescale() {
  5844. var n = Math.min(domain.length, range2.length);
  5845. if (clamp !== identity3)
  5846. clamp = clamper(domain[0], domain[n - 1]);
  5847. piecewise2 = n > 2 ? polymap : bimap;
  5848. output = input = null;
  5849. return scale;
  5850. }
  5851. function scale(x) {
  5852. return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise2(domain.map(transform), range2, interpolate)))(transform(clamp(x)));
  5853. }
  5854. scale.invert = function(y) {
  5855. return clamp(untransform((input || (input = piecewise2(range2, domain.map(transform), number_default)))(y)));
  5856. };
  5857. scale.domain = function(_) {
  5858. return arguments.length ? (domain = Array.from(_, number3), rescale()) : domain.slice();
  5859. };
  5860. scale.range = function(_) {
  5861. return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice();
  5862. };
  5863. scale.rangeRound = function(_) {
  5864. return range2 = Array.from(_), interpolate = round_default, rescale();
  5865. };
  5866. scale.clamp = function(_) {
  5867. return arguments.length ? (clamp = _ ? true : identity3, rescale()) : clamp !== identity3;
  5868. };
  5869. scale.interpolate = function(_) {
  5870. return arguments.length ? (interpolate = _, rescale()) : interpolate;
  5871. };
  5872. scale.unknown = function(_) {
  5873. return arguments.length ? (unknown = _, scale) : unknown;
  5874. };
  5875. return function(t, u) {
  5876. transform = t, untransform = u;
  5877. return rescale();
  5878. };
  5879. }
  5880. function continuous() {
  5881. return transformer2()(identity3, identity3);
  5882. }
  5883. // node_modules/d3-scale/src/tickFormat.js
  5884. function tickFormat(start2, stop, count, specifier) {
  5885. var step = tickStep(start2, stop, count), precision;
  5886. specifier = formatSpecifier(specifier == null ? ",f" : specifier);
  5887. switch (specifier.type) {
  5888. case "s": {
  5889. var value = Math.max(Math.abs(start2), Math.abs(stop));
  5890. if (specifier.precision == null && !isNaN(precision = precisionPrefix_default(step, value)))
  5891. specifier.precision = precision;
  5892. return formatPrefix(specifier, value);
  5893. }
  5894. case "":
  5895. case "e":
  5896. case "g":
  5897. case "p":
  5898. case "r": {
  5899. if (specifier.precision == null && !isNaN(precision = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
  5900. specifier.precision = precision - (specifier.type === "e");
  5901. break;
  5902. }
  5903. case "f":
  5904. case "%": {
  5905. if (specifier.precision == null && !isNaN(precision = precisionFixed_default(step)))
  5906. specifier.precision = precision - (specifier.type === "%") * 2;
  5907. break;
  5908. }
  5909. }
  5910. return format(specifier);
  5911. }
  5912. // node_modules/d3-scale/src/linear.js
  5913. function linearish(scale) {
  5914. var domain = scale.domain;
  5915. scale.ticks = function(count) {
  5916. var d = domain();
  5917. return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
  5918. };
  5919. scale.tickFormat = function(count, specifier) {
  5920. var d = domain();
  5921. return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
  5922. };
  5923. scale.nice = function(count) {
  5924. if (count == null)
  5925. count = 10;
  5926. var d = domain();
  5927. var i0 = 0;
  5928. var i1 = d.length - 1;
  5929. var start2 = d[i0];
  5930. var stop = d[i1];
  5931. var prestep;
  5932. var step;
  5933. var maxIter = 10;
  5934. if (stop < start2) {
  5935. step = start2, start2 = stop, stop = step;
  5936. step = i0, i0 = i1, i1 = step;
  5937. }
  5938. while (maxIter-- > 0) {
  5939. step = tickIncrement(start2, stop, count);
  5940. if (step === prestep) {
  5941. d[i0] = start2;
  5942. d[i1] = stop;
  5943. return domain(d);
  5944. } else if (step > 0) {
  5945. start2 = Math.floor(start2 / step) * step;
  5946. stop = Math.ceil(stop / step) * step;
  5947. } else if (step < 0) {
  5948. start2 = Math.ceil(start2 * step) / step;
  5949. stop = Math.floor(stop * step) / step;
  5950. } else {
  5951. break;
  5952. }
  5953. prestep = step;
  5954. }
  5955. return scale;
  5956. };
  5957. return scale;
  5958. }
  5959. function linear2() {
  5960. var scale = continuous();
  5961. scale.copy = function() {
  5962. return copy(scale, linear2());
  5963. };
  5964. initRange.apply(scale, arguments);
  5965. return linearish(scale);
  5966. }
  5967. // node_modules/d3-scale/src/identity.js
  5968. function identity4(domain) {
  5969. var unknown;
  5970. function scale(x) {
  5971. return x == null || isNaN(x = +x) ? unknown : x;
  5972. }
  5973. scale.invert = scale;
  5974. scale.domain = scale.range = function(_) {
  5975. return arguments.length ? (domain = Array.from(_, number3), scale) : domain.slice();
  5976. };
  5977. scale.unknown = function(_) {
  5978. return arguments.length ? (unknown = _, scale) : unknown;
  5979. };
  5980. scale.copy = function() {
  5981. return identity4(domain).unknown(unknown);
  5982. };
  5983. domain = arguments.length ? Array.from(domain, number3) : [0, 1];
  5984. return linearish(scale);
  5985. }
  5986. // node_modules/d3-scale/src/nice.js
  5987. function nice(domain, interval2) {
  5988. domain = domain.slice();
  5989. var i0 = 0, i1 = domain.length - 1, x05 = domain[i0], x12 = domain[i1], t;
  5990. if (x12 < x05) {
  5991. t = i0, i0 = i1, i1 = t;
  5992. t = x05, x05 = x12, x12 = t;
  5993. }
  5994. domain[i0] = interval2.floor(x05);
  5995. domain[i1] = interval2.ceil(x12);
  5996. return domain;
  5997. }
  5998. // node_modules/d3-scale/src/log.js
  5999. function transformLog(x) {
  6000. return Math.log(x);
  6001. }
  6002. function transformExp(x) {
  6003. return Math.exp(x);
  6004. }
  6005. function transformLogn(x) {
  6006. return -Math.log(-x);
  6007. }
  6008. function transformExpn(x) {
  6009. return -Math.exp(-x);
  6010. }
  6011. function pow10(x) {
  6012. return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
  6013. }
  6014. function powp(base) {
  6015. return base === 10 ? pow10 : base === Math.E ? Math.exp : (x) => Math.pow(base, x);
  6016. }
  6017. function logp(base) {
  6018. return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), (x) => Math.log(x) / base);
  6019. }
  6020. function reflect(f) {
  6021. return (x, k) => -f(-x, k);
  6022. }
  6023. function loggish(transform) {
  6024. const scale = transform(transformLog, transformExp);
  6025. const domain = scale.domain;
  6026. let base = 10;
  6027. let logs;
  6028. let pows;
  6029. function rescale() {
  6030. logs = logp(base), pows = powp(base);
  6031. if (domain()[0] < 0) {
  6032. logs = reflect(logs), pows = reflect(pows);
  6033. transform(transformLogn, transformExpn);
  6034. } else {
  6035. transform(transformLog, transformExp);
  6036. }
  6037. return scale;
  6038. }
  6039. scale.base = function(_) {
  6040. return arguments.length ? (base = +_, rescale()) : base;
  6041. };
  6042. scale.domain = function(_) {
  6043. return arguments.length ? (domain(_), rescale()) : domain();
  6044. };
  6045. scale.ticks = (count) => {
  6046. const d = domain();
  6047. let u = d[0];
  6048. let v = d[d.length - 1];
  6049. const r = v < u;
  6050. if (r)
  6051. [u, v] = [v, u];
  6052. let i = logs(u);
  6053. let j = logs(v);
  6054. let k;
  6055. let t;
  6056. const n = count == null ? 10 : +count;
  6057. let z = [];
  6058. if (!(base % 1) && j - i < n) {
  6059. i = Math.floor(i), j = Math.ceil(j);
  6060. if (u > 0)
  6061. for (;i <= j; ++i) {
  6062. for (k = 1;k < base; ++k) {
  6063. t = i < 0 ? k / pows(-i) : k * pows(i);
  6064. if (t < u)
  6065. continue;
  6066. if (t > v)
  6067. break;
  6068. z.push(t);
  6069. }
  6070. }
  6071. else
  6072. for (;i <= j; ++i) {
  6073. for (k = base - 1;k >= 1; --k) {
  6074. t = i > 0 ? k / pows(-i) : k * pows(i);
  6075. if (t < u)
  6076. continue;
  6077. if (t > v)
  6078. break;
  6079. z.push(t);
  6080. }
  6081. }
  6082. if (z.length * 2 < n)
  6083. z = ticks(u, v, n);
  6084. } else {
  6085. z = ticks(i, j, Math.min(j - i, n)).map(pows);
  6086. }
  6087. return r ? z.reverse() : z;
  6088. };
  6089. scale.tickFormat = (count, specifier) => {
  6090. if (count == null)
  6091. count = 10;
  6092. if (specifier == null)
  6093. specifier = base === 10 ? "s" : ",";
  6094. if (typeof specifier !== "function") {
  6095. if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null)
  6096. specifier.trim = true;
  6097. specifier = format(specifier);
  6098. }
  6099. if (count === Infinity)
  6100. return specifier;
  6101. const k = Math.max(1, base * count / scale.ticks().length);
  6102. return (d) => {
  6103. let i = d / pows(Math.round(logs(d)));
  6104. if (i * base < base - 0.5)
  6105. i *= base;
  6106. return i <= k ? specifier(d) : "";
  6107. };
  6108. };
  6109. scale.nice = () => {
  6110. return domain(nice(domain(), {
  6111. floor: (x) => pows(Math.floor(logs(x))),
  6112. ceil: (x) => pows(Math.ceil(logs(x)))
  6113. }));
  6114. };
  6115. return scale;
  6116. }
  6117. function log2() {
  6118. const scale = loggish(transformer2()).domain([1, 10]);
  6119. scale.copy = () => copy(scale, log2()).base(scale.base());
  6120. initRange.apply(scale, arguments);
  6121. return scale;
  6122. }
  6123. // node_modules/d3-scale/src/symlog.js
  6124. function transformSymlog(c) {
  6125. return function(x) {
  6126. return Math.sign(x) * Math.log1p(Math.abs(x / c));
  6127. };
  6128. }
  6129. function transformSymexp(c) {
  6130. return function(x) {
  6131. return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
  6132. };
  6133. }
  6134. function symlogish(transform) {
  6135. var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));
  6136. scale.constant = function(_) {
  6137. return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;
  6138. };
  6139. return linearish(scale);
  6140. }
  6141. function symlog() {
  6142. var scale = symlogish(transformer2());
  6143. scale.copy = function() {
  6144. return copy(scale, symlog()).constant(scale.constant());
  6145. };
  6146. return initRange.apply(scale, arguments);
  6147. }
  6148. // node_modules/d3-scale/src/pow.js
  6149. function transformPow(exponent) {
  6150. return function(x) {
  6151. return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
  6152. };
  6153. }
  6154. function transformSqrt(x) {
  6155. return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
  6156. }
  6157. function transformSquare(x) {
  6158. return x < 0 ? -x * x : x * x;
  6159. }
  6160. function powish(transform) {
  6161. var scale = transform(identity3, identity3), exponent = 1;
  6162. function rescale() {
  6163. return exponent === 1 ? transform(identity3, identity3) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent));
  6164. }
  6165. scale.exponent = function(_) {
  6166. return arguments.length ? (exponent = +_, rescale()) : exponent;
  6167. };
  6168. return linearish(scale);
  6169. }
  6170. function pow2() {
  6171. var scale = powish(transformer2());
  6172. scale.copy = function() {
  6173. return copy(scale, pow2()).exponent(scale.exponent());
  6174. };
  6175. initRange.apply(scale, arguments);
  6176. return scale;
  6177. }
  6178. // node_modules/d3-scale/src/quantile.js
  6179. function quantile2() {
  6180. var domain = [], range2 = [], thresholds = [], unknown;
  6181. function rescale() {
  6182. var i = 0, n = Math.max(1, range2.length);
  6183. thresholds = new Array(n - 1);
  6184. while (++i < n)
  6185. thresholds[i - 1] = quantileSorted(domain, i / n);
  6186. return scale;
  6187. }
  6188. function scale(x) {
  6189. return x == null || isNaN(x = +x) ? unknown : range2[bisect_default(thresholds, x)];
  6190. }
  6191. scale.invertExtent = function(y) {
  6192. var i = range2.indexOf(y);
  6193. return i < 0 ? [NaN, NaN] : [
  6194. i > 0 ? thresholds[i - 1] : domain[0],
  6195. i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
  6196. ];
  6197. };
  6198. scale.domain = function(_) {
  6199. if (!arguments.length)
  6200. return domain.slice();
  6201. domain = [];
  6202. for (let d of _)
  6203. if (d != null && !isNaN(d = +d))
  6204. domain.push(d);
  6205. domain.sort(ascending);
  6206. return rescale();
  6207. };
  6208. scale.range = function(_) {
  6209. return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice();
  6210. };
  6211. scale.unknown = function(_) {
  6212. return arguments.length ? (unknown = _, scale) : unknown;
  6213. };
  6214. scale.quantiles = function() {
  6215. return thresholds.slice();
  6216. };
  6217. scale.copy = function() {
  6218. return quantile2().domain(domain).range(range2).unknown(unknown);
  6219. };
  6220. return initRange.apply(scale, arguments);
  6221. }
  6222. // node_modules/d3-scale/src/threshold.js
  6223. function threshold() {
  6224. var domain = [0.5], range2 = [0, 1], unknown, n = 1;
  6225. function scale(x) {
  6226. return x != null && x <= x ? range2[bisect_default(domain, x, 0, n)] : unknown;
  6227. }
  6228. scale.domain = function(_) {
  6229. return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range2.length - 1), scale) : domain.slice();
  6230. };
  6231. scale.range = function(_) {
  6232. return arguments.length ? (range2 = Array.from(_), n = Math.min(domain.length, range2.length - 1), scale) : range2.slice();
  6233. };
  6234. scale.invertExtent = function(y) {
  6235. var i = range2.indexOf(y);
  6236. return [domain[i - 1], domain[i]];
  6237. };
  6238. scale.unknown = function(_) {
  6239. return arguments.length ? (unknown = _, scale) : unknown;
  6240. };
  6241. scale.copy = function() {
  6242. return threshold().domain(domain).range(range2).unknown(unknown);
  6243. };
  6244. return initRange.apply(scale, arguments);
  6245. }
  6246. // node_modules/d3-time/src/interval.js
  6247. var t02 = new Date;
  6248. var t12 = new Date;
  6249. function timeInterval(floori, offseti, count, field) {
  6250. function interval2(date) {
  6251. return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
  6252. }
  6253. interval2.floor = (date) => {
  6254. return floori(date = new Date(+date)), date;
  6255. };
  6256. interval2.ceil = (date) => {
  6257. return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
  6258. };
  6259. interval2.round = (date) => {
  6260. const d0 = interval2(date), d1 = interval2.ceil(date);
  6261. return date - d0 < d1 - date ? d0 : d1;
  6262. };
  6263. interval2.offset = (date, step) => {
  6264. return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
  6265. };
  6266. interval2.range = (start2, stop, step) => {
  6267. const range2 = [];
  6268. start2 = interval2.ceil(start2);
  6269. step = step == null ? 1 : Math.floor(step);
  6270. if (!(start2 < stop) || !(step > 0))
  6271. return range2;
  6272. let previous;
  6273. do
  6274. range2.push(previous = new Date(+start2)), offseti(start2, step), floori(start2);
  6275. while (previous < start2 && start2 < stop);
  6276. return range2;
  6277. };
  6278. interval2.filter = (test) => {
  6279. return timeInterval((date) => {
  6280. if (date >= date)
  6281. while (floori(date), !test(date))
  6282. date.setTime(date - 1);
  6283. }, (date, step) => {
  6284. if (date >= date) {
  6285. if (step < 0)
  6286. while (++step <= 0) {
  6287. while (offseti(date, -1), !test(date)) {}
  6288. }
  6289. else
  6290. while (--step >= 0) {
  6291. while (offseti(date, 1), !test(date)) {}
  6292. }
  6293. }
  6294. });
  6295. };
  6296. if (count) {
  6297. interval2.count = (start2, end) => {
  6298. t02.setTime(+start2), t12.setTime(+end);
  6299. floori(t02), floori(t12);
  6300. return Math.floor(count(t02, t12));
  6301. };
  6302. interval2.every = (step) => {
  6303. step = Math.floor(step);
  6304. return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field ? (d) => field(d) % step === 0 : (d) => interval2.count(0, d) % step === 0);
  6305. };
  6306. }
  6307. return interval2;
  6308. }
  6309. // node_modules/d3-time/src/millisecond.js
  6310. var millisecond = timeInterval(() => {}, (date, step) => {
  6311. date.setTime(+date + step);
  6312. }, (start2, end) => {
  6313. return end - start2;
  6314. });
  6315. millisecond.every = (k) => {
  6316. k = Math.floor(k);
  6317. if (!isFinite(k) || !(k > 0))
  6318. return null;
  6319. if (!(k > 1))
  6320. return millisecond;
  6321. return timeInterval((date) => {
  6322. date.setTime(Math.floor(date / k) * k);
  6323. }, (date, step) => {
  6324. date.setTime(+date + step * k);
  6325. }, (start2, end) => {
  6326. return (end - start2) / k;
  6327. });
  6328. };
  6329. var milliseconds = millisecond.range;
  6330. // node_modules/d3-time/src/duration.js
  6331. var durationSecond = 1000;
  6332. var durationMinute = durationSecond * 60;
  6333. var durationHour = durationMinute * 60;
  6334. var durationDay = durationHour * 24;
  6335. var durationWeek = durationDay * 7;
  6336. var durationMonth = durationDay * 30;
  6337. var durationYear = durationDay * 365;
  6338. // node_modules/d3-time/src/second.js
  6339. var second = timeInterval((date) => {
  6340. date.setTime(date - date.getMilliseconds());
  6341. }, (date, step) => {
  6342. date.setTime(+date + step * durationSecond);
  6343. }, (start2, end) => {
  6344. return (end - start2) / durationSecond;
  6345. }, (date) => {
  6346. return date.getUTCSeconds();
  6347. });
  6348. var seconds = second.range;
  6349. // node_modules/d3-time/src/minute.js
  6350. var timeMinute = timeInterval((date) => {
  6351. date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
  6352. }, (date, step) => {
  6353. date.setTime(+date + step * durationMinute);
  6354. }, (start2, end) => {
  6355. return (end - start2) / durationMinute;
  6356. }, (date) => {
  6357. return date.getMinutes();
  6358. });
  6359. var timeMinutes = timeMinute.range;
  6360. var utcMinute = timeInterval((date) => {
  6361. date.setUTCSeconds(0, 0);
  6362. }, (date, step) => {
  6363. date.setTime(+date + step * durationMinute);
  6364. }, (start2, end) => {
  6365. return (end - start2) / durationMinute;
  6366. }, (date) => {
  6367. return date.getUTCMinutes();
  6368. });
  6369. var utcMinutes = utcMinute.range;
  6370. // node_modules/d3-time/src/hour.js
  6371. var timeHour = timeInterval((date) => {
  6372. date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
  6373. }, (date, step) => {
  6374. date.setTime(+date + step * durationHour);
  6375. }, (start2, end) => {
  6376. return (end - start2) / durationHour;
  6377. }, (date) => {
  6378. return date.getHours();
  6379. });
  6380. var timeHours = timeHour.range;
  6381. var utcHour = timeInterval((date) => {
  6382. date.setUTCMinutes(0, 0, 0);
  6383. }, (date, step) => {
  6384. date.setTime(+date + step * durationHour);
  6385. }, (start2, end) => {
  6386. return (end - start2) / durationHour;
  6387. }, (date) => {
  6388. return date.getUTCHours();
  6389. });
  6390. var utcHours = utcHour.range;
  6391. // node_modules/d3-time/src/day.js
  6392. var timeDay = timeInterval((date) => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start2, end) => (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationDay, (date) => date.getDate() - 1);
  6393. var timeDays = timeDay.range;
  6394. var utcDay = timeInterval((date) => {
  6395. date.setUTCHours(0, 0, 0, 0);
  6396. }, (date, step) => {
  6397. date.setUTCDate(date.getUTCDate() + step);
  6398. }, (start2, end) => {
  6399. return (end - start2) / durationDay;
  6400. }, (date) => {
  6401. return date.getUTCDate() - 1;
  6402. });
  6403. var utcDays = utcDay.range;
  6404. var unixDay = timeInterval((date) => {
  6405. date.setUTCHours(0, 0, 0, 0);
  6406. }, (date, step) => {
  6407. date.setUTCDate(date.getUTCDate() + step);
  6408. }, (start2, end) => {
  6409. return (end - start2) / durationDay;
  6410. }, (date) => {
  6411. return Math.floor(date / durationDay);
  6412. });
  6413. var unixDays = unixDay.range;
  6414. // node_modules/d3-time/src/week.js
  6415. function timeWeekday(i) {
  6416. return timeInterval((date) => {
  6417. date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
  6418. date.setHours(0, 0, 0, 0);
  6419. }, (date, step) => {
  6420. date.setDate(date.getDate() + step * 7);
  6421. }, (start2, end) => {
  6422. return (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationWeek;
  6423. });
  6424. }
  6425. var timeSunday = timeWeekday(0);
  6426. var timeMonday = timeWeekday(1);
  6427. var timeTuesday = timeWeekday(2);
  6428. var timeWednesday = timeWeekday(3);
  6429. var timeThursday = timeWeekday(4);
  6430. var timeFriday = timeWeekday(5);
  6431. var timeSaturday = timeWeekday(6);
  6432. var timeSundays = timeSunday.range;
  6433. var timeMondays = timeMonday.range;
  6434. var timeTuesdays = timeTuesday.range;
  6435. var timeWednesdays = timeWednesday.range;
  6436. var timeThursdays = timeThursday.range;
  6437. var timeFridays = timeFriday.range;
  6438. var timeSaturdays = timeSaturday.range;
  6439. function utcWeekday(i) {
  6440. return timeInterval((date) => {
  6441. date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
  6442. date.setUTCHours(0, 0, 0, 0);
  6443. }, (date, step) => {
  6444. date.setUTCDate(date.getUTCDate() + step * 7);
  6445. }, (start2, end) => {
  6446. return (end - start2) / durationWeek;
  6447. });
  6448. }
  6449. var utcSunday = utcWeekday(0);
  6450. var utcMonday = utcWeekday(1);
  6451. var utcTuesday = utcWeekday(2);
  6452. var utcWednesday = utcWeekday(3);
  6453. var utcThursday = utcWeekday(4);
  6454. var utcFriday = utcWeekday(5);
  6455. var utcSaturday = utcWeekday(6);
  6456. var utcSundays = utcSunday.range;
  6457. var utcMondays = utcMonday.range;
  6458. var utcTuesdays = utcTuesday.range;
  6459. var utcWednesdays = utcWednesday.range;
  6460. var utcThursdays = utcThursday.range;
  6461. var utcFridays = utcFriday.range;
  6462. var utcSaturdays = utcSaturday.range;
  6463. // node_modules/d3-time/src/month.js
  6464. var timeMonth = timeInterval((date) => {
  6465. date.setDate(1);
  6466. date.setHours(0, 0, 0, 0);
  6467. }, (date, step) => {
  6468. date.setMonth(date.getMonth() + step);
  6469. }, (start2, end) => {
  6470. return end.getMonth() - start2.getMonth() + (end.getFullYear() - start2.getFullYear()) * 12;
  6471. }, (date) => {
  6472. return date.getMonth();
  6473. });
  6474. var timeMonths = timeMonth.range;
  6475. var utcMonth = timeInterval((date) => {
  6476. date.setUTCDate(1);
  6477. date.setUTCHours(0, 0, 0, 0);
  6478. }, (date, step) => {
  6479. date.setUTCMonth(date.getUTCMonth() + step);
  6480. }, (start2, end) => {
  6481. return end.getUTCMonth() - start2.getUTCMonth() + (end.getUTCFullYear() - start2.getUTCFullYear()) * 12;
  6482. }, (date) => {
  6483. return date.getUTCMonth();
  6484. });
  6485. var utcMonths = utcMonth.range;
  6486. // node_modules/d3-time/src/year.js
  6487. var timeYear = timeInterval((date) => {
  6488. date.setMonth(0, 1);
  6489. date.setHours(0, 0, 0, 0);
  6490. }, (date, step) => {
  6491. date.setFullYear(date.getFullYear() + step);
  6492. }, (start2, end) => {
  6493. return end.getFullYear() - start2.getFullYear();
  6494. }, (date) => {
  6495. return date.getFullYear();
  6496. });
  6497. timeYear.every = (k) => {
  6498. return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
  6499. date.setFullYear(Math.floor(date.getFullYear() / k) * k);
  6500. date.setMonth(0, 1);
  6501. date.setHours(0, 0, 0, 0);
  6502. }, (date, step) => {
  6503. date.setFullYear(date.getFullYear() + step * k);
  6504. });
  6505. };
  6506. var timeYears = timeYear.range;
  6507. var utcYear = timeInterval((date) => {
  6508. date.setUTCMonth(0, 1);
  6509. date.setUTCHours(0, 0, 0, 0);
  6510. }, (date, step) => {
  6511. date.setUTCFullYear(date.getUTCFullYear() + step);
  6512. }, (start2, end) => {
  6513. return end.getUTCFullYear() - start2.getUTCFullYear();
  6514. }, (date) => {
  6515. return date.getUTCFullYear();
  6516. });
  6517. utcYear.every = (k) => {
  6518. return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
  6519. date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
  6520. date.setUTCMonth(0, 1);
  6521. date.setUTCHours(0, 0, 0, 0);
  6522. }, (date, step) => {
  6523. date.setUTCFullYear(date.getUTCFullYear() + step * k);
  6524. });
  6525. };
  6526. var utcYears = utcYear.range;
  6527. // node_modules/d3-time/src/ticks.js
  6528. function ticker(year, month, week, day, hour, minute) {
  6529. const tickIntervals = [
  6530. [second, 1, durationSecond],
  6531. [second, 5, 5 * durationSecond],
  6532. [second, 15, 15 * durationSecond],
  6533. [second, 30, 30 * durationSecond],
  6534. [minute, 1, durationMinute],
  6535. [minute, 5, 5 * durationMinute],
  6536. [minute, 15, 15 * durationMinute],
  6537. [minute, 30, 30 * durationMinute],
  6538. [hour, 1, durationHour],
  6539. [hour, 3, 3 * durationHour],
  6540. [hour, 6, 6 * durationHour],
  6541. [hour, 12, 12 * durationHour],
  6542. [day, 1, durationDay],
  6543. [day, 2, 2 * durationDay],
  6544. [week, 1, durationWeek],
  6545. [month, 1, durationMonth],
  6546. [month, 3, 3 * durationMonth],
  6547. [year, 1, durationYear]
  6548. ];
  6549. function ticks2(start2, stop, count) {
  6550. const reverse2 = stop < start2;
  6551. if (reverse2)
  6552. [start2, stop] = [stop, start2];
  6553. const interval2 = count && typeof count.range === "function" ? count : tickInterval(start2, stop, count);
  6554. const ticks3 = interval2 ? interval2.range(start2, +stop + 1) : [];
  6555. return reverse2 ? ticks3.reverse() : ticks3;
  6556. }
  6557. function tickInterval(start2, stop, count) {
  6558. const target = Math.abs(stop - start2) / count;
  6559. const i = bisector(([, , step2]) => step2).right(tickIntervals, target);
  6560. if (i === tickIntervals.length)
  6561. return year.every(tickStep(start2 / durationYear, stop / durationYear, count));
  6562. if (i === 0)
  6563. return millisecond.every(Math.max(tickStep(start2, stop, count), 1));
  6564. const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
  6565. return t.every(step);
  6566. }
  6567. return [ticks2, tickInterval];
  6568. }
  6569. var [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);
  6570. var [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);
  6571. // node_modules/d3-time-format/src/locale.js
  6572. function localDate(d) {
  6573. if (0 <= d.y && d.y < 100) {
  6574. var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
  6575. date.setFullYear(d.y);
  6576. return date;
  6577. }
  6578. return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
  6579. }
  6580. function utcDate(d) {
  6581. if (0 <= d.y && d.y < 100) {
  6582. var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
  6583. date.setUTCFullYear(d.y);
  6584. return date;
  6585. }
  6586. return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
  6587. }
  6588. function newDate(y, m, d) {
  6589. return { y, m, d, H: 0, M: 0, S: 0, L: 0 };
  6590. }
  6591. function formatLocale(locale2) {
  6592. var { dateTime: locale_dateTime, date: locale_date, time: locale_time, periods: locale_periods, days: locale_weekdays, shortDays: locale_shortWeekdays, months: locale_months, shortMonths: locale_shortMonths } = locale2;
  6593. var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths);
  6594. var formats = {
  6595. a: formatShortWeekday,
  6596. A: formatWeekday,
  6597. b: formatShortMonth,
  6598. B: formatMonth,
  6599. c: null,
  6600. d: formatDayOfMonth,
  6601. e: formatDayOfMonth,
  6602. f: formatMicroseconds,
  6603. g: formatYearISO,
  6604. G: formatFullYearISO,
  6605. H: formatHour24,
  6606. I: formatHour12,
  6607. j: formatDayOfYear,
  6608. L: formatMilliseconds,
  6609. m: formatMonthNumber,
  6610. M: formatMinutes,
  6611. p: formatPeriod,
  6612. q: formatQuarter,
  6613. Q: formatUnixTimestamp,
  6614. s: formatUnixTimestampSeconds,
  6615. S: formatSeconds,
  6616. u: formatWeekdayNumberMonday,
  6617. U: formatWeekNumberSunday,
  6618. V: formatWeekNumberISO,
  6619. w: formatWeekdayNumberSunday,
  6620. W: formatWeekNumberMonday,
  6621. x: null,
  6622. X: null,
  6623. y: formatYear,
  6624. Y: formatFullYear,
  6625. Z: formatZone,
  6626. "%": formatLiteralPercent
  6627. };
  6628. var utcFormats = {
  6629. a: formatUTCShortWeekday,
  6630. A: formatUTCWeekday,
  6631. b: formatUTCShortMonth,
  6632. B: formatUTCMonth,
  6633. c: null,
  6634. d: formatUTCDayOfMonth,
  6635. e: formatUTCDayOfMonth,
  6636. f: formatUTCMicroseconds,
  6637. g: formatUTCYearISO,
  6638. G: formatUTCFullYearISO,
  6639. H: formatUTCHour24,
  6640. I: formatUTCHour12,
  6641. j: formatUTCDayOfYear,
  6642. L: formatUTCMilliseconds,
  6643. m: formatUTCMonthNumber,
  6644. M: formatUTCMinutes,
  6645. p: formatUTCPeriod,
  6646. q: formatUTCQuarter,
  6647. Q: formatUnixTimestamp,
  6648. s: formatUnixTimestampSeconds,
  6649. S: formatUTCSeconds,
  6650. u: formatUTCWeekdayNumberMonday,
  6651. U: formatUTCWeekNumberSunday,
  6652. V: formatUTCWeekNumberISO,
  6653. w: formatUTCWeekdayNumberSunday,
  6654. W: formatUTCWeekNumberMonday,
  6655. x: null,
  6656. X: null,
  6657. y: formatUTCYear,
  6658. Y: formatUTCFullYear,
  6659. Z: formatUTCZone,
  6660. "%": formatLiteralPercent
  6661. };
  6662. var parses = {
  6663. a: parseShortWeekday,
  6664. A: parseWeekday,
  6665. b: parseShortMonth,
  6666. B: parseMonth,
  6667. c: parseLocaleDateTime,
  6668. d: parseDayOfMonth,
  6669. e: parseDayOfMonth,
  6670. f: parseMicroseconds,
  6671. g: parseYear,
  6672. G: parseFullYear,
  6673. H: parseHour24,
  6674. I: parseHour24,
  6675. j: parseDayOfYear,
  6676. L: parseMilliseconds,
  6677. m: parseMonthNumber,
  6678. M: parseMinutes,
  6679. p: parsePeriod,
  6680. q: parseQuarter,
  6681. Q: parseUnixTimestamp,
  6682. s: parseUnixTimestampSeconds,
  6683. S: parseSeconds,
  6684. u: parseWeekdayNumberMonday,
  6685. U: parseWeekNumberSunday,
  6686. V: parseWeekNumberISO,
  6687. w: parseWeekdayNumberSunday,
  6688. W: parseWeekNumberMonday,
  6689. x: parseLocaleDate,
  6690. X: parseLocaleTime,
  6691. y: parseYear,
  6692. Y: parseFullYear,
  6693. Z: parseZone,
  6694. "%": parseLiteralPercent
  6695. };
  6696. formats.x = newFormat(locale_date, formats);
  6697. formats.X = newFormat(locale_time, formats);
  6698. formats.c = newFormat(locale_dateTime, formats);
  6699. utcFormats.x = newFormat(locale_date, utcFormats);
  6700. utcFormats.X = newFormat(locale_time, utcFormats);
  6701. utcFormats.c = newFormat(locale_dateTime, utcFormats);
  6702. function newFormat(specifier, formats2) {
  6703. return function(date) {
  6704. var string = [], i = -1, j = 0, n = specifier.length, c, pad, format2;
  6705. if (!(date instanceof Date))
  6706. date = new Date(+date);
  6707. while (++i < n) {
  6708. if (specifier.charCodeAt(i) === 37) {
  6709. string.push(specifier.slice(j, i));
  6710. if ((pad = pads[c = specifier.charAt(++i)]) != null)
  6711. c = specifier.charAt(++i);
  6712. else
  6713. pad = c === "e" ? " " : "0";
  6714. if (format2 = formats2[c])
  6715. c = format2(date, pad);
  6716. string.push(c);
  6717. j = i + 1;
  6718. }
  6719. }
  6720. string.push(specifier.slice(j, i));
  6721. return string.join("");
  6722. };
  6723. }
  6724. function newParse(specifier, Z) {
  6725. return function(string) {
  6726. var d = newDate(1900, undefined, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day;
  6727. if (i != string.length)
  6728. return null;
  6729. if ("Q" in d)
  6730. return new Date(d.Q);
  6731. if ("s" in d)
  6732. return new Date(d.s * 1000 + ("L" in d ? d.L : 0));
  6733. if (Z && !("Z" in d))
  6734. d.Z = 0;
  6735. if ("p" in d)
  6736. d.H = d.H % 12 + d.p * 12;
  6737. if (d.m === undefined)
  6738. d.m = "q" in d ? d.q : 0;
  6739. if ("V" in d) {
  6740. if (d.V < 1 || d.V > 53)
  6741. return null;
  6742. if (!("w" in d))
  6743. d.w = 1;
  6744. if ("Z" in d) {
  6745. week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();
  6746. week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
  6747. week = utcDay.offset(week, (d.V - 1) * 7);
  6748. d.y = week.getUTCFullYear();
  6749. d.m = week.getUTCMonth();
  6750. d.d = week.getUTCDate() + (d.w + 6) % 7;
  6751. } else {
  6752. week = localDate(newDate(d.y, 0, 1)), day = week.getDay();
  6753. week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
  6754. week = timeDay.offset(week, (d.V - 1) * 7);
  6755. d.y = week.getFullYear();
  6756. d.m = week.getMonth();
  6757. d.d = week.getDate() + (d.w + 6) % 7;
  6758. }
  6759. } else if ("W" in d || "U" in d) {
  6760. if (!("w" in d))
  6761. d.w = "u" in d ? d.u % 7 : ("W" in d) ? 1 : 0;
  6762. day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
  6763. d.m = 0;
  6764. d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
  6765. }
  6766. if ("Z" in d) {
  6767. d.H += d.Z / 100 | 0;
  6768. d.M += d.Z % 100;
  6769. return utcDate(d);
  6770. }
  6771. return localDate(d);
  6772. };
  6773. }
  6774. function parseSpecifier(d, specifier, string, j) {
  6775. var i = 0, n = specifier.length, m = string.length, c, parse;
  6776. while (i < n) {
  6777. if (j >= m)
  6778. return -1;
  6779. c = specifier.charCodeAt(i++);
  6780. if (c === 37) {
  6781. c = specifier.charAt(i++);
  6782. parse = parses[c in pads ? specifier.charAt(i++) : c];
  6783. if (!parse || (j = parse(d, string, j)) < 0)
  6784. return -1;
  6785. } else if (c != string.charCodeAt(j++)) {
  6786. return -1;
  6787. }
  6788. }
  6789. return j;
  6790. }
  6791. function parsePeriod(d, string, i) {
  6792. var n = periodRe.exec(string.slice(i));
  6793. return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  6794. }
  6795. function parseShortWeekday(d, string, i) {
  6796. var n = shortWeekdayRe.exec(string.slice(i));
  6797. return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  6798. }
  6799. function parseWeekday(d, string, i) {
  6800. var n = weekdayRe.exec(string.slice(i));
  6801. return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  6802. }
  6803. function parseShortMonth(d, string, i) {
  6804. var n = shortMonthRe.exec(string.slice(i));
  6805. return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  6806. }
  6807. function parseMonth(d, string, i) {
  6808. var n = monthRe.exec(string.slice(i));
  6809. return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  6810. }
  6811. function parseLocaleDateTime(d, string, i) {
  6812. return parseSpecifier(d, locale_dateTime, string, i);
  6813. }
  6814. function parseLocaleDate(d, string, i) {
  6815. return parseSpecifier(d, locale_date, string, i);
  6816. }
  6817. function parseLocaleTime(d, string, i) {
  6818. return parseSpecifier(d, locale_time, string, i);
  6819. }
  6820. function formatShortWeekday(d) {
  6821. return locale_shortWeekdays[d.getDay()];
  6822. }
  6823. function formatWeekday(d) {
  6824. return locale_weekdays[d.getDay()];
  6825. }
  6826. function formatShortMonth(d) {
  6827. return locale_shortMonths[d.getMonth()];
  6828. }
  6829. function formatMonth(d) {
  6830. return locale_months[d.getMonth()];
  6831. }
  6832. function formatPeriod(d) {
  6833. return locale_periods[+(d.getHours() >= 12)];
  6834. }
  6835. function formatQuarter(d) {
  6836. return 1 + ~~(d.getMonth() / 3);
  6837. }
  6838. function formatUTCShortWeekday(d) {
  6839. return locale_shortWeekdays[d.getUTCDay()];
  6840. }
  6841. function formatUTCWeekday(d) {
  6842. return locale_weekdays[d.getUTCDay()];
  6843. }
  6844. function formatUTCShortMonth(d) {
  6845. return locale_shortMonths[d.getUTCMonth()];
  6846. }
  6847. function formatUTCMonth(d) {
  6848. return locale_months[d.getUTCMonth()];
  6849. }
  6850. function formatUTCPeriod(d) {
  6851. return locale_periods[+(d.getUTCHours() >= 12)];
  6852. }
  6853. function formatUTCQuarter(d) {
  6854. return 1 + ~~(d.getUTCMonth() / 3);
  6855. }
  6856. return {
  6857. format: function(specifier) {
  6858. var f = newFormat(specifier += "", formats);
  6859. f.toString = function() {
  6860. return specifier;
  6861. };
  6862. return f;
  6863. },
  6864. parse: function(specifier) {
  6865. var p = newParse(specifier += "", false);
  6866. p.toString = function() {
  6867. return specifier;
  6868. };
  6869. return p;
  6870. },
  6871. utcFormat: function(specifier) {
  6872. var f = newFormat(specifier += "", utcFormats);
  6873. f.toString = function() {
  6874. return specifier;
  6875. };
  6876. return f;
  6877. },
  6878. utcParse: function(specifier) {
  6879. var p = newParse(specifier += "", true);
  6880. p.toString = function() {
  6881. return specifier;
  6882. };
  6883. return p;
  6884. }
  6885. };
  6886. }
  6887. var pads = { "-": "", _: " ", "0": "0" };
  6888. var numberRe = /^\s*\d+/;
  6889. var percentRe = /^%/;
  6890. var requoteRe = /[\\^$*+?|[\]().{}]/g;
  6891. function pad(value, fill, width) {
  6892. var sign2 = value < 0 ? "-" : "", string = (sign2 ? -value : value) + "", length2 = string.length;
  6893. return sign2 + (length2 < width ? new Array(width - length2 + 1).join(fill) + string : string);
  6894. }
  6895. function requote(s) {
  6896. return s.replace(requoteRe, "\\$&");
  6897. }
  6898. function formatRe(names) {
  6899. return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
  6900. }
  6901. function formatLookup(names) {
  6902. return new Map(names.map((name, i) => [name.toLowerCase(), i]));
  6903. }
  6904. function parseWeekdayNumberSunday(d, string, i) {
  6905. var n = numberRe.exec(string.slice(i, i + 1));
  6906. return n ? (d.w = +n[0], i + n[0].length) : -1;
  6907. }
  6908. function parseWeekdayNumberMonday(d, string, i) {
  6909. var n = numberRe.exec(string.slice(i, i + 1));
  6910. return n ? (d.u = +n[0], i + n[0].length) : -1;
  6911. }
  6912. function parseWeekNumberSunday(d, string, i) {
  6913. var n = numberRe.exec(string.slice(i, i + 2));
  6914. return n ? (d.U = +n[0], i + n[0].length) : -1;
  6915. }
  6916. function parseWeekNumberISO(d, string, i) {
  6917. var n = numberRe.exec(string.slice(i, i + 2));
  6918. return n ? (d.V = +n[0], i + n[0].length) : -1;
  6919. }
  6920. function parseWeekNumberMonday(d, string, i) {
  6921. var n = numberRe.exec(string.slice(i, i + 2));
  6922. return n ? (d.W = +n[0], i + n[0].length) : -1;
  6923. }
  6924. function parseFullYear(d, string, i) {
  6925. var n = numberRe.exec(string.slice(i, i + 4));
  6926. return n ? (d.y = +n[0], i + n[0].length) : -1;
  6927. }
  6928. function parseYear(d, string, i) {
  6929. var n = numberRe.exec(string.slice(i, i + 2));
  6930. return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
  6931. }
  6932. function parseZone(d, string, i) {
  6933. var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
  6934. return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
  6935. }
  6936. function parseQuarter(d, string, i) {
  6937. var n = numberRe.exec(string.slice(i, i + 1));
  6938. return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
  6939. }
  6940. function parseMonthNumber(d, string, i) {
  6941. var n = numberRe.exec(string.slice(i, i + 2));
  6942. return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
  6943. }
  6944. function parseDayOfMonth(d, string, i) {
  6945. var n = numberRe.exec(string.slice(i, i + 2));
  6946. return n ? (d.d = +n[0], i + n[0].length) : -1;
  6947. }
  6948. function parseDayOfYear(d, string, i) {
  6949. var n = numberRe.exec(string.slice(i, i + 3));
  6950. return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
  6951. }
  6952. function parseHour24(d, string, i) {
  6953. var n = numberRe.exec(string.slice(i, i + 2));
  6954. return n ? (d.H = +n[0], i + n[0].length) : -1;
  6955. }
  6956. function parseMinutes(d, string, i) {
  6957. var n = numberRe.exec(string.slice(i, i + 2));
  6958. return n ? (d.M = +n[0], i + n[0].length) : -1;
  6959. }
  6960. function parseSeconds(d, string, i) {
  6961. var n = numberRe.exec(string.slice(i, i + 2));
  6962. return n ? (d.S = +n[0], i + n[0].length) : -1;
  6963. }
  6964. function parseMilliseconds(d, string, i) {
  6965. var n = numberRe.exec(string.slice(i, i + 3));
  6966. return n ? (d.L = +n[0], i + n[0].length) : -1;
  6967. }
  6968. function parseMicroseconds(d, string, i) {
  6969. var n = numberRe.exec(string.slice(i, i + 6));
  6970. return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
  6971. }
  6972. function parseLiteralPercent(d, string, i) {
  6973. var n = percentRe.exec(string.slice(i, i + 1));
  6974. return n ? i + n[0].length : -1;
  6975. }
  6976. function parseUnixTimestamp(d, string, i) {
  6977. var n = numberRe.exec(string.slice(i));
  6978. return n ? (d.Q = +n[0], i + n[0].length) : -1;
  6979. }
  6980. function parseUnixTimestampSeconds(d, string, i) {
  6981. var n = numberRe.exec(string.slice(i));
  6982. return n ? (d.s = +n[0], i + n[0].length) : -1;
  6983. }
  6984. function formatDayOfMonth(d, p) {
  6985. return pad(d.getDate(), p, 2);
  6986. }
  6987. function formatHour24(d, p) {
  6988. return pad(d.getHours(), p, 2);
  6989. }
  6990. function formatHour12(d, p) {
  6991. return pad(d.getHours() % 12 || 12, p, 2);
  6992. }
  6993. function formatDayOfYear(d, p) {
  6994. return pad(1 + timeDay.count(timeYear(d), d), p, 3);
  6995. }
  6996. function formatMilliseconds(d, p) {
  6997. return pad(d.getMilliseconds(), p, 3);
  6998. }
  6999. function formatMicroseconds(d, p) {
  7000. return formatMilliseconds(d, p) + "000";
  7001. }
  7002. function formatMonthNumber(d, p) {
  7003. return pad(d.getMonth() + 1, p, 2);
  7004. }
  7005. function formatMinutes(d, p) {
  7006. return pad(d.getMinutes(), p, 2);
  7007. }
  7008. function formatSeconds(d, p) {
  7009. return pad(d.getSeconds(), p, 2);
  7010. }
  7011. function formatWeekdayNumberMonday(d) {
  7012. var day = d.getDay();
  7013. return day === 0 ? 7 : day;
  7014. }
  7015. function formatWeekNumberSunday(d, p) {
  7016. return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);
  7017. }
  7018. function dISO(d) {
  7019. var day = d.getDay();
  7020. return day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d);
  7021. }
  7022. function formatWeekNumberISO(d, p) {
  7023. d = dISO(d);
  7024. return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);
  7025. }
  7026. function formatWeekdayNumberSunday(d) {
  7027. return d.getDay();
  7028. }
  7029. function formatWeekNumberMonday(d, p) {
  7030. return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);
  7031. }
  7032. function formatYear(d, p) {
  7033. return pad(d.getFullYear() % 100, p, 2);
  7034. }
  7035. function formatYearISO(d, p) {
  7036. d = dISO(d);
  7037. return pad(d.getFullYear() % 100, p, 2);
  7038. }
  7039. function formatFullYear(d, p) {
  7040. return pad(d.getFullYear() % 1e4, p, 4);
  7041. }
  7042. function formatFullYearISO(d, p) {
  7043. var day = d.getDay();
  7044. d = day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d);
  7045. return pad(d.getFullYear() % 1e4, p, 4);
  7046. }
  7047. function formatZone(d) {
  7048. var z = d.getTimezoneOffset();
  7049. return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2);
  7050. }
  7051. function formatUTCDayOfMonth(d, p) {
  7052. return pad(d.getUTCDate(), p, 2);
  7053. }
  7054. function formatUTCHour24(d, p) {
  7055. return pad(d.getUTCHours(), p, 2);
  7056. }
  7057. function formatUTCHour12(d, p) {
  7058. return pad(d.getUTCHours() % 12 || 12, p, 2);
  7059. }
  7060. function formatUTCDayOfYear(d, p) {
  7061. return pad(1 + utcDay.count(utcYear(d), d), p, 3);
  7062. }
  7063. function formatUTCMilliseconds(d, p) {
  7064. return pad(d.getUTCMilliseconds(), p, 3);
  7065. }
  7066. function formatUTCMicroseconds(d, p) {
  7067. return formatUTCMilliseconds(d, p) + "000";
  7068. }
  7069. function formatUTCMonthNumber(d, p) {
  7070. return pad(d.getUTCMonth() + 1, p, 2);
  7071. }
  7072. function formatUTCMinutes(d, p) {
  7073. return pad(d.getUTCMinutes(), p, 2);
  7074. }
  7075. function formatUTCSeconds(d, p) {
  7076. return pad(d.getUTCSeconds(), p, 2);
  7077. }
  7078. function formatUTCWeekdayNumberMonday(d) {
  7079. var dow = d.getUTCDay();
  7080. return dow === 0 ? 7 : dow;
  7081. }
  7082. function formatUTCWeekNumberSunday(d, p) {
  7083. return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);
  7084. }
  7085. function UTCdISO(d) {
  7086. var day = d.getUTCDay();
  7087. return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
  7088. }
  7089. function formatUTCWeekNumberISO(d, p) {
  7090. d = UTCdISO(d);
  7091. return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
  7092. }
  7093. function formatUTCWeekdayNumberSunday(d) {
  7094. return d.getUTCDay();
  7095. }
  7096. function formatUTCWeekNumberMonday(d, p) {
  7097. return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);
  7098. }
  7099. function formatUTCYear(d, p) {
  7100. return pad(d.getUTCFullYear() % 100, p, 2);
  7101. }
  7102. function formatUTCYearISO(d, p) {
  7103. d = UTCdISO(d);
  7104. return pad(d.getUTCFullYear() % 100, p, 2);
  7105. }
  7106. function formatUTCFullYear(d, p) {
  7107. return pad(d.getUTCFullYear() % 1e4, p, 4);
  7108. }
  7109. function formatUTCFullYearISO(d, p) {
  7110. var day = d.getUTCDay();
  7111. d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
  7112. return pad(d.getUTCFullYear() % 1e4, p, 4);
  7113. }
  7114. function formatUTCZone() {
  7115. return "+0000";
  7116. }
  7117. function formatLiteralPercent() {
  7118. return "%";
  7119. }
  7120. function formatUnixTimestamp(d) {
  7121. return +d;
  7122. }
  7123. function formatUnixTimestampSeconds(d) {
  7124. return Math.floor(+d / 1000);
  7125. }
  7126. // node_modules/d3-time-format/src/defaultLocale.js
  7127. var locale2;
  7128. var timeFormat;
  7129. var timeParse;
  7130. var utcFormat;
  7131. var utcParse;
  7132. defaultLocale2({
  7133. dateTime: "%x, %X",
  7134. date: "%-m/%-d/%Y",
  7135. time: "%-I:%M:%S %p",
  7136. periods: ["AM", "PM"],
  7137. days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  7138. shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  7139. months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  7140. shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  7141. });
  7142. function defaultLocale2(definition) {
  7143. locale2 = formatLocale(definition);
  7144. timeFormat = locale2.format;
  7145. timeParse = locale2.parse;
  7146. utcFormat = locale2.utcFormat;
  7147. utcParse = locale2.utcParse;
  7148. return locale2;
  7149. }
  7150. // node_modules/d3-scale/src/time.js
  7151. function date(t) {
  7152. return new Date(t);
  7153. }
  7154. function number4(t) {
  7155. return t instanceof Date ? +t : +new Date(+t);
  7156. }
  7157. function calendar(ticks2, tickInterval, year, month, week, day, hour, minute, second2, format2) {
  7158. var scale = continuous(), invert = scale.invert, domain = scale.domain;
  7159. var formatMillisecond = format2(".%L"), formatSecond = format2(":%S"), formatMinute = format2("%I:%M"), formatHour = format2("%I %p"), formatDay = format2("%a %d"), formatWeek = format2("%b %d"), formatMonth = format2("%B"), formatYear2 = format2("%Y");
  7160. function tickFormat2(date2) {
  7161. return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2);
  7162. }
  7163. scale.invert = function(y) {
  7164. return new Date(invert(y));
  7165. };
  7166. scale.domain = function(_) {
  7167. return arguments.length ? domain(Array.from(_, number4)) : domain().map(date);
  7168. };
  7169. scale.ticks = function(interval2) {
  7170. var d = domain();
  7171. return ticks2(d[0], d[d.length - 1], interval2 == null ? 10 : interval2);
  7172. };
  7173. scale.tickFormat = function(count, specifier) {
  7174. return specifier == null ? tickFormat2 : format2(specifier);
  7175. };
  7176. scale.nice = function(interval2) {
  7177. var d = domain();
  7178. if (!interval2 || typeof interval2.range !== "function")
  7179. interval2 = tickInterval(d[0], d[d.length - 1], interval2 == null ? 10 : interval2);
  7180. return interval2 ? domain(nice(d, interval2)) : scale;
  7181. };
  7182. scale.copy = function() {
  7183. return copy(scale, calendar(ticks2, tickInterval, year, month, week, day, hour, minute, second2, format2));
  7184. };
  7185. return scale;
  7186. }
  7187. function time() {
  7188. return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
  7189. }
  7190. // node_modules/d3-scale/src/utcTime.js
  7191. function utcTime() {
  7192. return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);
  7193. }
  7194. // node_modules/d3-scale/src/sequential.js
  7195. function copy2(source, target) {
  7196. return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown());
  7197. }
  7198. // node_modules/d3-scale/src/diverging.js
  7199. function transformer3() {
  7200. var x05 = 0, x12 = 0.5, x2 = 1, s = 1, t03, t13, t22, k10, k21, interpolator = identity3, transform, clamp = false, unknown;
  7201. function scale(x) {
  7202. return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t13) * (s * x < s * t13 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));
  7203. }
  7204. scale.domain = function(_) {
  7205. return arguments.length ? ([x05, x12, x2] = _, t03 = transform(x05 = +x05), t13 = transform(x12 = +x12), t22 = transform(x2 = +x2), k10 = t03 === t13 ? 0 : 0.5 / (t13 - t03), k21 = t13 === t22 ? 0 : 0.5 / (t22 - t13), s = t13 < t03 ? -1 : 1, scale) : [x05, x12, x2];
  7206. };
  7207. scale.clamp = function(_) {
  7208. return arguments.length ? (clamp = !!_, scale) : clamp;
  7209. };
  7210. scale.interpolator = function(_) {
  7211. return arguments.length ? (interpolator = _, scale) : interpolator;
  7212. };
  7213. function range2(interpolate) {
  7214. return function(_) {
  7215. var r0, r1, r2;
  7216. return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)];
  7217. };
  7218. }
  7219. scale.range = range2(value_default);
  7220. scale.rangeRound = range2(round_default);
  7221. scale.unknown = function(_) {
  7222. return arguments.length ? (unknown = _, scale) : unknown;
  7223. };
  7224. return function(t) {
  7225. transform = t, t03 = t(x05), t13 = t(x12), t22 = t(x2), k10 = t03 === t13 ? 0 : 0.5 / (t13 - t03), k21 = t13 === t22 ? 0 : 0.5 / (t22 - t13), s = t13 < t03 ? -1 : 1;
  7226. return scale;
  7227. };
  7228. }
  7229. function diverging() {
  7230. var scale = linearish(transformer3()(identity3));
  7231. scale.copy = function() {
  7232. return copy2(scale, diverging());
  7233. };
  7234. return initInterpolator.apply(scale, arguments);
  7235. }
  7236. function divergingLog() {
  7237. var scale = loggish(transformer3()).domain([0.1, 1, 10]);
  7238. scale.copy = function() {
  7239. return copy2(scale, divergingLog()).base(scale.base());
  7240. };
  7241. return initInterpolator.apply(scale, arguments);
  7242. }
  7243. function divergingSymlog() {
  7244. var scale = symlogish(transformer3());
  7245. scale.copy = function() {
  7246. return copy2(scale, divergingSymlog()).constant(scale.constant());
  7247. };
  7248. return initInterpolator.apply(scale, arguments);
  7249. }
  7250. function divergingPow() {
  7251. var scale = powish(transformer3());
  7252. scale.copy = function() {
  7253. return copy2(scale, divergingPow()).exponent(scale.exponent());
  7254. };
  7255. return initInterpolator.apply(scale, arguments);
  7256. }
  7257. // node_modules/d3-scale-chromatic/src/colors.js
  7258. function colors_default(specifier) {
  7259. var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
  7260. while (i < n)
  7261. colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
  7262. return colors;
  7263. }
  7264. // node_modules/d3-scale-chromatic/src/categorical/category10.js
  7265. var category10_default = colors_default("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
  7266. // node_modules/d3-scale-chromatic/src/categorical/Accent.js
  7267. var Accent_default = colors_default("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");
  7268. // node_modules/d3-scale-chromatic/src/categorical/Dark2.js
  7269. var Dark2_default = colors_default("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");
  7270. // node_modules/d3-scale-chromatic/src/categorical/observable10.js
  7271. var observable10_default = colors_default("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");
  7272. // node_modules/d3-scale-chromatic/src/categorical/Paired.js
  7273. var Paired_default = colors_default("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");
  7274. // node_modules/d3-scale-chromatic/src/categorical/Pastel1.js
  7275. var Pastel1_default = colors_default("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");
  7276. // node_modules/d3-scale-chromatic/src/categorical/Pastel2.js
  7277. var Pastel2_default = colors_default("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");
  7278. // node_modules/d3-scale-chromatic/src/categorical/Set1.js
  7279. var Set1_default = colors_default("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");
  7280. // node_modules/d3-scale-chromatic/src/categorical/Set2.js
  7281. var Set2_default = colors_default("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");
  7282. // node_modules/d3-scale-chromatic/src/categorical/Set3.js
  7283. var Set3_default = colors_default("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");
  7284. // node_modules/d3-scale-chromatic/src/categorical/Tableau10.js
  7285. var Tableau10_default = colors_default("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
  7286. // node_modules/d3-scale-chromatic/src/ramp.js
  7287. var ramp_default = (scheme) => rgbBasis(scheme[scheme.length - 1]);
  7288. // node_modules/d3-scale-chromatic/src/diverging/BrBG.js
  7289. var scheme = new Array(3).concat("d8b365f5f5f55ab4ac", "a6611adfc27d80cdc1018571", "a6611adfc27df5f5f580cdc1018571", "8c510ad8b365f6e8c3c7eae55ab4ac01665e", "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e", "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e", "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e", "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30", "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(colors_default);
  7290. var BrBG_default = ramp_default(scheme);
  7291. // node_modules/d3-scale-chromatic/src/diverging/PRGn.js
  7292. var scheme2 = new Array(3).concat("af8dc3f7f7f77fbf7b", "7b3294c2a5cfa6dba0008837", "7b3294c2a5cff7f7f7a6dba0008837", "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837", "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837", "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837", "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837", "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b", "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(colors_default);
  7293. var PRGn_default = ramp_default(scheme2);
  7294. // node_modules/d3-scale-chromatic/src/diverging/PiYG.js
  7295. var scheme3 = new Array(3).concat("e9a3c9f7f7f7a1d76a", "d01c8bf1b6dab8e1864dac26", "d01c8bf1b6daf7f7f7b8e1864dac26", "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221", "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221", "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221", "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221", "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419", "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(colors_default);
  7296. var PiYG_default = ramp_default(scheme3);
  7297. // node_modules/d3-scale-chromatic/src/diverging/PuOr.js
  7298. var scheme4 = new Array(3).concat("998ec3f7f7f7f1a340", "5e3c99b2abd2fdb863e66101", "5e3c99b2abd2f7f7f7fdb863e66101", "542788998ec3d8daebfee0b6f1a340b35806", "542788998ec3d8daebf7f7f7fee0b6f1a340b35806", "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806", "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806", "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08", "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(colors_default);
  7299. var PuOr_default = ramp_default(scheme4);
  7300. // node_modules/d3-scale-chromatic/src/diverging/RdBu.js
  7301. var scheme5 = new Array(3).concat("ef8a62f7f7f767a9cf", "ca0020f4a58292c5de0571b0", "ca0020f4a582f7f7f792c5de0571b0", "b2182bef8a62fddbc7d1e5f067a9cf2166ac", "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac", "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac", "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac", "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061", "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(colors_default);
  7302. var RdBu_default = ramp_default(scheme5);
  7303. // node_modules/d3-scale-chromatic/src/diverging/RdGy.js
  7304. var scheme6 = new Array(3).concat("ef8a62ffffff999999", "ca0020f4a582bababa404040", "ca0020f4a582ffffffbababa404040", "b2182bef8a62fddbc7e0e0e09999994d4d4d", "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d", "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d", "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d", "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a", "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(colors_default);
  7305. var RdGy_default = ramp_default(scheme6);
  7306. // node_modules/d3-scale-chromatic/src/diverging/RdYlBu.js
  7307. var scheme7 = new Array(3).concat("fc8d59ffffbf91bfdb", "d7191cfdae61abd9e92c7bb6", "d7191cfdae61ffffbfabd9e92c7bb6", "d73027fc8d59fee090e0f3f891bfdb4575b4", "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4", "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4", "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4", "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695", "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(colors_default);
  7308. var RdYlBu_default = ramp_default(scheme7);
  7309. // node_modules/d3-scale-chromatic/src/diverging/RdYlGn.js
  7310. var scheme8 = new Array(3).concat("fc8d59ffffbf91cf60", "d7191cfdae61a6d96a1a9641", "d7191cfdae61ffffbfa6d96a1a9641", "d73027fc8d59fee08bd9ef8b91cf601a9850", "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850", "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850", "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850", "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837", "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(colors_default);
  7311. var RdYlGn_default = ramp_default(scheme8);
  7312. // node_modules/d3-scale-chromatic/src/diverging/Spectral.js
  7313. var scheme9 = new Array(3).concat("fc8d59ffffbf99d594", "d7191cfdae61abdda42b83ba", "d7191cfdae61ffffbfabdda42b83ba", "d53e4ffc8d59fee08be6f59899d5943288bd", "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd", "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd", "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd", "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2", "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(colors_default);
  7314. var Spectral_default = ramp_default(scheme9);
  7315. // node_modules/d3-scale-chromatic/src/sequential-multi/BuGn.js
  7316. var scheme10 = new Array(3).concat("e5f5f999d8c92ca25f", "edf8fbb2e2e266c2a4238b45", "edf8fbb2e2e266c2a42ca25f006d2c", "edf8fbccece699d8c966c2a42ca25f006d2c", "edf8fbccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(colors_default);
  7317. var BuGn_default = ramp_default(scheme10);
  7318. // node_modules/d3-scale-chromatic/src/sequential-multi/BuPu.js
  7319. var scheme11 = new Array(3).concat("e0ecf49ebcda8856a7", "edf8fbb3cde38c96c688419d", "edf8fbb3cde38c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(colors_default);
  7320. var BuPu_default = ramp_default(scheme11);
  7321. // node_modules/d3-scale-chromatic/src/sequential-multi/GnBu.js
  7322. var scheme12 = new Array(3).concat("e0f3dba8ddb543a2ca", "f0f9e8bae4bc7bccc42b8cbe", "f0f9e8bae4bc7bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(colors_default);
  7323. var GnBu_default = ramp_default(scheme12);
  7324. // node_modules/d3-scale-chromatic/src/sequential-multi/OrRd.js
  7325. var scheme13 = new Array(3).concat("fee8c8fdbb84e34a33", "fef0d9fdcc8afc8d59d7301f", "fef0d9fdcc8afc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(colors_default);
  7326. var OrRd_default = ramp_default(scheme13);
  7327. // node_modules/d3-scale-chromatic/src/sequential-multi/PuBuGn.js
  7328. var scheme14 = new Array(3).concat("ece2f0a6bddb1c9099", "f6eff7bdc9e167a9cf02818a", "f6eff7bdc9e167a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(colors_default);
  7329. var PuBuGn_default = ramp_default(scheme14);
  7330. // node_modules/d3-scale-chromatic/src/sequential-multi/PuBu.js
  7331. var scheme15 = new Array(3).concat("ece7f2a6bddb2b8cbe", "f1eef6bdc9e174a9cf0570b0", "f1eef6bdc9e174a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(colors_default);
  7332. var PuBu_default = ramp_default(scheme15);
  7333. // node_modules/d3-scale-chromatic/src/sequential-multi/PuRd.js
  7334. var scheme16 = new Array(3).concat("e7e1efc994c7dd1c77", "f1eef6d7b5d8df65b0ce1256", "f1eef6d7b5d8df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(colors_default);
  7335. var PuRd_default = ramp_default(scheme16);
  7336. // node_modules/d3-scale-chromatic/src/sequential-multi/RdPu.js
  7337. var scheme17 = new Array(3).concat("fde0ddfa9fb5c51b8a", "feebe2fbb4b9f768a1ae017e", "feebe2fbb4b9f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(colors_default);
  7338. var RdPu_default = ramp_default(scheme17);
  7339. // node_modules/d3-scale-chromatic/src/sequential-multi/YlGnBu.js
  7340. var scheme18 = new Array(3).concat("edf8b17fcdbb2c7fb8", "ffffcca1dab441b6c4225ea8", "ffffcca1dab441b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(colors_default);
  7341. var YlGnBu_default = ramp_default(scheme18);
  7342. // node_modules/d3-scale-chromatic/src/sequential-multi/YlGn.js
  7343. var scheme19 = new Array(3).concat("f7fcb9addd8e31a354", "ffffccc2e69978c679238443", "ffffccc2e69978c67931a354006837", "ffffccd9f0a3addd8e78c67931a354006837", "ffffccd9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(colors_default);
  7344. var YlGn_default = ramp_default(scheme19);
  7345. // node_modules/d3-scale-chromatic/src/sequential-multi/YlOrBr.js
  7346. var scheme20 = new Array(3).concat("fff7bcfec44fd95f0e", "ffffd4fed98efe9929cc4c02", "ffffd4fed98efe9929d95f0e993404", "ffffd4fee391fec44ffe9929d95f0e993404", "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(colors_default);
  7347. var YlOrBr_default = ramp_default(scheme20);
  7348. // node_modules/d3-scale-chromatic/src/sequential-multi/YlOrRd.js
  7349. var scheme21 = new Array(3).concat("ffeda0feb24cf03b20", "ffffb2fecc5cfd8d3ce31a1c", "ffffb2fecc5cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(colors_default);
  7350. var YlOrRd_default = ramp_default(scheme21);
  7351. // node_modules/d3-scale-chromatic/src/sequential-single/Blues.js
  7352. var scheme22 = new Array(3).concat("deebf79ecae13182bd", "eff3ffbdd7e76baed62171b5", "eff3ffbdd7e76baed63182bd08519c", "eff3ffc6dbef9ecae16baed63182bd08519c", "eff3ffc6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(colors_default);
  7353. var Blues_default = ramp_default(scheme22);
  7354. // node_modules/d3-scale-chromatic/src/sequential-single/Greens.js
  7355. var scheme23 = new Array(3).concat("e5f5e0a1d99b31a354", "edf8e9bae4b374c476238b45", "edf8e9bae4b374c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(colors_default);
  7356. var Greens_default = ramp_default(scheme23);
  7357. // node_modules/d3-scale-chromatic/src/sequential-single/Greys.js
  7358. var scheme24 = new Array(3).concat("f0f0f0bdbdbd636363", "f7f7f7cccccc969696525252", "f7f7f7cccccc969696636363252525", "f7f7f7d9d9d9bdbdbd969696636363252525", "f7f7f7d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(colors_default);
  7359. var Greys_default = ramp_default(scheme24);
  7360. // node_modules/d3-scale-chromatic/src/sequential-single/Purples.js
  7361. var scheme25 = new Array(3).concat("efedf5bcbddc756bb1", "f2f0f7cbc9e29e9ac86a51a3", "f2f0f7cbc9e29e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(colors_default);
  7362. var Purples_default = ramp_default(scheme25);
  7363. // node_modules/d3-scale-chromatic/src/sequential-single/Reds.js
  7364. var scheme26 = new Array(3).concat("fee0d2fc9272de2d26", "fee5d9fcae91fb6a4acb181d", "fee5d9fcae91fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(colors_default);
  7365. var Reds_default = ramp_default(scheme26);
  7366. // node_modules/d3-scale-chromatic/src/sequential-single/Oranges.js
  7367. var scheme27 = new Array(3).concat("fee6cefdae6be6550d", "feeddefdbe85fd8d3cd94701", "feeddefdbe85fd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(colors_default);
  7368. var Oranges_default = ramp_default(scheme27);
  7369. // node_modules/d3-scale-chromatic/src/sequential-multi/cividis.js
  7370. function cividis_default(t) {
  7371. t = Math.max(0, Math.min(1, t));
  7372. return "rgb(" + Math.max(0, Math.min(255, Math.round(-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57))))))) + ", " + Math.max(0, Math.min(255, Math.round(32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37))))))) + ", " + Math.max(0, Math.min(255, Math.round(81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67))))))) + ")";
  7373. }
  7374. // node_modules/d3-scale-chromatic/src/sequential-multi/cubehelix.js
  7375. var cubehelix_default2 = cubehelixLong(cubehelix(300, 0.5, 0), cubehelix(-240, 0.5, 1));
  7376. // node_modules/d3-scale-chromatic/src/sequential-multi/rainbow.js
  7377. var warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.5, 0.8));
  7378. var cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.5, 0.8));
  7379. var c = cubehelix();
  7380. function rainbow_default(t) {
  7381. if (t < 0 || t > 1)
  7382. t -= Math.floor(t);
  7383. var ts = Math.abs(t - 0.5);
  7384. c.h = 360 * t - 100;
  7385. c.s = 1.5 - 1.5 * ts;
  7386. c.l = 0.8 - 0.9 * ts;
  7387. return c + "";
  7388. }
  7389. // node_modules/d3-scale-chromatic/src/sequential-multi/sinebow.js
  7390. var c2 = rgb();
  7391. var pi_1_3 = Math.PI / 3;
  7392. var pi_2_3 = Math.PI * 2 / 3;
  7393. function sinebow_default(t) {
  7394. var x;
  7395. t = (0.5 - t) * Math.PI;
  7396. c2.r = 255 * (x = Math.sin(t)) * x;
  7397. c2.g = 255 * (x = Math.sin(t + pi_1_3)) * x;
  7398. c2.b = 255 * (x = Math.sin(t + pi_2_3)) * x;
  7399. return c2 + "";
  7400. }
  7401. // node_modules/d3-scale-chromatic/src/sequential-multi/turbo.js
  7402. function turbo_default(t) {
  7403. t = Math.max(0, Math.min(1, t));
  7404. return "rgb(" + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + ", " + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + ", " + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66))))))) + ")";
  7405. }
  7406. // node_modules/d3-scale-chromatic/src/sequential-multi/viridis.js
  7407. function ramp(range2) {
  7408. var n = range2.length;
  7409. return function(t) {
  7410. return range2[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
  7411. };
  7412. }
  7413. var viridis_default = ramp(colors_default("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
  7414. var magma = ramp(colors_default("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
  7415. var inferno = ramp(colors_default("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
  7416. var plasma = ramp(colors_default("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
  7417. // node_modules/d3-shape/src/math.js
  7418. var cos2 = Math.cos;
  7419. var min2 = Math.min;
  7420. var sin2 = Math.sin;
  7421. var sqrt3 = Math.sqrt;
  7422. var pi3 = Math.PI;
  7423. var halfPi2 = pi3 / 2;
  7424. var tau3 = 2 * pi3;
  7425. // node_modules/d3-shape/src/symbol/asterisk.js
  7426. var sqrt32 = sqrt3(3);
  7427. var asterisk_default = {
  7428. draw(context, size) {
  7429. const r = sqrt3(size + min2(size / 28, 0.75)) * 0.59436;
  7430. const t = r / 2;
  7431. const u = t * sqrt32;
  7432. context.moveTo(0, r);
  7433. context.lineTo(0, -r);
  7434. context.moveTo(-u, -t);
  7435. context.lineTo(u, t);
  7436. context.moveTo(-u, t);
  7437. context.lineTo(u, -t);
  7438. }
  7439. };
  7440. // node_modules/d3-shape/src/symbol/circle.js
  7441. var circle_default2 = {
  7442. draw(context, size) {
  7443. const r = sqrt3(size / pi3);
  7444. context.moveTo(r, 0);
  7445. context.arc(0, 0, r, 0, tau3);
  7446. }
  7447. };
  7448. // node_modules/d3-shape/src/symbol/cross.js
  7449. var cross_default = {
  7450. draw(context, size) {
  7451. const r = sqrt3(size / 5) / 2;
  7452. context.moveTo(-3 * r, -r);
  7453. context.lineTo(-r, -r);
  7454. context.lineTo(-r, -3 * r);
  7455. context.lineTo(r, -3 * r);
  7456. context.lineTo(r, -r);
  7457. context.lineTo(3 * r, -r);
  7458. context.lineTo(3 * r, r);
  7459. context.lineTo(r, r);
  7460. context.lineTo(r, 3 * r);
  7461. context.lineTo(-r, 3 * r);
  7462. context.lineTo(-r, r);
  7463. context.lineTo(-3 * r, r);
  7464. context.closePath();
  7465. }
  7466. };
  7467. // node_modules/d3-shape/src/symbol/diamond.js
  7468. var tan30 = sqrt3(1 / 3);
  7469. var tan30_2 = tan30 * 2;
  7470. var diamond_default = {
  7471. draw(context, size) {
  7472. const y = sqrt3(size / tan30_2);
  7473. const x = y * tan30;
  7474. context.moveTo(0, -y);
  7475. context.lineTo(x, 0);
  7476. context.lineTo(0, y);
  7477. context.lineTo(-x, 0);
  7478. context.closePath();
  7479. }
  7480. };
  7481. // node_modules/d3-shape/src/symbol/diamond2.js
  7482. var diamond2_default = {
  7483. draw(context, size) {
  7484. const r = sqrt3(size) * 0.62625;
  7485. context.moveTo(0, -r);
  7486. context.lineTo(r, 0);
  7487. context.lineTo(0, r);
  7488. context.lineTo(-r, 0);
  7489. context.closePath();
  7490. }
  7491. };
  7492. // node_modules/d3-shape/src/symbol/plus.js
  7493. var plus_default = {
  7494. draw(context, size) {
  7495. const r = sqrt3(size - min2(size / 7, 2)) * 0.87559;
  7496. context.moveTo(-r, 0);
  7497. context.lineTo(r, 0);
  7498. context.moveTo(0, r);
  7499. context.lineTo(0, -r);
  7500. }
  7501. };
  7502. // node_modules/d3-shape/src/symbol/square.js
  7503. var square_default = {
  7504. draw(context, size) {
  7505. const w = sqrt3(size);
  7506. const x = -w / 2;
  7507. context.rect(x, x, w, w);
  7508. }
  7509. };
  7510. // node_modules/d3-shape/src/symbol/square2.js
  7511. var square2_default = {
  7512. draw(context, size) {
  7513. const r = sqrt3(size) * 0.4431;
  7514. context.moveTo(r, r);
  7515. context.lineTo(r, -r);
  7516. context.lineTo(-r, -r);
  7517. context.lineTo(-r, r);
  7518. context.closePath();
  7519. }
  7520. };
  7521. // node_modules/d3-shape/src/symbol/star.js
  7522. var ka = 0.8908130915292852;
  7523. var kr = sin2(pi3 / 10) / sin2(7 * pi3 / 10);
  7524. var kx = sin2(tau3 / 10) * kr;
  7525. var ky = -cos2(tau3 / 10) * kr;
  7526. var star_default = {
  7527. draw(context, size) {
  7528. const r = sqrt3(size * ka);
  7529. const x = kx * r;
  7530. const y = ky * r;
  7531. context.moveTo(0, -r);
  7532. context.lineTo(x, y);
  7533. for (let i = 1;i < 5; ++i) {
  7534. const a = tau3 * i / 5;
  7535. const c3 = cos2(a);
  7536. const s = sin2(a);
  7537. context.lineTo(s * r, -c3 * r);
  7538. context.lineTo(c3 * x - s * y, s * x + c3 * y);
  7539. }
  7540. context.closePath();
  7541. }
  7542. };
  7543. // node_modules/d3-shape/src/symbol/triangle.js
  7544. var sqrt33 = sqrt3(3);
  7545. var triangle_default = {
  7546. draw(context, size) {
  7547. const y = -sqrt3(size / (sqrt33 * 3));
  7548. context.moveTo(0, y * 2);
  7549. context.lineTo(-sqrt33 * y, -y);
  7550. context.lineTo(sqrt33 * y, -y);
  7551. context.closePath();
  7552. }
  7553. };
  7554. // node_modules/d3-shape/src/symbol/triangle2.js
  7555. var sqrt34 = sqrt3(3);
  7556. var triangle2_default = {
  7557. draw(context, size) {
  7558. const s = sqrt3(size) * 0.6824;
  7559. const t = s / 2;
  7560. const u = s * sqrt34 / 2;
  7561. context.moveTo(0, -s);
  7562. context.lineTo(u, t);
  7563. context.lineTo(-u, t);
  7564. context.closePath();
  7565. }
  7566. };
  7567. // node_modules/d3-shape/src/symbol/wye.js
  7568. var c3 = -0.5;
  7569. var s = sqrt3(3) / 2;
  7570. var k = 1 / sqrt3(12);
  7571. var a = (k / 2 + 1) * 3;
  7572. var wye_default = {
  7573. draw(context, size) {
  7574. const r = sqrt3(size / a);
  7575. const x05 = r / 2, y05 = r * k;
  7576. const x12 = x05, y12 = r * k + r;
  7577. const x2 = -x12, y2 = y12;
  7578. context.moveTo(x05, y05);
  7579. context.lineTo(x12, y12);
  7580. context.lineTo(x2, y2);
  7581. context.lineTo(c3 * x05 - s * y05, s * x05 + c3 * y05);
  7582. context.lineTo(c3 * x12 - s * y12, s * x12 + c3 * y12);
  7583. context.lineTo(c3 * x2 - s * y2, s * x2 + c3 * y2);
  7584. context.lineTo(c3 * x05 + s * y05, c3 * y05 - s * x05);
  7585. context.lineTo(c3 * x12 + s * y12, c3 * y12 - s * x12);
  7586. context.lineTo(c3 * x2 + s * y2, c3 * y2 - s * x2);
  7587. context.closePath();
  7588. }
  7589. };
  7590. // node_modules/d3-shape/src/symbol/times.js
  7591. var times_default = {
  7592. draw(context, size) {
  7593. const r = sqrt3(size - min2(size / 6, 1.7)) * 0.6189;
  7594. context.moveTo(-r, -r);
  7595. context.lineTo(r, r);
  7596. context.moveTo(-r, r);
  7597. context.lineTo(r, -r);
  7598. }
  7599. };
  7600. // node_modules/d3-shape/src/symbol.js
  7601. var symbolsFill = [
  7602. circle_default2,
  7603. cross_default,
  7604. diamond_default,
  7605. square_default,
  7606. star_default,
  7607. triangle_default,
  7608. wye_default
  7609. ];
  7610. var symbolsStroke = [
  7611. circle_default2,
  7612. plus_default,
  7613. times_default,
  7614. triangle2_default,
  7615. asterisk_default,
  7616. square2_default,
  7617. diamond2_default
  7618. ];
  7619. // node_modules/d3-zoom/src/transform.js
  7620. function Transform(k2, x, y) {
  7621. this.k = k2;
  7622. this.x = x;
  7623. this.y = y;
  7624. }
  7625. Transform.prototype = {
  7626. constructor: Transform,
  7627. scale: function(k2) {
  7628. return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
  7629. },
  7630. translate: function(x, y) {
  7631. return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
  7632. },
  7633. apply: function(point2) {
  7634. return [point2[0] * this.k + this.x, point2[1] * this.k + this.y];
  7635. },
  7636. applyX: function(x) {
  7637. return x * this.k + this.x;
  7638. },
  7639. applyY: function(y) {
  7640. return y * this.k + this.y;
  7641. },
  7642. invert: function(location) {
  7643. return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
  7644. },
  7645. invertX: function(x) {
  7646. return (x - this.x) / this.k;
  7647. },
  7648. invertY: function(y) {
  7649. return (y - this.y) / this.k;
  7650. },
  7651. rescaleX: function(x) {
  7652. return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
  7653. },
  7654. rescaleY: function(y) {
  7655. return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
  7656. },
  7657. toString: function() {
  7658. return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
  7659. }
  7660. };
  7661. var identity5 = new Transform(1, 0, 0);
  7662. transform.prototype = Transform.prototype;
  7663. function transform(node) {
  7664. while (!node.__zoom)
  7665. if (!(node = node.parentNode))
  7666. return identity5;
  7667. return node.__zoom;
  7668. }
  7669. // node_modules/@observablehq/plot/src/defined.js
  7670. function defined(x) {
  7671. return x != null && !Number.isNaN(x);
  7672. }
  7673. function ascendingDefined2(a2, b) {
  7674. return +defined(b) - +defined(a2) || ascending(a2, b);
  7675. }
  7676. function descendingDefined(a2, b) {
  7677. return +defined(b) - +defined(a2) || descending(a2, b);
  7678. }
  7679. function nonempty(x) {
  7680. return x != null && `${x}` !== "";
  7681. }
  7682. function finite(x) {
  7683. return isFinite(x) ? x : NaN;
  7684. }
  7685. function positive(x) {
  7686. return x > 0 && isFinite(x) ? x : NaN;
  7687. }
  7688. function negative(x) {
  7689. return x < 0 && isFinite(x) ? x : NaN;
  7690. }
  7691. // node_modules/isoformat/src/format.js
  7692. function format2(date2, fallback) {
  7693. if (!(date2 instanceof Date))
  7694. date2 = new Date(+date2);
  7695. if (isNaN(date2))
  7696. return typeof fallback === "function" ? fallback(date2) : fallback;
  7697. const hours = date2.getUTCHours();
  7698. const minutes = date2.getUTCMinutes();
  7699. const seconds2 = date2.getUTCSeconds();
  7700. const milliseconds2 = date2.getUTCMilliseconds();
  7701. return `${formatYear2(date2.getUTCFullYear(), 4)}-${pad2(date2.getUTCMonth() + 1, 2)}-${pad2(date2.getUTCDate(), 2)}${hours || minutes || seconds2 || milliseconds2 ? `T${pad2(hours, 2)}:${pad2(minutes, 2)}${seconds2 || milliseconds2 ? `:${pad2(seconds2, 2)}${milliseconds2 ? `.${pad2(milliseconds2, 3)}` : ``}` : ``}Z` : ``}`;
  7702. }
  7703. function formatYear2(year) {
  7704. return year < 0 ? `-${pad2(-year, 6)}` : year > 9999 ? `+${pad2(year, 6)}` : pad2(year, 4);
  7705. }
  7706. function pad2(value, width) {
  7707. return `${value}`.padStart(width, "0");
  7708. }
  7709. // node_modules/isoformat/src/parse.js
  7710. var re2 = /^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;
  7711. function parse(string, fallback) {
  7712. if (!re2.test(string += ""))
  7713. return typeof fallback === "function" ? fallback(string) : fallback;
  7714. return new Date(string);
  7715. }
  7716. // node_modules/@observablehq/plot/src/order.js
  7717. function orderof(values) {
  7718. if (values == null)
  7719. return;
  7720. const first = values[0];
  7721. const last = values[values.length - 1];
  7722. return descending(first, last);
  7723. }
  7724. // node_modules/@observablehq/plot/src/time.js
  7725. var durationSecond2 = 1000;
  7726. var durationMinute2 = durationSecond2 * 60;
  7727. var durationHour2 = durationMinute2 * 60;
  7728. var durationDay2 = durationHour2 * 24;
  7729. var durationWeek2 = durationDay2 * 7;
  7730. var durationMonth2 = durationDay2 * 30;
  7731. var durationYear2 = durationDay2 * 365;
  7732. var tickIntervals = [
  7733. ["millisecond", 1],
  7734. ["2 milliseconds", 2],
  7735. ["5 milliseconds", 5],
  7736. ["10 milliseconds", 10],
  7737. ["20 milliseconds", 20],
  7738. ["50 milliseconds", 50],
  7739. ["100 milliseconds", 100],
  7740. ["200 milliseconds", 200],
  7741. ["500 milliseconds", 500],
  7742. ["second", durationSecond2],
  7743. ["5 seconds", 5 * durationSecond2],
  7744. ["15 seconds", 15 * durationSecond2],
  7745. ["30 seconds", 30 * durationSecond2],
  7746. ["minute", durationMinute2],
  7747. ["5 minutes", 5 * durationMinute2],
  7748. ["15 minutes", 15 * durationMinute2],
  7749. ["30 minutes", 30 * durationMinute2],
  7750. ["hour", durationHour2],
  7751. ["3 hours", 3 * durationHour2],
  7752. ["6 hours", 6 * durationHour2],
  7753. ["12 hours", 12 * durationHour2],
  7754. ["day", durationDay2],
  7755. ["2 days", 2 * durationDay2],
  7756. ["week", durationWeek2],
  7757. ["2 weeks", 2 * durationWeek2],
  7758. ["month", durationMonth2],
  7759. ["3 months", 3 * durationMonth2],
  7760. ["6 months", 6 * durationMonth2],
  7761. ["year", durationYear2],
  7762. ["2 years", 2 * durationYear2],
  7763. ["5 years", 5 * durationYear2],
  7764. ["10 years", 10 * durationYear2],
  7765. ["20 years", 20 * durationYear2],
  7766. ["50 years", 50 * durationYear2],
  7767. ["100 years", 100 * durationYear2]
  7768. ];
  7769. var durations = new Map([
  7770. ["second", durationSecond2],
  7771. ["minute", durationMinute2],
  7772. ["hour", durationHour2],
  7773. ["day", durationDay2],
  7774. ["monday", durationWeek2],
  7775. ["tuesday", durationWeek2],
  7776. ["wednesday", durationWeek2],
  7777. ["thursday", durationWeek2],
  7778. ["friday", durationWeek2],
  7779. ["saturday", durationWeek2],
  7780. ["sunday", durationWeek2],
  7781. ["week", durationWeek2],
  7782. ["month", durationMonth2],
  7783. ["year", durationYear2]
  7784. ]);
  7785. var timeIntervals = new Map([
  7786. ["second", second],
  7787. ["minute", timeMinute],
  7788. ["hour", timeHour],
  7789. ["day", timeDay],
  7790. ["monday", timeMonday],
  7791. ["tuesday", timeTuesday],
  7792. ["wednesday", timeWednesday],
  7793. ["thursday", timeThursday],
  7794. ["friday", timeFriday],
  7795. ["saturday", timeSaturday],
  7796. ["sunday", timeSunday],
  7797. ["week", timeSunday],
  7798. ["month", timeMonth],
  7799. ["year", timeYear]
  7800. ]);
  7801. var utcIntervals = new Map([
  7802. ["second", second],
  7803. ["minute", utcMinute],
  7804. ["hour", utcHour],
  7805. ["day", unixDay],
  7806. ["monday", utcMonday],
  7807. ["tuesday", utcTuesday],
  7808. ["wednesday", utcWednesday],
  7809. ["thursday", utcThursday],
  7810. ["friday", utcFriday],
  7811. ["saturday", utcSaturday],
  7812. ["sunday", utcSunday],
  7813. ["week", utcSunday],
  7814. ["month", utcMonth],
  7815. ["year", utcYear]
  7816. ]);
  7817. var intervalDuration = Symbol("intervalDuration");
  7818. var intervalType = Symbol("intervalType");
  7819. for (const [name, interval2] of timeIntervals) {
  7820. interval2[intervalDuration] = durations.get(name);
  7821. interval2[intervalType] = "time";
  7822. }
  7823. for (const [name, interval2] of utcIntervals) {
  7824. interval2[intervalDuration] = durations.get(name);
  7825. interval2[intervalType] = "utc";
  7826. }
  7827. var utcFormatIntervals = [
  7828. ["year", utcYear, "utc"],
  7829. ["month", utcMonth, "utc"],
  7830. ["day", unixDay, "utc", 6 * durationMonth2],
  7831. ["hour", utcHour, "utc", 3 * durationDay2],
  7832. ["minute", utcMinute, "utc", 6 * durationHour2],
  7833. ["second", second, "utc", 30 * durationMinute2]
  7834. ];
  7835. var timeFormatIntervals = [
  7836. ["year", timeYear, "time"],
  7837. ["month", timeMonth, "time"],
  7838. ["day", timeDay, "time", 6 * durationMonth2],
  7839. ["hour", timeHour, "time", 3 * durationDay2],
  7840. ["minute", timeMinute, "time", 6 * durationHour2],
  7841. ["second", second, "time", 30 * durationMinute2]
  7842. ];
  7843. var formatIntervals = [
  7844. utcFormatIntervals[0],
  7845. timeFormatIntervals[0],
  7846. utcFormatIntervals[1],
  7847. timeFormatIntervals[1],
  7848. utcFormatIntervals[2],
  7849. timeFormatIntervals[2],
  7850. ...utcFormatIntervals.slice(3)
  7851. ];
  7852. function parseTimeInterval(input) {
  7853. let name = `${input}`.toLowerCase();
  7854. if (name.endsWith("s"))
  7855. name = name.slice(0, -1);
  7856. let period = 1;
  7857. const match = /^(?:(\d+)\s+)/.exec(name);
  7858. if (match) {
  7859. name = name.slice(match[0].length);
  7860. period = +match[1];
  7861. }
  7862. switch (name) {
  7863. case "quarter":
  7864. name = "month";
  7865. period *= 3;
  7866. break;
  7867. case "half":
  7868. name = "month";
  7869. period *= 6;
  7870. break;
  7871. }
  7872. let interval2 = utcIntervals.get(name);
  7873. if (!interval2)
  7874. throw new Error(`unknown interval: ${input}`);
  7875. if (period > 1 && !interval2.every)
  7876. throw new Error(`non-periodic interval: ${name}`);
  7877. return [name, period];
  7878. }
  7879. function timeInterval2(input) {
  7880. return asInterval(parseTimeInterval(input), "time");
  7881. }
  7882. function utcInterval(input) {
  7883. return asInterval(parseTimeInterval(input), "utc");
  7884. }
  7885. function asInterval([name, period], type2) {
  7886. let interval2 = (type2 === "time" ? timeIntervals : utcIntervals).get(name);
  7887. if (period > 1) {
  7888. interval2 = interval2.every(period);
  7889. interval2[intervalDuration] = durations.get(name) * period;
  7890. interval2[intervalType] = type2;
  7891. }
  7892. return interval2;
  7893. }
  7894. function generalizeTimeInterval(interval2, n) {
  7895. if (!(n > 1))
  7896. return;
  7897. const duration = interval2[intervalDuration];
  7898. if (!tickIntervals.some(([, d]) => d === duration))
  7899. return;
  7900. if (duration % durationDay2 === 0 && durationDay2 < duration && duration < durationMonth2)
  7901. return;
  7902. const [i] = tickIntervals[bisector(([, step]) => Math.log(step)).center(tickIntervals, Math.log(duration * n))];
  7903. return (interval2[intervalType] === "time" ? timeInterval2 : utcInterval)(i);
  7904. }
  7905. function formatTimeInterval(name, type2, anchor) {
  7906. const format3 = type2 === "time" ? timeFormat : utcFormat;
  7907. if (anchor == null) {
  7908. return format3(name === "year" ? "%Y" : name === "month" ? "%Y-%m" : name === "day" ? "%Y-%m-%d" : name === "hour" || name === "minute" ? "%Y-%m-%dT%H:%M" : name === "second" ? "%Y-%m-%dT%H:%M:%S" : "%Y-%m-%dT%H:%M:%S.%L");
  7909. }
  7910. const template = getTimeTemplate(anchor);
  7911. switch (name) {
  7912. case "millisecond":
  7913. return formatConditional(format3(".%L"), format3(":%M:%S"), template);
  7914. case "second":
  7915. return formatConditional(format3(":%S"), format3("%-I:%M"), template);
  7916. case "minute":
  7917. return formatConditional(format3("%-I:%M"), format3("%p"), template);
  7918. case "hour":
  7919. return formatConditional(format3("%-I %p"), format3("%b %-d"), template);
  7920. case "day":
  7921. return formatConditional(format3("%-d"), format3("%b"), template);
  7922. case "month":
  7923. return formatConditional(format3("%b"), format3("%Y"), template);
  7924. case "year":
  7925. return format3("%Y");
  7926. }
  7927. throw new Error("unable to format time ticks");
  7928. }
  7929. function getTimeTemplate(anchor) {
  7930. return anchor === "left" || anchor === "right" ? (f1, f2) => `
  7931. ${f1}
  7932. ${f2}` : anchor === "top" ? (f1, f2) => `${f2}
  7933. ${f1}` : (f1, f2) => `${f1}
  7934. ${f2}`;
  7935. }
  7936. function getFormatIntervals(type2) {
  7937. return type2 === "time" ? timeFormatIntervals : type2 === "utc" ? utcFormatIntervals : formatIntervals;
  7938. }
  7939. function inferTimeFormat(type2, dates, anchor) {
  7940. const step = max(pairs(dates, (a2, b) => Math.abs(b - a2)));
  7941. if (step < 1000)
  7942. return formatTimeInterval("millisecond", "utc", anchor);
  7943. for (const [name, interval2, intervalType2, maxStep] of getFormatIntervals(type2)) {
  7944. if (step > maxStep)
  7945. break;
  7946. if (name === "hour" && !step)
  7947. break;
  7948. if (dates.every((d) => interval2.floor(d) >= d))
  7949. return formatTimeInterval(name, intervalType2, anchor);
  7950. }
  7951. }
  7952. function formatConditional(format1, format22, template) {
  7953. return (x, i, X3) => {
  7954. const f1 = format1(x, i);
  7955. const f2 = format22(x, i);
  7956. const j = i - orderof(X3);
  7957. return i !== j && X3[j] !== undefined && f2 === format22(X3[j], j) ? f1 : template(f1, f2);
  7958. };
  7959. }
  7960. // node_modules/@observablehq/plot/src/options.js
  7961. var TypedArray = Object.getPrototypeOf(Uint8Array);
  7962. var objectToString = Object.prototype.toString;
  7963. function isArray(value) {
  7964. return value instanceof Array || value instanceof TypedArray;
  7965. }
  7966. function isNumberArray2(value) {
  7967. return value instanceof TypedArray && !isBigIntArray(value);
  7968. }
  7969. function isNumberType(type2) {
  7970. return type2?.prototype instanceof TypedArray && !isBigIntType(type2);
  7971. }
  7972. function isBigIntArray(value) {
  7973. return value instanceof BigInt64Array || value instanceof BigUint64Array;
  7974. }
  7975. function isBigIntType(type2) {
  7976. return type2 === BigInt64Array || type2 === BigUint64Array;
  7977. }
  7978. var reindex = Symbol("reindex");
  7979. function valueof(data, value, type2) {
  7980. const valueType = typeof value;
  7981. return valueType === "string" ? isArrowTable(data) ? maybeTypedArrowify(data.getChild(value), type2) : maybeTypedMap(data, field(value), type2) : valueType === "function" ? maybeTypedMap(data, value, type2) : valueType === "number" || value instanceof Date || valueType === "boolean" ? map2(data, constant(value), type2) : typeof value?.transform === "function" ? maybeTypedArrayify(value.transform(data), type2) : maybeTake(maybeTypedArrayify(value, type2), data?.[reindex]);
  7982. }
  7983. function maybeTake(values, index2) {
  7984. return values != null && index2 ? take(values, index2) : values;
  7985. }
  7986. function maybeTypedMap(data, f, type2) {
  7987. return map2(data, isNumberType(type2) ? (d, i) => coerceNumber(f(d, i)) : f, type2);
  7988. }
  7989. function maybeTypedArrayify(data, type2) {
  7990. return type2 === undefined ? arrayify2(data) : isArrowVector(data) ? maybeTypedArrowify(data, type2) : data instanceof type2 ? data : type2.from(data, isNumberType(type2) && !isNumberArray2(data) ? coerceNumber : undefined);
  7991. }
  7992. function maybeTypedArrowify(vector, type2) {
  7993. return vector == null ? vector : (type2 === undefined || type2 === Array) && isArrowDateType(vector.type) ? coerceDates(vectorToArray(vector)) : maybeTypedArrayify(vectorToArray(vector), type2);
  7994. }
  7995. function vectorToArray(vector) {
  7996. return vector.nullCount ? vector.toJSON() : vector.toArray();
  7997. }
  7998. var singleton = [null];
  7999. var field = (name) => (d) => {
  8000. const v = d[name];
  8001. return v === undefined && d.type === "Feature" ? d.properties?.[name] : v;
  8002. };
  8003. var indexOf = { transform: range2 };
  8004. var identity6 = { transform: (d) => d };
  8005. var one2 = () => 1;
  8006. var yes = () => true;
  8007. var string = (x) => x == null ? x : `${x}`;
  8008. var number5 = (x) => x == null ? x : +x;
  8009. var first = (x) => x ? x[0] : undefined;
  8010. var second2 = (x) => x ? x[1] : undefined;
  8011. var constant = (x) => () => x;
  8012. function percentile(reduce) {
  8013. const p = +`${reduce}`.slice(1) / 100;
  8014. return (I, f) => quantile(I, p, f);
  8015. }
  8016. function coerceNumbers(values) {
  8017. return isNumberArray2(values) ? values : map2(values, coerceNumber, Float64Array);
  8018. }
  8019. function coerceNumber(x) {
  8020. return x == null ? NaN : Number(x);
  8021. }
  8022. function coerceDates(values) {
  8023. return map2(values, coerceDate);
  8024. }
  8025. function coerceDate(x) {
  8026. return x instanceof Date && !isNaN(x) ? x : typeof x === "string" ? parse(x) : x == null || isNaN(x = Number(x)) ? undefined : new Date(x);
  8027. }
  8028. function maybeColorChannel(value, defaultValue) {
  8029. if (value === undefined)
  8030. value = defaultValue;
  8031. return value === null ? [undefined, "none"] : isColor(value) ? [undefined, value] : [value, undefined];
  8032. }
  8033. function maybeNumberChannel(value, defaultValue) {
  8034. if (value === undefined)
  8035. value = defaultValue;
  8036. return value === null || typeof value === "number" ? [undefined, value] : [value, undefined];
  8037. }
  8038. function maybeKeyword(input, name, allowed) {
  8039. if (input != null)
  8040. return keyword(input, name, allowed);
  8041. }
  8042. function keyword(input, name, allowed) {
  8043. const i = `${input}`.toLowerCase();
  8044. if (!allowed.includes(i))
  8045. throw new Error(`invalid ${name}: ${input}`);
  8046. return i;
  8047. }
  8048. function dataify(data) {
  8049. return isArrowTable(data) ? data : arrayify2(data);
  8050. }
  8051. function arrayify2(values) {
  8052. if (values == null || isArray(values))
  8053. return values;
  8054. if (isArrowVector(values))
  8055. return maybeTypedArrowify(values);
  8056. if (isGeoJSON(values)) {
  8057. switch (values.type) {
  8058. case "FeatureCollection":
  8059. return values.features;
  8060. case "GeometryCollection":
  8061. return values.geometries;
  8062. default:
  8063. return [values];
  8064. }
  8065. }
  8066. return Array.from(values);
  8067. }
  8068. function isGeoJSON(x) {
  8069. switch (x?.type) {
  8070. case "FeatureCollection":
  8071. case "GeometryCollection":
  8072. case "Feature":
  8073. case "LineString":
  8074. case "MultiLineString":
  8075. case "MultiPoint":
  8076. case "MultiPolygon":
  8077. case "Point":
  8078. case "Polygon":
  8079. case "Sphere":
  8080. return true;
  8081. default:
  8082. return false;
  8083. }
  8084. }
  8085. function map2(values, f, type2 = Array) {
  8086. return values == null ? values : values instanceof type2 ? values.map(f) : type2.from(values, f);
  8087. }
  8088. function slice(values, type2 = Array) {
  8089. return values instanceof type2 ? values.slice() : type2.from(values);
  8090. }
  8091. function hasX({ x, x1: x12, x2 }) {
  8092. return x !== undefined || x12 !== undefined || x2 !== undefined;
  8093. }
  8094. function hasY({ y, y1: y12, y2 }) {
  8095. return y !== undefined || y12 !== undefined || y2 !== undefined;
  8096. }
  8097. function hasXY(options) {
  8098. return hasX(options) || hasY(options) || options.interval !== undefined;
  8099. }
  8100. function isObject(option) {
  8101. return option?.toString === objectToString;
  8102. }
  8103. function isScaleOptions(option) {
  8104. return isObject(option) && (option.type !== undefined || option.domain !== undefined);
  8105. }
  8106. function isOptions(option) {
  8107. return isObject(option) && typeof option.transform !== "function";
  8108. }
  8109. function isDomainSort(sort2) {
  8110. return isOptions(sort2) && sort2.value === undefined && sort2.channel === undefined;
  8111. }
  8112. function maybeZero(x, x12, x2, x3 = identity6) {
  8113. if (x12 === undefined && x2 === undefined) {
  8114. x12 = 0, x2 = x === undefined ? x3 : x;
  8115. } else if (x12 === undefined) {
  8116. x12 = x === undefined ? 0 : x;
  8117. } else if (x2 === undefined) {
  8118. x2 = x === undefined ? 0 : x;
  8119. }
  8120. return [x12, x2];
  8121. }
  8122. function maybeTuple(x, y) {
  8123. return x === undefined && y === undefined ? [first, second2] : [x, y];
  8124. }
  8125. function maybeZ({ z, fill, stroke } = {}) {
  8126. if (z === undefined)
  8127. [z] = maybeColorChannel(fill);
  8128. if (z === undefined)
  8129. [z] = maybeColorChannel(stroke);
  8130. return z;
  8131. }
  8132. function lengthof(data) {
  8133. return isArray(data) ? data.length : data?.numRows;
  8134. }
  8135. function range2(data) {
  8136. const n = lengthof(data);
  8137. const r = new Uint32Array(n);
  8138. for (let i = 0;i < n; ++i)
  8139. r[i] = i;
  8140. return r;
  8141. }
  8142. function take(values, index2) {
  8143. return isArray(values) ? map2(index2, (i) => values[i], values.constructor) : map2(index2, (i) => values.at(i));
  8144. }
  8145. function subarray(I, i, j) {
  8146. return I.subarray ? I.subarray(i, j) : I.slice(i, j);
  8147. }
  8148. function keyof2(value) {
  8149. return value !== null && typeof value === "object" ? value.valueOf() : value;
  8150. }
  8151. function column(source) {
  8152. let value;
  8153. return [
  8154. {
  8155. transform: () => value,
  8156. label: labelof(source)
  8157. },
  8158. (v) => value = v
  8159. ];
  8160. }
  8161. function maybeColumn(source) {
  8162. return source == null ? [source] : column(source);
  8163. }
  8164. function labelof(value, defaultValue) {
  8165. return typeof value === "string" ? value : value && value.label !== undefined ? value.label : defaultValue;
  8166. }
  8167. function mid(x12, x2) {
  8168. return {
  8169. transform(data) {
  8170. const X12 = x12.transform(data);
  8171. const X22 = x2.transform(data);
  8172. return isTemporal(X12) || isTemporal(X22) ? map2(X12, (_, i) => new Date((+X12[i] + +X22[i]) / 2)) : map2(X12, (_, i) => (+X12[i] + +X22[i]) / 2, Float64Array);
  8173. },
  8174. label: x12.label
  8175. };
  8176. }
  8177. function maybeApplyInterval(V, scale) {
  8178. const t = maybeIntervalTransform(scale?.interval, scale?.type);
  8179. return t ? map2(V, t) : V;
  8180. }
  8181. function maybeIntervalTransform(interval2, type2) {
  8182. const i = maybeInterval(interval2, type2);
  8183. return i && ((v) => defined(v) ? i.floor(v) : v);
  8184. }
  8185. function maybeInterval(interval2, type2) {
  8186. if (interval2 == null)
  8187. return;
  8188. if (typeof interval2 === "number")
  8189. return numberInterval(interval2);
  8190. if (typeof interval2 === "string")
  8191. return (type2 === "time" ? timeInterval2 : utcInterval)(interval2);
  8192. if (typeof interval2.floor !== "function")
  8193. throw new Error("invalid interval; missing floor method");
  8194. if (typeof interval2.offset !== "function")
  8195. throw new Error("invalid interval; missing offset method");
  8196. return interval2;
  8197. }
  8198. function numberInterval(interval2) {
  8199. interval2 = +interval2;
  8200. if (0 < interval2 && interval2 < 1 && Number.isInteger(1 / interval2))
  8201. interval2 = -1 / interval2;
  8202. const n = Math.abs(interval2);
  8203. return interval2 < 0 ? {
  8204. floor: (d) => Math.floor(d * n) / n,
  8205. offset: (d, s2 = 1) => (d * n + Math.floor(s2)) / n,
  8206. range: (lo, hi) => range(Math.ceil(lo * n), hi * n).map((x) => x / n)
  8207. } : {
  8208. floor: (d) => Math.floor(d / n) * n,
  8209. offset: (d, s2 = 1) => d + n * Math.floor(s2),
  8210. range: (lo, hi) => range(Math.ceil(lo / n), hi / n).map((x) => x * n)
  8211. };
  8212. }
  8213. function maybeRangeInterval(interval2, type2) {
  8214. interval2 = maybeInterval(interval2, type2);
  8215. if (interval2 && typeof interval2.range !== "function")
  8216. throw new Error("invalid interval: missing range method");
  8217. return interval2;
  8218. }
  8219. function maybeNiceInterval(interval2, type2) {
  8220. interval2 = maybeRangeInterval(interval2, type2);
  8221. if (interval2 && typeof interval2.ceil !== "function")
  8222. throw new Error("invalid interval: missing ceil method");
  8223. return interval2;
  8224. }
  8225. function isInterval(t) {
  8226. return typeof t?.range === "function";
  8227. }
  8228. function maybeValue(value) {
  8229. return value === undefined || isOptions(value) ? value : { value };
  8230. }
  8231. function numberChannel(source) {
  8232. return source == null ? null : {
  8233. transform: (data) => valueof(data, source, Float64Array),
  8234. label: labelof(source)
  8235. };
  8236. }
  8237. function isIterable(value) {
  8238. return value && typeof value[Symbol.iterator] === "function";
  8239. }
  8240. function isTextual(values) {
  8241. for (const value of values) {
  8242. if (value == null)
  8243. continue;
  8244. return typeof value !== "object" || value instanceof Date;
  8245. }
  8246. }
  8247. function isOrdinal(values) {
  8248. for (const value of values) {
  8249. if (value == null)
  8250. continue;
  8251. const type2 = typeof value;
  8252. return type2 === "string" || type2 === "boolean";
  8253. }
  8254. }
  8255. function isTemporal(values) {
  8256. for (const value of values) {
  8257. if (value == null)
  8258. continue;
  8259. return value instanceof Date;
  8260. }
  8261. }
  8262. function isTemporalString(values) {
  8263. for (const value of values) {
  8264. if (value == null)
  8265. continue;
  8266. return typeof value === "string" && isNaN(value) && parse(value);
  8267. }
  8268. }
  8269. function isNumericString(values) {
  8270. for (const value of values) {
  8271. if (value == null)
  8272. continue;
  8273. if (typeof value !== "string")
  8274. return false;
  8275. if (!value.trim())
  8276. continue;
  8277. return !isNaN(value);
  8278. }
  8279. }
  8280. function isNumeric(values) {
  8281. for (const value of values) {
  8282. if (value == null)
  8283. continue;
  8284. return typeof value === "number";
  8285. }
  8286. }
  8287. function isEvery(values, is) {
  8288. let every;
  8289. for (const value of values) {
  8290. if (value == null)
  8291. continue;
  8292. if (!is(value))
  8293. return false;
  8294. every = true;
  8295. }
  8296. return every;
  8297. }
  8298. var namedColors = new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));
  8299. function isColor(value) {
  8300. if (typeof value !== "string")
  8301. return false;
  8302. value = value.toLowerCase().trim();
  8303. return /^#[0-9a-f]{3,8}$/.test(value) || /^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(value) || namedColors.has(value);
  8304. }
  8305. function isOpacity(value) {
  8306. return typeof value === "number" && (0 <= value && value <= 1 || isNaN(value));
  8307. }
  8308. function isNoneish(value) {
  8309. return value == null || isNone(value);
  8310. }
  8311. function isNone(value) {
  8312. return /^\s*none\s*$/i.test(value);
  8313. }
  8314. function isRound(value) {
  8315. return /^\s*round\s*$/i.test(value);
  8316. }
  8317. function maybeAnchor(value, name) {
  8318. return maybeKeyword(value, name, [
  8319. "middle",
  8320. "top-left",
  8321. "top",
  8322. "top-right",
  8323. "right",
  8324. "bottom-right",
  8325. "bottom",
  8326. "bottom-left",
  8327. "left"
  8328. ]);
  8329. }
  8330. function maybeFrameAnchor(value = "middle") {
  8331. return maybeAnchor(value, "frameAnchor");
  8332. }
  8333. function inherit2(options = {}, ...rest) {
  8334. let o = options;
  8335. for (const defaults of rest) {
  8336. for (const key in defaults) {
  8337. if (o[key] === undefined) {
  8338. const value = defaults[key];
  8339. if (o === options)
  8340. o = { ...o, [key]: value };
  8341. else
  8342. o[key] = value;
  8343. }
  8344. }
  8345. }
  8346. return o;
  8347. }
  8348. function named2(things) {
  8349. console.warn("named iterables are deprecated; please use an object instead");
  8350. const names = new Set;
  8351. return Object.fromEntries(Array.from(things, (thing) => {
  8352. const { name } = thing;
  8353. if (name == null)
  8354. throw new Error("missing name");
  8355. const key = `${name}`;
  8356. if (key === "__proto__")
  8357. throw new Error(`illegal name: ${key}`);
  8358. if (names.has(key))
  8359. throw new Error(`duplicate name: ${key}`);
  8360. names.add(key);
  8361. return [name, thing];
  8362. }));
  8363. }
  8364. function maybeNamed(things) {
  8365. return isIterable(things) ? named2(things) : things;
  8366. }
  8367. function maybeClip(clip) {
  8368. if (clip === true)
  8369. clip = "frame";
  8370. else if (clip === false)
  8371. clip = null;
  8372. else if (!isGeoJSON(clip) && clip != null) {
  8373. clip = keyword(clip, "clip", ["frame", "sphere"]);
  8374. if (clip === "sphere")
  8375. clip = { type: "Sphere" };
  8376. }
  8377. return clip;
  8378. }
  8379. function isArrowTable(value) {
  8380. return value && typeof value.getChild === "function" && typeof value.toArray === "function" && value.schema && Array.isArray(value.schema.fields);
  8381. }
  8382. function isArrowVector(value) {
  8383. return value && typeof value.toArray === "function" && value.type;
  8384. }
  8385. function isArrowDateType(type2) {
  8386. return type2 && (type2.typeId === 8 || type2.typeId === 10) && type2.unit === 1;
  8387. }
  8388. // node_modules/@observablehq/plot/src/scales/index.js
  8389. var position = Symbol("position");
  8390. var color2 = Symbol("color");
  8391. var radius = Symbol("radius");
  8392. var length2 = Symbol("length");
  8393. var opacity = Symbol("opacity");
  8394. var symbol = Symbol("symbol");
  8395. var projection2 = Symbol("projection");
  8396. var registry = new Map([
  8397. ["x", position],
  8398. ["y", position],
  8399. ["fx", position],
  8400. ["fy", position],
  8401. ["r", radius],
  8402. ["color", color2],
  8403. ["opacity", opacity],
  8404. ["symbol", symbol],
  8405. ["length", length2],
  8406. ["projection", projection2]
  8407. ]);
  8408. function isPosition(kind) {
  8409. return kind === position || kind === projection2;
  8410. }
  8411. function hasNumericRange(kind) {
  8412. return kind === position || kind === radius || kind === length2 || kind === opacity;
  8413. }
  8414. // node_modules/@observablehq/plot/src/symbol.js
  8415. var sqrt35 = Math.sqrt(3);
  8416. var sqrt4_3 = 2 / sqrt35;
  8417. var symbolHexagon = {
  8418. draw(context, size) {
  8419. const rx = Math.sqrt(size / Math.PI), ry = rx * sqrt4_3, hy = ry / 2;
  8420. context.moveTo(0, ry);
  8421. context.lineTo(rx, hy);
  8422. context.lineTo(rx, -hy);
  8423. context.lineTo(0, -ry);
  8424. context.lineTo(-rx, -hy);
  8425. context.lineTo(-rx, hy);
  8426. context.closePath();
  8427. }
  8428. };
  8429. var symbols = new Map([
  8430. ["asterisk", asterisk_default],
  8431. ["circle", circle_default2],
  8432. ["cross", cross_default],
  8433. ["diamond", diamond_default],
  8434. ["diamond2", diamond2_default],
  8435. ["hexagon", symbolHexagon],
  8436. ["plus", plus_default],
  8437. ["square", square_default],
  8438. ["square2", square2_default],
  8439. ["star", star_default],
  8440. ["times", times_default],
  8441. ["triangle", triangle_default],
  8442. ["triangle2", triangle2_default],
  8443. ["wye", wye_default]
  8444. ]);
  8445. function isSymbolObject(value) {
  8446. return value && typeof value.draw === "function";
  8447. }
  8448. function isSymbol(value) {
  8449. if (isSymbolObject(value))
  8450. return true;
  8451. if (typeof value !== "string")
  8452. return false;
  8453. return symbols.has(value.toLowerCase());
  8454. }
  8455. function maybeSymbol(symbol2) {
  8456. if (symbol2 == null || isSymbolObject(symbol2))
  8457. return symbol2;
  8458. const value = symbols.get(`${symbol2}`.toLowerCase());
  8459. if (value)
  8460. return value;
  8461. throw new Error(`invalid symbol: ${symbol2}`);
  8462. }
  8463. function maybeSymbolChannel(symbol2) {
  8464. if (symbol2 == null || isSymbolObject(symbol2))
  8465. return [undefined, symbol2];
  8466. if (typeof symbol2 === "string") {
  8467. const value = symbols.get(`${symbol2}`.toLowerCase());
  8468. if (value)
  8469. return [undefined, value];
  8470. }
  8471. return [symbol2, undefined];
  8472. }
  8473. // node_modules/@observablehq/plot/src/transforms/basic.js
  8474. function basic({ filter: f1, sort: s1, reverse: r1, transform: t13, initializer: i1, ...options } = {}, transform2) {
  8475. if (t13 === undefined) {
  8476. if (f1 != null)
  8477. t13 = filterTransform(f1);
  8478. if (s1 != null && !isDomainSort(s1))
  8479. t13 = composeTransform(t13, sortTransform(s1));
  8480. if (r1)
  8481. t13 = composeTransform(t13, reverseTransform);
  8482. }
  8483. if (transform2 != null && i1 != null)
  8484. throw new Error("transforms cannot be applied after initializers");
  8485. return {
  8486. ...options,
  8487. ...(s1 === null || isDomainSort(s1)) && { sort: s1 },
  8488. transform: composeTransform(t13, transform2)
  8489. };
  8490. }
  8491. function initializer({ filter: f1, sort: s1, reverse: r1, initializer: i1, ...options } = {}, initializer2) {
  8492. if (i1 === undefined) {
  8493. if (f1 != null)
  8494. i1 = filterTransform(f1);
  8495. if (s1 != null && !isDomainSort(s1))
  8496. i1 = composeInitializer(i1, sortTransform(s1));
  8497. if (r1)
  8498. i1 = composeInitializer(i1, reverseTransform);
  8499. }
  8500. return {
  8501. ...options,
  8502. ...(s1 === null || isDomainSort(s1)) && { sort: s1 },
  8503. initializer: composeInitializer(i1, initializer2)
  8504. };
  8505. }
  8506. function composeTransform(t13, t22) {
  8507. if (t13 == null)
  8508. return t22 === null ? undefined : t22;
  8509. if (t22 == null)
  8510. return t13 === null ? undefined : t13;
  8511. return function(data, facets, plotOptions) {
  8512. ({ data, facets } = t13.call(this, data, facets, plotOptions));
  8513. return t22.call(this, dataify(data), facets, plotOptions);
  8514. };
  8515. }
  8516. function composeInitializer(i1, i2) {
  8517. if (i1 == null)
  8518. return i2 === null ? undefined : i2;
  8519. if (i2 == null)
  8520. return i1 === null ? undefined : i1;
  8521. return function(data, facets, channels, ...args) {
  8522. let c1, d1, f1, c22, d2, f2;
  8523. ({ data: d1 = data, facets: f1 = facets, channels: c1 } = i1.call(this, data, facets, channels, ...args));
  8524. ({ data: d2 = d1, facets: f2 = f1, channels: c22 } = i2.call(this, d1, f1, { ...channels, ...c1 }, ...args));
  8525. return { data: d2, facets: f2, channels: { ...c1, ...c22 } };
  8526. };
  8527. }
  8528. function apply(options, t) {
  8529. return (options.initializer != null ? initializer : basic)(options, t);
  8530. }
  8531. function filterTransform(value) {
  8532. return (data, facets) => {
  8533. const V = valueof(data, value);
  8534. return { data, facets: facets.map((I) => I.filter((i) => V[i])) };
  8535. };
  8536. }
  8537. function reverseTransform(data, facets) {
  8538. return { data, facets: facets.map((I) => I.slice().reverse()) };
  8539. }
  8540. function sort2(order, { sort: sort3, ...options } = {}) {
  8541. return {
  8542. ...(isOptions(order) && order.channel !== undefined ? initializer : apply)(options, sortTransform(order)),
  8543. sort: isDomainSort(sort3) ? sort3 : null
  8544. };
  8545. }
  8546. function sortTransform(value) {
  8547. return (typeof value === "function" && value.length !== 1 ? sortData : sortValue)(value);
  8548. }
  8549. function sortData(compare) {
  8550. return (data, facets) => {
  8551. const compareData = isArray(data) ? (i, j) => compare(data[i], data[j]) : (i, j) => compare(data.get(i), data.get(j));
  8552. return { data, facets: facets.map((I) => I.slice().sort(compareData)) };
  8553. };
  8554. }
  8555. function sortValue(value) {
  8556. let channel, order;
  8557. ({ channel, value, order } = { ...maybeValue(value) });
  8558. const negate = channel?.startsWith("-");
  8559. if (negate)
  8560. channel = channel.slice(1);
  8561. if (order === undefined)
  8562. order = negate ? descendingDefined : ascendingDefined2;
  8563. if (typeof order !== "function") {
  8564. switch (`${order}`.toLowerCase()) {
  8565. case "ascending":
  8566. order = ascendingDefined2;
  8567. break;
  8568. case "descending":
  8569. order = descendingDefined;
  8570. break;
  8571. default:
  8572. throw new Error(`invalid order: ${order}`);
  8573. }
  8574. }
  8575. return (data, facets, channels) => {
  8576. let V;
  8577. if (channel === undefined) {
  8578. V = valueof(data, value);
  8579. } else {
  8580. if (channels === undefined)
  8581. throw new Error("channel sort requires an initializer");
  8582. V = channels[channel];
  8583. if (!V)
  8584. return {};
  8585. V = V.value;
  8586. }
  8587. const compareValue = (i, j) => order(V[i], V[j]);
  8588. return { data, facets: facets.map((I) => I.slice().sort(compareValue)) };
  8589. };
  8590. }
  8591. // node_modules/@observablehq/plot/src/transforms/group.js
  8592. function maybeReduce(reduce, value, fallback = invalidReduce) {
  8593. if (reduce == null)
  8594. return fallback(reduce);
  8595. if (typeof reduce.reduceIndex === "function")
  8596. return reduce;
  8597. if (typeof reduce.reduce === "function" && isObject(reduce))
  8598. return reduceReduce(reduce);
  8599. if (typeof reduce === "function")
  8600. return reduceFunction(reduce);
  8601. if (/^p\d{2}$/i.test(reduce))
  8602. return reduceAccessor(percentile(reduce));
  8603. switch (`${reduce}`.toLowerCase()) {
  8604. case "first":
  8605. return reduceFirst;
  8606. case "last":
  8607. return reduceLast;
  8608. case "identity":
  8609. return reduceIdentity;
  8610. case "count":
  8611. return reduceCount;
  8612. case "distinct":
  8613. return reduceDistinct;
  8614. case "sum":
  8615. return value == null ? reduceCount : reduceSum;
  8616. case "proportion":
  8617. return reduceProportion(value, "data");
  8618. case "proportion-facet":
  8619. return reduceProportion(value, "facet");
  8620. case "deviation":
  8621. return reduceAccessor(deviation);
  8622. case "min":
  8623. return reduceAccessor(min);
  8624. case "min-index":
  8625. return reduceAccessor(minIndex);
  8626. case "max":
  8627. return reduceAccessor(max);
  8628. case "max-index":
  8629. return reduceAccessor(maxIndex);
  8630. case "mean":
  8631. return reduceMaybeTemporalAccessor(mean);
  8632. case "median":
  8633. return reduceMaybeTemporalAccessor(median);
  8634. case "variance":
  8635. return reduceAccessor(variance);
  8636. case "mode":
  8637. return reduceAccessor(mode);
  8638. }
  8639. return fallback(reduce);
  8640. }
  8641. function invalidReduce(reduce) {
  8642. throw new Error(`invalid reduce: ${reduce}`);
  8643. }
  8644. function reduceReduce(reduce) {
  8645. console.warn("deprecated reduce interface; implement reduceIndex instead.");
  8646. return { ...reduce, reduceIndex: reduce.reduce.bind(reduce) };
  8647. }
  8648. function reduceFunction(f) {
  8649. return {
  8650. reduceIndex(I, X3, extent2) {
  8651. return f(take(X3, I), extent2);
  8652. }
  8653. };
  8654. }
  8655. function reduceAccessor(f) {
  8656. return {
  8657. reduceIndex(I, X3) {
  8658. return f(I, (i) => X3[i]);
  8659. }
  8660. };
  8661. }
  8662. function reduceMaybeTemporalAccessor(f) {
  8663. return {
  8664. reduceIndex(I, X3) {
  8665. const x = f(I, (i) => X3[i]);
  8666. return isTemporal(X3) ? new Date(x) : x;
  8667. }
  8668. };
  8669. }
  8670. var reduceIdentity = {
  8671. reduceIndex(I, X3) {
  8672. return take(X3, I);
  8673. }
  8674. };
  8675. var reduceFirst = {
  8676. reduceIndex(I, X3) {
  8677. return X3[I[0]];
  8678. }
  8679. };
  8680. var reduceLast = {
  8681. reduceIndex(I, X3) {
  8682. return X3[I[I.length - 1]];
  8683. }
  8684. };
  8685. var reduceCount = {
  8686. label: "Frequency",
  8687. reduceIndex(I) {
  8688. return I.length;
  8689. }
  8690. };
  8691. var reduceDistinct = {
  8692. label: "Distinct",
  8693. reduceIndex(I, X3) {
  8694. const s2 = new InternSet;
  8695. for (const i of I)
  8696. s2.add(X3[i]);
  8697. return s2.size;
  8698. }
  8699. };
  8700. var reduceSum = reduceAccessor(sum);
  8701. function reduceProportion(value, scope) {
  8702. return value == null ? { scope, label: "Frequency", reduceIndex: (I, V, basis2 = 1) => I.length / basis2 } : { scope, reduceIndex: (I, V, basis2 = 1) => sum(I, (i) => V[i]) / basis2 };
  8703. }
  8704. // node_modules/@observablehq/plot/src/channel.js
  8705. function createChannel(data, { scale, type: type2, value, filter: filter2, hint, label = labelof(value) }, name) {
  8706. if (hint === undefined && typeof value?.transform === "function")
  8707. hint = value.hint;
  8708. return inferChannelScale(name, {
  8709. scale,
  8710. type: type2,
  8711. value: valueof(data, value),
  8712. label,
  8713. filter: filter2,
  8714. hint
  8715. });
  8716. }
  8717. function createChannels(channels, data) {
  8718. return Object.fromEntries(Object.entries(channels).map(([name, channel]) => [name, createChannel(data, channel, name)]));
  8719. }
  8720. function valueObject(channels, scales) {
  8721. const values = Object.fromEntries(Object.entries(channels).map(([name, { scale: scaleName, value }]) => {
  8722. const scale = scaleName == null ? null : scales[scaleName];
  8723. return [name, scale == null ? value : map2(value, scale)];
  8724. }));
  8725. values.channels = channels;
  8726. return values;
  8727. }
  8728. function inferChannelScale(name, channel) {
  8729. const { scale, value } = channel;
  8730. if (scale === true || scale === "auto") {
  8731. switch (name) {
  8732. case "fill":
  8733. case "stroke":
  8734. case "color":
  8735. channel.scale = scale !== true && isEvery(value, isColor) ? null : "color";
  8736. channel.defaultScale = "color";
  8737. break;
  8738. case "fillOpacity":
  8739. case "strokeOpacity":
  8740. case "opacity":
  8741. channel.scale = scale !== true && isEvery(value, isOpacity) ? null : "opacity";
  8742. channel.defaultScale = "opacity";
  8743. break;
  8744. case "symbol":
  8745. if (scale !== true && isEvery(value, isSymbol)) {
  8746. channel.scale = null;
  8747. channel.value = map2(value, maybeSymbol);
  8748. } else {
  8749. channel.scale = "symbol";
  8750. }
  8751. channel.defaultScale = "symbol";
  8752. break;
  8753. default:
  8754. channel.scale = registry.has(name) ? name : null;
  8755. break;
  8756. }
  8757. } else if (scale === false) {
  8758. channel.scale = null;
  8759. } else if (scale != null && !registry.has(scale)) {
  8760. throw new Error(`unknown scale: ${scale}`);
  8761. }
  8762. return channel;
  8763. }
  8764. function channelDomain(data, facets, channels, facetChannels, options) {
  8765. const { order: defaultOrder, reverse: defaultReverse, reduce: defaultReduce = true, limit: defaultLimit } = options;
  8766. for (const x in options) {
  8767. if (!registry.has(x))
  8768. continue;
  8769. let { value: y, order = defaultOrder, reverse: reverse2 = defaultReverse, reduce = defaultReduce, limit = defaultLimit } = maybeValue(options[x]);
  8770. const negate = y?.startsWith("-");
  8771. if (negate)
  8772. y = y.slice(1);
  8773. order = order === undefined ? negate !== (y === "width" || y === "height") ? descendingGroup : ascendingGroup : maybeOrder(order);
  8774. if (reduce == null || reduce === false)
  8775. continue;
  8776. const X3 = x === "fx" || x === "fy" ? reindexFacetChannel(facets, facetChannels[x]) : findScaleChannel(channels, x);
  8777. if (!X3)
  8778. throw new Error(`missing channel for scale: ${x}`);
  8779. const XV = X3.value;
  8780. const [lo = 0, hi = Infinity] = isIterable(limit) ? limit : limit < 0 ? [limit] : [0, limit];
  8781. if (y == null) {
  8782. X3.domain = () => {
  8783. let domain = Array.from(new InternSet(XV));
  8784. if (reverse2)
  8785. domain = domain.reverse();
  8786. if (lo !== 0 || hi !== Infinity)
  8787. domain = domain.slice(lo, hi);
  8788. return domain;
  8789. };
  8790. } else {
  8791. const YV = y === "data" ? data : y === "height" ? difference(channels, "y1", "y2") : y === "width" ? difference(channels, "x1", "x2") : values(channels, y, y === "y" ? "y2" : y === "x" ? "x2" : undefined);
  8792. const reducer2 = maybeReduce(reduce === true ? "max" : reduce, YV);
  8793. X3.domain = () => {
  8794. let domain = rollups(range2(XV), (I) => reducer2.reduceIndex(I, YV), (i) => XV[i]);
  8795. if (order)
  8796. domain.sort(order);
  8797. if (reverse2)
  8798. domain.reverse();
  8799. if (lo !== 0 || hi !== Infinity)
  8800. domain = domain.slice(lo, hi);
  8801. return domain.map(first);
  8802. };
  8803. }
  8804. }
  8805. }
  8806. function findScaleChannel(channels, scale) {
  8807. for (const name in channels) {
  8808. const channel = channels[name];
  8809. if (channel.scale === scale)
  8810. return channel;
  8811. }
  8812. }
  8813. function reindexFacetChannel(facets, channel) {
  8814. const originalFacets = facets.original;
  8815. if (originalFacets === facets)
  8816. return channel;
  8817. const V1 = channel.value;
  8818. const V2 = channel.value = [];
  8819. for (let i = 0;i < originalFacets.length; ++i) {
  8820. const vi = V1[originalFacets[i][0]];
  8821. for (const j of facets[i])
  8822. V2[j] = vi;
  8823. }
  8824. return channel;
  8825. }
  8826. function difference(channels, k1, k2) {
  8827. const X12 = values(channels, k1);
  8828. const X22 = values(channels, k2);
  8829. return map2(X22, (x2, i) => Math.abs(x2 - X12[i]), Float64Array);
  8830. }
  8831. function values(channels, name, alias) {
  8832. let channel = channels[name];
  8833. if (!channel && alias !== undefined)
  8834. channel = channels[alias];
  8835. if (channel)
  8836. return channel.value;
  8837. throw new Error(`missing channel: ${name}`);
  8838. }
  8839. function maybeOrder(order) {
  8840. if (order == null || typeof order === "function")
  8841. return order;
  8842. switch (`${order}`.toLowerCase()) {
  8843. case "ascending":
  8844. return ascendingGroup;
  8845. case "descending":
  8846. return descendingGroup;
  8847. }
  8848. throw new Error(`invalid order: ${order}`);
  8849. }
  8850. function ascendingGroup([ak, av], [bk, bv]) {
  8851. return ascendingDefined2(av, bv) || ascendingDefined2(ak, bk);
  8852. }
  8853. function descendingGroup([ak, av], [bk, bv]) {
  8854. return descendingDefined(av, bv) || ascendingDefined2(ak, bk);
  8855. }
  8856. function getSource(channels, key) {
  8857. let channel = channels[key];
  8858. if (!channel)
  8859. return;
  8860. while (channel.source)
  8861. channel = channel.source;
  8862. return channel.source === null ? null : channel;
  8863. }
  8864. // node_modules/@observablehq/plot/src/scales/schemes.js
  8865. var categoricalSchemes = new Map([
  8866. ["accent", Accent_default],
  8867. ["category10", category10_default],
  8868. ["dark2", Dark2_default],
  8869. ["observable10", observable10_default],
  8870. ["paired", Paired_default],
  8871. ["pastel1", Pastel1_default],
  8872. ["pastel2", Pastel2_default],
  8873. ["set1", Set1_default],
  8874. ["set2", Set2_default],
  8875. ["set3", Set3_default],
  8876. ["tableau10", Tableau10_default]
  8877. ]);
  8878. function isCategoricalScheme(scheme28) {
  8879. return scheme28 != null && categoricalSchemes.has(`${scheme28}`.toLowerCase());
  8880. }
  8881. var ordinalSchemes = new Map([
  8882. ...categoricalSchemes,
  8883. ["brbg", scheme112(scheme, BrBG_default)],
  8884. ["prgn", scheme112(scheme2, PRGn_default)],
  8885. ["piyg", scheme112(scheme3, PiYG_default)],
  8886. ["puor", scheme112(scheme4, PuOr_default)],
  8887. ["rdbu", scheme112(scheme5, RdBu_default)],
  8888. ["rdgy", scheme112(scheme6, RdGy_default)],
  8889. ["rdylbu", scheme112(scheme7, RdYlBu_default)],
  8890. ["rdylgn", scheme112(scheme8, RdYlGn_default)],
  8891. ["spectral", scheme112(scheme9, Spectral_default)],
  8892. ["burd", scheme11r(scheme5, RdBu_default)],
  8893. ["buylrd", scheme11r(scheme7, RdYlBu_default)],
  8894. ["blues", scheme92(scheme22, Blues_default)],
  8895. ["greens", scheme92(scheme23, Greens_default)],
  8896. ["greys", scheme92(scheme24, Greys_default)],
  8897. ["oranges", scheme92(scheme27, Oranges_default)],
  8898. ["purples", scheme92(scheme25, Purples_default)],
  8899. ["reds", scheme92(scheme26, Reds_default)],
  8900. ["turbo", schemei(turbo_default)],
  8901. ["viridis", schemei(viridis_default)],
  8902. ["magma", schemei(magma)],
  8903. ["inferno", schemei(inferno)],
  8904. ["plasma", schemei(plasma)],
  8905. ["cividis", schemei(cividis_default)],
  8906. ["cubehelix", schemei(cubehelix_default2)],
  8907. ["warm", schemei(warm)],
  8908. ["cool", schemei(cool)],
  8909. ["bugn", scheme92(scheme10, BuGn_default)],
  8910. ["bupu", scheme92(scheme11, BuPu_default)],
  8911. ["gnbu", scheme92(scheme12, GnBu_default)],
  8912. ["orrd", scheme92(scheme13, OrRd_default)],
  8913. ["pubu", scheme92(scheme15, PuBu_default)],
  8914. ["pubugn", scheme92(scheme14, PuBuGn_default)],
  8915. ["purd", scheme92(scheme16, PuRd_default)],
  8916. ["rdpu", scheme92(scheme17, RdPu_default)],
  8917. ["ylgn", scheme92(scheme19, YlGn_default)],
  8918. ["ylgnbu", scheme92(scheme18, YlGnBu_default)],
  8919. ["ylorbr", scheme92(scheme20, YlOrBr_default)],
  8920. ["ylorrd", scheme92(scheme21, YlOrRd_default)],
  8921. ["rainbow", schemeicyclical(rainbow_default)],
  8922. ["sinebow", schemeicyclical(sinebow_default)]
  8923. ]);
  8924. function scheme92(scheme28, interpolate) {
  8925. return ({ length: n }) => {
  8926. if (n === 1)
  8927. return [scheme28[3][1]];
  8928. if (n === 2)
  8929. return [scheme28[3][1], scheme28[3][2]];
  8930. n = Math.max(3, Math.floor(n));
  8931. return n > 9 ? quantize_default(interpolate, n) : scheme28[n];
  8932. };
  8933. }
  8934. function scheme112(scheme28, interpolate) {
  8935. return ({ length: n }) => {
  8936. if (n === 2)
  8937. return [scheme28[3][0], scheme28[3][2]];
  8938. n = Math.max(3, Math.floor(n));
  8939. return n > 11 ? quantize_default(interpolate, n) : scheme28[n];
  8940. };
  8941. }
  8942. function scheme11r(scheme28, interpolate) {
  8943. return ({ length: n }) => {
  8944. if (n === 2)
  8945. return [scheme28[3][2], scheme28[3][0]];
  8946. n = Math.max(3, Math.floor(n));
  8947. return n > 11 ? quantize_default((t) => interpolate(1 - t), n) : scheme28[n].slice().reverse();
  8948. };
  8949. }
  8950. function schemei(interpolate) {
  8951. return ({ length: n }) => quantize_default(interpolate, Math.max(2, Math.floor(n)));
  8952. }
  8953. function schemeicyclical(interpolate) {
  8954. return ({ length: n }) => quantize_default(interpolate, Math.floor(n) + 1).slice(0, -1);
  8955. }
  8956. function ordinalScheme(scheme28) {
  8957. const s2 = `${scheme28}`.toLowerCase();
  8958. if (!ordinalSchemes.has(s2))
  8959. throw new Error(`unknown ordinal scheme: ${s2}`);
  8960. return ordinalSchemes.get(s2);
  8961. }
  8962. function ordinalRange(scheme28, length3) {
  8963. const s2 = ordinalScheme(scheme28);
  8964. const r = typeof s2 === "function" ? s2({ length: length3 }) : s2;
  8965. return r.length !== length3 ? r.slice(0, length3) : r;
  8966. }
  8967. function maybeBooleanRange(domain, scheme28 = "greys") {
  8968. const range3 = new Set;
  8969. const [f, t] = ordinalRange(scheme28, 2);
  8970. for (const value of domain) {
  8971. if (value == null)
  8972. continue;
  8973. if (value === true)
  8974. range3.add(t);
  8975. else if (value === false)
  8976. range3.add(f);
  8977. else
  8978. return;
  8979. }
  8980. return [...range3];
  8981. }
  8982. var quantitativeSchemes = new Map([
  8983. ["brbg", BrBG_default],
  8984. ["prgn", PRGn_default],
  8985. ["piyg", PiYG_default],
  8986. ["puor", PuOr_default],
  8987. ["rdbu", RdBu_default],
  8988. ["rdgy", RdGy_default],
  8989. ["rdylbu", RdYlBu_default],
  8990. ["rdylgn", RdYlGn_default],
  8991. ["spectral", Spectral_default],
  8992. ["burd", (t) => RdBu_default(1 - t)],
  8993. ["buylrd", (t) => RdYlBu_default(1 - t)],
  8994. ["blues", Blues_default],
  8995. ["greens", Greens_default],
  8996. ["greys", Greys_default],
  8997. ["purples", Purples_default],
  8998. ["reds", Reds_default],
  8999. ["oranges", Oranges_default],
  9000. ["turbo", turbo_default],
  9001. ["viridis", viridis_default],
  9002. ["magma", magma],
  9003. ["inferno", inferno],
  9004. ["plasma", plasma],
  9005. ["cividis", cividis_default],
  9006. ["cubehelix", cubehelix_default2],
  9007. ["warm", warm],
  9008. ["cool", cool],
  9009. ["bugn", BuGn_default],
  9010. ["bupu", BuPu_default],
  9011. ["gnbu", GnBu_default],
  9012. ["orrd", OrRd_default],
  9013. ["pubugn", PuBuGn_default],
  9014. ["pubu", PuBu_default],
  9015. ["purd", PuRd_default],
  9016. ["rdpu", RdPu_default],
  9017. ["ylgnbu", YlGnBu_default],
  9018. ["ylgn", YlGn_default],
  9019. ["ylorbr", YlOrBr_default],
  9020. ["ylorrd", YlOrRd_default],
  9021. ["rainbow", rainbow_default],
  9022. ["sinebow", sinebow_default]
  9023. ]);
  9024. function quantitativeScheme(scheme28) {
  9025. const s2 = `${scheme28}`.toLowerCase();
  9026. if (!quantitativeSchemes.has(s2))
  9027. throw new Error(`unknown quantitative scheme: ${s2}`);
  9028. return quantitativeSchemes.get(s2);
  9029. }
  9030. var divergingSchemes = new Set([
  9031. "brbg",
  9032. "prgn",
  9033. "piyg",
  9034. "puor",
  9035. "rdbu",
  9036. "rdgy",
  9037. "rdylbu",
  9038. "rdylgn",
  9039. "spectral",
  9040. "burd",
  9041. "buylrd"
  9042. ]);
  9043. function isDivergingScheme(scheme28) {
  9044. return scheme28 != null && divergingSchemes.has(`${scheme28}`.toLowerCase());
  9045. }
  9046. // node_modules/@observablehq/plot/src/scales/quantitative.js
  9047. var flip = (i) => (t) => i(1 - t);
  9048. var unit2 = [0, 1];
  9049. var interpolators = new Map([
  9050. ["number", number_default],
  9051. ["rgb", rgb_default],
  9052. ["hsl", hsl_default],
  9053. ["hcl", hcl_default],
  9054. ["lab", lab2]
  9055. ]);
  9056. function maybeInterpolator(interpolate) {
  9057. const i = `${interpolate}`.toLowerCase();
  9058. if (!interpolators.has(i))
  9059. throw new Error(`unknown interpolator: ${i}`);
  9060. return interpolators.get(i);
  9061. }
  9062. function createScaleQ(key, scale, channels, {
  9063. type: type2,
  9064. nice: nice2,
  9065. clamp,
  9066. zero: zero3,
  9067. domain = inferAutoDomain(key, channels),
  9068. unknown,
  9069. round,
  9070. scheme: scheme28,
  9071. interval: interval2,
  9072. range: range3 = registry.get(key) === radius ? inferRadialRange(channels, domain) : registry.get(key) === length2 ? inferLengthRange(channels, domain) : registry.get(key) === opacity ? unit2 : undefined,
  9073. interpolate = registry.get(key) === color2 ? scheme28 == null && range3 !== undefined ? rgb_default : quantitativeScheme(scheme28 !== undefined ? scheme28 : type2 === "cyclical" ? "rainbow" : "turbo") : round ? round_default : number_default,
  9074. reverse: reverse2
  9075. }) {
  9076. domain = maybeRepeat(domain);
  9077. interval2 = maybeRangeInterval(interval2, type2);
  9078. if (type2 === "cyclical" || type2 === "sequential")
  9079. type2 = "linear";
  9080. if (typeof interpolate !== "function")
  9081. interpolate = maybeInterpolator(interpolate);
  9082. reverse2 = !!reverse2;
  9083. if (range3 !== undefined) {
  9084. const n = domain.length;
  9085. const m = (range3 = maybeRepeat(range3)).length;
  9086. if (n !== m) {
  9087. if (interpolate.length === 1)
  9088. throw new Error("invalid piecewise interpolator");
  9089. interpolate = piecewise(interpolate, range3);
  9090. range3 = undefined;
  9091. }
  9092. }
  9093. if (interpolate.length === 1) {
  9094. if (reverse2) {
  9095. interpolate = flip(interpolate);
  9096. reverse2 = false;
  9097. }
  9098. if (range3 === undefined) {
  9099. range3 = Float64Array.from(domain, (_, i) => i / (domain.length - 1));
  9100. if (range3.length === 2)
  9101. range3 = unit2;
  9102. }
  9103. scale.interpolate((range3 === unit2 ? constant : interpolatePiecewise)(interpolate));
  9104. } else {
  9105. scale.interpolate(interpolate);
  9106. }
  9107. if (zero3) {
  9108. const [min3, max2] = extent(domain);
  9109. if (min3 > 0 || max2 < 0) {
  9110. domain = slice(domain);
  9111. const o = orderof(domain) || 1;
  9112. if (o === Math.sign(min3))
  9113. domain[0] = 0;
  9114. else
  9115. domain[domain.length - 1] = 0;
  9116. }
  9117. }
  9118. if (reverse2)
  9119. domain = reverse(domain);
  9120. scale.domain(domain).unknown(unknown);
  9121. if (nice2)
  9122. scale.nice(maybeNice(nice2, type2)), domain = scale.domain();
  9123. if (range3 !== undefined)
  9124. scale.range(range3);
  9125. if (clamp)
  9126. scale.clamp(clamp);
  9127. return { type: type2, domain, range: range3, scale, interpolate, interval: interval2 };
  9128. }
  9129. function maybeRepeat(values2) {
  9130. values2 = arrayify2(values2);
  9131. return values2.length >= 2 ? values2 : [values2[0], values2[0]];
  9132. }
  9133. function maybeNice(nice2, type2) {
  9134. return nice2 === true ? undefined : typeof nice2 === "number" ? nice2 : maybeNiceInterval(nice2, type2);
  9135. }
  9136. function createScaleLinear(key, channels, options) {
  9137. return createScaleQ(key, linear2(), channels, options);
  9138. }
  9139. function createScaleSqrt(key, channels, options) {
  9140. return createScalePow(key, channels, { ...options, exponent: 0.5 });
  9141. }
  9142. function createScalePow(key, channels, { exponent = 1, ...options }) {
  9143. return createScaleQ(key, pow2().exponent(exponent), channels, { ...options, type: "pow" });
  9144. }
  9145. function createScaleLog(key, channels, { base = 10, domain = inferLogDomain(channels), ...options }) {
  9146. return createScaleQ(key, log2().base(base), channels, { ...options, domain });
  9147. }
  9148. function createScaleSymlog(key, channels, { constant: constant2 = 1, ...options }) {
  9149. return createScaleQ(key, symlog().constant(constant2), channels, options);
  9150. }
  9151. function createScaleQuantile(key, channels, {
  9152. range: range3,
  9153. quantiles = range3 === undefined ? 5 : (range3 = [...range3]).length,
  9154. n = quantiles,
  9155. scheme: scheme28 = "rdylbu",
  9156. domain = inferQuantileDomain(channels),
  9157. unknown,
  9158. interpolate,
  9159. reverse: reverse2
  9160. }) {
  9161. if (range3 === undefined) {
  9162. range3 = interpolate !== undefined ? quantize_default(interpolate, n) : registry.get(key) === color2 ? ordinalRange(scheme28, n) : undefined;
  9163. }
  9164. if (domain.length > 0) {
  9165. domain = quantile2(domain, range3 === undefined ? { length: n } : range3).quantiles();
  9166. }
  9167. return createScaleThreshold(key, channels, { domain, range: range3, reverse: reverse2, unknown });
  9168. }
  9169. function createScaleQuantize(key, channels, {
  9170. range: range3,
  9171. n = range3 === undefined ? 5 : (range3 = [...range3]).length,
  9172. scheme: scheme28 = "rdylbu",
  9173. domain = inferAutoDomain(key, channels),
  9174. unknown,
  9175. interpolate,
  9176. reverse: reverse2
  9177. }) {
  9178. const [min3, max2] = extent(domain);
  9179. let thresholds;
  9180. if (range3 === undefined) {
  9181. thresholds = ticks(min3, max2, n);
  9182. if (thresholds[0] <= min3)
  9183. thresholds.splice(0, 1);
  9184. if (thresholds[thresholds.length - 1] >= max2)
  9185. thresholds.pop();
  9186. n = thresholds.length + 1;
  9187. range3 = interpolate !== undefined ? quantize_default(interpolate, n) : registry.get(key) === color2 ? ordinalRange(scheme28, n) : undefined;
  9188. } else {
  9189. thresholds = quantize_default(number_default(min3, max2), n + 1).slice(1, -1);
  9190. if (min3 instanceof Date)
  9191. thresholds = thresholds.map((x) => new Date(x));
  9192. }
  9193. if (orderof(arrayify2(domain)) < 0)
  9194. thresholds.reverse();
  9195. return createScaleThreshold(key, channels, { domain: thresholds, range: range3, reverse: reverse2, unknown });
  9196. }
  9197. function createScaleThreshold(key, channels, {
  9198. domain = [0],
  9199. unknown,
  9200. scheme: scheme28 = "rdylbu",
  9201. interpolate,
  9202. range: range3 = interpolate !== undefined ? quantize_default(interpolate, domain.length + 1) : registry.get(key) === color2 ? ordinalRange(scheme28, domain.length + 1) : undefined,
  9203. reverse: reverse2
  9204. }) {
  9205. domain = arrayify2(domain);
  9206. const sign2 = orderof(domain);
  9207. if (!isNaN(sign2) && !isOrdered(domain, sign2))
  9208. throw new Error(`the ${key} scale has a non-monotonic domain`);
  9209. if (reverse2)
  9210. range3 = reverse(range3);
  9211. return {
  9212. type: "threshold",
  9213. scale: threshold(sign2 < 0 ? reverse(domain) : domain, range3 === undefined ? [] : range3).unknown(unknown),
  9214. domain,
  9215. range: range3
  9216. };
  9217. }
  9218. function isOrdered(domain, sign2) {
  9219. for (let i = 1, n = domain.length, d = domain[0];i < n; ++i) {
  9220. const s2 = descending(d, d = domain[i]);
  9221. if (s2 !== 0 && s2 !== sign2)
  9222. return false;
  9223. }
  9224. return true;
  9225. }
  9226. function createScaleIdentity(key) {
  9227. return { type: "identity", scale: hasNumericRange(registry.get(key)) ? identity4() : (d) => d };
  9228. }
  9229. function inferDomain(channels, f = finite) {
  9230. return channels.length ? [
  9231. min(channels, ({ value }) => value === undefined ? value : min(value, f)),
  9232. max(channels, ({ value }) => value === undefined ? value : max(value, f))
  9233. ] : [0, 1];
  9234. }
  9235. function inferAutoDomain(key, channels) {
  9236. const type2 = registry.get(key);
  9237. return (type2 === radius || type2 === opacity || type2 === length2 ? inferZeroDomain : inferDomain)(channels);
  9238. }
  9239. function inferZeroDomain(channels) {
  9240. return [0, channels.length ? max(channels, ({ value }) => value === undefined ? value : max(value, finite)) : 1];
  9241. }
  9242. function inferRadialRange(channels, domain) {
  9243. const hint = channels.find(({ radius: radius2 }) => radius2 !== undefined);
  9244. if (hint !== undefined)
  9245. return [0, hint.radius];
  9246. const h25 = quantile(channels, 0.5, ({ value }) => value === undefined ? NaN : quantile(value, 0.25, positive));
  9247. const range3 = domain.map((d) => 3 * Math.sqrt(d / h25));
  9248. const k2 = 30 / max(range3);
  9249. return k2 < 1 ? range3.map((r) => r * k2) : range3;
  9250. }
  9251. function inferLengthRange(channels, domain) {
  9252. const h50 = median(channels, ({ value }) => value === undefined ? NaN : median(value, Math.abs));
  9253. const range3 = domain.map((d) => 12 * d / h50);
  9254. const k2 = 60 / max(range3);
  9255. return k2 < 1 ? range3.map((r) => r * k2) : range3;
  9256. }
  9257. function inferLogDomain(channels) {
  9258. for (const { value } of channels) {
  9259. if (value !== undefined) {
  9260. for (let v of value) {
  9261. if (v > 0)
  9262. return inferDomain(channels, positive);
  9263. if (v < 0)
  9264. return inferDomain(channels, negative);
  9265. }
  9266. }
  9267. }
  9268. return [1, 10];
  9269. }
  9270. function inferQuantileDomain(channels) {
  9271. const domain = [];
  9272. for (const { value } of channels) {
  9273. if (value === undefined)
  9274. continue;
  9275. for (const v of value)
  9276. domain.push(v);
  9277. }
  9278. return domain;
  9279. }
  9280. function interpolatePiecewise(interpolate) {
  9281. return (i, j) => (t) => interpolate(i + t * (j - i));
  9282. }
  9283. // node_modules/@observablehq/plot/src/warnings.js
  9284. var warnings = 0;
  9285. var lastMessage;
  9286. function consumeWarnings() {
  9287. const w = warnings;
  9288. warnings = 0;
  9289. lastMessage = undefined;
  9290. return w;
  9291. }
  9292. function warn(message) {
  9293. if (message === lastMessage)
  9294. return;
  9295. lastMessage = message;
  9296. console.warn(message);
  9297. ++warnings;
  9298. }
  9299. // node_modules/@observablehq/plot/src/scales/diverging.js
  9300. function createScaleD(key, scale, transform2, channels, {
  9301. type: type2,
  9302. nice: nice2,
  9303. clamp,
  9304. domain = inferDomain(channels),
  9305. unknown,
  9306. pivot = 0,
  9307. scheme: scheme28,
  9308. range: range3,
  9309. symmetric = true,
  9310. interpolate = registry.get(key) === color2 ? scheme28 == null && range3 !== undefined ? rgb_default : quantitativeScheme(scheme28 !== undefined ? scheme28 : "rdbu") : number_default,
  9311. reverse: reverse2
  9312. }) {
  9313. pivot = +pivot;
  9314. domain = arrayify2(domain);
  9315. let [min3, max2] = domain;
  9316. if (domain.length > 2)
  9317. warn(`Warning: the diverging ${key} scale domain contains extra elements.`);
  9318. if (descending(min3, max2) < 0)
  9319. [min3, max2] = [max2, min3], reverse2 = !reverse2;
  9320. min3 = Math.min(min3, pivot);
  9321. max2 = Math.max(max2, pivot);
  9322. if (typeof interpolate !== "function") {
  9323. interpolate = maybeInterpolator(interpolate);
  9324. }
  9325. if (range3 !== undefined) {
  9326. interpolate = interpolate.length === 1 ? interpolatePiecewise(interpolate)(...range3) : piecewise(interpolate, range3);
  9327. }
  9328. if (reverse2)
  9329. interpolate = flip(interpolate);
  9330. if (symmetric) {
  9331. const mid2 = transform2.apply(pivot);
  9332. const mindelta = mid2 - transform2.apply(min3);
  9333. const maxdelta = transform2.apply(max2) - mid2;
  9334. if (mindelta < maxdelta)
  9335. min3 = transform2.invert(mid2 - maxdelta);
  9336. else if (mindelta > maxdelta)
  9337. max2 = transform2.invert(mid2 + mindelta);
  9338. }
  9339. scale.domain([min3, pivot, max2]).unknown(unknown).interpolator(interpolate);
  9340. if (clamp)
  9341. scale.clamp(clamp);
  9342. if (nice2)
  9343. scale.nice(nice2);
  9344. return { type: type2, domain: [min3, max2], pivot, interpolate, scale };
  9345. }
  9346. function createScaleDiverging(key, channels, options) {
  9347. return createScaleD(key, diverging(), transformIdentity, channels, options);
  9348. }
  9349. function createScaleDivergingSqrt(key, channels, options) {
  9350. return createScaleDivergingPow(key, channels, { ...options, exponent: 0.5 });
  9351. }
  9352. function createScaleDivergingPow(key, channels, { exponent = 1, ...options }) {
  9353. return createScaleD(key, divergingPow().exponent(exponent = +exponent), transformPow2(exponent), channels, {
  9354. ...options,
  9355. type: "diverging-pow"
  9356. });
  9357. }
  9358. function createScaleDivergingLog(key, channels, { base = 10, pivot = 1, domain = inferDomain(channels, pivot < 0 ? negative : positive), ...options }) {
  9359. return createScaleD(key, divergingLog().base(base = +base), transformLog2, channels, {
  9360. domain,
  9361. pivot,
  9362. ...options
  9363. });
  9364. }
  9365. function createScaleDivergingSymlog(key, channels, { constant: constant2 = 1, ...options }) {
  9366. return createScaleD(key, divergingSymlog().constant(constant2 = +constant2), transformSymlog2(constant2), channels, options);
  9367. }
  9368. var transformIdentity = {
  9369. apply(x) {
  9370. return x;
  9371. },
  9372. invert(x) {
  9373. return x;
  9374. }
  9375. };
  9376. var transformLog2 = {
  9377. apply: Math.log,
  9378. invert: Math.exp
  9379. };
  9380. var transformSqrt2 = {
  9381. apply(x) {
  9382. return Math.sign(x) * Math.sqrt(Math.abs(x));
  9383. },
  9384. invert(x) {
  9385. return Math.sign(x) * (x * x);
  9386. }
  9387. };
  9388. function transformPow2(exponent) {
  9389. return exponent === 0.5 ? transformSqrt2 : {
  9390. apply(x) {
  9391. return Math.sign(x) * Math.pow(Math.abs(x), exponent);
  9392. },
  9393. invert(x) {
  9394. return Math.sign(x) * Math.pow(Math.abs(x), 1 / exponent);
  9395. }
  9396. };
  9397. }
  9398. function transformSymlog2(constant2) {
  9399. return {
  9400. apply(x) {
  9401. return Math.sign(x) * Math.log1p(Math.abs(x / constant2));
  9402. },
  9403. invert(x) {
  9404. return Math.sign(x) * Math.expm1(Math.abs(x)) * constant2;
  9405. }
  9406. };
  9407. }
  9408. // node_modules/@observablehq/plot/src/scales/temporal.js
  9409. function createScaleT(key, scale, channels, options) {
  9410. return createScaleQ(key, scale, channels, options);
  9411. }
  9412. function createScaleTime(key, channels, options) {
  9413. return createScaleT(key, time(), channels, options);
  9414. }
  9415. function createScaleUtc(key, channels, options) {
  9416. return createScaleT(key, utcTime(), channels, options);
  9417. }
  9418. // node_modules/@observablehq/plot/src/scales/ordinal.js
  9419. var ordinalImplicit = Symbol("ordinal");
  9420. function createScaleO(key, scale, channels, { type: type2, interval: interval2, domain, range: range3, reverse: reverse2, hint }) {
  9421. interval2 = maybeRangeInterval(interval2, type2);
  9422. if (domain === undefined)
  9423. domain = inferDomain2(channels, interval2, key);
  9424. if (type2 === "categorical" || type2 === ordinalImplicit)
  9425. type2 = "ordinal";
  9426. if (reverse2)
  9427. domain = reverse(domain);
  9428. domain = scale.domain(domain).domain();
  9429. if (range3 !== undefined) {
  9430. if (typeof range3 === "function")
  9431. range3 = range3(domain);
  9432. scale.range(range3);
  9433. }
  9434. return { type: type2, domain, range: range3, scale, hint, interval: interval2 };
  9435. }
  9436. function createScaleOrdinal(key, channels, { type: type2, interval: interval2, domain, range: range3, scheme: scheme28, unknown, ...options }) {
  9437. interval2 = maybeRangeInterval(interval2, type2);
  9438. if (domain === undefined)
  9439. domain = inferDomain2(channels, interval2, key);
  9440. let hint;
  9441. if (registry.get(key) === symbol) {
  9442. hint = inferSymbolHint(channels);
  9443. range3 = range3 === undefined ? inferSymbolRange(hint) : map2(range3, maybeSymbol);
  9444. } else if (registry.get(key) === color2) {
  9445. if (range3 === undefined && (type2 === "ordinal" || type2 === ordinalImplicit)) {
  9446. range3 = maybeBooleanRange(domain, scheme28);
  9447. if (range3 !== undefined)
  9448. scheme28 = undefined;
  9449. }
  9450. if (scheme28 === undefined && range3 === undefined) {
  9451. scheme28 = type2 === "ordinal" ? "turbo" : "observable10";
  9452. }
  9453. if (scheme28 !== undefined) {
  9454. if (range3 !== undefined) {
  9455. const interpolate = quantitativeScheme(scheme28);
  9456. const t03 = range3[0], d = range3[1] - range3[0];
  9457. range3 = ({ length: n }) => quantize_default((t) => interpolate(t03 + d * t), n);
  9458. } else {
  9459. range3 = ordinalScheme(scheme28);
  9460. }
  9461. }
  9462. }
  9463. if (unknown === implicit) {
  9464. throw new Error(`implicit unknown on ${key} scale is not supported`);
  9465. }
  9466. return createScaleO(key, ordinal().unknown(unknown), channels, { ...options, type: type2, domain, range: range3, hint });
  9467. }
  9468. function createScalePoint(key, channels, { align = 0.5, padding = 0.5, ...options }) {
  9469. return maybeRound(point().align(align).padding(padding), channels, options, key);
  9470. }
  9471. function createScaleBand(key, channels, {
  9472. align = 0.5,
  9473. padding = 0.1,
  9474. paddingInner = padding,
  9475. paddingOuter = key === "fx" || key === "fy" ? 0 : padding,
  9476. ...options
  9477. }) {
  9478. return maybeRound(band().align(align).paddingInner(paddingInner).paddingOuter(paddingOuter), channels, options, key);
  9479. }
  9480. function maybeRound(scale, channels, options, key) {
  9481. let { round } = options;
  9482. if (round !== undefined)
  9483. scale.round(round = !!round);
  9484. scale = createScaleO(key, scale, channels, options);
  9485. scale.round = round;
  9486. return scale;
  9487. }
  9488. function inferDomain2(channels, interval2, key) {
  9489. const values2 = new InternSet;
  9490. for (const { value, domain } of channels) {
  9491. if (domain !== undefined)
  9492. return domain();
  9493. if (value === undefined)
  9494. continue;
  9495. for (const v of value)
  9496. values2.add(v);
  9497. }
  9498. if (interval2 !== undefined) {
  9499. const [min3, max2] = extent(values2).map(interval2.floor, interval2);
  9500. return interval2.range(min3, interval2.offset(max2));
  9501. }
  9502. if (values2.size > 1e4 && registry.get(key) === position) {
  9503. throw new Error(`implicit ordinal domain of ${key} scale has more than 10,000 values`);
  9504. }
  9505. return sort(values2, ascendingDefined2);
  9506. }
  9507. function inferHint(channels, key) {
  9508. let value;
  9509. for (const { hint } of channels) {
  9510. const candidate = hint?.[key];
  9511. if (candidate === undefined)
  9512. continue;
  9513. if (value === undefined)
  9514. value = candidate;
  9515. else if (value !== candidate)
  9516. return;
  9517. }
  9518. return value;
  9519. }
  9520. function inferSymbolHint(channels) {
  9521. return {
  9522. fill: inferHint(channels, "fill"),
  9523. stroke: inferHint(channels, "stroke")
  9524. };
  9525. }
  9526. function inferSymbolRange(hint) {
  9527. return isNoneish(hint.fill) ? symbolsStroke : symbolsFill;
  9528. }
  9529. // node_modules/@observablehq/plot/src/scales.js
  9530. function createScales(channelsByScale, {
  9531. label: globalLabel,
  9532. inset: globalInset = 0,
  9533. insetTop: globalInsetTop = globalInset,
  9534. insetRight: globalInsetRight = globalInset,
  9535. insetBottom: globalInsetBottom = globalInset,
  9536. insetLeft: globalInsetLeft = globalInset,
  9537. round,
  9538. nice: nice2,
  9539. clamp,
  9540. zero: zero3,
  9541. align,
  9542. padding,
  9543. projection: projection3,
  9544. facet: { label: facetLabel = globalLabel } = {},
  9545. ...options
  9546. } = {}) {
  9547. const scales = {};
  9548. for (const [key, channels] of channelsByScale) {
  9549. const scaleOptions = options[key];
  9550. const scale = createScale(key, channels, {
  9551. round: registry.get(key) === position ? round : undefined,
  9552. nice: nice2,
  9553. clamp,
  9554. zero: zero3,
  9555. align,
  9556. padding,
  9557. projection: projection3,
  9558. ...scaleOptions
  9559. });
  9560. if (scale) {
  9561. let {
  9562. label = key === "fx" || key === "fy" ? facetLabel : globalLabel,
  9563. percent,
  9564. transform: transform2,
  9565. inset,
  9566. insetTop = inset !== undefined ? inset : key === "y" ? globalInsetTop : 0,
  9567. insetRight = inset !== undefined ? inset : key === "x" ? globalInsetRight : 0,
  9568. insetBottom = inset !== undefined ? inset : key === "y" ? globalInsetBottom : 0,
  9569. insetLeft = inset !== undefined ? inset : key === "x" ? globalInsetLeft : 0
  9570. } = scaleOptions || {};
  9571. if (transform2 == null)
  9572. transform2 = undefined;
  9573. else if (typeof transform2 !== "function")
  9574. throw new Error("invalid scale transform; not a function");
  9575. scale.percent = !!percent;
  9576. scale.label = label === undefined ? inferScaleLabel(channels, scale) : label;
  9577. scale.transform = transform2;
  9578. if (key === "x" || key === "fx") {
  9579. scale.insetLeft = +insetLeft;
  9580. scale.insetRight = +insetRight;
  9581. } else if (key === "y" || key === "fy") {
  9582. scale.insetTop = +insetTop;
  9583. scale.insetBottom = +insetBottom;
  9584. }
  9585. scales[key] = scale;
  9586. }
  9587. }
  9588. return scales;
  9589. }
  9590. function createScaleFunctions(descriptors) {
  9591. const scales = {};
  9592. const scaleFunctions = { scales };
  9593. for (const [key, descriptor] of Object.entries(descriptors)) {
  9594. const { scale, type: type2, interval: interval2, label } = descriptor;
  9595. scales[key] = exposeScale(descriptor);
  9596. scaleFunctions[key] = scale;
  9597. scale.type = type2;
  9598. if (interval2 != null)
  9599. scale.interval = interval2;
  9600. if (label != null)
  9601. scale.label = label;
  9602. }
  9603. return scaleFunctions;
  9604. }
  9605. function autoScaleRange(scales, dimensions) {
  9606. const { x, y, fx, fy } = scales;
  9607. const superdimensions = fx || fy ? outerDimensions(dimensions) : dimensions;
  9608. if (fx)
  9609. autoScaleRangeX(fx, superdimensions);
  9610. if (fy)
  9611. autoScaleRangeY(fy, superdimensions);
  9612. const subdimensions = fx || fy ? innerDimensions(scales, dimensions) : dimensions;
  9613. if (x)
  9614. autoScaleRangeX(x, subdimensions);
  9615. if (y)
  9616. autoScaleRangeY(y, subdimensions);
  9617. }
  9618. function inferScaleLabel(channels = [], scale) {
  9619. let label;
  9620. for (const { label: l } of channels) {
  9621. if (l === undefined)
  9622. continue;
  9623. if (label === undefined)
  9624. label = l;
  9625. else if (label !== l)
  9626. return;
  9627. }
  9628. if (label === undefined)
  9629. return;
  9630. if (!isOrdinalScale(scale) && scale.percent)
  9631. label = `${label} (%)`;
  9632. return { inferred: true, toString: () => label };
  9633. }
  9634. function inferScaleOrder(scale) {
  9635. return Math.sign(orderof(scale.domain())) * Math.sign(orderof(scale.range()));
  9636. }
  9637. function outerDimensions(dimensions) {
  9638. const {
  9639. marginTop,
  9640. marginRight,
  9641. marginBottom,
  9642. marginLeft,
  9643. width,
  9644. height,
  9645. facet: {
  9646. marginTop: facetMarginTop,
  9647. marginRight: facetMarginRight,
  9648. marginBottom: facetMarginBottom,
  9649. marginLeft: facetMarginLeft
  9650. }
  9651. } = dimensions;
  9652. return {
  9653. marginTop: Math.max(marginTop, facetMarginTop),
  9654. marginRight: Math.max(marginRight, facetMarginRight),
  9655. marginBottom: Math.max(marginBottom, facetMarginBottom),
  9656. marginLeft: Math.max(marginLeft, facetMarginLeft),
  9657. width,
  9658. height
  9659. };
  9660. }
  9661. function innerDimensions({ fx, fy }, dimensions) {
  9662. const { marginTop, marginRight, marginBottom, marginLeft, width, height } = outerDimensions(dimensions);
  9663. return {
  9664. marginTop,
  9665. marginRight,
  9666. marginBottom,
  9667. marginLeft,
  9668. width: fx ? fx.scale.bandwidth() + marginLeft + marginRight : width,
  9669. height: fy ? fy.scale.bandwidth() + marginTop + marginBottom : height,
  9670. facet: { width, height }
  9671. };
  9672. }
  9673. function autoScaleRangeX(scale, dimensions) {
  9674. if (scale.range === undefined) {
  9675. const { insetLeft, insetRight } = scale;
  9676. const { width, marginLeft = 0, marginRight = 0 } = dimensions;
  9677. const left2 = marginLeft + insetLeft;
  9678. const right2 = width - marginRight - insetRight;
  9679. scale.range = [left2, Math.max(left2, right2)];
  9680. if (!isOrdinalScale(scale))
  9681. scale.range = piecewiseRange(scale);
  9682. scale.scale.range(scale.range);
  9683. }
  9684. autoScaleRound(scale);
  9685. }
  9686. function autoScaleRangeY(scale, dimensions) {
  9687. if (scale.range === undefined) {
  9688. const { insetTop, insetBottom } = scale;
  9689. const { height, marginTop = 0, marginBottom = 0 } = dimensions;
  9690. const top2 = marginTop + insetTop;
  9691. const bottom2 = height - marginBottom - insetBottom;
  9692. scale.range = [Math.max(top2, bottom2), top2];
  9693. if (!isOrdinalScale(scale))
  9694. scale.range = piecewiseRange(scale);
  9695. else
  9696. scale.range.reverse();
  9697. scale.scale.range(scale.range);
  9698. }
  9699. autoScaleRound(scale);
  9700. }
  9701. function autoScaleRound(scale) {
  9702. if (scale.round === undefined && isBandScale(scale) && roundError(scale) <= 30) {
  9703. scale.scale.round(true);
  9704. }
  9705. }
  9706. function roundError({ scale }) {
  9707. const n = scale.domain().length;
  9708. const [start2, stop] = scale.range();
  9709. const paddingInner = scale.paddingInner ? scale.paddingInner() : 1;
  9710. const paddingOuter = scale.paddingOuter ? scale.paddingOuter() : scale.padding();
  9711. const m = n - paddingInner;
  9712. const step = Math.abs(stop - start2) / Math.max(1, m + paddingOuter * 2);
  9713. return (step - Math.floor(step)) * m;
  9714. }
  9715. function piecewiseRange(scale) {
  9716. const length3 = scale.scale.domain().length + isThresholdScale(scale);
  9717. if (!(length3 > 2))
  9718. return scale.range;
  9719. const [start2, end] = scale.range;
  9720. return Array.from({ length: length3 }, (_, i) => start2 + i / (length3 - 1) * (end - start2));
  9721. }
  9722. function createScale(key, channels = [], options = {}) {
  9723. const type2 = inferScaleType(key, channels, options);
  9724. if (options.type === undefined && options.domain === undefined && options.range === undefined && options.interval == null && key !== "fx" && key !== "fy" && isOrdinalScale({ type: type2 })) {
  9725. const values2 = channels.map(({ value }) => value).filter((value) => value !== undefined);
  9726. if (values2.some(isTemporal))
  9727. warn(`Warning: some data associated with the ${key} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${formatScaleType(type2)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${key} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${key} scale to "${formatScaleType(type2)}".`);
  9728. else if (values2.some(isTemporalString))
  9729. warn(`Warning: some data associated with the ${key} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${formatScaleType(type2)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${key} scale to "${formatScaleType(type2)}".`);
  9730. else if (values2.some(isNumericString))
  9731. warn(`Warning: some data associated with the ${key} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${formatScaleType(type2)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${key} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${key} scale to "${formatScaleType(type2)}".`);
  9732. }
  9733. options.type = type2;
  9734. switch (type2) {
  9735. case "diverging":
  9736. case "diverging-sqrt":
  9737. case "diverging-pow":
  9738. case "diverging-log":
  9739. case "diverging-symlog":
  9740. case "cyclical":
  9741. case "sequential":
  9742. case "linear":
  9743. case "sqrt":
  9744. case "threshold":
  9745. case "quantile":
  9746. case "pow":
  9747. case "log":
  9748. case "symlog":
  9749. options = coerceType(channels, options, coerceNumbers);
  9750. break;
  9751. case "identity":
  9752. switch (registry.get(key)) {
  9753. case position:
  9754. options = coerceType(channels, options, coerceNumbers);
  9755. break;
  9756. case symbol:
  9757. options = coerceType(channels, options, coerceSymbols);
  9758. break;
  9759. }
  9760. break;
  9761. case "utc":
  9762. case "time":
  9763. options = coerceType(channels, options, coerceDates);
  9764. break;
  9765. }
  9766. switch (type2) {
  9767. case "diverging":
  9768. return createScaleDiverging(key, channels, options);
  9769. case "diverging-sqrt":
  9770. return createScaleDivergingSqrt(key, channels, options);
  9771. case "diverging-pow":
  9772. return createScaleDivergingPow(key, channels, options);
  9773. case "diverging-log":
  9774. return createScaleDivergingLog(key, channels, options);
  9775. case "diverging-symlog":
  9776. return createScaleDivergingSymlog(key, channels, options);
  9777. case "categorical":
  9778. case "ordinal":
  9779. case ordinalImplicit:
  9780. return createScaleOrdinal(key, channels, options);
  9781. case "cyclical":
  9782. case "sequential":
  9783. case "linear":
  9784. return createScaleLinear(key, channels, options);
  9785. case "sqrt":
  9786. return createScaleSqrt(key, channels, options);
  9787. case "threshold":
  9788. return createScaleThreshold(key, channels, options);
  9789. case "quantile":
  9790. return createScaleQuantile(key, channels, options);
  9791. case "quantize":
  9792. return createScaleQuantize(key, channels, options);
  9793. case "pow":
  9794. return createScalePow(key, channels, options);
  9795. case "log":
  9796. return createScaleLog(key, channels, options);
  9797. case "symlog":
  9798. return createScaleSymlog(key, channels, options);
  9799. case "utc":
  9800. return createScaleUtc(key, channels, options);
  9801. case "time":
  9802. return createScaleTime(key, channels, options);
  9803. case "point":
  9804. return createScalePoint(key, channels, options);
  9805. case "band":
  9806. return createScaleBand(key, channels, options);
  9807. case "identity":
  9808. return createScaleIdentity(key);
  9809. case undefined:
  9810. return;
  9811. default:
  9812. throw new Error(`unknown scale type: ${type2}`);
  9813. }
  9814. }
  9815. function formatScaleType(type2) {
  9816. return typeof type2 === "symbol" ? type2.description : type2;
  9817. }
  9818. function maybeScaleType(type2) {
  9819. return typeof type2 === "string" ? `${type2}`.toLowerCase() : type2;
  9820. }
  9821. var typeProjection = { toString: () => "projection" };
  9822. function inferScaleType(key, channels, { type: type2, domain, range: range3, scheme: scheme28, pivot, projection: projection3 }) {
  9823. type2 = maybeScaleType(type2);
  9824. if (key === "fx" || key === "fy")
  9825. return "band";
  9826. if ((key === "x" || key === "y") && projection3 != null)
  9827. type2 = typeProjection;
  9828. for (const channel of channels) {
  9829. const t = maybeScaleType(channel.type);
  9830. if (t === undefined)
  9831. continue;
  9832. else if (type2 === undefined)
  9833. type2 = t;
  9834. else if (type2 !== t)
  9835. throw new Error(`scale incompatible with channel: ${type2} !== ${t}`);
  9836. }
  9837. if (type2 === typeProjection)
  9838. return;
  9839. if (type2 !== undefined)
  9840. return type2;
  9841. if (domain === undefined && !channels.some(({ value }) => value !== undefined))
  9842. return;
  9843. const kind = registry.get(key);
  9844. if (kind === radius)
  9845. return "sqrt";
  9846. if (kind === opacity || kind === length2)
  9847. return "linear";
  9848. if (kind === symbol)
  9849. return "ordinal";
  9850. const n = (domain ?? range3)?.length;
  9851. if (n < 2 || n > 2)
  9852. return asOrdinalType(kind);
  9853. if (domain !== undefined) {
  9854. if (isOrdinal(domain))
  9855. return asOrdinalType(kind);
  9856. if (isTemporal(domain))
  9857. return "utc";
  9858. } else {
  9859. const values2 = channels.map(({ value }) => value).filter((value) => value !== undefined);
  9860. if (values2.some(isOrdinal))
  9861. return asOrdinalType(kind);
  9862. if (values2.some(isTemporal))
  9863. return "utc";
  9864. }
  9865. if (kind === color2) {
  9866. if (pivot != null || isDivergingScheme(scheme28))
  9867. return "diverging";
  9868. if (isCategoricalScheme(scheme28))
  9869. return "categorical";
  9870. }
  9871. return "linear";
  9872. }
  9873. function asOrdinalType(kind) {
  9874. switch (kind) {
  9875. case position:
  9876. return "point";
  9877. case color2:
  9878. return ordinalImplicit;
  9879. default:
  9880. return "ordinal";
  9881. }
  9882. }
  9883. function isOrdinalScale({ type: type2 }) {
  9884. return type2 === "ordinal" || type2 === "point" || type2 === "band" || type2 === ordinalImplicit;
  9885. }
  9886. function isThresholdScale({ type: type2 }) {
  9887. return type2 === "threshold";
  9888. }
  9889. function isBandScale({ type: type2 }) {
  9890. return type2 === "point" || type2 === "band";
  9891. }
  9892. function isCollapsed(scale) {
  9893. if (scale === undefined)
  9894. return true;
  9895. const domain = scale.domain();
  9896. const value = scale(domain[0]);
  9897. for (let i = 1, n = domain.length;i < n; ++i) {
  9898. if (scale(domain[i]) - value) {
  9899. return false;
  9900. }
  9901. }
  9902. return true;
  9903. }
  9904. function coerceType(channels, { domain, ...options }, coerceValues) {
  9905. for (const c4 of channels) {
  9906. if (c4.value !== undefined) {
  9907. if (domain === undefined)
  9908. domain = c4.value?.domain;
  9909. c4.value = coerceValues(c4.value);
  9910. }
  9911. }
  9912. return {
  9913. domain: domain === undefined ? domain : coerceValues(domain),
  9914. ...options
  9915. };
  9916. }
  9917. function coerceSymbols(values2) {
  9918. return map2(values2, maybeSymbol);
  9919. }
  9920. function exposeScales(scales) {
  9921. return (key) => {
  9922. if (!registry.has(key = `${key}`))
  9923. throw new Error(`unknown scale: ${key}`);
  9924. return scales[key];
  9925. };
  9926. }
  9927. function exposeScale({ scale, type: type2, domain, range: range3, interpolate, interval: interval2, transform: transform2, percent, pivot }) {
  9928. if (type2 === "identity")
  9929. return { type: "identity", apply: (d) => d, invert: (d) => d };
  9930. const unknown = scale.unknown ? scale.unknown() : undefined;
  9931. return {
  9932. type: type2,
  9933. domain: slice(domain),
  9934. ...range3 !== undefined && { range: slice(range3) },
  9935. ...transform2 !== undefined && { transform: transform2 },
  9936. ...percent && { percent },
  9937. ...unknown !== undefined && { unknown },
  9938. ...interval2 !== undefined && { interval: interval2 },
  9939. ...interpolate !== undefined && { interpolate },
  9940. ...scale.clamp && { clamp: scale.clamp() },
  9941. ...pivot !== undefined && { pivot, symmetric: false },
  9942. ...scale.base && { base: scale.base() },
  9943. ...scale.exponent && { exponent: scale.exponent() },
  9944. ...scale.constant && { constant: scale.constant() },
  9945. ...scale.align && { align: scale.align(), round: scale.round() },
  9946. ...scale.padding && (scale.paddingInner ? { paddingInner: scale.paddingInner(), paddingOuter: scale.paddingOuter() } : { padding: scale.padding() }),
  9947. ...scale.bandwidth && { bandwidth: scale.bandwidth(), step: scale.step() },
  9948. apply: (t) => scale(t),
  9949. ...scale.invert && { invert: (t) => scale.invert(t) }
  9950. };
  9951. }
  9952. // node_modules/@observablehq/plot/src/facet.js
  9953. function createFacets(channelsByScale, options) {
  9954. const { fx, fy } = createScales(channelsByScale, options);
  9955. const fxDomain = fx?.scale.domain();
  9956. const fyDomain = fy?.scale.domain();
  9957. return fxDomain && fyDomain ? cross(fxDomain, fyDomain).map(([x, y], i) => ({ x, y, i })) : fxDomain ? fxDomain.map((x, i) => ({ x, i })) : fyDomain ? fyDomain.map((y, i) => ({ y, i })) : undefined;
  9958. }
  9959. function recreateFacets(facets, { x: X3, y: Y3 }) {
  9960. X3 &&= facetIndex(X3);
  9961. Y3 &&= facetIndex(Y3);
  9962. return facets.filter(X3 && Y3 ? (f) => X3.has(f.x) && Y3.has(f.y) : X3 ? (f) => X3.has(f.x) : (f) => Y3.has(f.y)).sort(X3 && Y3 ? (a2, b) => X3.get(a2.x) - X3.get(b.x) || Y3.get(a2.y) - Y3.get(b.y) : X3 ? (a2, b) => X3.get(a2.x) - X3.get(b.x) : (a2, b) => Y3.get(a2.y) - Y3.get(b.y));
  9963. }
  9964. function facetGroups(data, { fx, fy }) {
  9965. const I = range2(data);
  9966. const FX = fx?.value;
  9967. const FY = fy?.value;
  9968. return fx && fy ? rollup(I, (G) => (G.fx = FX[G[0]], G.fy = FY[G[0]], G), (i) => FX[i], (i) => FY[i]) : fx ? rollup(I, (G) => (G.fx = FX[G[0]], G), (i) => FX[i]) : rollup(I, (G) => (G.fy = FY[G[0]], G), (i) => FY[i]);
  9969. }
  9970. function facetTranslator(fx, fy, { marginTop, marginLeft }) {
  9971. const x = fx ? ({ x: x2 }) => fx(x2) - marginLeft : () => 0;
  9972. const y = fy ? ({ y: y2 }) => fy(y2) - marginTop : () => 0;
  9973. return function(d) {
  9974. if (this.tagName === "svg") {
  9975. this.setAttribute("x", x(d));
  9976. this.setAttribute("y", y(d));
  9977. } else {
  9978. this.setAttribute("transform", `translate(${x(d)},${y(d)})`);
  9979. }
  9980. };
  9981. }
  9982. function facetExclude(index2) {
  9983. const ex = [];
  9984. const e = new Uint32Array(sum(index2, (d) => d.length));
  9985. for (const i of index2) {
  9986. let n = 0;
  9987. for (const j of index2) {
  9988. if (i === j)
  9989. continue;
  9990. e.set(j, n);
  9991. n += j.length;
  9992. }
  9993. ex.push(e.slice(0, n));
  9994. }
  9995. return ex;
  9996. }
  9997. var facetAnchors = new Map([
  9998. ["top", facetAnchorTop],
  9999. ["right", facetAnchorRight],
  10000. ["bottom", facetAnchorBottom],
  10001. ["left", facetAnchorLeft],
  10002. ["top-left", and(facetAnchorTop, facetAnchorLeft)],
  10003. ["top-right", and(facetAnchorTop, facetAnchorRight)],
  10004. ["bottom-left", and(facetAnchorBottom, facetAnchorLeft)],
  10005. ["bottom-right", and(facetAnchorBottom, facetAnchorRight)],
  10006. ["top-empty", facetAnchorTopEmpty],
  10007. ["right-empty", facetAnchorRightEmpty],
  10008. ["bottom-empty", facetAnchorBottomEmpty],
  10009. ["left-empty", facetAnchorLeftEmpty],
  10010. ["empty", facetAnchorEmpty]
  10011. ]);
  10012. function maybeFacetAnchor(facetAnchor) {
  10013. if (facetAnchor == null)
  10014. return null;
  10015. const anchor = facetAnchors.get(`${facetAnchor}`.toLowerCase());
  10016. if (anchor)
  10017. return anchor;
  10018. throw new Error(`invalid facet anchor: ${facetAnchor}`);
  10019. }
  10020. var indexCache = new WeakMap;
  10021. function facetIndex(V) {
  10022. let I = indexCache.get(V);
  10023. if (!I)
  10024. indexCache.set(V, I = new InternMap(map2(V, (v, i) => [v, i])));
  10025. return I;
  10026. }
  10027. function facetIndexOf(V, v) {
  10028. return facetIndex(V).get(v);
  10029. }
  10030. function facetFind(facets, x, y) {
  10031. x = keyof2(x);
  10032. y = keyof2(y);
  10033. return facets.find((f) => Object.is(keyof2(f.x), x) && Object.is(keyof2(f.y), y));
  10034. }
  10035. function facetEmpty(facets, x, y) {
  10036. return facetFind(facets, x, y)?.empty;
  10037. }
  10038. function facetAnchorTop(facets, { y: Y3 }, { y }) {
  10039. return Y3 ? facetIndexOf(Y3, y) === 0 : true;
  10040. }
  10041. function facetAnchorBottom(facets, { y: Y3 }, { y }) {
  10042. return Y3 ? facetIndexOf(Y3, y) === Y3.length - 1 : true;
  10043. }
  10044. function facetAnchorLeft(facets, { x: X3 }, { x }) {
  10045. return X3 ? facetIndexOf(X3, x) === 0 : true;
  10046. }
  10047. function facetAnchorRight(facets, { x: X3 }, { x }) {
  10048. return X3 ? facetIndexOf(X3, x) === X3.length - 1 : true;
  10049. }
  10050. function facetAnchorTopEmpty(facets, { y: Y3 }, { x, y, empty: empty3 }) {
  10051. if (empty3)
  10052. return false;
  10053. if (!Y3)
  10054. return;
  10055. const i = facetIndexOf(Y3, y);
  10056. if (i > 0)
  10057. return facetEmpty(facets, x, Y3[i - 1]);
  10058. }
  10059. function facetAnchorBottomEmpty(facets, { y: Y3 }, { x, y, empty: empty3 }) {
  10060. if (empty3)
  10061. return false;
  10062. if (!Y3)
  10063. return;
  10064. const i = facetIndexOf(Y3, y);
  10065. if (i < Y3.length - 1)
  10066. return facetEmpty(facets, x, Y3[i + 1]);
  10067. }
  10068. function facetAnchorLeftEmpty(facets, { x: X3 }, { x, y, empty: empty3 }) {
  10069. if (empty3)
  10070. return false;
  10071. if (!X3)
  10072. return;
  10073. const i = facetIndexOf(X3, x);
  10074. if (i > 0)
  10075. return facetEmpty(facets, X3[i - 1], y);
  10076. }
  10077. function facetAnchorRightEmpty(facets, { x: X3 }, { x, y, empty: empty3 }) {
  10078. if (empty3)
  10079. return false;
  10080. if (!X3)
  10081. return;
  10082. const i = facetIndexOf(X3, x);
  10083. if (i < X3.length - 1)
  10084. return facetEmpty(facets, X3[i + 1], y);
  10085. }
  10086. function facetAnchorEmpty(facets, channels, { empty: empty3 }) {
  10087. return empty3;
  10088. }
  10089. function and(a2, b) {
  10090. return function() {
  10091. return a2.apply(null, arguments) && b.apply(null, arguments);
  10092. };
  10093. }
  10094. function facetFilter(facets, { channels: { fx, fy }, groups: groups2 }) {
  10095. return fx && fy ? facets.map(({ x, y }) => groups2.get(x)?.get(y) ?? []) : fx ? facets.map(({ x }) => groups2.get(x) ?? []) : facets.map(({ y }) => groups2.get(y) ?? []);
  10096. }
  10097. // node_modules/@observablehq/plot/src/projection.js
  10098. var pi4 = Math.PI;
  10099. var tau4 = 2 * pi4;
  10100. var defaultAspectRatio = 0.618;
  10101. function createProjection({
  10102. projection: projection3,
  10103. inset: globalInset = 0,
  10104. insetTop = globalInset,
  10105. insetRight = globalInset,
  10106. insetBottom = globalInset,
  10107. insetLeft = globalInset
  10108. } = {}, dimensions) {
  10109. if (projection3 == null)
  10110. return;
  10111. if (typeof projection3.stream === "function")
  10112. return projection3;
  10113. let options;
  10114. let domain;
  10115. let clip = "frame";
  10116. if (isObject(projection3)) {
  10117. let inset;
  10118. ({
  10119. type: projection3,
  10120. domain,
  10121. inset,
  10122. insetTop = inset !== undefined ? inset : insetTop,
  10123. insetRight = inset !== undefined ? inset : insetRight,
  10124. insetBottom = inset !== undefined ? inset : insetBottom,
  10125. insetLeft = inset !== undefined ? inset : insetLeft,
  10126. clip = clip,
  10127. ...options
  10128. } = projection3);
  10129. if (projection3 == null)
  10130. return;
  10131. }
  10132. if (typeof projection3 !== "function")
  10133. ({ type: projection3 } = namedProjection(projection3));
  10134. const { width, height, marginLeft, marginRight, marginTop, marginBottom } = dimensions;
  10135. const dx = width - marginLeft - marginRight - insetLeft - insetRight;
  10136. const dy = height - marginTop - marginBottom - insetTop - insetBottom;
  10137. projection3 = projection3?.({ width: dx, height: dy, clip, ...options });
  10138. if (projection3 == null)
  10139. return;
  10140. clip = maybePostClip(clip, marginLeft, marginTop, width - marginRight, height - marginBottom);
  10141. let tx = marginLeft + insetLeft;
  10142. let ty = marginTop + insetTop;
  10143. let transform2;
  10144. if (domain != null) {
  10145. const [[x05, y05], [x12, y12]] = path_default(projection3).bounds(domain);
  10146. const k2 = Math.min(dx / (x12 - x05), dy / (y12 - y05));
  10147. if (k2 > 0) {
  10148. tx -= (k2 * (x05 + x12) - dx) / 2;
  10149. ty -= (k2 * (y05 + y12) - dy) / 2;
  10150. transform2 = transform_default({
  10151. point(x, y) {
  10152. this.stream.point(x * k2 + tx, y * k2 + ty);
  10153. }
  10154. });
  10155. } else {
  10156. warn(`Warning: the projection could not be fit to the specified domain; using the default scale.`);
  10157. }
  10158. }
  10159. transform2 ??= tx === 0 && ty === 0 ? identity7() : transform_default({
  10160. point(x, y) {
  10161. this.stream.point(x + tx, y + ty);
  10162. }
  10163. });
  10164. return { stream: (s2) => projection3.stream(transform2.stream(clip(s2))) };
  10165. }
  10166. function namedProjection(projection3) {
  10167. switch (`${projection3}`.toLowerCase()) {
  10168. case "albers-usa":
  10169. return scaleProjection(albersUsa_default, 0.7463, 0.4673);
  10170. case "albers":
  10171. return conicProjection2(albers_default, 0.7463, 0.4673);
  10172. case "azimuthal-equal-area":
  10173. return scaleProjection(azimuthalEqualArea_default, 4, 4);
  10174. case "azimuthal-equidistant":
  10175. return scaleProjection(azimuthalEquidistant_default, tau4, tau4);
  10176. case "conic-conformal":
  10177. return conicProjection2(conicConformal_default, tau4, tau4);
  10178. case "conic-equal-area":
  10179. return conicProjection2(conicEqualArea_default, 6.1702, 2.9781);
  10180. case "conic-equidistant":
  10181. return conicProjection2(conicEquidistant_default, 7.312, 3.6282);
  10182. case "equal-earth":
  10183. return scaleProjection(equalEarth_default, 5.4133, 2.6347);
  10184. case "equirectangular":
  10185. return scaleProjection(equirectangular_default, tau4, pi4);
  10186. case "gnomonic":
  10187. return scaleProjection(gnomonic_default, 3.4641, 3.4641);
  10188. case "identity":
  10189. return { type: identity7 };
  10190. case "reflect-y":
  10191. return { type: reflectY };
  10192. case "mercator":
  10193. return scaleProjection(mercator_default, tau4, tau4);
  10194. case "orthographic":
  10195. return scaleProjection(orthographic_default, 2, 2);
  10196. case "stereographic":
  10197. return scaleProjection(stereographic_default, 2, 2);
  10198. case "transverse-mercator":
  10199. return scaleProjection(transverseMercator_default, tau4, tau4);
  10200. default:
  10201. throw new Error(`unknown projection type: ${projection3}`);
  10202. }
  10203. }
  10204. function maybePostClip(clip, x12, y12, x2, y2) {
  10205. if (clip === false || clip == null || typeof clip === "number")
  10206. return (s2) => s2;
  10207. if (clip === true)
  10208. clip = "frame";
  10209. switch (`${clip}`.toLowerCase()) {
  10210. case "frame":
  10211. return clipRectangle(x12, y12, x2, y2);
  10212. default:
  10213. throw new Error(`unknown projection clip type: ${clip}`);
  10214. }
  10215. }
  10216. function scaleProjection(createProjection2, kx2, ky2) {
  10217. return {
  10218. type: ({ width, height, rotate, precision = 0.15, clip }) => {
  10219. const projection3 = createProjection2();
  10220. if (precision != null)
  10221. projection3.precision?.(precision);
  10222. if (rotate != null)
  10223. projection3.rotate?.(rotate);
  10224. if (typeof clip === "number")
  10225. projection3.clipAngle?.(clip);
  10226. if (width != null) {
  10227. projection3.scale(Math.min(width / kx2, height / ky2));
  10228. projection3.translate([width / 2, height / 2]);
  10229. }
  10230. return projection3;
  10231. },
  10232. aspectRatio: ky2 / kx2
  10233. };
  10234. }
  10235. function conicProjection2(createProjection2, kx2, ky2) {
  10236. const { type: type2, aspectRatio } = scaleProjection(createProjection2, kx2, ky2);
  10237. return {
  10238. type: (options) => {
  10239. const { parallels, domain, width, height } = options;
  10240. const projection3 = type2(options);
  10241. if (parallels != null) {
  10242. projection3.parallels(parallels);
  10243. if (domain === undefined && width != null) {
  10244. projection3.fitSize([width, height], { type: "Sphere" });
  10245. }
  10246. }
  10247. return projection3;
  10248. },
  10249. aspectRatio
  10250. };
  10251. }
  10252. var identity7 = constant({ stream: (stream) => stream });
  10253. var reflectY = constant(transform_default({
  10254. point(x, y) {
  10255. this.stream.point(x, -y);
  10256. }
  10257. }));
  10258. function project(cx, cy, values2, projection3) {
  10259. const x = values2[cx];
  10260. const y = values2[cy];
  10261. const n = x.length;
  10262. const X3 = values2[cx] = new Float64Array(n).fill(NaN);
  10263. const Y3 = values2[cy] = new Float64Array(n).fill(NaN);
  10264. let i;
  10265. const stream = projection3.stream({
  10266. point(x2, y2) {
  10267. X3[i] = x2;
  10268. Y3[i] = y2;
  10269. }
  10270. });
  10271. for (i = 0;i < n; ++i) {
  10272. stream.point(x[i], y[i]);
  10273. }
  10274. }
  10275. function hasProjection({ projection: projection3 } = {}) {
  10276. if (projection3 == null)
  10277. return false;
  10278. if (typeof projection3.stream === "function")
  10279. return true;
  10280. if (isObject(projection3))
  10281. projection3 = projection3.type;
  10282. return projection3 != null;
  10283. }
  10284. function projectionAspectRatio(projection3) {
  10285. if (typeof projection3?.stream === "function")
  10286. return defaultAspectRatio;
  10287. if (isObject(projection3)) {
  10288. let domain, options;
  10289. ({ domain, type: projection3, ...options } = projection3);
  10290. if (domain != null && projection3 != null) {
  10291. const type2 = typeof projection3 === "string" ? namedProjection(projection3).type : projection3;
  10292. const [[x05, y05], [x12, y12]] = path_default(type2({ ...options, width: 100, height: 100 })).bounds(domain);
  10293. const r = (y12 - y05) / (x12 - x05);
  10294. return r && isFinite(r) ? r < 0.2 ? 0.2 : r > 5 ? 5 : r : defaultAspectRatio;
  10295. }
  10296. }
  10297. if (projection3 == null)
  10298. return;
  10299. if (typeof projection3 !== "function") {
  10300. const { aspectRatio } = namedProjection(projection3);
  10301. if (aspectRatio)
  10302. return aspectRatio;
  10303. }
  10304. return defaultAspectRatio;
  10305. }
  10306. function getGeometryChannels(channel) {
  10307. const X3 = [];
  10308. const Y3 = [];
  10309. const x = { scale: "x", value: X3 };
  10310. const y = { scale: "y", value: Y3 };
  10311. const sink = {
  10312. point(x2, y2) {
  10313. X3.push(x2);
  10314. Y3.push(y2);
  10315. },
  10316. lineStart() {},
  10317. lineEnd() {},
  10318. polygonStart() {},
  10319. polygonEnd() {},
  10320. sphere() {}
  10321. };
  10322. for (const object of channel.value)
  10323. stream_default(object, sink);
  10324. return [x, y];
  10325. }
  10326. function xyProjection({ x: X3, y: Y3 }) {
  10327. if (X3 || Y3) {
  10328. X3 ??= (x) => x;
  10329. Y3 ??= (y) => y;
  10330. return transform_default({
  10331. point(x, y) {
  10332. this.stream.point(X3(x), Y3(y));
  10333. }
  10334. });
  10335. }
  10336. }
  10337. // node_modules/@observablehq/plot/src/context.js
  10338. function createContext(options = {}) {
  10339. const { document: document2 = typeof window !== "undefined" ? window.document : undefined, clip } = options;
  10340. return { document: document2, clip: maybeClip(clip) };
  10341. }
  10342. function create2(name, { document: document2 }) {
  10343. return select_default2(creator_default(name).call(document2.documentElement));
  10344. }
  10345. // node_modules/@observablehq/plot/src/memoize.js
  10346. var unset = Symbol("unset");
  10347. function memoize1(compute) {
  10348. return (compute.length === 1 ? memoize1Arg : memoize1Args)(compute);
  10349. }
  10350. function memoize1Arg(compute) {
  10351. let cacheValue;
  10352. let cacheKey = unset;
  10353. return (key) => {
  10354. if (!Object.is(cacheKey, key)) {
  10355. cacheKey = key;
  10356. cacheValue = compute(key);
  10357. }
  10358. return cacheValue;
  10359. };
  10360. }
  10361. function memoize1Args(compute) {
  10362. let cacheValue, cacheKeys;
  10363. return (...keys) => {
  10364. if (cacheKeys?.length !== keys.length || cacheKeys.some((k2, i) => !Object.is(k2, keys[i]))) {
  10365. cacheKeys = keys;
  10366. cacheValue = compute(...keys);
  10367. }
  10368. return cacheValue;
  10369. };
  10370. }
  10371. // node_modules/@observablehq/plot/src/format.js
  10372. var numberFormat = memoize1((locale3) => {
  10373. return new Intl.NumberFormat(locale3);
  10374. });
  10375. var monthFormat = memoize1((locale3, month) => {
  10376. return new Intl.DateTimeFormat(locale3, { timeZone: "UTC", ...month && { month } });
  10377. });
  10378. var weekdayFormat = memoize1((locale3, weekday) => {
  10379. return new Intl.DateTimeFormat(locale3, { timeZone: "UTC", ...weekday && { weekday } });
  10380. });
  10381. function formatNumber(locale3 = "en-US") {
  10382. const format3 = numberFormat(locale3);
  10383. return (i) => i != null && !isNaN(i) ? format3.format(i) : undefined;
  10384. }
  10385. function formatIsoDate(date2) {
  10386. return format2(date2, "Invalid Date");
  10387. }
  10388. function formatAuto(locale3 = "en-US") {
  10389. const number6 = formatNumber(locale3);
  10390. return (v) => (v instanceof Date ? formatIsoDate : typeof v === "number" ? number6 : string)(v);
  10391. }
  10392. var formatDefault = formatAuto();
  10393. // node_modules/@observablehq/plot/src/style.js
  10394. var offset = (typeof window !== "undefined" ? window.devicePixelRatio > 1 : typeof it === "undefined") ? 0 : 0.5;
  10395. var nextClipId = 0;
  10396. function getClipId() {
  10397. return `plot-clip-${++nextClipId}`;
  10398. }
  10399. function styles(mark, {
  10400. title,
  10401. href,
  10402. ariaLabel: variaLabel,
  10403. ariaDescription,
  10404. ariaHidden,
  10405. target,
  10406. fill,
  10407. fillOpacity,
  10408. stroke,
  10409. strokeWidth,
  10410. strokeOpacity,
  10411. strokeLinejoin,
  10412. strokeLinecap,
  10413. strokeMiterlimit,
  10414. strokeDasharray,
  10415. strokeDashoffset,
  10416. opacity: opacity2,
  10417. mixBlendMode,
  10418. imageFilter,
  10419. paintOrder,
  10420. pointerEvents,
  10421. shapeRendering,
  10422. channels
  10423. }, {
  10424. ariaLabel: cariaLabel,
  10425. fill: defaultFill = "currentColor",
  10426. fillOpacity: defaultFillOpacity,
  10427. stroke: defaultStroke = "none",
  10428. strokeOpacity: defaultStrokeOpacity,
  10429. strokeWidth: defaultStrokeWidth,
  10430. strokeLinecap: defaultStrokeLinecap,
  10431. strokeLinejoin: defaultStrokeLinejoin,
  10432. strokeMiterlimit: defaultStrokeMiterlimit,
  10433. paintOrder: defaultPaintOrder
  10434. }) {
  10435. if (defaultFill === null) {
  10436. fill = null;
  10437. fillOpacity = null;
  10438. }
  10439. if (defaultStroke === null) {
  10440. stroke = null;
  10441. strokeOpacity = null;
  10442. }
  10443. if (isNoneish(defaultFill)) {
  10444. if (!isNoneish(defaultStroke) && (!isNoneish(fill) || channels?.fill))
  10445. defaultStroke = "none";
  10446. } else {
  10447. if (isNoneish(defaultStroke) && (!isNoneish(stroke) || channels?.stroke))
  10448. defaultFill = "none";
  10449. }
  10450. const [vfill, cfill] = maybeColorChannel(fill, defaultFill);
  10451. const [vfillOpacity, cfillOpacity] = maybeNumberChannel(fillOpacity, defaultFillOpacity);
  10452. const [vstroke, cstroke] = maybeColorChannel(stroke, defaultStroke);
  10453. const [vstrokeOpacity, cstrokeOpacity] = maybeNumberChannel(strokeOpacity, defaultStrokeOpacity);
  10454. const [vopacity, copacity] = maybeNumberChannel(opacity2);
  10455. if (!isNone(cstroke)) {
  10456. if (strokeWidth === undefined)
  10457. strokeWidth = defaultStrokeWidth;
  10458. if (strokeLinecap === undefined)
  10459. strokeLinecap = defaultStrokeLinecap;
  10460. if (strokeLinejoin === undefined)
  10461. strokeLinejoin = defaultStrokeLinejoin;
  10462. if (strokeMiterlimit === undefined && !isRound(strokeLinejoin))
  10463. strokeMiterlimit = defaultStrokeMiterlimit;
  10464. if (!isNone(cfill) && paintOrder === undefined)
  10465. paintOrder = defaultPaintOrder;
  10466. }
  10467. const [vstrokeWidth, cstrokeWidth] = maybeNumberChannel(strokeWidth);
  10468. if (defaultFill !== null) {
  10469. mark.fill = impliedString(cfill, "currentColor");
  10470. mark.fillOpacity = impliedNumber(cfillOpacity, 1);
  10471. }
  10472. if (defaultStroke !== null) {
  10473. mark.stroke = impliedString(cstroke, "none");
  10474. mark.strokeWidth = impliedNumber(cstrokeWidth, 1);
  10475. mark.strokeOpacity = impliedNumber(cstrokeOpacity, 1);
  10476. mark.strokeLinejoin = impliedString(strokeLinejoin, "miter");
  10477. mark.strokeLinecap = impliedString(strokeLinecap, "butt");
  10478. mark.strokeMiterlimit = impliedNumber(strokeMiterlimit, 4);
  10479. mark.strokeDasharray = impliedString(strokeDasharray, "none");
  10480. mark.strokeDashoffset = impliedString(strokeDashoffset, "0");
  10481. }
  10482. mark.target = string(target);
  10483. mark.ariaLabel = string(cariaLabel);
  10484. mark.ariaDescription = string(ariaDescription);
  10485. mark.ariaHidden = string(ariaHidden);
  10486. mark.opacity = impliedNumber(copacity, 1);
  10487. mark.mixBlendMode = impliedString(mixBlendMode, "normal");
  10488. mark.imageFilter = impliedString(imageFilter, "none");
  10489. mark.paintOrder = impliedString(paintOrder, "normal");
  10490. mark.pointerEvents = impliedString(pointerEvents, "auto");
  10491. mark.shapeRendering = impliedString(shapeRendering, "auto");
  10492. return {
  10493. title: { value: title, optional: true, filter: null },
  10494. href: { value: href, optional: true, filter: null },
  10495. ariaLabel: { value: variaLabel, optional: true, filter: null },
  10496. fill: { value: vfill, scale: "auto", optional: true },
  10497. fillOpacity: { value: vfillOpacity, scale: "auto", optional: true },
  10498. stroke: { value: vstroke, scale: "auto", optional: true },
  10499. strokeOpacity: { value: vstrokeOpacity, scale: "auto", optional: true },
  10500. strokeWidth: { value: vstrokeWidth, optional: true },
  10501. opacity: { value: vopacity, scale: "auto", optional: true }
  10502. };
  10503. }
  10504. function applyTitle(selection2, L) {
  10505. if (L)
  10506. selection2.filter((i) => nonempty(L[i])).append("title").call(applyText, L);
  10507. }
  10508. function applyText(selection2, T) {
  10509. if (T)
  10510. selection2.text((i) => formatDefault(T[i]));
  10511. }
  10512. function applyChannelStyles(selection2, { target, tip }, {
  10513. ariaLabel: AL,
  10514. title: T,
  10515. fill: F,
  10516. fillOpacity: FO,
  10517. stroke: S,
  10518. strokeOpacity: SO,
  10519. strokeWidth: SW,
  10520. opacity: O,
  10521. href: H
  10522. }) {
  10523. if (AL)
  10524. applyAttr(selection2, "aria-label", (i) => AL[i]);
  10525. if (F)
  10526. applyAttr(selection2, "fill", (i) => F[i]);
  10527. if (FO)
  10528. applyAttr(selection2, "fill-opacity", (i) => FO[i]);
  10529. if (S)
  10530. applyAttr(selection2, "stroke", (i) => S[i]);
  10531. if (SO)
  10532. applyAttr(selection2, "stroke-opacity", (i) => SO[i]);
  10533. if (SW)
  10534. applyAttr(selection2, "stroke-width", (i) => SW[i]);
  10535. if (O)
  10536. applyAttr(selection2, "opacity", (i) => O[i]);
  10537. if (H)
  10538. applyHref(selection2, (i) => H[i], target);
  10539. if (!tip)
  10540. applyTitle(selection2, T);
  10541. }
  10542. function applyClip(selection2, mark, dimensions, context) {
  10543. let clipUrl;
  10544. const { clip = context.clip } = mark;
  10545. if (clip === "frame") {
  10546. selection2 = create2("svg:g", context).each(function() {
  10547. this.appendChild(selection2.node());
  10548. selection2.node = () => this;
  10549. });
  10550. clipUrl = getFrameClip(context, dimensions);
  10551. } else if (clip) {
  10552. clipUrl = getGeoClip(clip, context);
  10553. }
  10554. applyAttr(selection2, "aria-label", mark.ariaLabel);
  10555. applyAttr(selection2, "aria-description", mark.ariaDescription);
  10556. applyAttr(selection2, "aria-hidden", mark.ariaHidden);
  10557. applyAttr(selection2, "clip-path", clipUrl);
  10558. }
  10559. function memoizeClip(clip) {
  10560. const cache = new WeakMap;
  10561. return (context, dimensions) => {
  10562. let url = cache.get(context);
  10563. if (!url) {
  10564. const id2 = getClipId();
  10565. select_default2(context.ownerSVGElement).append("clipPath").attr("id", id2).call(clip, context, dimensions);
  10566. cache.set(context, url = `url(#${id2})`);
  10567. }
  10568. return url;
  10569. };
  10570. }
  10571. var getFrameClip = memoizeClip((clipPath, context, dimensions) => {
  10572. const { width, height, marginLeft, marginRight, marginTop, marginBottom } = dimensions;
  10573. clipPath.append("rect").attr("x", marginLeft).attr("y", marginTop).attr("width", width - marginRight - marginLeft).attr("height", height - marginTop - marginBottom);
  10574. });
  10575. var geoClipCache = new WeakMap;
  10576. var sphere = { type: "Sphere" };
  10577. function getGeoClip(geo, context) {
  10578. let cache, url;
  10579. if (!(cache = geoClipCache.get(context)))
  10580. geoClipCache.set(context, cache = new WeakMap);
  10581. if (geo.type === "Sphere")
  10582. geo = sphere;
  10583. if (!(url = cache.get(geo))) {
  10584. const id2 = getClipId();
  10585. select_default2(context.ownerSVGElement).append("clipPath").attr("id", id2).append("path").attr("d", context.path()(geo));
  10586. cache.set(geo, url = `url(#${id2})`);
  10587. }
  10588. return url;
  10589. }
  10590. function applyIndirectStyles(selection2, mark, dimensions, context) {
  10591. applyClip(selection2, mark, dimensions, context);
  10592. applyAttr(selection2, "class", mark.className);
  10593. applyAttr(selection2, "fill", mark.fill);
  10594. applyAttr(selection2, "fill-opacity", mark.fillOpacity);
  10595. applyAttr(selection2, "stroke", mark.stroke);
  10596. applyAttr(selection2, "stroke-width", mark.strokeWidth);
  10597. applyAttr(selection2, "stroke-opacity", mark.strokeOpacity);
  10598. applyAttr(selection2, "stroke-linejoin", mark.strokeLinejoin);
  10599. applyAttr(selection2, "stroke-linecap", mark.strokeLinecap);
  10600. applyAttr(selection2, "stroke-miterlimit", mark.strokeMiterlimit);
  10601. applyAttr(selection2, "stroke-dasharray", mark.strokeDasharray);
  10602. applyAttr(selection2, "stroke-dashoffset", mark.strokeDashoffset);
  10603. applyAttr(selection2, "shape-rendering", mark.shapeRendering);
  10604. applyAttr(selection2, "filter", mark.imageFilter);
  10605. applyAttr(selection2, "paint-order", mark.paintOrder);
  10606. const { pointerEvents = context.pointerSticky === false ? "none" : undefined } = mark;
  10607. applyAttr(selection2, "pointer-events", pointerEvents);
  10608. }
  10609. function applyDirectStyles(selection2, mark) {
  10610. applyStyle(selection2, "mix-blend-mode", mark.mixBlendMode);
  10611. applyAttr(selection2, "opacity", mark.opacity);
  10612. }
  10613. function applyHref(selection2, href, target) {
  10614. selection2.each(function(i) {
  10615. const h = href(i);
  10616. if (h != null) {
  10617. const a2 = this.ownerDocument.createElementNS(namespaces_default.svg, "a");
  10618. a2.setAttribute("fill", "inherit");
  10619. a2.setAttributeNS(namespaces_default.xlink, "href", h);
  10620. if (target != null)
  10621. a2.setAttribute("target", target);
  10622. this.parentNode.insertBefore(a2, this).appendChild(this);
  10623. }
  10624. });
  10625. }
  10626. function applyAttr(selection2, name, value) {
  10627. if (value != null)
  10628. selection2.attr(name, value);
  10629. }
  10630. function applyStyle(selection2, name, value) {
  10631. if (value != null)
  10632. selection2.style(name, value);
  10633. }
  10634. function applyTransform(selection2, mark, { x, y }, tx = offset, ty = offset) {
  10635. tx += mark.dx;
  10636. ty += mark.dy;
  10637. if (x?.bandwidth)
  10638. tx += x.bandwidth() / 2;
  10639. if (y?.bandwidth)
  10640. ty += y.bandwidth() / 2;
  10641. if (tx || ty)
  10642. selection2.attr("transform", `translate(${tx},${ty})`);
  10643. }
  10644. function impliedString(value, impliedValue) {
  10645. if ((value = string(value)) !== impliedValue)
  10646. return value;
  10647. }
  10648. function impliedNumber(value, impliedValue) {
  10649. if ((value = number5(value)) !== impliedValue)
  10650. return value;
  10651. }
  10652. var validClassName = /^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;
  10653. function maybeClassName(name) {
  10654. if (name === undefined)
  10655. return "plot-d6a7b5";
  10656. name = `${name}`;
  10657. if (!validClassName.test(name))
  10658. throw new Error(`invalid class name: ${name}`);
  10659. return name;
  10660. }
  10661. function applyInlineStyles(selection2, style) {
  10662. if (typeof style === "string") {
  10663. selection2.property("style", style);
  10664. } else if (style != null) {
  10665. for (const element of selection2) {
  10666. Object.assign(element.style, style);
  10667. }
  10668. }
  10669. }
  10670. function applyFrameAnchor({ frameAnchor }, { width, height, marginTop, marginRight, marginBottom, marginLeft }) {
  10671. return [
  10672. /left$/.test(frameAnchor) ? marginLeft : /right$/.test(frameAnchor) ? width - marginRight : (marginLeft + width - marginRight) / 2,
  10673. /^top/.test(frameAnchor) ? marginTop : /^bottom/.test(frameAnchor) ? height - marginBottom : (marginTop + height - marginBottom) / 2
  10674. ];
  10675. }
  10676. // node_modules/@observablehq/plot/src/mark.js
  10677. class Mark {
  10678. constructor(data, channels = {}, options = {}, defaults) {
  10679. const {
  10680. facet = "auto",
  10681. facetAnchor,
  10682. fx,
  10683. fy,
  10684. sort: sort3,
  10685. dx = 0,
  10686. dy = 0,
  10687. margin = 0,
  10688. marginTop = margin,
  10689. marginRight = margin,
  10690. marginBottom = margin,
  10691. marginLeft = margin,
  10692. className,
  10693. clip = defaults?.clip,
  10694. channels: extraChannels,
  10695. tip,
  10696. render
  10697. } = options;
  10698. this.data = data;
  10699. this.sort = isDomainSort(sort3) ? sort3 : null;
  10700. this.initializer = initializer(options).initializer;
  10701. this.transform = this.initializer ? options.transform : basic(options).transform;
  10702. if (facet === null || facet === false) {
  10703. this.facet = null;
  10704. } else {
  10705. this.facet = keyword(facet === true ? "include" : facet, "facet", ["auto", "include", "exclude", "super"]);
  10706. this.fx = data === singleton && typeof fx === "string" ? [fx] : fx;
  10707. this.fy = data === singleton && typeof fy === "string" ? [fy] : fy;
  10708. }
  10709. this.facetAnchor = maybeFacetAnchor(facetAnchor);
  10710. channels = maybeNamed(channels);
  10711. if (extraChannels !== undefined)
  10712. channels = { ...maybeChannels(extraChannels), ...channels };
  10713. if (defaults !== undefined)
  10714. channels = { ...styles(this, options, defaults), ...channels };
  10715. this.channels = Object.fromEntries(Object.entries(channels).map(([name, channel]) => {
  10716. if (isOptions(channel.value)) {
  10717. const { value, label = channel.label, scale = channel.scale } = channel.value;
  10718. channel = { ...channel, label, scale, value };
  10719. }
  10720. if (data === singleton && typeof channel.value === "string") {
  10721. const { value } = channel;
  10722. channel = { ...channel, value: [value] };
  10723. }
  10724. return [name, channel];
  10725. }).filter(([name, { value, optional }]) => {
  10726. if (value != null)
  10727. return true;
  10728. if (optional)
  10729. return false;
  10730. throw new Error(`missing channel value: ${name}`);
  10731. }));
  10732. this.dx = +dx;
  10733. this.dy = +dy;
  10734. this.marginTop = +marginTop;
  10735. this.marginRight = +marginRight;
  10736. this.marginBottom = +marginBottom;
  10737. this.marginLeft = +marginLeft;
  10738. this.clip = maybeClip(clip);
  10739. this.tip = maybeTip(tip);
  10740. this.className = string(className);
  10741. if (this.facet === "super") {
  10742. if (fx || fy)
  10743. throw new Error(`super-faceting cannot use fx or fy`);
  10744. for (const name in this.channels) {
  10745. const { scale } = channels[name];
  10746. if (scale !== "x" && scale !== "y")
  10747. continue;
  10748. throw new Error(`super-faceting cannot use x or y`);
  10749. }
  10750. }
  10751. if (render != null) {
  10752. this.render = composeRender(render, this.render);
  10753. }
  10754. }
  10755. initialize(facets, facetChannels, plotOptions) {
  10756. let data = dataify(this.data);
  10757. if (facets === undefined && data != null)
  10758. facets = [range2(data)];
  10759. const originalFacets = facets;
  10760. if (this.transform != null)
  10761. ({ facets, data } = this.transform(data, facets, plotOptions)), data = dataify(data);
  10762. if (facets !== undefined)
  10763. facets.original = originalFacets;
  10764. const channels = createChannels(this.channels, data);
  10765. if (this.sort != null)
  10766. channelDomain(data, facets, channels, facetChannels, this.sort);
  10767. return { data, facets, channels };
  10768. }
  10769. filter(index2, channels, values2) {
  10770. for (const name in channels) {
  10771. const { filter: filter2 = defined } = channels[name];
  10772. if (filter2 !== null) {
  10773. const value = values2[name];
  10774. index2 = index2.filter((i) => filter2(value[i]));
  10775. }
  10776. }
  10777. return index2;
  10778. }
  10779. project(channels, values2, context) {
  10780. for (const cx in channels) {
  10781. if (channels[cx].scale === "x" && /^x|x$/.test(cx)) {
  10782. const cy = cx.replace(/^x|x$/, "y");
  10783. if (cy in channels && channels[cy].scale === "y") {
  10784. project(cx, cy, values2, context.projection);
  10785. }
  10786. }
  10787. }
  10788. }
  10789. scale(channels, scales, context) {
  10790. const values2 = valueObject(channels, scales);
  10791. if (context.projection)
  10792. this.project(channels, values2, context);
  10793. return values2;
  10794. }
  10795. }
  10796. function marks(...marks2) {
  10797. marks2.plot = Mark.prototype.plot;
  10798. return marks2;
  10799. }
  10800. function composeRender(r1, r2) {
  10801. if (r1 == null)
  10802. return r2 === null ? undefined : r2;
  10803. if (r2 == null)
  10804. return r1 === null ? undefined : r1;
  10805. if (typeof r1 !== "function")
  10806. throw new TypeError(`invalid render transform: ${r1}`);
  10807. if (typeof r2 !== "function")
  10808. throw new TypeError(`invalid render transform: ${r2}`);
  10809. return function(i, s2, v, d, c4, next) {
  10810. return r1.call(this, i, s2, v, d, c4, (i2, s3, v2, d2, c5) => {
  10811. return r2.call(this, i2, s3, v2, d2, c5, next);
  10812. });
  10813. };
  10814. }
  10815. function maybeChannels(channels) {
  10816. return Object.fromEntries(Object.entries(maybeNamed(channels)).map(([name, channel]) => {
  10817. channel = typeof channel === "string" ? { value: channel, label: name } : maybeValue(channel);
  10818. if (channel.filter === undefined && channel.scale == null)
  10819. channel = { ...channel, filter: null };
  10820. return [name, channel];
  10821. }));
  10822. }
  10823. function maybeTip(tip) {
  10824. return tip === true ? "xy" : tip === false || tip == null ? null : typeof tip === "string" ? keyword(tip, "tip", ["x", "y", "xy"]) : tip;
  10825. }
  10826. function withTip(options, pointer) {
  10827. return options?.tip === true ? { ...options, tip: pointer } : isObject(options?.tip) && options.tip.pointer === undefined ? { ...options, tip: { ...options.tip, pointer } } : options;
  10828. }
  10829. // node_modules/@observablehq/plot/src/dimensions.js
  10830. function createDimensions(scales, marks2, options = {}) {
  10831. let marginTopDefault = 0.5 - offset, marginRightDefault = 0.5 + offset, marginBottomDefault = 0.5 + offset, marginLeftDefault = 0.5 - offset;
  10832. for (const { marginTop: marginTop2, marginRight: marginRight2, marginBottom: marginBottom2, marginLeft: marginLeft2 } of marks2) {
  10833. if (marginTop2 > marginTopDefault)
  10834. marginTopDefault = marginTop2;
  10835. if (marginRight2 > marginRightDefault)
  10836. marginRightDefault = marginRight2;
  10837. if (marginBottom2 > marginBottomDefault)
  10838. marginBottomDefault = marginBottom2;
  10839. if (marginLeft2 > marginLeftDefault)
  10840. marginLeftDefault = marginLeft2;
  10841. }
  10842. let {
  10843. margin,
  10844. marginTop = margin !== undefined ? margin : marginTopDefault,
  10845. marginRight = margin !== undefined ? margin : marginRightDefault,
  10846. marginBottom = margin !== undefined ? margin : marginBottomDefault,
  10847. marginLeft = margin !== undefined ? margin : marginLeftDefault
  10848. } = options;
  10849. marginTop = +marginTop;
  10850. marginRight = +marginRight;
  10851. marginBottom = +marginBottom;
  10852. marginLeft = +marginLeft;
  10853. let {
  10854. width = 640,
  10855. height = autoHeight(scales, options, {
  10856. width,
  10857. marginTopDefault,
  10858. marginRightDefault,
  10859. marginBottomDefault,
  10860. marginLeftDefault
  10861. }) + Math.max(0, marginTop - marginTopDefault + marginBottom - marginBottomDefault)
  10862. } = options;
  10863. width = +width;
  10864. height = +height;
  10865. const dimensions = {
  10866. width,
  10867. height,
  10868. marginTop,
  10869. marginRight,
  10870. marginBottom,
  10871. marginLeft
  10872. };
  10873. if (scales.fx || scales.fy) {
  10874. let {
  10875. margin: facetMargin,
  10876. marginTop: facetMarginTop = facetMargin !== undefined ? facetMargin : marginTop,
  10877. marginRight: facetMarginRight = facetMargin !== undefined ? facetMargin : marginRight,
  10878. marginBottom: facetMarginBottom = facetMargin !== undefined ? facetMargin : marginBottom,
  10879. marginLeft: facetMarginLeft = facetMargin !== undefined ? facetMargin : marginLeft
  10880. } = options.facet ?? {};
  10881. facetMarginTop = +facetMarginTop;
  10882. facetMarginRight = +facetMarginRight;
  10883. facetMarginBottom = +facetMarginBottom;
  10884. facetMarginLeft = +facetMarginLeft;
  10885. dimensions.facet = {
  10886. marginTop: facetMarginTop,
  10887. marginRight: facetMarginRight,
  10888. marginBottom: facetMarginBottom,
  10889. marginLeft: facetMarginLeft
  10890. };
  10891. }
  10892. return dimensions;
  10893. }
  10894. function autoHeight({ x, y, fy, fx }, { projection: projection3, aspectRatio }, { width, marginTopDefault, marginRightDefault, marginBottomDefault, marginLeftDefault }) {
  10895. const nfy = fy ? fy.scale.domain().length || 1 : 1;
  10896. const ar = projectionAspectRatio(projection3);
  10897. if (ar) {
  10898. const nfx = fx ? fx.scale.domain().length : 1;
  10899. const far = (1.1 * nfy - 0.1) / (1.1 * nfx - 0.1) * ar;
  10900. const lar = Math.max(0.1, Math.min(10, far));
  10901. return Math.round((width - marginLeftDefault - marginRightDefault) * lar + marginTopDefault + marginBottomDefault);
  10902. }
  10903. const ny = y ? isOrdinalScale(y) ? y.scale.domain().length || 1 : Math.max(7, 17 / nfy) : 1;
  10904. if (aspectRatio != null) {
  10905. aspectRatio = +aspectRatio;
  10906. if (!(isFinite(aspectRatio) && aspectRatio > 0))
  10907. throw new Error(`invalid aspectRatio: ${aspectRatio}`);
  10908. const ratio = aspectRatioLength("y", y) / (aspectRatioLength("x", x) * aspectRatio);
  10909. const fxb = fx ? fx.scale.bandwidth() : 1;
  10910. const fyb = fy ? fy.scale.bandwidth() : 1;
  10911. const w = fxb * (width - marginLeftDefault - marginRightDefault) - x.insetLeft - x.insetRight;
  10912. return (ratio * w + y.insetTop + y.insetBottom) / fyb + marginTopDefault + marginBottomDefault;
  10913. }
  10914. return !!(y || fy) * Math.max(1, Math.min(60, ny * nfy)) * 20 + !!fx * 30 + 60;
  10915. }
  10916. function aspectRatioLength(k2, scale) {
  10917. if (!scale)
  10918. throw new Error(`aspectRatio requires ${k2} scale`);
  10919. const { type: type2, domain } = scale;
  10920. let transform2;
  10921. switch (type2) {
  10922. case "linear":
  10923. case "utc":
  10924. case "time":
  10925. transform2 = Number;
  10926. break;
  10927. case "pow": {
  10928. const exponent = scale.scale.exponent();
  10929. transform2 = (x) => Math.pow(x, exponent);
  10930. break;
  10931. }
  10932. case "log":
  10933. transform2 = Math.log;
  10934. break;
  10935. case "point":
  10936. case "band":
  10937. return domain.length;
  10938. default:
  10939. throw new Error(`unsupported ${k2} scale for aspectRatio: ${type2}`);
  10940. }
  10941. const [min3, max2] = extent(domain);
  10942. return Math.abs(transform2(max2) - transform2(min3));
  10943. }
  10944. // node_modules/@observablehq/plot/src/interactions/pointer.js
  10945. var states = new WeakMap;
  10946. function pointerK(kx2, ky2, { x, y, px, py, maxRadius = 40, channels, render, ...options } = {}) {
  10947. maxRadius = +maxRadius;
  10948. if (px != null)
  10949. x ??= null, channels = { ...channels, px: { value: px, scale: "x" } };
  10950. if (py != null)
  10951. y ??= null, channels = { ...channels, py: { value: py, scale: "y" } };
  10952. return {
  10953. x,
  10954. y,
  10955. channels,
  10956. ...options,
  10957. render: composeRender(function(index2, scales, values2, dimensions, context, next) {
  10958. context = { ...context, pointerSticky: false };
  10959. const svg = context.ownerSVGElement;
  10960. const { data } = context.getMarkState(this);
  10961. let state = states.get(svg);
  10962. if (!state)
  10963. states.set(svg, state = { sticky: false, roots: [], renders: [] });
  10964. let renderIndex = state.renders.push(render2) - 1;
  10965. const { x: x2, y: y2, fx, fy } = scales;
  10966. let tx = fx ? fx(index2.fx) - dimensions.marginLeft : 0;
  10967. let ty = fy ? fy(index2.fy) - dimensions.marginTop : 0;
  10968. if (x2?.bandwidth)
  10969. tx += x2.bandwidth() / 2;
  10970. if (y2?.bandwidth)
  10971. ty += y2.bandwidth() / 2;
  10972. const faceted = index2.fi != null;
  10973. let facetState;
  10974. if (faceted) {
  10975. let facetStates = state.facetStates;
  10976. if (!facetStates)
  10977. state.facetStates = facetStates = new Map;
  10978. facetState = facetStates.get(this);
  10979. if (!facetState)
  10980. facetStates.set(this, facetState = new Map);
  10981. }
  10982. const [cx, cy] = applyFrameAnchor(this, dimensions);
  10983. const { px: PX, py: PY } = values2;
  10984. const px2 = PX ? (i2) => PX[i2] : anchorX(values2, cx);
  10985. const py2 = PY ? (i2) => PY[i2] : anchorY(values2, cy);
  10986. let i;
  10987. let g;
  10988. let s2;
  10989. let f;
  10990. function update(ii, ri) {
  10991. if (faceted) {
  10992. if (f)
  10993. f = cancelAnimationFrame(f);
  10994. if (ii == null)
  10995. facetState.delete(index2.fi);
  10996. else {
  10997. facetState.set(index2.fi, ri);
  10998. f = requestAnimationFrame(() => {
  10999. f = null;
  11000. for (const [fi, r] of facetState) {
  11001. if (r < ri || r === ri && fi < index2.fi) {
  11002. ii = null;
  11003. break;
  11004. }
  11005. }
  11006. render2(ii);
  11007. });
  11008. return;
  11009. }
  11010. }
  11011. render2(ii);
  11012. }
  11013. function render2(ii) {
  11014. if (i === ii && s2 === state.sticky)
  11015. return;
  11016. i = ii;
  11017. s2 = context.pointerSticky = state.sticky;
  11018. const I = i == null ? [] : [i];
  11019. if (faceted)
  11020. I.fx = index2.fx, I.fy = index2.fy, I.fi = index2.fi;
  11021. const r = next(I, scales, values2, dimensions, context);
  11022. if (g) {
  11023. if (faceted) {
  11024. const p = g.parentNode;
  11025. const ft = g.getAttribute("transform");
  11026. const mt = r.getAttribute("transform");
  11027. ft ? r.setAttribute("transform", ft) : r.removeAttribute("transform");
  11028. mt ? p.setAttribute("transform", mt) : p.removeAttribute("transform");
  11029. r.removeAttribute("aria-label");
  11030. r.removeAttribute("aria-description");
  11031. r.removeAttribute("aria-hidden");
  11032. }
  11033. g.replaceWith(r);
  11034. }
  11035. state.roots[renderIndex] = g = r;
  11036. if (!(i == null && facetState?.size > 1)) {
  11037. const value = i == null ? null : isArray(data) ? data[i] : data.get(i);
  11038. context.dispatchValue(value);
  11039. }
  11040. return r;
  11041. }
  11042. function pointermove(event) {
  11043. if (state.sticky || event.pointerType === "mouse" && event.buttons === 1)
  11044. return;
  11045. let [xp, yp] = pointer_default(event);
  11046. xp -= tx, yp -= ty;
  11047. const kpx = xp < dimensions.marginLeft || xp > dimensions.width - dimensions.marginRight ? 1 : kx2;
  11048. const kpy = yp < dimensions.marginTop || yp > dimensions.height - dimensions.marginBottom ? 1 : ky2;
  11049. let ii = null;
  11050. let ri = maxRadius * maxRadius;
  11051. for (const j of index2) {
  11052. const dx = kpx * (px2(j) - xp);
  11053. const dy = kpy * (py2(j) - yp);
  11054. const rj = dx * dx + dy * dy;
  11055. if (rj <= ri)
  11056. ii = j, ri = rj;
  11057. }
  11058. if (ii != null && (kx2 !== 1 || ky2 !== 1)) {
  11059. const dx = px2(ii) - xp;
  11060. const dy = py2(ii) - yp;
  11061. ri = dx * dx + dy * dy;
  11062. }
  11063. update(ii, ri);
  11064. }
  11065. function pointerdown(event) {
  11066. if (event.pointerType !== "mouse")
  11067. return;
  11068. if (i == null)
  11069. return;
  11070. if (state.sticky && state.roots.some((r) => r?.contains(event.target)))
  11071. return;
  11072. if (state.sticky)
  11073. state.sticky = false, state.renders.forEach((r) => r(null));
  11074. else
  11075. state.sticky = true, render2(i);
  11076. event.stopImmediatePropagation();
  11077. }
  11078. function pointerleave(event) {
  11079. if (event.pointerType !== "mouse")
  11080. return;
  11081. if (!state.sticky)
  11082. update(null);
  11083. }
  11084. svg.addEventListener("pointerenter", pointermove);
  11085. svg.addEventListener("pointermove", pointermove);
  11086. svg.addEventListener("pointerdown", pointerdown);
  11087. svg.addEventListener("pointerleave", pointerleave);
  11088. return render2(null);
  11089. }, render)
  11090. };
  11091. }
  11092. function pointer(options) {
  11093. return pointerK(1, 1, options);
  11094. }
  11095. function pointerX(options) {
  11096. return pointerK(1, 0.01, options);
  11097. }
  11098. function pointerY(options) {
  11099. return pointerK(0.01, 1, options);
  11100. }
  11101. function anchorX({ x1: X12, x2: X22, x: X3 = X12 }, cx) {
  11102. return X12 && X22 ? (i) => (X12[i] + X22[i]) / 2 : X3 ? (i) => X3[i] : () => cx;
  11103. }
  11104. function anchorY({ y1: Y12, y2: Y22, y: Y3 = Y12 }, cy) {
  11105. return Y12 && Y22 ? (i) => (Y12[i] + Y22[i]) / 2 : Y3 ? (i) => Y3[i] : () => cy;
  11106. }
  11107. // node_modules/@observablehq/plot/src/axes.js
  11108. function inferFontVariant(scale) {
  11109. return isOrdinalScale(scale) && scale.interval === undefined ? undefined : "tabular-nums";
  11110. }
  11111. // node_modules/@observablehq/plot/src/legends/ramp.js
  11112. function legendRamp(color3, options) {
  11113. let {
  11114. label = color3.label,
  11115. tickSize = 6,
  11116. width = 240,
  11117. height = 44 + tickSize,
  11118. marginTop = 18,
  11119. marginRight = 0,
  11120. marginBottom = 16 + tickSize,
  11121. marginLeft = 0,
  11122. style,
  11123. ticks: ticks2 = (width - marginLeft - marginRight) / 64,
  11124. tickFormat: tickFormat2,
  11125. fontVariant = inferFontVariant(color3),
  11126. round = true,
  11127. opacity: opacity2,
  11128. className
  11129. } = options;
  11130. const context = createContext(options);
  11131. className = maybeClassName(className);
  11132. opacity2 = maybeNumberChannel(opacity2)[1];
  11133. if (tickFormat2 === null)
  11134. tickFormat2 = () => null;
  11135. const svg = create2("svg", context).attr("class", `${className}-ramp`).attr("font-family", "system-ui, sans-serif").attr("font-size", 10).attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).call((svg2) => svg2.append("style").text(`:where(.${className}-ramp) {
  11136. display: block;
  11137. height: auto;
  11138. height: intrinsic;
  11139. max-width: 100%;
  11140. overflow: visible;
  11141. }
  11142. :where(.${className}-ramp text) {
  11143. white-space: pre;
  11144. }`)).call(applyInlineStyles, style);
  11145. let tickAdjust = (g) => g.selectAll(".tick line").attr("y1", marginTop + marginBottom - height);
  11146. let x;
  11147. const applyRange = round ? (x2, range4) => x2.rangeRound(range4) : (x2, range4) => x2.range(range4);
  11148. const { type: type2, domain, range: range3, interpolate, scale, pivot } = color3;
  11149. if (interpolate) {
  11150. const interpolator = range3 === undefined ? interpolate : piecewise(interpolate.length === 1 ? interpolatePiecewise(interpolate) : interpolate, range3);
  11151. x = applyRange(scale.copy(), quantize_default(number_default(marginLeft, width - marginRight), Math.min(domain.length + (pivot !== undefined), range3 === undefined ? Infinity : range3.length)));
  11152. const n = 256;
  11153. const canvas = context.document.createElement("canvas");
  11154. canvas.width = n;
  11155. canvas.height = 1;
  11156. const context2 = canvas.getContext("2d");
  11157. for (let i = 0, j = n - 1;i < n; ++i) {
  11158. context2.fillStyle = interpolator(i / j);
  11159. context2.fillRect(i, 0, 1, 1);
  11160. }
  11161. svg.append("image").attr("opacity", opacity2).attr("x", marginLeft).attr("y", marginTop).attr("width", width - marginLeft - marginRight).attr("height", height - marginTop - marginBottom).attr("preserveAspectRatio", "none").attr("xlink:href", canvas.toDataURL());
  11162. } else if (type2 === "threshold") {
  11163. const thresholds = domain;
  11164. const thresholdFormat = tickFormat2 === undefined ? (d) => d : typeof tickFormat2 === "string" ? format(tickFormat2) : tickFormat2;
  11165. x = applyRange(linear2().domain([-1, range3.length - 1]), [marginLeft, width - marginRight]);
  11166. svg.append("g").attr("fill-opacity", opacity2).selectAll().data(range3).enter().append("rect").attr("x", (d, i) => x(i - 1)).attr("y", marginTop).attr("width", (d, i) => x(i) - x(i - 1)).attr("height", height - marginTop - marginBottom).attr("fill", (d) => d);
  11167. ticks2 = map2(thresholds, (_, i) => i);
  11168. tickFormat2 = (i) => thresholdFormat(thresholds[i], i);
  11169. } else {
  11170. x = applyRange(band().domain(domain), [marginLeft, width - marginRight]);
  11171. svg.append("g").attr("fill-opacity", opacity2).selectAll().data(domain).enter().append("rect").attr("x", x).attr("y", marginTop).attr("width", Math.max(0, x.bandwidth() - 1)).attr("height", height - marginTop - marginBottom).attr("fill", scale);
  11172. tickAdjust = () => {};
  11173. }
  11174. svg.append("g").attr("transform", `translate(0,${height - marginBottom})`).call(axisBottom(x).ticks(Array.isArray(ticks2) ? null : ticks2, typeof tickFormat2 === "string" ? tickFormat2 : undefined).tickFormat(typeof tickFormat2 === "function" ? tickFormat2 : undefined).tickSize(tickSize).tickValues(Array.isArray(ticks2) ? ticks2 : null)).attr("font-size", null).attr("font-family", null).attr("font-variant", impliedString(fontVariant, "normal")).call(tickAdjust).call((g) => g.select(".domain").remove());
  11175. if (label !== undefined) {
  11176. svg.append("text").attr("x", marginLeft).attr("y", marginTop - 6).attr("fill", "currentColor").attr("font-weight", "bold").text(label);
  11177. }
  11178. return svg.node();
  11179. }
  11180. // node_modules/@observablehq/plot/src/math.js
  11181. var radians3 = Math.PI / 180;
  11182. // node_modules/@observablehq/plot/src/marker.js
  11183. function markers(mark, { marker, markerStart = marker, markerMid = marker, markerEnd = marker } = {}) {
  11184. mark.markerStart = maybeMarker(markerStart);
  11185. mark.markerMid = maybeMarker(markerMid);
  11186. mark.markerEnd = maybeMarker(markerEnd);
  11187. }
  11188. function maybeMarker(marker) {
  11189. if (marker == null || marker === false)
  11190. return null;
  11191. if (marker === true)
  11192. return markerCircleFill;
  11193. if (typeof marker === "function")
  11194. return marker;
  11195. switch (`${marker}`.toLowerCase()) {
  11196. case "none":
  11197. return null;
  11198. case "arrow":
  11199. return markerArrow("auto");
  11200. case "arrow-reverse":
  11201. return markerArrow("auto-start-reverse");
  11202. case "dot":
  11203. return markerDot;
  11204. case "circle":
  11205. case "circle-fill":
  11206. return markerCircleFill;
  11207. case "circle-stroke":
  11208. return markerCircleStroke;
  11209. case "tick":
  11210. return markerTick("auto");
  11211. case "tick-x":
  11212. return markerTick(90);
  11213. case "tick-y":
  11214. return markerTick(0);
  11215. }
  11216. throw new Error(`invalid marker: ${marker}`);
  11217. }
  11218. function markerArrow(orient) {
  11219. return (color3, context) => create2("svg:marker", context).attr("viewBox", "-5 -5 10 10").attr("markerWidth", 6.67).attr("markerHeight", 6.67).attr("orient", orient).attr("fill", "none").attr("stroke", color3).attr("stroke-width", 1.5).attr("stroke-linecap", "round").attr("stroke-linejoin", "round").call((marker) => marker.append("path").attr("d", "M-1.5,-3l3,3l-3,3")).node();
  11220. }
  11221. function markerDot(color3, context) {
  11222. return create2("svg:marker", context).attr("viewBox", "-5 -5 10 10").attr("markerWidth", 6.67).attr("markerHeight", 6.67).attr("fill", color3).attr("stroke", "none").call((marker) => marker.append("circle").attr("r", 2.5)).node();
  11223. }
  11224. function markerCircleFill(color3, context) {
  11225. return create2("svg:marker", context).attr("viewBox", "-5 -5 10 10").attr("markerWidth", 6.67).attr("markerHeight", 6.67).attr("fill", color3).attr("stroke", "var(--plot-background)").attr("stroke-width", 1.5).call((marker) => marker.append("circle").attr("r", 3)).node();
  11226. }
  11227. function markerCircleStroke(color3, context) {
  11228. return create2("svg:marker", context).attr("viewBox", "-5 -5 10 10").attr("markerWidth", 6.67).attr("markerHeight", 6.67).attr("fill", "var(--plot-background)").attr("stroke", color3).attr("stroke-width", 1.5).call((marker) => marker.append("circle").attr("r", 3)).node();
  11229. }
  11230. function markerTick(orient) {
  11231. return (color3, context) => create2("svg:marker", context).attr("viewBox", "-3 -3 6 6").attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", orient).attr("stroke", color3).call((marker) => marker.append("path").attr("d", "M0,-3v6")).node();
  11232. }
  11233. var nextMarkerId = 0;
  11234. function applyMarkers(path2, mark, { stroke: S }, context) {
  11235. return applyMarkersColor(path2, mark, S && ((i) => S[i]), null, context);
  11236. }
  11237. var START = 1;
  11238. var END = 2;
  11239. function getGroupedOrientation(path2, Z) {
  11240. const O = new Uint8Array(Z.length);
  11241. const D2 = path2.data().filter((I) => I.length > 1);
  11242. const n = D2.length;
  11243. for (let i = 0, z = unset;i < n; ++i) {
  11244. const I = D2[i];
  11245. if (I.length > 1) {
  11246. const i2 = I[0];
  11247. if (z !== (z = keyof2(Z[i2])))
  11248. O[i2] |= START;
  11249. }
  11250. }
  11251. for (let i = n - 1, z = unset;i >= 0; --i) {
  11252. const I = D2[i];
  11253. if (I.length > 1) {
  11254. const i2 = I[0];
  11255. if (z !== (z = keyof2(Z[i2])))
  11256. O[i2] |= END;
  11257. }
  11258. }
  11259. return ([i]) => O[i];
  11260. }
  11261. function applyMarkersColor(path2, { markerStart, markerMid, markerEnd, stroke }, strokeof = () => stroke, Z, context) {
  11262. if (!markerStart && !markerMid && !markerEnd)
  11263. return;
  11264. const iriByMarkerColor = new Map;
  11265. const orient = Z && getGroupedOrientation(path2, Z);
  11266. function applyMarker(name, marker, filter2) {
  11267. return function(i) {
  11268. if (filter2 && !filter2(i))
  11269. return;
  11270. const color3 = strokeof(i);
  11271. let iriByColor = iriByMarkerColor.get(marker);
  11272. if (!iriByColor)
  11273. iriByMarkerColor.set(marker, iriByColor = new Map);
  11274. let iri = iriByColor.get(color3);
  11275. if (!iri) {
  11276. const node = this.parentNode.insertBefore(marker(color3, context), this);
  11277. const id2 = `plot-marker-${++nextMarkerId}`;
  11278. node.setAttribute("id", id2);
  11279. iriByColor.set(color3, iri = `url(#${id2})`);
  11280. }
  11281. this.setAttribute(name, iri);
  11282. };
  11283. }
  11284. if (markerStart)
  11285. path2.each(applyMarker("marker-start", markerStart, orient && ((i) => orient(i) & START)));
  11286. if (markerMid && orient)
  11287. path2.each(applyMarker("marker-start", markerMid, (i) => !(orient(i) & START)));
  11288. if (markerMid)
  11289. path2.each(applyMarker("marker-mid", markerMid));
  11290. if (markerEnd)
  11291. path2.each(applyMarker("marker-end", markerEnd, orient && ((i) => orient(i) & END)));
  11292. }
  11293. // node_modules/@observablehq/plot/src/transforms/inset.js
  11294. function maybeInsetX({ inset, insetLeft, insetRight, ...options } = {}) {
  11295. [insetLeft, insetRight] = maybeInset(inset, insetLeft, insetRight);
  11296. return { inset, insetLeft, insetRight, ...options };
  11297. }
  11298. function maybeInsetY({ inset, insetTop, insetBottom, ...options } = {}) {
  11299. [insetTop, insetBottom] = maybeInset(inset, insetTop, insetBottom);
  11300. return { inset, insetTop, insetBottom, ...options };
  11301. }
  11302. function maybeInset(inset, inset1, inset2) {
  11303. return inset === undefined && inset1 === undefined && inset2 === undefined ? offset ? [1, 0] : [0.5, 0.5] : [inset1, inset2];
  11304. }
  11305. // node_modules/@observablehq/plot/src/transforms/interval.js
  11306. function maybeIntervalValue(value, { interval: interval2 }) {
  11307. value = { ...maybeValue(value) };
  11308. value.interval = maybeInterval(value.interval === undefined ? interval2 : value.interval);
  11309. return value;
  11310. }
  11311. function maybeIntervalK(k2, maybeInsetK, options, trivial) {
  11312. const { [k2]: v, [`${k2}1`]: v1, [`${k2}2`]: v2 } = options;
  11313. const { value, interval: interval2 } = maybeIntervalValue(v, options);
  11314. if (value == null || interval2 == null && !trivial)
  11315. return options;
  11316. const label = labelof(v);
  11317. if (interval2 == null) {
  11318. let V;
  11319. const kv = { transform: (data) => V || (V = valueof(data, value)), label };
  11320. return {
  11321. ...options,
  11322. [k2]: undefined,
  11323. [`${k2}1`]: v1 === undefined ? kv : v1,
  11324. [`${k2}2`]: v2 === undefined && !(v1 === v2 && trivial) ? kv : v2
  11325. };
  11326. }
  11327. let D1, V1;
  11328. function transform2(data) {
  11329. if (V1 !== undefined && data === D1)
  11330. return V1;
  11331. return V1 = map2(valueof(D1 = data, value), (v3) => interval2.floor(v3));
  11332. }
  11333. return maybeInsetK({
  11334. ...options,
  11335. [k2]: undefined,
  11336. [`${k2}1`]: v1 === undefined ? { transform: transform2, label } : v1,
  11337. [`${k2}2`]: v2 === undefined ? { transform: (data) => transform2(data).map((v3) => interval2.offset(v3)), label } : v2
  11338. });
  11339. }
  11340. function maybeIntervalMidK(k2, maybeInsetK, options) {
  11341. const { [k2]: v } = options;
  11342. const { value, interval: interval2 } = maybeIntervalValue(v, options);
  11343. if (value == null || interval2 == null)
  11344. return options;
  11345. return maybeInsetK({
  11346. ...options,
  11347. [k2]: {
  11348. label: labelof(v),
  11349. transform: (data) => {
  11350. const V1 = map2(valueof(data, value), (v2) => interval2.floor(v2));
  11351. const V2 = V1.map((v2) => interval2.offset(v2));
  11352. return V1.map(isTemporal(V1) ? (v1, v2) => v1 == null || isNaN(v1 = +v1) || (v2 = V2[v2], v2 == null) || isNaN(v2 = +v2) ? undefined : new Date((v1 + v2) / 2) : (v1, v2) => v1 == null || (v2 = V2[v2], v2 == null) ? NaN : (+v1 + +v2) / 2);
  11353. }
  11354. }
  11355. });
  11356. }
  11357. function maybeTrivialIntervalX(options = {}) {
  11358. return maybeIntervalK("x", maybeInsetX, options, true);
  11359. }
  11360. function maybeIntervalX(options = {}) {
  11361. return maybeIntervalK("x", maybeInsetX, options);
  11362. }
  11363. function maybeIntervalY(options = {}) {
  11364. return maybeIntervalK("y", maybeInsetY, options);
  11365. }
  11366. function maybeIntervalMidX(options = {}) {
  11367. return maybeIntervalMidK("x", maybeInsetX, options);
  11368. }
  11369. function maybeIntervalMidY(options = {}) {
  11370. return maybeIntervalMidK("y", maybeInsetY, options);
  11371. }
  11372. // node_modules/@observablehq/plot/src/marks/rule.js
  11373. var defaults = {
  11374. ariaLabel: "rule",
  11375. fill: null,
  11376. stroke: "currentColor"
  11377. };
  11378. class RuleX extends Mark {
  11379. constructor(data, options = {}) {
  11380. const { x, y1: y12, y2, inset = 0, insetTop = inset, insetBottom = inset } = options;
  11381. super(data, {
  11382. x: { value: x, scale: "x", optional: true },
  11383. y1: { value: y12, scale: "y", optional: true },
  11384. y2: { value: y2, scale: "y", optional: true }
  11385. }, withTip(options, "x"), defaults);
  11386. this.insetTop = number5(insetTop);
  11387. this.insetBottom = number5(insetBottom);
  11388. markers(this, options);
  11389. }
  11390. render(index2, scales, channels, dimensions, context) {
  11391. const { x, y } = scales;
  11392. const { x: X3, y1: Y12, y2: Y22 } = channels;
  11393. const { width, height, marginTop, marginRight, marginLeft, marginBottom } = dimensions;
  11394. const { insetTop, insetBottom } = this;
  11395. return create2("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, { x: X3 && x }, offset, 0).call((g) => g.selectAll().data(index2).enter().append("line").call(applyDirectStyles, this).attr("x1", X3 ? (i) => X3[i] : (marginLeft + width - marginRight) / 2).attr("x2", X3 ? (i) => X3[i] : (marginLeft + width - marginRight) / 2).attr("y1", Y12 && !isCollapsed(y) ? (i) => Y12[i] + insetTop : marginTop + insetTop).attr("y2", Y22 && !isCollapsed(y) ? y.bandwidth ? (i) => Y22[i] + y.bandwidth() - insetBottom : (i) => Y22[i] - insetBottom : height - marginBottom - insetBottom).call(applyChannelStyles, this, channels).call(applyMarkers, this, channels, context)).node();
  11396. }
  11397. }
  11398. class RuleY extends Mark {
  11399. constructor(data, options = {}) {
  11400. const { x1: x12, x2, y, inset = 0, insetRight = inset, insetLeft = inset } = options;
  11401. super(data, {
  11402. y: { value: y, scale: "y", optional: true },
  11403. x1: { value: x12, scale: "x", optional: true },
  11404. x2: { value: x2, scale: "x", optional: true }
  11405. }, withTip(options, "y"), defaults);
  11406. this.insetRight = number5(insetRight);
  11407. this.insetLeft = number5(insetLeft);
  11408. markers(this, options);
  11409. }
  11410. render(index2, scales, channels, dimensions, context) {
  11411. const { x, y } = scales;
  11412. const { y: Y3, x1: X12, x2: X22 } = channels;
  11413. const { width, height, marginTop, marginRight, marginLeft, marginBottom } = dimensions;
  11414. const { insetLeft, insetRight } = this;
  11415. return create2("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, { y: Y3 && y }, 0, offset).call((g) => g.selectAll().data(index2).enter().append("line").call(applyDirectStyles, this).attr("x1", X12 && !isCollapsed(x) ? (i) => X12[i] + insetLeft : marginLeft + insetLeft).attr("x2", X22 && !isCollapsed(x) ? x.bandwidth ? (i) => X22[i] + x.bandwidth() - insetRight : (i) => X22[i] - insetRight : width - marginRight - insetRight).attr("y1", Y3 ? (i) => Y3[i] : (marginTop + height - marginBottom) / 2).attr("y2", Y3 ? (i) => Y3[i] : (marginTop + height - marginBottom) / 2).call(applyChannelStyles, this, channels).call(applyMarkers, this, channels, context)).node();
  11416. }
  11417. }
  11418. function ruleX(data, options) {
  11419. let { x = identity6, y, y1: y12, y2, ...rest } = maybeIntervalY(options);
  11420. [y12, y2] = maybeOptionalZero(y, y12, y2);
  11421. return new RuleX(data, { ...rest, x, y1: y12, y2 });
  11422. }
  11423. function ruleY(data, options) {
  11424. let { y = identity6, x, x1: x12, x2, ...rest } = maybeIntervalX(options);
  11425. [x12, x2] = maybeOptionalZero(x, x12, x2);
  11426. return new RuleY(data, { ...rest, y, x1: x12, x2 });
  11427. }
  11428. function maybeOptionalZero(x, x12, x2) {
  11429. if (x == null) {
  11430. if (x12 === undefined) {
  11431. if (x2 !== undefined)
  11432. return [0, x2];
  11433. } else {
  11434. if (x2 === undefined)
  11435. return [0, x12];
  11436. }
  11437. } else if (x12 === undefined) {
  11438. return x2 === undefined ? [0, x] : [x, x2];
  11439. } else if (x2 === undefined) {
  11440. return [x, x12];
  11441. }
  11442. return [x12, x2];
  11443. }
  11444. // node_modules/@observablehq/plot/src/template.js
  11445. function template(strings, ...parts) {
  11446. let n = parts.length;
  11447. for (let j = 0, copy3 = true;j < n; ++j) {
  11448. if (typeof parts[j] !== "function") {
  11449. if (copy3) {
  11450. strings = strings.slice();
  11451. copy3 = false;
  11452. }
  11453. strings.splice(j, 2, strings[j] + parts[j] + strings[j + 1]);
  11454. parts.splice(j, 1);
  11455. --j, --n;
  11456. }
  11457. }
  11458. return (i) => {
  11459. let s2 = strings[0];
  11460. for (let j = 0;j < n; ++j) {
  11461. s2 += parts[j](i) + strings[j + 1];
  11462. }
  11463. return s2;
  11464. };
  11465. }
  11466. // node_modules/@observablehq/plot/src/marks/text.js
  11467. var defaults2 = {
  11468. ariaLabel: "text",
  11469. strokeLinejoin: "round",
  11470. strokeWidth: 3,
  11471. paintOrder: "stroke"
  11472. };
  11473. var softHyphen = "­";
  11474. class Text extends Mark {
  11475. constructor(data, options = {}) {
  11476. const {
  11477. x,
  11478. y,
  11479. text = isIterable(data) && isTextual(data) ? identity6 : indexOf,
  11480. frameAnchor,
  11481. textAnchor = /right$/i.test(frameAnchor) ? "end" : /left$/i.test(frameAnchor) ? "start" : "middle",
  11482. lineAnchor = /^top/i.test(frameAnchor) ? "top" : /^bottom/i.test(frameAnchor) ? "bottom" : "middle",
  11483. lineHeight = 1,
  11484. lineWidth = Infinity,
  11485. textOverflow,
  11486. monospace,
  11487. fontFamily = monospace ? "ui-monospace, monospace" : undefined,
  11488. fontSize,
  11489. fontStyle,
  11490. fontVariant,
  11491. fontWeight,
  11492. rotate
  11493. } = options;
  11494. const [vrotate, crotate] = maybeNumberChannel(rotate, 0);
  11495. const [vfontSize, cfontSize] = maybeFontSizeChannel(fontSize);
  11496. super(data, {
  11497. x: { value: x, scale: "x", optional: true },
  11498. y: { value: y, scale: "y", optional: true },
  11499. fontSize: { value: vfontSize, optional: true },
  11500. rotate: { value: numberChannel(vrotate), optional: true },
  11501. text: { value: text, filter: nonempty, optional: true }
  11502. }, options, defaults2);
  11503. this.rotate = crotate;
  11504. this.textAnchor = impliedString(textAnchor, "middle");
  11505. this.lineAnchor = keyword(lineAnchor, "lineAnchor", ["top", "middle", "bottom"]);
  11506. this.lineHeight = +lineHeight;
  11507. this.lineWidth = +lineWidth;
  11508. this.textOverflow = maybeTextOverflow(textOverflow);
  11509. this.monospace = !!monospace;
  11510. this.fontFamily = string(fontFamily);
  11511. this.fontSize = cfontSize;
  11512. this.fontStyle = string(fontStyle);
  11513. this.fontVariant = string(fontVariant);
  11514. this.fontWeight = string(fontWeight);
  11515. this.frameAnchor = maybeFrameAnchor(frameAnchor);
  11516. if (!(this.lineWidth >= 0))
  11517. throw new Error(`invalid lineWidth: ${lineWidth}`);
  11518. this.splitLines = splitter(this);
  11519. this.clipLine = clipper(this);
  11520. }
  11521. render(index2, scales, channels, dimensions, context) {
  11522. const { x, y } = scales;
  11523. const { x: X3, y: Y3, rotate: R, text: T, title: TL, fontSize: FS } = channels;
  11524. const { rotate } = this;
  11525. const [cx, cy] = applyFrameAnchor(this, dimensions);
  11526. return create2("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyIndirectTextStyles, this, T, dimensions).call(applyTransform, this, { x: X3 && x, y: Y3 && y }).call((g) => g.selectAll().data(index2).enter().append("text").call(applyDirectStyles, this).call(applyMultilineText, this, T, TL).attr("transform", template`translate(${X3 ? (i) => X3[i] : cx},${Y3 ? (i) => Y3[i] : cy})${R ? (i) => ` rotate(${R[i]})` : rotate ? ` rotate(${rotate})` : ``}`).call(applyAttr, "font-size", FS && ((i) => FS[i])).call(applyChannelStyles, this, channels)).node();
  11527. }
  11528. }
  11529. function maybeTextOverflow(textOverflow) {
  11530. return textOverflow == null ? null : keyword(textOverflow, "textOverflow", [
  11531. "clip",
  11532. "ellipsis",
  11533. "clip-start",
  11534. "clip-end",
  11535. "ellipsis-start",
  11536. "ellipsis-middle",
  11537. "ellipsis-end"
  11538. ]).replace(/^(clip|ellipsis)$/, "$1-end");
  11539. }
  11540. function applyMultilineText(selection2, mark, T, TL) {
  11541. if (!T)
  11542. return;
  11543. const { lineAnchor, lineHeight, textOverflow, splitLines, clipLine } = mark;
  11544. selection2.each(function(i) {
  11545. const lines = splitLines(formatDefault(T[i]) ?? "").map(clipLine);
  11546. const n = lines.length;
  11547. const y = lineAnchor === "top" ? 0.71 : lineAnchor === "bottom" ? 1 - n : (164 - n * 100) / 200;
  11548. if (n > 1) {
  11549. let m = 0;
  11550. for (let i2 = 0;i2 < n; ++i2) {
  11551. ++m;
  11552. if (!lines[i2])
  11553. continue;
  11554. const tspan = this.ownerDocument.createElementNS(namespaces_default.svg, "tspan");
  11555. tspan.setAttribute("x", 0);
  11556. if (i2 === m - 1)
  11557. tspan.setAttribute("y", `${(y + i2) * lineHeight}em`);
  11558. else
  11559. tspan.setAttribute("dy", `${m * lineHeight}em`);
  11560. tspan.textContent = lines[i2];
  11561. this.appendChild(tspan);
  11562. m = 0;
  11563. }
  11564. } else {
  11565. if (y)
  11566. this.setAttribute("y", `${y * lineHeight}em`);
  11567. this.textContent = lines[0];
  11568. }
  11569. if (textOverflow && !TL && lines[0] !== T[i]) {
  11570. const title = this.ownerDocument.createElementNS(namespaces_default.svg, "title");
  11571. title.textContent = T[i];
  11572. this.appendChild(title);
  11573. }
  11574. });
  11575. }
  11576. function text(data, { x, y, ...options } = {}) {
  11577. if (options.frameAnchor === undefined)
  11578. [x, y] = maybeTuple(x, y);
  11579. return new Text(data, { ...options, x, y });
  11580. }
  11581. function textX(data, { x = identity6, ...options } = {}) {
  11582. return new Text(data, maybeIntervalMidY({ ...options, x }));
  11583. }
  11584. function textY(data, { y = identity6, ...options } = {}) {
  11585. return new Text(data, maybeIntervalMidX({ ...options, y }));
  11586. }
  11587. function applyIndirectTextStyles(selection2, mark, T) {
  11588. applyAttr(selection2, "text-anchor", mark.textAnchor);
  11589. applyAttr(selection2, "font-family", mark.fontFamily);
  11590. applyAttr(selection2, "font-size", mark.fontSize);
  11591. applyAttr(selection2, "font-style", mark.fontStyle);
  11592. applyAttr(selection2, "font-variant", mark.fontVariant === undefined ? inferFontVariant2(T) : mark.fontVariant);
  11593. applyAttr(selection2, "font-weight", mark.fontWeight);
  11594. }
  11595. function inferFontVariant2(T) {
  11596. return T && (isNumeric(T) || isTemporal(T)) ? "tabular-nums" : undefined;
  11597. }
  11598. var fontSizes = new Set([
  11599. "inherit",
  11600. "initial",
  11601. "revert",
  11602. "unset",
  11603. "xx-small",
  11604. "x-small",
  11605. "small",
  11606. "medium",
  11607. "large",
  11608. "x-large",
  11609. "xx-large",
  11610. "xxx-large",
  11611. "larger",
  11612. "smaller"
  11613. ]);
  11614. function maybeFontSizeChannel(fontSize) {
  11615. if (fontSize == null || typeof fontSize === "number")
  11616. return [undefined, fontSize];
  11617. if (typeof fontSize !== "string")
  11618. return [fontSize, undefined];
  11619. fontSize = fontSize.trim().toLowerCase();
  11620. return fontSizes.has(fontSize) || /^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(fontSize) ? [undefined, fontSize] : [fontSize, undefined];
  11621. }
  11622. function lineWrap(input, maxWidth, widthof) {
  11623. const lines = [];
  11624. let lineStart, lineEnd = 0;
  11625. for (const [wordStart, wordEnd, required] of lineBreaks(input)) {
  11626. if (lineStart === undefined)
  11627. lineStart = wordStart;
  11628. if (lineEnd > lineStart && widthof(input, lineStart, wordEnd) > maxWidth) {
  11629. lines.push(input.slice(lineStart, lineEnd) + (input[lineEnd - 1] === softHyphen ? "-" : ""));
  11630. lineStart = wordStart;
  11631. }
  11632. if (required) {
  11633. lines.push(input.slice(lineStart, wordEnd));
  11634. lineStart = undefined;
  11635. continue;
  11636. }
  11637. lineEnd = wordEnd;
  11638. }
  11639. return lines;
  11640. }
  11641. function* lineBreaks(input) {
  11642. let i = 0, j = 0;
  11643. const n = input.length;
  11644. while (j < n) {
  11645. let k2 = 1;
  11646. switch (input[j]) {
  11647. case softHyphen:
  11648. case "-":
  11649. ++j;
  11650. yield [i, j, false];
  11651. i = j;
  11652. break;
  11653. case " ":
  11654. yield [i, j, false];
  11655. while (input[++j] === " ")
  11656. ;
  11657. i = j;
  11658. break;
  11659. case "\r":
  11660. if (input[j + 1] === `
  11661. `)
  11662. ++k2;
  11663. case `
  11664. `:
  11665. yield [i, j, true];
  11666. j += k2;
  11667. i = j;
  11668. break;
  11669. default:
  11670. ++j;
  11671. break;
  11672. }
  11673. }
  11674. yield [i, j, true];
  11675. }
  11676. var defaultWidthMap = {
  11677. a: 56,
  11678. b: 63,
  11679. c: 57,
  11680. d: 63,
  11681. e: 58,
  11682. f: 37,
  11683. g: 62,
  11684. h: 60,
  11685. i: 26,
  11686. j: 26,
  11687. k: 55,
  11688. l: 26,
  11689. m: 88,
  11690. n: 60,
  11691. o: 60,
  11692. p: 62,
  11693. q: 62,
  11694. r: 39,
  11695. s: 54,
  11696. t: 38,
  11697. u: 60,
  11698. v: 55,
  11699. w: 79,
  11700. x: 54,
  11701. y: 55,
  11702. z: 55,
  11703. A: 69,
  11704. B: 67,
  11705. C: 73,
  11706. D: 74,
  11707. E: 61,
  11708. F: 58,
  11709. G: 76,
  11710. H: 75,
  11711. I: 28,
  11712. J: 55,
  11713. K: 67,
  11714. L: 58,
  11715. M: 89,
  11716. N: 75,
  11717. O: 78,
  11718. P: 65,
  11719. Q: 78,
  11720. R: 67,
  11721. S: 65,
  11722. T: 65,
  11723. U: 75,
  11724. V: 69,
  11725. W: 98,
  11726. X: 69,
  11727. Y: 67,
  11728. Z: 67,
  11729. 0: 64,
  11730. 1: 48,
  11731. 2: 62,
  11732. 3: 64,
  11733. 4: 66,
  11734. 5: 63,
  11735. 6: 65,
  11736. 7: 58,
  11737. 8: 65,
  11738. 9: 65,
  11739. " ": 29,
  11740. "!": 32,
  11741. '"': 49,
  11742. "'": 31,
  11743. "(": 39,
  11744. ")": 39,
  11745. ",": 31,
  11746. "-": 48,
  11747. ".": 31,
  11748. "/": 32,
  11749. ":": 31,
  11750. ";": 31,
  11751. "?": 52,
  11752. "‘": 31,
  11753. "’": 31,
  11754. "“": 47,
  11755. "”": 47,
  11756. "…": 82
  11757. };
  11758. function defaultWidth(text2, start2 = 0, end = text2.length) {
  11759. let sum2 = 0;
  11760. for (let i = start2;i < end; i = readCharacter(text2, i)) {
  11761. sum2 += defaultWidthMap[text2[i]] ?? (isPictographic(text2, i) ? 120 : defaultWidthMap.e);
  11762. }
  11763. return sum2;
  11764. }
  11765. function monospaceWidth(text2, start2 = 0, end = text2.length) {
  11766. let sum2 = 0;
  11767. for (let i = start2;i < end; i = readCharacter(text2, i)) {
  11768. sum2 += isPictographic(text2, i) ? 126 : 63;
  11769. }
  11770. return sum2;
  11771. }
  11772. function splitter({ monospace, lineWidth, textOverflow }) {
  11773. if (textOverflow != null || lineWidth == Infinity)
  11774. return (text2) => text2.split(/\r\n?|\n/g);
  11775. const widthof = monospace ? monospaceWidth : defaultWidth;
  11776. const maxWidth = lineWidth * 100;
  11777. return (text2) => lineWrap(text2, maxWidth, widthof);
  11778. }
  11779. function clipper({ monospace, lineWidth, textOverflow }) {
  11780. if (textOverflow == null || lineWidth == Infinity)
  11781. return (text2) => text2;
  11782. const widthof = monospace ? monospaceWidth : defaultWidth;
  11783. const maxWidth = lineWidth * 100;
  11784. switch (textOverflow) {
  11785. case "clip-start":
  11786. return (text2) => clipStart(text2, maxWidth, widthof, "");
  11787. case "clip-end":
  11788. return (text2) => clipEnd(text2, maxWidth, widthof, "");
  11789. case "ellipsis-start":
  11790. return (text2) => clipStart(text2, maxWidth, widthof, ellipsis);
  11791. case "ellipsis-middle":
  11792. return (text2) => clipMiddle(text2, maxWidth, widthof, ellipsis);
  11793. case "ellipsis-end":
  11794. return (text2) => clipEnd(text2, maxWidth, widthof, ellipsis);
  11795. }
  11796. }
  11797. var ellipsis = "…";
  11798. function cut(text2, width, widthof, inset) {
  11799. const I = [];
  11800. let w = 0;
  11801. for (let i = 0, j = 0, n = text2.length;i < n; i = j) {
  11802. j = readCharacter(text2, i);
  11803. const l = widthof(text2, i, j);
  11804. if (w + l > width) {
  11805. w += inset;
  11806. while (w > width && i > 0)
  11807. j = i, i = I.pop(), w -= widthof(text2, i, j);
  11808. return [i, width - w];
  11809. }
  11810. w += l;
  11811. I.push(i);
  11812. }
  11813. return [-1, 0];
  11814. }
  11815. function clipEnd(text2, width, widthof, ellipsis2) {
  11816. text2 = text2.trim();
  11817. const e = widthof(ellipsis2);
  11818. const [i] = cut(text2, width, widthof, e);
  11819. return i < 0 ? text2 : text2.slice(0, i).trimEnd() + ellipsis2;
  11820. }
  11821. function clipMiddle(text2, width, widthof, ellipsis2) {
  11822. text2 = text2.trim();
  11823. const w = widthof(text2);
  11824. if (w <= width)
  11825. return text2;
  11826. const e = widthof(ellipsis2) / 2;
  11827. const [i, ei] = cut(text2, width / 2, widthof, e);
  11828. const [j] = cut(text2, w - width / 2 - ei + e, widthof, -e);
  11829. return j < 0 ? ellipsis2 : text2.slice(0, i).trimEnd() + ellipsis2 + text2.slice(readCharacter(text2, j)).trimStart();
  11830. }
  11831. function clipStart(text2, width, widthof, ellipsis2) {
  11832. text2 = text2.trim();
  11833. const w = widthof(text2);
  11834. if (w <= width)
  11835. return text2;
  11836. const e = widthof(ellipsis2);
  11837. const [j] = cut(text2, w - width + e, widthof, -e);
  11838. return j < 0 ? ellipsis2 : ellipsis2 + text2.slice(readCharacter(text2, j)).trimStart();
  11839. }
  11840. var reCombiner = /[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy;
  11841. var rePictographic = /\p{Extended_Pictographic}/uy;
  11842. function readCharacter(text2, i) {
  11843. i += isSurrogatePair(text2, i) ? 2 : 1;
  11844. if (isCombiner(text2, i))
  11845. i = reCombiner.lastIndex;
  11846. if (isZeroWidthJoiner(text2, i))
  11847. return readCharacter(text2, i + 1);
  11848. return i;
  11849. }
  11850. function isAscii(text2, i) {
  11851. return text2.charCodeAt(i) < 128;
  11852. }
  11853. function isSurrogatePair(text2, i) {
  11854. const hi = text2.charCodeAt(i);
  11855. if (hi >= 55296 && hi < 56320) {
  11856. const lo = text2.charCodeAt(i + 1);
  11857. return lo >= 56320 && lo < 57344;
  11858. }
  11859. return false;
  11860. }
  11861. function isZeroWidthJoiner(text2, i) {
  11862. return text2.charCodeAt(i) === 8205;
  11863. }
  11864. function isCombiner(text2, i) {
  11865. return isAscii(text2, i) ? false : (reCombiner.lastIndex = i, reCombiner.test(text2));
  11866. }
  11867. function isPictographic(text2, i) {
  11868. return isAscii(text2, i) ? false : (rePictographic.lastIndex = i, rePictographic.test(text2));
  11869. }
  11870. // node_modules/@observablehq/plot/src/marks/vector.js
  11871. var defaults3 = {
  11872. ariaLabel: "vector",
  11873. fill: "none",
  11874. stroke: "currentColor",
  11875. strokeWidth: 1.5,
  11876. strokeLinejoin: "round",
  11877. strokeLinecap: "round"
  11878. };
  11879. var defaultRadius = 3.5;
  11880. var wingRatio = defaultRadius * 5;
  11881. var shapeArrow = {
  11882. draw(context, l, r) {
  11883. const wing = l * r / wingRatio;
  11884. context.moveTo(0, 0);
  11885. context.lineTo(0, -l);
  11886. context.moveTo(-wing, wing - l);
  11887. context.lineTo(0, -l);
  11888. context.lineTo(wing, wing - l);
  11889. }
  11890. };
  11891. var shapeSpike = {
  11892. draw(context, l, r) {
  11893. context.moveTo(-r, 0);
  11894. context.lineTo(0, -l);
  11895. context.lineTo(r, 0);
  11896. }
  11897. };
  11898. var shapes = new Map([
  11899. ["arrow", shapeArrow],
  11900. ["spike", shapeSpike]
  11901. ]);
  11902. function isShapeObject(value) {
  11903. return value && typeof value.draw === "function";
  11904. }
  11905. function maybeShape(shape) {
  11906. if (isShapeObject(shape))
  11907. return shape;
  11908. const value = shapes.get(`${shape}`.toLowerCase());
  11909. if (value)
  11910. return value;
  11911. throw new Error(`invalid shape: ${shape}`);
  11912. }
  11913. class Vector extends Mark {
  11914. constructor(data, options = {}) {
  11915. const { x, y, r = defaultRadius, length: length3, rotate, shape = shapeArrow, anchor = "middle", frameAnchor } = options;
  11916. const [vl, cl] = maybeNumberChannel(length3, 12);
  11917. const [vr, cr] = maybeNumberChannel(rotate, 0);
  11918. super(data, {
  11919. x: { value: x, scale: "x", optional: true },
  11920. y: { value: y, scale: "y", optional: true },
  11921. length: { value: vl, scale: "length", optional: true },
  11922. rotate: { value: vr, optional: true }
  11923. }, options, defaults3);
  11924. this.r = +r;
  11925. this.length = cl;
  11926. this.rotate = cr;
  11927. this.shape = maybeShape(shape);
  11928. this.anchor = keyword(anchor, "anchor", ["start", "middle", "end"]);
  11929. this.frameAnchor = maybeFrameAnchor(frameAnchor);
  11930. }
  11931. render(index2, scales, channels, dimensions, context) {
  11932. const { x, y } = scales;
  11933. const { x: X3, y: Y3, length: L, rotate: A5 } = channels;
  11934. const { length: length3, rotate, anchor, shape, r } = this;
  11935. const [cx, cy] = applyFrameAnchor(this, dimensions);
  11936. return create2("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, { x: X3 && x, y: Y3 && y }).call((g) => g.selectAll().data(index2).enter().append("path").call(applyDirectStyles, this).attr("transform", template`translate(${X3 ? (i) => X3[i] : cx},${Y3 ? (i) => Y3[i] : cy})${A5 ? (i) => ` rotate(${A5[i]})` : rotate ? ` rotate(${rotate})` : ``}${anchor === "start" ? `` : anchor === "end" ? L ? (i) => ` translate(0,${L[i]})` : ` translate(0,${length3})` : L ? (i) => ` translate(0,${L[i] / 2})` : ` translate(0,${length3 / 2})`}`).attr("d", L ? (i) => {
  11937. const p = pathRound();
  11938. shape.draw(p, L[i], r);
  11939. return p;
  11940. } : (() => {
  11941. const p = pathRound();
  11942. shape.draw(p, length3, r);
  11943. return p;
  11944. })()).call(applyChannelStyles, this, channels)).node();
  11945. }
  11946. }
  11947. function vectorX(data, options = {}) {
  11948. const { x = identity6, ...rest } = options;
  11949. return new Vector(data, { ...rest, x });
  11950. }
  11951. function vectorY(data, options = {}) {
  11952. const { y = identity6, ...rest } = options;
  11953. return new Vector(data, { ...rest, y });
  11954. }
  11955. // node_modules/@observablehq/plot/src/marks/axis.js
  11956. function maybeData(data, options) {
  11957. if (arguments.length < 2 && !isIterable(data))
  11958. options = data, data = null;
  11959. if (options === undefined)
  11960. options = {};
  11961. return [data, options];
  11962. }
  11963. function maybeAnchor2({ anchor } = {}, anchors) {
  11964. return anchor === undefined ? anchors[0] : keyword(anchor, "anchor", anchors);
  11965. }
  11966. function anchorY2(options) {
  11967. return maybeAnchor2(options, ["left", "right"]);
  11968. }
  11969. function anchorFy(options) {
  11970. return maybeAnchor2(options, ["right", "left"]);
  11971. }
  11972. function anchorX2(options) {
  11973. return maybeAnchor2(options, ["bottom", "top"]);
  11974. }
  11975. function anchorFx(options) {
  11976. return maybeAnchor2(options, ["top", "bottom"]);
  11977. }
  11978. function axisY() {
  11979. const [data, options] = maybeData(...arguments);
  11980. return axisKy("y", anchorY2(options), data, options);
  11981. }
  11982. function axisFy() {
  11983. const [data, options] = maybeData(...arguments);
  11984. return axisKy("fy", anchorFy(options), data, options);
  11985. }
  11986. function axisX() {
  11987. const [data, options] = maybeData(...arguments);
  11988. return axisKx("x", anchorX2(options), data, options);
  11989. }
  11990. function axisFx() {
  11991. const [data, options] = maybeData(...arguments);
  11992. return axisKx("fx", anchorFx(options), data, options);
  11993. }
  11994. function axisKy(k2, anchor, data, {
  11995. color: color3 = "currentColor",
  11996. opacity: opacity2 = 1,
  11997. stroke = color3,
  11998. strokeOpacity = opacity2,
  11999. strokeWidth = 1,
  12000. fill = color3,
  12001. fillOpacity = opacity2,
  12002. textAnchor,
  12003. textStroke,
  12004. textStrokeOpacity,
  12005. textStrokeWidth,
  12006. tickSize = k2 === "y" ? 6 : 0,
  12007. tickPadding,
  12008. tickRotate,
  12009. x,
  12010. margin,
  12011. marginTop = margin === undefined ? 20 : margin,
  12012. marginRight = margin === undefined ? anchor === "right" ? 40 : 0 : margin,
  12013. marginBottom = margin === undefined ? 20 : margin,
  12014. marginLeft = margin === undefined ? anchor === "left" ? 40 : 0 : margin,
  12015. label,
  12016. labelAnchor,
  12017. labelArrow,
  12018. labelOffset,
  12019. ariaLabel = `${k2}-axis`,
  12020. ...options
  12021. }) {
  12022. tickSize = number5(tickSize);
  12023. tickPadding = number5(tickPadding);
  12024. tickRotate = number5(tickRotate);
  12025. if (labelAnchor !== undefined)
  12026. labelAnchor = keyword(labelAnchor, "labelAnchor", ["center", "top", "bottom"]);
  12027. labelArrow = maybeLabelArrow(labelArrow);
  12028. return marks(tickSize && !isNoneish(stroke) ? axisTickKy(k2, anchor, data, {
  12029. stroke,
  12030. strokeOpacity,
  12031. strokeWidth,
  12032. tickSize,
  12033. tickPadding,
  12034. tickRotate,
  12035. x,
  12036. ariaLabel,
  12037. ...options
  12038. }) : null, !isNoneish(fill) ? axisTextKy(k2, anchor, data, {
  12039. fill,
  12040. fillOpacity,
  12041. stroke: textStroke,
  12042. strokeOpacity: textStrokeOpacity,
  12043. strokeWidth: textStrokeWidth,
  12044. textAnchor,
  12045. tickSize,
  12046. tickPadding,
  12047. tickRotate,
  12048. x,
  12049. marginTop,
  12050. marginRight,
  12051. marginBottom,
  12052. marginLeft,
  12053. ariaLabel,
  12054. ...options
  12055. }) : null, !isNoneish(fill) && label !== null ? text([], labelOptions({ fill, fillOpacity, ...options }, function(data2, facets, channels, scales, dimensions) {
  12056. const scale = scales[k2];
  12057. const { marginTop: marginTop2, marginRight: marginRight2, marginBottom: marginBottom2, marginLeft: marginLeft2 } = k2 === "y" && dimensions.inset || dimensions;
  12058. const cla = labelAnchor ?? (scale.bandwidth ? "center" : "top");
  12059. const clo = labelOffset ?? (anchor === "right" ? marginRight2 : marginLeft2) - 3;
  12060. if (cla === "center") {
  12061. this.textAnchor = undefined;
  12062. this.lineAnchor = anchor === "right" ? "bottom" : "top";
  12063. this.frameAnchor = anchor;
  12064. this.rotate = -90;
  12065. } else {
  12066. this.textAnchor = anchor === "right" ? "end" : "start";
  12067. this.lineAnchor = cla;
  12068. this.frameAnchor = `${cla}-${anchor}`;
  12069. this.rotate = 0;
  12070. }
  12071. this.dy = cla === "top" ? 3 - marginTop2 : cla === "bottom" ? marginBottom2 - 3 : 0;
  12072. this.dx = anchor === "right" ? clo : -clo;
  12073. this.ariaLabel = `${ariaLabel} label`;
  12074. return {
  12075. facets: [[0]],
  12076. channels: { text: { value: [formatAxisLabel(k2, scale, { anchor, label, labelAnchor: cla, labelArrow })] } }
  12077. };
  12078. })) : null);
  12079. }
  12080. function axisKx(k2, anchor, data, {
  12081. color: color3 = "currentColor",
  12082. opacity: opacity2 = 1,
  12083. stroke = color3,
  12084. strokeOpacity = opacity2,
  12085. strokeWidth = 1,
  12086. fill = color3,
  12087. fillOpacity = opacity2,
  12088. textAnchor,
  12089. textStroke,
  12090. textStrokeOpacity,
  12091. textStrokeWidth,
  12092. tickSize = k2 === "x" ? 6 : 0,
  12093. tickPadding,
  12094. tickRotate,
  12095. y,
  12096. margin,
  12097. marginTop = margin === undefined ? anchor === "top" ? 30 : 0 : margin,
  12098. marginRight = margin === undefined ? 20 : margin,
  12099. marginBottom = margin === undefined ? anchor === "bottom" ? 30 : 0 : margin,
  12100. marginLeft = margin === undefined ? 20 : margin,
  12101. label,
  12102. labelAnchor,
  12103. labelArrow,
  12104. labelOffset,
  12105. ariaLabel = `${k2}-axis`,
  12106. ...options
  12107. }) {
  12108. tickSize = number5(tickSize);
  12109. tickPadding = number5(tickPadding);
  12110. tickRotate = number5(tickRotate);
  12111. if (labelAnchor !== undefined)
  12112. labelAnchor = keyword(labelAnchor, "labelAnchor", ["center", "left", "right"]);
  12113. labelArrow = maybeLabelArrow(labelArrow);
  12114. return marks(tickSize && !isNoneish(stroke) ? axisTickKx(k2, anchor, data, {
  12115. stroke,
  12116. strokeOpacity,
  12117. strokeWidth,
  12118. tickSize,
  12119. tickPadding,
  12120. tickRotate,
  12121. y,
  12122. ariaLabel,
  12123. ...options
  12124. }) : null, !isNoneish(fill) ? axisTextKx(k2, anchor, data, {
  12125. fill,
  12126. fillOpacity,
  12127. stroke: textStroke,
  12128. strokeOpacity: textStrokeOpacity,
  12129. strokeWidth: textStrokeWidth,
  12130. textAnchor,
  12131. tickSize,
  12132. tickPadding,
  12133. tickRotate,
  12134. y,
  12135. marginTop,
  12136. marginRight,
  12137. marginBottom,
  12138. marginLeft,
  12139. ariaLabel,
  12140. ...options
  12141. }) : null, !isNoneish(fill) && label !== null ? text([], labelOptions({ fill, fillOpacity, ...options }, function(data2, facets, channels, scales, dimensions) {
  12142. const scale = scales[k2];
  12143. const { marginTop: marginTop2, marginRight: marginRight2, marginBottom: marginBottom2, marginLeft: marginLeft2 } = k2 === "x" && dimensions.inset || dimensions;
  12144. const cla = labelAnchor ?? (scale.bandwidth ? "center" : "right");
  12145. const clo = labelOffset ?? (anchor === "top" ? marginTop2 : marginBottom2) - 3;
  12146. if (cla === "center") {
  12147. this.frameAnchor = anchor;
  12148. this.textAnchor = undefined;
  12149. } else {
  12150. this.frameAnchor = `${anchor}-${cla}`;
  12151. this.textAnchor = cla === "right" ? "end" : "start";
  12152. }
  12153. this.lineAnchor = anchor;
  12154. this.dy = anchor === "top" ? -clo : clo;
  12155. this.dx = cla === "right" ? marginRight2 - 3 : cla === "left" ? 3 - marginLeft2 : 0;
  12156. this.ariaLabel = `${ariaLabel} label`;
  12157. return {
  12158. facets: [[0]],
  12159. channels: { text: { value: [formatAxisLabel(k2, scale, { anchor, label, labelAnchor: cla, labelArrow })] } }
  12160. };
  12161. })) : null);
  12162. }
  12163. function axisTickKy(k2, anchor, data, {
  12164. strokeWidth = 1,
  12165. strokeLinecap = null,
  12166. strokeLinejoin = null,
  12167. facetAnchor = anchor + (k2 === "y" ? "-empty" : ""),
  12168. frameAnchor = anchor,
  12169. tickSize,
  12170. inset = 0,
  12171. insetLeft = inset,
  12172. insetRight = inset,
  12173. dx = 0,
  12174. y = k2 === "y" ? undefined : null,
  12175. ariaLabel,
  12176. ...options
  12177. }) {
  12178. return axisMark(vectorY, k2, data, {
  12179. ariaLabel: `${ariaLabel} tick`,
  12180. ariaHidden: true
  12181. }, {
  12182. strokeWidth,
  12183. strokeLinecap,
  12184. strokeLinejoin,
  12185. facetAnchor,
  12186. frameAnchor,
  12187. y,
  12188. ...options,
  12189. dx: anchor === "left" ? +dx - offset + +insetLeft : +dx + offset - insetRight,
  12190. anchor: "start",
  12191. length: tickSize,
  12192. shape: anchor === "left" ? shapeTickLeft : shapeTickRight
  12193. });
  12194. }
  12195. function axisTickKx(k2, anchor, data, {
  12196. strokeWidth = 1,
  12197. strokeLinecap = null,
  12198. strokeLinejoin = null,
  12199. facetAnchor = anchor + (k2 === "x" ? "-empty" : ""),
  12200. frameAnchor = anchor,
  12201. tickSize,
  12202. inset = 0,
  12203. insetTop = inset,
  12204. insetBottom = inset,
  12205. dy = 0,
  12206. x = k2 === "x" ? undefined : null,
  12207. ariaLabel,
  12208. ...options
  12209. }) {
  12210. return axisMark(vectorX, k2, data, {
  12211. ariaLabel: `${ariaLabel} tick`,
  12212. ariaHidden: true
  12213. }, {
  12214. strokeWidth,
  12215. strokeLinejoin,
  12216. strokeLinecap,
  12217. facetAnchor,
  12218. frameAnchor,
  12219. x,
  12220. ...options,
  12221. dy: anchor === "bottom" ? +dy - offset - insetBottom : +dy + offset + +insetTop,
  12222. anchor: "start",
  12223. length: tickSize,
  12224. shape: anchor === "bottom" ? shapeTickBottom : shapeTickTop
  12225. });
  12226. }
  12227. function axisTextKy(k2, anchor, data, {
  12228. facetAnchor = anchor + (k2 === "y" ? "-empty" : ""),
  12229. frameAnchor = anchor,
  12230. tickSize,
  12231. tickRotate = 0,
  12232. tickPadding = Math.max(3, 9 - tickSize) + (Math.abs(tickRotate) > 60 ? 4 * Math.cos(tickRotate * radians3) : 0),
  12233. text: text2,
  12234. textAnchor = Math.abs(tickRotate) > 60 ? "middle" : anchor === "left" ? "end" : "start",
  12235. lineAnchor = tickRotate > 60 ? "top" : tickRotate < -60 ? "bottom" : "middle",
  12236. fontVariant,
  12237. inset = 0,
  12238. insetLeft = inset,
  12239. insetRight = inset,
  12240. dx = 0,
  12241. ariaLabel,
  12242. y = k2 === "y" ? undefined : null,
  12243. ...options
  12244. }) {
  12245. return axisMark(textY, k2, data, { ariaLabel: `${ariaLabel} tick label` }, {
  12246. facetAnchor,
  12247. frameAnchor,
  12248. text: text2,
  12249. textAnchor,
  12250. lineAnchor,
  12251. fontVariant,
  12252. rotate: tickRotate,
  12253. y,
  12254. ...options,
  12255. dx: anchor === "left" ? +dx - tickSize - tickPadding + +insetLeft : +dx + +tickSize + +tickPadding - insetRight
  12256. }, function(scale, data2, ticks2, tickFormat2, channels) {
  12257. if (fontVariant === undefined)
  12258. this.fontVariant = inferFontVariant3(scale);
  12259. if (text2 === undefined)
  12260. channels.text = inferTextChannel(scale, data2, ticks2, tickFormat2, anchor);
  12261. });
  12262. }
  12263. function axisTextKx(k2, anchor, data, {
  12264. facetAnchor = anchor + (k2 === "x" ? "-empty" : ""),
  12265. frameAnchor = anchor,
  12266. tickSize,
  12267. tickRotate = 0,
  12268. tickPadding = Math.max(3, 9 - tickSize) + (Math.abs(tickRotate) >= 10 ? 4 * Math.cos(tickRotate * radians3) : 0),
  12269. text: text2,
  12270. textAnchor = Math.abs(tickRotate) >= 10 ? tickRotate < 0 ^ anchor === "bottom" ? "start" : "end" : "middle",
  12271. lineAnchor = Math.abs(tickRotate) >= 10 ? "middle" : anchor === "bottom" ? "top" : "bottom",
  12272. fontVariant,
  12273. inset = 0,
  12274. insetTop = inset,
  12275. insetBottom = inset,
  12276. dy = 0,
  12277. x = k2 === "x" ? undefined : null,
  12278. ariaLabel,
  12279. ...options
  12280. }) {
  12281. return axisMark(textX, k2, data, { ariaLabel: `${ariaLabel} tick label` }, {
  12282. facetAnchor,
  12283. frameAnchor,
  12284. text: text2 === undefined ? null : text2,
  12285. textAnchor,
  12286. lineAnchor,
  12287. fontVariant,
  12288. rotate: tickRotate,
  12289. x,
  12290. ...options,
  12291. dy: anchor === "bottom" ? +dy + +tickSize + +tickPadding - insetBottom : +dy - tickSize - tickPadding + +insetTop
  12292. }, function(scale, data2, ticks2, tickFormat2, channels) {
  12293. if (fontVariant === undefined)
  12294. this.fontVariant = inferFontVariant3(scale);
  12295. if (text2 === undefined)
  12296. channels.text = inferTextChannel(scale, data2, ticks2, tickFormat2, anchor);
  12297. });
  12298. }
  12299. function gridY() {
  12300. const [data, options] = maybeData(...arguments);
  12301. return gridKy("y", anchorY2(options), data, options);
  12302. }
  12303. function gridFy() {
  12304. const [data, options] = maybeData(...arguments);
  12305. return gridKy("fy", anchorFy(options), data, options);
  12306. }
  12307. function gridX() {
  12308. const [data, options] = maybeData(...arguments);
  12309. return gridKx("x", anchorX2(options), data, options);
  12310. }
  12311. function gridFx() {
  12312. const [data, options] = maybeData(...arguments);
  12313. return gridKx("fx", anchorFx(options), data, options);
  12314. }
  12315. function gridKy(k2, anchor, data, {
  12316. y = k2 === "y" ? undefined : null,
  12317. x = null,
  12318. x1: x12 = anchor === "left" ? x : null,
  12319. x2 = anchor === "right" ? x : null,
  12320. ariaLabel = `${k2}-grid`,
  12321. ariaHidden = true,
  12322. ...options
  12323. }) {
  12324. return axisMark(ruleY, k2, data, { ariaLabel, ariaHidden }, { y, x1: x12, x2, ...gridDefaults(options) });
  12325. }
  12326. function gridKx(k2, anchor, data, {
  12327. x = k2 === "x" ? undefined : null,
  12328. y = null,
  12329. y1: y12 = anchor === "top" ? y : null,
  12330. y2 = anchor === "bottom" ? y : null,
  12331. ariaLabel = `${k2}-grid`,
  12332. ariaHidden = true,
  12333. ...options
  12334. }) {
  12335. return axisMark(ruleX, k2, data, { ariaLabel, ariaHidden }, { x, y1: y12, y2, ...gridDefaults(options) });
  12336. }
  12337. function gridDefaults({
  12338. color: color3 = "currentColor",
  12339. opacity: opacity2 = 0.1,
  12340. stroke = color3,
  12341. strokeOpacity = opacity2,
  12342. strokeWidth = 1,
  12343. ...options
  12344. }) {
  12345. return { stroke, strokeOpacity, strokeWidth, ...options };
  12346. }
  12347. function labelOptions({
  12348. fill,
  12349. fillOpacity,
  12350. fontFamily,
  12351. fontSize,
  12352. fontStyle,
  12353. fontVariant,
  12354. fontWeight,
  12355. monospace,
  12356. pointerEvents,
  12357. shapeRendering,
  12358. clip = false
  12359. }, initializer2) {
  12360. [, fill] = maybeColorChannel(fill);
  12361. [, fillOpacity] = maybeNumberChannel(fillOpacity);
  12362. return {
  12363. facet: "super",
  12364. x: null,
  12365. y: null,
  12366. fill,
  12367. fillOpacity,
  12368. fontFamily,
  12369. fontSize,
  12370. fontStyle,
  12371. fontVariant,
  12372. fontWeight,
  12373. monospace,
  12374. pointerEvents,
  12375. shapeRendering,
  12376. clip,
  12377. initializer: initializer2
  12378. };
  12379. }
  12380. function axisMark(mark, k2, data, properties, options, initialize) {
  12381. let channels;
  12382. function axisInitializer(data2, facets, _channels, scales, dimensions, context) {
  12383. const initializeFacets = data2 == null && (k2 === "fx" || k2 === "fy");
  12384. const { [k2]: scale } = scales;
  12385. if (!scale)
  12386. throw new Error(`missing scale: ${k2}`);
  12387. const domain = scale.domain();
  12388. let { interval: interval2, ticks: ticks2, tickFormat: tickFormat2, tickSpacing = k2 === "x" ? 80 : 35 } = options;
  12389. if (typeof ticks2 === "string" && hasTemporalDomain(scale))
  12390. interval2 = ticks2, ticks2 = undefined;
  12391. if (ticks2 === undefined)
  12392. ticks2 = maybeRangeInterval(interval2, scale.type) ?? inferTickCount(scale, tickSpacing);
  12393. if (data2 == null) {
  12394. if (isIterable(ticks2)) {
  12395. data2 = arrayify2(ticks2);
  12396. } else if (isInterval(ticks2)) {
  12397. data2 = inclusiveRange(ticks2, ...extent(domain));
  12398. } else if (scale.interval) {
  12399. let interval3 = scale.interval;
  12400. if (scale.ticks) {
  12401. const [min3, max2] = extent(domain);
  12402. const n = (max2 - min3) / interval3[intervalDuration];
  12403. interval3 = generalizeTimeInterval(interval3, n / ticks2) ?? interval3;
  12404. data2 = inclusiveRange(interval3, min3, max2);
  12405. } else {
  12406. data2 = domain;
  12407. const n = data2.length;
  12408. interval3 = generalizeTimeInterval(interval3, n / ticks2) ?? interval3;
  12409. if (interval3 !== scale.interval)
  12410. data2 = inclusiveRange(interval3, ...extent(data2));
  12411. }
  12412. if (interval3 === scale.interval) {
  12413. const n = Math.round(data2.length / ticks2);
  12414. if (n > 1)
  12415. data2 = data2.filter((d, i) => i % n === 0);
  12416. }
  12417. } else if (scale.ticks) {
  12418. data2 = scale.ticks(ticks2);
  12419. } else {
  12420. data2 = domain;
  12421. }
  12422. if (!scale.ticks && data2.length && data2 !== domain) {
  12423. const domainSet = new InternSet(domain);
  12424. data2 = data2.filter((d) => domainSet.has(d));
  12425. if (!data2.length)
  12426. warn(`Warning: the ${k2}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`);
  12427. }
  12428. if (k2 === "y" || k2 === "x") {
  12429. facets = [range2(data2)];
  12430. } else {
  12431. channels[k2] = { scale: k2, value: identity6 };
  12432. }
  12433. }
  12434. initialize?.call(this, scale, data2, ticks2, tickFormat2, channels);
  12435. const initializedChannels = Object.fromEntries(Object.entries(channels).map(([name, channel]) => {
  12436. return [name, { ...channel, value: valueof(data2, channel.value) }];
  12437. }));
  12438. if (initializeFacets)
  12439. facets = context.filterFacets(data2, initializedChannels);
  12440. return { data: data2, facets, channels: initializedChannels };
  12441. }
  12442. const basicInitializer = initializer(options).initializer;
  12443. const m = mark(data, initializer({ ...options, initializer: axisInitializer }, basicInitializer));
  12444. if (data == null) {
  12445. channels = m.channels;
  12446. m.channels = {};
  12447. } else {
  12448. channels = {};
  12449. }
  12450. if (properties !== undefined)
  12451. Object.assign(m, properties);
  12452. if (m.clip === undefined)
  12453. m.clip = false;
  12454. return m;
  12455. }
  12456. function inferTickCount(scale, tickSpacing) {
  12457. const [min3, max2] = extent(scale.range());
  12458. return (max2 - min3) / tickSpacing;
  12459. }
  12460. function inferTextChannel(scale, data, ticks2, tickFormat2, anchor) {
  12461. return { value: inferTickFormat(scale, data, ticks2, tickFormat2, anchor) };
  12462. }
  12463. function inferTickFormat(scale, data, ticks2, tickFormat2, anchor) {
  12464. return typeof tickFormat2 === "function" && !(scale.type === "log" && scale.tickFormat) ? tickFormat2 : tickFormat2 === undefined && data && isTemporal(data) ? inferTimeFormat(scale.type, data, anchor) ?? formatDefault : scale.tickFormat ? scale.tickFormat(typeof ticks2 === "number" ? ticks2 : null, tickFormat2) : typeof tickFormat2 === "string" && scale.domain().length > 0 ? (isTemporal(scale.domain()) ? utcFormat : format)(tickFormat2) : tickFormat2 === undefined ? formatDefault : constant(tickFormat2);
  12465. }
  12466. function inclusiveRange(interval2, min3, max2) {
  12467. return interval2.range(min3, interval2.offset(interval2.floor(max2)));
  12468. }
  12469. var shapeTickBottom = {
  12470. draw(context, l) {
  12471. context.moveTo(0, 0);
  12472. context.lineTo(0, l);
  12473. }
  12474. };
  12475. var shapeTickTop = {
  12476. draw(context, l) {
  12477. context.moveTo(0, 0);
  12478. context.lineTo(0, -l);
  12479. }
  12480. };
  12481. var shapeTickLeft = {
  12482. draw(context, l) {
  12483. context.moveTo(0, 0);
  12484. context.lineTo(-l, 0);
  12485. }
  12486. };
  12487. var shapeTickRight = {
  12488. draw(context, l) {
  12489. context.moveTo(0, 0);
  12490. context.lineTo(l, 0);
  12491. }
  12492. };
  12493. function inferFontVariant3(scale) {
  12494. return scale.bandwidth && !scale.interval ? undefined : "tabular-nums";
  12495. }
  12496. function formatAxisLabel(k2, scale, { anchor, label = scale.label, labelAnchor, labelArrow } = {}) {
  12497. if (label == null || label.inferred && hasTemporalDomain(scale) && /^(date|time|year)$/i.test(label))
  12498. return;
  12499. label = String(label);
  12500. if (labelArrow === "auto")
  12501. labelArrow = (!scale.bandwidth || scale.interval) && !/[↑↓→←]/.test(label);
  12502. if (!labelArrow)
  12503. return label;
  12504. if (labelArrow === true) {
  12505. const order = inferScaleOrder(scale);
  12506. if (order)
  12507. labelArrow = /x$/.test(k2) || labelAnchor === "center" ? /x$/.test(k2) === order < 0 ? "left" : "right" : order < 0 ? "up" : "down";
  12508. }
  12509. switch (labelArrow) {
  12510. case "left":
  12511. return `← ${label}`;
  12512. case "right":
  12513. return `${label} →`;
  12514. case "up":
  12515. return anchor === "right" ? `${label} ↑` : `↑ ${label}`;
  12516. case "down":
  12517. return anchor === "right" ? `${label} ↓` : `↓ ${label}`;
  12518. }
  12519. return label;
  12520. }
  12521. function maybeLabelArrow(labelArrow = "auto") {
  12522. return isNoneish(labelArrow) ? false : typeof labelArrow === "boolean" ? labelArrow : keyword(labelArrow, "labelArrow", ["auto", "up", "right", "down", "left"]);
  12523. }
  12524. function hasTemporalDomain(scale) {
  12525. return isTemporal(scale.domain());
  12526. }
  12527. // node_modules/@observablehq/plot/src/legends/swatches.js
  12528. function maybeScale(scale, key) {
  12529. if (key == null)
  12530. return key;
  12531. const s2 = scale(key);
  12532. if (!s2)
  12533. throw new Error(`scale not found: ${key}`);
  12534. return s2;
  12535. }
  12536. function legendSwatches(color3, { opacity: opacity2, ...options } = {}) {
  12537. if (!isOrdinalScale(color3) && !isThresholdScale(color3))
  12538. throw new Error(`swatches legend requires ordinal or threshold color scale (not ${color3.type})`);
  12539. return legendItems(color3, options, (selection2, scale, width, height) => selection2.append("svg").attr("width", width).attr("height", height).attr("fill", scale.scale).attr("fill-opacity", maybeNumberChannel(opacity2)[1]).append("rect").attr("width", "100%").attr("height", "100%"));
  12540. }
  12541. function legendSymbols(symbol2, {
  12542. fill = symbol2.hint?.fill !== undefined ? symbol2.hint.fill : "none",
  12543. fillOpacity = 1,
  12544. stroke = symbol2.hint?.stroke !== undefined ? symbol2.hint.stroke : isNoneish(fill) ? "currentColor" : "none",
  12545. strokeOpacity = 1,
  12546. strokeWidth = 1.5,
  12547. r = 4.5,
  12548. ...options
  12549. } = {}, scale) {
  12550. const [vf, cf] = maybeColorChannel(fill);
  12551. const [vs, cs] = maybeColorChannel(stroke);
  12552. const sf = maybeScale(scale, vf);
  12553. const ss = maybeScale(scale, vs);
  12554. const size = r * r * Math.PI;
  12555. fillOpacity = maybeNumberChannel(fillOpacity)[1];
  12556. strokeOpacity = maybeNumberChannel(strokeOpacity)[1];
  12557. strokeWidth = maybeNumberChannel(strokeWidth)[1];
  12558. return legendItems(symbol2, options, (selection2, scale2, width, height) => selection2.append("svg").attr("viewBox", "-8 -8 16 16").attr("width", width).attr("height", height).attr("fill", vf === "color" ? (d) => sf.scale(d) : cf).attr("fill-opacity", fillOpacity).attr("stroke", vs === "color" ? (d) => ss.scale(d) : cs).attr("stroke-opacity", strokeOpacity).attr("stroke-width", strokeWidth).append("path").attr("d", (d) => {
  12559. const p = pathRound();
  12560. symbol2.scale(d).draw(p, size);
  12561. return p;
  12562. }));
  12563. }
  12564. function legendItems(scale, options = {}, swatch) {
  12565. let {
  12566. columns,
  12567. tickFormat: tickFormat2,
  12568. fontVariant = inferFontVariant(scale),
  12569. swatchSize = 15,
  12570. swatchWidth = swatchSize,
  12571. swatchHeight = swatchSize,
  12572. marginLeft = 0,
  12573. className,
  12574. style,
  12575. width
  12576. } = options;
  12577. const context = createContext(options);
  12578. className = maybeClassName(className);
  12579. tickFormat2 = inferTickFormat(scale.scale, scale.domain, undefined, tickFormat2);
  12580. const swatches = create2("div", context).attr("class", `${className}-swatches ${className}-swatches-${columns != null ? "columns" : "wrap"}`);
  12581. let extraStyle;
  12582. if (columns != null) {
  12583. extraStyle = `:where(.${className}-swatches-columns .${className}-swatch) {
  12584. display: flex;
  12585. align-items: center;
  12586. break-inside: avoid;
  12587. padding-bottom: 1px;
  12588. }
  12589. :where(.${className}-swatches-columns .${className}-swatch::before) {
  12590. flex-shrink: 0;
  12591. }
  12592. :where(.${className}-swatches-columns .${className}-swatch-label) {
  12593. white-space: nowrap;
  12594. overflow: hidden;
  12595. text-overflow: ellipsis;
  12596. }`;
  12597. swatches.style("columns", columns).selectAll().data(scale.domain).enter().append("div").attr("class", `${className}-swatch`).call(swatch, scale, swatchWidth, swatchHeight).call((item) => item.append("div").attr("class", `${className}-swatch-label`).attr("title", tickFormat2).text(tickFormat2));
  12598. } else {
  12599. extraStyle = `:where(.${className}-swatches-wrap) {
  12600. display: flex;
  12601. align-items: center;
  12602. min-height: 33px;
  12603. flex-wrap: wrap;
  12604. }
  12605. :where(.${className}-swatches-wrap .${className}-swatch) {
  12606. display: inline-flex;
  12607. align-items: center;
  12608. margin-right: 1em;
  12609. }`;
  12610. swatches.selectAll().data(scale.domain).enter().append("span").attr("class", `${className}-swatch`).call(swatch, scale, swatchWidth, swatchHeight).append(function() {
  12611. return this.ownerDocument.createTextNode(tickFormat2.apply(this, arguments));
  12612. });
  12613. }
  12614. return swatches.call((div) => div.insert("style", "*").text(`:where(.${className}-swatches) {
  12615. font-family: system-ui, sans-serif;
  12616. font-size: 10px;
  12617. margin-bottom: 0.5em;
  12618. }
  12619. :where(.${className}-swatch > svg) {
  12620. margin-right: 0.5em;
  12621. overflow: visible;
  12622. }
  12623. ${extraStyle}`)).style("margin-left", marginLeft ? `${+marginLeft}px` : null).style("width", width === undefined ? null : `${+width}px`).style("font-variant", impliedString(fontVariant, "normal")).call(applyInlineStyles, style).node();
  12624. }
  12625. // node_modules/@observablehq/plot/src/legends.js
  12626. var legendRegistry = new Map([
  12627. ["symbol", legendSymbols],
  12628. ["color", legendColor],
  12629. ["opacity", legendOpacity]
  12630. ]);
  12631. function exposeLegends(scales, context, defaults4 = {}) {
  12632. return (key, options) => {
  12633. if (!legendRegistry.has(key))
  12634. throw new Error(`unknown legend type: ${key}`);
  12635. if (!(key in scales))
  12636. return;
  12637. return legendRegistry.get(key)(scales[key], legendOptions(context, defaults4[key], options), (key2) => scales[key2]);
  12638. };
  12639. }
  12640. function legendOptions({ className, ...context }, { label, ticks: ticks2, tickFormat: tickFormat2 } = {}, options) {
  12641. return inherit2(options, { className, ...context }, { label, ticks: ticks2, tickFormat: tickFormat2 });
  12642. }
  12643. function legendColor(color3, { legend = true, ...options }) {
  12644. if (legend === true)
  12645. legend = color3.type === "ordinal" ? "swatches" : "ramp";
  12646. if (color3.domain === undefined)
  12647. return;
  12648. switch (`${legend}`.toLowerCase()) {
  12649. case "swatches":
  12650. return legendSwatches(color3, options);
  12651. case "ramp":
  12652. return legendRamp(color3, options);
  12653. default:
  12654. throw new Error(`unknown legend type: ${legend}`);
  12655. }
  12656. }
  12657. function legendOpacity({ type: type2, interpolate, ...scale }, { legend = true, color: color3 = rgb(0, 0, 0), ...options }) {
  12658. if (!interpolate)
  12659. throw new Error(`${type2} opacity scales are not supported`);
  12660. if (legend === true)
  12661. legend = "ramp";
  12662. if (`${legend}`.toLowerCase() !== "ramp")
  12663. throw new Error(`${legend} opacity legends are not supported`);
  12664. return legendColor({ type: type2, ...scale, interpolate: interpolateOpacity(color3) }, { legend, ...options });
  12665. }
  12666. function interpolateOpacity(color3) {
  12667. const { r, g, b } = rgb(color3) || rgb(0, 0, 0);
  12668. return (t) => `rgba(${r},${g},${b},${t})`;
  12669. }
  12670. function createLegends(scales, context, options) {
  12671. const legends = [];
  12672. for (const [key, value] of legendRegistry) {
  12673. const o = options[key];
  12674. if (o?.legend && key in scales) {
  12675. const legend = value(scales[key], legendOptions(context, scales[key], o), (key2) => scales[key2]);
  12676. if (legend != null)
  12677. legends.push(legend);
  12678. }
  12679. }
  12680. return legends;
  12681. }
  12682. // node_modules/@observablehq/plot/src/transforms/identity.js
  12683. function maybeIdentityY(options = {}, k2 = "y") {
  12684. return hasY(options) ? options : { ...options, [k2]: identity6 };
  12685. }
  12686. // node_modules/@observablehq/plot/src/transforms/exclusiveFacets.js
  12687. function exclusiveFacets(data, facets) {
  12688. if (facets.length === 1)
  12689. return { data, facets };
  12690. const n = lengthof(data);
  12691. const O = new Uint8Array(n);
  12692. let overlaps = 0;
  12693. for (const facet of facets) {
  12694. for (const i of facet) {
  12695. if (O[i])
  12696. ++overlaps;
  12697. O[i] = 1;
  12698. }
  12699. }
  12700. if (overlaps === 0)
  12701. return { data, facets };
  12702. data = slice(data);
  12703. const R = data[reindex] = new Uint32Array(n + overlaps);
  12704. facets = facets.map((facet) => slice(facet, Uint32Array));
  12705. let j = n;
  12706. O.fill(0);
  12707. for (const facet of facets) {
  12708. for (let k2 = 0, m = facet.length;k2 < m; ++k2) {
  12709. const i = facet[k2];
  12710. if (O[i])
  12711. facet[k2] = j, data[j] = data[i], R[j] = i, ++j;
  12712. else
  12713. R[i] = i;
  12714. O[i] = 1;
  12715. }
  12716. }
  12717. return { data, facets };
  12718. }
  12719. // node_modules/@observablehq/plot/src/transforms/stack.js
  12720. function stackY(stackOptions = {}, options = {}) {
  12721. if (arguments.length === 1)
  12722. [stackOptions, options] = mergeOptions(stackOptions);
  12723. const { x1: x12, x = x12, y, ...rest } = options;
  12724. const [transform2, X3, y12, y2] = stack(x, y, "x", "y", stackOptions, rest);
  12725. return { ...transform2, x1: x12, x: X3, y1: y12, y2, y: mid(y12, y2) };
  12726. }
  12727. function maybeStackY({ y, y1: y12, y2, ...options } = {}) {
  12728. options = withTip(options, "x");
  12729. if (y12 === undefined && y2 === undefined)
  12730. return stackY({ y, ...options });
  12731. [y12, y2] = maybeZero(y, y12, y2);
  12732. return { ...options, y1: y12, y2 };
  12733. }
  12734. function mergeOptions(options) {
  12735. const { offset: offset2, order, reverse: reverse2, ...rest } = options;
  12736. return [{ offset: offset2, order, reverse: reverse2 }, rest];
  12737. }
  12738. var lengthy = { length: true };
  12739. function stack(x, y = one2, kx2, ky2, { offset: offset2, order, reverse: reverse2 }, options) {
  12740. if (y === null)
  12741. throw new Error(`stack requires ${ky2}`);
  12742. const z = maybeZ(options);
  12743. const [X3, setX] = maybeColumn(x);
  12744. const [Y12, setY1] = column(y);
  12745. const [Y22, setY2] = column(y);
  12746. Y12.hint = Y22.hint = lengthy;
  12747. offset2 = maybeOffset(offset2);
  12748. order = maybeOrder2(order, offset2, ky2);
  12749. return [
  12750. basic(options, (data, facets, plotOptions) => {
  12751. ({ data, facets } = exclusiveFacets(data, facets));
  12752. const X4 = x == null ? undefined : setX(maybeApplyInterval(valueof(data, x), plotOptions?.[kx2]));
  12753. const Y3 = valueof(data, y, Float64Array);
  12754. const Z = valueof(data, z);
  12755. const compare = order && order(data, X4, Y3, Z);
  12756. const n = lengthof(data);
  12757. const Y13 = setY1(new Float64Array(n));
  12758. const Y23 = setY2(new Float64Array(n));
  12759. const facetstacks = [];
  12760. for (const facet of facets) {
  12761. const stacks = X4 ? Array.from(group(facet, (i) => X4[i]).values()) : [facet];
  12762. if (compare)
  12763. for (const stack2 of stacks)
  12764. stack2.sort(compare);
  12765. for (const stack2 of stacks) {
  12766. let yn = 0;
  12767. let yp = 0;
  12768. if (reverse2)
  12769. stack2.reverse();
  12770. for (const i of stack2) {
  12771. const y2 = Y3[i];
  12772. if (y2 < 0)
  12773. yn = Y23[i] = (Y13[i] = yn) + y2;
  12774. else if (y2 > 0)
  12775. yp = Y23[i] = (Y13[i] = yp) + y2;
  12776. else
  12777. Y23[i] = Y13[i] = yp;
  12778. }
  12779. }
  12780. facetstacks.push(stacks);
  12781. }
  12782. if (offset2)
  12783. offset2(facetstacks, Y13, Y23, Z);
  12784. return { data, facets };
  12785. }),
  12786. X3,
  12787. Y12,
  12788. Y22
  12789. ];
  12790. }
  12791. function maybeOffset(offset2) {
  12792. if (offset2 == null)
  12793. return;
  12794. if (typeof offset2 === "function")
  12795. return offset2;
  12796. switch (`${offset2}`.toLowerCase()) {
  12797. case "expand":
  12798. case "normalize":
  12799. return offsetExpand;
  12800. case "center":
  12801. case "silhouette":
  12802. return offsetCenter;
  12803. case "wiggle":
  12804. return offsetWiggle;
  12805. }
  12806. throw new Error(`unknown offset: ${offset2}`);
  12807. }
  12808. function extent2(stack2, Y22) {
  12809. let min3 = 0, max2 = 0;
  12810. for (const i of stack2) {
  12811. const y = Y22[i];
  12812. if (y < min3)
  12813. min3 = y;
  12814. if (y > max2)
  12815. max2 = y;
  12816. }
  12817. return [min3, max2];
  12818. }
  12819. function offsetExpand(facetstacks, Y12, Y22) {
  12820. for (const stacks of facetstacks) {
  12821. for (const stack2 of stacks) {
  12822. const [yn, yp] = extent2(stack2, Y22);
  12823. for (const i of stack2) {
  12824. const m = 1 / (yp - yn || 1);
  12825. Y12[i] = m * (Y12[i] - yn);
  12826. Y22[i] = m * (Y22[i] - yn);
  12827. }
  12828. }
  12829. }
  12830. }
  12831. function offsetCenter(facetstacks, Y12, Y22) {
  12832. for (const stacks of facetstacks) {
  12833. for (const stack2 of stacks) {
  12834. const [yn, yp] = extent2(stack2, Y22);
  12835. for (const i of stack2) {
  12836. const m = (yp + yn) / 2;
  12837. Y12[i] -= m;
  12838. Y22[i] -= m;
  12839. }
  12840. }
  12841. offsetZero(stacks, Y12, Y22);
  12842. }
  12843. offsetCenterFacets(facetstacks, Y12, Y22);
  12844. }
  12845. function offsetWiggle(facetstacks, Y12, Y22, Z) {
  12846. for (const stacks of facetstacks) {
  12847. const prev = new InternMap;
  12848. let y = 0;
  12849. for (const stack2 of stacks) {
  12850. let j = -1;
  12851. const Fi = stack2.map((i) => Math.abs(Y22[i] - Y12[i]));
  12852. const Df = stack2.map((i) => {
  12853. j = Z ? Z[i] : ++j;
  12854. const value = Y22[i] - Y12[i];
  12855. const diff = prev.has(j) ? value - prev.get(j) : 0;
  12856. prev.set(j, value);
  12857. return diff;
  12858. });
  12859. const Cf1 = [0, ...cumsum(Df)];
  12860. for (const i of stack2) {
  12861. Y12[i] += y;
  12862. Y22[i] += y;
  12863. }
  12864. const s1 = sum(Fi);
  12865. if (s1)
  12866. y -= sum(Fi, (d, i) => (Df[i] / 2 + Cf1[i]) * d) / s1;
  12867. }
  12868. offsetZero(stacks, Y12, Y22);
  12869. }
  12870. offsetCenterFacets(facetstacks, Y12, Y22);
  12871. }
  12872. function offsetZero(stacks, Y12, Y22) {
  12873. const m = min(stacks, (stack2) => min(stack2, (i) => Y12[i]));
  12874. for (const stack2 of stacks) {
  12875. for (const i of stack2) {
  12876. Y12[i] -= m;
  12877. Y22[i] -= m;
  12878. }
  12879. }
  12880. }
  12881. function offsetCenterFacets(facetstacks, Y12, Y22) {
  12882. const n = facetstacks.length;
  12883. if (n === 1)
  12884. return;
  12885. const facets = facetstacks.map((stacks) => stacks.flat());
  12886. const m = facets.map((I) => (min(I, (i) => Y12[i]) + max(I, (i) => Y22[i])) / 2);
  12887. const m0 = min(m);
  12888. for (let j = 0;j < n; j++) {
  12889. const p = m0 - m[j];
  12890. for (const i of facets[j]) {
  12891. Y12[i] += p;
  12892. Y22[i] += p;
  12893. }
  12894. }
  12895. }
  12896. function maybeOrder2(order, offset2, ky2) {
  12897. if (order === undefined && offset2 === offsetWiggle)
  12898. return orderInsideOut(ascendingDefined2);
  12899. if (order == null)
  12900. return;
  12901. if (typeof order === "string") {
  12902. const negate = order.startsWith("-");
  12903. const compare = negate ? descendingDefined : ascendingDefined2;
  12904. switch ((negate ? order.slice(1) : order).toLowerCase()) {
  12905. case "value":
  12906. case ky2:
  12907. return orderY(compare);
  12908. case "z":
  12909. return orderZ(compare);
  12910. case "sum":
  12911. return orderSum(compare);
  12912. case "appearance":
  12913. return orderAppearance(compare);
  12914. case "inside-out":
  12915. return orderInsideOut(compare);
  12916. }
  12917. return orderAccessor(field(order));
  12918. }
  12919. if (typeof order === "function")
  12920. return (order.length === 1 ? orderAccessor : orderComparator)(order);
  12921. if (isArray(order))
  12922. return orderGiven(order);
  12923. throw new Error(`invalid order: ${order}`);
  12924. }
  12925. function orderY(compare) {
  12926. return (data, X3, Y3) => (i, j) => compare(Y3[i], Y3[j]);
  12927. }
  12928. function orderZ(compare) {
  12929. return (data, X3, Y3, Z) => (i, j) => compare(Z[i], Z[j]);
  12930. }
  12931. function orderSum(compare) {
  12932. return orderZDomain(compare, (data, X3, Y3, Z) => groupSort(range2(data), (I) => sum(I, (i) => Y3[i]), (i) => Z[i]));
  12933. }
  12934. function orderAppearance(compare) {
  12935. return orderZDomain(compare, (data, X3, Y3, Z) => groupSort(range2(data), (I) => X3[greatest(I, (i) => Y3[i])], (i) => Z[i]));
  12936. }
  12937. function orderInsideOut(compare) {
  12938. return orderZDomain(compare, (data, X3, Y3, Z) => {
  12939. const I = range2(data);
  12940. const K2 = groupSort(I, (I2) => X3[greatest(I2, (i) => Y3[i])], (i) => Z[i]);
  12941. const sums = rollup(I, (I2) => sum(I2, (i) => Y3[i]), (i) => Z[i]);
  12942. const Kp = [], Kn = [];
  12943. let s2 = 0;
  12944. for (const k2 of K2) {
  12945. if (s2 < 0) {
  12946. s2 += sums.get(k2);
  12947. Kp.push(k2);
  12948. } else {
  12949. s2 -= sums.get(k2);
  12950. Kn.push(k2);
  12951. }
  12952. }
  12953. return Kn.reverse().concat(Kp);
  12954. });
  12955. }
  12956. function orderAccessor(f) {
  12957. return (data) => {
  12958. const O = valueof(data, f);
  12959. return (i, j) => ascendingDefined2(O[i], O[j]);
  12960. };
  12961. }
  12962. function orderComparator(f) {
  12963. return (data) => {
  12964. return isArray(data) ? (i, j) => f(data[i], data[j]) : (i, j) => f(data.get(i), data.get(j));
  12965. };
  12966. }
  12967. function orderGiven(domain) {
  12968. return orderZDomain(ascendingDefined2, () => domain);
  12969. }
  12970. function orderZDomain(compare, domain) {
  12971. return (data, X3, Y3, Z) => {
  12972. if (!Z)
  12973. throw new Error("missing channel: z");
  12974. const map3 = new InternMap(domain(data, X3, Y3, Z).map((d, i) => [d, i]));
  12975. return (i, j) => compare(map3.get(Z[i]), map3.get(Z[j]));
  12976. };
  12977. }
  12978. // node_modules/@observablehq/plot/src/marks/rect.js
  12979. var defaults4 = {
  12980. ariaLabel: "rect"
  12981. };
  12982. class Rect extends Mark {
  12983. constructor(data, options = {}) {
  12984. const { x1: x12, y1: y12, x2, y2 } = options;
  12985. super(data, {
  12986. x1: { value: x12, scale: "x", type: x12 != null && x2 == null ? "band" : undefined, optional: true },
  12987. y1: { value: y12, scale: "y", type: y12 != null && y2 == null ? "band" : undefined, optional: true },
  12988. x2: { value: x2, scale: "x", optional: true },
  12989. y2: { value: y2, scale: "y", optional: true }
  12990. }, options, defaults4);
  12991. rectInsets(this, options);
  12992. rectRadii(this, options);
  12993. }
  12994. render(index2, scales, channels, dimensions, context) {
  12995. const { x, y } = scales;
  12996. let { x1: X12, y1: Y12, x2: X22, y2: Y22 } = channels;
  12997. const { marginTop, marginRight, marginBottom, marginLeft, width, height } = dimensions;
  12998. const { projection: projection3 } = context;
  12999. const { insetTop, insetRight, insetBottom, insetLeft } = this;
  13000. const { rx, ry, rx1y1, rx1y2, rx2y1, rx2y2 } = this;
  13001. if ((X12 || X22) && !projection3 && isCollapsed(x))
  13002. X12 = X22 = null;
  13003. if ((Y12 || Y22) && !projection3 && isCollapsed(y))
  13004. Y12 = Y22 = null;
  13005. const bx = x?.bandwidth ? x.bandwidth() : 0;
  13006. const by = y?.bandwidth ? y.bandwidth() : 0;
  13007. return create2("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, {}, 0, 0).call((g) => g.selectAll().data(index2).enter().call(rx1y1 || rx1y2 || rx2y1 || rx2y2 ? (g2) => g2.append("path").call(applyDirectStyles, this).call(applyRoundedRect, X12 && X22 ? (i) => X12[i] + (X22[i] < X12[i] ? -insetRight : insetLeft) : X12 ? (i) => X12[i] + insetLeft : marginLeft + insetLeft, Y12 && Y22 ? (i) => Y12[i] + (Y22[i] < Y12[i] ? -insetBottom : insetTop) : Y12 ? (i) => Y12[i] + insetTop : marginTop + insetTop, X12 && X22 ? (i) => X22[i] - (X22[i] < X12[i] ? -insetLeft : insetRight) : X12 ? (i) => X12[i] + bx - insetRight : width - marginRight - insetRight, Y12 && Y22 ? (i) => Y22[i] - (Y22[i] < Y12[i] ? -insetTop : insetBottom) : Y12 ? (i) => Y12[i] + by - insetBottom : height - marginBottom - insetBottom, this).call(applyChannelStyles, this, channels) : (g2) => g2.append("rect").call(applyDirectStyles, this).attr("x", X12 ? X22 ? (i) => Math.min(X12[i], X22[i]) + insetLeft : (i) => X12[i] + insetLeft : marginLeft + insetLeft).attr("y", Y12 ? Y22 ? (i) => Math.min(Y12[i], Y22[i]) + insetTop : (i) => Y12[i] + insetTop : marginTop + insetTop).attr("width", X12 ? X22 ? (i) => Math.max(0, Math.abs(X22[i] - X12[i]) + bx - insetLeft - insetRight) : bx - insetLeft - insetRight : width - marginRight - marginLeft - insetRight - insetLeft).attr("height", Y12 ? Y22 ? (i) => Math.max(0, Math.abs(Y12[i] - Y22[i]) + by - insetTop - insetBottom) : by - insetTop - insetBottom : height - marginTop - marginBottom - insetTop - insetBottom).call(applyAttr, "rx", rx).call(applyAttr, "ry", ry).call(applyChannelStyles, this, channels))).node();
  13008. }
  13009. }
  13010. function rectInsets(mark, { inset = 0, insetTop = inset, insetRight = inset, insetBottom = inset, insetLeft = inset } = {}) {
  13011. mark.insetTop = number5(insetTop);
  13012. mark.insetRight = number5(insetRight);
  13013. mark.insetBottom = number5(insetBottom);
  13014. mark.insetLeft = number5(insetLeft);
  13015. }
  13016. function rectRadii(mark, {
  13017. r,
  13018. rx,
  13019. ry,
  13020. rx1 = r,
  13021. ry1 = r,
  13022. rx2 = r,
  13023. ry2 = r,
  13024. rx1y1 = rx1 !== undefined ? +rx1 : ry1 !== undefined ? +ry1 : 0,
  13025. rx1y2 = rx1 !== undefined ? +rx1 : ry2 !== undefined ? +ry2 : 0,
  13026. rx2y1 = rx2 !== undefined ? +rx2 : ry1 !== undefined ? +ry1 : 0,
  13027. rx2y2 = rx2 !== undefined ? +rx2 : ry2 !== undefined ? +ry2 : 0
  13028. } = {}) {
  13029. if (rx1y1 || rx1y2 || rx2y1 || rx2y2) {
  13030. mark.rx1y1 = rx1y1;
  13031. mark.rx1y2 = rx1y2;
  13032. mark.rx2y1 = rx2y1;
  13033. mark.rx2y2 = rx2y2;
  13034. } else {
  13035. mark.rx = impliedString(rx, "auto");
  13036. mark.ry = impliedString(ry, "auto");
  13037. }
  13038. }
  13039. function applyRoundedRect(selection2, X12, Y12, X22, Y22, mark) {
  13040. const { rx1y1: r11, rx1y2: r12, rx2y1: r21, rx2y2: r22 } = mark;
  13041. if (typeof X12 !== "function")
  13042. X12 = constant(X12);
  13043. if (typeof Y12 !== "function")
  13044. Y12 = constant(Y12);
  13045. if (typeof X22 !== "function")
  13046. X22 = constant(X22);
  13047. if (typeof Y22 !== "function")
  13048. Y22 = constant(Y22);
  13049. const rx = Math.max(Math.abs(r11 + r21), Math.abs(r12 + r22));
  13050. const ry = Math.max(Math.abs(r11 + r12), Math.abs(r21 + r22));
  13051. selection2.attr("d", (i) => {
  13052. const x12 = X12(i);
  13053. const y12 = Y12(i);
  13054. const x2 = X22(i);
  13055. const y2 = Y22(i);
  13056. const ix = x12 > x2;
  13057. const iy = y12 > y2;
  13058. const l = ix ? x2 : x12;
  13059. const r = ix ? x12 : x2;
  13060. const t = iy ? y2 : y12;
  13061. const b = iy ? y12 : y2;
  13062. const k2 = Math.min(1, (r - l) / rx, (b - t) / ry);
  13063. const tl = k2 * (ix ? iy ? r22 : r21 : iy ? r12 : r11);
  13064. const tr = k2 * (ix ? iy ? r12 : r11 : iy ? r22 : r21);
  13065. const br = k2 * (ix ? iy ? r11 : r12 : iy ? r21 : r22);
  13066. const bl = k2 * (ix ? iy ? r21 : r22 : iy ? r11 : r12);
  13067. return `M${l},${t + biasY(tl, bl)}A${tl},${tl} 0 0 ${tl < 0 ? 0 : 1} ${l + biasX(tl, bl)},${t}` + `H${r - biasX(tr, br)}A${tr},${tr} 0 0 ${tr < 0 ? 0 : 1} ${r},${t + biasY(tr, br)}` + `V${b - biasY(br, tr)}A${br},${br} 0 0 ${br < 0 ? 0 : 1} ${r - biasX(br, tr)},${b}` + `H${l + biasX(bl, tl)}A${bl},${bl} 0 0 ${bl < 0 ? 0 : 1} ${l},${b - biasY(bl, tl)}` + `Z`;
  13068. });
  13069. }
  13070. function biasX(r1, r2) {
  13071. return r2 < 0 ? r1 : Math.abs(r1);
  13072. }
  13073. function biasY(r1, r2) {
  13074. return r2 < 0 ? Math.abs(r1) : r1;
  13075. }
  13076. function rectY(data, options = {}) {
  13077. if (!hasXY(options))
  13078. options = { ...options, x: indexOf, y2: identity6, interval: 1 };
  13079. return new Rect(data, maybeStackY(maybeTrivialIntervalX(maybeIdentityY(options))));
  13080. }
  13081. // node_modules/@observablehq/plot/src/marks/frame.js
  13082. var defaults5 = {
  13083. ariaLabel: "frame",
  13084. fill: "none",
  13085. stroke: "currentColor",
  13086. clip: false
  13087. };
  13088. var lineDefaults = {
  13089. ariaLabel: "frame",
  13090. fill: null,
  13091. stroke: "currentColor",
  13092. strokeLinecap: "square",
  13093. clip: false
  13094. };
  13095. class Frame extends Mark {
  13096. constructor(options = {}) {
  13097. const { anchor = null } = options;
  13098. super(singleton, undefined, options, anchor == null ? defaults5 : lineDefaults);
  13099. this.anchor = maybeKeyword(anchor, "anchor", ["top", "right", "bottom", "left"]);
  13100. rectInsets(this, options);
  13101. if (!anchor)
  13102. rectRadii(this, options);
  13103. }
  13104. render(index2, scales, channels, dimensions, context) {
  13105. const { marginTop, marginRight, marginBottom, marginLeft, width, height } = dimensions;
  13106. const { anchor, insetTop, insetRight, insetBottom, insetLeft } = this;
  13107. const { rx, ry, rx1y1, rx1y2, rx2y1, rx2y2 } = this;
  13108. const x12 = marginLeft + insetLeft;
  13109. const x2 = width - marginRight - insetRight;
  13110. const y12 = marginTop + insetTop;
  13111. const y2 = height - marginBottom - insetBottom;
  13112. return create2(anchor ? "svg:line" : rx1y1 || rx1y2 || rx2y1 || rx2y2 ? "svg:path" : "svg:rect", context).datum(0).call(applyIndirectStyles, this, dimensions, context).call(applyDirectStyles, this).call(applyChannelStyles, this, channels).call(applyTransform, this, {}).call(anchor === "left" ? (line) => line.attr("x1", x12).attr("x2", x12).attr("y1", y12).attr("y2", y2) : anchor === "right" ? (line) => line.attr("x1", x2).attr("x2", x2).attr("y1", y12).attr("y2", y2) : anchor === "top" ? (line) => line.attr("x1", x12).attr("x2", x2).attr("y1", y12).attr("y2", y12) : anchor === "bottom" ? (line) => line.attr("x1", x12).attr("x2", x2).attr("y1", y2).attr("y2", y2) : rx1y1 || rx1y2 || rx2y1 || rx2y2 ? (path2) => path2.call(applyRoundedRect, x12, y12, x2, y2, this) : (rect) => rect.attr("x", x12).attr("y", y12).attr("width", x2 - x12).attr("height", y2 - y12).attr("rx", rx).attr("ry", ry)).node();
  13113. }
  13114. }
  13115. function frame2(options) {
  13116. return new Frame(options);
  13117. }
  13118. // node_modules/@observablehq/plot/src/marks/tip.js
  13119. var defaults6 = {
  13120. ariaLabel: "tip",
  13121. fill: "var(--plot-background)",
  13122. stroke: "currentColor"
  13123. };
  13124. var ignoreChannels = new Set(["geometry", "href", "src", "ariaLabel", "scales"]);
  13125. class Tip extends Mark {
  13126. constructor(data, options = {}) {
  13127. if (options.tip)
  13128. options = { ...options, tip: false };
  13129. if (options.title === undefined && isIterable(data) && isTextual(data))
  13130. options = { ...options, title: identity6 };
  13131. const {
  13132. x,
  13133. y,
  13134. x1: x12,
  13135. x2,
  13136. y1: y12,
  13137. y2,
  13138. anchor,
  13139. preferredAnchor = "bottom",
  13140. monospace,
  13141. fontFamily = monospace ? "ui-monospace, monospace" : undefined,
  13142. fontSize,
  13143. fontStyle,
  13144. fontVariant,
  13145. fontWeight,
  13146. lineHeight = 1,
  13147. lineWidth = 20,
  13148. frameAnchor,
  13149. format: format3,
  13150. textAnchor = "start",
  13151. textOverflow,
  13152. textPadding = 8,
  13153. title,
  13154. pointerSize = 12,
  13155. pathFilter = "drop-shadow(0 3px 4px rgba(0,0,0,0.2))"
  13156. } = options;
  13157. super(data, {
  13158. x: { value: x12 != null && x2 != null ? null : x, scale: "x", optional: true },
  13159. y: { value: y12 != null && y2 != null ? null : y, scale: "y", optional: true },
  13160. x1: { value: x12, scale: "x", optional: x2 == null },
  13161. y1: { value: y12, scale: "y", optional: y2 == null },
  13162. x2: { value: x2, scale: "x", optional: x12 == null },
  13163. y2: { value: y2, scale: "y", optional: y12 == null },
  13164. title: { value: title, optional: true }
  13165. }, options, defaults6);
  13166. this.anchor = maybeAnchor(anchor, "anchor");
  13167. this.preferredAnchor = maybeAnchor(preferredAnchor, "preferredAnchor");
  13168. this.frameAnchor = maybeFrameAnchor(frameAnchor);
  13169. this.textAnchor = impliedString(textAnchor, "middle");
  13170. this.textPadding = +textPadding;
  13171. this.pointerSize = +pointerSize;
  13172. this.pathFilter = string(pathFilter);
  13173. this.lineHeight = +lineHeight;
  13174. this.lineWidth = +lineWidth;
  13175. this.textOverflow = maybeTextOverflow(textOverflow);
  13176. this.monospace = !!monospace;
  13177. this.fontFamily = string(fontFamily);
  13178. this.fontSize = number5(fontSize);
  13179. this.fontStyle = string(fontStyle);
  13180. this.fontVariant = string(fontVariant);
  13181. this.fontWeight = string(fontWeight);
  13182. for (const key in defaults6)
  13183. if (key in this.channels)
  13184. this[key] = defaults6[key];
  13185. this.splitLines = splitter(this);
  13186. this.clipLine = clipper(this);
  13187. this.format = typeof format3 === "string" || typeof format3 === "function" ? { title: format3 } : { ...format3 };
  13188. }
  13189. render(index2, scales, values2, dimensions, context) {
  13190. const mark = this;
  13191. const { x, y, fx, fy } = scales;
  13192. const { ownerSVGElement: svg, document: document2 } = context;
  13193. const { anchor, monospace, lineHeight, lineWidth } = this;
  13194. const { textPadding: r, pointerSize: m, pathFilter } = this;
  13195. const { marginTop, marginLeft } = dimensions;
  13196. const { x1: X12, y1: Y12, x2: X22, y2: Y22, x: X3 = X12 ?? X22, y: Y3 = Y12 ?? Y22 } = values2;
  13197. const ox = fx ? fx(index2.fx) - marginLeft : 0;
  13198. const oy = fy ? fy(index2.fy) - marginTop : 0;
  13199. const [cx, cy] = applyFrameAnchor(this, dimensions);
  13200. const px = anchorX(values2, cx);
  13201. const py = anchorY(values2, cy);
  13202. const widthof = monospace ? monospaceWidth : defaultWidth;
  13203. const ee = widthof(ellipsis);
  13204. let sources, format3;
  13205. if ("title" in values2) {
  13206. sources = getSourceChannels.call(this, { title: values2.channels.title }, scales);
  13207. format3 = formatTitle;
  13208. } else {
  13209. sources = getSourceChannels.call(this, values2.channels, scales);
  13210. format3 = formatChannels;
  13211. }
  13212. const g = create2("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyIndirectTextStyles, this).call(applyTransform, this, { x: X3 && x, y: Y3 && y }).call((g2) => g2.selectAll().data(index2).enter().append("g").attr("transform", (i) => `translate(${Math.round(px(i))},${Math.round(py(i))})`).call(applyDirectStyles, this).call((g3) => g3.append("path").attr("filter", pathFilter)).call((g3) => g3.append("text").each(function(i) {
  13213. const that = select_default2(this);
  13214. this.setAttribute("fill", "currentColor");
  13215. this.setAttribute("fill-opacity", 1);
  13216. this.setAttribute("stroke", "none");
  13217. const lines = format3.call(mark, i, index2, sources, scales, values2);
  13218. if (typeof lines === "string") {
  13219. for (const line of mark.splitLines(lines)) {
  13220. renderLine(that, { value: mark.clipLine(line) });
  13221. }
  13222. } else {
  13223. const labels = new Set;
  13224. for (const line of lines) {
  13225. const { label = "" } = line;
  13226. if (label && labels.has(label))
  13227. continue;
  13228. else
  13229. labels.add(label);
  13230. renderLine(that, line);
  13231. }
  13232. }
  13233. })));
  13234. function renderLine(selection2, { label, value, color: color3, opacity: opacity2 }) {
  13235. label ??= "", value ??= "";
  13236. const swatch = color3 != null || opacity2 != null;
  13237. let title;
  13238. let w = lineWidth * 100;
  13239. const [j] = cut(label, w, widthof, ee);
  13240. if (j >= 0) {
  13241. label = label.slice(0, j).trimEnd() + ellipsis;
  13242. title = value.trim();
  13243. value = "";
  13244. } else {
  13245. if (label || !value && !swatch)
  13246. value = " " + value;
  13247. const [k2] = cut(value, w - widthof(label), widthof, ee);
  13248. if (k2 >= 0) {
  13249. title = value.trim();
  13250. value = value.slice(0, k2).trimEnd() + ellipsis;
  13251. }
  13252. }
  13253. const line = selection2.append("tspan").attr("x", 0).attr("dy", `${lineHeight}em`).text("​");
  13254. if (label)
  13255. line.append("tspan").attr("font-weight", "bold").text(label);
  13256. if (value)
  13257. line.append(() => document2.createTextNode(value));
  13258. if (swatch)
  13259. line.append("tspan").text(" ■").attr("fill", color3).attr("fill-opacity", opacity2).style("user-select", "none");
  13260. if (title)
  13261. line.append("title").text(title);
  13262. }
  13263. function postrender() {
  13264. const { width, height } = dimensions.facet ?? dimensions;
  13265. g.selectChildren().each(function(i) {
  13266. let { x: tx, width: w, height: h } = this.getBBox();
  13267. w = Math.round(w), h = Math.round(h);
  13268. let a2 = anchor;
  13269. if (a2 === undefined) {
  13270. const x2 = px(i) + ox;
  13271. const y2 = py(i) + oy;
  13272. const fitLeft = x2 + w + m + r * 2 < width;
  13273. const fitRight = x2 - w - m - r * 2 > 0;
  13274. const fitTop = y2 + h + m + r * 2 < height;
  13275. const fitBottom = y2 - h - m - r * 2 > 0;
  13276. a2 = fitLeft && fitRight ? fitTop && fitBottom ? mark.preferredAnchor : fitBottom ? "bottom" : "top" : fitTop && fitBottom ? fitLeft ? "left" : "right" : (fitLeft || fitRight) && (fitTop || fitBottom) ? `${fitBottom ? "bottom" : "top"}-${fitLeft ? "left" : "right"}` : mark.preferredAnchor;
  13277. }
  13278. const path2 = this.firstChild;
  13279. const text2 = this.lastChild;
  13280. path2.setAttribute("d", getPath(a2, m, r, w, h));
  13281. if (tx)
  13282. for (const t of text2.childNodes)
  13283. t.setAttribute("x", -tx);
  13284. text2.setAttribute("y", `${+getLineOffset(a2, text2.childNodes.length, lineHeight).toFixed(6)}em`);
  13285. text2.setAttribute("transform", `translate(${getTextTranslate(a2, m, r, w, h)})`);
  13286. });
  13287. g.attr("visibility", null);
  13288. }
  13289. if (index2.length) {
  13290. g.attr("visibility", "hidden");
  13291. if (svg.isConnected)
  13292. Promise.resolve().then(postrender);
  13293. else if (typeof requestAnimationFrame !== "undefined")
  13294. requestAnimationFrame(postrender);
  13295. }
  13296. return g.node();
  13297. }
  13298. }
  13299. function tip(data, { x, y, ...options } = {}) {
  13300. if (options.frameAnchor === undefined)
  13301. [x, y] = maybeTuple(x, y);
  13302. return new Tip(data, { ...options, x, y });
  13303. }
  13304. function getLineOffset(anchor, length3, lineHeight) {
  13305. return /^top(?:-|$)/.test(anchor) ? 0.94 - lineHeight : -0.29 - length3 * lineHeight;
  13306. }
  13307. function getTextTranslate(anchor, m, r, width, height) {
  13308. switch (anchor) {
  13309. case "middle":
  13310. return [-width / 2, height / 2];
  13311. case "top-left":
  13312. return [r, m + r];
  13313. case "top":
  13314. return [-width / 2, m / 2 + r];
  13315. case "top-right":
  13316. return [-width - r, m + r];
  13317. case "right":
  13318. return [-m / 2 - width - r, height / 2];
  13319. case "bottom-left":
  13320. return [r, -m - r];
  13321. case "bottom":
  13322. return [-width / 2, -m / 2 - r];
  13323. case "bottom-right":
  13324. return [-width - r, -m - r];
  13325. case "left":
  13326. return [r + m / 2, height / 2];
  13327. }
  13328. }
  13329. function getPath(anchor, m, r, width, height) {
  13330. const w = width + r * 2;
  13331. const h = height + r * 2;
  13332. switch (anchor) {
  13333. case "middle":
  13334. return `M${-w / 2},${-h / 2}h${w}v${h}h${-w}z`;
  13335. case "top-left":
  13336. return `M0,0l${m},${m}h${w - m}v${h}h${-w}z`;
  13337. case "top":
  13338. return `M0,0l${m / 2},${m / 2}h${(w - m) / 2}v${h}h${-w}v${-h}h${(w - m) / 2}z`;
  13339. case "top-right":
  13340. return `M0,0l${-m},${m}h${m - w}v${h}h${w}z`;
  13341. case "right":
  13342. return `M0,0l${-m / 2},${-m / 2}v${m / 2 - h / 2}h${-w}v${h}h${w}v${m / 2 - h / 2}z`;
  13343. case "bottom-left":
  13344. return `M0,0l${m},${-m}h${w - m}v${-h}h${-w}z`;
  13345. case "bottom":
  13346. return `M0,0l${m / 2},${-m / 2}h${(w - m) / 2}v${-h}h${-w}v${h}h${(w - m) / 2}z`;
  13347. case "bottom-right":
  13348. return `M0,0l${-m},${-m}h${m - w}v${-h}h${w}z`;
  13349. case "left":
  13350. return `M0,0l${m / 2},${-m / 2}v${m / 2 - h / 2}h${w}v${h}h${-w}v${m / 2 - h / 2}z`;
  13351. }
  13352. }
  13353. function getSourceChannels(channels, scales) {
  13354. const sources = {};
  13355. let format3 = this.format;
  13356. format3 = maybeExpandPairedFormat(format3, channels, "x");
  13357. format3 = maybeExpandPairedFormat(format3, channels, "y");
  13358. this.format = format3;
  13359. for (const key in format3) {
  13360. const value = format3[key];
  13361. if (value === null || value === false) {
  13362. continue;
  13363. } else if (key === "fx" || key === "fy") {
  13364. sources[key] = true;
  13365. } else {
  13366. const source = getSource(channels, key);
  13367. if (source)
  13368. sources[key] = source;
  13369. }
  13370. }
  13371. for (const key in channels) {
  13372. if (key in sources || key in format3 || ignoreChannels.has(key))
  13373. continue;
  13374. if ((key === "x" || key === "y") && channels.geometry)
  13375. continue;
  13376. const source = getSource(channels, key);
  13377. if (source) {
  13378. if (source.scale == null && source.defaultScale === "color")
  13379. continue;
  13380. sources[key] = source;
  13381. }
  13382. }
  13383. if (this.facet) {
  13384. if (scales.fx && !("fx" in format3))
  13385. sources.fx = true;
  13386. if (scales.fy && !("fy" in format3))
  13387. sources.fy = true;
  13388. }
  13389. for (const key in sources) {
  13390. const format4 = this.format[key];
  13391. if (typeof format4 === "string") {
  13392. const value = sources[key]?.value ?? scales[key]?.domain() ?? [];
  13393. this.format[key] = (isTemporal(value) ? utcFormat : format)(format4);
  13394. } else if (format4 === undefined || format4 === true) {
  13395. const scale = scales[key];
  13396. this.format[key] = scale?.bandwidth ? inferTickFormat(scale, scale.domain()) : formatDefault;
  13397. }
  13398. }
  13399. return sources;
  13400. }
  13401. function maybeExpandPairedFormat(format3, channels, key) {
  13402. if (!(key in format3))
  13403. return format3;
  13404. const key1 = `${key}1`;
  13405. const key2 = `${key}2`;
  13406. if (((key1 in format3) || !(key1 in channels)) && ((key2 in format3) || !(key2 in channels)))
  13407. return format3;
  13408. const entries = Object.entries(format3);
  13409. const value = format3[key];
  13410. entries.splice(entries.findIndex(([name]) => name === key) + 1, 0, [key1, value], [key2, value]);
  13411. return Object.fromEntries(entries);
  13412. }
  13413. function formatTitle(i, index2, { title }) {
  13414. return this.format.title(title.value[i], i);
  13415. }
  13416. function* formatChannels(i, index2, channels, scales, values2) {
  13417. for (const key in channels) {
  13418. if (key === "fx" || key === "fy") {
  13419. yield {
  13420. label: formatLabel(scales, channels, key),
  13421. value: this.format[key](index2[key], i)
  13422. };
  13423. continue;
  13424. }
  13425. if (key === "x1" && "x2" in channels)
  13426. continue;
  13427. if (key === "y1" && "y2" in channels)
  13428. continue;
  13429. const channel = channels[key];
  13430. if (key === "x2" && "x1" in channels) {
  13431. yield {
  13432. label: formatPairLabel(scales, channels, "x"),
  13433. value: formatPair(this.format.x2, channels.x1, channel, i)
  13434. };
  13435. } else if (key === "y2" && "y1" in channels) {
  13436. yield {
  13437. label: formatPairLabel(scales, channels, "y"),
  13438. value: formatPair(this.format.y2, channels.y1, channel, i)
  13439. };
  13440. } else {
  13441. const value = channel.value[i];
  13442. const scale = channel.scale;
  13443. if (!defined(value) && scale == null)
  13444. continue;
  13445. yield {
  13446. label: formatLabel(scales, channels, key),
  13447. value: this.format[key](value, i),
  13448. color: scale === "color" ? values2[key][i] : null,
  13449. opacity: scale === "opacity" ? values2[key][i] : null
  13450. };
  13451. }
  13452. }
  13453. }
  13454. function formatPair(formatValue, c1, c22, i) {
  13455. return c22.hint?.length ? `${formatValue(c22.value[i] - c1.value[i], i)}` : `${formatValue(c1.value[i], i)}–${formatValue(c22.value[i], i)}`;
  13456. }
  13457. function formatPairLabel(scales, channels, key) {
  13458. const l1 = formatLabel(scales, channels, `${key}1`, key);
  13459. const l2 = formatLabel(scales, channels, `${key}2`, key);
  13460. return l1 === l2 ? l1 : `${l1}–${l2}`;
  13461. }
  13462. function formatLabel(scales, channels, key, defaultLabel = key) {
  13463. const channel = channels[key];
  13464. const scale = scales[channel?.scale ?? key];
  13465. return String(scale?.label ?? channel?.label ?? defaultLabel);
  13466. }
  13467. // node_modules/@observablehq/plot/src/plot.js
  13468. function plot(options = {}) {
  13469. const { facet, style, title, subtitle, caption, ariaLabel, ariaDescription } = options;
  13470. const className = maybeClassName(options.className);
  13471. const marks2 = options.marks === undefined ? [] : flatMarks(options.marks);
  13472. marks2.push(...inferTips(marks2));
  13473. const topFacetState = maybeTopFacet(facet, options);
  13474. const facetStateByMark = new Map;
  13475. for (const mark of marks2) {
  13476. const facetState = maybeMarkFacet(mark, topFacetState, options);
  13477. if (facetState)
  13478. facetStateByMark.set(mark, facetState);
  13479. }
  13480. const channelsByScale = new Map;
  13481. if (topFacetState)
  13482. addScaleChannels(channelsByScale, [topFacetState], options);
  13483. addScaleChannels(channelsByScale, facetStateByMark, options);
  13484. const axes = flatMarks(inferAxes(marks2, channelsByScale, options));
  13485. for (const mark of axes) {
  13486. const facetState = maybeMarkFacet(mark, topFacetState, options);
  13487. if (facetState)
  13488. facetStateByMark.set(mark, facetState);
  13489. }
  13490. marks2.unshift(...axes);
  13491. let facets = createFacets(channelsByScale, options);
  13492. if (facets !== undefined) {
  13493. const topFacetsIndex = topFacetState ? facetFilter(facets, topFacetState) : undefined;
  13494. for (const mark of marks2) {
  13495. if (mark.facet === null || mark.facet === "super")
  13496. continue;
  13497. const facetState = facetStateByMark.get(mark);
  13498. if (facetState === undefined)
  13499. continue;
  13500. facetState.facetsIndex = mark.fx != null || mark.fy != null ? facetFilter(facets, facetState) : topFacetsIndex;
  13501. }
  13502. const nonEmpty = new Set;
  13503. for (const { facetsIndex } of facetStateByMark.values()) {
  13504. facetsIndex?.forEach((index2, i) => {
  13505. if (index2?.length > 0) {
  13506. nonEmpty.add(i);
  13507. }
  13508. });
  13509. }
  13510. facets.forEach(0 < nonEmpty.size && nonEmpty.size < facets.length ? (f, i) => f.empty = !nonEmpty.has(i) : (f) => f.empty = false);
  13511. for (const mark of marks2) {
  13512. if (mark.facet === "exclude") {
  13513. const facetState = facetStateByMark.get(mark);
  13514. if (facetState !== undefined)
  13515. facetState.facetsIndex = facetExclude(facetState.facetsIndex);
  13516. }
  13517. }
  13518. }
  13519. for (const key of registry.keys()) {
  13520. if (isScaleOptions(options[key]) && key !== "fx" && key !== "fy") {
  13521. channelsByScale.set(key, []);
  13522. }
  13523. }
  13524. const stateByMark = new Map;
  13525. for (const mark of marks2) {
  13526. if (stateByMark.has(mark))
  13527. throw new Error("duplicate mark; each mark must be unique");
  13528. const { facetsIndex, channels: facetChannels } = facetStateByMark.get(mark) ?? {};
  13529. const { data, facets: facets2, channels } = mark.initialize(facetsIndex, facetChannels, options);
  13530. applyScaleTransforms(channels, options);
  13531. stateByMark.set(mark, { data, facets: facets2, channels });
  13532. }
  13533. const scaleDescriptors = createScales(addScaleChannels(channelsByScale, stateByMark, options), options);
  13534. const dimensions = createDimensions(scaleDescriptors, marks2, options);
  13535. autoScaleRange(scaleDescriptors, dimensions);
  13536. const scales = createScaleFunctions(scaleDescriptors);
  13537. const { fx, fy } = scales;
  13538. const subdimensions = fx || fy ? innerDimensions(scaleDescriptors, dimensions) : dimensions;
  13539. const superdimensions = fx || fy ? actualDimensions(scales, dimensions) : dimensions;
  13540. const context = createContext(options);
  13541. const document2 = context.document;
  13542. const svg = creator_default("svg").call(document2.documentElement);
  13543. let figure = svg;
  13544. context.ownerSVGElement = svg;
  13545. context.className = className;
  13546. context.projection = createProjection(options, subdimensions);
  13547. context.path = function() {
  13548. return path_default(this.projection ?? xyProjection(scales));
  13549. };
  13550. context.filterFacets = (data, channels) => {
  13551. return facetFilter(facets, { channels, groups: facetGroups(data, channels) });
  13552. };
  13553. context.getMarkState = (mark) => {
  13554. const state = stateByMark.get(mark);
  13555. const facetState = facetStateByMark.get(mark);
  13556. return { ...state, channels: { ...state.channels, ...facetState?.channels } };
  13557. };
  13558. context.dispatchValue = (value) => {
  13559. if (figure.value === value)
  13560. return;
  13561. figure.value = value;
  13562. figure.dispatchEvent(new context.document.defaultView.Event("input", { bubbles: true }));
  13563. };
  13564. const newByScale = new Set;
  13565. for (const [mark, state] of stateByMark) {
  13566. if (mark.initializer != null) {
  13567. const dimensions2 = mark.facet === "super" ? superdimensions : subdimensions;
  13568. const update = mark.initializer(state.data, state.facets, state.channels, scales, dimensions2, context);
  13569. if (update.data !== undefined) {
  13570. state.data = update.data;
  13571. }
  13572. if (update.facets !== undefined) {
  13573. state.facets = update.facets;
  13574. }
  13575. if (update.channels !== undefined) {
  13576. const { fx: fx2, fy: fy2, ...channels } = update.channels;
  13577. inferChannelScales(channels);
  13578. Object.assign(state.channels, channels);
  13579. for (const channel of Object.values(channels)) {
  13580. const { scale } = channel;
  13581. if (scale != null && !isPosition(registry.get(scale))) {
  13582. applyScaleTransform(channel, options);
  13583. newByScale.add(scale);
  13584. }
  13585. }
  13586. if (fx2 != null || fy2 != null)
  13587. facetStateByMark.set(mark, true);
  13588. }
  13589. }
  13590. }
  13591. if (newByScale.size) {
  13592. const newChannelsByScale = new Map;
  13593. addScaleChannels(newChannelsByScale, stateByMark, options, (key) => newByScale.has(key));
  13594. addScaleChannels(channelsByScale, stateByMark, options, (key) => newByScale.has(key));
  13595. const newScaleDescriptors = inheritScaleLabels(createScales(newChannelsByScale, options), scaleDescriptors);
  13596. const { scales: newExposedScales, ...newScales } = createScaleFunctions(newScaleDescriptors);
  13597. Object.assign(scaleDescriptors, newScaleDescriptors);
  13598. Object.assign(scales, newScales);
  13599. Object.assign(scales.scales, newExposedScales);
  13600. }
  13601. let facetDomains, facetTranslate;
  13602. if (facets !== undefined) {
  13603. facetDomains = { x: fx?.domain(), y: fy?.domain() };
  13604. facets = recreateFacets(facets, facetDomains);
  13605. facetTranslate = facetTranslator(fx, fy, dimensions);
  13606. }
  13607. for (const [mark, state] of stateByMark) {
  13608. state.values = mark.scale(state.channels, scales, context);
  13609. }
  13610. const { width, height } = dimensions;
  13611. select_default2(svg).attr("class", className).attr("fill", "currentColor").attr("font-family", "system-ui, sans-serif").attr("font-size", 10).attr("text-anchor", "middle").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).attr("aria-label", ariaLabel).attr("aria-description", ariaDescription).call((svg2) => svg2.append("style").text(`:where(.${className}) {
  13612. --plot-background: white;
  13613. display: block;
  13614. height: auto;
  13615. height: intrinsic;
  13616. max-width: 100%;
  13617. }
  13618. :where(.${className} text),
  13619. :where(.${className} tspan) {
  13620. white-space: pre;
  13621. }`)).call(applyInlineStyles, style);
  13622. for (const mark of marks2) {
  13623. const { channels, values: values2, facets: indexes2 } = stateByMark.get(mark);
  13624. if (facets === undefined || mark.facet === "super") {
  13625. let index2 = null;
  13626. if (indexes2) {
  13627. index2 = indexes2[0];
  13628. index2 = mark.filter(index2, channels, values2);
  13629. if (index2.length === 0)
  13630. continue;
  13631. }
  13632. const node = mark.render(index2, scales, values2, superdimensions, context);
  13633. if (node == null)
  13634. continue;
  13635. svg.appendChild(node);
  13636. } else {
  13637. let g;
  13638. for (const f of facets) {
  13639. if (!(mark.facetAnchor?.(facets, facetDomains, f) ?? !f.empty))
  13640. continue;
  13641. let index2 = null;
  13642. if (indexes2) {
  13643. const faceted = facetStateByMark.has(mark);
  13644. index2 = indexes2[faceted ? f.i : 0];
  13645. index2 = mark.filter(index2, channels, values2);
  13646. if (index2.length === 0)
  13647. continue;
  13648. if (!faceted && index2 === indexes2[0])
  13649. index2 = subarray(index2);
  13650. index2.fx = f.x, index2.fy = f.y, index2.fi = f.i;
  13651. }
  13652. const node = mark.render(index2, scales, values2, subdimensions, context);
  13653. if (node == null)
  13654. continue;
  13655. (g ??= select_default2(svg).append("g")).append(() => node).datum(f);
  13656. for (const name of ["aria-label", "aria-description", "aria-hidden", "transform"]) {
  13657. if (node.hasAttribute(name)) {
  13658. g.attr(name, node.getAttribute(name));
  13659. node.removeAttribute(name);
  13660. }
  13661. }
  13662. }
  13663. g?.selectChildren().each(facetTranslate);
  13664. }
  13665. }
  13666. const legends = createLegends(scaleDescriptors, context, options);
  13667. const { figure: figured = title != null || subtitle != null || caption != null || legends.length > 0 } = options;
  13668. if (figured) {
  13669. figure = document2.createElement("figure");
  13670. figure.className = `${className}-figure`;
  13671. figure.style.maxWidth = "initial";
  13672. if (title != null)
  13673. figure.append(createTitleElement(document2, title, "h2"));
  13674. if (subtitle != null)
  13675. figure.append(createTitleElement(document2, subtitle, "h3"));
  13676. figure.append(...legends, svg);
  13677. if (caption != null)
  13678. figure.append(createFigcaption(document2, caption));
  13679. if ("value" in svg)
  13680. figure.value = svg.value, delete svg.value;
  13681. }
  13682. figure.scale = exposeScales(scales.scales);
  13683. figure.legend = exposeLegends(scaleDescriptors, context, options);
  13684. const w = consumeWarnings();
  13685. if (w > 0) {
  13686. select_default2(svg).append("text").attr("x", width).attr("y", 20).attr("dy", "-1em").attr("text-anchor", "end").attr("font-family", "initial").text("⚠️").append("title").text(`${w.toLocaleString("en-US")} warning${w === 1 ? "" : "s"}. Please check the console.`);
  13687. }
  13688. return figure;
  13689. }
  13690. function createTitleElement(document2, contents, tag) {
  13691. if (contents.ownerDocument)
  13692. return contents;
  13693. const e = document2.createElement(tag);
  13694. e.append(contents);
  13695. return e;
  13696. }
  13697. function createFigcaption(document2, caption) {
  13698. const e = document2.createElement("figcaption");
  13699. e.append(caption);
  13700. return e;
  13701. }
  13702. function flatMarks(marks2) {
  13703. return marks2.flat(Infinity).filter((mark) => mark != null).map(markify);
  13704. }
  13705. function markify(mark) {
  13706. return typeof mark.render === "function" ? mark : new Render(mark);
  13707. }
  13708. class Render extends Mark {
  13709. constructor(render) {
  13710. if (typeof render !== "function")
  13711. throw new TypeError("invalid mark; missing render function");
  13712. super();
  13713. this.render = render;
  13714. }
  13715. render() {}
  13716. }
  13717. function applyScaleTransforms(channels, options) {
  13718. for (const name in channels)
  13719. applyScaleTransform(channels[name], options);
  13720. return channels;
  13721. }
  13722. function applyScaleTransform(channel, options) {
  13723. const { scale, transform: t = true } = channel;
  13724. if (scale == null || !t)
  13725. return;
  13726. const {
  13727. type: type2,
  13728. percent,
  13729. interval: interval2,
  13730. transform: transform2 = percent ? (x) => x == null ? NaN : x * 100 : maybeIntervalTransform(interval2, type2)
  13731. } = options[scale] ?? {};
  13732. if (transform2 == null)
  13733. return;
  13734. channel.value = map2(channel.value, transform2);
  13735. channel.transform = false;
  13736. }
  13737. function inferChannelScales(channels) {
  13738. for (const name in channels) {
  13739. inferChannelScale(name, channels[name]);
  13740. }
  13741. }
  13742. function addScaleChannels(channelsByScale, stateByMark, options, filter2 = yes) {
  13743. for (const { channels } of stateByMark.values()) {
  13744. for (const name in channels) {
  13745. const channel = channels[name];
  13746. const { scale } = channel;
  13747. if (scale != null && filter2(scale)) {
  13748. if (scale === "projection") {
  13749. if (!hasProjection(options)) {
  13750. const gx = options.x?.domain === undefined;
  13751. const gy = options.y?.domain === undefined;
  13752. if (gx || gy) {
  13753. const [x, y] = getGeometryChannels(channel);
  13754. if (gx)
  13755. addScaleChannel(channelsByScale, "x", x);
  13756. if (gy)
  13757. addScaleChannel(channelsByScale, "y", y);
  13758. }
  13759. }
  13760. } else {
  13761. addScaleChannel(channelsByScale, scale, channel);
  13762. }
  13763. }
  13764. }
  13765. }
  13766. return channelsByScale;
  13767. }
  13768. function addScaleChannel(channelsByScale, scale, channel) {
  13769. const scaleChannels = channelsByScale.get(scale);
  13770. if (scaleChannels !== undefined)
  13771. scaleChannels.push(channel);
  13772. else
  13773. channelsByScale.set(scale, [channel]);
  13774. }
  13775. function maybeTopFacet(facet, options) {
  13776. if (facet == null)
  13777. return;
  13778. const { x, y } = facet;
  13779. if (x == null && y == null)
  13780. return;
  13781. const data = dataify(facet.data);
  13782. if (data == null)
  13783. throw new Error("missing facet data");
  13784. const channels = {};
  13785. if (x != null)
  13786. channels.fx = createChannel(data, { value: x, scale: "fx" });
  13787. if (y != null)
  13788. channels.fy = createChannel(data, { value: y, scale: "fy" });
  13789. applyScaleTransforms(channels, options);
  13790. const groups2 = facetGroups(data, channels);
  13791. return { channels, groups: groups2, data: facet.data };
  13792. }
  13793. function maybeMarkFacet(mark, topFacetState, options) {
  13794. if (mark.facet === null || mark.facet === "super")
  13795. return;
  13796. const { fx, fy } = mark;
  13797. if (fx != null || fy != null) {
  13798. const data2 = dataify(mark.data ?? fx ?? fy);
  13799. if (data2 === undefined)
  13800. throw new Error(`missing facet data in ${mark.ariaLabel}`);
  13801. if (data2 === null)
  13802. return;
  13803. const channels2 = {};
  13804. if (fx != null)
  13805. channels2.fx = createChannel(data2, { value: fx, scale: "fx" });
  13806. if (fy != null)
  13807. channels2.fy = createChannel(data2, { value: fy, scale: "fy" });
  13808. applyScaleTransforms(channels2, options);
  13809. return { channels: channels2, groups: facetGroups(data2, channels2) };
  13810. }
  13811. if (topFacetState === undefined)
  13812. return;
  13813. const { channels, groups: groups2, data } = topFacetState;
  13814. if (mark.facet !== "auto" || mark.data === data)
  13815. return { channels, groups: groups2 };
  13816. if (data.length > 0 && (groups2.size > 1 || groups2.size === 1 && channels.fx && channels.fy && [...groups2][0][1].size > 1) && lengthof(dataify(mark.data)) === lengthof(data)) {
  13817. warn(`Warning: the ${mark.ariaLabel} mark appears to use faceted data, but isn’t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`);
  13818. }
  13819. }
  13820. function derive(mark, options = {}) {
  13821. return initializer({ ...options, x: null, y: null }, (data, facets, channels, scales, dimensions, context) => {
  13822. return context.getMarkState(mark);
  13823. });
  13824. }
  13825. function inferTips(marks2) {
  13826. const tips = [];
  13827. for (const mark of marks2) {
  13828. let tipOptions = mark.tip;
  13829. if (tipOptions) {
  13830. if (tipOptions === true)
  13831. tipOptions = {};
  13832. else if (typeof tipOptions === "string")
  13833. tipOptions = { pointer: tipOptions };
  13834. let { pointer: p, preferredAnchor: a2 } = tipOptions;
  13835. p = /^x$/i.test(p) ? pointerX : /^y$/i.test(p) ? pointerY : pointer;
  13836. tipOptions = p(derive(mark, tipOptions));
  13837. tipOptions.title = null;
  13838. if (a2 === undefined)
  13839. tipOptions.preferredAnchor = p === pointerY ? "left" : "bottom";
  13840. const t = tip(mark.data, tipOptions);
  13841. t.facet = mark.facet;
  13842. t.facetAnchor = mark.facetAnchor;
  13843. tips.push(t);
  13844. }
  13845. }
  13846. return tips;
  13847. }
  13848. function inferAxes(marks2, channelsByScale, options) {
  13849. let {
  13850. projection: projection3,
  13851. x = {},
  13852. y = {},
  13853. fx = {},
  13854. fy = {},
  13855. axis: axis2,
  13856. grid,
  13857. facet = {},
  13858. facet: { axis: facetAxis = axis2, grid: facetGrid } = facet,
  13859. x: { axis: xAxis = axis2, grid: xGrid = xAxis === null ? null : grid } = x,
  13860. y: { axis: yAxis = axis2, grid: yGrid = yAxis === null ? null : grid } = y,
  13861. fx: { axis: fxAxis = facetAxis, grid: fxGrid = fxAxis === null ? null : facetGrid } = fx,
  13862. fy: { axis: fyAxis = facetAxis, grid: fyGrid = fyAxis === null ? null : facetGrid } = fy
  13863. } = options;
  13864. if (projection3 || !isScaleOptions(x) && !hasPositionChannel("x", marks2))
  13865. xAxis = xGrid = null;
  13866. if (projection3 || !isScaleOptions(y) && !hasPositionChannel("y", marks2))
  13867. yAxis = yGrid = null;
  13868. if (!channelsByScale.has("fx"))
  13869. fxAxis = fxGrid = null;
  13870. if (!channelsByScale.has("fy"))
  13871. fyAxis = fyGrid = null;
  13872. if (xAxis === undefined)
  13873. xAxis = !hasAxis(marks2, "x");
  13874. if (yAxis === undefined)
  13875. yAxis = !hasAxis(marks2, "y");
  13876. if (fxAxis === undefined)
  13877. fxAxis = !hasAxis(marks2, "fx");
  13878. if (fyAxis === undefined)
  13879. fyAxis = !hasAxis(marks2, "fy");
  13880. if (xAxis === true)
  13881. xAxis = "bottom";
  13882. if (yAxis === true)
  13883. yAxis = "left";
  13884. if (fxAxis === true)
  13885. fxAxis = xAxis === "top" || xAxis === null ? "bottom" : "top";
  13886. if (fyAxis === true)
  13887. fyAxis = yAxis === "right" || yAxis === null ? "left" : "right";
  13888. const axes = [];
  13889. maybeGrid(axes, fyGrid, gridFy, fy);
  13890. maybeAxis(axes, fyAxis, axisFy, "right", "left", facet, fy);
  13891. maybeGrid(axes, fxGrid, gridFx, fx);
  13892. maybeAxis(axes, fxAxis, axisFx, "top", "bottom", facet, fx);
  13893. maybeGrid(axes, yGrid, gridY, y);
  13894. maybeAxis(axes, yAxis, axisY, "left", "right", options, y);
  13895. maybeGrid(axes, xGrid, gridX, x);
  13896. maybeAxis(axes, xAxis, axisX, "bottom", "top", options, x);
  13897. return axes;
  13898. }
  13899. function maybeAxis(axes, axis2, axisType, primary, secondary, defaults7, options) {
  13900. if (!axis2)
  13901. return;
  13902. const both = isBoth(axis2);
  13903. options = axisOptions(both ? primary : axis2, defaults7, options);
  13904. const { line } = options;
  13905. if ((axisType === axisY || axisType === axisX) && line && !isNone(line))
  13906. axes.push(frame2(lineOptions(options)));
  13907. axes.push(axisType(options));
  13908. if (both)
  13909. axes.push(axisType({ ...options, anchor: secondary, label: null }));
  13910. }
  13911. function maybeGrid(axes, grid, gridType, options) {
  13912. if (!grid || isNone(grid))
  13913. return;
  13914. axes.push(gridType(gridOptions(grid, options)));
  13915. }
  13916. function isBoth(value) {
  13917. return /^\s*both\s*$/i.test(value);
  13918. }
  13919. function axisOptions(anchor, defaults7, {
  13920. line = defaults7.line,
  13921. ticks: ticks2,
  13922. tickSize,
  13923. tickSpacing,
  13924. tickPadding,
  13925. tickFormat: tickFormat2,
  13926. tickRotate,
  13927. fontVariant,
  13928. ariaLabel,
  13929. ariaDescription,
  13930. label = defaults7.label,
  13931. labelAnchor,
  13932. labelArrow = defaults7.labelArrow,
  13933. labelOffset
  13934. }) {
  13935. return {
  13936. anchor,
  13937. line,
  13938. ticks: ticks2,
  13939. tickSize,
  13940. tickSpacing,
  13941. tickPadding,
  13942. tickFormat: tickFormat2,
  13943. tickRotate,
  13944. fontVariant,
  13945. ariaLabel,
  13946. ariaDescription,
  13947. label,
  13948. labelAnchor,
  13949. labelArrow,
  13950. labelOffset
  13951. };
  13952. }
  13953. function lineOptions(options) {
  13954. const { anchor, line } = options;
  13955. return { anchor, facetAnchor: anchor + "-empty", stroke: line === true ? undefined : line };
  13956. }
  13957. function gridOptions(grid, {
  13958. stroke = isColor(grid) ? grid : undefined,
  13959. ticks: ticks2 = isGridTicks(grid) ? grid : undefined,
  13960. tickSpacing,
  13961. ariaLabel,
  13962. ariaDescription
  13963. }) {
  13964. return {
  13965. stroke,
  13966. ticks: ticks2,
  13967. tickSpacing,
  13968. ariaLabel,
  13969. ariaDescription
  13970. };
  13971. }
  13972. function isGridTicks(grid) {
  13973. switch (typeof grid) {
  13974. case "number":
  13975. return true;
  13976. case "string":
  13977. return !isColor(grid);
  13978. }
  13979. return isIterable(grid) || typeof grid?.range === "function";
  13980. }
  13981. function hasAxis(marks2, k2) {
  13982. const prefix = `${k2}-axis `;
  13983. return marks2.some((m) => m.ariaLabel?.startsWith(prefix));
  13984. }
  13985. function hasPositionChannel(k2, marks2) {
  13986. for (const mark of marks2) {
  13987. for (const key in mark.channels) {
  13988. const { scale } = mark.channels[key];
  13989. if (scale === k2 || scale === "projection") {
  13990. return true;
  13991. }
  13992. }
  13993. }
  13994. return false;
  13995. }
  13996. function inheritScaleLabels(newScales, scales) {
  13997. for (const key in newScales) {
  13998. const newScale = newScales[key];
  13999. const scale = scales[key];
  14000. if (newScale.label === undefined && scale) {
  14001. newScale.label = scale.label;
  14002. }
  14003. }
  14004. return newScales;
  14005. }
  14006. function actualDimensions({ fx, fy }, dimensions) {
  14007. const { marginTop, marginRight, marginBottom, marginLeft, width, height } = outerDimensions(dimensions);
  14008. const fxr = fx && outerRange(fx);
  14009. const fyr = fy && outerRange(fy);
  14010. return {
  14011. marginTop: fy ? fyr[0] : marginTop,
  14012. marginRight: fx ? width - fxr[1] : marginRight,
  14013. marginBottom: fy ? height - fyr[1] : marginBottom,
  14014. marginLeft: fx ? fxr[0] : marginLeft,
  14015. inset: {
  14016. marginTop: dimensions.marginTop,
  14017. marginRight: dimensions.marginRight,
  14018. marginBottom: dimensions.marginBottom,
  14019. marginLeft: dimensions.marginLeft
  14020. },
  14021. width,
  14022. height
  14023. };
  14024. }
  14025. function outerRange(scale) {
  14026. const domain = scale.domain();
  14027. if (domain.length === 0)
  14028. return [0, scale.bandwidth()];
  14029. let x12 = scale(domain[0]);
  14030. let x2 = scale(domain[domain.length - 1]);
  14031. if (x2 < x12)
  14032. [x12, x2] = [x2, x12];
  14033. return [x12, x2 + scale.bandwidth()];
  14034. }
  14035. // node_modules/@observablehq/plot/src/marks/dot.js
  14036. var defaults7 = {
  14037. ariaLabel: "dot",
  14038. fill: "none",
  14039. stroke: "currentColor",
  14040. strokeWidth: 1.5
  14041. };
  14042. function withDefaultSort(options) {
  14043. return options.sort === undefined && options.reverse === undefined ? sort2({ channel: "-r" }, options) : options;
  14044. }
  14045. class Dot extends Mark {
  14046. constructor(data, options = {}) {
  14047. const { x, y, r, rotate, symbol: symbol2 = circle_default2, frameAnchor } = options;
  14048. const [vrotate, crotate] = maybeNumberChannel(rotate, 0);
  14049. const [vsymbol, csymbol] = maybeSymbolChannel(symbol2);
  14050. const [vr, cr] = maybeNumberChannel(r, vsymbol == null ? 3 : 4.5);
  14051. super(data, {
  14052. x: { value: x, scale: "x", optional: true },
  14053. y: { value: y, scale: "y", optional: true },
  14054. r: { value: vr, scale: "r", filter: positive, optional: true },
  14055. rotate: { value: vrotate, optional: true },
  14056. symbol: { value: vsymbol, scale: "auto", optional: true }
  14057. }, withDefaultSort(options), defaults7);
  14058. this.r = cr;
  14059. this.rotate = crotate;
  14060. this.symbol = csymbol;
  14061. this.frameAnchor = maybeFrameAnchor(frameAnchor);
  14062. const { channels } = this;
  14063. const { symbol: symbolChannel } = channels;
  14064. if (symbolChannel) {
  14065. const { fill: fillChannel, stroke: strokeChannel } = channels;
  14066. symbolChannel.hint = {
  14067. fill: fillChannel ? fillChannel.value === symbolChannel.value ? "color" : "currentColor" : this.fill ?? "currentColor",
  14068. stroke: strokeChannel ? strokeChannel.value === symbolChannel.value ? "color" : "currentColor" : this.stroke ?? "none"
  14069. };
  14070. }
  14071. }
  14072. render(index2, scales, channels, dimensions, context) {
  14073. const { x, y } = scales;
  14074. const { x: X3, y: Y3, r: R, rotate: A5, symbol: S } = channels;
  14075. const { r, rotate, symbol: symbol2 } = this;
  14076. const [cx, cy] = applyFrameAnchor(this, dimensions);
  14077. const circle = symbol2 === circle_default2;
  14078. const size = R ? undefined : r * r * Math.PI;
  14079. if (negative(r))
  14080. index2 = [];
  14081. return create2("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, { x: X3 && x, y: Y3 && y }).call((g) => g.selectAll().data(index2).enter().append(circle ? "circle" : "path").call(applyDirectStyles, this).call(circle ? (selection2) => {
  14082. selection2.attr("cx", X3 ? (i) => X3[i] : cx).attr("cy", Y3 ? (i) => Y3[i] : cy).attr("r", R ? (i) => R[i] : r);
  14083. } : (selection2) => {
  14084. selection2.attr("transform", template`translate(${X3 ? (i) => X3[i] : cx},${Y3 ? (i) => Y3[i] : cy})${A5 ? (i) => ` rotate(${A5[i]})` : rotate ? ` rotate(${rotate})` : ``}`).attr("d", R && S ? (i) => {
  14085. const p = pathRound();
  14086. S[i].draw(p, R[i] * R[i] * Math.PI);
  14087. return p;
  14088. } : R ? (i) => {
  14089. const p = pathRound();
  14090. symbol2.draw(p, R[i] * R[i] * Math.PI);
  14091. return p;
  14092. } : S ? (i) => {
  14093. const p = pathRound();
  14094. S[i].draw(p, size);
  14095. return p;
  14096. } : (() => {
  14097. const p = pathRound();
  14098. symbol2.draw(p, size);
  14099. return p;
  14100. })());
  14101. }).call(applyChannelStyles, this, channels)).node();
  14102. }
  14103. }
  14104. function dot(data, { x, y, ...options } = {}) {
  14105. if (options.frameAnchor === undefined)
  14106. [x, y] = maybeTuple(x, y);
  14107. return new Dot(data, { ...options, x, y });
  14108. }
  14109. // node_modules/@observablehq/plot/src/marks/crosshair.js
  14110. function crosshairX(data, options = {}) {
  14111. return crosshairK(pointerX, data, options);
  14112. }
  14113. function crosshairK(pointer2, data, options = {}) {
  14114. const { x, y, maxRadius } = options;
  14115. const p = pointer2({ px: x, py: y, maxRadius });
  14116. const M2 = [];
  14117. if (x != null)
  14118. M2.push(ruleX(data, ruleOptions("x", { ...p, inset: -6 }, options)));
  14119. if (y != null)
  14120. M2.push(ruleY(data, ruleOptions("y", { ...p, inset: -6 }, options)));
  14121. if (x != null)
  14122. M2.push(text(data, textOptions("x", { ...p, dy: 9, frameAnchor: "bottom", lineAnchor: "top" }, options)));
  14123. if (y != null)
  14124. M2.push(text(data, textOptions("y", { ...p, dx: -9, frameAnchor: "left", textAnchor: "end" }, options)));
  14125. for (const m of M2)
  14126. m.ariaLabel = `crosshair ${m.ariaLabel}`;
  14127. return marks(...M2);
  14128. }
  14129. function markOptions(k2, { channels: pointerChannels, ...pointerOptions }, { facet, facetAnchor, fx, fy, [k2]: p, channels, transform: transform2, initializer: initializer2 }) {
  14130. return {
  14131. ...pointerOptions,
  14132. facet,
  14133. facetAnchor,
  14134. fx,
  14135. fy,
  14136. [k2]: p,
  14137. channels: { ...pointerChannels, ...channels },
  14138. transform: transform2,
  14139. initializer: pxpy(k2, initializer2)
  14140. };
  14141. }
  14142. function pxpy(k2, i) {
  14143. if (i == null)
  14144. return i;
  14145. return function(data, facets, { x: x12, y: y12, px, py, ...c1 }, ...args) {
  14146. const { channels: { x, y, ...c4 } = {}, ...rest } = i.call(this, data, facets, { ...c1, x: px, y: py }, ...args);
  14147. return {
  14148. channels: {
  14149. ...c4,
  14150. ...x && { px: x, ...k2 === "x" && { x } },
  14151. ...y && { py: y, ...k2 === "y" && { y } }
  14152. },
  14153. ...rest
  14154. };
  14155. };
  14156. }
  14157. function ruleOptions(k2, pointerOptions, options) {
  14158. const {
  14159. color: color3 = "currentColor",
  14160. opacity: opacity2 = 0.2,
  14161. ruleStroke: stroke = color3,
  14162. ruleStrokeOpacity: strokeOpacity = opacity2,
  14163. ruleStrokeWidth: strokeWidth
  14164. } = options;
  14165. return {
  14166. ...markOptions(k2, pointerOptions, options),
  14167. stroke,
  14168. strokeOpacity,
  14169. strokeWidth
  14170. };
  14171. }
  14172. function textOptions(k2, pointerOptions, options) {
  14173. const {
  14174. color: color3 = "currentColor",
  14175. textFill: fill = color3,
  14176. textFillOpacity: fillOpacity,
  14177. textStroke: stroke = "var(--plot-background)",
  14178. textStrokeOpacity: strokeOpacity,
  14179. textStrokeWidth: strokeWidth = 5
  14180. } = options;
  14181. return {
  14182. ...markOptions(k2, pointerOptions, textChannel(k2, options)),
  14183. fill,
  14184. fillOpacity,
  14185. stroke,
  14186. strokeOpacity,
  14187. strokeWidth
  14188. };
  14189. }
  14190. function textChannel(source, options) {
  14191. return initializer(options, (data, facets, channels) => {
  14192. return { channels: { text: { value: getSource(channels, source)?.value } } };
  14193. });
  14194. }
  14195. // node_modules/@observablehq/plot/src/index.js
  14196. Mark.prototype.plot = function({ marks: marks2 = [], ...options } = {}) {
  14197. return plot({ ...options, marks: [...marks2, this] });
  14198. };
  14199. // ts/cache.ts
  14200. var fetchCache = new Map;
  14201. async function cachedFetchJSON(url, options) {
  14202. if (fetchCache.has(url))
  14203. return fetchCache.get(url);
  14204. const response = await fetch(url, options).then((r) => r.json());
  14205. fetchCache.set(url, response);
  14206. return response;
  14207. }
  14208. // ts/mat.ts
  14209. var tickerSelect = document.querySelector("select#ticker");
  14210. var charts = document.querySelector("#charts");
  14211. (async function() {
  14212. const materials = await fetch("https://rest.fnar.net/material/allmaterials").then((r) => r.json());
  14213. const selected = document.location.hash.substring(1);
  14214. for (const mat of materials.sort((a2, b) => a2.Ticker.localeCompare(b.Ticker))) {
  14215. const option = document.createElement("option");
  14216. option.value = mat.Ticker;
  14217. option.textContent = `${mat.Ticker} ${mat.Name}`;
  14218. if (mat.Ticker === selected)
  14219. option.selected = true;
  14220. tickerSelect.appendChild(option);
  14221. }
  14222. if (selected)
  14223. render();
  14224. })();
  14225. tickerSelect.addEventListener("change", async () => {
  14226. await render();
  14227. document.location.hash = tickerSelect.value;
  14228. });
  14229. async function render() {
  14230. charts.innerHTML = "";
  14231. const ticker2 = tickerSelect.value;
  14232. const cxpc = await Promise.all([
  14233. getCXPC(ticker2, "NC1"),
  14234. getCXPC(ticker2, "CI1"),
  14235. getCXPC(ticker2, "IC1"),
  14236. getCXPC(ticker2, "AI1")
  14237. ]);
  14238. let minDate = null, maxDate = null;
  14239. let maxPrice = 0, maxTraded = 0;
  14240. for (const cxPrices of cxpc)
  14241. for (const p of cxPrices) {
  14242. if (minDate === null || p.DateEpochMs < minDate)
  14243. minDate = p.DateEpochMs;
  14244. if (maxDate === null || p.DateEpochMs > maxDate)
  14245. maxDate = p.DateEpochMs;
  14246. if (p.High > maxPrice)
  14247. maxPrice = p.High;
  14248. if (p.Traded > maxTraded)
  14249. maxTraded = p.Traded;
  14250. }
  14251. if (minDate === null || maxDate === null)
  14252. throw new Error("no data");
  14253. const dateRange = [new Date(minDate), new Date(maxDate)];
  14254. const cxpcRange = { dateRange, maxPrice, maxTraded };
  14255. charts.append(...await Promise.all([
  14256. renderExchange("NC1", ticker2, cxpcRange, cxpc[0]),
  14257. renderExchange("CI1", ticker2, cxpcRange, cxpc[1]),
  14258. renderExchange("IC1", ticker2, cxpcRange, cxpc[2]),
  14259. renderExchange("AI1", ticker2, cxpcRange, cxpc[3]),
  14260. renderRecipes(ticker2)
  14261. ]));
  14262. }
  14263. async function getCXPC(ticker2, cx) {
  14264. const cxpc = await cachedFetchJSON(`https://rest.fnar.net/exchange/cxpc/${ticker2}.${cx}`);
  14265. const threshold2 = Date.now() - 100 * 24 * 60 * 60 * 1000;
  14266. return cxpc.filter((p) => p.Interval === "HOUR_TWELVE" && p.DateEpochMs > threshold2);
  14267. }
  14268. async function renderExchange(cx, ticker2, cxpcRange, cxpc) {
  14269. const div = document.createElement("div");
  14270. div.append(renderPriceChart(cx, cxpcRange, cxpc));
  14271. div.append(renderOrderBook(await cachedFetchJSON(`https://rest.fnar.net/exchange/${ticker2}.${cx}`)));
  14272. return div;
  14273. }
  14274. function renderPriceChart(cx, { dateRange, maxPrice, maxTraded }, cxpc) {
  14275. const chartsWidth = charts.getBoundingClientRect().width;
  14276. const numFormat = formatNumber();
  14277. return plot({
  14278. grid: true,
  14279. width: chartsWidth < 600 ? chartsWidth : chartsWidth / 2 - 10,
  14280. height: 400,
  14281. marginLeft: 26 + 7 * Math.log10(maxPrice),
  14282. marginRight: 26 + 7 * Math.log10(maxTraded),
  14283. x: { domain: dateRange },
  14284. y: { axis: "left", label: cx, domain: [0, maxPrice * 1.1] },
  14285. marks: [
  14286. axisY(ticks(0, maxTraded * 1.5, 10), {
  14287. label: "traded",
  14288. anchor: "right",
  14289. y: (d) => d / maxTraded * maxPrice / 3
  14290. }),
  14291. rectY(cxpc, {
  14292. x: (p) => new Date(p.DateEpochMs),
  14293. y: (p) => p.Traded / maxTraded * maxPrice / 3,
  14294. interval: "day",
  14295. fill: "#272",
  14296. fillOpacity: 0.2
  14297. }),
  14298. ruleX(cxpc, {
  14299. x: (p) => new Date(p.DateEpochMs),
  14300. y1: "Low",
  14301. y2: "High",
  14302. strokeWidth: 5,
  14303. stroke: "#42a"
  14304. }),
  14305. dot(cxpc, {
  14306. x: (p) => new Date(p.DateEpochMs),
  14307. y: (p) => p.Volume / p.Traded,
  14308. fill: "#a37",
  14309. r: 2
  14310. }),
  14311. crosshairX(cxpc, {
  14312. x: (p) => new Date(p.DateEpochMs),
  14313. y: (p) => p.Volume / p.Traded,
  14314. textStroke: "#111"
  14315. }),
  14316. text(cxpc, pointerX({
  14317. px: (p) => new Date(p.DateEpochMs),
  14318. py: (p) => p.Volume / p.Traded,
  14319. dy: -20,
  14320. frameAnchor: "top-right",
  14321. fontVariant: "tabular-nums",
  14322. text: (p) => `${formatIsoDate(new Date(p.DateEpochMs))}
  14323. ` + `avg: $${numFormat(p.Volume / p.Traded)}
  14324. ` + `high: ${numFormat(p.High)}
  14325. ` + `low: ${numFormat(p.Low)}
  14326. ` + `traded: ${numFormat(p.Traded)}`
  14327. }))
  14328. ]
  14329. });
  14330. }
  14331. function renderOrderBook(book) {
  14332. const table = document.createElement("table");
  14333. book.SellingOrders.sort((a2, b) => b.ItemCost - a2.ItemCost);
  14334. for (const order of book.SellingOrders) {
  14335. if (book.MMSell !== null && order.ItemCost >= book.MMSell && order.ItemCount !== null)
  14336. continue;
  14337. const row = renderOrder(order);
  14338. row.classList.add("sell");
  14339. table.appendChild(row);
  14340. }
  14341. book.BuyingOrders.sort((a2, b) => b.ItemCost - a2.ItemCost);
  14342. for (const order of book.BuyingOrders) {
  14343. if (book.MMBuy !== null && order.ItemCost <= book.MMBuy && order.ItemCount !== null)
  14344. continue;
  14345. const row = renderOrder(order);
  14346. row.classList.add("buy");
  14347. table.appendChild(row);
  14348. }
  14349. const div = document.createElement("div");
  14350. div.classList.add("cxob");
  14351. div.appendChild(table);
  14352. const firstBuyRow = table.querySelector("tr.buy");
  14353. if (firstBuyRow !== null) {
  14354. const centerFirstBuyOrder = () => {
  14355. if (div.isConnected)
  14356. div.scrollTop = Math.max(0, firstBuyRow.offsetTop - div.clientHeight / 2 + 10);
  14357. else
  14358. requestAnimationFrame(centerFirstBuyOrder);
  14359. };
  14360. requestAnimationFrame(centerFirstBuyOrder);
  14361. }
  14362. return div;
  14363. }
  14364. function renderOrder(order) {
  14365. const row = document.createElement("tr");
  14366. row.insertCell().textContent = order.CompanyName;
  14367. row.insertCell().textContent = order.CompanyCode;
  14368. row.insertCell().textContent = order.ItemCount === null ? "∞" : order.ItemCount.toString();
  14369. row.insertCell().textContent = `${formatPrice(order.ItemCost)}`;
  14370. return row;
  14371. }
  14372. var formatPrice = new Intl.NumberFormat(undefined, { minimumSignificantDigits: 3, maximumSignificantDigits: 3 }).format;
  14373. async function renderRecipes(ticker2) {
  14374. const recipes = await cachedFetchJSON(`https://rest.fnar.net/recipes/${ticker2}`);
  14375. const section = document.createElement("section");
  14376. for (const recipe of recipes)
  14377. section.innerHTML += `<div class="recipe">
  14378. ${recipe.Inputs.map((i) => `${i.Amount}×${i.CommodityTicker}`).join(" ")}
  14379. <span class="building">${recipe.BuildingTicker}</span>
  14380. ${recipe.Outputs.map((o) => `${o.Amount}×${o.CommodityTicker}`).join(" ")}
  14381. </div>`;
  14382. return section;
  14383. }
  14384. //# debugId=F1B8D2638A78316864756E2164756E21