| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935 |
- var z3=Object.defineProperty;var k3=(u,e,t)=>e in u?z3(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t;var O3=(u,e)=>()=>(e||u((e={exports:{}}).exports,e),e.exports);var zi=(u,e,t)=>(k3(u,typeof e!="symbol"?e+"":e,t),t);var EH=O3(N_=>{function ES(u,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const c in r)if(c!=="default"&&!(c in u)){const p=Object.getOwnPropertyDescriptor(r,c);p&&Object.defineProperty(u,c,p.get?p:{enumerable:!0,get:()=>r[c]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const p of c)if(p.type==="childList")for(const y of p.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&r(y)}).observe(document,{childList:!0,subtree:!0});function t(c){const p={};return c.integrity&&(p.integrity=c.integrity),c.referrerpolicy&&(p.referrerPolicy=c.referrerpolicy),c.crossorigin==="use-credentials"?p.credentials="include":c.crossorigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function r(c){if(c.ep)return;c.ep=!0;const p=t(c);fetch(c.href,p)}})();if(typeof window<"u"){let u=function(){var e=document.body,t=document.getElementById("__svg__icons__dom__");t||(t=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.style.position="absolute",t.style.width="0",t.style.height="0",t.id="__svg__icons__dom__",t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("xmlns:link","http://www.w3.org/1999/xlink")),t.innerHTML='<symbol class="icon" viewBox="0 0 1024 1024" id="arrow_right"><path d="M320 885.333c-8.533 0-17.067-4.266-23.467-10.666-12.8-12.8-10.666-34.134 2.134-44.8L654.933 512 298.667 194.133c-12.8-10.666-14.934-32-2.134-44.8 10.667-12.8 32-14.933 44.8-2.133l384 341.333c6.4 6.4 10.667 14.934 10.667 23.467s-4.267 17.067-10.667 23.467l-384 341.333c-6.4 6.4-12.8 8.533-21.333 8.533z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="circle_radio"><path d="M512 42.667C252.288 42.667 42.667 252.288 42.667 512S252.288 981.333 512 981.333 981.333 771.712 981.333 512 771.712 42.667 512 42.667zm0 611.712A142.89 142.89 0 0 1 369.621 512 142.89 142.89 0 0 1 512 369.621 142.89 142.89 0 0 1 654.379 512 142.89 142.89 0 0 1 512 654.379z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="fly"><path d="M16.056 688A16.032 16.032 0 0 1 .728 667.408l33.6-112a16 16 0 0 1 30.656 9.184l-26.208 87.424 5.568-.928A83.872 83.872 0 0 0 87.8 629.824a84.544 84.544 0 0 0 24.736-41.632A16 16 0 0 1 128.056 576h94.4c55.52 0 110.944 5.488 164.752 16.32C438.952 602.72 492.264 608 545.656 608h350.4c25.648 0 49.76-9.984 67.888-28.112A95.424 95.424 0 0 0 992.056 512c0-52.944-43.056-96-96-96h-350.4c-53.392 0-106.72 5.28-158.448 15.68A836.992 836.992 0 0 1 222.456 448h-94.4a16 16 0 0 1-15.52-12.112 84.688 84.688 0 0 0-68.224-62.976l-5.552-.928L65 459.408a16 16 0 0 1-30.672 9.184l-33.6-112a16.016 16.016 0 0 1 17.952-20.368l30.88 5.12A116.624 116.624 0 0 1 139.832 416h82.624c53.392 0 106.72-5.28 158.448-15.68A836.992 836.992 0 0 1 545.656 384h350.4c70.576 0 128 57.424 128 128a127.2 127.2 0 0 1-37.488 90.512A127.2 127.2 0 0 1 896.056 640h-350.4c-55.52 0-110.944-5.488-164.752-16.32A805.264 805.264 0 0 0 222.456 608h-82.592a117.392 117.392 0 0 1-30.336 45.296 115.76 115.76 0 0 1-60.032 29.376l-30.816 5.12c-.88.128-1.76.208-2.624.208z" /><path d="M144.056 528h-128a16 16 0 1 1 0-32h128a16 16 0 1 1 0 32zm768 48a16 16 0 0 1-12.464-26.032c16.544-20.576 16.544-55.36 0-75.936a16 16 0 0 1 24.928-20.064c26.176 32.544 26.176 83.52 0 116.064A16 16 0 0 1 912.056 576zm-496 448a16 16 0 0 1-15.6-19.6l88.64-384.96a16 16 0 0 1 31.2 7.2l-83.12 360.848 27.264-5.408a47.984 47.984 0 0 0 32.096-23.12L694.52 616a16 16 0 0 1 27.712 16l-197.92 342.88a79.888 79.888 0 0 1-53.536 38.56l-51.6 10.24a15.088 15.088 0 0 1-3.12.32zm88.64-607.04a16 16 0 0 1-15.6-12.416l-88.64-384.96A16 16 0 0 1 419.176.32l51.52 10.24A79.952 79.952 0 0 1 524.36 49.2L722.232 392a16 16 0 0 1-27.712 16L496.6 65.12a48.048 48.048 0 0 0-32.208-23.2l-27.2-5.408 83.104 360.848a16 16 0 0 1-15.616 19.6z" /><path d="M704.056 288h-69.6a16 16 0 1 1 0-32h69.6v-64h-124.96a16 16 0 1 1 0-32h124.96c17.648 0 32 14.352 32 32v64c0 17.648-14.352 32-32 32zm0 576h-124.96a16 16 0 1 1 0-32h124.96v-64h-69.6a16 16 0 1 1 0-32h69.6c17.648 0 32 14.352 32 32v64c0 17.648-14.352 32-32 32zm-304-608c-20.832 0-31.744-13.088-38.976-21.76-6.448-7.744-8.992-10.24-14.384-10.24s-7.952 2.496-14.4 10.24c-7.232 8.672-18.144 21.76-38.96 21.76-20.816 0-31.728-13.088-38.944-21.76-6.8-8.176-9.2-10.24-14.336-10.24a16 16 0 1 1 0-32c20.816 0 31.728 13.088 38.944 21.76 6.8 8.176 9.2 10.24 14.336 10.24 5.392 0 7.936-2.496 14.384-10.24 7.232-8.672 18.144-21.76 38.976-21.76s31.744 13.088 38.976 21.76c6.448 7.744 8.992 10.24 14.384 10.24a16 16 0 1 1 0 32zm-53.36 576c-20.832 0-31.744-13.088-38.976-21.76-6.448-7.744-9.008-10.24-14.4-10.24-5.12 0-7.52 2.064-14.32 10.24-7.216 8.672-18.144 21.76-38.944 21.76a16 16 0 1 1 0-32c5.12 0 7.536-2.064 14.336-10.24 7.216-8.672 18.128-21.76 38.944-21.76 20.816 0 31.728 13.088 38.96 21.76 6.448 7.744 9.008 10.24 14.4 10.24s7.936-2.496 14.4-10.24c7.184-8.688 18.112-21.76 38.96-21.76a16 16 0 1 1 0 32c-5.392 0-7.936 2.496-14.4 10.24-7.2 8.672-18.128 21.76-38.96 21.76zm-42.64-656c-20.832 0-31.744-13.088-38.976-21.76-6.448-7.744-8.992-10.24-14.384-10.24s-7.952 2.496-14.4 10.24c-7.232 8.672-18.144 21.76-38.96 21.76-20.816 0-31.728-13.088-38.944-21.76-6.8-8.176-9.2-10.24-14.336-10.24a16 16 0 1 1 0-32c20.816 0 31.728 13.088 38.944 21.76 6.8 8.176 9.2 10.24 14.336 10.24 5.376 0 7.936-2.496 14.384-10.24 7.232-8.672 18.144-21.76 38.976-21.76s31.744 13.088 38.976 21.76c6.448 7.744 8.992 10.24 14.384 10.24a16 16 0 1 1 0 32zm-69.36 736c-20.832 0-31.744-13.088-38.976-21.76-6.448-7.744-9.008-10.24-14.4-10.24-5.12 0-7.52 2.064-14.32 10.24-7.216 8.672-18.144 21.76-38.944 21.76a16 16 0 1 1 0-32c5.12 0 7.536-2.064 14.336-10.24 7.216-8.672 18.128-21.76 38.944-21.76 20.816 0 31.728 13.088 38.96 21.76 6.448 7.744 9.008 10.24 14.4 10.24s7.936-2.496 14.4-10.24c7.184-8.688 18.112-21.76 38.96-21.76a16 16 0 1 1 0 32c-5.392 0-7.936 2.496-14.4 10.24-7.2 8.672-18.128 21.76-38.96 21.76zm549.36-336c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.8-5.92 22.72 0 2.88 3.04 4.64 7.04 4.64 11.36 0 4.32-1.76 8.32-4.64 11.36-3.04 2.88-7.04 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.8-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36s-1.76 8.32-4.64 11.36c-3.04 2.88-7.04 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.8-5.92 22.72 0 2.88 3.04 4.64 7.04 4.64 11.36 0 4.32-1.76 8.32-4.64 11.36-3.04 2.88-7.04 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.8-5.92 22.72 0 2.88 3.04 4.64 7.04 4.64 11.36 0 4.32-1.76 8.32-4.64 11.36-3.04 2.88-7.04 4.64-11.36 4.64zm192-96c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.64-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36s-1.76 8.32-4.64 11.36c-3.04 2.88-7.2 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.04-4.64-11.36 0-4.16 1.76-8.32 4.64-11.36 5.92-5.92 16.64-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36s-1.76 8.32-4.64 11.36c-3.04 2.88-7.2 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.64-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36 0 4.32-1.76 8.32-4.64 11.36-3.04 2.88-7.2 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.04-4.64-11.36 0-4.32 1.76-8.32 4.64-11.36 6.08-5.92 16.64-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36s-1.76 8.32-4.64 11.36c-3.04 2.88-7.2 4.64-11.36 4.64z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="operation"><path d="M548.907 472.17c-3.35-3.029-7.296-5.482-11.584-7.231l-140.118-87.36 88.598 139.37a39.668 39.668 0 0 0 7.296 11.478l1.109 1.792.32-.32a39.51 39.51 0 0 0 28.075 11.477c21.93-.064 39.594-17.941 39.488-39.83-.043-10.965-4.502-20.863-11.712-27.989l.256-.256-1.728-1.13z" /><path d="M521.088 196.8h-.17l-12.502.064.683 151.68h.106c.555 13.76 11.862 24.747 25.771 24.747 14.25 0 25.813-11.563 25.813-25.792 0-.534-.042-1.046-.085-1.579l1.173-95.488c129.088 17.984 217.344 117.141 217.899 251.285.661 147.136-110.144 256-257.301 256.619-147.158.661-254.656-109.483-255.296-256.619-.342-74.688 27.797-141.312 77.077-189.909l-.021-.021a18.725 18.725 0 0 0 2.24-2.091c6.976-7.723 3.84-20.267-4.118-27.456-7.232-6.528-24.277-5.93-31.402-.128l-.022-.043-.384.384a16.396 16.396 0 0 0-1.642 1.579c-.043.064-.086.128-.128.17-56.619 55.66-91.606 133.185-91.243 218.838.768 168.427 137.877 304.32 306.304 303.573 168.384-.789 304.299-137.877 303.552-306.282-.768-168.363-137.899-304.278-306.304-303.531z" /><path d="M511.979 11.115c-276.608 0-500.886 224.256-500.886 500.864 0 276.778 224.278 500.885 500.886 500.885 114.88 0 223.872-38.784 311.914-108.885 10.518-8.363 12.267-23.766 3.904-34.304-8.448-10.539-23.786-12.288-34.368-3.883-79.424 63.296-177.664 98.283-281.408 98.283-249.642 0-451.989-202.411-451.989-452.096 0-249.6 202.325-451.99 451.99-451.99 249.685 0 452.031 202.39 452.031 451.99 0 85.589-23.786 167.637-68.074 238.72-7.083 11.413-3.584 26.538 7.85 33.664 11.435 7.168 26.475 3.584 33.6-7.83 49.152-78.741 75.499-169.706 75.499-264.554-.021-276.608-224.256-500.864-500.95-500.864z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="right_bold"><path d="M761.056 532.128c.512-.992 1.344-1.824 1.792-2.848 8.8-18.304 5.92-40.704-9.664-55.424L399.936 139.744c-19.264-18.208-49.632-17.344-67.872 1.888-18.208 19.264-17.376 49.632 1.888 67.872l316.96 299.84L335.2 813.632c-19.072 18.4-19.648 48.768-1.248 67.872 9.408 9.792 21.984 14.688 34.56 14.688 12 0 24-4.48 33.312-13.44l350.048-337.376c.672-.672.928-1.6 1.6-2.304.512-.48 1.056-.832 1.568-1.344 2.72-2.848 4.16-6.336 6.016-9.6z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="weather"><path d="M554.752 256.427c135.168 0 211.883 89.472 223.019 197.546h3.413a157.312 157.312 0 0 1 157.525 157.142 157.312 157.312 0 0 1-157.525 157.098l-26.41-.042-66.134 111.957a32 32 0 0 1-57.344-28.075l1.92-3.925 47.701-79.957h-91.136l-66.218 111.957a32 32 0 0 1-57.344-28.075l1.962-3.925 47.702-79.957h-91.136l-66.219 111.957a32 32 0 0 1-57.344-28.075l1.92-3.925 47.701-79.957-22.528.042a157.312 157.312 0 0 1-157.525-157.098 157.312 157.312 0 0 1 157.525-157.142h3.414c11.221-108.8 87.893-197.546 223.061-197.546zm0 63.914c-88.405 0-165.419 69.675-165.419 165.931 0 15.232-13.61 27.221-29.184 27.221h-29.44c-53.845 0-97.45 42.71-97.45 95.403 0 52.693 43.605 95.445 97.408 95.445h448.128c53.802 0 97.408-42.752 97.408-95.445s-43.606-95.403-97.408-95.403h-29.44c-15.574 0-29.184-11.946-29.184-27.221 0-97.493-77.056-165.973-165.419-165.973zM186.325 433.75a32 32 0 0 1-13.397 39.851l-3.883 1.963-39.552 16.341a32 32 0 0 1-28.373-57.173l3.883-1.963 39.552-16.341a32 32 0 0 1 41.813 17.322zM463.104 227.5l-7.296 2.474a248.405 248.405 0 0 0-62.293 32.342 104.192 104.192 0 0 0-119.168 156.458 196.736 196.736 0 0 0-58.326 27.307 168.192 168.192 0 0 1 247.083-218.539zm-337.621 1.322 4.48 1.494 39.509 16.384a32 32 0 0 1-19.968 60.586l-4.523-1.45-39.509-16.384a32 32 0 0 1 20.01-60.587zM288.256 101.42l1.92 3.882 16.384 39.552a32 32 0 0 1-57.173 28.374l-1.963-3.883-16.384-39.552a32 32 0 0 1 57.173-28.373zM473.984 87.85a32 32 0 0 1 18.816 37.29l-1.493 4.48-16.342 39.552a32 32 0 0 1-60.629-20.01l1.493-4.48 16.342-39.552a32 32 0 0 1 41.813-17.28z" /></symbol>',e.insertBefore(t,e.lastChild)};var loadSvg=u;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",u):u()}class N3{constructor(e){zi(this,"_CompEventChain");zi(this,"_parentUnit");this._CompEventChain=e}get parentUnit(){return this._parentUnit}setParentUnit(e){return this._parentUnit=e,this}get CompEventChain(){return this._CompEventChain}addEvent(e){return this._CompEventChain.push(e),this}setCompEvent(e){return this._CompEventChain}remoteCompEvent(e){return this._CompEventChain}setCompEventChain(e){return this._CompEventChain=e,this._CompEventChain}clearCompEvent(){return this._CompEventChain=[],this._CompEventChain}}class Q3{constructor(e){zi(this,"_id");zi(this,"_position");zi(this,"_info");zi(this,"_eventchain",new N3([]).setParentUnit(this));return this._id=e,this}get id(){return this._id}setId(e){return this._id=e,this}get position(){return this._position}setPosition(e){return this._position=e,this}get info(){return this._info}setInfo(e){return this._info=e,this}get eventchain(){return this._eventchain}setEventchain(e){return this._eventchain=e.setParentUnit(this),this}addEvent(e){return this._eventchain.addEvent(e),this}async eventStart(){}}var Ou=(u=>(u.stop="stop",u.run="run",u.pause="pause",u))(Ou||{});class V3{constructor(){zi(this,"_FnQueue",[]);zi(this,"_index",0);zi(this,"_QueueStatus",Ou.stop)}get FnQueue(){return this._FnQueue}formatEventChain2Queue(e,t=()=>{}){let r=0,c=0;for(let p of e.ids)if(r+=p.eventchain.CompEventChain.length,p.eventchain.CompEventChain.length>0){let y=p.eventchain.parentUnit;for(let i of p.eventchain.CompEventChain){c+=1;let C={fn:i.Fn,args:Object.assign(y,{args:i.args}),prepare:i.prepareTime,delay:i.delayTime};this._FnQueue.push(C),t((c/r).toFixed(1))}}return this}async start(e,t=()=>{}){if(this._QueueStatus===Ou.stop?(this._index=-1,this._QueueStatus=Ou.run):this._QueueStatus===Ou.pause?this._QueueStatus=Ou.run:(this._index=-1,this._QueueStatus=Ou.run),this._FnQueue.length!==0)for(let r in this._FnQueue)if(this._QueueStatus===Ou.run){if(parseInt(r)>this._index){let c=this._FnQueue[r];this._index=parseInt(r),await this.runFun(c),this._index+1===this._FnQueue.length&&t(this._index)}}else break}async runPrepare(e){return new Promise(async(t,r)=>{await setTimeout(()=>{t()},e.prepare)})}async runFun(e){return await this.runPrepare(e),new Promise(async(t,r)=>{await e.fn(e.args),await setTimeout(()=>{t()},e.delay)})}stop(){this._QueueStatus=Ou.stop}pause(){this._QueueStatus=Ou.pause}}class J1{constructor(){zi(this,"_ids",[]);zi(this,"_queue");zi(this,"_loop");zi(this,"_loopIndex",0);zi(this,"_loopDone",()=>{});this._queue=new V3}setLoop(e,t=()=>{}){return this._loop=e,this._loopDone=t,this}destory(){this._ids=[],this._queue=null}get queue(){return this._queue}get ids(){return this._ids}start(){this.queue.start({},this.queneEndOnceLoop.bind(this))}stop(){this.queue.stop()}pause(){this.queue.pause()}queneEndOnceLoop(e){this._loopIndex+=1,this._loop===-1?this.start():this._loop>this._loopIndex?this.start():this._loopDone()}addUnit(e){return this._ids.push(e),this}removeUnit(e){let t=[];for(let r in this._ids){let c=this._ids[r];c.id!==e&&t.push(c)}return this._ids=t,this}clearUnit(){return this._ids=[],this}buildQueue(e){return this.queue.formatEventChain2Queue(this,e),this}}var TS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof{}<"u"?{}:typeof self<"u"?self:{},R_={},H3=u=>encodeURIComponent(u).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),SS="%[a-f0-9]{2}",DC=new RegExp("("+SS+")|([^%]+?)","gi"),PC=new RegExp("("+SS+")+","gi");function cb(u,e){try{return[decodeURIComponent(u.join(""))]}catch{}if(u.length===1)return u;e=e||1;var t=u.slice(0,e),r=u.slice(e);return Array.prototype.concat.call([],cb(t),cb(r))}function G3(u){try{return decodeURIComponent(u)}catch{for(var e=u.match(DC)||[],t=1;t<e.length;t++)u=cb(e,t).join(""),e=u.match(DC)||[];return u}}function W3(u){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=PC.exec(u);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var r=G3(t[0]);r!==t[0]&&(e[t[0]]=r)}t=PC.exec(u)}e["%C2"]="\uFFFD";for(var c=Object.keys(e),p=0;p<c.length;p++){var y=c[p];u=u.replace(new RegExp(y,"g"),e[y])}return u}var j3=function(u){if(typeof u!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof u+"`");try{return u=u.replace(/\+/g," "),decodeURIComponent(u)}catch{return W3(u)}},K3=(u,e)=>{if(!(typeof u=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[u];const t=u.indexOf(e);return t===-1?[u]:[u.slice(0,t),u.slice(t+e.length)]},$3=function(u,e){for(var t={},r=Object.keys(u),c=Array.isArray(e),p=0;p<r.length;p++){var y=r[p],i=u[y];(c?e.indexOf(y)!==-1:e(y,i,u))&&(t[y]=i)}return t};(function(u){const e=H3,t=j3,r=K3,c=$3,p=ae=>ae==null;function y(ae){switch(ae.arrayFormat){case"index":return le=>(Ae,we)=>{const me=Ae.length;return we===void 0||ae.skipNull&&we===null||ae.skipEmptyString&&we===""?Ae:we===null?[...Ae,[D(le,ae),"[",me,"]"].join("")]:[...Ae,[D(le,ae),"[",D(me,ae),"]=",D(we,ae)].join("")]};case"bracket":return le=>(Ae,we)=>we===void 0||ae.skipNull&&we===null||ae.skipEmptyString&&we===""?Ae:we===null?[...Ae,[D(le,ae),"[]"].join("")]:[...Ae,[D(le,ae),"[]=",D(we,ae)].join("")];case"comma":case"separator":return le=>(Ae,we)=>we==null||we.length===0?Ae:Ae.length===0?[[D(le,ae),"=",D(we,ae)].join("")]:[[Ae,D(we,ae)].join(ae.arrayFormatSeparator)];default:return le=>(Ae,we)=>we===void 0||ae.skipNull&&we===null||ae.skipEmptyString&&we===""?Ae:we===null?[...Ae,D(le,ae)]:[...Ae,[D(le,ae),"=",D(we,ae)].join("")]}}function i(ae){let le;switch(ae.arrayFormat){case"index":return(Ae,we,me)=>{if(le=/\[(\d*)\]$/.exec(Ae),Ae=Ae.replace(/\[\d*\]$/,""),!le){me[Ae]=we;return}me[Ae]===void 0&&(me[Ae]={}),me[Ae][le[1]]=we};case"bracket":return(Ae,we,me)=>{if(le=/(\[\])$/.exec(Ae),Ae=Ae.replace(/\[\]$/,""),!le){me[Ae]=we;return}if(me[Ae]===void 0){me[Ae]=[we];return}me[Ae]=[].concat(me[Ae],we)};case"comma":case"separator":return(Ae,we,me)=>{const Pe=typeof we=="string"&&we.includes(ae.arrayFormatSeparator),it=typeof we=="string"&&!Pe&&U(we,ae).includes(ae.arrayFormatSeparator);we=it?U(we,ae):we;const Me=Pe||it?we.split(ae.arrayFormatSeparator).map(Ke=>U(Ke,ae)):we===null?we:U(we,ae);me[Ae]=Me};default:return(Ae,we,me)=>{if(me[Ae]===void 0){me[Ae]=we;return}me[Ae]=[].concat(me[Ae],we)}}}function C(ae){if(typeof ae!="string"||ae.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function D(ae,le){return le.encode?le.strict?e(ae):encodeURIComponent(ae):ae}function U(ae,le){return le.decode?t(ae):ae}function N(ae){return Array.isArray(ae)?ae.sort():typeof ae=="object"?N(Object.keys(ae)).sort((le,Ae)=>Number(le)-Number(Ae)).map(le=>ae[le]):ae}function R(ae){const le=ae.indexOf("#");return le!==-1&&(ae=ae.slice(0,le)),ae}function G(ae){let le="";const Ae=ae.indexOf("#");return Ae!==-1&&(le=ae.slice(Ae)),le}function J(ae){ae=R(ae);const le=ae.indexOf("?");return le===-1?"":ae.slice(le+1)}function Y(ae,le){return le.parseNumbers&&!Number.isNaN(Number(ae))&&typeof ae=="string"&&ae.trim()!==""?ae=Number(ae):le.parseBooleans&&ae!==null&&(ae.toLowerCase()==="true"||ae.toLowerCase()==="false")&&(ae=ae.toLowerCase()==="true"),ae}function B(ae,le){le=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},le),C(le.arrayFormatSeparator);const Ae=i(le),we=Object.create(null);if(typeof ae!="string"||(ae=ae.trim().replace(/^[?#&]/,""),!ae))return we;for(const me of ae.split("&")){if(me==="")continue;let[Pe,it]=r(le.decode?me.replace(/\+/g," "):me,"=");it=it===void 0?null:["comma","separator"].includes(le.arrayFormat)?it:U(it,le),Ae(U(Pe,le),it,we)}for(const me of Object.keys(we)){const Pe=we[me];if(typeof Pe=="object"&&Pe!==null)for(const it of Object.keys(Pe))Pe[it]=Y(Pe[it],le);else we[me]=Y(Pe,le)}return le.sort===!1?we:(le.sort===!0?Object.keys(we).sort():Object.keys(we).sort(le.sort)).reduce((me,Pe)=>{const it=we[Pe];return Boolean(it)&&typeof it=="object"&&!Array.isArray(it)?me[Pe]=N(it):me[Pe]=it,me},Object.create(null))}u.extract=J,u.parse=B,u.stringify=(ae,le)=>{if(!ae)return"";le=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},le),C(le.arrayFormatSeparator);const Ae=it=>le.skipNull&&p(ae[it])||le.skipEmptyString&&ae[it]==="",we=y(le),me={};for(const it of Object.keys(ae))Ae(it)||(me[it]=ae[it]);const Pe=Object.keys(me);return le.sort!==!1&&Pe.sort(le.sort),Pe.map(it=>{const Me=ae[it];return Me===void 0?"":Me===null?D(it,le):Array.isArray(Me)?Me.reduce(we(it),[]).join("&"):D(it,le)+"="+D(Me,le)}).filter(it=>it.length>0).join("&")},u.parseUrl=(ae,le)=>{le=Object.assign({decode:!0},le);const[Ae,we]=r(ae,"#");return Object.assign({url:Ae.split("?")[0]||"",query:B(J(ae),le)},le&&le.parseFragmentIdentifier&&we?{fragmentIdentifier:U(we,le)}:{})},u.stringifyUrl=(ae,le)=>{le=Object.assign({encode:!0,strict:!0},le);const Ae=R(ae.url).split("?")[0]||"",we=u.extract(ae.url),me=u.parse(we,{sort:!1}),Pe=Object.assign(me,ae.query);let it=u.stringify(Pe,le);it&&(it=`?${it}`);let Me=G(ae.url);return ae.fragmentIdentifier&&(Me=`#${D(ae.fragmentIdentifier,le)}`),`${Ae}${it}${Me}`},u.pick=(ae,le,Ae)=>{Ae=Object.assign({parseFragmentIdentifier:!0},Ae);const{url:we,query:me,fragmentIdentifier:Pe}=u.parseUrl(ae,Ae);return u.stringifyUrl({url:we,query:c(me,le),fragmentIdentifier:Pe},Ae)},u.exclude=(ae,le,Ae)=>{const we=Array.isArray(le)?me=>!le.includes(me):(me,Pe)=>!le(me,Pe);return u.pick(ae,we,Ae)}})(R_);const Z3=ES({__proto__:null,default:R_},[R_]);/*!
- * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
- * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
- * Released under MIT License
- *//*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */var hb=function(u,e){return hb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])},hb(u,e)};function uu(u,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");hb(u,e);function t(){this.constructor=u}u.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ub=function(){return ub=Object.assign||function(e){for(var t,r=1,c=arguments.length;r<c;r++){t=arguments[r];for(var p in t)Object.prototype.hasOwnProperty.call(t,p)&&(e[p]=t[p])}return e},ub.apply(this,arguments)};function Ml(u,e,t,r){function c(p){return p instanceof t?p:new t(function(y){y(p)})}return new(t||(t=Promise))(function(p,y){function i(U){try{D(r.next(U))}catch(N){y(N)}}function C(U){try{D(r.throw(U))}catch(N){y(N)}}function D(U){U.done?p(U.value):c(U.value).then(i,C)}D((r=r.apply(u,e||[])).next())})}function il(u,e){var t={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},r,c,p,y;return y={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function i(D){return function(U){return C([D,U])}}function C(D){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,c&&(p=D[0]&2?c.return:D[0]?c.throw||((p=c.return)&&p.call(c),0):c.next)&&!(p=p.call(c,D[1])).done)return p;switch(c=0,p&&(D=[D[0]&2,p.value]),D[0]){case 0:case 1:p=D;break;case 4:return t.label++,{value:D[1],done:!1};case 5:t.label++,c=D[1],D=[0];continue;case 7:D=t.ops.pop(),t.trys.pop();continue;default:if(p=t.trys,!(p=p.length>0&&p[p.length-1])&&(D[0]===6||D[0]===2)){t=0;continue}if(D[0]===3&&(!p||D[1]>p[0]&&D[1]<p[3])){t.label=D[1];break}if(D[0]===6&&t.label<p[1]){t.label=p[1],p=D;break}if(p&&t.label<p[2]){t.label=p[2],t.ops.push(D);break}p[2]&&t.ops.pop(),t.trys.pop();continue}D=e.call(u,t)}catch(U){D=[6,U],c=0}finally{r=p=0}if(D[0]&5)throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}}function M0(u,e,t){if(t||arguments.length===2)for(var r=0,c=e.length,p;r<c;r++)(p||!(r in e))&&(p||(p=Array.prototype.slice.call(e,0,r)),p[r]=e[r]);return u.concat(p||e)}var ZA=function(){function u(e,t,r,c){this.left=e,this.top=t,this.width=r,this.height=c}return u.prototype.add=function(e,t,r,c){return new u(this.left+e,this.top+t,this.width+r,this.height+c)},u.fromClientRect=function(e,t){return new u(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},u.fromDOMRectList=function(e,t){var r=Array.from(t).find(function(c){return c.width!==0});return r?new u(r.left+e.windowBounds.left,r.top+e.windowBounds.top,r.width,r.height):u.EMPTY},u.EMPTY=new u(0,0,0,0),u}(),Mv=function(u,e){return ZA.fromClientRect(u,e.getBoundingClientRect())},X3=function(u){var e=u.body,t=u.documentElement;if(!e||!t)throw new Error("Unable to get document size");var r=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),c=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new ZA(0,0,r,c)},Iv=function(u){for(var e=[],t=0,r=u.length;t<r;){var c=u.charCodeAt(t++);if(c>=55296&&c<=56319&&t<r){var p=u.charCodeAt(t++);(p&64512)===56320?e.push(((c&1023)<<10)+(p&1023)+65536):(e.push(c),t--)}else e.push(c)}return e},Bo=function(){for(var u=[],e=0;e<arguments.length;e++)u[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,u);var t=u.length;if(!t)return"";for(var r=[],c=-1,p="";++c<t;){var y=u[c];y<=65535?r.push(y):(y-=65536,r.push((y>>10)+55296,y%1024+56320)),(c+1===t||r.length>16384)&&(p+=String.fromCharCode.apply(String,r),r.length=0)}return p},UC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",q3=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var I0=0;I0<UC.length;I0++)q3[UC.charCodeAt(I0)]=I0;var RC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p_=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var F0=0;F0<RC.length;F0++)p_[RC.charCodeAt(F0)]=F0;var Y3=function(u){var e=u.length*.75,t=u.length,r,c=0,p,y,i,C;u[u.length-1]==="="&&(e--,u[u.length-2]==="="&&e--);var D=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),U=Array.isArray(D)?D:new Uint8Array(D);for(r=0;r<t;r+=4)p=p_[u.charCodeAt(r)],y=p_[u.charCodeAt(r+1)],i=p_[u.charCodeAt(r+2)],C=p_[u.charCodeAt(r+3)],U[c++]=p<<2|y>>4,U[c++]=(y&15)<<4|i>>2,U[c++]=(i&3)<<6|C&63;return D},J3=function(u){for(var e=u.length,t=[],r=0;r<e;r+=2)t.push(u[r+1]<<8|u[r]);return t},eL=function(u){for(var e=u.length,t=[],r=0;r<e;r+=4)t.push(u[r+3]<<24|u[r+2]<<16|u[r+1]<<8|u[r]);return t},hf=5,B2=6+5,ew=2,tL=B2-hf,MS=65536>>hf,iL=1<<hf,tw=iL-1,nL=1024>>hf,rL=MS+nL,sL=rL,oL=32,aL=sL+oL,lL=65536>>B2,cL=1<<tL,hL=cL-1,zC=function(u,e,t){return u.slice?u.slice(e,t):new Uint16Array(Array.prototype.slice.call(u,e,t))},uL=function(u,e,t){return u.slice?u.slice(e,t):new Uint32Array(Array.prototype.slice.call(u,e,t))},AL=function(u,e){var t=Y3(u),r=Array.isArray(t)?eL(t):new Uint32Array(t),c=Array.isArray(t)?J3(t):new Uint16Array(t),p=24,y=zC(c,p/2,r[4]/2),i=r[5]===2?zC(c,(p+r[4])/2):uL(r,Math.ceil((p+r[4])/4));return new dL(r[0],r[1],r[2],r[3],y,i)},dL=function(){function u(e,t,r,c,p,y){this.initialValue=e,this.errorValue=t,this.highStart=r,this.highValueIndex=c,this.index=p,this.data=y}return u.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>hf],t=(t<<ew)+(e&tw),this.data[t];if(e<=65535)return t=this.index[MS+(e-55296>>hf)],t=(t<<ew)+(e&tw),this.data[t];if(e<this.highStart)return t=aL-lL+(e>>B2),t=this.index[t],t+=e>>hf&hL,t=this.index[t],t=(t<<ew)+(e&tw),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},u}(),kC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pL=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var L0=0;L0<kC.length;L0++)pL[kC.charCodeAt(L0)]=L0;var fL="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",OC=50,mL=1,IS=2,FS=3,gL=4,_L=5,NC=7,LS=8,QC=9,Zd=10,Ab=11,VC=12,db=13,yL=14,f_=15,pb=16,D0=17,Yg=18,xL=19,HC=20,fb=21,Jg=22,iw=23,nm=24,Mc=25,m_=26,g_=27,rm=28,vL=29,qp=30,wL=31,P0=32,U0=33,mb=34,gb=35,_b=36,z_=37,yb=38,Vx=39,Hx=40,nw=41,DS=42,bL=43,BL=[9001,65288],PS="!",Kr="\xD7",R0="\xF7",xb=AL(fL),PA=[qp,_b],vb=[mL,IS,FS,_L],US=[Zd,LS],GC=[g_,m_],CL=vb.concat(US),WC=[yb,Vx,Hx,mb,gb],EL=[f_,db],TL=function(u,e){e===void 0&&(e="strict");var t=[],r=[],c=[];return u.forEach(function(p,y){var i=xb.get(p);if(i>OC?(c.push(!0),i-=OC):c.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(p)!==-1)return r.push(y),t.push(pb);if(i===gL||i===Ab){if(y===0)return r.push(y),t.push(qp);var C=t[y-1];return CL.indexOf(C)===-1?(r.push(r[y-1]),t.push(C)):(r.push(y),t.push(qp))}if(r.push(y),i===wL)return t.push(e==="strict"?fb:z_);if(i===DS||i===vL)return t.push(qp);if(i===bL)return p>=131072&&p<=196605||p>=196608&&p<=262141?t.push(z_):t.push(qp);t.push(i)}),[r,t,c]},rw=function(u,e,t,r){var c=r[t];if(Array.isArray(u)?u.indexOf(c)!==-1:u===c)for(var p=t;p<=r.length;){p++;var y=r[p];if(y===e)return!0;if(y!==Zd)break}if(c===Zd)for(var p=t;p>0;){p--;var i=r[p];if(Array.isArray(u)?u.indexOf(i)!==-1:u===i)for(var C=t;C<=r.length;){C++;var y=r[C];if(y===e)return!0;if(y!==Zd)break}if(i!==Zd)break}return!1},jC=function(u,e){for(var t=u;t>=0;){var r=e[t];if(r===Zd)t--;else return r}return 0},SL=function(u,e,t,r,c){if(t[r]===0)return Kr;var p=r-1;if(Array.isArray(c)&&c[p]===!0)return Kr;var y=p-1,i=p+1,C=e[p],D=y>=0?e[y]:0,U=e[i];if(C===IS&&U===FS)return Kr;if(vb.indexOf(C)!==-1)return PS;if(vb.indexOf(U)!==-1||US.indexOf(U)!==-1)return Kr;if(jC(p,e)===LS)return R0;if(xb.get(u[p])===Ab||(C===P0||C===U0)&&xb.get(u[i])===Ab||C===NC||U===NC||C===QC||[Zd,db,f_].indexOf(C)===-1&&U===QC||[D0,Yg,xL,nm,rm].indexOf(U)!==-1||jC(p,e)===Jg||rw(iw,Jg,p,e)||rw([D0,Yg],fb,p,e)||rw(VC,VC,p,e))return Kr;if(C===Zd)return R0;if(C===iw||U===iw)return Kr;if(U===pb||C===pb)return R0;if([db,f_,fb].indexOf(U)!==-1||C===yL||D===_b&&EL.indexOf(C)!==-1||C===rm&&U===_b||U===HC||PA.indexOf(U)!==-1&&C===Mc||PA.indexOf(C)!==-1&&U===Mc||C===g_&&[z_,P0,U0].indexOf(U)!==-1||[z_,P0,U0].indexOf(C)!==-1&&U===m_||PA.indexOf(C)!==-1&&GC.indexOf(U)!==-1||GC.indexOf(C)!==-1&&PA.indexOf(U)!==-1||[g_,m_].indexOf(C)!==-1&&(U===Mc||[Jg,f_].indexOf(U)!==-1&&e[i+1]===Mc)||[Jg,f_].indexOf(C)!==-1&&U===Mc||C===Mc&&[Mc,rm,nm].indexOf(U)!==-1)return Kr;if([Mc,rm,nm,D0,Yg].indexOf(U)!==-1)for(var N=p;N>=0;){var R=e[N];if(R===Mc)return Kr;if([rm,nm].indexOf(R)!==-1)N--;else break}if([g_,m_].indexOf(U)!==-1)for(var N=[D0,Yg].indexOf(C)!==-1?y:p;N>=0;){var R=e[N];if(R===Mc)return Kr;if([rm,nm].indexOf(R)!==-1)N--;else break}if(yb===C&&[yb,Vx,mb,gb].indexOf(U)!==-1||[Vx,mb].indexOf(C)!==-1&&[Vx,Hx].indexOf(U)!==-1||[Hx,gb].indexOf(C)!==-1&&U===Hx||WC.indexOf(C)!==-1&&[HC,m_].indexOf(U)!==-1||WC.indexOf(U)!==-1&&C===g_||PA.indexOf(C)!==-1&&PA.indexOf(U)!==-1||C===nm&&PA.indexOf(U)!==-1||PA.concat(Mc).indexOf(C)!==-1&&U===Jg&&BL.indexOf(u[i])===-1||PA.concat(Mc).indexOf(U)!==-1&&C===Yg)return Kr;if(C===nw&&U===nw){for(var G=t[p],J=1;G>0&&(G--,e[G]===nw);)J++;if(J%2!==0)return Kr}return C===P0&&U===U0?Kr:R0},ML=function(u,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=TL(u,e.lineBreak),r=t[0],c=t[1],p=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(c=c.map(function(i){return[Mc,qp,DS].indexOf(i)!==-1?z_:i}));var y=e.wordBreak==="keep-all"?p.map(function(i,C){return i&&u[C]>=19968&&u[C]<=40959}):void 0;return[r,c,y]},IL=function(){function u(e,t,r,c){this.codePoints=e,this.required=t===PS,this.start=r,this.end=c}return u.prototype.slice=function(){return Bo.apply(void 0,this.codePoints.slice(this.start,this.end))},u}(),FL=function(u,e){var t=Iv(u),r=ML(t,e),c=r[0],p=r[1],y=r[2],i=t.length,C=0,D=0;return{next:function(){if(D>=i)return{done:!0,value:null};for(var U=Kr;D<i&&(U=SL(t,p,c,++D,y))===Kr;);if(U!==Kr||D===i){var N=new IL(t,U,C,D);return C=D,{value:N,done:!1}}return{done:!0,value:null}}}},LL=1<<0,DL=1<<1,ly=1<<2,KC=1<<3,tv=10,$C=47,B_=92,PL=9,UL=32,z0=34,e_=61,RL=35,zL=36,kL=37,k0=39,O0=40,t_=41,OL=95,nc=45,NL=33,QL=60,VL=62,HL=64,GL=91,WL=93,jL=61,KL=123,N0=63,$L=125,ZC=124,ZL=126,XL=128,XC=65533,sw=42,sf=43,qL=44,YL=58,JL=59,k_=46,eD=0,tD=8,iD=11,nD=14,rD=31,sD=127,Ru=-1,RS=48,zS=97,kS=101,oD=102,aD=117,lD=122,OS=65,NS=69,QS=70,cD=85,hD=90,nl=function(u){return u>=RS&&u<=57},uD=function(u){return u>=55296&&u<=57343},sm=function(u){return nl(u)||u>=OS&&u<=QS||u>=zS&&u<=oD},AD=function(u){return u>=zS&&u<=lD},dD=function(u){return u>=OS&&u<=hD},pD=function(u){return AD(u)||dD(u)},fD=function(u){return u>=XL},Q0=function(u){return u===tv||u===PL||u===UL},iv=function(u){return pD(u)||fD(u)||u===OL},qC=function(u){return iv(u)||nl(u)||u===nc},mD=function(u){return u>=eD&&u<=tD||u===iD||u>=nD&&u<=rD||u===sD},Kd=function(u,e){return u!==B_?!1:e!==tv},V0=function(u,e,t){return u===nc?iv(e)||Kd(e,t):iv(u)?!0:!!(u===B_&&Kd(u,e))},ow=function(u,e,t){return u===sf||u===nc?nl(e)?!0:e===k_&&nl(t):nl(u===k_?e:u)},gD=function(u){var e=0,t=1;(u[e]===sf||u[e]===nc)&&(u[e]===nc&&(t=-1),e++);for(var r=[];nl(u[e]);)r.push(u[e++]);var c=r.length?parseInt(Bo.apply(void 0,r),10):0;u[e]===k_&&e++;for(var p=[];nl(u[e]);)p.push(u[e++]);var y=p.length,i=y?parseInt(Bo.apply(void 0,p),10):0;(u[e]===NS||u[e]===kS)&&e++;var C=1;(u[e]===sf||u[e]===nc)&&(u[e]===nc&&(C=-1),e++);for(var D=[];nl(u[e]);)D.push(u[e++]);var U=D.length?parseInt(Bo.apply(void 0,D),10):0;return t*(c+i*Math.pow(10,-y))*Math.pow(10,C*U)},_D={type:2},yD={type:3},xD={type:4},vD={type:13},wD={type:8},bD={type:21},BD={type:9},CD={type:10},ED={type:11},TD={type:12},SD={type:14},H0={type:23},MD={type:1},ID={type:25},FD={type:24},LD={type:26},DD={type:27},PD={type:28},UD={type:29},RD={type:31},wb={type:32},VS=function(){function u(){this._value=[]}return u.prototype.write=function(e){this._value=this._value.concat(Iv(e))},u.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==wb;)e.push(t),t=this.consumeToken();return e},u.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case z0:return this.consumeStringToken(z0);case RL:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),c=this.peekCodePoint(2);if(qC(t)||Kd(r,c)){var p=V0(t,r,c)?DL:LL,y=this.consumeName();return{type:5,value:y,flags:p}}break;case zL:if(this.peekCodePoint(0)===e_)return this.consumeCodePoint(),vD;break;case k0:return this.consumeStringToken(k0);case O0:return _D;case t_:return yD;case sw:if(this.peekCodePoint(0)===e_)return this.consumeCodePoint(),SD;break;case sf:if(ow(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qL:return xD;case nc:var i=e,C=this.peekCodePoint(0),D=this.peekCodePoint(1);if(ow(i,C,D))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(V0(i,C,D))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(C===nc&&D===VL)return this.consumeCodePoint(),this.consumeCodePoint(),FD;break;case k_:if(ow(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case $C:if(this.peekCodePoint(0)===sw)for(this.consumeCodePoint();;){var U=this.consumeCodePoint();if(U===sw&&(U=this.consumeCodePoint(),U===$C))return this.consumeToken();if(U===Ru)return this.consumeToken()}break;case YL:return LD;case JL:return DD;case QL:if(this.peekCodePoint(0)===NL&&this.peekCodePoint(1)===nc&&this.peekCodePoint(2)===nc)return this.consumeCodePoint(),this.consumeCodePoint(),ID;break;case HL:var N=this.peekCodePoint(0),R=this.peekCodePoint(1),G=this.peekCodePoint(2);if(V0(N,R,G)){var y=this.consumeName();return{type:7,value:y}}break;case GL:return PD;case B_:if(Kd(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case WL:return UD;case jL:if(this.peekCodePoint(0)===e_)return this.consumeCodePoint(),wD;break;case KL:return ED;case $L:return TD;case aD:case cD:var J=this.peekCodePoint(0),Y=this.peekCodePoint(1);return J===sf&&(sm(Y)||Y===N0)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case ZC:if(this.peekCodePoint(0)===e_)return this.consumeCodePoint(),BD;if(this.peekCodePoint(0)===ZC)return this.consumeCodePoint(),bD;break;case ZL:if(this.peekCodePoint(0)===e_)return this.consumeCodePoint(),CD;break;case Ru:return wb}return Q0(e)?(this.consumeWhiteSpace(),RD):nl(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):iv(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Bo(e)}},u.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},u.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},u.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},u.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();sm(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===N0&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var c=parseInt(Bo.apply(void 0,e.map(function(C){return C===N0?RS:C})),16),p=parseInt(Bo.apply(void 0,e.map(function(C){return C===N0?QS:C})),16);return{type:30,start:c,end:p}}var y=parseInt(Bo.apply(void 0,e),16);if(this.peekCodePoint(0)===nc&&sm(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var i=[];sm(t)&&i.length<6;)i.push(t),t=this.consumeCodePoint();var p=parseInt(Bo.apply(void 0,i),16);return{type:30,start:y,end:p}}else return{type:30,start:y,end:y}},u.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===O0?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===O0?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},u.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ru)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===k0||t===z0){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ru||this.peekCodePoint(0)===t_)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),H0)}for(;;){var c=this.consumeCodePoint();if(c===Ru||c===t_)return{type:22,value:Bo.apply(void 0,e)};if(Q0(c))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Ru||this.peekCodePoint(0)===t_?(this.consumeCodePoint(),{type:22,value:Bo.apply(void 0,e)}):(this.consumeBadUrlRemnants(),H0);if(c===z0||c===k0||c===O0||mD(c))return this.consumeBadUrlRemnants(),H0;if(c===B_)if(Kd(c,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),H0;else e.push(c)}},u.prototype.consumeWhiteSpace=function(){for(;Q0(this.peekCodePoint(0));)this.consumeCodePoint()},u.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===t_||e===Ru)return;Kd(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},u.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var c=Math.min(t,e);r+=Bo.apply(void 0,this._value.splice(0,c)),e-=c}return this._value.shift(),r},u.prototype.consumeStringToken=function(e){var t="",r=0;do{var c=this._value[r];if(c===Ru||c===void 0||c===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(c===tv)return this._value.splice(0,r),MD;if(c===B_){var p=this._value[r+1];p!==Ru&&p!==void 0&&(p===tv?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Kd(c,p)&&(t+=this.consumeStringSlice(r),t+=Bo(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},u.prototype.consumeNumber=function(){var e=[],t=ly,r=this.peekCodePoint(0);for((r===sf||r===nc)&&e.push(this.consumeCodePoint());nl(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var c=this.peekCodePoint(1);if(r===k_&&nl(c))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=KC;nl(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),c=this.peekCodePoint(1);var p=this.peekCodePoint(2);if((r===NS||r===kS)&&((c===sf||c===nc)&&nl(p)||nl(c)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=KC;nl(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[gD(e),t]},u.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],c=this.peekCodePoint(0),p=this.peekCodePoint(1),y=this.peekCodePoint(2);if(V0(c,p,y)){var i=this.consumeName();return{type:15,number:t,flags:r,unit:i}}return c===kL?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},u.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(sm(e)){for(var t=Bo(e);sm(this.peekCodePoint(0))&&t.length<6;)t+=Bo(this.consumeCodePoint());Q0(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||uD(r)||r>1114111?XC:r}return e===Ru?XC:e},u.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(qC(t))e+=Bo(t);else if(Kd(t,this.peekCodePoint(0)))e+=Bo(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},u}(),HS=function(){function u(e){this._tokens=e}return u.create=function(e){var t=new VS;return t.write(e),new u(t.read())},u.parseValue=function(e){return u.create(e).parseComponentValue()},u.parseValues=function(e){return u.create(e).parseComponentValues()},u.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},u.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},u.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},u.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||kD(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},u.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},u.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?wb:e},u.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},u}(),cy=function(u){return u.type===15},Xm=function(u){return u.type===17},Ms=function(u){return u.type===20},zD=function(u){return u.type===0},bb=function(u,e){return Ms(u)&&u.value===e},GS=function(u){return u.type!==31},Hm=function(u){return u.type!==31&&u.type!==4},$u=function(u){var e=[],t=[];return u.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},kD=function(u,e){return e===11&&u.type===12||e===28&&u.type===29?!0:e===2&&u.type===3},sp=function(u){return u.type===17||u.type===15},zo=function(u){return u.type===16||sp(u)},WS=function(u){return u.length>1?[u[0],u[1]]:[u[0]]},ka={type:17,number:0,flags:ly},C2={type:16,number:50,flags:ly},Xd={type:16,number:100,flags:ly},__=function(u,e,t){var r=u[0],c=u[1];return[Gs(r,e),Gs(typeof c<"u"?c:r,t)]},Gs=function(u,e){if(u.type===16)return u.number/100*e;if(cy(u))switch(u.unit){case"rem":case"em":return 16*u.number;case"px":default:return u.number}return u.number},jS="deg",KS="grad",$S="rad",ZS="turn",Fv={name:"angle",parse:function(u,e){if(e.type===15)switch(e.unit){case jS:return Math.PI*e.number/180;case KS:return Math.PI/200*e.number;case $S:return e.number;case ZS:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},XS=function(u){return u.type===15&&(u.unit===jS||u.unit===KS||u.unit===$S||u.unit===ZS)},qS=function(u){var e=u.filter(Ms).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ka,ka];case"to top":case"bottom":return bh(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ka,Xd];case"to right":case"left":return bh(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Xd,Xd];case"to bottom":case"top":return bh(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Xd,ka];case"to left":case"right":return bh(270)}return 0},bh=function(u){return Math.PI*u/180},ep={name:"color",parse:function(u,e){if(e.type===18){var t=OD[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(u,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),c=e.value.substring(1,2),p=e.value.substring(2,3);return qd(parseInt(r+r,16),parseInt(c+c,16),parseInt(p+p,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),c=e.value.substring(1,2),p=e.value.substring(2,3),y=e.value.substring(3,4);return qd(parseInt(r+r,16),parseInt(c+c,16),parseInt(p+p,16),parseInt(y+y,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),c=e.value.substring(2,4),p=e.value.substring(4,6);return qd(parseInt(r,16),parseInt(c,16),parseInt(p,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),c=e.value.substring(2,4),p=e.value.substring(4,6),y=e.value.substring(6,8);return qd(parseInt(r,16),parseInt(c,16),parseInt(p,16),parseInt(y,16)/255)}}if(e.type===20){var i=jA[e.value.toUpperCase()];if(typeof i<"u")return i}return jA.TRANSPARENT}},tp=function(u){return(255&u)===0},ga=function(u){var e=255&u,t=255&u>>8,r=255&u>>16,c=255&u>>24;return e<255?"rgba("+c+","+r+","+t+","+e/255+")":"rgb("+c+","+r+","+t+")"},qd=function(u,e,t,r){return(u<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},YC=function(u,e){if(u.type===17)return u.number;if(u.type===16){var t=e===3?1:255;return e===3?u.number/100*t:Math.round(u.number/100*t)}return 0},JC=function(u,e){var t=e.filter(Hm);if(t.length===3){var r=t.map(YC),c=r[0],p=r[1],y=r[2];return qd(c,p,y,1)}if(t.length===4){var i=t.map(YC),c=i[0],p=i[1],y=i[2],C=i[3];return qd(c,p,y,C)}return 0};function aw(u,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-u)*t*6+u:t<1/2?e:t<2/3?(e-u)*6*(2/3-t)+u:u}var eE=function(u,e){var t=e.filter(Hm),r=t[0],c=t[1],p=t[2],y=t[3],i=(r.type===17?bh(r.number):Fv.parse(u,r))/(Math.PI*2),C=zo(c)?c.number/100:0,D=zo(p)?p.number/100:0,U=typeof y<"u"&&zo(y)?Gs(y,1):1;if(C===0)return qd(D*255,D*255,D*255,1);var N=D<=.5?D*(C+1):D+C-D*C,R=D*2-N,G=aw(R,N,i+1/3),J=aw(R,N,i),Y=aw(R,N,i-1/3);return qd(G*255,J*255,Y*255,U)},OD={hsl:eE,hsla:eE,rgb:JC,rgba:JC},C_=function(u,e){return ep.parse(u,HS.create(e).parseComponentValue())},jA={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},ND={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(u,e){return e.map(function(t){if(Ms(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},QD={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Lv=function(u,e){var t=ep.parse(u,e[0]),r=e[1];return r&&zo(r)?{color:t,stop:r}:{color:t,stop:null}},tE=function(u,e){var t=u[0],r=u[u.length-1];t.stop===null&&(t.stop=ka),r.stop===null&&(r.stop=Xd);for(var c=[],p=0,y=0;y<u.length;y++){var i=u[y].stop;if(i!==null){var C=Gs(i,e);C>p?c.push(C):c.push(p),p=C}else c.push(null)}for(var D=null,y=0;y<c.length;y++){var U=c[y];if(U===null)D===null&&(D=y);else if(D!==null){for(var N=y-D,R=c[D-1],G=(U-R)/(N+1),J=1;J<=N;J++)c[D+J-1]=G*J;D=null}}return u.map(function(Y,B){var ae=Y.color;return{color:ae,stop:Math.max(Math.min(1,c[B]/e),0)}})},VD=function(u,e,t){var r=e/2,c=t/2,p=Gs(u[0],e)-r,y=c-Gs(u[1],t);return(Math.atan2(y,p)+Math.PI*2)%(Math.PI*2)},HD=function(u,e,t){var r=typeof u=="number"?u:VD(u,e,t),c=Math.abs(e*Math.sin(r))+Math.abs(t*Math.cos(r)),p=e/2,y=t/2,i=c/2,C=Math.sin(r-Math.PI/2)*i,D=Math.cos(r-Math.PI/2)*i;return[c,p-D,p+D,y-C,y+C]},lu=function(u,e){return Math.sqrt(u*u+e*e)},iE=function(u,e,t,r,c){var p=[[0,0],[0,e],[u,0],[u,e]];return p.reduce(function(y,i){var C=i[0],D=i[1],U=lu(t-C,r-D);return(c?U<y.optimumDistance:U>y.optimumDistance)?{optimumCorner:i,optimumDistance:U}:y},{optimumDistance:c?1/0:-1/0,optimumCorner:null}).optimumCorner},GD=function(u,e,t,r,c){var p=0,y=0;switch(u.size){case 0:u.shape===0?p=y=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-c)):u.shape===1&&(p=Math.min(Math.abs(e),Math.abs(e-r)),y=Math.min(Math.abs(t),Math.abs(t-c)));break;case 2:if(u.shape===0)p=y=Math.min(lu(e,t),lu(e,t-c),lu(e-r,t),lu(e-r,t-c));else if(u.shape===1){var i=Math.min(Math.abs(t),Math.abs(t-c))/Math.min(Math.abs(e),Math.abs(e-r)),C=iE(r,c,e,t,!0),D=C[0],U=C[1];p=lu(D-e,(U-t)/i),y=i*p}break;case 1:u.shape===0?p=y=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-c)):u.shape===1&&(p=Math.max(Math.abs(e),Math.abs(e-r)),y=Math.max(Math.abs(t),Math.abs(t-c)));break;case 3:if(u.shape===0)p=y=Math.max(lu(e,t),lu(e,t-c),lu(e-r,t),lu(e-r,t-c));else if(u.shape===1){var i=Math.max(Math.abs(t),Math.abs(t-c))/Math.max(Math.abs(e),Math.abs(e-r)),N=iE(r,c,e,t,!1),D=N[0],U=N[1];p=lu(D-e,(U-t)/i),y=i*p}break}return Array.isArray(u.size)&&(p=Gs(u.size[0],r),y=u.size.length===2?Gs(u.size[1],c):p),[p,y]},WD=function(u,e){var t=bh(180),r=[];return $u(e).forEach(function(c,p){if(p===0){var y=c[0];if(y.type===20&&y.value==="to"){t=qS(c);return}else if(XS(y)){t=Fv.parse(u,y);return}}var i=Lv(u,c);r.push(i)}),{angle:t,stops:r,type:1}},G0=function(u,e){var t=bh(180),r=[];return $u(e).forEach(function(c,p){if(p===0){var y=c[0];if(y.type===20&&["top","left","right","bottom"].indexOf(y.value)!==-1){t=qS(c);return}else if(XS(y)){t=(Fv.parse(u,y)+bh(270))%bh(360);return}}var i=Lv(u,c);r.push(i)}),{angle:t,stops:r,type:1}},jD=function(u,e){var t=bh(180),r=[],c=1,p=0,y=3,i=[];return $u(e).forEach(function(C,D){var U=C[0];if(D===0){if(Ms(U)&&U.value==="linear"){c=1;return}else if(Ms(U)&&U.value==="radial"){c=2;return}}if(U.type===18){if(U.name==="from"){var N=ep.parse(u,U.values[0]);r.push({stop:ka,color:N})}else if(U.name==="to"){var N=ep.parse(u,U.values[0]);r.push({stop:Xd,color:N})}else if(U.name==="color-stop"){var R=U.values.filter(Hm);if(R.length===2){var N=ep.parse(u,R[1]),G=R[0];Xm(G)&&r.push({stop:{type:16,number:G.number*100,flags:G.flags},color:N})}}}}),c===1?{angle:(t+bh(180))%bh(360),stops:r,type:c}:{size:y,shape:p,stops:r,position:i,type:c}},YS="closest-side",JS="farthest-side",eM="closest-corner",tM="farthest-corner",iM="circle",nM="ellipse",rM="cover",sM="contain",KD=function(u,e){var t=0,r=3,c=[],p=[];return $u(e).forEach(function(y,i){var C=!0;if(i===0){var D=!1;C=y.reduce(function(N,R){if(D)if(Ms(R))switch(R.value){case"center":return p.push(C2),N;case"top":case"left":return p.push(ka),N;case"right":case"bottom":return p.push(Xd),N}else(zo(R)||sp(R))&&p.push(R);else if(Ms(R))switch(R.value){case iM:return t=0,!1;case nM:return t=1,!1;case"at":return D=!0,!1;case YS:return r=0,!1;case rM:case JS:return r=1,!1;case sM:case eM:return r=2,!1;case tM:return r=3,!1}else if(sp(R)||zo(R))return Array.isArray(r)||(r=[]),r.push(R),!1;return N},C)}if(C){var U=Lv(u,y);c.push(U)}}),{size:r,shape:t,stops:c,position:p,type:2}},W0=function(u,e){var t=0,r=3,c=[],p=[];return $u(e).forEach(function(y,i){var C=!0;if(i===0?C=y.reduce(function(U,N){if(Ms(N))switch(N.value){case"center":return p.push(C2),!1;case"top":case"left":return p.push(ka),!1;case"right":case"bottom":return p.push(Xd),!1}else if(zo(N)||sp(N))return p.push(N),!1;return U},C):i===1&&(C=y.reduce(function(U,N){if(Ms(N))switch(N.value){case iM:return t=0,!1;case nM:return t=1,!1;case sM:case YS:return r=0,!1;case JS:return r=1,!1;case eM:return r=2,!1;case rM:case tM:return r=3,!1}else if(sp(N)||zo(N))return Array.isArray(r)||(r=[]),r.push(N),!1;return U},C)),C){var D=Lv(u,y);c.push(D)}}),{size:r,shape:t,stops:c,position:p,type:2}},$D=function(u){return u.type===1},ZD=function(u){return u.type===2},E2={name:"image",parse:function(u,e){if(e.type===22){var t={url:e.value,type:0};return u.cache.addImage(e.value),t}if(e.type===18){var r=oM[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(u,e.values)}throw new Error("Unsupported image type "+e.type)}};function XD(u){return!(u.type===20&&u.value==="none")&&(u.type!==18||!!oM[u.name])}var oM={"linear-gradient":WD,"-moz-linear-gradient":G0,"-ms-linear-gradient":G0,"-o-linear-gradient":G0,"-webkit-linear-gradient":G0,"radial-gradient":KD,"-moz-radial-gradient":W0,"-ms-radial-gradient":W0,"-o-radial-gradient":W0,"-webkit-radial-gradient":W0,"-webkit-gradient":jD},qD={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(u,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return Hm(r)&&XD(r)}).map(function(r){return E2.parse(u,r)})}},YD={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(u,e){return e.map(function(t){if(Ms(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},JD={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(u,e){return $u(e).map(function(t){return t.filter(zo)}).map(WS)}},eP={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(u,e){return $u(e).map(function(t){return t.filter(Ms).map(function(r){return r.value}).join(" ")}).map(tP)}},tP=function(u){switch(u){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},Om;(function(u){u.AUTO="auto",u.CONTAIN="contain",u.COVER="cover"})(Om||(Om={}));var iP={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(u,e){return $u(e).map(function(t){return t.filter(nP)})}},nP=function(u){return Ms(u)||zo(u)},Dv=function(u){return{name:"border-"+u+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},rP=Dv("top"),sP=Dv("right"),oP=Dv("bottom"),aP=Dv("left"),Pv=function(u){return{name:"border-radius-"+u,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return WS(t.filter(zo))}}},lP=Pv("top-left"),cP=Pv("top-right"),hP=Pv("bottom-right"),uP=Pv("bottom-left"),Uv=function(u){return{name:"border-"+u+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},AP=Uv("top"),dP=Uv("right"),pP=Uv("bottom"),fP=Uv("left"),Rv=function(u){return{name:"border-"+u+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return cy(t)?t.number:0}}},mP=Rv("top"),gP=Rv("right"),_P=Rv("bottom"),yP=Rv("left"),xP={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},vP={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(u,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},wP={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(u,e){return e.filter(Ms).reduce(function(t,r){return t|bP(r.value)},0)}},bP=function(u){switch(u){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},BP={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(u,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},CP={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(u,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},nv;(function(u){u.NORMAL="normal",u.STRICT="strict"})(nv||(nv={}));var EP={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(u,e){switch(e){case"strict":return nv.STRICT;case"normal":default:return nv.NORMAL}}},TP={name:"line-height",initialValue:"normal",prefix:!1,type:4},nE=function(u,e){return Ms(u)&&u.value==="normal"?1.2*e:u.type===17?e*u.number:zo(u)?Gs(u,e):e},SP={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(u,e){return e.type===20&&e.value==="none"?null:E2.parse(u,e)}},MP={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(u,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},Bb={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(u,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},zv=function(u){return{name:"margin-"+u,initialValue:"0",prefix:!1,type:4}},IP=zv("top"),FP=zv("right"),LP=zv("bottom"),DP=zv("left"),PP={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(u,e){return e.filter(Ms).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},UP={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(u,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},kv=function(u){return{name:"padding-"+u,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},RP=kv("top"),zP=kv("right"),kP=kv("bottom"),OP=kv("left"),NP={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(u,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},QP={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(u,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},VP={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(u,e){return e.length===1&&bb(e[0],"none")?[]:$u(e).map(function(t){for(var r={color:jA.TRANSPARENT,offsetX:ka,offsetY:ka,blur:ka},c=0,p=0;p<t.length;p++){var y=t[p];sp(y)?(c===0?r.offsetX=y:c===1?r.offsetY=y:r.blur=y,c++):r.color=ep.parse(u,y)}return r})}},HP={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(u,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},GP={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(u,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=KP[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},WP=function(u){var e=u.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},jP=function(u){var e=u.filter(function(C){return C.type===17}).map(function(C){return C.number}),t=e[0],r=e[1];e[2],e[3];var c=e[4],p=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var y=e[12],i=e[13];return e[14],e[15],e.length===16?[t,r,c,p,y,i]:null},KP={matrix:WP,matrix3d:jP},rE={type:16,number:50,flags:ly},$P=[rE,rE],ZP={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(u,e){var t=e.filter(zo);return t.length!==2?$P:[t[0],t[1]]}},XP={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(u,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},E_;(function(u){u.NORMAL="normal",u.BREAK_ALL="break-all",u.KEEP_ALL="keep-all"})(E_||(E_={}));var qP={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(u,e){switch(e){case"break-all":return E_.BREAK_ALL;case"keep-all":return E_.KEEP_ALL;case"normal":default:return E_.NORMAL}}},YP={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(u,e){if(e.type===20)return{auto:!0,order:0};if(Xm(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},aM={name:"time",parse:function(u,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},JP={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(u,e){return Xm(e)?e.number:1}},eU={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},tU={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(u,e){return e.filter(Ms).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},iU={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(u,e){var t=[],r=[];return e.forEach(function(c){switch(c.type){case 20:case 0:t.push(c.value);break;case 17:t.push(c.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(c){return c.indexOf(" ")===-1?c:"'"+c+"'"})}},nU={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},rU={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(u,e){if(Xm(e))return e.number;if(Ms(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},sU={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(u,e){return e.filter(Ms).map(function(t){return t.value})}},oU={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(u,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},ra=function(u,e){return(u&e)!==0},aU={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(u,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},lU={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(u,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var r=[],c=e.filter(GS),p=0;p<c.length;p++){var y=c[p],i=c[p+1];if(y.type===20){var C=i&&Xm(i)?i.number:1;r.push({counter:y.value,increment:C})}}return r}},cU={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(u,e){if(e.length===0)return[];for(var t=[],r=e.filter(GS),c=0;c<r.length;c++){var p=r[c],y=r[c+1];if(Ms(p)&&p.value!=="none"){var i=y&&Xm(y)?y.number:0;t.push({counter:p.value,reset:i})}}return t}},hU={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(u,e){return e.filter(cy).map(function(t){return aM.parse(u,t)})}},uU={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(u,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var r=[],c=e.filter(zD);if(c.length%2!==0)return null;for(var p=0;p<c.length;p+=2){var y=c[p].value,i=c[p+1].value;r.push({open:y,close:i})}return r}},sE=function(u,e,t){if(!u)return"";var r=u[Math.min(e,u.length-1)];return r?t?r.open:r.close:""},AU={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(u,e){return e.length===1&&bb(e[0],"none")?[]:$u(e).map(function(t){for(var r={color:255,offsetX:ka,offsetY:ka,blur:ka,spread:ka,inset:!1},c=0,p=0;p<t.length;p++){var y=t[p];bb(y,"inset")?r.inset=!0:sp(y)?(c===0?r.offsetX=y:c===1?r.offsetY=y:c===2?r.blur=y:r.spread=y,c++):r.color=ep.parse(u,y)}return r})}},dU={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(u,e){var t=[0,1,2],r=[];return e.filter(Ms).forEach(function(c){switch(c.value){case"stroke":r.push(1);break;case"fill":r.push(0);break;case"markers":r.push(2);break}}),t.forEach(function(c){r.indexOf(c)===-1&&r.push(c)}),r}},pU={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},fU={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(u,e){return cy(e)?e.number:0}},mU=function(){function u(e,t){var r,c;this.animationDuration=Nn(e,hU,t.animationDuration),this.backgroundClip=Nn(e,ND,t.backgroundClip),this.backgroundColor=Nn(e,QD,t.backgroundColor),this.backgroundImage=Nn(e,qD,t.backgroundImage),this.backgroundOrigin=Nn(e,YD,t.backgroundOrigin),this.backgroundPosition=Nn(e,JD,t.backgroundPosition),this.backgroundRepeat=Nn(e,eP,t.backgroundRepeat),this.backgroundSize=Nn(e,iP,t.backgroundSize),this.borderTopColor=Nn(e,rP,t.borderTopColor),this.borderRightColor=Nn(e,sP,t.borderRightColor),this.borderBottomColor=Nn(e,oP,t.borderBottomColor),this.borderLeftColor=Nn(e,aP,t.borderLeftColor),this.borderTopLeftRadius=Nn(e,lP,t.borderTopLeftRadius),this.borderTopRightRadius=Nn(e,cP,t.borderTopRightRadius),this.borderBottomRightRadius=Nn(e,hP,t.borderBottomRightRadius),this.borderBottomLeftRadius=Nn(e,uP,t.borderBottomLeftRadius),this.borderTopStyle=Nn(e,AP,t.borderTopStyle),this.borderRightStyle=Nn(e,dP,t.borderRightStyle),this.borderBottomStyle=Nn(e,pP,t.borderBottomStyle),this.borderLeftStyle=Nn(e,fP,t.borderLeftStyle),this.borderTopWidth=Nn(e,mP,t.borderTopWidth),this.borderRightWidth=Nn(e,gP,t.borderRightWidth),this.borderBottomWidth=Nn(e,_P,t.borderBottomWidth),this.borderLeftWidth=Nn(e,yP,t.borderLeftWidth),this.boxShadow=Nn(e,AU,t.boxShadow),this.color=Nn(e,xP,t.color),this.direction=Nn(e,vP,t.direction),this.display=Nn(e,wP,t.display),this.float=Nn(e,BP,t.cssFloat),this.fontFamily=Nn(e,iU,t.fontFamily),this.fontSize=Nn(e,nU,t.fontSize),this.fontStyle=Nn(e,oU,t.fontStyle),this.fontVariant=Nn(e,sU,t.fontVariant),this.fontWeight=Nn(e,rU,t.fontWeight),this.letterSpacing=Nn(e,CP,t.letterSpacing),this.lineBreak=Nn(e,EP,t.lineBreak),this.lineHeight=Nn(e,TP,t.lineHeight),this.listStyleImage=Nn(e,SP,t.listStyleImage),this.listStylePosition=Nn(e,MP,t.listStylePosition),this.listStyleType=Nn(e,Bb,t.listStyleType),this.marginTop=Nn(e,IP,t.marginTop),this.marginRight=Nn(e,FP,t.marginRight),this.marginBottom=Nn(e,LP,t.marginBottom),this.marginLeft=Nn(e,DP,t.marginLeft),this.opacity=Nn(e,JP,t.opacity);var p=Nn(e,PP,t.overflow);this.overflowX=p[0],this.overflowY=p[p.length>1?1:0],this.overflowWrap=Nn(e,UP,t.overflowWrap),this.paddingTop=Nn(e,RP,t.paddingTop),this.paddingRight=Nn(e,zP,t.paddingRight),this.paddingBottom=Nn(e,kP,t.paddingBottom),this.paddingLeft=Nn(e,OP,t.paddingLeft),this.paintOrder=Nn(e,dU,t.paintOrder),this.position=Nn(e,QP,t.position),this.textAlign=Nn(e,NP,t.textAlign),this.textDecorationColor=Nn(e,eU,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=Nn(e,tU,(c=t.textDecorationLine)!==null&&c!==void 0?c:t.textDecoration),this.textShadow=Nn(e,VP,t.textShadow),this.textTransform=Nn(e,HP,t.textTransform),this.transform=Nn(e,GP,t.transform),this.transformOrigin=Nn(e,ZP,t.transformOrigin),this.visibility=Nn(e,XP,t.visibility),this.webkitTextStrokeColor=Nn(e,pU,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Nn(e,fU,t.webkitTextStrokeWidth),this.wordBreak=Nn(e,qP,t.wordBreak),this.zIndex=Nn(e,YP,t.zIndex)}return u.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},u.prototype.isTransparent=function(){return tp(this.backgroundColor)},u.prototype.isTransformed=function(){return this.transform!==null},u.prototype.isPositioned=function(){return this.position!==0},u.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},u.prototype.isFloating=function(){return this.float!==0},u.prototype.isInlineLevel=function(){return ra(this.display,4)||ra(this.display,33554432)||ra(this.display,268435456)||ra(this.display,536870912)||ra(this.display,67108864)||ra(this.display,134217728)},u}(),gU=function(){function u(e,t){this.content=Nn(e,aU,t.content),this.quotes=Nn(e,uU,t.quotes)}return u}(),oE=function(){function u(e,t){this.counterIncrement=Nn(e,lU,t.counterIncrement),this.counterReset=Nn(e,cU,t.counterReset)}return u}(),Nn=function(u,e,t){var r=new VS,c=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(c);var p=new HS(r.read());switch(e.type){case 2:var y=p.parseComponentValue();return e.parse(u,Ms(y)?y.value:e.initialValue);case 0:return e.parse(u,p.parseComponentValue());case 1:return e.parse(u,p.parseComponentValues());case 4:return p.parseComponentValue();case 3:switch(e.format){case"angle":return Fv.parse(u,p.parseComponentValue());case"color":return ep.parse(u,p.parseComponentValue());case"image":return E2.parse(u,p.parseComponentValue());case"length":var i=p.parseComponentValue();return sp(i)?i:ka;case"length-percentage":var C=p.parseComponentValue();return zo(C)?C:ka;case"time":return aM.parse(u,p.parseComponentValue())}break}},_U="data-html2canvas-debug",yU=function(u){var e=u.getAttribute(_U);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Cb=function(u,e){var t=yU(u);return t===1||e===t},Zu=function(){function u(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Cb(t,3))debugger;this.styles=new mU(e,window.getComputedStyle(t,null)),Sb(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Mv(this.context,t),Cb(t,4)&&(this.flags|=16)}return u}(),xU="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",aE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y_=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var j0=0;j0<aE.length;j0++)y_[aE.charCodeAt(j0)]=j0;var vU=function(u){var e=u.length*.75,t=u.length,r,c=0,p,y,i,C;u[u.length-1]==="="&&(e--,u[u.length-2]==="="&&e--);var D=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),U=Array.isArray(D)?D:new Uint8Array(D);for(r=0;r<t;r+=4)p=y_[u.charCodeAt(r)],y=y_[u.charCodeAt(r+1)],i=y_[u.charCodeAt(r+2)],C=y_[u.charCodeAt(r+3)],U[c++]=p<<2|y>>4,U[c++]=(y&15)<<4|i>>2,U[c++]=(i&3)<<6|C&63;return D},wU=function(u){for(var e=u.length,t=[],r=0;r<e;r+=2)t.push(u[r+1]<<8|u[r]);return t},bU=function(u){for(var e=u.length,t=[],r=0;r<e;r+=4)t.push(u[r+3]<<24|u[r+2]<<16|u[r+1]<<8|u[r]);return t},uf=5,T2=6+5,lw=2,BU=T2-uf,lM=65536>>uf,CU=1<<uf,cw=CU-1,EU=1024>>uf,TU=lM+EU,SU=TU,MU=32,IU=SU+MU,FU=65536>>T2,LU=1<<BU,DU=LU-1,lE=function(u,e,t){return u.slice?u.slice(e,t):new Uint16Array(Array.prototype.slice.call(u,e,t))},PU=function(u,e,t){return u.slice?u.slice(e,t):new Uint32Array(Array.prototype.slice.call(u,e,t))},UU=function(u,e){var t=vU(u),r=Array.isArray(t)?bU(t):new Uint32Array(t),c=Array.isArray(t)?wU(t):new Uint16Array(t),p=24,y=lE(c,p/2,r[4]/2),i=r[5]===2?lE(c,(p+r[4])/2):PU(r,Math.ceil((p+r[4])/4));return new RU(r[0],r[1],r[2],r[3],y,i)},RU=function(){function u(e,t,r,c,p,y){this.initialValue=e,this.errorValue=t,this.highStart=r,this.highValueIndex=c,this.index=p,this.data=y}return u.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>uf],t=(t<<lw)+(e&cw),this.data[t];if(e<=65535)return t=this.index[lM+(e-55296>>uf)],t=(t<<lw)+(e&cw),this.data[t];if(e<this.highStart)return t=IU-FU+(e>>T2),t=this.index[t],t+=e>>uf&DU,t=this.index[t],t=(t<<lw)+(e&cw),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},u}(),cE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zU=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var K0=0;K0<cE.length;K0++)zU[cE.charCodeAt(K0)]=K0;var kU=1,hw=2,uw=3,hE=4,uE=5,OU=7,AE=8,Aw=9,dw=10,dE=11,pE=12,fE=13,mE=14,pw=15,NU=function(u){for(var e=[],t=0,r=u.length;t<r;){var c=u.charCodeAt(t++);if(c>=55296&&c<=56319&&t<r){var p=u.charCodeAt(t++);(p&64512)===56320?e.push(((c&1023)<<10)+(p&1023)+65536):(e.push(c),t--)}else e.push(c)}return e},QU=function(){for(var u=[],e=0;e<arguments.length;e++)u[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,u);var t=u.length;if(!t)return"";for(var r=[],c=-1,p="";++c<t;){var y=u[c];y<=65535?r.push(y):(y-=65536,r.push((y>>10)+55296,y%1024+56320)),(c+1===t||r.length>16384)&&(p+=String.fromCharCode.apply(String,r),r.length=0)}return p},VU=UU(xU),yh="\xD7",fw="\xF7",HU=function(u){return VU.get(u)},GU=function(u,e,t){var r=t-2,c=e[r],p=e[t-1],y=e[t];if(p===hw&&y===uw)return yh;if(p===hw||p===uw||p===hE||y===hw||y===uw||y===hE)return fw;if(p===AE&&[AE,Aw,dE,pE].indexOf(y)!==-1||(p===dE||p===Aw)&&(y===Aw||y===dw)||(p===pE||p===dw)&&y===dw||y===fE||y===uE||y===OU||p===kU)return yh;if(p===fE&&y===mE){for(;c===uE;)c=e[--r];if(c===mE)return yh}if(p===pw&&y===pw){for(var i=0;c===pw;)i++,c=e[--r];if(i%2===0)return yh}return fw},WU=function(u){var e=NU(u),t=e.length,r=0,c=0,p=e.map(HU);return{next:function(){if(r>=t)return{done:!0,value:null};for(var y=yh;r<t&&(y=GU(e,p,++r))===yh;);if(y!==yh||r===t){var i=QU.apply(null,e.slice(c,r));return c=r,{value:i,done:!1}}return{done:!0,value:null}}}},jU=function(u){for(var e=WU(u),t=[],r;!(r=e.next()).done;)r.value&&t.push(r.value.slice());return t},KU=function(u){var e=123;if(u.createRange){var t=u.createRange();if(t.getBoundingClientRect){var r=u.createElement("boundtest");r.style.height=e+"px",r.style.display="block",u.body.appendChild(r),t.selectNode(r);var c=t.getBoundingClientRect(),p=Math.round(c.height);if(u.body.removeChild(r),p===e)return!0}}return!1},$U=function(u){var e=u.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",u.body.appendChild(e);var t=u.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var r=e.firstChild,c=Iv(r.data).map(function(C){return Bo(C)}),p=0,y={},i=c.every(function(C,D){t.setStart(r,p),t.setEnd(r,p+C.length);var U=t.getBoundingClientRect();p+=C.length;var N=U.x>y.x||U.y>y.y;return y=U,D===0?!0:N});return u.body.removeChild(e),i},ZU=function(){return typeof new Image().crossOrigin<"u"},XU=function(){return typeof new XMLHttpRequest().responseType=="string"},qU=function(u){var e=new Image,t=u.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},gE=function(u){return u[0]===0&&u[1]===255&&u[2]===0&&u[3]===255},YU=function(u){var e=u.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var c=new Image,p=e.toDataURL();c.src=p;var y=Eb(t,t,0,0,c);return r.fillStyle="red",r.fillRect(0,0,t,t),_E(y).then(function(i){r.drawImage(i,0,0);var C=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var D=u.createElement("div");return D.style.backgroundImage="url("+p+")",D.style.height=t+"px",gE(C)?_E(Eb(t,t,0,0,D)):Promise.reject(!1)}).then(function(i){return r.drawImage(i,0,0),gE(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Eb=function(u,e,t,r,c){var p="http://www.w3.org/2000/svg",y=document.createElementNS(p,"svg"),i=document.createElementNS(p,"foreignObject");return y.setAttributeNS(null,"width",u.toString()),y.setAttributeNS(null,"height",e.toString()),i.setAttributeNS(null,"width","100%"),i.setAttributeNS(null,"height","100%"),i.setAttributeNS(null,"x",t.toString()),i.setAttributeNS(null,"y",r.toString()),i.setAttributeNS(null,"externalResourcesRequired","true"),y.appendChild(i),i.appendChild(c),y},_E=function(u){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(u))})},za={get SUPPORT_RANGE_BOUNDS(){var u=KU(document);return Object.defineProperty(za,"SUPPORT_RANGE_BOUNDS",{value:u}),u},get SUPPORT_WORD_BREAKING(){var u=za.SUPPORT_RANGE_BOUNDS&&$U(document);return Object.defineProperty(za,"SUPPORT_WORD_BREAKING",{value:u}),u},get SUPPORT_SVG_DRAWING(){var u=qU(document);return Object.defineProperty(za,"SUPPORT_SVG_DRAWING",{value:u}),u},get SUPPORT_FOREIGNOBJECT_DRAWING(){var u=typeof Array.from=="function"&&typeof window.fetch=="function"?YU(document):Promise.resolve(!1);return Object.defineProperty(za,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:u}),u},get SUPPORT_CORS_IMAGES(){var u=ZU();return Object.defineProperty(za,"SUPPORT_CORS_IMAGES",{value:u}),u},get SUPPORT_RESPONSE_TYPE(){var u=XU();return Object.defineProperty(za,"SUPPORT_RESPONSE_TYPE",{value:u}),u},get SUPPORT_CORS_XHR(){var u="withCredentials"in new XMLHttpRequest;return Object.defineProperty(za,"SUPPORT_CORS_XHR",{value:u}),u},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var u=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(za,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:u}),u}},T_=function(){function u(e,t){this.text=e,this.bounds=t}return u}(),JU=function(u,e,t,r){var c=i4(e,t),p=[],y=0;return c.forEach(function(i){if(t.textDecorationLine.length||i.trim().length>0)if(za.SUPPORT_RANGE_BOUNDS){var C=yE(r,y,i.length).getClientRects();if(C.length>1){var D=S2(i),U=0;D.forEach(function(R){p.push(new T_(R,ZA.fromDOMRectList(u,yE(r,U+y,R.length).getClientRects()))),U+=R.length})}else p.push(new T_(i,ZA.fromDOMRectList(u,C)))}else{var N=r.splitText(i.length);p.push(new T_(i,e4(u,r))),r=N}else za.SUPPORT_RANGE_BOUNDS||(r=r.splitText(i.length));y+=i.length}),p},e4=function(u,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var c=e.parentNode;if(c){c.replaceChild(r,e);var p=Mv(u,r);return r.firstChild&&c.replaceChild(r.firstChild,r),p}}return ZA.EMPTY},yE=function(u,e,t){var r=u.ownerDocument;if(!r)throw new Error("Node has no owner document");var c=r.createRange();return c.setStart(u,e),c.setEnd(u,e+t),c},S2=function(u){if(za.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(u)).map(function(t){return t.segment})}return jU(u)},t4=function(u,e){if(za.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(u)).map(function(r){return r.segment})}return r4(u,e)},i4=function(u,e){return e.letterSpacing!==0?S2(u):t4(u,e)},n4=[32,160,4961,65792,65793,4153,4241],r4=function(u,e){for(var t=FL(u,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],c,p=function(){if(c.value){var y=c.value.slice(),i=Iv(y),C="";i.forEach(function(D){n4.indexOf(D)===-1?C+=Bo(D):(C.length&&r.push(C),r.push(Bo(D)),C="")}),C.length&&r.push(C)}};!(c=t.next()).done;)p();return r},s4=function(){function u(e,t,r){this.text=o4(t.data,r.textTransform),this.textBounds=JU(e,this.text,r,t)}return u}(),o4=function(u,e){switch(e){case 1:return u.toLowerCase();case 3:return u.replace(a4,l4);case 2:return u.toUpperCase();default:return u}},a4=/(^|\s|:|-|\(|\))([a-z])/g,l4=function(u,e,t){return u.length>0?e+t.toUpperCase():u},cM=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.src=r.currentSrc||r.src,c.intrinsicWidth=r.naturalWidth,c.intrinsicHeight=r.naturalHeight,c.context.cache.addImage(c.src),c}return e}(Zu),hM=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.canvas=r,c.intrinsicWidth=r.width,c.intrinsicHeight=r.height,c}return e}(Zu),uM=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this,p=new XMLSerializer,y=Mv(t,r);return r.setAttribute("width",y.width+"px"),r.setAttribute("height",y.height+"px"),c.svg="data:image/svg+xml,"+encodeURIComponent(p.serializeToString(r)),c.intrinsicWidth=r.width.baseVal.value,c.intrinsicHeight=r.height.baseVal.value,c.context.cache.addImage(c.svg),c}return e}(Zu),AM=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.value=r.value,c}return e}(Zu),Tb=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.start=r.start,c.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,c}return e}(Zu),c4=[{type:15,flags:0,unit:"px",number:3}],h4=[{type:16,flags:0,number:50}],u4=function(u){return u.width>u.height?new ZA(u.left+(u.width-u.height)/2,u.top,u.height,u.height):u.width<u.height?new ZA(u.left,u.top+(u.height-u.width)/2,u.width,u.width):u},A4=function(u){var e=u.type===d4?new Array(u.value.length+1).join("\u2022"):u.value;return e.length===0?u.placeholder||"":e},rv="checkbox",sv="radio",d4="password",xE=707406591,M2=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;switch(c.type=r.type.toLowerCase(),c.checked=r.checked,c.value=A4(r),(c.type===rv||c.type===sv)&&(c.styles.backgroundColor=3739148031,c.styles.borderTopColor=c.styles.borderRightColor=c.styles.borderBottomColor=c.styles.borderLeftColor=2779096575,c.styles.borderTopWidth=c.styles.borderRightWidth=c.styles.borderBottomWidth=c.styles.borderLeftWidth=1,c.styles.borderTopStyle=c.styles.borderRightStyle=c.styles.borderBottomStyle=c.styles.borderLeftStyle=1,c.styles.backgroundClip=[0],c.styles.backgroundOrigin=[0],c.bounds=u4(c.bounds)),c.type){case rv:c.styles.borderTopRightRadius=c.styles.borderTopLeftRadius=c.styles.borderBottomRightRadius=c.styles.borderBottomLeftRadius=c4;break;case sv:c.styles.borderTopRightRadius=c.styles.borderTopLeftRadius=c.styles.borderBottomRightRadius=c.styles.borderBottomLeftRadius=h4;break}return c}return e}(Zu),dM=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this,p=r.options[r.selectedIndex||0];return c.value=p&&p.text||"",c}return e}(Zu),pM=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.value=r.value,c}return e}(Zu),fM=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;c.src=r.src,c.width=parseInt(r.width,10)||0,c.height=parseInt(r.height,10)||0,c.backgroundColor=c.styles.backgroundColor;try{if(r.contentWindow&&r.contentWindow.document&&r.contentWindow.document.documentElement){c.tree=gM(t,r.contentWindow.document.documentElement);var p=r.contentWindow.document.documentElement?C_(t,getComputedStyle(r.contentWindow.document.documentElement).backgroundColor):jA.TRANSPARENT,y=r.contentWindow.document.body?C_(t,getComputedStyle(r.contentWindow.document.body).backgroundColor):jA.TRANSPARENT;c.backgroundColor=tp(p)?tp(y)?c.styles.backgroundColor:y:p}}catch{}return c}return e}(Zu),p4=["OL","UL","MENU"],Gx=function(u,e,t,r){for(var c=e.firstChild,p=void 0;c;c=p)if(p=c.nextSibling,_M(c)&&c.data.trim().length>0)t.textNodes.push(new s4(u,c,t.styles));else if(Fm(c))if(wM(c)&&c.assignedNodes)c.assignedNodes().forEach(function(i){return Gx(u,i,t,r)});else{var y=mM(u,c);y.styles.isVisible()&&(f4(c,y,r)?y.flags|=4:m4(y.styles)&&(y.flags|=2),p4.indexOf(c.tagName)!==-1&&(y.flags|=8),t.elements.push(y),c.slot,c.shadowRoot?Gx(u,c.shadowRoot,y,r):!ov(c)&&!yM(c)&&!av(c)&&Gx(u,c,y,r))}},mM=function(u,e){return Mb(e)?new cM(u,e):xM(e)?new hM(u,e):yM(e)?new uM(u,e):g4(e)?new AM(u,e):_4(e)?new Tb(u,e):y4(e)?new M2(u,e):av(e)?new dM(u,e):ov(e)?new pM(u,e):vM(e)?new fM(u,e):new Zu(u,e)},gM=function(u,e){var t=mM(u,e);return t.flags|=4,Gx(u,e,t,t),t},f4=function(u,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||I2(u)&&t.styles.isTransparent()},m4=function(u){return u.isPositioned()||u.isFloating()},_M=function(u){return u.nodeType===Node.TEXT_NODE},Fm=function(u){return u.nodeType===Node.ELEMENT_NODE},Sb=function(u){return Fm(u)&&typeof u.style<"u"&&!Wx(u)},Wx=function(u){return typeof u.className=="object"},g4=function(u){return u.tagName==="LI"},_4=function(u){return u.tagName==="OL"},y4=function(u){return u.tagName==="INPUT"},x4=function(u){return u.tagName==="HTML"},yM=function(u){return u.tagName==="svg"},I2=function(u){return u.tagName==="BODY"},xM=function(u){return u.tagName==="CANVAS"},vE=function(u){return u.tagName==="VIDEO"},Mb=function(u){return u.tagName==="IMG"},vM=function(u){return u.tagName==="IFRAME"},wE=function(u){return u.tagName==="STYLE"},v4=function(u){return u.tagName==="SCRIPT"},ov=function(u){return u.tagName==="TEXTAREA"},av=function(u){return u.tagName==="SELECT"},wM=function(u){return u.tagName==="SLOT"},bE=function(u){return u.tagName.indexOf("-")>0},w4=function(){function u(){this.counters={}}return u.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},u.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},u.prototype.pop=function(e){var t=this;e.forEach(function(r){return t.counters[r].pop()})},u.prototype.parse=function(e){var t=this,r=e.counterIncrement,c=e.counterReset,p=!0;r!==null&&r.forEach(function(i){var C=t.counters[i.counter];C&&i.increment!==0&&(p=!1,C.length||C.push(1),C[Math.max(0,C.length-1)]+=i.increment)});var y=[];return p&&c.forEach(function(i){var C=t.counters[i.counter];y.push(i.counter),C||(C=t.counters[i.counter]=[]),C.push(i.reset)}),y},u}(),BE={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},CE={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054F","\u054E","\u054D","\u054C","\u054B","\u054A","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053F","\u053E","\u053D","\u053C","\u053B","\u053A","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},b4={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05D9\u05F3","\u05D8\u05F3","\u05D7\u05F3","\u05D6\u05F3","\u05D5\u05F3","\u05D4\u05F3","\u05D3\u05F3","\u05D2\u05F3","\u05D1\u05F3","\u05D0\u05F3","\u05EA","\u05E9","\u05E8","\u05E7","\u05E6","\u05E4","\u05E2","\u05E1","\u05E0","\u05DE","\u05DC","\u05DB","\u05D9\u05D8","\u05D9\u05D7","\u05D9\u05D6","\u05D8\u05D6","\u05D8\u05D5","\u05D9","\u05D8","\u05D7","\u05D6","\u05D5","\u05D4","\u05D3","\u05D2","\u05D1","\u05D0"]},B4={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10F5","\u10F0","\u10EF","\u10F4","\u10EE","\u10ED","\u10EC","\u10EB","\u10EA","\u10E9","\u10E8","\u10E7","\u10E6","\u10E5","\u10E4","\u10F3","\u10E2","\u10E1","\u10E0","\u10DF","\u10DE","\u10DD","\u10F2","\u10DC","\u10DB","\u10DA","\u10D9","\u10D8","\u10D7","\u10F1","\u10D6","\u10D5","\u10D4","\u10D3","\u10D2","\u10D1","\u10D0"]},om=function(u,e,t,r,c,p){return u<e||u>t?O_(u,c,p.length>0):r.integers.reduce(function(y,i,C){for(;u>=i;)u-=i,y+=r.values[C];return y},"")+p},bM=function(u,e,t,r){var c="";do t||u--,c=r(u)+c,u/=e;while(u*e>=e);return c},wo=function(u,e,t,r,c){var p=t-e+1;return(u<0?"-":"")+(bM(Math.abs(u),p,r,function(y){return Bo(Math.floor(y%p)+e)})+c)},Op=function(u,e,t){t===void 0&&(t=". ");var r=e.length;return bM(Math.abs(u),r,!1,function(c){return e[Math.floor(c%r)]})+t},Mm=1<<0,Gd=1<<1,Wd=1<<2,x_=1<<3,UA=function(u,e,t,r,c,p){if(u<-9999||u>9999)return O_(u,4,c.length>0);var y=Math.abs(u),i=c;if(y===0)return e[0]+i;for(var C=0;y>0&&C<=4;C++){var D=y%10;D===0&&ra(p,Mm)&&i!==""?i=e[D]+i:D>1||D===1&&C===0||D===1&&C===1&&ra(p,Gd)||D===1&&C===1&&ra(p,Wd)&&u>100||D===1&&C>1&&ra(p,x_)?i=e[D]+(C>0?t[C-1]:"")+i:D===1&&C>0&&(i=t[C-1]+i),y=Math.floor(y/10)}return(u<0?r:"")+i},EE="\u5341\u767E\u5343\u842C",TE="\u62FE\u4F70\u4EDF\u842C",SE="\u30DE\u30A4\u30CA\u30B9",mw="\uB9C8\uC774\uB108\uC2A4",O_=function(u,e,t){var r=t?". ":"",c=t?"\u3001":"",p=t?", ":"",y=t?" ":"";switch(e){case 0:return"\u2022"+y;case 1:return"\u25E6"+y;case 2:return"\u25FE"+y;case 5:var i=wo(u,48,57,!0,r);return i.length<4?"0"+i:i;case 4:return Op(u,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",c);case 6:return om(u,1,3999,BE,3,r).toLowerCase();case 7:return om(u,1,3999,BE,3,r);case 8:return wo(u,945,969,!1,r);case 9:return wo(u,97,122,!1,r);case 10:return wo(u,65,90,!1,r);case 11:return wo(u,1632,1641,!0,r);case 12:case 49:return om(u,1,9999,CE,3,r);case 35:return om(u,1,9999,CE,3,r).toLowerCase();case 13:return wo(u,2534,2543,!0,r);case 14:case 30:return wo(u,6112,6121,!0,r);case 15:return Op(u,"\u5B50\u4E11\u5BC5\u536F\u8FB0\u5DF3\u5348\u672A\u7533\u9149\u620C\u4EA5",c);case 16:return Op(u,"\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678",c);case 17:case 48:return UA(u,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",EE,"\u8CA0",c,Gd|Wd|x_);case 47:return UA(u,"\u96F6\u58F9\u8CB3\u53C3\u8086\u4F0D\u9678\u67D2\u634C\u7396",TE,"\u8CA0",c,Mm|Gd|Wd|x_);case 42:return UA(u,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",EE,"\u8D1F",c,Gd|Wd|x_);case 41:return UA(u,"\u96F6\u58F9\u8D30\u53C1\u8086\u4F0D\u9646\u67D2\u634C\u7396",TE,"\u8D1F",c,Mm|Gd|Wd|x_);case 26:return UA(u,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u4E07",SE,c,0);case 25:return UA(u,"\u96F6\u58F1\u5F10\u53C2\u56DB\u4F0D\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343\u4E07",SE,c,Mm|Gd|Wd);case 31:return UA(u,"\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C","\uC2ED\uBC31\uCC9C\uB9CC",mw,p,Mm|Gd|Wd);case 33:return UA(u,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u842C",mw,p,0);case 32:return UA(u,"\u96F6\u58F9\u8CB3\u53C3\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343",mw,p,Mm|Gd|Wd);case 18:return wo(u,2406,2415,!0,r);case 20:return om(u,1,19999,B4,3,r);case 21:return wo(u,2790,2799,!0,r);case 22:return wo(u,2662,2671,!0,r);case 22:return om(u,1,10999,b4,3,r);case 23:return Op(u,"\u3042\u3044\u3046\u3048\u304A\u304B\u304D\u304F\u3051\u3053\u3055\u3057\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068\u306A\u306B\u306C\u306D\u306E\u306F\u3072\u3075\u3078\u307B\u307E\u307F\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308A\u308B\u308C\u308D\u308F\u3090\u3091\u3092\u3093");case 24:return Op(u,"\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092\u308F\u304B\u3088\u305F\u308C\u305D\u3064\u306D\u306A\u3089\u3080\u3046\u3090\u306E\u304A\u304F\u3084\u307E\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304D\u3086\u3081\u307F\u3057\u3091\u3072\u3082\u305B\u3059");case 27:return wo(u,3302,3311,!0,r);case 28:return Op(u,"\u30A2\u30A4\u30A6\u30A8\u30AA\u30AB\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CA\u30CB\u30CC\u30CD\u30CE\u30CF\u30D2\u30D5\u30D8\u30DB\u30DE\u30DF\u30E0\u30E1\u30E2\u30E4\u30E6\u30E8\u30E9\u30EA\u30EB\u30EC\u30ED\u30EF\u30F0\u30F1\u30F2\u30F3",c);case 29:return Op(u,"\u30A4\u30ED\u30CF\u30CB\u30DB\u30D8\u30C8\u30C1\u30EA\u30CC\u30EB\u30F2\u30EF\u30AB\u30E8\u30BF\u30EC\u30BD\u30C4\u30CD\u30CA\u30E9\u30E0\u30A6\u30F0\u30CE\u30AA\u30AF\u30E4\u30DE\u30B1\u30D5\u30B3\u30A8\u30C6\u30A2\u30B5\u30AD\u30E6\u30E1\u30DF\u30B7\u30F1\u30D2\u30E2\u30BB\u30B9",c);case 34:return wo(u,3792,3801,!0,r);case 37:return wo(u,6160,6169,!0,r);case 38:return wo(u,4160,4169,!0,r);case 39:return wo(u,2918,2927,!0,r);case 40:return wo(u,1776,1785,!0,r);case 43:return wo(u,3046,3055,!0,r);case 44:return wo(u,3174,3183,!0,r);case 45:return wo(u,3664,3673,!0,r);case 46:return wo(u,3872,3881,!0,r);case 3:default:return wo(u,48,57,!0,r)}},BM="data-html2canvas-ignore",ME=function(){function u(e,t,r){if(this.context=e,this.options=r,this.scrolledElements=[],this.referenceElement=t,this.counters=new w4,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return u.prototype.toIFrame=function(e,t){var r=this,c=C4(e,t);if(!c.contentWindow)return Promise.reject("Unable to find iframe window");var p=e.defaultView.pageXOffset,y=e.defaultView.pageYOffset,i=c.contentWindow,C=i.document,D=S4(c).then(function(){return Ml(r,void 0,void 0,function(){var U,N;return il(this,function(R){switch(R.label){case 0:return this.scrolledElements.forEach(L4),i&&(i.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(i.scrollY!==t.top||i.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(i.scrollX-t.left,i.scrollY-t.top,0,0))),U=this.options.onclone,N=this.clonedReferenceElement,typeof N>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:C.fonts&&C.fonts.ready?[4,C.fonts.ready]:[3,2];case 1:R.sent(),R.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,T4(C)]:[3,4];case 3:R.sent(),R.label=4;case 4:return typeof U=="function"?[2,Promise.resolve().then(function(){return U(C,N)}).then(function(){return c})]:[2,c]}})})});return C.open(),C.write(I4(document.doctype)+"<html></html>"),F4(this.referenceElement.ownerDocument,p,y),C.replaceChild(C.adoptNode(this.documentElement),C.documentElement),C.close(),D},u.prototype.createElementClone=function(e){if(Cb(e,2))debugger;if(xM(e))return this.createCanvasClone(e);if(vE(e))return this.createVideoClone(e);if(wE(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Mb(t)&&(Mb(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),bE(t)?this.createCustomElementClone(t):t},u.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return gw(e.style,t),t},u.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var r=[].slice.call(t.cssRules,0).reduce(function(p,y){return y&&typeof y.cssText=="string"?p+y.cssText:p},""),c=e.cloneNode(!1);return c.textContent=r,c}}catch(p){if(this.context.logger.error("Unable to access cssRules property",p),p.name!=="SecurityError")throw p}return e.cloneNode(!1)},u.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var r=e.ownerDocument.createElement("img");try{return r.src=e.toDataURL(),r}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var c=e.cloneNode(!1);try{c.width=e.width,c.height=e.height;var p=e.getContext("2d"),y=c.getContext("2d");if(y)if(!this.options.allowTaint&&p)y.putImageData(p.getImageData(0,0,e.width,e.height),0,0);else{var i=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(i){var C=i.getContextAttributes();(C==null?void 0:C.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}y.drawImage(e,0,0)}return c}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return c},u.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var r=t.getContext("2d");try{return r&&(r.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||r.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var c=e.ownerDocument.createElement("canvas");return c.width=e.offsetWidth,c.height=e.offsetHeight,c},u.prototype.appendChildNode=function(e,t,r){(!Fm(t)||!v4(t)&&!t.hasAttribute(BM)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Fm(t)||!wE(t))&&e.appendChild(this.cloneNode(t,r))},u.prototype.cloneChildNodes=function(e,t,r){for(var c=this,p=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;p;p=p.nextSibling)if(Fm(p)&&wM(p)&&typeof p.assignedNodes=="function"){var y=p.assignedNodes();y.length&&y.forEach(function(i){return c.appendChildNode(t,i,r)})}else this.appendChildNode(t,p,r)},u.prototype.cloneNode=function(e,t){if(_M(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var r=e.ownerDocument.defaultView;if(r&&Fm(e)&&(Sb(e)||Wx(e))){var c=this.createElementClone(e);c.style.transitionProperty="none";var p=r.getComputedStyle(e),y=r.getComputedStyle(e,":before"),i=r.getComputedStyle(e,":after");this.referenceElement===e&&Sb(c)&&(this.clonedReferenceElement=c),I2(c)&&U4(c);var C=this.counters.parse(new oE(this.context,p)),D=this.resolvePseudoContent(e,c,y,S_.BEFORE);bE(e)&&(t=!0),vE(e)||this.cloneChildNodes(e,c,t),D&&c.insertBefore(D,c.firstChild);var U=this.resolvePseudoContent(e,c,i,S_.AFTER);return U&&c.appendChild(U),this.counters.pop(C),(p&&(this.options.copyStyles||Wx(e))&&!vM(e)||t)&&gw(p,c),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([c,e.scrollLeft,e.scrollTop]),(ov(e)||av(e))&&(ov(c)||av(c))&&(c.value=e.value),c}return e.cloneNode(!1)},u.prototype.resolvePseudoContent=function(e,t,r,c){var p=this;if(!!r){var y=r.content,i=t.ownerDocument;if(!(!i||!y||y==="none"||y==="-moz-alt-content"||r.display==="none")){this.counters.parse(new oE(this.context,r));var C=new gU(this.context,r),D=i.createElement("html2canvaspseudoelement");gw(r,D),C.content.forEach(function(N){if(N.type===0)D.appendChild(i.createTextNode(N.value));else if(N.type===22){var R=i.createElement("img");R.src=N.value,R.style.opacity="1",D.appendChild(R)}else if(N.type===18){if(N.name==="attr"){var G=N.values.filter(Ms);G.length&&D.appendChild(i.createTextNode(e.getAttribute(G[0].value)||""))}else if(N.name==="counter"){var J=N.values.filter(Hm),Y=J[0],B=J[1];if(Y&&Ms(Y)){var ae=p.counters.getCounterValue(Y.value),le=B&&Ms(B)?Bb.parse(p.context,B.value):3;D.appendChild(i.createTextNode(O_(ae,le,!1)))}}else if(N.name==="counters"){var Ae=N.values.filter(Hm),Y=Ae[0],we=Ae[1],B=Ae[2];if(Y&&Ms(Y)){var me=p.counters.getCounterValues(Y.value),Pe=B&&Ms(B)?Bb.parse(p.context,B.value):3,it=we&&we.type===0?we.value:"",Me=me.map(function(oi){return O_(oi,Pe,!1)}).join(it);D.appendChild(i.createTextNode(Me))}}}else if(N.type===20)switch(N.value){case"open-quote":D.appendChild(i.createTextNode(sE(C.quotes,p.quoteDepth++,!0)));break;case"close-quote":D.appendChild(i.createTextNode(sE(C.quotes,--p.quoteDepth,!1)));break;default:D.appendChild(i.createTextNode(N.value))}}),D.className=Ib+" "+Fb;var U=c===S_.BEFORE?" "+Ib:" "+Fb;return Wx(t)?t.className.baseValue+=U:t.className+=U,D}}},u.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},u}(),S_;(function(u){u[u.BEFORE=0]="BEFORE",u[u.AFTER=1]="AFTER"})(S_||(S_={}));var C4=function(u,e){var t=u.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(BM,"true"),u.body.appendChild(t),t},E4=function(u){return new Promise(function(e){if(u.complete){e();return}if(!u.src){e();return}u.onload=e,u.onerror=e})},T4=function(u){return Promise.all([].slice.call(u.images,0).map(E4))},S4=function(u){return new Promise(function(e,t){var r=u.contentWindow;if(!r)return t("No window assigned for iframe");var c=r.document;r.onload=u.onload=function(){r.onload=u.onload=null;var p=setInterval(function(){c.body.childNodes.length>0&&c.readyState==="complete"&&(clearInterval(p),e(u))},50)}})},M4=["all","d","content"],gw=function(u,e){for(var t=u.length-1;t>=0;t--){var r=u.item(t);M4.indexOf(r)===-1&&e.style.setProperty(r,u.getPropertyValue(r))}return e},I4=function(u){var e="";return u&&(e+="<!DOCTYPE ",u.name&&(e+=u.name),u.internalSubset&&(e+=u.internalSubset),u.publicId&&(e+='"'+u.publicId+'"'),u.systemId&&(e+='"'+u.systemId+'"'),e+=">"),e},F4=function(u,e,t){u&&u.defaultView&&(e!==u.defaultView.pageXOffset||t!==u.defaultView.pageYOffset)&&u.defaultView.scrollTo(e,t)},L4=function(u){var e=u[0],t=u[1],r=u[2];e.scrollLeft=t,e.scrollTop=r},D4=":before",P4=":after",Ib="___html2canvas___pseudoelement_before",Fb="___html2canvas___pseudoelement_after",IE=`{
- content: "" !important;
- display: none !important;
- }`,U4=function(u){R4(u,"."+Ib+D4+IE+`
- .`+Fb+P4+IE)},R4=function(u,e){var t=u.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,u.appendChild(r)}},CM=function(){function u(){}return u.getOrigin=function(e){var t=u._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},u.isSameOrigin=function(e){return u.getOrigin(e)===u._origin},u.setContext=function(e){u._link=e.document.createElement("a"),u._origin=u.getOrigin(e.location.href)},u._origin="about:blank",u}(),z4=function(){function u(e,t){this.context=e,this._options=t,this._cache={}}return u.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(yw(e)||Q4(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},u.prototype.match=function(e){return this._cache[e]},u.prototype.loadImage=function(e){return Ml(this,void 0,void 0,function(){var t,r,c,p,y=this;return il(this,function(i){switch(i.label){case 0:return t=CM.isSameOrigin(e),r=!_w(e)&&this._options.useCORS===!0&&za.SUPPORT_CORS_IMAGES&&!t,c=!_w(e)&&!t&&!yw(e)&&typeof this._options.proxy=="string"&&za.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!_w(e)&&!yw(e)&&!c&&!r?[2]:(p=e,c?[4,this.proxy(p)]:[3,2]);case 1:p=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(C,D){var U=new Image;U.onload=function(){return C(U)},U.onerror=D,(V4(p)||r)&&(U.crossOrigin="anonymous"),U.src=p,U.complete===!0&&setTimeout(function(){return C(U)},500),y._options.imageTimeout>0&&setTimeout(function(){return D("Timed out ("+y._options.imageTimeout+"ms) loading image")},y._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},u.prototype.has=function(e){return typeof this._cache[e]<"u"},u.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},u.prototype.proxy=function(e){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var c=e.substring(0,256);return new Promise(function(p,y){var i=za.SUPPORT_RESPONSE_TYPE?"blob":"text",C=new XMLHttpRequest;C.onload=function(){if(C.status===200)if(i==="text")p(C.response);else{var N=new FileReader;N.addEventListener("load",function(){return p(N.result)},!1),N.addEventListener("error",function(R){return y(R)},!1),N.readAsDataURL(C.response)}else y("Failed to proxy resource "+c+" with status code "+C.status)},C.onerror=y;var D=r.indexOf("?")>-1?"&":"?";if(C.open("GET",""+r+D+"url="+encodeURIComponent(e)+"&responseType="+i),i!=="text"&&C instanceof XMLHttpRequest&&(C.responseType=i),t._options.imageTimeout){var U=t._options.imageTimeout;C.timeout=U,C.ontimeout=function(){return y("Timed out ("+U+"ms) proxying "+c)}}C.send()})},u}(),k4=/^data:image\/svg\+xml/i,O4=/^data:image\/.*;base64,/i,N4=/^data:image\/.*/i,Q4=function(u){return za.SUPPORT_SVG_DRAWING||!H4(u)},_w=function(u){return N4.test(u)},V4=function(u){return O4.test(u)},yw=function(u){return u.substr(0,4)==="blob"},H4=function(u){return u.substr(-3).toLowerCase()==="svg"||k4.test(u)},Rn=function(){function u(e,t){this.type=0,this.x=e,this.y=t}return u.prototype.add=function(e,t){return new u(this.x+e,this.y+t)},u}(),am=function(u,e,t){return new Rn(u.x+(e.x-u.x)*t,u.y+(e.y-u.y)*t)},$0=function(){function u(e,t,r,c){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=c}return u.prototype.subdivide=function(e,t){var r=am(this.start,this.startControl,e),c=am(this.startControl,this.endControl,e),p=am(this.endControl,this.end,e),y=am(r,c,e),i=am(c,p,e),C=am(y,i,e);return t?new u(this.start,r,y,C):new u(C,i,p,this.end)},u.prototype.add=function(e,t){return new u(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},u.prototype.reverse=function(){return new u(this.end,this.endControl,this.startControl,this.start)},u}(),vh=function(u){return u.type===1},G4=function(){function u(e){var t=e.styles,r=e.bounds,c=__(t.borderTopLeftRadius,r.width,r.height),p=c[0],y=c[1],i=__(t.borderTopRightRadius,r.width,r.height),C=i[0],D=i[1],U=__(t.borderBottomRightRadius,r.width,r.height),N=U[0],R=U[1],G=__(t.borderBottomLeftRadius,r.width,r.height),J=G[0],Y=G[1],B=[];B.push((p+C)/r.width),B.push((J+N)/r.width),B.push((y+Y)/r.height),B.push((D+R)/r.height);var ae=Math.max.apply(Math,B);ae>1&&(p/=ae,y/=ae,C/=ae,D/=ae,N/=ae,R/=ae,J/=ae,Y/=ae);var le=r.width-C,Ae=r.height-R,we=r.width-N,me=r.height-Y,Pe=t.borderTopWidth,it=t.borderRightWidth,Me=t.borderBottomWidth,Ke=t.borderLeftWidth,Et=Gs(t.paddingTop,e.bounds.width),oi=Gs(t.paddingRight,e.bounds.width),Ci=Gs(t.paddingBottom,e.bounds.width),te=Gs(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=p>0||y>0?ro(r.left+Ke/3,r.top+Pe/3,p-Ke/3,y-Pe/3,xs.TOP_LEFT):new Rn(r.left+Ke/3,r.top+Pe/3),this.topRightBorderDoubleOuterBox=p>0||y>0?ro(r.left+le,r.top+Pe/3,C-it/3,D-Pe/3,xs.TOP_RIGHT):new Rn(r.left+r.width-it/3,r.top+Pe/3),this.bottomRightBorderDoubleOuterBox=N>0||R>0?ro(r.left+we,r.top+Ae,N-it/3,R-Me/3,xs.BOTTOM_RIGHT):new Rn(r.left+r.width-it/3,r.top+r.height-Me/3),this.bottomLeftBorderDoubleOuterBox=J>0||Y>0?ro(r.left+Ke/3,r.top+me,J-Ke/3,Y-Me/3,xs.BOTTOM_LEFT):new Rn(r.left+Ke/3,r.top+r.height-Me/3),this.topLeftBorderDoubleInnerBox=p>0||y>0?ro(r.left+Ke*2/3,r.top+Pe*2/3,p-Ke*2/3,y-Pe*2/3,xs.TOP_LEFT):new Rn(r.left+Ke*2/3,r.top+Pe*2/3),this.topRightBorderDoubleInnerBox=p>0||y>0?ro(r.left+le,r.top+Pe*2/3,C-it*2/3,D-Pe*2/3,xs.TOP_RIGHT):new Rn(r.left+r.width-it*2/3,r.top+Pe*2/3),this.bottomRightBorderDoubleInnerBox=N>0||R>0?ro(r.left+we,r.top+Ae,N-it*2/3,R-Me*2/3,xs.BOTTOM_RIGHT):new Rn(r.left+r.width-it*2/3,r.top+r.height-Me*2/3),this.bottomLeftBorderDoubleInnerBox=J>0||Y>0?ro(r.left+Ke*2/3,r.top+me,J-Ke*2/3,Y-Me*2/3,xs.BOTTOM_LEFT):new Rn(r.left+Ke*2/3,r.top+r.height-Me*2/3),this.topLeftBorderStroke=p>0||y>0?ro(r.left+Ke/2,r.top+Pe/2,p-Ke/2,y-Pe/2,xs.TOP_LEFT):new Rn(r.left+Ke/2,r.top+Pe/2),this.topRightBorderStroke=p>0||y>0?ro(r.left+le,r.top+Pe/2,C-it/2,D-Pe/2,xs.TOP_RIGHT):new Rn(r.left+r.width-it/2,r.top+Pe/2),this.bottomRightBorderStroke=N>0||R>0?ro(r.left+we,r.top+Ae,N-it/2,R-Me/2,xs.BOTTOM_RIGHT):new Rn(r.left+r.width-it/2,r.top+r.height-Me/2),this.bottomLeftBorderStroke=J>0||Y>0?ro(r.left+Ke/2,r.top+me,J-Ke/2,Y-Me/2,xs.BOTTOM_LEFT):new Rn(r.left+Ke/2,r.top+r.height-Me/2),this.topLeftBorderBox=p>0||y>0?ro(r.left,r.top,p,y,xs.TOP_LEFT):new Rn(r.left,r.top),this.topRightBorderBox=C>0||D>0?ro(r.left+le,r.top,C,D,xs.TOP_RIGHT):new Rn(r.left+r.width,r.top),this.bottomRightBorderBox=N>0||R>0?ro(r.left+we,r.top+Ae,N,R,xs.BOTTOM_RIGHT):new Rn(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=J>0||Y>0?ro(r.left,r.top+me,J,Y,xs.BOTTOM_LEFT):new Rn(r.left,r.top+r.height),this.topLeftPaddingBox=p>0||y>0?ro(r.left+Ke,r.top+Pe,Math.max(0,p-Ke),Math.max(0,y-Pe),xs.TOP_LEFT):new Rn(r.left+Ke,r.top+Pe),this.topRightPaddingBox=C>0||D>0?ro(r.left+Math.min(le,r.width-it),r.top+Pe,le>r.width+it?0:Math.max(0,C-it),Math.max(0,D-Pe),xs.TOP_RIGHT):new Rn(r.left+r.width-it,r.top+Pe),this.bottomRightPaddingBox=N>0||R>0?ro(r.left+Math.min(we,r.width-Ke),r.top+Math.min(Ae,r.height-Me),Math.max(0,N-it),Math.max(0,R-Me),xs.BOTTOM_RIGHT):new Rn(r.left+r.width-it,r.top+r.height-Me),this.bottomLeftPaddingBox=J>0||Y>0?ro(r.left+Ke,r.top+Math.min(me,r.height-Me),Math.max(0,J-Ke),Math.max(0,Y-Me),xs.BOTTOM_LEFT):new Rn(r.left+Ke,r.top+r.height-Me),this.topLeftContentBox=p>0||y>0?ro(r.left+Ke+te,r.top+Pe+Et,Math.max(0,p-(Ke+te)),Math.max(0,y-(Pe+Et)),xs.TOP_LEFT):new Rn(r.left+Ke+te,r.top+Pe+Et),this.topRightContentBox=C>0||D>0?ro(r.left+Math.min(le,r.width+Ke+te),r.top+Pe+Et,le>r.width+Ke+te?0:C-Ke+te,D-(Pe+Et),xs.TOP_RIGHT):new Rn(r.left+r.width-(it+oi),r.top+Pe+Et),this.bottomRightContentBox=N>0||R>0?ro(r.left+Math.min(we,r.width-(Ke+te)),r.top+Math.min(Ae,r.height+Pe+Et),Math.max(0,N-(it+oi)),R-(Me+Ci),xs.BOTTOM_RIGHT):new Rn(r.left+r.width-(it+oi),r.top+r.height-(Me+Ci)),this.bottomLeftContentBox=J>0||Y>0?ro(r.left+Ke+te,r.top+me,Math.max(0,J-(Ke+te)),Y-(Me+Ci),xs.BOTTOM_LEFT):new Rn(r.left+Ke+te,r.top+r.height-(Me+Ci))}return u}(),xs;(function(u){u[u.TOP_LEFT=0]="TOP_LEFT",u[u.TOP_RIGHT=1]="TOP_RIGHT",u[u.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",u[u.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(xs||(xs={}));var ro=function(u,e,t,r,c){var p=4*((Math.sqrt(2)-1)/3),y=t*p,i=r*p,C=u+t,D=e+r;switch(c){case xs.TOP_LEFT:return new $0(new Rn(u,D),new Rn(u,D-i),new Rn(C-y,e),new Rn(C,e));case xs.TOP_RIGHT:return new $0(new Rn(u,e),new Rn(u+y,e),new Rn(C,D-i),new Rn(C,D));case xs.BOTTOM_RIGHT:return new $0(new Rn(C,e),new Rn(C,e+i),new Rn(u+y,D),new Rn(u,D));case xs.BOTTOM_LEFT:default:return new $0(new Rn(C,D),new Rn(C-y,D),new Rn(u,e+i),new Rn(u,e))}},lv=function(u){return[u.topLeftBorderBox,u.topRightBorderBox,u.bottomRightBorderBox,u.bottomLeftBorderBox]},W4=function(u){return[u.topLeftContentBox,u.topRightContentBox,u.bottomRightContentBox,u.bottomLeftContentBox]},cv=function(u){return[u.topLeftPaddingBox,u.topRightPaddingBox,u.bottomRightPaddingBox,u.bottomLeftPaddingBox]},j4=function(){function u(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return u}(),Z0=function(){function u(e,t){this.path=e,this.target=t,this.type=1}return u}(),K4=function(){function u(e){this.opacity=e,this.type=2,this.target=6}return u}(),$4=function(u){return u.type===0},EM=function(u){return u.type===1},Z4=function(u){return u.type===2},FE=function(u,e){return u.length===e.length?u.some(function(t,r){return t===e[r]}):!1},X4=function(u,e,t,r,c){return u.map(function(p,y){switch(y){case 0:return p.add(e,t);case 1:return p.add(e+r,t);case 2:return p.add(e+r,t+c);case 3:return p.add(e,t+c)}return p})},TM=function(){function u(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return u}(),SM=function(){function u(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new G4(this.container),this.container.styles.opacity<1&&this.effects.push(new K4(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,c=this.container.bounds.top+this.container.styles.transformOrigin[1].number,p=this.container.styles.transform;this.effects.push(new j4(r,c,p))}if(this.container.styles.overflowX!==0){var y=lv(this.curves),i=cv(this.curves);FE(y,i)?this.effects.push(new Z0(y,6)):(this.effects.push(new Z0(y,2)),this.effects.push(new Z0(i,4)))}}return u.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,c=this.effects.slice(0);r;){var p=r.effects.filter(function(C){return!EM(C)});if(t||r.container.styles.position!==0||!r.parent){if(c.unshift.apply(c,p),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var y=lv(r.curves),i=cv(r.curves);FE(y,i)||c.unshift(new Z0(i,6))}}else c.unshift.apply(c,p);r=r.parent}return c.filter(function(C){return ra(C.target,e)})},u}(),Lb=function(u,e,t,r){u.container.elements.forEach(function(c){var p=ra(c.flags,4),y=ra(c.flags,2),i=new SM(c,u);ra(c.styles.display,2048)&&r.push(i);var C=ra(c.flags,8)?[]:r;if(p||y){var D=p||c.styles.isPositioned()?t:e,U=new TM(i);if(c.styles.isPositioned()||c.styles.opacity<1||c.styles.isTransformed()){var N=c.styles.zIndex.order;if(N<0){var R=0;D.negativeZIndex.some(function(J,Y){return N>J.element.container.styles.zIndex.order?(R=Y,!1):R>0}),D.negativeZIndex.splice(R,0,U)}else if(N>0){var G=0;D.positiveZIndex.some(function(J,Y){return N>=J.element.container.styles.zIndex.order?(G=Y+1,!1):G>0}),D.positiveZIndex.splice(G,0,U)}else D.zeroOrAutoZIndexOrTransformedOrOpacity.push(U)}else c.styles.isFloating()?D.nonPositionedFloats.push(U):D.nonPositionedInlineLevel.push(U);Lb(i,U,p?U:t,C)}else c.styles.isInlineLevel()?e.inlineLevel.push(i):e.nonInlineLevel.push(i),Lb(i,e,t,C);ra(c.flags,8)&&MM(c,C)})},MM=function(u,e){for(var t=u instanceof Tb?u.start:1,r=u instanceof Tb?u.reversed:!1,c=0;c<e.length;c++){var p=e[c];p.container instanceof AM&&typeof p.container.value=="number"&&p.container.value!==0&&(t=p.container.value),p.listValue=O_(t,p.container.styles.listStyleType,!0),t+=r?-1:1}},q4=function(u){var e=new SM(u,null),t=new TM(e),r=[];return Lb(e,t,t,r),MM(e.container,r),t},LE=function(u,e){switch(e){case 0:return Bh(u.topLeftBorderBox,u.topLeftPaddingBox,u.topRightBorderBox,u.topRightPaddingBox);case 1:return Bh(u.topRightBorderBox,u.topRightPaddingBox,u.bottomRightBorderBox,u.bottomRightPaddingBox);case 2:return Bh(u.bottomRightBorderBox,u.bottomRightPaddingBox,u.bottomLeftBorderBox,u.bottomLeftPaddingBox);case 3:default:return Bh(u.bottomLeftBorderBox,u.bottomLeftPaddingBox,u.topLeftBorderBox,u.topLeftPaddingBox)}},Y4=function(u,e){switch(e){case 0:return Bh(u.topLeftBorderBox,u.topLeftBorderDoubleOuterBox,u.topRightBorderBox,u.topRightBorderDoubleOuterBox);case 1:return Bh(u.topRightBorderBox,u.topRightBorderDoubleOuterBox,u.bottomRightBorderBox,u.bottomRightBorderDoubleOuterBox);case 2:return Bh(u.bottomRightBorderBox,u.bottomRightBorderDoubleOuterBox,u.bottomLeftBorderBox,u.bottomLeftBorderDoubleOuterBox);case 3:default:return Bh(u.bottomLeftBorderBox,u.bottomLeftBorderDoubleOuterBox,u.topLeftBorderBox,u.topLeftBorderDoubleOuterBox)}},J4=function(u,e){switch(e){case 0:return Bh(u.topLeftBorderDoubleInnerBox,u.topLeftPaddingBox,u.topRightBorderDoubleInnerBox,u.topRightPaddingBox);case 1:return Bh(u.topRightBorderDoubleInnerBox,u.topRightPaddingBox,u.bottomRightBorderDoubleInnerBox,u.bottomRightPaddingBox);case 2:return Bh(u.bottomRightBorderDoubleInnerBox,u.bottomRightPaddingBox,u.bottomLeftBorderDoubleInnerBox,u.bottomLeftPaddingBox);case 3:default:return Bh(u.bottomLeftBorderDoubleInnerBox,u.bottomLeftPaddingBox,u.topLeftBorderDoubleInnerBox,u.topLeftPaddingBox)}},eR=function(u,e){switch(e){case 0:return X0(u.topLeftBorderStroke,u.topRightBorderStroke);case 1:return X0(u.topRightBorderStroke,u.bottomRightBorderStroke);case 2:return X0(u.bottomRightBorderStroke,u.bottomLeftBorderStroke);case 3:default:return X0(u.bottomLeftBorderStroke,u.topLeftBorderStroke)}},X0=function(u,e){var t=[];return vh(u)?t.push(u.subdivide(.5,!1)):t.push(u),vh(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},Bh=function(u,e,t,r){var c=[];return vh(u)?c.push(u.subdivide(.5,!1)):c.push(u),vh(t)?c.push(t.subdivide(.5,!0)):c.push(t),vh(r)?c.push(r.subdivide(.5,!0).reverse()):c.push(r),vh(e)?c.push(e.subdivide(.5,!1).reverse()):c.push(e),c},IM=function(u){var e=u.bounds,t=u.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},hv=function(u){var e=u.styles,t=u.bounds,r=Gs(e.paddingLeft,t.width),c=Gs(e.paddingRight,t.width),p=Gs(e.paddingTop,t.width),y=Gs(e.paddingBottom,t.width);return t.add(r+e.borderLeftWidth,p+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+c),-(e.borderTopWidth+e.borderBottomWidth+p+y))},tR=function(u,e){return u===0?e.bounds:u===2?hv(e):IM(e)},iR=function(u,e){return u===0?e.bounds:u===2?hv(e):IM(e)},xw=function(u,e,t){var r=tR(Im(u.styles.backgroundOrigin,e),u),c=iR(Im(u.styles.backgroundClip,e),u),p=nR(Im(u.styles.backgroundSize,e),t,r),y=p[0],i=p[1],C=__(Im(u.styles.backgroundPosition,e),r.width-y,r.height-i),D=rR(Im(u.styles.backgroundRepeat,e),C,p,r,c),U=Math.round(r.left+C[0]),N=Math.round(r.top+C[1]);return[D,U,N,y,i]},lm=function(u){return Ms(u)&&u.value===Om.AUTO},q0=function(u){return typeof u=="number"},nR=function(u,e,t){var r=e[0],c=e[1],p=e[2],y=u[0],i=u[1];if(!y)return[0,0];if(zo(y)&&i&&zo(i))return[Gs(y,t.width),Gs(i,t.height)];var C=q0(p);if(Ms(y)&&(y.value===Om.CONTAIN||y.value===Om.COVER)){if(q0(p)){var D=t.width/t.height;return D<p!=(y.value===Om.COVER)?[t.width,t.width/p]:[t.height*p,t.height]}return[t.width,t.height]}var U=q0(r),N=q0(c),R=U||N;if(lm(y)&&(!i||lm(i))){if(U&&N)return[r,c];if(!C&&!R)return[t.width,t.height];if(R&&C){var G=U?r:c*p,J=N?c:r/p;return[G,J]}var Y=U?r:t.width,B=N?c:t.height;return[Y,B]}if(C){var ae=0,le=0;return zo(y)?ae=Gs(y,t.width):zo(i)&&(le=Gs(i,t.height)),lm(y)?ae=le*p:(!i||lm(i))&&(le=ae/p),[ae,le]}var Ae=null,we=null;if(zo(y)?Ae=Gs(y,t.width):i&&zo(i)&&(we=Gs(i,t.height)),Ae!==null&&(!i||lm(i))&&(we=U&&N?Ae/r*c:t.height),we!==null&&lm(y)&&(Ae=U&&N?we/c*r:t.width),Ae!==null&&we!==null)return[Ae,we];throw new Error("Unable to calculate background-size for element")},Im=function(u,e){var t=u[e];return typeof t>"u"?u[0]:t},rR=function(u,e,t,r,c){var p=e[0],y=e[1],i=t[0],C=t[1];switch(u){case 2:return[new Rn(Math.round(r.left),Math.round(r.top+y)),new Rn(Math.round(r.left+r.width),Math.round(r.top+y)),new Rn(Math.round(r.left+r.width),Math.round(C+r.top+y)),new Rn(Math.round(r.left),Math.round(C+r.top+y))];case 3:return[new Rn(Math.round(r.left+p),Math.round(r.top)),new Rn(Math.round(r.left+p+i),Math.round(r.top)),new Rn(Math.round(r.left+p+i),Math.round(r.height+r.top)),new Rn(Math.round(r.left+p),Math.round(r.height+r.top))];case 1:return[new Rn(Math.round(r.left+p),Math.round(r.top+y)),new Rn(Math.round(r.left+p+i),Math.round(r.top+y)),new Rn(Math.round(r.left+p+i),Math.round(r.top+y+C)),new Rn(Math.round(r.left+p),Math.round(r.top+y+C))];default:return[new Rn(Math.round(c.left),Math.round(c.top)),new Rn(Math.round(c.left+c.width),Math.round(c.top)),new Rn(Math.round(c.left+c.width),Math.round(c.height+c.top)),new Rn(Math.round(c.left),Math.round(c.height+c.top))]}},sR="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",DE="Hidden Text",oR=function(){function u(e){this._data={},this._document=e}return u.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),c=this._document.createElement("img"),p=this._document.createElement("span"),y=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",y.appendChild(r),c.src=sR,c.width=1,c.height=1,c.style.margin="0",c.style.padding="0",c.style.verticalAlign="baseline",p.style.fontFamily=e,p.style.fontSize=t,p.style.margin="0",p.style.padding="0",p.appendChild(this._document.createTextNode(DE)),r.appendChild(p),r.appendChild(c);var i=c.offsetTop-p.offsetTop+2;r.removeChild(p),r.appendChild(this._document.createTextNode(DE)),r.style.lineHeight="normal",c.style.verticalAlign="super";var C=c.offsetTop-r.offsetTop+2;return y.removeChild(r),{baseline:i,middle:C}},u.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},u}(),FM=function(){function u(e,t){this.context=e,this.options=t}return u}(),aR=1e4,lR=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c._activeEffects=[],c.canvas=r.canvas?r.canvas:document.createElement("canvas"),c.ctx=c.canvas.getContext("2d"),r.canvas||(c.canvas.width=Math.floor(r.width*r.scale),c.canvas.height=Math.floor(r.height*r.scale),c.canvas.style.width=r.width+"px",c.canvas.style.height=r.height+"px"),c.fontMetrics=new oR(document),c.ctx.scale(c.options.scale,c.options.scale),c.ctx.translate(-r.x,-r.y),c.ctx.textBaseline="bottom",c._activeEffects=[],c.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),c}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(c){return r.applyEffect(c)})},e.prototype.applyEffect=function(t){this.ctx.save(),Z4(t)&&(this.ctx.globalAlpha=t.opacity),$4(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),EM(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Ml(this,void 0,void 0,function(){var r;return il(this,function(c){switch(c.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:c.sent(),c.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Ml(this,void 0,void 0,function(){return il(this,function(r){switch(r.label){case 0:if(ra(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,c){var p=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+c);else{var y=S2(t.text);y.reduce(function(i,C){return p.ctx.fillText(C,i,t.bounds.top+c),i+p.ctx.measureText(C).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(y){return y==="normal"||y==="small-caps"}).join(""),c=dR(t.fontFamily).join(", "),p=cy(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,p,c].join(" "),c,p]},e.prototype.renderTextNode=function(t,r){return Ml(this,void 0,void 0,function(){var c,p,y,i,C,D,U,N,R=this;return il(this,function(G){return c=this.createFontStyle(r),p=c[0],y=c[1],i=c[2],this.ctx.font=p,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",C=this.fontMetrics.getMetrics(y,i),D=C.baseline,U=C.middle,N=r.paintOrder,t.textBounds.forEach(function(J){N.forEach(function(Y){switch(Y){case 0:R.ctx.fillStyle=ga(r.color),R.renderTextWithLetterSpacing(J,r.letterSpacing,D);var B=r.textShadow;B.length&&J.text.trim().length&&(B.slice(0).reverse().forEach(function(ae){R.ctx.shadowColor=ga(ae.color),R.ctx.shadowOffsetX=ae.offsetX.number*R.options.scale,R.ctx.shadowOffsetY=ae.offsetY.number*R.options.scale,R.ctx.shadowBlur=ae.blur.number,R.renderTextWithLetterSpacing(J,r.letterSpacing,D)}),R.ctx.shadowColor="",R.ctx.shadowOffsetX=0,R.ctx.shadowOffsetY=0,R.ctx.shadowBlur=0),r.textDecorationLine.length&&(R.ctx.fillStyle=ga(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(ae){switch(ae){case 1:R.ctx.fillRect(J.bounds.left,Math.round(J.bounds.top+D),J.bounds.width,1);break;case 2:R.ctx.fillRect(J.bounds.left,Math.round(J.bounds.top),J.bounds.width,1);break;case 3:R.ctx.fillRect(J.bounds.left,Math.ceil(J.bounds.top+U),J.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&J.text.trim().length&&(R.ctx.strokeStyle=ga(r.webkitTextStrokeColor),R.ctx.lineWidth=r.webkitTextStrokeWidth,R.ctx.lineJoin=window.chrome?"miter":"round",R.ctx.strokeText(J.text,J.bounds.left,J.bounds.top+D)),R.ctx.strokeStyle="",R.ctx.lineWidth=0,R.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,c){if(c&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var p=hv(t),y=cv(r);this.path(y),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(c,0,0,t.intrinsicWidth,t.intrinsicHeight,p.left,p.top,p.width,p.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Ml(this,void 0,void 0,function(){var r,c,p,y,i,C,le,le,D,U,N,R,we,G,J,me,Y,B,ae,le,Ae,we,me;return il(this,function(Pe){switch(Pe.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,c=t.curves,p=r.styles,y=0,i=r.textNodes,Pe.label=1;case 1:return y<i.length?(C=i[y],[4,this.renderTextNode(C,p)]):[3,4];case 2:Pe.sent(),Pe.label=3;case 3:return y++,[3,1];case 4:if(!(r instanceof cM))return[3,8];Pe.label=5;case 5:return Pe.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return le=Pe.sent(),this.renderReplacedElement(r,c,le),[3,8];case 7:return Pe.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof hM&&this.renderReplacedElement(r,c,r.canvas),!(r instanceof uM))return[3,12];Pe.label=9;case 9:return Pe.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return le=Pe.sent(),this.renderReplacedElement(r,c,le),[3,12];case 11:return Pe.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof fM&&r.tree?(D=new e(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,D.render(r.tree)]):[3,14];case 13:U=Pe.sent(),r.width&&r.height&&this.ctx.drawImage(U,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),Pe.label=14;case 14:if(r instanceof M2&&(N=Math.min(r.bounds.width,r.bounds.height),r.type===rv?r.checked&&(this.ctx.save(),this.path([new Rn(r.bounds.left+N*.39363,r.bounds.top+N*.79),new Rn(r.bounds.left+N*.16,r.bounds.top+N*.5549),new Rn(r.bounds.left+N*.27347,r.bounds.top+N*.44071),new Rn(r.bounds.left+N*.39694,r.bounds.top+N*.5649),new Rn(r.bounds.left+N*.72983,r.bounds.top+N*.23),new Rn(r.bounds.left+N*.84,r.bounds.top+N*.34085),new Rn(r.bounds.left+N*.39363,r.bounds.top+N*.79)]),this.ctx.fillStyle=ga(xE),this.ctx.fill(),this.ctx.restore()):r.type===sv&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+N/2,r.bounds.top+N/2,N/4,0,Math.PI*2,!0),this.ctx.fillStyle=ga(xE),this.ctx.fill(),this.ctx.restore())),cR(r)&&r.value.length){switch(R=this.createFontStyle(p),we=R[0],G=R[1],J=this.fontMetrics.getMetrics(we,G).baseline,this.ctx.font=we,this.ctx.fillStyle=ga(p.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=uR(r.styles.textAlign),me=hv(r),Y=0,r.styles.textAlign){case 1:Y+=me.width/2;break;case 2:Y+=me.width;break}B=me.add(Y,0,0,-me.height/2+1),this.ctx.save(),this.path([new Rn(me.left,me.top),new Rn(me.left+me.width,me.top),new Rn(me.left+me.width,me.top+me.height),new Rn(me.left,me.top+me.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new T_(r.value,B),p.letterSpacing,J),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!ra(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(ae=r.styles.listStyleImage,ae.type!==0)return[3,18];le=void 0,Ae=ae.url,Pe.label=15;case 15:return Pe.trys.push([15,17,,18]),[4,this.context.cache.match(Ae)];case 16:return le=Pe.sent(),this.ctx.drawImage(le,r.bounds.left-(le.width+10),r.bounds.top),[3,18];case 17:return Pe.sent(),this.context.logger.error("Error loading list-style-image "+Ae),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(we=this.createFontStyle(p)[0],this.ctx.font=we,this.ctx.fillStyle=ga(p.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",me=new ZA(r.bounds.left,r.bounds.top+Gs(r.styles.paddingTop,r.bounds.width),r.bounds.width,nE(p.lineHeight,p.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new T_(t.listValue,me),p.letterSpacing,nE(p.lineHeight,p.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),Pe.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return Ml(this,void 0,void 0,function(){var r,c,ae,p,y,ae,i,C,ae,D,U,ae,N,R,ae,G,J,ae,Y,B,ae;return il(this,function(le){switch(le.label){case 0:if(ra(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:le.sent(),r=0,c=t.negativeZIndex,le.label=2;case 2:return r<c.length?(ae=c[r],[4,this.renderStack(ae)]):[3,5];case 3:le.sent(),le.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:le.sent(),p=0,y=t.nonInlineLevel,le.label=7;case 7:return p<y.length?(ae=y[p],[4,this.renderNode(ae)]):[3,10];case 8:le.sent(),le.label=9;case 9:return p++,[3,7];case 10:i=0,C=t.nonPositionedFloats,le.label=11;case 11:return i<C.length?(ae=C[i],[4,this.renderStack(ae)]):[3,14];case 12:le.sent(),le.label=13;case 13:return i++,[3,11];case 14:D=0,U=t.nonPositionedInlineLevel,le.label=15;case 15:return D<U.length?(ae=U[D],[4,this.renderStack(ae)]):[3,18];case 16:le.sent(),le.label=17;case 17:return D++,[3,15];case 18:N=0,R=t.inlineLevel,le.label=19;case 19:return N<R.length?(ae=R[N],[4,this.renderNode(ae)]):[3,22];case 20:le.sent(),le.label=21;case 21:return N++,[3,19];case 22:G=0,J=t.zeroOrAutoZIndexOrTransformedOrOpacity,le.label=23;case 23:return G<J.length?(ae=J[G],[4,this.renderStack(ae)]):[3,26];case 24:le.sent(),le.label=25;case 25:return G++,[3,23];case 26:Y=0,B=t.positiveZIndex,le.label=27;case 27:return Y<B.length?(ae=B[Y],[4,this.renderStack(ae)]):[3,30];case 28:le.sent(),le.label=29;case 29:return Y++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var r=this;t.forEach(function(c,p){var y=vh(c)?c.start:c;p===0?r.ctx.moveTo(y.x,y.y):r.ctx.lineTo(y.x,y.y),vh(c)&&r.ctx.bezierCurveTo(c.startControl.x,c.startControl.y,c.endControl.x,c.endControl.y,c.end.x,c.end.y)})},e.prototype.renderRepeat=function(t,r,c,p){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(c,p),this.ctx.fill(),this.ctx.translate(-c,-p)},e.prototype.resizeImage=function(t,r,c){var p;if(t.width===r&&t.height===c)return t;var y=(p=this.canvas.ownerDocument)!==null&&p!==void 0?p:document,i=y.createElement("canvas");i.width=Math.max(1,r),i.height=Math.max(1,c);var C=i.getContext("2d");return C.drawImage(t,0,0,t.width,t.height,0,0,r,c),i},e.prototype.renderBackgroundImage=function(t){return Ml(this,void 0,void 0,function(){var r,c,p,y,i,C;return il(this,function(D){switch(D.label){case 0:r=t.styles.backgroundImage.length-1,c=function(U){var N,R,G,Et,xe,ze,te,ce,Me,J,Et,xe,ze,te,ce,Y,B,ae,le,Ae,we,me,Pe,it,Me,Ke,Et,oi,Ci,te,ce,ye,xe,ze,Ne,Ge,Ve,Le,Ie,qe,et,vt;return il(this,function(Be){switch(Be.label){case 0:if(U.type!==0)return[3,5];N=void 0,R=U.url,Be.label=1;case 1:return Be.trys.push([1,3,,4]),[4,p.context.cache.match(R)];case 2:return N=Be.sent(),[3,4];case 3:return Be.sent(),p.context.logger.error("Error loading background-image "+R),[3,4];case 4:return N&&(G=xw(t,r,[N.width,N.height,N.width/N.height]),Et=G[0],xe=G[1],ze=G[2],te=G[3],ce=G[4],Me=p.ctx.createPattern(p.resizeImage(N,te,ce),"repeat"),p.renderRepeat(Et,Me,xe,ze)),[3,6];case 5:$D(U)?(J=xw(t,r,[null,null,null]),Et=J[0],xe=J[1],ze=J[2],te=J[3],ce=J[4],Y=HD(U.angle,te,ce),B=Y[0],ae=Y[1],le=Y[2],Ae=Y[3],we=Y[4],me=document.createElement("canvas"),me.width=te,me.height=ce,Pe=me.getContext("2d"),it=Pe.createLinearGradient(ae,Ae,le,we),tE(U.stops,B).forEach(function(dt){return it.addColorStop(dt.stop,ga(dt.color))}),Pe.fillStyle=it,Pe.fillRect(0,0,te,ce),te>0&&ce>0&&(Me=p.ctx.createPattern(me,"repeat"),p.renderRepeat(Et,Me,xe,ze))):ZD(U)&&(Ke=xw(t,r,[null,null,null]),Et=Ke[0],oi=Ke[1],Ci=Ke[2],te=Ke[3],ce=Ke[4],ye=U.position.length===0?[C2]:U.position,xe=Gs(ye[0],te),ze=Gs(ye[ye.length-1],ce),Ne=GD(U,xe,ze,te,ce),Ge=Ne[0],Ve=Ne[1],Ge>0&&Ve>0&&(Le=p.ctx.createRadialGradient(oi+xe,Ci+ze,0,oi+xe,Ci+ze,Ge),tE(U.stops,Ge*2).forEach(function(dt){return Le.addColorStop(dt.stop,ga(dt.color))}),p.path(Et),p.ctx.fillStyle=Le,Ge!==Ve?(Ie=t.bounds.left+.5*t.bounds.width,qe=t.bounds.top+.5*t.bounds.height,et=Ve/Ge,vt=1/et,p.ctx.save(),p.ctx.translate(Ie,qe),p.ctx.transform(1,0,0,et,0,0),p.ctx.translate(-Ie,-qe),p.ctx.fillRect(oi,vt*(Ci-qe)+qe,te,ce*vt),p.ctx.restore()):p.ctx.fill())),Be.label=6;case 6:return r--,[2]}})},p=this,y=0,i=t.styles.backgroundImage.slice(0).reverse(),D.label=1;case 1:return y<i.length?(C=i[y],[5,c(C)]):[3,4];case 2:D.sent(),D.label=3;case 3:return y++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,r,c){return Ml(this,void 0,void 0,function(){return il(this,function(p){return this.path(LE(c,r)),this.ctx.fillStyle=ga(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,r,c,p){return Ml(this,void 0,void 0,function(){var y,i;return il(this,function(C){switch(C.label){case 0:return r<3?[4,this.renderSolidBorder(t,c,p)]:[3,2];case 1:return C.sent(),[2];case 2:return y=Y4(p,c),this.path(y),this.ctx.fillStyle=ga(t),this.ctx.fill(),i=J4(p,c),this.path(i),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Ml(this,void 0,void 0,function(){var r,c,p,y,i,C,D,U,N=this;return il(this,function(R){switch(R.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,c=!tp(r.backgroundColor)||r.backgroundImage.length,p=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],y=hR(Im(r.backgroundClip,0),t.curves),c||r.boxShadow.length?(this.ctx.save(),this.path(y),this.ctx.clip(),tp(r.backgroundColor)||(this.ctx.fillStyle=ga(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:R.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(G){N.ctx.save();var J=lv(t.curves),Y=G.inset?0:aR,B=X4(J,-Y+(G.inset?1:-1)*G.spread.number,(G.inset?1:-1)*G.spread.number,G.spread.number*(G.inset?-2:2),G.spread.number*(G.inset?-2:2));G.inset?(N.path(J),N.ctx.clip(),N.mask(B)):(N.mask(J),N.ctx.clip(),N.path(B)),N.ctx.shadowOffsetX=G.offsetX.number+Y,N.ctx.shadowOffsetY=G.offsetY.number,N.ctx.shadowColor=ga(G.color),N.ctx.shadowBlur=G.blur.number,N.ctx.fillStyle=G.inset?ga(G.color):"rgba(0,0,0,1)",N.ctx.fill(),N.ctx.restore()}),R.label=2;case 2:i=0,C=0,D=p,R.label=3;case 3:return C<D.length?(U=D[C],U.style!==0&&!tp(U.color)&&U.width>0?U.style!==2?[3,5]:[4,this.renderDashedDottedBorder(U.color,U.width,i,t.curves,2)]:[3,11]):[3,13];case 4:return R.sent(),[3,11];case 5:return U.style!==3?[3,7]:[4,this.renderDashedDottedBorder(U.color,U.width,i,t.curves,3)];case 6:return R.sent(),[3,11];case 7:return U.style!==4?[3,9]:[4,this.renderDoubleBorder(U.color,U.width,i,t.curves)];case 8:return R.sent(),[3,11];case 9:return[4,this.renderSolidBorder(U.color,i,t.curves)];case 10:R.sent(),R.label=11;case 11:i++,R.label=12;case 12:return C++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,c,p,y){return Ml(this,void 0,void 0,function(){var i,C,D,U,N,R,G,J,Y,B,ae,le,Ae,we,me,Pe,me,Pe;return il(this,function(it){return this.ctx.save(),i=eR(p,c),C=LE(p,c),y===2&&(this.path(C),this.ctx.clip()),vh(C[0])?(D=C[0].start.x,U=C[0].start.y):(D=C[0].x,U=C[0].y),vh(C[1])?(N=C[1].end.x,R=C[1].end.y):(N=C[1].x,R=C[1].y),c===0||c===2?G=Math.abs(D-N):G=Math.abs(U-R),this.ctx.beginPath(),y===3?this.formatPath(i):this.formatPath(C.slice(0,2)),J=r<3?r*3:r*2,Y=r<3?r*2:r,y===3&&(J=r,Y=r),B=!0,G<=J*2?B=!1:G<=J*2+Y?(ae=G/(2*J+Y),J*=ae,Y*=ae):(le=Math.floor((G+Y)/(J+Y)),Ae=(G-le*J)/(le-1),we=(G-(le+1)*J)/le,Y=we<=0||Math.abs(Y-Ae)<Math.abs(Y-we)?Ae:we),B&&(y===3?this.ctx.setLineDash([0,J+Y]):this.ctx.setLineDash([J,Y])),y===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=ga(t),this.ctx.stroke(),this.ctx.setLineDash([]),y===2&&(vh(C[0])&&(me=C[3],Pe=C[0],this.ctx.beginPath(),this.formatPath([new Rn(me.end.x,me.end.y),new Rn(Pe.start.x,Pe.start.y)]),this.ctx.stroke()),vh(C[1])&&(me=C[1],Pe=C[2],this.ctx.beginPath(),this.formatPath([new Rn(me.end.x,me.end.y),new Rn(Pe.start.x,Pe.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Ml(this,void 0,void 0,function(){var r;return il(this,function(c){switch(c.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=ga(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=q4(t),[4,this.renderStack(r)];case 1:return c.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(FM),cR=function(u){return u instanceof pM||u instanceof dM?!0:u instanceof M2&&u.type!==sv&&u.type!==rv},hR=function(u,e){switch(u){case 0:return lv(e);case 2:return W4(e);case 1:default:return cv(e)}},uR=function(u){switch(u){case 1:return"center";case 2:return"right";case 0:default:return"left"}},AR=["-apple-system","system-ui"],dR=function(u){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?u.filter(function(e){return AR.indexOf(e)===-1}):u},pR=function(u){uu(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.canvas=r.canvas?r.canvas:document.createElement("canvas"),c.ctx=c.canvas.getContext("2d"),c.options=r,c.canvas.width=Math.floor(r.width*r.scale),c.canvas.height=Math.floor(r.height*r.scale),c.canvas.style.width=r.width+"px",c.canvas.style.height=r.height+"px",c.ctx.scale(c.options.scale,c.options.scale),c.ctx.translate(-r.x,-r.y),c.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),c}return e.prototype.render=function(t){return Ml(this,void 0,void 0,function(){var r,c;return il(this,function(p){switch(p.label){case 0:return r=Eb(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,fR(r)];case 1:return c=p.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=ga(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(c,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(FM),fR=function(u){return new Promise(function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(u))})},mR=function(){function u(e){var t=e.id,r=e.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return u.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,M0([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},u.prototype.getTime=function(){return Date.now()-this.start},u.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,M0([this.id,this.getTime()+"ms"],e))},u.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,M0([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},u.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,M0([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},u.instances={},u}(),gR=function(){function u(e,t){var r;this.windowBounds=t,this.instanceName="#"+u.instanceCount++,this.logger=new mR({id:this.instanceName,enabled:e.logging}),this.cache=(r=e.cache)!==null&&r!==void 0?r:new z4(this,e)}return u.instanceCount=1,u}(),PE=function(u,e){return e===void 0&&(e={}),_R(u,e)};typeof window<"u"&&CM.setContext(window);var _R=function(u,e){return Ml(void 0,void 0,void 0,function(){var t,r,c,p,y,i,C,D,U,N,R,G,J,Y,B,ae,le,Ae,we,me,it,Pe,it,Me,Ke,Et,oi,Ci,te,ce,ye,xe,ze,Ne,Ge,Ve,Le,Ie,qe,et;return il(this,function(vt){switch(vt.label){case 0:if(!u||typeof u!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=u.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return c={allowTaint:(Me=e.allowTaint)!==null&&Me!==void 0?Me:!1,imageTimeout:(Ke=e.imageTimeout)!==null&&Ke!==void 0?Ke:15e3,proxy:e.proxy,useCORS:(Et=e.useCORS)!==null&&Et!==void 0?Et:!1},p=ub({logging:(oi=e.logging)!==null&&oi!==void 0?oi:!0,cache:e.cache},c),y={windowWidth:(Ci=e.windowWidth)!==null&&Ci!==void 0?Ci:r.innerWidth,windowHeight:(te=e.windowHeight)!==null&&te!==void 0?te:r.innerHeight,scrollX:(ce=e.scrollX)!==null&&ce!==void 0?ce:r.pageXOffset,scrollY:(ye=e.scrollY)!==null&&ye!==void 0?ye:r.pageYOffset},i=new ZA(y.scrollX,y.scrollY,y.windowWidth,y.windowHeight),C=new gR(p,i),D=(xe=e.foreignObjectRendering)!==null&&xe!==void 0?xe:!1,U={allowTaint:(ze=e.allowTaint)!==null&&ze!==void 0?ze:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:D,copyStyles:D},C.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),N=new ME(C,u,U),R=N.clonedReferenceElement,R?[4,N.toIFrame(t,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return G=vt.sent(),J=I2(R)||x4(R)?X3(R.ownerDocument):Mv(C,R),Y=J.width,B=J.height,ae=J.left,le=J.top,Ae=yR(C,R,e.backgroundColor),we={canvas:e.canvas,backgroundColor:Ae,scale:(Ge=(Ne=e.scale)!==null&&Ne!==void 0?Ne:r.devicePixelRatio)!==null&&Ge!==void 0?Ge:1,x:((Ve=e.x)!==null&&Ve!==void 0?Ve:0)+ae,y:((Le=e.y)!==null&&Le!==void 0?Le:0)+le,width:(Ie=e.width)!==null&&Ie!==void 0?Ie:Math.ceil(Y),height:(qe=e.height)!==null&&qe!==void 0?qe:Math.ceil(B)},D?(C.logger.debug("Document cloned, using foreign object rendering"),it=new pR(C,we),[4,it.render(R)]):[3,3];case 2:return me=vt.sent(),[3,5];case 3:return C.logger.debug("Document cloned, element located at "+ae+","+le+" with size "+Y+"x"+B+" using computed rendering"),C.logger.debug("Starting DOM parsing"),Pe=gM(C,R),Ae===Pe.styles.backgroundColor&&(Pe.styles.backgroundColor=jA.TRANSPARENT),C.logger.debug("Starting renderer for element at "+we.x+","+we.y+" with size "+we.width+"x"+we.height),it=new lR(C,we),[4,it.render(Pe)];case 4:me=vt.sent(),vt.label=5;case 5:return(!((et=e.removeContainer)!==null&&et!==void 0)||et)&&(ME.destroy(G)||C.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),C.logger.debug("Finished rendering"),[2,me]}})})},yR=function(u,e,t){var r=e.ownerDocument,c=r.documentElement?C_(u,getComputedStyle(r.documentElement).backgroundColor):jA.TRANSPARENT,p=r.body?C_(u,getComputedStyle(r.body).backgroundColor):jA.TRANSPARENT,y=typeof t=="string"?C_(u,t):t===null?jA.TRANSPARENT:4294967295;return e===r.documentElement?tp(c)?tp(p)?y:p:c:y};window.queryString=Z3;const nf=class{constructor(){zi(this,"domId","");zi(this,"baseOption",{});zi(this,"nativeFns",{});zi(this,"params",{});zi(this,"_ParseUrl2Params",()=>{let e=R_.parse(window.location.search),t=R_.parse(window.location.hash);return this.params=Object.assign(this.params,e,t),nf._instance});zi(this,"Init",()=>{console.dir(this.nativeFns)});zi(this,"IsPC",()=>{let e=navigator.userAgent,t=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"],r=!0;for(let c=0;c<t.length;c++)if(e.indexOf(t[c])>0){r=!1;break}return r});zi(this,"_OutScreenshot",async function(e=""){$(`#${this.domId} > div`).css("width","100%"),$(`#${this.domId} > div`).css("height","100%"),$(`#${this.domId} > div`).css("overflow","hidden"),$("#bim-cache").css("display","none");let t;if(e!==""&&document.getElementById(e)){let c=document.getElementById(e);t=await PE(c)}t=await PE(document.body);let r=t.toDataURL();return await this._scaleImage(600,r),r});zi(this,"_scaleImage",async function(e=720,t=""){return new Promise((r,c)=>{let p="";if(!t||t==="")r(p);else{let y=document.body.offsetHeight,i=document.body.offsetWidth,C=e,D=e/(i/y),U=document.createElement("canvas");U.width=C,U.height=D;let N=U.getContext("2d"),R=document.createElement("img");R.id="testimg",R.src=t,R.style.width="200px",R.style.position="absolute",R.style.top="0px",R.style.zIndex="9999",R.onload=G=>{console.dir(R),N.drawImage(R,0,0,C,D),U.style.position="absolute",U.style.display="block",U.style.top="0px",U.style.right="0px",U.style.zIndex="10000",U.style.backgroundColor="red",p=U.toDataURL(),r(p)}}})})}static getInstance(){return nf._instance==null&&(nf._instance=new nf),nf._instance}BindFn(e){return this.nativeFns=e,this}};let Nm=nf;zi(Nm,"_instance");const zm=class{constructor(){zi(this,"targetComponentID","")}static getInstance(){return zm._instance==null&&(zm._instance=new zm),zm._instance}BindCbFn(e){return tf.getInstance().Fn,this}};let M_=zm;zi(M_,"_instance");var Ua={exports:{}};(function(u,e){(function({},t){u.exports=t()})(TS,function(){var t,r,c;function p(i,C){if(!t)t=C;else if(!r)r=C;else{var D="var sharedChunk = {}; ("+t+")(sharedChunk); ("+r+")(sharedChunk);",U={};t(U),c=C(U),typeof window<"u"&&(c.workerUrl=window.URL.createObjectURL(new Blob([D],{type:"text/javascript"})))}}p(["exports"],function(i){var C=D;function D(A,l,f,w){this.cx=3*A,this.bx=3*(f-A)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*l,this.by=3*(w-l)-this.cy,this.ay=1-this.cy-this.by,this.p1x=A,this.p1y=l,this.p2x=f,this.p2y=w}function U(A,l,f,w){const I=new C(A,l,f,w);return function(z){return I.solve(z)}}D.prototype={sampleCurveX:function(A){return((this.ax*A+this.bx)*A+this.cx)*A},sampleCurveY:function(A){return((this.ay*A+this.by)*A+this.cy)*A},sampleCurveDerivativeX:function(A){return(3*this.ax*A+2*this.bx)*A+this.cx},solveCurveX:function(A,l){if(l===void 0&&(l=1e-6),A<0)return 0;if(A>1)return 1;for(var f=A,w=0;w<8;w++){var I=this.sampleCurveX(f)-A;if(Math.abs(I)<l)return f;var z=this.sampleCurveDerivativeX(f);if(Math.abs(z)<1e-6)break;f-=I/z}var Q=0,Z=1;for(f=A,w=0;w<20&&(I=this.sampleCurveX(f),!(Math.abs(I-A)<l));w++)A>I?Q=f:Z=f,f=.5*(Z-Q)+Q;return f},solve:function(A,l){return this.sampleCurveY(this.solveCurveX(A,l))}};const N=U(.25,.1,.25,1);function R(A,l,f){return Math.min(f,Math.max(l,A))}function G(A,l,f){const w=f-l,I=((A-l)%w+w)%w+l;return I===l?f:I}function J(A,...l){for(const f of l)for(const w in f)A[w]=f[w];return A}let Y=1;function B(A,l){A.forEach(f=>{l[f]&&(l[f]=l[f].bind(l))})}function ae(A,l,f){const w={};for(const I in A)w[I]=l.call(f||this,A[I],I,A);return w}function le(A,l,f){const w={};for(const I in A)l.call(f||this,A[I],I,A)&&(w[I]=A[I]);return w}function Ae(A){return Array.isArray(A)?A.map(Ae):typeof A=="object"&&A?ae(A,Ae):A}const we={};function me(A){we[A]||(typeof console<"u"&&console.warn(A),we[A]=!0)}function Pe(A,l,f){return(f.y-A.y)*(l.x-A.x)>(l.y-A.y)*(f.x-A.x)}function it(A){let l=0;for(let f,w,I=0,z=A.length,Q=z-1;I<z;Q=I++)f=A[I],w=A[Q],l+=(w.x-f.x)*(f.y+w.y);return l}function Me(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ke(A){const l={};if(A.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(f,w,I,z)=>{const Q=I||z;return l[w]=!Q||Q.toLowerCase(),""}),l["max-age"]){const f=parseInt(l["max-age"],10);isNaN(f)?delete l["max-age"]:l["max-age"]=f}return l}let Et,oi,Ci=null;function te(A){if(Ci==null){const l=A.navigator?A.navigator.userAgent:null;Ci=!!A.safari||!(!l||!(/\b(iPad|iPhone|iPod)\b/.test(l)||l.match("Safari")&&!l.match("Chrome")))}return Ci}function ce(A){return typeof ImageBitmap<"u"&&A instanceof ImageBitmap}const ye={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(A){const l=requestAnimationFrame(A);return{cancel:()=>cancelAnimationFrame(l)}},getImageData(A,l=0){const f=window.document.createElement("canvas"),w=f.getContext("2d");if(!w)throw new Error("failed to create canvas 2d context");return f.width=A.width,f.height=A.height,w.drawImage(A,0,0,A.width,A.height),w.getImageData(-l,-l,A.width+2*l,A.height+2*l)},resolveURL:A=>(Et||(Et=document.createElement("a")),Et.href=A,Et.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(oi==null&&(oi=matchMedia("(prefers-reduced-motion: reduce)")),oi.matches)}};var xe=ze;function ze(A,l){this.x=A,this.y=l}ze.prototype={clone:function(){return new ze(this.x,this.y)},add:function(A){return this.clone()._add(A)},sub:function(A){return this.clone()._sub(A)},multByPoint:function(A){return this.clone()._multByPoint(A)},divByPoint:function(A){return this.clone()._divByPoint(A)},mult:function(A){return this.clone()._mult(A)},div:function(A){return this.clone()._div(A)},rotate:function(A){return this.clone()._rotate(A)},rotateAround:function(A,l){return this.clone()._rotateAround(A,l)},matMult:function(A){return this.clone()._matMult(A)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(A){return this.x===A.x&&this.y===A.y},dist:function(A){return Math.sqrt(this.distSqr(A))},distSqr:function(A){var l=A.x-this.x,f=A.y-this.y;return l*l+f*f},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(A){return Math.atan2(this.y-A.y,this.x-A.x)},angleWith:function(A){return this.angleWithSep(A.x,A.y)},angleWithSep:function(A,l){return Math.atan2(this.x*l-this.y*A,this.x*A+this.y*l)},_matMult:function(A){var l=A[2]*this.x+A[3]*this.y;return this.x=A[0]*this.x+A[1]*this.y,this.y=l,this},_add:function(A){return this.x+=A.x,this.y+=A.y,this},_sub:function(A){return this.x-=A.x,this.y-=A.y,this},_mult:function(A){return this.x*=A,this.y*=A,this},_div:function(A){return this.x/=A,this.y/=A,this},_multByPoint:function(A){return this.x*=A.x,this.y*=A.y,this},_divByPoint:function(A){return this.x/=A.x,this.y/=A.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var A=this.y;return this.y=this.x,this.x=-A,this},_rotate:function(A){var l=Math.cos(A),f=Math.sin(A),w=f*this.x+l*this.y;return this.x=l*this.x-f*this.y,this.y=w,this},_rotateAround:function(A,l){var f=Math.cos(A),w=Math.sin(A),I=l.y+w*(this.x-l.x)+f*(this.y-l.y);return this.x=l.x+f*(this.x-l.x)-w*(this.y-l.y),this.y=I,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ze.convert=function(A){return A instanceof ze?A:Array.isArray(A)?new ze(A[0],A[1]):A};const Ne={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ge="mapbox-tiles";let Ve,Le,Ie=500,qe=50;function et(){typeof caches>"u"||Ve||(Ve=caches.open(Ge))}let vt=1/0;const Be={supported:!1,testSupport:function(A){!Qt&&ut&&(Wt?Nt(A):dt=A)}};let dt,ut,Qt=!1,Wt=!1;function Nt(A){const l=A.createTexture();A.bindTexture(A.TEXTURE_2D,l);try{if(A.texImage2D(A.TEXTURE_2D,0,A.RGBA,A.RGBA,A.UNSIGNED_BYTE,ut),A.isContextLost())return;Be.supported=!0}catch{}A.deleteTexture(l),Qt=!0}typeof document<"u"&&(ut=document.createElement("img"),ut.onload=function(){dt&&Nt(dt),dt=null,Wt=!0},ut.onerror=function(){Qt=!0,dt=null},ut.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ct={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Ct);class Ft extends Error{constructor(l,f,w,I){super(`AJAXError: ${f} (${l}): ${w}`),this.status=l,this.statusText=f,this.url=w,this.body=I}}const Xt=Me()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function mi(A,l){const f=new AbortController,w=new Request(A.url,{method:A.method||"GET",body:A.body,credentials:A.credentials,headers:A.headers,referrer:Xt(),signal:f.signal});let I=!1,z=!1;return A.type==="json"&&w.headers.set("Accept","application/json"),((Q,Z,re)=>{if(z)return;const ge=Date.now();fetch(w).then(Ce=>Ce.ok?((Fe,Oe,je)=>{(A.type==="arrayBuffer"?Fe.arrayBuffer():A.type==="json"?Fe.json():Fe.text()).then($e=>{z||(Oe&&je&&function(Rt,Mt,ri){if(et(),!Ve)return;const gi={status:Mt.status,statusText:Mt.statusText,headers:new Headers};Mt.headers.forEach((ui,Pi)=>gi.headers.set(Pi,ui));const ei=Ke(Mt.headers.get("Cache-Control")||"");ei["no-store"]||(ei["max-age"]&&gi.headers.set("Expires",new Date(ri+1e3*ei["max-age"]).toUTCString()),new Date(gi.headers.get("Expires")).getTime()-ri<42e4||function(ui,Pi){if(Le===void 0)try{new Response(new ReadableStream),Le=!0}catch{Le=!1}Le?Pi(ui.body):ui.blob().then(Pi)}(Mt,ui=>{const Pi=new Response(ui,gi);et(),Ve&&Ve.then(Fi=>Fi.put(function(Sn){const fn=Sn.indexOf("?");return fn<0?Sn:Sn.slice(0,fn)}(Rt.url),Pi)).catch(Fi=>me(Fi.message))}))}(w,Oe,je),I=!0,l(null,$e,Fe.headers.get("Cache-Control"),Fe.headers.get("Expires")))}).catch($e=>{z||l(new Error($e.message))})})(Ce,null,ge):Ce.blob().then(Fe=>l(new Ft(Ce.status,Ce.statusText,A.url,Fe)))).catch(Ce=>{Ce.code!==20&&l(new Error(Ce.message))})})(),{cancel:()=>{z=!0,I||f.abort()}}}const fi=function(A,l){if(/:\/\//.test(A.url)&&!/^https?:|^file:/.test(A.url)){if(Me()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",A,l);if(!Me()){const w=A.url.substring(0,A.url.indexOf("://"));return(Ne.REGISTERED_PROTOCOLS[w]||mi)(A,l)}}if(!(/^file:/.test(f=A.url)||/^file:/.test(Xt())&&!/^\w+:/.test(f))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return mi(A,l);if(Me()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",A,l,void 0,!0)}var f;return function(w,I){const z=new XMLHttpRequest;z.open(w.method||"GET",w.url,!0),w.type==="arrayBuffer"&&(z.responseType="arraybuffer");for(const Q in w.headers)z.setRequestHeader(Q,w.headers[Q]);return w.type==="json"&&(z.responseType="text",z.setRequestHeader("Accept","application/json")),z.withCredentials=w.credentials==="include",z.onerror=()=>{I(new Error(z.statusText))},z.onload=()=>{if((z.status>=200&&z.status<300||z.status===0)&&z.response!==null){let Q=z.response;if(w.type==="json")try{Q=JSON.parse(z.response)}catch(Z){return I(Z)}I(null,Q,z.getResponseHeader("Cache-Control"),z.getResponseHeader("Expires"))}else{const Q=new Blob([z.response],{type:z.getResponseHeader("Content-Type")});I(new Ft(z.status,z.statusText,w.url,Q))}},z.send(w.body),{cancel:()=>z.abort()}}(A,l)},Gi=function(A,l){return fi(J(A,{type:"arrayBuffer"}),l)};function wn(A){const l=window.document.createElement("a");return l.href=A,l.protocol===window.document.location.protocol&&l.host===window.document.location.host}const Qi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Gn,kn;Gn=[],kn=0;const yt=function(A,l){if(Be.supported&&(A.headers||(A.headers={}),A.headers.accept="image/webp,*/*"),kn>=Ne.MAX_PARALLEL_IMAGE_REQUESTS){const z={requestParameters:A,callback:l,cancelled:!1,cancel(){this.cancelled=!0}};return Gn.push(z),z}kn++;let f=!1;const w=()=>{if(!f)for(f=!0,kn--;Gn.length&&kn<Ne.MAX_PARALLEL_IMAGE_REQUESTS;){const z=Gn.shift(),{requestParameters:Q,callback:Z,cancelled:re}=z;re||(z.cancel=yt(Q,Z).cancel)}},I=Gi(A,(z,Q,Z,re)=>{w(),z?l(z):Q&&function(ge,Ce){typeof createImageBitmap=="function"?function(Fe,Oe){const je=new Blob([new Uint8Array(Fe)],{type:"image/png"});createImageBitmap(je).then($e=>{Oe(null,$e)}).catch($e=>{Oe(new Error(`Could not load image because of ${$e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(ge,Ce):function(Fe,Oe){const je=new Image;je.onload=()=>{Oe(null,je),URL.revokeObjectURL(je.src),je.onload=null,window.requestAnimationFrame(()=>{je.src=Qi})},je.onerror=()=>Oe(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const $e=new Blob([new Uint8Array(Fe)],{type:"image/png"});je.src=Fe.byteLength?URL.createObjectURL($e):Qi}(ge,Ce)}(Q,(ge,Ce)=>{ge!=null?l(ge):Ce!=null&&l(null,Ce,{cacheControl:Z,expires:re})})});return{cancel:()=>{I.cancel(),w()}}};function st(A,l,f){f[A]&&f[A].indexOf(l)!==-1||(f[A]=f[A]||[],f[A].push(l))}function ti(A,l,f){if(f&&f[A]){const w=f[A].indexOf(l);w!==-1&&f[A].splice(w,1)}}class Ni{constructor(l,f={}){J(this,f),this.type=l}}class qi extends Ni{constructor(l,f={}){super("error",J({error:l},f))}}class en{on(l,f){return this._listeners=this._listeners||{},st(l,f,this._listeners),this}off(l,f){return ti(l,f,this._listeners),ti(l,f,this._oneTimeListeners),this}once(l,f){return this._oneTimeListeners=this._oneTimeListeners||{},st(l,f,this._oneTimeListeners),this}fire(l,f){typeof l=="string"&&(l=new Ni(l,f||{}));const w=l.type;if(this.listens(w)){l.target=this;const I=this._listeners&&this._listeners[w]?this._listeners[w].slice():[];for(const Z of I)Z.call(this,l);const z=this._oneTimeListeners&&this._oneTimeListeners[w]?this._oneTimeListeners[w].slice():[];for(const Z of z)ti(w,Z,this._oneTimeListeners),Z.call(this,l);const Q=this._eventedParent;Q&&(J(l,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),Q.fire(l))}else l instanceof qi&&console.error(l.error);return this}listens(l){return this._listeners&&this._listeners[l]&&this._listeners[l].length>0||this._oneTimeListeners&&this._oneTimeListeners[l]&&this._oneTimeListeners[l].length>0||this._eventedParent&&this._eventedParent.listens(l)}setEventedParent(l,f){return this._eventedParent=l,this._eventedParentData=f,this}}var $t={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class at{constructor(l,f,w,I){this.message=(l?`${l}: `:"")+w,I&&(this.identifier=I),f!=null&&f.__line__&&(this.line=f.__line__)}}function ii(A){const l=A.value;return l?[new at(A.key,l,"constants have been deprecated as of v8")]:[]}function hn(A,...l){for(const f of l)for(const w in f)A[w]=f[w];return A}function Xi(A){return A instanceof Number||A instanceof String||A instanceof Boolean?A.valueOf():A}function on(A){if(Array.isArray(A))return A.map(on);if(A instanceof Object&&!(A instanceof Number||A instanceof String||A instanceof Boolean)){const l={};for(const f in A)l[f]=on(A[f]);return l}return Xi(A)}class Cn extends Error{constructor(l,f){super(f),this.message=f,this.key=l}}class Tn{constructor(l,f=[]){this.parent=l,this.bindings={};for(const[w,I]of f)this.bindings[w]=I}concat(l){return new Tn(this,l)}get(l){if(this.bindings[l])return this.bindings[l];if(this.parent)return this.parent.get(l);throw new Error(`${l} not found in scope.`)}has(l){return!!this.bindings[l]||!!this.parent&&this.parent.has(l)}}const nr={kind:"null"},Ii={kind:"number"},bn={kind:"string"},Ot={kind:"boolean"},vi={kind:"color"},Wi={kind:"object"},Ui={kind:"value"},Pn={kind:"collator"},qn={kind:"formatted"},Hr={kind:"padding"},fr={kind:"resolvedImage"};function kr(A,l){return{kind:"array",itemType:A,N:l}}function Qn(A){if(A.kind==="array"){const l=Qn(A.itemType);return typeof A.N=="number"?`array<${l}, ${A.N}>`:A.itemType.kind==="value"?"array":`array<${l}>`}return A.kind}const zs=[nr,Ii,bn,Ot,vi,qn,Wi,kr(Ui),Hr,fr];function ot(A,l){if(l.kind==="error")return null;if(A.kind==="array"){if(l.kind==="array"&&(l.N===0&&l.itemType.kind==="value"||!ot(A.itemType,l.itemType))&&(typeof A.N!="number"||A.N===l.N))return null}else{if(A.kind===l.kind)return null;if(A.kind==="value"){for(const f of zs)if(!ot(f,l))return null}}return`Expected ${Qn(A)} but found ${Qn(l)} instead.`}function Ee(A,l){return l.some(f=>f.kind===A.kind)}function Ue(A,l){return l.some(f=>f==="null"?A===null:f==="array"?Array.isArray(A):f==="object"?A&&!Array.isArray(A)&&typeof A=="object":f===typeof A)}var ct,wt={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function X(A){return(A=Math.round(A))<0?0:A>255?255:A}function j(A){return X(A[A.length-1]==="%"?parseFloat(A)/100*255:parseInt(A))}function ie(A){return(l=A[A.length-1]==="%"?parseFloat(A)/100:parseFloat(A))<0?0:l>1?1:l;var l}function ne(A,l,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?A+(l-A)*f*6:2*f<1?l:3*f<2?A+(l-A)*(2/3-f)*6:A}try{ct={}.parseCSSColor=function(A){var l,f=A.replace(/ /g,"").toLowerCase();if(f in wt)return wt[f].slice();if(f[0]==="#")return f.length===4?(l=parseInt(f.substr(1),16))>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null:f.length===7&&(l=parseInt(f.substr(1),16))>=0&&l<=16777215?[(16711680&l)>>16,(65280&l)>>8,255&l,1]:null;var w=f.indexOf("("),I=f.indexOf(")");if(w!==-1&&I+1===f.length){var z=f.substr(0,w),Q=f.substr(w+1,I-(w+1)).split(","),Z=1;switch(z){case"rgba":if(Q.length!==4)return null;Z=ie(Q.pop());case"rgb":return Q.length!==3?null:[j(Q[0]),j(Q[1]),j(Q[2]),Z];case"hsla":if(Q.length!==4)return null;Z=ie(Q.pop());case"hsl":if(Q.length!==3)return null;var re=(parseFloat(Q[0])%360+360)%360/360,ge=ie(Q[1]),Ce=ie(Q[2]),Fe=Ce<=.5?Ce*(ge+1):Ce+ge-Ce*ge,Oe=2*Ce-Fe;return[X(255*ne(Oe,Fe,re+1/3)),X(255*ne(Oe,Fe,re)),X(255*ne(Oe,Fe,re-1/3)),Z];default:return null}}return null}}catch{}class de{constructor(l,f,w,I=1){this.r=l,this.g=f,this.b=w,this.a=I}static parse(l){if(!l)return;if(l instanceof de)return l;if(typeof l!="string")return;const f=ct(l);return f?new de(f[0]/255*f[3],f[1]/255*f[3],f[2]/255*f[3],f[3]):void 0}toString(){const[l,f,w,I]=this.toArray();return`rgba(${Math.round(l)},${Math.round(f)},${Math.round(w)},${I})`}toArray(){const{r:l,g:f,b:w,a:I}=this;return I===0?[0,0,0,0]:[255*l/I,255*f/I,255*w/I,I]}}de.black=new de(0,0,0,1),de.white=new de(1,1,1,1),de.transparent=new de(0,0,0,0),de.red=new de(1,0,0,1);class Re{constructor(l,f,w){this.sensitivity=l?f?"variant":"case":f?"accent":"base",this.locale=w,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(l,f){return this.collator.compare(l,f)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class tt{constructor(l,f,w,I,z){this.text=l,this.image=f,this.scale=w,this.fontStack=I,this.textColor=z}}class He{constructor(l){this.sections=l}static fromString(l){return new He([new tt(l,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(l=>l.text.length!==0||l.image&&l.image.name.length!==0)}static factory(l){return l instanceof He?l:He.fromString(l)}toString(){return this.sections.length===0?"":this.sections.map(l=>l.text).join("")}}class Je{constructor(l){this.values=l.slice()}static parse(l){if(l instanceof Je)return l;if(typeof l=="number")return new Je([l,l,l,l]);if(Array.isArray(l)&&!(l.length<1||l.length>4)){for(const f of l)if(typeof f!="number")return;switch(l.length){case 1:l=[l[0],l[0],l[0],l[0]];break;case 2:l=[l[0],l[1],l[0],l[1]];break;case 3:l=[l[0],l[1],l[2],l[1]]}return new Je(l)}}toString(){return JSON.stringify(this.values)}}class pt{constructor(l){this.name=l.name,this.available=l.available}toString(){return this.name}static fromString(l){return l?new pt({name:l,available:!1}):null}}function Lt(A,l,f,w){return typeof A=="number"&&A>=0&&A<=255&&typeof l=="number"&&l>=0&&l<=255&&typeof f=="number"&&f>=0&&f<=255?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid rgba value [${[A,l,f,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof w=="number"?[A,l,f,w]:[A,l,f]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function jt(A){if(A===null||typeof A=="string"||typeof A=="boolean"||typeof A=="number"||A instanceof de||A instanceof Re||A instanceof He||A instanceof Je||A instanceof pt)return!0;if(Array.isArray(A)){for(const l of A)if(!jt(l))return!1;return!0}if(typeof A=="object"){for(const l in A)if(!jt(A[l]))return!1;return!0}return!1}function Gt(A){if(A===null)return nr;if(typeof A=="string")return bn;if(typeof A=="boolean")return Ot;if(typeof A=="number")return Ii;if(A instanceof de)return vi;if(A instanceof Re)return Pn;if(A instanceof He)return qn;if(A instanceof Je)return Hr;if(A instanceof pt)return fr;if(Array.isArray(A)){const l=A.length;let f;for(const w of A){const I=Gt(w);if(f){if(f===I)continue;f=Ui;break}f=I}return kr(f||Ui,l)}return Wi}function ki(A){const l=typeof A;return A===null?"":l==="string"||l==="number"||l==="boolean"?String(A):A instanceof de||A instanceof He||A instanceof Je||A instanceof pt?A.toString():JSON.stringify(A)}class wi{constructor(l,f){this.type=l,this.value=f}static parse(l,f){if(l.length!==2)return f.error(`'literal' expression requires exactly one argument, but found ${l.length-1} instead.`);if(!jt(l[1]))return f.error("invalid value");const w=l[1];let I=Gt(w);const z=f.expectedType;return I.kind!=="array"||I.N!==0||!z||z.kind!=="array"||typeof z.N=="number"&&z.N!==0||(I=z),new wi(I,w)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Oi{constructor(l){this.name="ExpressionEvaluationError",this.message=l}toJSON(){return this.message}}const Yi={string:bn,number:Ii,boolean:Ot,object:Wi};class tn{constructor(l,f){this.type=l,this.args=f}static parse(l,f){if(l.length<2)return f.error("Expected at least one argument.");let w,I=1;const z=l[0];if(z==="array"){let Z,re;if(l.length>2){const ge=l[1];if(typeof ge!="string"||!(ge in Yi)||ge==="object")return f.error('The item type argument of "array" must be one of string, number, boolean',1);Z=Yi[ge],I++}else Z=Ui;if(l.length>3){if(l[2]!==null&&(typeof l[2]!="number"||l[2]<0||l[2]!==Math.floor(l[2])))return f.error('The length argument to "array" must be a positive integer literal',2);re=l[2],I++}w=kr(Z,re)}else{if(!Yi[z])throw new Error(`Types doesn't contain name = ${z}`);w=Yi[z]}const Q=[];for(;I<l.length;I++){const Z=f.parse(l[I],I,Ui);if(!Z)return null;Q.push(Z)}return new tn(w,Q)}evaluate(l){for(let f=0;f<this.args.length;f++){const w=this.args[f].evaluate(l);if(!ot(this.type,Gt(w)))return w;if(f===this.args.length-1)throw new Oi(`Expected value to be of type ${Qn(this.type)}, but found ${Qn(Gt(w))} instead.`)}throw new Error}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}}const rr={"to-boolean":Ot,"to-color":vi,"to-number":Ii,"to-string":bn};class yn{constructor(l,f){this.type=l,this.args=f}static parse(l,f){if(l.length<2)return f.error("Expected at least one argument.");const w=l[0];if(!rr[w])throw new Error(`Can't parse ${w} as it is not part of the known types`);if((w==="to-boolean"||w==="to-string")&&l.length!==2)return f.error("Expected one argument.");const I=rr[w],z=[];for(let Q=1;Q<l.length;Q++){const Z=f.parse(l[Q],Q,Ui);if(!Z)return null;z.push(Z)}return new yn(I,z)}evaluate(l){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(l));if(this.type.kind==="color"){let f,w;for(const I of this.args){if(f=I.evaluate(l),w=null,f instanceof de)return f;if(typeof f=="string"){const z=l.parseColor(f);if(z)return z}else if(Array.isArray(f)&&(w=f.length<3||f.length>4?`Invalid rbga value ${JSON.stringify(f)}: expected an array containing either three or four numeric values.`:Lt(f[0],f[1],f[2],f[3]),!w))return new de(f[0]/255,f[1]/255,f[2]/255,f[3])}throw new Oi(w||`Could not parse color from value '${typeof f=="string"?f:JSON.stringify(f)}'`)}if(this.type.kind==="padding"){let f;for(const w of this.args){f=w.evaluate(l);const I=Je.parse(f);if(I)return I}throw new Oi(`Could not parse padding from value '${typeof f=="string"?f:JSON.stringify(f)}'`)}if(this.type.kind==="number"){let f=null;for(const w of this.args){if(f=w.evaluate(l),f===null)return 0;const I=Number(f);if(!isNaN(I))return I}throw new Oi(`Could not convert ${JSON.stringify(f)} to number.`)}return this.type.kind==="formatted"?He.fromString(ki(this.args[0].evaluate(l))):this.type.kind==="resolvedImage"?pt.fromString(ki(this.args[0].evaluate(l))):ki(this.args[0].evaluate(l))}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}}const Yt=["Unknown","Point","LineString","Polygon"];class sr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Yt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(l){let f=this._parseColorCache[l];return f||(f=this._parseColorCache[l]=de.parse(l)),f}}class Yn{constructor(l,f,w,I){this.name=l,this.type=f,this._evaluate=w,this.args=I}evaluate(l){return this._evaluate(l,this.args)}eachChild(l){this.args.forEach(l)}outputDefined(){return!1}static parse(l,f){const w=l[0],I=Yn.definitions[w];if(!I)return f.error(`Unknown expression "${w}". If you wanted a literal array, use ["literal", [...]].`,0);const z=Array.isArray(I)?I[0]:I.type,Q=Array.isArray(I)?[[I[1],I[2]]]:I.overloads,Z=Q.filter(([ge])=>!Array.isArray(ge)||ge.length===l.length-1);let re=null;for(const[ge,Ce]of Z){re=new Ol(f.registry,f.path,null,f.scope);const Fe=[];let Oe=!1;for(let je=1;je<l.length;je++){const $e=l[je],Rt=Array.isArray(ge)?ge[je-1]:ge.type,Mt=re.parse($e,1+Fe.length,Rt);if(!Mt){Oe=!0;break}Fe.push(Mt)}if(!Oe)if(Array.isArray(ge)&&ge.length!==Fe.length)re.error(`Expected ${ge.length} arguments, but found ${Fe.length} instead.`);else{for(let je=0;je<Fe.length;je++){const $e=Array.isArray(ge)?ge[je]:ge.type,Rt=Fe[je];re.concat(je+1).checkSubtype($e,Rt.type)}if(re.errors.length===0)return new Yn(w,z,Ce,Fe)}}if(Z.length===1)f.errors.push(...re.errors);else{const ge=(Z.length?Z:Q).map(([Fe])=>{return Oe=Fe,Array.isArray(Oe)?`(${Oe.map(Qn).join(", ")})`:`(${Qn(Oe.type)}...)`;var Oe}).join(" | "),Ce=[];for(let Fe=1;Fe<l.length;Fe++){const Oe=f.parse(l[Fe],1+Ce.length);if(!Oe)return null;Ce.push(Qn(Oe.type))}f.error(`Expected arguments of type ${ge}, but found (${Ce.join(", ")}) instead.`)}return null}static register(l,f){Yn.definitions=f;for(const w in f)l[w]=Yn}}class Wr{constructor(l,f,w){this.type=Pn,this.locale=w,this.caseSensitive=l,this.diacriticSensitive=f}static parse(l,f){if(l.length!==2)return f.error("Expected one argument.");const w=l[1];if(typeof w!="object"||Array.isArray(w))return f.error("Collator options argument must be an object.");const I=f.parse(w["case-sensitive"]!==void 0&&w["case-sensitive"],1,Ot);if(!I)return null;const z=f.parse(w["diacritic-sensitive"]!==void 0&&w["diacritic-sensitive"],1,Ot);if(!z)return null;let Q=null;return w.locale&&(Q=f.parse(w.locale,1,bn),!Q)?null:new Wr(I,z,Q)}evaluate(l){return new Re(this.caseSensitive.evaluate(l),this.diacriticSensitive.evaluate(l),this.locale?this.locale.evaluate(l):null)}eachChild(l){l(this.caseSensitive),l(this.diacriticSensitive),this.locale&&l(this.locale)}outputDefined(){return!1}}const mr=8192;function Mr(A,l){A[0]=Math.min(A[0],l[0]),A[1]=Math.min(A[1],l[1]),A[2]=Math.max(A[2],l[0]),A[3]=Math.max(A[3],l[1])}function Oo(A,l){return!(A[0]<=l[0]||A[2]>=l[2]||A[1]<=l[1]||A[3]>=l[3])}function ks(A,l){const f=(180+A[0])/360,w=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+A[1]*Math.PI/360)))/360,I=Math.pow(2,l.z);return[Math.round(f*I*mr),Math.round(w*I*mr)]}function or(A,l,f){const w=A[0]-l[0],I=A[1]-l[1],z=A[0]-f[0],Q=A[1]-f[1];return w*Q-z*I==0&&w*z<=0&&I*Q<=0}function rn(A,l){let f=!1;for(let Q=0,Z=l.length;Q<Z;Q++){const re=l[Q];for(let ge=0,Ce=re.length;ge<Ce-1;ge++){if(or(A,re[ge],re[ge+1]))return!1;(I=re[ge])[1]>(w=A)[1]!=(z=re[ge+1])[1]>w[1]&&w[0]<(z[0]-I[0])*(w[1]-I[1])/(z[1]-I[1])+I[0]&&(f=!f)}}var w,I,z;return f}function cr(A,l){for(let f=0;f<l.length;f++)if(rn(A,l[f]))return!0;return!1}function Ar(A,l,f,w){const I=w[0]-f[0],z=w[1]-f[1],Q=(A[0]-f[0])*z-I*(A[1]-f[1]),Z=(l[0]-f[0])*z-I*(l[1]-f[1]);return Q>0&&Z<0||Q<0&&Z>0}function la(A,l,f){for(const ge of f)for(let Ce=0;Ce<ge.length-1;++Ce)if((Z=[(Q=ge[Ce+1])[0]-(z=ge[Ce])[0],Q[1]-z[1]])[0]*(re=[(I=l)[0]-(w=A)[0],I[1]-w[1]])[1]-Z[1]*re[0]!=0&&Ar(w,I,z,Q)&&Ar(z,Q,w,I))return!0;var w,I,z,Q,Z,re;return!1}function al(A,l){for(let f=0;f<A.length;++f)if(!rn(A[f],l))return!1;for(let f=0;f<A.length-1;++f)if(la(A[f],A[f+1],l))return!1;return!0}function dr(A,l){for(let f=0;f<l.length;f++)if(al(A,l[f]))return!0;return!1}function Ul(A,l,f){const w=[];for(let I=0;I<A.length;I++){const z=[];for(let Q=0;Q<A[I].length;Q++){const Z=ks(A[I][Q],f);Mr(l,Z),z.push(Z)}w.push(z)}return w}function Rl(A,l,f){const w=[];for(let I=0;I<A.length;I++){const z=Ul(A[I],l,f);w.push(z)}return w}function ll(A,l,f,w){if(A[0]<f[0]||A[0]>f[2]){const I=.5*w;let z=A[0]-f[0]>I?-w:f[0]-A[0]>I?w:0;z===0&&(z=A[0]-f[2]>I?-w:f[2]-A[0]>I?w:0),A[0]+=z}Mr(l,A)}function qs(A,l,f,w){const I=Math.pow(2,w.z)*mr,z=[w.x*mr,w.y*mr],Q=[];for(const Z of A)for(const re of Z){const ge=[re.x+z[0],re.y+z[1]];ll(ge,l,f,I),Q.push(ge)}return Q}function hs(A,l,f,w){const I=Math.pow(2,w.z)*mr,z=[w.x*mr,w.y*mr],Q=[];for(const re of A){const ge=[];for(const Ce of re){const Fe=[Ce.x+z[0],Ce.y+z[1]];Mr(l,Fe),ge.push(Fe)}Q.push(ge)}if(l[2]-l[0]<=I/2){(Z=l)[0]=Z[1]=1/0,Z[2]=Z[3]=-1/0;for(const re of Q)for(const ge of re)ll(ge,l,f,I)}var Z;return Q}class ho{constructor(l,f){this.type=Ot,this.geojson=l,this.geometries=f}static parse(l,f){if(l.length!==2)return f.error(`'within' expression requires exactly one argument, but found ${l.length-1} instead.`);if(jt(l[1])){const w=l[1];if(w.type==="FeatureCollection")for(let I=0;I<w.features.length;++I){const z=w.features[I].geometry.type;if(z==="Polygon"||z==="MultiPolygon")return new ho(w,w.features[I].geometry)}else if(w.type==="Feature"){const I=w.geometry.type;if(I==="Polygon"||I==="MultiPolygon")return new ho(w,w.geometry)}else if(w.type==="Polygon"||w.type==="MultiPolygon")return new ho(w,w)}return f.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(l){if(l.geometry()!=null&&l.canonicalID()!=null){if(l.geometryType()==="Point")return function(f,w){const I=[1/0,1/0,-1/0,-1/0],z=[1/0,1/0,-1/0,-1/0],Q=f.canonicalID();if(w.type==="Polygon"){const Z=Ul(w.coordinates,z,Q),re=qs(f.geometry(),I,z,Q);if(!Oo(I,z))return!1;for(const ge of re)if(!rn(ge,Z))return!1}if(w.type==="MultiPolygon"){const Z=Rl(w.coordinates,z,Q),re=qs(f.geometry(),I,z,Q);if(!Oo(I,z))return!1;for(const ge of re)if(!cr(ge,Z))return!1}return!0}(l,this.geometries);if(l.geometryType()==="LineString")return function(f,w){const I=[1/0,1/0,-1/0,-1/0],z=[1/0,1/0,-1/0,-1/0],Q=f.canonicalID();if(w.type==="Polygon"){const Z=Ul(w.coordinates,z,Q),re=hs(f.geometry(),I,z,Q);if(!Oo(I,z))return!1;for(const ge of re)if(!al(ge,Z))return!1}if(w.type==="MultiPolygon"){const Z=Rl(w.coordinates,z,Q),re=hs(f.geometry(),I,z,Q);if(!Oo(I,z))return!1;for(const ge of re)if(!dr(ge,Z))return!1}return!0}(l,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function cl(A){if(A instanceof Yn&&(A.name==="get"&&A.args.length===1||A.name==="feature-state"||A.name==="has"&&A.args.length===1||A.name==="properties"||A.name==="geometry-type"||A.name==="id"||/^filter-/.test(A.name))||A instanceof ho)return!1;let l=!0;return A.eachChild(f=>{l&&!cl(f)&&(l=!1)}),l}function Na(A){if(A instanceof Yn&&A.name==="feature-state")return!1;let l=!0;return A.eachChild(f=>{l&&!Na(f)&&(l=!1)}),l}function zl(A,l){if(A instanceof Yn&&l.indexOf(A.name)>=0)return!1;let f=!0;return A.eachChild(w=>{f&&!zl(w,l)&&(f=!1)}),f}class kl{constructor(l,f){this.type=f.type,this.name=l,this.boundExpression=f}static parse(l,f){if(l.length!==2||typeof l[1]!="string")return f.error("'var' expression requires exactly one string literal argument.");const w=l[1];return f.scope.has(w)?new kl(w,f.scope.get(w)):f.error(`Unknown variable "${w}". Make sure "${w}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(l){return this.boundExpression.evaluate(l)}eachChild(){}outputDefined(){return!1}}class Ol{constructor(l,f=[],w,I=new Tn,z=[]){this.registry=l,this.path=f,this.key=f.map(Q=>`[${Q}]`).join(""),this.scope=I,this.errors=z,this.expectedType=w}parse(l,f,w,I,z={}){return f?this.concat(f,w,I)._parse(l,z):this._parse(l,z)}_parse(l,f){function w(I,z,Q){return Q==="assert"?new tn(z,[I]):Q==="coerce"?new yn(z,[I]):I}if(l!==null&&typeof l!="string"&&typeof l!="boolean"&&typeof l!="number"||(l=["literal",l]),Array.isArray(l)){if(l.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const I=l[0];if(typeof I!="string")return this.error(`Expression name must be a string, but found ${typeof I} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const z=this.registry[I];if(z){let Q=z.parse(l,this);if(!Q)return null;if(this.expectedType){const Z=this.expectedType,re=Q.type;if(Z.kind!=="string"&&Z.kind!=="number"&&Z.kind!=="boolean"&&Z.kind!=="object"&&Z.kind!=="array"||re.kind!=="value")if(Z.kind!=="color"&&Z.kind!=="formatted"&&Z.kind!=="resolvedImage"||re.kind!=="value"&&re.kind!=="string")if(Z.kind!=="padding"||re.kind!=="value"&&re.kind!=="number"&&re.kind!=="array"){if(this.checkSubtype(Z,re))return null}else Q=w(Q,Z,f.typeAnnotation||"coerce");else Q=w(Q,Z,f.typeAnnotation||"coerce");else Q=w(Q,Z,f.typeAnnotation||"assert")}if(!(Q instanceof wi)&&Q.type.kind!=="resolvedImage"&&Qa(Q)){const Z=new sr;try{Q=new wi(Q.type,Q.evaluate(Z))}catch(re){return this.error(re.message),null}}return Q}return this.error(`Unknown expression "${I}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(l===void 0?"'undefined' value invalid. Use null instead.":typeof l=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof l} instead.`)}concat(l,f,w){const I=typeof l=="number"?this.path.concat(l):this.path,z=w?this.scope.concat(w):this.scope;return new Ol(this.registry,I,f||null,z,this.errors)}error(l,...f){const w=`${this.key}${f.map(I=>`[${I}]`).join("")}`;this.errors.push(new Cn(w,l))}checkSubtype(l,f){const w=ot(l,f);return w&&this.error(w),w}}function Qa(A){if(A instanceof kl)return Qa(A.boundExpression);if(A instanceof Yn&&A.name==="error"||A instanceof Wr||A instanceof ho)return!1;const l=A instanceof yn||A instanceof tn;let f=!0;return A.eachChild(w=>{f=l?f&&Qa(w):f&&w instanceof wi}),!!f&&cl(A)&&zl(A,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Nl(A,l){const f=A.length-1;let w,I,z=0,Q=f,Z=0;for(;z<=Q;)if(Z=Math.floor((z+Q)/2),w=A[Z],I=A[Z+1],w<=l){if(Z===f||l<I)return Z;z=Z+1}else{if(!(w>l))throw new Oi("Input is not a number.");Q=Z-1}return 0}class Ql{constructor(l,f,w){this.type=l,this.input=f,this.labels=[],this.outputs=[];for(const[I,z]of w)this.labels.push(I),this.outputs.push(z)}static parse(l,f){if(l.length-1<4)return f.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return f.error("Expected an even number of arguments.");const w=f.parse(l[1],1,Ii);if(!w)return null;const I=[];let z=null;f.expectedType&&f.expectedType.kind!=="value"&&(z=f.expectedType);for(let Q=1;Q<l.length;Q+=2){const Z=Q===1?-1/0:l[Q],re=l[Q+1],ge=Q,Ce=Q+1;if(typeof Z!="number")return f.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',ge);if(I.length&&I[I.length-1][0]>=Z)return f.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',ge);const Fe=f.parse(re,Ce,z);if(!Fe)return null;z=z||Fe.type,I.push([Z,Fe])}return new Ql(z,w,I)}evaluate(l){const f=this.labels,w=this.outputs;if(f.length===1)return w[0].evaluate(l);const I=this.input.evaluate(l);if(I<=f[0])return w[0].evaluate(l);const z=f.length;return I>=f[z-1]?w[z-1].evaluate(l):w[Nl(f,I)].evaluate(l)}eachChild(l){l(this.input);for(const f of this.outputs)l(f)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}}function ns(A,l,f){return A*(1-f)+l*f}var Ys=Object.freeze({__proto__:null,number:ns,color:function(A,l,f){return new de(ns(A.r,l.r,f),ns(A.g,l.g,f),ns(A.b,l.b,f),ns(A.a,l.a,f))},array:function(A,l,f){return A.map((w,I)=>ns(w,l[I],f))},padding:function(A,l,f){const w=A.values,I=l.values;return new Je([ns(w[0],I[0],f),ns(w[1],I[1],f),ns(w[2],I[2],f),ns(w[3],I[3],f)])}});const fs=.95047,Rc=1.08883,Eh=4/29,Os=6/29,No=3*Os*Os,ed=Math.PI/180,pu=180/Math.PI;function Cs(A){return A>.008856451679035631?Math.pow(A,1/3):A/No+Eh}function rc(A){return A>Os?A*A*A:No*(A-Eh)}function Th(A){return 255*(A<=.0031308?12.92*A:1.055*Math.pow(A,1/2.4)-.055)}function sc(A){return(A/=255)<=.04045?A/12.92:Math.pow((A+.055)/1.055,2.4)}function er(A){const l=sc(A.r),f=sc(A.g),w=sc(A.b),I=Cs((.4124564*l+.3575761*f+.1804375*w)/fs),z=Cs((.2126729*l+.7151522*f+.072175*w)/1);return{l:116*z-16,a:500*(I-z),b:200*(z-Cs((.0193339*l+.119192*f+.9503041*w)/Rc)),alpha:A.a}}function oc(A){let l=(A.l+16)/116,f=isNaN(A.a)?l:l+A.a/500,w=isNaN(A.b)?l:l-A.b/200;return l=1*rc(l),f=fs*rc(f),w=Rc*rc(w),new de(Th(3.2404542*f-1.5371385*l-.4985314*w),Th(-.969266*f+1.8760108*l+.041556*w),Th(.0556434*f-.2040259*l+1.0572252*w),A.alpha)}function Ju(A,l,f){const w=l-A;return A+f*(w>180||w<-180?w-360*Math.round(w/360):w)}const Qo={forward:er,reverse:oc,interpolate:function(A,l,f){return{l:ns(A.l,l.l,f),a:ns(A.a,l.a,f),b:ns(A.b,l.b,f),alpha:ns(A.alpha,l.alpha,f)}}},hl={forward:function(A){const{l,a:f,b:w}=er(A),I=Math.atan2(w,f)*pu;return{h:I<0?I+360:I,c:Math.sqrt(f*f+w*w),l,alpha:A.a}},reverse:function(A){const l=A.h*ed,f=A.c;return oc({l:A.l,a:Math.cos(l)*f,b:Math.sin(l)*f,alpha:A.alpha})},interpolate:function(A,l,f){return{h:Ju(A.h,l.h,f),c:ns(A.c,l.c,f),l:ns(A.l,l.l,f),alpha:ns(A.alpha,l.alpha,f)}}};var Sh=Object.freeze({__proto__:null,lab:Qo,hcl:hl});class Vo{constructor(l,f,w,I,z){this.type=l,this.operator=f,this.interpolation=w,this.input=I,this.labels=[],this.outputs=[];for(const[Q,Z]of z)this.labels.push(Q),this.outputs.push(Z)}static interpolationFactor(l,f,w,I){let z=0;if(l.name==="exponential")z=Mh(f,l.base,w,I);else if(l.name==="linear")z=Mh(f,1,w,I);else if(l.name==="cubic-bezier"){const Q=l.controlPoints;z=new C(Q[0],Q[1],Q[2],Q[3]).solve(Mh(f,1,w,I))}return z}static parse(l,f){let[w,I,z,...Q]=l;if(!Array.isArray(I)||I.length===0)return f.error("Expected an interpolation type expression.",1);if(I[0]==="linear")I={name:"linear"};else if(I[0]==="exponential"){const ge=I[1];if(typeof ge!="number")return f.error("Exponential interpolation requires a numeric base.",1,1);I={name:"exponential",base:ge}}else{if(I[0]!=="cubic-bezier")return f.error(`Unknown interpolation type ${String(I[0])}`,1,0);{const ge=I.slice(1);if(ge.length!==4||ge.some(Ce=>typeof Ce!="number"||Ce<0||Ce>1))return f.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);I={name:"cubic-bezier",controlPoints:ge}}}if(l.length-1<4)return f.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return f.error("Expected an even number of arguments.");if(z=f.parse(z,2,Ii),!z)return null;const Z=[];let re=null;w==="interpolate-hcl"||w==="interpolate-lab"?re=vi:f.expectedType&&f.expectedType.kind!=="value"&&(re=f.expectedType);for(let ge=0;ge<Q.length;ge+=2){const Ce=Q[ge],Fe=Q[ge+1],Oe=ge+3,je=ge+4;if(typeof Ce!="number")return f.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',Oe);if(Z.length&&Z[Z.length-1][0]>=Ce)return f.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',Oe);const $e=f.parse(Fe,je,re);if(!$e)return null;re=re||$e.type,Z.push([Ce,$e])}return re.kind==="number"||re.kind==="color"||re.kind==="padding"||re.kind==="array"&&re.itemType.kind==="number"&&typeof re.N=="number"?new Vo(re,w,I,z,Z):f.error(`Type ${Qn(re)} is not interpolatable.`)}evaluate(l){const f=this.labels,w=this.outputs;if(f.length===1)return w[0].evaluate(l);const I=this.input.evaluate(l);if(I<=f[0])return w[0].evaluate(l);const z=f.length;if(I>=f[z-1])return w[z-1].evaluate(l);const Q=Nl(f,I),Z=Vo.interpolationFactor(this.interpolation,I,f[Q],f[Q+1]),re=w[Q].evaluate(l),ge=w[Q+1].evaluate(l);return this.operator==="interpolate"?Ys[this.type.kind.toLowerCase()](re,ge,Z):this.operator==="interpolate-hcl"?hl.reverse(hl.interpolate(hl.forward(re),hl.forward(ge),Z)):Qo.reverse(Qo.interpolate(Qo.forward(re),Qo.forward(ge),Z))}eachChild(l){l(this.input);for(const f of this.outputs)l(f)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}}function Mh(A,l,f,w){const I=w-f,z=A-f;return I===0?0:l===1?z/I:(Math.pow(l,z)-1)/(Math.pow(l,I)-1)}class Va{constructor(l,f){this.type=l,this.args=f}static parse(l,f){if(l.length<2)return f.error("Expectected at least one argument.");let w=null;const I=f.expectedType;I&&I.kind!=="value"&&(w=I);const z=[];for(const Z of l.slice(1)){const re=f.parse(Z,1+z.length,w,void 0,{typeAnnotation:"omit"});if(!re)return null;w=w||re.type,z.push(re)}if(!w)throw new Error("No output type");const Q=I&&z.some(Z=>ot(I,Z.type));return new Va(Q?Ui:w,z)}evaluate(l){let f,w=null,I=0;for(const z of this.args)if(I++,w=z.evaluate(l),w&&w instanceof pt&&!w.available&&(f||(f=w.name),w=null,I===this.args.length&&(w=f)),w!==null)break;return w}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}}class ac{constructor(l,f){this.type=f.type,this.bindings=[].concat(l),this.result=f}evaluate(l){return this.result.evaluate(l)}eachChild(l){for(const f of this.bindings)l(f[1]);l(this.result)}static parse(l,f){if(l.length<4)return f.error(`Expected at least 3 arguments, but found ${l.length-1} instead.`);const w=[];for(let z=1;z<l.length-1;z+=2){const Q=l[z];if(typeof Q!="string")return f.error(`Expected string, but found ${typeof Q} instead.`,z);if(/[^a-zA-Z0-9_]/.test(Q))return f.error("Variable names must contain only alphanumeric characters or '_'.",z);const Z=f.parse(l[z+1],z+1);if(!Z)return null;w.push([Q,Z])}const I=f.parse(l[l.length-1],l.length-1,f.expectedType,w);return I?new ac(w,I):null}outputDefined(){return this.result.outputDefined()}}class fu{constructor(l,f,w){this.type=l,this.index=f,this.input=w}static parse(l,f){if(l.length!==3)return f.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const w=f.parse(l[1],1,Ii),I=f.parse(l[2],2,kr(f.expectedType||Ui));return w&&I?new fu(I.type.itemType,w,I):null}evaluate(l){const f=this.index.evaluate(l),w=this.input.evaluate(l);if(f<0)throw new Oi(`Array index out of bounds: ${f} < 0.`);if(f>=w.length)throw new Oi(`Array index out of bounds: ${f} > ${w.length-1}.`);if(f!==Math.floor(f))throw new Oi(`Array index must be an integer, but found ${f} instead.`);return w[f]}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}}class Vl{constructor(l,f){this.type=Ot,this.needle=l,this.haystack=f}static parse(l,f){if(l.length!==3)return f.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const w=f.parse(l[1],1,Ui),I=f.parse(l[2],2,Ui);return w&&I?Ee(w.type,[Ot,bn,Ii,nr,Ui])?new Vl(w,I):f.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qn(w.type)} instead`):null}evaluate(l){const f=this.needle.evaluate(l),w=this.haystack.evaluate(l);if(!w)return!1;if(!Ue(f,["boolean","string","number","null"]))throw new Oi(`Expected first argument to be of type boolean, string, number or null, but found ${Qn(Gt(f))} instead.`);if(!Ue(w,["string","array"]))throw new Oi(`Expected second argument to be of type array or string, but found ${Qn(Gt(w))} instead.`);return w.indexOf(f)>=0}eachChild(l){l(this.needle),l(this.haystack)}outputDefined(){return!0}}class ya{constructor(l,f,w){this.type=Ii,this.needle=l,this.haystack=f,this.fromIndex=w}static parse(l,f){if(l.length<=2||l.length>=5)return f.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const w=f.parse(l[1],1,Ui),I=f.parse(l[2],2,Ui);if(!w||!I)return null;if(!Ee(w.type,[Ot,bn,Ii,nr,Ui]))return f.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qn(w.type)} instead`);if(l.length===4){const z=f.parse(l[3],3,Ii);return z?new ya(w,I,z):null}return new ya(w,I)}evaluate(l){const f=this.needle.evaluate(l),w=this.haystack.evaluate(l);if(!Ue(f,["boolean","string","number","null"]))throw new Oi(`Expected first argument to be of type boolean, string, number or null, but found ${Qn(Gt(f))} instead.`);if(!Ue(w,["string","array"]))throw new Oi(`Expected second argument to be of type array or string, but found ${Qn(Gt(w))} instead.`);if(this.fromIndex){const I=this.fromIndex.evaluate(l);return w.indexOf(f,I)}return w.indexOf(f)}eachChild(l){l(this.needle),l(this.haystack),this.fromIndex&&l(this.fromIndex)}outputDefined(){return!1}}class zc{constructor(l,f,w,I,z,Q){this.inputType=l,this.type=f,this.input=w,this.cases=I,this.outputs=z,this.otherwise=Q}static parse(l,f){if(l.length<5)return f.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length%2!=1)return f.error("Expected an even number of arguments.");let w,I;f.expectedType&&f.expectedType.kind!=="value"&&(I=f.expectedType);const z={},Q=[];for(let ge=2;ge<l.length-1;ge+=2){let Ce=l[ge];const Fe=l[ge+1];Array.isArray(Ce)||(Ce=[Ce]);const Oe=f.concat(ge);if(Ce.length===0)return Oe.error("Expected at least one branch label.");for(const $e of Ce){if(typeof $e!="number"&&typeof $e!="string")return Oe.error("Branch labels must be numbers or strings.");if(typeof $e=="number"&&Math.abs($e)>Number.MAX_SAFE_INTEGER)return Oe.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof $e=="number"&&Math.floor($e)!==$e)return Oe.error("Numeric branch labels must be integer values.");if(w){if(Oe.checkSubtype(w,Gt($e)))return null}else w=Gt($e);if(z[String($e)]!==void 0)return Oe.error("Branch labels must be unique.");z[String($e)]=Q.length}const je=f.parse(Fe,ge,I);if(!je)return null;I=I||je.type,Q.push(je)}const Z=f.parse(l[1],1,Ui);if(!Z)return null;const re=f.parse(l[l.length-1],l.length-1,I);return re?Z.type.kind!=="value"&&f.concat(1).checkSubtype(w,Z.type)?null:new zc(w,I,Z,z,Q,re):null}evaluate(l){const f=this.input.evaluate(l);return(Gt(f)===this.inputType&&this.outputs[this.cases[f]]||this.otherwise).evaluate(l)}eachChild(l){l(this.input),this.outputs.forEach(l),l(this.otherwise)}outputDefined(){return this.outputs.every(l=>l.outputDefined())&&this.otherwise.outputDefined()}}class Ws{constructor(l,f,w){this.type=l,this.branches=f,this.otherwise=w}static parse(l,f){if(l.length<4)return f.error(`Expected at least 3 arguments, but found only ${l.length-1}.`);if(l.length%2!=0)return f.error("Expected an odd number of arguments.");let w;f.expectedType&&f.expectedType.kind!=="value"&&(w=f.expectedType);const I=[];for(let Q=1;Q<l.length-1;Q+=2){const Z=f.parse(l[Q],Q,Ot);if(!Z)return null;const re=f.parse(l[Q+1],Q+1,w);if(!re)return null;I.push([Z,re]),w=w||re.type}const z=f.parse(l[l.length-1],l.length-1,w);if(!z)return null;if(!w)throw new Error("Can't infer output type");return new Ws(w,I,z)}evaluate(l){for(const[f,w]of this.branches)if(f.evaluate(l))return w.evaluate(l);return this.otherwise.evaluate(l)}eachChild(l){for(const[f,w]of this.branches)l(f),l(w);l(this.otherwise)}outputDefined(){return this.branches.every(([l,f])=>f.outputDefined())&&this.otherwise.outputDefined()}}class lc{constructor(l,f,w,I){this.type=l,this.input=f,this.beginIndex=w,this.endIndex=I}static parse(l,f){if(l.length<=2||l.length>=5)return f.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const w=f.parse(l[1],1,Ui),I=f.parse(l[2],2,Ii);if(!w||!I)return null;if(!Ee(w.type,[kr(Ui),bn,Ui]))return f.error(`Expected first argument to be of type array or string, but found ${Qn(w.type)} instead`);if(l.length===4){const z=f.parse(l[3],3,Ii);return z?new lc(w.type,w,I,z):null}return new lc(w.type,w,I)}evaluate(l){const f=this.input.evaluate(l),w=this.beginIndex.evaluate(l);if(!Ue(f,["string","array"]))throw new Oi(`Expected first argument to be of type array or string, but found ${Qn(Gt(f))} instead.`);if(this.endIndex){const I=this.endIndex.evaluate(l);return f.slice(w,I)}return f.slice(w)}eachChild(l){l(this.input),l(this.beginIndex),this.endIndex&&l(this.endIndex)}outputDefined(){return!1}}function kc(A,l){return A==="=="||A==="!="?l.kind==="boolean"||l.kind==="string"||l.kind==="number"||l.kind==="null"||l.kind==="value":l.kind==="string"||l.kind==="number"||l.kind==="value"}function eA(A,l,f,w){return w.compare(l,f)===0}function cc(A,l,f){const w=A!=="=="&&A!=="!=";return class LM{constructor(z,Q,Z){this.type=Ot,this.lhs=z,this.rhs=Q,this.collator=Z,this.hasUntypedArgument=z.type.kind==="value"||Q.type.kind==="value"}static parse(z,Q){if(z.length!==3&&z.length!==4)return Q.error("Expected two or three arguments.");const Z=z[0];let re=Q.parse(z[1],1,Ui);if(!re)return null;if(!kc(Z,re.type))return Q.concat(1).error(`"${Z}" comparisons are not supported for type '${Qn(re.type)}'.`);let ge=Q.parse(z[2],2,Ui);if(!ge)return null;if(!kc(Z,ge.type))return Q.concat(2).error(`"${Z}" comparisons are not supported for type '${Qn(ge.type)}'.`);if(re.type.kind!==ge.type.kind&&re.type.kind!=="value"&&ge.type.kind!=="value")return Q.error(`Cannot compare types '${Qn(re.type)}' and '${Qn(ge.type)}'.`);w&&(re.type.kind==="value"&&ge.type.kind!=="value"?re=new tn(ge.type,[re]):re.type.kind!=="value"&&ge.type.kind==="value"&&(ge=new tn(re.type,[ge])));let Ce=null;if(z.length===4){if(re.type.kind!=="string"&&ge.type.kind!=="string"&&re.type.kind!=="value"&&ge.type.kind!=="value")return Q.error("Cannot use collator to compare non-string types.");if(Ce=Q.parse(z[3],3,Pn),!Ce)return null}return new LM(re,ge,Ce)}evaluate(z){const Q=this.lhs.evaluate(z),Z=this.rhs.evaluate(z);if(w&&this.hasUntypedArgument){const re=Gt(Q),ge=Gt(Z);if(re.kind!==ge.kind||re.kind!=="string"&&re.kind!=="number")throw new Oi(`Expected arguments for "${A}" to be (string, string) or (number, number), but found (${re.kind}, ${ge.kind}) instead.`)}if(this.collator&&!w&&this.hasUntypedArgument){const re=Gt(Q),ge=Gt(Z);if(re.kind!=="string"||ge.kind!=="string")return l(z,Q,Z)}return this.collator?f(z,Q,Z,this.collator.evaluate(z)):l(z,Q,Z)}eachChild(z){z(this.lhs),z(this.rhs),this.collator&&z(this.collator)}outputDefined(){return!0}}}const mu=cc("==",function(A,l,f){return l===f},eA),td=cc("!=",function(A,l,f){return l!==f},function(A,l,f,w){return!eA(0,l,f,w)}),gu=cc("<",function(A,l,f){return l<f},function(A,l,f,w){return w.compare(l,f)<0}),Ih=cc(">",function(A,l,f){return l>f},function(A,l,f,w){return w.compare(l,f)>0}),tA=cc("<=",function(A,l,f){return l<=f},function(A,l,f,w){return w.compare(l,f)<=0}),id=cc(">=",function(A,l,f){return l>=f},function(A,l,f,w){return w.compare(l,f)>=0});class hc{constructor(l,f,w,I,z){this.type=bn,this.number=l,this.locale=f,this.currency=w,this.minFractionDigits=I,this.maxFractionDigits=z}static parse(l,f){if(l.length!==3)return f.error("Expected two arguments.");const w=f.parse(l[1],1,Ii);if(!w)return null;const I=l[2];if(typeof I!="object"||Array.isArray(I))return f.error("NumberFormat options argument must be an object.");let z=null;if(I.locale&&(z=f.parse(I.locale,1,bn),!z))return null;let Q=null;if(I.currency&&(Q=f.parse(I.currency,1,bn),!Q))return null;let Z=null;if(I["min-fraction-digits"]&&(Z=f.parse(I["min-fraction-digits"],1,Ii),!Z))return null;let re=null;return I["max-fraction-digits"]&&(re=f.parse(I["max-fraction-digits"],1,Ii),!re)?null:new hc(w,z,Q,Z,re)}evaluate(l){return new Intl.NumberFormat(this.locale?this.locale.evaluate(l):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(l):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(l):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(l):void 0}).format(this.number.evaluate(l))}eachChild(l){l(this.number),this.locale&&l(this.locale),this.currency&&l(this.currency),this.minFractionDigits&&l(this.minFractionDigits),this.maxFractionDigits&&l(this.maxFractionDigits)}outputDefined(){return!1}}class Oc{constructor(l){this.type=qn,this.sections=l}static parse(l,f){if(l.length<2)return f.error("Expected at least one argument.");const w=l[1];if(!Array.isArray(w)&&typeof w=="object")return f.error("First argument must be an image or text section.");const I=[];let z=!1;for(let Q=1;Q<=l.length-1;++Q){const Z=l[Q];if(z&&typeof Z=="object"&&!Array.isArray(Z)){z=!1;let re=null;if(Z["font-scale"]&&(re=f.parse(Z["font-scale"],1,Ii),!re))return null;let ge=null;if(Z["text-font"]&&(ge=f.parse(Z["text-font"],1,kr(bn)),!ge))return null;let Ce=null;if(Z["text-color"]&&(Ce=f.parse(Z["text-color"],1,vi),!Ce))return null;const Fe=I[I.length-1];Fe.scale=re,Fe.font=ge,Fe.textColor=Ce}else{const re=f.parse(l[Q],1,Ui);if(!re)return null;const ge=re.type.kind;if(ge!=="string"&&ge!=="value"&&ge!=="null"&&ge!=="resolvedImage")return f.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");z=!0,I.push({content:re,scale:null,font:null,textColor:null})}}return new Oc(I)}evaluate(l){return new He(this.sections.map(f=>{const w=f.content.evaluate(l);return Gt(w)===fr?new tt("",w,null,null,null):new tt(ki(w),null,f.scale?f.scale.evaluate(l):null,f.font?f.font.evaluate(l).join(","):null,f.textColor?f.textColor.evaluate(l):null)}))}eachChild(l){for(const f of this.sections)l(f.content),f.scale&&l(f.scale),f.font&&l(f.font),f.textColor&&l(f.textColor)}outputDefined(){return!1}}class ul{constructor(l){this.type=fr,this.input=l}static parse(l,f){if(l.length!==2)return f.error("Expected two arguments.");const w=f.parse(l[1],1,bn);return w?new ul(w):f.error("No image name provided.")}evaluate(l){const f=this.input.evaluate(l),w=pt.fromString(f);return w&&l.availableImages&&(w.available=l.availableImages.indexOf(f)>-1),w}eachChild(l){l(this.input)}outputDefined(){return!1}}class Ir{constructor(l){this.type=Ii,this.input=l}static parse(l,f){if(l.length!==2)return f.error(`Expected 1 argument, but found ${l.length-1} instead.`);const w=f.parse(l[1],1);return w?w.type.kind!=="array"&&w.type.kind!=="string"&&w.type.kind!=="value"?f.error(`Expected argument of type string or array, but found ${Qn(w.type)} instead.`):new Ir(w):null}evaluate(l){const f=this.input.evaluate(l);if(typeof f=="string"||Array.isArray(f))return f.length;throw new Oi(`Expected value to be of type string or array, but found ${Qn(Gt(f))} instead.`)}eachChild(l){l(this.input)}outputDefined(){return!1}}const uc={"==":mu,"!=":td,">":Ih,"<":gu,">=":id,"<=":tA,array:tn,at:fu,boolean:tn,case:Ws,coalesce:Va,collator:Wr,format:Oc,image:ul,in:Vl,"index-of":ya,interpolate:Vo,"interpolate-hcl":Vo,"interpolate-lab":Vo,length:Ir,let:ac,literal:wi,match:zc,number:tn,"number-format":hc,object:tn,slice:lc,step:Ql,string:tn,"to-boolean":yn,"to-color":yn,"to-number":yn,"to-string":yn,var:kl,within:ho};function Nc(A,[l,f,w,I]){l=l.evaluate(A),f=f.evaluate(A),w=w.evaluate(A);const z=I?I.evaluate(A):1,Q=Lt(l,f,w,z);if(Q)throw new Oi(Q);return new de(l/255*z,f/255*z,w/255*z,z)}function _u(A,l){return A in l}function Al(A,l){const f=l[A];return f===void 0?null:f}function Ha(A){return{type:A}}function Qc(A){return{result:"success",value:A}}function dl(A){return{result:"error",value:A}}function qr(A){return A["property-type"]==="data-driven"||A["property-type"]==="cross-faded-data-driven"}function Fh(A){return!!A.expression&&A.expression.parameters.indexOf("zoom")>-1}function hr(A){return!!A.expression&&A.expression.interpolated}function Br(A){return A instanceof Number?"number":A instanceof String?"string":A instanceof Boolean?"boolean":Array.isArray(A)?"array":A===null?"null":typeof A}function jr(A){return typeof A=="object"&&A!==null&&!Array.isArray(A)}function $r(A){return A}function Hl(A,l){const f=l.type==="color",w=A.stops&&typeof A.stops[0][0]=="object",I=w||!(w||A.property!==void 0),z=A.type||(hr(l)?"exponential":"interval");if(f||l.type==="padding"){const ge=f?de.parse:Je.parse;(A=hn({},A)).stops&&(A.stops=A.stops.map(Ce=>[Ce[0],ge(Ce[1])])),A.default=ge(A.default?A.default:l.default)}if(A.colorSpace&&A.colorSpace!=="rgb"&&!Sh[A.colorSpace])throw new Error(`Unknown color space: ${A.colorSpace}`);let Q,Z,re;if(z==="exponential")Q=nA;else if(z==="interval")Q=iA;else if(z==="categorical"){Q=yu,Z=Object.create(null);for(const ge of A.stops)Z[ge[0]]=ge[1];re=typeof A.stops[0][0]}else{if(z!=="identity")throw new Error(`Unknown function type "${z}"`);Q=rA}if(w){const ge={},Ce=[];for(let je=0;je<A.stops.length;je++){const $e=A.stops[je],Rt=$e[0].zoom;ge[Rt]===void 0&&(ge[Rt]={zoom:Rt,type:A.type,property:A.property,default:A.default,stops:[]},Ce.push(Rt)),ge[Rt].stops.push([$e[0].value,$e[1]])}const Fe=[];for(const je of Ce)Fe.push([ge[je].zoom,Hl(ge[je],l)]);const Oe={name:"linear"};return{kind:"composite",interpolationType:Oe,interpolationFactor:Vo.interpolationFactor.bind(void 0,Oe),zoomStops:Fe.map(je=>je[0]),evaluate:({zoom:je},$e)=>nA({stops:Fe,base:A.base},l,je).evaluate(je,$e)}}if(I){const ge=z==="exponential"?{name:"exponential",base:A.base!==void 0?A.base:1}:null;return{kind:"camera",interpolationType:ge,interpolationFactor:Vo.interpolationFactor.bind(void 0,ge),zoomStops:A.stops.map(Ce=>Ce[0]),evaluate:({zoom:Ce})=>Q(A,l,Ce,Z,re)}}return{kind:"source",evaluate(ge,Ce){const Fe=Ce&&Ce.properties?Ce.properties[A.property]:void 0;return Fe===void 0?gr(A.default,l.default):Q(A,l,Fe,Z,re)}}}function gr(A,l,f){return A!==void 0?A:l!==void 0?l:f!==void 0?f:void 0}function yu(A,l,f,w,I){return gr(typeof f===I?w[f]:void 0,A.default,l.default)}function iA(A,l,f){if(Br(f)!=="number")return gr(A.default,l.default);const w=A.stops.length;if(w===1||f<=A.stops[0][0])return A.stops[0][1];if(f>=A.stops[w-1][0])return A.stops[w-1][1];const I=Nl(A.stops.map(z=>z[0]),f);return A.stops[I][1]}function nA(A,l,f){const w=A.base!==void 0?A.base:1;if(Br(f)!=="number")return gr(A.default,l.default);const I=A.stops.length;if(I===1||f<=A.stops[0][0])return A.stops[0][1];if(f>=A.stops[I-1][0])return A.stops[I-1][1];const z=Nl(A.stops.map(Ce=>Ce[0]),f),Q=function(Ce,Fe,Oe,je){const $e=je-Oe,Rt=Ce-Oe;return $e===0?0:Fe===1?Rt/$e:(Math.pow(Fe,Rt)-1)/(Math.pow(Fe,$e)-1)}(f,w,A.stops[z][0],A.stops[z+1][0]),Z=A.stops[z][1],re=A.stops[z+1][1];let ge=Ys[l.type]||$r;if(A.colorSpace&&A.colorSpace!=="rgb"){const Ce=Sh[A.colorSpace];ge=(Fe,Oe)=>Ce.reverse(Ce.interpolate(Ce.forward(Fe),Ce.forward(Oe),Q))}return typeof Z.evaluate=="function"?{evaluate(...Ce){const Fe=Z.evaluate.apply(void 0,Ce),Oe=re.evaluate.apply(void 0,Ce);if(Fe!==void 0&&Oe!==void 0)return ge(Fe,Oe,Q)}}:ge(Z,re,Q)}function rA(A,l,f){switch(l.type){case"color":f=de.parse(f);break;case"formatted":f=He.fromString(f.toString());break;case"resolvedImage":f=pt.fromString(f.toString());break;case"padding":f=Je.parse(f);break;default:Br(f)===l.type||l.type==="enum"&&l.values[f]||(f=void 0)}return gr(f,A.default,l.default)}Yn.register(uc,{error:[{kind:"error"},[bn],(A,[l])=>{throw new Oi(l.evaluate(A))}],typeof:[bn,[Ui],(A,[l])=>Qn(Gt(l.evaluate(A)))],"to-rgba":[kr(Ii,4),[vi],(A,[l])=>l.evaluate(A).toArray()],rgb:[vi,[Ii,Ii,Ii],Nc],rgba:[vi,[Ii,Ii,Ii,Ii],Nc],has:{type:Ot,overloads:[[[bn],(A,[l])=>_u(l.evaluate(A),A.properties())],[[bn,Wi],(A,[l,f])=>_u(l.evaluate(A),f.evaluate(A))]]},get:{type:Ui,overloads:[[[bn],(A,[l])=>Al(l.evaluate(A),A.properties())],[[bn,Wi],(A,[l,f])=>Al(l.evaluate(A),f.evaluate(A))]]},"feature-state":[Ui,[bn],(A,[l])=>Al(l.evaluate(A),A.featureState||{})],properties:[Wi,[],A=>A.properties()],"geometry-type":[bn,[],A=>A.geometryType()],id:[Ui,[],A=>A.id()],zoom:[Ii,[],A=>A.globals.zoom],"heatmap-density":[Ii,[],A=>A.globals.heatmapDensity||0],"line-progress":[Ii,[],A=>A.globals.lineProgress||0],accumulated:[Ui,[],A=>A.globals.accumulated===void 0?null:A.globals.accumulated],"+":[Ii,Ha(Ii),(A,l)=>{let f=0;for(const w of l)f+=w.evaluate(A);return f}],"*":[Ii,Ha(Ii),(A,l)=>{let f=1;for(const w of l)f*=w.evaluate(A);return f}],"-":{type:Ii,overloads:[[[Ii,Ii],(A,[l,f])=>l.evaluate(A)-f.evaluate(A)],[[Ii],(A,[l])=>-l.evaluate(A)]]},"/":[Ii,[Ii,Ii],(A,[l,f])=>l.evaluate(A)/f.evaluate(A)],"%":[Ii,[Ii,Ii],(A,[l,f])=>l.evaluate(A)%f.evaluate(A)],ln2:[Ii,[],()=>Math.LN2],pi:[Ii,[],()=>Math.PI],e:[Ii,[],()=>Math.E],"^":[Ii,[Ii,Ii],(A,[l,f])=>Math.pow(l.evaluate(A),f.evaluate(A))],sqrt:[Ii,[Ii],(A,[l])=>Math.sqrt(l.evaluate(A))],log10:[Ii,[Ii],(A,[l])=>Math.log(l.evaluate(A))/Math.LN10],ln:[Ii,[Ii],(A,[l])=>Math.log(l.evaluate(A))],log2:[Ii,[Ii],(A,[l])=>Math.log(l.evaluate(A))/Math.LN2],sin:[Ii,[Ii],(A,[l])=>Math.sin(l.evaluate(A))],cos:[Ii,[Ii],(A,[l])=>Math.cos(l.evaluate(A))],tan:[Ii,[Ii],(A,[l])=>Math.tan(l.evaluate(A))],asin:[Ii,[Ii],(A,[l])=>Math.asin(l.evaluate(A))],acos:[Ii,[Ii],(A,[l])=>Math.acos(l.evaluate(A))],atan:[Ii,[Ii],(A,[l])=>Math.atan(l.evaluate(A))],min:[Ii,Ha(Ii),(A,l)=>Math.min(...l.map(f=>f.evaluate(A)))],max:[Ii,Ha(Ii),(A,l)=>Math.max(...l.map(f=>f.evaluate(A)))],abs:[Ii,[Ii],(A,[l])=>Math.abs(l.evaluate(A))],round:[Ii,[Ii],(A,[l])=>{const f=l.evaluate(A);return f<0?-Math.round(-f):Math.round(f)}],floor:[Ii,[Ii],(A,[l])=>Math.floor(l.evaluate(A))],ceil:[Ii,[Ii],(A,[l])=>Math.ceil(l.evaluate(A))],"filter-==":[Ot,[bn,Ui],(A,[l,f])=>A.properties()[l.value]===f.value],"filter-id-==":[Ot,[Ui],(A,[l])=>A.id()===l.value],"filter-type-==":[Ot,[bn],(A,[l])=>A.geometryType()===l.value],"filter-<":[Ot,[bn,Ui],(A,[l,f])=>{const w=A.properties()[l.value],I=f.value;return typeof w==typeof I&&w<I}],"filter-id-<":[Ot,[Ui],(A,[l])=>{const f=A.id(),w=l.value;return typeof f==typeof w&&f<w}],"filter->":[Ot,[bn,Ui],(A,[l,f])=>{const w=A.properties()[l.value],I=f.value;return typeof w==typeof I&&w>I}],"filter-id->":[Ot,[Ui],(A,[l])=>{const f=A.id(),w=l.value;return typeof f==typeof w&&f>w}],"filter-<=":[Ot,[bn,Ui],(A,[l,f])=>{const w=A.properties()[l.value],I=f.value;return typeof w==typeof I&&w<=I}],"filter-id-<=":[Ot,[Ui],(A,[l])=>{const f=A.id(),w=l.value;return typeof f==typeof w&&f<=w}],"filter->=":[Ot,[bn,Ui],(A,[l,f])=>{const w=A.properties()[l.value],I=f.value;return typeof w==typeof I&&w>=I}],"filter-id->=":[Ot,[Ui],(A,[l])=>{const f=A.id(),w=l.value;return typeof f==typeof w&&f>=w}],"filter-has":[Ot,[Ui],(A,[l])=>l.value in A.properties()],"filter-has-id":[Ot,[],A=>A.id()!==null&&A.id()!==void 0],"filter-type-in":[Ot,[kr(bn)],(A,[l])=>l.value.indexOf(A.geometryType())>=0],"filter-id-in":[Ot,[kr(Ui)],(A,[l])=>l.value.indexOf(A.id())>=0],"filter-in-small":[Ot,[bn,kr(Ui)],(A,[l,f])=>f.value.indexOf(A.properties()[l.value])>=0],"filter-in-large":[Ot,[bn,kr(Ui)],(A,[l,f])=>function(w,I,z,Q){for(;z<=Q;){const Z=z+Q>>1;if(I[Z]===w)return!0;I[Z]>w?Q=Z-1:z=Z+1}return!1}(A.properties()[l.value],f.value,0,f.value.length-1)],all:{type:Ot,overloads:[[[Ot,Ot],(A,[l,f])=>l.evaluate(A)&&f.evaluate(A)],[Ha(Ot),(A,l)=>{for(const f of l)if(!f.evaluate(A))return!1;return!0}]]},any:{type:Ot,overloads:[[[Ot,Ot],(A,[l,f])=>l.evaluate(A)||f.evaluate(A)],[Ha(Ot),(A,l)=>{for(const f of l)if(f.evaluate(A))return!0;return!1}]]},"!":[Ot,[Ot],(A,[l])=>!l.evaluate(A)],"is-supported-script":[Ot,[bn],(A,[l])=>{const f=A.globals&&A.globals.isSupportedScript;return!f||f(l.evaluate(A))}],upcase:[bn,[bn],(A,[l])=>l.evaluate(A).toUpperCase()],downcase:[bn,[bn],(A,[l])=>l.evaluate(A).toLowerCase()],concat:[bn,Ha(Ui),(A,l)=>l.map(f=>ki(f.evaluate(A))).join("")],"resolved-locale":[bn,[Pn],(A,[l])=>l.evaluate(A).resolvedLocale()]});class Ac{constructor(l,f){this.expression=l,this._warningHistory={},this._evaluator=new sr,this._defaultValue=f?function(w){return w.type==="color"&&jr(w.default)?new de(0,0,0,0):w.type==="color"?de.parse(w.default)||null:w.type==="padding"?Je.parse(w.default)||null:w.default===void 0?null:w.default}(f):null,this._enumValues=f&&f.type==="enum"?f.values:null}evaluateWithoutErrorHandling(l,f,w,I,z,Q){return this._evaluator.globals=l,this._evaluator.feature=f,this._evaluator.featureState=w,this._evaluator.canonical=I,this._evaluator.availableImages=z||null,this._evaluator.formattedSection=Q,this.expression.evaluate(this._evaluator)}evaluate(l,f,w,I,z,Q){this._evaluator.globals=l,this._evaluator.feature=f||null,this._evaluator.featureState=w||null,this._evaluator.canonical=I,this._evaluator.availableImages=z||null,this._evaluator.formattedSection=Q||null;try{const Z=this.expression.evaluate(this._evaluator);if(Z==null||typeof Z=="number"&&Z!=Z)return this._defaultValue;if(this._enumValues&&!(Z in this._enumValues))throw new Oi(`Expected value to be one of ${Object.keys(this._enumValues).map(re=>JSON.stringify(re)).join(", ")}, but found ${JSON.stringify(Z)} instead.`);return Z}catch(Z){return this._warningHistory[Z.message]||(this._warningHistory[Z.message]=!0,typeof console<"u"&&console.warn(Z.message)),this._defaultValue}}}function Vc(A){return Array.isArray(A)&&A.length>0&&typeof A[0]=="string"&&A[0]in uc}function Hc(A,l){const f=new Ol(uc,[],l?function(I){const z={color:vi,string:bn,number:Ii,enum:bn,boolean:Ot,formatted:qn,padding:Hr,resolvedImage:fr};return I.type==="array"?kr(z[I.value]||Ui,I.length):z[I.type]}(l):void 0),w=f.parse(A,void 0,void 0,void 0,l&&l.type==="string"?{typeAnnotation:"coerce"}:void 0);return w?Qc(new Ac(w,l)):dl(f.errors)}class Lh{constructor(l,f){this.kind=l,this._styleExpression=f,this.isStateDependent=l!=="constant"&&!Na(f.expression)}evaluateWithoutErrorHandling(l,f,w,I,z,Q){return this._styleExpression.evaluateWithoutErrorHandling(l,f,w,I,z,Q)}evaluate(l,f,w,I,z,Q){return this._styleExpression.evaluate(l,f,w,I,z,Q)}}class Gc{constructor(l,f,w,I){this.kind=l,this.zoomStops=w,this._styleExpression=f,this.isStateDependent=l!=="camera"&&!Na(f.expression),this.interpolationType=I}evaluateWithoutErrorHandling(l,f,w,I,z,Q){return this._styleExpression.evaluateWithoutErrorHandling(l,f,w,I,z,Q)}evaluate(l,f,w,I,z,Q){return this._styleExpression.evaluate(l,f,w,I,z,Q)}interpolationFactor(l,f,w){return this.interpolationType?Vo.interpolationFactor(this.interpolationType,l,f,w):0}}function Dh(A,l){const f=Hc(A,l);if(f.result==="error")return f;const w=f.value.expression,I=cl(w);if(!I&&!qr(l))return dl([new Cn("","data expressions not supported")]);const z=zl(w,["zoom"]);if(!z&&!Fh(l))return dl([new Cn("","zoom expressions not supported")]);const Q=jc(w);return Q||z?Q instanceof Cn?dl([Q]):Q instanceof Vo&&!hr(l)?dl([new Cn("",'"interpolate" expressions cannot be used with this property')]):Qc(Q?new Gc(I?"camera":"composite",f.value,Q.labels,Q instanceof Vo?Q.interpolation:void 0):new Lh(I?"constant":"source",f.value)):dl([new Cn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wc{constructor(l,f){this._parameters=l,this._specification=f,hn(this,Hl(this._parameters,this._specification))}static deserialize(l){return new Wc(l._parameters,l._specification)}static serialize(l){return{_parameters:l._parameters,_specification:l._specification}}}function jc(A){let l=null;if(A instanceof ac)l=jc(A.result);else if(A instanceof Va){for(const f of A.args)if(l=jc(f),l)break}else(A instanceof Ql||A instanceof Vo)&&A.input instanceof Yn&&A.input.name==="zoom"&&(l=A);return l instanceof Cn||A.eachChild(f=>{const w=jc(f);w instanceof Cn?l=w:!l&&w?l=new Cn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):l&&w&&l!==w&&(l=new Cn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),l}function ca(A){const l=A.key,f=A.value,w=A.valueSpec||{},I=A.objectElementValidators||{},z=A.style,Q=A.styleSpec;let Z=[];const re=Br(f);if(re!=="object")return[new at(l,f,`object expected, ${re} found`)];for(const ge in f){const Ce=ge.split(".")[0],Fe=w[Ce]||w["*"];let Oe;if(I[Ce])Oe=I[Ce];else if(w[Ce])Oe=Mo;else if(I["*"])Oe=I["*"];else{if(!w["*"]){Z.push(new at(l,f[ge],`unknown property "${ge}"`));continue}Oe=Mo}Z=Z.concat(Oe({key:(l&&`${l}.`)+ge,value:f[ge],valueSpec:Fe,style:z,styleSpec:Q,object:f,objectKey:ge},f))}for(const ge in w)I[ge]||w[ge].required&&w[ge].default===void 0&&f[ge]===void 0&&Z.push(new at(l,f,`missing required property "${ge}"`));return Z}function sA(A){const l=A.value,f=A.valueSpec,w=A.style,I=A.styleSpec,z=A.key,Q=A.arrayElementValidator||Mo;if(Br(l)!=="array")return[new at(z,l,`array expected, ${Br(l)} found`)];if(f.length&&l.length!==f.length)return[new at(z,l,`array length ${f.length} expected, length ${l.length} found`)];if(f["min-length"]&&l.length<f["min-length"])return[new at(z,l,`array length at least ${f["min-length"]} expected, length ${l.length} found`)];let Z={type:f.value,values:f.values};I.$version<7&&(Z.function=f.function),Br(f.value)==="object"&&(Z=f.value);let re=[];for(let ge=0;ge<l.length;ge++)re=re.concat(Q({array:l,arrayIndex:ge,value:l[ge],valueSpec:Z,style:w,styleSpec:I,key:`${z}[${ge}]`}));return re}function oA(A){const l=A.key,f=A.value,w=A.valueSpec;let I=Br(f);return I==="number"&&f!=f&&(I="NaN"),I!=="number"?[new at(l,f,`number expected, ${I} found`)]:"minimum"in w&&f<w.minimum?[new at(l,f,`${f} is less than the minimum value ${w.minimum}`)]:"maximum"in w&&f>w.maximum?[new at(l,f,`${f} is greater than the maximum value ${w.maximum}`)]:[]}function Kc(A){const l=A.valueSpec,f=Xi(A.value.type);let w,I,z,Q={};const Z=f!=="categorical"&&A.value.property===void 0,re=!Z,ge=Br(A.value.stops)==="array"&&Br(A.value.stops[0])==="array"&&Br(A.value.stops[0][0])==="object",Ce=ca({key:A.key,value:A.value,valueSpec:A.styleSpec.function,style:A.style,styleSpec:A.styleSpec,objectElementValidators:{stops:function(je){if(f==="identity")return[new at(je.key,je.value,'identity function may not have a "stops" property')];let $e=[];const Rt=je.value;return $e=$e.concat(sA({key:je.key,value:Rt,valueSpec:je.valueSpec,style:je.style,styleSpec:je.styleSpec,arrayElementValidator:Fe})),Br(Rt)==="array"&&Rt.length===0&&$e.push(new at(je.key,Rt,"array must have at least one stop")),$e},default:function(je){return Mo({key:je.key,value:je.value,valueSpec:l,style:je.style,styleSpec:je.styleSpec})}}});return f==="identity"&&Z&&Ce.push(new at(A.key,A.value,'missing required property "property"')),f==="identity"||A.value.stops||Ce.push(new at(A.key,A.value,'missing required property "stops"')),f==="exponential"&&A.valueSpec.expression&&!hr(A.valueSpec)&&Ce.push(new at(A.key,A.value,"exponential functions not supported")),A.styleSpec.$version>=8&&(re&&!qr(A.valueSpec)?Ce.push(new at(A.key,A.value,"property functions not supported")):Z&&!Fh(A.valueSpec)&&Ce.push(new at(A.key,A.value,"zoom functions not supported"))),f!=="categorical"&&!ge||A.value.property!==void 0||Ce.push(new at(A.key,A.value,'"property" property is required')),Ce;function Fe(je){let $e=[];const Rt=je.value,Mt=je.key;if(Br(Rt)!=="array")return[new at(Mt,Rt,`array expected, ${Br(Rt)} found`)];if(Rt.length!==2)return[new at(Mt,Rt,`array length 2 expected, length ${Rt.length} found`)];if(ge){if(Br(Rt[0])!=="object")return[new at(Mt,Rt,`object expected, ${Br(Rt[0])} found`)];if(Rt[0].zoom===void 0)return[new at(Mt,Rt,"object stop key must have zoom")];if(Rt[0].value===void 0)return[new at(Mt,Rt,"object stop key must have value")];if(z&&z>Xi(Rt[0].zoom))return[new at(Mt,Rt[0].zoom,"stop zoom values must appear in ascending order")];Xi(Rt[0].zoom)!==z&&(z=Xi(Rt[0].zoom),I=void 0,Q={}),$e=$e.concat(ca({key:`${Mt}[0]`,value:Rt[0],valueSpec:{zoom:{}},style:je.style,styleSpec:je.styleSpec,objectElementValidators:{zoom:oA,value:Oe}}))}else $e=$e.concat(Oe({key:`${Mt}[0]`,value:Rt[0],valueSpec:{},style:je.style,styleSpec:je.styleSpec},Rt));return Vc(on(Rt[1]))?$e.concat([new at(`${Mt}[1]`,Rt[1],"expressions are not allowed in function stops.")]):$e.concat(Mo({key:`${Mt}[1]`,value:Rt[1],valueSpec:l,style:je.style,styleSpec:je.styleSpec}))}function Oe(je,$e){const Rt=Br(je.value),Mt=Xi(je.value),ri=je.value!==null?je.value:$e;if(w){if(Rt!==w)return[new at(je.key,ri,`${Rt} stop domain type must match previous stop domain type ${w}`)]}else w=Rt;if(Rt!=="number"&&Rt!=="string"&&Rt!=="boolean")return[new at(je.key,ri,"stop domain value must be a number, string, or boolean")];if(Rt!=="number"&&f!=="categorical"){let gi=`number expected, ${Rt} found`;return qr(l)&&f===void 0&&(gi+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at(je.key,ri,gi)]}return f!=="categorical"||Rt!=="number"||isFinite(Mt)&&Math.floor(Mt)===Mt?f!=="categorical"&&Rt==="number"&&I!==void 0&&Mt<I?[new at(je.key,ri,"stop domain values must appear in ascending order")]:(I=Mt,f==="categorical"&&Mt in Q?[new at(je.key,ri,"stop domain values must be unique")]:(Q[Mt]=!0,[])):[new at(je.key,ri,`integer expected, found ${Mt}`)]}}function ha(A){const l=(A.expressionContext==="property"?Dh:Hc)(on(A.value),A.valueSpec);if(l.result==="error")return l.value.map(w=>new at(`${A.key}${w.key}`,A.value,w.message));const f=l.value.expression||l.value._styleExpression.expression;if(A.expressionContext==="property"&&A.propertyKey==="text-font"&&!f.outputDefined())return[new at(A.key,A.value,`Invalid data expression for "${A.propertyKey}". Output values must be contained as literals within the expression.`)];if(A.expressionContext==="property"&&A.propertyType==="layout"&&!Na(f))return[new at(A.key,A.value,'"feature-state" data expressions are not supported with layout properties.')];if(A.expressionContext==="filter"&&!Na(f))return[new at(A.key,A.value,'"feature-state" data expressions are not supported with filters.')];if(A.expressionContext&&A.expressionContext.indexOf("cluster")===0){if(!zl(f,["zoom","feature-state"]))return[new at(A.key,A.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(A.expressionContext==="cluster-initial"&&!cl(f))return[new at(A.key,A.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function $c(A){const l=A.key,f=A.value,w=A.valueSpec,I=[];return Array.isArray(w.values)?w.values.indexOf(Xi(f))===-1&&I.push(new at(l,f,`expected one of [${w.values.join(", ")}], ${JSON.stringify(f)} found`)):Object.keys(w.values).indexOf(Xi(f))===-1&&I.push(new at(l,f,`expected one of [${Object.keys(w.values).join(", ")}], ${JSON.stringify(f)} found`)),I}function pl(A){if(A===!0||A===!1)return!0;if(!Array.isArray(A)||A.length===0)return!1;switch(A[0]){case"has":return A.length>=2&&A[1]!=="$id"&&A[1]!=="$type";case"in":return A.length>=3&&(typeof A[1]!="string"||Array.isArray(A[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return A.length!==3||Array.isArray(A[1])||Array.isArray(A[2]);case"any":case"all":for(const l of A.slice(1))if(!pl(l)&&typeof l!="boolean")return!1;return!0;default:return!0}}const aA={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ho(A){if(A==null)return{filter:()=>!0,needGeometry:!1};pl(A)||(A=Gl(A));const l=Hc(A,aA);if(l.result==="error")throw new Error(l.value.map(f=>`${f.key}: ${f.message}`).join(", "));return{filter:(f,w,I)=>l.value.evaluate(f,w,{},I),needGeometry:xu(A)}}function Ph(A,l){return A<l?-1:A>l?1:0}function xu(A){if(!Array.isArray(A))return!1;if(A[0]==="within")return!0;for(let l=1;l<A.length;l++)if(xu(A[l]))return!0;return!1}function Gl(A){if(!A)return!0;const l=A[0];return A.length<=1?l!=="any":l==="=="?vu(A[1],A[2],"=="):l==="!="?fl(vu(A[1],A[2],"==")):l==="<"||l===">"||l==="<="||l===">="?vu(A[1],A[2],l):l==="any"?(f=A.slice(1),["any"].concat(f.map(Gl))):l==="all"?["all"].concat(A.slice(1).map(Gl)):l==="none"?["all"].concat(A.slice(1).map(Gl).map(fl)):l==="in"?Zc(A[1],A.slice(2)):l==="!in"?fl(Zc(A[1],A.slice(2))):l==="has"?Xc(A[1]):l==="!has"?fl(Xc(A[1])):l!=="within"||A;var f}function vu(A,l,f){switch(A){case"$type":return[`filter-type-${f}`,l];case"$id":return[`filter-id-${f}`,l];default:return[`filter-${f}`,A,l]}}function Zc(A,l){if(l.length===0)return!1;switch(A){case"$type":return["filter-type-in",["literal",l]];case"$id":return["filter-id-in",["literal",l]];default:return l.length>200&&!l.some(f=>typeof f!=typeof l[0])?["filter-in-large",A,["literal",l.sort(Ph)]]:["filter-in-small",A,["literal",l]]}}function Xc(A){switch(A){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",A]}}function fl(A){return["!",A]}function qc(A){return pl(on(A.value))?ha(hn({},A,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Uh(A)}function Uh(A){const l=A.value,f=A.key;if(Br(l)!=="array")return[new at(f,l,`array expected, ${Br(l)} found`)];const w=A.styleSpec;let I,z=[];if(l.length<1)return[new at(f,l,"filter array must have at least 1 element")];switch(z=z.concat($c({key:`${f}[0]`,value:l[0],valueSpec:w.filter_operator,style:A.style,styleSpec:A.styleSpec})),Xi(l[0])){case"<":case"<=":case">":case">=":l.length>=2&&Xi(l[1])==="$type"&&z.push(new at(f,l,`"$type" cannot be use with operator "${l[0]}"`));case"==":case"!=":l.length!==3&&z.push(new at(f,l,`filter array for operator "${l[0]}" must have 3 elements`));case"in":case"!in":l.length>=2&&(I=Br(l[1]),I!=="string"&&z.push(new at(`${f}[1]`,l[1],`string expected, ${I} found`)));for(let Q=2;Q<l.length;Q++)I=Br(l[Q]),Xi(l[1])==="$type"?z=z.concat($c({key:`${f}[${Q}]`,value:l[Q],valueSpec:w.geometry_type,style:A.style,styleSpec:A.styleSpec})):I!=="string"&&I!=="number"&&I!=="boolean"&&z.push(new at(`${f}[${Q}]`,l[Q],`string, number, or boolean expected, ${I} found`));break;case"any":case"all":case"none":for(let Q=1;Q<l.length;Q++)z=z.concat(Uh({key:`${f}[${Q}]`,value:l[Q],style:A.style,styleSpec:A.styleSpec}));break;case"has":case"!has":I=Br(l[1]),l.length!==2?z.push(new at(f,l,`filter array for "${l[0]}" operator must have 2 elements`)):I!=="string"&&z.push(new at(`${f}[1]`,l[1],`string expected, ${I} found`));break;case"within":I=Br(l[1]),l.length!==2?z.push(new at(f,l,`filter array for "${l[0]}" operator must have 2 elements`)):I!=="object"&&z.push(new at(`${f}[1]`,l[1],`object expected, ${I} found`))}return z}function Rh(A,l){const f=A.key,w=A.style,I=A.styleSpec,z=A.value,Q=A.objectKey,Z=I[`${l}_${A.layerType}`];if(!Z)return[];const re=Q.match(/^(.*)-transition$/);if(l==="paint"&&re&&Z[re[1]]&&Z[re[1]].transition)return Mo({key:f,value:z,valueSpec:I.transition,style:w,styleSpec:I});const ge=A.valueSpec||Z[Q];if(!ge)return[new at(f,z,`unknown property "${Q}"`)];let Ce;if(Br(z)==="string"&&qr(ge)&&!ge.tokens&&(Ce=/^{([^}]+)}$/.exec(z)))return[new at(f,z,`"${Q}" does not support interpolation syntax
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(Ce[1])} }\`.`)];const Fe=[];return A.layerType==="symbol"&&(Q==="text-field"&&w&&!w.glyphs&&Fe.push(new at(f,z,'use of "text-field" requires a style "glyphs" property')),Q==="text-font"&&jr(on(z))&&Xi(z.type)==="identity"&&Fe.push(new at(f,z,'"text-font" does not support identity functions'))),Fe.concat(Mo({key:A.key,value:z,valueSpec:ge,style:w,styleSpec:I,expressionContext:"property",propertyType:l,propertyKey:Q}))}function wu(A){return Rh(A,"paint")}function nd(A){return Rh(A,"layout")}function dc(A){let l=[];const f=A.value,w=A.key,I=A.style,z=A.styleSpec;f.type||f.ref||l.push(new at(w,f,'either "type" or "ref" is required'));let Q=Xi(f.type);const Z=Xi(f.ref);if(f.id){const re=Xi(f.id);for(let ge=0;ge<A.arrayIndex;ge++){const Ce=I.layers[ge];Xi(Ce.id)===re&&l.push(new at(w,f.id,`duplicate layer id "${f.id}", previously used at line ${Ce.id.__line__}`))}}if("ref"in f){let re;["type","source","source-layer","filter","layout"].forEach(ge=>{ge in f&&l.push(new at(w,f[ge],`"${ge}" is prohibited for ref layers`))}),I.layers.forEach(ge=>{Xi(ge.id)===Z&&(re=ge)}),re?re.ref?l.push(new at(w,f.ref,"ref cannot reference another ref layer")):Q=Xi(re.type):l.push(new at(w,f.ref,`ref layer "${Z}" not found`))}else if(Q!=="background")if(f.source){const re=I.sources&&I.sources[f.source],ge=re&&Xi(re.type);re?ge==="vector"&&Q==="raster"?l.push(new at(w,f.source,`layer "${f.id}" requires a raster source`)):ge==="raster"&&Q!=="raster"?l.push(new at(w,f.source,`layer "${f.id}" requires a vector source`)):ge!=="vector"||f["source-layer"]?ge==="raster-dem"&&Q!=="hillshade"?l.push(new at(w,f.source,"raster-dem source can only be used with layer type 'hillshade'.")):Q!=="line"||!f.paint||!f.paint["line-gradient"]||ge==="geojson"&&re.lineMetrics||l.push(new at(w,f,`layer "${f.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):l.push(new at(w,f,`layer "${f.id}" must specify a "source-layer"`)):l.push(new at(w,f.source,`source "${f.source}" not found`))}else l.push(new at(w,f,'missing required property "source"'));return l=l.concat(ca({key:w,value:f,valueSpec:z.layer,style:A.style,styleSpec:A.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Mo({key:`${w}.type`,value:f.type,valueSpec:z.layer.type,style:A.style,styleSpec:A.styleSpec,object:f,objectKey:"type"}),filter:qc,layout:re=>ca({layer:f,key:re.key,value:re.value,style:re.style,styleSpec:re.styleSpec,objectElementValidators:{"*":ge=>nd(hn({layerType:Q},ge))}}),paint:re=>ca({layer:f,key:re.key,value:re.value,style:re.style,styleSpec:re.styleSpec,objectElementValidators:{"*":ge=>wu(hn({layerType:Q},ge))}})}})),l}function pc(A){const l=A.value,f=A.key,w=Br(l);return w!=="string"?[new at(f,l,`string expected, ${w} found`)]:[]}const Yc={promoteId:function({key:A,value:l}){if(Br(l)==="string")return pc({key:A,value:l});{const f=[];for(const w in l)f.push(...pc({key:`${A}.${w}`,value:l[w]}));return f}}};function zh(A){const l=A.value,f=A.key,w=A.styleSpec,I=A.style;if(!l.type)return[new at(f,l,'"type" is required')];const z=Xi(l.type);let Q;switch(z){case"vector":case"raster":case"raster-dem":return Q=ca({key:f,value:l,valueSpec:w[`source_${z.replace("-","_")}`],style:A.style,styleSpec:w,objectElementValidators:Yc}),Q;case"geojson":if(Q=ca({key:f,value:l,valueSpec:w.source_geojson,style:I,styleSpec:w,objectElementValidators:Yc}),l.cluster)for(const Z in l.clusterProperties){const[re,ge]=l.clusterProperties[Z],Ce=typeof re=="string"?[re,["accumulated"],["get",Z]]:re;Q.push(...ha({key:`${f}.${Z}.map`,value:ge,expressionContext:"cluster-map"})),Q.push(...ha({key:`${f}.${Z}.reduce`,value:Ce,expressionContext:"cluster-reduce"}))}return Q;case"video":return ca({key:f,value:l,valueSpec:w.source_video,style:I,styleSpec:w});case"image":return ca({key:f,value:l,valueSpec:w.source_image,style:I,styleSpec:w});case"canvas":return[new at(f,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return $c({key:`${f}.type`,value:l.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:I,styleSpec:w})}}function Jc(A){const l=A.value,f=A.styleSpec,w=f.light,I=A.style;let z=[];const Q=Br(l);if(l===void 0)return z;if(Q!=="object")return z=z.concat([new at("light",l,`object expected, ${Q} found`)]),z;for(const Z in l){const re=Z.match(/^(.*)-transition$/);z=z.concat(re&&w[re[1]]&&w[re[1]].transition?Mo({key:Z,value:l[Z],valueSpec:f.transition,style:I,styleSpec:f}):w[Z]?Mo({key:Z,value:l[Z],valueSpec:w[Z],style:I,styleSpec:f}):[new at(Z,l[Z],`unknown property "${Z}"`)])}return z}function So(A){const l=A.value,f=A.styleSpec,w=f.terrain,I=A.style;let z=[];const Q=Br(l);if(l===void 0)return z;if(Q!=="object")return z=z.concat([new at("terrain",l,`object expected, ${Q} found`)]),z;for(const Z in l)z=z.concat(w[Z]?Mo({key:Z,value:l[Z],valueSpec:w[Z],style:I,styleSpec:f}):[new at(Z,l[Z],`unknown property "${Z}"`)]);return z}const xa={"*":()=>[],array:sA,boolean:function(A){const l=A.value,f=A.key,w=Br(l);return w!=="boolean"?[new at(f,l,`boolean expected, ${w} found`)]:[]},number:oA,color:function(A){const l=A.key,f=A.value,w=Br(f);return w!=="string"?[new at(l,f,`color expected, ${w} found`)]:ct(f)===null?[new at(l,f,`color expected, "${f}" found`)]:[]},constants:ii,enum:$c,filter:qc,function:Kc,layer:dc,object:ca,source:zh,light:Jc,terrain:So,string:pc,formatted:function(A){return pc(A).length===0?[]:ha(A)},resolvedImage:function(A){return pc(A).length===0?[]:ha(A)},padding:function(A){const l=A.key,f=A.value;if(Br(f)==="array"){if(f.length<1||f.length>4)return[new at(l,f,`padding requires 1 to 4 values; ${f.length} values found`)];const w={type:"number"};let I=[];for(let z=0;z<f.length;z++)I=I.concat(Mo({key:`${l}[${z}]`,value:f[z],valueSpec:w}));return I}return oA({key:l,value:f,valueSpec:{}})}};function Mo(A){const l=A.value,f=A.valueSpec,w=A.styleSpec;return f.expression&&jr(Xi(l))?Kc(A):f.expression&&Vc(on(l))?ha(A):f.type&&xa[f.type]?xa[f.type](A):ca(hn({},A,{valueSpec:f.type?w[f.type]:f}))}function rd(A){const l=A.value,f=A.key,w=pc(A);return w.length||(l.indexOf("{fontstack}")===-1&&w.push(new at(f,l,'"glyphs" url must include a "{fontstack}" token')),l.indexOf("{range}")===-1&&w.push(new at(f,l,'"glyphs" url must include a "{range}" token'))),w}function Ga(A,l=$t){let f=[];return f=f.concat(Mo({key:"",value:A,valueSpec:l.$root,styleSpec:l,style:A,objectElementValidators:{glyphs:rd,"*":()=>[]}})),A.constants&&(f=f.concat(ii({key:"constants",value:A.constants,style:A,styleSpec:l}))),sd(f)}function sd(A){return[].concat(A).sort((l,f)=>l.line-f.line)}function ml(A){return function(...l){return sd(A.apply(this,l))}}Ga.source=ml(zh),Ga.light=ml(Jc),Ga.terrain=ml(So),Ga.layer=ml(dc),Ga.filter=ml(qc),Ga.paintProperty=ml(wu),Ga.layoutProperty=ml(nd);const kh=Ga,Oh=kh.light,lA=kh.paintProperty,od=kh.layoutProperty;function Nh(A,l){let f=!1;if(l&&l.length)for(const w of l)A.fire(new qi(new Error(w.message))),f=!0;return f}class fc{constructor(l,f,w){const I=this.cells=[];if(l instanceof ArrayBuffer){this.arrayBuffer=l;const Q=new Int32Array(this.arrayBuffer);l=Q[0],this.d=(f=Q[1])+2*(w=Q[2]);for(let re=0;re<this.d*this.d;re++){const ge=Q[3+re],Ce=Q[3+re+1];I.push(ge===Ce?null:Q.subarray(ge,Ce))}const Z=Q[3+I.length+1];this.keys=Q.subarray(Q[3+I.length],Z),this.bboxes=Q.subarray(Z),this.insert=this._insertReadonly}else{this.d=f+2*w;for(let Q=0;Q<this.d*this.d;Q++)I.push([]);this.keys=[],this.bboxes=[]}this.n=f,this.extent=l,this.padding=w,this.scale=f/l,this.uid=0;const z=w/f*l;this.min=-z,this.max=l+z}insert(l,f,w,I,z){this._forEachCell(f,w,I,z,this._insertCell,this.uid++,void 0,void 0),this.keys.push(l),this.bboxes.push(f),this.bboxes.push(w),this.bboxes.push(I),this.bboxes.push(z)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(l,f,w,I,z,Q){this.cells[z].push(Q)}query(l,f,w,I,z){const Q=this.min,Z=this.max;if(l<=Q&&f<=Q&&Z<=w&&Z<=I&&!z)return Array.prototype.slice.call(this.keys);{const re=[];return this._forEachCell(l,f,w,I,this._queryCell,re,{},z),re}}_queryCell(l,f,w,I,z,Q,Z,re){const ge=this.cells[z];if(ge!==null){const Ce=this.keys,Fe=this.bboxes;for(let Oe=0;Oe<ge.length;Oe++){const je=ge[Oe];if(Z[je]===void 0){const $e=4*je;(re?re(Fe[$e+0],Fe[$e+1],Fe[$e+2],Fe[$e+3]):l<=Fe[$e+2]&&f<=Fe[$e+3]&&w>=Fe[$e+0]&&I>=Fe[$e+1])?(Z[je]=!0,Q.push(Ce[je])):Z[je]=!1}}}}_forEachCell(l,f,w,I,z,Q,Z,re){const ge=this._convertToCellCoord(l),Ce=this._convertToCellCoord(f),Fe=this._convertToCellCoord(w),Oe=this._convertToCellCoord(I);for(let je=ge;je<=Fe;je++)for(let $e=Ce;$e<=Oe;$e++){const Rt=this.d*$e+je;if((!re||re(this._convertFromCellCoord(je),this._convertFromCellCoord($e),this._convertFromCellCoord(je+1),this._convertFromCellCoord($e+1)))&&z.call(this,l,f,w,I,Rt,Q,Z,re))return}}_convertFromCellCoord(l){return(l-this.padding)/this.scale}_convertToCellCoord(l){return Math.max(0,Math.min(this.d-1,Math.floor(l*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const l=this.cells,f=3+this.cells.length+1+1;let w=0;for(let Q=0;Q<this.cells.length;Q++)w+=this.cells[Q].length;const I=new Int32Array(f+w+this.keys.length+this.bboxes.length);I[0]=this.extent,I[1]=this.n,I[2]=this.padding;let z=f;for(let Q=0;Q<l.length;Q++){const Z=l[Q];I[3+Q]=z,I.set(Z,z),z+=Z.length}return I[3+l.length]=z,I.set(this.keys,z),z+=this.keys.length,I[3+l.length+1]=z,I.set(this.bboxes,z),z+=this.bboxes.length,I.buffer}static serialize(l,f){const w=l.toArrayBuffer();return f&&f.push(w),{buffer:w}}static deserialize(l){return new fc(l.buffer)}}const ua={};function pn(A,l,f={}){if(ua[A])throw new Error(`${A} is already registered.`);Object.defineProperty(l,"_classRegistryKey",{value:A,writeable:!1}),ua[A]={klass:l,omit:f.omit||[],shallow:f.shallow||[]}}pn("Object",Object),pn("TransferableGridIndex",fc),pn("Color",de),pn("Error",Error),pn("AJAXError",Ft),pn("ResolvedImage",pt),pn("StylePropertyFunction",Wc),pn("StyleExpression",Ac,{omit:["_evaluator"]}),pn("ZoomDependentExpression",Gc),pn("ZoomConstantExpression",Lh),pn("CompoundExpression",Yn,{omit:["_evaluate"]});for(const A in uc)uc[A]._classRegistryKey||pn(`Expression_${A}`,uc[A]);function eh(A){return A&&typeof ArrayBuffer<"u"&&(A instanceof ArrayBuffer||A.constructor&&A.constructor.name==="ArrayBuffer")}function Wl(A,l){if(A==null||typeof A=="boolean"||typeof A=="number"||typeof A=="string"||A instanceof Boolean||A instanceof Number||A instanceof String||A instanceof Date||A instanceof RegExp||A instanceof Blob)return A;if(eh(A)||ce(A))return l&&l.push(A),A;if(ArrayBuffer.isView(A)){const f=A;return l&&l.push(f.buffer),f}if(A instanceof ImageData)return l&&l.push(A.data.buffer),A;if(Array.isArray(A)){const f=[];for(const w of A)f.push(Wl(w,l));return f}if(typeof A=="object"){const f=A.constructor,w=f._classRegistryKey;if(!w)throw new Error("can't serialize object of unregistered class");if(!ua[w])throw new Error(`${w} is not registered.`);const I=f.serialize?f.serialize(A,l):{};if(f.serialize){if(l&&I===l[l.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const z in A){if(!A.hasOwnProperty(z)||ua[w].omit.indexOf(z)>=0)continue;const Q=A[z];I[z]=ua[w].shallow.indexOf(z)>=0?Q:Wl(Q,l)}A instanceof Error&&(I.message=A.message)}if(I.$name)throw new Error("$name property is reserved for worker serialization logic.");return w!=="Object"&&(I.$name=w),I}throw new Error("can't serialize object of type "+typeof A)}function Ns(A){if(A==null||typeof A=="boolean"||typeof A=="number"||typeof A=="string"||A instanceof Boolean||A instanceof Number||A instanceof String||A instanceof Date||A instanceof RegExp||A instanceof Blob||eh(A)||ce(A)||ArrayBuffer.isView(A)||A instanceof ImageData)return A;if(Array.isArray(A))return A.map(Ns);if(typeof A=="object"){const l=A.$name||"Object";if(!ua[l])throw new Error(`can't deserialize unregistered class ${l}`);const{klass:f}=ua[l];if(!f)throw new Error(`can't deserialize unregistered class ${l}`);if(f.deserialize)return f.deserialize(A);const w=Object.create(f.prototype);for(const I of Object.keys(A)){if(I==="$name")continue;const z=A[I];w[I]=ua[l].shallow.indexOf(I)>=0?z:Ns(z)}return w}throw new Error("can't deserialize object of type "+typeof A)}class gl{constructor(){this.first=!0}update(l,f){const w=Math.floor(l);return this.first?(this.first=!1,this.lastIntegerZoom=w,this.lastIntegerZoomTime=0,this.lastZoom=l,this.lastFloorZoom=w,!0):(this.lastFloorZoom>w?(this.lastIntegerZoom=w+1,this.lastIntegerZoomTime=f):this.lastFloorZoom<w&&(this.lastIntegerZoom=w,this.lastIntegerZoomTime=f),l!==this.lastZoom&&(this.lastZoom=l,this.lastFloorZoom=w,!0))}}const un={"Latin-1 Supplement":A=>A>=128&&A<=255,Arabic:A=>A>=1536&&A<=1791,"Arabic Supplement":A=>A>=1872&&A<=1919,"Arabic Extended-A":A=>A>=2208&&A<=2303,"Hangul Jamo":A=>A>=4352&&A<=4607,"Unified Canadian Aboriginal Syllabics":A=>A>=5120&&A<=5759,Khmer:A=>A>=6016&&A<=6143,"Unified Canadian Aboriginal Syllabics Extended":A=>A>=6320&&A<=6399,"General Punctuation":A=>A>=8192&&A<=8303,"Letterlike Symbols":A=>A>=8448&&A<=8527,"Number Forms":A=>A>=8528&&A<=8591,"Miscellaneous Technical":A=>A>=8960&&A<=9215,"Control Pictures":A=>A>=9216&&A<=9279,"Optical Character Recognition":A=>A>=9280&&A<=9311,"Enclosed Alphanumerics":A=>A>=9312&&A<=9471,"Geometric Shapes":A=>A>=9632&&A<=9727,"Miscellaneous Symbols":A=>A>=9728&&A<=9983,"Miscellaneous Symbols and Arrows":A=>A>=11008&&A<=11263,"CJK Radicals Supplement":A=>A>=11904&&A<=12031,"Kangxi Radicals":A=>A>=12032&&A<=12255,"Ideographic Description Characters":A=>A>=12272&&A<=12287,"CJK Symbols and Punctuation":A=>A>=12288&&A<=12351,Hiragana:A=>A>=12352&&A<=12447,Katakana:A=>A>=12448&&A<=12543,Bopomofo:A=>A>=12544&&A<=12591,"Hangul Compatibility Jamo":A=>A>=12592&&A<=12687,Kanbun:A=>A>=12688&&A<=12703,"Bopomofo Extended":A=>A>=12704&&A<=12735,"CJK Strokes":A=>A>=12736&&A<=12783,"Katakana Phonetic Extensions":A=>A>=12784&&A<=12799,"Enclosed CJK Letters and Months":A=>A>=12800&&A<=13055,"CJK Compatibility":A=>A>=13056&&A<=13311,"CJK Unified Ideographs Extension A":A=>A>=13312&&A<=19903,"Yijing Hexagram Symbols":A=>A>=19904&&A<=19967,"CJK Unified Ideographs":A=>A>=19968&&A<=40959,"Yi Syllables":A=>A>=40960&&A<=42127,"Yi Radicals":A=>A>=42128&&A<=42191,"Hangul Jamo Extended-A":A=>A>=43360&&A<=43391,"Hangul Syllables":A=>A>=44032&&A<=55215,"Hangul Jamo Extended-B":A=>A>=55216&&A<=55295,"Private Use Area":A=>A>=57344&&A<=63743,"CJK Compatibility Ideographs":A=>A>=63744&&A<=64255,"Arabic Presentation Forms-A":A=>A>=64336&&A<=65023,"Vertical Forms":A=>A>=65040&&A<=65055,"CJK Compatibility Forms":A=>A>=65072&&A<=65103,"Small Form Variants":A=>A>=65104&&A<=65135,"Arabic Presentation Forms-B":A=>A>=65136&&A<=65279,"Halfwidth and Fullwidth Forms":A=>A>=65280&&A<=65519};function th(A){for(const l of A)if(cA(l.charCodeAt(0)))return!0;return!1}function Ur(A){for(const l of A)if(!mc(l.charCodeAt(0)))return!1;return!0}function mc(A){return!(un.Arabic(A)||un["Arabic Supplement"](A)||un["Arabic Extended-A"](A)||un["Arabic Presentation Forms-A"](A)||un["Arabic Presentation Forms-B"](A))}function cA(A){return!(A!==746&&A!==747&&(A<4352||!(un["Bopomofo Extended"](A)||un.Bopomofo(A)||un["CJK Compatibility Forms"](A)&&!(A>=65097&&A<=65103)||un["CJK Compatibility Ideographs"](A)||un["CJK Compatibility"](A)||un["CJK Radicals Supplement"](A)||un["CJK Strokes"](A)||!(!un["CJK Symbols and Punctuation"](A)||A>=12296&&A<=12305||A>=12308&&A<=12319||A===12336)||un["CJK Unified Ideographs Extension A"](A)||un["CJK Unified Ideographs"](A)||un["Enclosed CJK Letters and Months"](A)||un["Hangul Compatibility Jamo"](A)||un["Hangul Jamo Extended-A"](A)||un["Hangul Jamo Extended-B"](A)||un["Hangul Jamo"](A)||un["Hangul Syllables"](A)||un.Hiragana(A)||un["Ideographic Description Characters"](A)||un.Kanbun(A)||un["Kangxi Radicals"](A)||un["Katakana Phonetic Extensions"](A)||un.Katakana(A)&&A!==12540||!(!un["Halfwidth and Fullwidth Forms"](A)||A===65288||A===65289||A===65293||A>=65306&&A<=65310||A===65339||A===65341||A===65343||A>=65371&&A<=65503||A===65507||A>=65512&&A<=65519)||!(!un["Small Form Variants"](A)||A>=65112&&A<=65118||A>=65123&&A<=65126)||un["Unified Canadian Aboriginal Syllabics"](A)||un["Unified Canadian Aboriginal Syllabics Extended"](A)||un["Vertical Forms"](A)||un["Yijing Hexagram Symbols"](A)||un["Yi Syllables"](A)||un["Yi Radicals"](A))))}function Qh(A){return!(cA(A)||function(l){return!!(un["Latin-1 Supplement"](l)&&(l===167||l===169||l===174||l===177||l===188||l===189||l===190||l===215||l===247)||un["General Punctuation"](l)&&(l===8214||l===8224||l===8225||l===8240||l===8241||l===8251||l===8252||l===8258||l===8263||l===8264||l===8265||l===8273)||un["Letterlike Symbols"](l)||un["Number Forms"](l)||un["Miscellaneous Technical"](l)&&(l>=8960&&l<=8967||l>=8972&&l<=8991||l>=8996&&l<=9e3||l===9003||l>=9085&&l<=9114||l>=9150&&l<=9165||l===9167||l>=9169&&l<=9179||l>=9186&&l<=9215)||un["Control Pictures"](l)&&l!==9251||un["Optical Character Recognition"](l)||un["Enclosed Alphanumerics"](l)||un["Geometric Shapes"](l)||un["Miscellaneous Symbols"](l)&&!(l>=9754&&l<=9759)||un["Miscellaneous Symbols and Arrows"](l)&&(l>=11026&&l<=11055||l>=11088&&l<=11097||l>=11192&&l<=11243)||un["CJK Symbols and Punctuation"](l)||un.Katakana(l)||un["Private Use Area"](l)||un["CJK Compatibility Forms"](l)||un["Small Form Variants"](l)||un["Halfwidth and Fullwidth Forms"](l)||l===8734||l===8756||l===8757||l>=9984&&l<=10087||l>=10102&&l<=10131||l===65532||l===65533)}(A))}function gc(A){return A>=1424&&A<=2303||un["Arabic Presentation Forms-A"](A)||un["Arabic Presentation Forms-B"](A)}function hA(A,l){return!(!l&&gc(A)||A>=2304&&A<=3583||A>=3840&&A<=4255||un.Khmer(A))}function uA(A){for(const l of A)if(gc(l.charCodeAt(0)))return!0;return!1}const Vh="deferred",Hh="loading",ih="loaded";let _c=null,Is="unavailable",fo=null;const Gh=function(A){A&&typeof A=="string"&&A.indexOf("NetworkError")>-1&&(Is="error"),_c&&_c(A)};function jl(){Kl.fire(new Ni("pluginStateChange",{pluginStatus:Is,pluginURL:fo}))}const Kl=new en,_l=function(){return Is},An=function(){if(Is!==Vh||!fo)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Is=Hh,jl(),fo&&Gi({url:fo},A=>{A?Gh(A):(Is=ih,jl())})},vs={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Is===ih||vs.applyArabicShaping!=null,isLoading:()=>Is===Hh,setState(A){if(!Me())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Is=A.pluginStatus,fo=A.pluginURL},isParsed(){if(!Me())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return vs.applyArabicShaping!=null&&vs.processBidirectionalText!=null&&vs.processStyledBidirectionalText!=null},getPluginURL(){if(!Me())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return fo}};class Zr{constructor(l,f){this.zoom=l,f?(this.now=f.now,this.fadeDuration=f.fadeDuration,this.zoomHistory=f.zoomHistory,this.transition=f.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new gl,this.transition={})}isSupportedScript(l){return function(f,w){for(const I of f)if(!hA(I.charCodeAt(0),w))return!1;return!0}(l,vs.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const l=this.zoom,f=l-Math.floor(l),w=this.crossFadingFactor();return l>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:f+(1-f)*w}:{fromScale:.5,toScale:1,t:1-(1-w)*f}}}class nh{constructor(l,f){this.property=l,this.value=f,this.expression=function(w,I){if(jr(w))return new Wc(w,I);if(Vc(w)){const z=Dh(w,I);if(z.result==="error")throw new Error(z.value.map(Q=>`${Q.key}: ${Q.message}`).join(", "));return z.value}{let z=w;return I.type==="color"&&typeof w=="string"?z=de.parse(w):I.type!=="padding"||typeof w!="number"&&!Array.isArray(w)||(z=Je.parse(w)),{kind:"constant",evaluate:()=>z}}}(f===void 0?l.specification.default:f,l.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(l,f,w){return this.property.possiblyEvaluate(this,l,f,w)}}class Wh{constructor(l){this.property=l,this.value=new nh(l,void 0)}transitioned(l,f){return new AA(this.property,this.value,f,J({},l.transition,this.transition),l.now)}untransitioned(){return new AA(this.property,this.value,null,{},0)}}class yc{constructor(l){this._properties=l,this._values=Object.create(l.defaultTransitionablePropertyValues)}getValue(l){return Ae(this._values[l].value.value)}setValue(l,f){Object.prototype.hasOwnProperty.call(this._values,l)||(this._values[l]=new Wh(this._values[l].property)),this._values[l].value=new nh(this._values[l].property,f===null?void 0:Ae(f))}getTransition(l){return Ae(this._values[l].transition)}setTransition(l,f){Object.prototype.hasOwnProperty.call(this._values,l)||(this._values[l]=new Wh(this._values[l].property)),this._values[l].transition=Ae(f)||void 0}serialize(){const l={};for(const f of Object.keys(this._values)){const w=this.getValue(f);w!==void 0&&(l[f]=w);const I=this.getTransition(f);I!==void 0&&(l[`${f}-transition`]=I)}return l}transitioned(l,f){const w=new jh(this._properties);for(const I of Object.keys(this._values))w._values[I]=this._values[I].transitioned(l,f._values[I]);return w}untransitioned(){const l=new jh(this._properties);for(const f of Object.keys(this._values))l._values[f]=this._values[f].untransitioned();return l}}class AA{constructor(l,f,w,I,z){this.property=l,this.value=f,this.begin=z+I.delay||0,this.end=this.begin+I.duration||0,l.specification.transition&&(I.delay||I.duration)&&(this.prior=w)}possiblyEvaluate(l,f,w){const I=l.now||0,z=this.value.possiblyEvaluate(l,f,w),Q=this.prior;if(Q){if(I>this.end)return this.prior=null,z;if(this.value.isDataDriven())return this.prior=null,z;if(I<this.begin)return Q.possiblyEvaluate(l,f,w);{const Z=(I-this.begin)/(this.end-this.begin);return this.property.interpolate(Q.possiblyEvaluate(l,f,w),z,function(re){if(re<=0)return 0;if(re>=1)return 1;const ge=re*re,Ce=ge*re;return 4*(re<.5?Ce:3*(re-ge)+Ce-.75)}(Z))}}return z}}class jh{constructor(l){this._properties=l,this._values=Object.create(l.defaultTransitioningPropertyValues)}possiblyEvaluate(l,f,w){const I=new Js(this._properties);for(const z of Object.keys(this._values))I._values[z]=this._values[z].possiblyEvaluate(l,f,w);return I}hasTransition(){for(const l of Object.keys(this._values))if(this._values[l].prior)return!0;return!1}}class rh{constructor(l){this._properties=l,this._values=Object.create(l.defaultPropertyValues)}getValue(l){return Ae(this._values[l].value)}setValue(l,f){this._values[l]=new nh(this._values[l].property,f===null?void 0:Ae(f))}serialize(){const l={};for(const f of Object.keys(this._values)){const w=this.getValue(f);w!==void 0&&(l[f]=w)}return l}possiblyEvaluate(l,f,w){const I=new Js(this._properties);for(const z of Object.keys(this._values))I._values[z]=this._values[z].possiblyEvaluate(l,f,w);return I}}class uo{constructor(l,f,w){this.property=l,this.value=f,this.parameters=w}isConstant(){return this.value.kind==="constant"}constantOr(l){return this.value.kind==="constant"?this.value.value:l}evaluate(l,f,w,I){return this.property.evaluate(this.value,this.parameters,l,f,w,I)}}class Js{constructor(l){this._properties=l,this._values=Object.create(l.defaultPossiblyEvaluatedValues)}get(l){return this._values[l]}}class Fn{constructor(l){this.specification=l}possiblyEvaluate(l,f){if(l.isDataDriven())throw new Error("Value should not be data driven");return l.expression.evaluate(f)}interpolate(l,f,w){const I=Ys[this.specification.type];return I?I(l,f,w):l}}class Vn{constructor(l,f){this.specification=l,this.overrides=f}possiblyEvaluate(l,f,w,I){return new uo(this,l.expression.kind==="constant"||l.expression.kind==="camera"?{kind:"constant",value:l.expression.evaluate(f,null,{},w,I)}:l.expression,f)}interpolate(l,f,w){if(l.value.kind!=="constant"||f.value.kind!=="constant")return l;if(l.value.value===void 0||f.value.value===void 0)return new uo(this,{kind:"constant",value:void 0},l.parameters);const I=Ys[this.specification.type];return I?new uo(this,{kind:"constant",value:I(l.value.value,f.value.value,w)},l.parameters):l}evaluate(l,f,w,I,z,Q){return l.kind==="constant"?l.value:l.evaluate(f,w,I,z,Q)}}class sh extends Vn{possiblyEvaluate(l,f,w,I){if(l.value===void 0)return new uo(this,{kind:"constant",value:void 0},f);if(l.expression.kind==="constant"){const z=l.expression.evaluate(f,null,{},w,I),Q=l.property.specification.type==="resolvedImage"&&typeof z!="string"?z.name:z,Z=this._calculate(Q,Q,Q,f);return new uo(this,{kind:"constant",value:Z},f)}if(l.expression.kind==="camera"){const z=this._calculate(l.expression.evaluate({zoom:f.zoom-1}),l.expression.evaluate({zoom:f.zoom}),l.expression.evaluate({zoom:f.zoom+1}),f);return new uo(this,{kind:"constant",value:z},f)}return new uo(this,l.expression,f)}evaluate(l,f,w,I,z,Q){if(l.kind==="source"){const Z=l.evaluate(f,w,I,z,Q);return this._calculate(Z,Z,Z,f)}return l.kind==="composite"?this._calculate(l.evaluate({zoom:Math.floor(f.zoom)-1},w,I),l.evaluate({zoom:Math.floor(f.zoom)},w,I),l.evaluate({zoom:Math.floor(f.zoom)+1},w,I),f):l.value}_calculate(l,f,w,I){return I.zoom>I.zoomHistory.lastIntegerZoom?{from:l,to:f}:{from:w,to:f}}interpolate(l){return l}}class dA{constructor(l){this.specification=l}possiblyEvaluate(l,f,w,I){if(l.value!==void 0){if(l.expression.kind==="constant"){const z=l.expression.evaluate(f,null,{},w,I);return this._calculate(z,z,z,f)}return this._calculate(l.expression.evaluate(new Zr(Math.floor(f.zoom-1),f)),l.expression.evaluate(new Zr(Math.floor(f.zoom),f)),l.expression.evaluate(new Zr(Math.floor(f.zoom+1),f)),f)}}_calculate(l,f,w,I){return I.zoom>I.zoomHistory.lastIntegerZoom?{from:l,to:f}:{from:w,to:f}}interpolate(l){return l}}class yl{constructor(l){this.specification=l}possiblyEvaluate(l,f,w,I){return!!l.expression.evaluate(f,null,{},w,I)}interpolate(){return!1}}class Es{constructor(l){this.properties=l,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const f in l){const w=l[f];w.specification.overridable&&this.overridableProperties.push(f);const I=this.defaultPropertyValues[f]=new nh(w,void 0),z=this.defaultTransitionablePropertyValues[f]=new Wh(w);this.defaultTransitioningPropertyValues[f]=z.untransitioned(),this.defaultPossiblyEvaluatedValues[f]=I.possiblyEvaluate({})}}}pn("DataDrivenProperty",Vn),pn("DataConstantProperty",Fn),pn("CrossFadedDataDrivenProperty",sh),pn("CrossFadedProperty",dA),pn("ColorRampProperty",yl);const Wa="-transition";class Go extends en{constructor(l,f){if(super(),this.id=l.id,this.type=l.type,this._featureFilter={filter:()=>!0,needGeometry:!1},l.type!=="custom"&&(this.metadata=l.metadata,this.minzoom=l.minzoom,this.maxzoom=l.maxzoom,l.type!=="background"&&(this.source=l.source,this.sourceLayer=l["source-layer"],this.filter=l.filter),f.layout&&(this._unevaluatedLayout=new rh(f.layout)),f.paint)){this._transitionablePaint=new yc(f.paint);for(const w in l.paint)this.setPaintProperty(w,l.paint[w],{validate:!1});for(const w in l.layout)this.setLayoutProperty(w,l.layout[w],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Js(f.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(l){return l==="visibility"?this.visibility:this._unevaluatedLayout.getValue(l)}setLayoutProperty(l,f,w={}){f!=null&&this._validate(od,`layers.${this.id}.layout.${l}`,l,f,w)||(l!=="visibility"?this._unevaluatedLayout.setValue(l,f):this.visibility=f)}getPaintProperty(l){return l.endsWith(Wa)?this._transitionablePaint.getTransition(l.slice(0,-Wa.length)):this._transitionablePaint.getValue(l)}setPaintProperty(l,f,w={}){if(f!=null&&this._validate(lA,`layers.${this.id}.paint.${l}`,l,f,w))return!1;if(l.endsWith(Wa))return this._transitionablePaint.setTransition(l.slice(0,-Wa.length),f||void 0),!1;{const I=this._transitionablePaint._values[l],z=I.property.specification["property-type"]==="cross-faded-data-driven",Q=I.value.isDataDriven(),Z=I.value;this._transitionablePaint.setValue(l,f),this._handleSpecialPaintPropertyUpdate(l);const re=this._transitionablePaint._values[l].value;return re.isDataDriven()||Q||z||this._handleOverridablePaintPropertyUpdate(l,Z,re)}}_handleSpecialPaintPropertyUpdate(l){}_handleOverridablePaintPropertyUpdate(l,f,w){return!1}isHidden(l){return!!(this.minzoom&&l<this.minzoom)||!!(this.maxzoom&&l>=this.maxzoom)||this.visibility==="none"}updateTransitions(l){this._transitioningPaint=this._transitionablePaint.transitioned(l,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(l,f){l.getCrossfadeParameters&&(this._crossfadeParameters=l.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(l,void 0,f)),this.paint=this._transitioningPaint.possiblyEvaluate(l,void 0,f)}serialize(){const l={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(l.layout=l.layout||{},l.layout.visibility=this.visibility),le(l,(f,w)=>!(f===void 0||w==="layout"&&!Object.keys(f).length||w==="paint"&&!Object.keys(f).length))}_validate(l,f,w,I,z={}){return(!z||z.validate!==!1)&&Nh(this,l.call(kh,{key:f,layerType:this.type,objectKey:w,value:I,styleSpec:$t,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const l in this.paint._values){const f=this.paint.get(l);if(f instanceof uo&&qr(f.property.specification)&&(f.value.kind==="source"||f.value.kind==="composite")&&f.value.isStateDependent)return!0}return!1}}const pA={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class va{constructor(l,f){this._structArray=l,this._pos1=f*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class us{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(l,f){return l._trim(),f&&(l.isTransferred=!0,f.push(l.arrayBuffer)),{length:l.length,arrayBuffer:l.arrayBuffer}}static deserialize(l){const f=Object.create(this.prototype);return f.arrayBuffer=l.arrayBuffer,f.length=l.length,f.capacity=l.arrayBuffer.byteLength/f.bytesPerElement,f._refreshViews(),f}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(l){this.reserve(l),this.length=l}reserve(l){if(l>this.capacity){this.capacity=Math.max(l,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const f=this.uint8;this._refreshViews(),f&&this.uint8.set(f)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Fs(A,l=1){let f=0,w=0;return{members:A.map(I=>{const z=pA[I.type].BYTES_PER_ELEMENT,Q=f=Kh(f,Math.max(l,z)),Z=I.components||1;return w=Math.max(w,z),f+=z*Z,{name:I.name,type:I.type,components:Z,offset:Q}}),size:Kh(f,Math.max(w,l)),alignment:l}}function Kh(A,l){return Math.ceil(A/l)*l}class xl extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f){const w=this.length;return this.resize(w+1),this.emplace(w,l,f)}emplace(l,f,w){const I=2*l;return this.int16[I+0]=f,this.int16[I+1]=w,l}}xl.prototype.bytesPerElement=4,pn("StructArrayLayout2i4",xl);class M extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I){const z=this.length;return this.resize(z+1),this.emplace(z,l,f,w,I)}emplace(l,f,w,I,z){const Q=4*l;return this.int16[Q+0]=f,this.int16[Q+1]=w,this.int16[Q+2]=I,this.int16[Q+3]=z,l}}M.prototype.bytesPerElement=8,pn("StructArrayLayout4i8",M);class h extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z,Q){const Z=this.length;return this.resize(Z+1),this.emplace(Z,l,f,w,I,z,Q)}emplace(l,f,w,I,z,Q,Z){const re=6*l;return this.int16[re+0]=f,this.int16[re+1]=w,this.int16[re+2]=I,this.int16[re+3]=z,this.int16[re+4]=Q,this.int16[re+5]=Z,l}}h.prototype.bytesPerElement=12,pn("StructArrayLayout2i4i12",h);class _ extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z,Q){const Z=this.length;return this.resize(Z+1),this.emplace(Z,l,f,w,I,z,Q)}emplace(l,f,w,I,z,Q,Z){const re=4*l,ge=8*l;return this.int16[re+0]=f,this.int16[re+1]=w,this.uint8[ge+4]=I,this.uint8[ge+5]=z,this.uint8[ge+6]=Q,this.uint8[ge+7]=Z,l}}_.prototype.bytesPerElement=8,pn("StructArrayLayout2i4ub8",_);class T extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f){const w=this.length;return this.resize(w+1),this.emplace(w,l,f)}emplace(l,f,w){const I=2*l;return this.float32[I+0]=f,this.float32[I+1]=w,l}}T.prototype.bytesPerElement=8,pn("StructArrayLayout2f8",T);class F extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z,Q,Z,re,ge,Ce){const Fe=this.length;return this.resize(Fe+1),this.emplace(Fe,l,f,w,I,z,Q,Z,re,ge,Ce)}emplace(l,f,w,I,z,Q,Z,re,ge,Ce,Fe){const Oe=10*l;return this.uint16[Oe+0]=f,this.uint16[Oe+1]=w,this.uint16[Oe+2]=I,this.uint16[Oe+3]=z,this.uint16[Oe+4]=Q,this.uint16[Oe+5]=Z,this.uint16[Oe+6]=re,this.uint16[Oe+7]=ge,this.uint16[Oe+8]=Ce,this.uint16[Oe+9]=Fe,l}}F.prototype.bytesPerElement=20,pn("StructArrayLayout10ui20",F);class O extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe){const je=this.length;return this.resize(je+1),this.emplace(je,l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe)}emplace(l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je){const $e=12*l;return this.int16[$e+0]=f,this.int16[$e+1]=w,this.int16[$e+2]=I,this.int16[$e+3]=z,this.uint16[$e+4]=Q,this.uint16[$e+5]=Z,this.uint16[$e+6]=re,this.uint16[$e+7]=ge,this.int16[$e+8]=Ce,this.int16[$e+9]=Fe,this.int16[$e+10]=Oe,this.int16[$e+11]=je,l}}O.prototype.bytesPerElement=24,pn("StructArrayLayout4i4ui4i24",O);class K extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f,w){const I=this.length;return this.resize(I+1),this.emplace(I,l,f,w)}emplace(l,f,w,I){const z=3*l;return this.float32[z+0]=f,this.float32[z+1]=w,this.float32[z+2]=I,l}}K.prototype.bytesPerElement=12,pn("StructArrayLayout3f12",K);class oe extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l){const f=this.length;return this.resize(f+1),this.emplace(f,l)}emplace(l,f){return this.uint32[1*l+0]=f,l}}oe.prototype.bytesPerElement=4,pn("StructArrayLayout1ul4",oe);class ue extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z,Q,Z,re,ge){const Ce=this.length;return this.resize(Ce+1),this.emplace(Ce,l,f,w,I,z,Q,Z,re,ge)}emplace(l,f,w,I,z,Q,Z,re,ge,Ce){const Fe=10*l,Oe=5*l;return this.int16[Fe+0]=f,this.int16[Fe+1]=w,this.int16[Fe+2]=I,this.int16[Fe+3]=z,this.int16[Fe+4]=Q,this.int16[Fe+5]=Z,this.uint32[Oe+3]=re,this.uint16[Fe+8]=ge,this.uint16[Fe+9]=Ce,l}}ue.prototype.bytesPerElement=20,pn("StructArrayLayout6i1ul2ui20",ue);class ve extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z,Q){const Z=this.length;return this.resize(Z+1),this.emplace(Z,l,f,w,I,z,Q)}emplace(l,f,w,I,z,Q,Z){const re=6*l;return this.int16[re+0]=f,this.int16[re+1]=w,this.int16[re+2]=I,this.int16[re+3]=z,this.int16[re+4]=Q,this.int16[re+5]=Z,l}}ve.prototype.bytesPerElement=12,pn("StructArrayLayout2i2i2i12",ve);class Te extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z){const Q=this.length;return this.resize(Q+1),this.emplace(Q,l,f,w,I,z)}emplace(l,f,w,I,z,Q){const Z=4*l,re=8*l;return this.float32[Z+0]=f,this.float32[Z+1]=w,this.float32[Z+2]=I,this.int16[re+6]=z,this.int16[re+7]=Q,l}}Te.prototype.bytesPerElement=16,pn("StructArrayLayout2f1f2i16",Te);class ke extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f,w,I){const z=this.length;return this.resize(z+1),this.emplace(z,l,f,w,I)}emplace(l,f,w,I,z){const Q=12*l,Z=3*l;return this.uint8[Q+0]=f,this.uint8[Q+1]=w,this.float32[Z+1]=I,this.float32[Z+2]=z,l}}ke.prototype.bytesPerElement=12,pn("StructArrayLayout2ub2f12",ke);class We extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w){const I=this.length;return this.resize(I+1),this.emplace(I,l,f,w)}emplace(l,f,w,I){const z=3*l;return this.uint16[z+0]=f,this.uint16[z+1]=w,this.uint16[z+2]=I,l}}We.prototype.bytesPerElement=6,pn("StructArrayLayout3ui6",We);class bt extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e,Rt,Mt,ri){const gi=this.length;return this.resize(gi+1),this.emplace(gi,l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e,Rt,Mt,ri)}emplace(l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e,Rt,Mt,ri,gi){const ei=24*l,ui=12*l,Pi=48*l;return this.int16[ei+0]=f,this.int16[ei+1]=w,this.uint16[ei+2]=I,this.uint16[ei+3]=z,this.uint32[ui+2]=Q,this.uint32[ui+3]=Z,this.uint32[ui+4]=re,this.uint16[ei+10]=ge,this.uint16[ei+11]=Ce,this.uint16[ei+12]=Fe,this.float32[ui+7]=Oe,this.float32[ui+8]=je,this.uint8[Pi+36]=$e,this.uint8[Pi+37]=Rt,this.uint8[Pi+38]=Mt,this.uint32[ui+10]=ri,this.int16[ei+22]=gi,l}}bt.prototype.bytesPerElement=48,pn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",bt);class mt extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e,Rt,Mt,ri,gi,ei,ui,Pi,Fi,Sn,fn,mn,an,nn,vn){const gn=this.length;return this.resize(gn+1),this.emplace(gn,l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e,Rt,Mt,ri,gi,ei,ui,Pi,Fi,Sn,fn,mn,an,nn,vn)}emplace(l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e,Rt,Mt,ri,gi,ei,ui,Pi,Fi,Sn,fn,mn,an,nn,vn,gn){const Ji=34*l,Wn=17*l;return this.int16[Ji+0]=f,this.int16[Ji+1]=w,this.int16[Ji+2]=I,this.int16[Ji+3]=z,this.int16[Ji+4]=Q,this.int16[Ji+5]=Z,this.int16[Ji+6]=re,this.int16[Ji+7]=ge,this.uint16[Ji+8]=Ce,this.uint16[Ji+9]=Fe,this.uint16[Ji+10]=Oe,this.uint16[Ji+11]=je,this.uint16[Ji+12]=$e,this.uint16[Ji+13]=Rt,this.uint16[Ji+14]=Mt,this.uint16[Ji+15]=ri,this.uint16[Ji+16]=gi,this.uint16[Ji+17]=ei,this.uint16[Ji+18]=ui,this.uint16[Ji+19]=Pi,this.uint16[Ji+20]=Fi,this.uint16[Ji+21]=Sn,this.uint16[Ji+22]=fn,this.uint32[Wn+12]=mn,this.float32[Wn+13]=an,this.float32[Wn+14]=nn,this.float32[Wn+15]=vn,this.float32[Wn+16]=gn,l}}mt.prototype.bytesPerElement=68,pn("StructArrayLayout8i15ui1ul4f68",mt);class gt extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l){const f=this.length;return this.resize(f+1),this.emplace(f,l)}emplace(l,f){return this.float32[1*l+0]=f,l}}gt.prototype.bytesPerElement=4,pn("StructArrayLayout1f4",gt);class Vt extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w){const I=this.length;return this.resize(I+1),this.emplace(I,l,f,w)}emplace(l,f,w,I){const z=3*l;return this.int16[z+0]=f,this.int16[z+1]=w,this.int16[z+2]=I,l}}Vt.prototype.bytesPerElement=6,pn("StructArrayLayout3i6",Vt);class Zt extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w){const I=this.length;return this.resize(I+1),this.emplace(I,l,f,w)}emplace(l,f,w,I){const z=4*l;return this.uint32[2*l+0]=f,this.uint16[z+2]=w,this.uint16[z+3]=I,l}}Zt.prototype.bytesPerElement=8,pn("StructArrayLayout1ul2ui8",Zt);class ni extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f){const w=this.length;return this.resize(w+1),this.emplace(w,l,f)}emplace(l,f,w){const I=2*l;return this.uint16[I+0]=f,this.uint16[I+1]=w,l}}ni.prototype.bytesPerElement=4,pn("StructArrayLayout2ui4",ni);class St extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l){const f=this.length;return this.resize(f+1),this.emplace(f,l)}emplace(l,f){return this.uint16[1*l+0]=f,l}}St.prototype.bytesPerElement=2,pn("StructArrayLayout1ui2",St);class zt extends us{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f,w,I){const z=this.length;return this.resize(z+1),this.emplace(z,l,f,w,I)}emplace(l,f,w,I,z){const Q=4*l;return this.float32[Q+0]=f,this.float32[Q+1]=w,this.float32[Q+2]=I,this.float32[Q+3]=z,l}}zt.prototype.bytesPerElement=16,pn("StructArrayLayout4f16",zt);class li extends va{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new xe(this.anchorPointX,this.anchorPointY)}}li.prototype.size=20;class Ei extends ue{get(l){return new li(this,l)}}pn("CollisionBoxArray",Ei);class bi extends va{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(l){this._structArray.uint8[this._pos1+37]=l}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(l){this._structArray.uint8[this._pos1+38]=l}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(l){this._structArray.uint32[this._pos4+10]=l}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}bi.prototype.size=48;class Hi extends bt{get(l){return new bi(this,l)}}pn("PlacedSymbolArray",Hi);class xi extends va{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(l){this._structArray.uint32[this._pos4+12]=l}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}xi.prototype.size=68;class xn extends mt{get(l){return new xi(this,l)}}pn("SymbolInstanceArray",xn);class cn extends gt{getoffsetX(l){return this.float32[1*l+0]}}pn("GlyphOffsetArray",cn);class Bn extends Vt{getx(l){return this.int16[3*l+0]}gety(l){return this.int16[3*l+1]}gettileUnitDistanceFromAnchor(l){return this.int16[3*l+2]}}pn("SymbolLineVertexArray",Bn);class tr extends va{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}tr.prototype.size=8;class ur extends Zt{get(l){return new tr(this,l)}}pn("FeatureIndexArray",ur);class Un extends xl{}class Lr extends xl{}class Rr extends xl{}class Cr extends h{}class Er extends _{}class Gr extends T{}class js extends F{}class wa extends O{}class Aa extends K{}class ba extends oe{}class ja extends ve{}class Wo extends ke{}class mo extends We{}class Ba extends ni{}const $l=Fs([{name:"a_pos",components:2,type:"Int16"}],4),{members:x}=$l;class a{constructor(l=[]){this.segments=l}prepareSegment(l,f,w,I){let z=this.segments[this.segments.length-1];return l>a.MAX_VERTEX_ARRAY_LENGTH&&me(`Max vertices per segment is ${a.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${l}`),(!z||z.vertexLength+l>a.MAX_VERTEX_ARRAY_LENGTH||z.sortKey!==I)&&(z={vertexOffset:f.length,primitiveOffset:w.length,vertexLength:0,primitiveLength:0},I!==void 0&&(z.sortKey=I),this.segments.push(z)),z}get(){return this.segments}destroy(){for(const l of this.segments)for(const f in l.vaos)l.vaos[f].destroy()}static simpleSegment(l,f,w,I){return new a([{vertexOffset:l,primitiveOffset:f,vertexLength:w,primitiveLength:I,vaos:{},sortKey:0}])}}function m(A,l){return 256*(A=R(Math.floor(A),0,255))+R(Math.floor(l),0,255)}a.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,pn("SegmentVector",a);const b=Fs([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var S={exports:{}},P={exports:{}};P.exports=function(A,l){var f,w,I,z,Q,Z,re,ge;for(w=A.length-(f=3&A.length),I=l,Q=3432918353,Z=461845907,ge=0;ge<w;)re=255&A.charCodeAt(ge)|(255&A.charCodeAt(++ge))<<8|(255&A.charCodeAt(++ge))<<16|(255&A.charCodeAt(++ge))<<24,++ge,I=27492+(65535&(z=5*(65535&(I=(I^=re=(65535&(re=(re=(65535&re)*Q+(((re>>>16)*Q&65535)<<16)&4294967295)<<15|re>>>17))*Z+(((re>>>16)*Z&65535)<<16)&4294967295)<<13|I>>>19))+((5*(I>>>16)&65535)<<16)&4294967295))+((58964+(z>>>16)&65535)<<16);switch(re=0,f){case 3:re^=(255&A.charCodeAt(ge+2))<<16;case 2:re^=(255&A.charCodeAt(ge+1))<<8;case 1:I^=re=(65535&(re=(re=(65535&(re^=255&A.charCodeAt(ge)))*Q+(((re>>>16)*Q&65535)<<16)&4294967295)<<15|re>>>17))*Z+(((re>>>16)*Z&65535)<<16)&4294967295}return I^=A.length,I=2246822507*(65535&(I^=I>>>16))+((2246822507*(I>>>16)&65535)<<16)&4294967295,I=3266489909*(65535&(I^=I>>>13))+((3266489909*(I>>>16)&65535)<<16)&4294967295,(I^=I>>>16)>>>0};var H={exports:{}};H.exports=function(A,l){for(var f,w=A.length,I=l^w,z=0;w>=4;)f=1540483477*(65535&(f=255&A.charCodeAt(z)|(255&A.charCodeAt(++z))<<8|(255&A.charCodeAt(++z))<<16|(255&A.charCodeAt(++z))<<24))+((1540483477*(f>>>16)&65535)<<16),I=1540483477*(65535&I)+((1540483477*(I>>>16)&65535)<<16)^(f=1540483477*(65535&(f^=f>>>24))+((1540483477*(f>>>16)&65535)<<16)),w-=4,++z;switch(w){case 3:I^=(255&A.charCodeAt(z+2))<<16;case 2:I^=(255&A.charCodeAt(z+1))<<8;case 1:I=1540483477*(65535&(I^=255&A.charCodeAt(z)))+((1540483477*(I>>>16)&65535)<<16)}return I=1540483477*(65535&(I^=I>>>13))+((1540483477*(I>>>16)&65535)<<16),(I^=I>>>15)>>>0};var W=P.exports,ee=H.exports;S.exports=W,S.exports.murmur3=W,S.exports.murmur2=ee;class pe{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(l,f,w,I){this.ids.push(fe(l)),this.positions.push(f,w,I)}getPositions(l){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const f=fe(l);let w=0,I=this.ids.length-1;for(;w<I;){const Q=w+I>>1;this.ids[Q]>=f?I=Q:w=Q+1}const z=[];for(;this.ids[w]===f;)z.push({index:this.positions[3*w],start:this.positions[3*w+1],end:this.positions[3*w+2]}),w++;return z}static serialize(l,f){const w=new Float64Array(l.ids),I=new Uint32Array(l.positions);return Se(w,I,0,w.length-1),f&&f.push(w.buffer,I.buffer),{ids:w,positions:I}}static deserialize(l){const f=new pe;return f.ids=l.ids,f.positions=l.positions,f.indexed=!0,f}}function fe(A){const l=+A;return!isNaN(l)&&l<=Number.MAX_SAFE_INTEGER?l:S.exports(String(A))}function Se(A,l,f,w){for(;f<w;){const I=A[f+w>>1];let z=f-1,Q=w+1;for(;;){do z++;while(A[z]<I);do Q--;while(A[Q]>I);if(z>=Q)break;Qe(A,z,Q),Qe(l,3*z,3*Q),Qe(l,3*z+1,3*Q+1),Qe(l,3*z+2,3*Q+2)}Q-f<w-Q?(Se(A,l,f,Q),f=Q+1):(Se(A,l,Q+1,w),w=Q)}}function Qe(A,l,f){const w=A[l];A[l]=A[f],A[f]=w}pn("FeaturePositionMap",pe);class rt{constructor(l,f){this.gl=l.gl,this.location=f}}class nt extends rt{constructor(l,f){super(l,f),this.current=0}set(l){this.current!==l&&(this.current=l,this.gl.uniform1f(this.location,l))}}class lt extends rt{constructor(l,f){super(l,f),this.current=[0,0,0,0]}set(l){l[0]===this.current[0]&&l[1]===this.current[1]&&l[2]===this.current[2]&&l[3]===this.current[3]||(this.current=l,this.gl.uniform4f(this.location,l[0],l[1],l[2],l[3]))}}class Xe extends rt{constructor(l,f){super(l,f),this.current=de.transparent}set(l){l.r===this.current.r&&l.g===this.current.g&&l.b===this.current.b&&l.a===this.current.a||(this.current=l,this.gl.uniform4f(this.location,l.r,l.g,l.b,l.a))}}const Ye=new Float32Array(16);function At(A){return[m(255*A.r,255*A.g),m(255*A.b,255*A.a)]}class ht{constructor(l,f,w){this.value=l,this.uniformNames=f.map(I=>`u_${I}`),this.type=w}setUniform(l,f,w){l.set(w.constantOr(this.value))}getBinding(l,f,w){return this.type==="color"?new Xe(l,f):new nt(l,f)}}class Bt{constructor(l,f){this.uniformNames=f.map(w=>`u_${w}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(l,f){this.pixelRatioFrom=f.pixelRatio,this.pixelRatioTo=l.pixelRatio,this.patternFrom=f.tlbr,this.patternTo=l.tlbr}setUniform(l,f,w,I){const z=I==="u_pattern_to"?this.patternTo:I==="u_pattern_from"?this.patternFrom:I==="u_pixel_ratio_to"?this.pixelRatioTo:I==="u_pixel_ratio_from"?this.pixelRatioFrom:null;z&&l.set(z)}getBinding(l,f,w){return w.substr(0,9)==="u_pattern"?new lt(l,f):new nt(l,f)}}class Pt{constructor(l,f,w,I){this.expression=l,this.type=w,this.maxValue=0,this.paintVertexAttributes=f.map(z=>({name:`a_${z}`,type:"Float32",components:w==="color"?2:1,offset:0})),this.paintVertexArray=new I}populatePaintArray(l,f,w,I,z){const Q=this.paintVertexArray.length,Z=this.expression.evaluate(new Zr(0),f,{},I,[],z);this.paintVertexArray.resize(l),this._setPaintValue(Q,l,Z)}updatePaintArray(l,f,w,I){const z=this.expression.evaluate({zoom:0},w,I);this._setPaintValue(l,f,z)}_setPaintValue(l,f,w){if(this.type==="color"){const I=At(w);for(let z=l;z<f;z++)this.paintVertexArray.emplace(z,I[0],I[1])}else{for(let I=l;I<f;I++)this.paintVertexArray.emplace(I,w);this.maxValue=Math.max(this.maxValue,Math.abs(w))}}upload(l){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=l.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class It{constructor(l,f,w,I,z,Q){this.expression=l,this.uniformNames=f.map(Z=>`u_${Z}_t`),this.type=w,this.useIntegerZoom=I,this.zoom=z,this.maxValue=0,this.paintVertexAttributes=f.map(Z=>({name:`a_${Z}`,type:"Float32",components:w==="color"?4:2,offset:0})),this.paintVertexArray=new Q}populatePaintArray(l,f,w,I,z){const Q=this.expression.evaluate(new Zr(this.zoom),f,{},I,[],z),Z=this.expression.evaluate(new Zr(this.zoom+1),f,{},I,[],z),re=this.paintVertexArray.length;this.paintVertexArray.resize(l),this._setPaintValue(re,l,Q,Z)}updatePaintArray(l,f,w,I){const z=this.expression.evaluate({zoom:this.zoom},w,I),Q=this.expression.evaluate({zoom:this.zoom+1},w,I);this._setPaintValue(l,f,z,Q)}_setPaintValue(l,f,w,I){if(this.type==="color"){const z=At(w),Q=At(I);for(let Z=l;Z<f;Z++)this.paintVertexArray.emplace(Z,z[0],z[1],Q[0],Q[1])}else{for(let z=l;z<f;z++)this.paintVertexArray.emplace(z,w,I);this.maxValue=Math.max(this.maxValue,Math.abs(w),Math.abs(I))}}upload(l){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=l.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(l,f){const w=this.useIntegerZoom?Math.floor(f.zoom):f.zoom,I=R(this.expression.interpolationFactor(w,this.zoom,this.zoom+1),0,1);l.set(I)}getBinding(l,f,w){return new nt(l,f)}}class Ht{constructor(l,f,w,I,z,Q){this.expression=l,this.type=f,this.useIntegerZoom=w,this.zoom=I,this.layerId=Q,this.zoomInPaintVertexArray=new z,this.zoomOutPaintVertexArray=new z}populatePaintArray(l,f,w){const I=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(l),this.zoomOutPaintVertexArray.resize(l),this._setPaintValues(I,l,f.patterns&&f.patterns[this.layerId],w)}updatePaintArray(l,f,w,I,z){this._setPaintValues(l,f,w.patterns&&w.patterns[this.layerId],z)}_setPaintValues(l,f,w,I){if(!I||!w)return;const{min:z,mid:Q,max:Z}=w,re=I[z],ge=I[Q],Ce=I[Z];if(re&&ge&&Ce)for(let Fe=l;Fe<f;Fe++)this.zoomInPaintVertexArray.emplace(Fe,ge.tl[0],ge.tl[1],ge.br[0],ge.br[1],re.tl[0],re.tl[1],re.br[0],re.br[1],ge.pixelRatio,re.pixelRatio),this.zoomOutPaintVertexArray.emplace(Fe,ge.tl[0],ge.tl[1],ge.br[0],ge.br[1],Ce.tl[0],Ce.tl[1],Ce.br[0],Ce.br[1],ge.pixelRatio,Ce.pixelRatio)}upload(l){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=l.createVertexBuffer(this.zoomInPaintVertexArray,b.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=l.createVertexBuffer(this.zoomOutPaintVertexArray,b.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class hi{constructor(l,f,w){this.binders={},this._buffers=[];const I=[];for(const z in l.paint._values){if(!w(z))continue;const Q=l.paint.get(z);if(!(Q instanceof uo&&qr(Q.property.specification)))continue;const Z=qt(z,l.type),re=Q.value,ge=Q.property.specification.type,Ce=Q.property.useIntegerZoom,Fe=Q.property.specification["property-type"],Oe=Fe==="cross-faded"||Fe==="cross-faded-data-driven";if(re.kind==="constant")this.binders[z]=Oe?new Bt(re.value,Z):new ht(re.value,Z,ge),I.push(`/u_${z}`);else if(re.kind==="source"||Oe){const je=ji(z,ge,"source");this.binders[z]=Oe?new Ht(re,ge,Ce,f,je,l.id):new Pt(re,Z,ge,je),I.push(`/a_${z}`)}else{const je=ji(z,ge,"composite");this.binders[z]=new It(re,Z,ge,Ce,f,je),I.push(`/z_${z}`)}}this.cacheKey=I.sort().join("")}getMaxValue(l){const f=this.binders[l];return f instanceof Pt||f instanceof It?f.maxValue:0}populatePaintArrays(l,f,w,I,z){for(const Q in this.binders){const Z=this.binders[Q];(Z instanceof Pt||Z instanceof It||Z instanceof Ht)&&Z.populatePaintArray(l,f,w,I,z)}}setConstantPatternPositions(l,f){for(const w in this.binders){const I=this.binders[w];I instanceof Bt&&I.setConstantPatternPositions(l,f)}}updatePaintArrays(l,f,w,I,z){let Q=!1;for(const Z in l){const re=f.getPositions(Z);for(const ge of re){const Ce=w.feature(ge.index);for(const Fe in this.binders){const Oe=this.binders[Fe];if((Oe instanceof Pt||Oe instanceof It||Oe instanceof Ht)&&Oe.expression.isStateDependent===!0){const je=I.paint.get(Fe);Oe.expression=je.value,Oe.updatePaintArray(ge.start,ge.end,Ce,l[Z],z),Q=!0}}}}return Q}defines(){const l=[];for(const f in this.binders){const w=this.binders[f];(w instanceof ht||w instanceof Bt)&&l.push(...w.uniformNames.map(I=>`#define HAS_UNIFORM_${I}`))}return l}getBinderAttributes(){const l=[];for(const f in this.binders){const w=this.binders[f];if(w instanceof Pt||w instanceof It)for(let I=0;I<w.paintVertexAttributes.length;I++)l.push(w.paintVertexAttributes[I].name);else if(w instanceof Ht)for(let I=0;I<b.members.length;I++)l.push(b.members[I].name)}return l}getBinderUniforms(){const l=[];for(const f in this.binders){const w=this.binders[f];if(w instanceof ht||w instanceof Bt||w instanceof It)for(const I of w.uniformNames)l.push(I)}return l}getPaintVertexBuffers(){return this._buffers}getUniforms(l,f){const w=[];for(const I in this.binders){const z=this.binders[I];if(z instanceof ht||z instanceof Bt||z instanceof It){for(const Q of z.uniformNames)if(f[Q]){const Z=z.getBinding(l,f[Q],Q);w.push({name:Q,property:I,binding:Z})}}}return w}setUniforms(l,f,w,I){for(const{name:z,property:Q,binding:Z}of f)this.binders[Q].setUniform(Z,I,w.get(Q),z)}updatePaintBuffers(l){this._buffers=[];for(const f in this.binders){const w=this.binders[f];if(l&&w instanceof Ht){const I=l.fromScale===2?w.zoomInPaintVertexBuffer:w.zoomOutPaintVertexBuffer;I&&this._buffers.push(I)}else(w instanceof Pt||w instanceof It)&&w.paintVertexBuffer&&this._buffers.push(w.paintVertexBuffer)}}upload(l){for(const f in this.binders){const w=this.binders[f];(w instanceof Pt||w instanceof It||w instanceof Ht)&&w.upload(l)}this.updatePaintBuffers()}destroy(){for(const l in this.binders){const f=this.binders[l];(f instanceof Pt||f instanceof It||f instanceof Ht)&&f.destroy()}}}class si{constructor(l,f,w=()=>!0){this.programConfigurations={};for(const I of l)this.programConfigurations[I.id]=new hi(I,f,w);this.needsUpload=!1,this._featureMap=new pe,this._bufferOffset=0}populatePaintArrays(l,f,w,I,z,Q){for(const Z in this.programConfigurations)this.programConfigurations[Z].populatePaintArrays(l,f,I,z,Q);f.id!==void 0&&this._featureMap.add(f.id,w,this._bufferOffset,l),this._bufferOffset=l,this.needsUpload=!0}updatePaintArrays(l,f,w,I){for(const z of w)this.needsUpload=this.programConfigurations[z.id].updatePaintArrays(l,this._featureMap,f,z,I)||this.needsUpload}get(l){return this.programConfigurations[l]}upload(l){if(this.needsUpload){for(const f in this.programConfigurations)this.programConfigurations[f].upload(l);this.needsUpload=!1}}destroy(){for(const l in this.programConfigurations)this.programConfigurations[l].destroy()}}function qt(A,l){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[A]||[A.replace(`${l}-`,"").replace(/-/g,"_")]}function ji(A,l,f){const w={color:{source:T,composite:zt},number:{source:gt,composite:T}},I=function(z){return{"line-pattern":{source:js,composite:js},"fill-pattern":{source:js,composite:js},"fill-extrusion-pattern":{source:js,composite:js}}[z]}(A);return I&&I[f]||w[l][f]}pn("ConstantBinder",ht),pn("CrossFadedConstantBinder",Bt),pn("SourceExpressionBinder",Pt),pn("CrossFadedCompositeBinder",Ht),pn("CompositeExpressionBinder",It),pn("ProgramConfiguration",hi,{omit:["_buffers"]}),pn("ProgramConfigurationSet",si);var Kt=8192;const Bi=Math.pow(2,14)-1,di=-Bi-1;function Ri(A){const l=Kt/A.extent,f=A.loadGeometry();for(let w=0;w<f.length;w++){const I=f[w];for(let z=0;z<I.length;z++){const Q=I[z],Z=Math.round(Q.x*l),re=Math.round(Q.y*l);Q.x=R(Z,di,Bi),Q.y=R(re,di,Bi),(Z<Q.x||Z>Q.x+1||re<Q.y||re>Q.y+1)&&me("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return f}function Ai(A,l){return{type:A.type,id:A.id,properties:A.properties,geometry:l?Ri(A):[]}}function Mi(A,l,f,w,I){A.emplaceBack(2*l+(w+1)/2,2*f+(I+1)/2)}class $i{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(f=>f.id),this.index=l.index,this.hasPattern=!1,this.layoutVertexArray=new Lr,this.indexArray=new mo,this.segments=new a,this.programConfigurations=new si(l.layers,l.zoom),this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id)}populate(l,f,w){const I=this.layers[0],z=[];let Q=null,Z=!1;I.type==="circle"&&(Q=I.layout.get("circle-sort-key"),Z=!Q.isConstant());for(const{feature:re,id:ge,index:Ce,sourceLayerIndex:Fe}of l){const Oe=this.layers[0]._featureFilter.needGeometry,je=Ai(re,Oe);if(!this.layers[0]._featureFilter.filter(new Zr(this.zoom),je,w))continue;const $e=Z?Q.evaluate(je,{},w):void 0,Rt={id:ge,properties:re.properties,type:re.type,sourceLayerIndex:Fe,index:Ce,geometry:Oe?je.geometry:Ri(re),patterns:{},sortKey:$e};z.push(Rt)}Z&&z.sort((re,ge)=>re.sortKey-ge.sortKey);for(const re of z){const{geometry:ge,index:Ce,sourceLayerIndex:Fe}=re,Oe=l[Ce].feature;this.addFeature(re,ge,Ce,w),f.featureIndex.insert(Oe,ge,Ce,Fe,this.index)}}update(l,f,w){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,f,this.stateDependentLayers,w)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,x),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(l,f,w,I){for(const z of f)for(const Q of z){const Z=Q.x,re=Q.y;if(Z<0||Z>=Kt||re<0||re>=Kt)continue;const ge=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,l.sortKey),Ce=ge.vertexLength;Mi(this.layoutVertexArray,Z,re,-1,-1),Mi(this.layoutVertexArray,Z,re,1,-1),Mi(this.layoutVertexArray,Z,re,1,1),Mi(this.layoutVertexArray,Z,re,-1,1),this.indexArray.emplaceBack(Ce,Ce+1,Ce+2),this.indexArray.emplaceBack(Ce,Ce+3,Ce+2),ge.vertexLength+=4,ge.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,w,{},I)}}function Jt(A,l){for(let f=0;f<A.length;f++)if(Dr(l,A[f]))return!0;for(let f=0;f<l.length;f++)if(Dr(A,l[f]))return!0;return!!Mn(A,l)}function pi(A,l,f){return!!Dr(A,l)||!!ar(l,A,f)}function In(A,l){if(A.length===1)return _n(l,A[0]);for(let f=0;f<l.length;f++){const w=l[f];for(let I=0;I<w.length;I++)if(Dr(A,w[I]))return!0}for(let f=0;f<A.length;f++)if(_n(l,A[f]))return!0;for(let f=0;f<l.length;f++)if(Mn(A,l[f]))return!0;return!1}function Hn(A,l,f){if(A.length>1){if(Mn(A,l))return!0;for(let w=0;w<l.length;w++)if(ar(l[w],A,f))return!0}for(let w=0;w<A.length;w++)if(ar(A[w],l,f))return!0;return!1}function Mn(A,l){if(A.length===0||l.length===0)return!1;for(let f=0;f<A.length-1;f++){const w=A[f],I=A[f+1];for(let z=0;z<l.length-1;z++)if($n(w,I,l[z],l[z+1]))return!0}return!1}function $n(A,l,f,w){return Pe(A,f,w)!==Pe(l,f,w)&&Pe(A,l,f)!==Pe(A,l,w)}function ar(A,l,f){const w=f*f;if(l.length===1)return A.distSqr(l[0])<w;for(let I=1;I<l.length;I++)if(On(A,l[I-1],l[I])<w)return!0;return!1}function On(A,l,f){const w=l.distSqr(f);if(w===0)return A.distSqr(l);const I=((A.x-l.x)*(f.x-l.x)+(A.y-l.y)*(f.y-l.y))/w;return A.distSqr(I<0?l:I>1?f:f.sub(l)._mult(I)._add(l))}function _n(A,l){let f,w,I,z=!1;for(let Q=0;Q<A.length;Q++){f=A[Q];for(let Z=0,re=f.length-1;Z<f.length;re=Z++)w=f[Z],I=f[re],w.y>l.y!=I.y>l.y&&l.x<(I.x-w.x)*(l.y-w.y)/(I.y-w.y)+w.x&&(z=!z)}return z}function Dr(A,l){let f=!1;for(let w=0,I=A.length-1;w<A.length;I=w++){const z=A[w],Q=A[I];z.y>l.y!=Q.y>l.y&&l.x<(Q.x-z.x)*(l.y-z.y)/(Q.y-z.y)+z.x&&(f=!f)}return f}function Or(A,l,f){const w=f[0],I=f[2];if(A.x<w.x&&l.x<w.x||A.x>I.x&&l.x>I.x||A.y<w.y&&l.y<w.y||A.y>I.y&&l.y>I.y)return!1;const z=Pe(A,l,f[0]);return z!==Pe(A,l,f[1])||z!==Pe(A,l,f[2])||z!==Pe(A,l,f[3])}function Nr(A,l,f){const w=l.paint.get(A).value;return w.kind==="constant"?w.value:f.programConfigurations.get(l.id).getMaxValue(A)}function Qr(A){return Math.sqrt(A[0]*A[0]+A[1]*A[1])}function go(A,l,f,w,I){if(!l[0]&&!l[1])return A;const z=xe.convert(l)._mult(I);f==="viewport"&&z._rotate(-w);const Q=[];for(let Z=0;Z<A.length;Z++)Q.push(A[Z].sub(z));return Q}pn("CircleBucket",$i,{omit:["layers"]});const Ca=new Es({"circle-sort-key":new Vn($t.layout_circle["circle-sort-key"])});var jo={paint:new Es({"circle-radius":new Vn($t.paint_circle["circle-radius"]),"circle-color":new Vn($t.paint_circle["circle-color"]),"circle-blur":new Vn($t.paint_circle["circle-blur"]),"circle-opacity":new Vn($t.paint_circle["circle-opacity"]),"circle-translate":new Fn($t.paint_circle["circle-translate"]),"circle-translate-anchor":new Fn($t.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Fn($t.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Fn($t.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Vn($t.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Vn($t.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Vn($t.paint_circle["circle-stroke-opacity"])}),layout:Ca},ws=1e-6,_r=typeof Float32Array<"u"?Float32Array:Array;function Xr(){var A=new _r(9);return _r!=Float32Array&&(A[1]=0,A[2]=0,A[3]=0,A[5]=0,A[6]=0,A[7]=0),A[0]=1,A[4]=1,A[8]=1,A}function Fr(A){return A[0]=1,A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[5]=1,A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[10]=1,A[11]=0,A[12]=0,A[13]=0,A[14]=0,A[15]=1,A}function Ls(A,l,f){var w=l[0],I=l[1],z=l[2],Q=l[3],Z=l[4],re=l[5],ge=l[6],Ce=l[7],Fe=l[8],Oe=l[9],je=l[10],$e=l[11],Rt=l[12],Mt=l[13],ri=l[14],gi=l[15],ei=f[0],ui=f[1],Pi=f[2],Fi=f[3];return A[0]=ei*w+ui*Z+Pi*Fe+Fi*Rt,A[1]=ei*I+ui*re+Pi*Oe+Fi*Mt,A[2]=ei*z+ui*ge+Pi*je+Fi*ri,A[3]=ei*Q+ui*Ce+Pi*$e+Fi*gi,A[4]=(ei=f[4])*w+(ui=f[5])*Z+(Pi=f[6])*Fe+(Fi=f[7])*Rt,A[5]=ei*I+ui*re+Pi*Oe+Fi*Mt,A[6]=ei*z+ui*ge+Pi*je+Fi*ri,A[7]=ei*Q+ui*Ce+Pi*$e+Fi*gi,A[8]=(ei=f[8])*w+(ui=f[9])*Z+(Pi=f[10])*Fe+(Fi=f[11])*Rt,A[9]=ei*I+ui*re+Pi*Oe+Fi*Mt,A[10]=ei*z+ui*ge+Pi*je+Fi*ri,A[11]=ei*Q+ui*Ce+Pi*$e+Fi*gi,A[12]=(ei=f[12])*w+(ui=f[13])*Z+(Pi=f[14])*Fe+(Fi=f[15])*Rt,A[13]=ei*I+ui*re+Pi*Oe+Fi*Mt,A[14]=ei*z+ui*ge+Pi*je+Fi*ri,A[15]=ei*Q+ui*Ce+Pi*$e+Fi*gi,A}Math.hypot||(Math.hypot=function(){for(var A=0,l=arguments.length;l--;)A+=arguments[l]*arguments[l];return Math.sqrt(A)});var eo,rs=Ls;function Io(){var A=new _r(3);return _r!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0),A}function bu(A,l,f){var w=new _r(3);return w[0]=A,w[1]=l,w[2]=f,w}function Ka(A,l,f){var w=l[0],I=l[1],z=l[2],Q=l[3];return A[0]=f[0]*w+f[4]*I+f[8]*z+f[12]*Q,A[1]=f[1]*w+f[5]*I+f[9]*z+f[13]*Q,A[2]=f[2]*w+f[6]*I+f[10]*z+f[14]*Q,A[3]=f[3]*w+f[7]*I+f[11]*z+f[15]*Q,A}function _o(){var A=new _r(4);return _r!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0),A[3]=1,A}function Ea(A,l){const f=Ka([],[A.x,A.y,0,1],l);return new xe(f[0]/f[3],f[1]/f[3])}Io(),eo=new _r(4),_r!=Float32Array&&(eo[0]=0,eo[1]=0,eo[2]=0,eo[3]=0),Io(),bu(1,0,0),bu(0,1,0),_o(),_o(),Xr(),function(){var A;A=new _r(2),_r!=Float32Array&&(A[0]=0,A[1]=0)}();class vl extends $i{}pn("HeatmapBucket",vl,{omit:["layers"]});var Zl={paint:new Es({"heatmap-radius":new Vn($t.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Vn($t.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Fn($t.paint_heatmap["heatmap-intensity"]),"heatmap-color":new yl($t.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Fn($t.paint_heatmap["heatmap-opacity"])})};function $h(A,{width:l,height:f},w,I){if(I){if(I instanceof Uint8ClampedArray)I=new Uint8Array(I.buffer);else if(I.length!==l*f*w)throw new RangeError(`mismatched image size. expected: ${I.length} but got: ${l*f*w}`)}else I=new Uint8Array(l*f*w);return A.width=l,A.height=f,A.data=I,A}function Zh(A,{width:l,height:f},w){if(l===A.width&&f===A.height)return;const I=$h({},{width:l,height:f},w);$a(A,I,{x:0,y:0},{x:0,y:0},{width:Math.min(A.width,l),height:Math.min(A.height,f)},w),A.width=l,A.height=f,A.data=I.data}function $a(A,l,f,w,I,z){if(I.width===0||I.height===0)return l;if(I.width>A.width||I.height>A.height||f.x>A.width-I.width||f.y>A.height-I.height)throw new RangeError("out of range source coordinates for image copy");if(I.width>l.width||I.height>l.height||w.x>l.width-I.width||w.y>l.height-I.height)throw new RangeError("out of range destination coordinates for image copy");const Q=A.data,Z=l.data;if(Q===Z)throw new Error("srcData equals dstData, so image is already copied");for(let re=0;re<I.height;re++){const ge=((f.y+re)*A.width+f.x)*z,Ce=((w.y+re)*l.width+w.x)*z;for(let Fe=0;Fe<I.width*z;Fe++)Z[Ce+Fe]=Q[ge+Fe]}return l}class Xh{constructor(l,f){$h(this,l,1,f)}resize(l){Zh(this,l,1)}clone(){return new Xh({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(l,f,w,I,z){$a(l,f,w,I,z,1)}}class da{constructor(l,f){$h(this,l,4,f)}resize(l){Zh(this,l,4)}replace(l,f){f?this.data.set(l):this.data=l instanceof Uint8ClampedArray?new Uint8Array(l.buffer):l}clone(){return new da({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(l,f,w,I,z){$a(l,f,w,I,z,4)}}function sg(A){const l={},f=A.resolution||256,w=A.clips?A.clips.length:1,I=A.image||new da({width:f,height:w});if(Math.log(f)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${f}`);const z=(Q,Z,re)=>{l[A.evaluationKey]=re;const ge=A.expression.evaluate(l);I.data[Q+Z+0]=Math.floor(255*ge.r/ge.a),I.data[Q+Z+1]=Math.floor(255*ge.g/ge.a),I.data[Q+Z+2]=Math.floor(255*ge.b/ge.a),I.data[Q+Z+3]=Math.floor(255*ge.a)};if(A.clips)for(let Q=0,Z=0;Q<w;++Q,Z+=4*f)for(let re=0,ge=0;re<f;re++,ge+=4){const Ce=re/(f-1),{start:Fe,end:Oe}=A.clips[Q];z(Z,ge,Fe*(1-Ce)+Oe*Ce)}else for(let Q=0,Z=0;Q<f;Q++,Z+=4)z(0,Z,Q/(f-1));return I}pn("AlphaImage",Xh),pn("RGBAImage",da);var og={paint:new Es({"hillshade-illumination-direction":new Fn($t.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Fn($t.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Fn($t.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Fn($t.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Fn($t.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Fn($t.paint_hillshade["hillshade-accent-color"])})};const Sy=Fs([{name:"a_pos",components:2,type:"Int16"}],4),{members:My}=Sy;var dp={exports:{}};function pp(A,l,f){f=f||2;var w,I,z,Q,Z,re,ge,Ce=l&&l.length,Fe=Ce?l[0]*f:A.length,Oe=ag(A,0,Fe,f,!0),je=[];if(!Oe||Oe.next===Oe.prev)return je;if(Ce&&(Oe=function(Rt,Mt,ri,gi){var ei,ui,Pi,Fi=[];for(ei=0,ui=Mt.length;ei<ui;ei++)(Pi=ag(Rt,Mt[ei]*gi,ei<ui-1?Mt[ei+1]*gi:Rt.length,gi,!1))===Pi.next&&(Pi.steiner=!0),Fi.push(o1(Pi));for(Fi.sort(ld),ei=0;ei<Fi.length;ei++)ri=Ly(Fi[ei],ri);return ri}(A,l,Oe,f)),A.length>80*f){w=z=A[0],I=Q=A[1];for(var $e=f;$e<Fe;$e+=f)(Z=A[$e])<w&&(w=Z),(re=A[$e+1])<I&&(I=re),Z>z&&(z=Z),re>Q&&(Q=re);ge=(ge=Math.max(z-w,Q-I))!==0?32767/ge:0}return ad(Oe,je,f,w,I,ge,0),je}function ag(A,l,f,w,I){var z,Q;if(I===gA(A,l,f,w)>0)for(z=l;z<f;z+=w)Q=Ry(z,A[z],A[z+1],Q);else for(z=f-w;z>=l;z-=w)Q=Ry(z,A[z],A[z+1],Q);return Q&&fA(Q,Q.next)&&(mp(Q),Q=Q.next),Q}function Bu(A,l){if(!A)return A;l||(l=A);var f,w=A;do if(f=!1,w.steiner||!fA(w,w.next)&&Ds(w.prev,w,w.next)!==0)w=w.next;else{if(mp(w),(w=l=w.prev)===w.next)break;f=!0}while(f||w!==l);return l}function ad(A,l,f,w,I,z,Q){if(A){!Q&&z&&function(Ce,Fe,Oe,je){var $e=Ce;do $e.z===0&&($e.z=Cf($e.x,$e.y,Fe,Oe,je)),$e.prevZ=$e.prev,$e.nextZ=$e.next,$e=$e.next;while($e!==Ce);$e.prevZ.nextZ=null,$e.prevZ=null,function(Rt){var Mt,ri,gi,ei,ui,Pi,Fi,Sn,fn=1;do{for(ri=Rt,Rt=null,ui=null,Pi=0;ri;){for(Pi++,gi=ri,Fi=0,Mt=0;Mt<fn&&(Fi++,gi=gi.nextZ);Mt++);for(Sn=fn;Fi>0||Sn>0&&gi;)Fi!==0&&(Sn===0||!gi||ri.z<=gi.z)?(ei=ri,ri=ri.nextZ,Fi--):(ei=gi,gi=gi.nextZ,Sn--),ui?ui.nextZ=ei:Rt=ei,ei.prevZ=ui,ui=ei;ri=gi}ui.nextZ=null,fn*=2}while(Pi>1)}($e)}(A,w,I,z);for(var Z,re,ge=A;A.prev!==A.next;)if(Z=A.prev,re=A.next,z?Fy(A,w,I,z):Iy(A))l.push(Z.i/f|0),l.push(A.i/f|0),l.push(re.i/f|0),mp(A),A=re.next,ge=re.next;else if((A=re)===ge){Q?Q===1?ad(A=r1(Bu(A),l,f),l,f,w,I,z,2):Q===2&&s1(A,l,f,w,I,z):ad(Bu(A),l,f,w,I,z,1);break}}}function Iy(A){var l=A.prev,f=A,w=A.next;if(Ds(l,f,w)>=0)return!1;for(var I=l.x,z=f.x,Q=w.x,Z=l.y,re=f.y,ge=w.y,Ce=I<z?I<Q?I:Q:z<Q?z:Q,Fe=Z<re?Z<ge?Z:ge:re<ge?re:ge,Oe=I>z?I>Q?I:Q:z>Q?z:Q,je=Z>re?Z>ge?Z:ge:re>ge?re:ge,$e=w.next;$e!==l;){if($e.x>=Ce&&$e.x<=Oe&&$e.y>=Fe&&$e.y<=je&&qh(I,Z,z,re,Q,ge,$e.x,$e.y)&&Ds($e.prev,$e,$e.next)>=0)return!1;$e=$e.next}return!0}function Fy(A,l,f,w){var I=A.prev,z=A,Q=A.next;if(Ds(I,z,Q)>=0)return!1;for(var Z=I.x,re=z.x,ge=Q.x,Ce=I.y,Fe=z.y,Oe=Q.y,je=Z<re?Z<ge?Z:ge:re<ge?re:ge,$e=Ce<Fe?Ce<Oe?Ce:Oe:Fe<Oe?Fe:Oe,Rt=Z>re?Z>ge?Z:ge:re>ge?re:ge,Mt=Ce>Fe?Ce>Oe?Ce:Oe:Fe>Oe?Fe:Oe,ri=Cf(je,$e,l,f,w),gi=Cf(Rt,Mt,l,f,w),ei=A.prevZ,ui=A.nextZ;ei&&ei.z>=ri&&ui&&ui.z<=gi;){if(ei.x>=je&&ei.x<=Rt&&ei.y>=$e&&ei.y<=Mt&&ei!==I&&ei!==Q&&qh(Z,Ce,re,Fe,ge,Oe,ei.x,ei.y)&&Ds(ei.prev,ei,ei.next)>=0||(ei=ei.prevZ,ui.x>=je&&ui.x<=Rt&&ui.y>=$e&&ui.y<=Mt&&ui!==I&&ui!==Q&&qh(Z,Ce,re,Fe,ge,Oe,ui.x,ui.y)&&Ds(ui.prev,ui,ui.next)>=0))return!1;ui=ui.nextZ}for(;ei&&ei.z>=ri;){if(ei.x>=je&&ei.x<=Rt&&ei.y>=$e&&ei.y<=Mt&&ei!==I&&ei!==Q&&qh(Z,Ce,re,Fe,ge,Oe,ei.x,ei.y)&&Ds(ei.prev,ei,ei.next)>=0)return!1;ei=ei.prevZ}for(;ui&&ui.z<=gi;){if(ui.x>=je&&ui.x<=Rt&&ui.y>=$e&&ui.y<=Mt&&ui!==I&&ui!==Q&&qh(Z,Ce,re,Fe,ge,Oe,ui.x,ui.y)&&Ds(ui.prev,ui,ui.next)>=0)return!1;ui=ui.nextZ}return!0}function r1(A,l,f){var w=A;do{var I=w.prev,z=w.next.next;!fA(I,z)&&oh(I,w,w.next,z)&&cd(I,z)&&cd(z,I)&&(l.push(I.i/f|0),l.push(w.i/f|0),l.push(z.i/f|0),mp(w),mp(w.next),w=A=z),w=w.next}while(w!==A);return Bu(w)}function s1(A,l,f,w,I,z){var Q=A;do{for(var Z=Q.next.next;Z!==Q.prev;){if(Q.i!==Z.i&&Py(Q,Z)){var re=Uy(Q,Z);return Q=Bu(Q,Q.next),re=Bu(re,re.next),ad(Q,l,f,w,I,z,0),void ad(re,l,f,w,I,z,0)}Z=Z.next}Q=Q.next}while(Q!==A)}function ld(A,l){return A.x-l.x}function Ly(A,l){var f=function(I,z){var Q,Z=z,re=I.x,ge=I.y,Ce=-1/0;do{if(ge<=Z.y&&ge>=Z.next.y&&Z.next.y!==Z.y){var Fe=Z.x+(ge-Z.y)*(Z.next.x-Z.x)/(Z.next.y-Z.y);if(Fe<=re&&Fe>Ce&&(Ce=Fe,Q=Z.x<Z.next.x?Z:Z.next,Fe===re))return Q}Z=Z.next}while(Z!==z);if(!Q)return null;var Oe,je=Q,$e=Q.x,Rt=Q.y,Mt=1/0;Z=Q;do re>=Z.x&&Z.x>=$e&&re!==Z.x&&qh(ge<Rt?re:Ce,ge,$e,Rt,ge<Rt?Ce:re,ge,Z.x,Z.y)&&(Oe=Math.abs(ge-Z.y)/(re-Z.x),cd(Z,I)&&(Oe<Mt||Oe===Mt&&(Z.x>Q.x||Z.x===Q.x&&Dy(Q,Z)))&&(Q=Z,Mt=Oe)),Z=Z.next;while(Z!==je);return Q}(A,l);if(!f)return l;var w=Uy(f,A);return Bu(w,w.next),Bu(f,f.next)}function Dy(A,l){return Ds(A.prev,A,l.prev)<0&&Ds(l.next,A,A.next)<0}function Cf(A,l,f,w,I){return(A=1431655765&((A=858993459&((A=252645135&((A=16711935&((A=(A-f)*I|0)|A<<8))|A<<4))|A<<2))|A<<1))|(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-w)*I|0)|l<<8))|l<<4))|l<<2))|l<<1))<<1}function o1(A){var l=A,f=A;do(l.x<f.x||l.x===f.x&&l.y<f.y)&&(f=l),l=l.next;while(l!==A);return f}function qh(A,l,f,w,I,z,Q,Z){return(I-Q)*(l-Z)>=(A-Q)*(z-Z)&&(A-Q)*(w-Z)>=(f-Q)*(l-Z)&&(f-Q)*(z-Z)>=(I-Q)*(w-Z)}function Py(A,l){return A.next.i!==l.i&&A.prev.i!==l.i&&!function(f,w){var I=f;do{if(I.i!==f.i&&I.next.i!==f.i&&I.i!==w.i&&I.next.i!==w.i&&oh(I,I.next,f,w))return!0;I=I.next}while(I!==f);return!1}(A,l)&&(cd(A,l)&&cd(l,A)&&function(f,w){var I=f,z=!1,Q=(f.x+w.x)/2,Z=(f.y+w.y)/2;do I.y>Z!=I.next.y>Z&&I.next.y!==I.y&&Q<(I.next.x-I.x)*(Z-I.y)/(I.next.y-I.y)+I.x&&(z=!z),I=I.next;while(I!==f);return z}(A,l)&&(Ds(A.prev,A,l.prev)||Ds(A,l.prev,l))||fA(A,l)&&Ds(A.prev,A,A.next)>0&&Ds(l.prev,l,l.next)>0)}function Ds(A,l,f){return(l.y-A.y)*(f.x-l.x)-(l.x-A.x)*(f.y-l.y)}function fA(A,l){return A.x===l.x&&A.y===l.y}function oh(A,l,f,w){var I=fp(Ds(A,l,f)),z=fp(Ds(A,l,w)),Q=fp(Ds(f,w,A)),Z=fp(Ds(f,w,l));return I!==z&&Q!==Z||!(I!==0||!mA(A,f,l))||!(z!==0||!mA(A,w,l))||!(Q!==0||!mA(f,A,w))||!(Z!==0||!mA(f,l,w))}function mA(A,l,f){return l.x<=Math.max(A.x,f.x)&&l.x>=Math.min(A.x,f.x)&&l.y<=Math.max(A.y,f.y)&&l.y>=Math.min(A.y,f.y)}function fp(A){return A>0?1:A<0?-1:0}function cd(A,l){return Ds(A.prev,A,A.next)<0?Ds(A,l,A.next)>=0&&Ds(A,A.prev,l)>=0:Ds(A,l,A.prev)<0||Ds(A,A.next,l)<0}function Uy(A,l){var f=new gp(A.i,A.x,A.y),w=new gp(l.i,l.x,l.y),I=A.next,z=l.prev;return A.next=l,l.prev=A,f.next=I,I.prev=f,w.next=f,f.prev=w,z.next=w,w.prev=z,w}function Ry(A,l,f,w){var I=new gp(A,l,f);return w?(I.next=w.next,I.prev=w,w.next.prev=I,w.next=I):(I.prev=I,I.next=I),I}function mp(A){A.next.prev=A.prev,A.prev.next=A.next,A.prevZ&&(A.prevZ.nextZ=A.nextZ),A.nextZ&&(A.nextZ.prevZ=A.prevZ)}function gp(A,l,f){this.i=A,this.x=l,this.y=f,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function gA(A,l,f,w){for(var I=0,z=l,Q=f-w;z<f;z+=w)I+=(A[Q]-A[z])*(A[z+1]+A[Q+1]),Q=z;return I}function hd(A,l,f,w,I){ah(A,l,f||0,w||A.length-1,I||Cu)}function ah(A,l,f,w,I){for(;w>f;){if(w-f>600){var z=w-f+1,Q=l-f+1,Z=Math.log(z),re=.5*Math.exp(2*Z/3),ge=.5*Math.sqrt(Z*re*(z-re)/z)*(Q-z/2<0?-1:1);ah(A,l,Math.max(f,Math.floor(l-Q*re/z+ge)),Math.min(w,Math.floor(l+(z-Q)*re/z+ge)),I)}var Ce=A[l],Fe=f,Oe=w;for(Ta(A,f,l),I(A[w],Ce)>0&&Ta(A,f,w);Fe<Oe;){for(Ta(A,Fe,Oe),Fe++,Oe--;I(A[Fe],Ce)<0;)Fe++;for(;I(A[Oe],Ce)>0;)Oe--}I(A[f],Ce)===0?Ta(A,f,Oe):Ta(A,++Oe,w),Oe<=l&&(f=Oe+1),l<=Oe&&(w=Oe-1)}}function Ta(A,l,f){var w=A[l];A[l]=A[f],A[f]=w}function Cu(A,l){return A<l?-1:A>l?1:0}function lh(A,l){const f=A.length;if(f<=1)return[A];const w=[];let I,z;for(let Q=0;Q<f;Q++){const Z=it(A[Q]);Z!==0&&(A[Q].area=Math.abs(Z),z===void 0&&(z=Z<0),z===Z<0?(I&&w.push(I),I=[A[Q]]):I.push(A[Q]))}if(I&&w.push(I),l>1)for(let Q=0;Q<w.length;Q++)w[Q].length<=l||(hd(w[Q],l,1,w[Q].length-1,_A),w[Q]=w[Q].slice(0,l));return w}function _A(A,l){return l.area-A.area}function lg(A,l,f){const w=f.patternDependencies;let I=!1;for(const z of l){const Q=z.paint.get(`${A}-pattern`);Q.isConstant()||(I=!0);const Z=Q.constantOr(null);Z&&(I=!0,w[Z.to]=!0,w[Z.from]=!0)}return I}function cg(A,l,f,w,I){const z=I.patternDependencies;for(const Q of l){const Z=Q.paint.get(`${A}-pattern`).value;if(Z.kind!=="constant"){let re=Z.evaluate({zoom:w-1},f,{},I.availableImages),ge=Z.evaluate({zoom:w},f,{},I.availableImages),Ce=Z.evaluate({zoom:w+1},f,{},I.availableImages);re=re&&re.name?re.name:re,ge=ge&&ge.name?ge.name:ge,Ce=Ce&&Ce.name?Ce.name:Ce,z[re]=!0,z[ge]=!0,z[Ce]=!0,f.patterns[Q.id]={min:re,mid:ge,max:Ce}}}return f}dp.exports=pp,dp.exports.default=pp,pp.deviation=function(A,l,f,w){var I=l&&l.length,z=Math.abs(gA(A,0,I?l[0]*f:A.length,f));if(I)for(var Q=0,Z=l.length;Q<Z;Q++)z-=Math.abs(gA(A,l[Q]*f,Q<Z-1?l[Q+1]*f:A.length,f));var re=0;for(Q=0;Q<w.length;Q+=3){var ge=w[Q]*f,Ce=w[Q+1]*f,Fe=w[Q+2]*f;re+=Math.abs((A[ge]-A[Fe])*(A[Ce+1]-A[ge+1])-(A[ge]-A[Ce])*(A[Fe+1]-A[ge+1]))}return z===0&&re===0?0:Math.abs((re-z)/z)},pp.flatten=function(A){for(var l=A[0][0].length,f={vertices:[],holes:[],dimensions:l},w=0,I=0;I<A.length;I++){for(var z=0;z<A[I].length;z++)for(var Q=0;Q<l;Q++)f.vertices.push(A[I][z][Q]);I>0&&f.holes.push(w+=A[I-1].length)}return f};class hg{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(f=>f.id),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Rr,this.indexArray=new mo,this.indexArray2=new Ba,this.programConfigurations=new si(l.layers,l.zoom),this.segments=new a,this.segments2=new a,this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id)}populate(l,f,w){this.hasPattern=lg("fill",this.layers,f);const I=this.layers[0].layout.get("fill-sort-key"),z=!I.isConstant(),Q=[];for(const{feature:Z,id:re,index:ge,sourceLayerIndex:Ce}of l){const Fe=this.layers[0]._featureFilter.needGeometry,Oe=Ai(Z,Fe);if(!this.layers[0]._featureFilter.filter(new Zr(this.zoom),Oe,w))continue;const je=z?I.evaluate(Oe,{},w,f.availableImages):void 0,$e={id:re,properties:Z.properties,type:Z.type,sourceLayerIndex:Ce,index:ge,geometry:Fe?Oe.geometry:Ri(Z),patterns:{},sortKey:je};Q.push($e)}z&&Q.sort((Z,re)=>Z.sortKey-re.sortKey);for(const Z of Q){const{geometry:re,index:ge,sourceLayerIndex:Ce}=Z;if(this.hasPattern){const Fe=cg("fill",this.layers,Z,this.zoom,f);this.patternFeatures.push(Fe)}else this.addFeature(Z,re,ge,w,{});f.featureIndex.insert(l[ge].feature,re,ge,Ce,this.index)}}update(l,f,w){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,f,this.stateDependentLayers,w)}addFeatures(l,f,w){for(const I of this.patternFeatures)this.addFeature(I,I.geometry,I.index,f,w)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,My),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.indexBuffer2=l.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(l,f,w,I,z){for(const Q of lh(f,500)){let Z=0;for(const je of Q)Z+=je.length;const re=this.segments.prepareSegment(Z,this.layoutVertexArray,this.indexArray),ge=re.vertexLength,Ce=[],Fe=[];for(const je of Q){if(je.length===0)continue;je!==Q[0]&&Fe.push(Ce.length/2);const $e=this.segments2.prepareSegment(je.length,this.layoutVertexArray,this.indexArray2),Rt=$e.vertexLength;this.layoutVertexArray.emplaceBack(je[0].x,je[0].y),this.indexArray2.emplaceBack(Rt+je.length-1,Rt),Ce.push(je[0].x),Ce.push(je[0].y);for(let Mt=1;Mt<je.length;Mt++)this.layoutVertexArray.emplaceBack(je[Mt].x,je[Mt].y),this.indexArray2.emplaceBack(Rt+Mt-1,Rt+Mt),Ce.push(je[Mt].x),Ce.push(je[Mt].y);$e.vertexLength+=je.length,$e.primitiveLength+=je.length}const Oe=dp.exports(Ce,Fe);for(let je=0;je<Oe.length;je+=3)this.indexArray.emplaceBack(ge+Oe[je],ge+Oe[je+1],ge+Oe[je+2]);re.vertexLength+=Z,re.primitiveLength+=Oe.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,w,z,I)}}pn("FillBucket",hg,{omit:["layers","patternFeatures"]});const a1=new Es({"fill-sort-key":new Vn($t.layout_fill["fill-sort-key"])});var zy={paint:new Es({"fill-antialias":new Fn($t.paint_fill["fill-antialias"]),"fill-opacity":new Vn($t.paint_fill["fill-opacity"]),"fill-color":new Vn($t.paint_fill["fill-color"]),"fill-outline-color":new Vn($t.paint_fill["fill-outline-color"]),"fill-translate":new Fn($t.paint_fill["fill-translate"]),"fill-translate-anchor":new Fn($t.paint_fill["fill-translate-anchor"]),"fill-pattern":new sh($t.paint_fill["fill-pattern"])}),layout:a1};const Ef=Fs([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),xc=Fs([{name:"a_centroid",components:2,type:"Int16"}],4),{members:l1}=Ef;var Eu={},to=xe,Zn=wl;function wl(A,l,f,w,I){this.properties={},this.extent=f,this.type=0,this._pbf=A,this._geometry=-1,this._keys=w,this._values=I,A.readFields(Tf,this,l)}function Tf(A,l,f){A==1?l.id=f.readVarint():A==2?function(w,I){for(var z=w.readVarint()+w.pos;w.pos<z;){var Q=I._keys[w.readVarint()],Z=I._values[w.readVarint()];I.properties[Q]=Z}}(f,l):A==3?l.type=f.readVarint():A==4&&(l._geometry=f.pos)}function Pr(A){for(var l,f,w=0,I=0,z=A.length,Q=z-1;I<z;Q=I++)w+=((f=A[Q]).x-(l=A[I]).x)*(l.y+f.y);return w}wl.types=["Unknown","Point","LineString","Polygon"],wl.prototype.loadGeometry=function(){var A=this._pbf;A.pos=this._geometry;for(var l,f=A.readVarint()+A.pos,w=1,I=0,z=0,Q=0,Z=[];A.pos<f;){if(I<=0){var re=A.readVarint();w=7&re,I=re>>3}if(I--,w===1||w===2)z+=A.readSVarint(),Q+=A.readSVarint(),w===1&&(l&&Z.push(l),l=[]),l.push(new to(z,Q));else{if(w!==7)throw new Error("unknown command "+w);l&&l.push(l[0].clone())}}return l&&Z.push(l),Z},wl.prototype.bbox=function(){var A=this._pbf;A.pos=this._geometry;for(var l=A.readVarint()+A.pos,f=1,w=0,I=0,z=0,Q=1/0,Z=-1/0,re=1/0,ge=-1/0;A.pos<l;){if(w<=0){var Ce=A.readVarint();f=7&Ce,w=Ce>>3}if(w--,f===1||f===2)(I+=A.readSVarint())<Q&&(Q=I),I>Z&&(Z=I),(z+=A.readSVarint())<re&&(re=z),z>ge&&(ge=z);else if(f!==7)throw new Error("unknown command "+f)}return[Q,re,Z,ge]},wl.prototype.toGeoJSON=function(A,l,f){var w,I,z=this.extent*Math.pow(2,f),Q=this.extent*A,Z=this.extent*l,re=this.loadGeometry(),ge=wl.types[this.type];function Ce(je){for(var $e=0;$e<je.length;$e++){var Rt=je[$e];je[$e]=[360*(Rt.x+Q)/z-180,360/Math.PI*Math.atan(Math.exp((180-360*(Rt.y+Z)/z)*Math.PI/180))-90]}}switch(this.type){case 1:var Fe=[];for(w=0;w<re.length;w++)Fe[w]=re[w][0];Ce(re=Fe);break;case 2:for(w=0;w<re.length;w++)Ce(re[w]);break;case 3:for(re=function(je){var $e=je.length;if($e<=1)return[je];for(var Rt,Mt,ri=[],gi=0;gi<$e;gi++){var ei=Pr(je[gi]);ei!==0&&(Mt===void 0&&(Mt=ei<0),Mt===ei<0?(Rt&&ri.push(Rt),Rt=[je[gi]]):Rt.push(je[gi]))}return Rt&&ri.push(Rt),ri}(re),w=0;w<re.length;w++)for(I=0;I<re[w].length;I++)Ce(re[w][I])}re.length===1?re=re[0]:ge="Multi"+ge;var Oe={type:"Feature",geometry:{type:ge,coordinates:re},properties:this.properties};return"id"in this&&(Oe.id=this.id),Oe};var ky=Zn,Sf=vc;function vc(A,l){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=A,this._keys=[],this._values=[],this._features=[],A.readFields(ch,this,l),this.length=this._features.length}function ch(A,l,f){A===15?l.version=f.readVarint():A===1?l.name=f.readString():A===5?l.extent=f.readVarint():A===2?l._features.push(f.pos):A===3?l._keys.push(f.readString()):A===4&&l._values.push(function(w){for(var I=null,z=w.readVarint()+w.pos;w.pos<z;){var Q=w.readVarint()>>3;I=Q===1?w.readString():Q===2?w.readFloat():Q===3?w.readDouble():Q===4?w.readVarint64():Q===5?w.readVarint():Q===6?w.readSVarint():Q===7?w.readBoolean():null}return I}(f))}vc.prototype.feature=function(A){if(A<0||A>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[A];var l=this._pbf.readVarint()+this._pbf.pos;return new ky(this._pbf,l,this.extent,this._keys,this._values)};var Xl=Sf;function bl(A,l,f){if(A===3){var w=new Xl(f,f.readVarint()+f.pos);w.length&&(l[w.name]=w)}}Eu.VectorTile=function(A,l){this.layers=A.readFields(bl,{},l)},Eu.VectorTileFeature=Zn,Eu.VectorTileLayer=Sf;const Fo=Eu.VectorTileFeature.types,Mf=Math.pow(2,13);function Za(A,l,f,w,I,z,Q,Z){A.emplaceBack(l,f,2*Math.floor(w*Mf)+Q,I*Mf*2,z*Mf*2,Math.round(Z))}class If{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(f=>f.id),this.index=l.index,this.hasPattern=!1,this.layoutVertexArray=new Cr,this.centroidVertexArray=new Un,this.indexArray=new mo,this.programConfigurations=new si(l.layers,l.zoom),this.segments=new a,this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id)}populate(l,f,w){this.features=[],this.hasPattern=lg("fill-extrusion",this.layers,f);for(const{feature:I,id:z,index:Q,sourceLayerIndex:Z}of l){const re=this.layers[0]._featureFilter.needGeometry,ge=Ai(I,re);if(!this.layers[0]._featureFilter.filter(new Zr(this.zoom),ge,w))continue;const Ce={id:z,sourceLayerIndex:Z,index:Q,geometry:re?ge.geometry:Ri(I),properties:I.properties,type:I.type,patterns:{}};this.hasPattern?this.features.push(cg("fill-extrusion",this.layers,Ce,this.zoom,f)):this.addFeature(Ce,Ce.geometry,Q,w,{}),f.featureIndex.insert(I,Ce.geometry,Q,Z,this.index,!0)}}addFeatures(l,f,w){for(const I of this.features){const{geometry:z}=I;this.addFeature(I,z,I.index,f,w)}}update(l,f,w){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,f,this.stateDependentLayers,w)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,l1),this.centroidVertexBuffer=l.createVertexBuffer(this.centroidVertexArray,xc.members,!0),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(l,f,w,I,z){const Q={x:0,y:0,vertexCount:0};for(const Z of lh(f,500)){let re=0;for(const $e of Z)re+=$e.length;let ge=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const $e of Z){if($e.length===0||ug($e))continue;let Rt=0;for(let Mt=0;Mt<$e.length;Mt++){const ri=$e[Mt];if(Mt>=1){const gi=$e[Mt-1];if(!ud(ri,gi)){ge.vertexLength+4>a.MAX_VERTEX_ARRAY_LENGTH&&(ge=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ei=ri.sub(gi)._perp()._unit(),ui=gi.dist(ri);Rt+ui>32768&&(Rt=0),Za(this.layoutVertexArray,ri.x,ri.y,ei.x,ei.y,0,0,Rt),Za(this.layoutVertexArray,ri.x,ri.y,ei.x,ei.y,0,1,Rt),Q.x+=2*ri.x,Q.y+=2*ri.y,Q.vertexCount+=2,Rt+=ui,Za(this.layoutVertexArray,gi.x,gi.y,ei.x,ei.y,0,0,Rt),Za(this.layoutVertexArray,gi.x,gi.y,ei.x,ei.y,0,1,Rt),Q.x+=2*gi.x,Q.y+=2*gi.y,Q.vertexCount+=2;const Pi=ge.vertexLength;this.indexArray.emplaceBack(Pi,Pi+2,Pi+1),this.indexArray.emplaceBack(Pi+1,Pi+2,Pi+3),ge.vertexLength+=4,ge.primitiveLength+=2}}}}if(ge.vertexLength+re>a.MAX_VERTEX_ARRAY_LENGTH&&(ge=this.segments.prepareSegment(re,this.layoutVertexArray,this.indexArray)),Fo[l.type]!=="Polygon")continue;const Ce=[],Fe=[],Oe=ge.vertexLength;for(const $e of Z)if($e.length!==0){$e!==Z[0]&&Fe.push(Ce.length/2);for(let Rt=0;Rt<$e.length;Rt++){const Mt=$e[Rt];Za(this.layoutVertexArray,Mt.x,Mt.y,0,0,1,1,0),Q.x+=Mt.x,Q.y+=Mt.y,Q.vertexCount+=1,Ce.push(Mt.x),Ce.push(Mt.y)}}const je=dp.exports(Ce,Fe);for(let $e=0;$e<je.length;$e+=3)this.indexArray.emplaceBack(Oe+je[$e],Oe+je[$e+2],Oe+je[$e+1]);ge.primitiveLength+=je.length/3,ge.vertexLength+=re}for(let Z=0;Z<Q.vertexCount;Z++)this.centroidVertexArray.emplaceBack(Math.floor(Q.x/Q.vertexCount),Math.floor(Q.y/Q.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,w,z,I)}}function ud(A,l){return A.x===l.x&&(A.x<0||A.x>Kt)||A.y===l.y&&(A.y<0||A.y>Kt)}function ug(A){return A.every(l=>l.x<0)||A.every(l=>l.x>Kt)||A.every(l=>l.y<0)||A.every(l=>l.y>Kt)}pn("FillExtrusionBucket",If,{omit:["layers","features"]});var Oy={paint:new Es({"fill-extrusion-opacity":new Fn($t["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Vn($t["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Fn($t["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Fn($t["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new sh($t["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Vn($t["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Vn($t["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Fn($t["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function yA(A,l){return A.x*l.x+A.y*l.y}function Ny(A,l){if(A.length===1){let f=0;const w=l[f++];let I;for(;!I||w.equals(I);)if(I=l[f++],!I)return 1/0;for(;f<l.length;f++){const z=l[f],Q=A[0],Z=I.sub(w),re=z.sub(w),ge=Q.sub(w),Ce=yA(Z,Z),Fe=yA(Z,re),Oe=yA(re,re),je=yA(ge,Z),$e=yA(ge,re),Rt=Ce*Oe-Fe*Fe,Mt=(Oe*je-Fe*$e)/Rt,ri=(Ce*$e-Fe*je)/Rt,gi=w.z*(1-Mt-ri)+I.z*Mt+z.z*ri;if(isFinite(gi))return gi}return 1/0}{let f=1/0;for(const w of l)f=Math.min(f,w.z);return f}}const Ag=Fs([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Qy}=Ag,c1=Fs([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Yh}=c1,xA=Eu.VectorTileFeature.types,Ff=Math.cos(Math.PI/180*37.5),_p=Math.pow(2,14)/.5;class yp{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(f=>f.id),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(f=>{this.gradients[f.id]={}}),this.layoutVertexArray=new Er,this.layoutVertexArray2=new Gr,this.indexArray=new mo,this.programConfigurations=new si(l.layers,l.zoom),this.segments=new a,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id)}populate(l,f,w){this.hasPattern=lg("line",this.layers,f);const I=this.layers[0].layout.get("line-sort-key"),z=!I.isConstant(),Q=[];for(const{feature:Z,id:re,index:ge,sourceLayerIndex:Ce}of l){const Fe=this.layers[0]._featureFilter.needGeometry,Oe=Ai(Z,Fe);if(!this.layers[0]._featureFilter.filter(new Zr(this.zoom),Oe,w))continue;const je=z?I.evaluate(Oe,{},w):void 0,$e={id:re,properties:Z.properties,type:Z.type,sourceLayerIndex:Ce,index:ge,geometry:Fe?Oe.geometry:Ri(Z),patterns:{},sortKey:je};Q.push($e)}z&&Q.sort((Z,re)=>Z.sortKey-re.sortKey);for(const Z of Q){const{geometry:re,index:ge,sourceLayerIndex:Ce}=Z;if(this.hasPattern){const Fe=cg("line",this.layers,Z,this.zoom,f);this.patternFeatures.push(Fe)}else this.addFeature(Z,re,ge,w,{});f.featureIndex.insert(l[ge].feature,re,ge,Ce,this.index)}}update(l,f,w){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,f,this.stateDependentLayers,w)}addFeatures(l,f,w){for(const I of this.patternFeatures)this.addFeature(I,I.geometry,I.index,f,w)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=l.createVertexBuffer(this.layoutVertexArray2,Yh)),this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,Qy),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(l){if(l.properties&&Object.prototype.hasOwnProperty.call(l.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(l.properties,"mapbox_clip_end"))return{start:+l.properties.mapbox_clip_start,end:+l.properties.mapbox_clip_end}}addFeature(l,f,w,I,z){const Q=this.layers[0].layout,Z=Q.get("line-join").evaluate(l,{}),re=Q.get("line-cap"),ge=Q.get("line-miter-limit"),Ce=Q.get("line-round-limit");this.lineClips=this.lineFeatureClips(l);for(const Fe of f)this.addLine(Fe,l,Z,re,ge,Ce);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,w,z,I)}addLine(l,f,w,I,z,Q){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ri=0;ri<l.length-1;ri++)this.totalDistance+=l[ri].dist(l[ri+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const Z=xA[f.type]==="Polygon";let re=l.length;for(;re>=2&&l[re-1].equals(l[re-2]);)re--;let ge=0;for(;ge<re-1&&l[ge].equals(l[ge+1]);)ge++;if(re<(Z?3:2))return;w==="bevel"&&(z=1.05);const Ce=this.overscaling<=16?122880/(512*this.overscaling):0,Fe=this.segments.prepareSegment(10*re,this.layoutVertexArray,this.indexArray);let Oe,je,$e,Rt,Mt;this.e1=this.e2=-1,Z&&(Oe=l[re-2],Mt=l[ge].sub(Oe)._unit()._perp());for(let ri=ge;ri<re;ri++){if($e=ri===re-1?Z?l[ge+1]:void 0:l[ri+1],$e&&l[ri].equals($e))continue;Mt&&(Rt=Mt),Oe&&(je=Oe),Oe=l[ri],Mt=$e?$e.sub(Oe)._unit()._perp():Rt,Rt=Rt||Mt;let gi=Rt.add(Mt);gi.x===0&&gi.y===0||gi._unit();const ei=Rt.x*Mt.x+Rt.y*Mt.y,ui=gi.x*Mt.x+gi.y*Mt.y,Pi=ui!==0?1/ui:1/0,Fi=2*Math.sqrt(2-2*ui),Sn=ui<Ff&&je&&$e,fn=Rt.x*Mt.y-Rt.y*Mt.x>0;if(Sn&&ri>ge){const nn=Oe.dist(je);if(nn>2*Ce){const vn=Oe.sub(Oe.sub(je)._mult(Ce/nn)._round());this.updateDistance(je,vn),this.addCurrentVertex(vn,Rt,0,0,Fe),je=vn}}const mn=je&&$e;let an=mn?w:Z?"butt":I;if(mn&&an==="round"&&(Pi<Q?an="miter":Pi<=2&&(an="fakeround")),an==="miter"&&Pi>z&&(an="bevel"),an==="bevel"&&(Pi>2&&(an="flipbevel"),Pi<z&&(an="miter")),je&&this.updateDistance(je,Oe),an==="miter")gi._mult(Pi),this.addCurrentVertex(Oe,gi,0,0,Fe);else if(an==="flipbevel"){if(Pi>100)gi=Mt.mult(-1);else{const nn=Pi*Rt.add(Mt).mag()/Rt.sub(Mt).mag();gi._perp()._mult(nn*(fn?-1:1))}this.addCurrentVertex(Oe,gi,0,0,Fe),this.addCurrentVertex(Oe,gi.mult(-1),0,0,Fe)}else if(an==="bevel"||an==="fakeround"){const nn=-Math.sqrt(Pi*Pi-1),vn=fn?nn:0,gn=fn?0:nn;if(je&&this.addCurrentVertex(Oe,Rt,vn,gn,Fe),an==="fakeround"){const Ji=Math.round(180*Fi/Math.PI/20);for(let Wn=1;Wn<Ji;Wn++){let zn=Wn/Ji;if(zn!==.5){const ms=zn-.5;zn+=zn*ms*(zn-1)*((1.0904+ei*(ei*(3.55645-1.43519*ei)-3.2452))*ms*ms+(.848013+ei*(.215638*ei-1.06021)))}const yr=Mt.sub(Rt)._mult(zn)._add(Rt)._unit()._mult(fn?-1:1);this.addHalfVertex(Oe,yr.x,yr.y,!1,fn,0,Fe)}}$e&&this.addCurrentVertex(Oe,Mt,-vn,-gn,Fe)}else if(an==="butt")this.addCurrentVertex(Oe,gi,0,0,Fe);else if(an==="square"){const nn=je?1:-1;this.addCurrentVertex(Oe,gi,nn,nn,Fe)}else an==="round"&&(je&&(this.addCurrentVertex(Oe,Rt,0,0,Fe),this.addCurrentVertex(Oe,Rt,1,1,Fe,!0)),$e&&(this.addCurrentVertex(Oe,Mt,-1,-1,Fe,!0),this.addCurrentVertex(Oe,Mt,0,0,Fe)));if(Sn&&ri<re-1){const nn=Oe.dist($e);if(nn>2*Ce){const vn=Oe.add($e.sub(Oe)._mult(Ce/nn)._round());this.updateDistance(Oe,vn),this.addCurrentVertex(vn,Mt,0,0,Fe),Oe=vn}}}}addCurrentVertex(l,f,w,I,z,Q=!1){const Z=f.y*I-f.x,re=-f.y-f.x*I;this.addHalfVertex(l,f.x+f.y*w,f.y-f.x*w,Q,!1,w,z),this.addHalfVertex(l,Z,re,Q,!0,-I,z),this.distance>_p/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(l,f,w,I,z,Q))}addHalfVertex({x:l,y:f},w,I,z,Q,Z,re){const ge=.5*(this.lineClips?this.scaledDistance*(_p-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((l<<1)+(z?1:0),(f<<1)+(Q?1:0),Math.round(63*w)+128,Math.round(63*I)+128,1+(Z===0?0:Z<0?-1:1)|(63&ge)<<2,ge>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const Ce=re.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,Ce),re.primitiveLength++),Q?this.e2=Ce:this.e1=Ce}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(l,f){this.distance+=l.dist(f),this.updateScaledDistance()}}pn("LineBucket",yp,{omit:["layers","patternFeatures"]});const Vy=new Es({"line-cap":new Fn($t.layout_line["line-cap"]),"line-join":new Vn($t.layout_line["line-join"]),"line-miter-limit":new Fn($t.layout_line["line-miter-limit"]),"line-round-limit":new Fn($t.layout_line["line-round-limit"]),"line-sort-key":new Vn($t.layout_line["line-sort-key"])});var Hy={paint:new Es({"line-opacity":new Vn($t.paint_line["line-opacity"]),"line-color":new Vn($t.paint_line["line-color"]),"line-translate":new Fn($t.paint_line["line-translate"]),"line-translate-anchor":new Fn($t.paint_line["line-translate-anchor"]),"line-width":new Vn($t.paint_line["line-width"]),"line-gap-width":new Vn($t.paint_line["line-gap-width"]),"line-offset":new Vn($t.paint_line["line-offset"]),"line-blur":new Vn($t.paint_line["line-blur"]),"line-dasharray":new dA($t.paint_line["line-dasharray"]),"line-pattern":new sh($t.paint_line["line-pattern"]),"line-gradient":new yl($t.paint_line["line-gradient"])}),layout:Vy};const dg=new class extends Vn{possiblyEvaluate(A,l){return l=new Zr(Math.floor(l.zoom),{now:l.now,fadeDuration:l.fadeDuration,zoomHistory:l.zoomHistory,transition:l.transition}),super.possiblyEvaluate(A,l)}evaluate(A,l,f,w){return l=J({},l,{zoom:Math.floor(l.zoom)}),super.evaluate(A,l,f,w)}}(Hy.paint.properties["line-width"].specification);function Gy(A,l){return l>0?l+2*A:A}dg.useIntegerZoom=!0;const pg=Fs([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),h1=Fs([{name:"a_projected_pos",components:3,type:"Float32"}],4);Fs([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const fg=Fs([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Fs([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const mg=Fs([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Wy=Fs([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function vA(A,l,f){return A.sections.forEach(w=>{w.text=function(I,z,Q){const Z=z.layout.get("text-transform").evaluate(Q,{});return Z==="uppercase"?I=I.toLocaleUpperCase():Z==="lowercase"&&(I=I.toLocaleLowerCase()),vs.applyArabicShaping&&(I=vs.applyArabicShaping(I)),I}(w.text,l,f)}),A}Fs([{name:"triangle",components:3,type:"Uint16"}]),Fs([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Fs([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Fs([{type:"Float32",name:"offsetX"}]),Fs([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Ad={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var yo=24,Tu=Yr,xp=function(A,l,f,w,I){var z,Q,Z=8*I-w-1,re=(1<<Z)-1,ge=re>>1,Ce=-7,Fe=f?I-1:0,Oe=f?-1:1,je=A[l+Fe];for(Fe+=Oe,z=je&(1<<-Ce)-1,je>>=-Ce,Ce+=Z;Ce>0;z=256*z+A[l+Fe],Fe+=Oe,Ce-=8);for(Q=z&(1<<-Ce)-1,z>>=-Ce,Ce+=w;Ce>0;Q=256*Q+A[l+Fe],Fe+=Oe,Ce-=8);if(z===0)z=1-ge;else{if(z===re)return Q?NaN:1/0*(je?-1:1);Q+=Math.pow(2,w),z-=ge}return(je?-1:1)*Q*Math.pow(2,z-w)},gg=function(A,l,f,w,I,z){var Q,Z,re,ge=8*z-I-1,Ce=(1<<ge)-1,Fe=Ce>>1,Oe=I===23?Math.pow(2,-24)-Math.pow(2,-77):0,je=w?0:z-1,$e=w?1:-1,Rt=l<0||l===0&&1/l<0?1:0;for(l=Math.abs(l),isNaN(l)||l===1/0?(Z=isNaN(l)?1:0,Q=Ce):(Q=Math.floor(Math.log(l)/Math.LN2),l*(re=Math.pow(2,-Q))<1&&(Q--,re*=2),(l+=Q+Fe>=1?Oe/re:Oe*Math.pow(2,1-Fe))*re>=2&&(Q++,re/=2),Q+Fe>=Ce?(Z=0,Q=Ce):Q+Fe>=1?(Z=(l*re-1)*Math.pow(2,I),Q+=Fe):(Z=l*Math.pow(2,Fe-1)*Math.pow(2,I),Q=0));I>=8;A[f+je]=255&Z,je+=$e,Z/=256,I-=8);for(Q=Q<<I|Z,ge+=I;ge>0;A[f+je]=255&Q,je+=$e,Q/=256,ge-=8);A[f+je-$e]|=128*Rt};function Yr(A){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(A)?A:new Uint8Array(A||0),this.pos=0,this.type=0,this.length=this.buf.length}Yr.Varint=0,Yr.Fixed64=1,Yr.Bytes=2,Yr.Fixed32=5;var Su,_g=4294967296,vp=1/_g,Sa=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function hh(A){return A.type===Yr.Bytes?A.readVarint()+A.pos:A.pos+1}function wA(A,l,f){return f?4294967296*l+(A>>>0):4294967296*(l>>>0)+(A>>>0)}function ql(A,l,f){var w=l<=16383?1:l<=2097151?2:l<=268435455?3:Math.floor(Math.log(l)/(7*Math.LN2));f.realloc(w);for(var I=f.pos-1;I>=A;I--)f.buf[I+w]=f.buf[I]}function yg(A,l){for(var f=0;f<A.length;f++)l.writeVarint(A[f])}function bA(A,l){for(var f=0;f<A.length;f++)l.writeSVarint(A[f])}function wp(A,l){for(var f=0;f<A.length;f++)l.writeFloat(A[f])}function BA(A,l){for(var f=0;f<A.length;f++)l.writeDouble(A[f])}function xg(A,l){for(var f=0;f<A.length;f++)l.writeBoolean(A[f])}function Lf(A,l){for(var f=0;f<A.length;f++)l.writeFixed32(A[f])}function jy(A,l){for(var f=0;f<A.length;f++)l.writeSFixed32(A[f])}function Ky(A,l){for(var f=0;f<A.length;f++)l.writeFixed64(A[f])}function u1(A,l){for(var f=0;f<A.length;f++)l.writeSFixed64(A[f])}function dd(A,l){return(A[l]|A[l+1]<<8|A[l+2]<<16)+16777216*A[l+3]}function CA(A,l,f){A[f]=l,A[f+1]=l>>>8,A[f+2]=l>>>16,A[f+3]=l>>>24}function pd(A,l){return(A[l]|A[l+1]<<8|A[l+2]<<16)+(A[l+3]<<24)}function fd(A,l,f){A===1&&f.readMessage(Jh,l)}function Jh(A,l,f){if(A===3){const{id:w,bitmap:I,width:z,height:Q,left:Z,top:re,advance:ge}=f.readMessage(vg,{});l.push({id:w,bitmap:new Xh({width:z+6,height:Q+6},I),metrics:{width:z,height:Q,left:Z,top:re,advance:ge}})}}function vg(A,l,f){A===1?l.id=f.readVarint():A===2?l.bitmap=f.readBytes():A===3?l.width=f.readVarint():A===4?l.height=f.readVarint():A===5?l.left=f.readSVarint():A===6?l.top=f.readSVarint():A===7&&(l.advance=f.readVarint())}function wg(A){let l=0,f=0;for(const Q of A)l+=Q.w*Q.h,f=Math.max(f,Q.w);A.sort((Q,Z)=>Z.h-Q.h);const w=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(l/.95)),f),h:1/0}];let I=0,z=0;for(const Q of A)for(let Z=w.length-1;Z>=0;Z--){const re=w[Z];if(!(Q.w>re.w||Q.h>re.h)){if(Q.x=re.x,Q.y=re.y,z=Math.max(z,Q.y+Q.h),I=Math.max(I,Q.x+Q.w),Q.w===re.w&&Q.h===re.h){const ge=w.pop();Z<w.length&&(w[Z]=ge)}else Q.h===re.h?(re.x+=Q.w,re.w-=Q.w):Q.w===re.w?(re.y+=Q.h,re.h-=Q.h):(w.push({x:re.x+Q.w,y:re.y,w:re.w-Q.w,h:Q.h}),re.y+=Q.h,re.h-=Q.h);break}}return{w:I,h:z,fill:l/(I*z)||0}}Yr.prototype={destroy:function(){this.buf=null},readFields:function(A,l,f){for(f=f||this.length;this.pos<f;){var w=this.readVarint(),I=w>>3,z=this.pos;this.type=7&w,A(I,l,this),this.pos===z&&this.skip(w)}return l},readMessage:function(A,l){return this.readFields(A,l,this.readVarint()+this.pos)},readFixed32:function(){var A=dd(this.buf,this.pos);return this.pos+=4,A},readSFixed32:function(){var A=pd(this.buf,this.pos);return this.pos+=4,A},readFixed64:function(){var A=dd(this.buf,this.pos)+dd(this.buf,this.pos+4)*_g;return this.pos+=8,A},readSFixed64:function(){var A=dd(this.buf,this.pos)+pd(this.buf,this.pos+4)*_g;return this.pos+=8,A},readFloat:function(){var A=xp(this.buf,this.pos,!0,23,4);return this.pos+=4,A},readDouble:function(){var A=xp(this.buf,this.pos,!0,52,8);return this.pos+=8,A},readVarint:function(A){var l,f,w=this.buf;return l=127&(f=w[this.pos++]),f<128?l:(l|=(127&(f=w[this.pos++]))<<7,f<128?l:(l|=(127&(f=w[this.pos++]))<<14,f<128?l:(l|=(127&(f=w[this.pos++]))<<21,f<128?l:function(I,z,Q){var Z,re,ge=Q.buf;if(Z=(112&(re=ge[Q.pos++]))>>4,re<128||(Z|=(127&(re=ge[Q.pos++]))<<3,re<128)||(Z|=(127&(re=ge[Q.pos++]))<<10,re<128)||(Z|=(127&(re=ge[Q.pos++]))<<17,re<128)||(Z|=(127&(re=ge[Q.pos++]))<<24,re<128)||(Z|=(1&(re=ge[Q.pos++]))<<31,re<128))return wA(I,Z,z);throw new Error("Expected varint not more than 10 bytes")}(l|=(15&(f=w[this.pos]))<<28,A,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var A=this.readVarint();return A%2==1?(A+1)/-2:A/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var A=this.readVarint()+this.pos,l=this.pos;return this.pos=A,A-l>=12&&Sa?function(f,w,I){return Sa.decode(f.subarray(w,I))}(this.buf,l,A):function(f,w,I){for(var z="",Q=w;Q<I;){var Z,re,ge,Ce=f[Q],Fe=null,Oe=Ce>239?4:Ce>223?3:Ce>191?2:1;if(Q+Oe>I)break;Oe===1?Ce<128&&(Fe=Ce):Oe===2?(192&(Z=f[Q+1]))==128&&(Fe=(31&Ce)<<6|63&Z)<=127&&(Fe=null):Oe===3?(re=f[Q+2],(192&(Z=f[Q+1]))==128&&(192&re)==128&&((Fe=(15&Ce)<<12|(63&Z)<<6|63&re)<=2047||Fe>=55296&&Fe<=57343)&&(Fe=null)):Oe===4&&(re=f[Q+2],ge=f[Q+3],(192&(Z=f[Q+1]))==128&&(192&re)==128&&(192&ge)==128&&((Fe=(15&Ce)<<18|(63&Z)<<12|(63&re)<<6|63&ge)<=65535||Fe>=1114112)&&(Fe=null)),Fe===null?(Fe=65533,Oe=1):Fe>65535&&(Fe-=65536,z+=String.fromCharCode(Fe>>>10&1023|55296),Fe=56320|1023&Fe),z+=String.fromCharCode(Fe),Q+=Oe}return z}(this.buf,l,A)},readBytes:function(){var A=this.readVarint()+this.pos,l=this.buf.subarray(this.pos,A);return this.pos=A,l},readPackedVarint:function(A,l){if(this.type!==Yr.Bytes)return A.push(this.readVarint(l));var f=hh(this);for(A=A||[];this.pos<f;)A.push(this.readVarint(l));return A},readPackedSVarint:function(A){if(this.type!==Yr.Bytes)return A.push(this.readSVarint());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readSVarint());return A},readPackedBoolean:function(A){if(this.type!==Yr.Bytes)return A.push(this.readBoolean());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readBoolean());return A},readPackedFloat:function(A){if(this.type!==Yr.Bytes)return A.push(this.readFloat());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readFloat());return A},readPackedDouble:function(A){if(this.type!==Yr.Bytes)return A.push(this.readDouble());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readDouble());return A},readPackedFixed32:function(A){if(this.type!==Yr.Bytes)return A.push(this.readFixed32());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readFixed32());return A},readPackedSFixed32:function(A){if(this.type!==Yr.Bytes)return A.push(this.readSFixed32());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readSFixed32());return A},readPackedFixed64:function(A){if(this.type!==Yr.Bytes)return A.push(this.readFixed64());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readFixed64());return A},readPackedSFixed64:function(A){if(this.type!==Yr.Bytes)return A.push(this.readSFixed64());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readSFixed64());return A},skip:function(A){var l=7&A;if(l===Yr.Varint)for(;this.buf[this.pos++]>127;);else if(l===Yr.Bytes)this.pos=this.readVarint()+this.pos;else if(l===Yr.Fixed32)this.pos+=4;else{if(l!==Yr.Fixed64)throw new Error("Unimplemented type: "+l);this.pos+=8}},writeTag:function(A,l){this.writeVarint(A<<3|l)},realloc:function(A){for(var l=this.length||16;l<this.pos+A;)l*=2;if(l!==this.length){var f=new Uint8Array(l);f.set(this.buf),this.buf=f,this.length=l}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(A){this.realloc(4),CA(this.buf,A,this.pos),this.pos+=4},writeSFixed32:function(A){this.realloc(4),CA(this.buf,A,this.pos),this.pos+=4},writeFixed64:function(A){this.realloc(8),CA(this.buf,-1&A,this.pos),CA(this.buf,Math.floor(A*vp),this.pos+4),this.pos+=8},writeSFixed64:function(A){this.realloc(8),CA(this.buf,-1&A,this.pos),CA(this.buf,Math.floor(A*vp),this.pos+4),this.pos+=8},writeVarint:function(A){(A=+A||0)>268435455||A<0?function(l,f){var w,I;if(l>=0?(w=l%4294967296|0,I=l/4294967296|0):(I=~(-l/4294967296),4294967295^(w=~(-l%4294967296))?w=w+1|0:(w=0,I=I+1|0)),l>=18446744073709552e3||l<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");f.realloc(10),function(z,Q,Z){Z.buf[Z.pos++]=127&z|128,z>>>=7,Z.buf[Z.pos++]=127&z|128,z>>>=7,Z.buf[Z.pos++]=127&z|128,z>>>=7,Z.buf[Z.pos++]=127&z|128,Z.buf[Z.pos]=127&(z>>>=7)}(w,0,f),function(z,Q){var Z=(7&z)<<4;Q.buf[Q.pos++]|=Z|((z>>>=3)?128:0),z&&(Q.buf[Q.pos++]=127&z|((z>>>=7)?128:0),z&&(Q.buf[Q.pos++]=127&z|((z>>>=7)?128:0),z&&(Q.buf[Q.pos++]=127&z|((z>>>=7)?128:0),z&&(Q.buf[Q.pos++]=127&z|((z>>>=7)?128:0),z&&(Q.buf[Q.pos++]=127&z)))))}(I,f)}(A,this):(this.realloc(4),this.buf[this.pos++]=127&A|(A>127?128:0),A<=127||(this.buf[this.pos++]=127&(A>>>=7)|(A>127?128:0),A<=127||(this.buf[this.pos++]=127&(A>>>=7)|(A>127?128:0),A<=127||(this.buf[this.pos++]=A>>>7&127))))},writeSVarint:function(A){this.writeVarint(A<0?2*-A-1:2*A)},writeBoolean:function(A){this.writeVarint(Boolean(A))},writeString:function(A){A=String(A),this.realloc(4*A.length),this.pos++;var l=this.pos;this.pos=function(w,I,z){for(var Q,Z,re=0;re<I.length;re++){if((Q=I.charCodeAt(re))>55295&&Q<57344){if(!Z){Q>56319||re+1===I.length?(w[z++]=239,w[z++]=191,w[z++]=189):Z=Q;continue}if(Q<56320){w[z++]=239,w[z++]=191,w[z++]=189,Z=Q;continue}Q=Z-55296<<10|Q-56320|65536,Z=null}else Z&&(w[z++]=239,w[z++]=191,w[z++]=189,Z=null);Q<128?w[z++]=Q:(Q<2048?w[z++]=Q>>6|192:(Q<65536?w[z++]=Q>>12|224:(w[z++]=Q>>18|240,w[z++]=Q>>12&63|128),w[z++]=Q>>6&63|128),w[z++]=63&Q|128)}return z}(this.buf,A,this.pos);var f=this.pos-l;f>=128&&ql(l,f,this),this.pos=l-1,this.writeVarint(f),this.pos+=f},writeFloat:function(A){this.realloc(4),gg(this.buf,A,this.pos,!0,23,4),this.pos+=4},writeDouble:function(A){this.realloc(8),gg(this.buf,A,this.pos,!0,52,8),this.pos+=8},writeBytes:function(A){var l=A.length;this.writeVarint(l),this.realloc(l);for(var f=0;f<l;f++)this.buf[this.pos++]=A[f]},writeRawMessage:function(A,l){this.pos++;var f=this.pos;A(l,this);var w=this.pos-f;w>=128&&ql(f,w,this),this.pos=f-1,this.writeVarint(w),this.pos+=w},writeMessage:function(A,l,f){this.writeTag(A,Yr.Bytes),this.writeRawMessage(l,f)},writePackedVarint:function(A,l){l.length&&this.writeMessage(A,yg,l)},writePackedSVarint:function(A,l){l.length&&this.writeMessage(A,bA,l)},writePackedBoolean:function(A,l){l.length&&this.writeMessage(A,xg,l)},writePackedFloat:function(A,l){l.length&&this.writeMessage(A,wp,l)},writePackedDouble:function(A,l){l.length&&this.writeMessage(A,BA,l)},writePackedFixed32:function(A,l){l.length&&this.writeMessage(A,Lf,l)},writePackedSFixed32:function(A,l){l.length&&this.writeMessage(A,jy,l)},writePackedFixed64:function(A,l){l.length&&this.writeMessage(A,Ky,l)},writePackedSFixed64:function(A,l){l.length&&this.writeMessage(A,u1,l)},writeBytesField:function(A,l){this.writeTag(A,Yr.Bytes),this.writeBytes(l)},writeFixed32Field:function(A,l){this.writeTag(A,Yr.Fixed32),this.writeFixed32(l)},writeSFixed32Field:function(A,l){this.writeTag(A,Yr.Fixed32),this.writeSFixed32(l)},writeFixed64Field:function(A,l){this.writeTag(A,Yr.Fixed64),this.writeFixed64(l)},writeSFixed64Field:function(A,l){this.writeTag(A,Yr.Fixed64),this.writeSFixed64(l)},writeVarintField:function(A,l){this.writeTag(A,Yr.Varint),this.writeVarint(l)},writeSVarintField:function(A,l){this.writeTag(A,Yr.Varint),this.writeSVarint(l)},writeStringField:function(A,l){this.writeTag(A,Yr.Bytes),this.writeString(l)},writeFloatField:function(A,l){this.writeTag(A,Yr.Fixed32),this.writeFloat(l)},writeDoubleField:function(A,l){this.writeTag(A,Yr.Fixed64),this.writeDouble(l)},writeBooleanField:function(A,l){this.writeVarintField(A,Boolean(l))}};class EA{constructor(l,{pixelRatio:f,version:w,stretchX:I,stretchY:z,content:Q}){this.paddedRect=l,this.pixelRatio=f,this.stretchX=I,this.stretchY=z,this.content=Q,this.version=w}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class md{constructor(l,f){const w={},I={};this.haveRenderCallbacks=[];const z=[];this.addImages(l,w,z),this.addImages(f,I,z);const{w:Q,h:Z}=wg(z),re=new da({width:Q||1,height:Z||1});for(const ge in l){const Ce=l[ge],Fe=w[ge].paddedRect;da.copy(Ce.data,re,{x:0,y:0},{x:Fe.x+1,y:Fe.y+1},Ce.data)}for(const ge in f){const Ce=f[ge],Fe=I[ge].paddedRect,Oe=Fe.x+1,je=Fe.y+1,$e=Ce.data.width,Rt=Ce.data.height;da.copy(Ce.data,re,{x:0,y:0},{x:Oe,y:je},Ce.data),da.copy(Ce.data,re,{x:0,y:Rt-1},{x:Oe,y:je-1},{width:$e,height:1}),da.copy(Ce.data,re,{x:0,y:0},{x:Oe,y:je+Rt},{width:$e,height:1}),da.copy(Ce.data,re,{x:$e-1,y:0},{x:Oe-1,y:je},{width:1,height:Rt}),da.copy(Ce.data,re,{x:0,y:0},{x:Oe+$e,y:je},{width:1,height:Rt})}this.image=re,this.iconPositions=w,this.patternPositions=I}addImages(l,f,w){for(const I in l){const z=l[I],Q={x:0,y:0,w:z.data.width+2,h:z.data.height+2};w.push(Q),f[I]=new EA(Q,z),z.hasRenderCallback&&this.haveRenderCallbacks.push(I)}}patchUpdatedImages(l,f){l.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const w in l.updatedImages)this.patchUpdatedImage(this.iconPositions[w],l.getImage(w),f),this.patchUpdatedImage(this.patternPositions[w],l.getImage(w),f)}patchUpdatedImage(l,f,w){if(!l||!f||l.version===f.version)return;l.version=f.version;const[I,z]=l.tl;w.update(f.data,void 0,{x:I,y:z})}}pn("ImagePosition",EA),pn("ImageAtlas",md),i.WritingMode=void 0,(Su=i.WritingMode||(i.WritingMode={}))[Su.none=0]="none",Su[Su.horizontal=1]="horizontal",Su[Su.vertical=2]="vertical",Su[Su.horizontalOnly=3]="horizontalOnly";const pa=-17;class eu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(l,f){const w=new eu;return w.scale=l||1,w.fontStack=f,w}static forImage(l){const f=new eu;return f.imageName=l,f}}class so{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(l,f){const w=new so;for(let I=0;I<l.sections.length;I++){const z=l.sections[I];z.image?w.addImageSection(z):w.addTextSection(z,f)}return w}length(){return this.text.length}getSection(l){return this.sections[this.sectionIndex[l]]}getSectionIndex(l){return this.sectionIndex[l]}getCharCode(l){return this.text.charCodeAt(l)}verticalizePunctuation(){this.text=function(l){let f="";for(let w=0;w<l.length;w++){const I=l.charCodeAt(w+1)||null,z=l.charCodeAt(w-1)||null;f+=I&&Qh(I)&&!Ad[l[w+1]]||z&&Qh(z)&&!Ad[l[w-1]]||!Ad[l[w]]?l[w]:Ad[l[w]]}return f}(this.text)}trim(){let l=0;for(let w=0;w<this.text.length&&gd[this.text.charCodeAt(w)];w++)l++;let f=this.text.length;for(let w=this.text.length-1;w>=0&&w>=l&&gd[this.text.charCodeAt(w)];w--)f--;this.text=this.text.substring(l,f),this.sectionIndex=this.sectionIndex.slice(l,f)}substring(l,f){const w=new so;return w.text=this.text.substring(l,f),w.sectionIndex=this.sectionIndex.slice(l,f),w.sections=this.sections,w}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((l,f)=>Math.max(l,this.sections[f].scale),0)}addTextSection(l,f){this.text+=l.text,this.sections.push(eu.forText(l.scale,l.fontStack||f));const w=this.sections.length-1;for(let I=0;I<l.text.length;++I)this.sectionIndex.push(w)}addImageSection(l){const f=l.image?l.image.name:"";if(f.length===0)return void me("Can't add FormattedSection with an empty image.");const w=this.getNextImageSectionCharCode();w?(this.text+=String.fromCharCode(w),this.sections.push(eu.forImage(f)),this.sectionIndex.push(this.sections.length-1)):me("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ma(A,l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e,Rt){const Mt=so.fromFeature(A,I);let ri;Fe===i.WritingMode.vertical&&Mt.verticalizePunctuation();const{processBidirectionalText:gi,processStyledBidirectionalText:ei}=vs;if(gi&&Mt.sections.length===1){ri=[];const Fi=gi(Mt.toString(),Df(Mt,ge,z,l,w,je,$e));for(const Sn of Fi){const fn=new so;fn.text=Sn,fn.sections=Mt.sections;for(let mn=0;mn<Sn.length;mn++)fn.sectionIndex.push(0);ri.push(fn)}}else if(ei){ri=[];const Fi=ei(Mt.text,Mt.sectionIndex,Df(Mt,ge,z,l,w,je,$e));for(const Sn of Fi){const fn=new so;fn.text=Sn[0],fn.sectionIndex=Sn[1],fn.sections=Mt.sections,ri.push(fn)}}else ri=function(Fi,Sn){const fn=[],mn=Fi.text;let an=0;for(const nn of Sn)fn.push(Fi.substring(an,nn)),an=nn;return an<mn.length&&fn.push(Fi.substring(an,mn.length)),fn}(Mt,Df(Mt,ge,z,l,w,je,$e));const ui=[],Pi={positionedLines:ui,text:Mt.toString(),top:Ce[1],bottom:Ce[1],left:Ce[0],right:Ce[0],writingMode:Fe,iconsInText:!1,verticalizable:!1};return function(Fi,Sn,fn,mn,an,nn,vn,gn,Ji,Wn,zn,yr){let ms=0,bs=pa,Vs=0,Cl=0;const xo=gn==="right"?1:gn==="left"?0:.5;let Ks=0;for(const io of an){io.trim();const Do=io.getMaxScale(),Po=(Do-1)*yo,fa={positionedGlyphs:[],lineOffset:0};Fi.positionedLines[Ks]=fa;const Jr=fa.positionedGlyphs;let Hs=0;if(!io.length()){bs+=nn,++Ks;continue}for(let $s=0;$s<io.length();$s++){const pr=io.getSection($s),Ya=io.getSectionIndex($s),Uo=io.getCharCode($s);let ao=0,Jl=null,Bc=null,Fa=null,Ah=yo;const El=!(Ji===i.WritingMode.horizontal||!zn&&!cA(Uo)||zn&&(gd[Uo]||(oo=Uo,un.Arabic(oo)||un["Arabic Supplement"](oo)||un["Arabic Extended-A"](oo)||un["Arabic Presentation Forms-A"](oo)||un["Arabic Presentation Forms-B"](oo))));if(pr.imageName){const vr=mn[pr.imageName];if(!vr)continue;Fa=pr.imageName,Fi.iconsInText=Fi.iconsInText||!0,Bc=vr.paddedRect;const Zo=vr.displaySize;pr.scale=pr.scale*yo/yr,Jl={width:Zo[0],height:Zo[1],left:1,top:-3,advance:El?Zo[1]:Zo[0]},ao=Po+(yo-Zo[1]*pr.scale),Ah=Jl.advance;const dh=El?Zo[0]*pr.scale-yo*Do:Zo[1]*pr.scale-yo*Do;dh>0&&dh>Hs&&(Hs=dh)}else{const vr=fn[pr.fontStack],Zo=vr&&vr[Uo];if(Zo&&Zo.rect)Bc=Zo.rect,Jl=Zo.metrics;else{const dh=Sn[pr.fontStack],Sd=dh&&dh[Uo];if(!Sd)continue;Jl=Sd.metrics}ao=(Do-pr.scale)*yo}El?(Fi.verticalizable=!0,Jr.push({glyph:Uo,imageName:Fa,x:ms,y:bs+ao,vertical:El,scale:pr.scale,fontStack:pr.fontStack,sectionIndex:Ya,metrics:Jl,rect:Bc}),ms+=Ah*pr.scale+Wn):(Jr.push({glyph:Uo,imageName:Fa,x:ms,y:bs+ao,vertical:El,scale:pr.scale,fontStack:pr.fontStack,sectionIndex:Ya,metrics:Jl,rect:Bc}),ms+=Jl.advance*pr.scale+Wn)}Jr.length!==0&&(Vs=Math.max(ms-Wn,Vs),TA(Jr,0,Jr.length-1,xo,Hs)),ms=0;const gs=nn*Do+Hs;fa.lineOffset=Math.max(Hs,Po),bs+=gs,Cl=Math.max(gs,Cl),++Ks}var oo;const Lo=bs-pa,{horizontalAlign:$o,verticalAlign:Ia}=Pf(vn);(function(io,Do,Po,fa,Jr,Hs,gs,$s,pr){const Ya=(Do-Po)*Jr;let Uo=0;Uo=Hs!==gs?-$s*fa-pa:(-fa*pr+.5)*gs;for(const ao of io)for(const Jl of ao.positionedGlyphs)Jl.x+=Ya,Jl.y+=Uo})(Fi.positionedLines,xo,$o,Ia,Vs,Cl,nn,Lo,an.length),Fi.top+=-Ia*Lo,Fi.bottom=Fi.top+Lo,Fi.left+=-$o*Vs,Fi.right=Fi.left+Vs}(Pi,l,f,w,ri,Q,Z,re,Fe,ge,Oe,Rt),!function(Fi){for(const Sn of Fi)if(Sn.positionedGlyphs.length!==0)return!1;return!0}(ui)&&Pi}const gd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Qs={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function bg(A,l,f,w,I,z){if(l.imageName){const Q=w[l.imageName];return Q?Q.displaySize[0]*l.scale*yo/z+I:0}{const Q=f[l.fontStack],Z=Q&&Q[A];return Z?Z.metrics.advance*l.scale+I:0}}function _d(A,l,f,w){const I=Math.pow(A-l,2);return w?A<l?I/2:2*I:I+Math.abs(f)*f}function wc(A,l,f){let w=0;return A===10&&(w-=1e4),f&&(w+=150),A!==40&&A!==65288||(w+=50),l!==41&&l!==65289||(w+=50),w}function $y(A,l,f,w,I,z){let Q=null,Z=_d(l,f,I,z);for(const re of w){const ge=_d(l-re.x,f,I,z)+re.badness;ge<=Z&&(Q=re,Z=ge)}return{index:A,x:l,priorBreak:Q,badness:Z}}function Zy(A){return A?Zy(A.priorBreak).concat(A.index):[]}function Df(A,l,f,w,I,z,Q){if(z!=="point")return[];if(!A)return[];const Z=[],re=function(Oe,je,$e,Rt,Mt,ri){let gi=0;for(let ei=0;ei<Oe.length();ei++){const ui=Oe.getSection(ei);gi+=bg(Oe.getCharCode(ei),ui,Rt,Mt,je,ri)}return gi/Math.max(1,Math.ceil(gi/$e))}(A,l,f,w,I,Q),ge=A.text.indexOf("\u200B")>=0;let Ce=0;for(let Oe=0;Oe<A.length();Oe++){const je=A.getSection(Oe),$e=A.getCharCode(Oe);if(gd[$e]||(Ce+=bg($e,je,w,I,l,Q)),Oe<A.length()-1){const Rt=!((Fe=$e)<11904||!(un["Bopomofo Extended"](Fe)||un.Bopomofo(Fe)||un["CJK Compatibility Forms"](Fe)||un["CJK Compatibility Ideographs"](Fe)||un["CJK Compatibility"](Fe)||un["CJK Radicals Supplement"](Fe)||un["CJK Strokes"](Fe)||un["CJK Symbols and Punctuation"](Fe)||un["CJK Unified Ideographs Extension A"](Fe)||un["CJK Unified Ideographs"](Fe)||un["Enclosed CJK Letters and Months"](Fe)||un["Halfwidth and Fullwidth Forms"](Fe)||un.Hiragana(Fe)||un["Ideographic Description Characters"](Fe)||un["Kangxi Radicals"](Fe)||un["Katakana Phonetic Extensions"](Fe)||un.Katakana(Fe)||un["Vertical Forms"](Fe)||un["Yi Radicals"](Fe)||un["Yi Syllables"](Fe)));(Qs[$e]||Rt||je.imageName)&&Z.push($y(Oe+1,Ce,re,Z,wc($e,A.getCharCode(Oe+1),Rt&&ge),!1))}}var Fe;return Zy($y(A.length(),Ce,re,Z,0,!0))}function Pf(A){let l=.5,f=.5;switch(A){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(A){case"bottom":case"bottom-right":case"bottom-left":f=1;break;case"top":case"top-right":case"top-left":f=0}return{horizontalAlign:l,verticalAlign:f}}function TA(A,l,f,w,I){if(!w&&!I)return;const z=A[f],Q=(A[f].x+z.metrics.advance*z.scale)*w;for(let Z=l;Z<=f;Z++)A[Z].x-=Q,A[Z].y+=I}function Xy(A,l,f){const{horizontalAlign:w,verticalAlign:I}=Pf(f),z=l[0]-A.displaySize[0]*w,Q=l[1]-A.displaySize[1]*I;return{image:A,top:Q,bottom:Q+A.displaySize[1],left:z,right:z+A.displaySize[0]}}function Bg(A,l,f,w,I,z){const Q=A.image;let Z;if(Q.content){const Mt=Q.content,ri=Q.pixelRatio||1;Z=[Mt[0]/ri,Mt[1]/ri,Q.displaySize[0]-Mt[2]/ri,Q.displaySize[1]-Mt[3]/ri]}const re=l.left*z,ge=l.right*z;let Ce,Fe,Oe,je;f==="width"||f==="both"?(je=I[0]+re-w[3],Fe=I[0]+ge+w[1]):(je=I[0]+(re+ge-Q.displaySize[0])/2,Fe=je+Q.displaySize[0]);const $e=l.top*z,Rt=l.bottom*z;return f==="height"||f==="both"?(Ce=I[1]+$e-w[0],Oe=I[1]+Rt+w[2]):(Ce=I[1]+($e+Rt-Q.displaySize[1])/2,Oe=Ce+Q.displaySize[1]),{image:Q,top:Ce,right:Fe,bottom:Oe,left:je,collisionPadding:Z}}const uh=128;function Cg(A,l){const{expression:f}=l;if(f.kind==="constant")return{kind:"constant",layoutSize:f.evaluate(new Zr(A+1))};if(f.kind==="source")return{kind:"source"};{const{zoomStops:w,interpolationType:I}=f;let z=0;for(;z<w.length&&w[z]<=A;)z++;z=Math.max(0,z-1);let Q=z;for(;Q<w.length&&w[Q]<A+1;)Q++;Q=Math.min(w.length-1,Q);const Z=w[z],re=w[Q];return f.kind==="composite"?{kind:"composite",minZoom:Z,maxZoom:re,interpolationType:I}:{kind:"camera",minZoom:Z,maxZoom:re,minSize:f.evaluate(new Zr(Z)),maxSize:f.evaluate(new Zr(re)),interpolationType:I}}}class Mu extends xe{constructor(l,f,w,I){super(l,f),this.angle=w,I!==void 0&&(this.segment=I)}clone(){return new Mu(this.x,this.y,this.angle,this.segment)}}function Uf(A,l,f,w,I){if(l.segment===void 0)return!0;let z=l,Q=l.segment+1,Z=0;for(;Z>-f/2;){if(Q--,Q<0)return!1;Z-=A[Q].dist(z),z=A[Q]}Z+=A[Q].dist(A[Q+1]),Q++;const re=[];let ge=0;for(;Z<f/2;){const Ce=A[Q],Fe=A[Q+1];if(!Fe)return!1;let Oe=A[Q-1].angleTo(Ce)-Ce.angleTo(Fe);for(Oe=Math.abs((Oe+3*Math.PI)%(2*Math.PI)-Math.PI),re.push({distance:Z,angleDelta:Oe}),ge+=Oe;Z-re[0].distance>w;)ge-=re.shift().angleDelta;if(ge>I)return!1;Q++,Z+=Ce.dist(Fe)}return!0}function Rf(A){let l=0;for(let f=0;f<A.length-1;f++)l+=A[f].dist(A[f+1]);return l}function zf(A,l,f){return A?.6*l*f:0}function Ko(A,l){return Math.max(A?A.right-A.left:0,l?l.right-l.left:0)}function qy(A,l,f,w,I,z){const Q=zf(f,I,z),Z=Ko(f,w)*z;let re=0;const ge=Rf(A)/2;for(let Ce=0;Ce<A.length-1;Ce++){const Fe=A[Ce],Oe=A[Ce+1],je=Fe.dist(Oe);if(re+je>ge){const $e=(ge-re)/je,Rt=ns(Fe.x,Oe.x,$e),Mt=ns(Fe.y,Oe.y,$e),ri=new Mu(Rt,Mt,Oe.angleTo(Fe),Ce);return ri._round(),!Q||Uf(A,ri,Z,Q,l)?ri:void 0}re+=je}}function A1(A,l,f,w,I,z,Q,Z,re){const ge=zf(w,z,Q),Ce=Ko(w,I),Fe=Ce*Q,Oe=A[0].x===0||A[0].x===re||A[0].y===0||A[0].y===re;return l-Fe<l/4&&(l=Fe+l/4),Eg(A,Oe?l/2*Z%l:(Ce/2+2*z)*Q*Z%l,l,ge,f,Fe,Oe,!1,re)}function Eg(A,l,f,w,I,z,Q,Z,re){const ge=z/2,Ce=Rf(A);let Fe=0,Oe=l-f,je=[];for(let $e=0;$e<A.length-1;$e++){const Rt=A[$e],Mt=A[$e+1],ri=Rt.dist(Mt),gi=Mt.angleTo(Rt);for(;Oe+f<Fe+ri;){Oe+=f;const ei=(Oe-Fe)/ri,ui=ns(Rt.x,Mt.x,ei),Pi=ns(Rt.y,Mt.y,ei);if(ui>=0&&ui<re&&Pi>=0&&Pi<re&&Oe-ge>=0&&Oe+ge<=Ce){const Fi=new Mu(ui,Pi,gi,$e);Fi._round(),w&&!Uf(A,Fi,z,w,I)||je.push(Fi)}}Fe+=ri}return Z||je.length||Q||(je=Eg(A,Fe/2,f,w,I,z,Q,!0,re)),je}function Yy(A,l,f,w,I){const z=[];for(let Q=0;Q<A.length;Q++){const Z=A[Q];let re;for(let ge=0;ge<Z.length-1;ge++){let Ce=Z[ge],Fe=Z[ge+1];Ce.x<l&&Fe.x<l||(Ce.x<l?Ce=new xe(l,Ce.y+(l-Ce.x)/(Fe.x-Ce.x)*(Fe.y-Ce.y))._round():Fe.x<l&&(Fe=new xe(l,Ce.y+(l-Ce.x)/(Fe.x-Ce.x)*(Fe.y-Ce.y))._round()),Ce.y<f&&Fe.y<f||(Ce.y<f?Ce=new xe(Ce.x+(f-Ce.y)/(Fe.y-Ce.y)*(Fe.x-Ce.x),f)._round():Fe.y<f&&(Fe=new xe(Ce.x+(f-Ce.y)/(Fe.y-Ce.y)*(Fe.x-Ce.x),f)._round()),Ce.x>=w&&Fe.x>=w||(Ce.x>=w?Ce=new xe(w,Ce.y+(w-Ce.x)/(Fe.x-Ce.x)*(Fe.y-Ce.y))._round():Fe.x>=w&&(Fe=new xe(w,Ce.y+(w-Ce.x)/(Fe.x-Ce.x)*(Fe.y-Ce.y))._round()),Ce.y>=I&&Fe.y>=I||(Ce.y>=I?Ce=new xe(Ce.x+(I-Ce.y)/(Fe.y-Ce.y)*(Fe.x-Ce.x),I)._round():Fe.y>=I&&(Fe=new xe(Ce.x+(I-Ce.y)/(Fe.y-Ce.y)*(Fe.x-Ce.x),I)._round()),re&&Ce.equals(re[re.length-1])||(re=[Ce],z.push(re)),re.push(Fe)))))}}return z}function Jy(A,l,f,w){const I=[],z=A.image,Q=z.pixelRatio,Z=z.paddedRect.w-2,re=z.paddedRect.h-2,ge=A.right-A.left,Ce=A.bottom-A.top,Fe=z.stretchX||[[0,Z]],Oe=z.stretchY||[[0,re]],je=(nn,vn)=>nn+vn[1]-vn[0],$e=Fe.reduce(je,0),Rt=Oe.reduce(je,0),Mt=Z-$e,ri=re-Rt;let gi=0,ei=$e,ui=0,Pi=Rt,Fi=0,Sn=Mt,fn=0,mn=ri;if(z.content&&w){const nn=z.content;gi=bp(Fe,0,nn[0]),ui=bp(Oe,0,nn[1]),ei=bp(Fe,nn[0],nn[2]),Pi=bp(Oe,nn[1],nn[3]),Fi=nn[0]-gi,fn=nn[1]-ui,Sn=nn[2]-nn[0]-ei,mn=nn[3]-nn[1]-Pi}const an=(nn,vn,gn,Ji)=>{const Wn=Bp(nn.stretch-gi,ei,ge,A.left),zn=yd(nn.fixed-Fi,Sn,nn.stretch,$e),yr=Bp(vn.stretch-ui,Pi,Ce,A.top),ms=yd(vn.fixed-fn,mn,vn.stretch,Rt),bs=Bp(gn.stretch-gi,ei,ge,A.left),Vs=yd(gn.fixed-Fi,Sn,gn.stretch,$e),Cl=Bp(Ji.stretch-ui,Pi,Ce,A.top),xo=yd(Ji.fixed-fn,mn,Ji.stretch,Rt),Ks=new xe(Wn,yr),oo=new xe(bs,yr),Lo=new xe(bs,Cl),$o=new xe(Wn,Cl),Ia=new xe(zn/Q,ms/Q),io=new xe(Vs/Q,xo/Q),Do=l*Math.PI/180;if(Do){const Jr=Math.sin(Do),Hs=Math.cos(Do),gs=[Hs,-Jr,Jr,Hs];Ks._matMult(gs),oo._matMult(gs),$o._matMult(gs),Lo._matMult(gs)}const Po=nn.stretch+nn.fixed,fa=vn.stretch+vn.fixed;return{tl:Ks,tr:oo,bl:$o,br:Lo,tex:{x:z.paddedRect.x+1+Po,y:z.paddedRect.y+1+fa,w:gn.stretch+gn.fixed-Po,h:Ji.stretch+Ji.fixed-fa},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ia,pixelOffsetBR:io,minFontScaleX:Sn/Q/ge,minFontScaleY:mn/Q/Ce,isSDF:f}};if(w&&(z.stretchX||z.stretchY)){const nn=Tg(Fe,Mt,$e),vn=Tg(Oe,ri,Rt);for(let gn=0;gn<nn.length-1;gn++){const Ji=nn[gn],Wn=nn[gn+1];for(let zn=0;zn<vn.length-1;zn++)I.push(an(Ji,vn[zn],Wn,vn[zn+1]))}}else I.push(an({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:Z+1},{fixed:0,stretch:re+1}));return I}function bp(A,l,f){let w=0;for(const I of A)w+=Math.max(l,Math.min(f,I[1]))-Math.max(l,Math.min(f,I[0]));return w}function Tg(A,l,f){const w=[{fixed:-1,stretch:0}];for(const[I,z]of A){const Q=w[w.length-1];w.push({fixed:I-Q.stretch,stretch:Q.stretch}),w.push({fixed:I-Q.stretch,stretch:Q.stretch+(z-I)})}return w.push({fixed:l+1,stretch:f}),w}function Bp(A,l,f,w){return A/l*f+w}function yd(A,l,f,w){return A-l*f/w}pn("Anchor",Mu);class Yl{constructor(l,f,w,I,z,Q,Z,re,ge,Ce){if(this.boxStartIndex=l.length,ge){let Fe=Q.top,Oe=Q.bottom;const je=Q.collisionPadding;je&&(Fe-=je[1],Oe+=je[3]);let $e=Oe-Fe;$e>0&&($e=Math.max(10,$e),this.circleDiameter=$e)}else{let Fe=Q.top*Z-re[0],Oe=Q.bottom*Z+re[2],je=Q.left*Z-re[3],$e=Q.right*Z+re[1];const Rt=Q.collisionPadding;if(Rt&&(je-=Rt[0]*Z,Fe-=Rt[1]*Z,$e+=Rt[2]*Z,Oe+=Rt[3]*Z),Ce){const Mt=new xe(je,Fe),ri=new xe($e,Fe),gi=new xe(je,Oe),ei=new xe($e,Oe),ui=Ce*Math.PI/180;Mt._rotate(ui),ri._rotate(ui),gi._rotate(ui),ei._rotate(ui),je=Math.min(Mt.x,ri.x,gi.x,ei.x),$e=Math.max(Mt.x,ri.x,gi.x,ei.x),Fe=Math.min(Mt.y,ri.y,gi.y,ei.y),Oe=Math.max(Mt.y,ri.y,gi.y,ei.y)}l.emplaceBack(f.x,f.y,je,Fe,$e,Oe,w,I,z)}this.boxEndIndex=l.length}}class Xa{constructor(l=[],f=d1){if(this.data=l,this.length=this.data.length,this.compare=f,this.length>0)for(let w=(this.length>>1)-1;w>=0;w--)this._down(w)}push(l){this.data.push(l),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const l=this.data[0],f=this.data.pop();return this.length--,this.length>0&&(this.data[0]=f,this._down(0)),l}peek(){return this.data[0]}_up(l){const{data:f,compare:w}=this,I=f[l];for(;l>0;){const z=l-1>>1,Q=f[z];if(w(I,Q)>=0)break;f[l]=Q,l=z}f[l]=I}_down(l){const{data:f,compare:w}=this,I=this.length>>1,z=f[l];for(;l<I;){let Q=1+(l<<1),Z=f[Q];const re=Q+1;if(re<this.length&&w(f[re],Z)<0&&(Q=re,Z=f[re]),w(Z,z)>=0)break;f[l]=Z,l=Q}f[l]=z}}function d1(A,l){return A<l?-1:A>l?1:0}function Sg(A,l=1,f=!1){let w=1/0,I=1/0,z=-1/0,Q=-1/0;const Z=A[0];for(let je=0;je<Z.length;je++){const $e=Z[je];(!je||$e.x<w)&&(w=$e.x),(!je||$e.y<I)&&(I=$e.y),(!je||$e.x>z)&&(z=$e.x),(!je||$e.y>Q)&&(Q=$e.y)}const re=Math.min(z-w,Q-I);let ge=re/2;const Ce=new Xa([],p1);if(re===0)return new xe(w,I);for(let je=w;je<z;je+=re)for(let $e=I;$e<Q;$e+=re)Ce.push(new xd(je+ge,$e+ge,ge,A));let Fe=function(je){let $e=0,Rt=0,Mt=0;const ri=je[0];for(let gi=0,ei=ri.length,ui=ei-1;gi<ei;ui=gi++){const Pi=ri[gi],Fi=ri[ui],Sn=Pi.x*Fi.y-Fi.x*Pi.y;Rt+=(Pi.x+Fi.x)*Sn,Mt+=(Pi.y+Fi.y)*Sn,$e+=3*Sn}return new xd(Rt/$e,Mt/$e,0,je)}(A),Oe=Ce.length;for(;Ce.length;){const je=Ce.pop();(je.d>Fe.d||!Fe.d)&&(Fe=je,f&&console.log("found best %d after %d probes",Math.round(1e4*je.d)/1e4,Oe)),je.max-Fe.d<=l||(ge=je.h/2,Ce.push(new xd(je.p.x-ge,je.p.y-ge,ge,A)),Ce.push(new xd(je.p.x+ge,je.p.y-ge,ge,A)),Ce.push(new xd(je.p.x-ge,je.p.y+ge,ge,A)),Ce.push(new xd(je.p.x+ge,je.p.y+ge,ge,A)),Oe+=4)}return f&&(console.log(`num probes: ${Oe}`),console.log(`best distance: ${Fe.d}`)),Fe.p}function p1(A,l){return l.max-A.max}function xd(A,l,f,w){this.p=new xe(A,l),this.h=f,this.d=function(I,z){let Q=!1,Z=1/0;for(let re=0;re<z.length;re++){const ge=z[re];for(let Ce=0,Fe=ge.length,Oe=Fe-1;Ce<Fe;Oe=Ce++){const je=ge[Ce],$e=ge[Oe];je.y>I.y!=$e.y>I.y&&I.x<($e.x-je.x)*(I.y-je.y)/($e.y-je.y)+je.x&&(Q=!Q),Z=Math.min(Z,On(I,je,$e))}}return(Q?1:-1)*Math.sqrt(Z)}(this.p,w),this.max=this.d+this.h*Math.SQRT2}const Mg=Number.POSITIVE_INFINITY;function vd(A,l){return l[1]!==Mg?function(f,w,I){let z=0,Q=0;switch(w=Math.abs(w),I=Math.abs(I),f){case"top-right":case"top-left":case"top":Q=I-7;break;case"bottom-right":case"bottom-left":case"bottom":Q=7-I}switch(f){case"top-right":case"bottom-right":case"right":z=-w;break;case"top-left":case"bottom-left":case"left":z=w}return[z,Q]}(A,l[0],l[1]):function(f,w){let I=0,z=0;w<0&&(w=0);const Q=w/Math.sqrt(2);switch(f){case"top-right":case"top-left":z=Q-7;break;case"bottom-right":case"bottom-left":z=7-Q;break;case"bottom":z=7-w;break;case"top":z=w-7}switch(f){case"top-right":case"bottom-right":I=-Q;break;case"top-left":case"bottom-left":I=Q;break;case"left":I=w;break;case"right":I=-w}return[I,z]}(A,l[0])}function wd(A){switch(A){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function e0(A,l,f,w,I,z,Q,Z,re,ge,Ce){let Fe=z.textMaxSize.evaluate(l,{});Fe===void 0&&(Fe=Q);const Oe=A.layers[0].layout,je=Oe.get("icon-offset").evaluate(l,{},Ce),$e=t0(f.horizontal),Rt=Q/24,Mt=A.tilePixelRatio*Rt,ri=A.tilePixelRatio*Fe/24,gi=A.tilePixelRatio*Z,ei=A.tilePixelRatio*Oe.get("symbol-spacing"),ui=Oe.get("text-padding")*A.tilePixelRatio,Pi=function(Ji,Wn,zn,yr=1){const ms=Ji.get("icon-padding").evaluate(Wn,{},zn),bs=ms&&ms.values;return[bs[0]*yr,bs[1]*yr,bs[2]*yr,bs[3]*yr]}(Oe,l,Ce,A.tilePixelRatio),Fi=Oe.get("text-max-angle")/180*Math.PI,Sn=Oe.get("text-rotation-alignment")!=="viewport"&&Oe.get("symbol-placement")!=="point",fn=Oe.get("icon-rotation-alignment")==="map"&&Oe.get("symbol-placement")!=="point",mn=Oe.get("symbol-placement"),an=ei/2,nn=Oe.get("icon-text-fit");let vn;w&&nn!=="none"&&(A.allowVerticalPlacement&&f.vertical&&(vn=Bg(w,f.vertical,nn,Oe.get("icon-text-fit-padding"),je,Rt)),$e&&(w=Bg(w,$e,nn,Oe.get("icon-text-fit-padding"),je,Rt)));const gn=(Ji,Wn)=>{Wn.x<0||Wn.x>=Kt||Wn.y<0||Wn.y>=Kt||function(zn,yr,ms,bs,Vs,Cl,xo,Ks,oo,Lo,$o,Ia,io,Do,Po,fa,Jr,Hs,gs,$s,pr,Ya,Uo,ao,Jl){const Bc=zn.addToLineVertexArray(yr,ms);let Fa,Ah,El,vr,Zo=0,dh=0,Sd=0,ph=0,Iu=-1,Gf=-1;const tu={};let h0=S.exports(""),Rg=0,zg=0;if(Ks._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Rg,zg]=Ks.layout.get("text-offset").evaluate(pr,{},ao).map(Xo=>Xo*yo):(Rg=Ks.layout.get("text-radial-offset").evaluate(pr,{},ao)*yo,zg=Mg),zn.allowVerticalPlacement&&bs.vertical){const Xo=Ks.layout.get("text-rotate").evaluate(pr,{},ao)+90;El=new Yl(oo,yr,Lo,$o,Ia,bs.vertical,io,Do,Po,Xo),xo&&(vr=new Yl(oo,yr,Lo,$o,Ia,xo,Jr,Hs,Po,Xo))}if(Vs){const Xo=Ks.layout.get("icon-rotate").evaluate(pr,{}),Ec=Ks.layout.get("icon-text-fit")!=="none",qo=Jy(Vs,Xo,Uo,Ec),iu=xo?Jy(xo,Xo,Uo,Ec):void 0;Ah=new Yl(oo,yr,Lo,$o,Ia,Vs,Jr,Hs,!1,Xo),Zo=4*qo.length;const IA=zn.iconSizeData;let nu=null;IA.kind==="source"?(nu=[uh*Ks.layout.get("icon-size").evaluate(pr,{})],nu[0]>qa&&me(`${zn.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):IA.kind==="composite"&&(nu=[uh*Ya.compositeIconSizes[0].evaluate(pr,{},ao),uh*Ya.compositeIconSizes[1].evaluate(pr,{},ao)],(nu[0]>qa||nu[1]>qa)&&me(`${zn.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),zn.addSymbols(zn.icon,qo,nu,$s,gs,pr,i.WritingMode.none,yr,Bc.lineStartIndex,Bc.lineLength,-1,ao),Iu=zn.icon.placedSymbolArray.length-1,iu&&(dh=4*iu.length,zn.addSymbols(zn.icon,iu,nu,$s,gs,pr,i.WritingMode.vertical,yr,Bc.lineStartIndex,Bc.lineLength,-1,ao),Gf=zn.icon.placedSymbolArray.length-1)}const u0=Object.keys(bs.horizontal);for(const Xo of u0){const Ec=bs.horizontal[Xo];if(!Fa){h0=S.exports(Ec.text);const iu=Ks.layout.get("text-rotate").evaluate(pr,{},ao);Fa=new Yl(oo,yr,Lo,$o,Ia,Ec,io,Do,Po,iu)}const qo=Ec.positionedLines.length===1;if(Sd+=bd(zn,yr,Ec,Cl,Ks,Po,pr,fa,Bc,bs.vertical?i.WritingMode.horizontal:i.WritingMode.horizontalOnly,qo?u0:[Xo],tu,Iu,Ya,ao),qo)break}bs.vertical&&(ph+=bd(zn,yr,bs.vertical,Cl,Ks,Po,pr,fa,Bc,i.WritingMode.vertical,["vertical"],tu,Gf,Ya,ao));const w1=Fa?Fa.boxStartIndex:zn.collisionBoxArray.length,b1=Fa?Fa.boxEndIndex:zn.collisionBoxArray.length,B1=El?El.boxStartIndex:zn.collisionBoxArray.length,C1=El?El.boxEndIndex:zn.collisionBoxArray.length,Wf=Ah?Ah.boxStartIndex:zn.collisionBoxArray.length,Md=Ah?Ah.boxEndIndex:zn.collisionBoxArray.length,A0=vr?vr.boxStartIndex:zn.collisionBoxArray.length,E1=vr?vr.boxEndIndex:zn.collisionBoxArray.length;let Cc=-1;const jf=(Xo,Ec)=>Xo&&Xo.circleDiameter?Math.max(Xo.circleDiameter,Ec):Ec;Cc=jf(Fa,Cc),Cc=jf(El,Cc),Cc=jf(Ah,Cc),Cc=jf(vr,Cc);const Kf=Cc>-1?1:0;Kf&&(Cc*=Jl/yo),zn.glyphOffsetArray.length>=bc.MAX_GLYPHS&&me("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),pr.sortKey!==void 0&&zn.addToSortKeyRanges(zn.symbolInstances.length,pr.sortKey),zn.symbolInstances.emplaceBack(yr.x,yr.y,tu.right>=0?tu.right:-1,tu.center>=0?tu.center:-1,tu.left>=0?tu.left:-1,tu.vertical||-1,Iu,Gf,h0,w1,b1,B1,C1,Wf,Md,A0,E1,Lo,Sd,ph,Zo,dh,Kf,0,io,Rg,zg,Cc)}(A,Wn,Ji,f,w,I,vn,A.layers[0],A.collisionBoxArray,l.index,l.sourceLayerIndex,A.index,Mt,[ui,ui,ui,ui],Sn,re,gi,Pi,fn,je,l,z,ge,Ce,Q)};if(mn==="line")for(const Ji of Yy(l.geometry,0,0,Kt,Kt)){const Wn=A1(Ji,ei,Fi,f.vertical||$e,w,24,ri,A.overscaling,Kt);for(const zn of Wn){const yr=$e;yr&&f1(A,yr.text,an,zn)||gn(Ji,zn)}}else if(mn==="line-center"){for(const Ji of l.geometry)if(Ji.length>1){const Wn=qy(Ji,Fi,f.vertical||$e,w,24,ri);Wn&&gn(Ji,Wn)}}else if(l.type==="Polygon")for(const Ji of lh(l.geometry,0)){const Wn=Sg(Ji,16);gn(Ji[0],new Mu(Wn.x,Wn.y,0))}else if(l.type==="LineString")for(const Ji of l.geometry)gn(Ji,new Mu(Ji[0].x,Ji[0].y,0));else if(l.type==="Point")for(const Ji of l.geometry)for(const Wn of Ji)gn([Wn],new Mu(Wn.x,Wn.y,0))}const qa=32640;function bd(A,l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e){const Rt=function(gi,ei,ui,Pi,Fi,Sn,fn,mn){const an=Pi.layout.get("text-rotate").evaluate(Sn,{})*Math.PI/180,nn=[];for(const vn of ei.positionedLines)for(const gn of vn.positionedGlyphs){if(!gn.rect)continue;const Ji=gn.rect||{};let Wn=4,zn=!0,yr=1,ms=0;const bs=(Fi||mn)&&gn.vertical,Vs=gn.metrics.advance*gn.scale/2;if(mn&&ei.verticalizable){const gs=(gn.scale-1)*yo,$s=(yo-gn.metrics.width*gn.scale)/2;ms=vn.lineOffset/2-(gn.imageName?-$s:gs)}if(gn.imageName){const gs=fn[gn.imageName];zn=gs.sdf,yr=gs.pixelRatio,Wn=1/yr}const Cl=Fi?[gn.x+Vs,gn.y]:[0,0];let xo=Fi?[0,0]:[gn.x+Vs+ui[0],gn.y+ui[1]-ms],Ks=[0,0];bs&&(Ks=xo,xo=[0,0]);const oo=(gn.metrics.left-Wn)*gn.scale-Vs+xo[0],Lo=(-gn.metrics.top-Wn)*gn.scale+xo[1],$o=oo+Ji.w*gn.scale/yr,Ia=Lo+Ji.h*gn.scale/yr,io=new xe(oo,Lo),Do=new xe($o,Lo),Po=new xe(oo,Ia),fa=new xe($o,Ia);if(bs){const gs=new xe(-Vs,Vs-pa),$s=-Math.PI/2,pr=12-Vs,Ya=new xe(22-pr,-(gn.imageName?pr:0)),Uo=new xe(...Ks);io._rotateAround($s,gs)._add(Ya)._add(Uo),Do._rotateAround($s,gs)._add(Ya)._add(Uo),Po._rotateAround($s,gs)._add(Ya)._add(Uo),fa._rotateAround($s,gs)._add(Ya)._add(Uo)}if(an){const gs=Math.sin(an),$s=Math.cos(an),pr=[$s,-gs,gs,$s];io._matMult(pr),Do._matMult(pr),Po._matMult(pr),fa._matMult(pr)}const Jr=new xe(0,0),Hs=new xe(0,0);nn.push({tl:io,tr:Do,bl:Po,br:fa,tex:Ji,writingMode:ei.writingMode,glyphOffset:Cl,sectionIndex:gn.sectionIndex,isSDF:zn,pixelOffsetTL:Jr,pixelOffsetBR:Hs,minFontScaleX:0,minFontScaleY:0})}return nn}(0,f,Z,I,z,Q,w,A.allowVerticalPlacement),Mt=A.textSizeData;let ri=null;Mt.kind==="source"?(ri=[uh*I.layout.get("text-size").evaluate(Q,{})],ri[0]>qa&&me(`${A.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Mt.kind==="composite"&&(ri=[uh*je.compositeTextSizes[0].evaluate(Q,{},$e),uh*je.compositeTextSizes[1].evaluate(Q,{},$e)],(ri[0]>qa||ri[1]>qa)&&me(`${A.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),A.addSymbols(A.text,Rt,ri,Z,z,Q,ge,l,re.lineStartIndex,re.lineLength,Oe,$e);for(const gi of Ce)Fe[gi]=A.text.placedSymbolArray.length-1;return 4*Rt.length}function t0(A){for(const l in A)return A[l];return null}function f1(A,l,f,w){const I=A.compareText;if(l in I){const z=I[l];for(let Q=z.length-1;Q>=0;Q--)if(w.dist(z[Q])<f)return!0}else I[l]=[];return I[l].push(w),!1}const m1=Eu.VectorTileFeature.types,g1=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function kf(A,l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe){const je=Z?Math.min(qa,Math.round(Z[0])):0,$e=Z?Math.min(qa,Math.round(Z[1])):0;A.emplaceBack(l,f,Math.round(32*w),Math.round(32*I),z,Q,(je<<1)+(re?1:0),$e,16*ge,16*Ce,256*Fe,256*Oe)}function Ig(A,l,f){A.emplaceBack(l.x,l.y,f),A.emplaceBack(l.x,l.y,f),A.emplaceBack(l.x,l.y,f),A.emplaceBack(l.x,l.y,f)}function _1(A){for(const l of A.sections)if(uA(l.text))return!0;return!1}class Cp{constructor(l){this.layoutVertexArray=new wa,this.indexArray=new mo,this.programConfigurations=l,this.segments=new a,this.dynamicLayoutVertexArray=new Aa,this.opacityVertexArray=new ba,this.placedSymbolArray=new Hi}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(l,f,w,I){this.isEmpty()||(w&&(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,pg.members),this.indexBuffer=l.createIndexBuffer(this.indexArray,f),this.dynamicLayoutVertexBuffer=l.createVertexBuffer(this.dynamicLayoutVertexArray,h1.members,!0),this.opacityVertexBuffer=l.createVertexBuffer(this.opacityVertexArray,g1,!0),this.opacityVertexBuffer.itemSize=1),(w||I)&&this.programConfigurations.upload(l))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}pn("SymbolBuffers",Cp);class Fg{constructor(l,f,w){this.layoutVertexArray=new l,this.layoutAttributes=f,this.indexArray=new w,this.segments=new a,this.collisionVertexArray=new Wo}upload(l){this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=l.createVertexBuffer(this.collisionVertexArray,fg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}pn("CollisionBuffers",Fg);class bc{constructor(l){this.collisionBoxArray=l.collisionBoxArray,this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(Q=>Q.id),this.index=l.index,this.pixelRatio=l.pixelRatio,this.sourceLayerIndex=l.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Fr([]),this.placementViewportMatrix=Fr([]);const f=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cg(this.zoom,f["text-size"]),this.iconSizeData=Cg(this.zoom,f["icon-size"]);const w=this.layers[0].layout,I=w.get("symbol-sort-key"),z=w.get("symbol-z-order");this.canOverlap=Bd(w,"text-overlap","text-allow-overlap")!=="never"||Bd(w,"icon-overlap","icon-allow-overlap")!=="never"||w.get("text-ignore-placement")||w.get("icon-ignore-placement"),this.sortFeaturesByKey=z!=="viewport-y"&&!I.isConstant(),this.sortFeaturesByY=(z==="viewport-y"||z==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,w.get("symbol-placement")==="point"&&(this.writingModes=w.get("text-writing-mode").map(Q=>i.WritingMode[Q])),this.stateDependentLayerIds=this.layers.filter(Q=>Q.isStateDependent()).map(Q=>Q.id),this.sourceID=l.sourceID}createArrays(){this.text=new Cp(new si(this.layers,this.zoom,l=>/^text/.test(l))),this.icon=new Cp(new si(this.layers,this.zoom,l=>/^icon/.test(l))),this.glyphOffsetArray=new cn,this.lineVertexArray=new Bn,this.symbolInstances=new xn}calculateGlyphDependencies(l,f,w,I,z){for(let Q=0;Q<l.length;Q++)if(f[l.charCodeAt(Q)]=!0,(w||I)&&z){const Z=Ad[l.charAt(Q)];Z&&(f[Z.charCodeAt(0)]=!0)}}populate(l,f,w){const I=this.layers[0],z=I.layout,Q=z.get("text-font"),Z=z.get("text-field"),re=z.get("icon-image"),ge=(Z.value.kind!=="constant"||Z.value.value instanceof He&&!Z.value.value.isEmpty()||Z.value.value.toString().length>0)&&(Q.value.kind!=="constant"||Q.value.value.length>0),Ce=re.value.kind!=="constant"||!!re.value.value||Object.keys(re.parameters).length>0,Fe=z.get("symbol-sort-key");if(this.features=[],!ge&&!Ce)return;const Oe=f.iconDependencies,je=f.glyphDependencies,$e=f.availableImages,Rt=new Zr(this.zoom);for(const{feature:Mt,id:ri,index:gi,sourceLayerIndex:ei}of l){const ui=I._featureFilter.needGeometry,Pi=Ai(Mt,ui);if(!I._featureFilter.filter(Rt,Pi,w))continue;let Fi,Sn;if(ui||(Pi.geometry=Ri(Mt)),ge){const mn=I.getValueAndResolveTokens("text-field",Pi,w,$e),an=He.factory(mn);_1(an)&&(this.hasRTLText=!0),(!this.hasRTLText||_l()==="unavailable"||this.hasRTLText&&vs.isParsed())&&(Fi=vA(an,I,Pi))}if(Ce){const mn=I.getValueAndResolveTokens("icon-image",Pi,w,$e);Sn=mn instanceof pt?mn:pt.fromString(mn)}if(!Fi&&!Sn)continue;const fn=this.sortFeaturesByKey?Fe.evaluate(Pi,{},w):void 0;if(this.features.push({id:ri,text:Fi,icon:Sn,index:gi,sourceLayerIndex:ei,geometry:Pi.geometry,properties:Mt.properties,type:m1[Mt.type],sortKey:fn}),Sn&&(Oe[Sn.name]=!0),Fi){const mn=Q.evaluate(Pi,{},w).join(","),an=z.get("text-rotation-alignment")!=="viewport"&&z.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(i.WritingMode.vertical)>=0;for(const nn of Fi.sections)if(nn.image)Oe[nn.image.name]=!0;else{const vn=th(Fi.toString()),gn=nn.fontStack||mn,Ji=je[gn]=je[gn]||{};this.calculateGlyphDependencies(nn.text,Ji,an,this.allowVerticalPlacement,vn)}}}z.get("symbol-placement")==="line"&&(this.features=function(Mt){const ri={},gi={},ei=[];let ui=0;function Pi(mn){ei.push(Mt[mn]),ui++}function Fi(mn,an,nn){const vn=gi[mn];return delete gi[mn],gi[an]=vn,ei[vn].geometry[0].pop(),ei[vn].geometry[0]=ei[vn].geometry[0].concat(nn[0]),vn}function Sn(mn,an,nn){const vn=ri[an];return delete ri[an],ri[mn]=vn,ei[vn].geometry[0].shift(),ei[vn].geometry[0]=nn[0].concat(ei[vn].geometry[0]),vn}function fn(mn,an,nn){const vn=nn?an[0][an[0].length-1]:an[0][0];return`${mn}:${vn.x}:${vn.y}`}for(let mn=0;mn<Mt.length;mn++){const an=Mt[mn],nn=an.geometry,vn=an.text?an.text.toString():null;if(!vn){Pi(mn);continue}const gn=fn(vn,nn),Ji=fn(vn,nn,!0);if(gn in gi&&Ji in ri&&gi[gn]!==ri[Ji]){const Wn=Sn(gn,Ji,nn),zn=Fi(gn,Ji,ei[Wn].geometry);delete ri[gn],delete gi[Ji],gi[fn(vn,ei[zn].geometry,!0)]=zn,ei[Wn].geometry=null}else gn in gi?Fi(gn,Ji,nn):Ji in ri?Sn(gn,Ji,nn):(Pi(mn),ri[gn]=ui-1,gi[Ji]=ui-1)}return ei.filter(mn=>mn.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Mt,ri)=>Mt.sortKey-ri.sortKey)}update(l,f,w){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(l,f,this.layers,w),this.icon.programConfigurations.updatePaintArrays(l,f,this.layers,w))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(l){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(l),this.iconCollisionBox.upload(l)),this.text.upload(l,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(l,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(l,f){const w=this.lineVertexArray.length;if(l.segment!==void 0){let I=l.dist(f[l.segment+1]),z=l.dist(f[l.segment]);const Q={};for(let Z=l.segment+1;Z<f.length;Z++)Q[Z]={x:f[Z].x,y:f[Z].y,tileUnitDistanceFromAnchor:I},Z<f.length-1&&(I+=f[Z+1].dist(f[Z]));for(let Z=l.segment||0;Z>=0;Z--)Q[Z]={x:f[Z].x,y:f[Z].y,tileUnitDistanceFromAnchor:z},Z>0&&(z+=f[Z-1].dist(f[Z]));for(let Z=0;Z<f.length;Z++){const re=Q[Z];this.lineVertexArray.emplaceBack(re.x,re.y,re.tileUnitDistanceFromAnchor)}}return{lineStartIndex:w,lineLength:this.lineVertexArray.length-w}}addSymbols(l,f,w,I,z,Q,Z,re,ge,Ce,Fe,Oe){const je=l.indexArray,$e=l.layoutVertexArray,Rt=l.segments.prepareSegment(4*f.length,$e,je,this.canOverlap?Q.sortKey:void 0),Mt=this.glyphOffsetArray.length,ri=Rt.vertexLength,gi=this.allowVerticalPlacement&&Z===i.WritingMode.vertical?Math.PI/2:0,ei=Q.text&&Q.text.sections;for(let ui=0;ui<f.length;ui++){const{tl:Pi,tr:Fi,bl:Sn,br:fn,tex:mn,pixelOffsetTL:an,pixelOffsetBR:nn,minFontScaleX:vn,minFontScaleY:gn,glyphOffset:Ji,isSDF:Wn,sectionIndex:zn}=f[ui],yr=Rt.vertexLength,ms=Ji[1];kf($e,re.x,re.y,Pi.x,ms+Pi.y,mn.x,mn.y,w,Wn,an.x,an.y,vn,gn),kf($e,re.x,re.y,Fi.x,ms+Fi.y,mn.x+mn.w,mn.y,w,Wn,nn.x,an.y,vn,gn),kf($e,re.x,re.y,Sn.x,ms+Sn.y,mn.x,mn.y+mn.h,w,Wn,an.x,nn.y,vn,gn),kf($e,re.x,re.y,fn.x,ms+fn.y,mn.x+mn.w,mn.y+mn.h,w,Wn,nn.x,nn.y,vn,gn),Ig(l.dynamicLayoutVertexArray,re,gi),je.emplaceBack(yr,yr+1,yr+2),je.emplaceBack(yr+1,yr+2,yr+3),Rt.vertexLength+=4,Rt.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ji[0]),ui!==f.length-1&&zn===f[ui+1].sectionIndex||l.programConfigurations.populatePaintArrays($e.length,Q,Q.index,{},Oe,ei&&ei[zn])}l.placedSymbolArray.emplaceBack(re.x,re.y,Mt,this.glyphOffsetArray.length-Mt,ri,ge,Ce,re.segment,w?w[0]:0,w?w[1]:0,I[0],I[1],Z,0,!1,0,Fe)}_addCollisionDebugVertex(l,f,w,I,z,Q){return f.emplaceBack(0,0),l.emplaceBack(w.x,w.y,I,z,Math.round(Q.x),Math.round(Q.y))}addCollisionDebugVertices(l,f,w,I,z,Q,Z){const re=z.segments.prepareSegment(4,z.layoutVertexArray,z.indexArray),ge=re.vertexLength,Ce=z.layoutVertexArray,Fe=z.collisionVertexArray,Oe=Z.anchorX,je=Z.anchorY;this._addCollisionDebugVertex(Ce,Fe,Q,Oe,je,new xe(l,f)),this._addCollisionDebugVertex(Ce,Fe,Q,Oe,je,new xe(w,f)),this._addCollisionDebugVertex(Ce,Fe,Q,Oe,je,new xe(w,I)),this._addCollisionDebugVertex(Ce,Fe,Q,Oe,je,new xe(l,I)),re.vertexLength+=4;const $e=z.indexArray;$e.emplaceBack(ge,ge+1),$e.emplaceBack(ge+1,ge+2),$e.emplaceBack(ge+2,ge+3),$e.emplaceBack(ge+3,ge),re.primitiveLength+=4}addDebugCollisionBoxes(l,f,w,I){for(let z=l;z<f;z++){const Q=this.collisionBoxArray.get(z);this.addCollisionDebugVertices(Q.x1,Q.y1,Q.x2,Q.y2,I?this.textCollisionBox:this.iconCollisionBox,Q.anchorPoint,w)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Fg(ja,mg.members,Ba),this.iconCollisionBox=new Fg(ja,mg.members,Ba);for(let l=0;l<this.symbolInstances.length;l++){const f=this.symbolInstances.get(l);this.addDebugCollisionBoxes(f.textBoxStartIndex,f.textBoxEndIndex,f,!0),this.addDebugCollisionBoxes(f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f,!0),this.addDebugCollisionBoxes(f.iconBoxStartIndex,f.iconBoxEndIndex,f,!1),this.addDebugCollisionBoxes(f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f,!1)}}_deserializeCollisionBoxesForSymbol(l,f,w,I,z,Q,Z,re,ge){const Ce={};for(let Fe=f;Fe<w;Fe++){const Oe=l.get(Fe);Ce.textBox={x1:Oe.x1,y1:Oe.y1,x2:Oe.x2,y2:Oe.y2,anchorPointX:Oe.anchorPointX,anchorPointY:Oe.anchorPointY},Ce.textFeatureIndex=Oe.featureIndex;break}for(let Fe=I;Fe<z;Fe++){const Oe=l.get(Fe);Ce.verticalTextBox={x1:Oe.x1,y1:Oe.y1,x2:Oe.x2,y2:Oe.y2,anchorPointX:Oe.anchorPointX,anchorPointY:Oe.anchorPointY},Ce.verticalTextFeatureIndex=Oe.featureIndex;break}for(let Fe=Q;Fe<Z;Fe++){const Oe=l.get(Fe);Ce.iconBox={x1:Oe.x1,y1:Oe.y1,x2:Oe.x2,y2:Oe.y2,anchorPointX:Oe.anchorPointX,anchorPointY:Oe.anchorPointY},Ce.iconFeatureIndex=Oe.featureIndex;break}for(let Fe=re;Fe<ge;Fe++){const Oe=l.get(Fe);Ce.verticalIconBox={x1:Oe.x1,y1:Oe.y1,x2:Oe.x2,y2:Oe.y2,anchorPointX:Oe.anchorPointX,anchorPointY:Oe.anchorPointY},Ce.verticalIconFeatureIndex=Oe.featureIndex;break}return Ce}deserializeCollisionBoxes(l){this.collisionArrays=[];for(let f=0;f<this.symbolInstances.length;f++){const w=this.symbolInstances.get(f);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(l,w.textBoxStartIndex,w.textBoxEndIndex,w.verticalTextBoxStartIndex,w.verticalTextBoxEndIndex,w.iconBoxStartIndex,w.iconBoxEndIndex,w.verticalIconBoxStartIndex,w.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(l,f){const w=l.placedSymbolArray.get(f),I=w.vertexStartIndex+4*w.numGlyphs;for(let z=w.vertexStartIndex;z<I;z+=4)l.indexArray.emplaceBack(z,z+1,z+2),l.indexArray.emplaceBack(z+1,z+2,z+3)}getSortedSymbolIndexes(l){if(this.sortedAngle===l&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const f=Math.sin(l),w=Math.cos(l),I=[],z=[],Q=[];for(let Z=0;Z<this.symbolInstances.length;++Z){Q.push(Z);const re=this.symbolInstances.get(Z);I.push(0|Math.round(f*re.anchorX+w*re.anchorY)),z.push(re.featureIndex)}return Q.sort((Z,re)=>I[Z]-I[re]||z[re]-z[Z]),Q}addToSortKeyRanges(l,f){const w=this.sortKeyRanges[this.sortKeyRanges.length-1];w&&w.sortKey===f?w.symbolInstanceEnd=l+1:this.sortKeyRanges.push({sortKey:f,symbolInstanceStart:l,symbolInstanceEnd:l+1})}sortFeatures(l){if(this.sortFeaturesByY&&this.sortedAngle!==l&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(l),this.sortedAngle=l,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const f of this.symbolInstanceIndexes){const w=this.symbolInstances.get(f);this.featureSortOrder.push(w.featureIndex),[w.rightJustifiedTextSymbolIndex,w.centerJustifiedTextSymbolIndex,w.leftJustifiedTextSymbolIndex].forEach((I,z,Q)=>{I>=0&&Q.indexOf(I)===z&&this.addIndicesForPlacedSymbol(this.text,I)}),w.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,w.verticalPlacedTextSymbolIndex),w.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,w.placedIconSymbolIndex),w.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,w.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}pn("SymbolBucket",bc,{omit:["layers","collisionBoxArray","features","compareText"]}),bc.MAX_GLYPHS=65535,bc.addDynamicAttributes=Ig;const y1=new Es({"symbol-placement":new Fn($t.layout_symbol["symbol-placement"]),"symbol-spacing":new Fn($t.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Fn($t.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Vn($t.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Fn($t.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Fn($t.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Fn($t.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Fn($t.layout_symbol["icon-ignore-placement"]),"icon-optional":new Fn($t.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Fn($t.layout_symbol["icon-rotation-alignment"]),"icon-size":new Vn($t.layout_symbol["icon-size"]),"icon-text-fit":new Fn($t.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Fn($t.layout_symbol["icon-text-fit-padding"]),"icon-image":new Vn($t.layout_symbol["icon-image"]),"icon-rotate":new Vn($t.layout_symbol["icon-rotate"]),"icon-padding":new Vn($t.layout_symbol["icon-padding"]),"icon-keep-upright":new Fn($t.layout_symbol["icon-keep-upright"]),"icon-offset":new Vn($t.layout_symbol["icon-offset"]),"icon-anchor":new Vn($t.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Fn($t.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Fn($t.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Fn($t.layout_symbol["text-rotation-alignment"]),"text-field":new Vn($t.layout_symbol["text-field"]),"text-font":new Vn($t.layout_symbol["text-font"]),"text-size":new Vn($t.layout_symbol["text-size"]),"text-max-width":new Vn($t.layout_symbol["text-max-width"]),"text-line-height":new Fn($t.layout_symbol["text-line-height"]),"text-letter-spacing":new Vn($t.layout_symbol["text-letter-spacing"]),"text-justify":new Vn($t.layout_symbol["text-justify"]),"text-radial-offset":new Vn($t.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Fn($t.layout_symbol["text-variable-anchor"]),"text-anchor":new Vn($t.layout_symbol["text-anchor"]),"text-max-angle":new Fn($t.layout_symbol["text-max-angle"]),"text-writing-mode":new Fn($t.layout_symbol["text-writing-mode"]),"text-rotate":new Vn($t.layout_symbol["text-rotate"]),"text-padding":new Fn($t.layout_symbol["text-padding"]),"text-keep-upright":new Fn($t.layout_symbol["text-keep-upright"]),"text-transform":new Vn($t.layout_symbol["text-transform"]),"text-offset":new Vn($t.layout_symbol["text-offset"]),"text-allow-overlap":new Fn($t.layout_symbol["text-allow-overlap"]),"text-overlap":new Fn($t.layout_symbol["text-overlap"]),"text-ignore-placement":new Fn($t.layout_symbol["text-ignore-placement"]),"text-optional":new Fn($t.layout_symbol["text-optional"])});var Ps={paint:new Es({"icon-opacity":new Vn($t.paint_symbol["icon-opacity"]),"icon-color":new Vn($t.paint_symbol["icon-color"]),"icon-halo-color":new Vn($t.paint_symbol["icon-halo-color"]),"icon-halo-width":new Vn($t.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Vn($t.paint_symbol["icon-halo-blur"]),"icon-translate":new Fn($t.paint_symbol["icon-translate"]),"icon-translate-anchor":new Fn($t.paint_symbol["icon-translate-anchor"]),"text-opacity":new Vn($t.paint_symbol["text-opacity"]),"text-color":new Vn($t.paint_symbol["text-color"],{runtimeType:vi,getOverride:A=>A.textColor,hasOverride:A=>!!A.textColor}),"text-halo-color":new Vn($t.paint_symbol["text-halo-color"]),"text-halo-width":new Vn($t.paint_symbol["text-halo-width"]),"text-halo-blur":new Vn($t.paint_symbol["text-halo-blur"]),"text-translate":new Fn($t.paint_symbol["text-translate"]),"text-translate-anchor":new Fn($t.paint_symbol["text-translate-anchor"])}),layout:y1};class Ep{constructor(l){if(l.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=l.property.overrides?l.property.overrides.runtimeType:nr,this.defaultValue=l}evaluate(l){if(l.formattedSection){const f=this.defaultValue.property.overrides;if(f&&f.hasOverride(l.formattedSection))return f.getOverride(l.formattedSection)}return l.feature&&l.featureState?this.defaultValue.evaluate(l.feature,l.featureState):this.defaultValue.property.specification.default}eachChild(l){this.defaultValue.isConstant()||l(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}pn("FormatSectionOverride",Ep,{omit:["defaultValue"]});class Tp extends Go{constructor(l){super(l,Ps)}recalculate(l,f){if(super.recalculate(l,f),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const w=this.layout.get("text-writing-mode");if(w){const I=[];for(const z of w)I.indexOf(z)<0&&I.push(z);this.layout._values["text-writing-mode"]=I}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(l,f,w,I){const z=this.layout.get(l).evaluate(f,{},w,I),Q=this._unevaluatedLayout._values[l];return Q.isDataDriven()||Vc(Q.value)||!z?z:function(Z,re){return re.replace(/{([^{}]+)}/g,(ge,Ce)=>Ce in Z?String(Z[Ce]):"")}(f.properties,z)}createBucket(l){return new bc(l)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const l of Ps.paint.overridableProperties){if(!Tp.hasPaintOverride(this.layout,l))continue;const f=this.paint.get(l),w=new Ep(f),I=new Ac(w,f.property.specification);let z=null;z=f.value.kind==="constant"||f.value.kind==="source"?new Lh("source",I):new Gc("composite",I,f.value.zoomStops),this.paint._values[l]=new uo(f.property,z,f.parameters)}}_handleOverridablePaintPropertyUpdate(l,f,w){return!(!this.layout||f.isDataDriven()||w.isDataDriven())&&Tp.hasPaintOverride(this.layout,l)}static hasPaintOverride(l,f){const w=l.get("text-field"),I=Ps.paint.properties[f];let z=!1;const Q=Z=>{for(const re of Z)if(I.overrides&&I.overrides.hasOverride(re))return void(z=!0)};if(w.value.kind==="constant"&&w.value.value instanceof He)Q(w.value.value.sections);else if(w.value.kind==="source"){const Z=ge=>{z||(ge instanceof wi&&Gt(ge.value)===qn?Q(ge.value.sections):ge instanceof Oc?Q(ge.sections):ge.eachChild(Z))},re=w.value;re._styleExpression&&Z(re._styleExpression.expression)}return z}}function Bd(A,l,f){let w="never";const I=A.get(l);return I?w=I:A.get(f)&&(w="always"),w}var Of={paint:new Es({"background-color":new Fn($t.paint_background["background-color"]),"background-pattern":new dA($t.paint_background["background-pattern"]),"background-opacity":new Fn($t.paint_background["background-opacity"])})},Sp={paint:new Es({"raster-opacity":new Fn($t.paint_raster["raster-opacity"]),"raster-hue-rotate":new Fn($t.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Fn($t.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Fn($t.paint_raster["raster-brightness-max"]),"raster-saturation":new Fn($t.paint_raster["raster-saturation"]),"raster-contrast":new Fn($t.paint_raster["raster-contrast"]),"raster-resampling":new Fn($t.paint_raster["raster-resampling"]),"raster-fade-duration":new Fn($t.paint_raster["raster-fade-duration"])})};class i0 extends Go{constructor(l){super(l,{}),this.onAdd=f=>{this.implementation.onAdd&&this.implementation.onAdd(f,f.painter.context.gl)},this.onRemove=f=>{this.implementation.onRemove&&this.implementation.onRemove(f,f.painter.context.gl)},this.implementation=l}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const n0={circle:class extends Go{constructor(A){super(A,jo)}createBucket(A){return new $i(A)}queryRadius(A){const l=A;return Nr("circle-radius",this,l)+Nr("circle-stroke-width",this,l)+Qr(this.paint.get("circle-translate"))}queryIntersectsFeature(A,l,f,w,I,z,Q,Z){const re=go(A,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),z.angle,Q),ge=this.paint.get("circle-radius").evaluate(l,f)+this.paint.get("circle-stroke-width").evaluate(l,f),Ce=this.paint.get("circle-pitch-alignment")==="map",Fe=Ce?re:function(je,$e){return je.map(Rt=>Ea(Rt,$e))}(re,Z),Oe=Ce?ge*Q:ge;for(const je of w)for(const $e of je){const Rt=Ce?$e:Ea($e,Z);let Mt=Oe;const ri=Ka([],[$e.x,$e.y,0,1],Z);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Mt*=ri[3]/z.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Mt*=z.cameraToCenterDistance/ri[3]),pi(Fe,Rt,Mt))return!0}return!1}},heatmap:class extends Go{constructor(A){super(A,Zl),this._updateColorRamp()}createBucket(A){return new vl(A)}_handleSpecialPaintPropertyUpdate(A){A==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sg({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends Go{constructor(A){super(A,og)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends Go{constructor(A){super(A,zy)}recalculate(A,l){super.recalculate(A,l);const f=this.paint._values["fill-outline-color"];f.value.kind==="constant"&&f.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(A){return new hg(A)}queryRadius(){return Qr(this.paint.get("fill-translate"))}queryIntersectsFeature(A,l,f,w,I,z,Q){return In(go(A,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),z.angle,Q),w)}isTileClipped(){return!0}},"fill-extrusion":class extends Go{constructor(A){super(A,Oy)}createBucket(A){return new If(A)}queryRadius(){return Qr(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(A,l,f,w,I,z,Q,Z){const re=go(A,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),z.angle,Q),ge=this.paint.get("fill-extrusion-height").evaluate(l,f),Ce=this.paint.get("fill-extrusion-base").evaluate(l,f),Fe=function(je,$e,Rt,Mt){const ri=[];for(const gi of je){const ei=[gi.x,gi.y,0,1];Ka(ei,ei,$e),ri.push(new xe(ei[0]/ei[3],ei[1]/ei[3]))}return ri}(re,Z),Oe=function(je,$e,Rt,Mt){const ri=[],gi=[],ei=Mt[8]*$e,ui=Mt[9]*$e,Pi=Mt[10]*$e,Fi=Mt[11]*$e,Sn=Mt[8]*Rt,fn=Mt[9]*Rt,mn=Mt[10]*Rt,an=Mt[11]*Rt;for(const nn of je){const vn=[],gn=[];for(const Ji of nn){const Wn=Ji.x,zn=Ji.y,yr=Mt[0]*Wn+Mt[4]*zn+Mt[12],ms=Mt[1]*Wn+Mt[5]*zn+Mt[13],bs=Mt[2]*Wn+Mt[6]*zn+Mt[14],Vs=Mt[3]*Wn+Mt[7]*zn+Mt[15],Cl=bs+Pi,xo=Vs+Fi,Ks=yr+Sn,oo=ms+fn,Lo=bs+mn,$o=Vs+an,Ia=new xe((yr+ei)/xo,(ms+ui)/xo);Ia.z=Cl/xo,vn.push(Ia);const io=new xe(Ks/$o,oo/$o);io.z=Lo/$o,gn.push(io)}ri.push(vn),gi.push(gn)}return[ri,gi]}(w,Ce,ge,Z);return function(je,$e,Rt){let Mt=1/0;In(Rt,$e)&&(Mt=Ny(Rt,$e[0]));for(let ri=0;ri<$e.length;ri++){const gi=$e[ri],ei=je[ri];for(let ui=0;ui<gi.length-1;ui++){const Pi=gi[ui],Fi=[Pi,gi[ui+1],ei[ui+1],ei[ui],Pi];Jt(Rt,Fi)&&(Mt=Math.min(Mt,Ny(Rt,Fi)))}}return Mt!==1/0&&Mt}(Oe[0],Oe[1],Fe)}},line:class extends Go{constructor(A){super(A,Hy),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(A){A==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ql,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(A,l){super.recalculate(A,l),this.paint._values["line-floorwidth"]=dg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,A)}createBucket(A){return new yp(A)}queryRadius(A){const l=A,f=Gy(Nr("line-width",this,l),Nr("line-gap-width",this,l)),w=Nr("line-offset",this,l);return f/2+Math.abs(w)+Qr(this.paint.get("line-translate"))}queryIntersectsFeature(A,l,f,w,I,z,Q){const Z=go(A,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),z.angle,Q),re=Q/2*Gy(this.paint.get("line-width").evaluate(l,f),this.paint.get("line-gap-width").evaluate(l,f)),ge=this.paint.get("line-offset").evaluate(l,f);return ge&&(w=function(Ce,Fe){const Oe=[];for(let je=0;je<Ce.length;je++){const $e=Ce[je],Rt=[];for(let Mt=0;Mt<$e.length;Mt++){const ri=$e[Mt-1],gi=$e[Mt],ei=$e[Mt+1],ui=Mt===0?new xe(0,0):gi.sub(ri)._unit()._perp(),Pi=Mt===$e.length-1?new xe(0,0):ei.sub(gi)._unit()._perp(),Fi=ui._add(Pi)._unit(),Sn=Fi.x*Pi.x+Fi.y*Pi.y;Sn!==0&&Fi._mult(1/Sn),Rt.push(Fi._mult(Fe)._add(gi))}Oe.push(Rt)}return Oe}(w,ge*Q)),function(Ce,Fe,Oe){for(let je=0;je<Fe.length;je++){const $e=Fe[je];if(Ce.length>=3){for(let Rt=0;Rt<$e.length;Rt++)if(Dr(Ce,$e[Rt]))return!0}if(Hn(Ce,$e,Oe))return!0}return!1}(Z,w,re)}isTileClipped(){return!0}},symbol:Tp,background:class extends Go{constructor(A){super(A,Of)}},raster:class extends Go{constructor(A){super(A,Sp)}}};class Mp{constructor(l){this._callback=l,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Nf=63710088e-1;class Ts{constructor(l,f){if(isNaN(l)||isNaN(f))throw new Error(`Invalid LngLat object: (${l}, ${f})`);if(this.lng=+l,this.lat=+f,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ts(G(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(l){const f=Math.PI/180,w=this.lat*f,I=l.lat*f,z=Math.sin(w)*Math.sin(I)+Math.cos(w)*Math.cos(I)*Math.cos((l.lng-this.lng)*f);return Nf*Math.acos(Math.min(z,1))}toBounds(l=0){const f=360*l/40075017,w=f/Math.cos(Math.PI/180*this.lat);return new SA(new Ts(this.lng-w,this.lat-f),new Ts(this.lng+w,this.lat+f))}static convert(l){if(l instanceof Ts)return l;if(Array.isArray(l)&&(l.length===2||l.length===3))return new Ts(Number(l[0]),Number(l[1]));if(!Array.isArray(l)&&typeof l=="object"&&l!==null)return new Ts(Number("lng"in l?l.lng:l.lon),Number(l.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class SA{constructor(l,f){l&&(f?this.setSouthWest(l).setNorthEast(f):l.length===4?this.setSouthWest([l[0],l[1]]).setNorthEast([l[2],l[3]]):this.setSouthWest(l[0]).setNorthEast(l[1]))}setNorthEast(l){return this._ne=l instanceof Ts?new Ts(l.lng,l.lat):Ts.convert(l),this}setSouthWest(l){return this._sw=l instanceof Ts?new Ts(l.lng,l.lat):Ts.convert(l),this}extend(l){const f=this._sw,w=this._ne;let I,z;if(l instanceof Ts)I=l,z=l;else{if(!(l instanceof SA))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(SA.convert(l)):this.extend(Ts.convert(l)):this;if(I=l._sw,z=l._ne,!I||!z)return this}return f||w?(f.lng=Math.min(I.lng,f.lng),f.lat=Math.min(I.lat,f.lat),w.lng=Math.max(z.lng,w.lng),w.lat=Math.max(z.lat,w.lat)):(this._sw=new Ts(I.lng,I.lat),this._ne=new Ts(z.lng,z.lat)),this}getCenter(){return new Ts((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Ts(this.getWest(),this.getNorth())}getSouthEast(){return new Ts(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(l){const{lng:f,lat:w}=Ts.convert(l);let I=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(I=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=w&&w<=this._ne.lat&&I}static convert(l){return l instanceof SA?l:l&&new SA(l)}}const Lg=2*Math.PI*Nf;function Cd(A){return Lg*Math.cos(A*Math.PI/180)}function r0(A){return(180+A)/360}function Qf(A){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+A*Math.PI/360)))/360}function s0(A,l){return A/Cd(l)}function Ip(A){return 360/Math.PI*Math.atan(Math.exp((180-360*A)*Math.PI/180))-90}class Ed{constructor(l,f,w=0){this.x=+l,this.y=+f,this.z=+w}static fromLngLat(l,f=0){const w=Ts.convert(l);return new Ed(r0(w.lng),Qf(w.lat),s0(f,w.lat))}toLngLat(){return new Ts(360*this.x-180,Ip(this.y))}toAltitude(){return this.z*Cd(Ip(this.y))}meterInMercatorCoordinateUnits(){return 1/Lg*(l=Ip(this.y),1/Math.cos(l*Math.PI/180));var l}}function Fp(A,l,f){var w=2*Math.PI*6378137/256/Math.pow(2,f);return[A*w-2*Math.PI*6378137/2,l*w-2*Math.PI*6378137/2]}class Dg{constructor(l,f,w){if(l<0||l>25||w<0||w>=Math.pow(2,l)||f<0||f>=Math.pow(2,l))throw new Error(`x=${f}, y=${w}, z=${l} outside of bounds. 0<=x<${Math.pow(2,l)}, 0<=y<${Math.pow(2,l)} 0<=z<=25 `);this.z=l,this.x=f,this.y=w,this.key=Lp(0,l,l,f,w)}equals(l){return this.z===l.z&&this.x===l.x&&this.y===l.y}url(l,f,w){const I=(Q=this.y,Z=this.z,re=Fp(256*(z=this.x),256*(Q=Math.pow(2,Z)-Q-1),Z),ge=Fp(256*(z+1),256*(Q+1),Z),re[0]+","+re[1]+","+ge[0]+","+ge[1]);var z,Q,Z,re,ge;const Ce=function(Fe,Oe,je){let $e,Rt="";for(let Mt=Fe;Mt>0;Mt--)$e=1<<Mt-1,Rt+=(Oe&$e?1:0)+(je&$e?2:0);return Rt}(this.z,this.x,this.y);return l[(this.x+this.y)%l.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(w==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,f>1?"@2x":"").replace(/{quadkey}/g,Ce).replace(/{bbox-epsg-3857}/g,I)}isChildOf(l){const f=this.z-l.z;return f>0&&l.x===this.x>>f&&l.y===this.y>>f}getTilePoint(l){const f=Math.pow(2,this.z);return new xe((l.x*f-this.x)*Kt,(l.y*f-this.y)*Kt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class o0{constructor(l,f){this.wrap=l,this.canonical=f,this.key=Lp(l,f.z,f.z,f.x,f.y)}}class Bl{constructor(l,f,w,I,z){if(l<w)throw new Error(`overscaledZ should be >= z; overscaledZ = ${l}; z = ${w}`);this.overscaledZ=l,this.wrap=f,this.canonical=new Dg(w,+I,+z),this.key=Lp(f,l,w,I,z)}clone(){return new Bl(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(l){return this.overscaledZ===l.overscaledZ&&this.wrap===l.wrap&&this.canonical.equals(l.canonical)}scaledTo(l){if(l>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${l}; overscaledZ = ${this.overscaledZ}`);const f=this.canonical.z-l;return l>this.canonical.z?new Bl(l,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Bl(l,this.wrap,l,this.canonical.x>>f,this.canonical.y>>f)}calculateScaledKey(l,f){if(l>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${l}; overscaledZ = ${this.overscaledZ}`);const w=this.canonical.z-l;return l>this.canonical.z?Lp(this.wrap*+f,l,this.canonical.z,this.canonical.x,this.canonical.y):Lp(this.wrap*+f,l,l,this.canonical.x>>w,this.canonical.y>>w)}isChildOf(l){if(l.wrap!==this.wrap)return!1;const f=this.canonical.z-l.canonical.z;return l.overscaledZ===0||l.overscaledZ<this.overscaledZ&&l.canonical.x===this.canonical.x>>f&&l.canonical.y===this.canonical.y>>f}children(l){if(this.overscaledZ>=l)return[new Bl(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const f=this.canonical.z+1,w=2*this.canonical.x,I=2*this.canonical.y;return[new Bl(f,this.wrap,f,w,I),new Bl(f,this.wrap,f,w+1,I),new Bl(f,this.wrap,f,w,I+1),new Bl(f,this.wrap,f,w+1,I+1)]}isLessThan(l){return this.wrap<l.wrap||!(this.wrap>l.wrap)&&(this.overscaledZ<l.overscaledZ||!(this.overscaledZ>l.overscaledZ)&&(this.canonical.x<l.canonical.x||!(this.canonical.x>l.canonical.x)&&this.canonical.y<l.canonical.y))}wrapped(){return new Bl(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(l){return new Bl(this.overscaledZ,l,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new o0(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(l){return this.canonical.getTilePoint(new Ed(l.x-this.wrap,l.y))}}function Lp(A,l,f,w,I){(A*=2)<0&&(A=-1*A-1);const z=1<<f;return(z*z*A+z*I+w).toString(36)+f.toString(36)+l.toString(36)}pn("CanonicalTileID",Dg),pn("OverscaledTileID",Bl,{omit:["posMatrix"]});class a0{constructor(l,f,w){if(this.uid=l,f.height!==f.width)throw new RangeError("DEM tiles must be square");if(w&&w!=="mapbox"&&w!=="terrarium")return void me(`"${w}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=f.height;const I=this.dim=f.height-2;this.data=new Uint32Array(f.data.buffer),this.encoding=w||"mapbox";for(let z=0;z<I;z++)this.data[this._idx(-1,z)]=this.data[this._idx(0,z)],this.data[this._idx(I,z)]=this.data[this._idx(I-1,z)],this.data[this._idx(z,-1)]=this.data[this._idx(z,0)],this.data[this._idx(z,I)]=this.data[this._idx(z,I-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(I,-1)]=this.data[this._idx(I-1,0)],this.data[this._idx(-1,I)]=this.data[this._idx(0,I-1)],this.data[this._idx(I,I)]=this.data[this._idx(I-1,I-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let z=0;z<I;z++)for(let Q=0;Q<I;Q++){const Z=this.get(z,Q);Z>this.max&&(this.max=Z),Z<this.min&&(this.min=Z)}}get(l,f){const w=new Uint8Array(this.data.buffer),I=4*this._idx(l,f);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(w[I],w[I+1],w[I+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(l,f){if(l<-1||l>=this.dim+1||f<-1||f>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(f+1)*this.stride+(l+1)}_unpackMapbox(l,f,w){return(256*l*256+256*f+w)/10-1e4}_unpackTerrarium(l,f,w){return 256*l+f+w/256-32768}getPixels(){return new da({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(l,f,w){if(this.dim!==l.dim)throw new Error("dem dimension mismatch");let I=f*this.dim,z=f*this.dim+this.dim,Q=w*this.dim,Z=w*this.dim+this.dim;switch(f){case-1:I=z-1;break;case 1:z=I+1}switch(w){case-1:Q=Z-1;break;case 1:Z=Q+1}const re=-f*this.dim,ge=-w*this.dim;for(let Ce=Q;Ce<Z;Ce++)for(let Fe=I;Fe<z;Fe++)this.data[this._idx(Fe,Ce)]=l.data[this._idx(Fe+re,Ce+ge)]}}pn("DEMData",a0);class l0{constructor(l){this._stringToNumber={},this._numberToString=[];for(let f=0;f<l.length;f++){const w=l[f];this._stringToNumber[w]=f,this._numberToString[f]=w}}encode(l){return this._stringToNumber[l]}decode(l){if(l>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${l} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[l]}}class Dp{constructor(l,f,w,I,z){this.type="Feature",this._vectorTileFeature=l,l._z=f,l._x=w,l._y=I,this.properties=l.properties,this.id=z}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(l){this._geometry=l}toJSON(){const l={geometry:this.geometry};for(const f in this)f!=="_geometry"&&f!=="_vectorTileFeature"&&(l[f]=this[f]);return l}}class c0{constructor(l,f){this.tileID=l,this.x=l.canonical.x,this.y=l.canonical.y,this.z=l.canonical.z,this.grid=new fc(Kt,16,0),this.grid3D=new fc(Kt,16,0),this.featureIndexArray=new ur,this.promoteId=f}insert(l,f,w,I,z,Q){const Z=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(w,I,z);const re=Q?this.grid3D:this.grid;for(let ge=0;ge<f.length;ge++){const Ce=f[ge],Fe=[1/0,1/0,-1/0,-1/0];for(let Oe=0;Oe<Ce.length;Oe++){const je=Ce[Oe];Fe[0]=Math.min(Fe[0],je.x),Fe[1]=Math.min(Fe[1],je.y),Fe[2]=Math.max(Fe[2],je.x),Fe[3]=Math.max(Fe[3],je.y)}Fe[0]<Kt&&Fe[1]<Kt&&Fe[2]>=0&&Fe[3]>=0&&re.insert(Z,Fe[0],Fe[1],Fe[2],Fe[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Eu.VectorTile(new Tu(this.rawTileData)).layers,this.sourceLayerCoder=new l0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(l,f,w,I){this.loadVTLayers();const z=l.params||{},Q=Kt/l.tileSize/l.scale,Z=Ho(z.filter),re=l.queryGeometry,ge=l.queryPadding*Q,Ce=MA(re),Fe=this.grid.query(Ce.minX-ge,Ce.minY-ge,Ce.maxX+ge,Ce.maxY+ge),Oe=MA(l.cameraQueryGeometry),je=this.grid3D.query(Oe.minX-ge,Oe.minY-ge,Oe.maxX+ge,Oe.maxY+ge,(Mt,ri,gi,ei)=>function(ui,Pi,Fi,Sn,fn){for(const an of ui)if(Pi<=an.x&&Fi<=an.y&&Sn>=an.x&&fn>=an.y)return!0;const mn=[new xe(Pi,Fi),new xe(Pi,fn),new xe(Sn,fn),new xe(Sn,Fi)];if(ui.length>2){for(const an of mn)if(Dr(ui,an))return!0}for(let an=0;an<ui.length-1;an++)if(Or(ui[an],ui[an+1],mn))return!0;return!1}(l.cameraQueryGeometry,Mt-ge,ri-ge,gi+ge,ei+ge));for(const Mt of je)Fe.push(Mt);Fe.sort(x1);const $e={};let Rt;for(let Mt=0;Mt<Fe.length;Mt++){const ri=Fe[Mt];if(ri===Rt)continue;Rt=ri;const gi=this.featureIndexArray.get(ri);let ei=null;this.loadMatchingFeature($e,gi.bucketIndex,gi.sourceLayerIndex,gi.featureIndex,Z,z.layers,z.availableImages,f,w,I,(ui,Pi,Fi)=>(ei||(ei=Ri(ui)),Pi.queryIntersectsFeature(re,ui,Fi,ei,this.z,l.transform,Q,l.pixelPosMatrix)))}return $e}loadMatchingFeature(l,f,w,I,z,Q,Z,re,ge,Ce,Fe){const Oe=this.bucketLayerIDs[f];if(Q&&!function(Mt,ri){for(let gi=0;gi<Mt.length;gi++)if(ri.indexOf(Mt[gi])>=0)return!0;return!1}(Q,Oe))return;const je=this.sourceLayerCoder.decode(w),$e=this.vtLayers[je].feature(I);if(z.needGeometry){const Mt=Ai($e,!0);if(!z.filter(new Zr(this.tileID.overscaledZ),Mt,this.tileID.canonical))return}else if(!z.filter(new Zr(this.tileID.overscaledZ),$e))return;const Rt=this.getId($e,je);for(let Mt=0;Mt<Oe.length;Mt++){const ri=Oe[Mt];if(Q&&Q.indexOf(ri)<0)continue;const gi=re[ri];if(!gi)continue;let ei={};Rt&&Ce&&(ei=Ce.getState(gi.sourceLayer||"_geojsonTileLayer",Rt));const ui=J({},ge[ri]);ui.paint=Pg(ui.paint,gi.paint,$e,ei,Z),ui.layout=Pg(ui.layout,gi.layout,$e,ei,Z);const Pi=!Fe||Fe($e,gi,ei);if(!Pi)continue;const Fi=new Dp($e,this.z,this.x,this.y,Rt);Fi.layer=ui;let Sn=l[ri];Sn===void 0&&(Sn=l[ri]=[]),Sn.push({featureIndex:I,feature:Fi,intersectionZ:Pi})}}lookupSymbolFeatures(l,f,w,I,z,Q,Z,re){const ge={};this.loadVTLayers();const Ce=Ho(z);for(const Fe of l)this.loadMatchingFeature(ge,w,I,Fe,Ce,Q,Z,re,f);return ge}hasLayer(l){for(const f of this.bucketLayerIDs)for(const w of f)if(l===w)return!0;return!1}getId(l,f){let w=l.id;return this.promoteId&&(w=l.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[f]],typeof w=="boolean"&&(w=Number(w))),w}}function Pg(A,l,f,w,I){return ae(A,(z,Q)=>{const Z=l instanceof Js?l.get(Q):null;return Z&&Z.evaluate?Z.evaluate(f,w,I):Z})}function MA(A){let l=1/0,f=1/0,w=-1/0,I=-1/0;for(const z of A)l=Math.min(l,z.x),f=Math.min(f,z.y),w=Math.max(w,z.x),I=Math.max(I,z.y);return{minX:l,minY:f,maxX:w,maxY:I}}function x1(A,l){return l-A}var Ug;pn("FeatureIndex",c0,{omit:["rawTileData","sourceLayerCoder"]}),i.PerformanceMarkers=void 0,(Ug=i.PerformanceMarkers||(i.PerformanceMarkers={})).create="create",Ug.load="load",Ug.fullLoad="fullLoad";let Vf=null,Td=[];const Hf=1e3/30,v1={mark(A){performance.mark(A)},frame(A){const l=A;Vf!=null&&Td.push(l-Vf),Vf=l},clearMetrics(){Vf=null,Td=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const A in i.PerformanceMarkers)performance.clearMarks(i.PerformanceMarkers[A])},getPerformanceMetrics(){performance.measure("loadTime",i.PerformanceMarkers.create,i.PerformanceMarkers.load),performance.measure("fullLoadTime",i.PerformanceMarkers.create,i.PerformanceMarkers.fullLoad);const A=performance.getEntriesByName("loadTime")[0].duration,l=performance.getEntriesByName("fullLoadTime")[0].duration,f=Td.length,w=1/(Td.reduce((z,Q)=>z+Q,0)/f/1e3),I=Td.filter(z=>z>Hf).reduce((z,Q)=>z+(Q-Hf)/Hf,0);return{loadTime:A,fullLoadTime:l,fps:w,percentDroppedFrames:I/(f+I)*100}}};i.AJAXError=Ft,i.ARRAY_TYPE=_r,i.Actor=class{constructor(A,l,f){this.target=A,this.parent=l,this.mapId=f,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},B(["receive","process"],this),this.invoker=new Mp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Me()?A:window}send(A,l,f,w,I=!1){const z=Math.round(1e18*Math.random()).toString(36).substring(0,10);f&&(this.callbacks[z]=f);const Q=te(this.globalScope)?void 0:[];return this.target.postMessage({id:z,type:A,hasCallback:!!f,targetMapId:w,mustQueue:I,sourceMapId:this.mapId,data:Wl(l,Q)},Q),{cancel:()=>{f&&delete this.callbacks[z],this.target.postMessage({id:z,type:"<cancel>",targetMapId:w,sourceMapId:this.mapId})}}}receive(A){const l=A.data,f=l.id;if(f&&(!l.targetMapId||this.mapId===l.targetMapId))if(l.type==="<cancel>"){delete this.tasks[f];const w=this.cancelCallbacks[f];delete this.cancelCallbacks[f],w&&w()}else Me()||l.mustQueue?(this.tasks[f]=l,this.taskQueue.push(f),this.invoker.trigger()):this.processTask(f,l)}process(){if(!this.taskQueue.length)return;const A=this.taskQueue.shift(),l=this.tasks[A];delete this.tasks[A],this.taskQueue.length&&this.invoker.trigger(),l&&this.processTask(A,l)}processTask(A,l){if(l.type==="<response>"){const f=this.callbacks[A];delete this.callbacks[A],f&&(l.error?f(Ns(l.error)):f(null,Ns(l.data)))}else{let f=!1;const w=te(this.globalScope)?void 0:[],I=l.hasCallback?(Z,re)=>{f=!0,delete this.cancelCallbacks[A],this.target.postMessage({id:A,type:"<response>",sourceMapId:this.mapId,error:Z?Wl(Z):null,data:Wl(re,w)},w)}:Z=>{f=!0};let z=null;const Q=Ns(l.data);if(this.parent[l.type])z=this.parent[l.type](l.sourceMapId,Q,I);else if(this.parent.getWorkerSource){const Z=l.type.split(".");z=this.parent.getWorkerSource(l.sourceMapId,Z[0],Q.source)[Z[1]](Q,I)}else I(new Error(`Could not find function ${l.type}`));!f&&z&&z.cancel&&(this.cancelCallbacks[A]=z.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.AlphaImage=Xh,i.CanonicalTileID=Dg,i.CollisionBoxArray=Ei,i.CollisionCircleLayoutArray=class extends Te{},i.Color=de,i.DEMData=a0,i.DataConstantProperty=Fn,i.DictionaryCoder=l0,i.EXTENT=Kt,i.ErrorEvent=qi,i.EvaluationParameters=Zr,i.Event=Ni,i.Evented=en,i.FeatureIndex=c0,i.FillBucket=hg,i.FillExtrusionBucket=If,i.GeoJSONFeature=Dp,i.ImageAtlas=md,i.ImagePosition=EA,i.LineBucket=yp,i.LineStripIndexArray=class extends St{},i.LngLat=Ts,i.LngLatBounds=SA,i.MercatorCoordinate=Ed,i.ONE_EM=yo,i.OverscaledTileID=Bl,i.PerformanceUtils=v1,i.PosArray=Un,i.Properties=Es,i.QuadTriangleArray=class extends We{},i.RGBAImage=da,i.RasterBoundsArray=class extends M{},i.RequestPerformance=class{constructor(A){this._marks={start:[A.url,"start"].join("#"),end:[A.url,"end"].join("#"),measure:A.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let A=performance.getEntriesByName(this._marks.measure);return A.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),A=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),A}},i.ResourceType=Ct,i.SegmentVector=a,i.SymbolBucket=bc,i.Transitionable=yc,i.TriangleIndexArray=mo,i.Uniform1f=nt,i.Uniform1i=class extends rt{constructor(A,l){super(A,l),this.current=0}set(A){this.current!==A&&(this.current=A,this.gl.uniform1i(this.location,A))}},i.Uniform2f=class extends rt{constructor(A,l){super(A,l),this.current=[0,0]}set(A){A[0]===this.current[0]&&A[1]===this.current[1]||(this.current=A,this.gl.uniform2f(this.location,A[0],A[1]))}},i.Uniform3f=class extends rt{constructor(A,l){super(A,l),this.current=[0,0,0]}set(A){A[0]===this.current[0]&&A[1]===this.current[1]&&A[2]===this.current[2]||(this.current=A,this.gl.uniform3f(this.location,A[0],A[1],A[2]))}},i.Uniform4f=lt,i.UniformColor=Xe,i.UniformMatrix4f=class extends rt{constructor(A,l){super(A,l),this.current=Ye}set(A){if(A[12]!==this.current[12]||A[0]!==this.current[0])return this.current=A,void this.gl.uniformMatrix4fv(this.location,!1,A);for(let l=1;l<16;l++)if(A[l]!==this.current[l]){this.current=A,this.gl.uniformMatrix4fv(this.location,!1,A);break}}},i.UnwrappedTileID=o0,i.ValidationError=at,i.ZoomHistory=gl,i.add=function(A,l,f){return A[0]=l[0]+f[0],A[1]=l[1]+f[1],A[2]=l[2]+f[2],A},i.addDynamicAttributes=Ig,i.asyncAll=function(A,l,f){if(!A.length)return f(null,[]);let w=A.length;const I=new Array(A.length);let z=null;A.forEach((Q,Z)=>{l(Q,(re,ge)=>{re&&(z=re),I[Z]=ge,--w==0&&f(z,I)})})},i.bezier=U,i.bindAll=B,i.cacheEntryPossiblyAdded=function(A){vt++,vt>qe&&(A.getActor().send("enforceCacheSizeLimit",Ie),vt=0)},i.clamp=R,i.clearTileCache=function(A){const l=caches.delete(Ge);A&&l.catch(A).then(()=>A())},i.clipLine=Yy,i.clone=function(A){var l=new _r(16);return l[0]=A[0],l[1]=A[1],l[2]=A[2],l[3]=A[3],l[4]=A[4],l[5]=A[5],l[6]=A[6],l[7]=A[7],l[8]=A[8],l[9]=A[9],l[10]=A[10],l[11]=A[11],l[12]=A[12],l[13]=A[13],l[14]=A[14],l[15]=A[15],l},i.clone$1=Ae,i.clone$2=function(A){var l=new _r(3);return l[0]=A[0],l[1]=A[1],l[2]=A[2],l},i.collisionCircleLayout=Wy,i.config=Ne,i.copy=function(A,l){return A[0]=l[0],A[1]=l[1],A[2]=l[2],A[3]=l[3],A[4]=l[4],A[5]=l[5],A[6]=l[6],A[7]=l[7],A[8]=l[8],A[9]=l[9],A[10]=l[10],A[11]=l[11],A[12]=l[12],A[13]=l[13],A[14]=l[14],A[15]=l[15],A},i.create=function(){var A=new _r(16);return _r!=Float32Array&&(A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[11]=0,A[12]=0,A[13]=0,A[14]=0),A[0]=1,A[5]=1,A[10]=1,A[15]=1,A},i.create$1=Xr,i.createExpression=Hc,i.createFilter=Ho,i.createLayout=Fs,i.createStyleLayer=function(A){return A.type==="custom"?new i0(A):new n0[A.type](A)},i.cross=function(A,l,f){var w=l[0],I=l[1],z=l[2],Q=f[0],Z=f[1],re=f[2];return A[0]=I*re-z*Z,A[1]=z*Q-w*re,A[2]=w*Z-I*Q,A},i.dot=function(A,l){return A[0]*l[0]+A[1]*l[1]+A[2]*l[2]},i.dot$1=function(A,l){return A[0]*l[0]+A[1]*l[1]+A[2]*l[2]+A[3]*l[3]},i.ease=N,i.emitValidationErrors=Nh,i.enforceCacheSizeLimit=function(A){et(),Ve&&Ve.then(l=>{l.keys().then(f=>{for(let w=0;w<f.length-A;w++)l.delete(f[w])})})},i.equals=function(A,l){var f=A[0],w=A[1],I=A[2],z=A[3],Q=A[4],Z=A[5],re=A[6],ge=A[7],Ce=A[8],Fe=A[9],Oe=A[10],je=A[11],$e=A[12],Rt=A[13],Mt=A[14],ri=A[15],gi=l[0],ei=l[1],ui=l[2],Pi=l[3],Fi=l[4],Sn=l[5],fn=l[6],mn=l[7],an=l[8],nn=l[9],vn=l[10],gn=l[11],Ji=l[12],Wn=l[13],zn=l[14],yr=l[15];return Math.abs(f-gi)<=ws*Math.max(1,Math.abs(f),Math.abs(gi))&&Math.abs(w-ei)<=ws*Math.max(1,Math.abs(w),Math.abs(ei))&&Math.abs(I-ui)<=ws*Math.max(1,Math.abs(I),Math.abs(ui))&&Math.abs(z-Pi)<=ws*Math.max(1,Math.abs(z),Math.abs(Pi))&&Math.abs(Q-Fi)<=ws*Math.max(1,Math.abs(Q),Math.abs(Fi))&&Math.abs(Z-Sn)<=ws*Math.max(1,Math.abs(Z),Math.abs(Sn))&&Math.abs(re-fn)<=ws*Math.max(1,Math.abs(re),Math.abs(fn))&&Math.abs(ge-mn)<=ws*Math.max(1,Math.abs(ge),Math.abs(mn))&&Math.abs(Ce-an)<=ws*Math.max(1,Math.abs(Ce),Math.abs(an))&&Math.abs(Fe-nn)<=ws*Math.max(1,Math.abs(Fe),Math.abs(nn))&&Math.abs(Oe-vn)<=ws*Math.max(1,Math.abs(Oe),Math.abs(vn))&&Math.abs(je-gn)<=ws*Math.max(1,Math.abs(je),Math.abs(gn))&&Math.abs($e-Ji)<=ws*Math.max(1,Math.abs($e),Math.abs(Ji))&&Math.abs(Rt-Wn)<=ws*Math.max(1,Math.abs(Rt),Math.abs(Wn))&&Math.abs(Mt-zn)<=ws*Math.max(1,Math.abs(Mt),Math.abs(zn))&&Math.abs(ri-yr)<=ws*Math.max(1,Math.abs(ri),Math.abs(yr))},i.evaluateSizeForFeature=function(A,{uSize:l,uSizeT:f},{lowerSize:w,upperSize:I}){return A.kind==="source"?w/uh:A.kind==="composite"?ns(w/uh,I/uh,f):l},i.evaluateSizeForZoom=function(A,l){let f=0,w=0;if(A.kind==="constant")w=A.layoutSize;else if(A.kind!=="source"){const{interpolationType:I,minZoom:z,maxZoom:Q}=A,Z=I?R(Vo.interpolationFactor(I,l,z,Q),0,1):0;A.kind==="camera"?w=ns(A.minSize,A.maxSize,Z):f=Z}return{uSizeT:f,uSize:w}},i.evaluateVariableOffset=vd,i.evented=Kl,i.exported=ye,i.exported$1=Be,i.extend=J,i.filterObject=le,i.fromRotation=function(A,l){var f=Math.sin(l),w=Math.cos(l);return A[0]=w,A[1]=f,A[2]=0,A[3]=-f,A[4]=w,A[5]=0,A[6]=0,A[7]=0,A[8]=1,A},i.fromScaling=function(A,l){return A[0]=l[0],A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[5]=l[1],A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[10]=l[2],A[11]=0,A[12]=0,A[13]=0,A[14]=0,A[15]=1,A},i.getAnchorAlignment=Pf,i.getAnchorJustification=wd,i.getArrayBuffer=Gi,i.getImage=yt,i.getJSON=function(A,l){return fi(J(A,{type:"json"}),l)},i.getOverlapMode=Bd,i.getRTLTextPluginStatus=_l,i.getReferrer=Xt,i.getVideo=function(A,l){const f=window.document.createElement("video");f.muted=!0,f.onloadstart=function(){l(null,f)};for(let w=0;w<A.length;w++){const I=window.document.createElement("source");wn(A[w])||(f.crossOrigin="Anonymous"),I.src=A[w],f.appendChild(I)}return{cancel:()=>{}}},i.identity=Fr,i.invert=function(A,l){var f=l[0],w=l[1],I=l[2],z=l[3],Q=l[4],Z=l[5],re=l[6],ge=l[7],Ce=l[8],Fe=l[9],Oe=l[10],je=l[11],$e=l[12],Rt=l[13],Mt=l[14],ri=l[15],gi=f*Z-w*Q,ei=f*re-I*Q,ui=f*ge-z*Q,Pi=w*re-I*Z,Fi=w*ge-z*Z,Sn=I*ge-z*re,fn=Ce*Rt-Fe*$e,mn=Ce*Mt-Oe*$e,an=Ce*ri-je*$e,nn=Fe*Mt-Oe*Rt,vn=Fe*ri-je*Rt,gn=Oe*ri-je*Mt,Ji=gi*gn-ei*vn+ui*nn+Pi*an-Fi*mn+Sn*fn;return Ji?(A[0]=(Z*gn-re*vn+ge*nn)*(Ji=1/Ji),A[1]=(I*vn-w*gn-z*nn)*Ji,A[2]=(Rt*Sn-Mt*Fi+ri*Pi)*Ji,A[3]=(Oe*Fi-Fe*Sn-je*Pi)*Ji,A[4]=(re*an-Q*gn-ge*mn)*Ji,A[5]=(f*gn-I*an+z*mn)*Ji,A[6]=(Mt*ui-$e*Sn-ri*ei)*Ji,A[7]=(Ce*Sn-Oe*ui+je*ei)*Ji,A[8]=(Q*vn-Z*an+ge*fn)*Ji,A[9]=(w*an-f*vn-z*fn)*Ji,A[10]=($e*Fi-Rt*ui+ri*gi)*Ji,A[11]=(Fe*ui-Ce*Fi-je*gi)*Ji,A[12]=(Z*mn-Q*nn-re*fn)*Ji,A[13]=(f*nn-w*mn+I*fn)*Ji,A[14]=(Rt*ei-$e*Pi-Mt*gi)*Ji,A[15]=(Ce*Pi-Fe*ei+Oe*gi)*Ji,A):null},i.isImageBitmap=ce,i.isSafari=te,i.isWorker=Me,i.keysDifference=function(A,l){const f=[];for(const w in A)w in l||f.push(w);return f},i.lazyLoadRTLTextPlugin=function(){vs.isLoading()||vs.isLoaded()||_l()!=="deferred"||An()},i.makeRequest=fi,i.mapObject=ae,i.mercatorXfromLng=r0,i.mercatorYfromLat=Qf,i.mercatorZfromAltitude=s0,i.mul=rs,i.mul$1=function(A,l,f){return A[0]=l[0]*f[0],A[1]=l[1]*f[1],A[2]=l[2]*f[2],A[3]=l[3]*f[3],A},i.multiply=Ls,i.nextPowerOfTwo=function(A){return A<=1?1:Math.pow(2,Math.ceil(Math.log(A)/Math.LN2))},i.normalize=function(A,l){var f=l[0],w=l[1],I=l[2],z=f*f+w*w+I*I;return z>0&&(z=1/Math.sqrt(z)),A[0]=l[0]*z,A[1]=l[1]*z,A[2]=l[2]*z,A},i.number=ns,i.ortho=function(A,l,f,w,I,z,Q){var Z=1/(l-f),re=1/(w-I),ge=1/(z-Q);return A[0]=-2*Z,A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[5]=-2*re,A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[10]=2*ge,A[11]=0,A[12]=(l+f)*Z,A[13]=(I+w)*re,A[14]=(Q+z)*ge,A[15]=1,A},i.parseCacheControl=Ke,i.parseGlyphPbf=function(A){return new Tu(A).readFields(fd,[])},i.pbf=Tu,i.performSymbolLayout=function(A){A.bucket.createArrays(),A.bucket.tilePixelRatio=Kt/(512*A.bucket.overscaling),A.bucket.compareText={},A.bucket.iconsNeedLinear=!1;const l=A.bucket.layers[0].layout,f=A.bucket.layers[0]._unevaluatedLayout._values,w={layoutIconSize:f["icon-size"].possiblyEvaluate(new Zr(A.bucket.zoom+1),A.canonical),layoutTextSize:f["text-size"].possiblyEvaluate(new Zr(A.bucket.zoom+1),A.canonical),textMaxSize:f["text-size"].possiblyEvaluate(new Zr(18))};if(A.bucket.textSizeData.kind==="composite"){const{minZoom:re,maxZoom:ge}=A.bucket.textSizeData;w.compositeTextSizes=[f["text-size"].possiblyEvaluate(new Zr(re),A.canonical),f["text-size"].possiblyEvaluate(new Zr(ge),A.canonical)]}if(A.bucket.iconSizeData.kind==="composite"){const{minZoom:re,maxZoom:ge}=A.bucket.iconSizeData;w.compositeIconSizes=[f["icon-size"].possiblyEvaluate(new Zr(re),A.canonical),f["icon-size"].possiblyEvaluate(new Zr(ge),A.canonical)]}const I=l.get("text-line-height")*yo,z=l.get("text-rotation-alignment")!=="viewport"&&l.get("symbol-placement")!=="point",Q=l.get("text-keep-upright"),Z=l.get("text-size");for(const re of A.bucket.features){const ge=l.get("text-font").evaluate(re,{},A.canonical).join(","),Ce=Z.evaluate(re,{},A.canonical),Fe=w.layoutTextSize.evaluate(re,{},A.canonical),Oe=w.layoutIconSize.evaluate(re,{},A.canonical),je={horizontal:{},vertical:void 0},$e=re.text;let Rt,Mt=[0,0];if($e){const ei=$e.toString(),ui=l.get("text-letter-spacing").evaluate(re,{},A.canonical)*yo,Pi=Ur(ei)?ui:0,Fi=l.get("text-anchor").evaluate(re,{},A.canonical),Sn=l.get("text-variable-anchor");if(!Sn){const vn=l.get("text-radial-offset").evaluate(re,{},A.canonical);Mt=vn?vd(Fi,[vn*yo,Mg]):l.get("text-offset").evaluate(re,{},A.canonical).map(gn=>gn*yo)}let fn=z?"center":l.get("text-justify").evaluate(re,{},A.canonical);const mn=l.get("symbol-placement"),an=mn==="point"?l.get("text-max-width").evaluate(re,{},A.canonical)*yo:0,nn=()=>{A.bucket.allowVerticalPlacement&&th(ei)&&(je.vertical=Ma($e,A.glyphMap,A.glyphPositions,A.imagePositions,ge,an,I,Fi,"left",Pi,Mt,i.WritingMode.vertical,!0,mn,Fe,Ce))};if(!z&&Sn){const vn=fn==="auto"?Sn.map(Ji=>wd(Ji)):[fn];let gn=!1;for(let Ji=0;Ji<vn.length;Ji++){const Wn=vn[Ji];if(!je.horizontal[Wn])if(gn)je.horizontal[Wn]=je.horizontal[0];else{const zn=Ma($e,A.glyphMap,A.glyphPositions,A.imagePositions,ge,an,I,"center",Wn,Pi,Mt,i.WritingMode.horizontal,!1,mn,Fe,Ce);zn&&(je.horizontal[Wn]=zn,gn=zn.positionedLines.length===1)}}nn()}else{fn==="auto"&&(fn=wd(Fi));const vn=Ma($e,A.glyphMap,A.glyphPositions,A.imagePositions,ge,an,I,Fi,fn,Pi,Mt,i.WritingMode.horizontal,!1,mn,Fe,Ce);vn&&(je.horizontal[fn]=vn),nn(),th(ei)&&z&&Q&&(je.vertical=Ma($e,A.glyphMap,A.glyphPositions,A.imagePositions,ge,an,I,Fi,fn,Pi,Mt,i.WritingMode.vertical,!1,mn,Fe,Ce))}}let ri=!1;if(re.icon&&re.icon.name){const ei=A.imageMap[re.icon.name];ei&&(Rt=Xy(A.imagePositions[re.icon.name],l.get("icon-offset").evaluate(re,{},A.canonical),l.get("icon-anchor").evaluate(re,{},A.canonical)),ri=!!ei.sdf,A.bucket.sdfIcons===void 0?A.bucket.sdfIcons=ri:A.bucket.sdfIcons!==ri&&me("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ei.pixelRatio!==A.bucket.pixelRatio||l.get("icon-rotate").constantOr(1)!==0)&&(A.bucket.iconsNeedLinear=!0))}const gi=t0(je.horizontal)||je.vertical;A.bucket.iconsInText=!!gi&&gi.iconsInText,(gi||Rt)&&e0(A.bucket,re,je,Rt,A.imageMap,w,Fe,Oe,Mt,ri,A.canonical)}A.showCollisionBoxes&&A.bucket.generateCollisionDebugBuffers()},i.perspective=function(A,l,f,w,I){var z,Q=1/Math.tan(l/2);return A[0]=Q/f,A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[5]=Q,A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[11]=-1,A[12]=0,A[13]=0,A[15]=0,I!=null&&I!==1/0?(A[10]=(I+w)*(z=1/(w-I)),A[14]=2*I*w*z):(A[10]=-1,A[14]=-2*w),A},i.pick=function(A,l){const f={};for(let w=0;w<l.length;w++){const I=l[w];I in A&&(f[I]=A[I])}return f},i.plugin=vs,i.pointGeometry=xe,i.polygonIntersectsPolygon=Jt,i.potpack=wg,i.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],i.register=pn,i.registerForPluginStateChange=function(A){return A({pluginStatus:Is,pluginURL:fo}),Kl.on("pluginStateChange",A),A},i.renderColorRamp=sg,i.rotateX=function(A,l,f){var w=Math.sin(f),I=Math.cos(f),z=l[4],Q=l[5],Z=l[6],re=l[7],ge=l[8],Ce=l[9],Fe=l[10],Oe=l[11];return l!==A&&(A[0]=l[0],A[1]=l[1],A[2]=l[2],A[3]=l[3],A[12]=l[12],A[13]=l[13],A[14]=l[14],A[15]=l[15]),A[4]=z*I+ge*w,A[5]=Q*I+Ce*w,A[6]=Z*I+Fe*w,A[7]=re*I+Oe*w,A[8]=ge*I-z*w,A[9]=Ce*I-Q*w,A[10]=Fe*I-Z*w,A[11]=Oe*I-re*w,A},i.rotateZ=function(A,l,f){var w=Math.sin(f),I=Math.cos(f),z=l[0],Q=l[1],Z=l[2],re=l[3],ge=l[4],Ce=l[5],Fe=l[6],Oe=l[7];return l!==A&&(A[8]=l[8],A[9]=l[9],A[10]=l[10],A[11]=l[11],A[12]=l[12],A[13]=l[13],A[14]=l[14],A[15]=l[15]),A[0]=z*I+ge*w,A[1]=Q*I+Ce*w,A[2]=Z*I+Fe*w,A[3]=re*I+Oe*w,A[4]=ge*I-z*w,A[5]=Ce*I-Q*w,A[6]=Fe*I-Z*w,A[7]=Oe*I-re*w,A},i.scale=function(A,l,f){var w=f[0],I=f[1],z=f[2];return A[0]=l[0]*w,A[1]=l[1]*w,A[2]=l[2]*w,A[3]=l[3]*w,A[4]=l[4]*I,A[5]=l[5]*I,A[6]=l[6]*I,A[7]=l[7]*I,A[8]=l[8]*z,A[9]=l[9]*z,A[10]=l[10]*z,A[11]=l[11]*z,A[12]=l[12],A[13]=l[13],A[14]=l[14],A[15]=l[15],A},i.scale$1=function(A,l,f){return A[0]=l[0]*f,A[1]=l[1]*f,A[2]=l[2]*f,A},i.setCacheLimits=function(A,l){Ie=A,qe=l},i.setRTLTextPlugin=function(A,l,f=!1){if(Is===Vh||Is===Hh||Is===ih)throw new Error("setRTLTextPlugin cannot be called multiple times.");fo=ye.resolveURL(A),Is=Vh,_c=l,jl(),f||An()},i.spec=$t,i.sphericalToCartesian=function([A,l,f]){return l+=90,l*=Math.PI/180,f*=Math.PI/180,{x:A*Math.cos(l)*Math.sin(f),y:A*Math.sin(l)*Math.sin(f),z:A*Math.cos(f)}},i.sqrLen=function(A){var l=A[0],f=A[1];return l*l+f*f},i.sub=function(A,l,f){return A[0]=l[0]-f[0],A[1]=l[1]-f[1],A[2]=l[2]-f[2],A},i.toEvaluationFeature=Ai,i.transformMat3=function(A,l,f){var w=l[0],I=l[1],z=l[2];return A[0]=w*f[0]+I*f[3]+z*f[6],A[1]=w*f[1]+I*f[4]+z*f[7],A[2]=w*f[2]+I*f[5]+z*f[8],A},i.transformMat4=Ka,i.transformMat4$1=function(A,l,f){var w=l[0],I=l[1];return A[0]=f[0]*w+f[4]*I+f[12],A[1]=f[1]*w+f[5]*I+f[13],A},i.translate=function(A,l,f){var w,I,z,Q,Z,re,ge,Ce,Fe,Oe,je,$e,Rt=f[0],Mt=f[1],ri=f[2];return l===A?(A[12]=l[0]*Rt+l[4]*Mt+l[8]*ri+l[12],A[13]=l[1]*Rt+l[5]*Mt+l[9]*ri+l[13],A[14]=l[2]*Rt+l[6]*Mt+l[10]*ri+l[14],A[15]=l[3]*Rt+l[7]*Mt+l[11]*ri+l[15]):(I=l[1],z=l[2],Q=l[3],Z=l[4],re=l[5],ge=l[6],Ce=l[7],Fe=l[8],Oe=l[9],je=l[10],$e=l[11],A[0]=w=l[0],A[1]=I,A[2]=z,A[3]=Q,A[4]=Z,A[5]=re,A[6]=ge,A[7]=Ce,A[8]=Fe,A[9]=Oe,A[10]=je,A[11]=$e,A[12]=w*Rt+Z*Mt+Fe*ri+l[12],A[13]=I*Rt+re*Mt+Oe*ri+l[13],A[14]=z*Rt+ge*Mt+je*ri+l[14],A[15]=Q*Rt+Ce*Mt+$e*ri+l[15]),A},i.triggerPluginCompletionEvent=Gh,i.unicodeBlockLookup=un,i.uniqueId=function(){return Y++},i.validateCustomStyleLayer=function(A){const l=[],f=A.id;return f===void 0&&l.push({message:`layers.${f}: missing required property "id"`}),A.render===void 0&&l.push({message:`layers.${f}: missing required method "render"`}),A.renderingMode&&A.renderingMode!=="2d"&&A.renderingMode!=="3d"&&l.push({message:`layers.${f}: property "renderingMode" must be either "2d" or "3d"`}),l},i.validateLight=Oh,i.validateStyle=kh,i.vectorTile=Eu,i.warnOnce=me,i.wrap=G}),p(["./shared"],function(i){function C(X){const j=typeof X;if(j==="number"||j==="boolean"||j==="string"||X==null)return JSON.stringify(X);if(Array.isArray(X)){let de="[";for(const Re of X)de+=`${C(Re)},`;return`${de}]`}const ie=Object.keys(X).sort();let ne="{";for(let de=0;de<ie.length;de++)ne+=`${JSON.stringify(ie[de])}:${C(X[ie[de]])},`;return`${ne}}`}function D(X){let j="";for(const ie of i.refProperties)j+=`/${C(X[ie])}`;return j}class U{constructor(j){this.keyCache={},j&&this.replace(j)}replace(j){this._layerConfigs={},this._layers={},this.update(j,[])}update(j,ie){for(const de of j){this._layerConfigs[de.id]=de;const Re=this._layers[de.id]=i.createStyleLayer(de);Re._featureFilter=i.createFilter(Re.filter),this.keyCache[de.id]&&delete this.keyCache[de.id]}for(const de of ie)delete this.keyCache[de],delete this._layerConfigs[de],delete this._layers[de];this.familiesBySource={};const ne=function(de,Re){const tt={};for(let Je=0;Je<de.length;Je++){const pt=Re&&Re[de[Je].id]||D(de[Je]);Re&&(Re[de[Je].id]=pt);let Lt=tt[pt];Lt||(Lt=tt[pt]=[]),Lt.push(de[Je])}const He=[];for(const Je in tt)He.push(tt[Je]);return He}(Object.values(this._layerConfigs),this.keyCache);for(const de of ne){const Re=de.map(jt=>this._layers[jt.id]),tt=Re[0];if(tt.visibility==="none")continue;const He=tt.source||"";let Je=this.familiesBySource[He];Je||(Je=this.familiesBySource[He]={});const pt=tt.sourceLayer||"_geojsonTileLayer";let Lt=Je[pt];Lt||(Lt=Je[pt]=[]),Lt.push(Re)}}}class N{constructor(j){const ie={},ne=[];for(const He in j){const Je=j[He],pt=ie[He]={};for(const Lt in Je){const jt=Je[+Lt];if(!jt||jt.bitmap.width===0||jt.bitmap.height===0)continue;const Gt={x:0,y:0,w:jt.bitmap.width+2,h:jt.bitmap.height+2};ne.push(Gt),pt[Lt]={rect:Gt,metrics:jt.metrics}}}const{w:de,h:Re}=i.potpack(ne),tt=new i.AlphaImage({width:de||1,height:Re||1});for(const He in j){const Je=j[He];for(const pt in Je){const Lt=Je[+pt];if(!Lt||Lt.bitmap.width===0||Lt.bitmap.height===0)continue;const jt=ie[He][pt].rect;i.AlphaImage.copy(Lt.bitmap,tt,{x:0,y:0},{x:jt.x+1,y:jt.y+1},Lt.bitmap)}}this.image=tt,this.positions=ie}}i.register("GlyphAtlas",N);class R{constructor(j){this.tileID=new i.OverscaledTileID(j.tileID.overscaledZ,j.tileID.wrap,j.tileID.canonical.z,j.tileID.canonical.x,j.tileID.canonical.y),this.uid=j.uid,this.zoom=j.zoom,this.pixelRatio=j.pixelRatio,this.tileSize=j.tileSize,this.source=j.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=j.showCollisionBoxes,this.collectResourceTiming=!!j.collectResourceTiming,this.returnDependencies=!!j.returnDependencies,this.promoteId=j.promoteId}parse(j,ie,ne,de,Re){this.status="parsing",this.data=j,this.collisionBoxArray=new i.CollisionBoxArray;const tt=new i.DictionaryCoder(Object.keys(j.layers).sort()),He=new i.FeatureIndex(this.tileID,this.promoteId);He.bucketLayerIDs=[];const Je={},pt={featureIndex:He,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ne},Lt=ie.familiesBySource[this.source];for(const yn in Lt){const Yt=j.layers[yn];if(!Yt)continue;Yt.version===1&&i.warnOnce(`Vector tile source "${this.source}" layer "${yn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const sr=tt.encode(yn),Yn=[];for(let Wr=0;Wr<Yt.length;Wr++){const mr=Yt.feature(Wr),Mr=He.getId(mr,yn);Yn.push({feature:mr,id:Mr,index:Wr,sourceLayerIndex:sr})}for(const Wr of Lt[yn]){const mr=Wr[0];mr.source!==this.source&&i.warnOnce(`layer.source = ${mr.source} does not equal this.source = ${this.source}`),mr.minzoom&&this.zoom<Math.floor(mr.minzoom)||mr.maxzoom&&this.zoom>=mr.maxzoom||mr.visibility!=="none"&&(G(Wr,this.zoom,ne),(Je[mr.id]=mr.createBucket({index:He.bucketLayerIDs.length,layers:Wr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:sr,sourceID:this.source})).populate(Yn,pt,this.tileID.canonical),He.bucketLayerIDs.push(Wr.map(Mr=>Mr.id)))}}let jt,Gt,ki,wi;const Oi=i.mapObject(pt.glyphDependencies,yn=>Object.keys(yn).map(Number));Object.keys(Oi).length?de.send("getGlyphs",{uid:this.uid,stacks:Oi},(yn,Yt)=>{jt||(jt=yn,Gt=Yt,rr.call(this))}):Gt={};const Yi=Object.keys(pt.iconDependencies);Yi.length?de.send("getImages",{icons:Yi,source:this.source,tileID:this.tileID,type:"icons"},(yn,Yt)=>{jt||(jt=yn,ki=Yt,rr.call(this))}):ki={};const tn=Object.keys(pt.patternDependencies);function rr(){if(jt)return Re(jt);if(Gt&&ki&&wi){const yn=new N(Gt),Yt=new i.ImageAtlas(ki,wi);for(const sr in Je){const Yn=Je[sr];Yn instanceof i.SymbolBucket?(G(Yn.layers,this.zoom,ne),i.performSymbolLayout({bucket:Yn,glyphMap:Gt,glyphPositions:yn.positions,imageMap:ki,imagePositions:Yt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Yn.hasPattern&&(Yn instanceof i.LineBucket||Yn instanceof i.FillBucket||Yn instanceof i.FillExtrusionBucket)&&(G(Yn.layers,this.zoom,ne),Yn.addFeatures(pt,this.tileID.canonical,Yt.patternPositions))}this.status="done",Re(null,{buckets:Object.values(Je).filter(sr=>!sr.isEmpty()),featureIndex:He,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:yn.image,imageAtlas:Yt,glyphMap:this.returnDependencies?Gt:null,iconMap:this.returnDependencies?ki:null,glyphPositions:this.returnDependencies?yn.positions:null})}}tn.length?de.send("getImages",{icons:tn,source:this.source,tileID:this.tileID,type:"patterns"},(yn,Yt)=>{jt||(jt=yn,wi=Yt,rr.call(this))}):wi={},rr.call(this)}}function G(X,j,ie){const ne=new i.EvaluationParameters(j);for(const de of X)de.recalculate(ne,ie)}function J(X,j){const ie=i.getArrayBuffer(X.request,(ne,de,Re,tt)=>{ne?j(ne):de&&j(null,{vectorTile:new i.vectorTile.VectorTile(new i.pbf(de)),rawData:de,cacheControl:Re,expires:tt})});return()=>{ie.cancel(),j()}}class Y{constructor(j,ie,ne,de){this.actor=j,this.layerIndex=ie,this.availableImages=ne,this.loadVectorData=de||J,this.loading={},this.loaded={}}loadTile(j,ie){const ne=j.uid;this.loading||(this.loading={});const de=!!(j&&j.request&&j.request.collectResourceTiming)&&new i.RequestPerformance(j.request),Re=this.loading[ne]=new R(j);Re.abort=this.loadVectorData(j,(tt,He)=>{if(delete this.loading[ne],tt||!He)return Re.status="done",this.loaded[ne]=Re,ie(tt);const Je=He.rawData,pt={};He.expires&&(pt.expires=He.expires),He.cacheControl&&(pt.cacheControl=He.cacheControl);const Lt={};if(de){const jt=de.finish();jt&&(Lt.resourceTiming=JSON.parse(JSON.stringify(jt)))}Re.vectorTile=He.vectorTile,Re.parse(He.vectorTile,this.layerIndex,this.availableImages,this.actor,(jt,Gt)=>{if(jt||!Gt)return ie(jt);ie(null,i.extend({rawTileData:Je.slice(0)},Gt,pt,Lt))}),this.loaded=this.loaded||{},this.loaded[ne]=Re})}reloadTile(j,ie){const ne=this.loaded,de=j.uid,Re=this;if(ne&&ne[de]){const tt=ne[de];tt.showCollisionBoxes=j.showCollisionBoxes;const He=(Je,pt)=>{const Lt=tt.reloadCallback;Lt&&(delete tt.reloadCallback,tt.parse(tt.vectorTile,Re.layerIndex,this.availableImages,Re.actor,Lt)),ie(Je,pt)};tt.status==="parsing"?tt.reloadCallback=He:tt.status==="done"&&(tt.vectorTile?tt.parse(tt.vectorTile,this.layerIndex,this.availableImages,this.actor,He):He())}}abortTile(j,ie){const ne=this.loading,de=j.uid;ne&&ne[de]&&ne[de].abort&&(ne[de].abort(),delete ne[de]),ie()}removeTile(j,ie){const ne=this.loaded,de=j.uid;ne&&ne[de]&&delete ne[de],ie()}}class B{constructor(){this.loaded={}}loadTile(j,ie){const{uid:ne,encoding:de,rawImageData:Re}=j,tt=i.isImageBitmap(Re)?this.getImageData(Re):Re,He=new i.DEMData(ne,tt,de);this.loaded=this.loaded||{},this.loaded[ne]=He,ie(null,He)}getImageData(j){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(j.width,j.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=j.width,this.offscreenCanvas.height=j.height,this.offscreenCanvasContext.drawImage(j,0,0,j.width,j.height);const ie=this.offscreenCanvasContext.getImageData(-1,-1,j.width+2,j.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new i.RGBAImage({width:ie.width,height:ie.height},ie.data)}removeTile(j){const ie=this.loaded,ne=j.uid;ie&&ie[ne]&&delete ie[ne]}}var ae=function X(j,ie){var ne,de=j&&j.type;if(de==="FeatureCollection")for(ne=0;ne<j.features.length;ne++)X(j.features[ne],ie);else if(de==="GeometryCollection")for(ne=0;ne<j.geometries.length;ne++)X(j.geometries[ne],ie);else if(de==="Feature")X(j.geometry,ie);else if(de==="Polygon")le(j.coordinates,ie);else if(de==="MultiPolygon")for(ne=0;ne<j.coordinates.length;ne++)le(j.coordinates[ne],ie);return j};function le(X,j){if(X.length!==0){Ae(X[0],j);for(var ie=1;ie<X.length;ie++)Ae(X[ie],!j)}}function Ae(X,j){for(var ie=0,ne=0,de=0,Re=X.length,tt=Re-1;de<Re;tt=de++){var He=(X[de][0]-X[tt][0])*(X[tt][1]+X[de][1]),Je=ie+He;ne+=Math.abs(ie)>=Math.abs(He)?ie-Je+He:He-Je+ie,ie=Je}ie+ne>=0!=!!j&&X.reverse()}const we=i.vectorTile.VectorTileFeature.prototype.toGeoJSON;class me{constructor(j){this._feature=j,this.extent=i.EXTENT,this.type=j.type,this.properties=j.tags,"id"in j&&!isNaN(j.id)&&(this.id=parseInt(j.id,10))}loadGeometry(){if(this._feature.type===1){const j=[];for(const ie of this._feature.geometry)j.push([new i.pointGeometry(ie[0],ie[1])]);return j}{const j=[];for(const ie of this._feature.geometry){const ne=[];for(const de of ie)ne.push(new i.pointGeometry(de[0],de[1]));j.push(ne)}return j}}toGeoJSON(j,ie,ne){return we.call(this,j,ie,ne)}}class Pe{constructor(j){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=j.length,this._features=j}feature(j){return new me(this._features[j])}}var it={exports:{}},Me=i.pointGeometry,Ke=i.vectorTile.VectorTileFeature,Et=oi;function oi(X,j){this.options=j||{},this.features=X,this.length=X.length}function Ci(X,j){this.id=typeof X.id=="number"?X.id:void 0,this.type=X.type,this.rawGeometry=X.type===1?[X.geometry]:X.geometry,this.properties=X.tags,this.extent=j||4096}oi.prototype.feature=function(X){return new Ci(this.features[X],this.options.extent)},Ci.prototype.loadGeometry=function(){var X=this.rawGeometry;this.geometry=[];for(var j=0;j<X.length;j++){for(var ie=X[j],ne=[],de=0;de<ie.length;de++)ne.push(new Me(ie[de][0],ie[de][1]));this.geometry.push(ne)}return this.geometry},Ci.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var X=this.geometry,j=1/0,ie=-1/0,ne=1/0,de=-1/0,Re=0;Re<X.length;Re++)for(var tt=X[Re],He=0;He<tt.length;He++){var Je=tt[He];j=Math.min(j,Je.x),ie=Math.max(ie,Je.x),ne=Math.min(ne,Je.y),de=Math.max(de,Je.y)}return[j,ne,ie,de]},Ci.prototype.toGeoJSON=Ke.prototype.toGeoJSON;var te=i.pbf,ce=Et;function ye(X){var j=new te;return function(ie,ne){for(var de in ie.layers)ne.writeMessage(3,xe,ie.layers[de])}(X,j),j.finish()}function xe(X,j){var ie;j.writeVarintField(15,X.version||1),j.writeStringField(1,X.name||""),j.writeVarintField(5,X.extent||4096);var ne={keys:[],values:[],keycache:{},valuecache:{}};for(ie=0;ie<X.length;ie++)ne.feature=X.feature(ie),j.writeMessage(2,ze,ne);var de=ne.keys;for(ie=0;ie<de.length;ie++)j.writeStringField(3,de[ie]);var Re=ne.values;for(ie=0;ie<Re.length;ie++)j.writeMessage(4,Ie,Re[ie])}function ze(X,j){var ie=X.feature;ie.id!==void 0&&j.writeVarintField(1,ie.id),j.writeMessage(2,Ne,X),j.writeVarintField(3,ie.type),j.writeMessage(4,Le,ie)}function Ne(X,j){var ie=X.feature,ne=X.keys,de=X.values,Re=X.keycache,tt=X.valuecache;for(var He in ie.properties){var Je=ie.properties[He],pt=Re[He];if(Je!==null){pt===void 0&&(ne.push(He),Re[He]=pt=ne.length-1),j.writeVarint(pt);var Lt=typeof Je;Lt!=="string"&&Lt!=="boolean"&&Lt!=="number"&&(Je=JSON.stringify(Je));var jt=Lt+":"+Je,Gt=tt[jt];Gt===void 0&&(de.push(Je),tt[jt]=Gt=de.length-1),j.writeVarint(Gt)}}}function Ge(X,j){return(j<<3)+(7&X)}function Ve(X){return X<<1^X>>31}function Le(X,j){for(var ie=X.loadGeometry(),ne=X.type,de=0,Re=0,tt=ie.length,He=0;He<tt;He++){var Je=ie[He],pt=1;ne===1&&(pt=Je.length),j.writeVarint(Ge(1,pt));for(var Lt=ne===3?Je.length-1:Je.length,jt=0;jt<Lt;jt++){jt===1&&ne!==1&&j.writeVarint(Ge(2,Lt-1));var Gt=Je[jt].x-de,ki=Je[jt].y-Re;j.writeVarint(Ve(Gt)),j.writeVarint(Ve(ki)),de+=Gt,Re+=ki}ne===3&&j.writeVarint(Ge(7,1))}}function Ie(X,j){var ie=typeof X;ie==="string"?j.writeStringField(1,X):ie==="boolean"?j.writeBooleanField(7,X):ie==="number"&&(X%1!=0?j.writeDoubleField(3,X):X<0?j.writeSVarintField(6,X):j.writeVarintField(5,X))}function qe(X,j,ie,ne,de,Re){if(de-ne<=ie)return;const tt=ne+de>>1;et(X,j,tt,ne,de,Re%2),qe(X,j,ie,ne,tt-1,Re+1),qe(X,j,ie,tt+1,de,Re+1)}function et(X,j,ie,ne,de,Re){for(;de>ne;){if(de-ne>600){const pt=de-ne+1,Lt=ie-ne+1,jt=Math.log(pt),Gt=.5*Math.exp(2*jt/3),ki=.5*Math.sqrt(jt*Gt*(pt-Gt)/pt)*(Lt-pt/2<0?-1:1);et(X,j,ie,Math.max(ne,Math.floor(ie-Lt*Gt/pt+ki)),Math.min(de,Math.floor(ie+(pt-Lt)*Gt/pt+ki)),Re)}const tt=j[2*ie+Re];let He=ne,Je=de;for(vt(X,j,ne,ie),j[2*de+Re]>tt&&vt(X,j,ne,de);He<Je;){for(vt(X,j,He,Je),He++,Je--;j[2*He+Re]<tt;)He++;for(;j[2*Je+Re]>tt;)Je--}j[2*ne+Re]===tt?vt(X,j,ne,Je):(Je++,vt(X,j,Je,de)),Je<=ie&&(ne=Je+1),ie<=Je&&(de=Je-1)}}function vt(X,j,ie,ne){Be(X,ie,ne),Be(j,2*ie,2*ne),Be(j,2*ie+1,2*ne+1)}function Be(X,j,ie){const ne=X[j];X[j]=X[ie],X[ie]=ne}function dt(X,j,ie,ne){const de=X-ie,Re=j-ne;return de*de+Re*Re}it.exports=ye,it.exports.fromVectorTileJs=ye,it.exports.fromGeojsonVt=function(X,j){j=j||{};var ie={};for(var ne in X)ie[ne]=new ce(X[ne].features,j),ie[ne].name=ne,ie[ne].version=j.version,ie[ne].extent=j.extent;return ye({layers:ie})},it.exports.GeoJSONWrapper=ce;const ut=X=>X[0],Qt=X=>X[1];class Wt{constructor(j,ie=ut,ne=Qt,de=64,Re=Float64Array){this.nodeSize=de,this.points=j;const tt=j.length<65536?Uint16Array:Uint32Array,He=this.ids=new tt(j.length),Je=this.coords=new Re(2*j.length);for(let pt=0;pt<j.length;pt++)He[pt]=pt,Je[2*pt]=ie(j[pt]),Je[2*pt+1]=ne(j[pt]);qe(He,Je,de,0,He.length-1,0)}range(j,ie,ne,de){return function(Re,tt,He,Je,pt,Lt,jt){const Gt=[0,Re.length-1,0],ki=[];let wi,Oi;for(;Gt.length;){const Yi=Gt.pop(),tn=Gt.pop(),rr=Gt.pop();if(tn-rr<=jt){for(let sr=rr;sr<=tn;sr++)wi=tt[2*sr],Oi=tt[2*sr+1],wi>=He&&wi<=pt&&Oi>=Je&&Oi<=Lt&&ki.push(Re[sr]);continue}const yn=Math.floor((rr+tn)/2);wi=tt[2*yn],Oi=tt[2*yn+1],wi>=He&&wi<=pt&&Oi>=Je&&Oi<=Lt&&ki.push(Re[yn]);const Yt=(Yi+1)%2;(Yi===0?He<=wi:Je<=Oi)&&(Gt.push(rr),Gt.push(yn-1),Gt.push(Yt)),(Yi===0?pt>=wi:Lt>=Oi)&&(Gt.push(yn+1),Gt.push(tn),Gt.push(Yt))}return ki}(this.ids,this.coords,j,ie,ne,de,this.nodeSize)}within(j,ie,ne){return function(de,Re,tt,He,Je,pt){const Lt=[0,de.length-1,0],jt=[],Gt=Je*Je;for(;Lt.length;){const ki=Lt.pop(),wi=Lt.pop(),Oi=Lt.pop();if(wi-Oi<=pt){for(let Yt=Oi;Yt<=wi;Yt++)dt(Re[2*Yt],Re[2*Yt+1],tt,He)<=Gt&&jt.push(de[Yt]);continue}const Yi=Math.floor((Oi+wi)/2),tn=Re[2*Yi],rr=Re[2*Yi+1];dt(tn,rr,tt,He)<=Gt&&jt.push(de[Yi]);const yn=(ki+1)%2;(ki===0?tt-Je<=tn:He-Je<=rr)&&(Lt.push(Oi),Lt.push(Yi-1),Lt.push(yn)),(ki===0?tt+Je>=tn:He+Je>=rr)&&(Lt.push(Yi+1),Lt.push(wi),Lt.push(yn))}return jt}(this.ids,this.coords,j,ie,ne,this.nodeSize)}}const Nt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:X=>X},Ct=Math.fround||(Ft=new Float32Array(1),X=>(Ft[0]=+X,Ft[0]));var Ft;class Xt{constructor(j){this.options=yt(Object.create(Nt),j),this.trees=new Array(this.options.maxZoom+1)}load(j){const{log:ie,minZoom:ne,maxZoom:de,nodeSize:Re}=this.options;ie&&console.time("total time");const tt=`prepare ${j.length} points`;ie&&console.time(tt),this.points=j;let He=[];for(let Je=0;Je<j.length;Je++)j[Je].geometry&&He.push(fi(j[Je],Je));this.trees[de+1]=new Wt(He,st,ti,Re,Float32Array),ie&&console.timeEnd(tt);for(let Je=de;Je>=ne;Je--){const pt=+Date.now();He=this._cluster(He,Je),this.trees[Je]=new Wt(He,st,ti,Re,Float32Array),ie&&console.log("z%d: %d clusters in %dms",Je,He.length,+Date.now()-pt)}return ie&&console.timeEnd("total time"),this}getClusters(j,ie){let ne=((j[0]+180)%360+360)%360-180;const de=Math.max(-90,Math.min(90,j[1]));let Re=j[2]===180?180:((j[2]+180)%360+360)%360-180;const tt=Math.max(-90,Math.min(90,j[3]));if(j[2]-j[0]>=360)ne=-180,Re=180;else if(ne>Re){const Lt=this.getClusters([ne,de,180,tt],ie),jt=this.getClusters([-180,de,Re,tt],ie);return Lt.concat(jt)}const He=this.trees[this._limitZoom(ie)],Je=He.range(Qi(ne),Gn(tt),Qi(Re),Gn(de)),pt=[];for(const Lt of Je){const jt=He.points[Lt];pt.push(jt.numPoints?Gi(jt):this.points[jt.index])}return pt}getChildren(j){const ie=this._getOriginId(j),ne=this._getOriginZoom(j),de="No cluster with the specified id.",Re=this.trees[ne];if(!Re)throw new Error(de);const tt=Re.points[ie];if(!tt)throw new Error(de);const He=this.options.radius/(this.options.extent*Math.pow(2,ne-1)),Je=Re.within(tt.x,tt.y,He),pt=[];for(const Lt of Je){const jt=Re.points[Lt];jt.parentId===j&&pt.push(jt.numPoints?Gi(jt):this.points[jt.index])}if(pt.length===0)throw new Error(de);return pt}getLeaves(j,ie,ne){const de=[];return this._appendLeaves(de,j,ie=ie||10,ne=ne||0,0),de}getTile(j,ie,ne){const de=this.trees[this._limitZoom(j)],Re=Math.pow(2,j),{extent:tt,radius:He}=this.options,Je=He/tt,pt=(ne-Je)/Re,Lt=(ne+1+Je)/Re,jt={features:[]};return this._addTileFeatures(de.range((ie-Je)/Re,pt,(ie+1+Je)/Re,Lt),de.points,ie,ne,Re,jt),ie===0&&this._addTileFeatures(de.range(1-Je/Re,pt,1,Lt),de.points,Re,ne,Re,jt),ie===Re-1&&this._addTileFeatures(de.range(0,pt,Je/Re,Lt),de.points,-1,ne,Re,jt),jt.features.length?jt:null}getClusterExpansionZoom(j){let ie=this._getOriginZoom(j)-1;for(;ie<=this.options.maxZoom;){const ne=this.getChildren(j);if(ie++,ne.length!==1)break;j=ne[0].properties.cluster_id}return ie}_appendLeaves(j,ie,ne,de,Re){const tt=this.getChildren(ie);for(const He of tt){const Je=He.properties;if(Je&&Je.cluster?Re+Je.point_count<=de?Re+=Je.point_count:Re=this._appendLeaves(j,Je.cluster_id,ne,de,Re):Re<de?Re++:j.push(He),j.length===ne)break}return Re}_addTileFeatures(j,ie,ne,de,Re,tt){for(const He of j){const Je=ie[He],pt=Je.numPoints;let Lt,jt,Gt;if(pt)Lt=wn(Je),jt=Je.x,Gt=Je.y;else{const Oi=this.points[Je.index];Lt=Oi.properties,jt=Qi(Oi.geometry.coordinates[0]),Gt=Gn(Oi.geometry.coordinates[1])}const ki={type:1,geometry:[[Math.round(this.options.extent*(jt*Re-ne)),Math.round(this.options.extent*(Gt*Re-de))]],tags:Lt};let wi;pt?wi=Je.id:this.options.generateId?wi=Je.index:this.points[Je.index].id&&(wi=this.points[Je.index].id),wi!==void 0&&(ki.id=wi),tt.features.push(ki)}}_limitZoom(j){return Math.max(this.options.minZoom,Math.min(Math.floor(+j),this.options.maxZoom+1))}_cluster(j,ie){const ne=[],{radius:de,extent:Re,reduce:tt,minPoints:He}=this.options,Je=de/(Re*Math.pow(2,ie));for(let pt=0;pt<j.length;pt++){const Lt=j[pt];if(Lt.zoom<=ie)continue;Lt.zoom=ie;const jt=this.trees[ie+1],Gt=jt.within(Lt.x,Lt.y,Je),ki=Lt.numPoints||1;let wi=ki;for(const Oi of Gt){const Yi=jt.points[Oi];Yi.zoom>ie&&(wi+=Yi.numPoints||1)}if(wi>ki&&wi>=He){let Oi=Lt.x*ki,Yi=Lt.y*ki,tn=tt&&ki>1?this._map(Lt,!0):null;const rr=(pt<<5)+(ie+1)+this.points.length;for(const yn of Gt){const Yt=jt.points[yn];if(Yt.zoom<=ie)continue;Yt.zoom=ie;const sr=Yt.numPoints||1;Oi+=Yt.x*sr,Yi+=Yt.y*sr,Yt.parentId=rr,tt&&(tn||(tn=this._map(Lt,!0)),tt(tn,this._map(Yt)))}Lt.parentId=rr,ne.push(mi(Oi/wi,Yi/wi,rr,wi,tn))}else if(ne.push(Lt),wi>1)for(const Oi of Gt){const Yi=jt.points[Oi];Yi.zoom<=ie||(Yi.zoom=ie,ne.push(Yi))}}return ne}_getOriginId(j){return j-this.points.length>>5}_getOriginZoom(j){return(j-this.points.length)%32}_map(j,ie){if(j.numPoints)return ie?yt({},j.properties):j.properties;const ne=this.points[j.index].properties,de=this.options.map(ne);return ie&&de===ne?yt({},de):de}}function mi(X,j,ie,ne,de){return{x:Ct(X),y:Ct(j),zoom:1/0,id:ie,parentId:-1,numPoints:ne,properties:de}}function fi(X,j){const[ie,ne]=X.geometry.coordinates;return{x:Ct(Qi(ie)),y:Ct(Gn(ne)),zoom:1/0,index:j,parentId:-1}}function Gi(X){return{type:"Feature",id:X.id,properties:wn(X),geometry:{type:"Point",coordinates:[(j=X.x,360*(j-.5)),kn(X.y)]}};var j}function wn(X){const j=X.numPoints,ie=j>=1e4?`${Math.round(j/1e3)}k`:j>=1e3?Math.round(j/100)/10+"k":j;return yt(yt({},X.properties),{cluster:!0,cluster_id:X.id,point_count:j,point_count_abbreviated:ie})}function Qi(X){return X/360+.5}function Gn(X){const j=Math.sin(X*Math.PI/180),ie=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return ie<0?0:ie>1?1:ie}function kn(X){const j=(180-360*X)*Math.PI/180;return 360*Math.atan(Math.exp(j))/Math.PI-90}function yt(X,j){for(const ie in j)X[ie]=j[ie];return X}function st(X){return X.x}function ti(X){return X.y}function Ni(X,j,ie,ne){for(var de,Re=ne,tt=ie-j>>1,He=ie-j,Je=X[j],pt=X[j+1],Lt=X[ie],jt=X[ie+1],Gt=j+3;Gt<ie;Gt+=3){var ki=qi(X[Gt],X[Gt+1],Je,pt,Lt,jt);if(ki>Re)de=Gt,Re=ki;else if(ki===Re){var wi=Math.abs(Gt-tt);wi<He&&(de=Gt,He=wi)}}Re>ne&&(de-j>3&&Ni(X,j,de,ne),X[de+2]=Re,ie-de>3&&Ni(X,de,ie,ne))}function qi(X,j,ie,ne,de,Re){var tt=de-ie,He=Re-ne;if(tt!==0||He!==0){var Je=((X-ie)*tt+(j-ne)*He)/(tt*tt+He*He);Je>1?(ie=de,ne=Re):Je>0&&(ie+=tt*Je,ne+=He*Je)}return(tt=X-ie)*tt+(He=j-ne)*He}function en(X,j,ie,ne){var de={id:X===void 0?null:X,type:j,geometry:ie,tags:ne,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Re){var tt=Re.geometry,He=Re.type;if(He==="Point"||He==="MultiPoint"||He==="LineString")$t(Re,tt);else if(He==="Polygon"||He==="MultiLineString")for(var Je=0;Je<tt.length;Je++)$t(Re,tt[Je]);else if(He==="MultiPolygon")for(Je=0;Je<tt.length;Je++)for(var pt=0;pt<tt[Je].length;pt++)$t(Re,tt[Je][pt])}(de),de}function $t(X,j){for(var ie=0;ie<j.length;ie+=3)X.minX=Math.min(X.minX,j[ie]),X.minY=Math.min(X.minY,j[ie+1]),X.maxX=Math.max(X.maxX,j[ie]),X.maxY=Math.max(X.maxY,j[ie+1])}function at(X,j,ie,ne){if(j.geometry){var de=j.geometry.coordinates,Re=j.geometry.type,tt=Math.pow(ie.tolerance/((1<<ie.maxZoom)*ie.extent),2),He=[],Je=j.id;if(ie.promoteId?Je=j.properties[ie.promoteId]:ie.generateId&&(Je=ne||0),Re==="Point")ii(de,He);else if(Re==="MultiPoint")for(var pt=0;pt<de.length;pt++)ii(de[pt],He);else if(Re==="LineString")hn(de,He,tt,!1);else if(Re==="MultiLineString"){if(ie.lineMetrics){for(pt=0;pt<de.length;pt++)hn(de[pt],He=[],tt,!1),X.push(en(Je,"LineString",He,j.properties));return}Xi(de,He,tt,!1)}else if(Re==="Polygon")Xi(de,He,tt,!0);else{if(Re!=="MultiPolygon"){if(Re==="GeometryCollection"){for(pt=0;pt<j.geometry.geometries.length;pt++)at(X,{id:Je,geometry:j.geometry.geometries[pt],properties:j.properties},ie,ne);return}throw new Error("Input data is not a valid GeoJSON object.")}for(pt=0;pt<de.length;pt++){var Lt=[];Xi(de[pt],Lt,tt,!0),He.push(Lt)}}X.push(en(Je,Re,He,j.properties))}}function ii(X,j){j.push(on(X[0])),j.push(Cn(X[1])),j.push(0)}function hn(X,j,ie,ne){for(var de,Re,tt=0,He=0;He<X.length;He++){var Je=on(X[He][0]),pt=Cn(X[He][1]);j.push(Je),j.push(pt),j.push(0),He>0&&(tt+=ne?(de*pt-Je*Re)/2:Math.sqrt(Math.pow(Je-de,2)+Math.pow(pt-Re,2))),de=Je,Re=pt}var Lt=j.length-3;j[2]=1,Ni(j,0,Lt,ie),j[Lt+2]=1,j.size=Math.abs(tt),j.start=0,j.end=j.size}function Xi(X,j,ie,ne){for(var de=0;de<X.length;de++){var Re=[];hn(X[de],Re,ie,ne),j.push(Re)}}function on(X){return X/360+.5}function Cn(X){var j=Math.sin(X*Math.PI/180),ie=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return ie<0?0:ie>1?1:ie}function Tn(X,j,ie,ne,de,Re,tt,He){if(ne/=j,Re>=(ie/=j)&&tt<ne)return X;if(tt<ie||Re>=ne)return null;for(var Je=[],pt=0;pt<X.length;pt++){var Lt=X[pt],jt=Lt.geometry,Gt=Lt.type,ki=de===0?Lt.minX:Lt.minY,wi=de===0?Lt.maxX:Lt.maxY;if(ki>=ie&&wi<ne)Je.push(Lt);else if(!(wi<ie||ki>=ne)){var Oi=[];if(Gt==="Point"||Gt==="MultiPoint")nr(jt,Oi,ie,ne,de);else if(Gt==="LineString")Ii(jt,Oi,ie,ne,de,!1,He.lineMetrics);else if(Gt==="MultiLineString")Ot(jt,Oi,ie,ne,de,!1);else if(Gt==="Polygon")Ot(jt,Oi,ie,ne,de,!0);else if(Gt==="MultiPolygon")for(var Yi=0;Yi<jt.length;Yi++){var tn=[];Ot(jt[Yi],tn,ie,ne,de,!0),tn.length&&Oi.push(tn)}if(Oi.length){if(He.lineMetrics&&Gt==="LineString"){for(Yi=0;Yi<Oi.length;Yi++)Je.push(en(Lt.id,Gt,Oi[Yi],Lt.tags));continue}Gt!=="LineString"&&Gt!=="MultiLineString"||(Oi.length===1?(Gt="LineString",Oi=Oi[0]):Gt="MultiLineString"),Gt!=="Point"&&Gt!=="MultiPoint"||(Gt=Oi.length===3?"Point":"MultiPoint"),Je.push(en(Lt.id,Gt,Oi,Lt.tags))}}}return Je.length?Je:null}function nr(X,j,ie,ne,de){for(var Re=0;Re<X.length;Re+=3){var tt=X[Re+de];tt>=ie&&tt<=ne&&(j.push(X[Re]),j.push(X[Re+1]),j.push(X[Re+2]))}}function Ii(X,j,ie,ne,de,Re,tt){for(var He,Je,pt=bn(X),Lt=de===0?Wi:Ui,jt=X.start,Gt=0;Gt<X.length-3;Gt+=3){var ki=X[Gt],wi=X[Gt+1],Oi=X[Gt+2],Yi=X[Gt+3],tn=X[Gt+4],rr=de===0?ki:wi,yn=de===0?Yi:tn,Yt=!1;tt&&(He=Math.sqrt(Math.pow(ki-Yi,2)+Math.pow(wi-tn,2))),rr<ie?yn>ie&&(Je=Lt(pt,ki,wi,Yi,tn,ie),tt&&(pt.start=jt+He*Je)):rr>ne?yn<ne&&(Je=Lt(pt,ki,wi,Yi,tn,ne),tt&&(pt.start=jt+He*Je)):vi(pt,ki,wi,Oi),yn<ie&&rr>=ie&&(Je=Lt(pt,ki,wi,Yi,tn,ie),Yt=!0),yn>ne&&rr<=ne&&(Je=Lt(pt,ki,wi,Yi,tn,ne),Yt=!0),!Re&&Yt&&(tt&&(pt.end=jt+He*Je),j.push(pt),pt=bn(X)),tt&&(jt+=He)}var sr=X.length-3;ki=X[sr],wi=X[sr+1],Oi=X[sr+2],(rr=de===0?ki:wi)>=ie&&rr<=ne&&vi(pt,ki,wi,Oi),sr=pt.length-3,Re&&sr>=3&&(pt[sr]!==pt[0]||pt[sr+1]!==pt[1])&&vi(pt,pt[0],pt[1],pt[2]),pt.length&&j.push(pt)}function bn(X){var j=[];return j.size=X.size,j.start=X.start,j.end=X.end,j}function Ot(X,j,ie,ne,de,Re){for(var tt=0;tt<X.length;tt++)Ii(X[tt],j,ie,ne,de,Re,!1)}function vi(X,j,ie,ne){X.push(j),X.push(ie),X.push(ne)}function Wi(X,j,ie,ne,de,Re){var tt=(Re-j)/(ne-j);return X.push(Re),X.push(ie+(de-ie)*tt),X.push(1),tt}function Ui(X,j,ie,ne,de,Re){var tt=(Re-ie)/(de-ie);return X.push(j+(ne-j)*tt),X.push(Re),X.push(1),tt}function Pn(X,j){for(var ie=[],ne=0;ne<X.length;ne++){var de,Re=X[ne],tt=Re.type;if(tt==="Point"||tt==="MultiPoint"||tt==="LineString")de=qn(Re.geometry,j);else if(tt==="MultiLineString"||tt==="Polygon"){de=[];for(var He=0;He<Re.geometry.length;He++)de.push(qn(Re.geometry[He],j))}else if(tt==="MultiPolygon")for(de=[],He=0;He<Re.geometry.length;He++){for(var Je=[],pt=0;pt<Re.geometry[He].length;pt++)Je.push(qn(Re.geometry[He][pt],j));de.push(Je)}ie.push(en(Re.id,tt,de,Re.tags))}return ie}function qn(X,j){var ie=[];ie.size=X.size,X.start!==void 0&&(ie.start=X.start,ie.end=X.end);for(var ne=0;ne<X.length;ne+=3)ie.push(X[ne]+j,X[ne+1],X[ne+2]);return ie}function Hr(X,j){if(X.transformed)return X;var ie,ne,de,Re=1<<X.z,tt=X.x,He=X.y;for(ie=0;ie<X.features.length;ie++){var Je=X.features[ie],pt=Je.geometry,Lt=Je.type;if(Je.geometry=[],Lt===1)for(ne=0;ne<pt.length;ne+=2)Je.geometry.push(fr(pt[ne],pt[ne+1],j,Re,tt,He));else for(ne=0;ne<pt.length;ne++){var jt=[];for(de=0;de<pt[ne].length;de+=2)jt.push(fr(pt[ne][de],pt[ne][de+1],j,Re,tt,He));Je.geometry.push(jt)}}return X.transformed=!0,X}function fr(X,j,ie,ne,de,Re){return[Math.round(ie*(X*ne-de)),Math.round(ie*(j*ne-Re))]}function kr(X,j,ie,ne,de){for(var Re=j===de.maxZoom?0:de.tolerance/((1<<j)*de.extent),tt={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:ie,y:ne,z:j,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},He=0;He<X.length;He++){tt.numFeatures++,Qn(tt,X[He],Re,de);var Je=X[He].minX,pt=X[He].minY,Lt=X[He].maxX,jt=X[He].maxY;Je<tt.minX&&(tt.minX=Je),pt<tt.minY&&(tt.minY=pt),Lt>tt.maxX&&(tt.maxX=Lt),jt>tt.maxY&&(tt.maxY=jt)}return tt}function Qn(X,j,ie,ne){var de=j.geometry,Re=j.type,tt=[];if(Re==="Point"||Re==="MultiPoint")for(var He=0;He<de.length;He+=3)tt.push(de[He]),tt.push(de[He+1]),X.numPoints++,X.numSimplified++;else if(Re==="LineString")zs(tt,de,X,ie,!1,!1);else if(Re==="MultiLineString"||Re==="Polygon")for(He=0;He<de.length;He++)zs(tt,de[He],X,ie,Re==="Polygon",He===0);else if(Re==="MultiPolygon")for(var Je=0;Je<de.length;Je++){var pt=de[Je];for(He=0;He<pt.length;He++)zs(tt,pt[He],X,ie,!0,He===0)}if(tt.length){var Lt=j.tags||null;if(Re==="LineString"&&ne.lineMetrics){for(var jt in Lt={},j.tags)Lt[jt]=j.tags[jt];Lt.mapbox_clip_start=de.start/de.size,Lt.mapbox_clip_end=de.end/de.size}var Gt={geometry:tt,type:Re==="Polygon"||Re==="MultiPolygon"?3:Re==="LineString"||Re==="MultiLineString"?2:1,tags:Lt};j.id!==null&&(Gt.id=j.id),X.features.push(Gt)}}function zs(X,j,ie,ne,de,Re){var tt=ne*ne;if(ne>0&&j.size<(de?tt:ne))ie.numPoints+=j.length/3;else{for(var He=[],Je=0;Je<j.length;Je+=3)(ne===0||j[Je+2]>tt)&&(ie.numSimplified++,He.push(j[Je]),He.push(j[Je+1])),ie.numPoints++;de&&function(pt,Lt){for(var jt=0,Gt=0,ki=pt.length,wi=ki-2;Gt<ki;wi=Gt,Gt+=2)jt+=(pt[Gt]-pt[wi])*(pt[Gt+1]+pt[wi+1]);if(jt>0===Lt)for(Gt=0,ki=pt.length;Gt<ki/2;Gt+=2){var Oi=pt[Gt],Yi=pt[Gt+1];pt[Gt]=pt[ki-2-Gt],pt[Gt+1]=pt[ki-1-Gt],pt[ki-2-Gt]=Oi,pt[ki-1-Gt]=Yi}}(He,Re),X.push(He)}}function ot(X,j){var ie=(j=this.options=function(de,Re){for(var tt in Re)de[tt]=Re[tt];return de}(Object.create(this.options),j)).debug;if(ie&&console.time("preprocess data"),j.maxZoom<0||j.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(j.promoteId&&j.generateId)throw new Error("promoteId and generateId cannot be used together.");var ne=function(de,Re){var tt=[];if(de.type==="FeatureCollection")for(var He=0;He<de.features.length;He++)at(tt,de.features[He],Re,He);else at(tt,de.type==="Feature"?de:{geometry:de},Re);return tt}(X,j);this.tiles={},this.tileCoords=[],ie&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",j.indexMaxZoom,j.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ne=function(de,Re){var tt=Re.buffer/Re.extent,He=de,Je=Tn(de,1,-1-tt,tt,0,-1,2,Re),pt=Tn(de,1,1-tt,2+tt,0,-1,2,Re);return(Je||pt)&&(He=Tn(de,1,-tt,1+tt,0,-1,2,Re)||[],Je&&(He=Pn(Je,1).concat(He)),pt&&(He=He.concat(Pn(pt,-1)))),He}(ne,j),ne.length&&this.splitTile(ne,0,0,0),ie&&(ne.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Ee(X,j,ie){return 32*((1<<X)*ie+j)+X}function Ue(X,j){const ie=X.tileID.canonical;if(!this._geoJSONIndex)return j(null,null);const ne=this._geoJSONIndex.getTile(ie.z,ie.x,ie.y);if(!ne)return j(null,null);const de=new Pe(ne.features);let Re=it.exports(de);Re.byteOffset===0&&Re.byteLength===Re.buffer.byteLength||(Re=new Uint8Array(Re)),j(null,{vectorTile:de,rawData:Re.buffer})}ot.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ot.prototype.splitTile=function(X,j,ie,ne,de,Re,tt){for(var He=[X,j,ie,ne],Je=this.options,pt=Je.debug;He.length;){ne=He.pop(),ie=He.pop(),j=He.pop(),X=He.pop();var Lt=1<<j,jt=Ee(j,ie,ne),Gt=this.tiles[jt];if(!Gt&&(pt>1&&console.time("creation"),Gt=this.tiles[jt]=kr(X,j,ie,ne,Je),this.tileCoords.push({z:j,x:ie,y:ne}),pt)){pt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",j,ie,ne,Gt.numFeatures,Gt.numPoints,Gt.numSimplified),console.timeEnd("creation"));var ki="z"+j;this.stats[ki]=(this.stats[ki]||0)+1,this.total++}if(Gt.source=X,de){if(j===Je.maxZoom||j===de)continue;var wi=1<<de-j;if(ie!==Math.floor(Re/wi)||ne!==Math.floor(tt/wi))continue}else if(j===Je.indexMaxZoom||Gt.numPoints<=Je.indexMaxPoints)continue;if(Gt.source=null,X.length!==0){pt>1&&console.time("clipping");var Oi,Yi,tn,rr,yn,Yt,sr=.5*Je.buffer/Je.extent,Yn=.5-sr,Wr=.5+sr,mr=1+sr;Oi=Yi=tn=rr=null,yn=Tn(X,Lt,ie-sr,ie+Wr,0,Gt.minX,Gt.maxX,Je),Yt=Tn(X,Lt,ie+Yn,ie+mr,0,Gt.minX,Gt.maxX,Je),X=null,yn&&(Oi=Tn(yn,Lt,ne-sr,ne+Wr,1,Gt.minY,Gt.maxY,Je),Yi=Tn(yn,Lt,ne+Yn,ne+mr,1,Gt.minY,Gt.maxY,Je),yn=null),Yt&&(tn=Tn(Yt,Lt,ne-sr,ne+Wr,1,Gt.minY,Gt.maxY,Je),rr=Tn(Yt,Lt,ne+Yn,ne+mr,1,Gt.minY,Gt.maxY,Je),Yt=null),pt>1&&console.timeEnd("clipping"),He.push(Oi||[],j+1,2*ie,2*ne),He.push(Yi||[],j+1,2*ie,2*ne+1),He.push(tn||[],j+1,2*ie+1,2*ne),He.push(rr||[],j+1,2*ie+1,2*ne+1)}}},ot.prototype.getTile=function(X,j,ie){var ne=this.options,de=ne.extent,Re=ne.debug;if(X<0||X>24)return null;var tt=1<<X,He=Ee(X,j=(j%tt+tt)%tt,ie);if(this.tiles[He])return Hr(this.tiles[He],de);Re>1&&console.log("drilling down to z%d-%d-%d",X,j,ie);for(var Je,pt=X,Lt=j,jt=ie;!Je&&pt>0;)pt--,Lt=Math.floor(Lt/2),jt=Math.floor(jt/2),Je=this.tiles[Ee(pt,Lt,jt)];return Je&&Je.source?(Re>1&&console.log("found parent tile z%d-%d-%d",pt,Lt,jt),Re>1&&console.time("drilling down"),this.splitTile(Je.source,pt,Lt,jt,X,j,ie),Re>1&&console.timeEnd("drilling down"),this.tiles[He]?Hr(this.tiles[He],de):null):null};class ct extends Y{constructor(j,ie,ne,de){super(j,ie,ne,Ue),de&&(this.loadGeoJSON=de)}loadData(j,ie){var ne;(ne=this._pendingRequest)===null||ne===void 0||ne.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const de=!!(j&&j.request&&j.request.collectResourceTiming)&&new i.RequestPerformance(j.request);this._pendingCallback=ie,this._pendingRequest=this.loadGeoJSON(j,(Re,tt)=>{if(delete this._pendingCallback,delete this._pendingRequest,Re||!tt)return ie(Re);if(typeof tt!="object")return ie(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));{ae(tt,!0);try{if(j.filter){const Je=i.createExpression(j.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Je.result==="error")throw new Error(Je.value.map(Lt=>`${Lt.key}: ${Lt.message}`).join(", "));tt={type:"FeatureCollection",features:tt.features.filter(Lt=>Je.value.evaluate({zoom:0},Lt))}}this._geoJSONIndex=j.cluster?new Xt(function({superclusterOptions:Je,clusterProperties:pt}){if(!pt||!Je)return Je;const Lt={},jt={},Gt={accumulated:null,zoom:0},ki={properties:null},wi=Object.keys(pt);for(const Oi of wi){const[Yi,tn]=pt[Oi],rr=i.createExpression(tn),yn=i.createExpression(typeof Yi=="string"?[Yi,["accumulated"],["get",Oi]]:Yi);Lt[Oi]=rr.value,jt[Oi]=yn.value}return Je.map=Oi=>{ki.properties=Oi;const Yi={};for(const tn of wi)Yi[tn]=Lt[tn].evaluate(Gt,ki);return Yi},Je.reduce=(Oi,Yi)=>{ki.properties=Yi;for(const tn of wi)Gt.accumulated=Oi[tn],Oi[tn]=jt[tn].evaluate(Gt,ki)},Je}(j)).load(tt.features):function(Je,pt){return new ot(Je,pt)}(tt,j.geojsonVtOptions)}catch(Je){return ie(Je)}this.loaded={};const He={};if(de){const Je=de.finish();Je&&(He.resourceTiming={},He.resourceTiming[j.source]=JSON.parse(JSON.stringify(Je)))}ie(null,He)}})}reloadTile(j,ie){const ne=this.loaded;return ne&&ne[j.uid]?super.reloadTile(j,ie):this.loadTile(j,ie)}loadGeoJSON(j,ie){if(j.request)return i.getJSON(j.request,ie);if(typeof j.data=="string")try{ie(null,JSON.parse(j.data))}catch{ie(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`))}else ie(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(j,ie){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),ie()}getClusterExpansionZoom(j,ie){try{ie(null,this._geoJSONIndex.getClusterExpansionZoom(j.clusterId))}catch(ne){ie(ne)}}getClusterChildren(j,ie){try{ie(null,this._geoJSONIndex.getChildren(j.clusterId))}catch(ne){ie(ne)}}getClusterLeaves(j,ie){try{ie(null,this._geoJSONIndex.getLeaves(j.clusterId,j.limit,j.offset))}catch(ne){ie(ne)}}}class wt{constructor(j){this.self=j,this.actor=new i.Actor(j,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Y,geojson:ct},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(ie,ne)=>{if(this.workerSourceTypes[ie])throw new Error(`Worker source with name "${ie}" already registered.`);this.workerSourceTypes[ie]=ne},this.self.registerRTLTextPlugin=ie=>{if(i.plugin.isParsed())throw new Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=ie.applyArabicShaping,i.plugin.processBidirectionalText=ie.processBidirectionalText,i.plugin.processStyledBidirectionalText=ie.processStyledBidirectionalText}}setReferrer(j,ie){this.referrer=ie}setImages(j,ie,ne){this.availableImages[j]=ie;for(const de in this.workerSources[j]){const Re=this.workerSources[j][de];for(const tt in Re)Re[tt].availableImages=ie}ne()}setLayers(j,ie,ne){this.getLayerIndex(j).replace(ie),ne()}updateLayers(j,ie,ne){this.getLayerIndex(j).update(ie.layers,ie.removedIds),ne()}loadTile(j,ie,ne){this.getWorkerSource(j,ie.type,ie.source).loadTile(ie,ne)}loadDEMTile(j,ie,ne){this.getDEMWorkerSource(j,ie.source).loadTile(ie,ne)}reloadTile(j,ie,ne){this.getWorkerSource(j,ie.type,ie.source).reloadTile(ie,ne)}abortTile(j,ie,ne){this.getWorkerSource(j,ie.type,ie.source).abortTile(ie,ne)}removeTile(j,ie,ne){this.getWorkerSource(j,ie.type,ie.source).removeTile(ie,ne)}removeDEMTile(j,ie){this.getDEMWorkerSource(j,ie.source).removeTile(ie)}removeSource(j,ie,ne){if(!this.workerSources[j]||!this.workerSources[j][ie.type]||!this.workerSources[j][ie.type][ie.source])return;const de=this.workerSources[j][ie.type][ie.source];delete this.workerSources[j][ie.type][ie.source],de.removeSource!==void 0?de.removeSource(ie,ne):ne()}loadWorkerSource(j,ie,ne){try{this.self.importScripts(ie.url),ne()}catch(de){ne(de.toString())}}syncRTLPluginState(j,ie,ne){try{i.plugin.setState(ie);const de=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&de!=null){this.self.importScripts(de);const Re=i.plugin.isParsed();ne(Re?void 0:new Error(`RTL Text Plugin failed to import scripts from ${de}`),Re)}}catch(de){ne(de.toString())}}getAvailableImages(j){let ie=this.availableImages[j];return ie||(ie=[]),ie}getLayerIndex(j){let ie=this.layerIndexes[j];return ie||(ie=this.layerIndexes[j]=new U),ie}getWorkerSource(j,ie,ne){if(this.workerSources[j]||(this.workerSources[j]={}),this.workerSources[j][ie]||(this.workerSources[j][ie]={}),!this.workerSources[j][ie][ne]){const de={send:(Re,tt,He)=>{this.actor.send(Re,tt,He,j)}};this.workerSources[j][ie][ne]=new this.workerSourceTypes[ie](de,this.getLayerIndex(j),this.getAvailableImages(j))}return this.workerSources[j][ie][ne]}getDEMWorkerSource(j,ie){return this.demWorkerSources[j]||(this.demWorkerSources[j]={}),this.demWorkerSources[j][ie]||(this.demWorkerSources[j][ie]=new B),this.demWorkerSources[j][ie]}enforceCacheSizeLimit(j,ie){i.enforceCacheSizeLimit(ie)}}return i.isWorker()&&(self.worker=new wt(self)),wt}),p(["./shared"],function(i){var C=D;function D(M){return!function(h){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var T,F,O=new Blob([""],{type:"text/javascript"}),K=URL.createObjectURL(O);try{F=new Worker(K),T=!0}catch{T=!1}return F&&F.terminate(),URL.revokeObjectURL(K),T}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var T=document.createElement("canvas");T.width=T.height=1;var F=T.getContext("2d");if(!F)return!1;var O=F.getImageData(0,0,1,1);return O&&O.width===T.width}()?(U[_=h&&h.failIfMajorPerformanceCaveat]===void 0&&(U[_]=function(T){var F,O=function(K){var oe=document.createElement("canvas"),ue=Object.create(D.webGLContextAttributes);return ue.failIfMajorPerformanceCaveat=K,oe.getContext("webgl",ue)||oe.getContext("experimental-webgl",ue)}(T);if(!O)return!1;try{F=O.createShader(O.VERTEX_SHADER)}catch{return!1}return!(!F||O.isContextLost())&&(O.shaderSource(F,"void main() {}"),O.compileShader(F),O.getShaderParameter(F,O.COMPILE_STATUS)===!0)}(_)),U[_]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var _}(M)}var U={};function N(M,h){if(Array.isArray(M)){if(!Array.isArray(h)||M.length!==h.length)return!1;for(let _=0;_<M.length;_++)if(!N(M[_],h[_]))return!1;return!0}if(typeof M=="object"&&M!==null&&h!==null){if(typeof h!="object"||Object.keys(M).length!==Object.keys(h).length)return!1;for(const _ in M)if(!N(M[_],h[_]))return!1;return!0}return M===h}D.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class R{static testProp(h){if(!R.docStyle)return h[0];for(let _=0;_<h.length;_++)if(h[_]in R.docStyle)return h[_];return h[0]}static create(h,_,T){const F=window.document.createElement(h);return _!==void 0&&(F.className=_),T&&T.appendChild(F),F}static createNS(h,_){return window.document.createElementNS(h,_)}static disableDrag(){R.docStyle&&R.selectProp&&(R.userSelect=R.docStyle[R.selectProp],R.docStyle[R.selectProp]="none")}static enableDrag(){R.docStyle&&R.selectProp&&(R.docStyle[R.selectProp]=R.userSelect)}static setTransform(h,_){h.style[R.transformProp]=_}static addEventListener(h,_,T,F={}){h.addEventListener(_,T,"passive"in F?F:F.capture)}static removeEventListener(h,_,T,F={}){h.removeEventListener(_,T,"passive"in F?F:F.capture)}static suppressClickInternal(h){h.preventDefault(),h.stopPropagation(),window.removeEventListener("click",R.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",R.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",R.suppressClickInternal,!0)},0)}static mousePos(h,_){const T=h.getBoundingClientRect();return new i.pointGeometry(_.clientX-T.left-h.clientLeft,_.clientY-T.top-h.clientTop)}static touchPos(h,_){const T=h.getBoundingClientRect(),F=[];for(let O=0;O<_.length;O++)F.push(new i.pointGeometry(_[O].clientX-T.left-h.clientLeft,_[O].clientY-T.top-h.clientTop));return F}static mouseButton(h){return h.button}static remove(h){h.parentNode&&h.parentNode.removeChild(h)}}R.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,R.selectProp=R.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),R.transformProp=R.testProp(["transform","WebkitTransform"]);class G{constructor(h){this._transformRequestFn=h}transformRequest(h,_){return this._transformRequestFn&&this._transformRequestFn(h,_)||{url:h}}normalizeSpriteURL(h,_,T){const F=function(O){const K=O.match(J);if(!K)throw new Error(`Unable to parse URL "${O}"`);return{protocol:K[1],authority:K[2],path:K[3]||"/",params:K[4]?K[4].split("&"):[]}}(h);return F.path+=`${_}${T}`,function(O){const K=O.params.length?`?${O.params.join("&")}`:"";return`${O.protocol}://${O.authority}${O.path}${K}`}(F)}setTransformRequest(h){this._transformRequestFn=h}}const J=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Y{constructor(h,_,T,F){this.context=h,this.format=T,this.texture=h.gl.createTexture(),this.update(_,F)}update(h,_,T){const{width:F,height:O}=h,K=!(this.size&&this.size[0]===F&&this.size[1]===O||T),{context:oe}=this,{gl:ue}=oe;if(this.useMipmap=Boolean(_&&_.useMipmap),ue.bindTexture(ue.TEXTURE_2D,this.texture),oe.pixelStoreUnpackFlipY.set(!1),oe.pixelStoreUnpack.set(1),oe.pixelStoreUnpackPremultiplyAlpha.set(this.format===ue.RGBA&&(!_||_.premultiply!==!1)),K)this.size=[F,O],h instanceof HTMLImageElement||h instanceof HTMLCanvasElement||h instanceof HTMLVideoElement||h instanceof ImageData||i.isImageBitmap(h)?ue.texImage2D(ue.TEXTURE_2D,0,this.format,this.format,ue.UNSIGNED_BYTE,h):ue.texImage2D(ue.TEXTURE_2D,0,this.format,F,O,0,this.format,ue.UNSIGNED_BYTE,h.data);else{const{x:ve,y:Te}=T||{x:0,y:0};h instanceof HTMLImageElement||h instanceof HTMLCanvasElement||h instanceof HTMLVideoElement||h instanceof ImageData||i.isImageBitmap(h)?ue.texSubImage2D(ue.TEXTURE_2D,0,ve,Te,ue.RGBA,ue.UNSIGNED_BYTE,h):ue.texSubImage2D(ue.TEXTURE_2D,0,ve,Te,F,O,ue.RGBA,ue.UNSIGNED_BYTE,h.data)}this.useMipmap&&this.isSizePowerOfTwo()&&ue.generateMipmap(ue.TEXTURE_2D)}bind(h,_,T){const{context:F}=this,{gl:O}=F;O.bindTexture(O.TEXTURE_2D,this.texture),T!==O.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(T=O.LINEAR),h!==this.filter&&(O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MAG_FILTER,h),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MIN_FILTER,T||h),this.filter=h),_!==this.wrap&&(O.texParameteri(O.TEXTURE_2D,O.TEXTURE_WRAP_S,_),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_WRAP_T,_),this.wrap=_)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:h}=this.context;h.deleteTexture(this.texture),this.texture=null}}function B(M){const{userImage:h}=M;return!!(h&&h.render&&h.render())&&(M.data.replace(new Uint8Array(h.data.buffer)),!0)}class ae extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(h){if(this.loaded!==h&&(this.loaded=h,h)){for(const{ids:_,callback:T}of this.requestors)this._notify(_,T);this.requestors=[]}}getImage(h){return this.images[h]}addImage(h,_){if(this.images[h])throw new Error(`Image id ${h} already exist, use updateImage instead`);this._validate(h,_)&&(this.images[h]=_)}_validate(h,_){let T=!0;return this._validateStretch(_.stretchX,_.data&&_.data.width)||(this.fire(new i.ErrorEvent(new Error(`Image "${h}" has invalid "stretchX" value`))),T=!1),this._validateStretch(_.stretchY,_.data&&_.data.height)||(this.fire(new i.ErrorEvent(new Error(`Image "${h}" has invalid "stretchY" value`))),T=!1),this._validateContent(_.content,_)||(this.fire(new i.ErrorEvent(new Error(`Image "${h}" has invalid "content" value`))),T=!1),T}_validateStretch(h,_){if(!h)return!0;let T=0;for(const F of h){if(F[0]<T||F[1]<F[0]||_<F[1])return!1;T=F[1]}return!0}_validateContent(h,_){return!(h&&(h.length!==4||h[0]<0||_.data.width<h[0]||h[1]<0||_.data.height<h[1]||h[2]<0||_.data.width<h[2]||h[3]<0||_.data.height<h[3]||h[2]<h[0]||h[3]<h[1]))}updateImage(h,_){const T=this.images[h];if(T.data.width!==_.data.width||T.data.height!==_.data.height)throw new Error(`size mismatch between old image (${T.data.width}x${T.data.height}) and new image (${_.data.width}x${_.data.height}).`);_.version=T.version+1,this.images[h]=_,this.updatedImages[h]=!0}removeImage(h){const _=this.images[h];delete this.images[h],delete this.patterns[h],_.userImage&&_.userImage.onRemove&&_.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(h,_){let T=!0;if(!this.isLoaded())for(const F of h)this.images[F]||(T=!1);this.isLoaded()||T?this._notify(h,_):this.requestors.push({ids:h,callback:_})}_notify(h,_){const T={};for(const F of h){this.images[F]||this.fire(new i.Event("styleimagemissing",{id:F}));const O=this.images[F];O?T[F]={data:O.data.clone(),pixelRatio:O.pixelRatio,sdf:O.sdf,version:O.version,stretchX:O.stretchX,stretchY:O.stretchY,content:O.content,hasRenderCallback:Boolean(O.userImage&&O.userImage.render)}:i.warnOnce(`Image "${F}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}_(null,T)}getPixelSize(){const{width:h,height:_}=this.atlasImage;return{width:h,height:_}}getPattern(h){const _=this.patterns[h],T=this.getImage(h);if(!T)return null;if(_&&_.position.version===T.version)return _.position;if(_)_.position.version=T.version;else{const F={w:T.data.width+2,h:T.data.height+2,x:0,y:0},O=new i.ImagePosition(F,T);this.patterns[h]={bin:F,position:O}}return this._updatePatternAtlas(),this.patterns[h].position}bind(h){const _=h.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Y(h,this.atlasImage,_.RGBA),this.atlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE)}_updatePatternAtlas(){const h=[];for(const O in this.patterns)h.push(this.patterns[O].bin);const{w:_,h:T}=i.potpack(h),F=this.atlasImage;F.resize({width:_||1,height:T||1});for(const O in this.patterns){const{bin:K}=this.patterns[O],oe=K.x+1,ue=K.y+1,ve=this.images[O].data,Te=ve.width,ke=ve.height;i.RGBAImage.copy(ve,F,{x:0,y:0},{x:oe,y:ue},{width:Te,height:ke}),i.RGBAImage.copy(ve,F,{x:0,y:ke-1},{x:oe,y:ue-1},{width:Te,height:1}),i.RGBAImage.copy(ve,F,{x:0,y:0},{x:oe,y:ue+ke},{width:Te,height:1}),i.RGBAImage.copy(ve,F,{x:Te-1,y:0},{x:oe-1,y:ue},{width:1,height:ke}),i.RGBAImage.copy(ve,F,{x:0,y:0},{x:oe+Te,y:ue},{width:1,height:ke})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(h){for(const _ of h){if(this.callbackDispatchedThisFrame[_])continue;this.callbackDispatchedThisFrame[_]=!0;const T=this.images[_];T||i.warnOnce(`Image with ID: "${_}" was not found`),B(T)&&this.updateImage(_,T)}}}const le=1e20;function Ae(M,h,_,T,F,O,K,oe,ue){for(let ve=h;ve<h+T;ve++)we(M,_*O+ve,O,F,K,oe,ue);for(let ve=_;ve<_+F;ve++)we(M,ve*O+h,1,T,K,oe,ue)}function we(M,h,_,T,F,O,K){O[0]=0,K[0]=-le,K[1]=le,F[0]=M[h];for(let oe=1,ue=0,ve=0;oe<T;oe++){F[oe]=M[h+oe*_];const Te=oe*oe;do{const ke=O[ue];ve=(F[oe]-F[ke]+Te-ke*ke)/(oe-ke)/2}while(ve<=K[ue]&&--ue>-1);ue++,O[ue]=oe,K[ue]=ve,K[ue+1]=le}for(let oe=0,ue=0;oe<T;oe++){for(;K[ue+1]<oe;)ue++;const ve=O[ue],Te=oe-ve;M[h+oe*_]=F[ve]+Te*Te}}class me{constructor(h,_){this.requestManager=h,this.localIdeographFontFamily=_,this.entries={}}setURL(h){this.url=h}getGlyphs(h,_){const T=[];for(const F in h)for(const O of h[F])T.push({stack:F,id:O});i.asyncAll(T,({stack:F,id:O},K)=>{let oe=this.entries[F];oe||(oe=this.entries[F]={glyphs:{},requests:{},ranges:{}});let ue=oe.glyphs[O];if(ue!==void 0)return void K(null,{stack:F,id:O,glyph:ue});if(ue=this._tinySDF(oe,F,O),ue)return oe.glyphs[O]=ue,void K(null,{stack:F,id:O,glyph:ue});const ve=Math.floor(O/256);if(256*ve>65535)return void K(new Error("glyphs > 65535 not supported"));if(oe.ranges[ve])return void K(null,{stack:F,id:O,glyph:ue});let Te=oe.requests[ve];Te||(Te=oe.requests[ve]=[],me.loadGlyphRange(F,ve,this.url,this.requestManager,(ke,We)=>{if(We){for(const bt in We)this._doesCharSupportLocalGlyph(+bt)||(oe.glyphs[+bt]=We[+bt]);oe.ranges[ve]=!0}for(const bt of Te)bt(ke,We);delete oe.requests[ve]})),Te.push((ke,We)=>{ke?K(ke):We&&K(null,{stack:F,id:O,glyph:We[O]||null})})},(F,O)=>{if(F)_(F);else if(O){const K={};for(const{stack:oe,id:ue,glyph:ve}of O)(K[oe]||(K[oe]={}))[ue]=ve&&{id:ve.id,bitmap:ve.bitmap.clone(),metrics:ve.metrics};_(null,K)}})}_doesCharSupportLocalGlyph(h){return!!this.localIdeographFontFamily&&(i.unicodeBlockLookup["CJK Unified Ideographs"](h)||i.unicodeBlockLookup["Hangul Syllables"](h)||i.unicodeBlockLookup.Hiragana(h)||i.unicodeBlockLookup.Katakana(h))}_tinySDF(h,_,T){const F=this.localIdeographFontFamily;if(!F||!this._doesCharSupportLocalGlyph(T))return;let O=h.tinySDF;if(!O){let oe="400";/bold/i.test(_)?oe="900":/medium/i.test(_)?oe="500":/light/i.test(_)&&(oe="200"),O=h.tinySDF=new me.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:F,fontWeight:oe})}const K=O.draw(String.fromCharCode(T));return{id:T,bitmap:new i.AlphaImage({width:K.width||30,height:K.height||30},K.data),metrics:{width:K.glyphWidth||24,height:K.glyphHeight||24,left:K.glyphLeft||0,top:K.glyphTop-27||-8,advance:K.glyphAdvance||24}}}}me.loadGlyphRange=function(M,h,_,T,F){const O=256*h,K=O+255,oe=T.transformRequest(_.replace("{fontstack}",M).replace("{range}",`${O}-${K}`),i.ResourceType.Glyphs);i.getArrayBuffer(oe,(ue,ve)=>{if(ue)F(ue);else if(ve){const Te={};for(const ke of i.parseGlyphPbf(ve))Te[ke.id]=ke;F(null,Te)}})},me.TinySDF=class{constructor({fontSize:M=24,buffer:h=3,radius:_=8,cutoff:T=.25,fontFamily:F="sans-serif",fontWeight:O="normal",fontStyle:K="normal"}={}){this.buffer=h,this.cutoff=T,this.radius=_;const oe=this.size=M+4*h,ue=this._createCanvas(oe),ve=this.ctx=ue.getContext("2d",{willReadFrequently:!0});ve.font=`${K} ${O} ${M}px ${F}`,ve.textBaseline="alphabetic",ve.textAlign="left",ve.fillStyle="black",this.gridOuter=new Float64Array(oe*oe),this.gridInner=new Float64Array(oe*oe),this.f=new Float64Array(oe),this.z=new Float64Array(oe+1),this.v=new Uint16Array(oe)}_createCanvas(M){const h=document.createElement("canvas");return h.width=h.height=M,h}draw(M){const{width:h,actualBoundingBoxAscent:_,actualBoundingBoxDescent:T,actualBoundingBoxLeft:F,actualBoundingBoxRight:O}=this.ctx.measureText(M),K=Math.ceil(_),oe=Math.min(this.size-this.buffer,Math.ceil(O-F)),ue=Math.min(this.size-this.buffer,K+Math.ceil(T)),ve=oe+2*this.buffer,Te=ue+2*this.buffer,ke=Math.max(ve*Te,0),We=new Uint8ClampedArray(ke),bt={data:We,width:ve,height:Te,glyphWidth:oe,glyphHeight:ue,glyphTop:K,glyphLeft:0,glyphAdvance:h};if(oe===0||ue===0)return bt;const{ctx:mt,buffer:gt,gridInner:Vt,gridOuter:Zt}=this;mt.clearRect(gt,gt,oe,ue),mt.fillText(M,gt,gt+K);const ni=mt.getImageData(gt,gt,oe,ue);Zt.fill(le,0,ke),Vt.fill(0,0,ke);for(let St=0;St<ue;St++)for(let zt=0;zt<oe;zt++){const li=ni.data[4*(St*oe+zt)+3]/255;if(li===0)continue;const Ei=(St+gt)*ve+zt+gt;if(li===1)Zt[Ei]=0,Vt[Ei]=le;else{const bi=.5-li;Zt[Ei]=bi>0?bi*bi:0,Vt[Ei]=bi<0?bi*bi:0}}Ae(Zt,0,0,ve,Te,ve,this.f,this.v,this.z),Ae(Vt,gt,gt,oe,ue,ve,this.f,this.v,this.z);for(let St=0;St<ke;St++){const zt=Math.sqrt(Zt[St])-Math.sqrt(Vt[St]);We[St]=Math.round(255-255*(zt/this.radius+this.cutoff))}return bt}};const Pe=new i.Properties({anchor:new i.DataConstantProperty(i.spec.light.anchor),position:new class{constructor(){this.specification=i.spec.light.position}possiblyEvaluate(M,h){return i.sphericalToCartesian(M.expression.evaluate(h))}interpolate(M,h,_){return{x:i.number(M.x,h.x,_),y:i.number(M.y,h.y,_),z:i.number(M.z,h.z,_)}}},color:new i.DataConstantProperty(i.spec.light.color),intensity:new i.DataConstantProperty(i.spec.light.intensity)}),it="-transition";class Me extends i.Evented{constructor(h){super(),this._transitionable=new i.Transitionable(Pe),this.setLight(h),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(h,_={}){if(!this._validate(i.validateLight,h,_))for(const T in h){const F=h[T];T.endsWith(it)?this._transitionable.setTransition(T.slice(0,-it.length),F):this._transitionable.setValue(T,F)}}updateTransitions(h){this._transitioning=this._transitionable.transitioned(h,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(h){this.properties=this._transitioning.possiblyEvaluate(h)}_validate(h,_,T){return(!T||T.validate!==!1)&&i.emitValidationErrors(this,h.call(i.validateStyle,i.extend({value:_,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}class Ke{constructor(h,_){this.width=h,this.height=_,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(h,_){const T=h.join(",")+String(_);return this.dashEntry[T]||(this.dashEntry[T]=this.addDash(h,_)),this.dashEntry[T]}getDashRanges(h,_,T){const F=[];let O=h.length%2==1?-h[h.length-1]*T:0,K=h[0]*T,oe=!0;F.push({left:O,right:K,isDash:oe,zeroLength:h[0]===0});let ue=h[0];for(let ve=1;ve<h.length;ve++){oe=!oe;const Te=h[ve];O=ue*T,ue+=Te,K=ue*T,F.push({left:O,right:K,isDash:oe,zeroLength:Te===0})}return F}addRoundDash(h,_,T){const F=_/2;for(let O=-T;O<=T;O++){const K=this.width*(this.nextRow+T+O);let oe=0,ue=h[oe];for(let ve=0;ve<this.width;ve++){ve/ue.right>1&&(ue=h[++oe]);const Te=Math.abs(ve-ue.left),ke=Math.abs(ve-ue.right),We=Math.min(Te,ke);let bt;const mt=O/T*(F+1);if(ue.isDash){const gt=F-Math.abs(mt);bt=Math.sqrt(We*We+gt*gt)}else bt=F-Math.sqrt(We*We+mt*mt);this.data[K+ve]=Math.max(0,Math.min(255,bt+128))}}}addRegularDash(h){for(let oe=h.length-1;oe>=0;--oe){const ue=h[oe],ve=h[oe+1];ue.zeroLength?h.splice(oe,1):ve&&ve.isDash===ue.isDash&&(ve.left=ue.left,h.splice(oe,1))}const _=h[0],T=h[h.length-1];_.isDash===T.isDash&&(_.left=T.left-this.width,T.right=_.right+this.width);const F=this.width*this.nextRow;let O=0,K=h[O];for(let oe=0;oe<this.width;oe++){oe/K.right>1&&(K=h[++O]);const ue=Math.abs(oe-K.left),ve=Math.abs(oe-K.right),Te=Math.min(ue,ve);this.data[F+oe]=Math.max(0,Math.min(255,(K.isDash?Te:-Te)+128))}}addDash(h,_){const T=_?7:0,F=2*T+1;if(this.nextRow+F>this.height)return i.warnOnce("LineAtlas out of space"),null;let O=0;for(let oe=0;oe<h.length;oe++)O+=h[oe];if(O!==0){const oe=this.width/O,ue=this.getDashRanges(h,this.width,oe);_?this.addRoundDash(ue,oe,T):this.addRegularDash(ue)}const K={y:(this.nextRow+T+.5)/this.height,height:2*T/this.height,width:O};return this.nextRow+=F,this.dirty=!0,K}bind(h){const _=h.gl;this.texture?(_.bindTexture(_.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,_.texSubImage2D(_.TEXTURE_2D,0,0,0,this.width,this.height,_.ALPHA,_.UNSIGNED_BYTE,this.data))):(this.texture=_.createTexture(),_.bindTexture(_.TEXTURE_2D,this.texture),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.REPEAT),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.REPEAT),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR),_.texImage2D(_.TEXTURE_2D,0,_.ALPHA,this.width,this.height,0,_.ALPHA,_.UNSIGNED_BYTE,this.data))}}class Et{constructor(h,_){this.workerPool=h,this.actors=[],this.currentActor=0,this.id=i.uniqueId();const T=this.workerPool.acquire(this.id);for(let F=0;F<T.length;F++){const O=new Et.Actor(T[F],_,this.id);O.name=`Worker ${F}`,this.actors.push(O)}if(!this.actors.length)throw new Error("No actors found")}broadcast(h,_,T){i.asyncAll(this.actors,(F,O)=>{F.send(h,_,O)},T=T||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(h=>{h.remove()}),this.actors=[],this.workerPool.release(this.id)}}function oi(M,h,_){const T=function(F,O){if(F)return _(F);if(O){const K=i.pick(i.extend(O,M),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);O.vector_layers&&(K.vectorLayers=O.vector_layers,K.vectorLayerIds=K.vectorLayers.map(oe=>oe.id)),_(null,K)}};return M.url?i.getJSON(h.transformRequest(M.url,i.ResourceType.Source),T):i.exported.frame(()=>T(null,M))}Et.Actor=i.Actor;class Ci{constructor(h,_,T){this.bounds=i.LngLatBounds.convert(this.validateBounds(h)),this.minzoom=_||0,this.maxzoom=T||24}validateBounds(h){return Array.isArray(h)&&h.length===4?[Math.max(-180,h[0]),Math.max(-90,h[1]),Math.min(180,h[2]),Math.min(90,h[3])]:[-180,-90,180,90]}contains(h){const _=Math.pow(2,h.z),T=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*_),F=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*_),O=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*_),K=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*_);return h.x>=T&&h.x<O&&h.y>=F&&h.y<K}}class te extends i.Evented{constructor(h,_,T,F){if(super(),this.id=h,this.dispatcher=T,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(_,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},_),this._collectResourceTiming=_.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(F)}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=oi(this._options,this.map._requestManager,(h,_)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),h?this.fire(new i.ErrorEvent(h)):_&&(i.extend(this,_),_.bounds&&(this.tileBounds=new Ci(_.bounds,this.minzoom,this.maxzoom)),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(h){return!this.tileBounds||this.tileBounds.contains(h.canonical)}onAdd(h){this.map=h,this.load()}setSourceProperty(h){this._tileJSONRequest&&this._tileJSONRequest.cancel(),h(),this.load()}setTiles(h){return this.setSourceProperty(()=>{this._options.tiles=h}),this}setUrl(h){return this.setSourceProperty(()=>{this.url=h,this._options.url=h}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}loadTile(h,_){const T=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),F={request:this.map._requestManager.transformRequest(T,i.ResourceType.Tile),uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,tileSize:this.tileSize*h.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function O(K,oe){return delete h.request,h.aborted?_(null):K&&K.status!==404?_(K):(oe&&oe.resourceTiming&&(h.resourceTiming=oe.resourceTiming),this.map._refreshExpiredTiles&&oe&&h.setExpiryData(oe),h.loadVectorData(oe,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),_(null),void(h.reloadCallback&&(this.loadTile(h,h.reloadCallback),h.reloadCallback=null)))}F.request.collectResourceTiming=this._collectResourceTiming,h.actor&&h.state!=="expired"?h.state==="loading"?h.reloadCallback=_:h.request=h.actor.send("reloadTile",F,O.bind(this)):(h.actor=this.dispatcher.getActor(),h.request=h.actor.send("loadTile",F,O.bind(this)))}abortTile(h){h.request&&(h.request.cancel(),delete h.request),h.actor&&h.actor.send("abortTile",{uid:h.uid,type:this.type,source:this.id},void 0)}unloadTile(h){h.unloadVectorData(),h.actor&&h.actor.send("removeTile",{uid:h.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class ce extends i.Evented{constructor(h,_,T,F){super(),this.id=h,this.dispatcher=T,this.setEventedParent(F),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.extend({type:"raster"},_),i.extend(this,i.pick(_,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=oi(this._options,this.map._requestManager,(h,_)=>{this._tileJSONRequest=null,this._loaded=!0,h?this.fire(new i.ErrorEvent(h)):_&&(i.extend(this,_),_.bounds&&(this.tileBounds=new Ci(_.bounds,this.minzoom,this.maxzoom)),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(h){this.map=h,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(h){return!this.tileBounds||this.tileBounds.contains(h.canonical)}loadTile(h,_){const T=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);h.request=i.getImage(this.map._requestManager.transformRequest(T,i.ResourceType.Tile),(F,O,K)=>{if(delete h.request,h.aborted)h.state="unloaded",_(null);else if(F)h.state="errored",_(F);else if(O){this.map._refreshExpiredTiles&&h.setExpiryData(K);const oe=this.map.painter.context,ue=oe.gl;h.texture=this.map.painter.getTileTexture(O.width),h.texture?h.texture.update(O,{useMipmap:!0}):(h.texture=new Y(oe,O,ue.RGBA,{useMipmap:!0}),h.texture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE,ue.LINEAR_MIPMAP_NEAREST),oe.extTextureFilterAnisotropic&&ue.texParameterf(ue.TEXTURE_2D,oe.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,oe.extTextureFilterAnisotropicMax)),h.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),_(null)}})}abortTile(h,_){h.request&&(h.request.cancel(),delete h.request),_()}unloadTile(h,_){h.texture&&this.map.painter.saveTileTexture(h.texture),_()}hasTransition(){return!1}}let ye;class xe extends ce{constructor(h,_,T,F){super(h,_,T,F),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},_),this.encoding=_.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(h,_){const T=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function F(O,K){O&&(h.state="errored",_(O)),K&&(h.dem=K,h.needsHillshadePrepare=!0,h.needsTerrainPrepare=!0,h.state="loaded",_(null))}h.request=i.getImage(this.map._requestManager.transformRequest(T,i.ResourceType.Tile),function(O,K){if(delete h.request,h.aborted)h.state="unloaded",_(null);else if(O)h.state="errored",_(O);else if(K){this.map._refreshExpiredTiles&&h.setExpiryData(K),delete K.cacheControl,delete K.expires;const oe=i.isImageBitmap(K)&&(ye==null&&(ye=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ye)?K:i.exported.getImageData(K,1),ue={uid:h.uid,coord:h.tileID,source:this.id,rawImageData:oe,encoding:this.encoding};h.actor&&h.state!=="expired"||(h.actor=this.dispatcher.getActor(),h.actor.send("loadDEMTile",ue,F.bind(this)))}}.bind(this)),h.neighboringTiles=this._getNeighboringTiles(h.tileID)}_getNeighboringTiles(h){const _=h.canonical,T=Math.pow(2,_.z),F=(_.x-1+T)%T,O=_.x===0?h.wrap-1:h.wrap,K=(_.x+1+T)%T,oe=_.x+1===T?h.wrap+1:h.wrap,ue={};return ue[new i.OverscaledTileID(h.overscaledZ,O,_.z,F,_.y).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,oe,_.z,K,_.y).key]={backfilled:!1},_.y>0&&(ue[new i.OverscaledTileID(h.overscaledZ,O,_.z,F,_.y-1).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,h.wrap,_.z,_.x,_.y-1).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,oe,_.z,K,_.y-1).key]={backfilled:!1}),_.y+1<T&&(ue[new i.OverscaledTileID(h.overscaledZ,O,_.z,F,_.y+1).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,h.wrap,_.z,_.x,_.y+1).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,oe,_.z,K,_.y+1).key]={backfilled:!1}),ue}unloadTile(h){h.demTexture&&this.map.painter.saveTileTexture(h.demTexture),h.fbo&&(h.fbo.destroy(),delete h.fbo),h.dem&&delete h.dem,delete h.neighboringTiles,h.state="unloaded",h.actor&&h.actor.send("removeDEMTile",{uid:h.uid,source:this.id})}}class ze extends i.Evented{constructor(h,_,T,F){super(),this.id=h,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=T.getActor(),this.setEventedParent(F),this._data=_.data,this._options=i.extend({},_),this._collectResourceTiming=_.collectResourceTiming,_.maxzoom!==void 0&&(this.maxzoom=_.maxzoom),_.type&&(this.type=_.type),_.attribution&&(this.attribution=_.attribution),this.promoteId=_.promoteId;const O=i.EXTENT/this.tileSize;this.workerOptions=i.extend({source:this.id,cluster:_.cluster||!1,geojsonVtOptions:{buffer:(_.buffer!==void 0?_.buffer:128)*O,tolerance:(_.tolerance!==void 0?_.tolerance:.375)*O,extent:i.EXTENT,maxZoom:this.maxzoom,lineMetrics:_.lineMetrics||!1,generateId:_.generateId||!1},superclusterOptions:{maxZoom:_.clusterMaxZoom!==void 0?_.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,_.clusterMinPoints||2),extent:i.EXTENT,radius:(_.clusterRadius||50)*O,log:!1,generateId:_.generateId||!1},clusterProperties:_.clusterProperties,filter:_.filter},_.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(h){this.map=h,this.load()}setData(h){return this._data=h,this._updateWorkerData("content"),this}getClusterExpansionZoom(h,_){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:h,source:this.id},_),this}getClusterChildren(h,_){return this.actor.send("geojson.getClusterChildren",{clusterId:h,source:this.id},_),this}getClusterLeaves(h,_,T,F){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:h,limit:_,offset:T},F),this}_updateWorkerData(h){const _=i.extend({},this.workerOptions),T=this._data;typeof T=="string"?(_.request=this.map._requestManager.transformRequest(i.exported.resolveURL(T),i.ResourceType.Source),_.request.collectResourceTiming=this._collectResourceTiming):_.data=JSON.stringify(T),this._pendingLoads++,this.fire(new i.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,_,(F,O)=>{if(this._pendingLoads--,this._removed||O&&O.abandoned)return void this.fire(new i.Event("dataabort",{dataType:"source",sourceDataType:h}));let K=null;if(O&&O.resourceTiming&&O.resourceTiming[this.id]&&(K=O.resourceTiming[this.id].slice(0)),F)return void this.fire(new i.ErrorEvent(F));const oe={dataType:"source",sourceDataType:h};this._collectResourceTiming&&K&&K.length>0&&i.extend(oe,{resourceTiming:K}),this.fire(new i.Event("data",oe))})}loaded(){return this._pendingLoads===0}loadTile(h,_){const T=h.actor?"reloadTile":"loadTile";h.actor=this.actor;const F={type:this.type,uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};h.request=this.actor.send(T,F,(O,K)=>(delete h.request,h.unloadVectorData(),h.aborted?_(null):O?_(O):(h.loadVectorData(K,this.map.painter,T==="reloadTile"),_(null))))}abortTile(h){h.request&&(h.request.cancel(),delete h.request),h.aborted=!0}unloadTile(h){h.unloadVectorData(),this.actor.send("removeTile",{uid:h.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ne=i.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ge extends i.Evented{constructor(h,_,T,F){super(),this.id=h,this.dispatcher=T,this.coordinates=_.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(F),this.options=_}load(h,_){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(T,F)=>{this._loaded=!0,T?this.fire(new i.ErrorEvent(T)):F&&(this.image=F,h&&(this.coordinates=h),_&&_(),this._finishLoading())})}loaded(){return this._loaded}updateImage(h){return this.image&&h.url?(this.options.url=h.url,this.load(h.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(h){this.map=h,this.load()}setCoordinates(h){this.coordinates=h;const _=h.map(i.MercatorCoordinate.fromLngLat);this.tileID=function(F){let O=1/0,K=1/0,oe=-1/0,ue=-1/0;for(const We of F)O=Math.min(O,We.x),K=Math.min(K,We.y),oe=Math.max(oe,We.x),ue=Math.max(ue,We.y);const ve=Math.max(oe-O,ue-K),Te=Math.max(0,Math.floor(-Math.log(ve)/Math.LN2)),ke=Math.pow(2,Te);return new i.CanonicalTileID(Te,Math.floor((O+oe)/2*ke),Math.floor((K+ue)/2*ke))}(_),this.minzoom=this.maxzoom=this.tileID.z;const T=_.map(F=>this.tileID.getTilePoint(F)._round());return this._boundsArray=new i.RasterBoundsArray,this._boundsArray.emplaceBack(T[0].x,T[0].y,0,0),this._boundsArray.emplaceBack(T[1].x,T[1].y,i.EXTENT,0),this._boundsArray.emplaceBack(T[3].x,T[3].y,0,i.EXTENT),this._boundsArray.emplaceBack(T[2].x,T[2].y,i.EXTENT,i.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const h=this.map.painter.context,_=h.gl;this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Y(h,this.image,_.RGBA),this.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE));for(const T in this.tiles){const F=this.tiles[T];F.state!=="loaded"&&(F.state="loaded",F.texture=this.texture)}}loadTile(h,_){this.tileID&&this.tileID.equals(h.tileID.canonical)?(this.tiles[String(h.tileID.wrap)]=h,h.buckets={},_(null)):(h.state="errored",_(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Ve extends Ge{constructor(h,_,T,F){super(h,_,T,F),this.roundZoom=!0,this.type="video",this.options=_}load(){this._loaded=!1;const h=this.options;this.urls=[];for(const _ of h.urls)this.urls.push(this.map._requestManager.transformRequest(_,i.ResourceType.Source).url);i.getVideo(this.urls,(_,T)=>{this._loaded=!0,_?this.fire(new i.ErrorEvent(_)):T&&(this.video=T,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(h){if(this.video){const _=this.video.seekable;h<_.start(0)||h>_.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${_.start(0)} and ${_.end(0)}-second mark.`))):this.video.currentTime=h}}getVideo(){return this.video}onAdd(h){this.map||(this.map=h,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const h=this.map.painter.context,_=h.gl;this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE),_.texSubImage2D(_.TEXTURE_2D,0,0,0,_.RGBA,_.UNSIGNED_BYTE,this.video)):(this.texture=new Y(h,this.video,_.RGBA),this.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE));for(const T in this.tiles){const F=this.tiles[T];F.state!=="loaded"&&(F.state="loaded",F.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Le extends Ge{constructor(h,_,T,F){super(h,_,T,F),_.coordinates?Array.isArray(_.coordinates)&&_.coordinates.length===4&&!_.coordinates.some(O=>!Array.isArray(O)||O.length!==2||O.some(K=>typeof K!="number"))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'missing required property "coordinates"'))),_.animate&&typeof _.animate!="boolean"&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'optional "animate" property must be a boolean value'))),_.canvas?typeof _.canvas=="string"||_.canvas instanceof HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'missing required property "canvas"'))),this.options=_,this.animate=_.animate===void 0||_.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(h){this.map=h,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let h=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,h=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,h=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const _=this.map.painter.context,T=_.gl;this.boundsBuffer||(this.boundsBuffer=_.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(h||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Y(_,this.canvas,T.RGBA,{premultiply:!0});for(const F in this.tiles){const O=this.tiles[F];O.state!=="loaded"&&(O.state="loaded",O.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const h of[this.canvas.width,this.canvas.height])if(isNaN(h)||h<=0)return!0;return!1}}const Ie={vector:te,raster:ce,"raster-dem":xe,geojson:ze,video:Ve,image:Ge,canvas:Le};function qe(M,h){const _=i.create();return i.translate(_,_,[1,1,0]),i.scale(_,_,[.5*M.width,.5*M.height,1]),i.multiply(_,_,M.calculatePosMatrix(h.toUnwrapped()))}function et(M,h,_,T,F,O){const K=function(ke,We,bt){if(ke)for(const mt of ke){const gt=We[mt];if(gt&>.source===bt&>.type==="fill-extrusion")return!0}else for(const mt in We){const gt=We[mt];if(gt.source===bt&>.type==="fill-extrusion")return!0}return!1}(F&&F.layers,h,M.id),oe=O.maxPitchScaleFactor(),ue=M.tilesIn(T,oe,K);ue.sort(vt);const ve=[];for(const ke of ue)ve.push({wrappedTileID:ke.tileID.wrapped().key,queryResults:ke.tile.queryRenderedFeatures(h,_,M._state,ke.queryGeometry,ke.cameraQueryGeometry,ke.scale,F,O,oe,qe(M.transform,ke.tileID))});const Te=function(ke){const We={},bt={};for(const mt of ke){const gt=mt.queryResults,Vt=mt.wrappedTileID,Zt=bt[Vt]=bt[Vt]||{};for(const ni in gt){const St=gt[ni],zt=Zt[ni]=Zt[ni]||{},li=We[ni]=We[ni]||[];for(const Ei of St)zt[Ei.featureIndex]||(zt[Ei.featureIndex]=!0,li.push(Ei))}}return We}(ve);for(const ke in Te)Te[ke].forEach(We=>{const bt=We.feature,mt=M.getFeatureState(bt.layer["source-layer"],bt.id);bt.source=bt.layer.source,bt.layer["source-layer"]&&(bt.sourceLayer=bt.layer["source-layer"]),bt.state=mt});return Te}function vt(M,h){const _=M.tileID,T=h.tileID;return _.overscaledZ-T.overscaledZ||_.canonical.y-T.canonical.y||_.wrap-T.wrap||_.canonical.x-T.canonical.x}class Be{constructor(h,_){this.tileID=h,this.uid=i.uniqueId(),this.uses=0,this.tileSize=_,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(h){const _=h+this.timeAdded;_<i.exported.now()||this.fadeEndTime&&_<this.fadeEndTime||(this.fadeEndTime=_)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(h){this.demTexture&&h.saveTileTexture(this.demTexture),this.textures.forEach(_=>h.saveTileTexture(_)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(h,_,T){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",h){h.featureIndex&&(this.latestFeatureIndex=h.featureIndex,h.rawTileData?(this.latestRawTileData=h.rawTileData,this.latestFeatureIndex.rawTileData=h.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=h.collisionBoxArray,this.buckets=function(F,O){const K={};if(!O)return K;for(const oe of F){const ue=oe.layerIds.map(ve=>O.getLayer(ve)).filter(Boolean);if(ue.length!==0){oe.layers=ue,oe.stateDependentLayerIds&&(oe.stateDependentLayers=oe.stateDependentLayerIds.map(ve=>ue.filter(Te=>Te.id===ve)[0]));for(const ve of ue)K[ve.id]=oe}}return K}(h.buckets,_.style),this.hasSymbolBuckets=!1;for(const F in this.buckets){const O=this.buckets[F];if(O instanceof i.SymbolBucket){if(this.hasSymbolBuckets=!0,!T)break;O.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const F in this.buckets){const O=this.buckets[F];if(O instanceof i.SymbolBucket&&O.hasRTLText){this.hasRTLText=!0,i.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const F in this.buckets){const O=this.buckets[F];this.queryPadding=Math.max(this.queryPadding,_.style.getLayer(F).queryRadius(O))}h.imageAtlas&&(this.imageAtlas=h.imageAtlas),h.glyphAtlasImage&&(this.glyphAtlasImage=h.glyphAtlasImage)}else this.collisionBoxArray=new i.CollisionBoxArray}unloadVectorData(){for(const h in this.buckets)this.buckets[h].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(h){return this.buckets[h.id]}upload(h){for(const T in this.buckets){const F=this.buckets[T];F.uploadPending()&&F.upload(h)}const _=h.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Y(h,this.imageAtlas.image,_.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Y(h,this.glyphAtlasImage,_.ALPHA),this.glyphAtlasImage=null)}prepare(h){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(h,this.imageAtlasTexture)}queryRenderedFeatures(h,_,T,F,O,K,oe,ue,ve,Te){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:F,cameraQueryGeometry:O,scale:K,tileSize:this.tileSize,pixelPosMatrix:Te,transform:ue,params:oe,queryPadding:this.queryPadding*ve},h,_,T):{}}querySourceFeatures(h,_){const T=this.latestFeatureIndex;if(!T||!T.rawTileData)return;const F=T.loadVTLayers(),O=_?_.sourceLayer:"",K=F._geojsonTileLayer||F[O];if(!K)return;const oe=i.createFilter(_&&_.filter),{z:ue,x:ve,y:Te}=this.tileID.canonical,ke={z:ue,x:ve,y:Te};for(let We=0;We<K.length;We++){const bt=K.feature(We);if(oe.needGeometry){const Vt=i.toEvaluationFeature(bt,!0);if(!oe.filter(new i.EvaluationParameters(this.tileID.overscaledZ),Vt,this.tileID.canonical))continue}else if(!oe.filter(new i.EvaluationParameters(this.tileID.overscaledZ),bt))continue;const mt=T.getId(bt,O),gt=new i.GeoJSONFeature(bt,ue,ve,Te,mt);gt.tile=ke,h.push(gt)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(h){const _=this.expirationTime;if(h.cacheControl){const T=i.parseCacheControl(h.cacheControl);T["max-age"]&&(this.expirationTime=Date.now()+1e3*T["max-age"])}else h.expires&&(this.expirationTime=new Date(h.expires).getTime());if(this.expirationTime){const T=Date.now();let F=!1;if(this.expirationTime>T)F=!1;else if(_)if(this.expirationTime<_)F=!0;else{const O=this.expirationTime-_;O?this.expirationTime=T+Math.max(O,3e4):F=!0}else F=!0;F?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(h,_){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(h).length===0)return;const T=this.latestFeatureIndex.loadVTLayers();for(const F in this.buckets){if(!_.style.hasLayer(F))continue;const O=this.buckets[F],K=O.layers[0].sourceLayer||"_geojsonTileLayer",oe=T[K],ue=h[K];if(!oe||!ue||Object.keys(ue).length===0)continue;O.update(ue,oe,this.imageAtlas&&this.imageAtlas.patternPositions||{});const ve=_&&_.style&&_.style.getLayer(F);ve&&(this.queryPadding=Math.max(this.queryPadding,ve.queryRadius(O)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<i.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(h){this.symbolFadeHoldUntil=i.exported.now()+h}setDependencies(h,_){const T={};for(const F of _)T[F]=!0;this.dependencies[h]=T}hasDependency(h,_){for(const T of h){const F=this.dependencies[T];if(F){for(const O of _)if(F[O])return!0}}return!1}}class dt{constructor(h,_){this.max=h,this.onRemove=_,this.reset()}reset(){for(const h in this.data)for(const _ of this.data[h])_.timeout&&clearTimeout(_.timeout),this.onRemove(_.value);return this.data={},this.order=[],this}add(h,_,T){const F=h.wrapped().key;this.data[F]===void 0&&(this.data[F]=[]);const O={value:_,timeout:void 0};if(T!==void 0&&(O.timeout=setTimeout(()=>{this.remove(h,O)},T)),this.data[F].push(O),this.order.push(F),this.order.length>this.max){const K=this._getAndRemoveByKey(this.order[0]);K&&this.onRemove(K)}return this}has(h){return h.wrapped().key in this.data}getAndRemove(h){return this.has(h)?this._getAndRemoveByKey(h.wrapped().key):null}_getAndRemoveByKey(h){const _=this.data[h].shift();return _.timeout&&clearTimeout(_.timeout),this.data[h].length===0&&delete this.data[h],this.order.splice(this.order.indexOf(h),1),_.value}getByKey(h){const _=this.data[h];return _?_[0].value:null}get(h){return this.has(h)?this.data[h.wrapped().key][0].value:null}remove(h,_){if(!this.has(h))return this;const T=h.wrapped().key,F=_===void 0?0:this.data[T].indexOf(_),O=this.data[T][F];return this.data[T].splice(F,1),O.timeout&&clearTimeout(O.timeout),this.data[T].length===0&&delete this.data[T],this.onRemove(O.value),this.order.splice(this.order.indexOf(T),1),this}setMaxSize(h){for(this.max=h;this.order.length>this.max;){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this}filter(h){const _=[];for(const T in this.data)for(const F of this.data[T])h(F.value)||_.push(F);for(const T of _)this.remove(T.value.tileID,T)}}class ut{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(h,_,T){const F=String(_);if(this.stateChanges[h]=this.stateChanges[h]||{},this.stateChanges[h][F]=this.stateChanges[h][F]||{},i.extend(this.stateChanges[h][F],T),this.deletedStates[h]===null){this.deletedStates[h]={};for(const O in this.state[h])O!==F&&(this.deletedStates[h][O]=null)}else if(this.deletedStates[h]&&this.deletedStates[h][F]===null){this.deletedStates[h][F]={};for(const O in this.state[h][F])T[O]||(this.deletedStates[h][F][O]=null)}else for(const O in T)this.deletedStates[h]&&this.deletedStates[h][F]&&this.deletedStates[h][F][O]===null&&delete this.deletedStates[h][F][O]}removeFeatureState(h,_,T){if(this.deletedStates[h]===null)return;const F=String(_);if(this.deletedStates[h]=this.deletedStates[h]||{},T&&_!==void 0)this.deletedStates[h][F]!==null&&(this.deletedStates[h][F]=this.deletedStates[h][F]||{},this.deletedStates[h][F][T]=null);else if(_!==void 0)if(this.stateChanges[h]&&this.stateChanges[h][F])for(T in this.deletedStates[h][F]={},this.stateChanges[h][F])this.deletedStates[h][F][T]=null;else this.deletedStates[h][F]=null;else this.deletedStates[h]=null}getState(h,_){const T=String(_),F=i.extend({},(this.state[h]||{})[T],(this.stateChanges[h]||{})[T]);if(this.deletedStates[h]===null)return{};if(this.deletedStates[h]){const O=this.deletedStates[h][_];if(O===null)return{};for(const K in O)delete F[K]}return F}initializeTileState(h,_){h.setFeatureState(this.state,_)}coalesceChanges(h,_){const T={};for(const F in this.stateChanges){this.state[F]=this.state[F]||{};const O={};for(const K in this.stateChanges[F])this.state[F][K]||(this.state[F][K]={}),i.extend(this.state[F][K],this.stateChanges[F][K]),O[K]=this.state[F][K];T[F]=O}for(const F in this.deletedStates){this.state[F]=this.state[F]||{};const O={};if(this.deletedStates[F]===null)for(const K in this.state[F])O[K]={},this.state[F][K]={};else for(const K in this.deletedStates[F]){if(this.deletedStates[F][K]===null)this.state[F][K]={};else for(const oe of Object.keys(this.deletedStates[F][K]))delete this.state[F][K][oe];O[K]=this.state[F][K]}T[F]=T[F]||{},i.extend(T[F],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(T).length!==0)for(const F in h)h[F].setFeatureState(T,_)}}class Qt extends i.Evented{constructor(h,_,T){super(),this.id=h,this.dispatcher=T,this.on("data",F=>{F.dataType==="source"&&F.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&F.dataType==="source"&&F.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(F,O,K,oe){const ue=new Ie[O.type](F,O,K,oe);if(ue.id!==F)throw new Error(`Expected Source id to be ${F} instead of ${ue.id}`);return i.bindAll(["load","abort","unload","serialize","prepare"],ue),ue}(h,_,T,this),this._tiles={},this._cache=new dt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ut}onAdd(h){this.map=h,this._maxTileCacheSize=h?h._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(h)}onRemove(h){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(h)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const h in this._tiles){const _=this._tiles[h];if(_.state!=="loaded"&&_.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const h=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,h&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(h,_){return this._source.loadTile(h,_)}_unloadTile(h){if(this._source.unloadTile)return this._source.unloadTile(h,()=>{})}_abortTile(h){this._source.abortTile&&this._source.abortTile(h,()=>{}),this._source.fire(new i.Event("dataabort",{tile:h,coord:h.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(h){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const _ in this._tiles){const T=this._tiles[_];T.upload(h),T.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(h=>h.tileID).sort(Wt).map(h=>h.key)}getRenderableIds(h){const _=[];for(const T in this._tiles)this._isIdRenderable(T,h)&&_.push(this._tiles[T]);return h?_.sort((T,F)=>{const O=T.tileID,K=F.tileID,oe=new i.pointGeometry(O.canonical.x,O.canonical.y)._rotate(this.transform.angle),ue=new i.pointGeometry(K.canonical.x,K.canonical.y)._rotate(this.transform.angle);return O.overscaledZ-K.overscaledZ||ue.y-oe.y||ue.x-oe.x}).map(T=>T.tileID.key):_.map(T=>T.tileID).sort(Wt).map(T=>T.key)}hasRenderableParent(h){const _=this.findLoadedParent(h,0);return!!_&&this._isIdRenderable(_.tileID.key)}_isIdRenderable(h,_){return this._tiles[h]&&this._tiles[h].hasData()&&!this._coveredTiles[h]&&(_||!this._tiles[h].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const h in this._tiles)this._tiles[h].state!=="errored"&&this._reloadTile(h,"reloading")}}_reloadTile(h,_){const T=this._tiles[h];T&&(T.state!=="loading"&&(T.state=_),this._loadTile(T,this._tileLoaded.bind(this,T,h,_)))}_tileLoaded(h,_,T,F){if(F)return h.state="errored",void(F.status!==404?this._source.fire(new i.ErrorEvent(F,{tile:h})):this.update(this.transform,this.terrain));h.timeAdded=i.exported.now(),T==="expired"&&(h.refreshedUponExpiration=!0),this._setTileReloadTimer(_,h),this.getSource().type==="raster-dem"&&h.dem&&this._backfillDEM(h),this._state.initializeTileState(h,this.map?this.map.painter:null),h.aborted||this._source.fire(new i.Event("data",{dataType:"source",tile:h,coord:h.tileID}))}_backfillDEM(h){const _=this.getRenderableIds();for(let F=0;F<_.length;F++){const O=_[F];if(h.neighboringTiles&&h.neighboringTiles[O]){const K=this.getTileByID(O);T(h,K),T(K,h)}}function T(F,O){F.needsHillshadePrepare=!0,F.needsTerrainPrepare=!0;let K=O.tileID.canonical.x-F.tileID.canonical.x;const oe=O.tileID.canonical.y-F.tileID.canonical.y,ue=Math.pow(2,F.tileID.canonical.z),ve=O.tileID.key;K===0&&oe===0||Math.abs(oe)>1||(Math.abs(K)>1&&(Math.abs(K+ue)===1?K+=ue:Math.abs(K-ue)===1&&(K-=ue)),O.dem&&F.dem&&(F.dem.backfillBorder(O.dem,K,oe),F.neighboringTiles&&F.neighboringTiles[ve]&&(F.neighboringTiles[ve].backfilled=!0)))}}getTile(h){return this.getTileByID(h.key)}getTileByID(h){return this._tiles[h]}_retainLoadedChildren(h,_,T,F){for(const O in this._tiles){let K=this._tiles[O];if(F[O]||!K.hasData()||K.tileID.overscaledZ<=_||K.tileID.overscaledZ>T)continue;let oe=K.tileID;for(;K&&K.tileID.overscaledZ>_+1;){const ve=K.tileID.scaledTo(K.tileID.overscaledZ-1);K=this._tiles[ve.key],K&&K.hasData()&&(oe=ve)}let ue=oe;for(;ue.overscaledZ>_;)if(ue=ue.scaledTo(ue.overscaledZ-1),h[ue.key]){F[oe.key]=oe;break}}}findLoadedParent(h,_){if(h.key in this._loadedParentTiles){const T=this._loadedParentTiles[h.key];return T&&T.tileID.overscaledZ>=_?T:null}for(let T=h.overscaledZ-1;T>=_;T--){const F=h.scaledTo(T),O=this._getLoadedTile(F);if(O)return O}}_getLoadedTile(h){const _=this._tiles[h.key];return _&&_.hasData()?_:this._cache.getByKey(h.wrapped().key)}updateCacheSize(h){const _=Math.ceil(h.width/this._source.tileSize)+1,T=Math.ceil(h.height/this._source.tileSize)+1,F=Math.floor(_*T*5),O=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,F):F;this._cache.setMaxSize(O)}handleWrapJump(h){const _=Math.round((h-(this._prevLng===void 0?h:this._prevLng))/360);if(this._prevLng=h,_){const T={};for(const F in this._tiles){const O=this._tiles[F];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+_),T[O.tileID.key]=O}this._tiles=T;for(const F in this._timers)clearTimeout(this._timers[F]),delete this._timers[F];for(const F in this._tiles)this._setTileReloadTimer(F,this._tiles[F])}}update(h,_){if(this.transform=h,this.terrain=_,!this._sourceLoaded||this._paused)return;let T;this.updateCacheSize(h),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?T=h.getVisibleUnwrappedCoordinates(this._source.tileID).map(ve=>new i.OverscaledTileID(ve.canonical.z,ve.wrap,ve.canonical.z,ve.canonical.x,ve.canonical.y)):(T=h.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:_}),this._source.hasTile&&(T=T.filter(ve=>this._source.hasTile(ve)))):T=[];const F=h.coveringZoomLevel(this._source),O=Math.max(F-Qt.maxOverzooming,this._source.minzoom),K=Math.max(F+Qt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const ve={};for(const Te of T)if(Te.canonical.z>this._source.minzoom){const ke=Te.scaledTo(Te.canonical.z-1);ve[ke.key]=ke;const We=Te.scaledTo(Math.max(this._source.minzoom,Math.min(Te.canonical.z,5)));ve[We.key]=We}T=T.concat(Object.values(ve))}const oe=this._updateRetainedTiles(T,F);if(Nt(this._source.type)){const ve={},Te={},ke=Object.keys(oe);for(const We of ke){const bt=oe[We],mt=this._tiles[We];if(!mt||mt.fadeEndTime&&mt.fadeEndTime<=i.exported.now())continue;const gt=this.findLoadedParent(bt,O);gt&&(this._addTile(gt.tileID),ve[gt.tileID.key]=gt.tileID),Te[We]=bt}this._retainLoadedChildren(Te,F,K,oe);for(const We in ve)oe[We]||(this._coveredTiles[We]=!0,oe[We]=ve[We]);if(_){const We={},bt={};for(const mt of T)this._tiles[mt.key].hasData()?We[mt.key]=mt:bt[mt.key]=mt;for(const mt in bt){const gt=bt[mt].children(this._source.maxzoom);this._tiles[gt[0].key]&&this._tiles[gt[1].key]&&this._tiles[gt[2].key]&&this._tiles[gt[3].key]&&(We[gt[0].key]=oe[gt[0].key]=gt[0],We[gt[1].key]=oe[gt[1].key]=gt[1],We[gt[2].key]=oe[gt[2].key]=gt[2],We[gt[3].key]=oe[gt[3].key]=gt[3],delete bt[mt])}for(const mt in bt){const gt=this.findLoadedParent(bt[mt],this._source.minzoom);if(gt){We[gt.tileID.key]=oe[gt.tileID.key]=gt.tileID;for(const Vt in We)We[Vt].isChildOf(gt.tileID)&&delete We[Vt]}}for(const mt in this._tiles)We[mt]||(this._coveredTiles[mt]=!0)}}for(const ve in oe)this._tiles[ve].clearFadeHold();const ue=i.keysDifference(this._tiles,oe);for(const ve of ue){const Te=this._tiles[ve];Te.hasSymbolBuckets&&!Te.holdingForFade()?Te.setHoldDuration(this.map._fadeDuration):Te.hasSymbolBuckets&&!Te.symbolFadeFinished()||this._removeTile(ve)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const h in this._tiles)this._tiles[h].holdingForFade()&&this._removeTile(h)}_updateRetainedTiles(h,_){const T={},F={},O=Math.max(_-Qt.maxOverzooming,this._source.minzoom),K=Math.max(_+Qt.maxUnderzooming,this._source.minzoom),oe={};for(const ue of h){const ve=this._addTile(ue);T[ue.key]=ue,ve.hasData()||_<this._source.maxzoom&&(oe[ue.key]=ue)}this._retainLoadedChildren(oe,_,K,T);for(const ue of h){let ve=this._tiles[ue.key];if(ve.hasData())continue;if(_+1>this._source.maxzoom){const ke=ue.children(this._source.maxzoom)[0],We=this.getTile(ke);if(We&&We.hasData()){T[ke.key]=ke;continue}}else{const ke=ue.children(this._source.maxzoom);if(T[ke[0].key]&&T[ke[1].key]&&T[ke[2].key]&&T[ke[3].key])continue}let Te=ve.wasRequested();for(let ke=ue.overscaledZ-1;ke>=O;--ke){const We=ue.scaledTo(ke);if(F[We.key]||(F[We.key]=!0,ve=this.getTile(We),!ve&&Te&&(ve=this._addTile(We)),ve&&(T[We.key]=We,Te=ve.wasRequested(),ve.hasData())))break}}return T}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const h in this._tiles){const _=[];let T,F=this._tiles[h].tileID;for(;F.overscaledZ>0;){if(F.key in this._loadedParentTiles){T=this._loadedParentTiles[F.key];break}_.push(F.key);const O=F.scaledTo(F.overscaledZ-1);if(T=this._getLoadedTile(O),T)break;F=O}for(const O of _)this._loadedParentTiles[O]=T}}_addTile(h){let _=this._tiles[h.key];if(_)return _;_=this._cache.getAndRemove(h),_&&(this._setTileReloadTimer(h.key,_),_.tileID=h,this._state.initializeTileState(_,this.map?this.map.painter:null),this._cacheTimers[h.key]&&(clearTimeout(this._cacheTimers[h.key]),delete this._cacheTimers[h.key],this._setTileReloadTimer(h.key,_)));const T=_;return _||(_=new Be(h,this._source.tileSize*h.overscaleFactor()),this._loadTile(_,this._tileLoaded.bind(this,_,h.key,_.state))),_.uses++,this._tiles[h.key]=_,T||this._source.fire(new i.Event("dataloading",{tile:_,coord:_.tileID,dataType:"source"})),_}_setTileReloadTimer(h,_){h in this._timers&&(clearTimeout(this._timers[h]),delete this._timers[h]);const T=_.getExpiryTimeout();T&&(this._timers[h]=setTimeout(()=>{this._reloadTile(h,"expired"),delete this._timers[h]},T))}_removeTile(h){const _=this._tiles[h];_&&(_.uses--,delete this._tiles[h],this._timers[h]&&(clearTimeout(this._timers[h]),delete this._timers[h]),_.uses>0||(_.hasData()&&_.state!=="reloading"?this._cache.add(_.tileID,_,_.getExpiryTimeout()):(_.aborted=!0,this._abortTile(_),this._unloadTile(_))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const h in this._tiles)this._removeTile(h);this._cache.reset()}tilesIn(h,_,T){const F=[],O=this.transform;if(!O)return F;const K=T?O.getCameraQueryGeometry(h):h,oe=h.map(mt=>O.pointCoordinate(mt,this.terrain)),ue=K.map(mt=>O.pointCoordinate(mt,this.terrain)),ve=this.getIds();let Te=1/0,ke=1/0,We=-1/0,bt=-1/0;for(const mt of ue)Te=Math.min(Te,mt.x),ke=Math.min(ke,mt.y),We=Math.max(We,mt.x),bt=Math.max(bt,mt.y);for(let mt=0;mt<ve.length;mt++){const gt=this._tiles[ve[mt]];if(gt.holdingForFade())continue;const Vt=gt.tileID,Zt=Math.pow(2,O.zoom-gt.tileID.overscaledZ),ni=_*gt.queryPadding*i.EXTENT/gt.tileSize/Zt,St=[Vt.getTilePoint(new i.MercatorCoordinate(Te,ke)),Vt.getTilePoint(new i.MercatorCoordinate(We,bt))];if(St[0].x-ni<i.EXTENT&&St[0].y-ni<i.EXTENT&&St[1].x+ni>=0&&St[1].y+ni>=0){const zt=oe.map(Ei=>Vt.getTilePoint(Ei)),li=ue.map(Ei=>Vt.getTilePoint(Ei));F.push({tile:gt,tileID:Vt,queryGeometry:zt,cameraQueryGeometry:li,scale:Zt})}}return F}getVisibleCoordinates(h){const _=this.getRenderableIds(h).map(T=>this._tiles[T].tileID);for(const T of _)T.posMatrix=this.transform.calculatePosMatrix(T.toUnwrapped());return _}hasTransition(){if(this._source.hasTransition())return!0;if(Nt(this._source.type))for(const h in this._tiles){const _=this._tiles[h];if(_.fadeEndTime!==void 0&&_.fadeEndTime>=i.exported.now())return!0}return!1}setFeatureState(h,_,T){this._state.updateState(h=h||"_geojsonTileLayer",_,T)}removeFeatureState(h,_,T){this._state.removeFeatureState(h=h||"_geojsonTileLayer",_,T)}getFeatureState(h,_){return this._state.getState(h=h||"_geojsonTileLayer",_)}setDependencies(h,_,T){const F=this._tiles[h];F&&F.setDependencies(_,T)}reloadTilesForDependencies(h,_){for(const T in this._tiles)this._tiles[T].hasDependency(h,_)&&this._reloadTile(T,"reloading");this._cache.filter(T=>!T.hasDependency(h,_))}}function Wt(M,h){const _=Math.abs(2*M.wrap)-+(M.wrap<0),T=Math.abs(2*h.wrap)-+(h.wrap<0);return M.overscaledZ-h.overscaledZ||T-_||h.canonical.y-M.canonical.y||h.canonical.x-M.canonical.x}function Nt(M){return M==="raster"||M==="image"||M==="video"}Qt.maxOverzooming=10,Qt.maxUnderzooming=3;const Ct="mapboxgl_preloaded_worker_pool";class Ft{constructor(){this.active={}}acquire(h){if(!this.workers)for(this.workers=[];this.workers.length<Ft.workerCount;)this.workers.push(new Worker(xl.workerUrl));return this.active[h]=!0,this.workers.slice()}release(h){delete this.active[h],this.numActive()===0&&(this.workers.forEach(_=>{_.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ct]}numActive(){return Object.keys(this.active).length}}const Xt=Math.floor(i.exported.hardwareConcurrency/2);let mi;function fi(){return mi||(mi=new Ft),mi}function Gi(M,h){const _={};for(const T in M)T!=="ref"&&(_[T]=M[T]);return i.refProperties.forEach(T=>{T in h&&(_[T]=h[T])}),_}function wn(M){M=M.slice();const h=Object.create(null);for(let _=0;_<M.length;_++)h[M[_].id]=M[_];for(let _=0;_<M.length;_++)"ref"in M[_]&&(M[_]=Gi(M[_],h[M[_].ref]));return M}Ft.workerCount=Math.max(Math.min(Xt,6),1);const Qi={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Gn(M,h,_){_.push({command:Qi.addSource,args:[M,h[M]]})}function kn(M,h,_){h.push({command:Qi.removeSource,args:[M]}),_[M]=!0}function yt(M,h,_,T){kn(M,_,T),Gn(M,h,_)}function st(M,h,_){let T;for(T in M[_])if(Object.prototype.hasOwnProperty.call(M[_],T)&&T!=="data"&&!N(M[_][T],h[_][T]))return!1;for(T in h[_])if(Object.prototype.hasOwnProperty.call(h[_],T)&&T!=="data"&&!N(M[_][T],h[_][T]))return!1;return!0}function ti(M,h,_,T,F,O){let K;for(K in h=h||{},M=M||{})Object.prototype.hasOwnProperty.call(M,K)&&(N(M[K],h[K])||_.push({command:O,args:[T,K,h[K],F]}));for(K in h)Object.prototype.hasOwnProperty.call(h,K)&&!Object.prototype.hasOwnProperty.call(M,K)&&(N(M[K],h[K])||_.push({command:O,args:[T,K,h[K],F]}))}function Ni(M){return M.id}function qi(M,h){return M[h.id]=h,M}class en{constructor(h,_){this.reset(h,_)}reset(h,_){this.points=h||[],this._distances=[0];for(let T=1;T<this.points.length;T++)this._distances[T]=this._distances[T-1]+this.points[T].dist(this.points[T-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(_||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(h){if(this.points.length===1)return this.points[0];h=i.clamp(h,0,1);let _=1,T=this._distances[_];const F=h*this.paddedLength+this.padding;for(;T<F&&_<this._distances.length;)T=this._distances[++_];const O=_-1,K=this._distances[O],oe=T-K,ue=oe>0?(F-K)/oe:0;return this.points[O].mult(1-ue).add(this.points[_].mult(ue))}}function $t(M,h){let _=!0;return M==="always"||M!=="never"&&h!=="never"||(_=!1),_}class at{constructor(h,_,T){const F=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(h/T),this.yCellCount=Math.ceil(_/T);for(let K=0;K<this.xCellCount*this.yCellCount;K++)F.push([]),O.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=h,this.height=_,this.xScale=this.xCellCount/h,this.yScale=this.yCellCount/_,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(h,_,T,F,O){this._forEachCell(_,T,F,O,this._insertBoxCell,this.boxUid++),this.boxKeys.push(h),this.bboxes.push(_),this.bboxes.push(T),this.bboxes.push(F),this.bboxes.push(O)}insertCircle(h,_,T,F){this._forEachCell(_-F,T-F,_+F,T+F,this._insertCircleCell,this.circleUid++),this.circleKeys.push(h),this.circles.push(_),this.circles.push(T),this.circles.push(F)}_insertBoxCell(h,_,T,F,O,K){this.boxCells[O].push(K)}_insertCircleCell(h,_,T,F,O,K){this.circleCells[O].push(K)}_query(h,_,T,F,O,K,oe){if(T<0||h>this.width||F<0||_>this.height)return[];const ue=[];if(h<=0&&_<=0&&this.width<=T&&this.height<=F){if(O)return[{key:null,x1:h,y1:_,x2:T,y2:F}];for(let ve=0;ve<this.boxKeys.length;ve++)ue.push({key:this.boxKeys[ve],x1:this.bboxes[4*ve],y1:this.bboxes[4*ve+1],x2:this.bboxes[4*ve+2],y2:this.bboxes[4*ve+3]});for(let ve=0;ve<this.circleKeys.length;ve++){const Te=this.circles[3*ve],ke=this.circles[3*ve+1],We=this.circles[3*ve+2];ue.push({key:this.circleKeys[ve],x1:Te-We,y1:ke-We,x2:Te+We,y2:ke+We})}}else this._forEachCell(h,_,T,F,this._queryCell,ue,{hitTest:O,overlapMode:K,seenUids:{box:{},circle:{}}},oe);return ue}query(h,_,T,F){return this._query(h,_,T,F,!1,null)}hitTest(h,_,T,F,O,K){return this._query(h,_,T,F,!0,O,K).length>0}hitTestCircle(h,_,T,F,O){const K=h-T,oe=h+T,ue=_-T,ve=_+T;if(oe<0||K>this.width||ve<0||ue>this.height)return!1;const Te=[];return this._forEachCell(K,ue,oe,ve,this._queryCellCircle,Te,{hitTest:!0,overlapMode:F,circle:{x:h,y:_,radius:T},seenUids:{box:{},circle:{}}},O),Te.length>0}_queryCell(h,_,T,F,O,K,oe,ue){const{seenUids:ve,hitTest:Te,overlapMode:ke}=oe,We=this.boxCells[O];if(We!==null){const mt=this.bboxes;for(const gt of We)if(!ve.box[gt]){ve.box[gt]=!0;const Vt=4*gt,Zt=this.boxKeys[gt];if(h<=mt[Vt+2]&&_<=mt[Vt+3]&&T>=mt[Vt+0]&&F>=mt[Vt+1]&&(!ue||ue(Zt))&&(!Te||!$t(ke,Zt.overlapMode))&&(K.push({key:Zt,x1:mt[Vt],y1:mt[Vt+1],x2:mt[Vt+2],y2:mt[Vt+3]}),Te))return!0}}const bt=this.circleCells[O];if(bt!==null){const mt=this.circles;for(const gt of bt)if(!ve.circle[gt]){ve.circle[gt]=!0;const Vt=3*gt,Zt=this.circleKeys[gt];if(this._circleAndRectCollide(mt[Vt],mt[Vt+1],mt[Vt+2],h,_,T,F)&&(!ue||ue(Zt))&&(!Te||!$t(ke,Zt.overlapMode))){const ni=mt[Vt],St=mt[Vt+1],zt=mt[Vt+2];if(K.push({key:Zt,x1:ni-zt,y1:St-zt,x2:ni+zt,y2:St+zt}),Te)return!0}}}return!1}_queryCellCircle(h,_,T,F,O,K,oe,ue){const{circle:ve,seenUids:Te,overlapMode:ke}=oe,We=this.boxCells[O];if(We!==null){const mt=this.bboxes;for(const gt of We)if(!Te.box[gt]){Te.box[gt]=!0;const Vt=4*gt,Zt=this.boxKeys[gt];if(this._circleAndRectCollide(ve.x,ve.y,ve.radius,mt[Vt+0],mt[Vt+1],mt[Vt+2],mt[Vt+3])&&(!ue||ue(Zt))&&!$t(ke,Zt.overlapMode))return K.push(!0),!0}}const bt=this.circleCells[O];if(bt!==null){const mt=this.circles;for(const gt of bt)if(!Te.circle[gt]){Te.circle[gt]=!0;const Vt=3*gt,Zt=this.circleKeys[gt];if(this._circlesCollide(mt[Vt],mt[Vt+1],mt[Vt+2],ve.x,ve.y,ve.radius)&&(!ue||ue(Zt))&&!$t(ke,Zt.overlapMode))return K.push(!0),!0}}}_forEachCell(h,_,T,F,O,K,oe,ue){const ve=this._convertToXCellCoord(h),Te=this._convertToYCellCoord(_),ke=this._convertToXCellCoord(T),We=this._convertToYCellCoord(F);for(let bt=ve;bt<=ke;bt++)for(let mt=Te;mt<=We;mt++)if(O.call(this,h,_,T,F,this.xCellCount*mt+bt,K,oe,ue))return}_convertToXCellCoord(h){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(h*this.xScale)))}_convertToYCellCoord(h){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(h*this.yScale)))}_circlesCollide(h,_,T,F,O,K){const oe=F-h,ue=O-_,ve=T+K;return ve*ve>oe*oe+ue*ue}_circleAndRectCollide(h,_,T,F,O,K,oe){const ue=(K-F)/2,ve=Math.abs(h-(F+ue));if(ve>ue+T)return!1;const Te=(oe-O)/2,ke=Math.abs(_-(O+Te));if(ke>Te+T)return!1;if(ve<=ue||ke<=Te)return!0;const We=ve-ue,bt=ke-Te;return We*We+bt*bt<=T*T}}function ii(M,h,_,T,F){const O=i.create();return h?(i.scale(O,O,[1/F,1/F,1]),_||i.rotateZ(O,O,T.angle)):i.multiply(O,T.labelPlaneMatrix,M),O}function hn(M,h,_,T,F){if(h){const O=i.clone(M);return i.scale(O,O,[F,F,1]),_||i.rotateZ(O,O,-T.angle),O}return T.glCoordMatrix}function Xi(M,h,_){let T;_?(T=[M.x,M.y,_(M.x,M.y),1],i.transformMat4(T,T,h)):(T=[M.x,M.y,0,1],Pn(T,T,h));const F=T[3];return{point:new i.pointGeometry(T[0]/F,T[1]/F),signedDistanceFromCamera:F}}function on(M,h){return .5+M/h*.5}function Cn(M,h){const _=M[0]/M[3],T=M[1]/M[3];return _>=-h[0]&&_<=h[0]&&T>=-h[1]&&T<=h[1]}function Tn(M,h,_,T,F,O,K,oe,ue,ve){const Te=T?M.textSizeData:M.iconSizeData,ke=i.evaluateSizeForZoom(Te,_.transform.zoom),We=[256/_.width*2+1,256/_.height*2+1],bt=T?M.text.dynamicLayoutVertexArray:M.icon.dynamicLayoutVertexArray;bt.clear();const mt=M.lineVertexArray,gt=T?M.text.placedSymbolArray:M.icon.placedSymbolArray,Vt=_.transform.width/_.transform.height;let Zt=!1;for(let ni=0;ni<gt.length;ni++){const St=gt.get(ni);if(St.hidden||St.writingMode===i.WritingMode.vertical&&!Zt){Ui(St.numGlyphs,bt);continue}let zt;if(Zt=!1,ve?(zt=[St.anchorX,St.anchorY,ve(St.anchorX,St.anchorY),1],i.transformMat4(zt,zt,h)):(zt=[St.anchorX,St.anchorY,0,1],Pn(zt,zt,h)),!Cn(zt,We)){Ui(St.numGlyphs,bt);continue}const li=on(_.transform.cameraToCenterDistance,zt[3]),Ei=i.evaluateSizeForFeature(Te,ke,St),bi=K?Ei/li:Ei*li,Hi=new i.pointGeometry(St.anchorX,St.anchorY),xi=Xi(Hi,F,ve).point,xn={},cn=bn(St,bi,!1,oe,h,F,O,M.glyphOffsetArray,mt,bt,xi,Hi,xn,Vt,ue,ve);Zt=cn.useVertical,(cn.notEnoughRoom||Zt||cn.needsFlipping&&bn(St,bi,!0,oe,h,F,O,M.glyphOffsetArray,mt,bt,xi,Hi,xn,Vt,ue,ve).notEnoughRoom)&&Ui(St.numGlyphs,bt)}T?M.text.dynamicLayoutVertexBuffer.updateData(bt):M.icon.dynamicLayoutVertexBuffer.updateData(bt)}function nr(M,h,_,T,F,O,K,oe,ue,ve,Te,ke,We){const bt=oe.glyphStartIndex+oe.numGlyphs,mt=oe.lineStartIndex,gt=oe.lineStartIndex+oe.lineLength,Vt=h.getoffsetX(oe.glyphStartIndex),Zt=h.getoffsetX(bt-1),ni=vi(M*Vt,_,T,F,O,K,oe.segment,mt,gt,ue,ve,Te,ke,We);if(!ni)return null;const St=vi(M*Zt,_,T,F,O,K,oe.segment,mt,gt,ue,ve,Te,ke,We);return St?{first:ni,last:St}:null}function Ii(M,h,_,T){return M===i.WritingMode.horizontal&&Math.abs(_.y-h.y)>Math.abs(_.x-h.x)*T?{useVertical:!0}:(M===i.WritingMode.vertical?h.y<_.y:h.x>_.x)?{needsFlipping:!0}:null}function bn(M,h,_,T,F,O,K,oe,ue,ve,Te,ke,We,bt,mt,gt){const Vt=h/24,Zt=M.lineOffsetX*Vt,ni=M.lineOffsetY*Vt;let St;if(M.numGlyphs>1){const zt=M.glyphStartIndex+M.numGlyphs,li=M.lineStartIndex,Ei=M.lineStartIndex+M.lineLength,bi=nr(Vt,oe,Zt,ni,_,Te,ke,M,ue,O,We,mt,gt);if(!bi)return{notEnoughRoom:!0};const Hi=Xi(bi.first.point,K,gt).point,xi=Xi(bi.last.point,K,gt).point;if(T&&!_){const xn=Ii(M.writingMode,Hi,xi,bt);if(xn)return xn}St=[bi.first];for(let xn=M.glyphStartIndex+1;xn<zt-1;xn++)St.push(vi(Vt*oe.getoffsetX(xn),Zt,ni,_,Te,ke,M.segment,li,Ei,ue,O,We,mt,gt));St.push(bi.last)}else{if(T&&!_){const li=Xi(ke,F,gt).point,Ei=M.lineStartIndex+M.segment+1,bi=new i.pointGeometry(ue.getx(Ei),ue.gety(Ei)),Hi=Xi(bi,F,gt),xi=Hi.signedDistanceFromCamera>0?Hi.point:Ot(ke,bi,li,1,F,gt),xn=Ii(M.writingMode,li,xi,bt);if(xn)return xn}const zt=vi(Vt*oe.getoffsetX(M.glyphStartIndex),Zt,ni,_,Te,ke,M.segment,M.lineStartIndex,M.lineStartIndex+M.lineLength,ue,O,We,mt,gt);if(!zt)return{notEnoughRoom:!0};St=[zt]}for(const zt of St)i.addDynamicAttributes(ve,zt.point,zt.angle);return{}}function Ot(M,h,_,T,F,O){const K=Xi(M.add(M.sub(h)._unit()),F,O).point,oe=_.sub(K);return _.add(oe._mult(T/oe.mag()))}function vi(M,h,_,T,F,O,K,oe,ue,ve,Te,ke,We,bt){const mt=T?M-h:M+h;let gt=mt>0?1:-1,Vt=0;T&&(gt*=-1,Vt=Math.PI),gt<0&&(Vt+=Math.PI);let Zt=gt>0?oe+K:oe+K+1,ni=F,St=F,zt=0,li=0;const Ei=Math.abs(mt),bi=[];for(;zt+li<=Ei;){if(Zt+=gt,Zt<oe||Zt>=ue)return null;if(St=ni,bi.push(ni),ni=ke[Zt],ni===void 0){const Bn=new i.pointGeometry(ve.getx(Zt),ve.gety(Zt)),tr=Xi(Bn,Te,bt);if(tr.signedDistanceFromCamera>0)ni=ke[Zt]=tr.point;else{const ur=Zt-gt;ni=Ot(zt===0?O:new i.pointGeometry(ve.getx(ur),ve.gety(ur)),Bn,St,Ei-zt+1,Te,bt)}}zt+=li,li=St.dist(ni)}const Hi=(Ei-zt)/li,xi=ni.sub(St),xn=xi.mult(Hi)._add(St);xn._add(xi._unit()._perp()._mult(_*gt));const cn=Vt+Math.atan2(ni.y-St.y,ni.x-St.x);return bi.push(xn),{point:xn,angle:We?cn:0,path:bi}}const Wi=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ui(M,h){for(let _=0;_<M;_++){const T=h.length;h.resize(T+4),h.float32.set(Wi,3*T)}}function Pn(M,h,_){const T=h[0],F=h[1];return M[0]=_[0]*T+_[4]*F+_[12],M[1]=_[1]*T+_[5]*F+_[13],M[3]=_[3]*T+_[7]*F+_[15],M}const qn=100;class Hr{constructor(h,_=new at(h.width+200,h.height+200,25),T=new at(h.width+200,h.height+200,25)){this.transform=h,this.grid=_,this.ignoredGrid=T,this.pitchfactor=Math.cos(h._pitch)*h.cameraToCenterDistance,this.screenRightBoundary=h.width+qn,this.screenBottomBoundary=h.height+qn,this.gridRightBoundary=h.width+200,this.gridBottomBoundary=h.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(h,_,T,F,O,K){const oe=this.projectAndGetPerspectiveRatio(F,h.anchorPointX,h.anchorPointY,K),ue=T*oe.perspectiveRatio,ve=h.x1*ue+oe.point.x,Te=h.y1*ue+oe.point.y,ke=h.x2*ue+oe.point.x,We=h.y2*ue+oe.point.y;return!this.isInsideGrid(ve,Te,ke,We)||_!=="always"&&this.grid.hitTest(ve,Te,ke,We,_,O)||oe.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[ve,Te,ke,We],offscreen:this.isOffscreen(ve,Te,ke,We)}}placeCollisionCircles(h,_,T,F,O,K,oe,ue,ve,Te,ke,We,bt,mt){const gt=[],Vt=new i.pointGeometry(_.anchorX,_.anchorY),Zt=Xi(Vt,K,mt),ni=on(this.transform.cameraToCenterDistance,Zt.signedDistanceFromCamera),St=(Te?O/ni:O*ni)/i.ONE_EM,zt=Xi(Vt,oe,mt).point,li=nr(St,F,_.lineOffsetX*St,_.lineOffsetY*St,!1,zt,Vt,_,T,oe,{},!1,mt);let Ei=!1,bi=!1,Hi=!0;if(li){const xi=.5*We*ni+bt,xn=new i.pointGeometry(-100,-100),cn=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Bn=new en,tr=li.first,ur=li.last;let Un=[];for(let Cr=tr.path.length-1;Cr>=1;Cr--)Un.push(tr.path[Cr]);for(let Cr=1;Cr<ur.path.length;Cr++)Un.push(ur.path[Cr]);const Lr=2.5*xi;if(ue){const Cr=Un.map(Er=>Xi(Er,ue,mt));Un=Cr.some(Er=>Er.signedDistanceFromCamera<=0)?[]:Cr.map(Er=>Er.point)}let Rr=[];if(Un.length>0){const Cr=Un[0].clone(),Er=Un[0].clone();for(let Gr=1;Gr<Un.length;Gr++)Cr.x=Math.min(Cr.x,Un[Gr].x),Cr.y=Math.min(Cr.y,Un[Gr].y),Er.x=Math.max(Er.x,Un[Gr].x),Er.y=Math.max(Er.y,Un[Gr].y);Rr=Cr.x>=xn.x&&Er.x<=cn.x&&Cr.y>=xn.y&&Er.y<=cn.y?[Un]:Er.x<xn.x||Cr.x>cn.x||Er.y<xn.y||Cr.y>cn.y?[]:i.clipLine([Un],xn.x,xn.y,cn.x,cn.y)}for(const Cr of Rr){Bn.reset(Cr,.25*xi);let Er=0;Er=Bn.length<=.5*xi?1:Math.ceil(Bn.paddedLength/Lr)+1;for(let Gr=0;Gr<Er;Gr++){const js=Gr/Math.max(Er-1,1),wa=Bn.lerp(js),Aa=wa.x+qn,ba=wa.y+qn;gt.push(Aa,ba,xi,0);const ja=Aa-xi,Wo=ba-xi,mo=Aa+xi,Ba=ba+xi;if(Hi=Hi&&this.isOffscreen(ja,Wo,mo,Ba),bi=bi||this.isInsideGrid(ja,Wo,mo,Ba),h!=="always"&&this.grid.hitTestCircle(Aa,ba,xi,h,ke)&&(Ei=!0,!ve))return{circles:[],offscreen:!1,collisionDetected:Ei}}}}return{circles:!ve&&Ei||!bi||ni<this.perspectiveRatioCutoff?[]:gt,offscreen:Hi,collisionDetected:Ei}}queryRenderedSymbols(h){if(h.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const _=[];let T=1/0,F=1/0,O=-1/0,K=-1/0;for(const Te of h){const ke=new i.pointGeometry(Te.x+qn,Te.y+qn);T=Math.min(T,ke.x),F=Math.min(F,ke.y),O=Math.max(O,ke.x),K=Math.max(K,ke.y),_.push(ke)}const oe=this.grid.query(T,F,O,K).concat(this.ignoredGrid.query(T,F,O,K)),ue={},ve={};for(const Te of oe){const ke=Te.key;if(ue[ke.bucketInstanceId]===void 0&&(ue[ke.bucketInstanceId]={}),ue[ke.bucketInstanceId][ke.featureIndex])continue;const We=[new i.pointGeometry(Te.x1,Te.y1),new i.pointGeometry(Te.x2,Te.y1),new i.pointGeometry(Te.x2,Te.y2),new i.pointGeometry(Te.x1,Te.y2)];i.polygonIntersectsPolygon(_,We)&&(ue[ke.bucketInstanceId][ke.featureIndex]=!0,ve[ke.bucketInstanceId]===void 0&&(ve[ke.bucketInstanceId]=[]),ve[ke.bucketInstanceId].push(ke.featureIndex))}return ve}insertCollisionBox(h,_,T,F,O,K){(T?this.ignoredGrid:this.grid).insert({bucketInstanceId:F,featureIndex:O,collisionGroupID:K,overlapMode:_},h[0],h[1],h[2],h[3])}insertCollisionCircles(h,_,T,F,O,K){const oe=T?this.ignoredGrid:this.grid,ue={bucketInstanceId:F,featureIndex:O,collisionGroupID:K,overlapMode:_};for(let ve=0;ve<h.length;ve+=4)oe.insertCircle(ue,h[ve],h[ve+1],h[ve+2])}projectAndGetPerspectiveRatio(h,_,T,F){let O;return F?(O=[_,T,F(_,T),1],i.transformMat4(O,O,h)):(O=[_,T,0,1],Pn(O,O,h)),{point:new i.pointGeometry((O[0]/O[3]+1)/2*this.transform.width+qn,(-O[1]/O[3]+1)/2*this.transform.height+qn),perspectiveRatio:.5+this.transform.cameraToCenterDistance/O[3]*.5}}isOffscreen(h,_,T,F){return T<qn||h>=this.screenRightBoundary||F<qn||_>this.screenBottomBoundary}isInsideGrid(h,_,T,F){return T>=0&&h<this.gridRightBoundary&&F>=0&&_<this.gridBottomBoundary}getViewportMatrix(){const h=i.identity([]);return i.translate(h,h,[-100,-100,0]),h}}function fr(M,h,_){return h*(i.EXTENT/(M.tileSize*Math.pow(2,_-M.tileID.overscaledZ)))}class kr{constructor(h,_,T,F){this.opacity=h?Math.max(0,Math.min(1,h.opacity+(h.placed?_:-_))):F&&T?1:0,this.placed=T}isHidden(){return this.opacity===0&&!this.placed}}class Qn{constructor(h,_,T,F,O){this.text=new kr(h?h.text:null,_,T,O),this.icon=new kr(h?h.icon:null,_,F,O)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class zs{constructor(h,_,T){this.text=h,this.icon=_,this.skipFade=T}}class ot{constructor(){this.invProjMatrix=i.create(),this.viewportMatrix=i.create(),this.circles=[]}}class Ee{constructor(h,_,T,F,O){this.bucketInstanceId=h,this.featureIndex=_,this.sourceLayerIndex=T,this.bucketIndex=F,this.tileID=O}}class Ue{constructor(h){this.crossSourceCollisions=h,this.maxGroupID=0,this.collisionGroups={}}get(h){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[h]){const _=++this.maxGroupID;this.collisionGroups[h]={ID:_,predicate:T=>T.collisionGroupID===_}}return this.collisionGroups[h]}}function ct(M,h,_,T,F){const{horizontalAlign:O,verticalAlign:K}=i.getAnchorAlignment(M),oe=-(O-.5)*h,ue=-(K-.5)*_,ve=i.evaluateVariableOffset(M,T);return new i.pointGeometry(oe+ve[0]*F,ue+ve[1]*F)}function wt(M,h,_,T,F,O){const{x1:K,x2:oe,y1:ue,y2:ve,anchorPointX:Te,anchorPointY:ke}=M,We=new i.pointGeometry(h,_);return T&&We._rotate(F?O:-O),{x1:K+We.x,y1:ue+We.y,x2:oe+We.x,y2:ve+We.y,anchorPointX:Te,anchorPointY:ke}}class X{constructor(h,_,T,F,O){this.transform=h.clone(),this.terrain=_,this.collisionIndex=new Hr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=T,this.retainedQueryData={},this.collisionGroups=new Ue(F),this.collisionCircleArrays={},this.prevPlacement=O,O&&(O.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(h,_,T,F){const O=T.getBucket(_),K=T.latestFeatureIndex;if(!O||!K||_.id!==O.layerIds[0])return;const oe=T.collisionBoxArray,ue=O.layers[0].layout,ve=Math.pow(2,this.transform.zoom-T.tileID.overscaledZ),Te=T.tileSize/i.EXTENT,ke=this.transform.calculatePosMatrix(T.tileID.toUnwrapped()),We=ue.get("text-pitch-alignment")==="map",bt=ue.get("text-rotation-alignment")==="map",mt=fr(T,1,this.transform.zoom),gt=ii(ke,We,bt,this.transform,mt);let Vt=null;if(We){const ni=hn(ke,We,bt,this.transform,mt);Vt=i.multiply([],this.transform.labelPlaneMatrix,ni)}this.retainedQueryData[O.bucketInstanceId]=new Ee(O.bucketInstanceId,K,O.sourceLayerIndex,O.index,T.tileID);const Zt={bucket:O,layout:ue,posMatrix:ke,textLabelPlaneMatrix:gt,labelToScreenMatrix:Vt,scale:ve,textPixelRatio:Te,holdingForFade:T.holdingForFade(),collisionBoxArray:oe,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(O.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(O.sourceID)};if(F)for(const ni of O.sortKeyRanges){const{sortKey:St,symbolInstanceStart:zt,symbolInstanceEnd:li}=ni;h.push({sortKey:St,symbolInstanceStart:zt,symbolInstanceEnd:li,parameters:Zt})}else h.push({symbolInstanceStart:0,symbolInstanceEnd:O.symbolInstances.length,parameters:Zt})}attemptAnchorPlacement(h,_,T,F,O,K,oe,ue,ve,Te,ke,We,bt,mt,gt,Vt){const Zt=[We.textOffset0,We.textOffset1],ni=ct(h,T,F,Zt,O),St=this.collisionIndex.placeCollisionBox(wt(_,ni.x,ni.y,K,oe,this.transform.angle),ke,ue,ve,Te.predicate,Vt);if((!gt||this.collisionIndex.placeCollisionBox(wt(gt,ni.x,ni.y,K,oe,this.transform.angle),ke,ue,ve,Te.predicate,Vt).box.length!==0)&&St.box.length>0){let zt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[We.crossTileID]&&this.prevPlacement.placements[We.crossTileID]&&this.prevPlacement.placements[We.crossTileID].text&&(zt=this.prevPlacement.variableOffsets[We.crossTileID].anchor),We.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[We.crossTileID]={textOffset:Zt,width:T,height:F,anchor:h,textBoxScale:O,prevAnchor:zt},this.markUsedJustification(bt,h,We,mt),bt.allowVerticalPlacement&&(this.markUsedOrientation(bt,mt,We),this.placedOrientations[We.crossTileID]=mt),{shift:ni,placedGlyphBoxes:St}}}placeLayerBucketPart(h,_,T){const{bucket:F,layout:O,posMatrix:K,textLabelPlaneMatrix:oe,labelToScreenMatrix:ue,textPixelRatio:ve,holdingForFade:Te,collisionBoxArray:ke,partiallyEvaluatedTextSize:We,collisionGroup:bt}=h.parameters,mt=O.get("text-optional"),gt=O.get("icon-optional"),Vt=i.getOverlapMode(O,"text-overlap","text-allow-overlap"),Zt=Vt==="always",ni=i.getOverlapMode(O,"icon-overlap","icon-allow-overlap"),St=ni==="always",zt=O.get("text-rotation-alignment")==="map",li=O.get("text-pitch-alignment")==="map",Ei=O.get("icon-text-fit")!=="none",bi=O.get("symbol-z-order")==="viewport-y",Hi=Zt&&(St||!F.hasIconData()||gt),xi=St&&(Zt||!F.hasTextData()||mt);!F.collisionArrays&&ke&&F.deserializeCollisionBoxes(ke);const xn=(cn,Bn)=>{if(_[cn.crossTileID])return;if(Te)return void(this.placements[cn.crossTileID]=new zs(!1,!1,!1));let tr=!1,ur=!1,Un=!0,Lr=null,Rr={box:null,offscreen:null},Cr={box:null,offscreen:null},Er=null,Gr=null,js=null,wa=0,Aa=0,ba=0;Bn.textFeatureIndex?wa=Bn.textFeatureIndex:cn.useRuntimeCollisionCircles&&(wa=cn.featureIndex),Bn.verticalTextFeatureIndex&&(Aa=Bn.verticalTextFeatureIndex);const ja=this.retainedQueryData[F.bucketInstanceId].tileID,Wo=this.terrain?(x,a)=>this.terrain.getElevation(ja,x,a):null;for(const x of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const a=Bn[x];a&&(a.elevation=Wo?Wo(a.anchorPointX,a.anchorPointY):0)}const mo=Bn.textBox;if(mo){const x=m=>{let b=i.WritingMode.horizontal;if(F.allowVerticalPlacement&&!m&&this.prevPlacement){const S=this.prevPlacement.placedOrientations[cn.crossTileID];S&&(this.placedOrientations[cn.crossTileID]=S,b=S,this.markUsedOrientation(F,b,cn))}return b},a=(m,b)=>{if(F.allowVerticalPlacement&&cn.numVerticalGlyphVertices>0&&Bn.verticalTextBox){for(const S of F.writingModes)if(S===i.WritingMode.vertical?(Rr=b(),Cr=Rr):Rr=m(),Rr&&Rr.box&&Rr.box.length)break}else Rr=m()};if(O.get("text-variable-anchor")){let m=O.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[cn.crossTileID]){const P=this.prevPlacement.variableOffsets[cn.crossTileID];m.indexOf(P.anchor)>0&&(m=m.filter(H=>H!==P.anchor),m.unshift(P.anchor))}const b=(P,H,W)=>{const ee=P.x2-P.x1,pe=P.y2-P.y1,fe=cn.textBoxScale,Se=Ei&&ni==="never"?H:null;let Qe={box:[],offscreen:!1};const rt=Vt!=="never"?2*m.length:m.length;for(let nt=0;nt<rt;++nt){const lt=this.attemptAnchorPlacement(m[nt%m.length],P,ee,pe,fe,zt,li,ve,K,bt,nt>=m.length?Vt:"never",cn,F,W,Se,Wo);if(lt&&(Qe=lt.placedGlyphBoxes,Qe&&Qe.box&&Qe.box.length)){tr=!0,Lr=lt.shift;break}}return Qe};a(()=>b(mo,Bn.iconBox,i.WritingMode.horizontal),()=>{const P=Bn.verticalTextBox;return F.allowVerticalPlacement&&!(Rr&&Rr.box&&Rr.box.length)&&cn.numVerticalGlyphVertices>0&&P?b(P,Bn.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null}}),Rr&&(tr=Rr.box,Un=Rr.offscreen);const S=x(Rr&&Rr.box);if(!tr&&this.prevPlacement){const P=this.prevPlacement.variableOffsets[cn.crossTileID];P&&(this.variableOffsets[cn.crossTileID]=P,this.markUsedJustification(F,P.anchor,cn,S))}}else{const m=(b,S)=>{const P=this.collisionIndex.placeCollisionBox(b,Vt,ve,K,bt.predicate,Wo);return P&&P.box&&P.box.length&&(this.markUsedOrientation(F,S,cn),this.placedOrientations[cn.crossTileID]=S),P};a(()=>m(mo,i.WritingMode.horizontal),()=>{const b=Bn.verticalTextBox;return F.allowVerticalPlacement&&cn.numVerticalGlyphVertices>0&&b?m(b,i.WritingMode.vertical):{box:null,offscreen:null}}),x(Rr&&Rr.box&&Rr.box.length)}}if(Er=Rr,tr=Er&&Er.box&&Er.box.length>0,Un=Er&&Er.offscreen,cn.useRuntimeCollisionCircles){const x=F.text.placedSymbolArray.get(cn.centerJustifiedTextSymbolIndex),a=i.evaluateSizeForFeature(F.textSizeData,We,x),m=O.get("text-padding");Gr=this.collisionIndex.placeCollisionCircles(Vt,x,F.lineVertexArray,F.glyphOffsetArray,a,K,oe,ue,T,li,bt.predicate,cn.collisionCircleDiameter,m,Wo),Gr.circles.length&&Gr.collisionDetected&&!T&&i.warnOnce("Collisions detected, but collision boxes are not shown"),tr=Zt||Gr.circles.length>0&&!Gr.collisionDetected,Un=Un&&Gr.offscreen}if(Bn.iconFeatureIndex&&(ba=Bn.iconFeatureIndex),Bn.iconBox){const x=a=>{const m=Ei&&Lr?wt(a,Lr.x,Lr.y,zt,li,this.transform.angle):a;return this.collisionIndex.placeCollisionBox(m,ni,ve,K,bt.predicate,Wo)};Cr&&Cr.box&&Cr.box.length&&Bn.verticalIconBox?(js=x(Bn.verticalIconBox),ur=js.box.length>0):(js=x(Bn.iconBox),ur=js.box.length>0),Un=Un&&js.offscreen}const Ba=mt||cn.numHorizontalGlyphVertices===0&&cn.numVerticalGlyphVertices===0,$l=gt||cn.numIconVertices===0;if(Ba||$l?$l?Ba||(ur=ur&&tr):tr=ur&&tr:ur=tr=ur&&tr,tr&&Er&&Er.box&&this.collisionIndex.insertCollisionBox(Er.box,Vt,O.get("text-ignore-placement"),F.bucketInstanceId,Cr&&Cr.box&&Aa?Aa:wa,bt.ID),ur&&js&&this.collisionIndex.insertCollisionBox(js.box,ni,O.get("icon-ignore-placement"),F.bucketInstanceId,ba,bt.ID),Gr&&(tr&&this.collisionIndex.insertCollisionCircles(Gr.circles,Vt,O.get("text-ignore-placement"),F.bucketInstanceId,wa,bt.ID),T)){const x=F.bucketInstanceId;let a=this.collisionCircleArrays[x];a===void 0&&(a=this.collisionCircleArrays[x]=new ot);for(let m=0;m<Gr.circles.length;m+=4)a.circles.push(Gr.circles[m+0]),a.circles.push(Gr.circles[m+1]),a.circles.push(Gr.circles[m+2]),a.circles.push(Gr.collisionDetected?1:0)}if(cn.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(F.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[cn.crossTileID]=new zs(tr||Hi,ur||xi,Un||F.justReloaded),_[cn.crossTileID]=!0};if(bi){if(h.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const cn=F.getSortedSymbolIndexes(this.transform.angle);for(let Bn=cn.length-1;Bn>=0;--Bn){const tr=cn[Bn];xn(F.symbolInstances.get(tr),F.collisionArrays[tr])}}else for(let cn=h.symbolInstanceStart;cn<h.symbolInstanceEnd;cn++)xn(F.symbolInstances.get(cn),F.collisionArrays[cn]);if(T&&F.bucketInstanceId in this.collisionCircleArrays){const cn=this.collisionCircleArrays[F.bucketInstanceId];i.invert(cn.invProjMatrix,K),cn.viewportMatrix=this.collisionIndex.getViewportMatrix()}F.justReloaded=!1}markUsedJustification(h,_,T,F){let O;O=F===i.WritingMode.vertical?T.verticalPlacedTextSymbolIndex:{left:T.leftJustifiedTextSymbolIndex,center:T.centerJustifiedTextSymbolIndex,right:T.rightJustifiedTextSymbolIndex}[i.getAnchorJustification(_)];const K=[T.leftJustifiedTextSymbolIndex,T.centerJustifiedTextSymbolIndex,T.rightJustifiedTextSymbolIndex,T.verticalPlacedTextSymbolIndex];for(const oe of K)oe>=0&&(h.text.placedSymbolArray.get(oe).crossTileID=O>=0&&oe!==O?0:T.crossTileID)}markUsedOrientation(h,_,T){const F=_===i.WritingMode.horizontal||_===i.WritingMode.horizontalOnly?_:0,O=_===i.WritingMode.vertical?_:0,K=[T.leftJustifiedTextSymbolIndex,T.centerJustifiedTextSymbolIndex,T.rightJustifiedTextSymbolIndex];for(const oe of K)h.text.placedSymbolArray.get(oe).placedOrientation=F;T.verticalPlacedTextSymbolIndex&&(h.text.placedSymbolArray.get(T.verticalPlacedTextSymbolIndex).placedOrientation=O)}commit(h){this.commitTime=h,this.zoomAtLastRecencyCheck=this.transform.zoom;const _=this.prevPlacement;let T=!1;this.prevZoomAdjustment=_?_.zoomAdjustment(this.transform.zoom):0;const F=_?_.symbolFadeChange(h):1,O=_?_.opacities:{},K=_?_.variableOffsets:{},oe=_?_.placedOrientations:{};for(const ue in this.placements){const ve=this.placements[ue],Te=O[ue];Te?(this.opacities[ue]=new Qn(Te,F,ve.text,ve.icon),T=T||ve.text!==Te.text.placed||ve.icon!==Te.icon.placed):(this.opacities[ue]=new Qn(null,F,ve.text,ve.icon,ve.skipFade),T=T||ve.text||ve.icon)}for(const ue in O){const ve=O[ue];if(!this.opacities[ue]){const Te=new Qn(ve,F,!1,!1);Te.isHidden()||(this.opacities[ue]=Te,T=T||ve.text.placed||ve.icon.placed)}}for(const ue in K)this.variableOffsets[ue]||!this.opacities[ue]||this.opacities[ue].isHidden()||(this.variableOffsets[ue]=K[ue]);for(const ue in oe)this.placedOrientations[ue]||!this.opacities[ue]||this.opacities[ue].isHidden()||(this.placedOrientations[ue]=oe[ue]);if(_&&_.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");T?this.lastPlacementChangeTime=h:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=_?_.lastPlacementChangeTime:h)}updateLayerOpacities(h,_){const T={};for(const F of _){const O=F.getBucket(h);O&&F.latestFeatureIndex&&h.id===O.layerIds[0]&&this.updateBucketOpacities(O,T,F.collisionBoxArray)}}updateBucketOpacities(h,_,T){h.hasTextData()&&h.text.opacityVertexArray.clear(),h.hasIconData()&&h.icon.opacityVertexArray.clear(),h.hasIconCollisionBoxData()&&h.iconCollisionBox.collisionVertexArray.clear(),h.hasTextCollisionBoxData()&&h.textCollisionBox.collisionVertexArray.clear();const F=h.layers[0].layout,O=new Qn(null,0,!1,!1,!0),K=F.get("text-allow-overlap"),oe=F.get("icon-allow-overlap"),ue=F.get("text-variable-anchor"),ve=F.get("text-rotation-alignment")==="map",Te=F.get("text-pitch-alignment")==="map",ke=F.get("icon-text-fit")!=="none",We=new Qn(null,0,K&&(oe||!h.hasIconData()||F.get("icon-optional")),oe&&(K||!h.hasTextData()||F.get("text-optional")),!0);!h.collisionArrays&&T&&(h.hasIconCollisionBoxData()||h.hasTextCollisionBoxData())&&h.deserializeCollisionBoxes(T);const bt=(mt,gt,Vt)=>{for(let Zt=0;Zt<gt/4;Zt++)mt.opacityVertexArray.emplaceBack(Vt)};for(let mt=0;mt<h.symbolInstances.length;mt++){const gt=h.symbolInstances.get(mt),{numHorizontalGlyphVertices:Vt,numVerticalGlyphVertices:Zt,crossTileID:ni}=gt;let St=this.opacities[ni];_[ni]?St=O:St||(St=We,this.opacities[ni]=St),_[ni]=!0;const zt=gt.numIconVertices>0,li=this.placedOrientations[gt.crossTileID],Ei=li===i.WritingMode.vertical,bi=li===i.WritingMode.horizontal||li===i.WritingMode.horizontalOnly;if(Vt>0||Zt>0){const Hi=pt(St.text);bt(h.text,Vt,Ei?Lt:Hi),bt(h.text,Zt,bi?Lt:Hi);const xi=St.text.isHidden();[gt.rightJustifiedTextSymbolIndex,gt.centerJustifiedTextSymbolIndex,gt.leftJustifiedTextSymbolIndex].forEach(Bn=>{Bn>=0&&(h.text.placedSymbolArray.get(Bn).hidden=xi||Ei?1:0)}),gt.verticalPlacedTextSymbolIndex>=0&&(h.text.placedSymbolArray.get(gt.verticalPlacedTextSymbolIndex).hidden=xi||bi?1:0);const xn=this.variableOffsets[gt.crossTileID];xn&&this.markUsedJustification(h,xn.anchor,gt,li);const cn=this.placedOrientations[gt.crossTileID];cn&&(this.markUsedJustification(h,"left",gt,cn),this.markUsedOrientation(h,cn,gt))}if(zt){const Hi=pt(St.icon),xi=!(ke&>.verticalPlacedIconSymbolIndex&&Ei);gt.placedIconSymbolIndex>=0&&(bt(h.icon,gt.numIconVertices,xi?Hi:Lt),h.icon.placedSymbolArray.get(gt.placedIconSymbolIndex).hidden=St.icon.isHidden()),gt.verticalPlacedIconSymbolIndex>=0&&(bt(h.icon,gt.numVerticalIconVertices,xi?Lt:Hi),h.icon.placedSymbolArray.get(gt.verticalPlacedIconSymbolIndex).hidden=St.icon.isHidden())}if(h.hasIconCollisionBoxData()||h.hasTextCollisionBoxData()){const Hi=h.collisionArrays[mt];if(Hi){let xi=new i.pointGeometry(0,0);if(Hi.textBox||Hi.verticalTextBox){let cn=!0;if(ue){const Bn=this.variableOffsets[ni];Bn?(xi=ct(Bn.anchor,Bn.width,Bn.height,Bn.textOffset,Bn.textBoxScale),ve&&xi._rotate(Te?this.transform.angle:-this.transform.angle)):cn=!1}Hi.textBox&&j(h.textCollisionBox.collisionVertexArray,St.text.placed,!cn||Ei,xi.x,xi.y),Hi.verticalTextBox&&j(h.textCollisionBox.collisionVertexArray,St.text.placed,!cn||bi,xi.x,xi.y)}const xn=Boolean(!bi&&Hi.verticalIconBox);Hi.iconBox&&j(h.iconCollisionBox.collisionVertexArray,St.icon.placed,xn,ke?xi.x:0,ke?xi.y:0),Hi.verticalIconBox&&j(h.iconCollisionBox.collisionVertexArray,St.icon.placed,!xn,ke?xi.x:0,ke?xi.y:0)}}}if(h.sortFeatures(this.transform.angle),this.retainedQueryData[h.bucketInstanceId]&&(this.retainedQueryData[h.bucketInstanceId].featureSortOrder=h.featureSortOrder),h.hasTextData()&&h.text.opacityVertexBuffer&&h.text.opacityVertexBuffer.updateData(h.text.opacityVertexArray),h.hasIconData()&&h.icon.opacityVertexBuffer&&h.icon.opacityVertexBuffer.updateData(h.icon.opacityVertexArray),h.hasIconCollisionBoxData()&&h.iconCollisionBox.collisionVertexBuffer&&h.iconCollisionBox.collisionVertexBuffer.updateData(h.iconCollisionBox.collisionVertexArray),h.hasTextCollisionBoxData()&&h.textCollisionBox.collisionVertexBuffer&&h.textCollisionBox.collisionVertexBuffer.updateData(h.textCollisionBox.collisionVertexArray),h.text.opacityVertexArray.length!==h.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${h.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${h.text.layoutVertexArray.length}) / 4`);if(h.icon.opacityVertexArray.length!==h.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${h.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${h.icon.layoutVertexArray.length}) / 4`);if(h.bucketInstanceId in this.collisionCircleArrays){const mt=this.collisionCircleArrays[h.bucketInstanceId];h.placementInvProjMatrix=mt.invProjMatrix,h.placementViewportMatrix=mt.viewportMatrix,h.collisionCircleArray=mt.circles,delete this.collisionCircleArrays[h.bucketInstanceId]}}symbolFadeChange(h){return this.fadeDuration===0?1:(h-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(h){return Math.max(0,(this.transform.zoom-h)/1.5)}hasTransitions(h){return this.stale||h-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(h,_){const T=this.zoomAtLastRecencyCheck===_?1-this.zoomAdjustment(_):1;return this.zoomAtLastRecencyCheck=_,this.commitTime+this.fadeDuration*T>h}setStale(){this.stale=!0}}function j(M,h,_,T,F){M.emplaceBack(h?1:0,_?1:0,T||0,F||0),M.emplaceBack(h?1:0,_?1:0,T||0,F||0),M.emplaceBack(h?1:0,_?1:0,T||0,F||0),M.emplaceBack(h?1:0,_?1:0,T||0,F||0)}const ie=Math.pow(2,25),ne=Math.pow(2,24),de=Math.pow(2,17),Re=Math.pow(2,16),tt=Math.pow(2,9),He=Math.pow(2,8),Je=Math.pow(2,1);function pt(M){if(M.opacity===0&&!M.placed)return 0;if(M.opacity===1&&M.placed)return 4294967295;const h=M.placed?1:0,_=Math.floor(127*M.opacity);return _*ie+h*ne+_*de+h*Re+_*tt+h*He+_*Je+h}const Lt=0;class jt{constructor(h){this._sortAcrossTiles=h.layout.get("symbol-z-order")!=="viewport-y"&&!h.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(h,_,T,F,O){const K=this._bucketParts;for(;this._currentTileIndex<h.length;)if(_.getBucketParts(K,F,h[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,O())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,K.sort((oe,ue)=>oe.sortKey-ue.sortKey));this._currentPartIndex<K.length;)if(_.placeLayerBucketPart(K[this._currentPartIndex],this._seenCrossTileIDs,T),this._currentPartIndex++,O())return!0;return!1}}class Gt{constructor(h,_,T,F,O,K,oe,ue){this.placement=new X(h,_,K,oe,ue),this._currentPlacementIndex=T.length-1,this._forceFullPlacement=F,this._showCollisionBoxes=O,this._done=!1}isDone(){return this._done}continuePlacement(h,_,T){const F=i.exported.now(),O=()=>{const K=i.exported.now()-F;return!this._forceFullPlacement&&K>2};for(;this._currentPlacementIndex>=0;){const K=_[h[this._currentPlacementIndex]],oe=this.placement.collisionIndex.transform.zoom;if(K.type==="symbol"&&(!K.minzoom||K.minzoom<=oe)&&(!K.maxzoom||K.maxzoom>oe)){if(this._inProgressLayer||(this._inProgressLayer=new jt(K)),this._inProgressLayer.continuePlacement(T[K.source],this.placement,this._showCollisionBoxes,K,O))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(h){return this.placement.commit(h),this.placement}}const ki=512/i.EXTENT/2;class wi{constructor(h,_,T){this.tileID=h,this.indexedSymbolInstances={},this.bucketInstanceId=T;for(let F=0;F<_.length;F++){const O=_.get(F),K=O.key;this.indexedSymbolInstances[K]||(this.indexedSymbolInstances[K]=[]),this.indexedSymbolInstances[K].push({crossTileID:O.crossTileID,coord:this.getScaledCoordinates(O,h)})}}getScaledCoordinates(h,_){const T=ki/Math.pow(2,_.canonical.z-this.tileID.canonical.z);return{x:Math.floor((_.canonical.x*i.EXTENT+h.anchorX)*T),y:Math.floor((_.canonical.y*i.EXTENT+h.anchorY)*T)}}findMatches(h,_,T){const F=this.tileID.canonical.z<_.canonical.z?1:Math.pow(2,this.tileID.canonical.z-_.canonical.z);for(let O=0;O<h.length;O++){const K=h.get(O);if(K.crossTileID)continue;const oe=this.indexedSymbolInstances[K.key];if(!oe)continue;const ue=this.getScaledCoordinates(K,_);for(const ve of oe)if(Math.abs(ve.coord.x-ue.x)<=F&&Math.abs(ve.coord.y-ue.y)<=F&&!T[ve.crossTileID]){T[ve.crossTileID]=!0,K.crossTileID=ve.crossTileID;break}}}}class Oi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yi{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(h){const _=Math.round((h-this.lng)/360);if(_!==0)for(const T in this.indexes){const F=this.indexes[T],O={};for(const K in F){const oe=F[K];oe.tileID=oe.tileID.unwrapTo(oe.tileID.wrap+_),O[oe.tileID.key]=oe}this.indexes[T]=O}this.lng=h}addBucket(h,_,T){if(this.indexes[h.overscaledZ]&&this.indexes[h.overscaledZ][h.key]){if(this.indexes[h.overscaledZ][h.key].bucketInstanceId===_.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(h.overscaledZ,this.indexes[h.overscaledZ][h.key])}for(let O=0;O<_.symbolInstances.length;O++)_.symbolInstances.get(O).crossTileID=0;this.usedCrossTileIDs[h.overscaledZ]||(this.usedCrossTileIDs[h.overscaledZ]={});const F=this.usedCrossTileIDs[h.overscaledZ];for(const O in this.indexes){const K=this.indexes[O];if(Number(O)>h.overscaledZ)for(const oe in K){const ue=K[oe];ue.tileID.isChildOf(h)&&ue.findMatches(_.symbolInstances,h,F)}else{const oe=K[h.scaledTo(Number(O)).key];oe&&oe.findMatches(_.symbolInstances,h,F)}}for(let O=0;O<_.symbolInstances.length;O++){const K=_.symbolInstances.get(O);K.crossTileID||(K.crossTileID=T.generate(),F[K.crossTileID]=!0)}return this.indexes[h.overscaledZ]===void 0&&(this.indexes[h.overscaledZ]={}),this.indexes[h.overscaledZ][h.key]=new wi(h,_.symbolInstances,_.bucketInstanceId),!0}removeBucketCrossTileIDs(h,_){for(const T in _.indexedSymbolInstances)for(const F of _.indexedSymbolInstances[T])delete this.usedCrossTileIDs[h][F.crossTileID]}removeStaleBuckets(h){let _=!1;for(const T in this.indexes){const F=this.indexes[T];for(const O in F)h[F[O].bucketInstanceId]||(this.removeBucketCrossTileIDs(T,F[O]),delete F[O],_=!0)}return _}}class tn{constructor(){this.layerIndexes={},this.crossTileIDs=new Oi,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(h,_,T){let F=this.layerIndexes[h.id];F===void 0&&(F=this.layerIndexes[h.id]=new Yi);let O=!1;const K={};F.handleWrapJump(T);for(const oe of _){const ue=oe.getBucket(h);ue&&h.id===ue.layerIds[0]&&(ue.bucketInstanceId||(ue.bucketInstanceId=++this.maxBucketInstanceId),F.addBucket(oe.tileID,ue,this.crossTileIDs)&&(O=!0),K[ue.bucketInstanceId]=!0)}return F.removeStaleBuckets(K)&&(O=!0),O}pruneUnusedLayers(h){const _={};h.forEach(T=>{_[T]=!0});for(const T in this.layerIndexes)_[T]||delete this.layerIndexes[T]}}var rr=i.createLayout([{name:"a_pos",type:"Int16",components:2}]);class yn extends i.Evented{constructor(h){super(),this.sourceCache=h,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=h._cache.max,h.usedForTerrain=!0,h.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const h in this._tiles){const _=this._tiles[h];_.textures.forEach(T=>T.destroy()),_.textures=[]}}update(h,_){this.sourceCache.update(h,_),this._renderableTilesKeys=[];for(const T of h.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:_}))this._renderableTilesKeys.push(T.key),this._tiles[T.key]||(T.posMatrix=new Float64Array(16),i.ortho(T.posMatrix,0,i.EXTENT,0,i.EXTENT,0,1),this._tiles[T.key]=new Be(T,this.tileSize))}removeOutdated(h){const _={};this.renderHistory=this.renderHistory.filter((T,F)=>this.renderHistory.indexOf(T)===F).slice(0,this.renderHistorySize);for(const T of this._renderableTilesKeys)_[T]=!0;for(const T of this.renderHistory)_[T]=!0;for(const T in this._tiles)_[T]||(this._tiles[T].clearTextures(h),delete this._tiles[T])}getRenderableTiles(){return this._renderableTilesKeys.map(h=>this.getTileByID(h))}getTileByID(h){return this._tiles[h]}getTerrainCoords(h){const _={};for(const T of this._renderableTilesKeys){const F=this._tiles[T].tileID;if(F.canonical.equals(h.canonical)){const O=h.clone();O.posMatrix=new Float64Array(16),i.ortho(O.posMatrix,0,i.EXTENT,0,i.EXTENT,0,1),_[T]=O}else if(F.canonical.isChildOf(h.canonical)){const O=h.clone();O.posMatrix=new Float64Array(16);const K=F.canonical.z-h.canonical.z,oe=F.canonical.x-(F.canonical.x>>K<<K),ue=F.canonical.y-(F.canonical.y>>K<<K),ve=i.EXTENT>>K;i.ortho(O.posMatrix,0,ve,0,ve,0,1),i.translate(O.posMatrix,O.posMatrix,[-oe*ve,-ue*ve,0]),_[T]=O}else if(h.canonical.isChildOf(F.canonical)){const O=h.clone();O.posMatrix=new Float64Array(16);const K=h.canonical.z-F.canonical.z,oe=h.canonical.x-(h.canonical.x>>K<<K),ue=h.canonical.y-(h.canonical.y>>K<<K),ve=i.EXTENT>>K;i.ortho(O.posMatrix,0,i.EXTENT,0,i.EXTENT,0,1),i.translate(O.posMatrix,O.posMatrix,[oe*ve,ue*ve,0]),i.scale(O.posMatrix,O.posMatrix,[1/2**K,1/2**K,0]),_[T]=O}}return _}getSourceTile(h,_){const T=this.sourceCache._source;let F=h.overscaledZ-this.deltaZoom;if(F>T.maxzoom&&(F=T.maxzoom),F<T.minzoom)return null;this._sourceTileCache[h.key]||(this._sourceTileCache[h.key]=h.scaledTo(F).key);let O=this.sourceCache.getTileByID(this._sourceTileCache[h.key]);if((!O||!O.dem)&&_)for(;F>=T.minzoom&&(!O||!O.dem);)O=this.sourceCache.getTileByID(h.scaledTo(F--).key);return O}tilesAfterTime(h=Date.now()){return Object.values(this._tiles).filter(_=>_.timeLoaded>=h)}}class Yt{constructor(h,_,T){this.style=h,this.sourceCache=new yn(_),this.options=T,this.exaggeration=typeof T.exaggeration=="number"?T.exaggeration:1,this.elevationOffset=typeof T.elevationOffset=="number"?T.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(h,_,T,F=i.EXTENT){if(!(_>=0&&_<F&&T>=0&&T<F))return this.elevationOffset;let O=0;const K=this.getTerrainData(h);if(K.tile&&K.tile.dem){const oe=i.transformMat4$1([],[_/F*i.EXTENT,T/F*i.EXTENT],K.u_terrain_matrix),ue=[oe[0]*K.tile.dem.dim,oe[1]*K.tile.dem.dim],ve=[Math.floor(ue[0]),Math.floor(ue[1])],Te=K.tile.dem.get(ve[0],ve[1]),ke=K.tile.dem.get(ve[0],ve[1]+1),We=K.tile.dem.get(ve[0]+1,ve[1]),bt=K.tile.dem.get(ve[0]+1,ve[1]+1);O=i.number(i.number(Te,ke,ue[0]-ve[0]),i.number(We,bt,ue[0]-ve[0]),ue[1]-ve[1])}return O}rememberForRerender(h,_){for(const T in this.sourceCache._tiles){const F=this.sourceCache._tiles[T];(F.tileID.equals(_)||F.tileID.isChildOf(_))&&(h===this.sourceCache.sourceCache.id&&(F.timeLoaded=Date.now()),this._rerender[h]=this._rerender[h]||{},this._rerender[h][F.tileID.key]=!0)}}needsRerender(h,_){return this._rerender[h]&&this._rerender[h][_.key]}clearRerenderCache(){this._rerender={}}getElevation(h,_,T,F=i.EXTENT){return(this.getDEMElevation(h,_,T,F)+this.elevationOffset)*this.exaggeration}getTerrainData(h){if(!this._emptyDemTexture){const F=this.style.map.painter.context,O=new i.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Y(F,O,F.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Y(F,new i.RGBAImage({width:1,height:1}),F.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(F.gl.NEAREST,F.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=i.identity([])}const _=this.sourceCache.getSourceTile(h,!0);if(_&&_.dem&&(!_.demTexture||_.needsTerrainPrepare)){const F=this.style.map.painter.context;_.demTexture=this.style.map.painter.getTileTexture(_.dem.stride),_.demTexture?_.demTexture.update(_.dem.getPixels(),{premultiply:!1}):_.demTexture=new Y(F,_.dem.getPixels(),F.gl.RGBA,{premultiply:!1}),_.demTexture.bind(F.gl.NEAREST,F.gl.CLAMP_TO_EDGE),_.needsTerrainPrepare=!1}const T=_&&_+_.tileID.key+h.key;if(T&&!this._demMatrixCache[T]){const F=this.sourceCache.sourceCache._source.maxzoom;let O=h.canonical.z-_.tileID.canonical.z;h.overscaledZ>h.canonical.z&&(h.canonical.z>=F?O=h.canonical.z-F:i.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const K=h.canonical.x-(h.canonical.x>>O<<O),oe=h.canonical.y-(h.canonical.y>>O<<O),ue=i.fromScaling(new Float64Array(16),[1/(i.EXTENT<<O),1/(i.EXTENT<<O),0]);i.translate(ue,ue,[K*i.EXTENT,oe*i.EXTENT,0]),this._demMatrixCache[h.key]={matrix:ue,coord:h}}return{u_depth:2,u_terrain:3,u_terrain_dim:_&&_.dem&&_.dem.dim||1,u_terrain_matrix:T?this._demMatrixCache[h.key].matrix:this._emptyDemMatrix,u_terrain_unpack:_&&_.dem&&_.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(_&&_.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:_}}getRTTFramebuffer(){const h=this.style.map.painter;if(!this._rttFramebuffer){const _=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=h.context.createFramebuffer(_,_,!0),this._rttFramebuffer.depthAttachment.set(h.context.createRenderbuffer(h.context.gl.DEPTH_COMPONENT16,_,_))}return this._rttFramebuffer}getFramebuffer(h){const _=this.style.map.painter,T=_.width/devicePixelRatio,F=_.height/devicePixelRatio;return!this._fbo||this._fbo.width===T&&this._fbo.height===F||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Y(_.context,{width:T,height:F,data:null},_.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(_.context.gl.NEAREST,_.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Y(_.context,{width:T,height:F,data:null},_.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(_.context.gl.NEAREST,_.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=_.context.createFramebuffer(T,F,!0),this._fbo.depthAttachment.set(_.context.createRenderbuffer(_.context.gl.DEPTH_COMPONENT16,T,F))),this._fbo.colorAttachment.set(h==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const h=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const _=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let O=0,K=0;O<this._coordsTextureSize;O++)for(let oe=0;oe<this._coordsTextureSize;oe++,K+=4)_[K+0]=255&oe,_[K+1]=255&O,_[K+2]=oe>>8<<4|O>>8,_[K+3]=0;const T=new i.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(_.buffer)),F=new Y(h,T,h.gl.RGBA,{premultiply:!1});return F.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),this._coordsTexture=F,F}pointCoordinate(h){const _=new Uint8Array(4),T=this.style.map.painter,F=T.context,O=F.gl;F.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),O.readPixels(h.x,T.height/devicePixelRatio-h.y-1,1,1,O.RGBA,O.UNSIGNED_BYTE,_),F.bindFramebuffer.set(null);const K=_[0]+(_[2]>>4<<8),oe=_[1]+((15&_[2])<<8),ue=this.coordsIndex[255-_[3]],ve=ue&&this.sourceCache.getTileByID(ue);if(!ve)return null;const Te=this._coordsTextureSize,ke=(1<<ve.tileID.canonical.z)*Te;return new i.MercatorCoordinate((ve.tileID.canonical.x*Te+K)/ke,(ve.tileID.canonical.y*Te+oe)/ke,this.getElevation(ve.tileID,K,oe,Te))}getTerrainMesh(){if(this._mesh)return this._mesh;const h=this.style.map.painter.context,_=new i.PosArray,T=new i.TriangleIndexArray,F=this.meshSize,O=i.EXTENT/F,K=F*F;for(let oe=0;oe<=F;oe++)for(let ue=0;ue<=F;ue++)_.emplaceBack(ue*O,oe*O);for(let oe=0;oe<K;oe+=F+1)for(let ue=0;ue<F;ue++)T.emplaceBack(ue+oe,F+ue+oe+1,F+ue+oe+2),T.emplaceBack(ue+oe,F+ue+oe+2,ue+oe+1);return this._mesh={indexBuffer:h.createIndexBuffer(T),vertexBuffer:h.createVertexBuffer(_,rr.members),segments:i.SegmentVector.simpleSegment(0,0,_.length,T.length)},this._mesh}getMinMaxElevation(h){const _=this.getTerrainData(h).tile,T={minElevation:null,maxElevation:null};return _&&_.dem&&(T.minElevation=(_.dem.min+this.elevationOffset)*this.exaggeration,T.maxElevation=(_.dem.max+this.elevationOffset)*this.exaggeration),T}}const sr=(M,h)=>i.emitValidationErrors(M,h&&h.filter(_=>_.identifier!=="source.canvas")),Yn=i.pick(Qi,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Wr=i.pick(Qi,["setCenter","setZoom","setBearing","setPitch"]),mr=function(){const M={},h=i.spec.$version;for(const _ in i.spec.$root){const T=i.spec.$root[_];if(T.required){let F=null;F=_==="version"?h:T.type==="array"?[]:{},F!=null&&(M[_]=F)}}return M}();class Mr extends i.Evented{constructor(h,_={}){super(),this.map=h,this.dispatcher=new Et(fi(),this),this.imageManager=new ae,this.imageManager.setEventedParent(this),this.glyphManager=new me(h._requestManager,_.localIdeographFontFamily),this.lineAtlas=new Ke(256,512),this.crossTileSymbolIndex=new tn,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new i.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());const T=this;this._rtlTextPluginCallback=Mr.registerForPluginStateChange(F=>{T.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:F.pluginStatus,pluginURL:F.pluginURL},(O,K)=>{if(i.triggerPluginCompletionEvent(O),K&&K.every(oe=>oe))for(const oe in T.sourceCaches)T.sourceCaches[oe].reload()})}),this.on("data",F=>{if(F.dataType!=="source"||F.sourceDataType!=="metadata")return;const O=this.sourceCaches[F.sourceId];if(!O)return;const K=O.getSource();if(K&&K.vectorLayerIds)for(const oe in this._layers){const ue=this._layers[oe];ue.source===K.id&&this._validateLayer(ue)}})}loadURL(h,_={}){this.fire(new i.Event("dataloading",{dataType:"style"}));const T=typeof _.validate!="boolean"||_.validate,F=this.map._requestManager.transformRequest(h,i.ResourceType.Style);this._request=i.getJSON(F,(O,K)=>{this._request=null,O?this.fire(new i.ErrorEvent(O)):K&&this._load(K,T)})}loadJSON(h,_={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(h,_.validate!==!1)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(mr,!1)}_load(h,_){if(_&&sr(this,i.validateStyle(h)))return;this._loaded=!0,this.stylesheet=h;for(const F in h.sources)this.addSource(F,h.sources[F],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs);const T=wn(this.stylesheet.layers);this._order=T.map(F=>F.id),this._layers={},this._serializedLayers={};for(let F of T)F=i.createStyleLayer(F),F.setEventedParent(this,{layer:{id:F.id}}),this._layers[F.id]=F,this._serializedLayers[F.id]=F.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Me(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}_loadSprite(h){this._spriteRequest=function(_,T,F,O){let K,oe,ue;const ve=F>1?"@2x":"";let Te=i.getJSON(T.transformRequest(T.normalizeSpriteURL(_,ve,".json"),i.ResourceType.SpriteJSON),(bt,mt)=>{Te=null,ue||(ue=bt,K=mt,We())}),ke=i.getImage(T.transformRequest(T.normalizeSpriteURL(_,ve,".png"),i.ResourceType.SpriteImage),(bt,mt)=>{ke=null,ue||(ue=bt,oe=mt,We())});function We(){if(ue)O(ue);else if(K&&oe){const bt=i.exported.getImageData(oe),mt={};for(const gt in K){const{width:Vt,height:Zt,x:ni,y:St,sdf:zt,pixelRatio:li,stretchX:Ei,stretchY:bi,content:Hi}=K[gt],xi=new i.RGBAImage({width:Vt,height:Zt});i.RGBAImage.copy(bt,xi,{x:ni,y:St},{x:0,y:0},{width:Vt,height:Zt}),mt[gt]={data:xi,pixelRatio:li,sdf:zt,stretchX:Ei,stretchY:bi,content:Hi}}O(null,mt)}}return{cancel(){Te&&(Te.cancel(),Te=null),ke&&(ke.cancel(),ke=null)}}}(h,this.map._requestManager,this.map.getPixelRatio(),(_,T)=>{if(this._spriteRequest=null,_)this.fire(new i.ErrorEvent(_));else if(T)for(const F in T)this.imageManager.addImage(F,T[F]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(h){const _=this.sourceCaches[h.source];if(!_)return;const T=h.sourceLayer;if(!T)return;const F=_.getSource();(F.type==="geojson"||F.vectorLayerIds&&F.vectorLayerIds.indexOf(T)===-1)&&this.fire(new i.ErrorEvent(new Error(`Source layer "${T}" does not exist on source "${F.id}" as specified by style layer "${h.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const h in this.sourceCaches)if(!this.sourceCaches[h].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(h){const _=[];for(const T of h){const F=this._layers[T];F.type!=="custom"&&_.push(F.serialize())}return _}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const h in this.sourceCaches)if(this.sourceCaches[h].hasTransition())return!0;for(const h in this._layers)if(this._layers[h].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(h){if(!this._loaded)return;const _=this._changed;if(this._changed){const F=Object.keys(this._updatedLayers),O=Object.keys(this._removedLayers);(F.length||O.length)&&this._updateWorkerLayers(F,O);for(const K in this._updatedSources){const oe=this._updatedSources[K];if(oe==="reload")this._reloadSource(K);else{if(oe!=="clear")throw new Error(`Invalid action ${oe}`);this._clearSource(K)}}this._updateTilesForChangedImages();for(const K in this._updatedPaintProps)this._layers[K].updateTransitions(h);this.light.updateTransitions(h),this._resetUpdates()}const T={};for(const F in this.sourceCaches){const O=this.sourceCaches[F];T[F]=O.used,O.used=!1}for(const F of this._order){const O=this._layers[F];O.recalculate(h,this._availableImages),!O.isHidden(h.zoom)&&O.source&&(this.sourceCaches[O.source].used=!0)}for(const F in T){const O=this.sourceCaches[F];T[F]!==O.used&&O.fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:F}))}this.light.recalculate(h),this.z=h.zoom,_&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const h=Object.keys(this._changedImages);if(h.length){for(const _ in this.sourceCaches)this.sourceCaches[_].reloadTilesForDependencies(["icons","patterns"],h);this._changedImages={}}}_updateWorkerLayers(h,_){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(h),removedIds:_})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(h){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),h){const _=this.sourceCaches[h.source];if(!_)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);this.terrain=new Yt(this,_,h),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=T=>{T.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=T=>{T.tile&&(T.sourceId===h.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(T.sourceId,T.tile.tileID)):T.source.type==="geojson"&&this.terrain.rememberForRerender(T.sourceId,T.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new i.Event("terrain",{terrain:h}))}setState(h){if(this._checkLoaded(),sr(this,i.validateStyle(h)))return!1;(h=i.clone$1(h)).layers=wn(h.layers);const _=function(F,O){if(!F)return[{command:Qi.setStyle,args:[O]}];let K=[];try{if(!N(F.version,O.version))return[{command:Qi.setStyle,args:[O]}];N(F.center,O.center)||K.push({command:Qi.setCenter,args:[O.center]}),N(F.zoom,O.zoom)||K.push({command:Qi.setZoom,args:[O.zoom]}),N(F.bearing,O.bearing)||K.push({command:Qi.setBearing,args:[O.bearing]}),N(F.pitch,O.pitch)||K.push({command:Qi.setPitch,args:[O.pitch]}),N(F.sprite,O.sprite)||K.push({command:Qi.setSprite,args:[O.sprite]}),N(F.glyphs,O.glyphs)||K.push({command:Qi.setGlyphs,args:[O.glyphs]}),N(F.transition,O.transition)||K.push({command:Qi.setTransition,args:[O.transition]}),N(F.light,O.light)||K.push({command:Qi.setLight,args:[O.light]});const oe={},ue=[];(function(Te,ke,We,bt){let mt;for(mt in ke=ke||{},Te=Te||{})Object.prototype.hasOwnProperty.call(Te,mt)&&(Object.prototype.hasOwnProperty.call(ke,mt)||kn(mt,We,bt));for(mt in ke)Object.prototype.hasOwnProperty.call(ke,mt)&&(Object.prototype.hasOwnProperty.call(Te,mt)?N(Te[mt],ke[mt])||(Te[mt].type==="geojson"&&ke[mt].type==="geojson"&&st(Te,ke,mt)?We.push({command:Qi.setGeoJSONSourceData,args:[mt,ke[mt].data]}):yt(mt,ke,We,bt)):Gn(mt,ke,We))})(F.sources,O.sources,ue,oe);const ve=[];F.layers&&F.layers.forEach(Te=>{oe[Te.source]?K.push({command:Qi.removeLayer,args:[Te.id]}):ve.push(Te)}),K=K.concat(ue),function(Te,ke,We){ke=ke||[];const bt=(Te=Te||[]).map(Ni),mt=ke.map(Ni),gt=Te.reduce(qi,{}),Vt=ke.reduce(qi,{}),Zt=bt.slice(),ni=Object.create(null);let St,zt,li,Ei,bi,Hi,xi;for(St=0,zt=0;St<bt.length;St++)li=bt[St],Object.prototype.hasOwnProperty.call(Vt,li)?zt++:(We.push({command:Qi.removeLayer,args:[li]}),Zt.splice(Zt.indexOf(li,zt),1));for(St=0,zt=0;St<mt.length;St++)li=mt[mt.length-1-St],Zt[Zt.length-1-St]!==li&&(Object.prototype.hasOwnProperty.call(gt,li)?(We.push({command:Qi.removeLayer,args:[li]}),Zt.splice(Zt.lastIndexOf(li,Zt.length-zt),1)):zt++,Hi=Zt[Zt.length-St],We.push({command:Qi.addLayer,args:[Vt[li],Hi]}),Zt.splice(Zt.length-St,0,li),ni[li]=!0);for(St=0;St<mt.length;St++)if(li=mt[St],Ei=gt[li],bi=Vt[li],!ni[li]&&!N(Ei,bi))if(N(Ei.source,bi.source)&&N(Ei["source-layer"],bi["source-layer"])&&N(Ei.type,bi.type)){for(xi in ti(Ei.layout,bi.layout,We,li,null,Qi.setLayoutProperty),ti(Ei.paint,bi.paint,We,li,null,Qi.setPaintProperty),N(Ei.filter,bi.filter)||We.push({command:Qi.setFilter,args:[li,bi.filter]}),N(Ei.minzoom,bi.minzoom)&&N(Ei.maxzoom,bi.maxzoom)||We.push({command:Qi.setLayerZoomRange,args:[li,bi.minzoom,bi.maxzoom]}),Ei)Object.prototype.hasOwnProperty.call(Ei,xi)&&xi!=="layout"&&xi!=="paint"&&xi!=="filter"&&xi!=="metadata"&&xi!=="minzoom"&&xi!=="maxzoom"&&(xi.indexOf("paint.")===0?ti(Ei[xi],bi[xi],We,li,xi.slice(6),Qi.setPaintProperty):N(Ei[xi],bi[xi])||We.push({command:Qi.setLayerProperty,args:[li,xi,bi[xi]]}));for(xi in bi)Object.prototype.hasOwnProperty.call(bi,xi)&&!Object.prototype.hasOwnProperty.call(Ei,xi)&&xi!=="layout"&&xi!=="paint"&&xi!=="filter"&&xi!=="metadata"&&xi!=="minzoom"&&xi!=="maxzoom"&&(xi.indexOf("paint.")===0?ti(Ei[xi],bi[xi],We,li,xi.slice(6),Qi.setPaintProperty):N(Ei[xi],bi[xi])||We.push({command:Qi.setLayerProperty,args:[li,xi,bi[xi]]}))}else We.push({command:Qi.removeLayer,args:[li]}),Hi=Zt[Zt.lastIndexOf(li)+1],We.push({command:Qi.addLayer,args:[bi,Hi]})}(ve,O.layers,K)}catch(oe){console.warn("Unable to compute style diff:",oe),K=[{command:Qi.setStyle,args:[O]}]}return K}(this.serialize(),h).filter(F=>!(F.command in Wr));if(_.length===0)return!1;const T=_.filter(F=>!(F.command in Yn));if(T.length>0)throw new Error(`Unimplemented: ${T.map(F=>F.command).join(", ")}.`);return _.forEach(F=>{F.command!=="setTransition"&&this[F.command].apply(this,F.args)}),this.stylesheet=h,!0}addImage(h,_){if(this.getImage(h))return this.fire(new i.ErrorEvent(new Error(`An image named "${h}" already exists.`)));this.imageManager.addImage(h,_),this._afterImageUpdated(h)}updateImage(h,_){this.imageManager.updateImage(h,_)}getImage(h){return this.imageManager.getImage(h)}removeImage(h){if(!this.getImage(h))return this.fire(new i.ErrorEvent(new Error(`An image named "${h}" does not exist.`)));this.imageManager.removeImage(h),this._afterImageUpdated(h)}_afterImageUpdated(h){this._availableImages=this.imageManager.listImages(),this._changedImages[h]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(h,_,T={}){if(this._checkLoaded(),this.sourceCaches[h]!==void 0)throw new Error(`Source "${h}" already exists.`);if(!_.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(_).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(_.type)>=0&&this._validate(i.validateStyle.source,`sources.${h}`,_,null,T))return;this.map&&this.map._collectResourceTiming&&(_.collectResourceTiming=!0);const F=this.sourceCaches[h]=new Qt(h,_,this.dispatcher);F.style=this,F.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:F.serialize(),sourceId:h})),F.onAdd(this.map),this._changed=!0}removeSource(h){if(this._checkLoaded(),this.sourceCaches[h]===void 0)throw new Error("There is no source with this ID");for(const T in this._layers)if(this._layers[T].source===h)return this.fire(new i.ErrorEvent(new Error(`Source "${h}" cannot be removed while layer "${T}" is using it.`)));const _=this.sourceCaches[h];delete this.sourceCaches[h],delete this._updatedSources[h],_.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:h})),_.setEventedParent(null),_.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(h,_){if(this._checkLoaded(),this.sourceCaches[h]===void 0)throw new Error(`There is no source with this ID=${h}`);const T=this.sourceCaches[h].getSource();if(T.type!=="geojson")throw new Error(`geojsonSource.type is ${T.type}, which is !== 'geojson`);T.setData(_),this._changed=!0}getSource(h){return this.sourceCaches[h]&&this.sourceCaches[h].getSource()}addLayer(h,_,T={}){this._checkLoaded();const F=h.id;if(this.getLayer(F))return void this.fire(new i.ErrorEvent(new Error(`Layer "${F}" already exists on this map.`)));let O;if(h.type==="custom"){if(sr(this,i.validateCustomStyleLayer(h)))return;O=i.createStyleLayer(h)}else{if(typeof h.source=="object"&&(this.addSource(F,h.source),h=i.clone$1(h),h=i.extend(h,{source:F})),this._validate(i.validateStyle.layer,`layers.${F}`,h,{arrayIndex:-1},T))return;O=i.createStyleLayer(h),this._validateLayer(O),O.setEventedParent(this,{layer:{id:F}}),this._serializedLayers[O.id]=O.serialize()}const K=_?this._order.indexOf(_):this._order.length;if(_&&K===-1)this.fire(new i.ErrorEvent(new Error(`Cannot add layer "${F}" before non-existing layer "${_}".`)));else{if(this._order.splice(K,0,F),this._layerOrderChanged=!0,this._layers[F]=O,this._removedLayers[F]&&O.source&&O.type!=="custom"){const oe=this._removedLayers[F];delete this._removedLayers[F],oe.type!==O.type?this._updatedSources[O.source]="clear":(this._updatedSources[O.source]="reload",this.sourceCaches[O.source].pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map)}}moveLayer(h,_){if(this._checkLoaded(),this._changed=!0,!this._layers[h])return void this.fire(new i.ErrorEvent(new Error(`The layer '${h}' does not exist in the map's style and cannot be moved.`)));if(h===_)return;const T=this._order.indexOf(h);this._order.splice(T,1);const F=_?this._order.indexOf(_):this._order.length;_&&F===-1?this.fire(new i.ErrorEvent(new Error(`Cannot move layer "${h}" before non-existing layer "${_}".`))):(this._order.splice(F,0,h),this._layerOrderChanged=!0)}removeLayer(h){this._checkLoaded();const _=this._layers[h];if(!_)return void this.fire(new i.ErrorEvent(new Error(`Cannot remove non-existing layer "${h}".`)));_.setEventedParent(null);const T=this._order.indexOf(h);this._order.splice(T,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[h]=_,delete this._layers[h],delete this._serializedLayers[h],delete this._updatedLayers[h],delete this._updatedPaintProps[h],_.onRemove&&_.onRemove(this.map)}getLayer(h){return this._layers[h]}hasLayer(h){return h in this._layers}setLayerZoomRange(h,_,T){this._checkLoaded();const F=this.getLayer(h);F?F.minzoom===_&&F.maxzoom===T||(_!=null&&(F.minzoom=_),T!=null&&(F.maxzoom=T),this._updateLayer(F)):this.fire(new i.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${h}".`)))}setFilter(h,_,T={}){this._checkLoaded();const F=this.getLayer(h);if(F){if(!N(F.filter,_))return _==null?(F.filter=void 0,void this._updateLayer(F)):void(this._validate(i.validateStyle.filter,`layers.${F.id}.filter`,_,null,T)||(F.filter=i.clone$1(_),this._updateLayer(F)))}else this.fire(new i.ErrorEvent(new Error(`Cannot filter non-existing layer "${h}".`)))}getFilter(h){return i.clone$1(this.getLayer(h).filter)}setLayoutProperty(h,_,T,F={}){this._checkLoaded();const O=this.getLayer(h);O?N(O.getLayoutProperty(_),T)||(O.setLayoutProperty(_,T,F),this._updateLayer(O)):this.fire(new i.ErrorEvent(new Error(`Cannot style non-existing layer "${h}".`)))}getLayoutProperty(h,_){const T=this.getLayer(h);if(T)return T.getLayoutProperty(_);this.fire(new i.ErrorEvent(new Error(`Cannot get style of non-existing layer "${h}".`)))}setPaintProperty(h,_,T,F={}){this._checkLoaded();const O=this.getLayer(h);O?N(O.getPaintProperty(_),T)||(O.setPaintProperty(_,T,F)&&this._updateLayer(O),this._changed=!0,this._updatedPaintProps[h]=!0):this.fire(new i.ErrorEvent(new Error(`Cannot style non-existing layer "${h}".`)))}getPaintProperty(h,_){return this.getLayer(h).getPaintProperty(_)}setFeatureState(h,_){this._checkLoaded();const T=h.source,F=h.sourceLayer,O=this.sourceCaches[T];if(O===void 0)return void this.fire(new i.ErrorEvent(new Error(`The source '${T}' does not exist in the map's style.`)));const K=O.getSource().type;K==="geojson"&&F?this.fire(new i.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):K!=="vector"||F?(h.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),O.setFeatureState(F,h.id,_)):this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(h,_){this._checkLoaded();const T=h.source,F=this.sourceCaches[T];if(F===void 0)return void this.fire(new i.ErrorEvent(new Error(`The source '${T}' does not exist in the map's style.`)));const O=F.getSource().type,K=O==="vector"?h.sourceLayer:void 0;O!=="vector"||K?_&&typeof h.id!="string"&&typeof h.id!="number"?this.fire(new i.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):F.removeFeatureState(K,h.id,_):this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(h){this._checkLoaded();const _=h.source,T=h.sourceLayer,F=this.sourceCaches[_];if(F!==void 0)return F.getSource().type!=="vector"||T?(h.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),F.getFeatureState(T,h.id)):void this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new i.ErrorEvent(new Error(`The source '${_}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:i.mapObject(this.sourceCaches,h=>h.serialize()),layers:this._serializeLayers(this._order)},h=>h!==void 0)}_updateLayer(h){this._updatedLayers[h.id]=!0,h.source&&!this._updatedSources[h.source]&&this.sourceCaches[h.source].getSource().type!=="raster"&&(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(h){const _=K=>this._layers[K].type==="fill-extrusion",T={},F=[];for(let K=this._order.length-1;K>=0;K--){const oe=this._order[K];if(_(oe)){T[oe]=K;for(const ue of h){const ve=ue[oe];if(ve)for(const Te of ve)F.push(Te)}}}F.sort((K,oe)=>oe.intersectionZ-K.intersectionZ);const O=[];for(let K=this._order.length-1;K>=0;K--){const oe=this._order[K];if(_(oe))for(let ue=F.length-1;ue>=0;ue--){const ve=F[ue].feature;if(T[ve.layer.id]<K)break;O.push(ve),F.pop()}else for(const ue of h){const ve=ue[oe];if(ve)for(const Te of ve)O.push(Te.feature)}}return O}queryRenderedFeatures(h,_,T){_&&_.filter&&this._validate(i.validateStyle.filter,"queryRenderedFeatures.filter",_.filter,null,_);const F={};if(_&&_.layers){if(!Array.isArray(_.layers))return this.fire(new i.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const K of _.layers){const oe=this._layers[K];if(!oe)return this.fire(new i.ErrorEvent(new Error(`The layer '${K}' does not exist in the map's style and cannot be queried for features.`))),[];F[oe.source]=!0}}const O=[];_.availableImages=this._availableImages;for(const K in this.sourceCaches)_.layers&&!F[K]||O.push(et(this.sourceCaches[K],this._layers,this._serializedLayers,h,_,T));return this.placement&&O.push(function(K,oe,ue,ve,Te,ke,We){const bt={},mt=ke.queryRenderedSymbols(ve),gt=[];for(const Vt of Object.keys(mt).map(Number))gt.push(We[Vt]);gt.sort(vt);for(const Vt of gt){const Zt=Vt.featureIndex.lookupSymbolFeatures(mt[Vt.bucketInstanceId],oe,Vt.bucketIndex,Vt.sourceLayerIndex,Te.filter,Te.layers,Te.availableImages,K);for(const ni in Zt){const St=bt[ni]=bt[ni]||[],zt=Zt[ni];zt.sort((li,Ei)=>{const bi=Vt.featureSortOrder;if(bi){const Hi=bi.indexOf(li.featureIndex);return bi.indexOf(Ei.featureIndex)-Hi}return Ei.featureIndex-li.featureIndex});for(const li of zt)St.push(li)}}for(const Vt in bt)bt[Vt].forEach(Zt=>{const ni=Zt.feature,St=ue[K[Vt].source].getFeatureState(ni.layer["source-layer"],ni.id);ni.source=ni.layer.source,ni.layer["source-layer"]&&(ni.sourceLayer=ni.layer["source-layer"]),ni.state=St});return bt}(this._layers,this._serializedLayers,this.sourceCaches,h,_,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(O)}querySourceFeatures(h,_){_&&_.filter&&this._validate(i.validateStyle.filter,"querySourceFeatures.filter",_.filter,null,_);const T=this.sourceCaches[h];return T?function(F,O){const K=F.getRenderableIds().map(ve=>F.getTileByID(ve)),oe=[],ue={};for(let ve=0;ve<K.length;ve++){const Te=K[ve],ke=Te.tileID.canonical.key;ue[ke]||(ue[ke]=!0,Te.querySourceFeatures(oe,O))}return oe}(T,_):[]}addSourceType(h,_,T){return Mr.getSourceType(h)?T(new Error(`A source type called "${h}" already exists.`)):(Mr.setSourceType(h,_),_.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:h,url:_.workerSourceURL},T):T(null,null))}getLight(){return this.light.getLight()}setLight(h,_={}){this._checkLoaded();const T=this.light.getLight();let F=!1;for(const K in h)if(!N(h[K],T[K])){F=!0;break}if(!F)return;const O={now:i.exported.now(),transition:i.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(h,_),this.light.updateTransitions(O)}_validate(h,_,T,F,O={}){return(!O||O.validate!==!1)&&sr(this,h.call(i.validateStyle,i.extend({key:_,style:this.serialize(),value:T,styleSpec:i.spec},F)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const h in this._layers)this._layers[h].setEventedParent(null);for(const h in this.sourceCaches){const _=this.sourceCaches[h];_.setEventedParent(null),_.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(h){this.sourceCaches[h].clearTiles()}_reloadSource(h){this.sourceCaches[h].resume(),this.sourceCaches[h].reload()}_updateSources(h){for(const _ in this.sourceCaches)this.sourceCaches[_].update(h,this.terrain)}_generateCollisionBoxes(){for(const h in this.sourceCaches)this._reloadSource(h)}_updatePlacement(h,_,T,F,O=!1){let K=!1,oe=!1;const ue={};for(const ve of this._order){const Te=this._layers[ve];if(Te.type!=="symbol")continue;if(!ue[Te.source]){const We=this.sourceCaches[Te.source];ue[Te.source]=We.getRenderableIds(!0).map(bt=>We.getTileByID(bt)).sort((bt,mt)=>mt.tileID.overscaledZ-bt.tileID.overscaledZ||(bt.tileID.isLessThan(mt.tileID)?-1:1))}const ke=this.crossTileSymbolIndex.addLayer(Te,ue[Te.source],h.center.lng);K=K||ke}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((O=O||this._layerOrderChanged||T===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),h.zoom))&&(this.pauseablePlacement=new Gt(h,this.terrain,this._order,O,_,T,F,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,ue),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),oe=!0),K&&this.pauseablePlacement.placement.setStale()),oe||K)for(const ve of this._order){const Te=this._layers[ve];Te.type==="symbol"&&this.placement.updateLayerOpacities(Te,ue[Te.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(const h in this.sourceCaches)this.sourceCaches[h].releaseSymbolFadeTiles()}getImages(h,_,T){this.imageManager.getImages(_.icons,T),this._updateTilesForChangedImages();const F=this.sourceCaches[_.source];F&&F.setDependencies(_.tileID.key,_.type,_.icons)}getGlyphs(h,_,T){this.glyphManager.getGlyphs(_.stacks,T)}getResource(h,_,T){return i.makeRequest(_,T)}}Mr.getSourceType=function(M){return Ie[M]},Mr.setSourceType=function(M,h){Ie[M]=h},Mr.registerForPluginStateChange=i.registerForPluginStateChange;var Oo="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const ks={prelude:or(`#ifdef GL_ES
- precision mediump float;
- #else
- #if !defined(lowp)
- #define lowp
- #endif
- #if !defined(mediump)
- #define mediump
- #endif
- #if !defined(highp)
- #define highp
- #endif
- #endif`,`#ifdef GL_ES
- precision highp float;
- #else
- #if !defined(lowp)
- #define lowp
- #endif
- #if !defined(mediump)
- #define mediump
- #endif
- #if !defined(highp)
- #define highp
- #endif
- #endif
- vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
- );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
- #ifdef TERRAIN3D
- uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
- #endif
- const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
- #ifdef TERRAIN3D
- highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
- #else
- return 1.0;
- #endif
- }float calculate_visibility(vec4 pos) {
- #ifdef TERRAIN3D
- vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
- #else
- return 1.0;
- #endif
- }float ele(vec2 pos) {
- #ifdef TERRAIN3D
- vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
- #else
- return 0.0;
- #endif
- }float get_elevation(vec2 pos) {
- #ifdef TERRAIN3D
- vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;
- #else
- return 0.0;
- #endif
- }`),background:or(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:or(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:or(`varying vec3 v_data;varying float v_visibility;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define mediump float radius
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define highp vec4 stroke_color
- #pragma mapbox: define mediump float stroke_width
- #pragma mapbox: define lowp float stroke_opacity
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize mediump float radius
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize highp vec4 stroke_color
- #pragma mapbox: initialize mediump float stroke_width
- #pragma mapbox: initialize lowp float stroke_opacity
- vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define mediump float radius
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define highp vec4 stroke_color
- #pragma mapbox: define mediump float stroke_width
- #pragma mapbox: define lowp float stroke_opacity
- void main(void) {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize mediump float radius
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize highp vec4 stroke_color
- #pragma mapbox: initialize mediump float stroke_width
- #pragma mapbox: initialize lowp float stroke_opacity
- vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:or("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:or(`uniform highp float u_intensity;varying vec2 v_extrude;
- #pragma mapbox: define highp float weight
- #define GAUSS_COEF 0.3989422804014327
- void main() {
- #pragma mapbox: initialize highp float weight
- float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
- #pragma mapbox: define highp float weight
- #pragma mapbox: define mediump float radius
- const highp float ZERO=1.0/255.0/16.0;
- #define GAUSS_COEF 0.3989422804014327
- void main(void) {
- #pragma mapbox: initialize highp float weight
- #pragma mapbox: initialize mediump float radius
- vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:or(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(0.0);
- #endif
- }`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:or("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:or("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:or("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:or(`#pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float opacity
- gl_FragColor=color*opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float opacity
- gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:or(`varying vec2 v_pos;
- #pragma mapbox: define highp vec4 outline_color
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 outline_color
- #pragma mapbox: initialize lowp float opacity
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
- #pragma mapbox: define highp vec4 outline_color
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 outline_color
- #pragma mapbox: initialize lowp float opacity
- gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:or(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp vec4 pattern_from
- #pragma mapbox: define lowp vec4 pattern_to
- void main() {
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump vec4 pattern_from
- #pragma mapbox: initialize mediump vec4 pattern_to
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp vec4 pattern_from
- #pragma mapbox: define lowp vec4 pattern_to
- #pragma mapbox: define lowp float pixel_ratio_from
- #pragma mapbox: define lowp float pixel_ratio_to
- void main() {
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump vec4 pattern_from
- #pragma mapbox: initialize mediump vec4 pattern_to
- #pragma mapbox: initialize lowp float pixel_ratio_from
- #pragma mapbox: initialize lowp float pixel_ratio_to
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:or(`#ifdef GL_ES
- precision highp float;
- #endif
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp vec4 pattern_from
- #pragma mapbox: define lowp vec4 pattern_to
- void main() {
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump vec4 pattern_from
- #pragma mapbox: initialize mediump vec4 pattern_to
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp vec4 pattern_from
- #pragma mapbox: define lowp vec4 pattern_to
- #pragma mapbox: define lowp float pixel_ratio_from
- #pragma mapbox: define lowp float pixel_ratio_to
- void main() {
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump vec4 pattern_from
- #pragma mapbox: initialize mediump vec4 pattern_to
- #pragma mapbox: initialize lowp float pixel_ratio_from
- #pragma mapbox: initialize lowp float pixel_ratio_to
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:or(`varying vec4 v_color;void main() {gl_FragColor=v_color;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
- #ifdef TERRAIN3D
- attribute vec2 a_centroid;
- #endif
- varying vec4 v_color;
- #pragma mapbox: define highp float base
- #pragma mapbox: define highp float height
- #pragma mapbox: define highp vec4 color
- void main() {
- #pragma mapbox: initialize highp float base
- #pragma mapbox: initialize highp float height
- #pragma mapbox: initialize highp vec4 color
- vec3 normal=a_normal_ed.xyz;
- #ifdef TERRAIN3D
- float baseDelta=10.0;float ele=get_elevation(a_centroid);
- #else
- float baseDelta=0.0;float ele=0.0;
- #endif
- base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:or(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
- #pragma mapbox: define lowp float base
- #pragma mapbox: define lowp float height
- #pragma mapbox: define lowp vec4 pattern_from
- #pragma mapbox: define lowp vec4 pattern_to
- #pragma mapbox: define lowp float pixel_ratio_from
- #pragma mapbox: define lowp float pixel_ratio_to
- void main() {
- #pragma mapbox: initialize lowp float base
- #pragma mapbox: initialize lowp float height
- #pragma mapbox: initialize mediump vec4 pattern_from
- #pragma mapbox: initialize mediump vec4 pattern_to
- #pragma mapbox: initialize lowp float pixel_ratio_from
- #pragma mapbox: initialize lowp float pixel_ratio_to
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
- #ifdef TERRAIN3D
- attribute vec2 a_centroid;
- #endif
- varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
- #pragma mapbox: define lowp float base
- #pragma mapbox: define lowp float height
- #pragma mapbox: define lowp vec4 pattern_from
- #pragma mapbox: define lowp vec4 pattern_to
- #pragma mapbox: define lowp float pixel_ratio_from
- #pragma mapbox: define lowp float pixel_ratio_to
- void main() {
- #pragma mapbox: initialize lowp float base
- #pragma mapbox: initialize lowp float height
- #pragma mapbox: initialize mediump vec4 pattern_from
- #pragma mapbox: initialize mediump vec4 pattern_to
- #pragma mapbox: initialize lowp float pixel_ratio_from
- #pragma mapbox: initialize lowp float pixel_ratio_to
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
- #ifdef TERRAIN3D
- float baseDelta=10.0;float ele=get_elevation(a_centroid);
- #else
- float baseDelta=0.0;float ele=0.0;
- #endif
- base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
- ? a_pos
- : vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:or(`#ifdef GL_ES
- precision highp float;
- #endif
- uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:or(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
- #define PI 3.141592653589793
- void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:or(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`
- #define scale 0.015873016
- attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define mediump float gapwidth
- #pragma mapbox: define lowp float offset
- #pragma mapbox: define mediump float width
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump float gapwidth
- #pragma mapbox: initialize lowp float offset
- #pragma mapbox: initialize mediump float width
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
- #ifdef TERRAIN3D
- v_gamma_scale=1.0;
- #else
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
- #endif
- v_width2=vec2(outset,inset);}`),lineGradient:or(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`
- #define scale 0.015873016
- attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define mediump float gapwidth
- #pragma mapbox: define lowp float offset
- #pragma mapbox: define mediump float width
- void main() {
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump float gapwidth
- #pragma mapbox: initialize lowp float offset
- #pragma mapbox: initialize mediump float width
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
- #ifdef TERRAIN3D
- v_gamma_scale=1.0;
- #else
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
- #endif
- v_width2=vec2(outset,inset);}`),linePattern:or(`#ifdef GL_ES
- precision highp float;
- #endif
- uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
- #pragma mapbox: define lowp vec4 pattern_from
- #pragma mapbox: define lowp vec4 pattern_to
- #pragma mapbox: define lowp float pixel_ratio_from
- #pragma mapbox: define lowp float pixel_ratio_to
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize mediump vec4 pattern_from
- #pragma mapbox: initialize mediump vec4 pattern_to
- #pragma mapbox: initialize lowp float pixel_ratio_from
- #pragma mapbox: initialize lowp float pixel_ratio_to
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`
- #define scale 0.015873016
- #define LINE_DISTANCE_SCALE 2.0
- attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float offset
- #pragma mapbox: define mediump float gapwidth
- #pragma mapbox: define mediump float width
- #pragma mapbox: define lowp float floorwidth
- #pragma mapbox: define lowp vec4 pattern_from
- #pragma mapbox: define lowp vec4 pattern_to
- #pragma mapbox: define lowp float pixel_ratio_from
- #pragma mapbox: define lowp float pixel_ratio_to
- void main() {
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float offset
- #pragma mapbox: initialize mediump float gapwidth
- #pragma mapbox: initialize mediump float width
- #pragma mapbox: initialize lowp float floorwidth
- #pragma mapbox: initialize mediump vec4 pattern_from
- #pragma mapbox: initialize mediump vec4 pattern_to
- #pragma mapbox: initialize lowp float pixel_ratio_from
- #pragma mapbox: initialize lowp float pixel_ratio_to
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
- #ifdef TERRAIN3D
- v_gamma_scale=1.0;
- #else
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
- #endif
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:or(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define mediump float width
- #pragma mapbox: define lowp float floorwidth
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump float width
- #pragma mapbox: initialize lowp float floorwidth
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`
- #define scale 0.015873016
- #define LINE_DISTANCE_SCALE 2.0
- attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define mediump float gapwidth
- #pragma mapbox: define lowp float offset
- #pragma mapbox: define mediump float width
- #pragma mapbox: define lowp float floorwidth
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump float gapwidth
- #pragma mapbox: initialize lowp float offset
- #pragma mapbox: initialize mediump float width
- #pragma mapbox: initialize lowp float floorwidth
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
- #ifdef TERRAIN3D
- v_gamma_scale=1.0;
- #else
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
- #endif
- v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:or(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:or(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize lowp float opacity
- lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize lowp float opacity
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
- camera_to_anchor_distance/u_camera_to_center_distance :
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:or(`#define SDF_PX 8.0
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
- #pragma mapbox: define highp vec4 fill_color
- #pragma mapbox: define highp vec4 halo_color
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float halo_width
- #pragma mapbox: define lowp float halo_blur
- void main() {
- #pragma mapbox: initialize highp vec4 fill_color
- #pragma mapbox: initialize highp vec4 halo_color
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float halo_width
- #pragma mapbox: initialize lowp float halo_blur
- float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
- #pragma mapbox: define highp vec4 fill_color
- #pragma mapbox: define highp vec4 halo_color
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float halo_width
- #pragma mapbox: define lowp float halo_blur
- void main() {
- #pragma mapbox: initialize highp vec4 fill_color
- #pragma mapbox: initialize highp vec4 halo_color
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float halo_width
- #pragma mapbox: initialize lowp float halo_blur
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
- camera_to_anchor_distance/u_camera_to_center_distance :
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:or(`#define SDF_PX 8.0
- #define SDF 1.0
- #define ICON 0.0
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
- #pragma mapbox: define highp vec4 fill_color
- #pragma mapbox: define highp vec4 halo_color
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float halo_width
- #pragma mapbox: define lowp float halo_blur
- void main() {
- #pragma mapbox: initialize highp vec4 fill_color
- #pragma mapbox: initialize highp vec4 halo_color
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float halo_width
- #pragma mapbox: initialize lowp float halo_blur
- float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
- #pragma mapbox: define highp vec4 fill_color
- #pragma mapbox: define highp vec4 halo_color
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float halo_width
- #pragma mapbox: define lowp float halo_blur
- void main() {
- #pragma mapbox: initialize highp vec4 fill_color
- #pragma mapbox: initialize highp vec4 halo_color
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float halo_width
- #pragma mapbox: initialize lowp float halo_blur
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
- camera_to_anchor_distance/u_camera_to_center_distance :
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:or("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Oo),terrainDepth:or("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Oo),terrainCoords:or("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Oo)};function or(M,h){const _=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,T=h.match(/attribute ([\w]+) ([\w]+)/g),F=M.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),O=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),K=O?O.concat(F):F,oe={};return{fragmentSource:M=M.replace(_,(ue,ve,Te,ke,We)=>(oe[We]=!0,ve==="define"?`
- #ifndef HAS_UNIFORM_u_${We}
- varying ${Te} ${ke} ${We};
- #else
- uniform ${Te} ${ke} u_${We};
- #endif
- `:`
- #ifdef HAS_UNIFORM_u_${We}
- ${Te} ${ke} ${We} = u_${We};
- #endif
- `)),vertexSource:h=h.replace(_,(ue,ve,Te,ke,We)=>{const bt=ke==="float"?"vec2":"vec4",mt=We.match(/color/)?"color":bt;return oe[We]?ve==="define"?`
- #ifndef HAS_UNIFORM_u_${We}
- uniform lowp float u_${We}_t;
- attribute ${Te} ${bt} a_${We};
- varying ${Te} ${ke} ${We};
- #else
- uniform ${Te} ${ke} u_${We};
- #endif
- `:mt==="vec4"?`
- #ifndef HAS_UNIFORM_u_${We}
- ${We} = a_${We};
- #else
- ${Te} ${ke} ${We} = u_${We};
- #endif
- `:`
- #ifndef HAS_UNIFORM_u_${We}
- ${We} = unpack_mix_${mt}(a_${We}, u_${We}_t);
- #else
- ${Te} ${ke} ${We} = u_${We};
- #endif
- `:ve==="define"?`
- #ifndef HAS_UNIFORM_u_${We}
- uniform lowp float u_${We}_t;
- attribute ${Te} ${bt} a_${We};
- #else
- uniform ${Te} ${ke} u_${We};
- #endif
- `:mt==="vec4"?`
- #ifndef HAS_UNIFORM_u_${We}
- ${Te} ${ke} ${We} = a_${We};
- #else
- ${Te} ${ke} ${We} = u_${We};
- #endif
- `:`
- #ifndef HAS_UNIFORM_u_${We}
- ${Te} ${ke} ${We} = unpack_mix_${mt}(a_${We}, u_${We}_t);
- #else
- ${Te} ${ke} ${We} = u_${We};
- #endif
- `}),staticAttributes:T,staticUniforms:K}}class rn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(h,_,T,F,O,K,oe,ue,ve){this.context=h;let Te=this.boundPaintVertexBuffers.length!==F.length;for(let ke=0;!Te&&ke<F.length;ke++)this.boundPaintVertexBuffers[ke]!==F[ke]&&(Te=!0);h.extVertexArrayObject&&this.vao&&this.boundProgram===_&&this.boundLayoutVertexBuffer===T&&!Te&&this.boundIndexBuffer===O&&this.boundVertexOffset===K&&this.boundDynamicVertexBuffer===oe&&this.boundDynamicVertexBuffer2===ue&&this.boundDynamicVertexBuffer3===ve?(h.bindVertexArrayOES.set(this.vao),oe&&oe.bind(),O&&O.dynamicDraw&&O.bind(),ue&&ue.bind(),ve&&ve.bind()):this.freshBind(_,T,F,O,K,oe,ue,ve)}freshBind(h,_,T,F,O,K,oe,ue){let ve;const Te=h.numAttributes,ke=this.context,We=ke.gl;if(ke.extVertexArrayObject)this.vao&&this.destroy(),this.vao=ke.extVertexArrayObject.createVertexArrayOES(),ke.bindVertexArrayOES.set(this.vao),ve=0,this.boundProgram=h,this.boundLayoutVertexBuffer=_,this.boundPaintVertexBuffers=T,this.boundIndexBuffer=F,this.boundVertexOffset=O,this.boundDynamicVertexBuffer=K,this.boundDynamicVertexBuffer2=oe,this.boundDynamicVertexBuffer3=ue;else{ve=ke.currentNumAttributes||0;for(let bt=Te;bt<ve;bt++)We.disableVertexAttribArray(bt)}_.enableAttributes(We,h);for(const bt of T)bt.enableAttributes(We,h);K&&K.enableAttributes(We,h),oe&&oe.enableAttributes(We,h),ue&&ue.enableAttributes(We,h),_.bind(),_.setVertexAttribPointers(We,h,O);for(const bt of T)bt.bind(),bt.setVertexAttribPointers(We,h,O);K&&(K.bind(),K.setVertexAttribPointers(We,h,O)),F&&F.bind(),oe&&(oe.bind(),oe.setVertexAttribPointers(We,h,O)),ue&&(ue.bind(),ue.setVertexAttribPointers(We,h,O)),ke.currentNumAttributes=Te}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function cr(M){const h=[];for(let _=0;_<M.length;_++){if(M[_]===null)continue;const T=M[_].split(" ");h.push(T.pop())}return h}class Ar{constructor(h,_,T,F,O,K,oe){const ue=h.gl;this.program=ue.createProgram();const ve=cr(T.staticAttributes),Te=F?F.getBinderAttributes():[],ke=ve.concat(Te),We=ks.prelude.staticUniforms?cr(ks.prelude.staticUniforms):[],bt=T.staticUniforms?cr(T.staticUniforms):[],mt=F?F.getBinderUniforms():[],gt=We.concat(bt).concat(mt),Vt=[];for(const bi of gt)Vt.indexOf(bi)<0&&Vt.push(bi);const Zt=F?F.defines():[];K&&Zt.push("#define OVERDRAW_INSPECTOR;"),oe&&Zt.push("#define TERRAIN3D;");const ni=Zt.concat(ks.prelude.fragmentSource,T.fragmentSource).join(`
- `),St=Zt.concat(ks.prelude.vertexSource,T.vertexSource).join(`
- `),zt=ue.createShader(ue.FRAGMENT_SHADER);if(ue.isContextLost())return void(this.failedToCreate=!0);ue.shaderSource(zt,ni),ue.compileShader(zt),ue.attachShader(this.program,zt);const li=ue.createShader(ue.VERTEX_SHADER);if(ue.isContextLost())return void(this.failedToCreate=!0);ue.shaderSource(li,St),ue.compileShader(li),ue.attachShader(this.program,li),this.attributes={};const Ei={};this.numAttributes=ke.length;for(let bi=0;bi<this.numAttributes;bi++)ke[bi]&&(ue.bindAttribLocation(this.program,bi,ke[bi]),this.attributes[ke[bi]]=bi);ue.linkProgram(this.program),ue.deleteShader(li),ue.deleteShader(zt);for(let bi=0;bi<Vt.length;bi++){const Hi=Vt[bi];if(Hi&&!Ei[Hi]){const xi=ue.getUniformLocation(this.program,Hi);xi&&(Ei[Hi]=xi)}}this.fixedUniforms=O(h,Ei),this.terrainUniforms=((bi,Hi)=>({u_depth:new i.Uniform1i(bi,Hi.u_depth),u_terrain:new i.Uniform1i(bi,Hi.u_terrain),u_terrain_dim:new i.Uniform1f(bi,Hi.u_terrain_dim),u_terrain_matrix:new i.UniformMatrix4f(bi,Hi.u_terrain_matrix),u_terrain_unpack:new i.Uniform4f(bi,Hi.u_terrain_unpack),u_terrain_offset:new i.Uniform1f(bi,Hi.u_terrain_offset),u_terrain_exaggeration:new i.Uniform1f(bi,Hi.u_terrain_exaggeration)}))(h,Ei),this.binderUniforms=F?F.getUniforms(h,Ei):[]}draw(h,_,T,F,O,K,oe,ue,ve,Te,ke,We,bt,mt,gt,Vt,Zt,ni){const St=h.gl;if(this.failedToCreate)return;if(h.program.set(this.program),h.setDepthMode(T),h.setStencilMode(F),h.setColorMode(O),h.setCullFace(K),ue){h.activeTexture.set(St.TEXTURE2),St.bindTexture(St.TEXTURE_2D,ue.depthTexture),h.activeTexture.set(St.TEXTURE3),St.bindTexture(St.TEXTURE_2D,ue.texture);for(const li in this.terrainUniforms)this.terrainUniforms[li].set(ue[li])}for(const li in this.fixedUniforms)this.fixedUniforms[li].set(oe[li]);gt&>.setUniforms(h,this.binderUniforms,bt,{zoom:mt});let zt=0;switch(_){case St.LINES:zt=2;break;case St.TRIANGLES:zt=3;break;case St.LINE_STRIP:zt=1}for(const li of We.get()){const Ei=li.vaos||(li.vaos={});(Ei[ve]||(Ei[ve]=new rn)).bind(h,this,Te,gt?gt.getPaintVertexBuffers():[],ke,li.vertexOffset,Vt,Zt,ni),St.drawElements(_,li.primitiveLength*zt,St.UNSIGNED_SHORT,li.primitiveOffset*zt*2)}}}function la(M,h,_){const T=1/fr(_,1,h.transform.tileZoom),F=Math.pow(2,_.tileID.overscaledZ),O=_.tileSize*Math.pow(2,h.transform.tileZoom)/F,K=O*(_.tileID.canonical.x+_.tileID.wrap*F),oe=O*_.tileID.canonical.y;return{u_image:0,u_texsize:_.imageAtlasTexture.size,u_scale:[T,M.fromScale,M.toScale],u_fade:M.t,u_pixel_coord_upper:[K>>16,oe>>16],u_pixel_coord_lower:[65535&K,65535&oe]}}const al=(M,h,_,T)=>{const F=h.style.light,O=F.properties.get("position"),K=[O.x,O.y,O.z],oe=i.create$1();F.properties.get("anchor")==="viewport"&&i.fromRotation(oe,-h.transform.angle),i.transformMat3(K,K,oe);const ue=F.properties.get("color");return{u_matrix:M,u_lightpos:K,u_lightintensity:F.properties.get("intensity"),u_lightcolor:[ue.r,ue.g,ue.b],u_vertical_gradient:+_,u_opacity:T}},dr=(M,h,_,T,F,O,K)=>i.extend(al(M,h,_,T),la(O,h,K),{u_height_factor:-Math.pow(2,F.overscaledZ)/K.tileSize/8}),Ul=M=>({u_matrix:M}),Rl=(M,h,_,T)=>i.extend(Ul(M),la(_,h,T)),ll=(M,h)=>({u_matrix:M,u_world:h}),qs=(M,h,_,T,F)=>i.extend(Rl(M,h,_,T),{u_world:F}),hs=(M,h,_,T)=>{const F=M.transform;let O,K;if(T.paint.get("circle-pitch-alignment")==="map"){const oe=fr(_,1,F.zoom);O=!0,K=[oe,oe]}else O=!1,K=F.pixelsToGLUnits;return{u_camera_to_center_distance:F.cameraToCenterDistance,u_scale_with_map:+(T.paint.get("circle-pitch-scale")==="map"),u_matrix:M.translatePosMatrix(h.posMatrix,_,T.paint.get("circle-translate"),T.paint.get("circle-translate-anchor")),u_pitch_with_map:+O,u_device_pixel_ratio:M.pixelRatio,u_extrude_scale:K}},ho=(M,h,_)=>{const T=fr(_,1,h.zoom),F=Math.pow(2,h.zoom-_.tileID.overscaledZ),O=_.tileID.overscaleFactor();return{u_matrix:M,u_camera_to_center_distance:h.cameraToCenterDistance,u_pixels_to_tile_units:T,u_extrude_scale:[h.pixelsToGLUnits[0]/(T*F),h.pixelsToGLUnits[1]/(T*F)],u_overscale_factor:O}},cl=(M,h,_=1)=>({u_matrix:M,u_color:h,u_overlay:0,u_overlay_scale:_}),Na=M=>({u_matrix:M}),zl=(M,h,_,T)=>({u_matrix:M,u_extrude_scale:fr(h,1,_),u_intensity:T});function kl(M,h){const _=Math.pow(2,h.canonical.z),T=h.canonical.y;return[new i.MercatorCoordinate(0,T/_).toLngLat().lat,new i.MercatorCoordinate(0,(T+1)/_).toLngLat().lat]}const Ol=(M,h,_,T)=>{const F=M.transform;return{u_matrix:Ys(M,h,_,T),u_ratio:1/fr(h,1,F.zoom),u_device_pixel_ratio:M.pixelRatio,u_units_to_pixels:[1/F.pixelsToGLUnits[0],1/F.pixelsToGLUnits[1]]}},Qa=(M,h,_,T,F)=>i.extend(Ol(M,h,_,F),{u_image:0,u_image_height:T}),Nl=(M,h,_,T,F)=>{const O=M.transform,K=ns(h,O);return{u_matrix:Ys(M,h,_,F),u_texsize:h.imageAtlasTexture.size,u_ratio:1/fr(h,1,O.zoom),u_device_pixel_ratio:M.pixelRatio,u_image:0,u_scale:[K,T.fromScale,T.toScale],u_fade:T.t,u_units_to_pixels:[1/O.pixelsToGLUnits[0],1/O.pixelsToGLUnits[1]]}},Ql=(M,h,_,T,F,O)=>{const K=M.lineAtlas,oe=ns(h,M.transform),ue=_.layout.get("line-cap")==="round",ve=K.getDash(T.from,ue),Te=K.getDash(T.to,ue),ke=ve.width*F.fromScale,We=Te.width*F.toScale;return i.extend(Ol(M,h,_,O),{u_patternscale_a:[oe/ke,-ve.height/2],u_patternscale_b:[oe/We,-Te.height/2],u_sdfgamma:K.width/(256*Math.min(ke,We)*M.pixelRatio)/2,u_image:0,u_tex_y_a:ve.y,u_tex_y_b:Te.y,u_mix:F.t})};function ns(M,h){return 1/fr(M,1,h.tileZoom)}function Ys(M,h,_,T){return M.translatePosMatrix(T?T.posMatrix:h.tileID.posMatrix,h,_.paint.get("line-translate"),_.paint.get("line-translate-anchor"))}const fs=(M,h,_,T,F)=>{return{u_matrix:M,u_tl_parent:h,u_scale_parent:_,u_buffer_scale:1,u_fade_t:T.mix,u_opacity:T.opacity*F.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:F.paint.get("raster-brightness-min"),u_brightness_high:F.paint.get("raster-brightness-max"),u_saturation_factor:(K=F.paint.get("raster-saturation"),K>0?1-1/(1.001-K):-K),u_contrast_factor:(O=F.paint.get("raster-contrast"),O>0?1/(1-O):1+O),u_spin_weights:Rc(F.paint.get("raster-hue-rotate"))};var O,K};function Rc(M){M*=Math.PI/180;const h=Math.sin(M),_=Math.cos(M);return[(2*_+1)/3,(-Math.sqrt(3)*h-_+1)/3,(Math.sqrt(3)*h-_+1)/3]}const Eh=(M,h,_,T,F,O,K,oe,ue,ve)=>{const Te=F.transform;return{u_is_size_zoom_constant:+(M==="constant"||M==="source"),u_is_size_feature_constant:+(M==="constant"||M==="camera"),u_size_t:h?h.uSizeT:0,u_size:h?h.uSize:0,u_camera_to_center_distance:Te.cameraToCenterDistance,u_pitch:Te.pitch/360*2*Math.PI,u_rotate_symbol:+_,u_aspect_ratio:Te.width/Te.height,u_fade_change:F.options.fadeDuration?F.symbolFadeChange:1,u_matrix:O,u_label_plane_matrix:K,u_coord_matrix:oe,u_is_text:+ue,u_pitch_with_map:+T,u_texsize:ve,u_texture:0}},Os=(M,h,_,T,F,O,K,oe,ue,ve,Te)=>{const ke=F.transform;return i.extend(Eh(M,h,_,T,F,O,K,oe,ue,ve),{u_gamma_scale:T?Math.cos(ke._pitch)*ke.cameraToCenterDistance:1,u_device_pixel_ratio:F.pixelRatio,u_is_halo:+Te})},No=(M,h,_,T,F,O,K,oe,ue,ve)=>i.extend(Os(M,h,_,T,F,O,K,oe,!0,ue,!0),{u_texsize_icon:ve,u_texture_icon:1}),ed=(M,h,_)=>({u_matrix:M,u_opacity:h,u_color:_}),pu=(M,h,_,T,F,O)=>i.extend(function(K,oe,ue,ve){const Te=ue.imageManager.getPattern(K.from.toString()),ke=ue.imageManager.getPattern(K.to.toString()),{width:We,height:bt}=ue.imageManager.getPixelSize(),mt=Math.pow(2,ve.tileID.overscaledZ),gt=ve.tileSize*Math.pow(2,ue.transform.tileZoom)/mt,Vt=gt*(ve.tileID.canonical.x+ve.tileID.wrap*mt),Zt=gt*ve.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Te.tl,u_pattern_br_a:Te.br,u_pattern_tl_b:ke.tl,u_pattern_br_b:ke.br,u_texsize:[We,bt],u_mix:oe.t,u_pattern_size_a:Te.displaySize,u_pattern_size_b:ke.displaySize,u_scale_a:oe.fromScale,u_scale_b:oe.toScale,u_tile_units_to_pixels:1/fr(ve,1,ue.transform.tileZoom),u_pixel_coord_upper:[Vt>>16,Zt>>16],u_pixel_coord_lower:[65535&Vt,65535&Zt]}}(T,O,_,F),{u_matrix:M,u_opacity:h}),Cs={fillExtrusion:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_lightpos:new i.Uniform3f(M,h.u_lightpos),u_lightintensity:new i.Uniform1f(M,h.u_lightintensity),u_lightcolor:new i.Uniform3f(M,h.u_lightcolor),u_vertical_gradient:new i.Uniform1f(M,h.u_vertical_gradient),u_opacity:new i.Uniform1f(M,h.u_opacity)}),fillExtrusionPattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_lightpos:new i.Uniform3f(M,h.u_lightpos),u_lightintensity:new i.Uniform1f(M,h.u_lightintensity),u_lightcolor:new i.Uniform3f(M,h.u_lightcolor),u_vertical_gradient:new i.Uniform1f(M,h.u_vertical_gradient),u_height_factor:new i.Uniform1f(M,h.u_height_factor),u_image:new i.Uniform1i(M,h.u_image),u_texsize:new i.Uniform2f(M,h.u_texsize),u_pixel_coord_upper:new i.Uniform2f(M,h.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(M,h.u_pixel_coord_lower),u_scale:new i.Uniform3f(M,h.u_scale),u_fade:new i.Uniform1f(M,h.u_fade),u_opacity:new i.Uniform1f(M,h.u_opacity)}),fill:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),fillPattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_image:new i.Uniform1i(M,h.u_image),u_texsize:new i.Uniform2f(M,h.u_texsize),u_pixel_coord_upper:new i.Uniform2f(M,h.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(M,h.u_pixel_coord_lower),u_scale:new i.Uniform3f(M,h.u_scale),u_fade:new i.Uniform1f(M,h.u_fade)}),fillOutline:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_world:new i.Uniform2f(M,h.u_world)}),fillOutlinePattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_world:new i.Uniform2f(M,h.u_world),u_image:new i.Uniform1i(M,h.u_image),u_texsize:new i.Uniform2f(M,h.u_texsize),u_pixel_coord_upper:new i.Uniform2f(M,h.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(M,h.u_pixel_coord_lower),u_scale:new i.Uniform3f(M,h.u_scale),u_fade:new i.Uniform1f(M,h.u_fade)}),circle:(M,h)=>({u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_scale_with_map:new i.Uniform1i(M,h.u_scale_with_map),u_pitch_with_map:new i.Uniform1i(M,h.u_pitch_with_map),u_extrude_scale:new i.Uniform2f(M,h.u_extrude_scale),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),collisionBox:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_pixels_to_tile_units:new i.Uniform1f(M,h.u_pixels_to_tile_units),u_extrude_scale:new i.Uniform2f(M,h.u_extrude_scale),u_overscale_factor:new i.Uniform1f(M,h.u_overscale_factor)}),collisionCircle:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_inv_matrix:new i.UniformMatrix4f(M,h.u_inv_matrix),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_viewport_size:new i.Uniform2f(M,h.u_viewport_size)}),debug:(M,h)=>({u_color:new i.UniformColor(M,h.u_color),u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_overlay:new i.Uniform1i(M,h.u_overlay),u_overlay_scale:new i.Uniform1f(M,h.u_overlay_scale)}),clippingMask:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),heatmap:(M,h)=>({u_extrude_scale:new i.Uniform1f(M,h.u_extrude_scale),u_intensity:new i.Uniform1f(M,h.u_intensity),u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),heatmapTexture:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_world:new i.Uniform2f(M,h.u_world),u_image:new i.Uniform1i(M,h.u_image),u_color_ramp:new i.Uniform1i(M,h.u_color_ramp),u_opacity:new i.Uniform1f(M,h.u_opacity)}),hillshade:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_image:new i.Uniform1i(M,h.u_image),u_latrange:new i.Uniform2f(M,h.u_latrange),u_light:new i.Uniform2f(M,h.u_light),u_shadow:new i.UniformColor(M,h.u_shadow),u_highlight:new i.UniformColor(M,h.u_highlight),u_accent:new i.UniformColor(M,h.u_accent)}),hillshadePrepare:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_image:new i.Uniform1i(M,h.u_image),u_dimension:new i.Uniform2f(M,h.u_dimension),u_zoom:new i.Uniform1f(M,h.u_zoom),u_unpack:new i.Uniform4f(M,h.u_unpack)}),line:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_ratio:new i.Uniform1f(M,h.u_ratio),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(M,h.u_units_to_pixels)}),lineGradient:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_ratio:new i.Uniform1f(M,h.u_ratio),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(M,h.u_units_to_pixels),u_image:new i.Uniform1i(M,h.u_image),u_image_height:new i.Uniform1f(M,h.u_image_height)}),linePattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_texsize:new i.Uniform2f(M,h.u_texsize),u_ratio:new i.Uniform1f(M,h.u_ratio),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_image:new i.Uniform1i(M,h.u_image),u_units_to_pixels:new i.Uniform2f(M,h.u_units_to_pixels),u_scale:new i.Uniform3f(M,h.u_scale),u_fade:new i.Uniform1f(M,h.u_fade)}),lineSDF:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_ratio:new i.Uniform1f(M,h.u_ratio),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(M,h.u_units_to_pixels),u_patternscale_a:new i.Uniform2f(M,h.u_patternscale_a),u_patternscale_b:new i.Uniform2f(M,h.u_patternscale_b),u_sdfgamma:new i.Uniform1f(M,h.u_sdfgamma),u_image:new i.Uniform1i(M,h.u_image),u_tex_y_a:new i.Uniform1f(M,h.u_tex_y_a),u_tex_y_b:new i.Uniform1f(M,h.u_tex_y_b),u_mix:new i.Uniform1f(M,h.u_mix)}),raster:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_tl_parent:new i.Uniform2f(M,h.u_tl_parent),u_scale_parent:new i.Uniform1f(M,h.u_scale_parent),u_buffer_scale:new i.Uniform1f(M,h.u_buffer_scale),u_fade_t:new i.Uniform1f(M,h.u_fade_t),u_opacity:new i.Uniform1f(M,h.u_opacity),u_image0:new i.Uniform1i(M,h.u_image0),u_image1:new i.Uniform1i(M,h.u_image1),u_brightness_low:new i.Uniform1f(M,h.u_brightness_low),u_brightness_high:new i.Uniform1f(M,h.u_brightness_high),u_saturation_factor:new i.Uniform1f(M,h.u_saturation_factor),u_contrast_factor:new i.Uniform1f(M,h.u_contrast_factor),u_spin_weights:new i.Uniform3f(M,h.u_spin_weights)}),symbolIcon:(M,h)=>({u_is_size_zoom_constant:new i.Uniform1i(M,h.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(M,h.u_is_size_feature_constant),u_size_t:new i.Uniform1f(M,h.u_size_t),u_size:new i.Uniform1f(M,h.u_size),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_pitch:new i.Uniform1f(M,h.u_pitch),u_rotate_symbol:new i.Uniform1i(M,h.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(M,h.u_aspect_ratio),u_fade_change:new i.Uniform1f(M,h.u_fade_change),u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(M,h.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(M,h.u_coord_matrix),u_is_text:new i.Uniform1i(M,h.u_is_text),u_pitch_with_map:new i.Uniform1i(M,h.u_pitch_with_map),u_texsize:new i.Uniform2f(M,h.u_texsize),u_texture:new i.Uniform1i(M,h.u_texture)}),symbolSDF:(M,h)=>({u_is_size_zoom_constant:new i.Uniform1i(M,h.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(M,h.u_is_size_feature_constant),u_size_t:new i.Uniform1f(M,h.u_size_t),u_size:new i.Uniform1f(M,h.u_size),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_pitch:new i.Uniform1f(M,h.u_pitch),u_rotate_symbol:new i.Uniform1i(M,h.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(M,h.u_aspect_ratio),u_fade_change:new i.Uniform1f(M,h.u_fade_change),u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(M,h.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(M,h.u_coord_matrix),u_is_text:new i.Uniform1i(M,h.u_is_text),u_pitch_with_map:new i.Uniform1i(M,h.u_pitch_with_map),u_texsize:new i.Uniform2f(M,h.u_texsize),u_texture:new i.Uniform1i(M,h.u_texture),u_gamma_scale:new i.Uniform1f(M,h.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(M,h.u_is_halo)}),symbolTextAndIcon:(M,h)=>({u_is_size_zoom_constant:new i.Uniform1i(M,h.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(M,h.u_is_size_feature_constant),u_size_t:new i.Uniform1f(M,h.u_size_t),u_size:new i.Uniform1f(M,h.u_size),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_pitch:new i.Uniform1f(M,h.u_pitch),u_rotate_symbol:new i.Uniform1i(M,h.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(M,h.u_aspect_ratio),u_fade_change:new i.Uniform1f(M,h.u_fade_change),u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(M,h.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(M,h.u_coord_matrix),u_is_text:new i.Uniform1i(M,h.u_is_text),u_pitch_with_map:new i.Uniform1i(M,h.u_pitch_with_map),u_texsize:new i.Uniform2f(M,h.u_texsize),u_texsize_icon:new i.Uniform2f(M,h.u_texsize_icon),u_texture:new i.Uniform1i(M,h.u_texture),u_texture_icon:new i.Uniform1i(M,h.u_texture_icon),u_gamma_scale:new i.Uniform1f(M,h.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(M,h.u_is_halo)}),background:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_opacity:new i.Uniform1f(M,h.u_opacity),u_color:new i.UniformColor(M,h.u_color)}),backgroundPattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_opacity:new i.Uniform1f(M,h.u_opacity),u_image:new i.Uniform1i(M,h.u_image),u_pattern_tl_a:new i.Uniform2f(M,h.u_pattern_tl_a),u_pattern_br_a:new i.Uniform2f(M,h.u_pattern_br_a),u_pattern_tl_b:new i.Uniform2f(M,h.u_pattern_tl_b),u_pattern_br_b:new i.Uniform2f(M,h.u_pattern_br_b),u_texsize:new i.Uniform2f(M,h.u_texsize),u_mix:new i.Uniform1f(M,h.u_mix),u_pattern_size_a:new i.Uniform2f(M,h.u_pattern_size_a),u_pattern_size_b:new i.Uniform2f(M,h.u_pattern_size_b),u_scale_a:new i.Uniform1f(M,h.u_scale_a),u_scale_b:new i.Uniform1f(M,h.u_scale_b),u_pixel_coord_upper:new i.Uniform2f(M,h.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(M,h.u_pixel_coord_lower),u_tile_units_to_pixels:new i.Uniform1f(M,h.u_tile_units_to_pixels)}),terrain:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_texture:new i.Uniform1i(M,h.u_texture)}),terrainDepth:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),terrainCoords:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_texture:new i.Uniform1i(M,h.u_texture),u_terrain_coords_id:new i.Uniform1f(M,h.u_terrain_coords_id)})};class rc{constructor(h,_,T){this.context=h;const F=h.gl;this.buffer=F.createBuffer(),this.dynamicDraw=Boolean(T),this.context.unbindVAO(),h.bindElementBuffer.set(this.buffer),F.bufferData(F.ELEMENT_ARRAY_BUFFER,_.arrayBuffer,this.dynamicDraw?F.DYNAMIC_DRAW:F.STATIC_DRAW),this.dynamicDraw||delete _.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(h){const _=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),_.bufferSubData(_.ELEMENT_ARRAY_BUFFER,0,h.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Th={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class sc{constructor(h,_,T,F){this.length=_.length,this.attributes=T,this.itemSize=_.bytesPerElement,this.dynamicDraw=F,this.context=h;const O=h.gl;this.buffer=O.createBuffer(),h.bindVertexBuffer.set(this.buffer),O.bufferData(O.ARRAY_BUFFER,_.arrayBuffer,this.dynamicDraw?O.DYNAMIC_DRAW:O.STATIC_DRAW),this.dynamicDraw||delete _.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(h){if(h.length!==this.length)throw new Error(`Length of new data is ${h.length}, which doesn't match current length of ${this.length}`);const _=this.context.gl;this.bind(),_.bufferSubData(_.ARRAY_BUFFER,0,h.arrayBuffer)}enableAttributes(h,_){for(let T=0;T<this.attributes.length;T++){const F=_.attributes[this.attributes[T].name];F!==void 0&&h.enableVertexAttribArray(F)}}setVertexAttribPointers(h,_,T){for(let F=0;F<this.attributes.length;F++){const O=this.attributes[F],K=_.attributes[O.name];K!==void 0&&h.vertexAttribPointer(K,O.components,h[Th[O.type]],!1,this.itemSize,O.offset+this.itemSize*(T||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class er{constructor(h){this.gl=h.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(h){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class oc extends er{getDefault(){return i.Color.transparent}set(h){const _=this.current;(h.r!==_.r||h.g!==_.g||h.b!==_.b||h.a!==_.a||this.dirty)&&(this.gl.clearColor(h.r,h.g,h.b,h.a),this.current=h,this.dirty=!1)}}class Ju extends er{getDefault(){return 1}set(h){(h!==this.current||this.dirty)&&(this.gl.clearDepth(h),this.current=h,this.dirty=!1)}}class Qo extends er{getDefault(){return 0}set(h){(h!==this.current||this.dirty)&&(this.gl.clearStencil(h),this.current=h,this.dirty=!1)}}class hl extends er{getDefault(){return[!0,!0,!0,!0]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||h[2]!==_[2]||h[3]!==_[3]||this.dirty)&&(this.gl.colorMask(h[0],h[1],h[2],h[3]),this.current=h,this.dirty=!1)}}class Sh extends er{getDefault(){return!0}set(h){(h!==this.current||this.dirty)&&(this.gl.depthMask(h),this.current=h,this.dirty=!1)}}class Vo extends er{getDefault(){return 255}set(h){(h!==this.current||this.dirty)&&(this.gl.stencilMask(h),this.current=h,this.dirty=!1)}}class Mh extends er{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(h){const _=this.current;(h.func!==_.func||h.ref!==_.ref||h.mask!==_.mask||this.dirty)&&(this.gl.stencilFunc(h.func,h.ref,h.mask),this.current=h,this.dirty=!1)}}class Va extends er{getDefault(){const h=this.gl;return[h.KEEP,h.KEEP,h.KEEP]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||h[2]!==_[2]||this.dirty)&&(this.gl.stencilOp(h[0],h[1],h[2]),this.current=h,this.dirty=!1)}}class ac extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;h?_.enable(_.STENCIL_TEST):_.disable(_.STENCIL_TEST),this.current=h,this.dirty=!1}}class fu extends er{getDefault(){return[0,1]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||this.dirty)&&(this.gl.depthRange(h[0],h[1]),this.current=h,this.dirty=!1)}}class Vl extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;h?_.enable(_.DEPTH_TEST):_.disable(_.DEPTH_TEST),this.current=h,this.dirty=!1}}class ya extends er{getDefault(){return this.gl.LESS}set(h){(h!==this.current||this.dirty)&&(this.gl.depthFunc(h),this.current=h,this.dirty=!1)}}class zc extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;h?_.enable(_.BLEND):_.disable(_.BLEND),this.current=h,this.dirty=!1}}class Ws extends er{getDefault(){const h=this.gl;return[h.ONE,h.ZERO]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||this.dirty)&&(this.gl.blendFunc(h[0],h[1]),this.current=h,this.dirty=!1)}}class lc extends er{getDefault(){return i.Color.transparent}set(h){const _=this.current;(h.r!==_.r||h.g!==_.g||h.b!==_.b||h.a!==_.a||this.dirty)&&(this.gl.blendColor(h.r,h.g,h.b,h.a),this.current=h,this.dirty=!1)}}class kc extends er{getDefault(){return this.gl.FUNC_ADD}set(h){(h!==this.current||this.dirty)&&(this.gl.blendEquation(h),this.current=h,this.dirty=!1)}}class eA extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;h?_.enable(_.CULL_FACE):_.disable(_.CULL_FACE),this.current=h,this.dirty=!1}}class cc extends er{getDefault(){return this.gl.BACK}set(h){(h!==this.current||this.dirty)&&(this.gl.cullFace(h),this.current=h,this.dirty=!1)}}class mu extends er{getDefault(){return this.gl.CCW}set(h){(h!==this.current||this.dirty)&&(this.gl.frontFace(h),this.current=h,this.dirty=!1)}}class td extends er{getDefault(){return null}set(h){(h!==this.current||this.dirty)&&(this.gl.useProgram(h),this.current=h,this.dirty=!1)}}class gu extends er{getDefault(){return this.gl.TEXTURE0}set(h){(h!==this.current||this.dirty)&&(this.gl.activeTexture(h),this.current=h,this.dirty=!1)}}class Ih extends er{getDefault(){const h=this.gl;return[0,0,h.drawingBufferWidth,h.drawingBufferHeight]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||h[2]!==_[2]||h[3]!==_[3]||this.dirty)&&(this.gl.viewport(h[0],h[1],h[2],h[3]),this.current=h,this.dirty=!1)}}class tA extends er{getDefault(){return null}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.bindFramebuffer(_.FRAMEBUFFER,h),this.current=h,this.dirty=!1}}class id extends er{getDefault(){return null}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.bindRenderbuffer(_.RENDERBUFFER,h),this.current=h,this.dirty=!1}}class hc extends er{getDefault(){return null}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.bindTexture(_.TEXTURE_2D,h),this.current=h,this.dirty=!1}}class Oc extends er{getDefault(){return null}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.bindBuffer(_.ARRAY_BUFFER,h),this.current=h,this.dirty=!1}}class ul extends er{getDefault(){return null}set(h){const _=this.gl;_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,h),this.current=h,this.dirty=!1}}class Ir extends er{constructor(h){super(h),this.vao=h.extVertexArrayObject}getDefault(){return null}set(h){this.vao&&(h!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(h),this.current=h,this.dirty=!1)}}class uc extends er{getDefault(){return 4}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.pixelStorei(_.UNPACK_ALIGNMENT,h),this.current=h,this.dirty=!1}}class Nc extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h),this.current=h,this.dirty=!1}}class _u extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,h),this.current=h,this.dirty=!1}}class Al extends er{constructor(h,_){super(h),this.context=h,this.parent=_}getDefault(){return null}}class Ha extends Al{setDirty(){this.dirty=!0}set(h){if(h===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const _=this.gl;_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,h,0),this.current=h,this.dirty=!1}}class Qc extends Al{set(h){if(h===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const _=this.gl;_.framebufferRenderbuffer(_.FRAMEBUFFER,_.DEPTH_ATTACHMENT,_.RENDERBUFFER,h),this.current=h,this.dirty=!1}}class dl{constructor(h,_,T,F){this.context=h,this.width=_,this.height=T;const O=h.gl,K=this.framebuffer=O.createFramebuffer();if(this.colorAttachment=new Ha(h,K),F&&(this.depthAttachment=new Qc(h,K)),O.checkFramebufferStatus(O.FRAMEBUFFER)!==O.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const h=this.context.gl,_=this.colorAttachment.get();if(_&&h.deleteTexture(_),this.depthAttachment){const T=this.depthAttachment.get();T&&h.deleteRenderbuffer(T)}h.deleteFramebuffer(this.framebuffer)}}class qr{constructor(h,_,T){this.blendFunction=h,this.blendColor=_,this.mask=T}}qr.Replace=[1,0],qr.disabled=new qr(qr.Replace,i.Color.transparent,[!1,!1,!1,!1]),qr.unblended=new qr(qr.Replace,i.Color.transparent,[!0,!0,!0,!0]),qr.alphaBlended=new qr([1,771],i.Color.transparent,[!0,!0,!0,!0]);class Fh{constructor(h){this.gl=h,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new oc(this),this.clearDepth=new Ju(this),this.clearStencil=new Qo(this),this.colorMask=new hl(this),this.depthMask=new Sh(this),this.stencilMask=new Vo(this),this.stencilFunc=new Mh(this),this.stencilOp=new Va(this),this.stencilTest=new ac(this),this.depthRange=new fu(this),this.depthTest=new Vl(this),this.depthFunc=new ya(this),this.blend=new zc(this),this.blendFunc=new Ws(this),this.blendColor=new lc(this),this.blendEquation=new kc(this),this.cullFace=new eA(this),this.cullFaceSide=new cc(this),this.frontFace=new mu(this),this.program=new td(this),this.activeTexture=new gu(this),this.viewport=new Ih(this),this.bindFramebuffer=new tA(this),this.bindRenderbuffer=new id(this),this.bindTexture=new hc(this),this.bindVertexBuffer=new Oc(this),this.bindElementBuffer=new ul(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ir(this),this.pixelStoreUnpack=new uc(this),this.pixelStoreUnpackPremultiplyAlpha=new Nc(this),this.pixelStoreUnpackFlipY=new _u(this),this.extTextureFilterAnisotropic=h.getExtension("EXT_texture_filter_anisotropic")||h.getExtension("MOZ_EXT_texture_filter_anisotropic")||h.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=h.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=h.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(h.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=h.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=h.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=h.getParameter(h.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(h,_){return new rc(this,h,_)}createVertexBuffer(h,_,T){return new sc(this,h,_,T)}createRenderbuffer(h,_,T){const F=this.gl,O=F.createRenderbuffer();return this.bindRenderbuffer.set(O),F.renderbufferStorage(F.RENDERBUFFER,h,_,T),this.bindRenderbuffer.set(null),O}createFramebuffer(h,_,T){return new dl(this,h,_,T)}clear({color:h,depth:_}){const T=this.gl;let F=0;h&&(F|=T.COLOR_BUFFER_BIT,this.clearColor.set(h),this.colorMask.set([!0,!0,!0,!0])),_!==void 0&&(F|=T.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(_),this.depthMask.set(!0)),T.clear(F)}setCullFace(h){h.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(h.mode),this.frontFace.set(h.frontFace))}setDepthMode(h){h.func!==this.gl.ALWAYS||h.mask?(this.depthTest.set(!0),this.depthFunc.set(h.func),this.depthMask.set(h.mask),this.depthRange.set(h.range)):this.depthTest.set(!1)}setStencilMode(h){h.test.func!==this.gl.ALWAYS||h.mask?(this.stencilTest.set(!0),this.stencilMask.set(h.mask),this.stencilOp.set([h.fail,h.depthFail,h.pass]),this.stencilFunc.set({func:h.test.func,ref:h.ref,mask:h.test.mask})):this.stencilTest.set(!1)}setColorMode(h){N(h.blendFunction,qr.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(h.blendFunction),this.blendColor.set(h.blendColor)),this.colorMask.set(h.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class hr{constructor(h,_,T){this.func=h,this.mask=_,this.range=T}}hr.ReadOnly=!1,hr.ReadWrite=!0,hr.disabled=new hr(519,hr.ReadOnly,[0,1]);const Br=7680;class jr{constructor(h,_,T,F,O,K){this.test=h,this.ref=_,this.mask=T,this.fail=F,this.depthFail=O,this.pass=K}}jr.disabled=new jr({func:519,mask:0},0,0,Br,Br,Br);class $r{constructor(h,_,T){this.enable=h,this.mode=_,this.frontFace=T}}let Hl;function gr(M,h,_,T,F,O,K){const oe=M.context,ue=oe.gl,ve=M.useProgram("collisionBox"),Te=[];let ke=0,We=0;for(let St=0;St<T.length;St++){const zt=T[St],li=h.getTile(zt),Ei=li.getBucket(_);if(!Ei)continue;let bi=zt.posMatrix;F[0]===0&&F[1]===0||(bi=M.translatePosMatrix(zt.posMatrix,li,F,O));const Hi=K?Ei.textCollisionBox:Ei.iconCollisionBox,xi=Ei.collisionCircleArray;if(xi.length>0){const xn=i.create(),cn=bi;i.mul(xn,Ei.placementInvProjMatrix,M.transform.glCoordMatrix),i.mul(xn,xn,Ei.placementViewportMatrix),Te.push({circleArray:xi,circleOffset:We,transform:cn,invTransform:xn,coord:zt}),ke+=xi.length/4,We=ke}Hi&&ve.draw(oe,ue.LINES,hr.disabled,jr.disabled,M.colorModeForRenderPass(),$r.disabled,ho(bi,M.transform,li),M.style.terrain&&M.style.terrain.getTerrainData(zt),_.id,Hi.layoutVertexBuffer,Hi.indexBuffer,Hi.segments,null,M.transform.zoom,null,null,Hi.collisionVertexBuffer)}if(!K||!Te.length)return;const bt=M.useProgram("collisionCircle"),mt=new i.CollisionCircleLayoutArray;mt.resize(4*ke),mt._trim();let gt=0;for(const St of Te)for(let zt=0;zt<St.circleArray.length/4;zt++){const li=4*zt,Ei=St.circleArray[li+0],bi=St.circleArray[li+1],Hi=St.circleArray[li+2],xi=St.circleArray[li+3];mt.emplace(gt++,Ei,bi,Hi,xi,0),mt.emplace(gt++,Ei,bi,Hi,xi,1),mt.emplace(gt++,Ei,bi,Hi,xi,2),mt.emplace(gt++,Ei,bi,Hi,xi,3)}(!Hl||Hl.length<2*ke)&&(Hl=function(St){const zt=2*St,li=new i.QuadTriangleArray;li.resize(zt),li._trim();for(let Ei=0;Ei<zt;Ei++){const bi=6*Ei;li.uint16[bi+0]=4*Ei+0,li.uint16[bi+1]=4*Ei+1,li.uint16[bi+2]=4*Ei+2,li.uint16[bi+3]=4*Ei+2,li.uint16[bi+4]=4*Ei+3,li.uint16[bi+5]=4*Ei+0}return li}(ke));const Vt=oe.createIndexBuffer(Hl,!0),Zt=oe.createVertexBuffer(mt,i.collisionCircleLayout.members,!0);for(const St of Te){const zt={u_matrix:St.transform,u_inv_matrix:St.invTransform,u_camera_to_center_distance:(ni=M.transform).cameraToCenterDistance,u_viewport_size:[ni.width,ni.height]};bt.draw(oe,ue.TRIANGLES,hr.disabled,jr.disabled,M.colorModeForRenderPass(),$r.disabled,zt,M.style.terrain&&M.style.terrain.getTerrainData(St.coord),_.id,Zt,Vt,i.SegmentVector.simpleSegment(0,2*St.circleOffset,St.circleArray.length,St.circleArray.length/2),null,M.transform.zoom,null,null,null)}var ni;Zt.destroy(),Vt.destroy()}$r.disabled=new $r(!1,1029,2305),$r.backCCW=new $r(!0,1029,2305);const yu=i.identity(new Float32Array(16));function iA(M,h,_,T,F,O){const{horizontalAlign:K,verticalAlign:oe}=i.getAnchorAlignment(M),ue=-(K-.5)*h,ve=-(oe-.5)*_,Te=i.evaluateVariableOffset(M,T);return new i.pointGeometry((ue/F+Te[0])*O,(ve/F+Te[1])*O)}function nA(M,h,_,T,F,O,K,oe,ue,ve,Te){const ke=M.text.placedSymbolArray,We=M.text.dynamicLayoutVertexArray,bt=M.icon.dynamicLayoutVertexArray,mt={};We.clear();for(let gt=0;gt<ke.length;gt++){const Vt=ke.get(gt),Zt=M.allowVerticalPlacement&&!Vt.placedOrientation,ni=Vt.hidden||!Vt.crossTileID||Zt?null:T[Vt.crossTileID];if(ni){const St=new i.pointGeometry(Vt.anchorX,Vt.anchorY),zt=Xi(St,_?K:O,Te),li=on(F.cameraToCenterDistance,zt.signedDistanceFromCamera);let Ei=i.evaluateSizeForFeature(M.textSizeData,ue,Vt)*li/i.ONE_EM;_&&(Ei*=M.tilePixelRatio/oe);const{width:bi,height:Hi,anchor:xi,textOffset:xn,textBoxScale:cn}=ni,Bn=iA(xi,bi,Hi,xn,cn,Ei),tr=_?Xi(St.add(Bn),O,Te).point:zt.point.add(h?Bn.rotate(-F.angle):Bn),ur=M.allowVerticalPlacement&&Vt.placedOrientation===i.WritingMode.vertical?Math.PI/2:0;for(let Un=0;Un<Vt.numGlyphs;Un++)i.addDynamicAttributes(We,tr,ur);ve&&Vt.associatedIconIndex>=0&&(mt[Vt.associatedIconIndex]={shiftedAnchor:tr,angle:ur})}else Ui(Vt.numGlyphs,We)}if(ve){bt.clear();const gt=M.icon.placedSymbolArray;for(let Vt=0;Vt<gt.length;Vt++){const Zt=gt.get(Vt);if(Zt.hidden)Ui(Zt.numGlyphs,bt);else{const ni=mt[Vt];if(ni)for(let St=0;St<Zt.numGlyphs;St++)i.addDynamicAttributes(bt,ni.shiftedAnchor,ni.angle);else Ui(Zt.numGlyphs,bt)}}M.icon.dynamicLayoutVertexBuffer.updateData(bt)}M.text.dynamicLayoutVertexBuffer.updateData(We)}function rA(M,h,_){return _.iconsInText&&h?"symbolTextAndIcon":M?"symbolSDF":"symbolIcon"}function Ac(M,h,_,T,F,O,K,oe,ue,ve,Te,ke){const We=M.context,bt=We.gl,mt=M.transform,gt=oe==="map",Vt=ue==="map",Zt=oe!=="viewport"&&_.layout.get("symbol-placement")!=="point",ni=gt&&!Vt&&!Zt,St=!_.layout.get("symbol-sort-key").isConstant();let zt=!1;const li=M.depthModeForSublayer(0,hr.ReadOnly),Ei=_.layout.get("text-variable-anchor"),bi=[];for(const Hi of T){const xi=h.getTile(Hi),xn=xi.getBucket(_);if(!xn)continue;const cn=F?xn.text:xn.icon;if(!cn||!cn.segments.get().length)continue;const Bn=cn.programConfigurations.get(_.id),tr=F||xn.sdfIcons,ur=F?xn.textSizeData:xn.iconSizeData,Un=Vt||mt.pitch!==0,Lr=M.useProgram(rA(tr,F,xn),Bn),Rr=i.evaluateSizeForZoom(ur,mt.zoom),Cr=M.style.terrain&&M.style.terrain.getTerrainData(Hi);let Er,Gr,js,wa,Aa=[0,0],ba=null;if(F){if(Gr=xi.glyphAtlasTexture,js=bt.LINEAR,Er=xi.glyphAtlasTexture.size,xn.iconsInText){Aa=xi.imageAtlasTexture.size,ba=xi.imageAtlasTexture;const H=ur.kind==="composite"||ur.kind==="camera";wa=Un||M.options.rotating||M.options.zooming||H?bt.LINEAR:bt.NEAREST}}else{const H=_.layout.get("icon-size").constantOr(0)!==1||xn.iconsNeedLinear;Gr=xi.imageAtlasTexture,js=tr||M.options.rotating||M.options.zooming||H||Un?bt.LINEAR:bt.NEAREST,Er=xi.imageAtlasTexture.size}const ja=fr(xi,1,M.transform.zoom),Wo=ii(Hi.posMatrix,Vt,gt,M.transform,ja),mo=hn(Hi.posMatrix,Vt,gt,M.transform,ja),Ba=Ei&&xn.hasTextData(),$l=_.layout.get("icon-text-fit")!=="none"&&Ba&&xn.hasIconData();if(Zt){const H=M.style.terrain?(ee,pe)=>M.style.terrain.getElevation(Hi,ee,pe):null,W=_.layout.get("text-rotation-alignment")==="map";Tn(xn,Hi.posMatrix,M,F,Wo,mo,Vt,ve,W,H)}const x=M.translatePosMatrix(Hi.posMatrix,xi,O,K),a=Zt||F&&Ei||$l?yu:Wo,m=M.translatePosMatrix(mo,xi,O,K,!0),b=tr&&_.paint.get(F?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let S;S=tr?xn.iconsInText?No(ur.kind,Rr,ni,Vt,M,x,a,m,Er,Aa):Os(ur.kind,Rr,ni,Vt,M,x,a,m,F,Er,!0):Eh(ur.kind,Rr,ni,Vt,M,x,a,m,F,Er);const P={program:Lr,buffers:cn,uniformValues:S,atlasTexture:Gr,atlasTextureIcon:ba,atlasInterpolation:js,atlasInterpolationIcon:wa,isSDF:tr,hasHalo:b};if(St&&xn.canOverlap){zt=!0;const H=cn.segments.get();for(const W of H)bi.push({segments:new i.SegmentVector([W]),sortKey:W.sortKey,state:P,terrainData:Cr})}else bi.push({segments:cn.segments,sortKey:0,state:P,terrainData:Cr})}zt&&bi.sort((Hi,xi)=>Hi.sortKey-xi.sortKey);for(const Hi of bi){const xi=Hi.state;if(We.activeTexture.set(bt.TEXTURE0),xi.atlasTexture.bind(xi.atlasInterpolation,bt.CLAMP_TO_EDGE),xi.atlasTextureIcon&&(We.activeTexture.set(bt.TEXTURE1),xi.atlasTextureIcon&&xi.atlasTextureIcon.bind(xi.atlasInterpolationIcon,bt.CLAMP_TO_EDGE)),xi.isSDF){const xn=xi.uniformValues;xi.hasHalo&&(xn.u_is_halo=1,Vc(xi.buffers,Hi.segments,_,M,xi.program,li,Te,ke,xn,Hi.terrainData)),xn.u_is_halo=0}Vc(xi.buffers,Hi.segments,_,M,xi.program,li,Te,ke,xi.uniformValues,Hi.terrainData)}}function Vc(M,h,_,T,F,O,K,oe,ue,ve){const Te=T.context;F.draw(Te,Te.gl.TRIANGLES,O,K,oe,$r.disabled,ue,ve,_.id,M.layoutVertexBuffer,M.indexBuffer,h,_.paint,T.transform.zoom,M.programConfigurations.get(_.id),M.dynamicLayoutVertexBuffer,M.opacityVertexBuffer)}function Hc(M,h,_,T,F,O,K){const oe=M.context.gl,ue=_.paint.get("fill-pattern"),ve=ue&&ue.constantOr(1),Te=_.getCrossfadeParameters();let ke,We,bt,mt,gt;K?(We=ve&&!_.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",ke=oe.LINES):(We=ve?"fillPattern":"fill",ke=oe.TRIANGLES);for(const Vt of T){const Zt=h.getTile(Vt);if(ve&&!Zt.patternsLoaded())continue;const ni=Zt.getBucket(_);if(!ni)continue;const St=ni.programConfigurations.get(_.id),zt=M.useProgram(We,St),li=M.style.terrain&&M.style.terrain.getTerrainData(Vt);ve&&(M.context.activeTexture.set(oe.TEXTURE0),Zt.imageAtlasTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),St.updatePaintBuffers(Te));const Ei=ue.constantOr(null);if(Ei&&Zt.imageAtlas){const xi=Zt.imageAtlas,xn=xi.patternPositions[Ei.to.toString()],cn=xi.patternPositions[Ei.from.toString()];xn&&cn&&St.setConstantPatternPositions(xn,cn)}const bi=li?Vt:null,Hi=M.translatePosMatrix(bi?bi.posMatrix:Vt.posMatrix,Zt,_.paint.get("fill-translate"),_.paint.get("fill-translate-anchor"));if(K){mt=ni.indexBuffer2,gt=ni.segments2;const xi=[oe.drawingBufferWidth,oe.drawingBufferHeight];bt=We==="fillOutlinePattern"&&ve?qs(Hi,M,Te,Zt,xi):ll(Hi,xi)}else mt=ni.indexBuffer,gt=ni.segments,bt=ve?Rl(Hi,M,Te,Zt):Ul(Hi);zt.draw(M.context,ke,F,M.stencilModeForClipping(Vt),O,$r.disabled,bt,li,_.id,ni.layoutVertexBuffer,mt,gt,_.paint,M.transform.zoom,St)}}function Lh(M,h,_,T,F,O,K){const oe=M.context,ue=oe.gl,ve=_.paint.get("fill-extrusion-pattern"),Te=ve.constantOr(1),ke=_.getCrossfadeParameters(),We=_.paint.get("fill-extrusion-opacity");for(const bt of T){const mt=h.getTile(bt),gt=mt.getBucket(_);if(!gt)continue;const Vt=M.style.terrain&&M.style.terrain.getTerrainData(bt),Zt=gt.programConfigurations.get(_.id),ni=M.useProgram(Te?"fillExtrusionPattern":"fillExtrusion",Zt);Te&&(M.context.activeTexture.set(ue.TEXTURE0),mt.imageAtlasTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE),Zt.updatePaintBuffers(ke));const St=ve.constantOr(null);if(St&&mt.imageAtlas){const bi=mt.imageAtlas,Hi=bi.patternPositions[St.to.toString()],xi=bi.patternPositions[St.from.toString()];Hi&&xi&&Zt.setConstantPatternPositions(Hi,xi)}const zt=M.translatePosMatrix(bt.posMatrix,mt,_.paint.get("fill-extrusion-translate"),_.paint.get("fill-extrusion-translate-anchor")),li=_.paint.get("fill-extrusion-vertical-gradient"),Ei=Te?dr(zt,M,li,We,bt,ke,mt):al(zt,M,li,We);ni.draw(oe,oe.gl.TRIANGLES,F,O,K,$r.backCCW,Ei,Vt,_.id,gt.layoutVertexBuffer,gt.indexBuffer,gt.segments,_.paint,M.transform.zoom,Zt,M.style.terrain&>.centroidVertexBuffer)}}function Gc(M,h,_,T,F,O,K){const oe=M.context,ue=oe.gl,ve=_.fbo;if(!ve)return;const Te=M.useProgram("hillshade"),ke=M.style.terrain&&M.style.terrain.getTerrainData(h);oe.activeTexture.set(ue.TEXTURE0),ue.bindTexture(ue.TEXTURE_2D,ve.colorAttachment.get()),Te.draw(oe,ue.TRIANGLES,F,O,K,$r.disabled,((We,bt,mt,gt)=>{const Vt=mt.paint.get("hillshade-shadow-color"),Zt=mt.paint.get("hillshade-highlight-color"),ni=mt.paint.get("hillshade-accent-color");let St=mt.paint.get("hillshade-illumination-direction")*(Math.PI/180);mt.paint.get("hillshade-illumination-anchor")==="viewport"&&(St-=We.transform.angle);const zt=!We.options.moving;return{u_matrix:gt?gt.posMatrix:We.transform.calculatePosMatrix(bt.tileID.toUnwrapped(),zt),u_image:0,u_latrange:kl(0,bt.tileID),u_light:[mt.paint.get("hillshade-exaggeration"),St],u_shadow:Vt,u_highlight:Zt,u_accent:ni}})(M,_,T,ke?h:null),ke,T.id,M.rasterBoundsBuffer,M.quadTriangleIndexBuffer,M.rasterBoundsSegments)}function Dh(M,h,_,T,F,O){const K=M.context,oe=K.gl,ue=h.dem;if(ue&&ue.data){const ve=ue.dim,Te=ue.stride,ke=ue.getPixels();if(K.activeTexture.set(oe.TEXTURE1),K.pixelStoreUnpackPremultiplyAlpha.set(!1),h.demTexture=h.demTexture||M.getTileTexture(Te),h.demTexture){const bt=h.demTexture;bt.update(ke,{premultiply:!1}),bt.bind(oe.NEAREST,oe.CLAMP_TO_EDGE)}else h.demTexture=new Y(K,ke,oe.RGBA,{premultiply:!1}),h.demTexture.bind(oe.NEAREST,oe.CLAMP_TO_EDGE);K.activeTexture.set(oe.TEXTURE0);let We=h.fbo;if(!We){const bt=new Y(K,{width:ve,height:ve,data:null},oe.RGBA);bt.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),We=h.fbo=K.createFramebuffer(ve,ve,!0),We.colorAttachment.set(bt.texture)}K.bindFramebuffer.set(We.framebuffer),K.viewport.set([0,0,ve,ve]),M.useProgram("hillshadePrepare").draw(K,oe.TRIANGLES,T,F,O,$r.disabled,((bt,mt)=>{const gt=mt.stride,Vt=i.create();return i.ortho(Vt,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(Vt,Vt,[0,-i.EXTENT,0]),{u_matrix:Vt,u_image:1,u_dimension:[gt,gt],u_zoom:bt.overscaledZ,u_unpack:mt.getUnpackVector()}})(h.tileID,ue),null,_.id,M.rasterBoundsBuffer,M.quadTriangleIndexBuffer,M.rasterBoundsSegments),h.needsHillshadePrepare=!1}}function Wc(M,h,_,T,F,O){const K=T.paint.get("raster-fade-duration");if(!O&&K>0){const oe=i.exported.now(),ue=(oe-M.timeAdded)/K,ve=h?(oe-h.timeAdded)/K:-1,Te=_.getSource(),ke=F.coveringZoomLevel({tileSize:Te.tileSize,roundZoom:Te.roundZoom}),We=!h||Math.abs(h.tileID.overscaledZ-ke)>Math.abs(M.tileID.overscaledZ-ke),bt=We&&M.refreshedUponExpiration?1:i.clamp(We?ue:1-ve,0,1);return M.refreshedUponExpiration&&ue>=1&&(M.refreshedUponExpiration=!1),h?{opacity:1,mix:1-bt}:{opacity:bt,mix:0}}return{opacity:1,mix:0}}const jc=new i.Color(1,0,0,1),ca=new i.Color(0,1,0,1),sA=new i.Color(0,0,1,1),oA=new i.Color(1,0,1,1),Kc=new i.Color(0,1,1,1);function ha(M,h,_,T){pl(M,0,h+_/2,M.transform.width,_,T)}function $c(M,h,_,T){pl(M,h-_/2,0,_,M.transform.height,T)}function pl(M,h,_,T,F,O){const K=M.context,oe=K.gl;oe.enable(oe.SCISSOR_TEST),oe.scissor(h*M.pixelRatio,_*M.pixelRatio,T*M.pixelRatio,F*M.pixelRatio),K.clear({color:O}),oe.disable(oe.SCISSOR_TEST)}function aA(M,h,_){const T=M.context,F=T.gl,O=_.posMatrix,K=M.useProgram("debug"),oe=hr.disabled,ue=jr.disabled,ve=M.colorModeForRenderPass(),Te="$debug",ke=M.style.terrain&&M.style.terrain.getTerrainData(_);T.activeTexture.set(F.TEXTURE0),M.emptyTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE);const We=h.getTileByID(_.key).latestRawTileData,bt=Math.floor((We&&We.byteLength||0)/1024),mt=h.getTile(_).tileSize,gt=512/Math.min(mt,512)*(_.overscaledZ/M.transform.zoom)*.5;let Vt=_.canonical.toString();_.overscaledZ!==_.canonical.z&&(Vt+=` => ${_.overscaledZ}`),function(Zt,ni){Zt.initDebugOverlayCanvas();const St=Zt.debugOverlayCanvas,zt=Zt.context.gl,li=Zt.debugOverlayCanvas.getContext("2d");li.clearRect(0,0,St.width,St.height),li.shadowColor="white",li.shadowBlur=2,li.lineWidth=1.5,li.strokeStyle="white",li.textBaseline="top",li.font="bold 36px Open Sans, sans-serif",li.fillText(ni,5,5),li.strokeText(ni,5,5),Zt.debugOverlayTexture.update(St),Zt.debugOverlayTexture.bind(zt.LINEAR,zt.CLAMP_TO_EDGE)}(M,`${Vt} ${bt}kB`),K.draw(T,F.TRIANGLES,oe,ue,qr.alphaBlended,$r.disabled,cl(O,i.Color.transparent,gt),null,Te,M.debugBuffer,M.quadTriangleIndexBuffer,M.debugSegments),K.draw(T,F.LINE_STRIP,oe,ue,ve,$r.disabled,cl(O,i.Color.red),ke,Te,M.debugBuffer,M.tileBorderIndexBuffer,M.debugSegments)}function Ho(M,h,_){const T=M.context,F=T.gl,O=M.colorModeForRenderPass(),K=new hr(F.LEQUAL,hr.ReadWrite,M.depthRangeFor3D),oe=M.useProgram("terrain"),ue=h.getTerrainMesh(),ve=h.getTerrainData(_.tileID);T.bindFramebuffer.set(null),T.viewport.set([0,0,M.width,M.height]),T.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,h.getRTTFramebuffer().colorAttachment.get());const Te=M.transform.calculatePosMatrix(_.tileID.toUnwrapped());oe.draw(T,F.TRIANGLES,K,jr.disabled,O,$r.backCCW,{u_matrix:Te,u_texture:0},ve,"terrain",ue.vertexBuffer,ue.indexBuffer,ue.segments)}function Ph(M,h,_,T){const F=M.context,O=_.tileSize*h.qualityFactor;_.textures[T]||(_.textures[T]=M.getTileTexture(O)||new Y(F,{width:O,height:O,data:null},F.gl.RGBA),_.textures[T].bind(F.gl.LINEAR,F.gl.CLAMP_TO_EDGE),T===0&&h.sourceCache.renderHistory.unshift(_.tileID.key));const K=h.getRTTFramebuffer();K.colorAttachment.set(_.textures[T].texture),F.bindFramebuffer.set(K.framebuffer),F.viewport.set([0,0,O,O])}class xu{constructor(h){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=h,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=h.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const h=this.painter.style,_=h.terrain;for(const T in h.sourceCaches){this._coordsDescendingInv[T]={};const F=h.sourceCaches[T].getVisibleCoordinates();for(const O of F){const K=_.sourceCache.getTerrainCoords(O);for(const oe in K)this._coordsDescendingInv[T][oe]||(this._coordsDescendingInv[T][oe]=[]),this._coordsDescendingInv[T][oe].push(K[oe])}}for(const T of h._order){const F=h._layers[T],O=F.source;if(this._renderToTexture[F.type]&&!this._coordsDescendingInvStr[O]){this._coordsDescendingInvStr[O]={};for(const K in this._coordsDescendingInv[O])this._coordsDescendingInvStr[O][K]=this._coordsDescendingInv[O][K].map(oe=>oe.key).sort().join()}}return this._renderableTiles.forEach(T=>{for(const F in this._coordsDescendingInvStr){const O=this._coordsDescendingInvStr[F][T.tileID.key];O&&O!==T.textureCoords[F]&&T.clearTextures(this.painter),_.needsRerender(F,T.tileID)&&T.clearTextures(this.painter)}this._rerender[T.tileID.key]=!T.textures.length}),_.clearRerenderCache(),_.sourceCache.removeOutdated(this.painter),this}renderLayer(h){const _=h.type,T=this.painter,F=T.style._order,O=T.currentLayer,K=O+1===F.length;if(this._renderToTexture[_]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=_,this._stacks[this._stacks.length-1].push(F[O]),!K))return!0;if(this._renderToTexture[this._prevType]||_==="hillshade"||this._renderToTexture[_]&&K){this._prevType=_;const oe=this._stacks.length-1,ue=this._stacks[oe]||[];for(const ve of this._renderableTiles){if(Ph(T,T.style.terrain,ve,oe),this._rerender[ve.tileID.key]){T.context.clear({color:i.Color.transparent});for(let Te=0;Te<ue.length;Te++){const ke=T.style._layers[ue[Te]],We=ke.source?this._coordsDescendingInv[ke.source][ve.tileID.key]:[ve.tileID];T._renderTileClippingMasks(ke,We),T.renderLayer(T,T.style.sourceCaches[ke.source],ke,We),ke.source&&(ve.textureCoords[ke.source]=this._coordsDescendingInvStr[ke.source][ve.tileID.key])}}Ho(T,T.style.terrain,ve)}if(_==="hillshade"){this._stacks.push([F[O]]);for(const ve of this._renderableTiles){const Te=this._coordsDescendingInv[h.source][ve.tileID.key];Ph(T,T.style.terrain,ve,this._stacks.length-1),T.context.clear({color:i.Color.transparent}),T._renderTileClippingMasks(h,Te),T.renderLayer(T,T.style.sourceCaches[h.source],h,Te),Ho(T,T.style.terrain,ve)}return!0}return this._renderToTexture[_]}return!1}}const Gl={symbol:function(M,h,_,T,F){if(M.renderPass!=="translucent")return;const O=jr.disabled,K=M.colorModeForRenderPass();_.layout.get("text-variable-anchor")&&function(oe,ue,ve,Te,ke,We,bt){const mt=ue.transform,gt=ke==="map",Vt=We==="map";for(const Zt of oe){const ni=Te.getTile(Zt),St=ni.getBucket(ve);if(!St||!St.text||!St.text.segments.get().length)continue;const zt=i.evaluateSizeForZoom(St.textSizeData,mt.zoom),li=fr(ni,1,ue.transform.zoom),Ei=ii(Zt.posMatrix,Vt,gt,ue.transform,li),bi=ve.layout.get("icon-text-fit")!=="none"&&St.hasIconData();if(zt){const Hi=Math.pow(2,mt.zoom-ni.tileID.overscaledZ);nA(St,gt,Vt,bt,mt,Ei,Zt.posMatrix,Hi,zt,bi,ue.style.terrain?(xi,xn)=>ue.style.terrain.getElevation(Zt,xi,xn):null)}}}(T,M,_,h,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),F),_.paint.get("icon-opacity").constantOr(1)!==0&&Ac(M,h,_,T,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),O,K),_.paint.get("text-opacity").constantOr(1)!==0&&Ac(M,h,_,T,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),O,K),h.map.showCollisionBoxes&&(gr(M,h,_,T,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),!0),gr(M,h,_,T,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),!1))},circle:function(M,h,_,T){if(M.renderPass!=="translucent")return;const F=_.paint.get("circle-opacity"),O=_.paint.get("circle-stroke-width"),K=_.paint.get("circle-stroke-opacity"),oe=!_.layout.get("circle-sort-key").isConstant();if(F.constantOr(1)===0&&(O.constantOr(1)===0||K.constantOr(1)===0))return;const ue=M.context,ve=ue.gl,Te=M.depthModeForSublayer(0,hr.ReadOnly),ke=jr.disabled,We=M.colorModeForRenderPass(),bt=[];for(let mt=0;mt<T.length;mt++){const gt=T[mt],Vt=h.getTile(gt),Zt=Vt.getBucket(_);if(!Zt)continue;const ni=Zt.programConfigurations.get(_.id),St=M.useProgram("circle",ni),zt=Zt.layoutVertexBuffer,li=Zt.indexBuffer,Ei=M.style.terrain&&M.style.terrain.getTerrainData(gt),bi={programConfiguration:ni,program:St,layoutVertexBuffer:zt,indexBuffer:li,uniformValues:hs(M,gt,Vt,_),terrainData:Ei};if(oe){const Hi=Zt.segments.get();for(const xi of Hi)bt.push({segments:new i.SegmentVector([xi]),sortKey:xi.sortKey,state:bi})}else bt.push({segments:Zt.segments,sortKey:0,state:bi})}oe&&bt.sort((mt,gt)=>mt.sortKey-gt.sortKey);for(const mt of bt){const{programConfiguration:gt,program:Vt,layoutVertexBuffer:Zt,indexBuffer:ni,uniformValues:St,terrainData:zt}=mt.state;Vt.draw(ue,ve.TRIANGLES,Te,ke,We,$r.disabled,St,zt,_.id,Zt,ni,mt.segments,_.paint,M.transform.zoom,gt)}},heatmap:function(M,h,_,T){if(_.paint.get("heatmap-opacity")!==0)if(M.renderPass==="offscreen"){const F=M.context,O=F.gl,K=jr.disabled,oe=new qr([O.ONE,O.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(ue,ve,Te){const ke=ue.gl;ue.activeTexture.set(ke.TEXTURE1),ue.viewport.set([0,0,ve.width/4,ve.height/4]);let We=Te.heatmapFbo;if(We)ke.bindTexture(ke.TEXTURE_2D,We.colorAttachment.get()),ue.bindFramebuffer.set(We.framebuffer);else{const bt=ke.createTexture();ke.bindTexture(ke.TEXTURE_2D,bt),ke.texParameteri(ke.TEXTURE_2D,ke.TEXTURE_WRAP_S,ke.CLAMP_TO_EDGE),ke.texParameteri(ke.TEXTURE_2D,ke.TEXTURE_WRAP_T,ke.CLAMP_TO_EDGE),ke.texParameteri(ke.TEXTURE_2D,ke.TEXTURE_MIN_FILTER,ke.LINEAR),ke.texParameteri(ke.TEXTURE_2D,ke.TEXTURE_MAG_FILTER,ke.LINEAR),We=Te.heatmapFbo=ue.createFramebuffer(ve.width/4,ve.height/4,!1),function(mt,gt,Vt,Zt){const ni=mt.gl;ni.texImage2D(ni.TEXTURE_2D,0,ni.RGBA,gt.width/4,gt.height/4,0,ni.RGBA,mt.extRenderToTextureHalfFloat?mt.extTextureHalfFloat.HALF_FLOAT_OES:ni.UNSIGNED_BYTE,null),Zt.colorAttachment.set(Vt)}(ue,ve,bt,We)}})(F,M,_),F.clear({color:i.Color.transparent});for(let ue=0;ue<T.length;ue++){const ve=T[ue];if(h.hasRenderableParent(ve))continue;const Te=h.getTile(ve),ke=Te.getBucket(_);if(!ke)continue;const We=ke.programConfigurations.get(_.id),bt=M.useProgram("heatmap",We),{zoom:mt}=M.transform;bt.draw(F,O.TRIANGLES,hr.disabled,K,oe,$r.disabled,zl(ve.posMatrix,Te,mt,_.paint.get("heatmap-intensity")),null,_.id,ke.layoutVertexBuffer,ke.indexBuffer,ke.segments,_.paint,M.transform.zoom,We)}F.viewport.set([0,0,M.width,M.height])}else M.renderPass==="translucent"&&(M.context.setColorMode(M.colorModeForRenderPass()),function(F,O){const K=F.context,oe=K.gl,ue=O.heatmapFbo;if(!ue)return;K.activeTexture.set(oe.TEXTURE0),oe.bindTexture(oe.TEXTURE_2D,ue.colorAttachment.get()),K.activeTexture.set(oe.TEXTURE1);let ve=O.colorRampTexture;ve||(ve=O.colorRampTexture=new Y(K,O.colorRamp,oe.RGBA)),ve.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),F.useProgram("heatmapTexture").draw(K,oe.TRIANGLES,hr.disabled,jr.disabled,F.colorModeForRenderPass(),$r.disabled,((Te,ke,We,bt)=>{const mt=i.create();i.ortho(mt,0,Te.width,Te.height,0,0,1);const gt=Te.context.gl;return{u_matrix:mt,u_world:[gt.drawingBufferWidth,gt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:ke.paint.get("heatmap-opacity")}})(F,O),null,O.id,F.viewportBuffer,F.quadTriangleIndexBuffer,F.viewportSegments,O.paint,F.transform.zoom)}(M,_))},line:function(M,h,_,T){if(M.renderPass!=="translucent")return;const F=_.paint.get("line-opacity"),O=_.paint.get("line-width");if(F.constantOr(1)===0||O.constantOr(1)===0)return;const K=M.depthModeForSublayer(0,hr.ReadOnly),oe=M.colorModeForRenderPass(),ue=_.paint.get("line-dasharray"),ve=_.paint.get("line-pattern"),Te=ve.constantOr(1),ke=_.paint.get("line-gradient"),We=_.getCrossfadeParameters(),bt=Te?"linePattern":ue?"lineSDF":ke?"lineGradient":"line",mt=M.context,gt=mt.gl;let Vt=!0;for(const Zt of T){const ni=h.getTile(Zt);if(Te&&!ni.patternsLoaded())continue;const St=ni.getBucket(_);if(!St)continue;const zt=St.programConfigurations.get(_.id),li=M.context.program.get(),Ei=M.useProgram(bt,zt),bi=Vt||Ei.program!==li,Hi=M.style.terrain&&M.style.terrain.getTerrainData(Zt),xi=ve.constantOr(null);if(xi&&ni.imageAtlas){const Bn=ni.imageAtlas,tr=Bn.patternPositions[xi.to.toString()],ur=Bn.patternPositions[xi.from.toString()];tr&&ur&&zt.setConstantPatternPositions(tr,ur)}const xn=Hi?Zt:null,cn=Te?Nl(M,ni,_,We,xn):ue?Ql(M,ni,_,ue,We,xn):ke?Qa(M,ni,_,St.lineClipsArray.length,xn):Ol(M,ni,_,xn);if(Te)mt.activeTexture.set(gt.TEXTURE0),ni.imageAtlasTexture.bind(gt.LINEAR,gt.CLAMP_TO_EDGE),zt.updatePaintBuffers(We);else if(ue&&(bi||M.lineAtlas.dirty))mt.activeTexture.set(gt.TEXTURE0),M.lineAtlas.bind(mt);else if(ke){const Bn=St.gradients[_.id];let tr=Bn.texture;if(_.gradientVersion!==Bn.version){let ur=256;if(_.stepInterpolant){const Un=h.getSource().maxzoom,Lr=Zt.canonical.z===Un?Math.ceil(1<<M.transform.maxZoom-Zt.canonical.z):1;ur=i.clamp(i.nextPowerOfTwo(St.maxLineLength/i.EXTENT*1024*Lr),256,mt.maxTextureSize)}Bn.gradient=i.renderColorRamp({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:ur,image:Bn.gradient||void 0,clips:St.lineClipsArray}),Bn.texture?Bn.texture.update(Bn.gradient):Bn.texture=new Y(mt,Bn.gradient,gt.RGBA),Bn.version=_.gradientVersion,tr=Bn.texture}mt.activeTexture.set(gt.TEXTURE0),tr.bind(_.stepInterpolant?gt.NEAREST:gt.LINEAR,gt.CLAMP_TO_EDGE)}Ei.draw(mt,gt.TRIANGLES,K,M.stencilModeForClipping(Zt),oe,$r.disabled,cn,Hi,_.id,St.layoutVertexBuffer,St.indexBuffer,St.segments,_.paint,M.transform.zoom,zt,St.layoutVertexBuffer2),Vt=!1}},fill:function(M,h,_,T){const F=_.paint.get("fill-color"),O=_.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const K=M.colorModeForRenderPass(),oe=_.paint.get("fill-pattern"),ue=M.opaquePassEnabledForLayer()&&!oe.constantOr(1)&&F.constantOr(i.Color.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";if(M.renderPass===ue){const ve=M.depthModeForSublayer(1,M.renderPass==="opaque"?hr.ReadWrite:hr.ReadOnly);Hc(M,h,_,T,ve,K,!1)}if(M.renderPass==="translucent"&&_.paint.get("fill-antialias")){const ve=M.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,hr.ReadOnly);Hc(M,h,_,T,ve,K,!0)}},"fill-extrusion":function(M,h,_,T){const F=_.paint.get("fill-extrusion-opacity");if(F!==0&&M.renderPass==="translucent"){const O=new hr(M.context.gl.LEQUAL,hr.ReadWrite,M.depthRangeFor3D);if(F!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))Lh(M,h,_,T,O,jr.disabled,qr.disabled),Lh(M,h,_,T,O,M.stencilModeFor3D(),M.colorModeForRenderPass());else{const K=M.colorModeForRenderPass();Lh(M,h,_,T,O,jr.disabled,K)}}},hillshade:function(M,h,_,T){if(M.renderPass!=="offscreen"&&M.renderPass!=="translucent")return;const F=M.context,O=M.depthModeForSublayer(0,hr.ReadOnly),K=M.colorModeForRenderPass(),[oe,ue]=M.renderPass==="translucent"?M.stencilConfigForOverlap(T):[{},T];for(const ve of ue){const Te=h.getTile(ve);Te.needsHillshadePrepare!==void 0&&Te.needsHillshadePrepare&&M.renderPass==="offscreen"?Dh(M,Te,_,O,jr.disabled,K):M.renderPass==="translucent"&&Gc(M,ve,Te,_,O,oe[ve.overscaledZ],K)}F.viewport.set([0,0,M.width,M.height])},raster:function(M,h,_,T){if(M.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!T.length)return;const F=M.context,O=F.gl,K=h.getSource(),oe=M.useProgram("raster"),ue=M.colorModeForRenderPass(),[ve,Te]=K instanceof Ge?[{},T]:M.stencilConfigForOverlap(T),ke=Te[Te.length-1].overscaledZ,We=!M.options.moving;for(const bt of Te){const mt=M.depthModeForSublayer(bt.overscaledZ-ke,_.paint.get("raster-opacity")===1?hr.ReadWrite:hr.ReadOnly,O.LESS),gt=h.getTile(bt);gt.registerFadeDuration(_.paint.get("raster-fade-duration"));const Vt=h.findLoadedParent(bt,0),Zt=Wc(gt,Vt,h,_,M.transform,M.style.terrain);let ni,St;const zt=_.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;F.activeTexture.set(O.TEXTURE0),gt.texture.bind(zt,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),F.activeTexture.set(O.TEXTURE1),Vt?(Vt.texture.bind(zt,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),ni=Math.pow(2,Vt.tileID.overscaledZ-gt.tileID.overscaledZ),St=[gt.tileID.canonical.x*ni%1,gt.tileID.canonical.y*ni%1]):gt.texture.bind(zt,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST);const li=M.style.terrain&&M.style.terrain.getTerrainData(bt),Ei=li?bt:null,bi=Ei?Ei.posMatrix:M.transform.calculatePosMatrix(bt.toUnwrapped(),We),Hi=fs(bi,St||[0,0],ni||1,Zt,_);K instanceof Ge?oe.draw(F,O.TRIANGLES,mt,jr.disabled,ue,$r.disabled,Hi,li,_.id,K.boundsBuffer,M.quadTriangleIndexBuffer,K.boundsSegments):oe.draw(F,O.TRIANGLES,mt,ve[bt.overscaledZ],ue,$r.disabled,Hi,li,_.id,M.rasterBoundsBuffer,M.quadTriangleIndexBuffer,M.rasterBoundsSegments)}},background:function(M,h,_,T){const F=_.paint.get("background-color"),O=_.paint.get("background-opacity");if(O===0)return;const K=M.context,oe=K.gl,ue=M.transform,ve=ue.tileSize,Te=_.paint.get("background-pattern");if(M.isPatternMissing(Te))return;const ke=!Te&&F.a===1&&O===1&&M.opaquePassEnabledForLayer()?"opaque":"translucent";if(M.renderPass!==ke)return;const We=jr.disabled,bt=M.depthModeForSublayer(0,ke==="opaque"?hr.ReadWrite:hr.ReadOnly),mt=M.colorModeForRenderPass(),gt=M.useProgram(Te?"backgroundPattern":"background"),Vt=T||ue.coveringTiles({tileSize:ve,terrain:M.style.terrain});Te&&(K.activeTexture.set(oe.TEXTURE0),M.imageManager.bind(M.context));const Zt=_.getCrossfadeParameters();for(const ni of Vt){const St=T?ni.posMatrix:M.transform.calculatePosMatrix(ni.toUnwrapped()),zt=Te?pu(St,O,M,Te,{tileID:ni,tileSize:ve},Zt):ed(St,O,F),li=M.style.terrain&&M.style.terrain.getTerrainData(ni);gt.draw(K,oe.TRIANGLES,bt,We,mt,$r.disabled,zt,li,_.id,M.tileExtentBuffer,M.quadTriangleIndexBuffer,M.tileExtentSegments)}},debug:function(M,h,_){for(let T=0;T<_.length;T++)aA(M,h,_[T])},custom:function(M,h,_){const T=M.context,F=_.implementation;if(M.renderPass==="offscreen"){const O=F.prerender;O&&(M.setCustomLayerDefaults(),T.setColorMode(M.colorModeForRenderPass()),O.call(F,T.gl,M.transform.customLayerMatrix()),T.setDirty(),M.setBaseState())}else if(M.renderPass==="translucent"){M.setCustomLayerDefaults(),T.setColorMode(M.colorModeForRenderPass()),T.setStencilMode(jr.disabled);const O=F.renderingMode==="3d"?new hr(M.context.gl.LEQUAL,hr.ReadWrite,M.depthRangeFor3D):M.depthModeForSublayer(0,hr.ReadOnly);T.setDepthMode(O),F.render(T.gl,M.transform.customLayerMatrix()),T.setDirty(),M.setBaseState(),T.bindFramebuffer.set(null)}}};class vu{constructor(h,_){this.context=new Fh(h),this.transform=_,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:i.create(),renderTime:0},this.setup(),this.numSublayers=Qt.maxUnderzooming+Qt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new tn,this.gpuTimers={}}resize(h,_,T){if(this.width=h*T,this.height=_*T,this.pixelRatio=T,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const F of this.style._order)this.style._layers[F].resize()}setup(){const h=this.context,_=new i.PosArray;_.emplaceBack(0,0),_.emplaceBack(i.EXTENT,0),_.emplaceBack(0,i.EXTENT),_.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=h.createVertexBuffer(_,rr.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);const T=new i.PosArray;T.emplaceBack(0,0),T.emplaceBack(i.EXTENT,0),T.emplaceBack(0,i.EXTENT),T.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=h.createVertexBuffer(T,rr.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);const F=new i.RasterBoundsArray;F.emplaceBack(0,0,0,0),F.emplaceBack(i.EXTENT,0,i.EXTENT,0),F.emplaceBack(0,i.EXTENT,0,i.EXTENT),F.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.rasterBoundsBuffer=h.createVertexBuffer(F,Ne.members),this.rasterBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);const O=new i.PosArray;O.emplaceBack(0,0),O.emplaceBack(1,0),O.emplaceBack(0,1),O.emplaceBack(1,1),this.viewportBuffer=h.createVertexBuffer(O,rr.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);const K=new i.LineStripIndexArray;K.emplaceBack(0),K.emplaceBack(1),K.emplaceBack(3),K.emplaceBack(2),K.emplaceBack(0),this.tileBorderIndexBuffer=h.createIndexBuffer(K);const oe=new i.TriangleIndexArray;oe.emplaceBack(0,1,2),oe.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=h.createIndexBuffer(oe),this.emptyTexture=new Y(h,{width:1,height:1,data:new Uint8Array([0,0,0,0])},h.gl.RGBA);const ue=this.context.gl;this.stencilClearMode=new jr({func:ue.ALWAYS,mask:0},0,255,ue.ZERO,ue.ZERO,ue.ZERO)}clearStencil(){const h=this.context,_=h.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const T=i.create();i.ortho(T,0,this.width,this.height,0,0,1),i.scale(T,T,[_.drawingBufferWidth,_.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(h,_.TRIANGLES,hr.disabled,this.stencilClearMode,qr.disabled,$r.disabled,Na(T),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(h,_){if(this.currentStencilSource===h.source||!h.isTileClipped()||!_||!_.length)return;this.currentStencilSource=h.source;const T=this.context,F=T.gl;this.nextStencilID+_.length>256&&this.clearStencil(),T.setColorMode(qr.disabled),T.setDepthMode(hr.disabled);const O=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const K of _){const oe=this._tileClippingMaskIDs[K.key]=this.nextStencilID++,ue=this.style.terrain&&this.style.terrain.getTerrainData(K);O.draw(T,F.TRIANGLES,hr.disabled,new jr({func:F.ALWAYS,mask:0},oe,255,F.KEEP,F.KEEP,F.REPLACE),qr.disabled,$r.disabled,Na(K.posMatrix),ue,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const h=this.nextStencilID++,_=this.context.gl;return new jr({func:_.NOTEQUAL,mask:255},h,255,_.KEEP,_.KEEP,_.REPLACE)}stencilModeForClipping(h){const _=this.context.gl;return new jr({func:_.EQUAL,mask:255},this._tileClippingMaskIDs[h.key],0,_.KEEP,_.KEEP,_.REPLACE)}stencilConfigForOverlap(h){const _=this.context.gl,T=h.sort((K,oe)=>oe.overscaledZ-K.overscaledZ),F=T[T.length-1].overscaledZ,O=T[0].overscaledZ-F+1;if(O>1){this.currentStencilSource=void 0,this.nextStencilID+O>256&&this.clearStencil();const K={};for(let oe=0;oe<O;oe++)K[oe+F]=new jr({func:_.GEQUAL,mask:255},oe+this.nextStencilID,255,_.KEEP,_.KEEP,_.REPLACE);return this.nextStencilID+=O,[K,T]}return[{[F]:jr.disabled},T]}colorModeForRenderPass(){const h=this.context.gl;return this._showOverdrawInspector?new qr([h.CONSTANT_COLOR,h.ONE],new i.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?qr.unblended:qr.alphaBlended}depthModeForSublayer(h,_,T){if(!this.opaquePassEnabledForLayer())return hr.disabled;const F=1-((1+this.currentLayer)*this.numSublayers+h)*this.depthEpsilon;return new hr(T||this.context.gl.LEQUAL,_,[F,F])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(h,_){this.style=h,this.options=_,this.lineAtlas=h.lineAtlas,this.imageManager=h.imageManager,this.glyphManager=h.glyphManager,this.symbolFadeChange=h.placement.symbolFadeChange(i.exported.now()),this.imageManager.beginFrame();const T=this.style._order,F=this.style.sourceCaches,O=this.style.terrain&&new xu(this);for(const ve in F){const Te=F[ve];Te.used&&Te.prepare(this.context)}const K={},oe={},ue={};for(const ve in F){const Te=F[ve];K[ve]=Te.getVisibleCoordinates(),oe[ve]=K[ve].slice().reverse(),ue[ve]=Te.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let ve=0;ve<T.length;ve++)if(this.style._layers[T[ve]].is3D()){this.opaquePassCutoff=ve;break}if(O){this.opaquePassCutoff=0;const ve=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!i.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||ve.length)&&(i.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(Te,ke){const We=Te.context,bt=We.gl,mt=qr.unblended,gt=new hr(bt.LEQUAL,hr.ReadWrite,[0,1]),Vt=ke.getTerrainMesh(),Zt=ke.sourceCache.getRenderableTiles(),ni=Te.useProgram("terrainDepth");We.bindFramebuffer.set(ke.getFramebuffer("depth").framebuffer),We.viewport.set([0,0,Te.width/devicePixelRatio,Te.height/devicePixelRatio]),We.clear({color:i.Color.transparent,depth:1});for(const St of Zt){const zt=ke.getTerrainData(St.tileID),li=Te.transform.calculatePosMatrix(St.tileID.toUnwrapped());ni.draw(We,bt.TRIANGLES,gt,jr.disabled,mt,$r.backCCW,{u_matrix:li},zt,"terrain",Vt.vertexBuffer,Vt.indexBuffer,Vt.segments)}We.bindFramebuffer.set(null),We.viewport.set([0,0,Te.width,Te.height])}(this,this.style.terrain),function(Te,ke){const We=Te.context,bt=We.gl,mt=qr.unblended,gt=new hr(bt.LEQUAL,hr.ReadWrite,[0,1]),Vt=ke.getTerrainMesh(),Zt=ke.getCoordsTexture(),ni=ke.sourceCache.getRenderableTiles(),St=Te.useProgram("terrainCoords");We.bindFramebuffer.set(ke.getFramebuffer("coords").framebuffer),We.viewport.set([0,0,Te.width/devicePixelRatio,Te.height/devicePixelRatio]),We.clear({color:i.Color.transparent,depth:1}),ke.coordsIndex=[];for(const zt of ni){const li=ke.getTerrainData(zt.tileID);We.activeTexture.set(bt.TEXTURE0),bt.bindTexture(bt.TEXTURE_2D,Zt.texture);const Ei=Te.transform.calculatePosMatrix(zt.tileID.toUnwrapped());St.draw(We,bt.TRIANGLES,gt,jr.disabled,mt,$r.backCCW,{u_matrix:Ei,u_terrain_coords_id:(255-ke.coordsIndex.length)/255,u_texture:0},li,"terrain",Vt.vertexBuffer,Vt.indexBuffer,Vt.segments),ke.coordsIndex.push(zt.tileID.key)}We.bindFramebuffer.set(null),We.viewport.set([0,0,Te.width,Te.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const ve of T){const Te=this.style._layers[ve];if(!Te.hasOffscreenPass()||Te.isHidden(this.transform.zoom))continue;const ke=oe[Te.source];(Te.type==="custom"||ke.length)&&this.renderLayer(this,F[Te.source],Te,ke)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:_.showOverdrawInspector?i.Color.black:i.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=_.showOverdrawInspector,this.depthRangeFor3D=[0,1-(h._order.length+2)*this.numSublayers*this.depthEpsilon],!O)for(this.renderPass="opaque",this.currentLayer=T.length-1;this.currentLayer>=0;this.currentLayer--){const ve=this.style._layers[T[this.currentLayer]],Te=F[ve.source],ke=K[ve.source];this._renderTileClippingMasks(ve,ke),this.renderLayer(this,Te,ve,ke)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<T.length;this.currentLayer++){const ve=this.style._layers[T[this.currentLayer]],Te=F[ve.source];if(O&&O.renderLayer(ve))continue;const ke=(ve.type==="symbol"?ue:oe)[ve.source];this._renderTileClippingMasks(ve,K[ve.source]),this.renderLayer(this,Te,ve,ke)}if(this.options.showTileBoundaries){let ve,Te;Object.values(this.style._layers).forEach(ke=>{ke.source&&!ke.isHidden(this.transform.zoom)&&(ke.source!==(Te&&Te.id)&&(Te=this.style.sourceCaches[ke.source]),(!ve||ve.getSource().maxzoom<Te.getSource().maxzoom)&&(ve=Te))}),ve&&Gl.debug(this,ve,ve.getVisibleCoordinates())}this.options.showPadding&&function(ve){const Te=ve.transform.padding;ha(ve,ve.transform.height-(Te.top||0),3,jc),ha(ve,Te.bottom||0,3,ca),$c(ve,Te.left||0,3,sA),$c(ve,ve.transform.width-(Te.right||0),3,oA);const ke=ve.transform.centerPoint;(function(We,bt,mt,gt){pl(We,bt-1,mt-10,2,20,gt),pl(We,bt-10,mt-1,20,2,gt)})(ve,ke.x,ve.transform.height-ke.y,Kc)}(this),this.context.setDefault()}renderLayer(h,_,T,F){T.isHidden(this.transform.zoom)||(T.type==="background"||T.type==="custom"||(F||[]).length)&&(this.id=T.id,this.gpuTimingStart(T),Gl[T.type](h,_,T,F,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(h){if(!this.options.gpuTiming)return;const _=this.context.extTimerQuery;let T=this.gpuTimers[h.id];T||(T=this.gpuTimers[h.id]={calls:0,cpuTime:0,query:_.createQueryEXT()}),T.calls++,_.beginQueryEXT(_.TIME_ELAPSED_EXT,T.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const h=this.context.extTimerQuery;h.endQueryEXT(h.TIME_ELAPSED_EXT)}collectGpuTimers(){const h=this.gpuTimers;return this.gpuTimers={},h}queryGpuTimers(h){const _={};for(const T in h){const F=h[T],O=this.context.extTimerQuery,K=O.getQueryObjectEXT(F.query,O.QUERY_RESULT_EXT)/1e6;O.deleteQueryEXT(F.query),_[T]=K}return _}translatePosMatrix(h,_,T,F,O){if(!T[0]&&!T[1])return h;const K=O?F==="map"?this.transform.angle:0:F==="viewport"?-this.transform.angle:0;if(K){const ve=Math.sin(K),Te=Math.cos(K);T=[T[0]*Te-T[1]*ve,T[0]*ve+T[1]*Te]}const oe=[O?T[0]:fr(_,T[0],this.transform.zoom),O?T[1]:fr(_,T[1],this.transform.zoom),0],ue=new Float32Array(16);return i.translate(ue,h,oe),ue}saveTileTexture(h){const _=this._tileTextures[h.size[0]];_?_.push(h):this._tileTextures[h.size[0]]=[h]}getTileTexture(h){const _=this._tileTextures[h];return _&&_.length>0?_.pop():null}isPatternMissing(h){if(!h)return!1;if(!h.from||!h.to)return!0;const _=this.imageManager.getPattern(h.from.toString()),T=this.imageManager.getPattern(h.to.toString());return!_||!T}useProgram(h,_){this.cache=this.cache||{};const T=h+(_?_.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[T]||(this.cache[T]=new Ar(this.context,h,ks[h],_,Cs[h],this._showOverdrawInspector,this.style.terrain)),this.cache[T]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const h=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(h.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Y(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Zc{constructor(h,_){this.points=h,this.planes=_}static fromInvProjectionMatrix(h,_,T){const F=Math.pow(2,T),O=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(oe=>{const ue=1/(oe=i.transformMat4([],oe,h))[3]/_*F;return i.mul$1(oe,oe,[ue,ue,1/oe[3],ue])}),K=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(oe=>{const ue=i.sub([],O[oe[0]],O[oe[1]]),ve=i.sub([],O[oe[2]],O[oe[1]]),Te=i.normalize([],i.cross([],ue,ve)),ke=-i.dot(Te,O[oe[1]]);return Te.concat(ke)});return new Zc(O,K)}}class Xc{constructor(h,_){this.min=h,this.max=_,this.center=i.scale$1([],i.add([],this.min,this.max),.5)}quadrant(h){const _=[h%2==0,h<2],T=i.clone$2(this.min),F=i.clone$2(this.max);for(let O=0;O<_.length;O++)T[O]=_[O]?this.min[O]:this.center[O],F[O]=_[O]?this.center[O]:this.max[O];return F[2]=this.max[2],new Xc(T,F)}distanceX(h){return Math.max(Math.min(this.max[0],h[0]),this.min[0])-h[0]}distanceY(h){return Math.max(Math.min(this.max[1],h[1]),this.min[1])-h[1]}intersects(h){const _=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let T=!0;for(let F=0;F<h.planes.length;F++){const O=h.planes[F];let K=0;for(let oe=0;oe<_.length;oe++)i.dot$1(O,_[oe])>=0&&K++;if(K===0)return 0;K!==_.length&&(T=!1)}if(T)return 2;for(let F=0;F<3;F++){let O=Number.MAX_VALUE,K=-Number.MAX_VALUE;for(let oe=0;oe<h.points.length;oe++){const ue=h.points[oe][F]-this.min[F];O=Math.min(O,ue),K=Math.max(K,ue)}if(K<0||O>this.max[F]-this.min[F])return 0}return 1}}class fl{constructor(h=0,_=0,T=0,F=0){if(isNaN(h)||h<0||isNaN(_)||_<0||isNaN(T)||T<0||isNaN(F)||F<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=h,this.bottom=_,this.left=T,this.right=F}interpolate(h,_,T){return _.top!=null&&h.top!=null&&(this.top=i.number(h.top,_.top,T)),_.bottom!=null&&h.bottom!=null&&(this.bottom=i.number(h.bottom,_.bottom,T)),_.left!=null&&h.left!=null&&(this.left=i.number(h.left,_.left,T)),_.right!=null&&h.right!=null&&(this.right=i.number(h.right,_.right,T)),this}getCenter(h,_){const T=i.clamp((this.left+h-this.right)/2,0,h),F=i.clamp((this.top+_-this.bottom)/2,0,_);return new i.pointGeometry(T,F)}equals(h){return this.top===h.top&&this.bottom===h.bottom&&this.left===h.left&&this.right===h.right}clone(){return new fl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class qc{constructor(h,_,T,F,O){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=O===void 0||!!O,this._minZoom=h||0,this._maxZoom=_||22,this._minPitch=T==null?0:T,this._maxPitch=F==null?60:F,this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new fl,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const h=new qc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return h.tileSize=this.tileSize,h.latRange=this.latRange,h.width=this.width,h.height=this.height,h._center=this._center,h._elevation=this._elevation,h.zoom=this.zoom,h.angle=this.angle,h._fov=this._fov,h._pitch=this._pitch,h._unmodified=this._unmodified,h._edgeInsets=this._edgeInsets.clone(),h._calcMatrices(),h}get minZoom(){return this._minZoom}set minZoom(h){this._minZoom!==h&&(this._minZoom=h,this.zoom=Math.max(this.zoom,h))}get maxZoom(){return this._maxZoom}set maxZoom(h){this._maxZoom!==h&&(this._maxZoom=h,this.zoom=Math.min(this.zoom,h))}get minPitch(){return this._minPitch}set minPitch(h){this._minPitch!==h&&(this._minPitch=h,this.pitch=Math.max(this.pitch,h))}get maxPitch(){return this._maxPitch}set maxPitch(h){this._maxPitch!==h&&(this._maxPitch=h,this.pitch=Math.min(this.pitch,h))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(h){h===void 0?h=!0:h===null&&(h=!1),this._renderWorldCopies=h}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(h){const _=-i.wrap(h,-180,180)*Math.PI/180;var T;this.angle!==_&&(this._unmodified=!1,this.angle=_,this._calcMatrices(),this.rotationMatrix=(T=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(T[1]=0,T[2]=0),T[0]=1,T[3]=1,T),function(F,O,K){var oe=O[0],ue=O[1],ve=O[2],Te=O[3],ke=Math.sin(K),We=Math.cos(K);F[0]=oe*We+ve*ke,F[1]=ue*We+Te*ke,F[2]=oe*-ke+ve*We,F[3]=ue*-ke+Te*We}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(h){const _=i.clamp(h,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==_&&(this._unmodified=!1,this._pitch=_,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(h){h=Math.max(.01,Math.min(60,h)),this._fov!==h&&(this._unmodified=!1,this._fov=h/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(h){const _=Math.min(Math.max(h,this.minZoom),this.maxZoom);this._zoom!==_&&(this._unmodified=!1,this._zoom=_,this.scale=this.zoomScale(_),this.tileZoom=Math.floor(_),this.zoomFraction=_-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(h){h.lat===this._center.lat&&h.lng===this._center.lng||(this._unmodified=!1,this._center=h,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(h){h!==this._elevation&&(this._elevation=h,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(h){this._edgeInsets.equals(h)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,h,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(h){return this._edgeInsets.equals(h)}interpolatePadding(h,_,T){this._unmodified=!1,this._edgeInsets.interpolate(h,_,T),this._constrain(),this._calcMatrices()}coveringZoomLevel(h){const _=(h.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/h.tileSize));return Math.max(0,_)}getVisibleUnwrappedCoordinates(h){const _=[new i.UnwrappedTileID(0,h)];if(this._renderWorldCopies){const T=this.pointCoordinate(new i.pointGeometry(0,0)),F=this.pointCoordinate(new i.pointGeometry(this.width,0)),O=this.pointCoordinate(new i.pointGeometry(this.width,this.height)),K=this.pointCoordinate(new i.pointGeometry(0,this.height)),oe=Math.floor(Math.min(T.x,F.x,O.x,K.x)),ue=Math.floor(Math.max(T.x,F.x,O.x,K.x)),ve=1;for(let Te=oe-ve;Te<=ue+ve;Te++)Te!==0&&_.push(new i.UnwrappedTileID(Te,h))}return _}coveringTiles(h){var _,T;let F=this.coveringZoomLevel(h);const O=F;if(h.minzoom!==void 0&&F<h.minzoom)return[];h.maxzoom!==void 0&&F>h.maxzoom&&(F=h.maxzoom);const K=this.pointCoordinate(this.getCameraPoint()),oe=i.MercatorCoordinate.fromLngLat(this.center),ue=Math.pow(2,F),ve=[ue*K.x,ue*K.y,0],Te=[ue*oe.x,ue*oe.y,0],ke=Zc.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,F);let We=h.minzoom||0;!h.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(We=F);const bt=h.terrain?2/Math.min(this.tileSize,h.tileSize)*this.tileSize:3,mt=St=>({aabb:new Xc([St*ue,0,0],[(St+1)*ue,ue,0]),zoom:0,x:0,y:0,wrap:St,fullyVisible:!1}),gt=[],Vt=[],Zt=F,ni=h.reparseOverscaled?O:F;if(this._renderWorldCopies)for(let St=1;St<=3;St++)gt.push(mt(-St)),gt.push(mt(St));for(gt.push(mt(0));gt.length>0;){const St=gt.pop(),zt=St.x,li=St.y;let Ei=St.fullyVisible;if(!Ei){const Bn=St.aabb.intersects(ke);if(Bn===0)continue;Ei=Bn===2}const bi=h.terrain?ve:Te,Hi=St.aabb.distanceX(bi),xi=St.aabb.distanceY(bi),xn=Math.max(Math.abs(Hi),Math.abs(xi)),cn=bt+(1<<Zt-St.zoom)-2;if(St.zoom===Zt||xn>cn&&St.zoom>=We){const Bn=Zt-St.zoom,tr=ve[0]-.5-(zt<<Bn),ur=ve[1]-.5-(li<<Bn);Vt.push({tileID:new i.OverscaledTileID(St.zoom===Zt?ni:St.zoom,St.wrap,St.zoom,zt,li),distanceSq:i.sqrLen([Te[0]-.5-zt,Te[1]-.5-li]),tileDistanceToCamera:Math.sqrt(tr*tr+ur*ur)})}else for(let Bn=0;Bn<4;Bn++){const tr=(zt<<1)+Bn%2,ur=(li<<1)+(Bn>>1),Un=St.zoom+1;let Lr=St.aabb.quadrant(Bn);if(h.terrain){const Rr=new i.OverscaledTileID(Un,St.wrap,Un,tr,ur),Cr=h.terrain.getMinMaxElevation(Rr),Er=(_=Cr.minElevation)!==null&&_!==void 0?_:this.elevation,Gr=(T=Cr.maxElevation)!==null&&T!==void 0?T:this.elevation;Lr=new Xc([Lr.min[0],Lr.min[1],Er],[Lr.max[0],Lr.max[1],Gr])}gt.push({aabb:Lr,zoom:Un,x:tr,y:ur,wrap:St.wrap,fullyVisible:Ei})}}return Vt.sort((St,zt)=>St.distanceSq-zt.distanceSq).map(St=>St.tileID)}resize(h,_){this.width=h,this.height=_,this.pixelsToGLUnits=[2/h,-2/_],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(h){return Math.pow(2,h)}scaleZoom(h){return Math.log(h)/Math.LN2}project(h){const _=i.clamp(h.lat,-this.maxValidLatitude,this.maxValidLatitude);return new i.pointGeometry(i.mercatorXfromLng(h.lng)*this.worldSize,i.mercatorYfromLat(_)*this.worldSize)}unproject(h){return new i.MercatorCoordinate(h.x/this.worldSize,h.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(h){this.freezeElevation||(this.elevation=h?this.getElevation(this._center,h):0)}getElevation(h,_){const T=i.MercatorCoordinate.fromLngLat(h),F=(1<<this.tileZoom)*i.EXTENT,O=T.x*F,K=T.y*F,oe=Math.floor(O/i.EXTENT),ue=Math.floor(K/i.EXTENT),ve=new i.OverscaledTileID(this.tileZoom,0,this.tileZoom,oe,ue);return _.getElevation(ve,O%i.EXTENT,K%i.EXTENT,i.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(h){const _=this.pointLocation(this.centerPoint,h),T=this.getElevation(_,h);if(!(this.elevation-T))return;const F=this.getCameraPosition(),O=i.MercatorCoordinate.fromLngLat(F.lngLat,F.altitude),K=i.MercatorCoordinate.fromLngLat(_,T),oe=O.x-K.x,ue=O.y-K.y,ve=O.z-K.z,Te=Math.sqrt(oe*oe+ue*ue+ve*ve),ke=this.scaleZoom(this.cameraToCenterDistance/Te/this.tileSize);this._elevation=T,this._center=_,this.zoom=ke}setLocationAtPoint(h,_){const T=this.pointCoordinate(_),F=this.pointCoordinate(this.centerPoint),O=this.locationCoordinate(h),K=new i.MercatorCoordinate(O.x-(T.x-F.x),O.y-(T.y-F.y));this.center=this.coordinateLocation(K),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(h,_){return _?this.coordinatePoint(this.locationCoordinate(h),this.getElevation(h,_),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(h))}pointLocation(h,_){return this.coordinateLocation(this.pointCoordinate(h,_))}locationCoordinate(h){return i.MercatorCoordinate.fromLngLat(h)}coordinateLocation(h){return h&&h.toLngLat()}pointCoordinate(h,_){if(_){const We=_.pointCoordinate(h);if(We!=null)return We}const T=[h.x,h.y,0,1],F=[h.x,h.y,1,1];i.transformMat4(T,T,this.pixelMatrixInverse),i.transformMat4(F,F,this.pixelMatrixInverse);const O=T[3],K=F[3],oe=T[1]/O,ue=F[1]/K,ve=T[2]/O,Te=F[2]/K,ke=ve===Te?0:(0-ve)/(Te-ve);return new i.MercatorCoordinate(i.number(T[0]/O,F[0]/K,ke)/this.worldSize,i.number(oe,ue,ke)/this.worldSize)}coordinatePoint(h,_=0,T=this.pixelMatrix){const F=[h.x*this.worldSize,h.y*this.worldSize,_,1];return i.transformMat4(F,F,T),new i.pointGeometry(F[0]/F[3],F[1]/F[3])}getBounds(){const h=Math.max(0,this.height/2-this.getHorizon());return new i.LngLatBounds().extend(this.pointLocation(new i.pointGeometry(0,h))).extend(this.pointLocation(new i.pointGeometry(this.width,h))).extend(this.pointLocation(new i.pointGeometry(this.width,this.height))).extend(this.pointLocation(new i.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new i.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(h){h?(this.lngRange=[h.getWest(),h.getEast()],this.latRange=[h.getSouth(),h.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(h,_=!1){const T=h.key,F=_?this._alignedPosMatrixCache:this._posMatrixCache;if(F[T])return F[T];const O=h.canonical,K=this.worldSize/this.zoomScale(O.z),oe=O.x+Math.pow(2,O.z)*h.wrap,ue=i.identity(new Float64Array(16));return i.translate(ue,ue,[oe*K,O.y*K,0]),i.scale(ue,ue,[K/i.EXTENT,K/i.EXTENT,1]),i.multiply(ue,_?this.alignedProjMatrix:this.projMatrix,ue),F[T]=new Float32Array(ue),F[T]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let h,_,T,F,O=-90,K=90,oe=-180,ue=180;const ve=this.size,Te=this._unmodified;if(this.latRange){const bt=this.latRange;O=i.mercatorYfromLat(bt[1])*this.worldSize,K=i.mercatorYfromLat(bt[0])*this.worldSize,h=K-O<ve.y?ve.y/(K-O):0}if(this.lngRange){const bt=this.lngRange;oe=i.wrap(i.mercatorXfromLng(bt[0])*this.worldSize,0,this.worldSize),ue=i.wrap(i.mercatorXfromLng(bt[1])*this.worldSize,0,this.worldSize),ue<oe&&(ue+=this.worldSize),_=ue-oe<ve.x?ve.x/(ue-oe):0}const ke=this.point,We=Math.max(_||0,h||0);if(We)return this.center=this.unproject(new i.pointGeometry(_?(ue+oe)/2:ke.x,h?(K+O)/2:ke.y)),this.zoom+=this.scaleZoom(We),this._unmodified=Te,void(this._constraining=!1);if(this.latRange){const bt=ke.y,mt=ve.y/2;bt-mt<O&&(F=O+mt),bt+mt>K&&(F=K-mt)}if(this.lngRange){const bt=(oe+ue)/2,mt=i.wrap(ke.x,bt-this.worldSize/2,bt+this.worldSize/2),gt=ve.x/2;mt-gt<oe&&(T=oe+gt),mt+gt>ue&&(T=ue-gt)}T===void 0&&F===void 0||(this.center=this.unproject(new i.pointGeometry(T!==void 0?T:ke.x,F!==void 0?F:ke.y)).wrap()),this._unmodified=Te,this._constraining=!1}_calcMatrices(){if(!this.height)return;const h=this.centerOffset,_=this.point.x,T=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=i.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let F=i.identity(new Float64Array(16));i.scale(F,F,[this.width/2,-this.height/2,1]),i.translate(F,F,[1,-1,0]),this.labelPlaneMatrix=F,F=i.identity(new Float64Array(16)),i.scale(F,F,[1,-1,1]),i.translate(F,F,[-1,-1,0]),i.scale(F,F,[2/this.width,2/this.height,1]),this.glCoordMatrix=F,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const O=Math.PI/2+this._pitch,K=this._fov*(.5+h.y/this.height),oe=Math.sin(K)*this.cameraToSeaLevelDistance/Math.sin(i.clamp(Math.PI-O-K,.01,Math.PI-.01)),ue=this.getHorizon(),ve=2*Math.atan(ue/this.cameraToCenterDistance)*(.5+h.y/(2*ue)),Te=Math.sin(ve)*this.cameraToSeaLevelDistance/Math.sin(i.clamp(Math.PI-O-ve,.01,Math.PI-.01)),ke=Math.cos(Math.PI/2-this._pitch)*oe+this.cameraToSeaLevelDistance,We=Math.cos(Math.PI/2-this._pitch)*Te+this.cameraToSeaLevelDistance,bt=1.01*Math.min(ke,We),mt=this.height/50;F=new Float64Array(16),i.perspective(F,this._fov,this.width/this.height,mt,bt),F[8]=2*-h.x/this.width,F[9]=2*h.y/this.height,i.scale(F,F,[1,-1,1]),i.translate(F,F,[0,0,-this.cameraToCenterDistance]),i.rotateX(F,F,this._pitch),i.rotateZ(F,F,this.angle),i.translate(F,F,[-_,-T,0]),this.mercatorMatrix=i.scale([],F,[this.worldSize,this.worldSize,this.worldSize]),i.scale(F,F,[1,1,this._pixelPerMeter]),this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,F),i.translate(F,F,[0,0,-this.elevation]),this.projMatrix=F,this.invProjMatrix=i.invert([],F),this.pixelMatrix3D=i.multiply(new Float64Array(16),this.labelPlaneMatrix,F);const gt=this.width%2/2,Vt=this.height%2/2,Zt=Math.cos(this.angle),ni=Math.sin(this.angle),St=_-Math.round(_)+Zt*gt+ni*Vt,zt=T-Math.round(T)+Zt*Vt+ni*gt,li=new Float64Array(F);if(i.translate(li,li,[St>.5?St-1:St,zt>.5?zt-1:zt,0]),this.alignedProjMatrix=li,F=i.invert(new Float64Array(16),this.pixelMatrix),!F)throw new Error("failed to invert matrix");this.pixelMatrixInverse=F,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const h=this.pointCoordinate(new i.pointGeometry(0,0)),_=[h.x*this.worldSize,h.y*this.worldSize,0,1];return i.transformMat4(_,_,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const h=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,h))}getCameraQueryGeometry(h){const _=this.getCameraPoint();if(h.length===1)return[h[0],_];{let T=_.x,F=_.y,O=_.x,K=_.y;for(const oe of h)T=Math.min(T,oe.x),F=Math.min(F,oe.y),O=Math.max(O,oe.x),K=Math.max(K,oe.y);return[new i.pointGeometry(T,F),new i.pointGeometry(O,F),new i.pointGeometry(O,K),new i.pointGeometry(T,K),new i.pointGeometry(T,F)]}}}class Uh{constructor(h){this._hashName=h&&encodeURIComponent(h),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(_,T){let F=!1,O=null;const K=()=>{O=null,F&&(_(),O=setTimeout(K,300),F=!1)};return()=>(F=!0,O||K(),O)}(this._updateHashUnthrottled.bind(this))}addTo(h){return this._map=h,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(h){const _=this._map.getCenter(),T=Math.round(100*this._map.getZoom())/100,F=Math.ceil((T*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,F),K=Math.round(_.lng*O)/O,oe=Math.round(_.lat*O)/O,ue=this._map.getBearing(),ve=this._map.getPitch();let Te="";if(Te+=h?`/${K}/${oe}/${T}`:`${T}/${oe}/${K}`,(ue||ve)&&(Te+="/"+Math.round(10*ue)/10),ve&&(Te+=`/${Math.round(ve)}`),this._hashName){const ke=this._hashName;let We=!1;const bt=window.location.hash.slice(1).split("&").map(mt=>{const gt=mt.split("=")[0];return gt===ke?(We=!0,`${gt}=${Te}`):mt}).filter(mt=>mt);return We||bt.push(`${ke}=${Te}`),`#${bt.join("&")}`}return`#${Te}`}_getCurrentHash(){const h=window.location.hash.replace("#","");if(this._hashName){let _;return h.split("&").map(T=>T.split("=")).forEach(T=>{T[0]===this._hashName&&(_=T)}),(_&&_[1]||"").split("/")}return h.split("/")}_onHashChange(){const h=this._getCurrentHash();if(h.length>=3&&!h.some(_=>isNaN(_))){const _=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:_,pitch:+(h[4]||0)}),!0}return!1}_updateHashUnthrottled(){const h=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,h)}catch{}}}const Rh={linearity:.3,easing:i.bezier(0,0,.3,1)},wu=i.extend({deceleration:2500,maxSpeed:1400},Rh),nd=i.extend({deceleration:20,maxSpeed:1400},Rh),dc=i.extend({deceleration:1e3,maxSpeed:360},Rh),pc=i.extend({deceleration:1e3,maxSpeed:90},Rh);class Yc{constructor(h){this._map=h,this.clear()}clear(){this._inertiaBuffer=[]}record(h){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:h})}_drainInertiaBuffer(){const h=this._inertiaBuffer,_=i.exported.now();for(;h.length>0&&_-h[0].time>160;)h.shift()}_onMoveEnd(h){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const _={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:O}of this._inertiaBuffer)_.zoom+=O.zoomDelta||0,_.bearing+=O.bearingDelta||0,_.pitch+=O.pitchDelta||0,O.panDelta&&_.pan._add(O.panDelta),O.around&&(_.around=O.around),O.pinchAround&&(_.pinchAround=O.pinchAround);const T=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,F={};if(_.pan.mag()){const O=Jc(_.pan.mag(),T,i.extend({},wu,h||{}));F.offset=_.pan.mult(O.amount/_.pan.mag()),F.center=this._map.transform.center,zh(F,O)}if(_.zoom){const O=Jc(_.zoom,T,nd);F.zoom=this._map.transform.zoom+O.amount,zh(F,O)}if(_.bearing){const O=Jc(_.bearing,T,dc);F.bearing=this._map.transform.bearing+i.clamp(O.amount,-179,179),zh(F,O)}if(_.pitch){const O=Jc(_.pitch,T,pc);F.pitch=this._map.transform.pitch+O.amount,zh(F,O)}if(F.zoom||F.bearing){const O=_.pinchAround===void 0?_.around:_.pinchAround;F.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),i.extend(F,{noMoveStart:!0})}}function zh(M,h){(!M.duration||M.duration<h.duration)&&(M.duration=h.duration,M.easing=h.easing)}function Jc(M,h,_){const{maxSpeed:T,linearity:F,deceleration:O}=_,K=i.clamp(M*F/(h/1e3),-T,T),oe=Math.abs(K)/(O*F);return{easing:_.easing,duration:1e3*oe,amount:K*(oe/2)}}class So extends i.Event{constructor(h,_,T,F={}){const O=R.mousePos(_.getCanvasContainer(),T),K=_.unproject(O);super(h,i.extend({point:O,lngLat:K,originalEvent:T},F)),this._defaultPrevented=!1,this.target=_}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class xa extends i.Event{constructor(h,_,T){const F=h==="touchend"?T.changedTouches:T.touches,O=R.touchPos(_.getCanvasContainer(),F),K=O.map(ue=>_.unproject(ue)),oe=O.reduce((ue,ve,Te,ke)=>ue.add(ve.div(ke.length)),new i.pointGeometry(0,0));super(h,{points:O,point:oe,lngLats:K,lngLat:_.unproject(oe),originalEvent:T}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Mo extends i.Event{constructor(h,_,T){super(h,{originalEvent:T}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class rd{constructor(h,_){this._map=h,this._clickTolerance=_.clickTolerance}reset(){delete this._mousedownPos}wheel(h){return this._firePreventable(new Mo(h.type,this._map,h))}mousedown(h,_){return this._mousedownPos=_,this._firePreventable(new So(h.type,this._map,h))}mouseup(h){this._map.fire(new So(h.type,this._map,h))}click(h,_){this._mousedownPos&&this._mousedownPos.dist(_)>=this._clickTolerance||this._map.fire(new So(h.type,this._map,h))}dblclick(h){return this._firePreventable(new So(h.type,this._map,h))}mouseover(h){this._map.fire(new So(h.type,this._map,h))}mouseout(h){this._map.fire(new So(h.type,this._map,h))}touchstart(h){return this._firePreventable(new xa(h.type,this._map,h))}touchmove(h){this._map.fire(new xa(h.type,this._map,h))}touchend(h){this._map.fire(new xa(h.type,this._map,h))}touchcancel(h){this._map.fire(new xa(h.type,this._map,h))}_firePreventable(h){if(this._map.fire(h),h.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ga{constructor(h){this._map=h}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(h){this._map.fire(new So(h.type,this._map,h))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new So("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(h){this._delayContextMenu?this._contextMenuEvent=h:this._ignoreContextMenu||this._map.fire(new So(h.type,this._map,h)),this._map.listens("contextmenu")&&h.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class sd{constructor(h,_){this._map=h,this._el=h.getCanvasContainer(),this._container=h.getContainer(),this._clickTolerance=_.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(h,_){this.isEnabled()&&h.shiftKey&&h.button===0&&(R.disableDrag(),this._startPos=this._lastPos=_,this._active=!0)}mousemoveWindow(h,_){if(!this._active)return;const T=_;if(this._lastPos.equals(T)||!this._box&&T.dist(this._startPos)<this._clickTolerance)return;const F=this._startPos;this._lastPos=T,this._box||(this._box=R.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",h));const O=Math.min(F.x,T.x),K=Math.max(F.x,T.x),oe=Math.min(F.y,T.y),ue=Math.max(F.y,T.y);R.setTransform(this._box,`translate(${O}px,${oe}px)`),this._box.style.width=K-O+"px",this._box.style.height=ue-oe+"px"}mouseupWindow(h,_){if(!this._active||h.button!==0)return;const T=this._startPos,F=_;if(this.reset(),R.suppressClick(),T.x!==F.x||T.y!==F.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:h})),{cameraAnimation:O=>O.fitScreenCoordinates(T,F,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",h)}keydown(h){this._active&&h.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",h))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(R.remove(this._box),this._box=null),R.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(h,_){return this._map.fire(new i.Event(h,{originalEvent:_}))}}function ml(M,h){if(M.length!==h.length)throw new Error(`The number of touches and points are not equal - touches ${M.length}, points ${h.length}`);const _={};for(let T=0;T<M.length;T++)_[M[T].identifier]=h[T];return _}class kh{constructor(h){this.reset(),this.numTouches=h.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(h,_,T){(this.centroid||T.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=h.timeStamp),T.length===this.numTouches&&(this.centroid=function(F){const O=new i.pointGeometry(0,0);for(const K of F)O._add(K);return O.div(F.length)}(_),this.touches=ml(T,_)))}touchmove(h,_,T){if(this.aborted||!this.centroid)return;const F=ml(T,_);for(const O in this.touches){const K=this.touches[O],oe=F[O];(!oe||oe.dist(K)>30)&&(this.aborted=!0)}}touchend(h,_,T){if((!this.centroid||h.timeStamp-this.startTime>500)&&(this.aborted=!0),T.length===0){const F=!this.aborted&&this.centroid;if(this.reset(),F)return F}}}class Oh{constructor(h){this.singleTap=new kh(h),this.numTaps=h.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(h,_,T){this.singleTap.touchstart(h,_,T)}touchmove(h,_,T){this.singleTap.touchmove(h,_,T)}touchend(h,_,T){const F=this.singleTap.touchend(h,_,T);if(F){const O=h.timeStamp-this.lastTime<500,K=!this.lastTap||this.lastTap.dist(F)<30;if(O&&K||this.reset(),this.count++,this.lastTime=h.timeStamp,this.lastTap=F,this.count===this.numTaps)return this.reset(),F}}}class lA{constructor(){this._zoomIn=new Oh({numTouches:1,numTaps:2}),this._zoomOut=new Oh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(h,_,T){this._zoomIn.touchstart(h,_,T),this._zoomOut.touchstart(h,_,T)}touchmove(h,_,T){this._zoomIn.touchmove(h,_,T),this._zoomOut.touchmove(h,_,T)}touchend(h,_,T){const F=this._zoomIn.touchend(h,_,T),O=this._zoomOut.touchend(h,_,T);return F?(this._active=!0,h.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:K=>K.easeTo({duration:300,zoom:K.getZoom()+1,around:K.unproject(F)},{originalEvent:h})}):O?(this._active=!0,h.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:K=>K.easeTo({duration:300,zoom:K.getZoom()-1,around:K.unproject(O)},{originalEvent:h})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const od={0:1,2:2};class Nh{constructor(h){this.reset(),this._clickTolerance=h.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(h,_){return!1}_move(h,_){return{}}mousedown(h,_){if(this._lastPoint)return;const T=R.mouseButton(h);this._correctButton(h,T)&&(this._lastPoint=_,this._eventButton=T)}mousemoveWindow(h,_){const T=this._lastPoint;if(T){if(h.preventDefault(),function(F,O){const K=od[O];return F.buttons===void 0||(F.buttons&K)!==K}(h,this._eventButton))this.reset();else if(this._moved||!(_.dist(T)<this._clickTolerance))return this._moved=!0,this._lastPoint=_,this._move(T,_)}}mouseupWindow(h){this._lastPoint&&R.mouseButton(h)===this._eventButton&&(this._moved&&R.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fc extends Nh{mousedown(h,_){super.mousedown(h,_),this._lastPoint&&(this._active=!0)}_correctButton(h,_){return _===0&&!h.ctrlKey}_move(h,_){return{around:_,panDelta:_.sub(h)}}}class ua extends Nh{_correctButton(h,_){return _===0&&h.ctrlKey||_===2}_move(h,_){const T=.8*(_.x-h.x);if(T)return this._active=!0,{bearingDelta:T}}contextmenu(h){h.preventDefault()}}class pn extends Nh{_correctButton(h,_){return _===0&&h.ctrlKey||_===2}_move(h,_){const T=-.5*(_.y-h.y);if(T)return this._active=!0,{pitchDelta:T}}contextmenu(h){h.preventDefault()}}class eh{constructor(h,_){this._minTouches=h.cooperativeGestures?2:1,this._clickTolerance=h.clickTolerance||1,this._map=_,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(h,_,T){return this._calculateTransform(h,_,T)}touchmove(h,_,T){if(this._map._cooperativeGestures&&(this._minTouches===2&&T.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(h,!1,T.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(T.length<this._minTouches))return h.preventDefault(),this._calculateTransform(h,_,T)}touchend(h,_,T){this._calculateTransform(h,_,T),this._active&&T.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(h,_,T){T.length>0&&(this._active=!0);const F=ml(T,_),O=new i.pointGeometry(0,0),K=new i.pointGeometry(0,0);let oe=0;for(const ve in F){const Te=F[ve],ke=this._touches[ve];ke&&(O._add(Te),K._add(Te.sub(ke)),oe++,F[ve]=Te)}if(this._touches=F,oe<this._minTouches||!K.mag())return;const ue=K.div(oe);return this._sum._add(ue),this._sum.mag()<this._clickTolerance?void 0:{around:O.div(oe),panDelta:ue}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wl{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(h){}_move(h,_,T){return{}}touchstart(h,_,T){this._firstTwoTouches||T.length<2||(this._firstTwoTouches=[T[0].identifier,T[1].identifier],this._start([_[0],_[1]]))}touchmove(h,_,T){if(!this._firstTwoTouches)return;h.preventDefault();const[F,O]=this._firstTwoTouches,K=Ns(T,_,F),oe=Ns(T,_,O);if(!K||!oe)return;const ue=this._aroundCenter?null:K.add(oe).div(2);return this._move([K,oe],ue,h)}touchend(h,_,T){if(!this._firstTwoTouches)return;const[F,O]=this._firstTwoTouches,K=Ns(T,_,F),oe=Ns(T,_,O);K&&oe||(this._active&&R.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(h){this._enabled=!0,this._aroundCenter=!!h&&h.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ns(M,h,_){for(let T=0;T<M.length;T++)if(M[T].identifier===_)return h[T]}function gl(M,h){return Math.log(M/h)/Math.LN2}class un extends Wl{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(h){this._startDistance=this._distance=h[0].dist(h[1])}_move(h,_){const T=this._distance;if(this._distance=h[0].dist(h[1]),this._active||!(Math.abs(gl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:gl(this._distance,T),pinchAround:_}}}function th(M,h){return 180*M.angleWith(h)/Math.PI}class Ur extends Wl{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(h){this._startVector=this._vector=h[0].sub(h[1]),this._minDiameter=h[0].dist(h[1])}_move(h,_){const T=this._vector;if(this._vector=h[0].sub(h[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:th(this._vector,T),pinchAround:_}}_isBelowThreshold(h){this._minDiameter=Math.min(this._minDiameter,h.mag());const _=25/(Math.PI*this._minDiameter)*360,T=th(h,this._startVector);return Math.abs(T)<_}}function mc(M){return Math.abs(M.y)>Math.abs(M.x)}class cA extends Wl{constructor(h){super(),this._map=h}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(h,_,T){super.touchstart(h,_,T),this._currentTouchCount=T.length}_start(h){this._lastPoints=h,mc(h[0].sub(h[1]))&&(this._valid=!1)}_move(h,_,T){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const F=h[0].sub(this._lastPoints[0]),O=h[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(F,O,T.timeStamp),this._valid?(this._lastPoints=h,this._active=!0,{pitchDelta:(F.y+O.y)/2*-.5}):void 0}gestureBeginsVertically(h,_,T){if(this._valid!==void 0)return this._valid;const F=h.mag()>=2,O=_.mag()>=2;if(!F&&!O)return;if(!F||!O)return this._firstMove===void 0&&(this._firstMove=T),T-this._firstMove<100&&void 0;const K=h.y>0==_.y>0;return mc(h)&&mc(_)&&K}}const Qh={panStep:100,bearingStep:15,pitchStep:10};class gc{constructor(){const h=Qh;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(h){if(h.altKey||h.ctrlKey||h.metaKey)return;let _=0,T=0,F=0,O=0,K=0;switch(h.keyCode){case 61:case 107:case 171:case 187:_=1;break;case 189:case 109:case 173:_=-1;break;case 37:h.shiftKey?T=-1:(h.preventDefault(),O=-1);break;case 39:h.shiftKey?T=1:(h.preventDefault(),O=1);break;case 38:h.shiftKey?F=1:(h.preventDefault(),K=-1);break;case 40:h.shiftKey?F=-1:(h.preventDefault(),K=1);break;default:return}return this._rotationDisabled&&(T=0,F=0),{cameraAnimation:oe=>{const ue=oe.getZoom();oe.easeTo({duration:300,easeId:"keyboardHandler",easing:hA,zoom:_?Math.round(ue)+_*(h.shiftKey?2:1):ue,bearing:oe.getBearing()+T*this._bearingStep,pitch:oe.getPitch()+F*this._pitchStep,offset:[-O*this._panStep,-K*this._panStep],center:oe.getCenter()},{originalEvent:h})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function hA(M){return M*(2-M)}const uA=4.000244140625;class Vh{constructor(h,_){this._map=h,this._el=h.getCanvasContainer(),this._handler=_,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout"],this)}setZoomRate(h){this._defaultZoomRate=h}setWheelZoomRate(h){this._wheelZoomRate=h}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(h){this.isEnabled()||(this._enabled=!0,this._aroundCenter=h&&h.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(h){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;h.preventDefault()}let _=h.deltaMode===WheelEvent.DOM_DELTA_LINE?40*h.deltaY:h.deltaY;const T=i.exported.now(),F=T-(this._lastWheelEventTime||0);this._lastWheelEventTime=T,_!==0&&_%uA==0?this._type="wheel":_!==0&&Math.abs(_)<4?this._type="trackpad":F>400?(this._type=null,this._lastValue=_,this._timeout=setTimeout(this._onTimeout,40,h)):this._type||(this._type=Math.abs(F*_)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,_+=this._lastValue)),h.shiftKey&&_&&(_/=4),this._type&&(this._lastWheelEvent=h,this._delta-=_,this._active||this._start(h)),h.preventDefault()}_onTimeout(h){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(h)}_start(h){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const _=R.mousePos(this._el,h);this._around=i.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(_)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const h=this._map.transform;if(this._delta!==0){const oe=this._type==="wheel"&&Math.abs(this._delta)>uA?this._wheelZoomRate:this._defaultZoomRate;let ue=2/(1+Math.exp(-Math.abs(this._delta*oe)));this._delta<0&&ue!==0&&(ue=1/ue);const ve=typeof this._targetZoom=="number"?h.zoomScale(this._targetZoom):h.scale;this._targetZoom=Math.min(h.maxZoom,Math.max(h.minZoom,h.scaleZoom(ve*ue))),this._type==="wheel"&&(this._startZoom=h.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const _=typeof this._targetZoom=="number"?this._targetZoom:h.zoom,T=this._startZoom,F=this._easing;let O,K=!1;if(this._type==="wheel"&&T&&F){const oe=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),ue=F(oe);O=i.number(T,_,ue),oe<1?this._frameId||(this._frameId=!0):K=!0}else O=_,K=!0;return this._active=!0,K&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!K,zoomDelta:O-h.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(h){let _=i.ease;if(this._prevEase){const T=this._prevEase,F=(i.exported.now()-T.start)/T.duration,O=T.easing(F+.01)-T.easing(F),K=.27/Math.sqrt(O*O+1e-4)*.01,oe=Math.sqrt(.0729-K*K);_=i.bezier(K,oe,.25,1)}return this._prevEase={start:i.exported.now(),duration:h,easing:_},_}reset(){this._active=!1}}class Hh{constructor(h,_){this._clickZoom=h,this._tapZoom=_}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class ih{constructor(){this.reset()}reset(){this._active=!1}dblclick(h,_){return h.preventDefault(),{cameraAnimation:T=>{T.easeTo({duration:300,zoom:T.getZoom()+(h.shiftKey?-1:1),around:T.unproject(_)},{originalEvent:h})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _c{constructor(){this._tap=new Oh({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(h,_,T){this._swipePoint||(this._tapTime&&h.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?T.length>0&&(this._swipePoint=_[0],this._swipeTouch=T[0].identifier):this._tap.touchstart(h,_,T))}touchmove(h,_,T){if(this._tapTime){if(this._swipePoint){if(T[0].identifier!==this._swipeTouch)return;const F=_[0],O=F.y-this._swipePoint.y;return this._swipePoint=F,h.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(h,_,T)}touchend(h,_,T){this._tapTime?this._swipePoint&&T.length===0&&this.reset():this._tap.touchend(h,_,T)&&(this._tapTime=h.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Is{constructor(h,_,T){this._el=h,this._mousePan=_,this._touchPan=T}enable(h){this._inertiaOptions=h||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class fo{constructor(h,_,T){this._pitchWithRotate=h.pitchWithRotate,this._mouseRotate=_,this._mousePitch=T}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Gh{constructor(h,_,T,F){this._el=h,this._touchZoom=_,this._touchRotate=T,this._tapDragZoom=F,this._rotationDisabled=!1,this._enabled=!0}enable(h){this._touchZoom.enable(h),this._rotationDisabled||this._touchRotate.enable(h),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const jl=M=>M.zoom||M.drag||M.pitch||M.rotate;class Kl extends i.Event{}function _l(M){return M.panDelta&&M.panDelta.mag()||M.zoomDelta||M.bearingDelta||M.pitchDelta}class An{constructor(h,_){this._map=h,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Yc(h),this._bearingSnap=_.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(_),i.bindAll(["handleEvent","handleWindowEvent"],this);const T=this._el;this._listeners=[[T,"touchstart",{passive:!0}],[T,"touchmove",{passive:!1}],[T,"touchend",void 0],[T,"touchcancel",void 0],[T,"mousedown",void 0],[T,"mousemove",void 0],[T,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[T,"mouseover",void 0],[T,"mouseout",void 0],[T,"dblclick",void 0],[T,"click",void 0],[T,"keydown",{capture:!1}],[T,"keyup",void 0],[T,"wheel",{passive:!1}],[T,"contextmenu",void 0],[window,"blur",void 0]];for(const[F,O,K]of this._listeners)R.addEventListener(F,O,F===document?this.handleWindowEvent:this.handleEvent,K)}destroy(){for(const[h,_,T]of this._listeners)R.removeEventListener(h,_,h===document?this.handleWindowEvent:this.handleEvent,T)}_addDefaultHandlers(h){const _=this._map,T=_.getCanvasContainer();this._add("mapEvent",new rd(_,h));const F=_.boxZoom=new sd(_,h);this._add("boxZoom",F);const O=new lA,K=new ih;_.doubleClickZoom=new Hh(K,O),this._add("tapZoom",O),this._add("clickZoom",K);const oe=new _c;this._add("tapDragZoom",oe);const ue=_.touchPitch=new cA(_);this._add("touchPitch",ue);const ve=new ua(h),Te=new pn(h);_.dragRotate=new fo(h,ve,Te),this._add("mouseRotate",ve,["mousePitch"]),this._add("mousePitch",Te,["mouseRotate"]);const ke=new fc(h),We=new eh(h,_);_.dragPan=new Is(T,ke,We),this._add("mousePan",ke),this._add("touchPan",We,["touchZoom","touchRotate"]);const bt=new Ur,mt=new un;_.touchZoomRotate=new Gh(T,mt,bt,oe),this._add("touchRotate",bt,["touchPan","touchZoom"]),this._add("touchZoom",mt,["touchPan","touchRotate"]);const gt=_.scrollZoom=new Vh(_,this);this._add("scrollZoom",gt,["mousePan"]);const Vt=_.keyboard=new gc;this._add("keyboard",Vt),this._add("blockableMapEvent",new Ga(_));for(const Zt of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])h.interactive&&h[Zt]&&_[Zt].enable(h[Zt])}_add(h,_,T){this._handlers.push({handlerName:h,handler:_,allowed:T}),this._handlersById[h]=_}stop(h){if(!this._updatingCamera){for(const{handler:_}of this._handlers)_.reset();this._inertia.clear(),this._fireEvents({},{},h),this._changes=[]}}isActive(){for(const{handler:h}of this._handlers)if(h.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(jl(this._eventsInProgress))||this.isZooming()}_blockedByActive(h,_,T){for(const F in h)if(F!==T&&(!_||_.indexOf(F)<0))return!0;return!1}handleWindowEvent(h){this.handleEvent(h,`${h.type}Window`)}_getMapTouches(h){const _=[];for(const T of h)this._el.contains(T.target)&&_.push(T);return _}handleEvent(h,_){if(h.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const T=h.type==="renderFrame"?void 0:h,F={needsRenderFrame:!1},O={},K={},oe=h.touches,ue=oe?this._getMapTouches(oe):void 0,ve=ue?R.touchPos(this._el,ue):R.mousePos(this._el,h);for(const{handlerName:We,handler:bt,allowed:mt}of this._handlers){if(!bt.isEnabled())continue;let gt;this._blockedByActive(K,mt,We)?bt.reset():bt[_||h.type]&&(gt=bt[_||h.type](h,ve,ue),this.mergeHandlerResult(F,O,gt,We,T),gt&>.needsRenderFrame&&this._triggerRenderFrame()),(gt||bt.isActive())&&(K[We]=bt)}const Te={};for(const We in this._previousActiveHandlers)K[We]||(Te[We]=T);this._previousActiveHandlers=K,(Object.keys(Te).length||_l(F))&&(this._changes.push([F,O,Te]),this._triggerRenderFrame()),(Object.keys(K).length||_l(F))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ke}=F;ke&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ke(this._map))}mergeHandlerResult(h,_,T,F,O){if(!T)return;i.extend(h,T);const K={handlerName:F,originalEvent:T.originalEvent||O};T.zoomDelta!==void 0&&(_.zoom=K),T.panDelta!==void 0&&(_.drag=K),T.pitchDelta!==void 0&&(_.pitch=K),T.bearingDelta!==void 0&&(_.rotate=K)}_applyChanges(){const h={},_={},T={};for(const[F,O,K]of this._changes)F.panDelta&&(h.panDelta=(h.panDelta||new i.pointGeometry(0,0))._add(F.panDelta)),F.zoomDelta&&(h.zoomDelta=(h.zoomDelta||0)+F.zoomDelta),F.bearingDelta&&(h.bearingDelta=(h.bearingDelta||0)+F.bearingDelta),F.pitchDelta&&(h.pitchDelta=(h.pitchDelta||0)+F.pitchDelta),F.around!==void 0&&(h.around=F.around),F.pinchAround!==void 0&&(h.pinchAround=F.pinchAround),F.noInertia&&(h.noInertia=F.noInertia),i.extend(_,O),i.extend(T,K);this._updateMapTransform(h,_,T),this._changes=[]}_updateMapTransform(h,_,T){const F=this._map,O=F.transform,K=F.style&&F.style.terrain;if(!(_l(h)||K&&this._drag))return this._fireEvents(_,T,!0);let{panDelta:oe,zoomDelta:ue,bearingDelta:ve,pitchDelta:Te,around:ke,pinchAround:We}=h;We!==void 0&&(ke=We),F._stop(!0),ke=ke||F.transform.centerPoint;const bt=O.pointLocation(oe?ke.sub(oe):ke);ve&&(O.bearing+=ve),Te&&(O.pitch+=Te),ue&&(O.zoom+=ue),K?_.drag&&!this._drag?(this._drag={center:O.centerPoint,lngLat:O.pointLocation(ke),point:ke,handlerName:_.drag.handlerName},F.fire(new i.Event("freezeElevation",{freeze:!0}))):this._drag&&T[this._drag.handlerName]?(F.fire(new i.Event("freezeElevation",{freeze:!1})),this._drag=null):_.drag&&this._drag&&(O.center=O.pointLocation(O.centerPoint.sub(oe))):O.setLocationAtPoint(bt,ke),this._map._update(),h.noInertia||this._inertia.record(h),this._fireEvents(_,T,!0)}_fireEvents(h,_,T){const F=jl(this._eventsInProgress),O=jl(h),K={};for(const Te in h){const{originalEvent:ke}=h[Te];this._eventsInProgress[Te]||(K[`${Te}start`]=ke),this._eventsInProgress[Te]=h[Te]}!F&&O&&this._fireEvent("movestart",O.originalEvent);for(const Te in K)this._fireEvent(Te,K[Te]);O&&this._fireEvent("move",O.originalEvent);for(const Te in h){const{originalEvent:ke}=h[Te];this._fireEvent(Te,ke)}const oe={};let ue;for(const Te in this._eventsInProgress){const{handlerName:ke,originalEvent:We}=this._eventsInProgress[Te];this._handlersById[ke].isActive()||(delete this._eventsInProgress[Te],ue=_[ke]||We,oe[`${Te}end`]=ue)}for(const Te in oe)this._fireEvent(Te,oe[Te]);const ve=jl(this._eventsInProgress);if(T&&(F||O)&&!ve){this._updatingCamera=!0;const Te=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),ke=We=>We!==0&&-this._bearingSnap<We&&We<this._bearingSnap;Te?(ke(Te.bearing||this._map.getBearing())&&(Te.bearing=0),this._map.easeTo(Te,{originalEvent:ue})):(this._map.fire(new i.Event("moveend",{originalEvent:ue})),ke(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(h,_){this._map.fire(new i.Event(h,_?{originalEvent:_}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(h=>{delete this._frameId,this.handleEvent(new Kl("renderFrame",{timeStamp:h})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const vs={extend:(M,...h)=>i.extend(M,...h),run(M){M()},logToElement(M,h=!1,_="log"){const T=window.document.getElementById(_);T&&(h&&(T.innerHTML=""),T.innerHTML+=`<br>${M}`)}};class Zr extends i.Evented{constructor(h,_){super(),this._moving=!1,this._zooming=!1,this.transform=h,this._bearingSnap=_.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(h,_){return this.jumpTo({center:h},_)}panBy(h,_,T){return h=i.pointGeometry.convert(h).mult(-1),this.panTo(this.transform.center,i.extend({offset:h},_),T)}panTo(h,_,T){return this.easeTo(i.extend({center:h},_),T)}getZoom(){return this.transform.zoom}setZoom(h,_){return this.jumpTo({zoom:h},_),this}zoomTo(h,_,T){return this.easeTo(i.extend({zoom:h},_),T)}zoomIn(h,_){return this.zoomTo(this.getZoom()+1,h,_),this}zoomOut(h,_){return this.zoomTo(this.getZoom()-1,h,_),this}getBearing(){return this.transform.bearing}setBearing(h,_){return this.jumpTo({bearing:h},_),this}getPadding(){return this.transform.padding}setPadding(h,_){return this.jumpTo({padding:h},_),this}rotateTo(h,_,T){return this.easeTo(i.extend({bearing:h},_),T)}resetNorth(h,_){return this.rotateTo(0,i.extend({duration:1e3},h),_),this}resetNorthPitch(h,_){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},h),_),this}snapToNorth(h,_){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(h,_):this}getPitch(){return this.transform.pitch}setPitch(h,_){return this.jumpTo({pitch:h},_),this}cameraForBounds(h,_){h=i.LngLatBounds.convert(h);const T=_&&_.bearing||0;return this._cameraForBoxAndBearing(h.getNorthWest(),h.getSouthEast(),T,_)}_cameraForBoxAndBearing(h,_,T,F){const O={top:0,bottom:0,right:0,left:0};if(typeof(F=i.extend({padding:O,offset:[0,0],maxZoom:this.transform.maxZoom},F)).padding=="number"){const li=F.padding;F.padding={top:li,bottom:li,right:li,left:li}}F.padding=i.extend(O,F.padding);const K=this.transform,oe=K.padding,ue=K.project(i.LngLat.convert(h)),ve=K.project(i.LngLat.convert(_)),Te=ue.rotate(-T*Math.PI/180),ke=ve.rotate(-T*Math.PI/180),We=new i.pointGeometry(Math.max(Te.x,ke.x),Math.max(Te.y,ke.y)),bt=new i.pointGeometry(Math.min(Te.x,ke.x),Math.min(Te.y,ke.y)),mt=We.sub(bt),gt=(K.width-(oe.left+oe.right+F.padding.left+F.padding.right))/mt.x,Vt=(K.height-(oe.top+oe.bottom+F.padding.top+F.padding.bottom))/mt.y;if(Vt<0||gt<0)return void i.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Zt=Math.min(K.scaleZoom(K.scale*Math.min(gt,Vt)),F.maxZoom),ni=i.pointGeometry.convert(F.offset),St=new i.pointGeometry((F.padding.left-F.padding.right)/2,(F.padding.top-F.padding.bottom)/2).rotate(T*Math.PI/180),zt=ni.add(St).mult(K.scale/K.zoomScale(Zt));return{center:K.unproject(ue.add(ve).div(2).sub(zt)),zoom:Zt,bearing:T}}fitBounds(h,_,T){return this._fitInternal(this.cameraForBounds(h,_),_,T)}fitScreenCoordinates(h,_,T,F,O){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.pointGeometry.convert(h)),this.transform.pointLocation(i.pointGeometry.convert(_)),T,F),F,O)}_fitInternal(h,_,T){return h?(delete(_=i.extend(h,_)).padding,_.linear?this.easeTo(_,T):this.flyTo(_,T)):this}jumpTo(h,_){this.stop();const T=this.transform;let F=!1,O=!1,K=!1;return"zoom"in h&&T.zoom!==+h.zoom&&(F=!0,T.zoom=+h.zoom),h.center!==void 0&&(T.center=i.LngLat.convert(h.center)),"bearing"in h&&T.bearing!==+h.bearing&&(O=!0,T.bearing=+h.bearing),"pitch"in h&&T.pitch!==+h.pitch&&(K=!0,T.pitch=+h.pitch),h.padding==null||T.isPaddingEqual(h.padding)||(T.padding=h.padding),this.fire(new i.Event("movestart",_)).fire(new i.Event("move",_)),F&&this.fire(new i.Event("zoomstart",_)).fire(new i.Event("zoom",_)).fire(new i.Event("zoomend",_)),O&&this.fire(new i.Event("rotatestart",_)).fire(new i.Event("rotate",_)).fire(new i.Event("rotateend",_)),K&&this.fire(new i.Event("pitchstart",_)).fire(new i.Event("pitch",_)).fire(new i.Event("pitchend",_)),this.fire(new i.Event("moveend",_))}calculateCameraOptionsFromTo(h,_,T,F=0){const O=i.MercatorCoordinate.fromLngLat(h,_),K=i.MercatorCoordinate.fromLngLat(T,F),oe=K.x-O.x,ue=K.y-O.y,ve=K.z-O.z,Te=Math.hypot(oe,ue,ve);if(Te===0)throw new Error("Can't calculate camera options with same From and To");const ke=Math.hypot(oe,ue),We=this.transform.scaleZoom(this.transform.cameraToCenterDistance/Te/this.transform.tileSize),bt=180*Math.atan2(oe,-ue)/Math.PI;let mt=180*Math.acos(ke/Te)/Math.PI;return mt=ve<0?90-mt:90+mt,{center:K.toLngLat(),zoom:We,pitch:mt,bearing:bt}}easeTo(h,_){this._stop(!1,h.easeId),((h=i.extend({offset:[0,0],duration:500,easing:i.ease},h)).animate===!1||!h.essential&&i.exported.prefersReducedMotion)&&(h.duration=0);const T=this.transform,F=this.getZoom(),O=this.getBearing(),K=this.getPitch(),oe=this.getPadding(),ue="zoom"in h?+h.zoom:F,ve="bearing"in h?this._normalizeBearing(h.bearing,O):O,Te="pitch"in h?+h.pitch:K,ke="padding"in h?h.padding:T.padding,We=i.pointGeometry.convert(h.offset);let bt=T.centerPoint.add(We);const mt=T.pointLocation(bt),gt=i.LngLat.convert(h.center||mt);this._normalizeCenter(gt);const Vt=T.project(mt),Zt=T.project(gt).sub(Vt),ni=T.zoomScale(ue-F);let St,zt;h.around&&(St=i.LngLat.convert(h.around),zt=T.locationPoint(St));const li={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ue!==F,this._rotating=this._rotating||O!==ve,this._pitching=this._pitching||Te!==K,this._padding=!T.isPaddingEqual(ke),this._easeId=h.easeId,this._prepareEase(_,h.noMoveStart,li),this._ease(Ei=>{if(this._zooming&&(T.zoom=i.number(F,ue,Ei)),this._rotating&&(T.bearing=i.number(O,ve,Ei)),this._pitching&&(T.pitch=i.number(K,Te,Ei)),this._padding&&(T.interpolatePadding(oe,ke,Ei),bt=T.centerPoint.add(We)),St)T.setLocationAtPoint(St,zt);else{const bi=T.zoomScale(T.zoom-F),Hi=ue>F?Math.min(2,ni):Math.max(.5,ni),xi=Math.pow(Hi,1-Ei),xn=T.unproject(Vt.add(Zt.mult(Ei*xi)).mult(bi));T.setLocationAtPoint(T.renderWorldCopies?xn.wrap():xn,bt)}this._fireMoveEvents(_)},Ei=>{this._afterEase(_,Ei)},h),this}_prepareEase(h,_,T={}){this._moving=!0,this.fire(new i.Event("freezeElevation",{freeze:!0})),_||T.moving||this.fire(new i.Event("movestart",h)),this._zooming&&!T.zooming&&this.fire(new i.Event("zoomstart",h)),this._rotating&&!T.rotating&&this.fire(new i.Event("rotatestart",h)),this._pitching&&!T.pitching&&this.fire(new i.Event("pitchstart",h))}_fireMoveEvents(h){this.fire(new i.Event("move",h)),this._zooming&&this.fire(new i.Event("zoom",h)),this._rotating&&this.fire(new i.Event("rotate",h)),this._pitching&&this.fire(new i.Event("pitch",h))}_afterEase(h,_){if(this._easeId&&_&&this._easeId===_)return;delete this._easeId,this.fire(new i.Event("freezeElevation",{freeze:!1}));const T=this._zooming,F=this._rotating,O=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,T&&this.fire(new i.Event("zoomend",h)),F&&this.fire(new i.Event("rotateend",h)),O&&this.fire(new i.Event("pitchend",h)),this.fire(new i.Event("moveend",h))}flyTo(h,_){if(!h.essential&&i.exported.prefersReducedMotion){const Un=i.pick(h,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Un,_)}this.stop(),h=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},h);const T=this.transform,F=this.getZoom(),O=this.getBearing(),K=this.getPitch(),oe=this.getPadding(),ue="zoom"in h?i.clamp(+h.zoom,T.minZoom,T.maxZoom):F,ve="bearing"in h?this._normalizeBearing(h.bearing,O):O,Te="pitch"in h?+h.pitch:K,ke="padding"in h?h.padding:T.padding,We=T.zoomScale(ue-F),bt=i.pointGeometry.convert(h.offset);let mt=T.centerPoint.add(bt);const gt=T.pointLocation(mt),Vt=i.LngLat.convert(h.center||gt);this._normalizeCenter(Vt);const Zt=T.project(gt),ni=T.project(Vt).sub(Zt);let St=h.curve;const zt=Math.max(T.width,T.height),li=zt/We,Ei=ni.mag();if("minZoom"in h){const Un=i.clamp(Math.min(h.minZoom,F,ue),T.minZoom,T.maxZoom),Lr=zt/T.zoomScale(Un-F);St=Math.sqrt(Lr/Ei*2)}const bi=St*St;function Hi(Un){const Lr=(li*li-zt*zt+(Un?-1:1)*bi*bi*Ei*Ei)/(2*(Un?li:zt)*bi*Ei);return Math.log(Math.sqrt(Lr*Lr+1)-Lr)}function xi(Un){return(Math.exp(Un)-Math.exp(-Un))/2}function xn(Un){return(Math.exp(Un)+Math.exp(-Un))/2}const cn=Hi(0);let Bn=function(Un){return xn(cn)/xn(cn+St*Un)},tr=function(Un){return zt*((xn(cn)*(xi(Lr=cn+St*Un)/xn(Lr))-xi(cn))/bi)/Ei;var Lr},ur=(Hi(1)-cn)/St;if(Math.abs(Ei)<1e-6||!isFinite(ur)){if(Math.abs(zt-li)<1e-6)return this.easeTo(h,_);const Un=li<zt?-1:1;ur=Math.abs(Math.log(li/zt))/St,tr=function(){return 0},Bn=function(Lr){return Math.exp(Un*St*Lr)}}return h.duration="duration"in h?+h.duration:1e3*ur/("screenSpeed"in h?+h.screenSpeed/St:+h.speed),h.maxDuration&&h.duration>h.maxDuration&&(h.duration=0),this._zooming=!0,this._rotating=O!==ve,this._pitching=Te!==K,this._padding=!T.isPaddingEqual(ke),this._prepareEase(_,!1),this._ease(Un=>{const Lr=Un*ur,Rr=1/Bn(Lr);T.zoom=Un===1?ue:F+T.scaleZoom(Rr),this._rotating&&(T.bearing=i.number(O,ve,Un)),this._pitching&&(T.pitch=i.number(K,Te,Un)),this._padding&&(T.interpolatePadding(oe,ke,Un),mt=T.centerPoint.add(bt));const Cr=Un===1?Vt:T.unproject(Zt.add(ni.mult(tr(Lr))).mult(Rr));T.setLocationAtPoint(T.renderWorldCopies?Cr.wrap():Cr,mt),this._fireMoveEvents(_)},()=>this._afterEase(_),h),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(h,_){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const T=this._onEaseEnd;delete this._onEaseEnd,T.call(this,_)}if(!h){const T=this.handlers;T&&T.stop(!1)}return this}_ease(h,_,T){T.animate===!1||T.duration===0?(h(1),_()):(this._easeStart=i.exported.now(),this._easeOptions=T,this._onEaseFrame=h,this._onEaseEnd=_,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const h=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(h)),h<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(h,_){h=i.wrap(h,-180,180);const T=Math.abs(h-_);return Math.abs(h-360-_)<T&&(h-=360),Math.abs(h+360-_)<T&&(h+=360),h}_normalizeCenter(h){const _=this.transform;if(!_.renderWorldCopies||_.lngRange)return;const T=h.lng-_.center.lng;h.lng+=T>180?-360:T<-180?360:0}}class nh{constructor(h={}){this.options=h,i.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(h){return this._map=h,this._compact=this.options&&this.options.compact,this._container=R.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=R.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=R.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){R.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(h,_){const T=this._map._getUIString(`AttributionControl.${_}`);h.title=T,h.setAttribute("aria-label",T)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(h){!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let h=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?h=h.concat(this.options.customAttribution.map(F=>typeof F!="string"?"":F)):typeof this.options.customAttribution=="string"&&h.push(this.options.customAttribution)),this._map.style.stylesheet){const F=this._map.style.stylesheet;this.styleOwner=F.owner,this.styleId=F.id}const _=this._map.style.sourceCaches;for(const F in _){const O=_[F];if(O.used||O.usedForTerrain){const K=O.getSource();K.attribution&&h.indexOf(K.attribution)<0&&h.push(K.attribution)}}h=h.filter(F=>String(F).trim()),h.sort((F,O)=>F.length-O.length),h=h.filter((F,O)=>{for(let K=O+1;K<h.length;K++)if(h[K].indexOf(F)>=0)return!1;return!0});const T=h.join(" | ");T!==this._attribHTML&&(this._attribHTML=T,h.length?(this._innerContainer.innerHTML=T,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Wh{constructor(h={}){this.options=h,i.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(h){this._map=h,this._compact=this.options&&this.options.compact,this._container=R.create("div","maplibregl-ctrl mapboxgl-ctrl");const _=R.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return _.target="_blank",_.rel="noopener nofollow",_.href="https://maplibre.org/",_.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),_.setAttribute("rel","noopener nofollow"),this._container.appendChild(_),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){R.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const h=this._container.children;if(h.length){const _=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&_.classList.add("maplibregl-compact","mapboxgl-compact"):_.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class yc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(h){const _=++this._id;return this._queue.push({callback:h,id:_,cancelled:!1}),_}remove(h){const _=this._currentlyRunning,T=_?this._queue.concat(_):this._queue;for(const F of T)if(F.id===h)return void(F.cancelled=!0)}run(h=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const _=this._currentlyRunning=this._queue;this._queue=[];for(const T of _)if(!T.cancelled&&(T.callback(h),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const AA={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},jh={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},rh={showCompass:!0,showZoom:!0,visualizePitch:!1};class uo{constructor(h,_,T=!1){this._clickTolerance=10,this.element=_,this.mouseRotate=new ua({clickTolerance:h.dragRotate._mouseRotate._clickTolerance}),this.map=h,T&&(this.mousePitch=new pn({clickTolerance:h.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),R.addEventListener(_,"mousedown",this.mousedown),R.addEventListener(_,"touchstart",this.touchstart,{passive:!1}),R.addEventListener(_,"touchmove",this.touchmove),R.addEventListener(_,"touchend",this.touchend),R.addEventListener(_,"touchcancel",this.reset)}down(h,_){this.mouseRotate.mousedown(h,_),this.mousePitch&&this.mousePitch.mousedown(h,_),R.disableDrag()}move(h,_){const T=this.map,F=this.mouseRotate.mousemoveWindow(h,_);if(F&&F.bearingDelta&&T.setBearing(T.getBearing()+F.bearingDelta),this.mousePitch){const O=this.mousePitch.mousemoveWindow(h,_);O&&O.pitchDelta&&T.setPitch(T.getPitch()+O.pitchDelta)}}off(){const h=this.element;R.removeEventListener(h,"mousedown",this.mousedown),R.removeEventListener(h,"touchstart",this.touchstart,{passive:!1}),R.removeEventListener(h,"touchmove",this.touchmove),R.removeEventListener(h,"touchend",this.touchend),R.removeEventListener(h,"touchcancel",this.reset),this.offTemp()}offTemp(){R.enableDrag(),R.removeEventListener(window,"mousemove",this.mousemove),R.removeEventListener(window,"mouseup",this.mouseup)}mousedown(h){this.down(i.extend({},h,{ctrlKey:!0,preventDefault:()=>h.preventDefault()}),R.mousePos(this.element,h)),R.addEventListener(window,"mousemove",this.mousemove),R.addEventListener(window,"mouseup",this.mouseup)}mousemove(h){this.move(h,R.mousePos(this.element,h))}mouseup(h){this.mouseRotate.mouseupWindow(h),this.mousePitch&&this.mousePitch.mouseupWindow(h),this.offTemp()}touchstart(h){h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=R.touchPos(this.element,h.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>h.preventDefault()},this._startPos))}touchmove(h){h.targetTouches.length!==1?this.reset():(this._lastPos=R.touchPos(this.element,h.targetTouches)[0],this.move({preventDefault:()=>h.preventDefault()},this._lastPos))}touchend(h){h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Js(M,h,_){if(M=new i.LngLat(M.lng,M.lat),h){const T=new i.LngLat(M.lng-360,M.lat),F=new i.LngLat(M.lng+360,M.lat),O=_.locationPoint(M).distSqr(h);_.locationPoint(T).distSqr(h)<O?M=T:_.locationPoint(F).distSqr(h)<O&&(M=F)}for(;Math.abs(M.lng-_.center.lng)>180;){const T=_.locationPoint(M);if(T.x>=0&&T.y>=0&&T.x<=_.width&&T.y<=_.height)break;M.lng>_.center.lng?M.lng-=360:M.lng+=360}return M}const Fn={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Vn(M,h,_){const T=M.classList;for(const F in Fn)T.remove(`maplibregl-${_}-anchor-${F}`,`mapboxgl-${_}-anchor-${F}`);T.add(`maplibregl-${_}-anchor-${h}`,`mapboxgl-${_}-anchor-${h}`)}class sh extends i.Evented{constructor(h,_){if(super(),(h instanceof HTMLElement||_)&&(h=i.extend({element:h},_)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=h&&h.anchor||"center",this._color=h&&h.color||"#3FB1CE",this._scale=h&&h.scale||1,this._draggable=h&&h.draggable||!1,this._clickTolerance=h&&h.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=h&&h.rotation||0,this._rotationAlignment=h&&h.rotationAlignment||"auto",this._pitchAlignment=h&&h.pitchAlignment&&h.pitchAlignment!=="auto"?h.pitchAlignment:this._rotationAlignment,h&&h.element)this._element=h.element,this._offset=i.pointGeometry.convert(h&&h.offset||[0,0]);else{this._defaultMarker=!0,this._element=R.create("div"),this._element.setAttribute("aria-label","Map marker");const T=R.createNS("http://www.w3.org/2000/svg","svg"),F=41,O=27;T.setAttributeNS(null,"display","block"),T.setAttributeNS(null,"height",`${F}px`),T.setAttributeNS(null,"width",`${O}px`),T.setAttributeNS(null,"viewBox",`0 0 ${O} ${F}`);const K=R.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"stroke","none"),K.setAttributeNS(null,"stroke-width","1"),K.setAttributeNS(null,"fill","none"),K.setAttributeNS(null,"fill-rule","evenodd");const oe=R.createNS("http://www.w3.org/2000/svg","g");oe.setAttributeNS(null,"fill-rule","nonzero");const ue=R.createNS("http://www.w3.org/2000/svg","g");ue.setAttributeNS(null,"transform","translate(3.0, 29.0)"),ue.setAttributeNS(null,"fill","#000000");const ve=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ni of ve){const St=R.createNS("http://www.w3.org/2000/svg","ellipse");St.setAttributeNS(null,"opacity","0.04"),St.setAttributeNS(null,"cx","10.5"),St.setAttributeNS(null,"cy","5.80029008"),St.setAttributeNS(null,"rx",ni.rx),St.setAttributeNS(null,"ry",ni.ry),ue.appendChild(St)}const Te=R.createNS("http://www.w3.org/2000/svg","g");Te.setAttributeNS(null,"fill",this._color);const ke=R.createNS("http://www.w3.org/2000/svg","path");ke.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),Te.appendChild(ke);const We=R.createNS("http://www.w3.org/2000/svg","g");We.setAttributeNS(null,"opacity","0.25"),We.setAttributeNS(null,"fill","#000000");const bt=R.createNS("http://www.w3.org/2000/svg","path");bt.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),We.appendChild(bt);const mt=R.createNS("http://www.w3.org/2000/svg","g");mt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),mt.setAttributeNS(null,"fill","#FFFFFF");const gt=R.createNS("http://www.w3.org/2000/svg","g");gt.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Vt=R.createNS("http://www.w3.org/2000/svg","circle");Vt.setAttributeNS(null,"fill","#000000"),Vt.setAttributeNS(null,"opacity","0.25"),Vt.setAttributeNS(null,"cx","5.5"),Vt.setAttributeNS(null,"cy","5.5"),Vt.setAttributeNS(null,"r","5.4999962");const Zt=R.createNS("http://www.w3.org/2000/svg","circle");Zt.setAttributeNS(null,"fill","#FFFFFF"),Zt.setAttributeNS(null,"cx","5.5"),Zt.setAttributeNS(null,"cy","5.5"),Zt.setAttributeNS(null,"r","5.4999962"),gt.appendChild(Vt),gt.appendChild(Zt),oe.appendChild(ue),oe.appendChild(Te),oe.appendChild(We),oe.appendChild(mt),oe.appendChild(gt),T.appendChild(oe),T.setAttributeNS(null,"height",F*this._scale+"px"),T.setAttributeNS(null,"width",O*this._scale+"px"),this._element.appendChild(T),this._offset=i.pointGeometry.convert(h&&h.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",T=>{T.preventDefault()}),this._element.addEventListener("mousedown",T=>{T.preventDefault()}),Vn(this._element,this._anchor,"marker"),this._popup=null}addTo(h){return this.remove(),this._map=h,h.getCanvasContainer().appendChild(this._element),h.on("move",this._update),h.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),R.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=i.LngLat.convert(h),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(h){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),h){if(!("offset"in h.options)){const F=Math.sqrt(Math.pow(13.5,2)/2);h.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[F,-1*(38.1-13.5+F)],"bottom-right":[-F,-1*(38.1-13.5+F)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=h,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(h){const _=h.code,T=h.charCode||h.keyCode;_!=="Space"&&_!=="Enter"&&T!==32&&T!==13||this.togglePopup()}_onMapClick(h){const _=h.originalEvent.target,T=this._element;this._popup&&(_===T||T.contains(_))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const h=this._popup;return h?(h.isOpen()?h.remove():h.addTo(this._map),this):this}_update(h){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Js(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let _="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?_=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(_=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let T="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?T="rotateX(0deg)":this._pitchAlignment==="map"&&(T=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),R.setTransform(this._element,`${Fn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${T} ${_}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const F=this._map.unproject(this._pos),O=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=F.distanceTo(this._lngLat)>20*O?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(h){return this._offset=i.pointGeometry.convert(h),this._update(),this}_onMove(h){if(!this._isDragging){const _=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=_}this._isDragging&&(this._pos=h.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new i.Event("dragend")),this._state="inactive"}_addDragHandler(h){this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(h){return this._draggable=!!h,this._map&&(h?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(h){return this._rotation=h||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(h){return this._rotationAlignment=h||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(h){return this._pitchAlignment=h&&h!=="auto"?h:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const dA={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let yl,Es=0,Wa=!1;const Go={maxWidth:100,unit:"metric"};function pA(M,h,_){const T=_&&_.maxWidth||100,F=M._container.clientHeight/2,O=M.unproject([0,F]),K=M.unproject([T,F]),oe=O.distanceTo(K);if(_&&_.unit==="imperial"){const ue=3.2808*oe;ue>5280?va(h,T,ue/5280,M._getUIString("ScaleControl.Miles")):va(h,T,ue,M._getUIString("ScaleControl.Feet"))}else _&&_.unit==="nautical"?va(h,T,oe/1852,M._getUIString("ScaleControl.NauticalMiles")):oe>=1e3?va(h,T,oe/1e3,M._getUIString("ScaleControl.Kilometers")):va(h,T,oe,M._getUIString("ScaleControl.Meters"))}function va(M,h,_,T){const F=function(O){const K=Math.pow(10,`${Math.floor(O)}`.length-1);let oe=O/K;return oe=oe>=10?10:oe>=5?5:oe>=3?3:oe>=2?2:oe>=1?1:function(ue){const ve=Math.pow(10,Math.ceil(-Math.log(ue)/Math.LN10));return Math.round(ue*ve)/ve}(oe),K*oe}(_);M.style.width=h*(F/_)+"px",M.innerHTML=`${F} ${T}`}const us={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Fs=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Kh(M){if(M){if(typeof M=="number"){const h=Math.round(Math.sqrt(.5*Math.pow(M,2)));return{center:new i.pointGeometry(0,0),top:new i.pointGeometry(0,M),"top-left":new i.pointGeometry(h,h),"top-right":new i.pointGeometry(-h,h),bottom:new i.pointGeometry(0,-M),"bottom-left":new i.pointGeometry(h,-h),"bottom-right":new i.pointGeometry(-h,-h),left:new i.pointGeometry(M,0),right:new i.pointGeometry(-M,0)}}if(M instanceof i.pointGeometry||Array.isArray(M)){const h=i.pointGeometry.convert(M);return{center:h,top:h,"top-left":h,"top-right":h,bottom:h,"bottom-left":h,"bottom-right":h,left:h,right:h}}return{center:i.pointGeometry.convert(M.center||[0,0]),top:i.pointGeometry.convert(M.top||[0,0]),"top-left":i.pointGeometry.convert(M["top-left"]||[0,0]),"top-right":i.pointGeometry.convert(M["top-right"]||[0,0]),bottom:i.pointGeometry.convert(M.bottom||[0,0]),"bottom-left":i.pointGeometry.convert(M["bottom-left"]||[0,0]),"bottom-right":i.pointGeometry.convert(M["bottom-right"]||[0,0]),left:i.pointGeometry.convert(M.left||[0,0]),right:i.pointGeometry.convert(M.right||[0,0])}}return Kh(new i.pointGeometry(0,0))}const xl={supported:C,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends Zr{constructor(M){var h;if(i.PerformanceUtils.mark(i.PerformanceMarkers.create),(M=i.extend({},jh,M)).minZoom!=null&&M.maxZoom!=null&&M.minZoom>M.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(M.minPitch!=null&&M.maxPitch!=null&&M.minPitch>M.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(M.minPitch!=null&&M.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(M.maxPitch!=null&&M.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new qc(M.minZoom,M.maxZoom,M.minPitch,M.maxPitch,M.renderWorldCopies),{bearingSnap:M.bearingSnap}),this._interactive=M.interactive,this._cooperativeGestures=M.cooperativeGestures,this._maxTileCacheSize=M.maxTileCacheSize,this._failIfMajorPerformanceCaveat=M.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=M.preserveDrawingBuffer,this._antialias=M.antialias,this._trackResize=M.trackResize,this._bearingSnap=M.bearingSnap,this._refreshExpiredTiles=M.refreshExpiredTiles,this._fadeDuration=M.fadeDuration,this._crossSourceCollisions=M.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=M.collectResourceTiming,this._renderTaskQueue=new yc,this._controls=[],this._mapId=i.uniqueId(),this._locale=i.extend({},AA,M.locale),this._clickTolerance=M.clickTolerance,this._pixelRatio=(h=M.pixelRatio)!==null&&h!==void 0?h:devicePixelRatio,this._requestManager=new G(M.transformRequest),typeof M.container=="string"){if(this._container=document.getElementById(M.container),!this._container)throw new Error(`Container '${M.container}' not found.`)}else{if(!(M.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=M.container}if(M.maxBounds&&this.setMaxBounds(M.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new An(this,M),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=M.hash&&new Uh(typeof M.hash=="string"&&M.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:M.center,zoom:M.zoom,bearing:M.bearing,pitch:M.pitch}),M.bounds&&(this.resize(),this.fitBounds(M.bounds,i.extend({},M.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=M.localIdeographFontFamily,M.style&&this.setStyle(M.style,{localIdeographFontFamily:M.localIdeographFontFamily}),M.attributionControl&&this.addControl(new nh({customAttribution:M.customAttribution})),M.maplibreLogo&&this.addControl(new Wh,M.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new i.Event(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new i.Event(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new i.Event("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(M,h){if(h===void 0&&(h=M.getDefaultPosition?M.getDefaultPosition():"top-right"),!M||!M.onAdd)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const _=M.onAdd(this);this._controls.push(M);const T=this._controlPositions[h];return h.indexOf("bottom")!==-1?T.insertBefore(_,T.firstChild):T.appendChild(_),this}removeControl(M){if(!M||!M.onRemove)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const h=this._controls.indexOf(M);return h>-1&&this._controls.splice(h,1),M.onRemove(this),this}hasControl(M){return this._controls.indexOf(M)>-1}calculateCameraOptionsFromTo(M,h,_,T){return T==null&&this.style.terrain&&(T=this.transform.getElevation(_,this.style.terrain)),super.calculateCameraOptionsFromTo(M,h,_,T)}resize(M){const h=this._containerDimensions(),_=h[0],T=h[1];this._resizeCanvas(_,T,this.getPixelRatio()),this.transform.resize(_,T),this.painter.resize(_,T,this.getPixelRatio());const F=!this._moving;return F&&(this.stop(),this.fire(new i.Event("movestart",M)).fire(new i.Event("move",M))),this.fire(new i.Event("resize",M)),F&&this.fire(new i.Event("moveend",M)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(M){const[h,_]=this._containerDimensions();this._pixelRatio=M,this._resizeCanvas(h,_,M),this.painter.resize(h,_,M)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(M){return this.transform.setMaxBounds(i.LngLatBounds.convert(M)),this._update()}setMinZoom(M){if((M=M==null?-2:M)>=-2&&M<=this.transform.maxZoom)return this.transform.minZoom=M,this._update(),this.getZoom()<M&&this.setZoom(M),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(M){if((M=M==null?22:M)>=this.transform.minZoom)return this.transform.maxZoom=M,this._update(),this.getZoom()>M&&this.setZoom(M),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(M){if((M=M==null?0:M)<0)throw new Error("minPitch must be greater than or equal to 0");if(M>=0&&M<=this.transform.maxPitch)return this.transform.minPitch=M,this._update(),this.getPitch()<M&&this.setPitch(M),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(M){if((M=M==null?60:M)>85)throw new Error("maxPitch must be less than or equal to 85");if(M>=this.transform.minPitch)return this.transform.maxPitch=M,this._update(),this.getPitch()>M&&this.setPitch(M),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(M){return this.transform.renderWorldCopies=M,this._update()}project(M){return this.transform.locationPoint(i.LngLat.convert(M),this.style&&this.style.terrain)}unproject(M){return this.transform.pointLocation(i.pointGeometry.convert(M),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(M,h,_){if(M==="mouseenter"||M==="mouseover"){let T=!1;return{layer:h,listener:_,delegates:{mousemove:O=>{const K=this.getLayer(h)?this.queryRenderedFeatures(O.point,{layers:[h]}):[];K.length?T||(T=!0,_.call(this,new So(M,this,O.originalEvent,{features:K}))):T=!1},mouseout:()=>{T=!1}}}}if(M==="mouseleave"||M==="mouseout"){let T=!1;return{layer:h,listener:_,delegates:{mousemove:K=>{(this.getLayer(h)?this.queryRenderedFeatures(K.point,{layers:[h]}):[]).length?T=!0:T&&(T=!1,_.call(this,new So(M,this,K.originalEvent)))},mouseout:K=>{T&&(T=!1,_.call(this,new So(M,this,K.originalEvent)))}}}}{const T=F=>{const O=this.getLayer(h)?this.queryRenderedFeatures(F.point,{layers:[h]}):[];O.length&&(F.features=O,_.call(this,F),delete F.features)};return{layer:h,listener:_,delegates:{[M]:T}}}}on(M,h,_){if(_===void 0)return super.on(M,h);const T=this._createDelegatedListener(M,h,_);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[M]=this._delegatedListeners[M]||[],this._delegatedListeners[M].push(T);for(const F in T.delegates)this.on(F,T.delegates[F]);return this}once(M,h,_){if(_===void 0)return super.once(M,h);const T=this._createDelegatedListener(M,h,_);for(const F in T.delegates)this.once(F,T.delegates[F]);return this}off(M,h,_){return _===void 0?super.off(M,h):(this._delegatedListeners&&this._delegatedListeners[M]&&(T=>{const F=this._delegatedListeners[M];for(let O=0;O<F.length;O++){const K=F[O];if(K.layer===h&&K.listener===_){for(const oe in K.delegates)this.off(oe,K.delegates[oe]);return F.splice(O,1),this}}})(),this)}queryRenderedFeatures(M,h){if(!this.style)return[];let _;if(h!==void 0||M===void 0||M instanceof i.pointGeometry||Array.isArray(M)||(h=M,M=void 0),h=h||{},(M=M||[[0,0],[this.transform.width,this.transform.height]])instanceof i.pointGeometry||typeof M[0]=="number")_=[i.pointGeometry.convert(M)];else{const T=i.pointGeometry.convert(M[0]),F=i.pointGeometry.convert(M[1]);_=[T,new i.pointGeometry(F.x,T.y),F,new i.pointGeometry(T.x,F.y),T]}return this.style.queryRenderedFeatures(_,h,this.transform)}querySourceFeatures(M,h){return this.style.querySourceFeatures(M,h)}setStyle(M,h){return(h=i.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},h)).diff!==!1&&h.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&M?(this._diffStyle(M,h),this):(this._localIdeographFontFamily=h.localIdeographFontFamily,this._updateStyle(M,h))}setTransformRequest(M){return this._requestManager.setTransformRequest(M),this}_getUIString(M){const h=this._locale[M];if(h==null)throw new Error(`Missing UI string '${M}'`);return h}_updateStyle(M,h){return this.style&&(this.style.setEventedParent(null),this.style._remove()),M?(this.style=new Mr(this,h||{}),this.style.setEventedParent(this,{style:this.style}),typeof M=="string"?this.style.loadURL(M):this.style.loadJSON(M),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Mr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(M,h){if(typeof M=="string"){const _=this._requestManager.transformRequest(M,i.ResourceType.Style);i.getJSON(_,(T,F)=>{T?this.fire(new i.ErrorEvent(T)):F&&this._updateDiff(F,h)})}else typeof M=="object"&&this._updateDiff(M,h)}_updateDiff(M,h){try{this.style.setState(M)&&this._update(!0)}catch(_){i.warnOnce(`Unable to perform style diff: ${_.message||_.error||_}. Rebuilding the style from scratch.`),this._updateStyle(M,h)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.warnOnce("There is no style added to the map.")}addSource(M,h){return this._lazyInitEmptyStyle(),this.style.addSource(M,h),this._update(!0)}isSourceLoaded(M){const h=this.style&&this.style.sourceCaches[M];if(h!==void 0)return h.loaded();this.fire(new i.ErrorEvent(new Error(`There is no source with ID '${M}'`)))}setTerrain(M){return this.style.setTerrain(M),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const M=this.style&&this.style.sourceCaches;for(const h in M){const _=M[h]._tiles;for(const T in _){const F=_[T];if(F.state!=="loaded"&&F.state!=="errored")return!1}}return!0}addSourceType(M,h,_){return this._lazyInitEmptyStyle(),this.style.addSourceType(M,h,_)}removeSource(M){return this.style.removeSource(M),this._update(!0)}getSource(M){return this.style.getSource(M)}addImage(M,h,{pixelRatio:_=1,sdf:T=!1,stretchX:F,stretchY:O,content:K}={}){if(this._lazyInitEmptyStyle(),h instanceof HTMLImageElement||i.isImageBitmap(h)){const{width:oe,height:ue,data:ve}=i.exported.getImageData(h);this.style.addImage(M,{data:new i.RGBAImage({width:oe,height:ue},ve),pixelRatio:_,stretchX:F,stretchY:O,content:K,sdf:T,version:0})}else{if(h.width===void 0||h.height===void 0)return this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:oe,height:ue,data:ve}=h,Te=h;this.style.addImage(M,{data:new i.RGBAImage({width:oe,height:ue},new Uint8Array(ve)),pixelRatio:_,stretchX:F,stretchY:O,content:K,sdf:T,version:0,userImage:Te}),Te.onAdd&&Te.onAdd(this,M)}}}updateImage(M,h){const _=this.style.getImage(M);if(!_)return this.fire(new i.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const T=h instanceof HTMLImageElement||i.isImageBitmap(h)?i.exported.getImageData(h):h,{width:F,height:O,data:K}=T;if(F===void 0||O===void 0)return this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(F!==_.data.width||O!==_.data.height)return this.fire(new i.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const oe=!(h instanceof HTMLImageElement||i.isImageBitmap(h));_.data.replace(K,oe),this.style.updateImage(M,_)}hasImage(M){return M?!!this.style.getImage(M):(this.fire(new i.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(M){this.style.removeImage(M)}loadImage(M,h){i.getImage(this._requestManager.transformRequest(M,i.ResourceType.Image),h)}listImages(){return this.style.listImages()}addLayer(M,h){return this._lazyInitEmptyStyle(),this.style.addLayer(M,h),this._update(!0)}moveLayer(M,h){return this.style.moveLayer(M,h),this._update(!0)}removeLayer(M){return this.style.removeLayer(M),this._update(!0)}getLayer(M){return this.style.getLayer(M)}setLayerZoomRange(M,h,_){return this.style.setLayerZoomRange(M,h,_),this._update(!0)}setFilter(M,h,_={}){return this.style.setFilter(M,h,_),this._update(!0)}getFilter(M){return this.style.getFilter(M)}setPaintProperty(M,h,_,T={}){return this.style.setPaintProperty(M,h,_,T),this._update(!0)}getPaintProperty(M,h){return this.style.getPaintProperty(M,h)}setLayoutProperty(M,h,_,T={}){return this.style.setLayoutProperty(M,h,_,T),this._update(!0)}getLayoutProperty(M,h){return this.style.getLayoutProperty(M,h)}setLight(M,h={}){return this._lazyInitEmptyStyle(),this.style.setLight(M,h),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(M,h){return this.style.setFeatureState(M,h),this._update()}removeFeatureState(M,h){return this.style.removeFeatureState(M,h),this._update()}getFeatureState(M){return this.style.getFeatureState(M)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let M=0,h=0;return this._container&&(M=this._container.clientWidth||400,h=this._container.clientHeight||300),[M,h]}_setupContainer(){const M=this._container;M.classList.add("maplibregl-map","mapboxgl-map");const h=this._canvasContainer=R.create("div","maplibregl-canvas-container mapboxgl-canvas-container",M);this._interactive&&h.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=R.create("canvas","maplibregl-canvas mapboxgl-canvas",h),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const _=this._containerDimensions();this._resizeCanvas(_[0],_[1],this.getPixelRatio());const T=this._controlContainer=R.create("div","maplibregl-control-container mapboxgl-control-container",M),F=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(O=>{F[O]=R.create("div",`maplibregl-ctrl-${O} mapboxgl-ctrl-${O}`,T)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const M=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=R.create("div","maplibregl-cooperative-gesture-screen",M);let h="Control",_=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(_=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",h="Meta"),this._cooperativeGesturesScreen.innerHTML=`
- <div class="maplibregl-desktop-message">${_}</div>
- <div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
- `,document.addEventListener("keydown",T=>{T.key===h&&(this._metaPress=!0)}),document.addEventListener("keyup",T=>{T.key===h&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",T=>{this._onCooperativeGesture(T,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(M,h,_){this._canvas.width=_*M,this._canvas.height=_*h,this._canvas.style.width=`${M}px`,this._canvas.style.height=`${h}px`}_setupPainter(){const M=i.extend({},C.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),h=this._canvas.getContext("webgl",M)||this._canvas.getContext("experimental-webgl",M);h?(this.painter=new vu(h,this.transform),i.exported$1.testSupport(h)):this.fire(new i.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(M){M.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:M}))}_contextRestored(M){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:M}))}_onMapScroll(M){if(M.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(M,h,_){return!h&&_<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(M){return this.style?(this._styleDirty=this._styleDirty||M,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(M){return this._update(),this._renderTaskQueue.add(M)}_cancelRenderFrame(M){this._renderTaskQueue.remove(M)}_render(M){let h,_=0;const T=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(h=T.createQueryEXT(),T.beginQueryEXT(T.TIME_ELAPSED_EXT,h),_=i.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(M),this._removed)return;let F=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const K=this.transform.zoom,oe=i.exported.now();this.style.zoomHistory.update(K,oe);const ue=new i.EvaluationParameters(K,{now:oe,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),ve=ue.crossFadingFactor();ve===1&&ve===this._crossFadingFactor||(F=!0,this._crossFadingFactor=ve),this.style.update(ue)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.PerformanceUtils.mark(i.PerformanceMarkers.load),this.fire(new i.Event("load"))),this.style&&(this.style.hasTransitions()||F)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const K=i.exported.now()-_;T.endQueryEXT(T.TIME_ELAPSED_EXT,h),setTimeout(()=>{const oe=T.getQueryObjectEXT(h,T.QUERY_RESULT_EXT)/1e6;T.deleteQueryEXT(h),this.fire(new i.Event("gpu-timing-frame",{cpuTime:K,gpuTime:oe}))},50)}if(this.listens("gpu-timing-layer")){const K=this.painter.collectGpuTimers();setTimeout(()=>{const oe=this.painter.queryGpuTimers(K);this.fire(new i.Event("gpu-timing-layer",{layerTimes:oe}))},50)}const O=this._sourcesDirty||this._styleDirty||this._placementDirty;return O||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.Event("idle")),!this._loaded||this._fullyLoaded||O||(this._fullyLoaded=!0,i.PerformanceUtils.mark(i.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const h of this._controls)h.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const M=this.painter.context.gl.getExtension("WEBGL_lose_context");M&&M.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),R.remove(this._canvasContainer),R.remove(this._controlContainer),this._cooperativeGestures&&R.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),i.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new i.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=i.exported.frame(M=>{i.PerformanceUtils.frame(M),this._frame=null,this._render(M)}))}_onWindowOnline(){this._update()}_onWindowResize(M){this._trackResize&&this.resize({originalEvent:M})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(M){this._showTileBoundaries!==M&&(this._showTileBoundaries=M,this._update())}get showPadding(){return!!this._showPadding}set showPadding(M){this._showPadding!==M&&(this._showPadding=M,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(M){this._showCollisionBoxes!==M&&(this._showCollisionBoxes=M,M?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(M){this._showOverdrawInspector!==M&&(this._showOverdrawInspector=M,this._update())}get repaint(){return!!this._repaint}set repaint(M){this._repaint!==M&&(this._repaint=M,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(M){this._vertices=M,this._update()}_setCacheLimits(M,h){i.setCacheLimits(M,h)}get version(){return"2.4.0"}},NavigationControl:class{constructor(M){this.options=i.extend({},rh,M),this._container=R.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",h=>h.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",h=>this._map.zoomIn({},{originalEvent:h})),R.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",h=>this._map.zoomOut({},{originalEvent:h})),R.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",h=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:h}):this._map.resetNorth({},{originalEvent:h})}),this._compassIcon=R.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const M=this._map.getZoom(),h=M===this._map.getMaxZoom(),_=M===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=_,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",_.toString())}_rotateCompassArrow(){const M=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=M}onAdd(M){return this._map=M,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new uo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){R.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(M,h){const _=R.create("button",M,this._container);return _.type="button",_.addEventListener("click",h),_}_setButtonTitle(M,h){const _=this._map._getUIString(`NavigationControl.${h}`);M.title=_,M.setAttribute("aria-label",_)}},GeolocateControl:class extends i.Evented{constructor(M){super(),this.options=i.extend({},dA,M),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(M){var h;return this._map=M,this._container=R.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),h=this._setupUI,yl!==void 0?h(yl):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(_=>{yl=_.state!=="denied",h(yl)}):(yl=!!window.navigator.geolocation,h(yl)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),R.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Es=0,Wa=!1}_isOutOfMapMaxBounds(M){const h=this._map.getMaxBounds(),_=M.coords;return h&&(_.longitude<h.getWest()||_.longitude>h.getEast()||_.latitude<h.getSouth()||_.latitude>h.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(M){if(this._map){if(this._isOutOfMapMaxBounds(M))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",M)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=M,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(M),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(M),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",M)),this._finish()}}_updateCamera(M){const h=new i.LngLat(M.coords.longitude,M.coords.latitude),_=M.coords.accuracy,T=this._map.getBearing(),F=i.extend({bearing:T},this.options.fitBoundsOptions);this._map.fitBounds(h.toBounds(_),F,{geolocateSource:!0})}_updateMarker(M){if(M){const h=new i.LngLat(M.coords.longitude,M.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=M.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const M=this._map._container.clientHeight/2,h=this._map.unproject([0,M]),_=this._map.unproject([1,M]),T=h.distanceTo(_),F=Math.ceil(2*this._accuracy/T);this._circleElement.style.width=`${F}px`,this._circleElement.style.height=`${F}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(M){if(this._map){if(this.options.trackUserLocation)if(M.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(M.code===3&&Wa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",M)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(M){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=R.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),R.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",M===!1){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=R.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new sh(this._dotElement),this._circleElement=R.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new sh({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return i.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Es--,Wa=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let M;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Es++,Es>1?(M={maximumAge:6e5,timeout:0},Wa=!0):(M=this.options.positionOptions,Wa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,M)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:nh,LogoControl:Wh,ScaleControl:class{constructor(M){this.options=i.extend({},Go,M),i.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){pA(this._map,this._container,this.options)}onAdd(M){return this._map=M,this._container=R.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",M.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){R.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(M){this.options.unit=M,pA(this._map,this._container,this.options)}},FullscreenControl:class{constructor(M){this._fullscreen=!1,M&&M.container&&(M.container instanceof HTMLElement?this._container=M.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(M){return this._map=M,this._container||(this._container=this._map.getContainer()),this._controlContainer=R.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){R.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const M=this._fullscreenButton=R.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);R.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",M).setAttribute("aria-hidden","true"),M.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const M=this._getTitle();this._fullscreenButton.setAttribute("aria-label",M),this._fullscreenButton.title=M}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(M){this.options=M,i.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(M){return this._map=M,this._container=R.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=R.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),R.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){R.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends i.Evented{constructor(M){super(),this.options=i.extend(Object.create(us),M),i.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(M){return this._map&&this.remove(),this._map=M,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new i.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&R.remove(this._content),this._container&&(R.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(M){return this._lngLat=i.LngLat.convert(M),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(M){return this.setDOMContent(document.createTextNode(M))}setHTML(M){const h=document.createDocumentFragment(),_=document.createElement("body");let T;for(_.innerHTML=M;T=_.firstChild,T;)h.appendChild(T);return this.setDOMContent(h)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(M){return this.options.maxWidth=M,this._update(),this}setDOMContent(M){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=R.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(M),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(M){this._container&&this._container.classList.add(M)}removeClassName(M){this._container&&this._container.classList.remove(M)}setOffset(M){return this.options.offset=M,this._update(),this}toggleClassName(M){if(this._container)return this._container.classList.toggle(M)}_createCloseButton(){this.options.closeButton&&(this._closeButton=R.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(M){this._update(M.point)}_onMouseMove(M){this._update(M.point)}_onDrag(M){this._update(M.point)}_update(M){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=R.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=R.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(O=>this._container.classList.add(O)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Js(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!M))return;const h=this._pos=this._trackPointer&&M?M:this._map.project(this._lngLat);let _=this.options.anchor;const T=Kh(this.options.offset);if(!_){const O=this._container.offsetWidth,K=this._container.offsetHeight;let oe;oe=h.y+T.bottom.y<K?["top"]:h.y>this._map.transform.height-K?["bottom"]:[],h.x<O/2?oe.push("left"):h.x>this._map.transform.width-O/2&&oe.push("right"),_=oe.length===0?"bottom":oe.join("-")}const F=h.add(T[_]).round();R.setTransform(this._container,`${Fn[_]} translate(${F.x}px,${F.y}px)`),Vn(this._container,_,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const M=this._container.querySelector(Fs);M&&M.focus()}_onClose(){this.remove()}},Marker:sh,Style:Mr,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,Evented:i.Evented,AJAXError:i.AJAXError,config:i.config,CanvasSource:Le,GeoJSONSource:ze,ImageSource:Ge,RasterDEMTileSource:xe,RasterTileSource:ce,VectorTileSource:te,VideoSource:Ve,prewarm:function(){fi().acquire(Ct)},clearPrewarmedResources:function(){const M=mi;M&&(M.isPreloaded()&&M.numActive()===1?(M.release(Ct),mi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Ft.workerCount},set workerCount(M){Ft.workerCount=M},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(M){i.config.MAX_PARALLEL_IMAGE_REQUESTS=M},clearStorage(M){i.clearTileCache(M)},workerUrl:"",addProtocol(M,h){i.config.REGISTERED_PROTOCOLS[M]=h},removeProtocol(M){delete i.config.REGISTERED_PROTOCOLS[M]}};return vs.extend(xl,{isSafari:i.isSafari,getPerformanceMetrics:i.PerformanceUtils.getPerformanceMetrics}),xl});var y=c;return y})})(Ua);const xR=Ua.exports,vR=ES({__proto__:null,default:xR},[Ua.exports]);var I_={Linear:{None:function(u){return u}},Quadratic:{In:function(u){return u*u},Out:function(u){return u*(2-u)},InOut:function(u){return(u*=2)<1?.5*u*u:-.5*(--u*(u-2)-1)}},Cubic:{In:function(u){return u*u*u},Out:function(u){return--u*u*u+1},InOut:function(u){return(u*=2)<1?.5*u*u*u:.5*((u-=2)*u*u+2)}},Quartic:{In:function(u){return u*u*u*u},Out:function(u){return 1- --u*u*u*u},InOut:function(u){return(u*=2)<1?.5*u*u*u*u:-.5*((u-=2)*u*u*u-2)}},Quintic:{In:function(u){return u*u*u*u*u},Out:function(u){return--u*u*u*u*u+1},InOut:function(u){return(u*=2)<1?.5*u*u*u*u*u:.5*((u-=2)*u*u*u*u+2)}},Sinusoidal:{In:function(u){return 1-Math.cos(u*Math.PI/2)},Out:function(u){return Math.sin(u*Math.PI/2)},InOut:function(u){return .5*(1-Math.cos(Math.PI*u))}},Exponential:{In:function(u){return u===0?0:Math.pow(1024,u-1)},Out:function(u){return u===1?1:1-Math.pow(2,-10*u)},InOut:function(u){return u===0?0:u===1?1:(u*=2)<1?.5*Math.pow(1024,u-1):.5*(-Math.pow(2,-10*(u-1))+2)}},Circular:{In:function(u){return 1-Math.sqrt(1-u*u)},Out:function(u){return Math.sqrt(1- --u*u)},InOut:function(u){return(u*=2)<1?-.5*(Math.sqrt(1-u*u)-1):.5*(Math.sqrt(1-(u-=2)*u)+1)}},Elastic:{In:function(u){return u===0?0:u===1?1:-Math.pow(2,10*(u-1))*Math.sin((u-1.1)*5*Math.PI)},Out:function(u){return u===0?0:u===1?1:Math.pow(2,-10*u)*Math.sin((u-.1)*5*Math.PI)+1},InOut:function(u){return u===0?0:u===1?1:(u*=2,u<1?-.5*Math.pow(2,10*(u-1))*Math.sin((u-1.1)*5*Math.PI):.5*Math.pow(2,-10*(u-1))*Math.sin((u-1.1)*5*Math.PI)+1)}},Back:{In:function(u){var e=1.70158;return u*u*((e+1)*u-e)},Out:function(u){var e=1.70158;return--u*u*((e+1)*u+e)+1},InOut:function(u){var e=2.5949095;return(u*=2)<1?.5*(u*u*((e+1)*u-e)):.5*((u-=2)*u*((e+1)*u+e)+2)}},Bounce:{In:function(u){return 1-I_.Bounce.Out(1-u)},Out:function(u){return u<1/2.75?7.5625*u*u:u<2/2.75?7.5625*(u-=1.5/2.75)*u+.75:u<2.5/2.75?7.5625*(u-=2.25/2.75)*u+.9375:7.5625*(u-=2.625/2.75)*u+.984375},InOut:function(u){return u<.5?I_.Bounce.In(u*2)*.5:I_.Bounce.Out(u*2-1)*.5+.5}}},v_;typeof self>"u"&&typeof process<"u"&&process.hrtime?v_=function(){var u=process.hrtime();return u[0]*1e3+u[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?v_=self.performance.now.bind(self.performance):Date.now!==void 0?v_=Date.now:v_=function(){return new Date().getTime()};var Yp=v_,DM=function(){function u(){this._tweens={},this._tweensAddedDuringUpdate={}}return u.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},u.prototype.removeAll=function(){this._tweens={}},u.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},u.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},u.prototype.update=function(e,t){e===void 0&&(e=Yp()),t===void 0&&(t=!1);var r=Object.keys(this._tweens);if(r.length===0)return!1;for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var c=0;c<r.length;c++){var p=this._tweens[r[c]],y=!t;p&&p.update(e,y)===!1&&!t&&delete this._tweens[r[c]]}r=Object.keys(this._tweensAddedDuringUpdate)}return!0},u}(),Lm={Linear:function(u,e){var t=u.length-1,r=t*e,c=Math.floor(r),p=Lm.Utils.Linear;return e<0?p(u[0],u[1],r):e>1?p(u[t],u[t-1],t-r):p(u[c],u[c+1>t?t:c+1],r-c)},Bezier:function(u,e){for(var t=0,r=u.length-1,c=Math.pow,p=Lm.Utils.Bernstein,y=0;y<=r;y++)t+=c(1-e,r-y)*c(e,y)*u[y]*p(r,y);return t},CatmullRom:function(u,e){var t=u.length-1,r=t*e,c=Math.floor(r),p=Lm.Utils.CatmullRom;return u[0]===u[t]?(e<0&&(c=Math.floor(r=t*(1+e))),p(u[(c-1+t)%t],u[c],u[(c+1)%t],u[(c+2)%t],r-c)):e<0?u[0]-(p(u[0],u[0],u[1],u[1],-r)-u[0]):e>1?u[t]-(p(u[t],u[t],u[t-1],u[t-1],r-t)-u[t]):p(u[c?c-1:0],u[c],u[t<c+1?t:c+1],u[t<c+2?t:c+2],r-c)},Utils:{Linear:function(u,e,t){return(e-u)*t+u},Bernstein:function(u,e){var t=Lm.Utils.Factorial;return t(u)/t(e)/t(u-e)},Factorial:function(){var u=[1];return function(e){var t=1;if(u[e])return u[e];for(var r=e;r>1;r--)t*=r;return u[e]=t,t}}(),CatmullRom:function(u,e,t,r,c){var p=(t-u)*.5,y=(r-e)*.5,i=c*c,C=c*i;return(2*e-2*t+p+y)*C+(-3*e+3*t-2*p-y)*i+p*c+e}}},F2=function(){function u(){}return u.nextId=function(){return u._nextId++},u._nextId=0,u}(),PM=new DM,wR=function(){function u(e,t){t===void 0&&(t=PM),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=I_.Linear.None,this._interpolationFunction=Lm.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=F2.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return u.prototype.getId=function(){return this._id},u.prototype.isPlaying=function(){return this._isPlaying},u.prototype.isPaused=function(){return this._isPaused},u.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),t!==void 0&&(this._duration=t),this},u.prototype.duration=function(e){return this._duration=e,this},u.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var t in this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?Yp()+parseFloat(e):e:Yp(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},u.prototype._setupProperties=function(e,t,r,c){for(var p in r){var y=e[p],i=Array.isArray(y),C=i?"array":typeof y,D=!i&&Array.isArray(r[p]);if(!(C==="undefined"||C==="function")){if(D){var U=r[p];if(U.length===0)continue;U=U.map(this._handleRelativeValue.bind(this,y)),r[p]=[y].concat(U)}if((C==="object"||i)&&y&&!D){t[p]=i?[]:{};for(var N in y)t[p][N]=y[N];c[p]=i?[]:{},this._setupProperties(y,t[p],r[p],c[p])}else typeof t[p]>"u"&&(t[p]=y),i||(t[p]*=1),D?c[p]=r[p].slice().reverse():c[p]=t[p]||0}}},u.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},u.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},u.prototype.pause=function(e){return e===void 0&&(e=Yp()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},u.prototype.resume=function(e){return e===void 0&&(e=Yp()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},u.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},u.prototype.group=function(e){return this._group=e,this},u.prototype.delay=function(e){return this._delayTime=e,this},u.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},u.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},u.prototype.yoyo=function(e){return this._yoyo=e,this},u.prototype.easing=function(e){return this._easingFunction=e,this},u.prototype.interpolation=function(e){return this._interpolationFunction=e,this},u.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},u.prototype.onStart=function(e){return this._onStartCallback=e,this},u.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},u.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},u.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},u.prototype.onStop=function(e){return this._onStopCallback=e,this},u.prototype.update=function(e,t){if(e===void 0&&(e=Yp()),t===void 0&&(t=!0),this._isPaused)return!0;var r,c,p=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>p)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),c=(e-this._startTime)/this._duration,c=this._duration===0||c>1?1:c;var y=this._easingFunction(c);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,y),this._onUpdateCallback&&this._onUpdateCallback(this._object,c),c===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(r in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[r]=="string"&&(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(this._valuesEnd[r])),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var i=0,C=this._chainedTweens.length;i<C;i++)this._chainedTweens[i].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},u.prototype._updateProperties=function(e,t,r,c){for(var p in r)if(t[p]!==void 0){var y=t[p]||0,i=r[p],C=Array.isArray(e[p]),D=Array.isArray(i),U=!C&&D;U?e[p]=this._interpolationFunction(i,c):typeof i=="object"&&i?this._updateProperties(e[p],y,i,c):(i=this._handleRelativeValue(y,i),typeof i=="number"&&(e[p]=y+(i-y)*c))}},u.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},u.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],r=this._valuesEnd[e];typeof r=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(r):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},u}(),bR="18.6.4",BR=F2.nextId,Wu=PM,CR=Wu.getAll.bind(Wu),ER=Wu.removeAll.bind(Wu),TR=Wu.add.bind(Wu),SR=Wu.remove.bind(Wu),MR=Wu.update.bind(Wu),N_={Easing:I_,Group:DM,Interpolation:Lm,now:Yp,Sequence:F2,nextId:BR,Tween:wR,VERSION:bR,getAll:CR,removeAll:ER,add:TR,remove:SR,update:MR};/**
- * @license
- * Copyright 2010-2022 Three.js Authors
- * SPDX-License-Identifier: MIT
- */const Ov="148",$p={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Zp={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},UM=0,Db=1,RM=2,IR=3,FR=0,L2=1,zM=2,Dm=3,ju=0,Dc=1,Il=2,w_=3,KA=0,Af=1,uv=2,Pb=3,Ub=4,kM=5,Jp=100,OM=101,NM=102,Rb=103,zb=104,QM=200,VM=201,HM=202,GM=203,D2=204,P2=205,WM=206,jM=207,KM=208,$M=209,ZM=210,XM=0,qM=1,YM=2,Av=3,JM=4,eI=5,tI=6,iI=7,hy=0,nI=1,rI=2,Vu=0,U2=1,sI=2,oI=3,aI=4,lI=5,Nv=300,op=301,ap=302,Q_=303,V_=304,qm=306,HA=1e3,rl=1001,H_=1002,Co=1003,dv=1004,LR=1004,F_=1005,DR=1005,Xs=1006,R2=1007,PR=1007,lp=1008,UR=1008,cp=1009,cI=1010,hI=1011,z2=1012,uI=1013,Yd=1014,GA=1015,Gm=1016,AI=1017,dI=1018,df=1020,pI=1021,fI=1022,Dl=1023,mI=1024,gI=1025,ip=1026,gf=1027,_I=1028,yI=1029,xI=1030,vI=1031,wI=1033,jx=33776,Kx=33777,$x=33778,Zx=33779,kb=35840,Ob=35841,Nb=35842,Qb=35843,bI=36196,Vb=37492,Hb=37496,Gb=37808,Wb=37809,jb=37810,Kb=37811,$b=37812,Zb=37813,Xb=37814,qb=37815,Yb=37816,Jb=37817,e2=37818,t2=37819,i2=37820,n2=37821,r2=36492,BI=2200,CI=2201,EI=2202,G_=2300,W_=2301,Xx=2302,of=2400,af=2401,j_=2402,Qv=2500,k2=2501,RR=0,zR=1,kR=2,hp=3e3,Ss=3001,TI=3200,SI=3201,up=0,MI=1,OR="",cu="srgb",Wm="srgb-linear",NR=0,qx=7680,QR=7681,VR=7682,HR=7683,GR=34055,WR=34056,jR=5386,KR=512,$R=513,ZR=514,XR=515,qR=516,YR=517,JR=518,II=519,K_=35044,ez=35048,tz=35040,iz=35045,nz=35049,rz=35041,sz=35046,oz=35050,az=35042,lz="100",s2="300 es",pv=1035;class Xu{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const c=this._listeners[e];if(c!==void 0){const p=c.indexOf(t);p!==-1&&c.splice(p,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const c=r.slice(0);for(let p=0,y=c.length;p<y;p++)c[p].call(this,e);e.target=null}}}const el=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let UE=1234567;const pf=Math.PI/180,$_=180/Math.PI;function Pc(){const u=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(el[u&255]+el[u>>8&255]+el[u>>16&255]+el[u>>24&255]+"-"+el[e&255]+el[e>>8&255]+"-"+el[e>>16&15|64]+el[e>>24&255]+"-"+el[t&63|128]+el[t>>8&255]+"-"+el[t>>16&255]+el[t>>24&255]+el[r&255]+el[r>>8&255]+el[r>>16&255]+el[r>>24&255]).toLowerCase()}function Eo(u,e,t){return Math.max(e,Math.min(t,u))}function O2(u,e){return(u%e+e)%e}function cz(u,e,t,r,c){return r+(u-e)*(c-r)/(t-e)}function hz(u,e,t){return u!==e?(t-u)/(e-u):0}function L_(u,e,t){return(1-t)*u+t*e}function uz(u,e,t,r){return L_(u,e,1-Math.exp(-t*r))}function Az(u,e=1){return e-Math.abs(O2(u,e*2)-e)}function dz(u,e,t){return u<=e?0:u>=t?1:(u=(u-e)/(t-e),u*u*(3-2*u))}function pz(u,e,t){return u<=e?0:u>=t?1:(u=(u-e)/(t-e),u*u*u*(u*(u*6-15)+10))}function fz(u,e){return u+Math.floor(Math.random()*(e-u+1))}function mz(u,e){return u+Math.random()*(e-u)}function gz(u){return u*(.5-Math.random())}function _z(u){u!==void 0&&(UE=u);let e=UE+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function yz(u){return u*pf}function xz(u){return u*$_}function o2(u){return(u&u-1)===0&&u!==0}function FI(u){return Math.pow(2,Math.ceil(Math.log(u)/Math.LN2))}function fv(u){return Math.pow(2,Math.floor(Math.log(u)/Math.LN2))}function vz(u,e,t,r,c){const p=Math.cos,y=Math.sin,i=p(t/2),C=y(t/2),D=p((e+r)/2),U=y((e+r)/2),N=p((e-r)/2),R=y((e-r)/2),G=p((r-e)/2),J=y((r-e)/2);switch(c){case"XYX":u.set(i*U,C*N,C*R,i*D);break;case"YZY":u.set(C*R,i*U,C*N,i*D);break;case"ZXZ":u.set(C*N,C*R,i*U,i*D);break;case"XZX":u.set(i*U,C*J,C*G,i*D);break;case"YXY":u.set(C*G,i*U,C*J,i*D);break;case"ZYZ":u.set(C*J,C*G,i*U,i*D);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+c)}}function WA(u,e){switch(e.constructor){case Float32Array:return u;case Uint16Array:return u/65535;case Uint8Array:return u/255;case Int16Array:return Math.max(u/32767,-1);case Int8Array:return Math.max(u/127,-1);default:throw new Error("Invalid component type.")}}function Rs(u,e){switch(e.constructor){case Float32Array:return u;case Uint16Array:return Math.round(u*65535);case Uint8Array:return Math.round(u*255);case Int16Array:return Math.round(u*32767);case Int8Array:return Math.round(u*127);default:throw new Error("Invalid component type.")}}var LI=Object.freeze({__proto__:null,DEG2RAD:pf,RAD2DEG:$_,generateUUID:Pc,clamp:Eo,euclideanModulo:O2,mapLinear:cz,inverseLerp:hz,lerp:L_,damp:uz,pingpong:Az,smoothstep:dz,smootherstep:pz,randInt:fz,randFloat:mz,randFloatSpread:gz,seededRandom:_z,degToRad:yz,radToDeg:xz,isPowerOfTwo:o2,ceilPowerOfTwo:FI,floorPowerOfTwo:fv,setQuaternionFromProperEuler:vz,normalize:Rs,denormalize:WA});class Di{constructor(e=0,t=0){Di.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,c=e.elements;return this.x=c[0]*t+c[3]*r+c[6],this.y=c[1]*t+c[4]*r+c[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),c=Math.sin(t),p=this.x-e.x,y=this.y-e.y;return this.x=p*r-y*c+e.x,this.y=p*c+y*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Pl{constructor(){Pl.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,c,p,y,i,C,D){const U=this.elements;return U[0]=e,U[1]=c,U[2]=i,U[3]=t,U[4]=p,U[5]=C,U[6]=r,U[7]=y,U[8]=D,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,c=t.elements,p=this.elements,y=r[0],i=r[3],C=r[6],D=r[1],U=r[4],N=r[7],R=r[2],G=r[5],J=r[8],Y=c[0],B=c[3],ae=c[6],le=c[1],Ae=c[4],we=c[7],me=c[2],Pe=c[5],it=c[8];return p[0]=y*Y+i*le+C*me,p[3]=y*B+i*Ae+C*Pe,p[6]=y*ae+i*we+C*it,p[1]=D*Y+U*le+N*me,p[4]=D*B+U*Ae+N*Pe,p[7]=D*ae+U*we+N*it,p[2]=R*Y+G*le+J*me,p[5]=R*B+G*Ae+J*Pe,p[8]=R*ae+G*we+J*it,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],c=e[2],p=e[3],y=e[4],i=e[5],C=e[6],D=e[7],U=e[8];return t*y*U-t*i*D-r*p*U+r*i*C+c*p*D-c*y*C}invert(){const e=this.elements,t=e[0],r=e[1],c=e[2],p=e[3],y=e[4],i=e[5],C=e[6],D=e[7],U=e[8],N=U*y-i*D,R=i*C-U*p,G=D*p-y*C,J=t*N+r*R+c*G;if(J===0)return this.set(0,0,0,0,0,0,0,0,0);const Y=1/J;return e[0]=N*Y,e[1]=(c*D-U*r)*Y,e[2]=(i*r-c*y)*Y,e[3]=R*Y,e[4]=(U*t-c*C)*Y,e[5]=(c*p-i*t)*Y,e[6]=G*Y,e[7]=(r*C-D*t)*Y,e[8]=(y*t-r*p)*Y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,c,p,y,i){const C=Math.cos(p),D=Math.sin(p);return this.set(r*C,r*D,-r*(C*y+D*i)+y+e,-c*D,c*C,-c*(-D*y+C*i)+i+t,0,0,1),this}scale(e,t){return this.premultiply(vw.makeScale(e,t)),this}rotate(e){return this.premultiply(vw.makeRotation(-e)),this}translate(e,t){return this.premultiply(vw.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let c=0;c<9;c++)if(t[c]!==r[c])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const vw=new Pl;function DI(u){for(let e=u.length-1;e>=0;--e)if(u[e]>=65535)return!0;return!1}const wz={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Pm(u,e){return new wz[u](e)}function Z_(u){return document.createElementNS("http://www.w3.org/1999/xhtml",u)}function ff(u){return u<.04045?u*.0773993808:Math.pow(u*.9478672986+.0521327014,2.4)}function Yx(u){return u<.0031308?u*12.92:1.055*Math.pow(u,.41666)-.055}const ww={[cu]:{[Wm]:ff},[Wm]:{[cu]:Yx}},tl={legacyMode:!0,get workingColorSpace(){return Wm},set workingColorSpace(u){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(u,e,t){if(this.legacyMode||e===t||!e||!t)return u;if(ww[e]&&ww[e][t]!==void 0){const r=ww[e][t];return u.r=r(u.r),u.g=r(u.g),u.b=r(u.b),u}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(u,e){return this.convert(u,this.workingColorSpace,e)},toWorkingColorSpace:function(u,e){return this.convert(u,e,this.workingColorSpace)}},PI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ia={r:0,g:0,b:0},su={h:0,s:0,l:0},Y0={h:0,s:0,l:0};function bw(u,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?u+(e-u)*6*t:t<1/2?e:t<2/3?u+(e-u)*6*(2/3-t):u}function J0(u,e){return e.r=u.r,e.g=u.g,e.b=u.b,e}class Dn{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=cu){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tl.toWorkingColorSpace(this,t),this}setRGB(e,t,r,c=tl.workingColorSpace){return this.r=e,this.g=t,this.b=r,tl.toWorkingColorSpace(this,c),this}setHSL(e,t,r,c=tl.workingColorSpace){if(e=O2(e,1),t=Eo(t,0,1),r=Eo(r,0,1),t===0)this.r=this.g=this.b=r;else{const p=r<=.5?r*(1+t):r+t-r*t,y=2*r-p;this.r=bw(y,p,e+1/3),this.g=bw(y,p,e),this.b=bw(y,p,e-1/3)}return tl.toWorkingColorSpace(this,c),this}setStyle(e,t=cu){function r(p){p!==void 0&&parseFloat(p)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let c;if(c=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let p;const y=c[1],i=c[2];switch(y){case"rgb":case"rgba":if(p=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(p[1],10))/255,this.g=Math.min(255,parseInt(p[2],10))/255,this.b=Math.min(255,parseInt(p[3],10))/255,tl.toWorkingColorSpace(this,t),r(p[4]),this;if(p=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(p[1],10))/100,this.g=Math.min(100,parseInt(p[2],10))/100,this.b=Math.min(100,parseInt(p[3],10))/100,tl.toWorkingColorSpace(this,t),r(p[4]),this;break;case"hsl":case"hsla":if(p=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const C=parseFloat(p[1])/360,D=parseFloat(p[2])/100,U=parseFloat(p[3])/100;return r(p[4]),this.setHSL(C,D,U,t)}break}}else if(c=/^\#([A-Fa-f\d]+)$/.exec(e)){const p=c[1],y=p.length;if(y===3)return this.r=parseInt(p.charAt(0)+p.charAt(0),16)/255,this.g=parseInt(p.charAt(1)+p.charAt(1),16)/255,this.b=parseInt(p.charAt(2)+p.charAt(2),16)/255,tl.toWorkingColorSpace(this,t),this;if(y===6)return this.r=parseInt(p.charAt(0)+p.charAt(1),16)/255,this.g=parseInt(p.charAt(2)+p.charAt(3),16)/255,this.b=parseInt(p.charAt(4)+p.charAt(5),16)/255,tl.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=cu){const r=PI[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ff(e.r),this.g=ff(e.g),this.b=ff(e.b),this}copyLinearToSRGB(e){return this.r=Yx(e.r),this.g=Yx(e.g),this.b=Yx(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=cu){return tl.fromWorkingColorSpace(J0(this,ia),e),Eo(ia.r*255,0,255)<<16^Eo(ia.g*255,0,255)<<8^Eo(ia.b*255,0,255)<<0}getHexString(e=cu){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tl.workingColorSpace){tl.fromWorkingColorSpace(J0(this,ia),t);const r=ia.r,c=ia.g,p=ia.b,y=Math.max(r,c,p),i=Math.min(r,c,p);let C,D;const U=(i+y)/2;if(i===y)C=0,D=0;else{const N=y-i;switch(D=U<=.5?N/(y+i):N/(2-y-i),y){case r:C=(c-p)/N+(c<p?6:0);break;case c:C=(p-r)/N+2;break;case p:C=(r-c)/N+4;break}C/=6}return e.h=C,e.s=D,e.l=U,e}getRGB(e,t=tl.workingColorSpace){return tl.fromWorkingColorSpace(J0(this,ia),t),e.r=ia.r,e.g=ia.g,e.b=ia.b,e}getStyle(e=cu){return tl.fromWorkingColorSpace(J0(this,ia),e),e!==cu?`color(${e} ${ia.r} ${ia.g} ${ia.b})`:`rgb(${ia.r*255|0},${ia.g*255|0},${ia.b*255|0})`}offsetHSL(e,t,r){return this.getHSL(su),su.h+=e,su.s+=t,su.l+=r,this.setHSL(su.h,su.s,su.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(su),e.getHSL(Y0);const r=L_(su.h,Y0.h,t),c=L_(su.s,Y0.s,t),p=L_(su.l,Y0.l,t);return this.setHSL(r,c,p),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}Dn.NAMES=PI;let cm;class N2{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{cm===void 0&&(cm=Z_("canvas")),cm.width=e.width,cm.height=e.height;const r=cm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=cm}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Z_("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const c=r.getImageData(0,0,e.width,e.height),p=c.data;for(let y=0;y<p.length;y++)p[y]=ff(p[y]/255)*255;return r.putImageData(c,0,0),t}else if(e.data){const t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(ff(t[r]/255)*255):t[r]=ff(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class lf{constructor(e=null){this.isSource=!0,this.uuid=Pc(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},c=this.data;if(c!==null){let p;if(Array.isArray(c)){p=[];for(let y=0,i=c.length;y<i;y++)c[y].isDataTexture?p.push(Bw(c[y].image)):p.push(Bw(c[y]))}else p=Bw(c);r.url=p}return t||(e.images[this.uuid]=r),r}}function Bw(u){return typeof HTMLImageElement<"u"&&u instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&u instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&u instanceof ImageBitmap?N2.getDataURL(u):u.data?{data:Array.from(u.data),width:u.width,height:u.height,type:u.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let bz=0;class To extends Xu{constructor(e=To.DEFAULT_IMAGE,t=To.DEFAULT_MAPPING,r=rl,c=rl,p=Xs,y=lp,i=Dl,C=cp,D=To.DEFAULT_ANISOTROPY,U=hp){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:bz++}),this.uuid=Pc(),this.name="",this.source=new lf(e),this.mipmaps=[],this.mapping=t,this.wrapS=r,this.wrapT=c,this.magFilter=p,this.minFilter=y,this.anisotropy=D,this.format=i,this.internalFormat=null,this.type=C,this.offset=new Di(0,0),this.repeat=new Di(1,1),this.center=new Di(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Pl,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=U,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Nv)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case HA:e.x=e.x-Math.floor(e.x);break;case rl:e.x=e.x<0?0:1;break;case H_:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case HA:e.y=e.y-Math.floor(e.y);break;case rl:e.y=e.y<0?0:1;break;case H_:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}To.DEFAULT_IMAGE=null;To.DEFAULT_MAPPING=Nv;To.DEFAULT_ANISOTROPY=1;class ls{constructor(e=0,t=0,r=0,c=1){ls.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=c}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,c){return this.x=e,this.y=t,this.z=r,this.w=c,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,c=this.z,p=this.w,y=e.elements;return this.x=y[0]*t+y[4]*r+y[8]*c+y[12]*p,this.y=y[1]*t+y[5]*r+y[9]*c+y[13]*p,this.z=y[2]*t+y[6]*r+y[10]*c+y[14]*p,this.w=y[3]*t+y[7]*r+y[11]*c+y[15]*p,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,c,p;const C=e.elements,D=C[0],U=C[4],N=C[8],R=C[1],G=C[5],J=C[9],Y=C[2],B=C[6],ae=C[10];if(Math.abs(U-R)<.01&&Math.abs(N-Y)<.01&&Math.abs(J-B)<.01){if(Math.abs(U+R)<.1&&Math.abs(N+Y)<.1&&Math.abs(J+B)<.1&&Math.abs(D+G+ae-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const Ae=(D+1)/2,we=(G+1)/2,me=(ae+1)/2,Pe=(U+R)/4,it=(N+Y)/4,Me=(J+B)/4;return Ae>we&&Ae>me?Ae<.01?(r=0,c=.707106781,p=.707106781):(r=Math.sqrt(Ae),c=Pe/r,p=it/r):we>me?we<.01?(r=.707106781,c=0,p=.707106781):(c=Math.sqrt(we),r=Pe/c,p=Me/c):me<.01?(r=.707106781,c=.707106781,p=0):(p=Math.sqrt(me),r=it/p,c=Me/p),this.set(r,c,p,t),this}let le=Math.sqrt((B-J)*(B-J)+(N-Y)*(N-Y)+(R-U)*(R-U));return Math.abs(le)<.001&&(le=1),this.x=(B-J)/le,this.y=(N-Y)/le,this.z=(R-U)/le,this.w=Math.acos((D+G+ae-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Oa extends Xu{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ls(0,0,e,t),this.scissorTest=!1,this.viewport=new ls(0,0,e,t);const c={width:e,height:t,depth:1};this.texture=new To(c,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:Xs,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new lf(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class uy extends To{constructor(e=null,t=1,r=1,c=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:c},this.magFilter=Co,this.minFilter=Co,this.wrapR=rl,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Bz extends Oa{constructor(e=1,t=1,r=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new uy(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class Vv extends To{constructor(e=null,t=1,r=1,c=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:c},this.magFilter=Co,this.minFilter=Co,this.wrapR=rl,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Cz extends Oa{constructor(e=1,t=1,r=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new Vv(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class Ez extends Oa{constructor(e=1,t=1,r=1,c={}){super(e,t,c),this.isWebGLMultipleRenderTargets=!0;const p=this.texture;this.texture=[];for(let y=0;y<r;y++)this.texture[y]=p.clone(),this.texture[y].isRenderTargetTexture=!0}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let c=0,p=this.texture.length;c<p;c++)this.texture[c].image.width=e,this.texture[c].image.height=t,this.texture[c].image.depth=r;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,r=e.texture.length;t<r;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class sl{constructor(e=0,t=0,r=0,c=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=c}static slerpFlat(e,t,r,c,p,y,i){let C=r[c+0],D=r[c+1],U=r[c+2],N=r[c+3];const R=p[y+0],G=p[y+1],J=p[y+2],Y=p[y+3];if(i===0){e[t+0]=C,e[t+1]=D,e[t+2]=U,e[t+3]=N;return}if(i===1){e[t+0]=R,e[t+1]=G,e[t+2]=J,e[t+3]=Y;return}if(N!==Y||C!==R||D!==G||U!==J){let B=1-i;const ae=C*R+D*G+U*J+N*Y,le=ae>=0?1:-1,Ae=1-ae*ae;if(Ae>Number.EPSILON){const me=Math.sqrt(Ae),Pe=Math.atan2(me,ae*le);B=Math.sin(B*Pe)/me,i=Math.sin(i*Pe)/me}const we=i*le;if(C=C*B+R*we,D=D*B+G*we,U=U*B+J*we,N=N*B+Y*we,B===1-i){const me=1/Math.sqrt(C*C+D*D+U*U+N*N);C*=me,D*=me,U*=me,N*=me}}e[t]=C,e[t+1]=D,e[t+2]=U,e[t+3]=N}static multiplyQuaternionsFlat(e,t,r,c,p,y){const i=r[c],C=r[c+1],D=r[c+2],U=r[c+3],N=p[y],R=p[y+1],G=p[y+2],J=p[y+3];return e[t]=i*J+U*N+C*G-D*R,e[t+1]=C*J+U*R+D*N-i*G,e[t+2]=D*J+U*G+i*R-C*N,e[t+3]=U*J-i*N-C*R-D*G,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,c){return this._x=e,this._y=t,this._z=r,this._w=c,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const r=e._x,c=e._y,p=e._z,y=e._order,i=Math.cos,C=Math.sin,D=i(r/2),U=i(c/2),N=i(p/2),R=C(r/2),G=C(c/2),J=C(p/2);switch(y){case"XYZ":this._x=R*U*N+D*G*J,this._y=D*G*N-R*U*J,this._z=D*U*J+R*G*N,this._w=D*U*N-R*G*J;break;case"YXZ":this._x=R*U*N+D*G*J,this._y=D*G*N-R*U*J,this._z=D*U*J-R*G*N,this._w=D*U*N+R*G*J;break;case"ZXY":this._x=R*U*N-D*G*J,this._y=D*G*N+R*U*J,this._z=D*U*J+R*G*N,this._w=D*U*N-R*G*J;break;case"ZYX":this._x=R*U*N-D*G*J,this._y=D*G*N+R*U*J,this._z=D*U*J-R*G*N,this._w=D*U*N+R*G*J;break;case"YZX":this._x=R*U*N+D*G*J,this._y=D*G*N+R*U*J,this._z=D*U*J-R*G*N,this._w=D*U*N-R*G*J;break;case"XZY":this._x=R*U*N-D*G*J,this._y=D*G*N-R*U*J,this._z=D*U*J+R*G*N,this._w=D*U*N+R*G*J;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+y)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,c=Math.sin(r);return this._x=e.x*c,this._y=e.y*c,this._z=e.z*c,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],c=t[4],p=t[8],y=t[1],i=t[5],C=t[9],D=t[2],U=t[6],N=t[10],R=r+i+N;if(R>0){const G=.5/Math.sqrt(R+1);this._w=.25/G,this._x=(U-C)*G,this._y=(p-D)*G,this._z=(y-c)*G}else if(r>i&&r>N){const G=2*Math.sqrt(1+r-i-N);this._w=(U-C)/G,this._x=.25*G,this._y=(c+y)/G,this._z=(p+D)/G}else if(i>N){const G=2*Math.sqrt(1+i-r-N);this._w=(p-D)/G,this._x=(c+y)/G,this._y=.25*G,this._z=(C+U)/G}else{const G=2*Math.sqrt(1+N-r-i);this._w=(y-c)/G,this._x=(p+D)/G,this._y=(C+U)/G,this._z=.25*G}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Eo(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const c=Math.min(1,t/r);return this.slerp(e,c),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,c=e._y,p=e._z,y=e._w,i=t._x,C=t._y,D=t._z,U=t._w;return this._x=r*U+y*i+c*D-p*C,this._y=c*U+y*C+p*i-r*D,this._z=p*U+y*D+r*C-c*i,this._w=y*U-r*i-c*C-p*D,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,c=this._y,p=this._z,y=this._w;let i=y*e._w+r*e._x+c*e._y+p*e._z;if(i<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,i=-i):this.copy(e),i>=1)return this._w=y,this._x=r,this._y=c,this._z=p,this;const C=1-i*i;if(C<=Number.EPSILON){const G=1-t;return this._w=G*y+t*this._w,this._x=G*r+t*this._x,this._y=G*c+t*this._y,this._z=G*p+t*this._z,this.normalize(),this._onChangeCallback(),this}const D=Math.sqrt(C),U=Math.atan2(D,i),N=Math.sin((1-t)*U)/D,R=Math.sin(t*U)/D;return this._w=y*N+this._w*R,this._x=r*N+this._x*R,this._y=c*N+this._y*R,this._z=p*N+this._z*R,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),c=2*Math.PI*Math.random(),p=2*Math.PI*Math.random();return this.set(t*Math.cos(c),r*Math.sin(p),r*Math.cos(p),t*Math.sin(c))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ft{constructor(e=0,t=0,r=0){ft.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(RE.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(RE.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,c=this.z,p=e.elements;return this.x=p[0]*t+p[3]*r+p[6]*c,this.y=p[1]*t+p[4]*r+p[7]*c,this.z=p[2]*t+p[5]*r+p[8]*c,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,c=this.z,p=e.elements,y=1/(p[3]*t+p[7]*r+p[11]*c+p[15]);return this.x=(p[0]*t+p[4]*r+p[8]*c+p[12])*y,this.y=(p[1]*t+p[5]*r+p[9]*c+p[13])*y,this.z=(p[2]*t+p[6]*r+p[10]*c+p[14])*y,this}applyQuaternion(e){const t=this.x,r=this.y,c=this.z,p=e.x,y=e.y,i=e.z,C=e.w,D=C*t+y*c-i*r,U=C*r+i*t-p*c,N=C*c+p*r-y*t,R=-p*t-y*r-i*c;return this.x=D*C+R*-p+U*-i-N*-y,this.y=U*C+R*-y+N*-p-D*-i,this.z=N*C+R*-i+D*-y-U*-p,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,c=this.z,p=e.elements;return this.x=p[0]*t+p[4]*r+p[8]*c,this.y=p[1]*t+p[5]*r+p[9]*c,this.z=p[2]*t+p[6]*r+p[10]*c,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,c=e.y,p=e.z,y=t.x,i=t.y,C=t.z;return this.x=c*C-p*i,this.y=p*y-r*C,this.z=r*i-c*y,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return Cw.copy(this).projectOnVector(e),this.sub(Cw)}reflect(e){return this.sub(Cw.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(Eo(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,c=this.z-e.z;return t*t+r*r+c*c}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const c=Math.sin(t)*e;return this.x=c*Math.sin(r),this.y=Math.cos(t)*e,this.z=c*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),c=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=c,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Cw=new ft,RE=new sl;class qu{constructor(e=new ft(1/0,1/0,1/0),t=new ft(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,r=1/0,c=1/0,p=-1/0,y=-1/0,i=-1/0;for(let C=0,D=e.length;C<D;C+=3){const U=e[C],N=e[C+1],R=e[C+2];U<t&&(t=U),N<r&&(r=N),R<c&&(c=R),U>p&&(p=U),N>y&&(y=N),R>i&&(i=R)}return this.min.set(t,r,c),this.max.set(p,y,i),this}setFromBufferAttribute(e){let t=1/0,r=1/0,c=1/0,p=-1/0,y=-1/0,i=-1/0;for(let C=0,D=e.count;C<D;C++){const U=e.getX(C),N=e.getY(C),R=e.getZ(C);U<t&&(t=U),N<r&&(r=N),R<c&&(c=R),U>p&&(p=U),N>y&&(y=N),R>i&&(i=R)}return this.min.set(t,r,c),this.max.set(p,y,i),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=Np.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0)if(t&&r.attributes!=null&&r.attributes.position!==void 0){const p=r.attributes.position;for(let y=0,i=p.count;y<i;y++)Np.fromBufferAttribute(p,y).applyMatrix4(e.matrixWorld),this.expandByPoint(Np)}else r.boundingBox===null&&r.computeBoundingBox(),Ew.copy(r.boundingBox),Ew.applyMatrix4(e.matrixWorld),this.union(Ew);const c=e.children;for(let p=0,y=c.length;p<y;p++)this.expandByObject(c[p],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Np),Np.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(i_),ex.subVectors(this.max,i_),hm.subVectors(e.a,i_),um.subVectors(e.b,i_),Am.subVectors(e.c,i_),zd.subVectors(um,hm),kd.subVectors(Am,um),Qp.subVectors(hm,Am);let t=[0,-zd.z,zd.y,0,-kd.z,kd.y,0,-Qp.z,Qp.y,zd.z,0,-zd.x,kd.z,0,-kd.x,Qp.z,0,-Qp.x,-zd.y,zd.x,0,-kd.y,kd.x,0,-Qp.y,Qp.x,0];return!Tw(t,hm,um,Am,ex)||(t=[1,0,0,0,1,0,0,0,1],!Tw(t,hm,um,Am,ex))?!1:(tx.crossVectors(zd,kd),t=[tx.x,tx.y,tx.z],Tw(t,hm,um,Am,ex))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Np.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Np).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(RA[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),RA[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),RA[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),RA[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),RA[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),RA[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),RA[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),RA[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(RA),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const RA=[new ft,new ft,new ft,new ft,new ft,new ft,new ft,new ft],Np=new ft,Ew=new qu,hm=new ft,um=new ft,Am=new ft,zd=new ft,kd=new ft,Qp=new ft,i_=new ft,ex=new ft,tx=new ft,Vp=new ft;function Tw(u,e,t,r,c){for(let p=0,y=u.length-3;p<=y;p+=3){Vp.fromArray(u,p);const i=c.x*Math.abs(Vp.x)+c.y*Math.abs(Vp.y)+c.z*Math.abs(Vp.z),C=e.dot(Vp),D=t.dot(Vp),U=r.dot(Vp);if(Math.max(-Math.max(C,D,U),Math.min(C,D,U))>i)return!1}return!0}const Tz=new qu,n_=new ft,Sw=new ft;class qA{constructor(e=new ft,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):Tz.setFromPoints(e).getCenter(r);let c=0;for(let p=0,y=e.length;p<y;p++)c=Math.max(c,r.distanceToSquared(e[p]));return this.radius=Math.sqrt(c),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;n_.subVectors(e,this.center);const t=n_.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),c=(r-this.radius)*.5;this.center.addScaledVector(n_,c/r),this.radius+=c}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sw.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(n_.copy(e.center).add(Sw)),this.expandByPoint(n_.copy(e.center).sub(Sw))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const zA=new ft,Mw=new ft,ix=new ft,Od=new ft,Iw=new ft,nx=new ft,Fw=new ft;class Ay{constructor(e=new ft,t=new ft(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,zA)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=zA.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(zA.copy(this.direction).multiplyScalar(t).add(this.origin),zA.distanceToSquared(e))}distanceSqToSegment(e,t,r,c){Mw.copy(e).add(t).multiplyScalar(.5),ix.copy(t).sub(e).normalize(),Od.copy(this.origin).sub(Mw);const p=e.distanceTo(t)*.5,y=-this.direction.dot(ix),i=Od.dot(this.direction),C=-Od.dot(ix),D=Od.lengthSq(),U=Math.abs(1-y*y);let N,R,G,J;if(U>0)if(N=y*C-i,R=y*i-C,J=p*U,N>=0)if(R>=-J)if(R<=J){const Y=1/U;N*=Y,R*=Y,G=N*(N+y*R+2*i)+R*(y*N+R+2*C)+D}else R=p,N=Math.max(0,-(y*R+i)),G=-N*N+R*(R+2*C)+D;else R=-p,N=Math.max(0,-(y*R+i)),G=-N*N+R*(R+2*C)+D;else R<=-J?(N=Math.max(0,-(-y*p+i)),R=N>0?-p:Math.min(Math.max(-p,-C),p),G=-N*N+R*(R+2*C)+D):R<=J?(N=0,R=Math.min(Math.max(-p,-C),p),G=R*(R+2*C)+D):(N=Math.max(0,-(y*p+i)),R=N>0?p:Math.min(Math.max(-p,-C),p),G=-N*N+R*(R+2*C)+D);else R=y>0?-p:p,N=Math.max(0,-(y*R+i)),G=-N*N+R*(R+2*C)+D;return r&&r.copy(this.direction).multiplyScalar(N).add(this.origin),c&&c.copy(ix).multiplyScalar(R).add(Mw),G}intersectSphere(e,t){zA.subVectors(e.center,this.origin);const r=zA.dot(this.direction),c=zA.dot(zA)-r*r,p=e.radius*e.radius;if(c>p)return null;const y=Math.sqrt(p-c),i=r-y,C=r+y;return i<0&&C<0?null:i<0?this.at(C,t):this.at(i,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,c,p,y,i,C;const D=1/this.direction.x,U=1/this.direction.y,N=1/this.direction.z,R=this.origin;return D>=0?(r=(e.min.x-R.x)*D,c=(e.max.x-R.x)*D):(r=(e.max.x-R.x)*D,c=(e.min.x-R.x)*D),U>=0?(p=(e.min.y-R.y)*U,y=(e.max.y-R.y)*U):(p=(e.max.y-R.y)*U,y=(e.min.y-R.y)*U),r>y||p>c||((p>r||isNaN(r))&&(r=p),(y<c||isNaN(c))&&(c=y),N>=0?(i=(e.min.z-R.z)*N,C=(e.max.z-R.z)*N):(i=(e.max.z-R.z)*N,C=(e.min.z-R.z)*N),r>C||i>c)||((i>r||r!==r)&&(r=i),(C<c||c!==c)&&(c=C),c<0)?null:this.at(r>=0?r:c,t)}intersectsBox(e){return this.intersectBox(e,zA)!==null}intersectTriangle(e,t,r,c,p){Iw.subVectors(t,e),nx.subVectors(r,e),Fw.crossVectors(Iw,nx);let y=this.direction.dot(Fw),i;if(y>0){if(c)return null;i=1}else if(y<0)i=-1,y=-y;else return null;Od.subVectors(this.origin,e);const C=i*this.direction.dot(nx.crossVectors(Od,nx));if(C<0)return null;const D=i*this.direction.dot(Iw.cross(Od));if(D<0||C+D>y)return null;const U=-i*Od.dot(Fw);return U<0?null:this.at(U/y,p)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class lr{constructor(){lr.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,c,p,y,i,C,D,U,N,R,G,J,Y,B){const ae=this.elements;return ae[0]=e,ae[4]=t,ae[8]=r,ae[12]=c,ae[1]=p,ae[5]=y,ae[9]=i,ae[13]=C,ae[2]=D,ae[6]=U,ae[10]=N,ae[14]=R,ae[3]=G,ae[7]=J,ae[11]=Y,ae[15]=B,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new lr().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,c=1/dm.setFromMatrixColumn(e,0).length(),p=1/dm.setFromMatrixColumn(e,1).length(),y=1/dm.setFromMatrixColumn(e,2).length();return t[0]=r[0]*c,t[1]=r[1]*c,t[2]=r[2]*c,t[3]=0,t[4]=r[4]*p,t[5]=r[5]*p,t[6]=r[6]*p,t[7]=0,t[8]=r[8]*y,t[9]=r[9]*y,t[10]=r[10]*y,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,c=e.y,p=e.z,y=Math.cos(r),i=Math.sin(r),C=Math.cos(c),D=Math.sin(c),U=Math.cos(p),N=Math.sin(p);if(e.order==="XYZ"){const R=y*U,G=y*N,J=i*U,Y=i*N;t[0]=C*U,t[4]=-C*N,t[8]=D,t[1]=G+J*D,t[5]=R-Y*D,t[9]=-i*C,t[2]=Y-R*D,t[6]=J+G*D,t[10]=y*C}else if(e.order==="YXZ"){const R=C*U,G=C*N,J=D*U,Y=D*N;t[0]=R+Y*i,t[4]=J*i-G,t[8]=y*D,t[1]=y*N,t[5]=y*U,t[9]=-i,t[2]=G*i-J,t[6]=Y+R*i,t[10]=y*C}else if(e.order==="ZXY"){const R=C*U,G=C*N,J=D*U,Y=D*N;t[0]=R-Y*i,t[4]=-y*N,t[8]=J+G*i,t[1]=G+J*i,t[5]=y*U,t[9]=Y-R*i,t[2]=-y*D,t[6]=i,t[10]=y*C}else if(e.order==="ZYX"){const R=y*U,G=y*N,J=i*U,Y=i*N;t[0]=C*U,t[4]=J*D-G,t[8]=R*D+Y,t[1]=C*N,t[5]=Y*D+R,t[9]=G*D-J,t[2]=-D,t[6]=i*C,t[10]=y*C}else if(e.order==="YZX"){const R=y*C,G=y*D,J=i*C,Y=i*D;t[0]=C*U,t[4]=Y-R*N,t[8]=J*N+G,t[1]=N,t[5]=y*U,t[9]=-i*U,t[2]=-D*U,t[6]=G*N+J,t[10]=R-Y*N}else if(e.order==="XZY"){const R=y*C,G=y*D,J=i*C,Y=i*D;t[0]=C*U,t[4]=-N,t[8]=D*U,t[1]=R*N+Y,t[5]=y*U,t[9]=G*N-J,t[2]=J*N-G,t[6]=i*U,t[10]=Y*N+R}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Sz,e,Mz)}lookAt(e,t,r){const c=this.elements;return Tc.subVectors(e,t),Tc.lengthSq()===0&&(Tc.z=1),Tc.normalize(),Nd.crossVectors(r,Tc),Nd.lengthSq()===0&&(Math.abs(r.z)===1?Tc.x+=1e-4:Tc.z+=1e-4,Tc.normalize(),Nd.crossVectors(r,Tc)),Nd.normalize(),rx.crossVectors(Tc,Nd),c[0]=Nd.x,c[4]=rx.x,c[8]=Tc.x,c[1]=Nd.y,c[5]=rx.y,c[9]=Tc.y,c[2]=Nd.z,c[6]=rx.z,c[10]=Tc.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,c=t.elements,p=this.elements,y=r[0],i=r[4],C=r[8],D=r[12],U=r[1],N=r[5],R=r[9],G=r[13],J=r[2],Y=r[6],B=r[10],ae=r[14],le=r[3],Ae=r[7],we=r[11],me=r[15],Pe=c[0],it=c[4],Me=c[8],Ke=c[12],Et=c[1],oi=c[5],Ci=c[9],te=c[13],ce=c[2],ye=c[6],xe=c[10],ze=c[14],Ne=c[3],Ge=c[7],Ve=c[11],Le=c[15];return p[0]=y*Pe+i*Et+C*ce+D*Ne,p[4]=y*it+i*oi+C*ye+D*Ge,p[8]=y*Me+i*Ci+C*xe+D*Ve,p[12]=y*Ke+i*te+C*ze+D*Le,p[1]=U*Pe+N*Et+R*ce+G*Ne,p[5]=U*it+N*oi+R*ye+G*Ge,p[9]=U*Me+N*Ci+R*xe+G*Ve,p[13]=U*Ke+N*te+R*ze+G*Le,p[2]=J*Pe+Y*Et+B*ce+ae*Ne,p[6]=J*it+Y*oi+B*ye+ae*Ge,p[10]=J*Me+Y*Ci+B*xe+ae*Ve,p[14]=J*Ke+Y*te+B*ze+ae*Le,p[3]=le*Pe+Ae*Et+we*ce+me*Ne,p[7]=le*it+Ae*oi+we*ye+me*Ge,p[11]=le*Me+Ae*Ci+we*xe+me*Ve,p[15]=le*Ke+Ae*te+we*ze+me*Le,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],c=e[8],p=e[12],y=e[1],i=e[5],C=e[9],D=e[13],U=e[2],N=e[6],R=e[10],G=e[14],J=e[3],Y=e[7],B=e[11],ae=e[15];return J*(+p*C*N-c*D*N-p*i*R+r*D*R+c*i*G-r*C*G)+Y*(+t*C*G-t*D*R+p*y*R-c*y*G+c*D*U-p*C*U)+B*(+t*D*N-t*i*G-p*y*N+r*y*G+p*i*U-r*D*U)+ae*(-c*i*U-t*C*N+t*i*R+c*y*N-r*y*R+r*C*U)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const c=this.elements;return e.isVector3?(c[12]=e.x,c[13]=e.y,c[14]=e.z):(c[12]=e,c[13]=t,c[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],c=e[2],p=e[3],y=e[4],i=e[5],C=e[6],D=e[7],U=e[8],N=e[9],R=e[10],G=e[11],J=e[12],Y=e[13],B=e[14],ae=e[15],le=N*B*D-Y*R*D+Y*C*G-i*B*G-N*C*ae+i*R*ae,Ae=J*R*D-U*B*D-J*C*G+y*B*G+U*C*ae-y*R*ae,we=U*Y*D-J*N*D+J*i*G-y*Y*G-U*i*ae+y*N*ae,me=J*N*C-U*Y*C-J*i*R+y*Y*R+U*i*B-y*N*B,Pe=t*le+r*Ae+c*we+p*me;if(Pe===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const it=1/Pe;return e[0]=le*it,e[1]=(Y*R*p-N*B*p-Y*c*G+r*B*G+N*c*ae-r*R*ae)*it,e[2]=(i*B*p-Y*C*p+Y*c*D-r*B*D-i*c*ae+r*C*ae)*it,e[3]=(N*C*p-i*R*p-N*c*D+r*R*D+i*c*G-r*C*G)*it,e[4]=Ae*it,e[5]=(U*B*p-J*R*p+J*c*G-t*B*G-U*c*ae+t*R*ae)*it,e[6]=(J*C*p-y*B*p-J*c*D+t*B*D+y*c*ae-t*C*ae)*it,e[7]=(y*R*p-U*C*p+U*c*D-t*R*D-y*c*G+t*C*G)*it,e[8]=we*it,e[9]=(J*N*p-U*Y*p-J*r*G+t*Y*G+U*r*ae-t*N*ae)*it,e[10]=(y*Y*p-J*i*p+J*r*D-t*Y*D-y*r*ae+t*i*ae)*it,e[11]=(U*i*p-y*N*p-U*r*D+t*N*D+y*r*G-t*i*G)*it,e[12]=me*it,e[13]=(U*Y*c-J*N*c+J*r*R-t*Y*R-U*r*B+t*N*B)*it,e[14]=(J*i*c-y*Y*c-J*r*C+t*Y*C+y*r*B-t*i*B)*it,e[15]=(y*N*c-U*i*c+U*r*C-t*N*C-y*r*R+t*i*R)*it,this}scale(e){const t=this.elements,r=e.x,c=e.y,p=e.z;return t[0]*=r,t[4]*=c,t[8]*=p,t[1]*=r,t[5]*=c,t[9]*=p,t[2]*=r,t[6]*=c,t[10]*=p,t[3]*=r,t[7]*=c,t[11]*=p,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],c=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,c))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),c=Math.sin(t),p=1-r,y=e.x,i=e.y,C=e.z,D=p*y,U=p*i;return this.set(D*y+r,D*i-c*C,D*C+c*i,0,D*i+c*C,U*i+r,U*C-c*y,0,D*C-c*i,U*C+c*y,p*C*C+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,c,p,y){return this.set(1,r,p,0,e,1,y,0,t,c,1,0,0,0,0,1),this}compose(e,t,r){const c=this.elements,p=t._x,y=t._y,i=t._z,C=t._w,D=p+p,U=y+y,N=i+i,R=p*D,G=p*U,J=p*N,Y=y*U,B=y*N,ae=i*N,le=C*D,Ae=C*U,we=C*N,me=r.x,Pe=r.y,it=r.z;return c[0]=(1-(Y+ae))*me,c[1]=(G+we)*me,c[2]=(J-Ae)*me,c[3]=0,c[4]=(G-we)*Pe,c[5]=(1-(R+ae))*Pe,c[6]=(B+le)*Pe,c[7]=0,c[8]=(J+Ae)*it,c[9]=(B-le)*it,c[10]=(1-(R+Y))*it,c[11]=0,c[12]=e.x,c[13]=e.y,c[14]=e.z,c[15]=1,this}decompose(e,t,r){const c=this.elements;let p=dm.set(c[0],c[1],c[2]).length();const y=dm.set(c[4],c[5],c[6]).length(),i=dm.set(c[8],c[9],c[10]).length();this.determinant()<0&&(p=-p),e.x=c[12],e.y=c[13],e.z=c[14],ou.copy(this);const D=1/p,U=1/y,N=1/i;return ou.elements[0]*=D,ou.elements[1]*=D,ou.elements[2]*=D,ou.elements[4]*=U,ou.elements[5]*=U,ou.elements[6]*=U,ou.elements[8]*=N,ou.elements[9]*=N,ou.elements[10]*=N,t.setFromRotationMatrix(ou),r.x=p,r.y=y,r.z=i,this}makePerspective(e,t,r,c,p,y){const i=this.elements,C=2*p/(t-e),D=2*p/(r-c),U=(t+e)/(t-e),N=(r+c)/(r-c),R=-(y+p)/(y-p),G=-2*y*p/(y-p);return i[0]=C,i[4]=0,i[8]=U,i[12]=0,i[1]=0,i[5]=D,i[9]=N,i[13]=0,i[2]=0,i[6]=0,i[10]=R,i[14]=G,i[3]=0,i[7]=0,i[11]=-1,i[15]=0,this}makeOrthographic(e,t,r,c,p,y){const i=this.elements,C=1/(t-e),D=1/(r-c),U=1/(y-p),N=(t+e)*C,R=(r+c)*D,G=(y+p)*U;return i[0]=2*C,i[4]=0,i[8]=0,i[12]=-N,i[1]=0,i[5]=2*D,i[9]=0,i[13]=-R,i[2]=0,i[6]=0,i[10]=-2*U,i[14]=-G,i[3]=0,i[7]=0,i[11]=0,i[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let c=0;c<16;c++)if(t[c]!==r[c])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const dm=new ft,ou=new lr,Sz=new ft(0,0,0),Mz=new ft(1,1,1),Nd=new ft,rx=new ft,Tc=new ft,zE=new lr,kE=new sl;class Ym{constructor(e=0,t=0,r=0,c=Ym.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=c}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,c=this._order){return this._x=e,this._y=t,this._z=r,this._order=c,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const c=e.elements,p=c[0],y=c[4],i=c[8],C=c[1],D=c[5],U=c[9],N=c[2],R=c[6],G=c[10];switch(t){case"XYZ":this._y=Math.asin(Eo(i,-1,1)),Math.abs(i)<.9999999?(this._x=Math.atan2(-U,G),this._z=Math.atan2(-y,p)):(this._x=Math.atan2(R,D),this._z=0);break;case"YXZ":this._x=Math.asin(-Eo(U,-1,1)),Math.abs(U)<.9999999?(this._y=Math.atan2(i,G),this._z=Math.atan2(C,D)):(this._y=Math.atan2(-N,p),this._z=0);break;case"ZXY":this._x=Math.asin(Eo(R,-1,1)),Math.abs(R)<.9999999?(this._y=Math.atan2(-N,G),this._z=Math.atan2(-y,D)):(this._y=0,this._z=Math.atan2(C,p));break;case"ZYX":this._y=Math.asin(-Eo(N,-1,1)),Math.abs(N)<.9999999?(this._x=Math.atan2(R,G),this._z=Math.atan2(C,p)):(this._x=0,this._z=Math.atan2(-y,D));break;case"YZX":this._z=Math.asin(Eo(C,-1,1)),Math.abs(C)<.9999999?(this._x=Math.atan2(-U,D),this._y=Math.atan2(-N,p)):(this._x=0,this._y=Math.atan2(i,G));break;case"XZY":this._z=Math.asin(-Eo(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(R,D),this._y=Math.atan2(i,p)):(this._x=Math.atan2(-U,G),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return zE.makeRotationFromQuaternion(e),this.setFromRotationMatrix(zE,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return kE.setFromEuler(this),this.setFromQuaternion(kE,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}Ym.DefaultOrder="XYZ";Ym.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class dy{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Iz=0;const OE=new ft,pm=new sl,kA=new lr,sx=new ft,r_=new ft,Fz=new ft,Lz=new sl,NE=new ft(1,0,0),QE=new ft(0,1,0),VE=new ft(0,0,1),Dz={type:"added"},HE={type:"removed"};class cs extends Xu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Iz++}),this.uuid=Pc(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=cs.DefaultUp.clone();const e=new ft,t=new Ym,r=new sl,c=new ft(1,1,1);function p(){r.setFromEuler(t,!1)}function y(){t.setFromQuaternion(r,void 0,!1)}t._onChange(p),r._onChange(y),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:c},modelViewMatrix:{value:new lr},normalMatrix:{value:new Pl}}),this.matrix=new lr,this.matrixWorld=new lr,this.matrixAutoUpdate=cs.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=cs.DefaultMatrixWorldAutoUpdate,this.layers=new dy,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return pm.setFromAxisAngle(e,t),this.quaternion.multiply(pm),this}rotateOnWorldAxis(e,t){return pm.setFromAxisAngle(e,t),this.quaternion.premultiply(pm),this}rotateX(e){return this.rotateOnAxis(NE,e)}rotateY(e){return this.rotateOnAxis(QE,e)}rotateZ(e){return this.rotateOnAxis(VE,e)}translateOnAxis(e,t){return OE.copy(e).applyQuaternion(this.quaternion),this.position.add(OE.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(NE,e)}translateY(e){return this.translateOnAxis(QE,e)}translateZ(e){return this.translateOnAxis(VE,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(kA.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?sx.copy(e):sx.set(e,t,r);const c=this.parent;this.updateWorldMatrix(!0,!1),r_.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?kA.lookAt(r_,sx,this.up):kA.lookAt(sx,r_,this.up),this.quaternion.setFromRotationMatrix(kA),c&&(kA.extractRotation(c.matrixWorld),pm.setFromRotationMatrix(kA),this.quaternion.premultiply(pm.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Dz)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(HE)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(HE)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),kA.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),kA.multiply(e.parent.matrixWorld)),e.applyMatrix4(kA),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,c=this.children.length;r<c;r++){const y=this.children[r].getObjectByProperty(e,t);if(y!==void 0)return y}}getObjectsByProperty(e,t){let r=[];this[e]===t&&r.push(this);for(let c=0,p=this.children.length;c<p;c++){const y=this.children[c].getObjectsByProperty(e,t);y.length>0&&(r=r.concat(y))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(r_,e,Fz),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(r_,Lz,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let r=0,c=t.length;r<c;r++)t[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let r=0,c=t.length;r<c;r++)t[r].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let r=0,c=t.length;r<c;r++){const p=t[r];(p.matrixWorldAutoUpdate===!0||e===!0)&&p.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const r=this.parent;if(e===!0&&r!==null&&r.matrixWorldAutoUpdate===!0&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const c=this.children;for(let p=0,y=c.length;p<y;p++){const i=c[p];i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const c={};c.uuid=this.uuid,c.type=this.type,this.name!==""&&(c.name=this.name),this.castShadow===!0&&(c.castShadow=!0),this.receiveShadow===!0&&(c.receiveShadow=!0),this.visible===!1&&(c.visible=!1),this.frustumCulled===!1&&(c.frustumCulled=!1),this.renderOrder!==0&&(c.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(c.userData=this.userData),c.layers=this.layers.mask,c.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(c.matrixAutoUpdate=!1),this.isInstancedMesh&&(c.type="InstancedMesh",c.count=this.count,c.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(c.instanceColor=this.instanceColor.toJSON()));function p(i,C){return i[C.uuid]===void 0&&(i[C.uuid]=C.toJSON(e)),C.uuid}if(this.isScene)this.background&&(this.background.isColor?c.background=this.background.toJSON():this.background.isTexture&&(c.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(c.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){c.geometry=p(e.geometries,this.geometry);const i=this.geometry.parameters;if(i!==void 0&&i.shapes!==void 0){const C=i.shapes;if(Array.isArray(C))for(let D=0,U=C.length;D<U;D++){const N=C[D];p(e.shapes,N)}else p(e.shapes,C)}}if(this.isSkinnedMesh&&(c.bindMode=this.bindMode,c.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(p(e.skeletons,this.skeleton),c.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const i=[];for(let C=0,D=this.material.length;C<D;C++)i.push(p(e.materials,this.material[C]));c.material=i}else c.material=p(e.materials,this.material);if(this.children.length>0){c.children=[];for(let i=0;i<this.children.length;i++)c.children.push(this.children[i].toJSON(e).object)}if(this.animations.length>0){c.animations=[];for(let i=0;i<this.animations.length;i++){const C=this.animations[i];c.animations.push(p(e.animations,C))}}if(t){const i=y(e.geometries),C=y(e.materials),D=y(e.textures),U=y(e.images),N=y(e.shapes),R=y(e.skeletons),G=y(e.animations),J=y(e.nodes);i.length>0&&(r.geometries=i),C.length>0&&(r.materials=C),D.length>0&&(r.textures=D),U.length>0&&(r.images=U),N.length>0&&(r.shapes=N),R.length>0&&(r.skeletons=R),G.length>0&&(r.animations=G),J.length>0&&(r.nodes=J)}return r.object=c,r;function y(i){const C=[];for(const D in i){const U=i[D];delete U.metadata,C.push(U)}return C}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r<e.children.length;r++){const c=e.children[r];this.add(c.clone())}return this}}cs.DefaultUp=new ft(0,1,0);cs.DefaultMatrixAutoUpdate=!0;cs.DefaultMatrixWorldAutoUpdate=!0;const au=new ft,OA=new ft,Lw=new ft,NA=new ft,fm=new ft,mm=new ft,GE=new ft,Dw=new ft,Pw=new ft,Uw=new ft;class wh{constructor(e=new ft,t=new ft,r=new ft){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,c){c.subVectors(r,t),au.subVectors(e,t),c.cross(au);const p=c.lengthSq();return p>0?c.multiplyScalar(1/Math.sqrt(p)):c.set(0,0,0)}static getBarycoord(e,t,r,c,p){au.subVectors(c,t),OA.subVectors(r,t),Lw.subVectors(e,t);const y=au.dot(au),i=au.dot(OA),C=au.dot(Lw),D=OA.dot(OA),U=OA.dot(Lw),N=y*D-i*i;if(N===0)return p.set(-2,-1,-1);const R=1/N,G=(D*C-i*U)*R,J=(y*U-i*C)*R;return p.set(1-G-J,J,G)}static containsPoint(e,t,r,c){return this.getBarycoord(e,t,r,c,NA),NA.x>=0&&NA.y>=0&&NA.x+NA.y<=1}static getUV(e,t,r,c,p,y,i,C){return this.getBarycoord(e,t,r,c,NA),C.set(0,0),C.addScaledVector(p,NA.x),C.addScaledVector(y,NA.y),C.addScaledVector(i,NA.z),C}static isFrontFacing(e,t,r,c){return au.subVectors(r,t),OA.subVectors(e,t),au.cross(OA).dot(c)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,c){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[c]),this}setFromAttributeAndIndices(e,t,r,c){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,c),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return au.subVectors(this.c,this.b),OA.subVectors(this.a,this.b),au.cross(OA).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return wh.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return wh.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,c,p){return wh.getUV(e,this.a,this.b,this.c,t,r,c,p)}containsPoint(e){return wh.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return wh.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,c=this.b,p=this.c;let y,i;fm.subVectors(c,r),mm.subVectors(p,r),Dw.subVectors(e,r);const C=fm.dot(Dw),D=mm.dot(Dw);if(C<=0&&D<=0)return t.copy(r);Pw.subVectors(e,c);const U=fm.dot(Pw),N=mm.dot(Pw);if(U>=0&&N<=U)return t.copy(c);const R=C*N-U*D;if(R<=0&&C>=0&&U<=0)return y=C/(C-U),t.copy(r).addScaledVector(fm,y);Uw.subVectors(e,p);const G=fm.dot(Uw),J=mm.dot(Uw);if(J>=0&&G<=J)return t.copy(p);const Y=G*D-C*J;if(Y<=0&&D>=0&&J<=0)return i=D/(D-J),t.copy(r).addScaledVector(mm,i);const B=U*J-G*N;if(B<=0&&N-U>=0&&G-J>=0)return GE.subVectors(p,c),i=(N-U)/(N-U+(G-J)),t.copy(c).addScaledVector(GE,i);const ae=1/(B+Y+R);return y=Y*ae,i=R*ae,t.copy(r).addScaledVector(fm,y).addScaledVector(mm,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Pz=0;class ol extends Xu{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Pz++}),this.uuid=Pc(),this.name="",this.type="Material",this.blending=Af,this.side=ju,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=D2,this.blendDst=P2,this.blendEquation=Jp,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Av,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=II,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=qx,this.stencilZFail=qx,this.stencilZPass=qx,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const c=this[t];if(c===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}c&&c.isColor?c.set(r):c&&c.isVector3&&r&&r.isVector3?c.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Af&&(r.blending=this.blending),this.side!==ju&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function c(p){const y=[];for(const i in p){const C=p[i];delete C.metadata,y.push(C)}return y}if(t){const p=c(e.textures),y=c(e.images);p.length>0&&(r.textures=p),y.length>0&&(r.images=y)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const c=t.length;r=new Array(c);for(let p=0;p!==c;++p)r[p]=t[p].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class na extends ol{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Dn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=hy,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ro=new ft,ox=new Di;class ds{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=K_,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let c=0,p=this.itemSize;c<p;c++)this.array[e+c]=t.array[r+c];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)ox.fromBufferAttribute(this,t),ox.applyMatrix3(e),this.setXY(t,ox.x,ox.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)Ro.fromBufferAttribute(this,t),Ro.applyMatrix3(e),this.setXYZ(t,Ro.x,Ro.y,Ro.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)Ro.fromBufferAttribute(this,t),Ro.applyMatrix4(e),this.setXYZ(t,Ro.x,Ro.y,Ro.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)Ro.fromBufferAttribute(this,t),Ro.applyNormalMatrix(e),this.setXYZ(t,Ro.x,Ro.y,Ro.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)Ro.fromBufferAttribute(this,t),Ro.transformDirection(e),this.setXYZ(t,Ro.x,Ro.y,Ro.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=WA(t,this.array)),t}setX(e,t){return this.normalized&&(t=Rs(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=WA(t,this.array)),t}setY(e,t){return this.normalized&&(t=Rs(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=WA(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Rs(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=WA(t,this.array)),t}setW(e,t){return this.normalized&&(t=Rs(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=Rs(t,this.array),r=Rs(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,c){return e*=this.itemSize,this.normalized&&(t=Rs(t,this.array),r=Rs(r,this.array),c=Rs(c,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=c,this}setXYZW(e,t,r,c,p){return e*=this.itemSize,this.normalized&&(t=Rs(t,this.array),r=Rs(r,this.array),c=Rs(c,this.array),p=Rs(p,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=c,this.array[e+3]=p,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==K_&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class Uz extends ds{constructor(e,t,r){super(new Int8Array(e),t,r)}}class Rz extends ds{constructor(e,t,r){super(new Uint8Array(e),t,r)}}class zz extends ds{constructor(e,t,r){super(new Uint8ClampedArray(e),t,r)}}class kz extends ds{constructor(e,t,r){super(new Int16Array(e),t,r)}}class Q2 extends ds{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class Oz extends ds{constructor(e,t,r){super(new Int32Array(e),t,r)}}class V2 extends ds{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class Nz extends ds{constructor(e,t,r){super(new Uint16Array(e),t,r),this.isFloat16BufferAttribute=!0}}class jn extends ds{constructor(e,t,r){super(new Float32Array(e),t,r)}}class Qz extends ds{constructor(e,t,r){super(new Float64Array(e),t,r)}}let Vz=0;const _h=new lr,Rw=new cs,gm=new ft,Sc=new qu,s_=new qu,ma=new ft;class br extends Xu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Vz++}),this.uuid=Pc(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(DI(e)?V2:Q2)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const p=new Pl().getNormalMatrix(e);r.applyNormalMatrix(p),r.needsUpdate=!0}const c=this.attributes.tangent;return c!==void 0&&(c.transformDirection(e),c.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return _h.makeRotationFromQuaternion(e),this.applyMatrix4(_h),this}rotateX(e){return _h.makeRotationX(e),this.applyMatrix4(_h),this}rotateY(e){return _h.makeRotationY(e),this.applyMatrix4(_h),this}rotateZ(e){return _h.makeRotationZ(e),this.applyMatrix4(_h),this}translate(e,t,r){return _h.makeTranslation(e,t,r),this.applyMatrix4(_h),this}scale(e,t,r){return _h.makeScale(e,t,r),this.applyMatrix4(_h),this}lookAt(e){return Rw.lookAt(e),Rw.updateMatrix(),this.applyMatrix4(Rw.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(gm).negate(),this.translate(gm.x,gm.y,gm.z),this}setFromPoints(e){const t=[];for(let r=0,c=e.length;r<c;r++){const p=e[r];t.push(p.x,p.y,p.z||0)}return this.setAttribute("position",new jn(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qu);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new ft(-1/0,-1/0,-1/0),new ft(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let r=0,c=t.length;r<c;r++){const p=t[r];Sc.setFromBufferAttribute(p),this.morphTargetsRelative?(ma.addVectors(this.boundingBox.min,Sc.min),this.boundingBox.expandByPoint(ma),ma.addVectors(this.boundingBox.max,Sc.max),this.boundingBox.expandByPoint(ma)):(this.boundingBox.expandByPoint(Sc.min),this.boundingBox.expandByPoint(Sc.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new qA);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new ft,1/0);return}if(e){const r=this.boundingSphere.center;if(Sc.setFromBufferAttribute(e),t)for(let p=0,y=t.length;p<y;p++){const i=t[p];s_.setFromBufferAttribute(i),this.morphTargetsRelative?(ma.addVectors(Sc.min,s_.min),Sc.expandByPoint(ma),ma.addVectors(Sc.max,s_.max),Sc.expandByPoint(ma)):(Sc.expandByPoint(s_.min),Sc.expandByPoint(s_.max))}Sc.getCenter(r);let c=0;for(let p=0,y=e.count;p<y;p++)ma.fromBufferAttribute(e,p),c=Math.max(c,r.distanceToSquared(ma));if(t)for(let p=0,y=t.length;p<y;p++){const i=t[p],C=this.morphTargetsRelative;for(let D=0,U=i.count;D<U;D++)ma.fromBufferAttribute(i,D),C&&(gm.fromBufferAttribute(e,D),ma.add(gm)),c=Math.max(c,r.distanceToSquared(ma))}this.boundingSphere.radius=Math.sqrt(c),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=e.array,c=t.position.array,p=t.normal.array,y=t.uv.array,i=c.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ds(new Float32Array(4*i),4));const C=this.getAttribute("tangent").array,D=[],U=[];for(let Et=0;Et<i;Et++)D[Et]=new ft,U[Et]=new ft;const N=new ft,R=new ft,G=new ft,J=new Di,Y=new Di,B=new Di,ae=new ft,le=new ft;function Ae(Et,oi,Ci){N.fromArray(c,Et*3),R.fromArray(c,oi*3),G.fromArray(c,Ci*3),J.fromArray(y,Et*2),Y.fromArray(y,oi*2),B.fromArray(y,Ci*2),R.sub(N),G.sub(N),Y.sub(J),B.sub(J);const te=1/(Y.x*B.y-B.x*Y.y);!isFinite(te)||(ae.copy(R).multiplyScalar(B.y).addScaledVector(G,-Y.y).multiplyScalar(te),le.copy(G).multiplyScalar(Y.x).addScaledVector(R,-B.x).multiplyScalar(te),D[Et].add(ae),D[oi].add(ae),D[Ci].add(ae),U[Et].add(le),U[oi].add(le),U[Ci].add(le))}let we=this.groups;we.length===0&&(we=[{start:0,count:r.length}]);for(let Et=0,oi=we.length;Et<oi;++Et){const Ci=we[Et],te=Ci.start,ce=Ci.count;for(let ye=te,xe=te+ce;ye<xe;ye+=3)Ae(r[ye+0],r[ye+1],r[ye+2])}const me=new ft,Pe=new ft,it=new ft,Me=new ft;function Ke(Et){it.fromArray(p,Et*3),Me.copy(it);const oi=D[Et];me.copy(oi),me.sub(it.multiplyScalar(it.dot(oi))).normalize(),Pe.crossVectors(Me,oi);const te=Pe.dot(U[Et])<0?-1:1;C[Et*4]=me.x,C[Et*4+1]=me.y,C[Et*4+2]=me.z,C[Et*4+3]=te}for(let Et=0,oi=we.length;Et<oi;++Et){const Ci=we[Et],te=Ci.start,ce=Ci.count;for(let ye=te,xe=te+ce;ye<xe;ye+=3)Ke(r[ye+0]),Ke(r[ye+1]),Ke(r[ye+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new ds(new Float32Array(t.count*3),3),this.setAttribute("normal",r);else for(let R=0,G=r.count;R<G;R++)r.setXYZ(R,0,0,0);const c=new ft,p=new ft,y=new ft,i=new ft,C=new ft,D=new ft,U=new ft,N=new ft;if(e)for(let R=0,G=e.count;R<G;R+=3){const J=e.getX(R+0),Y=e.getX(R+1),B=e.getX(R+2);c.fromBufferAttribute(t,J),p.fromBufferAttribute(t,Y),y.fromBufferAttribute(t,B),U.subVectors(y,p),N.subVectors(c,p),U.cross(N),i.fromBufferAttribute(r,J),C.fromBufferAttribute(r,Y),D.fromBufferAttribute(r,B),i.add(U),C.add(U),D.add(U),r.setXYZ(J,i.x,i.y,i.z),r.setXYZ(Y,C.x,C.y,C.z),r.setXYZ(B,D.x,D.y,D.z)}else for(let R=0,G=t.count;R<G;R+=3)c.fromBufferAttribute(t,R+0),p.fromBufferAttribute(t,R+1),y.fromBufferAttribute(t,R+2),U.subVectors(y,p),N.subVectors(c,p),U.cross(N),r.setXYZ(R+0,U.x,U.y,U.z),r.setXYZ(R+1,U.x,U.y,U.z),r.setXYZ(R+2,U.x,U.y,U.z);this.normalizeNormals(),r.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)ma.fromBufferAttribute(e,t),ma.normalize(),e.setXYZ(t,ma.x,ma.y,ma.z)}toNonIndexed(){function e(i,C){const D=i.array,U=i.itemSize,N=i.normalized,R=new D.constructor(C.length*U);let G=0,J=0;for(let Y=0,B=C.length;Y<B;Y++){i.isInterleavedBufferAttribute?G=C[Y]*i.data.stride+i.offset:G=C[Y]*U;for(let ae=0;ae<U;ae++)R[J++]=D[G++]}return new ds(R,U,N)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new br,r=this.index.array,c=this.attributes;for(const i in c){const C=c[i],D=e(C,r);t.setAttribute(i,D)}const p=this.morphAttributes;for(const i in p){const C=[],D=p[i];for(let U=0,N=D.length;U<N;U++){const R=D[U],G=e(R,r);C.push(G)}t.morphAttributes[i]=C}t.morphTargetsRelative=this.morphTargetsRelative;const y=this.groups;for(let i=0,C=y.length;i<C;i++){const D=y[i];t.addGroup(D.start,D.count,D.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const C=this.parameters;for(const D in C)C[D]!==void 0&&(e[D]=C[D]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const C in r){const D=r[C];e.data.attributes[C]=D.toJSON(e.data)}const c={};let p=!1;for(const C in this.morphAttributes){const D=this.morphAttributes[C],U=[];for(let N=0,R=D.length;N<R;N++){const G=D[N];U.push(G.toJSON(e.data))}U.length>0&&(c[C]=U,p=!0)}p&&(e.data.morphAttributes=c,e.data.morphTargetsRelative=this.morphTargetsRelative);const y=this.groups;y.length>0&&(e.data.groups=JSON.parse(JSON.stringify(y)));const i=this.boundingSphere;return i!==null&&(e.data.boundingSphere={center:i.center.toArray(),radius:i.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const c=e.attributes;for(const D in c){const U=c[D];this.setAttribute(D,U.clone(t))}const p=e.morphAttributes;for(const D in p){const U=[],N=p[D];for(let R=0,G=N.length;R<G;R++)U.push(N[R].clone(t));this.morphAttributes[D]=U}this.morphTargetsRelative=e.morphTargetsRelative;const y=e.groups;for(let D=0,U=y.length;D<U;D++){const N=y[D];this.addGroup(N.start,N.count,N.materialIndex)}const i=e.boundingBox;i!==null&&(this.boundingBox=i.clone());const C=e.boundingSphere;return C!==null&&(this.boundingSphere=C.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const WE=new lr,_m=new Ay,zw=new qA,o_=new ft,a_=new ft,l_=new ft,kw=new ft,ax=new ft,lx=new Di,cx=new Di,hx=new Di,Ow=new ft,ux=new ft;class is extends cs{constructor(e=new br,t=new na){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const c=t[r[0]];if(c!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let p=0,y=c.length;p<y;p++){const i=c[p].name||String(p);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=p}}}}getVertexPosition(e,t){const r=this.geometry,c=r.attributes.position,p=r.morphAttributes.position,y=r.morphTargetsRelative;t.fromBufferAttribute(c,e);const i=this.morphTargetInfluences;if(p&&i){ax.set(0,0,0);for(let C=0,D=p.length;C<D;C++){const U=i[C],N=p[C];U!==0&&(kw.fromBufferAttribute(N,e),y?ax.addScaledVector(kw,U):ax.addScaledVector(kw.sub(t),U))}t.add(ax)}return this.isSkinnedMesh&&this.boneTransform(e,t),t}raycast(e,t){const r=this.geometry,c=this.material,p=this.matrixWorld;if(c===void 0||(r.boundingSphere===null&&r.computeBoundingSphere(),zw.copy(r.boundingSphere),zw.applyMatrix4(p),e.ray.intersectsSphere(zw)===!1)||(WE.copy(p).invert(),_m.copy(e.ray).applyMatrix4(WE),r.boundingBox!==null&&_m.intersectsBox(r.boundingBox)===!1))return;let y;const i=r.index,C=r.attributes.position,D=r.attributes.uv,U=r.attributes.uv2,N=r.groups,R=r.drawRange;if(i!==null)if(Array.isArray(c))for(let G=0,J=N.length;G<J;G++){const Y=N[G],B=c[Y.materialIndex],ae=Math.max(Y.start,R.start),le=Math.min(i.count,Math.min(Y.start+Y.count,R.start+R.count));for(let Ae=ae,we=le;Ae<we;Ae+=3){const me=i.getX(Ae),Pe=i.getX(Ae+1),it=i.getX(Ae+2);y=Ax(this,B,e,_m,D,U,me,Pe,it),y&&(y.faceIndex=Math.floor(Ae/3),y.face.materialIndex=Y.materialIndex,t.push(y))}}else{const G=Math.max(0,R.start),J=Math.min(i.count,R.start+R.count);for(let Y=G,B=J;Y<B;Y+=3){const ae=i.getX(Y),le=i.getX(Y+1),Ae=i.getX(Y+2);y=Ax(this,c,e,_m,D,U,ae,le,Ae),y&&(y.faceIndex=Math.floor(Y/3),t.push(y))}}else if(C!==void 0)if(Array.isArray(c))for(let G=0,J=N.length;G<J;G++){const Y=N[G],B=c[Y.materialIndex],ae=Math.max(Y.start,R.start),le=Math.min(C.count,Math.min(Y.start+Y.count,R.start+R.count));for(let Ae=ae,we=le;Ae<we;Ae+=3){const me=Ae,Pe=Ae+1,it=Ae+2;y=Ax(this,B,e,_m,D,U,me,Pe,it),y&&(y.faceIndex=Math.floor(Ae/3),y.face.materialIndex=Y.materialIndex,t.push(y))}}else{const G=Math.max(0,R.start),J=Math.min(C.count,R.start+R.count);for(let Y=G,B=J;Y<B;Y+=3){const ae=Y,le=Y+1,Ae=Y+2;y=Ax(this,c,e,_m,D,U,ae,le,Ae),y&&(y.faceIndex=Math.floor(Y/3),t.push(y))}}}}function Hz(u,e,t,r,c,p,y,i){let C;if(e.side===Dc?C=r.intersectTriangle(y,p,c,!0,i):C=r.intersectTriangle(c,p,y,e.side===ju,i),C===null)return null;ux.copy(i),ux.applyMatrix4(u.matrixWorld);const D=t.ray.origin.distanceTo(ux);return D<t.near||D>t.far?null:{distance:D,point:ux.clone(),object:u}}function Ax(u,e,t,r,c,p,y,i,C){u.getVertexPosition(y,o_),u.getVertexPosition(i,a_),u.getVertexPosition(C,l_);const D=Hz(u,e,t,r,o_,a_,l_,Ow);if(D){c&&(lx.fromBufferAttribute(c,y),cx.fromBufferAttribute(c,i),hx.fromBufferAttribute(c,C),D.uv=wh.getUV(Ow,o_,a_,l_,lx,cx,hx,new Di)),p&&(lx.fromBufferAttribute(p,y),cx.fromBufferAttribute(p,i),hx.fromBufferAttribute(p,C),D.uv2=wh.getUV(Ow,o_,a_,l_,lx,cx,hx,new Di));const U={a:y,b:i,c:C,normal:new ft,materialIndex:0};wh.getNormal(o_,a_,l_,U.normal),D.face=U}return D}class YA extends br{constructor(e=1,t=1,r=1,c=1,p=1,y=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:c,heightSegments:p,depthSegments:y};const i=this;c=Math.floor(c),p=Math.floor(p),y=Math.floor(y);const C=[],D=[],U=[],N=[];let R=0,G=0;J("z","y","x",-1,-1,r,t,e,y,p,0),J("z","y","x",1,-1,r,t,-e,y,p,1),J("x","z","y",1,1,e,r,t,c,y,2),J("x","z","y",1,-1,e,r,-t,c,y,3),J("x","y","z",1,-1,e,t,r,c,p,4),J("x","y","z",-1,-1,e,t,-r,c,p,5),this.setIndex(C),this.setAttribute("position",new jn(D,3)),this.setAttribute("normal",new jn(U,3)),this.setAttribute("uv",new jn(N,2));function J(Y,B,ae,le,Ae,we,me,Pe,it,Me,Ke){const Et=we/it,oi=me/Me,Ci=we/2,te=me/2,ce=Pe/2,ye=it+1,xe=Me+1;let ze=0,Ne=0;const Ge=new ft;for(let Ve=0;Ve<xe;Ve++){const Le=Ve*oi-te;for(let Ie=0;Ie<ye;Ie++){const qe=Ie*Et-Ci;Ge[Y]=qe*le,Ge[B]=Le*Ae,Ge[ae]=ce,D.push(Ge.x,Ge.y,Ge.z),Ge[Y]=0,Ge[B]=0,Ge[ae]=Pe>0?1:-1,U.push(Ge.x,Ge.y,Ge.z),N.push(Ie/it),N.push(1-Ve/Me),ze+=1}}for(let Ve=0;Ve<Me;Ve++)for(let Le=0;Le<it;Le++){const Ie=R+Le+ye*Ve,qe=R+Le+ye*(Ve+1),et=R+(Le+1)+ye*(Ve+1),vt=R+(Le+1)+ye*Ve;C.push(Ie,qe,vt),C.push(qe,et,vt),Ne+=6}i.addGroup(G,Ne,Ke),G+=Ne,R+=ze}}static fromJSON(e){return new YA(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function jm(u){const e={};for(const t in u){e[t]={};for(const r in u[t]){const c=u[t][r];c&&(c.isColor||c.isMatrix3||c.isMatrix4||c.isVector2||c.isVector3||c.isVector4||c.isTexture||c.isQuaternion)?e[t][r]=c.clone():Array.isArray(c)?e[t][r]=c.slice():e[t][r]=c}}return e}function Sl(u){const e={};for(let t=0;t<u.length;t++){const r=jm(u[t]);for(const c in r)e[c]=r[c]}return e}function Gz(u){const e=[];for(let t=0;t<u.length;t++)e.push(u[t].clone());return e}function UI(u){return u.getRenderTarget()===null&&u.outputEncoding===Ss?cu:Wm}const _f={clone:jm,merge:Sl};var Wz=`void main() {
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,jz=`void main() {
- gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
- }`;class ko extends ol{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Wz,this.fragmentShader=jz,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=jm(e.uniforms),this.uniformsGroups=Gz(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const c in this.uniforms){const y=this.uniforms[c].value;y&&y.isTexture?t.uniforms[c]={type:"t",value:y.toJSON(e).uuid}:y&&y.isColor?t.uniforms[c]={type:"c",value:y.getHex()}:y&&y.isVector2?t.uniforms[c]={type:"v2",value:y.toArray()}:y&&y.isVector3?t.uniforms[c]={type:"v3",value:y.toArray()}:y&&y.isVector4?t.uniforms[c]={type:"v4",value:y.toArray()}:y&&y.isMatrix3?t.uniforms[c]={type:"m3",value:y.toArray()}:y&&y.isMatrix4?t.uniforms[c]={type:"m4",value:y.toArray()}:t.uniforms[c]={value:y}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const r={};for(const c in this.extensions)this.extensions[c]===!0&&(r[c]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class Hv extends cs{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new lr,this.projectionMatrix=new lr,this.projectionMatrixInverse=new lr}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class _a extends Hv{constructor(e=50,t=1,r=.1,c=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=c,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=$_*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(pf*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return $_*2*Math.atan(Math.tan(pf*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,c,p,y){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=c,this.view.width=p,this.view.height=y,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(pf*.5*this.fov)/this.zoom,r=2*t,c=this.aspect*r,p=-.5*c;const y=this.view;if(this.view!==null&&this.view.enabled){const C=y.fullWidth,D=y.fullHeight;p+=y.offsetX*c/C,t-=y.offsetY*r/D,c*=y.width/C,r*=y.height/D}const i=this.filmOffset;i!==0&&(p+=e*i/this.getFilmWidth()),this.projectionMatrix.makePerspective(p,p+c,t,t-r,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ym=-90,xm=1;class RI extends cs{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;const c=new _a(ym,xm,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(1,0,0),this.add(c);const p=new _a(ym,xm,e,t);p.layers=this.layers,p.up.set(0,1,0),p.lookAt(-1,0,0),this.add(p);const y=new _a(ym,xm,e,t);y.layers=this.layers,y.up.set(0,0,-1),y.lookAt(0,1,0),this.add(y);const i=new _a(ym,xm,e,t);i.layers=this.layers,i.up.set(0,0,1),i.lookAt(0,-1,0),this.add(i);const C=new _a(ym,xm,e,t);C.layers=this.layers,C.up.set(0,1,0),C.lookAt(0,0,1),this.add(C);const D=new _a(ym,xm,e,t);D.layers=this.layers,D.up.set(0,1,0),D.lookAt(0,0,-1),this.add(D)}update(e,t){this.parent===null&&this.updateMatrixWorld();const r=this.renderTarget,[c,p,y,i,C,D]=this.children,U=e.getRenderTarget(),N=e.toneMapping,R=e.xr.enabled;e.toneMapping=Vu,e.xr.enabled=!1;const G=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,c),e.setRenderTarget(r,1),e.render(t,p),e.setRenderTarget(r,2),e.render(t,y),e.setRenderTarget(r,3),e.render(t,i),e.setRenderTarget(r,4),e.render(t,C),r.texture.generateMipmaps=G,e.setRenderTarget(r,5),e.render(t,D),e.setRenderTarget(U),e.toneMapping=N,e.xr.enabled=R,r.texture.needsPMREMUpdate=!0}}class py extends To{constructor(e,t,r,c,p,y,i,C,D,U){e=e!==void 0?e:[],t=t!==void 0?t:op,super(e,t,r,c,p,y,i,C,D,U),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class zI extends Oa{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},c=[r,r,r,r,r,r];this.texture=new py(c,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Xs}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
- varying vec3 vWorldDirection;
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }
- `,fragmentShader:`
- uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- }
- `},c=new YA(5,5,5),p=new ko({name:"CubemapFromEquirect",uniforms:jm(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Dc,blending:KA});p.uniforms.tEquirect.value=t;const y=new is(c,p),i=t.minFilter;return t.minFilter===lp&&(t.minFilter=Xs),new RI(1,10,this).update(e,y),t.minFilter=i,y.geometry.dispose(),y.material.dispose(),this}clear(e,t,r,c){const p=e.getRenderTarget();for(let y=0;y<6;y++)e.setRenderTarget(this,y),e.clear(t,r,c);e.setRenderTarget(p)}}const Nw=new ft,Kz=new ft,$z=new Pl;class $d{constructor(e=new ft(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,c){return this.normal.set(e,t,r),this.constant=c,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const c=Nw.subVectors(r,t).cross(Kz.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(c,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const r=e.delta(Nw),c=this.normal.dot(r);if(c===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const p=-(e.start.dot(this.normal)+this.constant)/c;return p<0||p>1?null:t.copy(r).multiplyScalar(p).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||$z.getNormalMatrix(e),c=this.coplanarPoint(Nw).applyMatrix4(e),p=this.normal.applyMatrix3(r).normalize();return this.constant=-c.dot(p),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const vm=new qA,dx=new ft;class Gv{constructor(e=new $d,t=new $d,r=new $d,c=new $d,p=new $d,y=new $d){this.planes=[e,t,r,c,p,y]}set(e,t,r,c,p,y){const i=this.planes;return i[0].copy(e),i[1].copy(t),i[2].copy(r),i[3].copy(c),i[4].copy(p),i[5].copy(y),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){const t=this.planes,r=e.elements,c=r[0],p=r[1],y=r[2],i=r[3],C=r[4],D=r[5],U=r[6],N=r[7],R=r[8],G=r[9],J=r[10],Y=r[11],B=r[12],ae=r[13],le=r[14],Ae=r[15];return t[0].setComponents(i-c,N-C,Y-R,Ae-B).normalize(),t[1].setComponents(i+c,N+C,Y+R,Ae+B).normalize(),t[2].setComponents(i+p,N+D,Y+G,Ae+ae).normalize(),t[3].setComponents(i-p,N-D,Y-G,Ae-ae).normalize(),t[4].setComponents(i-y,N-U,Y-J,Ae-le).normalize(),t[5].setComponents(i+y,N+U,Y+J,Ae+le).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),vm.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(vm)}intersectsSprite(e){return vm.center.set(0,0,0),vm.radius=.7071067811865476,vm.applyMatrix4(e.matrixWorld),this.intersectsSphere(vm)}intersectsSphere(e){const t=this.planes,r=e.center,c=-e.radius;for(let p=0;p<6;p++)if(t[p].distanceToPoint(r)<c)return!1;return!0}intersectsBox(e){const t=this.planes;for(let r=0;r<6;r++){const c=t[r];if(dx.x=c.normal.x>0?e.max.x:e.min.x,dx.y=c.normal.y>0?e.max.y:e.min.y,dx.z=c.normal.z>0?e.max.z:e.min.z,c.distanceToPoint(dx)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function kI(){let u=null,e=!1,t=null,r=null;function c(p,y){t(p,y),r=u.requestAnimationFrame(c)}return{start:function(){e!==!0&&t!==null&&(r=u.requestAnimationFrame(c),e=!0)},stop:function(){u.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(p){t=p},setContext:function(p){u=p}}}function Zz(u,e){const t=e.isWebGL2,r=new WeakMap;function c(D,U){const N=D.array,R=D.usage,G=u.createBuffer();u.bindBuffer(U,G),u.bufferData(U,N,R),D.onUploadCallback();let J;if(N instanceof Float32Array)J=5126;else if(N instanceof Uint16Array)if(D.isFloat16BufferAttribute)if(t)J=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else J=5123;else if(N instanceof Int16Array)J=5122;else if(N instanceof Uint32Array)J=5125;else if(N instanceof Int32Array)J=5124;else if(N instanceof Int8Array)J=5120;else if(N instanceof Uint8Array)J=5121;else if(N instanceof Uint8ClampedArray)J=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+N);return{buffer:G,type:J,bytesPerElement:N.BYTES_PER_ELEMENT,version:D.version}}function p(D,U,N){const R=U.array,G=U.updateRange;u.bindBuffer(N,D),G.count===-1?u.bufferSubData(N,0,R):(t?u.bufferSubData(N,G.offset*R.BYTES_PER_ELEMENT,R,G.offset,G.count):u.bufferSubData(N,G.offset*R.BYTES_PER_ELEMENT,R.subarray(G.offset,G.offset+G.count)),G.count=-1),U.onUploadCallback()}function y(D){return D.isInterleavedBufferAttribute&&(D=D.data),r.get(D)}function i(D){D.isInterleavedBufferAttribute&&(D=D.data);const U=r.get(D);U&&(u.deleteBuffer(U.buffer),r.delete(D))}function C(D,U){if(D.isGLBufferAttribute){const R=r.get(D);(!R||R.version<D.version)&&r.set(D,{buffer:D.buffer,type:D.type,bytesPerElement:D.elementSize,version:D.version});return}D.isInterleavedBufferAttribute&&(D=D.data);const N=r.get(D);N===void 0?r.set(D,c(D,U)):N.version<D.version&&(p(N.buffer,D,U),N.version=D.version)}return{get:y,remove:i,update:C}}class $A extends br{constructor(e=1,t=1,r=1,c=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:c};const p=e/2,y=t/2,i=Math.floor(r),C=Math.floor(c),D=i+1,U=C+1,N=e/i,R=t/C,G=[],J=[],Y=[],B=[];for(let ae=0;ae<U;ae++){const le=ae*R-y;for(let Ae=0;Ae<D;Ae++){const we=Ae*N-p;J.push(we,-le,0),Y.push(0,0,1),B.push(Ae/i),B.push(1-ae/C)}}for(let ae=0;ae<C;ae++)for(let le=0;le<i;le++){const Ae=le+D*ae,we=le+D*(ae+1),me=le+1+D*(ae+1),Pe=le+1+D*ae;G.push(Ae,we,Pe),G.push(we,me,Pe)}this.setIndex(G),this.setAttribute("position",new jn(J,3)),this.setAttribute("normal",new jn(Y,3)),this.setAttribute("uv",new jn(B,2))}static fromJSON(e){return new $A(e.width,e.height,e.widthSegments,e.heightSegments)}}var Xz=`#ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, vUv ).g;
- #endif`,qz=`#ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,Yz=`#ifdef USE_ALPHATEST
- if ( diffuseColor.a < alphaTest ) discard;
- #endif`,Jz=`#ifdef USE_ALPHATEST
- uniform float alphaTest;
- #endif`,ek=`#ifdef USE_AOMAP
- float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
- reflectedLight.indirectDiffuse *= ambientOcclusion;
- #if defined( USE_ENVMAP ) && defined( STANDARD )
- float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
- reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
- #endif
- #endif`,tk=`#ifdef USE_AOMAP
- uniform sampler2D aoMap;
- uniform float aoMapIntensity;
- #endif`,ik="vec3 transformed = vec3( position );",nk=`vec3 objectNormal = vec3( normal );
- #ifdef USE_TANGENT
- vec3 objectTangent = vec3( tangent.xyz );
- #endif`,rk=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
- return RECIPROCAL_PI * diffuseColor;
- }
- vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- }
- float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- }
- vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
- float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
- float x2 = x * x;
- float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
- return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
- }
- float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
- float a2 = pow2( alpha );
- float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
- float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
- return 0.5 / max( gv + gl, EPSILON );
- }
- float D_GGX( const in float alpha, const in float dotNH ) {
- float a2 = pow2( alpha );
- float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
- return RECIPROCAL_PI * a2 / pow2( denom );
- }
- vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- return F * ( V * D );
- }
- #ifdef USE_IRIDESCENCE
- vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- return F * ( V * D );
- }
- #endif
- vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
- const float LUT_SIZE = 64.0;
- const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
- const float LUT_BIAS = 0.5 / LUT_SIZE;
- float dotNV = saturate( dot( N, V ) );
- vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
- uv = uv * LUT_SCALE + LUT_BIAS;
- return uv;
- }
- float LTC_ClippedSphereFormFactor( const in vec3 f ) {
- float l = length( f );
- return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
- }
- vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
- float x = dot( v1, v2 );
- float y = abs( x );
- float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
- float b = 3.4175940 + ( 4.1616724 + y ) * y;
- float v = a / b;
- float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
- return cross( v1, v2 ) * theta_sintheta;
- }
- vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
- vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
- vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
- vec3 lightNormal = cross( v1, v2 );
- if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
- vec3 T1, T2;
- T1 = normalize( V - N * dot( V, N ) );
- T2 = - cross( N, T1 );
- mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
- vec3 coords[ 4 ];
- coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
- coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
- coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
- coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
- coords[ 0 ] = normalize( coords[ 0 ] );
- coords[ 1 ] = normalize( coords[ 1 ] );
- coords[ 2 ] = normalize( coords[ 2 ] );
- coords[ 3 ] = normalize( coords[ 3 ] );
- vec3 vectorFormFactor = vec3( 0.0 );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
- float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
- return vec3( result );
- }
- float G_BlinnPhong_Implicit( ) {
- return 0.25;
- }
- float D_BlinnPhong( const in float shininess, const in float dotNH ) {
- return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
- }
- vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( specularColor, 1.0, dotVH );
- float G = G_BlinnPhong_Implicit( );
- float D = D_BlinnPhong( shininess, dotNH );
- return F * ( G * D );
- }
- #if defined( USE_SHEEN )
- float D_Charlie( float roughness, float dotNH ) {
- float alpha = pow2( roughness );
- float invAlpha = 1.0 / alpha;
- float cos2h = dotNH * dotNH;
- float sin2h = max( 1.0 - cos2h, 0.0078125 );
- return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
- }
- float V_Neubelt( float dotNV, float dotNL ) {
- return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
- }
- vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float D = D_Charlie( sheenRoughness, dotNH );
- float V = V_Neubelt( dotNV, dotNL );
- return sheenColor * ( D * V );
- }
- #endif`,sk=`#ifdef USE_IRIDESCENCE
- const mat3 XYZ_TO_REC709 = mat3(
- 3.2404542, -0.9692660, 0.0556434,
- -1.5371385, 1.8760108, -0.2040259,
- -0.4985314, 0.0415560, 1.0572252
- );
- vec3 Fresnel0ToIor( vec3 fresnel0 ) {
- vec3 sqrtF0 = sqrt( fresnel0 );
- return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
- }
- vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
- }
- float IorToFresnel0( float transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
- }
- vec3 evalSensitivity( float OPD, vec3 shift ) {
- float phase = 2.0 * PI * OPD * 1.0e-9;
- vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
- vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
- vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
- vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
- xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
- xyz /= 1.0685e-7;
- vec3 rgb = XYZ_TO_REC709 * xyz;
- return rgb;
- }
- vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
- vec3 I;
- float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
- float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
- float cosTheta2Sq = 1.0 - sinTheta2Sq;
- if ( cosTheta2Sq < 0.0 ) {
- return vec3( 1.0 );
- }
- float cosTheta2 = sqrt( cosTheta2Sq );
- float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
- float R12 = F_Schlick( R0, 1.0, cosTheta1 );
- float R21 = R12;
- float T121 = 1.0 - R12;
- float phi12 = 0.0;
- if ( iridescenceIOR < outsideIOR ) phi12 = PI;
- float phi21 = PI - phi12;
- vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
- vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
- vec3 phi23 = vec3( 0.0 );
- if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
- if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
- if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
- float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
- vec3 phi = vec3( phi21 ) + phi23;
- vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
- vec3 r123 = sqrt( R123 );
- vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
- vec3 C0 = R12 + Rs;
- I = C0;
- vec3 Cm = Rs - T121;
- for ( int m = 1; m <= 2; ++ m ) {
- Cm *= r123;
- vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
- I += Cm * Sm;
- }
- return max( I, vec3( 0.0 ) );
- }
- #endif`,ok=`#ifdef USE_BUMPMAP
- uniform sampler2D bumpMap;
- uniform float bumpScale;
- vec2 dHdxy_fwd() {
- vec2 dSTdx = dFdx( vUv );
- vec2 dSTdy = dFdy( vUv );
- float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
- float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
- float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
- return vec2( dBx, dBy );
- }
- vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
- vec3 vSigmaX = dFdx( surf_pos.xyz );
- vec3 vSigmaY = dFdy( surf_pos.xyz );
- vec3 vN = surf_norm;
- vec3 R1 = cross( vSigmaY, vN );
- vec3 R2 = cross( vN, vSigmaX );
- float fDet = dot( vSigmaX, R1 ) * faceDirection;
- vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
- return normalize( abs( fDet ) * surf_norm - vGrad );
- }
- #endif`,ak=`#if NUM_CLIPPING_PLANES > 0
- vec4 plane;
- #pragma unroll_loop_start
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
- }
- #pragma unroll_loop_end
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
- bool clipped = true;
- #pragma unroll_loop_start
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
- }
- #pragma unroll_loop_end
- if ( clipped ) discard;
- #endif
- #endif`,lk=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
- #endif`,ck=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- #endif`,hk=`#if NUM_CLIPPING_PLANES > 0
- vClipPosition = - mvPosition.xyz;
- #endif`,uk=`#if defined( USE_COLOR_ALPHA )
- diffuseColor *= vColor;
- #elif defined( USE_COLOR )
- diffuseColor.rgb *= vColor;
- #endif`,Ak=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR )
- varying vec3 vColor;
- #endif`,dk=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
- varying vec3 vColor;
- #endif`,pk=`#if defined( USE_COLOR_ALPHA )
- vColor = vec4( 1.0 );
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
- vColor = vec3( 1.0 );
- #endif
- #ifdef USE_COLOR
- vColor *= color;
- #endif
- #ifdef USE_INSTANCING_COLOR
- vColor.xyz *= instanceColor.xyz;
- #endif`,fk=`#define PI 3.141592653589793
- #define PI2 6.283185307179586
- #define PI_HALF 1.5707963267948966
- #define RECIPROCAL_PI 0.3183098861837907
- #define RECIPROCAL_PI2 0.15915494309189535
- #define EPSILON 1e-6
- #ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- #define whiteComplement( a ) ( 1.0 - saturate( a ) )
- float pow2( const in float x ) { return x*x; }
- vec3 pow2( const in vec3 x ) { return x*x; }
- float pow3( const in float x ) { return x*x*x; }
- float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
- float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
- float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
- highp float rand( const in vec2 uv ) {
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
- highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
- return fract( sin( sn ) * c );
- }
- #ifdef HIGH_PRECISION
- float precisionSafeLength( vec3 v ) { return length( v ); }
- #else
- float precisionSafeLength( vec3 v ) {
- float maxComponent = max3( abs( v ) );
- return length( v / maxComponent ) * maxComponent;
- }
- #endif
- struct IncidentLight {
- vec3 color;
- vec3 direction;
- bool visible;
- };
- struct ReflectedLight {
- vec3 directDiffuse;
- vec3 directSpecular;
- vec3 indirectDiffuse;
- vec3 indirectSpecular;
- };
- struct GeometricContext {
- vec3 position;
- vec3 normal;
- vec3 viewDir;
- #ifdef USE_CLEARCOAT
- vec3 clearcoatNormal;
- #endif
- };
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
- }
- mat3 transposeMat3( const in mat3 m ) {
- mat3 tmp;
- tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
- tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
- tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
- return tmp;
- }
- float luminance( const in vec3 rgb ) {
- const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
- return dot( weights, rgb );
- }
- bool isPerspectiveMatrix( mat4 m ) {
- return m[ 2 ][ 3 ] == - 1.0;
- }
- vec2 equirectUv( in vec3 dir ) {
- float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
- float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
- return vec2( u, v );
- }`,mk=`#ifdef ENVMAP_TYPE_CUBE_UV
- #define cubeUV_minMipLevel 4.0
- #define cubeUV_minTileSize 16.0
- float getFace( vec3 direction ) {
- vec3 absDirection = abs( direction );
- float face = - 1.0;
- if ( absDirection.x > absDirection.z ) {
- if ( absDirection.x > absDirection.y )
- face = direction.x > 0.0 ? 0.0 : 3.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- } else {
- if ( absDirection.z > absDirection.y )
- face = direction.z > 0.0 ? 2.0 : 5.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- }
- return face;
- }
- vec2 getUV( vec3 direction, float face ) {
- vec2 uv;
- if ( face == 0.0 ) {
- uv = vec2( direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 1.0 ) {
- uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
- } else if ( face == 2.0 ) {
- uv = vec2( - direction.x, direction.y ) / abs( direction.z );
- } else if ( face == 3.0 ) {
- uv = vec2( - direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 4.0 ) {
- uv = vec2( - direction.x, direction.z ) / abs( direction.y );
- } else {
- uv = vec2( direction.x, direction.y ) / abs( direction.z );
- }
- return 0.5 * ( uv + 1.0 );
- }
- vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
- float face = getFace( direction );
- float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
- mipInt = max( mipInt, cubeUV_minMipLevel );
- float faceSize = exp2( mipInt );
- highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
- if ( face > 2.0 ) {
- uv.y += faceSize;
- face -= 3.0;
- }
- uv.x += face * faceSize;
- uv.x += filterInt * 3.0 * cubeUV_minTileSize;
- uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
- uv.x *= CUBEUV_TEXEL_WIDTH;
- uv.y *= CUBEUV_TEXEL_HEIGHT;
- #ifdef texture2DGradEXT
- return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
- #else
- return texture2D( envMap, uv ).rgb;
- #endif
- }
- #define cubeUV_r0 1.0
- #define cubeUV_v0 0.339
- #define cubeUV_m0 - 2.0
- #define cubeUV_r1 0.8
- #define cubeUV_v1 0.276
- #define cubeUV_m1 - 1.0
- #define cubeUV_r4 0.4
- #define cubeUV_v4 0.046
- #define cubeUV_m4 2.0
- #define cubeUV_r5 0.305
- #define cubeUV_v5 0.016
- #define cubeUV_m5 3.0
- #define cubeUV_r6 0.21
- #define cubeUV_v6 0.0038
- #define cubeUV_m6 4.0
- float roughnessToMip( float roughness ) {
- float mip = 0.0;
- if ( roughness >= cubeUV_r1 ) {
- mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
- } else if ( roughness >= cubeUV_r4 ) {
- mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
- } else if ( roughness >= cubeUV_r5 ) {
- mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
- } else if ( roughness >= cubeUV_r6 ) {
- mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
- } else {
- mip = - 2.0 * log2( 1.16 * roughness ); }
- return mip;
- }
- vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
- float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
- float mipF = fract( mip );
- float mipInt = floor( mip );
- vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
- if ( mipF == 0.0 ) {
- return vec4( color0, 1.0 );
- } else {
- vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
- return vec4( mix( color0, color1, mipF ), 1.0 );
- }
- }
- #endif`,gk=`vec3 transformedNormal = objectNormal;
- #ifdef USE_INSTANCING
- mat3 m = mat3( instanceMatrix );
- transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
- transformedNormal = m * transformedNormal;
- #endif
- transformedNormal = normalMatrix * transformedNormal;
- #ifdef FLIP_SIDED
- transformedNormal = - transformedNormal;
- #endif
- #ifdef USE_TANGENT
- vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
- #ifdef FLIP_SIDED
- transformedTangent = - transformedTangent;
- #endif
- #endif`,_k=`#ifdef USE_DISPLACEMENTMAP
- uniform sampler2D displacementMap;
- uniform float displacementScale;
- uniform float displacementBias;
- #endif`,yk=`#ifdef USE_DISPLACEMENTMAP
- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
- #endif`,xk=`#ifdef USE_EMISSIVEMAP
- vec4 emissiveColor = texture2D( emissiveMap, vUv );
- totalEmissiveRadiance *= emissiveColor.rgb;
- #endif`,vk=`#ifdef USE_EMISSIVEMAP
- uniform sampler2D emissiveMap;
- #endif`,wk="gl_FragColor = linearToOutputTexel( gl_FragColor );",bk=`vec4 LinearToLinear( in vec4 value ) {
- return value;
- }
- vec4 LinearTosRGB( in vec4 value ) {
- return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
- }`,Bk=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vec3 cameraToFrag;
- if ( isOrthographic ) {
- cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToFrag = normalize( vWorldPosition - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vec3 reflectVec = reflect( cameraToFrag, worldNormal );
- #else
- vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
- #endif
- #else
- vec3 reflectVec = vReflect;
- #endif
- #ifdef ENVMAP_TYPE_CUBE
- vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
- #else
- vec4 envColor = vec4( 0.0 );
- #endif
- #ifdef ENVMAP_BLENDING_MULTIPLY
- outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_MIX )
- outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_ADD )
- outgoingLight += envColor.xyz * specularStrength * reflectivity;
- #endif
- #endif`,Ck=`#ifdef USE_ENVMAP
- uniform float envMapIntensity;
- uniform float flipEnvMap;
- #ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #else
- uniform sampler2D envMap;
- #endif
-
- #endif`,Ek=`#ifdef USE_ENVMAP
- uniform float reflectivity;
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
- varying vec3 vWorldPosition;
- uniform float refractionRatio;
- #else
- varying vec3 vReflect;
- #endif
- #endif`,Tk=`#ifdef USE_ENVMAP
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
-
- varying vec3 vWorldPosition;
- #else
- varying vec3 vReflect;
- uniform float refractionRatio;
- #endif
- #endif`,Sk=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vWorldPosition = worldPosition.xyz;
- #else
- vec3 cameraToVertex;
- if ( isOrthographic ) {
- cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vReflect = reflect( cameraToVertex, worldNormal );
- #else
- vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
- #endif
- #endif
- #endif`,Mk=`#ifdef USE_FOG
- vFogDepth = - mvPosition.z;
- #endif`,Ik=`#ifdef USE_FOG
- varying float vFogDepth;
- #endif`,Fk=`#ifdef USE_FOG
- #ifdef FOG_EXP2
- float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
- #else
- float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
- #endif
- gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
- #endif`,Lk=`#ifdef USE_FOG
- uniform vec3 fogColor;
- varying float vFogDepth;
- #ifdef FOG_EXP2
- uniform float fogDensity;
- #else
- uniform float fogNear;
- uniform float fogFar;
- #endif
- #endif`,Dk=`#ifdef USE_GRADIENTMAP
- uniform sampler2D gradientMap;
- #endif
- vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
- float dotNL = dot( normal, lightDirection );
- vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
- #ifdef USE_GRADIENTMAP
- return vec3( texture2D( gradientMap, coord ).r );
- #else
- vec2 fw = fwidth( coord ) * 0.5;
- return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
- #endif
- }`,Pk=`#ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vUv2 );
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
- reflectedLight.indirectDiffuse += lightMapIrradiance;
- #endif`,Uk=`#ifdef USE_LIGHTMAP
- uniform sampler2D lightMap;
- uniform float lightMapIntensity;
- #endif`,Rk=`LambertMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularStrength = specularStrength;`,zk=`varying vec3 vViewPosition;
- struct LambertMaterial {
- vec3 diffuseColor;
- float specularStrength;
- };
- void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Lambert
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,kk=`uniform bool receiveShadow;
- uniform vec3 ambientLightColor;
- uniform vec3 lightProbe[ 9 ];
- vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
- float x = normal.x, y = normal.y, z = normal.z;
- vec3 result = shCoefficients[ 0 ] * 0.886227;
- result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
- result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
- result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
- result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
- result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
- result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
- result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
- result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
- return result;
- }
- vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
- return irradiance;
- }
- vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
- vec3 irradiance = ambientLightColor;
- return irradiance;
- }
- float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
- #if defined ( PHYSICALLY_CORRECT_LIGHTS )
- float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
- if ( cutoffDistance > 0.0 ) {
- distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
- }
- return distanceFalloff;
- #else
- if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
- return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
- }
- return 1.0;
- #endif
- }
- float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
- return smoothstep( coneCosine, penumbraCosine, angleCosine );
- }
- #if NUM_DIR_LIGHTS > 0
- struct DirectionalLight {
- vec3 direction;
- vec3 color;
- };
- uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
- void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
- light.color = directionalLight.color;
- light.direction = directionalLight.direction;
- light.visible = true;
- }
- #endif
- #if NUM_POINT_LIGHTS > 0
- struct PointLight {
- vec3 position;
- vec3 color;
- float distance;
- float decay;
- };
- uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
- void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
- vec3 lVector = pointLight.position - geometry.position;
- light.direction = normalize( lVector );
- float lightDistance = length( lVector );
- light.color = pointLight.color;
- light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- }
- #endif
- #if NUM_SPOT_LIGHTS > 0
- struct SpotLight {
- vec3 position;
- vec3 direction;
- vec3 color;
- float distance;
- float decay;
- float coneCos;
- float penumbraCos;
- };
- uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
- void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
- vec3 lVector = spotLight.position - geometry.position;
- light.direction = normalize( lVector );
- float angleCos = dot( light.direction, spotLight.direction );
- float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
- if ( spotAttenuation > 0.0 ) {
- float lightDistance = length( lVector );
- light.color = spotLight.color * spotAttenuation;
- light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- } else {
- light.color = vec3( 0.0 );
- light.visible = false;
- }
- }
- #endif
- #if NUM_RECT_AREA_LIGHTS > 0
- struct RectAreaLight {
- vec3 color;
- vec3 position;
- vec3 halfWidth;
- vec3 halfHeight;
- };
- uniform sampler2D ltc_1; uniform sampler2D ltc_2;
- uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
- #endif
- #if NUM_HEMI_LIGHTS > 0
- struct HemisphereLight {
- vec3 direction;
- vec3 skyColor;
- vec3 groundColor;
- };
- uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
- vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
- float dotNL = dot( normal, hemiLight.direction );
- float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
- vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
- return irradiance;
- }
- #endif`,Ok=`#if defined( USE_ENVMAP )
- vec3 getIBLIrradiance( const in vec3 normal ) {
- #if defined( ENVMAP_TYPE_CUBE_UV )
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
- return PI * envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
- #if defined( ENVMAP_TYPE_CUBE_UV )
- vec3 reflectVec = reflect( - viewDir, normal );
- reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
- reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
- return envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- #endif`,Nk=`ToonMaterial material;
- material.diffuseColor = diffuseColor.rgb;`,Qk=`varying vec3 vViewPosition;
- struct ToonMaterial {
- vec3 diffuseColor;
- };
- void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
- vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Toon
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Vk=`BlinnPhongMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularColor = specular;
- material.specularShininess = shininess;
- material.specularStrength = specularStrength;`,Hk=`varying vec3 vViewPosition;
- struct BlinnPhongMaterial {
- vec3 diffuseColor;
- vec3 specularColor;
- float specularShininess;
- float specularStrength;
- };
- void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
- }
- void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_BlinnPhong
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Gk=`PhysicalMaterial material;
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
- vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
- float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
- material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
- material.roughness = min( material.roughness, 1.0 );
- #ifdef IOR
- material.ior = ior;
- #ifdef SPECULAR
- float specularIntensityFactor = specularIntensity;
- vec3 specularColorFactor = specularColor;
- #ifdef USE_SPECULARINTENSITYMAP
- specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
- #endif
- #ifdef USE_SPECULARCOLORMAP
- specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
- #endif
- material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
- #else
- float specularIntensityFactor = 1.0;
- vec3 specularColorFactor = vec3( 1.0 );
- material.specularF90 = 1.0;
- #endif
- material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
- #else
- material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
- material.specularF90 = 1.0;
- #endif
- #ifdef USE_CLEARCOAT
- material.clearcoat = clearcoat;
- material.clearcoatRoughness = clearcoatRoughness;
- material.clearcoatF0 = vec3( 0.04 );
- material.clearcoatF90 = 1.0;
- #ifdef USE_CLEARCOATMAP
- material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
- #endif
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
- material.clearcoatRoughness += geometryRoughness;
- material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
- #endif
- #ifdef USE_IRIDESCENCE
- material.iridescence = iridescence;
- material.iridescenceIOR = iridescenceIOR;
- #ifdef USE_IRIDESCENCEMAP
- material.iridescence *= texture2D( iridescenceMap, vUv ).r;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
- #else
- material.iridescenceThickness = iridescenceThicknessMaximum;
- #endif
- #endif
- #ifdef USE_SHEEN
- material.sheenColor = sheenColor;
- #ifdef USE_SHEENCOLORMAP
- material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
- #endif
- material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
- #ifdef USE_SHEENROUGHNESSMAP
- material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
- #endif
- #endif`,Wk=`struct PhysicalMaterial {
- vec3 diffuseColor;
- float roughness;
- vec3 specularColor;
- float specularF90;
- #ifdef USE_CLEARCOAT
- float clearcoat;
- float clearcoatRoughness;
- vec3 clearcoatF0;
- float clearcoatF90;
- #endif
- #ifdef USE_IRIDESCENCE
- float iridescence;
- float iridescenceIOR;
- float iridescenceThickness;
- vec3 iridescenceFresnel;
- vec3 iridescenceF0;
- #endif
- #ifdef USE_SHEEN
- vec3 sheenColor;
- float sheenRoughness;
- #endif
- #ifdef IOR
- float ior;
- #endif
- #ifdef USE_TRANSMISSION
- float transmission;
- float transmissionAlpha;
- float thickness;
- float attenuationDistance;
- vec3 attenuationColor;
- #endif
- };
- vec3 clearcoatSpecular = vec3( 0.0 );
- vec3 sheenSpecular = vec3( 0.0 );
- float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- float r2 = roughness * roughness;
- float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
- float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
- float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
- return saturate( DG * RECIPROCAL_PI );
- }
- vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
- const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
- vec4 r = roughness * c0 + c1;
- float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
- vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
- return fab;
- }
- vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- return specularColor * fab.x + specularF90 * fab.y;
- }
- #ifdef USE_IRIDESCENCE
- void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
- #else
- void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
- #endif
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- #ifdef USE_IRIDESCENCE
- vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
- #else
- vec3 Fr = specularColor;
- #endif
- vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
- float Ess = fab.x + fab.y;
- float Ems = 1.0 - Ess;
- vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
- singleScatter += FssEss;
- multiScatter += Fms * Ems;
- }
- #if NUM_RECT_AREA_LIGHTS > 0
- void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- vec3 normal = geometry.normal;
- vec3 viewDir = geometry.viewDir;
- vec3 position = geometry.position;
- vec3 lightPos = rectAreaLight.position;
- vec3 halfWidth = rectAreaLight.halfWidth;
- vec3 halfHeight = rectAreaLight.halfHeight;
- vec3 lightColor = rectAreaLight.color;
- float roughness = material.roughness;
- vec3 rectCoords[ 4 ];
- rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
- rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
- rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
- vec2 uv = LTC_Uv( normal, viewDir, roughness );
- vec4 t1 = texture2D( ltc_1, uv );
- vec4 t2 = texture2D( ltc_2, uv );
- mat3 mInv = mat3(
- vec3( t1.x, 0, t1.y ),
- vec3( 0, 1, 0 ),
- vec3( t1.z, 0, t1.w )
- );
- vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
- reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
- }
- #endif
- void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- #ifdef USE_CLEARCOAT
- float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
- vec3 ccIrradiance = dotNLcc * directLight.color;
- clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
- #endif
- #ifdef USE_SHEEN
- sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
- #endif
- #ifdef USE_IRIDESCENCE
- reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
- #else
- reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
- #endif
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
- #ifdef USE_CLEARCOAT
- clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
- #endif
- #ifdef USE_SHEEN
- sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
- #endif
- vec3 singleScattering = vec3( 0.0 );
- vec3 multiScattering = vec3( 0.0 );
- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
- #ifdef USE_IRIDESCENCE
- computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
- #else
- computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
- #endif
- vec3 totalScattering = singleScattering + multiScattering;
- vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
- reflectedLight.indirectSpecular += radiance * singleScattering;
- reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
- reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
- }
- #define RE_Direct RE_Direct_Physical
- #define RE_Direct_RectArea RE_Direct_RectArea_Physical
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
- #define RE_IndirectSpecular RE_IndirectSpecular_Physical
- float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
- return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
- }`,jk=`
- GeometricContext geometry;
- geometry.position = - vViewPosition;
- geometry.normal = normal;
- geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
- #ifdef USE_CLEARCOAT
- geometry.clearcoatNormal = clearcoatNormal;
- #endif
- #ifdef USE_IRIDESCENCE
- float dotNVi = saturate( dot( normal, geometry.viewDir ) );
- if ( material.iridescenceThickness == 0.0 ) {
- material.iridescence = 0.0;
- } else {
- material.iridescence = saturate( material.iridescence );
- }
- if ( material.iridescence > 0.0 ) {
- material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
- material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
- }
- #endif
- IncidentLight directLight;
- #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
- PointLight pointLight;
- #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
- pointLight = pointLights[ i ];
- getPointLightInfo( pointLight, geometry, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
- pointLightShadow = pointLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
- #endif
- RE_Direct( directLight, geometry, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
- SpotLight spotLight;
- vec4 spotColor;
- vec3 spotLightCoord;
- bool inSpotLightMap;
- #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
- spotLight = spotLights[ i ];
- getSpotLightInfo( spotLight, geometry, directLight );
- #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
- #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
- #else
- #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #endif
- #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
- spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
- inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
- spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
- directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
- #endif
- #undef SPOT_LIGHT_MAP_INDEX
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- spotLightShadow = spotLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometry, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
- DirectionalLight directionalLight;
- #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
- directionalLight = directionalLights[ i ];
- getDirectionalLightInfo( directionalLight, geometry, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
- directionalLightShadow = directionalLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometry, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
- RectAreaLight rectAreaLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
- rectAreaLight = rectAreaLights[ i ];
- RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if defined( RE_IndirectDiffuse )
- vec3 iblIrradiance = vec3( 0.0 );
- vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
- irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
- #if ( NUM_HEMI_LIGHTS > 0 )
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
- irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if defined( RE_IndirectSpecular )
- vec3 radiance = vec3( 0.0 );
- vec3 clearcoatRadiance = vec3( 0.0 );
- #endif`,Kk=`#if defined( RE_IndirectDiffuse )
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vUv2 );
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
- irradiance += lightMapIrradiance;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
- iblIrradiance += getIBLIrradiance( geometry.normal );
- #endif
- #endif
- #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
- radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
- #ifdef USE_CLEARCOAT
- clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
- #endif
- #endif`,$k=`#if defined( RE_IndirectDiffuse )
- RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
- #endif
- #if defined( RE_IndirectSpecular )
- RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
- #endif`,Zk=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
- gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
- #endif`,Xk=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
- uniform float logDepthBufFC;
- varying float vFragDepth;
- varying float vIsPerspective;
- #endif`,qk=`#ifdef USE_LOGDEPTHBUF
- #ifdef USE_LOGDEPTHBUF_EXT
- varying float vFragDepth;
- varying float vIsPerspective;
- #else
- uniform float logDepthBufFC;
- #endif
- #endif`,Yk=`#ifdef USE_LOGDEPTHBUF
- #ifdef USE_LOGDEPTHBUF_EXT
- vFragDepth = 1.0 + gl_Position.w;
- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
- #else
- if ( isPerspectiveMatrix( projectionMatrix ) ) {
- gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
- gl_Position.z *= gl_Position.w;
- }
- #endif
- #endif`,Jk=`#ifdef USE_MAP
- vec4 sampledDiffuseColor = texture2D( map, vUv );
- #ifdef DECODE_VIDEO_TEXTURE
- sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
- #endif
- diffuseColor *= sampledDiffuseColor;
- #endif`,e5=`#ifdef USE_MAP
- uniform sampler2D map;
- #endif`,t5=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
- #endif
- #ifdef USE_MAP
- diffuseColor *= texture2D( map, uv );
- #endif
- #ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, uv ).g;
- #endif`,i5=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- uniform mat3 uvTransform;
- #endif
- #ifdef USE_MAP
- uniform sampler2D map;
- #endif
- #ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,n5=`float metalnessFactor = metalness;
- #ifdef USE_METALNESSMAP
- vec4 texelMetalness = texture2D( metalnessMap, vUv );
- metalnessFactor *= texelMetalness.b;
- #endif`,r5=`#ifdef USE_METALNESSMAP
- uniform sampler2D metalnessMap;
- #endif`,s5=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
- vColor *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- #if defined( USE_COLOR_ALPHA )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
- #elif defined( USE_COLOR )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
- #endif
- }
- #endif`,o5=`#ifdef USE_MORPHNORMALS
- objectNormal *= morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
- }
- #else
- objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
- objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
- objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
- objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
- #endif
- #endif`,a5=`#ifdef USE_MORPHTARGETS
- uniform float morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
- uniform sampler2DArray morphTargetsTexture;
- uniform ivec2 morphTargetsTextureSize;
- vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
- int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
- int y = texelIndex / morphTargetsTextureSize.x;
- int x = texelIndex - y * morphTargetsTextureSize.x;
- ivec3 morphUV = ivec3( x, y, morphTargetIndex );
- return texelFetch( morphTargetsTexture, morphUV, 0 );
- }
- #else
- #ifndef USE_MORPHNORMALS
- uniform float morphTargetInfluences[ 8 ];
- #else
- uniform float morphTargetInfluences[ 4 ];
- #endif
- #endif
- #endif`,l5=`#ifdef USE_MORPHTARGETS
- transformed *= morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
- }
- #else
- transformed += morphTarget0 * morphTargetInfluences[ 0 ];
- transformed += morphTarget1 * morphTargetInfluences[ 1 ];
- transformed += morphTarget2 * morphTargetInfluences[ 2 ];
- transformed += morphTarget3 * morphTargetInfluences[ 3 ];
- #ifndef USE_MORPHNORMALS
- transformed += morphTarget4 * morphTargetInfluences[ 4 ];
- transformed += morphTarget5 * morphTargetInfluences[ 5 ];
- transformed += morphTarget6 * morphTargetInfluences[ 6 ];
- transformed += morphTarget7 * morphTargetInfluences[ 7 ];
- #endif
- #endif
- #endif`,c5=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
- #ifdef FLAT_SHADED
- vec3 fdx = dFdx( vViewPosition );
- vec3 fdy = dFdy( vViewPosition );
- vec3 normal = normalize( cross( fdx, fdy ) );
- #else
- vec3 normal = normalize( vNormal );
- #ifdef DOUBLE_SIDED
- normal = normal * faceDirection;
- #endif
- #ifdef USE_TANGENT
- vec3 tangent = normalize( vTangent );
- vec3 bitangent = normalize( vBitangent );
- #ifdef DOUBLE_SIDED
- tangent = tangent * faceDirection;
- bitangent = bitangent * faceDirection;
- #endif
- #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
- mat3 vTBN = mat3( tangent, bitangent, normal );
- #endif
- #endif
- #endif
- vec3 geometryNormal = normal;`,h5=`#ifdef OBJECTSPACE_NORMALMAP
- normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
- #ifdef FLIP_SIDED
- normal = - normal;
- #endif
- #ifdef DOUBLE_SIDED
- normal = normal * faceDirection;
- #endif
- normal = normalize( normalMatrix * normal );
- #elif defined( TANGENTSPACE_NORMALMAP )
- vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
- mapN.xy *= normalScale;
- #ifdef USE_TANGENT
- normal = normalize( vTBN * mapN );
- #else
- normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
- #endif
- #elif defined( USE_BUMPMAP )
- normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
- #endif`,u5=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,A5=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,d5=`#ifndef FLAT_SHADED
- vNormal = normalize( transformedNormal );
- #ifdef USE_TANGENT
- vTangent = normalize( transformedTangent );
- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
- #endif
- #endif`,p5=`#ifdef USE_NORMALMAP
- uniform sampler2D normalMap;
- uniform vec2 normalScale;
- #endif
- #ifdef OBJECTSPACE_NORMALMAP
- uniform mat3 normalMatrix;
- #endif
- #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
- vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
- vec3 q0 = dFdx( eye_pos.xyz );
- vec3 q1 = dFdy( eye_pos.xyz );
- vec2 st0 = dFdx( vUv.st );
- vec2 st1 = dFdy( vUv.st );
- vec3 N = surf_norm;
- vec3 q1perp = cross( q1, N );
- vec3 q0perp = cross( N, q0 );
- vec3 T = q1perp * st0.x + q0perp * st1.x;
- vec3 B = q1perp * st0.y + q0perp * st1.y;
- float det = max( dot( T, T ), dot( B, B ) );
- float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
- return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
- }
- #endif`,f5=`#ifdef USE_CLEARCOAT
- vec3 clearcoatNormal = geometryNormal;
- #endif`,m5=`#ifdef USE_CLEARCOAT_NORMALMAP
- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
- clearcoatMapN.xy *= clearcoatNormalScale;
- #ifdef USE_TANGENT
- clearcoatNormal = normalize( vTBN * clearcoatMapN );
- #else
- clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
- #endif
- #endif`,g5=`#ifdef USE_CLEARCOATMAP
- uniform sampler2D clearcoatMap;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform sampler2D clearcoatRoughnessMap;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform sampler2D clearcoatNormalMap;
- uniform vec2 clearcoatNormalScale;
- #endif`,_5=`#ifdef USE_IRIDESCENCEMAP
- uniform sampler2D iridescenceMap;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform sampler2D iridescenceThicknessMap;
- #endif`,y5=`#ifdef OPAQUE
- diffuseColor.a = 1.0;
- #endif
- #ifdef USE_TRANSMISSION
- diffuseColor.a *= material.transmissionAlpha + 0.1;
- #endif
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,x5=`vec3 packNormalToRGB( const in vec3 normal ) {
- return normalize( normal ) * 0.5 + 0.5;
- }
- vec3 unpackRGBToNormal( const in vec3 rgb ) {
- return 2.0 * rgb.xyz - 1.0;
- }
- const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
- const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
- const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
- const float ShiftRight8 = 1. / 256.;
- vec4 packDepthToRGBA( const in float v ) {
- vec4 r = vec4( fract( v * PackFactors ), v );
- r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
- }
- float unpackRGBAToDepth( const in vec4 v ) {
- return dot( v, UnpackFactors );
- }
- vec2 packDepthToRG( in highp float v ) {
- return packDepthToRGBA( v ).yx;
- }
- float unpackRGToDepth( const in highp vec2 v ) {
- return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
- }
- vec4 pack2HalfToRGBA( vec2 v ) {
- vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
- return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
- }
- vec2 unpackRGBATo2Half( vec4 v ) {
- return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
- }
- float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
- return ( viewZ + near ) / ( near - far );
- }
- float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
- return linearClipZ * ( near - far ) - near;
- }
- float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
- return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
- }
- float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
- return ( near * far ) / ( ( far - near ) * invClipZ - far );
- }`,v5=`#ifdef PREMULTIPLIED_ALPHA
- gl_FragColor.rgb *= gl_FragColor.a;
- #endif`,w5=`vec4 mvPosition = vec4( transformed, 1.0 );
- #ifdef USE_INSTANCING
- mvPosition = instanceMatrix * mvPosition;
- #endif
- mvPosition = modelViewMatrix * mvPosition;
- gl_Position = projectionMatrix * mvPosition;`,b5=`#ifdef DITHERING
- gl_FragColor.rgb = dithering( gl_FragColor.rgb );
- #endif`,B5=`#ifdef DITHERING
- vec3 dithering( vec3 color ) {
- float grid_position = rand( gl_FragCoord.xy );
- vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
- dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
- return color + dither_shift_RGB;
- }
- #endif`,C5=`float roughnessFactor = roughness;
- #ifdef USE_ROUGHNESSMAP
- vec4 texelRoughness = texture2D( roughnessMap, vUv );
- roughnessFactor *= texelRoughness.g;
- #endif`,E5=`#ifdef USE_ROUGHNESSMAP
- uniform sampler2D roughnessMap;
- #endif`,T5=`#if NUM_SPOT_LIGHT_COORDS > 0
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #if NUM_SPOT_LIGHT_MAPS > 0
- uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
- struct SpotLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
- return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
- }
- vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
- return unpackRGBATo2Half( texture2D( shadow, uv ) );
- }
- float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
- float occlusion = 1.0;
- vec2 distribution = texture2DDistribution( shadow, uv );
- float hard_shadow = step( compare , distribution.x );
- if (hard_shadow != 1.0 ) {
- float distance = compare - distribution.x ;
- float variance = max( 0.00000, distribution.y * distribution.y );
- float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
- }
- return occlusion;
- }
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
- float shadow = 1.0;
- shadowCoord.xyz /= shadowCoord.w;
- shadowCoord.z += shadowBias;
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
- if ( frustumTest ) {
- #if defined( SHADOWMAP_TYPE_PCF )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx0 = - texelSize.x * shadowRadius;
- float dy0 = - texelSize.y * shadowRadius;
- float dx1 = + texelSize.x * shadowRadius;
- float dy1 = + texelSize.y * shadowRadius;
- float dx2 = dx0 / 2.0;
- float dy2 = dy0 / 2.0;
- float dx3 = dx1 / 2.0;
- float dy3 = dy1 / 2.0;
- shadow = (
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
- ) * ( 1.0 / 17.0 );
- #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx = texelSize.x;
- float dy = texelSize.y;
- vec2 uv = shadowCoord.xy;
- vec2 f = fract( uv * shadowMapSize + 0.5 );
- uv -= f * texelSize;
- shadow = (
- texture2DCompare( shadowMap, uv, shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
- f.x ),
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
- f.x ),
- f.y )
- ) * ( 1.0 / 9.0 );
- #elif defined( SHADOWMAP_TYPE_VSM )
- shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
- #else
- shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
- #endif
- }
- return shadow;
- }
- vec2 cubeToUV( vec3 v, float texelSizeY ) {
- vec3 absV = abs( v );
- float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
- absV *= scaleToCube;
- v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
- vec2 planar = v.xy;
- float almostATexel = 1.5 * texelSizeY;
- float almostOne = 1.0 - almostATexel;
- if ( absV.z >= almostOne ) {
- if ( v.z > 0.0 )
- planar.x = 4.0 - v.x;
- } else if ( absV.x >= almostOne ) {
- float signX = sign( v.x );
- planar.x = v.z * signX + 2.0 * signX;
- } else if ( absV.y >= almostOne ) {
- float signY = sign( v.y );
- planar.x = v.x + 2.0 * signY + 2.0;
- planar.y = v.z * signY - 2.0;
- }
- return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
- }
- float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
- vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
- vec3 lightToPosition = shadowCoord.xyz;
- float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
- vec3 bd3D = normalize( lightToPosition );
- #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
- vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
- return (
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
- ) * ( 1.0 / 9.0 );
- #else
- return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
- #endif
- }
- #endif`,S5=`#if NUM_SPOT_LIGHT_COORDS > 0
- uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- struct SpotLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- #endif`,M5=`#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
- #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
- vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- vec4 shadowWorldPosition;
- #endif
- #if NUM_DIR_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
- vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_SPOT_LIGHT_COORDS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
- shadowWorldPosition = worldPosition;
- #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
- #endif
- vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
- vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #endif`,I5=`float getShadowMask() {
- float shadow = 1.0;
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- directionalLight = directionalLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
- spotLight = spotLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- pointLight = pointLightShadows[ i ];
- shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- return shadow;
- }`,F5=`#ifdef USE_SKINNING
- mat4 boneMatX = getBoneMatrix( skinIndex.x );
- mat4 boneMatY = getBoneMatrix( skinIndex.y );
- mat4 boneMatZ = getBoneMatrix( skinIndex.z );
- mat4 boneMatW = getBoneMatrix( skinIndex.w );
- #endif`,L5=`#ifdef USE_SKINNING
- uniform mat4 bindMatrix;
- uniform mat4 bindMatrixInverse;
- uniform highp sampler2D boneTexture;
- uniform int boneTextureSize;
- mat4 getBoneMatrix( const in float i ) {
- float j = i * 4.0;
- float x = mod( j, float( boneTextureSize ) );
- float y = floor( j / float( boneTextureSize ) );
- float dx = 1.0 / float( boneTextureSize );
- float dy = 1.0 / float( boneTextureSize );
- y = dy * ( y + 0.5 );
- vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
- vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
- vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
- vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
- mat4 bone = mat4( v1, v2, v3, v4 );
- return bone;
- }
- #endif`,D5=`#ifdef USE_SKINNING
- vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
- vec4 skinned = vec4( 0.0 );
- skinned += boneMatX * skinVertex * skinWeight.x;
- skinned += boneMatY * skinVertex * skinWeight.y;
- skinned += boneMatZ * skinVertex * skinWeight.z;
- skinned += boneMatW * skinVertex * skinWeight.w;
- transformed = ( bindMatrixInverse * skinned ).xyz;
- #endif`,P5=`#ifdef USE_SKINNING
- mat4 skinMatrix = mat4( 0.0 );
- skinMatrix += skinWeight.x * boneMatX;
- skinMatrix += skinWeight.y * boneMatY;
- skinMatrix += skinWeight.z * boneMatZ;
- skinMatrix += skinWeight.w * boneMatW;
- skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
- objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
- #ifdef USE_TANGENT
- objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
- #endif
- #endif`,U5=`float specularStrength;
- #ifdef USE_SPECULARMAP
- vec4 texelSpecular = texture2D( specularMap, vUv );
- specularStrength = texelSpecular.r;
- #else
- specularStrength = 1.0;
- #endif`,R5=`#ifdef USE_SPECULARMAP
- uniform sampler2D specularMap;
- #endif`,z5=`#if defined( TONE_MAPPING )
- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
- #endif`,k5=`#ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- uniform float toneMappingExposure;
- vec3 LinearToneMapping( vec3 color ) {
- return toneMappingExposure * color;
- }
- vec3 ReinhardToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- return saturate( color / ( vec3( 1.0 ) + color ) );
- }
- vec3 OptimizedCineonToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- color = max( vec3( 0.0 ), color - 0.004 );
- return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
- }
- vec3 RRTAndODTFit( vec3 v ) {
- vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
- vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
- return a / b;
- }
- vec3 ACESFilmicToneMapping( vec3 color ) {
- const mat3 ACESInputMat = mat3(
- vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
- vec3( 0.04823, 0.01566, 0.83777 )
- );
- const mat3 ACESOutputMat = mat3(
- vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
- vec3( -0.07367, -0.00605, 1.07602 )
- );
- color *= toneMappingExposure / 0.6;
- color = ACESInputMat * color;
- color = RRTAndODTFit( color );
- color = ACESOutputMat * color;
- return saturate( color );
- }
- vec3 CustomToneMapping( vec3 color ) { return color; }`,O5=`#ifdef USE_TRANSMISSION
- material.transmission = transmission;
- material.transmissionAlpha = 1.0;
- material.thickness = thickness;
- material.attenuationDistance = attenuationDistance;
- material.attenuationColor = attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- material.transmission *= texture2D( transmissionMap, vUv ).r;
- #endif
- #ifdef USE_THICKNESSMAP
- material.thickness *= texture2D( thicknessMap, vUv ).g;
- #endif
- vec3 pos = vWorldPosition;
- vec3 v = normalize( cameraPosition - pos );
- vec3 n = inverseTransformDirection( normal, viewMatrix );
- vec4 transmission = getIBLVolumeRefraction(
- n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
- pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
- material.attenuationColor, material.attenuationDistance );
- material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );
- totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
- #endif`,N5=`#ifdef USE_TRANSMISSION
- uniform float transmission;
- uniform float thickness;
- uniform float attenuationDistance;
- uniform vec3 attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- uniform sampler2D transmissionMap;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform sampler2D thicknessMap;
- #endif
- uniform vec2 transmissionSamplerSize;
- uniform sampler2D transmissionSamplerMap;
- uniform mat4 modelMatrix;
- uniform mat4 projectionMatrix;
- varying vec3 vWorldPosition;
- vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
- vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
- vec3 modelScale;
- modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
- modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
- modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
- return normalize( refractionVector ) * thickness * modelScale;
- }
- float applyIorToRoughness( const in float roughness, const in float ior ) {
- return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
- }
- vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
- float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
- #ifdef texture2DLodEXT
- return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
- #else
- return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
- #endif
- }
- vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
- if ( isinf( attenuationDistance ) ) {
- return radiance;
- } else {
- vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
- vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;
- }
- }
- vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
- const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
- const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
- const in vec3 attenuationColor, const in float attenuationDistance ) {
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
- vec3 refractedRayExit = position + transmissionRay;
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
- refractionCoords += 1.0;
- refractionCoords /= 2.0;
- vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
- vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
- vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
- return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
- }
- #endif`,Q5=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
- varying vec2 vUv;
- #endif`,V5=`#ifdef USE_UV
- #ifdef UVS_VERTEX_ONLY
- vec2 vUv;
- #else
- varying vec2 vUv;
- #endif
- uniform mat3 uvTransform;
- #endif`,H5=`#ifdef USE_UV
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- #endif`,G5=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
- varying vec2 vUv2;
- #endif`,W5=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
- attribute vec2 uv2;
- varying vec2 vUv2;
- uniform mat3 uv2Transform;
- #endif`,j5=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
- vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
- #endif`,K5=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
- vec4 worldPosition = vec4( transformed, 1.0 );
- #ifdef USE_INSTANCING
- worldPosition = instanceMatrix * worldPosition;
- #endif
- worldPosition = modelMatrix * worldPosition;
- #endif`;const $5=`varying vec2 vUv;
- uniform mat3 uvTransform;
- void main() {
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- gl_Position = vec4( position.xy, 1.0, 1.0 );
- }`,Z5=`uniform sampler2D t2D;
- uniform float backgroundIntensity;
- varying vec2 vUv;
- void main() {
- vec4 texColor = texture2D( t2D, vUv );
- #ifdef DECODE_VIDEO_TEXTURE
- texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- }`,X5=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,q5=`#ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- uniform sampler2D envMap;
- #endif
- uniform float flipEnvMap;
- uniform float backgroundBlurriness;
- uniform float backgroundIntensity;
- varying vec3 vWorldDirection;
- #include <cube_uv_reflection_fragment>
- void main() {
- #ifdef ENVMAP_TYPE_CUBE
- vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
- #else
- vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- }`,Y5=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,J5=`uniform samplerCube tCube;
- uniform float tFlip;
- uniform float opacity;
- varying vec3 vWorldDirection;
- void main() {
- vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
- gl_FragColor = texColor;
- gl_FragColor.a *= opacity;
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- }`,eO=`#include <common>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- varying vec2 vHighPrecisionZW;
- void main() {
- #include <uv_vertex>
- #include <skinbase_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vHighPrecisionZW = gl_Position.zw;
- }`,tO=`#if DEPTH_PACKING == 3200
- uniform float opacity;
- #endif
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- varying vec2 vHighPrecisionZW;
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( 1.0 );
- #if DEPTH_PACKING == 3200
- diffuseColor.a = opacity;
- #endif
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <logdepthbuf_fragment>
- float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
- #if DEPTH_PACKING == 3200
- gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
- #elif DEPTH_PACKING == 3201
- gl_FragColor = packDepthToRGBA( fragCoordZ );
- #endif
- }`,iO=`#define DISTANCE
- varying vec3 vWorldPosition;
- #include <common>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <skinbase_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <worldpos_vertex>
- #include <clipping_planes_vertex>
- vWorldPosition = worldPosition.xyz;
- }`,nO=`#define DISTANCE
- uniform vec3 referencePosition;
- uniform float nearDistance;
- uniform float farDistance;
- varying vec3 vWorldPosition;
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main () {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( 1.0 );
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- float dist = length( vWorldPosition - referencePosition );
- dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
- dist = saturate( dist );
- gl_FragColor = packDepthToRGBA( dist );
- }`,rO=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }`,sO=`uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- }`,oO=`uniform float scale;
- attribute float lineDistance;
- varying float vLineDistance;
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- vLineDistance = scale * lineDistance;
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,aO=`uniform vec3 diffuse;
- uniform float opacity;
- uniform float dashSize;
- uniform float totalSize;
- varying float vLineDistance;
- #include <common>
- #include <color_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- if ( mod( vLineDistance, totalSize ) > dashSize ) {
- discard;
- }
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <color_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,lO=`#include <common>
- #include <uv_pars_vertex>
- #include <uv2_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <uv2_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <fog_vertex>
- }`,cO=`uniform vec3 diffuse;
- uniform float opacity;
- #ifndef FLAT_SHADED
- varying vec3 vNormal;
- #endif
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <uv2_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <specularmap_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vUv2 );
- reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
- #else
- reflectedLight.indirectDiffuse += vec3( 1.0 );
- #endif
- #include <aomap_fragment>
- reflectedLight.indirectDiffuse *= diffuseColor.rgb;
- vec3 outgoingLight = reflectedLight.indirectDiffuse;
- #include <envmap_fragment>
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,hO=`#define LAMBERT
- varying vec3 vViewPosition;
- #include <common>
- #include <uv_pars_vertex>
- #include <uv2_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <uv2_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,uO=`#define LAMBERT
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <uv2_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_lambert_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_lambert_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,AO=`#define MATCAP
- varying vec3 vViewPosition;
- #include <common>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- vViewPosition = - mvPosition.xyz;
- }`,dO=`#define MATCAP
- uniform vec3 diffuse;
- uniform float opacity;
- uniform sampler2D matcap;
- varying vec3 vViewPosition;
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <fog_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- vec3 viewDir = normalize( vViewPosition );
- vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
- vec3 y = cross( viewDir, x );
- vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
- #ifdef USE_MATCAP
- vec4 matcapColor = texture2D( matcap, uv );
- #else
- vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
- #endif
- vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,pO=`#define NORMAL
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
- varying vec3 vViewPosition;
- #endif
- #include <common>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
- vViewPosition = - mvPosition.xyz;
- #endif
- }`,fO=`#define NORMAL
- uniform float opacity;
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
- varying vec3 vViewPosition;
- #endif
- #include <packing>
- #include <uv_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
- #ifdef OPAQUE
- gl_FragColor.a = 1.0;
- #endif
- }`,mO=`#define PHONG
- varying vec3 vViewPosition;
- #include <common>
- #include <uv_pars_vertex>
- #include <uv2_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <uv2_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,gO=`#define PHONG
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform vec3 specular;
- uniform float shininess;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <uv2_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_phong_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_phong_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,_O=`#define STANDARD
- varying vec3 vViewPosition;
- #ifdef USE_TRANSMISSION
- varying vec3 vWorldPosition;
- #endif
- #include <common>
- #include <uv_pars_vertex>
- #include <uv2_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <uv2_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- #ifdef USE_TRANSMISSION
- vWorldPosition = worldPosition.xyz;
- #endif
- }`,yO=`#define STANDARD
- #ifdef PHYSICAL
- #define IOR
- #define SPECULAR
- #endif
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float roughness;
- uniform float metalness;
- uniform float opacity;
- #ifdef IOR
- uniform float ior;
- #endif
- #ifdef SPECULAR
- uniform float specularIntensity;
- uniform vec3 specularColor;
- #ifdef USE_SPECULARINTENSITYMAP
- uniform sampler2D specularIntensityMap;
- #endif
- #ifdef USE_SPECULARCOLORMAP
- uniform sampler2D specularColorMap;
- #endif
- #endif
- #ifdef USE_CLEARCOAT
- uniform float clearcoat;
- uniform float clearcoatRoughness;
- #endif
- #ifdef USE_IRIDESCENCE
- uniform float iridescence;
- uniform float iridescenceIOR;
- uniform float iridescenceThicknessMinimum;
- uniform float iridescenceThicknessMaximum;
- #endif
- #ifdef USE_SHEEN
- uniform vec3 sheenColor;
- uniform float sheenRoughness;
- #ifdef USE_SHEENCOLORMAP
- uniform sampler2D sheenColorMap;
- #endif
- #ifdef USE_SHEENROUGHNESSMAP
- uniform sampler2D sheenRoughnessMap;
- #endif
- #endif
- varying vec3 vViewPosition;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <uv2_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <bsdfs>
- #include <iridescence_fragment>
- #include <cube_uv_reflection_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_physical_pars_fragment>
- #include <fog_pars_fragment>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_physical_pars_fragment>
- #include <transmission_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <clearcoat_pars_fragment>
- #include <iridescence_pars_fragment>
- #include <roughnessmap_pars_fragment>
- #include <metalnessmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <roughnessmap_fragment>
- #include <metalnessmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <clearcoat_normal_fragment_begin>
- #include <clearcoat_normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_physical_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
- vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
- #include <transmission_fragment>
- vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
- #ifdef USE_SHEEN
- float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
- outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
- #endif
- #ifdef USE_CLEARCOAT
- float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
- vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
- outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
- #endif
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,xO=`#define TOON
- varying vec3 vViewPosition;
- #include <common>
- #include <uv_pars_vertex>
- #include <uv2_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <uv2_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,vO=`#define TOON
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <uv2_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <gradientmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_toon_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_toon_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,wO=`uniform float size;
- uniform float scale;
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- gl_PointSize = size;
- #ifdef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
- #endif
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <fog_vertex>
- }`,bO=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <color_pars_fragment>
- #include <map_particle_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_particle_fragment>
- #include <color_fragment>
- #include <alphatest_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,BO=`#include <common>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- void main() {
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,CO=`uniform vec3 color;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <shadowmap_pars_fragment>
- #include <shadowmask_pars_fragment>
- void main() {
- gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- }`,EO=`uniform float rotation;
- uniform vec2 center;
- #include <common>
- #include <uv_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
- vec2 scale;
- scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
- scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
- #ifndef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) scale *= - mvPosition.z;
- #endif
- vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
- vec2 rotatedPosition;
- rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
- rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
- mvPosition.xy += rotatedPosition;
- gl_Position = projectionMatrix * mvPosition;
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,TO=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <output_fragment>
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- }`,zr={alphamap_fragment:Xz,alphamap_pars_fragment:qz,alphatest_fragment:Yz,alphatest_pars_fragment:Jz,aomap_fragment:ek,aomap_pars_fragment:tk,begin_vertex:ik,beginnormal_vertex:nk,bsdfs:rk,iridescence_fragment:sk,bumpmap_pars_fragment:ok,clipping_planes_fragment:ak,clipping_planes_pars_fragment:lk,clipping_planes_pars_vertex:ck,clipping_planes_vertex:hk,color_fragment:uk,color_pars_fragment:Ak,color_pars_vertex:dk,color_vertex:pk,common:fk,cube_uv_reflection_fragment:mk,defaultnormal_vertex:gk,displacementmap_pars_vertex:_k,displacementmap_vertex:yk,emissivemap_fragment:xk,emissivemap_pars_fragment:vk,encodings_fragment:wk,encodings_pars_fragment:bk,envmap_fragment:Bk,envmap_common_pars_fragment:Ck,envmap_pars_fragment:Ek,envmap_pars_vertex:Tk,envmap_physical_pars_fragment:Ok,envmap_vertex:Sk,fog_vertex:Mk,fog_pars_vertex:Ik,fog_fragment:Fk,fog_pars_fragment:Lk,gradientmap_pars_fragment:Dk,lightmap_fragment:Pk,lightmap_pars_fragment:Uk,lights_lambert_fragment:Rk,lights_lambert_pars_fragment:zk,lights_pars_begin:kk,lights_toon_fragment:Nk,lights_toon_pars_fragment:Qk,lights_phong_fragment:Vk,lights_phong_pars_fragment:Hk,lights_physical_fragment:Gk,lights_physical_pars_fragment:Wk,lights_fragment_begin:jk,lights_fragment_maps:Kk,lights_fragment_end:$k,logdepthbuf_fragment:Zk,logdepthbuf_pars_fragment:Xk,logdepthbuf_pars_vertex:qk,logdepthbuf_vertex:Yk,map_fragment:Jk,map_pars_fragment:e5,map_particle_fragment:t5,map_particle_pars_fragment:i5,metalnessmap_fragment:n5,metalnessmap_pars_fragment:r5,morphcolor_vertex:s5,morphnormal_vertex:o5,morphtarget_pars_vertex:a5,morphtarget_vertex:l5,normal_fragment_begin:c5,normal_fragment_maps:h5,normal_pars_fragment:u5,normal_pars_vertex:A5,normal_vertex:d5,normalmap_pars_fragment:p5,clearcoat_normal_fragment_begin:f5,clearcoat_normal_fragment_maps:m5,clearcoat_pars_fragment:g5,iridescence_pars_fragment:_5,output_fragment:y5,packing:x5,premultiplied_alpha_fragment:v5,project_vertex:w5,dithering_fragment:b5,dithering_pars_fragment:B5,roughnessmap_fragment:C5,roughnessmap_pars_fragment:E5,shadowmap_pars_fragment:T5,shadowmap_pars_vertex:S5,shadowmap_vertex:M5,shadowmask_pars_fragment:I5,skinbase_vertex:F5,skinning_pars_vertex:L5,skinning_vertex:D5,skinnormal_vertex:P5,specularmap_fragment:U5,specularmap_pars_fragment:R5,tonemapping_fragment:z5,tonemapping_pars_fragment:k5,transmission_fragment:O5,transmission_pars_fragment:N5,uv_pars_fragment:Q5,uv_pars_vertex:V5,uv_vertex:H5,uv2_pars_fragment:G5,uv2_pars_vertex:W5,uv2_vertex:j5,worldpos_vertex:K5,background_vert:$5,background_frag:Z5,backgroundCube_vert:X5,backgroundCube_frag:q5,cube_vert:Y5,cube_frag:J5,depth_vert:eO,depth_frag:tO,distanceRGBA_vert:iO,distanceRGBA_frag:nO,equirect_vert:rO,equirect_frag:sO,linedashed_vert:oO,linedashed_frag:aO,meshbasic_vert:lO,meshbasic_frag:cO,meshlambert_vert:hO,meshlambert_frag:uO,meshmatcap_vert:AO,meshmatcap_frag:dO,meshnormal_vert:pO,meshnormal_frag:fO,meshphong_vert:mO,meshphong_frag:gO,meshphysical_vert:_O,meshphysical_frag:yO,meshtoon_vert:xO,meshtoon_frag:vO,points_vert:wO,points_frag:bO,shadow_vert:BO,shadow_frag:CO,sprite_vert:EO,sprite_frag:TO},En={common:{diffuse:{value:new Dn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Pl},uv2Transform:{value:new Pl},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Di(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Dn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Dn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Pl}},sprite:{diffuse:{value:new Dn(16777215)},opacity:{value:1},center:{value:new Di(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Pl}}},Fl={basic:{uniforms:Sl([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.fog]),vertexShader:zr.meshbasic_vert,fragmentShader:zr.meshbasic_frag},lambert:{uniforms:Sl([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.fog,En.lights,{emissive:{value:new Dn(0)}}]),vertexShader:zr.meshlambert_vert,fragmentShader:zr.meshlambert_frag},phong:{uniforms:Sl([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.fog,En.lights,{emissive:{value:new Dn(0)},specular:{value:new Dn(1118481)},shininess:{value:30}}]),vertexShader:zr.meshphong_vert,fragmentShader:zr.meshphong_frag},standard:{uniforms:Sl([En.common,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.roughnessmap,En.metalnessmap,En.fog,En.lights,{emissive:{value:new Dn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:zr.meshphysical_vert,fragmentShader:zr.meshphysical_frag},toon:{uniforms:Sl([En.common,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.gradientmap,En.fog,En.lights,{emissive:{value:new Dn(0)}}]),vertexShader:zr.meshtoon_vert,fragmentShader:zr.meshtoon_frag},matcap:{uniforms:Sl([En.common,En.bumpmap,En.normalmap,En.displacementmap,En.fog,{matcap:{value:null}}]),vertexShader:zr.meshmatcap_vert,fragmentShader:zr.meshmatcap_frag},points:{uniforms:Sl([En.points,En.fog]),vertexShader:zr.points_vert,fragmentShader:zr.points_frag},dashed:{uniforms:Sl([En.common,En.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:zr.linedashed_vert,fragmentShader:zr.linedashed_frag},depth:{uniforms:Sl([En.common,En.displacementmap]),vertexShader:zr.depth_vert,fragmentShader:zr.depth_frag},normal:{uniforms:Sl([En.common,En.bumpmap,En.normalmap,En.displacementmap,{opacity:{value:1}}]),vertexShader:zr.meshnormal_vert,fragmentShader:zr.meshnormal_frag},sprite:{uniforms:Sl([En.sprite,En.fog]),vertexShader:zr.sprite_vert,fragmentShader:zr.sprite_frag},background:{uniforms:{uvTransform:{value:new Pl},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:zr.background_vert,fragmentShader:zr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:zr.backgroundCube_vert,fragmentShader:zr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:zr.cube_vert,fragmentShader:zr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:zr.equirect_vert,fragmentShader:zr.equirect_frag},distanceRGBA:{uniforms:Sl([En.common,En.displacementmap,{referencePosition:{value:new ft},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:zr.distanceRGBA_vert,fragmentShader:zr.distanceRGBA_frag},shadow:{uniforms:Sl([En.lights,En.fog,{color:{value:new Dn(0)},opacity:{value:1}}]),vertexShader:zr.shadow_vert,fragmentShader:zr.shadow_frag}};Fl.physical={uniforms:Sl([Fl.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Di(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Dn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Di},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Dn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Dn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:zr.meshphysical_vert,fragmentShader:zr.meshphysical_frag};const px={r:0,b:0,g:0};function SO(u,e,t,r,c,p,y){const i=new Dn(0);let C=p===!0?0:1,D,U,N=null,R=0,G=null;function J(B,ae){let le=!1,Ae=ae.isScene===!0?ae.background:null;Ae&&Ae.isTexture&&(Ae=(ae.backgroundBlurriness>0?t:e).get(Ae));const we=u.xr,me=we.getSession&&we.getSession();me&&me.environmentBlendMode==="additive"&&(Ae=null),Ae===null?Y(i,C):Ae&&Ae.isColor&&(Y(Ae,1),le=!0),(u.autoClear||le)&&u.clear(u.autoClearColor,u.autoClearDepth,u.autoClearStencil),Ae&&(Ae.isCubeTexture||Ae.mapping===qm)?(U===void 0&&(U=new is(new YA(1,1,1),new ko({name:"BackgroundCubeMaterial",uniforms:jm(Fl.backgroundCube.uniforms),vertexShader:Fl.backgroundCube.vertexShader,fragmentShader:Fl.backgroundCube.fragmentShader,side:Dc,depthTest:!1,depthWrite:!1,fog:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(Pe,it,Me){this.matrixWorld.copyPosition(Me.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),c.update(U)),U.material.uniforms.envMap.value=Ae,U.material.uniforms.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1,U.material.uniforms.backgroundBlurriness.value=ae.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=ae.backgroundIntensity,U.material.toneMapped=Ae.encoding!==Ss,(N!==Ae||R!==Ae.version||G!==u.toneMapping)&&(U.material.needsUpdate=!0,N=Ae,R=Ae.version,G=u.toneMapping),U.layers.enableAll(),B.unshift(U,U.geometry,U.material,0,0,null)):Ae&&Ae.isTexture&&(D===void 0&&(D=new is(new $A(2,2),new ko({name:"BackgroundMaterial",uniforms:jm(Fl.background.uniforms),vertexShader:Fl.background.vertexShader,fragmentShader:Fl.background.fragmentShader,side:ju,depthTest:!1,depthWrite:!1,fog:!1})),D.geometry.deleteAttribute("normal"),Object.defineProperty(D.material,"map",{get:function(){return this.uniforms.t2D.value}}),c.update(D)),D.material.uniforms.t2D.value=Ae,D.material.uniforms.backgroundIntensity.value=ae.backgroundIntensity,D.material.toneMapped=Ae.encoding!==Ss,Ae.matrixAutoUpdate===!0&&Ae.updateMatrix(),D.material.uniforms.uvTransform.value.copy(Ae.matrix),(N!==Ae||R!==Ae.version||G!==u.toneMapping)&&(D.material.needsUpdate=!0,N=Ae,R=Ae.version,G=u.toneMapping),D.layers.enableAll(),B.unshift(D,D.geometry,D.material,0,0,null))}function Y(B,ae){B.getRGB(px,UI(u)),r.buffers.color.setClear(px.r,px.g,px.b,ae,y)}return{getClearColor:function(){return i},setClearColor:function(B,ae=1){i.set(B),C=ae,Y(i,C)},getClearAlpha:function(){return C},setClearAlpha:function(B){C=B,Y(i,C)},render:J}}function MO(u,e,t,r){const c=u.getParameter(34921),p=r.isWebGL2?null:e.get("OES_vertex_array_object"),y=r.isWebGL2||p!==null,i={},C=B(null);let D=C,U=!1;function N(ce,ye,xe,ze,Ne){let Ge=!1;if(y){const Ve=Y(ze,xe,ye);D!==Ve&&(D=Ve,G(D.object)),Ge=ae(ce,ze,xe,Ne),Ge&&le(ce,ze,xe,Ne)}else{const Ve=ye.wireframe===!0;(D.geometry!==ze.id||D.program!==xe.id||D.wireframe!==Ve)&&(D.geometry=ze.id,D.program=xe.id,D.wireframe=Ve,Ge=!0)}Ne!==null&&t.update(Ne,34963),(Ge||U)&&(U=!1,Me(ce,ye,xe,ze),Ne!==null&&u.bindBuffer(34963,t.get(Ne).buffer))}function R(){return r.isWebGL2?u.createVertexArray():p.createVertexArrayOES()}function G(ce){return r.isWebGL2?u.bindVertexArray(ce):p.bindVertexArrayOES(ce)}function J(ce){return r.isWebGL2?u.deleteVertexArray(ce):p.deleteVertexArrayOES(ce)}function Y(ce,ye,xe){const ze=xe.wireframe===!0;let Ne=i[ce.id];Ne===void 0&&(Ne={},i[ce.id]=Ne);let Ge=Ne[ye.id];Ge===void 0&&(Ge={},Ne[ye.id]=Ge);let Ve=Ge[ze];return Ve===void 0&&(Ve=B(R()),Ge[ze]=Ve),Ve}function B(ce){const ye=[],xe=[],ze=[];for(let Ne=0;Ne<c;Ne++)ye[Ne]=0,xe[Ne]=0,ze[Ne]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:ye,enabledAttributes:xe,attributeDivisors:ze,object:ce,attributes:{},index:null}}function ae(ce,ye,xe,ze){const Ne=D.attributes,Ge=ye.attributes;let Ve=0;const Le=xe.getAttributes();for(const Ie in Le)if(Le[Ie].location>=0){const et=Ne[Ie];let vt=Ge[Ie];if(vt===void 0&&(Ie==="instanceMatrix"&&ce.instanceMatrix&&(vt=ce.instanceMatrix),Ie==="instanceColor"&&ce.instanceColor&&(vt=ce.instanceColor)),et===void 0||et.attribute!==vt||vt&&et.data!==vt.data)return!0;Ve++}return D.attributesNum!==Ve||D.index!==ze}function le(ce,ye,xe,ze){const Ne={},Ge=ye.attributes;let Ve=0;const Le=xe.getAttributes();for(const Ie in Le)if(Le[Ie].location>=0){let et=Ge[Ie];et===void 0&&(Ie==="instanceMatrix"&&ce.instanceMatrix&&(et=ce.instanceMatrix),Ie==="instanceColor"&&ce.instanceColor&&(et=ce.instanceColor));const vt={};vt.attribute=et,et&&et.data&&(vt.data=et.data),Ne[Ie]=vt,Ve++}D.attributes=Ne,D.attributesNum=Ve,D.index=ze}function Ae(){const ce=D.newAttributes;for(let ye=0,xe=ce.length;ye<xe;ye++)ce[ye]=0}function we(ce){me(ce,0)}function me(ce,ye){const xe=D.newAttributes,ze=D.enabledAttributes,Ne=D.attributeDivisors;xe[ce]=1,ze[ce]===0&&(u.enableVertexAttribArray(ce),ze[ce]=1),Ne[ce]!==ye&&((r.isWebGL2?u:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](ce,ye),Ne[ce]=ye)}function Pe(){const ce=D.newAttributes,ye=D.enabledAttributes;for(let xe=0,ze=ye.length;xe<ze;xe++)ye[xe]!==ce[xe]&&(u.disableVertexAttribArray(xe),ye[xe]=0)}function it(ce,ye,xe,ze,Ne,Ge){r.isWebGL2===!0&&(xe===5124||xe===5125)?u.vertexAttribIPointer(ce,ye,xe,Ne,Ge):u.vertexAttribPointer(ce,ye,xe,ze,Ne,Ge)}function Me(ce,ye,xe,ze){if(r.isWebGL2===!1&&(ce.isInstancedMesh||ze.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;Ae();const Ne=ze.attributes,Ge=xe.getAttributes(),Ve=ye.defaultAttributeValues;for(const Le in Ge){const Ie=Ge[Le];if(Ie.location>=0){let qe=Ne[Le];if(qe===void 0&&(Le==="instanceMatrix"&&ce.instanceMatrix&&(qe=ce.instanceMatrix),Le==="instanceColor"&&ce.instanceColor&&(qe=ce.instanceColor)),qe!==void 0){const et=qe.normalized,vt=qe.itemSize,Be=t.get(qe);if(Be===void 0)continue;const dt=Be.buffer,ut=Be.type,Qt=Be.bytesPerElement;if(qe.isInterleavedBufferAttribute){const Wt=qe.data,Nt=Wt.stride,Ct=qe.offset;if(Wt.isInstancedInterleavedBuffer){for(let Ft=0;Ft<Ie.locationSize;Ft++)me(Ie.location+Ft,Wt.meshPerAttribute);ce.isInstancedMesh!==!0&&ze._maxInstanceCount===void 0&&(ze._maxInstanceCount=Wt.meshPerAttribute*Wt.count)}else for(let Ft=0;Ft<Ie.locationSize;Ft++)we(Ie.location+Ft);u.bindBuffer(34962,dt);for(let Ft=0;Ft<Ie.locationSize;Ft++)it(Ie.location+Ft,vt/Ie.locationSize,ut,et,Nt*Qt,(Ct+vt/Ie.locationSize*Ft)*Qt)}else{if(qe.isInstancedBufferAttribute){for(let Wt=0;Wt<Ie.locationSize;Wt++)me(Ie.location+Wt,qe.meshPerAttribute);ce.isInstancedMesh!==!0&&ze._maxInstanceCount===void 0&&(ze._maxInstanceCount=qe.meshPerAttribute*qe.count)}else for(let Wt=0;Wt<Ie.locationSize;Wt++)we(Ie.location+Wt);u.bindBuffer(34962,dt);for(let Wt=0;Wt<Ie.locationSize;Wt++)it(Ie.location+Wt,vt/Ie.locationSize,ut,et,vt*Qt,vt/Ie.locationSize*Wt*Qt)}}else if(Ve!==void 0){const et=Ve[Le];if(et!==void 0)switch(et.length){case 2:u.vertexAttrib2fv(Ie.location,et);break;case 3:u.vertexAttrib3fv(Ie.location,et);break;case 4:u.vertexAttrib4fv(Ie.location,et);break;default:u.vertexAttrib1fv(Ie.location,et)}}}}Pe()}function Ke(){Ci();for(const ce in i){const ye=i[ce];for(const xe in ye){const ze=ye[xe];for(const Ne in ze)J(ze[Ne].object),delete ze[Ne];delete ye[xe]}delete i[ce]}}function Et(ce){if(i[ce.id]===void 0)return;const ye=i[ce.id];for(const xe in ye){const ze=ye[xe];for(const Ne in ze)J(ze[Ne].object),delete ze[Ne];delete ye[xe]}delete i[ce.id]}function oi(ce){for(const ye in i){const xe=i[ye];if(xe[ce.id]===void 0)continue;const ze=xe[ce.id];for(const Ne in ze)J(ze[Ne].object),delete ze[Ne];delete xe[ce.id]}}function Ci(){te(),U=!0,D!==C&&(D=C,G(D.object))}function te(){C.geometry=null,C.program=null,C.wireframe=!1}return{setup:N,reset:Ci,resetDefaultState:te,dispose:Ke,releaseStatesOfGeometry:Et,releaseStatesOfProgram:oi,initAttributes:Ae,enableAttribute:we,disableUnusedAttributes:Pe}}function IO(u,e,t,r){const c=r.isWebGL2;let p;function y(D){p=D}function i(D,U){u.drawArrays(p,D,U),t.update(U,p,1)}function C(D,U,N){if(N===0)return;let R,G;if(c)R=u,G="drawArraysInstanced";else if(R=e.get("ANGLE_instanced_arrays"),G="drawArraysInstancedANGLE",R===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}R[G](p,D,U,N),t.update(U,p,N)}this.setMode=y,this.render=i,this.renderInstances=C}function FO(u,e,t){let r;function c(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const it=e.get("EXT_texture_filter_anisotropic");r=u.getParameter(it.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function p(it){if(it==="highp"){if(u.getShaderPrecisionFormat(35633,36338).precision>0&&u.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";it="mediump"}return it==="mediump"&&u.getShaderPrecisionFormat(35633,36337).precision>0&&u.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const y=typeof WebGL2RenderingContext<"u"&&u instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&u instanceof WebGL2ComputeRenderingContext;let i=t.precision!==void 0?t.precision:"highp";const C=p(i);C!==i&&(console.warn("THREE.WebGLRenderer:",i,"not supported, using",C,"instead."),i=C);const D=y||e.has("WEBGL_draw_buffers"),U=t.logarithmicDepthBuffer===!0,N=u.getParameter(34930),R=u.getParameter(35660),G=u.getParameter(3379),J=u.getParameter(34076),Y=u.getParameter(34921),B=u.getParameter(36347),ae=u.getParameter(36348),le=u.getParameter(36349),Ae=R>0,we=y||e.has("OES_texture_float"),me=Ae&&we,Pe=y?u.getParameter(36183):0;return{isWebGL2:y,drawBuffers:D,getMaxAnisotropy:c,getMaxPrecision:p,precision:i,logarithmicDepthBuffer:U,maxTextures:N,maxVertexTextures:R,maxTextureSize:G,maxCubemapSize:J,maxAttributes:Y,maxVertexUniforms:B,maxVaryings:ae,maxFragmentUniforms:le,vertexTextures:Ae,floatFragmentTextures:we,floatVertexTextures:me,maxSamples:Pe}}function LO(u){const e=this;let t=null,r=0,c=!1,p=!1;const y=new $d,i=new Pl,C={value:null,needsUpdate:!1};this.uniform=C,this.numPlanes=0,this.numIntersection=0,this.init=function(N,R,G){const J=N.length!==0||R||r!==0||c;return c=R,t=U(N,G,0),r=N.length,J},this.beginShadows=function(){p=!0,U(null)},this.endShadows=function(){p=!1,D()},this.setState=function(N,R,G){const J=N.clippingPlanes,Y=N.clipIntersection,B=N.clipShadows,ae=u.get(N);if(!c||J===null||J.length===0||p&&!B)p?U(null):D();else{const le=p?0:r,Ae=le*4;let we=ae.clippingState||null;C.value=we,we=U(J,R,Ae,G);for(let me=0;me!==Ae;++me)we[me]=t[me];ae.clippingState=we,this.numIntersection=Y?this.numPlanes:0,this.numPlanes+=le}};function D(){C.value!==t&&(C.value=t,C.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function U(N,R,G,J){const Y=N!==null?N.length:0;let B=null;if(Y!==0){if(B=C.value,J!==!0||B===null){const ae=G+Y*4,le=R.matrixWorldInverse;i.getNormalMatrix(le),(B===null||B.length<ae)&&(B=new Float32Array(ae));for(let Ae=0,we=G;Ae!==Y;++Ae,we+=4)y.copy(N[Ae]).applyMatrix4(le,i),y.normal.toArray(B,we),B[we+3]=y.constant}C.value=B,C.needsUpdate=!0}return e.numPlanes=Y,e.numIntersection=0,B}}function DO(u){let e=new WeakMap;function t(y,i){return i===Q_?y.mapping=op:i===V_&&(y.mapping=ap),y}function r(y){if(y&&y.isTexture&&y.isRenderTargetTexture===!1){const i=y.mapping;if(i===Q_||i===V_)if(e.has(y)){const C=e.get(y).texture;return t(C,y.mapping)}else{const C=y.image;if(C&&C.height>0){const D=new zI(C.height/2);return D.fromEquirectangularTexture(u,y),e.set(y,D),y.addEventListener("dispose",c),t(D.texture,y.mapping)}else return null}}return y}function c(y){const i=y.target;i.removeEventListener("dispose",c);const C=e.get(i);C!==void 0&&(e.delete(i),C.dispose())}function p(){e=new WeakMap}return{get:r,dispose:p}}class fy extends Hv{constructor(e=-1,t=1,r=1,c=-1,p=.1,y=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=c,this.near=p,this.far=y,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,c,p,y){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=c,this.view.width=p,this.view.height=y,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,c=(this.top+this.bottom)/2;let p=r-e,y=r+e,i=c+t,C=c-t;if(this.view!==null&&this.view.enabled){const D=(this.right-this.left)/this.view.fullWidth/this.zoom,U=(this.top-this.bottom)/this.view.fullHeight/this.zoom;p+=D*this.view.offsetX,y=p+D*this.view.width,i-=U*this.view.offsetY,C=i-U*this.view.height}this.projectionMatrix.makeOrthographic(p,y,i,C,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Um=4,jE=[.125,.215,.35,.446,.526,.582],ef=20,Qw=new fy,KE=new Dn;let Vw=null;const Xp=(1+Math.sqrt(5))/2,wm=1/Xp,$E=[new ft(1,1,1),new ft(-1,1,1),new ft(1,1,-1),new ft(-1,1,-1),new ft(0,Xp,wm),new ft(0,Xp,-wm),new ft(wm,0,Xp),new ft(-wm,0,Xp),new ft(Xp,wm,0),new ft(-Xp,wm,0)];class a2{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,c=100){Vw=this._renderer.getRenderTarget(),this._setSize(256);const p=this._allocateTargets();return p.depthBuffer=!0,this._sceneToCubeUV(e,r,c,p),t>0&&this._blur(p,0,0,t),this._applyPMREM(p),this._cleanup(p),p}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=qE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=XE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Vw),e.scissorTest=!1,fx(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===op||e.mapping===ap?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Vw=this._renderer.getRenderTarget();const r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:Xs,minFilter:Xs,generateMipmaps:!1,type:Gm,format:Dl,encoding:hp,depthBuffer:!1},c=ZE(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ZE(e,t,r);const{_lodMax:p}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=PO(p)),this._blurMaterial=UO(p,e,t)}return c}_compileMaterial(e){const t=new is(this._lodPlanes[0],e);this._renderer.compile(t,Qw)}_sceneToCubeUV(e,t,r,c){const i=new _a(90,1,t,r),C=[1,-1,1,1,1,1],D=[1,1,1,-1,-1,-1],U=this._renderer,N=U.autoClear,R=U.toneMapping;U.getClearColor(KE),U.toneMapping=Vu,U.autoClear=!1;const G=new na({name:"PMREM.Background",side:Dc,depthWrite:!1,depthTest:!1}),J=new is(new YA,G);let Y=!1;const B=e.background;B?B.isColor&&(G.color.copy(B),e.background=null,Y=!0):(G.color.copy(KE),Y=!0);for(let ae=0;ae<6;ae++){const le=ae%3;le===0?(i.up.set(0,C[ae],0),i.lookAt(D[ae],0,0)):le===1?(i.up.set(0,0,C[ae]),i.lookAt(0,D[ae],0)):(i.up.set(0,C[ae],0),i.lookAt(0,0,D[ae]));const Ae=this._cubeSize;fx(c,le*Ae,ae>2?Ae:0,Ae,Ae),U.setRenderTarget(c),Y&&U.render(J,i),U.render(e,i)}J.geometry.dispose(),J.material.dispose(),U.toneMapping=R,U.autoClear=N,e.background=B}_textureToCubeUV(e,t){const r=this._renderer,c=e.mapping===op||e.mapping===ap;c?(this._cubemapMaterial===null&&(this._cubemapMaterial=qE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=XE());const p=c?this._cubemapMaterial:this._equirectMaterial,y=new is(this._lodPlanes[0],p),i=p.uniforms;i.envMap.value=e;const C=this._cubeSize;fx(t,0,0,3*C,2*C),r.setRenderTarget(t),r.render(y,Qw)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let c=1;c<this._lodPlanes.length;c++){const p=Math.sqrt(this._sigmas[c]*this._sigmas[c]-this._sigmas[c-1]*this._sigmas[c-1]),y=$E[(c-1)%$E.length];this._blur(e,c-1,c,p,y)}t.autoClear=r}_blur(e,t,r,c,p){const y=this._pingPongRenderTarget;this._halfBlur(e,y,t,r,c,"latitudinal",p),this._halfBlur(y,e,r,r,c,"longitudinal",p)}_halfBlur(e,t,r,c,p,y,i){const C=this._renderer,D=this._blurMaterial;y!=="latitudinal"&&y!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const U=3,N=new is(this._lodPlanes[c],D),R=D.uniforms,G=this._sizeLods[r]-1,J=isFinite(p)?Math.PI/(2*G):2*Math.PI/(2*ef-1),Y=p/J,B=isFinite(p)?1+Math.floor(U*Y):ef;B>ef&&console.warn(`sigmaRadians, ${p}, is too large and will clip, as it requested ${B} samples when the maximum is set to ${ef}`);const ae=[];let le=0;for(let it=0;it<ef;++it){const Me=it/Y,Ke=Math.exp(-Me*Me/2);ae.push(Ke),it===0?le+=Ke:it<B&&(le+=2*Ke)}for(let it=0;it<ae.length;it++)ae[it]=ae[it]/le;R.envMap.value=e.texture,R.samples.value=B,R.weights.value=ae,R.latitudinal.value=y==="latitudinal",i&&(R.poleAxis.value=i);const{_lodMax:Ae}=this;R.dTheta.value=J,R.mipInt.value=Ae-r;const we=this._sizeLods[c],me=3*we*(c>Ae-Um?c-Ae+Um:0),Pe=4*(this._cubeSize-we);fx(t,me,Pe,3*we,2*we),C.setRenderTarget(t),C.render(N,Qw)}}function PO(u){const e=[],t=[],r=[];let c=u;const p=u-Um+1+jE.length;for(let y=0;y<p;y++){const i=Math.pow(2,c);t.push(i);let C=1/i;y>u-Um?C=jE[y-u+Um-1]:y===0&&(C=0),r.push(C);const D=1/(i-2),U=-D,N=1+D,R=[U,U,N,U,N,N,U,U,N,N,U,N],G=6,J=6,Y=3,B=2,ae=1,le=new Float32Array(Y*J*G),Ae=new Float32Array(B*J*G),we=new Float32Array(ae*J*G);for(let Pe=0;Pe<G;Pe++){const it=Pe%3*2/3-1,Me=Pe>2?0:-1,Ke=[it,Me,0,it+2/3,Me,0,it+2/3,Me+1,0,it,Me,0,it+2/3,Me+1,0,it,Me+1,0];le.set(Ke,Y*J*Pe),Ae.set(R,B*J*Pe);const Et=[Pe,Pe,Pe,Pe,Pe,Pe];we.set(Et,ae*J*Pe)}const me=new br;me.setAttribute("position",new ds(le,Y)),me.setAttribute("uv",new ds(Ae,B)),me.setAttribute("faceIndex",new ds(we,ae)),e.push(me),c>Um&&c--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function ZE(u,e,t){const r=new Oa(u,e,t);return r.texture.mapping=qm,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function fx(u,e,t,r,c){u.viewport.set(e,t,r,c),u.scissor.set(e,t,r,c)}function UO(u,e,t){const r=new Float32Array(ef),c=new ft(0,1,0);return new ko({name:"SphericalGaussianBlur",defines:{n:ef,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${u}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:H2(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- uniform int samples;
- uniform float weights[ n ];
- uniform bool latitudinal;
- uniform float dTheta;
- uniform float mipInt;
- uniform vec3 poleAxis;
- #define ENVMAP_TYPE_CUBE_UV
- #include <cube_uv_reflection_fragment>
- vec3 getSample( float theta, vec3 axis ) {
- float cosTheta = cos( theta );
- // Rodrigues' axis-angle rotation
- vec3 sampleDirection = vOutputDirection * cosTheta
- + cross( axis, vOutputDirection ) * sin( theta )
- + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
- return bilinearCubeUV( envMap, sampleDirection, mipInt );
- }
- void main() {
- vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
- if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
- axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
- }
- axis = normalize( axis );
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
- for ( int i = 1; i < n; i++ ) {
- if ( i >= samples ) {
- break;
- }
- float theta = dTheta * float( i );
- gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
- gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
- }
- }
- `,blending:KA,depthTest:!1,depthWrite:!1})}function XE(){return new ko({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:H2(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- #include <common>
- void main() {
- vec3 outputDirection = normalize( vOutputDirection );
- vec2 uv = equirectUv( outputDirection );
- gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
- }
- `,blending:KA,depthTest:!1,depthWrite:!1})}function qE(){return new ko({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:H2(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- uniform float flipEnvMap;
- varying vec3 vOutputDirection;
- uniform samplerCube envMap;
- void main() {
- gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
- }
- `,blending:KA,depthTest:!1,depthWrite:!1})}function H2(){return`
- precision mediump float;
- precision mediump int;
- attribute float faceIndex;
- varying vec3 vOutputDirection;
- // RH coordinate system; PMREM face-indexing convention
- vec3 getDirection( vec2 uv, float face ) {
- uv = 2.0 * uv - 1.0;
- vec3 direction = vec3( uv, 1.0 );
- if ( face == 0.0 ) {
- direction = direction.zyx; // ( 1, v, u ) pos x
- } else if ( face == 1.0 ) {
- direction = direction.xzy;
- direction.xz *= -1.0; // ( -u, 1, -v ) pos y
- } else if ( face == 2.0 ) {
- direction.x *= -1.0; // ( -u, v, 1 ) pos z
- } else if ( face == 3.0 ) {
- direction = direction.zyx;
- direction.xz *= -1.0; // ( -1, v, -u ) neg x
- } else if ( face == 4.0 ) {
- direction = direction.xzy;
- direction.xy *= -1.0; // ( -u, -1, v ) neg y
- } else if ( face == 5.0 ) {
- direction.z *= -1.0; // ( u, v, -1 ) neg z
- }
- return direction;
- }
- void main() {
- vOutputDirection = getDirection( uv, faceIndex );
- gl_Position = vec4( position, 1.0 );
- }
- `}function RO(u){let e=new WeakMap,t=null;function r(i){if(i&&i.isTexture){const C=i.mapping,D=C===Q_||C===V_,U=C===op||C===ap;if(D||U)if(i.isRenderTargetTexture&&i.needsPMREMUpdate===!0){i.needsPMREMUpdate=!1;let N=e.get(i);return t===null&&(t=new a2(u)),N=D?t.fromEquirectangular(i,N):t.fromCubemap(i,N),e.set(i,N),N.texture}else{if(e.has(i))return e.get(i).texture;{const N=i.image;if(D&&N&&N.height>0||U&&N&&c(N)){t===null&&(t=new a2(u));const R=D?t.fromEquirectangular(i):t.fromCubemap(i);return e.set(i,R),i.addEventListener("dispose",p),R.texture}else return null}}}return i}function c(i){let C=0;const D=6;for(let U=0;U<D;U++)i[U]!==void 0&&C++;return C===D}function p(i){const C=i.target;C.removeEventListener("dispose",p);const D=e.get(C);D!==void 0&&(e.delete(C),D.dispose())}function y(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:r,dispose:y}}function zO(u){const e={};function t(r){if(e[r]!==void 0)return e[r];let c;switch(r){case"WEBGL_depth_texture":c=u.getExtension("WEBGL_depth_texture")||u.getExtension("MOZ_WEBGL_depth_texture")||u.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":c=u.getExtension("EXT_texture_filter_anisotropic")||u.getExtension("MOZ_EXT_texture_filter_anisotropic")||u.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":c=u.getExtension("WEBGL_compressed_texture_s3tc")||u.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||u.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":c=u.getExtension("WEBGL_compressed_texture_pvrtc")||u.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:c=u.getExtension(r)}return e[r]=c,c}return{has:function(r){return t(r)!==null},init:function(r){r.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(r){const c=t(r);return c===null&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),c}}}function kO(u,e,t,r){const c={},p=new WeakMap;function y(N){const R=N.target;R.index!==null&&e.remove(R.index);for(const J in R.attributes)e.remove(R.attributes[J]);R.removeEventListener("dispose",y),delete c[R.id];const G=p.get(R);G&&(e.remove(G),p.delete(R)),r.releaseStatesOfGeometry(R),R.isInstancedBufferGeometry===!0&&delete R._maxInstanceCount,t.memory.geometries--}function i(N,R){return c[R.id]===!0||(R.addEventListener("dispose",y),c[R.id]=!0,t.memory.geometries++),R}function C(N){const R=N.attributes;for(const J in R)e.update(R[J],34962);const G=N.morphAttributes;for(const J in G){const Y=G[J];for(let B=0,ae=Y.length;B<ae;B++)e.update(Y[B],34962)}}function D(N){const R=[],G=N.index,J=N.attributes.position;let Y=0;if(G!==null){const le=G.array;Y=G.version;for(let Ae=0,we=le.length;Ae<we;Ae+=3){const me=le[Ae+0],Pe=le[Ae+1],it=le[Ae+2];R.push(me,Pe,Pe,it,it,me)}}else{const le=J.array;Y=J.version;for(let Ae=0,we=le.length/3-1;Ae<we;Ae+=3){const me=Ae+0,Pe=Ae+1,it=Ae+2;R.push(me,Pe,Pe,it,it,me)}}const B=new(DI(R)?V2:Q2)(R,1);B.version=Y;const ae=p.get(N);ae&&e.remove(ae),p.set(N,B)}function U(N){const R=p.get(N);if(R){const G=N.index;G!==null&&R.version<G.version&&D(N)}else D(N);return p.get(N)}return{get:i,update:C,getWireframeAttribute:U}}function OO(u,e,t,r){const c=r.isWebGL2;let p;function y(R){p=R}let i,C;function D(R){i=R.type,C=R.bytesPerElement}function U(R,G){u.drawElements(p,G,i,R*C),t.update(G,p,1)}function N(R,G,J){if(J===0)return;let Y,B;if(c)Y=u,B="drawElementsInstanced";else if(Y=e.get("ANGLE_instanced_arrays"),B="drawElementsInstancedANGLE",Y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}Y[B](p,G,i,R*C,J),t.update(G,p,J)}this.setMode=y,this.setIndex=D,this.render=U,this.renderInstances=N}function NO(u){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function r(p,y,i){switch(t.calls++,y){case 4:t.triangles+=i*(p/3);break;case 1:t.lines+=i*(p/2);break;case 3:t.lines+=i*(p-1);break;case 2:t.lines+=i*p;break;case 0:t.points+=i*p;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",y);break}}function c(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:c,update:r}}function QO(u,e){return u[0]-e[0]}function VO(u,e){return Math.abs(e[1])-Math.abs(u[1])}function HO(u,e,t){const r={},c=new Float32Array(8),p=new WeakMap,y=new ls,i=[];for(let D=0;D<8;D++)i[D]=[D,0];function C(D,U,N,R){const G=D.morphTargetInfluences;if(e.isWebGL2===!0){const Y=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,B=Y!==void 0?Y.length:0;let ae=p.get(U);if(ae===void 0||ae.count!==B){let xe=function(){ce.dispose(),p.delete(U),U.removeEventListener("dispose",xe)};var J=xe;ae!==void 0&&ae.texture.dispose();const we=U.morphAttributes.position!==void 0,me=U.morphAttributes.normal!==void 0,Pe=U.morphAttributes.color!==void 0,it=U.morphAttributes.position||[],Me=U.morphAttributes.normal||[],Ke=U.morphAttributes.color||[];let Et=0;we===!0&&(Et=1),me===!0&&(Et=2),Pe===!0&&(Et=3);let oi=U.attributes.position.count*Et,Ci=1;oi>e.maxTextureSize&&(Ci=Math.ceil(oi/e.maxTextureSize),oi=e.maxTextureSize);const te=new Float32Array(oi*Ci*4*B),ce=new uy(te,oi,Ci,B);ce.type=GA,ce.needsUpdate=!0;const ye=Et*4;for(let ze=0;ze<B;ze++){const Ne=it[ze],Ge=Me[ze],Ve=Ke[ze],Le=oi*Ci*4*ze;for(let Ie=0;Ie<Ne.count;Ie++){const qe=Ie*ye;we===!0&&(y.fromBufferAttribute(Ne,Ie),te[Le+qe+0]=y.x,te[Le+qe+1]=y.y,te[Le+qe+2]=y.z,te[Le+qe+3]=0),me===!0&&(y.fromBufferAttribute(Ge,Ie),te[Le+qe+4]=y.x,te[Le+qe+5]=y.y,te[Le+qe+6]=y.z,te[Le+qe+7]=0),Pe===!0&&(y.fromBufferAttribute(Ve,Ie),te[Le+qe+8]=y.x,te[Le+qe+9]=y.y,te[Le+qe+10]=y.z,te[Le+qe+11]=Ve.itemSize===4?y.w:1)}}ae={count:B,texture:ce,size:new Di(oi,Ci)},p.set(U,ae),U.addEventListener("dispose",xe)}let le=0;for(let we=0;we<G.length;we++)le+=G[we];const Ae=U.morphTargetsRelative?1:1-le;R.getUniforms().setValue(u,"morphTargetBaseInfluence",Ae),R.getUniforms().setValue(u,"morphTargetInfluences",G),R.getUniforms().setValue(u,"morphTargetsTexture",ae.texture,t),R.getUniforms().setValue(u,"morphTargetsTextureSize",ae.size)}else{const Y=G===void 0?0:G.length;let B=r[U.id];if(B===void 0||B.length!==Y){B=[];for(let me=0;me<Y;me++)B[me]=[me,0];r[U.id]=B}for(let me=0;me<Y;me++){const Pe=B[me];Pe[0]=me,Pe[1]=G[me]}B.sort(VO);for(let me=0;me<8;me++)me<Y&&B[me][1]?(i[me][0]=B[me][0],i[me][1]=B[me][1]):(i[me][0]=Number.MAX_SAFE_INTEGER,i[me][1]=0);i.sort(QO);const ae=U.morphAttributes.position,le=U.morphAttributes.normal;let Ae=0;for(let me=0;me<8;me++){const Pe=i[me],it=Pe[0],Me=Pe[1];it!==Number.MAX_SAFE_INTEGER&&Me?(ae&&U.getAttribute("morphTarget"+me)!==ae[it]&&U.setAttribute("morphTarget"+me,ae[it]),le&&U.getAttribute("morphNormal"+me)!==le[it]&&U.setAttribute("morphNormal"+me,le[it]),c[me]=Me,Ae+=Me):(ae&&U.hasAttribute("morphTarget"+me)===!0&&U.deleteAttribute("morphTarget"+me),le&&U.hasAttribute("morphNormal"+me)===!0&&U.deleteAttribute("morphNormal"+me),c[me]=0)}const we=U.morphTargetsRelative?1:1-Ae;R.getUniforms().setValue(u,"morphTargetBaseInfluence",we),R.getUniforms().setValue(u,"morphTargetInfluences",c)}}return{update:C}}function GO(u,e,t,r){let c=new WeakMap;function p(C){const D=r.render.frame,U=C.geometry,N=e.get(C,U);return c.get(N)!==D&&(e.update(N),c.set(N,D)),C.isInstancedMesh&&(C.hasEventListener("dispose",i)===!1&&C.addEventListener("dispose",i),t.update(C.instanceMatrix,34962),C.instanceColor!==null&&t.update(C.instanceColor,34962)),N}function y(){c=new WeakMap}function i(C){const D=C.target;D.removeEventListener("dispose",i),t.remove(D.instanceMatrix),D.instanceColor!==null&&t.remove(D.instanceColor)}return{update:p,dispose:y}}const OI=new To,NI=new uy,QI=new Vv,VI=new py,YE=[],JE=[],eT=new Float32Array(16),tT=new Float32Array(9),iT=new Float32Array(4);function Jm(u,e,t){const r=u[0];if(r<=0||r>0)return u;const c=e*t;let p=YE[c];if(p===void 0&&(p=new Float32Array(c),YE[c]=p),e!==0){r.toArray(p,0);for(let y=1,i=0;y!==e;++y)i+=t,u[y].toArray(p,i)}return p}function oa(u,e){if(u.length!==e.length)return!1;for(let t=0,r=u.length;t<r;t++)if(u[t]!==e[t])return!1;return!0}function aa(u,e){for(let t=0,r=e.length;t<r;t++)u[t]=e[t]}function Wv(u,e){let t=JE[e];t===void 0&&(t=new Int32Array(e),JE[e]=t);for(let r=0;r!==e;++r)t[r]=u.allocateTextureUnit();return t}function WO(u,e){const t=this.cache;t[0]!==e&&(u.uniform1f(this.addr,e),t[0]=e)}function jO(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(u.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(oa(t,e))return;u.uniform2fv(this.addr,e),aa(t,e)}}function KO(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(u.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(u.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(oa(t,e))return;u.uniform3fv(this.addr,e),aa(t,e)}}function $O(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(u.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(oa(t,e))return;u.uniform4fv(this.addr,e),aa(t,e)}}function ZO(u,e){const t=this.cache,r=e.elements;if(r===void 0){if(oa(t,e))return;u.uniformMatrix2fv(this.addr,!1,e),aa(t,e)}else{if(oa(t,r))return;iT.set(r),u.uniformMatrix2fv(this.addr,!1,iT),aa(t,r)}}function XO(u,e){const t=this.cache,r=e.elements;if(r===void 0){if(oa(t,e))return;u.uniformMatrix3fv(this.addr,!1,e),aa(t,e)}else{if(oa(t,r))return;tT.set(r),u.uniformMatrix3fv(this.addr,!1,tT),aa(t,r)}}function qO(u,e){const t=this.cache,r=e.elements;if(r===void 0){if(oa(t,e))return;u.uniformMatrix4fv(this.addr,!1,e),aa(t,e)}else{if(oa(t,r))return;eT.set(r),u.uniformMatrix4fv(this.addr,!1,eT),aa(t,r)}}function YO(u,e){const t=this.cache;t[0]!==e&&(u.uniform1i(this.addr,e),t[0]=e)}function JO(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(u.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(oa(t,e))return;u.uniform2iv(this.addr,e),aa(t,e)}}function e6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(u.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(oa(t,e))return;u.uniform3iv(this.addr,e),aa(t,e)}}function t6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(u.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(oa(t,e))return;u.uniform4iv(this.addr,e),aa(t,e)}}function i6(u,e){const t=this.cache;t[0]!==e&&(u.uniform1ui(this.addr,e),t[0]=e)}function n6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(u.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(oa(t,e))return;u.uniform2uiv(this.addr,e),aa(t,e)}}function r6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(u.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(oa(t,e))return;u.uniform3uiv(this.addr,e),aa(t,e)}}function s6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(u.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(oa(t,e))return;u.uniform4uiv(this.addr,e),aa(t,e)}}function o6(u,e,t){const r=this.cache,c=t.allocateTextureUnit();r[0]!==c&&(u.uniform1i(this.addr,c),r[0]=c),t.setTexture2D(e||OI,c)}function a6(u,e,t){const r=this.cache,c=t.allocateTextureUnit();r[0]!==c&&(u.uniform1i(this.addr,c),r[0]=c),t.setTexture3D(e||QI,c)}function l6(u,e,t){const r=this.cache,c=t.allocateTextureUnit();r[0]!==c&&(u.uniform1i(this.addr,c),r[0]=c),t.setTextureCube(e||VI,c)}function c6(u,e,t){const r=this.cache,c=t.allocateTextureUnit();r[0]!==c&&(u.uniform1i(this.addr,c),r[0]=c),t.setTexture2DArray(e||NI,c)}function h6(u){switch(u){case 5126:return WO;case 35664:return jO;case 35665:return KO;case 35666:return $O;case 35674:return ZO;case 35675:return XO;case 35676:return qO;case 5124:case 35670:return YO;case 35667:case 35671:return JO;case 35668:case 35672:return e6;case 35669:case 35673:return t6;case 5125:return i6;case 36294:return n6;case 36295:return r6;case 36296:return s6;case 35678:case 36198:case 36298:case 36306:case 35682:return o6;case 35679:case 36299:case 36307:return a6;case 35680:case 36300:case 36308:case 36293:return l6;case 36289:case 36303:case 36311:case 36292:return c6}}function u6(u,e){u.uniform1fv(this.addr,e)}function A6(u,e){const t=Jm(e,this.size,2);u.uniform2fv(this.addr,t)}function d6(u,e){const t=Jm(e,this.size,3);u.uniform3fv(this.addr,t)}function p6(u,e){const t=Jm(e,this.size,4);u.uniform4fv(this.addr,t)}function f6(u,e){const t=Jm(e,this.size,4);u.uniformMatrix2fv(this.addr,!1,t)}function m6(u,e){const t=Jm(e,this.size,9);u.uniformMatrix3fv(this.addr,!1,t)}function g6(u,e){const t=Jm(e,this.size,16);u.uniformMatrix4fv(this.addr,!1,t)}function _6(u,e){u.uniform1iv(this.addr,e)}function y6(u,e){u.uniform2iv(this.addr,e)}function x6(u,e){u.uniform3iv(this.addr,e)}function v6(u,e){u.uniform4iv(this.addr,e)}function w6(u,e){u.uniform1uiv(this.addr,e)}function b6(u,e){u.uniform2uiv(this.addr,e)}function B6(u,e){u.uniform3uiv(this.addr,e)}function C6(u,e){u.uniform4uiv(this.addr,e)}function E6(u,e,t){const r=this.cache,c=e.length,p=Wv(t,c);oa(r,p)||(u.uniform1iv(this.addr,p),aa(r,p));for(let y=0;y!==c;++y)t.setTexture2D(e[y]||OI,p[y])}function T6(u,e,t){const r=this.cache,c=e.length,p=Wv(t,c);oa(r,p)||(u.uniform1iv(this.addr,p),aa(r,p));for(let y=0;y!==c;++y)t.setTexture3D(e[y]||QI,p[y])}function S6(u,e,t){const r=this.cache,c=e.length,p=Wv(t,c);oa(r,p)||(u.uniform1iv(this.addr,p),aa(r,p));for(let y=0;y!==c;++y)t.setTextureCube(e[y]||VI,p[y])}function M6(u,e,t){const r=this.cache,c=e.length,p=Wv(t,c);oa(r,p)||(u.uniform1iv(this.addr,p),aa(r,p));for(let y=0;y!==c;++y)t.setTexture2DArray(e[y]||NI,p[y])}function I6(u){switch(u){case 5126:return u6;case 35664:return A6;case 35665:return d6;case 35666:return p6;case 35674:return f6;case 35675:return m6;case 35676:return g6;case 5124:case 35670:return _6;case 35667:case 35671:return y6;case 35668:case 35672:return x6;case 35669:case 35673:return v6;case 5125:return w6;case 36294:return b6;case 36295:return B6;case 36296:return C6;case 35678:case 36198:case 36298:case 36306:case 35682:return E6;case 35679:case 36299:case 36307:return T6;case 35680:case 36300:case 36308:case 36293:return S6;case 36289:case 36303:case 36311:case 36292:return M6}}class F6{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.setValue=h6(t.type)}}class L6{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=I6(t.type)}}class D6{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){const c=this.seq;for(let p=0,y=c.length;p!==y;++p){const i=c[p];i.setValue(e,t[i.id],r)}}}const Hw=/(\w+)(\])?(\[|\.)?/g;function nT(u,e){u.seq.push(e),u.map[e.id]=e}function P6(u,e,t){const r=u.name,c=r.length;for(Hw.lastIndex=0;;){const p=Hw.exec(r),y=Hw.lastIndex;let i=p[1];const C=p[2]==="]",D=p[3];if(C&&(i=i|0),D===void 0||D==="["&&y+2===c){nT(t,D===void 0?new F6(i,u,e):new L6(i,u,e));break}else{let N=t.map[i];N===void 0&&(N=new D6(i),nT(t,N)),t=N}}}class Jx{constructor(e,t){this.seq=[],this.map={};const r=e.getProgramParameter(t,35718);for(let c=0;c<r;++c){const p=e.getActiveUniform(t,c),y=e.getUniformLocation(t,p.name);P6(p,y,this)}}setValue(e,t,r,c){const p=this.map[t];p!==void 0&&p.setValue(e,r,c)}setOptional(e,t,r){const c=t[r];c!==void 0&&this.setValue(e,r,c)}static upload(e,t,r,c){for(let p=0,y=t.length;p!==y;++p){const i=t[p],C=r[i.id];C.needsUpdate!==!1&&i.setValue(e,C.value,c)}}static seqWithValue(e,t){const r=[];for(let c=0,p=e.length;c!==p;++c){const y=e[c];y.id in t&&r.push(y)}return r}}function rT(u,e,t){const r=u.createShader(e);return u.shaderSource(r,t),u.compileShader(r),r}let U6=0;function R6(u,e){const t=u.split(`
- `),r=[],c=Math.max(e-6,0),p=Math.min(e+6,t.length);for(let y=c;y<p;y++){const i=y+1;r.push(`${i===e?">":" "} ${i}: ${t[y]}`)}return r.join(`
- `)}function z6(u){switch(u){case hp:return["Linear","( value )"];case Ss:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",u),["Linear","( value )"]}}function sT(u,e,t){const r=u.getShaderParameter(e,35713),c=u.getShaderInfoLog(e).trim();if(r&&c==="")return"";const p=/ERROR: 0:(\d+)/.exec(c);if(p){const y=parseInt(p[1]);return t.toUpperCase()+`
- `+c+`
- `+R6(u.getShaderSource(e),y)}else return c}function k6(u,e){const t=z6(e);return"vec4 "+u+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function O6(u,e){let t;switch(e){case U2:t="Linear";break;case sI:t="Reinhard";break;case oI:t="OptimizedCineon";break;case aI:t="ACESFilmic";break;case lI:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+u+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function N6(u){return[u.extensionDerivatives||!!u.envMapCubeUVHeight||u.bumpMap||u.tangentSpaceNormalMap||u.clearcoatNormalMap||u.flatShading||u.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(u.extensionFragDepth||u.logarithmicDepthBuffer)&&u.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",u.extensionDrawBuffers&&u.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(u.extensionShaderTextureLOD||u.envMap||u.transmission)&&u.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(b_).join(`
- `)}function Q6(u){const e=[];for(const t in u){const r=u[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(`
- `)}function V6(u,e){const t={},r=u.getProgramParameter(e,35721);for(let c=0;c<r;c++){const p=u.getActiveAttrib(e,c),y=p.name;let i=1;p.type===35674&&(i=2),p.type===35675&&(i=3),p.type===35676&&(i=4),t[y]={type:p.type,location:u.getAttribLocation(e,y),locationSize:i}}return t}function b_(u){return u!==""}function oT(u,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return u.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function aT(u,e){return u.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const H6=/^[ \t]*#include +<([\w\d./]+)>/gm;function l2(u){return u.replace(H6,G6)}function G6(u,e){const t=zr[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return l2(t)}const W6=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function lT(u){return u.replace(W6,j6)}function j6(u,e,t,r){let c="";for(let p=parseInt(e);p<parseInt(t);p++)c+=r.replace(/\[\s*i\s*\]/g,"[ "+p+" ]").replace(/UNROLLED_LOOP_INDEX/g,p);return c}function cT(u){let e="precision "+u.precision+` float;
- precision `+u.precision+" int;";return u.precision==="highp"?e+=`
- #define HIGH_PRECISION`:u.precision==="mediump"?e+=`
- #define MEDIUM_PRECISION`:u.precision==="lowp"&&(e+=`
- #define LOW_PRECISION`),e}function K6(u){let e="SHADOWMAP_TYPE_BASIC";return u.shadowMapType===L2?e="SHADOWMAP_TYPE_PCF":u.shadowMapType===zM?e="SHADOWMAP_TYPE_PCF_SOFT":u.shadowMapType===Dm&&(e="SHADOWMAP_TYPE_VSM"),e}function $6(u){let e="ENVMAP_TYPE_CUBE";if(u.envMap)switch(u.envMapMode){case op:case ap:e="ENVMAP_TYPE_CUBE";break;case qm:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Z6(u){let e="ENVMAP_MODE_REFLECTION";if(u.envMap)switch(u.envMapMode){case ap:e="ENVMAP_MODE_REFRACTION";break}return e}function X6(u){let e="ENVMAP_BLENDING_NONE";if(u.envMap)switch(u.combine){case hy:e="ENVMAP_BLENDING_MULTIPLY";break;case nI:e="ENVMAP_BLENDING_MIX";break;case rI:e="ENVMAP_BLENDING_ADD";break}return e}function q6(u){const e=u.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:r,maxMip:t}}function Y6(u,e,t,r){const c=u.getContext(),p=t.defines;let y=t.vertexShader,i=t.fragmentShader;const C=K6(t),D=$6(t),U=Z6(t),N=X6(t),R=q6(t),G=t.isWebGL2?"":N6(t),J=Q6(p),Y=c.createProgram();let B,ae,le=t.glslVersion?"#version "+t.glslVersion+`
- `:"";t.isRawShaderMaterial?(B=[J].filter(b_).join(`
- `),B.length>0&&(B+=`
- `),ae=[G,J].filter(b_).join(`
- `),ae.length>0&&(ae+=`
- `)):(B=[cT(t),"#define SHADER_NAME "+t.shaderName,J,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+U:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+C:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
- `].filter(b_).join(`
- `),ae=[G,cT(t),"#define SHADER_NAME "+t.shaderName,J,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+D:"",t.envMap?"#define "+U:"",t.envMap?"#define "+N:"",R?"#define CUBEUV_TEXEL_WIDTH "+R.texelWidth:"",R?"#define CUBEUV_TEXEL_HEIGHT "+R.texelHeight:"",R?"#define CUBEUV_MAX_MIP "+R.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+C:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Vu?"#define TONE_MAPPING":"",t.toneMapping!==Vu?zr.tonemapping_pars_fragment:"",t.toneMapping!==Vu?O6("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",zr.encodings_pars_fragment,k6("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
- `].filter(b_).join(`
- `)),y=l2(y),y=oT(y,t),y=aT(y,t),i=l2(i),i=oT(i,t),i=aT(i,t),y=lT(y),i=lT(i),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(le=`#version 300 es
- `,B=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
- `)+`
- `+B,ae=["#define varying in",t.glslVersion===s2?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===s2?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
- `)+`
- `+ae);const Ae=le+B+y,we=le+ae+i,me=rT(c,35633,Ae),Pe=rT(c,35632,we);if(c.attachShader(Y,me),c.attachShader(Y,Pe),t.index0AttributeName!==void 0?c.bindAttribLocation(Y,0,t.index0AttributeName):t.morphTargets===!0&&c.bindAttribLocation(Y,0,"position"),c.linkProgram(Y),u.debug.checkShaderErrors){const Ke=c.getProgramInfoLog(Y).trim(),Et=c.getShaderInfoLog(me).trim(),oi=c.getShaderInfoLog(Pe).trim();let Ci=!0,te=!0;if(c.getProgramParameter(Y,35714)===!1){Ci=!1;const ce=sT(c,me,"vertex"),ye=sT(c,Pe,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(Y,35715)+`
- Program Info Log: `+Ke+`
- `+ce+`
- `+ye)}else Ke!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Ke):(Et===""||oi==="")&&(te=!1);te&&(this.diagnostics={runnable:Ci,programLog:Ke,vertexShader:{log:Et,prefix:B},fragmentShader:{log:oi,prefix:ae}})}c.deleteShader(me),c.deleteShader(Pe);let it;this.getUniforms=function(){return it===void 0&&(it=new Jx(c,Y)),it};let Me;return this.getAttributes=function(){return Me===void 0&&(Me=V6(c,Y)),Me},this.destroy=function(){r.releaseStatesOfProgram(this),c.deleteProgram(Y),this.program=void 0},this.name=t.shaderName,this.id=U6++,this.cacheKey=e,this.usedTimes=1,this.program=Y,this.vertexShader=me,this.fragmentShader=Pe,this}let J6=0;class eN{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,c=this._getShaderStage(t),p=this._getShaderStage(r),y=this._getShaderCacheForMaterial(e);return y.has(c)===!1&&(y.add(c),c.usedTimes++),y.has(p)===!1&&(y.add(p),p.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new tN(e),t.set(e,r)),r}}class tN{constructor(e){this.id=J6++,this.code=e,this.usedTimes=0}}function iN(u,e,t,r,c,p,y){const i=new dy,C=new eN,D=[],U=c.isWebGL2,N=c.logarithmicDepthBuffer,R=c.vertexTextures;let G=c.precision;const J={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function Y(Me,Ke,Et,oi,Ci){const te=oi.fog,ce=Ci.geometry,ye=Me.isMeshStandardMaterial?oi.environment:null,xe=(Me.isMeshStandardMaterial?t:e).get(Me.envMap||ye),ze=!!xe&&xe.mapping===qm?xe.image.height:null,Ne=J[Me.type];Me.precision!==null&&(G=c.getMaxPrecision(Me.precision),G!==Me.precision&&console.warn("THREE.WebGLProgram.getParameters:",Me.precision,"not supported, using",G,"instead."));const Ge=ce.morphAttributes.position||ce.morphAttributes.normal||ce.morphAttributes.color,Ve=Ge!==void 0?Ge.length:0;let Le=0;ce.morphAttributes.position!==void 0&&(Le=1),ce.morphAttributes.normal!==void 0&&(Le=2),ce.morphAttributes.color!==void 0&&(Le=3);let Ie,qe,et,vt;if(Ne){const Nt=Fl[Ne];Ie=Nt.vertexShader,qe=Nt.fragmentShader}else Ie=Me.vertexShader,qe=Me.fragmentShader,C.update(Me),et=C.getVertexShaderID(Me),vt=C.getFragmentShaderID(Me);const Be=u.getRenderTarget(),dt=Me.alphaTest>0,ut=Me.clearcoat>0,Qt=Me.iridescence>0;return{isWebGL2:U,shaderID:Ne,shaderName:Me.type,vertexShader:Ie,fragmentShader:qe,defines:Me.defines,customVertexShaderID:et,customFragmentShaderID:vt,isRawShaderMaterial:Me.isRawShaderMaterial===!0,glslVersion:Me.glslVersion,precision:G,instancing:Ci.isInstancedMesh===!0,instancingColor:Ci.isInstancedMesh===!0&&Ci.instanceColor!==null,supportsVertexTextures:R,outputEncoding:Be===null?u.outputEncoding:Be.isXRRenderTarget===!0?Be.texture.encoding:hp,map:!!Me.map,matcap:!!Me.matcap,envMap:!!xe,envMapMode:xe&&xe.mapping,envMapCubeUVHeight:ze,lightMap:!!Me.lightMap,aoMap:!!Me.aoMap,emissiveMap:!!Me.emissiveMap,bumpMap:!!Me.bumpMap,normalMap:!!Me.normalMap,objectSpaceNormalMap:Me.normalMapType===MI,tangentSpaceNormalMap:Me.normalMapType===up,decodeVideoTexture:!!Me.map&&Me.map.isVideoTexture===!0&&Me.map.encoding===Ss,clearcoat:ut,clearcoatMap:ut&&!!Me.clearcoatMap,clearcoatRoughnessMap:ut&&!!Me.clearcoatRoughnessMap,clearcoatNormalMap:ut&&!!Me.clearcoatNormalMap,iridescence:Qt,iridescenceMap:Qt&&!!Me.iridescenceMap,iridescenceThicknessMap:Qt&&!!Me.iridescenceThicknessMap,displacementMap:!!Me.displacementMap,roughnessMap:!!Me.roughnessMap,metalnessMap:!!Me.metalnessMap,specularMap:!!Me.specularMap,specularIntensityMap:!!Me.specularIntensityMap,specularColorMap:!!Me.specularColorMap,opaque:Me.transparent===!1&&Me.blending===Af,alphaMap:!!Me.alphaMap,alphaTest:dt,gradientMap:!!Me.gradientMap,sheen:Me.sheen>0,sheenColorMap:!!Me.sheenColorMap,sheenRoughnessMap:!!Me.sheenRoughnessMap,transmission:Me.transmission>0,transmissionMap:!!Me.transmissionMap,thicknessMap:!!Me.thicknessMap,combine:Me.combine,vertexTangents:!!Me.normalMap&&!!ce.attributes.tangent,vertexColors:Me.vertexColors,vertexAlphas:Me.vertexColors===!0&&!!ce.attributes.color&&ce.attributes.color.itemSize===4,vertexUvs:!!Me.map||!!Me.bumpMap||!!Me.normalMap||!!Me.specularMap||!!Me.alphaMap||!!Me.emissiveMap||!!Me.roughnessMap||!!Me.metalnessMap||!!Me.clearcoatMap||!!Me.clearcoatRoughnessMap||!!Me.clearcoatNormalMap||!!Me.iridescenceMap||!!Me.iridescenceThicknessMap||!!Me.displacementMap||!!Me.transmissionMap||!!Me.thicknessMap||!!Me.specularIntensityMap||!!Me.specularColorMap||!!Me.sheenColorMap||!!Me.sheenRoughnessMap,uvsVertexOnly:!(!!Me.map||!!Me.bumpMap||!!Me.normalMap||!!Me.specularMap||!!Me.alphaMap||!!Me.emissiveMap||!!Me.roughnessMap||!!Me.metalnessMap||!!Me.clearcoatNormalMap||!!Me.iridescenceMap||!!Me.iridescenceThicknessMap||Me.transmission>0||!!Me.transmissionMap||!!Me.thicknessMap||!!Me.specularIntensityMap||!!Me.specularColorMap||Me.sheen>0||!!Me.sheenColorMap||!!Me.sheenRoughnessMap)&&!!Me.displacementMap,fog:!!te,useFog:Me.fog===!0,fogExp2:te&&te.isFogExp2,flatShading:!!Me.flatShading,sizeAttenuation:Me.sizeAttenuation,logarithmicDepthBuffer:N,skinning:Ci.isSkinnedMesh===!0,morphTargets:ce.morphAttributes.position!==void 0,morphNormals:ce.morphAttributes.normal!==void 0,morphColors:ce.morphAttributes.color!==void 0,morphTargetsCount:Ve,morphTextureStride:Le,numDirLights:Ke.directional.length,numPointLights:Ke.point.length,numSpotLights:Ke.spot.length,numSpotLightMaps:Ke.spotLightMap.length,numRectAreaLights:Ke.rectArea.length,numHemiLights:Ke.hemi.length,numDirLightShadows:Ke.directionalShadowMap.length,numPointLightShadows:Ke.pointShadowMap.length,numSpotLightShadows:Ke.spotShadowMap.length,numSpotLightShadowsWithMaps:Ke.numSpotLightShadowsWithMaps,numClippingPlanes:y.numPlanes,numClipIntersection:y.numIntersection,dithering:Me.dithering,shadowMapEnabled:u.shadowMap.enabled&&Et.length>0,shadowMapType:u.shadowMap.type,toneMapping:Me.toneMapped?u.toneMapping:Vu,physicallyCorrectLights:u.physicallyCorrectLights,premultipliedAlpha:Me.premultipliedAlpha,doubleSided:Me.side===Il,flipSided:Me.side===Dc,useDepthPacking:!!Me.depthPacking,depthPacking:Me.depthPacking||0,index0AttributeName:Me.index0AttributeName,extensionDerivatives:Me.extensions&&Me.extensions.derivatives,extensionFragDepth:Me.extensions&&Me.extensions.fragDepth,extensionDrawBuffers:Me.extensions&&Me.extensions.drawBuffers,extensionShaderTextureLOD:Me.extensions&&Me.extensions.shaderTextureLOD,rendererExtensionFragDepth:U||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:U||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:U||r.has("EXT_shader_texture_lod"),customProgramCacheKey:Me.customProgramCacheKey()}}function B(Me){const Ke=[];if(Me.shaderID?Ke.push(Me.shaderID):(Ke.push(Me.customVertexShaderID),Ke.push(Me.customFragmentShaderID)),Me.defines!==void 0)for(const Et in Me.defines)Ke.push(Et),Ke.push(Me.defines[Et]);return Me.isRawShaderMaterial===!1&&(ae(Ke,Me),le(Ke,Me),Ke.push(u.outputEncoding)),Ke.push(Me.customProgramCacheKey),Ke.join()}function ae(Me,Ke){Me.push(Ke.precision),Me.push(Ke.outputEncoding),Me.push(Ke.envMapMode),Me.push(Ke.envMapCubeUVHeight),Me.push(Ke.combine),Me.push(Ke.vertexUvs),Me.push(Ke.fogExp2),Me.push(Ke.sizeAttenuation),Me.push(Ke.morphTargetsCount),Me.push(Ke.morphAttributeCount),Me.push(Ke.numDirLights),Me.push(Ke.numPointLights),Me.push(Ke.numSpotLights),Me.push(Ke.numSpotLightMaps),Me.push(Ke.numHemiLights),Me.push(Ke.numRectAreaLights),Me.push(Ke.numDirLightShadows),Me.push(Ke.numPointLightShadows),Me.push(Ke.numSpotLightShadows),Me.push(Ke.numSpotLightShadowsWithMaps),Me.push(Ke.shadowMapType),Me.push(Ke.toneMapping),Me.push(Ke.numClippingPlanes),Me.push(Ke.numClipIntersection),Me.push(Ke.depthPacking)}function le(Me,Ke){i.disableAll(),Ke.isWebGL2&&i.enable(0),Ke.supportsVertexTextures&&i.enable(1),Ke.instancing&&i.enable(2),Ke.instancingColor&&i.enable(3),Ke.map&&i.enable(4),Ke.matcap&&i.enable(5),Ke.envMap&&i.enable(6),Ke.lightMap&&i.enable(7),Ke.aoMap&&i.enable(8),Ke.emissiveMap&&i.enable(9),Ke.bumpMap&&i.enable(10),Ke.normalMap&&i.enable(11),Ke.objectSpaceNormalMap&&i.enable(12),Ke.tangentSpaceNormalMap&&i.enable(13),Ke.clearcoat&&i.enable(14),Ke.clearcoatMap&&i.enable(15),Ke.clearcoatRoughnessMap&&i.enable(16),Ke.clearcoatNormalMap&&i.enable(17),Ke.iridescence&&i.enable(18),Ke.iridescenceMap&&i.enable(19),Ke.iridescenceThicknessMap&&i.enable(20),Ke.displacementMap&&i.enable(21),Ke.specularMap&&i.enable(22),Ke.roughnessMap&&i.enable(23),Ke.metalnessMap&&i.enable(24),Ke.gradientMap&&i.enable(25),Ke.alphaMap&&i.enable(26),Ke.alphaTest&&i.enable(27),Ke.vertexColors&&i.enable(28),Ke.vertexAlphas&&i.enable(29),Ke.vertexUvs&&i.enable(30),Ke.vertexTangents&&i.enable(31),Ke.uvsVertexOnly&&i.enable(32),Me.push(i.mask),i.disableAll(),Ke.fog&&i.enable(0),Ke.useFog&&i.enable(1),Ke.flatShading&&i.enable(2),Ke.logarithmicDepthBuffer&&i.enable(3),Ke.skinning&&i.enable(4),Ke.morphTargets&&i.enable(5),Ke.morphNormals&&i.enable(6),Ke.morphColors&&i.enable(7),Ke.premultipliedAlpha&&i.enable(8),Ke.shadowMapEnabled&&i.enable(9),Ke.physicallyCorrectLights&&i.enable(10),Ke.doubleSided&&i.enable(11),Ke.flipSided&&i.enable(12),Ke.useDepthPacking&&i.enable(13),Ke.dithering&&i.enable(14),Ke.specularIntensityMap&&i.enable(15),Ke.specularColorMap&&i.enable(16),Ke.transmission&&i.enable(17),Ke.transmissionMap&&i.enable(18),Ke.thicknessMap&&i.enable(19),Ke.sheen&&i.enable(20),Ke.sheenColorMap&&i.enable(21),Ke.sheenRoughnessMap&&i.enable(22),Ke.decodeVideoTexture&&i.enable(23),Ke.opaque&&i.enable(24),Me.push(i.mask)}function Ae(Me){const Ke=J[Me.type];let Et;if(Ke){const oi=Fl[Ke];Et=_f.clone(oi.uniforms)}else Et=Me.uniforms;return Et}function we(Me,Ke){let Et;for(let oi=0,Ci=D.length;oi<Ci;oi++){const te=D[oi];if(te.cacheKey===Ke){Et=te,++Et.usedTimes;break}}return Et===void 0&&(Et=new Y6(u,Ke,Me,p),D.push(Et)),Et}function me(Me){if(--Me.usedTimes===0){const Ke=D.indexOf(Me);D[Ke]=D[D.length-1],D.pop(),Me.destroy()}}function Pe(Me){C.remove(Me)}function it(){C.dispose()}return{getParameters:Y,getProgramCacheKey:B,getUniforms:Ae,acquireProgram:we,releaseProgram:me,releaseShaderCache:Pe,programs:D,dispose:it}}function nN(){let u=new WeakMap;function e(p){let y=u.get(p);return y===void 0&&(y={},u.set(p,y)),y}function t(p){u.delete(p)}function r(p,y,i){u.get(p)[y]=i}function c(){u=new WeakMap}return{get:e,remove:t,update:r,dispose:c}}function rN(u,e){return u.groupOrder!==e.groupOrder?u.groupOrder-e.groupOrder:u.renderOrder!==e.renderOrder?u.renderOrder-e.renderOrder:u.material.id!==e.material.id?u.material.id-e.material.id:u.z!==e.z?u.z-e.z:u.id-e.id}function hT(u,e){return u.groupOrder!==e.groupOrder?u.groupOrder-e.groupOrder:u.renderOrder!==e.renderOrder?u.renderOrder-e.renderOrder:u.z!==e.z?e.z-u.z:u.id-e.id}function uT(){const u=[];let e=0;const t=[],r=[],c=[];function p(){e=0,t.length=0,r.length=0,c.length=0}function y(N,R,G,J,Y,B){let ae=u[e];return ae===void 0?(ae={id:N.id,object:N,geometry:R,material:G,groupOrder:J,renderOrder:N.renderOrder,z:Y,group:B},u[e]=ae):(ae.id=N.id,ae.object=N,ae.geometry=R,ae.material=G,ae.groupOrder=J,ae.renderOrder=N.renderOrder,ae.z=Y,ae.group=B),e++,ae}function i(N,R,G,J,Y,B){const ae=y(N,R,G,J,Y,B);G.transmission>0?r.push(ae):G.transparent===!0?c.push(ae):t.push(ae)}function C(N,R,G,J,Y,B){const ae=y(N,R,G,J,Y,B);G.transmission>0?r.unshift(ae):G.transparent===!0?c.unshift(ae):t.unshift(ae)}function D(N,R){t.length>1&&t.sort(N||rN),r.length>1&&r.sort(R||hT),c.length>1&&c.sort(R||hT)}function U(){for(let N=e,R=u.length;N<R;N++){const G=u[N];if(G.id===null)break;G.id=null,G.object=null,G.geometry=null,G.material=null,G.group=null}}return{opaque:t,transmissive:r,transparent:c,init:p,push:i,unshift:C,finish:U,sort:D}}function sN(){let u=new WeakMap;function e(r,c){const p=u.get(r);let y;return p===void 0?(y=new uT,u.set(r,[y])):c>=p.length?(y=new uT,p.push(y)):y=p[c],y}function t(){u=new WeakMap}return{get:e,dispose:t}}function oN(){const u={};return{get:function(e){if(u[e.id]!==void 0)return u[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ft,color:new Dn};break;case"SpotLight":t={position:new ft,direction:new ft,color:new Dn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ft,color:new Dn,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ft,skyColor:new Dn,groundColor:new Dn};break;case"RectAreaLight":t={color:new Dn,position:new ft,halfWidth:new ft,halfHeight:new ft};break}return u[e.id]=t,t}}}function aN(){const u={};return{get:function(e){if(u[e.id]!==void 0)return u[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Di};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Di};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Di,shadowCameraNear:1,shadowCameraFar:1e3};break}return u[e.id]=t,t}}}let lN=0;function cN(u,e){return(e.castShadow?2:0)-(u.castShadow?2:0)+(e.map?1:0)-(u.map?1:0)}function hN(u,e){const t=new oN,r=aN(),c={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let U=0;U<9;U++)c.probe.push(new ft);const p=new ft,y=new lr,i=new lr;function C(U,N){let R=0,G=0,J=0;for(let oi=0;oi<9;oi++)c.probe[oi].set(0,0,0);let Y=0,B=0,ae=0,le=0,Ae=0,we=0,me=0,Pe=0,it=0,Me=0;U.sort(cN);const Ke=N!==!0?Math.PI:1;for(let oi=0,Ci=U.length;oi<Ci;oi++){const te=U[oi],ce=te.color,ye=te.intensity,xe=te.distance,ze=te.shadow&&te.shadow.map?te.shadow.map.texture:null;if(te.isAmbientLight)R+=ce.r*ye*Ke,G+=ce.g*ye*Ke,J+=ce.b*ye*Ke;else if(te.isLightProbe)for(let Ne=0;Ne<9;Ne++)c.probe[Ne].addScaledVector(te.sh.coefficients[Ne],ye);else if(te.isDirectionalLight){const Ne=t.get(te);if(Ne.color.copy(te.color).multiplyScalar(te.intensity*Ke),te.castShadow){const Ge=te.shadow,Ve=r.get(te);Ve.shadowBias=Ge.bias,Ve.shadowNormalBias=Ge.normalBias,Ve.shadowRadius=Ge.radius,Ve.shadowMapSize=Ge.mapSize,c.directionalShadow[Y]=Ve,c.directionalShadowMap[Y]=ze,c.directionalShadowMatrix[Y]=te.shadow.matrix,we++}c.directional[Y]=Ne,Y++}else if(te.isSpotLight){const Ne=t.get(te);Ne.position.setFromMatrixPosition(te.matrixWorld),Ne.color.copy(ce).multiplyScalar(ye*Ke),Ne.distance=xe,Ne.coneCos=Math.cos(te.angle),Ne.penumbraCos=Math.cos(te.angle*(1-te.penumbra)),Ne.decay=te.decay,c.spot[ae]=Ne;const Ge=te.shadow;if(te.map&&(c.spotLightMap[it]=te.map,it++,Ge.updateMatrices(te),te.castShadow&&Me++),c.spotLightMatrix[ae]=Ge.matrix,te.castShadow){const Ve=r.get(te);Ve.shadowBias=Ge.bias,Ve.shadowNormalBias=Ge.normalBias,Ve.shadowRadius=Ge.radius,Ve.shadowMapSize=Ge.mapSize,c.spotShadow[ae]=Ve,c.spotShadowMap[ae]=ze,Pe++}ae++}else if(te.isRectAreaLight){const Ne=t.get(te);Ne.color.copy(ce).multiplyScalar(ye),Ne.halfWidth.set(te.width*.5,0,0),Ne.halfHeight.set(0,te.height*.5,0),c.rectArea[le]=Ne,le++}else if(te.isPointLight){const Ne=t.get(te);if(Ne.color.copy(te.color).multiplyScalar(te.intensity*Ke),Ne.distance=te.distance,Ne.decay=te.decay,te.castShadow){const Ge=te.shadow,Ve=r.get(te);Ve.shadowBias=Ge.bias,Ve.shadowNormalBias=Ge.normalBias,Ve.shadowRadius=Ge.radius,Ve.shadowMapSize=Ge.mapSize,Ve.shadowCameraNear=Ge.camera.near,Ve.shadowCameraFar=Ge.camera.far,c.pointShadow[B]=Ve,c.pointShadowMap[B]=ze,c.pointShadowMatrix[B]=te.shadow.matrix,me++}c.point[B]=Ne,B++}else if(te.isHemisphereLight){const Ne=t.get(te);Ne.skyColor.copy(te.color).multiplyScalar(ye*Ke),Ne.groundColor.copy(te.groundColor).multiplyScalar(ye*Ke),c.hemi[Ae]=Ne,Ae++}}le>0&&(e.isWebGL2||u.has("OES_texture_float_linear")===!0?(c.rectAreaLTC1=En.LTC_FLOAT_1,c.rectAreaLTC2=En.LTC_FLOAT_2):u.has("OES_texture_half_float_linear")===!0?(c.rectAreaLTC1=En.LTC_HALF_1,c.rectAreaLTC2=En.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),c.ambient[0]=R,c.ambient[1]=G,c.ambient[2]=J;const Et=c.hash;(Et.directionalLength!==Y||Et.pointLength!==B||Et.spotLength!==ae||Et.rectAreaLength!==le||Et.hemiLength!==Ae||Et.numDirectionalShadows!==we||Et.numPointShadows!==me||Et.numSpotShadows!==Pe||Et.numSpotMaps!==it)&&(c.directional.length=Y,c.spot.length=ae,c.rectArea.length=le,c.point.length=B,c.hemi.length=Ae,c.directionalShadow.length=we,c.directionalShadowMap.length=we,c.pointShadow.length=me,c.pointShadowMap.length=me,c.spotShadow.length=Pe,c.spotShadowMap.length=Pe,c.directionalShadowMatrix.length=we,c.pointShadowMatrix.length=me,c.spotLightMatrix.length=Pe+it-Me,c.spotLightMap.length=it,c.numSpotLightShadowsWithMaps=Me,Et.directionalLength=Y,Et.pointLength=B,Et.spotLength=ae,Et.rectAreaLength=le,Et.hemiLength=Ae,Et.numDirectionalShadows=we,Et.numPointShadows=me,Et.numSpotShadows=Pe,Et.numSpotMaps=it,c.version=lN++)}function D(U,N){let R=0,G=0,J=0,Y=0,B=0;const ae=N.matrixWorldInverse;for(let le=0,Ae=U.length;le<Ae;le++){const we=U[le];if(we.isDirectionalLight){const me=c.directional[R];me.direction.setFromMatrixPosition(we.matrixWorld),p.setFromMatrixPosition(we.target.matrixWorld),me.direction.sub(p),me.direction.transformDirection(ae),R++}else if(we.isSpotLight){const me=c.spot[J];me.position.setFromMatrixPosition(we.matrixWorld),me.position.applyMatrix4(ae),me.direction.setFromMatrixPosition(we.matrixWorld),p.setFromMatrixPosition(we.target.matrixWorld),me.direction.sub(p),me.direction.transformDirection(ae),J++}else if(we.isRectAreaLight){const me=c.rectArea[Y];me.position.setFromMatrixPosition(we.matrixWorld),me.position.applyMatrix4(ae),i.identity(),y.copy(we.matrixWorld),y.premultiply(ae),i.extractRotation(y),me.halfWidth.set(we.width*.5,0,0),me.halfHeight.set(0,we.height*.5,0),me.halfWidth.applyMatrix4(i),me.halfHeight.applyMatrix4(i),Y++}else if(we.isPointLight){const me=c.point[G];me.position.setFromMatrixPosition(we.matrixWorld),me.position.applyMatrix4(ae),G++}else if(we.isHemisphereLight){const me=c.hemi[B];me.direction.setFromMatrixPosition(we.matrixWorld),me.direction.transformDirection(ae),B++}}}return{setup:C,setupView:D,state:c}}function AT(u,e){const t=new hN(u,e),r=[],c=[];function p(){r.length=0,c.length=0}function y(N){r.push(N)}function i(N){c.push(N)}function C(N){t.setup(r,N)}function D(N){t.setupView(r,N)}return{init:p,state:{lightsArray:r,shadowsArray:c,lights:t},setupLights:C,setupLightsView:D,pushLight:y,pushShadow:i}}function uN(u,e){let t=new WeakMap;function r(p,y=0){const i=t.get(p);let C;return i===void 0?(C=new AT(u,e),t.set(p,[C])):y>=i.length?(C=new AT(u,e),i.push(C)):C=i[y],C}function c(){t=new WeakMap}return{get:r,dispose:c}}class G2 extends ol{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=TI,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class W2 extends ol{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new ft,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const AN=`void main() {
- gl_Position = vec4( position, 1.0 );
- }`,dN=`uniform sampler2D shadow_pass;
- uniform vec2 resolution;
- uniform float radius;
- #include <packing>
- void main() {
- const float samples = float( VSM_SAMPLES );
- float mean = 0.0;
- float squared_mean = 0.0;
- float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
- float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
- for ( float i = 0.0; i < samples; i ++ ) {
- float uvOffset = uvStart + i * uvStride;
- #ifdef HORIZONTAL_PASS
- vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
- mean += distribution.x;
- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
- #else
- float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
- mean += depth;
- squared_mean += depth * depth;
- #endif
- }
- mean = mean / samples;
- squared_mean = squared_mean / samples;
- float std_dev = sqrt( squared_mean - mean * mean );
- gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
- }`;function pN(u,e,t){let r=new Gv;const c=new Di,p=new Di,y=new ls,i=new G2({depthPacking:SI}),C=new W2,D={},U=t.maxTextureSize,N={0:Dc,1:ju,2:Il},R=new ko({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Di},radius:{value:4}},vertexShader:AN,fragmentShader:dN}),G=R.clone();G.defines.HORIZONTAL_PASS=1;const J=new br;J.setAttribute("position",new ds(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const Y=new is(J,R),B=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=L2,this.render=function(we,me,Pe){if(B.enabled===!1||B.autoUpdate===!1&&B.needsUpdate===!1||we.length===0)return;const it=u.getRenderTarget(),Me=u.getActiveCubeFace(),Ke=u.getActiveMipmapLevel(),Et=u.state;Et.setBlending(KA),Et.buffers.color.setClear(1,1,1,1),Et.buffers.depth.setTest(!0),Et.setScissorTest(!1);for(let oi=0,Ci=we.length;oi<Ci;oi++){const te=we[oi],ce=te.shadow;if(ce===void 0){console.warn("THREE.WebGLShadowMap:",te,"has no shadow.");continue}if(ce.autoUpdate===!1&&ce.needsUpdate===!1)continue;c.copy(ce.mapSize);const ye=ce.getFrameExtents();if(c.multiply(ye),p.copy(ce.mapSize),(c.x>U||c.y>U)&&(c.x>U&&(p.x=Math.floor(U/ye.x),c.x=p.x*ye.x,ce.mapSize.x=p.x),c.y>U&&(p.y=Math.floor(U/ye.y),c.y=p.y*ye.y,ce.mapSize.y=p.y)),ce.map===null){const ze=this.type!==Dm?{minFilter:Co,magFilter:Co}:{};ce.map=new Oa(c.x,c.y,ze),ce.map.texture.name=te.name+".shadowMap",ce.camera.updateProjectionMatrix()}u.setRenderTarget(ce.map),u.clear();const xe=ce.getViewportCount();for(let ze=0;ze<xe;ze++){const Ne=ce.getViewport(ze);y.set(p.x*Ne.x,p.y*Ne.y,p.x*Ne.z,p.y*Ne.w),Et.viewport(y),ce.updateMatrices(te,ze),r=ce.getFrustum(),Ae(me,Pe,ce.camera,te,this.type)}ce.isPointLightShadow!==!0&&this.type===Dm&&ae(ce,Pe),ce.needsUpdate=!1}B.needsUpdate=!1,u.setRenderTarget(it,Me,Ke)};function ae(we,me){const Pe=e.update(Y);R.defines.VSM_SAMPLES!==we.blurSamples&&(R.defines.VSM_SAMPLES=we.blurSamples,G.defines.VSM_SAMPLES=we.blurSamples,R.needsUpdate=!0,G.needsUpdate=!0),we.mapPass===null&&(we.mapPass=new Oa(c.x,c.y)),R.uniforms.shadow_pass.value=we.map.texture,R.uniforms.resolution.value=we.mapSize,R.uniforms.radius.value=we.radius,u.setRenderTarget(we.mapPass),u.clear(),u.renderBufferDirect(me,null,Pe,R,Y,null),G.uniforms.shadow_pass.value=we.mapPass.texture,G.uniforms.resolution.value=we.mapSize,G.uniforms.radius.value=we.radius,u.setRenderTarget(we.map),u.clear(),u.renderBufferDirect(me,null,Pe,G,Y,null)}function le(we,me,Pe,it,Me,Ke){let Et=null;const oi=Pe.isPointLight===!0?we.customDistanceMaterial:we.customDepthMaterial;if(oi!==void 0)Et=oi;else if(Et=Pe.isPointLight===!0?C:i,u.localClippingEnabled&&me.clipShadows===!0&&Array.isArray(me.clippingPlanes)&&me.clippingPlanes.length!==0||me.displacementMap&&me.displacementScale!==0||me.alphaMap&&me.alphaTest>0||me.map&&me.alphaTest>0){const Ci=Et.uuid,te=me.uuid;let ce=D[Ci];ce===void 0&&(ce={},D[Ci]=ce);let ye=ce[te];ye===void 0&&(ye=Et.clone(),ce[te]=ye),Et=ye}return Et.visible=me.visible,Et.wireframe=me.wireframe,Ke===Dm?Et.side=me.shadowSide!==null?me.shadowSide:me.side:Et.side=me.shadowSide!==null?me.shadowSide:N[me.side],Et.alphaMap=me.alphaMap,Et.alphaTest=me.alphaTest,Et.map=me.map,Et.clipShadows=me.clipShadows,Et.clippingPlanes=me.clippingPlanes,Et.clipIntersection=me.clipIntersection,Et.displacementMap=me.displacementMap,Et.displacementScale=me.displacementScale,Et.displacementBias=me.displacementBias,Et.wireframeLinewidth=me.wireframeLinewidth,Et.linewidth=me.linewidth,Pe.isPointLight===!0&&Et.isMeshDistanceMaterial===!0&&(Et.referencePosition.setFromMatrixPosition(Pe.matrixWorld),Et.nearDistance=it,Et.farDistance=Me),Et}function Ae(we,me,Pe,it,Me){if(we.visible===!1)return;if(we.layers.test(me.layers)&&(we.isMesh||we.isLine||we.isPoints)&&(we.castShadow||we.receiveShadow&&Me===Dm)&&(!we.frustumCulled||r.intersectsObject(we))){we.modelViewMatrix.multiplyMatrices(Pe.matrixWorldInverse,we.matrixWorld);const oi=e.update(we),Ci=we.material;if(Array.isArray(Ci)){const te=oi.groups;for(let ce=0,ye=te.length;ce<ye;ce++){const xe=te[ce],ze=Ci[xe.materialIndex];if(ze&&ze.visible){const Ne=le(we,ze,it,Pe.near,Pe.far,Me);u.renderBufferDirect(Pe,null,oi,Ne,we,xe)}}}else if(Ci.visible){const te=le(we,Ci,it,Pe.near,Pe.far,Me);u.renderBufferDirect(Pe,null,oi,te,we,null)}}const Et=we.children;for(let oi=0,Ci=Et.length;oi<Ci;oi++)Ae(Et[oi],me,Pe,it,Me)}}function fN(u,e,t){const r=t.isWebGL2;function c(){let Ot=!1;const vi=new ls;let Wi=null;const Ui=new ls(0,0,0,0);return{setMask:function(Pn){Wi!==Pn&&!Ot&&(u.colorMask(Pn,Pn,Pn,Pn),Wi=Pn)},setLocked:function(Pn){Ot=Pn},setClear:function(Pn,qn,Hr,fr,kr){kr===!0&&(Pn*=fr,qn*=fr,Hr*=fr),vi.set(Pn,qn,Hr,fr),Ui.equals(vi)===!1&&(u.clearColor(Pn,qn,Hr,fr),Ui.copy(vi))},reset:function(){Ot=!1,Wi=null,Ui.set(-1,0,0,0)}}}function p(){let Ot=!1,vi=null,Wi=null,Ui=null;return{setTest:function(Pn){Pn?dt(2929):ut(2929)},setMask:function(Pn){vi!==Pn&&!Ot&&(u.depthMask(Pn),vi=Pn)},setFunc:function(Pn){if(Wi!==Pn){switch(Pn){case XM:u.depthFunc(512);break;case qM:u.depthFunc(519);break;case YM:u.depthFunc(513);break;case Av:u.depthFunc(515);break;case JM:u.depthFunc(514);break;case eI:u.depthFunc(518);break;case tI:u.depthFunc(516);break;case iI:u.depthFunc(517);break;default:u.depthFunc(515)}Wi=Pn}},setLocked:function(Pn){Ot=Pn},setClear:function(Pn){Ui!==Pn&&(u.clearDepth(Pn),Ui=Pn)},reset:function(){Ot=!1,vi=null,Wi=null,Ui=null}}}function y(){let Ot=!1,vi=null,Wi=null,Ui=null,Pn=null,qn=null,Hr=null,fr=null,kr=null;return{setTest:function(Qn){Ot||(Qn?dt(2960):ut(2960))},setMask:function(Qn){vi!==Qn&&!Ot&&(u.stencilMask(Qn),vi=Qn)},setFunc:function(Qn,zs,ot){(Wi!==Qn||Ui!==zs||Pn!==ot)&&(u.stencilFunc(Qn,zs,ot),Wi=Qn,Ui=zs,Pn=ot)},setOp:function(Qn,zs,ot){(qn!==Qn||Hr!==zs||fr!==ot)&&(u.stencilOp(Qn,zs,ot),qn=Qn,Hr=zs,fr=ot)},setLocked:function(Qn){Ot=Qn},setClear:function(Qn){kr!==Qn&&(u.clearStencil(Qn),kr=Qn)},reset:function(){Ot=!1,vi=null,Wi=null,Ui=null,Pn=null,qn=null,Hr=null,fr=null,kr=null}}}const i=new c,C=new p,D=new y,U=new WeakMap,N=new WeakMap;let R={},G={},J=new WeakMap,Y=[],B=null,ae=!1,le=null,Ae=null,we=null,me=null,Pe=null,it=null,Me=null,Ke=!1,Et=null,oi=null,Ci=null,te=null,ce=null;const ye=u.getParameter(35661);let xe=!1,ze=0;const Ne=u.getParameter(7938);Ne.indexOf("WebGL")!==-1?(ze=parseFloat(/^WebGL (\d)/.exec(Ne)[1]),xe=ze>=1):Ne.indexOf("OpenGL ES")!==-1&&(ze=parseFloat(/^OpenGL ES (\d)/.exec(Ne)[1]),xe=ze>=2);let Ge=null,Ve={};const Le=u.getParameter(3088),Ie=u.getParameter(2978),qe=new ls().fromArray(Le),et=new ls().fromArray(Ie);function vt(Ot,vi,Wi){const Ui=new Uint8Array(4),Pn=u.createTexture();u.bindTexture(Ot,Pn),u.texParameteri(Ot,10241,9728),u.texParameteri(Ot,10240,9728);for(let qn=0;qn<Wi;qn++)u.texImage2D(vi+qn,0,6408,1,1,0,6408,5121,Ui);return Pn}const Be={};Be[3553]=vt(3553,3553,1),Be[34067]=vt(34067,34069,6),i.setClear(0,0,0,1),C.setClear(1),D.setClear(0),dt(2929),C.setFunc(Av),fi(!1),Gi(Db),dt(2884),Xt(KA);function dt(Ot){R[Ot]!==!0&&(u.enable(Ot),R[Ot]=!0)}function ut(Ot){R[Ot]!==!1&&(u.disable(Ot),R[Ot]=!1)}function Qt(Ot,vi){return G[Ot]!==vi?(u.bindFramebuffer(Ot,vi),G[Ot]=vi,r&&(Ot===36009&&(G[36160]=vi),Ot===36160&&(G[36009]=vi)),!0):!1}function Wt(Ot,vi){let Wi=Y,Ui=!1;if(Ot)if(Wi=J.get(vi),Wi===void 0&&(Wi=[],J.set(vi,Wi)),Ot.isWebGLMultipleRenderTargets){const Pn=Ot.texture;if(Wi.length!==Pn.length||Wi[0]!==36064){for(let qn=0,Hr=Pn.length;qn<Hr;qn++)Wi[qn]=36064+qn;Wi.length=Pn.length,Ui=!0}}else Wi[0]!==36064&&(Wi[0]=36064,Ui=!0);else Wi[0]!==1029&&(Wi[0]=1029,Ui=!0);Ui&&(t.isWebGL2?u.drawBuffers(Wi):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Wi))}function Nt(Ot){return B!==Ot?(u.useProgram(Ot),B=Ot,!0):!1}const Ct={[Jp]:32774,[OM]:32778,[NM]:32779};if(r)Ct[Rb]=32775,Ct[zb]=32776;else{const Ot=e.get("EXT_blend_minmax");Ot!==null&&(Ct[Rb]=Ot.MIN_EXT,Ct[zb]=Ot.MAX_EXT)}const Ft={[QM]:0,[VM]:1,[HM]:768,[D2]:770,[ZM]:776,[KM]:774,[WM]:772,[GM]:769,[P2]:771,[$M]:775,[jM]:773};function Xt(Ot,vi,Wi,Ui,Pn,qn,Hr,fr){if(Ot===KA){ae===!0&&(ut(3042),ae=!1);return}if(ae===!1&&(dt(3042),ae=!0),Ot!==kM){if(Ot!==le||fr!==Ke){if((Ae!==Jp||Pe!==Jp)&&(u.blendEquation(32774),Ae=Jp,Pe=Jp),fr)switch(Ot){case Af:u.blendFuncSeparate(1,771,1,771);break;case uv:u.blendFunc(1,1);break;case Pb:u.blendFuncSeparate(0,769,0,1);break;case Ub:u.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",Ot);break}else switch(Ot){case Af:u.blendFuncSeparate(770,771,1,771);break;case uv:u.blendFunc(770,1);break;case Pb:u.blendFuncSeparate(0,769,0,1);break;case Ub:u.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",Ot);break}we=null,me=null,it=null,Me=null,le=Ot,Ke=fr}return}Pn=Pn||vi,qn=qn||Wi,Hr=Hr||Ui,(vi!==Ae||Pn!==Pe)&&(u.blendEquationSeparate(Ct[vi],Ct[Pn]),Ae=vi,Pe=Pn),(Wi!==we||Ui!==me||qn!==it||Hr!==Me)&&(u.blendFuncSeparate(Ft[Wi],Ft[Ui],Ft[qn],Ft[Hr]),we=Wi,me=Ui,it=qn,Me=Hr),le=Ot,Ke=!1}function mi(Ot,vi){Ot.side===Il?ut(2884):dt(2884);let Wi=Ot.side===Dc;vi&&(Wi=!Wi),fi(Wi),Ot.blending===Af&&Ot.transparent===!1?Xt(KA):Xt(Ot.blending,Ot.blendEquation,Ot.blendSrc,Ot.blendDst,Ot.blendEquationAlpha,Ot.blendSrcAlpha,Ot.blendDstAlpha,Ot.premultipliedAlpha),C.setFunc(Ot.depthFunc),C.setTest(Ot.depthTest),C.setMask(Ot.depthWrite),i.setMask(Ot.colorWrite);const Ui=Ot.stencilWrite;D.setTest(Ui),Ui&&(D.setMask(Ot.stencilWriteMask),D.setFunc(Ot.stencilFunc,Ot.stencilRef,Ot.stencilFuncMask),D.setOp(Ot.stencilFail,Ot.stencilZFail,Ot.stencilZPass)),Qi(Ot.polygonOffset,Ot.polygonOffsetFactor,Ot.polygonOffsetUnits),Ot.alphaToCoverage===!0?dt(32926):ut(32926)}function fi(Ot){Et!==Ot&&(Ot?u.frontFace(2304):u.frontFace(2305),Et=Ot)}function Gi(Ot){Ot!==UM?(dt(2884),Ot!==oi&&(Ot===Db?u.cullFace(1029):Ot===RM?u.cullFace(1028):u.cullFace(1032))):ut(2884),oi=Ot}function wn(Ot){Ot!==Ci&&(xe&&u.lineWidth(Ot),Ci=Ot)}function Qi(Ot,vi,Wi){Ot?(dt(32823),(te!==vi||ce!==Wi)&&(u.polygonOffset(vi,Wi),te=vi,ce=Wi)):ut(32823)}function Gn(Ot){Ot?dt(3089):ut(3089)}function kn(Ot){Ot===void 0&&(Ot=33984+ye-1),Ge!==Ot&&(u.activeTexture(Ot),Ge=Ot)}function yt(Ot,vi,Wi){Wi===void 0&&(Ge===null?Wi=33984+ye-1:Wi=Ge);let Ui=Ve[Wi];Ui===void 0&&(Ui={type:void 0,texture:void 0},Ve[Wi]=Ui),(Ui.type!==Ot||Ui.texture!==vi)&&(Ge!==Wi&&(u.activeTexture(Wi),Ge=Wi),u.bindTexture(Ot,vi||Be[Ot]),Ui.type=Ot,Ui.texture=vi)}function st(){const Ot=Ve[Ge];Ot!==void 0&&Ot.type!==void 0&&(u.bindTexture(Ot.type,null),Ot.type=void 0,Ot.texture=void 0)}function ti(){try{u.compressedTexImage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function Ni(){try{u.compressedTexImage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function qi(){try{u.texSubImage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function en(){try{u.texSubImage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function $t(){try{u.compressedTexSubImage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function at(){try{u.compressedTexSubImage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function ii(){try{u.texStorage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function hn(){try{u.texStorage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function Xi(){try{u.texImage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function on(){try{u.texImage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function Cn(Ot){qe.equals(Ot)===!1&&(u.scissor(Ot.x,Ot.y,Ot.z,Ot.w),qe.copy(Ot))}function Tn(Ot){et.equals(Ot)===!1&&(u.viewport(Ot.x,Ot.y,Ot.z,Ot.w),et.copy(Ot))}function nr(Ot,vi){let Wi=N.get(vi);Wi===void 0&&(Wi=new WeakMap,N.set(vi,Wi));let Ui=Wi.get(Ot);Ui===void 0&&(Ui=u.getUniformBlockIndex(vi,Ot.name),Wi.set(Ot,Ui))}function Ii(Ot,vi){const Ui=N.get(vi).get(Ot);U.get(vi)!==Ui&&(u.uniformBlockBinding(vi,Ui,Ot.__bindingPointIndex),U.set(vi,Ui))}function bn(){u.disable(3042),u.disable(2884),u.disable(2929),u.disable(32823),u.disable(3089),u.disable(2960),u.disable(32926),u.blendEquation(32774),u.blendFunc(1,0),u.blendFuncSeparate(1,0,1,0),u.colorMask(!0,!0,!0,!0),u.clearColor(0,0,0,0),u.depthMask(!0),u.depthFunc(513),u.clearDepth(1),u.stencilMask(4294967295),u.stencilFunc(519,0,4294967295),u.stencilOp(7680,7680,7680),u.clearStencil(0),u.cullFace(1029),u.frontFace(2305),u.polygonOffset(0,0),u.activeTexture(33984),u.bindFramebuffer(36160,null),r===!0&&(u.bindFramebuffer(36009,null),u.bindFramebuffer(36008,null)),u.useProgram(null),u.lineWidth(1),u.scissor(0,0,u.canvas.width,u.canvas.height),u.viewport(0,0,u.canvas.width,u.canvas.height),R={},Ge=null,Ve={},G={},J=new WeakMap,Y=[],B=null,ae=!1,le=null,Ae=null,we=null,me=null,Pe=null,it=null,Me=null,Ke=!1,Et=null,oi=null,Ci=null,te=null,ce=null,qe.set(0,0,u.canvas.width,u.canvas.height),et.set(0,0,u.canvas.width,u.canvas.height),i.reset(),C.reset(),D.reset()}return{buffers:{color:i,depth:C,stencil:D},enable:dt,disable:ut,bindFramebuffer:Qt,drawBuffers:Wt,useProgram:Nt,setBlending:Xt,setMaterial:mi,setFlipSided:fi,setCullFace:Gi,setLineWidth:wn,setPolygonOffset:Qi,setScissorTest:Gn,activeTexture:kn,bindTexture:yt,unbindTexture:st,compressedTexImage2D:ti,compressedTexImage3D:Ni,texImage2D:Xi,texImage3D:on,updateUBOMapping:nr,uniformBlockBinding:Ii,texStorage2D:ii,texStorage3D:hn,texSubImage2D:qi,texSubImage3D:en,compressedTexSubImage2D:$t,compressedTexSubImage3D:at,scissor:Cn,viewport:Tn,reset:bn}}function mN(u,e,t,r,c,p,y){const i=c.isWebGL2,C=c.maxTextures,D=c.maxCubemapSize,U=c.maxTextureSize,N=c.maxSamples,R=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,G=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),J=new WeakMap;let Y;const B=new WeakMap;let ae=!1;try{ae=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function le(yt,st){return ae?new OffscreenCanvas(yt,st):Z_("canvas")}function Ae(yt,st,ti,Ni){let qi=1;if((yt.width>Ni||yt.height>Ni)&&(qi=Ni/Math.max(yt.width,yt.height)),qi<1||st===!0)if(typeof HTMLImageElement<"u"&&yt instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&yt instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&yt instanceof ImageBitmap){const en=st?fv:Math.floor,$t=en(qi*yt.width),at=en(qi*yt.height);Y===void 0&&(Y=le($t,at));const ii=ti?le($t,at):Y;return ii.width=$t,ii.height=at,ii.getContext("2d").drawImage(yt,0,0,$t,at),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+yt.width+"x"+yt.height+") to ("+$t+"x"+at+")."),ii}else return"data"in yt&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+yt.width+"x"+yt.height+")."),yt;return yt}function we(yt){return o2(yt.width)&&o2(yt.height)}function me(yt){return i?!1:yt.wrapS!==rl||yt.wrapT!==rl||yt.minFilter!==Co&&yt.minFilter!==Xs}function Pe(yt,st){return yt.generateMipmaps&&st&&yt.minFilter!==Co&&yt.minFilter!==Xs}function it(yt){u.generateMipmap(yt)}function Me(yt,st,ti,Ni,qi=!1){if(i===!1)return st;if(yt!==null){if(u[yt]!==void 0)return u[yt];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+yt+"'")}let en=st;return st===6403&&(ti===5126&&(en=33326),ti===5131&&(en=33325),ti===5121&&(en=33321)),st===33319&&(ti===5126&&(en=33328),ti===5131&&(en=33327),ti===5121&&(en=33323)),st===6408&&(ti===5126&&(en=34836),ti===5131&&(en=34842),ti===5121&&(en=Ni===Ss&&qi===!1?35907:32856),ti===32819&&(en=32854),ti===32820&&(en=32855)),(en===33325||en===33326||en===33327||en===33328||en===34842||en===34836)&&e.get("EXT_color_buffer_float"),en}function Ke(yt,st,ti){return Pe(yt,ti)===!0||yt.isFramebufferTexture&&yt.minFilter!==Co&&yt.minFilter!==Xs?Math.log2(Math.max(st.width,st.height))+1:yt.mipmaps!==void 0&&yt.mipmaps.length>0?yt.mipmaps.length:yt.isCompressedTexture&&Array.isArray(yt.image)?st.mipmaps.length:1}function Et(yt){return yt===Co||yt===dv||yt===F_?9728:9729}function oi(yt){const st=yt.target;st.removeEventListener("dispose",oi),te(st),st.isVideoTexture&&J.delete(st)}function Ci(yt){const st=yt.target;st.removeEventListener("dispose",Ci),ye(st)}function te(yt){const st=r.get(yt);if(st.__webglInit===void 0)return;const ti=yt.source,Ni=B.get(ti);if(Ni){const qi=Ni[st.__cacheKey];qi.usedTimes--,qi.usedTimes===0&&ce(yt),Object.keys(Ni).length===0&&B.delete(ti)}r.remove(yt)}function ce(yt){const st=r.get(yt);u.deleteTexture(st.__webglTexture);const ti=yt.source,Ni=B.get(ti);delete Ni[st.__cacheKey],y.memory.textures--}function ye(yt){const st=yt.texture,ti=r.get(yt),Ni=r.get(st);if(Ni.__webglTexture!==void 0&&(u.deleteTexture(Ni.__webglTexture),y.memory.textures--),yt.depthTexture&&yt.depthTexture.dispose(),yt.isWebGLCubeRenderTarget)for(let qi=0;qi<6;qi++)u.deleteFramebuffer(ti.__webglFramebuffer[qi]),ti.__webglDepthbuffer&&u.deleteRenderbuffer(ti.__webglDepthbuffer[qi]);else{if(u.deleteFramebuffer(ti.__webglFramebuffer),ti.__webglDepthbuffer&&u.deleteRenderbuffer(ti.__webglDepthbuffer),ti.__webglMultisampledFramebuffer&&u.deleteFramebuffer(ti.__webglMultisampledFramebuffer),ti.__webglColorRenderbuffer)for(let qi=0;qi<ti.__webglColorRenderbuffer.length;qi++)ti.__webglColorRenderbuffer[qi]&&u.deleteRenderbuffer(ti.__webglColorRenderbuffer[qi]);ti.__webglDepthRenderbuffer&&u.deleteRenderbuffer(ti.__webglDepthRenderbuffer)}if(yt.isWebGLMultipleRenderTargets)for(let qi=0,en=st.length;qi<en;qi++){const $t=r.get(st[qi]);$t.__webglTexture&&(u.deleteTexture($t.__webglTexture),y.memory.textures--),r.remove(st[qi])}r.remove(st),r.remove(yt)}let xe=0;function ze(){xe=0}function Ne(){const yt=xe;return yt>=C&&console.warn("THREE.WebGLTextures: Trying to use "+yt+" texture units while this GPU supports only "+C),xe+=1,yt}function Ge(yt){const st=[];return st.push(yt.wrapS),st.push(yt.wrapT),st.push(yt.wrapR||0),st.push(yt.magFilter),st.push(yt.minFilter),st.push(yt.anisotropy),st.push(yt.internalFormat),st.push(yt.format),st.push(yt.type),st.push(yt.generateMipmaps),st.push(yt.premultiplyAlpha),st.push(yt.flipY),st.push(yt.unpackAlignment),st.push(yt.encoding),st.join()}function Ve(yt,st){const ti=r.get(yt);if(yt.isVideoTexture&&Gn(yt),yt.isRenderTargetTexture===!1&&yt.version>0&&ti.__version!==yt.version){const Ni=yt.image;if(Ni===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ni.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ut(ti,yt,st);return}}t.bindTexture(3553,ti.__webglTexture,33984+st)}function Le(yt,st){const ti=r.get(yt);if(yt.version>0&&ti.__version!==yt.version){ut(ti,yt,st);return}t.bindTexture(35866,ti.__webglTexture,33984+st)}function Ie(yt,st){const ti=r.get(yt);if(yt.version>0&&ti.__version!==yt.version){ut(ti,yt,st);return}t.bindTexture(32879,ti.__webglTexture,33984+st)}function qe(yt,st){const ti=r.get(yt);if(yt.version>0&&ti.__version!==yt.version){Qt(ti,yt,st);return}t.bindTexture(34067,ti.__webglTexture,33984+st)}const et={[HA]:10497,[rl]:33071,[H_]:33648},vt={[Co]:9728,[dv]:9984,[F_]:9986,[Xs]:9729,[R2]:9985,[lp]:9987};function Be(yt,st,ti){if(ti?(u.texParameteri(yt,10242,et[st.wrapS]),u.texParameteri(yt,10243,et[st.wrapT]),(yt===32879||yt===35866)&&u.texParameteri(yt,32882,et[st.wrapR]),u.texParameteri(yt,10240,vt[st.magFilter]),u.texParameteri(yt,10241,vt[st.minFilter])):(u.texParameteri(yt,10242,33071),u.texParameteri(yt,10243,33071),(yt===32879||yt===35866)&&u.texParameteri(yt,32882,33071),(st.wrapS!==rl||st.wrapT!==rl)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),u.texParameteri(yt,10240,Et(st.magFilter)),u.texParameteri(yt,10241,Et(st.minFilter)),st.minFilter!==Co&&st.minFilter!==Xs&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Ni=e.get("EXT_texture_filter_anisotropic");if(st.magFilter===Co||st.minFilter!==F_&&st.minFilter!==lp||st.type===GA&&e.has("OES_texture_float_linear")===!1||i===!1&&st.type===Gm&&e.has("OES_texture_half_float_linear")===!1)return;(st.anisotropy>1||r.get(st).__currentAnisotropy)&&(u.texParameterf(yt,Ni.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(st.anisotropy,c.getMaxAnisotropy())),r.get(st).__currentAnisotropy=st.anisotropy)}}function dt(yt,st){let ti=!1;yt.__webglInit===void 0&&(yt.__webglInit=!0,st.addEventListener("dispose",oi));const Ni=st.source;let qi=B.get(Ni);qi===void 0&&(qi={},B.set(Ni,qi));const en=Ge(st);if(en!==yt.__cacheKey){qi[en]===void 0&&(qi[en]={texture:u.createTexture(),usedTimes:0},y.memory.textures++,ti=!0),qi[en].usedTimes++;const $t=qi[yt.__cacheKey];$t!==void 0&&(qi[yt.__cacheKey].usedTimes--,$t.usedTimes===0&&ce(st)),yt.__cacheKey=en,yt.__webglTexture=qi[en].texture}return ti}function ut(yt,st,ti){let Ni=3553;(st.isDataArrayTexture||st.isCompressedArrayTexture)&&(Ni=35866),st.isData3DTexture&&(Ni=32879);const qi=dt(yt,st),en=st.source;t.bindTexture(Ni,yt.__webglTexture,33984+ti);const $t=r.get(en);if(en.version!==$t.__version||qi===!0){t.activeTexture(33984+ti),u.pixelStorei(37440,st.flipY),u.pixelStorei(37441,st.premultiplyAlpha),u.pixelStorei(3317,st.unpackAlignment),u.pixelStorei(37443,0);const at=me(st)&&we(st.image)===!1;let ii=Ae(st.image,at,!1,U);ii=kn(st,ii);const hn=we(ii)||i,Xi=p.convert(st.format,st.encoding);let on=p.convert(st.type),Cn=Me(st.internalFormat,Xi,on,st.encoding,st.isVideoTexture);Be(Ni,st,hn);let Tn;const nr=st.mipmaps,Ii=i&&st.isVideoTexture!==!0,bn=$t.__version===void 0||qi===!0,Ot=Ke(st,ii,hn);if(st.isDepthTexture)Cn=6402,i?st.type===GA?Cn=36012:st.type===Yd?Cn=33190:st.type===df?Cn=35056:Cn=33189:st.type===GA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),st.format===ip&&Cn===6402&&st.type!==z2&&st.type!==Yd&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),st.type=Yd,on=p.convert(st.type)),st.format===gf&&Cn===6402&&(Cn=34041,st.type!==df&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),st.type=df,on=p.convert(st.type))),bn&&(Ii?t.texStorage2D(3553,1,Cn,ii.width,ii.height):t.texImage2D(3553,0,Cn,ii.width,ii.height,0,Xi,on,null));else if(st.isDataTexture)if(nr.length>0&&hn){Ii&&bn&&t.texStorage2D(3553,Ot,Cn,nr[0].width,nr[0].height);for(let vi=0,Wi=nr.length;vi<Wi;vi++)Tn=nr[vi],Ii?t.texSubImage2D(3553,vi,0,0,Tn.width,Tn.height,Xi,on,Tn.data):t.texImage2D(3553,vi,Cn,Tn.width,Tn.height,0,Xi,on,Tn.data);st.generateMipmaps=!1}else Ii?(bn&&t.texStorage2D(3553,Ot,Cn,ii.width,ii.height),t.texSubImage2D(3553,0,0,0,ii.width,ii.height,Xi,on,ii.data)):t.texImage2D(3553,0,Cn,ii.width,ii.height,0,Xi,on,ii.data);else if(st.isCompressedTexture)if(st.isCompressedArrayTexture){Ii&&bn&&t.texStorage3D(35866,Ot,Cn,nr[0].width,nr[0].height,ii.depth);for(let vi=0,Wi=nr.length;vi<Wi;vi++)Tn=nr[vi],st.format!==Dl?Xi!==null?Ii?t.compressedTexSubImage3D(35866,vi,0,0,0,Tn.width,Tn.height,ii.depth,Xi,Tn.data,0,0):t.compressedTexImage3D(35866,vi,Cn,Tn.width,Tn.height,ii.depth,0,Tn.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ii?t.texSubImage3D(35866,vi,0,0,0,Tn.width,Tn.height,ii.depth,Xi,on,Tn.data):t.texImage3D(35866,vi,Cn,Tn.width,Tn.height,ii.depth,0,Xi,on,Tn.data)}else{Ii&&bn&&t.texStorage2D(3553,Ot,Cn,nr[0].width,nr[0].height);for(let vi=0,Wi=nr.length;vi<Wi;vi++)Tn=nr[vi],st.format!==Dl?Xi!==null?Ii?t.compressedTexSubImage2D(3553,vi,0,0,Tn.width,Tn.height,Xi,Tn.data):t.compressedTexImage2D(3553,vi,Cn,Tn.width,Tn.height,0,Tn.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ii?t.texSubImage2D(3553,vi,0,0,Tn.width,Tn.height,Xi,on,Tn.data):t.texImage2D(3553,vi,Cn,Tn.width,Tn.height,0,Xi,on,Tn.data)}else if(st.isDataArrayTexture)Ii?(bn&&t.texStorage3D(35866,Ot,Cn,ii.width,ii.height,ii.depth),t.texSubImage3D(35866,0,0,0,0,ii.width,ii.height,ii.depth,Xi,on,ii.data)):t.texImage3D(35866,0,Cn,ii.width,ii.height,ii.depth,0,Xi,on,ii.data);else if(st.isData3DTexture)Ii?(bn&&t.texStorage3D(32879,Ot,Cn,ii.width,ii.height,ii.depth),t.texSubImage3D(32879,0,0,0,0,ii.width,ii.height,ii.depth,Xi,on,ii.data)):t.texImage3D(32879,0,Cn,ii.width,ii.height,ii.depth,0,Xi,on,ii.data);else if(st.isFramebufferTexture){if(bn)if(Ii)t.texStorage2D(3553,Ot,Cn,ii.width,ii.height);else{let vi=ii.width,Wi=ii.height;for(let Ui=0;Ui<Ot;Ui++)t.texImage2D(3553,Ui,Cn,vi,Wi,0,Xi,on,null),vi>>=1,Wi>>=1}}else if(nr.length>0&&hn){Ii&&bn&&t.texStorage2D(3553,Ot,Cn,nr[0].width,nr[0].height);for(let vi=0,Wi=nr.length;vi<Wi;vi++)Tn=nr[vi],Ii?t.texSubImage2D(3553,vi,0,0,Xi,on,Tn):t.texImage2D(3553,vi,Cn,Xi,on,Tn);st.generateMipmaps=!1}else Ii?(bn&&t.texStorage2D(3553,Ot,Cn,ii.width,ii.height),t.texSubImage2D(3553,0,0,0,Xi,on,ii)):t.texImage2D(3553,0,Cn,Xi,on,ii);Pe(st,hn)&&it(Ni),$t.__version=en.version,st.onUpdate&&st.onUpdate(st)}yt.__version=st.version}function Qt(yt,st,ti){if(st.image.length!==6)return;const Ni=dt(yt,st),qi=st.source;t.bindTexture(34067,yt.__webglTexture,33984+ti);const en=r.get(qi);if(qi.version!==en.__version||Ni===!0){t.activeTexture(33984+ti),u.pixelStorei(37440,st.flipY),u.pixelStorei(37441,st.premultiplyAlpha),u.pixelStorei(3317,st.unpackAlignment),u.pixelStorei(37443,0);const $t=st.isCompressedTexture||st.image[0].isCompressedTexture,at=st.image[0]&&st.image[0].isDataTexture,ii=[];for(let vi=0;vi<6;vi++)!$t&&!at?ii[vi]=Ae(st.image[vi],!1,!0,D):ii[vi]=at?st.image[vi].image:st.image[vi],ii[vi]=kn(st,ii[vi]);const hn=ii[0],Xi=we(hn)||i,on=p.convert(st.format,st.encoding),Cn=p.convert(st.type),Tn=Me(st.internalFormat,on,Cn,st.encoding),nr=i&&st.isVideoTexture!==!0,Ii=en.__version===void 0||Ni===!0;let bn=Ke(st,hn,Xi);Be(34067,st,Xi);let Ot;if($t){nr&&Ii&&t.texStorage2D(34067,bn,Tn,hn.width,hn.height);for(let vi=0;vi<6;vi++){Ot=ii[vi].mipmaps;for(let Wi=0;Wi<Ot.length;Wi++){const Ui=Ot[Wi];st.format!==Dl?on!==null?nr?t.compressedTexSubImage2D(34069+vi,Wi,0,0,Ui.width,Ui.height,on,Ui.data):t.compressedTexImage2D(34069+vi,Wi,Tn,Ui.width,Ui.height,0,Ui.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):nr?t.texSubImage2D(34069+vi,Wi,0,0,Ui.width,Ui.height,on,Cn,Ui.data):t.texImage2D(34069+vi,Wi,Tn,Ui.width,Ui.height,0,on,Cn,Ui.data)}}}else{Ot=st.mipmaps,nr&&Ii&&(Ot.length>0&&bn++,t.texStorage2D(34067,bn,Tn,ii[0].width,ii[0].height));for(let vi=0;vi<6;vi++)if(at){nr?t.texSubImage2D(34069+vi,0,0,0,ii[vi].width,ii[vi].height,on,Cn,ii[vi].data):t.texImage2D(34069+vi,0,Tn,ii[vi].width,ii[vi].height,0,on,Cn,ii[vi].data);for(let Wi=0;Wi<Ot.length;Wi++){const Pn=Ot[Wi].image[vi].image;nr?t.texSubImage2D(34069+vi,Wi+1,0,0,Pn.width,Pn.height,on,Cn,Pn.data):t.texImage2D(34069+vi,Wi+1,Tn,Pn.width,Pn.height,0,on,Cn,Pn.data)}}else{nr?t.texSubImage2D(34069+vi,0,0,0,on,Cn,ii[vi]):t.texImage2D(34069+vi,0,Tn,on,Cn,ii[vi]);for(let Wi=0;Wi<Ot.length;Wi++){const Ui=Ot[Wi];nr?t.texSubImage2D(34069+vi,Wi+1,0,0,on,Cn,Ui.image[vi]):t.texImage2D(34069+vi,Wi+1,Tn,on,Cn,Ui.image[vi])}}}Pe(st,Xi)&&it(34067),en.__version=qi.version,st.onUpdate&&st.onUpdate(st)}yt.__version=st.version}function Wt(yt,st,ti,Ni,qi){const en=p.convert(ti.format,ti.encoding),$t=p.convert(ti.type),at=Me(ti.internalFormat,en,$t,ti.encoding);r.get(st).__hasExternalTextures||(qi===32879||qi===35866?t.texImage3D(qi,0,at,st.width,st.height,st.depth,0,en,$t,null):t.texImage2D(qi,0,at,st.width,st.height,0,en,$t,null)),t.bindFramebuffer(36160,yt),Qi(st)?R.framebufferTexture2DMultisampleEXT(36160,Ni,qi,r.get(ti).__webglTexture,0,wn(st)):(qi===3553||qi>=34069&&qi<=34074)&&u.framebufferTexture2D(36160,Ni,qi,r.get(ti).__webglTexture,0),t.bindFramebuffer(36160,null)}function Nt(yt,st,ti){if(u.bindRenderbuffer(36161,yt),st.depthBuffer&&!st.stencilBuffer){let Ni=33189;if(ti||Qi(st)){const qi=st.depthTexture;qi&&qi.isDepthTexture&&(qi.type===GA?Ni=36012:qi.type===Yd&&(Ni=33190));const en=wn(st);Qi(st)?R.renderbufferStorageMultisampleEXT(36161,en,Ni,st.width,st.height):u.renderbufferStorageMultisample(36161,en,Ni,st.width,st.height)}else u.renderbufferStorage(36161,Ni,st.width,st.height);u.framebufferRenderbuffer(36160,36096,36161,yt)}else if(st.depthBuffer&&st.stencilBuffer){const Ni=wn(st);ti&&Qi(st)===!1?u.renderbufferStorageMultisample(36161,Ni,35056,st.width,st.height):Qi(st)?R.renderbufferStorageMultisampleEXT(36161,Ni,35056,st.width,st.height):u.renderbufferStorage(36161,34041,st.width,st.height),u.framebufferRenderbuffer(36160,33306,36161,yt)}else{const Ni=st.isWebGLMultipleRenderTargets===!0?st.texture:[st.texture];for(let qi=0;qi<Ni.length;qi++){const en=Ni[qi],$t=p.convert(en.format,en.encoding),at=p.convert(en.type),ii=Me(en.internalFormat,$t,at,en.encoding),hn=wn(st);ti&&Qi(st)===!1?u.renderbufferStorageMultisample(36161,hn,ii,st.width,st.height):Qi(st)?R.renderbufferStorageMultisampleEXT(36161,hn,ii,st.width,st.height):u.renderbufferStorage(36161,ii,st.width,st.height)}}u.bindRenderbuffer(36161,null)}function Ct(yt,st){if(st&&st.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,yt),!(st.depthTexture&&st.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(st.depthTexture).__webglTexture||st.depthTexture.image.width!==st.width||st.depthTexture.image.height!==st.height)&&(st.depthTexture.image.width=st.width,st.depthTexture.image.height=st.height,st.depthTexture.needsUpdate=!0),Ve(st.depthTexture,0);const Ni=r.get(st.depthTexture).__webglTexture,qi=wn(st);if(st.depthTexture.format===ip)Qi(st)?R.framebufferTexture2DMultisampleEXT(36160,36096,3553,Ni,0,qi):u.framebufferTexture2D(36160,36096,3553,Ni,0);else if(st.depthTexture.format===gf)Qi(st)?R.framebufferTexture2DMultisampleEXT(36160,33306,3553,Ni,0,qi):u.framebufferTexture2D(36160,33306,3553,Ni,0);else throw new Error("Unknown depthTexture format")}function Ft(yt){const st=r.get(yt),ti=yt.isWebGLCubeRenderTarget===!0;if(yt.depthTexture&&!st.__autoAllocateDepthBuffer){if(ti)throw new Error("target.depthTexture not supported in Cube render targets");Ct(st.__webglFramebuffer,yt)}else if(ti){st.__webglDepthbuffer=[];for(let Ni=0;Ni<6;Ni++)t.bindFramebuffer(36160,st.__webglFramebuffer[Ni]),st.__webglDepthbuffer[Ni]=u.createRenderbuffer(),Nt(st.__webglDepthbuffer[Ni],yt,!1)}else t.bindFramebuffer(36160,st.__webglFramebuffer),st.__webglDepthbuffer=u.createRenderbuffer(),Nt(st.__webglDepthbuffer,yt,!1);t.bindFramebuffer(36160,null)}function Xt(yt,st,ti){const Ni=r.get(yt);st!==void 0&&Wt(Ni.__webglFramebuffer,yt,yt.texture,36064,3553),ti!==void 0&&Ft(yt)}function mi(yt){const st=yt.texture,ti=r.get(yt),Ni=r.get(st);yt.addEventListener("dispose",Ci),yt.isWebGLMultipleRenderTargets!==!0&&(Ni.__webglTexture===void 0&&(Ni.__webglTexture=u.createTexture()),Ni.__version=st.version,y.memory.textures++);const qi=yt.isWebGLCubeRenderTarget===!0,en=yt.isWebGLMultipleRenderTargets===!0,$t=we(yt)||i;if(qi){ti.__webglFramebuffer=[];for(let at=0;at<6;at++)ti.__webglFramebuffer[at]=u.createFramebuffer()}else{if(ti.__webglFramebuffer=u.createFramebuffer(),en)if(c.drawBuffers){const at=yt.texture;for(let ii=0,hn=at.length;ii<hn;ii++){const Xi=r.get(at[ii]);Xi.__webglTexture===void 0&&(Xi.__webglTexture=u.createTexture(),y.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(i&&yt.samples>0&&Qi(yt)===!1){const at=en?st:[st];ti.__webglMultisampledFramebuffer=u.createFramebuffer(),ti.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,ti.__webglMultisampledFramebuffer);for(let ii=0;ii<at.length;ii++){const hn=at[ii];ti.__webglColorRenderbuffer[ii]=u.createRenderbuffer(),u.bindRenderbuffer(36161,ti.__webglColorRenderbuffer[ii]);const Xi=p.convert(hn.format,hn.encoding),on=p.convert(hn.type),Cn=Me(hn.internalFormat,Xi,on,hn.encoding,yt.isXRRenderTarget===!0),Tn=wn(yt);u.renderbufferStorageMultisample(36161,Tn,Cn,yt.width,yt.height),u.framebufferRenderbuffer(36160,36064+ii,36161,ti.__webglColorRenderbuffer[ii])}u.bindRenderbuffer(36161,null),yt.depthBuffer&&(ti.__webglDepthRenderbuffer=u.createRenderbuffer(),Nt(ti.__webglDepthRenderbuffer,yt,!0)),t.bindFramebuffer(36160,null)}}if(qi){t.bindTexture(34067,Ni.__webglTexture),Be(34067,st,$t);for(let at=0;at<6;at++)Wt(ti.__webglFramebuffer[at],yt,st,36064,34069+at);Pe(st,$t)&&it(34067),t.unbindTexture()}else if(en){const at=yt.texture;for(let ii=0,hn=at.length;ii<hn;ii++){const Xi=at[ii],on=r.get(Xi);t.bindTexture(3553,on.__webglTexture),Be(3553,Xi,$t),Wt(ti.__webglFramebuffer,yt,Xi,36064+ii,3553),Pe(Xi,$t)&&it(3553)}t.unbindTexture()}else{let at=3553;(yt.isWebGL3DRenderTarget||yt.isWebGLArrayRenderTarget)&&(i?at=yt.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(at,Ni.__webglTexture),Be(at,st,$t),Wt(ti.__webglFramebuffer,yt,st,36064,at),Pe(st,$t)&&it(at),t.unbindTexture()}yt.depthBuffer&&Ft(yt)}function fi(yt){const st=we(yt)||i,ti=yt.isWebGLMultipleRenderTargets===!0?yt.texture:[yt.texture];for(let Ni=0,qi=ti.length;Ni<qi;Ni++){const en=ti[Ni];if(Pe(en,st)){const $t=yt.isWebGLCubeRenderTarget?34067:3553,at=r.get(en).__webglTexture;t.bindTexture($t,at),it($t),t.unbindTexture()}}}function Gi(yt){if(i&&yt.samples>0&&Qi(yt)===!1){const st=yt.isWebGLMultipleRenderTargets?yt.texture:[yt.texture],ti=yt.width,Ni=yt.height;let qi=16384;const en=[],$t=yt.stencilBuffer?33306:36096,at=r.get(yt),ii=yt.isWebGLMultipleRenderTargets===!0;if(ii)for(let hn=0;hn<st.length;hn++)t.bindFramebuffer(36160,at.__webglMultisampledFramebuffer),u.framebufferRenderbuffer(36160,36064+hn,36161,null),t.bindFramebuffer(36160,at.__webglFramebuffer),u.framebufferTexture2D(36009,36064+hn,3553,null,0);t.bindFramebuffer(36008,at.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,at.__webglFramebuffer);for(let hn=0;hn<st.length;hn++){en.push(36064+hn),yt.depthBuffer&&en.push($t);const Xi=at.__ignoreDepthValues!==void 0?at.__ignoreDepthValues:!1;if(Xi===!1&&(yt.depthBuffer&&(qi|=256),yt.stencilBuffer&&(qi|=1024)),ii&&u.framebufferRenderbuffer(36008,36064,36161,at.__webglColorRenderbuffer[hn]),Xi===!0&&(u.invalidateFramebuffer(36008,[$t]),u.invalidateFramebuffer(36009,[$t])),ii){const on=r.get(st[hn]).__webglTexture;u.framebufferTexture2D(36009,36064,3553,on,0)}u.blitFramebuffer(0,0,ti,Ni,0,0,ti,Ni,qi,9728),G&&u.invalidateFramebuffer(36008,en)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),ii)for(let hn=0;hn<st.length;hn++){t.bindFramebuffer(36160,at.__webglMultisampledFramebuffer),u.framebufferRenderbuffer(36160,36064+hn,36161,at.__webglColorRenderbuffer[hn]);const Xi=r.get(st[hn]).__webglTexture;t.bindFramebuffer(36160,at.__webglFramebuffer),u.framebufferTexture2D(36009,36064+hn,3553,Xi,0)}t.bindFramebuffer(36009,at.__webglMultisampledFramebuffer)}}function wn(yt){return Math.min(N,yt.samples)}function Qi(yt){const st=r.get(yt);return i&&yt.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&st.__useRenderToTexture!==!1}function Gn(yt){const st=y.render.frame;J.get(yt)!==st&&(J.set(yt,st),yt.update())}function kn(yt,st){const ti=yt.encoding,Ni=yt.format,qi=yt.type;return yt.isCompressedTexture===!0||yt.isVideoTexture===!0||yt.format===pv||ti!==hp&&(ti===Ss?i===!1?e.has("EXT_sRGB")===!0&&Ni===Dl?(yt.format=pv,yt.minFilter=Xs,yt.generateMipmaps=!1):st=N2.sRGBToLinear(st):(Ni!==Dl||qi!==cp)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",ti)),st}this.allocateTextureUnit=Ne,this.resetTextureUnits=ze,this.setTexture2D=Ve,this.setTexture2DArray=Le,this.setTexture3D=Ie,this.setTextureCube=qe,this.rebindTextures=Xt,this.setupRenderTarget=mi,this.updateRenderTargetMipmap=fi,this.updateMultisampleRenderTarget=Gi,this.setupDepthRenderbuffer=Ft,this.setupFrameBufferTexture=Wt,this.useMultisampledRTT=Qi}function HI(u,e,t){const r=t.isWebGL2;function c(p,y=null){let i;if(p===cp)return 5121;if(p===AI)return 32819;if(p===dI)return 32820;if(p===cI)return 5120;if(p===hI)return 5122;if(p===z2)return 5123;if(p===uI)return 5124;if(p===Yd)return 5125;if(p===GA)return 5126;if(p===Gm)return r?5131:(i=e.get("OES_texture_half_float"),i!==null?i.HALF_FLOAT_OES:null);if(p===pI)return 6406;if(p===Dl)return 6408;if(p===mI)return 6409;if(p===gI)return 6410;if(p===ip)return 6402;if(p===gf)return 34041;if(p===fI)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(p===pv)return i=e.get("EXT_sRGB"),i!==null?i.SRGB_ALPHA_EXT:null;if(p===_I)return 6403;if(p===yI)return 36244;if(p===xI)return 33319;if(p===vI)return 33320;if(p===wI)return 36249;if(p===jx||p===Kx||p===$x||p===Zx)if(y===Ss)if(i=e.get("WEBGL_compressed_texture_s3tc_srgb"),i!==null){if(p===jx)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(p===Kx)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(p===$x)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(p===Zx)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=e.get("WEBGL_compressed_texture_s3tc"),i!==null){if(p===jx)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(p===Kx)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(p===$x)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(p===Zx)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(p===kb||p===Ob||p===Nb||p===Qb)if(i=e.get("WEBGL_compressed_texture_pvrtc"),i!==null){if(p===kb)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(p===Ob)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(p===Nb)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(p===Qb)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(p===bI)return i=e.get("WEBGL_compressed_texture_etc1"),i!==null?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(p===Vb||p===Hb)if(i=e.get("WEBGL_compressed_texture_etc"),i!==null){if(p===Vb)return y===Ss?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(p===Hb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(p===Gb||p===Wb||p===jb||p===Kb||p===$b||p===Zb||p===Xb||p===qb||p===Yb||p===Jb||p===e2||p===t2||p===i2||p===n2)if(i=e.get("WEBGL_compressed_texture_astc"),i!==null){if(p===Gb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(p===Wb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(p===jb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(p===Kb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(p===$b)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(p===Zb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(p===Xb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(p===qb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(p===Yb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(p===Jb)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(p===e2)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(p===t2)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(p===i2)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(p===n2)return y===Ss?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(p===r2)if(i=e.get("EXT_texture_compression_bptc"),i!==null){if(p===r2)return y===Ss?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return p===df?r?34042:(i=e.get("WEBGL_depth_texture"),i!==null?i.UNSIGNED_INT_24_8_WEBGL:null):u[p]!==void 0?u[p]:null}return{convert:c}}class GI extends _a{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class As extends cs{constructor(){super(),this.isGroup=!0,this.type="Group"}}const gN={type:"move"};class Gw{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new As,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new As,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ft,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ft),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new As,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ft,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ft),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let c=null,p=null,y=null;const i=this._targetRay,C=this._grip,D=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(D&&e.hand){y=!0;for(const Y of e.hand.values()){const B=t.getJointPose(Y,r),ae=this._getHandJoint(D,Y);B!==null&&(ae.matrix.fromArray(B.transform.matrix),ae.matrix.decompose(ae.position,ae.rotation,ae.scale),ae.jointRadius=B.radius),ae.visible=B!==null}const U=D.joints["index-finger-tip"],N=D.joints["thumb-tip"],R=U.position.distanceTo(N.position),G=.02,J=.005;D.inputState.pinching&&R>G+J?(D.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!D.inputState.pinching&&R<=G-J&&(D.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else C!==null&&e.gripSpace&&(p=t.getPose(e.gripSpace,r),p!==null&&(C.matrix.fromArray(p.transform.matrix),C.matrix.decompose(C.position,C.rotation,C.scale),p.linearVelocity?(C.hasLinearVelocity=!0,C.linearVelocity.copy(p.linearVelocity)):C.hasLinearVelocity=!1,p.angularVelocity?(C.hasAngularVelocity=!0,C.angularVelocity.copy(p.angularVelocity)):C.hasAngularVelocity=!1));i!==null&&(c=t.getPose(e.targetRaySpace,r),c===null&&p!==null&&(c=p),c!==null&&(i.matrix.fromArray(c.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),c.linearVelocity?(i.hasLinearVelocity=!0,i.linearVelocity.copy(c.linearVelocity)):i.hasLinearVelocity=!1,c.angularVelocity?(i.hasAngularVelocity=!0,i.angularVelocity.copy(c.angularVelocity)):i.hasAngularVelocity=!1,this.dispatchEvent(gN)))}return i!==null&&(i.visible=c!==null),C!==null&&(C.visible=p!==null),D!==null&&(D.visible=y!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new As;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class WI extends To{constructor(e,t,r,c,p,y,i,C,D,U){if(U=U!==void 0?U:ip,U!==ip&&U!==gf)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&U===ip&&(r=Yd),r===void 0&&U===gf&&(r=df),super(null,c,p,y,i,C,U,r,D),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=i!==void 0?i:Co,this.minFilter=C!==void 0?C:Co,this.flipY=!1,this.generateMipmaps=!1}}class _N extends Xu{constructor(e,t){super();const r=this;let c=null,p=1,y=null,i="local-floor",C=null,D=null,U=null,N=null,R=null,G=null;const J=t.getContextAttributes();let Y=null,B=null;const ae=[],le=[],Ae=new Set,we=new Map,me=new _a;me.layers.enable(1),me.viewport=new ls;const Pe=new _a;Pe.layers.enable(2),Pe.viewport=new ls;const it=[me,Pe],Me=new GI;Me.layers.enable(1),Me.layers.enable(2);let Ke=null,Et=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Le){let Ie=ae[Le];return Ie===void 0&&(Ie=new Gw,ae[Le]=Ie),Ie.getTargetRaySpace()},this.getControllerGrip=function(Le){let Ie=ae[Le];return Ie===void 0&&(Ie=new Gw,ae[Le]=Ie),Ie.getGripSpace()},this.getHand=function(Le){let Ie=ae[Le];return Ie===void 0&&(Ie=new Gw,ae[Le]=Ie),Ie.getHandSpace()};function oi(Le){const Ie=le.indexOf(Le.inputSource);if(Ie===-1)return;const qe=ae[Ie];qe!==void 0&&qe.dispatchEvent({type:Le.type,data:Le.inputSource})}function Ci(){c.removeEventListener("select",oi),c.removeEventListener("selectstart",oi),c.removeEventListener("selectend",oi),c.removeEventListener("squeeze",oi),c.removeEventListener("squeezestart",oi),c.removeEventListener("squeezeend",oi),c.removeEventListener("end",Ci),c.removeEventListener("inputsourceschange",te);for(let Le=0;Le<ae.length;Le++){const Ie=le[Le];Ie!==null&&(le[Le]=null,ae[Le].disconnect(Ie))}Ke=null,Et=null,e.setRenderTarget(Y),R=null,N=null,U=null,c=null,B=null,Ve.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Le){p=Le,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Le){i=Le,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return C||y},this.setReferenceSpace=function(Le){C=Le},this.getBaseLayer=function(){return N!==null?N:R},this.getBinding=function(){return U},this.getFrame=function(){return G},this.getSession=function(){return c},this.setSession=async function(Le){if(c=Le,c!==null){if(Y=e.getRenderTarget(),c.addEventListener("select",oi),c.addEventListener("selectstart",oi),c.addEventListener("selectend",oi),c.addEventListener("squeeze",oi),c.addEventListener("squeezestart",oi),c.addEventListener("squeezeend",oi),c.addEventListener("end",Ci),c.addEventListener("inputsourceschange",te),J.xrCompatible!==!0&&await t.makeXRCompatible(),c.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const Ie={antialias:c.renderState.layers===void 0?J.antialias:!0,alpha:J.alpha,depth:J.depth,stencil:J.stencil,framebufferScaleFactor:p};R=new XRWebGLLayer(c,t,Ie),c.updateRenderState({baseLayer:R}),B=new Oa(R.framebufferWidth,R.framebufferHeight,{format:Dl,type:cp,encoding:e.outputEncoding,stencilBuffer:J.stencil})}else{let Ie=null,qe=null,et=null;J.depth&&(et=J.stencil?35056:33190,Ie=J.stencil?gf:ip,qe=J.stencil?df:Yd);const vt={colorFormat:32856,depthFormat:et,scaleFactor:p};U=new XRWebGLBinding(c,t),N=U.createProjectionLayer(vt),c.updateRenderState({layers:[N]}),B=new Oa(N.textureWidth,N.textureHeight,{format:Dl,type:cp,depthTexture:new WI(N.textureWidth,N.textureHeight,qe,void 0,void 0,void 0,void 0,void 0,void 0,Ie),stencilBuffer:J.stencil,encoding:e.outputEncoding,samples:J.antialias?4:0});const Be=e.properties.get(B);Be.__ignoreDepthValues=N.ignoreDepthValues}B.isXRRenderTarget=!0,this.setFoveation(1),C=null,y=await c.requestReferenceSpace(i),Ve.setContext(c),Ve.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function te(Le){for(let Ie=0;Ie<Le.removed.length;Ie++){const qe=Le.removed[Ie],et=le.indexOf(qe);et>=0&&(le[et]=null,ae[et].disconnect(qe))}for(let Ie=0;Ie<Le.added.length;Ie++){const qe=Le.added[Ie];let et=le.indexOf(qe);if(et===-1){for(let Be=0;Be<ae.length;Be++)if(Be>=le.length){le.push(qe),et=Be;break}else if(le[Be]===null){le[Be]=qe,et=Be;break}if(et===-1)break}const vt=ae[et];vt&&vt.connect(qe)}}const ce=new ft,ye=new ft;function xe(Le,Ie,qe){ce.setFromMatrixPosition(Ie.matrixWorld),ye.setFromMatrixPosition(qe.matrixWorld);const et=ce.distanceTo(ye),vt=Ie.projectionMatrix.elements,Be=qe.projectionMatrix.elements,dt=vt[14]/(vt[10]-1),ut=vt[14]/(vt[10]+1),Qt=(vt[9]+1)/vt[5],Wt=(vt[9]-1)/vt[5],Nt=(vt[8]-1)/vt[0],Ct=(Be[8]+1)/Be[0],Ft=dt*Nt,Xt=dt*Ct,mi=et/(-Nt+Ct),fi=mi*-Nt;Ie.matrixWorld.decompose(Le.position,Le.quaternion,Le.scale),Le.translateX(fi),Le.translateZ(mi),Le.matrixWorld.compose(Le.position,Le.quaternion,Le.scale),Le.matrixWorldInverse.copy(Le.matrixWorld).invert();const Gi=dt+mi,wn=ut+mi,Qi=Ft-fi,Gn=Xt+(et-fi),kn=Qt*ut/wn*Gi,yt=Wt*ut/wn*Gi;Le.projectionMatrix.makePerspective(Qi,Gn,kn,yt,Gi,wn)}function ze(Le,Ie){Ie===null?Le.matrixWorld.copy(Le.matrix):Le.matrixWorld.multiplyMatrices(Ie.matrixWorld,Le.matrix),Le.matrixWorldInverse.copy(Le.matrixWorld).invert()}this.updateCamera=function(Le){if(c===null)return;Me.near=Pe.near=me.near=Le.near,Me.far=Pe.far=me.far=Le.far,(Ke!==Me.near||Et!==Me.far)&&(c.updateRenderState({depthNear:Me.near,depthFar:Me.far}),Ke=Me.near,Et=Me.far);const Ie=Le.parent,qe=Me.cameras;ze(Me,Ie);for(let vt=0;vt<qe.length;vt++)ze(qe[vt],Ie);Me.matrixWorld.decompose(Me.position,Me.quaternion,Me.scale),Le.matrix.copy(Me.matrix),Le.matrix.decompose(Le.position,Le.quaternion,Le.scale);const et=Le.children;for(let vt=0,Be=et.length;vt<Be;vt++)et[vt].updateMatrixWorld(!0);qe.length===2?xe(Me,me,Pe):Me.projectionMatrix.copy(me.projectionMatrix)},this.getCamera=function(){return Me},this.getFoveation=function(){if(N!==null)return N.fixedFoveation;if(R!==null)return R.fixedFoveation},this.setFoveation=function(Le){N!==null&&(N.fixedFoveation=Le),R!==null&&R.fixedFoveation!==void 0&&(R.fixedFoveation=Le)},this.getPlanes=function(){return Ae};let Ne=null;function Ge(Le,Ie){if(D=Ie.getViewerPose(C||y),G=Ie,D!==null){const qe=D.views;R!==null&&(e.setRenderTargetFramebuffer(B,R.framebuffer),e.setRenderTarget(B));let et=!1;qe.length!==Me.cameras.length&&(Me.cameras.length=0,et=!0);for(let vt=0;vt<qe.length;vt++){const Be=qe[vt];let dt=null;if(R!==null)dt=R.getViewport(Be);else{const Qt=U.getViewSubImage(N,Be);dt=Qt.viewport,vt===0&&(e.setRenderTargetTextures(B,Qt.colorTexture,N.ignoreDepthValues?void 0:Qt.depthStencilTexture),e.setRenderTarget(B))}let ut=it[vt];ut===void 0&&(ut=new _a,ut.layers.enable(vt),ut.viewport=new ls,it[vt]=ut),ut.matrix.fromArray(Be.transform.matrix),ut.projectionMatrix.fromArray(Be.projectionMatrix),ut.viewport.set(dt.x,dt.y,dt.width,dt.height),vt===0&&Me.matrix.copy(ut.matrix),et===!0&&Me.cameras.push(ut)}}for(let qe=0;qe<ae.length;qe++){const et=le[qe],vt=ae[qe];et!==null&&vt!==void 0&&vt.update(et,Ie,C||y)}if(Ne&&Ne(Le,Ie),Ie.detectedPlanes){r.dispatchEvent({type:"planesdetected",data:Ie.detectedPlanes});let qe=null;for(const et of Ae)Ie.detectedPlanes.has(et)||(qe===null&&(qe=[]),qe.push(et));if(qe!==null)for(const et of qe)Ae.delete(et),we.delete(et),r.dispatchEvent({type:"planeremoved",data:et});for(const et of Ie.detectedPlanes)if(!Ae.has(et))Ae.add(et),we.set(et,Ie.lastChangedTime),r.dispatchEvent({type:"planeadded",data:et});else{const vt=we.get(et);et.lastChangedTime>vt&&(we.set(et,et.lastChangedTime),r.dispatchEvent({type:"planechanged",data:et}))}}G=null}const Ve=new kI;Ve.setAnimationLoop(Ge),this.setAnimationLoop=function(Le){Ne=Le},this.dispose=function(){}}}function yN(u,e){function t(Y,B){B.color.getRGB(Y.fogColor.value,UI(u)),B.isFog?(Y.fogNear.value=B.near,Y.fogFar.value=B.far):B.isFogExp2&&(Y.fogDensity.value=B.density)}function r(Y,B,ae,le,Ae){B.isMeshBasicMaterial||B.isMeshLambertMaterial?c(Y,B):B.isMeshToonMaterial?(c(Y,B),U(Y,B)):B.isMeshPhongMaterial?(c(Y,B),D(Y,B)):B.isMeshStandardMaterial?(c(Y,B),N(Y,B),B.isMeshPhysicalMaterial&&R(Y,B,Ae)):B.isMeshMatcapMaterial?(c(Y,B),G(Y,B)):B.isMeshDepthMaterial?c(Y,B):B.isMeshDistanceMaterial?(c(Y,B),J(Y,B)):B.isMeshNormalMaterial?c(Y,B):B.isLineBasicMaterial?(p(Y,B),B.isLineDashedMaterial&&y(Y,B)):B.isPointsMaterial?i(Y,B,ae,le):B.isSpriteMaterial?C(Y,B):B.isShadowMaterial?(Y.color.value.copy(B.color),Y.opacity.value=B.opacity):B.isShaderMaterial&&(B.uniformsNeedUpdate=!1)}function c(Y,B){Y.opacity.value=B.opacity,B.color&&Y.diffuse.value.copy(B.color),B.emissive&&Y.emissive.value.copy(B.emissive).multiplyScalar(B.emissiveIntensity),B.map&&(Y.map.value=B.map),B.alphaMap&&(Y.alphaMap.value=B.alphaMap),B.bumpMap&&(Y.bumpMap.value=B.bumpMap,Y.bumpScale.value=B.bumpScale,B.side===Dc&&(Y.bumpScale.value*=-1)),B.displacementMap&&(Y.displacementMap.value=B.displacementMap,Y.displacementScale.value=B.displacementScale,Y.displacementBias.value=B.displacementBias),B.emissiveMap&&(Y.emissiveMap.value=B.emissiveMap),B.normalMap&&(Y.normalMap.value=B.normalMap,Y.normalScale.value.copy(B.normalScale),B.side===Dc&&Y.normalScale.value.negate()),B.specularMap&&(Y.specularMap.value=B.specularMap),B.alphaTest>0&&(Y.alphaTest.value=B.alphaTest);const ae=e.get(B).envMap;if(ae&&(Y.envMap.value=ae,Y.flipEnvMap.value=ae.isCubeTexture&&ae.isRenderTargetTexture===!1?-1:1,Y.reflectivity.value=B.reflectivity,Y.ior.value=B.ior,Y.refractionRatio.value=B.refractionRatio),B.lightMap){Y.lightMap.value=B.lightMap;const we=u.physicallyCorrectLights!==!0?Math.PI:1;Y.lightMapIntensity.value=B.lightMapIntensity*we}B.aoMap&&(Y.aoMap.value=B.aoMap,Y.aoMapIntensity.value=B.aoMapIntensity);let le;B.map?le=B.map:B.specularMap?le=B.specularMap:B.displacementMap?le=B.displacementMap:B.normalMap?le=B.normalMap:B.bumpMap?le=B.bumpMap:B.roughnessMap?le=B.roughnessMap:B.metalnessMap?le=B.metalnessMap:B.alphaMap?le=B.alphaMap:B.emissiveMap?le=B.emissiveMap:B.clearcoatMap?le=B.clearcoatMap:B.clearcoatNormalMap?le=B.clearcoatNormalMap:B.clearcoatRoughnessMap?le=B.clearcoatRoughnessMap:B.iridescenceMap?le=B.iridescenceMap:B.iridescenceThicknessMap?le=B.iridescenceThicknessMap:B.specularIntensityMap?le=B.specularIntensityMap:B.specularColorMap?le=B.specularColorMap:B.transmissionMap?le=B.transmissionMap:B.thicknessMap?le=B.thicknessMap:B.sheenColorMap?le=B.sheenColorMap:B.sheenRoughnessMap&&(le=B.sheenRoughnessMap),le!==void 0&&(le.isWebGLRenderTarget&&(le=le.texture),le.matrixAutoUpdate===!0&&le.updateMatrix(),Y.uvTransform.value.copy(le.matrix));let Ae;B.aoMap?Ae=B.aoMap:B.lightMap&&(Ae=B.lightMap),Ae!==void 0&&(Ae.isWebGLRenderTarget&&(Ae=Ae.texture),Ae.matrixAutoUpdate===!0&&Ae.updateMatrix(),Y.uv2Transform.value.copy(Ae.matrix))}function p(Y,B){Y.diffuse.value.copy(B.color),Y.opacity.value=B.opacity}function y(Y,B){Y.dashSize.value=B.dashSize,Y.totalSize.value=B.dashSize+B.gapSize,Y.scale.value=B.scale}function i(Y,B,ae,le){Y.diffuse.value.copy(B.color),Y.opacity.value=B.opacity,Y.size.value=B.size*ae,Y.scale.value=le*.5,B.map&&(Y.map.value=B.map),B.alphaMap&&(Y.alphaMap.value=B.alphaMap),B.alphaTest>0&&(Y.alphaTest.value=B.alphaTest);let Ae;B.map?Ae=B.map:B.alphaMap&&(Ae=B.alphaMap),Ae!==void 0&&(Ae.matrixAutoUpdate===!0&&Ae.updateMatrix(),Y.uvTransform.value.copy(Ae.matrix))}function C(Y,B){Y.diffuse.value.copy(B.color),Y.opacity.value=B.opacity,Y.rotation.value=B.rotation,B.map&&(Y.map.value=B.map),B.alphaMap&&(Y.alphaMap.value=B.alphaMap),B.alphaTest>0&&(Y.alphaTest.value=B.alphaTest);let ae;B.map?ae=B.map:B.alphaMap&&(ae=B.alphaMap),ae!==void 0&&(ae.matrixAutoUpdate===!0&&ae.updateMatrix(),Y.uvTransform.value.copy(ae.matrix))}function D(Y,B){Y.specular.value.copy(B.specular),Y.shininess.value=Math.max(B.shininess,1e-4)}function U(Y,B){B.gradientMap&&(Y.gradientMap.value=B.gradientMap)}function N(Y,B){Y.roughness.value=B.roughness,Y.metalness.value=B.metalness,B.roughnessMap&&(Y.roughnessMap.value=B.roughnessMap),B.metalnessMap&&(Y.metalnessMap.value=B.metalnessMap),e.get(B).envMap&&(Y.envMapIntensity.value=B.envMapIntensity)}function R(Y,B,ae){Y.ior.value=B.ior,B.sheen>0&&(Y.sheenColor.value.copy(B.sheenColor).multiplyScalar(B.sheen),Y.sheenRoughness.value=B.sheenRoughness,B.sheenColorMap&&(Y.sheenColorMap.value=B.sheenColorMap),B.sheenRoughnessMap&&(Y.sheenRoughnessMap.value=B.sheenRoughnessMap)),B.clearcoat>0&&(Y.clearcoat.value=B.clearcoat,Y.clearcoatRoughness.value=B.clearcoatRoughness,B.clearcoatMap&&(Y.clearcoatMap.value=B.clearcoatMap),B.clearcoatRoughnessMap&&(Y.clearcoatRoughnessMap.value=B.clearcoatRoughnessMap),B.clearcoatNormalMap&&(Y.clearcoatNormalScale.value.copy(B.clearcoatNormalScale),Y.clearcoatNormalMap.value=B.clearcoatNormalMap,B.side===Dc&&Y.clearcoatNormalScale.value.negate())),B.iridescence>0&&(Y.iridescence.value=B.iridescence,Y.iridescenceIOR.value=B.iridescenceIOR,Y.iridescenceThicknessMinimum.value=B.iridescenceThicknessRange[0],Y.iridescenceThicknessMaximum.value=B.iridescenceThicknessRange[1],B.iridescenceMap&&(Y.iridescenceMap.value=B.iridescenceMap),B.iridescenceThicknessMap&&(Y.iridescenceThicknessMap.value=B.iridescenceThicknessMap)),B.transmission>0&&(Y.transmission.value=B.transmission,Y.transmissionSamplerMap.value=ae.texture,Y.transmissionSamplerSize.value.set(ae.width,ae.height),B.transmissionMap&&(Y.transmissionMap.value=B.transmissionMap),Y.thickness.value=B.thickness,B.thicknessMap&&(Y.thicknessMap.value=B.thicknessMap),Y.attenuationDistance.value=B.attenuationDistance,Y.attenuationColor.value.copy(B.attenuationColor)),Y.specularIntensity.value=B.specularIntensity,Y.specularColor.value.copy(B.specularColor),B.specularIntensityMap&&(Y.specularIntensityMap.value=B.specularIntensityMap),B.specularColorMap&&(Y.specularColorMap.value=B.specularColorMap)}function G(Y,B){B.matcap&&(Y.matcap.value=B.matcap)}function J(Y,B){Y.referencePosition.value.copy(B.referencePosition),Y.nearDistance.value=B.nearDistance,Y.farDistance.value=B.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function xN(u,e,t,r){let c={},p={},y=[];const i=t.isWebGL2?u.getParameter(35375):0;function C(le,Ae){const we=Ae.program;r.uniformBlockBinding(le,we)}function D(le,Ae){let we=c[le.id];we===void 0&&(J(le),we=U(le),c[le.id]=we,le.addEventListener("dispose",B));const me=Ae.program;r.updateUBOMapping(le,me);const Pe=e.render.frame;p[le.id]!==Pe&&(R(le),p[le.id]=Pe)}function U(le){const Ae=N();le.__bindingPointIndex=Ae;const we=u.createBuffer(),me=le.__size,Pe=le.usage;return u.bindBuffer(35345,we),u.bufferData(35345,me,Pe),u.bindBuffer(35345,null),u.bindBufferBase(35345,Ae,we),we}function N(){for(let le=0;le<i;le++)if(y.indexOf(le)===-1)return y.push(le),le;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function R(le){const Ae=c[le.id],we=le.uniforms,me=le.__cache;u.bindBuffer(35345,Ae);for(let Pe=0,it=we.length;Pe<it;Pe++){const Me=we[Pe];if(G(Me,Pe,me)===!0){const Ke=Me.__offset,Et=Array.isArray(Me.value)?Me.value:[Me.value];let oi=0;for(let Ci=0;Ci<Et.length;Ci++){const te=Et[Ci],ce=Y(te);typeof te=="number"?(Me.__data[0]=te,u.bufferSubData(35345,Ke+oi,Me.__data)):te.isMatrix3?(Me.__data[0]=te.elements[0],Me.__data[1]=te.elements[1],Me.__data[2]=te.elements[2],Me.__data[3]=te.elements[0],Me.__data[4]=te.elements[3],Me.__data[5]=te.elements[4],Me.__data[6]=te.elements[5],Me.__data[7]=te.elements[0],Me.__data[8]=te.elements[6],Me.__data[9]=te.elements[7],Me.__data[10]=te.elements[8],Me.__data[11]=te.elements[0]):(te.toArray(Me.__data,oi),oi+=ce.storage/Float32Array.BYTES_PER_ELEMENT)}u.bufferSubData(35345,Ke,Me.__data)}}u.bindBuffer(35345,null)}function G(le,Ae,we){const me=le.value;if(we[Ae]===void 0){if(typeof me=="number")we[Ae]=me;else{const Pe=Array.isArray(me)?me:[me],it=[];for(let Me=0;Me<Pe.length;Me++)it.push(Pe[Me].clone());we[Ae]=it}return!0}else if(typeof me=="number"){if(we[Ae]!==me)return we[Ae]=me,!0}else{const Pe=Array.isArray(we[Ae])?we[Ae]:[we[Ae]],it=Array.isArray(me)?me:[me];for(let Me=0;Me<Pe.length;Me++){const Ke=Pe[Me];if(Ke.equals(it[Me])===!1)return Ke.copy(it[Me]),!0}}return!1}function J(le){const Ae=le.uniforms;let we=0;const me=16;let Pe=0;for(let it=0,Me=Ae.length;it<Me;it++){const Ke=Ae[it],Et={boundary:0,storage:0},oi=Array.isArray(Ke.value)?Ke.value:[Ke.value];for(let Ci=0,te=oi.length;Ci<te;Ci++){const ce=oi[Ci],ye=Y(ce);Et.boundary+=ye.boundary,Et.storage+=ye.storage}if(Ke.__data=new Float32Array(Et.storage/Float32Array.BYTES_PER_ELEMENT),Ke.__offset=we,it>0){Pe=we%me;const Ci=me-Pe;Pe!==0&&Ci-Et.boundary<0&&(we+=me-Pe,Ke.__offset=we)}we+=Et.storage}return Pe=we%me,Pe>0&&(we+=me-Pe),le.__size=we,le.__cache={},this}function Y(le){const Ae={boundary:0,storage:0};return typeof le=="number"?(Ae.boundary=4,Ae.storage=4):le.isVector2?(Ae.boundary=8,Ae.storage=8):le.isVector3||le.isColor?(Ae.boundary=16,Ae.storage=12):le.isVector4?(Ae.boundary=16,Ae.storage=16):le.isMatrix3?(Ae.boundary=48,Ae.storage=48):le.isMatrix4?(Ae.boundary=64,Ae.storage=64):le.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",le),Ae}function B(le){const Ae=le.target;Ae.removeEventListener("dispose",B);const we=y.indexOf(Ae.__bindingPointIndex);y.splice(we,1),u.deleteBuffer(c[Ae.id]),delete c[Ae.id],delete p[Ae.id]}function ae(){for(const le in c)u.deleteBuffer(c[le]);y=[],c={},p={}}return{bind:C,update:D,dispose:ae}}function vN(){const u=Z_("canvas");return u.style.display="block",u}function mv(u={}){this.isWebGLRenderer=!0;const e=u.canvas!==void 0?u.canvas:vN(),t=u.context!==void 0?u.context:null,r=u.depth!==void 0?u.depth:!0,c=u.stencil!==void 0?u.stencil:!0,p=u.antialias!==void 0?u.antialias:!1,y=u.premultipliedAlpha!==void 0?u.premultipliedAlpha:!0,i=u.preserveDrawingBuffer!==void 0?u.preserveDrawingBuffer:!1,C=u.powerPreference!==void 0?u.powerPreference:"default",D=u.failIfMajorPerformanceCaveat!==void 0?u.failIfMajorPerformanceCaveat:!1;let U;t!==null?U=t.getContextAttributes().alpha:U=u.alpha!==void 0?u.alpha:!1;let N=null,R=null;const G=[],J=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=hp,this.physicallyCorrectLights=!1,this.toneMapping=Vu,this.toneMappingExposure=1;const Y=this;let B=!1,ae=0,le=0,Ae=null,we=-1,me=null;const Pe=new ls,it=new ls;let Me=null,Ke=e.width,Et=e.height,oi=1,Ci=null,te=null;const ce=new ls(0,0,Ke,Et),ye=new ls(0,0,Ke,Et);let xe=!1;const ze=new Gv;let Ne=!1,Ge=!1,Ve=null;const Le=new lr,Ie=new Di,qe=new ft,et={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function vt(){return Ae===null?oi:1}let Be=t;function dt(X,j){for(let ie=0;ie<X.length;ie++){const ne=X[ie],de=e.getContext(ne,j);if(de!==null)return de}return null}try{const X={alpha:!0,depth:r,stencil:c,antialias:p,premultipliedAlpha:y,preserveDrawingBuffer:i,powerPreference:C,failIfMajorPerformanceCaveat:D};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Ov}`),e.addEventListener("webglcontextlost",Cn,!1),e.addEventListener("webglcontextrestored",Tn,!1),e.addEventListener("webglcontextcreationerror",nr,!1),Be===null){const j=["webgl2","webgl","experimental-webgl"];if(Y.isWebGL1Renderer===!0&&j.shift(),Be=dt(j,X),Be===null)throw dt(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}Be.getShaderPrecisionFormat===void 0&&(Be.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(X){throw console.error("THREE.WebGLRenderer: "+X.message),X}let ut,Qt,Wt,Nt,Ct,Ft,Xt,mi,fi,Gi,wn,Qi,Gn,kn,yt,st,ti,Ni,qi,en,$t,at,ii,hn;function Xi(){ut=new zO(Be),Qt=new FO(Be,ut,u),ut.init(Qt),at=new HI(Be,ut,Qt),Wt=new fN(Be,ut,Qt),Nt=new NO,Ct=new nN,Ft=new mN(Be,ut,Wt,Ct,Qt,at,Nt),Xt=new DO(Y),mi=new RO(Y),fi=new Zz(Be,Qt),ii=new MO(Be,ut,fi,Qt),Gi=new kO(Be,fi,Nt,ii),wn=new GO(Be,Gi,fi,Nt),qi=new HO(Be,Qt,Ft),st=new LO(Ct),Qi=new iN(Y,Xt,mi,ut,Qt,ii,st),Gn=new yN(Y,Ct),kn=new sN,yt=new uN(ut,Qt),Ni=new SO(Y,Xt,mi,Wt,wn,U,y),ti=new pN(Y,wn,Qt),hn=new xN(Be,Nt,Qt,Wt),en=new IO(Be,ut,Nt,Qt),$t=new OO(Be,ut,Nt,Qt),Nt.programs=Qi.programs,Y.capabilities=Qt,Y.extensions=ut,Y.properties=Ct,Y.renderLists=kn,Y.shadowMap=ti,Y.state=Wt,Y.info=Nt}Xi();const on=new _N(Y,Be);this.xr=on,this.getContext=function(){return Be},this.getContextAttributes=function(){return Be.getContextAttributes()},this.forceContextLoss=function(){const X=ut.get("WEBGL_lose_context");X&&X.loseContext()},this.forceContextRestore=function(){const X=ut.get("WEBGL_lose_context");X&&X.restoreContext()},this.getPixelRatio=function(){return oi},this.setPixelRatio=function(X){X!==void 0&&(oi=X,this.setSize(Ke,Et,!1))},this.getSize=function(X){return X.set(Ke,Et)},this.setSize=function(X,j,ie){if(on.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Ke=X,Et=j,e.width=Math.floor(X*oi),e.height=Math.floor(j*oi),ie!==!1&&(e.style.width=X+"px",e.style.height=j+"px"),this.setViewport(0,0,X,j)},this.getDrawingBufferSize=function(X){return X.set(Ke*oi,Et*oi).floor()},this.setDrawingBufferSize=function(X,j,ie){Ke=X,Et=j,oi=ie,e.width=Math.floor(X*ie),e.height=Math.floor(j*ie),this.setViewport(0,0,X,j)},this.getCurrentViewport=function(X){return X.copy(Pe)},this.getViewport=function(X){return X.copy(ce)},this.setViewport=function(X,j,ie,ne){X.isVector4?ce.set(X.x,X.y,X.z,X.w):ce.set(X,j,ie,ne),Wt.viewport(Pe.copy(ce).multiplyScalar(oi).floor())},this.getScissor=function(X){return X.copy(ye)},this.setScissor=function(X,j,ie,ne){X.isVector4?ye.set(X.x,X.y,X.z,X.w):ye.set(X,j,ie,ne),Wt.scissor(it.copy(ye).multiplyScalar(oi).floor())},this.getScissorTest=function(){return xe},this.setScissorTest=function(X){Wt.setScissorTest(xe=X)},this.setOpaqueSort=function(X){Ci=X},this.setTransparentSort=function(X){te=X},this.getClearColor=function(X){return X.copy(Ni.getClearColor())},this.setClearColor=function(){Ni.setClearColor.apply(Ni,arguments)},this.getClearAlpha=function(){return Ni.getClearAlpha()},this.setClearAlpha=function(){Ni.setClearAlpha.apply(Ni,arguments)},this.clear=function(X=!0,j=!0,ie=!0){let ne=0;X&&(ne|=16384),j&&(ne|=256),ie&&(ne|=1024),Be.clear(ne)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Cn,!1),e.removeEventListener("webglcontextrestored",Tn,!1),e.removeEventListener("webglcontextcreationerror",nr,!1),kn.dispose(),yt.dispose(),Ct.dispose(),Xt.dispose(),mi.dispose(),wn.dispose(),ii.dispose(),hn.dispose(),Qi.dispose(),on.dispose(),on.removeEventListener("sessionstart",Ui),on.removeEventListener("sessionend",Pn),Ve&&(Ve.dispose(),Ve=null),qn.stop()};function Cn(X){X.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),B=!0}function Tn(){console.log("THREE.WebGLRenderer: Context Restored."),B=!1;const X=Nt.autoReset,j=ti.enabled,ie=ti.autoUpdate,ne=ti.needsUpdate,de=ti.type;Xi(),Nt.autoReset=X,ti.enabled=j,ti.autoUpdate=ie,ti.needsUpdate=ne,ti.type=de}function nr(X){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",X.statusMessage)}function Ii(X){const j=X.target;j.removeEventListener("dispose",Ii),bn(j)}function bn(X){Ot(X),Ct.remove(X)}function Ot(X){const j=Ct.get(X).programs;j!==void 0&&(j.forEach(function(ie){Qi.releaseProgram(ie)}),X.isShaderMaterial&&Qi.releaseShaderCache(X))}this.renderBufferDirect=function(X,j,ie,ne,de,Re){j===null&&(j=et);const tt=de.isMesh&&de.matrixWorld.determinant()<0,He=Ue(X,j,ie,ne,de);Wt.setMaterial(ne,tt);let Je=ie.index,pt=1;ne.wireframe===!0&&(Je=Gi.getWireframeAttribute(ie),pt=2);const Lt=ie.drawRange,jt=ie.attributes.position;let Gt=Lt.start*pt,ki=(Lt.start+Lt.count)*pt;Re!==null&&(Gt=Math.max(Gt,Re.start*pt),ki=Math.min(ki,(Re.start+Re.count)*pt)),Je!==null?(Gt=Math.max(Gt,0),ki=Math.min(ki,Je.count)):jt!=null&&(Gt=Math.max(Gt,0),ki=Math.min(ki,jt.count));const wi=ki-Gt;if(wi<0||wi===1/0)return;ii.setup(de,ne,He,ie,Je);let Oi,Yi=en;if(Je!==null&&(Oi=fi.get(Je),Yi=$t,Yi.setIndex(Oi)),de.isMesh)ne.wireframe===!0?(Wt.setLineWidth(ne.wireframeLinewidth*vt()),Yi.setMode(1)):Yi.setMode(4);else if(de.isLine){let tn=ne.linewidth;tn===void 0&&(tn=1),Wt.setLineWidth(tn*vt()),de.isLineSegments?Yi.setMode(1):de.isLineLoop?Yi.setMode(2):Yi.setMode(3)}else de.isPoints?Yi.setMode(0):de.isSprite&&Yi.setMode(4);if(de.isInstancedMesh)Yi.renderInstances(Gt,wi,de.count);else if(ie.isInstancedBufferGeometry){const tn=ie._maxInstanceCount!==void 0?ie._maxInstanceCount:1/0,rr=Math.min(ie.instanceCount,tn);Yi.renderInstances(Gt,wi,rr)}else Yi.render(Gt,wi)},this.compile=function(X,j){function ie(ne,de,Re){ne.transparent===!0&&ne.side===w_?(ne.side=Dc,ne.needsUpdate=!0,ot(ne,de,Re),ne.side=ju,ne.needsUpdate=!0,ot(ne,de,Re),ne.side=w_):ot(ne,de,Re)}R=yt.get(X),R.init(),J.push(R),X.traverseVisible(function(ne){ne.isLight&&ne.layers.test(j.layers)&&(R.pushLight(ne),ne.castShadow&&R.pushShadow(ne))}),R.setupLights(Y.physicallyCorrectLights),X.traverse(function(ne){const de=ne.material;if(de)if(Array.isArray(de))for(let Re=0;Re<de.length;Re++){const tt=de[Re];ie(tt,X,ne)}else ie(de,X,ne)}),J.pop(),R=null};let vi=null;function Wi(X){vi&&vi(X)}function Ui(){qn.stop()}function Pn(){qn.start()}const qn=new kI;qn.setAnimationLoop(Wi),typeof self<"u"&&qn.setContext(self),this.setAnimationLoop=function(X){vi=X,on.setAnimationLoop(X),X===null?qn.stop():qn.start()},on.addEventListener("sessionstart",Ui),on.addEventListener("sessionend",Pn),this.render=function(X,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(B===!0)return;X.matrixWorldAutoUpdate===!0&&X.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),on.enabled===!0&&on.isPresenting===!0&&(on.cameraAutoUpdate===!0&&on.updateCamera(j),j=on.getCamera()),X.isScene===!0&&X.onBeforeRender(Y,X,j,Ae),R=yt.get(X,J.length),R.init(),J.push(R),Le.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),ze.setFromProjectionMatrix(Le),Ge=this.localClippingEnabled,Ne=st.init(this.clippingPlanes,Ge,j),N=kn.get(X,G.length),N.init(),G.push(N),Hr(X,j,0,Y.sortObjects),N.finish(),Y.sortObjects===!0&&N.sort(Ci,te),Ne===!0&&st.beginShadows();const ie=R.state.shadowsArray;if(ti.render(ie,X,j),Ne===!0&&st.endShadows(),this.info.autoReset===!0&&this.info.reset(),Ni.render(N,X),R.setupLights(Y.physicallyCorrectLights),j.isArrayCamera){const ne=j.cameras;for(let de=0,Re=ne.length;de<Re;de++){const tt=ne[de];fr(N,X,tt,tt.viewport)}}else fr(N,X,j);Ae!==null&&(Ft.updateMultisampleRenderTarget(Ae),Ft.updateRenderTargetMipmap(Ae)),X.isScene===!0&&X.onAfterRender(Y,X,j),ii.resetDefaultState(),we=-1,me=null,J.pop(),J.length>0?R=J[J.length-1]:R=null,G.pop(),G.length>0?N=G[G.length-1]:N=null};function Hr(X,j,ie,ne){if(X.visible===!1)return;if(X.layers.test(j.layers)){if(X.isGroup)ie=X.renderOrder;else if(X.isLOD)X.autoUpdate===!0&&X.update(j);else if(X.isLight)R.pushLight(X),X.castShadow&&R.pushShadow(X);else if(X.isSprite){if(!X.frustumCulled||ze.intersectsSprite(X)){ne&&qe.setFromMatrixPosition(X.matrixWorld).applyMatrix4(Le);const tt=wn.update(X),He=X.material;He.visible&&N.push(X,tt,He,ie,qe.z,null)}}else if((X.isMesh||X.isLine||X.isPoints)&&(X.isSkinnedMesh&&X.skeleton.frame!==Nt.render.frame&&(X.skeleton.update(),X.skeleton.frame=Nt.render.frame),!X.frustumCulled||ze.intersectsObject(X))){ne&&qe.setFromMatrixPosition(X.matrixWorld).applyMatrix4(Le);const tt=wn.update(X),He=X.material;if(Array.isArray(He)){const Je=tt.groups;for(let pt=0,Lt=Je.length;pt<Lt;pt++){const jt=Je[pt],Gt=He[jt.materialIndex];Gt&&Gt.visible&&N.push(X,tt,Gt,ie,qe.z,jt)}}else He.visible&&N.push(X,tt,He,ie,qe.z,null)}}const Re=X.children;for(let tt=0,He=Re.length;tt<He;tt++)Hr(Re[tt],j,ie,ne)}function fr(X,j,ie,ne){const de=X.opaque,Re=X.transmissive,tt=X.transparent;R.setupLightsView(ie),Re.length>0&&kr(de,j,ie),ne&&Wt.viewport(Pe.copy(ne)),de.length>0&&Qn(de,j,ie),Re.length>0&&Qn(Re,j,ie),tt.length>0&&Qn(tt,j,ie),Wt.buffers.depth.setTest(!0),Wt.buffers.depth.setMask(!0),Wt.buffers.color.setMask(!0),Wt.setPolygonOffset(!1)}function kr(X,j,ie){const ne=Qt.isWebGL2;Ve===null&&(Ve=new Oa(1,1,{generateMipmaps:!0,type:ut.has("EXT_color_buffer_half_float")?Gm:cp,minFilter:lp,samples:ne&&p===!0?4:0})),Y.getDrawingBufferSize(Ie),ne?Ve.setSize(Ie.x,Ie.y):Ve.setSize(fv(Ie.x),fv(Ie.y));const de=Y.getRenderTarget();Y.setRenderTarget(Ve),Y.clear();const Re=Y.toneMapping;Y.toneMapping=Vu,Qn(X,j,ie),Y.toneMapping=Re,Ft.updateMultisampleRenderTarget(Ve),Ft.updateRenderTargetMipmap(Ve),Y.setRenderTarget(de)}function Qn(X,j,ie){const ne=j.isScene===!0?j.overrideMaterial:null;for(let de=0,Re=X.length;de<Re;de++){const tt=X[de],He=tt.object,Je=tt.geometry,pt=ne===null?tt.material:ne,Lt=tt.group;He.layers.test(ie.layers)&&zs(He,j,ie,Je,pt,Lt)}}function zs(X,j,ie,ne,de,Re){X.onBeforeRender(Y,j,ie,ne,de,Re),X.modelViewMatrix.multiplyMatrices(ie.matrixWorldInverse,X.matrixWorld),X.normalMatrix.getNormalMatrix(X.modelViewMatrix),de.onBeforeRender(Y,j,ie,ne,X,Re),de.transparent===!0&&de.side===w_?(de.side=Dc,de.needsUpdate=!0,Y.renderBufferDirect(ie,j,ne,de,X,Re),de.side=ju,de.needsUpdate=!0,Y.renderBufferDirect(ie,j,ne,de,X,Re),de.side=w_):Y.renderBufferDirect(ie,j,ne,de,X,Re),X.onAfterRender(Y,j,ie,ne,de,Re)}function ot(X,j,ie){j.isScene!==!0&&(j=et);const ne=Ct.get(X),de=R.state.lights,Re=R.state.shadowsArray,tt=de.state.version,He=Qi.getParameters(X,de.state,Re,j,ie),Je=Qi.getProgramCacheKey(He);let pt=ne.programs;ne.environment=X.isMeshStandardMaterial?j.environment:null,ne.fog=j.fog,ne.envMap=(X.isMeshStandardMaterial?mi:Xt).get(X.envMap||ne.environment),pt===void 0&&(X.addEventListener("dispose",Ii),pt=new Map,ne.programs=pt);let Lt=pt.get(Je);if(Lt!==void 0){if(ne.currentProgram===Lt&&ne.lightsStateVersion===tt)return Ee(X,He),Lt}else He.uniforms=Qi.getUniforms(X),X.onBuild(ie,He,Y),X.onBeforeCompile(He,Y),Lt=Qi.acquireProgram(He,Je),pt.set(Je,Lt),ne.uniforms=He.uniforms;const jt=ne.uniforms;(!X.isShaderMaterial&&!X.isRawShaderMaterial||X.clipping===!0)&&(jt.clippingPlanes=st.uniform),Ee(X,He),ne.needsLights=wt(X),ne.lightsStateVersion=tt,ne.needsLights&&(jt.ambientLightColor.value=de.state.ambient,jt.lightProbe.value=de.state.probe,jt.directionalLights.value=de.state.directional,jt.directionalLightShadows.value=de.state.directionalShadow,jt.spotLights.value=de.state.spot,jt.spotLightShadows.value=de.state.spotShadow,jt.rectAreaLights.value=de.state.rectArea,jt.ltc_1.value=de.state.rectAreaLTC1,jt.ltc_2.value=de.state.rectAreaLTC2,jt.pointLights.value=de.state.point,jt.pointLightShadows.value=de.state.pointShadow,jt.hemisphereLights.value=de.state.hemi,jt.directionalShadowMap.value=de.state.directionalShadowMap,jt.directionalShadowMatrix.value=de.state.directionalShadowMatrix,jt.spotShadowMap.value=de.state.spotShadowMap,jt.spotLightMatrix.value=de.state.spotLightMatrix,jt.spotLightMap.value=de.state.spotLightMap,jt.pointShadowMap.value=de.state.pointShadowMap,jt.pointShadowMatrix.value=de.state.pointShadowMatrix);const Gt=Lt.getUniforms(),ki=Jx.seqWithValue(Gt.seq,jt);return ne.currentProgram=Lt,ne.uniformsList=ki,Lt}function Ee(X,j){const ie=Ct.get(X);ie.outputEncoding=j.outputEncoding,ie.instancing=j.instancing,ie.skinning=j.skinning,ie.morphTargets=j.morphTargets,ie.morphNormals=j.morphNormals,ie.morphColors=j.morphColors,ie.morphTargetsCount=j.morphTargetsCount,ie.numClippingPlanes=j.numClippingPlanes,ie.numIntersection=j.numClipIntersection,ie.vertexAlphas=j.vertexAlphas,ie.vertexTangents=j.vertexTangents,ie.toneMapping=j.toneMapping}function Ue(X,j,ie,ne,de){j.isScene!==!0&&(j=et),Ft.resetTextureUnits();const Re=j.fog,tt=ne.isMeshStandardMaterial?j.environment:null,He=Ae===null?Y.outputEncoding:Ae.isXRRenderTarget===!0?Ae.texture.encoding:hp,Je=(ne.isMeshStandardMaterial?mi:Xt).get(ne.envMap||tt),pt=ne.vertexColors===!0&&!!ie.attributes.color&&ie.attributes.color.itemSize===4,Lt=!!ne.normalMap&&!!ie.attributes.tangent,jt=!!ie.morphAttributes.position,Gt=!!ie.morphAttributes.normal,ki=!!ie.morphAttributes.color,wi=ne.toneMapped?Y.toneMapping:Vu,Oi=ie.morphAttributes.position||ie.morphAttributes.normal||ie.morphAttributes.color,Yi=Oi!==void 0?Oi.length:0,tn=Ct.get(ne),rr=R.state.lights;if(Ne===!0&&(Ge===!0||X!==me)){const ks=X===me&&ne.id===we;st.setState(ne,X,ks)}let yn=!1;ne.version===tn.__version?(tn.needsLights&&tn.lightsStateVersion!==rr.state.version||tn.outputEncoding!==He||de.isInstancedMesh&&tn.instancing===!1||!de.isInstancedMesh&&tn.instancing===!0||de.isSkinnedMesh&&tn.skinning===!1||!de.isSkinnedMesh&&tn.skinning===!0||tn.envMap!==Je||ne.fog===!0&&tn.fog!==Re||tn.numClippingPlanes!==void 0&&(tn.numClippingPlanes!==st.numPlanes||tn.numIntersection!==st.numIntersection)||tn.vertexAlphas!==pt||tn.vertexTangents!==Lt||tn.morphTargets!==jt||tn.morphNormals!==Gt||tn.morphColors!==ki||tn.toneMapping!==wi||Qt.isWebGL2===!0&&tn.morphTargetsCount!==Yi)&&(yn=!0):(yn=!0,tn.__version=ne.version);let Yt=tn.currentProgram;yn===!0&&(Yt=ot(ne,j,de));let sr=!1,Yn=!1,Wr=!1;const mr=Yt.getUniforms(),Mr=tn.uniforms;if(Wt.useProgram(Yt.program)&&(sr=!0,Yn=!0,Wr=!0),ne.id!==we&&(we=ne.id,Yn=!0),sr||me!==X){if(mr.setValue(Be,"projectionMatrix",X.projectionMatrix),Qt.logarithmicDepthBuffer&&mr.setValue(Be,"logDepthBufFC",2/(Math.log(X.far+1)/Math.LN2)),me!==X&&(me=X,Yn=!0,Wr=!0),ne.isShaderMaterial||ne.isMeshPhongMaterial||ne.isMeshToonMaterial||ne.isMeshStandardMaterial||ne.envMap){const ks=mr.map.cameraPosition;ks!==void 0&&ks.setValue(Be,qe.setFromMatrixPosition(X.matrixWorld))}(ne.isMeshPhongMaterial||ne.isMeshToonMaterial||ne.isMeshLambertMaterial||ne.isMeshBasicMaterial||ne.isMeshStandardMaterial||ne.isShaderMaterial)&&mr.setValue(Be,"isOrthographic",X.isOrthographicCamera===!0),(ne.isMeshPhongMaterial||ne.isMeshToonMaterial||ne.isMeshLambertMaterial||ne.isMeshBasicMaterial||ne.isMeshStandardMaterial||ne.isShaderMaterial||ne.isShadowMaterial||de.isSkinnedMesh)&&mr.setValue(Be,"viewMatrix",X.matrixWorldInverse)}if(de.isSkinnedMesh){mr.setOptional(Be,de,"bindMatrix"),mr.setOptional(Be,de,"bindMatrixInverse");const ks=de.skeleton;ks&&(Qt.floatVertexTextures?(ks.boneTexture===null&&ks.computeBoneTexture(),mr.setValue(Be,"boneTexture",ks.boneTexture,Ft),mr.setValue(Be,"boneTextureSize",ks.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Oo=ie.morphAttributes;if((Oo.position!==void 0||Oo.normal!==void 0||Oo.color!==void 0&&Qt.isWebGL2===!0)&&qi.update(de,ie,ne,Yt),(Yn||tn.receiveShadow!==de.receiveShadow)&&(tn.receiveShadow=de.receiveShadow,mr.setValue(Be,"receiveShadow",de.receiveShadow)),ne.isMeshGouraudMaterial&&ne.envMap!==null&&(Mr.envMap.value=Je,Mr.flipEnvMap.value=Je.isCubeTexture&&Je.isRenderTargetTexture===!1?-1:1),Yn&&(mr.setValue(Be,"toneMappingExposure",Y.toneMappingExposure),tn.needsLights&&ct(Mr,Wr),Re&&ne.fog===!0&&Gn.refreshFogUniforms(Mr,Re),Gn.refreshMaterialUniforms(Mr,ne,oi,Et,Ve),Jx.upload(Be,tn.uniformsList,Mr,Ft)),ne.isShaderMaterial&&ne.uniformsNeedUpdate===!0&&(Jx.upload(Be,tn.uniformsList,Mr,Ft),ne.uniformsNeedUpdate=!1),ne.isSpriteMaterial&&mr.setValue(Be,"center",de.center),mr.setValue(Be,"modelViewMatrix",de.modelViewMatrix),mr.setValue(Be,"normalMatrix",de.normalMatrix),mr.setValue(Be,"modelMatrix",de.matrixWorld),ne.isShaderMaterial||ne.isRawShaderMaterial){const ks=ne.uniformsGroups;for(let or=0,rn=ks.length;or<rn;or++)if(Qt.isWebGL2){const cr=ks[or];hn.update(cr,Yt),hn.bind(cr,Yt)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Yt}function ct(X,j){X.ambientLightColor.needsUpdate=j,X.lightProbe.needsUpdate=j,X.directionalLights.needsUpdate=j,X.directionalLightShadows.needsUpdate=j,X.pointLights.needsUpdate=j,X.pointLightShadows.needsUpdate=j,X.spotLights.needsUpdate=j,X.spotLightShadows.needsUpdate=j,X.rectAreaLights.needsUpdate=j,X.hemisphereLights.needsUpdate=j}function wt(X){return X.isMeshLambertMaterial||X.isMeshToonMaterial||X.isMeshPhongMaterial||X.isMeshStandardMaterial||X.isShadowMaterial||X.isShaderMaterial&&X.lights===!0}this.getActiveCubeFace=function(){return ae},this.getActiveMipmapLevel=function(){return le},this.getRenderTarget=function(){return Ae},this.setRenderTargetTextures=function(X,j,ie){Ct.get(X.texture).__webglTexture=j,Ct.get(X.depthTexture).__webglTexture=ie;const ne=Ct.get(X);ne.__hasExternalTextures=!0,ne.__hasExternalTextures&&(ne.__autoAllocateDepthBuffer=ie===void 0,ne.__autoAllocateDepthBuffer||ut.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ne.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(X,j){const ie=Ct.get(X);ie.__webglFramebuffer=j,ie.__useDefaultFramebuffer=j===void 0},this.setRenderTarget=function(X,j=0,ie=0){Ae=X,ae=j,le=ie;let ne=!0,de=null,Re=!1,tt=!1;if(X){const Je=Ct.get(X);Je.__useDefaultFramebuffer!==void 0?(Wt.bindFramebuffer(36160,null),ne=!1):Je.__webglFramebuffer===void 0?Ft.setupRenderTarget(X):Je.__hasExternalTextures&&Ft.rebindTextures(X,Ct.get(X.texture).__webglTexture,Ct.get(X.depthTexture).__webglTexture);const pt=X.texture;(pt.isData3DTexture||pt.isDataArrayTexture||pt.isCompressedArrayTexture)&&(tt=!0);const Lt=Ct.get(X).__webglFramebuffer;X.isWebGLCubeRenderTarget?(de=Lt[j],Re=!0):Qt.isWebGL2&&X.samples>0&&Ft.useMultisampledRTT(X)===!1?de=Ct.get(X).__webglMultisampledFramebuffer:de=Lt,Pe.copy(X.viewport),it.copy(X.scissor),Me=X.scissorTest}else Pe.copy(ce).multiplyScalar(oi).floor(),it.copy(ye).multiplyScalar(oi).floor(),Me=xe;if(Wt.bindFramebuffer(36160,de)&&Qt.drawBuffers&&ne&&Wt.drawBuffers(X,de),Wt.viewport(Pe),Wt.scissor(it),Wt.setScissorTest(Me),Re){const Je=Ct.get(X.texture);Be.framebufferTexture2D(36160,36064,34069+j,Je.__webglTexture,ie)}else if(tt){const Je=Ct.get(X.texture),pt=j||0;Be.framebufferTextureLayer(36160,36064,Je.__webglTexture,ie||0,pt)}we=-1},this.readRenderTargetPixels=function(X,j,ie,ne,de,Re,tt){if(!(X&&X.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let He=Ct.get(X).__webglFramebuffer;if(X.isWebGLCubeRenderTarget&&tt!==void 0&&(He=He[tt]),He){Wt.bindFramebuffer(36160,He);try{const Je=X.texture,pt=Je.format,Lt=Je.type;if(pt!==Dl&&at.convert(pt)!==Be.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const jt=Lt===Gm&&(ut.has("EXT_color_buffer_half_float")||Qt.isWebGL2&&ut.has("EXT_color_buffer_float"));if(Lt!==cp&&at.convert(Lt)!==Be.getParameter(35738)&&!(Lt===GA&&(Qt.isWebGL2||ut.has("OES_texture_float")||ut.has("WEBGL_color_buffer_float")))&&!jt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=X.width-ne&&ie>=0&&ie<=X.height-de&&Be.readPixels(j,ie,ne,de,at.convert(pt),at.convert(Lt),Re)}finally{const Je=Ae!==null?Ct.get(Ae).__webglFramebuffer:null;Wt.bindFramebuffer(36160,Je)}}},this.copyFramebufferToTexture=function(X,j,ie=0){const ne=Math.pow(2,-ie),de=Math.floor(j.image.width*ne),Re=Math.floor(j.image.height*ne);Ft.setTexture2D(j,0),Be.copyTexSubImage2D(3553,ie,0,0,X.x,X.y,de,Re),Wt.unbindTexture()},this.copyTextureToTexture=function(X,j,ie,ne=0){const de=j.image.width,Re=j.image.height,tt=at.convert(ie.format),He=at.convert(ie.type);Ft.setTexture2D(ie,0),Be.pixelStorei(37440,ie.flipY),Be.pixelStorei(37441,ie.premultiplyAlpha),Be.pixelStorei(3317,ie.unpackAlignment),j.isDataTexture?Be.texSubImage2D(3553,ne,X.x,X.y,de,Re,tt,He,j.image.data):j.isCompressedTexture?Be.compressedTexSubImage2D(3553,ne,X.x,X.y,j.mipmaps[0].width,j.mipmaps[0].height,tt,j.mipmaps[0].data):Be.texSubImage2D(3553,ne,X.x,X.y,tt,He,j.image),ne===0&&ie.generateMipmaps&&Be.generateMipmap(3553),Wt.unbindTexture()},this.copyTextureToTexture3D=function(X,j,ie,ne,de=0){if(Y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Re=X.max.x-X.min.x+1,tt=X.max.y-X.min.y+1,He=X.max.z-X.min.z+1,Je=at.convert(ne.format),pt=at.convert(ne.type);let Lt;if(ne.isData3DTexture)Ft.setTexture3D(ne,0),Lt=32879;else if(ne.isDataArrayTexture)Ft.setTexture2DArray(ne,0),Lt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Be.pixelStorei(37440,ne.flipY),Be.pixelStorei(37441,ne.premultiplyAlpha),Be.pixelStorei(3317,ne.unpackAlignment);const jt=Be.getParameter(3314),Gt=Be.getParameter(32878),ki=Be.getParameter(3316),wi=Be.getParameter(3315),Oi=Be.getParameter(32877),Yi=ie.isCompressedTexture?ie.mipmaps[0]:ie.image;Be.pixelStorei(3314,Yi.width),Be.pixelStorei(32878,Yi.height),Be.pixelStorei(3316,X.min.x),Be.pixelStorei(3315,X.min.y),Be.pixelStorei(32877,X.min.z),ie.isDataTexture||ie.isData3DTexture?Be.texSubImage3D(Lt,de,j.x,j.y,j.z,Re,tt,He,Je,pt,Yi.data):ie.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Be.compressedTexSubImage3D(Lt,de,j.x,j.y,j.z,Re,tt,He,Je,Yi.data)):Be.texSubImage3D(Lt,de,j.x,j.y,j.z,Re,tt,He,Je,pt,Yi),Be.pixelStorei(3314,jt),Be.pixelStorei(32878,Gt),Be.pixelStorei(3316,ki),Be.pixelStorei(3315,wi),Be.pixelStorei(32877,Oi),de===0&&ne.generateMipmaps&&Be.generateMipmap(Lt),Wt.unbindTexture()},this.initTexture=function(X){X.isCubeTexture?Ft.setTextureCube(X,0):X.isData3DTexture?Ft.setTexture3D(X,0):X.isDataArrayTexture||X.isCompressedArrayTexture?Ft.setTexture2DArray(X,0):Ft.setTexture2D(X,0),Wt.unbindTexture()},this.resetState=function(){ae=0,le=0,Ae=null,Wt.reset(),ii.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class jI extends mv{}jI.prototype.isWebGL1Renderer=!0;class jv{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Dn(e),this.density=t}clone(){return new jv(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Kv{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new Dn(e),this.near=t,this.far=r}clone(){return new Kv(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class j2 extends cs{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class $v{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=K_,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Pc()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let c=0,p=this.stride;c<p;c++)this.array[e+c]=t.array[r+c];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Pc()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Pc()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Tl=new ft;class Lc{constructor(e,t,r,c=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=c}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,r=this.data.count;t<r;t++)Tl.fromBufferAttribute(this,t),Tl.applyMatrix4(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)Tl.fromBufferAttribute(this,t),Tl.applyNormalMatrix(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)Tl.fromBufferAttribute(this,t),Tl.transformDirection(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this}setX(e,t){return this.normalized&&(t=Rs(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Rs(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Rs(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Rs(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=WA(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=WA(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=WA(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=WA(t,this.array)),t}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Rs(t,this.array),r=Rs(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,c){return e=e*this.data.stride+this.offset,this.normalized&&(t=Rs(t,this.array),r=Rs(r,this.array),c=Rs(c,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=c,this}setXYZW(e,t,r,c,p){return e=e*this.data.stride+this.offset,this.normalized&&(t=Rs(t,this.array),r=Rs(r,this.array),c=Rs(c,this.array),p=Rs(p,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=c,this.data.array[e+3]=p,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let r=0;r<this.count;r++){const c=r*this.data.stride+this.offset;for(let p=0;p<this.itemSize;p++)t.push(this.data.array[c+p])}return new ds(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Lc(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let r=0;r<this.count;r++){const c=r*this.data.stride+this.offset;for(let p=0;p<this.itemSize;p++)t.push(this.data.array[c+p])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class my extends ol{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Dn(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let bm;const c_=new ft,Bm=new ft,Cm=new ft,Em=new Di,h_=new Di,KI=new lr,mx=new ft,u_=new ft,gx=new ft,dT=new Di,Ww=new Di,pT=new Di;class gv extends cs{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",bm===void 0){bm=new br;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new $v(t,5);bm.setIndex([0,1,2,0,2,3]),bm.setAttribute("position",new Lc(r,3,0,!1)),bm.setAttribute("uv",new Lc(r,2,3,!1))}this.geometry=bm,this.material=e!==void 0?e:new my,this.center=new Di(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Bm.setFromMatrixScale(this.matrixWorld),KI.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Cm.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Bm.multiplyScalar(-Cm.z);const r=this.material.rotation;let c,p;r!==0&&(p=Math.cos(r),c=Math.sin(r));const y=this.center;_x(mx.set(-.5,-.5,0),Cm,y,Bm,c,p),_x(u_.set(.5,-.5,0),Cm,y,Bm,c,p),_x(gx.set(.5,.5,0),Cm,y,Bm,c,p),dT.set(0,0),Ww.set(1,0),pT.set(1,1);let i=e.ray.intersectTriangle(mx,u_,gx,!1,c_);if(i===null&&(_x(u_.set(-.5,.5,0),Cm,y,Bm,c,p),Ww.set(0,1),i=e.ray.intersectTriangle(mx,gx,u_,!1,c_),i===null))return;const C=e.ray.origin.distanceTo(c_);C<e.near||C>e.far||t.push({distance:C,point:c_.clone(),uv:wh.getUV(c_,mx,u_,gx,dT,Ww,pT,new Di),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function _x(u,e,t,r,c,p){Em.subVectors(u,t).addScalar(.5).multiply(r),c!==void 0?(h_.x=p*Em.x-c*Em.y,h_.y=c*Em.x+p*Em.y):h_.copy(Em),u.copy(e),u.x+=h_.x,u.y+=h_.y,u.applyMatrix4(KI)}const yx=new ft,fT=new ft;class $I extends cs{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let r=0,c=t.length;r<c;r++){const p=t[r];this.addLevel(p.object.clone(),p.distance,p.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,r=0){t=Math.abs(t);const c=this.levels;let p;for(p=0;p<c.length&&!(t<c[p].distance);p++);return c.splice(p,0,{distance:t,hysteresis:r,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let r,c;for(r=1,c=t.length;r<c;r++){let p=t[r].distance;if(t[r].object.visible&&(p-=p*t[r].hysteresis),e<p)break}return t[r-1].object}return null}raycast(e,t){if(this.levels.length>0){yx.setFromMatrixPosition(this.matrixWorld);const c=e.ray.origin.distanceTo(yx);this.getObjectForDistance(c).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yx.setFromMatrixPosition(e.matrixWorld),fT.setFromMatrixPosition(this.matrixWorld);const r=yx.distanceTo(fT)/e.zoom;t[0].object.visible=!0;let c,p;for(c=1,p=t.length;c<p;c++){let y=t[c].distance;if(t[c].object.visible&&(y-=y*t[c].hysteresis),r>=y)t[c-1].object.visible=!1,t[c].object.visible=!0;else break}for(this._currentLevel=c-1;c<p;c++)t[c].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const r=this.levels;for(let c=0,p=r.length;c<p;c++){const y=r[c];t.object.levels.push({object:y.object.uuid,distance:y.distance,hysteresis:y.hysteresis})}return t}}const mT=new ft,gT=new ls,_T=new ls,wN=new ft,yT=new lr;class ZI extends is{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new lr,this.bindMatrixInverse=new lr}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ls,t=this.geometry.attributes.skinWeight;for(let r=0,c=t.count;r<c;r++){e.fromBufferAttribute(t,r);const p=1/e.manhattanLength();p!==1/0?e.multiplyScalar(p):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const r=this.skeleton,c=this.geometry;gT.fromBufferAttribute(c.attributes.skinIndex,e),_T.fromBufferAttribute(c.attributes.skinWeight,e),mT.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let p=0;p<4;p++){const y=_T.getComponent(p);if(y!==0){const i=gT.getComponent(p);yT.multiplyMatrices(r.bones[i].matrixWorld,r.boneInverses[i]),t.addScaledVector(wN.copy(mT).applyMatrix4(yT),y)}}return t.applyMatrix4(this.bindMatrixInverse)}}class K2 extends cs{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Qm extends To{constructor(e=null,t=1,r=1,c,p,y,i,C,D=Co,U=Co,N,R){super(null,y,i,C,D,U,c,p,N,R),this.isDataTexture=!0,this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const xT=new lr,bN=new lr;class Zv{constructor(e=[],t=[]){this.uuid=Pc(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let r=0,c=this.bones.length;r<c;r++)this.boneInverses.push(new lr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const r=new lr;this.bones[e]&&r.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(r)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const r=this.bones[e];r&&r.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const r=this.bones[e];r&&(r.parent&&r.parent.isBone?(r.matrix.copy(r.parent.matrixWorld).invert(),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))}}update(){const e=this.bones,t=this.boneInverses,r=this.boneMatrices,c=this.boneTexture;for(let p=0,y=e.length;p<y;p++){const i=e[p]?e[p].matrixWorld:bN;xT.multiplyMatrices(i,t[p]),xT.toArray(r,p*16)}c!==null&&(c.needsUpdate=!0)}clone(){return new Zv(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=FI(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const r=new Qm(t,e,e,Dl,GA);return r.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=r,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,r=this.bones.length;t<r;t++){const c=this.bones[t];if(c.name===e)return c}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let r=0,c=e.bones.length;r<c;r++){const p=e.bones[r];let y=t[p];y===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",p),y=new K2),this.bones.push(y),this.boneInverses.push(new lr().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,r=this.boneInverses;for(let c=0,p=t.length;c<p;c++){const y=t[c];e.bones.push(y.uuid);const i=r[c];e.boneInverses.push(i.toArray())}return e}}class Km extends ds{constructor(e,t,r,c=1){super(e,t,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=c}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const vT=new lr,wT=new lr,xx=[],BN=new lr,A_=new is;class XI extends is{constructor(e,t,r){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Km(new Float32Array(r*16),16),this.instanceColor=null,this.count=r,this.frustumCulled=!1;for(let c=0;c<r;c++)this.setMatrixAt(c,BN)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const r=this.matrixWorld,c=this.count;if(A_.geometry=this.geometry,A_.material=this.material,A_.material!==void 0)for(let p=0;p<c;p++){this.getMatrixAt(p,vT),wT.multiplyMatrices(r,vT),A_.matrixWorld=wT,A_.raycast(e,xx);for(let y=0,i=xx.length;y<i;y++){const C=xx[y];C.instanceId=p,C.object=this,t.push(C)}xx.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Km(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class sa extends ol{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Dn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const bT=new ft,BT=new ft,CT=new lr,jw=new Ay,vx=new qA;class Ku extends cs{constructor(e=new br,t=new sa){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[0];for(let c=1,p=t.count;c<p;c++)bT.fromBufferAttribute(t,c-1),BT.fromBufferAttribute(t,c),r[c]=r[c-1],r[c]+=bT.distanceTo(BT);e.setAttribute("lineDistance",new jn(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const r=this.geometry,c=this.matrixWorld,p=e.params.Line.threshold,y=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),vx.copy(r.boundingSphere),vx.applyMatrix4(c),vx.radius+=p,e.ray.intersectsSphere(vx)===!1)return;CT.copy(c).invert(),jw.copy(e.ray).applyMatrix4(CT);const i=p/((this.scale.x+this.scale.y+this.scale.z)/3),C=i*i,D=new ft,U=new ft,N=new ft,R=new ft,G=this.isLineSegments?2:1,J=r.index,B=r.attributes.position;if(J!==null){const ae=Math.max(0,y.start),le=Math.min(J.count,y.start+y.count);for(let Ae=ae,we=le-1;Ae<we;Ae+=G){const me=J.getX(Ae),Pe=J.getX(Ae+1);if(D.fromBufferAttribute(B,me),U.fromBufferAttribute(B,Pe),jw.distanceSqToSegment(D,U,R,N)>C)continue;R.applyMatrix4(this.matrixWorld);const Me=e.ray.origin.distanceTo(R);Me<e.near||Me>e.far||t.push({distance:Me,point:N.clone().applyMatrix4(this.matrixWorld),index:Ae,face:null,faceIndex:null,object:this})}}else{const ae=Math.max(0,y.start),le=Math.min(B.count,y.start+y.count);for(let Ae=ae,we=le-1;Ae<we;Ae+=G){if(D.fromBufferAttribute(B,Ae),U.fromBufferAttribute(B,Ae+1),jw.distanceSqToSegment(D,U,R,N)>C)continue;R.applyMatrix4(this.matrixWorld);const Pe=e.ray.origin.distanceTo(R);Pe<e.near||Pe>e.far||t.push({distance:Pe,point:N.clone().applyMatrix4(this.matrixWorld),index:Ae,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const c=t[r[0]];if(c!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let p=0,y=c.length;p<y;p++){const i=c[p].name||String(p);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=p}}}}}const ET=new ft,TT=new ft;class Yu extends Ku{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let c=0,p=t.count;c<p;c+=2)ET.fromBufferAttribute(t,c),TT.fromBufferAttribute(t,c+1),r[c]=c===0?0:r[c-1],r[c+1]=r[c]+ET.distanceTo(TT);e.setAttribute("lineDistance",new jn(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class _v extends Ku{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class $2 extends ol{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Dn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const ST=new lr,c2=new Ay,wx=new qA,bx=new ft;class Z2 extends cs{constructor(e=new br,t=new $2){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const r=this.geometry,c=this.matrixWorld,p=e.params.Points.threshold,y=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),wx.copy(r.boundingSphere),wx.applyMatrix4(c),wx.radius+=p,e.ray.intersectsSphere(wx)===!1)return;ST.copy(c).invert(),c2.copy(e.ray).applyMatrix4(ST);const i=p/((this.scale.x+this.scale.y+this.scale.z)/3),C=i*i,D=r.index,N=r.attributes.position;if(D!==null){const R=Math.max(0,y.start),G=Math.min(D.count,y.start+y.count);for(let J=R,Y=G;J<Y;J++){const B=D.getX(J);bx.fromBufferAttribute(N,B),MT(bx,B,C,c,e,t,this)}}else{const R=Math.max(0,y.start),G=Math.min(N.count,y.start+y.count);for(let J=R,Y=G;J<Y;J++)bx.fromBufferAttribute(N,J),MT(bx,J,C,c,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const c=t[r[0]];if(c!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let p=0,y=c.length;p<y;p++){const i=c[p].name||String(p);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=p}}}}}function MT(u,e,t,r,c,p,y){const i=c2.distanceSqToPoint(u);if(i<t){const C=new ft;c2.closestPointToPoint(u,C),C.applyMatrix4(r);const D=c.ray.origin.distanceTo(C);if(D<c.near||D>c.far)return;p.push({distance:D,distanceToRay:Math.sqrt(i),point:C,index:e,face:null,object:y})}}class CN extends To{constructor(e,t,r,c,p,y,i,C,D){super(e,t,r,c,p,y,i,C,D),this.isVideoTexture=!0,this.minFilter=y!==void 0?y:Xs,this.magFilter=p!==void 0?p:Xs,this.generateMipmaps=!1;const U=this;function N(){U.needsUpdate=!0,e.requestVideoFrameCallback(N)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(N)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class EN extends To{constructor(e,t,r){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=r,this.magFilter=Co,this.minFilter=Co,this.generateMipmaps=!1,this.needsUpdate=!0}}class X2 extends To{constructor(e,t,r,c,p,y,i,C,D,U,N,R){super(null,y,i,C,D,U,c,p,N,R),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class TN extends X2{constructor(e,t,r,c,p,y){super(e,t,r,p,y),this.isCompressedArrayTexture=!0,this.image.depth=c,this.wrapR=rl}}class qI extends To{constructor(e,t,r,c,p,y,i,C,D){super(e,t,r,c,p,y,i,C,D),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Au{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,c=this.getPoint(0),p=0;t.push(0);for(let y=1;y<=e;y++)r=this.getPoint(y/e),p+=r.distanceTo(c),t.push(p),c=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let c=0;const p=r.length;let y;t?y=t:y=e*r[p-1];let i=0,C=p-1,D;for(;i<=C;)if(c=Math.floor(i+(C-i)/2),D=r[c]-y,D<0)i=c+1;else if(D>0)C=c-1;else{C=c;break}if(c=C,r[c]===y)return c/(p-1);const U=r[c],R=r[c+1]-U,G=(y-U)/R;return(c+G)/(p-1)}getTangent(e,t){let c=e-1e-4,p=e+1e-4;c<0&&(c=0),p>1&&(p=1);const y=this.getPoint(c),i=this.getPoint(p),C=t||(y.isVector2?new Di:new ft);return C.copy(i).sub(y).normalize(),C}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new ft,c=[],p=[],y=[],i=new ft,C=new lr;for(let G=0;G<=e;G++){const J=G/e;c[G]=this.getTangentAt(J,new ft)}p[0]=new ft,y[0]=new ft;let D=Number.MAX_VALUE;const U=Math.abs(c[0].x),N=Math.abs(c[0].y),R=Math.abs(c[0].z);U<=D&&(D=U,r.set(1,0,0)),N<=D&&(D=N,r.set(0,1,0)),R<=D&&r.set(0,0,1),i.crossVectors(c[0],r).normalize(),p[0].crossVectors(c[0],i),y[0].crossVectors(c[0],p[0]);for(let G=1;G<=e;G++){if(p[G]=p[G-1].clone(),y[G]=y[G-1].clone(),i.crossVectors(c[G-1],c[G]),i.length()>Number.EPSILON){i.normalize();const J=Math.acos(Eo(c[G-1].dot(c[G]),-1,1));p[G].applyMatrix4(C.makeRotationAxis(i,J))}y[G].crossVectors(c[G],p[G])}if(t===!0){let G=Math.acos(Eo(p[0].dot(p[e]),-1,1));G/=e,c[0].dot(i.crossVectors(p[0],p[e]))>0&&(G=-G);for(let J=1;J<=e;J++)p[J].applyMatrix4(C.makeRotationAxis(c[J],G*J)),y[J].crossVectors(c[J],p[J])}return{tangents:c,normals:p,binormals:y}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Xv extends Au{constructor(e=0,t=0,r=1,c=1,p=0,y=Math.PI*2,i=!1,C=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=c,this.aStartAngle=p,this.aEndAngle=y,this.aClockwise=i,this.aRotation=C}getPoint(e,t){const r=t||new Di,c=Math.PI*2;let p=this.aEndAngle-this.aStartAngle;const y=Math.abs(p)<Number.EPSILON;for(;p<0;)p+=c;for(;p>c;)p-=c;p<Number.EPSILON&&(y?p=0:p=c),this.aClockwise===!0&&!y&&(p===c?p=-c:p=p-c);const i=this.aStartAngle+e*p;let C=this.aX+this.xRadius*Math.cos(i),D=this.aY+this.yRadius*Math.sin(i);if(this.aRotation!==0){const U=Math.cos(this.aRotation),N=Math.sin(this.aRotation),R=C-this.aX,G=D-this.aY;C=R*U-G*N+this.aX,D=R*N+G*U+this.aY}return r.set(C,D)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class YI extends Xv{constructor(e,t,r,c,p,y){super(e,t,r,r,c,p,y),this.isArcCurve=!0,this.type="ArcCurve"}}function q2(){let u=0,e=0,t=0,r=0;function c(p,y,i,C){u=p,e=i,t=-3*p+3*y-2*i-C,r=2*p-2*y+i+C}return{initCatmullRom:function(p,y,i,C,D){c(y,i,D*(i-p),D*(C-y))},initNonuniformCatmullRom:function(p,y,i,C,D,U,N){let R=(y-p)/D-(i-p)/(D+U)+(i-y)/U,G=(i-y)/U-(C-y)/(U+N)+(C-i)/N;R*=U,G*=U,c(y,i,R,G)},calc:function(p){const y=p*p,i=y*p;return u+e*p+t*y+r*i}}}const Bx=new ft,Kw=new q2,$w=new q2,Zw=new q2;class X_ extends Au{constructor(e=[],t=!1,r="centripetal",c=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=c}getPoint(e,t=new ft){const r=t,c=this.points,p=c.length,y=(p-(this.closed?0:1))*e;let i=Math.floor(y),C=y-i;this.closed?i+=i>0?0:(Math.floor(Math.abs(i)/p)+1)*p:C===0&&i===p-1&&(i=p-2,C=1);let D,U;this.closed||i>0?D=c[(i-1)%p]:(Bx.subVectors(c[0],c[1]).add(c[0]),D=Bx);const N=c[i%p],R=c[(i+1)%p];if(this.closed||i+2<p?U=c[(i+2)%p]:(Bx.subVectors(c[p-1],c[p-2]).add(c[p-1]),U=Bx),this.curveType==="centripetal"||this.curveType==="chordal"){const G=this.curveType==="chordal"?.5:.25;let J=Math.pow(D.distanceToSquared(N),G),Y=Math.pow(N.distanceToSquared(R),G),B=Math.pow(R.distanceToSquared(U),G);Y<1e-4&&(Y=1),J<1e-4&&(J=Y),B<1e-4&&(B=Y),Kw.initNonuniformCatmullRom(D.x,N.x,R.x,U.x,J,Y,B),$w.initNonuniformCatmullRom(D.y,N.y,R.y,U.y,J,Y,B),Zw.initNonuniformCatmullRom(D.z,N.z,R.z,U.z,J,Y,B)}else this.curveType==="catmullrom"&&(Kw.initCatmullRom(D.x,N.x,R.x,U.x,this.tension),$w.initCatmullRom(D.y,N.y,R.y,U.y,this.tension),Zw.initCatmullRom(D.z,N.z,R.z,U.z,this.tension));return r.set(Kw.calc(C),$w.calc(C),Zw.calc(C)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const c=e.points[t];this.points.push(c.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const c=this.points[t];e.points.push(c.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const c=e.points[t];this.points.push(new ft().fromArray(c))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function IT(u,e,t,r,c){const p=(r-e)*.5,y=(c-t)*.5,i=u*u,C=u*i;return(2*t-2*r+p+y)*C+(-3*t+3*r-2*p-y)*i+p*u+t}function SN(u,e){const t=1-u;return t*t*e}function MN(u,e){return 2*(1-u)*u*e}function IN(u,e){return u*u*e}function D_(u,e,t,r){return SN(u,e)+MN(u,t)+IN(u,r)}function FN(u,e){const t=1-u;return t*t*t*e}function LN(u,e){const t=1-u;return 3*t*t*u*e}function DN(u,e){return 3*(1-u)*u*u*e}function PN(u,e){return u*u*u*e}function P_(u,e,t,r,c){return FN(u,e)+LN(u,t)+DN(u,r)+PN(u,c)}class Y2 extends Au{constructor(e=new Di,t=new Di,r=new Di,c=new Di){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=c}getPoint(e,t=new Di){const r=t,c=this.v0,p=this.v1,y=this.v2,i=this.v3;return r.set(P_(e,c.x,p.x,y.x,i.x),P_(e,c.y,p.y,y.y,i.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class JI extends Au{constructor(e=new ft,t=new ft,r=new ft,c=new ft){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=c}getPoint(e,t=new ft){const r=t,c=this.v0,p=this.v1,y=this.v2,i=this.v3;return r.set(P_(e,c.x,p.x,y.x,i.x),P_(e,c.y,p.y,y.y,i.y),P_(e,c.z,p.z,y.z,i.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class qv extends Au{constructor(e=new Di,t=new Di){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Di){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const r=t||new Di;return r.copy(this.v2).sub(this.v1).normalize(),r}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class eF extends Au{constructor(e=new ft,t=new ft){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ft){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class J2 extends Au{constructor(e=new Di,t=new Di,r=new Di){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new Di){const r=t,c=this.v0,p=this.v1,y=this.v2;return r.set(D_(e,c.x,p.x,y.x),D_(e,c.y,p.y,y.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class eB extends Au{constructor(e=new ft,t=new ft,r=new ft){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new ft){const r=t,c=this.v0,p=this.v1,y=this.v2;return r.set(D_(e,c.x,p.x,y.x),D_(e,c.y,p.y,y.y),D_(e,c.z,p.z,y.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class tB extends Au{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Di){const r=t,c=this.points,p=(c.length-1)*e,y=Math.floor(p),i=p-y,C=c[y===0?y:y-1],D=c[y],U=c[y>c.length-2?c.length-1:y+1],N=c[y>c.length-3?c.length-1:y+2];return r.set(IT(i,C.x,D.x,U.x,N.x),IT(i,C.y,D.y,U.y,N.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const c=e.points[t];this.points.push(c.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const c=this.points[t];e.points.push(c.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const c=e.points[t];this.points.push(new Di().fromArray(c))}return this}}var iB=Object.freeze({__proto__:null,ArcCurve:YI,CatmullRomCurve3:X_,CubicBezierCurve:Y2,CubicBezierCurve3:JI,EllipseCurve:Xv,LineCurve:qv,LineCurve3:eF,QuadraticBezierCurve:J2,QuadraticBezierCurve3:eB,SplineCurve:tB});class tF extends Au{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new qv(t,e))}getPoint(e,t){const r=e*this.getLength(),c=this.getCurveLengths();let p=0;for(;p<c.length;){if(c[p]>=r){const y=c[p]-r,i=this.curves[p],C=i.getLength(),D=C===0?0:1-y/C;return i.getPointAt(D,t)}p++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let r=0,c=this.curves.length;r<c;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let r;for(let c=0,p=this.curves;c<p.length;c++){const y=p[c],i=y.isEllipseCurve?e*2:y.isLineCurve||y.isLineCurve3?1:y.isSplineCurve?e*y.points.length:e,C=y.getPoints(i);for(let D=0;D<C.length;D++){const U=C[D];r&&r.equals(U)||(t.push(U),r=U)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const c=e.curves[t];this.curves.push(c.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){const c=this.curves[t];e.curves.push(c.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const c=e.curves[t];this.curves.push(new iB[c.type]().fromJSON(c))}return this}}class q_ extends tF{constructor(e){super(),this.type="Path",this.currentPoint=new Di,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const r=new qv(this.currentPoint.clone(),new Di(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,c){const p=new J2(this.currentPoint.clone(),new Di(e,t),new Di(r,c));return this.curves.push(p),this.currentPoint.set(r,c),this}bezierCurveTo(e,t,r,c,p,y){const i=new Y2(this.currentPoint.clone(),new Di(e,t),new Di(r,c),new Di(p,y));return this.curves.push(i),this.currentPoint.set(p,y),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),r=new tB(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,c,p,y){const i=this.currentPoint.x,C=this.currentPoint.y;return this.absarc(e+i,t+C,r,c,p,y),this}absarc(e,t,r,c,p,y){return this.absellipse(e,t,r,r,c,p,y),this}ellipse(e,t,r,c,p,y,i,C){const D=this.currentPoint.x,U=this.currentPoint.y;return this.absellipse(e+D,t+U,r,c,p,y,i,C),this}absellipse(e,t,r,c,p,y,i,C){const D=new Xv(e,t,r,c,p,y,i,C);if(this.curves.length>0){const N=D.getPoint(0);N.equals(this.currentPoint)||this.lineTo(N.x,N.y)}this.curves.push(D);const U=D.getPoint(1);return this.currentPoint.copy(U),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class eg extends br{constructor(e=[new Di(0,-.5),new Di(.5,0),new Di(0,.5)],t=12,r=0,c=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:c},t=Math.floor(t),c=Eo(c,0,Math.PI*2);const p=[],y=[],i=[],C=[],D=[],U=1/t,N=new ft,R=new Di,G=new ft,J=new ft,Y=new ft;let B=0,ae=0;for(let le=0;le<=e.length-1;le++)switch(le){case 0:B=e[le+1].x-e[le].x,ae=e[le+1].y-e[le].y,G.x=ae*1,G.y=-B,G.z=ae*0,Y.copy(G),G.normalize(),C.push(G.x,G.y,G.z);break;case e.length-1:C.push(Y.x,Y.y,Y.z);break;default:B=e[le+1].x-e[le].x,ae=e[le+1].y-e[le].y,G.x=ae*1,G.y=-B,G.z=ae*0,J.copy(G),G.x+=Y.x,G.y+=Y.y,G.z+=Y.z,G.normalize(),C.push(G.x,G.y,G.z),Y.copy(J)}for(let le=0;le<=t;le++){const Ae=r+le*U*c,we=Math.sin(Ae),me=Math.cos(Ae);for(let Pe=0;Pe<=e.length-1;Pe++){N.x=e[Pe].x*we,N.y=e[Pe].y,N.z=e[Pe].x*me,y.push(N.x,N.y,N.z),R.x=le/t,R.y=Pe/(e.length-1),i.push(R.x,R.y);const it=C[3*Pe+0]*we,Me=C[3*Pe+1],Ke=C[3*Pe+0]*me;D.push(it,Me,Ke)}}for(let le=0;le<t;le++)for(let Ae=0;Ae<e.length-1;Ae++){const we=Ae+le*e.length,me=we,Pe=we+e.length,it=we+e.length+1,Me=we+1;p.push(me,Pe,Me),p.push(it,Me,Pe)}this.setIndex(p),this.setAttribute("position",new jn(y,3)),this.setAttribute("uv",new jn(i,2)),this.setAttribute("normal",new jn(D,3))}static fromJSON(e){return new eg(e.points,e.segments,e.phiStart,e.phiLength)}}class gy extends eg{constructor(e=1,t=1,r=4,c=8){const p=new q_;p.absarc(0,-t/2,e,Math.PI*1.5,0),p.absarc(0,t/2,e,0,Math.PI*.5),super(p.getPoints(r),c),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:r,radialSegments:c}}static fromJSON(e){return new gy(e.radius,e.length,e.capSegments,e.radialSegments)}}class _y extends br{constructor(e=1,t=32,r=0,c=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:c},t=Math.max(3,t);const p=[],y=[],i=[],C=[],D=new ft,U=new Di;y.push(0,0,0),i.push(0,0,1),C.push(.5,.5);for(let N=0,R=3;N<=t;N++,R+=3){const G=r+N/t*c;D.x=e*Math.cos(G),D.y=e*Math.sin(G),y.push(D.x,D.y,D.z),i.push(0,0,1),U.x=(y[R]/e+1)/2,U.y=(y[R+1]/e+1)/2,C.push(U.x,U.y)}for(let N=1;N<=t;N++)p.push(N,N+1,0);this.setIndex(p),this.setAttribute("position",new jn(y,3)),this.setAttribute("normal",new jn(i,3)),this.setAttribute("uv",new jn(C,2))}static fromJSON(e){return new _y(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class wf extends br{constructor(e=1,t=1,r=1,c=32,p=1,y=!1,i=0,C=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:c,heightSegments:p,openEnded:y,thetaStart:i,thetaLength:C};const D=this;c=Math.floor(c),p=Math.floor(p);const U=[],N=[],R=[],G=[];let J=0;const Y=[],B=r/2;let ae=0;le(),y===!1&&(e>0&&Ae(!0),t>0&&Ae(!1)),this.setIndex(U),this.setAttribute("position",new jn(N,3)),this.setAttribute("normal",new jn(R,3)),this.setAttribute("uv",new jn(G,2));function le(){const we=new ft,me=new ft;let Pe=0;const it=(t-e)/r;for(let Me=0;Me<=p;Me++){const Ke=[],Et=Me/p,oi=Et*(t-e)+e;for(let Ci=0;Ci<=c;Ci++){const te=Ci/c,ce=te*C+i,ye=Math.sin(ce),xe=Math.cos(ce);me.x=oi*ye,me.y=-Et*r+B,me.z=oi*xe,N.push(me.x,me.y,me.z),we.set(ye,it,xe).normalize(),R.push(we.x,we.y,we.z),G.push(te,1-Et),Ke.push(J++)}Y.push(Ke)}for(let Me=0;Me<c;Me++)for(let Ke=0;Ke<p;Ke++){const Et=Y[Ke][Me],oi=Y[Ke+1][Me],Ci=Y[Ke+1][Me+1],te=Y[Ke][Me+1];U.push(Et,oi,te),U.push(oi,Ci,te),Pe+=6}D.addGroup(ae,Pe,0),ae+=Pe}function Ae(we){const me=J,Pe=new Di,it=new ft;let Me=0;const Ke=we===!0?e:t,Et=we===!0?1:-1;for(let Ci=1;Ci<=c;Ci++)N.push(0,B*Et,0),R.push(0,Et,0),G.push(.5,.5),J++;const oi=J;for(let Ci=0;Ci<=c;Ci++){const ce=Ci/c*C+i,ye=Math.cos(ce),xe=Math.sin(ce);it.x=Ke*xe,it.y=B*Et,it.z=Ke*ye,N.push(it.x,it.y,it.z),R.push(0,Et,0),Pe.x=ye*.5+.5,Pe.y=xe*.5*Et+.5,G.push(Pe.x,Pe.y),J++}for(let Ci=0;Ci<c;Ci++){const te=me+Ci,ce=oi+Ci;we===!0?U.push(ce,ce+1,te):U.push(ce+1,ce,te),Me+=3}D.addGroup(ae,Me,we===!0?1:2),ae+=Me}}static fromJSON(e){return new wf(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class yf extends wf{constructor(e=1,t=1,r=32,c=1,p=!1,y=0,i=Math.PI*2){super(0,e,t,r,c,p,y,i),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:c,openEnded:p,thetaStart:y,thetaLength:i}}static fromJSON(e){return new yf(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class JA extends br{constructor(e=[],t=[],r=1,c=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:c};const p=[],y=[];i(c),D(r),U(),this.setAttribute("position",new jn(p,3)),this.setAttribute("normal",new jn(p.slice(),3)),this.setAttribute("uv",new jn(y,2)),c===0?this.computeVertexNormals():this.normalizeNormals();function i(le){const Ae=new ft,we=new ft,me=new ft;for(let Pe=0;Pe<t.length;Pe+=3)G(t[Pe+0],Ae),G(t[Pe+1],we),G(t[Pe+2],me),C(Ae,we,me,le)}function C(le,Ae,we,me){const Pe=me+1,it=[];for(let Me=0;Me<=Pe;Me++){it[Me]=[];const Ke=le.clone().lerp(we,Me/Pe),Et=Ae.clone().lerp(we,Me/Pe),oi=Pe-Me;for(let Ci=0;Ci<=oi;Ci++)Ci===0&&Me===Pe?it[Me][Ci]=Ke:it[Me][Ci]=Ke.clone().lerp(Et,Ci/oi)}for(let Me=0;Me<Pe;Me++)for(let Ke=0;Ke<2*(Pe-Me)-1;Ke++){const Et=Math.floor(Ke/2);Ke%2===0?(R(it[Me][Et+1]),R(it[Me+1][Et]),R(it[Me][Et])):(R(it[Me][Et+1]),R(it[Me+1][Et+1]),R(it[Me+1][Et]))}}function D(le){const Ae=new ft;for(let we=0;we<p.length;we+=3)Ae.x=p[we+0],Ae.y=p[we+1],Ae.z=p[we+2],Ae.normalize().multiplyScalar(le),p[we+0]=Ae.x,p[we+1]=Ae.y,p[we+2]=Ae.z}function U(){const le=new ft;for(let Ae=0;Ae<p.length;Ae+=3){le.x=p[Ae+0],le.y=p[Ae+1],le.z=p[Ae+2];const we=B(le)/2/Math.PI+.5,me=ae(le)/Math.PI+.5;y.push(we,1-me)}J(),N()}function N(){for(let le=0;le<y.length;le+=6){const Ae=y[le+0],we=y[le+2],me=y[le+4],Pe=Math.max(Ae,we,me),it=Math.min(Ae,we,me);Pe>.9&&it<.1&&(Ae<.2&&(y[le+0]+=1),we<.2&&(y[le+2]+=1),me<.2&&(y[le+4]+=1))}}function R(le){p.push(le.x,le.y,le.z)}function G(le,Ae){const we=le*3;Ae.x=e[we+0],Ae.y=e[we+1],Ae.z=e[we+2]}function J(){const le=new ft,Ae=new ft,we=new ft,me=new ft,Pe=new Di,it=new Di,Me=new Di;for(let Ke=0,Et=0;Ke<p.length;Ke+=9,Et+=6){le.set(p[Ke+0],p[Ke+1],p[Ke+2]),Ae.set(p[Ke+3],p[Ke+4],p[Ke+5]),we.set(p[Ke+6],p[Ke+7],p[Ke+8]),Pe.set(y[Et+0],y[Et+1]),it.set(y[Et+2],y[Et+3]),Me.set(y[Et+4],y[Et+5]),me.copy(le).add(Ae).add(we).divideScalar(3);const oi=B(me);Y(Pe,Et+0,le,oi),Y(it,Et+2,Ae,oi),Y(Me,Et+4,we,oi)}}function Y(le,Ae,we,me){me<0&&le.x===1&&(y[Ae]=le.x-1),we.x===0&&we.z===0&&(y[Ae]=me/2/Math.PI+.5)}function B(le){return Math.atan2(le.z,-le.x)}function ae(le){return Math.atan2(-le.y,Math.sqrt(le.x*le.x+le.z*le.z))}}static fromJSON(e){return new JA(e.vertices,e.indices,e.radius,e.details)}}class yy extends JA{constructor(e=1,t=0){const r=(1+Math.sqrt(5))/2,c=1/r,p=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-c,-r,0,-c,r,0,c,-r,0,c,r,-c,-r,0,-c,r,0,c,-r,0,c,r,0,-r,0,-c,r,0,-c,-r,0,c,r,0,c],y=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(p,y,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new yy(e.radius,e.detail)}}const Cx=new ft,Ex=new ft,Xw=new ft,Tx=new wh;class iF extends br{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const c=Math.pow(10,4),p=Math.cos(pf*t),y=e.getIndex(),i=e.getAttribute("position"),C=y?y.count:i.count,D=[0,0,0],U=["a","b","c"],N=new Array(3),R={},G=[];for(let J=0;J<C;J+=3){y?(D[0]=y.getX(J),D[1]=y.getX(J+1),D[2]=y.getX(J+2)):(D[0]=J,D[1]=J+1,D[2]=J+2);const{a:Y,b:B,c:ae}=Tx;if(Y.fromBufferAttribute(i,D[0]),B.fromBufferAttribute(i,D[1]),ae.fromBufferAttribute(i,D[2]),Tx.getNormal(Xw),N[0]=`${Math.round(Y.x*c)},${Math.round(Y.y*c)},${Math.round(Y.z*c)}`,N[1]=`${Math.round(B.x*c)},${Math.round(B.y*c)},${Math.round(B.z*c)}`,N[2]=`${Math.round(ae.x*c)},${Math.round(ae.y*c)},${Math.round(ae.z*c)}`,!(N[0]===N[1]||N[1]===N[2]||N[2]===N[0]))for(let le=0;le<3;le++){const Ae=(le+1)%3,we=N[le],me=N[Ae],Pe=Tx[U[le]],it=Tx[U[Ae]],Me=`${we}_${me}`,Ke=`${me}_${we}`;Ke in R&&R[Ke]?(Xw.dot(R[Ke].normal)<=p&&(G.push(Pe.x,Pe.y,Pe.z),G.push(it.x,it.y,it.z)),R[Ke]=null):Me in R||(R[Me]={index0:D[le],index1:D[Ae],normal:Xw.clone()})}}for(const J in R)if(R[J]){const{index0:Y,index1:B}=R[J];Cx.fromBufferAttribute(i,Y),Ex.fromBufferAttribute(i,B),G.push(Cx.x,Cx.y,Cx.z),G.push(Ex.x,Ex.y,Ex.z)}this.setAttribute("position",new jn(G,3))}}}class np extends q_{constructor(e){super(e),this.uuid=Pc(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let r=0,c=this.holes.length;r<c;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const c=e.holes[t];this.holes.push(c.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){const c=this.holes[t];e.holes.push(c.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const c=e.holes[t];this.holes.push(new q_().fromJSON(c))}return this}}const UN={triangulate:function(u,e,t=2){const r=e&&e.length,c=r?e[0]*t:u.length;let p=nF(u,0,c,t,!0);const y=[];if(!p||p.next===p.prev)return y;let i,C,D,U,N,R,G;if(r&&(p=NN(u,e,p,t)),u.length>80*t){i=D=u[0],C=U=u[1];for(let J=t;J<c;J+=t)N=u[J],R=u[J+1],N<i&&(i=N),R<C&&(C=R),N>D&&(D=N),R>U&&(U=R);G=Math.max(D-i,U-C),G=G!==0?32767/G:0}return Y_(p,y,t,i,C,G,0),y}};function nF(u,e,t,r,c){let p,y;if(c===qN(u,e,t,r)>0)for(p=e;p<t;p+=r)y=FT(p,u[p],u[p+1],y);else for(p=t-r;p>=e;p-=r)y=FT(p,u[p],u[p+1],y);return y&&Yv(y,y.next)&&(ey(y),y=y.next),y}function xf(u,e){if(!u)return u;e||(e=u);let t=u,r;do if(r=!1,!t.steiner&&(Yv(t,t.next)||co(t.prev,t,t.next)===0)){if(ey(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Y_(u,e,t,r,c,p,y){if(!u)return;!y&&p&&WN(u,r,c,p);let i=u,C,D;for(;u.prev!==u.next;){if(C=u.prev,D=u.next,p?zN(u,r,c,p):RN(u)){e.push(C.i/t|0),e.push(u.i/t|0),e.push(D.i/t|0),ey(u),u=D.next,i=D.next;continue}if(u=D,u===i){y?y===1?(u=kN(xf(u),e,t),Y_(u,e,t,r,c,p,2)):y===2&&ON(u,e,t,r,c,p):Y_(xf(u),e,t,r,c,p,1);break}}}function RN(u){const e=u.prev,t=u,r=u.next;if(co(e,t,r)>=0)return!1;const c=e.x,p=t.x,y=r.x,i=e.y,C=t.y,D=r.y,U=c<p?c<y?c:y:p<y?p:y,N=i<C?i<D?i:D:C<D?C:D,R=c>p?c>y?c:y:p>y?p:y,G=i>C?i>D?i:D:C>D?C:D;let J=r.next;for(;J!==e;){if(J.x>=U&&J.x<=R&&J.y>=N&&J.y<=G&&Rm(c,i,p,C,y,D,J.x,J.y)&&co(J.prev,J,J.next)>=0)return!1;J=J.next}return!0}function zN(u,e,t,r){const c=u.prev,p=u,y=u.next;if(co(c,p,y)>=0)return!1;const i=c.x,C=p.x,D=y.x,U=c.y,N=p.y,R=y.y,G=i<C?i<D?i:D:C<D?C:D,J=U<N?U<R?U:R:N<R?N:R,Y=i>C?i>D?i:D:C>D?C:D,B=U>N?U>R?U:R:N>R?N:R,ae=h2(G,J,e,t,r),le=h2(Y,B,e,t,r);let Ae=u.prevZ,we=u.nextZ;for(;Ae&&Ae.z>=ae&&we&&we.z<=le;){if(Ae.x>=G&&Ae.x<=Y&&Ae.y>=J&&Ae.y<=B&&Ae!==c&&Ae!==y&&Rm(i,U,C,N,D,R,Ae.x,Ae.y)&&co(Ae.prev,Ae,Ae.next)>=0||(Ae=Ae.prevZ,we.x>=G&&we.x<=Y&&we.y>=J&&we.y<=B&&we!==c&&we!==y&&Rm(i,U,C,N,D,R,we.x,we.y)&&co(we.prev,we,we.next)>=0))return!1;we=we.nextZ}for(;Ae&&Ae.z>=ae;){if(Ae.x>=G&&Ae.x<=Y&&Ae.y>=J&&Ae.y<=B&&Ae!==c&&Ae!==y&&Rm(i,U,C,N,D,R,Ae.x,Ae.y)&&co(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.prevZ}for(;we&&we.z<=le;){if(we.x>=G&&we.x<=Y&&we.y>=J&&we.y<=B&&we!==c&&we!==y&&Rm(i,U,C,N,D,R,we.x,we.y)&&co(we.prev,we,we.next)>=0)return!1;we=we.nextZ}return!0}function kN(u,e,t){let r=u;do{const c=r.prev,p=r.next.next;!Yv(c,p)&&rF(c,r,r.next,p)&&J_(c,p)&&J_(p,c)&&(e.push(c.i/t|0),e.push(r.i/t|0),e.push(p.i/t|0),ey(r),ey(r.next),r=u=p),r=r.next}while(r!==u);return xf(r)}function ON(u,e,t,r,c,p){let y=u;do{let i=y.next.next;for(;i!==y.prev;){if(y.i!==i.i&&$N(y,i)){let C=sF(y,i);y=xf(y,y.next),C=xf(C,C.next),Y_(y,e,t,r,c,p,0),Y_(C,e,t,r,c,p,0);return}i=i.next}y=y.next}while(y!==u)}function NN(u,e,t,r){const c=[];let p,y,i,C,D;for(p=0,y=e.length;p<y;p++)i=e[p]*r,C=p<y-1?e[p+1]*r:u.length,D=nF(u,i,C,r,!1),D===D.next&&(D.steiner=!0),c.push(KN(D));for(c.sort(QN),p=0;p<c.length;p++)t=VN(c[p],t);return t}function QN(u,e){return u.x-e.x}function VN(u,e){const t=HN(u,e);if(!t)return e;const r=sF(t,u);return xf(r,r.next),xf(t,t.next)}function HN(u,e){let t=e,r=-1/0,c;const p=u.x,y=u.y;do{if(y<=t.y&&y>=t.next.y&&t.next.y!==t.y){const R=t.x+(y-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(R<=p&&R>r&&(r=R,c=t.x<t.next.x?t:t.next,R===p))return c}t=t.next}while(t!==e);if(!c)return null;const i=c,C=c.x,D=c.y;let U=1/0,N;t=c;do p>=t.x&&t.x>=C&&p!==t.x&&Rm(y<D?p:r,y,C,D,y<D?r:p,y,t.x,t.y)&&(N=Math.abs(y-t.y)/(p-t.x),J_(t,u)&&(N<U||N===U&&(t.x>c.x||t.x===c.x&&GN(c,t)))&&(c=t,U=N)),t=t.next;while(t!==i);return c}function GN(u,e){return co(u.prev,u,e.prev)<0&&co(e.next,u,u.next)<0}function WN(u,e,t,r){let c=u;do c.z===0&&(c.z=h2(c.x,c.y,e,t,r)),c.prevZ=c.prev,c.nextZ=c.next,c=c.next;while(c!==u);c.prevZ.nextZ=null,c.prevZ=null,jN(c)}function jN(u){let e,t,r,c,p,y,i,C,D=1;do{for(t=u,u=null,p=null,y=0;t;){for(y++,r=t,i=0,e=0;e<D&&(i++,r=r.nextZ,!!r);e++);for(C=D;i>0||C>0&&r;)i!==0&&(C===0||!r||t.z<=r.z)?(c=t,t=t.nextZ,i--):(c=r,r=r.nextZ,C--),p?p.nextZ=c:u=c,c.prevZ=p,p=c;t=r}p.nextZ=null,D*=2}while(y>1);return u}function h2(u,e,t,r,c){return u=(u-t)*c|0,e=(e-r)*c|0,u=(u|u<<8)&16711935,u=(u|u<<4)&252645135,u=(u|u<<2)&858993459,u=(u|u<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,u|e<<1}function KN(u){let e=u,t=u;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==u);return t}function Rm(u,e,t,r,c,p,y,i){return(c-y)*(e-i)>=(u-y)*(p-i)&&(u-y)*(r-i)>=(t-y)*(e-i)&&(t-y)*(p-i)>=(c-y)*(r-i)}function $N(u,e){return u.next.i!==e.i&&u.prev.i!==e.i&&!ZN(u,e)&&(J_(u,e)&&J_(e,u)&&XN(u,e)&&(co(u.prev,u,e.prev)||co(u,e.prev,e))||Yv(u,e)&&co(u.prev,u,u.next)>0&&co(e.prev,e,e.next)>0)}function co(u,e,t){return(e.y-u.y)*(t.x-e.x)-(e.x-u.x)*(t.y-e.y)}function Yv(u,e){return u.x===e.x&&u.y===e.y}function rF(u,e,t,r){const c=Mx(co(u,e,t)),p=Mx(co(u,e,r)),y=Mx(co(t,r,u)),i=Mx(co(t,r,e));return!!(c!==p&&y!==i||c===0&&Sx(u,t,e)||p===0&&Sx(u,r,e)||y===0&&Sx(t,u,r)||i===0&&Sx(t,e,r))}function Sx(u,e,t){return e.x<=Math.max(u.x,t.x)&&e.x>=Math.min(u.x,t.x)&&e.y<=Math.max(u.y,t.y)&&e.y>=Math.min(u.y,t.y)}function Mx(u){return u>0?1:u<0?-1:0}function ZN(u,e){let t=u;do{if(t.i!==u.i&&t.next.i!==u.i&&t.i!==e.i&&t.next.i!==e.i&&rF(t,t.next,u,e))return!0;t=t.next}while(t!==u);return!1}function J_(u,e){return co(u.prev,u,u.next)<0?co(u,e,u.next)>=0&&co(u,u.prev,e)>=0:co(u,e,u.prev)<0||co(u,u.next,e)<0}function XN(u,e){let t=u,r=!1;const c=(u.x+e.x)/2,p=(u.y+e.y)/2;do t.y>p!=t.next.y>p&&t.next.y!==t.y&&c<(t.next.x-t.x)*(p-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==u);return r}function sF(u,e){const t=new u2(u.i,u.x,u.y),r=new u2(e.i,e.x,e.y),c=u.next,p=e.prev;return u.next=e,e.prev=u,t.next=c,c.prev=t,r.next=t,t.prev=r,p.next=r,r.prev=p,r}function FT(u,e,t,r){const c=new u2(u,e,t);return r?(c.next=r.next,c.prev=r,r.next.prev=c,r.next=c):(c.prev=c,c.next=c),c}function ey(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function u2(u,e,t){this.i=u,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qN(u,e,t,r){let c=0;for(let p=e,y=t-r;p<t;p+=r)c+=(u[y]-u[p])*(u[p+1]+u[y+1]),y=p;return c}class Hu{static area(e){const t=e.length;let r=0;for(let c=t-1,p=0;p<t;c=p++)r+=e[c].x*e[p].y-e[p].x*e[c].y;return r*.5}static isClockWise(e){return Hu.area(e)<0}static triangulateShape(e,t){const r=[],c=[],p=[];LT(e),DT(r,e);let y=e.length;t.forEach(LT);for(let C=0;C<t.length;C++)c.push(y),y+=t[C].length,DT(r,t[C]);const i=UN.triangulate(r,c);for(let C=0;C<i.length;C+=3)p.push(i.slice(C,C+3));return p}}function LT(u){const e=u.length;e>2&&u[e-1].equals(u[0])&&u.pop()}function DT(u,e){for(let t=0;t<e.length;t++)u.push(e[t].x),u.push(e[t].y)}class xy extends br{constructor(e=new np([new Di(.5,.5),new Di(-.5,.5),new Di(-.5,-.5),new Di(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const r=this,c=[],p=[];for(let i=0,C=e.length;i<C;i++){const D=e[i];y(D)}this.setAttribute("position",new jn(c,3)),this.setAttribute("uv",new jn(p,2)),this.computeVertexNormals();function y(i){const C=[],D=t.curveSegments!==void 0?t.curveSegments:12,U=t.steps!==void 0?t.steps:1,N=t.depth!==void 0?t.depth:1;let R=t.bevelEnabled!==void 0?t.bevelEnabled:!0,G=t.bevelThickness!==void 0?t.bevelThickness:.2,J=t.bevelSize!==void 0?t.bevelSize:G-.1,Y=t.bevelOffset!==void 0?t.bevelOffset:0,B=t.bevelSegments!==void 0?t.bevelSegments:3;const ae=t.extrudePath,le=t.UVGenerator!==void 0?t.UVGenerator:YN;let Ae,we=!1,me,Pe,it,Me;ae&&(Ae=ae.getSpacedPoints(U),we=!0,R=!1,me=ae.computeFrenetFrames(U,!1),Pe=new ft,it=new ft,Me=new ft),R||(B=0,G=0,J=0,Y=0);const Ke=i.extractPoints(D);let Et=Ke.shape;const oi=Ke.holes;if(!Hu.isClockWise(Et)){Et=Et.reverse();for(let Ct=0,Ft=oi.length;Ct<Ft;Ct++){const Xt=oi[Ct];Hu.isClockWise(Xt)&&(oi[Ct]=Xt.reverse())}}const te=Hu.triangulateShape(Et,oi),ce=Et;for(let Ct=0,Ft=oi.length;Ct<Ft;Ct++){const Xt=oi[Ct];Et=Et.concat(Xt)}function ye(Ct,Ft,Xt){return Ft||console.error("THREE.ExtrudeGeometry: vec does not exist"),Ft.clone().multiplyScalar(Xt).add(Ct)}const xe=Et.length,ze=te.length;function Ne(Ct,Ft,Xt){let mi,fi,Gi;const wn=Ct.x-Ft.x,Qi=Ct.y-Ft.y,Gn=Xt.x-Ct.x,kn=Xt.y-Ct.y,yt=wn*wn+Qi*Qi,st=wn*kn-Qi*Gn;if(Math.abs(st)>Number.EPSILON){const ti=Math.sqrt(yt),Ni=Math.sqrt(Gn*Gn+kn*kn),qi=Ft.x-Qi/ti,en=Ft.y+wn/ti,$t=Xt.x-kn/Ni,at=Xt.y+Gn/Ni,ii=(($t-qi)*kn-(at-en)*Gn)/(wn*kn-Qi*Gn);mi=qi+wn*ii-Ct.x,fi=en+Qi*ii-Ct.y;const hn=mi*mi+fi*fi;if(hn<=2)return new Di(mi,fi);Gi=Math.sqrt(hn/2)}else{let ti=!1;wn>Number.EPSILON?Gn>Number.EPSILON&&(ti=!0):wn<-Number.EPSILON?Gn<-Number.EPSILON&&(ti=!0):Math.sign(Qi)===Math.sign(kn)&&(ti=!0),ti?(mi=-Qi,fi=wn,Gi=Math.sqrt(yt)):(mi=wn,fi=Qi,Gi=Math.sqrt(yt/2))}return new Di(mi/Gi,fi/Gi)}const Ge=[];for(let Ct=0,Ft=ce.length,Xt=Ft-1,mi=Ct+1;Ct<Ft;Ct++,Xt++,mi++)Xt===Ft&&(Xt=0),mi===Ft&&(mi=0),Ge[Ct]=Ne(ce[Ct],ce[Xt],ce[mi]);const Ve=[];let Le,Ie=Ge.concat();for(let Ct=0,Ft=oi.length;Ct<Ft;Ct++){const Xt=oi[Ct];Le=[];for(let mi=0,fi=Xt.length,Gi=fi-1,wn=mi+1;mi<fi;mi++,Gi++,wn++)Gi===fi&&(Gi=0),wn===fi&&(wn=0),Le[mi]=Ne(Xt[mi],Xt[Gi],Xt[wn]);Ve.push(Le),Ie=Ie.concat(Le)}for(let Ct=0;Ct<B;Ct++){const Ft=Ct/B,Xt=G*Math.cos(Ft*Math.PI/2),mi=J*Math.sin(Ft*Math.PI/2)+Y;for(let fi=0,Gi=ce.length;fi<Gi;fi++){const wn=ye(ce[fi],Ge[fi],mi);dt(wn.x,wn.y,-Xt)}for(let fi=0,Gi=oi.length;fi<Gi;fi++){const wn=oi[fi];Le=Ve[fi];for(let Qi=0,Gn=wn.length;Qi<Gn;Qi++){const kn=ye(wn[Qi],Le[Qi],mi);dt(kn.x,kn.y,-Xt)}}}const qe=J+Y;for(let Ct=0;Ct<xe;Ct++){const Ft=R?ye(Et[Ct],Ie[Ct],qe):Et[Ct];we?(it.copy(me.normals[0]).multiplyScalar(Ft.x),Pe.copy(me.binormals[0]).multiplyScalar(Ft.y),Me.copy(Ae[0]).add(it).add(Pe),dt(Me.x,Me.y,Me.z)):dt(Ft.x,Ft.y,0)}for(let Ct=1;Ct<=U;Ct++)for(let Ft=0;Ft<xe;Ft++){const Xt=R?ye(Et[Ft],Ie[Ft],qe):Et[Ft];we?(it.copy(me.normals[Ct]).multiplyScalar(Xt.x),Pe.copy(me.binormals[Ct]).multiplyScalar(Xt.y),Me.copy(Ae[Ct]).add(it).add(Pe),dt(Me.x,Me.y,Me.z)):dt(Xt.x,Xt.y,N/U*Ct)}for(let Ct=B-1;Ct>=0;Ct--){const Ft=Ct/B,Xt=G*Math.cos(Ft*Math.PI/2),mi=J*Math.sin(Ft*Math.PI/2)+Y;for(let fi=0,Gi=ce.length;fi<Gi;fi++){const wn=ye(ce[fi],Ge[fi],mi);dt(wn.x,wn.y,N+Xt)}for(let fi=0,Gi=oi.length;fi<Gi;fi++){const wn=oi[fi];Le=Ve[fi];for(let Qi=0,Gn=wn.length;Qi<Gn;Qi++){const kn=ye(wn[Qi],Le[Qi],mi);we?dt(kn.x,kn.y+Ae[U-1].y,Ae[U-1].x+Xt):dt(kn.x,kn.y,N+Xt)}}}et(),vt();function et(){const Ct=c.length/3;if(R){let Ft=0,Xt=xe*Ft;for(let mi=0;mi<ze;mi++){const fi=te[mi];ut(fi[2]+Xt,fi[1]+Xt,fi[0]+Xt)}Ft=U+B*2,Xt=xe*Ft;for(let mi=0;mi<ze;mi++){const fi=te[mi];ut(fi[0]+Xt,fi[1]+Xt,fi[2]+Xt)}}else{for(let Ft=0;Ft<ze;Ft++){const Xt=te[Ft];ut(Xt[2],Xt[1],Xt[0])}for(let Ft=0;Ft<ze;Ft++){const Xt=te[Ft];ut(Xt[0]+xe*U,Xt[1]+xe*U,Xt[2]+xe*U)}}r.addGroup(Ct,c.length/3-Ct,0)}function vt(){const Ct=c.length/3;let Ft=0;Be(ce,Ft),Ft+=ce.length;for(let Xt=0,mi=oi.length;Xt<mi;Xt++){const fi=oi[Xt];Be(fi,Ft),Ft+=fi.length}r.addGroup(Ct,c.length/3-Ct,1)}function Be(Ct,Ft){let Xt=Ct.length;for(;--Xt>=0;){const mi=Xt;let fi=Xt-1;fi<0&&(fi=Ct.length-1);for(let Gi=0,wn=U+B*2;Gi<wn;Gi++){const Qi=xe*Gi,Gn=xe*(Gi+1),kn=Ft+mi+Qi,yt=Ft+fi+Qi,st=Ft+fi+Gn,ti=Ft+mi+Gn;Qt(kn,yt,st,ti)}}}function dt(Ct,Ft,Xt){C.push(Ct),C.push(Ft),C.push(Xt)}function ut(Ct,Ft,Xt){Wt(Ct),Wt(Ft),Wt(Xt);const mi=c.length/3,fi=le.generateTopUV(r,c,mi-3,mi-2,mi-1);Nt(fi[0]),Nt(fi[1]),Nt(fi[2])}function Qt(Ct,Ft,Xt,mi){Wt(Ct),Wt(Ft),Wt(mi),Wt(Ft),Wt(Xt),Wt(mi);const fi=c.length/3,Gi=le.generateSideWallUV(r,c,fi-6,fi-3,fi-2,fi-1);Nt(Gi[0]),Nt(Gi[1]),Nt(Gi[3]),Nt(Gi[1]),Nt(Gi[2]),Nt(Gi[3])}function Wt(Ct){c.push(C[Ct*3+0]),c.push(C[Ct*3+1]),c.push(C[Ct*3+2])}function Nt(Ct){p.push(Ct.x),p.push(Ct.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return JN(t,r,e)}static fromJSON(e,t){const r=[];for(let p=0,y=e.shapes.length;p<y;p++){const i=t[e.shapes[p]];r.push(i)}const c=e.options.extrudePath;return c!==void 0&&(e.options.extrudePath=new iB[c.type]().fromJSON(c)),new xy(r,e.options)}}const YN={generateTopUV:function(u,e,t,r,c){const p=e[t*3],y=e[t*3+1],i=e[r*3],C=e[r*3+1],D=e[c*3],U=e[c*3+1];return[new Di(p,y),new Di(i,C),new Di(D,U)]},generateSideWallUV:function(u,e,t,r,c,p){const y=e[t*3],i=e[t*3+1],C=e[t*3+2],D=e[r*3],U=e[r*3+1],N=e[r*3+2],R=e[c*3],G=e[c*3+1],J=e[c*3+2],Y=e[p*3],B=e[p*3+1],ae=e[p*3+2];return Math.abs(i-U)<Math.abs(y-D)?[new Di(y,1-C),new Di(D,1-N),new Di(R,1-J),new Di(Y,1-ae)]:[new Di(i,1-C),new Di(U,1-N),new Di(G,1-J),new Di(B,1-ae)]}};function JN(u,e,t){if(t.shapes=[],Array.isArray(u))for(let r=0,c=u.length;r<c;r++){const p=u[r];t.shapes.push(p.uuid)}else t.shapes.push(u.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class vy extends JA{constructor(e=1,t=0){const r=(1+Math.sqrt(5))/2,c=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],p=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(c,p,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new vy(e.radius,e.detail)}}class tg extends JA{constructor(e=1,t=0){const r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],c=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,c,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new tg(e.radius,e.detail)}}class wy extends br{constructor(e=.5,t=1,r=32,c=1,p=0,y=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:c,thetaStart:p,thetaLength:y},r=Math.max(3,r),c=Math.max(1,c);const i=[],C=[],D=[],U=[];let N=e;const R=(t-e)/c,G=new ft,J=new Di;for(let Y=0;Y<=c;Y++){for(let B=0;B<=r;B++){const ae=p+B/r*y;G.x=N*Math.cos(ae),G.y=N*Math.sin(ae),C.push(G.x,G.y,G.z),D.push(0,0,1),J.x=(G.x/t+1)/2,J.y=(G.y/t+1)/2,U.push(J.x,J.y)}N+=R}for(let Y=0;Y<c;Y++){const B=Y*(r+1);for(let ae=0;ae<r;ae++){const le=ae+B,Ae=le,we=le+r+1,me=le+r+2,Pe=le+1;i.push(Ae,we,Pe),i.push(we,me,Pe)}}this.setIndex(i),this.setAttribute("position",new jn(C,3)),this.setAttribute("normal",new jn(D,3)),this.setAttribute("uv",new jn(U,2))}static fromJSON(e){return new wy(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ig extends br{constructor(e=new np([new Di(0,.5),new Di(-.5,-.5),new Di(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const r=[],c=[],p=[],y=[];let i=0,C=0;if(Array.isArray(e)===!1)D(e);else for(let U=0;U<e.length;U++)D(e[U]),this.addGroup(i,C,U),i+=C,C=0;this.setIndex(r),this.setAttribute("position",new jn(c,3)),this.setAttribute("normal",new jn(p,3)),this.setAttribute("uv",new jn(y,2));function D(U){const N=c.length/3,R=U.extractPoints(t);let G=R.shape;const J=R.holes;Hu.isClockWise(G)===!1&&(G=G.reverse());for(let B=0,ae=J.length;B<ae;B++){const le=J[B];Hu.isClockWise(le)===!0&&(J[B]=le.reverse())}const Y=Hu.triangulateShape(G,J);for(let B=0,ae=J.length;B<ae;B++){const le=J[B];G=G.concat(le)}for(let B=0,ae=G.length;B<ae;B++){const le=G[B];c.push(le.x,le.y,0),p.push(0,0,1),y.push(le.x,le.y)}for(let B=0,ae=Y.length;B<ae;B++){const le=Y[B],Ae=le[0]+N,we=le[1]+N,me=le[2]+N;r.push(Ae,we,me),C+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return eQ(t,e)}static fromJSON(e,t){const r=[];for(let c=0,p=e.shapes.length;c<p;c++){const y=t[e.shapes[c]];r.push(y)}return new ig(r,e.curveSegments)}}function eQ(u,e){if(e.shapes=[],Array.isArray(u))for(let t=0,r=u.length;t<r;t++){const c=u[t];e.shapes.push(c.uuid)}else e.shapes.push(u.uuid);return e}class Qu extends br{constructor(e=1,t=32,r=16,c=0,p=Math.PI*2,y=0,i=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:c,phiLength:p,thetaStart:y,thetaLength:i},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));const C=Math.min(y+i,Math.PI);let D=0;const U=[],N=new ft,R=new ft,G=[],J=[],Y=[],B=[];for(let ae=0;ae<=r;ae++){const le=[],Ae=ae/r;let we=0;ae==0&&y==0?we=.5/t:ae==r&&C==Math.PI&&(we=-.5/t);for(let me=0;me<=t;me++){const Pe=me/t;N.x=-e*Math.cos(c+Pe*p)*Math.sin(y+Ae*i),N.y=e*Math.cos(y+Ae*i),N.z=e*Math.sin(c+Pe*p)*Math.sin(y+Ae*i),J.push(N.x,N.y,N.z),R.copy(N).normalize(),Y.push(R.x,R.y,R.z),B.push(Pe+we,1-Ae),le.push(D++)}U.push(le)}for(let ae=0;ae<r;ae++)for(let le=0;le<t;le++){const Ae=U[ae][le+1],we=U[ae][le],me=U[ae+1][le],Pe=U[ae+1][le+1];(ae!==0||y>0)&&G.push(Ae,we,Pe),(ae!==r-1||C<Math.PI)&&G.push(we,me,Pe)}this.setIndex(G),this.setAttribute("position",new jn(J,3)),this.setAttribute("normal",new jn(Y,3)),this.setAttribute("uv",new jn(B,2))}static fromJSON(e){return new Qu(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class by extends JA{constructor(e=1,t=0){const r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],c=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,c,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new by(e.radius,e.detail)}}class By extends br{constructor(e=1,t=.4,r=12,c=48,p=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:c,arc:p},r=Math.floor(r),c=Math.floor(c);const y=[],i=[],C=[],D=[],U=new ft,N=new ft,R=new ft;for(let G=0;G<=r;G++)for(let J=0;J<=c;J++){const Y=J/c*p,B=G/r*Math.PI*2;N.x=(e+t*Math.cos(B))*Math.cos(Y),N.y=(e+t*Math.cos(B))*Math.sin(Y),N.z=t*Math.sin(B),i.push(N.x,N.y,N.z),U.x=e*Math.cos(Y),U.y=e*Math.sin(Y),R.subVectors(N,U).normalize(),C.push(R.x,R.y,R.z),D.push(J/c),D.push(G/r)}for(let G=1;G<=r;G++)for(let J=1;J<=c;J++){const Y=(c+1)*G+J-1,B=(c+1)*(G-1)+J-1,ae=(c+1)*(G-1)+J,le=(c+1)*G+J;y.push(Y,B,le),y.push(B,ae,le)}this.setIndex(y),this.setAttribute("position",new jn(i,3)),this.setAttribute("normal",new jn(C,3)),this.setAttribute("uv",new jn(D,2))}static fromJSON(e){return new By(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Cy extends br{constructor(e=1,t=.4,r=64,c=8,p=2,y=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:c,p,q:y},r=Math.floor(r),c=Math.floor(c);const i=[],C=[],D=[],U=[],N=new ft,R=new ft,G=new ft,J=new ft,Y=new ft,B=new ft,ae=new ft;for(let Ae=0;Ae<=r;++Ae){const we=Ae/r*p*Math.PI*2;le(we,p,y,e,G),le(we+.01,p,y,e,J),B.subVectors(J,G),ae.addVectors(J,G),Y.crossVectors(B,ae),ae.crossVectors(Y,B),Y.normalize(),ae.normalize();for(let me=0;me<=c;++me){const Pe=me/c*Math.PI*2,it=-t*Math.cos(Pe),Me=t*Math.sin(Pe);N.x=G.x+(it*ae.x+Me*Y.x),N.y=G.y+(it*ae.y+Me*Y.y),N.z=G.z+(it*ae.z+Me*Y.z),C.push(N.x,N.y,N.z),R.subVectors(N,G).normalize(),D.push(R.x,R.y,R.z),U.push(Ae/r),U.push(me/c)}}for(let Ae=1;Ae<=r;Ae++)for(let we=1;we<=c;we++){const me=(c+1)*(Ae-1)+(we-1),Pe=(c+1)*Ae+(we-1),it=(c+1)*Ae+we,Me=(c+1)*(Ae-1)+we;i.push(me,Pe,Me),i.push(Pe,it,Me)}this.setIndex(i),this.setAttribute("position",new jn(C,3)),this.setAttribute("normal",new jn(D,3)),this.setAttribute("uv",new jn(U,2));function le(Ae,we,me,Pe,it){const Me=Math.cos(Ae),Ke=Math.sin(Ae),Et=me/we*Ae,oi=Math.cos(Et);it.x=Pe*(2+oi)*.5*Me,it.y=Pe*(2+oi)*Ke*.5,it.z=Pe*Math.sin(Et)*.5}}static fromJSON(e){return new Cy(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ng extends br{constructor(e=new eB(new ft(-1,-1,0),new ft(-1,1,0),new ft(1,1,0)),t=64,r=1,c=8,p=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:c,closed:p};const y=e.computeFrenetFrames(t,p);this.tangents=y.tangents,this.normals=y.normals,this.binormals=y.binormals;const i=new ft,C=new ft,D=new Di;let U=new ft;const N=[],R=[],G=[],J=[];Y(),this.setIndex(J),this.setAttribute("position",new jn(N,3)),this.setAttribute("normal",new jn(R,3)),this.setAttribute("uv",new jn(G,2));function Y(){for(let Ae=0;Ae<t;Ae++)B(Ae);B(p===!1?t:0),le(),ae()}function B(Ae){U=e.getPointAt(Ae/t,U);const we=y.normals[Ae],me=y.binormals[Ae];for(let Pe=0;Pe<=c;Pe++){const it=Pe/c*Math.PI*2,Me=Math.sin(it),Ke=-Math.cos(it);C.x=Ke*we.x+Me*me.x,C.y=Ke*we.y+Me*me.y,C.z=Ke*we.z+Me*me.z,C.normalize(),R.push(C.x,C.y,C.z),i.x=U.x+r*C.x,i.y=U.y+r*C.y,i.z=U.z+r*C.z,N.push(i.x,i.y,i.z)}}function ae(){for(let Ae=1;Ae<=t;Ae++)for(let we=1;we<=c;we++){const me=(c+1)*(Ae-1)+(we-1),Pe=(c+1)*Ae+(we-1),it=(c+1)*Ae+we,Me=(c+1)*(Ae-1)+we;J.push(me,Pe,Me),J.push(Pe,it,Me)}}function le(){for(let Ae=0;Ae<=t;Ae++)for(let we=0;we<=c;we++)D.x=Ae/t,D.y=we/c,G.push(D.x,D.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new ng(new iB[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class nB extends br{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],r=new Set,c=new ft,p=new ft;if(e.index!==null){const y=e.attributes.position,i=e.index;let C=e.groups;C.length===0&&(C=[{start:0,count:i.count,materialIndex:0}]);for(let D=0,U=C.length;D<U;++D){const N=C[D],R=N.start,G=N.count;for(let J=R,Y=R+G;J<Y;J+=3)for(let B=0;B<3;B++){const ae=i.getX(J+B),le=i.getX(J+(B+1)%3);c.fromBufferAttribute(y,ae),p.fromBufferAttribute(y,le),PT(c,p,r)===!0&&(t.push(c.x,c.y,c.z),t.push(p.x,p.y,p.z))}}}else{const y=e.attributes.position;for(let i=0,C=y.count/3;i<C;i++)for(let D=0;D<3;D++){const U=3*i+D,N=3*i+(D+1)%3;c.fromBufferAttribute(y,U),p.fromBufferAttribute(y,N),PT(c,p,r)===!0&&(t.push(c.x,c.y,c.z),t.push(p.x,p.y,p.z))}}this.setAttribute("position",new jn(t,3))}}}function PT(u,e,t){const r=`${u.x},${u.y},${u.z}-${e.x},${e.y},${e.z}`,c=`${e.x},${e.y},${e.z}-${u.x},${u.y},${u.z}`;return t.has(r)===!0||t.has(c)===!0?!1:(t.add(r),t.add(c),!0)}var UT=Object.freeze({__proto__:null,BoxGeometry:YA,CapsuleGeometry:gy,CircleGeometry:_y,ConeGeometry:yf,CylinderGeometry:wf,DodecahedronGeometry:yy,EdgesGeometry:iF,ExtrudeGeometry:xy,IcosahedronGeometry:vy,LatheGeometry:eg,OctahedronGeometry:tg,PlaneGeometry:$A,PolyhedronGeometry:JA,RingGeometry:wy,ShapeGeometry:ig,SphereGeometry:Qu,TetrahedronGeometry:by,TorusGeometry:By,TorusKnotGeometry:Cy,TubeGeometry:ng,WireframeGeometry:nB});class oF extends ol{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Dn(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class aF extends ko{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ty extends ol{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Dn(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=up,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class rB extends ty{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Di(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Eo(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Dn(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Dn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Dn(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class sB extends ol{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Dn(16777215),this.specular=new Dn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=up,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=hy,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class lF extends ol{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Dn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=up,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class cF extends ol{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=up,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class yv extends ol{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Dn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=up,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=hy,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hF extends ol{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Dn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=up,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class uF extends sa{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function xh(u,e,t){return oB(u)?new u.constructor(u.subarray(e,t!==void 0?t:u.length)):u.slice(e,t)}function cf(u,e,t){return!u||!t&&u.constructor===e?u:typeof e.BYTES_PER_ELEMENT=="number"?new e(u):Array.prototype.slice.call(u)}function oB(u){return ArrayBuffer.isView(u)&&!(u instanceof DataView)}function AF(u){function e(c,p){return u[c]-u[p]}const t=u.length,r=new Array(t);for(let c=0;c!==t;++c)r[c]=c;return r.sort(e),r}function A2(u,e,t){const r=u.length,c=new u.constructor(r);for(let p=0,y=0;y!==r;++p){const i=t[p]*e;for(let C=0;C!==e;++C)c[y++]=u[i+C]}return c}function aB(u,e,t,r){let c=1,p=u[0];for(;p!==void 0&&p[r]===void 0;)p=u[c++];if(p===void 0)return;let y=p[r];if(y!==void 0)if(Array.isArray(y))do y=p[r],y!==void 0&&(e.push(p.time),t.push.apply(t,y)),p=u[c++];while(p!==void 0);else if(y.toArray!==void 0)do y=p[r],y!==void 0&&(e.push(p.time),y.toArray(t,t.length)),p=u[c++];while(p!==void 0);else do y=p[r],y!==void 0&&(e.push(p.time),t.push(y)),p=u[c++];while(p!==void 0)}function tQ(u,e,t,r,c=30){const p=u.clone();p.name=e;const y=[];for(let C=0;C<p.tracks.length;++C){const D=p.tracks[C],U=D.getValueSize(),N=[],R=[];for(let G=0;G<D.times.length;++G){const J=D.times[G]*c;if(!(J<t||J>=r)){N.push(D.times[G]);for(let Y=0;Y<U;++Y)R.push(D.values[G*U+Y])}}N.length!==0&&(D.times=cf(N,D.times.constructor),D.values=cf(R,D.values.constructor),y.push(D))}p.tracks=y;let i=1/0;for(let C=0;C<p.tracks.length;++C)i>p.tracks[C].times[0]&&(i=p.tracks[C].times[0]);for(let C=0;C<p.tracks.length;++C)p.tracks[C].shift(-1*i);return p.resetDuration(),p}function iQ(u,e=0,t=u,r=30){r<=0&&(r=30);const c=t.tracks.length,p=e/r;for(let y=0;y<c;++y){const i=t.tracks[y],C=i.ValueTypeName;if(C==="bool"||C==="string")continue;const D=u.tracks.find(function(ae){return ae.name===i.name&&ae.ValueTypeName===C});if(D===void 0)continue;let U=0;const N=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(U=N/3);let R=0;const G=D.getValueSize();D.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(R=G/3);const J=i.times.length-1;let Y;if(p<=i.times[0]){const ae=U,le=N-U;Y=xh(i.values,ae,le)}else if(p>=i.times[J]){const ae=J*N+U,le=ae+N-U;Y=xh(i.values,ae,le)}else{const ae=i.createInterpolant(),le=U,Ae=N-U;ae.evaluate(p),Y=xh(ae.resultBuffer,le,Ae)}C==="quaternion"&&new sl().fromArray(Y).normalize().conjugate().toArray(Y);const B=D.times.length;for(let ae=0;ae<B;++ae){const le=ae*G+R;if(C==="quaternion")sl.multiplyQuaternionsFlat(D.values,le,Y,0,D.values,le);else{const Ae=G-R*2;for(let we=0;we<Ae;++we)D.values[le+we]-=Y[we]}}}return u.blendMode=k2,u}var nQ=Object.freeze({__proto__:null,arraySlice:xh,convertArray:cf,isTypedArray:oB,getKeyframeOrder:AF,sortedArray:A2,flattenJSON:aB,subclip:tQ,makeClipAdditive:iQ});class Ey{constructor(e,t,r,c){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=c!==void 0?c:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,c=t[r],p=t[r-1];e:{t:{let y;i:{n:if(!(e<c)){for(let i=r+2;;){if(c===void 0){if(e<p)break n;return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===i)break;if(p=c,c=t[++r],e<c)break t}y=t.length;break i}if(!(e>=p)){const i=t[1];e<i&&(r=2,p=i);for(let C=r-2;;){if(p===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===C)break;if(c=p,p=t[--r-1],e>=p)break t}y=r,r=0;break i}break e}for(;r<y;){const i=r+y>>>1;e<t[i]?y=i:r=i+1}if(c=t[r],p=t[r-1],p===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(c===void 0)return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,p,c)}return this.interpolate_(r,p,e,c)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,c=this.valueSize,p=e*c;for(let y=0;y!==c;++y)t[y]=r[p+y];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class dF extends Ey{constructor(e,t,r,c){super(e,t,r,c),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:of,endingEnd:of}}intervalChanged_(e,t,r){const c=this.parameterPositions;let p=e-2,y=e+1,i=c[p],C=c[y];if(i===void 0)switch(this.getSettings_().endingStart){case af:p=e,i=2*t-r;break;case j_:p=c.length-2,i=t+c[p]-c[p+1];break;default:p=e,i=r}if(C===void 0)switch(this.getSettings_().endingEnd){case af:y=e,C=2*r-t;break;case j_:y=1,C=r+c[1]-c[0];break;default:y=e-1,C=t}const D=(r-t)*.5,U=this.valueSize;this._weightPrev=D/(t-i),this._weightNext=D/(C-r),this._offsetPrev=p*U,this._offsetNext=y*U}interpolate_(e,t,r,c){const p=this.resultBuffer,y=this.sampleValues,i=this.valueSize,C=e*i,D=C-i,U=this._offsetPrev,N=this._offsetNext,R=this._weightPrev,G=this._weightNext,J=(r-t)/(c-t),Y=J*J,B=Y*J,ae=-R*B+2*R*Y-R*J,le=(1+R)*B+(-1.5-2*R)*Y+(-.5+R)*J+1,Ae=(-1-G)*B+(1.5+G)*Y+.5*J,we=G*B-G*Y;for(let me=0;me!==i;++me)p[me]=ae*y[U+me]+le*y[D+me]+Ae*y[C+me]+we*y[N+me];return p}}class lB extends Ey{constructor(e,t,r,c){super(e,t,r,c)}interpolate_(e,t,r,c){const p=this.resultBuffer,y=this.sampleValues,i=this.valueSize,C=e*i,D=C-i,U=(r-t)/(c-t),N=1-U;for(let R=0;R!==i;++R)p[R]=y[D+R]*N+y[C+R]*U;return p}}class pF extends Ey{constructor(e,t,r,c){super(e,t,r,c)}interpolate_(e){return this.copySampleValue_(e-1)}}class du{constructor(e,t,r,c){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=cf(t,this.TimeBufferType),this.values=cf(r,this.ValueBufferType),this.setInterpolation(c||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:cf(e.times,Array),values:cf(e.values,Array)};const c=e.getInterpolation();c!==e.DefaultInterpolation&&(r.interpolation=c)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new pF(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new lB(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new dF(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case G_:t=this.InterpolantFactoryMethodDiscrete;break;case W_:t=this.InterpolantFactoryMethodLinear;break;case Xx:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return G_;case this.InterpolantFactoryMethodLinear:return W_;case this.InterpolantFactoryMethodSmooth:return Xx}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let r=0,c=t.length;r!==c;++r)t[r]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let r=0,c=t.length;r!==c;++r)t[r]*=e}return this}trim(e,t){const r=this.times,c=r.length;let p=0,y=c-1;for(;p!==c&&r[p]<e;)++p;for(;y!==-1&&r[y]>t;)--y;if(++y,p!==0||y!==c){p>=y&&(y=Math.max(y,1),p=y-1);const i=this.getValueSize();this.times=xh(r,p,y),this.values=xh(this.values,p*i,y*i)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,c=this.values,p=r.length;p===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let y=null;for(let i=0;i!==p;i++){const C=r[i];if(typeof C=="number"&&isNaN(C)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,i,C),e=!1;break}if(y!==null&&y>C){console.error("THREE.KeyframeTrack: Out of order keys.",this,i,C,y),e=!1;break}y=C}if(c!==void 0&&oB(c))for(let i=0,C=c.length;i!==C;++i){const D=c[i];if(isNaN(D)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,i,D),e=!1;break}}return e}optimize(){const e=xh(this.times),t=xh(this.values),r=this.getValueSize(),c=this.getInterpolation()===Xx,p=e.length-1;let y=1;for(let i=1;i<p;++i){let C=!1;const D=e[i],U=e[i+1];if(D!==U&&(i!==1||D!==e[0]))if(c)C=!0;else{const N=i*r,R=N-r,G=N+r;for(let J=0;J!==r;++J){const Y=t[N+J];if(Y!==t[R+J]||Y!==t[G+J]){C=!0;break}}}if(C){if(i!==y){e[y]=e[i];const N=i*r,R=y*r;for(let G=0;G!==r;++G)t[R+G]=t[N+G]}++y}}if(p>0){e[y]=e[p];for(let i=p*r,C=y*r,D=0;D!==r;++D)t[C+D]=t[i+D];++y}return y!==e.length?(this.times=xh(e,0,y),this.values=xh(t,0,y*r)):(this.times=e,this.values=t),this}clone(){const e=xh(this.times,0),t=xh(this.values,0),r=this.constructor,c=new r(this.name,e,t);return c.createInterpolant=this.createInterpolant,c}}du.prototype.TimeBufferType=Float32Array;du.prototype.ValueBufferType=Float32Array;du.prototype.DefaultInterpolation=W_;class bf extends du{}bf.prototype.ValueTypeName="bool";bf.prototype.ValueBufferType=Array;bf.prototype.DefaultInterpolation=G_;bf.prototype.InterpolantFactoryMethodLinear=void 0;bf.prototype.InterpolantFactoryMethodSmooth=void 0;class cB extends du{}cB.prototype.ValueTypeName="color";class iy extends du{}iy.prototype.ValueTypeName="number";class fF extends Ey{constructor(e,t,r,c){super(e,t,r,c)}interpolate_(e,t,r,c){const p=this.resultBuffer,y=this.sampleValues,i=this.valueSize,C=(r-t)/(c-t);let D=e*i;for(let U=D+i;D!==U;D+=4)sl.slerpFlat(p,0,y,D-i,y,D,C);return p}}class rg extends du{InterpolantFactoryMethodLinear(e){return new fF(this.times,this.values,this.getValueSize(),e)}}rg.prototype.ValueTypeName="quaternion";rg.prototype.DefaultInterpolation=W_;rg.prototype.InterpolantFactoryMethodSmooth=void 0;class Bf extends du{}Bf.prototype.ValueTypeName="string";Bf.prototype.ValueBufferType=Array;Bf.prototype.DefaultInterpolation=G_;Bf.prototype.InterpolantFactoryMethodLinear=void 0;Bf.prototype.InterpolantFactoryMethodSmooth=void 0;class ny extends du{}ny.prototype.ValueTypeName="vector";class ry{constructor(e,t=-1,r,c=Qv){this.name=e,this.tracks=r,this.duration=t,this.blendMode=c,this.uuid=Pc(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,c=1/(e.fps||1);for(let y=0,i=r.length;y!==i;++y)t.push(sQ(r[y]).scale(c));const p=new this(e.name,e.duration,t,e.blendMode);return p.uuid=e.uuid,p}static toJSON(e){const t=[],r=e.tracks,c={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let p=0,y=r.length;p!==y;++p)t.push(du.toJSON(r[p]));return c}static CreateFromMorphTargetSequence(e,t,r,c){const p=t.length,y=[];for(let i=0;i<p;i++){let C=[],D=[];C.push((i+p-1)%p,i,(i+1)%p),D.push(0,1,0);const U=AF(C);C=A2(C,1,U),D=A2(D,1,U),!c&&C[0]===0&&(C.push(p),D.push(D[0])),y.push(new iy(".morphTargetInfluences["+t[i].name+"]",C,D).scale(1/r))}return new this(e,-1,y)}static findByName(e,t){let r=e;if(!Array.isArray(e)){const c=e;r=c.geometry&&c.geometry.animations||c.animations}for(let c=0;c<r.length;c++)if(r[c].name===t)return r[c];return null}static CreateClipsFromMorphTargetSequences(e,t,r){const c={},p=/^([\w-]*?)([\d]+)$/;for(let i=0,C=e.length;i<C;i++){const D=e[i],U=D.name.match(p);if(U&&U.length>1){const N=U[1];let R=c[N];R||(c[N]=R=[]),R.push(D)}}const y=[];for(const i in c)y.push(this.CreateFromMorphTargetSequence(i,c[i],t,r));return y}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(N,R,G,J,Y){if(G.length!==0){const B=[],ae=[];aB(G,B,ae,J),B.length!==0&&Y.push(new N(R,B,ae))}},c=[],p=e.name||"default",y=e.fps||30,i=e.blendMode;let C=e.length||-1;const D=e.hierarchy||[];for(let N=0;N<D.length;N++){const R=D[N].keys;if(!(!R||R.length===0))if(R[0].morphTargets){const G={};let J;for(J=0;J<R.length;J++)if(R[J].morphTargets)for(let Y=0;Y<R[J].morphTargets.length;Y++)G[R[J].morphTargets[Y]]=-1;for(const Y in G){const B=[],ae=[];for(let le=0;le!==R[J].morphTargets.length;++le){const Ae=R[J];B.push(Ae.time),ae.push(Ae.morphTarget===Y?1:0)}c.push(new iy(".morphTargetInfluence["+Y+"]",B,ae))}C=G.length*y}else{const G=".bones["+t[N].name+"]";r(ny,G+".position",R,"pos",c),r(rg,G+".quaternion",R,"rot",c),r(ny,G+".scale",R,"scl",c)}}return c.length===0?null:new this(p,C,c,i)}resetDuration(){const e=this.tracks;let t=0;for(let r=0,c=e.length;r!==c;++r){const p=this.tracks[r];t=Math.max(t,p.times[p.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function rQ(u){switch(u.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return iy;case"vector":case"vector2":case"vector3":case"vector4":return ny;case"color":return cB;case"quaternion":return rg;case"bool":case"boolean":return bf;case"string":return Bf}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+u)}function sQ(u){if(u.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=rQ(u.type);if(u.times===void 0){const t=[],r=[];aB(u.keys,t,r,"value"),u.times=t,u.values=r}return e.parse!==void 0?e.parse(u):new e(u.name,u.times,u.values,u.interpolation)}const vf={enabled:!1,files:{},add:function(u,e){this.enabled!==!1&&(this.files[u]=e)},get:function(u){if(this.enabled!==!1)return this.files[u]},remove:function(u){delete this.files[u]},clear:function(){this.files={}}};class hB{constructor(e,t,r){const c=this;let p=!1,y=0,i=0,C;const D=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(U){i++,p===!1&&c.onStart!==void 0&&c.onStart(U,y,i),p=!0},this.itemEnd=function(U){y++,c.onProgress!==void 0&&c.onProgress(U,y,i),y===i&&(p=!1,c.onLoad!==void 0&&c.onLoad())},this.itemError=function(U){c.onError!==void 0&&c.onError(U)},this.resolveURL=function(U){return C?C(U):U},this.setURLModifier=function(U){return C=U,this},this.addHandler=function(U,N){return D.push(U,N),this},this.removeHandler=function(U){const N=D.indexOf(U);return N!==-1&&D.splice(N,2),this},this.getHandler=function(U){for(let N=0,R=D.length;N<R;N+=2){const G=D[N],J=D[N+1];if(G.global&&(G.lastIndex=0),G.test(U))return J}return null}}}const mF=new hB;class Uc{constructor(e){this.manager=e!==void 0?e:mF,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const r=this;return new Promise(function(c,p){r.load(e,c,t,p)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const QA={};class oQ extends Error{constructor(e,t){super(e),this.response=t}}class XA extends Uc{constructor(e){super(e)}load(e,t,r,c){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const p=vf.get(e);if(p!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(p),this.manager.itemEnd(e)},0),p;if(QA[e]!==void 0){QA[e].push({onLoad:t,onProgress:r,onError:c});return}QA[e]=[],QA[e].push({onLoad:t,onProgress:r,onError:c});const y=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),i=this.mimeType,C=this.responseType;fetch(y).then(D=>{if(D.status===200||D.status===0){if(D.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||D.body===void 0||D.body.getReader===void 0)return D;const U=QA[e],N=D.body.getReader(),R=D.headers.get("Content-Length")||D.headers.get("X-File-Size"),G=R?parseInt(R):0,J=G!==0;let Y=0;const B=new ReadableStream({start(ae){le();function le(){N.read().then(({done:Ae,value:we})=>{if(Ae)ae.close();else{Y+=we.byteLength;const me=new ProgressEvent("progress",{lengthComputable:J,loaded:Y,total:G});for(let Pe=0,it=U.length;Pe<it;Pe++){const Me=U[Pe];Me.onProgress&&Me.onProgress(me)}ae.enqueue(we),le()}})}}});return new Response(B)}else throw new oQ(`fetch for "${D.url}" responded with ${D.status}: ${D.statusText}`,D)}).then(D=>{switch(C){case"arraybuffer":return D.arrayBuffer();case"blob":return D.blob();case"document":return D.text().then(U=>new DOMParser().parseFromString(U,i));case"json":return D.json();default:if(i===void 0)return D.text();{const N=/charset="?([^;"\s]*)"?/i.exec(i),R=N&&N[1]?N[1].toLowerCase():void 0,G=new TextDecoder(R);return D.arrayBuffer().then(J=>G.decode(J))}}}).then(D=>{vf.add(e,D);const U=QA[e];delete QA[e];for(let N=0,R=U.length;N<R;N++){const G=U[N];G.onLoad&&G.onLoad(D)}}).catch(D=>{const U=QA[e];if(U===void 0)throw this.manager.itemError(e),D;delete QA[e];for(let N=0,R=U.length;N<R;N++){const G=U[N];G.onError&&G.onError(D)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class aQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=new XA(this.manager);y.setPath(this.path),y.setRequestHeader(this.requestHeader),y.setWithCredentials(this.withCredentials),y.load(e,function(i){try{t(p.parse(JSON.parse(i)))}catch(C){c?c(C):console.error(C),p.manager.itemError(e)}},r,c)}parse(e){const t=[];for(let r=0;r<e.length;r++){const c=ry.parse(e[r]);t.push(c)}return t}}class lQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=[],i=new X2,C=new XA(this.manager);C.setPath(this.path),C.setResponseType("arraybuffer"),C.setRequestHeader(this.requestHeader),C.setWithCredentials(p.withCredentials);let D=0;function U(N){C.load(e[N],function(R){const G=p.parse(R,!0);y[N]={width:G.width,height:G.height,format:G.format,mipmaps:G.mipmaps},D+=1,D===6&&(G.mipmapCount===1&&(i.minFilter=Xs),i.image=y,i.format=G.format,i.needsUpdate=!0,t&&t(i))},r,c)}if(Array.isArray(e))for(let N=0,R=e.length;N<R;++N)U(N);else C.load(e,function(N){const R=p.parse(N,!0);if(R.isCubemap){const G=R.mipmaps.length/R.mipmapCount;for(let J=0;J<G;J++){y[J]={mipmaps:[]};for(let Y=0;Y<R.mipmapCount;Y++)y[J].mipmaps.push(R.mipmaps[J*R.mipmapCount+Y]),y[J].format=R.format,y[J].width=R.width,y[J].height=R.height}i.image=y}else i.image.width=R.width,i.image.height=R.height,i.mipmaps=R.mipmaps;R.mipmapCount===1&&(i.minFilter=Xs),i.format=R.format,i.needsUpdate=!0,t&&t(i)},r,c);return i}}class sy extends Uc{constructor(e){super(e)}load(e,t,r,c){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const p=this,y=vf.get(e);if(y!==void 0)return p.manager.itemStart(e),setTimeout(function(){t&&t(y),p.manager.itemEnd(e)},0),y;const i=Z_("img");function C(){U(),vf.add(e,this),t&&t(this),p.manager.itemEnd(e)}function D(N){U(),c&&c(N),p.manager.itemError(e),p.manager.itemEnd(e)}function U(){i.removeEventListener("load",C,!1),i.removeEventListener("error",D,!1)}return i.addEventListener("load",C,!1),i.addEventListener("error",D,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(i.crossOrigin=this.crossOrigin),p.manager.itemStart(e),i.src=e,i}}class cQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=new py,y=new sy(this.manager);y.setCrossOrigin(this.crossOrigin),y.setPath(this.path);let i=0;function C(D){y.load(e[D],function(U){p.images[D]=U,i++,i===6&&(p.needsUpdate=!0,t&&t(p))},void 0,c)}for(let D=0;D<e.length;++D)C(D);return p}}class hQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=new Qm,i=new XA(this.manager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(p.withCredentials),i.load(e,function(C){const D=p.parse(C);!D||(D.image!==void 0?y.image=D.image:D.data!==void 0&&(y.image.width=D.width,y.image.height=D.height,y.image.data=D.data),y.wrapS=D.wrapS!==void 0?D.wrapS:rl,y.wrapT=D.wrapT!==void 0?D.wrapT:rl,y.magFilter=D.magFilter!==void 0?D.magFilter:Xs,y.minFilter=D.minFilter!==void 0?D.minFilter:Xs,y.anisotropy=D.anisotropy!==void 0?D.anisotropy:1,D.encoding!==void 0&&(y.encoding=D.encoding),D.flipY!==void 0&&(y.flipY=D.flipY),D.format!==void 0&&(y.format=D.format),D.type!==void 0&&(y.type=D.type),D.mipmaps!==void 0&&(y.mipmaps=D.mipmaps,y.minFilter=lp),D.mipmapCount===1&&(y.minFilter=Xs),D.generateMipmaps!==void 0&&(y.generateMipmaps=D.generateMipmaps),y.needsUpdate=!0,t&&t(y,D))},r,c),y}}class jd extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=new To,y=new sy(this.manager);return y.setCrossOrigin(this.crossOrigin),y.setPath(this.path),y.load(e,function(i){p.image=i,p.needsUpdate=!0,t!==void 0&&t(p)},r,c),p}}class Ap extends cs{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Dn(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class uB extends Ap{constructor(e,t,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(cs.DefaultUp),this.updateMatrix(),this.groundColor=new Dn(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const qw=new lr,RT=new ft,zT=new ft;class AB{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Di(512,512),this.map=null,this.mapPass=null,this.matrix=new lr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Gv,this._frameExtents=new Di(1,1),this._viewportCount=1,this._viewports=[new ls(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;RT.setFromMatrixPosition(e.matrixWorld),t.position.copy(RT),zT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(zT),t.updateMatrixWorld(),qw.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(qw),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(qw)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class uQ extends AB{constructor(){super(new _a(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=$_*2*e.angle*this.focus,c=this.mapSize.width/this.mapSize.height,p=e.distance||t.far;(r!==t.fov||c!==t.aspect||p!==t.far)&&(t.fov=r,t.aspect=c,t.far=p,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class gF extends Ap{constructor(e,t,r=0,c=Math.PI/3,p=0,y=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(cs.DefaultUp),this.updateMatrix(),this.target=new cs,this.distance=r,this.angle=c,this.penumbra=p,this.decay=y,this.map=null,this.shadow=new uQ}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const kT=new lr,d_=new ft,Yw=new ft;class AQ extends AB{constructor(){super(new _a(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Di(4,2),this._viewportCount=6,this._viewports=[new ls(2,1,1,1),new ls(0,1,1,1),new ls(3,1,1,1),new ls(1,1,1,1),new ls(3,0,1,1),new ls(1,0,1,1)],this._cubeDirections=[new ft(1,0,0),new ft(-1,0,0),new ft(0,0,1),new ft(0,0,-1),new ft(0,1,0),new ft(0,-1,0)],this._cubeUps=[new ft(0,1,0),new ft(0,1,0),new ft(0,1,0),new ft(0,1,0),new ft(0,0,1),new ft(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,c=this.matrix,p=e.distance||r.far;p!==r.far&&(r.far=p,r.updateProjectionMatrix()),d_.setFromMatrixPosition(e.matrixWorld),r.position.copy(d_),Yw.copy(r.position),Yw.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Yw),r.updateMatrixWorld(),c.makeTranslation(-d_.x,-d_.y,-d_.z),kT.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kT)}}class dB extends Ap{constructor(e,t,r=0,c=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=c,this.shadow=new AQ}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class dQ extends AB{constructor(){super(new fy(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class pB extends Ap{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(cs.DefaultUp),this.updateMatrix(),this.target=new cs,this.shadow=new dQ}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class fB extends Ap{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class _F extends Ap{constructor(e,t,r=10,c=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=c}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class yF{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ft)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const r=e.x,c=e.y,p=e.z,y=this.coefficients;return t.copy(y[0]).multiplyScalar(.282095),t.addScaledVector(y[1],.488603*c),t.addScaledVector(y[2],.488603*p),t.addScaledVector(y[3],.488603*r),t.addScaledVector(y[4],1.092548*(r*c)),t.addScaledVector(y[5],1.092548*(c*p)),t.addScaledVector(y[6],.315392*(3*p*p-1)),t.addScaledVector(y[7],1.092548*(r*p)),t.addScaledVector(y[8],.546274*(r*r-c*c)),t}getIrradianceAt(e,t){const r=e.x,c=e.y,p=e.z,y=this.coefficients;return t.copy(y[0]).multiplyScalar(.886227),t.addScaledVector(y[1],2*.511664*c),t.addScaledVector(y[2],2*.511664*p),t.addScaledVector(y[3],2*.511664*r),t.addScaledVector(y[4],2*.429043*r*c),t.addScaledVector(y[5],2*.429043*c*p),t.addScaledVector(y[6],.743125*p*p-.247708),t.addScaledVector(y[7],2*.429043*r*p),t.addScaledVector(y[8],.429043*(r*r-c*c)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const r=this.coefficients;for(let c=0;c<9;c++)r[c].fromArray(e,t+c*3);return this}toArray(e=[],t=0){const r=this.coefficients;for(let c=0;c<9;c++)r[c].toArray(e,t+c*3);return e}static getBasisAt(e,t){const r=e.x,c=e.y,p=e.z;t[0]=.282095,t[1]=.488603*c,t[2]=.488603*p,t[3]=.488603*r,t[4]=1.092548*r*c,t[5]=1.092548*c*p,t[6]=.315392*(3*p*p-1),t[7]=1.092548*r*p,t[8]=.546274*(r*r-c*c)}}class Jv extends Ap{constructor(e=new yF,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class e1 extends Uc{constructor(e){super(e),this.textures={}}load(e,t,r,c){const p=this,y=new XA(p.manager);y.setPath(p.path),y.setRequestHeader(p.requestHeader),y.setWithCredentials(p.withCredentials),y.load(e,function(i){try{t(p.parse(JSON.parse(i)))}catch(C){c?c(C):console.error(C),p.manager.itemError(e)}},r,c)}parse(e){const t=this.textures;function r(p){return t[p]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",p),t[p]}const c=e1.createMaterialFromType(e.type);if(e.uuid!==void 0&&(c.uuid=e.uuid),e.name!==void 0&&(c.name=e.name),e.color!==void 0&&c.color!==void 0&&c.color.setHex(e.color),e.roughness!==void 0&&(c.roughness=e.roughness),e.metalness!==void 0&&(c.metalness=e.metalness),e.sheen!==void 0&&(c.sheen=e.sheen),e.sheenColor!==void 0&&(c.sheenColor=new Dn().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(c.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&c.emissive!==void 0&&c.emissive.setHex(e.emissive),e.specular!==void 0&&c.specular!==void 0&&c.specular.setHex(e.specular),e.specularIntensity!==void 0&&(c.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&c.specularColor!==void 0&&c.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(c.shininess=e.shininess),e.clearcoat!==void 0&&(c.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(c.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(c.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(c.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(c.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(c.transmission=e.transmission),e.thickness!==void 0&&(c.thickness=e.thickness),e.attenuationDistance!==void 0&&(c.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&c.attenuationColor!==void 0&&c.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(c.fog=e.fog),e.flatShading!==void 0&&(c.flatShading=e.flatShading),e.blending!==void 0&&(c.blending=e.blending),e.combine!==void 0&&(c.combine=e.combine),e.side!==void 0&&(c.side=e.side),e.shadowSide!==void 0&&(c.shadowSide=e.shadowSide),e.opacity!==void 0&&(c.opacity=e.opacity),e.transparent!==void 0&&(c.transparent=e.transparent),e.alphaTest!==void 0&&(c.alphaTest=e.alphaTest),e.depthTest!==void 0&&(c.depthTest=e.depthTest),e.depthWrite!==void 0&&(c.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(c.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(c.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(c.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(c.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(c.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(c.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(c.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(c.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(c.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(c.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(c.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(c.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(c.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(c.rotation=e.rotation),e.linewidth!==1&&(c.linewidth=e.linewidth),e.dashSize!==void 0&&(c.dashSize=e.dashSize),e.gapSize!==void 0&&(c.gapSize=e.gapSize),e.scale!==void 0&&(c.scale=e.scale),e.polygonOffset!==void 0&&(c.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(c.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(c.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(c.dithering=e.dithering),e.alphaToCoverage!==void 0&&(c.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(c.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(c.visible=e.visible),e.toneMapped!==void 0&&(c.toneMapped=e.toneMapped),e.userData!==void 0&&(c.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?c.vertexColors=e.vertexColors>0:c.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const p in e.uniforms){const y=e.uniforms[p];switch(c.uniforms[p]={},y.type){case"t":c.uniforms[p].value=r(y.value);break;case"c":c.uniforms[p].value=new Dn().setHex(y.value);break;case"v2":c.uniforms[p].value=new Di().fromArray(y.value);break;case"v3":c.uniforms[p].value=new ft().fromArray(y.value);break;case"v4":c.uniforms[p].value=new ls().fromArray(y.value);break;case"m3":c.uniforms[p].value=new Pl().fromArray(y.value);break;case"m4":c.uniforms[p].value=new lr().fromArray(y.value);break;default:c.uniforms[p].value=y.value}}if(e.defines!==void 0&&(c.defines=e.defines),e.vertexShader!==void 0&&(c.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(c.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(c.glslVersion=e.glslVersion),e.extensions!==void 0)for(const p in e.extensions)c.extensions[p]=e.extensions[p];if(e.size!==void 0&&(c.size=e.size),e.sizeAttenuation!==void 0&&(c.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(c.map=r(e.map)),e.matcap!==void 0&&(c.matcap=r(e.matcap)),e.alphaMap!==void 0&&(c.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(c.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(c.bumpScale=e.bumpScale),e.normalMap!==void 0&&(c.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(c.normalMapType=e.normalMapType),e.normalScale!==void 0){let p=e.normalScale;Array.isArray(p)===!1&&(p=[p,p]),c.normalScale=new Di().fromArray(p)}return e.displacementMap!==void 0&&(c.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(c.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(c.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(c.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(c.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(c.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(c.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(c.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(c.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(c.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(c.envMap=r(e.envMap)),e.envMapIntensity!==void 0&&(c.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(c.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(c.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(c.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(c.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(c.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(c.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(c.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(c.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(c.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(c.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(c.clearcoatNormalScale=new Di().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(c.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(c.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(c.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(c.thicknessMap=r(e.thicknessMap)),e.sheenColorMap!==void 0&&(c.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(c.sheenRoughnessMap=r(e.sheenRoughnessMap)),c}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:oF,SpriteMaterial:my,RawShaderMaterial:aF,ShaderMaterial:ko,PointsMaterial:$2,MeshPhysicalMaterial:rB,MeshStandardMaterial:ty,MeshPhongMaterial:sB,MeshToonMaterial:lF,MeshNormalMaterial:cF,MeshLambertMaterial:yv,MeshDepthMaterial:G2,MeshDistanceMaterial:W2,MeshBasicMaterial:na,MeshMatcapMaterial:hF,LineDashedMaterial:uF,LineBasicMaterial:sa,Material:ol};return new t[e]}}class d2{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,c=e.length;r<c;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class mB extends br{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class xF extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=new XA(p.manager);y.setPath(p.path),y.setRequestHeader(p.requestHeader),y.setWithCredentials(p.withCredentials),y.load(e,function(i){try{t(p.parse(JSON.parse(i)))}catch(C){c?c(C):console.error(C),p.manager.itemError(e)}},r,c)}parse(e){const t={},r={};function c(G,J){if(t[J]!==void 0)return t[J];const B=G.interleavedBuffers[J],ae=p(G,B.buffer),le=Pm(B.type,ae),Ae=new $v(le,B.stride);return Ae.uuid=B.uuid,t[J]=Ae,Ae}function p(G,J){if(r[J]!==void 0)return r[J];const B=G.arrayBuffers[J],ae=new Uint32Array(B).buffer;return r[J]=ae,ae}const y=e.isInstancedBufferGeometry?new mB:new br,i=e.data.index;if(i!==void 0){const G=Pm(i.type,i.array);y.setIndex(new ds(G,1))}const C=e.data.attributes;for(const G in C){const J=C[G];let Y;if(J.isInterleavedBufferAttribute){const B=c(e.data,J.data);Y=new Lc(B,J.itemSize,J.offset,J.normalized)}else{const B=Pm(J.type,J.array),ae=J.isInstancedBufferAttribute?Km:ds;Y=new ae(B,J.itemSize,J.normalized)}J.name!==void 0&&(Y.name=J.name),J.usage!==void 0&&Y.setUsage(J.usage),J.updateRange!==void 0&&(Y.updateRange.offset=J.updateRange.offset,Y.updateRange.count=J.updateRange.count),y.setAttribute(G,Y)}const D=e.data.morphAttributes;if(D)for(const G in D){const J=D[G],Y=[];for(let B=0,ae=J.length;B<ae;B++){const le=J[B];let Ae;if(le.isInterleavedBufferAttribute){const we=c(e.data,le.data);Ae=new Lc(we,le.itemSize,le.offset,le.normalized)}else{const we=Pm(le.type,le.array);Ae=new ds(we,le.itemSize,le.normalized)}le.name!==void 0&&(Ae.name=le.name),Y.push(Ae)}y.morphAttributes[G]=Y}e.data.morphTargetsRelative&&(y.morphTargetsRelative=!0);const N=e.data.groups||e.data.drawcalls||e.data.offsets;if(N!==void 0)for(let G=0,J=N.length;G!==J;++G){const Y=N[G];y.addGroup(Y.start,Y.count,Y.materialIndex)}const R=e.data.boundingSphere;if(R!==void 0){const G=new ft;R.center!==void 0&&G.fromArray(R.center),y.boundingSphere=new qA(G,R.radius)}return e.name&&(y.name=e.name),e.userData&&(y.userData=e.userData),y}}class pQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=this.path===""?d2.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||y;const i=new XA(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,function(C){let D=null;try{D=JSON.parse(C)}catch(N){c!==void 0&&c(N),console.error("THREE:ObjectLoader: Can't parse "+e+".",N.message);return}const U=D.metadata;if(U===void 0||U.type===void 0||U.type.toLowerCase()==="geometry"){c!==void 0&&c(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}p.parse(D,t)},r,c)}async loadAsync(e,t){const r=this,c=this.path===""?d2.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||c;const p=new XA(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials);const y=await p.loadAsync(e,t),i=JSON.parse(y),C=i.metadata;if(C===void 0||C.type===void 0||C.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await r.parseAsync(i)}parse(e,t){const r=this.parseAnimations(e.animations),c=this.parseShapes(e.shapes),p=this.parseGeometries(e.geometries,c),y=this.parseImages(e.images,function(){t!==void 0&&t(D)}),i=this.parseTextures(e.textures,y),C=this.parseMaterials(e.materials,i),D=this.parseObject(e.object,p,C,i,r),U=this.parseSkeletons(e.skeletons,D);if(this.bindSkeletons(D,U),t!==void 0){let N=!1;for(const R in y)if(y[R].data instanceof HTMLImageElement){N=!0;break}N===!1&&t(D)}return D}async parseAsync(e){const t=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),c=this.parseGeometries(e.geometries,r),p=await this.parseImagesAsync(e.images),y=this.parseTextures(e.textures,p),i=this.parseMaterials(e.materials,y),C=this.parseObject(e.object,c,i,y,t),D=this.parseSkeletons(e.skeletons,C);return this.bindSkeletons(C,D),C}parseShapes(e){const t={};if(e!==void 0)for(let r=0,c=e.length;r<c;r++){const p=new np().fromJSON(e[r]);t[p.uuid]=p}return t}parseSkeletons(e,t){const r={},c={};if(t.traverse(function(p){p.isBone&&(c[p.uuid]=p)}),e!==void 0)for(let p=0,y=e.length;p<y;p++){const i=new Zv().fromJSON(e[p],c);r[i.uuid]=i}return r}parseGeometries(e,t){const r={};if(e!==void 0){const c=new xF;for(let p=0,y=e.length;p<y;p++){let i;const C=e[p];switch(C.type){case"BufferGeometry":case"InstancedBufferGeometry":i=c.parse(C);break;default:C.type in UT?i=UT[C.type].fromJSON(C,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${C.type}"`)}i.uuid=C.uuid,C.name!==void 0&&(i.name=C.name),i.isBufferGeometry===!0&&C.userData!==void 0&&(i.userData=C.userData),r[C.uuid]=i}}return r}parseMaterials(e,t){const r={},c={};if(e!==void 0){const p=new e1;p.setTextures(t);for(let y=0,i=e.length;y<i;y++){const C=e[y];r[C.uuid]===void 0&&(r[C.uuid]=p.parse(C)),c[C.uuid]=r[C.uuid]}}return c}parseAnimations(e){const t={};if(e!==void 0)for(let r=0;r<e.length;r++){const c=e[r],p=ry.parse(c);t[p.uuid]=p}return t}parseImages(e,t){const r=this,c={};let p;function y(C){return r.manager.itemStart(C),p.load(C,function(){r.manager.itemEnd(C)},void 0,function(){r.manager.itemError(C),r.manager.itemEnd(C)})}function i(C){if(typeof C=="string"){const D=C,U=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(D)?D:r.resourcePath+D;return y(U)}else return C.data?{data:Pm(C.type,C.data),width:C.width,height:C.height}:null}if(e!==void 0&&e.length>0){const C=new hB(t);p=new sy(C),p.setCrossOrigin(this.crossOrigin);for(let D=0,U=e.length;D<U;D++){const N=e[D],R=N.url;if(Array.isArray(R)){const G=[];for(let J=0,Y=R.length;J<Y;J++){const B=R[J],ae=i(B);ae!==null&&(ae instanceof HTMLImageElement?G.push(ae):G.push(new Qm(ae.data,ae.width,ae.height)))}c[N.uuid]=new lf(G)}else{const G=i(N.url);c[N.uuid]=new lf(G)}}}return c}async parseImagesAsync(e){const t=this,r={};let c;async function p(y){if(typeof y=="string"){const i=y,C=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(i)?i:t.resourcePath+i;return await c.loadAsync(C)}else return y.data?{data:Pm(y.type,y.data),width:y.width,height:y.height}:null}if(e!==void 0&&e.length>0){c=new sy(this.manager),c.setCrossOrigin(this.crossOrigin);for(let y=0,i=e.length;y<i;y++){const C=e[y],D=C.url;if(Array.isArray(D)){const U=[];for(let N=0,R=D.length;N<R;N++){const G=D[N],J=await p(G);J!==null&&(J instanceof HTMLImageElement?U.push(J):U.push(new Qm(J.data,J.width,J.height)))}r[C.uuid]=new lf(U)}else{const U=await p(C.url);r[C.uuid]=new lf(U)}}}return r}parseTextures(e,t){function r(p,y){return typeof p=="number"?p:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",p),y[p])}const c={};if(e!==void 0)for(let p=0,y=e.length;p<y;p++){const i=e[p];i.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',i.uuid),t[i.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",i.image);const C=t[i.image],D=C.data;let U;Array.isArray(D)?(U=new py,D.length===6&&(U.needsUpdate=!0)):(D&&D.data?U=new Qm:U=new To,D&&(U.needsUpdate=!0)),U.source=C,U.uuid=i.uuid,i.name!==void 0&&(U.name=i.name),i.mapping!==void 0&&(U.mapping=r(i.mapping,fQ)),i.offset!==void 0&&U.offset.fromArray(i.offset),i.repeat!==void 0&&U.repeat.fromArray(i.repeat),i.center!==void 0&&U.center.fromArray(i.center),i.rotation!==void 0&&(U.rotation=i.rotation),i.wrap!==void 0&&(U.wrapS=r(i.wrap[0],OT),U.wrapT=r(i.wrap[1],OT)),i.format!==void 0&&(U.format=i.format),i.type!==void 0&&(U.type=i.type),i.encoding!==void 0&&(U.encoding=i.encoding),i.minFilter!==void 0&&(U.minFilter=r(i.minFilter,NT)),i.magFilter!==void 0&&(U.magFilter=r(i.magFilter,NT)),i.anisotropy!==void 0&&(U.anisotropy=i.anisotropy),i.flipY!==void 0&&(U.flipY=i.flipY),i.generateMipmaps!==void 0&&(U.generateMipmaps=i.generateMipmaps),i.premultiplyAlpha!==void 0&&(U.premultiplyAlpha=i.premultiplyAlpha),i.unpackAlignment!==void 0&&(U.unpackAlignment=i.unpackAlignment),i.userData!==void 0&&(U.userData=i.userData),c[i.uuid]=U}return c}parseObject(e,t,r,c,p){let y;function i(R){return t[R]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",R),t[R]}function C(R){if(R!==void 0){if(Array.isArray(R)){const G=[];for(let J=0,Y=R.length;J<Y;J++){const B=R[J];r[B]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",B),G.push(r[B])}return G}return r[R]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",R),r[R]}}function D(R){return c[R]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",R),c[R]}let U,N;switch(e.type){case"Scene":y=new j2,e.background!==void 0&&(Number.isInteger(e.background)?y.background=new Dn(e.background):y.background=D(e.background)),e.environment!==void 0&&(y.environment=D(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?y.fog=new Kv(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(y.fog=new jv(e.fog.color,e.fog.density))),e.backgroundBlurriness!==void 0&&(y.backgroundBlurriness=e.backgroundBlurriness);break;case"PerspectiveCamera":y=new _a(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(y.focus=e.focus),e.zoom!==void 0&&(y.zoom=e.zoom),e.filmGauge!==void 0&&(y.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(y.filmOffset=e.filmOffset),e.view!==void 0&&(y.view=Object.assign({},e.view));break;case"OrthographicCamera":y=new fy(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(y.zoom=e.zoom),e.view!==void 0&&(y.view=Object.assign({},e.view));break;case"AmbientLight":y=new fB(e.color,e.intensity);break;case"DirectionalLight":y=new pB(e.color,e.intensity);break;case"PointLight":y=new dB(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":y=new _F(e.color,e.intensity,e.width,e.height);break;case"SpotLight":y=new gF(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":y=new uB(e.color,e.groundColor,e.intensity);break;case"LightProbe":y=new Jv().fromJSON(e);break;case"SkinnedMesh":U=i(e.geometry),N=C(e.material),y=new ZI(U,N),e.bindMode!==void 0&&(y.bindMode=e.bindMode),e.bindMatrix!==void 0&&y.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(y.skeleton=e.skeleton);break;case"Mesh":U=i(e.geometry),N=C(e.material),y=new is(U,N);break;case"InstancedMesh":U=i(e.geometry),N=C(e.material);const R=e.count,G=e.instanceMatrix,J=e.instanceColor;y=new XI(U,N,R),y.instanceMatrix=new Km(new Float32Array(G.array),16),J!==void 0&&(y.instanceColor=new Km(new Float32Array(J.array),J.itemSize));break;case"LOD":y=new $I;break;case"Line":y=new Ku(i(e.geometry),C(e.material));break;case"LineLoop":y=new _v(i(e.geometry),C(e.material));break;case"LineSegments":y=new Yu(i(e.geometry),C(e.material));break;case"PointCloud":case"Points":y=new Z2(i(e.geometry),C(e.material));break;case"Sprite":y=new gv(C(e.material));break;case"Group":y=new As;break;case"Bone":y=new K2;break;default:y=new cs}if(y.uuid=e.uuid,e.name!==void 0&&(y.name=e.name),e.matrix!==void 0?(y.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(y.matrixAutoUpdate=e.matrixAutoUpdate),y.matrixAutoUpdate&&y.matrix.decompose(y.position,y.quaternion,y.scale)):(e.position!==void 0&&y.position.fromArray(e.position),e.rotation!==void 0&&y.rotation.fromArray(e.rotation),e.quaternion!==void 0&&y.quaternion.fromArray(e.quaternion),e.scale!==void 0&&y.scale.fromArray(e.scale)),e.castShadow!==void 0&&(y.castShadow=e.castShadow),e.receiveShadow!==void 0&&(y.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(y.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(y.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(y.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&y.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(y.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(y.visible=e.visible),e.frustumCulled!==void 0&&(y.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(y.renderOrder=e.renderOrder),e.userData!==void 0&&(y.userData=e.userData),e.layers!==void 0&&(y.layers.mask=e.layers),e.children!==void 0){const R=e.children;for(let G=0;G<R.length;G++)y.add(this.parseObject(R[G],t,r,c,p))}if(e.animations!==void 0){const R=e.animations;for(let G=0;G<R.length;G++){const J=R[G];y.animations.push(p[J])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(y.autoUpdate=e.autoUpdate);const R=e.levels;for(let G=0;G<R.length;G++){const J=R[G],Y=y.getObjectByProperty("uuid",J.object);Y!==void 0&&y.addLevel(Y,J.distance,J.hysteresis)}}return y}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(r){if(r.isSkinnedMesh===!0&&r.skeleton!==void 0){const c=t[r.skeleton];c===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",r.skeleton):r.bind(c,r.bindMatrix)}})}}const fQ={UVMapping:Nv,CubeReflectionMapping:op,CubeRefractionMapping:ap,EquirectangularReflectionMapping:Q_,EquirectangularRefractionMapping:V_,CubeUVReflectionMapping:qm},OT={RepeatWrapping:HA,ClampToEdgeWrapping:rl,MirroredRepeatWrapping:H_},NT={NearestFilter:Co,NearestMipmapNearestFilter:dv,NearestMipmapLinearFilter:F_,LinearFilter:Xs,LinearMipmapNearestFilter:R2,LinearMipmapLinearFilter:lp};class mQ extends Uc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,c){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const p=this,y=vf.get(e);if(y!==void 0)return p.manager.itemStart(e),setTimeout(function(){t&&t(y),p.manager.itemEnd(e)},0),y;const i={};i.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",i.headers=this.requestHeader,fetch(e,i).then(function(C){return C.blob()}).then(function(C){return createImageBitmap(C,Object.assign(p.options,{colorSpaceConversion:"none"}))}).then(function(C){vf.add(e,C),t&&t(C),p.manager.itemEnd(e)}).catch(function(C){c&&c(C),p.manager.itemError(e),p.manager.itemEnd(e)}),p.manager.itemStart(e)}}let Ix;class gB{static getContext(){return Ix===void 0&&(Ix=new(window.AudioContext||window.webkitAudioContext)),Ix}static setContext(e){Ix=e}}class gQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=new XA(this.manager);y.setResponseType("arraybuffer"),y.setPath(this.path),y.setRequestHeader(this.requestHeader),y.setWithCredentials(this.withCredentials),y.load(e,function(i){try{const C=i.slice(0);gB.getContext().decodeAudioData(C,function(U){t(U)})}catch(C){c?c(C):console.error(C),p.manager.itemError(e)}},r,c)}}class _Q extends Jv{constructor(e,t,r=1){super(void 0,r),this.isHemisphereLightProbe=!0;const c=new Dn().set(e),p=new Dn().set(t),y=new ft(c.r,c.g,c.b),i=new ft(p.r,p.g,p.b),C=Math.sqrt(Math.PI),D=C*Math.sqrt(.75);this.sh.coefficients[0].copy(y).add(i).multiplyScalar(C),this.sh.coefficients[1].copy(y).sub(i).multiplyScalar(D)}}class vF extends Jv{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const r=new Dn().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const QT=new lr,VT=new lr,Hp=new lr;class yQ{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new _a,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new _a,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Hp.copy(e.projectionMatrix);const c=t.eyeSep/2,p=c*t.near/t.focus,y=t.near*Math.tan(pf*t.fov*.5)/t.zoom;let i,C;VT.elements[12]=-c,QT.elements[12]=c,i=-y*t.aspect+p,C=y*t.aspect+p,Hp.elements[0]=2*t.near/(C-i),Hp.elements[8]=(C+i)/(C-i),this.cameraL.projectionMatrix.copy(Hp),i=-y*t.aspect-p,C=y*t.aspect-p,Hp.elements[0]=2*t.near/(C-i),Hp.elements[8]=(C+i)/(C-i),this.cameraR.projectionMatrix.copy(Hp)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(VT),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(QT)}}class t1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=HT(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=HT();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function HT(){return(typeof performance>"u"?Date:performance).now()}const Gp=new ft,GT=new sl,xQ=new ft,Wp=new ft;class vQ extends cs{constructor(){super(),this.type="AudioListener",this.context=gB.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new t1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Gp,GT,xQ),Wp.set(0,0,-1).applyQuaternion(GT),t.positionX){const c=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Gp.x,c),t.positionY.linearRampToValueAtTime(Gp.y,c),t.positionZ.linearRampToValueAtTime(Gp.z,c),t.forwardX.linearRampToValueAtTime(Wp.x,c),t.forwardY.linearRampToValueAtTime(Wp.y,c),t.forwardZ.linearRampToValueAtTime(Wp.z,c),t.upX.linearRampToValueAtTime(r.x,c),t.upY.linearRampToValueAtTime(r.y,c),t.upZ.linearRampToValueAtTime(r.z,c)}else t.setPosition(Gp.x,Gp.y,Gp.z),t.setOrientation(Wp.x,Wp.y,Wp.z,r.x,r.y,r.z)}}class wF extends cs{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const jp=new ft,WT=new sl,wQ=new ft,Kp=new ft;class bQ extends wF{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(jp,WT,wQ),Kp.set(0,0,1).applyQuaternion(WT);const t=this.panner;if(t.positionX){const r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(jp.x,r),t.positionY.linearRampToValueAtTime(jp.y,r),t.positionZ.linearRampToValueAtTime(jp.z,r),t.orientationX.linearRampToValueAtTime(Kp.x,r),t.orientationY.linearRampToValueAtTime(Kp.y,r),t.orientationZ.linearRampToValueAtTime(Kp.z,r)}else t.setPosition(jp.x,jp.y,jp.z),t.setOrientation(Kp.x,Kp.y,Kp.z)}}class BQ{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}}class bF{constructor(e,t,r){this.binding=e,this.valueSize=r;let c,p,y;switch(t){case"quaternion":c=this._slerp,p=this._slerpAdditive,y=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":c=this._select,p=this._select,y=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:c=this._lerp,p=this._lerpAdditive,y=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=c,this._mixBufferRegionAdditive=p,this._setIdentity=y,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,c=this.valueSize,p=e*c+c;let y=this.cumulativeWeight;if(y===0){for(let i=0;i!==c;++i)r[p+i]=r[i];y=t}else{y+=t;const i=t/y;this._mixBufferRegion(r,p,0,i,c)}this.cumulativeWeight=y}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,c=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,c,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,c=e*t+t,p=this.cumulativeWeight,y=this.cumulativeWeightAdditive,i=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,p<1){const C=t*this._origIndex;this._mixBufferRegion(r,c,C,1-p,t)}y>0&&this._mixBufferRegionAdditive(r,c,this._addIndex*t,1,t);for(let C=t,D=t+t;C!==D;++C)if(r[C]!==r[C+t]){i.setValue(r,c);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,c=r*this._origIndex;e.getValue(t,c);for(let p=r,y=c;p!==y;++p)t[p]=t[c+p%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,c,p){if(c>=.5)for(let y=0;y!==p;++y)e[t+y]=e[r+y]}_slerp(e,t,r,c){sl.slerpFlat(e,t,e,t,e,r,c)}_slerpAdditive(e,t,r,c,p){const y=this._workIndex*p;sl.multiplyQuaternionsFlat(e,y,e,t,e,r),sl.slerpFlat(e,t,e,t,e,y,c)}_lerp(e,t,r,c,p){const y=1-c;for(let i=0;i!==p;++i){const C=t+i;e[C]=e[C]*y+e[r+i]*c}}_lerpAdditive(e,t,r,c,p){for(let y=0;y!==p;++y){const i=t+y;e[i]=e[i]+e[r+y]*c}}}const _B="\\[\\]\\.:\\/",CQ=new RegExp("["+_B+"]","g"),yB="[^"+_B+"]",EQ="[^"+_B.replace("\\.","")+"]",TQ=/((?:WC+[\/:])*)/.source.replace("WC",yB),SQ=/(WCOD+)?/.source.replace("WCOD",EQ),MQ=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",yB),IQ=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",yB),FQ=new RegExp("^"+TQ+SQ+MQ+IQ+"$"),LQ=["material","materials","bones","map"];class DQ{constructor(e,t,r){const c=r||as.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,c)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,c=this._bindings[r];c!==void 0&&c.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let c=this._targetGroup.nCachedObjects_,p=r.length;c!==p;++c)r[c].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class as{constructor(e,t,r){this.path=t,this.parsedPath=r||as.parseTrackName(t),this.node=as.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new as.Composite(e,t,r):new as(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(CQ,"")}static parseTrackName(e){const t=FQ.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},c=r.nodeName&&r.nodeName.lastIndexOf(".");if(c!==void 0&&c!==-1){const p=r.nodeName.substring(c+1);LQ.indexOf(p)!==-1&&(r.nodeName=r.nodeName.substring(0,c),r.objectName=p)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(p){for(let y=0;y<p.length;y++){const i=p[y];if(i.name===t||i.uuid===t)return i;const C=r(i.children);if(C)return C}return null},c=r(e.children);if(c)return c}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const r=this.resolvedProperty;for(let c=0,p=r.length;c!==p;++c)e[t++]=r[c]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const r=this.resolvedProperty;for(let c=0,p=r.length;c!==p;++c)r[c]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const r=this.resolvedProperty;for(let c=0,p=r.length;c!==p;++c)r[c]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const r=this.resolvedProperty;for(let c=0,p=r.length;c!==p;++c)r[c]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,r=t.objectName,c=t.propertyName;let p=t.propertyIndex;if(e||(e=as.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(r){let D=t.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let U=0;U<e.length;U++)if(e[U].name===D){D=U;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(D!==void 0){if(e[D]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[D]}}const y=e[c];if(y===void 0){const D=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+D+"."+c+" but it wasn't found.",e);return}let i=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?i=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(i=this.Versioning.MatrixWorldNeedsUpdate);let C=this.BindingType.Direct;if(p!==void 0){if(c==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[p]!==void 0&&(p=e.morphTargetDictionary[p])}C=this.BindingType.ArrayElement,this.resolvedProperty=y,this.propertyIndex=p}else y.fromArray!==void 0&&y.toArray!==void 0?(C=this.BindingType.HasFromToArray,this.resolvedProperty=y):Array.isArray(y)?(C=this.BindingType.EntireArray,this.resolvedProperty=y):this.propertyName=c;this.getValue=this.GetterByBindingType[C],this.setValue=this.SetterByBindingTypeAndVersioning[C][i]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}as.Composite=DQ;as.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};as.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};as.prototype.GetterByBindingType=[as.prototype._getValue_direct,as.prototype._getValue_array,as.prototype._getValue_arrayElement,as.prototype._getValue_toArray];as.prototype.SetterByBindingTypeAndVersioning=[[as.prototype._setValue_direct,as.prototype._setValue_direct_setNeedsUpdate,as.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[as.prototype._setValue_array,as.prototype._setValue_array_setNeedsUpdate,as.prototype._setValue_array_setMatrixWorldNeedsUpdate],[as.prototype._setValue_arrayElement,as.prototype._setValue_arrayElement_setNeedsUpdate,as.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[as.prototype._setValue_fromArray,as.prototype._setValue_fromArray_setNeedsUpdate,as.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class PQ{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Pc(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let r=0,c=arguments.length;r!==c;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,r=this._paths,c=this._parsedPaths,p=this._bindings,y=p.length;let i,C=e.length,D=this.nCachedObjects_;for(let U=0,N=arguments.length;U!==N;++U){const R=arguments[U],G=R.uuid;let J=t[G];if(J===void 0){J=C++,t[G]=J,e.push(R);for(let Y=0,B=y;Y!==B;++Y)p[Y].push(new as(R,r[Y],c[Y]))}else if(J<D){i=e[J];const Y=--D,B=e[Y];t[B.uuid]=J,e[J]=B,t[G]=Y,e[Y]=R;for(let ae=0,le=y;ae!==le;++ae){const Ae=p[ae],we=Ae[Y];let me=Ae[J];Ae[J]=we,me===void 0&&(me=new as(R,r[ae],c[ae])),Ae[Y]=me}}else e[J]!==i&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=D}remove(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,c=r.length;let p=this.nCachedObjects_;for(let y=0,i=arguments.length;y!==i;++y){const C=arguments[y],D=C.uuid,U=t[D];if(U!==void 0&&U>=p){const N=p++,R=e[N];t[R.uuid]=U,e[U]=R,t[D]=N,e[N]=C;for(let G=0,J=c;G!==J;++G){const Y=r[G],B=Y[N],ae=Y[U];Y[U]=B,Y[N]=ae}}}this.nCachedObjects_=p}uncache(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,c=r.length;let p=this.nCachedObjects_,y=e.length;for(let i=0,C=arguments.length;i!==C;++i){const D=arguments[i],U=D.uuid,N=t[U];if(N!==void 0)if(delete t[U],N<p){const R=--p,G=e[R],J=--y,Y=e[J];t[G.uuid]=N,e[N]=G,t[Y.uuid]=R,e[R]=Y,e.pop();for(let B=0,ae=c;B!==ae;++B){const le=r[B],Ae=le[R],we=le[J];le[N]=Ae,le[R]=we,le.pop()}}else{const R=--y,G=e[R];R>0&&(t[G.uuid]=N),e[N]=G,e.pop();for(let J=0,Y=c;J!==Y;++J){const B=r[J];B[N]=B[R],B.pop()}}}this.nCachedObjects_=p}subscribe_(e,t){const r=this._bindingsIndicesByPath;let c=r[e];const p=this._bindings;if(c!==void 0)return p[c];const y=this._paths,i=this._parsedPaths,C=this._objects,D=C.length,U=this.nCachedObjects_,N=new Array(D);c=p.length,r[e]=c,y.push(e),i.push(t),p.push(N);for(let R=U,G=C.length;R!==G;++R){const J=C[R];N[R]=new as(J,e,t)}return N}unsubscribe_(e){const t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){const c=this._paths,p=this._parsedPaths,y=this._bindings,i=y.length-1,C=y[i],D=e[i];t[D]=r,y[r]=C,y.pop(),p[r]=p[i],p.pop(),c[r]=c[i],c.pop()}}}class UQ{constructor(e,t,r=null,c=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=c;const p=t.tracks,y=p.length,i=new Array(y),C={endingStart:of,endingEnd:of};for(let D=0;D!==y;++D){const U=p[D].createInterpolant(null);i[D]=U,U.settings=C}this._interpolantSettings=C,this._interpolants=i,this._propertyBindings=new Array(y),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=CI,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){const c=this._clip.duration,p=e._clip.duration,y=p/c,i=c/p;e.warp(1,y,t),this.warp(i,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){const c=this._mixer,p=c.time,y=this.timeScale;let i=this._timeScaleInterpolant;i===null&&(i=c._lendControlInterpolant(),this._timeScaleInterpolant=i);const C=i.parameterPositions,D=i.sampleValues;return C[0]=p,C[1]=p+r,D[0]=e/y,D[1]=t/y,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,c){if(!this.enabled){this._updateWeight(e);return}const p=this._startTime;if(p!==null){const C=(e-p)*r;C<0||r===0?t=0:(this._startTime=null,t=r*C)}t*=this._updateTimeScale(e);const y=this._updateTime(t),i=this._updateWeight(e);if(i>0){const C=this._interpolants,D=this._propertyBindings;switch(this.blendMode){case k2:for(let U=0,N=C.length;U!==N;++U)C[U].evaluate(y),D[U].accumulateAdditive(i);break;case Qv:default:for(let U=0,N=C.length;U!==N;++U)C[U].evaluate(y),D[U].accumulate(c,i)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const c=r.evaluate(e)[0];t*=c,e>r.parameterPositions[1]&&(this.stopFading(),c===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const c=r.evaluate(e)[0];t*=c,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let c=this.time+e,p=this._loopCount;const y=r===EI;if(e===0)return p===-1?c:y&&(p&1)===1?t-c:c;if(r===BI){p===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(c>=t)c=t;else if(c<0)c=0;else{this.time=c;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=c,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(p===-1&&(e>=0?(p=0,this._setEndings(!0,this.repetitions===0,y)):this._setEndings(this.repetitions===0,!0,y)),c>=t||c<0){const i=Math.floor(c/t);c-=t*i,p+=Math.abs(i);const C=this.repetitions-p;if(C<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,c=e>0?t:0,this.time=c,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(C===1){const D=e<0;this._setEndings(D,!D,y)}else this._setEndings(!1,!1,y);this._loopCount=p,this.time=c,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=c;if(y&&(p&1)===1)return t-c}return c}_setEndings(e,t,r){const c=this._interpolantSettings;r?(c.endingStart=af,c.endingEnd=af):(e?c.endingStart=this.zeroSlopeAtStart?af:of:c.endingStart=j_,t?c.endingEnd=this.zeroSlopeAtEnd?af:of:c.endingEnd=j_)}_scheduleFading(e,t,r){const c=this._mixer,p=c.time;let y=this._weightInterpolant;y===null&&(y=c._lendControlInterpolant(),this._weightInterpolant=y);const i=y.parameterPositions,C=y.sampleValues;return i[0]=p,C[0]=t,i[1]=p+e,C[1]=r,this}}const RQ=new Float32Array(1);class zQ extends Xu{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,c=e._clip.tracks,p=c.length,y=e._propertyBindings,i=e._interpolants,C=r.uuid,D=this._bindingsByRootAndName;let U=D[C];U===void 0&&(U={},D[C]=U);for(let N=0;N!==p;++N){const R=c[N],G=R.name;let J=U[G];if(J!==void 0)++J.referenceCount,y[N]=J;else{if(J=y[N],J!==void 0){J._cacheIndex===null&&(++J.referenceCount,this._addInactiveBinding(J,C,G));continue}const Y=t&&t._propertyBindings[N].binding.parsedPath;J=new bF(as.create(r,G,Y),R.ValueTypeName,R.getValueSize()),++J.referenceCount,this._addInactiveBinding(J,C,G),y[N]=J}i[N].resultBuffer=J.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,c=e._clip.uuid,p=this._actionsByClip[c];this._bindAction(e,p&&p.knownActions[0]),this._addInactiveAction(e,c,r)}const t=e._propertyBindings;for(let r=0,c=t.length;r!==c;++r){const p=t[r];p.useCount++===0&&(this._lendBinding(p),p.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,c=t.length;r!==c;++r){const p=t[r];--p.useCount===0&&(p.restoreOriginalState(),this._takeBackBinding(p))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,r){const c=this._actions,p=this._actionsByClip;let y=p[t];if(y===void 0)y={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,p[t]=y;else{const i=y.knownActions;e._byClipCacheIndex=i.length,i.push(e)}e._cacheIndex=c.length,c.push(e),y.actionByRoot[r]=e}_removeInactiveAction(e){const t=this._actions,r=t[t.length-1],c=e._cacheIndex;r._cacheIndex=c,t[c]=r,t.pop(),e._cacheIndex=null;const p=e._clip.uuid,y=this._actionsByClip,i=y[p],C=i.knownActions,D=C[C.length-1],U=e._byClipCacheIndex;D._byClipCacheIndex=U,C[U]=D,C.pop(),e._byClipCacheIndex=null;const N=i.actionByRoot,R=(e._localRoot||this._root).uuid;delete N[R],C.length===0&&delete y[p],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let r=0,c=t.length;r!==c;++r){const p=t[r];--p.referenceCount===0&&this._removeInactiveBinding(p)}}_lendAction(e){const t=this._actions,r=e._cacheIndex,c=this._nActiveActions++,p=t[c];e._cacheIndex=c,t[c]=e,p._cacheIndex=r,t[r]=p}_takeBackAction(e){const t=this._actions,r=e._cacheIndex,c=--this._nActiveActions,p=t[c];e._cacheIndex=c,t[c]=e,p._cacheIndex=r,t[r]=p}_addInactiveBinding(e,t,r){const c=this._bindingsByRootAndName,p=this._bindings;let y=c[t];y===void 0&&(y={},c[t]=y),y[r]=e,e._cacheIndex=p.length,p.push(e)}_removeInactiveBinding(e){const t=this._bindings,r=e.binding,c=r.rootNode.uuid,p=r.path,y=this._bindingsByRootAndName,i=y[c],C=t[t.length-1],D=e._cacheIndex;C._cacheIndex=D,t[D]=C,t.pop(),delete i[p],Object.keys(i).length===0&&delete y[c]}_lendBinding(e){const t=this._bindings,r=e._cacheIndex,c=this._nActiveBindings++,p=t[c];e._cacheIndex=c,t[c]=e,p._cacheIndex=r,t[r]=p}_takeBackBinding(e){const t=this._bindings,r=e._cacheIndex,c=--this._nActiveBindings,p=t[c];e._cacheIndex=c,t[c]=e,p._cacheIndex=r,t[r]=p}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let r=e[t];return r===void 0&&(r=new lB(new Float32Array(2),new Float32Array(2),1,RQ),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){const t=this._controlInterpolants,r=e.__cacheIndex,c=--this._nActiveControlInterpolants,p=t[c];e.__cacheIndex=c,t[c]=e,p.__cacheIndex=r,t[r]=p}clipAction(e,t,r){const c=t||this._root,p=c.uuid;let y=typeof e=="string"?ry.findByName(c,e):e;const i=y!==null?y.uuid:e,C=this._actionsByClip[i];let D=null;if(r===void 0&&(y!==null?r=y.blendMode:r=Qv),C!==void 0){const N=C.actionByRoot[p];if(N!==void 0&&N.blendMode===r)return N;D=C.knownActions[0],y===null&&(y=D._clip)}if(y===null)return null;const U=new UQ(this,y,t,r);return this._bindAction(U,D),this._addInactiveAction(U,i,p),U}existingAction(e,t){const r=t||this._root,c=r.uuid,p=typeof e=="string"?ry.findByName(r,e):e,y=p?p.uuid:e,i=this._actionsByClip[y];return i!==void 0&&i.actionByRoot[c]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,c=this.time+=e,p=Math.sign(e),y=this._accuIndex^=1;for(let D=0;D!==r;++D)t[D]._update(c,e,p,y);const i=this._bindings,C=this._nActiveBindings;for(let D=0;D!==C;++D)i[D].apply(y);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,r=e.uuid,c=this._actionsByClip,p=c[r];if(p!==void 0){const y=p.knownActions;for(let i=0,C=y.length;i!==C;++i){const D=y[i];this._deactivateAction(D);const U=D._cacheIndex,N=t[t.length-1];D._cacheIndex=null,D._byClipCacheIndex=null,N._cacheIndex=U,t[U]=N,t.pop(),this._removeInactiveBindingsForAction(D)}delete c[r]}}uncacheRoot(e){const t=e.uuid,r=this._actionsByClip;for(const y in r){const i=r[y].actionByRoot,C=i[t];C!==void 0&&(this._deactivateAction(C),this._removeInactiveAction(C))}const c=this._bindingsByRootAndName,p=c[t];if(p!==void 0)for(const y in p){const i=p[y];i.restoreOriginalState(),this._removeInactiveBinding(i)}}uncacheAction(e,t){const r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class xB{constructor(e){this.value=e}clone(){return new xB(this.value.clone===void 0?this.value:this.value.clone())}}let kQ=0;class OQ extends Xu{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:kQ++}),this.name="",this.usage=K_,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let r=0,c=t.length;r<c;r++)this.uniforms.push(t[r].clone());return this}clone(){return new this.constructor().copy(this)}}class xv extends $v{constructor(e,t,r=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class NQ{constructor(e,t,r,c,p){this.isGLBufferAttribute=!0,this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=c,this.count=p,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class p2{constructor(e,t,r=0,c=1/0){this.ray=new Ay(e,t),this.near=r,this.far=c,this.camera=null,this.layers=new dy,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return f2(e,this,r,t),r.sort(jT),r}intersectObjects(e,t=!0,r=[]){for(let c=0,p=e.length;c<p;c++)f2(e[c],this,r,t);return r.sort(jT),r}}function jT(u,e){return u.distance-e.distance}function f2(u,e,t,r){if(u.layers.test(e.layers)&&u.raycast(e,t),r===!0){const c=u.children;for(let p=0,y=c.length;p<y;p++)f2(c[p],e,t,!0)}}class m2{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Eo(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class QQ{constructor(e=1,t=0,r=0){return this.radius=e,this.theta=t,this.y=r,this}set(e,t,r){return this.radius=e,this.theta=t,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}clone(){return new this.constructor().copy(this)}}const KT=new Di;class VQ{constructor(e=new Di(1/0,1/0),t=new Di(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=KT.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return KT.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const $T=new ft,Fx=new ft;class BF{constructor(e=new ft,t=new ft){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){$T.subVectors(e,this.start),Fx.subVectors(this.end,this.start);const r=Fx.dot(Fx);let p=Fx.dot($T)/r;return t&&(p=Eo(p,0,1)),p}closestPointToPoint(e,t,r){const c=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(c).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ZT=new ft;class HQ extends cs{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new br,c=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let y=0,i=1,C=32;y<C;y++,i++){const D=y/C*Math.PI*2,U=i/C*Math.PI*2;c.push(Math.cos(D),Math.sin(D),1,Math.cos(U),Math.sin(U),1)}r.setAttribute("position",new jn(c,3));const p=new sa({fog:!1,toneMapped:!1});this.cone=new Yu(r,p),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),ZT.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ZT),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Qd=new ft,Lx=new lr,Jw=new lr;class GQ extends Yu{constructor(e){const t=CF(e),r=new br,c=[],p=[],y=new Dn(0,0,1),i=new Dn(0,1,0);for(let D=0;D<t.length;D++){const U=t[D];U.parent&&U.parent.isBone&&(c.push(0,0,0),c.push(0,0,0),p.push(y.r,y.g,y.b),p.push(i.r,i.g,i.b))}r.setAttribute("position",new jn(c,3)),r.setAttribute("color",new jn(p,3));const C=new sa({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,C),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,r=this.geometry,c=r.getAttribute("position");Jw.copy(this.root.matrixWorld).invert();for(let p=0,y=0;p<t.length;p++){const i=t[p];i.parent&&i.parent.isBone&&(Lx.multiplyMatrices(Jw,i.matrixWorld),Qd.setFromMatrixPosition(Lx),c.setXYZ(y,Qd.x,Qd.y,Qd.z),Lx.multiplyMatrices(Jw,i.parent.matrixWorld),Qd.setFromMatrixPosition(Lx),c.setXYZ(y+1,Qd.x,Qd.y,Qd.z),y+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function CF(u){const e=[];u.isBone===!0&&e.push(u);for(let t=0;t<u.children.length;t++)e.push.apply(e,CF(u.children[t]));return e}class WQ extends is{constructor(e,t,r){const c=new Qu(t,4,2),p=new na({wireframe:!0,fog:!1,toneMapped:!1});super(c,p),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const jQ=new ft,XT=new Dn,qT=new Dn;class EF extends cs{constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const c=new tg(t);c.rotateY(Math.PI*.5),this.material=new na({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const p=c.getAttribute("position"),y=new Float32Array(p.count*3);c.setAttribute("color",new ds(y,3)),this.add(new is(c,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");XT.copy(this.light.color),qT.copy(this.light.groundColor);for(let r=0,c=t.count;r<c;r++){const p=r<c/2?XT:qT;t.setXYZ(r,p.r,p.g,p.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(jQ.setFromMatrixPosition(this.light.matrixWorld).negate())}}class KQ extends Yu{constructor(e=10,t=10,r=4473924,c=8947848){r=new Dn(r),c=new Dn(c);const p=t/2,y=e/t,i=e/2,C=[],D=[];for(let R=0,G=0,J=-i;R<=t;R++,J+=y){C.push(-i,0,J,i,0,J),C.push(J,0,-i,J,0,i);const Y=R===p?r:c;Y.toArray(D,G),G+=3,Y.toArray(D,G),G+=3,Y.toArray(D,G),G+=3,Y.toArray(D,G),G+=3}const U=new br;U.setAttribute("position",new jn(C,3)),U.setAttribute("color",new jn(D,3));const N=new sa({vertexColors:!0,toneMapped:!1});super(U,N),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class $Q extends Yu{constructor(e=10,t=16,r=8,c=64,p=4473924,y=8947848){p=new Dn(p),y=new Dn(y);const i=[],C=[];if(t>1)for(let N=0;N<t;N++){const R=N/t*(Math.PI*2),G=Math.sin(R)*e,J=Math.cos(R)*e;i.push(0,0,0),i.push(G,0,J);const Y=N&1?p:y;C.push(Y.r,Y.g,Y.b),C.push(Y.r,Y.g,Y.b)}for(let N=0;N<r;N++){const R=N&1?p:y,G=e-e/r*N;for(let J=0;J<c;J++){let Y=J/c*(Math.PI*2),B=Math.sin(Y)*G,ae=Math.cos(Y)*G;i.push(B,0,ae),C.push(R.r,R.g,R.b),Y=(J+1)/c*(Math.PI*2),B=Math.sin(Y)*G,ae=Math.cos(Y)*G,i.push(B,0,ae),C.push(R.r,R.g,R.b)}}const D=new br;D.setAttribute("position",new jn(i,3)),D.setAttribute("color",new jn(C,3));const U=new sa({vertexColors:!0,toneMapped:!1});super(D,U),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const YT=new ft,Dx=new ft,JT=new ft;class TF extends cs{constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",t===void 0&&(t=1);let c=new br;c.setAttribute("position",new jn([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const p=new sa({fog:!1,toneMapped:!1});this.lightPlane=new Ku(c,p),this.add(this.lightPlane),c=new br,c.setAttribute("position",new jn([0,0,0,0,0,1],3)),this.targetLine=new Ku(c,p),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),YT.setFromMatrixPosition(this.light.matrixWorld),Dx.setFromMatrixPosition(this.light.target.matrixWorld),JT.subVectors(Dx,YT),this.lightPlane.lookAt(Dx),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Dx),this.targetLine.scale.z=JT.length()}}const Px=new ft,po=new Hv;class SF extends Yu{constructor(e){const t=new br,r=new sa({color:16777215,vertexColors:!0,toneMapped:!1}),c=[],p=[],y={};i("n1","n2"),i("n2","n4"),i("n4","n3"),i("n3","n1"),i("f1","f2"),i("f2","f4"),i("f4","f3"),i("f3","f1"),i("n1","f1"),i("n2","f2"),i("n3","f3"),i("n4","f4"),i("p","n1"),i("p","n2"),i("p","n3"),i("p","n4"),i("u1","u2"),i("u2","u3"),i("u3","u1"),i("c","t"),i("p","c"),i("cn1","cn2"),i("cn3","cn4"),i("cf1","cf2"),i("cf3","cf4");function i(J,Y){C(J),C(Y)}function C(J){c.push(0,0,0),p.push(0,0,0),y[J]===void 0&&(y[J]=[]),y[J].push(c.length/3-1)}t.setAttribute("position",new jn(c,3)),t.setAttribute("color",new jn(p,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=y,this.update();const D=new Dn(16755200),U=new Dn(16711680),N=new Dn(43775),R=new Dn(16777215),G=new Dn(3355443);this.setColors(D,U,N,R,G)}setColors(e,t,r,c,p){const i=this.geometry.getAttribute("color");i.setXYZ(0,e.r,e.g,e.b),i.setXYZ(1,e.r,e.g,e.b),i.setXYZ(2,e.r,e.g,e.b),i.setXYZ(3,e.r,e.g,e.b),i.setXYZ(4,e.r,e.g,e.b),i.setXYZ(5,e.r,e.g,e.b),i.setXYZ(6,e.r,e.g,e.b),i.setXYZ(7,e.r,e.g,e.b),i.setXYZ(8,e.r,e.g,e.b),i.setXYZ(9,e.r,e.g,e.b),i.setXYZ(10,e.r,e.g,e.b),i.setXYZ(11,e.r,e.g,e.b),i.setXYZ(12,e.r,e.g,e.b),i.setXYZ(13,e.r,e.g,e.b),i.setXYZ(14,e.r,e.g,e.b),i.setXYZ(15,e.r,e.g,e.b),i.setXYZ(16,e.r,e.g,e.b),i.setXYZ(17,e.r,e.g,e.b),i.setXYZ(18,e.r,e.g,e.b),i.setXYZ(19,e.r,e.g,e.b),i.setXYZ(20,e.r,e.g,e.b),i.setXYZ(21,e.r,e.g,e.b),i.setXYZ(22,e.r,e.g,e.b),i.setXYZ(23,e.r,e.g,e.b),i.setXYZ(24,t.r,t.g,t.b),i.setXYZ(25,t.r,t.g,t.b),i.setXYZ(26,t.r,t.g,t.b),i.setXYZ(27,t.r,t.g,t.b),i.setXYZ(28,t.r,t.g,t.b),i.setXYZ(29,t.r,t.g,t.b),i.setXYZ(30,t.r,t.g,t.b),i.setXYZ(31,t.r,t.g,t.b),i.setXYZ(32,r.r,r.g,r.b),i.setXYZ(33,r.r,r.g,r.b),i.setXYZ(34,r.r,r.g,r.b),i.setXYZ(35,r.r,r.g,r.b),i.setXYZ(36,r.r,r.g,r.b),i.setXYZ(37,r.r,r.g,r.b),i.setXYZ(38,c.r,c.g,c.b),i.setXYZ(39,c.r,c.g,c.b),i.setXYZ(40,p.r,p.g,p.b),i.setXYZ(41,p.r,p.g,p.b),i.setXYZ(42,p.r,p.g,p.b),i.setXYZ(43,p.r,p.g,p.b),i.setXYZ(44,p.r,p.g,p.b),i.setXYZ(45,p.r,p.g,p.b),i.setXYZ(46,p.r,p.g,p.b),i.setXYZ(47,p.r,p.g,p.b),i.setXYZ(48,p.r,p.g,p.b),i.setXYZ(49,p.r,p.g,p.b),i.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,r=1,c=1;po.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),bo("c",t,e,po,0,0,-1),bo("t",t,e,po,0,0,1),bo("n1",t,e,po,-r,-c,-1),bo("n2",t,e,po,r,-c,-1),bo("n3",t,e,po,-r,c,-1),bo("n4",t,e,po,r,c,-1),bo("f1",t,e,po,-r,-c,1),bo("f2",t,e,po,r,-c,1),bo("f3",t,e,po,-r,c,1),bo("f4",t,e,po,r,c,1),bo("u1",t,e,po,r*.7,c*1.1,-1),bo("u2",t,e,po,-r*.7,c*1.1,-1),bo("u3",t,e,po,0,c*2,-1),bo("cf1",t,e,po,-r,0,1),bo("cf2",t,e,po,r,0,1),bo("cf3",t,e,po,0,-c,1),bo("cf4",t,e,po,0,c,1),bo("cn1",t,e,po,-r,0,-1),bo("cn2",t,e,po,r,0,-1),bo("cn3",t,e,po,0,-c,-1),bo("cn4",t,e,po,0,c,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function bo(u,e,t,r,c,p,y){Px.set(c,p,y).unproject(r);const i=e[u];if(i!==void 0){const C=t.getAttribute("position");for(let D=0,U=i.length;D<U;D++)C.setXYZ(i[D],Px.x,Px.y,Px.z)}}const Ux=new qu;class g2 extends Yu{constructor(e,t=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),c=new Float32Array(8*3),p=new br;p.setIndex(new ds(r,1)),p.setAttribute("position",new ds(c,3)),super(p,new sa({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Ux.setFromObject(this.object),Ux.isEmpty())return;const t=Ux.min,r=Ux.max,c=this.geometry.attributes.position,p=c.array;p[0]=r.x,p[1]=r.y,p[2]=r.z,p[3]=t.x,p[4]=r.y,p[5]=r.z,p[6]=t.x,p[7]=t.y,p[8]=r.z,p[9]=r.x,p[10]=t.y,p[11]=r.z,p[12]=r.x,p[13]=r.y,p[14]=t.z,p[15]=t.x,p[16]=r.y,p[17]=t.z,p[18]=t.x,p[19]=t.y,p[20]=t.z,p[21]=r.x,p[22]=t.y,p[23]=t.z,c.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ZQ extends Yu{constructor(e,t=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),c=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],p=new br;p.setIndex(new ds(r,1)),p.setAttribute("position",new jn(c,3)),super(p,new sa({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class XQ extends Ku{constructor(e,t=1,r=16776960){const c=r,p=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],y=new br;y.setAttribute("position",new jn(p,3)),y.computeBoundingSphere(),super(y,new sa({color:c,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const i=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],C=new br;C.setAttribute("position",new jn(i,3)),C.computeBoundingSphere(),this.add(new is(C,new na({color:c,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const eS=new ft;let Rx,eb;class MF extends cs{constructor(e=new ft(0,0,1),t=new ft(0,0,0),r=1,c=16776960,p=r*.2,y=p*.2){super(),this.type="ArrowHelper",Rx===void 0&&(Rx=new br,Rx.setAttribute("position",new jn([0,0,0,0,1,0],3)),eb=new wf(0,.5,1,5,1),eb.translate(0,-.5,0)),this.position.copy(t),this.line=new Ku(Rx,new sa({color:c,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new is(eb,new na({color:c,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,p,y)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{eS.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(eS,t)}}setLength(e,t=e*.2,r=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class IF extends Yu{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],c=new br;c.setAttribute("position",new jn(t,3)),c.setAttribute("color",new jn(r,3));const p=new sa({vertexColors:!0,toneMapped:!1});super(c,p),this.type="AxesHelper"}setColors(e,t,r){const c=new Dn,p=this.geometry.attributes.color.array;return c.set(e),c.toArray(p,0),c.toArray(p,3),c.set(t),c.toArray(p,6),c.toArray(p,9),c.set(r),c.toArray(p,12),c.toArray(p,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class qQ{constructor(){this.type="ShapePath",this.color=new Dn,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new q_,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,c){return this.currentPath.quadraticCurveTo(e,t,r,c),this}bezierCurveTo(e,t,r,c,p,y){return this.currentPath.bezierCurveTo(e,t,r,c,p,y),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(ae){const le=[];for(let Ae=0,we=ae.length;Ae<we;Ae++){const me=ae[Ae],Pe=new np;Pe.curves=me.curves,le.push(Pe)}return le}function r(ae,le){const Ae=le.length;let we=!1;for(let me=Ae-1,Pe=0;Pe<Ae;me=Pe++){let it=le[me],Me=le[Pe],Ke=Me.x-it.x,Et=Me.y-it.y;if(Math.abs(Et)>Number.EPSILON){if(Et<0&&(it=le[Pe],Ke=-Ke,Me=le[me],Et=-Et),ae.y<it.y||ae.y>Me.y)continue;if(ae.y===it.y){if(ae.x===it.x)return!0}else{const oi=Et*(ae.x-it.x)-Ke*(ae.y-it.y);if(oi===0)return!0;if(oi<0)continue;we=!we}}else{if(ae.y!==it.y)continue;if(Me.x<=ae.x&&ae.x<=it.x||it.x<=ae.x&&ae.x<=Me.x)return!0}}return we}const c=Hu.isClockWise,p=this.subPaths;if(p.length===0)return[];let y,i,C;const D=[];if(p.length===1)return i=p[0],C=new np,C.curves=i.curves,D.push(C),D;let U=!c(p[0].getPoints());U=e?!U:U;const N=[],R=[];let G=[],J=0,Y;R[J]=void 0,G[J]=[];for(let ae=0,le=p.length;ae<le;ae++)i=p[ae],Y=i.getPoints(),y=c(Y),y=e?!y:y,y?(!U&&R[J]&&J++,R[J]={s:new np,p:Y},R[J].s.curves=i.curves,U&&J++,G[J]=[]):G[J].push({h:i,p:Y[0]});if(!R[0])return t(p);if(R.length>1){let ae=!1,le=0;for(let Ae=0,we=R.length;Ae<we;Ae++)N[Ae]=[];for(let Ae=0,we=R.length;Ae<we;Ae++){const me=G[Ae];for(let Pe=0;Pe<me.length;Pe++){const it=me[Pe];let Me=!0;for(let Ke=0;Ke<R.length;Ke++)r(it.p,R[Ke].p)&&(Ae!==Ke&&le++,Me?(Me=!1,N[Ke].push(it)):ae=!0);Me&&N[Ae].push(it)}}le>0&&ae===!1&&(G=N)}let B;for(let ae=0,le=R.length;ae<le;ae++){C=R[ae].s,D.push(C),B=G[ae];for(let Ae=0,we=B.length;Ae<we;Ae++)C.holes.push(B[Ae].h)}return D}}const VA=YQ();function YQ(){const u=new ArrayBuffer(4),e=new Float32Array(u),t=new Uint32Array(u),r=new Uint32Array(512),c=new Uint32Array(512);for(let C=0;C<256;++C){const D=C-127;D<-27?(r[C]=0,r[C|256]=32768,c[C]=24,c[C|256]=24):D<-14?(r[C]=1024>>-D-14,r[C|256]=1024>>-D-14|32768,c[C]=-D-1,c[C|256]=-D-1):D<=15?(r[C]=D+15<<10,r[C|256]=D+15<<10|32768,c[C]=13,c[C|256]=13):D<128?(r[C]=31744,r[C|256]=64512,c[C]=24,c[C|256]=24):(r[C]=31744,r[C|256]=64512,c[C]=13,c[C|256]=13)}const p=new Uint32Array(2048),y=new Uint32Array(64),i=new Uint32Array(64);for(let C=1;C<1024;++C){let D=C<<13,U=0;for(;(D&8388608)===0;)D<<=1,U-=8388608;D&=-8388609,U+=947912704,p[C]=D|U}for(let C=1024;C<2048;++C)p[C]=939524096+(C-1024<<13);for(let C=1;C<31;++C)y[C]=C<<23;y[31]=1199570944,y[32]=2147483648;for(let C=33;C<63;++C)y[C]=2147483648+(C-32<<23);y[63]=3347054592;for(let C=1;C<64;++C)C!==32&&(i[C]=1024);return{floatView:e,uint32View:t,baseTable:r,shiftTable:c,mantissaTable:p,exponentTable:y,offsetTable:i}}function JQ(u){Math.abs(u)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),u=Eo(u,-65504,65504),VA.floatView[0]=u;const e=VA.uint32View[0],t=e>>23&511;return VA.baseTable[t]+((e&8388607)>>VA.shiftTable[t])}function eV(u){const e=u>>10;return VA.uint32View[0]=VA.mantissaTable[VA.offsetTable[e]+(u&1023)]+VA.exponentTable[e],VA.floatView[0]}var tV=Object.freeze({__proto__:null,toHalfFloat:JQ,fromHalfFloat:eV});function iV(){console.error("THREE.ImmediateRenderObject has been removed.")}class nV extends Oa{constructor(e,t,r){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,r),this.samples=4}}class rV extends uy{constructor(e,t,r,c){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,r,c)}}class sV extends Vv{constructor(e,t,r,c){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,r,c)}}class oV extends YA{constructor(e,t,r,c,p,y){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,r,c,p,y)}}class aV extends gy{constructor(e,t,r,c){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,r,c)}}class lV extends _y{constructor(e,t,r,c){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,r,c)}}class cV extends yf{constructor(e,t,r,c,p,y,i){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,r,c,p,y,i)}}class hV extends wf{constructor(e,t,r,c,p,y,i,C){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,r,c,p,y,i,C)}}class uV extends yy{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}}class AV extends xy{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}}class dV extends vy{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}}class pV extends eg{constructor(e,t,r,c){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,r,c)}}class fV extends tg{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}}class FF extends $A{constructor(e,t,r,c){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,r,c)}}class mV extends JA{constructor(e,t,r,c){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,r,c)}}class gV extends wy{constructor(e,t,r,c,p,y){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,r,c,p,y)}}class _V extends ig{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}}class yV extends Qu{constructor(e,t,r,c,p,y,i){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,r,c,p,y,i)}}class xV extends by{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}}class vV extends By{constructor(e,t,r,c,p){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,r,c,p)}}class wV extends Cy{constructor(e,t,r,c,p,y){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,r,c,p,y)}}class bV extends ng{constructor(e,t,r,c,p){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,r,c,p)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ov}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ov);const LF=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:aI,AddEquation:Jp,AddOperation:rI,AdditiveAnimationBlendMode:k2,AdditiveBlending:uv,AlphaFormat:pI,AlwaysDepth:qM,AlwaysStencilFunc:II,AmbientLight:fB,AmbientLightProbe:vF,AnimationClip:ry,AnimationLoader:aQ,AnimationMixer:zQ,AnimationObjectGroup:PQ,AnimationUtils:nQ,ArcCurve:YI,ArrayCamera:GI,ArrowHelper:MF,Audio:wF,AudioAnalyser:BQ,AudioContext:gB,AudioListener:vQ,AudioLoader:gQ,AxesHelper:IF,BackSide:Dc,BasicDepthPacking:TI,BasicShadowMap:FR,Bone:K2,BooleanKeyframeTrack:bf,Box2:VQ,Box3:qu,Box3Helper:ZQ,BoxBufferGeometry:oV,BoxGeometry:YA,BoxHelper:g2,BufferAttribute:ds,BufferGeometry:br,BufferGeometryLoader:xF,ByteType:cI,Cache:vf,Camera:Hv,CameraHelper:SF,CanvasTexture:qI,CapsuleBufferGeometry:aV,CapsuleGeometry:gy,CatmullRomCurve3:X_,CineonToneMapping:oI,CircleBufferGeometry:lV,CircleGeometry:_y,ClampToEdgeWrapping:rl,Clock:t1,Color:Dn,ColorKeyframeTrack:cB,ColorManagement:tl,CompressedArrayTexture:TN,CompressedTexture:X2,CompressedTextureLoader:lQ,ConeBufferGeometry:cV,ConeGeometry:yf,CubeCamera:RI,CubeReflectionMapping:op,CubeRefractionMapping:ap,CubeTexture:py,CubeTextureLoader:cQ,CubeUVReflectionMapping:qm,CubicBezierCurve:Y2,CubicBezierCurve3:JI,CubicInterpolant:dF,CullFaceBack:Db,CullFaceFront:RM,CullFaceFrontBack:IR,CullFaceNone:UM,Curve:Au,CurvePath:tF,CustomBlending:kM,CustomToneMapping:lI,CylinderBufferGeometry:hV,CylinderGeometry:wf,Cylindrical:QQ,Data3DTexture:Vv,DataArrayTexture:uy,DataTexture:Qm,DataTexture2DArray:rV,DataTexture3D:sV,DataTextureLoader:hQ,DataUtils:tV,DecrementStencilOp:HR,DecrementWrapStencilOp:WR,DefaultLoadingManager:mF,DepthFormat:ip,DepthStencilFormat:gf,DepthTexture:WI,DirectionalLight:pB,DirectionalLightHelper:TF,DiscreteInterpolant:pF,DodecahedronBufferGeometry:uV,DodecahedronGeometry:yy,DoubleSide:Il,DstAlphaFactor:WM,DstColorFactor:KM,DynamicCopyUsage:oz,DynamicDrawUsage:ez,DynamicReadUsage:nz,EdgesGeometry:iF,EllipseCurve:Xv,EqualDepth:JM,EqualStencilFunc:ZR,EquirectangularReflectionMapping:Q_,EquirectangularRefractionMapping:V_,Euler:Ym,EventDispatcher:Xu,ExtrudeBufferGeometry:AV,ExtrudeGeometry:xy,FileLoader:XA,Float16BufferAttribute:Nz,Float32BufferAttribute:jn,Float64BufferAttribute:Qz,FloatType:GA,Fog:Kv,FogExp2:jv,FramebufferTexture:EN,FrontSide:ju,Frustum:Gv,GLBufferAttribute:NQ,GLSL1:lz,GLSL3:s2,GreaterDepth:tI,GreaterEqualDepth:eI,GreaterEqualStencilFunc:JR,GreaterStencilFunc:qR,GridHelper:KQ,Group:As,HalfFloatType:Gm,HemisphereLight:uB,HemisphereLightHelper:EF,HemisphereLightProbe:_Q,IcosahedronBufferGeometry:dV,IcosahedronGeometry:vy,ImageBitmapLoader:mQ,ImageLoader:sy,ImageUtils:N2,ImmediateRenderObject:iV,IncrementStencilOp:VR,IncrementWrapStencilOp:GR,InstancedBufferAttribute:Km,InstancedBufferGeometry:mB,InstancedInterleavedBuffer:xv,InstancedMesh:XI,Int16BufferAttribute:kz,Int32BufferAttribute:Oz,Int8BufferAttribute:Uz,IntType:uI,InterleavedBuffer:$v,InterleavedBufferAttribute:Lc,Interpolant:Ey,InterpolateDiscrete:G_,InterpolateLinear:W_,InterpolateSmooth:Xx,InvertStencilOp:jR,KeepStencilOp:qx,KeyframeTrack:du,LOD:$I,LatheBufferGeometry:pV,LatheGeometry:eg,Layers:dy,LessDepth:YM,LessEqualDepth:Av,LessEqualStencilFunc:XR,LessStencilFunc:$R,Light:Ap,LightProbe:Jv,Line:Ku,Line3:BF,LineBasicMaterial:sa,LineCurve:qv,LineCurve3:eF,LineDashedMaterial:uF,LineLoop:_v,LineSegments:Yu,LinearEncoding:hp,LinearFilter:Xs,LinearInterpolant:lB,LinearMipMapLinearFilter:UR,LinearMipMapNearestFilter:PR,LinearMipmapLinearFilter:lp,LinearMipmapNearestFilter:R2,LinearSRGBColorSpace:Wm,LinearToneMapping:U2,Loader:Uc,LoaderUtils:d2,LoadingManager:hB,LoopOnce:BI,LoopPingPong:EI,LoopRepeat:CI,LuminanceAlphaFormat:gI,LuminanceFormat:mI,MOUSE:$p,Material:ol,MaterialLoader:e1,MathUtils:LI,Matrix3:Pl,Matrix4:lr,MaxEquation:zb,Mesh:is,MeshBasicMaterial:na,MeshDepthMaterial:G2,MeshDistanceMaterial:W2,MeshLambertMaterial:yv,MeshMatcapMaterial:hF,MeshNormalMaterial:cF,MeshPhongMaterial:sB,MeshPhysicalMaterial:rB,MeshStandardMaterial:ty,MeshToonMaterial:lF,MinEquation:Rb,MirroredRepeatWrapping:H_,MixOperation:nI,MultiplyBlending:Ub,MultiplyOperation:hy,NearestFilter:Co,NearestMipMapLinearFilter:DR,NearestMipMapNearestFilter:LR,NearestMipmapLinearFilter:F_,NearestMipmapNearestFilter:dv,NeverDepth:XM,NeverStencilFunc:KR,NoBlending:KA,NoColorSpace:OR,NoToneMapping:Vu,NormalAnimationBlendMode:Qv,NormalBlending:Af,NotEqualDepth:iI,NotEqualStencilFunc:YR,NumberKeyframeTrack:iy,Object3D:cs,ObjectLoader:pQ,ObjectSpaceNormalMap:MI,OctahedronBufferGeometry:fV,OctahedronGeometry:tg,OneFactor:VM,OneMinusDstAlphaFactor:jM,OneMinusDstColorFactor:$M,OneMinusSrcAlphaFactor:P2,OneMinusSrcColorFactor:GM,OrthographicCamera:fy,PCFShadowMap:L2,PCFSoftShadowMap:zM,PMREMGenerator:a2,Path:q_,PerspectiveCamera:_a,Plane:$d,PlaneBufferGeometry:FF,PlaneGeometry:$A,PlaneHelper:XQ,PointLight:dB,PointLightHelper:WQ,Points:Z2,PointsMaterial:$2,PolarGridHelper:$Q,PolyhedronBufferGeometry:mV,PolyhedronGeometry:JA,PositionalAudio:bQ,PropertyBinding:as,PropertyMixer:bF,QuadraticBezierCurve:J2,QuadraticBezierCurve3:eB,Quaternion:sl,QuaternionKeyframeTrack:rg,QuaternionLinearInterpolant:fF,REVISION:Ov,RGBADepthPacking:SI,RGBAFormat:Dl,RGBAIntegerFormat:wI,RGBA_ASTC_10x10_Format:t2,RGBA_ASTC_10x5_Format:Yb,RGBA_ASTC_10x6_Format:Jb,RGBA_ASTC_10x8_Format:e2,RGBA_ASTC_12x10_Format:i2,RGBA_ASTC_12x12_Format:n2,RGBA_ASTC_4x4_Format:Gb,RGBA_ASTC_5x4_Format:Wb,RGBA_ASTC_5x5_Format:jb,RGBA_ASTC_6x5_Format:Kb,RGBA_ASTC_6x6_Format:$b,RGBA_ASTC_8x5_Format:Zb,RGBA_ASTC_8x6_Format:Xb,RGBA_ASTC_8x8_Format:qb,RGBA_BPTC_Format:r2,RGBA_ETC2_EAC_Format:Hb,RGBA_PVRTC_2BPPV1_Format:Qb,RGBA_PVRTC_4BPPV1_Format:Nb,RGBA_S3TC_DXT1_Format:Kx,RGBA_S3TC_DXT3_Format:$x,RGBA_S3TC_DXT5_Format:Zx,RGBFormat:fI,RGB_ETC1_Format:bI,RGB_ETC2_Format:Vb,RGB_PVRTC_2BPPV1_Format:Ob,RGB_PVRTC_4BPPV1_Format:kb,RGB_S3TC_DXT1_Format:jx,RGFormat:xI,RGIntegerFormat:vI,RawShaderMaterial:aF,Ray:Ay,Raycaster:p2,RectAreaLight:_F,RedFormat:_I,RedIntegerFormat:yI,ReinhardToneMapping:sI,RepeatWrapping:HA,ReplaceStencilOp:QR,ReverseSubtractEquation:NM,RingBufferGeometry:gV,RingGeometry:wy,SRGBColorSpace:cu,Scene:j2,ShaderChunk:zr,ShaderLib:Fl,ShaderMaterial:ko,ShadowMaterial:oF,Shape:np,ShapeBufferGeometry:_V,ShapeGeometry:ig,ShapePath:qQ,ShapeUtils:Hu,ShortType:hI,Skeleton:Zv,SkeletonHelper:GQ,SkinnedMesh:ZI,Source:lf,Sphere:qA,SphereBufferGeometry:yV,SphereGeometry:Qu,Spherical:m2,SphericalHarmonics3:yF,SplineCurve:tB,SpotLight:gF,SpotLightHelper:HQ,Sprite:gv,SpriteMaterial:my,SrcAlphaFactor:D2,SrcAlphaSaturateFactor:ZM,SrcColorFactor:HM,StaticCopyUsage:sz,StaticDrawUsage:K_,StaticReadUsage:iz,StereoCamera:yQ,StreamCopyUsage:az,StreamDrawUsage:tz,StreamReadUsage:rz,StringKeyframeTrack:Bf,SubtractEquation:OM,SubtractiveBlending:Pb,TOUCH:Zp,TangentSpaceNormalMap:up,TetrahedronBufferGeometry:xV,TetrahedronGeometry:by,Texture:To,TextureLoader:jd,TorusBufferGeometry:vV,TorusGeometry:By,TorusKnotBufferGeometry:wV,TorusKnotGeometry:Cy,Triangle:wh,TriangleFanDrawMode:kR,TriangleStripDrawMode:zR,TrianglesDrawMode:RR,TubeBufferGeometry:bV,TubeGeometry:ng,TwoPassDoubleSide:w_,UVMapping:Nv,Uint16BufferAttribute:Q2,Uint32BufferAttribute:V2,Uint8BufferAttribute:Rz,Uint8ClampedBufferAttribute:zz,Uniform:xB,UniformsGroup:OQ,UniformsLib:En,UniformsUtils:_f,UnsignedByteType:cp,UnsignedInt248Type:df,UnsignedIntType:Yd,UnsignedShort4444Type:AI,UnsignedShort5551Type:dI,UnsignedShortType:z2,VSMShadowMap:Dm,Vector2:Di,Vector3:ft,Vector4:ls,VectorKeyframeTrack:ny,VideoTexture:CN,WebGL1Renderer:jI,WebGL3DRenderTarget:Cz,WebGLArrayRenderTarget:Bz,WebGLCubeRenderTarget:zI,WebGLMultipleRenderTargets:Ez,WebGLMultisampleRenderTarget:nV,WebGLRenderTarget:Oa,WebGLRenderer:mv,WebGLUtils:HI,WireframeGeometry:nB,WrapAroundEnding:j_,ZeroCurvatureEnding:of,ZeroFactor:QM,ZeroSlopeEnding:af,ZeroStencilOp:NR,_SRGBAFormat:pv,sRGBEncoding:Ss},Symbol.toStringTag,{value:"Module"}));var DF={exports:{}};(function(u,e){(function({},t){u.exports=t()})(TS,function(){var t,r,c;function p(i,C){if(!t)t=C;else if(!r)r=C;else{var D="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+t+")(sharedChunk); ("+r+")(sharedChunk); self.onerror = null;",U={};t(U),c=C(U),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(c.workerUrl=window.URL.createObjectURL(new Blob([D],{type:"text/javascript"})))}}p(["exports"],function(i){var C=typeof self<"u"?self:{},D="2.12.0";let U;const N={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(U==null){const s=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{U={}.API_URL_REGEX!=null?new RegExp({}.API_URL_REGEX):s}catch{U=s}}return U},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){return this.API_URL?this.API_URL.indexOf("https://api.mapbox.cn")===0?"https://events.mapbox.cn/events/v2":this.API_URL.indexOf("https://api.mapbox.com")===0?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},R={supported:!1,testSupport:function(s){!Y&&J&&(B?ae(s):G=s)}};let G,J,Y=!1,B=!1;function ae(s){const n=s.createTexture();s.bindTexture(s.TEXTURE_2D,n);try{if(s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,J),s.isContextLost())return;R.supported=!0}catch{}s.deleteTexture(n),Y=!0}C.document&&(J=C.document.createElement("img"),J.onload=function(){G&&ae(G),G=null,B=!0},J.onerror=function(){Y=!0,G=null},J.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const le="01";var Ae=we;function we(s,n,o,d){this.cx=3*s,this.bx=3*(o-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=o,this.p2y=d}we.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var o=s,d=0;d<8;d++){var g=this.sampleCurveX(o)-s;if(Math.abs(g)<n)return o;var v=this.sampleCurveDerivativeX(o);if(Math.abs(v)<1e-6)break;o-=g/v}var E=0,L=1;for(o=s,d=0;d<20&&(g=this.sampleCurveX(o),!(Math.abs(g-s)<n));d++)s>g?E=o:L=o,o=.5*(L-E)+E;return o},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var me=Pe;function Pe(s,n){this.x=s,this.y=n}Pe.prototype={clone:function(){return new Pe(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,n){return this.clone()._rotateAround(s,n)},matMult:function(s){return this.clone()._matMult(s)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var n=s.x-this.x,o=s.y-this.y;return n*n+o*o},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,n){return Math.atan2(this.x*n-this.y*s,this.x*s+this.y*n)},_matMult:function(s){var n=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=n,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var n=Math.cos(s),o=Math.sin(s),d=o*this.x+n*this.y;return this.x=n*this.x-o*this.y,this.y=d,this},_rotateAround:function(s,n){var o=Math.cos(s),d=Math.sin(s),g=n.y+d*(this.x-n.x)+o*(this.y-n.y);return this.x=n.x+o*(this.x-n.x)-d*(this.y-n.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Pe.convert=function(s){return s instanceof Pe?s:Array.isArray(s)?new Pe(s[0],s[1]):s};const it=Math.PI/180,Me=180/Math.PI;function Ke(s){return s*it}function Et(s){return s*Me}const oi=[[0,0],[1,0],[1,1],[0,1]];function Ci(s){if(s<=0)return 0;if(s>=1)return 1;const n=s*s,o=n*s;return 4*(s<.5?o:3*(s-n)+o-.75)}function te(s,n,o,d){const g=new Ae(s,n,o,d);return function(v){return g.solve(v)}}const ce=te(.25,.1,.25,1);function ye(s,n,o){return Math.min(o,Math.max(n,s))}function xe(s,n,o){return(o=ye((o-s)/(n-s),0,1))*o*(3-2*o)}function ze(s,n,o){const d=o-n,g=((s-n)%d+d)%d+n;return g===n?o:g}function Ne(s,n,o){if(!s.length)return o(null,[]);let d=s.length;const g=new Array(s.length);let v=null;s.forEach((E,L)=>{n(E,(k,V)=>{k&&(v=k),g[L]=V,--d==0&&o(v,g)})})}function Ge(s){const n=[];for(const o in s)n.push(s[o]);return n}function Ve(s,...n){for(const o of n)for(const d in o)s[d]=o[d];return s}let Le=1;function Ie(){return Le++}function qe(){return function s(n){return n?(n^Math.random()*(16>>n/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,s)}()}function et(s){return s<=1?1:Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function vt(s){return!!s&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(s)}function Be(s,n){s.forEach(o=>{n[o]&&(n[o]=n[o].bind(n))})}function dt(s,n){return s.indexOf(n,s.length-n.length)!==-1}function ut(s,n,o){const d={};for(const g in s)d[g]=n.call(o||this,s[g],g,s);return d}function Qt(s,n,o){const d={};for(const g in s)n.call(o||this,s[g],g,s)&&(d[g]=s[g]);return d}function Wt(s){return Array.isArray(s)?s.map(Wt):typeof s=="object"&&s?ut(s,Wt):s}const Nt={};function Ct(s){Nt[s]||(typeof console<"u"&&console.warn(s),Nt[s]=!0)}function Ft(s,n,o){return(o.y-s.y)*(n.x-s.x)>(n.y-s.y)*(o.x-s.x)}function Xt(s){let n=0;for(let o,d,g=0,v=s.length,E=v-1;g<v;E=g++)o=s[g],d=s[E],n+=(d.x-o.x)*(o.y+d.y);return n}function mi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function fi(s){const n={};if(s.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(o,d,g,v)=>{const E=g||v;return n[d]=!E||E.toLowerCase(),""}),n["max-age"]){const o=parseInt(n["max-age"],10);isNaN(o)?delete n["max-age"]:n["max-age"]=o}return n}let Gi=null;function wn(s){if(Gi==null){const n=s.navigator?s.navigator.userAgent:null;Gi=!!s.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return Gi}function Qi(s){try{const n=C[s];return n.setItem("_mapbox_test_",1),n.removeItem("_mapbox_test_"),!0}catch{return!1}}function Gn(s,n){return[s[4*n],s[4*n+1],s[4*n+2],s[4*n+3]]}const kn="mapbox-tiles";let yt,st,ti=500,Ni=50;function qi(){try{return C.caches}catch{}}function en(){qi()&&!yt&&(yt=C.caches.open(kn))}function $t(s){const n=s.indexOf("?");if(n<0)return s;const o=function(g){const v=g.indexOf("?");return v>0?g.slice(v+1).split("&"):[]}(s),d=o.filter(g=>{const v=g.split("=");return v[0]==="language"||v[0]==="worldview"});return d.length?`${s.slice(0,n)}?${d.join("&")}`:s.slice(0,n)}let at=1/0;const ii={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(ii);class hn extends Error{constructor(n,o,d){o===401&&Ui(d)&&(n+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(n),this.status=o,this.url=d}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Xi=mi()?()=>self.worker&&self.worker.referrer:()=>(C.location.protocol==="blob:"?C.parent:C).location.href,on=function(s,n){if(!(/^file:/.test(o=s.url)||/^file:/.test(Xi())&&!/^\w+:/.test(o))){if(C.fetch&&C.Request&&C.AbortController&&C.Request.prototype.hasOwnProperty("signal"))return function(d,g){const v=new C.AbortController,E=new C.Request(d.url,{method:d.method||"GET",body:d.body,credentials:d.credentials,headers:d.headers,referrer:Xi(),signal:v.signal});let L=!1,k=!1;const V=(q=E.url).indexOf("sku=")>0&&Ui(q);var q;d.type==="json"&&E.headers.set("Accept","application/json");const se=(_e,be,De)=>{if(k)return;if(_e&&_e.message!=="SecurityError"&&Ct(_e),be&&De)return he(be);const Ze=Date.now();C.fetch(E).then(xt=>{if(xt.ok){const Dt=V?xt.clone():null;return he(xt,Dt,Ze)}return g(new hn(xt.statusText,xt.status,d.url))}).catch(xt=>{xt.code!==20&&g(new Error(xt.message))})},he=(_e,be,De)=>{(d.type==="arrayBuffer"?_e.arrayBuffer():d.type==="json"?_e.json():_e.text()).then(Ze=>{k||(be&&De&&function(xt,Dt,_t){if(en(),!yt)return;const Tt={status:Dt.status,statusText:Dt.statusText,headers:new C.Headers};Dt.headers.forEach((ci,ai)=>Tt.headers.set(ai,ci));const kt=fi(Dt.headers.get("Cache-Control")||"");if(kt["no-store"])return;kt["max-age"]&&Tt.headers.set("Expires",new Date(_t+1e3*kt["max-age"]).toUTCString());const Ut=Tt.headers.get("Expires");Ut&&(new Date(Ut).getTime()-_t<42e4||function(ci,ai){if(st===void 0)try{new Response(new ReadableStream),st=!0}catch{st=!1}st?ai(ci.body):ci.blob().then(ai)}(Dt,ci=>{const ai=new C.Response(ci,Tt);en(),yt&&yt.then(Ti=>Ti.put($t(xt.url),ai)).catch(Ti=>Ct(Ti.message))}))}(E,be,De),L=!0,g(null,Ze,_e.headers.get("Cache-Control"),_e.headers.get("Expires")))}).catch(Ze=>{k||g(new Error(Ze.message))})};return V?function(_e,be){if(en(),!yt)return be(null);const De=$t(_e.url);yt.then(Ze=>{Ze.match(De).then(xt=>{const Dt=function(_t){if(!_t)return!1;const Tt=new Date(_t.headers.get("Expires")||0),kt=fi(_t.headers.get("Cache-Control")||"");return Tt>Date.now()&&!kt["no-cache"]}(xt);Ze.delete(De),Dt&&Ze.put(De,xt.clone()),be(null,xt,Dt)}).catch(be)}).catch(be)}(E,se):se(null,null),{cancel:()=>{k=!0,L||v.abort()}}}(s,n);if(mi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",s,n,void 0,!0)}var o;return function(d,g){const v=new C.XMLHttpRequest;v.open(d.method||"GET",d.url,!0),d.type==="arrayBuffer"&&(v.responseType="arraybuffer");for(const E in d.headers)v.setRequestHeader(E,d.headers[E]);return d.type==="json"&&(v.responseType="text",v.setRequestHeader("Accept","application/json")),v.withCredentials=d.credentials==="include",v.onerror=()=>{g(new Error(v.statusText))},v.onload=()=>{if((v.status>=200&&v.status<300||v.status===0)&&v.response!==null){let E=v.response;if(d.type==="json")try{E=JSON.parse(v.response)}catch(L){return g(L)}g(null,E,v.getResponseHeader("Cache-Control"),v.getResponseHeader("Expires"))}else g(new hn(v.statusText,v.status,d.url))},v.send(d.body),{cancel:()=>v.abort()}}(s,n)},Cn=function(s,n){return on(Ve(s,{type:"arrayBuffer"}),n)};function Tn(s){const n=C.document.createElement("a");return n.href=s,n.protocol===C.document.location.protocol&&n.host===C.document.location.host}const nr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Ii,bn;Ii=[],bn=0;const Ot=function(s,n){if(R.supported&&(s.headers||(s.headers={}),s.headers.accept="image/webp,*/*"),bn>=N.MAX_PARALLEL_IMAGE_REQUESTS){const v={requestParameters:s,callback:n,cancelled:!1,cancel(){this.cancelled=!0}};return Ii.push(v),v}bn++;let o=!1;const d=()=>{if(!o)for(o=!0,bn--;Ii.length&&bn<N.MAX_PARALLEL_IMAGE_REQUESTS;){const v=Ii.shift(),{requestParameters:E,callback:L,cancelled:k}=v;k||(v.cancel=Ot(E,L).cancel)}},g=Cn(s,(v,E,L,k)=>{d(),v?n(v):E&&(C.createImageBitmap?function(V,q){const se=new C.Blob([new Uint8Array(V)],{type:"image/png"});C.createImageBitmap(se).then(he=>{q(null,he)}).catch(he=>{q(new Error(`Could not load image because of ${he.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(E,(V,q)=>n(V,q,L,k)):function(V,q){const se=new C.Image,he=C.URL;se.onload=()=>{q(null,se),he.revokeObjectURL(se.src),se.onload=null,C.requestAnimationFrame(()=>{se.src=nr})},se.onerror=()=>q(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const _e=new C.Blob([new Uint8Array(V)],{type:"image/png"});se.src=V.byteLength?he.createObjectURL(_e):nr}(E,(V,q)=>n(V,q,L,k)))});return{cancel:()=>{g.cancel(),d()}}},vi="NO_ACCESS_TOKEN";function Wi(s){return s.indexOf("mapbox:")===0}function Ui(s){return N.API_URL_REGEX.test(s)}function Pn(s){return N.API_CDN_URL_REGEX.test(s)}function qn(s){return N.API_STYLE_REGEX.test(s)&&!Hr(s)}function Hr(s){return N.API_SPRITE_REGEX.test(s)}const fr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function kr(s){const n=s.match(fr);if(!n)throw new Error("Unable to parse URL object");return{protocol:n[1],authority:n[2],path:n[3]||"/",params:n[4]?n[4].split("&"):[]}}function Qn(s){const n=s.params.length?`?${s.params.join("&")}`:"";return`${s.protocol}://${s.authority}${s.path}${n}`}function zs(s){if(!s)return null;const n=s.split(".");if(!n||n.length!==3)return null;try{return JSON.parse(decodeURIComponent(C.atob(n[1]).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class ot{constructor(n){this.type=n,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(n){const o=zs(N.ACCESS_TOKEN);let d="";return d=o&&o.u?C.btoa(encodeURIComponent(o.u).replace(/%([0-9A-F]{2})/g,(g,v)=>String.fromCharCode(Number("0x"+v)))):N.ACCESS_TOKEN||"",n?`mapbox.eventData.${n}:${d}`:`mapbox.eventData:${d}`}fetchEventData(){const n=Qi("localStorage"),o=this.getStorageKey(),d=this.getStorageKey("uuid");if(n)try{const g=C.localStorage.getItem(o);g&&(this.eventData=JSON.parse(g));const v=C.localStorage.getItem(d);v&&(this.anonId=v)}catch{Ct("Unable to read from LocalStorage")}}saveEventData(){const n=Qi("localStorage"),o=this.getStorageKey(),d=this.getStorageKey("uuid");if(n)try{C.localStorage.setItem(d,this.anonId),Object.keys(this.eventData).length>=1&&C.localStorage.setItem(o,JSON.stringify(this.eventData))}catch{Ct("Unable to write to LocalStorage")}}processRequests(n){}postEvent(n,o,d,g){if(!N.EVENTS_URL)return;const v=kr(N.EVENTS_URL);v.params.push(`access_token=${g||N.ACCESS_TOKEN||""}`);const E={event:this.type,created:new Date(n).toISOString()},L=o?Ve(E,o):E,k={url:Qn(v),headers:{"Content-Type":"text/plain"},body:JSON.stringify([L])};this.pendingRequest=function(V,q){return on(Ve(V,{method:"POST"}),q)}(k,V=>{this.pendingRequest=null,d(V),this.saveEventData(),this.processRequests(g)})}queueRequest(n,o){this.queue.push(n),this.processRequests(o)}}const Ee=new class extends ot{constructor(s){super("appUserTurnstile"),this._customAccessToken=s}postTurnstileEvent(s,n){N.EVENTS_URL&&N.ACCESS_TOKEN&&Array.isArray(s)&&s.some(o=>Wi(o)||Ui(o))&&this.queueRequest(Date.now(),n)}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const n=zs(N.ACCESS_TOKEN),o=n?n.u:N.ACCESS_TOKEN;let d=o!==this.eventData.tokenU;vt(this.anonId)||(this.anonId=qe(),d=!0);const g=this.queue.shift();if(this.eventData.lastSuccess){const v=new Date(this.eventData.lastSuccess),E=new Date(g),L=(g-this.eventData.lastSuccess)/864e5;d=d||L>=1||L<-1||v.getDate()!==E.getDate()}else d=!0;d?this.postEvent(g,{sdkIdentifier:"mapbox-gl-js",sdkVersion:D,skuId:le,"enabled.telemetry":!1,userId:this.anonId},v=>{v||(this.eventData.lastSuccess=g,this.eventData.tokenU=o)},s):this.processRequests()}},Ue=Ee.postTurnstileEvent.bind(Ee),ct=new class extends ot{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(s,n,o,d){this.skuToken=n,this.errorCb=d,N.EVENTS_URL&&(o||N.ACCESS_TOKEN?this.queueRequest({id:s,timestamp:Date.now()},o):this.errorCb(new Error(vi)))}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{id:n,timestamp:o}=this.queue.shift();n&&this.success[n]||(this.anonId||this.fetchEventData(),vt(this.anonId)||(this.anonId=qe()),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:D,skuId:le,skuToken:this.skuToken,userId:this.anonId},d=>{d?this.errorCb(d):n&&(this.success[n]=!0)},s))}},wt=ct.postMapLoadEvent.bind(ct),X=new class extends ot{constructor(){super("gljs.performance")}postPerformanceEvent(s,n){N.EVENTS_URL&&(s||N.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:n},s)}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:n,performanceData:o}=this.queue.shift(),d=function(g){const v=C.performance.getEntriesByType("resource"),E=C.performance.getEntriesByType("mark"),L=function(he){const _e={};if(he){for(const be in he)if(be!=="other")for(const De of he[be]){const Ze=`${be}ResolveRangeMin`,xt=`${be}ResolveRangeMax`,Dt=`${be}RequestCount`,_t=`${be}RequestCachedCount`;_e[Ze]=Math.min(_e[Ze]||1/0,De.startTime),_e[xt]=Math.max(_e[xt]||-1/0,De.responseEnd);const Tt=kt=>{_e[kt]===void 0&&(_e[kt]=0),++_e[kt]};De.transferSize!==void 0&&De.transferSize===0&&Tt(_t),Tt(Dt)}}return _e}(function(he,_e){const be={};if(he)for(const De of he){const Ze=_e(De);be[Ze]===void 0&&(be[Ze]=[]),be[Ze].push(De)}return be}(v,He)),k=C.devicePixelRatio,V=C.navigator.connection||C.navigator.mozConnection||C.navigator.webkitConnection,q={counters:[],metadata:[],attributes:[]},se=(he,_e,be)=>{be!=null&&he.push({name:_e,value:be.toString()})};for(const he in L)se(q.counters,he,L[he]);if(g.interactionRange[0]!==1/0&&g.interactionRange[1]!==-1/0&&(se(q.counters,"interactionRangeMin",g.interactionRange[0]),se(q.counters,"interactionRangeMax",g.interactionRange[1])),E)for(const he of Object.keys(Re)){const _e=Re[he],be=E.find(De=>De.name===_e);be&&se(q.counters,_e,be.startTime)}return se(q.counters,"visibilityHidden",g.visibilityHidden),se(q.attributes,"style",function(he){if(he)for(const _e of he){const be=_e.name.split("?")[0];if(qn(be)){const De=be.split("/").slice(-2);if(De.length===2)return`mapbox://styles/${De[0]}/${De[1]}`}}}(v)),se(q.attributes,"terrainEnabled",g.terrainEnabled?"true":"false"),se(q.attributes,"fogEnabled",g.fogEnabled?"true":"false"),se(q.attributes,"projection",g.projection),se(q.attributes,"zoom",g.zoom),se(q.metadata,"devicePixelRatio",k),se(q.metadata,"connectionEffectiveType",V?V.effectiveType:void 0),se(q.metadata,"navigatorUserAgent",C.navigator.userAgent),se(q.metadata,"screenWidth",C.screen.width),se(q.metadata,"screenHeight",C.screen.height),se(q.metadata,"windowWidth",C.innerWidth),se(q.metadata,"windowHeight",C.innerHeight),se(q.metadata,"mapWidth",g.width/k),se(q.metadata,"mapHeight",g.height/k),se(q.metadata,"webglRenderer",g.renderer),se(q.metadata,"webglVendor",g.vendor),se(q.metadata,"sdkVersion",D),se(q.metadata,"sdkIdentifier","mapbox-gl-js"),q}(o);for(const g of d.metadata);for(const g of d.counters);for(const g of d.attributes);this.postEvent(n,d,()=>{},s)}},j=X.postPerformanceEvent.bind(X),ie=new class extends ot{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(s,n,o,d){if(!N.API_URL||!N.SESSION_PATH)return;const g=kr(N.API_URL+N.SESSION_PATH);g.params.push(`sku=${n||""}`),g.params.push(`access_token=${d||N.ACCESS_TOKEN||""}`);const v={url:Qn(g),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(E,L){return on(Ve(E,{method:"GET"}),L)}(v,E=>{this.pendingRequest=null,o(E),this.saveEventData(),this.processRequests(d)})}getSessionAPI(s,n,o,d){this.skuToken=n,this.errorCb=d,N.SESSION_PATH&&N.API_URL&&(o||N.ACCESS_TOKEN?this.queueRequest({id:s,timestamp:Date.now()},o):this.errorCb(new Error(vi)))}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{id:n,timestamp:o}=this.queue.shift();n&&this.success[n]||this.getSession(o,this.skuToken,d=>{d?this.errorCb(d):n&&(this.success[n]=!0)},s)}},ne=ie.getSessionAPI.bind(ie),de=new Set,Re={create:"create",load:"load",fullLoad:"fullLoad"},tt={mark(s){C.performance.mark(s)},measure(s,n,o){C.performance.measure(s,n,o)}};function He(s){const n=s.name.split("?")[0];return Pn(n)&&n.includes("mapbox-gl.js")?"javascript":Pn(n)&&n.includes("mapbox-gl.css")?"css":function(o){return N.API_FONTS_REGEX.test(o)}(n)?"fontRange":Hr(n)?"sprite":qn(n)?"style":function(o){return N.API_TILEJSON_REGEX.test(o)}(n)?"tilejson":"other"}const Je=C.performance;function pt(s){const n=s?s.url.toString():void 0;return Je.getEntriesByName(n)}let Lt,jt,Gt,ki;const wi={now:()=>Gt!==void 0?Gt:C.performance.now(),setNow(s){Gt=s},restoreNow(){Gt=void 0},frame(s){const n=C.requestAnimationFrame(s);return{cancel:()=>C.cancelAnimationFrame(n)}},getImageData(s,n=0){const{width:o,height:d}=s;ki||(ki=C.document.createElement("canvas"));const g=ki.getContext("2d",{willReadFrequently:!0});if(!g)throw new Error("failed to create canvas 2d context");return(o>ki.width||d>ki.height)&&(ki.width=o,ki.height=d),g.clearRect(-n,-n,o+2*n,d+2*n),g.drawImage(s,0,0,o,d),g.getImageData(-n,-n,o+2*n,d+2*n)},resolveURL:s=>(Lt||(Lt=C.document.createElement("a")),Lt.href=s,Lt.href),get devicePixelRatio(){return C.devicePixelRatio},get prefersReducedMotion(){return!!C.matchMedia&&(jt==null&&(jt=C.matchMedia("(prefers-reduced-motion: reduce)")),jt.matches)}};function Oi(s,n,o){o[s]&&o[s].indexOf(n)!==-1||(o[s]=o[s]||[],o[s].push(n))}function Yi(s,n,o){if(o&&o[s]){const d=o[s].indexOf(n);d!==-1&&o[s].splice(d,1)}}class tn{constructor(n,o={}){Ve(this,o),this.type=n}}class rr extends tn{constructor(n,o={}){super("error",Ve({error:n},o))}}class yn{on(n,o){return this._listeners=this._listeners||{},Oi(n,o,this._listeners),this}off(n,o){return Yi(n,o,this._listeners),Yi(n,o,this._oneTimeListeners),this}once(n,o){return o?(this._oneTimeListeners=this._oneTimeListeners||{},Oi(n,o,this._oneTimeListeners),this):new Promise(d=>this.once(n,d))}fire(n,o){typeof n=="string"&&(n=new tn(n,o||{}));const d=n.type;if(this.listens(d)){n.target=this;const g=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const L of g)L.call(this,n);const v=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const L of v)Yi(d,L,this._oneTimeListeners),L.call(this,n);const E=this._eventedParent;E&&(Ve(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),E.fire(n))}else n instanceof rr&&console.error(n.error);return this}listens(n){return!!(this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n))}setEventedParent(n,o){return this._eventedParent=n,this._eventedParentData=o,this}}var Yt=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function sr(s,...n){for(const o of n)for(const d in o)s[d]=o[d];return s}function Yn(s){return s instanceof Number||s instanceof String||s instanceof Boolean?s.valueOf():s}function Wr(s){if(Array.isArray(s))return s.map(Wr);if(s instanceof Object&&!(s instanceof Number||s instanceof String||s instanceof Boolean)){const n={};for(const o in s)n[o]=Wr(s[o]);return n}return Yn(s)}class mr extends Error{constructor(n,o){super(o),this.message=o,this.key=n}}var Mr=mr;class Oo{constructor(n,o=[]){this.parent=n,this.bindings={};for(const[d,g]of o)this.bindings[d]=g}concat(n){return new Oo(this,n)}get(n){if(this.bindings[n])return this.bindings[n];if(this.parent)return this.parent.get(n);throw new Error(`${n} not found in scope.`)}has(n){return!!this.bindings[n]||!!this.parent&&this.parent.has(n)}}var ks=Oo;const or={kind:"null"},rn={kind:"number"},cr={kind:"string"},Ar={kind:"boolean"},la={kind:"color"},al={kind:"object"},dr={kind:"value"},Ul={kind:"collator"},Rl={kind:"formatted"},ll={kind:"resolvedImage"};function qs(s,n){return{kind:"array",itemType:s,N:n}}function hs(s){if(s.kind==="array"){const n=hs(s.itemType);return typeof s.N=="number"?`array<${n}, ${s.N}>`:s.itemType.kind==="value"?"array":`array<${n}>`}return s.kind}const ho=[or,rn,cr,Ar,la,Rl,al,qs(dr),ll];function cl(s,n){if(n.kind==="error")return null;if(s.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!cl(s.itemType,n.itemType))&&(typeof s.N!="number"||s.N===n.N))return null}else{if(s.kind===n.kind)return null;if(s.kind==="value"){for(const o of ho)if(!cl(o,n))return null}}return`Expected ${hs(s)} but found ${hs(n)} instead.`}function Na(s,n){return n.some(o=>o.kind===s.kind)}function zl(s,n){return n.some(o=>o==="null"?s===null:o==="array"?Array.isArray(s):o==="object"?s&&!Array.isArray(s)&&typeof s=="object":o===typeof s)}var kl,Ol={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Qa(s){return(s=Math.round(s))<0?0:s>255?255:s}function Nl(s){return Qa(s[s.length-1]==="%"?parseFloat(s)/100*255:parseInt(s))}function Ql(s){return(n=s[s.length-1]==="%"?parseFloat(s)/100:parseFloat(s))<0?0:n>1?1:n;var n}function ns(s,n,o){return o<0?o+=1:o>1&&(o-=1),6*o<1?s+(n-s)*o*6:2*o<1?n:3*o<2?s+(n-s)*(2/3-o)*6:s}try{kl={}.parseCSSColor=function(s){var n,o=s.replace(/ /g,"").toLowerCase();if(o in Ol)return Ol[o].slice();if(o[0]==="#")return o.length===4?(n=parseInt(o.substr(1),16))>=0&&n<=4095?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null:o.length===7&&(n=parseInt(o.substr(1),16))>=0&&n<=16777215?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null;var d=o.indexOf("("),g=o.indexOf(")");if(d!==-1&&g+1===o.length){var v=o.substr(0,d),E=o.substr(d+1,g-(d+1)).split(","),L=1;switch(v){case"rgba":if(E.length!==4)return null;L=Ql(E.pop());case"rgb":return E.length!==3?null:[Nl(E[0]),Nl(E[1]),Nl(E[2]),L];case"hsla":if(E.length!==4)return null;L=Ql(E.pop());case"hsl":if(E.length!==3)return null;var k=(parseFloat(E[0])%360+360)%360/360,V=Ql(E[1]),q=Ql(E[2]),se=q<=.5?q*(V+1):q+V-q*V,he=2*q-se;return[Qa(255*ns(he,se,k+1/3)),Qa(255*ns(he,se,k)),Qa(255*ns(he,se,k-1/3)),L];default:return null}}return null}}catch{}class Ys{constructor(n,o,d,g=1){this.r=n,this.g=o,this.b=d,this.a=g}static parse(n){if(!n)return;if(n instanceof Ys)return n;if(typeof n!="string")return;const o=kl(n);return o?new Ys(o[0]/255*o[3],o[1]/255*o[3],o[2]/255*o[3],o[3]):void 0}toString(){const[n,o,d,g]=this.toArray();return`rgba(${Math.round(n)},${Math.round(o)},${Math.round(d)},${g})`}toArray(){const{r:n,g:o,b:d,a:g}=this;return g===0?[0,0,0,0]:[255*n/g,255*o/g,255*d/g,g]}toArray01(){const{r:n,g:o,b:d,a:g}=this;return g===0?[0,0,0,0]:[n/g,o/g,d/g,g]}toArray01PremultipliedAlpha(){const{r:n,g:o,b:d,a:g}=this;return[n,o,d,g]}}Ys.black=new Ys(0,0,0,1),Ys.white=new Ys(1,1,1,1),Ys.transparent=new Ys(0,0,0,0),Ys.red=new Ys(1,0,0,1),Ys.blue=new Ys(0,0,1,1);var fs=Ys;class Rc{constructor(n,o,d){this.sensitivity=n?o?"variant":"case":o?"accent":"base",this.locale=d,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,o){return this.collator.compare(n,o)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Eh{constructor(n,o,d,g,v){this.text=n.normalize?n.normalize():n,this.image=o,this.scale=d,this.fontStack=g,this.textColor=v}}class Os{constructor(n){this.sections=n}static fromString(n){return new Os([new Eh(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof Os?n:Os.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}serialize(){const n=["format"];for(const o of this.sections){if(o.image){n.push(["image",o.image.name]);continue}n.push(o.text);const d={};o.fontStack&&(d["text-font"]=["literal",o.fontStack.split(",")]),o.scale&&(d["font-scale"]=o.scale),o.textColor&&(d["text-color"]=["rgba"].concat(o.textColor.toArray())),n.push(d)}return n}}class No{constructor(n){this.name=n.name,this.available=n.available}toString(){return this.name}static fromString(n){return n?new No({name:n,available:!1}):null}serialize(){return["image",this.name]}}function ed(s,n,o,d){return typeof s=="number"&&s>=0&&s<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof o=="number"&&o>=0&&o<=255?d===void 0||typeof d=="number"&&d>=0&&d<=1?null:`Invalid rgba value [${[s,n,o,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[s,n,o,d]:[s,n,o]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function pu(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof fs||s instanceof Rc||s instanceof Os||s instanceof No)return!0;if(Array.isArray(s)){for(const n of s)if(!pu(n))return!1;return!0}if(typeof s=="object"){for(const n in s)if(!pu(s[n]))return!1;return!0}return!1}function Cs(s){if(s===null)return or;if(typeof s=="string")return cr;if(typeof s=="boolean")return Ar;if(typeof s=="number")return rn;if(s instanceof fs)return la;if(s instanceof Rc)return Ul;if(s instanceof Os)return Rl;if(s instanceof No)return ll;if(Array.isArray(s)){const n=s.length;let o;for(const d of s){const g=Cs(d);if(o){if(o===g)continue;o=dr;break}o=g}return qs(o||dr,n)}return al}function rc(s){const n=typeof s;return s===null?"":n==="string"||n==="number"||n==="boolean"?String(s):s instanceof fs||s instanceof Os||s instanceof No?s.toString():JSON.stringify(s)}class Th{constructor(n,o){this.type=n,this.value=o}static parse(n,o){if(n.length!==2)return o.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!pu(n[1]))return o.error("invalid value");const d=n[1];let g=Cs(d);const v=o.expectedType;return g.kind!=="array"||g.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(g=v),new Th(g,d)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof fs?["rgba"].concat(this.value.toArray()):this.value instanceof Os?this.value.serialize():this.value}}var sc=Th,er=class{constructor(s){this.name="ExpressionEvaluationError",this.message=s}toJSON(){return this.message}};const oc={string:cr,number:rn,boolean:Ar,object:al};class Ju{constructor(n,o){this.type=n,this.args=o}static parse(n,o){if(n.length<2)return o.error("Expected at least one argument.");let d,g=1;const v=n[0];if(v==="array"){let L,k;if(n.length>2){const V=n[1];if(typeof V!="string"||!(V in oc)||V==="object")return o.error('The item type argument of "array" must be one of string, number, boolean',1);L=oc[V],g++}else L=dr;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return o.error('The length argument to "array" must be a positive integer literal',2);k=n[2],g++}d=qs(L,k)}else d=oc[v];const E=[];for(;g<n.length;g++){const L=o.parse(n[g],g,dr);if(!L)return null;E.push(L)}return new Ju(d,E)}evaluate(n){for(let o=0;o<this.args.length;o++){const d=this.args[o].evaluate(n);if(!cl(this.type,Cs(d)))return d;if(o===this.args.length-1)throw new er(`Expected value to be of type ${hs(this.type)}, but found ${hs(Cs(d))} instead.`)}return null}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}serialize(){const n=this.type,o=[n.kind];if(n.kind==="array"){const d=n.itemType;if(d.kind==="string"||d.kind==="number"||d.kind==="boolean"){o.push(d.kind);const g=n.N;(typeof g=="number"||this.args.length>1)&&o.push(g)}}return o.concat(this.args.map(d=>d.serialize()))}}var Qo=Ju;class hl{constructor(n){this.type=Rl,this.sections=n}static parse(n,o){if(n.length<2)return o.error("Expected at least one argument.");const d=n[1];if(!Array.isArray(d)&&typeof d=="object")return o.error("First argument must be an image or text section.");const g=[];let v=!1;for(let E=1;E<=n.length-1;++E){const L=n[E];if(v&&typeof L=="object"&&!Array.isArray(L)){v=!1;let k=null;if(L["font-scale"]&&(k=o.parse(L["font-scale"],1,rn),!k))return null;let V=null;if(L["text-font"]&&(V=o.parse(L["text-font"],1,qs(cr)),!V))return null;let q=null;if(L["text-color"]&&(q=o.parse(L["text-color"],1,la),!q))return null;const se=g[g.length-1];se.scale=k,se.font=V,se.textColor=q}else{const k=o.parse(n[E],1,dr);if(!k)return null;const V=k.type.kind;if(V!=="string"&&V!=="value"&&V!=="null"&&V!=="resolvedImage")return o.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,g.push({content:k,scale:null,font:null,textColor:null})}}return new hl(g)}evaluate(n){return new Os(this.sections.map(o=>{const d=o.content.evaluate(n);return Cs(d)===ll?new Eh("",d,null,null,null):new Eh(rc(d),null,o.scale?o.scale.evaluate(n):null,o.font?o.font.evaluate(n).join(","):null,o.textColor?o.textColor.evaluate(n):null)}))}eachChild(n){for(const o of this.sections)n(o.content),o.scale&&n(o.scale),o.font&&n(o.font),o.textColor&&n(o.textColor)}outputDefined(){return!1}serialize(){const n=["format"];for(const o of this.sections){n.push(o.content.serialize());const d={};o.scale&&(d["font-scale"]=o.scale.serialize()),o.font&&(d["text-font"]=o.font.serialize()),o.textColor&&(d["text-color"]=o.textColor.serialize()),n.push(d)}return n}}class Sh{constructor(n){this.type=ll,this.input=n}static parse(n,o){if(n.length!==2)return o.error("Expected two arguments.");const d=o.parse(n[1],1,cr);return d?new Sh(d):o.error("No image name provided.")}evaluate(n){const o=this.input.evaluate(n),d=No.fromString(o);return d&&n.availableImages&&(d.available=n.availableImages.indexOf(o)>-1),d}eachChild(n){n(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Vo={"to-boolean":Ar,"to-color":la,"to-number":rn,"to-string":cr};class Mh{constructor(n,o){this.type=n,this.args=o}static parse(n,o){if(n.length<2)return o.error("Expected at least one argument.");const d=n[0];if((d==="to-boolean"||d==="to-string")&&n.length!==2)return o.error("Expected one argument.");const g=Vo[d],v=[];for(let E=1;E<n.length;E++){const L=o.parse(n[E],E,dr);if(!L)return null;v.push(L)}return new Mh(g,v)}evaluate(n){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(n));if(this.type.kind==="color"){let o,d;for(const g of this.args){if(o=g.evaluate(n),d=null,o instanceof fs)return o;if(typeof o=="string"){const v=n.parseColor(o);if(v)return v}else if(Array.isArray(o)&&(d=o.length<3||o.length>4?`Invalid rbga value ${JSON.stringify(o)}: expected an array containing either three or four numeric values.`:ed(o[0],o[1],o[2],o[3]),!d))return new fs(o[0]/255,o[1]/255,o[2]/255,o[3])}throw new er(d||`Could not parse color from value '${typeof o=="string"?o:String(JSON.stringify(o))}'`)}if(this.type.kind==="number"){let o=null;for(const d of this.args){if(o=d.evaluate(n),o===null)return 0;const g=Number(o);if(!isNaN(g))return g}throw new er(`Could not convert ${JSON.stringify(o)} to number.`)}return this.type.kind==="formatted"?Os.fromString(rc(this.args[0].evaluate(n))):this.type.kind==="resolvedImage"?No.fromString(rc(this.args[0].evaluate(n))):rc(this.args[0].evaluate(n))}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}serialize(){if(this.type.kind==="formatted")return new hl([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Sh(this.args[0]).serialize();const n=[`to-${this.type.kind}`];return this.eachChild(o=>{n.push(o.serialize())}),n}}var Va=Mh;const ac=["Unknown","Point","LineString","Polygon"];var fu=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?ac[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const s=this.featureDistanceData.center,n=this.featureDistanceData.scale,{x:o,y:d}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*n-s[0])+this.featureDistanceData.bearing[1]*(d*n-s[1])}return 0}parseColor(s){let n=this._parseColorCache[s];return n||(n=this._parseColorCache[s]=fs.parse(s)),n}};class Vl{constructor(n,o,d,g){this.name=n,this.type=o,this._evaluate=d,this.args=g}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(n=>n.serialize()))}static parse(n,o){const d=n[0],g=Vl.definitions[d];if(!g)return o.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(g)?g[0]:g.type,E=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,L=E.filter(([V])=>!Array.isArray(V)||V.length===n.length-1);let k=null;for(const[V,q]of L){k=new hr(o.registry,o.path,null,o.scope);const se=[];let he=!1;for(let _e=1;_e<n.length;_e++){const be=n[_e],De=Array.isArray(V)?V[_e-1]:V.type,Ze=k.parse(be,1+se.length,De);if(!Ze){he=!0;break}se.push(Ze)}if(!he)if(Array.isArray(V)&&V.length!==se.length)k.error(`Expected ${V.length} arguments, but found ${se.length} instead.`);else{for(let _e=0;_e<se.length;_e++){const be=Array.isArray(V)?V[_e]:V.type,De=se[_e];k.concat(_e+1).checkSubtype(be,De.type)}if(k.errors.length===0)return new Vl(d,v,q,se)}}if(L.length===1)o.errors.push(...k.errors);else{const V=(L.length?L:E).map(([se])=>{return he=se,Array.isArray(he)?`(${he.map(hs).join(", ")})`:`(${hs(he.type)}...)`;var he}).join(" | "),q=[];for(let se=1;se<n.length;se++){const he=o.parse(n[se],1+q.length);if(!he)return null;q.push(hs(he.type))}o.error(`Expected arguments of type ${V}, but found (${q.join(", ")}) instead.`)}return null}static register(n,o){Vl.definitions=o;for(const d in o)n[d]=Vl}}var ya=Vl;class zc{constructor(n,o,d){this.type=Ul,this.locale=d,this.caseSensitive=n,this.diacriticSensitive=o}static parse(n,o){if(n.length!==2)return o.error("Expected one argument.");const d=n[1];if(typeof d!="object"||Array.isArray(d))return o.error("Collator options argument must be an object.");const g=o.parse(d["case-sensitive"]!==void 0&&d["case-sensitive"],1,Ar);if(!g)return null;const v=o.parse(d["diacritic-sensitive"]!==void 0&&d["diacritic-sensitive"],1,Ar);if(!v)return null;let E=null;return d.locale&&(E=o.parse(d.locale,1,cr),!E)?null:new zc(g,v,E)}evaluate(n){return new Rc(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}serialize(){const n={};return n["case-sensitive"]=this.caseSensitive.serialize(),n["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(n.locale=this.locale.serialize()),["collator",n]}}const Ws=8192;function lc(s,n){s[0]=Math.min(s[0],n[0]),s[1]=Math.min(s[1],n[1]),s[2]=Math.max(s[2],n[0]),s[3]=Math.max(s[3],n[1])}function kc(s,n){return!(s[0]<=n[0]||s[2]>=n[2]||s[1]<=n[1]||s[3]>=n[3])}function eA(s,n){const o=(180+s[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,g=Math.pow(2,n.z);return[Math.round(o*g*Ws),Math.round(d*g*Ws)]}function cc(s,n,o){const d=s[0]-n[0],g=s[1]-n[1],v=s[0]-o[0],E=s[1]-o[1];return d*E-v*g==0&&d*v<=0&&g*E<=0}function mu(s,n){let o=!1;for(let E=0,L=n.length;E<L;E++){const k=n[E];for(let V=0,q=k.length;V<q-1;V++){if(cc(s,k[V],k[V+1]))return!1;(g=k[V])[1]>(d=s)[1]!=(v=k[V+1])[1]>d[1]&&d[0]<(v[0]-g[0])*(d[1]-g[1])/(v[1]-g[1])+g[0]&&(o=!o)}}var d,g,v;return o}function td(s,n){for(let o=0;o<n.length;o++)if(mu(s,n[o]))return!0;return!1}function gu(s,n,o,d){const g=d[0]-o[0],v=d[1]-o[1],E=(s[0]-o[0])*v-g*(s[1]-o[1]),L=(n[0]-o[0])*v-g*(n[1]-o[1]);return E>0&&L<0||E<0&&L>0}function Ih(s,n,o){for(const V of o)for(let q=0;q<V.length-1;++q)if((L=[(E=V[q+1])[0]-(v=V[q])[0],E[1]-v[1]])[0]*(k=[(g=n)[0]-(d=s)[0],g[1]-d[1]])[1]-L[1]*k[0]!=0&&gu(d,g,v,E)&&gu(v,E,d,g))return!0;var d,g,v,E,L,k;return!1}function tA(s,n){for(let o=0;o<s.length;++o)if(!mu(s[o],n))return!1;for(let o=0;o<s.length-1;++o)if(Ih(s[o],s[o+1],n))return!1;return!0}function id(s,n){for(let o=0;o<n.length;o++)if(tA(s,n[o]))return!0;return!1}function hc(s,n,o){const d=[];for(let g=0;g<s.length;g++){const v=[];for(let E=0;E<s[g].length;E++){const L=eA(s[g][E],o);lc(n,L),v.push(L)}d.push(v)}return d}function Oc(s,n,o){const d=[];for(let g=0;g<s.length;g++){const v=hc(s[g],n,o);d.push(v)}return d}function ul(s,n,o,d){if(s[0]<o[0]||s[0]>o[2]){const g=.5*d;let v=s[0]-o[0]>g?-d:o[0]-s[0]>g?d:0;v===0&&(v=s[0]-o[2]>g?-d:o[2]-s[0]>g?d:0),s[0]+=v}lc(n,s)}function Ir(s,n,o,d){const g=Math.pow(2,d.z)*Ws,v=[d.x*Ws,d.y*Ws],E=[];if(!s)return E;for(const L of s)for(const k of L){const V=[k.x+v[0],k.y+v[1]];ul(V,n,o,g),E.push(V)}return E}function uc(s,n,o,d){const g=Math.pow(2,d.z)*Ws,v=[d.x*Ws,d.y*Ws],E=[];if(!s)return E;for(const k of s){const V=[];for(const q of k){const se=[q.x+v[0],q.y+v[1]];lc(n,se),V.push(se)}E.push(V)}if(n[2]-n[0]<=g/2){(L=n)[0]=L[1]=1/0,L[2]=L[3]=-1/0;for(const k of E)for(const V of k)ul(V,n,o,g)}var L;return E}class Nc{constructor(n,o){this.type=Ar,this.geojson=n,this.geometries=o}static parse(n,o){if(n.length!==2)return o.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(pu(n[1])){const d=n[1];if(d.type==="FeatureCollection")for(let g=0;g<d.features.length;++g){const v=d.features[g].geometry.type;if(v==="Polygon"||v==="MultiPolygon")return new Nc(d,d.features[g].geometry)}else if(d.type==="Feature"){const g=d.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new Nc(d,d.geometry)}else if(d.type==="Polygon"||d.type==="MultiPolygon")return new Nc(d,d)}return o.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(o,d){const g=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],E=o.canonicalID();if(!E)return!1;if(d.type==="Polygon"){const L=hc(d.coordinates,v,E),k=Ir(o.geometry(),g,v,E);if(!kc(g,v))return!1;for(const V of k)if(!mu(V,L))return!1}if(d.type==="MultiPolygon"){const L=Oc(d.coordinates,v,E),k=Ir(o.geometry(),g,v,E);if(!kc(g,v))return!1;for(const V of k)if(!td(V,L))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(o,d){const g=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],E=o.canonicalID();if(!E)return!1;if(d.type==="Polygon"){const L=hc(d.coordinates,v,E),k=uc(o.geometry(),g,v,E);if(!kc(g,v))return!1;for(const V of k)if(!tA(V,L))return!1}if(d.type==="MultiPolygon"){const L=Oc(d.coordinates,v,E),k=uc(o.geometry(),g,v,E);if(!kc(g,v))return!1;for(const V of k)if(!id(V,L))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var _u=Nc;function Al(s){if(s instanceof ya&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof _u)return!1;let n=!0;return s.eachChild(o=>{n&&!Al(o)&&(n=!1)}),n}function Ha(s){if(s instanceof ya&&s.name==="feature-state")return!1;let n=!0;return s.eachChild(o=>{n&&!Ha(o)&&(n=!1)}),n}function Qc(s,n){if(s instanceof ya&&n.indexOf(s.name)>=0)return!1;let o=!0;return s.eachChild(d=>{o&&!Qc(d,n)&&(o=!1)}),o}class dl{constructor(n,o){this.type=o.type,this.name=n,this.boundExpression=o}static parse(n,o){if(n.length!==2||typeof n[1]!="string")return o.error("'var' expression requires exactly one string literal argument.");const d=n[1];return o.scope.has(d)?new dl(d,o.scope.get(d)):o.error(`Unknown variable "${d}". Make sure "${d}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(n){return this.boundExpression.evaluate(n)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var qr=dl;class Fh{constructor(n,o=[],d,g=new ks,v=[]){this.registry=n,this.path=o,this.key=o.map(E=>`[${E}]`).join(""),this.scope=g,this.errors=v,this.expectedType=d}parse(n,o,d,g,v={}){return o?this.concat(o,d,g)._parse(n,v):this._parse(n,v)}_parse(n,o){function d(g,v,E){return E==="assert"?new Qo(v,[g]):E==="coerce"?new Va(v,[g]):g}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=n[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[g];if(v){let E=v.parse(n,this);if(!E)return null;if(this.expectedType){const L=this.expectedType,k=E.type;if(L.kind!=="string"&&L.kind!=="number"&&L.kind!=="boolean"&&L.kind!=="object"&&L.kind!=="array"||k.kind!=="value")if(L.kind!=="color"&&L.kind!=="formatted"&&L.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string"){if(this.checkSubtype(L,k))return null}else E=d(E,L,o.typeAnnotation||"coerce");else E=d(E,L,o.typeAnnotation||"assert")}if(!(E instanceof sc)&&E.type.kind!=="resolvedImage"&&Br(E)){const L=new fu;try{E=new sc(E.type,E.evaluate(L))}catch(k){return this.error(k.message),null}}return E}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,o,d){const g=typeof n=="number"?this.path.concat(n):this.path,v=d?this.scope.concat(d):this.scope;return new Fh(this.registry,g,o||null,v,this.errors)}error(n,...o){const d=`${this.key}${o.map(g=>`[${g}]`).join("")}`;this.errors.push(new Mr(d,n))}checkSubtype(n,o){const d=cl(n,o);return d&&this.error(d),d}}var hr=Fh;function Br(s){if(s instanceof qr)return Br(s.boundExpression);if(s instanceof ya&&s.name==="error"||s instanceof zc||s instanceof _u)return!1;const n=s instanceof Va||s instanceof Qo;let o=!0;return s.eachChild(d=>{o=n?o&&Br(d):o&&d instanceof sc}),!!o&&Al(s)&&Qc(s,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function jr(s,n){const o=s.length-1;let d,g,v=0,E=o,L=0;for(;v<=E;)if(L=Math.floor((v+E)/2),d=s[L],g=s[L+1],d<=n){if(L===o||n<g)return L;v=L+1}else{if(!(d>n))throw new er("Input is not a number.");E=L-1}return 0}class $r{constructor(n,o,d){this.type=n,this.input=o,this.labels=[],this.outputs=[];for(const[g,v]of d)this.labels.push(g),this.outputs.push(v)}static parse(n,o){if(n.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return o.error("Expected an even number of arguments.");const d=o.parse(n[1],1,rn);if(!d)return null;const g=[];let v=null;o.expectedType&&o.expectedType.kind!=="value"&&(v=o.expectedType);for(let E=1;E<n.length;E+=2){const L=E===1?-1/0:n[E],k=n[E+1],V=E,q=E+1;if(typeof L!="number")return o.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',V);if(g.length&&g[g.length-1][0]>=L)return o.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',V);const se=o.parse(k,q,v);if(!se)return null;v=v||se.type,g.push([L,se])}return new $r(v,d,g)}evaluate(n){const o=this.labels,d=this.outputs;if(o.length===1)return d[0].evaluate(n);const g=this.input.evaluate(n);if(g<=o[0])return d[0].evaluate(n);const v=o.length;return g>=o[v-1]?d[v-1].evaluate(n):d[jr(o,g)].evaluate(n)}eachChild(n){n(this.input);for(const o of this.outputs)n(o)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}serialize(){const n=["step",this.input.serialize()];for(let o=0;o<this.labels.length;o++)o>0&&n.push(this.labels[o]),n.push(this.outputs[o].serialize());return n}}var Hl=$r;function gr(s,n,o){return s*(1-o)+n*o}var yu=Object.freeze({__proto__:null,number:gr,color:function(s,n,o){return new fs(gr(s.r,n.r,o),gr(s.g,n.g,o),gr(s.b,n.b,o),gr(s.a,n.a,o))},array:function(s,n,o){return s.map((d,g)=>gr(d,n[g],o))}});const iA=.95047,nA=1.08883,rA=4/29,Ac=6/29,Vc=3*Ac*Ac,Hc=Math.PI/180,Lh=180/Math.PI;function Gc(s){return s>.008856451679035631?Math.pow(s,1/3):s/Vc+rA}function Dh(s){return s>Ac?s*s*s:Vc*(s-rA)}function Wc(s){return 255*(s<=.0031308?12.92*s:1.055*Math.pow(s,1/2.4)-.055)}function jc(s){return(s/=255)<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function ca(s){const n=jc(s.r),o=jc(s.g),d=jc(s.b),g=Gc((.4124564*n+.3575761*o+.1804375*d)/iA),v=Gc((.2126729*n+.7151522*o+.072175*d)/1);return{l:116*v-16,a:500*(g-v),b:200*(v-Gc((.0193339*n+.119192*o+.9503041*d)/nA)),alpha:s.a}}function sA(s){let n=(s.l+16)/116,o=isNaN(s.a)?n:n+s.a/500,d=isNaN(s.b)?n:n-s.b/200;return n=1*Dh(n),o=iA*Dh(o),d=nA*Dh(d),new fs(Wc(3.2404542*o-1.5371385*n-.4985314*d),Wc(-.969266*o+1.8760108*n+.041556*d),Wc(.0556434*o-.2040259*n+1.0572252*d),s.alpha)}function oA(s,n,o){const d=n-s;return s+o*(d>180||d<-180?d-360*Math.round(d/360):d)}const Kc={forward:ca,reverse:sA,interpolate:function(s,n,o){return{l:gr(s.l,n.l,o),a:gr(s.a,n.a,o),b:gr(s.b,n.b,o),alpha:gr(s.alpha,n.alpha,o)}}},ha={forward:function(s){const{l:n,a:o,b:d}=ca(s),g=Math.atan2(d,o)*Lh;return{h:g<0?g+360:g,c:Math.sqrt(o*o+d*d),l:n,alpha:s.a}},reverse:function(s){const n=s.h*Hc,o=s.c;return sA({l:s.l,a:Math.cos(n)*o,b:Math.sin(n)*o,alpha:s.alpha})},interpolate:function(s,n,o){return{h:oA(s.h,n.h,o),c:gr(s.c,n.c,o),l:gr(s.l,n.l,o),alpha:gr(s.alpha,n.alpha,o)}}};var $c=Object.freeze({__proto__:null,lab:Kc,hcl:ha});class pl{constructor(n,o,d,g,v){this.type=n,this.operator=o,this.interpolation=d,this.input=g,this.labels=[],this.outputs=[];for(const[E,L]of v)this.labels.push(E),this.outputs.push(L)}static interpolationFactor(n,o,d,g){let v=0;if(n.name==="exponential")v=aA(o,n.base,d,g);else if(n.name==="linear")v=aA(o,1,d,g);else if(n.name==="cubic-bezier"){const E=n.controlPoints;v=new Ae(E[0],E[1],E[2],E[3]).solve(aA(o,1,d,g))}return v}static parse(n,o){let[d,g,v,...E]=n;if(!Array.isArray(g)||g.length===0)return o.error("Expected an interpolation type expression.",1);if(g[0]==="linear")g={name:"linear"};else if(g[0]==="exponential"){const V=g[1];if(typeof V!="number")return o.error("Exponential interpolation requires a numeric base.",1,1);g={name:"exponential",base:V}}else{if(g[0]!=="cubic-bezier")return o.error(`Unknown interpolation type ${String(g[0])}`,1,0);{const V=g.slice(1);if(V.length!==4||V.some(q=>typeof q!="number"||q<0||q>1))return o.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:V}}}if(n.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return o.error("Expected an even number of arguments.");if(v=o.parse(v,2,rn),!v)return null;const L=[];let k=null;d==="interpolate-hcl"||d==="interpolate-lab"?k=la:o.expectedType&&o.expectedType.kind!=="value"&&(k=o.expectedType);for(let V=0;V<E.length;V+=2){const q=E[V],se=E[V+1],he=V+3,_e=V+4;if(typeof q!="number")return o.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',he);if(L.length&&L[L.length-1][0]>=q)return o.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',he);const be=o.parse(se,_e,k);if(!be)return null;k=k||be.type,L.push([q,be])}return k.kind==="number"||k.kind==="color"||k.kind==="array"&&k.itemType.kind==="number"&&typeof k.N=="number"?new pl(k,d,g,v,L):o.error(`Type ${hs(k)} is not interpolatable.`)}evaluate(n){const o=this.labels,d=this.outputs;if(o.length===1)return d[0].evaluate(n);const g=this.input.evaluate(n);if(g<=o[0])return d[0].evaluate(n);const v=o.length;if(g>=o[v-1])return d[v-1].evaluate(n);const E=jr(o,g),L=pl.interpolationFactor(this.interpolation,g,o[E],o[E+1]),k=d[E].evaluate(n),V=d[E+1].evaluate(n);return this.operator==="interpolate"?yu[this.type.kind.toLowerCase()](k,V,L):this.operator==="interpolate-hcl"?ha.reverse(ha.interpolate(ha.forward(k),ha.forward(V),L)):Kc.reverse(Kc.interpolate(Kc.forward(k),Kc.forward(V),L))}eachChild(n){n(this.input);for(const o of this.outputs)n(o)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}serialize(){let n;n=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const o=[this.operator,n,this.input.serialize()];for(let d=0;d<this.labels.length;d++)o.push(this.labels[d],this.outputs[d].serialize());return o}}function aA(s,n,o,d){const g=d-o,v=s-o;return g===0?0:n===1?v/g:(Math.pow(n,v)-1)/(Math.pow(n,g)-1)}var Ho=pl;class Ph{constructor(n,o){this.type=n,this.args=o}static parse(n,o){if(n.length<2)return o.error("Expectected at least one argument.");let d=null;const g=o.expectedType;g&&g.kind!=="value"&&(d=g);const v=[];for(const L of n.slice(1)){const k=o.parse(L,1+v.length,d,void 0,{typeAnnotation:"omit"});if(!k)return null;d=d||k.type,v.push(k)}const E=g&&v.some(L=>cl(g,L.type));return new Ph(E?dr:d,v)}evaluate(n){let o,d=null,g=0;for(const v of this.args){if(g++,d=v.evaluate(n),d&&d instanceof No&&!d.available&&(o||(o=d),d=null,g===this.args.length))return o;if(d!==null)break}return d}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}serialize(){const n=["coalesce"];return this.eachChild(o=>{n.push(o.serialize())}),n}}var xu=Ph;class Gl{constructor(n,o){this.type=o.type,this.bindings=[].concat(n),this.result=o}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const o of this.bindings)n(o[1]);n(this.result)}static parse(n,o){if(n.length<4)return o.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const d=[];for(let v=1;v<n.length-1;v+=2){const E=n[v];if(typeof E!="string")return o.error(`Expected string, but found ${typeof E} instead.`,v);if(/[^a-zA-Z0-9_]/.test(E))return o.error("Variable names must contain only alphanumeric characters or '_'.",v);const L=o.parse(n[v+1],v+1);if(!L)return null;d.push([E,L])}const g=o.parse(n[n.length-1],n.length-1,o.expectedType,d);return g?new Gl(d,g):null}outputDefined(){return this.result.outputDefined()}serialize(){const n=["let"];for(const[o,d]of this.bindings)n.push(o,d.serialize());return n.push(this.result.serialize()),n}}var vu=Gl;class Zc{constructor(n,o,d){this.type=n,this.index=o,this.input=d}static parse(n,o){if(n.length!==3)return o.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const d=o.parse(n[1],1,rn),g=o.parse(n[2],2,qs(o.expectedType||dr));return d&&g?new Zc(g.type.itemType,d,g):null}evaluate(n){const o=this.index.evaluate(n),d=this.input.evaluate(n);if(o<0)throw new er(`Array index out of bounds: ${o} < 0.`);if(o>=d.length)throw new er(`Array index out of bounds: ${o} > ${d.length-1}.`);if(o!==Math.floor(o))throw new er(`Array index must be an integer, but found ${o} instead.`);return d[o]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Xc=Zc;class fl{constructor(n,o){this.type=Ar,this.needle=n,this.haystack=o}static parse(n,o){if(n.length!==3)return o.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const d=o.parse(n[1],1,dr),g=o.parse(n[2],2,dr);return d&&g?Na(d.type,[Ar,cr,rn,or,dr])?new fl(d,g):o.error(`Expected first argument to be of type boolean, string, number or null, but found ${hs(d.type)} instead`):null}evaluate(n){const o=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(d==null)return!1;if(!zl(o,["boolean","string","number","null"]))throw new er(`Expected first argument to be of type boolean, string, number or null, but found ${hs(Cs(o))} instead.`);if(!zl(d,["string","array"]))throw new er(`Expected second argument to be of type array or string, but found ${hs(Cs(d))} instead.`);return d.indexOf(o)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var qc=fl;class Uh{constructor(n,o,d){this.type=rn,this.needle=n,this.haystack=o,this.fromIndex=d}static parse(n,o){if(n.length<=2||n.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=o.parse(n[1],1,dr),g=o.parse(n[2],2,dr);if(!d||!g)return null;if(!Na(d.type,[Ar,cr,rn,or,dr]))return o.error(`Expected first argument to be of type boolean, string, number or null, but found ${hs(d.type)} instead`);if(n.length===4){const v=o.parse(n[3],3,rn);return v?new Uh(d,g,v):null}return new Uh(d,g)}evaluate(n){const o=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!zl(o,["boolean","string","number","null"]))throw new er(`Expected first argument to be of type boolean, string, number or null, but found ${hs(Cs(o))} instead.`);if(!zl(d,["string","array"]))throw new er(`Expected second argument to be of type array or string, but found ${hs(Cs(d))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(n);return d.indexOf(o,g)}return d.indexOf(o)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const n=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),n]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Rh=Uh;class wu{constructor(n,o,d,g,v,E){this.inputType=n,this.type=o,this.input=d,this.cases=g,this.outputs=v,this.otherwise=E}static parse(n,o){if(n.length<5)return o.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return o.error("Expected an even number of arguments.");let d,g;o.expectedType&&o.expectedType.kind!=="value"&&(g=o.expectedType);const v={},E=[];for(let V=2;V<n.length-1;V+=2){let q=n[V];const se=n[V+1];Array.isArray(q)||(q=[q]);const he=o.concat(V);if(q.length===0)return he.error("Expected at least one branch label.");for(const be of q){if(typeof be!="number"&&typeof be!="string")return he.error("Branch labels must be numbers or strings.");if(typeof be=="number"&&Math.abs(be)>Number.MAX_SAFE_INTEGER)return he.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof be=="number"&&Math.floor(be)!==be)return he.error("Numeric branch labels must be integer values.");if(d){if(he.checkSubtype(d,Cs(be)))return null}else d=Cs(be);if(v[String(be)]!==void 0)return he.error("Branch labels must be unique.");v[String(be)]=E.length}const _e=o.parse(se,V,g);if(!_e)return null;g=g||_e.type,E.push(_e)}const L=o.parse(n[1],1,dr);if(!L)return null;const k=o.parse(n[n.length-1],n.length-1,g);return k?L.type.kind!=="value"&&o.concat(1).checkSubtype(d,L.type)?null:new wu(d,g,L,v,E,k):null}evaluate(n){const o=this.input.evaluate(n);return(Cs(o)===this.inputType&&this.outputs[this.cases[o]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}serialize(){const n=["match",this.input.serialize()],o=Object.keys(this.cases).sort(),d=[],g={};for(const E of o){const L=g[this.cases[E]];L===void 0?(g[this.cases[E]]=d.length,d.push([this.cases[E],[E]])):d[L][1].push(E)}const v=E=>this.inputType.kind==="number"?Number(E):E;for(const[E,L]of d)n.push(L.length===1?v(L[0]):L.map(v)),n.push(this.outputs[E].serialize());return n.push(this.otherwise.serialize()),n}}var nd=wu;class dc{constructor(n,o,d){this.type=n,this.branches=o,this.otherwise=d}static parse(n,o){if(n.length<4)return o.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return o.error("Expected an odd number of arguments.");let d;o.expectedType&&o.expectedType.kind!=="value"&&(d=o.expectedType);const g=[];for(let E=1;E<n.length-1;E+=2){const L=o.parse(n[E],E,Ar);if(!L)return null;const k=o.parse(n[E+1],E+1,d);if(!k)return null;g.push([L,k]),d=d||k.type}const v=o.parse(n[n.length-1],n.length-1,d);return v?new dc(d,g,v):null}evaluate(n){for(const[o,d]of this.branches)if(o.evaluate(n))return d.evaluate(n);return this.otherwise.evaluate(n)}eachChild(n){for(const[o,d]of this.branches)n(o),n(d);n(this.otherwise)}outputDefined(){return this.branches.every(([n,o])=>o.outputDefined())&&this.otherwise.outputDefined()}serialize(){const n=["case"];return this.eachChild(o=>{n.push(o.serialize())}),n}}var pc=dc;class Yc{constructor(n,o,d,g){this.type=n,this.input=o,this.beginIndex=d,this.endIndex=g}static parse(n,o){if(n.length<=2||n.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=o.parse(n[1],1,dr),g=o.parse(n[2],2,rn);if(!d||!g)return null;if(!Na(d.type,[qs(dr),cr,dr]))return o.error(`Expected first argument to be of type array or string, but found ${hs(d.type)} instead`);if(n.length===4){const v=o.parse(n[3],3,rn);return v?new Yc(d.type,d,g,v):null}return new Yc(d.type,d,g)}evaluate(n){const o=this.input.evaluate(n),d=this.beginIndex.evaluate(n);if(!zl(o,["string","array"]))throw new er(`Expected first argument to be of type array or string, but found ${hs(Cs(o))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(n);return o.slice(d,g)}return o.slice(d)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const n=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),n]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var zh=Yc;function Jc(s,n){return s==="=="||s==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function So(s,n,o,d){return d.compare(n,o)===0}function xa(s,n,o){const d=s!=="=="&&s!=="!=";return class PF{constructor(v,E,L){this.type=Ar,this.lhs=v,this.rhs=E,this.collator=L,this.hasUntypedArgument=v.type.kind==="value"||E.type.kind==="value"}static parse(v,E){if(v.length!==3&&v.length!==4)return E.error("Expected two or three arguments.");const L=v[0];let k=E.parse(v[1],1,dr);if(!k)return null;if(!Jc(L,k.type))return E.concat(1).error(`"${L}" comparisons are not supported for type '${hs(k.type)}'.`);let V=E.parse(v[2],2,dr);if(!V)return null;if(!Jc(L,V.type))return E.concat(2).error(`"${L}" comparisons are not supported for type '${hs(V.type)}'.`);if(k.type.kind!==V.type.kind&&k.type.kind!=="value"&&V.type.kind!=="value")return E.error(`Cannot compare types '${hs(k.type)}' and '${hs(V.type)}'.`);d&&(k.type.kind==="value"&&V.type.kind!=="value"?k=new Qo(V.type,[k]):k.type.kind!=="value"&&V.type.kind==="value"&&(V=new Qo(k.type,[V])));let q=null;if(v.length===4){if(k.type.kind!=="string"&&V.type.kind!=="string"&&k.type.kind!=="value"&&V.type.kind!=="value")return E.error("Cannot use collator to compare non-string types.");if(q=E.parse(v[3],3,Ul),!q)return null}return new PF(k,V,q)}evaluate(v){const E=this.lhs.evaluate(v),L=this.rhs.evaluate(v);if(d&&this.hasUntypedArgument){const k=Cs(E),V=Cs(L);if(k.kind!==V.kind||k.kind!=="string"&&k.kind!=="number")throw new er(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${k.kind}, ${V.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=Cs(E),V=Cs(L);if(k.kind!=="string"||V.kind!=="string")return n(v,E,L)}return this.collator?o(v,E,L,this.collator.evaluate(v)):n(v,E,L)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}serialize(){const v=[s];return this.eachChild(E=>{v.push(E.serialize())}),v}}}const Mo=xa("==",function(s,n,o){return n===o},So),rd=xa("!=",function(s,n,o){return n!==o},function(s,n,o,d){return!So(0,n,o,d)}),Ga=xa("<",function(s,n,o){return n<o},function(s,n,o,d){return d.compare(n,o)<0}),sd=xa(">",function(s,n,o){return n>o},function(s,n,o,d){return d.compare(n,o)>0}),ml=xa("<=",function(s,n,o){return n<=o},function(s,n,o,d){return d.compare(n,o)<=0}),kh=xa(">=",function(s,n,o){return n>=o},function(s,n,o,d){return d.compare(n,o)>=0});class Oh{constructor(n,o,d,g,v,E){this.type=cr,this.number=n,this.locale=o,this.currency=d,this.unit=g,this.minFractionDigits=v,this.maxFractionDigits=E}static parse(n,o){if(n.length!==3)return o.error("Expected two arguments.");const d=o.parse(n[1],1,rn);if(!d)return null;const g=n[2];if(typeof g!="object"||Array.isArray(g))return o.error("NumberFormat options argument must be an object.");let v=null;if(g.locale&&(v=o.parse(g.locale,1,cr),!v))return null;let E=null;if(g.currency&&(E=o.parse(g.currency,1,cr),!E))return null;let L=null;if(g.unit&&(L=o.parse(g.unit,1,cr),!L))return null;let k=null;if(g["min-fraction-digits"]&&(k=o.parse(g["min-fraction-digits"],1,rn),!k))return null;let V=null;return g["max-fraction-digits"]&&(V=o.parse(g["max-fraction-digits"],1,rn),!V)?null:new Oh(d,v,E,L,k,V)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(n):void 0,unit:this.unit?this.unit.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.unit&&n(this.unit),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const n={};return this.locale&&(n.locale=this.locale.serialize()),this.currency&&(n.currency=this.currency.serialize()),this.unit&&(n.unit=this.unit.serialize()),this.minFractionDigits&&(n["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(n["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),n]}}class lA{constructor(n){this.type=rn,this.input=n}static parse(n,o){if(n.length!==2)return o.error(`Expected 1 argument, but found ${n.length-1} instead.`);const d=o.parse(n[1],1);return d?d.type.kind!=="array"&&d.type.kind!=="string"&&d.type.kind!=="value"?o.error(`Expected argument of type string or array, but found ${hs(d.type)} instead.`):new lA(d):null}evaluate(n){const o=this.input.evaluate(n);if(typeof o=="string"||Array.isArray(o))return o.length;throw new er(`Expected value to be of type string or array, but found ${hs(Cs(o))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}serialize(){const n=["length"];return this.eachChild(o=>{n.push(o.serialize())}),n}}const od={"==":Mo,"!=":rd,">":sd,"<":Ga,">=":kh,"<=":ml,array:Qo,at:Xc,boolean:Qo,case:pc,coalesce:xu,collator:zc,format:hl,image:Sh,in:qc,"index-of":Rh,interpolate:Ho,"interpolate-hcl":Ho,"interpolate-lab":Ho,length:lA,let:vu,literal:sc,match:nd,number:Qo,"number-format":Oh,object:Qo,slice:zh,step:Hl,string:Qo,"to-boolean":Va,"to-color":Va,"to-number":Va,"to-string":Va,var:qr,within:_u};function Nh(s,[n,o,d,g]){n=n.evaluate(s),o=o.evaluate(s),d=d.evaluate(s);const v=g?g.evaluate(s):1,E=ed(n,o,d,v);if(E)throw new er(E);return new fs(n/255*v,o/255*v,d/255*v,v)}function fc(s,n){return s in n}function ua(s,n){const o=n[s];return o===void 0?null:o}function pn(s){return{type:s}}ya.register(od,{error:[{kind:"error"},[cr],(s,[n])=>{throw new er(n.evaluate(s))}],typeof:[cr,[dr],(s,[n])=>hs(Cs(n.evaluate(s)))],"to-rgba":[qs(rn,4),[la],(s,[n])=>n.evaluate(s).toArray()],rgb:[la,[rn,rn,rn],Nh],rgba:[la,[rn,rn,rn,rn],Nh],has:{type:Ar,overloads:[[[cr],(s,[n])=>fc(n.evaluate(s),s.properties())],[[cr,al],(s,[n,o])=>fc(n.evaluate(s),o.evaluate(s))]]},get:{type:dr,overloads:[[[cr],(s,[n])=>ua(n.evaluate(s),s.properties())],[[cr,al],(s,[n,o])=>ua(n.evaluate(s),o.evaluate(s))]]},"feature-state":[dr,[cr],(s,[n])=>ua(n.evaluate(s),s.featureState||{})],properties:[al,[],s=>s.properties()],"geometry-type":[cr,[],s=>s.geometryType()],id:[dr,[],s=>s.id()],zoom:[rn,[],s=>s.globals.zoom],pitch:[rn,[],s=>s.globals.pitch||0],"distance-from-center":[rn,[],s=>s.distanceFromCenter()],"heatmap-density":[rn,[],s=>s.globals.heatmapDensity||0],"line-progress":[rn,[],s=>s.globals.lineProgress||0],"sky-radial-progress":[rn,[],s=>s.globals.skyRadialProgress||0],accumulated:[dr,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[rn,pn(rn),(s,n)=>{let o=0;for(const d of n)o+=d.evaluate(s);return o}],"*":[rn,pn(rn),(s,n)=>{let o=1;for(const d of n)o*=d.evaluate(s);return o}],"-":{type:rn,overloads:[[[rn,rn],(s,[n,o])=>n.evaluate(s)-o.evaluate(s)],[[rn],(s,[n])=>-n.evaluate(s)]]},"/":[rn,[rn,rn],(s,[n,o])=>n.evaluate(s)/o.evaluate(s)],"%":[rn,[rn,rn],(s,[n,o])=>n.evaluate(s)%o.evaluate(s)],ln2:[rn,[],()=>Math.LN2],pi:[rn,[],()=>Math.PI],e:[rn,[],()=>Math.E],"^":[rn,[rn,rn],(s,[n,o])=>Math.pow(n.evaluate(s),o.evaluate(s))],sqrt:[rn,[rn],(s,[n])=>Math.sqrt(n.evaluate(s))],log10:[rn,[rn],(s,[n])=>Math.log(n.evaluate(s))/Math.LN10],ln:[rn,[rn],(s,[n])=>Math.log(n.evaluate(s))],log2:[rn,[rn],(s,[n])=>Math.log(n.evaluate(s))/Math.LN2],sin:[rn,[rn],(s,[n])=>Math.sin(n.evaluate(s))],cos:[rn,[rn],(s,[n])=>Math.cos(n.evaluate(s))],tan:[rn,[rn],(s,[n])=>Math.tan(n.evaluate(s))],asin:[rn,[rn],(s,[n])=>Math.asin(n.evaluate(s))],acos:[rn,[rn],(s,[n])=>Math.acos(n.evaluate(s))],atan:[rn,[rn],(s,[n])=>Math.atan(n.evaluate(s))],min:[rn,pn(rn),(s,n)=>Math.min(...n.map(o=>o.evaluate(s)))],max:[rn,pn(rn),(s,n)=>Math.max(...n.map(o=>o.evaluate(s)))],abs:[rn,[rn],(s,[n])=>Math.abs(n.evaluate(s))],round:[rn,[rn],(s,[n])=>{const o=n.evaluate(s);return o<0?-Math.round(-o):Math.round(o)}],floor:[rn,[rn],(s,[n])=>Math.floor(n.evaluate(s))],ceil:[rn,[rn],(s,[n])=>Math.ceil(n.evaluate(s))],"filter-==":[Ar,[cr,dr],(s,[n,o])=>s.properties()[n.value]===o.value],"filter-id-==":[Ar,[dr],(s,[n])=>s.id()===n.value],"filter-type-==":[Ar,[cr],(s,[n])=>s.geometryType()===n.value],"filter-<":[Ar,[cr,dr],(s,[n,o])=>{const d=s.properties()[n.value],g=o.value;return typeof d==typeof g&&d<g}],"filter-id-<":[Ar,[dr],(s,[n])=>{const o=s.id(),d=n.value;return typeof o==typeof d&&o<d}],"filter->":[Ar,[cr,dr],(s,[n,o])=>{const d=s.properties()[n.value],g=o.value;return typeof d==typeof g&&d>g}],"filter-id->":[Ar,[dr],(s,[n])=>{const o=s.id(),d=n.value;return typeof o==typeof d&&o>d}],"filter-<=":[Ar,[cr,dr],(s,[n,o])=>{const d=s.properties()[n.value],g=o.value;return typeof d==typeof g&&d<=g}],"filter-id-<=":[Ar,[dr],(s,[n])=>{const o=s.id(),d=n.value;return typeof o==typeof d&&o<=d}],"filter->=":[Ar,[cr,dr],(s,[n,o])=>{const d=s.properties()[n.value],g=o.value;return typeof d==typeof g&&d>=g}],"filter-id->=":[Ar,[dr],(s,[n])=>{const o=s.id(),d=n.value;return typeof o==typeof d&&o>=d}],"filter-has":[Ar,[dr],(s,[n])=>n.value in s.properties()],"filter-has-id":[Ar,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[Ar,[qs(cr)],(s,[n])=>n.value.indexOf(s.geometryType())>=0],"filter-id-in":[Ar,[qs(dr)],(s,[n])=>n.value.indexOf(s.id())>=0],"filter-in-small":[Ar,[cr,qs(dr)],(s,[n,o])=>o.value.indexOf(s.properties()[n.value])>=0],"filter-in-large":[Ar,[cr,qs(dr)],(s,[n,o])=>function(d,g,v,E){for(;v<=E;){const L=v+E>>1;if(g[L]===d)return!0;g[L]>d?E=L-1:v=L+1}return!1}(s.properties()[n.value],o.value,0,o.value.length-1)],all:{type:Ar,overloads:[[[Ar,Ar],(s,[n,o])=>n.evaluate(s)&&o.evaluate(s)],[pn(Ar),(s,n)=>{for(const o of n)if(!o.evaluate(s))return!1;return!0}]]},any:{type:Ar,overloads:[[[Ar,Ar],(s,[n,o])=>n.evaluate(s)||o.evaluate(s)],[pn(Ar),(s,n)=>{for(const o of n)if(o.evaluate(s))return!0;return!1}]]},"!":[Ar,[Ar],(s,[n])=>!n.evaluate(s)],"is-supported-script":[Ar,[cr],(s,[n])=>{const o=s.globals&&s.globals.isSupportedScript;return!o||o(n.evaluate(s))}],upcase:[cr,[cr],(s,[n])=>n.evaluate(s).toUpperCase()],downcase:[cr,[cr],(s,[n])=>n.evaluate(s).toLowerCase()],concat:[cr,pn(dr),(s,n)=>n.map(o=>rc(o.evaluate(s))).join("")],"resolved-locale":[cr,[Ul],(s,[n])=>n.evaluate(s).resolvedLocale()]});var eh=od;function Wl(s){return{result:"success",value:s}}function Ns(s){return{result:"error",value:s}}function gl(s){return s["property-type"]==="data-driven"}function un(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function th(s){return!!s.expression&&s.expression.interpolated}function Ur(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function mc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function cA(s){return s}function Qh(s,n){const o=n.type==="color",d=s.stops&&typeof s.stops[0][0]=="object",g=d||!(d||s.property!==void 0),v=s.type||(th(n)?"exponential":"interval");if(o&&((s=sr({},s)).stops&&(s.stops=s.stops.map(V=>[V[0],fs.parse(V[1])])),s.default=fs.parse(s.default?s.default:n.default)),s.colorSpace&&s.colorSpace!=="rgb"&&!$c[s.colorSpace])throw new Error(`Unknown color space: ${s.colorSpace}`);let E,L,k;if(v==="exponential")E=Vh;else if(v==="interval")E=uA;else if(v==="categorical"){E=hA,L=Object.create(null);for(const V of s.stops)L[V[0]]=V[1];k=typeof s.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=Hh}if(d){const V={},q=[];for(let _e=0;_e<s.stops.length;_e++){const be=s.stops[_e],De=be[0].zoom;V[De]===void 0&&(V[De]={zoom:De,type:s.type,property:s.property,default:s.default,stops:[]},q.push(De)),V[De].stops.push([be[0].value,be[1]])}const se=[];for(const _e of q)se.push([V[_e].zoom,Qh(V[_e],n)]);const he={name:"linear"};return{kind:"composite",interpolationType:he,interpolationFactor:Ho.interpolationFactor.bind(void 0,he),zoomStops:se.map(_e=>_e[0]),evaluate:({zoom:_e},be)=>Vh({stops:se,base:s.base},n,_e).evaluate(_e,be)}}if(g){const V=v==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:V,interpolationFactor:Ho.interpolationFactor.bind(void 0,V),zoomStops:s.stops.map(q=>q[0]),evaluate:({zoom:q})=>E(s,n,q,L,k)}}return{kind:"source",evaluate(V,q){const se=q&&q.properties?q.properties[s.property]:void 0;return se===void 0?gc(s.default,n.default):E(s,n,se,L,k)}}}function gc(s,n,o){return s!==void 0?s:n!==void 0?n:o!==void 0?o:void 0}function hA(s,n,o,d,g){return gc(typeof o===g?d[o]:void 0,s.default,n.default)}function uA(s,n,o){if(Ur(o)!=="number")return gc(s.default,n.default);const d=s.stops.length;if(d===1||o<=s.stops[0][0])return s.stops[0][1];if(o>=s.stops[d-1][0])return s.stops[d-1][1];const g=jr(s.stops.map(v=>v[0]),o);return s.stops[g][1]}function Vh(s,n,o){const d=s.base!==void 0?s.base:1;if(Ur(o)!=="number")return gc(s.default,n.default);const g=s.stops.length;if(g===1||o<=s.stops[0][0])return s.stops[0][1];if(o>=s.stops[g-1][0])return s.stops[g-1][1];const v=jr(s.stops.map(q=>q[0]),o),E=function(q,se,he,_e){const be=_e-he,De=q-he;return be===0?0:se===1?De/be:(Math.pow(se,De)-1)/(Math.pow(se,be)-1)}(o,d,s.stops[v][0],s.stops[v+1][0]),L=s.stops[v][1],k=s.stops[v+1][1];let V=yu[n.type]||cA;if(s.colorSpace&&s.colorSpace!=="rgb"){const q=$c[s.colorSpace];V=(se,he)=>q.reverse(q.interpolate(q.forward(se),q.forward(he),E))}return typeof L.evaluate=="function"?{evaluate(...q){const se=L.evaluate.apply(void 0,q),he=k.evaluate.apply(void 0,q);if(se!==void 0&&he!==void 0)return V(se,he,E)}}:V(L,k,E)}function Hh(s,n,o){return n.type==="color"?o=fs.parse(o):n.type==="formatted"?o=Os.fromString(o.toString()):n.type==="resolvedImage"?o=No.fromString(o.toString()):Ur(o)===n.type||n.type==="enum"&&n.values[o]||(o=void 0),gc(o,s.default,n.default)}class ih{constructor(n,o){this.expression=n,this._warningHistory={},this._evaluator=new fu,this._defaultValue=o?function(d){return d.type==="color"&&(mc(d.default)||Array.isArray(d.default))?new fs(0,0,0,0):d.type==="color"?fs.parse(d.default)||null:d.default===void 0?null:d.default}(o):null,this._enumValues=o&&o.type==="enum"?o.values:null}evaluateWithoutErrorHandling(n,o,d,g,v,E,L,k){return this._evaluator.globals=n,this._evaluator.feature=o,this._evaluator.featureState=d,this._evaluator.canonical=g||null,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=E,this._evaluator.featureTileCoord=L||null,this._evaluator.featureDistanceData=k||null,this.expression.evaluate(this._evaluator)}evaluate(n,o,d,g,v,E,L,k){this._evaluator.globals=n,this._evaluator.feature=o||null,this._evaluator.featureState=d||null,this._evaluator.canonical=g||null,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=E||null,this._evaluator.featureTileCoord=L||null,this._evaluator.featureDistanceData=k||null;try{const V=this.expression.evaluate(this._evaluator);if(V==null||typeof V=="number"&&V!=V)return this._defaultValue;if(this._enumValues&&!(V in this._enumValues))throw new er(`Expected value to be one of ${Object.keys(this._enumValues).map(q=>JSON.stringify(q)).join(", ")}, but found ${JSON.stringify(V)} instead.`);return V}catch(V){return this._warningHistory[V.message]||(this._warningHistory[V.message]=!0,typeof console<"u"&&console.warn(V.message)),this._defaultValue}}}function _c(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in eh}function Is(s,n){const o=new hr(eh,[],n?function(g){const v={color:la,string:cr,number:rn,enum:cr,boolean:Ar,formatted:Rl,resolvedImage:ll};return g.type==="array"?qs(v[g.value]||dr,g.length):v[g.type]}(n):void 0),d=o.parse(s,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?Wl(new ih(d,n)):Ns(o.errors)}class fo{constructor(n,o){this.kind=n,this._styleExpression=o,this.isStateDependent=n!=="constant"&&!Ha(o.expression)}evaluateWithoutErrorHandling(n,o,d,g,v,E){return this._styleExpression.evaluateWithoutErrorHandling(n,o,d,g,v,E)}evaluate(n,o,d,g,v,E){return this._styleExpression.evaluate(n,o,d,g,v,E)}}class Gh{constructor(n,o,d,g){this.kind=n,this.zoomStops=d,this._styleExpression=o,this.isStateDependent=n!=="camera"&&!Ha(o.expression),this.interpolationType=g}evaluateWithoutErrorHandling(n,o,d,g,v,E){return this._styleExpression.evaluateWithoutErrorHandling(n,o,d,g,v,E)}evaluate(n,o,d,g,v,E){return this._styleExpression.evaluate(n,o,d,g,v,E)}interpolationFactor(n,o,d){return this.interpolationType?Ho.interpolationFactor(this.interpolationType,n,o,d):0}}function jl(s,n){if((s=Is(s,n)).result==="error")return s;const o=s.value.expression,d=Al(o);if(!d&&!gl(n))return Ns([new Mr("","data expressions not supported")]);const g=Qc(o,["zoom","pitch","distance-from-center"]);if(!g&&!un(n))return Ns([new Mr("","zoom expressions not supported")]);const v=_l(o);return v||g?v instanceof Mr?Ns([v]):v instanceof Ho&&!th(n)?Ns([new Mr("",'"interpolate" expressions cannot be used with this property')]):Wl(v?new Gh(d?"camera":"composite",s.value,v.labels,v instanceof Ho?v.interpolation:void 0):new fo(d?"constant":"source",s.value)):Ns([new Mr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Kl{constructor(n,o){this._parameters=n,this._specification=o,sr(this,Qh(this._parameters,this._specification))}static deserialize(n){return new Kl(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function _l(s){let n=null;if(s instanceof vu)n=_l(s.result);else if(s instanceof xu){for(const o of s.args)if(n=_l(o),n)break}else(s instanceof Hl||s instanceof Ho)&&s.input instanceof ya&&s.input.name==="zoom"&&(n=s);return n instanceof Mr||s.eachChild(o=>{const d=_l(o);d instanceof Mr?n=d:!n&&d?n=new Mr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&d&&n!==d&&(n=new Mr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}class An{constructor(n,o,d,g){this.message=(n?`${n}: `:"")+d,g&&(this.identifier=g),o!=null&&o.__line__&&(this.line=o.__line__)}}function vs(s){const n=s.key,o=s.value,d=s.valueSpec||{},g=s.objectElementValidators||{},v=s.style,E=s.styleSpec;let L=[];const k=Ur(o);if(k!=="object")return[new An(n,o,`object expected, ${k} found`)];for(const V in o){const q=V.split(".")[0],se=d[q]||d["*"];let he;g[q]?he=g[q]:d[q]?he=Te:g["*"]?he=g["*"]:d["*"]&&(he=Te),he?L=L.concat(he({key:(n&&`${n}.`)+V,value:o[V],valueSpec:se,style:v,styleSpec:E,object:o,objectKey:V},o)):L.push(new An(n,o[V],`unknown property "${V}"`))}for(const V in d)g[V]||d[V].required&&d[V].default===void 0&&o[V]===void 0&&L.push(new An(n,o,`missing required property "${V}"`));return L}function Zr(s){const n=s.value,o=s.valueSpec,d=s.style,g=s.styleSpec,v=s.key,E=s.arrayElementValidator||Te;if(Ur(n)!=="array")return[new An(v,n,`array expected, ${Ur(n)} found`)];if(o.length&&n.length!==o.length)return[new An(v,n,`array length ${o.length} expected, length ${n.length} found`)];if(o["min-length"]&&n.length<o["min-length"])return[new An(v,n,`array length at least ${o["min-length"]} expected, length ${n.length} found`)];let L={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};g.$version<7&&(L.function=o.function),Ur(o.value)==="object"&&(L=o.value);let k=[];for(let V=0;V<n.length;V++)k=k.concat(E({array:n,arrayIndex:V,value:n[V],valueSpec:L,style:d,styleSpec:g,key:`${v}[${V}]`}));return k}function nh(s){const n=s.key,o=s.value,d=s.valueSpec;let g=Ur(o);if(g==="number"&&o!=o&&(g="NaN"),g!=="number")return[new An(n,o,`number expected, ${g} found`)];if("minimum"in d){let v=d.minimum;if(Ur(d.minimum)==="array"&&(v=d.minimum[s.arrayIndex]),o<v)return[new An(n,o,`${o} is less than the minimum value ${v}`)]}if("maximum"in d){let v=d.maximum;if(Ur(d.maximum)==="array"&&(v=d.maximum[s.arrayIndex]),o>v)return[new An(n,o,`${o} is greater than the maximum value ${v}`)]}return[]}function Wh(s){const n=s.valueSpec,o=Yn(s.value.type);let d,g,v,E={};const L=o!=="categorical"&&s.value.property===void 0,k=!L,V=Ur(s.value.stops)==="array"&&Ur(s.value.stops[0])==="array"&&Ur(s.value.stops[0][0])==="object",q=vs({key:s.key,value:s.value,valueSpec:s.styleSpec.function,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(_e){if(o==="identity")return[new An(_e.key,_e.value,'identity function may not have a "stops" property')];let be=[];const De=_e.value;return be=be.concat(Zr({key:_e.key,value:De,valueSpec:_e.valueSpec,style:_e.style,styleSpec:_e.styleSpec,arrayElementValidator:se})),Ur(De)==="array"&&De.length===0&&be.push(new An(_e.key,De,"array must have at least one stop")),be},default:function(_e){return Te({key:_e.key,value:_e.value,valueSpec:n,style:_e.style,styleSpec:_e.styleSpec})}}});return o==="identity"&&L&&q.push(new An(s.key,s.value,'missing required property "property"')),o==="identity"||s.value.stops||q.push(new An(s.key,s.value,'missing required property "stops"')),o==="exponential"&&s.valueSpec.expression&&!th(s.valueSpec)&&q.push(new An(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(k&&!gl(s.valueSpec)?q.push(new An(s.key,s.value,"property functions not supported")):L&&!un(s.valueSpec)&&q.push(new An(s.key,s.value,"zoom functions not supported"))),o!=="categorical"&&!V||s.value.property!==void 0||q.push(new An(s.key,s.value,'"property" property is required')),q;function se(_e){let be=[];const De=_e.value,Ze=_e.key;if(Ur(De)!=="array")return[new An(Ze,De,`array expected, ${Ur(De)} found`)];if(De.length!==2)return[new An(Ze,De,`array length 2 expected, length ${De.length} found`)];if(V){if(Ur(De[0])!=="object")return[new An(Ze,De,`object expected, ${Ur(De[0])} found`)];if(De[0].zoom===void 0)return[new An(Ze,De,"object stop key must have zoom")];if(De[0].value===void 0)return[new An(Ze,De,"object stop key must have value")];const xt=Yn(De[0].zoom);if(typeof xt!="number")return[new An(Ze,De[0].zoom,"stop zoom values must be numbers")];if(v&&v>xt)return[new An(Ze,De[0].zoom,"stop zoom values must appear in ascending order")];xt!==v&&(v=xt,g=void 0,E={}),be=be.concat(vs({key:`${Ze}[0]`,value:De[0],valueSpec:{zoom:{}},style:_e.style,styleSpec:_e.styleSpec,objectElementValidators:{zoom:nh,value:he}}))}else be=be.concat(he({key:`${Ze}[0]`,value:De[0],valueSpec:{},style:_e.style,styleSpec:_e.styleSpec},De));return _c(Wr(De[1]))?be.concat([new An(`${Ze}[1]`,De[1],"expressions are not allowed in function stops.")]):be.concat(Te({key:`${Ze}[1]`,value:De[1],valueSpec:n,style:_e.style,styleSpec:_e.styleSpec}))}function he(_e,be){const De=Ur(_e.value),Ze=Yn(_e.value),xt=_e.value!==null?_e.value:be;if(d){if(De!==d)return[new An(_e.key,xt,`${De} stop domain type must match previous stop domain type ${d}`)]}else d=De;if(De!=="number"&&De!=="string"&&De!=="boolean"&&typeof Ze!="number"&&typeof Ze!="string"&&typeof Ze!="boolean")return[new An(_e.key,xt,"stop domain value must be a number, string, or boolean")];if(De!=="number"&&o!=="categorical"){let Dt=`number expected, ${De} found`;return gl(n)&&o===void 0&&(Dt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new An(_e.key,xt,Dt)]}return o!=="categorical"||De!=="number"||typeof Ze=="number"&&isFinite(Ze)&&Math.floor(Ze)===Ze?o!=="categorical"&&De==="number"&&typeof Ze=="number"&&typeof g=="number"&&g!==void 0&&Ze<g?[new An(_e.key,xt,"stop domain values must appear in ascending order")]:(g=Ze,o==="categorical"&&Ze in E?[new An(_e.key,xt,"stop domain values must be unique")]:(E[Ze]=!0,[])):[new An(_e.key,xt,`integer expected, found ${String(Ze)}`)]}}function yc(s){const n=(s.expressionContext==="property"?jl:Is)(Wr(s.value),s.valueSpec);if(n.result==="error")return n.value.map(d=>new An(`${s.key}${d.key}`,s.value,d.message));const o=n.value.expression||n.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!o.outputDefined())return[new An(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Ha(o))return[new An(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter")return AA(o,s);if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!Qc(o,["zoom","feature-state"]))return[new An(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!Al(o))return[new An(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function AA(s,n){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(n.valueSpec&&n.valueSpec.expression)for(const g of n.valueSpec.expression.parameters)o.delete(g);if(o.size===0)return[];const d=[];return s instanceof ya&&o.has(s.name)?[new An(n.key,n.value,`["${s.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(s.eachChild(g=>{d.push(...AA(g,n))}),d)}function jh(s){const n=s.key,o=s.value,d=s.valueSpec,g=[];return Array.isArray(d.values)?d.values.indexOf(Yn(o))===-1&&g.push(new An(n,o,`expected one of [${d.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(d.values).indexOf(Yn(o))===-1&&g.push(new An(n,o,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(o)} found`)),g}function rh(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const n of s.slice(1))if(!rh(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}function uo(s,n="fill"){if(s==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};rh(s)||(s=Es(s));const o=s;let d=!0;try{d=function(V){if(!Vn(V))return V;let q=Wr(V);return Fn(q),q=Js(q),q}(o)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
- This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
- and paste the contents of this message in the report.
- Thank you!
- Filter Expression:
- ${JSON.stringify(o,null,2)}
- `)}const g=Yt[`filter_${n}`],v=Is(d,g);let E=null;if(v.result==="error")throw new Error(v.value.map(V=>`${V.key}: ${V.message}`).join(", "));E=(V,q,se)=>v.value.evaluate(V,q,{},se);let L=null,k=null;if(d!==o){const V=Is(o,g);if(V.result==="error")throw new Error(V.value.map(q=>`${q.key}: ${q.message}`).join(", "));L=(q,se,he,_e,be)=>V.value.evaluate(q,se,{},he,void 0,void 0,_e,be),k=!Al(V.value.expression)}return{filter:E,dynamicFilter:L||void 0,needGeometry:yl(d),needFeature:!!k}}function Js(s){if(!Array.isArray(s))return s;const n=function(o){if(sh.has(o[0])){for(let d=1;d<o.length;d++)if(Vn(o[d]))return!0}return o}(s);return n===!0?n:n.map(o=>Js(o))}function Fn(s){let n=!1;const o=[];if(s[0]==="case"){for(let d=1;d<s.length-1;d+=2)n=n||Vn(s[d]),o.push(s[d+1]);o.push(s[s.length-1])}else if(s[0]==="match"){n=n||Vn(s[1]);for(let d=2;d<s.length-1;d+=2)o.push(s[d+1]);o.push(s[s.length-1])}else if(s[0]==="step"){n=n||Vn(s[1]);for(let d=1;d<s.length-1;d+=2)o.push(s[d+1])}n&&(s.length=0,s.push("any",...o));for(let d=1;d<s.length;d++)Fn(s[d])}function Vn(s){if(!Array.isArray(s))return!1;if((n=s[0])==="pitch"||n==="distance-from-center")return!0;var n;for(let o=1;o<s.length;o++)if(Vn(s[o]))return!0;return!1}const sh=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function dA(s,n){return s<n?-1:s>n?1:0}function yl(s){if(!Array.isArray(s))return!1;if(s[0]==="within")return!0;for(let n=1;n<s.length;n++)if(yl(s[n]))return!0;return!1}function Es(s){if(!s)return!0;const n=s[0];return s.length<=1?n!=="any":n==="=="?Wa(s[1],s[2],"=="):n==="!="?va(Wa(s[1],s[2],"==")):n==="<"||n===">"||n==="<="||n===">="?Wa(s[1],s[2],n):n==="any"?(o=s.slice(1),["any"].concat(o.map(Es))):n==="all"?["all"].concat(s.slice(1).map(Es)):n==="none"?["all"].concat(s.slice(1).map(Es).map(va)):n==="in"?Go(s[1],s.slice(2)):n==="!in"?va(Go(s[1],s.slice(2))):n==="has"?pA(s[1]):n==="!has"?va(pA(s[1])):n!=="within"||s;var o}function Wa(s,n,o){switch(s){case"$type":return[`filter-type-${o}`,n];case"$id":return[`filter-id-${o}`,n];default:return[`filter-${o}`,s,n]}}function Go(s,n){if(n.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(o=>typeof o!=typeof n[0])?["filter-in-large",s,["literal",n.sort(dA)]]:["filter-in-small",s,["literal",n]]}}function pA(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function va(s){return["!",s]}function us(s){return rh(Wr(s.value))?yc(sr({},s,{expressionContext:"filter",valueSpec:s.styleSpec[`filter_${s.layerType||"fill"}`]})):Fs(s)}function Fs(s){const n=s.value,o=s.key;if(Ur(n)!=="array")return[new An(o,n,`array expected, ${Ur(n)} found`)];const d=s.styleSpec;let g,v=[];if(n.length<1)return[new An(o,n,"filter array must have at least 1 element")];switch(v=v.concat(jh({key:`${o}[0]`,value:n[0],valueSpec:d.filter_operator,style:s.style,styleSpec:s.styleSpec})),Yn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&Yn(n[1])==="$type"&&v.push(new An(o,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&v.push(new An(o,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(g=Ur(n[1]),g!=="string"&&v.push(new An(`${o}[1]`,n[1],`string expected, ${g} found`)));for(let E=2;E<n.length;E++)g=Ur(n[E]),Yn(n[1])==="$type"?v=v.concat(jh({key:`${o}[${E}]`,value:n[E],valueSpec:d.geometry_type,style:s.style,styleSpec:s.styleSpec})):g!=="string"&&g!=="number"&&g!=="boolean"&&v.push(new An(`${o}[${E}]`,n[E],`string, number, or boolean expected, ${g} found`));break;case"any":case"all":case"none":for(let E=1;E<n.length;E++)v=v.concat(Fs({key:`${o}[${E}]`,value:n[E],style:s.style,styleSpec:s.styleSpec}));break;case"has":case"!has":g=Ur(n[1]),n.length!==2?v.push(new An(o,n,`filter array for "${n[0]}" operator must have 2 elements`)):g!=="string"&&v.push(new An(`${o}[1]`,n[1],`string expected, ${g} found`));break;case"within":g=Ur(n[1]),n.length!==2?v.push(new An(o,n,`filter array for "${n[0]}" operator must have 2 elements`)):g!=="object"&&v.push(new An(`${o}[1]`,n[1],`object expected, ${g} found`))}return v}function Kh(s,n){const o=s.key,d=s.style,g=s.styleSpec,v=s.value,E=s.objectKey,L=g[`${n}_${s.layerType}`];if(!L)return[];const k=E.match(/^(.*)-transition$/);if(n==="paint"&&k&&L[k[1]]&&L[k[1]].transition)return Te({key:o,value:v,valueSpec:g.transition,style:d,styleSpec:g});const V=s.valueSpec||L[E];if(!V)return[new An(o,v,`unknown property "${E}"`)];let q;if(Ur(v)==="string"&&gl(V)&&!V.tokens&&(q=/^{([^}]+)}$/.exec(v)))return[new An(o,v,`"${E}" does not support interpolation syntax
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(q[1])} }\`.`)];const se=[];return s.layerType==="symbol"&&(E==="text-field"&&d&&!d.glyphs&&se.push(new An(o,v,'use of "text-field" requires a style "glyphs" property')),E==="text-font"&&mc(Wr(v))&&Yn(v.type)==="identity"&&se.push(new An(o,v,'"text-font" does not support identity functions'))),se.concat(Te({key:s.key,value:v,valueSpec:V,style:d,styleSpec:g,expressionContext:"property",propertyType:n,propertyKey:E}))}function xl(s){return Kh(s,"paint")}function M(s){return Kh(s,"layout")}function h(s){let n=[];const o=s.value,d=s.key,g=s.style,v=s.styleSpec;o.type||o.ref||n.push(new An(d,o,'either "type" or "ref" is required'));let E=Yn(o.type);const L=Yn(o.ref);if(o.id){const k=Yn(o.id);for(let V=0;V<s.arrayIndex;V++){const q=g.layers[V];Yn(q.id)===k&&n.push(new An(d,o.id,`duplicate layer id "${o.id}", previously used at line ${q.id.__line__}`))}}if("ref"in o){let k;["type","source","source-layer","filter","layout"].forEach(V=>{V in o&&n.push(new An(d,o[V],`"${V}" is prohibited for ref layers`))}),g.layers.forEach(V=>{Yn(V.id)===L&&(k=V)}),k?k.ref?n.push(new An(d,o.ref,"ref cannot reference another ref layer")):E=Yn(k.type):typeof L=="string"&&n.push(new An(d,o.ref,`ref layer "${L}" not found`))}else if(E!=="background"&&E!=="sky")if(o.source){const k=g.sources&&g.sources[o.source],V=k&&Yn(k.type);k?V==="vector"&&E==="raster"?n.push(new An(d,o.source,`layer "${o.id}" requires a raster source`)):V==="raster"&&E!=="raster"?n.push(new An(d,o.source,`layer "${o.id}" requires a vector source`)):V!=="vector"||o["source-layer"]?V==="raster-dem"&&E!=="hillshade"?n.push(new An(d,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):E!=="line"||!o.paint||!o.paint["line-gradient"]&&!o.paint["line-trim-offset"]||V==="geojson"&&k.lineMetrics||n.push(new An(d,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new An(d,o,`layer "${o.id}" must specify a "source-layer"`)):n.push(new An(d,o.source,`source "${o.source}" not found`))}else n.push(new An(d,o,'missing required property "source"'));return n=n.concat(vs({key:d,value:o,valueSpec:v.layer,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Te({key:`${d}.type`,value:o.type,valueSpec:v.layer.type,style:s.style,styleSpec:s.styleSpec,object:o,objectKey:"type"}),filter:k=>us(sr({layerType:E},k)),layout:k=>vs({layer:o,key:k.key,value:k.value,valueSpec:{},style:k.style,styleSpec:k.styleSpec,objectElementValidators:{"*":V=>M(sr({layerType:E},V))}}),paint:k=>vs({layer:o,key:k.key,value:k.value,valueSpec:{},style:k.style,styleSpec:k.styleSpec,objectElementValidators:{"*":V=>xl(sr({layerType:E},V))}})}})),n}function _(s){const n=s.value,o=s.key,d=Ur(n);return d!=="string"?[new An(o,n,`string expected, ${d} found`)]:[]}const T={promoteId:function({key:s,value:n}){if(Ur(n)==="string")return _({key:s,value:n});{const o=[];for(const d in n)o.push(..._({key:`${s}.${d}`,value:n[d]}));return o}}};function F(s){const n=s.value,o=s.key,d=s.styleSpec,g=s.style;if(!n.type)return[new An(o,n,'"type" is required')];const v=Yn(n.type);let E;switch(v){case"vector":case"raster":case"raster-dem":return E=vs({key:o,value:n,valueSpec:d[`source_${v.replace("-","_")}`],style:s.style,styleSpec:d,objectElementValidators:T}),E;case"geojson":if(E=vs({key:o,value:n,valueSpec:d.source_geojson,style:g,styleSpec:d,objectElementValidators:T}),n.cluster)for(const L in n.clusterProperties){const[k,V]=n.clusterProperties[L],q=typeof k=="string"?[k,["accumulated"],["get",L]]:k;E.push(...yc({key:`${o}.${L}.map`,value:V,expressionContext:"cluster-map"})),E.push(...yc({key:`${o}.${L}.reduce`,value:q,expressionContext:"cluster-reduce"}))}return E;case"video":return vs({key:o,value:n,valueSpec:d.source_video,style:g,styleSpec:d});case"image":return vs({key:o,value:n,valueSpec:d.source_image,style:g,styleSpec:d});case"canvas":return[new An(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return jh({key:`${o}.type`,value:n.type,valueSpec:{values:O(d)},style:g,styleSpec:d})}}function O(s){return s.source.reduce((n,o)=>{const d=s[o];return d.type.type==="enum"&&(n=n.concat(Object.keys(d.type.values))),n},[])}function K(s){const n=s.value,o=s.styleSpec,d=o.light,g=s.style;let v=[];const E=Ur(n);if(n===void 0)return v;if(E!=="object")return v=v.concat([new An("light",n,`object expected, ${E} found`)]),v;for(const L in n){const k=L.match(/^(.*)-transition$/);v=v.concat(k&&d[k[1]]&&d[k[1]].transition?Te({key:L,value:n[L],valueSpec:o.transition,style:g,styleSpec:o}):d[L]?Te({key:L,value:n[L],valueSpec:d[L],style:g,styleSpec:o}):[new An(L,n[L],`unknown property "${L}"`)])}return v}function oe(s){const n=s.value,o=s.key,d=s.style,g=s.styleSpec,v=g.terrain;let E=[];const L=Ur(n);if(n===void 0)return E;if(L!=="object")return E=E.concat([new An("terrain",n,`object expected, ${L} found`)]),E;for(const k in n){const V=k.match(/^(.*)-transition$/);E=E.concat(V&&v[V[1]]&&v[V[1]].transition?Te({key:k,value:n[k],valueSpec:g.transition,style:d,styleSpec:g}):v[k]?Te({key:k,value:n[k],valueSpec:v[k],style:d,styleSpec:g}):[new An(k,n[k],`unknown property "${k}"`)])}if(n.source){const k=d.sources&&d.sources[n.source],V=k&&Yn(k.type);k?V!=="raster-dem"&&E.push(new An(o,n.source,`terrain cannot be used with a source of type ${String(V)}, it only be used with a "raster-dem" source type`)):E.push(new An(o,n.source,`source "${n.source}" not found`))}else E.push(new An(o,n,'terrain is missing required property "source"'));return E}function ue(s){const n=s.value,o=s.style,d=s.styleSpec,g=d.fog;let v=[];const E=Ur(n);if(n===void 0)return v;if(E!=="object")return v=v.concat([new An("fog",n,`object expected, ${E} found`)]),v;for(const L in n){const k=L.match(/^(.*)-transition$/);v=v.concat(k&&g[k[1]]&&g[k[1]].transition?Te({key:L,value:n[L],valueSpec:d.transition,style:o,styleSpec:d}):g[L]?Te({key:L,value:n[L],valueSpec:g[L],style:o,styleSpec:d}):[new An(L,n[L],`unknown property "${L}"`)])}return v}const ve={"*":()=>[],array:Zr,boolean:function(s){const n=s.value,o=s.key,d=Ur(n);return d!=="boolean"?[new An(o,n,`boolean expected, ${d} found`)]:[]},number:nh,color:function(s){const n=s.key,o=s.value,d=Ur(o);return d!=="string"?[new An(n,o,`color expected, ${d} found`)]:kl(o)===null?[new An(n,o,`color expected, "${o}" found`)]:[]},enum:jh,filter:us,function:Wh,layer:h,object:vs,source:F,light:K,terrain:oe,fog:ue,string:_,formatted:function(s){return _(s).length===0?[]:yc(s)},resolvedImage:function(s){return _(s).length===0?[]:yc(s)},projection:function(s){const n=s.value,o=s.styleSpec,d=o.projection,g=s.style;let v=[];const E=Ur(n);if(E==="object")for(const L in n)v=v.concat(Te({key:L,value:n[L],valueSpec:d[L],style:g,styleSpec:o}));else E!=="string"&&(v=v.concat([new An("projection",n,`object or string expected, ${E} found`)]));return v}};function Te(s){const n=s.value,o=s.valueSpec,d=s.styleSpec;return o.expression&&mc(Yn(n))?Wh(s):o.expression&&_c(Wr(n))?yc(s):o.type&&ve[o.type]?ve[o.type](s):vs(sr({},s,{valueSpec:o.type?d[o.type]:o}))}function ke(s){const n=s.value,o=s.key,d=_(s);return d.length||(n.indexOf("{fontstack}")===-1&&d.push(new An(o,n,'"glyphs" url must include a "{fontstack}" token')),n.indexOf("{range}")===-1&&d.push(new An(o,n,'"glyphs" url must include a "{range}" token'))),d}function We(s,n=Yt){return gt(Te({key:"",value:s,valueSpec:n.$root,styleSpec:n,style:s,objectElementValidators:{glyphs:ke,"*":()=>[]}}))}const bt=s=>gt(xl(s)),mt=s=>gt(M(s));function gt(s){return s.slice().sort((n,o)=>n.line&&o.line?n.line-o.line:0)}function Vt(s,n){let o=!1;if(n&&n.length)for(const d of n)s.fire(new rr(new Error(d.message))),o=!0;return o}var Zt=ni;function ni(s,n,o){var d=this.cells=[];if(s instanceof ArrayBuffer){this.arrayBuffer=s;var g=new Int32Array(this.arrayBuffer);s=g[0],this.d=(n=g[1])+2*(o=g[2]);for(var v=0;v<this.d*this.d;v++){var E=g[3+v],L=g[3+v+1];d.push(E===L?null:g.subarray(E,L))}var k=g[3+d.length+1];this.keys=g.subarray(g[3+d.length],k),this.bboxes=g.subarray(k),this.insert=this._insertReadonly}else{this.d=n+2*o;for(var V=0;V<this.d*this.d;V++)d.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=s,this.padding=o,this.scale=n/s,this.uid=0;var q=o/n*s;this.min=-q,this.max=s+q}ni.prototype.insert=function(s,n,o,d,g){this._forEachCell(n,o,d,g,this._insertCell,this.uid++),this.keys.push(s),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(d),this.bboxes.push(g)},ni.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},ni.prototype._insertCell=function(s,n,o,d,g,v){this.cells[g].push(v)},ni.prototype.query=function(s,n,o,d,g){var v=this.min,E=this.max;if(s<=v&&n<=v&&E<=o&&E<=d&&!g)return Array.prototype.slice.call(this.keys);var L=[];return this._forEachCell(s,n,o,d,this._queryCell,L,{},g),L},ni.prototype._queryCell=function(s,n,o,d,g,v,E,L){var k=this.cells[g];if(k!==null)for(var V=this.keys,q=this.bboxes,se=0;se<k.length;se++){var he=k[se];if(E[he]===void 0){var _e=4*he;(L?L(q[_e+0],q[_e+1],q[_e+2],q[_e+3]):s<=q[_e+2]&&n<=q[_e+3]&&o>=q[_e+0]&&d>=q[_e+1])?(E[he]=!0,v.push(V[he])):E[he]=!1}}},ni.prototype._forEachCell=function(s,n,o,d,g,v,E,L){for(var k=this._convertToCellCoord(s),V=this._convertToCellCoord(n),q=this._convertToCellCoord(o),se=this._convertToCellCoord(d),he=k;he<=q;he++)for(var _e=V;_e<=se;_e++){var be=this.d*_e+he;if((!L||L(this._convertFromCellCoord(he),this._convertFromCellCoord(_e),this._convertFromCellCoord(he+1),this._convertFromCellCoord(_e+1)))&&g.call(this,s,n,o,d,be,v,E,L))return}},ni.prototype._convertFromCellCoord=function(s){return(s-this.padding)/this.scale},ni.prototype._convertToCellCoord=function(s){return Math.max(0,Math.min(this.d-1,Math.floor(s*this.scale)+this.padding))},ni.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var s=this.cells,n=3+this.cells.length+1+1,o=0,d=0;d<this.cells.length;d++)o+=this.cells[d].length;var g=new Int32Array(n+o+this.keys.length+this.bboxes.length);g[0]=this.extent,g[1]=this.n,g[2]=this.padding;for(var v=n,E=0;E<s.length;E++){var L=s[E];g[3+E]=v,g.set(L,v),v+=L.length}return g[3+s.length]=v,g.set(this.keys,v),g[3+s.length+1]=v+=this.keys.length,g.set(this.bboxes,v),v+=this.bboxes.length,g.buffer};const St={};function zt(s,n,o={}){Object.defineProperty(s,"_classRegistryKey",{value:n,writeable:!1}),St[n]={klass:s,omit:o.omit||[]}}zt(Object,"Object"),Zt.serialize=function(s,n){const o=s.toArrayBuffer();return n&&n.push(o),{buffer:o}},Zt.deserialize=function(s){return new Zt(s.buffer)},Object.defineProperty(Zt,"name",{value:"Grid"}),zt(Zt,"Grid"),zt(fs,"Color"),zt(Error,"Error"),zt(hn,"AJAXError"),zt(No,"ResolvedImage"),zt(Kl,"StylePropertyFunction"),zt(ih,"StyleExpression",{omit:["_evaluator"]}),zt(Gh,"ZoomDependentExpression"),zt(fo,"ZoomConstantExpression"),zt(ya,"CompoundExpression",{omit:["_evaluate"]});for(const s in eh)St[eh[s]._classRegistryKey]||zt(eh[s],`Expression${s}`);function li(s){return s&&typeof ArrayBuffer<"u"&&(s instanceof ArrayBuffer||s.constructor&&s.constructor.name==="ArrayBuffer")}function Ei(s){return C.ImageBitmap&&s instanceof C.ImageBitmap}function bi(s,n){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp)return s;if(li(s)||Ei(s))return n&&n.push(s),s;if(ArrayBuffer.isView(s)){const o=s;return n&&n.push(o.buffer),o}if(s instanceof C.ImageData)return n&&n.push(s.data.buffer),s;if(Array.isArray(s)){const o=[];for(const d of s)o.push(bi(d,n));return o}if(typeof s=="object"){const o=s.constructor,d=o._classRegistryKey;if(!d)throw new Error(`can't serialize object of unregistered class ${d}`);const g=o.serialize?o.serialize(s,n):{};if(!o.serialize){for(const v in s)s.hasOwnProperty(v)&&(St[d].omit.indexOf(v)>=0||(g[v]=bi(s[v],n)));s instanceof Error&&(g.message=s.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return d!=="Object"&&(g.$name=d),g}throw new Error("can't serialize object of type "+typeof s)}function Hi(s){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp||li(s)||Ei(s)||ArrayBuffer.isView(s)||s instanceof C.ImageData)return s;if(Array.isArray(s))return s.map(Hi);if(typeof s=="object"){const n=s.$name||"Object",{klass:o}=St[n];if(!o)throw new Error(`can't deserialize unregistered class ${n}`);if(o.deserialize)return o.deserialize(s);const d=Object.create(o.prototype);for(const g of Object.keys(s))g!=="$name"&&(d[g]=Hi(s[g]));return d}throw new Error("can't deserialize object of type "+typeof s)}const xi=s=>s>=1536&&s<=1791,xn=s=>s>=1872&&s<=1919,cn=s=>s>=2208&&s<=2303,Bn=s=>s>=11904&&s<=12031,tr=s=>s>=12032&&s<=12255,ur=s=>s>=12272&&s<=12287,Un=s=>s>=12288&&s<=12351,Lr=s=>s>=12352&&s<=12447,Rr=s=>s>=12448&&s<=12543,Cr=s=>s>=12544&&s<=12591,Er=s=>s>=12704&&s<=12735,Gr=s=>s>=12736&&s<=12783,js=s=>s>=12784&&s<=12799,wa=s=>s>=12800&&s<=13055,Aa=s=>s>=13056&&s<=13311,ba=s=>s>=13312&&s<=19903,ja=s=>s>=19968&&s<=40959,Wo=s=>s>=40960&&s<=42127,mo=s=>s>=42128&&s<=42191,Ba=s=>s>=44032&&s<=55215,$l=s=>s>=63744&&s<=64255,x=s=>s>=64336&&s<=65023,a=s=>s>=65040&&s<=65055,m=s=>s>=65072&&s<=65103,b=s=>s>=65104&&s<=65135,S=s=>s>=65136&&s<=65279,P=s=>s>=65280&&s<=65519;function H(s){for(const n of s)if(pe(n.charCodeAt(0)))return!0;return!1}function W(s){for(const n of s)if(!ee(n.charCodeAt(0)))return!1;return!0}function ee(s){return!(xi(s)||xn(s)||cn(s)||x(s)||S(s))}function pe(s){return!(s!==746&&s!==747&&(s<4352||!(Er(s)||Cr(s)||m(s)&&!(s>=65097&&s<=65103)||$l(s)||Aa(s)||Bn(s)||Gr(s)||!(!Un(s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ba(s)||ja(s)||wa(s)||(n=>n>=12592&&n<=12687)(s)||(n=>n>=43360&&n<=43391)(s)||(n=>n>=55216&&n<=55295)(s)||(n=>n>=4352&&n<=4607)(s)||Ba(s)||Lr(s)||ur(s)||(n=>n>=12688&&n<=12703)(s)||tr(s)||js(s)||Rr(s)&&s!==12540||!(!P(s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!b(s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||(n=>n>=5120&&n<=5759)(s)||(n=>n>=6320&&n<=6399)(s)||a(s)||(n=>n>=19904&&n<=19967)(s)||Wo(s)||mo(s))))}function fe(s){return!(pe(s)||function(n){return!!((o=>o>=128&&o<=255)(n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||(o=>o>=8192&&o<=8303)(n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||(o=>o>=8448&&o<=8527)(n)||(o=>o>=8528&&o<=8591)(n)||(o=>o>=8960&&o<=9215)(n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||(o=>o>=9216&&o<=9279)(n)&&n!==9251||(o=>o>=9280&&o<=9311)(n)||(o=>o>=9312&&o<=9471)(n)||(o=>o>=9632&&o<=9727)(n)||(o=>o>=9728&&o<=9983)(n)&&!(n>=9754&&n<=9759)||(o=>o>=11008&&o<=11263)(n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||Un(n)||Rr(n)||(o=>o>=57344&&o<=63743)(n)||m(n)||b(n)||P(n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(s))}function Se(s){return s>=1424&&s<=2303||x(s)||S(s)}function Qe(s,n){return!(!n&&Se(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||(o=>o>=6016&&o<=6143)(s))}function rt(s){for(const n of s)if(Se(n.charCodeAt(0)))return!0;return!1}const nt="deferred",lt="loading",Xe="loaded";let Ye=null,At="unavailable",ht=null;const Bt=function(s){s&&typeof s=="string"&&s.indexOf("NetworkError")>-1&&(At="error"),Ye&&Ye(s)};function Pt(){It.fire(new tn("pluginStateChange",{pluginStatus:At,pluginURL:ht}))}const It=new yn,Ht=function(){return At},hi=function(){if(At!==nt||!ht)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");At=lt,Pt(),ht&&Cn({url:ht},s=>{s?Bt(s):(At=Xe,Pt())})},si={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>At===Xe||si.applyArabicShaping!=null,isLoading:()=>At===lt,setState(s){At=s.pluginStatus,ht=s.pluginURL},isParsed:()=>si.applyArabicShaping!=null&&si.processBidirectionalText!=null&&si.processStyledBidirectionalText!=null,getPluginURL:()=>ht};class qt{constructor(n,o){this.zoom=n,o?(this.now=o.now,this.fadeDuration=o.fadeDuration,this.transition=o.transition,this.pitch=o.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(n){return function(o,d){for(const g of o)if(!Qe(g.charCodeAt(0),d))return!1;return!0}(n,si.isLoaded())}}class ji{constructor(n,o){this.property=n,this.value=o,this.expression=function(d,g){if(mc(d))return new Kl(d,g);if(_c(d)){const v=jl(d,g);if(v.result==="error")throw new Error(v.value.map(E=>`${E.key}: ${E.message}`).join(", "));return v.value}{let v=d;return typeof d=="string"&&g.type==="color"&&(v=fs.parse(d)),{kind:"constant",evaluate:()=>v}}}(o===void 0?n.specification.default:o,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,o,d){return this.property.possiblyEvaluate(this,n,o,d)}}class Kt{constructor(n){this.property=n,this.value=new ji(n,void 0)}transitioned(n,o){return new di(this.property,this.value,o,Ve({},n.transition,this.transition),n.now)}untransitioned(){return new di(this.property,this.value,null,{},0)}}class Bi{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return Wt(this._values[n].value.value)}setValue(n,o){this._values.hasOwnProperty(n)||(this._values[n]=new Kt(this._values[n].property)),this._values[n].value=new ji(this._values[n].property,o===null?void 0:Wt(o))}getTransition(n){return Wt(this._values[n].transition)}setTransition(n,o){this._values.hasOwnProperty(n)||(this._values[n]=new Kt(this._values[n].property)),this._values[n].transition=Wt(o)||void 0}serialize(){const n={};for(const o of Object.keys(this._values)){const d=this.getValue(o);d!==void 0&&(n[o]=d);const g=this.getTransition(o);g!==void 0&&(n[`${o}-transition`]=g)}return n}transitioned(n,o){const d=new Ri(this._properties);for(const g of Object.keys(this._values))d._values[g]=this._values[g].transitioned(n,o._values[g]);return d}untransitioned(){const n=new Ri(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].untransitioned();return n}}class di{constructor(n,o,d,g,v){const E=g.delay||0,L=g.duration||0;v=v||0,this.property=n,this.value=o,this.begin=v+E,this.end=this.begin+L,n.specification.transition&&(g.delay||g.duration)&&(this.prior=d)}possiblyEvaluate(n,o,d){const g=n.now||0,v=this.value.possiblyEvaluate(n,o,d),E=this.prior;if(E){if(g>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(g<this.begin)return E.possiblyEvaluate(n,o,d);{const L=(g-this.begin)/(this.end-this.begin);return this.property.interpolate(E.possiblyEvaluate(n,o,d),v,Ci(L))}}return v}}class Ri{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,o,d){const g=new $i(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].possiblyEvaluate(n,o,d);return g}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class Ai{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}getValue(n){return Wt(this._values[n].value)}setValue(n,o){this._values[n]=new ji(this._values[n].property,o===null?void 0:Wt(o))}serialize(){const n={};for(const o of Object.keys(this._values)){const d=this.getValue(o);d!==void 0&&(n[o]=d)}return n}possiblyEvaluate(n,o,d){const g=new $i(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].possiblyEvaluate(n,o,d);return g}}class Mi{constructor(n,o,d){this.property=n,this.value=o,this.parameters=d}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,o,d,g){return this.property.evaluate(this.value,this.parameters,n,o,d,g)}}class $i{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class Jt{constructor(n){this.specification=n}possiblyEvaluate(n,o){return n.expression.evaluate(o)}interpolate(n,o,d){const g=yu[this.specification.type];return g?g(n,o,d):n}}class pi{constructor(n,o){this.specification=n,this.overrides=o}possiblyEvaluate(n,o,d,g){return new Mi(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(o,null,{},d,g)}:n.expression,o)}interpolate(n,o,d){if(n.value.kind!=="constant"||o.value.kind!=="constant")return n;if(n.value.value===void 0||o.value.value===void 0)return new Mi(this,{kind:"constant",value:void 0},n.parameters);const g=yu[this.specification.type];return g?new Mi(this,{kind:"constant",value:g(n.value.value,o.value.value,d)},n.parameters):n}evaluate(n,o,d,g,v,E){return n.kind==="constant"?n.value:n.evaluate(o,d,g,v,E)}}class In{constructor(n){this.specification=n}possiblyEvaluate(n,o,d,g){return!!n.expression.evaluate(o,null,{},d,g)}interpolate(){return!1}}class Hn{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const o=new qt(0,{});for(const d in n){const g=n[d];g.specification.overridable&&this.overridableProperties.push(d);const v=this.defaultPropertyValues[d]=new ji(g,void 0),E=this.defaultTransitionablePropertyValues[d]=new Kt(g);this.defaultTransitioningPropertyValues[d]=E.untransitioned(),this.defaultPossiblyEvaluatedValues[d]=v.possiblyEvaluate(o)}}}function Mn(s,n){return 256*(s=ye(Math.floor(s),0,255))+ye(Math.floor(n),0,255)}zt(pi,"DataDrivenProperty"),zt(Jt,"DataConstantProperty"),zt(In,"ColorRampProperty");const $n={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ar{constructor(n,o){this._structArray=n,this._pos1=o*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class On{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,o){return n._trim(),o&&(n.isTransferred=!0,o.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const o=Object.create(this.prototype);return o.arrayBuffer=n.arrayBuffer,o.length=n.length,o.capacity=n.arrayBuffer.byteLength/o.bytesPerElement,o._refreshViews(),o}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const o=this.uint8;this._refreshViews(),o&&this.uint8.set(o)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function _n(s,n=1){let o=0,d=0;return{members:s.map(g=>{const v=$n[g.type].BYTES_PER_ELEMENT,E=o=Dr(o,Math.max(n,v)),L=g.components||1;return d=Math.max(d,v),o+=v*L,{name:g.name,type:g.type,components:L,offset:E}}),size:Dr(o,Math.max(d,n)),alignment:n}}function Dr(s,n){return Math.ceil(s/n)*n}class Or extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o){const d=this.length;return this.resize(d+1),this.emplace(d,n,o)}emplace(n,o,d){const g=2*n;return this.int16[g+0]=o,this.int16[g+1]=d,n}}Or.prototype.bytesPerElement=4,zt(Or,"StructArrayLayout2i4");class Nr extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d){const g=this.length;return this.resize(g+1),this.emplace(g,n,o,d)}emplace(n,o,d,g){const v=3*n;return this.int16[v+0]=o,this.int16[v+1]=d,this.int16[v+2]=g,n}}Nr.prototype.bytesPerElement=6,zt(Nr,"StructArrayLayout3i6");class Qr extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=4*n;return this.int16[E+0]=o,this.int16[E+1]=d,this.int16[E+2]=g,this.int16[E+3]=v,n}}Qr.prototype.bytesPerElement=8,zt(Qr,"StructArrayLayout4i8");class go extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L){const k=this.length;return this.resize(k+1),this.emplace(k,n,o,d,g,v,E,L)}emplace(n,o,d,g,v,E,L,k){const V=6*n,q=12*n,se=3*n;return this.int16[V+0]=o,this.int16[V+1]=d,this.uint8[q+4]=g,this.uint8[q+5]=v,this.uint8[q+6]=E,this.uint8[q+7]=L,this.float32[se+2]=k,n}}go.prototype.bytesPerElement=12,zt(go,"StructArrayLayout2i4ub1f12");class Ca extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=4*n;return this.float32[E+0]=o,this.float32[E+1]=d,this.float32[E+2]=g,this.float32[E+3]=v,n}}Ca.prototype.bytesPerElement=16,zt(Ca,"StructArrayLayout4f16");class jo extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v){const E=this.length;return this.resize(E+1),this.emplace(E,n,o,d,g,v)}emplace(n,o,d,g,v,E){const L=6*n,k=3*n;return this.uint16[L+0]=o,this.uint16[L+1]=d,this.uint16[L+2]=g,this.uint16[L+3]=v,this.float32[k+2]=E,n}}jo.prototype.bytesPerElement=12,zt(jo,"StructArrayLayout4ui1f12");class ws extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=4*n;return this.uint16[E+0]=o,this.uint16[E+1]=d,this.uint16[E+2]=g,this.uint16[E+3]=v,n}}ws.prototype.bytesPerElement=8,zt(ws,"StructArrayLayout4ui8");class _r extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E){const L=this.length;return this.resize(L+1),this.emplace(L,n,o,d,g,v,E)}emplace(n,o,d,g,v,E,L){const k=6*n;return this.int16[k+0]=o,this.int16[k+1]=d,this.int16[k+2]=g,this.int16[k+3]=v,this.int16[k+4]=E,this.int16[k+5]=L,n}}_r.prototype.bytesPerElement=12,zt(_r,"StructArrayLayout6i12");class Xr extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L,k,V,q,se,he){const _e=this.length;return this.resize(_e+1),this.emplace(_e,n,o,d,g,v,E,L,k,V,q,se,he)}emplace(n,o,d,g,v,E,L,k,V,q,se,he,_e){const be=12*n;return this.int16[be+0]=o,this.int16[be+1]=d,this.int16[be+2]=g,this.int16[be+3]=v,this.uint16[be+4]=E,this.uint16[be+5]=L,this.uint16[be+6]=k,this.uint16[be+7]=V,this.int16[be+8]=q,this.int16[be+9]=se,this.int16[be+10]=he,this.int16[be+11]=_e,n}}Xr.prototype.bytesPerElement=24,zt(Xr,"StructArrayLayout4i4ui4i24");class Fr extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E){const L=this.length;return this.resize(L+1),this.emplace(L,n,o,d,g,v,E)}emplace(n,o,d,g,v,E,L){const k=10*n,V=5*n;return this.int16[k+0]=o,this.int16[k+1]=d,this.int16[k+2]=g,this.float32[V+2]=v,this.float32[V+3]=E,this.float32[V+4]=L,n}}Fr.prototype.bytesPerElement=20,zt(Fr,"StructArrayLayout3i3f20");class Ls extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const o=this.length;return this.resize(o+1),this.emplace(o,n)}emplace(n,o){return this.uint32[1*n+0]=o,n}}Ls.prototype.bytesPerElement=4,zt(Ls,"StructArrayLayout1ul4");class eo extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L,k,V,q,se,he,_e){const be=this.length;return this.resize(be+1),this.emplace(be,n,o,d,g,v,E,L,k,V,q,se,he,_e)}emplace(n,o,d,g,v,E,L,k,V,q,se,he,_e,be){const De=20*n,Ze=10*n;return this.int16[De+0]=o,this.int16[De+1]=d,this.int16[De+2]=g,this.int16[De+3]=v,this.int16[De+4]=E,this.float32[Ze+3]=L,this.float32[Ze+4]=k,this.float32[Ze+5]=V,this.float32[Ze+6]=q,this.int16[De+14]=se,this.uint32[Ze+8]=he,this.uint16[De+18]=_e,this.uint16[De+19]=be,n}}eo.prototype.bytesPerElement=40,zt(eo,"StructArrayLayout5i4f1i1ul2ui40");class rs extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L){const k=this.length;return this.resize(k+1),this.emplace(k,n,o,d,g,v,E,L)}emplace(n,o,d,g,v,E,L,k){const V=8*n;return this.int16[V+0]=o,this.int16[V+1]=d,this.int16[V+2]=g,this.int16[V+4]=v,this.int16[V+5]=E,this.int16[V+6]=L,this.int16[V+7]=k,n}}rs.prototype.bytesPerElement=16,zt(rs,"StructArrayLayout3i2i2i16");class Io extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v){const E=this.length;return this.resize(E+1),this.emplace(E,n,o,d,g,v)}emplace(n,o,d,g,v,E){const L=4*n,k=8*n;return this.float32[L+0]=o,this.float32[L+1]=d,this.float32[L+2]=g,this.int16[k+6]=v,this.int16[k+7]=E,n}}Io.prototype.bytesPerElement=16,zt(Io,"StructArrayLayout2f1f2i16");class bu extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=12*n,L=3*n;return this.uint8[E+0]=o,this.uint8[E+1]=d,this.float32[L+1]=g,this.float32[L+2]=v,n}}bu.prototype.bytesPerElement=12,zt(bu,"StructArrayLayout2ub2f12");class Ka extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d){const g=this.length;return this.resize(g+1),this.emplace(g,n,o,d)}emplace(n,o,d,g){const v=3*n;return this.float32[v+0]=o,this.float32[v+1]=d,this.float32[v+2]=g,n}}Ka.prototype.bytesPerElement=12,zt(Ka,"StructArrayLayout3f12");class _o extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d){const g=this.length;return this.resize(g+1),this.emplace(g,n,o,d)}emplace(n,o,d,g){const v=3*n;return this.uint16[v+0]=o,this.uint16[v+1]=d,this.uint16[v+2]=g,n}}_o.prototype.bytesPerElement=6,zt(_o,"StructArrayLayout3ui6");class Ea extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L,k,V,q,se,he,_e,be,De,Ze,xt,Dt,_t,Tt,kt){const Ut=this.length;return this.resize(Ut+1),this.emplace(Ut,n,o,d,g,v,E,L,k,V,q,se,he,_e,be,De,Ze,xt,Dt,_t,Tt,kt)}emplace(n,o,d,g,v,E,L,k,V,q,se,he,_e,be,De,Ze,xt,Dt,_t,Tt,kt,Ut){const ci=30*n,ai=15*n,Ti=60*n;return this.int16[ci+0]=o,this.int16[ci+1]=d,this.int16[ci+2]=g,this.float32[ai+2]=v,this.float32[ai+3]=E,this.uint16[ci+8]=L,this.uint16[ci+9]=k,this.uint32[ai+5]=V,this.uint32[ai+6]=q,this.uint32[ai+7]=se,this.uint16[ci+16]=he,this.uint16[ci+17]=_e,this.uint16[ci+18]=be,this.float32[ai+10]=De,this.float32[ai+11]=Ze,this.uint8[Ti+48]=xt,this.uint8[Ti+49]=Dt,this.uint8[Ti+50]=_t,this.uint32[ai+13]=Tt,this.int16[ci+28]=kt,this.uint8[Ti+58]=Ut,n}}Ea.prototype.bytesPerElement=60,zt(Ea,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class vl extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L,k,V,q,se,he,_e,be,De,Ze,xt,Dt,_t,Tt,kt,Ut,ci,ai,Ti,Ki,_i,Si,Li,Vi){const Zi=this.length;return this.resize(Zi+1),this.emplace(Zi,n,o,d,g,v,E,L,k,V,q,se,he,_e,be,De,Ze,xt,Dt,_t,Tt,kt,Ut,ci,ai,Ti,Ki,_i,Si,Li,Vi)}emplace(n,o,d,g,v,E,L,k,V,q,se,he,_e,be,De,Ze,xt,Dt,_t,Tt,kt,Ut,ci,ai,Ti,Ki,_i,Si,Li,Vi,Zi){const yi=38*n,sn=19*n;return this.int16[yi+0]=o,this.int16[yi+1]=d,this.int16[yi+2]=g,this.float32[sn+2]=v,this.float32[sn+3]=E,this.int16[yi+8]=L,this.int16[yi+9]=k,this.int16[yi+10]=V,this.int16[yi+11]=q,this.int16[yi+12]=se,this.int16[yi+13]=he,this.uint16[yi+14]=_e,this.uint16[yi+15]=be,this.uint16[yi+16]=De,this.uint16[yi+17]=Ze,this.uint16[yi+18]=xt,this.uint16[yi+19]=Dt,this.uint16[yi+20]=_t,this.uint16[yi+21]=Tt,this.uint16[yi+22]=kt,this.uint16[yi+23]=Ut,this.uint16[yi+24]=ci,this.uint16[yi+25]=ai,this.uint16[yi+26]=Ti,this.uint16[yi+27]=Ki,this.uint16[yi+28]=_i,this.uint32[sn+15]=Si,this.float32[sn+16]=Li,this.float32[sn+17]=Vi,this.float32[sn+18]=Zi,n}}vl.prototype.bytesPerElement=76,zt(vl,"StructArrayLayout3i2f6i15ui1ul3f76");class Zl extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const o=this.length;return this.resize(o+1),this.emplace(o,n)}emplace(n,o){return this.float32[1*n+0]=o,n}}Zl.prototype.bytesPerElement=4,zt(Zl,"StructArrayLayout1f4");class $h extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v){const E=this.length;return this.resize(E+1),this.emplace(E,n,o,d,g,v)}emplace(n,o,d,g,v,E){const L=5*n;return this.float32[L+0]=o,this.float32[L+1]=d,this.float32[L+2]=g,this.float32[L+3]=v,this.float32[L+4]=E,n}}$h.prototype.bytesPerElement=20,zt($h,"StructArrayLayout5f20");class Zh extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=6*n;return this.uint32[3*n+0]=o,this.uint16[E+2]=d,this.uint16[E+3]=g,this.uint16[E+4]=v,n}}Zh.prototype.bytesPerElement=12,zt(Zh,"StructArrayLayout1ul3ui12");class $a extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o){const d=this.length;return this.resize(d+1),this.emplace(d,n,o)}emplace(n,o,d){const g=2*n;return this.uint16[g+0]=o,this.uint16[g+1]=d,n}}$a.prototype.bytesPerElement=4,zt($a,"StructArrayLayout2ui4");class Xh extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const o=this.length;return this.resize(o+1),this.emplace(o,n)}emplace(n,o){return this.uint16[1*n+0]=o,n}}Xh.prototype.bytesPerElement=2,zt(Xh,"StructArrayLayout1ui2");class da extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o){const d=this.length;return this.resize(d+1),this.emplace(d,n,o)}emplace(n,o,d){const g=2*n;return this.float32[g+0]=o,this.float32[g+1]=d,n}}da.prototype.bytesPerElement=8,zt(da,"StructArrayLayout2f8");class sg extends ar{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}sg.prototype.size=40;class og extends eo{get(n){return new sg(this,n)}}zt(og,"CollisionBoxArray");class Sy extends ar{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(n){this._structArray.uint8[this._pos1+49]=n}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(n){this._structArray.uint8[this._pos1+50]=n}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(n){this._structArray.uint32[this._pos4+13]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(n){this._structArray.uint8[this._pos1+58]=n}}Sy.prototype.size=60;class My extends Ea{get(n){return new Sy(this,n)}}zt(My,"PlacedSymbolArray");class dp extends ar{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(n){this._structArray.uint32[this._pos4+15]=n}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}dp.prototype.size=76;class pp extends vl{get(n){return new dp(this,n)}}zt(pp,"SymbolInstanceArray");class ag extends Zl{getoffsetX(n){return this.float32[1*n+0]}}zt(ag,"GlyphOffsetArray");class Bu extends Or{getx(n){return this.int16[2*n+0]}gety(n){return this.int16[2*n+1]}}zt(Bu,"SymbolLineVertexArray");class ad extends ar{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}ad.prototype.size=12;class Iy extends Zh{get(n){return new ad(this,n)}}zt(Iy,"FeatureIndexArray");class Fy extends $a{geta_centroid_pos0(n){return this.uint16[2*n+0]}geta_centroid_pos1(n){return this.uint16[2*n+1]}}zt(Fy,"FillExtrusionCentroidArray");const r1=_n([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),s1=_n([{name:"a_dash",components:4,type:"Uint16"}]);var ld={exports:{}},Ly={exports:{}};Ly.exports=function(s,n){var o,d,g,v,E,L,k,V;for(d=s.length-(o=3&s.length),g=n,E=3432918353,L=461845907,V=0;V<d;)k=255&s.charCodeAt(V)|(255&s.charCodeAt(++V))<<8|(255&s.charCodeAt(++V))<<16|(255&s.charCodeAt(++V))<<24,++V,g=27492+(65535&(v=5*(65535&(g=(g^=k=(65535&(k=(k=(65535&k)*E+(((k>>>16)*E&65535)<<16)&4294967295)<<15|k>>>17))*L+(((k>>>16)*L&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(k=0,o){case 3:k^=(255&s.charCodeAt(V+2))<<16;case 2:k^=(255&s.charCodeAt(V+1))<<8;case 1:g^=k=(65535&(k=(k=(65535&(k^=255&s.charCodeAt(V)))*E+(((k>>>16)*E&65535)<<16)&4294967295)<<15|k>>>17))*L+(((k>>>16)*L&65535)<<16)&4294967295}return g^=s.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var Dy={exports:{}};Dy.exports=function(s,n){for(var o,d=s.length,g=n^d,v=0;d>=4;)o=1540483477*(65535&(o=255&s.charCodeAt(v)|(255&s.charCodeAt(++v))<<8|(255&s.charCodeAt(++v))<<16|(255&s.charCodeAt(++v))<<24))+((1540483477*(o>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),d-=4,++v;switch(d){case 3:g^=(255&s.charCodeAt(v+2))<<16;case 2:g^=(255&s.charCodeAt(v+1))<<8;case 1:g=1540483477*(65535&(g^=255&s.charCodeAt(v)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var Cf=Ly.exports,o1=Dy.exports;ld.exports=Cf,ld.exports.murmur3=Cf,ld.exports.murmur2=o1;class qh{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,o,d,g){this.ids.push(Py(n)),this.positions.push(o,d,g)}getPositions(n){const o=Py(n);let d=0,g=this.ids.length-1;for(;d<g;){const E=d+g>>1;this.ids[E]>=o?g=E:d=E+1}const v=[];for(;this.ids[d]===o;)v.push({index:this.positions[3*d],start:this.positions[3*d+1],end:this.positions[3*d+2]}),d++;return v}static serialize(n,o){const d=new Float64Array(n.ids),g=new Uint32Array(n.positions);return Ds(d,g,0,d.length-1),o&&o.push(d.buffer,g.buffer),{ids:d,positions:g}}static deserialize(n){const o=new qh;return o.ids=n.ids,o.positions=n.positions,o.indexed=!0,o}}function Py(s){const n=+s;return!isNaN(n)&&Number.MIN_SAFE_INTEGER<=n&&n<=Number.MAX_SAFE_INTEGER?n:ld.exports(String(s))}function Ds(s,n,o,d){for(;o<d;){const g=s[o+d>>1];let v=o-1,E=d+1;for(;;){do v++;while(s[v]<g);do E--;while(s[E]>g);if(v>=E)break;fA(s,v,E),fA(n,3*v,3*E),fA(n,3*v+1,3*E+1),fA(n,3*v+2,3*E+2)}E-o<d-E?(Ds(s,n,o,E),o=E+1):(Ds(s,n,E+1,d),d=E)}}function fA(s,n,o){const d=s[n];s[n]=s[o],s[o]=d}zt(qh,"FeaturePositionMap");class oh{constructor(n){this.gl=n.gl,this.initialized=!1}fetchUniformLocation(n,o){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(n,o),this.initialized=!0),!!this.location}}class mA extends oh{constructor(n){super(n),this.current=0}set(n,o,d){this.fetchUniformLocation(n,o)&&this.current!==d&&(this.current=d,this.gl.uniform1f(this.location,d))}}class fp extends oh{constructor(n){super(n),this.current=[0,0,0,0]}set(n,o,d){this.fetchUniformLocation(n,o)&&(d[0]===this.current[0]&&d[1]===this.current[1]&&d[2]===this.current[2]&&d[3]===this.current[3]||(this.current=d,this.gl.uniform4f(this.location,d[0],d[1],d[2],d[3])))}}class cd extends oh{constructor(n){super(n),this.current=fs.transparent}set(n,o,d){this.fetchUniformLocation(n,o)&&(d.r===this.current.r&&d.g===this.current.g&&d.b===this.current.b&&d.a===this.current.a||(this.current=d,this.gl.uniform4f(this.location,d.r,d.g,d.b,d.a)))}}const Uy=new Float32Array(16),Ry=new Float32Array(9),mp=new Float32Array(4);function gp(s){return[Mn(255*s.r,255*s.g),Mn(255*s.b,255*s.a)]}class gA{constructor(n,o,d){this.value=n,this.uniformNames=o.map(g=>`u_${g}`),this.type=d}setUniform(n,o,d,g,v){o.set(n,v,g.constantOr(this.value))}getBinding(n,o){return this.type==="color"?new cd(n):new mA(n)}}class hd{constructor(n,o){this.uniformNames=o.map(d=>`u_${d}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(n){this.pixelRatio=n.pixelRatio||1,this.pattern=n.tl.concat(n.br)}setUniform(n,o,d,g,v){const E=v==="u_pattern"||v==="u_dash"?this.pattern:v==="u_pixel_ratio"?this.pixelRatio:null;E&&o.set(n,v,E)}getBinding(n,o){return o==="u_pattern"||o==="u_dash"?new fp(n):new mA(n)}}class ah{constructor(n,o,d,g){this.expression=n,this.type=d,this.maxValue=0,this.paintVertexAttributes=o.map(v=>({name:`a_${v}`,type:"Float32",components:d==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(n,o,d,g,v,E){const L=this.paintVertexArray.length,k=this.expression.evaluate(new qt(0),o,{},v,g,E);this.paintVertexArray.resize(n),this._setPaintValue(L,n,k)}updatePaintArray(n,o,d,g,v){const E=this.expression.evaluate({zoom:0},d,g,void 0,v);this._setPaintValue(n,o,E)}_setPaintValue(n,o,d){if(this.type==="color"){const g=gp(d);for(let v=n;v<o;v++)this.paintVertexArray.emplace(v,g[0],g[1])}else{for(let g=n;g<o;g++)this.paintVertexArray.emplace(g,d);this.maxValue=Math.max(this.maxValue,Math.abs(d))}}upload(n){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=n.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ta{constructor(n,o,d,g,v,E){this.expression=n,this.uniformNames=o.map(L=>`u_${L}_t`),this.type=d,this.useIntegerZoom=g,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=o.map(L=>({name:`a_${L}`,type:"Float32",components:d==="color"?4:2,offset:0})),this.paintVertexArray=new E}populatePaintArray(n,o,d,g,v,E){const L=this.expression.evaluate(new qt(this.zoom),o,{},v,g,E),k=this.expression.evaluate(new qt(this.zoom+1),o,{},v,g,E),V=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(V,n,L,k)}updatePaintArray(n,o,d,g,v){const E=this.expression.evaluate({zoom:this.zoom},d,g,void 0,v),L=this.expression.evaluate({zoom:this.zoom+1},d,g,void 0,v);this._setPaintValue(n,o,E,L)}_setPaintValue(n,o,d,g){if(this.type==="color"){const v=gp(d),E=gp(g);for(let L=n;L<o;L++)this.paintVertexArray.emplace(L,v[0],v[1],E[0],E[1])}else{for(let v=n;v<o;v++)this.paintVertexArray.emplace(v,d,g);this.maxValue=Math.max(this.maxValue,Math.abs(d),Math.abs(g))}}upload(n){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=n.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(n,o,d,g,v){const E=this.useIntegerZoom?Math.floor(d.zoom):d.zoom,L=ye(this.expression.interpolationFactor(E,this.zoom,this.zoom+1),0,1);o.set(n,v,L)}getBinding(n,o){return new mA(n)}}class Cu{constructor(n,o,d,g,v){this.expression=n,this.layerId=v,this.paintVertexAttributes=(d==="array"?s1:r1).members;for(let E=0;E<o.length;++E);this.paintVertexArray=new g}populatePaintArray(n,o,d){const g=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValues(g,n,o.patterns&&o.patterns[this.layerId],d)}updatePaintArray(n,o,d,g,v,E){this._setPaintValues(n,o,d.patterns&&d.patterns[this.layerId],E)}_setPaintValues(n,o,d,g){if(!g||!d)return;const v=g[d];if(!v)return;const{tl:E,br:L,pixelRatio:k}=v;for(let V=n;V<o;V++)this.paintVertexArray.emplace(V,E[0],E[1],L[0],L[1],k)}upload(n){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=n.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class lh{constructor(n,o,d=()=>!0){this.binders={},this._buffers=[];const g=[];for(const v in n.paint._values){if(!d(v))continue;const E=n.paint.get(v);if(!(E instanceof Mi&&gl(E.property.specification)))continue;const L=cg(v,n.type),k=E.value,V=E.property.specification.type,q=E.property.useIntegerZoom,se=v==="line-dasharray"||v.endsWith("pattern"),he=v==="line-dasharray"&&n.layout.get("line-cap").value.kind!=="constant";if(k.kind!=="constant"||he)if(k.kind==="source"||he||se){const _e=zy(v,V,"source");this.binders[v]=se?new Cu(k,L,V,_e,n.id):new ah(k,L,V,_e),g.push(`/a_${v}`)}else{const _e=zy(v,V,"composite");this.binders[v]=new Ta(k,L,V,q,o,_e),g.push(`/z_${v}`)}else this.binders[v]=se?new hd(k.value,L):new gA(k.value,L,V),g.push(`/u_${v}`)}this.cacheKey=g.sort().join("")}getMaxValue(n){const o=this.binders[n];return o instanceof ah||o instanceof Ta?o.maxValue:0}populatePaintArrays(n,o,d,g,v,E){for(const L in this.binders){const k=this.binders[L];(k instanceof ah||k instanceof Ta||k instanceof Cu)&&k.populatePaintArray(n,o,d,g,v,E)}}setConstantPatternPositions(n){for(const o in this.binders){const d=this.binders[o];d instanceof hd&&d.setConstantPatternPositions(n)}}updatePaintArrays(n,o,d,g,v,E){let L=!1;for(const k in n){const V=o.getPositions(k);for(const q of V){const se=d.feature(q.index);for(const he in this.binders){const _e=this.binders[he];if((_e instanceof ah||_e instanceof Ta||_e instanceof Cu)&&_e.expression.isStateDependent===!0){const be=g.paint.get(he);_e.expression=be.value,_e.updatePaintArray(q.start,q.end,se,n[k],v,E),L=!0}}}}return L}defines(){const n=[];for(const o in this.binders){const d=this.binders[o];(d instanceof gA||d instanceof hd)&&n.push(...d.uniformNames.map(g=>`#define HAS_UNIFORM_${g}`))}return n}getBinderAttributes(){const n=[];for(const o in this.binders){const d=this.binders[o];if(d instanceof ah||d instanceof Ta||d instanceof Cu)for(let g=0;g<d.paintVertexAttributes.length;g++)n.push(d.paintVertexAttributes[g].name)}return n}getBinderUniforms(){const n=[];for(const o in this.binders){const d=this.binders[o];if(d instanceof gA||d instanceof hd||d instanceof Ta)for(const g of d.uniformNames)n.push(g)}return n}getPaintVertexBuffers(){return this._buffers}getUniforms(n){const o=[];for(const d in this.binders){const g=this.binders[d];if(g instanceof gA||g instanceof hd||g instanceof Ta)for(const v of g.uniformNames)o.push({name:v,property:d,binding:g.getBinding(n,v)})}return o}setUniforms(n,o,d,g,v){for(const{name:E,property:L,binding:k}of d)this.binders[L].setUniform(n,k,v,g.get(L),E)}updatePaintBuffers(){this._buffers=[];for(const n in this.binders){const o=this.binders[n];(o instanceof ah||o instanceof Ta||o instanceof Cu)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(n){for(const o in this.binders){const d=this.binders[o];(d instanceof ah||d instanceof Ta||d instanceof Cu)&&d.upload(n)}this.updatePaintBuffers()}destroy(){for(const n in this.binders){const o=this.binders[n];(o instanceof ah||o instanceof Ta||o instanceof Cu)&&o.destroy()}}}class _A{constructor(n,o,d=()=>!0){this.programConfigurations={};for(const g of n)this.programConfigurations[g.id]=new lh(g,o,d);this.needsUpload=!1,this._featureMap=new qh,this._bufferOffset=0}populatePaintArrays(n,o,d,g,v,E,L){for(const k in this.programConfigurations)this.programConfigurations[k].populatePaintArrays(n,o,g,v,E,L);o.id!==void 0&&this._featureMap.add(o.id,d,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,o,d,g,v){for(const E of d)this.needsUpload=this.programConfigurations[E.id].updatePaintArrays(n,this._featureMap,o,E,g,v)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const o in this.programConfigurations)this.programConfigurations[o].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}const lg={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function cg(s,n){return lg[s]||[s.replace(`${n}-`,"").replace(/-/g,"_")]}const hg={"line-pattern":{source:jo,composite:jo},"fill-pattern":{source:jo,composite:jo},"fill-extrusion-pattern":{source:jo,composite:jo},"line-dasharray":{source:ws,composite:ws}},a1={color:{source:da,composite:Ca},number:{source:Zl,composite:da}};function zy(s,n,o){const d=hg[s];return d&&d[o]||a1[n][o]}zt(gA,"ConstantBinder"),zt(hd,"PatternConstantBinder"),zt(ah,"SourceExpressionBinder"),zt(Cu,"PatternCompositeBinder"),zt(Ta,"CompositeExpressionBinder"),zt(lh,"ProgramConfiguration",{omit:["_buffers"]}),zt(_A,"ProgramConfigurationSet");const Ef="-transition";class xc extends yn{constructor(n,o){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&n.type!=="sky"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),o.layout&&(this._unevaluatedLayout=new Ai(o.layout)),o.paint)){this._transitionablePaint=new Bi(o.paint);for(const d in n.paint)this.setPaintProperty(d,n.paint[d],{validate:!1});for(const d in n.layout)this.setLayoutProperty(d,n.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new $i(o.paint)}}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,o,d={}){o!=null&&this._validate(mt,`layers.${this.id}.layout.${n}`,n,o,d)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,o):this.visibility=o)}getPaintProperty(n){return dt(n,Ef)?this._transitionablePaint.getTransition(n.slice(0,-Ef.length)):this._transitionablePaint.getValue(n)}setPaintProperty(n,o,d={}){if(o!=null&&this._validate(bt,`layers.${this.id}.paint.${n}`,n,o,d))return!1;if(dt(n,Ef))return this._transitionablePaint.setTransition(n.slice(0,-Ef.length),o||void 0),!1;{const g=this._transitionablePaint._values[n],v=g.value.isDataDriven(),E=g.value;this._transitionablePaint.setValue(n,o),this._handleSpecialPaintPropertyUpdate(n);const L=this._transitionablePaint._values[n].value,k=L.isDataDriven(),V=dt(n,"pattern")||n==="line-dasharray";return k||v||V||this._handleOverridablePaintPropertyUpdate(n,E,L)}}_handleSpecialPaintPropertyUpdate(n){}getProgramIds(){return null}getProgramConfiguration(n){return null}_handleOverridablePaintPropertyUpdate(n,o,d){return!1}isHidden(n){return!!(this.minzoom&&n<this.minzoom)||!!(this.maxzoom&&n>=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,o){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,o)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,o)}serialize(){const n={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),Qt(n,(o,d)=>!(o===void 0||d==="layout"&&!Object.keys(o).length||d==="paint"&&!Object.keys(o).length))}_validate(n,o,d,g,v={}){return(!v||v.validate!==!1)&&Vt(this,n.call(We,{key:o,layerType:this.type,objectKey:d,value:g,styleSpec:Yt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const o=this.paint.get(n);if(o instanceof Mi&&gl(o.property.specification)&&(o.value.kind==="source"||o.value.kind==="composite")&&o.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=uo(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const l1=_n([{name:"a_pos",components:2,type:"Int16"}],4),Eu=_n([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class to{constructor(n=[]){this.segments=n}prepareSegment(n,o,d,g){let v=this.segments[this.segments.length-1];return n>to.MAX_VERTEX_ARRAY_LENGTH&&Ct(`Max vertices per segment is ${to.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!v||v.vertexLength+n>to.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==g)&&(v={vertexOffset:o.length,primitiveOffset:d.length,vertexLength:0,primitiveLength:0},g!==void 0&&(v.sortKey=g),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const n of this.segments)for(const o in n.vaos)n.vaos[o].destroy()}static simpleSegment(n,o,d,g){return new to([{vertexOffset:n,primitiveOffset:o,vertexLength:d,primitiveLength:g,vaos:{},sortKey:0}])}}to.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,zt(to,"SegmentVector");var Zn=8192;class wl{constructor(n,o){n&&(o?this.setSouthWest(n).setNorthEast(o):n.length===4?this.setSouthWest([n[0],n[1]]).setNorthEast([n[2],n[3]]):this.setSouthWest(n[0]).setNorthEast(n[1]))}setNorthEast(n){return this._ne=n instanceof Pr?new Pr(n.lng,n.lat):Pr.convert(n),this}setSouthWest(n){return this._sw=n instanceof Pr?new Pr(n.lng,n.lat):Pr.convert(n),this}extend(n){const o=this._sw,d=this._ne;let g,v;if(n instanceof Pr)g=n,v=n;else{if(!(n instanceof wl))return Array.isArray(n)?n.length===4||n.every(Array.isArray)?this.extend(wl.convert(n)):this.extend(Pr.convert(n)):typeof n=="object"&&n!==null&&n.hasOwnProperty("lat")&&n.hasOwnProperty("lon")?this.extend(Pr.convert(n)):this;if(g=n._sw,v=n._ne,!g||!v)return this}return o||d?(o.lng=Math.min(g.lng,o.lng),o.lat=Math.min(g.lat,o.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new Pr(g.lng,g.lat),this._ne=new Pr(v.lng,v.lat)),this}getCenter(){return new Pr((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Pr(this.getWest(),this.getNorth())}getSouthEast(){return new Pr(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(n){const{lng:o,lat:d}=Pr.convert(n);let g=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(n){return!n||n instanceof wl?n:new wl(n)}}const Tf=63710088e-1;class Pr{constructor(n,o){if(isNaN(n)||isNaN(o))throw new Error(`Invalid LngLat object: (${n}, ${o})`);if(this.lng=+n,this.lat=+o,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Pr(ze(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const o=Math.PI/180,d=this.lat*o,g=n.lat*o,v=Math.sin(d)*Math.sin(g)+Math.cos(d)*Math.cos(g)*Math.cos((n.lng-this.lng)*o);return Tf*Math.acos(Math.min(v,1))}toBounds(n=0){const o=360*n/40075017,d=o/Math.cos(Math.PI/180*this.lat);return new wl(new Pr(this.lng-d,this.lat-o),new Pr(this.lng+d,this.lat+o))}static convert(n){if(n instanceof Pr)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new Pr(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new Pr(Number("lng"in n?n.lng:n.lon),Number(n.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const ky=2*Math.PI*Tf;function Sf(s){return ky*Math.cos(s*Math.PI/180)}function vc(s){return(180+s)/360}function ch(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function Xl(s,n){return s/Sf(n)}function bl(s){return 360*s-180}function Fo(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}function Mf(s,n){return s*Sf(Fo(n))}const Za=85.051129;function If(s){return 1/Math.cos(s*Math.PI/180)}class ud{constructor(n,o,d=0){this.x=+n,this.y=+o,this.z=+d}static fromLngLat(n,o=0){const d=Pr.convert(n);return new ud(vc(d.lng),ch(d.lat),Xl(o,d.lat))}toLngLat(){return new Pr(bl(this.x),Fo(this.y))}toAltitude(){return Mf(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ky*If(Fo(this.y))}}function ug(s,n,o,d,g,v,E,L,k){const V=(n+d)/2,q=(o+g)/2,se=new me(V,q);L(se),function(he,_e,be,De,Ze,xt){const Dt=be-Ze,_t=De-xt;return Math.abs((De-_e)*Dt-(be-he)*_t)/Math.hypot(Dt,_t)}(se.x,se.y,v.x,v.y,E.x,E.y)>=k?(ug(s,n,o,V,q,v,se,L,k),ug(s,V,q,d,g,se,E,L,k)):s.push(E)}function Oy(s,n,o){let d=s[0],g=d.x,v=d.y;n(d);const E=[d];for(let L=1;L<s.length;L++){const k=s[L],{x:V,y:q}=k;n(k),ug(E,g,v,V,q,d,k,n,o),g=V,v=q,d=k}return E}function yA(s,n,o,d){if(d(n,o)){const g=n.add(o)._mult(.5);yA(s,n,g,d),yA(s,g,o,d)}else s.push(o)}function Ny(s,n){let o=s[0];const d=[o];for(let g=1;g<s.length;g++){const v=s[g];yA(d,o,v,n),o=v}return d}const Ag=Math.pow(2,14)-1,Qy=-Ag-1;function c1(s,n){const o=Math.round(s.x*n),d=Math.round(s.y*n);return s.x=ye(o,Qy,Ag),s.y=ye(d,Qy,Ag),(o<s.x||o>s.x+1||d<s.y||d>s.y+1)&&Ct("Geometry exceeds allowed extent, reduce your vector tile buffer size"),s}function Yh(s,n,o){const d=s.loadGeometry(),g=s.extent,v=Zn/g;if(n&&o&&o.projection.isReprojectedInTileSpace){const E=1<<n.z,{scale:L,x:k,y:V,projection:q}=o,se=he=>{const _e=bl((n.x+he.x/g)/E),be=Fo((n.y+he.y/g)/E),De=q.project(_e,be);he.x=(De.x*L-k)*g,he.y=(De.y*L-V)*g};for(let he=0;he<d.length;he++)if(s.type!==1)d[he]=Oy(d[he],se,1);else{const _e=[];for(const be of d[he])be.x<0||be.x>=g||be.y<0||be.y>=g||(se(be),_e.push(be));d[he]=_e}}for(const E of d)for(const L of E)c1(L,v);return d}function xA(s,n){return{type:s.type,id:s.id,properties:s.properties,geometry:n?Yh(s):[]}}function Ff(s,n,o,d,g){s.emplaceBack(2*n+(d+1)/2,2*o+(g+1)/2)}function _p(s,n,o){s.emplaceBack(n.x,n.y,n.z,o[0]*16384,o[1]*16384,o[2]*16384)}class yp{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(o=>o.id),this.index=n.index,this.hasPattern=!1,this.projection=n.projection,this.layoutVertexArray=new Or,this.indexArray=new _o,this.segments=new to,this.programConfigurations=new _A(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(n,o,d,g){const v=this.layers[0],E=[];let L=null;v.type==="circle"&&(L=v.layout.get("circle-sort-key"));for(const{feature:V,id:q,index:se,sourceLayerIndex:he}of n){const _e=this.layers[0]._featureFilter.needGeometry,be=xA(V,_e);if(!this.layers[0]._featureFilter.filter(new qt(this.zoom),be,d))continue;const De=L?L.evaluate(be,{},d):void 0,Ze={id:q,properties:V.properties,type:V.type,sourceLayerIndex:he,index:se,geometry:_e?be.geometry:Yh(V,d,g),patterns:{},sortKey:De};E.push(Ze)}L&&E.sort((V,q)=>V.sortKey-q.sortKey);let k=null;g.projection.name==="globe"&&(this.globeExtVertexArray=new _r,k=g.projection);for(const V of E){const{geometry:q,index:se,sourceLayerIndex:he}=V,_e=n[se].feature;this.addFeature(V,q,se,o.availableImages,d,k),o.featureIndex.insert(_e,q,se,he,this.index)}}update(n,o,d,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,o,this.stateDependentLayers,d,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,l1.members),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=n.createVertexBuffer(this.globeExtVertexArray,Eu.members))),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(n,o,d,g,v,E){for(const L of o)for(const k of L){const V=k.x,q=k.y;if(V<0||V>=Zn||q<0||q>=Zn)continue;if(E){const _e=E.projectTilePoint(V,q,v),be=E.upVector(v,V,q),De=this.globeExtVertexArray;_p(De,_e,be),_p(De,_e,be),_p(De,_e,be),_p(De,_e,be)}const se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),he=se.vertexLength;Ff(this.layoutVertexArray,V,q,-1,-1),Ff(this.layoutVertexArray,V,q,1,-1),Ff(this.layoutVertexArray,V,q,1,1),Ff(this.layoutVertexArray,V,q,-1,1),this.indexArray.emplaceBack(he,he+1,he+2),this.indexArray.emplaceBack(he,he+2,he+3),se.vertexLength+=4,se.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,{},g,v)}}function Vy(s,n){for(let o=0;o<s.length;o++)if(vA(n,s[o]))return!0;for(let o=0;o<n.length;o++)if(vA(s,n[o]))return!0;return!!pg(s,n)}function Hy(s,n,o){return!!vA(s,n)||!!fg(n,s,o)}function dg(s,n){if(s.length===1)return Wy(n,s[0]);for(let o=0;o<n.length;o++){const d=n[o];for(let g=0;g<d.length;g++)if(vA(s,d[g]))return!0}for(let o=0;o<s.length;o++)if(Wy(n,s[o]))return!0;for(let o=0;o<n.length;o++)if(pg(s,n[o]))return!0;return!1}function Gy(s,n,o){if(s.length>1){if(pg(s,n))return!0;for(let d=0;d<n.length;d++)if(fg(n[d],s,o))return!0}for(let d=0;d<s.length;d++)if(fg(s[d],n,o))return!0;return!1}function pg(s,n){if(s.length===0||n.length===0)return!1;for(let o=0;o<s.length-1;o++){const d=s[o],g=s[o+1];for(let v=0;v<n.length-1;v++)if(h1(d,g,n[v],n[v+1]))return!0}return!1}function h1(s,n,o,d){return Ft(s,o,d)!==Ft(n,o,d)&&Ft(s,n,o)!==Ft(s,n,d)}function fg(s,n,o){const d=o*o;if(n.length===1)return s.distSqr(n[0])<d;for(let g=1;g<n.length;g++)if(mg(s,n[g-1],n[g])<d)return!0;return!1}function mg(s,n,o){const d=n.distSqr(o);if(d===0)return s.distSqr(n);const g=((s.x-n.x)*(o.x-n.x)+(s.y-n.y)*(o.y-n.y))/d;return s.distSqr(g<0?n:g>1?o:o.sub(n)._mult(g)._add(n))}function Wy(s,n){let o,d,g,v=!1;for(let E=0;E<s.length;E++){o=s[E];for(let L=0,k=o.length-1;L<o.length;k=L++)d=o[L],g=o[k],d.y>n.y!=g.y>n.y&&n.x<(g.x-d.x)*(n.y-d.y)/(g.y-d.y)+d.x&&(v=!v)}return v}function vA(s,n){let o=!1;for(let d=0,g=s.length-1;d<s.length;g=d++){const v=s[d],E=s[g];v.y>n.y!=E.y>n.y&&n.x<(E.x-v.x)*(n.y-v.y)/(E.y-v.y)+v.x&&(o=!o)}return o}function Ad(s,n,o,d,g){for(const E of s)if(n<=E.x&&o<=E.y&&d>=E.x&&g>=E.y)return!0;const v=[new me(n,o),new me(n,g),new me(d,g),new me(d,o)];if(s.length>2){for(const E of v)if(vA(s,E))return!0}for(let E=0;E<s.length-1;E++)if(yo(s[E],s[E+1],v))return!0;return!1}function yo(s,n,o){const d=o[0],g=o[2];if(s.x<d.x&&n.x<d.x||s.x>g.x&&n.x>g.x||s.y<d.y&&n.y<d.y||s.y>g.y&&n.y>g.y)return!1;const v=Ft(s,n,o[0]);return v!==Ft(s,n,o[1])||v!==Ft(s,n,o[2])||v!==Ft(s,n,o[3])}function Tu(s,n,o){const d=n.paint.get(s).value;return d.kind==="constant"?d.value:o.programConfigurations.get(n.id).getMaxValue(s)}function xp(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function gg(s,n,o,d,g){if(!n[0]&&!n[1])return s;const v=me.convert(n)._mult(g);o==="viewport"&&v._rotate(-d);const E=[];for(let L=0;L<s.length;L++)E.push(s[L].sub(v));return E}function Yr(s,n,o,d){const g=me.convert(s)._mult(d);return n==="viewport"&&g._rotate(-o),g}zt(yp,"CircleBucket",{omit:["layers"]});const Su=new Hn({"circle-sort-key":new pi(Yt.layout_circle["circle-sort-key"])});var _g={paint:new Hn({"circle-radius":new pi(Yt.paint_circle["circle-radius"]),"circle-color":new pi(Yt.paint_circle["circle-color"]),"circle-blur":new pi(Yt.paint_circle["circle-blur"]),"circle-opacity":new pi(Yt.paint_circle["circle-opacity"]),"circle-translate":new Jt(Yt.paint_circle["circle-translate"]),"circle-translate-anchor":new Jt(Yt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Jt(Yt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Jt(Yt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new pi(Yt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new pi(Yt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new pi(Yt.paint_circle["circle-stroke-opacity"])}),layout:Su},vp=1e-6,Sa=typeof Float32Array<"u"?Float32Array:Array;function hh(){var s=new Sa(9);return Sa!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[5]=0,s[6]=0,s[7]=0),s[0]=1,s[4]=1,s[8]=1,s}function wA(s,n,o){var d=n[0],g=n[1],v=n[2],E=n[3],L=n[4],k=n[5],V=n[6],q=n[7],se=n[8],he=o[0],_e=o[1],be=o[2],De=o[3],Ze=o[4],xt=o[5],Dt=o[6],_t=o[7],Tt=o[8];return s[0]=he*d+_e*E+be*V,s[1]=he*g+_e*L+be*q,s[2]=he*v+_e*k+be*se,s[3]=De*d+Ze*E+xt*V,s[4]=De*g+Ze*L+xt*q,s[5]=De*v+Ze*k+xt*se,s[6]=Dt*d+_t*E+Tt*V,s[7]=Dt*g+_t*L+Tt*q,s[8]=Dt*v+_t*k+Tt*se,s}function ql(s){return s[0]=1,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=1,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s}function yg(s,n){var o=n[0],d=n[1],g=n[2],v=n[3],E=n[4],L=n[5],k=n[6],V=n[7],q=n[8],se=n[9],he=n[10],_e=n[11],be=n[12],De=n[13],Ze=n[14],xt=n[15],Dt=o*L-d*E,_t=o*k-g*E,Tt=o*V-v*E,kt=d*k-g*L,Ut=d*V-v*L,ci=g*V-v*k,ai=q*De-se*be,Ti=q*Ze-he*be,Ki=q*xt-_e*be,_i=se*Ze-he*De,Si=se*xt-_e*De,Li=he*xt-_e*Ze,Vi=Dt*Li-_t*Si+Tt*_i+kt*Ki-Ut*Ti+ci*ai;return Vi?(s[0]=(L*Li-k*Si+V*_i)*(Vi=1/Vi),s[1]=(g*Si-d*Li-v*_i)*Vi,s[2]=(De*ci-Ze*Ut+xt*kt)*Vi,s[3]=(he*Ut-se*ci-_e*kt)*Vi,s[4]=(k*Ki-E*Li-V*Ti)*Vi,s[5]=(o*Li-g*Ki+v*Ti)*Vi,s[6]=(Ze*Tt-be*ci-xt*_t)*Vi,s[7]=(q*ci-he*Tt+_e*_t)*Vi,s[8]=(E*Si-L*Ki+V*ai)*Vi,s[9]=(d*Ki-o*Si-v*ai)*Vi,s[10]=(be*Ut-De*Tt+xt*Dt)*Vi,s[11]=(se*Tt-q*Ut-_e*Dt)*Vi,s[12]=(L*Ti-E*_i-k*ai)*Vi,s[13]=(o*_i-d*Ti+g*ai)*Vi,s[14]=(De*_t-be*kt-Ze*Dt)*Vi,s[15]=(q*kt-se*_t+he*Dt)*Vi,s):null}function bA(s,n,o){var d=n[0],g=n[1],v=n[2],E=n[3],L=n[4],k=n[5],V=n[6],q=n[7],se=n[8],he=n[9],_e=n[10],be=n[11],De=n[12],Ze=n[13],xt=n[14],Dt=n[15],_t=o[0],Tt=o[1],kt=o[2],Ut=o[3];return s[0]=_t*d+Tt*L+kt*se+Ut*De,s[1]=_t*g+Tt*k+kt*he+Ut*Ze,s[2]=_t*v+Tt*V+kt*_e+Ut*xt,s[3]=_t*E+Tt*q+kt*be+Ut*Dt,s[4]=(_t=o[4])*d+(Tt=o[5])*L+(kt=o[6])*se+(Ut=o[7])*De,s[5]=_t*g+Tt*k+kt*he+Ut*Ze,s[6]=_t*v+Tt*V+kt*_e+Ut*xt,s[7]=_t*E+Tt*q+kt*be+Ut*Dt,s[8]=(_t=o[8])*d+(Tt=o[9])*L+(kt=o[10])*se+(Ut=o[11])*De,s[9]=_t*g+Tt*k+kt*he+Ut*Ze,s[10]=_t*v+Tt*V+kt*_e+Ut*xt,s[11]=_t*E+Tt*q+kt*be+Ut*Dt,s[12]=(_t=o[12])*d+(Tt=o[13])*L+(kt=o[14])*se+(Ut=o[15])*De,s[13]=_t*g+Tt*k+kt*he+Ut*Ze,s[14]=_t*v+Tt*V+kt*_e+Ut*xt,s[15]=_t*E+Tt*q+kt*be+Ut*Dt,s}function wp(s,n,o){var d,g,v,E,L,k,V,q,se,he,_e,be,De=o[0],Ze=o[1],xt=o[2];return n===s?(s[12]=n[0]*De+n[4]*Ze+n[8]*xt+n[12],s[13]=n[1]*De+n[5]*Ze+n[9]*xt+n[13],s[14]=n[2]*De+n[6]*Ze+n[10]*xt+n[14],s[15]=n[3]*De+n[7]*Ze+n[11]*xt+n[15]):(g=n[1],v=n[2],E=n[3],L=n[4],k=n[5],V=n[6],q=n[7],se=n[8],he=n[9],_e=n[10],be=n[11],s[0]=d=n[0],s[1]=g,s[2]=v,s[3]=E,s[4]=L,s[5]=k,s[6]=V,s[7]=q,s[8]=se,s[9]=he,s[10]=_e,s[11]=be,s[12]=d*De+L*Ze+se*xt+n[12],s[13]=g*De+k*Ze+he*xt+n[13],s[14]=v*De+V*Ze+_e*xt+n[14],s[15]=E*De+q*Ze+be*xt+n[15]),s}function BA(s,n,o){var d=o[0],g=o[1],v=o[2];return s[0]=n[0]*d,s[1]=n[1]*d,s[2]=n[2]*d,s[3]=n[3]*d,s[4]=n[4]*g,s[5]=n[5]*g,s[6]=n[6]*g,s[7]=n[7]*g,s[8]=n[8]*v,s[9]=n[9]*v,s[10]=n[10]*v,s[11]=n[11]*v,s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15],s}function xg(s,n,o){var d=Math.sin(o),g=Math.cos(o),v=n[4],E=n[5],L=n[6],k=n[7],V=n[8],q=n[9],se=n[10],he=n[11];return n!==s&&(s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[4]=v*g+V*d,s[5]=E*g+q*d,s[6]=L*g+se*d,s[7]=k*g+he*d,s[8]=V*g-v*d,s[9]=q*g-E*d,s[10]=se*g-L*d,s[11]=he*g-k*d,s}function Lf(s,n,o){var d=Math.sin(o),g=Math.cos(o),v=n[0],E=n[1],L=n[2],k=n[3],V=n[8],q=n[9],se=n[10],he=n[11];return n!==s&&(s[4]=n[4],s[5]=n[5],s[6]=n[6],s[7]=n[7],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[0]=v*g-V*d,s[1]=E*g-q*d,s[2]=L*g-se*d,s[3]=k*g-he*d,s[8]=v*d+V*g,s[9]=E*d+q*g,s[10]=L*d+se*g,s[11]=k*d+he*g,s}function jy(s,n){return s[0]=n[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=n[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s}function Ky(s,n,o){var d,g,v,E=o[0],L=o[1],k=o[2],V=Math.hypot(E,L,k);return V<vp?null:(E*=V=1/V,L*=V,k*=V,d=Math.sin(n),g=Math.cos(n),s[0]=E*E*(v=1-g)+g,s[1]=L*E*v+k*d,s[2]=k*E*v-L*d,s[3]=0,s[4]=E*L*v-k*d,s[5]=L*L*v+g,s[6]=k*L*v+E*d,s[7]=0,s[8]=E*k*v+L*d,s[9]=L*k*v-E*d,s[10]=k*k*v+g,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s)}Math.hypot||(Math.hypot=function(){for(var s=0,n=arguments.length;n--;)s+=arguments[n]*arguments[n];return Math.sqrt(s)});var u1=bA;function dd(){var s=new Sa(3);return Sa!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0),s}function CA(s){var n=new Sa(3);return n[0]=s[0],n[1]=s[1],n[2]=s[2],n}function pd(s){return Math.hypot(s[0],s[1],s[2])}function fd(s,n,o){var d=new Sa(3);return d[0]=s,d[1]=n,d[2]=o,d}function Jh(s,n,o){return s[0]=n[0]+o[0],s[1]=n[1]+o[1],s[2]=n[2]+o[2],s}function vg(s,n,o){return s[0]=n[0]-o[0],s[1]=n[1]-o[1],s[2]=n[2]-o[2],s}function wg(s,n,o){return s[0]=n[0]*o[0],s[1]=n[1]*o[1],s[2]=n[2]*o[2],s}function EA(s,n,o){return s[0]=Math.min(n[0],o[0]),s[1]=Math.min(n[1],o[1]),s[2]=Math.min(n[2],o[2]),s}function md(s,n,o){return s[0]=Math.max(n[0],o[0]),s[1]=Math.max(n[1],o[1]),s[2]=Math.max(n[2],o[2]),s}function pa(s,n,o){return s[0]=n[0]*o,s[1]=n[1]*o,s[2]=n[2]*o,s}function eu(s,n,o,d){return s[0]=n[0]+o[0]*d,s[1]=n[1]+o[1]*d,s[2]=n[2]+o[2]*d,s}function so(s,n){var o=n[0],d=n[1],g=n[2],v=o*o+d*d+g*g;return v>0&&(v=1/Math.sqrt(v)),s[0]=n[0]*v,s[1]=n[1]*v,s[2]=n[2]*v,s}function Ma(s,n){return s[0]*n[0]+s[1]*n[1]+s[2]*n[2]}function gd(s,n,o){var d=n[0],g=n[1],v=n[2],E=o[0],L=o[1],k=o[2];return s[0]=g*k-v*L,s[1]=v*E-d*k,s[2]=d*L-g*E,s}function Qs(s,n,o){var d=n[0],g=n[1],v=n[2],E=o[3]*d+o[7]*g+o[11]*v+o[15];return s[0]=(o[0]*d+o[4]*g+o[8]*v+o[12])/(E=E||1),s[1]=(o[1]*d+o[5]*g+o[9]*v+o[13])/E,s[2]=(o[2]*d+o[6]*g+o[10]*v+o[14])/E,s}function bg(s,n,o){var d=o[0],g=o[1],v=o[2],E=n[0],L=n[1],k=n[2],V=g*k-v*L,q=v*E-d*k,se=d*L-g*E,he=g*se-v*q,_e=v*V-d*se,be=d*q-g*V,De=2*o[3];return q*=De,se*=De,_e*=2,be*=2,s[0]=E+(V*=De)+(he*=2),s[1]=L+q+_e,s[2]=k+se+be,s}var _d,wc=vg,$y=wg,Zy=pd;function Df(s,n,o){return s[0]=n[0]*o,s[1]=n[1]*o,s[2]=n[2]*o,s[3]=n[3]*o,s}function Pf(s,n){var o=n[0],d=n[1],g=n[2],v=n[3],E=o*o+d*d+g*g+v*v;return E>0&&(E=1/Math.sqrt(E)),s[0]=o*E,s[1]=d*E,s[2]=g*E,s[3]=v*E,s}function TA(s,n,o){var d=n[0],g=n[1],v=n[2],E=n[3];return s[0]=o[0]*d+o[4]*g+o[8]*v+o[12]*E,s[1]=o[1]*d+o[5]*g+o[9]*v+o[13]*E,s[2]=o[2]*d+o[6]*g+o[10]*v+o[14]*E,s[3]=o[3]*d+o[7]*g+o[11]*v+o[15]*E,s}function Xy(){var s=new Sa(4);return Sa!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0),s[3]=1,s}function Bg(s){return s[0]=0,s[1]=0,s[2]=0,s[3]=1,s}function uh(s,n,o){o*=.5;var d=n[0],g=n[1],v=n[2],E=n[3],L=Math.sin(o),k=Math.cos(o);return s[0]=d*k+E*L,s[1]=g*k+v*L,s[2]=v*k-g*L,s[3]=E*k-d*L,s}function Cg(s,n,o){o*=.5;var d=n[0],g=n[1],v=n[2],E=n[3],L=Math.sin(o),k=Math.cos(o);return s[0]=d*k-v*L,s[1]=g*k+E*L,s[2]=v*k+d*L,s[3]=E*k-g*L,s}dd(),_d=new Sa(4),Sa!=Float32Array&&(_d[0]=0,_d[1]=0,_d[2]=0,_d[3]=0);var Mu=Pf;dd(),fd(1,0,0),fd(0,1,0),Xy(),Xy(),hh();class Uf{constructor(n,o){this.pos=n,this.dir=o}intersectsPlane(n,o,d){const g=Ma(o,this.dir);if(Math.abs(g)<1e-6)return!1;const v=((n[0]-this.pos[0])*o[0]+(n[1]-this.pos[1])*o[1]+(n[2]-this.pos[2])*o[2])/g;return d[0]=this.pos[0]+this.dir[0]*v,d[1]=this.pos[1]+this.dir[1]*v,d[2]=this.pos[2]+this.dir[2]*v,!0}closestPointOnSphere(n,o,d){if(function(_e,be){var De=_e[0],Ze=_e[1],xt=_e[2],Dt=be[0],_t=be[1],Tt=be[2];return Math.abs(De-Dt)<=vp*Math.max(1,Math.abs(De),Math.abs(Dt))&&Math.abs(Ze-_t)<=vp*Math.max(1,Math.abs(Ze),Math.abs(_t))&&Math.abs(xt-Tt)<=vp*Math.max(1,Math.abs(xt),Math.abs(Tt))}(this.pos,n)||o===0)return d[0]=d[1]=d[2]=0,!1;const[g,v,E]=this.dir,L=this.pos[0]-n[0],k=this.pos[1]-n[1],V=this.pos[2]-n[2],q=g*g+v*v+E*E,se=2*(L*g+k*v+V*E),he=se*se-4*q*(L*L+k*k+V*V-o*o);if(he<0){const _e=Math.max(-se/2,0),be=L+g*_e,De=k+v*_e,Ze=V+E*_e,xt=Math.hypot(be,De,Ze);return d[0]=be*o/xt,d[1]=De*o/xt,d[2]=Ze*o/xt,!1}{const _e=(-se-Math.sqrt(he))/(2*q);if(_e<0){const be=Math.hypot(L,k,V);return d[0]=L*o/be,d[1]=k*o/be,d[2]=V*o/be,!1}return d[0]=L+g*_e,d[1]=k+v*_e,d[2]=V+E*_e,!0}}}class Rf{constructor(n,o,d,g,v){this.TL=n,this.TR=o,this.BR=d,this.BL=g,this.horizon=v}static fromInvProjectionMatrix(n,o,d){const g=[-1,1,1],v=[1,1,1],E=[1,-1,1],L=[-1,-1,1],k=Qs(g,g,n),V=Qs(v,v,n),q=Qs(E,E,n),se=Qs(L,L,n);return new Rf(k,V,q,se,o/d)}}class zf{constructor(n,o){this.points=n,this.planes=o}static fromInvProjectionMatrix(n,o,d,g){const v=Math.pow(2,d),E=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(k=>{const V=TA([],k,n),q=1/V[3]/o*v;return function(se,he,_e){return se[0]=he[0]*_e[0],se[1]=he[1]*_e[1],se[2]=he[2]*_e[2],se[3]=he[3]*_e[3],se}(V,V,[q,q,g?1/V[3]:q,q])}),L=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(k=>{const V=so([],gd([],wc([],E[k[0]],E[k[1]]),wc([],E[k[2]],E[k[1]]))),q=-Ma(V,E[k[1]]);return V.concat(q)});return new zf(E,L)}}class Ko{static fromPoints(n){const o=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(const g of n)EA(o,o,g),md(d,d,g);return new Ko(o,d)}static applyTransform(n,o){const d=n.getCorners();for(let g=0;g<d.length;++g)Qs(d[g],d[g],o);return Ko.fromPoints(d)}constructor(n,o){this.min=n,this.max=o,this.center=pa([],Jh([],this.min,this.max),.5)}quadrant(n){const o=[n%2==0,n<2],d=CA(this.min),g=CA(this.max);for(let v=0;v<o.length;v++)d[v]=o[v]?this.min[v]:this.center[v],g[v]=o[v]?this.center[v]:this.max[v];return g[2]=this.max[2],new Ko(d,g)}distanceX(n){return Math.max(Math.min(this.max[0],n[0]),this.min[0])-n[0]}distanceY(n){return Math.max(Math.min(this.max[1],n[1]),this.min[1])-n[1]}distanceZ(n){return Math.max(Math.min(this.max[2],n[2]),this.min[2])-n[2]}getCorners(){const n=this.min,o=this.max;return[[n[0],n[1],n[2]],[o[0],n[1],n[2]],[o[0],o[1],n[2]],[n[0],o[1],n[2]],[n[0],n[1],o[2]],[o[0],n[1],o[2]],[o[0],o[1],o[2]],[n[0],o[1],o[2]]]}intersects(n){const o=this.getCorners();let d=!0;for(let g=0;g<n.planes.length;g++){const v=n.planes[g];let E=0;for(let L=0;L<o.length;L++)E+=Ma(v,o[L])+v[3]>=0;if(E===0)return 0;E!==o.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let v=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(let L=0;L<n.points.length;L++){const k=n.points[L][g]-this.min[g];v=Math.min(v,k),E=Math.max(E,k)}if(E<0||v>this.max[g]-this.min[g])return 0}return 1}}function qy(s,n,o,d,g,v,E,L,k){if(v&&s.queryGeometry.isAboveHorizon)return!1;v&&(k*=s.pixelToTileUnitsFactor);const V=s.tileID.canonical,q=o.projection.upVectorScale(V,o.center.lat,o.worldSize).metersToTile;for(const se of n)for(const he of se){const _e=he.add(L),be=g&&o.elevation?o.elevation.exaggeration()*g.getElevationAt(_e.x,_e.y,!0):0,De=o.projection.projectTilePoint(_e.x,_e.y,V);if(be>0){const _t=o.projection.upVector(V,_e.x,_e.y);De.x+=_t[0]*q*be,De.y+=_t[1]*q*be,De.z+=_t[2]*q*be}const Ze=v?_e:A1(De.x,De.y,De.z,d),xt=v?s.tilespaceRays.map(_t=>Jy(_t,be)):s.queryGeometry.screenGeometry,Dt=TA([],[De.x,De.y,De.z,1],d);if(!E&&v?k*=Dt[3]/o.cameraToCenterDistance:E&&!v&&(k*=o.cameraToCenterDistance/Dt[3]),v){const _t=Fo((he.y/Zn+V.y)/(1<<V.z));k/=o.projection.pixelsPerMeter(_t,1)/Xl(1,_t)}if(Hy(xt,Ze,k))return!0}return!1}function A1(s,n,o,d){const g=TA([],[s,n,o,1],d);return new me(g[0]/g[3],g[1]/g[3])}const Eg=fd(0,0,0),Yy=fd(0,0,1);function Jy(s,n){const o=dd();return Eg[2]=n,s.intersectsPlane(Eg,Yy,o),new me(o[0],o[1])}class bp extends yp{}function Tg(s,{width:n,height:o},d,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==n*o*d)throw new RangeError("mismatched image size")}else g=new Uint8Array(n*o*d);return s.width=n,s.height=o,s.data=g,s}function Bp(s,n,o){const{width:d,height:g}=n;d===s.width&&g===s.height||(yd(s,n,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,d),height:Math.min(s.height,g)},o),s.width=d,s.height=g,s.data=n.data)}function yd(s,n,o,d,g,v){if(g.width===0||g.height===0)return n;if(g.width>s.width||g.height>s.height||o.x>s.width-g.width||o.y>s.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>n.width||g.height>n.height||d.x>n.width-g.width||d.y>n.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const E=s.data,L=n.data;for(let k=0;k<g.height;k++){const V=((o.y+k)*s.width+o.x)*v,q=((d.y+k)*n.width+d.x)*v;for(let se=0;se<g.width*v;se++)L[q+se]=E[V+se]}return n}zt(bp,"HeatmapBucket",{omit:["layers"]});class Yl{constructor(n,o){Tg(this,n,1,o)}resize(n){Bp(this,new Yl(n),1)}clone(){return new Yl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(n,o,d,g,v){yd(n,o,d,g,v,1)}}class Xa{constructor(n,o){Tg(this,n,4,o)}resize(n){Bp(this,new Xa(n),4)}replace(n,o){o?this.data.set(n):this.data=n instanceof Uint8ClampedArray?new Uint8Array(n.buffer):n}clone(){return new Xa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(n,o,d,g,v){yd(n,o,d,g,v,4)}}zt(Yl,"AlphaImage"),zt(Xa,"RGBAImage");var d1={paint:new Hn({"heatmap-radius":new pi(Yt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new pi(Yt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Jt(Yt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new In(Yt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Jt(Yt.paint_heatmap["heatmap-opacity"])})};function Sg(s){const n={},o=s.resolution||256,d=s.clips?s.clips.length:1,g=s.image||new Xa({width:o,height:d}),v=(E,L,k)=>{n[s.evaluationKey]=k;const V=s.expression.evaluate(n);g.data[E+L+0]=Math.floor(255*V.r/V.a),g.data[E+L+1]=Math.floor(255*V.g/V.a),g.data[E+L+2]=Math.floor(255*V.b/V.a),g.data[E+L+3]=Math.floor(255*V.a)};if(s.clips)for(let E=0,L=0;E<d;++E,L+=4*o)for(let k=0,V=0;k<o;k++,V+=4){const q=k/(o-1),{start:se,end:he}=s.clips[E];v(L,V,se*(1-q)+he*q)}else for(let E=0,L=0;E<o;E++,L+=4)v(0,L,E/(o-1));return g}var p1={paint:new Hn({"hillshade-illumination-direction":new Jt(Yt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Jt(Yt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Jt(Yt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Jt(Yt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Jt(Yt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Jt(Yt.paint_hillshade["hillshade-accent-color"])})};const xd=_n([{name:"a_pos",components:2,type:"Int16"}],4),{members:Mg}=xd;var vd={exports:{}};function wd(s,n,o){o=o||2;var d,g,v,E,L,k,V,q=n&&n.length,se=q?n[0]*o:s.length,he=e0(s,0,se,o,!0),_e=[];if(!he||he.next===he.prev)return _e;if(q&&(he=function(De,Ze,xt,Dt){var _t,Tt,kt,Ut=[];for(_t=0,Tt=Ze.length;_t<Tt;_t++)(kt=e0(De,Ze[_t]*Dt,_t<Tt-1?Ze[_t+1]*Dt:De.length,Dt,!1))===kt.next&&(kt.steiner=!0),Ut.push(Fg(kt));for(Ut.sort(kf),_t=0;_t<Ut.length;_t++)xt=Ig(Ut[_t],xt);return xt}(s,n,he,o)),s.length>80*o){d=v=s[0],g=E=s[1];for(var be=o;be<se;be+=o)(L=s[be])<d&&(d=L),(k=s[be+1])<g&&(g=k),L>v&&(v=L),k>E&&(E=k);V=(V=Math.max(v-d,E-g))!==0?32767/V:0}return bd(he,_e,o,d,g,V,0),_e}function e0(s,n,o,d,g){var v,E;if(g===Ts(s,n,o,d)>0)for(v=n;v<o;v+=d)E=n0(v,s[v],s[v+1],E);else for(v=o-d;v>=n;v-=d)E=n0(v,s[v],s[v+1],E);return E&&Ep(E,E.next)&&(Mp(E),E=E.next),E}function qa(s,n){if(!s)return s;n||(n=s);var o,d=s;do if(o=!1,d.steiner||!Ep(d,d.next)&&Ps(d.prev,d,d.next)!==0)d=d.next;else{if(Mp(d),(d=n=d.prev)===d.next)break;o=!0}while(o||d!==n);return n}function bd(s,n,o,d,g,v,E){if(s){!E&&v&&function(q,se,he,_e){var be=q;do be.z===0&&(be.z=Cp(be.x,be.y,se,he,_e)),be.prevZ=be.prev,be.nextZ=be.next,be=be.next;while(be!==q);be.prevZ.nextZ=null,be.prevZ=null,function(De){var Ze,xt,Dt,_t,Tt,kt,Ut,ci,ai=1;do{for(xt=De,De=null,Tt=null,kt=0;xt;){for(kt++,Dt=xt,Ut=0,Ze=0;Ze<ai&&(Ut++,Dt=Dt.nextZ);Ze++);for(ci=ai;Ut>0||ci>0&&Dt;)Ut!==0&&(ci===0||!Dt||xt.z<=Dt.z)?(_t=xt,xt=xt.nextZ,Ut--):(_t=Dt,Dt=Dt.nextZ,ci--),Tt?Tt.nextZ=_t:De=_t,_t.prevZ=Tt,Tt=_t;xt=Dt}Tt.nextZ=null,ai*=2}while(kt>1)}(be)}(s,d,g,v);for(var L,k,V=s;s.prev!==s.next;)if(L=s.prev,k=s.next,v?f1(s,d,g,v):t0(s))n.push(L.i/o|0),n.push(s.i/o|0),n.push(k.i/o|0),Mp(s),s=k.next,V=k.next;else if((s=k)===V){E?E===1?bd(s=m1(qa(s),n,o),n,o,d,g,v,2):E===2&&g1(s,n,o,d,g,v):bd(qa(s),n,o,d,g,v,1);break}}}function t0(s){var n=s.prev,o=s,d=s.next;if(Ps(n,o,d)>=0)return!1;for(var g=n.x,v=o.x,E=d.x,L=n.y,k=o.y,V=d.y,q=g<v?g<E?g:E:v<E?v:E,se=L<k?L<V?L:V:k<V?k:V,he=g>v?g>E?g:E:v>E?v:E,_e=L>k?L>V?L:V:k>V?k:V,be=d.next;be!==n;){if(be.x>=q&&be.x<=he&&be.y>=se&&be.y<=_e&&bc(g,L,v,k,E,V,be.x,be.y)&&Ps(be.prev,be,be.next)>=0)return!1;be=be.next}return!0}function f1(s,n,o,d){var g=s.prev,v=s,E=s.next;if(Ps(g,v,E)>=0)return!1;for(var L=g.x,k=v.x,V=E.x,q=g.y,se=v.y,he=E.y,_e=L<k?L<V?L:V:k<V?k:V,be=q<se?q<he?q:he:se<he?se:he,De=L>k?L>V?L:V:k>V?k:V,Ze=q>se?q>he?q:he:se>he?se:he,xt=Cp(_e,be,n,o,d),Dt=Cp(De,Ze,n,o,d),_t=s.prevZ,Tt=s.nextZ;_t&&_t.z>=xt&&Tt&&Tt.z<=Dt;){if(_t.x>=_e&&_t.x<=De&&_t.y>=be&&_t.y<=Ze&&_t!==g&&_t!==E&&bc(L,q,k,se,V,he,_t.x,_t.y)&&Ps(_t.prev,_t,_t.next)>=0||(_t=_t.prevZ,Tt.x>=_e&&Tt.x<=De&&Tt.y>=be&&Tt.y<=Ze&&Tt!==g&&Tt!==E&&bc(L,q,k,se,V,he,Tt.x,Tt.y)&&Ps(Tt.prev,Tt,Tt.next)>=0))return!1;Tt=Tt.nextZ}for(;_t&&_t.z>=xt;){if(_t.x>=_e&&_t.x<=De&&_t.y>=be&&_t.y<=Ze&&_t!==g&&_t!==E&&bc(L,q,k,se,V,he,_t.x,_t.y)&&Ps(_t.prev,_t,_t.next)>=0)return!1;_t=_t.prevZ}for(;Tt&&Tt.z<=Dt;){if(Tt.x>=_e&&Tt.x<=De&&Tt.y>=be&&Tt.y<=Ze&&Tt!==g&&Tt!==E&&bc(L,q,k,se,V,he,Tt.x,Tt.y)&&Ps(Tt.prev,Tt,Tt.next)>=0)return!1;Tt=Tt.nextZ}return!0}function m1(s,n,o){var d=s;do{var g=d.prev,v=d.next.next;!Ep(g,v)&&Tp(g,d,d.next,v)&&Sp(g,v)&&Sp(v,g)&&(n.push(g.i/o|0),n.push(d.i/o|0),n.push(v.i/o|0),Mp(d),Mp(d.next),d=s=v),d=d.next}while(d!==s);return qa(d)}function g1(s,n,o,d,g,v){var E=s;do{for(var L=E.next.next;L!==E.prev;){if(E.i!==L.i&&y1(E,L)){var k=i0(E,L);return E=qa(E,E.next),k=qa(k,k.next),bd(E,n,o,d,g,v,0),void bd(k,n,o,d,g,v,0)}L=L.next}E=E.next}while(E!==s)}function kf(s,n){return s.x-n.x}function Ig(s,n){var o=function(g,v){var E,L=v,k=g.x,V=g.y,q=-1/0;do{if(V<=L.y&&V>=L.next.y&&L.next.y!==L.y){var se=L.x+(V-L.y)*(L.next.x-L.x)/(L.next.y-L.y);if(se<=k&&se>q&&(q=se,E=L.x<L.next.x?L:L.next,se===k))return E}L=L.next}while(L!==v);if(!E)return null;var he,_e=E,be=E.x,De=E.y,Ze=1/0;L=E;do k>=L.x&&L.x>=be&&k!==L.x&&bc(V<De?k:q,V,be,De,V<De?q:k,V,L.x,L.y)&&(he=Math.abs(V-L.y)/(k-L.x),Sp(L,g)&&(he<Ze||he===Ze&&(L.x>E.x||L.x===E.x&&_1(E,L)))&&(E=L,Ze=he)),L=L.next;while(L!==_e);return E}(s,n);if(!o)return n;var d=i0(o,s);return qa(d,d.next),qa(o,o.next)}function _1(s,n){return Ps(s.prev,s,n.prev)<0&&Ps(n.next,s,s.next)<0}function Cp(s,n,o,d,g){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-o)*g|0)|s<<8))|s<<4))|s<<2))|s<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-d)*g|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function Fg(s){var n=s,o=s;do(n.x<o.x||n.x===o.x&&n.y<o.y)&&(o=n),n=n.next;while(n!==s);return o}function bc(s,n,o,d,g,v,E,L){return(g-E)*(n-L)>=(s-E)*(v-L)&&(s-E)*(d-L)>=(o-E)*(n-L)&&(o-E)*(v-L)>=(g-E)*(d-L)}function y1(s,n){return s.next.i!==n.i&&s.prev.i!==n.i&&!function(o,d){var g=o;do{if(g.i!==o.i&&g.next.i!==o.i&&g.i!==d.i&&g.next.i!==d.i&&Tp(g,g.next,o,d))return!0;g=g.next}while(g!==o);return!1}(s,n)&&(Sp(s,n)&&Sp(n,s)&&function(o,d){var g=o,v=!1,E=(o.x+d.x)/2,L=(o.y+d.y)/2;do g.y>L!=g.next.y>L&&g.next.y!==g.y&&E<(g.next.x-g.x)*(L-g.y)/(g.next.y-g.y)+g.x&&(v=!v),g=g.next;while(g!==o);return v}(s,n)&&(Ps(s.prev,s,n.prev)||Ps(s,n.prev,n))||Ep(s,n)&&Ps(s.prev,s,s.next)>0&&Ps(n.prev,n,n.next)>0)}function Ps(s,n,o){return(n.y-s.y)*(o.x-n.x)-(n.x-s.x)*(o.y-n.y)}function Ep(s,n){return s.x===n.x&&s.y===n.y}function Tp(s,n,o,d){var g=Of(Ps(s,n,o)),v=Of(Ps(s,n,d)),E=Of(Ps(o,d,s)),L=Of(Ps(o,d,n));return g!==v&&E!==L||!(g!==0||!Bd(s,o,n))||!(v!==0||!Bd(s,d,n))||!(E!==0||!Bd(o,s,d))||!(L!==0||!Bd(o,n,d))}function Bd(s,n,o){return n.x<=Math.max(s.x,o.x)&&n.x>=Math.min(s.x,o.x)&&n.y<=Math.max(s.y,o.y)&&n.y>=Math.min(s.y,o.y)}function Of(s){return s>0?1:s<0?-1:0}function Sp(s,n){return Ps(s.prev,s,s.next)<0?Ps(s,n,s.next)>=0&&Ps(s,s.prev,n)>=0:Ps(s,n,s.prev)<0||Ps(s,s.next,n)<0}function i0(s,n){var o=new Nf(s.i,s.x,s.y),d=new Nf(n.i,n.x,n.y),g=s.next,v=n.prev;return s.next=n,n.prev=s,o.next=g,g.prev=o,d.next=o,o.prev=d,v.next=d,d.prev=v,d}function n0(s,n,o,d){var g=new Nf(s,n,o);return d?(g.next=d.next,g.prev=d,d.next.prev=g,d.next=g):(g.prev=g,g.next=g),g}function Mp(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Nf(s,n,o){this.i=s,this.x=n,this.y=o,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ts(s,n,o,d){for(var g=0,v=n,E=o-d;v<o;v+=d)g+=(s[E]-s[v])*(s[v+1]+s[E+1]),E=v;return g}function SA(s,n,o,d,g){Lg(s,n,o||0,d||s.length-1,g||r0)}function Lg(s,n,o,d,g){for(;d>o;){if(d-o>600){var v=d-o+1,E=n-o+1,L=Math.log(v),k=.5*Math.exp(2*L/3),V=.5*Math.sqrt(L*k*(v-k)/v)*(E-v/2<0?-1:1);Lg(s,n,Math.max(o,Math.floor(n-E*k/v+V)),Math.min(d,Math.floor(n+(v-E)*k/v+V)),g)}var q=s[n],se=o,he=d;for(Cd(s,o,n),g(s[d],q)>0&&Cd(s,o,d);se<he;){for(Cd(s,se,he),se++,he--;g(s[se],q)<0;)se++;for(;g(s[he],q)>0;)he--}g(s[o],q)===0?Cd(s,o,he):Cd(s,++he,d),he<=n&&(o=he+1),n<=he&&(d=he-1)}}function Cd(s,n,o){var d=s[n];s[n]=s[o],s[o]=d}function r0(s,n){return s<n?-1:s>n?1:0}function Qf(s,n){const o=s.length;if(o<=1)return[s];const d=[];let g,v;for(let E=0;E<o;E++){const L=Xt(s[E]);L!==0&&(s[E].area=Math.abs(L),v===void 0&&(v=L<0),v===L<0?(g&&d.push(g),g=[s[E]]):g.push(s[E]))}if(g&&d.push(g),n>1)for(let E=0;E<d.length;E++)d[E].length<=n||(SA(d[E],n,1,d[E].length-1,s0),d[E]=d[E].slice(0,n));return d}function s0(s,n){return n.area-s.area}function Ip(s,n,o){const d=o.patternDependencies;let g=!1;for(const v of n){const E=v.paint.get(`${s}-pattern`);E.isConstant()||(g=!0);const L=E.constantOr(null);L&&(g=!0,d[L]=!0)}return g}function Ed(s,n,o,d,g){const v=g.patternDependencies;for(const E of n){const L=E.paint.get(`${s}-pattern`).value;if(L.kind!=="constant"){let k=L.evaluate({zoom:d},o,{},g.availableImages);k=k&&k.name?k.name:k,v[k]=!0,o.patterns[E.id]=k}}return o}vd.exports=wd,vd.exports.default=wd,wd.deviation=function(s,n,o,d){var g=n&&n.length,v=Math.abs(Ts(s,0,g?n[0]*o:s.length,o));if(g)for(var E=0,L=n.length;E<L;E++)v-=Math.abs(Ts(s,n[E]*o,E<L-1?n[E+1]*o:s.length,o));var k=0;for(E=0;E<d.length;E+=3){var V=d[E]*o,q=d[E+1]*o,se=d[E+2]*o;k+=Math.abs((s[V]-s[se])*(s[q+1]-s[V+1])-(s[V]-s[q])*(s[se+1]-s[V+1]))}return v===0&&k===0?0:Math.abs((k-v)/v)},wd.flatten=function(s){for(var n=s[0][0].length,o={vertices:[],holes:[],dimensions:n},d=0,g=0;g<s.length;g++){for(var v=0;v<s[g].length;v++)for(var E=0;E<n;E++)o.vertices.push(s[g][v][E]);g>0&&o.holes.push(d+=s[g-1].length)}return o};class Fp{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(o=>o.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Or,this.indexArray=new _o,this.indexArray2=new $a,this.programConfigurations=new _A(n.layers,n.zoom),this.segments=new to,this.segments2=new to,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.projection=n.projection}populate(n,o,d,g){this.hasPattern=Ip("fill",this.layers,o);const v=this.layers[0].layout.get("fill-sort-key"),E=[];for(const{feature:L,id:k,index:V,sourceLayerIndex:q}of n){const se=this.layers[0]._featureFilter.needGeometry,he=xA(L,se);if(!this.layers[0]._featureFilter.filter(new qt(this.zoom),he,d))continue;const _e=v?v.evaluate(he,{},d,o.availableImages):void 0,be={id:k,properties:L.properties,type:L.type,sourceLayerIndex:q,index:V,geometry:se?he.geometry:Yh(L,d,g),patterns:{},sortKey:_e};E.push(be)}v&&E.sort((L,k)=>L.sortKey-k.sortKey);for(const L of E){const{geometry:k,index:V,sourceLayerIndex:q}=L;if(this.hasPattern){const se=Ed("fill",this.layers,L,this.zoom,o);this.patternFeatures.push(se)}else this.addFeature(L,k,V,d,{},o.availableImages);o.featureIndex.insert(n[V].feature,k,V,q,this.index)}}update(n,o,d,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,o,this.stateDependentLayers,d,g)}addFeatures(n,o,d,g,v){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,o,d,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Mg),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(n,o,d,g,v,E=[]){for(const L of Qf(o,500)){let k=0;for(const be of L)k+=be.length;const V=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray),q=V.vertexLength,se=[],he=[];for(const be of L){if(be.length===0)continue;be!==L[0]&&he.push(se.length/2);const De=this.segments2.prepareSegment(be.length,this.layoutVertexArray,this.indexArray2),Ze=De.vertexLength;this.layoutVertexArray.emplaceBack(be[0].x,be[0].y),this.indexArray2.emplaceBack(Ze+be.length-1,Ze),se.push(be[0].x),se.push(be[0].y);for(let xt=1;xt<be.length;xt++)this.layoutVertexArray.emplaceBack(be[xt].x,be[xt].y),this.indexArray2.emplaceBack(Ze+xt-1,Ze+xt),se.push(be[xt].x),se.push(be[xt].y);De.vertexLength+=be.length,De.primitiveLength+=be.length}const _e=vd.exports(se,he);for(let be=0;be<_e.length;be+=3)this.indexArray.emplaceBack(q+_e[be],q+_e[be+1],q+_e[be+2]);V.vertexLength+=k,V.primitiveLength+=_e.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,v,E,g)}}zt(Fp,"FillBucket",{omit:["layers","patternFeatures"]});const Dg=new Hn({"fill-sort-key":new pi(Yt.layout_fill["fill-sort-key"])});var o0={paint:new Hn({"fill-antialias":new Jt(Yt.paint_fill["fill-antialias"]),"fill-opacity":new pi(Yt.paint_fill["fill-opacity"]),"fill-color":new pi(Yt.paint_fill["fill-color"]),"fill-outline-color":new pi(Yt.paint_fill["fill-outline-color"]),"fill-translate":new Jt(Yt.paint_fill["fill-translate"]),"fill-translate-anchor":new Jt(Yt.paint_fill["fill-translate-anchor"]),"fill-pattern":new pi(Yt.paint_fill["fill-pattern"])}),layout:Dg};const Bl=_n([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Lp=_n([{name:"a_centroid_pos",components:2,type:"Uint16"}]),a0=_n([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:l0}=Bl;var Dp={},c0=me,Pg=MA;function MA(s,n,o,d,g){this.properties={},this.extent=o,this.type=0,this._pbf=s,this._geometry=-1,this._keys=d,this._values=g,s.readFields(x1,this,n)}function x1(s,n,o){s==1?n.id=o.readVarint():s==2?function(d,g){for(var v=d.readVarint()+d.pos;d.pos<v;){var E=g._keys[d.readVarint()],L=g._values[d.readVarint()];g.properties[E]=L}}(o,n):s==3?n.type=o.readVarint():s==4&&(n._geometry=o.pos)}function Ug(s){for(var n,o,d=0,g=0,v=s.length,E=v-1;g<v;E=g++)d+=((o=s[E]).x-(n=s[g]).x)*(n.y+o.y);return d}MA.types=["Unknown","Point","LineString","Polygon"],MA.prototype.loadGeometry=function(){var s=this._pbf;s.pos=this._geometry;for(var n,o=s.readVarint()+s.pos,d=1,g=0,v=0,E=0,L=[];s.pos<o;){if(g<=0){var k=s.readVarint();d=7&k,g=k>>3}if(g--,d===1||d===2)v+=s.readSVarint(),E+=s.readSVarint(),d===1&&(n&&L.push(n),n=[]),n.push(new c0(v,E));else{if(d!==7)throw new Error("unknown command "+d);n&&n.push(n[0].clone())}}return n&&L.push(n),L},MA.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var n=s.readVarint()+s.pos,o=1,d=0,g=0,v=0,E=1/0,L=-1/0,k=1/0,V=-1/0;s.pos<n;){if(d<=0){var q=s.readVarint();o=7&q,d=q>>3}if(d--,o===1||o===2)(g+=s.readSVarint())<E&&(E=g),g>L&&(L=g),(v+=s.readSVarint())<k&&(k=v),v>V&&(V=v);else if(o!==7)throw new Error("unknown command "+o)}return[E,k,L,V]},MA.prototype.toGeoJSON=function(s,n,o){var d,g,v=this.extent*Math.pow(2,o),E=this.extent*s,L=this.extent*n,k=this.loadGeometry(),V=MA.types[this.type];function q(_e){for(var be=0;be<_e.length;be++){var De=_e[be];_e[be]=[360*(De.x+E)/v-180,360/Math.PI*Math.atan(Math.exp((180-360*(De.y+L)/v)*Math.PI/180))-90]}}switch(this.type){case 1:var se=[];for(d=0;d<k.length;d++)se[d]=k[d][0];q(k=se);break;case 2:for(d=0;d<k.length;d++)q(k[d]);break;case 3:for(k=function(_e){var be=_e.length;if(be<=1)return[_e];for(var De,Ze,xt=[],Dt=0;Dt<be;Dt++){var _t=Ug(_e[Dt]);_t!==0&&(Ze===void 0&&(Ze=_t<0),Ze===_t<0?(De&&xt.push(De),De=[_e[Dt]]):De.push(_e[Dt]))}return De&&xt.push(De),xt}(k),d=0;d<k.length;d++)for(g=0;g<k[d].length;g++)q(k[d][g])}k.length===1?k=k[0]:V="Multi"+V;var he={type:"Feature",geometry:{type:V,coordinates:k},properties:this.properties};return"id"in this&&(he.id=this.id),he};var Vf=Pg,Td=Hf;function Hf(s,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(v1,this,n),this.length=this._features.length}function v1(s,n,o){s===15?n.version=o.readVarint():s===1?n.name=o.readString():s===5?n.extent=o.readVarint():s===2?n._features.push(o.pos):s===3?n._keys.push(o.readString()):s===4&&n._values.push(function(d){for(var g=null,v=d.readVarint()+d.pos;d.pos<v;){var E=d.readVarint()>>3;g=E===1?d.readString():E===2?d.readFloat():E===3?d.readDouble():E===4?d.readVarint64():E===5?d.readVarint():E===6?d.readSVarint():E===7?d.readBoolean():null}return g}(o))}Hf.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var n=this._pbf.readVarint()+this._pbf.pos;return new Vf(this._pbf,n,this.extent,this._keys,this._values)};var A=Td;function l(s,n,o){if(s===3){var d=new A(o,o.readVarint()+o.pos);d.length&&(n[d.name]=d)}}var f=Dp.VectorTile=function(s,n){this.layers=s.readFields(l,{},n)},w=Dp.VectorTileFeature=Pg;function I(s,n,o,d){const g=[],v=d===0?(E,L,k,V,q,se)=>{E.push(new me(se,k+(se-L)/(V-L)*(q-k)))}:(E,L,k,V,q,se)=>{E.push(new me(L+(se-k)/(q-k)*(V-L),se))};for(const E of s){const L=[];for(const k of E){if(k.length<=2)continue;const V=[];for(let he=0;he<k.length-1;he++){const _e=k[he].x,be=k[he].y,De=k[he+1].x,Ze=k[he+1].y,xt=d===0?_e:be,Dt=d===0?De:Ze;xt<n?Dt>n&&v(V,_e,be,De,Ze,n):xt>o?Dt<o&&v(V,_e,be,De,Ze,o):V.push(k[he]),Dt<n&&xt>=n&&v(V,_e,be,De,Ze,n),Dt>o&&xt<=o&&v(V,_e,be,De,Ze,o)}let q=k[k.length-1];const se=d===0?q.x:q.y;se>=n&&se<=o&&V.push(q),V.length&&(q=V[V.length-1],V[0].x===q.x&&V[0].y===q.y||V.push(V[0]),L.push(V))}L.length&&g.push(L)}return g}Dp.VectorTileLayer=Td;const z=w.types,Q=Math.pow(2,13);function Z(s,n,o,d,g,v,E,L){s.emplaceBack((n<<1)+E,(o<<1)+v,(Math.floor(d*Q)<<1)+g,Math.round(L))}function re(s,n,o){s.emplaceBack(n.x,n.y,n.z,o[0]*16384,o[1]*16384,o[2]*16384)}class ge{constructor(){this.acc=new me(0,0),this.polyCount=[]}startRing(n){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new me(n.x,n.y),this.max=new me(n.x,n.y))}append(n,o){this.currentPolyCount.edges++,this.acc._add(n);const d=this.min,g=this.max;n.x<d.x?d.x=n.x:n.x>g.x&&(g.x=n.x),n.y<d.y?d.y=n.y:n.y>g.y&&(g.y=n.y),((n.x===0||n.x===Zn)&&n.x===o.x)!=((n.y===0||n.y===Zn)&&n.y===o.y)&&this.processBorderOverlap(n,o),o.x<0!=n.x<0&&this.addBorderIntersection(0,gr(o.y,n.y,(0-o.x)/(n.x-o.x))),o.x>Zn!=n.x>Zn&&this.addBorderIntersection(1,gr(o.y,n.y,(Zn-o.x)/(n.x-o.x))),o.y<0!=n.y<0&&this.addBorderIntersection(2,gr(o.x,n.x,(0-o.y)/(n.y-o.y))),o.y>Zn!=n.y>Zn&&this.addBorderIntersection(3,gr(o.x,n.x,(Zn-o.y)/(n.y-o.y)))}addBorderIntersection(n,o){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const d=this.borders[n];o<d[0]&&(d[0]=o),o>d[1]&&(d[1]=o)}processBorderOverlap(n,o){if(n.x===o.x){if(n.y===o.y)return;const d=n.x===0?0:1;this.addBorderIntersection(d,o.y),this.addBorderIntersection(d,n.y)}else{const d=n.y===0?2:3;this.addBorderIntersection(d,o.x),this.addBorderIntersection(d,n.x)}}centroid(){const n=this.polyCount.reduce((o,d)=>o+d.edges,0);return n!==0?this.acc.div(n)._round():new me(0,0)}span(){return new me(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((n,o)=>n+ +(o[0]!==Number.MAX_VALUE),0)}}class Ce{constructor(n){this.zoom=n.zoom,this.canonical=n.canonical,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(o=>o.id),this.index=n.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=n.projection,this.layoutVertexArray=new Qr,this.centroidVertexArray=new Fy,this.indexArray=new _o,this.programConfigurations=new _A(n.layers,n.zoom),this.segments=new to,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.enableTerrain=n.enableTerrain}populate(n,o,d,g){this.features=[],this.hasPattern=Ip("fill-extrusion",this.layers,o),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(v){const E=Math.exp(Math.PI*(1-v.y/(1<<v.z)*2));return 80150034*E/(E*E+1)/Zn/(1<<v.z)}(d),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:v,id:E,index:L,sourceLayerIndex:k}of n){const V=this.layers[0]._featureFilter.needGeometry,q=xA(v,V);if(!this.layers[0]._featureFilter.filter(new qt(this.zoom),q,d))continue;const se={id:E,sourceLayerIndex:k,index:L,geometry:V?q.geometry:Yh(v,d,g),properties:v.properties,type:v.type,patterns:{}},he=this.layoutVertexArray.length;this.hasPattern?this.features.push(Ed("fill-extrusion",this.layers,se,this.zoom,o)):this.addFeature(se,se.geometry,L,d,{},o.availableImages,g),o.featureIndex.insert(v,se.geometry,L,k,this.index,he)}this.sortBorders()}addFeatures(n,o,d,g,v){for(const E of this.features){const{geometry:L}=E;this.addFeature(E,L,E.index,o,d,g,v)}this.sortBorders()}update(n,o,d,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,o,this.stateDependentLayers,d,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,l0),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=n.createVertexBuffer(this.layoutVertexExtArray,a0.members,!0))),this.programConfigurations.upload(n),this.uploaded=!0}uploadCentroid(n){this.centroidVertexArray.length!==0&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,Lp.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,o,d,g,v,E,L){const k=[new me(0,0),new me(Zn,Zn)],V=L.projection,q=V.name==="globe",se=this.enableTerrain&&!q?new ge:null,he=z[n.type]==="Polygon";q&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new _r);const _e=Qf(o,500);for(let xt=_e.length-1;xt>=0;xt--){const Dt=_e[xt];(Dt.length===0||(be=Dt[0]).every(_t=>_t.x<=0)||be.every(_t=>_t.x>=Zn)||be.every(_t=>_t.y<=0)||be.every(_t=>_t.y>=Zn))&&_e.splice(xt,1)}var be;let De;if(q)De=gi(_e,k,g);else{De=[];for(const xt of _e)De.push({polygon:xt,bounds:k})}const Ze=he?this.edgeRadius:0;for(const{polygon:xt,bounds:Dt}of De){let _t=0,Tt=0;for(const Ut of xt)he&&!Ut[0].equals(Ut[Ut.length-1])&&Ut.push(Ut[0]),Tt+=he?Ut.length-1:Ut.length;const kt=this.segments.prepareSegment((he?5:4)*Tt,this.layoutVertexArray,this.indexArray);if(he){const Ut=[],ci=[];_t=kt.vertexLength;for(const Ti of xt){let Ki,_i;Ti.length&&Ti!==xt[0]&&ci.push(Ut.length/2),Ki=Ti[1].sub(Ti[0])._perp()._unit();for(let Si=1;Si<Ti.length;Si++){const Li=Ti[Si],Vi=Ti[Si===Ti.length-1?1:Si+1];let{x:Zi,y:yi}=Li;if(Ze){_i=Vi.sub(Li)._perp()._unit();const sn=Ki.add(_i)._unit(),Kn=Ze*Math.min(4,1/(Ki.x*sn.x+Ki.y*sn.y));Zi+=Kn*sn.x,yi+=Kn*sn.y,Ki=_i}Z(this.layoutVertexArray,Zi,yi,0,0,1,1,0),kt.vertexLength++,Ut.push(Li.x,Li.y),q&&re(this.layoutVertexExtArray,V.projectTilePoint(Zi,yi,g),V.upVector(g,Zi,yi))}}const ai=vd.exports(Ut,ci);for(let Ti=0;Ti<ai.length;Ti+=3)this.indexArray.emplaceBack(_t+ai[Ti],_t+ai[Ti+2],_t+ai[Ti+1]),kt.primitiveLength++}for(const Ut of xt){se&&Ut.length&&se.startRing(Ut[0]);let ci,ai,Ti,Ki=Ut.length>4&&Rt(Ut[Ut.length-2],Ut[0],Ut[1]),_i=Ze?Oe(Ut[Ut.length-2],Ut[0],Ut[1],Ze):0;ai=Ut[1].sub(Ut[0])._perp()._unit();let Si=!0;for(let Li=1,Vi=0;Li<Ut.length;Li++){let Zi=Ut[Li-1],yi=Ut[Li];const sn=Ut[Li===Ut.length-1?1:Li+1];if(se&&he&&se.currentPolyCount.top++,$e(yi,Zi,Dt)){Ze&&(ai=sn.sub(yi)._perp()._unit(),Si=!Si);continue}se&&se.append(yi,Zi);const Kn=yi.sub(Zi)._perp(),dn=Kn.x/(Math.abs(Kn.x)+Math.abs(Kn.y)),Ln=Kn.y>0?1:0,ln=Zi.dist(yi);if(Vi+ln>32768&&(Vi=0),Ze){Ti=sn.sub(yi)._perp()._unit();let xr=je(Zi,yi,sn,Fe(ai,Ti),Ze);isNaN(xr)&&(xr=0);const Jn=yi.sub(Zi)._unit();Zi=Zi.add(Jn.mult(_i))._round(),yi=yi.add(Jn.mult(-xr))._round(),_i=xr,ai=Ti}const Xn=kt.vertexLength,Tr=Ut.length>4&&Rt(Zi,yi,sn);let wr=Mt(Vi,Ki,Si);if(Z(this.layoutVertexArray,Zi.x,Zi.y,dn,Ln,0,0,wr),Z(this.layoutVertexArray,Zi.x,Zi.y,dn,Ln,0,1,wr),Vi+=ln,wr=Mt(Vi,Tr,!Si),Ki=Tr,Z(this.layoutVertexArray,yi.x,yi.y,dn,Ln,0,0,wr),Z(this.layoutVertexArray,yi.x,yi.y,dn,Ln,0,1,wr),kt.vertexLength+=4,this.indexArray.emplaceBack(Xn+0,Xn+1,Xn+2),this.indexArray.emplaceBack(Xn+1,Xn+3,Xn+2),kt.primitiveLength+=2,Ze){const xr=_t+(Li===1?Ut.length-2:Li-2),Jn=Li===1?_t:xr+1;if(this.indexArray.emplaceBack(Xn+1,xr,Xn+3),this.indexArray.emplaceBack(xr,Jn,Xn+3),kt.primitiveLength+=2,ci===void 0&&(ci=Xn),!$e(sn,Ut[Li],Dt)){const es=Li===Ut.length-1?ci:kt.vertexLength;this.indexArray.emplaceBack(Xn+2,Xn+3,es),this.indexArray.emplaceBack(Xn+3,es+1,es),this.indexArray.emplaceBack(Xn+3,Jn,es+1),kt.primitiveLength+=3}Si=!Si}if(q){const xr=this.layoutVertexExtArray,Jn=V.projectTilePoint(Zi.x,Zi.y,g),es=V.projectTilePoint(yi.x,yi.y,g),ir=V.upVector(g,Zi.x,Zi.y),Sr=V.upVector(g,yi.x,yi.y);re(xr,Jn,ir),re(xr,Jn,ir),re(xr,es,Sr),re(xr,es,Sr)}}he&&(_t+=Ut.length-1)}}if(se&&se.polyCount.length>0){if(se.borders){se.vertexArrayOffset=this.centroidVertexArray.length;const xt=se.borders,Dt=this.featuresOnBorder.push(se)-1;for(let _t=0;_t<4;_t++)xt[_t][0]!==Number.MAX_VALUE&&this.borders[_t].push(Dt)}this.encodeCentroid(se.borders?void 0:se.centroid(),se)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,v,E,g)}sortBorders(){for(let n=0;n<4;n++)this.borders[n].sort((o,d)=>this.featuresOnBorder[o].borders[n][0]-this.featuresOnBorder[d].borders[n][0])}encodeCentroid(n,o,d=!0){let g,v;if(n)if(n.y!==0){const L=o.span()._mult(this.tileToMeter);g=(Math.max(n.x,1)<<3)+Math.min(7,Math.round(L.x/10)),v=(Math.max(n.y,1)<<3)+Math.min(7,Math.round(L.y/10))}else g=Math.ceil(7*(n.x+450)),v=0;else g=0,v=+d;let E=d?this.centroidVertexArray.length:o.vertexArrayOffset;for(const L of o.polyCount){d&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*L.edges+L.top);for(let k=0;k<L.top;k++)this.centroidVertexArray.emplace(E++,g,v);for(let k=0;k<2*L.edges;k++)this.centroidVertexArray.emplace(E++,0,v),this.centroidVertexArray.emplace(E++,g,v)}}}function Fe(s,n){const o=s.add(n)._unit();return s.x*o.x+s.y*o.y}function Oe(s,n,o,d){const g=n.sub(s)._perp()._unit(),v=o.sub(n)._perp()._unit();return je(s,n,o,Fe(g,v),d)}function je(s,n,o,d,g){const v=Math.sqrt(1-d*d);return Math.min(s.dist(n)/3,n.dist(o)/3,g*v/d)}function $e(s,n,o){return s.x<o[0].x&&n.x<o[0].x||s.x>o[1].x&&n.x>o[1].x||s.y<o[0].y&&n.y<o[0].y||s.y>o[1].y&&n.y>o[1].y}function Rt(s,n,o){if(s.x<0||s.x>=Zn||n.x<0||n.x>=Zn||o.x<0||o.x>=Zn)return!1;const d=o.sub(n),g=d.perp(),v=s.sub(n);return(d.x*v.x+d.y*v.y)/Math.sqrt((d.x*d.x+d.y*d.y)*(v.x*v.x+v.y*v.y))>-.866&&g.x*v.x+g.y*v.y<0}function Mt(s,n,o){const d=n?2|s:-3&s;return o?1|d:-2&d}function ri(){const s=Math.PI/32,n=Math.tan(s),o=Tf;return o*Math.sqrt(1+2*n*n)-o}function gi(s,n,o){const d=1<<o.z,g=bl(o.x/d),v=bl((o.x+1)/d),E=Fo(o.y/d),L=Fo((o.y+1)/d);return function(k,V,q,se,he=0,_e){const be=[];if(!k.length||!q||!se)return be;const De=(Ut,ci)=>{for(const ai of Ut)be.push({polygon:ai,bounds:ci})},Ze=Math.ceil(Math.log2(q)),xt=Math.ceil(Math.log2(se)),Dt=Ze-xt,_t=[];for(let Ut=0;Ut<Math.abs(Dt);Ut++)_t.push(Dt>0?0:1);for(let Ut=0;Ut<Math.min(Ze,xt);Ut++)_t.push(0),_t.push(1);let Tt=k;if(Tt=I(Tt,V[0].y-he,V[1].y+he,1),Tt=I(Tt,V[0].x-he,V[1].x+he,0),!Tt.length)return be;const kt=[];for(_t.length?kt.push({polygons:Tt,bounds:V,depth:0}):De(Tt,V);kt.length;){const Ut=kt.pop(),ci=Ut.depth,ai=_t[ci],Ti=Ut.bounds[0],Ki=Ut.bounds[1],_i=ai===0?Ti.x:Ti.y,Si=ai===0?Ki.x:Ki.y,Li=_e?_e(ai,_i,Si):.5*(_i+Si),Vi=I(Ut.polygons,_i-he,Li+he,ai),Zi=I(Ut.polygons,Li-he,Si+he,ai);if(Vi.length){const yi=[Ti,new me(ai===0?Li:Ki.x,ai===1?Li:Ki.y)];_t.length>ci+1?kt.push({polygons:Vi,bounds:yi,depth:ci+1}):De(Vi,yi)}if(Zi.length){const yi=[new me(ai===0?Li:Ti.x,ai===1?Li:Ti.y),Ki];_t.length>ci+1?kt.push({polygons:Zi,bounds:yi,depth:ci+1}):De(Zi,yi)}}return be}(s,n,Math.ceil((v-g)/11.25),Math.ceil((E-L)/11.25),1,(k,V,q)=>{if(k===0)return .5*(V+q);{const se=Fo((o.y+V/Zn)/d);return(ch(.5*(Fo((o.y+q/Zn)/d)+se))*d-o.y)*Zn}})}zt(Ce,"FillExtrusionBucket",{omit:["layers","features"]}),zt(ge,"PartMetadata");const ei=new Hn({"fill-extrusion-edge-radius":new Jt(Yt["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var ui={paint:new Hn({"fill-extrusion-opacity":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new pi(Yt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pi(Yt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new pi(Yt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new pi(Yt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:ei};function Pi(s,n,o){var d=2*Math.PI*6378137/256/Math.pow(2,o);return[s*d-2*Math.PI*6378137/2,n*d-2*Math.PI*6378137/2]}class Fi{constructor(n,o,d){this.z=n,this.x=o,this.y=d,this.key=mn(0,n,n,o,d)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,o){const d=function(v,E,L){var k=Pi(256*v,256*(E=Math.pow(2,L)-E-1),L),V=Pi(256*(v+1),256*(E+1),L);return k[0]+","+k[1]+","+V[0]+","+V[1]}(this.x,this.y,this.z),g=function(v,E,L){let k,V="";for(let q=v;q>0;q--)k=1<<q-1,V+=(E&k?1:0)+(L&k?2:0);return V}(this.z,this.x,this.y);return n[(this.x+this.y)%n.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",g).replace("{bbox-epsg-3857}",d)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Sn{constructor(n,o){this.wrap=n,this.canonical=o,this.key=mn(n,o.z,o.z,o.x,o.y)}}class fn{constructor(n,o,d,g,v){this.overscaledZ=n,this.wrap=o,this.canonical=new Fi(d,+g,+v),this.key=o===0&&n===d?this.canonical.key:mn(o,n,d,g,v)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){const o=this.canonical.z-n;return n>this.canonical.z?new fn(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new fn(n,this.wrap,n,this.canonical.x>>o,this.canonical.y>>o)}calculateScaledKey(n,o=!0){if(this.overscaledZ===n&&o)return this.key;if(n>this.canonical.z)return mn(this.wrap*+o,n,this.canonical.z,this.canonical.x,this.canonical.y);{const d=this.canonical.z-n;return mn(this.wrap*+o,n,n,this.canonical.x>>d,this.canonical.y>>d)}}isChildOf(n){if(n.wrap!==this.wrap)return!1;const o=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ<this.overscaledZ&&n.canonical.x===this.canonical.x>>o&&n.canonical.y===this.canonical.y>>o}children(n){if(this.overscaledZ>=n)return[new fn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const o=this.canonical.z+1,d=2*this.canonical.x,g=2*this.canonical.y;return[new fn(o,this.wrap,o,d,g),new fn(o,this.wrap,o,d+1,g),new fn(o,this.wrap,o,d,g+1),new fn(o,this.wrap,o,d+1,g+1)]}isLessThan(n){return this.wrap<n.wrap||!(this.wrap>n.wrap)&&(this.overscaledZ<n.overscaledZ||!(this.overscaledZ>n.overscaledZ)&&(this.canonical.x<n.canonical.x||!(this.canonical.x>n.canonical.x)&&this.canonical.y<n.canonical.y))}wrapped(){return new fn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(n){return new fn(this.overscaledZ,n,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Sn(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function mn(s,n,o,d,g){const v=1<<Math.min(o,22);let E=v*(g%v)+d%v;return s&&o<22&&(E+=v*v*((s<0?-2*s-1:2*s)%(1<<2*(22-o)))),16*(32*E+o)+(n-o)}zt(Fi,"CanonicalTileID"),zt(fn,"OverscaledTileID",{omit:["projMatrix"]});class an extends me{constructor(n,o,d){super(n,o),this.z=d}}function nn(s,n){return s.x*n.x+s.y*n.y}function vn(s,n){if(s.length===1){let o=0;const d=n[o++];let g;for(;!g||d.equals(g);)if(g=n[o++],!g)return 1/0;for(;o<n.length;o++){const v=n[o],E=s[0],L=g.sub(d),k=v.sub(d),V=E.sub(d),q=nn(L,L),se=nn(L,k),he=nn(k,k),_e=nn(V,L),be=nn(V,k),De=q*he-se*se,Ze=(he*_e-se*be)/De,xt=(q*be-se*_e)/De,Dt=d.z*(1-Ze-xt)+g.z*Ze+v.z*xt;if(isFinite(Dt))return Dt}return 1/0}{let o=1/0;for(const d of n)o=Math.min(o,d.z);return o}}function gn(s,n,o,d,g,v,E,L){const k=E*g.getElevationAt(s,n,!0,!0),V=v[0]!==0,q=V?v[1]===0?E*(v[0]/7-450):E*function(se,he,_e){const be=Math.floor(he[0]/8),De=Math.floor(he[1]/8),Ze=10*(he[0]-8*be),xt=10*(he[1]-8*De),Dt=se.getElevationAt(be,De,!0,!0),_t=se.getMeterToDEM(_e),Tt=Math.floor(.5*(Ze*_t-1)),kt=Math.floor(.5*(xt*_t-1)),Ut=se.tileCoordToPixel(be,De),ci=2*Tt+1,ai=2*kt+1,Ti=function(Zi,yi,sn,Kn,dn){return[Zi.getElevationAtPixel(yi,sn,!0),Zi.getElevationAtPixel(yi+dn,sn,!0),Zi.getElevationAtPixel(yi,sn+dn,!0),Zi.getElevationAtPixel(yi+Kn,sn+dn,!0)]}(se,Ut.x-Tt,Ut.y-kt,ci,ai),Ki=Math.abs(Ti[0]-Ti[1]),_i=Math.abs(Ti[2]-Ti[3]),Si=Math.abs(Ti[0]-Ti[2])+Math.abs(Ti[1]-Ti[3]),Li=Math.min(.25,.5*_t*(Ki+_i)/ci),Vi=Math.min(.25,.5*_t*Si/ai);return Dt+Math.max(Li*Ze,Vi*xt)}(g,v,L):k;return{base:k+(o===0)?-1:o,top:V?Math.max(q+d,k+o+2):k+d}}const Ji=_n([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:Wn}=Ji,zn=_n([{name:"a_packed",components:4,type:"Float32"}]),{members:yr}=zn,ms=w.types,bs=Math.cos(Math.PI/180*37.5);class Vs{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(o=>o.id),this.index=n.index,this.projection=n.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(o=>{this.gradients[o.id]={}}),this.layoutVertexArray=new go,this.layoutVertexArray2=new Ca,this.indexArray=new _o,this.programConfigurations=new _A(n.layers,n.zoom),this.segments=new to,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(n,o,d,g){this.hasPattern=Ip("line",this.layers,o);const v=this.layers[0].layout.get("line-sort-key"),E=[];for(const{feature:q,id:se,index:he,sourceLayerIndex:_e}of n){const be=this.layers[0]._featureFilter.needGeometry,De=xA(q,be);if(!this.layers[0]._featureFilter.filter(new qt(this.zoom),De,d))continue;const Ze=v?v.evaluate(De,{},d):void 0,xt={id:se,properties:q.properties,type:q.type,sourceLayerIndex:_e,index:he,geometry:be?De.geometry:Yh(q,d,g),patterns:{},sortKey:Ze};E.push(xt)}v&&E.sort((q,se)=>q.sortKey-se.sortKey);const{lineAtlas:L,featureIndex:k}=o,V=this.addConstantDashes(L);for(const q of E){const{geometry:se,index:he,sourceLayerIndex:_e}=q;if(V&&this.addFeatureDashes(q,L),this.hasPattern){const be=Ed("line",this.layers,q,this.zoom,o);this.patternFeatures.push(be)}else this.addFeature(q,se,he,d,L.positions,o.availableImages);k.insert(n[he].feature,se,he,_e,this.index)}}addConstantDashes(n){let o=!1;for(const d of this.layers){const g=d.paint.get("line-dasharray").value,v=d.layout.get("line-cap").value;if(g.kind!=="constant"||v.kind!=="constant")o=!0;else{const E=v.value,L=g.value;if(!L)continue;n.addDash(L,E)}}return o}addFeatureDashes(n,o){const d=this.zoom;for(const g of this.layers){const v=g.paint.get("line-dasharray").value,E=g.layout.get("line-cap").value;if(v.kind==="constant"&&E.kind==="constant")continue;let L,k;if(v.kind==="constant"){if(L=v.value,!L)continue}else L=v.evaluate({zoom:d},n);k=E.kind==="constant"?E.value:E.evaluate({zoom:d},n),o.addDash(L,k),n.patterns[g.id]=o.getKey(L,k)}}update(n,o,d,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,o,this.stateDependentLayers,d,g)}addFeatures(n,o,d,g,v){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,o,d,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,yr)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Wn),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&n.properties.hasOwnProperty("mapbox_clip_start")&&n.properties.hasOwnProperty("mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,o,d,g,v,E){const L=this.layers[0].layout,k=L.get("line-join").evaluate(n,{}),V=L.get("line-cap").evaluate(n,{}),q=L.get("line-miter-limit"),se=L.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const he of o)this.addLine(he,n,k,V,q,se);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,v,E,g)}addLine(n,o,d,g,v,E){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let xt=0;xt<n.length-1;xt++)this.totalDistance+=n[xt].dist(n[xt+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const L=ms[o.type]==="Polygon";let k=n.length;for(;k>=2&&n[k-1].equals(n[k-2]);)k--;let V=0;for(;V<k-1&&n[V].equals(n[V+1]);)V++;if(k<(L?3:2))return;d==="bevel"&&(v=1.05);const q=this.overscaling<=16?122880/(512*this.overscaling):0,se=this.segments.prepareSegment(10*k,this.layoutVertexArray,this.indexArray);let he,_e,be,De,Ze;this.e1=this.e2=-1,L&&(he=n[k-2],Ze=n[V].sub(he)._unit()._perp());for(let xt=V;xt<k;xt++){if(be=xt===k-1?L?n[V+1]:void 0:n[xt+1],be&&n[xt].equals(be))continue;Ze&&(De=Ze),he&&(_e=he),he=n[xt],Ze=be?be.sub(he)._unit()._perp():De,De=De||Ze;let Dt=De.add(Ze);Dt.x===0&&Dt.y===0||Dt._unit();const _t=De.x*Ze.x+De.y*Ze.y,Tt=Dt.x*Ze.x+Dt.y*Ze.y,kt=Tt!==0?1/Tt:1/0,Ut=2*Math.sqrt(2-2*Tt),ci=Tt<bs&&_e&&be,ai=De.x*Ze.y-De.y*Ze.x>0;if(ci&&xt>V){const _i=he.dist(_e);if(_i>2*q){const Si=he.sub(he.sub(_e)._mult(q/_i)._round());this.updateDistance(_e,Si),this.addCurrentVertex(Si,De,0,0,se),_e=Si}}const Ti=_e&&be;let Ki=Ti?d:L?"butt":g;if(Ti&&Ki==="round"&&(kt<E?Ki="miter":kt<=2&&(Ki="fakeround")),Ki==="miter"&&kt>v&&(Ki="bevel"),Ki==="bevel"&&(kt>2&&(Ki="flipbevel"),kt<v&&(Ki="miter")),_e&&this.updateDistance(_e,he),Ki==="miter")Dt._mult(kt),this.addCurrentVertex(he,Dt,0,0,se);else if(Ki==="flipbevel"){if(kt>100)Dt=Ze.mult(-1);else{const _i=kt*De.add(Ze).mag()/De.sub(Ze).mag();Dt._perp()._mult(_i*(ai?-1:1))}this.addCurrentVertex(he,Dt,0,0,se),this.addCurrentVertex(he,Dt.mult(-1),0,0,se)}else if(Ki==="bevel"||Ki==="fakeround"){const _i=-Math.sqrt(kt*kt-1),Si=ai?_i:0,Li=ai?0:_i;if(_e&&this.addCurrentVertex(he,De,Si,Li,se),Ki==="fakeround"){const Vi=Math.round(180*Ut/Math.PI/20);for(let Zi=1;Zi<Vi;Zi++){let yi=Zi/Vi;if(yi!==.5){const Kn=yi-.5;yi+=yi*Kn*(yi-1)*((1.0904+_t*(_t*(3.55645-1.43519*_t)-3.2452))*Kn*Kn+(.848013+_t*(.215638*_t-1.06021)))}const sn=Ze.sub(De)._mult(yi)._add(De)._unit()._mult(ai?-1:1);this.addHalfVertex(he,sn.x,sn.y,!1,ai,0,se)}}be&&this.addCurrentVertex(he,Ze,-Si,-Li,se)}else if(Ki==="butt")this.addCurrentVertex(he,Dt,0,0,se);else if(Ki==="square"){const _i=_e?1:-1;_e||this.addCurrentVertex(he,Dt,_i,_i,se),this.addCurrentVertex(he,Dt,0,0,se),_e&&this.addCurrentVertex(he,Dt,_i,_i,se)}else Ki==="round"&&(_e&&(this.addCurrentVertex(he,De,0,0,se),this.addCurrentVertex(he,De,1,1,se,!0)),be&&(this.addCurrentVertex(he,Ze,-1,-1,se,!0),this.addCurrentVertex(he,Ze,0,0,se)));if(ci&&xt<k-1){const _i=he.dist(be);if(_i>2*q){const Si=he.add(be.sub(he)._mult(q/_i)._round());this.updateDistance(he,Si),this.addCurrentVertex(Si,Ze,0,0,se),he=Si}}}}addCurrentVertex(n,o,d,g,v,E=!1){const L=o.y*g-o.x,k=-o.y-o.x*g;this.addHalfVertex(n,o.x+o.y*d,o.y-o.x*d,E,!1,d,v),this.addHalfVertex(n,L,k,E,!0,-g,v)}addHalfVertex({x:n,y:o},d,g,v,E,L,k){this.layoutVertexArray.emplaceBack((n<<1)+(v?1:0),(o<<1)+(E?1:0),Math.round(63*d)+128,Math.round(63*g)+128,1+(L===0?0:L<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const V=k.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,V),k.primitiveLength++),E?this.e2=V:this.e1=V}updateScaledDistance(){if(this.lineClips){const n=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=n*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(n,o){this.distance+=n.dist(o),this.updateScaledDistance()}}zt(Vs,"LineBucket",{omit:["layers","patternFeatures"]});const Cl=new Hn({"line-cap":new pi(Yt.layout_line["line-cap"]),"line-join":new pi(Yt.layout_line["line-join"]),"line-miter-limit":new Jt(Yt.layout_line["line-miter-limit"]),"line-round-limit":new Jt(Yt.layout_line["line-round-limit"]),"line-sort-key":new pi(Yt.layout_line["line-sort-key"])});var xo={paint:new Hn({"line-opacity":new pi(Yt.paint_line["line-opacity"]),"line-color":new pi(Yt.paint_line["line-color"]),"line-translate":new Jt(Yt.paint_line["line-translate"]),"line-translate-anchor":new Jt(Yt.paint_line["line-translate-anchor"]),"line-width":new pi(Yt.paint_line["line-width"]),"line-gap-width":new pi(Yt.paint_line["line-gap-width"]),"line-offset":new pi(Yt.paint_line["line-offset"]),"line-blur":new pi(Yt.paint_line["line-blur"]),"line-dasharray":new pi(Yt.paint_line["line-dasharray"]),"line-pattern":new pi(Yt.paint_line["line-pattern"]),"line-gradient":new In(Yt.paint_line["line-gradient"]),"line-trim-offset":new Jt(Yt.paint_line["line-trim-offset"])}),layout:Cl};const Ks=new class extends pi{possiblyEvaluate(s,n){return n=new qt(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,transition:n.transition}),super.possiblyEvaluate(s,n)}evaluate(s,n,o,d){return n=Ve({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(s,n,o,d)}}(xo.paint.properties["line-width"].specification);function oo(s,n){return n>0?n+2*s:s}Ks.useIntegerZoom=!0;const Lo=_n([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),$o=_n([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Ia=_n([{name:"a_projected_pos",components:4,type:"Float32"}],4);_n([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const io=_n([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Do=_n([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);_n([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Po=_n([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),fa=_n([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);_n([{name:"triangle",components:3,type:"Uint16"}]),_n([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),_n([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),_n([{type:"Float32",name:"offsetX"}]),_n([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Jr=24;const Hs=128;function gs(s,n){const{expression:o}=n;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new qt(s+1))};if(o.kind==="source")return{kind:"source"};{const{zoomStops:d,interpolationType:g}=o;let v=0;for(;v<d.length&&d[v]<=s;)v++;v=Math.max(0,v-1);let E=v;for(;E<d.length&&d[E]<s+1;)E++;E=Math.min(d.length-1,E);const L=d[v],k=d[E];return o.kind==="composite"?{kind:"composite",minZoom:L,maxZoom:k,interpolationType:g}:{kind:"camera",minZoom:L,maxZoom:k,minSize:o.evaluate(new qt(L)),maxSize:o.evaluate(new qt(k)),interpolationType:g}}}function $s(s,{uSize:n,uSizeT:o},{lowerSize:d,upperSize:g}){return s.kind==="source"?d/Hs:s.kind==="composite"?gr(d/Hs,g/Hs,o):n}function pr(s,n){let o=0,d=0;if(s.kind==="constant")d=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:g,minZoom:v,maxZoom:E}=s,L=g?ye(Ho.interpolationFactor(g,n,v,E),0,1):0;s.kind==="camera"?d=gr(s.minSize,s.maxSize,L):o=L}return{uSizeT:o,uSize:d}}var Ya=Object.freeze({__proto__:null,getSizeData:gs,evaluateSizeForFeature:$s,evaluateSizeForZoom:pr,SIZE_PACK_FACTOR:Hs});function Uo(s,n,o){return s.sections.forEach(d=>{d.text=function(g,v,E){const L=v.layout.get("text-transform").evaluate(E,{});return L==="uppercase"?g=g.toLocaleUpperCase():L==="lowercase"&&(g=g.toLocaleLowerCase()),si.applyArabicShaping&&(g=si.applyArabicShaping(g)),g}(d.text,n,o)}),s}const ao={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};function Jl(s){return s==="\uFE36"||s==="\uFE48"||s==="\uFE38"||s==="\uFE44"||s==="\uFE42"||s==="\uFE3E"||s==="\uFE3C"||s==="\uFE3A"||s==="\uFE18"||s==="\uFE40"||s==="\uFE10"||s==="\uFE13"||s==="\uFE14"||s==="\uFF40"||s==="\uFFE3"||s==="\uFE11"||s==="\uFE12"}function Bc(s){return s==="\uFE35"||s==="\uFE47"||s==="\uFE37"||s==="\uFE43"||s==="\uFE41"||s==="\uFE3D"||s==="\uFE3B"||s==="\uFE39"||s==="\uFE17"||s==="\uFE3F"}var Fa=vr,Ah=function(s,n,o,d,g){var v,E,L=8*g-d-1,k=(1<<L)-1,V=k>>1,q=-7,se=o?g-1:0,he=o?-1:1,_e=s[n+se];for(se+=he,v=_e&(1<<-q)-1,_e>>=-q,q+=L;q>0;v=256*v+s[n+se],se+=he,q-=8);for(E=v&(1<<-q)-1,v>>=-q,q+=d;q>0;E=256*E+s[n+se],se+=he,q-=8);if(v===0)v=1-V;else{if(v===k)return E?NaN:1/0*(_e?-1:1);E+=Math.pow(2,d),v-=V}return(_e?-1:1)*E*Math.pow(2,v-d)},El=function(s,n,o,d,g,v){var E,L,k,V=8*v-g-1,q=(1<<V)-1,se=q>>1,he=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,_e=d?0:v-1,be=d?1:-1,De=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(L=isNaN(n)?1:0,E=q):(E=Math.floor(Math.log(n)/Math.LN2),n*(k=Math.pow(2,-E))<1&&(E--,k*=2),(n+=E+se>=1?he/k:he*Math.pow(2,1-se))*k>=2&&(E++,k/=2),E+se>=q?(L=0,E=q):E+se>=1?(L=(n*k-1)*Math.pow(2,g),E+=se):(L=n*Math.pow(2,se-1)*Math.pow(2,g),E=0));g>=8;s[o+_e]=255&L,_e+=be,L/=256,g-=8);for(E=E<<g|L,V+=g;V>0;s[o+_e]=255&E,_e+=be,E/=256,V-=8);s[o+_e-be]|=128*De};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function vr(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}vr.Varint=0,vr.Fixed64=1,vr.Bytes=2,vr.Fixed32=5;var Zo=4294967296,dh=1/Zo,Sd=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ph(s){return s.type===vr.Bytes?s.readVarint()+s.pos:s.pos+1}function Iu(s,n,o){return o?4294967296*n+(s>>>0):4294967296*(n>>>0)+(s>>>0)}function Gf(s,n,o){var d=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));o.realloc(d);for(var g=o.pos-1;g>=s;g--)o.buf[g+d]=o.buf[g]}function tu(s,n){for(var o=0;o<s.length;o++)n.writeVarint(s[o])}function h0(s,n){for(var o=0;o<s.length;o++)n.writeSVarint(s[o])}function Rg(s,n){for(var o=0;o<s.length;o++)n.writeFloat(s[o])}function zg(s,n){for(var o=0;o<s.length;o++)n.writeDouble(s[o])}function u0(s,n){for(var o=0;o<s.length;o++)n.writeBoolean(s[o])}function w1(s,n){for(var o=0;o<s.length;o++)n.writeFixed32(s[o])}function b1(s,n){for(var o=0;o<s.length;o++)n.writeSFixed32(s[o])}function B1(s,n){for(var o=0;o<s.length;o++)n.writeFixed64(s[o])}function C1(s,n){for(var o=0;o<s.length;o++)n.writeSFixed64(s[o])}function Wf(s,n){return(s[n]|s[n+1]<<8|s[n+2]<<16)+16777216*s[n+3]}function Md(s,n,o){s[o]=n,s[o+1]=n>>>8,s[o+2]=n>>>16,s[o+3]=n>>>24}function A0(s,n){return(s[n]|s[n+1]<<8|s[n+2]<<16)+(s[n+3]<<24)}function E1(s,n,o){n.glyphs=[],s===1&&o.readMessage(Cc,n)}function Cc(s,n,o){if(s===3){const{id:d,bitmap:g,width:v,height:E,left:L,top:k,advance:V}=o.readMessage(jf,{});n.glyphs.push({id:d,bitmap:new Yl({width:v+6,height:E+6},g),metrics:{width:v,height:E,left:L,top:k,advance:V}})}else s===4?n.ascender=o.readSVarint():s===5&&(n.descender=o.readSVarint())}function jf(s,n,o){s===1?n.id=o.readVarint():s===2?n.bitmap=o.readBytes():s===3?n.width=o.readVarint():s===4?n.height=o.readVarint():s===5?n.left=o.readSVarint():s===6?n.top=o.readSVarint():s===7&&(n.advance=o.readVarint())}function Kf(s){let n=0,o=0;for(const E of s)n+=E.w*E.h,o=Math.max(o,E.w);s.sort((E,L)=>L.h-E.h);const d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),o),h:1/0}];let g=0,v=0;for(const E of s)for(let L=d.length-1;L>=0;L--){const k=d[L];if(!(E.w>k.w||E.h>k.h)){if(E.x=k.x,E.y=k.y,v=Math.max(v,E.y+E.h),g=Math.max(g,E.x+E.w),E.w===k.w&&E.h===k.h){const V=d.pop();L<d.length&&(d[L]=V)}else E.h===k.h?(k.x+=E.w,k.w-=E.w):E.w===k.w?(k.y+=E.h,k.h-=E.h):(d.push({x:k.x+E.w,y:k.y,w:k.w-E.w,h:E.h}),k.y+=E.h,k.h-=E.h);break}}return{w:g,h:v,fill:n/(g*v)||0}}vr.prototype={destroy:function(){this.buf=null},readFields:function(s,n,o){for(o=o||this.length;this.pos<o;){var d=this.readVarint(),g=d>>3,v=this.pos;this.type=7&d,s(g,n,this),this.pos===v&&this.skip(d)}return n},readMessage:function(s,n){return this.readFields(s,n,this.readVarint()+this.pos)},readFixed32:function(){var s=Wf(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=A0(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=Wf(this.buf,this.pos)+Wf(this.buf,this.pos+4)*Zo;return this.pos+=8,s},readSFixed64:function(){var s=Wf(this.buf,this.pos)+A0(this.buf,this.pos+4)*Zo;return this.pos+=8,s},readFloat:function(){var s=Ah(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=Ah(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var n,o,d=this.buf;return n=127&(o=d[this.pos++]),o<128?n:(n|=(127&(o=d[this.pos++]))<<7,o<128?n:(n|=(127&(o=d[this.pos++]))<<14,o<128?n:(n|=(127&(o=d[this.pos++]))<<21,o<128?n:function(g,v,E){var L,k,V=E.buf;if(L=(112&(k=V[E.pos++]))>>4,k<128||(L|=(127&(k=V[E.pos++]))<<3,k<128)||(L|=(127&(k=V[E.pos++]))<<10,k<128)||(L|=(127&(k=V[E.pos++]))<<17,k<128)||(L|=(127&(k=V[E.pos++]))<<24,k<128)||(L|=(1&(k=V[E.pos++]))<<31,k<128))return Iu(g,L,v);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(o=d[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var s=this.readVarint()+this.pos,n=this.pos;return this.pos=s,s-n>=12&&Sd?function(o,d,g){return Sd.decode(o.subarray(d,g))}(this.buf,n,s):function(o,d,g){for(var v="",E=d;E<g;){var L,k,V,q=o[E],se=null,he=q>239?4:q>223?3:q>191?2:1;if(E+he>g)break;he===1?q<128&&(se=q):he===2?(192&(L=o[E+1]))==128&&(se=(31&q)<<6|63&L)<=127&&(se=null):he===3?(k=o[E+2],(192&(L=o[E+1]))==128&&(192&k)==128&&((se=(15&q)<<12|(63&L)<<6|63&k)<=2047||se>=55296&&se<=57343)&&(se=null)):he===4&&(k=o[E+2],V=o[E+3],(192&(L=o[E+1]))==128&&(192&k)==128&&(192&V)==128&&((se=(15&q)<<18|(63&L)<<12|(63&k)<<6|63&V)<=65535||se>=1114112)&&(se=null)),se===null?(se=65533,he=1):se>65535&&(se-=65536,v+=String.fromCharCode(se>>>10&1023|55296),se=56320|1023&se),v+=String.fromCharCode(se),E+=he}return v}(this.buf,n,s)},readBytes:function(){var s=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,s);return this.pos=s,n},readPackedVarint:function(s,n){if(this.type!==vr.Bytes)return s.push(this.readVarint(n));var o=ph(this);for(s=s||[];this.pos<o;)s.push(this.readVarint(n));return s},readPackedSVarint:function(s){if(this.type!==vr.Bytes)return s.push(this.readSVarint());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readSVarint());return s},readPackedBoolean:function(s){if(this.type!==vr.Bytes)return s.push(this.readBoolean());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readBoolean());return s},readPackedFloat:function(s){if(this.type!==vr.Bytes)return s.push(this.readFloat());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readFloat());return s},readPackedDouble:function(s){if(this.type!==vr.Bytes)return s.push(this.readDouble());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readDouble());return s},readPackedFixed32:function(s){if(this.type!==vr.Bytes)return s.push(this.readFixed32());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readFixed32());return s},readPackedSFixed32:function(s){if(this.type!==vr.Bytes)return s.push(this.readSFixed32());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readSFixed32());return s},readPackedFixed64:function(s){if(this.type!==vr.Bytes)return s.push(this.readFixed64());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readFixed64());return s},readPackedSFixed64:function(s){if(this.type!==vr.Bytes)return s.push(this.readSFixed64());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readSFixed64());return s},skip:function(s){var n=7&s;if(n===vr.Varint)for(;this.buf[this.pos++]>127;);else if(n===vr.Bytes)this.pos=this.readVarint()+this.pos;else if(n===vr.Fixed32)this.pos+=4;else{if(n!==vr.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(s,n){this.writeVarint(s<<3|n)},realloc:function(s){for(var n=this.length||16;n<this.pos+s;)n*=2;if(n!==this.length){var o=new Uint8Array(n);o.set(this.buf),this.buf=o,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(s){this.realloc(4),Md(this.buf,s,this.pos),this.pos+=4},writeSFixed32:function(s){this.realloc(4),Md(this.buf,s,this.pos),this.pos+=4},writeFixed64:function(s){this.realloc(8),Md(this.buf,-1&s,this.pos),Md(this.buf,Math.floor(s*dh),this.pos+4),this.pos+=8},writeSFixed64:function(s){this.realloc(8),Md(this.buf,-1&s,this.pos),Md(this.buf,Math.floor(s*dh),this.pos+4),this.pos+=8},writeVarint:function(s){(s=+s||0)>268435455||s<0?function(n,o){var d,g;if(n>=0?(d=n%4294967296|0,g=n/4294967296|0):(g=~(-n/4294967296),4294967295^(d=~(-n%4294967296))?d=d+1|0:(d=0,g=g+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");o.realloc(10),function(v,E,L){L.buf[L.pos++]=127&v|128,v>>>=7,L.buf[L.pos++]=127&v|128,v>>>=7,L.buf[L.pos++]=127&v|128,v>>>=7,L.buf[L.pos++]=127&v|128,L.buf[L.pos]=127&(v>>>=7)}(d,0,o),function(v,E){var L=(7&v)<<4;E.buf[E.pos++]|=L|((v>>>=3)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v)))))}(g,o)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(Boolean(s))},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var n=this.pos;this.pos=function(d,g,v){for(var E,L,k=0;k<g.length;k++){if((E=g.charCodeAt(k))>55295&&E<57344){if(!L){E>56319||k+1===g.length?(d[v++]=239,d[v++]=191,d[v++]=189):L=E;continue}if(E<56320){d[v++]=239,d[v++]=191,d[v++]=189,L=E;continue}E=L-55296<<10|E-56320|65536,L=null}else L&&(d[v++]=239,d[v++]=191,d[v++]=189,L=null);E<128?d[v++]=E:(E<2048?d[v++]=E>>6|192:(E<65536?d[v++]=E>>12|224:(d[v++]=E>>18|240,d[v++]=E>>12&63|128),d[v++]=E>>6&63|128),d[v++]=63&E|128)}return v}(this.buf,s,this.pos);var o=this.pos-n;o>=128&&Gf(n,o,this),this.pos=n-1,this.writeVarint(o),this.pos+=o},writeFloat:function(s){this.realloc(4),El(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),El(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var n=s.length;this.writeVarint(n),this.realloc(n);for(var o=0;o<n;o++)this.buf[this.pos++]=s[o]},writeRawMessage:function(s,n){this.pos++;var o=this.pos;s(n,this);var d=this.pos-o;d>=128&&Gf(o,d,this),this.pos=o-1,this.writeVarint(d),this.pos+=d},writeMessage:function(s,n,o){this.writeTag(s,vr.Bytes),this.writeRawMessage(n,o)},writePackedVarint:function(s,n){n.length&&this.writeMessage(s,tu,n)},writePackedSVarint:function(s,n){n.length&&this.writeMessage(s,h0,n)},writePackedBoolean:function(s,n){n.length&&this.writeMessage(s,u0,n)},writePackedFloat:function(s,n){n.length&&this.writeMessage(s,Rg,n)},writePackedDouble:function(s,n){n.length&&this.writeMessage(s,zg,n)},writePackedFixed32:function(s,n){n.length&&this.writeMessage(s,w1,n)},writePackedSFixed32:function(s,n){n.length&&this.writeMessage(s,b1,n)},writePackedFixed64:function(s,n){n.length&&this.writeMessage(s,B1,n)},writePackedSFixed64:function(s,n){n.length&&this.writeMessage(s,C1,n)},writeBytesField:function(s,n){this.writeTag(s,vr.Bytes),this.writeBytes(n)},writeFixed32Field:function(s,n){this.writeTag(s,vr.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(s,n){this.writeTag(s,vr.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(s,n){this.writeTag(s,vr.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(s,n){this.writeTag(s,vr.Fixed64),this.writeSFixed64(n)},writeVarintField:function(s,n){this.writeTag(s,vr.Varint),this.writeVarint(n)},writeSVarintField:function(s,n){this.writeTag(s,vr.Varint),this.writeSVarint(n)},writeStringField:function(s,n){this.writeTag(s,vr.Bytes),this.writeString(n)},writeFloatField:function(s,n){this.writeTag(s,vr.Fixed32),this.writeFloat(n)},writeDoubleField:function(s,n){this.writeTag(s,vr.Fixed64),this.writeDouble(n)},writeBooleanField:function(s,n){this.writeVarintField(s,Boolean(n))}};class Xo{constructor(n,{pixelRatio:o,version:d,stretchX:g,stretchY:v,content:E}){this.paddedRect=n,this.pixelRatio=o,this.stretchX=g,this.stretchY=v,this.content=E,this.version=d}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Ec{constructor(n,o){const d={},g={};this.haveRenderCallbacks=[];const v=[];this.addImages(n,d,v),this.addImages(o,g,v);const{w:E,h:L}=Kf(v),k=new Xa({width:E||1,height:L||1});for(const V in n){const q=n[V],se=d[V].paddedRect;Xa.copy(q.data,k,{x:0,y:0},{x:se.x+1,y:se.y+1},q.data)}for(const V in o){const q=o[V],se=g[V].paddedRect,he=se.x+1,_e=se.y+1,be=q.data.width,De=q.data.height;Xa.copy(q.data,k,{x:0,y:0},{x:he,y:_e},q.data),Xa.copy(q.data,k,{x:0,y:De-1},{x:he,y:_e-1},{width:be,height:1}),Xa.copy(q.data,k,{x:0,y:0},{x:he,y:_e+De},{width:be,height:1}),Xa.copy(q.data,k,{x:be-1,y:0},{x:he-1,y:_e},{width:1,height:De}),Xa.copy(q.data,k,{x:0,y:0},{x:he+be,y:_e},{width:1,height:De})}this.image=k,this.iconPositions=d,this.patternPositions=g}addImages(n,o,d){for(const g in n){const v=n[g],E={x:0,y:0,w:v.data.width+2,h:v.data.height+2};d.push(E),o[g]=new Xo(E,v),v.hasRenderCallback&&this.haveRenderCallbacks.push(g)}}patchUpdatedImages(n,o){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(d=>n.hasImage(d)),n.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const d in n.updatedImages)this.patchUpdatedImage(this.iconPositions[d],n.getImage(d),o),this.patchUpdatedImage(this.patternPositions[d],n.getImage(d),o)}patchUpdatedImage(n,o,d){if(!n||!o||n.version===o.version)return;n.version=o.version;const[g,v]=n.tl;d.update(o.data,void 0,{x:g,y:v})}}zt(Xo,"ImagePosition"),zt(Ec,"ImageAtlas");const qo={horizontal:1,vertical:2,horizontalOnly:3};class iu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(n,o){const d=new iu;return d.scale=n||1,d.fontStack=o,d}static forImage(n){const o=new iu;return o.imageName=n,o}}class IA{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(n,o){const d=new IA;for(let g=0;g<n.sections.length;g++){const v=n.sections[g];v.image?d.addImageSection(v):d.addTextSection(v,o)}return d}length(){return this.text.length}getSection(n){return this.sections[this.sectionIndex[n]]}getSections(){return this.sections}getSectionIndex(n){return this.sectionIndex[n]}getCharCode(n){return this.text.charCodeAt(n)}verticalizePunctuation(n){this.text=function(o,d){let g="";for(let v=0;v<o.length;v++){const E=o.charCodeAt(v+1)||null,L=o.charCodeAt(v-1)||null;g+=!d&&(E&&fe(E)&&!ao[o[v+1]]||L&&fe(L)&&!ao[o[v-1]])||!ao[o[v]]?o[v]:ao[o[v]]}return g}(this.text,n)}trim(){let n=0;for(let d=0;d<this.text.length&&d0[this.text.charCodeAt(d)];d++)n++;let o=this.text.length;for(let d=this.text.length-1;d>=0&&d>=n&&d0[this.text.charCodeAt(d)];d--)o--;this.text=this.text.substring(n,o),this.sectionIndex=this.sectionIndex.slice(n,o)}substring(n,o){const d=new IA;return d.text=this.text.substring(n,o),d.sectionIndex=this.sectionIndex.slice(n,o),d.sections=this.sections,d}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,o)=>Math.max(n,this.sections[o].scale),0)}addTextSection(n,o){this.text+=n.text,this.sections.push(iu.forText(n.scale,n.fontStack||o));const d=this.sections.length-1;for(let g=0;g<n.text.length;++g)this.sectionIndex.push(d)}addImageSection(n){const o=n.image?n.image.name:"";if(o.length===0)return void Ct("Can't add FormattedSection with an empty image.");const d=this.getNextImageSectionCharCode();d?(this.text+=String.fromCharCode(d),this.sections.push(iu.forImage(o)),this.sectionIndex.push(this.sections.length-1)):Ct("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function nu(s,n,o,d,g,v,E,L,k,V,q,se,he,_e,be){const De=IA.fromFeature(s,g);se===qo.vertical&&De.verticalizePunctuation(he);let Ze=[];const xt=function(Ut,ci,ai,Ti,Ki,_i){if(!Ut)return[];const Si=[],Li=function(sn,Kn,dn,Ln,ln,Xn){let Tr=0;for(let wr=0;wr<sn.length();wr++){const xr=sn.getSection(wr);Tr+=EB(sn.getCharCode(wr),xr,Ln,ln,Kn,Xn)}return Tr/Math.max(1,Math.ceil(Tr/dn))}(Ut,ci,ai,Ti,Ki,_i),Vi=Ut.text.indexOf("\u200B")>=0;let Zi=0;for(let sn=0;sn<Ut.length();sn++){const Kn=Ut.getSection(sn),dn=Ut.getCharCode(sn);if(d0[dn]||(Zi+=EB(dn,Kn,Ti,Ki,ci,_i)),sn<Ut.length()-1){const Ln=!((yi=dn)<11904||!(Er(yi)||Cr(yi)||m(yi)||$l(yi)||Aa(yi)||Bn(yi)||Gr(yi)||Un(yi)||ba(yi)||ja(yi)||wa(yi)||P(yi)||Lr(yi)||ur(yi)||tr(yi)||js(yi)||Rr(yi)||a(yi)||mo(yi)||Wo(yi)));(jF[dn]||Ln||Kn.imageName)&&Si.push(SB(sn+1,Zi,Li,Si,KF(dn,Ut.getCharCode(sn+1),Ln&&Vi),!1))}}var yi;return MB(SB(Ut.length(),Zi,Li,Si,0,!0))}(De,V,v,n,d,_e),{processBidirectionalText:Dt,processStyledBidirectionalText:_t}=si;if(Dt&&De.sections.length===1){const Ut=Dt(De.toString(),xt);for(const ci of Ut){const ai=new IA;ai.text=ci,ai.sections=De.sections;for(let Ti=0;Ti<ci.length;Ti++)ai.sectionIndex.push(0);Ze.push(ai)}}else if(_t){const Ut=_t(De.text,De.sectionIndex,xt);for(const ci of Ut){const ai=new IA;ai.text=ci[0],ai.sectionIndex=ci[1],ai.sections=De.sections,Ze.push(ai)}}else Ze=function(Ut,ci){const ai=[],Ti=Ut.text;let Ki=0;for(const _i of ci)ai.push(Ut.substring(Ki,_i)),Ki=_i;return Ki<Ti.length&&ai.push(Ut.substring(Ki,Ti.length)),ai}(De,xt);const Tt=[],kt={positionedLines:Tt,text:De.toString(),top:q[1],bottom:q[1],left:q[0],right:q[0],writingMode:se,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(Ut,ci,ai,Ti,Ki,_i,Si,Li,Vi,Zi,yi,sn){let Kn=0,dn=0,Ln=0;const ln=Li==="right"?1:Li==="left"?0:.5;let Xn=!1;for(const ir of Ki){const Sr=ir.getSections();for(const ss of Sr){if(ss.imageName)continue;const _s=ci[ss.fontStack];if(_s&&(Xn=_s.ascender!==void 0&&_s.descender!==void 0,!Xn))break}if(!Xn)break}let Tr=0;for(const ir of Ki){ir.trim();const Sr=ir.getMaxScale(),ss=(Sr-1)*Jr,_s={positionedGlyphs:[],lineOffset:0};Ut.positionedLines[Tr]=_s;const ps=_s.positionedGlyphs;let ys=0;if(!ir.length()){dn+=_i,++Tr;continue}let Bs=0,Zs=0;for(let ts=0;ts<ir.length();ts++){const Ao=ir.getSection(ts),lo=ir.getSectionIndex(ts),Vr=ir.getCharCode(ts);let Us=Ao.scale,vo=null,os=null,no=null,La=Jr,Jo=0;const ea=!(Vi===qo.horizontal||!yi&&!pe(Vr)||yi&&(d0[Vr]||(wr=Vr,xi(wr)||xn(wr)||cn(wr)||x(wr)||S(wr))));if(Ao.imageName){const Ja=Ti[Ao.imageName];if(!Ja)continue;no=Ao.imageName,Ut.iconsInText=Ut.iconsInText||!0,os=Ja.paddedRect;const ta=Ja.displaySize;Us=Us*Jr/sn,vo={width:ta[0],height:ta[1],left:1,top:-3,advance:ea?ta[1]:ta[0],localGlyph:!1},Jo=Xn?-vo.height*Us:Sr*Jr-17-ta[1]*Us,La=vo.advance;const DA=(ea?ta[0]:ta[1])*Us-Jr*Sr;DA>0&&DA>ys&&(ys=DA)}else{const Ja=ai[Ao.fontStack];if(!Ja)continue;Ja[Vr]&&(os=Ja[Vr]);const ta=ci[Ao.fontStack];if(!ta)continue;const DA=ta.glyphs[Vr];if(!DA)continue;if(vo=DA.metrics,La=Vr!==8203?Jr:0,Xn){const im=ta.ascender!==void 0?Math.abs(ta.ascender):0,Zg=ta.descender!==void 0?Math.abs(ta.descender):0,Xg=(im+Zg)*Us;Bs<Xg&&(Bs=Xg,Zs=(im-Zg)/2*Us),Jo=-im*Us}else Jo=(Sr-Us)*Jr-17}ea?(Ut.verticalizable=!0,ps.push({glyph:Vr,imageName:no,x:Kn,y:dn+Jo,vertical:ea,scale:Us,localGlyph:vo.localGlyph,fontStack:Ao.fontStack,sectionIndex:lo,metrics:vo,rect:os}),Kn+=La*Us+Zi):(ps.push({glyph:Vr,imageName:no,x:Kn,y:dn+Jo,vertical:ea,scale:Us,localGlyph:vo.localGlyph,fontStack:Ao.fontStack,sectionIndex:lo,metrics:vo,rect:os}),Kn+=vo.advance*Us+Zi)}ps.length!==0&&(Ln=Math.max(Kn-Zi,Ln),Xn?IB(ps,ln,ys,Zs,_i*Sr/2):IB(ps,ln,ys,0,_i/2)),Kn=0;const Yo=_i*Sr+ys;_s.lineOffset=Math.max(ys,ss),dn+=Yo,++Tr}var wr;const xr=dn,{horizontalAlign:Jn,verticalAlign:es}=T1(Si);(function(ir,Sr,ss,_s,ps,ys){const Bs=(Sr-ss)*ps,Zs=-ys*_s;for(const Yo of ir)for(const ts of Yo.positionedGlyphs)ts.x+=Bs,ts.y+=Zs})(Ut.positionedLines,ln,Jn,es,Ln,xr),Ut.top+=-es*xr,Ut.bottom=Ut.top+xr,Ut.left+=-Jn*Ln,Ut.right=Ut.left+Ln,Ut.hasBaseline=Xn}(kt,n,o,d,Ze,E,L,k,se,V,he,be),!function(Ut){for(const ci of Ut)if(ci.positionedGlyphs.length!==0)return!1;return!0}(Tt)&&kt}const d0={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},jF={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function EB(s,n,o,d,g,v){if(n.imageName){const E=d[n.imageName];return E?E.displaySize[0]*n.scale*Jr/v+g:0}{const E=o[n.fontStack],L=E&&E.glyphs[s];return L?L.metrics.advance*n.scale+g:0}}function TB(s,n,o,d){const g=Math.pow(s-n,2);return d?s<n?g/2:2*g:g+Math.abs(o)*o}function KF(s,n,o){let d=0;return s===10&&(d-=1e4),o&&(d+=150),s!==40&&s!==65288||(d+=50),n!==41&&n!==65289||(d+=50),d}function SB(s,n,o,d,g,v){let E=null,L=TB(n,o,g,v);for(const k of d){const V=TB(n-k.x,o,g,v)+k.badness;V<=L&&(E=k,L=V)}return{index:s,x:n,priorBreak:E,badness:L}}function MB(s){return s?MB(s.priorBreak).concat(s.index):[]}function T1(s){let n=.5,o=.5;switch(s){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(s){case"bottom":case"bottom-right":case"bottom-left":o=1;break;case"top":case"top-right":case"top-left":o=0}return{horizontalAlign:n,verticalAlign:o}}function IB(s,n,o,d,g){if(!(n||o||d||g))return;const v=s.length-1,E=s[v],L=(E.x+E.metrics.advance*E.scale)*n;for(let k=0;k<=v;k++)s[k].x-=L,s[k].y+=o+d+g}function $F(s,n,o){const{horizontalAlign:d,verticalAlign:g}=T1(o),v=n[0]-s.displaySize[0]*d,E=n[1]-s.displaySize[1]*g;return{image:s,top:E,bottom:E+s.displaySize[1],left:v,right:v+s.displaySize[0]}}function FB(s,n,o,d,g,v){const E=s.image;let L;if(E.content){const Ze=E.content,xt=E.pixelRatio||1;L=[Ze[0]/xt,Ze[1]/xt,E.displaySize[0]-Ze[2]/xt,E.displaySize[1]-Ze[3]/xt]}const k=n.left*v,V=n.right*v;let q,se,he,_e;o==="width"||o==="both"?(_e=g[0]+k-d[3],se=g[0]+V+d[1]):(_e=g[0]+(k+V-E.displaySize[0])/2,se=_e+E.displaySize[0]);const be=n.top*v,De=n.bottom*v;return o==="height"||o==="both"?(q=g[1]+be-d[0],he=g[1]+De+d[2]):(q=g[1]+(be+De-E.displaySize[1])/2,he=q+E.displaySize[1]),{image:E,top:q,right:se,bottom:he,left:_e,collisionPadding:L}}class FA extends me{constructor(n,o,d,g,v){super(n,o),this.angle=g,this.z=d,v!==void 0&&(this.segment=v)}clone(){return new FA(this.x,this.y,this.z,this.angle,this.segment)}}function LB(s,n,o,d,g){if(n.segment===void 0)return!0;let v=n,E=n.segment+1,L=0;for(;L>-o/2;){if(E--,E<0)return!1;L-=s[E].dist(v),v=s[E]}L+=s[E].dist(s[E+1]),E++;const k=[];let V=0;for(;L<o/2;){const q=s[E],se=s[E+1];if(!se)return!1;let he=s[E-1].angleTo(q)-q.angleTo(se);for(he=Math.abs((he+3*Math.PI)%(2*Math.PI)-Math.PI),k.push({distance:L,angleDelta:he}),V+=he;L-k[0].distance>d;)V-=k.shift().angleDelta;if(V>g)return!1;E++,L+=q.dist(se)}return!0}function DB(s){let n=0;for(let o=0;o<s.length-1;o++)n+=s[o].dist(s[o+1]);return n}function PB(s,n,o){return s?.6*n*o:0}function UB(s,n){return Math.max(s?s.right-s.left:0,n?n.right-n.left:0)}function ZF(s,n,o,d,g,v){const E=PB(o,g,v),L=UB(o,d)*v;let k=0;const V=DB(s)/2;for(let q=0;q<s.length-1;q++){const se=s[q],he=s[q+1],_e=se.dist(he);if(k+_e>V){const be=(V-k)/_e,De=gr(se.x,he.x,be),Ze=gr(se.y,he.y,be),xt=new FA(De,Ze,0,he.angleTo(se),q);return!E||LB(s,xt,L,E,n)?xt:void 0}k+=_e}}function XF(s,n,o,d,g,v,E,L,k){const V=PB(d,v,E),q=UB(d,g),se=q*E,he=s[0].x===0||s[0].x===k||s[0].y===0||s[0].y===k;return n-se<n/4&&(n=se+n/4),RB(s,he?n/2*L%n:(q/2+2*v)*E*L%n,n,V,o,se,he,!1,k)}function RB(s,n,o,d,g,v,E,L,k){const V=v/2,q=DB(s);let se=0,he=n-o,_e=[];for(let be=0;be<s.length-1;be++){const De=s[be],Ze=s[be+1],xt=De.dist(Ze),Dt=Ze.angleTo(De);for(;he+o<se+xt;){he+=o;const _t=(he-se)/xt,Tt=gr(De.x,Ze.x,_t),kt=gr(De.y,Ze.y,_t);if(Tt>=0&&Tt<k&&kt>=0&&kt<k&&he-V>=0&&he+V<=q){const Ut=new FA(Tt,kt,0,Dt,be);Ut._round(),d&&!LB(s,Ut,v,d,g)||_e.push(Ut)}}se+=xt}return L||_e.length||E||(_e=RB(s,se/2,o,d,g,v,E,!0,k)),_e}function zB(s,n,o,d,g){const v=[];for(let E=0;E<s.length;E++){const L=s[E];let k;for(let V=0;V<L.length-1;V++){let q=L[V],se=L[V+1];q.x<n&&se.x<n||(q.x<n?q=new me(n,q.y+(n-q.x)/(se.x-q.x)*(se.y-q.y))._round():se.x<n&&(se=new me(n,q.y+(n-q.x)/(se.x-q.x)*(se.y-q.y))._round()),q.y<o&&se.y<o||(q.y<o?q=new me(q.x+(o-q.y)/(se.y-q.y)*(se.x-q.x),o)._round():se.y<o&&(se=new me(q.x+(o-q.y)/(se.y-q.y)*(se.x-q.x),o)._round()),q.x>=d&&se.x>=d||(q.x>=d?q=new me(d,q.y+(d-q.x)/(se.x-q.x)*(se.y-q.y))._round():se.x>=d&&(se=new me(d,q.y+(d-q.x)/(se.x-q.x)*(se.y-q.y))._round()),q.y>=g&&se.y>=g||(q.y>=g?q=new me(q.x+(g-q.y)/(se.y-q.y)*(se.x-q.x),g)._round():se.y>=g&&(se=new me(q.x+(g-q.y)/(se.y-q.y)*(se.x-q.x),g)._round()),k&&q.equals(k[k.length-1])||(k=[q],v.push(k)),k.push(se)))))}}return v}zt(FA,"Anchor");const kg=1e20;function kB(s,n,o,d,g,v,E,L,k){for(let V=n;V<n+d;V++)OB(s,o*v+V,v,g,E,L,k);for(let V=o;V<o+g;V++)OB(s,V*v+n,1,d,E,L,k)}function OB(s,n,o,d,g,v,E){v[0]=0,E[0]=-kg,E[1]=kg,g[0]=s[n];for(let L=1,k=0,V=0;L<d;L++){g[L]=s[n+L*o];const q=L*L;do{const se=v[k];V=(g[L]-g[se]+q-se*se)/(L-se)/2}while(V<=E[k]&&--k>-1);k++,v[k]=L,E[k]=V,E[k+1]=kg}for(let L=0,k=0;L<d;L++){for(;E[k+1]<L;)k++;const V=v[k],q=L-V;s[n+L*o]=g[V]+q*q}}const S1={none:0,ideographs:1,all:2};class $f{constructor(n,o,d){this.requestManager=n,this.localGlyphMode=o,this.localFontFamily=d,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(n){this.url=n}getGlyphs(n,o){const d=[];for(const g in n)for(const v of n[g])d.push({stack:g,id:v});Ne(d,({stack:g,id:v},E)=>{let L=this.entries[g];L||(L=this.entries[g]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let k=L.glyphs[v];if(k!==void 0)return void E(null,{stack:g,id:v,glyph:k});if(k=this._tinySDF(L,g,v),k)return L.glyphs[v]=k,void E(null,{stack:g,id:v,glyph:k});const V=Math.floor(v/256);if(256*V>65535)return void E(new Error("glyphs > 65535 not supported"));if(L.ranges[V])return void E(null,{stack:g,id:v,glyph:k});let q=L.requests[V];q||(q=L.requests[V]=[],$f.loadGlyphRange(g,V,this.url,this.requestManager,(se,he)=>{if(he){L.ascender=he.ascender,L.descender=he.descender;for(const _e in he.glyphs)this._doesCharSupportLocalGlyph(+_e)||(L.glyphs[+_e]=he.glyphs[+_e]);L.ranges[V]=!0}for(const _e of q)_e(se,he);delete L.requests[V]})),q.push((se,he)=>{se?E(se):he&&E(null,{stack:g,id:v,glyph:he.glyphs[v]||null})})},(g,v)=>{if(g)o(g);else if(v){const E={};for(const{stack:L,id:k,glyph:V}of v)E[L]===void 0&&(E[L]={}),E[L].glyphs===void 0&&(E[L].glyphs={}),E[L].glyphs[k]=V&&{id:V.id,bitmap:V.bitmap.clone(),metrics:V.metrics},E[L].ascender=this.entries[L].ascender,E[L].descender=this.entries[L].descender;o(null,E)}})}_doesCharSupportLocalGlyph(n){return this.localGlyphMode!==S1.none&&(this.localGlyphMode===S1.all?!!this.localFontFamily:!!this.localFontFamily&&(ja(n)||Ba(n)||Lr(n)||Rr(n)||Un(n)))}_tinySDF(n,o,d){const g=this.localFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let v=n.tinySDF;if(!v){let De="400";/bold/i.test(o)?De="900":/medium/i.test(o)?De="500":/light/i.test(o)&&(De="200"),v=n.tinySDF=new $f.TinySDF({fontFamily:g,fontWeight:De,fontSize:48,buffer:6,radius:16}),v.fontWeight=De}if(this.localGlyphs[v.fontWeight][d])return this.localGlyphs[v.fontWeight][d];const E=String.fromCharCode(d),{data:L,width:k,height:V,glyphWidth:q,glyphHeight:se,glyphLeft:he,glyphTop:_e,glyphAdvance:be}=v.draw(E);return this.localGlyphs[v.fontWeight][d]={id:d,bitmap:new Yl({width:k,height:V},L),metrics:{width:q/2,height:se/2,left:he/2,top:_e/2-27,advance:be/2,localGlyph:!0}}}}function NB(s,n,o,d){const g=[],v=s.image,E=v.pixelRatio,L=v.paddedRect.w-2,k=v.paddedRect.h-2,V=s.right-s.left,q=s.bottom-s.top,se=v.stretchX||[[0,L]],he=v.stretchY||[[0,k]],_e=(_i,Si)=>_i+Si[1]-Si[0],be=se.reduce(_e,0),De=he.reduce(_e,0),Ze=L-be,xt=k-De;let Dt=0,_t=be,Tt=0,kt=De,Ut=0,ci=Ze,ai=0,Ti=xt;if(v.content&&d){const _i=v.content;Dt=p0(se,0,_i[0]),Tt=p0(he,0,_i[1]),_t=p0(se,_i[0],_i[2]),kt=p0(he,_i[1],_i[3]),Ut=_i[0]-Dt,ai=_i[1]-Tt,ci=_i[2]-_i[0]-_t,Ti=_i[3]-_i[1]-kt}const Ki=(_i,Si,Li,Vi)=>{const Zi=f0(_i.stretch-Dt,_t,V,s.left),yi=m0(_i.fixed-Ut,ci,_i.stretch,be),sn=f0(Si.stretch-Tt,kt,q,s.top),Kn=m0(Si.fixed-ai,Ti,Si.stretch,De),dn=f0(Li.stretch-Dt,_t,V,s.left),Ln=m0(Li.fixed-Ut,ci,Li.stretch,be),ln=f0(Vi.stretch-Tt,kt,q,s.top),Xn=m0(Vi.fixed-ai,Ti,Vi.stretch,De),Tr=new me(Zi,sn),wr=new me(dn,sn),xr=new me(dn,ln),Jn=new me(Zi,ln),es=new me(yi/E,Kn/E),ir=new me(Ln/E,Xn/E),Sr=n*Math.PI/180;if(Sr){const ps=Math.sin(Sr),ys=Math.cos(Sr),Bs=[ys,-ps,ps,ys];Tr._matMult(Bs),wr._matMult(Bs),Jn._matMult(Bs),xr._matMult(Bs)}const ss=_i.stretch+_i.fixed,_s=Si.stretch+Si.fixed;return{tl:Tr,tr:wr,bl:Jn,br:xr,tex:{x:v.paddedRect.x+1+ss,y:v.paddedRect.y+1+_s,w:Li.stretch+Li.fixed-ss,h:Vi.stretch+Vi.fixed-_s},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:es,pixelOffsetBR:ir,minFontScaleX:ci/E/V,minFontScaleY:Ti/E/q,isSDF:o}};if(d&&(v.stretchX||v.stretchY)){const _i=QB(se,Ze,be),Si=QB(he,xt,De);for(let Li=0;Li<_i.length-1;Li++){const Vi=_i[Li],Zi=_i[Li+1];for(let yi=0;yi<Si.length-1;yi++)g.push(Ki(Vi,Si[yi],Zi,Si[yi+1]))}}else g.push(Ki({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:L+1},{fixed:0,stretch:k+1}));return g}function p0(s,n,o){let d=0;for(const g of s)d+=Math.max(n,Math.min(o,g[1]))-Math.max(n,Math.min(o,g[0]));return d}function QB(s,n,o){const d=[{fixed:-1,stretch:0}];for(const[g,v]of s){const E=d[d.length-1];d.push({fixed:g-E.stretch,stretch:E.stretch}),d.push({fixed:g-E.stretch,stretch:E.stretch+(v-g)})}return d.push({fixed:n+1,stretch:o}),d}function f0(s,n,o,d){return s/n*o+d}function m0(s,n,o,d){return s-n*o/d}function qF(s,n,o,d){const g=n+s.positionedLines[d].lineOffset;return d===0?o+g/2:o+(g+(n+s.positionedLines[d-1].lineOffset))/2}$f.loadGlyphRange=function(s,n,o,d,g){const v=256*n,E=v+255,L=d.transformRequest(d.normalizeGlyphsURL(o).replace("{fontstack}",s).replace("{range}",`${v}-${E}`),ii.Glyphs);Cn(L,(k,V)=>{if(k)g(k);else if(V){const q={},se=function(he){return new Fa(he).readFields(E1,{})}(V);for(const he of se.glyphs)q[he.id]=he;g(null,{glyphs:q,ascender:se.ascender,descender:se.descender})}})},$f.TinySDF=class{constructor({fontSize:s=24,buffer:n=3,radius:o=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:v="normal",fontStyle:E="normal"}={}){this.buffer=n,this.cutoff=d,this.radius=o;const L=this.size=s+4*n,k=this._createCanvas(L),V=this.ctx=k.getContext("2d",{willReadFrequently:!0});V.font=`${E} ${v} ${s}px ${g}`,V.textBaseline="alphabetic",V.textAlign="left",V.fillStyle="black",this.gridOuter=new Float64Array(L*L),this.gridInner=new Float64Array(L*L),this.f=new Float64Array(L),this.z=new Float64Array(L+1),this.v=new Uint16Array(L)}_createCanvas(s){const n=document.createElement("canvas");return n.width=n.height=s,n}draw(s){const{width:n,actualBoundingBoxAscent:o,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(s),E=Math.ceil(o),L=Math.min(this.size-this.buffer,Math.ceil(v-g)),k=Math.min(this.size-this.buffer,E+Math.ceil(d)),V=L+2*this.buffer,q=k+2*this.buffer,se=Math.max(V*q,0),he=new Uint8ClampedArray(se),_e={data:he,width:V,height:q,glyphWidth:L,glyphHeight:k,glyphTop:E,glyphLeft:0,glyphAdvance:n};if(L===0||k===0)return _e;const{ctx:be,buffer:De,gridInner:Ze,gridOuter:xt}=this;be.clearRect(De,De,L,k),be.fillText(s,De,De+E);const Dt=be.getImageData(De,De,L,k);xt.fill(kg,0,se),Ze.fill(0,0,se);for(let _t=0;_t<k;_t++)for(let Tt=0;Tt<L;Tt++){const kt=Dt.data[4*(_t*L+Tt)+3]/255;if(kt===0)continue;const Ut=(_t+De)*V+Tt+De;if(kt===1)xt[Ut]=0,Ze[Ut]=kg;else{const ci=.5-kt;xt[Ut]=ci>0?ci*ci:0,Ze[Ut]=ci<0?ci*ci:0}}kB(xt,0,0,V,q,V,this.f,this.v,this.z),kB(Ze,De,De,L,k,V,this.f,this.v,this.z);for(let _t=0;_t<se;_t++){const Tt=Math.sqrt(xt[_t])-Math.sqrt(Ze[_t]);he[_t]=Math.round(255-255*(Tt/this.radius+this.cutoff))}return _e}};class YF{constructor(n=[],o=JF){if(this.data=n,this.length=this.data.length,this.compare=o,this.length>0)for(let d=(this.length>>1)-1;d>=0;d--)this._down(d)}push(n){this.data.push(n),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const n=this.data[0],o=this.data.pop();return this.length--,this.length>0&&(this.data[0]=o,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:o,compare:d}=this,g=o[n];for(;n>0;){const v=n-1>>1,E=o[v];if(d(g,E)>=0)break;o[n]=E,n=v}o[n]=g}_down(n){const{data:o,compare:d}=this,g=this.length>>1,v=o[n];for(;n<g;){let E=1+(n<<1),L=o[E];const k=E+1;if(k<this.length&&d(o[k],L)<0&&(E=k,L=o[k]),d(L,v)>=0)break;o[n]=L,n=E}o[n]=v}}function JF(s,n){return s<n?-1:s>n?1:0}function e3(s,n=1,o=!1){let d=1/0,g=1/0,v=-1/0,E=-1/0;const L=s[0];for(let _e=0;_e<L.length;_e++){const be=L[_e];(!_e||be.x<d)&&(d=be.x),(!_e||be.y<g)&&(g=be.y),(!_e||be.x>v)&&(v=be.x),(!_e||be.y>E)&&(E=be.y)}const k=Math.min(v-d,E-g);let V=k/2;const q=new YF([],t3);if(k===0)return new me(d,g);for(let _e=d;_e<v;_e+=k)for(let be=g;be<E;be+=k)q.push(new Zf(_e+V,be+V,V,s));let se=function(_e){let be=0,De=0,Ze=0;const xt=_e[0];for(let Dt=0,_t=xt.length,Tt=_t-1;Dt<_t;Tt=Dt++){const kt=xt[Dt],Ut=xt[Tt],ci=kt.x*Ut.y-Ut.x*kt.y;De+=(kt.x+Ut.x)*ci,Ze+=(kt.y+Ut.y)*ci,be+=3*ci}return new Zf(De/be,Ze/be,0,_e)}(s),he=q.length;for(;q.length;){const _e=q.pop();(_e.d>se.d||!se.d)&&(se=_e,o&&console.log("found best %d after %d probes",Math.round(1e4*_e.d)/1e4,he)),_e.max-se.d<=n||(V=_e.h/2,q.push(new Zf(_e.p.x-V,_e.p.y-V,V,s)),q.push(new Zf(_e.p.x+V,_e.p.y-V,V,s)),q.push(new Zf(_e.p.x-V,_e.p.y+V,V,s)),q.push(new Zf(_e.p.x+V,_e.p.y+V,V,s)),he+=4)}return o&&(console.log(`num probes: ${he}`),console.log(`best distance: ${se.d}`)),se.p}function t3(s,n){return n.max-s.max}function Zf(s,n,o,d){this.p=new me(s,n),this.h=o,this.d=function(g,v){let E=!1,L=1/0;for(let k=0;k<v.length;k++){const V=v[k];for(let q=0,se=V.length,he=se-1;q<se;he=q++){const _e=V[q],be=V[he];_e.y>g.y!=be.y>g.y&&g.x<(be.x-_e.x)*(g.y-_e.y)/(be.y-_e.y)+_e.x&&(E=!E),L=Math.min(L,mg(g,_e,be))}}return(E?1:-1)*Math.sqrt(L)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}const M1=Number.POSITIVE_INFINITY,i3=Math.sqrt(2);function VB(s,[n,o]){let d=0,g=0;if(o===M1){n<0&&(n=0);const v=n/i3;switch(s){case"top-right":case"top-left":g=v-7;break;case"bottom-right":case"bottom-left":g=7-v;break;case"bottom":g=7-n;break;case"top":g=n-7}switch(s){case"top-right":case"bottom-right":d=-v;break;case"top-left":case"bottom-left":d=v;break;case"left":d=n;break;case"right":d=-n}}else{switch(n=Math.abs(n),o=Math.abs(o),s){case"top-right":case"top-left":case"top":g=o-7;break;case"bottom-right":case"bottom-left":case"bottom":g=7-o}switch(s){case"top-right":case"bottom-right":case"right":d=-n;break;case"top-left":case"bottom-left":case"left":d=n}}return[d,g]}function n3(s,n,o,d,g,v,E,L,k,V){s.createArrays(),s.tilePixelRatio=Zn/(512*s.overscaling),s.compareText={},s.iconsNeedLinear=!1;const q=s.layers[0].layout,se=s.layers[0]._unevaluatedLayout._values,he={};if(s.textSizeData.kind==="composite"){const{minZoom:De,maxZoom:Ze}=s.textSizeData;he.compositeTextSizes=[se["text-size"].possiblyEvaluate(new qt(De),L),se["text-size"].possiblyEvaluate(new qt(Ze),L)]}if(s.iconSizeData.kind==="composite"){const{minZoom:De,maxZoom:Ze}=s.iconSizeData;he.compositeIconSizes=[se["icon-size"].possiblyEvaluate(new qt(De),L),se["icon-size"].possiblyEvaluate(new qt(Ze),L)]}he.layoutTextSize=se["text-size"].possiblyEvaluate(new qt(k+1),L),he.layoutIconSize=se["icon-size"].possiblyEvaluate(new qt(k+1),L),he.textMaxSize=se["text-size"].possiblyEvaluate(new qt(18),L);const _e=q.get("text-rotation-alignment")==="map"&&q.get("symbol-placement")!=="point",be=q.get("text-size");for(const De of s.features){const Ze=q.get("text-font").evaluate(De,{},L).join(","),xt=be.evaluate(De,{},L),Dt=he.layoutTextSize.evaluate(De,{},L),_t=(he.layoutIconSize.evaluate(De,{},L),{horizontal:{},vertical:void 0}),Tt=De.text;let kt,Ut=[0,0];if(Tt){const Ti=Tt.toString(),Ki=q.get("text-letter-spacing").evaluate(De,{},L)*Jr,_i=q.get("text-line-height").evaluate(De,{},L)*Jr,Si=W(Ti)?Ki:0,Li=q.get("text-anchor").evaluate(De,{},L),Vi=q.get("text-variable-anchor");if(!Vi){const dn=q.get("text-radial-offset").evaluate(De,{},L);Ut=dn?VB(Li,[dn*Jr,M1]):q.get("text-offset").evaluate(De,{},L).map(Ln=>Ln*Jr)}let Zi=_e?"center":q.get("text-justify").evaluate(De,{},L);const yi=q.get("symbol-placement")==="point",sn=yi?q.get("text-max-width").evaluate(De,{},L)*Jr:1/0,Kn=dn=>{s.allowVerticalPlacement&&H(Ti)&&(_t.vertical=nu(Tt,n,o,g,Ze,sn,_i,Li,dn,Si,Ut,qo.vertical,!0,Dt,xt))};if(!_e&&Vi){const dn=Zi==="auto"?Vi.map(ln=>I1(ln)):[Zi];let Ln=!1;for(let ln=0;ln<dn.length;ln++){const Xn=dn[ln];if(!_t.horizontal[Xn])if(Ln)_t.horizontal[Xn]=_t.horizontal[0];else{const Tr=nu(Tt,n,o,g,Ze,sn,_i,"center",Xn,Si,Ut,qo.horizontal,!1,Dt,xt);Tr&&(_t.horizontal[Xn]=Tr,Ln=Tr.positionedLines.length===1)}}Kn("left")}else{if(Zi==="auto"&&(Zi=I1(Li)),yi||q.get("text-writing-mode").indexOf("horizontal")>=0||!H(Ti)){const dn=nu(Tt,n,o,g,Ze,sn,_i,Li,Zi,Si,Ut,qo.horizontal,!1,Dt,xt);dn&&(_t.horizontal[Zi]=dn)}Kn(yi?"left":Zi)}}let ci=!1;if(De.icon&&De.icon.name){const Ti=d[De.icon.name];Ti&&(kt=$F(g[De.icon.name],q.get("icon-offset").evaluate(De,{},L),q.get("icon-anchor").evaluate(De,{},L)),ci=Ti.sdf,s.sdfIcons===void 0?s.sdfIcons=Ti.sdf:s.sdfIcons!==Ti.sdf&&Ct("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Ti.pixelRatio!==s.pixelRatio||q.get("icon-rotate").constantOr(1)!==0)&&(s.iconsNeedLinear=!0))}const ai=GB(_t.horizontal)||_t.vertical;s.iconsInText||(s.iconsInText=!!ai&&ai.iconsInText),(ai||kt)&&r3(s,De,_t,kt,d,he,Dt,0,Ut,ci,E,L,V)}v&&s.generateCollisionDebugBuffers(k,s.collisionBoxArray)}function I1(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function r3(s,n,o,d,g,v,E,L,k,V,q,se,he){let _e=v.textMaxSize.evaluate(n,{},se);_e===void 0&&(_e=E);const be=s.layers[0].layout,De=be.get("icon-offset").evaluate(n,{},se),Ze=GB(o.horizontal)||o.vertical,xt=he.name==="globe",Dt=E/24,_t=s.tilePixelRatio*_e/24,Tt=(Si=s.overscaling,s.zoom>18&&Si>2&&(Si>>=1),Math.max(Zn/(512*Si),1)*be.get("symbol-spacing")),kt=be.get("text-padding")*s.tilePixelRatio,Ut=be.get("icon-padding")*s.tilePixelRatio,ci=Ke(be.get("text-max-angle")),ai=be.get("text-rotation-alignment")==="map"&&be.get("symbol-placement")!=="point",Ti=be.get("icon-rotation-alignment")==="map"&&be.get("symbol-placement")!=="point",Ki=be.get("symbol-placement"),_i=Tt/2;var Si;const Li=be.get("icon-text-fit");let Vi;d&&Li!=="none"&&(s.allowVerticalPlacement&&o.vertical&&(Vi=FB(d,o.vertical,Li,be.get("icon-text-fit-padding"),De,Dt)),Ze&&(d=FB(d,Ze,Li,be.get("icon-text-fit-padding"),De,Dt)));const Zi=(yi,sn,Kn)=>{if(sn.x<0||sn.x>=Zn||sn.y<0||sn.y>=Zn)return;let dn=null;if(xt){const{x:Ln,y:ln,z:Xn}=he.projectTilePoint(sn.x,sn.y,Kn);dn={anchor:new FA(Ln,ln,Xn,0,void 0),up:he.upVector(Kn,sn.x,sn.y)}}(function(Ln,ln,Xn,Tr,wr,xr,Jn,es,ir,Sr,ss,_s,ps,ys,Bs,Zs,Yo,ts,Ao,lo,Vr,Us,vo,os,no){const La=Ln.addToLineVertexArray(ln,Tr);let Jo,ea,Ja,ta,DA,im,Zg,Xg=0,SC=0,MC=0,IC=0,K1=-1,$1=-1;const Uu={};let FC=ld.exports("");const zp=Xn?Xn.anchor:ln;let Z1=0,X1=0;if(ir._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Z1,X1]=ir.layout.get("text-offset").evaluate(Vr,{},no).map(ec=>ec*Jr):(Z1=ir.layout.get("text-radial-offset").evaluate(Vr,{},no)*Jr,X1=M1),Ln.allowVerticalPlacement&&wr.vertical){const ec=wr.vertical;if(Bs)im=F1(ec),es&&(Zg=F1(es));else{const tc=ir.layout.get("text-rotate").evaluate(Vr,{},no)+90;Ja=g0(Sr,zp,ln,ss,_s,ps,ec,ys,tc,Zs),es&&(ta=g0(Sr,zp,ln,ss,_s,ps,es,ts,tc))}}if(xr){const ec=ir.layout.get("icon-rotate").evaluate(Vr,{},no),tc=ir.layout.get("icon-text-fit")!=="none",qg=NB(xr,ec,vo,tc),Y1=es?NB(es,ec,vo,tc):void 0;ea=g0(Sr,zp,ln,ss,_s,ps,xr,ts,ec),Xg=4*qg.length;const LC=Ln.iconSizeData;let kp=null;LC.kind==="source"?(kp=[Hs*ir.layout.get("icon-size").evaluate(Vr,{},no)],kp[0]>Id&&Ct(`${Ln.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):LC.kind==="composite"&&(kp=[Hs*Us.compositeIconSizes[0].evaluate(Vr,{},no),Hs*Us.compositeIconSizes[1].evaluate(Vr,{},no)],(kp[0]>Id||kp[1]>Id)&&Ct(`${Ln.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ln.addSymbols(Ln.icon,qg,kp,lo,Ao,Vr,!1,Xn,ln,La.lineStartIndex,La.lineLength,-1,os,no),K1=Ln.icon.placedSymbolArray.length-1,Y1&&(SC=4*Y1.length,Ln.addSymbols(Ln.icon,Y1,kp,lo,Ao,Vr,qo.vertical,Xn,ln,La.lineStartIndex,La.lineLength,-1,os,no),$1=Ln.icon.placedSymbolArray.length-1)}for(const ec in wr.horizontal){const tc=wr.horizontal[ec];Jo||(FC=ld.exports(tc.text),Bs?DA=F1(tc):Jo=g0(Sr,zp,ln,ss,_s,ps,tc,ys,ir.layout.get("text-rotate").evaluate(Vr,{},no),Zs));const qg=tc.positionedLines.length===1;if(MC+=HB(Ln,Xn,ln,tc,Jn,ir,Bs,Vr,Zs,La,wr.vertical?qo.horizontal:qo.horizontalOnly,qg?Object.keys(wr.horizontal):[ec],Uu,K1,Us,os,no),qg)break}wr.vertical&&(IC+=HB(Ln,Xn,ln,wr.vertical,Jn,ir,Bs,Vr,Zs,La,qo.vertical,["vertical"],Uu,$1,Us,os,no));let Rd=-1;const q1=(ec,tc)=>ec?Math.max(ec,tc):tc;Rd=q1(DA,Rd),Rd=q1(im,Rd),Rd=q1(Zg,Rd);const R3=Rd>-1?1:0;Ln.glyphOffsetArray.length>=Ld.MAX_GLYPHS&&Ct("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Vr.sortKey!==void 0&&Ln.addToSortKeyRanges(Ln.symbolInstances.length,Vr.sortKey),Ln.symbolInstances.emplaceBack(zp.x,zp.y,zp.z,ln.x,ln.y,Uu.right>=0?Uu.right:-1,Uu.center>=0?Uu.center:-1,Uu.left>=0?Uu.left:-1,Uu.vertical>=0?Uu.vertical:-1,K1,$1,FC,Jo!==void 0?Jo:Ln.collisionBoxArray.length,Jo!==void 0?Jo+1:Ln.collisionBoxArray.length,Ja!==void 0?Ja:Ln.collisionBoxArray.length,Ja!==void 0?Ja+1:Ln.collisionBoxArray.length,ea!==void 0?ea:Ln.collisionBoxArray.length,ea!==void 0?ea+1:Ln.collisionBoxArray.length,ta||Ln.collisionBoxArray.length,ta?ta+1:Ln.collisionBoxArray.length,ss,MC,IC,Xg,SC,R3,0,Z1,X1,Rd)})(s,sn,dn,yi,o,d,g,Vi,s.layers[0],s.collisionBoxArray,n.index,n.sourceLayerIndex,s.index,kt,ai,k,0,Ut,Ti,De,n,v,V,q,se)};if(Ki==="line")for(const yi of zB(n.geometry,0,0,Zn,Zn)){const sn=XF(yi,Tt,ci,o.vertical||Ze,d,24,_t,s.overscaling,Zn);for(const Kn of sn){const dn=Ze;dn&&s3(s,dn.text,_i,Kn)||Zi(yi,Kn,se)}}else if(Ki==="line-center"){for(const yi of n.geometry)if(yi.length>1){const sn=ZF(yi,ci,o.vertical||Ze,d,24,_t);sn&&Zi(yi,sn,se)}}else if(n.type==="Polygon")for(const yi of Qf(n.geometry,0)){const sn=e3(yi,16);Zi(yi[0],new FA(sn.x,sn.y,0,0,void 0),se)}else if(n.type==="LineString")for(const yi of n.geometry)Zi(yi,new FA(yi[0].x,yi[0].y,0,0,void 0),se);else if(n.type==="Point")for(const yi of n.geometry)for(const sn of yi)Zi([sn],new FA(sn.x,sn.y,0,0,void 0),se)}const Id=32640;function HB(s,n,o,d,g,v,E,L,k,V,q,se,he,_e,be,De,Ze){const xt=function(Tt,kt,Ut,ci,ai,Ti,Ki,_i){const Si=[];if(kt.positionedLines.length===0)return Si;const Li=ci.layout.get("text-rotate").evaluate(Ti,{})*Math.PI/180,Vi=function(dn){const Ln=dn[0],ln=dn[1],Xn=Ln*ln;return Xn>0?[Ln,-ln]:Xn<0?[-Ln,ln]:Ln===0?[ln,Ln]:[ln,-Ln]}(Ut);let Zi=Math.abs(kt.top-kt.bottom);for(const dn of kt.positionedLines)Zi-=dn.lineOffset;const yi=kt.positionedLines.length,sn=Zi/yi;let Kn=kt.top-Ut[1];for(let dn=0;dn<yi;++dn){const Ln=kt.positionedLines[dn];Kn=qF(kt,sn,Kn,dn);for(const ln of Ln.positionedGlyphs){if(!ln.rect)continue;const Xn=ln.rect||{};let Tr=4,wr=!0,xr=1,Jn=0;if(ln.imageName){const os=Ki[ln.imageName];if(!os)continue;if(os.sdf){Ct("SDF images are not supported in formatted text and will be ignored.");continue}wr=!1,xr=os.pixelRatio,Tr=1/xr}const es=(ai||_i)&&ln.vertical,ir=ln.metrics.advance*ln.scale/2,Sr=ln.metrics,ss=ln.rect;if(ss===null)continue;_i&&kt.verticalizable&&(Jn=ln.imageName?ir-ln.metrics.width*ln.scale/2:0);const _s=ai?[ln.x+ir,ln.y]:[0,0];let ps=[0,0],ys=[0,0],Bs=!1;ai||(es?(ys=[ln.x+ir+Vi[0],ln.y+Vi[1]-Jn],Bs=!0):ps=[ln.x+ir+Ut[0],ln.y+Ut[1]-Jn]);const Zs=ss.w*ln.scale/(xr*(ln.localGlyph?2:1)),Yo=ss.h*ln.scale/(xr*(ln.localGlyph?2:1));let ts,Ao,lo,Vr;if(es){const os=ln.y-Kn,no=new me(-ir,ir-os),La=-Math.PI/2,Jo=new me(...ys);ts=new me(-ir+ps[0],ps[1]),ts._rotateAround(La,no)._add(Jo),ts.x+=-os+ir,ts.y-=(Sr.left-Tr)*ln.scale;const ea=ln.imageName?Sr.advance*ln.scale:Jr*ln.scale,Ja=String.fromCharCode(ln.glyph);Jl(Ja)?ts.x+=(1-Tr)*ln.scale:Bc(Ja)?ts.x+=ea-Sr.height*ln.scale+(-Tr-1)*ln.scale:ts.x+=ln.imageName||Sr.width+2*Tr===ss.w&&Sr.height+2*Tr===ss.h?(ea-Yo)/2:(ea-(Sr.height+2*Tr)*ln.scale)/2,Ao=new me(ts.x,ts.y-Zs),lo=new me(ts.x+Yo,ts.y),Vr=new me(ts.x+Yo,ts.y-Zs)}else{const os=(Sr.left-Tr)*ln.scale-ir+ps[0],no=(-Sr.top-Tr)*ln.scale+ps[1],La=os+Zs,Jo=no+Yo;ts=new me(os,no),Ao=new me(La,no),lo=new me(os,Jo),Vr=new me(La,Jo)}if(Li){let os;os=ai?new me(0,0):Bs?new me(Vi[0],Vi[1]):new me(Ut[0],Ut[1]),ts._rotateAround(Li,os),Ao._rotateAround(Li,os),lo._rotateAround(Li,os),Vr._rotateAround(Li,os)}const Us=new me(0,0),vo=new me(0,0);Si.push({tl:ts,tr:Ao,bl:lo,br:Vr,tex:Xn,writingMode:kt.writingMode,glyphOffset:_s,sectionIndex:ln.sectionIndex,isSDF:wr,pixelOffsetTL:Us,pixelOffsetBR:vo,minFontScaleX:0,minFontScaleY:0})}}return Si}(0,d,k,v,E,L,g,s.allowVerticalPlacement),Dt=s.textSizeData;let _t=null;Dt.kind==="source"?(_t=[Hs*v.layout.get("text-size").evaluate(L,{},Ze)],_t[0]>Id&&Ct(`${s.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Dt.kind==="composite"&&(_t=[Hs*be.compositeTextSizes[0].evaluate(L,{},Ze),Hs*be.compositeTextSizes[1].evaluate(L,{},Ze)],(_t[0]>Id||_t[1]>Id)&&Ct(`${s.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),s.addSymbols(s.text,xt,_t,k,E,L,q,n,o,V.lineStartIndex,V.lineLength,_e,De,Ze);for(const Tt of se)he[Tt]=s.text.placedSymbolArray.length-1;return 4*xt.length}function GB(s){for(const n in s)return s[n];return null}function g0(s,n,o,d,g,v,E,L,k,V){let q=E.top,se=E.bottom,he=E.left,_e=E.right;const be=E.collisionPadding;if(be&&(he-=be[0],q-=be[1],_e+=be[2],se+=be[3]),k){const De=new me(he,q),Ze=new me(_e,q),xt=new me(he,se),Dt=new me(_e,se),_t=Ke(k);let Tt=new me(0,0);V&&(Tt=new me(V[0],V[1])),De._rotateAround(_t,Tt),Ze._rotateAround(_t,Tt),xt._rotateAround(_t,Tt),Dt._rotateAround(_t,Tt),he=Math.min(De.x,Ze.x,xt.x,Dt.x),_e=Math.max(De.x,Ze.x,xt.x,Dt.x),q=Math.min(De.y,Ze.y,xt.y,Dt.y),se=Math.max(De.y,Ze.y,xt.y,Dt.y)}return s.emplaceBack(n.x,n.y,n.z,o.x,o.y,he,q,_e,se,L,d,g,v),s.length-1}function F1(s){s.collisionPadding&&(s.top-=s.collisionPadding[1],s.bottom+=s.collisionPadding[3]);const n=s.bottom-s.top;return n>0?Math.max(10,n):null}function s3(s,n,o,d){const g=s.compareText;if(n in g){const v=g[n];for(let E=v.length-1;E>=0;E--)if(d.dist(v[E])<o)return!0}else g[n]=[];return g[n].push(d),!1}const o3=_n([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:WB}=o3,jB=_n([{name:"a_pos_3",components:3,type:"Int16"}]);var Og=_n([{name:"a_pos",type:"Int16",components:2}]);const LA=Zn/Math.PI/2,L1=2*Xl(1,0)*LA*Math.PI,Xf=64,qf=[Xf,32,16],fh=-LA,mh=LA,a3=[new Ko([fh,fh,fh],[mh,mh,mh]),new Ko([fh,fh,fh],[0,0,mh]),new Ko([0,fh,fh],[mh,0,mh]),new Ko([fh,0,fh],[0,mh,mh]),new Ko([0,0,fh],[mh,mh,mh])];function KB(s,n,o,d=!0){const g=pa([],s._camera.position,s.worldSize),v=[n,o,1,1];TA(v,v,s.pixelMatrixInverse),Df(v,v,1/v[3]);const E=so([],wc([],v,g)),L=s.globeMatrix,k=[L[12],L[13],L[14]],V=wc([],k,g),q=pd(V),se=so([],V),he=s.worldSize/(2*Math.PI),_e=Ma(se,E),be=Math.asin(he/q);if(be<Math.acos(_e)){if(!d)return null;const Ki=[],_i=[];pa(Ki,E,q/_e),so(_i,wc(_i,Ki,V)),so(E,Jh(E,V,pa(E,_i,Math.tan(be)*q)))}const De=[];new Uf(g,E).closestPointOnSphere(k,he,De);const Ze=so([],Gn(L,0)),xt=so([],Gn(L,1)),Dt=so([],Gn(L,2)),_t=Ma(Ze,De),Tt=Ma(xt,De),kt=Ma(Dt,De),Ut=Et(Math.asin(-Tt/he));let ci=Et(Math.atan2(_t,kt));ci=s.center.lng+function(Ki,_i){const Si=(_i-Ki+180)%360-180;return Si<-180?Si+360:Si}(s.center.lng,ci);const ai=vc(ci),Ti=ye(ch(Ut),0,1);return new ud(ai,Ti)}class l3{constructor(n,o,d){this.a=wc([],n,d),this.b=wc([],o,d),this.center=d;const g=so([],this.a),v=so([],this.b);this.angle=Math.acos(Ma(g,v))}}function D1(s,n){if(s.angle===0)return null;let o;return o=s.a[n]===0?1/s.angle*.5*Math.PI:1/s.angle*Math.atan(s.b[n]/s.a[n]/Math.sin(s.angle)-1/Math.tan(s.angle)),o<0||o>1?null:function(d,g,v,E){const L=Math.sin(v);return d*(Math.sin((1-E)*v)/L)+g*(Math.sin(E*v)/L)}(s.a[n],s.b[n],s.angle,ye(o,0,1))+s.center[n]}function Fu(s){if(s.z<=1)return a3[s.z+2*s.y+s.x];const n=P1(_0(s));return Ko.fromPoints(n)}function Pp(s,n,o){return pa(s,s,1-o),eu(s,s,n,o)}function $B(s,n){const o=Jf(n.zoom);if(o===0)return Fu(s);const d=_0(s),g=P1(d),v=vc(d.getWest())*n.worldSize,E=vc(d.getEast())*n.worldSize,L=ch(d.getNorth())*n.worldSize,k=ch(d.getSouth())*n.worldSize,V=[v,L,0],q=[E,L,0],se=[v,k,0],he=[E,k,0],_e=yg([],n.globeMatrix);return Qs(V,V,_e),Qs(q,q,_e),Qs(se,se,_e),Qs(he,he,_e),g[0]=Pp(g[0],se,o),g[1]=Pp(g[1],he,o),g[2]=Pp(g[2],q,o),g[3]=Pp(g[3],V,o),Ko.fromPoints(g)}function ZB(s,n,o){for(const d of s)Qs(d,d,n),pa(d,d,o)}function c3(s,n,o){const d=n/s.worldSize,g=s.globeMatrix;if(o.z<=1){const ai=Fu(o).getCorners();return ZB(ai,g,d),Ko.fromPoints(ai)}const v=_0(o),E=P1(v);ZB(E,g,d);const L=Number.MAX_VALUE,k=[-L,-L,-L],V=[L,L,L];if(v.contains(s.center)){for(const Ki of E)EA(V,V,Ki),md(k,k,Ki);k[2]=0;const ai=s.point,Ti=[ai.x*d,ai.y*d,0];return EA(V,V,Ti),md(k,k,Ti),new Ko(V,k)}const q=[g[12]*d,g[13]*d,g[14]*d],se=v.getCenter(),he=ye(s.center.lat,-85.051129,Za),_e=ye(se.lat,-85.051129,Za),be=vc(s.center.lng),De=ch(he);let Ze=be-vc(se.lng);const xt=De-ch(_e);Ze>.5?Ze-=1:Ze<-.5&&(Ze+=1);let Dt=0;Math.abs(Ze)>Math.abs(xt)?Dt=Ze>=0?1:3:(Dt=xt>=0?0:2,eu(q,q,[g[4]*d,g[5]*d,g[6]*d],-Math.sin(Ke(xt>=0?v.getSouth():v.getNorth()))*LA));const _t=E[Dt],Tt=E[(Dt+1)%4],kt=new l3(_t,Tt,q),Ut=[D1(kt,0)||_t[0],D1(kt,1)||_t[1],D1(kt,2)||_t[2]],ci=Jf(s.zoom);if(ci>0){const ai=function({x:Ki,y:_i,z:Si},Li,Vi,Zi,yi){const sn=1/(1<<Si);let Kn=Ki*sn,dn=Kn+sn,Ln=_i*sn,ln=Ln+sn,Xn=0;const Tr=(Kn+dn)/2-Zi;return Tr>.5?Xn=-1:Tr<-.5&&(Xn=1),Kn=((Kn+Xn)*Li-(Zi*=Li))*Vi+Zi,dn=((dn+Xn)*Li-Zi)*Vi+Zi,Ln=(Ln*Li-(yi*=Li))*Vi+yi,ln=(ln*Li-yi)*Vi+yi,[[Kn,ln,0],[dn,ln,0],[dn,Ln,0],[Kn,Ln,0]]}(o,n,s._pixelsPerMercatorPixel,be,De);for(let Ki=0;Ki<E.length;Ki++)Pp(E[Ki],ai[Ki],ci);const Ti=Jh([],ai[Dt],ai[(Dt+1)%4]);pa(Ti,Ti,.5),Pp(Ut,Ti,ci)}for(const ai of E)EA(V,V,ai),md(k,k,ai);return V[2]=Math.min(_t[2],Tt[2]),EA(V,V,Ut),md(k,k,Ut),new Ko(V,k)}function _0({x:s,y:n,z:o}){const d=1/(1<<o),g=new Pr(bl(s*d),Fo((n+1)*d)),v=new Pr(bl((s+1)*d),Fo(n*d));return new wl(g,v)}function P1(s){const n=Ke(s.getNorth()),o=Ke(s.getSouth()),d=Math.cos(n),g=Math.cos(o),v=Math.sin(n),E=Math.sin(o),L=s.getWest(),k=s.getEast();return[Yf(g,E,L),Yf(g,E,k),Yf(d,v,k),Yf(d,v,L)]}function Yf(s,n,o,d=LA){return o=Ke(o),[s*Math.sin(o)*d,-n*d,s*Math.cos(o)*d]}function Ng(s,n,o){return Yf(Math.cos(Ke(s)),Math.sin(Ke(s)),n,o)}function Qg(s,n,o,d){const g=1<<o.z,v=(s/Zn+o.x)/g;return Ng(Fo((n/Zn+o.y)/g),bl(v),d)}function y0({min:s,max:n}){return 16383/Math.max(n[0]-s[0],n[1]-s[1],n[2]-s[2])}const XB=new Float64Array(16);function Vg(s){const n=y0(s),o=jy(XB,[n,n,n]);return wp(o,o,((d=[])[0]=-(g=s.min)[0],d[1]=-g[1],d[2]=-g[2],d));var d,g}function U1(s){const n=(d=s.min,(o=XB)[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=d[0],o[13]=d[1],o[14]=d[2],o[15]=1,o);var o,d;const g=1/y0(s);return BA(n,n,[g,g,g])}function qB(s,n,o,d,g){const v=function(k){const V=Zn/(2*Math.PI);return k/(2*Math.PI)/V}(o),E=[s,n,-o/(2*Math.PI)],L=ql(new Float64Array(16));return wp(L,L,E),BA(L,L,[v,v,v]),xg(L,L,Ke(-g)),Lf(L,L,Ke(-d)),L}function Jf(s){return xe(5,6,s)}function YB(s,n){const o=Ng(n.lat,n.lng),d=function(be){const De=Ng(be._center.lat,be._center.lng);let Ze=gd([],fd(0,1,0),De);const xt=Ky([],-be.angle,De);Ze=Qs(Ze,Ze,xt),Ky(xt,-be._pitch,Ze);const Dt=so([],De);return pa(Dt,Dt,be.cameraToCenterDistance/be.pixelsPerMeter*L1),Qs(Dt,Dt,xt),Jh([],De,Dt)}(s);return E=(g=vg([],d,o))[0],L=g[1],k=g[2],V=(v=o)[0],q=v[1],se=v[2],_e=(he=Math.sqrt(E*E+L*L+k*k)*Math.sqrt(V*V+q*q+se*se))&&Ma(g,v)/he,Math.acos(Math.min(Math.max(_e,-1),1));var g,v,E,L,k,V,q,se,he,_e}function R1(s,n){return YB(s,n)>Math.PI/2*1.01}const JB=Ke(85),h3=Math.cos(JB),u3=Math.sin(JB);function eC(s,n){const o=s.fovAboveCenter,d=s.elevation?s.elevation.getMinElevationBelowMSL()*n:0,g=(s._camera.position[2]*s.worldSize-d)/Math.cos(s._pitch),v=Math.sin(o)*g/Math.sin(Math.max(Math.PI/2-s._pitch-o,.01)),E=Math.sin(s._pitch)*v+g;return Math.min(1.01*E,g*(1/s._horizonShift))}function Up(s,n){if(!n.isReprojectedInTileSpace)return{scale:1<<s.z,x:s.x,y:s.y,x2:s.x+1,y2:s.y+1,projection:n};const o=Math.pow(2,-s.z),d=s.x*o,g=(s.x+1)*o,v=s.y*o,E=(s.y+1)*o,L=bl(d),k=bl(g),V=Fo(v),q=Fo(E),se=n.project(L,V),he=n.project(k,V),_e=n.project(k,q),be=n.project(L,q);let De=Math.min(se.x,he.x,_e.x,be.x),Ze=Math.min(se.y,he.y,_e.y,be.y),xt=Math.max(se.x,he.x,_e.x,be.x),Dt=Math.max(se.y,he.y,_e.y,be.y);const _t=o/16;function Tt(Ut,ci,ai,Ti,Ki,_i){const Si=(ai+Ki)/2,Li=(Ti+_i)/2,Vi=n.project(bl(Si),Fo(Li)),Zi=Math.max(0,De-Vi.x,Ze-Vi.y,Vi.x-xt,Vi.y-Dt);De=Math.min(De,Vi.x),xt=Math.max(xt,Vi.x),Ze=Math.min(Ze,Vi.y),Dt=Math.max(Dt,Vi.y),Zi>_t&&(Tt(Ut,Vi,ai,Ti,Si,Li),Tt(Vi,ci,Si,Li,Ki,_i))}Tt(se,he,d,v,g,v),Tt(he,_e,g,v,g,E),Tt(_e,be,g,E,d,E),Tt(be,se,d,E,d,v),De-=_t,Ze-=_t,xt+=_t,Dt+=_t;const kt=1/Math.max(xt-De,Dt-Ze);return{scale:kt,x:De*kt,y:Ze*kt,x2:xt*kt,y2:Dt*kt,projection:n}}const A3=ql(new Float32Array(16));class Fd{constructor(n){this.spec=n,this.name=n.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(n,o){return{x:0,y:0,z:0}}unproject(n,o){return new Pr(0,0)}projectTilePoint(n,o,d){return{x:n,y:o,z:0}}locationPoint(n,o,d=!0){return n._coordinatePoint(n.locationCoordinate(o),d)}pixelsPerMeter(n,o){return Xl(1,n)*o}pixelSpaceConversion(n,o,d){return 1}farthestPixelDistance(n){return eC(n,n.pixelsPerMeter)}pointCoordinate(n,o,d,g){const v=n.horizonLineFromTop(!1),E=new me(o,Math.max(v,d));return n.rayIntersectionCoordinate(n.pointRayIntersection(E,g))}pointCoordinate3D(n,o,d){const g=new me(o,d);if(n.elevation)return n.elevation.pointCoordinate(g);{const v=this.pointCoordinate(n,g.x,g.y,0);return[v.x,v.y,v.z]}}isPointAboveHorizon(n,o){if(n.elevation)return!this.pointCoordinate3D(n,o.x,o.y);const d=n.horizonLineFromTop();return o.y<d}createInversionMatrix(n,o){return A3}createTileMatrix(n,o,d){let g,v,E;const L=d.canonical,k=ql(new Float64Array(16));if(this.isReprojectedInTileSpace){const V=Up(L,this);g=1,v=V.x+d.wrap*V.scale,E=V.y,BA(k,k,[g/V.scale,g/V.scale,n.pixelsPerMeter/o])}else g=o/n.zoomScale(L.z),v=(L.x+Math.pow(2,L.z)*d.wrap)*g,E=L.y*g;return wp(k,k,[v,E,0]),BA(k,k,[g/Zn,g/Zn,1]),k}upVector(n,o,d){return[0,0,1]}upVectorScale(n,o,d){return{metersToTile:1}}}class d3 extends Fd{constructor(n){super(n),this.range=[4,7],this.center=n.center||[-96,37.5];const[o,d]=this.parallels=n.parallels||[29.5,45.5],g=Math.sin(Ke(o));this.n=(g+Math.sin(Ke(d)))/2,this.c=1+g*(2*this.n-g),this.r0=Math.sqrt(this.c)/this.n}project(n,o){const{n:d,c:g,r0:v}=this,E=Ke(n-this.center[0]),L=Ke(o),k=Math.sqrt(g-2*d*Math.sin(L))/d;return{x:k*Math.sin(E*d),y:k*Math.cos(E*d)-v,z:0}}unproject(n,o){const{n:d,c:g,r0:v}=this,E=v+o;let L=Math.atan2(n,Math.abs(E))*Math.sign(E);E*d<0&&(L-=Math.PI*Math.sign(n)*Math.sign(E));const k=Ke(this.center[0])*d;L=ze(L,-Math.PI-k,Math.PI-k);const V=ye(Et(L/d)+this.center[0],-180,180),q=Math.asin(ye((g-(n*n+E*E)*d*d)/(2*d),-1,1)),se=ye(Et(q),-85.051129,Za);return new Pr(V,se)}}const Hg=1.340264,Gg=-.081106,Wg=893e-6,jg=.003796,x0=Math.sqrt(3)/2;class p3 extends Fd{project(n,o){o=o/180*Math.PI,n=n/180*Math.PI;const d=Math.asin(x0*Math.sin(o)),g=d*d,v=g*g*g;return{x:.5*(n*Math.cos(d)/(x0*(Hg+3*Gg*g+v*(7*Wg+9*jg*g)))/Math.PI+.5),y:1-.5*(d*(Hg+Gg*g+v*(Wg+jg*g))/Math.PI+1),z:0}}unproject(n,o){n=(2*n-.5)*Math.PI;let d=o=(2*(1-o)-1)*Math.PI,g=d*d,v=g*g*g;for(let q,se,he,_e=0;_e<12&&(se=d*(Hg+Gg*g+v*(Wg+jg*g))-o,he=Hg+3*Gg*g+v*(7*Wg+9*jg*g),q=se/he,d=ye(d-q,-Math.PI/3,Math.PI/3),g=d*d,v=g*g*g,!(Math.abs(q)<1e-12));++_e);const E=x0*n*(Hg+3*Gg*g+v*(7*Wg+9*jg*g))/Math.cos(d),L=Math.asin(Math.sin(d)/x0),k=ye(180*E/Math.PI,-180,180),V=ye(180*L/Math.PI,-85.051129,Za);return new Pr(k,V)}}class f3 extends Fd{constructor(n){super(n),this.wrap=!0,this.supportsWorldCopies=!0}project(n,o){return{x:.5+n/360,y:.5-o/360,z:0}}unproject(n,o){const d=360*(n-.5),g=ye(360*(.5-o),-85.051129,Za);return new Pr(d,g)}}const em=Math.PI/2;function v0(s){return Math.tan((em+s)/2)}class m3 extends Fd{constructor(n){super(n),this.center=n.center||[0,30];const[o,d]=this.parallels=n.parallels||[30,30];let g=Ke(o),v=Ke(d);this.southernCenter=g+v<0,this.southernCenter&&(g=-g,v=-v);const E=Math.cos(g),L=v0(g);this.n=g===v?Math.sin(g):Math.log(E/Math.cos(v))/Math.log(v0(v)/L),this.f=E*Math.pow(v0(g),this.n)/this.n}project(n,o){o=Ke(o),this.southernCenter&&(o=-o),n=Ke(n-this.center[0]);const d=1e-6,{n:g,f:v}=this;v>0?o<-em+d&&(o=-em+d):o>em-d&&(o=em-d);const E=v/Math.pow(v0(o),g);let L=E*Math.sin(g*n),k=v-E*Math.cos(g*n);return L=.5*(L/Math.PI+.5),k=.5*(k/Math.PI+.5),{x:L,y:this.southernCenter?k:1-k,z:0}}unproject(n,o){n=(2*n-.5)*Math.PI,this.southernCenter&&(o=1-o),o=(2*(1-o)-.5)*Math.PI;const{n:d,f:g}=this,v=g-o,E=Math.sign(v),L=Math.sign(d)*Math.sqrt(n*n+v*v);let k=Math.atan2(n,Math.abs(v))*E;v*d<0&&(k-=Math.PI*Math.sign(n)*E);const V=ye(Et(k/d)+this.center[0],-180,180),q=ye(Et(2*Math.atan(Math.pow(g/L,1/d))-em),-85.051129,Za);return new Pr(V,this.southernCenter?-q:q)}}class tC extends Fd{constructor(n){super(n),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(n,o){return{x:vc(n),y:ch(o),z:0}}unproject(n,o){const d=bl(n),g=Fo(o);return new Pr(d,g)}}const iC=Ke(Za);class g3 extends Fd{project(n,o){const d=(o=Ke(o))*o,g=d*d;return{x:.5*((n=Ke(n))*(.8707-.131979*d+g*(g*(.003971*d-.001529*g)-.013791))/Math.PI+.5),y:1-.5*(o*(1.007226+d*(.015085+g*(.028874*d-.044475-.005916*g)))/Math.PI+1),z:0}}unproject(n,o){n=(2*n-.5)*Math.PI;let d=o=(2*(1-o)-1)*Math.PI,g=25,v=0,E=d*d;do{E=d*d;const V=E*E;v=(d*(1.007226+E*(.015085+V*(.028874*E-.044475-.005916*V)))-o)/(1.007226+E*(.045255+V*(.259866*E-.311325-.005916*11*V))),d=ye(d-v,-iC,iC)}while(Math.abs(v)>1e-6&&--g>0);E=d*d;const L=ye(Et(n/(.8707+E*(E*(E*E*E*(.003971-.001529*E)-.013791)-.131979))),-180,180),k=Et(d);return new Pr(L,k)}}const nC=Ke(Za);class _3 extends Fd{project(n,o){o=Ke(o),n=Ke(n);const d=Math.cos(o),g=2/Math.PI,v=Math.acos(d*Math.cos(n/2)),E=Math.sin(v)/v,L=.5*(n*g+2*d*Math.sin(n/2)/E)||0,k=.5*(o+Math.sin(o)/E)||0;return{x:.5*(L/Math.PI+.5),y:1-.5*(k/Math.PI+1),z:0}}unproject(n,o){let d=n=(2*n-.5)*Math.PI,g=o=(2*(1-o)-1)*Math.PI,v=25;const E=1e-6;let L=0,k=0;do{const V=Math.cos(g),q=Math.sin(g),se=2*q*V,he=q*q,_e=V*V,be=Math.cos(d/2),De=Math.sin(d/2),Ze=2*be*De,xt=De*De,Dt=1-_e*be*be,_t=Dt?1/Dt:0,Tt=Dt?Math.acos(V*be)*Math.sqrt(1/Dt):0,kt=.5*(2*Tt*V*De+2*d/Math.PI)-n,Ut=.5*(Tt*q+g)-o,ci=.5*_t*(_e*xt+Tt*V*be*he)+1/Math.PI,ai=_t*(Ze*se/4-Tt*q*De),Ti=.125*_t*(se*De-Tt*q*_e*Ze),Ki=.5*_t*(he*be+Tt*xt*V)+.5,_i=ai*Ti-Ki*ci;L=(Ut*ai-kt*Ki)/_i,k=(kt*Ti-Ut*ci)/_i,d=ye(d-L,-Math.PI,Math.PI),g=ye(g-k,-nC,nC)}while((Math.abs(L)>E||Math.abs(k)>E)&&--v>0);return new Pr(Et(d),Et(g))}}class rC extends Fd{constructor(n){super(n),this.center=n.center||[0,0],this.parallels=n.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Ke(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(n,o){const{scale:d,cosPhi:g}=this;return{x:Ke(n)*g*d+.5,y:-Math.sin(Ke(o))/g*d+.5,z:0}}unproject(n,o){const{scale:d,cosPhi:g}=this,v=-(o-.5)/d,E=ye(Et((n-.5)/d)/g,-180,180),L=Math.asin(ye(v*g,-1,1)),k=ye(Et(L),-85.051129,Za);return new Pr(E,k)}}class y3 extends tC{constructor(n){super(n),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug","custom"],this.range=[3,5]}projectTilePoint(n,o,d){const g=Qg(n,o,d);return Qs(g,g,Vg(Fu(d))),{x:g[0],y:g[1],z:g[2]}}locationPoint(n,o){const d=Ng(o.lat,o.lng),g=so([],d),v=n.elevation?n.elevation.getAtPointOrZero(n.locationCoordinate(o),n._centerAltitude):n._centerAltitude;eu(d,d,g,Xl(1,0)*Zn*v);const E=ql(new Float64Array(16));return bA(E,n.pixelMatrix,n.globeMatrix),Qs(d,d,E),new me(d[0],d[1])}pixelsPerMeter(n,o){return Xl(1,0)*o}pixelSpaceConversion(n,o,d){const g=Xl(1,n)*o,v=gr(Xl(1,45)*o,g,d);return this.pixelsPerMeter(n,o)/v}createTileMatrix(n,o,d){const g=U1(Fu(d.canonical));return bA(new Float64Array(16),n.globeMatrix,g)}createInversionMatrix(n,o){const{center:d}=n,g=Vg(Fu(o));return Lf(g,g,Ke(d.lng)),xg(g,g,Ke(d.lat)),BA(g,g,[n._pixelsPerMercatorPixel,n._pixelsPerMercatorPixel,1]),Float32Array.from(g)}pointCoordinate(n,o,d,g){return KB(n,o,d,!0)||new ud(0,0)}pointCoordinate3D(n,o,d){const g=this.pointCoordinate(n,o,d,0);return[g.x,g.y,g.z]}isPointAboveHorizon(n,o){return!KB(n,o.x,o.y,!1)}farthestPixelDistance(n){const o=function(g,v){const E=g.cameraToCenterDistance,L=g._centerAltitude*v,k=g._camera,V=g._camera.forward(),q=Jh([],pa([],V,-E),[0,0,L]),se=g.worldSize/(2*Math.PI),he=[0,0,-se],_e=g.width/g.height,be=Math.tan(g.fovAboveCenter),De=pa([],k.up(),be),Ze=pa([],k.right(),be*_e),xt=so([],Jh([],Jh([],V,De),Ze)),Dt=[];let _t;if(new Uf(q,xt).closestPointOnSphere(he,se,Dt)){const Tt=Jh([],Dt,he),kt=wc([],Tt,q);_t=Math.cos(g.fovAboveCenter)*pd(kt)}else{const Tt=wc([],q,he),kt=wc([],he,q);so(kt,kt);const Ut=pd(Tt)-se;_t=Math.sqrt(Ut*(Ut+2*se));const ci=Math.acos(_t/(se+Ut))-Math.acos(Ma(V,kt));_t*=Math.cos(ci)}return 1.01*_t}(n,this.pixelsPerMeter(n.center.lat,n.worldSize)),d=Jf(n.zoom);if(d>0){const g=eC(n,Xl(1,n.center.lat)*n.worldSize),v=n.worldSize/(2*Math.PI),E=Math.max(n.width,n.height)/n.worldSize*Math.PI;return gr(o,g+v*(1-Math.cos(E)),Math.pow(d,10))}return o}upVector(n,o,d){return Qg(o,d,n,1)}upVectorScale(n){return{metersToTile:L1*y0(Fu(n))}}}function sC(s){const n=s.parallels,o=!!n&&Math.abs(n[0]+n[1])<.01;switch(s.name){case"mercator":return new tC(s);case"equirectangular":return new f3(s);case"naturalEarth":return new g3(s);case"equalEarth":return new p3(s);case"winkelTripel":return new _3(s);case"albers":return o?new rC(s):new d3(s);case"lambertConformalConic":return o?new rC(s):new m3(s);case"globe":return new y3(s)}throw new Error(`Invalid projection name: ${s.name}`)}const x3=w.types,v3=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function w0(s,n,o,d,g,v,E,L,k,V,q,se,he){const _e=L?Math.min(Id,Math.round(L[0])):0,be=L?Math.min(Id,Math.round(L[1])):0;s.emplaceBack(n,o,Math.round(32*d),Math.round(32*g),v,E,(_e<<1)+(k?1:0),be,16*V,16*q,256*se,256*he)}function b0(s,n,o,d,g,v,E){s.emplaceBack(n,o,d,g,v,E)}function B0(s,n,o,d,g){s.emplaceBack(n,o,d,g),s.emplaceBack(n,o,d,g),s.emplaceBack(n,o,d,g),s.emplaceBack(n,o,d,g)}function w3(s){for(const n of s.sections)if(rt(n.text))return!0;return!1}class z1{constructor(n){this.layoutVertexArray=new Xr,this.indexArray=new _o,this.programConfigurations=n,this.segments=new to,this.dynamicLayoutVertexArray=new Ca,this.opacityVertexArray=new Ls,this.placedSymbolArray=new My,this.globeExtVertexArray=new Fr}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(n,o,d,g){this.isEmpty()||(d&&(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Lo.members),this.indexBuffer=n.createIndexBuffer(this.indexArray,o),this.dynamicLayoutVertexBuffer=n.createVertexBuffer(this.dynamicLayoutVertexArray,Ia.members,!0),this.opacityVertexBuffer=n.createVertexBuffer(this.opacityVertexArray,v3,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=n.createVertexBuffer(this.globeExtVertexArray,$o.members,!0)),this.opacityVertexBuffer.itemSize=1),(d||g)&&this.programConfigurations.upload(n))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}zt(z1,"SymbolBuffers");class k1{constructor(n,o,d){this.layoutVertexArray=new n,this.layoutAttributes=o,this.indexArray=new d,this.segments=new to,this.collisionVertexArray=new bu,this.collisionVertexArrayExt=new Ka}upload(n){this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=n.createVertexBuffer(this.collisionVertexArray,io.members,!0),this.collisionVertexBufferExt=n.createVertexBuffer(this.collisionVertexArrayExt,Do.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}zt(k1,"CollisionBuffers");class Ld{constructor(n){this.collisionBoxArray=n.collisionBoxArray,this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(E=>E.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ql([]),this.placementViewportMatrix=ql([]);const o=this.layers[0]._unevaluatedLayout._values;this.textSizeData=gs(this.zoom,o["text-size"]),this.iconSizeData=gs(this.zoom,o["icon-size"]);const d=this.layers[0].layout,g=d.get("symbol-sort-key"),v=d.get("symbol-z-order");this.canOverlap=d.get("text-allow-overlap")||d.get("icon-allow-overlap")||d.get("text-ignore-placement")||d.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&g.constantOr(1)!==void 0,this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=d.get("text-writing-mode").map(E=>qo[E]),this.stateDependentLayerIds=this.layers.filter(E=>E.isStateDependent()).map(E=>E.id),this.sourceID=n.sourceID,this.projection=n.projection}createArrays(){this.text=new z1(new _A(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new z1(new _A(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new ag,this.lineVertexArray=new Bu,this.symbolInstances=new pp}calculateGlyphDependencies(n,o,d,g,v){for(let E=0;E<n.length;E++)if(o[n.charCodeAt(E)]=!0,g&&v){const L=ao[n.charAt(E)];L&&(o[L.charCodeAt(0)]=!0)}}populate(n,o,d,g){const v=this.layers[0],E=v.layout,L=this.projection.name==="globe",k=E.get("text-font"),V=E.get("text-field"),q=E.get("icon-image"),se=(V.value.kind!=="constant"||V.value.value instanceof Os&&!V.value.value.isEmpty()||V.value.value.toString().length>0)&&(k.value.kind!=="constant"||k.value.value.length>0),he=q.value.kind!=="constant"||!!q.value.value||Object.keys(q.parameters).length>0,_e=E.get("symbol-sort-key");if(this.features=[],!se&&!he)return;const be=o.iconDependencies,De=o.glyphDependencies,Ze=o.availableImages,xt=new qt(this.zoom);for(const{feature:Dt,id:_t,index:Tt,sourceLayerIndex:kt}of n){const Ut=v._featureFilter.needGeometry,ci=xA(Dt,Ut);if(!v._featureFilter.filter(xt,ci,d))continue;if(Ut||(ci.geometry=Yh(Dt,d,g)),L&&Dt.type!==1&&d.z<=5){const _i=ci.geometry,Si=.98078528056,Li=(Vi,Zi)=>Ma(Qg(Vi.x,Vi.y,d,1),Qg(Zi.x,Zi.y,d,1))<Si;for(let Vi=0;Vi<_i.length;Vi++)_i[Vi]=Ny(_i[Vi],Li)}let ai,Ti;if(se){const _i=v.getValueAndResolveTokens("text-field",ci,d,Ze),Si=Os.factory(_i);w3(Si)&&(this.hasRTLText=!0),(!this.hasRTLText||Ht()==="unavailable"||this.hasRTLText&&si.isParsed())&&(ai=Uo(Si,v,ci))}if(he){const _i=v.getValueAndResolveTokens("icon-image",ci,d,Ze);Ti=_i instanceof No?_i:No.fromString(_i)}if(!ai&&!Ti)continue;const Ki=this.sortFeaturesByKey?_e.evaluate(ci,{},d):void 0;if(this.features.push({id:_t,text:ai,icon:Ti,index:Tt,sourceLayerIndex:kt,geometry:ci.geometry,properties:Dt.properties,type:x3[Dt.type],sortKey:Ki}),Ti&&(be[Ti.name]=!0),ai){const _i=k.evaluate(ci,{},d).join(","),Si=E.get("text-rotation-alignment")==="map"&&E.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(qo.vertical)>=0;for(const Li of ai.sections)if(Li.image)be[Li.image.name]=!0;else{const Vi=H(ai.toString()),Zi=Li.fontStack||_i,yi=De[Zi]=De[Zi]||{};this.calculateGlyphDependencies(Li.text,yi,Si,this.allowVerticalPlacement,Vi)}}}E.get("symbol-placement")==="line"&&(this.features=function(Dt){const _t={},Tt={},kt=[];let Ut=0;function ci(_i){kt.push(Dt[_i]),Ut++}function ai(_i,Si,Li){const Vi=Tt[_i];return delete Tt[_i],Tt[Si]=Vi,kt[Vi].geometry[0].pop(),kt[Vi].geometry[0]=kt[Vi].geometry[0].concat(Li[0]),Vi}function Ti(_i,Si,Li){const Vi=_t[Si];return delete _t[Si],_t[_i]=Vi,kt[Vi].geometry[0].shift(),kt[Vi].geometry[0]=Li[0].concat(kt[Vi].geometry[0]),Vi}function Ki(_i,Si,Li){const Vi=Li?Si[0][Si[0].length-1]:Si[0][0];return`${_i}:${Vi.x}:${Vi.y}`}for(let _i=0;_i<Dt.length;_i++){const Si=Dt[_i],Li=Si.geometry,Vi=Si.text?Si.text.toString():null;if(!Vi){ci(_i);continue}const Zi=Ki(Vi,Li),yi=Ki(Vi,Li,!0);if(Zi in Tt&&yi in _t&&Tt[Zi]!==_t[yi]){const sn=Ti(Zi,yi,Li),Kn=ai(Zi,yi,kt[sn].geometry);delete _t[Zi],delete Tt[yi],Tt[Ki(Vi,kt[Kn].geometry,!0)]=Kn,kt[sn].geometry=null}else Zi in Tt?ai(Zi,yi,Li):yi in _t?Ti(Zi,yi,Li):(ci(_i),_t[Zi]=Ut-1,Tt[yi]=Ut-1)}return kt.filter(_i=>_i.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Dt,_t)=>Dt.sortKey-_t.sortKey)}update(n,o,d,g){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,o,this.layers,d,g),this.icon.programConfigurations.updatePaintArrays(n,o,this.layers,d,g))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=sC(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(n,o){const d=this.lineVertexArray.length;if(n.segment!==void 0)for(const{x:g,y:v}of o)this.lineVertexArray.emplaceBack(g,v);return{lineStartIndex:d,lineLength:this.lineVertexArray.length-d}}addSymbols(n,o,d,g,v,E,L,k,V,q,se,he,_e,be){const De=n.indexArray,Ze=n.layoutVertexArray,xt=n.globeExtVertexArray,Dt=n.segments.prepareSegment(4*o.length,Ze,De,this.canOverlap?E.sortKey:void 0),_t=this.glyphOffsetArray.length,Tt=Dt.vertexLength,kt=this.allowVerticalPlacement&&L===qo.vertical?Math.PI/2:0,Ut=E.text&&E.text.sections;for(let ai=0;ai<o.length;ai++){const{tl:Ti,tr:Ki,bl:_i,br:Si,tex:Li,pixelOffsetTL:Vi,pixelOffsetBR:Zi,minFontScaleX:yi,minFontScaleY:sn,glyphOffset:Kn,isSDF:dn,sectionIndex:Ln}=o[ai],ln=Dt.vertexLength,Xn=Kn[1];if(w0(Ze,V.x,V.y,Ti.x,Xn+Ti.y,Li.x,Li.y,d,dn,Vi.x,Vi.y,yi,sn),w0(Ze,V.x,V.y,Ki.x,Xn+Ki.y,Li.x+Li.w,Li.y,d,dn,Zi.x,Vi.y,yi,sn),w0(Ze,V.x,V.y,_i.x,Xn+_i.y,Li.x,Li.y+Li.h,d,dn,Vi.x,Zi.y,yi,sn),w0(Ze,V.x,V.y,Si.x,Xn+Si.y,Li.x+Li.w,Li.y+Li.h,d,dn,Zi.x,Zi.y,yi,sn),k){const{x:Tr,y:wr,z:xr}=k.anchor,[Jn,es,ir]=k.up;b0(xt,Tr,wr,xr,Jn,es,ir),b0(xt,Tr,wr,xr,Jn,es,ir),b0(xt,Tr,wr,xr,Jn,es,ir),b0(xt,Tr,wr,xr,Jn,es,ir),B0(n.dynamicLayoutVertexArray,Tr,wr,xr,kt)}else B0(n.dynamicLayoutVertexArray,V.x,V.y,V.z,kt);De.emplaceBack(ln,ln+1,ln+2),De.emplaceBack(ln+1,ln+2,ln+3),Dt.vertexLength+=4,Dt.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Kn[0]),ai!==o.length-1&&Ln===o[ai+1].sectionIndex||n.programConfigurations.populatePaintArrays(Ze.length,E,E.index,{},_e,be,Ut&&Ut[Ln])}const ci=k?k.anchor:V;n.placedSymbolArray.emplaceBack(ci.x,ci.y,ci.z,V.x,V.y,_t,this.glyphOffsetArray.length-_t,Tt,q,se,V.segment,d?d[0]:0,d?d[1]:0,g[0],g[1],L,0,!1,0,he,0)}_commitLayoutVertex(n,o,d,g,v,E,L){n.emplaceBack(o,d,g,v,E,Math.round(L.x),Math.round(L.y))}_addCollisionDebugVertices(n,o,d,g,v,E,L){const k=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),V=k.vertexLength,q=L.tileAnchorX,se=L.tileAnchorY;for(let _e=0;_e<4;_e++)d.collisionVertexArray.emplaceBack(0,0,0,0);d.collisionVertexArrayExt.emplaceBack(o,-n.padding,-n.padding),d.collisionVertexArrayExt.emplaceBack(o,n.padding,-n.padding),d.collisionVertexArrayExt.emplaceBack(o,n.padding,n.padding),d.collisionVertexArrayExt.emplaceBack(o,-n.padding,n.padding),this._commitLayoutVertex(d.layoutVertexArray,g,v,E,q,se,new me(n.x1,n.y1)),this._commitLayoutVertex(d.layoutVertexArray,g,v,E,q,se,new me(n.x2,n.y1)),this._commitLayoutVertex(d.layoutVertexArray,g,v,E,q,se,new me(n.x2,n.y2)),this._commitLayoutVertex(d.layoutVertexArray,g,v,E,q,se,new me(n.x1,n.y2)),k.vertexLength+=4;const he=d.indexArray;he.emplaceBack(V,V+1),he.emplaceBack(V+1,V+2),he.emplaceBack(V+2,V+3),he.emplaceBack(V+3,V),k.primitiveLength+=4}_addTextDebugCollisionBoxes(n,o,d,g,v,E){for(let L=g;L<v;L++){const k=d.get(L),V=this.getSymbolInstanceTextSize(n,E,o,L);this._addCollisionDebugVertices(k,V,this.textCollisionBox,k.projectedAnchorX,k.projectedAnchorY,k.projectedAnchorZ,E)}}_addIconDebugCollisionBoxes(n,o,d,g,v,E){for(let L=g;L<v;L++){const k=d.get(L),V=this.getSymbolInstanceIconSize(n,o,E.placedIconSymbolIndex);this._addCollisionDebugVertices(k,V,this.iconCollisionBox,k.projectedAnchorX,k.projectedAnchorY,k.projectedAnchorZ,E)}}generateCollisionDebugBuffers(n,o){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new k1(rs,Po.members,$a),this.iconCollisionBox=new k1(rs,Po.members,$a);const d=pr(this.iconSizeData,n),g=pr(this.textSizeData,n);for(let v=0;v<this.symbolInstances.length;v++){const E=this.symbolInstances.get(v);this._addTextDebugCollisionBoxes(g,n,o,E.textBoxStartIndex,E.textBoxEndIndex,E),this._addTextDebugCollisionBoxes(g,n,o,E.verticalTextBoxStartIndex,E.verticalTextBoxEndIndex,E),this._addIconDebugCollisionBoxes(d,n,o,E.iconBoxStartIndex,E.iconBoxEndIndex,E),this._addIconDebugCollisionBoxes(d,n,o,E.verticalIconBoxStartIndex,E.verticalIconBoxEndIndex,E)}}getSymbolInstanceTextSize(n,o,d,g){const v=this.text.placedSymbolArray.get(o.rightJustifiedTextSymbolIndex>=0?o.rightJustifiedTextSymbolIndex:o.centerJustifiedTextSymbolIndex>=0?o.centerJustifiedTextSymbolIndex:o.leftJustifiedTextSymbolIndex>=0?o.leftJustifiedTextSymbolIndex:o.verticalPlacedTextSymbolIndex>=0?o.verticalPlacedTextSymbolIndex:g),E=$s(this.textSizeData,n,v)/Jr;return this.tilePixelRatio*E}getSymbolInstanceIconSize(n,o,d){const g=this.icon.placedSymbolArray.get(d),v=$s(this.iconSizeData,n,g);return this.tilePixelRatio*v}_commitDebugCollisionVertexUpdate(n,o,d){n.emplaceBack(o,-d,-d),n.emplaceBack(o,d,-d),n.emplaceBack(o,d,d),n.emplaceBack(o,-d,d)}_updateTextDebugCollisionBoxes(n,o,d,g,v,E){for(let L=g;L<v;L++){const k=d.get(L),V=this.getSymbolInstanceTextSize(n,E,o,L);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,V,k.padding)}}_updateIconDebugCollisionBoxes(n,o,d,g,v,E){for(let L=g;L<v;L++){const k=d.get(L),V=this.getSymbolInstanceIconSize(n,o,E);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,V,k.padding)}}updateCollisionDebugBuffers(n,o){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const d=pr(this.iconSizeData,n),g=pr(this.textSizeData,n);for(let v=0;v<this.symbolInstances.length;v++){const E=this.symbolInstances.get(v);this._updateTextDebugCollisionBoxes(g,n,o,E.textBoxStartIndex,E.textBoxEndIndex,E),this._updateTextDebugCollisionBoxes(g,n,o,E.verticalTextBoxStartIndex,E.verticalTextBoxEndIndex,E),this._updateIconDebugCollisionBoxes(d,n,o,E.iconBoxStartIndex,E.iconBoxEndIndex,E.placedIconSymbolIndex),this._updateIconDebugCollisionBoxes(d,n,o,E.verticalIconBoxStartIndex,E.verticalIconBoxEndIndex,E.placedIconSymbolIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(n,o,d,g,v,E,L,k,V){const q={};if(o<d){const{x1:se,y1:he,x2:_e,y2:be,padding:De,projectedAnchorX:Ze,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt,featureIndex:kt}=n.get(o);q.textBox={x1:se,y1:he,x2:_e,y2:be,padding:De,projectedAnchorX:Ze,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt},q.textFeatureIndex=kt}if(g<v){const{x1:se,y1:he,x2:_e,y2:be,padding:De,projectedAnchorX:Ze,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt,featureIndex:kt}=n.get(g);q.verticalTextBox={x1:se,y1:he,x2:_e,y2:be,padding:De,projectedAnchorX:Ze,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt},q.verticalTextFeatureIndex=kt}if(E<L){const{x1:se,y1:he,x2:_e,y2:be,padding:De,projectedAnchorX:Ze,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt,featureIndex:kt}=n.get(E);q.iconBox={x1:se,y1:he,x2:_e,y2:be,padding:De,projectedAnchorX:Ze,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt},q.iconFeatureIndex=kt}if(k<V){const{x1:se,y1:he,x2:_e,y2:be,padding:De,projectedAnchorX:Ze,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt,featureIndex:kt}=n.get(k);q.verticalIconBox={x1:se,y1:he,x2:_e,y2:be,padding:De,projectedAnchorX:Ze,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt},q.verticalIconFeatureIndex=kt}return q}deserializeCollisionBoxes(n){this.collisionArrays=[];for(let o=0;o<this.symbolInstances.length;o++){const d=this.symbolInstances.get(o);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(n,d.textBoxStartIndex,d.textBoxEndIndex,d.verticalTextBoxStartIndex,d.verticalTextBoxEndIndex,d.iconBoxStartIndex,d.iconBoxEndIndex,d.verticalIconBoxStartIndex,d.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(n,o){const d=n.placedSymbolArray.get(o),g=d.vertexStartIndex+4*d.numGlyphs;for(let v=d.vertexStartIndex;v<g;v+=4)n.indexArray.emplaceBack(v,v+1,v+2),n.indexArray.emplaceBack(v+1,v+2,v+3)}getSortedSymbolIndexes(n){if(this.sortedAngle===n&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const o=Math.sin(n),d=Math.cos(n),g=[],v=[],E=[];for(let L=0;L<this.symbolInstances.length;++L){E.push(L);const k=this.symbolInstances.get(L);g.push(0|Math.round(o*k.tileAnchorX+d*k.tileAnchorY)),v.push(k.featureIndex)}return E.sort((L,k)=>g[L]-g[k]||v[k]-v[L]),E}addToSortKeyRanges(n,o){const d=this.sortKeyRanges[this.sortKeyRanges.length-1];d&&d.sortKey===o?d.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:o,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const o of this.symbolInstanceIndexes){const d=this.symbolInstances.get(o);this.featureSortOrder.push(d.featureIndex);const{rightJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:v,leftJustifiedTextSymbolIndex:E,verticalPlacedTextSymbolIndex:L,placedIconSymbolIndex:k,verticalPlacedIconSymbolIndex:V}=d;g>=0&&this.addIndicesForPlacedSymbol(this.text,g),v>=0&&v!==g&&this.addIndicesForPlacedSymbol(this.text,v),E>=0&&E!==v&&E!==g&&this.addIndicesForPlacedSymbol(this.text,E),L>=0&&this.addIndicesForPlacedSymbol(this.text,L),k>=0&&this.addIndicesForPlacedSymbol(this.icon,k),V>=0&&this.addIndicesForPlacedSymbol(this.icon,V)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}zt(Ld,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Ld.MAX_GLYPHS=65535,Ld.addDynamicAttributes=B0;const b3=new Hn({"symbol-placement":new Jt(Yt.layout_symbol["symbol-placement"]),"symbol-spacing":new Jt(Yt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Jt(Yt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new pi(Yt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Jt(Yt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Jt(Yt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Jt(Yt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Jt(Yt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Jt(Yt.layout_symbol["icon-rotation-alignment"]),"icon-size":new pi(Yt.layout_symbol["icon-size"]),"icon-text-fit":new Jt(Yt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Jt(Yt.layout_symbol["icon-text-fit-padding"]),"icon-image":new pi(Yt.layout_symbol["icon-image"]),"icon-rotate":new pi(Yt.layout_symbol["icon-rotate"]),"icon-padding":new Jt(Yt.layout_symbol["icon-padding"]),"icon-keep-upright":new Jt(Yt.layout_symbol["icon-keep-upright"]),"icon-offset":new pi(Yt.layout_symbol["icon-offset"]),"icon-anchor":new pi(Yt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Jt(Yt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Jt(Yt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Jt(Yt.layout_symbol["text-rotation-alignment"]),"text-field":new pi(Yt.layout_symbol["text-field"]),"text-font":new pi(Yt.layout_symbol["text-font"]),"text-size":new pi(Yt.layout_symbol["text-size"]),"text-max-width":new pi(Yt.layout_symbol["text-max-width"]),"text-line-height":new pi(Yt.layout_symbol["text-line-height"]),"text-letter-spacing":new pi(Yt.layout_symbol["text-letter-spacing"]),"text-justify":new pi(Yt.layout_symbol["text-justify"]),"text-radial-offset":new pi(Yt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Jt(Yt.layout_symbol["text-variable-anchor"]),"text-anchor":new pi(Yt.layout_symbol["text-anchor"]),"text-max-angle":new Jt(Yt.layout_symbol["text-max-angle"]),"text-writing-mode":new Jt(Yt.layout_symbol["text-writing-mode"]),"text-rotate":new pi(Yt.layout_symbol["text-rotate"]),"text-padding":new Jt(Yt.layout_symbol["text-padding"]),"text-keep-upright":new Jt(Yt.layout_symbol["text-keep-upright"]),"text-transform":new pi(Yt.layout_symbol["text-transform"]),"text-offset":new pi(Yt.layout_symbol["text-offset"]),"text-allow-overlap":new Jt(Yt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Jt(Yt.layout_symbol["text-ignore-placement"]),"text-optional":new Jt(Yt.layout_symbol["text-optional"])});var O1={paint:new Hn({"icon-opacity":new pi(Yt.paint_symbol["icon-opacity"]),"icon-color":new pi(Yt.paint_symbol["icon-color"]),"icon-halo-color":new pi(Yt.paint_symbol["icon-halo-color"]),"icon-halo-width":new pi(Yt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new pi(Yt.paint_symbol["icon-halo-blur"]),"icon-translate":new Jt(Yt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Jt(Yt.paint_symbol["icon-translate-anchor"]),"text-opacity":new pi(Yt.paint_symbol["text-opacity"]),"text-color":new pi(Yt.paint_symbol["text-color"],{runtimeType:la,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new pi(Yt.paint_symbol["text-halo-color"]),"text-halo-width":new pi(Yt.paint_symbol["text-halo-width"]),"text-halo-blur":new pi(Yt.paint_symbol["text-halo-blur"]),"text-translate":new Jt(Yt.paint_symbol["text-translate"]),"text-translate-anchor":new Jt(Yt.paint_symbol["text-translate-anchor"])}),layout:b3};class oC{constructor(n){this.type=n.property.overrides?n.property.overrides.runtimeType:or,this.defaultValue=n}evaluate(n){if(n.formattedSection){const o=this.defaultValue.property.overrides;if(o&&o.hasOverride(n.formattedSection))return o.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}zt(oC,"FormatSectionOverride",{omit:["defaultValue"]});class C0 extends xc{constructor(n){super(n,O1)}recalculate(n,o){super.recalculate(n,o),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const d=this.layout.get("text-writing-mode");if(d){const g=[];for(const v of d)g.indexOf(v)<0&&g.push(v);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(n,o,d,g){const v=this.layout.get(n).evaluate(o,{},d,g),E=this._unevaluatedLayout._values[n];return E.isDataDriven()||_c(E.value)||!v?v:function(L,k){return k.replace(/{([^{}]+)}/g,(V,q)=>q in L?String(L[q]):"")}(o.properties,v)}createBucket(n){return new Ld(n)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const n of O1.paint.overridableProperties){if(!C0.hasPaintOverride(this.layout,n))continue;const o=this.paint.get(n),d=new oC(o),g=new ih(d,o.property.specification);let v=null;v=o.value.kind==="constant"||o.value.kind==="source"?new fo("source",g):new Gh("composite",g,o.value.zoomStops,o.value._interpolationType),this.paint._values[n]=new Mi(o.property,v,o.parameters)}}_handleOverridablePaintPropertyUpdate(n,o,d){return!(!this.layout||o.isDataDriven()||d.isDataDriven())&&C0.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,o){const d=n.get("text-field"),g=O1.paint.properties[o];let v=!1;const E=L=>{for(const k of L)if(g.overrides&&g.overrides.hasOverride(k))return void(v=!0)};if(d.value.kind==="constant"&&d.value.value instanceof Os)E(d.value.value.sections);else if(d.value.kind==="source"){const L=V=>{v||(V instanceof sc&&Cs(V.value)===Rl?E(V.value.sections):V instanceof hl?E(V.sections):V.eachChild(L))},k=d.value;k._styleExpression&&L(k._styleExpression.expression)}return v}getProgramConfiguration(n){return new lh(this,n)}}var B3={paint:new Hn({"background-color":new Jt(Yt.paint_background["background-color"]),"background-pattern":new Jt(Yt.paint_background["background-pattern"]),"background-opacity":new Jt(Yt.paint_background["background-opacity"])})},C3={paint:new Hn({"raster-opacity":new Jt(Yt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Jt(Yt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Jt(Yt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Jt(Yt.paint_raster["raster-brightness-max"]),"raster-saturation":new Jt(Yt.paint_raster["raster-saturation"]),"raster-contrast":new Jt(Yt.paint_raster["raster-contrast"]),"raster-resampling":new Jt(Yt.paint_raster["raster-resampling"]),"raster-fade-duration":new Jt(Yt.paint_raster["raster-fade-duration"])})};class E3 extends xc{constructor(n){super(n,{}),this.implementation=n}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(n){this.implementation.onAdd&&this.implementation.onAdd(n,n.painter.context.gl)}onRemove(n){this.implementation.onRemove&&this.implementation.onRemove(n,n.painter.context.gl)}}var T3={paint:new Hn({"sky-type":new Jt(Yt.paint_sky["sky-type"]),"sky-atmosphere-sun":new Jt(Yt.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Jt(Yt.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Jt(Yt.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Jt(Yt.paint_sky["sky-gradient-radius"]),"sky-gradient":new In(Yt.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Jt(Yt.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Jt(Yt.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Jt(Yt.paint_sky["sky-opacity"])})};function N1(s,n,o){const d=[0,0,1],g=Bg([]);return Cg(g,g,o?-Ke(s)+Math.PI:Ke(s)),uh(g,g,-Ke(n)),bg(d,d,g),so(d,d)}const S3={circle:class extends xc{constructor(s){super(s,_g)}createBucket(s){return new yp(s)}queryRadius(s){const n=s;return Tu("circle-radius",this,n)+Tu("circle-stroke-width",this,n)+xp(this.paint.get("circle-translate"))}queryIntersectsFeature(s,n,o,d,g,v,E,L){const k=Yr(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),v.angle,s.pixelToTileUnitsFactor),V=this.paint.get("circle-radius").evaluate(n,o)+this.paint.get("circle-stroke-width").evaluate(n,o);return qy(s,d,v,E,L,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",k,V)}getProgramIds(){return["circle"]}getProgramConfiguration(s){return new lh(this,s)}},heatmap:class extends xc{createBucket(s){return new bp(s)}constructor(s){super(s,d1),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Sg({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(s){return Tu("heatmap-radius",this,s)}queryIntersectsFeature(s,n,o,d,g,v,E,L){const k=this.paint.get("heatmap-radius").evaluate(n,o);return qy(s,d,v,E,L,!0,!0,new me(0,0),k)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(s){return new lh(this,s)}},hillshade:class extends xc{constructor(s){super(s,p1)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends xc{constructor(s){super(s,o0)}getProgramIds(){const s=this.paint.get("fill-pattern"),n=s&&s.constantOr(1),o=[n?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&o.push(n&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),o}getProgramConfiguration(s){return new lh(this,s)}recalculate(s,n){super.recalculate(s,n);const o=this.paint._values["fill-outline-color"];o.value.kind==="constant"&&o.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(s){return new Fp(s)}queryRadius(){return xp(this.paint.get("fill-translate"))}queryIntersectsFeature(s,n,o,d,g,v){return!s.queryGeometry.isAboveHorizon&&dg(gg(s.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),v.angle,s.pixelToTileUnitsFactor),d)}isTileClipped(){return!0}},"fill-extrusion":class extends xc{constructor(s){super(s,ui)}createBucket(s){return new Ce(s)}queryRadius(){return xp(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(s){return new lh(this,s)}queryIntersectsFeature(s,n,o,d,g,v,E,L,k){const V=Yr(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),v.angle,s.pixelToTileUnitsFactor),q=this.paint.get("fill-extrusion-height").evaluate(n,o),se=this.paint.get("fill-extrusion-base").evaluate(n,o),he=[0,0],_e=L&&v.elevation,be=v.elevation?v.elevation.exaggeration():1,De=s.tile.getBucket(this);if(_e&&De instanceof Ce){const Tt=De.centroidVertexArray,kt=k+1;kt<Tt.length&&(he[0]=Tt.geta_centroid_pos0(kt),he[1]=Tt.geta_centroid_pos1(kt))}if(he[0]===0&&he[1]===1)return!1;v.projection.name==="globe"&&(d=gi([d],[new me(0,0),new me(Zn,Zn)],s.tileID.canonical).map(Tt=>Tt.polygon).flat());const Ze=_e?L:null,[xt,Dt]=function(Tt,kt,Ut,ci,ai,Ti,Ki,_i,Si,Li,Vi){return Tt.projection.name==="globe"?function(Zi,yi,sn,Kn,dn,Ln,ln,Xn,Tr,wr,xr){const Jn=[],es=[],ir=Zi.projection.upVectorScale(xr,Zi.center.lat,Zi.worldSize).metersToTile,Sr=[0,0,0,1],ss=[0,0,0,1],_s=(ys,Bs,Zs,Yo)=>{ys[0]=Bs,ys[1]=Zs,ys[2]=Yo,ys[3]=1},ps=ri();sn>0&&(sn+=ps),Kn+=ps;for(const ys of yi){const Bs=[],Zs=[];for(const Yo of ys){const ts=Yo.x+dn.x,Ao=Yo.y+dn.y,lo=Zi.projection.projectTilePoint(ts,Ao,xr),Vr=Zi.projection.upVector(xr,Yo.x,Yo.y);let Us=sn,vo=Kn;if(ln){const os=gn(ts,Ao,sn,Kn,ln,Xn,Tr,wr);Us+=os.base,vo+=os.top}sn!==0?_s(Sr,lo.x+Vr[0]*ir*Us,lo.y+Vr[1]*ir*Us,lo.z+Vr[2]*ir*Us):_s(Sr,lo.x,lo.y,lo.z),_s(ss,lo.x+Vr[0]*ir*vo,lo.y+Vr[1]*ir*vo,lo.z+Vr[2]*ir*vo),Qs(Sr,Sr,Ln),Qs(ss,ss,Ln),Bs.push(new an(Sr[0],Sr[1],Sr[2])),Zs.push(new an(ss[0],ss[1],ss[2]))}Jn.push(Bs),es.push(Zs)}return[Jn,es]}(Tt,kt,Ut,ci,ai,Ti,Ki,_i,Si,Li,Vi):Ki?function(Zi,yi,sn,Kn,dn,Ln,ln,Xn,Tr){const wr=[],xr=[],Jn=[0,0,0,1];for(const es of Zi){const ir=[],Sr=[];for(const ss of es){const _s=ss.x+Kn.x,ps=ss.y+Kn.y,ys=gn(_s,ps,yi,sn,Ln,ln,Xn,Tr);Jn[0]=_s,Jn[1]=ps,Jn[2]=ys.base,Jn[3]=1,TA(Jn,Jn,dn),Jn[3]=Math.max(Jn[3],1e-5);const Bs=new an(Jn[0]/Jn[3],Jn[1]/Jn[3],Jn[2]/Jn[3]);Jn[0]=_s,Jn[1]=ps,Jn[2]=ys.top,Jn[3]=1,TA(Jn,Jn,dn),Jn[3]=Math.max(Jn[3],1e-5);const Zs=new an(Jn[0]/Jn[3],Jn[1]/Jn[3],Jn[2]/Jn[3]);ir.push(Bs),Sr.push(Zs)}wr.push(ir),xr.push(Sr)}return[wr,xr]}(kt,Ut,ci,ai,Ti,Ki,_i,Si,Li):function(Zi,yi,sn,Kn,dn){const Ln=[],ln=[],Xn=dn[8]*yi,Tr=dn[9]*yi,wr=dn[10]*yi,xr=dn[11]*yi,Jn=dn[8]*sn,es=dn[9]*sn,ir=dn[10]*sn,Sr=dn[11]*sn;for(const ss of Zi){const _s=[],ps=[];for(const ys of ss){const Bs=ys.x+Kn.x,Zs=ys.y+Kn.y,Yo=dn[0]*Bs+dn[4]*Zs+dn[12],ts=dn[1]*Bs+dn[5]*Zs+dn[13],Ao=dn[2]*Bs+dn[6]*Zs+dn[14],lo=dn[3]*Bs+dn[7]*Zs+dn[15],Vr=Yo+Xn,Us=ts+Tr,vo=Ao+wr,os=Math.max(lo+xr,1e-5),no=Yo+Jn,La=ts+es,Jo=Ao+ir,ea=Math.max(lo+Sr,1e-5);_s.push(new an(Vr/os,Us/os,vo/os)),ps.push(new an(no/ea,La/ea,Jo/ea))}Ln.push(_s),ln.push(ps)}return[Ln,ln]}(kt,Ut,ci,ai,Ti)}(v,d,se,q,V,E,Ze,he,be,v.center.lat,s.tileID.canonical),_t=s.queryGeometry;return function(Tt,kt,Ut){let ci=1/0;dg(Ut,kt)&&(ci=vn(Ut,kt[0]));for(let ai=0;ai<kt.length;ai++){const Ti=kt[ai],Ki=Tt[ai];for(let _i=0;_i<Ti.length-1;_i++){const Si=Ti[_i],Li=[Si,Ti[_i+1],Ki[_i+1],Ki[_i],Si];Vy(Ut,Li)&&(ci=Math.min(ci,vn(Ut,Li)))}}return ci!==1/0&&ci}(xt,Dt,_t.isPointQuery()?_t.screenBounds:_t.screenGeometry)}},line:class extends xc{constructor(s){super(s,xo),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(s){if(s==="line-gradient"){const n=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=n._styleExpression&&n._styleExpression.expression instanceof Hl,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(s,n){super.recalculate(s,n),this.paint._values["line-floorwidth"]=Ks.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,s)}createBucket(s){return new Vs(s)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(s){return new lh(this,s)}queryRadius(s){const n=s,o=oo(Tu("line-width",this,n),Tu("line-gap-width",this,n)),d=Tu("line-offset",this,n);return o/2+Math.abs(d)+xp(this.paint.get("line-translate"))}queryIntersectsFeature(s,n,o,d,g,v){if(s.queryGeometry.isAboveHorizon)return!1;const E=gg(s.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),v.angle,s.pixelToTileUnitsFactor),L=s.pixelToTileUnitsFactor/2*oo(this.paint.get("line-width").evaluate(n,o),this.paint.get("line-gap-width").evaluate(n,o)),k=this.paint.get("line-offset").evaluate(n,o);return k&&(d=function(V,q){const se=[],he=new me(0,0);for(let _e=0;_e<V.length;_e++){const be=V[_e],De=[];for(let Ze=0;Ze<be.length;Ze++){const xt=be[Ze-1],Dt=be[Ze],_t=be[Ze+1],Tt=Ze===0?he:Dt.sub(xt)._unit()._perp(),kt=Ze===be.length-1?he:_t.sub(Dt)._unit()._perp(),Ut=Tt._add(kt)._unit();Ut._mult(1/(Ut.x*kt.x+Ut.y*kt.y)),De.push(Ut._mult(q)._add(Dt))}se.push(De)}return se}(d,k*s.pixelToTileUnitsFactor)),function(V,q,se){for(let he=0;he<q.length;he++){const _e=q[he];if(V.length>=3){for(let be=0;be<_e.length;be++)if(vA(V,_e[be]))return!0}if(Gy(V,_e,se))return!0}return!1}(E,d,L)}isTileClipped(){return!0}},symbol:C0,background:class extends xc{constructor(s){super(s,B3)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends xc{constructor(s){super(s,C3)}getProgramIds(){return["raster"]}},sky:class extends xc{constructor(s){super(s,T3),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="sky-gradient"?this._updateColorRamp():s!=="sky-atmosphere-sun"&&s!=="sky-atmosphere-halo-color"&&s!=="sky-atmosphere-color"&&s!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Sg({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(s){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const n=s.style.light.properties.get("position");return this._lightPosition.azimuthal!==n.azimuthal||this._lightPosition.polar!==n.polar}return!1}getCenter(s,n){if(this.paint.get("sky-type")==="atmosphere"){const d=this.paint.get("sky-atmosphere-sun"),g=!d,v=s.style.light,E=v.properties.get("position");return g&&v.properties.get("anchor")==="viewport"&&Ct("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),g?N1(E.azimuthal,90-E.polar,n):N1(d[0],90-d[1],n)}const o=this.paint.get("sky-gradient-center");return N1(o[0],90-o[1],n)}is3D(){return!1}isSky(){return!0}markSkyboxValid(s){this._skyboxInvalidated=!1,this._lightPosition=s.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const s=this.paint.get("sky-type");return s==="atmosphere"?["skyboxCapture","skybox"]:s==="gradient"?["skyboxGradient"]:null}}};class Kg{constructor(n,o,d,g){this.context=n,this.format=d,this.texture=n.gl.createTexture(),this.update(o,g)}update(n,o,d){const{width:g,height:v}=n,{context:E}=this,{gl:L}=E,{HTMLImageElement:k,HTMLCanvasElement:V,HTMLVideoElement:q,ImageData:se,ImageBitmap:he}=C;if(L.bindTexture(L.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===L.RGBA&&(!o||o.premultiply!==!1)),d||this.size&&this.size[0]===g&&this.size[1]===v){const{x:_e,y:be}=d||{x:0,y:0};n instanceof k||n instanceof V||n instanceof q||n instanceof se||he&&n instanceof he?L.texSubImage2D(L.TEXTURE_2D,0,_e,be,L.RGBA,L.UNSIGNED_BYTE,n):L.texSubImage2D(L.TEXTURE_2D,0,_e,be,g,v,L.RGBA,L.UNSIGNED_BYTE,n.data)}else this.size=[g,v],n instanceof k||n instanceof V||n instanceof q||n instanceof se||he&&n instanceof he?L.texImage2D(L.TEXTURE_2D,0,this.format,this.format,L.UNSIGNED_BYTE,n):L.texImage2D(L.TEXTURE_2D,0,this.format,g,v,0,this.format,L.UNSIGNED_BYTE,n.data);this.useMipmap=Boolean(o&&o.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&L.generateMipmap(L.TEXTURE_2D)}bind(n,o){const{context:d}=this,{gl:g}=d;g.bindTexture(g.TEXTURE_2D,this.texture),n!==this.filter&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,n),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,this.useMipmap?n===g.NEAREST?g.NEAREST_MIPMAP_NEAREST:g.LINEAR_MIPMAP_NEAREST:n),this.filter=n),o!==this.wrap&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,o),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,o),this.wrap=o)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:n}=this.context;n.deleteTexture(this.texture),this.texture=null}}class M3{constructor(n){this._callback=n,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class I3{constructor(){this.tasks={},this.taskQueue=[],Be(["process"],this),this.invoker=new M3(this.process),this.nextId=0}add(n,o){const d=this.nextId++,g=function({type:v,isSymbolTile:E,zoom:L}){return L=L||0,v==="message"?0:v!=="maybePrepare"||E?v!=="parseTile"||E?v==="parseTile"&&E?300-L:v==="maybePrepare"&&E?400-L:500:200-L:100-L}(o);if(g===0){mi();try{n()}finally{}return{cancel:()=>{}}}return this.tasks[d]={fn:n,metadata:o,priority:g,id:d},this.taskQueue.push(d),this.invoker.trigger(),{cancel:()=>{delete this.tasks[d]}}}process(){mi();try{if(this.taskQueue=this.taskQueue.filter(d=>!!this.tasks[d]),!this.taskQueue.length)return;const n=this.pick();if(n===null)return;const o=this.tasks[n];if(delete this.tasks[n],this.taskQueue.length&&this.invoker.trigger(),!o)return;o.fn()}finally{}}pick(){let n=null,o=1/0;for(let g=0;g<this.taskQueue.length;g++){const v=this.tasks[this.taskQueue[g]];v.priority<o&&(o=v.priority,n=g)}if(n===null)return null;const d=this.taskQueue[n];return this.taskQueue.splice(n,1),d}remove(){this.invoker.remove()}}class aC{constructor(n){this._stringToNumber={},this._numberToString=[];for(let o=0;o<n.length;o++){const d=n[o];this._stringToNumber[d]=o,this._numberToString[o]=d}}encode(n){return this._stringToNumber[n]}decode(n){return this._numberToString[n]}}const F3=["tile","layer","source","sourceLayer","state"];class lC{constructor(n,o,d,g,v){this.type="Feature",this._vectorTileFeature=n,this._z=o,this._x=d,this._y=g,this.properties=n.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(n){this._geometry=n}toJSON(){const n={type:"Feature",geometry:this.geometry,properties:this.properties};this.id!==void 0&&(n.id=this.id);for(const o of F3)this[o]!==void 0&&(n[o]=this[o]);return n}}const gh=32,Lu=33,Dd=new Uint16Array(8184);for(let s=0;s<2046;s++){let n=s+2,o=0,d=0,g=0,v=0,E=0,L=0;for(1&n?g=v=E=gh:o=d=L=gh;(n>>=1)>1;){const V=o+g>>1,q=d+v>>1;1&n?(g=o,v=d,o=E,d=L):(o=g,d=v,g=E,v=L),E=V,L=q}const k=4*s;Dd[k+0]=o,Dd[k+1]=d,Dd[k+2]=g,Dd[k+3]=v}const Du=new Uint16Array(2178),Pd=new Uint8Array(1089),E0=new Uint16Array(1089);function cC(s){return s===0?-.03125:s===32?.03125:0}var hC=_n([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const uC={type:2,extent:Zn,loadGeometry:()=>[[new me(0,0),new me(8193,0),new me(8193,8193),new me(0,8193),new me(0,0)]]};class Q1{constructor(n,o,d,g,v){this.tileID=n,this.uid=Ie(),this.uses=0,this.tileSize=o,this.tileZoom=d,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=v,this.expiredRequestCount=0,this.state="loading",g&&g.transform&&(this.projection=g.transform.projection)}registerFadeDuration(n){const o=n+this.timeAdded;o<wi.now()||this.fadeEndTime&&o<this.fadeEndTime||(this.fadeEndTime=o)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=Up(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(n,o,d){if(this.unloadVectorData(),this.state="loaded",n){n.featureIndex&&(this.latestFeatureIndex=n.featureIndex,n.rawTileData?(this.latestRawTileData=n.rawTileData,this.latestFeatureIndex.rawTileData=n.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=n.collisionBoxArray,this.buckets=function(g,v){const E={};if(!v)return E;for(const L of g){const k=L.layerIds.map(V=>v.getLayer(V)).filter(Boolean);if(k.length!==0){L.layers=k,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(V=>k.filter(q=>q.id===V)[0]));for(const V of k)E[V.id]=L}}return E}(n.buckets,o.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const v=this.buckets[g];if(v instanceof Ld){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const v=this.buckets[g];if(v instanceof Ld&&v.hasRTLText){this.hasRTLText=!0,si.isLoading()||si.isLoaded()||Ht()!=="deferred"||hi();break}}this.queryPadding=0;for(const g in this.buckets){const v=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(g).queryRadius(v))}n.imageAtlas&&(this.imageAtlas=n.imageAtlas),n.glyphAtlasImage&&(this.glyphAtlasImage=n.glyphAtlasImage),n.lineAtlas&&(this.lineAtlas=n.lineAtlas)}else this.collisionBoxArray=new og}unloadVectorData(){if(this.hasData()){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(n){return this.buckets[n.id]}upload(n){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(n)}const o=n.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Kg(n,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Kg(n,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Kg(n,this.lineAtlas.image,o.ALPHA),this.lineAtlas.uploaded=!0)}prepare(n){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(n,this.imageAtlasTexture)}queryRenderedFeatures(n,o,d,g,v,E,L,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:g,pixelPosMatrix:L,transform:E,params:v,tileTransform:this.tileTransform},n,o,d):{}}querySourceFeatures(n,o){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),v=o?o.sourceLayer:"",E=g._geojsonTileLayer||g[v];if(!E)return;const L=uo(o&&o.filter),{z:k,x:V,y:q}=this.tileID.canonical,se={z:k,x:V,y:q};for(let he=0;he<E.length;he++){const _e=E.feature(he);if(L.needGeometry){const Ze=xA(_e,!0);if(!L.filter(new qt(this.tileID.overscaledZ),Ze,this.tileID.canonical))continue}else if(!L.filter(new qt(this.tileID.overscaledZ),_e))continue;const be=d.getId(_e,v),De=new lC(_e,k,V,q,be);De.tile=se,n.push(De)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(n){const o=this.expirationTime;if(n.cacheControl){const d=fi(n.cacheControl);d["max-age"]&&(this.expirationTime=Date.now()+1e3*d["max-age"])}else n.expires&&(this.expirationTime=new Date(n.expires).getTime());if(this.expirationTime){const d=Date.now();let g=!1;if(this.expirationTime>d)g=!1;else if(o)if(this.expirationTime<o)g=!0;else{const v=this.expirationTime-o;v?this.expirationTime=d+Math.max(v,3e4):g=!0}else g=!0;g?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(n,o){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(n).length===0||!o)return;const d=this.latestFeatureIndex.loadVTLayers(),g=o.style.listImages();for(const v in this.buckets){if(!o.style.hasLayer(v))continue;const E=this.buckets[v],L=E.layers[0].sourceLayer||"_geojsonTileLayer",k=d[L],V=n[L];if(!k||!V||Object.keys(V).length===0)continue;if(E.update(V,k,g,this.imageAtlas&&this.imageAtlas.patternPositions||{}),E instanceof Vs||E instanceof Fp){const se=o.style._getSourceCache(E.layers[0].source);o._terrain&&o._terrain.enabled&&se&&E.programConfigurations.needsUpload&&o._terrain._clearRenderCacheForTile(se.id,this.tileID)}const q=o&&o.style&&o.style.getLayer(v);q&&(this.queryPadding=Math.max(this.queryPadding,q.queryRadius(E)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<wi.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(n){this.symbolFadeHoldUntil=wi.now()+n}setTexture(n,o){const d=o.context,g=d.gl;this.texture=this.texture||o.getTileTexture(n.width),this.texture?this.texture.update(n,{useMipmap:!0}):(this.texture=new Kg(d,n,g.RGBA,{useMipmap:!0}),this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE),d.extTextureFilterAnisotropic&&g.texParameterf(g.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax))}setDependencies(n,o){const d={};for(const g of o)d[g]=!0;this.dependencies[n]=d}hasDependency(n,o){for(const d of n){const g=this.dependencies[d];if(g){for(const v of o)if(g[v])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(n,o){if(!o||o.name==="mercator"||this._tileDebugBuffer)return;const d=Yh(uC,this.tileID.canonical,this.tileTransform)[0],g=new Or,v=new Xh;for(let E=0;E<d.length;E++){const{x:L,y:k}=d[E];g.emplaceBack(L,k),v.emplaceBack(E)}v.emplaceBack(0),this._tileDebugIndexBuffer=n.createIndexBuffer(v),this._tileDebugBuffer=n.createVertexBuffer(g,Og.members),this._tileDebugSegments=to.simpleSegment(0,0,g.length,v.length)}_makeTileBoundsBuffers(n,o){if(this._tileBoundsBuffer||!o||o.name==="mercator")return;const d=Yh(uC,this.tileID.canonical,this.tileTransform)[0];let g,v;if(this.isRaster){const E=function(L,k){const V=Up(L,k),q=Math.pow(2,L.z);for(let Ze=0;Ze<Lu;Ze++)for(let xt=0;xt<Lu;xt++){const Dt=bl((L.x+(xt+cC(xt))/gh)/q),_t=Fo((L.y+(Ze+cC(Ze))/gh)/q),Tt=k.project(Dt,_t),kt=Ze*Lu+xt;Du[2*kt+0]=Math.round((Tt.x*V.scale-V.x)*Zn),Du[2*kt+1]=Math.round((Tt.y*V.scale-V.y)*Zn)}Pd.fill(0),E0.fill(0);for(let Ze=2045;Ze>=0;Ze--){const xt=4*Ze,Dt=Dd[xt+0],_t=Dd[xt+1],Tt=Dd[xt+2],kt=Dd[xt+3],Ut=Dt+Tt>>1,ci=_t+kt>>1,ai=Ut+ci-_t,Ti=ci+Dt-Ut,Ki=_t*Lu+Dt,_i=kt*Lu+Tt,Si=ci*Lu+Ut,Li=Math.hypot((Du[2*Ki+0]+Du[2*_i+0])/2-Du[2*Si+0],(Du[2*Ki+1]+Du[2*_i+1])/2-Du[2*Si+1])>=16;if(Pd[Si]=Pd[Si]||(Li?1:0),Ze<1022){const Vi=(_t+Ti>>1)*Lu+(Dt+ai>>1),Zi=(kt+Ti>>1)*Lu+(Tt+ai>>1);Pd[Si]=Pd[Si]||Pd[Vi]||Pd[Zi]}}const se=new Qr,he=new _o;let _e=0;function be(Ze,xt){const Dt=xt*Lu+Ze;return E0[Dt]===0&&(se.emplaceBack(Du[2*Dt+0],Du[2*Dt+1],Ze*Zn/gh,xt*Zn/gh),E0[Dt]=++_e),E0[Dt]-1}function De(Ze,xt,Dt,_t,Tt,kt){const Ut=Ze+Dt>>1,ci=xt+_t>>1;if(Math.abs(Ze-Tt)+Math.abs(xt-kt)>1&&Pd[ci*Lu+Ut])De(Tt,kt,Ze,xt,Ut,ci),De(Dt,_t,Tt,kt,Ut,ci);else{const ai=be(Ze,xt),Ti=be(Dt,_t),Ki=be(Tt,kt);he.emplaceBack(ai,Ti,Ki)}}return De(0,0,gh,gh,gh,0),De(gh,gh,0,0,0,gh),{vertices:se,indices:he}}(this.tileID.canonical,o);g=E.vertices,v=E.indices}else{g=new Qr,v=new _o;for(const{x:L,y:k}of d)g.emplaceBack(L,k,0,0);const E=vd.exports(g.int16,void 0,4);for(let L=0;L<E.length;L+=3)v.emplaceBack(E[L],E[L+1],E[L+2])}this._tileBoundsBuffer=n.createVertexBuffer(g,hC.members),this._tileBoundsIndexBuffer=n.createIndexBuffer(v),this._tileBoundsSegments=to.simpleSegment(0,0,g.length,v.length)}_makeGlobeTileDebugBuffers(n,o){const d=o.projection;if(!d||d.name!=="globe"||o.freezeTileCoverage)return;const g=this.tileID.canonical,v=Vg($B(g,o)),E=Jf(o.zoom);let L;E>0&&(L=yg(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(n,g,o,v,L,E),this._makeGlobeTileDebugTextBuffer(n,g,o,v,L,E)}_globePoint(n,o,d,g,v,E,L){let k=Qg(n,o,d);if(E){const V=1<<d.z,q=vc(g.center.lng),se=ch(g.center.lat),he=(d.x+.5)/V-q;let _e=0;he>.5?_e=-1:he<-.5&&(_e=1);let be=(n/Zn+d.x)/V+_e,De=(o/Zn+d.y)/V;be=(be-q)*g._pixelsPerMercatorPixel+q,De=(De-se)*g._pixelsPerMercatorPixel+se;const Ze=[be*g.worldSize,De*g.worldSize,0];Qs(Ze,Ze,E),k=Pp(k,Ze,L)}return Qs(k,k,v)}_makeGlobeTileDebugBorderBuffer(n,o,d,g,v,E){const L=new Or,k=new Xh,V=new Nr,q=(he,_e,be,De,Ze)=>{const xt=(be-he)/(Ze-1),Dt=(De-_e)/(Ze-1),_t=L.length;for(let Tt=0;Tt<Ze;Tt++){const kt=he+Tt*xt,Ut=_e+Tt*Dt;L.emplaceBack(kt,Ut);const ci=this._globePoint(kt,Ut,o,d,g,v,E);V.emplaceBack(ci[0],ci[1],ci[2]),k.emplaceBack(_t+Tt)}},se=Zn;q(0,0,se,0,16),q(se,0,se,se,16),q(se,se,0,se,16),q(0,se,0,0,16),this._tileDebugIndexBuffer=n.createIndexBuffer(k),this._tileDebugBuffer=n.createVertexBuffer(L,Og.members),this._globeTileDebugBorderBuffer=n.createVertexBuffer(V,jB.members),this._tileDebugSegments=to.simpleSegment(0,0,L.length,k.length)}_makeGlobeTileDebugTextBuffer(n,o,d,g,v,E){const L=new Or,k=new _o,V=new Nr,q=25;k.reserve(32),L.reserve(q),V.reserve(q);const se=(he,_e)=>q*he+_e;for(let he=0;he<q;he++){const _e=2048*he;for(let be=0;be<q;be++){const De=2048*be;L.emplaceBack(De,_e);const Ze=this._globePoint(De,_e,o,d,g,v,E);V.emplaceBack(Ze[0],Ze[1],Ze[2])}}for(let he=0;he<4;he++)for(let _e=0;_e<4;_e++){const be=se(he,_e),De=se(he,_e+1),Ze=se(he+1,_e),xt=se(he+1,_e+1);k.emplaceBack(be,De,Ze),k.emplaceBack(Ze,De,xt)}this._tileDebugTextIndexBuffer=n.createIndexBuffer(k),this._tileDebugTextBuffer=n.createVertexBuffer(L,Og.members),this._globeTileDebugTextBuffer=n.createVertexBuffer(V,jB.members),this._tileDebugTextSegments=to.simpleSegment(0,0,q,32)}}class L3{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(n,o,d){const g=String(o);if(this.stateChanges[n]=this.stateChanges[n]||{},this.stateChanges[n][g]=this.stateChanges[n][g]||{},Ve(this.stateChanges[n][g],d),this.deletedStates[n]===null){this.deletedStates[n]={};for(const v in this.state[n])v!==g&&(this.deletedStates[n][v]=null)}else if(this.deletedStates[n]&&this.deletedStates[n][g]===null){this.deletedStates[n][g]={};for(const v in this.state[n][g])d[v]||(this.deletedStates[n][g][v]=null)}else for(const v in d)this.deletedStates[n]&&this.deletedStates[n][g]&&this.deletedStates[n][g][v]===null&&delete this.deletedStates[n][g][v]}removeFeatureState(n,o,d){if(this.deletedStates[n]===null)return;const g=String(o);if(this.deletedStates[n]=this.deletedStates[n]||{},d&&o!==void 0)this.deletedStates[n][g]!==null&&(this.deletedStates[n][g]=this.deletedStates[n][g]||{},this.deletedStates[n][g][d]=null);else if(o!==void 0)if(this.stateChanges[n]&&this.stateChanges[n][g])for(d in this.deletedStates[n][g]={},this.stateChanges[n][g])this.deletedStates[n][g][d]=null;else this.deletedStates[n][g]=null;else this.deletedStates[n]=null}getState(n,o){const d=String(o),g=Ve({},(this.state[n]||{})[d],(this.stateChanges[n]||{})[d]);if(this.deletedStates[n]===null)return{};if(this.deletedStates[n]){const v=this.deletedStates[n][o];if(v===null)return{};for(const E in v)delete g[E]}return g}initializeTileState(n,o){n.setFeatureState(this.state,o)}coalesceChanges(n,o){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const v={};for(const E in this.stateChanges[g])this.state[g][E]||(this.state[g][E]={}),Ve(this.state[g][E],this.stateChanges[g][E]),v[E]=this.state[g][E];d[g]=v}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const v={};if(this.deletedStates[g]===null)for(const E in this.state[g])v[E]={},this.state[g][E]={};else for(const E in this.deletedStates[g]){if(this.deletedStates[g][E]===null)this.state[g][E]={};else for(const L of Object.keys(this.deletedStates[g][E]))delete this.state[g][E][L];v[E]=this.state[g][E]}d[g]=d[g]||{},Ve(d[g],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in n)n[g].setFeatureState(d,o)}}class AC{constructor(n){this.size=n,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(n,o){const d=this.toIdx(n,o);return{min:this.minimums[d],max:this.maximums[d]}}isLeaf(n,o){return this.leaves[this.toIdx(n,o)]}toIdx(n,o){return o*this.size+n}}function dC(s,n,o,d){let g=0,v=Number.MAX_VALUE;for(let E=0;E<3;E++)if(Math.abs(d[E])<1e-15){if(o[E]<s[E]||o[E]>n[E])return null}else{const L=1/d[E];let k=(s[E]-o[E])*L,V=(n[E]-o[E])*L;if(k>V){const q=k;k=V,V=q}if(k>g&&(g=k),V<v&&(v=V),g>v)return null}return g}function pC(s,n,o,d,g,v,E,L,k,V,q){const se=d-s,he=g-n,_e=v-o,be=E-s,De=L-n,Ze=k-o,xt=q[1]*Ze-q[2]*De,Dt=q[2]*be-q[0]*Ze,_t=q[0]*De-q[1]*be,Tt=se*xt+he*Dt+_e*_t;if(Math.abs(Tt)<1e-15)return null;const kt=1/Tt,Ut=V[0]-s,ci=V[1]-n,ai=V[2]-o,Ti=(Ut*xt+ci*Dt+ai*_t)*kt;if(Ti<0||Ti>1)return null;const Ki=ci*_e-ai*he,_i=ai*se-Ut*_e,Si=Ut*he-ci*se,Li=(q[0]*Ki+q[1]*_i+q[2]*Si)*kt;return Li<0||Ti+Li>1?null:(be*Ki+De*_i+Ze*Si)*kt}function fC(s,n,o){return(s-n)/(o-n)}function mC(s,n,o,d,g,v,E,L,k){const V=1<<o,q=v-d,se=E-g,he=(s+1)/V*q+d,_e=(n+0)/V*se+g,be=(n+1)/V*se+g;L[0]=(s+0)/V*q+d,L[1]=_e,k[0]=he,k[1]=be}class gC{constructor(n){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=n,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const o=function(v){const E=Math.ceil(Math.log2(v.dim/8)),L=[];let k=Math.ceil(Math.pow(2,E));const V=1/k,q=(_e,be,De,Ze,xt)=>{const Dt=Ze?1:0,_t=(_e+1)*De-Dt,Tt=be*De,kt=(be+1)*De-Dt;xt[0]=_e*De,xt[1]=Tt,xt[2]=_t,xt[3]=kt};let se=new AC(k);const he=[];for(let _e=0;_e<k*k;_e++){q(_e%k,Math.floor(_e/k),V,!1,he);const be=Ud(he[0],he[1],v),De=Ud(he[2],he[1],v),Ze=Ud(he[2],he[3],v),xt=Ud(he[0],he[3],v);se.minimums.push(Math.min(be,De,Ze,xt)),se.maximums.push(Math.max(be,De,Ze,xt)),se.leaves.push(1)}for(L.push(se),k/=2;k>=1;k/=2){const _e=L[L.length-1];se=new AC(k);for(let be=0;be<k*k;be++){q(be%k,Math.floor(be/k),2,!0,he);const De=_e.getElevation(he[0],he[1]),Ze=_e.getElevation(he[2],he[1]),xt=_e.getElevation(he[2],he[3]),Dt=_e.getElevation(he[0],he[3]),_t=_e.isLeaf(he[0],he[1]),Tt=_e.isLeaf(he[2],he[1]),kt=_e.isLeaf(he[2],he[3]),Ut=_e.isLeaf(he[0],he[3]),ci=Math.min(De.min,Ze.min,xt.min,Dt.min),ai=Math.max(De.max,Ze.max,xt.max,Dt.max),Ti=_t&&Tt&&kt&&Ut;se.maximums.push(ai),se.minimums.push(ci),se.leaves.push(ai-ci<=5&&Ti?1:0)}L.push(se)}return L}(this.dem),d=o.length-1,g=o[d];this._addNode(g.minimums[0],g.maximums[0],g.leaves[0]),this._construct(o,0,0,d,0)}raycastRoot(n,o,d,g,v,E,L=1){return dC([n,o,-100],[d,g,this.maximums[0]*L],v,E)}raycast(n,o,d,g,v,E,L=1){if(!this.nodeCount)return null;const k=this.raycastRoot(n,o,d,g,v,E,L);if(k==null)return null;const V=[],q=[],se=[],he=[],_e=[{idx:0,t:k,nodex:0,nodey:0,depth:0}];for(;_e.length>0;){const{idx:be,t:De,nodex:Ze,nodey:xt,depth:Dt}=_e.pop();if(this.leaves[be]){mC(Ze,xt,Dt,n,o,d,g,se,he);const Tt=1<<Dt,kt=(Ze+0)/Tt,Ut=(Ze+1)/Tt,ci=(xt+0)/Tt,ai=(xt+1)/Tt,Ti=Ud(kt,ci,this.dem)*L,Ki=Ud(Ut,ci,this.dem)*L,_i=Ud(Ut,ai,this.dem)*L,Si=Ud(kt,ai,this.dem)*L,Li=pC(se[0],se[1],Ti,he[0],se[1],Ki,he[0],he[1],_i,v,E),Vi=pC(he[0],he[1],_i,se[0],he[1],Si,se[0],se[1],Ti,v,E),Zi=Math.min(Li!==null?Li:Number.MAX_VALUE,Vi!==null?Vi:Number.MAX_VALUE);if(Zi!==Number.MAX_VALUE)return Zi;{const yi=eu([],v,E,De);if(_C(Ti,Ki,Si,_i,fC(yi[0],se[0],he[0]),fC(yi[1],se[1],he[1]))>=yi[2])return De}continue}let _t=0;for(let Tt=0;Tt<this._siblingOffset.length;Tt++){mC((Ze<<1)+this._siblingOffset[Tt][0],(xt<<1)+this._siblingOffset[Tt][1],Dt+1,n,o,d,g,se,he),se[2]=-100,he[2]=this.maximums[this.childOffsets[be]+Tt]*L;const kt=dC(se,he,v,E);if(kt!=null){const Ut=kt;V[Tt]=Ut;let ci=!1;for(let ai=0;ai<_t&&!ci;ai++)Ut>=V[q[ai]]&&(q.splice(ai,0,Tt),ci=!0);ci||(q[_t]=Tt),_t++}}for(let Tt=0;Tt<_t;Tt++){const kt=q[Tt];_e.push({idx:this.childOffsets[be]+kt,t:V[kt],nodex:(Ze<<1)+this._siblingOffset[kt][0],nodey:(xt<<1)+this._siblingOffset[kt][1],depth:Dt+1})}}return null}_addNode(n,o,d){return this.minimums.push(n),this.maximums.push(o),this.leaves.push(d),this.childOffsets.push(0),this.nodeCount++}_construct(n,o,d,g,v){if(n[g].isLeaf(o,d)===1)return;this.childOffsets[v]||(this.childOffsets[v]=this.nodeCount);const E=g-1,L=n[E];let k=0,V=0;for(let q=0;q<this._siblingOffset.length;q++){const se=2*o+this._siblingOffset[q][0],he=2*d+this._siblingOffset[q][1],_e=L.getElevation(se,he),be=L.isLeaf(se,he),De=this._addNode(_e.min,_e.max,be);be&&(k|=1<<q),V||(V=De)}for(let q=0;q<this._siblingOffset.length;q++)k&1<<q||this._construct(n,2*o+this._siblingOffset[q][0],2*d+this._siblingOffset[q][1],E,V+q)}}function _C(s,n,o,d,g,v){return gr(gr(s,o,v),gr(n,d,v),g)}function Ud(s,n,o){const d=o.dim,g=ye(s*d-.5,0,d-1),v=ye(n*d-.5,0,d-1),E=Math.floor(g),L=Math.floor(v),k=Math.min(E+1,d-1),V=Math.min(L+1,d-1);return _C(o.get(E,L),o.get(k,L),o.get(E,V),o.get(k,V),g-E,v-L)}const yC={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class T0{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(n,o,d,g=!1,v=!1){if(this.uid=n,o.height!==o.width)throw new RangeError("DEM tiles must be square");if(d&&d!=="mapbox"&&d!=="terrarium")return Ct(`"${d}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=o.height;const E=this.dim=o.height-2,L=new Uint32Array(o.data.buffer);if(this.pixels=new Uint8Array(o.data.buffer),this.encoding=d||"mapbox",this.borderReady=g,!g){for(let k=0;k<E;k++)L[this._idx(-1,k)]=L[this._idx(0,k)],L[this._idx(E,k)]=L[this._idx(E-1,k)],L[this._idx(k,-1)]=L[this._idx(k,0)],L[this._idx(k,E)]=L[this._idx(k,E-1)];L[this._idx(-1,-1)]=L[this._idx(0,0)],L[this._idx(E,-1)]=L[this._idx(E-1,0)],L[this._idx(-1,E)]=L[this._idx(0,E-1)],L[this._idx(E,E)]=L[this._idx(E-1,E-1)],v&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new gC(this)}get(n,o,d=!1){d&&(n=ye(n,-1,this.dim),o=ye(o,-1,this.dim));const g=4*this._idx(n,o);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}static getUnpackVector(n){return yC[n]}get unpackVector(){return yC[this.encoding]}_idx(n,o){if(n<-1||n>=this.dim+1||o<-1||o>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(o+1)*this.stride+(n+1)}_unpackMapbox(n,o,d){return(256*n*256+256*o+d)/10-1e4}_unpackTerrarium(n,o,d){return 256*n+o+d/256-32768}static pack(n,o){const d=[0,0,0,0],g=T0.getUnpackVector(o);let v=Math.floor((n+g[3])/g[2]);return d[2]=v%256,v=Math.floor(v/256),d[1]=v%256,v=Math.floor(v/256),d[0]=v,d}getPixels(){return new Xa({width:this.stride,height:this.stride},this.pixels)}backfillBorder(n,o,d){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let g=o*this.dim,v=o*this.dim+this.dim,E=d*this.dim,L=d*this.dim+this.dim;switch(o){case-1:g=v-1;break;case 1:v=g+1}switch(d){case-1:E=L-1;break;case 1:L=E+1}const k=-o*this.dim,V=-d*this.dim;for(let q=E;q<L;q++)for(let se=g;se<v;se++){const he=4*this._idx(se,q),_e=4*this._idx(se+k,q+V);this.pixels[he+0]=n.pixels[_e+0],this.pixels[he+1]=n.pixels[_e+1],this.pixels[he+2]=n.pixels[_e+2],this.pixels[he+3]=n.pixels[_e+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}zt(T0,"DEMData"),zt(gC,"DemMinMaxQuadTree",{omit:["dem"]});class D3{constructor(n,o){this.max=n,this.onRemove=o,this.reset()}reset(){for(const n in this.data)for(const o of this.data[n])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(n,o,d){const g=n.wrapped().key;this.data[g]===void 0&&(this.data[g]=[]);const v={value:o,timeout:void 0};if(d!==void 0&&(v.timeout=setTimeout(()=>{this.remove(n,v)},d)),this.data[g].push(v),this.order.push(g),this.order.length>this.max){const E=this._getAndRemoveByKey(this.order[0]);E&&this.onRemove(E)}return this}has(n){return n.wrapped().key in this.data}getAndRemove(n){return this.has(n)?this._getAndRemoveByKey(n.wrapped().key):null}_getAndRemoveByKey(n){const o=this.data[n].shift();return o.timeout&&clearTimeout(o.timeout),this.data[n].length===0&&delete this.data[n],this.order.splice(this.order.indexOf(n),1),o.value}getByKey(n){const o=this.data[n];return o?o[0].value:null}get(n){return this.has(n)?this.data[n.wrapped().key][0].value:null}remove(n,o){if(!this.has(n))return this;const d=n.wrapped().key,g=o===void 0?0:this.data[d].indexOf(o),v=this.data[d][g];return this.data[d].splice(g,1),v.timeout&&clearTimeout(v.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(v.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(n){for(this.max=n;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(n){const o=[];for(const d in this.data)for(const g of this.data[d])n(g.value)||o.push(g);for(const d of o)this.remove(d.value.tileID,d)}}class tm{constructor(n,o,d){this.func=n,this.mask=o,this.range=d}}tm.ReadOnly=!1,tm.ReadWrite=!0,tm.disabled=new tm(519,tm.ReadOnly,[0,1]);const V1=7680;class H1{constructor(n,o,d,g,v,E){this.test=n,this.ref=o,this.mask=d,this.fail=g,this.depthFail=v,this.pass=E}}H1.disabled=new H1({func:519,mask:0},0,0,V1,V1,V1);class Pu{constructor(n,o,d){this.blendFunction=n,this.blendColor=o,this.mask=d}}Pu.Replace=[1,0],Pu.disabled=new Pu(Pu.Replace,fs.transparent,[!1,!1,!1,!1]),Pu.unblended=new Pu(Pu.Replace,fs.transparent,[!0,!0,!0,!0]),Pu.alphaBlended=new Pu([1,771],fs.transparent,[!0,!0,!0,!0]);const G1=1029,W1=2305;class ru{constructor(n,o,d){this.enable=n,this.mode=o,this.frontFace=d}}ru.disabled=new ru(!1,G1,W1),ru.backCCW=new ru(!0,G1,W1),ru.backCW=new ru(!0,G1,2304),ru.frontCW=new ru(!0,1028,2304),ru.frontCCW=new ru(!0,1028,W1);class Rp extends yn{constructor(n,o,d){super(),this.id=n,this._onlySymbols=d,o.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new D3(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new L3,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(n){this.map=n,this._minTileCacheSize=this._minTileCacheSize===void 0&&n?n._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&n?n._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const n in this._tiles){const o=this._tiles[n];if(o.state!=="loaded"&&o.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const n=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,n&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(n,o){return n.isSymbolTile=this._onlySymbols,this._source.loadTile(n,o)}_unloadTile(n){if(this._source.unloadTile)return this._source.unloadTile(n,()=>{})}_abortTile(n){if(this._source.abortTile)return this._source.abortTile(n,()=>{})}serialize(){return this._source.serialize()}prepare(n){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const d=this._tiles[o];d.upload(n),d.prepare(this.map.style.imageManager)}}getIds(){return Ge(this._tiles).map(n=>n.tileID).sort(xC).map(n=>n.key)}getRenderableIds(n){const o=[];for(const d in this._tiles)this._isIdRenderable(+d,n)&&o.push(this._tiles[d]);return n?o.sort((d,g)=>{const v=d.tileID,E=g.tileID,L=new me(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),k=new me(E.canonical.x,E.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-E.overscaledZ||k.y-L.y||k.x-L.x}).map(d=>d.tileID.key):o.map(d=>d.tileID).sort(xC).map(d=>d.key)}hasRenderableParent(n){const o=this.findLoadedParent(n,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(n,o){return this._tiles[n]&&this._tiles[n].hasData()&&!this._coveredTiles[n]&&(o||!this._tiles[n].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const n in this._tiles)this._tiles[n].state!=="errored"&&this._reloadTile(+n,"reloading")}}_reloadTile(n,o){const d=this._tiles[n];d&&(d.state!=="loading"&&(d.state=o),this._loadTile(d,this._tileLoaded.bind(this,d,n,o)))}_tileLoaded(n,o,d,g){if(g)if(n.state="errored",g.status!==404)this._source.fire(new rr(g,{tile:n}));else if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const v=this.map.painter.terrain;this.update(this.transform,v.getScaledDemTileSize(),!0),v.resetTileLookupCache(this.id)}else this.update(this.transform);else n.timeAdded=wi.now(),d==="expired"&&(n.refreshedUponExpiration=!0),this._setTileReloadTimer(o,n),this._source.type==="raster-dem"&&n.dem&&this._backfillDEM(n),this._state.initializeTileState(n,this.map?this.map.painter:null),this._source.fire(new tn("data",{dataType:"source",tile:n,coord:n.tileID,sourceCacheId:this.id}))}_backfillDEM(n){const o=this.getRenderableIds();for(let g=0;g<o.length;g++){const v=o[g];if(n.neighboringTiles&&n.neighboringTiles[v]){const E=this.getTileByID(v);d(n,E),d(E,n)}}function d(g,v){if(!g.dem||g.dem.borderReady)return;g.needsHillshadePrepare=!0,g.needsDEMTextureUpload=!0;let E=v.tileID.canonical.x-g.tileID.canonical.x;const L=v.tileID.canonical.y-g.tileID.canonical.y,k=Math.pow(2,g.tileID.canonical.z),V=v.tileID.key;E===0&&L===0||Math.abs(L)>1||(Math.abs(E)>1&&(Math.abs(E+k)===1?E+=k:Math.abs(E-k)===1&&(E-=k)),v.dem&&g.dem&&(g.dem.backfillBorder(v.dem,E,L),g.neighboringTiles&&g.neighboringTiles[V]&&(g.neighboringTiles[V].backfilled=!0)))}}getTile(n){return this.getTileByID(n.key)}getTileByID(n){return this._tiles[n]}_retainLoadedChildren(n,o,d,g){for(const v in this._tiles){let E=this._tiles[v];if(g[v]||!E.hasData()||E.tileID.overscaledZ<=o||E.tileID.overscaledZ>d)continue;let L=E.tileID;for(;E&&E.tileID.overscaledZ>o+1;){const V=E.tileID.scaledTo(E.tileID.overscaledZ-1);E=this._tiles[V.key],E&&E.hasData()&&(L=V)}let k=L;for(;k.overscaledZ>o;)if(k=k.scaledTo(k.overscaledZ-1),n[k.key]){g[L.key]=L;break}}}findLoadedParent(n,o){if(n.key in this._loadedParentTiles){const d=this._loadedParentTiles[n.key];return d&&d.tileID.overscaledZ>=o?d:null}for(let d=n.overscaledZ-1;d>=o;d--){const g=n.scaledTo(d),v=this._getLoadedTile(g);if(v)return v}}_getLoadedTile(n){const o=this._tiles[n.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?n.wrapped().key:n.canonical.key)}updateCacheSize(n,o){o=o||this._source.tileSize;const d=Math.ceil(n.width/o)+1,g=Math.ceil(n.height/o)+1,v=Math.floor(d*g*5),E=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,v):v,L=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,E):E;this._cache.setMaxSize(L)}handleWrapJump(n){const o=Math.round((n-(this._prevLng===void 0?n:this._prevLng))/360);if(this._prevLng=n,o){const d={};for(const g in this._tiles){const v=this._tiles[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+o),d[v.tileID.key]=v}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(+g,this._tiles[g])}}update(n,o,d){if(this.transform=n,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!d)return;let g;this.updateCacheSize(n,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?g=n.getVisibleUnwrappedCoordinates(this._source.tileID).map(L=>new fn(L.canonical.z,L.wrap,L.canonical.z,L.canonical.x,L.canonical.y)):(g=n.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!d,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(g=g.filter(L=>this._source.hasTile(L)))):g=[];const v=this._updateRetainedTiles(g);if(vC(this._source.type)&&g.length!==0){const L={},k={},V=Object.keys(v);for(const se of V){const he=v[se],_e=this._tiles[se];if(!_e||_e.fadeEndTime&&_e.fadeEndTime<=wi.now())continue;const be=this.findLoadedParent(he,Math.max(he.overscaledZ-Rp.maxOverzooming,this._source.minzoom));be&&(this._addTile(be.tileID),L[be.tileID.key]=be.tileID),k[se]=he}const q=g[g.length-1].overscaledZ;for(const se in this._tiles){const he=this._tiles[se];if(v[se]||!he.hasData())continue;let _e=he.tileID;for(;_e.overscaledZ>q;){_e=_e.scaledTo(_e.overscaledZ-1);const be=this._tiles[_e.key];if(be&&be.hasData()&&k[_e.key]){v[se]=he.tileID;break}}}for(const se in L)v[se]||(this._coveredTiles[se]=!0,v[se]=L[se])}for(const L in v)this._tiles[L].clearFadeHold();const E=function(L,k){const V=[];for(const q in L)q in k||V.push(q);return V}(this._tiles,v);for(const L of E){const k=this._tiles[L];k.hasSymbolBuckets&&!k.holdingForFade()?k.setHoldDuration(this.map._fadeDuration):k.hasSymbolBuckets&&!k.symbolFadeFinished()||this._removeTile(+L)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const n in this._tiles)this._tiles[n].holdingForFade()&&this._removeTile(+n)}_updateRetainedTiles(n){const o={};if(n.length===0)return o;const d={},g=n.reduce((V,q)=>Math.min(V,q.overscaledZ),1/0),v=n[0].overscaledZ,E=Math.max(v-Rp.maxOverzooming,this._source.minzoom),L=Math.max(v+Rp.maxUnderzooming,this._source.minzoom),k={};for(const V of n){const q=this._addTile(V);o[V.key]=V,q.hasData()||g<this._source.maxzoom&&(k[V.key]=V)}this._retainLoadedChildren(k,g,L,o);for(const V of n){let q=this._tiles[V.key];if(q.hasData())continue;if(V.canonical.z>=this._source.maxzoom){const he=V.children(this._source.maxzoom)[0],_e=this.getTile(he);if(_e&&_e.hasData()){o[he.key]=he;continue}}else{const he=V.children(this._source.maxzoom);if(o[he[0].key]&&o[he[1].key]&&o[he[2].key]&&o[he[3].key])continue}let se=q.wasRequested();for(let he=V.overscaledZ-1;he>=E;--he){const _e=V.scaledTo(he);if(d[_e.key]||(d[_e.key]=!0,q=this.getTile(_e),!q&&se&&(q=this._addTile(_e)),q&&(o[_e.key]=_e,se=q.wasRequested(),q.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const n in this._tiles){const o=[];let d,g=this._tiles[n].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}o.push(g.key);const v=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;g=v}for(const v of o)this._loadedParentTiles[v]=d}}_addTile(n){let o=this._tiles[n.key];if(o)return o;o=this._cache.getAndRemove(n),o&&(this._setTileReloadTimer(n.key,o),o.tileID=n,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[n.key]&&(clearTimeout(this._cacheTimers[n.key]),delete this._cacheTimers[n.key],this._setTileReloadTimer(n.key,o)));const d=Boolean(o);if(!d){const g=this.map?this.map.painter:null;o=new Q1(n,this._source.tileSize*n.overscaleFactor(),this.transform.tileZoom,g,this._isRaster),this._loadTile(o,this._tileLoaded.bind(this,o,n.key,o.state))}return o?(o.uses++,this._tiles[n.key]=o,d||this._source.fire(new tn("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o):null}_setTileReloadTimer(n,o){n in this._timers&&(clearTimeout(this._timers[n]),delete this._timers[n]);const d=o.getExpiryTimeout();d&&(this._timers[n]=setTimeout(()=>{this._reloadTile(n,"expired"),delete this._timers[n]},d))}_removeTile(n){const o=this._tiles[n];o&&(o.uses--,delete this._tiles[n],this._timers[n]&&(clearTimeout(this._timers[n]),delete this._timers[n]),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const n in this._tiles)this._removeTile(+n);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(n,o,d){const g=[],v=this.transform;if(!v)return g;const E=v.projection.name==="globe",L=vc(v.center.lng);for(const k in this._tiles){const V=this._tiles[k];if(d&&V.clearQueryDebugViz(),V.holdingForFade())continue;let q;if(E){const se=V.tileID.canonical;if(se.z===0){const he=[Math.abs(ye(L,...$g(se,-1))-L),Math.abs(ye(L,...$g(se,1))-L)];q=[0,2*he.indexOf(Math.min(...he))-1]}else{const he=[Math.abs(ye(L,...$g(se,-1))-L),Math.abs(ye(L,...$g(se,0))-L),Math.abs(ye(L,...$g(se,1))-L)];q=[he.indexOf(Math.min(...he))-1]}}else q=[0];for(const se of q){const he=n.containsTile(V,v,o,se);he&&g.push(he)}}return g}getVisibleCoordinates(n){const o=this.getRenderableIds(n).map(d=>this._tiles[d].tileID);for(const d of o)d.projMatrix=this.transform.calculateProjMatrix(d.toUnwrapped());return o}hasTransition(){if(this._source.hasTransition())return!0;if(vC(this._source.type))for(const n in this._tiles){const o=this._tiles[n];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=wi.now())return!0}return!1}setFeatureState(n,o,d){this._state.updateState(n=n||"_geojsonTileLayer",o,d)}removeFeatureState(n,o,d){this._state.removeFeatureState(n=n||"_geojsonTileLayer",o,d)}getFeatureState(n,o){return this._state.getState(n=n||"_geojsonTileLayer",o)}setDependencies(n,o,d){const g=this._tiles[n];g&&g.setDependencies(o,d)}reloadTilesForDependencies(n,o){for(const d in this._tiles)this._tiles[d].hasDependency(n,o)&&this._reloadTile(+d,"reloading");this._cache.filter(d=>!d.hasDependency(n,o))}_preloadTiles(n,o){const d=new Map,g=Array.isArray(n)?n:[n],v=this.map.painter.terrain,E=this.usedForTerrain&&v?v.getScaledDemTileSize():this._source.tileSize;for(const L of g){const k=L.coveringTiles({tileSize:E,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const V of k)d.set(V.key,V);this.usedForTerrain&&L.updateElevation(!1)}Ne(Array.from(d.values()),(L,k)=>{const V=new Q1(L,this._source.tileSize*L.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(V,q=>{this._source.type==="raster-dem"&&V.dem&&this._backfillDEM(V),k(q,V)})},o)}}function xC(s,n){const o=Math.abs(2*s.wrap)-+(s.wrap<0),d=Math.abs(2*n.wrap)-+(n.wrap<0);return s.overscaledZ-n.overscaledZ||d-o||n.canonical.y-s.canonical.y||n.canonical.x-s.canonical.x}function vC(s){return s==="raster"||s==="image"||s==="video"||s==="custom"}function $g(s,n){const o=1<<s.z;return[s.x/o+n,(s.x+1)/o+n]}Rp.maxOverzooming=10,Rp.maxUnderzooming=3;class S0{constructor(n,o,d){this._demTile=n,this._dem=this._demTile.dem,this._scale=o,this._offset=d}static create(n,o,d){const g=d||n.findDEMTileFor(o);if(!g||!g.dem)return;const v=g.dem,E=g.tileID,L=1<<o.canonical.z-E.canonical.z;return new S0(g,g.tileSize/Zn/L,[(o.canonical.x/L-E.canonical.x)*v.dim,(o.canonical.y/L-E.canonical.y)*v.dim])}tileCoordToPixel(n,o){const d=o*this._scale+this._offset[1],g=Math.floor(n*this._scale+this._offset[0]),v=Math.floor(d);return new me(g,v)}getElevationAt(n,o,d,g){const v=n*this._scale+this._offset[0],E=o*this._scale+this._offset[1],L=Math.floor(v),k=Math.floor(E),V=this._dem;return g=!!g,d?gr(gr(V.get(L,k,g),V.get(L,k+1,g),E-k),gr(V.get(L+1,k,g),V.get(L+1,k+1,g),E-k),v-L):V.get(L,k,g)}getElevationAtPixel(n,o,d){return this._dem.get(n,o,!!d)}getMeterToDEM(n){return(1<<this._demTile.tileID.canonical.z)*Xl(1,n)*this._dem.stride}}class wC{constructor(n,o){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new Zt(Zn,16,0),this.featureIndexArray=new Iy,this.promoteId=o}insert(n,o,d,g,v,E=0){const L=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(d,g,v,E);const k=this.grid;for(let V=0;V<o.length;V++){const q=o[V],se=[1/0,1/0,-1/0,-1/0];for(let he=0;he<q.length;he++){const _e=q[he];se[0]=Math.min(se[0],_e.x),se[1]=Math.min(se[1],_e.y),se[2]=Math.max(se[2],_e.x),se[3]=Math.max(se[3],_e.y)}se[0]<Zn&&se[1]<Zn&&se[2]>=0&&se[3]>=0&&k.insert(L,se[0],se[1],se[2],se[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new f(new Fa(this.rawTileData)).layers,this.sourceLayerCoder=new aC(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const n in this.vtLayers)this.vtFeatures[n]=[]}return this.vtLayers}query(n,o,d,g){this.loadVTLayers();const v=n.params||{},E=uo(v.filter),L=n.tileResult,k=n.transform,V=L.bufferedTilespaceBounds,q=this.grid.query(V.min.x,V.min.y,V.max.x,V.max.y,(be,De,Ze,xt)=>Ad(L.bufferedTilespaceGeometry,be,De,Ze,xt));q.sort(P3);let se=null;k.elevation&&q.length>0&&(se=S0.create(k.elevation,this.tileID));const he={};let _e;for(let be=0;be<q.length;be++){const De=q[be];if(De===_e)continue;_e=De;const Ze=this.featureIndexArray.get(De);let xt=null;this.loadMatchingFeature(he,Ze,E,v.layers,v.availableImages,o,d,g,(Dt,_t,Tt,kt=0)=>(xt||(xt=Yh(Dt,this.tileID.canonical,n.tileTransform)),_t.queryIntersectsFeature(L,Dt,Tt,xt,this.z,n.transform,n.pixelPosMatrix,se,kt)))}return he}loadMatchingFeature(n,o,d,g,v,E,L,k,V){const{featureIndex:q,bucketIndex:se,sourceLayerIndex:he,layoutVertexArrayOffset:_e}=o,be=this.bucketLayerIDs[se];if(g&&!function(Dt,_t){for(let Tt=0;Tt<Dt.length;Tt++)if(_t.indexOf(Dt[Tt])>=0)return!0;return!1}(g,be))return;const De=this.sourceLayerCoder.decode(he),Ze=this.vtLayers[De].feature(q);if(d.needGeometry){const Dt=xA(Ze,!0);if(!d.filter(new qt(this.tileID.overscaledZ),Dt,this.tileID.canonical))return}else if(!d.filter(new qt(this.tileID.overscaledZ),Ze))return;const xt=this.getId(Ze,De);for(let Dt=0;Dt<be.length;Dt++){const _t=be[Dt];if(g&&g.indexOf(_t)<0)continue;const Tt=E[_t];if(!Tt)continue;let kt={};xt!==void 0&&k&&(kt=k.getState(Tt.sourceLayer||"_geojsonTileLayer",xt));const Ut=Ve({},L[_t]);Ut.paint=bC(Ut.paint,Tt.paint,Ze,kt,v),Ut.layout=bC(Ut.layout,Tt.layout,Ze,kt,v);const ci=!V||V(Ze,Tt,kt,_e);if(!ci)continue;const ai=new lC(Ze,this.z,this.x,this.y,xt);ai.layer=Ut;let Ti=n[_t];Ti===void 0&&(Ti=n[_t]=[]),Ti.push({featureIndex:q,feature:ai,intersectionZ:ci})}}lookupSymbolFeatures(n,o,d,g,v,E,L,k){const V={};this.loadVTLayers();const q=uo(v);for(const se of n)this.loadMatchingFeature(V,{bucketIndex:d,sourceLayerIndex:g,featureIndex:se,layoutVertexArrayOffset:0},q,E,L,k,o);return V}loadFeature(n){const{featureIndex:o,sourceLayerIndex:d}=n;this.loadVTLayers();const g=this.sourceLayerCoder.decode(d),v=this.vtFeatures[g];if(v[o])return v[o];const E=this.vtLayers[g].feature(o);return v[o]=E,E}hasLayer(n){for(const o of this.bucketLayerIDs)for(const d of o)if(n===d)return!0;return!1}getId(n,o){let d=n.id;if(this.promoteId){const g=typeof this.promoteId=="string"?this.promoteId:this.promoteId[o];g!=null&&(d=n.properties[g]),typeof d=="boolean"&&(d=Number(d))}return d}}function bC(s,n,o,d,g){return ut(s,(v,E)=>{const L=n instanceof $i?n.get(E):null;return L&&L.evaluate?L.evaluate(o,d,g):L})}function P3(s,n){return n-s}zt(wC,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class BC{constructor(n,o){this.width=n,this.height=o,this.nextRow=0,this.image=new Yl({width:n,height:o}),this.positions={},this.uploaded=!1}getDash(n,o){const d=this.getKey(n,o);return this.positions[d]}trim(){const n=this.width,o=this.height=et(this.nextRow);this.image.resize({width:n,height:o})}getKey(n,o){return n.join(",")+o}getDashRanges(n,o,d){const g=[];let v=n.length%2==1?-n[n.length-1]*d:0,E=n[0]*d,L=!0;g.push({left:v,right:E,isDash:L,zeroLength:n[0]===0});let k=n[0];for(let V=1;V<n.length;V++){L=!L;const q=n[V];v=k*d,k+=q,E=k*d,g.push({left:v,right:E,isDash:L,zeroLength:q===0})}return g}addRoundDash(n,o,d){const g=o/2;for(let v=-d;v<=d;v++){const E=this.width*(this.nextRow+d+v);let L=0,k=n[L];for(let V=0;V<this.width;V++){V/k.right>1&&(k=n[++L]);const q=Math.abs(V-k.left),se=Math.abs(V-k.right),he=Math.min(q,se);let _e;const be=v/d*(g+1);if(k.isDash){const De=g-Math.abs(be);_e=Math.sqrt(he*he+De*De)}else _e=g-Math.sqrt(he*he+be*be);this.image.data[E+V]=Math.max(0,Math.min(255,_e+128))}}}addRegularDash(n,o){for(let k=n.length-1;k>=0;--k){const V=n[k],q=n[k+1];V.zeroLength?n.splice(k,1):q&&q.isDash===V.isDash&&(q.left=V.left,n.splice(k,1))}const d=n[0],g=n[n.length-1];d.isDash===g.isDash&&(d.left=g.left-this.width,g.right=d.right+this.width);const v=this.width*this.nextRow;let E=0,L=n[E];for(let k=0;k<this.width;k++){k/L.right>1&&(L=n[++E]);const V=Math.abs(k-L.left),q=Math.abs(k-L.right),se=Math.min(V,q);this.image.data[v+k]=Math.max(0,Math.min(255,(L.isDash?se:-se)+o+128))}}addDash(n,o){const d=this.getKey(n,o);if(this.positions[d])return this.positions[d];const g=o==="round",v=g?7:0,E=2*v+1;if(this.nextRow+E>this.height)return Ct("LineAtlas out of space"),null;n.length===0&&n.push(1);let L=0;for(let q=0;q<n.length;q++)n[q]<0&&(Ct("Negative value is found in line dasharray, replacing values with 0"),n[q]=0),L+=n[q];if(L!==0){const q=this.width/L,se=this.getDashRanges(n,this.width,q);g?this.addRoundDash(se,q,v):this.addRegularDash(se,o==="square"?.5*q:0)}const k=this.nextRow+v;this.nextRow+=E;const V={tl:[k,v],br:[L,0]};return this.positions[d]=V,V}}zt(BC,"LineAtlas");class CC{constructor(n){const o={},d=[];for(const L in n){const k=n[L],V=o[L]={};for(const q in k.glyphs){const se=k.glyphs[+q];if(!se||se.bitmap.width===0||se.bitmap.height===0)continue;const he=se.metrics.localGlyph?2:1,_e={x:0,y:0,w:se.bitmap.width+2*he,h:se.bitmap.height+2*he};d.push(_e),V[q]=_e}}const{w:g,h:v}=Kf(d),E=new Yl({width:g||1,height:v||1});for(const L in n){const k=n[L];for(const V in k.glyphs){const q=k.glyphs[+V];if(!q||q.bitmap.width===0||q.bitmap.height===0)continue;const se=o[L][V],he=q.metrics.localGlyph?2:1;Yl.copy(q.bitmap,E,{x:0,y:0},{x:se.x+he,y:se.y+he},q.bitmap)}}this.image=E,this.positions=o}}zt(CC,"GlyphAtlas");class U3{constructor(n){this.tileID=new fn(n.tileID.overscaledZ,n.tileID.wrap,n.tileID.canonical.z,n.tileID.canonical.x,n.tileID.canonical.y),this.tileZoom=n.tileZoom,this.uid=n.uid,this.zoom=n.zoom,this.canonical=n.tileID.canonical,this.pixelRatio=n.pixelRatio,this.tileSize=n.tileSize,this.source=n.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=n.showCollisionBoxes,this.collectResourceTiming=!!n.collectResourceTiming,this.returnDependencies=!!n.returnDependencies,this.promoteId=n.promoteId,this.enableTerrain=!!n.enableTerrain,this.isSymbolTile=n.isSymbolTile,this.tileTransform=Up(n.tileID.canonical,n.projection),this.projection=n.projection}parse(n,o,d,g,v){this.status="parsing",this.data=n,this.collisionBoxArray=new og;const E=new aC(Object.keys(n.layers).sort()),L=new wC(this.tileID,this.promoteId);L.bucketLayerIDs=[];const k={},V=new BC(256,256),q={featureIndex:L,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:V,availableImages:d},se=o.familiesBySource[this.source];for(const kt in se){const Ut=n.layers[kt];if(!Ut)continue;let ci=!1,ai=!1;for(const _i of se[kt])_i[0].type==="symbol"?ci=!0:ai=!0;if(this.isSymbolTile===!0&&!ci||this.isSymbolTile===!1&&!ai)continue;Ut.version===1&&Ct(`Vector tile source "${this.source}" layer "${kt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ti=E.encode(kt),Ki=[];for(let _i=0;_i<Ut.length;_i++){const Si=Ut.feature(_i),Li=L.getId(Si,kt);Ki.push({feature:Si,id:Li,index:_i,sourceLayerIndex:Ti})}for(const _i of se[kt]){const Si=_i[0];this.isSymbolTile!==void 0&&Si.type==="symbol"!==this.isSymbolTile||Si.minzoom&&this.zoom<Math.floor(Si.minzoom)||Si.maxzoom&&this.zoom>=Si.maxzoom||Si.visibility!=="none"&&(j1(_i,this.zoom,d),(k[Si.id]=Si.createBucket({index:L.bucketLayerIDs.length,layers:_i,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ti,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:d})).populate(Ki,q,this.tileID.canonical,this.tileTransform),L.bucketLayerIDs.push(_i.map(Li=>Li.id)))}}let he,_e,be,De;V.trim();const Ze={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},xt=ut(q.glyphDependencies,kt=>Object.keys(kt).map(Number));Object.keys(xt).length?g.send("getGlyphs",{uid:this.uid,stacks:xt},(kt,Ut)=>{he||(he=kt,_e=Ut,Tt.call(this))},void 0,!1,Ze):_e={};const Dt=Object.keys(q.iconDependencies);Dt.length?g.send("getImages",{icons:Dt,source:this.source,tileID:this.tileID,type:"icons"},(kt,Ut)=>{he||(he=kt,be=Ut,Tt.call(this))},void 0,!1,Ze):be={};const _t=Object.keys(q.patternDependencies);function Tt(){if(he)return v(he);if(_e&&be&&De){const kt=new CC(_e),Ut=new Ec(be,De);for(const ci in k){const ai=k[ci];ai instanceof Ld?(j1(ai.layers,this.zoom,d),n3(ai,_e,kt.positions,be,Ut.iconPositions,this.showCollisionBoxes,d,this.tileID.canonical,this.tileZoom,this.projection)):ai.hasPattern&&(ai instanceof Vs||ai instanceof Fp||ai instanceof Ce)&&(j1(ai.layers,this.zoom,d),ai.addFeatures(q,this.tileID.canonical,Ut.patternPositions,d,this.tileTransform))}this.status="done",v(null,{buckets:Ge(k).filter(ci=>!ci.isEmpty()),featureIndex:L,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:kt.image,lineAtlas:V,imageAtlas:Ut,glyphMap:this.returnDependencies?_e:null,iconMap:this.returnDependencies?be:null,glyphPositions:this.returnDependencies?kt.positions:null})}}_t.length?g.send("getImages",{icons:_t,source:this.source,tileID:this.tileID,type:"patterns"},(kt,Ut)=>{he||(he=kt,De=Ut,Tt.call(this))},void 0,!1,Ze):De={},Tt.call(this)}}function j1(s,n,o){const d=new qt(n);for(const g of s)g.recalculate(d,o)}class EC{constructor(n){this.entries={},this.scheduler=n}request(n,o,d,g){const v=this.entries[n]=this.entries[n]||{callbacks:[]};if(v.result){const[E,L]=v.result;return this.scheduler?this.scheduler.add(()=>{g(E,L)},o):g(E,L),()=>{}}return v.callbacks.push(g),v.cancel||(v.cancel=d((E,L)=>{v.result=[E,L];for(const k of v.callbacks)this.scheduler?this.scheduler.add(()=>{k(E,L)},o):k(E,L);setTimeout(()=>delete this.entries[n],3e3)})),()=>{v.result||(v.callbacks=v.callbacks.filter(E=>E!==g),v.callbacks.length||(v.cancel(),delete this.entries[n]))}}}function TC(s,n,o){const d=JSON.stringify(s.request);return s.data&&(this.deduped.entries[d]={result:[null,s.data]}),this.deduped.request(d,{type:"parseTile",isSymbolTile:s.isSymbolTile,zoom:s.tileZoom},g=>{const v=Cn(s.request,(E,L,k,V)=>{E?g(E):L&&g(null,{vectorTile:o?void 0:new f(new Fa(L)),rawData:L,cacheControl:k,expires:V})});return()=>{v.cancel(),g()}},n)}i.ARRAY_TYPE=Sa,i.AUTH_ERR_MSG=vi,i.Aabb=Ko,i.Actor=class{constructor(s,n,o){this.target=s,this.parent=n,this.mapId=o,this.callbacks={},this.cancelCallbacks={},Be(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=mi()?s:C,this.scheduler=new I3}send(s,n,o,d,g=!1,v){const E=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(o.metadata=v,this.callbacks[E]=o);const L=wn(this.globalScope)?void 0:[];return this.target.postMessage({id:E,type:s,hasCallback:!!o,targetMapId:d,mustQueue:g,sourceMapId:this.mapId,data:bi(n,L)},L),{cancel:()=>{o&&delete this.callbacks[E],this.target.postMessage({id:E,type:"<cancel>",targetMapId:d,sourceMapId:this.mapId})}}}receive(s){const n=s.data,o=n.id;if(o&&(!n.targetMapId||this.mapId===n.targetMapId))if(n.type==="<cancel>"){const d=this.cancelCallbacks[o];delete this.cancelCallbacks[o],d&&d.cancel()}else if(n.mustQueue||mi()){const d=this.callbacks[o];this.cancelCallbacks[o]=this.scheduler.add(()=>this.processTask(o,n),d&&d.metadata||{type:"message"})}else this.processTask(o,n)}processTask(s,n){if(n.type==="<response>"){const o=this.callbacks[s];delete this.callbacks[s],o&&(n.error?o(Hi(n.error)):o(null,Hi(n.data)))}else{const o=wn(this.globalScope)?void 0:[],d=n.hasCallback?(v,E)=>{delete this.cancelCallbacks[s],this.target.postMessage({id:s,type:"<response>",sourceMapId:this.mapId,error:v?bi(v):null,data:bi(E,o)},o)}:v=>{},g=Hi(n.data);if(this.parent[n.type])this.parent[n.type](n.sourceMapId,g,d);else if(this.parent.getWorkerSource){const v=n.type.split(".");this.parent.getWorkerSource(n.sourceMapId,v[0],g.source)[v[1]](g,d)}else d(new Error(`Could not find function ${n.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.CanonicalTileID=Fi,i.Color=fs,i.ColorMode=Pu,i.CullFaceMode=ru,i.DEMData=T0,i.DataConstantProperty=Jt,i.DedupedRequest=EC,i.DepthMode=tm,i.EXTENT=Zn,i.Elevation=class{isDataAvailableAtPoint(s){const n=this._source();if(this.isUsingMockSource()||!n||s.y<0||s.y>1)return!1;const o=n.getSource().maxzoom,d=1<<o,g=Math.floor(s.x),v=Math.floor((s.x-g)*d),E=Math.floor(s.y*d),L=this.findDEMTileFor(new fn(o,g,o,v,E));return!(!L||!L.dem)}getAtPointOrZero(s,n=0){return this.getAtPoint(s,n)||0}getAtPoint(s,n,o=!0){if(this.isUsingMockSource())return null;n==null&&(n=null);const d=this._source();if(!d||s.y<0||s.y>1)return n;const g=d.getSource().maxzoom,v=1<<g,E=Math.floor(s.x),L=s.x-E,k=new fn(g,E,g,Math.floor(L*v),Math.floor(s.y*v)),V=this.findDEMTileFor(k);if(!V||!V.dem)return n;const q=V.dem,se=1<<V.tileID.canonical.z,he=(L*se-V.tileID.canonical.x)*q.dim,_e=(s.y*se-V.tileID.canonical.y)*q.dim,be=Math.floor(he),De=Math.floor(_e);return(o?this.exaggeration():1)*gr(gr(q.get(be,De),q.get(be,De+1),_e-De),gr(q.get(be+1,De),q.get(be+1,De+1),_e-De),he-be)}getAtTileOffset(s,n,o){const d=1<<s.canonical.z;return this.getAtPointOrZero(new ud(s.wrap+(s.canonical.x+n/Zn)/d,(s.canonical.y+o/Zn)/d))}getAtTileOffsetFunc(s,n,o,d){return g=>{const v=this.getAtTileOffset(s,g.x,g.y),E=d.upVector(s.canonical,g.x,g.y);return pa(E,E,v*d.upVectorScale(s.canonical,n,o).metersToTile),E}}getForTilePoints(s,n,o,d){if(this.isUsingMockSource())return!1;const g=S0.create(this,s,d);return!!g&&(n.forEach(v=>{v[2]=this.exaggeration()*g.getElevationAt(v[0],v[1],o)}),!0)}getMinMaxForTile(s){if(this.isUsingMockSource())return null;const n=this.findDEMTileFor(s);if(!n||!n.dem)return null;const o=n.dem.tree,d=n.tileID,g=1<<s.canonical.z-d.canonical.z;let v=s.canonical.x/g-d.canonical.x,E=s.canonical.y/g-d.canonical.y,L=0;for(let k=0;k<s.canonical.z-d.canonical.z&&!o.leaves[L];k++){v*=2,E*=2;const V=2*Math.floor(E)+Math.floor(v);L=o.childOffsets[L]+V,v%=1,E%=1}return{min:this.exaggeration()*o.minimums[L],max:this.exaggeration()*o.maximums[L]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(s,n,o){throw new Error("Pure virtual method called.")}pointCoordinate(s){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(s){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}},i.ErrorEvent=rr,i.EvaluationParameters=qt,i.Event=tn,i.Evented=yn,i.FillExtrusionBucket=Ce,i.Frustum=zf,i.FrustumCorners=Rf,i.GLOBE_METERS_TO_ECEF=L1,i.GLOBE_RADIUS=LA,i.GLOBE_SCALE_MATCH_LATITUDE=45,i.GLOBE_ZOOM_THRESHOLD_MAX=6,i.GLOBE_ZOOM_THRESHOLD_MIN=5,i.GlobeSharedBuffers=class{constructor(s){this._createGrid(s),this._createPoles(s)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const s of this._poleSegments)s.destroy();for(const s of this._gridSegments)s.destroy();if(this._wireframeIndexBuffer){this._wireframeIndexBuffer.destroy();for(const s of this._wireframeSegments)s.destroy()}}_createGrid(s){const n=new Or,o=new _o,d=65;for(let g=0;g<d;g++)for(let v=0;v<d;v++)n.emplaceBack(v,g);this._gridSegments=[];for(let g=0,v=0;g<qf.length;g++){const E=qf[g];for(let k=0;k<E;k++)for(let V=0;V<64;V++){const q=k*d+V;o.emplaceBack(q+1,q,q+d),o.emplaceBack(q+d,q+d+1,q+1)}const L=64*E*2;this._gridSegments.push(to.simpleSegment(0,v,(E+1)*d,L)),v+=L}this._gridBuffer=s.createVertexBuffer(n,Og.members),this._gridIndexBuffer=s.createIndexBuffer(o,!0)}_createPoles(s){const n=new _o;for(let g=0;g<=Xf;g++)n.emplaceBack(0,g+1,g+2);this._poleIndexBuffer=s.createIndexBuffer(n,!0);const o=new $h,d=new $h;this._poleSegments=[];for(let g=0,v=0;g<5;g++){const E=360/(1<<g);o.emplaceBack(0,-LA,0,.5,0),d.emplaceBack(0,-LA,0,.5,1);for(let L=0;L<=Xf;L++){const k=L/Xf,V=gr(0,E,k),[q,se,he]=Yf(h3,u3,V,LA);o.emplaceBack(q,se,he,k,0),d.emplaceBack(q,se,he,k,1)}this._poleSegments.push(to.simpleSegment(v,0,66,64)),v+=66}this._poleNorthVertexBuffer=s.createVertexBuffer(o,WB,!1),this._poleSouthVertexBuffer=s.createVertexBuffer(d,WB,!1)}getGridBuffers(s){return[this._gridBuffer,this._gridIndexBuffer,this._gridSegments[s]]}getPoleBuffers(s){return[this._poleNorthVertexBuffer,this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[s]]}getWirefameBuffers(s,n){if(!this._wireframeSegments){const o=new $a,d=Xf,g=d+1;this._wireframeSegments=[];for(let v=0,E=0;v<qf.length;v++){const L=qf[v];for(let V=0;V<L;V++)for(let q=0;q<d;q++){const se=V*g+q;o.emplaceBack(se,se+1),o.emplaceBack(se,se+g),o.emplaceBack(se,se+g+1)}const k=L*d*3;this._wireframeSegments.push(to.simpleSegment(0,E,(L+1)*g,k)),E+=k}this._wireframeIndexBuffer=s.createIndexBuffer(o)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[n]]}},i.GlyphManager=$f,i.ImagePosition=Xo,i.LivePerformanceUtils=tt,i.LngLat=Pr,i.LngLatBounds=wl,i.LocalGlyphMode=S1,i.MAX_MERCATOR_LATITUDE=Za,i.MercatorCoordinate=ud,i.ONE_EM=Jr,i.OverscaledTileID=fn,i.PerformanceMarkers=Re,i.Properties=Hn,i.RGBAImage=Xa,i.Ray=Uf,i.RequestManager=class{constructor(s,n,o){this._transformRequestFn=s,this._customAccessToken=n,this._silenceAuthErrors=!!o,this._createSkuToken()}_createSkuToken(){const s=function(){let n="";for(let o=0;o<10;o++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",le,n].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=s.token,this._skuTokenExpiresAt=s.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(s,n){return this._transformRequestFn&&this._transformRequestFn(s,n)||{url:s}}normalizeStyleURL(s,n){if(!Wi(s))return s;const o=kr(s);return o.path=`/styles/v1${o.path}`,this._makeAPIURL(o,this._customAccessToken||n)}normalizeGlyphsURL(s,n){if(!Wi(s))return s;const o=kr(s);return o.path=`/fonts/v1${o.path}`,this._makeAPIURL(o,this._customAccessToken||n)}normalizeSourceURL(s,n,o,d){if(!Wi(s))return s;const g=kr(s);return g.path=`/v4/${g.authority}.json`,g.params.push("secure"),o&&g.params.push(`language=${o}`),d&&g.params.push(`worldview=${d}`),this._makeAPIURL(g,this._customAccessToken||n)}normalizeSpriteURL(s,n,o,d){const g=kr(s);return Wi(s)?(g.path=`/styles/v1${g.path}/sprite${n}${o}`,this._makeAPIURL(g,this._customAccessToken||d)):(g.path+=`${n}${o}`,Qn(g))}normalizeTileURL(s,n,o){if(this._isSkuTokenExpired()&&this._createSkuToken(),s&&!Wi(s))return s;const d=kr(s);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||o&&d.authority!=="raster"&&o===512?"@2x":""}${R.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${N.RASTER_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${N.TILE_URL_VERSION}${d.path}`);const g=this._customAccessToken||function(v){for(const E of v){const L=E.match(/^access_token=(.*)$/);if(L)return L[1]}return null}(d.params)||N.ACCESS_TOKEN;return N.REQUIRE_ACCESS_TOKEN&&g&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,g)}canonicalizeTileURL(s,n){const o=kr(s);if(!o.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!o.path.match(/\.[\w]+$/))return s;let d="mapbox://";o.path.match(/^\/raster\/v1\//)?d+=`raster/${o.path.replace(`/${N.RASTER_URL_PREFIX}/`,"")}`:d+=`tiles/${o.path.replace(`/${N.TILE_URL_VERSION}/`,"")}`;let g=o.params;return n&&(g=g.filter(v=>!v.match(/^access_token=/))),g.length&&(d+=`?${g.join("&")}`),d}canonicalizeTileset(s,n){const o=!!n&&Wi(n),d=[];for(const g of s.tiles||[])Ui(g)?d.push(this.canonicalizeTileURL(g,o)):d.push(g);return d}_makeAPIURL(s,n){const o="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=kr(N.API_URL);if(s.protocol=d.protocol,s.authority=d.authority,s.protocol==="http"){const g=s.params.indexOf("secure");g>=0&&s.params.splice(g,1)}if(d.path!=="/"&&(s.path=`${d.path}${s.path}`),!N.REQUIRE_ACCESS_TOKEN)return Qn(s);if(n=n||N.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${o}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${o}`)}return s.params=s.params.filter(g=>g.indexOf("access_token")===-1),s.params.push(`access_token=${n||""}`),Qn(s)}},i.ResourceType=ii,i.SegmentVector=to,i.SourceCache=Rp,i.StencilMode=H1,i.StructArrayLayout1ui2=Xh,i.StructArrayLayout2f1f2i16=Io,i.StructArrayLayout2i4=Or,i.StructArrayLayout2ui4=$a,i.StructArrayLayout3f12=Ka,i.StructArrayLayout3ui6=_o,i.StructArrayLayout4i8=Qr,i.StructArrayLayout5f20=$h,i.Texture=Kg,i.Tile=Q1,i.Transitionable=Bi,i.Uniform1f=mA,i.Uniform1i=class extends oh{constructor(s){super(s),this.current=0}set(s,n,o){this.fetchUniformLocation(s,n)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}},i.Uniform2f=class extends oh{constructor(s){super(s),this.current=[0,0]}set(s,n,o){this.fetchUniformLocation(s,n)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}},i.Uniform3f=class extends oh{constructor(s){super(s),this.current=[0,0,0]}set(s,n,o){this.fetchUniformLocation(s,n)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}},i.Uniform4f=fp,i.UniformColor=cd,i.UniformMatrix2f=class extends oh{constructor(s){super(s),this.current=mp}set(s,n,o){if(this.fetchUniformLocation(s,n)){for(let d=0;d<4;d++)if(o[d]!==this.current[d]){this.current=o,this.gl.uniformMatrix2fv(this.location,!1,o);break}}}},i.UniformMatrix3f=class extends oh{constructor(s){super(s),this.current=Ry}set(s,n,o){if(this.fetchUniformLocation(s,n)){for(let d=0;d<9;d++)if(o[d]!==this.current[d]){this.current=o,this.gl.uniformMatrix3fv(this.location,!1,o);break}}}},i.UniformMatrix4f=class extends oh{constructor(s){super(s),this.current=Uy}set(s,n,o){if(this.fetchUniformLocation(s,n)){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(let d=1;d<16;d++)if(o[d]!==this.current[d]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}}}},i.UnwrappedTileID=Sn,i.ValidationError=An,i.VectorTileFeature=w,i.VectorTileWorkerSource=class extends yn{constructor(s,n,o,d,g){super(),this.actor=s,this.layerIndex=n,this.availableImages=o,this.loadVectorData=g||TC,this.loading={},this.loaded={},this.deduped=new EC(s.scheduler),this.isSpriteLoaded=d,this.scheduler=s.scheduler}loadTile(s,n){const o=s.uid,d=s&&s.request,g=d&&d.collectResourceTiming,v=this.loading[o]=new U3(s);v.abort=this.loadVectorData(s,(E,L)=>{const k=!this.loading[o];if(delete this.loading[o],k||E||!L)return v.status="done",k||(this.loaded[o]=v),n(E);const V=L.rawData,q={};L.expires&&(q.expires=L.expires),L.cacheControl&&(q.cacheControl=L.cacheControl),v.vectorTile=L.vectorTile||new f(new Fa(V));const se=()=>{v.parse(v.vectorTile,this.layerIndex,this.availableImages,this.actor,(he,_e)=>{if(he||!_e)return n(he);const be={};if(g){const De=pt(d);De.length>0&&(be.resourceTiming=JSON.parse(JSON.stringify(De)))}n(null,Ve({rawTileData:V.slice(0)},_e,q,be))})};this.isSpriteLoaded?se():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(se,{type:"parseTile",isSymbolTile:s.isSymbolTile,zoom:s.tileZoom}):se()}),this.loaded=this.loaded||{},this.loaded[o]=v})}reloadTile(s,n){const o=this.loaded,d=s.uid,g=this;if(o&&o[d]){const v=o[d];v.showCollisionBoxes=s.showCollisionBoxes,v.enableTerrain=!!s.enableTerrain,v.projection=s.projection,v.tileTransform=Up(s.tileID.canonical,s.projection);const E=(L,k)=>{const V=v.reloadCallback;V&&(delete v.reloadCallback,v.parse(v.vectorTile,g.layerIndex,this.availableImages,g.actor,V)),n(L,k)};v.status==="parsing"?v.reloadCallback=E:v.status==="done"&&(v.vectorTile?v.parse(v.vectorTile,this.layerIndex,this.availableImages,this.actor,E):E())}}abortTile(s,n){const o=s.uid,d=this.loading[o];d&&(d.abort&&d.abort(),delete this.loading[o]),n()}removeTile(s,n){const o=this.loaded,d=s.uid;o&&o[d]&&delete o[d],n()}},i.WritingMode=qo,i.add=Jh,i.addDynamicAttributes=B0,i.adjoint=function(s,n){var o=n[0],d=n[1],g=n[2],v=n[3],E=n[4],L=n[5],k=n[6],V=n[7],q=n[8];return s[0]=E*q-L*V,s[1]=g*V-d*q,s[2]=d*L-g*E,s[3]=L*k-v*q,s[4]=o*q-g*k,s[5]=g*v-o*L,s[6]=v*V-E*k,s[7]=d*k-o*V,s[8]=o*E-d*v,s},i.asyncAll=Ne,i.bezier=te,i.bindAll=Be,i.boundsAttributes=hC,i.bufferConvexPolygon=function(s,n){const o=[];for(let d=0;d<s.length;d++){const g=ze(d-1,-1,s.length-1),v=ze(d+1,-1,s.length-1),E=s[d],L=s[v],k=s[g].sub(E).unit(),V=L.sub(E).unit(),q=V.angleWithSep(k.x,k.y),se=k.add(V).unit().mult(-1*n/Math.sin(q/2));o.push(E.add(se))}return o},i.cacheEntryPossiblyAdded=function(s){at++,at>Ni&&(s.getActor().send("enforceCacheSizeLimit",ti),at=0)},i.calculateGlobeLabelMatrix=function(s,n){const{x:o,y:d}=s.point,g=qB(o,d,s.worldSize/s._pixelsPerMercatorPixel,0,0);return bA(g,g,U1(Fu(n)))},i.calculateGlobeMatrix=function(s){const{x:n,y:o}=s.point,{lng:d,lat:g}=s._center;return qB(n,o,s.worldSize,d,g)},i.calculateGlobeMercatorMatrix=function(s){const n=s.pixelsPerMeter,o=n/Xl(1,s.center.lat),d=ql(new Float64Array(16));return wp(d,d,[s.point.x,s.point.y,0]),BA(d,d,[o,o,n]),Float32Array.from(d)},i.circumferenceAtLatitude=Sf,i.clamp=ye,i.clearTileCache=function(s){if(!qi())return;const n=C.caches.delete(kn);s&&n.catch(s).then(()=>s())},i.clipLine=zB,i.clone=function(s){var n=new Sa(16);return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],n[9]=s[9],n[10]=s[10],n[11]=s[11],n[12]=s[12],n[13]=s[13],n[14]=s[14],n[15]=s[15],n},i.clone$1=Wt,i.collisionCircleLayout=fa,i.config=N,i.conjugate=function(s,n){return s[0]=-n[0],s[1]=-n[1],s[2]=-n[2],s[3]=n[3],s},i.create=function(){var s=new Sa(16);return Sa!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},i.create$1=hh,i.createExpression=Is,i.createLayout=_n,i.createStyleLayer=function(s){return s.type==="custom"?new E3(s):new S3[s.type](s)},i.cross=gd,i.degToRad=Ke,i.distance=function(s,n){return Math.hypot(n[0]-s[0],n[1]-s[1],n[2]-s[2])},i.div=function(s,n,o){return s[0]=n[0]/o[0],s[1]=n[1]/o[1],s[2]=n[2]/o[2],s},i.dot=Ma,i.earthRadius=Tf,i.ease=ce,i.easeCubicInOut=Ci,i.ecefToLatLng=function([s,n,o]){const d=Math.hypot(s,n,o),g=Math.atan2(s,o),v=.5*Math.PI-Math.acos(-n/d);return new Pr(Et(g),Et(v))},i.emitValidationErrors=Vt,i.endsWith=dt,i.enforceCacheSizeLimit=function(s){en(),yt&&yt.then(n=>{n.keys().then(o=>{for(let d=0;d<o.length-s;d++)n.delete(o[d])})})},i.evaluateSizeForFeature=$s,i.evaluateSizeForZoom=pr,i.evaluateVariableOffset=VB,i.evented=It,i.exactEquals=function(s,n){return s[0]===n[0]&&s[1]===n[1]&&s[2]===n[2]&&s[3]===n[3]},i.exactEquals$1=function(s,n){return s[0]===n[0]&&s[1]===n[1]&&s[2]===n[2]},i.exported=wi,i.exported$1=R,i.extend=Ve,i.extend$1=sr,i.fillExtrusionHeightLift=ri,i.filterObject=Qt,i.fromMat4=function(s,n){return s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[4],s[4]=n[5],s[5]=n[6],s[6]=n[8],s[7]=n[9],s[8]=n[10],s},i.fromQuat=function(s,n){var o=n[0],d=n[1],g=n[2],v=n[3],E=o+o,L=d+d,k=g+g,V=o*E,q=d*E,se=d*L,he=g*E,_e=g*L,be=g*k,De=v*E,Ze=v*L,xt=v*k;return s[0]=1-se-be,s[1]=q+xt,s[2]=he-Ze,s[3]=0,s[4]=q-xt,s[5]=1-V-be,s[6]=_e+De,s[7]=0,s[8]=he+Ze,s[9]=_e-De,s[10]=1-V-se,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},i.fromRotation=function(s,n){var o=Math.sin(n),d=Math.cos(n);return s[0]=d,s[1]=o,s[2]=0,s[3]=-o,s[4]=d,s[5]=0,s[6]=0,s[7]=0,s[8]=1,s},i.fromScaling=jy,i.furthestTileCorner=function(s){const n=Math.round((s+45+360)%360/90)%4;return oi[n]},i.getAABBPointSquareDist=function(s,n,o){let d=0;for(let g=0;g<2;++g){const v=o?o[g]:0;s[g]>v&&(d+=(s[g]-v)*(s[g]-v)),n[g]<v&&(d+=(v-n[g])*(v-n[g]))}return d},i.getAnchorAlignment=T1,i.getAnchorJustification=I1,i.getBounds=function(s){let n=1/0,o=1/0,d=-1/0,g=-1/0;for(const v of s)n=Math.min(n,v.x),o=Math.min(o,v.y),d=Math.max(d,v.x),g=Math.max(g,v.y);return{min:new me(n,o),max:new me(d,g)}},i.getColumn=Gn,i.getGridMatrix=function(s,n,o,d){const g=n.getNorth(),v=n.getSouth(),E=n.getWest(),L=n.getEast(),k=1<<s.z,V=L-E,q=g-v,se=V/Xf,he=-q/qf[o],_e=[0,se,0,he,0,0,g,E,0];if(s.z>0){const be=180/d;wA(_e,_e,[be/V+1,0,0,0,be/q+1,0,-.5*be/se,.5*be/he,1])}return _e[2]=k,_e[5]=s.x,_e[8]=s.y,_e},i.getImage=Ot,i.getJSON=function(s,n){return on(Ve(s,{type:"json"}),n)},i.getLatitudinalLod=function(s){const n=80.051129;s=ye(s,-80.051129,n)/n*90;const o=Math.pow(Math.abs(Math.sin(Ke(s))),3);return Math.round(o*(qf.length-1))},i.getMapSessionAPI=ne,i.getPerformanceMeasurement=pt,i.getProjection=sC,i.getRTLTextPluginStatus=Ht,i.getReferrer=Xi,i.getTilePoint=function(s,{x:n,y:o},d=0){return new me(((n-d)*s.scale-s.x)*Zn,(o*s.scale-s.y)*Zn)},i.getTileVec3=function(s,n,o=0){return fd(((n.x-o)*s.scale-s.x)*Zn,(n.y*s.scale-s.y)*Zn,Mf(n.z,n.y))},i.getVideo=function(s,n){const o=C.document.createElement("video");o.muted=!0,o.onloadstart=function(){n(null,o)};for(let d=0;d<s.length;d++){const g=C.document.createElement("source");Tn(s[d])||(o.crossOrigin="Anonymous"),g.src=s[d],o.appendChild(g)}return{cancel:()=>{}}},i.globeCenterToScreenPoint=function(s){const n=[0,0,0],o=ql(new Float64Array(16));return bA(o,s.pixelMatrix,s.globeMatrix),Qs(n,n,o),new me(n[0],n[1])},i.globeDenormalizeECEF=U1,i.globeECEFOrigin=function(s,n){const o=[0,0,0];return Qs(o,o,Vg(Fu(n.canonical))),Qs(o,o,s),o},i.globeNormalizeECEF=Vg,i.globePixelsToTileUnits=function(s,n){return Zn/(512*Math.pow(2,s))*y0(Fu(n))},i.globePoleMatrixForTile=function(s,n,o){const d=ql(new Float64Array(16)),g=(n/(1<<s)-.5)*Math.PI*2;return Lf(d,o.globeMatrix,g),Float32Array.from(d)},i.globeTileBounds=Fu,i.globeTiltAtLngLat=YB,i.globeToMercatorTransition=Jf,i.globeUseCustomAntiAliasing=function(s,n,o){const d=Jf(o.zoom),g=s.style.map._antialias,v=!!n.extStandardDerivatives,E=n.extStandardDerivativesForceOff||s.terrain&&s.terrain.exaggeration()>0;return d===0&&!g&&!E&&v},i.identity=ql,i.identity$1=Bg,i.invert=yg,i.isFullscreen=function(){return!!C.document.fullscreenElement||!!C.document.webkitFullscreenElement},i.isLngLatBehindGlobe=R1,i.isMapAuthenticated=function(s){return de.has(s)},i.isMapboxURL=Wi,i.isSafariWithAntialiasingBug=function(s){const n=s.navigator?s.navigator.userAgent:null;return!!wn(s)&&n&&(n.match("Version/15.4")||n.match("Version/15.5")||n.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},i.latFromMercatorY=Fo,i.latLngToECEF=Ng,i.len=Zy,i.length=pd,i.length$1=function(s){return Math.hypot(s[0],s[1],s[2],s[3])},i.lngFromMercatorX=bl,i.loadVectorTile=TC,i.makeRequest=on,i.mapValue=function(s,n,o,d,g){return ye((s-n)/(o-n)*(g-d)+d,d,g)},i.mercatorScale=If,i.mercatorXfromLng=vc,i.mercatorYfromLat=ch,i.mercatorZfromAltitude=Xl,i.mul=u1,i.mul$1=$y,i.multiply=bA,i.multiply$1=wA,i.multiply$2=wg,i.nextPowerOfTwo=et,i.normalize=so,i.normalize$1=Mu,i.normalize$2=Pf,i.number=gr,i.ortho=function(s,n,o,d,g,v,E){var L=1/(n-o),k=1/(d-g),V=1/(v-E);return s[0]=-2*L,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=-2*k,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=2*V,s[11]=0,s[12]=(n+o)*L,s[13]=(g+d)*k,s[14]=(E+v)*V,s[15]=1,s},i.pbf=Fa,i.perspective=function(s,n,o,d,g){var v,E=1/Math.tan(n/2);return s[0]=E/o,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=E,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=-1,s[12]=0,s[13]=0,s[15]=0,g!=null&&g!==1/0?(s[10]=(g+d)*(v=1/(d-g)),s[14]=2*g*d*v):(s[10]=-1,s[14]=-2*d),s},i.pick=function(s,n){const o={};for(let d=0;d<n.length;d++){const g=n[d];g in s&&(o[g]=s[g])}return o},i.plugin=si,i.pointGeometry=me,i.polesInViewport=function(s){const n=ql(new Float64Array(16));bA(n,s.pixelMatrix,s.globeMatrix);const o=[0,fh,0],d=[0,mh,0];return Qs(o,o,n),Qs(d,d,n),[o[0]>0&&o[0]<=s.width&&o[1]>0&&o[1]<=s.height&&!R1(s,new Pr(s.center.lat,90)),d[0]>0&&d[0]<=s.width&&d[1]>0&&d[1]<=s.height&&!R1(s,new Pr(s.center.lat,-90))]},i.polygonContainsPoint=vA,i.polygonIntersectsBox=Ad,i.polygonIntersectsPolygon=Vy,i.polygonizeBounds=function(s,n,o=0,d=!0){const g=new me(o,o),v=s.sub(g),E=n.add(g),L=[v,new me(E.x,v.y),E,new me(v.x,E.y)];return d&&L.push(v.clone()),L},i.posAttributes=Og,i.postMapLoadEvent=wt,i.postPerformanceEvent=j,i.postTurnstileEvent=Ue,i.potpack=Kf,i.prevPowerOfTwo=function(s){return s<=1?1:Math.pow(2,Math.floor(Math.log(s)/Math.LN2))},i.radToDeg=Et,i.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],i.registerForPluginStateChange=function(s){return s({pluginStatus:At,pluginURL:ht}),It.on("pluginStateChange",s),s},i.removeAuthState=function(s){de.delete(s)},i.renderColorRamp=Sg,i.resample=Oy,i.rotateX=xg,i.rotateX$1=uh,i.rotateY=Lf,i.rotateY$1=Cg,i.rotateZ=function(s,n,o){var d=Math.sin(o),g=Math.cos(o),v=n[0],E=n[1],L=n[2],k=n[3],V=n[4],q=n[5],se=n[6],he=n[7];return n!==s&&(s[8]=n[8],s[9]=n[9],s[10]=n[10],s[11]=n[11],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[0]=v*g+V*d,s[1]=E*g+q*d,s[2]=L*g+se*d,s[3]=k*g+he*d,s[4]=V*g-v*d,s[5]=q*g-E*d,s[6]=se*g-L*d,s[7]=he*g-k*d,s},i.rotateZ$1=function(s,n,o){o*=.5;var d=n[0],g=n[1],v=n[2],E=n[3],L=Math.sin(o),k=Math.cos(o);return s[0]=d*k+g*L,s[1]=g*k-d*L,s[2]=v*k+E*L,s[3]=E*k-v*L,s},i.scale=BA,i.scale$1=Df,i.scale$2=pa,i.scaleAndAdd=eu,i.set=function(s,n,o,d){return s[0]=n,s[1]=o,s[2]=d,s},i.setCacheLimits=function(s,n){ti=s,Ni=n},i.setColumn=function(s,n,o){s[4*n+0]=o[0],s[4*n+1]=o[1],s[4*n+2]=o[2],s[4*n+3]=o[3]},i.setRTLTextPlugin=function(s,n,o=!1){if(At===nt||At===lt||At===Xe)throw new Error("setRTLTextPlugin cannot be called multiple times.");ht=wi.resolveURL(s),At=nt,Ye=n,Pt(),o||hi()},i.smoothstep=xe,i.spec=Yt,i.squaredLength=function(s){var n=s[0],o=s[1],d=s[2];return n*n+o*o+d*d},i.storeAuthState=function(s,n){n?de.add(s):de.delete(s)},i.sub=wc,i.subtract=vg,i.symbolSize=Ya,i.tileAABB=function(s,n,o,d,g,v,E,L,k){if(k.name==="globe")return c3(s,n,new Fi(o,d,g));const V=Up({z:o,x:d,y:g},k);return new Ko([(v+V.x/V.scale)*n,n*(V.y/V.scale),E],[(v+V.x2/V.scale)*n,n*(V.y2/V.scale),L])},i.tileCornersToBounds=_0,i.tileTransform=Up,i.transformMat3=function(s,n,o){var d=n[0],g=n[1],v=n[2];return s[0]=d*o[0]+g*o[3]+v*o[6],s[1]=d*o[1]+g*o[4]+v*o[7],s[2]=d*o[2]+g*o[5]+v*o[8],s},i.transformMat4=Qs,i.transformMat4$1=TA,i.transformQuat=bg,i.transitionTileAABBinECEF=$B,i.translate=wp,i.transpose=function(s,n){if(s===n){var o=n[1],d=n[2],g=n[5];s[1]=n[3],s[2]=n[6],s[3]=o,s[5]=n[7],s[6]=d,s[7]=g}else s[0]=n[0],s[1]=n[3],s[2]=n[6],s[3]=n[1],s[4]=n[4],s[5]=n[7],s[6]=n[2],s[7]=n[5],s[8]=n[8];return s},i.triggerPluginCompletionEvent=Bt,i.uniqueId=Ie,i.updateGlobeVertexNormal=function(s,n,o,d,g){const v=5*n+2;s.float32[v+0]=o,s.float32[v+1]=d,s.float32[v+2]=g},i.validateCustomStyleLayer=function(s){const n=[],o=s.id;return o===void 0&&n.push({message:`layers.${o}: missing required property "id"`}),s.render===void 0&&n.push({message:`layers.${o}: missing required method "render"`}),s.renderingMode&&s.renderingMode!=="2d"&&s.renderingMode!=="3d"&&n.push({message:`layers.${o}: property "renderingMode" must be either "2d" or "3d"`}),n},i.validateFilter=s=>gt(us(s)),i.validateFog=s=>gt(ue(s)),i.validateLayer=s=>gt(h(s)),i.validateLight=s=>gt(K(s)),i.validateSource=s=>gt(F(s)),i.validateStyle=We,i.validateTerrain=s=>gt(oe(s)),i.values=Ge,i.vectorTile=Dp,i.version=D,i.warnOnce=Ct,i.window=C,i.wrap=ze}),p(["./shared"],function(i){function C(ot){if(typeof ot=="number"||typeof ot=="boolean"||typeof ot=="string"||ot==null)return JSON.stringify(ot);if(Array.isArray(ot)){let Ue="[";for(const ct of ot)Ue+=`${C(ct)},`;return`${Ue}]`}let Ee="{";for(const Ue of Object.keys(ot).sort())Ee+=`${Ue}:${C(ot[Ue])},`;return`${Ee}}`}function D(ot){let Ee="";for(const Ue of i.refProperties)Ee+=`/${C(ot[Ue])}`;return Ee}class U{constructor(Ee){this.keyCache={},Ee&&this.replace(Ee)}replace(Ee){this._layerConfigs={},this._layers={},this.update(Ee,[])}update(Ee,Ue){for(const wt of Ee)this._layerConfigs[wt.id]=wt,(this._layers[wt.id]=i.createStyleLayer(wt)).compileFilter(),this.keyCache[wt.id]&&delete this.keyCache[wt.id];for(const wt of Ue)delete this.keyCache[wt],delete this._layerConfigs[wt],delete this._layers[wt];this.familiesBySource={};const ct=function(wt,X){const j={};for(let ne=0;ne<wt.length;ne++){const de=X&&X[wt[ne].id]||D(wt[ne]);X&&(X[wt[ne].id]=de);let Re=j[de];Re||(Re=j[de]=[]),Re.push(wt[ne])}const ie=[];for(const ne in j)ie.push(j[ne]);return ie}(i.values(this._layerConfigs),this.keyCache);for(const wt of ct){const X=wt.map(tt=>this._layers[tt.id]),j=X[0];if(j.visibility==="none")continue;const ie=j.source||"";let ne=this.familiesBySource[ie];ne||(ne=this.familiesBySource[ie]={});const de=j.sourceLayer||"_geojsonTileLayer";let Re=ne[de];Re||(Re=ne[de]=[]),Re.push(X)}}}class N{loadTile(Ee,Ue){const{uid:ct,encoding:wt,rawImageData:X,padding:j,buildQuadTree:ie}=Ee,ne=i.window.ImageBitmap&&X instanceof i.window.ImageBitmap?this.getImageData(X,j):X;Ue(null,new i.DEMData(ct,ne,wt,j<1,ie))}getImageData(Ee,Ue){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(Ee.width,Ee.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=Ee.width,this.offscreenCanvas.height=Ee.height,this.offscreenCanvasContext.drawImage(Ee,0,0,Ee.width,Ee.height);const ct=this.offscreenCanvasContext.getImageData(-Ue,-Ue,Ee.width+2*Ue,Ee.height+2*Ue);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),ct}}var R=function ot(Ee,Ue){var ct,wt=Ee&&Ee.type;if(wt==="FeatureCollection")for(ct=0;ct<Ee.features.length;ct++)ot(Ee.features[ct],Ue);else if(wt==="GeometryCollection")for(ct=0;ct<Ee.geometries.length;ct++)ot(Ee.geometries[ct],Ue);else if(wt==="Feature")ot(Ee.geometry,Ue);else if(wt==="Polygon")G(Ee.coordinates,Ue);else if(wt==="MultiPolygon")for(ct=0;ct<Ee.coordinates.length;ct++)G(Ee.coordinates[ct],Ue);return Ee};function G(ot,Ee){if(ot.length!==0){J(ot[0],Ee);for(var Ue=1;Ue<ot.length;Ue++)J(ot[Ue],!Ee)}}function J(ot,Ee){for(var Ue=0,ct=0,wt=0,X=ot.length,j=X-1;wt<X;j=wt++){var ie=(ot[wt][0]-ot[j][0])*(ot[j][1]+ot[wt][1]),ne=Ue+ie;ct+=Math.abs(Ue)>=Math.abs(ie)?Ue-ne+ie:ie-ne+Ue,Ue=ne}Ue+ct>=0!=!!Ee&&ot.reverse()}const Y=i.VectorTileFeature.prototype.toGeoJSON;class B{constructor(Ee){this._feature=Ee,this.extent=i.EXTENT,this.type=Ee.type,this.properties=Ee.tags,"id"in Ee&&!isNaN(Ee.id)&&(this.id=parseInt(Ee.id,10))}loadGeometry(){if(this._feature.type===1){const Ee=[];for(const Ue of this._feature.geometry)Ee.push([new i.pointGeometry(Ue[0],Ue[1])]);return Ee}{const Ee=[];for(const Ue of this._feature.geometry){const ct=[];for(const wt of Ue)ct.push(new i.pointGeometry(wt[0],wt[1]));Ee.push(ct)}return Ee}}toGeoJSON(Ee,Ue,ct){return Y.call(this,Ee,Ue,ct)}}class ae{constructor(Ee){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=Ee.length,this._features=Ee}feature(Ee){return new B(this._features[Ee])}}var le={exports:{}},Ae=i.pointGeometry,we=i.vectorTile.VectorTileFeature,me=Pe;function Pe(ot,Ee){this.options=Ee||{},this.features=ot,this.length=ot.length}function it(ot,Ee){this.id=typeof ot.id=="number"?ot.id:void 0,this.type=ot.type,this.rawGeometry=ot.type===1?[ot.geometry]:ot.geometry,this.properties=ot.tags,this.extent=Ee||4096}Pe.prototype.feature=function(ot){return new it(this.features[ot],this.options.extent)},it.prototype.loadGeometry=function(){var ot=this.rawGeometry;this.geometry=[];for(var Ee=0;Ee<ot.length;Ee++){for(var Ue=ot[Ee],ct=[],wt=0;wt<Ue.length;wt++)ct.push(new Ae(Ue[wt][0],Ue[wt][1]));this.geometry.push(ct)}return this.geometry},it.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var ot=this.geometry,Ee=1/0,Ue=-1/0,ct=1/0,wt=-1/0,X=0;X<ot.length;X++)for(var j=ot[X],ie=0;ie<j.length;ie++){var ne=j[ie];Ee=Math.min(Ee,ne.x),Ue=Math.max(Ue,ne.x),ct=Math.min(ct,ne.y),wt=Math.max(wt,ne.y)}return[Ee,ct,Ue,wt]},it.prototype.toGeoJSON=we.prototype.toGeoJSON;var Me=i.pbf,Ke=me;function Et(ot){var Ee=new Me;return function(Ue,ct){for(var wt in Ue.layers)ct.writeMessage(3,oi,Ue.layers[wt])}(ot,Ee),Ee.finish()}function oi(ot,Ee){var Ue;Ee.writeVarintField(15,ot.version||1),Ee.writeStringField(1,ot.name||""),Ee.writeVarintField(5,ot.extent||4096);var ct={keys:[],values:[],keycache:{},valuecache:{}};for(Ue=0;Ue<ot.length;Ue++)ct.feature=ot.feature(Ue),Ee.writeMessage(2,Ci,ct);var wt=ct.keys;for(Ue=0;Ue<wt.length;Ue++)Ee.writeStringField(3,wt[Ue]);var X=ct.values;for(Ue=0;Ue<X.length;Ue++)Ee.writeMessage(4,ze,X[Ue])}function Ci(ot,Ee){var Ue=ot.feature;Ue.id!==void 0&&Ee.writeVarintField(1,Ue.id),Ee.writeMessage(2,te,ot),Ee.writeVarintField(3,Ue.type),Ee.writeMessage(4,xe,Ue)}function te(ot,Ee){var Ue=ot.feature,ct=ot.keys,wt=ot.values,X=ot.keycache,j=ot.valuecache;for(var ie in Ue.properties){var ne=Ue.properties[ie],de=X[ie];if(ne!==null){de===void 0&&(ct.push(ie),X[ie]=de=ct.length-1),Ee.writeVarint(de);var Re=typeof ne;Re!=="string"&&Re!=="boolean"&&Re!=="number"&&(ne=JSON.stringify(ne));var tt=Re+":"+ne,He=j[tt];He===void 0&&(wt.push(ne),j[tt]=He=wt.length-1),Ee.writeVarint(He)}}}function ce(ot,Ee){return(Ee<<3)+(7&ot)}function ye(ot){return ot<<1^ot>>31}function xe(ot,Ee){for(var Ue=ot.loadGeometry(),ct=ot.type,wt=0,X=0,j=Ue.length,ie=0;ie<j;ie++){var ne=Ue[ie],de=1;ct===1&&(de=ne.length),Ee.writeVarint(ce(1,de));for(var Re=ct===3?ne.length-1:ne.length,tt=0;tt<Re;tt++){tt===1&&ct!==1&&Ee.writeVarint(ce(2,Re-1));var He=ne[tt].x-wt,Je=ne[tt].y-X;Ee.writeVarint(ye(He)),Ee.writeVarint(ye(Je)),wt+=He,X+=Je}ct===3&&Ee.writeVarint(ce(7,1))}}function ze(ot,Ee){var Ue=typeof ot;Ue==="string"?Ee.writeStringField(1,ot):Ue==="boolean"?Ee.writeBooleanField(7,ot):Ue==="number"&&(ot%1!=0?Ee.writeDoubleField(3,ot):ot<0?Ee.writeSVarintField(6,ot):Ee.writeVarintField(5,ot))}function Ne(ot,Ee,Ue,ct,wt,X){if(wt-ct<=Ue)return;const j=ct+wt>>1;Ge(ot,Ee,j,ct,wt,X%2),Ne(ot,Ee,Ue,ct,j-1,X+1),Ne(ot,Ee,Ue,j+1,wt,X+1)}function Ge(ot,Ee,Ue,ct,wt,X){for(;wt>ct;){if(wt-ct>600){const de=wt-ct+1,Re=Ue-ct+1,tt=Math.log(de),He=.5*Math.exp(2*tt/3),Je=.5*Math.sqrt(tt*He*(de-He)/de)*(Re-de/2<0?-1:1);Ge(ot,Ee,Ue,Math.max(ct,Math.floor(Ue-Re*He/de+Je)),Math.min(wt,Math.floor(Ue+(de-Re)*He/de+Je)),X)}const j=Ee[2*Ue+X];let ie=ct,ne=wt;for(Ve(ot,Ee,ct,Ue),Ee[2*wt+X]>j&&Ve(ot,Ee,ct,wt);ie<ne;){for(Ve(ot,Ee,ie,ne),ie++,ne--;Ee[2*ie+X]<j;)ie++;for(;Ee[2*ne+X]>j;)ne--}Ee[2*ct+X]===j?Ve(ot,Ee,ct,ne):(ne++,Ve(ot,Ee,ne,wt)),ne<=Ue&&(ct=ne+1),Ue<=ne&&(wt=ne-1)}}function Ve(ot,Ee,Ue,ct){Le(ot,Ue,ct),Le(Ee,2*Ue,2*ct),Le(Ee,2*Ue+1,2*ct+1)}function Le(ot,Ee,Ue){const ct=ot[Ee];ot[Ee]=ot[Ue],ot[Ue]=ct}function Ie(ot,Ee,Ue,ct){const wt=ot-Ue,X=Ee-ct;return wt*wt+X*X}le.exports=Et,le.exports.fromVectorTileJs=Et,le.exports.fromGeojsonVt=function(ot,Ee){Ee=Ee||{};var Ue={};for(var ct in ot)Ue[ct]=new Ke(ot[ct].features,Ee),Ue[ct].name=ct,Ue[ct].version=Ee.version,Ue[ct].extent=Ee.extent;return Et({layers:Ue})},le.exports.GeoJSONWrapper=Ke;const qe=ot=>ot[0],et=ot=>ot[1];class vt{constructor(Ee,Ue=qe,ct=et,wt=64,X=Float64Array){this.nodeSize=wt,this.points=Ee;const j=Ee.length<65536?Uint16Array:Uint32Array,ie=this.ids=new j(Ee.length),ne=this.coords=new X(2*Ee.length);for(let de=0;de<Ee.length;de++)ie[de]=de,ne[2*de]=Ue(Ee[de]),ne[2*de+1]=ct(Ee[de]);Ne(ie,ne,wt,0,ie.length-1,0)}range(Ee,Ue,ct,wt){return function(X,j,ie,ne,de,Re,tt){const He=[0,X.length-1,0],Je=[];let pt,Lt;for(;He.length;){const jt=He.pop(),Gt=He.pop(),ki=He.pop();if(Gt-ki<=tt){for(let Yi=ki;Yi<=Gt;Yi++)pt=j[2*Yi],Lt=j[2*Yi+1],pt>=ie&&pt<=de&&Lt>=ne&&Lt<=Re&&Je.push(X[Yi]);continue}const wi=Math.floor((ki+Gt)/2);pt=j[2*wi],Lt=j[2*wi+1],pt>=ie&&pt<=de&&Lt>=ne&&Lt<=Re&&Je.push(X[wi]);const Oi=(jt+1)%2;(jt===0?ie<=pt:ne<=Lt)&&(He.push(ki),He.push(wi-1),He.push(Oi)),(jt===0?de>=pt:Re>=Lt)&&(He.push(wi+1),He.push(Gt),He.push(Oi))}return Je}(this.ids,this.coords,Ee,Ue,ct,wt,this.nodeSize)}within(Ee,Ue,ct){return function(wt,X,j,ie,ne,de){const Re=[0,wt.length-1,0],tt=[],He=ne*ne;for(;Re.length;){const Je=Re.pop(),pt=Re.pop(),Lt=Re.pop();if(pt-Lt<=de){for(let Oi=Lt;Oi<=pt;Oi++)Ie(X[2*Oi],X[2*Oi+1],j,ie)<=He&&tt.push(wt[Oi]);continue}const jt=Math.floor((Lt+pt)/2),Gt=X[2*jt],ki=X[2*jt+1];Ie(Gt,ki,j,ie)<=He&&tt.push(wt[jt]);const wi=(Je+1)%2;(Je===0?j-ne<=Gt:ie-ne<=ki)&&(Re.push(Lt),Re.push(jt-1),Re.push(wi)),(Je===0?j+ne>=Gt:ie+ne>=ki)&&(Re.push(jt+1),Re.push(pt),Re.push(wi))}return tt}(this.ids,this.coords,Ee,Ue,ct,this.nodeSize)}}const Be={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ot=>ot},dt=Math.fround||(ut=new Float32Array(1),ot=>(ut[0]=+ot,ut[0]));var ut;class Qt{constructor(Ee){this.options=Gi(Object.create(Be),Ee),this.trees=new Array(this.options.maxZoom+1)}load(Ee){const{log:Ue,minZoom:ct,maxZoom:wt,nodeSize:X}=this.options;Ue&&console.time("total time");const j=`prepare ${Ee.length} points`;Ue&&console.time(j),this.points=Ee;let ie=[];for(let ne=0;ne<Ee.length;ne++)Ee[ne].geometry&&ie.push(Nt(Ee[ne],ne));this.trees[wt+1]=new vt(ie,wn,Qi,X,Float32Array),Ue&&console.timeEnd(j);for(let ne=wt;ne>=ct;ne--){const de=+Date.now();ie=this._cluster(ie,ne),this.trees[ne]=new vt(ie,wn,Qi,X,Float32Array),Ue&&console.log("z%d: %d clusters in %dms",ne,ie.length,+Date.now()-de)}return Ue&&console.timeEnd("total time"),this}getClusters(Ee,Ue){let ct=((Ee[0]+180)%360+360)%360-180;const wt=Math.max(-90,Math.min(90,Ee[1]));let X=Ee[2]===180?180:((Ee[2]+180)%360+360)%360-180;const j=Math.max(-90,Math.min(90,Ee[3]));if(Ee[2]-Ee[0]>=360)ct=-180,X=180;else if(ct>X){const Re=this.getClusters([ct,wt,180,j],Ue),tt=this.getClusters([-180,wt,X,j],Ue);return Re.concat(tt)}const ie=this.trees[this._limitZoom(Ue)],ne=ie.range(Xt(ct),mi(j),Xt(X),mi(wt)),de=[];for(const Re of ne){const tt=ie.points[Re];de.push(tt.numPoints?Ct(tt):this.points[tt.index])}return de}getChildren(Ee){const Ue=this._getOriginId(Ee),ct=this._getOriginZoom(Ee),wt="No cluster with the specified id.",X=this.trees[ct];if(!X)throw new Error(wt);const j=X.points[Ue];if(!j)throw new Error(wt);const ie=this.options.radius/(this.options.extent*Math.pow(2,ct-1)),ne=X.within(j.x,j.y,ie),de=[];for(const Re of ne){const tt=X.points[Re];tt.parentId===Ee&&de.push(tt.numPoints?Ct(tt):this.points[tt.index])}if(de.length===0)throw new Error(wt);return de}getLeaves(Ee,Ue,ct){const wt=[];return this._appendLeaves(wt,Ee,Ue=Ue||10,ct=ct||0,0),wt}getTile(Ee,Ue,ct){const wt=this.trees[this._limitZoom(Ee)],X=Math.pow(2,Ee),{extent:j,radius:ie}=this.options,ne=ie/j,de=(ct-ne)/X,Re=(ct+1+ne)/X,tt={features:[]};return this._addTileFeatures(wt.range((Ue-ne)/X,de,(Ue+1+ne)/X,Re),wt.points,Ue,ct,X,tt),Ue===0&&this._addTileFeatures(wt.range(1-ne/X,de,1,Re),wt.points,X,ct,X,tt),Ue===X-1&&this._addTileFeatures(wt.range(0,de,ne/X,Re),wt.points,-1,ct,X,tt),tt.features.length?tt:null}getClusterExpansionZoom(Ee){let Ue=this._getOriginZoom(Ee)-1;for(;Ue<=this.options.maxZoom;){const ct=this.getChildren(Ee);if(Ue++,ct.length!==1)break;Ee=ct[0].properties.cluster_id}return Ue}_appendLeaves(Ee,Ue,ct,wt,X){const j=this.getChildren(Ue);for(const ie of j){const ne=ie.properties;if(ne&&ne.cluster?X+ne.point_count<=wt?X+=ne.point_count:X=this._appendLeaves(Ee,ne.cluster_id,ct,wt,X):X<wt?X++:Ee.push(ie),Ee.length===ct)break}return X}_addTileFeatures(Ee,Ue,ct,wt,X,j){for(const ie of Ee){const ne=Ue[ie],de=ne.numPoints;let Re,tt,He;if(de)Re=Ft(ne),tt=ne.x,He=ne.y;else{const Lt=this.points[ne.index];Re=Lt.properties,tt=Xt(Lt.geometry.coordinates[0]),He=mi(Lt.geometry.coordinates[1])}const Je={type:1,geometry:[[Math.round(this.options.extent*(tt*X-ct)),Math.round(this.options.extent*(He*X-wt))]],tags:Re};let pt;de?pt=ne.id:this.options.generateId?pt=ne.index:this.points[ne.index].id&&(pt=this.points[ne.index].id),pt!==void 0&&(Je.id=pt),j.features.push(Je)}}_limitZoom(Ee){return Math.max(this.options.minZoom,Math.min(Math.floor(+Ee),this.options.maxZoom+1))}_cluster(Ee,Ue){const ct=[],{radius:wt,extent:X,reduce:j,minPoints:ie}=this.options,ne=wt/(X*Math.pow(2,Ue));for(let de=0;de<Ee.length;de++){const Re=Ee[de];if(Re.zoom<=Ue)continue;Re.zoom=Ue;const tt=this.trees[Ue+1],He=tt.within(Re.x,Re.y,ne),Je=Re.numPoints||1;let pt=Je;for(const Lt of He){const jt=tt.points[Lt];jt.zoom>Ue&&(pt+=jt.numPoints||1)}if(pt>Je&&pt>=ie){let Lt=Re.x*Je,jt=Re.y*Je,Gt=j&&Je>1?this._map(Re,!0):null;const ki=(de<<5)+(Ue+1)+this.points.length;for(const wi of He){const Oi=tt.points[wi];if(Oi.zoom<=Ue)continue;Oi.zoom=Ue;const Yi=Oi.numPoints||1;Lt+=Oi.x*Yi,jt+=Oi.y*Yi,Oi.parentId=ki,j&&(Gt||(Gt=this._map(Re,!0)),j(Gt,this._map(Oi)))}Re.parentId=ki,ct.push(Wt(Lt/pt,jt/pt,ki,pt,Gt))}else if(ct.push(Re),pt>1)for(const Lt of He){const jt=tt.points[Lt];jt.zoom<=Ue||(jt.zoom=Ue,ct.push(jt))}}return ct}_getOriginId(Ee){return Ee-this.points.length>>5}_getOriginZoom(Ee){return(Ee-this.points.length)%32}_map(Ee,Ue){if(Ee.numPoints)return Ue?Gi({},Ee.properties):Ee.properties;const ct=this.points[Ee.index].properties,wt=this.options.map(ct);return Ue&&wt===ct?Gi({},wt):wt}}function Wt(ot,Ee,Ue,ct,wt){return{x:dt(ot),y:dt(Ee),zoom:1/0,id:Ue,parentId:-1,numPoints:ct,properties:wt}}function Nt(ot,Ee){const[Ue,ct]=ot.geometry.coordinates;return{x:dt(Xt(Ue)),y:dt(mi(ct)),zoom:1/0,index:Ee,parentId:-1}}function Ct(ot){return{type:"Feature",id:ot.id,properties:Ft(ot),geometry:{type:"Point",coordinates:[(Ee=ot.x,360*(Ee-.5)),fi(ot.y)]}};var Ee}function Ft(ot){const Ee=ot.numPoints,Ue=Ee>=1e4?`${Math.round(Ee/1e3)}k`:Ee>=1e3?Math.round(Ee/100)/10+"k":Ee;return Gi(Gi({},ot.properties),{cluster:!0,cluster_id:ot.id,point_count:Ee,point_count_abbreviated:Ue})}function Xt(ot){return ot/360+.5}function mi(ot){const Ee=Math.sin(ot*Math.PI/180),Ue=.5-.25*Math.log((1+Ee)/(1-Ee))/Math.PI;return Ue<0?0:Ue>1?1:Ue}function fi(ot){const Ee=(180-360*ot)*Math.PI/180;return 360*Math.atan(Math.exp(Ee))/Math.PI-90}function Gi(ot,Ee){for(const Ue in Ee)ot[Ue]=Ee[Ue];return ot}function wn(ot){return ot.x}function Qi(ot){return ot.y}function Gn(ot,Ee,Ue,ct){for(var wt,X=ct,j=Ue-Ee>>1,ie=Ue-Ee,ne=ot[Ee],de=ot[Ee+1],Re=ot[Ue],tt=ot[Ue+1],He=Ee+3;He<Ue;He+=3){var Je=kn(ot[He],ot[He+1],ne,de,Re,tt);if(Je>X)wt=He,X=Je;else if(Je===X){var pt=Math.abs(He-j);pt<ie&&(wt=He,ie=pt)}}X>ct&&(wt-Ee>3&&Gn(ot,Ee,wt,ct),ot[wt+2]=X,Ue-wt>3&&Gn(ot,wt,Ue,ct))}function kn(ot,Ee,Ue,ct,wt,X){var j=wt-Ue,ie=X-ct;if(j!==0||ie!==0){var ne=((ot-Ue)*j+(Ee-ct)*ie)/(j*j+ie*ie);ne>1?(Ue=wt,ct=X):ne>0&&(Ue+=j*ne,ct+=ie*ne)}return(j=ot-Ue)*j+(ie=Ee-ct)*ie}function yt(ot,Ee,Ue,ct){var wt={id:ot===void 0?null:ot,type:Ee,geometry:Ue,tags:ct,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(X){var j=X.geometry,ie=X.type;if(ie==="Point"||ie==="MultiPoint"||ie==="LineString")st(X,j);else if(ie==="Polygon"||ie==="MultiLineString")for(var ne=0;ne<j.length;ne++)st(X,j[ne]);else if(ie==="MultiPolygon")for(ne=0;ne<j.length;ne++)for(var de=0;de<j[ne].length;de++)st(X,j[ne][de])}(wt),wt}function st(ot,Ee){for(var Ue=0;Ue<Ee.length;Ue+=3)ot.minX=Math.min(ot.minX,Ee[Ue]),ot.minY=Math.min(ot.minY,Ee[Ue+1]),ot.maxX=Math.max(ot.maxX,Ee[Ue]),ot.maxY=Math.max(ot.maxY,Ee[Ue+1])}function ti(ot,Ee,Ue,ct){if(Ee.geometry){var wt=Ee.geometry.coordinates,X=Ee.geometry.type,j=Math.pow(Ue.tolerance/((1<<Ue.maxZoom)*Ue.extent),2),ie=[],ne=Ee.id;if(Ue.promoteId?ne=Ee.properties[Ue.promoteId]:Ue.generateId&&(ne=ct||0),X==="Point")Ni(wt,ie);else if(X==="MultiPoint")for(var de=0;de<wt.length;de++)Ni(wt[de],ie);else if(X==="LineString")qi(wt,ie,j,!1);else if(X==="MultiLineString"){if(Ue.lineMetrics){for(de=0;de<wt.length;de++)qi(wt[de],ie=[],j,!1),ot.push(yt(ne,"LineString",ie,Ee.properties));return}en(wt,ie,j,!1)}else if(X==="Polygon")en(wt,ie,j,!0);else{if(X!=="MultiPolygon"){if(X==="GeometryCollection"){for(de=0;de<Ee.geometry.geometries.length;de++)ti(ot,{id:ne,geometry:Ee.geometry.geometries[de],properties:Ee.properties},Ue,ct);return}throw new Error("Input data is not a valid GeoJSON object.")}for(de=0;de<wt.length;de++){var Re=[];en(wt[de],Re,j,!0),ie.push(Re)}}ot.push(yt(ne,X,ie,Ee.properties))}}function Ni(ot,Ee){Ee.push($t(ot[0])),Ee.push(at(ot[1])),Ee.push(0)}function qi(ot,Ee,Ue,ct){for(var wt,X,j=0,ie=0;ie<ot.length;ie++){var ne=$t(ot[ie][0]),de=at(ot[ie][1]);Ee.push(ne),Ee.push(de),Ee.push(0),ie>0&&(j+=ct?(wt*de-ne*X)/2:Math.sqrt(Math.pow(ne-wt,2)+Math.pow(de-X,2))),wt=ne,X=de}var Re=Ee.length-3;Ee[2]=1,Gn(Ee,0,Re,Ue),Ee[Re+2]=1,Ee.size=Math.abs(j),Ee.start=0,Ee.end=Ee.size}function en(ot,Ee,Ue,ct){for(var wt=0;wt<ot.length;wt++){var X=[];qi(ot[wt],X,Ue,ct),Ee.push(X)}}function $t(ot){return ot/360+.5}function at(ot){var Ee=Math.sin(ot*Math.PI/180),Ue=.5-.25*Math.log((1+Ee)/(1-Ee))/Math.PI;return Ue<0?0:Ue>1?1:Ue}function ii(ot,Ee,Ue,ct,wt,X,j,ie){if(ct/=Ee,X>=(Ue/=Ee)&&j<ct)return ot;if(j<Ue||X>=ct)return null;for(var ne=[],de=0;de<ot.length;de++){var Re=ot[de],tt=Re.geometry,He=Re.type,Je=wt===0?Re.minX:Re.minY,pt=wt===0?Re.maxX:Re.maxY;if(Je>=Ue&&pt<ct)ne.push(Re);else if(!(pt<Ue||Je>=ct)){var Lt=[];if(He==="Point"||He==="MultiPoint")hn(tt,Lt,Ue,ct,wt);else if(He==="LineString")Xi(tt,Lt,Ue,ct,wt,!1,ie.lineMetrics);else if(He==="MultiLineString")Cn(tt,Lt,Ue,ct,wt,!1);else if(He==="Polygon")Cn(tt,Lt,Ue,ct,wt,!0);else if(He==="MultiPolygon")for(var jt=0;jt<tt.length;jt++){var Gt=[];Cn(tt[jt],Gt,Ue,ct,wt,!0),Gt.length&&Lt.push(Gt)}if(Lt.length){if(ie.lineMetrics&&He==="LineString"){for(jt=0;jt<Lt.length;jt++)ne.push(yt(Re.id,He,Lt[jt],Re.tags));continue}He!=="LineString"&&He!=="MultiLineString"||(Lt.length===1?(He="LineString",Lt=Lt[0]):He="MultiLineString"),He!=="Point"&&He!=="MultiPoint"||(He=Lt.length===3?"Point":"MultiPoint"),ne.push(yt(Re.id,He,Lt,Re.tags))}}}return ne.length?ne:null}function hn(ot,Ee,Ue,ct,wt){for(var X=0;X<ot.length;X+=3){var j=ot[X+wt];j>=Ue&&j<=ct&&(Ee.push(ot[X]),Ee.push(ot[X+1]),Ee.push(ot[X+2]))}}function Xi(ot,Ee,Ue,ct,wt,X,j){for(var ie,ne,de=on(ot),Re=wt===0?nr:Ii,tt=ot.start,He=0;He<ot.length-3;He+=3){var Je=ot[He],pt=ot[He+1],Lt=ot[He+2],jt=ot[He+3],Gt=ot[He+4],ki=wt===0?Je:pt,wi=wt===0?jt:Gt,Oi=!1;j&&(ie=Math.sqrt(Math.pow(Je-jt,2)+Math.pow(pt-Gt,2))),ki<Ue?wi>Ue&&(ne=Re(de,Je,pt,jt,Gt,Ue),j&&(de.start=tt+ie*ne)):ki>ct?wi<ct&&(ne=Re(de,Je,pt,jt,Gt,ct),j&&(de.start=tt+ie*ne)):Tn(de,Je,pt,Lt),wi<Ue&&ki>=Ue&&(ne=Re(de,Je,pt,jt,Gt,Ue),Oi=!0),wi>ct&&ki<=ct&&(ne=Re(de,Je,pt,jt,Gt,ct),Oi=!0),!X&&Oi&&(j&&(de.end=tt+ie*ne),Ee.push(de),de=on(ot)),j&&(tt+=ie)}var Yi=ot.length-3;Je=ot[Yi],pt=ot[Yi+1],Lt=ot[Yi+2],(ki=wt===0?Je:pt)>=Ue&&ki<=ct&&Tn(de,Je,pt,Lt),Yi=de.length-3,X&&Yi>=3&&(de[Yi]!==de[0]||de[Yi+1]!==de[1])&&Tn(de,de[0],de[1],de[2]),de.length&&Ee.push(de)}function on(ot){var Ee=[];return Ee.size=ot.size,Ee.start=ot.start,Ee.end=ot.end,Ee}function Cn(ot,Ee,Ue,ct,wt,X){for(var j=0;j<ot.length;j++)Xi(ot[j],Ee,Ue,ct,wt,X,!1)}function Tn(ot,Ee,Ue,ct){ot.push(Ee),ot.push(Ue),ot.push(ct)}function nr(ot,Ee,Ue,ct,wt,X){var j=(X-Ee)/(ct-Ee);return ot.push(X),ot.push(Ue+(wt-Ue)*j),ot.push(1),j}function Ii(ot,Ee,Ue,ct,wt,X){var j=(X-Ue)/(wt-Ue);return ot.push(Ee+(ct-Ee)*j),ot.push(X),ot.push(1),j}function bn(ot,Ee){for(var Ue=[],ct=0;ct<ot.length;ct++){var wt,X=ot[ct],j=X.type;if(j==="Point"||j==="MultiPoint"||j==="LineString")wt=Ot(X.geometry,Ee);else if(j==="MultiLineString"||j==="Polygon"){wt=[];for(var ie=0;ie<X.geometry.length;ie++)wt.push(Ot(X.geometry[ie],Ee))}else if(j==="MultiPolygon")for(wt=[],ie=0;ie<X.geometry.length;ie++){for(var ne=[],de=0;de<X.geometry[ie].length;de++)ne.push(Ot(X.geometry[ie][de],Ee));wt.push(ne)}Ue.push(yt(X.id,j,wt,X.tags))}return Ue}function Ot(ot,Ee){var Ue=[];Ue.size=ot.size,ot.start!==void 0&&(Ue.start=ot.start,Ue.end=ot.end);for(var ct=0;ct<ot.length;ct+=3)Ue.push(ot[ct]+Ee,ot[ct+1],ot[ct+2]);return Ue}function vi(ot,Ee){if(ot.transformed)return ot;var Ue,ct,wt,X=1<<ot.z,j=ot.x,ie=ot.y;for(Ue=0;Ue<ot.features.length;Ue++){var ne=ot.features[Ue],de=ne.geometry,Re=ne.type;if(ne.geometry=[],Re===1)for(ct=0;ct<de.length;ct+=2)ne.geometry.push(Wi(de[ct],de[ct+1],Ee,X,j,ie));else for(ct=0;ct<de.length;ct++){var tt=[];for(wt=0;wt<de[ct].length;wt+=2)tt.push(Wi(de[ct][wt],de[ct][wt+1],Ee,X,j,ie));ne.geometry.push(tt)}}return ot.transformed=!0,ot}function Wi(ot,Ee,Ue,ct,wt,X){return[Math.round(Ue*(ot*ct-wt)),Math.round(Ue*(Ee*ct-X))]}function Ui(ot,Ee,Ue,ct,wt){for(var X=Ee===wt.maxZoom?0:wt.tolerance/((1<<Ee)*wt.extent),j={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:Ue,y:ct,z:Ee,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},ie=0;ie<ot.length;ie++){j.numFeatures++,Pn(j,ot[ie],X,wt);var ne=ot[ie].minX,de=ot[ie].minY,Re=ot[ie].maxX,tt=ot[ie].maxY;ne<j.minX&&(j.minX=ne),de<j.minY&&(j.minY=de),Re>j.maxX&&(j.maxX=Re),tt>j.maxY&&(j.maxY=tt)}return j}function Pn(ot,Ee,Ue,ct){var wt=Ee.geometry,X=Ee.type,j=[];if(X==="Point"||X==="MultiPoint")for(var ie=0;ie<wt.length;ie+=3)j.push(wt[ie]),j.push(wt[ie+1]),ot.numPoints++,ot.numSimplified++;else if(X==="LineString")qn(j,wt,ot,Ue,!1,!1);else if(X==="MultiLineString"||X==="Polygon")for(ie=0;ie<wt.length;ie++)qn(j,wt[ie],ot,Ue,X==="Polygon",ie===0);else if(X==="MultiPolygon")for(var ne=0;ne<wt.length;ne++){var de=wt[ne];for(ie=0;ie<de.length;ie++)qn(j,de[ie],ot,Ue,!0,ie===0)}if(j.length){var Re=Ee.tags||null;if(X==="LineString"&&ct.lineMetrics){for(var tt in Re={},Ee.tags)Re[tt]=Ee.tags[tt];Re.mapbox_clip_start=wt.start/wt.size,Re.mapbox_clip_end=wt.end/wt.size}var He={geometry:j,type:X==="Polygon"||X==="MultiPolygon"?3:X==="LineString"||X==="MultiLineString"?2:1,tags:Re};Ee.id!==null&&(He.id=Ee.id),ot.features.push(He)}}function qn(ot,Ee,Ue,ct,wt,X){var j=ct*ct;if(ct>0&&Ee.size<(wt?j:ct))Ue.numPoints+=Ee.length/3;else{for(var ie=[],ne=0;ne<Ee.length;ne+=3)(ct===0||Ee[ne+2]>j)&&(Ue.numSimplified++,ie.push(Ee[ne]),ie.push(Ee[ne+1])),Ue.numPoints++;wt&&function(de,Re){for(var tt=0,He=0,Je=de.length,pt=Je-2;He<Je;pt=He,He+=2)tt+=(de[He]-de[pt])*(de[He+1]+de[pt+1]);if(tt>0===Re)for(He=0,Je=de.length;He<Je/2;He+=2){var Lt=de[He],jt=de[He+1];de[He]=de[Je-2-He],de[He+1]=de[Je-1-He],de[Je-2-He]=Lt,de[Je-1-He]=jt}}(ie,X),ot.push(ie)}}function Hr(ot,Ee){var Ue=(Ee=this.options=function(wt,X){for(var j in X)wt[j]=X[j];return wt}(Object.create(this.options),Ee)).debug;if(Ue&&console.time("preprocess data"),Ee.maxZoom<0||Ee.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Ee.promoteId&&Ee.generateId)throw new Error("promoteId and generateId cannot be used together.");var ct=function(wt,X){var j=[];if(wt.type==="FeatureCollection")for(var ie=0;ie<wt.features.length;ie++)ti(j,wt.features[ie],X,ie);else ti(j,wt.type==="Feature"?wt:{geometry:wt},X);return j}(ot,Ee);this.tiles={},this.tileCoords=[],Ue&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Ee.indexMaxZoom,Ee.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ct=function(wt,X){var j=X.buffer/X.extent,ie=wt,ne=ii(wt,1,-1-j,j,0,-1,2,X),de=ii(wt,1,1-j,2+j,0,-1,2,X);return(ne||de)&&(ie=ii(wt,1,-j,1+j,0,-1,2,X)||[],ne&&(ie=bn(ne,1).concat(ie)),de&&(ie=ie.concat(bn(de,-1)))),ie}(ct,Ee),ct.length&&this.splitTile(ct,0,0,0),Ue&&(ct.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function fr(ot,Ee,Ue){return 32*((1<<ot)*Ue+Ee)+ot}function kr(ot,Ee){const Ue=ot.tileID.canonical;if(!this._geoJSONIndex)return Ee(null,null);const ct=this._geoJSONIndex.getTile(Ue.z,Ue.x,Ue.y);if(!ct)return Ee(null,null);const wt=new ae(ct.features);let X=le.exports(wt);X.byteOffset===0&&X.byteLength===X.buffer.byteLength||(X=new Uint8Array(X)),Ee(null,{vectorTile:wt,rawData:X.buffer})}Hr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Hr.prototype.splitTile=function(ot,Ee,Ue,ct,wt,X,j){for(var ie=[ot,Ee,Ue,ct],ne=this.options,de=ne.debug;ie.length;){ct=ie.pop(),Ue=ie.pop(),Ee=ie.pop(),ot=ie.pop();var Re=1<<Ee,tt=fr(Ee,Ue,ct),He=this.tiles[tt];if(!He&&(de>1&&console.time("creation"),He=this.tiles[tt]=Ui(ot,Ee,Ue,ct,ne),this.tileCoords.push({z:Ee,x:Ue,y:ct}),de)){de>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Ee,Ue,ct,He.numFeatures,He.numPoints,He.numSimplified),console.timeEnd("creation"));var Je="z"+Ee;this.stats[Je]=(this.stats[Je]||0)+1,this.total++}if(He.source=ot,wt){if(Ee===ne.maxZoom||Ee===wt)continue;var pt=1<<wt-Ee;if(Ue!==Math.floor(X/pt)||ct!==Math.floor(j/pt))continue}else if(Ee===ne.indexMaxZoom||He.numPoints<=ne.indexMaxPoints)continue;if(He.source=null,ot.length!==0){de>1&&console.time("clipping");var Lt,jt,Gt,ki,wi,Oi,Yi=.5*ne.buffer/ne.extent,tn=.5-Yi,rr=.5+Yi,yn=1+Yi;Lt=jt=Gt=ki=null,wi=ii(ot,Re,Ue-Yi,Ue+rr,0,He.minX,He.maxX,ne),Oi=ii(ot,Re,Ue+tn,Ue+yn,0,He.minX,He.maxX,ne),ot=null,wi&&(Lt=ii(wi,Re,ct-Yi,ct+rr,1,He.minY,He.maxY,ne),jt=ii(wi,Re,ct+tn,ct+yn,1,He.minY,He.maxY,ne),wi=null),Oi&&(Gt=ii(Oi,Re,ct-Yi,ct+rr,1,He.minY,He.maxY,ne),ki=ii(Oi,Re,ct+tn,ct+yn,1,He.minY,He.maxY,ne),Oi=null),de>1&&console.timeEnd("clipping"),ie.push(Lt||[],Ee+1,2*Ue,2*ct),ie.push(jt||[],Ee+1,2*Ue,2*ct+1),ie.push(Gt||[],Ee+1,2*Ue+1,2*ct),ie.push(ki||[],Ee+1,2*Ue+1,2*ct+1)}}},Hr.prototype.getTile=function(ot,Ee,Ue){var ct=this.options,wt=ct.extent,X=ct.debug;if(ot<0||ot>24)return null;var j=1<<ot,ie=fr(ot,Ee=(Ee%j+j)%j,Ue);if(this.tiles[ie])return vi(this.tiles[ie],wt);X>1&&console.log("drilling down to z%d-%d-%d",ot,Ee,Ue);for(var ne,de=ot,Re=Ee,tt=Ue;!ne&&de>0;)de--,Re=Math.floor(Re/2),tt=Math.floor(tt/2),ne=this.tiles[fr(de,Re,tt)];return ne&&ne.source?(X>1&&console.log("found parent tile z%d-%d-%d",de,Re,tt),X>1&&console.time("drilling down"),this.splitTile(ne.source,de,Re,tt,ot,Ee,Ue),X>1&&console.timeEnd("drilling down"),this.tiles[ie]?vi(this.tiles[ie],wt):null):null};class Qn extends i.VectorTileWorkerSource{constructor(Ee,Ue,ct,wt,X){super(Ee,Ue,ct,wt,kr),X&&(this.loadGeoJSON=X)}loadData(Ee,Ue){const ct=Ee&&Ee.request,wt=ct&&ct.collectResourceTiming;this.loadGeoJSON(Ee,(X,j)=>{if(X||!j)return Ue(X);if(typeof j!="object")return Ue(new Error(`Input data given to '${Ee.source}' is not a valid GeoJSON object.`));{R(j,!0);try{if(Ee.filter){const ne=i.createExpression(Ee.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ne.result==="error")throw new Error(ne.value.map(Re=>`${Re.key}: ${Re.message}`).join(", "));j={type:"FeatureCollection",features:j.features.filter(Re=>ne.value.evaluate({zoom:0},Re))}}this._geoJSONIndex=Ee.cluster?new Qt(function({superclusterOptions:ne,clusterProperties:de}){if(!de||!ne)return ne;const Re={},tt={},He={accumulated:null,zoom:0},Je={properties:null},pt=Object.keys(de);for(const Lt of pt){const[jt,Gt]=de[Lt],ki=i.createExpression(Gt),wi=i.createExpression(typeof jt=="string"?[jt,["accumulated"],["get",Lt]]:jt);Re[Lt]=ki.value,tt[Lt]=wi.value}return ne.map=Lt=>{Je.properties=Lt;const jt={};for(const Gt of pt)jt[Gt]=Re[Gt].evaluate(He,Je);return jt},ne.reduce=(Lt,jt)=>{Je.properties=jt;for(const Gt of pt)He.accumulated=Lt[Gt],Lt[Gt]=tt[Gt].evaluate(He,Je)},ne}(Ee)).load(j.features):function(ne,de){return new Hr(ne,de)}(j,Ee.geojsonVtOptions)}catch(ne){return Ue(ne)}this.loaded={};const ie={};if(wt){const ne=i.getPerformanceMeasurement(ct);ne&&(ie.resourceTiming={},ie.resourceTiming[Ee.source]=JSON.parse(JSON.stringify(ne)))}Ue(null,ie)}})}reloadTile(Ee,Ue){const ct=this.loaded;return ct&&ct[Ee.uid]?super.reloadTile(Ee,Ue):this.loadTile(Ee,Ue)}loadGeoJSON(Ee,Ue){if(Ee.request)i.getJSON(Ee.request,Ue);else{if(typeof Ee.data!="string")return Ue(new Error(`Input data given to '${Ee.source}' is not a valid GeoJSON object.`));try{return Ue(null,JSON.parse(Ee.data))}catch{return Ue(new Error(`Input data given to '${Ee.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(Ee,Ue){try{Ue(null,this._geoJSONIndex.getClusterExpansionZoom(Ee.clusterId))}catch(ct){Ue(ct)}}getClusterChildren(Ee,Ue){try{Ue(null,this._geoJSONIndex.getChildren(Ee.clusterId))}catch(ct){Ue(ct)}}getClusterLeaves(Ee,Ue){try{Ue(null,this._geoJSONIndex.getLeaves(Ee.clusterId,Ee.limit,Ee.offset))}catch(ct){Ue(ct)}}}class zs{constructor(Ee){this.self=Ee,this.actor=new i.Actor(Ee,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=i.getProjection({name:"mercator"}),this.workerSourceTypes={vector:i.VectorTileWorkerSource,geojson:Qn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(Ue,ct)=>{if(this.workerSourceTypes[Ue])throw new Error(`Worker source with name "${Ue}" already registered.`);this.workerSourceTypes[Ue]=ct},this.self.registerRTLTextPlugin=Ue=>{if(i.plugin.isParsed())throw new Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=Ue.applyArabicShaping,i.plugin.processBidirectionalText=Ue.processBidirectionalText,i.plugin.processStyledBidirectionalText=Ue.processStyledBidirectionalText}}clearCaches(Ee,Ue,ct){delete this.layerIndexes[Ee],delete this.availableImages[Ee],delete this.workerSources[Ee],delete this.demWorkerSources[Ee],ct()}checkIfReady(Ee,Ue,ct){ct()}setReferrer(Ee,Ue){this.referrer=Ue}spriteLoaded(Ee,Ue){this.isSpriteLoaded[Ee]=Ue;for(const ct in this.workerSources[Ee]){const wt=this.workerSources[Ee][ct];for(const X in wt)wt[X]instanceof i.VectorTileWorkerSource&&(wt[X].isSpriteLoaded=Ue,wt[X].fire(new i.Event("isSpriteLoaded")))}}setImages(Ee,Ue,ct){this.availableImages[Ee]=Ue;for(const wt in this.workerSources[Ee]){const X=this.workerSources[Ee][wt];for(const j in X)X[j].availableImages=Ue}ct()}enableTerrain(Ee,Ue,ct){this.terrain=Ue,ct()}setProjection(Ee,Ue){this.projections[Ee]=i.getProjection(Ue)}setLayers(Ee,Ue,ct){this.getLayerIndex(Ee).replace(Ue),ct()}updateLayers(Ee,Ue,ct){this.getLayerIndex(Ee).update(Ue.layers,Ue.removedIds),ct()}loadTile(Ee,Ue,ct){const wt=this.enableTerrain?i.extend({enableTerrain:this.terrain},Ue):Ue;wt.projection=this.projections[Ee]||this.defaultProjection,this.getWorkerSource(Ee,Ue.type,Ue.source).loadTile(wt,ct)}loadDEMTile(Ee,Ue,ct){const wt=this.enableTerrain?i.extend({buildQuadTree:this.terrain},Ue):Ue;this.getDEMWorkerSource(Ee,Ue.source).loadTile(wt,ct)}reloadTile(Ee,Ue,ct){const wt=this.enableTerrain?i.extend({enableTerrain:this.terrain},Ue):Ue;wt.projection=this.projections[Ee]||this.defaultProjection,this.getWorkerSource(Ee,Ue.type,Ue.source).reloadTile(wt,ct)}abortTile(Ee,Ue,ct){this.getWorkerSource(Ee,Ue.type,Ue.source).abortTile(Ue,ct)}removeTile(Ee,Ue,ct){this.getWorkerSource(Ee,Ue.type,Ue.source).removeTile(Ue,ct)}removeSource(Ee,Ue,ct){if(!this.workerSources[Ee]||!this.workerSources[Ee][Ue.type]||!this.workerSources[Ee][Ue.type][Ue.source])return;const wt=this.workerSources[Ee][Ue.type][Ue.source];delete this.workerSources[Ee][Ue.type][Ue.source],wt.removeSource!==void 0?wt.removeSource(Ue,ct):ct()}loadWorkerSource(Ee,Ue,ct){try{this.self.importScripts(Ue.url),ct()}catch(wt){ct(wt.toString())}}syncRTLPluginState(Ee,Ue,ct){try{i.plugin.setState(Ue);const wt=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&wt!=null){this.self.importScripts(wt);const X=i.plugin.isParsed();ct(X?void 0:new Error(`RTL Text Plugin failed to import scripts from ${wt}`),X)}}catch(wt){ct(wt.toString())}}getAvailableImages(Ee){let Ue=this.availableImages[Ee];return Ue||(Ue=[]),Ue}getLayerIndex(Ee){let Ue=this.layerIndexes[Ee];return Ue||(Ue=this.layerIndexes[Ee]=new U),Ue}getWorkerSource(Ee,Ue,ct){if(this.workerSources[Ee]||(this.workerSources[Ee]={}),this.workerSources[Ee][Ue]||(this.workerSources[Ee][Ue]={}),!this.workerSources[Ee][Ue][ct]){const wt={send:(X,j,ie,ne,de,Re)=>{this.actor.send(X,j,ie,Ee,de,Re)},scheduler:this.actor.scheduler};this.workerSources[Ee][Ue][ct]=new this.workerSourceTypes[Ue](wt,this.getLayerIndex(Ee),this.getAvailableImages(Ee),this.isSpriteLoaded[Ee])}return this.workerSources[Ee][Ue][ct]}getDEMWorkerSource(Ee,Ue){return this.demWorkerSources[Ee]||(this.demWorkerSources[Ee]={}),this.demWorkerSources[Ee][Ue]||(this.demWorkerSources[Ee][Ue]=new N),this.demWorkerSources[Ee][Ue]}enforceCacheSizeLimit(Ee,Ue){i.enforceCacheSizeLimit(Ue)}getWorkerPerformanceMetrics(Ee,Ue,ct){ct(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new zs(self)),zs}),p(["./shared"],function(i){function C(x,a){if(Array.isArray(x)){if(!Array.isArray(a)||x.length!==a.length)return!1;for(let m=0;m<x.length;m++)if(!C(x[m],a[m]))return!1;return!0}if(typeof x=="object"&&x!==null&&a!==null){if(typeof a!="object"||Object.keys(x).length!==Object.keys(a).length)return!1;for(const m in x)if(!C(x[m],a[m]))return!1;return!0}return x===a}var D=U;function U(x){return!function(a){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var b,S,P=new Blob([""],{type:"text/javascript"}),H=URL.createObjectURL(P);try{S=new Worker(H),b=!0}catch{b=!1}return S&&S.terminate(),URL.revokeObjectURL(H),b}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var b=document.createElement("canvas");b.width=b.height=1;var S=b.getContext("2d");if(!S)return!1;var P=S.getImageData(0,0,1,1);return P&&P.width===b.width}()?(N[m=a&&a.failIfMajorPerformanceCaveat]===void 0&&(N[m]=function(b){var S,P=function(H){var W=document.createElement("canvas"),ee=Object.create(U.webGLContextAttributes);return ee.failIfMajorPerformanceCaveat=H,W.getContext("webgl",ee)||W.getContext("experimental-webgl",ee)}(b);if(!P)return!1;try{S=P.createShader(P.VERTEX_SHADER)}catch{return!1}return!(!S||P.isContextLost())&&(P.shaderSource(S,"void main() {}"),P.compileShader(S),P.getShaderParameter(S,P.COMPILE_STATUS)===!0)}(m)),N[m]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var m}(x)}var N={};function R(x,a,m){const b=i.window.document.createElement(x);return a!==void 0&&(b.className=a),m&&m.appendChild(b),b}function G(x,a,m){const b=i.window.document.createElementNS("http://www.w3.org/2000/svg",x);for(const S of Object.keys(a))b.setAttributeNS(null,S,a[S]);return m&&m.appendChild(b),b}U.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const J=i.window.document&&i.window.document.documentElement.style,Y=J&&J.userSelect!==void 0?"userSelect":"WebkitUserSelect";let B;function ae(){J&&Y&&(B=J[Y],J[Y]="none")}function le(){J&&Y&&(J[Y]=B)}function Ae(x){x.preventDefault(),x.stopPropagation(),i.window.removeEventListener("click",Ae,!0)}function we(){i.window.addEventListener("click",Ae,!0),i.window.setTimeout(()=>{i.window.removeEventListener("click",Ae,!0)},0)}function me(x,a){const m=x.getBoundingClientRect();return Me(x,m,a)}function Pe(x,a){const m=x.getBoundingClientRect(),b=[];for(let S=0;S<a.length;S++)b.push(Me(x,m,a[S]));return b}function it(x){return i.window.InstallTrigger!==void 0&&x.button===2&&x.ctrlKey&&i.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:x.button}function Me(x,a,m){const b=x.offsetWidth===a.width?1:x.offsetWidth/a.width;return new i.pointGeometry((m.clientX-a.left)*b,(m.clientY-a.top)*b)}function Ke(x,a){var m=a[0],b=a[1],S=a[2],P=a[3],H=m*P-S*b;return H?(x[0]=P*(H=1/H),x[1]=-b*H,x[2]=-S*H,x[3]=m*H,x):null}function Et(x){const{userImage:a}=x;return!!(a&&a.render&&a.render())&&(x.data.replace(new Uint8Array(a.data.buffer)),!0)}class oi extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(a){if(this.loaded!==a&&(this.loaded=a,a)){for(const{ids:m,callback:b}of this.requestors)this._notify(m,b);this.requestors=[]}}hasImage(a){return!!this.getImage(a)}getImage(a){return this.images[a]}addImage(a,m){this._validate(a,m)&&(this.images[a]=m)}_validate(a,m){let b=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new i.ErrorEvent(new Error(`Image "${a}" has invalid "stretchX" value`))),b=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new i.ErrorEvent(new Error(`Image "${a}" has invalid "stretchY" value`))),b=!1),this._validateContent(m.content,m)||(this.fire(new i.ErrorEvent(new Error(`Image "${a}" has invalid "content" value`))),b=!1),b}_validateStretch(a,m){if(!a)return!0;let b=0;for(const S of a){if(S[0]<b||S[1]<S[0]||m<S[1])return!1;b=S[1]}return!0}_validateContent(a,m){return!(a&&(a.length!==4||a[0]<0||m.data.width<a[0]||a[1]<0||m.data.height<a[1]||a[2]<0||m.data.width<a[2]||a[3]<0||m.data.height<a[3]||a[2]<a[0]||a[3]<a[1]))}updateImage(a,m){m.version=this.images[a].version+1,this.images[a]=m,this.updatedImages[a]=!0}removeImage(a){const m=this.images[a];delete this.images[a],delete this.patterns[a],m.userImage&&m.userImage.onRemove&&m.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(a,m){let b=!0;if(!this.isLoaded())for(const S of a)this.images[S]||(b=!1);this.isLoaded()||b?this._notify(a,m):this.requestors.push({ids:a,callback:m})}_notify(a,m){const b={};for(const S of a){this.images[S]||this.fire(new i.Event("styleimagemissing",{id:S}));const P=this.images[S];P?b[S]={data:P.data.clone(),pixelRatio:P.pixelRatio,sdf:P.sdf,version:P.version,stretchX:P.stretchX,stretchY:P.stretchY,content:P.content,hasRenderCallback:Boolean(P.userImage&&P.userImage.render)}:i.warnOnce(`Image "${S}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}m(null,b)}getPixelSize(){const{width:a,height:m}=this.atlasImage;return{width:a,height:m}}getPattern(a){const m=this.patterns[a],b=this.getImage(a);if(!b)return null;if(m&&m.position.version===b.version)return m.position;if(m)m.position.version=b.version;else{const S={w:b.data.width+2,h:b.data.height+2,x:0,y:0},P=new i.ImagePosition(S,b);this.patterns[a]={bin:S,position:P}}return this._updatePatternAtlas(),this.patterns[a].position}bind(a){const m=a.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new i.Texture(a,this.atlasImage,m.RGBA),this.atlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE)}_updatePatternAtlas(){const a=[];for(const P in this.patterns)a.push(this.patterns[P].bin);const{w:m,h:b}=i.potpack(a),S=this.atlasImage;S.resize({width:m||1,height:b||1});for(const P in this.patterns){const{bin:H}=this.patterns[P],W=H.x+1,ee=H.y+1,pe=this.images[P].data,fe=pe.width,Se=pe.height;i.RGBAImage.copy(pe,S,{x:0,y:0},{x:W,y:ee},{width:fe,height:Se}),i.RGBAImage.copy(pe,S,{x:0,y:Se-1},{x:W,y:ee-1},{width:fe,height:1}),i.RGBAImage.copy(pe,S,{x:0,y:0},{x:W,y:ee+Se},{width:fe,height:1}),i.RGBAImage.copy(pe,S,{x:fe-1,y:0},{x:W-1,y:ee},{width:1,height:Se}),i.RGBAImage.copy(pe,S,{x:0,y:0},{x:W+fe,y:ee},{width:1,height:Se})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(a){for(const m of a){if(this.callbackDispatchedThisFrame[m])continue;this.callbackDispatchedThisFrame[m]=!0;const b=this.images[m];Et(b)&&this.updateImage(m,b)}}}const Ci=new i.Properties({anchor:new i.DataConstantProperty(i.spec.light.anchor),position:new class{constructor(){this.specification=i.spec.light.position}possiblyEvaluate(x,a){return function([m,b,S]){const P=i.degToRad(b+90),H=i.degToRad(S);return{x:m*Math.cos(P)*Math.sin(H),y:m*Math.sin(P)*Math.sin(H),z:m*Math.cos(H),azimuthal:b,polar:S}}(x.expression.evaluate(a))}interpolate(x,a,m){return{x:i.number(x.x,a.x,m),y:i.number(x.y,a.y,m),z:i.number(x.z,a.z,m),azimuthal:i.number(x.azimuthal,a.azimuthal,m),polar:i.number(x.polar,a.polar,m)}}},color:new i.DataConstantProperty(i.spec.light.color),intensity:new i.DataConstantProperty(i.spec.light.intensity)}),te="-transition";class ce extends i.Evented{constructor(a){super(),this._transitionable=new i.Transitionable(Ci),this.setLight(a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(a,m={}){if(!this._validate(i.validateLight,a,m))for(const b in a){const S=a[b];i.endsWith(b,te)?this._transitionable.setTransition(b.slice(0,-te.length),S):this._transitionable.setValue(b,S)}}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,m,b){return(!b||b.validate!==!1)&&i.emitValidationErrors(this,a.call(i.validateStyle,i.extend({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}const ye=new i.Properties({source:new i.DataConstantProperty(i.spec.terrain.source),exaggeration:new i.DataConstantProperty(i.spec.terrain.exaggeration)}),xe="-transition";class ze extends i.Evented{constructor(a,m){super(),this._transitionable=new i.Transitionable(ye),this.set(a),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=m}get(){return this._transitionable.serialize()}set(a){for(const m in a){const b=a[m];i.endsWith(m,xe)?this._transitionable.setTransition(m.slice(0,-xe.length),b):this._transitionable.setValue(m,b)}}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}}function Ne(x,a,m,b){const S=i.smoothstep(45,65,m),[P,H]=Ge(x,b),W=i.length(a);let ee=1-Math.min(1,Math.exp((W-P)/(H-P)*-6));return ee*=ee*ee,ee=Math.min(1,1.00747*ee),ee*S*x.alpha}function Ge(x,a){const m=.5/Math.tan(.5*a);return[x.range[0]+m,x.range[1]+m]}const Ve=new i.Properties({range:new i.DataConstantProperty(i.spec.fog.range),color:new i.DataConstantProperty(i.spec.fog.color),"high-color":new i.DataConstantProperty(i.spec.fog["high-color"]),"space-color":new i.DataConstantProperty(i.spec.fog["space-color"]),"horizon-blend":new i.DataConstantProperty(i.spec.fog["horizon-blend"]),"star-intensity":new i.DataConstantProperty(i.spec.fog["star-intensity"])}),Le="-transition";class Ie extends i.Evented{constructor(a,m){super(),this._transitionable=new i.Transitionable(Ve),this.set(a),this._transitioning=this._transitionable.untransitioned(),this._transform=m}get state(){const a=this._transform,m=a.projection.name==="globe",b=i.globeToMercatorTransition(a.zoom),S=this.properties.get("range"),P=[.5,3];return{range:m?[i.number(P[0],S[0],b),i.number(P[1],S[1],b)]:S,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(a,m={}){if(!this._validate(i.validateFog,a,m)){for(const b of Object.keys(i.spec.fog))a&&a[b]===void 0&&(a[b]=i.spec.fog[b].default);for(const b in a){const S=a[b];i.endsWith(b,Le)?this._transitionable.setTransition(b.slice(0,-Le.length),S):this._transitionable.setValue(b,S)}}}getOpacity(a){if(!this._transform.projection.supportsFog)return 0;const m=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:i.smoothstep(45,65,a))*m.a}getOpacityAtLatLng(a,m){return this._transform.projection.supportsFog?function(b,S,P){const H=i.MercatorCoordinate.fromLngLat(S),W=P.elevation?P.elevation.getAtPointOrZero(H):0,ee=[H.x,H.y,W];return i.transformMat4(ee,ee,P.mercatorFogMatrix),Ne(b,ee,P.pitch,P._fov)}(this.state,a,m):0}getFovAdjustedRange(a){return this._transform.projection.supportsFog?Ge(this.state,a):[0,1]}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,m,b){return(!b||b.validate!==!1)&&i.emitValidationErrors(this,a.call(i.validateStyle,i.extend({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}class qe{constructor(a,m){this.workerPool=a,this.actors=[],this.currentActor=0,this.id=i.uniqueId();const b=this.workerPool.acquire(this.id);for(let S=0;S<b.length;S++){const P=new qe.Actor(b[S],m,this.id);P.name=`Worker ${S}`,this.actors.push(P)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(a,m,b){i.asyncAll(this.actors,(S,P)=>{S.send(a,m,P)},b=b||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(a=>{a.remove()}),this.actors=[],this.workerPool.release(this.id)}}function et(x,a,m){return a*(i.EXTENT/(x.tileSize*Math.pow(2,m-x.tileID.overscaledZ)))}qe.Actor=i.Actor;class vt{constructor(a,m,b,S){this.screenBounds=a,this.cameraPoint=m,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=b,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,S)}static createFromScreenPoints(a,m){let b,S;if(a instanceof i.pointGeometry||typeof a[0]=="number"){const P=i.pointGeometry.convert(a);b=[P],S=m.isPointAboveHorizon(P)}else{const P=i.pointGeometry.convert(a[0]),H=i.pointGeometry.convert(a[1]);b=[P,H],S=i.polygonizeBounds(P,H).every(W=>m.isPointAboveHorizon(W))}return new vt(b,m.getCameraPoint(),S,m)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(a){return i.polygonizeBounds(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],a)}bufferedCameraGeometry(a){const m=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],S=i.polygonizeBounds(m,b,0,!1);return this.cameraPoint.y>b.y&&(this.cameraPoint.x>m.x&&this.cameraPoint.x<b.x?S.splice(3,0,this.cameraPoint):this.cameraPoint.x>=b.x?S[2]=this.cameraPoint:this.cameraPoint.x<=m.x&&(S[3]=this.cameraPoint)),i.bufferConvexPolygon(S,a)}bufferedCameraGeometryGlobe(a){const m=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],S=i.polygonizeBounds(m,b,a),P=this.cameraPoint.clone();switch(3*((P.y>m.y)+(P.y>b.y))+((P.x>m.x)+(P.x>b.x))){case 0:S[0]=P,S[4]=P.clone();break;case 1:S.splice(1,0,P);break;case 2:S[1]=P;break;case 3:S.splice(4,0,P);break;case 5:S.splice(2,0,P);break;case 6:S[3]=P;break;case 7:S.splice(3,0,P);break;case 8:S[2]=P}return S}containsTile(a,m,b,S=0){const P=a.queryPadding/m._pixelsPerMercatorPixel+1,H=b?this._bufferedCameraMercator(P,m):this._bufferedScreenMercator(P,m);let W=a.tileID.wrap+(H.unwrapped?S:0);const ee=H.polygon.map(Xe=>i.getTilePoint(a.tileTransform,Xe,W));if(!i.polygonIntersectsBox(ee,0,0,i.EXTENT,i.EXTENT))return;W=a.tileID.wrap+(this.screenGeometryMercator.unwrapped?S:0);const pe=this.screenGeometryMercator.polygon.map(Xe=>i.getTileVec3(a.tileTransform,Xe,W)),fe=pe.map(Xe=>new i.pointGeometry(Xe[0],Xe[1])),Se=m.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),Qe=i.getTileVec3(a.tileTransform,Se,W),rt=pe.map(Xe=>{const Ye=i.sub(Xe,Xe,Qe);return i.normalize(Ye,Ye),new i.Ray(Qe,Ye)}),nt=et(a,1,m.zoom)*m._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:fe,tilespaceRays:rt,bufferedTilespaceGeometry:ee,bufferedTilespaceBounds:(lt=i.getBounds(ee),lt.min.x=i.clamp(lt.min.x,0,i.EXTENT),lt.min.y=i.clamp(lt.min.y,0,i.EXTENT),lt.max.x=i.clamp(lt.max.x,0,i.EXTENT),lt.max.y=i.clamp(lt.max.y,0,i.EXTENT),lt),tile:a,tileID:a.tileID,pixelToTileUnitsFactor:nt};var lt}_bufferedScreenMercator(a,m){const b=ut(a);if(this._screenRaycastCache[b])return this._screenRaycastCache[b];{let S;return S=m.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(a),m):{polygon:this.bufferedScreenGeometry(a).map(P=>m.pointCoordinate3D(P)),unwrapped:!0},this._screenRaycastCache[b]=S,S}}_bufferedCameraMercator(a,m){const b=ut(a);if(this._cameraRaycastCache[b])return this._cameraRaycastCache[b];{let S;return S=m.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(a),m):{polygon:this.bufferedCameraGeometry(a).map(P=>m.pointCoordinate3D(P)),unwrapped:!0},this._cameraRaycastCache[b]=S,S}}_projectAndResample(a,m){const b=function(P,H){const W=i.multiply([],H.pixelMatrix,H.globeMatrix),ee=[0,-i.GLOBE_RADIUS,0,1],pe=[0,i.GLOBE_RADIUS,0,1],fe=[0,0,0,1];i.transformMat4$1(ee,ee,W),i.transformMat4$1(pe,pe,W),i.transformMat4$1(fe,fe,W);const Se=new i.pointGeometry(ee[0]/ee[3],ee[1]/ee[3]),Qe=new i.pointGeometry(pe[0]/pe[3],pe[1]/pe[3]),rt=i.polygonContainsPoint(P,Se)&&ee[3]<fe[3],nt=i.polygonContainsPoint(P,Qe)&&pe[3]<fe[3];if(!rt&&!nt)return null;const lt=function(Ht,hi,si){for(let qt=1;qt<Ht.length;qt++){const ji=dt(hi.pointCoordinate3D(Ht[qt-1]).x),Kt=dt(hi.pointCoordinate3D(Ht[qt]).x);if(si<0){if(ji<Kt)return{idx:qt,t:-ji/(Kt-1-ji)}}else if(Kt<ji)return{idx:qt,t:(1-ji)/(Kt+1-ji)}}return null}(P,H,rt?-1:1);if(!lt)return null;const{idx:Xe,t:Ye}=lt;let At=Xe>1?Be(P.slice(0,Xe),H):[],ht=Xe<P.length?Be(P.slice(Xe),H):[];At=At.map(Ht=>new i.pointGeometry(dt(Ht.x),Ht.y)),ht=ht.map(Ht=>new i.pointGeometry(dt(Ht.x),Ht.y));const Bt=[...At];Bt.length===0&&Bt.push(ht[ht.length-1]);const Pt=i.number(Bt[Bt.length-1].y,(ht.length===0?At[0]:ht[0]).y,Ye);let It;return It=rt?[new i.pointGeometry(0,Pt),new i.pointGeometry(0,0),new i.pointGeometry(1,0),new i.pointGeometry(1,Pt)]:[new i.pointGeometry(1,Pt),new i.pointGeometry(1,1),new i.pointGeometry(0,1),new i.pointGeometry(0,Pt)],Bt.push(...It),ht.length===0?Bt.push(At[0]):Bt.push(...ht),{polygon:Bt.map(Ht=>new i.MercatorCoordinate(Ht.x,Ht.y)),unwrapped:!1}}(a,m);if(b)return b;const S=function(P,H){let W=!1,ee=-1/0,pe=0;for(let Se=0;Se<P.length-1;Se++)P[Se].x>ee&&(ee=P[Se].x,pe=Se);for(let Se=0;Se<P.length-1;Se++){const Qe=(pe+Se)%(P.length-1),rt=P[Qe],nt=P[Qe+1];Math.abs(rt.x-nt.x)>.5&&(rt.x<nt.x?(rt.x+=1,Qe===0&&(P[P.length-1].x+=1)):(nt.x+=1,Qe+1===P.length-1&&(P[0].x+=1)),W=!0)}const fe=i.mercatorXfromLng(H.center.lng);return W&&fe<Math.abs(fe-1)&&P.forEach(Se=>{Se.x-=1}),{polygon:P,unwrapped:W}}(Be(a,m).map(P=>new i.pointGeometry(dt(P.x),P.y)),m);return{polygon:S.polygon.map(P=>new i.MercatorCoordinate(P.x,P.y)),unwrapped:S.unwrapped}}}function Be(x,a){return i.resample(x,m=>{const b=a.pointCoordinate3D(m);m.x=b.x,m.y=b.y},1/256)}function dt(x){return x<0?1+x%1:x%1}function ut(x){return 100*x|0}function Qt(x,a,m,b,S){const P=function(H,W){if(H)return S(H);if(W){x.url&&W.tiles&&x.tiles&&delete x.tiles;const ee=i.pick(i.extend(W,x),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);W.vector_layers&&(ee.vectorLayers=W.vector_layers,ee.vectorLayerIds=ee.vectorLayers.map(pe=>pe.id)),ee.tiles=a.canonicalizeTileset(ee,x.url),S(null,ee)}};return x.url?i.getJSON(a.transformRequest(a.normalizeSourceURL(x.url,null,m,b),i.ResourceType.Source),P):i.exported.frame(()=>P(null,x))}class Wt{constructor(a,m,b){this.bounds=i.LngLatBounds.convert(this.validateBounds(a)),this.minzoom=m||0,this.maxzoom=b||24}validateBounds(a){return Array.isArray(a)&&a.length===4?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3])]:[-180,-90,180,90]}contains(a){const m=Math.pow(2,a.z),b=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*m),S=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*m),P=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*m),H=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*m);return a.x>=b&&a.x<P&&a.y>=S&&a.y<H}}class Nt{constructor(a,m,b){this.context=a;const S=a.gl;this.buffer=S.createBuffer(),this.dynamicDraw=Boolean(b),this.context.unbindVAO(),a.bindElementBuffer.set(this.buffer),S.bufferData(S.ELEMENT_ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?S.DYNAMIC_DRAW:S.STATIC_DRAW),this.dynamicDraw||m.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(a){const m=this.context.gl;this.context.unbindVAO(),this.bind(),m.bufferSubData(m.ELEMENT_ARRAY_BUFFER,0,a.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ct={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ft{constructor(a,m,b,S){this.length=m.length,this.attributes=b,this.itemSize=m.bytesPerElement,this.dynamicDraw=S,this.context=a;const P=a.gl;this.buffer=P.createBuffer(),a.bindVertexBuffer.set(this.buffer),P.bufferData(P.ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?P.DYNAMIC_DRAW:P.STATIC_DRAW),this.dynamicDraw||m.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(a){const m=this.context.gl;this.bind(),m.bufferSubData(m.ARRAY_BUFFER,0,a.arrayBuffer)}enableAttributes(a,m){for(let b=0;b<this.attributes.length;b++){const S=m.attributes[this.attributes[b].name];S!==void 0&&a.enableVertexAttribArray(S)}}setVertexAttribPointers(a,m,b){for(let S=0;S<this.attributes.length;S++){const P=this.attributes[S],H=m.attributes[P.name];H!==void 0&&a.vertexAttribPointer(H,P.components,a[Ct[P.type]],!1,this.itemSize,P.offset+this.itemSize*(b||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Xt{constructor(a){this.gl=a.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(a){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class mi extends Xt{getDefault(){return i.Color.transparent}set(a){const m=this.current;(a.r!==m.r||a.g!==m.g||a.b!==m.b||a.a!==m.a||this.dirty)&&(this.gl.clearColor(a.r,a.g,a.b,a.a),this.current=a,this.dirty=!1)}}class fi extends Xt{getDefault(){return 1}set(a){(a!==this.current||this.dirty)&&(this.gl.clearDepth(a),this.current=a,this.dirty=!1)}}class Gi extends Xt{getDefault(){return 0}set(a){(a!==this.current||this.dirty)&&(this.gl.clearStencil(a),this.current=a,this.dirty=!1)}}class wn extends Xt{getDefault(){return[!0,!0,!0,!0]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||a[2]!==m[2]||a[3]!==m[3]||this.dirty)&&(this.gl.colorMask(a[0],a[1],a[2],a[3]),this.current=a,this.dirty=!1)}}class Qi extends Xt{getDefault(){return!0}set(a){(a!==this.current||this.dirty)&&(this.gl.depthMask(a),this.current=a,this.dirty=!1)}}class Gn extends Xt{getDefault(){return 255}set(a){(a!==this.current||this.dirty)&&(this.gl.stencilMask(a),this.current=a,this.dirty=!1)}}class kn extends Xt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(a){const m=this.current;(a.func!==m.func||a.ref!==m.ref||a.mask!==m.mask||this.dirty)&&(this.gl.stencilFunc(a.func,a.ref,a.mask),this.current=a,this.dirty=!1)}}class yt extends Xt{getDefault(){const a=this.gl;return[a.KEEP,a.KEEP,a.KEEP]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||a[2]!==m[2]||this.dirty)&&(this.gl.stencilOp(a[0],a[1],a[2]),this.current=a,this.dirty=!1)}}class st extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;a?m.enable(m.STENCIL_TEST):m.disable(m.STENCIL_TEST),this.current=a,this.dirty=!1}}class ti extends Xt{getDefault(){return[0,1]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||this.dirty)&&(this.gl.depthRange(a[0],a[1]),this.current=a,this.dirty=!1)}}class Ni extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),this.current=a,this.dirty=!1}}class qi extends Xt{getDefault(){return this.gl.LESS}set(a){(a!==this.current||this.dirty)&&(this.gl.depthFunc(a),this.current=a,this.dirty=!1)}}class en extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;a?m.enable(m.BLEND):m.disable(m.BLEND),this.current=a,this.dirty=!1}}class $t extends Xt{getDefault(){const a=this.gl;return[a.ONE,a.ZERO]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||this.dirty)&&(this.gl.blendFunc(a[0],a[1]),this.current=a,this.dirty=!1)}}class at extends Xt{getDefault(){return i.Color.transparent}set(a){const m=this.current;(a.r!==m.r||a.g!==m.g||a.b!==m.b||a.a!==m.a||this.dirty)&&(this.gl.blendColor(a.r,a.g,a.b,a.a),this.current=a,this.dirty=!1)}}class ii extends Xt{getDefault(){return this.gl.FUNC_ADD}set(a){(a!==this.current||this.dirty)&&(this.gl.blendEquation(a),this.current=a,this.dirty=!1)}}class hn extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;a?m.enable(m.CULL_FACE):m.disable(m.CULL_FACE),this.current=a,this.dirty=!1}}class Xi extends Xt{getDefault(){return this.gl.BACK}set(a){(a!==this.current||this.dirty)&&(this.gl.cullFace(a),this.current=a,this.dirty=!1)}}class on extends Xt{getDefault(){return this.gl.CCW}set(a){(a!==this.current||this.dirty)&&(this.gl.frontFace(a),this.current=a,this.dirty=!1)}}class Cn extends Xt{getDefault(){return null}set(a){(a!==this.current||this.dirty)&&(this.gl.useProgram(a),this.current=a,this.dirty=!1)}}class Tn extends Xt{getDefault(){return this.gl.TEXTURE0}set(a){(a!==this.current||this.dirty)&&(this.gl.activeTexture(a),this.current=a,this.dirty=!1)}}class nr extends Xt{getDefault(){const a=this.gl;return[0,0,a.drawingBufferWidth,a.drawingBufferHeight]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||a[2]!==m[2]||a[3]!==m[3]||this.dirty)&&(this.gl.viewport(a[0],a[1],a[2],a[3]),this.current=a,this.dirty=!1)}}class Ii extends Xt{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.bindFramebuffer(m.FRAMEBUFFER,a),this.current=a,this.dirty=!1}}class bn extends Xt{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.bindRenderbuffer(m.RENDERBUFFER,a),this.current=a,this.dirty=!1}}class Ot extends Xt{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.bindTexture(m.TEXTURE_2D,a),this.current=a,this.dirty=!1}}class vi extends Xt{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.bindBuffer(m.ARRAY_BUFFER,a),this.current=a,this.dirty=!1}}class Wi extends Xt{getDefault(){return null}set(a){const m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,a),this.current=a,this.dirty=!1}}class Ui extends Xt{constructor(a){super(a),this.vao=a.extVertexArrayObject}getDefault(){return null}set(a){this.vao&&(a!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(a),this.current=a,this.dirty=!1)}}class Pn extends Xt{getDefault(){return 4}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_ALIGNMENT,a),this.current=a,this.dirty=!1}}class qn extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a),this.current=a,this.dirty=!1}}class Hr extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,a),this.current=a,this.dirty=!1}}class fr extends Xt{constructor(a,m){super(a),this.context=a,this.parent=m}getDefault(){return null}}class kr extends fr{setDirty(){this.dirty=!0}set(a){if(a===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,a,0),this.current=a,this.dirty=!1}}class Qn extends fr{attachment(){return this.gl.DEPTH_ATTACHMENT}set(a){if(a===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferRenderbuffer(m.FRAMEBUFFER,this.attachment(),m.RENDERBUFFER,a),this.current=a,this.dirty=!1}}class zs extends Qn{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class ot{constructor(a,m,b,S){this.context=a,this.width=m,this.height=b;const P=this.framebuffer=a.gl.createFramebuffer();this.colorAttachment=new kr(a,P),S&&(this.depthAttachment=new Qn(a,P))}destroy(){const a=this.context.gl,m=this.colorAttachment.get();if(m&&a.deleteTexture(m),this.depthAttachment){const b=this.depthAttachment.get();b&&a.deleteRenderbuffer(b)}a.deleteFramebuffer(this.framebuffer)}}class Ee{constructor(a){this.gl=a,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new mi(this),this.clearDepth=new fi(this),this.clearStencil=new Gi(this),this.colorMask=new wn(this),this.depthMask=new Qi(this),this.stencilMask=new Gn(this),this.stencilFunc=new kn(this),this.stencilOp=new yt(this),this.stencilTest=new st(this),this.depthRange=new ti(this),this.depthTest=new Ni(this),this.depthFunc=new qi(this),this.blend=new en(this),this.blendFunc=new $t(this),this.blendColor=new at(this),this.blendEquation=new ii(this),this.cullFace=new hn(this),this.cullFaceSide=new Xi(this),this.frontFace=new on(this),this.program=new Cn(this),this.activeTexture=new Tn(this),this.viewport=new nr(this),this.bindFramebuffer=new Ii(this),this.bindRenderbuffer=new bn(this),this.bindTexture=new Ot(this),this.bindVertexBuffer=new vi(this),this.bindElementBuffer=new Wi(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ui(this),this.pixelStoreUnpack=new Pn(this),this.pixelStoreUnpackPremultiplyAlpha=new qn(this),this.pixelStoreUnpackFlipY=new Hr(this),this.extTextureFilterAnisotropic=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=a.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extDebugRendererInfo=a.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=a.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=a.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.extTextureHalfFloat=a.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(a.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=a.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=a.getExtension("OES_standard_derivatives"),this.extTimerQuery=a.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(a,m){return new Nt(this,a,m)}createVertexBuffer(a,m,b){return new Ft(this,a,m,b)}createRenderbuffer(a,m,b){const S=this.gl,P=S.createRenderbuffer();return this.bindRenderbuffer.set(P),S.renderbufferStorage(S.RENDERBUFFER,a,m,b),this.bindRenderbuffer.set(null),P}createFramebuffer(a,m,b){return new ot(this,a,m,b)}clear({color:a,depth:m,stencil:b}){const S=this.gl;let P=0;a&&(P|=S.COLOR_BUFFER_BIT,this.clearColor.set(a),this.colorMask.set([!0,!0,!0,!0])),m!==void 0&&(P|=S.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(m),this.depthMask.set(!0)),b!==void 0&&(P|=S.STENCIL_BUFFER_BIT,this.clearStencil.set(b),this.stencilMask.set(255)),S.clear(P)}setCullFace(a){a.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(a.mode),this.frontFace.set(a.frontFace))}setDepthMode(a){a.func!==this.gl.ALWAYS||a.mask?(this.depthTest.set(!0),this.depthFunc.set(a.func),this.depthMask.set(a.mask),this.depthRange.set(a.range)):this.depthTest.set(!1)}setStencilMode(a){a.test.func!==this.gl.ALWAYS||a.mask?(this.stencilTest.set(!0),this.stencilMask.set(a.mask),this.stencilOp.set([a.fail,a.depthFail,a.pass]),this.stencilFunc.set({func:a.test.func,ref:a.ref,mask:a.test.mask})):this.stencilTest.set(!1)}setColorMode(a){C(a.blendFunction,i.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(a.blendFunction),this.blendColor.set(a.blendColor)),this.colorMask.set(a.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Ue extends i.Evented{constructor(a,m,b,S){super(),this.id=a,this.dispatcher=b,this.setEventedParent(S),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.extend({type:"raster"},m),i.extend(this,i.pick(m,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Qt(this._options,this.map._requestManager,null,null,(a,m)=>{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new i.ErrorEvent(a)):m&&(i.extend(this,m),m.bounds&&(this.tileBounds=new Wt(m.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(m.tiles),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(a,m){const b=i.exported.devicePixelRatio>=2,S=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),b,this.tileSize);a.request=i.getImage(this.map._requestManager.transformRequest(S,i.ResourceType.Tile),(P,H,W,ee)=>(delete a.request,a.aborted?(a.state="unloaded",m(null)):P?(a.state="errored",m(P)):H?(this.map._refreshExpiredTiles&&a.setExpiryData({cacheControl:W,expires:ee}),a.setTexture(H,this.map.painter),a.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),void m(null)):m(null)))}static loadTileData(a,m,b){a.setTexture(m,b)}static unloadTileData(a,m){a.texture&&m.saveTileTexture(a.texture)}abortTile(a,m){a.request&&(a.request.cancel(),delete a.request),m()}unloadTile(a,m){a.texture&&this.map.painter.saveTileTexture(a.texture),m()}hasTransition(){return!1}}let ct;function wt(x,a,m,b,S,P,H,W){const ee=[x,m,S,a,b,P,1,1,1],pe=[H,W,1],fe=i.adjoint([],ee),[Se,Qe,rt]=i.transformMat3(pe,pe,i.transpose(fe,fe));return i.multiply$1(ee,[Se,0,0,0,Qe,0,0,0,rt],ee)}class X extends i.Evented{constructor(a,m,b,S){super(),this.id=a,this.dispatcher=b,this.coordinates=m.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(S),this.options=m,this._dirty=!1}load(a,m){this._loaded=m||!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(b,S)=>{if(this._imageRequest=null,this._loaded=!0,b)this.fire(new i.ErrorEvent(b));else if(S){const{HTMLImageElement:P}=i.window;this.image=S instanceof P?i.exported.getImageData(S):S,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,a&&(this.coordinates=a),this._finishLoading()}})}loaded(){return this._loaded}updateImage(a){return this.image&&a.url?(this._imageRequest&&a.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=a.url,this.load(a.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(a){this.map=a,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(a){this.coordinates=a,this._boundsArray=void 0;const m=a.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(b){let S=1/0,P=1/0,H=-1/0,W=-1/0;for(const Se of b)S=Math.min(S,Se.x),P=Math.min(P,Se.y),H=Math.max(H,Se.x),W=Math.max(W,Se.y);const ee=Math.max(H-S,W-P),pe=Math.max(0,Math.floor(-Math.log(ee)/Math.LN2)),fe=Math.pow(2,pe);return new i.CanonicalTileID(pe,Math.floor((S+H)/2*fe),Math.floor((P+W)/2*fe))}(m),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(a){for(const ee in this.tiles){const pe=this.tiles[ee];pe.state!=="loaded"&&(pe.state="loaded",pe.texture=this.texture)}if(this._boundsArray)return;const m=i.tileTransform(this.tileID,this.map.transform.projection),[b,S,P,H]=this.coordinates.map(ee=>{const pe=m.projection.project(ee[0],ee[1]);return i.getTilePoint(m,pe)._round()});this.perspectiveTransform=function(ee,pe,fe,Se,Qe,rt,nt,lt,Xe,Ye){const At=wt(0,0,ee,0,0,pe,ee,pe),ht=wt(fe,Se,Qe,rt,nt,lt,Xe,Ye);return i.multiply$1(ht,i.adjoint(At,At),ht),[ht[6]/ht[8]*ee/i.EXTENT,ht[7]/ht[8]*pe/i.EXTENT]}(this.width,this.height,b.x,b.y,S.x,S.y,H.x,H.y,P.x,P.y);const W=this._boundsArray=new i.StructArrayLayout4i8;W.emplaceBack(b.x,b.y,0,0),W.emplaceBack(S.x,S.y,i.EXTENT,0),W.emplaceBack(H.x,H.y,0,i.EXTENT),W.emplaceBack(P.x,P.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=a.createVertexBuffer(W,i.boundsAttributes.members),this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const a=this.map.painter.context,m=a.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new i.Texture(a,this.image,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(a)}loadTile(a,m){this.tileID&&this.tileID.equals(a.tileID.canonical)?(this.tiles[String(a.tileID.wrap)]=a,a.buckets={},m(null)):(a.state="errored",m(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const j={vector:class extends i.Evented{constructor(x,a,m,b){if(super(),this.id=x,this.dispatcher=m,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(a,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},a),this._collectResourceTiming=a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(b),this._tileWorkers={},this._deduped=new i.DedupedRequest}load(x){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"}));const a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,m=this.map._worldview;this._tileJSONRequest=Qt(this._options,this.map._requestManager,a,m,(b,S)=>{this._tileJSONRequest=null,this._loaded=!0,b?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),m&&m.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${m}`),this.fire(new i.ErrorEvent(b))):S&&(i.extend(this,S),S.bounds&&(this.tileBounds=new Wt(S.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(S.tiles,this.map._requestManager._customAccessToken),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))),x&&x(b)})}loaded(){return this._loaded}hasTile(x){return!this.tileBounds||this.tileBounds.contains(x.canonical)}onAdd(x){this.map=x,this.load()}reload(){this.cancelTileJSONRequest(),this.load(()=>{const x=this.map.style._getSourceCaches(this.id);for(const a of x)a.clearTiles()})}setSourceProperty(x){x(),this.reload()}setTiles(x){return this._options.tiles=x,this.reload(),this}setUrl(x){return this.url=x,this._options.url=x,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return i.extend({},this._options)}loadTile(x,a){const m=this.map._requestManager.normalizeTileURL(x.tileID.canonical.url(this.tiles,this.scheme)),b={request:this.map._requestManager.transformRequest(m,i.ResourceType.Tile),data:void 0,uid:x.uid,tileID:x.tileID,tileZoom:x.tileZoom,zoom:x.tileID.overscaledZ,tileSize:this.tileSize*x.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:x.isSymbolTile};if(b.request.collectResourceTiming=this._collectResourceTiming,x.actor&&x.state!=="expired")x.state==="loading"?x.reloadCallback=a:x.request=x.actor.send("reloadTile",b,S.bind(this));else if(x.actor=this._tileWorkers[m]=this._tileWorkers[m]||this.dispatcher.getActor(),this.dispatcher.ready)x.request=x.actor.send("loadTile",b,S.bind(this),void 0,!0);else{const P=i.loadVectorTile.call({deduped:this._deduped},b,(H,W)=>{H||!W?S.call(this,H):(b.data={cacheControl:W.cacheControl,expires:W.expires,rawData:W.rawData.slice(0)},x.actor&&x.actor.send("loadTile",b,S.bind(this),void 0,!0))},!0);x.request={cancel:P}}function S(P,H){return delete x.request,x.aborted?a(null):P&&P.status!==404?a(P):(H&&H.resourceTiming&&(x.resourceTiming=H.resourceTiming),this.map._refreshExpiredTiles&&H&&x.setExpiryData(H),x.loadVectorData(H,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),a(null),void(x.reloadCallback&&(this.loadTile(x,x.reloadCallback),x.reloadCallback=null)))}}abortTile(x){x.request&&(x.request.cancel(),delete x.request),x.actor&&x.actor.send("abortTile",{uid:x.uid,type:this.type,source:this.id})}unloadTile(x){x.unloadVectorData(),x.actor&&x.actor.send("removeTile",{uid:x.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}},raster:Ue,"raster-dem":class extends Ue{constructor(x,a,m,b){super(x,a,m,b),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},a),this.encoding=a.encoding||"mapbox"}loadTile(x,a){const m=this.map._requestManager.normalizeTileURL(x.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function b(S,P){S&&(x.state="errored",a(S)),P&&(x.dem=P,x.dem.onDeserialize(),x.needsHillshadePrepare=!0,x.needsDEMTextureUpload=!0,x.state="loaded",a(null))}x.request=i.getImage(this.map._requestManager.transformRequest(m,i.ResourceType.Tile),function(S,P,H,W){if(delete x.request,x.aborted)x.state="unloaded",a(null);else if(S)x.state="errored",a(S);else if(P){this.map._refreshExpiredTiles&&x.setExpiryData({cacheControl:H,expires:W});const ee=i.window.ImageBitmap&&P instanceof i.window.ImageBitmap&&(ct==null&&(ct=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&typeof i.window.createImageBitmap=="function"),ct),pe=1-(P.width-i.prevPowerOfTwo(P.width))/2;pe<1||x.neighboringTiles||(x.neighboringTiles=this._getNeighboringTiles(x.tileID));const fe=ee?P:i.exported.getImageData(P,pe),Se={uid:x.uid,coord:x.tileID,source:this.id,rawImageData:fe,encoding:this.encoding,padding:pe};x.actor&&x.state!=="expired"||(x.actor=this.dispatcher.getActor(),x.actor.send("loadDEMTile",Se,b.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(x){const a=x.canonical,m=Math.pow(2,a.z),b=(a.x-1+m)%m,S=a.x===0?x.wrap-1:x.wrap,P=(a.x+1+m)%m,H=a.x+1===m?x.wrap+1:x.wrap,W={};return W[new i.OverscaledTileID(x.overscaledZ,S,a.z,b,a.y).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,H,a.z,P,a.y).key]={backfilled:!1},a.y>0&&(W[new i.OverscaledTileID(x.overscaledZ,S,a.z,b,a.y-1).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,x.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,H,a.z,P,a.y-1).key]={backfilled:!1}),a.y+1<m&&(W[new i.OverscaledTileID(x.overscaledZ,S,a.z,b,a.y+1).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,x.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,H,a.z,P,a.y+1).key]={backfilled:!1}),W}unloadTile(x){x.demTexture&&this.map.painter.saveTileTexture(x.demTexture),x.fbo&&(x.fbo.destroy(),delete x.fbo),x.dem&&delete x.dem,delete x.neighboringTiles,x.state="unloaded"}},geojson:class extends i.Evented{constructor(x,a,m,b){super(),this.id=x,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=m.getActor(),this.setEventedParent(b),this._data=a.data,this._options=i.extend({},a),this._collectResourceTiming=a.collectResourceTiming,a.maxzoom!==void 0&&(this.maxzoom=a.maxzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId;const S=i.EXTENT/this.tileSize;this.workerOptions=i.extend({source:this.id,cluster:a.cluster||!1,geojsonVtOptions:{buffer:(a.buffer!==void 0?a.buffer:128)*S,tolerance:(a.tolerance!==void 0?a.tolerance:.375)*S,extent:i.EXTENT,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:a.clusterMaxZoom!==void 0?a.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,a.clusterMinPoints||2),extent:i.EXTENT,radius:(a.clusterRadius!==void 0?a.clusterRadius:50)*S,log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter},a.workerOptions)}onAdd(x){this.map=x,this.setData(this._data)}setData(x){return this._data=x,this._updateWorkerData(),this}getClusterExpansionZoom(x,a){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:x,source:this.id},a),this}getClusterChildren(x,a){return this.actor.send("geojson.getClusterChildren",{clusterId:x,source:this.id},a),this}getClusterLeaves(x,a,m,b){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:x,limit:a,offset:m},b),this}_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new i.Event("dataloading",{dataType:"source"})),this._loaded=!1;const x=i.extend({},this.workerOptions),a=this._data;typeof a=="string"?(x.request=this.map._requestManager.transformRequest(i.exported.resolveURL(a),i.ResourceType.Source),x.request.collectResourceTiming=this._collectResourceTiming):x.data=JSON.stringify(a),this._pendingLoad=this.actor.send(`${this.type}.loadData`,x,(m,b)=>{if(this._loaded=!0,this._pendingLoad=null,m)this.fire(new i.ErrorEvent(m));else{const S={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&b&&b.resourceTiming&&b.resourceTiming[this.id]&&(S.resourceTiming=b.resourceTiming[this.id]),this.fire(new i.Event("data",S)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(x,a){const m=x.actor?"reloadTile":"loadTile";x.actor=this.actor,x.request=this.actor.send(m,{type:this.type,uid:x.uid,tileID:x.tileID,tileZoom:x.tileZoom,zoom:x.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(b,S)=>(delete x.request,x.unloadVectorData(),x.aborted?a(null):b?a(b):(x.loadVectorData(S,this.map.painter,m==="reloadTile"),a(null))),void 0,m==="loadTile")}abortTile(x){x.request&&(x.request.cancel(),delete x.request),x.aborted=!0}unloadTile(x){x.unloadVectorData(),this.actor.send("removeTile",{uid:x.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends X{constructor(x,a,m,b){super(x,a,m,b),this.roundZoom=!0,this.type="video",this.options=a}load(){this._loaded=!1;const x=this.options;this.urls=[];for(const a of x.urls)this.urls.push(this.map._requestManager.transformRequest(a,i.ResourceType.Source).url);i.getVideo(this.urls,(a,m)=>{this._loaded=!0,a?this.fire(new i.ErrorEvent(a)):m&&(this.video=m,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(x){if(this.video){const a=this.video.seekable;x<a.start(0)||x>a.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=x}}getVideo(){return this.video}onAdd(x){this.map||(this.map=x,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const x=this.map.painter.context,a=x.gl;this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(x,this.video,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(x)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:X,canvas:class extends X{constructor(x,a,m,b){super(x,a,m,b),a.coordinates?Array.isArray(a.coordinates)&&a.coordinates.length===4&&!a.coordinates.some(S=>!Array.isArray(S)||S.length!==2||S.some(P=>typeof P!="number"))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'missing required property "coordinates"'))),a.animate&&typeof a.animate!="boolean"&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'optional "animate" property must be a boolean value'))),a.canvas?typeof a.canvas=="string"||a.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'missing required property "canvas"'))),this.options=a,this.animate=a.animate===void 0||a.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(x){this.map=x,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let x=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,x=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,x=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const a=this.map.painter.context;this.texture?(x||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(a,this.canvas,a.gl.RGBA,{premultiply:!0}),this._prepareData(a)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const x of[this.canvas.width,this.canvas.height])if(isNaN(x)||x<=0)return!0;return!1}},custom:class extends i.Evented{constructor(x,a,m,b){super(),this.id=x,this.type="custom",this._dataType="raster",this._dispatcher=m,this._implementation=a,this.setEventedParent(b),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Wt(this._implementation.bounds,this.minzoom,this.maxzoom)),a.update=this._update.bind(this),a.clearTiles=this._clearTiles.bind(this),a.coveringTiles=this._coveringTiles.bind(this),i.extend(this,i.pick(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(x){this._map=x,this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(x),this.load()}onRemove(x){this._implementation.onRemove&&this._implementation.onRemove(x)}hasTile(x){if(this._implementation.hasTile){const{x:a,y:m,z:b}=x.canonical;return this._implementation.hasTile({x:a,y:m,z:b})}return!this.tileBounds||this.tileBounds.contains(x.canonical)}loadTile(x,a){const{x:m,y:b,z:S}=x.tileID.canonical,P=new i.window.AbortController;x.request=Promise.resolve(this._implementation.loadTile({x:m,y:b,z:S},{signal:P.signal})).then(function(H){return delete x.request,x.aborted?(x.state="unloaded",a(null)):H===void 0?(x.state="errored",a(null)):H===null?(this.loadTileData(x,{width:this.tileSize,height:this.tileSize,data:null}),x.state="loaded",a(null)):function(W){return W instanceof i.window.ImageData||W instanceof i.window.HTMLCanvasElement||W instanceof i.window.ImageBitmap||W instanceof i.window.HTMLImageElement}(H)?(this.loadTileData(x,H),x.state="loaded",void a(null)):(x.state="errored",a(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch(H=>{H.code!==20&&(x.state="errored",a(H))}),x.request.cancel=()=>P.abort()}loadTileData(x,a){Ue.loadTileData(x,a,this._map.painter)}unloadTileData(x){Ue.unloadTileData(x,this._map.painter)}unloadTile(x,a){if(this.unloadTileData(x),this._implementation.unloadTile){const{x:m,y:b,z:S}=x.tileID.canonical;this._implementation.unloadTile({x:m,y:b,z:S})}a()}abortTile(x,a){x.request&&x.request.cancel&&(x.request.cancel(),delete x.request),a()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(x=>({x:x.canonical.x,y:x.canonical.y,z:x.canonical.z}))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}}},ie=function(x,a,m,b){const S=new j[a.type](x,a,m,b);if(S.id!==x)throw new Error(`Expected Source id to be ${x} instead of ${S.id}`);return i.bindAll(["load","abort","unload","serialize","prepare"],S),S};function ne(x,a){const m=i.identity([]);return i.scale(m,m,[.5*x.width,.5*-x.height,1]),i.translate(m,m,[1,-1,0]),i.multiply(m,m,x.calculateProjMatrix(a.toUnwrapped())),Float32Array.from(m)}function de(x,a,m,b,S,P,H,W=!1){const ee=x.tilesIn(b,H,W);ee.sort(tt);const pe=[];for(const Se of ee)pe.push({wrappedTileID:Se.tile.tileID.wrapped().key,queryResults:Se.tile.queryRenderedFeatures(a,m,x._state,Se,S,P,ne(x.transform,Se.tile.tileID),W)});const fe=function(Se){const Qe={},rt={};for(const nt of Se){const lt=nt.queryResults,Xe=nt.wrappedTileID,Ye=rt[Xe]=rt[Xe]||{};for(const At in lt){const ht=lt[At],Bt=Ye[At]=Ye[At]||{},Pt=Qe[At]=Qe[At]||[];for(const It of ht)Bt[It.featureIndex]||(Bt[It.featureIndex]=!0,Pt.push(It))}}return Qe}(pe);for(const Se in fe)fe[Se].forEach(Qe=>{const rt=Qe.feature,nt=rt.layer;nt&&nt.type!=="background"&&nt.type!=="sky"&&(rt.source=nt.source,nt["source-layer"]&&(rt.sourceLayer=nt["source-layer"]),rt.state=rt.id!==void 0?x.getFeatureState(nt["source-layer"],rt.id):{})});return fe}function Re(x,a){const m=x.getRenderableIds().map(P=>x.getTileByID(P)),b=[],S={};for(let P=0;P<m.length;P++){const H=m[P],W=H.tileID.canonical.key;S[W]||(S[W]=!0,H.querySourceFeatures(b,a))}return b}function tt(x,a){const m=x.tileID,b=a.tileID;return m.overscaledZ-b.overscaledZ||m.canonical.y-b.canonical.y||m.wrap-b.wrap||m.canonical.x-b.canonical.x}function He(){return $l.workerClass!=null?new $l.workerClass:new i.window.Worker($l.workerUrl)}const Je="mapboxgl_preloaded_worker_pool";class pt{constructor(){this.active={}}acquire(a){if(!this.workers)for(this.workers=[];this.workers.length<pt.workerCount;)this.workers.push(new He);return this.active[a]=!0,this.workers.slice()}release(a){delete this.active[a],this.numActive()===0&&(this.workers.forEach(m=>{m.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Je]}numActive(){return Object.keys(this.active).length}}let Lt;function jt(){return Lt||(Lt=new pt),Lt}function Gt(x,a){const m={};for(const b in x)b!=="ref"&&(m[b]=x[b]);return i.refProperties.forEach(b=>{b in a&&(m[b]=a[b])}),m}function ki(x){x=x.slice();const a=Object.create(null);for(let m=0;m<x.length;m++)a[x[m].id]=x[m];for(let m=0;m<x.length;m++)"ref"in x[m]&&(x[m]=Gt(x[m],a[x[m].ref]));return x}pt.workerCount=2;const wi={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setProjection:"setProjection"};function Oi(x,a,m){m.push({command:wi.addSource,args:[x,a[x]]})}function Yi(x,a,m){a.push({command:wi.removeSource,args:[x]}),m[x]=!0}function tn(x,a,m,b){Yi(x,m,b),Oi(x,a,m)}function rr(x,a,m){let b;for(b in x[m])if(x[m].hasOwnProperty(b)&&b!=="data"&&!C(x[m][b],a[m][b]))return!1;for(b in a[m])if(a[m].hasOwnProperty(b)&&b!=="data"&&!C(x[m][b],a[m][b]))return!1;return!0}function yn(x,a,m,b,S,P){let H;for(H in a=a||{},x=x||{})x.hasOwnProperty(H)&&(C(x[H],a[H])||m.push({command:P,args:[b,H,a[H],S]}));for(H in a)a.hasOwnProperty(H)&&!x.hasOwnProperty(H)&&(C(x[H],a[H])||m.push({command:P,args:[b,H,a[H],S]}))}function Yt(x){return x.id}function sr(x,a){return x[a.id]=a,x}class Yn{constructor(a,m){this.reset(a,m)}reset(a,m){this.points=a||[],this._distances=[0];for(let b=1;b<this.points.length;b++)this._distances[b]=this._distances[b-1]+this.points[b].dist(this.points[b-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(m||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(a){if(this.points.length===1)return this.points[0];a=i.clamp(a,0,1);let m=1,b=this._distances[m];const S=a*this.paddedLength+this.padding;for(;b<S&&m<this._distances.length;)b=this._distances[++m];const P=m-1,H=this._distances[P],W=b-H,ee=W>0?(S-H)/W:0;return this.points[P].mult(1-ee).add(this.points[m].mult(ee))}}class Wr{constructor(a,m,b){const S=this.boxCells=[],P=this.circleCells=[];this.xCellCount=Math.ceil(a/b),this.yCellCount=Math.ceil(m/b);for(let H=0;H<this.xCellCount*this.yCellCount;H++)S.push([]),P.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=a,this.height=m,this.xScale=this.xCellCount/a,this.yScale=this.yCellCount/m,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(a,m,b,S,P){this._forEachCell(m,b,S,P,this._insertBoxCell,this.boxUid++),this.boxKeys.push(a),this.bboxes.push(m),this.bboxes.push(b),this.bboxes.push(S),this.bboxes.push(P)}insertCircle(a,m,b,S){this._forEachCell(m-S,b-S,m+S,b+S,this._insertCircleCell,this.circleUid++),this.circleKeys.push(a),this.circles.push(m),this.circles.push(b),this.circles.push(S)}_insertBoxCell(a,m,b,S,P,H){this.boxCells[P].push(H)}_insertCircleCell(a,m,b,S,P,H){this.circleCells[P].push(H)}_query(a,m,b,S,P,H){if(b<0||a>this.width||S<0||m>this.height)return!P&&[];const W=[];if(a<=0&&m<=0&&this.width<=b&&this.height<=S){if(P)return!0;for(let ee=0;ee<this.boxKeys.length;ee++)W.push({key:this.boxKeys[ee],x1:this.bboxes[4*ee],y1:this.bboxes[4*ee+1],x2:this.bboxes[4*ee+2],y2:this.bboxes[4*ee+3]});for(let ee=0;ee<this.circleKeys.length;ee++){const pe=this.circles[3*ee],fe=this.circles[3*ee+1],Se=this.circles[3*ee+2];W.push({key:this.circleKeys[ee],x1:pe-Se,y1:fe-Se,x2:pe+Se,y2:fe+Se})}return H?W.filter(H):W}return this._forEachCell(a,m,b,S,this._queryCell,W,{hitTest:P,seenUids:{box:{},circle:{}}},H),P?W.length>0:W}_queryCircle(a,m,b,S,P){const H=a-b,W=a+b,ee=m-b,pe=m+b;if(W<0||H>this.width||pe<0||ee>this.height)return!S&&[];const fe=[];return this._forEachCell(H,ee,W,pe,this._queryCellCircle,fe,{hitTest:S,circle:{x:a,y:m,radius:b},seenUids:{box:{},circle:{}}},P),S?fe.length>0:fe}query(a,m,b,S,P){return this._query(a,m,b,S,!1,P)}hitTest(a,m,b,S,P){return this._query(a,m,b,S,!0,P)}hitTestCircle(a,m,b,S){return this._queryCircle(a,m,b,!0,S)}_queryCell(a,m,b,S,P,H,W,ee){const pe=W.seenUids,fe=this.boxCells[P];if(fe!==null){const Qe=this.bboxes;for(const rt of fe)if(!pe.box[rt]){pe.box[rt]=!0;const nt=4*rt;if(a<=Qe[nt+2]&&m<=Qe[nt+3]&&b>=Qe[nt+0]&&S>=Qe[nt+1]&&(!ee||ee(this.boxKeys[rt]))){if(W.hitTest)return H.push(!0),!0;H.push({key:this.boxKeys[rt],x1:Qe[nt],y1:Qe[nt+1],x2:Qe[nt+2],y2:Qe[nt+3]})}}}const Se=this.circleCells[P];if(Se!==null){const Qe=this.circles;for(const rt of Se)if(!pe.circle[rt]){pe.circle[rt]=!0;const nt=3*rt;if(this._circleAndRectCollide(Qe[nt],Qe[nt+1],Qe[nt+2],a,m,b,S)&&(!ee||ee(this.circleKeys[rt]))){if(W.hitTest)return H.push(!0),!0;{const lt=Qe[nt],Xe=Qe[nt+1],Ye=Qe[nt+2];H.push({key:this.circleKeys[rt],x1:lt-Ye,y1:Xe-Ye,x2:lt+Ye,y2:Xe+Ye})}}}}}_queryCellCircle(a,m,b,S,P,H,W,ee){const pe=W.circle,fe=W.seenUids,Se=this.boxCells[P];if(Se!==null){const rt=this.bboxes;for(const nt of Se)if(!fe.box[nt]){fe.box[nt]=!0;const lt=4*nt;if(this._circleAndRectCollide(pe.x,pe.y,pe.radius,rt[lt+0],rt[lt+1],rt[lt+2],rt[lt+3])&&(!ee||ee(this.boxKeys[nt])))return H.push(!0),!0}}const Qe=this.circleCells[P];if(Qe!==null){const rt=this.circles;for(const nt of Qe)if(!fe.circle[nt]){fe.circle[nt]=!0;const lt=3*nt;if(this._circlesCollide(rt[lt],rt[lt+1],rt[lt+2],pe.x,pe.y,pe.radius)&&(!ee||ee(this.circleKeys[nt])))return H.push(!0),!0}}}_forEachCell(a,m,b,S,P,H,W,ee){const pe=this._convertToXCellCoord(a),fe=this._convertToYCellCoord(m),Se=this._convertToXCellCoord(b),Qe=this._convertToYCellCoord(S);for(let rt=pe;rt<=Se;rt++)for(let nt=fe;nt<=Qe;nt++)if(P.call(this,a,m,b,S,this.xCellCount*nt+rt,H,W,ee))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(a,m,b,S,P,H){const W=S-a,ee=P-m,pe=b+H;return pe*pe>W*W+ee*ee}_circleAndRectCollide(a,m,b,S,P,H,W){const ee=(H-S)/2,pe=Math.abs(a-(S+ee));if(pe>ee+b)return!1;const fe=(W-P)/2,Se=Math.abs(m-(P+fe));if(Se>fe+b)return!1;if(pe<=ee||Se<=fe)return!0;const Qe=pe-ee,rt=Se-fe;return Qe*Qe+rt*rt<=b*b}}const mr=Math.tan(85*Math.PI/180);function Mr(x,a,m,b,S,P,H){const W=i.create();if(m)if(P.name==="globe"){const ee=i.calculateGlobeLabelMatrix(S,a);i.multiply(W,W,ee)}else{const ee=Ke([],H);W[0]=ee[0],W[1]=ee[1],W[4]=ee[2],W[5]=ee[3],b||i.rotateZ(W,W,S.angle)}else i.multiply(W,S.labelPlaneMatrix,x);return W}function Oo(x,a,m,b,S,P,H){const W=Mr(x,a,m,b,S,P,H);return P.name==="globe"&&m||(W[2]=W[6]=W[10]=W[14]=0),W}function ks(x,a,m,b,S,P,H){if(m){if(P.name==="globe"){const W=Mr(x,a,m,b,S,P,H);return i.invert(W,W),i.multiply(W,x,W),W}{const W=i.clone(x),ee=i.identity([]);return ee[0]=H[0],ee[1]=H[1],ee[4]=H[2],ee[5]=H[3],i.multiply(W,W,ee),b||i.rotateZ(W,W,-S.angle),W}}return S.glCoordMatrix}function or(x,a,m,b){const S=[x,a,m,1];m?i.transformMat4$1(S,S,b):hs(S,S,b);const P=S[3];return S[0]/=P,S[1]/=P,S[2]/=P,S}function rn(x,a){return Math.min(.5+x/a*.5,1.5)}function cr(x,a){const m=x[0]/x[3],b=x[1]/x[3];return m>=-a[0]&&m<=a[0]&&b>=-a[1]&&b<=a[1]}function Ar(x,a,m,b,S,P,H,W,ee,pe){const fe=m.transform,Se=b?x.textSizeData:x.iconSizeData,Qe=i.evaluateSizeForZoom(Se,m.transform.zoom),rt=fe.projection.name==="globe",nt=[256/m.width*2+1,256/m.height*2+1],lt=b?x.text.dynamicLayoutVertexArray:x.icon.dynamicLayoutVertexArray;lt.clear();let Xe=null;rt&&(Xe=b?x.text.globeExtVertexArray:x.icon.globeExtVertexArray);const Ye=x.lineVertexArray,At=b?x.text.placedSymbolArray:x.icon.placedSymbolArray,ht=m.transform.width/m.transform.height;let Bt,Pt=!1;for(let It=0;It<At.length;It++){const Ht=At.get(It),{numGlyphs:hi,writingMode:si}=Ht;if(si!==i.WritingMode.vertical||Pt||Bt===i.WritingMode.horizontal||(Pt=!0),Bt=si,(Ht.hidden||si===i.WritingMode.vertical)&&!Pt){qs(hi,lt);continue}Pt=!1;const qt=new i.pointGeometry(Ht.tileAnchorX,Ht.tileAnchorY);let{x:ji,y:Kt,z:Bi}=fe.projection.projectTilePoint(qt.x,qt.y,pe.canonical);if(ee){const[Hn,Mn,$n]=ee(qt);ji+=Hn,Kt+=Mn,Bi+=$n}const di=[ji,Kt,Bi,1];if(i.transformMat4$1(di,di,a),!cr(di,nt)){qs(hi,lt);continue}const Ri=rn(m.transform.cameraToCenterDistance,di[3]),Ai=i.evaluateSizeForFeature(Se,Qe,Ht),Mi=H?Ai/Ri:Ai*Ri,$i=or(ji,Kt,Bi,S);if($i[3]<=0){qs(hi,lt);continue}let Jt={};const pi=H?null:ee,In=dr(Ht,Mi,!1,W,a,S,P,x.glyphOffsetArray,Ye,lt,Xe,$i,qt,Jt,ht,pi,fe.projection,pe,H);Pt=In.useVertical,pi&&In.needsFlipping&&(Jt={}),(In.notEnoughRoom||Pt||In.needsFlipping&&dr(Ht,Mi,!0,W,a,S,P,x.glyphOffsetArray,Ye,lt,Xe,$i,qt,Jt,ht,pi,fe.projection,pe,H).notEnoughRoom)&&qs(hi,lt)}b?(x.text.dynamicLayoutVertexBuffer.updateData(lt),Xe&&x.text.globeExtVertexBuffer.updateData(Xe)):(x.icon.dynamicLayoutVertexBuffer.updateData(lt),Xe&&x.icon.globeExtVertexBuffer.updateData(Xe))}function la(x,a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt){const{lineStartIndex:Xe,glyphStartIndex:Ye,segment:At}=W,ht=Ye+W.numGlyphs,Bt=Xe+W.lineLength,Pt=a.getoffsetX(Ye),It=a.getoffsetX(ht-1),Ht=ll(x*Pt,m,b,S,P,H,At,Xe,Bt,ee,pe,fe,Se,Qe,!0,rt,nt,lt);if(!Ht)return null;const hi=ll(x*It,m,b,S,P,H,At,Xe,Bt,ee,pe,fe,Se,Qe,!0,rt,nt,lt);return hi?{first:Ht,last:hi}:null}function al(x,a,m,b){return x===i.WritingMode.horizontal&&Math.abs(b)>Math.abs(m)?{useVertical:!0}:x===i.WritingMode.vertical?b>0?{needsFlipping:!0}:null:a!==0&&function(S,P){return S===0||Math.abs(P/S)>mr}(m,b)?a===1?{needsFlipping:!0}:null:m<0?{needsFlipping:!0}:null}function dr(x,a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt,Xe,Ye,At){const ht=a/24,Bt=x.lineOffsetX*ht,Pt=x.lineOffsetY*ht,{lineStartIndex:It,glyphStartIndex:Ht,numGlyphs:hi,segment:si,writingMode:qt,flipState:ji}=x,Kt=It+x.lineLength,Bi=di=>{if(fe){const[$i,Jt,pi]=di.up,In=pe.length;i.updateGlobeVertexNormal(fe,In+0,$i,Jt,pi),i.updateGlobeVertexNormal(fe,In+1,$i,Jt,pi),i.updateGlobeVertexNormal(fe,In+2,$i,Jt,pi),i.updateGlobeVertexNormal(fe,In+3,$i,Jt,pi)}const[Ri,Ai,Mi]=di.point;i.addDynamicAttributes(pe,Ri,Ai,Mi,di.angle)};if(hi>1){const di=la(ht,W,Bt,Pt,m,Se,Qe,x,ee,P,rt,lt,!1,Xe,Ye,At);if(!di)return{notEnoughRoom:!0};if(b&&!m){let[Ri,Ai,Mi]=di.first.point,[$i,Jt,pi]=di.last.point;[Ri,Ai]=or(Ri,Ai,Mi,H),[$i,Jt]=or($i,Jt,pi,H);const In=al(qt,ji,($i-Ri)*nt,Jt-Ai);if(x.flipState=In&&In.needsFlipping?1:2,In)return In}Bi(di.first);for(let Ri=Ht+1;Ri<Ht+hi-1;Ri++){const Ai=ll(ht*W.getoffsetX(Ri),Bt,Pt,m,Se,Qe,si,It,Kt,ee,P,rt,lt,!1,!1,Xe,Ye,At);if(!Ai)return pe.length-=4*(Ri-Ht),{notEnoughRoom:!0};Bi(Ai)}Bi(di.last)}else{if(b&&!m){const Ri=or(Qe.x,Qe.y,0,S),Ai=It+si+1,Mi=new i.pointGeometry(ee.getx(Ai),ee.gety(Ai)),$i=or(Mi.x,Mi.y,0,S),Jt=$i[3]>0?$i:Rl(Qe,Mi,Ri,1,S,void 0,Xe,Ye.canonical),pi=al(qt,ji,(Jt[0]-Ri[0])*nt,Jt[1]-Ri[1]);if(x.flipState=pi&&pi.needsFlipping?1:2,pi)return pi}const di=ll(ht*W.getoffsetX(Ht),Bt,Pt,m,Se,Qe,si,It,Kt,ee,P,rt,lt,!1,!1,Xe,Ye,At);if(!di)return{notEnoughRoom:!0};Bi(di)}return{}}function Ul(x,a,m,b,S){const{x:P,y:H,z:W}=b.projectTilePoint(x.x,x.y,a);if(!S)return or(P,H,W,m);const[ee,pe,fe]=S(x);return or(P+ee,H+pe,W+fe,m)}function Rl(x,a,m,b,S,P,H,W){const ee=Ul(x.sub(a)._unit()._add(x),W,S,H,P);return i.sub(ee,m,ee),i.normalize(ee,ee),i.scaleAndAdd(ee,m,ee,b)}function ll(x,a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt,Xe,Ye){const At=b?x-a:x+a;let ht=At>0?1:-1,Bt=0;b&&(ht*=-1,Bt=Math.PI),ht<0&&(Bt+=Math.PI);let Pt=W+H+(ht>0?0:1)|0,It=S,Ht=S,hi=0,si=0;const qt=Math.abs(At),ji=[],Kt=[];let Bi=P,di=Bi;const Ri=()=>Rl(di,Bi,Ht,qt-hi+1,fe,Qe,lt,Xe.canonical);for(;hi+si<=qt;){if(Pt+=ht,Pt<W||Pt>=ee)return null;if(Ht=It,di=Bi,ji.push(Ht),rt&&Kt.push(di),Bi=new i.pointGeometry(pe.getx(Pt),pe.gety(Pt)),It=Se[Pt],!It){const $n=Ul(Bi,Xe.canonical,fe,lt,Qe);It=$n[3]>0?Se[Pt]=$n:Ri()}hi+=si,si=i.distance(Ht,It)}nt&&Qe&&(Se[Pt]&&(It=Ri(),si=i.distance(Ht,It)),Se[Pt]=It);const Ai=(qt-hi)/si,Mi=Bi.sub(di)._mult(Ai)._add(di),$i=i.sub([],It,Ht),Jt=i.scaleAndAdd([],Ht,$i,Ai);let pi=[0,0,1],In=$i[0],Hn=$i[1];if(Ye&&(pi=lt.upVector(Xe.canonical,Mi.x,Mi.y),pi[0]!==0||pi[1]!==0||pi[2]!==1)){const $n=[pi[2],0,-pi[0]],ar=i.cross([],pi,$n);i.normalize($n,$n),i.normalize(ar,ar),In=i.dot($i,$n),Hn=i.dot($i,ar)}if(m){const $n=i.cross([],pi,$i);i.normalize($n,$n),i.scaleAndAdd(Jt,Jt,$n,m*ht)}const Mn=Bt+Math.atan2(Hn,In);return ji.push(Jt),rt&&Kt.push(Mi),{point:Jt,angle:Mn,path:ji,tilePath:Kt,up:pi}}function qs(x,a){const m=a.length,b=m+4*x;a.resize(b),a.float32.fill(-1/0,4*m,4*b)}function hs(x,a,m){const b=a[0],S=a[1];return x[0]=m[0]*b+m[4]*S+m[12],x[1]=m[1]*b+m[5]*S+m[13],x[3]=m[3]*b+m[7]*S+m[15],x}const ho=100;class cl{constructor(a,m,b=new Wr(a.width+200,a.height+200,25),S=new Wr(a.width+200,a.height+200,25)){this.transform=a,this.grid=b,this.ignoredGrid=S,this.pitchfactor=Math.cos(a._pitch)*a.cameraToCenterDistance,this.screenRightBoundary=a.width+ho,this.screenBottomBoundary=a.height+ho,this.gridRightBoundary=a.width+200,this.gridBottomBoundary=a.height+200,this.fogState=m}placeCollisionBox(a,m,b,S,P,H,W,ee){let pe=b.projectedAnchorX,fe=b.projectedAnchorY,Se=b.projectedAnchorZ;const Qe=b.elevation,rt=b.tileID,nt=a.getProjection();if(Qe&&rt){const[It,Ht,hi]=nt.upVector(rt.canonical,b.tileAnchorX,b.tileAnchorY),si=nt.upVectorScale(rt.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;pe+=It*Qe*si,fe+=Ht*Qe*si,Se+=hi*Qe*si}const lt=this.projectAndGetPerspectiveRatio(W,pe,fe,Se,b.tileID,nt.name==="globe"||!!Qe||this.transform.pitch>0,nt),Xe=H*lt.perspectiveRatio,Ye=(b.x1*m+S.x-b.padding)*Xe+lt.point.x,At=(b.y1*m+S.y-b.padding)*Xe+lt.point.y,ht=(b.x2*m+S.x+b.padding)*Xe+lt.point.x,Bt=(b.y2*m+S.y+b.padding)*Xe+lt.point.y,Pt=lt.perspectiveRatio<=.55||lt.occluded;return!this.isInsideGrid(Ye,At,ht,Bt)||!P&&this.grid.hitTest(Ye,At,ht,Bt,ee)||Pt?{box:[],offscreen:!1,occluded:lt.occluded}:{box:[Ye,At,ht,Bt],offscreen:this.isOffscreen(Ye,At,ht,Bt),occluded:!1}}placeCollisionCircles(a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt){const Xe=[],Ye=this.transform.elevation,At=a.getProjection(),ht=Ye?Ye.getAtTileOffsetFunc(lt,this.transform.center.lat,this.transform.worldSize,At):null,Bt=new i.pointGeometry(b.tileAnchorX,b.tileAnchorY);let{x:Pt,y:It,z:Ht}=At.projectTilePoint(Bt.x,Bt.y,lt.canonical);if(ht){const[Mi,$i,Jt]=ht(Bt);Pt+=Mi,It+=$i,Ht+=Jt}const hi=At.name==="globe",si=this.projectAndGetPerspectiveRatio(W,Pt,It,Ht,lt,hi||!!Ye||this.transform.pitch>0,At),{perspectiveRatio:qt}=si,ji=(Se?H/qt:H*qt)/i.ONE_EM,Kt=or(Pt,It,Ht,ee),Bi=si.signedDistanceFromCamera>0?la(ji,P,b.lineOffsetX*ji,b.lineOffsetY*ji,!1,Kt,Bt,b,S,ee,{},Ye&&!Se?ht:null,Se&&!!Ye,At,lt,Se):null;let di=!1,Ri=!1,Ai=!0;if(Bi&&!si.occluded){const Mi=.5*rt*qt+nt,$i=new i.pointGeometry(-100,-100),Jt=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),pi=new Yn,{first:In,last:Hn}=Bi,Mn=In.path.length;let $n=[];for(let _n=Mn-1;_n>=1;_n--)$n.push(In.path[_n]);for(let _n=1;_n<Hn.path.length;_n++)$n.push(Hn.path[_n]);const ar=2.5*Mi;pe&&($n=$n.map(([_n,Dr,Or],Nr)=>(ht&&!hi&&(Or=ht(Nr<Mn-1?In.tilePath[Mn-1-Nr]:Hn.tilePath[Nr-Mn+2])[2]),or(_n,Dr,Or,pe))),$n.some(_n=>_n[3]<=0)&&($n=[]));let On=[];if($n.length>0){let _n=1/0,Dr=-1/0,Or=1/0,Nr=-1/0;for(const Qr of $n)_n=Math.min(_n,Qr[0]),Or=Math.min(Or,Qr[1]),Dr=Math.max(Dr,Qr[0]),Nr=Math.max(Nr,Qr[1]);Dr>=$i.x&&_n<=Jt.x&&Nr>=$i.y&&Or<=Jt.y&&(On=[$n.map(Qr=>new i.pointGeometry(Qr[0],Qr[1]))],(_n<$i.x||Dr>Jt.x||Or<$i.y||Nr>Jt.y)&&(On=i.clipLine(On,$i.x,$i.y,Jt.x,Jt.y)))}for(const _n of On){pi.reset(_n,.25*Mi);let Dr=0;Dr=pi.length<=.5*Mi?1:Math.ceil(pi.paddedLength/ar)+1;for(let Or=0;Or<Dr;Or++){const Nr=Or/Math.max(Dr-1,1),Qr=pi.lerp(Nr),go=Qr.x+ho,Ca=Qr.y+ho;Xe.push(go,Ca,Mi,0);const jo=go-Mi,ws=Ca-Mi,_r=go+Mi,Xr=Ca+Mi;if(Ai=Ai&&this.isOffscreen(jo,ws,_r,Xr),Ri=Ri||this.isInsideGrid(jo,ws,_r,Xr),!m&&this.grid.hitTestCircle(go,Ca,Mi,Qe)&&(di=!0,!fe))return{circles:[],offscreen:!1,collisionDetected:di,occluded:!1}}}}return{circles:!fe&&di||!Ri?[]:Xe,offscreen:Ai,collisionDetected:di,occluded:si.occluded}}queryRenderedSymbols(a){if(a.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const m=[];let b=1/0,S=1/0,P=-1/0,H=-1/0;for(const fe of a){const Se=new i.pointGeometry(fe.x+ho,fe.y+ho);b=Math.min(b,Se.x),S=Math.min(S,Se.y),P=Math.max(P,Se.x),H=Math.max(H,Se.y),m.push(Se)}const W=this.grid.query(b,S,P,H).concat(this.ignoredGrid.query(b,S,P,H)),ee={},pe={};for(const fe of W){const Se=fe.key;if(ee[Se.bucketInstanceId]===void 0&&(ee[Se.bucketInstanceId]={}),ee[Se.bucketInstanceId][Se.featureIndex])continue;const Qe=[new i.pointGeometry(fe.x1,fe.y1),new i.pointGeometry(fe.x2,fe.y1),new i.pointGeometry(fe.x2,fe.y2),new i.pointGeometry(fe.x1,fe.y2)];i.polygonIntersectsPolygon(m,Qe)&&(ee[Se.bucketInstanceId][Se.featureIndex]=!0,pe[Se.bucketInstanceId]===void 0&&(pe[Se.bucketInstanceId]=[]),pe[Se.bucketInstanceId].push(Se.featureIndex))}return pe}insertCollisionBox(a,m,b,S,P){(m?this.ignoredGrid:this.grid).insert({bucketInstanceId:b,featureIndex:S,collisionGroupID:P},a[0],a[1],a[2],a[3])}insertCollisionCircles(a,m,b,S,P){const H=m?this.ignoredGrid:this.grid,W={bucketInstanceId:b,featureIndex:S,collisionGroupID:P};for(let ee=0;ee<a.length;ee+=4)H.insertCircle(W,a[ee],a[ee+1],a[ee+2])}projectAndGetPerspectiveRatio(a,m,b,S,P,H,W){const ee=[m,b,S,1];let pe=!1;if(S||this.transform.pitch>0){i.transformMat4$1(ee,ee,a);const Se=W.name==="globe";this.fogState&&P&&!Se&&(pe=function(rt,nt,lt,Xe,Ye,At){const ht=At.calculateFogTileMatrix(Ye),Bt=[nt,lt,Xe];return i.transformMat4(Bt,Bt,ht),Ne(rt,Bt,At.pitch,At._fov)}(this.fogState,m,b,S,P.toUnwrapped(),this.transform)>.9)}else hs(ee,ee,a);const fe=ee[3];return{point:new i.pointGeometry((ee[0]/fe+1)/2*this.transform.width+ho,(-ee[1]/fe+1)/2*this.transform.height+ho),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(W)/fe*.5,1.5),signedDistanceFromCamera:fe,occluded:H&&ee[2]>fe||pe}}isOffscreen(a,m,b,S){return b<ho||a>=this.screenRightBoundary||S<ho||m>this.screenBottomBoundary}isInsideGrid(a,m,b,S){return b>=0&&a<this.gridRightBoundary&&S>=0&&m<this.gridBottomBoundary}getViewportMatrix(){const a=i.identity([]);return i.translate(a,a,[-100,-100,0]),a}}function Na(x,a,m){const b=a.createTileMatrix(x,x.worldSize,m.toUnwrapped());return i.multiply(new Float32Array(16),x.projMatrix,b)}function zl(x,a,m){if(a.projection.name===m.projection.name)return x.projMatrix;const b=m.clone();return b.setProjection(a.projection),Na(b,a.getProjection(),x)}function kl(x,a,m){return a.name===m.projection.name?x.projMatrix:Na(m,a,x)}class Ol{constructor(a,m,b,S){this.opacity=a?Math.max(0,Math.min(1,a.opacity+(a.placed?m:-m))):S&&b?1:0,this.placed=b}isHidden(){return this.opacity===0&&!this.placed}}class Qa{constructor(a,m,b,S,P,H=!1){this.text=new Ol(a?a.text:null,m,b,P),this.icon=new Ol(a?a.icon:null,m,S,P),this.clipped=H}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Nl{constructor(a,m,b,S=!1){this.text=a,this.icon=m,this.skipFade=b,this.clipped=S}}class Ql{constructor(){this.invProjMatrix=i.create(),this.viewportMatrix=i.create(),this.circles=[]}}class ns{constructor(a,m,b,S,P){this.bucketInstanceId=a,this.featureIndex=m,this.sourceLayerIndex=b,this.bucketIndex=S,this.tileID=P}}class Ys{constructor(a){this.crossSourceCollisions=a,this.maxGroupID=0,this.collisionGroups={}}get(a){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[a]){const m=++this.maxGroupID;this.collisionGroups[a]={ID:m,predicate:b=>b.collisionGroupID===m}}return this.collisionGroups[a]}}function fs(x,a,m,b,S){const{horizontalAlign:P,verticalAlign:H}=i.getAnchorAlignment(x),W=-(P-.5)*a,ee=-(H-.5)*m,pe=i.evaluateVariableOffset(x,b);return new i.pointGeometry(W+pe[0]*S,ee+pe[1]*S)}function Rc(x,a,m,b,S){const P=new i.pointGeometry(x,a);return m&&P._rotate(b?S:-S),P}class Eh{constructor(a,m,b,S,P){this.transform=a.clone(),this.projection=a.projection.name,this.collisionIndex=new cl(this.transform,P),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Ys(b),this.collisionCircleArrays={},this.prevPlacement=S,S&&(S.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(a,m,b,S){const P=b.getBucket(m),H=b.latestFeatureIndex;if(!P||!H||m.id!==P.layerIds[0])return;const W=P.layers[0].layout,ee=b.collisionBoxArray,pe=Math.pow(2,this.transform.zoom-b.tileID.overscaledZ),fe=b.tileSize/i.EXTENT,Se=b.tileID.toUnwrapped();this.transform.setProjection(P.projection);const Qe=(rt=b.tileID,nt=P.getProjection(),lt=this.transform,nt.name===this.projection?lt.calculateProjMatrix(rt.toUnwrapped()):Na(lt,nt,rt));var rt,nt,lt;const Xe=W.get("text-pitch-alignment")==="map",Ye=W.get("text-rotation-alignment")==="map";m.compileFilter();const At=m.dynamicFilter(),ht=m.dynamicFilterNeedsFeature(),Bt=this.transform.calculatePixelsToTileUnitsMatrix(b),Pt=Oo(Qe,b.tileID.canonical,Xe,Ye,this.transform,P.getProjection(),Bt);let It=null;if(Xe){const si=ks(Qe,b.tileID.canonical,Xe,Ye,this.transform,P.getProjection(),Bt);It=i.multiply([],this.transform.labelPlaneMatrix,si)}let Ht=null;At&&b.latestFeatureIndex&&(Ht={unwrappedTileID:Se,dynamicFilter:At,dynamicFilterNeedsFeature:ht,featureIndex:b.latestFeatureIndex}),this.retainedQueryData[P.bucketInstanceId]=new ns(P.bucketInstanceId,H,P.sourceLayerIndex,P.index,b.tileID);const hi={bucket:P,layout:W,posMatrix:Qe,textLabelPlaneMatrix:Pt,labelToScreenMatrix:It,clippingData:Ht,scale:pe,textPixelRatio:fe,holdingForFade:b.holdingForFade(),collisionBoxArray:ee,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(P.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(P.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(P.sourceID)};if(S)for(const si of P.sortKeyRanges){const{sortKey:qt,symbolInstanceStart:ji,symbolInstanceEnd:Kt}=si;a.push({sortKey:qt,symbolInstanceStart:ji,symbolInstanceEnd:Kt,parameters:hi})}else a.push({symbolInstanceStart:0,symbolInstanceEnd:P.symbolInstances.length,parameters:hi})}attemptAnchorPlacement(a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt,Xe,Ye,At){const{textOffset0:ht,textOffset1:Bt,crossTileID:Pt}=Qe,It=[ht,Bt],Ht=fs(a,b,S,It,P),hi=this.collisionIndex.placeCollisionBox(nt,P,m,Rc(Ht.x,Ht.y,H,W,this.transform.angle),Se,ee,pe,fe.predicate);if(Xe){const si=nt.getSymbolInstanceIconSize(At,this.transform.zoom,Qe.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(nt,si,Xe,Rc(Ht.x,Ht.y,H,W,this.transform.angle),Se,ee,pe,fe.predicate).box.length===0)return}if(hi.box.length>0){let si;return this.prevPlacement&&this.prevPlacement.variableOffsets[Pt]&&this.prevPlacement.placements[Pt]&&this.prevPlacement.placements[Pt].text&&(si=this.prevPlacement.variableOffsets[Pt].anchor),this.variableOffsets[Pt]={textOffset:It,width:b,height:S,anchor:a,textScale:P,prevAnchor:si},this.markUsedJustification(nt,a,Qe,lt),nt.allowVerticalPlacement&&(this.markUsedOrientation(nt,lt,Qe),this.placedOrientations[Pt]=lt),{shift:Ht,placedGlyphBoxes:hi}}}placeLayerBucketPart(a,m,b,S){const{bucket:P,layout:H,posMatrix:W,textLabelPlaneMatrix:ee,labelToScreenMatrix:pe,clippingData:fe,textPixelRatio:Se,holdingForFade:Qe,collisionBoxArray:rt,partiallyEvaluatedTextSize:nt,partiallyEvaluatedIconSize:lt,collisionGroup:Xe}=a.parameters,Ye=H.get("text-optional"),At=H.get("icon-optional"),ht=H.get("text-allow-overlap"),Bt=H.get("icon-allow-overlap"),Pt=H.get("text-rotation-alignment")==="map",It=H.get("text-pitch-alignment")==="map",Ht=H.get("icon-text-fit")!=="none",hi=H.get("symbol-z-order")==="viewport-y";this.transform.setProjection(P.projection);let si=ht&&(Bt||!P.hasIconData()||At),qt=Bt&&(ht||!P.hasTextData()||Ye);!P.collisionArrays&&rt&&P.deserializeCollisionBoxes(rt),b&&S&&P.updateCollisionDebugBuffers(this.transform.zoom,rt);const ji=(Kt,Bi,di)=>{const{crossTileID:Ri,numVerticalGlyphVertices:Ai}=Kt;if(fe){const _r={zoom:this.transform.zoom,pitch:this.transform.pitch};let Xr=null;if(fe.dynamicFilterNeedsFeature){const Fr=this.retainedQueryData[P.bucketInstanceId];Xr=fe.featureIndex.loadFeature({featureIndex:Kt.featureIndex,bucketIndex:Fr.bucketIndex,sourceLayerIndex:Fr.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,fe.dynamicFilter)(_r,Xr,this.retainedQueryData[P.bucketInstanceId].tileID.canonical,new i.pointGeometry(Kt.tileAnchorX,Kt.tileAnchorY),this.transform.calculateDistanceTileData(fe.unwrappedTileID)))return this.placements[Ri]=new Nl(!1,!1,!1,!0),void(m[Ri]=!0)}if(m[Ri])return;if(Qe)return void(this.placements[Ri]=new Nl(!1,!1,!1));let Mi=!1,$i=!1,Jt=!0,pi=!1,In=!1,Hn=null,Mn={box:null,offscreen:null,occluded:null},$n={box:null,offscreen:null,occluded:null},ar=null,On=null,_n=null,Dr=0,Or=0,Nr=0;di.textFeatureIndex?Dr=di.textFeatureIndex:Kt.useRuntimeCollisionCircles&&(Dr=Kt.featureIndex),di.verticalTextFeatureIndex&&(Or=di.verticalTextFeatureIndex);const Qr=_r=>{_r.tileID=this.retainedQueryData[P.bucketInstanceId].tileID;const Xr=this.transform.elevation;(Xr||_r.elevation)&&(_r.elevation=Xr?Xr.getAtTileOffset(_r.tileID,_r.tileAnchorX,_r.tileAnchorY):0)},go=di.textBox;if(go){Qr(go);const _r=Fr=>{let Ls=i.WritingMode.horizontal;if(P.allowVerticalPlacement&&!Fr&&this.prevPlacement){const eo=this.prevPlacement.placedOrientations[Ri];eo&&(this.placedOrientations[Ri]=eo,Ls=eo,this.markUsedOrientation(P,Ls,Kt))}return Ls},Xr=(Fr,Ls)=>{if(P.allowVerticalPlacement&&Ai>0&&di.verticalTextBox){for(const eo of P.writingModes)if(eo===i.WritingMode.vertical?(Mn=Ls(),$n=Mn):Mn=Fr(),Mn&&Mn.box&&Mn.box.length)break}else Mn=Fr()};if(H.get("text-variable-anchor")){let Fr=H.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ri]){const rs=this.prevPlacement.variableOffsets[Ri];Fr.indexOf(rs.anchor)>0&&(Fr=Fr.filter(Io=>Io!==rs.anchor),Fr.unshift(rs.anchor))}const Ls=(rs,Io,bu)=>{const Ka=P.getSymbolInstanceTextSize(nt,Kt,this.transform.zoom,Bi),_o=(rs.x2-rs.x1)*Ka+2*rs.padding,Ea=(rs.y2-rs.y1)*Ka+2*rs.padding,vl=Ht&&!Bt?Io:null;vl&&Qr(vl);let Zl={box:[],offscreen:!1,occluded:!1};const $h=ht?2*Fr.length:Fr.length;for(let Zh=0;Zh<$h;++Zh){const $a=this.attemptAnchorPlacement(Fr[Zh%Fr.length],rs,_o,Ea,Ka,Pt,It,Se,W,Xe,Zh>=Fr.length,Kt,Bi,P,bu,vl,nt,lt);if($a&&(Zl=$a.placedGlyphBoxes,Zl&&Zl.box&&Zl.box.length)){Mi=!0,Hn=$a.shift;break}}return Zl};Xr(()=>Ls(go,di.iconBox,i.WritingMode.horizontal),()=>{const rs=di.verticalTextBox;return rs&&Qr(rs),P.allowVerticalPlacement&&!(Mn&&Mn.box&&Mn.box.length)&&Ai>0&&rs?Ls(rs,di.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null,occluded:null}}),Mn&&(Mi=Mn.box,Jt=Mn.offscreen,pi=Mn.occluded);const eo=_r(Mn&&Mn.box);if(!Mi&&this.prevPlacement){const rs=this.prevPlacement.variableOffsets[Ri];rs&&(this.variableOffsets[Ri]=rs,this.markUsedJustification(P,rs.anchor,Kt,eo))}}else{const Fr=(Ls,eo)=>{const rs=P.getSymbolInstanceTextSize(nt,Kt,this.transform.zoom,Bi),Io=this.collisionIndex.placeCollisionBox(P,rs,Ls,new i.pointGeometry(0,0),ht,Se,W,Xe.predicate);return Io&&Io.box&&Io.box.length&&(this.markUsedOrientation(P,eo,Kt),this.placedOrientations[Ri]=eo),Io};Xr(()=>Fr(go,i.WritingMode.horizontal),()=>{const Ls=di.verticalTextBox;return P.allowVerticalPlacement&&Ai>0&&Ls?(Qr(Ls),Fr(Ls,i.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}}),_r(Mn&&Mn.box&&Mn.box.length)}}if(ar=Mn,Mi=ar&&ar.box&&ar.box.length>0,Jt=ar&&ar.offscreen,pi=ar&&ar.occluded,Kt.useRuntimeCollisionCircles){const _r=P.text.placedSymbolArray.get(Kt.centerJustifiedTextSymbolIndex>=0?Kt.centerJustifiedTextSymbolIndex:Kt.verticalPlacedTextSymbolIndex),Xr=i.evaluateSizeForFeature(P.textSizeData,nt,_r),Fr=H.get("text-padding");On=this.collisionIndex.placeCollisionCircles(P,ht,_r,P.lineVertexArray,P.glyphOffsetArray,Xr,W,ee,pe,b,It,Xe.predicate,Kt.collisionCircleDiameter*Xr/i.ONE_EM,Fr,this.retainedQueryData[P.bucketInstanceId].tileID),Mi=ht||On.circles.length>0&&!On.collisionDetected,Jt=Jt&&On.offscreen,pi=On.occluded}if(di.iconFeatureIndex&&(Nr=di.iconFeatureIndex),di.iconBox){const _r=Xr=>{Qr(Xr);const Fr=Ht&&Hn?Rc(Hn.x,Hn.y,Pt,It,this.transform.angle):new i.pointGeometry(0,0),Ls=P.getSymbolInstanceIconSize(lt,this.transform.zoom,Kt.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(P,Ls,Xr,Fr,Bt,Se,W,Xe.predicate)};$n&&$n.box&&$n.box.length&&di.verticalIconBox?(_n=_r(di.verticalIconBox),$i=_n.box.length>0):(_n=_r(di.iconBox),$i=_n.box.length>0),Jt=Jt&&_n.offscreen,In=_n.occluded}const Ca=Ye||Kt.numHorizontalGlyphVertices===0&&Ai===0,jo=At||Kt.numIconVertices===0;if(Ca||jo?jo?Ca||($i=$i&&Mi):Mi=$i&&Mi:$i=Mi=$i&&Mi,Mi&&ar&&ar.box&&this.collisionIndex.insertCollisionBox(ar.box,H.get("text-ignore-placement"),P.bucketInstanceId,$n&&$n.box&&Or?Or:Dr,Xe.ID),$i&&_n&&this.collisionIndex.insertCollisionBox(_n.box,H.get("icon-ignore-placement"),P.bucketInstanceId,Nr,Xe.ID),On&&(Mi&&this.collisionIndex.insertCollisionCircles(On.circles,H.get("text-ignore-placement"),P.bucketInstanceId,Dr,Xe.ID),b)){const _r=P.bucketInstanceId;let Xr=this.collisionCircleArrays[_r];Xr===void 0&&(Xr=this.collisionCircleArrays[_r]=new Ql);for(let Fr=0;Fr<On.circles.length;Fr+=4)Xr.circles.push(On.circles[Fr+0]),Xr.circles.push(On.circles[Fr+1]),Xr.circles.push(On.circles[Fr+2]),Xr.circles.push(On.collisionDetected?1:0)}const ws=P.projection.name!=="globe";si=si&&(ws||!pi),qt=qt&&(ws||!In),this.placements[Ri]=new Nl(Mi||si,$i||qt,Jt||P.justReloaded),m[Ri]=!0};if(hi){const Kt=P.getSortedSymbolIndexes(this.transform.angle);for(let Bi=Kt.length-1;Bi>=0;--Bi){const di=Kt[Bi];ji(P.symbolInstances.get(di),di,P.collisionArrays[di])}}else for(let Kt=a.symbolInstanceStart;Kt<a.symbolInstanceEnd;Kt++)ji(P.symbolInstances.get(Kt),Kt,P.collisionArrays[Kt]);if(b&&P.bucketInstanceId in this.collisionCircleArrays){const Kt=this.collisionCircleArrays[P.bucketInstanceId];i.invert(Kt.invProjMatrix,W),Kt.viewportMatrix=this.collisionIndex.getViewportMatrix()}P.justReloaded=!1}markUsedJustification(a,m,b,S){const{leftJustifiedTextSymbolIndex:P,centerJustifiedTextSymbolIndex:H,rightJustifiedTextSymbolIndex:W,verticalPlacedTextSymbolIndex:ee,crossTileID:pe}=b,fe=i.getAnchorJustification(m),Se=S===i.WritingMode.vertical?ee:fe==="left"?P:fe==="center"?H:fe==="right"?W:-1;P>=0&&(a.text.placedSymbolArray.get(P).crossTileID=Se>=0&&P!==Se?0:pe),H>=0&&(a.text.placedSymbolArray.get(H).crossTileID=Se>=0&&H!==Se?0:pe),W>=0&&(a.text.placedSymbolArray.get(W).crossTileID=Se>=0&&W!==Se?0:pe),ee>=0&&(a.text.placedSymbolArray.get(ee).crossTileID=Se>=0&&ee!==Se?0:pe)}markUsedOrientation(a,m,b){const S=m===i.WritingMode.horizontal||m===i.WritingMode.horizontalOnly?m:0,P=m===i.WritingMode.vertical?m:0,{leftJustifiedTextSymbolIndex:H,centerJustifiedTextSymbolIndex:W,rightJustifiedTextSymbolIndex:ee,verticalPlacedTextSymbolIndex:pe}=b,fe=a.text.placedSymbolArray;H>=0&&(fe.get(H).placedOrientation=S),W>=0&&(fe.get(W).placedOrientation=S),ee>=0&&(fe.get(ee).placedOrientation=S),pe>=0&&(fe.get(pe).placedOrientation=P)}commit(a){this.commitTime=a,this.zoomAtLastRecencyCheck=this.transform.zoom;const m=this.prevPlacement;let b=!1;this.prevZoomAdjustment=m?m.zoomAdjustment(this.transform.zoom):0;const S=m?m.symbolFadeChange(a):1,P=m?m.opacities:{},H=m?m.variableOffsets:{},W=m?m.placedOrientations:{};for(const ee in this.placements){const pe=this.placements[ee],fe=P[ee];fe?(this.opacities[ee]=new Qa(fe,S,pe.text,pe.icon,null,pe.clipped),b=b||pe.text!==fe.text.placed||pe.icon!==fe.icon.placed):(this.opacities[ee]=new Qa(null,S,pe.text,pe.icon,pe.skipFade,pe.clipped),b=b||pe.text||pe.icon)}for(const ee in P){const pe=P[ee];if(!this.opacities[ee]){const fe=new Qa(pe,S,!1,!1);fe.isHidden()||(this.opacities[ee]=fe,b=b||pe.text.placed||pe.icon.placed)}}for(const ee in H)this.variableOffsets[ee]||!this.opacities[ee]||this.opacities[ee].isHidden()||(this.variableOffsets[ee]=H[ee]);for(const ee in W)this.placedOrientations[ee]||!this.opacities[ee]||this.opacities[ee].isHidden()||(this.placedOrientations[ee]=W[ee]);b?this.lastPlacementChangeTime=a:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=m?m.lastPlacementChangeTime:a)}updateLayerOpacities(a,m){const b={};for(const S of m){const P=S.getBucket(a);P&&S.latestFeatureIndex&&a.id===P.layerIds[0]&&this.updateBucketOpacities(P,b,S.collisionBoxArray)}}updateBucketOpacities(a,m,b){a.hasTextData()&&a.text.opacityVertexArray.clear(),a.hasIconData()&&a.icon.opacityVertexArray.clear(),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexArray.clear(),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexArray.clear();const S=a.layers[0].layout,P=!!a.layers[0].dynamicFilter(),H=new Qa(null,0,!1,!1,!0),W=S.get("text-allow-overlap"),ee=S.get("icon-allow-overlap"),pe=S.get("text-variable-anchor"),fe=S.get("text-rotation-alignment")==="map",Se=S.get("text-pitch-alignment")==="map",Qe=S.get("icon-text-fit")!=="none",rt=new Qa(null,0,W&&(ee||!a.hasIconData()||S.get("icon-optional")),ee&&(W||!a.hasTextData()||S.get("text-optional")),!0);!a.collisionArrays&&b&&(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData())&&a.deserializeCollisionBoxes(b);const nt=(Xe,Ye,At)=>{for(let ht=0;ht<Ye/4;ht++)Xe.opacityVertexArray.emplaceBack(At)};let lt=0;for(let Xe=0;Xe<a.symbolInstances.length;Xe++){const Ye=a.symbolInstances.get(Xe),{numHorizontalGlyphVertices:At,numVerticalGlyphVertices:ht,crossTileID:Bt,numIconVertices:Pt}=Ye;let It=this.opacities[Bt];m[Bt]?It=H:It||(It=rt,this.opacities[Bt]=It),m[Bt]=!0;const Ht=At>0||ht>0,hi=Pt>0,si=this.placedOrientations[Bt],qt=si===i.WritingMode.vertical,ji=si===i.WritingMode.horizontal||si===i.WritingMode.horizontalOnly;if(!Ht&&!hi||It.isHidden()||lt++,Ht){const Kt=er(It.text);nt(a.text,At,qt?oc:Kt),nt(a.text,ht,ji?oc:Kt);const Bi=It.text.isHidden(),{leftJustifiedTextSymbolIndex:di,centerJustifiedTextSymbolIndex:Ri,rightJustifiedTextSymbolIndex:Ai,verticalPlacedTextSymbolIndex:Mi}=Ye,$i=a.text.placedSymbolArray,Jt=Bi||qt?1:0;di>=0&&($i.get(di).hidden=Jt),Ri>=0&&($i.get(Ri).hidden=Jt),Ai>=0&&($i.get(Ai).hidden=Jt),Mi>=0&&($i.get(Mi).hidden=Bi||ji?1:0);const pi=this.variableOffsets[Bt];pi&&this.markUsedJustification(a,pi.anchor,Ye,si);const In=this.placedOrientations[Bt];In&&(this.markUsedJustification(a,"left",Ye,In),this.markUsedOrientation(a,In,Ye))}if(hi){const Kt=er(It.icon),{placedIconSymbolIndex:Bi,verticalPlacedIconSymbolIndex:di}=Ye,Ri=a.icon.placedSymbolArray,Ai=It.icon.isHidden()?1:0;Bi>=0&&(nt(a.icon,Pt,qt?oc:Kt),Ri.get(Bi).hidden=Ai),di>=0&&(nt(a.icon,Ye.numVerticalIconVertices,ji?oc:Kt),Ri.get(di).hidden=Ai)}if(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData()){const Kt=a.collisionArrays[Xe];if(Kt){let Bi=new i.pointGeometry(0,0),di=!0;if(Kt.textBox||Kt.verticalTextBox){if(pe){const Ai=this.variableOffsets[Bt];Ai?(Bi=fs(Ai.anchor,Ai.width,Ai.height,Ai.textOffset,Ai.textScale),fe&&Bi._rotate(Se?this.transform.angle:-this.transform.angle)):di=!1}P&&(di=!It.clipped),Kt.textBox&&Os(a.textCollisionBox.collisionVertexArray,It.text.placed,!di||qt,Bi.x,Bi.y),Kt.verticalTextBox&&Os(a.textCollisionBox.collisionVertexArray,It.text.placed,!di||ji,Bi.x,Bi.y)}const Ri=di&&Boolean(!ji&&Kt.verticalIconBox);Kt.iconBox&&Os(a.iconCollisionBox.collisionVertexArray,It.icon.placed,Ri,Qe?Bi.x:0,Qe?Bi.y:0),Kt.verticalIconBox&&Os(a.iconCollisionBox.collisionVertexArray,It.icon.placed,!Ri,Qe?Bi.x:0,Qe?Bi.y:0)}}}if(a.fullyClipped=lt===0,a.sortFeatures(this.transform.angle),this.retainedQueryData[a.bucketInstanceId]&&(this.retainedQueryData[a.bucketInstanceId].featureSortOrder=a.featureSortOrder),a.hasTextData()&&a.text.opacityVertexBuffer&&a.text.opacityVertexBuffer.updateData(a.text.opacityVertexArray),a.hasIconData()&&a.icon.opacityVertexBuffer&&a.icon.opacityVertexBuffer.updateData(a.icon.opacityVertexArray),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexBuffer&&a.iconCollisionBox.collisionVertexBuffer.updateData(a.iconCollisionBox.collisionVertexArray),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexBuffer&&a.textCollisionBox.collisionVertexBuffer.updateData(a.textCollisionBox.collisionVertexArray),a.bucketInstanceId in this.collisionCircleArrays){const Xe=this.collisionCircleArrays[a.bucketInstanceId];a.placementInvProjMatrix=Xe.invProjMatrix,a.placementViewportMatrix=Xe.viewportMatrix,a.collisionCircleArray=Xe.circles,delete this.collisionCircleArrays[a.bucketInstanceId]}}symbolFadeChange(a){return this.fadeDuration===0?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(a,m){const b=this.zoomAtLastRecencyCheck===m?1-this.zoomAdjustment(m):1;return this.zoomAtLastRecencyCheck=m,this.commitTime+this.fadeDuration*b>a}setStale(){this.stale=!0}}function Os(x,a,m,b,S){x.emplaceBack(a?1:0,m?1:0,b||0,S||0),x.emplaceBack(a?1:0,m?1:0,b||0,S||0),x.emplaceBack(a?1:0,m?1:0,b||0,S||0),x.emplaceBack(a?1:0,m?1:0,b||0,S||0)}const No=Math.pow(2,25),ed=Math.pow(2,24),pu=Math.pow(2,17),Cs=Math.pow(2,16),rc=Math.pow(2,9),Th=Math.pow(2,8),sc=Math.pow(2,1);function er(x){if(x.opacity===0&&!x.placed)return 0;if(x.opacity===1&&x.placed)return 4294967295;const a=x.placed?1:0,m=Math.floor(127*x.opacity);return m*No+a*ed+m*pu+a*Cs+m*rc+a*Th+m*sc+a}const oc=0;class Ju{constructor(a){this._sortAcrossTiles=a.layout.get("symbol-z-order")!=="viewport-y"&&a.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(a,m,b,S,P){const H=this._bucketParts;for(;this._currentTileIndex<a.length;)if(m.getBucketParts(H,S,a[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,P())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,H.sort((W,ee)=>W.sortKey-ee.sortKey));this._currentPartIndex<H.length;){const W=H[this._currentPartIndex];if(m.placeLayerBucketPart(W,this._seenCrossTileIDs,b,W.symbolInstanceStart===0),this._currentPartIndex++,P())return!0}return!1}}class Qo{constructor(a,m,b,S,P,H,W,ee){this.placement=new Eh(a,P,H,W,ee),this._currentPlacementIndex=m.length-1,this._forceFullPlacement=b,this._showCollisionBoxes=S,this._done=!1}isDone(){return this._done}continuePlacement(a,m,b){const S=i.exported.now(),P=()=>{const H=i.exported.now()-S;return!this._forceFullPlacement&&H>2};for(;this._currentPlacementIndex>=0;){const H=m[a[this._currentPlacementIndex]],W=this.placement.collisionIndex.transform.zoom;if(H.type==="symbol"&&(!H.minzoom||H.minzoom<=W)&&(!H.maxzoom||H.maxzoom>W)){if(this._inProgressLayer||(this._inProgressLayer=new Ju(H)),this._inProgressLayer.continuePlacement(b[H.source],this.placement,this._showCollisionBoxes,H,P))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const hl=512/i.EXTENT/2;class Sh{constructor(a,m,b){this.tileID=a,this.indexedSymbolInstances={},this.bucketInstanceId=b;for(let S=0;S<m.length;S++){const P=m.get(S),H=P.key;this.indexedSymbolInstances[H]||(this.indexedSymbolInstances[H]=[]),this.indexedSymbolInstances[H].push({crossTileID:P.crossTileID,coord:this.getScaledCoordinates(P,a)})}}getScaledCoordinates(a,m){const b=hl/Math.pow(2,m.canonical.z-this.tileID.canonical.z);return{x:Math.floor((m.canonical.x*i.EXTENT+a.tileAnchorX)*b),y:Math.floor((m.canonical.y*i.EXTENT+a.tileAnchorY)*b)}}findMatches(a,m,b){const S=this.tileID.canonical.z<m.canonical.z?1:Math.pow(2,this.tileID.canonical.z-m.canonical.z);for(let P=0;P<a.length;P++){const H=a.get(P);if(H.crossTileID)continue;const W=this.indexedSymbolInstances[H.key];if(!W)continue;const ee=this.getScaledCoordinates(H,m);for(const pe of W)if(Math.abs(pe.coord.x-ee.x)<=S&&Math.abs(pe.coord.y-ee.y)<=S&&!b[pe.crossTileID]){b[pe.crossTileID]=!0,H.crossTileID=pe.crossTileID;break}}}}class Vo{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Mh{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(a){const m=Math.round((a-this.lng)/360);if(m!==0)for(const b in this.indexes){const S=this.indexes[b],P={};for(const H in S){const W=S[H];W.tileID=W.tileID.unwrapTo(W.tileID.wrap+m),P[W.tileID.key]=W}this.indexes[b]=P}this.lng=a}addBucket(a,m,b){if(this.indexes[a.overscaledZ]&&this.indexes[a.overscaledZ][a.key]){if(this.indexes[a.overscaledZ][a.key].bucketInstanceId===m.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(a.overscaledZ,this.indexes[a.overscaledZ][a.key])}for(let P=0;P<m.symbolInstances.length;P++)m.symbolInstances.get(P).crossTileID=0;this.usedCrossTileIDs[a.overscaledZ]||(this.usedCrossTileIDs[a.overscaledZ]={});const S=this.usedCrossTileIDs[a.overscaledZ];for(const P in this.indexes){const H=this.indexes[P];if(Number(P)>a.overscaledZ)for(const W in H){const ee=H[W];ee.tileID.isChildOf(a)&&ee.findMatches(m.symbolInstances,a,S)}else{const W=H[a.scaledTo(Number(P)).key];W&&W.findMatches(m.symbolInstances,a,S)}}for(let P=0;P<m.symbolInstances.length;P++){const H=m.symbolInstances.get(P);H.crossTileID||(H.crossTileID=b.generate(),S[H.crossTileID]=!0)}return this.indexes[a.overscaledZ]===void 0&&(this.indexes[a.overscaledZ]={}),this.indexes[a.overscaledZ][a.key]=new Sh(a,m.symbolInstances,m.bucketInstanceId),!0}removeBucketCrossTileIDs(a,m){for(const b in m.indexedSymbolInstances)for(const S of m.indexedSymbolInstances[b])delete this.usedCrossTileIDs[a][S.crossTileID]}removeStaleBuckets(a){let m=!1;for(const b in this.indexes){const S=this.indexes[b];for(const P in S)a[S[P].bucketInstanceId]||(this.removeBucketCrossTileIDs(b,S[P]),delete S[P],m=!0)}return m}}class Va{constructor(){this.layerIndexes={},this.crossTileIDs=new Vo,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(a,m,b,S){let P=this.layerIndexes[a.id];P===void 0&&(P=this.layerIndexes[a.id]=new Mh);let H=!1;const W={};S.name!=="globe"&&P.handleWrapJump(b);for(const ee of m){const pe=ee.getBucket(a);pe&&a.id===pe.layerIds[0]&&(pe.bucketInstanceId||(pe.bucketInstanceId=++this.maxBucketInstanceId),P.addBucket(ee.tileID,pe,this.crossTileIDs)&&(H=!0),W[pe.bucketInstanceId]=!0)}return P.removeStaleBuckets(W)&&(H=!0),H}pruneUnusedLayers(a){const m={};a.forEach(b=>{m[b]=!0});for(const b in this.layerIndexes)m[b]||delete this.layerIndexes[b]}}const ac=(x,a)=>i.emitValidationErrors(x,a&&a.filter(m=>m.identifier!=="source.canvas")),fu=i.pick(wi,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Vl=i.pick(wi,["setCenter","setZoom","setBearing","setPitch"]),ya={version:8,layers:[],sources:{}},zc={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class Ws extends i.Evented{constructor(a,m={}){super(),this.map=a,this.dispatcher=new qe(jt(),this),this.imageManager=new oi,this.imageManager.setEventedParent(this),this.glyphManager=new i.GlyphManager(a._requestManager,m.localFontFamily?i.LocalGlyphMode.all:m.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,m.localFontFamily||m.localIdeographFontFamily),this.crossTileSymbolIndex=new Va,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());const b=this;this._rtlTextPluginCallback=Ws.registerForPluginStateChange(S=>{b.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:S.pluginStatus,pluginURL:S.pluginURL},(P,H)=>{if(i.triggerPluginCompletionEvent(P),H&&H.every(W=>W))for(const W in b._sourceCaches){const ee=b._sourceCaches[W],pe=ee.getSource().type;pe!=="vector"&&pe!=="geojson"||ee.reload()}})}),this.on("data",S=>{if(S.dataType!=="source"||S.sourceDataType!=="metadata")return;const P=this.getSource(S.sourceId);if(P&&P.vectorLayerIds)for(const H in this._layers){const W=this._layers[H];W.source===P.id&&this._validateLayer(W)}})}loadURL(a,m={}){this.fire(new i.Event("dataloading",{dataType:"style"}));const b=typeof m.validate=="boolean"?m.validate:!i.isMapboxURL(a);a=this.map._requestManager.normalizeStyleURL(a,m.accessToken);const S=this.map._requestManager.transformRequest(a,i.ResourceType.Style);this._request=i.getJSON(S,(P,H)=>{this._request=null,P?this.fire(new i.ErrorEvent(P)):H&&this._load(H,b)})}loadJSON(a,m={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(a,m.validate!==!1)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(ya,!1)}_updateLayerCount(a,m){const b=m?1:-1;a.is3D()&&(this._num3DLayers+=b),a.type==="circle"&&(this._numCircleLayers+=b),a.type==="symbol"&&(this._numSymbolLayers+=b)}_load(a,m){if(m&&ac(this,i.validateStyle(a)))return;this._loaded=!0,this.stylesheet=i.clone$1(a),this._updateMapProjection();for(const S in a.sources)this.addSource(S,a.sources[S],{validate:!1});this._changed=!1,a.sprite?this._loadSprite(a.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(a.glyphs);const b=ki(this.stylesheet.layers);this._order=b.map(S=>S.id),this._layers={},this._serializedLayers={};for(let S of b)S=i.createStyleLayer(S),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S,this._serializedLayers[S.id]=S.serialize(),this._updateLayerCount(S,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new ce(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}setProjection(a){a?this.stylesheet.projection=a:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(a){this._spriteRequest=function(m,b,S){let P,H,W;const ee=i.exported.devicePixelRatio>1?"@2x":"";let pe=i.getJSON(b.transformRequest(b.normalizeSpriteURL(m,ee,".json"),i.ResourceType.SpriteJSON),(Qe,rt)=>{pe=null,W||(W=Qe,P=rt,Se())}),fe=i.getImage(b.transformRequest(b.normalizeSpriteURL(m,ee,".png"),i.ResourceType.SpriteImage),(Qe,rt)=>{fe=null,W||(W=Qe,H=rt,Se())});function Se(){if(W)S(W);else if(P&&H){const Qe=i.exported.getImageData(H),rt={};for(const nt in P){const{width:lt,height:Xe,x:Ye,y:At,sdf:ht,pixelRatio:Bt,stretchX:Pt,stretchY:It,content:Ht}=P[nt],hi=new i.RGBAImage({width:lt,height:Xe});i.RGBAImage.copy(Qe,hi,{x:Ye,y:At},{x:0,y:0},{width:lt,height:Xe}),rt[nt]={data:hi,pixelRatio:Bt,sdf:ht,stretchX:Pt,stretchY:It,content:Ht}}S(null,rt)}}return{cancel(){pe&&(pe.cancel(),pe=null),fe&&(fe.cancel(),fe=null)}}}(a,this.map._requestManager,(m,b)=>{if(this._spriteRequest=null,m)this.fire(new i.ErrorEvent(m));else if(b)for(const S in b)this.imageManager.addImage(S,b[S]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(a){const m=this.getSource(a.source);if(!m)return;const b=a.sourceLayer;b&&(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(b)===-1)&&this.fire(new i.ErrorEvent(new Error(`Source layer "${b}" does not exist on source "${m.id}" as specified by style layer "${a.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const a in this._sourceCaches)if(!this._sourceCaches[a].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(a){const m=[];for(const b of a){const S=this._layers[b];S.type!=="custom"&&m.push(S.serialize())}return m}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const a in this._sourceCaches)if(this._sourceCaches[a].hasTransition())return!0;for(const a in this._layers)if(this._layers[a].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(a){return!!this.terrain&&zc[a.type]}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(a){if(!this._loaded)return;const m=this._changed;if(this._changed){const S=Object.keys(this._updatedLayers),P=Object.keys(this._removedLayers);(S.length||P.length)&&this._updateWorkerLayers(S,P);for(const H in this._updatedSources){const W=this._updatedSources[H];W==="reload"?this._reloadSource(H):W==="clear"&&this._clearSource(H)}this._updateTilesForChangedImages();for(const H in this._updatedPaintProps)this._layers[H].updateTransitions(a);this.light.updateTransitions(a),this.fog&&this.fog.updateTransitions(a),this._resetUpdates()}const b={};for(const S in this._sourceCaches){const P=this._sourceCaches[S];b[S]=P.used,P.used=!1}for(const S of this._order){const P=this._layers[S];if(P.recalculate(a,this._availableImages),!P.isHidden(a.zoom)){const W=this._getLayerSourceCache(P);W&&(W.used=!0)}const H=this.map.painter;if(H){const W=P.getProgramIds();if(!W)continue;const ee=P.getProgramConfiguration(a.zoom);for(const pe of W)H.useProgram(pe,ee)}}for(const S in b){const P=this._sourceCaches[S];b[S]!==P.used&&P.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:P.getSource().id}))}this.light.recalculate(a),this.terrain&&this.terrain.recalculate(a),this.fog&&this.fog.recalculate(a),this.z=a.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),m&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const a=Object.keys(this._changedImages);if(a.length){for(const m in this._sourceCaches)this._sourceCaches[m].reloadTilesForDependencies(["icons","patterns"],a);this._changedImages={}}}_updateWorkerLayers(a,m){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(a),removedIds:m})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(a){if(this._checkLoaded(),ac(this,i.validateStyle(a)))return!1;(a=i.clone$1(a)).layers=ki(a.layers);const m=function(S,P){if(!S)return[{command:wi.setStyle,args:[P]}];let H=[];try{if(!C(S.version,P.version))return[{command:wi.setStyle,args:[P]}];C(S.center,P.center)||H.push({command:wi.setCenter,args:[P.center]}),C(S.zoom,P.zoom)||H.push({command:wi.setZoom,args:[P.zoom]}),C(S.bearing,P.bearing)||H.push({command:wi.setBearing,args:[P.bearing]}),C(S.pitch,P.pitch)||H.push({command:wi.setPitch,args:[P.pitch]}),C(S.sprite,P.sprite)||H.push({command:wi.setSprite,args:[P.sprite]}),C(S.glyphs,P.glyphs)||H.push({command:wi.setGlyphs,args:[P.glyphs]}),C(S.transition,P.transition)||H.push({command:wi.setTransition,args:[P.transition]}),C(S.light,P.light)||H.push({command:wi.setLight,args:[P.light]}),C(S.fog,P.fog)||H.push({command:wi.setFog,args:[P.fog]}),C(S.projection,P.projection)||H.push({command:wi.setProjection,args:[P.projection]});const W={},ee=[];(function(Se,Qe,rt,nt){let lt;for(lt in Qe=Qe||{},Se=Se||{})Se.hasOwnProperty(lt)&&(Qe.hasOwnProperty(lt)||Yi(lt,rt,nt));for(lt in Qe)Qe.hasOwnProperty(lt)&&(Se.hasOwnProperty(lt)?C(Se[lt],Qe[lt])||(Se[lt].type==="geojson"&&Qe[lt].type==="geojson"&&rr(Se,Qe,lt)?rt.push({command:wi.setGeoJSONSourceData,args:[lt,Qe[lt].data]}):tn(lt,Qe,rt,nt)):Oi(lt,Qe,rt))})(S.sources,P.sources,ee,W);const pe=[];S.layers&&S.layers.forEach(Se=>{Se.source&&W[Se.source]?H.push({command:wi.removeLayer,args:[Se.id]}):pe.push(Se)});let fe=S.terrain;fe&&W[fe.source]&&(H.push({command:wi.setTerrain,args:[void 0]}),fe=void 0),H=H.concat(ee),C(fe,P.terrain)||H.push({command:wi.setTerrain,args:[P.terrain]}),function(Se,Qe,rt){Qe=Qe||[];const nt=(Se=Se||[]).map(Yt),lt=Qe.map(Yt),Xe=Se.reduce(sr,{}),Ye=Qe.reduce(sr,{}),At=nt.slice(),ht=Object.create(null);let Bt,Pt,It,Ht,hi,si,qt;for(Bt=0,Pt=0;Bt<nt.length;Bt++)It=nt[Bt],Ye.hasOwnProperty(It)?Pt++:(rt.push({command:wi.removeLayer,args:[It]}),At.splice(At.indexOf(It,Pt),1));for(Bt=0,Pt=0;Bt<lt.length;Bt++)It=lt[lt.length-1-Bt],At[At.length-1-Bt]!==It&&(Xe.hasOwnProperty(It)?(rt.push({command:wi.removeLayer,args:[It]}),At.splice(At.lastIndexOf(It,At.length-Pt),1)):Pt++,si=At[At.length-Bt],rt.push({command:wi.addLayer,args:[Ye[It],si]}),At.splice(At.length-Bt,0,It),ht[It]=!0);for(Bt=0;Bt<lt.length;Bt++)if(It=lt[Bt],Ht=Xe[It],hi=Ye[It],!ht[It]&&!C(Ht,hi))if(C(Ht.source,hi.source)&&C(Ht["source-layer"],hi["source-layer"])&&C(Ht.type,hi.type)){for(qt in yn(Ht.layout,hi.layout,rt,It,null,wi.setLayoutProperty),yn(Ht.paint,hi.paint,rt,It,null,wi.setPaintProperty),C(Ht.filter,hi.filter)||rt.push({command:wi.setFilter,args:[It,hi.filter]}),C(Ht.minzoom,hi.minzoom)&&C(Ht.maxzoom,hi.maxzoom)||rt.push({command:wi.setLayerZoomRange,args:[It,hi.minzoom,hi.maxzoom]}),Ht)Ht.hasOwnProperty(qt)&&qt!=="layout"&&qt!=="paint"&&qt!=="filter"&&qt!=="metadata"&&qt!=="minzoom"&&qt!=="maxzoom"&&(qt.indexOf("paint.")===0?yn(Ht[qt],hi[qt],rt,It,qt.slice(6),wi.setPaintProperty):C(Ht[qt],hi[qt])||rt.push({command:wi.setLayerProperty,args:[It,qt,hi[qt]]}));for(qt in hi)hi.hasOwnProperty(qt)&&!Ht.hasOwnProperty(qt)&&qt!=="layout"&&qt!=="paint"&&qt!=="filter"&&qt!=="metadata"&&qt!=="minzoom"&&qt!=="maxzoom"&&(qt.indexOf("paint.")===0?yn(Ht[qt],hi[qt],rt,It,qt.slice(6),wi.setPaintProperty):C(Ht[qt],hi[qt])||rt.push({command:wi.setLayerProperty,args:[It,qt,hi[qt]]}))}else rt.push({command:wi.removeLayer,args:[It]}),si=At[At.lastIndexOf(It)+1],rt.push({command:wi.addLayer,args:[hi,si]})}(pe,P.layers,H)}catch(W){console.warn("Unable to compute style diff:",W),H=[{command:wi.setStyle,args:[P]}]}return H}(this.serialize(),a).filter(S=>!(S.command in Vl));if(m.length===0)return!1;const b=m.filter(S=>!(S.command in fu));if(b.length>0)throw new Error(`Unimplemented: ${b.map(S=>S.command).join(", ")}.`);return m.forEach(S=>{S.command!=="setTransition"&&S.command!=="setProjection"&&this[S.command].apply(this,S.args)}),this.stylesheet=a,this._updateMapProjection(),!0}addImage(a,m){return this.getImage(a)?this.fire(new i.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(a,m),this._afterImageUpdated(a),this)}updateImage(a,m){this.imageManager.updateImage(a,m)}getImage(a){return this.imageManager.getImage(a)}removeImage(a){return this.getImage(a)?(this.imageManager.removeImage(a),this._afterImageUpdated(a),this):this.fire(new i.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(a){this._availableImages=this.imageManager.listImages(),this._changedImages[a]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(a,m,b={}){if(this._checkLoaded(),this.getSource(a)!==void 0)throw new Error("There is already a source with this ID");if(!m.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(m.type)>=0&&this._validate(i.validateSource,`sources.${a}`,m,null,b))return;this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);const S=ie(a,m,this.dispatcher,this);S.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(a),source:S.serialize(),sourceId:a}));const P=H=>{const W=(H?"symbol:":"other:")+a,ee=this._sourceCaches[W]=new i.SourceCache(W,S,H);(H?this._symbolSourceCaches:this._otherSourceCaches)[a]=ee,ee.style=this,ee.onAdd(this.map)};P(!1),m.type!=="vector"&&m.type!=="geojson"||P(!0),S.onAdd&&S.onAdd(this.map),this._changed=!0}removeSource(a){this._checkLoaded();const m=this.getSource(a);if(!m)throw new Error("There is no source with this ID");for(const S in this._layers)if(this._layers[S].source===a)return this.fire(new i.ErrorEvent(new Error(`Source "${a}" cannot be removed while layer "${S}" is using it.`)));if(this.terrain&&this.terrain.get().source===a)return this.fire(new i.ErrorEvent(new Error(`Source "${a}" cannot be removed while terrain is using it.`)));const b=this._getSourceCaches(a);for(const S of b)delete this._sourceCaches[S.id],delete this._updatedSources[S.id],S.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:S.getSource().id})),S.setEventedParent(null),S.clearTiles();return delete this._otherSourceCaches[a],delete this._symbolSourceCaches[a],m.setEventedParent(null),m.onRemove&&m.onRemove(this.map),this._changed=!0,this}setGeoJSONSourceData(a,m){this._checkLoaded(),this.getSource(a).setData(m),this._changed=!0}getSource(a){const m=this._getSourceCache(a);return m&&m.getSource()}_getSources(){const a=[];for(const m in this._otherSourceCaches){const b=this._getSourceCache(m);b&&a.push(b.getSource())}return a}addLayer(a,m,b={}){this._checkLoaded();const S=a.id;if(this.getLayer(S))return void this.fire(new i.ErrorEvent(new Error(`Layer with id "${S}" already exists on this map`)));let P;if(a.type==="custom"){if(ac(this,i.validateCustomStyleLayer(a)))return;P=i.createStyleLayer(a)}else{if(typeof a.source=="object"&&(this.addSource(S,a.source),a=i.clone$1(a),a=i.extend(a,{source:S})),this._validate(i.validateLayer,`layers.${S}`,a,{arrayIndex:-1},b))return;P=i.createStyleLayer(a),this._validateLayer(P),P.setEventedParent(this,{layer:{id:S}}),this._serializedLayers[P.id]=P.serialize(),this._updateLayerCount(P,!0)}const H=m?this._order.indexOf(m):this._order.length;if(m&&H===-1)return void this.fire(new i.ErrorEvent(new Error(`Layer with id "${m}" does not exist on this map.`)));this._order.splice(H,0,S),this._layerOrderChanged=!0,this._layers[S]=P;const W=this._getLayerSourceCache(P);if(this._removedLayers[S]&&P.source&&W&&P.type!=="custom"){const ee=this._removedLayers[S];delete this._removedLayers[S],ee.type!==P.type?this._updatedSources[P.source]="clear":(this._updatedSources[P.source]="reload",W.pause())}this._updateLayer(P),P.onAdd&&P.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(a,m){if(this._checkLoaded(),this._changed=!0,!this._layers[a])return void this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be moved.`)));if(a===m)return;const b=this._order.indexOf(a);this._order.splice(b,1);const S=m?this._order.indexOf(m):this._order.length;m&&S===-1?this.fire(new i.ErrorEvent(new Error(`Layer with id "${m}" does not exist on this map.`))):(this._order.splice(S,0,a),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(a){this._checkLoaded();const m=this._layers[a];if(!m)return void this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be removed.`)));m.setEventedParent(null),this._updateLayerCount(m,!1);const b=this._order.indexOf(a);this._order.splice(b,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[a]=m,delete this._layers[a],delete this._serializedLayers[a],delete this._updatedLayers[a],delete this._updatedPaintProps[a],m.onRemove&&m.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(a){return this._layers[a]}hasLayer(a){return a in this._layers}hasLayerType(a){for(const m in this._layers)if(this._layers[m].type===a)return!0;return!1}setLayerZoomRange(a,m,b){this._checkLoaded();const S=this.getLayer(a);S?S.minzoom===m&&S.maxzoom===b||(m!=null&&(S.minzoom=m),b!=null&&(S.maxzoom=b),this._updateLayer(S)):this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(a,m,b={}){this._checkLoaded();const S=this.getLayer(a);if(S){if(!C(S.filter,m))return m==null?(S.filter=void 0,void this._updateLayer(S)):void(this._validate(i.validateFilter,`layers.${S.id}.filter`,m,{layerType:S.type},b)||(S.filter=i.clone$1(m),this._updateLayer(S)))}else this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be filtered.`)))}getFilter(a){const m=this.getLayer(a);return m&&i.clone$1(m.filter)}setLayoutProperty(a,m,b,S={}){this._checkLoaded();const P=this.getLayer(a);P?C(P.getLayoutProperty(m),b)||(P.setLayoutProperty(m,b,S),this._updateLayer(P)):this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(a,m){const b=this.getLayer(a);if(b)return b.getLayoutProperty(m);this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style.`)))}setPaintProperty(a,m,b,S={}){this._checkLoaded();const P=this.getLayer(a);P?C(P.getPaintProperty(m),b)||(P.setPaintProperty(m,b,S)&&this._updateLayer(P),this._changed=!0,this._updatedPaintProps[a]=!0):this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(a,m){const b=this.getLayer(a);return b&&b.getPaintProperty(m)}setFeatureState(a,m){this._checkLoaded();const b=a.source,S=a.sourceLayer,P=this.getSource(b);if(!P)return void this.fire(new i.ErrorEvent(new Error(`The source '${b}' does not exist in the map's style.`)));const H=P.type;if(H==="geojson"&&S)return void this.fire(new i.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(H==="vector"&&!S)return void this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));a.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided.")));const W=this._getSourceCaches(b);for(const ee of W)ee.setFeatureState(S,a.id,m)}removeFeatureState(a,m){this._checkLoaded();const b=a.source,S=this.getSource(b);if(!S)return void this.fire(new i.ErrorEvent(new Error(`The source '${b}' does not exist in the map's style.`)));const P=S.type,H=P==="vector"?a.sourceLayer:void 0;if(P==="vector"&&!H)return void this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(m&&typeof a.id!="string"&&typeof a.id!="number")return void this.fire(new i.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const W=this._getSourceCaches(b);for(const ee of W)ee.removeFeatureState(H,a.id,m)}getFeatureState(a){this._checkLoaded();const m=a.source,b=a.sourceLayer,S=this.getSource(m);if(S){if(S.type!=="vector"||b)return a.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(m)[0].getFeatureState(b,a.id);this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error(`The source '${m}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const a={};for(const m in this._sourceCaches){const b=this._sourceCaches[m].getSource();a[b.id]||(a[b.id]=b.serialize())}return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:a,layers:this._serializeLayers(this._order)},m=>m!==void 0)}_updateLayer(a){this._updatedLayers[a.id]=!0;const m=this._getLayerSourceCache(a);a.source&&!this._updatedSources[a.source]&&m&&m.getSource().type!=="raster"&&(this._updatedSources[a.source]="reload",m.pause()),this._changed=!0,a.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(a){const m=H=>this._layers[H].type==="fill-extrusion",b={},S=[];for(let H=this._order.length-1;H>=0;H--){const W=this._order[H];if(m(W)){b[W]=H;for(const ee of a){const pe=ee[W];if(pe)for(const fe of pe)S.push(fe)}}}S.sort((H,W)=>W.intersectionZ-H.intersectionZ);const P=[];for(let H=this._order.length-1;H>=0;H--){const W=this._order[H];if(m(W))for(let ee=S.length-1;ee>=0;ee--){const pe=S[ee].feature;if(b[pe.layer.id]<H)break;P.push(pe),S.pop()}else for(const ee of a){const pe=ee[W];if(pe)for(const fe of pe)P.push(fe.feature)}}return P}queryRenderedFeatures(a,m,b){m&&m.filter&&this._validate(i.validateFilter,"queryRenderedFeatures.filter",m.filter,null,m);const S={};if(m&&m.layers){if(!Array.isArray(m.layers))return this.fire(new i.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const ee of m.layers){const pe=this._layers[ee];if(!pe)return this.fire(new i.ErrorEvent(new Error(`The layer '${ee}' does not exist in the map's style and cannot be queried for features.`))),[];S[pe.source]=!0}}const P=[];m.availableImages=this._availableImages;const H=m&&m.layers?m.layers.some(ee=>{const pe=this.getLayer(ee);return pe&&pe.is3D()}):this.has3DLayers(),W=vt.createFromScreenPoints(a,b);for(const ee in this._sourceCaches){const pe=this._sourceCaches[ee].getSource().id;m.layers&&!S[pe]||P.push(de(this._sourceCaches[ee],this._layers,this._serializedLayers,W,m,b,H,!!this.map._showQueryGeometry))}return this.placement&&P.push(function(ee,pe,fe,Se,Qe,rt,nt){const lt={},Xe=rt.queryRenderedSymbols(Se),Ye=[];for(const At of Object.keys(Xe).map(Number))Ye.push(nt[At]);Ye.sort(tt);for(const At of Ye){const ht=At.featureIndex.lookupSymbolFeatures(Xe[At.bucketInstanceId],pe,At.bucketIndex,At.sourceLayerIndex,Qe.filter,Qe.layers,Qe.availableImages,ee);for(const Bt in ht){const Pt=lt[Bt]=lt[Bt]||[],It=ht[Bt];It.sort((Ht,hi)=>{const si=At.featureSortOrder;if(si){const qt=si.indexOf(Ht.featureIndex);return si.indexOf(hi.featureIndex)-qt}return hi.featureIndex-Ht.featureIndex});for(const Ht of It)Pt.push(Ht)}}for(const At in lt)lt[At].forEach(ht=>{const Bt=ht.feature,Pt=fe(ee[At]).getFeatureState(Bt.layer["source-layer"],Bt.id);Bt.source=Bt.layer.source,Bt.layer["source-layer"]&&(Bt.sourceLayer=Bt.layer["source-layer"]),Bt.state=Pt});return lt}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),W.screenGeometry,m,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(P)}querySourceFeatures(a,m){m&&m.filter&&this._validate(i.validateFilter,"querySourceFeatures.filter",m.filter,null,m);const b=this._getSourceCaches(a);let S=[];for(const P of b)S=S.concat(Re(P,m));return S}addSourceType(a,m,b){return Ws.getSourceType(a)?b(new Error(`A source type called "${a}" already exists.`)):(Ws.setSourceType(a,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:a,url:m.workerSourceURL},b):b(null,null))}getLight(){return this.light.getLight()}setLight(a,m={}){this._checkLoaded();const b=this.light.getLight();let S=!1;for(const H in a)if(!C(a[H],b[H])){S=!0;break}if(!S)return;const P=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(a,m),this.light.updateTransitions(P)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(a,m=1){if(this._checkLoaded(),!a)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(m===1){if(typeof a.source=="object"){const b="terrain-dem-src";this.addSource(b,a.source),a=i.clone$1(a),a=i.extend(a,{source:b})}if(this._validate(i.validateTerrain,"terrain",a))return}if(!this.terrain||this.terrain&&m!==this.terrain.drapeRenderMode)this._createTerrain(a,m);else{const b=this.terrain,S=b.get();for(const P of Object.keys(i.spec.terrain))!a.hasOwnProperty(P)&&i.spec.terrain[P].default&&(a[P]=i.spec.terrain[P].default);for(const P in a)if(!C(a[P],S[P])){b.set(a),this.stylesheet.terrain=a;const H=this._setTransitionParameters({duration:0});b.updateTransitions(H);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(a){const m=this.fog=new Ie(a,this.map.transform);this.stylesheet.fog=a;const b=this._setTransitionParameters({duration:0});m.updateTransitions(b)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const a of this.map._markers)a._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(a){if(this._checkLoaded(),!a)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const m=this.fog,b=m.get();Object.keys(a).length===0&&m.set(a);for(const S in a)if(!C(a[S],b[S])){m.set(a),this.stylesheet.fog=a;const P=this._setTransitionParameters({duration:0});m.updateTransitions(P);break}}else this._createFog(a);this._markersNeedUpdate=!0}_setTransitionParameters(a){return{now:i.exported.now(),transition:i.extend(a,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const a=this._order.filter(b=>this.isLayerDraped(this._layers[b])),m=this._order.filter(b=>!this.isLayerDraped(this._layers[b]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...a),this._drapedFirstOrder.push(...m)}_createTerrain(a,m){const b=this.terrain=new ze(a,m);this.stylesheet.terrain=a,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const S=this._setTransitionParameters({duration:0});b.updateTransitions(S)}_force3DLayerUpdate(){for(const a in this._layers){const m=this._layers[a];m.type==="fill-extrusion"&&this._updateLayer(m)}}_forceSymbolLayerUpdate(){for(const a in this._layers){const m=this._layers[a];m.type==="symbol"&&this._updateLayer(m)}}_validate(a,m,b,S,P={}){return(!P||P.validate!==!1)&&ac(this,a.call(i.validateStyle,i.extend({key:m,style:this.serialize(),value:b,styleSpec:i.spec},S)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const a in this._layers)this._layers[a].setEventedParent(null);for(const a in this._sourceCaches)this._sourceCaches[a].clearTiles(),this._sourceCaches[a].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(a){const m=this._getSourceCaches(a);for(const b of m)b.clearTiles()}_reloadSource(a){const m=this._getSourceCaches(a);for(const b of m)b.resume(),b.reload()}_reloadSources(){for(const a of this._getSources())a.reload&&a.reload()}_updateSources(a){for(const m in this._sourceCaches)this._sourceCaches[m].update(a)}_generateCollisionBoxes(){for(const a in this._sourceCaches){const m=this._sourceCaches[a];m.resume(),m.reload()}}_updatePlacement(a,m,b,S,P=!1){let H=!1,W=!1;const ee={};for(const pe of this._order){const fe=this._layers[pe];if(fe.type!=="symbol")continue;if(!ee[fe.source]){const Qe=this._getLayerSourceCache(fe);if(!Qe)continue;ee[fe.source]=Qe.getRenderableIds(!0).map(rt=>Qe.getTileByID(rt)).sort((rt,nt)=>nt.tileID.overscaledZ-rt.tileID.overscaledZ||(rt.tileID.isLessThan(nt.tileID)?-1:1))}const Se=this.crossTileSymbolIndex.addLayer(fe,ee[fe.source],a.center.lng,a.projection);H=H||Se}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),P=P||this._layerOrderChanged||b===0,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(P||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),a.zoom))&&(this.pauseablePlacement=new Qo(a,this._order,P,m,b,S,this.placement,this.fog&&a.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,ee),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),W=!0),H&&this.pauseablePlacement.placement.setStale()),W||H)for(const pe of this._order){const fe=this._layers[pe];fe.type==="symbol"&&this.placement.updateLayerOpacities(fe,ee[fe.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(const a in this._sourceCaches)this._sourceCaches[a].releaseSymbolFadeTiles()}getImages(a,m,b){this.imageManager.getImages(m.icons,b),this._updateTilesForChangedImages();const S=P=>{P&&P.setDependencies(m.tileID.key,m.type,m.icons)};S(this._otherSourceCaches[m.source]),S(this._symbolSourceCaches[m.source])}getGlyphs(a,m,b){this.glyphManager.getGlyphs(m.stacks,b)}getResource(a,m,b){return i.makeRequest(m,b)}_getSourceCache(a){return this._otherSourceCaches[a]}_getLayerSourceCache(a){return a.type==="symbol"?this._symbolSourceCaches[a.source]:this._otherSourceCaches[a.source]}_getSourceCaches(a){const m=[];return this._otherSourceCaches[a]&&m.push(this._otherSourceCaches[a]),this._symbolSourceCaches[a]&&m.push(this._symbolSourceCaches[a]),m}_isSourceCacheLoaded(a){const m=this._getSourceCaches(a);return m.length===0?(this.fire(new i.ErrorEvent(new Error(`There is no source with ID '${a}'`))),!1):m.every(b=>b.loaded())}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Ws.getSourceType=function(x){return j[x]},Ws.setSourceType=function(x,a){j[x]=a},Ws.registerForPluginStateChange=i.registerForPluginStateChange;var lc=`
- #define EPSILON 0.0000001
- #define PI 3.141592653589793
- #define EXTENT 8192.0
- #define HALF_PI PI/2.0
- #define QUARTER_PI PI/4.0
- #define RAD_TO_DEG 180.0/PI
- #define DEG_TO_RAD PI/180.0
- #define GLOBE_RADIUS EXTENT/PI/2.0`,kc="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",eA=`
- #define ELEVATION_SCALE 7.0
- #define ELEVATION_OFFSET 450.0
- #ifdef PROJECTION_GLOBE_VIEW
- uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
- mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
- #else
- vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
- #endif
- #ifdef TERRAIN
- #ifdef TERRAIN_DEM_FLOAT_FORMAT
- uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;
- #else
- uniform sampler2D u_dem;uniform sampler2D u_dem_prev;
- #endif
- uniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {
- #ifdef TERRAIN_DEM_FLOAT_FORMAT
- vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;
- #else
- float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));
- #ifdef TERRAIN_DEM_NEAREST_FILTER
- return u_exaggeration*tl;
- #endif
- float tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
- #endif
- }float prevElevation(vec2 apos) {
- #ifdef TERRAIN_DEM_FLOAT_FORMAT
- vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;
- #else
- float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
- #endif
- }
- #ifdef TERRAIN_VERTEX_MORPHING
- float elevation(vec2 apos) {
- #ifdef ZERO_EXAGGERATION
- return 0.0;
- #endif
- float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
- #else
- float elevation(vec2 apos) {
- #ifdef ZERO_EXAGGERATION
- return 0.0;
- #endif
- return currentElevation(apos);}
- #endif
- highp float unpack_depth(highp vec4 rgba_depth)
- {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(
- unpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))
- );return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {
- #ifdef TERRAIN_DEM_FLOAT_FORMAT
- float tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;
- #else
- vec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);
- #endif
- return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
- #else
- float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }
- #endif`,cc=`#ifdef FOG
- uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
- #endif`,mu=`#ifdef FOG
- uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
- mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
- #endif`;let td={},gu={};const Ih=[];ul(lc,Ih),ul(eA,Ih),ul(cc,Ih),ul(mu,Ih),td=Ir("",eA),gu=Ir(mu,cc);const tA=Ir(`
- highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)
- {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}`,`
- float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
- #ifndef PROJECTED_POS_ON_VIEWPORT
- float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
- #else
- return vec3(0.0);
- #endif
- }vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
- #endif
- vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
- unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
- );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered.`),id=lc,hc=`
- #ifdef GL_ES
- precision mediump float;
- #else
- #if !defined(lowp)
- #define lowp
- #endif
- #if !defined(mediump)
- #define mediump
- #endif
- #if !defined(highp)
- #define highp
- #endif
- #endif`;var Oc={background:Ir(`uniform vec4 u_color;uniform float u_opacity;
- #ifdef LIGHTING_3D_MODE
- varying vec4 v_color;
- #endif
- void main() {vec4 out_color;
- #ifdef LIGHTING_3D_MODE
- out_color=v_color;
- #else
- out_color=u_color;
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
- #endif
- gl_FragColor=out_color*u_opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
- #ifdef LIGHTING_3D_MODE
- uniform vec4 u_color;varying vec4 v_color;
- #endif
- void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
- #ifdef LIGHTING_3D_MODE
- v_color=apply_lighting(u_color);
- #endif
- #ifdef FOG
- v_fog_pos=fog_position(a_pos);
- #endif
- }`),backgroundPattern:Ir(`uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color);
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
- #endif
- gl_FragColor=out_color*u_opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);
- #ifdef FOG
- v_fog_pos=fog_position(a_pos);
- #endif
- }`),circle:Ir(`varying vec3 v_data;varying float v_visibility;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define mediump float radius
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define highp vec4 stroke_color
- #pragma mapbox: define mediump float stroke_width
- #pragma mapbox: define lowp float stroke_opacity
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize mediump float radius
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize highp vec4 stroke_color
- #pragma mapbox: initialize mediump float stroke_width
- #pragma mapbox: initialize lowp float stroke_opacity
- vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
- antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
- );vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color);
- #endif
- #ifdef FOG
- out_color=fog_apply_premultiplied(out_color,v_fog_pos);
- #endif
- gl_FragColor=out_color*(v_visibility*opacity_t);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`#define NUM_VISIBILITY_RINGS 2
- #define INV_SQRT2 0.70710678
- #define ELEVATION_BIAS 0.0001
- #define NUM_SAMPLES_PER_RING 16
- uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
- #endif
- varying vec3 v_data;varying float v_visibility;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define mediump float radius
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define highp vec4 stroke_color
- #pragma mapbox: define mediump float stroke_width
- #pragma mapbox: define lowp float stroke_opacity
- vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
- #if defined(TERRAIN)
- return elevation(pos)+ELEVATION_BIAS;
- #else
- return 0.0;
- #endif
- }vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
- #ifdef PITCH_WITH_MAP
- #ifdef PROJECTION_GLOBE_VIEW
- return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
- #else
- return u_matrix*( world_center+vec4(sample_offset,0,0) );
- #endif
- #else
- return projected_center+vec4(sample_offset,0,0);
- #endif
- }float get_sample_step() {
- #ifdef PITCH_WITH_MAP
- return 2.0*PI/float(NUM_SAMPLES_PER_RING);
- #else
- return PI/float(NUM_SAMPLES_PER_RING);
- #endif
- }void main(void) {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize mediump float radius
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize highp vec4 stroke_color
- #pragma mapbox: initialize mediump float stroke_width
- #pragma mapbox: initialize lowp float stroke_opacity
- vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
- #else
- surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
- #endif
- vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
- #ifdef PITCH_WITH_MAP
- #ifdef SCALE_WITH_MAP
- view_scale=1.0;
- #else
- view_scale=projected_center.w/u_camera_to_center_distance;
- #endif
- #else
- #ifdef SCALE_WITH_MAP
- view_scale=u_camera_to_center_distance;
- #else
- view_scale=projected_center.w;
- #endif
- #endif
- gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
- #ifdef TERRAIN
- float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
- #ifdef PITCH_WITH_MAP
- float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
- #else
- occlusion_world_center=world_center;occlusion_projected_center=projected_center;
- #endif
- for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
- #else
- visibility=1.0;
- #endif
- #ifdef PROJECTION_GLOBE_VIEW
- visibility=1.0;
- #endif
- v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
- #ifdef FOG
- v_fog_pos=fog_position(world_center.xyz);
- #endif
- }`),clippingMask:Ir("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ir(`uniform highp float u_intensity;varying vec2 v_extrude;
- #pragma mapbox: define highp float weight
- #define GAUSS_COEF 0.3989422804014327
- void main() {
- #pragma mapbox: initialize highp float weight
- float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
- #ifdef FOG
- if (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
- #endif
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
- #endif
- varying vec2 v_extrude;
- #pragma mapbox: define highp float weight
- #pragma mapbox: define mediump float radius
- const highp float ZERO=1.0/255.0/16.0;
- #define GAUSS_COEF 0.3989422804014327
- void main(void) {
- #pragma mapbox: initialize highp float weight
- #pragma mapbox: initialize mediump float radius
- vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
- #else
- pos=vec3(tilePos+extrude,elevation(tilePos));
- #endif
- gl_Position=u_matrix*vec4(pos,1);
- #ifdef FOG
- v_fog_pos=fog_position(pos);
- #endif
- }`),heatmapTexture:Ir(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(0.0);
- #endif
- }`,"attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Ir("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
- 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Ir("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}",`attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
- mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
- 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Ir("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}",`attribute vec2 a_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- attribute vec3 a_pos_3;
- #endif
- varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
- #ifdef PROJECTION_GLOBE_VIEW
- gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
- #else
- gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
- #endif
- }`),fill:Ir(`#pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float opacity
- vec4 out_color=color;
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color);
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
- #endif
- gl_FragColor=out_color*opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float opacity
- gl_Position=u_matrix*vec4(a_pos,0,1);
- #ifdef FOG
- v_fog_pos=fog_position(a_pos);
- #endif
- }`),fillOutline:Ir(`varying vec2 v_pos;
- #pragma mapbox: define highp vec4 outline_color
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 outline_color
- #pragma mapbox: initialize lowp float opacity
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color);
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
- #endif
- gl_FragColor=out_color*(alpha*opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
- #pragma mapbox: define highp vec4 outline_color
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize highp vec4 outline_color
- #pragma mapbox: initialize lowp float opacity
- gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
- #ifdef FOG
- v_fog_pos=fog_position(a_pos);
- #endif
- }`),fillOutlinePattern:Ir(`uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world;
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp vec4 pattern
- void main() {
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump vec4 pattern
- vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos);
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color);
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
- #endif
- gl_FragColor=out_color*(alpha*opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world;
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp vec4 pattern
- #pragma mapbox: define lowp float pixel_ratio
- void main() {
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump vec4 pattern
- #pragma mapbox: initialize lowp float pixel_ratio
- vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
- #ifdef FOG
- v_fog_pos=fog_position(a_pos);
- #endif
- }`),fillPattern:Ir(`uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp vec4 pattern
- void main() {
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump vec4 pattern
- vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color);
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
- #endif
- gl_FragColor=out_color*opacity;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp vec4 pattern
- #pragma mapbox: define lowp float pixel_ratio
- void main() {
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump vec4 pattern
- #pragma mapbox: initialize lowp float pixel_ratio
- vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
- #ifdef FOG
- v_fog_pos=fog_position(a_pos);
- #endif
- }`),fillExtrusion:Ir(`varying vec4 v_color;
- #ifdef RENDER_SHADOWS
- varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;
- #endif
- #ifdef FAUX_AO
- uniform lowp vec2 u_ao;varying vec3 v_ao;
- #endif
- #ifdef ZERO_ROOF_RADIUS
- varying vec4 v_roof_color;
- #endif
- #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)
- varying highp vec3 v_normal;
- #endif
- void main() {
- #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)
- vec3 normal=v_normal;
- #endif
- float z;vec4 color;
- #ifdef ZERO_ROOF_RADIUS
- z=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);
- #else
- color=v_color;
- #endif
- #ifdef FAUX_AO
- float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
- #ifdef ZERO_ROOF_RADIUS
- concave*=(1.0-z);
- #endif
- float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;
- #endif
- #ifdef RENDER_SHADOWS
- #ifdef ZERO_ROOF_RADIUS
- normal=mix(normal,vec3(0.0,0.0,1.0),z);
- #endif
- color.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);
- #endif
- #ifdef FOG
- color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
- #endif
- gl_FragColor=color;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
- #endif
- varying vec4 v_color;
- #ifdef RENDER_SHADOWS
- uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;
- #endif
- #ifdef ZERO_ROOF_RADIUS
- varying vec4 v_roof_color;
- #endif
- #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)
- varying highp vec3 v_normal;
- #endif
- #ifdef FAUX_AO
- uniform lowp vec2 u_ao;varying vec3 v_ao;
- #endif
- #pragma mapbox: define highp float base
- #pragma mapbox: define highp float height
- #pragma mapbox: define highp vec4 color
- void main() {
- #pragma mapbox: initialize highp float base
- #pragma mapbox: initialize highp float height
- #pragma mapbox: initialize highp vec4 color
- vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
- #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)
- v_normal=normal;
- #endif
- base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
- #if defined(HAS_CENTROID) || defined(TERRAIN)
- centroid_pos=a_centroid_pos;
- #endif
- float ele=0.0;float h=0.0;float c_ele;vec3 pos;
- #ifdef TERRAIN
- bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);
- #else
- h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
- #endif
- #ifdef PROJECTION_GLOBE_VIEW
- float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
- #endif
- float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);
- #ifdef RENDER_SHADOWS
- v_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;
- #endif
- float NdotL=0.0;float colorvalue=0.0;
- #ifdef LIGHTING_3D_MODE
- NdotL=calculate_NdotL(normal);
- #else
- colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);
- #endif
- if (normal.y !=0.0) {float r=0.84;
- #ifndef LIGHTING_3D_MODE
- r=mix(0.7,0.98,1.0-u_lightintensity);
- #endif
- NdotL*=(
- (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);
- #ifdef FAUX_AO
- float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
- #ifdef TERRAIN
- top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
- #endif
- v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
- #ifdef PROJECTION_GLOBE_VIEW
- top_height+=u_height_lift;
- #endif
- gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
- #endif
- #ifdef LIGHTING_3D_MODE
- v_color=apply_lighting(color,NdotL);
- #else
- v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));
- #endif
- v_color*=u_opacity;
- #ifdef ZERO_ROOF_RADIUS
- v_roof_color=vec4(0.0,0.0,0.0,1.0);
- #ifdef LIGHTING_3D_MODE
- v_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));
- #else
- float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));
- #endif
- v_roof_color*=u_opacity;
- #endif
- #ifdef FOG
- v_fog_pos=fog_position(pos);
- #endif
- }`),fillExtrusionPattern:Ir(`uniform vec2 u_texsize;uniform sampler2D u_image;
- #ifdef FAUX_AO
- uniform lowp vec2 u_ao;varying vec3 v_ao;
- #endif
- #ifdef LIGHTING_3D_MODE
- varying float v_NdotL;
- #endif
- varying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;
- #pragma mapbox: define lowp float base
- #pragma mapbox: define lowp float height
- #pragma mapbox: define lowp vec4 pattern
- #pragma mapbox: define lowp float pixel_ratio
- void main() {
- #pragma mapbox: initialize lowp float base
- #pragma mapbox: initialize lowp float height
- #pragma mapbox: initialize mediump vec4 pattern
- #pragma mapbox: initialize lowp float pixel_ratio
- vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color,v_NdotL)*u_opacity;
- #else
- out_color=out_color*v_lighting;
- #endif
- #ifdef FAUX_AO
- float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
- #endif
- gl_FragColor=out_color;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
- #endif
- varying vec2 v_pos;varying vec4 v_lighting;
- #ifdef FAUX_AO
- uniform lowp vec2 u_ao;varying vec3 v_ao;
- #endif
- #ifdef LIGHTING_3D_MODE
- varying float v_NdotL;
- #endif
- #pragma mapbox: define lowp float base
- #pragma mapbox: define lowp float height
- #pragma mapbox: define lowp vec4 pattern
- #pragma mapbox: define lowp float pixel_ratio
- void main() {
- #pragma mapbox: initialize lowp float base
- #pragma mapbox: initialize lowp float height
- #pragma mapbox: initialize mediump vec4 pattern
- #pragma mapbox: initialize lowp float pixel_ratio
- vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
- #if defined(HAS_CENTROID) || defined(TERRAIN)
- centroid_pos=a_centroid_pos;
- #endif
- float ele=0.0;float h=z;vec3 p;float c_ele;
- #ifdef TERRAIN
- bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);
- #else
- p=vec3(pos_nx.xy,z);
- #endif
- #ifdef PROJECTION_GLOBE_VIEW
- float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
- #endif
- float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
- ? pos_nx.xy
- : vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
- #ifdef LIGHTING_3D_MODE
- NdotL=calculate_NdotL(normal);
- #else
- NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
- #endif
- if (normal.y !=0.0) {float r=0.84;
- #ifndef LIGHTING_3D_MODE
- r=mix(0.7,0.98,1.0-u_lightintensity);
- #endif
- NdotL*=(
- (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
- #ifdef FAUX_AO
- float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
- #ifdef TERRAIN
- top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
- #endif
- v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
- #ifdef PROJECTION_GLOBE_VIEW
- top_height+=u_height_lift;
- #endif
- gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
- #endif
- #ifdef LIGHTING_3D_MODE
- v_NdotL=NdotL;
- #else
- v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
- #endif
- #ifdef FOG
- v_fog_pos=fog_position(p);
- #endif
- }`),hillshadePrepare:Ir(`#ifdef GL_ES
- precision highp float;
- #endif
- uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {
- #ifdef TERRAIN_DEM_FLOAT_FORMAT
- return texture2D(u_image,coord).a/4.0;
- #else
- vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;
- #endif
- }void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(
- (c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
- )/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(
- deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ir(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
- #ifdef LIGHTING_3D_MODE
- gl_FragColor=apply_lighting(gl_FragColor);
- #endif
- #ifdef FOG
- gl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));
- #endif
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
- #ifdef FOG
- v_fog_pos=fog_position(a_pos);
- #endif
- }`),line:Ir(`uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;
- #ifdef RENDER_LINE_DASH
- uniform sampler2D u_dash_image;varying vec2 v_tex;
- #endif
- #ifdef RENDER_LINE_GRADIENT
- uniform sampler2D u_gradient_image;
- #endif
- uniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float floorwidth
- #pragma mapbox: define lowp vec4 dash
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float floorwidth
- #pragma mapbox: initialize lowp vec4 dash
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);
- #ifdef RENDER_LINE_DASH
- float sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);
- #endif
- highp vec4 out_color;
- #ifdef RENDER_LINE_GRADIENT
- out_color=texture2D(u_gradient_image,v_uv.xy);
- #else
- out_color=color;
- #endif
- #ifdef RENDER_LINE_TRIM_OFFSET
- highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);}}
- #endif
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color);
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
- #endif
- #ifdef RENDER_LINE_ALPHA_DISCARD
- if (alpha < u_alpha_discard_threshold) {discard;}
- #endif
- #ifdef RENDER_LINE_BORDER
- float edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);
- #ifdef RENDER_LINE_BORDER_AUTO
- float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}
- #else
- out_color.rgb=mix(u_border_color.rgb,out_color.rgb,smoothAlpha);
- #endif
- }
- #endif
- gl_FragColor=out_color*(alpha*opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`
- #define EXTRUDE_SCALE 0.015873016
- attribute vec2 a_pos_normal;attribute vec4 a_data;
- #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
- attribute highp vec4 a_packed;
- #endif
- #ifdef RENDER_LINE_DASH
- attribute float a_linesofar;
- #endif
- uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;
- #ifdef RENDER_LINE_DASH
- uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;
- #endif
- #ifdef RENDER_LINE_GRADIENT
- uniform float u_image_height;
- #endif
- #pragma mapbox: define highp vec4 color
- #pragma mapbox: define lowp float floorwidth
- #pragma mapbox: define lowp vec4 dash
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define mediump float gapwidth
- #pragma mapbox: define lowp float offset
- #pragma mapbox: define mediump float width
- void main() {
- #pragma mapbox: initialize highp vec4 color
- #pragma mapbox: initialize lowp float floorwidth
- #pragma mapbox: initialize lowp vec4 dash
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize mediump float gapwidth
- #pragma mapbox: initialize lowp float offset
- #pragma mapbox: initialize mediump float width
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
- #ifndef RENDER_TO_TEXTURE
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
- #else
- v_gamma_scale=1.0;
- #endif
- #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
- float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];
- #ifdef RENDER_LINE_GRADIENT
- highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);
- #else
- v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);
- #endif
- #endif
- #ifdef RENDER_LINE_DASH
- float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);
- #endif
- v_width2=vec2(outset,inset);
- #ifdef FOG
- v_fog_pos=fog_position(pos);
- #endif
- }`),linePattern:Ir(`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
- #pragma mapbox: define lowp vec4 pattern
- #pragma mapbox: define lowp float pixel_ratio
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize mediump vec4 pattern
- #pragma mapbox: initialize lowp float pixel_ratio
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos);
- #ifdef LIGHTING_3D_MODE
- color=apply_lighting(color);
- #endif
- #ifdef FOG
- color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
- #endif
- gl_FragColor=color*(alpha*opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`
- #define scale 0.015873016
- attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
- #pragma mapbox: define lowp float blur
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float offset
- #pragma mapbox: define mediump float gapwidth
- #pragma mapbox: define mediump float width
- #pragma mapbox: define lowp float floorwidth
- #pragma mapbox: define lowp vec4 pattern
- #pragma mapbox: define lowp float pixel_ratio
- void main() {
- #pragma mapbox: initialize lowp float blur
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float offset
- #pragma mapbox: initialize mediump float gapwidth
- #pragma mapbox: initialize mediump float width
- #pragma mapbox: initialize lowp float floorwidth
- #pragma mapbox: initialize mediump vec4 pattern
- #pragma mapbox: initialize lowp float pixel_ratio
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
- #ifndef RENDER_TO_TEXTURE
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
- #else
- v_gamma_scale=1.0;
- #endif
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;
- #ifdef FOG
- v_fog_pos=fog_position(pos);
- #endif
- }`),raster:Ir(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(
- dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
- #ifdef LIGHTING_3D_MODE
- out_color=apply_lighting(out_color);
- #endif
- #ifdef FOG
- out_color=fog_dither(fog_apply(out_color,v_fog_pos));
- #endif
- gl_FragColor=vec4(out_color*color.a,color.a);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;
- #ifdef FOG
- v_fog_pos=fog_position(a_pos);
- #endif
- }`),symbolIcon:Ir(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize lowp float opacity
- lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;
- #ifdef PROJECTION_GLOBE_VIEW
- attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;
- #endif
- uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;
- #ifdef PROJECTION_GLOBE_VIEW
- uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
- #endif
- varying vec2 v_tex;varying float v_fade_opacity;
- #pragma mapbox: define lowp float opacity
- void main() {
- #pragma mapbox: initialize lowp float opacity
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
- #else
- world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
- #endif
- vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
- camera_to_anchor_distance/u_camera_to_center_distance :
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
- 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);
- #else
- offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);
- #endif
- vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
- #else
- projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
- #endif
- highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
- #ifdef TERRAIN
- #ifdef PITCH_WITH_MAP_TERRAIN
- vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
- #endif
- #endif
- float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
- #else
- gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
- #endif
- float projection_transition_fade=1.0;
- #if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
- projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
- #endif
- v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}`),symbolSDF:Ir(`#define SDF_PX 8.0
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
- #pragma mapbox: define highp vec4 fill_color
- #pragma mapbox: define highp vec4 halo_color
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float halo_width
- #pragma mapbox: define lowp float halo_blur
- void main() {
- #pragma mapbox: initialize highp vec4 fill_color
- #pragma mapbox: initialize highp vec4 halo_color
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float halo_width
- #pragma mapbox: initialize lowp float halo_blur
- float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;
- #ifdef PROJECTION_GLOBE_VIEW
- attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;
- #endif
- uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;
- #ifdef PROJECTION_GLOBE_VIEW
- uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
- #endif
- varying vec2 v_data0;varying vec3 v_data1;
- #pragma mapbox: define highp vec4 fill_color
- #pragma mapbox: define highp vec4 halo_color
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float halo_width
- #pragma mapbox: define lowp float halo_blur
- void main() {
- #pragma mapbox: initialize highp vec4 fill_color
- #pragma mapbox: initialize highp vec4 halo_color
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float halo_width
- #pragma mapbox: initialize lowp float halo_blur
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
- #else
- world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
- #endif
- vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
- camera_to_anchor_distance/u_camera_to_center_distance :
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
- 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);
- #else
- offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);
- #endif
- vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
- #else
- projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
- #endif
- highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);
- #ifdef TERRAIN
- #ifdef PITCH_WITH_MAP_TERRAIN
- vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
- #endif
- #endif
- float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
- #else
- gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
- #endif
- float gamma_scale=gl_Position.w;float projection_transition_fade=1.0;
- #if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
- projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
- #endif
- vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}`),symbolTextAndIcon:Ir(`#define SDF_PX 8.0
- #define SDF 1.0
- #define ICON 0.0
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
- #pragma mapbox: define highp vec4 fill_color
- #pragma mapbox: define highp vec4 halo_color
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float halo_width
- #pragma mapbox: define lowp float halo_blur
- void main() {
- #pragma mapbox: initialize highp vec4 fill_color
- #pragma mapbox: initialize highp vec4 halo_color
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float halo_width
- #pragma mapbox: initialize lowp float halo_blur
- float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;
- #ifdef PROJECTION_GLOBE_VIEW
- attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;
- #endif
- uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;
- #ifdef PROJECTION_GLOBE_VIEW
- uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
- #endif
- varying vec4 v_data0;varying vec4 v_data1;
- #pragma mapbox: define highp vec4 fill_color
- #pragma mapbox: define highp vec4 halo_color
- #pragma mapbox: define lowp float opacity
- #pragma mapbox: define lowp float halo_width
- #pragma mapbox: define lowp float halo_blur
- void main() {
- #pragma mapbox: initialize highp vec4 fill_color
- #pragma mapbox: initialize highp vec4 halo_color
- #pragma mapbox: initialize lowp float opacity
- #pragma mapbox: initialize lowp float halo_width
- #pragma mapbox: initialize lowp float halo_blur
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
- #else
- world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
- #endif
- vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
- camera_to_anchor_distance/u_camera_to_center_distance :
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
- 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
- #else
- projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
- #endif
- highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);
- #ifdef TERRAIN
- #ifdef PITCH_WITH_MAP_TERRAIN
- vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
- #endif
- #endif
- float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;
- #ifdef PROJECTION_GLOBE_VIEW
- vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
- #else
- gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
- #endif
- float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;
- #if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
- projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
- #endif
- v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}`),terrainRaster:Ir(`uniform sampler2D u_image0;varying vec2 v_pos0;
- #ifdef FOG
- varying float v_fog_opacity;
- #endif
- #ifdef RENDER_SHADOWS
- varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;
- #endif
- void main() {vec4 color=texture2D(u_image0,v_pos0);
- #ifdef RENDER_SHADOWS
- color.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);
- #endif
- #ifdef FOG
- #ifdef ZERO_EXAGGERATION
- color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
- #else
- color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
- #endif
- #endif
- gl_FragColor=color;
- #ifdef TERRAIN_WIREFRAME
- gl_FragColor=vec4(1.0,0.0,0.0,0.8);
- #endif
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;
- #ifdef FOG
- varying float v_fog_opacity;
- #endif
- #ifdef RENDER_SHADOWS
- uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;
- #endif
- const float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;
- #ifdef TERRAIN_WIREFRAME
- elevation+=u_skirt_height*u_skirt_height*wireframeOffset;
- #endif
- vec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
- #ifdef FOG
- #ifdef ZERO_EXAGGERATION
- v_fog_pos=fog_position(decodedPos);
- #else
- v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
- #endif
- #endif
- #ifdef RENDER_SHADOWS
- vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;
- #endif
- }`),terrainDepth:Ir(`#ifdef GL_ES
- precision highp float;
- #endif
- varying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:Ir(`
- varying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
- cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;
- #ifdef FOG
- sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
- #endif
- sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,kc),skyboxGradient:Ir(`varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));
- #ifdef FOG
- color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
- #endif
- color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,kc),skyboxCapture:Ir(`
- varying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;
- #ifdef GL_ES
- precision highp float;
- #endif
- #define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)
- #define BETA_M vec3(21e-6,21e-6,21e-6)
- #define MIE_G 0.76
- #define DENSITY_HEIGHT_SCALE_R 8000.0
- #define DENSITY_HEIGHT_SCALE_M 1200.0
- #define PLANET_RADIUS 6360e3
- #define ATMOSPHERE_RADIUS 6420e3
- #define SAMPLE_STEPS 10
- #define DENSITY_STEPS 4
- float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}`,"attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Ir(`uniform sampler2D u_image0;varying vec2 v_pos0;
- #ifndef FOG
- uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
- #endif
- void main() {vec4 color;
- #ifdef CUSTOM_ANTIALIASING
- vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
- mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias);
- #else
- color=texture2D(u_image0,v_pos0);
- #endif
- #ifdef FOG
- color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
- #endif
- gl_FragColor=color;
- #ifdef TERRAIN_WIREFRAME
- gl_FragColor=vec4(1.0,0.0,0.0,0.8);
- #endif
- #ifdef OVERDRAW_INSPECTOR
- gl_FragColor=vec4(1.0);
- #endif
- }`,`uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;
- #ifdef GLOBE_POLES
- attribute vec3 a_globe_pos;attribute vec2 a_uv;
- #else
- attribute vec2 a_pos;
- #endif
- varying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {
- #ifdef GLOBE_POLES
- vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
- #else
- float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 latLng=u_grid_matrix*vec3(a_pos,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
- #endif
- v_pos0=uv;vec2 tile_pos=uv*EXTENT;
- #ifdef GLOBE_POLES
- vec3 up_vector=normalize(globe_pos)*u_tile_up_scale;
- #else
- vec3 up_vector=elevationVector(tile_pos);
- #endif
- float height=elevation(tile_pos);
- #ifdef TERRAIN_WIREFRAME
- height+=wireframeOffset;
- #endif
- globe_pos+=up_vector*height;
- #ifdef GLOBE_POLES
- vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
- #else
- vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
- #endif
- gl_Position=u_proj_matrix*interpolated_pos;
- #ifdef FOG
- v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
- #endif
- }`),globeAtmosphere:Ir(`uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
- #ifdef PROJECTION_GLOBE_VIEW
- globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}
- #endif
- highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
- 0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;
- #ifdef PROJECTION_GLOBE_VIEW
- highp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?
- PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
- #else
- horizon_angle=horizon_angle_mercator;
- #endif
- horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:
- (n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:
- uv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}`,`attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
- mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
- mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`)};function ul(x,a){const m=x.replace(/\s*\/\/[^\n]*\n/g,`
- `).split(`
- `);for(let b of m)if(b=b.trim(),b[0]==="#"&&b.includes("if")&&!b.includes("endif")){b=b.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const S=b.split(" ");for(const P of S)a.includes(P)||a.push(P)}}function Ir(x,a){const m=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,b=a.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),S={},P=[...Ih];return ul(x,P),ul(a,P),{fragmentSource:x=x.replace(m,(H,W,ee,pe,fe)=>(S[fe]=!0,W==="define"?`
- #ifndef HAS_UNIFORM_u_${fe}
- varying ${ee} ${pe} ${fe};
- #else
- uniform ${ee} ${pe} u_${fe};
- #endif
- `:`
- #ifdef HAS_UNIFORM_u_${fe}
- ${ee} ${pe} ${fe} = u_${fe};
- #endif
- `)),vertexSource:a=a.replace(m,(H,W,ee,pe,fe)=>{const Se=pe==="float"?"vec2":"vec4",Qe=fe.match(/color/)?"color":Se;return S[fe]?W==="define"?`
- #ifndef HAS_UNIFORM_u_${fe}
- uniform lowp float u_${fe}_t;
- attribute ${ee} ${Se} a_${fe};
- varying ${ee} ${pe} ${fe};
- #else
- uniform ${ee} ${pe} u_${fe};
- #endif
- `:Qe==="vec4"?`
- #ifndef HAS_UNIFORM_u_${fe}
- ${fe} = a_${fe};
- #else
- ${ee} ${pe} ${fe} = u_${fe};
- #endif
- `:`
- #ifndef HAS_UNIFORM_u_${fe}
- ${fe} = unpack_mix_${Qe}(a_${fe}, u_${fe}_t);
- #else
- ${ee} ${pe} ${fe} = u_${fe};
- #endif
- `:W==="define"?`
- #ifndef HAS_UNIFORM_u_${fe}
- uniform lowp float u_${fe}_t;
- attribute ${ee} ${Se} a_${fe};
- #else
- uniform ${ee} ${pe} u_${fe};
- #endif
- `:Qe==="vec4"?`
- #ifndef HAS_UNIFORM_u_${fe}
- ${ee} ${pe} ${fe} = a_${fe};
- #else
- ${ee} ${pe} ${fe} = u_${fe};
- #endif
- `:`
- #ifndef HAS_UNIFORM_u_${fe}
- ${ee} ${pe} ${fe} = unpack_mix_${Qe}(a_${fe}, u_${fe}_t);
- #else
- ${ee} ${pe} ${fe} = u_${fe};
- #endif
- `}),staticAttributes:b,usedDefines:P}}class uc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(a,m,b,S,P,H,W){this.context=a;let ee=this.boundPaintVertexBuffers.length!==S.length;for(let fe=0;!ee&&fe<S.length;fe++)this.boundPaintVertexBuffers[fe]!==S[fe]&&(ee=!0);let pe=this.boundDynamicVertexBuffers.length!==W.length;for(let fe=0;!pe&&fe<W.length;fe++)this.boundDynamicVertexBuffers[fe]!==W[fe]&&(pe=!0);if(!a.extVertexArrayObject||!this.vao||this.boundProgram!==m||this.boundLayoutVertexBuffer!==b||ee||pe||this.boundIndexBuffer!==P||this.boundVertexOffset!==H)this.freshBind(m,b,S,P,H,W);else{a.bindVertexArrayOES.set(this.vao);for(const fe of W)fe&&fe.bind();P&&P.dynamicDraw&&P.bind()}}freshBind(a,m,b,S,P,H){let W;const ee=a.numAttributes,pe=this.context,fe=pe.gl;if(pe.extVertexArrayObject)this.vao&&this.destroy(),this.vao=pe.extVertexArrayObject.createVertexArrayOES(),pe.bindVertexArrayOES.set(this.vao),W=0,this.boundProgram=a,this.boundLayoutVertexBuffer=m,this.boundPaintVertexBuffers=b,this.boundIndexBuffer=S,this.boundVertexOffset=P,this.boundDynamicVertexBuffers=H;else{W=pe.currentNumAttributes||0;for(let Se=ee;Se<W;Se++)fe.disableVertexAttribArray(Se)}m.enableAttributes(fe,a),m.bind(),m.setVertexAttribPointers(fe,a,P);for(const Se of b)Se.enableAttributes(fe,a),Se.bind(),Se.setVertexAttribPointers(fe,a,P);for(const Se of H)Se&&(Se.enableAttributes(fe,a),Se.bind(),Se.setVertexAttribPointers(fe,a,P));S&&S.bind(),pe.currentNumAttributes=ee}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Nc(x,a){const m=Math.pow(2,a.canonical.z),b=a.canonical.y;return[new i.MercatorCoordinate(0,b/m).toLngLat().lat,new i.MercatorCoordinate(0,(b+1)/m).toLngLat().lat]}function _u(x,a,m,b,S,P,H){const W=x.context,ee=W.gl,pe=m.fbo;if(!pe)return;x.prepareDrawTile();const fe=x.useProgram("hillshade");W.activeTexture.set(ee.TEXTURE0),ee.bindTexture(ee.TEXTURE_2D,pe.colorAttachment.get());const Se=((lt,Xe,Ye,At)=>{const ht=Ye.paint.get("hillshade-shadow-color"),Bt=Ye.paint.get("hillshade-highlight-color"),Pt=Ye.paint.get("hillshade-accent-color");let It=Ye.paint.get("hillshade-illumination-direction")*(Math.PI/180);Ye.paint.get("hillshade-illumination-anchor")==="viewport"&&(It-=lt.transform.angle);const Ht=!lt.options.moving;return{u_matrix:At||lt.transform.calculateProjMatrix(Xe.tileID.toUnwrapped(),Ht),u_image:0,u_latrange:Nc(0,Xe.tileID),u_light:[Ye.paint.get("hillshade-exaggeration"),It],u_shadow:ht,u_highlight:Bt,u_accent:Pt}})(x,m,b,x.terrain?a.projMatrix:null);x.prepareDrawProgram(W,fe,a.toUnwrapped());const{tileBoundsBuffer:Qe,tileBoundsIndexBuffer:rt,tileBoundsSegments:nt}=x.getTileBoundsBuffers(m);fe.draw(W,ee.TRIANGLES,S,P,H,i.CullFaceMode.disabled,Se,b.id,Qe,rt,nt)}function Al(x,a,m){if(!a.needsDEMTextureUpload)return;const b=x.context,S=b.gl;b.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||x.getTileTexture(m.stride);const P=m.getPixels();a.demTexture?a.demTexture.update(P,{premultiply:!1}):a.demTexture=new i.Texture(b,P,S.RGBA,{premultiply:!1}),a.needsDEMTextureUpload=!1}function Ha(x,a,m,b,S,P){const H=x.context,W=H.gl;if(!a.dem)return;const ee=a.dem;if(H.activeTexture.set(W.TEXTURE1),Al(x,a,ee),!a.demTexture)return;a.demTexture.bind(W.NEAREST,W.CLAMP_TO_EDGE);const pe=ee.dim;H.activeTexture.set(W.TEXTURE0);let fe=a.fbo;if(!fe){const nt=new i.Texture(H,{width:pe,height:pe,data:null},W.RGBA);nt.bind(W.LINEAR,W.CLAMP_TO_EDGE),fe=a.fbo=H.createFramebuffer(pe,pe,!0),fe.colorAttachment.set(nt.texture)}H.bindFramebuffer.set(fe.framebuffer),H.viewport.set([0,0,pe,pe]);const{tileBoundsBuffer:Se,tileBoundsIndexBuffer:Qe,tileBoundsSegments:rt}=x.getMercatorTileBoundsBuffers();x.useProgram("hillshadePrepare").draw(H,W.TRIANGLES,b,S,P,i.CullFaceMode.disabled,((nt,lt)=>{const Xe=lt.stride,Ye=i.create();return i.ortho(Ye,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(Ye,Ye,[0,-i.EXTENT,0]),{u_matrix:Ye,u_image:1,u_dimension:[Xe,Xe],u_zoom:nt.overscaledZ,u_unpack:lt.unpackVector}})(a.tileID,ee),m.id,Se,Qe,rt),a.needsHillshadePrepare=!1}const Qc=x=>({u_matrix:new i.UniformMatrix4f(x),u_image0:new i.Uniform1i(x),u_skirt_height:new i.Uniform1f(x)}),dl=(x,a)=>({u_matrix:x,u_image0:0,u_skirt_height:a}),qr=(x,a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt)=>({u_proj_matrix:Float32Array.from(x),u_globe_matrix:a,u_normalize_matrix:Float32Array.from(b),u_merc_matrix:m,u_zoom_transition:S,u_merc_center:P,u_image0:0,u_frustum_tl:H,u_frustum_tr:W,u_frustum_br:ee,u_frustum_bl:pe,u_globe_pos:fe,u_globe_radius:Se,u_viewport:Qe,u_grid_matrix:rt?Float32Array.from(rt):new Float32Array(9)});function Fh(x,a){return x!=null&&a!=null&&!(!x.hasData()||!a.hasData())&&x.demTexture!=null&&a.demTexture!=null&&x.tileID.key!==a.tileID.key}const hr=new class{constructor(){this.operations={}}newMorphing(x,a,m,b,S){if(x in this.operations){const P=this.operations[x];P.to.tileID.key!==m.tileID.key&&(P.queued=m)}else this.operations[x]={startTime:b,phase:0,duration:S,from:a,to:m,queued:null}}getMorphValuesForProxy(x){if(!(x in this.operations))return null;const a=this.operations[x];return{from:a.from,to:a.to,phase:a.phase}}update(x){for(const a in this.operations){const m=this.operations[a];for(m.phase=(x-m.startTime)/m.duration;m.phase>=1||!this._validOp(m);)if(!this._nextOp(m,x)){delete this.operations[a];break}}}_nextOp(x,a){return!!x.queued&&(x.from=x.to,x.to=x.queued,x.queued=null,x.phase=0,x.startTime=a,!0)}_validOp(x){return x.from.hasData()&&x.to.hasData()}},Br={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function jr(x,a){const m=1<<x.z;return!a&&(x.x===0||x.x===m-1)||x.y===0||x.y===m-1}const $r=x=>({u_matrix:x});function Hl(x,a,m,b,S){if(S>0){const P=i.exported.now(),H=(P-x.timeAdded)/S,W=a?(P-a.timeAdded)/S:-1,ee=m.getSource(),pe=b.coveringZoomLevel({tileSize:ee.tileSize,roundZoom:ee.roundZoom}),fe=!a||Math.abs(a.tileID.overscaledZ-pe)>Math.abs(x.tileID.overscaledZ-pe),Se=fe&&x.refreshedUponExpiration?1:i.clamp(fe?H:1-W,0,1);return x.refreshedUponExpiration&&H>=1&&(x.refreshedUponExpiration=!1),a?{opacity:1,mix:1-Se}:{opacity:Se,mix:0}}return{opacity:1,mix:0}}class gr extends i.SourceCache{constructor(a){const m={type:"raster-dem",maxzoom:a.transform.maxZoom},b=new qe(jt(),null),S=ie("mock-dem",m,b,a.style);super("mock-dem",S,!1),S.setEventedParent(this),this._sourceLoaded=!0}_loadTile(a,m){a.state="loaded",m(null)}}class yu extends i.SourceCache{constructor(a){const m=ie("proxy",{type:"geojson",maxzoom:a.transform.maxZoom},new qe(jt(),null),a.style);super("proxy",m,!1),m.setEventedParent(this),this.map=this.getSource().map=a,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(a,m,b){if(a.freezeTileCoverage)return;this.transform=a;const S=a.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((P,H)=>{if(P[H.key]="",!this._tiles[H.key]){const W=new i.Tile(H,this._source.tileSize*H.overscaleFactor(),a.tileZoom);W.state="loaded",this._tiles[H.key]=W}return P},{});for(const P in this._tiles)P in S||(this.freeFBO(P),this._tiles[P].unloadVectorData(),delete this._tiles[P])}freeFBO(a){const m=this.proxyCachedFBO[a];if(m!==void 0){const b=Object.values(m);this.renderCachePool.push(...b),delete this.proxyCachedFBO[a]}}deallocRenderCache(){this.renderCache.forEach(a=>a.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class iA extends i.OverscaledTileID{constructor(a,m,b){super(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y),this.proxyTileKey=m,this.projMatrix=b}}class nA extends i.Elevation{constructor(a,m){super(),this.painter=a,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[b,S,P]=function(ee){const pe=new i.StructArrayLayout4i8,fe=new i.StructArrayLayout3ui6,Se=131;pe.reserve(17161),fe.reserve(33800);const Qe=i.EXTENT/128,rt=i.EXTENT+Qe/2,nt=rt+Qe;for(let Xe=-Qe;Xe<nt;Xe+=Qe)for(let Ye=-Qe;Ye<nt;Ye+=Qe){const At=Ye<0||Ye>rt||Xe<0||Xe>rt?24575:0,ht=i.clamp(Math.round(Ye),0,i.EXTENT),Bt=i.clamp(Math.round(Xe),0,i.EXTENT);pe.emplaceBack(ht+At,Bt,ht,Bt)}const lt=(Xe,Ye)=>{const At=Ye*Se+Xe;fe.emplaceBack(At+1,At,At+Se),fe.emplaceBack(At+Se,At+Se+1,At+1)};for(let Xe=1;Xe<129;Xe++)for(let Ye=1;Ye<129;Ye++)lt(Ye,Xe);return[0,129].forEach(Xe=>{for(let Ye=0;Ye<130;Ye++)lt(Ye,Xe),lt(Xe,Ye)}),[pe,fe,32768]}(),H=a.context;this.gridBuffer=H.createVertexBuffer(b,i.boundsAttributes.members),this.gridIndexBuffer=H.createIndexBuffer(S),this.gridSegments=i.SegmentVector.simpleSegment(0,0,b.length,S.length),this.gridNoSkirtSegments=i.SegmentVector.simpleSegment(0,0,b.length,P),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new yu(m.map),this.orthoMatrix=i.create(),i.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,i.EXTENT,0,i.EXTENT,0,1);const W=H.gl;this._overlapStencilMode=new i.StencilMode({func:W.GEQUAL,mask:255},0,255,W.KEEP,W.KEEP,W.REPLACE),this._previousZoom=a.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=m,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new gr(m.map)}set style(a){a.on("data",this._onStyleDataEvent.bind(this)),a.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=a,this._checkRenderCacheEfficiency()}update(a,m,b){if(a&&a.terrain){this._style!==a&&(this.style=a),this.enabled=!0;const S=a.terrain.properties;this.sourceCache=a.terrain.drapeRenderMode===0?this._mockSourceCache:a._getSourceCache(S.get("source")),this._exaggeration=S.get("exaggeration");const P=()=>{this.sourceCache.used&&i.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
- This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const H=this.getScaledDemTileSize();this.sourceCache.update(m,H,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,P(),this._initializing=!0),P(),m.updateElevation(!0,b),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(m),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(a){this._findCoveringTileCache[a]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const a=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||a.efficiency!==100&&i.warnOnce(`Terrain render cache efficiency is not optimal (${a.efficiency}%) and performance
- may be affected negatively, consider placing all background, fill and line layers before layer
- with id '${a.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(a){a.coord&&a.dataType==="source"?this._clearRenderCacheForTile(a.sourceCacheId,a.coord):a.dataType==="style"&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const a in this._style._sourceCaches)this._style._sourceCaches[a].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(a=>a.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const a=2*this.proxySourceCache.getSource().tileSize;return[a,a]}set useVertexMorphing(a){this._useVertexMorphing=a}updateTileBinding(a){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const m=this.proxySourceCache,b=this.painter.transform;this._initializing&&(this._initializing=b._centerAltitude===0&&this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(b.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const S=this.proxyCoords=m.getIds().map(ee=>{const pe=m.getTileByID(ee).tileID;return pe.projMatrix=b.calculateProjMatrix(pe.toUnwrapped()),pe});(function(ee,pe){const fe=pe.transform.pointCoordinate(pe.transform.getCameraPoint()),Se=new i.pointGeometry(fe.x,fe.y);ee.sort((Qe,rt)=>{if(rt.overscaledZ-Qe.overscaledZ)return rt.overscaledZ-Qe.overscaledZ;const nt=new i.pointGeometry(Qe.canonical.x+(1<<Qe.canonical.z)*Qe.wrap,Qe.canonical.y),lt=new i.pointGeometry(rt.canonical.x+(1<<rt.canonical.z)*rt.wrap,rt.canonical.y),Xe=Se.mult(1<<Qe.canonical.z);return Xe.x-=.5,Xe.y-=.5,Xe.distSqr(nt)-Xe.distSqr(lt)})})(S,this.painter),this._previousZoom=b.zoom;const P=this.proxyToSource||{};this.proxyToSource={},S.forEach(ee=>{this.proxyToSource[ee.key]={}}),this.terrainTileForTile={};const H=this._style._sourceCaches;for(const ee in H){const pe=H[ee];if(!pe.used||(pe!==this.sourceCache&&this.resetTileLookupCache(pe.id),this._setupProxiedCoordsForOrtho(pe,a[ee],P),pe.usedForTerrain))continue;const fe=a[ee];pe.getSource().reparseOverscaled&&this._assignTerrainTiles(fe)}this.proxiedCoords[m.id]=S.map(ee=>new iA(ee,ee.key,this.orthoMatrix)),this._assignTerrainTiles(S),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(P),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();const W={};this._visibleDemTiles=[];for(const ee of this.proxyCoords){const pe=this.terrainTileForTile[ee.key];if(!pe)continue;const fe=pe.tileID.key;fe in W||(this._visibleDemTiles.push(pe),W[fe]=fe)}}_assignTerrainTiles(a){this._initializing||a.forEach(m=>{if(this.terrainTileForTile[m.key])return;const b=this._findTileCoveringTileID(m,this.sourceCache);b&&(this.terrainTileForTile[m.key]=b)})}_prepareDEMTextures(){const a=this.painter.context,m=a.gl;for(const b in this.terrainTileForTile){const S=this.terrainTileForTile[b],P=S.dem;!P||S.demTexture&&!S.needsDEMTextureUpload||(a.activeTexture.set(m.TEXTURE1),Al(this.painter,S,P))}}_prepareDemTileUniforms(a,m,b,S){if(!m||m.demTexture==null)return!1;const P=a.tileID.canonical,H=Math.pow(2,m.tileID.canonical.z-P.z),W=S||"";return b[`u_dem_tl${W}`]=[P.x*H%1,P.y*H%1],b[`u_dem_scale${W}`]=H,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const a=this.painter.context,m=a.gl;if(!this._emptyDepthBufferTexture){const b=new i.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new i.Texture(a,b,m.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let a=0;const m=this._visibleDemTiles.reduce((b,S)=>{if(!S.dem)return b;const P=S.dem.tree.minimums[0];return P>0&&a++,b+P},0);return a?m/a:0}_updateEmptyDEMTexture(){const a=this.painter.context,m=a.gl;a.activeTexture.set(m.TEXTURE2);const b=this._getLoadedAreaMinimum(),S=new i.RGBAImage({width:1,height:1},new Uint8Array(i.DEMData.pack(b,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let P=this._emptyDEMTexture;return P?P.update(S,{premultiply:!1}):P=this._emptyDEMTexture=new i.Texture(a,S,m.RGBA,{premultiply:!1}),P}setupElevationDraw(a,m,b){const S=this.painter.context,P=S.gl,H=(W=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(W),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});var W;H.u_dem_size=this.sourceCache.getSource().tileSize,H.u_exaggeration=this.exaggeration();let ee=null,pe=null,fe=1;if(b&&b.morphing&&this._useVertexMorphing){const Se=b.morphing.srcDemTile,Qe=b.morphing.dstDemTile;fe=b.morphing.phase,Se&&Qe&&(this._prepareDemTileUniforms(a,Se,H,"_prev")&&(pe=Se),this._prepareDemTileUniforms(a,Qe,H)&&(ee=Qe))}if(pe&&ee?(S.activeTexture.set(P.TEXTURE2),ee.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE,P.NEAREST),S.activeTexture.set(P.TEXTURE4),pe.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE,P.NEAREST),H.u_dem_lerp=fe):(ee=this.terrainTileForTile[a.tileID.key],S.activeTexture.set(P.TEXTURE2),(this._prepareDemTileUniforms(a,ee,H)?ee.demTexture:this.emptyDEMTexture).bind(P.NEAREST,P.CLAMP_TO_EDGE)),S.activeTexture.set(P.TEXTURE3),b&&b.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE),this._depthFBO&&(H.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE),H.u_depth_size_inv=[1,1]),b&&b.useMeterToDem&&ee){const Se=(1<<ee.tileID.canonical.z)*i.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;H.u_meter_to_dem=Se}if(b&&b.labelPlaneMatrixInv&&(H.u_label_plane_matrix_inv=b.labelPlaneMatrixInv),m.setTerrainUniformValues(S,H),this.painter.transform.projection.name==="globe"){const Se=this.globeUniformValues(this.painter.transform,a.tileID.canonical,b&&b.useDenormalizedUpVectorScale);m.setGlobeUniformValues(S,Se)}}globeUniformValues(a,m,b){const S=a.projection;return{u_tile_tl_up:S.upVector(m,0,0),u_tile_tr_up:S.upVector(m,i.EXTENT,0),u_tile_br_up:S.upVector(m,i.EXTENT,i.EXTENT),u_tile_bl_up:S.upVector(m,0,i.EXTENT),u_tile_up_scale:b?i.GLOBE_METERS_TO_ECEF:S.upVectorScale(m,a.center.lat,a.worldSize).metersToTile}}renderToBackBuffer(a){const m=this.painter,b=this.painter.context;a.length!==0&&(b.bindFramebuffer.set(null),b.viewport.set([0,0,m.width,m.height]),m.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(S,P,H,W,ee){if(S.transform.projection.name==="globe")(function(pe,fe,Se,Qe,rt){const nt=pe.context,lt=nt.gl;let Xe,Ye;const At=pe.options.showTerrainWireframe?2:0,ht=pe.transform,Bt=i.globeUseCustomAntiAliasing(pe,nt,ht),Pt=(Ri,Ai)=>{if(Ye===Ri)return;const Mi=[Br[Ri],"PROJECTION_GLOBE_VIEW"];Bt&&Mi.push("CUSTOM_ANTIALIASING"),Ai&&Mi.push(Br[At]),Xe=pe.useProgram("globeRaster",null,Mi),Ye=Ri},It=pe.colorModeForRenderPass(),Ht=new i.DepthMode(lt.LEQUAL,i.DepthMode.ReadWrite,pe.depthRangeFor3D);hr.update(rt);const hi=i.calculateGlobeMercatorMatrix(ht),si=[i.mercatorXfromLng(ht.center.lng),i.mercatorYfromLat(ht.center.lat)],qt=At?[!1,!0]:[!1],ji=pe.globeSharedBuffers,Kt=[ht.width*i.exported.devicePixelRatio,ht.height*i.exported.devicePixelRatio],Bi=Float32Array.from(ht.globeMatrix),di={useDenormalizedUpVectorScale:!0};if(qt.forEach(Ri=>{Ye=-1;const Ai=Ri?lt.LINES:lt.TRIANGLES;for(const Mi of Qe){const $i=Se.getTile(Mi),Jt=i.StencilMode.disabled,pi=fe.prevTerrainTileForTile[Mi.key],In=fe.terrainTileForTile[Mi.key];Fh(pi,In)&&hr.newMorphing(Mi.key,pi,In,rt,250),nt.activeTexture.set(lt.TEXTURE0),$i.texture.bind(lt.LINEAR,lt.CLAMP_TO_EDGE);const Hn=hr.getMorphValuesForProxy(Mi.key),Mn=Hn?1:0;Hn&&i.extend$1(di,{morphing:{srcDemTile:Hn.from,dstDemTile:Hn.to,phase:i.easeCubicInOut(Hn.phase)}});const $n=i.tileCornersToBounds(Mi.canonical),ar=i.getLatitudinalLod($n.getCenter().lat),On=i.getGridMatrix(Mi.canonical,$n,ar,ht.worldSize/ht._pixelsPerMercatorPixel),_n=i.globeNormalizeECEF(i.globeTileBounds(Mi.canonical)),Dr=qr(ht.projMatrix,Bi,hi,_n,i.globeToMercatorTransition(ht.zoom),si,ht.frustumCorners.TL,ht.frustumCorners.TR,ht.frustumCorners.BR,ht.frustumCorners.BL,ht.globeCenterInViewSpace,ht.globeRadius,Kt,On);if(Pt(Mn,Ri),fe.setupElevationDraw($i,Xe,di),pe.prepareDrawProgram(nt,Xe,Mi.toUnwrapped()),ji){const[Or,Nr,Qr]=Ri?ji.getWirefameBuffers(pe.context,ar):ji.getGridBuffers(ar);Xe.draw(nt,Ai,Ht,Jt,It,i.CullFaceMode.backCCW,Dr,"globe_raster",Or,Nr,Qr)}}}),ji){const Ri=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Bt&&Ri.push("CUSTOM_ANTIALIASING"),Xe=pe.useProgram("globeRaster",null,Ri);for(const Ai of Qe){const{x:Mi,y:$i,z:Jt}=Ai.canonical,pi=$i===0,In=$i===(1<<Jt)-1,[Hn,Mn,$n,ar]=ji.getPoleBuffers(Jt);if(ar&&(pi||In)){const On=Se.getTile(Ai);nt.activeTexture.set(lt.TEXTURE0),On.texture.bind(lt.LINEAR,lt.CLAMP_TO_EDGE);let _n=i.globePoleMatrixForTile(Jt,Mi,ht);const Dr=i.globeNormalizeECEF(i.globeTileBounds(Ai.canonical)),Or=(Nr,Qr)=>Nr.draw(nt,lt.TRIANGLES,Ht,i.StencilMode.disabled,It,i.CullFaceMode.disabled,qr(ht.projMatrix,_n,_n,Dr,0,si,ht.frustumCorners.TL,ht.frustumCorners.TR,ht.frustumCorners.BR,ht.frustumCorners.BL,ht.globeCenterInViewSpace,ht.globeRadius,Kt),"globe_pole_raster",Qr,$n,ar);fe.setupElevationDraw(On,Xe,di),pe.prepareDrawProgram(nt,Xe,Ai.toUnwrapped()),pi&&Or(Xe,Hn),In&&(_n=i.scale(i.create(),_n,[1,-1,1]),Or(Xe,Mn))}}}})(S,P,H,W,ee);else{const pe=S.context,fe=pe.gl;let Se,Qe;const rt=S.options.showTerrainWireframe?2:0,nt=(ht,Bt)=>{if(Qe===ht)return;const Pt=[Br[ht]];Bt&&Pt.push(Br[rt]),Se=S.useProgram("terrainRaster",null,Pt),Qe=ht},lt=S.colorModeForRenderPass(),Xe=new i.DepthMode(fe.LEQUAL,i.DepthMode.ReadWrite,S.depthRangeFor3D);hr.update(ee);const Ye=S.transform,At=6*Math.pow(1.5,22-Ye.zoom)*P.exaggeration();(rt?[!1,!0]:[!1]).forEach(ht=>{Qe=-1;const Bt=ht?fe.LINES:fe.TRIANGLES,[Pt,It]=ht?P.getWirefameBuffer():[P.gridIndexBuffer,P.gridSegments];for(const Ht of W){const hi=H.getTile(Ht),si=i.StencilMode.disabled,qt=P.prevTerrainTileForTile[Ht.key],ji=P.terrainTileForTile[Ht.key];Fh(qt,ji)&&hr.newMorphing(Ht.key,qt,ji,ee,250),pe.activeTexture.set(fe.TEXTURE0),hi.texture.bind(fe.LINEAR,fe.CLAMP_TO_EDGE,fe.LINEAR_MIPMAP_NEAREST);const Kt=hr.getMorphValuesForProxy(Ht.key),Bi=Kt?1:0;let di;Kt&&(di={morphing:{srcDemTile:Kt.from,dstDemTile:Kt.to,phase:i.easeCubicInOut(Kt.phase)}});const Ri=dl(Ht.projMatrix,jr(Ht.canonical,Ye.renderWorldCopies)?At/10:At);nt(Bi,ht),P.setupElevationDraw(hi,Se,di),S.prepareDrawProgram(pe,Se,Ht.toUnwrapped()),Se.draw(pe,Bt,Xe,si,lt,i.CullFaceMode.backCCW,Ri,"terrain_raster",P.gridBuffer,Pt,It)}})}}(m,this,this.proxySourceCache,a,this._updateTimestamp),this.renderingToTexture=!0,m.gpuTimingDeferredRenderEnd(),a.splice(0,a.length))}renderBatch(a){if(this._drapedRenderBatches.length===0)return a+1;this.renderingToTexture=!0;const m=this.painter,b=this.painter.context,S=this.proxySourceCache,P=this.proxiedCoords[S.id],H=this._drapedRenderBatches.shift(),W=[],ee=m.style.order;let pe=0;for(const fe of P){const Se=S.getTileByID(fe.proxyTileKey),Qe=S.proxyCachedFBO[fe.key]?S.proxyCachedFBO[fe.key][a]:void 0,rt=Qe!==void 0?S.renderCache[Qe]:this.pool[pe++],nt=Qe!==void 0;if(Se.texture=rt.tex,nt&&!rt.dirty){W.push(Se.tileID);continue}let lt;b.bindFramebuffer.set(rt.fb.framebuffer),this.renderedToTile=!1,rt.dirty&&(b.clear({color:i.Color.transparent,stencil:0}),rt.dirty=!1);for(let Xe=H.start;Xe<=H.end;++Xe){const Ye=m.style._layers[ee[Xe]];if(Ye.isHidden(m.transform.zoom))continue;const At=m.style._getLayerSourceCache(Ye),ht=At?this.proxyToSource[fe.key][At.id]:[fe];if(!ht)continue;const Bt=ht;b.viewport.set([0,0,rt.fb.width,rt.fb.height]),lt!==(At?At.id:null)&&(this._setupStencil(rt,ht,Ye,At),lt=At?At.id:null),m.renderLayer(m,At,Ye,Bt)}this.renderedToTile?(rt.dirty=!0,W.push(Se.tileID)):nt||--pe,pe===5&&(pe=0,this.renderToBackBuffer(W))}return this.renderToBackBuffer(W),this.renderingToTexture=!1,b.bindFramebuffer.set(null),b.viewport.set([0,0,m.width,m.height]),H.end+1}postRender(){}renderCacheEfficiency(a){const m=a.order.length;if(m===0)return{efficiency:100};let b,S=0,P=0,H=!1;for(let W=0;W<m;++W){const ee=a._layers[a.order[W]];this._style.isLayerDraped(ee)?(H&&++S,++P):H||(H=!0,b=ee.id)}return P===0?{efficiency:100}:{efficiency:100*(1-S/P),firstUndrapedLayer:b}}getMinElevationBelowMSL(){let a=0;return this._visibleDemTiles.filter(m=>m.dem).forEach(m=>{a=Math.min(a,m.dem.tree.minimums[0])}),a===0?a:(a-30)*this._exaggeration}raycast(a,m,b){if(!this._visibleDemTiles)return null;const S=this._visibleDemTiles.filter(P=>P.dem).map(P=>{const H=P.tileID,W=1<<H.overscaledZ,{x:ee,y:pe}=H.canonical,fe=ee/W,Se=(ee+1)/W,Qe=pe/W,rt=(pe+1)/W;return{minx:fe,miny:Qe,maxx:Se,maxy:rt,t:P.dem.tree.raycastRoot(fe,Qe,Se,rt,a,m,b),tile:P}});S.sort((P,H)=>(P.t!==null?P.t:Number.MAX_VALUE)-(H.t!==null?H.t:Number.MAX_VALUE));for(const P of S){if(P.t==null)return null;const H=P.tile.dem.tree.raycast(P.minx,P.miny,P.maxx,P.maxy,a,m,b);if(H!=null)return H}return null}_createFBO(){const a=this.painter.context,m=a.gl,b=this.drapeBufferSize;a.activeTexture.set(m.TEXTURE0);const S=new i.Texture(a,{width:b[0],height:b[1],data:null},m.RGBA);S.bind(m.LINEAR,m.CLAMP_TO_EDGE);const P=a.createFramebuffer(b[0],b[1],!1);return P.colorAttachment.set(S.texture),P.depthAttachment=new zs(a,P.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=a.createRenderbuffer(a.gl.DEPTH_STENCIL,b[0],b[1]),this._stencilRef=0,P.depthAttachment.set(this._sharedDepthStencil),a.clear({stencil:0})):P.depthAttachment.set(this._sharedDepthStencil),a.extTextureFilterAnisotropic&&!a.extTextureFilterAnisotropicForceOff&&m.texParameterf(m.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax),{fb:P,tex:S,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.light&&this._style.light.hasTransition())return!0;for(const a in this._style._sourceCaches)if(this._style._sourceCaches[a].hasTransition())return!0;return this._style.order.some(a=>{const m=this._style._layers[a],b=m.isHidden(this.painter.transform.zoom);return m.type!=="custom"&&!b&&m.hasTransition()})}_clearRasterFadeFromRenderCache(){let a=!1;for(const m in this._style._sourceCaches)if(this._style._sourceCaches[m]._source instanceof Ue){a=!0;break}if(a)for(let m=0;m<this._style.order.length;++m){const b=this._style._layers[this._style.order[m]],S=b.isHidden(this.painter.transform.zoom),P=this._style._getLayerSourceCache(b);if(b.type!=="raster"||S||!P)continue;const H=b.paint.get("raster-fade-duration");for(const W of this.proxyCoords){const ee=this.proxyToSource[W.key][P.id];if(ee)for(const pe of ee){const fe=Hl(P.getTile(pe),P.findLoadedParent(pe,0),P,this.painter.transform,H);(fe.opacity!==1||fe.mix!==0)&&this._clearRenderCacheForTile(P.id,pe)}}}}_setupDrapedRenderBatches(){const a=this._style.order,m=a.length;if(m===0)return;const b=[];let S,P=0,H=this._style._layers[a[P]];for(;!this._style.isLayerDraped(H)&&H.isHidden(this.painter.transform.zoom)&&++P<m;)H=this._style._layers[a[P]];for(;P<m;++P){const W=this._style._layers[a[P]];W.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(W)?S===void 0&&(S=P):S!==void 0&&(b.push({start:S,end:P-1}),S=void 0))}S!==void 0&&b.push({start:S,end:P-1}),this._drapedRenderBatches=b}_setupRenderCache(a){const m=this.proxySourceCache;if(this._shouldDisableRenderCache()||this._invalidateRenderCache){if(this._invalidateRenderCache=!1,m.renderCache.length>m.renderCachePool.length){const H=Object.values(m.proxyCachedFBO);m.proxyCachedFBO={};for(let W=0;W<H.length;++W){const ee=Object.values(H[W]);m.renderCachePool.push(...ee)}}return}this._clearRasterFadeFromRenderCache();const b=this.proxyCoords,S=this._tilesDirty;for(let H=b.length-1;H>=0;H--){const W=b[H];if(m.getTileByID(W.key),m.proxyCachedFBO[W.key]!==void 0){const ee=a[W.key],pe=this.proxyToSource[W.key];let fe=0;for(const Se in pe){const Qe=pe[Se],rt=ee[Se];if(!rt||rt.length!==Qe.length||Qe.some((nt,lt)=>nt!==rt[lt]||S[Se]&&S[Se].hasOwnProperty(nt.key))){fe=-1;break}++fe}for(const Se in m.proxyCachedFBO[W.key])m.renderCache[m.proxyCachedFBO[W.key][Se]].dirty=fe<0||fe!==Object.values(ee).length}}const P=[...this._drapedRenderBatches];P.sort((H,W)=>W.end-W.start-(H.end-H.start));for(const H of P)for(const W of b){if(m.proxyCachedFBO[W.key])continue;let ee=m.renderCachePool.pop();ee===void 0&&m.renderCache.length<50&&(ee=m.renderCache.length,m.renderCache.push(this._createFBO())),ee!==void 0&&(m.proxyCachedFBO[W.key]={},m.proxyCachedFBO[W.key][H.start]=ee,m.renderCache[ee].dirty=!0)}this._tilesDirty={}}_setupStencil(a,m,b,S){if(!S||!this._sourceTilesOverlap[S.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const P=this.painter.context,H=P.gl;if(m.length<=1)return void(this._overlapStencilType=!1);let W;if(b.isTileClipped())W=m.length,this._overlapStencilMode.test={func:H.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(m[0].overscaledZ>m[m.length-1].overscaledZ))return void(this._overlapStencilType=!1);W=1,this._overlapStencilMode.test={func:H.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+W>255&&(P.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=W,this._overlapStencilMode.ref=this._stencilRef,b.isTileClipped()&&this._renderTileClippingMasks(m,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(a){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[a.key]),this._overlapStencilMode):i.StencilMode.disabled}_renderTileClippingMasks(a,m){const b=this.painter,S=this.painter.context,P=S.gl;b._tileClippingMaskIDs={},S.setColorMode(i.ColorMode.disabled),S.setDepthMode(i.DepthMode.disabled);const H=b.useProgram("clippingMask");for(const W of a){const ee=b._tileClippingMaskIDs[W.key]=--m;H.draw(S,P.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:P.ALWAYS,mask:0},ee,255,P.KEEP,P.KEEP,P.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,$r(W.projMatrix),"$clipping",b.tileExtentBuffer,b.quadTriangleIndexBuffer,b.tileExtentSegments)}}pointCoordinate(a){const m=this.painter.transform;if(a.x<0||a.x>m.width||a.y<0||a.y>m.height)return null;const b=[a.x,a.y,1,1];i.transformMat4$1(b,b,m.pixelMatrixInverse),i.scale$1(b,b,1/b[3]),b[0]/=m.worldSize,b[1]/=m.worldSize;const S=m._camera.position,P=i.mercatorZfromAltitude(1,m.center.lat),H=[S[0],S[1],S[2]/P,0],W=i.subtract([],b.slice(0,3),H);i.normalize(W,W);const ee=this.raycast(H,W,this._exaggeration);return ee!==null&&ee?(i.scaleAndAdd(H,H,W,ee),H[3]=H[2],H[2]*=P,H):null}drawDepth(){const a=this.painter,m=a.context,b=this.proxySourceCache,S=Math.ceil(a.width),P=Math.ceil(a.height);if(!this._depthFBO||this._depthFBO.width===S&&this._depthFBO.height===P||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const H=m.gl,W=m.createFramebuffer(S,P,!0);m.activeTexture.set(H.TEXTURE0);const ee=new i.Texture(m,{width:S,height:P,data:null},H.RGBA);ee.bind(H.NEAREST,H.CLAMP_TO_EDGE),W.colorAttachment.set(ee.texture);const pe=m.createRenderbuffer(m.gl.DEPTH_COMPONENT16,S,P);W.depthAttachment.set(pe),this._depthFBO=W,this._depthTexture=ee}m.bindFramebuffer.set(this._depthFBO.framebuffer),m.viewport.set([0,0,S,P]),function(H,W,ee,pe){if(H.transform.projection.name==="globe")return;const fe=H.context,Se=fe.gl;fe.clear({depth:1});const Qe=H.useProgram("terrainDepth"),rt=new i.DepthMode(Se.LESS,i.DepthMode.ReadWrite,H.depthRangeFor3D);for(const nt of pe){const lt=ee.getTile(nt),Xe=dl(nt.projMatrix,0);W.setupElevationDraw(lt,Qe),Qe.draw(fe,Se.TRIANGLES,rt,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,Xe,"terrain_depth",W.gridBuffer,W.gridIndexBuffer,W.gridNoSkirtSegments)}}(a,this,b,this.proxyCoords)}_setupProxiedCoordsForOrtho(a,m,b){if(a.getSource()instanceof X)return this._setupProxiedCoordsForImageSource(a,m,b);this._findCoveringTileCache[a.id]=this._findCoveringTileCache[a.id]||{};const S=this.proxiedCoords[a.id]=[],P=this.proxyCoords;for(let W=0;W<P.length;W++){const ee=P[W],pe=this._findTileCoveringTileID(ee,a);if(pe){const fe=this._createProxiedId(ee,pe,b[ee.key]&&b[ee.key][a.id]);S.push(fe),this.proxyToSource[ee.key][a.id]=[fe]}}let H=!1;for(let W=0;W<m.length;W++){const ee=a.getTile(m[W]);if(!ee||!ee.hasData())continue;const pe=this._findTileCoveringTileID(ee.tileID,this.proxySourceCache);if(pe&&pe.tileID.canonical.z!==ee.tileID.canonical.z){const fe=this.proxyToSource[pe.tileID.key][a.id],Se=this._createProxiedId(pe.tileID,ee,b[pe.tileID.key]&&b[pe.tileID.key][a.id]);fe?fe.splice(fe.length-1,0,Se):this.proxyToSource[pe.tileID.key][a.id]=[Se],S.push(Se),H=!0}}this._sourceTilesOverlap[a.id]=H}_setupProxiedCoordsForImageSource(a,m,b){if(!a.getSource().loaded())return;const S=this.proxiedCoords[a.id]=[],P=this.proxyCoords,H=a.getSource(),W=new i.pointGeometry(H.tileID.x,H.tileID.y)._div(1<<H.tileID.z),ee=H.coordinates.map(i.MercatorCoordinate.fromLngLat).reduce((fe,Se)=>(fe.min.x=Math.min(fe.min.x,Se.x-W.x),fe.min.y=Math.min(fe.min.y,Se.y-W.y),fe.max.x=Math.max(fe.max.x,Se.x-W.x),fe.max.y=Math.max(fe.max.y,Se.y-W.y),fe),{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),pe=(fe,Se)=>{const Qe=fe.wrap+fe.canonical.x/(1<<fe.canonical.z),rt=fe.canonical.y/(1<<fe.canonical.z),nt=i.EXTENT/(1<<fe.canonical.z),lt=Se.wrap+Se.canonical.x/(1<<Se.canonical.z),Xe=Se.canonical.y/(1<<Se.canonical.z);return Qe+nt<lt+ee.min.x||Qe>lt+ee.max.x||rt+nt<Xe+ee.min.y||rt>Xe+ee.max.y};for(let fe=0;fe<P.length;fe++){const Se=P[fe];for(let Qe=0;Qe<m.length;Qe++){const rt=a.getTile(m[Qe]);if(!rt||!rt.hasData()||pe(Se,rt.tileID))continue;const nt=this._createProxiedId(Se,rt,b[Se.key]&&b[Se.key][a.id]),lt=this.proxyToSource[Se.key][a.id];lt?lt.push(nt):this.proxyToSource[Se.key][a.id]=[nt],S.push(nt)}}}_createProxiedId(a,m,b){let S=this.orthoMatrix;if(b){const P=b.find(H=>H.key===m.tileID.key);if(P)return P}if(m.tileID.key!==a.key){const P=a.canonical.z-m.tileID.canonical.z;let H,W,ee;S=i.create();const pe=m.tileID.wrap-a.wrap<<a.overscaledZ;P>0?(H=i.EXTENT>>P,W=H*((m.tileID.canonical.x<<P)-a.canonical.x+pe),ee=H*((m.tileID.canonical.y<<P)-a.canonical.y)):(H=i.EXTENT<<-P,W=i.EXTENT*(m.tileID.canonical.x-(a.canonical.x+pe<<-P)),ee=i.EXTENT*(m.tileID.canonical.y-(a.canonical.y<<-P))),i.ortho(S,0,H,0,H,0,1),i.translate(S,S,[W,ee,0])}return new iA(m.tileID,a.key,S)}_findTileCoveringTileID(a,m){let b=m.getTile(a);if(b&&b.hasData())return b;const S=this._findCoveringTileCache[m.id],P=S[a.key];if(b=P?m.getTileByID(P):null,b&&b.hasData()||P===null)return b;let H=b?b.tileID:a,W=H.overscaledZ;const ee=m.getSource().minzoom,pe=[];if(!P){const Se=m.getSource().maxzoom;if(a.canonical.z>=Se){const Qe=a.canonical.z-Se;m.getSource().reparseOverscaled?(W=Math.max(a.canonical.z+2,m.transform.tileZoom),H=new i.OverscaledTileID(W,a.wrap,Se,a.canonical.x>>Qe,a.canonical.y>>Qe)):Qe!==0&&(W=Se,H=new i.OverscaledTileID(W,a.wrap,Se,a.canonical.x>>Qe,a.canonical.y>>Qe))}H.key!==a.key&&(pe.push(H.key),b=m.getTile(H))}const fe=Se=>{pe.forEach(Qe=>{S[Qe]=Se}),pe.length=0};for(W-=1;W>=ee&&(!b||!b.hasData());W--){b&&fe(b.tileID.key);const Se=H.calculateScaledKey(W);if(b=m.getTileByID(Se),b&&b.hasData())break;const Qe=S[Se];if(Qe===null)break;Qe===void 0?pe.push(Se):b=m.getTileByID(Qe)}return fe(b?b.tileID.key:null),b&&b.hasData()?b:null}findDEMTileFor(a){return this.enabled?this._findTileCoveringTileID(a,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(a,m){let b=this._tilesDirty[a];b||(b=this._tilesDirty[a]={}),b[m.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const a=function(m){let b=0;const S=new i.StructArrayLayout2ui4,P=131;for(let H=1;H<129;H++){for(let W=1;W<129;W++)b=H*P+W,S.emplaceBack(b,b+1),S.emplaceBack(b,b+P),S.emplaceBack(b+1,b+P),H===128&&S.emplaceBack(b+P,b+P+1);S.emplaceBack(b+1,b+1+P)}return S}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(a),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,a.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class rA{static cacheKey(a,m,b,S){let P=`${m}${S?S.cacheKey:""}`;for(const H of b)a.usedDefines.includes(H)&&(P+=`/${H}`);return P}constructor(a,m,b,S,P,H){const W=a.gl;this.program=W.createProgram();const ee=function(Xe){const Ye=[];for(let At=0;At<Xe.length;At++){if(Xe[At]===null)continue;const ht=Xe[At].split(" ");Ye.push(ht.pop())}return Ye}(b.staticAttributes),pe=S?S.getBinderAttributes():[],fe=ee.concat(pe);let Se=S?S.defines():[];Se=Se.concat(H.map(Xe=>`#define ${Xe}`));const Qe=Se.concat(a.extStandardDerivatives?`#extension GL_OES_standard_derivatives : enable
- `.concat(hc):hc,hc,id,tA.fragmentSource,gu.fragmentSource,b.fragmentSource).join(`
- `),rt=Se.concat(`
- #ifdef GL_ES
- precision highp float;
- #else
- #if !defined(lowp)
- #define lowp
- #endif
- #if !defined(mediump)
- #define mediump
- #endif
- #if !defined(highp)
- #define highp
- #endif
- #endif`,id,tA.vertexSource,gu.vertexSource,td.vertexSource,b.vertexSource).join(`
- `),nt=W.createShader(W.FRAGMENT_SHADER);if(W.isContextLost())return void(this.failedToCreate=!0);W.shaderSource(nt,Qe),W.compileShader(nt),W.attachShader(this.program,nt);const lt=W.createShader(W.VERTEX_SHADER);if(W.isContextLost())this.failedToCreate=!0;else{W.shaderSource(lt,rt),W.compileShader(lt),W.attachShader(this.program,lt),this.attributes={},this.numAttributes=fe.length;for(let Xe=0;Xe<this.numAttributes;Xe++)fe[Xe]&&(W.bindAttribLocation(this.program,Xe,fe[Xe]),this.attributes[fe[Xe]]=Xe);W.linkProgram(this.program),W.deleteShader(lt),W.deleteShader(nt),this.fixedUniforms=P(a),this.binderUniforms=S?S.getUniforms(a):[],H.includes("TERRAIN")&&(this.terrainUniforms=(Xe=>({u_dem:new i.Uniform1i(Xe),u_dem_prev:new i.Uniform1i(Xe),u_dem_unpack:new i.Uniform4f(Xe),u_dem_tl:new i.Uniform2f(Xe),u_dem_scale:new i.Uniform1f(Xe),u_dem_tl_prev:new i.Uniform2f(Xe),u_dem_scale_prev:new i.Uniform1f(Xe),u_dem_size:new i.Uniform1f(Xe),u_dem_lerp:new i.Uniform1f(Xe),u_exaggeration:new i.Uniform1f(Xe),u_depth:new i.Uniform1i(Xe),u_depth_size_inv:new i.Uniform2f(Xe),u_meter_to_dem:new i.Uniform1f(Xe),u_label_plane_matrix_inv:new i.UniformMatrix4f(Xe)}))(a)),H.includes("GLOBE")&&(this.globeUniforms=(Xe=>({u_tile_tl_up:new i.Uniform3f(Xe),u_tile_tr_up:new i.Uniform3f(Xe),u_tile_br_up:new i.Uniform3f(Xe),u_tile_bl_up:new i.Uniform3f(Xe),u_tile_up_scale:new i.Uniform1f(Xe)}))(a)),H.includes("FOG")&&(this.fogUniforms=(Xe=>({u_fog_matrix:new i.UniformMatrix4f(Xe),u_fog_range:new i.Uniform2f(Xe),u_fog_color:new i.Uniform4f(Xe),u_fog_horizon_blend:new i.Uniform1f(Xe),u_fog_temporal_offset:new i.Uniform1f(Xe),u_frustum_tl:new i.Uniform3f(Xe),u_frustum_tr:new i.Uniform3f(Xe),u_frustum_br:new i.Uniform3f(Xe),u_frustum_bl:new i.Uniform3f(Xe),u_globe_pos:new i.Uniform3f(Xe),u_globe_radius:new i.Uniform1f(Xe),u_globe_transition:new i.Uniform1f(Xe),u_is_globe:new i.Uniform1i(Xe),u_viewport:new i.Uniform2f(Xe)}))(a))}}setTerrainUniformValues(a,m){if(!this.terrainUniforms)return;const b=this.terrainUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const S in m)b[S]&&b[S].set(this.program,S,m[S])}}setGlobeUniformValues(a,m){if(!this.globeUniforms)return;const b=this.globeUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const S in m)b[S]&&b[S].set(this.program,S,m[S])}}setFogUniformValues(a,m){if(!this.fogUniforms)return;const b=this.fogUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const S in m)b[S].set(this.program,S,m[S])}}draw(a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt){const Xe=a.gl;if(this.failedToCreate)return;a.program.set(this.program),a.setDepthMode(b),a.setStencilMode(S),a.setColorMode(P),a.setCullFace(H);for(const At of Object.keys(this.fixedUniforms))this.fixedUniforms[At].set(this.program,At,W[At]);nt&&nt.setUniforms(this.program,a,this.binderUniforms,Qe,{zoom:rt});const Ye={[Xe.LINES]:2,[Xe.TRIANGLES]:3,[Xe.LINE_STRIP]:1}[m];for(const At of Se.get()){const ht=At.vaos||(At.vaos={});(ht[ee]||(ht[ee]=new uc)).bind(a,this,pe,nt?nt.getPaintVertexBuffers():[],fe,At.vertexOffset,lt||[]),Xe.drawElements(m,At.primitiveLength*Ye,Xe.UNSIGNED_SHORT,At.primitiveOffset*Ye*2)}}}function Ac(x,a){const m=Math.pow(2,a.tileID.overscaledZ),b=a.tileSize*Math.pow(2,x.transform.tileZoom)/m,S=b*(a.tileID.canonical.x+a.tileID.wrap*m),P=b*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture.size,u_tile_units_to_pixels:1/et(a,1,x.transform.tileZoom),u_pixel_coord_upper:[S>>16,P>>16],u_pixel_coord_lower:[65535&S,65535&P]}}const Vc=i.create(),Hc=(x,a,m,b,S,P,H,W,ee,pe,fe)=>{const Se=a.style.light,Qe=Se.properties.get("position"),rt=[Qe.x,Qe.y,Qe.z],nt=i.create$1();Se.properties.get("anchor")==="viewport"&&(i.fromRotation(nt,-a.transform.angle),i.transformMat3(rt,rt,nt));const lt=Se.properties.get("color"),Xe=a.transform,Ye={u_matrix:x,u_lightpos:rt,u_lightintensity:Se.properties.get("intensity"),u_lightcolor:[lt.r,lt.g,lt.b],u_vertical_gradient:+m,u_opacity:b,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Vc,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:S,u_edge_radius:P};return Xe.projection.name==="globe"&&(Ye.u_tile_id=[H.canonical.x,H.canonical.y,1<<H.canonical.z],Ye.u_zoom_transition=ee,Ye.u_inv_rot_matrix=fe,Ye.u_merc_center=pe,Ye.u_up_dir=Xe.projection.upVector(new i.CanonicalTileID(0,0,0),pe[0]*i.EXTENT,pe[1]*i.EXTENT),Ye.u_height_lift=W),Ye},Lh=(x,a,m,b,S,P,H,W,ee,pe,fe,Se)=>{const Qe=Hc(x,a,m,b,S,P,H,ee,pe,fe,Se),rt={u_height_factor:-Math.pow(2,H.overscaledZ)/W.tileSize/8};return i.extend(Qe,Ac(a,W),rt)},Gc=x=>({u_matrix:x}),Dh=(x,a,m)=>i.extend(Gc(x),Ac(a,m)),Wc=(x,a)=>({u_matrix:x,u_world:a}),jc=(x,a,m,b)=>i.extend(Dh(x,a,m),{u_world:b}),ca=i.create(),sA=(x,a,m,b,S,P)=>{const H=x.transform,W=H.projection.name==="globe";let ee;if(P.paint.get("circle-pitch-alignment")==="map")if(W){const fe=i.globePixelsToTileUnits(H.zoom,a.canonical)*H._pixelsPerMercatorPixel;ee=Float32Array.from([fe,0,0,fe])}else ee=H.calculatePixelsToTileUnitsMatrix(m);else ee=new Float32Array([H.pixelsToGLUnits[0],0,0,H.pixelsToGLUnits[1]]);const pe={u_camera_to_center_distance:H.cameraToCenterDistance,u_matrix:x.translatePosMatrix(a.projMatrix,m,P.paint.get("circle-translate"),P.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:ee,u_inv_rot_matrix:ca,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(W){pe.u_inv_rot_matrix=b,pe.u_merc_center=S,pe.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],pe.u_zoom_transition=i.globeToMercatorTransition(H.zoom);const fe=S[0]*i.EXTENT,Se=S[1]*i.EXTENT;pe.u_up_dir=H.projection.upVector(new i.CanonicalTileID(0,0,0),fe,Se)}return pe},oA=x=>{const a=[];return x.paint.get("circle-pitch-alignment")==="map"&&a.push("PITCH_WITH_MAP"),x.paint.get("circle-pitch-scale")==="map"&&a.push("SCALE_WITH_MAP"),a},Kc=(x,a,m,b)=>{const S=i.EXTENT/m.tileSize;return{u_matrix:x,u_camera_to_center_distance:a.getCameraToCenterDistance(b),u_extrude_scale:[a.pixelsToGLUnits[0]/S,a.pixelsToGLUnits[1]/S]}},ha=(x,a,m=1)=>({u_matrix:x,u_color:a,u_overlay:0,u_overlay_scale:m}),$c=i.create(),pl=(x,a,m,b,S,P,H)=>{const W=x.transform,ee=W.projection.name==="globe",pe=ee?i.globePixelsToTileUnits(W.zoom,a.canonical)*W._pixelsPerMercatorPixel:et(m,1,P),fe={u_matrix:a.projMatrix,u_extrude_scale:pe,u_intensity:H,u_inv_rot_matrix:$c,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(ee){fe.u_inv_rot_matrix=b,fe.u_merc_center=S,fe.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],fe.u_zoom_transition=i.globeToMercatorTransition(W.zoom);const Se=S[0]*i.EXTENT,Qe=S[1]*i.EXTENT;fe.u_up_dir=W.projection.upVector(new i.CanonicalTileID(0,0,0),Se,Qe)}return fe},aA=(x,a,m,b,S,P,H)=>{const W=x.transform,ee=W.calculatePixelsToTileUnitsMatrix(a);return{u_matrix:xu(x,a,m,b),u_pixels_to_tile_units:ee,u_device_pixel_ratio:P,u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:S,u_texsize:Gl(m)?a.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Ph(a,x.transform),u_alpha_discard_threshold:0,u_trim_offset:H}},Ho=(x,a,m,b,S)=>{const P=x.transform;return{u_matrix:xu(x,a,m,b),u_texsize:a.imageAtlasTexture.size,u_pixels_to_tile_units:P.calculatePixelsToTileUnitsMatrix(a),u_device_pixel_ratio:S,u_image:0,u_tile_units_to_pixels:Ph(a,P),u_units_to_pixels:[1/P.pixelsToGLUnits[0],1/P.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function Ph(x,a){return 1/et(x,1,a.tileZoom)}function xu(x,a,m,b){return x.translatePosMatrix(b||a.tileID.projMatrix,a,m.paint.get("line-translate"),m.paint.get("line-translate-anchor"))}function Gl(x){const a=x.paint.get("line-dasharray").value;return a.value||a.kind!=="constant"}const vu=(x,a,m,b,S,P)=>{return{u_matrix:x,u_tl_parent:a,u_scale_parent:m,u_fade_t:b.mix,u_opacity:b.opacity*S.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:S.paint.get("raster-brightness-min"),u_brightness_high:S.paint.get("raster-brightness-max"),u_saturation_factor:(W=S.paint.get("raster-saturation"),W>0?1-1/(1.001-W):-W),u_contrast_factor:(H=S.paint.get("raster-contrast"),H>0?1/(1-H):1+H),u_spin_weights:Zc(S.paint.get("raster-hue-rotate")),u_perspective_transform:P};var H,W};function Zc(x){x*=Math.PI/180;const a=Math.sin(x),m=Math.cos(x);return[(2*m+1)/3,(-Math.sqrt(3)*a-m+1)/3,(Math.sqrt(3)*a-m+1)/3]}const Xc=i.create(),fl=(x,a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt)=>{const Xe=S.transform,Ye={u_is_size_zoom_constant:+(x==="constant"||x==="source"),u_is_size_feature_constant:+(x==="constant"||x==="camera"),u_size_t:a?a.uSizeT:0,u_size:a?a.uSize:0,u_camera_to_center_distance:Xe.cameraToCenterDistance,u_rotate_symbol:+m,u_aspect_ratio:Xe.width/Xe.height,u_fade_change:S.options.fadeDuration?S.symbolFadeChange:1,u_matrix:P,u_label_plane_matrix:H,u_coord_matrix:W,u_is_text:+ee,u_pitch_with_map:+b,u_texsize:pe,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Xc,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Xc,u_up_vector:[0,-1,0]};return lt.name==="globe"&&(Ye.u_tile_id=[fe.canonical.x,fe.canonical.y,1<<fe.canonical.z],Ye.u_zoom_transition=Se,Ye.u_inv_rot_matrix=rt,Ye.u_merc_center=Qe,Ye.u_camera_forward=Xe._camera.forward(),Ye.u_ecef_origin=i.globeECEFOrigin(Xe.globeMatrix,fe.toUnwrapped()),Ye.u_tile_matrix=Float32Array.from(Xe.globeMatrix),Ye.u_up_vector=nt),Ye},qc=(x,a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt,Xe)=>i.extend(fl(x,a,m,b,S,P,H,W,ee,pe,Se,Qe,rt,nt,lt,Xe),{u_gamma_scale:b?S.transform.cameraToCenterDistance*Math.cos(S.terrain?0:S.transform._pitch):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+fe}),Uh=(x,a,m,b,S,P,H,W,ee,pe,fe,Se,Qe,rt,nt,lt)=>i.extend(qc(x,a,m,b,S,P,H,W,!0,ee,!0,fe,Se,Qe,rt,nt,lt),{u_texsize_icon:pe,u_texture_icon:1}),Rh=(x,a,m)=>({u_matrix:x,u_opacity:a,u_color:m}),wu=(x,a,m,b,S)=>i.extend(function(P,H,W){const ee=H.imageManager.getPattern(P.toString()),{width:pe,height:fe}=H.imageManager.getPixelSize(),Se=Math.pow(2,W.tileID.overscaledZ),Qe=W.tileSize*Math.pow(2,H.transform.tileZoom)/Se,rt=Qe*(W.tileID.canonical.x+W.tileID.wrap*Se),nt=Qe*W.tileID.canonical.y;return{u_image:0,u_pattern_tl:ee.tl,u_pattern_br:ee.br,u_texsize:[pe,fe],u_pattern_size:ee.displaySize,u_tile_units_to_pixels:1/et(W,1,H.transform.tileZoom),u_pixel_coord_upper:[rt>>16,nt>>16],u_pixel_coord_lower:[65535&rt,65535&nt]}}(b,m,S),{u_matrix:x,u_opacity:a}),nd={fillExtrusion:x=>({u_matrix:new i.UniformMatrix4f(x),u_lightpos:new i.Uniform3f(x),u_lightintensity:new i.Uniform1f(x),u_lightcolor:new i.Uniform3f(x),u_vertical_gradient:new i.Uniform1f(x),u_opacity:new i.Uniform1f(x),u_edge_radius:new i.Uniform1f(x),u_ao:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_up_dir:new i.Uniform3f(x),u_height_lift:new i.Uniform1f(x)}),fillExtrusionPattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_lightpos:new i.Uniform3f(x),u_lightintensity:new i.Uniform1f(x),u_lightcolor:new i.Uniform3f(x),u_vertical_gradient:new i.Uniform1f(x),u_height_factor:new i.Uniform1f(x),u_edge_radius:new i.Uniform1f(x),u_ao:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_up_dir:new i.Uniform3f(x),u_height_lift:new i.Uniform1f(x),u_image:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_pixel_coord_upper:new i.Uniform2f(x),u_pixel_coord_lower:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x),u_opacity:new i.Uniform1f(x)}),fill:x=>({u_matrix:new i.UniformMatrix4f(x)}),fillPattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_image:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_pixel_coord_upper:new i.Uniform2f(x),u_pixel_coord_lower:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x)}),fillOutline:x=>({u_matrix:new i.UniformMatrix4f(x),u_world:new i.Uniform2f(x)}),fillOutlinePattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_world:new i.Uniform2f(x),u_image:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_pixel_coord_upper:new i.Uniform2f(x),u_pixel_coord_lower:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x)}),circle:x=>({u_camera_to_center_distance:new i.Uniform1f(x),u_extrude_scale:new i.UniformMatrix2f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_up_dir:new i.Uniform3f(x)}),collisionBox:x=>({u_matrix:new i.UniformMatrix4f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_extrude_scale:new i.Uniform2f(x)}),collisionCircle:x=>({u_matrix:new i.UniformMatrix4f(x),u_inv_matrix:new i.UniformMatrix4f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_viewport_size:new i.Uniform2f(x)}),debug:x=>({u_color:new i.UniformColor(x),u_matrix:new i.UniformMatrix4f(x),u_overlay:new i.Uniform1i(x),u_overlay_scale:new i.Uniform1f(x)}),clippingMask:x=>({u_matrix:new i.UniformMatrix4f(x)}),heatmap:x=>({u_extrude_scale:new i.Uniform1f(x),u_intensity:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_up_dir:new i.Uniform3f(x)}),heatmapTexture:x=>({u_image:new i.Uniform1i(x),u_color_ramp:new i.Uniform1i(x),u_opacity:new i.Uniform1f(x)}),hillshade:x=>({u_matrix:new i.UniformMatrix4f(x),u_image:new i.Uniform1i(x),u_latrange:new i.Uniform2f(x),u_light:new i.Uniform2f(x),u_shadow:new i.UniformColor(x),u_highlight:new i.UniformColor(x),u_accent:new i.UniformColor(x)}),hillshadePrepare:x=>({u_matrix:new i.UniformMatrix4f(x),u_image:new i.Uniform1i(x),u_dimension:new i.Uniform2f(x),u_zoom:new i.Uniform1f(x),u_unpack:new i.Uniform4f(x)}),line:x=>({u_matrix:new i.UniformMatrix4f(x),u_pixels_to_tile_units:new i.UniformMatrix2f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_units_to_pixels:new i.Uniform2f(x),u_dash_image:new i.Uniform1i(x),u_gradient_image:new i.Uniform1i(x),u_image_height:new i.Uniform1f(x),u_texsize:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x),u_alpha_discard_threshold:new i.Uniform1f(x),u_trim_offset:new i.Uniform2f(x)}),linePattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_texsize:new i.Uniform2f(x),u_pixels_to_tile_units:new i.UniformMatrix2f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_image:new i.Uniform1i(x),u_units_to_pixels:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x),u_alpha_discard_threshold:new i.Uniform1f(x)}),raster:x=>({u_matrix:new i.UniformMatrix4f(x),u_tl_parent:new i.Uniform2f(x),u_scale_parent:new i.Uniform1f(x),u_fade_t:new i.Uniform1f(x),u_opacity:new i.Uniform1f(x),u_image0:new i.Uniform1i(x),u_image1:new i.Uniform1i(x),u_brightness_low:new i.Uniform1f(x),u_brightness_high:new i.Uniform1f(x),u_saturation_factor:new i.Uniform1f(x),u_contrast_factor:new i.Uniform1f(x),u_spin_weights:new i.Uniform3f(x),u_perspective_transform:new i.Uniform2f(x)}),symbolIcon:x=>({u_is_size_zoom_constant:new i.Uniform1i(x),u_is_size_feature_constant:new i.Uniform1i(x),u_size_t:new i.Uniform1f(x),u_size:new i.Uniform1f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_rotate_symbol:new i.Uniform1i(x),u_aspect_ratio:new i.Uniform1f(x),u_fade_change:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_label_plane_matrix:new i.UniformMatrix4f(x),u_coord_matrix:new i.UniformMatrix4f(x),u_is_text:new i.Uniform1i(x),u_pitch_with_map:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_camera_forward:new i.Uniform3f(x),u_tile_matrix:new i.UniformMatrix4f(x),u_up_vector:new i.Uniform3f(x),u_ecef_origin:new i.Uniform3f(x),u_texture:new i.Uniform1i(x)}),symbolSDF:x=>({u_is_size_zoom_constant:new i.Uniform1i(x),u_is_size_feature_constant:new i.Uniform1i(x),u_size_t:new i.Uniform1f(x),u_size:new i.Uniform1f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_rotate_symbol:new i.Uniform1i(x),u_aspect_ratio:new i.Uniform1f(x),u_fade_change:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_label_plane_matrix:new i.UniformMatrix4f(x),u_coord_matrix:new i.UniformMatrix4f(x),u_is_text:new i.Uniform1i(x),u_pitch_with_map:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_texture:new i.Uniform1i(x),u_gamma_scale:new i.Uniform1f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_camera_forward:new i.Uniform3f(x),u_tile_matrix:new i.UniformMatrix4f(x),u_up_vector:new i.Uniform3f(x),u_ecef_origin:new i.Uniform3f(x),u_is_halo:new i.Uniform1i(x)}),symbolTextAndIcon:x=>({u_is_size_zoom_constant:new i.Uniform1i(x),u_is_size_feature_constant:new i.Uniform1i(x),u_size_t:new i.Uniform1f(x),u_size:new i.Uniform1f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_rotate_symbol:new i.Uniform1i(x),u_aspect_ratio:new i.Uniform1f(x),u_fade_change:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_label_plane_matrix:new i.UniformMatrix4f(x),u_coord_matrix:new i.UniformMatrix4f(x),u_is_text:new i.Uniform1i(x),u_pitch_with_map:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_texsize_icon:new i.Uniform2f(x),u_texture:new i.Uniform1i(x),u_texture_icon:new i.Uniform1i(x),u_gamma_scale:new i.Uniform1f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_is_halo:new i.Uniform1i(x)}),background:x=>({u_matrix:new i.UniformMatrix4f(x),u_opacity:new i.Uniform1f(x),u_color:new i.UniformColor(x)}),backgroundPattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_opacity:new i.Uniform1f(x),u_image:new i.Uniform1i(x),u_pattern_tl:new i.Uniform2f(x),u_pattern_br:new i.Uniform2f(x),u_texsize:new i.Uniform2f(x),u_pattern_size:new i.Uniform2f(x),u_pixel_coord_upper:new i.Uniform2f(x),u_pixel_coord_lower:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x)}),terrainRaster:Qc,terrainDepth:Qc,skybox:x=>({u_matrix:new i.UniformMatrix4f(x),u_sun_direction:new i.Uniform3f(x),u_cubemap:new i.Uniform1i(x),u_opacity:new i.Uniform1f(x),u_temporal_offset:new i.Uniform1f(x)}),skyboxGradient:x=>({u_matrix:new i.UniformMatrix4f(x),u_color_ramp:new i.Uniform1i(x),u_center_direction:new i.Uniform3f(x),u_radius:new i.Uniform1f(x),u_opacity:new i.Uniform1f(x),u_temporal_offset:new i.Uniform1f(x)}),skyboxCapture:x=>({u_matrix_3f:new i.UniformMatrix3f(x),u_sun_direction:new i.Uniform3f(x),u_sun_intensity:new i.Uniform1f(x),u_color_tint_r:new i.Uniform4f(x),u_color_tint_m:new i.Uniform4f(x),u_luminance:new i.Uniform1f(x)}),globeRaster:x=>({u_proj_matrix:new i.UniformMatrix4f(x),u_globe_matrix:new i.UniformMatrix4f(x),u_normalize_matrix:new i.UniformMatrix4f(x),u_merc_matrix:new i.UniformMatrix4f(x),u_zoom_transition:new i.Uniform1f(x),u_merc_center:new i.Uniform2f(x),u_image0:new i.Uniform1i(x),u_grid_matrix:new i.UniformMatrix3f(x),u_frustum_tl:new i.Uniform3f(x),u_frustum_tr:new i.Uniform3f(x),u_frustum_br:new i.Uniform3f(x),u_frustum_bl:new i.Uniform3f(x),u_globe_pos:new i.Uniform3f(x),u_globe_radius:new i.Uniform1f(x),u_viewport:new i.Uniform2f(x)}),globeAtmosphere:x=>({u_frustum_tl:new i.Uniform3f(x),u_frustum_tr:new i.Uniform3f(x),u_frustum_br:new i.Uniform3f(x),u_frustum_bl:new i.Uniform3f(x),u_horizon:new i.Uniform1f(x),u_transition:new i.Uniform1f(x),u_fadeout_range:new i.Uniform1f(x),u_color:new i.Uniform4f(x),u_high_color:new i.Uniform4f(x),u_space_color:new i.Uniform4f(x),u_star_intensity:new i.Uniform1f(x),u_star_density:new i.Uniform1f(x),u_star_size:new i.Uniform1f(x),u_temporal_offset:new i.Uniform1f(x),u_horizon_angle:new i.Uniform1f(x),u_rotation_matrix:new i.UniformMatrix4f(x)})};let dc;function pc(x,a,m,b,S,P,H){const W=x.context,ee=W.gl,pe=x.transform,fe=x.useProgram("collisionBox"),Se=[];let Qe=0,rt=0;for(let Bt=0;Bt<b.length;Bt++){const Pt=b[Bt],It=a.getTile(Pt),Ht=It.getBucket(m);if(!Ht)continue;const hi=zl(Pt,Ht,pe);let si=hi;S[0]===0&&S[1]===0||(si=x.translatePosMatrix(hi,It,S,P));const qt=H?Ht.textCollisionBox:Ht.iconCollisionBox,ji=Ht.collisionCircleArray;if(ji.length>0){const Kt=i.create(),Bi=si;i.mul(Kt,Ht.placementInvProjMatrix,pe.glCoordMatrix),i.mul(Kt,Kt,Ht.placementViewportMatrix),Se.push({circleArray:ji,circleOffset:rt,transform:Bi,invTransform:Kt,projection:Ht.getProjection()}),Qe+=ji.length/4,rt=Qe}qt&&(x.terrain&&x.terrain.setupElevationDraw(It,fe),fe.draw(W,ee.LINES,i.DepthMode.disabled,i.StencilMode.disabled,x.colorModeForRenderPass(),i.CullFaceMode.disabled,Kc(si,pe,It,Ht.getProjection()),m.id,qt.layoutVertexBuffer,qt.indexBuffer,qt.segments,null,pe.zoom,null,[qt.collisionVertexBuffer,qt.collisionVertexBufferExt]))}if(!H||!Se.length)return;const nt=x.useProgram("collisionCircle"),lt=new i.StructArrayLayout2f1f2i16;lt.resize(4*Qe),lt._trim();let Xe=0;for(const Bt of Se)for(let Pt=0;Pt<Bt.circleArray.length/4;Pt++){const It=4*Pt,Ht=Bt.circleArray[It+0],hi=Bt.circleArray[It+1],si=Bt.circleArray[It+2],qt=Bt.circleArray[It+3];lt.emplace(Xe++,Ht,hi,si,qt,0),lt.emplace(Xe++,Ht,hi,si,qt,1),lt.emplace(Xe++,Ht,hi,si,qt,2),lt.emplace(Xe++,Ht,hi,si,qt,3)}(!dc||dc.length<2*Qe)&&(dc=function(Bt){const Pt=2*Bt,It=new i.StructArrayLayout3ui6;It.resize(Pt),It._trim();for(let Ht=0;Ht<Pt;Ht++){const hi=6*Ht;It.uint16[hi+0]=4*Ht+0,It.uint16[hi+1]=4*Ht+1,It.uint16[hi+2]=4*Ht+2,It.uint16[hi+3]=4*Ht+2,It.uint16[hi+4]=4*Ht+3,It.uint16[hi+5]=4*Ht+0}return It}(Qe));const Ye=W.createIndexBuffer(dc,!0),At=W.createVertexBuffer(lt,i.collisionCircleLayout.members,!0);for(const Bt of Se){const Pt={u_matrix:Bt.transform,u_inv_matrix:Bt.invTransform,u_camera_to_center_distance:(ht=pe).getCameraToCenterDistance(Bt.projection),u_viewport_size:[ht.width,ht.height]};nt.draw(W,ee.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,x.colorModeForRenderPass(),i.CullFaceMode.disabled,Pt,m.id,At,Ye,i.SegmentVector.simpleSegment(0,2*Bt.circleOffset,Bt.circleArray.length,Bt.circleArray.length/2),null,pe.zoom)}var ht;At.destroy(),Ye.destroy()}const Yc=i.create();function zh({width:x,height:a,anchor:m,textOffset:b,textScale:S},P){const{horizontalAlign:H,verticalAlign:W}=i.getAnchorAlignment(m),ee=-(H-.5)*x,pe=-(W-.5)*a,fe=i.evaluateVariableOffset(m,b);return new i.pointGeometry((ee/S+fe[0])*P,(pe/S+fe[1])*P)}function Jc(x,a,m,b,S,P,H,W,ee,pe,fe){const Se=x.text.placedSymbolArray,Qe=x.text.dynamicLayoutVertexArray,rt=x.icon.dynamicLayoutVertexArray,nt={},lt=x.getProjection(),Xe=kl(W,lt,P),Ye=P.elevation,At=lt.upVectorScale(W.canonical,P.center.lat,P.worldSize).metersToTile;Qe.clear();for(let ht=0;ht<Se.length;ht++){const Bt=Se.get(ht),{tileAnchorX:Pt,tileAnchorY:It,numGlyphs:Ht}=Bt,hi=x.allowVerticalPlacement&&!Bt.placedOrientation,si=Bt.hidden||!Bt.crossTileID||hi?null:b[Bt.crossTileID];if(si){let qt=0,ji=0,Kt=0;if(Ye){const In=Ye?Ye.getAtTileOffset(W,Pt,It):0,[Hn,Mn,$n]=lt.upVector(W.canonical,Pt,It);qt=In*Hn*At,ji=In*Mn*At,Kt=In*$n*At}let[Bi,di,Ri,Ai]=or(Bt.projectedAnchorX+qt,Bt.projectedAnchorY+ji,Bt.projectedAnchorZ+Kt,m?Xe:H);const Mi=rn(P.getCameraToCenterDistance(lt),Ai);let $i=S.evaluateSizeForFeature(x.textSizeData,pe,Bt)*Mi/i.ONE_EM;m&&($i*=x.tilePixelRatio/ee);const Jt=zh(si,$i);m?({x:Bi,y:di,z:Ri}=lt.projectTilePoint(Pt+Jt.x,It+Jt.y,W.canonical),[Bi,di,Ri]=or(Bi+qt,di+ji,Ri+Kt,H)):(a&&Jt._rotate(-P.angle),Bi+=Jt.x,di+=Jt.y,Ri=0);const pi=x.allowVerticalPlacement&&Bt.placedOrientation===i.WritingMode.vertical?Math.PI/2:0;for(let In=0;In<Ht;In++)i.addDynamicAttributes(Qe,Bi,di,Ri,pi);fe&&Bt.associatedIconIndex>=0&&(nt[Bt.associatedIconIndex]={x:Bi,y:di,z:Ri,angle:pi})}else qs(Ht,Qe)}if(fe){rt.clear();const ht=x.icon.placedSymbolArray;for(let Bt=0;Bt<ht.length;Bt++){const Pt=ht.get(Bt),{numGlyphs:It}=Pt,Ht=nt[Bt];if(Pt.hidden||!Ht)qs(It,rt);else{const{x:hi,y:si,z:qt,angle:ji}=Ht;for(let Kt=0;Kt<It;Kt++)i.addDynamicAttributes(rt,hi,si,qt,ji)}}x.icon.dynamicLayoutVertexBuffer.updateData(rt)}x.text.dynamicLayoutVertexBuffer.updateData(Qe)}function So(x,a,m){return m.iconsInText&&a?"symbolTextAndIcon":x?"symbolSDF":"symbolIcon"}function xa(x,a,m,b,S,P,H,W,ee,pe,fe,Se){const Qe=x.context,rt=Qe.gl,nt=x.transform,lt=W==="map",Xe=ee==="map",Ye=lt&&m.layout.get("symbol-placement")!=="point",At=lt&&!Xe&&!Ye,ht=m.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Bt=!1;const Pt=x.depthModeForSublayer(0,i.DepthMode.ReadOnly),It=[i.mercatorXfromLng(nt.center.lng),i.mercatorYfromLat(nt.center.lat)],Ht=m.layout.get("text-variable-anchor"),hi=nt.projection.name==="globe",si=[],qt=[0,-1,0];let ji=qt;!hi&&!nt.mercatorFromTransition||lt||(ji=function(Kt){const Bi=Kt._camera.getWorldToCamera(Kt.worldSize,1),di=i.multiply([],Bi,Kt.globeMatrix);i.invert(di,di);const Ri=[0,0,0],Ai=[0,1,0,0];return i.transformMat4$1(Ai,Ai,di),Ri[0]=Ai[0],Ri[1]=Ai[1],Ri[2]=Ai[2],i.normalize(Ri,Ri),Ri}(nt));for(const Kt of b){const Bi=a.getTile(Kt),di=Bi.getBucket(m);if(!di||di.projection.name==="mercator"&&hi)continue;const Ri=S?di.text:di.icon;if(!Ri||di.fullyClipped||!Ri.segments.get().length)continue;const Ai=Ri.programConfigurations.get(m.id),Mi=S||di.sdfIcons,$i=S?di.textSizeData:di.iconSizeData,Jt=Xe||nt.pitch!==0,pi=i.evaluateSizeForZoom($i,nt.zoom);let In,Hn,Mn,$n,ar=[0,0],On=null;if(S){if(Hn=Bi.glyphAtlasTexture,Mn=rt.LINEAR,In=Bi.glyphAtlasTexture.size,di.iconsInText){ar=Bi.imageAtlasTexture.size,On=Bi.imageAtlasTexture;const Ea=$i.kind==="composite"||$i.kind==="camera";$n=Jt||x.options.rotating||x.options.zooming||Ea?rt.LINEAR:rt.NEAREST}}else{const Ea=m.layout.get("icon-size").constantOr(0)!==1||di.iconsNeedLinear;Hn=Bi.imageAtlasTexture,Mn=Mi||x.options.rotating||x.options.zooming||Ea||Jt?rt.LINEAR:rt.NEAREST,In=Bi.imageAtlasTexture.size}const _n=di.projection.name==="globe",Dr=_n?ji:qt,Or=_n?i.globeToMercatorTransition(nt.zoom):0,Nr=kl(Kt,di.getProjection(),nt),Qr=nt.calculatePixelsToTileUnitsMatrix(Bi),go=Mr(Nr,Bi.tileID.canonical,Xe,lt,nt,di.getProjection(),Qr),Ca=x.terrain&&Xe&&Ye?i.invert(i.create(),go):Yc,jo=ks(Nr,Bi.tileID.canonical,Xe,lt,nt,di.getProjection(),Qr),ws=Ht&&di.hasTextData(),_r=m.layout.get("icon-text-fit")!=="none"&&ws&&di.hasIconData();if(Ye){const Ea=nt.elevation,vl=Ea?Ea.getAtTileOffsetFunc(Kt,nt.center.lat,nt.worldSize,di.getProjection()):null,Zl=Oo(Nr,Bi.tileID.canonical,Xe,lt,nt,di.getProjection(),Qr);Ar(di,Nr,x,S,Zl,jo,Xe,pe,vl,Kt)}const Xr=Ye||S&&Ht||_r,Fr=x.translatePosMatrix(Nr,Bi,P,H),Ls=Xr?Yc:go,eo=x.translatePosMatrix(jo,Bi,P,H,!0),rs=di.getProjection().createInversionMatrix(nt,Kt.canonical),Io=[];x.terrainRenderModeElevated()&&Xe&&Io.push("PITCH_WITH_MAP_TERRAIN"),_n&&Io.push("PROJECTION_GLOBE_VIEW"),Xr&&Io.push("PROJECTED_POS_ON_VIEWPORT");const bu=Mi&&m.paint.get(S?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ka;Ka=Mi?di.iconsInText?Uh($i.kind,pi,At,Xe,x,Fr,Ls,eo,In,ar,Kt,Or,It,rs,Dr,di.getProjection()):qc($i.kind,pi,At,Xe,x,Fr,Ls,eo,S,In,!0,Kt,Or,It,rs,Dr,di.getProjection()):fl($i.kind,pi,At,Xe,x,Fr,Ls,eo,S,In,Kt,Or,It,rs,Dr,di.getProjection());const _o={program:x.useProgram(So(Mi,S,di),Ai,Io),buffers:Ri,uniformValues:Ka,atlasTexture:Hn,atlasTextureIcon:On,atlasInterpolation:Mn,atlasInterpolationIcon:$n,isSDF:Mi,hasHalo:bu,tile:Bi,labelPlaneMatrixInv:Ca};if(ht&&di.canOverlap){Bt=!0;const Ea=Ri.segments.get();for(const vl of Ea)si.push({segments:new i.SegmentVector([vl]),sortKey:vl.sortKey,state:_o})}else si.push({segments:Ri.segments,sortKey:0,state:_o})}Bt&&si.sort((Kt,Bi)=>Kt.sortKey-Bi.sortKey);for(const Kt of si){const Bi=Kt.state;if(x.terrain&&x.terrain.setupElevationDraw(Bi.tile,Bi.program,{useDepthForOcclusion:!hi,labelPlaneMatrixInv:Bi.labelPlaneMatrixInv}),Qe.activeTexture.set(rt.TEXTURE0),Bi.atlasTexture.bind(Bi.atlasInterpolation,rt.CLAMP_TO_EDGE),Bi.atlasTextureIcon&&(Qe.activeTexture.set(rt.TEXTURE1),Bi.atlasTextureIcon&&Bi.atlasTextureIcon.bind(Bi.atlasInterpolationIcon,rt.CLAMP_TO_EDGE)),Bi.isSDF){const di=Bi.uniformValues;Bi.hasHalo&&(di.u_is_halo=1,Mo(Bi.buffers,Kt.segments,m,x,Bi.program,Pt,fe,Se,di)),di.u_is_halo=0}Mo(Bi.buffers,Kt.segments,m,x,Bi.program,Pt,fe,Se,Bi.uniformValues)}}function Mo(x,a,m,b,S,P,H,W,ee){const pe=b.context,fe=[x.dynamicLayoutVertexBuffer,x.opacityVertexBuffer,x.globeExtVertexBuffer];S.draw(pe,pe.gl.TRIANGLES,P,H,W,i.CullFaceMode.disabled,ee,m.id,x.layoutVertexBuffer,x.indexBuffer,a,m.paint,b.transform.zoom,x.programConfigurations.get(m.id),fe)}function rd(x,a,m,b,S,P,H){const W=x.context.gl,ee=m.paint.get("fill-pattern"),pe=ee&&ee.constantOr(1);let fe,Se,Qe,rt,nt;H?(Se=pe&&!m.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",fe=W.LINES):(Se=pe?"fillPattern":"fill",fe=W.TRIANGLES);for(const lt of b){const Xe=a.getTile(lt);if(pe&&!Xe.patternsLoaded())continue;const Ye=Xe.getBucket(m);if(!Ye)continue;x.prepareDrawTile();const At=Ye.programConfigurations.get(m.id),ht=x.useProgram(Se,At);pe&&(x.context.activeTexture.set(W.TEXTURE0),Xe.imageAtlasTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE),At.updatePaintBuffers());const Bt=ee.constantOr(null);if(Bt&&Xe.imageAtlas){const It=Xe.imageAtlas.patternPositions[Bt.toString()];It&&At.setConstantPatternPositions(It)}const Pt=x.translatePosMatrix(lt.projMatrix,Xe,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));if(H){rt=Ye.indexBuffer2,nt=Ye.segments2;const It=x.terrain&&x.terrain.renderingToTexture?x.terrain.drapeBufferSize:[W.drawingBufferWidth,W.drawingBufferHeight];Qe=Se==="fillOutlinePattern"&&pe?jc(Pt,x,Xe,It):Wc(Pt,It)}else rt=Ye.indexBuffer,nt=Ye.segments,Qe=pe?Dh(Pt,x,Xe):Gc(Pt);x.prepareDrawProgram(x.context,ht,lt.toUnwrapped()),ht.draw(x.context,fe,S,x.stencilModeForClipping(lt),P,i.CullFaceMode.disabled,Qe,m.id,Ye.layoutVertexBuffer,rt,nt,m.paint,x.transform.zoom,At)}}function Ga(x,a,m,b,S,P,H){const W=x.context,ee=W.gl,pe=x.transform,fe=m.paint.get("fill-extrusion-pattern"),Se=fe.constantOr(1),Qe=m.paint.get("fill-extrusion-opacity"),rt=[m.paint.get("fill-extrusion-ambient-occlusion-intensity"),m.paint.get("fill-extrusion-ambient-occlusion-radius")],nt=m.layout.get("fill-extrusion-edge-radius"),lt=pe.projection.name==="globe"?i.fillExtrusionHeightLift():0,Xe=pe.projection.name==="globe",Ye=Xe?i.globeToMercatorTransition(pe.zoom):0,At=[i.mercatorXfromLng(pe.center.lng),i.mercatorYfromLat(pe.center.lat)],ht=[];Xe&&(ht.push("PROJECTION_GLOBE_VIEW"),x.style.terrainSetForDrapingOnly()&&ht.push("TERRAIN")),rt[0]>0&&ht.push("FAUX_AO");for(const Bt of b){const Pt=a.getTile(Bt),It=Pt.getBucket(m);if(!It||It.projection.name!==pe.projection.name)continue;const Ht=It.programConfigurations.get(m.id),hi=x.useProgram(Se?"fillExtrusionPattern":"fillExtrusion",Ht,ht);if(x.terrain){const Ri=x.terrain;if(x.style.terrainSetForDrapingOnly())Ri.setupElevationDraw(Pt,hi,{useMeterToDem:!0});else{if(!It.enableTerrain)continue;if(Ri.setupElevationDraw(Pt,hi,{useMeterToDem:!0}),sd(W,a,Bt,It,m,Ri),!It.centroidVertexBuffer){const Ai=hi.attributes.a_centroid_pos;Ai!==void 0&&ee.vertexAttrib2f(Ai,0,0)}}}Se&&(x.context.activeTexture.set(ee.TEXTURE0),Pt.imageAtlasTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),Ht.updatePaintBuffers());const si=fe.constantOr(null);if(si&&Pt.imageAtlas){const Ri=Pt.imageAtlas.patternPositions[si.toString()];Ri&&Ht.setConstantPatternPositions(Ri)}const qt=x.translatePosMatrix(Bt.projMatrix,Pt,m.paint.get("fill-extrusion-translate"),m.paint.get("fill-extrusion-translate-anchor")),ji=pe.projection.createInversionMatrix(pe,Bt.canonical),Kt=m.paint.get("fill-extrusion-vertical-gradient"),Bi=Se?Lh(qt,x,Kt,Qe,rt,nt,Bt,Pt,lt,Ye,At,ji):Hc(qt,x,Kt,Qe,rt,nt,Bt,lt,Ye,At,ji);x.prepareDrawProgram(W,hi,Bt.toUnwrapped());const di=[];x.terrain&&di.push(It.centroidVertexBuffer),Xe&&di.push(It.layoutVertexExtBuffer),hi.draw(W,W.gl.TRIANGLES,S,P,H,i.CullFaceMode.backCCW,Bi,m.id,It.layoutVertexBuffer,It.indexBuffer,It.segments,m.paint,x.transform.zoom,Ht,di)}}function sd(x,a,m,b,S,P){const H=[Ye=>{let At=Ye.canonical.x-1,ht=Ye.wrap;return At<0&&(At=(1<<Ye.canonical.z)-1,ht--),new i.OverscaledTileID(Ye.overscaledZ,ht,Ye.canonical.z,At,Ye.canonical.y)},Ye=>{let At=Ye.canonical.x+1,ht=Ye.wrap;return At===1<<Ye.canonical.z&&(At=0,ht++),new i.OverscaledTileID(Ye.overscaledZ,ht,Ye.canonical.z,At,Ye.canonical.y)},Ye=>new i.OverscaledTileID(Ye.overscaledZ,Ye.wrap,Ye.canonical.z,Ye.canonical.x,(Ye.canonical.y===0?1<<Ye.canonical.z:Ye.canonical.y)-1),Ye=>new i.OverscaledTileID(Ye.overscaledZ,Ye.wrap,Ye.canonical.z,Ye.canonical.x,Ye.canonical.y===(1<<Ye.canonical.z)-1?0:Ye.canonical.y+1)],W=Ye=>{const At=a.getSource().minzoom,ht=Pt=>{const It=a.getTileByID(Pt);if(It&&It.hasData())return It.getBucket(S)},Bt=[0,-1,1];for(const Pt of Bt){if(Ye.overscaledZ+Pt<At)continue;const It=ht(Ye.calculateScaledKey(Ye.overscaledZ+Pt));if(It)return It}},ee=[0,0,0],pe=(Ye,At)=>(ee[0]=Math.min(Ye.min.y,At.min.y),ee[1]=Math.max(Ye.max.y,At.max.y),ee[2]=i.EXTENT-At.min.x>Ye.max.x?At.min.x-i.EXTENT:Ye.max.x,ee),fe=(Ye,At)=>(ee[0]=Math.min(Ye.min.x,At.min.x),ee[1]=Math.max(Ye.max.x,At.max.x),ee[2]=i.EXTENT-At.min.y>Ye.max.y?At.min.y-i.EXTENT:Ye.max.y,ee),Se=[(Ye,At)=>pe(Ye,At),(Ye,At)=>pe(At,Ye),(Ye,At)=>fe(Ye,At),(Ye,At)=>fe(At,Ye)],Qe=new i.pointGeometry(0,0);let rt,nt,lt;const Xe=(Ye,At,ht,Bt,Pt)=>{const It=[[Bt?ht:Ye,Bt?Ye:ht,0],[Bt?ht:At,Bt?At:ht,0]],Ht=Pt<0?i.EXTENT+Pt:Pt,hi=[Bt?Ht:(Ye+At)/2,Bt?(Ye+At)/2:Ht,0];return ht===0&&Pt<0||ht!==0&&Pt>0?P.getForTilePoints(lt,[hi],!0,nt):It.push(hi),P.getForTilePoints(m,It,!0,rt),Math.max(It[0][2],It[1][2],hi[2])/P.exaggeration()};for(let Ye=0;Ye<4;Ye++){const At=(Ye<2?1:5)-Ye,ht=b.borders[Ye];if(ht.length===0)continue;const Bt=lt=H[Ye](m),Pt=W(Bt);if(!(Pt&&Pt instanceof i.FillExtrusionBucket&&Pt.enableTerrain)||b.borderDoneWithNeighborZ[Ye]===Pt.canonical.z&&Pt.borderDoneWithNeighborZ[At]===b.canonical.z||(nt=P.findDEMTileFor(Bt),!nt||!nt.dem))continue;if(!rt){const si=P.findDEMTileFor(m);if(!si||!si.dem)return;rt=si}const It=Pt.borders[At];let Ht=0;const hi=Pt.borderDoneWithNeighborZ[At]!==b.canonical.z;if(b.canonical.z===Pt.canonical.z){for(let si=0;si<ht.length;si++){const qt=b.featuresOnBorder[ht[si]],ji=qt.borders[Ye];let Kt;for(;Ht<It.length&&(Kt=Pt.featuresOnBorder[It[Ht]],!(Kt.borders[At][1]>ji[0]+3));)hi&&Pt.encodeCentroid(void 0,Kt,!1),Ht++;if(Kt&&Ht<It.length){const Bi=Ht;let di=0;for(;!(Kt.borders[At][0]>ji[1]-3)&&(di++,++Ht!==It.length);)Kt=Pt.featuresOnBorder[It[Ht]];if(Kt=Pt.featuresOnBorder[It[Bi]],qt.intersectsCount()>1||Kt.intersectsCount()>1||di!==1){di!==1&&(Ht=Bi),b.encodeCentroid(void 0,qt,!1),hi&&Pt.encodeCentroid(void 0,Kt,!1);continue}const Ri=Se[Ye](qt,Kt),Ai=Ye%2?i.EXTENT-1:0;Qe.x=Xe(Ri[0],Math.min(i.EXTENT-1,Ri[1]),Ai,Ye<2,Ri[2]),Qe.y=0,b.encodeCentroid(Qe,qt,!1),hi&&Pt.encodeCentroid(Qe,Kt,!1)}else b.encodeCentroid(void 0,qt,!1)}b.borderDoneWithNeighborZ[Ye]=Pt.canonical.z,b.needsCentroidUpdate=!0,hi&&(Pt.borderDoneWithNeighborZ[At]=b.canonical.z,Pt.needsCentroidUpdate=!0)}else{for(const si of ht)b.encodeCentroid(void 0,b.featuresOnBorder[si],!1);if(hi){for(const si of It)Pt.encodeCentroid(void 0,Pt.featuresOnBorder[si],!1);Pt.borderDoneWithNeighborZ[At]=b.canonical.z,Pt.needsCentroidUpdate=!0}b.borderDoneWithNeighborZ[Ye]=Pt.canonical.z,b.needsCentroidUpdate=!0}}(b.needsCentroidUpdate||!b.centroidVertexBuffer&&b.centroidVertexArray.length!==0)&&b.uploadCentroid(x)}const ml=new i.Color(1,0,0,1),kh=new i.Color(0,1,0,1),Oh=new i.Color(0,0,1,1),lA=new i.Color(1,0,1,1),od=new i.Color(0,1,1,1);function Nh(x,a,m){const b=x.context,S=x.transform,P=b.gl,H=S.projection.name==="globe",W=H?["PROJECTION_GLOBE_VIEW"]:null;let ee=m.projMatrix;if(H&&i.globeToMercatorTransition(S.zoom)>0){const qt=i.transitionTileAABBinECEF(m.canonical,S),ji=i.globeDenormalizeECEF(qt);ee=i.multiply(new Float32Array(16),S.globeMatrix,ji),i.multiply(ee,S.projMatrix,ee)}const pe=x.useProgram("debug",null,W),fe=a.getTileByID(m.key);x.terrain&&x.terrain.setupElevationDraw(fe,pe);const Se=i.DepthMode.disabled,Qe=i.StencilMode.disabled,rt=x.colorModeForRenderPass(),nt="$debug";b.activeTexture.set(P.TEXTURE0),x.emptyTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),H?fe._makeGlobeTileDebugBuffers(x.context,S):fe._makeDebugTileBoundsBuffers(x.context,S.projection);const lt=fe._tileDebugBuffer||x.debugBuffer,Xe=fe._tileDebugIndexBuffer||x.debugIndexBuffer,Ye=fe._tileDebugSegments||x.debugSegments;pe.draw(b,P.LINE_STRIP,Se,Qe,rt,i.CullFaceMode.disabled,ha(ee,i.Color.red),nt,lt,Xe,Ye,null,null,null,[fe._globeTileDebugBorderBuffer]);const At=fe.latestRawTileData,ht=Math.floor((At&&At.byteLength||0)/1024),Bt=a.getTile(m).tileSize,Pt=512/Math.min(Bt,512)*(m.overscaledZ/S.zoom)*.5;let It=m.canonical.toString();m.overscaledZ!==m.canonical.z&&(It+=` => ${m.overscaledZ}`),It+=` ${ht}kb`,function(qt,ji){qt.initDebugOverlayCanvas();const Kt=qt.debugOverlayCanvas,Bi=qt.context.gl,di=qt.debugOverlayCanvas.getContext("2d");di.clearRect(0,0,Kt.width,Kt.height),di.shadowColor="white",di.shadowBlur=2,di.lineWidth=1.5,di.strokeStyle="white",di.textBaseline="top",di.font="bold 36px Open Sans, sans-serif",di.fillText(ji,5,5),di.strokeText(ji,5,5),qt.debugOverlayTexture.update(Kt),qt.debugOverlayTexture.bind(Bi.LINEAR,Bi.CLAMP_TO_EDGE)}(x,It);const Ht=fe._tileDebugTextBuffer||x.debugBuffer,hi=fe._tileDebugTextIndexBuffer||x.quadTriangleIndexBuffer,si=fe._tileDebugTextSegments||x.debugSegments;pe.draw(b,P.TRIANGLES,Se,Qe,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,ha(ee,i.Color.transparent,Pt),nt,Ht,hi,si,null,null,null,[fe._globeTileDebugTextBuffer])}function fc(x,a,m,b){pn(x,0,a+m/2,x.transform.width,m,b)}function ua(x,a,m,b){pn(x,a-m/2,0,m,x.transform.height,b)}function pn(x,a,m,b,S,P){const H=x.context,W=H.gl;W.enable(W.SCISSOR_TEST),W.scissor(a*i.exported.devicePixelRatio,m*i.exported.devicePixelRatio,b*i.exported.devicePixelRatio,S*i.exported.devicePixelRatio),H.clear({color:P}),W.disable(W.SCISSOR_TEST)}const eh=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Wl}=eh;function Ns(x,a,m,b){x.emplaceBack(a,m,b)}class gl{constructor(a){this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,Ns(this.vertexArray,-1,-1,1),Ns(this.vertexArray,1,-1,1),Ns(this.vertexArray,-1,1,1),Ns(this.vertexArray,1,1,1),Ns(this.vertexArray,-1,-1,-1),Ns(this.vertexArray,1,-1,-1),Ns(this.vertexArray,-1,1,-1),Ns(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=a.createVertexBuffer(this.vertexArray,Wl),this.indexBuffer=a.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)}}function un(x,a,m,b,S,P){const H=x.gl,W=a.paint.get("sky-atmosphere-color"),ee=a.paint.get("sky-atmosphere-halo-color"),pe=a.paint.get("sky-atmosphere-sun-intensity"),fe=((Se,Qe,rt,nt,lt)=>({u_matrix_3f:Se,u_sun_direction:Qe,u_sun_intensity:rt,u_color_tint_r:[nt.r,nt.g,nt.b,nt.a],u_color_tint_m:[lt.r,lt.g,lt.b,lt.a],u_luminance:5e-5}))(i.fromMat4(i.create$1(),b),S,pe,W,ee);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+P,a.skyboxTexture,0),m.draw(x,H.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,fe,"skyboxCapture",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)}const th=i.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ur{constructor(a){const m=new i.StructArrayLayout5f20;m.emplaceBack(-1,1,1,0,0),m.emplaceBack(1,1,1,1,0),m.emplaceBack(1,-1,1,1,1),m.emplaceBack(-1,-1,1,0,1);const b=new i.StructArrayLayout3ui6;b.emplaceBack(0,1,2),b.emplaceBack(2,3,0),this.vertexBuffer=a.createVertexBuffer(m,th.members),this.indexBuffer=a.createIndexBuffer(b),this.segments=i.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const mc={symbol:function(x,a,m,b,S){if(x.renderPass!=="translucent")return;const P=i.StencilMode.disabled,H=x.colorModeForRenderPass();m.layout.get("text-variable-anchor")&&function(W,ee,pe,fe,Se,Qe,rt){const nt=ee.transform,lt=Se==="map",Xe=Qe==="map";for(const Ye of W){const At=fe.getTile(Ye),ht=At.getBucket(pe);if(!ht||!ht.text||!ht.text.segments.get().length)continue;const Bt=i.evaluateSizeForZoom(ht.textSizeData,nt.zoom),Pt=kl(Ye,ht.getProjection(),nt),It=nt.calculatePixelsToTileUnitsMatrix(At),Ht=Mr(Pt,At.tileID.canonical,Xe,lt,nt,ht.getProjection(),It),hi=pe.layout.get("icon-text-fit")!=="none"&&ht.hasIconData();if(Bt){const si=Math.pow(2,nt.zoom-At.tileID.overscaledZ);Jc(ht,lt,Xe,rt,i.symbolSize,nt,Ht,Ye,si,Bt,hi)}}}(b,x,m,a,m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),S),m.paint.get("icon-opacity").constantOr(1)!==0&&xa(x,a,m,b,!1,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),m.layout.get("icon-rotation-alignment"),m.layout.get("icon-pitch-alignment"),m.layout.get("icon-keep-upright"),P,H),m.paint.get("text-opacity").constantOr(1)!==0&&xa(x,a,m,b,!0,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),m.layout.get("text-keep-upright"),P,H),a.map.showCollisionBoxes&&(pc(x,a,m,b,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),!0),pc(x,a,m,b,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),!1))},circle:function(x,a,m,b){if(x.renderPass!=="translucent")return;const S=m.paint.get("circle-opacity"),P=m.paint.get("circle-stroke-width"),H=m.paint.get("circle-stroke-opacity"),W=m.layout.get("circle-sort-key").constantOr(1)!==void 0;if(S.constantOr(1)===0&&(P.constantOr(1)===0||H.constantOr(1)===0))return;const ee=x.context,pe=ee.gl,fe=x.transform,Se=x.depthModeForSublayer(0,i.DepthMode.ReadOnly),Qe=i.StencilMode.disabled,rt=x.colorModeForRenderPass(),nt=fe.projection.name==="globe",lt=[i.mercatorXfromLng(fe.center.lng),i.mercatorYfromLat(fe.center.lat)],Xe=[];for(let At=0;At<b.length;At++){const ht=b[At],Bt=a.getTile(ht),Pt=Bt.getBucket(m);if(!Pt||Pt.projection.name!==fe.projection.name)continue;const It=Pt.programConfigurations.get(m.id),Ht=oA(m);nt&&Ht.push("PROJECTION_GLOBE_VIEW");const hi=x.useProgram("circle",It,Ht),si=Pt.layoutVertexBuffer,qt=Pt.globeExtVertexBuffer,ji=Pt.indexBuffer,Kt=fe.projection.createInversionMatrix(fe,ht.canonical),Bi={programConfiguration:It,program:hi,layoutVertexBuffer:si,globeExtVertexBuffer:qt,indexBuffer:ji,uniformValues:sA(x,ht,Bt,Kt,lt,m),tile:Bt};if(W){const di=Pt.segments.get();for(const Ri of di)Xe.push({segments:new i.SegmentVector([Ri]),sortKey:Ri.sortKey,state:Bi})}else Xe.push({segments:Pt.segments,sortKey:0,state:Bi})}W&&Xe.sort((At,ht)=>At.sortKey-ht.sortKey);const Ye={useDepthForOcclusion:!nt};for(const At of Xe){const{programConfiguration:ht,program:Bt,layoutVertexBuffer:Pt,globeExtVertexBuffer:It,indexBuffer:Ht,uniformValues:hi,tile:si}=At.state,qt=At.segments;x.terrain&&x.terrain.setupElevationDraw(si,Bt,Ye),x.prepareDrawProgram(ee,Bt,si.tileID.toUnwrapped()),Bt.draw(ee,pe.TRIANGLES,Se,Qe,rt,i.CullFaceMode.disabled,hi,m.id,Pt,Ht,qt,m.paint,fe.zoom,ht,[It])}},heatmap:function(x,a,m,b){if(m.paint.get("heatmap-opacity")!==0)if(x.renderPass==="offscreen"){const S=x.context,P=S.gl,H=i.StencilMode.disabled,W=new i.ColorMode([P.ONE,P.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(rt,nt,lt,Xe){const Ye=rt.gl,At=nt.width*Xe,ht=nt.height*Xe;rt.activeTexture.set(Ye.TEXTURE1),rt.viewport.set([0,0,At,ht]);let Bt=lt.heatmapFbo;if(!Bt||Bt&&(Bt.width!==At||Bt.height!==ht)){Bt&&Bt.destroy();const Pt=Ye.createTexture();Ye.bindTexture(Ye.TEXTURE_2D,Pt),Ye.texParameteri(Ye.TEXTURE_2D,Ye.TEXTURE_WRAP_S,Ye.CLAMP_TO_EDGE),Ye.texParameteri(Ye.TEXTURE_2D,Ye.TEXTURE_WRAP_T,Ye.CLAMP_TO_EDGE),Ye.texParameteri(Ye.TEXTURE_2D,Ye.TEXTURE_MIN_FILTER,Ye.LINEAR),Ye.texParameteri(Ye.TEXTURE_2D,Ye.TEXTURE_MAG_FILTER,Ye.LINEAR),Bt=lt.heatmapFbo=rt.createFramebuffer(At,ht,!1),function(It,Ht,hi,si,qt,ji){const Kt=It.gl;Kt.texImage2D(Kt.TEXTURE_2D,0,Kt.RGBA,qt,ji,0,Kt.RGBA,It.extRenderToTextureHalfFloat?It.extTextureHalfFloat.HALF_FLOAT_OES:Kt.UNSIGNED_BYTE,null),si.colorAttachment.set(hi)}(rt,0,Pt,Bt,At,ht)}else Ye.bindTexture(Ye.TEXTURE_2D,Bt.colorAttachment.get()),rt.bindFramebuffer.set(Bt.framebuffer)})(S,x,m,x.transform.projection.name==="globe"?.5:.25),S.clear({color:i.Color.transparent});const ee=x.transform,pe=ee.projection.name==="globe",fe=pe?["PROJECTION_GLOBE_VIEW"]:null,Se=pe?i.CullFaceMode.frontCCW:i.CullFaceMode.disabled,Qe=[i.mercatorXfromLng(ee.center.lng),i.mercatorYfromLat(ee.center.lat)];for(let rt=0;rt<b.length;rt++){const nt=b[rt];if(a.hasRenderableParent(nt))continue;const lt=a.getTile(nt),Xe=lt.getBucket(m);if(!Xe||Xe.projection.name!==ee.projection.name)continue;const Ye=Xe.programConfigurations.get(m.id),At=x.useProgram("heatmap",Ye,fe),{zoom:ht}=x.transform;x.terrain&&x.terrain.setupElevationDraw(lt,At),x.prepareDrawProgram(S,At,nt.toUnwrapped());const Bt=ee.projection.createInversionMatrix(ee,nt.canonical);At.draw(S,P.TRIANGLES,i.DepthMode.disabled,H,W,Se,pl(x,nt,lt,Bt,Qe,ht,m.paint.get("heatmap-intensity")),m.id,Xe.layoutVertexBuffer,Xe.indexBuffer,Xe.segments,m.paint,x.transform.zoom,Ye,pe?[Xe.globeExtVertexBuffer]:null)}S.viewport.set([0,0,x.width,x.height])}else x.renderPass==="translucent"&&(x.context.setColorMode(x.colorModeForRenderPass()),function(S,P){const H=S.context,W=H.gl,ee=P.heatmapFbo;if(!ee)return;H.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,ee.colorAttachment.get()),H.activeTexture.set(W.TEXTURE1);let pe=P.colorRampTexture;pe||(pe=P.colorRampTexture=new i.Texture(H,P.colorRamp,W.RGBA)),pe.bind(W.LINEAR,W.CLAMP_TO_EDGE),S.useProgram("heatmapTexture").draw(H,W.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,S.colorModeForRenderPass(),i.CullFaceMode.disabled,((fe,Se,Qe,rt)=>({u_image:0,u_color_ramp:1,u_opacity:Se.paint.get("heatmap-opacity")}))(0,P),P.id,S.viewportBuffer,S.quadTriangleIndexBuffer,S.viewportSegments,P.paint,S.transform.zoom)}(x,m))},line:function(x,a,m,b){if(x.renderPass!=="translucent")return;const S=m.paint.get("line-opacity"),P=m.paint.get("line-width");if(S.constantOr(1)===0||P.constantOr(1)===0)return;const H=x.depthModeForSublayer(0,i.DepthMode.ReadOnly),W=x.colorModeForRenderPass(),ee=x.terrain&&x.terrain.renderingToTexture?1:i.exported.devicePixelRatio,pe=m.paint.get("line-dasharray"),fe=pe.constantOr(1),Se=m.layout.get("line-cap"),Qe=m.paint.get("line-pattern"),rt=Qe.constantOr(1),nt=m.paint.get("line-gradient"),lt=rt?"linePattern":"line",Xe=x.context,Ye=Xe.gl,At=(Bt=>{const Pt=[];Gl(Bt)&&Pt.push("RENDER_LINE_DASH"),Bt.paint.get("line-gradient")&&Pt.push("RENDER_LINE_GRADIENT");const It=Bt.paint.get("line-trim-offset");It[0]===0&&It[1]===0||Pt.push("RENDER_LINE_TRIM_OFFSET");const Ht=Bt.paint.get("line-pattern").constantOr(1),hi=Bt.paint.get("line-opacity").constantOr(1)!==1;return!Ht&&hi&&Pt.push("RENDER_LINE_ALPHA_DISCARD"),Pt})(m);let ht=At.includes("RENDER_LINE_ALPHA_DISCARD");x.terrain&&x.terrain.clipOrMaskOverlapStencilType()&&(ht=!1);for(const Bt of b){const Pt=a.getTile(Bt);if(rt&&!Pt.patternsLoaded())continue;const It=Pt.getBucket(m);if(!It)continue;x.prepareDrawTile();const Ht=It.programConfigurations.get(m.id),hi=x.useProgram(lt,Ht,At),si=Qe.constantOr(null);if(si&&Pt.imageAtlas){const Mi=Pt.imageAtlas.patternPositions[si.toString()];Mi&&Ht.setConstantPatternPositions(Mi)}const qt=pe.constantOr(null),ji=Se.constantOr(null);if(!rt&&qt&&ji&&Pt.lineAtlas){const Mi=Pt.lineAtlas.getDash(qt,ji);Mi&&Ht.setConstantPatternPositions(Mi)}let[Kt,Bi]=m.paint.get("line-trim-offset");(ji==="round"||ji==="square")&&Kt!==Bi&&(Kt===0&&(Kt-=1),Bi===1&&(Bi+=1));const di=x.terrain?Bt.projMatrix:null,Ri=rt?Ho(x,Pt,m,di,ee):aA(x,Pt,m,di,It.lineClipsArray.length,ee,[Kt,Bi]);if(nt){const Mi=It.gradients[m.id];let $i=Mi.texture;if(m.gradientVersion!==Mi.version){let Jt=256;if(m.stepInterpolant){const pi=a.getSource().maxzoom,In=Bt.canonical.z===pi?Math.ceil(1<<x.transform.maxZoom-Bt.canonical.z):1;Jt=i.clamp(i.nextPowerOfTwo(It.maxLineLength/i.EXTENT*1024*In),256,Xe.maxTextureSize)}Mi.gradient=i.renderColorRamp({expression:m.gradientExpression(),evaluationKey:"lineProgress",resolution:Jt,image:Mi.gradient||void 0,clips:It.lineClipsArray}),Mi.texture?Mi.texture.update(Mi.gradient):Mi.texture=new i.Texture(Xe,Mi.gradient,Ye.RGBA),Mi.version=m.gradientVersion,$i=Mi.texture}Xe.activeTexture.set(Ye.TEXTURE1),$i.bind(m.stepInterpolant?Ye.NEAREST:Ye.LINEAR,Ye.CLAMP_TO_EDGE)}fe&&(Xe.activeTexture.set(Ye.TEXTURE0),Pt.lineAtlasTexture.bind(Ye.LINEAR,Ye.REPEAT),Ht.updatePaintBuffers()),rt&&(Xe.activeTexture.set(Ye.TEXTURE0),Pt.imageAtlasTexture.bind(Ye.LINEAR,Ye.CLAMP_TO_EDGE),Ht.updatePaintBuffers()),x.prepareDrawProgram(Xe,hi,Bt.toUnwrapped());const Ai=Mi=>{hi.draw(Xe,Ye.TRIANGLES,H,Mi,W,i.CullFaceMode.disabled,Ri,m.id,It.layoutVertexBuffer,It.indexBuffer,It.segments,m.paint,x.transform.zoom,Ht,[It.layoutVertexBuffer2])};if(ht){const Mi=x.stencilModeForClipping(Bt).ref;Mi===0&&x.terrain&&Xe.clear({stencil:0});const $i={func:Ye.EQUAL,mask:255};Ri.u_alpha_discard_threshold=.8,Ai(new i.StencilMode($i,Mi,255,Ye.KEEP,Ye.KEEP,Ye.INVERT)),Ri.u_alpha_discard_threshold=0,Ai(new i.StencilMode($i,Mi,255,Ye.KEEP,Ye.KEEP,Ye.KEEP))}else Ai(x.stencilModeForClipping(Bt))}ht&&(x.resetStencilClippingMasks(),x.terrain&&Xe.clear({stencil:0}))},fill:function(x,a,m,b){const S=m.paint.get("fill-color"),P=m.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const H=x.colorModeForRenderPass(),W=m.paint.get("fill-pattern"),ee=x.opaquePassEnabledForLayer()&&!W.constantOr(1)&&S.constantOr(i.Color.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===ee){const pe=x.depthModeForSublayer(1,x.renderPass==="opaque"?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);rd(x,a,m,b,pe,H,!1)}if(x.renderPass==="translucent"&&m.paint.get("fill-antialias")){const pe=x.depthModeForSublayer(m.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);rd(x,a,m,b,pe,H,!0)}},"fill-extrusion":function(x,a,m,b){const S=m.paint.get("fill-extrusion-opacity");if(S!==0&&x.renderPass==="translucent"){const P=new i.DepthMode(x.context.gl.LEQUAL,i.DepthMode.ReadWrite,x.depthRangeFor3D);if(S!==1||m.paint.get("fill-extrusion-pattern").constantOr(1))Ga(x,a,m,b,P,i.StencilMode.disabled,i.ColorMode.disabled),Ga(x,a,m,b,P,x.stencilModeFor3D(),x.colorModeForRenderPass()),x.resetStencilClippingMasks();else{const H=x.colorModeForRenderPass();Ga(x,a,m,b,P,i.StencilMode.disabled,H)}}},hillshade:function(x,a,m,b){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const S=x.context,P=x.depthModeForSublayer(0,i.DepthMode.ReadOnly),H=x.colorModeForRenderPass(),W=x.terrain&&x.terrain.renderingToTexture,[ee,pe]=x.renderPass!=="translucent"||W?[{},b]:x.stencilConfigForOverlap(b);for(const fe of pe){const Se=a.getTile(fe);if(Se.needsHillshadePrepare&&x.renderPass==="offscreen")Ha(x,Se,m,P,i.StencilMode.disabled,H);else if(x.renderPass==="translucent"){const Qe=W&&x.terrain?x.terrain.stencilModeForRTTOverlap(fe):ee[fe.overscaledZ];_u(x,fe,Se,m,P,Qe,H)}}S.viewport.set([0,0,x.width,x.height]),x.resetStencilClippingMasks()},raster:function(x,a,m,b,S,P){if(x.renderPass!=="translucent"||m.paint.get("raster-opacity")===0||!b.length)return;const H=x.context,W=H.gl,ee=a.getSource(),pe=x.useProgram("raster"),fe=x.colorModeForRenderPass(),Se=x.terrain&&x.terrain.renderingToTexture,[Qe,rt]=ee instanceof X||Se?[{},b]:x.stencilConfigForOverlap(b),nt=rt[rt.length-1].overscaledZ,lt=!x.options.moving;for(const Xe of rt){const Ye=Se?i.DepthMode.disabled:x.depthModeForSublayer(Xe.overscaledZ-nt,m.paint.get("raster-opacity")===1?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,W.LESS),At=Xe.toUnwrapped(),ht=a.getTile(Xe);if(Se&&(!ht||!ht.hasData()))continue;const Bt=Se?Xe.projMatrix:x.transform.calculateProjMatrix(At,lt),Pt=x.terrain&&Se?x.terrain.stencilModeForRTTOverlap(Xe):Qe[Xe.overscaledZ],It=P?0:m.paint.get("raster-fade-duration");ht.registerFadeDuration(It);const Ht=a.findLoadedParent(Xe,0),hi=Hl(ht,Ht,a,x.transform,It);let si,qt;x.terrain&&x.terrain.prepareDrawTile();const ji=m.paint.get("raster-resampling")==="nearest"?W.NEAREST:W.LINEAR;H.activeTexture.set(W.TEXTURE0),ht.texture.bind(ji,W.CLAMP_TO_EDGE),H.activeTexture.set(W.TEXTURE1),Ht?(Ht.texture.bind(ji,W.CLAMP_TO_EDGE),si=Math.pow(2,Ht.tileID.overscaledZ-ht.tileID.overscaledZ),qt=[ht.tileID.canonical.x*si%1,ht.tileID.canonical.y*si%1]):ht.texture.bind(ji,W.CLAMP_TO_EDGE);const Kt=vu(Bt,qt||[0,0],si||1,hi,m,ee instanceof X?ee.perspectiveTransform:[0,0]);if(x.prepareDrawProgram(H,pe,At),ee instanceof X)ee.boundsBuffer&&ee.boundsSegments&&pe.draw(H,W.TRIANGLES,Ye,i.StencilMode.disabled,fe,i.CullFaceMode.disabled,Kt,m.id,ee.boundsBuffer,x.quadTriangleIndexBuffer,ee.boundsSegments);else{const{tileBoundsBuffer:Bi,tileBoundsIndexBuffer:di,tileBoundsSegments:Ri}=x.getTileBoundsBuffers(ht);pe.draw(H,W.TRIANGLES,Ye,Pt,fe,i.CullFaceMode.disabled,Kt,m.id,Bi,di,Ri)}}x.resetStencilClippingMasks()},background:function(x,a,m,b){const S=m.paint.get("background-color"),P=m.paint.get("background-opacity");if(P===0)return;const H=x.context,W=H.gl,ee=x.transform,pe=ee.tileSize,fe=m.paint.get("background-pattern");if(x.isPatternMissing(fe))return;const Se=!fe&&S.a===1&&P===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==Se)return;const Qe=i.StencilMode.disabled,rt=x.depthModeForSublayer(0,Se==="opaque"?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),nt=x.colorModeForRenderPass(),lt=x.useProgram(fe?"backgroundPattern":"background");let Xe,Ye=b;Ye||(Xe=x.getBackgroundTiles(),Ye=Object.values(Xe).map(At=>At.tileID)),fe&&(H.activeTexture.set(W.TEXTURE0),x.imageManager.bind(x.context));for(const At of Ye){const ht=At.toUnwrapped(),Bt=b?At.projMatrix:x.transform.calculateProjMatrix(ht);x.prepareDrawTile();const Pt=a?a.getTile(At):Xe?Xe[At.key]:new i.Tile(At,pe,ee.zoom,x),It=fe?wu(Bt,P,x,fe,{tileID:At,tileSize:pe}):Rh(Bt,P,S);x.prepareDrawProgram(H,lt,ht);const{tileBoundsBuffer:Ht,tileBoundsIndexBuffer:hi,tileBoundsSegments:si}=x.getTileBoundsBuffers(Pt);lt.draw(H,W.TRIANGLES,rt,Qe,nt,i.CullFaceMode.disabled,It,m.id,Ht,hi,si)}},sky:function(x,a,m){const b=x.transform,S=b.projection.name==="mercator"||b.projection.name==="globe"?1:i.smoothstep(7,8,b.zoom),P=m.paint.get("sky-opacity")*S;if(P===0)return;const H=x.context,W=m.paint.get("sky-type"),ee=new i.DepthMode(H.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),pe=x.frameCounter/1e3%1;W==="atmosphere"?x.renderPass==="offscreen"?m.needsSkyboxCapture(x)&&(function(fe,Se,Qe,rt){const nt=fe.context,lt=nt.gl;let Xe=Se.skyboxFbo;if(!Xe){Xe=Se.skyboxFbo=nt.createFramebuffer(32,32,!1),Se.skyboxGeometry=new gl(nt),Se.skyboxTexture=nt.gl.createTexture(),lt.bindTexture(lt.TEXTURE_CUBE_MAP,Se.skyboxTexture),lt.texParameteri(lt.TEXTURE_CUBE_MAP,lt.TEXTURE_WRAP_S,lt.CLAMP_TO_EDGE),lt.texParameteri(lt.TEXTURE_CUBE_MAP,lt.TEXTURE_WRAP_T,lt.CLAMP_TO_EDGE),lt.texParameteri(lt.TEXTURE_CUBE_MAP,lt.TEXTURE_MIN_FILTER,lt.LINEAR),lt.texParameteri(lt.TEXTURE_CUBE_MAP,lt.TEXTURE_MAG_FILTER,lt.LINEAR);for(let Bt=0;Bt<6;++Bt)lt.texImage2D(lt.TEXTURE_CUBE_MAP_POSITIVE_X+Bt,0,lt.RGBA,32,32,0,lt.RGBA,lt.UNSIGNED_BYTE,null)}nt.bindFramebuffer.set(Xe.framebuffer),nt.viewport.set([0,0,32,32]);const Ye=Se.getCenter(fe,!0),At=fe.useProgram("skyboxCapture"),ht=new Float64Array(16);i.identity(ht),i.rotateY(ht,ht,.5*-Math.PI),un(nt,Se,At,ht,Ye,0),i.identity(ht),i.rotateY(ht,ht,.5*Math.PI),un(nt,Se,At,ht,Ye,1),i.identity(ht),i.rotateX(ht,ht,.5*-Math.PI),un(nt,Se,At,ht,Ye,2),i.identity(ht),i.rotateX(ht,ht,.5*Math.PI),un(nt,Se,At,ht,Ye,3),i.identity(ht),un(nt,Se,At,ht,Ye,4),i.identity(ht),i.rotateY(ht,ht,Math.PI),un(nt,Se,At,ht,Ye,5),nt.viewport.set([0,0,fe.width,fe.height])}(x,m),m.markSkyboxValid(x)):x.renderPass==="sky"&&function(fe,Se,Qe,rt,nt){const lt=fe.context,Xe=lt.gl,Ye=fe.transform,At=fe.useProgram("skybox");lt.activeTexture.set(Xe.TEXTURE0),Xe.bindTexture(Xe.TEXTURE_CUBE_MAP,Se.skyboxTexture);const ht=((Bt,Pt,It,Ht,hi)=>({u_matrix:Bt,u_sun_direction:Pt,u_cubemap:0,u_opacity:Ht,u_temporal_offset:hi}))(Ye.skyboxMatrix,Se.getCenter(fe,!1),0,rt,nt);fe.prepareDrawProgram(lt,At),At.draw(lt,Xe.TRIANGLES,Qe,i.StencilMode.disabled,fe.colorModeForRenderPass(),i.CullFaceMode.backCW,ht,"skybox",Se.skyboxGeometry.vertexBuffer,Se.skyboxGeometry.indexBuffer,Se.skyboxGeometry.segment)}(x,m,ee,P,pe):W==="gradient"&&x.renderPass==="sky"&&function(fe,Se,Qe,rt,nt){const lt=fe.context,Xe=lt.gl,Ye=fe.transform,At=fe.useProgram("skyboxGradient");Se.skyboxGeometry||(Se.skyboxGeometry=new gl(lt)),lt.activeTexture.set(Xe.TEXTURE0);let ht=Se.colorRampTexture;ht||(ht=Se.colorRampTexture=new i.Texture(lt,Se.colorRamp,Xe.RGBA)),ht.bind(Xe.LINEAR,Xe.CLAMP_TO_EDGE);const Bt=((Pt,It,Ht,hi,si)=>({u_matrix:Pt,u_color_ramp:0,u_center_direction:It,u_radius:i.degToRad(Ht),u_opacity:hi,u_temporal_offset:si}))(Ye.skyboxMatrix,Se.getCenter(fe,!1),Se.paint.get("sky-gradient-radius"),rt,nt);fe.prepareDrawProgram(lt,At),At.draw(lt,Xe.TRIANGLES,Qe,i.StencilMode.disabled,fe.colorModeForRenderPass(),i.CullFaceMode.backCW,Bt,"skyboxGradient",Se.skyboxGeometry.vertexBuffer,Se.skyboxGeometry.indexBuffer,Se.skyboxGeometry.segment)}(x,m,ee,P,pe)},debug:function(x,a,m){for(let b=0;b<m.length;b++)Nh(x,a,m[b])},custom:function(x,a,m){const b=x.context,S=m.implementation;if(x.transform.projection.unsupportedLayers&&x.transform.projection.unsupportedLayers.includes("custom"))i.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");else if(x.renderPass==="offscreen"){const P=S.prerender;P&&(x.setCustomLayerDefaults(),b.setColorMode(x.colorModeForRenderPass()),P.call(S,b.gl,x.transform.customLayerMatrix()),b.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),b.setColorMode(x.colorModeForRenderPass()),b.setStencilMode(i.StencilMode.disabled);const P=S.renderingMode==="3d"?new i.DepthMode(x.context.gl.LEQUAL,i.DepthMode.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,i.DepthMode.ReadOnly);b.setDepthMode(P),S.render(b.gl,x.transform.customLayerMatrix()),b.setDirty(),x.setBaseState(),b.bindFramebuffer.set(null)}}};class cA{constructor(a,m){this.context=new Ee(a),this.transform=m,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=i.SourceCache.maxUnderzooming+i.SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Va,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}updateTerrain(a,m){const b=!!a&&!!a.terrain&&this.transform.projection.supportsTerrain;if(!(b||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new nA(this,a));const S=this._terrain;this.transform.elevation=b?S:null,S.update(a,this.transform,m)}_updateFog(a){const m=a.fog;if(!m||this.transform.projection.name==="globe"||m.getOpacity(this.transform.pitch)<1||m.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[b,S]=m.getFovAdjustedRange(this.transform._fov);if(b>S)return void(this.transform.fogCullDistSq=null);const P=b+.78*(S-b);this.transform.fogCullDistSq=P*P}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(a,m){if(this.width=a*i.exported.devicePixelRatio,this.height=m*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const b of this.style.order)this.style._layers[b].resize()}setup(){const a=this.context,m=new i.StructArrayLayout2i4;m.emplaceBack(0,0),m.emplaceBack(i.EXTENT,0),m.emplaceBack(0,i.EXTENT),m.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=a.createVertexBuffer(m,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);const b=new i.StructArrayLayout2i4;b.emplaceBack(0,0),b.emplaceBack(i.EXTENT,0),b.emplaceBack(0,i.EXTENT),b.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=a.createVertexBuffer(b,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);const S=new i.StructArrayLayout2i4;S.emplaceBack(-1,-1),S.emplaceBack(1,-1),S.emplaceBack(-1,1),S.emplaceBack(1,1),this.viewportBuffer=a.createVertexBuffer(S,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);const P=new i.StructArrayLayout4i8;P.emplaceBack(0,0,0,0),P.emplaceBack(i.EXTENT,0,i.EXTENT,0),P.emplaceBack(0,i.EXTENT,0,i.EXTENT),P.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=a.createVertexBuffer(P,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);const H=new i.StructArrayLayout3ui6;H.emplaceBack(0,1,2),H.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=a.createIndexBuffer(H);const W=new i.StructArrayLayout1ui2;for(const pe of[0,1,3,2,0])W.emplaceBack(pe);this.debugIndexBuffer=a.createIndexBuffer(W),this.emptyTexture=new i.Texture(a,new i.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),a.gl.RGBA),this.identityMat=i.create();const ee=this.context.gl;this.stencilClearMode=new i.StencilMode({func:ee.ALWAYS,mask:0},0,255,ee.ZERO,ee.ZERO,ee.ZERO),this.loadTimeStamps.push(i.window.performance.now()),this.atmosphereBuffer=new Ur(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(a){return a._makeTileBoundsBuffers(this.context,this.transform.projection),a._tileBoundsBuffer?{tileBoundsBuffer:a._tileBoundsBuffer,tileBoundsIndexBuffer:a._tileBoundsIndexBuffer,tileBoundsSegments:a._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const a=this.context,m=a.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(a,m.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,$r(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(a,m,b){if(!m||this.currentStencilSource===m.id||!a.isTileClipped()||!b||b.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let W=!1;for(const ee of b)if(this._tileClippingMaskIDs[ee.key]===void 0){W=!0;break}if(!W)return}this.currentStencilSource=m.id;const S=this.context,P=S.gl;this.nextStencilID+b.length>256&&this.clearStencil(),S.setColorMode(i.ColorMode.disabled),S.setDepthMode(i.DepthMode.disabled);const H=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const W of b){const ee=m.getTile(W),pe=this._tileClippingMaskIDs[W.key]=this.nextStencilID++,{tileBoundsBuffer:fe,tileBoundsIndexBuffer:Se,tileBoundsSegments:Qe}=this.getTileBoundsBuffers(ee);H.draw(S,P.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:P.ALWAYS,mask:0},pe,255,P.KEEP,P.KEEP,P.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,$r(W.projMatrix),"$clipping",fe,Se,Qe)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const a=this.nextStencilID++,m=this.context.gl;return new i.StencilMode({func:m.NOTEQUAL,mask:255},a,255,m.KEEP,m.KEEP,m.REPLACE)}stencilModeForClipping(a){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(a);const m=this.context.gl;return new i.StencilMode({func:m.EQUAL,mask:255},this._tileClippingMaskIDs[a.key],0,m.KEEP,m.KEEP,m.REPLACE)}stencilConfigForOverlap(a){const m=this.context.gl,b=a.sort((H,W)=>W.overscaledZ-H.overscaledZ),S=b[b.length-1].overscaledZ,P=b[0].overscaledZ-S+1;if(P>1){this.currentStencilSource=void 0,this.nextStencilID+P>256&&this.clearStencil();const H={};for(let W=0;W<P;W++)H[W+S]=new i.StencilMode({func:m.GEQUAL,mask:255},W+this.nextStencilID,255,m.KEEP,m.KEEP,m.REPLACE);return this.nextStencilID+=P,[H,b]}return[{[S]:i.StencilMode.disabled},b]}colorModeForRenderPass(){const a=this.context.gl;return this._showOverdrawInspector?new i.ColorMode([a.CONSTANT_COLOR,a.ONE],new i.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?i.ColorMode.unblended:i.ColorMode.alphaBlended}depthModeForSublayer(a,m,b){if(!this.opaquePassEnabledForLayer())return i.DepthMode.disabled;const S=1-((1+this.currentLayer)*this.numSublayers+a)*this.depthEpsilon;return new i.DepthMode(b||this.context.gl.LEQUAL,m,[S,S])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(a,m){this.style=a,this.options=m,this.imageManager=a.imageManager,this.glyphManager=a.glyphManager,this.symbolFadeChange=a.placement.symbolFadeChange(i.exported.now()),this.imageManager.beginFrame();const b=this.style.order,S=this.style._sourceCaches;for(const ee in S){const pe=S[ee];pe.used&&pe.prepare(this.context)}const P={},H={},W={};for(const ee in S){const pe=S[ee];P[ee]=pe.getVisibleCoordinates(),H[ee]=P[ee].slice().reverse(),W[ee]=pe.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let ee=0;ee<b.length;ee++)if(this.style._layers[b[ee]].is3D()){this.opaquePassCutoff=ee;break}if(this.terrain&&(this.terrain.updateTileBinding(W),this.opaquePassCutoff=0),this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new i.GlobeSharedBuffers(this.context)),i.isMapAuthenticated(this.context.gl)){this.renderPass="offscreen";for(const ee of b){const pe=this.style._layers[ee],fe=a._getLayerSourceCache(pe);if(!pe.hasOffscreenPass()||pe.isHidden(this.transform.zoom))continue;const Se=fe?H[fe.id]:void 0;(pe.type==="custom"||pe.isSky()||Se&&Se.length)&&this.renderLayer(this,fe,pe,Se)}if(this.depthRangeFor3D=[0,1-(a.order.length+2)*this.numSublayers*this.depthEpsilon],this.terrain&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&this.terrain.drawDepth(),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]),this.context.clear({color:m.showOverdrawInspector?i.Color.black:i.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=m.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=b.length-1;this.currentLayer>=0;this.currentLayer--){const ee=this.style._layers[b[this.currentLayer]],pe=a._getLayerSourceCache(ee);if(ee.isSky())continue;const fe=pe?H[pe.id]:void 0;this._renderTileClippingMasks(ee,pe,fe),this.renderLayer(this,pe,ee,fe)}if(this.style.fog&&this.transform.projection.supportsFog&&function(ee,pe){const fe=ee.context,Se=fe.gl,Qe=ee.transform,rt=new i.DepthMode(Se.LEQUAL,i.DepthMode.ReadOnly,[0,1]),nt=ee.useProgram("globeAtmosphere",null,Qe.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),lt=i.globeToMercatorTransition(Qe.zoom),Xe=pe.properties.get("color").toArray01(),Ye=pe.properties.get("high-color").toArray01(),At=pe.properties.get("space-color").toArray01PremultipliedAlpha(),ht=i.identity$1([]);i.rotateY$1(ht,ht,-i.degToRad(Qe._center.lng)),i.rotateX$1(ht,ht,i.degToRad(Qe._center.lat)),i.rotateZ$1(ht,ht,Qe.angle),i.rotateX$1(ht,ht,-Qe._pitch);const Bt=i.fromQuat(new Float32Array(16),ht),Pt=i.mapValue(pe.properties.get("star-intensity"),0,1,0,.25),It=5e-4,Ht=i.mapValue(pe.properties.get("horizon-blend"),0,1,It,.25),hi=i.globeUseCustomAntiAliasing(ee,fe,Qe)&&Ht===It?Qe.worldSize/(2*Math.PI*1.025)-1:Qe.globeRadius,si=ee.frameCounter/1e3%1,qt=i.length(Qe.globeCenterInViewSpace),ji=Math.sqrt(Math.pow(qt,2)-Math.pow(hi,2)),Kt=Math.acos(ji/qt),Bi=((Ri,Ai,Mi,$i,Jt,pi,In,Hn,Mn,$n,ar,On,_n,Dr)=>({u_frustum_tl:Ri,u_frustum_tr:Ai,u_frustum_br:Mi,u_frustum_bl:$i,u_horizon:Jt,u_transition:pi,u_fadeout_range:In,u_color:Hn,u_high_color:Mn,u_space_color:$n,u_star_intensity:ar,u_star_size:5*i.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:On,u_horizon_angle:_n,u_rotation_matrix:Dr}))(Qe.frustumCorners.TL,Qe.frustumCorners.TR,Qe.frustumCorners.BR,Qe.frustumCorners.BL,Qe.frustumCorners.horizon,lt,Ht,Xe,Ye,At,Pt,si,Kt,Bt);ee.prepareDrawProgram(fe,nt);const di=ee.atmosphereBuffer;di&&nt.draw(fe,Se.TRIANGLES,rt,i.StencilMode.disabled,i.ColorMode.alphaBlended,i.CullFaceMode.backCW,Bi,"skybox",di.vertexBuffer,di.indexBuffer,di.segments)}(this,this.style.fog),this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||this.transform.projection.name!=="globe")&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer<b.length;this.currentLayer++){const ee=this.style._layers[b[this.currentLayer]],pe=a._getLayerSourceCache(ee);ee.isSky()&&this.renderLayer(this,pe,ee,pe?H[pe.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<b.length;){const ee=this.style._layers[b[this.currentLayer]],pe=a._getLayerSourceCache(ee);if(ee.isSky()){++this.currentLayer;continue}if(this.terrain&&this.style.isLayerDraped(ee)){if(ee.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer);continue}const fe=pe?(ee.type==="symbol"?W:H)[pe.id]:void 0;this._renderTileClippingMasks(ee,pe,pe?P[pe.id]:void 0),this.renderLayer(this,pe,ee,fe),++this.currentLayer}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let ee=null;i.values(this.style._layers).forEach(pe=>{const fe=a._getLayerSourceCache(pe);fe&&!pe.isHidden(this.transform.zoom)&&(!ee||ee.getSource().maxzoom<fe.getSource().maxzoom)&&(ee=fe)}),ee&&this.options.showTileBoundaries&&mc.debug(this,ee,ee.getVisibleCoordinates())}this.options.showPadding&&function(ee){const pe=ee.transform.padding;fc(ee,ee.transform.height-(pe.top||0),3,ml),fc(ee,pe.bottom||0,3,kh),ua(ee,pe.left||0,3,Oh),ua(ee,ee.transform.width-(pe.right||0),3,lA);const fe=ee.transform.centerPoint;(function(Se,Qe,rt,nt){pn(Se,Qe-1,rt-10,2,20,nt),pn(Se,Qe-10,rt-1,20,2,nt)})(ee,fe.x,ee.transform.height-fe.y,od)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(i.window.performance.now()),this.saveCanvasCopy())}}renderLayer(a,m,b,S){b.isHidden(this.transform.zoom)||(b.type==="background"||b.type==="sky"||b.type==="custom"||S&&S.length)&&(this.id=b.id,this.gpuTimingStart(b),a.transform.projection.unsupportedLayers&&a.transform.projection.unsupportedLayers.includes(b.type)||mc[b.type](a,m,b,S,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(a){if(!this.options.gpuTiming)return;const m=this.context.extTimerQuery;let b=this.gpuTimers[a.id];b||(b=this.gpuTimers[a.id]={calls:0,cpuTime:0,query:m.createQueryEXT()}),b.calls++,m.beginQueryEXT(m.TIME_ELAPSED_EXT,b.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const a=this.context.extTimerQuery,m=a.createQueryEXT();this.deferredRenderGpuTimeQueries.push(m),a.beginQueryEXT(a.TIME_ELAPSED_EXT,m)}}gpuTimingDeferredRenderEnd(){if(!this.options.gpuTimingDeferredRender)return;const a=this.context.extTimerQuery;a.endQueryEXT(a.TIME_ELAPSED_EXT)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const a=this.context.extTimerQuery;a.endQueryEXT(a.TIME_ELAPSED_EXT)}collectGpuTimers(){const a=this.gpuTimers;return this.gpuTimers={},a}collectDeferredRenderGpuQueries(){const a=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],a}queryGpuTimers(a){const m={};for(const b in a){const S=a[b],P=this.context.extTimerQuery,H=P.getQueryObjectEXT(S.query,P.QUERY_RESULT_EXT)/1e6;P.deleteQueryEXT(S.query),m[b]=H}return m}queryGpuTimeDeferredRender(a){if(!this.options.gpuTimingDeferredRender)return 0;const m=this.context.extTimerQuery;let b=0;for(const S of a)b+=m.getQueryObjectEXT(S,m.QUERY_RESULT_EXT)/1e6,m.deleteQueryEXT(S);return b}translatePosMatrix(a,m,b,S,P){if(!b[0]&&!b[1])return a;const H=P?S==="map"?this.transform.angle:0:S==="viewport"?-this.transform.angle:0;if(H){const pe=Math.sin(H),fe=Math.cos(H);b=[b[0]*fe-b[1]*pe,b[0]*pe+b[1]*fe]}const W=[P?b[0]:et(m,b[0],this.transform.zoom),P?b[1]:et(m,b[1],this.transform.zoom),0],ee=new Float32Array(16);return i.translate(ee,a,W),ee}saveTileTexture(a){const m=this._tileTextures[a.size[0]];m?m.push(a):this._tileTextures[a.size[0]]=[a]}getTileTexture(a){const m=this._tileTextures[a];return m&&m.length>0?m.pop():null}isPatternMissing(a){return a===null||a!==void 0&&!this.imageManager.getPattern(a.toString())}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){const a=this.terrain&&this.terrain.renderingToTexture,m=this.terrain&&this.terrain.exaggeration()===0,b=this.style&&this.style.fog,S=[];return this.terrainRenderModeElevated()&&S.push("TERRAIN"),this.transform.projection.name==="globe"&&S.push("GLOBE"),m&&S.push("ZERO_EXAGGERATION"),b&&!a&&b.getOpacity(this.transform.pitch)!==0&&S.push("FOG"),a&&S.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&S.push("OVERDRAW_INSPECTOR"),S}useProgram(a,m,b){this.cache=this.cache||{};const S=b||[],P=this.currentGlobalDefines().concat(S),H=rA.cacheKey(Oc[a],a,P,m);return this.cache[H]||(this.cache[H]=new rA(this.context,a,Oc[a],m,nd[a],P)),this.cache[H]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(a,m,b){if(this.terrain&&this.terrain.renderingToTexture)return;const S=this.style.fog;if(S){const P=S.getOpacity(this.transform.pitch),H=((W,ee,pe,fe,Se,Qe,rt,nt,lt,Xe,Ye)=>{const At=W.transform,ht=ee.properties.get("color").toArray01();ht[3]=fe;const Bt=W.frameCounter/1e3%1;return{u_fog_matrix:pe?At.calculateFogTileMatrix(pe):W.identityMat,u_fog_range:ee.getFovAdjustedRange(At._fov),u_fog_color:ht,u_fog_horizon_blend:ee.properties.get("horizon-blend"),u_fog_temporal_offset:Bt,u_frustum_tl:Se,u_frustum_tr:Qe,u_frustum_br:rt,u_frustum_bl:nt,u_globe_pos:lt,u_globe_radius:Xe,u_viewport:Ye,u_globe_transition:i.globeToMercatorTransition(At.zoom),u_is_globe:+(At.projection.name==="globe")}})(this,S,b,P,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*i.exported.devicePixelRatio,this.transform.height*i.exported.devicePixelRatio]);m.setFogUniformValues(a,H)}}setTileLoadedFlag(a){this.tileLoaded=a}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const a=this.context.gl,m=a.createTexture();return a.bindTexture(a.TEXTURE_2D,m),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,a.drawingBufferWidth,a.drawingBufferHeight,0),m}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const a=this.style&&this.style.fog;return!!a&&a.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const a=this._backgroundTiles,m=this._backgroundTiles={},b=this.transform.coveringTiles({tileSize:512});for(const S of b)m[S.key]=a[S.key]||new i.Tile(S,512,this.transform.tileZoom,this);return m}clearBackgroundTiles(){this._backgroundTiles={}}}class Qh{constructor(a=0,m=0,b=0,S=0){if(isNaN(a)||a<0||isNaN(m)||m<0||isNaN(b)||b<0||isNaN(S)||S<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=m,this.left=b,this.right=S}interpolate(a,m,b){return m.top!=null&&a.top!=null&&(this.top=i.number(a.top,m.top,b)),m.bottom!=null&&a.bottom!=null&&(this.bottom=i.number(a.bottom,m.bottom,b)),m.left!=null&&a.left!=null&&(this.left=i.number(a.left,m.left,b)),m.right!=null&&a.right!=null&&(this.right=i.number(a.right,m.right,b)),this}getCenter(a,m){const b=i.clamp((this.left+a-this.right)/2,0,a),S=i.clamp((this.top+m-this.bottom)/2,0,m);return new i.pointGeometry(b,S)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new Qh(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function gc(x,a){const m=i.getColumn(x,3);i.fromQuat(x,a),i.setColumn(x,3,m)}function hA(x,a){const m=i.identity$1([]);return i.rotateZ$1(m,m,-a),i.rotateX$1(m,m,-x),m}function uA(x,a){const m=[x[0],x[1],0],b=[a[0],a[1],0];if(i.length(m)>=1e-15){const H=i.normalize([],m);i.scale$2(b,H,i.dot(b,H)),a[0]=b[0],a[1]=b[1]}const S=i.cross([],a,x);if(i.len(S)<1e-15)return null;const P=Math.atan2(-S[1],S[0]);return hA(Math.atan2(Math.sqrt(x[0]*x[0]+x[1]*x[1]),-x[2]),P)}class Vh{constructor(a,m){this.position=a,this.orientation=m}get position(){return this._position}set position(a){if(a){const m=a instanceof i.MercatorCoordinate?a:new i.MercatorCoordinate(a[0],a[1],a[2]);this._renderWorldCopies&&(m.x=i.wrap(m.x,0,1)),this._position=m}else this._position=null}lookAtPoint(a,m){if(this.orientation=null,!this.position)return;const b=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(a)):0,S=this.position,P=i.MercatorCoordinate.fromLngLat(a,b),H=[P.x-S.x,P.y-S.y,P.z-S.z];m||(m=[0,0,1]),m[2]=Math.abs(m[2]),this.orientation=uA(H,m)}setPitchBearing(a,m){this.orientation=hA(i.degToRad(a),i.degToRad(-m))}}class Hh{constructor(a,m){this._transform=i.identity([]),this.orientation=m,this.position=a}get mercatorPosition(){const a=this.position;return new i.MercatorCoordinate(a[0],a[1],a[2])}get position(){const a=i.getColumn(this._transform,3);return[a[0],a[1],a[2]]}set position(a){var m;a&&i.setColumn(this._transform,3,[(m=a)[0],m[1],m[2],1])}get orientation(){return this._orientation}set orientation(a){this._orientation=a||i.identity$1([]),a&&gc(this._transform,this._orientation)}getPitchBearing(){const a=this.forward(),m=this.right();return{bearing:Math.atan2(-m[1],m[0]),pitch:Math.atan2(Math.sqrt(a[0]*a[0]+a[1]*a[1]),-a[2])}}setPitchBearing(a,m){this._orientation=hA(a,m),gc(this._transform,this._orientation)}forward(){const a=i.getColumn(this._transform,2);return[-a[0],-a[1],-a[2]]}up(){const a=i.getColumn(this._transform,1);return[-a[0],-a[1],-a[2]]}right(){const a=i.getColumn(this._transform,0);return[a[0],a[1],a[2]]}getCameraToWorld(a,m){const b=new Float64Array(16);return i.invert(b,this.getWorldToCamera(a,m)),b}getWorldToCameraPosition(a,m,b){const S=this.position;i.scale$2(S,S,-a);const P=new Float64Array(16);return i.fromScaling(P,[b,b,b]),i.translate(P,P,S),P[10]*=m,P}getWorldToCamera(a,m){const b=new Float64Array(16),S=new Float64Array(4),P=this.position;return i.conjugate(S,this._orientation),i.scale$2(P,P,-a),i.fromQuat(b,S),i.translate(b,b,P),b[1]*=-1,b[5]*=-1,b[9]*=-1,b[13]*=-1,b[8]*=m,b[9]*=m,b[10]*=m,b[11]*=m,b}getCameraToClipPerspective(a,m,b,S){const P=new Float64Array(16);return i.perspective(P,a,m,b,S),P}getDistanceToElevation(a,m=!1){const b=a===0?0:i.mercatorZfromAltitude(a,m?i.latFromMercatorY(this.position[1]):this.position[1]),S=this.forward();return(b-this.position[2])/S[2]}clone(){return new Hh([...this.position],[...this.orientation])}}function ih(x,a){const m=Is(x.projection,x.zoom,x.width,x.height),b=function(P,H,W,ee,pe){const fe=new i.LngLat(W.lng-180*fo,W.lat),Se=new i.LngLat(W.lng+180*fo,W.lat),Qe=P.project(fe.lng,fe.lat),rt=P.project(Se.lng,Se.lat),nt=-Math.atan2(rt.y-Qe.y,rt.x-Qe.x),lt=i.MercatorCoordinate.fromLngLat(W);lt.y=i.clamp(lt.y,-.999975,.999975);const Xe=lt.toLngLat(),Ye=P.project(Xe.lng,Xe.lat),At=i.MercatorCoordinate.fromLngLat(Xe);At.x+=fo;const ht=At.toLngLat(),Bt=P.project(ht.lng,ht.lat),Pt=jl(Bt.x-Ye.x,Bt.y-Ye.y,nt),It=i.MercatorCoordinate.fromLngLat(Xe);It.y+=fo;const Ht=It.toLngLat(),hi=P.project(Ht.lng,Ht.lat),si=jl(hi.x-Ye.x,hi.y-Ye.y,nt),qt=Math.abs(Pt.x)/Math.abs(si.y),ji=i.identity([]);i.rotateZ(ji,ji,-nt*(1-(pe?0:ee)));const Kt=i.identity([]);return i.scale(Kt,Kt,[1,1-(1-qt)*ee,1]),Kt[4]=-si.x/si.y*ee,i.rotateZ(Kt,Kt,nt),i.multiply(Kt,ji,Kt),Kt}(x.projection,0,x.center,m,a),S=_c(x);return i.scale(b,b,[S,S,1]),b}function _c(x){const a=x.projection,m=Is(x.projection,x.zoom,x.width,x.height),b=Gh(a,x.center),S=Gh(a,i.LngLat.convert(a.center));return Math.pow(2,b*m+(1-m)*S)}function Is(x,a,m,b,S=1/0){const P=x.range;if(!P)return 0;const H=Math.min(S,Math.max(m,b)),W=Math.log(H/1024)/Math.LN2;return i.smoothstep(P[0]+W,P[1]+W,a)}const fo=1/4e4;function Gh(x,a){const m=i.clamp(a.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),b=new i.LngLat(a.lng-180*fo,m),S=new i.LngLat(a.lng+180*fo,m),P=x.project(b.lng,m),H=x.project(S.lng,m),W=i.MercatorCoordinate.fromLngLat(b),ee=i.MercatorCoordinate.fromLngLat(S),pe=H.x-P.x,fe=H.y-P.y,Se=ee.x-W.x,Qe=ee.y-W.y,rt=Math.sqrt((Se*Se+Qe*Qe)/(pe*pe+fe*fe));return Math.log(rt)/Math.LN2}function jl(x,a,m){const b=Math.cos(m),S=Math.sin(m);return{x:x*b-a*S,y:x*S+a*b}}class Kl{constructor(a,m,b,S,P,H,W){this.tileSize=512,this._renderWorldCopies=P===void 0||P,this._minZoom=a||0,this._maxZoom=m||22,this._minPitch=b==null?0:b,this._maxPitch=S==null?60:S,this.setProjection(H),this.setMaxBounds(W),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Qh,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Hh,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const a=new Kl(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return a._elevation=this._elevation,a._centerAltitude=this._centerAltitude,a._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,a.tileSize=this.tileSize,a.mercatorFromTransition=this.mercatorFromTransition,a.width=this.width,a.height=this.height,a.cameraElevationReference=this.cameraElevationReference,a._center=this._center,a._setZoom(this.zoom),a._seaLevelZoom=this._seaLevelZoom,a.angle=this.angle,a._fov=this._fov,a._pitch=this._pitch,a._nearZ=this._nearZ,a._farZ=this._farZ,a._averageElevation=this._averageElevation,a._unmodified=this._unmodified,a._edgeInsets=this._edgeInsets.clone(),a._camera=this._camera.clone(),a._calcMatrices(),a.freezeTileCoverage=this.freezeTileCoverage,a.frustumCorners=this.frustumCorners,a}get elevation(){return this._elevation}set elevation(a){this._elevation!==a&&(this._elevation=a,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(a,m=!1){const b=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||b)&&this._updateCameraOnTerrain(),(a||b)&&this._constrainCamera(m),this._calcMatrices()}getProjection(){return i.pick(this.projection,["name","center","parallels"])}setProjection(a){this.projectionOptions=a||{name:"mercator"};const m=this.projection?this.getProjection():void 0;this.projection=i.getProjection(this.projectionOptions);const b=!C(m,this.getProjection());return b&&this._calcMatrices(),this.mercatorFromTransition=!1,b}setMercatorFromTransition(){const a=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=i.getProjection({name:"mercator"});const m=a!==this.projection.name;return m&&this._calcMatrices(),m}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(a){a===void 0?a=!0:a===null&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get cameraWorldSize(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return i.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.pointGeometry(this.width,this.height)}get bearing(){return i.wrap(this.rotation,-180,180)}set bearing(a){this.rotation=a}get rotation(){return-this.angle/Math.PI*180}set rotation(a){const m=-a*Math.PI/180;var b;this.angle!==m&&(this._unmodified=!1,this.angle=m,this._calcMatrices(),this.rotationMatrix=(b=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(b[1]=0,b[2]=0),b[0]=1,b[3]=1,b),function(S,P,H){var W=P[0],ee=P[1],pe=P[2],fe=P[3],Se=Math.sin(H),Qe=Math.cos(H);S[0]=W*Qe+pe*Se,S[1]=ee*Qe+fe*Se,S[2]=W*-Se+pe*Qe,S[3]=ee*-Se+fe*Qe}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(a){const m=i.clamp(a,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==m&&(this._unmodified=!1,this._pitch=m,this._calcMatrices())}get aspect(){return this.width/this.height}get fovX(){return this._fov}get fovY(){const a=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/a)}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=i.degToRad(a),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(a){this._averageElevation=a,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(a){const m=Math.min(Math.max(a,this.minZoom),this.maxZoom);this._zoom!==m&&(this._unmodified=!1,this._setZoom(m),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(a){this._zoom=a,this.scale=this.zoomScale(a),this.tileZoom=Math.floor(a),this.zoomFraction=a-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const a=this._elevation;this._centerAltitude=a.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=a.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const a=this._elevation,m=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],b=this.horizonLineFromTop();let S=0,P=0;for(let H=0;H<m.length;H++){const W=new i.pointGeometry(m[H][0]*this.width,b+m[H][1]*(this.height-b)),ee=a.pointCoordinate(W);if(!ee)continue;const pe=1/Math.hypot(ee[0]-this._camera.position[0],ee[1]-this._camera.position[1]);S+=ee[3]*pe,P+=pe}return P===0?NaN:S/P}get center(){return this._center}set center(a){a.lat===this._center.lat&&a.lng===this._center.lng||(this._unmodified=!1,this._center=a,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const a=this._seaLevelZoom,m=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),b=this.pixelsPerMeter/this.worldSize*m,S=this._mercatorZfromZoom(a),P=this._mercatorZfromZoom(this._maxZoom),H=Math.max(S-b,P);this._setZoom(this._zoomFromMercatorZ(H))}get padding(){return this._edgeInsets.toJSON()}set padding(a){this._edgeInsets.equals(a)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,a,1),this._calcMatrices())}computeZoomRelativeTo(a){const m=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,a.toAltitude()));let b;b=a.z<this._camera.position[2]?[m.x,m.y,m.z]:[a.x,a.y,a.z];const S=i.length(i.sub([],this._camera.position,b));return i.clamp(this._zoomFromMercatorZ(S),this._minZoom,this._maxZoom)}setFreeCameraOptions(a){if(!this.height||!a.position&&!a.orientation)return;this._updateCameraState();let m=!1;if(a.orientation&&!i.exactEquals(a.orientation,this._camera.orientation)&&(m=this._setCameraOrientation(a.orientation)),a.position){const b=[a.position.x,a.position.y,a.position.z];i.exactEquals$1(b,this._camera.position)||(this._setCameraPosition(b),m=!0)}m&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const a=this._camera.position,m=new Vh;return m.position=new i.MercatorCoordinate(a[0],a[1],a[2]),m.orientation=this._camera.orientation,m._elevation=this.elevation,m._renderWorldCopies=this.renderWorldCopies,m}_setCameraOrientation(a){if(!i.length$1(a))return!1;i.normalize$1(a,a);const m=i.transformQuat([],[0,0,-1],a),b=i.transformQuat([],[0,-1,0],a);if(b[2]<0)return!1;const S=uA(m,b);return!!S&&(this._camera.orientation=S,!0)}_setCameraPosition(a){const m=this.zoomScale(this.minZoom)*this.tileSize,b=this.zoomScale(this.maxZoom)*this.tileSize,S=this.cameraToCenterDistance;a[2]=i.clamp(a[2],S/b,S/m),this._camera.position=a}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(a){return this._edgeInsets.equals(a)}interpolatePadding(a,m,b){this._unmodified=!1,this._edgeInsets.interpolate(a,m,b),this._constrain(),this._calcMatrices()}coveringZoomLevel(a){const m=(a.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/a.tileSize));return Math.max(0,m)}getVisibleUnwrappedCoordinates(a){const m=[new i.UnwrappedTileID(0,a)];if(this.renderWorldCopies){const b=this.pointCoordinate(new i.pointGeometry(0,0)),S=this.pointCoordinate(new i.pointGeometry(this.width,0)),P=this.pointCoordinate(new i.pointGeometry(this.width,this.height)),H=this.pointCoordinate(new i.pointGeometry(0,this.height)),W=Math.floor(Math.min(b.x,S.x,P.x,H.x)),ee=Math.floor(Math.max(b.x,S.x,P.x,H.x)),pe=1;for(let fe=W-pe;fe<=ee+pe;fe++)fe!==0&&m.push(new i.UnwrappedTileID(fe,a))}return m}coveringTiles(a){let m=this.coveringZoomLevel(a);const b=m,S=this.elevation&&!a.isTerrainDEM,P=this.projection.name==="mercator";if(a.minzoom!==void 0&&m<a.minzoom)return[];a.maxzoom!==void 0&&m>a.maxzoom&&(m=a.maxzoom);const H=this.locationCoordinate(this.center),W=this.center.lat,ee=1<<m,pe=[ee*H.x,ee*H.y,0],fe=this.projection.name==="globe",Se=!fe,Qe=i.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m,Se),rt=fe?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),nt=ee*i.mercatorZfromAltitude(1,this.center.lat),lt=this._camera.position[2]/i.mercatorZfromAltitude(1,this.center.lat),Xe=[ee*rt.x,ee*rt.y,lt*(Se?1:nt)],Ye=this.cameraToCenterDistance/a.tileSize*(a.roundZoom?1:.502),At=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?m:0,ht=a.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,Bt=a.isTerrainDEM?-ht:this._elevation?this._elevation.getMinElevationBelowMSL():0,Pt=this.projection.isReprojectedInTileSpace?_c(this):1,It=Ai=>{const $i=new i.MercatorCoordinate(Ai.x+25e-6,Ai.y,Ai.z),Jt=new i.MercatorCoordinate(Ai.x,Ai.y+25e-6,Ai.z),pi=Ai.toLngLat(),In=$i.toLngLat(),Hn=Jt.toLngLat(),Mn=this.locationCoordinate(pi),$n=this.locationCoordinate(In),ar=this.locationCoordinate(Hn),On=Math.hypot($n.x-Mn.x,$n.y-Mn.y),_n=Math.hypot(ar.x-Mn.x,ar.y-Mn.y);return Math.sqrt(On*_n)*Pt/25e-6},Ht=Ai=>{const Mi=ht,$i=Bt;return{aabb:i.tileAABB(this,ee,0,0,0,Ai,$i,Mi,this.projection),zoom:0,x:0,y:0,minZ:$i,maxZ:Mi,wrap:Ai,fullyVisible:!1}},hi=[];let si=[];const qt=m,ji=a.reparseOverscaled?b:m,Kt=Ai=>Ai*Ai,Bi=Kt((lt-this._centerAltitude)*nt),di=Ai=>{if(!this._elevation||!Ai.tileID||!P)return;const Mi=this._elevation.getMinMaxForTile(Ai.tileID),$i=Ai.aabb;Mi?($i.min[2]=Mi.min,$i.max[2]=Mi.max,$i.center[2]=($i.min[2]+$i.max[2])/2):(Ai.shouldSplit=Ri(Ai),Ai.shouldSplit||($i.min[2]=$i.max[2]=$i.center[2]=this._centerAltitude))},Ri=Ai=>{if(Ai.zoom<At)return!0;if(Ai.zoom===qt)return!1;if(Ai.shouldSplit!=null)return Ai.shouldSplit;const Mi=Ai.aabb.distanceX(Xe),$i=Ai.aabb.distanceY(Xe);let Jt=Bi,pi=1;if(fe){Jt=Kt(Ai.aabb.distanceZ(Xe));const Mn=Math.pow(2,Ai.zoom),$n=i.latFromMercatorY((Ai.y+1)/Mn),ar=i.latFromMercatorY(Ai.y/Mn),On=Math.min(Math.max(W,$n),ar),_n=i.circumferenceAtLatitude(On)/i.circumferenceAtLatitude(W);if(pi=On===W?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,_n/this._mercatorScaleRatio),this.zoom<=i.GLOBE_ZOOM_THRESHOLD_MIN&&Ai.zoom===qt-1&&_n>=.9)return!0}else if(S&&(Jt=Kt(Ai.aabb.distanceZ(Xe)*nt)),this.projection.isReprojectedInTileSpace&&b<=5){const Mn=Math.pow(2,Ai.zoom),$n=It(new i.MercatorCoordinate((Ai.x+.5)/Mn,(Ai.y+.5)/Mn));pi=$n>.85?1:$n}const In=Mi*Mi+$i*$i+Jt,Hn=Kt((1<<qt-Ai.zoom)*Ye*pi*((Mn,$n)=>{if($n*Kt(.707)<Mn)return 1;const ar=Math.sqrt($n/Mn);return ar/(1.4144271570014144+(Math.pow(1.1,ar-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(Jt,Bi),In));return In<Hn};if(this.renderWorldCopies)for(let Ai=1;Ai<=3;Ai++)hi.push(Ht(-Ai)),hi.push(Ht(Ai));for(hi.push(Ht(0));hi.length>0;){const Ai=hi.pop(),Mi=Ai.x,$i=Ai.y;let Jt=Ai.fullyVisible;if(!Jt){const pi=Ai.aabb.intersects(Qe);if(pi===0)continue;Jt=pi===2}if(Ai.zoom!==qt&&Ri(Ai))for(let pi=0;pi<4;pi++){const In=(Mi<<1)+pi%2,Hn=($i<<1)+(pi>>1),Mn={aabb:P?Ai.aabb.quadrant(pi):i.tileAABB(this,ee,Ai.zoom+1,In,Hn,Ai.wrap,Ai.minZ,Ai.maxZ,this.projection),zoom:Ai.zoom+1,x:In,y:Hn,wrap:Ai.wrap,fullyVisible:Jt,tileID:void 0,shouldSplit:void 0,minZ:Ai.minZ,maxZ:Ai.maxZ};S&&!fe&&(Mn.tileID=new i.OverscaledTileID(Ai.zoom+1===qt?ji:Ai.zoom+1,Ai.wrap,Ai.zoom+1,In,Hn),di(Mn)),hi.push(Mn)}else{const pi=Ai.zoom===qt?ji:Ai.zoom;if(a.minzoom&&a.minzoom>pi)continue;const In=pe[0]-(.5+Mi+(Ai.wrap<<Ai.zoom))*(1<<m-Ai.zoom),Hn=pe[1]-.5-$i,Mn=Ai.tileID?Ai.tileID:new i.OverscaledTileID(pi,Ai.wrap,Ai.zoom,Mi,$i);si.push({tileID:Mn,distanceSq:In*In+Hn*Hn})}}if(this.fogCullDistSq){const Ai=this.fogCullDistSq,Mi=this.horizonLineFromTop();si=si.filter($i=>{const Jt=[0,0,0,1],pi=[i.EXTENT,i.EXTENT,0,1],In=this.calculateFogTileMatrix($i.tileID.toUnwrapped());i.transformMat4$1(Jt,Jt,In),i.transformMat4$1(pi,pi,In);const Hn=i.getAABBPointSquareDist(Jt,pi);if(Hn===0)return!0;let Mn=!1;const $n=this._elevation;if($n&&Hn>Ai&&Mi!==0){const ar=this.calculateProjMatrix($i.tileID.toUnwrapped());let On;a.isTerrainDEM||(On=$n.getMinMaxForTile($i.tileID)),On||(On={min:Bt,max:ht});const _n=i.furthestTileCorner(this.rotation),Dr=[_n[0]*i.EXTENT,_n[1]*i.EXTENT,On.max];i.transformMat4(Dr,Dr,ar),Mn=(1-Dr[1])*this.height*.5<Mi}return Hn<Ai||Mn})}return si.sort((Ai,Mi)=>Ai.distanceSq-Mi.distanceSq).map(Ai=>Ai.tileID)}resize(a,m){this.width=a,this.height=m,this.pixelsToGLUnits=[2/a,-2/m],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log(a)/Math.LN2}project(a){const m=i.clamp(a.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),b=this.projection.project(a.lng,m);return new i.pointGeometry(b.x*this.worldSize,b.y*this.worldSize)}unproject(a){return this.projection.unproject(a.x/this.worldSize,a.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(a,m){let b,S;const P=this.centerPoint;if(this.projection.name==="globe"){const W=this.worldSize;b=(m.x-P.x)/W,S=(m.y-P.y)/W}else{const W=this.pointCoordinate(m),ee=this.pointCoordinate(P);b=W.x-ee.x,S=W.y-ee.y}const H=this.locationCoordinate(a);this.setLocation(new i.MercatorCoordinate(H.x-b,H.y-S))}setLocation(a){this.center=this.coordinateLocation(a),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(a){return this.projection.locationPoint(this,a)}locationPoint3D(a){return this.projection.locationPoint(this,a,!0)}pointLocation(a){return this.coordinateLocation(this.pointCoordinate(a))}pointLocation3D(a){return this.coordinateLocation(this.pointCoordinate3D(a))}locationCoordinate(a,m){const b=m?i.mercatorZfromAltitude(m,a.lat):void 0,S=this.projection.project(a.lng,a.lat);return new i.MercatorCoordinate(S.x,S.y,b)}coordinateLocation(a){return this.projection.unproject(a.x,a.y)}pointRayIntersection(a,m){const b=m!=null?m:this._centerAltitude,S=[a.x,a.y,0,1],P=[a.x,a.y,1,1];i.transformMat4$1(S,S,this.pixelMatrixInverse),i.transformMat4$1(P,P,this.pixelMatrixInverse);const H=P[3];i.scale$1(S,S,1/S[3]),i.scale$1(P,P,1/H);const W=S[2],ee=P[2];return{p0:S,p1:P,t:W===ee?0:(b-W)/(ee-W)}}screenPointToMercatorRay(a){const m=[a.x,a.y,0,1],b=[a.x,a.y,1,1];return i.transformMat4$1(m,m,this.pixelMatrixInverse),i.transformMat4$1(b,b,this.pixelMatrixInverse),i.scale$1(m,m,1/m[3]),i.scale$1(b,b,1/b[3]),m[2]=i.mercatorZfromAltitude(m[2],this._center.lat)*this.worldSize,b[2]=i.mercatorZfromAltitude(b[2],this._center.lat)*this.worldSize,i.scale$1(m,m,1/this.worldSize),i.scale$1(b,b,1/this.worldSize),new i.Ray([m[0],m[1],m[2]],i.normalize([],i.sub([],b,m)))}rayIntersectionCoordinate(a){const{p0:m,p1:b,t:S}=a,P=i.mercatorZfromAltitude(m[2],this._center.lat),H=i.mercatorZfromAltitude(b[2],this._center.lat);return new i.MercatorCoordinate(i.number(m[0],b[0],S)/this.worldSize,i.number(m[1],b[1],S)/this.worldSize,i.number(P,H,S))}pointCoordinate(a,m=this._centerAltitude){return this.projection.pointCoordinate(this,a.x,a.y,m)}pointCoordinate3D(a){if(!this.elevation)return this.pointCoordinate(a);let m=this.projection.pointCoordinate3D(this,a.x,a.y);if(m)return new i.MercatorCoordinate(m[0],m[1],m[2]);let b=0,S=this.horizonLineFromTop();if(a.y>S)return this.pointCoordinate(a);const P=.02*S,H=a.clone();for(let W=0;W<10&&S-b>P;W++){H.y=i.number(b,S,.66);const ee=this.projection.pointCoordinate3D(this,H.x,H.y);ee?(S=H.y,m=ee):b=H.y}return m?new i.MercatorCoordinate(m[0],m[1],m[2]):this.pointCoordinate(a)}isPointAboveHorizon(a){return this.projection.isPointAboveHorizon(this,a)}_coordinatePoint(a,m){const b=m&&this.elevation?this.elevation.getAtPointOrZero(a,this._centerAltitude):this._centerAltitude,S=[a.x*this.worldSize,a.y*this.worldSize,b+a.toAltitude(),1];return i.transformMat4$1(S,S,this.pixelMatrix),S[3]>0?new i.pointGeometry(S[0]/S[3],S[1]/S[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getGlobeBounds(){const{top:a,left:m}=this._edgeInsets,b=this.height-this._edgeInsets.bottom,S=this.width-this._edgeInsets.right,P=this.pointCoordinate3D(new i.pointGeometry(m,a)),H=this.pointCoordinate3D(new i.pointGeometry(S,a)),W=this.pointCoordinate3D(new i.pointGeometry(S,b)),ee=this.pointCoordinate3D(new i.pointGeometry(m,b));let pe=Math.min(P.x,ee.x),fe=Math.max(H.x,W.x),Se=Math.min(P.y,H.y),Qe=Math.max(ee.y,W.y);const rt=Math.pow(2,-this.zoom)/16,nt=(It,Ht,hi,si)=>{const qt=(It+hi)/2,ji=(Ht+si)/2,Kt=new i.pointGeometry(qt,ji),Bi=this.pointCoordinate3D(Kt),di=Math.max(0,pe-Bi.x,Se-Bi.y,Bi.x-fe,Bi.y-Qe);pe=Math.min(pe,Bi.x),fe=Math.max(fe,Bi.x),Se=Math.min(Se,Bi.y),Qe=Math.max(Qe,Bi.y),di>rt&&(nt(It,Ht,qt,ji),nt(qt,ji,hi,si))};nt(m,a,S,a),nt(S,a,S,b),nt(S,b,m,b),nt(m,b,m,a);const[lt,Xe]=i.polesInViewport(this),Ye=lt||Xe,At=lt?90:i.latFromMercatorY(Se),ht=Ye?180:i.lngFromMercatorX(fe),Bt=Xe?-90:i.latFromMercatorY(Qe),Pt=Ye?-180:i.lngFromMercatorX(pe);return new i.LngLatBounds(new i.LngLat(Pt,Bt),new i.LngLat(ht,At))}_getBounds(a,m){if(this.projection.name==="globe")return this._getGlobeBounds();const b=new i.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),S=new i.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),P=new i.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),H=new i.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let W=this.pointCoordinate(b,a),ee=this.pointCoordinate(S,a);const pe=this.pointCoordinate(P,m),fe=this.pointCoordinate(H,m),Se=(Qe,rt)=>(rt.y-Qe.y)/(rt.x-Qe.x);return W.y>1&&ee.y>=0?W=new i.MercatorCoordinate((1-fe.y)/Se(fe,W)+fe.x,1):W.y<0&&ee.y<=1&&(W=new i.MercatorCoordinate(-fe.y/Se(fe,W)+fe.x,0)),ee.y>1&&W.y>=0?ee=new i.MercatorCoordinate((1-pe.y)/Se(pe,ee)+pe.x,1):ee.y<0&&W.y<=1&&(ee=new i.MercatorCoordinate(-pe.y/Se(pe,ee)+pe.x,0)),new i.LngLatBounds().extend(this.coordinateLocation(W)).extend(this.coordinateLocation(ee)).extend(this.coordinateLocation(fe)).extend(this.coordinateLocation(pe))}_getBounds3D(){const a=this.elevation;if(!a.visibleDemTiles.length||a.isUsingMockSource())return this._getBounds(0,0);const m=a.visibleDemTiles.reduce((b,S)=>{if(S.dem){const P=S.dem.tree;b.min=Math.min(b.min,P.minimums[0]),b.max=Math.max(b.max,P.maximums[0])}return b},{min:Number.MAX_VALUE,max:0});return this._getBounds(m.min*a.exaggeration(),m.max*a.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(a=!0){const m=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,b=this.height/2-m*(1-this._horizonShift);return a?Math.max(0,b):b}getMaxBounds(){return this.maxBounds}setMaxBounds(a){this.maxBounds=a,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,a&&(this.minLat=a.getSouth(),this.maxLat=a.getNorth(),this.minLng=a.getWest(),this.maxLng=a.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=i.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=i.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=i.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=i.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(a,m){return this.projection.createTileMatrix(this,m,a)}calculateDistanceTileData(a){const m=a.key,b=this._distanceTileDataCache;if(b[m])return b[m];const S=a.canonical,P=1/this.height,H=this.cameraWorldSize,W=H/this.zoomScale(S.z),ee=(S.x+Math.pow(2,S.z)*a.wrap)*W,pe=S.y*W,fe=this.point;fe.x*=H/this.worldSize,fe.y*=H/this.worldSize;const Se=this.angle,Qe=Math.sin(-Se),rt=-Math.cos(-Se);return b[m]={bearing:[Qe,rt],center:[(fe.x-ee)*P,(fe.y-pe)*P],scale:W/i.EXTENT*P},b[m]}calculateFogTileMatrix(a){const m=a.key,b=this._fogTileMatrixCache;if(b[m])return b[m];const S=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,a);return i.multiply(S,this.worldToFogMatrix,S),b[m]=new Float32Array(S),b[m]}calculateProjMatrix(a,m=!1){const b=a.key,S=m?this._alignedProjMatrixCache:this._projMatrixCache;if(S[b])return S[b];const P=this.calculatePosMatrix(a,this.worldSize);return i.multiply(P,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:m?this.alignedProjMatrix:this.projMatrix,P),S[b]=new Float32Array(P),S[b]}calculatePixelsToTileUnitsMatrix(a){const m=a.tileID.key,b=this._pixelsToTileUnitsCache;if(b[m])return b[m];const S=function(P,H){const{scale:W}=P.tileTransform,ee=W*i.EXTENT/(P.tileSize*Math.pow(2,H.zoom-P.tileID.overscaledZ+P.tileID.canonical.z));return pe=new Float32Array(4),Qe=(fe=H.inverseAdjustmentMatrix)[1],rt=fe[2],nt=fe[3],Xe=(Se=[ee,ee])[1],pe[0]=fe[0]*(lt=Se[0]),pe[1]=Qe*lt,pe[2]=rt*Xe,pe[3]=nt*Xe,pe;var pe,fe,Se,Qe,rt,nt,lt,Xe}(a,this);return b[m]=S,b[m]}customLayerMatrix(){return this.mercatorMatrix.slice()}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const a=this._elevation;this._updateCameraState();const m=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,b=this._computeCameraPosition(m),S=this._camera.forward(),P=i.mercatorZfromAltitude(1,this._center.lat);b[2]/=P,S[2]/=P,i.normalize(S,S);const H=a.raycast(b,S,a.exaggeration());if(H){const W=i.scaleAndAdd([],b,S,H),ee=new i.MercatorCoordinate(W[0],W[1],i.mercatorZfromAltitude(W[2],i.latFromMercatorY(W[1]))),pe=(ee.z+i.length([ee.x-b[0],ee.y-b[1],ee.z-b[2]*P]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(pe),this._centerAltitude=ee.toAltitude(),this._center=this.coordinateLocation(ee),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(a=!1){if(!this._elevation)return;const m=this._elevation,b=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,S=this._computeCameraPosition(b),P=m.getAtPointOrZero(new i.MercatorCoordinate(...S)),H=this.pixelsPerMeter/this.worldSize*P,W=this._minimumHeightOverTerrain(),ee=S[2]-H;if(ee<=W)if(ee<0||a){const pe=this.locationCoordinate(this._center,this._centerAltitude),fe=[S[0],S[1],pe.z-S[2]],Se=i.length(fe);fe[2]-=(W-ee)/this._pixelsPerMercatorPixel;const Qe=i.length(fe);if(Qe===0)return;i.scale$2(fe,fe,Se/Qe*this._pixelsPerMercatorPixel),this._camera.position=[S[0],S[1],pe.z*this._pixelsPerMercatorPixel-fe[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const a=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||a){const Qe=this.center;return Qe.lat=i.clamp(Qe.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!a)&&(Qe.lng=i.clamp(Qe.lng,this.minLng,this.maxLng)),this.center=Qe,void(this._constraining=!1)}const m=this._unmodified,{x:b,y:S}=this.point;let P=0,H=b,W=S;const ee=this.width/2,pe=this.height/2,fe=this.worldMinY*this.scale,Se=this.worldMaxY*this.scale;if(S-pe<fe&&(W=fe+pe),S+pe>Se&&(W=Se-pe),Se-fe<this.height&&(P=Math.max(P,this.height/(Se-fe)),W=(Se+fe)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const Qe=this.worldMinX*this.scale,rt=this.worldMaxX*this.scale,nt=this.worldSize/2-(Qe+rt)/2;H=(b+nt+this.worldSize)%this.worldSize-nt,H-ee<Qe&&(H=Qe+ee),H+ee>rt&&(H=rt-ee),rt-Qe<this.width&&(P=Math.max(P,this.width/(rt-Qe)),H=(rt+Qe)/2)}H===b&&W===S||(this.center=this.unproject(new i.pointGeometry(H,W))),P&&(this.zoom+=this.scaleZoom(P)),this._constrainCamera(),this._unmodified=m,this._constraining=!1}_minZoomForBounds(){let a=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(a=Math.max(a,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),a}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const a=this.centerOffset,m=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=i.mercatorZfromAltitude(1,this.center.lat)/i.mercatorZfromAltitude(1,i.GLOBE_SCALE_MATCH_LATITUDE));const b=Is(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,b),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const S=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?m:1),P=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);P[8]=2*-a.x/this.width,P[9]=2*a.y/this.height;let H=i.mul([],P,S);if(this.projection.isReprojectedInTileSpace){const Pt=this.locationCoordinate(this.center),It=i.identity([]);i.translate(It,It,[Pt.x*this.worldSize,Pt.y*this.worldSize,0]),i.multiply(It,It,ih(this)),i.translate(It,It,[-Pt.x*this.worldSize,-Pt.y*this.worldSize,0]),i.multiply(H,H,It),this.inverseAdjustmentMatrix=function(Ht){const hi=ih(Ht,!0);return Ke([],[hi[0],hi[1],hi[4],hi[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=i.scale([],H,[this.worldSize,this.worldSize,this.worldSize/m,1]),this.projMatrix=H,this.invProjMatrix=i.invert(new Float64Array(16),this.projMatrix);const W=i.invert([],P);this.frustumCorners=i.FrustumCorners.fromInvProjectionMatrix(W,this.horizonLineFromTop(),this.height);const ee=new Float32Array(16);i.identity(ee),i.scale(ee,ee,[1,-1,1]),i.rotateX(ee,ee,this._pitch),i.rotateZ(ee,ee,this.angle);const pe=i.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),fe=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;pe[8]=2*-a.x/this.width,pe[9]=2*(a.y+fe)/this.height,this.skyboxMatrix=i.multiply(ee,pe,ee);const Se=this.point,Qe=Se.x,rt=Se.y,nt=this.width%2/2,lt=this.height%2/2,Xe=Math.cos(this.angle),Ye=Math.sin(this.angle),At=Qe-Math.round(Qe)+Xe*nt+Ye*lt,ht=rt-Math.round(rt)+Xe*lt+Ye*nt,Bt=new Float64Array(H);if(i.translate(Bt,Bt,[At>.5?At-1:At,ht>.5?ht-1:ht,0]),this.alignedProjMatrix=Bt,H=i.create(),i.scale(H,H,[this.width/2,-this.height/2,1]),i.translate(H,H,[1,-1,0]),this.labelPlaneMatrix=H,H=i.create(),i.scale(H,H,[1,-1,1]),i.translate(H,H,[-1,-1,0]),i.scale(H,H,[2/this.width,2/this.height,1]),this.glCoordMatrix=H,this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},H=i.invert(new Float64Array(16),this.pixelMatrix),!H)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=H,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=i.calculateGlobeMatrix(this);const Pt=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.transformMat4(Pt,Pt,S),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=H;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const a=this.cameraWorldSizeForFog,m=this.cameraPixelsPerMeter,b=this._camera.position,S=1/this.height/this._pixelsPerMercatorPixel,P=[a,a,m];i.scale$2(P,P,S),i.scale$2(b,b,-1),i.multiply$2(b,b,P);const H=i.create();i.translate(H,H,b),i.scale(H,H,P),this.mercatorFogMatrix=H,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(a,m,S)}_computeCameraPosition(a){const m=(a=a||this.pixelsPerMeter)/this.pixelsPerMeter,b=this._camera.forward(),S=this.point,P=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*m-a/this.worldSize*this._centerAltitude;return[S.x/this.worldSize-b[0]*P,S.y/this.worldSize-b[1]*P,a/this.worldSize*this._centerAltitude-b[2]*P]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(a){const m=this._maxCameraBoundsDistance()*Math.cos(this._pitch),b=this._camera.position[2],S=a[2];let P=1;this.projection.wrap&&(this.center=this.center.wrap()),S>0&&(P=Math.min((m-b)/S,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,a,P),this._updateStateFromCamera()}_updateStateFromCamera(){const a=this._camera.position,m=this._camera.forward(),{pitch:b,bearing:S}=this._camera.getPitchBearing(),P=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,H=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),W=Math.max((a[2]-P)/Math.cos(b),H),ee=this._zoomFromMercatorZ(W);i.scaleAndAdd(a,a,m,W),this._pitch=i.clamp(b,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(S,-Math.PI,Math.PI),this._setZoom(i.clamp(ee,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.MercatorCoordinate(a[0],a[1],a[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(a){return Math.pow(2,a)*this.tileSize}_mercatorZfromZoom(a){return this.cameraToCenterDistance/this._worldSizeFromZoom(a)}_minimumHeightOverTerrain(){const a=Math.min((this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(a)}_zoomFromMercatorZ(a){return this.scaleZoom(this.cameraToCenterDistance/(a*this.tileSize))}zoomFromMercatorZAdjusted(a){const m=H=>{const W=this.getCameraToCenterDistance(this.projection,H);return this.scaleZoom(W/(a*this.tileSize))};let b,S=m(this.zoom),P=Math.abs(S-m(S));for(;b!==P;)S=m(S),b=P,P=Math.abs(S-m(S));return S}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(a,m){const b=Math.min(a.x,m.x),S=Math.max(a.x,m.x),P=Math.min(a.y,m.y),H=Math.max(a.y,m.y);if(P<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const W=[new i.pointGeometry(b,P),new i.pointGeometry(S,H),new i.pointGeometry(b,H),new i.pointGeometry(S,P)],ee=this.renderWorldCopies?-3:0,pe=this.renderWorldCopies?4:1;for(const fe of W){const Se=this.pointRayIntersection(fe);if(Se.t<0)return!0;const Qe=this.rayIntersectionCoordinate(Se);if(Qe.x<ee||Qe.y<0||Qe.x>pe||Qe.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}zoomDeltaToMovement(a,m){const b=i.length(i.sub([],this._camera.position,a)),S=this._zoomFromMercatorZ(b)+m;return b-this._mercatorZfromZoom(S)}getCameraPoint(){if(this.projection.name==="globe"){const a=function([m,b,S],P){const H=[m,b,S,1];i.transformMat4$1(H,H,P);const W=H[3]=Math.max(H[3],1e-6);return H[0]/=W,H[1]/=W,H[2]/=W,H}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.pointGeometry(a[0],a[1])}{const a=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,a))}}getCameraToCenterDistance(a,m=this.zoom){const b=Is(a,m,this.width,this.height,1024),S=a.pixelSpaceConversion(this.center.lat,this.worldSize,b);return .5/Math.tan(.5*this._fov)*this.height*S}getWorldToCameraMatrix(){const a=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&i.multiply(a,a,this.globeMatrix),a}}function _l(x,a){let m=!1,b=null;const S=()=>{b=null,m&&(x(),b=setTimeout(S,a),m=!1)};return()=>(m=!0,b||S(),b)}class An{constructor(a){this._hashName=a&&encodeURIComponent(a),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=_l(this._updateHashUnthrottled.bind(this),300)}addTo(a){return this._map=a,i.window.addEventListener("hashchange",this._onHashChange,!1),a.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),i.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const a=this._map;if(!a)return"";const m=vs(a);if(this._hashName){const b=this._hashName;let S=!1;const P=i.window.location.hash.slice(1).split("&").map(H=>{const W=H.split("=")[0];return W===b?(S=!0,`${W}=${m}`):H}).filter(H=>H);return S||P.push(`${b}=${m}`),`#${P.join("&")}`}return`#${m}`}_getCurrentHash(){const a=i.window.location.hash.replace("#","");if(this._hashName){let m;return a.split("&").map(b=>b.split("=")).forEach(b=>{b[0]===this._hashName&&(m=b)}),(m&&m[1]||"").split("/")}return a.split("/")}_onHashChange(){const a=this._map;if(!a)return!1;const m=this._getCurrentHash();if(m.length>=3&&!m.some(b=>isNaN(b))){const b=a.dragRotate.isEnabled()&&a.touchZoomRotate.isEnabled()?+(m[3]||0):a.getBearing();return a.jumpTo({center:[+m[2],+m[1]],zoom:+m[0],bearing:b,pitch:+(m[4]||0)}),!0}return!1}_updateHashUnthrottled(){const a=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,a)}}function vs(x,a){const m=x.getCenter(),b=Math.round(100*x.getZoom())/100,S=Math.ceil((b*Math.LN2+Math.log(512/360/.5))/Math.LN10),P=Math.pow(10,S),H=Math.round(m.lng*P)/P,W=Math.round(m.lat*P)/P,ee=x.getBearing(),pe=x.getPitch();let fe=a?`/${H}/${W}/${b}`:`${b}/${W}/${H}`;return(ee||pe)&&(fe+="/"+Math.round(10*ee)/10),pe&&(fe+=`/${Math.round(pe)}`),fe}const Zr={linearity:.3,easing:i.bezier(0,0,.3,1)},nh=i.extend({deceleration:2500,maxSpeed:1400},Zr),Wh=i.extend({deceleration:20,maxSpeed:1400},Zr),yc=i.extend({deceleration:1e3,maxSpeed:360},Zr),AA=i.extend({deceleration:1e3,maxSpeed:90},Zr);class jh{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(a){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:a})}_drainInertiaBuffer(){const a=this._inertiaBuffer,m=i.exported.now();for(;a.length>0&&m-a[0].time>160;)a.shift()}_onMoveEnd(a){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const m={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:P}of this._inertiaBuffer)m.zoom+=P.zoomDelta||0,m.bearing+=P.bearingDelta||0,m.pitch+=P.pitchDelta||0,P.panDelta&&m.pan._add(P.panDelta),P.around&&(m.around=P.around),P.pinchAround&&(m.pinchAround=P.pinchAround);const b=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,S={};if(m.pan.mag()){const P=uo(m.pan.mag(),b,i.extend({},nh,a||{}));S.offset=m.pan.mult(P.amount/m.pan.mag()),S.center=this._map.transform.center,rh(S,P)}if(m.zoom){const P=uo(m.zoom,b,Wh);S.zoom=this._map.transform.zoom+P.amount,rh(S,P)}if(m.bearing){const P=uo(m.bearing,b,yc);S.bearing=this._map.transform.bearing+i.clamp(P.amount,-179,179),rh(S,P)}if(m.pitch){const P=uo(m.pitch,b,AA);S.pitch=this._map.transform.pitch+P.amount,rh(S,P)}if(S.zoom||S.bearing){const P=m.pinchAround===void 0?m.around:m.pinchAround;S.around=P?this._map.unproject(P):this._map.getCenter()}return this.clear(),S.noMoveStart=!0,S}}function rh(x,a){(!x.duration||x.duration<a.duration)&&(x.duration=a.duration,x.easing=a.easing)}function uo(x,a,m){const{maxSpeed:b,linearity:S,deceleration:P}=m,H=i.clamp(x*S/(a/1e3),-b,b),W=Math.abs(H)/(P*S);return{easing:m.easing,duration:1e3*W,amount:H*(W/2)}}class Js extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,m,b,S={}){const P=me(m.getCanvasContainer(),b),H=m.unproject(P);super(a,i.extend({point:P,lngLat:H,originalEvent:b},S)),this._defaultPrevented=!1,this.target=m}}class Fn extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,m,b){const S=a==="touchend"?b.changedTouches:b.touches,P=Pe(m.getCanvasContainer(),S),H=P.map(ee=>m.unproject(ee)),W=P.reduce((ee,pe,fe,Se)=>ee.add(pe.div(Se.length)),new i.pointGeometry(0,0));super(a,{points:P,point:W,lngLats:H,lngLat:m.unproject(W),originalEvent:b}),this._defaultPrevented=!1}}class Vn extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,m,b){super(a,{originalEvent:b}),this._defaultPrevented=!1}}class sh{constructor(a,m){this._map=a,this._clickTolerance=m.clickTolerance}reset(){this._mousedownPos=void 0}wheel(a){return this._firePreventable(new Vn(a.type,this._map,a))}mousedown(a,m){return this._mousedownPos=m,this._firePreventable(new Js(a.type,this._map,a))}mouseup(a){this._map.fire(new Js(a.type,this._map,a))}preclick(a){const m=i.extend({},a);m.type="preclick",this._map.fire(new Js(m.type,this._map,m))}click(a,m){this._mousedownPos&&this._mousedownPos.dist(m)>=this._clickTolerance||(this.preclick(a),this._map.fire(new Js(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new Js(a.type,this._map,a))}mouseover(a){this._map.fire(new Js(a.type,this._map,a))}mouseout(a){this._map.fire(new Js(a.type,this._map,a))}touchstart(a){return this._firePreventable(new Fn(a.type,this._map,a))}touchmove(a){this._map.fire(new Fn(a.type,this._map,a))}touchend(a){this._map.fire(new Fn(a.type,this._map,a))}touchcancel(a){this._map.fire(new Fn(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class dA{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(a){this._map.fire(new Js(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Js("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new Js(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yl{constructor(a,m){this._map=a,this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=m.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,m){this.isEnabled()&&a.shiftKey&&a.button===0&&(ae(),this._startPos=this._lastPos=m,this._active=!0)}mousemoveWindow(a,m){if(!this._active)return;const b=m,S=this._startPos,P=this._lastPos;if(!S||!P||P.equals(b)||!this._box&&b.dist(S)<this._clickTolerance)return;this._lastPos=b,this._box||(this._box=R("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",a));const H=Math.min(S.x,b.x),W=Math.max(S.x,b.x),ee=Math.min(S.y,b.y),pe=Math.max(S.y,b.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${H}px,${ee}px)`,this._box.style.width=W-H+"px",this._box.style.height=pe-ee+"px")})}mouseupWindow(a,m){if(!this._active)return;const b=this._startPos,S=m;if(b&&a.button===0){if(this.reset(),we(),b.x!==S.x||b.y!==S.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:a})),{cameraAnimation:P=>P.fitScreenCoordinates(b,S,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",a)}}keydown(a){this._active&&a.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",a))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),le(),delete this._startPos,delete this._lastPos}_fireEvent(a,m){return this._map.fire(new i.Event(a,{originalEvent:m}))}}function Es(x,a){const m={};for(let b=0;b<x.length;b++)m[x[b].identifier]=a[b];return m}class Wa{constructor(a){this.reset(),this.numTouches=a.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(a,m,b){(this.centroid||b.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=a.timeStamp),b.length===this.numTouches&&(this.centroid=function(S){const P=new i.pointGeometry(0,0);for(const H of S)P._add(H);return P.div(S.length)}(m),this.touches=Es(b,m)))}touchmove(a,m,b){if(this.aborted||!this.centroid)return;const S=Es(b,m);for(const P in this.touches){const H=this.touches[P],W=S[P];(!W||W.dist(H)>30)&&(this.aborted=!0)}}touchend(a,m,b){if((!this.centroid||a.timeStamp-this.startTime>500)&&(this.aborted=!0),b.length===0){const S=!this.aborted&&this.centroid;if(this.reset(),S)return S}}}class Go{constructor(a){this.singleTap=new Wa(a),this.numTaps=a.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(a,m,b){this.singleTap.touchstart(a,m,b)}touchmove(a,m,b){this.singleTap.touchmove(a,m,b)}touchend(a,m,b){const S=this.singleTap.touchend(a,m,b);if(S){const P=a.timeStamp-this.lastTime<500,H=!this.lastTap||this.lastTap.dist(S)<30;if(P&&H||this.reset(),this.count++,this.lastTime=a.timeStamp,this.lastTap=S,this.count===this.numTaps)return this.reset(),S}}}class pA{constructor(){this._zoomIn=new Go({numTouches:1,numTaps:2}),this._zoomOut=new Go({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,m,b){this._zoomIn.touchstart(a,m,b),this._zoomOut.touchstart(a,m,b)}touchmove(a,m,b){this._zoomIn.touchmove(a,m,b),this._zoomOut.touchmove(a,m,b)}touchend(a,m,b){const S=this._zoomIn.touchend(a,m,b),P=this._zoomOut.touchend(a,m,b);return S?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:H=>H.easeTo({duration:300,zoom:H.getZoom()+1,around:H.unproject(S)},{originalEvent:a})}):P?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:H=>H.easeTo({duration:300,zoom:H.getZoom()-1,around:H.unproject(P)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const va={0:1,2:2};class us{constructor(a){this.reset(),this._clickTolerance=a.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(a,m){return!1}_move(a,m){return{}}mousedown(a,m){if(this._lastPoint)return;const b=it(a);this._correctButton(a,b)&&(this._lastPoint=m,this._eventButton=b)}mousemoveWindow(a,m){const b=this._lastPoint;if(b){if(a.preventDefault(),this._eventButton!=null&&function(S,P){const H=va[P];return S.buttons===void 0||(S.buttons&H)!==H}(a,this._eventButton))this.reset();else if(this._moved||!(m.dist(b)<this._clickTolerance))return this._moved=!0,this._lastPoint=m,this._move(b,m)}}mouseupWindow(a){this._lastPoint&&it(a)===this._eventButton&&(this._moved&&we(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fs extends us{mousedown(a,m){super.mousedown(a,m),this._lastPoint&&(this._active=!0)}_correctButton(a,m){return m===0&&!a.ctrlKey}_move(a,m){return{around:m,panDelta:m.sub(a)}}}class Kh extends us{_correctButton(a,m){return m===0&&a.ctrlKey||m===2}_move(a,m){const b=.8*(m.x-a.x);if(b)return this._active=!0,{bearingDelta:b}}contextmenu(a){a.preventDefault()}}class xl extends us{_correctButton(a,m){return m===0&&a.ctrlKey||m===2}_move(a,m){const b=-.5*(m.y-a.y);if(b)return this._active=!0,{pitchDelta:b}}contextmenu(a){a.preventDefault()}}class M{constructor(a,m){this._map=a,this._el=a.getCanvasContainer(),this._minTouches=1,this._clickTolerance=m.clickTolerance||1,this.reset(),i.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new i.pointGeometry(0,0)}touchstart(a,m,b){return this._calculateTransform(a,m,b)}touchmove(a,m,b){if(this._active&&!(b.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(b.length===1&&!i.isFullscreen())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return a.cancelable&&a.preventDefault(),this._calculateTransform(a,m,b)}}touchend(a,m,b){this._calculateTransform(a,m,b),this._active&&b.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(a,m,b){b.length>0&&(this._active=!0);const S=Es(b,m),P=new i.pointGeometry(0,0),H=new i.pointGeometry(0,0);let W=0;for(const pe in S){const fe=S[pe],Se=this._touches[pe];Se&&(P._add(fe),H._add(fe.sub(Se)),W++,S[pe]=fe)}if(this._touches=S,W<this._minTouches||!H.mag())return;const ee=H.div(W);return this._sum._add(ee),this._sum.mag()<this._clickTolerance?void 0:{around:P.div(W),panDelta:ee}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=R("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")},500)}}class h{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(a){}_move(a,m,b){return{}}touchstart(a,m,b){this._firstTwoTouches||b.length<2||(this._firstTwoTouches=[b[0].identifier,b[1].identifier],this._start([m[0],m[1]]))}touchmove(a,m,b){const S=this._firstTwoTouches;if(!S)return;a.preventDefault();const[P,H]=S,W=_(b,m,P),ee=_(b,m,H);if(!W||!ee)return;const pe=this._aroundCenter?null:W.add(ee).div(2);return this._move([W,ee],pe,a)}touchend(a,m,b){if(!this._firstTwoTouches)return;const[S,P]=this._firstTwoTouches,H=_(b,m,S),W=_(b,m,P);H&&W||(this._active&&we(),this.reset())}touchcancel(){this.reset()}enable(a){this._enabled=!0,this._aroundCenter=!!a&&a.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function _(x,a,m){for(let b=0;b<x.length;b++)if(x[b].identifier===m)return a[b]}function T(x,a){return Math.log(x/a)/Math.LN2}class F extends h{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(a){this._startDistance=this._distance=a[0].dist(a[1])}_move(a,m){const b=this._distance;if(this._distance=a[0].dist(a[1]),this._active||!(Math.abs(T(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:T(this._distance,b),pinchAround:m}}}function O(x,a){return 180*x.angleWith(a)/Math.PI}class K extends h{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(a){this._startVector=this._vector=a[0].sub(a[1]),this._minDiameter=a[0].dist(a[1])}_move(a,m){const b=this._vector;if(this._vector=a[0].sub(a[1]),b&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:O(this._vector,b),pinchAround:m}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const m=25/(Math.PI*this._minDiameter)*360,b=this._startVector;if(!b)return!1;const S=O(a,b);return Math.abs(S)<m}}function oe(x){return Math.abs(x.y)>Math.abs(x.x)}class ue extends h{constructor(a){super(),this._map=a}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(a){this._lastPoints=a,oe(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,m,b){const S=this._lastPoints;if(!S)return;const P=a[0].sub(S[0]),H=a[1].sub(S[1]);return this._map._cooperativeGestures&&!i.isFullscreen()&&b.touches.length<3||(this._valid=this.gestureBeginsVertically(P,H,b.timeStamp),!this._valid)?void 0:(this._lastPoints=a,this._active=!0,{pitchDelta:(P.y+H.y)/2*-.5})}gestureBeginsVertically(a,m,b){if(this._valid!==void 0)return this._valid;const S=a.mag()>=2,P=m.mag()>=2;if(!S&&!P)return;if(!S||!P)return this._firstMove==null&&(this._firstMove=b),b-this._firstMove<100&&void 0;const H=a.y>0==m.y>0;return oe(a)&&oe(m)&&H}}const ve={panStep:100,bearingStep:15,pitchStep:10};class Te{constructor(){const a=ve;this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let m=0,b=0,S=0,P=0,H=0;switch(a.keyCode){case 61:case 107:case 171:case 187:m=1;break;case 189:case 109:case 173:m=-1;break;case 37:a.shiftKey?b=-1:(a.preventDefault(),P=-1);break;case 39:a.shiftKey?b=1:(a.preventDefault(),P=1);break;case 38:a.shiftKey?S=1:(a.preventDefault(),H=-1);break;case 40:a.shiftKey?S=-1:(a.preventDefault(),H=1);break;default:return}return this._rotationDisabled&&(b=0,S=0),{cameraAnimation:W=>{const ee=W.getZoom();W.easeTo({duration:300,easeId:"keyboardHandler",easing:ke,zoom:m?Math.round(ee)+m*(a.shiftKey?2:1):ee,bearing:W.getBearing()+b*this._bearingStep,pitch:W.getPitch()+S*this._pitchStep,offset:[-P*this._panStep,-H*this._panStep],center:W.getCenter()},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ke(x){return x*(2-x)}const We=4.000244140625;class bt{constructor(a,m){this._map=a,this._el=a.getCanvasContainer(),this._handler=m,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&a.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(a){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(a.ctrlKey||a.metaKey||this.isZooming()||i.isFullscreen()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let m=a.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*a.deltaY:a.deltaY;const b=i.exported.now(),S=b-(this._lastWheelEventTime||0);this._lastWheelEventTime=b,m!==0&&m%We==0?this._type="wheel":m!==0&&Math.abs(m)<4?this._type="trackpad":S>400?(this._type=null,this._lastValue=m,this._timeout=setTimeout(this._onTimeout,40,a)):this._type||(this._type=Math.abs(S*m)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,m+=this._lastValue)),a.shiftKey&&m&&(m/=4),this._type&&(this._lastWheelEvent=a,this._delta-=m,this._active||this._start(a)),a.preventDefault()}_onTimeout(a){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)}_start(a){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const m=me(this._el,a);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:m,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const a=this._map.transform;this._type==="wheel"&&a.projection.wrap&&(a._center.lng>=180||a._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const m=()=>a._terrainEnabled()&&this._aroundCoord?a.computeZoomRelativeTo(this._aroundCoord):a.zoom;if(this._delta!==0){const ee=this._type==="wheel"&&Math.abs(this._delta)>We?this._wheelZoomRate:this._defaultZoomRate;let pe=2/(1+Math.exp(-Math.abs(this._delta*ee)));this._delta<0&&pe!==0&&(pe=1/pe);const fe=m(),Se=Math.pow(2,fe),Qe=typeof this._targetZoom=="number"?a.zoomScale(this._targetZoom):Se;this._targetZoom=Math.min(a.maxZoom,Math.max(a.minZoom,a.scaleZoom(Qe*pe))),this._type==="wheel"&&(this._startZoom=fe,this._easing=this._smoothOutEasing(200)),this._delta=0}const b=typeof this._targetZoom=="number"?this._targetZoom:m(),S=this._startZoom,P=this._easing;let H,W=!1;if(this._type==="wheel"&&S&&P){const ee=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),pe=P(ee);H=i.number(S,b,pe),ee<1?this._frameId||(this._frameId=!0):W=!0}else H=b,W=!0;return this._active=!0,W&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!W,zoomDelta:H-m(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(a){let m=i.ease;if(this._prevEase){const b=this._prevEase,S=(i.exported.now()-b.start)/b.duration,P=b.easing(S+.01)-b.easing(S),H=.27/Math.sqrt(P*P+1e-4)*.01,W=Math.sqrt(.0729-H*H);m=i.bezier(H,W,.25,1)}return this._prevEase={start:i.exported.now(),duration:a,easing:m},m}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=R("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")},200)}}class mt{constructor(a,m){this._clickZoom=a,this._tapZoom=m}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class gt{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(a,m){return a.preventDefault(),{cameraAnimation:b=>{b.easeTo({duration:300,zoom:b.getZoom()+(a.shiftKey?-1:1),around:b.unproject(m)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vt{constructor(){this._tap=new Go({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(a,m,b){this._swipePoint||(this._tapTime&&a.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?b.length>0&&(this._swipePoint=m[0],this._swipeTouch=b[0].identifier):this._tap.touchstart(a,m,b))}touchmove(a,m,b){if(this._tapTime){if(this._swipePoint){if(b[0].identifier!==this._swipeTouch)return;const S=m[0],P=S.y-this._swipePoint.y;return this._swipePoint=S,a.preventDefault(),this._active=!0,{zoomDelta:P/128}}}else this._tap.touchmove(a,m,b)}touchend(a,m,b){this._tapTime?this._swipePoint&&b.length===0&&this.reset():this._tap.touchend(a,m,b)&&(this._tapTime=a.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zt{constructor(a,m,b){this._el=a,this._mousePan=m,this._touchPan=b}enable(a){this._inertiaOptions=a||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ni{constructor(a,m,b){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=m,this._mousePitch=b}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class St{constructor(a,m,b,S){this._el=a,this._touchZoom=m,this._touchRotate=b,this._tapDragZoom=S,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const zt=x=>x.zoom||x.drag||x.pitch||x.rotate;class li extends i.Event{}class Ei{constructor(){this.constants=[1,1,.01],this.radius=0}setup(a,m){const b=i.sub([],m,a);this.radius=i.length(b[2]<0?i.div([],b,this.constants):[b[0],b[1],0])}projectRay(a){i.div(a,a,this.constants),i.normalize(a,a),i.mul$1(a,a,this.constants);const m=i.scale$2([],a,this.radius);if(m[2]>0){const b=i.scale$2([],[0,0,1],i.dot(m,[0,0,1])),S=i.scale$2([],i.normalize([],[m[0],m[1],0]),this.radius),P=i.add([],m,i.scale$2([],i.sub([],i.add([],S,b),m),2));m[0]=P[0],m[1]=P[1]}return m}}function bi(x){return x.panDelta&&x.panDelta.mag()||x.zoomDelta||x.bearingDelta||x.pitchDelta}class Hi{constructor(a,m){this._map=a,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new jh(a),this._bearingSnap=m.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Ei,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(m),i.bindAll(["handleEvent","handleWindowEvent"],this);const b=this._el;this._listeners=[[b,"touchstart",{passive:!0}],[b,"touchmove",{passive:!1}],[b,"touchend",void 0],[b,"touchcancel",void 0],[b,"mousedown",void 0],[b,"mousemove",void 0],[b,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[b,"mouseover",void 0],[b,"mouseout",void 0],[b,"dblclick",void 0],[b,"click",void 0],[b,"keydown",{capture:!1}],[b,"keyup",void 0],[b,"wheel",{passive:!1}],[b,"contextmenu",void 0],[i.window,"blur",void 0]];for(const[S,P,H]of this._listeners)S.addEventListener(P,S===i.window.document?this.handleWindowEvent:this.handleEvent,H)}destroy(){for(const[a,m,b]of this._listeners)a.removeEventListener(m,a===i.window.document?this.handleWindowEvent:this.handleEvent,b)}_addDefaultHandlers(a){const m=this._map,b=m.getCanvasContainer();this._add("mapEvent",new sh(m,a));const S=m.boxZoom=new yl(m,a);this._add("boxZoom",S);const P=new pA,H=new gt;m.doubleClickZoom=new mt(H,P),this._add("tapZoom",P),this._add("clickZoom",H);const W=new Vt;this._add("tapDragZoom",W);const ee=m.touchPitch=new ue(m);this._add("touchPitch",ee);const pe=new Kh(a),fe=new xl(a);m.dragRotate=new ni(a,pe,fe),this._add("mouseRotate",pe,["mousePitch"]),this._add("mousePitch",fe,["mouseRotate"]);const Se=new Fs(a),Qe=new M(m,a);m.dragPan=new Zt(b,Se,Qe),this._add("mousePan",Se),this._add("touchPan",Qe,["touchZoom","touchRotate"]);const rt=new K,nt=new F;m.touchZoomRotate=new St(b,nt,rt,W),this._add("touchRotate",rt,["touchPan","touchZoom"]),this._add("touchZoom",nt,["touchPan","touchRotate"]),this._add("blockableMapEvent",new dA(m));const lt=m.scrollZoom=new bt(m,this);this._add("scrollZoom",lt,["mousePan"]);const Xe=m.keyboard=new Te;this._add("keyboard",Xe);for(const Ye of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])a.interactive&&a[Ye]&&m[Ye].enable(a[Ye])}_add(a,m,b){this._handlers.push({handlerName:a,handler:m,allowed:b}),this._handlersById[a]=m}stop(a){if(!this._updatingCamera){for(const{handler:m}of this._handlers)m.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!zt(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(a,m,b){for(const S in a)if(S!==b&&(!m||m.indexOf(S)<0))return!0;return!1}handleWindowEvent(a){this.handleEvent(a,`${a.type}Window`)}_getMapTouches(a){const m=[];for(const b of a)this._el.contains(b.target)&&m.push(b);return m}handleEvent(a,m){this._updatingCamera=!0;const b=a.type==="renderFrame",S=b?void 0:a,P={needsRenderFrame:!1},H={},W={},ee=a.touches?this._getMapTouches(a.touches):void 0,pe=ee?Pe(this._el,ee):b?void 0:me(this._el,a);for(const{handlerName:Qe,handler:rt,allowed:nt}of this._handlers){if(!rt.isEnabled())continue;let lt;this._blockedByActive(W,nt,Qe)?rt.reset():rt[m||a.type]&&(lt=rt[m||a.type](a,pe,ee),this.mergeHandlerResult(P,H,lt,Qe,S),lt&<.needsRenderFrame&&this._triggerRenderFrame()),(lt||rt.isActive())&&(W[Qe]=rt)}const fe={};for(const Qe in this._previousActiveHandlers)W[Qe]||(fe[Qe]=S);this._previousActiveHandlers=W,(Object.keys(fe).length||bi(P))&&(this._changes.push([P,H,fe]),this._triggerRenderFrame()),(Object.keys(W).length||bi(P))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:Se}=P;Se&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Se(this._map))}mergeHandlerResult(a,m,b,S,P){if(!b)return;i.extend(a,b);const H={handlerName:S,originalEvent:b.originalEvent||P};b.zoomDelta!==void 0&&(m.zoom=H),b.panDelta!==void 0&&(m.drag=H),b.pitchDelta!==void 0&&(m.pitch=H),b.bearingDelta!==void 0&&(m.rotate=H)}_applyChanges(){const a={},m={},b={};for(const[S,P,H]of this._changes)S.panDelta&&(a.panDelta=(a.panDelta||new i.pointGeometry(0,0))._add(S.panDelta)),S.zoomDelta&&(a.zoomDelta=(a.zoomDelta||0)+S.zoomDelta),S.bearingDelta&&(a.bearingDelta=(a.bearingDelta||0)+S.bearingDelta),S.pitchDelta&&(a.pitchDelta=(a.pitchDelta||0)+S.pitchDelta),S.around!==void 0&&(a.around=S.around),S.aroundCoord!==void 0&&(a.aroundCoord=S.aroundCoord),S.pinchAround!==void 0&&(a.pinchAround=S.pinchAround),S.noInertia&&(a.noInertia=S.noInertia),i.extend(m,P),i.extend(b,H);this._updateMapTransform(a,m,b),this._changes=[]}_updateMapTransform(a,m,b){const S=this._map,P=S.transform,H=At=>[At.x,At.y,At.z];if((At=>{const ht=this._eventsInProgress.drag;return ht&&!this._handlersById[ht.handlerName].isActive()})()&&!bi(a)){const At=P.zoom;P.cameraElevationReference="sea",P.recenterOnTerrain(),P.cameraElevationReference="ground",At!==P.zoom&&this._map._update(!0)}if(P._isCameraConstrained&&S._stop(!0),!bi(a))return void this._fireEvents(m,b,!0);let{panDelta:W,zoomDelta:ee,bearingDelta:pe,pitchDelta:fe,around:Se,aroundCoord:Qe,pinchAround:rt}=a;P._isCameraConstrained&&(ee>0&&(ee=0),P._isCameraConstrained=!1),rt!==void 0&&(Se=rt),(At=>m.drag&&!this._eventsInProgress.drag)()&&Se&&(this._dragOrigin=H(P.pointCoordinate3D(Se)),this._trackingEllipsoid.setup(P._camera.position,this._dragOrigin)),P.cameraElevationReference="sea",S._stop(!0),Se=Se||S.transform.centerPoint,pe&&(P.bearing+=pe),fe&&(P.pitch+=fe),P._updateCameraState();const nt=[0,0,0];if(W)if(P.projection.name==="mercator"){const At=this._trackingEllipsoid.projectRay(P.screenPointToMercatorRay(Se).dir),ht=this._trackingEllipsoid.projectRay(P.screenPointToMercatorRay(Se.sub(W)).dir);nt[0]=ht[0]-At[0],nt[1]=ht[1]-At[1]}else{const At=P.pointCoordinate(Se);if(P.projection.name==="globe"){W=W.rotate(-P.angle);const ht=P._pixelsPerMercatorPixel/P.worldSize;nt[0]=-W.x*i.mercatorScale(i.latFromMercatorY(At.y))*ht,nt[1]=-W.y*i.mercatorScale(P.center.lat)*ht}else{const ht=P.pointCoordinate(Se.sub(W));At&&ht&&(nt[0]=ht.x-At.x,nt[1]=ht.y-At.y)}}const lt=P.zoom,Xe=[0,0,0];if(ee){const At=H(Qe||P.pointCoordinate3D(Se)),ht={dir:i.normalize([],i.sub([],At,P._camera.position))};if(ht.dir[2]<0){const Bt=P.zoomDeltaToMovement(At,ee);i.scale$2(Xe,ht.dir,Bt)}}const Ye=i.add(nt,nt,Xe);P._translateCameraConstrained(Ye),ee&&Math.abs(P.zoom-lt)>1e-4&&P.recenterOnTerrain(),P.cameraElevationReference="ground",this._map._update(),a.noInertia||this._inertia.record(a),this._fireEvents(m,b,!0)}_fireEvents(a,m,b){const S=zt(this._eventsInProgress),P=zt(a),H={};for(const fe in a){const{originalEvent:Se}=a[fe];this._eventsInProgress[fe]||(H[`${fe}start`]=Se),this._eventsInProgress[fe]=a[fe]}!S&&P&&this._fireEvent("movestart",P.originalEvent);for(const fe in H)this._fireEvent(fe,H[fe]);P&&this._fireEvent("move",P.originalEvent);for(const fe in a){const{originalEvent:Se}=a[fe];this._fireEvent(fe,Se)}const W={};let ee;for(const fe in this._eventsInProgress){const{handlerName:Se,originalEvent:Qe}=this._eventsInProgress[fe];this._handlersById[Se].isActive()||(delete this._eventsInProgress[fe],ee=m[Se]||Qe,W[`${fe}end`]=ee)}for(const fe in W)this._fireEvent(fe,W[fe]);const pe=zt(this._eventsInProgress);if(b&&(S||P)&&!pe){this._updatingCamera=!0;const fe=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),Se=Qe=>Qe!==0&&-this._bearingSnap<Qe&&Qe<this._bearingSnap;fe?(Se(fe.bearing||this._map.getBearing())&&(fe.bearing=0),this._map.easeTo(fe,{originalEvent:ee})):(this._map.fire(new i.Event("moveend",{originalEvent:ee})),Se(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(a,m){this._map.fire(new i.Event(a,m?{originalEvent:m}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(a=>{this._frameId=void 0,this.handleEvent(new li("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const xi="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class xn extends i.Evented{constructor(a,m){super(),this._moving=!1,this._zooming=!1,this.transform=a,this._bearingSnap=m.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(a,m){return this.jumpTo({center:a},m)}panBy(a,m,b){return a=i.pointGeometry.convert(a).mult(-1),this.panTo(this.transform.center,i.extend({offset:a},m),b)}panTo(a,m,b){return this.easeTo(i.extend({center:a},m),b)}getZoom(){return this.transform.zoom}setZoom(a,m){return this.jumpTo({zoom:a},m),this}zoomTo(a,m,b){return this.easeTo(i.extend({zoom:a},m),b)}zoomIn(a,m){return this.zoomTo(this.getZoom()+1,a,m),this}zoomOut(a,m){return this.zoomTo(this.getZoom()-1,a,m),this}getBearing(){return this.transform.bearing}setBearing(a,m){return this.jumpTo({bearing:a},m),this}getPadding(){return this.transform.padding}setPadding(a,m){return this.jumpTo({padding:a},m),this}rotateTo(a,m,b){return this.easeTo(i.extend({bearing:a},m),b)}resetNorth(a,m){return this.rotateTo(0,i.extend({duration:1e3},a),m),this}resetNorthPitch(a,m){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},a),m),this}snapToNorth(a,m){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(a,m):this}getPitch(){return this.transform.pitch}setPitch(a,m){return this.jumpTo({pitch:a},m),this}cameraForBounds(a,m){a=i.LngLatBounds.convert(a);const b=m&&m.bearing||0,S=m&&m.pitch||0,P=a.getNorthWest(),H=a.getSouthEast();return this._cameraForBounds(this.transform,P,H,b,S,m)}_extendCameraOptions(a){const m={top:0,bottom:0,right:0,left:0};if(typeof(a=i.extend({padding:m,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const b=a.padding;a.padding={top:b,bottom:b,right:b,left:b}}return a.padding=i.extend(m,a.padding),a}_minimumAABBFrustumDistance(a,m){const b=m.max[0]-m.min[0],S=m.max[1]-m.min[1];return b/S>a.aspect?b/(2*Math.tan(.5*a.fovX)*a.aspect):S/(2*Math.tan(.5*a.fovY)*a.aspect)}_cameraForBoundsOnGlobe(a,m,b,S,P,H){const W=a.clone(),ee=this._extendCameraOptions(H);W.bearing=S,W.pitch=P;const pe=i.LngLat.convert(m),fe=i.LngLat.convert(b),Se=.5*(pe.lat+fe.lat),Qe=.5*(pe.lng+fe.lng),rt=i.latLngToECEF(Se,Qe),nt=i.normalize([],rt),lt=i.normalize([],i.cross([],nt,[0,1,0])),Xe=i.cross([],lt,nt),Ye=[lt[0],lt[1],lt[2],0,Xe[0],Xe[1],Xe[2],0,nt[0],nt[1],nt[2],0,0,0,0,1],At=[rt,i.latLngToECEF(pe.lat,pe.lng),i.latLngToECEF(fe.lat,pe.lng),i.latLngToECEF(fe.lat,fe.lng),i.latLngToECEF(pe.lat,fe.lng),i.latLngToECEF(Se,pe.lng),i.latLngToECEF(Se,fe.lng),i.latLngToECEF(pe.lat,Qe),i.latLngToECEF(fe.lat,Qe)];let ht=i.Aabb.fromPoints(At.map(Jt=>[i.dot(lt,Jt),i.dot(Xe,Jt),i.dot(nt,Jt)]));const Bt=i.transformMat4([],ht.center,Ye);i.squaredLength(Bt)===0&&i.set(Bt,0,0,1),i.normalize(Bt,Bt),i.scale$2(Bt,Bt,i.GLOBE_RADIUS),W.center=i.ecefToLatLng(Bt);const Pt=W.getWorldToCameraMatrix(),It=i.invert(new Float64Array(16),Pt);ht=i.Aabb.applyTransform(ht,i.multiply([],Pt,Ye)),i.transformMat4(Bt,Bt,Pt);const Ht=.5*(ht.max[2]-ht.min[2]),hi=this._minimumAABBFrustumDistance(W,ht),si=i.scale$2([],[0,0,1],Ht),qt=i.add(si,Bt,si),ji=hi+(W.pitch===0?0:i.distance(Bt,qt)),Kt=W.globeCenterInViewSpace,Bi=i.sub([],Bt,[Kt[0],Kt[1],Kt[2]]);i.normalize(Bi,Bi),i.scale$2(Bi,Bi,ji);const di=i.add([],Bt,Bi);i.transformMat4(di,di,It);const Ri=i.earthRadius/i.GLOBE_RADIUS,Ai=i.length(di),Mi=i.mercatorZfromAltitude(Ai*Ri-i.earthRadius,0),$i=Math.min(W.zoomFromMercatorZAdjusted(Mi),ee.maxZoom);return $i>.5*(i.GLOBE_ZOOM_THRESHOLD_MIN+i.GLOBE_ZOOM_THRESHOLD_MAX)?(W.setProjection({name:"mercator"}),W.zoom=$i,this._cameraForBounds(W,m,b,S,P,H)):{center:W.center,zoom:$i,bearing:S,pitch:P}}queryTerrainElevation(a,m){const b=this.transform.elevation;return b?(m=i.extend({},{exaggerated:!0},m),b.getAtPoint(i.MercatorCoordinate.fromLngLat(a),null,m.exaggerated)):null}_cameraForBounds(a,m,b,S,P,H){if(a.projection.name==="globe")return this._cameraForBoundsOnGlobe(a,m,b,S,P,H);const W=a.clone(),ee=this._extendCameraOptions(H),pe=W.padding;W.bearing=S,W.pitch=P;const fe=i.LngLat.convert(m),Se=i.LngLat.convert(b),Qe=new i.LngLat(fe.lng,Se.lat),rt=new i.LngLat(Se.lng,fe.lat),nt=W.project(fe),lt=W.project(Se),Xe=this.queryTerrainElevation(fe),Ye=this.queryTerrainElevation(Se),At=this.queryTerrainElevation(Qe),ht=this.queryTerrainElevation(rt),Bt=[[nt.x,nt.y,Math.min(Xe||0,Ye||0,At||0,ht||0)],[lt.x,lt.y,Math.max(Xe||0,Ye||0,At||0,ht||0)]];let Pt=i.Aabb.fromPoints(Bt);const It=W.getWorldToCameraMatrix(),Ht=i.invert(new Float64Array(16),It);Pt=i.Aabb.applyTransform(Pt,It);const hi=i.sub([],Pt.max,Pt.min),si=pe.left||0,qt=pe.right||0,ji=pe.bottom||0,Kt=pe.top||0,{left:Bi,right:di,top:Ri,bottom:Ai}=ee.padding,Mi=.5*(si+qt),$i=.5*(Kt+ji),Jt=Math.min(W.scaleZoom(W.scale*Math.min((W.width-(si+qt+Bi+di))/hi[0],(W.height-(ji+Kt+Ai+Ri))/hi[1])),ee.maxZoom),pi=W.scale/W.zoomScale(Jt);Pt=new i.Aabb([Pt.min[0]-(Bi+Mi)*pi,Pt.min[1]-(Ai+$i)*pi,Pt.min[2]],[Pt.max[0]+(di+Mi)*pi,Pt.max[1]+(Ri+$i)*pi,Pt.max[2]]);const In=.5*hi[2],Hn=this._minimumAABBFrustumDistance(W,Pt),Mn=[0,0,1,0];i.transformMat4$1(Mn,Mn,It),i.normalize$2(Mn,Mn);const $n=i.scale$2([],Mn,Hn+In),ar=i.add([],Pt.center,$n),On=(typeof ee.offset.x=="number"&&typeof ee.offset.y=="number"?new i.pointGeometry(ee.offset.x,ee.offset.y):i.pointGeometry.convert(ee.offset)).rotate(-i.degToRad(S));Pt.center[0]-=On.x*pi,Pt.center[1]+=On.y*pi,i.transformMat4(Pt.center,Pt.center,Ht),i.transformMat4(ar,ar,Ht);const _n=[Pt.center[0],Pt.center[1],ar[2]*W.pixelsPerMeter];i.scale$2(_n,_n,1/W.worldSize);const Dr=i.lngFromMercatorX(_n[0]),Or=i.latFromMercatorY(_n[1]),Nr=Math.min(W._zoomFromMercatorZ(_n[2]),ee.maxZoom),Qr=new i.LngLat(Dr,Or);return W.mercatorFromTransition&&Nr<.5*(i.GLOBE_ZOOM_THRESHOLD_MIN+i.GLOBE_ZOOM_THRESHOLD_MAX)?(W.setProjection({name:"globe"}),W.zoom=Nr,this._cameraForBounds(W,m,b,S,P,H)):{center:Qr,zoom:Nr,bearing:S,pitch:P}}fitBounds(a,m,b){const S=this.cameraForBounds(a,m);return this._fitInternal(S,m,b)}fitScreenCoordinates(a,m,b,S,P){const H=i.pointGeometry.convert(a),W=i.pointGeometry.convert(m),ee=new i.pointGeometry(Math.min(H.x,W.x),Math.min(H.y,W.y)),pe=new i.pointGeometry(Math.max(H.x,W.x),Math.max(H.y,W.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(H,W))return this;const fe=this.transform.pointLocation3D(ee),Se=this.transform.pointLocation3D(pe),Qe=this.transform.pointLocation3D(new i.pointGeometry(ee.x,pe.y)),rt=this.transform.pointLocation3D(new i.pointGeometry(pe.x,ee.y)),nt=[Math.min(fe.lng,Se.lng,Qe.lng,rt.lng),Math.min(fe.lat,Se.lat,Qe.lat,rt.lat)],lt=[Math.max(fe.lng,Se.lng,Qe.lng,rt.lng),Math.max(fe.lat,Se.lat,Qe.lat,rt.lat)],Xe=S&&S.pitch?S.pitch:this.getPitch(),Ye=this._cameraForBounds(this.transform,nt,lt,b,Xe,S);return this._fitInternal(Ye,S,P)}_fitInternal(a,m,b){return a?(delete(m=i.extend(a,m)).padding,m.linear?this.easeTo(m,b):this.flyTo(m,b)):this}jumpTo(a,m){this.stop();const b=a.preloadOnly?this.transform.clone():this.transform;let S=!1,P=!1,H=!1;return"zoom"in a&&b.zoom!==+a.zoom&&(S=!0,b.zoom=+a.zoom),a.center!==void 0&&(b.center=i.LngLat.convert(a.center)),"bearing"in a&&b.bearing!==+a.bearing&&(P=!0,b.bearing=+a.bearing),"pitch"in a&&b.pitch!==+a.pitch&&(H=!0,b.pitch=+a.pitch),a.padding==null||b.isPaddingEqual(a.padding)||(b.padding=a.padding),a.preloadOnly?(this._preloadTiles(b),this):(this.fire(new i.Event("movestart",m)).fire(new i.Event("move",m)),S&&this.fire(new i.Event("zoomstart",m)).fire(new i.Event("zoom",m)).fire(new i.Event("zoomend",m)),P&&this.fire(new i.Event("rotatestart",m)).fire(new i.Event("rotate",m)).fire(new i.Event("rotateend",m)),H&&this.fire(new i.Event("pitchstart",m)).fire(new i.Event("pitch",m)).fire(new i.Event("pitchend",m)),this.fire(new i.Event("moveend",m)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.warnOnce(xi),this.transform.getFreeCameraOptions()}setFreeCameraOptions(a,m){const b=this.transform;if(!b.projection.supportsFreeCamera)return i.warnOnce(xi),this;this.stop();const S=b.zoom,P=b.pitch,H=b.bearing;b.setFreeCameraOptions(a);const W=S!==b.zoom,ee=P!==b.pitch,pe=H!==b.bearing;return this.fire(new i.Event("movestart",m)).fire(new i.Event("move",m)),W&&this.fire(new i.Event("zoomstart",m)).fire(new i.Event("zoom",m)).fire(new i.Event("zoomend",m)),pe&&this.fire(new i.Event("rotatestart",m)).fire(new i.Event("rotate",m)).fire(new i.Event("rotateend",m)),ee&&this.fire(new i.Event("pitchstart",m)).fire(new i.Event("pitch",m)).fire(new i.Event("pitchend",m)),this.fire(new i.Event("moveend",m)),this}easeTo(a,m){this._stop(!1,a.easeId),((a=i.extend({offset:[0,0],duration:500,easing:i.ease},a)).animate===!1||!a.essential&&i.exported.prefersReducedMotion)&&(a.duration=0);const b=this.transform,S=this.getZoom(),P=this.getBearing(),H=this.getPitch(),W=this.getPadding(),ee="zoom"in a?+a.zoom:S,pe="bearing"in a?this._normalizeBearing(a.bearing,P):P,fe="pitch"in a?+a.pitch:H,Se="padding"in a?a.padding:b.padding,Qe=i.pointGeometry.convert(a.offset);let rt,nt,lt;if(b.projection.name==="globe"){const si=i.MercatorCoordinate.fromLngLat(b.center),qt=Qe.rotate(-b.angle);si.x+=qt.x/b.worldSize,si.y+=qt.y/b.worldSize;const ji=si.toLngLat(),Kt=i.LngLat.convert(a.center||ji);this._normalizeCenter(Kt),rt=b.centerPoint.add(qt),nt=new i.pointGeometry(si.x,si.y).mult(b.worldSize),lt=new i.pointGeometry(i.mercatorXfromLng(Kt.lng),i.mercatorYfromLat(Kt.lat)).mult(b.worldSize).sub(nt)}else{rt=b.centerPoint.add(Qe);const si=b.pointLocation(rt),qt=i.LngLat.convert(a.center||si);this._normalizeCenter(qt),nt=b.project(si),lt=b.project(qt).sub(nt)}const Xe=b.zoomScale(ee-S);let Ye,At;a.around&&(Ye=i.LngLat.convert(a.around),At=b.locationPoint(Ye));const ht=this._zooming||ee!==S,Bt=this._rotating||P!==pe,Pt=this._pitching||fe!==H,It=!b.isPaddingEqual(Se),Ht=si=>qt=>{if(ht&&(si.zoom=i.number(S,ee,qt)),Bt&&(si.bearing=i.number(P,pe,qt)),Pt&&(si.pitch=i.number(H,fe,qt)),It&&(si.interpolatePadding(W,Se,qt),rt=si.centerPoint.add(Qe)),Ye)si.setLocationAtPoint(Ye,At);else{const ji=si.zoomScale(si.zoom-S),Kt=ee>S?Math.min(2,Xe):Math.max(.5,Xe),Bi=Math.pow(Kt,1-qt),di=si.unproject(nt.add(lt.mult(qt*Bi)).mult(ji));si.setLocationAtPoint(si.renderWorldCopies?di.wrap():di,rt)}return a.preloadOnly||this._fireMoveEvents(m),si};if(a.preloadOnly){const si=this._emulate(Ht,a.duration,b);return this._preloadTiles(si),this}const hi={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=ht,this._rotating=Bt,this._pitching=Pt,this._padding=It,this._easeId=a.easeId,this._prepareEase(m,a.noMoveStart,hi),this._ease(Ht(b),si=>{b.recenterOnTerrain(),this._afterEase(m,si)},a),this}_prepareEase(a,m,b={}){this._moving=!0,this.transform.cameraElevationReference="sea",m||b.moving||this.fire(new i.Event("movestart",a)),this._zooming&&!b.zooming&&this.fire(new i.Event("zoomstart",a)),this._rotating&&!b.rotating&&this.fire(new i.Event("rotatestart",a)),this._pitching&&!b.pitching&&this.fire(new i.Event("pitchstart",a))}_fireMoveEvents(a){this.fire(new i.Event("move",a)),this._zooming&&this.fire(new i.Event("zoom",a)),this._rotating&&this.fire(new i.Event("rotate",a)),this._pitching&&this.fire(new i.Event("pitch",a))}_afterEase(a,m){if(this._easeId&&m&&this._easeId===m)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const b=this._zooming,S=this._rotating,P=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,b&&this.fire(new i.Event("zoomend",a)),S&&this.fire(new i.Event("rotateend",a)),P&&this.fire(new i.Event("pitchend",a)),this.fire(new i.Event("moveend",a))}flyTo(a,m){if(!a.essential&&i.exported.prefersReducedMotion){const Jt=i.pick(a,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Jt,m)}this.stop(),a=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},a);const b=this.transform,S=this.getZoom(),P=this.getBearing(),H=this.getPitch(),W=this.getPadding(),ee="zoom"in a?i.clamp(+a.zoom,b.minZoom,b.maxZoom):S,pe="bearing"in a?this._normalizeBearing(a.bearing,P):P,fe="pitch"in a?+a.pitch:H,Se="padding"in a?a.padding:b.padding,Qe=b.zoomScale(ee-S),rt=i.pointGeometry.convert(a.offset);let nt=b.centerPoint.add(rt);const lt=b.pointLocation(nt),Xe=i.LngLat.convert(a.center||lt);this._normalizeCenter(Xe);const Ye=b.project(lt),At=b.project(Xe).sub(Ye);let ht=a.curve;const Bt=Math.max(b.width,b.height),Pt=Bt/Qe,It=At.mag();if("minZoom"in a){const Jt=i.clamp(Math.min(a.minZoom,S,ee),b.minZoom,b.maxZoom),pi=Bt/b.zoomScale(Jt-S);ht=Math.sqrt(pi/It*2)}const Ht=ht*ht;function hi(Jt){const pi=(Pt*Pt-Bt*Bt+(Jt?-1:1)*Ht*Ht*It*It)/(2*(Jt?Pt:Bt)*Ht*It);return Math.log(Math.sqrt(pi*pi+1)-pi)}function si(Jt){return(Math.exp(Jt)-Math.exp(-Jt))/2}function qt(Jt){return(Math.exp(Jt)+Math.exp(-Jt))/2}const ji=hi(0);let Kt=function(Jt){return qt(ji)/qt(ji+ht*Jt)},Bi=function(Jt){return Bt*((qt(ji)*(si(pi=ji+ht*Jt)/qt(pi))-si(ji))/Ht)/It;var pi},di=(hi(1)-ji)/ht;if(Math.abs(It)<1e-6||!isFinite(di)){if(Math.abs(Bt-Pt)<1e-6)return this.easeTo(a,m);const Jt=Pt<Bt?-1:1;di=Math.abs(Math.log(Pt/Bt))/ht,Bi=function(){return 0},Kt=function(pi){return Math.exp(Jt*ht*pi)}}a.duration="duration"in a?+a.duration:1e3*di/("screenSpeed"in a?+a.screenSpeed/ht:+a.speed),a.maxDuration&&a.duration>a.maxDuration&&(a.duration=0);const Ri=P!==pe,Ai=fe!==H,Mi=!b.isPaddingEqual(Se),$i=Jt=>pi=>{const In=pi*di,Hn=1/Kt(In);Jt.zoom=pi===1?ee:S+Jt.scaleZoom(Hn),Ri&&(Jt.bearing=i.number(P,pe,pi)),Ai&&(Jt.pitch=i.number(H,fe,pi)),Mi&&(Jt.interpolatePadding(W,Se,pi),nt=Jt.centerPoint.add(rt));const Mn=pi===1?Xe:Jt.unproject(Ye.add(At.mult(Bi(In))).mult(Hn));return Jt.setLocationAtPoint(Jt.renderWorldCopies?Mn.wrap():Mn,nt),Jt._updateCameraOnTerrain(),a.preloadOnly||this._fireMoveEvents(m),Jt};if(a.preloadOnly){const Jt=this._emulate($i,a.duration,b);return this._preloadTiles(Jt),this}return this._zooming=!0,this._rotating=Ri,this._pitching=Ai,this._padding=Mi,this._prepareEase(m,!1),this._ease($i(b),()=>this._afterEase(m),a),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(a,m){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const b=this._onEaseEnd;this._onEaseEnd=void 0,b.call(this,m)}if(!a){const b=this.handlers;b&&b.stop(!1)}return this}_ease(a,m,b){b.animate===!1||b.duration===0?(a(1),m()):(this._easeStart=i.exported.now(),this._easeOptions=b,this._onEaseFrame=a,this._onEaseEnd=m,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const a=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1),m=this._onEaseFrame;m&&m(this._easeOptions.easing(a)),a<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(a,m){a=i.wrap(a,-180,180);const b=Math.abs(a-m);return Math.abs(a-360-m)<b&&(a-=360),Math.abs(a+360-m)<b&&(a+=360),a}_normalizeCenter(a){const m=this.transform;if(!m.renderWorldCopies||m.maxBounds)return;const b=a.lng-m.center.lng;a.lng+=b>180?-360:b<-180?360:0}_emulate(a,m,b){const S=Math.ceil(15*m/1e3),P=[],H=a(b.clone());for(let W=0;W<=S;W++){const ee=H(W/S);P.push(ee.clone())}return P}}class cn{constructor(a={}){this.options=a,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(a){const m=this.options&&this.options.compact;return this._map=a,this._container=R("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=R("button","mapboxgl-ctrl-attrib-button",this._container),R("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=R("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),m&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),m===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(a,m){const b=this._map._getUIString(`AttributionControl.${m}`);a.setAttribute("aria-label",b),a.removeAttribute("title"),a.firstElementChild&&a.firstElementChild.setAttribute("title",b)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let a=this._editLink;a||(a=this._editLink=this._container.querySelector(".mapbox-improve-map"));const m=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(a){const b=m.reduce((S,P,H)=>(P.value&&(S+=`${P.key}=${P.value}${H<m.length-1?"&":""}`),S),"?");a.href=`${i.config.FEEDBACK_URL}/${b}#${vs(this._map,!0)}`,a.rel="noopener nofollow",this._setElementTitle(a,"MapFeedback")}}_updateData(a){!a||a.sourceDataType!=="metadata"&&a.sourceDataType!=="visibility"&&a.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let a=[];if(this._map.style.stylesheet){const S=this._map.style.stylesheet;this.styleOwner=S.owner,this.styleId=S.id}const m=this._map.style._sourceCaches;for(const S in m){const P=m[S];if(P.used){const H=P.getSource();H.attribution&&a.indexOf(H.attribution)<0&&a.push(H.attribution)}}a.sort((S,P)=>S.length-P.length),a=a.filter((S,P)=>{for(let H=P+1;H<a.length;H++)if(a[H].indexOf(S)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=[...this.options.customAttribution,...a]:a.unshift(this.options.customAttribution));const b=a.join(" | ");b!==this._attribHTML&&(this._attribHTML=b,a.length?(this._innerContainer.innerHTML=b,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Bn{constructor(){i.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(a){this._map=a,this._container=R("div","mapboxgl-ctrl");const m=R("a","mapboxgl-ctrl-logo");return m.target="_blank",m.rel="noopener nofollow",m.href="https://www.mapbox.com/",m.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),m.setAttribute("rel","noopener nofollow"),this._container.appendChild(m),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(a){a&&a.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const a=this._map.style._sourceCaches;if(Object.entries(a).length===0)return!0;for(const m in a){const b=a[m].getSource();if(b.hasOwnProperty("mapbox_logo")&&!b.mapbox_logo)return!1}return!0}_updateCompact(){const a=this._container.children;if(a.length){const m=a[0];this._map.getCanvasContainer().offsetWidth<250?m.classList.add("mapboxgl-compact"):m.classList.remove("mapboxgl-compact")}}}class tr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(a){const m=++this._id;return this._queue.push({callback:a,id:m,cancelled:!1}),m}remove(a){const m=this._currentlyRunning,b=m?this._queue.concat(m):this._queue;for(const S of b)if(S.id===a)return void(S.cancelled=!0)}run(a=0){const m=this._currentlyRunning=this._queue;this._queue=[];for(const b of m)if(!b.cancelled&&(b.callback(a),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function ur(x,a,m){if(x=new i.LngLat(x.lng,x.lat),a){const b=new i.LngLat(x.lng-360,x.lat),S=new i.LngLat(x.lng+360,x.lat),P=360*Math.ceil(Math.abs(x.lng-m.center.lng)/360),H=m.locationPoint(x).distSqr(a),W=a.x<0||a.y<0||a.x>m.width||a.y>m.height;m.locationPoint(b).distSqr(a)<H&&(W||Math.abs(b.lng-m.center.lng)<P)?x=b:m.locationPoint(S).distSqr(a)<H&&(W||Math.abs(S.lng-m.center.lng)<P)&&(x=S)}for(;Math.abs(x.lng-m.center.lng)>180;){const b=m.locationPoint(x);if(b.x>=0&&b.y>=0&&b.x<=m.width&&b.y<=m.height)break;x.lng>m.center.lng?x.lng-=360:x.lng+=360}return x}const Un={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class Lr extends i.Evented{constructor(a,m){if(super(),(a instanceof i.window.HTMLElement||m)&&(a=i.extend({element:a},m)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=a&&a.anchor||"center",this._color=a&&a.color||"#3FB1CE",this._scale=a&&a.scale||1,this._draggable=a&&a.draggable||!1,this._clickTolerance=a&&a.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=a&&a.rotation||0,this._rotationAlignment=a&&a.rotationAlignment||"auto",this._pitchAlignment=a&&a.pitchAlignment&&a.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=a&&a.occludedOpacity||.2,a&&a.element)this._element=a.element,this._offset=i.pointGeometry.convert(a&&a.offset||[0,0]);else{this._defaultMarker=!0,this._element=R("div");const S=41,P=27,H=G("svg",{display:"block",height:S*this._scale+"px",width:P*this._scale+"px",viewBox:`0 0 ${P} ${S}`},this._element),W=G("radialGradient",{id:"shadowGradient"},G("defs",{},H));G("stop",{offset:"10%","stop-opacity":.4},W),G("stop",{offset:"100%","stop-opacity":.05},W),G("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},H),G("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},H),G("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},H),G("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},H),this._offset=i.pointGeometry.convert(a&&a.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",S=>{S.preventDefault()}),this._element.addEventListener("mousedown",S=>{S.preventDefault()});const b=this._element.classList;for(const S in Un)b.remove(`mapboxgl-marker-anchor-${S}`);b.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(a){return a===this._map||(this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._updateMoving),a.on("moveend",this._update),a.on("remove",this._clearFadeTimer),a._addMarker(this),this.setDraggable(this._draggable),this._update(),a.on("click",this._onMapClick)),this}remove(){const a=this._map;return a&&(a.off("click",this._onMapClick),a.off("move",this._updateMoving),a.off("moveend",this._update),a.off("mousedown",this._addDragHandler),a.off("touchstart",this._addDragHandler),a.off("mouseup",this._onUp),a.off("touchend",this._onUp),a.off("mousemove",this._onMove),a.off("touchmove",this._onMove),a.off("remove",this._clearFadeTimer),a._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(a){return this._lngLat=i.LngLat.convert(a),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(a){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),a){if(!("offset"in a.options)){const S=Math.sqrt(Math.pow(13.5,2)/2);a.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[S,-1*(38.1-13.5+S)],"bottom-right":[-S,-1*(38.1-13.5+S)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=a,a._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(a){const m=a.code,b=a.charCode||a.keyCode;m!=="Space"&&m!=="Enter"&&b!==32&&b!==13||this.togglePopup()}_onMapClick(a){const m=a.originalEvent.target,b=this._element;this._popup&&(m===b||b.contains(m))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const a=this._popup;return a?(a.isOpen()?(a.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(a.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const a=this._map,m=this._pos;if(!a||!m)return!1;const b=a.unproject(m),S=a.getFreeCameraOptions();if(!S.position)return!1;const P=S.position.toLngLat();return P.distanceTo(b)<.9*P.distanceTo(this._lngLat)}_evaluateOpacity(){const a=this._map;if(!a)return;const m=this._pos;if(!m||m.x<0||m.x>a.transform.width||m.y<0||m.y>a.transform.height)return void this._clearFadeTimer();const b=a.unproject(m);let S;a._showingGlobe()&&i.isLngLatBehindGlobe(a.transform,this._lngLat)?S=0:(S=1-a._queryFogOpacity(b),a.transform._terrainEnabled()&&a.getTerrain()&&this._behindTerrain()&&(S*=this._occludedOpacity)),this._element.style.opacity=`${S}`,this._element.style.pointerEvents=S>0?"auto":"none",this._popup&&this._popup._setOpacity(S),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const a=this._pos;if(!a||!this._map)return;const m=this._offset.mult(this._scale);this._element.style.transform=`
- translate(${a.x}px,${a.y}px)
- ${Un[this._anchor]}
- ${this._calculateXYTransform()} ${this._calculateZTransform()}
- translate(${m.x}px,${m.y}px)
- `}_calculateXYTransform(){const a=this._pos,m=this._map,b=this.getPitchAlignment();if(!m||!a||b!=="map")return"";if(!m._showingGlobe()){const ee=m.getPitch();return ee?`rotateX(${ee}deg)`:""}const S=i.radToDeg(i.globeTiltAtLngLat(m.transform,this._lngLat)),P=a.sub(i.globeCenterToScreenPoint(m.transform)),H=Math.abs(P.x)+Math.abs(P.y);if(H===0)return"";const W=S/H;return`rotateX(${-P.y*W}deg) rotateY(${P.x*W}deg)`}_calculateZTransform(){const a=this._pos,m=this._map;if(!m||!a)return"";let b=0;const S=this.getRotationAlignment();if(S==="map")if(m._showingGlobe()){const P=m.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),H=m.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(P);b=i.radToDeg(Math.atan2(H.y,H.x))-90}else b=-m.getBearing();else if(S==="horizon"){const P=i.smoothstep(4,6,m.getZoom()),H=i.globeCenterToScreenPoint(m.transform);H.y+=P*m.transform.height;const W=a.sub(H),ee=i.radToDeg(Math.atan2(W.y,W.x));b=(ee>90?ee-270:ee+90)*(1-P)}return b+=this._rotation,b?`rotateZ(${b}deg)`:""}_update(a){i.window.cancelAnimationFrame(this._updateFrameId);const m=this._map;m&&(m.transform.renderWorldCopies&&(this._lngLat=ur(this._lngLat,this._pos,m.transform)),this._pos=m.project(this._lngLat),a===!0?this._updateFrameId=i.window.requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),m._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(m._showingGlobe()||m.getTerrain()||m.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(a){return this._offset=i.pointGeometry.convert(a),this._update(),this}_onMove(a){const m=this._map;if(!m)return;const b=this._pointerdownPos,S=this._positionDelta;if(b&&S){if(!this._isDragging){const P=this._clickTolerance||m._clickTolerance;if(a.point.dist(b)<P)return;this._isDragging=!0}this._pos=a.point.sub(S),this._lngLat=m.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const a=this._map;a&&(a.off("mousemove",this._onMove),a.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new i.Event("dragend")),this._state="inactive"}_addDragHandler(a){const m=this._map,b=this._pos;m&&b&&this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(b),this._pointerdownPos=a.point,this._state="pending",m.on("mousemove",this._onMove),m.on("touchmove",this._onMove),m.once("mouseup",this._onUp),m.once("touchend",this._onUp))}setDraggable(a){this._draggable=!!a;const m=this._map;return m&&(a?(m.on("mousedown",this._addDragHandler),m.on("touchstart",this._addDragHandler)):(m.off("mousedown",this._addDragHandler),m.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(a){return this._rotation=a||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a||"auto",this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(a){return this._occludedOpacity=a||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Rr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Cr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Er(x=new i.pointGeometry(0,0),a="bottom"){if(typeof x=="number"){const m=Math.round(Math.sqrt(.5*Math.pow(x,2)));switch(a){case"top":return new i.pointGeometry(0,x);case"top-left":return new i.pointGeometry(m,m);case"top-right":return new i.pointGeometry(-m,m);case"bottom":return new i.pointGeometry(0,-x);case"bottom-left":return new i.pointGeometry(m,-m);case"bottom-right":return new i.pointGeometry(-m,-m);case"left":return new i.pointGeometry(x,0);case"right":return new i.pointGeometry(-x,0)}return new i.pointGeometry(0,0)}return x instanceof i.pointGeometry||Array.isArray(x)?i.pointGeometry.convert(x):i.pointGeometry.convert(x[a]||[0,0])}class Gr{constructor(a){this.jumpTo(a)}getValue(a){if(a<=this._startTime)return this._start;if(a>=this._endTime)return this._end;const m=i.easeCubicInOut((a-this._startTime)/(this._endTime-this._startTime));return this._start*(1-m)+this._end*m}isEasing(a){return a>=this._startTime&&a<=this._endTime}jumpTo(a){this._startTime=-1/0,this._endTime=-1/0,this._start=a,this._end=a}easeTo(a,m,b){this._start=this.getValue(m),this._end=a,this._startTime=m,this._endTime=m+b}}const js={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},wa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},Aa={showCompass:!0,showZoom:!0,visualizePitch:!1};class ba{constructor(a,m,b=!1){this._clickTolerance=10,this.element=m,this.mouseRotate=new Kh({clickTolerance:a.dragRotate._mouseRotate._clickTolerance}),this.map=a,b&&(this.mousePitch=new xl({clickTolerance:a.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),m.addEventListener("mousedown",this.mousedown),m.addEventListener("touchstart",this.touchstart,{passive:!1}),m.addEventListener("touchmove",this.touchmove),m.addEventListener("touchend",this.touchend),m.addEventListener("touchcancel",this.reset)}down(a,m){this.mouseRotate.mousedown(a,m),this.mousePitch&&this.mousePitch.mousedown(a,m),ae()}move(a,m){const b=this.map,S=this.mouseRotate.mousemoveWindow(a,m),P=S&&S.bearingDelta;if(P&&b.setBearing(b.getBearing()+P),this.mousePitch){const H=this.mousePitch.mousemoveWindow(a,m),W=H&&H.pitchDelta;W&&b.setPitch(b.getPitch()+W)}}off(){const a=this.element;a.removeEventListener("mousedown",this.mousedown),a.removeEventListener("touchstart",this.touchstart,{passive:!1}),a.removeEventListener("touchmove",this.touchmove),a.removeEventListener("touchend",this.touchend),a.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){le(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}mousedown(a){this.down(i.extend({},a,{ctrlKey:!0,preventDefault:()=>a.preventDefault()}),me(this.element,a)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}mousemove(a){this.move(a,me(this.element,a))}mouseup(a){this.mouseRotate.mouseupWindow(a),this.mousePitch&&this.mousePitch.mouseupWindow(a),this.offTemp()}touchstart(a){a.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Pe(this.element,a.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>a.preventDefault()},this._startPos))}touchmove(a){a.targetTouches.length!==1?this.reset():(this._lastPos=Pe(this.element,a.targetTouches)[0],this.move({preventDefault:()=>a.preventDefault()},this._lastPos))}touchend(a){a.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}const ja={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},Wo={maxWidth:100,unit:"metric"};function mo(x,a,m){const b=Ba(a),S=b/a,P={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"}[m];this._map._requestDomTask(()=>{this._container.style.width=x*S+"px",this._container.innerHTML=`${b} ${P}`})}function Ba(x){const a=Math.pow(10,`${Math.floor(x)}`.length-1);let m=x/a;return m=m>=10?10:m>=5?5:m>=3?3:m>=2?2:m>=1?1:function(b){const S=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*S)/S}(m),a*m}const $l={version:i.version,supported:D,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends xn{constructor(x){if(i.LivePerformanceUtils.mark(i.PerformanceMarkers.create),(x=i.extend({},wa,x)).minZoom!=null&&x.maxZoom!=null&&x.minZoom>x.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(x.minPitch!=null&&x.maxPitch!=null&&x.minPitch>x.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(x.minPitch!=null&&x.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(x.maxPitch!=null&&x.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(x.antialias&&i.isSafariWithAntialiasingBug(i.window)&&(x.antialias=!1,i.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Kl(x.minZoom,x.maxZoom,x.minPitch,x.maxPitch,x.renderWorldCopies),x),this._interactive=x.interactive,this._minTileCacheSize=x.minTileCacheSize,this._maxTileCacheSize=x.maxTileCacheSize,this._failIfMajorPerformanceCaveat=x.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=x.preserveDrawingBuffer,this._antialias=x.antialias,this._trackResize=x.trackResize,this._bearingSnap=x.bearingSnap,this._refreshExpiredTiles=x.refreshExpiredTiles,this._fadeDuration=x.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=x.crossSourceCollisions,this._collectResourceTiming=x.collectResourceTiming,this._optimizeForTerrain=x.optimizeForTerrain,this._language=this._parseLanguage(x.language),this._worldview=x.worldview,this._renderTaskQueue=new tr,this._domRenderTaskQueue=new tr,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.uniqueId(),this._locale=i.extend({},js,x.locale),this._clickTolerance=x.clickTolerance,this._cooperativeGestures=x.cooperativeGestures,this._performanceMetricsCollection=x.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Gr(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new i.RequestManager(x.transformRequest,x.accessToken,x.testMode),this._silenceAuthErrors=!!x.testMode,typeof x.container=="string"){if(this._container=i.window.document.getElementById(x.container),!this._container)throw new Error(`Container '${x.container}' not found.`)}else{if(!(x.container instanceof i.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=x.container}if(this._container.childNodes.length>0&&i.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),x.maxBounds&&this.setMaxBounds(x.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),i.window!==void 0&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1),i.window.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new Hi(this,x),this._localFontFamily=x.localFontFamily,this._localIdeographFontFamily=x.localIdeographFontFamily,x.style&&this.setStyle(x.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),x.projection&&this.setProjection(x.projection),this._hash=x.hash&&new An(typeof x.hash=="string"&&x.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:x.center,zoom:x.zoom,bearing:x.bearing,pitch:x.pitch}),x.bounds&&(this.resize(),this.fitBounds(x.bounds,i.extend({},x.fitBoundsOptions,{duration:0})))),this.resize(),x.attributionControl&&this.addControl(new cn({customAttribution:x.customAttribution})),this._logoControl=new Bn,this.addControl(this._logoControl,x.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new i.Event(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new i.Event(`${a.dataType}dataloading`,a))})}_getMapId(){return this._mapId}addControl(x,a){if(a===void 0&&(a=x.getDefaultPosition?x.getDefaultPosition():"top-right"),!x||!x.onAdd)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const m=x.onAdd(this);this._controls.push(x);const b=this._controlPositions[a];return a.indexOf("bottom")!==-1?b.insertBefore(m,b.firstChild):b.appendChild(m),this}removeControl(x){if(!x||!x.onRemove)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const a=this._controls.indexOf(x);return a>-1&&this._controls.splice(a,1),x.onRemove(this),this}hasControl(x){return this._controls.indexOf(x)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(x){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const a=!this._moving;return a&&this.fire(new i.Event("movestart",x)).fire(new i.Event("move",x)),this.fire(new i.Event("resize",x)),a&&this.fire(new i.Event("moveend",x)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(x){return this.transform.setMaxBounds(i.LngLatBounds.convert(x)),this._update()}setMinZoom(x){if((x=x==null?-2:x)>=-2&&x<=this.transform.maxZoom)return this.transform.minZoom=x,this._update(),this.getZoom()<x?this.setZoom(x):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(x){if((x=x==null?22:x)>=this.transform.minZoom)return this.transform.maxZoom=x,this._update(),this.getZoom()>x?this.setZoom(x):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(x){if((x=x==null?0:x)<0)throw new Error("minPitch must be greater than or equal to 0");if(x>=0&&x<=this.transform.maxPitch)return this.transform.minPitch=x,this._update(),this.getPitch()<x?this.setPitch(x):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(x){if((x=x==null?85:x)>85)throw new Error("maxPitch must be less than or equal to 85");if(x>=this.transform.minPitch)return this.transform.maxPitch=x,this._update(),this.getPitch()>x?this.setPitch(x):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(x){return this.transform.renderWorldCopies=x,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(x){return x==="auto"?i.window.navigator.language:Array.isArray(x)?x.length===0?void 0:x.map(a=>a==="auto"?i.window.navigator.language:a):x}setLanguage(x){const a=this._parseLanguage(x);if(!this.style||a===this._language)return this;this._language=a,this.style._reloadSources();for(const m of this._controls)m._setLanguage&&m._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(x){return this.style&&x!==this._worldview?(this._worldview=x,this.style._reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(x){return this._lazyInitEmptyStyle(),x?typeof x=="string"&&(x={name:x}):x=null,this._useExplicitProjection=!!x,this._prioritizeAndUpdateProjection(x,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const x=this.transform,a=x.projection.name;let m;a==="globe"&&x.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?(x.setMercatorFromTransition(),m=!0):a==="mercator"&&x.zoom<i.GLOBE_ZOOM_THRESHOLD_MAX&&(x.setProjection({name:"globe"}),m=!0),m&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(x,a){return this._updateProjection(x||a||{name:"mercator"})}_updateProjection(x){let a;if(a=x.name==="globe"&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(x),this.style.applyProjectionUpdate(),a){this.painter.clearBackgroundTiles();for(const m in this.style._sourceCaches)this.style._sourceCaches[m].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(x){return this.transform.locationPoint3D(i.LngLat.convert(x))}unproject(x){return this.transform.pointLocation3D(i.pointGeometry.convert(x))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(x,a,m){if(x==="mouseenter"||x==="mouseover"){let b=!1;const S=H=>{const W=a.filter(pe=>this.getLayer(pe)),ee=W.length?this.queryRenderedFeatures(H.point,{layers:W}):[];ee.length?b||(b=!0,m.call(this,new Js(x,this,H.originalEvent,{features:ee}))):b=!1},P=()=>{b=!1};return{layers:new Set(a),listener:m,delegates:{mousemove:S,mouseout:P}}}if(x==="mouseleave"||x==="mouseout"){let b=!1;const S=H=>{const W=a.filter(ee=>this.getLayer(ee));(W.length?this.queryRenderedFeatures(H.point,{layers:W}):[]).length?b=!0:b&&(b=!1,m.call(this,new Js(x,this,H.originalEvent)))},P=H=>{b&&(b=!1,m.call(this,new Js(x,this,H.originalEvent)))};return{layers:new Set(a),listener:m,delegates:{mousemove:S,mouseout:P}}}{const b=S=>{const P=a.filter(W=>this.getLayer(W)),H=P.length?this.queryRenderedFeatures(S.point,{layers:P}):[];H.length&&(S.features=H,m.call(this,S),delete S.features)};return{layers:new Set(a),listener:m,delegates:{[x]:b}}}}on(x,a,m){if(m===void 0)return super.on(x,a);Array.isArray(a)||(a=[a]);const b=this._createDelegatedListener(x,a,m);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[x]=this._delegatedListeners[x]||[],this._delegatedListeners[x].push(b);for(const S in b.delegates)this.on(S,b.delegates[S]);return this}once(x,a,m){if(m===void 0)return super.once(x,a);Array.isArray(a)||(a=[a]);const b=this._createDelegatedListener(x,a,m);for(const S in b.delegates)this.once(S,b.delegates[S]);return this}off(x,a,m){if(m===void 0)return super.off(x,a);a=new Set(Array.isArray(a)?a:[a]);const b=(P,H)=>{if(P.size!==H.size)return!1;for(const W of P)if(!H.has(W))return!1;return!0},S=this._delegatedListeners?this._delegatedListeners[x]:void 0;return S&&(P=>{for(let H=0;H<P.length;H++){const W=P[H];if(W.listener===m&&b(W.layers,a)){for(const ee in W.delegates)this.off(ee,W.delegates[ee]);return P.splice(H,1),this}}})(S),this}queryRenderedFeatures(x,a){return this.style?(a!==void 0||x===void 0||x instanceof i.pointGeometry||Array.isArray(x)||(a=x,x=void 0),this.style.queryRenderedFeatures(x=x||[[0,0],[this.transform.width,this.transform.height]],a=a||{},this.transform)):[]}querySourceFeatures(x,a){return this.style.querySourceFeatures(x,a)}setStyle(x,a){return(a=i.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},a)).diff!==!1&&a.localIdeographFontFamily===this._localIdeographFontFamily&&a.localFontFamily===this._localFontFamily&&this.style&&x?(this._diffStyle(x,a),this):(this._localIdeographFontFamily=a.localIdeographFontFamily,this._localFontFamily=a.localFontFamily,this._updateStyle(x,a))}_getUIString(x){const a=this._locale[x];if(a==null)throw new Error(`Missing UI string '${x}'`);return a}_updateStyle(x,a){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),x&&(this.style=new Ws(this,a||{}),this.style.setEventedParent(this,{style:this.style}),typeof x=="string"?this.style.loadURL(x):this.style.loadJSON(x)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Ws(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(x,a){if(typeof x=="string"){const m=this._requestManager.normalizeStyleURL(x),b=this._requestManager.transformRequest(m,i.ResourceType.Style);i.getJSON(b,(S,P)=>{S?this.fire(new i.ErrorEvent(S)):P&&this._updateDiff(P,a)})}else typeof x=="object"&&this._updateDiff(x,a)}_updateDiff(x,a){try{this.style.setState(x)&&this._update(!0)}catch(m){i.warnOnce(`Unable to perform style diff: ${m.message||m.error||m}. Rebuilding the style from scratch.`),this._updateStyle(x,a)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(i.warnOnce("There is no style added to the map."),!1)}addSource(x,a){return this._lazyInitEmptyStyle(),this.style.addSource(x,a),this._update(!0)}isSourceLoaded(x){return!!this.style&&this.style._isSourceCacheLoaded(x)}areTilesLoaded(){const x=this.style&&this.style._sourceCaches;for(const a in x){const m=x[a]._tiles;for(const b in m){const S=m[b];if(S.state!=="loaded"&&S.state!=="errored")return!1}}return!0}addSourceType(x,a,m){this._lazyInitEmptyStyle(),this.style.addSourceType(x,a,m)}removeSource(x){return this.style.removeSource(x),this._updateTerrain(),this._update(!0)}getSource(x){return this.style.getSource(x)}addImage(x,a,{pixelRatio:m=1,sdf:b=!1,stretchX:S,stretchY:P,content:H}={}){if(this._lazyInitEmptyStyle(),a instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&a instanceof i.window.ImageBitmap){const{width:W,height:ee,data:pe}=i.exported.getImageData(a);this.style.addImage(x,{data:new i.RGBAImage({width:W,height:ee},pe),pixelRatio:m,stretchX:S,stretchY:P,content:H,sdf:b,version:0})}else if(a.width===void 0||a.height===void 0)this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:W,height:ee}=a,pe=a;this.style.addImage(x,{data:new i.RGBAImage({width:W,height:ee},new Uint8Array(pe.data)),pixelRatio:m,stretchX:S,stretchY:P,content:H,sdf:b,version:0,userImage:pe}),pe.onAdd&&pe.onAdd(this,x)}}updateImage(x,a){const m=this.style.getImage(x);if(!m)return void this.fire(new i.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const b=a instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&a instanceof i.window.ImageBitmap?i.exported.getImageData(a):a,{width:S,height:P}=b;S!==void 0&&P!==void 0?S===m.data.width&&P===m.data.height?(m.data.replace(b.data,!(a instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&a instanceof i.window.ImageBitmap)),this.style.updateImage(x,m)):this.fire(new i.ErrorEvent(new Error(`The width and height of the updated image (${S}, ${P})
- must be that same as the previous version of the image
- (${m.data.width}, ${m.data.height})`))):this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}hasImage(x){return x?!!this.style.getImage(x):(this.fire(new i.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(x){this.style.removeImage(x)}loadImage(x,a){i.getImage(this._requestManager.transformRequest(x,i.ResourceType.Image),(m,b)=>{a(m,b instanceof i.window.HTMLImageElement?i.exported.getImageData(b):b)})}listImages(){return this.style.listImages()}addLayer(x,a){return this._lazyInitEmptyStyle(),this.style.addLayer(x,a),this._update(!0)}moveLayer(x,a){return this.style.moveLayer(x,a),this._update(!0)}removeLayer(x){return this.style.removeLayer(x),this._update(!0)}getLayer(x){return this.style.getLayer(x)}setLayerZoomRange(x,a,m){return this.style.setLayerZoomRange(x,a,m),this._update(!0)}setFilter(x,a,m={}){return this.style.setFilter(x,a,m),this._update(!0)}getFilter(x){return this.style.getFilter(x)}setPaintProperty(x,a,m,b={}){return this.style.setPaintProperty(x,a,m,b),this._update(!0)}getPaintProperty(x,a){return this.style.getPaintProperty(x,a)}setLayoutProperty(x,a,m,b={}){return this.style.setLayoutProperty(x,a,m,b),this._update(!0)}getLayoutProperty(x,a){return this.style.getLayoutProperty(x,a)}setLight(x,a={}){return this._lazyInitEmptyStyle(),this.style.setLight(x,a),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(x){return this._lazyInitEmptyStyle(),!x&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(x),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(x){return this._lazyInitEmptyStyle(),this.style.setFog(x),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(x){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(x),this.transform):0}setFeatureState(x,a){return this.style.setFeatureState(x,a),this._update()}removeFeatureState(x,a){return this.style.removeFeatureState(x,a),this._update()}getFeatureState(x){return this.style.getFeatureState(x)}_updateContainerDimensions(){if(!this._container)return;const x=this._container.getBoundingClientRect().width||400,a=this._container.getBoundingClientRect().height||300;let m,b,S,P=this._container;for(;P&&(!b||!S);){const H=i.window.getComputedStyle(P).transform;H&&H!=="none"&&(m=H.match(/matrix.*\((.+)\)/)[1].split(", "),m[0]&&m[0]!=="0"&&m[0]!=="1"&&(b=m[0]),m[3]&&m[3]!=="0"&&m[3]!=="1"&&(S=m[3])),P=P.parentElement}this._containerWidth=b?Math.abs(x/b):x,this._containerHeight=S?Math.abs(a/S):a}_detectMissingCSS(){i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&i.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const x=this._container;x.classList.add("mapboxgl-map"),(this._missingCSSCanary=R("div","mapboxgl-canary",x)).style.visibility="hidden",this._detectMissingCSS();const a=this._canvasContainer=R("div","mapboxgl-canvas-container",x);this._interactive&&a.classList.add("mapboxgl-interactive"),this._canvas=R("canvas","mapboxgl-canvas",a),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const m=this._controlContainer=R("div","mapboxgl-control-container",x),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(S=>{b[S]=R("div",`mapboxgl-ctrl-${S}`,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(x,a){const m=i.exported.devicePixelRatio||1;this._canvas.width=m*Math.ceil(x),this._canvas.height=m*Math.ceil(a),this._canvas.style.width=`${x}px`,this._canvas.style.height=`${a}px`}_addMarker(x){this._markers.push(x)}_removeMarker(x){const a=this._markers.indexOf(x);a!==-1&&this._markers.splice(a,1)}_addPopup(x){this._popups.push(x)}_removePopup(x){const a=this._popups.indexOf(x);a!==-1&&this._popups.splice(a,1)}_setupPainter(){const x=i.extend({},D.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),a=this._canvas.getContext("webgl",x)||this._canvas.getContext("experimental-webgl",x);a?(i.storeAuthState(a,!0),this.painter=new cA(a,this.transform),this.on("data",m=>{m.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(a)):this.fire(new i.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(x){x.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:x}))}_contextRestored(x){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:x}))}_onMapScroll(x){if(x.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(x){return this.style?(this._styleDirty=this._styleDirty||x,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(x){return this._update(),this._renderTaskQueue.add(x)}_cancelRenderFrame(x){this._renderTaskQueue.remove(x)}_requestDomTask(x){!this.loaded()||this.loaded()&&!this.isMoving()?x():this._domRenderTaskQueue.add(x)}_render(x){let a;const m=this.painter.context.extTimerQuery,b=i.exported.now();if(this.listens("gpu-timing-frame")&&(a=m.createQueryEXT(),m.beginQueryEXT(m.TIME_ELAPSED_EXT,a)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],i.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],i.window.performance.now())),this._renderTaskQueue.run(x),this._domRenderTaskQueue.run(x),this._removed)return;this._updateProjectionTransition();const S=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const W=this.transform.zoom,ee=this.transform.pitch,pe=i.exported.now(),fe=new i.EvaluationParameters(W,{now:pe,fadeDuration:S,pitch:ee,transition:this.style.getTransition()});this.style.update(fe)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let P=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),P=this._updateAverageElevation(b),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):P=this._updateAverageElevation(b),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,S,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:S,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),a){const W=i.exported.now()-b;m.endQueryEXT(m.TIME_ELAPSED_EXT,a),setTimeout(()=>{const ee=m.getQueryObjectEXT(a,m.QUERY_RESULT_EXT)/1e6;m.deleteQueryEXT(a),this.fire(new i.Event("gpu-timing-frame",{cpuTime:W,gpuTime:ee})),i.window.performance.mark("frame-gpu",{startTime:b,detail:{gpuTime:ee}})},50)}if(this.listens("gpu-timing-layer")){const W=this.painter.collectGpuTimers();setTimeout(()=>{const ee=this.painter.queryGpuTimers(W);this.fire(new i.Event("gpu-timing-layer",{layerTimes:ee}))},50)}if(this.listens("gpu-timing-deferred-render")){const W=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const ee=this.painter.queryGpuTimeDeferredRender(W);this.fire(new i.Event("gpu-timing-deferred-render",{gpuTime:ee}))},50)}const H=this._sourcesDirty||this._styleDirty||this._placementDirty||P;if(H||this._repaint)this.triggerRepaint();else{const W=!this.isMoving()&&this.loaded();if(W&&(P=this._updateAverageElevation(b,!0)),P)this.triggerRepaint();else if(this._triggerFrame(!1),W&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const ee=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:ee})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||H||(this._fullyLoaded=!0,i.LivePerformanceUtils.mark(i.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&i.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(x){for(const a of this._markers)x&&!this.getRenderWorldCopies()&&(a._lngLat=a._lngLat.wrap()),a._update();for(const a of this._popups)!x||this.getRenderWorldCopies()||a._trackPointer||(a._lngLat=a._lngLat.wrap()),a._update()}_updateAverageElevation(x,a=!1){const m=b=>(this.transform.averageElevation=b,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&m(0);if((a||x-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(x)){const b=this.transform.averageElevation;let S=this.transform.sampleAverageElevation(),P=!1;this.transform.elevation&&(P=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(S)?S=0:this._averageElevationLastSampledAt=x;const H=Math.abs(b-S);if(H>1){if(this._isInitialLoad||P)return this._averageElevation.jumpTo(S),m(S);this._averageElevation.easeTo(S,x,300)}else if(H>1e-4)return this._averageElevation.jumpTo(S),m(S)}return!!this._averageElevation.isEasing(x)&&m(this._averageElevation.getValue(x))}_authenticate(){i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,x=>{if(x&&(x.message===i.AUTH_ERR_MSG||x.status===401)){const a=this.painter.context.gl;i.storeAuthState(a,!1),this._logoControl instanceof Bn&&this._logoControl._updateLogo(),a&&a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){const x=this._isDragging();this.painter.updateTerrain(this.style,x)}_calculateSpeedIndex(){const x=this.painter.canvasCopy(),a=this.painter.getCanvasCopiesAndTimestamps();a.timeStamps.push(performance.now());const m=this.painter.context.gl,b=m.createFramebuffer();function S(P){m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,P,0);const H=new Uint8Array(m.drawingBufferWidth*m.drawingBufferHeight*4);return m.readPixels(0,0,m.drawingBufferWidth,m.drawingBufferHeight,m.RGBA,m.UNSIGNED_BYTE,H),H}return m.bindFramebuffer(m.FRAMEBUFFER,b),this._canvasPixelComparison(S(x),a.canvasCopies.map(S),a.timeStamps)}_canvasPixelComparison(x,a,m){let b=m[1]-m[0];const S=x.length/4;for(let P=0;P<a.length;P++){const H=a[P];let W=0;for(let ee=0;ee<H.length;ee+=4)H[ee]===x[ee]&&H[ee+1]===x[ee+1]&&H[ee+2]===x[ee+2]&&H[ee+3]===x[ee+3]&&(W+=1);b+=(m[P+2]-m[P+1])*(1-W/S)}return b}remove(){this._hash&&this._hash.remove();for(const a of this._controls)a.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),i.window!==void 0&&(i.window.removeEventListener("resize",this._onWindowResize,!1),i.window.removeEventListener("orientationchange",this._onWindowResize,!1),i.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),i.window.removeEventListener("online",this._onWindowOnline,!1),i.window.removeEventListener("visibilitychange",this._onVisibilityChange,!1));const x=this.painter.context.gl.getExtension("WEBGL_lose_context");x&&x.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),i.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new i.Event("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(x){this._renderNextFrame=this._renderNextFrame||x,this.style&&!this._frame&&(this._frame=i.exported.frame(a=>{const m=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,m&&this._render(a)}))}_preloadTiles(x){const a=this.style?Object.values(this.style._sourceCaches):[];return i.asyncAll(a,(m,b)=>m._preloadTiles(x,b),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(x){this._trackResize&&this.resize({originalEvent:x})._update()}_onVisibilityChange(){i.window.document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(x){this._showTileBoundaries!==x&&(this._showTileBoundaries=x,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(x){this._showTerrainWireframe!==x&&(this._showTerrainWireframe=x,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(x){this._speedIndexTiming!==x&&(this._speedIndexTiming=x,this._update())}get showPadding(){return!!this._showPadding}set showPadding(x){this._showPadding!==x&&(this._showPadding=x,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(x){this._showCollisionBoxes!==x&&(this._showCollisionBoxes=x,x?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(x){this._showOverdrawInspector!==x&&(this._showOverdrawInspector=x,this._update())}get repaint(){return!!this._repaint}set repaint(x){this._repaint!==x&&(this._repaint=x,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(x){this._vertices=x,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(x){this._showTileAABBs!==x&&(this._showTileAABBs=x,x&&this._update())}_setCacheLimits(x,a){i.setCacheLimits(x,a)}get version(){return i.version}},NavigationControl:class{constructor(x){this.options=i.extend({},Aa,x),this._container=R("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",a=>{this._map&&this._map.zoomIn({},{originalEvent:a})}),R("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",a=>{this._map&&this._map.zoomOut({},{originalEvent:a})}),R("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",a=>{const m=this._map;m&&(this.options.visualizePitch?m.resetNorthPitch({},{originalEvent:a}):m.resetNorth({},{originalEvent:a}))}),this._compassIcon=R("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const x=this._map;if(!x)return;const a=x.getZoom(),m=a===x.getMaxZoom(),b=a===x.getMinZoom();this._zoomInButton.disabled=m,this._zoomOutButton.disabled=b,this._zoomInButton.setAttribute("aria-disabled",m.toString()),this._zoomOutButton.setAttribute("aria-disabled",b.toString())}_rotateCompassArrow(){const x=this._map;if(!x)return;const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(x.transform.pitch*(Math.PI/180)),.5)}) rotateX(${x.transform.pitch}deg) rotateZ(${x.transform.angle*(180/Math.PI)}deg)`:`rotate(${x.transform.angle*(180/Math.PI)}deg)`;x._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=a)})}onAdd(x){return this._map=x,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),x.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&x.on("pitch",this._rotateCompassArrow),x.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ba(x,this._compass,this.options.visualizePitch)),this._container}onRemove(){const x=this._map;x&&(this._container.remove(),this.options.showZoom&&x.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&x.off("pitch",this._rotateCompassArrow),x.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(x,a){const m=R("button",x,this._container);return m.type="button",m.addEventListener("click",a),m}_setButtonTitle(x,a){if(!this._map)return;const m=this._map._getUIString(`NavigationControl.${a}`);x.setAttribute("aria-label",m),x.firstElementChild&&x.firstElementChild.setAttribute("title",m)}},GeolocateControl:class extends i.Evented{constructor(x){super(),this.options=i.extend({geolocation:i.window.navigator.geolocation},ja,x),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=_l(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(x){return this._map=x,this._container=R("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(x){const a=(m=!!this.options.geolocation)=>{this._supportsGeolocation=m,x(m)};this._supportsGeolocation!==void 0?x(this._supportsGeolocation):i.window.navigator.permissions!==void 0?i.window.navigator.permissions.query({name:"geolocation"}).then(m=>a(m.state!=="denied")).catch(()=>a()):a()}_isOutOfMapMaxBounds(x){const a=this._map.getMaxBounds(),m=x.coords;return!!a&&(m.longitude<a.getWest()||m.longitude>a.getEast()||m.latitude<a.getSouth()||m.latitude>a.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(x){if(this._map){if(this._isOutOfMapMaxBounds(x))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",x)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=x,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(x),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(x),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",x)),this._finish()}}_updateCamera(x){const a=new i.LngLat(x.coords.longitude,x.coords.latitude),m=x.coords.accuracy,b=this._map.getBearing(),S=i.extend({bearing:b},this.options.fitBoundsOptions);this._map.fitBounds(a.toBounds(m),S,{geolocateSource:!0})}_updateMarker(x){if(x){const a=new i.LngLat(x.coords.longitude,x.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=x.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const x=this._map.transform,a=i.mercatorZfromAltitude(1,x._center.lat)*x.worldSize,m=Math.ceil(2*this._accuracy*a);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(x){if(this._map){if(this.options.trackUserLocation)if(x.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(x.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",x)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(x){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",a=>a.preventDefault()),this._geolocateButton=R("button","mapboxgl-ctrl-geolocate",this._container),R("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",x===!1){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a)}else{const a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=R("div","mapboxgl-user-location"),this._dotElement.appendChild(R("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(R("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Lr({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=R("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Lr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",a=>{a.geolocateSource||this._watchState!=="ACTIVE_LOCK"||a.originalEvent&&a.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}}_onDeviceOrientation(x){this._userLocationDotMarker&&(x.webkitCompassHeading?this._heading=x.webkitCompassHeading:x.absolute===!0&&(this._heading=-1*x.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let x;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(x={maximumAge:6e5,timeout:0},this._noTimeout=!0):(x=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,x),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const x=()=>{i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};i.window.DeviceMotionEvent!==void 0&&typeof i.window.DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(a=>{a==="granted"&&x()}).catch(console.error):x()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientation),i.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:cn,ScaleControl:class{constructor(x){this.options=i.extend({},Wo,x),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch{return!1}}()||(this._setScale=mo.bind(this)),i.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const x=this.options.maxWidth||100,a=this._map,m=a._containerHeight/2,b=a._containerWidth/2-x/2,S=a.unproject([b,m]),P=a.unproject([b+x,m]),H=S.distanceTo(P);if(this.options.unit==="imperial"){const W=3.2808*H;W>5280?this._setScale(x,W/5280,"mile"):this._setScale(x,W,"foot")}else this.options.unit==="nautical"?this._setScale(x,H/1852,"nautical-mile"):H>=1e3?this._setScale(x,H/1e3,"kilometer"):this._setScale(x,H,"meter")}_setScale(x,a,m){const b=Ba(a),S=b/a;this._map._requestDomTask(()=>{this._container.style.width=x*S+"px",this._container.innerHTML=m!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"narrow",unit:m}).format(b):`${b} nm`})}onAdd(x){return this._map=x,this._language=x.getLanguage(),this._container=R("div","mapboxgl-ctrl mapboxgl-ctrl-scale",x.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(x){this._language=x,this._update()}setUnit(x){this.options.unit=x,this._update()}},FullscreenControl:class{constructor(x){this._fullscreen=!1,x&&x.container&&(x.container instanceof i.window.HTMLElement?this._container=x.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(x){return this._map=x,this._container||(this._container=this._map.getContainer()),this._controlContainer=R("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}_setupUI(){const x=this._fullscreenButton=R("button","mapboxgl-ctrl-fullscreen",this._controlContainer);R("span","mapboxgl-ctrl-icon",x).setAttribute("aria-hidden","true"),x.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const x=this._getTitle();this._fullscreenButton.setAttribute("aria-label",x),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",x)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(i.window.document.fullscreenElement||i.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends i.Evented{constructor(x){super(),this.options=i.extend(Object.create(Rr),x),i.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(x&&x.className?x.className.trim().split(/\s+/):[])}addTo(x){return this._map&&this.remove(),this._map=x,this.options.closeOnClick&&x.on("preclick",this._onClose),this.options.closeOnMove&&x.on("move",this._onClose),x.on("remove",this.remove),this._update(),x._addPopup(this),this._focusFirstElement(),this._trackPointer?(x.on("mousemove",this._onMouseEvent),x.on("mouseup",this._onMouseEvent),x._canvasContainer.classList.add("mapboxgl-track-pointer")):x.on("move",this._update),this.fire(new i.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const x=this._map;return x&&(x.off("move",this._update),x.off("move",this._onClose),x.off("preclick",this._onClose),x.off("click",this._onClose),x.off("remove",this.remove),x.off("mousemove",this._onMouseEvent),x.off("mouseup",this._onMouseEvent),x.off("drag",this._onMouseEvent),x._canvasContainer&&x._canvasContainer.classList.remove("mapboxgl-track-pointer"),x._removePopup(this),this._map=void 0),this.fire(new i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(x){this._lngLat=i.LngLat.convert(x),this._pos=null,this._trackPointer=!1,this._update();const a=this._map;return a&&(a.on("move",this._update),a.off("mousemove",this._onMouseEvent),a._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const x=this._map;return x&&(x.off("move",this._update),x.on("mousemove",this._onMouseEvent),x.on("drag",this._onMouseEvent),x._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(x){return this.setDOMContent(i.window.document.createTextNode(x))}setHTML(x){const a=i.window.document.createDocumentFragment(),m=i.window.document.createElement("body");let b;for(m.innerHTML=x;b=m.firstChild,b;)a.appendChild(b);return this.setDOMContent(a)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(x){return this.options.maxWidth=x,this._update(),this}setDOMContent(x){let a=this._content;if(a)for(;a.hasChildNodes();)a.firstChild&&a.removeChild(a.firstChild);else a=this._content=R("div","mapboxgl-popup-content",this._container||void 0);if(a.appendChild(x),this.options.closeButton){const m=this._closeButton=R("button","mapboxgl-popup-close-button",a);m.type="button",m.setAttribute("aria-label","Close popup"),m.setAttribute("aria-hidden","true"),m.innerHTML="×",m.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(x){return this._classList.add(x),this._updateClassList(),this}removeClassName(x){return this._classList.delete(x),this._updateClassList(),this}setOffset(x){return this.options.offset=x,this._update(),this}toggleClassName(x){let a;return this._classList.delete(x)?a=!1:(this._classList.add(x),a=!0),this._updateClassList(),a}_onMouseEvent(x){this._update(x.point)}_getAnchor(x){if(this.options.anchor)return this.options.anchor;const a=this._map,m=this._container,b=this._pos;if(!a||!m||!b)return"bottom";const S=m.offsetWidth,P=m.offsetHeight,H=b.x<S/2,W=b.x>a.transform.width-S/2;if(b.y+x<P)return H?"top-left":W?"top-right":"top";if(b.y>a.transform.height-P){if(H)return"bottom-left";if(W)return"bottom-right"}return H?"left":W?"right":"bottom"}_updateClassList(){const x=this._container;if(!x)return;const a=[...this._classList];a.push("mapboxgl-popup"),this._anchor&&a.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&a.push("mapboxgl-popup-track-pointer"),x.className=a.join(" ")}_update(x){const a=this._map,m=this._content;if(!a||!this._lngLat&&!this._trackPointer||!m)return;let b=this._container;if(b||(b=this._container=R("div","mapboxgl-popup",a.getContainer()),this._tip=R("div","mapboxgl-popup-tip",b),b.appendChild(m)),this.options.maxWidth&&b.style.maxWidth!==this.options.maxWidth&&(b.style.maxWidth=this.options.maxWidth),a.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ur(this._lngLat,this._pos,a.transform)),!this._trackPointer||x){const S=this._pos=this._trackPointer&&x?x:a.project(this._lngLat),P=Er(this.options.offset),H=this._anchor=this._getAnchor(P.y),W=Er(this.options.offset,H),ee=S.add(W).round();a._requestDomTask(()=>{this._container&&H&&(this._container.style.transform=`${Un[H]} translate(${ee.x}px,${ee.y}px)`)})}if(!this._marker&&a._showingGlobe()){const S=i.isLngLatBehindGlobe(a.transform,this._lngLat)?0:1;this._setOpacity(S)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const x=this._container.querySelector(Cr);x&&x.focus()}_onClose(){this.remove()}_setOpacity(x){this._container&&(this._container.style.opacity=`${x}`),this._content&&(this._content.style.pointerEvents=x?"auto":"none")}},Marker:Lr,Style:Ws,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:Vh,Evented:i.Evented,config:i.config,prewarm:function(){jt().acquire(Je)},clearPrewarmedResources:function(){const x=Lt;x&&(x.isPreloaded()&&x.numActive()===1?(x.release(Je),Lt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return i.config.ACCESS_TOKEN},set accessToken(x){i.config.ACCESS_TOKEN=x},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(x){i.config.API_URL=x},get workerCount(){return pt.workerCount},set workerCount(x){pt.workerCount=x},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(x){i.config.MAX_PARALLEL_IMAGE_REQUESTS=x},clearStorage(x){i.clearTileCache(x)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return $l});var y=c;return y})})(DF);const Tm=DF.exports,BV=`
- varying vec2 vUv;
- varying vec3 v3;
- varying vec3 v_color;
- attribute vec3 color;
- void main(){
- v_color = color;
- vUv = uv;
- // v3 = vec3((position.x+1.0) /2.0,(position.y+1.0) /2.0,(position.z+1.0) /2.0);
- // v3 = vec3((position.x+1.0) /2.0,(position.y+1.0) /2.0,(position.z+1.0) /2.0);
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }
- `,CV=`
- varying vec2 vUv;
- varying vec3 v3;
- uniform float iTime;
- uniform float opacity;
- uniform vec3 color;
- varying vec3 v_color;
- void main(){
- vec2 uv = vUv;
- // vec3 vv3 = vec3((v3.x+1.0) /2.0,(v3.y+1.0) /2.0,(v3.z+1.0) /2.0);
- // v3.x = (v3.x + 1.0) / 2.0;
- // float time = iTime * 0.3 + 0.0*0.01;
- // // To create the BG pattern
- // vec3 wave_color = vec3(0.0);
- // // To create the waves
- // float wave_width = 0.01;
- // // uv.y -= 0.5;
- //
- // for(float i = 0.0; i < 1.0; i++) {
- //
- // // uv.y += cos(i * 2.0 + iTime ) > 0.0 ? sin(i * 2.0 + iTime ) : -sin(i * 2.0 + iTime ) ;
- // // \u63A7\u5236\u7EBF\u6761\u8FD0\u52A8\u65B9\u5F0F\u3002 sin \u5185\u90E8\u63A7\u5236\u901F\u5EA6 \u5916\u9762\u63A7\u5236\u5E45\u5EA6
- // // uv.y += sin(i * 2.3 + iTime ) * 0.5 + 0.0 ; // 0 => 0.3 ,uv.y \u662F0-1\u533A\u95F4\u5185
- // // uv.y += 1.5;
- // // | uv.y | < 0.293 \u9010\u6B65\u663E\u793A > 0.293 \u9010\u6B65\u9690\u85CF
- // // uv.y = 0.293;
- // // \u63A7\u5236\u7EBF\u6761\u5BBD\u5EA6
- // wave_width = abs(1.0 / (40.0 * uv.y));
- // wave_color = vec3(wave_width , wave_width * 3.9, wave_width * 4.5);
- // }
- //
- // float random = ((wave_color.r + wave_color.g + wave_color.b) / 4.0) - 0.2;
- // // gl_FragColor = vec4(wave_color, random);
- // // uv.y += 0.5;
- // gl_FragColor = vec4(uv.y,0.0,0.0,1.0);
- gl_FragColor = vec4(v_color,opacity);
- }
- `;function EV(u){let e=[];return u.features.forEach(function(t){const r={geo:[],name:t.properties.name};r.name,e.push(r);const c=0;t.geometry.type==="Polygon"?(r.geo[0]=[],t.geometry.coordinates[0].forEach((p=[0,1,2])=>{p[0]=Tm.MercatorCoordinate.fromLngLat(p,c).x,p[1]=Tm.MercatorCoordinate.fromLngLat(p,c).y,p[2]=Tm.MercatorCoordinate.fromLngLat(p,c).z,r.geo[0].push(new Di(p[0],p[1]))})):t.geometry.type==="MultiPolygon"&&t.geometry.coordinates.forEach((p,y)=>{r.geo[y]=[],p[0].forEach(i=>{i[0]=Tm.MercatorCoordinate.fromLngLat(i,c).x,i[1]=Tm.MercatorCoordinate.fromLngLat(i,c).y,i[2]=Tm.MercatorCoordinate.fromLngLat(i,c).z,r.geo[y].push(new ft(i[0],i[1],i[2]))})})}),e}function tb(u){let e=new As;return e.name="geojson",EV(u)}var ic=63710088e-1,UF={centimeters:ic*100,centimetres:ic*100,degrees:ic/111325,feet:ic*3.28084,inches:ic*39.37,kilometers:ic/1e3,kilometres:ic/1e3,meters:ic,metres:ic,miles:ic/1609.344,millimeters:ic*1e3,millimetres:ic*1e3,nauticalmiles:ic/1852,radians:1,yards:ic*1.0936};function TV(u,e,t){t===void 0&&(t={});var r={type:"Feature"};return(t.id===0||t.id)&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.properties=e||{},r.geometry=u,r}function SV(u,e,t){if(t===void 0&&(t={}),!u)throw new Error("coordinates is required");if(!Array.isArray(u))throw new Error("coordinates must be an Array");if(u.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!tS(u[0])||!tS(u[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:u};return TV(r,e,t)}function MV(u,e){e===void 0&&(e="kilometers");var t=UF[e];if(!t)throw new Error(e+" units is invalid");return u*t}function IV(u,e){e===void 0&&(e="kilometers");var t=UF[e];if(!t)throw new Error(e+" units is invalid");return u/t}function _2(u){var e=u%(2*Math.PI);return e*180/Math.PI}function hu(u){var e=u%360;return e*Math.PI/180}function tS(u){return!isNaN(u)&&u!==null&&!Array.isArray(u)}function oy(u){if(!u)throw new Error("coord is required");if(!Array.isArray(u)){if(u.type==="Feature"&&u.geometry!==null&&u.geometry.type==="Point")return u.geometry.coordinates;if(u.type==="Point")return u.coordinates}if(Array.isArray(u)&&u.length>=2&&!Array.isArray(u[0])&&!Array.isArray(u[1]))return u;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function RF(u,e,t){t===void 0&&(t={});var r=oy(u),c=oy(e),p=hu(c[1]-r[1]),y=hu(c[0]-r[0]),i=hu(r[1]),C=hu(c[1]),D=Math.pow(Math.sin(p/2),2)+Math.pow(Math.sin(y/2),2)*Math.cos(i)*Math.cos(C);return MV(2*Math.atan2(Math.sqrt(D),Math.sqrt(1-D)),t.units)}function FV(u,e,t,r){r===void 0&&(r={});var c=oy(u),p=hu(c[0]),y=hu(c[1]),i=hu(t),C=IV(e,r.units),D=Math.asin(Math.sin(y)*Math.cos(C)+Math.cos(y)*Math.sin(C)*Math.cos(i)),U=p+Math.atan2(Math.sin(i)*Math.sin(C)*Math.cos(y),Math.cos(C)-Math.sin(y)*Math.sin(D)),N=_2(U),R=_2(D);return SV([N,R],r.properties)}function zF(u,e,t){if(t===void 0&&(t={}),t.final===!0)return LV(u,e);var r=oy(u),c=oy(e),p=hu(r[0]),y=hu(c[0]),i=hu(r[1]),C=hu(c[1]),D=Math.sin(y-p)*Math.cos(C),U=Math.cos(i)*Math.sin(C)-Math.sin(i)*Math.cos(C)*Math.cos(y-p);return _2(Math.atan2(D,U))}function LV(u,e){var t=zF(e,u);return t=(t+180)%360,t}function DV(u,e){var t=RF(u,e),r=zF(u,e),c=FV(u,t/2,r);return c}var vv={exports:{}};/*!
- * Knockout JavaScript library v3.5.1
- * (c) The Knockout.js team - http://knockoutjs.com/
- * License: MIT (http://www.opensource.org/licenses/mit-license.php)
- */(function(u,e){(function(){(function(t){var r=this||(0,eval)("this"),c=r.document,p=r.navigator,y=r.jQuery,i=r.JSON;y||typeof jQuery>"u"||(y=jQuery),function(C){C(u.exports||e)}(function(C,D){function U(te,ce){return te===null||typeof te in ae?te===ce:!1}function N(te,ce){var ye;return function(){ye||(ye=B.a.setTimeout(function(){ye=t,te()},ce))}}function R(te,ce){var ye;return function(){clearTimeout(ye),ye=B.a.setTimeout(te,ce)}}function G(te,ce){ce&&ce!=="change"?ce==="beforeChange"?this.pc(te):this.gb(te,ce):this.qc(te)}function J(te,ce){ce!==null&&ce.s&&ce.s()}function Y(te,ce){var ye=this.qd,xe=ye[Pe];xe.ra||(this.Qb&&this.mb[ce]?(ye.uc(ce,te,this.mb[ce]),this.mb[ce]=null,--this.Qb):xe.I[ce]||ye.uc(ce,te,xe.J?{da:te}:ye.$c(te)),te.Ja&&te.gd())}var B=typeof C<"u"?C:{};B.b=function(te,ce){for(var ye=te.split("."),xe=B,ze=0;ze<ye.length-1;ze++)xe=xe[ye[ze]];xe[ye[ye.length-1]]=ce},B.L=function(te,ce,ye){te[ce]=ye},B.version="3.5.1",B.b("version",B.version),B.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},B.a=function(){function te(Be,dt){for(var ut in Be)ze.call(Be,ut)&&dt(ut,Be[ut])}function ce(Be,dt){if(dt)for(var ut in dt)ze.call(dt,ut)&&(Be[ut]=dt[ut]);return Be}function ye(Be,dt){return Be.__proto__=dt,Be}function xe(Be,dt,ut,Qt){var Wt=Be[dt].match(et)||[];B.a.D(ut.match(et),function(Nt){B.a.Na(Wt,Nt,Qt)}),Be[dt]=Wt.join(" ")}var ze=Object.prototype.hasOwnProperty,Ne={__proto__:[]}instanceof Array,Ge=typeof Symbol=="function",Ve={},Le={};Ve[p&&/Firefox\/2/i.test(p.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],Ve.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),te(Ve,function(Be,dt){if(dt.length)for(var ut=0,Qt=dt.length;ut<Qt;ut++)Le[dt[ut]]=Be});var Ie={propertychange:!0},qe=c&&function(){for(var Be=3,dt=c.createElement("div"),ut=dt.getElementsByTagName("i");dt.innerHTML="<!--[if gt IE "+ ++Be+"]><i></i><![endif]-->",ut[0];);return 4<Be?Be:t}(),et=/\S+/g,vt;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(Be,dt,ut){for(var Qt=0,Wt=Be.length;Qt<Wt;Qt++)dt.call(ut,Be[Qt],Qt,Be)},A:typeof Array.prototype.indexOf=="function"?function(Be,dt){return Array.prototype.indexOf.call(Be,dt)}:function(Be,dt){for(var ut=0,Qt=Be.length;ut<Qt;ut++)if(Be[ut]===dt)return ut;return-1},Lb:function(Be,dt,ut){for(var Qt=0,Wt=Be.length;Qt<Wt;Qt++)if(dt.call(ut,Be[Qt],Qt,Be))return Be[Qt];return t},Pa:function(Be,dt){var ut=B.a.A(Be,dt);0<ut?Be.splice(ut,1):ut===0&&Be.shift()},wc:function(Be){var dt=[];return Be&&B.a.D(Be,function(ut){0>B.a.A(dt,ut)&&dt.push(ut)}),dt},Mb:function(Be,dt,ut){var Qt=[];if(Be)for(var Wt=0,Nt=Be.length;Wt<Nt;Wt++)Qt.push(dt.call(ut,Be[Wt],Wt));return Qt},jb:function(Be,dt,ut){var Qt=[];if(Be)for(var Wt=0,Nt=Be.length;Wt<Nt;Wt++)dt.call(ut,Be[Wt],Wt)&&Qt.push(Be[Wt]);return Qt},Nb:function(Be,dt){if(dt instanceof Array)Be.push.apply(Be,dt);else for(var ut=0,Qt=dt.length;ut<Qt;ut++)Be.push(dt[ut]);return Be},Na:function(Be,dt,ut){var Qt=B.a.A(B.a.bc(Be),dt);0>Qt?ut&&Be.push(dt):ut||Be.splice(Qt,1)},Ba:Ne,extend:ce,setPrototypeOf:ye,Ab:Ne?ye:ce,P:te,Ga:function(Be,dt,ut){if(!Be)return Be;var Qt={},Wt;for(Wt in Be)ze.call(Be,Wt)&&(Qt[Wt]=dt.call(ut,Be[Wt],Wt,Be));return Qt},Tb:function(Be){for(;Be.firstChild;)B.removeNode(Be.firstChild)},Yb:function(Be){Be=B.a.la(Be);for(var dt=(Be[0]&&Be[0].ownerDocument||c).createElement("div"),ut=0,Qt=Be.length;ut<Qt;ut++)dt.appendChild(B.oa(Be[ut]));return dt},Ca:function(Be,dt){for(var ut=0,Qt=Be.length,Wt=[];ut<Qt;ut++){var Nt=Be[ut].cloneNode(!0);Wt.push(dt?B.oa(Nt):Nt)}return Wt},va:function(Be,dt){if(B.a.Tb(Be),dt)for(var ut=0,Qt=dt.length;ut<Qt;ut++)Be.appendChild(dt[ut])},Xc:function(Be,dt){var ut=Be.nodeType?[Be]:Be;if(0<ut.length){for(var Qt=ut[0],Wt=Qt.parentNode,Nt=0,Ct=dt.length;Nt<Ct;Nt++)Wt.insertBefore(dt[Nt],Qt);for(Nt=0,Ct=ut.length;Nt<Ct;Nt++)B.removeNode(ut[Nt])}},Ua:function(Be,dt){if(Be.length){for(dt=dt.nodeType===8&&dt.parentNode||dt;Be.length&&Be[0].parentNode!==dt;)Be.splice(0,1);for(;1<Be.length&&Be[Be.length-1].parentNode!==dt;)Be.length--;if(1<Be.length){var ut=Be[0],Qt=Be[Be.length-1];for(Be.length=0;ut!==Qt;)Be.push(ut),ut=ut.nextSibling;Be.push(Qt)}}return Be},Zc:function(Be,dt){7>qe?Be.setAttribute("selected",dt):Be.selected=dt},Db:function(Be){return Be===null||Be===t?"":Be.trim?Be.trim():Be.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(Be,dt){return Be=Be||"",dt.length>Be.length?!1:Be.substring(0,dt.length)===dt},vd:function(Be,dt){if(Be===dt)return!0;if(Be.nodeType===11)return!1;if(dt.contains)return dt.contains(Be.nodeType!==1?Be.parentNode:Be);if(dt.compareDocumentPosition)return(dt.compareDocumentPosition(Be)&16)==16;for(;Be&&Be!=dt;)Be=Be.parentNode;return!!Be},Sb:function(Be){return B.a.vd(Be,Be.ownerDocument.documentElement)},kd:function(Be){return!!B.a.Lb(Be,B.a.Sb)},R:function(Be){return Be&&Be.tagName&&Be.tagName.toLowerCase()},Ac:function(Be){return B.onError?function(){try{return Be.apply(this,arguments)}catch(dt){throw B.onError&&B.onError(dt),dt}}:Be},setTimeout:function(Be,dt){return setTimeout(B.a.Ac(Be),dt)},Gc:function(Be){setTimeout(function(){throw B.onError&&B.onError(Be),Be},0)},B:function(Be,dt,ut){var Qt=B.a.Ac(ut);if(ut=Ie[dt],B.options.useOnlyNativeEvents||ut||!y)if(ut||typeof Be.addEventListener!="function")if(typeof Be.attachEvent<"u"){var Wt=function(Ct){Qt.call(Be,Ct)},Nt="on"+dt;Be.attachEvent(Nt,Wt),B.a.K.za(Be,function(){Be.detachEvent(Nt,Wt)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else Be.addEventListener(dt,Qt,!1);else vt||(vt=typeof y(Be).on=="function"?"on":"bind"),y(Be)[vt](dt,Qt)},Fb:function(Be,dt){if(!Be||!Be.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var ut;if(B.a.R(Be)==="input"&&Be.type&&dt.toLowerCase()=="click"?(ut=Be.type,ut=ut=="checkbox"||ut=="radio"):ut=!1,B.options.useOnlyNativeEvents||!y||ut)if(typeof c.createEvent=="function")if(typeof Be.dispatchEvent=="function")ut=c.createEvent(Le[dt]||"HTMLEvents"),ut.initEvent(dt,!0,!0,r,0,0,0,0,0,!1,!1,!1,!1,0,Be),Be.dispatchEvent(ut);else throw Error("The supplied element doesn't support dispatchEvent");else if(ut&&Be.click)Be.click();else if(typeof Be.fireEvent<"u")Be.fireEvent("on"+dt);else throw Error("Browser doesn't support triggering events");else y(Be).trigger(dt)},f:function(Be){return B.O(Be)?Be():Be},bc:function(Be){return B.O(Be)?Be.v():Be},Eb:function(Be,dt,ut){var Qt;dt&&(typeof Be.classList=="object"?(Qt=Be.classList[ut?"add":"remove"],B.a.D(dt.match(et),function(Wt){Qt.call(Be.classList,Wt)})):typeof Be.className.baseVal=="string"?xe(Be.className,"baseVal",dt,ut):xe(Be,"className",dt,ut))},Bb:function(Be,dt){var ut=B.a.f(dt);(ut===null||ut===t)&&(ut="");var Qt=B.h.firstChild(Be);!Qt||Qt.nodeType!=3||B.h.nextSibling(Qt)?B.h.va(Be,[Be.ownerDocument.createTextNode(ut)]):Qt.data=ut,B.a.Ad(Be)},Yc:function(Be,dt){if(Be.name=dt,7>=qe)try{var ut=Be.name.replace(/[&<>'"]/g,function(Qt){return"&#"+Qt.charCodeAt(0)+";"});Be.mergeAttributes(c.createElement("<input name='"+ut+"'/>"),!1)}catch{}},Ad:function(Be){9<=qe&&(Be=Be.nodeType==1?Be:Be.parentNode,Be.style&&(Be.style.zoom=Be.style.zoom))},wd:function(Be){if(qe){var dt=Be.style.width;Be.style.width=0,Be.style.width=dt}},Pd:function(Be,dt){Be=B.a.f(Be),dt=B.a.f(dt);for(var ut=[],Qt=Be;Qt<=dt;Qt++)ut.push(Qt);return ut},la:function(Be){for(var dt=[],ut=0,Qt=Be.length;ut<Qt;ut++)dt.push(Be[ut]);return dt},Da:function(Be){return Ge?Symbol(Be):Be},Zd:qe===6,$d:qe===7,W:qe,Lc:function(Be,dt){for(var ut=B.a.la(Be.getElementsByTagName("input")).concat(B.a.la(Be.getElementsByTagName("textarea"))),Qt=typeof dt=="string"?function(Ct){return Ct.name===dt}:function(Ct){return dt.test(Ct.name)},Wt=[],Nt=ut.length-1;0<=Nt;Nt--)Qt(ut[Nt])&&Wt.push(ut[Nt]);return Wt},Nd:function(Be){return typeof Be=="string"&&(Be=B.a.Db(Be))?i&&i.parse?i.parse(Be):new Function("return "+Be)():null},hc:function(Be,dt,ut){if(!i||!i.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return i.stringify(B.a.f(Be),dt,ut)},Od:function(Be,dt,ut){ut=ut||{};var Qt=ut.params||{},Wt=ut.includeFields||this.Jc,Nt=Be;if(typeof Be=="object"&&B.a.R(Be)==="form")for(var Nt=Be.action,Ct=Wt.length-1;0<=Ct;Ct--)for(var Ft=B.a.Lc(Be,Wt[Ct]),Xt=Ft.length-1;0<=Xt;Xt--)Qt[Ft[Xt].name]=Ft[Xt].value;dt=B.a.f(dt);var mi=c.createElement("form");mi.style.display="none",mi.action=Nt,mi.method="post";for(var fi in dt)Be=c.createElement("input"),Be.type="hidden",Be.name=fi,Be.value=B.a.hc(B.a.f(dt[fi])),mi.appendChild(Be);te(Qt,function(Gi,wn){var Qi=c.createElement("input");Qi.type="hidden",Qi.name=Gi,Qi.value=wn,mi.appendChild(Qi)}),c.body.appendChild(mi),ut.submitter?ut.submitter(mi):mi.submit(),setTimeout(function(){mi.parentNode.removeChild(mi)},0)}}}(),B.b("utils",B.a),B.b("utils.arrayForEach",B.a.D),B.b("utils.arrayFirst",B.a.Lb),B.b("utils.arrayFilter",B.a.jb),B.b("utils.arrayGetDistinctValues",B.a.wc),B.b("utils.arrayIndexOf",B.a.A),B.b("utils.arrayMap",B.a.Mb),B.b("utils.arrayPushAll",B.a.Nb),B.b("utils.arrayRemoveItem",B.a.Pa),B.b("utils.cloneNodes",B.a.Ca),B.b("utils.createSymbolOrString",B.a.Da),B.b("utils.extend",B.a.extend),B.b("utils.fieldsIncludedWithJsonPost",B.a.Jc),B.b("utils.getFormFields",B.a.Lc),B.b("utils.objectMap",B.a.Ga),B.b("utils.peekObservable",B.a.bc),B.b("utils.postJson",B.a.Od),B.b("utils.parseJson",B.a.Nd),B.b("utils.registerEventHandler",B.a.B),B.b("utils.stringifyJson",B.a.hc),B.b("utils.range",B.a.Pd),B.b("utils.toggleDomNodeCssClass",B.a.Eb),B.b("utils.triggerEvent",B.a.Fb),B.b("utils.unwrapObservable",B.a.f),B.b("utils.objectForEach",B.a.P),B.b("utils.addOrRemoveItem",B.a.Na),B.b("utils.setTextContent",B.a.Bb),B.b("unwrap",B.a.f),Function.prototype.bind||(Function.prototype.bind=function(te){var ce=this;if(arguments.length===1)return function(){return ce.apply(te,arguments)};var ye=Array.prototype.slice.call(arguments,1);return function(){var xe=ye.slice(0);return xe.push.apply(xe,arguments),ce.apply(te,xe)}}),B.a.g=new function(){var te=0,ce="__ko__"+new Date().getTime(),ye={},xe,ze;return B.a.W?(xe=function(Ne,Ge){var Ve=Ne[ce];if(!Ve||Ve==="null"||!ye[Ve]){if(!Ge)return t;Ve=Ne[ce]="ko"+te++,ye[Ve]={}}return ye[Ve]},ze=function(Ne){var Ge=Ne[ce];return Ge?(delete ye[Ge],Ne[ce]=null,!0):!1}):(xe=function(Ne,Ge){var Ve=Ne[ce];return!Ve&&Ge&&(Ve=Ne[ce]={}),Ve},ze=function(Ne){return Ne[ce]?(delete Ne[ce],!0):!1}),{get:function(Ne,Ge){var Ve=xe(Ne,!1);return Ve&&Ve[Ge]},set:function(Ne,Ge,Ve){(Ne=xe(Ne,Ve!==t))&&(Ne[Ge]=Ve)},Ub:function(Ne,Ge,Ve){return Ne=xe(Ne,!0),Ne[Ge]||(Ne[Ge]=Ve)},clear:ze,Z:function(){return te+++ce}}},B.b("utils.domData",B.a.g),B.b("utils.domData.clear",B.a.g.clear),B.a.K=new function(){function te(Ge,Ve){var Le=B.a.g.get(Ge,xe);return Le===t&&Ve&&(Le=[],B.a.g.set(Ge,xe,Le)),Le}function ce(Ge){var Ve=te(Ge,!1);if(Ve)for(var Ve=Ve.slice(0),Le=0;Le<Ve.length;Le++)Ve[Le](Ge);B.a.g.clear(Ge),B.a.K.cleanExternalData(Ge),Ne[Ge.nodeType]&&ye(Ge.childNodes,!0)}function ye(Ge,Ve){for(var Le=[],Ie,qe=0;qe<Ge.length;qe++)if((!Ve||Ge[qe].nodeType===8)&&(ce(Le[Le.length]=Ie=Ge[qe]),Ge[qe]!==Ie))for(;qe--&&B.a.A(Le,Ge[qe])==-1;);}var xe=B.a.g.Z(),ze={1:!0,8:!0,9:!0},Ne={1:!0,9:!0};return{za:function(Ge,Ve){if(typeof Ve!="function")throw Error("Callback must be a function");te(Ge,!0).push(Ve)},yb:function(Ge,Ve){var Le=te(Ge,!1);Le&&(B.a.Pa(Le,Ve),Le.length==0&&B.a.g.set(Ge,xe,t))},oa:function(Ge){return B.u.G(function(){ze[Ge.nodeType]&&(ce(Ge),Ne[Ge.nodeType]&&ye(Ge.getElementsByTagName("*")))}),Ge},removeNode:function(Ge){B.oa(Ge),Ge.parentNode&&Ge.parentNode.removeChild(Ge)},cleanExternalData:function(Ge){y&&typeof y.cleanData=="function"&&y.cleanData([Ge])}}},B.oa=B.a.K.oa,B.removeNode=B.a.K.removeNode,B.b("cleanNode",B.oa),B.b("removeNode",B.removeNode),B.b("utils.domNodeDisposal",B.a.K),B.b("utils.domNodeDisposal.addDisposeCallback",B.a.K.za),B.b("utils.domNodeDisposal.removeDisposeCallback",B.a.K.yb),function(){var te=[0,"",""],ce=[1,"<table>","</table>"],ye=[3,"<table><tbody><tr>","</tr></tbody></table>"],xe=[1,"<select multiple='multiple'>","</select>"],ze={thead:ce,tbody:ce,tfoot:ce,tr:[2,"<table><tbody>","</tbody></table>"],td:ye,th:ye,option:xe,optgroup:xe},Ne=8>=B.a.W;B.a.ua=function(Ge,Ve){var Le;if(y){if(y.parseHTML)Le=y.parseHTML(Ge,Ve)||[];else if((Le=y.clean([Ge],Ve))&&Le[0]){for(var Ie=Le[0];Ie.parentNode&&Ie.parentNode.nodeType!==11;)Ie=Ie.parentNode;Ie.parentNode&&Ie.parentNode.removeChild(Ie)}}else{(Le=Ve)||(Le=c);var Ie=Le.parentWindow||Le.defaultView||r,qe=B.a.Db(Ge).toLowerCase(),et=Le.createElement("div"),vt;for(vt=(qe=qe.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&ze[qe[1]]||te,qe=vt[0],vt="ignored<div>"+vt[1]+Ge+vt[2]+"</div>",typeof Ie.innerShiv=="function"?et.appendChild(Ie.innerShiv(vt)):(Ne&&Le.body.appendChild(et),et.innerHTML=vt,Ne&&et.parentNode.removeChild(et));qe--;)et=et.lastChild;Le=B.a.la(et.lastChild.childNodes)}return Le},B.a.Md=function(Ge,Ve){var Le=B.a.ua(Ge,Ve);return Le.length&&Le[0].parentElement||B.a.Yb(Le)},B.a.fc=function(Ge,Ve){if(B.a.Tb(Ge),Ve=B.a.f(Ve),Ve!==null&&Ve!==t)if(typeof Ve!="string"&&(Ve=Ve.toString()),y)y(Ge).html(Ve);else for(var Le=B.a.ua(Ve,Ge.ownerDocument),Ie=0;Ie<Le.length;Ie++)Ge.appendChild(Le[Ie])}}(),B.b("utils.parseHtmlFragment",B.a.ua),B.b("utils.setHtml",B.a.fc),B.aa=function(){function te(ye,xe){if(ye){if(ye.nodeType==8){var ze=B.aa.Uc(ye.nodeValue);ze!=null&&xe.push({ud:ye,Kd:ze})}else if(ye.nodeType==1)for(var ze=0,Ne=ye.childNodes,Ge=Ne.length;ze<Ge;ze++)te(Ne[ze],xe)}}var ce={};return{Xb:function(ye){if(typeof ye!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var xe=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return ce[xe]=ye,"<!--[ko_memo:"+xe+"]-->"},bd:function(ye,xe){var ze=ce[ye];if(ze===t)throw Error("Couldn't find any memo with ID "+ye+". Perhaps it's already been unmemoized.");try{return ze.apply(null,xe||[]),!0}finally{delete ce[ye]}},cd:function(ye,xe){var ze=[];te(ye,ze);for(var Ne=0,Ge=ze.length;Ne<Ge;Ne++){var Ve=ze[Ne].ud,Le=[Ve];xe&&B.a.Nb(Le,xe),B.aa.bd(ze[Ne].Kd,Le),Ve.nodeValue="",Ve.parentNode&&Ve.parentNode.removeChild(Ve)}},Uc:function(ye){return(ye=ye.match(/^\[ko_memo\:(.*?)\]$/))?ye[1]:null}}}(),B.b("memoization",B.aa),B.b("memoization.memoize",B.aa.Xb),B.b("memoization.unmemoize",B.aa.bd),B.b("memoization.parseMemoText",B.aa.Uc),B.b("memoization.unmemoizeDomNodeAndDescendants",B.aa.cd),B.na=function(){function te(){if(ze){for(var Ve=ze,Le=0,Ie;Ge<ze;)if(Ie=xe[Ge++]){if(Ge>Ve){if(5e3<=++Le){Ge=ze,B.a.Gc(Error("'Too much recursion' after processing "+Le+" task groups."));break}Ve=ze}try{Ie()}catch(qe){B.a.Gc(qe)}}}}function ce(){te(),Ge=ze=xe.length=0}var ye,xe=[],ze=0,Ne=1,Ge=0;return r.MutationObserver?ye=function(Ve){var Le=c.createElement("div");return new MutationObserver(Ve).observe(Le,{attributes:!0}),function(){Le.classList.toggle("foo")}}(ce):ye=c&&"onreadystatechange"in c.createElement("script")?function(Ve){var Le=c.createElement("script");Le.onreadystatechange=function(){Le.onreadystatechange=null,c.documentElement.removeChild(Le),Le=null,Ve()},c.documentElement.appendChild(Le)}:function(Ve){setTimeout(Ve,0)},{scheduler:ye,zb:function(Ve){return ze||B.na.scheduler(ce),xe[ze++]=Ve,Ne++},cancel:function(Ve){Ve=Ve-(Ne-ze),Ve>=Ge&&Ve<ze&&(xe[Ve]=null)},resetForTesting:function(){var Ve=ze-Ge;return Ge=ze=xe.length=0,Ve},Sd:te}}(),B.b("tasks",B.na),B.b("tasks.schedule",B.na.zb),B.b("tasks.runEarly",B.na.Sd),B.Ta={throttle:function(te,ce){te.throttleEvaluation=ce;var ye=null;return B.$({read:te,write:function(xe){clearTimeout(ye),ye=B.a.setTimeout(function(){te(xe)},ce)}})},rateLimit:function(te,ce){var ye,xe,ze;typeof ce=="number"?ye=ce:(ye=ce.timeout,xe=ce.method),te.Hb=!1,ze=typeof xe=="function"?xe:xe=="notifyWhenChangesStop"?R:N,te.ub(function(Ne){return ze(Ne,ye,ce)})},deferred:function(te,ce){if(ce!==!0)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");te.Hb||(te.Hb=!0,te.ub(function(ye){var xe,ze=!1;return function(){if(!ze){B.na.cancel(xe),xe=B.na.zb(ye);try{ze=!0,te.notifySubscribers(t,"dirty")}finally{ze=!1}}}}))},notify:function(te,ce){te.equalityComparer=ce=="always"?null:U}};var ae={undefined:1,boolean:1,number:1,string:1};B.b("extenders",B.Ta),B.ic=function(te,ce,ye){this.da=te,this.lc=ce,this.mc=ye,this.Ib=!1,this.fb=this.Jb=null,B.L(this,"dispose",this.s),B.L(this,"disposeWhenNodeIsRemoved",this.l)},B.ic.prototype.s=function(){this.Ib||(this.fb&&B.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},B.ic.prototype.l=function(te){this.Jb=te,B.a.K.za(te,this.fb=this.s.bind(this))},B.T=function(){B.a.Ab(this,le),le.qb(this)};var le={qb:function(te){te.U={change:[]},te.sc=1},subscribe:function(te,ce,ye){var xe=this;ye=ye||"change";var ze=new B.ic(xe,ce?te.bind(ce):te,function(){B.a.Pa(xe.U[ye],ze),xe.hb&&xe.hb(ye)});return xe.Qa&&xe.Qa(ye),xe.U[ye]||(xe.U[ye]=[]),xe.U[ye].push(ze),ze},notifySubscribers:function(te,ce){if(ce=ce||"change",ce==="change"&&this.Gb(),this.Wa(ce)){var ye=ce==="change"&&this.ed||this.U[ce].slice(0);try{B.u.xc();for(var xe=0,ze;ze=ye[xe];++xe)ze.Ib||ze.lc(te)}finally{B.u.end()}}},ob:function(){return this.sc},Dd:function(te){return this.ob()!==te},Gb:function(){++this.sc},ub:function(te){var ce=this,ye=B.O(ce),xe,ze,Ne,Ge,Ve;ce.gb||(ce.gb=ce.notifySubscribers,ce.notifySubscribers=G);var Le=te(function(){ce.Ja=!1,ye&&Ge===ce&&(Ge=ce.nc?ce.nc():ce());var Ie=ze||Ve&&ce.sb(Ne,Ge);Ve=ze=xe=!1,Ie&&ce.gb(Ne=Ge)});ce.qc=function(Ie,qe){qe&&ce.Ja||(Ve=!qe),ce.ed=ce.U.change.slice(0),ce.Ja=xe=!0,Ge=Ie,Le()},ce.pc=function(Ie){xe||(Ne=Ie,ce.gb(Ie,"beforeChange"))},ce.rc=function(){Ve=!0},ce.gd=function(){ce.sb(Ne,ce.v(!0))&&(ze=!0)}},Wa:function(te){return this.U[te]&&this.U[te].length},Bd:function(te){if(te)return this.U[te]&&this.U[te].length||0;var ce=0;return B.a.P(this.U,function(ye,xe){ye!=="dirty"&&(ce+=xe.length)}),ce},sb:function(te,ce){return!this.equalityComparer||!this.equalityComparer(te,ce)},toString:function(){return"[object Object]"},extend:function(te){var ce=this;return te&&B.a.P(te,function(ye,xe){var ze=B.Ta[ye];typeof ze=="function"&&(ce=ze(ce,xe)||ce)}),ce}};B.L(le,"init",le.qb),B.L(le,"subscribe",le.subscribe),B.L(le,"extend",le.extend),B.L(le,"getSubscriptionsCount",le.Bd),B.a.Ba&&B.a.setPrototypeOf(le,Function.prototype),B.T.fn=le,B.Qc=function(te){return te!=null&&typeof te.subscribe=="function"&&typeof te.notifySubscribers=="function"},B.b("subscribable",B.T),B.b("isSubscribable",B.Qc),B.S=B.u=function(){function te(Ne){ye.push(xe),xe=Ne}function ce(){xe=ye.pop()}var ye=[],xe,ze=0;return{xc:te,end:ce,cc:function(Ne){if(xe){if(!B.Qc(Ne))throw Error("Only subscribable things can act as dependencies");xe.od.call(xe.pd,Ne,Ne.fd||(Ne.fd=++ze))}},G:function(Ne,Ge,Ve){try{return te(),Ne.apply(Ge,Ve||[])}finally{ce()}},qa:function(){if(xe)return xe.o.qa()},Va:function(){if(xe)return xe.o.Va()},Ya:function(){if(xe)return xe.Ya},o:function(){if(xe)return xe.o}}}(),B.b("computedContext",B.S),B.b("computedContext.getDependenciesCount",B.S.qa),B.b("computedContext.getDependencies",B.S.Va),B.b("computedContext.isInitial",B.S.Ya),B.b("computedContext.registerDependency",B.S.cc),B.b("ignoreDependencies",B.Yd=B.u.G);var Ae=B.a.Da("_latestValue");B.ta=function(te){function ce(){return 0<arguments.length?(ce.sb(ce[Ae],arguments[0])&&(ce.ya(),ce[Ae]=arguments[0],ce.xa()),this):(B.u.cc(ce),ce[Ae])}return ce[Ae]=te,B.a.Ba||B.a.extend(ce,B.T.fn),B.T.fn.qb(ce),B.a.Ab(ce,we),B.options.deferUpdates&&B.Ta.deferred(ce,!0),ce};var we={equalityComparer:U,v:function(){return this[Ae]},xa:function(){this.notifySubscribers(this[Ae],"spectate"),this.notifySubscribers(this[Ae])},ya:function(){this.notifySubscribers(this[Ae],"beforeChange")}};B.a.Ba&&B.a.setPrototypeOf(we,B.T.fn);var me=B.ta.Ma="__ko_proto__";we[me]=B.ta,B.O=function(te){if((te=typeof te=="function"&&te[me])&&te!==we[me]&&te!==B.o.fn[me])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!te},B.Za=function(te){return typeof te=="function"&&(te[me]===we[me]||te[me]===B.o.fn[me]&&te.Nc)},B.b("observable",B.ta),B.b("isObservable",B.O),B.b("isWriteableObservable",B.Za),B.b("isWritableObservable",B.Za),B.b("observable.fn",we),B.L(we,"peek",we.v),B.L(we,"valueHasMutated",we.xa),B.L(we,"valueWillMutate",we.ya),B.Ha=function(te){if(te=te||[],typeof te!="object"||!("length"in te))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return te=B.ta(te),B.a.Ab(te,B.Ha.fn),te.extend({trackArrayChanges:!0})},B.Ha.fn={remove:function(te){for(var ce=this.v(),ye=[],xe=typeof te!="function"||B.O(te)?function(Ge){return Ge===te}:te,ze=0;ze<ce.length;ze++){var Ne=ce[ze];if(xe(Ne)){if(ye.length===0&&this.ya(),ce[ze]!==Ne)throw Error("Array modified during remove; cannot remove item");ye.push(Ne),ce.splice(ze,1),ze--}}return ye.length&&this.xa(),ye},removeAll:function(te){if(te===t){var ce=this.v(),ye=ce.slice(0);return this.ya(),ce.splice(0,ce.length),this.xa(),ye}return te?this.remove(function(xe){return 0<=B.a.A(te,xe)}):[]},destroy:function(te){var ce=this.v(),ye=typeof te!="function"||B.O(te)?function(Ne){return Ne===te}:te;this.ya();for(var xe=ce.length-1;0<=xe;xe--){var ze=ce[xe];ye(ze)&&(ze._destroy=!0)}this.xa()},destroyAll:function(te){return te===t?this.destroy(function(){return!0}):te?this.destroy(function(ce){return 0<=B.a.A(te,ce)}):[]},indexOf:function(te){var ce=this();return B.a.A(ce,te)},replace:function(te,ce){var ye=this.indexOf(te);0<=ye&&(this.ya(),this.v()[ye]=ce,this.xa())},sorted:function(te){var ce=this().slice(0);return te?ce.sort(te):ce.sort()},reversed:function(){return this().slice(0).reverse()}},B.a.Ba&&B.a.setPrototypeOf(B.Ha.fn,B.ta.fn),B.a.D("pop push reverse shift sort splice unshift".split(" "),function(te){B.Ha.fn[te]=function(){var ce=this.v();this.ya(),this.zc(ce,te,arguments);var ye=ce[te].apply(ce,arguments);return this.xa(),ye===ce?this:ye}}),B.a.D(["slice"],function(te){B.Ha.fn[te]=function(){var ce=this();return ce[te].apply(ce,arguments)}}),B.Pc=function(te){return B.O(te)&&typeof te.remove=="function"&&typeof te.push=="function"},B.b("observableArray",B.Ha),B.b("isObservableArray",B.Pc),B.Ta.trackArrayChanges=function(te,ce){function ye(){function et(){if(Ve){var vt=[].concat(te.v()||[]),Be;te.Wa("arrayChange")&&((!ze||1<Ve)&&(ze=B.a.Pb(Le,vt,te.Ob)),Be=ze),Le=vt,ze=null,Ve=0,Be&&Be.length&&te.notifySubscribers(Be,"arrayChange")}}xe?et():(xe=!0,Ge=te.subscribe(function(){++Ve},null,"spectate"),Le=[].concat(te.v()||[]),ze=null,Ne=te.subscribe(et))}if(te.Ob={},ce&&typeof ce=="object"&&B.a.extend(te.Ob,ce),te.Ob.sparse=!0,!te.zc){var xe=!1,ze=null,Ne,Ge,Ve=0,Le,Ie=te.Qa,qe=te.hb;te.Qa=function(et){Ie&&Ie.call(te,et),et==="arrayChange"&&ye()},te.hb=function(et){qe&&qe.call(te,et),et!=="arrayChange"||te.Wa("arrayChange")||(Ne&&Ne.s(),Ge&&Ge.s(),Ge=Ne=null,xe=!1,Le=t)},te.zc=function(et,vt,Be){function dt(mi,fi,Gi){return ut[ut.length]={status:mi,value:fi,index:Gi}}if(xe&&!Ve){var ut=[],Qt=et.length,Wt=Be.length,Nt=0;switch(vt){case"push":Nt=Qt;case"unshift":for(vt=0;vt<Wt;vt++)dt("added",Be[vt],Nt+vt);break;case"pop":Nt=Qt-1;case"shift":Qt&&dt("deleted",et[Nt],Nt);break;case"splice":vt=Math.min(Math.max(0,0>Be[0]?Qt+Be[0]:Be[0]),Qt);for(var Qt=Wt===1?Qt:Math.min(vt+(Be[1]||0),Qt),Wt=vt+Wt-2,Nt=Math.max(Qt,Wt),Ct=[],Ft=[],Xt=2;vt<Nt;++vt,++Xt)vt<Qt&&Ft.push(dt("deleted",et[vt],vt)),vt<Wt&&Ct.push(dt("added",Be[Xt],vt));B.a.Kc(Ft,Ct);break;default:return}ze=ut}}}};var Pe=B.a.Da("_state");B.o=B.$=function(te,ce,ye){function xe(){if(0<arguments.length){if(typeof ze=="function")ze.apply(Ne.nb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}return Ne.ra||B.u.cc(xe),(Ne.ka||Ne.J&&xe.Xa())&&xe.ha(),Ne.X}if(typeof te=="object"?ye=te:(ye=ye||{},te&&(ye.read=te)),typeof ye.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var ze=ye.write,Ne={X:t,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:ye.read,nb:ce||ye.owner,l:ye.disposeWhenNodeIsRemoved||ye.l||null,Sa:ye.disposeWhen||ye.Sa,Rb:null,I:{},V:0,Ic:null};return xe[Pe]=Ne,xe.Nc=typeof ze=="function",B.a.Ba||B.a.extend(xe,B.T.fn),B.T.fn.qb(xe),B.a.Ab(xe,it),ye.pure?(Ne.wb=!0,Ne.J=!0,B.a.extend(xe,Me)):ye.deferEvaluation&&B.a.extend(xe,Ke),B.options.deferUpdates&&B.Ta.deferred(xe,!0),Ne.l&&(Ne.jc=!0,Ne.l.nodeType||(Ne.l=null)),Ne.J||ye.deferEvaluation||xe.ha(),Ne.l&&xe.ja()&&B.a.K.za(Ne.l,Ne.Rb=function(){xe.s()}),xe};var it={equalityComparer:U,qa:function(){return this[Pe].V},Va:function(){var te=[];return B.a.P(this[Pe].I,function(ce,ye){te[ye.Ka]=ye.da}),te},Vb:function(te){if(!this[Pe].V)return!1;var ce=this.Va();return B.a.A(ce,te)!==-1?!0:!!B.a.Lb(ce,function(ye){return ye.Vb&&ye.Vb(te)})},uc:function(te,ce,ye){if(this[Pe].wb&&ce===this)throw Error("A 'pure' computed must not be called recursively");this[Pe].I[te]=ye,ye.Ka=this[Pe].V++,ye.La=ce.ob()},Xa:function(){var te,ce,ye=this[Pe].I;for(te in ye)if(Object.prototype.hasOwnProperty.call(ye,te)&&(ce=ye[te],this.Ia&&ce.da.Ja||ce.da.Dd(ce.La)))return!0},Jd:function(){this.Ia&&!this[Pe].rb&&this.Ia(!1)},ja:function(){var te=this[Pe];return te.ka||0<te.V},Rd:function(){this.Ja?this[Pe].ka&&(this[Pe].sa=!0):this.Hc()},$c:function(te){if(te.Hb){var ce=te.subscribe(this.Jd,this,"dirty"),ye=te.subscribe(this.Rd,this);return{da:te,s:function(){ce.s(),ye.s()}}}return te.subscribe(this.Hc,this)},Hc:function(){var te=this,ce=te.throttleEvaluation;ce&&0<=ce?(clearTimeout(this[Pe].Ic),this[Pe].Ic=B.a.setTimeout(function(){te.ha(!0)},ce)):te.Ia?te.Ia(!0):te.ha(!0)},ha:function(te){var ce=this[Pe],ye=ce.Sa,xe=!1;if(!ce.rb&&!ce.ra){if(ce.l&&!B.a.Sb(ce.l)||ye&&ye()){if(!ce.jc){this.s();return}}else ce.jc=!1;ce.rb=!0;try{xe=this.zd(te)}finally{ce.rb=!1}return xe}},zd:function(te){var ce=this[Pe],xe=!1,ye=ce.wb?t:!ce.V,xe={qd:this,mb:ce.I,Qb:ce.V};B.u.xc({pd:xe,od:Y,o:this,Ya:ye}),ce.I={},ce.V=0;var ze=this.yd(ce,xe);return ce.V?xe=this.sb(ce.X,ze):(this.s(),xe=!0),xe&&(ce.J?this.Gb():this.notifySubscribers(ce.X,"beforeChange"),ce.X=ze,this.notifySubscribers(ce.X,"spectate"),!ce.J&&te&&this.notifySubscribers(ce.X),this.rc&&this.rc()),ye&&this.notifySubscribers(ce.X,"awake"),xe},yd:function(te,ce){try{var ye=te.Wc;return te.nb?ye.call(te.nb):ye()}finally{B.u.end(),ce.Qb&&!te.J&&B.a.P(ce.mb,J),te.sa=te.ka=!1}},v:function(te){var ce=this[Pe];return(ce.ka&&(te||!ce.V)||ce.J&&this.Xa())&&this.ha(),ce.X},ub:function(te){B.T.fn.ub.call(this,te),this.nc=function(){return this[Pe].J||(this[Pe].sa?this.ha():this[Pe].ka=!1),this[Pe].X},this.Ia=function(ce){this.pc(this[Pe].X),this[Pe].ka=!0,ce&&(this[Pe].sa=!0),this.qc(this,!ce)}},s:function(){var te=this[Pe];!te.J&&te.I&&B.a.P(te.I,function(ce,ye){ye.s&&ye.s()}),te.l&&te.Rb&&B.a.K.yb(te.l,te.Rb),te.I=t,te.V=0,te.ra=!0,te.sa=!1,te.ka=!1,te.J=!1,te.l=t,te.Sa=t,te.Wc=t,this.Nc||(te.nb=t)}},Me={Qa:function(te){var ce=this,ye=ce[Pe];if(!ye.ra&&ye.J&&te=="change"){if(ye.J=!1,ye.sa||ce.Xa())ye.I=null,ye.V=0,ce.ha()&&ce.Gb();else{var xe=[];B.a.P(ye.I,function(ze,Ne){xe[Ne.Ka]=ze}),B.a.D(xe,function(ze,Ne){var Ge=ye.I[ze],Ve=ce.$c(Ge.da);Ve.Ka=Ne,Ve.La=Ge.La,ye.I[ze]=Ve}),ce.Xa()&&ce.ha()&&ce.Gb()}ye.ra||ce.notifySubscribers(ye.X,"awake")}},hb:function(te){var ce=this[Pe];ce.ra||te!="change"||this.Wa("change")||(B.a.P(ce.I,function(ye,xe){xe.s&&(ce.I[ye]={da:xe.da,Ka:xe.Ka,La:xe.La},xe.s())}),ce.J=!0,this.notifySubscribers(t,"asleep"))},ob:function(){var te=this[Pe];return te.J&&(te.sa||this.Xa())&&this.ha(),B.T.fn.ob.call(this)}},Ke={Qa:function(te){te!="change"&&te!="beforeChange"||this.v()}};B.a.Ba&&B.a.setPrototypeOf(it,B.T.fn);var Et=B.ta.Ma;it[Et]=B.o,B.Oc=function(te){return typeof te=="function"&&te[Et]===it[Et]},B.Fd=function(te){return B.Oc(te)&&te[Pe]&&te[Pe].wb},B.b("computed",B.o),B.b("dependentObservable",B.o),B.b("isComputed",B.Oc),B.b("isPureComputed",B.Fd),B.b("computed.fn",it),B.L(it,"peek",it.v),B.L(it,"dispose",it.s),B.L(it,"isActive",it.ja),B.L(it,"getDependenciesCount",it.qa),B.L(it,"getDependencies",it.Va),B.xb=function(te,ce){return typeof te=="function"?B.o(te,ce,{pure:!0}):(te=B.a.extend({},te),te.pure=!0,B.o(te,ce))},B.b("pureComputed",B.xb),function(){function te(xe,ze,Ne){if(Ne=Ne||new ye,xe=ze(xe),typeof xe!="object"||xe===null||xe===t||xe instanceof RegExp||xe instanceof Date||xe instanceof String||xe instanceof Number||xe instanceof Boolean)return xe;var Ge=xe instanceof Array?[]:{};return Ne.save(xe,Ge),ce(xe,function(Ve){var Le=ze(xe[Ve]);switch(typeof Le){case"boolean":case"number":case"string":case"function":Ge[Ve]=Le;break;case"object":case"undefined":var Ie=Ne.get(Le);Ge[Ve]=Ie!==t?Ie:te(Le,ze,Ne)}}),Ge}function ce(xe,ze){if(xe instanceof Array){for(var Ne=0;Ne<xe.length;Ne++)ze(Ne);typeof xe.toJSON=="function"&&ze("toJSON")}else for(Ne in xe)ze(Ne)}function ye(){this.keys=[],this.values=[]}B.ad=function(xe){if(arguments.length==0)throw Error("When calling ko.toJS, pass the object you want to convert.");return te(xe,function(ze){for(var Ne=0;B.O(ze)&&10>Ne;Ne++)ze=ze();return ze})},B.toJSON=function(xe,ze,Ne){return xe=B.ad(xe),B.a.hc(xe,ze,Ne)},ye.prototype={constructor:ye,save:function(xe,ze){var Ne=B.a.A(this.keys,xe);0<=Ne?this.values[Ne]=ze:(this.keys.push(xe),this.values.push(ze))},get:function(xe){return xe=B.a.A(this.keys,xe),0<=xe?this.values[xe]:t}}}(),B.b("toJS",B.ad),B.b("toJSON",B.toJSON),B.Wd=function(te,ce,ye){function xe(ze){var Ne=B.xb(te,ye).extend({ma:"always"}),Ge=Ne.subscribe(function(Ve){Ve&&(Ge.s(),ze(Ve))});return Ne.notifySubscribers(Ne.v()),Ge}return typeof Promise!="function"||ce?xe(ce.bind(ye)):new Promise(xe)},B.b("when",B.Wd),function(){B.w={M:function(te){switch(B.a.R(te)){case"option":return te.__ko__hasDomDataOptionValue__===!0?B.a.g.get(te,B.c.options.$b):7>=B.a.W?te.getAttributeNode("value")&&te.getAttributeNode("value").specified?te.value:te.text:te.value;case"select":return 0<=te.selectedIndex?B.w.M(te.options[te.selectedIndex]):t;default:return te.value}},cb:function(te,ce,ye){switch(B.a.R(te)){case"option":typeof ce=="string"?(B.a.g.set(te,B.c.options.$b,t),"__ko__hasDomDataOptionValue__"in te&&delete te.__ko__hasDomDataOptionValue__,te.value=ce):(B.a.g.set(te,B.c.options.$b,ce),te.__ko__hasDomDataOptionValue__=!0,te.value=typeof ce=="number"?ce:"");break;case"select":(ce===""||ce===null)&&(ce=t);for(var xe=-1,ze=0,Ne=te.options.length,Ge;ze<Ne;++ze)if(Ge=B.w.M(te.options[ze]),Ge==ce||Ge===""&&ce===t){xe=ze;break}(ye||0<=xe||ce===t&&1<te.size)&&(te.selectedIndex=xe,B.a.W===6&&B.a.setTimeout(function(){te.selectedIndex=xe},0));break;default:(ce===null||ce===t)&&(ce=""),te.value=ce}}}}(),B.b("selectExtensions",B.w),B.b("selectExtensions.readValue",B.w.M),B.b("selectExtensions.writeValue",B.w.cb),B.m=function(){function te(Ve){Ve=B.a.Db(Ve),Ve.charCodeAt(0)===123&&(Ve=Ve.slice(1,-1)),Ve+=`
- ,`;var Le=[],Ie=Ve.match(xe),qe,et=[],vt=0;if(1<Ie.length){for(var Be=0,dt;dt=Ie[Be];++Be){var ut=dt.charCodeAt(0);if(ut===44){if(0>=vt){Le.push(qe&&et.length?{key:qe,value:et.join("")}:{unknown:qe||et.join("")}),qe=vt=0,et=[];continue}}else if(ut===58){if(!vt&&!qe&&et.length===1){qe=et.pop();continue}}else{if(ut===47&&1<dt.length&&(dt.charCodeAt(1)===47||dt.charCodeAt(1)===42))continue;ut===47&&Be&&1<dt.length?(ut=Ie[Be-1].match(ze))&&!Ne[ut[0]]&&(Ve=Ve.substr(Ve.indexOf(dt)+1),Ie=Ve.match(xe),Be=-1,dt="/"):ut===40||ut===123||ut===91?++vt:ut===41||ut===125||ut===93?--vt:qe||et.length||ut!==34&&ut!==39||(dt=dt.slice(1,-1))}et.push(dt)}if(0<vt)throw Error("Unbalanced parentheses, braces, or brackets")}return Le}var ce=["true","false","null","undefined"],ye=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,xe=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
- |/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),ze=/[\])"'A-Za-z0-9_$]+$/,Ne={in:1,return:1,typeof:1},Ge={};return{Ra:[],wa:Ge,ac:te,vb:function(Ve,Le){function Ie(ut,Qt){var Wt;if(!Be){var Nt=B.getBindingHandler(ut);if(Nt&&Nt.preprocess&&!(Qt=Nt.preprocess(Qt,ut,Ie)))return;(Nt=Ge[ut])&&(Wt=Qt,0<=B.a.A(ce,Wt)?Wt=!1:(Nt=Wt.match(ye),Wt=Nt===null?!1:Nt[1]?"Object("+Nt[1]+")"+Nt[2]:Wt),Nt=Wt),Nt&&et.push("'"+(typeof Ge[ut]=="string"?Ge[ut]:ut)+"':function(_z){"+Wt+"=_z}")}vt&&(Qt="function(){return "+Qt+" }"),qe.push("'"+ut+"':"+Qt)}Le=Le||{};var qe=[],et=[],vt=Le.valueAccessors,Be=Le.bindingParams,dt=typeof Ve=="string"?te(Ve):Ve;return B.a.D(dt,function(ut){Ie(ut.key||ut.unknown,ut.value)}),et.length&&Ie("_ko_property_writers","{"+et.join(",")+" }"),qe.join(",")},Id:function(Ve,Le){for(var Ie=0;Ie<Ve.length;Ie++)if(Ve[Ie].key==Le)return!0;return!1},eb:function(Ve,Le,Ie,qe,et){Ve&&B.O(Ve)?!B.Za(Ve)||et&&Ve.v()===qe||Ve(qe):(Ve=Le.get("_ko_property_writers"))&&Ve[Ie]&&Ve[Ie](qe)}}}(),B.b("expressionRewriting",B.m),B.b("expressionRewriting.bindingRewriteValidators",B.m.Ra),B.b("expressionRewriting.parseObjectLiteral",B.m.ac),B.b("expressionRewriting.preProcessBindings",B.m.vb),B.b("expressionRewriting._twoWayBindings",B.m.wa),B.b("jsonExpressionRewriting",B.m),B.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",B.m.vb),function(){function te(Ie){return Ie.nodeType==8&&Ne.test(ze?Ie.text:Ie.nodeValue)}function ce(Ie){return Ie.nodeType==8&&Ge.test(ze?Ie.text:Ie.nodeValue)}function ye(Ie,qe){for(var et=Ie,vt=1,Be=[];et=et.nextSibling;){if(ce(et)&&(B.a.g.set(et,Le,!0),vt--,vt===0))return Be;Be.push(et),te(et)&&vt++}if(!qe)throw Error("Cannot find closing comment tag to match: "+Ie.nodeValue);return null}function xe(Ie,qe){var et=ye(Ie,qe);return et?0<et.length?et[et.length-1].nextSibling:Ie.nextSibling:null}var ze=c&&c.createComment("test").text==="<!--test-->",Ne=ze?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,Ge=ze?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,Ve={ul:!0,ol:!0},Le="__ko_matchedEndComment__";B.h={ea:{},childNodes:function(Ie){return te(Ie)?ye(Ie):Ie.childNodes},Ea:function(Ie){if(te(Ie)){Ie=B.h.childNodes(Ie);for(var qe=0,et=Ie.length;qe<et;qe++)B.removeNode(Ie[qe])}else B.a.Tb(Ie)},va:function(Ie,qe){if(te(Ie)){B.h.Ea(Ie);for(var et=Ie.nextSibling,vt=0,Be=qe.length;vt<Be;vt++)et.parentNode.insertBefore(qe[vt],et)}else B.a.va(Ie,qe)},Vc:function(Ie,qe){var et;te(Ie)?(et=Ie.nextSibling,Ie=Ie.parentNode):et=Ie.firstChild,et?qe!==et&&Ie.insertBefore(qe,et):Ie.appendChild(qe)},Wb:function(Ie,qe,et){et?(et=et.nextSibling,te(Ie)&&(Ie=Ie.parentNode),et?qe!==et&&Ie.insertBefore(qe,et):Ie.appendChild(qe)):B.h.Vc(Ie,qe)},firstChild:function(Ie){if(te(Ie))return!Ie.nextSibling||ce(Ie.nextSibling)?null:Ie.nextSibling;if(Ie.firstChild&&ce(Ie.firstChild))throw Error("Found invalid end comment, as the first child of "+Ie);return Ie.firstChild},nextSibling:function(Ie){if(te(Ie)&&(Ie=xe(Ie)),Ie.nextSibling&&ce(Ie.nextSibling)){var qe=Ie.nextSibling;if(ce(qe)&&!B.a.g.get(qe,Le))throw Error("Found end comment without a matching opening comment, as child of "+Ie);return null}return Ie.nextSibling},Cd:te,Vd:function(Ie){return(Ie=(ze?Ie.text:Ie.nodeValue).match(Ne))?Ie[1]:null},Sc:function(Ie){if(Ve[B.a.R(Ie)]){var qe=Ie.firstChild;if(qe)do if(qe.nodeType===1){var et;et=qe.firstChild;var vt=null;if(et)do if(vt)vt.push(et);else if(te(et)){var Be=xe(et,!0);Be?et=Be:vt=[et]}else ce(et)&&(vt=[et]);while(et=et.nextSibling);if(et=vt)for(vt=qe.nextSibling,Be=0;Be<et.length;Be++)vt?Ie.insertBefore(et[Be],vt):Ie.appendChild(et[Be])}while(qe=qe.nextSibling)}}}}(),B.b("virtualElements",B.h),B.b("virtualElements.allowedBindings",B.h.ea),B.b("virtualElements.emptyNode",B.h.Ea),B.b("virtualElements.insertAfter",B.h.Wb),B.b("virtualElements.prepend",B.h.Vc),B.b("virtualElements.setDomNodeChildren",B.h.va),function(){B.ga=function(){this.nd={}},B.a.extend(B.ga.prototype,{nodeHasBindings:function(te){switch(te.nodeType){case 1:return te.getAttribute("data-bind")!=null||B.j.getComponentNameForNode(te);case 8:return B.h.Cd(te);default:return!1}},getBindings:function(te,ce){var ye=this.getBindingsString(te,ce),ye=ye?this.parseBindingsString(ye,ce,te):null;return B.j.tc(ye,te,ce,!1)},getBindingAccessors:function(te,ce){var ye=this.getBindingsString(te,ce),ye=ye?this.parseBindingsString(ye,ce,te,{valueAccessors:!0}):null;return B.j.tc(ye,te,ce,!0)},getBindingsString:function(te){switch(te.nodeType){case 1:return te.getAttribute("data-bind");case 8:return B.h.Vd(te);default:return null}},parseBindingsString:function(te,ce,ye,xe){try{var ze=this.nd,Ne=te+(xe&&xe.valueAccessors||""),Ge;if(!(Ge=ze[Ne])){var Ve,Le="with($context){with($data||{}){return{"+B.m.vb(te,xe)+"}}}";Ve=new Function("$context","$element",Le),Ge=ze[Ne]=Ve}return Ge(ce,ye)}catch(Ie){throw Ie.message=`Unable to parse bindings.
- Bindings value: `+te+`
- Message: `+Ie.message,Ie}}}),B.ga.instance=new B.ga}(),B.b("bindingProvider",B.ga),function(){function te(Nt){var Ct=(Nt=B.a.g.get(Nt,Wt))&&Nt.N;Ct&&(Nt.N=null,Ct.Tc())}function ce(Nt,Ct,Ft){this.node=Nt,this.yc=Ct,this.kb=[],this.H=!1,Ct.N||B.a.K.za(Nt,te),Ft&&Ft.N&&(Ft.N.kb.push(Nt),this.Kb=Ft)}function ye(Nt){return function(){return Nt}}function xe(Nt){return Nt()}function ze(Nt){return B.a.Ga(B.u.G(Nt),function(Ct,Ft){return function(){return Nt()[Ft]}})}function Ne(Nt,Ct,Ft){return typeof Nt=="function"?ze(Nt.bind(null,Ct,Ft)):B.a.Ga(Nt,ye)}function Ge(Nt,Ct){return ze(this.getBindings.bind(this,Nt,Ct))}function Ve(Nt,Ct){var Ft=B.h.firstChild(Ct);if(Ft){var Xt,mi=B.ga.instance,fi=mi.preprocessNode;if(fi){for(;Xt=Ft;)Ft=B.h.nextSibling(Xt),fi.call(mi,Xt);Ft=B.h.firstChild(Ct)}for(;Xt=Ft;)Ft=B.h.nextSibling(Xt),Le(Nt,Xt)}B.i.ma(Ct,B.i.H)}function Le(Nt,Ct){var Ft=Nt,Xt=Ct.nodeType===1;Xt&&B.h.Sc(Ct),(Xt||B.ga.instance.nodeHasBindings(Ct))&&(Ft=qe(Ct,null,Nt).bindingContextForDescendants),Ft&&!ut[B.a.R(Ct)]&&Ve(Ft,Ct)}function Ie(Nt){var Ct=[],Ft={},Xt=[];return B.a.P(Nt,function mi(fi){if(!Ft[fi]){var Gi=B.getBindingHandler(fi);Gi&&(Gi.after&&(Xt.push(fi),B.a.D(Gi.after,function(wn){if(Nt[wn]){if(B.a.A(Xt,wn)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+Xt.join(", "));mi(wn)}}),Xt.length--),Ct.push({key:fi,Mc:Gi})),Ft[fi]=!0}}),Ct}function qe(Nt,Ct,Ft){var Xt=B.a.g.Ub(Nt,Wt,{}),mi=Xt.hd;if(!Ct){if(mi)throw Error("You cannot apply bindings multiple times to the same element.");Xt.hd=!0}mi||(Xt.context=Ft),Xt.Zb||(Xt.Zb={});var fi;if(Ct&&typeof Ct!="function")fi=Ct;else{var Gi=B.ga.instance,wn=Gi.getBindingAccessors||Ge,Qi=B.$(function(){return(fi=Ct?Ct(Ft,Nt):wn.call(Gi,Nt,Ft))&&(Ft[vt]&&Ft[vt](),Ft[dt]&&Ft[dt]()),fi},null,{l:Nt});fi&&Qi.ja()||(Qi=null)}var Gn=Ft,kn;if(fi){var yt=function(){return B.a.Ga(Qi?Qi():fi,xe)},st=Qi?function(ti){return function(){return xe(Qi()[ti])}}:function(ti){return fi[ti]};yt.get=function(ti){return fi[ti]&&xe(st(ti))},yt.has=function(ti){return ti in fi},B.i.H in fi&&B.i.subscribe(Nt,B.i.H,function(){var ti=(0,fi[B.i.H])();if(ti){var Ni=B.h.childNodes(Nt);Ni.length&&ti(Ni,B.Ec(Ni[0]))}}),B.i.pa in fi&&(Gn=B.i.Cb(Nt,Ft),B.i.subscribe(Nt,B.i.pa,function(){var ti=(0,fi[B.i.pa])();ti&&B.h.firstChild(Nt)&&ti(Nt)})),Xt=Ie(fi),B.a.D(Xt,function(ti){var Ni=ti.Mc.init,qi=ti.Mc.update,en=ti.key;if(Nt.nodeType===8&&!B.h.ea[en])throw Error("The binding '"+en+"' cannot be used with virtual elements");try{typeof Ni=="function"&&B.u.G(function(){var $t=Ni(Nt,st(en),yt,Gn.$data,Gn);if($t&&$t.controlsDescendantBindings){if(kn!==t)throw Error("Multiple bindings ("+kn+" and "+en+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");kn=en}}),typeof qi=="function"&&B.$(function(){qi(Nt,st(en),yt,Gn.$data,Gn)},null,{l:Nt})}catch($t){throw $t.message='Unable to process binding "'+en+": "+fi[en]+`"
- Message: `+$t.message,$t}})}return Xt=kn===t,{shouldBindDescendants:Xt,bindingContextForDescendants:Xt&&Gn}}function et(Nt,Ct){return Nt&&Nt instanceof B.fa?Nt:new B.fa(Nt,t,t,Ct)}var vt=B.a.Da("_subscribable"),Be=B.a.Da("_ancestorBindingInfo"),dt=B.a.Da("_dataDependency");B.c={};var ut={script:!0,textarea:!0,template:!0};B.getBindingHandler=function(Nt){return B.c[Nt]};var Qt={};B.fa=function(Nt,Ct,Ft,Xt,mi){function fi(){var st=Gn?Qi():Qi,ti=B.a.f(st);return Ct?(B.a.extend(Gi,Ct),Be in Ct&&(Gi[Be]=Ct[Be])):(Gi.$parents=[],Gi.$root=ti,Gi.ko=B),Gi[vt]=kn,wn?ti=Gi.$data:(Gi.$rawData=st,Gi.$data=ti),Ft&&(Gi[Ft]=ti),Xt&&Xt(Gi,Ct,ti),Ct&&Ct[vt]&&!B.S.o().Vb(Ct[vt])&&Ct[vt](),yt&&(Gi[dt]=yt),Gi.$data}var Gi=this,wn=Nt===Qt,Qi=wn?t:Nt,Gn=typeof Qi=="function"&&!B.O(Qi),kn,yt=mi&&mi.dataDependency;mi&&mi.exportDependencies?fi():(kn=B.xb(fi),kn.v(),kn.ja()?kn.equalityComparer=null:Gi[vt]=t)},B.fa.prototype.createChildContext=function(Nt,Ct,Ft,Xt){if(!Xt&&Ct&&typeof Ct=="object"&&(Xt=Ct,Ct=Xt.as,Ft=Xt.extend),Ct&&Xt&&Xt.noChildContext){var mi=typeof Nt=="function"&&!B.O(Nt);return new B.fa(Qt,this,null,function(fi){Ft&&Ft(fi),fi[Ct]=mi?Nt():Nt},Xt)}return new B.fa(Nt,this,Ct,function(fi,Gi){fi.$parentContext=Gi,fi.$parent=Gi.$data,fi.$parents=(Gi.$parents||[]).slice(0),fi.$parents.unshift(fi.$parent),Ft&&Ft(fi)},Xt)},B.fa.prototype.extend=function(Nt,Ct){return new B.fa(Qt,this,null,function(Ft){B.a.extend(Ft,typeof Nt=="function"?Nt(Ft):Nt)},Ct)};var Wt=B.a.g.Z();ce.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},ce.prototype.sd=function(Nt){B.a.Pa(this.kb,Nt),!this.kb.length&&this.H&&this.Cc()},ce.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,B.a.K.yb(this.node,te),B.i.ma(this.node,B.i.pa),this.Tc())},B.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(Nt,Ct,Ft,Xt,mi){var fi=B.a.g.Ub(Nt,Wt,{});return fi.Fa||(fi.Fa=new B.T),mi&&mi.notifyImmediately&&fi.Zb[Ct]&&B.u.G(Ft,Xt,[Nt]),fi.Fa.subscribe(Ft,Xt,Ct)},ma:function(Nt,Ct){var Ft=B.a.g.get(Nt,Wt);if(Ft&&(Ft.Zb[Ct]=!0,Ft.Fa&&Ft.Fa.notifySubscribers(Nt,Ct),Ct==B.i.H)){if(Ft.N)Ft.N.Cc();else if(Ft.N===t&&Ft.Fa&&Ft.Fa.Wa(B.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(Nt,Ct){var Ft=B.a.g.Ub(Nt,Wt,{});return Ft.N||(Ft.N=new ce(Nt,Ft,Ct[Be])),Ct[Be]==Ft?Ct:Ct.extend(function(Xt){Xt[Be]=Ft})}},B.Td=function(Nt){return(Nt=B.a.g.get(Nt,Wt))&&Nt.context},B.ib=function(Nt,Ct,Ft){return Nt.nodeType===1&&B.h.Sc(Nt),qe(Nt,Ct,et(Ft))},B.ld=function(Nt,Ct,Ft){return Ft=et(Ft),B.ib(Nt,Ne(Ct,Ft,Nt),Ft)},B.Oa=function(Nt,Ct){Ct.nodeType!==1&&Ct.nodeType!==8||Ve(et(Nt),Ct)},B.vc=function(Nt,Ct,Ft){if(!y&&r.jQuery&&(y=r.jQuery),2>arguments.length){if(Ct=c.body,!Ct)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!Ct||Ct.nodeType!==1&&Ct.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");Le(et(Nt,Ft),Ct)},B.Dc=function(Nt){return!Nt||Nt.nodeType!==1&&Nt.nodeType!==8?t:B.Td(Nt)},B.Ec=function(Nt){return(Nt=B.Dc(Nt))?Nt.$data:t},B.b("bindingHandlers",B.c),B.b("bindingEvent",B.i),B.b("bindingEvent.subscribe",B.i.subscribe),B.b("bindingEvent.startPossiblyAsyncContentBinding",B.i.Cb),B.b("applyBindings",B.vc),B.b("applyBindingsToDescendants",B.Oa),B.b("applyBindingAccessorsToNode",B.ib),B.b("applyBindingsToNode",B.ld),B.b("contextFor",B.Dc),B.b("dataFor",B.Ec)}(),function(te){function ce(Ge,Ve){var Le=Object.prototype.hasOwnProperty.call(ze,Ge)?ze[Ge]:te,Ie;Le?Le.subscribe(Ve):(Le=ze[Ge]=new B.T,Le.subscribe(Ve),ye(Ge,function(qe,et){var vt=!(!et||!et.synchronous);Ne[Ge]={definition:qe,Gd:vt},delete ze[Ge],Ie||vt?Le.notifySubscribers(qe):B.na.zb(function(){Le.notifySubscribers(qe)})}),Ie=!0)}function ye(Ge,Ve){xe("getConfig",[Ge],function(Le){Le?xe("loadComponent",[Ge,Le],function(Ie){Ve(Ie,Le)}):Ve(null,null)})}function xe(Ge,Ve,Le,Ie){Ie||(Ie=B.j.loaders.slice(0));var qe=Ie.shift();if(qe){var et=qe[Ge];if(et){var vt=!1;if(et.apply(qe,Ve.concat(function(Be){vt?Le(null):Be!==null?Le(Be):xe(Ge,Ve,Le,Ie)}))!==te&&(vt=!0,!qe.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else xe(Ge,Ve,Le,Ie)}else Le(null)}var ze={},Ne={};B.j={get:function(Ge,Ve){var Le=Object.prototype.hasOwnProperty.call(Ne,Ge)?Ne[Ge]:te;Le?Le.Gd?B.u.G(function(){Ve(Le.definition)}):B.na.zb(function(){Ve(Le.definition)}):ce(Ge,Ve)},Bc:function(Ge){delete Ne[Ge]},oc:xe},B.j.loaders=[],B.b("components",B.j),B.b("components.get",B.j.get),B.b("components.clearCachedDefinition",B.j.Bc)}(),function(){function te(Le,Ie,qe,et){function vt(){--dt===0&&et(Be)}var Be={},dt=2,ut=qe.template;qe=qe.viewModel,ut?ze(Ie,ut,function(Qt){B.j.oc("loadTemplate",[Le,Qt],function(Wt){Be.template=Wt,vt()})}):vt(),qe?ze(Ie,qe,function(Qt){B.j.oc("loadViewModel",[Le,Qt],function(Wt){Be[Ve]=Wt,vt()})}):vt()}function ce(Le,Ie,qe){if(typeof Ie=="function")qe(function(vt){return new Ie(vt)});else if(typeof Ie[Ve]=="function")qe(Ie[Ve]);else if("instance"in Ie){var et=Ie.instance;qe(function(){return et})}else"viewModel"in Ie?ce(Le,Ie.viewModel,qe):Le("Unknown viewModel value: "+Ie)}function ye(Le){switch(B.a.R(Le)){case"script":return B.a.ua(Le.text);case"textarea":return B.a.ua(Le.value);case"template":if(xe(Le.content))return B.a.Ca(Le.content.childNodes)}return B.a.Ca(Le.childNodes)}function xe(Le){return r.DocumentFragment?Le instanceof DocumentFragment:Le&&Le.nodeType===11}function ze(Le,Ie,qe){typeof Ie.require=="string"?D||r.require?(D||r.require)([Ie.require],function(et){et&&typeof et=="object"&&et.Xd&&et.default&&(et=et.default),qe(et)}):Le("Uses require, but no AMD loader is present"):qe(Ie)}function Ne(Le){return function(Ie){throw Error("Component '"+Le+"': "+Ie)}}var Ge={};B.j.register=function(Le,Ie){if(!Ie)throw Error("Invalid configuration for "+Le);if(B.j.tb(Le))throw Error("Component "+Le+" is already registered");Ge[Le]=Ie},B.j.tb=function(Le){return Object.prototype.hasOwnProperty.call(Ge,Le)},B.j.unregister=function(Le){delete Ge[Le],B.j.Bc(Le)},B.j.Fc={getConfig:function(Le,Ie){Ie(B.j.tb(Le)?Ge[Le]:null)},loadComponent:function(Le,Ie,qe){var et=Ne(Le);ze(et,Ie,function(vt){te(Le,et,vt,qe)})},loadTemplate:function(Le,Ie,qe){if(Le=Ne(Le),typeof Ie=="string")qe(B.a.ua(Ie));else if(Ie instanceof Array)qe(Ie);else if(xe(Ie))qe(B.a.la(Ie.childNodes));else if(Ie.element)if(Ie=Ie.element,r.HTMLElement?Ie instanceof HTMLElement:Ie&&Ie.tagName&&Ie.nodeType===1)qe(ye(Ie));else if(typeof Ie=="string"){var et=c.getElementById(Ie);et?qe(ye(et)):Le("Cannot find element with ID "+Ie)}else Le("Unknown element type: "+Ie);else Le("Unknown template value: "+Ie)},loadViewModel:function(Le,Ie,qe){ce(Ne(Le),Ie,qe)}};var Ve="createViewModel";B.b("components.register",B.j.register),B.b("components.isRegistered",B.j.tb),B.b("components.unregister",B.j.unregister),B.b("components.defaultLoader",B.j.Fc),B.j.loaders.push(B.j.Fc),B.j.dd=Ge}(),function(){function te(ye,xe){var ze=ye.getAttribute("params");if(ze){var ze=ce.parseBindingsString(ze,xe,ye,{valueAccessors:!0,bindingParams:!0}),ze=B.a.Ga(ze,function(Ve){return B.o(Ve,null,{l:ye})}),Ne=B.a.Ga(ze,function(Ve){var Le=Ve.v();return Ve.ja()?B.o({read:function(){return B.a.f(Ve())},write:B.Za(Le)&&function(Ie){Ve()(Ie)},l:ye}):Le});return Object.prototype.hasOwnProperty.call(Ne,"$raw")||(Ne.$raw=ze),Ne}return{$raw:{}}}B.j.getComponentNameForNode=function(ye){var xe=B.a.R(ye);if(B.j.tb(xe)&&(xe.indexOf("-")!=-1||""+ye=="[object HTMLUnknownElement]"||8>=B.a.W&&ye.tagName===xe))return xe},B.j.tc=function(ye,xe,ze,Ne){if(xe.nodeType===1){var Ge=B.j.getComponentNameForNode(xe);if(Ge){if(ye=ye||{},ye.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var Ve={name:Ge,params:te(xe,ze)};ye.component=Ne?function(){return Ve}:Ve}}return ye};var ce=new B.ga;9>B.a.W&&(B.j.register=function(ye){return function(xe){return ye.apply(this,arguments)}}(B.j.register),c.createDocumentFragment=function(ye){return function(){var xe=ye();return B.j.dd,xe}}(c.createDocumentFragment))}(),function(){function te(xe,ze,Ne){if(ze=ze.template,!ze)throw Error("Component '"+xe+"' has no template");xe=B.a.Ca(ze),B.h.va(Ne,xe)}function ce(xe,ze,Ne){var Ge=xe.createViewModel;return Ge?Ge.call(xe,ze,Ne):ze}var ye=0;B.c.component={init:function(xe,ze,Ne,Ge,Ve){function Le(){var Be=Ie&&Ie.dispose;typeof Be=="function"&&Be.call(Ie),et&&et.s(),qe=Ie=et=null}var Ie,qe,et,vt=B.a.la(B.h.childNodes(xe));return B.h.Ea(xe),B.a.K.za(xe,Le),B.o(function(){var Be=B.a.f(ze()),dt,ut;if(typeof Be=="string"?dt=Be:(dt=B.a.f(Be.name),ut=B.a.f(Be.params)),!dt)throw Error("No component name specified");var Qt=B.i.Cb(xe,Ve),Wt=qe=++ye;B.j.get(dt,function(Nt){if(qe===Wt){if(Le(),!Nt)throw Error("Unknown component '"+dt+"'");te(dt,Nt,xe);var Ct=ce(Nt,ut,{element:xe,templateNodes:vt});Nt=Qt.createChildContext(Ct,{extend:function(Ft){Ft.$component=Ct,Ft.$componentTemplateNodes=vt}}),Ct&&Ct.koDescendantsComplete&&(et=B.i.subscribe(xe,B.i.pa,Ct.koDescendantsComplete,Ct)),Ie=Ct,B.Oa(Nt,xe)}})},null,{l:xe}),{controlsDescendantBindings:!0}}},B.h.ea.component=!0}();var oi={class:"className",for:"htmlFor"};B.c.attr={update:function(te,ce){var ye=B.a.f(ce())||{};B.a.P(ye,function(xe,ze){ze=B.a.f(ze);var Ne=xe.indexOf(":"),Ne="lookupNamespaceURI"in te&&0<Ne&&te.lookupNamespaceURI(xe.substr(0,Ne)),Ge=ze===!1||ze===null||ze===t;Ge?Ne?te.removeAttributeNS(Ne,xe):te.removeAttribute(xe):ze=ze.toString(),8>=B.a.W&&xe in oi?(xe=oi[xe],Ge?te.removeAttribute(xe):te[xe]=ze):Ge||(Ne?te.setAttributeNS(Ne,xe,ze):te.setAttribute(xe,ze)),xe==="name"&&B.a.Yc(te,Ge?"":ze)})}},function(){B.c.checked={after:["value","attr"],init:function(te,ce,ye){function xe(){var Be=te.checked,dt=Ne();if(!B.S.Ya()&&(Be||!Ve&&!B.S.qa())){var ut=B.u.G(ce);if(Ie){var Qt=qe?ut.v():ut,Wt=vt;vt=dt,Wt!==dt?Be&&(B.a.Na(Qt,dt,!0),B.a.Na(Qt,Wt,!1)):B.a.Na(Qt,dt,Be),qe&&B.Za(ut)&&ut(Qt)}else Ge&&(dt===t?dt=Be:Be||(dt=t)),B.m.eb(ut,ye,"checked",dt,!0)}}function ze(){var Be=B.a.f(ce()),dt=Ne();Ie?(te.checked=0<=B.a.A(Be,dt),vt=dt):te.checked=Ge&&dt===t?!!Be:Ne()===Be}var Ne=B.xb(function(){if(ye.has("checkedValue"))return B.a.f(ye.get("checkedValue"));if(et)return ye.has("value")?B.a.f(ye.get("value")):te.value}),Ge=te.type=="checkbox",Ve=te.type=="radio";if(Ge||Ve){var Le=ce(),Ie=Ge&&B.a.f(Le)instanceof Array,qe=!(Ie&&Le.push&&Le.splice),et=Ve||Ie,vt=Ie?Ne():t;Ve&&!te.name&&B.c.uniqueName.init(te,function(){return!0}),B.o(xe,null,{l:te}),B.a.B(te,"click",xe),B.o(ze,null,{l:te}),Le=t}}},B.m.wa.checked=!0,B.c.checkedValue={update:function(te,ce){te.value=B.a.f(ce())}}}(),B.c.class={update:function(te,ce){var ye=B.a.Db(B.a.f(ce()));B.a.Eb(te,te.__ko__cssValue,!1),te.__ko__cssValue=ye,B.a.Eb(te,ye,!0)}},B.c.css={update:function(te,ce){var ye=B.a.f(ce());ye!==null&&typeof ye=="object"?B.a.P(ye,function(xe,ze){ze=B.a.f(ze),B.a.Eb(te,xe,ze)}):B.c.class.update(te,ce)}},B.c.enable={update:function(te,ce){var ye=B.a.f(ce());ye&&te.disabled?te.removeAttribute("disabled"):ye||te.disabled||(te.disabled=!0)}},B.c.disable={update:function(te,ce){B.c.enable.update(te,function(){return!B.a.f(ce())})}},B.c.event={init:function(te,ce,ye,xe,ze){var Ne=ce()||{};B.a.P(Ne,function(Ge){typeof Ge=="string"&&B.a.B(te,Ge,function(Ve){var Le,Ie=ce()[Ge];if(Ie){try{var qe=B.a.la(arguments);xe=ze.$data,qe.unshift(xe),Le=Ie.apply(xe,qe)}finally{Le!==!0&&(Ve.preventDefault?Ve.preventDefault():Ve.returnValue=!1)}ye.get(Ge+"Bubble")===!1&&(Ve.cancelBubble=!0,Ve.stopPropagation&&Ve.stopPropagation())}})})}},B.c.foreach={Rc:function(te){return function(){var ce=te(),ye=B.a.bc(ce);return!ye||typeof ye.length=="number"?{foreach:ce,templateEngine:B.ba.Ma}:(B.a.f(ce),{foreach:ye.data,as:ye.as,noChildContext:ye.noChildContext,includeDestroyed:ye.includeDestroyed,afterAdd:ye.afterAdd,beforeRemove:ye.beforeRemove,afterRender:ye.afterRender,beforeMove:ye.beforeMove,afterMove:ye.afterMove,templateEngine:B.ba.Ma})}},init:function(te,ce){return B.c.template.init(te,B.c.foreach.Rc(ce))},update:function(te,ce,ye,xe,ze){return B.c.template.update(te,B.c.foreach.Rc(ce),ye,xe,ze)}},B.m.Ra.foreach=!1,B.h.ea.foreach=!0,B.c.hasfocus={init:function(te,ce,ye){function xe(Ge){te.__ko_hasfocusUpdating=!0;var Ve=te.ownerDocument;if("activeElement"in Ve){var Le;try{Le=Ve.activeElement}catch{Le=Ve.body}Ge=Le===te}Ve=ce(),B.m.eb(Ve,ye,"hasfocus",Ge,!0),te.__ko_hasfocusLastValue=Ge,te.__ko_hasfocusUpdating=!1}var ze=xe.bind(null,!0),Ne=xe.bind(null,!1);B.a.B(te,"focus",ze),B.a.B(te,"focusin",ze),B.a.B(te,"blur",Ne),B.a.B(te,"focusout",Ne),te.__ko_hasfocusLastValue=!1},update:function(te,ce){var ye=!!B.a.f(ce());te.__ko_hasfocusUpdating||te.__ko_hasfocusLastValue===ye||(ye?te.focus():te.blur(),!ye&&te.__ko_hasfocusLastValue&&te.ownerDocument.body.focus(),B.u.G(B.a.Fb,null,[te,ye?"focusin":"focusout"]))}},B.m.wa.hasfocus=!0,B.c.hasFocus=B.c.hasfocus,B.m.wa.hasFocus="hasfocus",B.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(te,ce){B.a.fc(te,ce())}},function(){function te(ce,ye,xe){B.c[ce]={init:function(ze,Ne,Ge,Ve,Le){var Ie,qe,et={},vt,Be,dt;if(ye){Ve=Ge.get("as");var ut=Ge.get("noChildContext");dt=!(Ve&&ut),et={as:Ve,noChildContext:ut,exportDependencies:dt}}return Be=(vt=Ge.get("completeOn")=="render")||Ge.has(B.i.pa),B.o(function(){var Qt=B.a.f(Ne()),Wt=!xe!=!Qt,Nt=!qe,Ct;(dt||Wt!==Ie)&&(Be&&(Le=B.i.Cb(ze,Le)),Wt&&((!ye||dt)&&(et.dataDependency=B.S.o()),Ct=ye?Le.createChildContext(typeof Qt=="function"?Qt:Ne,et):B.S.qa()?Le.extend(null,et):Le),Nt&&B.S.qa()&&(qe=B.a.Ca(B.h.childNodes(ze),!0)),Wt?(Nt||B.h.va(ze,B.a.Ca(qe)),B.Oa(Ct,ze)):(B.h.Ea(ze),vt||B.i.ma(ze,B.i.H)),Ie=Wt)},null,{l:ze}),{controlsDescendantBindings:!0}}},B.m.Ra[ce]=!1,B.h.ea[ce]=!0}te("if"),te("ifnot",!1,!0),te("with",!0)}(),B.c.let={init:function(te,ce,ye,xe,ze){return ce=ze.extend(ce),B.Oa(ce,te),{controlsDescendantBindings:!0}}},B.h.ea.let=!0;var Ci={};B.c.options={init:function(te){if(B.a.R(te)!=="select")throw Error("options binding applies only to SELECT elements");for(;0<te.length;)te.remove(0);return{controlsDescendantBindings:!0}},update:function(te,ce,ye){function xe(){return B.a.jb(te.options,function(ut){return ut.selected})}function ze(ut,Qt,Wt){var Nt=typeof Qt;return Nt=="function"?Qt(ut):Nt=="string"?ut[Qt]:Wt}function Ne(ut,Qt){if(Be&&Ie)B.i.ma(te,B.i.H);else if(vt.length){var Wt=0<=B.a.A(vt,B.w.M(Qt[0]));B.a.Zc(Qt[0],Wt),Be&&!Wt&&B.u.G(B.a.Fb,null,[te,"change"])}}var Ge=te.multiple,Ve=te.length!=0&&Ge?te.scrollTop:null,Le=B.a.f(ce()),Ie=ye.get("valueAllowUnset")&&ye.has("value"),qe=ye.get("optionsIncludeDestroyed");ce={};var et,vt=[];Ie||(Ge?vt=B.a.Mb(xe(),B.w.M):0<=te.selectedIndex&&vt.push(B.w.M(te.options[te.selectedIndex]))),Le&&(typeof Le.length>"u"&&(Le=[Le]),et=B.a.jb(Le,function(ut){return qe||ut===t||ut===null||!B.a.f(ut._destroy)}),ye.has("optionsCaption")&&(Le=B.a.f(ye.get("optionsCaption")),Le!==null&&Le!==t&&et.unshift(Ci)));var Be=!1;if(ce.beforeRemove=function(ut){te.removeChild(ut)},Le=Ne,ye.has("optionsAfterRender")&&typeof ye.get("optionsAfterRender")=="function"&&(Le=function(ut,Qt){Ne(0,Qt),B.u.G(ye.get("optionsAfterRender"),null,[Qt[0],ut!==Ci?ut:t])}),B.a.ec(te,et,function(ut,Qt,Wt){return Wt.length&&(vt=!Ie&&Wt[0].selected?[B.w.M(Wt[0])]:[],Be=!0),Qt=te.ownerDocument.createElement("option"),ut===Ci?(B.a.Bb(Qt,ye.get("optionsCaption")),B.w.cb(Qt,t)):(Wt=ze(ut,ye.get("optionsValue"),ut),B.w.cb(Qt,B.a.f(Wt)),ut=ze(ut,ye.get("optionsText"),Wt),B.a.Bb(Qt,ut)),[Qt]},ce,Le),!Ie){var dt;Ge?dt=vt.length&&xe().length<vt.length:dt=vt.length&&0<=te.selectedIndex?B.w.M(te.options[te.selectedIndex])!==vt[0]:vt.length||0<=te.selectedIndex,dt&&B.u.G(B.a.Fb,null,[te,"change"])}(Ie||B.S.Ya())&&B.i.ma(te,B.i.H),B.a.wd(te),Ve&&20<Math.abs(Ve-te.scrollTop)&&(te.scrollTop=Ve)}},B.c.options.$b=B.a.g.Z(),B.c.selectedOptions={init:function(te,ce,ye){function xe(){var Ge=ce(),Ve=[];B.a.D(te.getElementsByTagName("option"),function(Le){Le.selected&&Ve.push(B.w.M(Le))}),B.m.eb(Ge,ye,"selectedOptions",Ve)}function ze(){var Ge=B.a.f(ce()),Ve=te.scrollTop;Ge&&typeof Ge.length=="number"&&B.a.D(te.getElementsByTagName("option"),function(Le){var Ie=0<=B.a.A(Ge,B.w.M(Le));Le.selected!=Ie&&B.a.Zc(Le,Ie)}),te.scrollTop=Ve}if(B.a.R(te)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var Ne;B.i.subscribe(te,B.i.H,function(){Ne?xe():(B.a.B(te,"change",xe),Ne=B.o(ze,null,{l:te}))},null,{notifyImmediately:!0})},update:function(){}},B.m.wa.selectedOptions=!0,B.c.style={update:function(te,ce){var ye=B.a.f(ce()||{});B.a.P(ye,function(xe,ze){if(ze=B.a.f(ze),(ze===null||ze===t||ze===!1)&&(ze=""),y)y(te).css(xe,ze);else if(/^--/.test(xe))te.style.setProperty(xe,ze);else{xe=xe.replace(/-(\w)/g,function(Ge,Ve){return Ve.toUpperCase()});var Ne=te.style[xe];te.style[xe]=ze,ze===Ne||te.style[xe]!=Ne||isNaN(ze)||(te.style[xe]=ze+"px")}})}},B.c.submit={init:function(te,ce,ye,xe,ze){if(typeof ce()!="function")throw Error("The value for a submit binding must be a function");B.a.B(te,"submit",function(Ne){var Ge,Ve=ce();try{Ge=Ve.call(ze.$data,te)}finally{Ge!==!0&&(Ne.preventDefault?Ne.preventDefault():Ne.returnValue=!1)}})}},B.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(te,ce){B.a.Bb(te,ce())}},B.h.ea.text=!0,function(){if(r&&r.navigator){var te=function(et){if(et)return parseFloat(et[1])},ce=r.navigator.userAgent,ye,xe,ze,Ne,Ge;(ye=r.opera&&r.opera.version&&parseInt(r.opera.version()))||(Ge=te(ce.match(/Edge\/([^ ]+)$/)))||te(ce.match(/Chrome\/([^ ]+)/))||(xe=te(ce.match(/Version\/([^ ]+) Safari/)))||(ze=te(ce.match(/Firefox\/([^ ]+)/)))||(Ne=B.a.W||te(ce.match(/MSIE ([^ ]+)/)))||(Ne=te(ce.match(/rv:([^ )]+)/)))}if(8<=Ne&&10>Ne)var Ve=B.a.g.Z(),Le=B.a.g.Z(),Ie=function(et){var vt=this.activeElement;(vt=vt&&B.a.g.get(vt,Le))&&vt(et)},qe=function(et,vt){var Be=et.ownerDocument;B.a.g.get(Be,Ve)||(B.a.g.set(Be,Ve,!0),B.a.B(Be,"selectionchange",Ie)),B.a.g.set(et,Le,vt)};B.c.textInput={init:function(et,vt,Be){function dt(fi,Gi){B.a.B(et,fi,Gi)}function ut(){var fi=B.a.f(vt());(fi===null||fi===t)&&(fi=""),Ft!==t&&fi===Ft?B.a.setTimeout(ut,4):et.value!==fi&&(mi=!0,et.value=fi,mi=!1,Nt=et.value)}function Qt(){Ct||(Ft=et.value,Ct=B.a.setTimeout(Wt,4))}function Wt(){clearTimeout(Ct),Ft=Ct=t;var fi=et.value;Nt!==fi&&(Nt=fi,B.m.eb(vt(),Be,"textInput",fi))}var Nt=et.value,Ct,Ft,Xt=B.a.W==9?Qt:Wt,mi=!1;Ne&&dt("keypress",Wt),11>Ne&&dt("propertychange",function(fi){mi||fi.propertyName!=="value"||Xt()}),Ne==8&&(dt("keyup",Wt),dt("keydown",Wt)),qe&&(qe(et,Xt),dt("dragend",Qt)),(!Ne||9<=Ne)&&dt("input",Xt),5>xe&&B.a.R(et)==="textarea"?(dt("keydown",Qt),dt("paste",Qt),dt("cut",Qt)):11>ye?dt("keydown",Qt):4>ze?(dt("DOMAutoComplete",Wt),dt("dragdrop",Wt),dt("drop",Wt)):Ge&&et.type==="number"&&dt("keydown",Qt),dt("change",Wt),dt("blur",Wt),B.o(ut,null,{l:et})}},B.m.wa.textInput=!0,B.c.textinput={preprocess:function(et,vt,Be){Be("textInput",et)}}}(),B.c.uniqueName={init:function(te,ce){if(ce()){var ye="ko_unique_"+ ++B.c.uniqueName.rd;B.a.Yc(te,ye)}}},B.c.uniqueName.rd=0,B.c.using={init:function(te,ce,ye,xe,ze){var Ne;return ye.has("as")&&(Ne={as:ye.get("as"),noChildContext:ye.get("noChildContext")}),ce=ze.createChildContext(ce,Ne),B.Oa(ce,te),{controlsDescendantBindings:!0}}},B.h.ea.using=!0,B.c.value={init:function(te,ce,ye){var xe=B.a.R(te),ze=xe=="input";if(!ze||te.type!="checkbox"&&te.type!="radio"){var Ne=[],Ge=ye.get("valueUpdate"),Ve=!1,Le=null;Ge&&(typeof Ge=="string"?Ne=[Ge]:Ne=B.a.wc(Ge),B.a.Pa(Ne,"change"));var Ie=function(){Le=null,Ve=!1;var vt=ce(),Be=B.w.M(te);B.m.eb(vt,ye,"value",Be)};!B.a.W||!ze||te.type!="text"||te.autocomplete=="off"||te.form&&te.form.autocomplete=="off"||B.a.A(Ne,"propertychange")!=-1||(B.a.B(te,"propertychange",function(){Ve=!0}),B.a.B(te,"focus",function(){Ve=!1}),B.a.B(te,"blur",function(){Ve&&Ie()})),B.a.D(Ne,function(vt){var Be=Ie;B.a.Ud(vt,"after")&&(Be=function(){Le=B.w.M(te),B.a.setTimeout(Ie,0)},vt=vt.substring(5)),B.a.B(te,vt,Be)});var qe;if(qe=ze&&te.type=="file"?function(){var vt=B.a.f(ce());vt===null||vt===t||vt===""?te.value="":B.u.G(Ie)}:function(){var vt=B.a.f(ce()),Be=B.w.M(te);Le!==null&&vt===Le?B.a.setTimeout(qe,0):(vt!==Be||Be===t)&&(xe==="select"?(Be=ye.get("valueAllowUnset"),B.w.cb(te,vt,Be),Be||vt===B.w.M(te)||B.u.G(Ie)):B.w.cb(te,vt))},xe==="select"){var et;B.i.subscribe(te,B.i.H,function(){et?ye.get("valueAllowUnset")?qe():Ie():(B.a.B(te,"change",Ie),et=B.o(qe,null,{l:te}))},null,{notifyImmediately:!0})}else B.a.B(te,"change",Ie),B.o(qe,null,{l:te})}else B.ib(te,{checkedValue:ce})},update:function(){}},B.m.wa.value=!0,B.c.visible={update:function(te,ce){var ye=B.a.f(ce()),xe=te.style.display!="none";ye&&!xe?te.style.display="":!ye&&xe&&(te.style.display="none")}},B.c.hidden={update:function(te,ce){B.c.visible.update(te,function(){return!B.a.f(ce())})}},function(te){B.c[te]={init:function(ce,ye,xe,ze,Ne){return B.c.event.init.call(this,ce,function(){var Ge={};return Ge[te]=ye(),Ge},xe,ze,Ne)}}}("click"),B.ca=function(){},B.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},B.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},B.ca.prototype.makeTemplateSource=function(te,ce){if(typeof te=="string"){ce=ce||c;var ye=ce.getElementById(te);if(!ye)throw Error("Cannot find template with ID "+te);return new B.C.F(ye)}if(te.nodeType==1||te.nodeType==8)return new B.C.ia(te);throw Error("Unknown template type: "+te)},B.ca.prototype.renderTemplate=function(te,ce,ye,xe){return te=this.makeTemplateSource(te,xe),this.renderTemplateSource(te,ce,ye,xe)},B.ca.prototype.isTemplateRewritten=function(te,ce){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(te,ce).data("isRewritten")},B.ca.prototype.rewriteTemplate=function(te,ce,ye){te=this.makeTemplateSource(te,ye),ce=ce(te.text()),te.text(ce),te.data("isRewritten",!0)},B.b("templateEngine",B.ca),B.kc=function(){function te(xe,ze,Ne,Ge){xe=B.m.ac(xe);for(var Ve=B.m.Ra,Le=0;Le<xe.length;Le++){var Ie=xe[Le].key;if(Object.prototype.hasOwnProperty.call(Ve,Ie)){var qe=Ve[Ie];if(typeof qe=="function"){if(Ie=qe(xe[Le].value))throw Error(Ie)}else if(!qe)throw Error("This template engine does not support the '"+Ie+"' binding within its templates")}}return Ne="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+B.m.vb(xe,{valueAccessors:!0})+" } })()},'"+Ne.toLowerCase()+"')",Ge.createJavaScriptEvaluatorBlock(Ne)+ze}var ce=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,ye=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(xe,ze,Ne){ze.isTemplateRewritten(xe,Ne)||ze.rewriteTemplate(xe,function(Ge){return B.kc.Ld(Ge,ze)},Ne)},Ld:function(xe,ze){return xe.replace(ce,function(Ne,Ge,Ve,Le,Ie){return te(Ie,Ge,Ve,ze)}).replace(ye,function(Ne,Ge){return te(Ge,"<!-- ko -->","#comment",ze)})},md:function(xe,ze){return B.aa.Xb(function(Ne,Ge){var Ve=Ne.nextSibling;Ve&&Ve.nodeName.toLowerCase()===ze&&B.ib(Ve,xe,Ge)})}}}(),B.b("__tr_ambtns",B.kc.md),function(){B.C={},B.C.F=function(ye){if(this.F=ye){var xe=B.a.R(ye);this.ab=xe==="script"?1:xe==="textarea"?2:xe=="template"&&ye.content&&ye.content.nodeType===11?3:4}},B.C.F.prototype.text=function(){var ye=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[ye];var xe=arguments[0];ye==="innerHTML"?B.a.fc(this.F,xe):this.F[ye]=xe};var te=B.a.g.Z()+"_";B.C.F.prototype.data=function(ye){if(arguments.length===1)return B.a.g.get(this.F,te+ye);B.a.g.set(this.F,te+ye,arguments[1])};var ce=B.a.g.Z();B.C.F.prototype.nodes=function(){var ye=this.F;if(arguments.length==0){var xe=B.a.g.get(ye,ce)||{},ze=xe.lb||(this.ab===3?ye.content:this.ab===4?ye:t);if(!ze||xe.jd){var Ne=this.text();Ne&&Ne!==xe.bb&&(ze=B.a.Md(Ne,ye.ownerDocument),B.a.g.set(ye,ce,{lb:ze,bb:Ne,jd:!0}))}return ze}xe=arguments[0],this.ab!==t&&this.text(""),B.a.g.set(ye,ce,{lb:xe})},B.C.ia=function(ye){this.F=ye},B.C.ia.prototype=new B.C.F,B.C.ia.prototype.constructor=B.C.ia,B.C.ia.prototype.text=function(){if(arguments.length==0){var ye=B.a.g.get(this.F,ce)||{};return ye.bb===t&&ye.lb&&(ye.bb=ye.lb.innerHTML),ye.bb}B.a.g.set(this.F,ce,{bb:arguments[0]})},B.b("templateSources",B.C),B.b("templateSources.domElement",B.C.F),B.b("templateSources.anonymousTemplate",B.C.ia)}(),function(){function te(Le,Ie,qe){var et;for(Ie=B.h.nextSibling(Ie);Le&&(et=Le)!==Ie;)Le=B.h.nextSibling(et),qe(et,Le)}function ce(Le,Ie){if(Le.length){var qe=Le[0],et=Le[Le.length-1],vt=qe.parentNode,Be=B.ga.instance,dt=Be.preprocessNode;if(dt){if(te(qe,et,function(ut,Qt){var Wt=ut.previousSibling,Nt=dt.call(Be,ut);Nt&&(ut===qe&&(qe=Nt[0]||Qt),ut===et&&(et=Nt[Nt.length-1]||Wt))}),Le.length=0,!qe)return;qe===et?Le.push(qe):(Le.push(qe,et),B.a.Ua(Le,vt))}te(qe,et,function(ut){ut.nodeType!==1&&ut.nodeType!==8||B.vc(Ie,ut)}),te(qe,et,function(ut){ut.nodeType!==1&&ut.nodeType!==8||B.aa.cd(ut,[Ie])}),B.a.Ua(Le,vt)}}function ye(Le){return Le.nodeType?Le:0<Le.length?Le[0]:null}function xe(Le,Ie,qe,et,vt){vt=vt||{};var Be=(Le&&ye(Le)||qe||{}).ownerDocument,dt=vt.templateEngine||Ne;if(B.kc.xd(qe,dt,Be),qe=dt.renderTemplate(qe,et,vt,Be),typeof qe.length!="number"||0<qe.length&&typeof qe[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch(Be=!1,Ie){case"replaceChildren":B.h.va(Le,qe),Be=!0;break;case"replaceNode":B.a.Xc(Le,qe),Be=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+Ie)}return Be&&(ce(qe,et),vt.afterRender&&B.u.G(vt.afterRender,null,[qe,et[vt.as||"$data"]]),Ie=="replaceChildren"&&B.i.ma(Le,B.i.H)),qe}function ze(Le,Ie,qe){return B.O(Le)?Le():typeof Le=="function"?Le(Ie,qe):Le}var Ne;B.gc=function(Le){if(Le!=t&&!(Le instanceof B.ca))throw Error("templateEngine must inherit from ko.templateEngine");Ne=Le},B.dc=function(Le,Ie,qe,et,vt){if(qe=qe||{},(qe.templateEngine||Ne)==t)throw Error("Set a template engine before calling renderTemplate");if(vt=vt||"replaceChildren",et){var Be=ye(et);return B.$(function(){var ut=Ie&&Ie instanceof B.fa?Ie:new B.fa(Ie,null,null,null,{exportDependencies:!0}),dt=ze(Le,ut.$data,ut),ut=xe(et,vt,dt,ut,qe);vt=="replaceNode"&&(et=ut,Be=ye(et))},null,{Sa:function(){return!Be||!B.a.Sb(Be)},l:Be&&vt=="replaceNode"?Be.parentNode:Be})}return B.aa.Xb(function(dt){B.dc(Le,Ie,qe,dt,"replaceNode")})},B.Qd=function(Le,Ie,qe,et,vt){function Be(Ft,Xt){B.u.G(B.a.ec,null,[et,Ft,ut,qe,dt,Xt]),B.i.ma(et,B.i.H)}function dt(Ft,Xt){ce(Xt,Qt),qe.afterRender&&qe.afterRender(Xt,Ft),Qt=null}function ut(Ft,Xt){Qt=vt.createChildContext(Ft,{as:Wt,noChildContext:qe.noChildContext,extend:function(fi){fi.$index=Xt,Wt&&(fi[Wt+"Index"]=Xt)}});var mi=ze(Le,Ft,Qt);return xe(et,"ignoreTargetNode",mi,Qt,qe)}var Qt,Wt=qe.as,Nt=qe.includeDestroyed===!1||B.options.foreachHidesDestroyed&&!qe.includeDestroyed;if(Nt||qe.beforeRemove||!B.Pc(Ie))return B.$(function(){var Ft=B.a.f(Ie)||[];typeof Ft.length>"u"&&(Ft=[Ft]),Nt&&(Ft=B.a.jb(Ft,function(Xt){return Xt===t||Xt===null||!B.a.f(Xt._destroy)})),Be(Ft)},null,{l:et});Be(Ie.v());var Ct=Ie.subscribe(function(Ft){Be(Ie(),Ft)},null,"arrayChange");return Ct.l(et),Ct};var Ge=B.a.g.Z(),Ve=B.a.g.Z();B.c.template={init:function(Le,Ie){var qe=B.a.f(Ie());if(typeof qe=="string"||"name"in qe)B.h.Ea(Le);else if("nodes"in qe){if(qe=qe.nodes||[],B.O(qe))throw Error('The "nodes" option must be a plain, non-observable array.');var et=qe[0]&&qe[0].parentNode;et&&B.a.g.get(et,Ve)||(et=B.a.Yb(qe),B.a.g.set(et,Ve,!0)),new B.C.ia(Le).nodes(et)}else if(qe=B.h.childNodes(Le),0<qe.length)et=B.a.Yb(qe),new B.C.ia(Le).nodes(et);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(Le,Ie,qe,et,vt){var Be=Ie();Ie=B.a.f(Be),qe=!0,et=null,typeof Ie=="string"?Ie={}:(Be="name"in Ie?Ie.name:Le,"if"in Ie&&(qe=B.a.f(Ie.if)),qe&&"ifnot"in Ie&&(qe=!B.a.f(Ie.ifnot)),qe&&!Be&&(qe=!1)),"foreach"in Ie?et=B.Qd(Be,qe&&Ie.foreach||[],Ie,Le,vt):qe?(qe=vt,"data"in Ie&&(qe=vt.createChildContext(Ie.data,{as:Ie.as,noChildContext:Ie.noChildContext,exportDependencies:!0})),et=B.dc(Be,qe,Ie,Le)):B.h.Ea(Le),vt=et,(Ie=B.a.g.get(Le,Ge))&&typeof Ie.s=="function"&&Ie.s(),B.a.g.set(Le,Ge,!vt||vt.ja&&!vt.ja()?t:vt)}},B.m.Ra.template=function(Le){return Le=B.m.ac(Le),Le.length==1&&Le[0].unknown||B.m.Id(Le,"name")?null:"This template engine does not support anonymous templates nested within its templates"},B.h.ea.template=!0}(),B.b("setTemplateEngine",B.gc),B.b("renderTemplate",B.dc),B.a.Kc=function(te,ce,ye){if(te.length&&ce.length){var xe,ze,Ne,Ge,Ve;for(xe=ze=0;(!ye||xe<ye)&&(Ge=te[ze]);++ze){for(Ne=0;Ve=ce[Ne];++Ne)if(Ge.value===Ve.value){Ge.moved=Ve.index,Ve.moved=Ge.index,ce.splice(Ne,1),xe=Ne=0;break}xe+=Ne}}},B.a.Pb=function(){function te(ce,ye,xe,ze,Ne){var Ge=Math.min,Ve=Math.max,Le=[],Ie,qe=ce.length,et,vt=ye.length,Be=vt-qe||1,dt=qe+vt+1,ut,Qt,Wt;for(Ie=0;Ie<=qe;Ie++)for(Qt=ut,Le.push(ut=[]),Wt=Ge(vt,Ie+Be),et=Ve(0,Ie-1);et<=Wt;et++)ut[et]=et?Ie?ce[Ie-1]===ye[et-1]?Qt[et-1]:Ge(Qt[et]||dt,ut[et-1]||dt)+1:et+1:Ie+1;for(Ge=[],Ve=[],Be=[],Ie=qe,et=vt;Ie||et;)vt=Le[Ie][et]-1,et&&vt===Le[Ie][et-1]?Ve.push(Ge[Ge.length]={status:xe,value:ye[--et],index:et}):Ie&&vt===Le[Ie-1][et]?Be.push(Ge[Ge.length]={status:ze,value:ce[--Ie],index:Ie}):(--et,--Ie,Ne.sparse||Ge.push({status:"retained",value:ye[et]}));return B.a.Kc(Be,Ve,!Ne.dontLimitMoves&&10*qe),Ge.reverse()}return function(ce,ye,xe){return xe=typeof xe=="boolean"?{dontLimitMoves:xe}:xe||{},ce=ce||[],ye=ye||[],ce.length<ye.length?te(ce,ye,"added","deleted",xe):te(ye,ce,"deleted","added",xe)}}(),B.b("utils.compareArrays",B.a.Pb),function(){function te(xe,ze,Ne,Ge,Ve){var Le=[],Ie=B.$(function(){var qe=ze(Ne,Ve,B.a.Ua(Le,xe))||[];0<Le.length&&(B.a.Xc(Le,qe),Ge&&B.u.G(Ge,null,[Ne,qe,Ve])),Le.length=0,B.a.Nb(Le,qe)},null,{l:xe,Sa:function(){return!B.a.kd(Le)}});return{Y:Le,$:Ie.ja()?Ie:t}}var ce=B.a.g.Z(),ye=B.a.g.Z();B.a.ec=function(xe,ze,Ne,Ge,Ve,Le){function Ie(ti){mi={Aa:ti,pb:B.ta(Qt++)},dt.push(mi),Be||Xt.push(mi)}function qe(ti){mi=vt[ti],Qt!==mi.pb.v()&&Ft.push(mi),mi.pb(Qt++),B.a.Ua(mi.Y,xe),dt.push(mi)}function et(ti,Ni){if(ti)for(var qi=0,en=Ni.length;qi<en;qi++)B.a.D(Ni[qi].Y,function($t){ti($t,qi,Ni[qi].Aa)})}ze=ze||[],typeof ze.length>"u"&&(ze=[ze]),Ge=Ge||{};var vt=B.a.g.get(xe,ce),Be=!vt,dt=[],ut=0,Qt=0,Wt=[],Nt=[],Ct=[],Ft=[],Xt=[],mi,fi=0;if(Be)B.a.D(ze,Ie);else{if(!Le||vt&&vt._countWaitingForRemove){var Gi=B.a.Mb(vt,function(ti){return ti.Aa});Le=B.a.Pb(Gi,ze,{dontLimitMoves:Ge.dontLimitMoves,sparse:!0})}for(var Gi=0,wn,Qi,Gn;wn=Le[Gi];Gi++)switch(Qi=wn.moved,Gn=wn.index,wn.status){case"deleted":for(;ut<Gn;)qe(ut++);Qi===t&&(mi=vt[ut],mi.$&&(mi.$.s(),mi.$=t),B.a.Ua(mi.Y,xe).length&&(Ge.beforeRemove&&(dt.push(mi),fi++,mi.Aa===ye?mi=null:Ct.push(mi)),mi&&Wt.push.apply(Wt,mi.Y))),ut++;break;case"added":for(;Qt<Gn;)qe(ut++);Qi!==t?(Nt.push(dt.length),qe(Qi)):Ie(wn.value)}for(;Qt<ze.length;)qe(ut++);dt._countWaitingForRemove=fi}B.a.g.set(xe,ce,dt),et(Ge.beforeMove,Ft),B.a.D(Wt,Ge.beforeRemove?B.oa:B.removeNode);var kn,yt,st;try{st=xe.ownerDocument.activeElement}catch{}if(Nt.length)for(;(Gi=Nt.shift())!=t;){for(mi=dt[Gi],kn=t;Gi;)if((yt=dt[--Gi].Y)&&yt.length){kn=yt[yt.length-1];break}for(ze=0;ut=mi.Y[ze];kn=ut,ze++)B.h.Wb(xe,ut,kn)}for(Gi=0;mi=dt[Gi];Gi++){for(mi.Y||B.a.extend(mi,te(xe,Ne,mi.Aa,Ve,mi.pb)),ze=0;ut=mi.Y[ze];kn=ut,ze++)B.h.Wb(xe,ut,kn);!mi.Ed&&Ve&&(Ve(mi.Aa,mi.Y,mi.pb),mi.Ed=!0,kn=mi.Y[mi.Y.length-1])}for(st&&xe.ownerDocument.activeElement!=st&&st.focus(),et(Ge.beforeRemove,Ct),Gi=0;Gi<Ct.length;++Gi)Ct[Gi].Aa=ye;et(Ge.afterMove,Ft),et(Ge.afterAdd,Xt)}}(),B.b("utils.setDomNodeChildrenFromArrayMapping",B.a.ec),B.ba=function(){this.allowTemplateRewriting=!1},B.ba.prototype=new B.ca,B.ba.prototype.constructor=B.ba,B.ba.prototype.renderTemplateSource=function(te,ce,ye,xe){return(ce=!(9>B.a.W)&&te.nodes?te.nodes():null)?B.a.la(ce.cloneNode(!0).childNodes):(te=te.text(),B.a.ua(te,xe))},B.ba.Ma=new B.ba,B.gc(B.ba.Ma),B.b("nativeTemplateEngine",B.ba),function(){B.$a=function(){var ce=this.Hd=function(){if(!y||!y.tmpl)return 0;try{if(0<=y.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch{}return 1}();this.renderTemplateSource=function(ye,xe,ze,Ne){if(Ne=Ne||c,ze=ze||{},2>ce)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var Ge=ye.data("precompiled");return Ge||(Ge=ye.text()||"",Ge=y.template(null,"{{ko_with $item.koBindingContext}}"+Ge+"{{/ko_with}}"),ye.data("precompiled",Ge)),ye=[xe.$data],xe=y.extend({koBindingContext:xe},ze.templateOptions),xe=y.tmpl(Ge,ye,xe),xe.appendTo(Ne.createElement("div")),y.fragments={},xe},this.createJavaScriptEvaluatorBlock=function(ye){return"{{ko_code ((function() { return "+ye+" })()) }}"},this.addTemplate=function(ye,xe){c.write("<script type='text/html' id='"+ye+"'>"+xe+"<\/script>")},0<ce&&(y.tmpl.tag.ko_code={open:"__.push($1 || '');"},y.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},B.$a.prototype=new B.ca,B.$a.prototype.constructor=B.$a;var te=new B.$a;0<te.Hd&&B.gc(te),B.b("jqueryTmplTemplateEngine",B.$a)}()})})()})()})(vv,vv.exports);const{sin:Fc,cos:PV,sqrt:vB,abs:wv,PI:Ll}=Math,iS=6378245,nS=.006693421622965823;function kF(u,e){return u>=72.004&&u<=137.8347&&e>=.8293&&e<=55.8271}function UV(u,e){let t=-100+2*u+3*e+.2*e*e+.1*u*e+.2*vB(wv(u));return t+=(20*Fc(6*u*Ll)+20*Fc(2*u*Ll))*2/3,t+=(20*Fc(e*Ll)+40*Fc(e/3*Ll))*2/3,t+=(160*Fc(e/12*Ll)+320*Fc(e*Ll/30))*2/3,t}function RV(u,e){let t=300+u+2*e+.1*u*u+.1*u*e+.1*vB(wv(u));return t+=(20*Fc(6*u*Ll)+20*Fc(2*u*Ll))*2/3,t+=(20*Fc(u*Ll)+40*Fc(u/3*Ll))*2/3,t+=(150*Fc(u/12*Ll)+300*Fc(u/30*Ll))*2/3,t}function zV(u,e){let t=RV(u-105,e-35),r=UV(u-105,e-35);const c=e/180*Ll;let p=Fc(c);p=1-nS*p*p;const y=vB(p);return t=t*180/(iS/y*PV(c)*Ll),r=r*180/(iS*(1-nS)/(p*y)*Ll),[t,r]}function rp(u){const[e,t]=u;if(!kF(e,t))return[e,t];const r=zV(e,t);return[e+r[0],t+r[1]]}function $m(u){const[e,t]=u;if(!kF(e,t))return[e,t];let[r,c]=[e,t],p=rp([r,c]),y=p[0]-e,i=p[1]-t;for(;wv(y)>1e-6||wv(i)>1e-6;)r-=y,c-=i,p=rp([r,c]),y=p[0]-e,i=p[1]-t;return[r,c]}const{sin:bv,cos:Bv,atan2:OF,sqrt:NF,PI:kV}=Math,Cv=kV*3e3/180;function Vm(u){const[e,t]=u,r=e-.0065,c=t-.006,p=NF(r*r+c*c)-2e-5*bv(c*Cv),y=OF(c,r)-3e-6*Bv(r*Cv),i=p*Bv(y),C=p*bv(y);return[i,C]}function Zm(u){const[e,t]=u,r=e,c=t,p=NF(r*r+c*c)+2e-5*bv(c*Cv),y=OF(c,r)+3e-6*Bv(r*Cv),i=p*Bv(y)+.0065,C=p*bv(y)+.006;return[i,C]}const rS=180/Math.PI,sS=Math.PI/180,Ev=6378137,Vd=20037508342789244e-9;function zx(u){return[u[0]*rS/Ev,(Math.PI*.5-2*Math.atan(Math.exp(-u[1]/Ev)))*rS]}function i1(u){const e=Math.abs(u[0])<=180?u[0]:u[0]-(u[0]<0?-1:1)*360,t=[Ev*e*sS,Ev*Math.log(Math.tan(Math.PI*.25+.5*u[1]*sS))];return t[0]>Vd&&(t[0]=Vd),t[0]<-Vd&&(t[0]=-Vd),t[1]>Vd&&(t[1]=Vd),t[1]<-Vd&&(t[1]=-Vd),t}const{abs:y2}=Math,oS=[1289059486e-2,836237787e-2,5591021,348198983e-2,167804312e-2,0],aS=[75,60,45,30,15,0],OV=[[1410526172116255e-23,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,173379812e-1],[-7435856389565537e-24,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,1026014486e-2],[-3030883460898826e-23,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,685681737e-2],[-1981981304930552e-23,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,448277706e-2],[309191371068437e-23,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,25551644e-1],[2890871144776878e-24,8983055095805407e-21,-3068298e-14,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],NV=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,6477955746671607e-7,-4082003173641316e-6,1077490566351142e-5,-1517187553151559e-5,1205306533862167e-5,-5124939663577472e-6,9133119359512032e-7,67.5],[.00337398766765,111320.7020202162,4481351045890365e-9,-2339375119931662e-8,7968221547186455e-8,-1159649932797253e-7,9723671115602145e-8,-4366194633752821e-8,8477230501135234e-9,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837749470245e-9,992013.7397791013,-122195221711287e-8,1340652697009075e-9,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758690035394e-9,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]];function QF(u,e,t){const r=y2(e)/t[9];let c=t[0]+t[1]*y2(u),p=t[2]+t[3]*r+t[4]*r**2+t[5]*r**3+t[6]*r**4+t[7]*r**5+t[8]*r**6;return c*=u<0?-1:1,p*=e<0?-1:1,[c,p]}function n1(u){const[e,t]=u;let r=[];for(let c=0;c<aS.length;c++)if(y2(t)>aS[c]){r=NV[c];break}return QF(e,t,r)}function kx(u){const[e,t]=u;let r=[];for(let c=0;c<oS.length;c++)if(t>=oS[c]){r=OV[c];break}return QF(e,t,r)}function Hd(u,e){if(!u)throw new Error(e)}function VF(u){return!!u&&Object.prototype.toString.call(u)==="[object Array]"}function lS(u){return!isNaN(Number(u))&&u!==null&&!VF(u)}function Ch(...u){const e=u.length-1;return function(...t){let r=e,c=u[e].apply(null,t);for(;r--;)c=u[r].call(null,c);return c}}function HF(u,e,t=!1){if(u===null)return;let r,c,p,y,i,C,D,U=0,N=0,R;const{type:G}=u,J=G==="FeatureCollection",Y=G==="Feature",B=J?u.features.length:1;for(let ae=0;ae<B;ae++){D=J?u.features[ae].geometry:Y?u.geometry:u,R=D?D.type==="GeometryCollection":!1,i=R?D.geometries.length:1;for(let le=0;le<i;le++){let Ae=0,we=0;if(y=R?D.geometries[le]:D,y===null)continue;const me=y.type;switch(U=t&&(me==="Polygon"||me==="MultiPolygon")?1:0,me){case null:break;case"Point":if(C=y.coordinates,e(C,N,ae,Ae,we)===!1)return!1;N++,Ae++;break;case"LineString":case"MultiPoint":for(C=y.coordinates,r=0;r<C.length;r++){if(e(C[r],N,ae,Ae,we)===!1)return!1;N++,me==="MultiPoint"&&Ae++}me==="LineString"&&Ae++;break;case"Polygon":case"MultiLineString":for(C=y.coordinates,r=0;r<C.length;r++){for(c=0;c<C[r].length-U;c++){if(e(C[r][c],N,ae,Ae,we)===!1)return!1;N++}me==="MultiLineString"&&Ae++,me==="Polygon"&&we++}me==="Polygon"&&Ae++;break;case"MultiPolygon":for(C=y.coordinates,r=0;r<C.length;r++){for(we=0,c=0;c<C[r].length;c++){for(p=0;p<C[r][c].length-U;p++){if(e(C[r][c][p],N,ae,Ae,we)===!1)return!1;N++}we++}Ae++}break;case"GeometryCollection":for(r=0;r<y.geometries.length;r++)if(HF(y.geometries[r],e,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}var x2=(u=>(u.WGS84="WGS84",u.WGS1984="WGS84",u.EPSG4326="WGS84",u.GCJ02="GCJ02",u.AMap="GCJ02",u.BD09="BD09",u.BD09LL="BD09",u.Baidu="BD09",u.BMap="BD09",u.BD09MC="BD09MC",u.BD09Meter="BD09MC",u.EPSG3857="EPSG3857",u.EPSG900913="EPSG3857",u.EPSG102100="EPSG3857",u.WebMercator="EPSG3857",u.WM="EPSG3857",u))(x2||{});const QV={to:{GCJ02:rp,BD09:Ch(Zm,rp),BD09MC:Ch(n1,Zm,rp),EPSG3857:i1}},VV={to:{WGS84:$m,BD09:Zm,BD09MC:Ch(n1,Zm),EPSG3857:Ch(i1,$m)}},HV={to:{WGS84:Ch($m,Vm),GCJ02:Vm,EPSG3857:Ch(i1,$m,Vm),BD09MC:n1}},GV={to:{WGS84:zx,GCJ02:Ch(rp,zx),BD09:Ch(Zm,rp,zx),BD09MC:Ch(n1,Zm,rp,zx)}},WV={to:{WGS84:Ch($m,Vm,kx),GCJ02:Ch(Vm,kx),EPSG3857:Ch(i1,$m,Vm,kx),BD09:kx}},jV={WGS84:QV,GCJ02:VV,BD09:HV,EPSG3857:GV,BD09MC:WV};function KV(u,e,t){if(Hd(!!u,"The args[0] input coordinate is required"),Hd(!!e,"The args[1] original coordinate system is required"),Hd(!!t,"The args[2] target coordinate system is required"),e===t)return u;const r=jV[e];Hd(!!r,`Invalid original coordinate system: ${e}`);const c=r.to[t];Hd(!!c,`Invalid target coordinate system: ${t}`);const p=typeof u;if(Hd(p==="string"||p==="object",`Invalid input coordinate type: ${p}`),p==="string")try{u=JSON.parse(u)}catch{throw new Error(`Invalid input coordinate: ${u}`)}let y=!1;VF(u)&&(Hd(u.length>=2,`Invalid input coordinate: ${u}`),Hd(lS(u[0])&&lS(u[1]),`Invalid input coordinate: ${u}`),u=u.map(Number),y=!0);const i=c;return y?i(u):(HF(u,C=>{[C[0],C[1]]=i(C)}),u)}const ib={...x2,CRSTypes:x2,transform:KV},$V=function(u){let e=document.createElement("div");e.innerHTML=u;let t=document.createDocumentFragment();for(;e.firstChild;)t.appendChild(e.firstChild);return t},ZV=`
- uniform sampler2D texture;
- varying float opacity;
- varying vec3 vexColor;
- void main(){
- gl_FragColor = vec4(vexColor,opacity);
- gl_FragColor = gl_FragColor * texture2D(texture,gl_PointCoord);
- // gl_FragColor = vec4(1.0,0.0,0.0,1.0);
- }
- `,XV=`
- attribute float size;
- attribute vec4 colors;
- varying float opacity;
- varying vec3 vexColor;
- void main(){
- vexColor.x = colors.r;
- vexColor.y = colors.g;
- vexColor.z = colors.b;
- //w\u5206\u91CF\u4E3A\u900F\u660E\u5EA6
- opacity = colors.w;
- vec4 mvPosition = modelViewMatrix * vec4(position,1.0);
- gl_PointSize = size;
- gl_Position = projectionMatrix * mvPosition;
- }
- `;class qV{constructor({vecs:e,num:t,size:r,color:c,speed:p=2e3}){zi(this,"speed");zi(this,"color");zi(this,"sizes");zi(this,"vecs");zi(this,"num");zi(this,"size");zi(this,"spline");zi(this,"particleSystem");zi(this,"tween");this.vecs=e,this.num=t,this.speed=p,this.size=r,this.spline=new X_(e),this.color=c,this.initFlyTrack()}initFlyTrack(){let e=this.spline.getPoints(this.num);const t=new br().setFromPoints(e),r=new sa({color:16777215});r.transparent=!0,r.opacity=.3;const c=new Ku(t,r);this.particleSystem=new As,this.particleSystem.name="flyline_particle_system",this.particleSystem.add(c)}start(){const e=this.spline.getPoints(this.num),t=e.length*4,r=e.length,c=new Float32Array(t),p=new Float32Array(r),y=new br().setFromPoints(e);for(let G=0,J=0;G<t;G+=4,J++)c[G]=this.color.r,c[G+1]=this.color.g,c[G+2]=this.color.b,c[G+3]=(G+3)/r,p[J]=this.size*(J/r);const i={texture:{value:new qI(this.createSpriteCanvas(this.size)),type:"t2"}};y.setAttribute("colors",new ds(c,4)),y.setAttribute("size",new ds(p,1));const C=new ko({uniforms:i,vertexShader:XV,fragmentShader:ZV,transparent:!0,depthTest:!1}),D=new Z2(y,C);D.name="partLinePoints",this.particleSystem.add(D);const U=5e3,N=this.num,R={start:0,end:N};this.tween=this.tweenAnimate(R,{start:U-N*5,end:U},this.speed*10,null,()=>{let G=[],J=Math.round(R.start),Y=Math.floor(R.end);for(let B=J;B<=Y&&B<=U;B++)G=G.concat(this.spline.getPointAt(B/U).toArray());y.attributes.position=new ds(new Float32Array(G),3)},()=>{}),this.tween.repeat(1/0).start()}stop(){this.tween.stop()}tweenAnimate(e,t,r,c,p,y){let i=c||N_.Easing.Linear.None,C=new N_.Tween(e).to(t,r).easing(i);return p&&C.onUpdate(()=>p()),y&&C.onComplete(()=>y()),C}createSpriteCanvas(e){const t=document.createElement("canvas");t.width=t.height=e;const r=t.getContext("2d");return r!=null&&(r.fillStyle="rgba(255,255,255,.0)",r.beginPath(),r.arc(e/2,e/2,e/2,0,Math.PI*2),r.fillStyle="white",r.fill(),r.closePath()),t}}const YV=(u,e)=>{let t=DV(u,e).geometry.coordinates,r,c=0;const p=Math.max(u[0],e[0]),y=Math.min(u[0],e[0]);t[0]>y&&t[0]<p?r=t[0]:t[0]<y?r=y+t[0]:t[0]>p&&(r=t[0]-p);const i=Math.max(u[1],e[1]),C=Math.min(u[1],e[1]);return t[1]>C&&t[1]<i?c=t[1]:t[1]<C?c=C:t[1]>i&&(c=i),[r,c]},v2={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
- varying vec2 vUv;
- void main() {
- vUv = uv;
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,fragmentShader:`
- uniform float opacity;
- uniform sampler2D tDiffuse;
- varying vec2 vUv;
- void main() {
- gl_FragColor = texture2D( tDiffuse, vUv );
- gl_FragColor.a *= opacity;
- }`};class Ty{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const JV=new fy(-1,1,1,-1,0,1),wB=new br;wB.setAttribute("position",new jn([-1,3,0,-1,-1,0,3,-1,0],3));wB.setAttribute("uv",new jn([0,2,0,0,2,0],2));class GF{constructor(e){this._mesh=new is(wB,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,JV)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class bB extends Ty{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof ko?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=_f.clone(e.uniforms),this.material=new ko({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new GF(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class cS extends Ty{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,r){const c=e.getContext(),p=e.state;p.buffers.color.setMask(!1),p.buffers.depth.setMask(!1),p.buffers.color.setLocked(!0),p.buffers.depth.setLocked(!0);let y,i;this.inverse?(y=0,i=1):(y=1,i=0),p.buffers.stencil.setTest(!0),p.buffers.stencil.setOp(c.REPLACE,c.REPLACE,c.REPLACE),p.buffers.stencil.setFunc(c.ALWAYS,y,4294967295),p.buffers.stencil.setClear(i),p.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),p.buffers.color.setLocked(!1),p.buffers.depth.setLocked(!1),p.buffers.stencil.setLocked(!1),p.buffers.stencil.setFunc(c.EQUAL,1,4294967295),p.buffers.stencil.setOp(c.KEEP,c.KEEP,c.KEEP),p.buffers.stencil.setLocked(!0)}}class eH extends Ty{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class nb{constructor(e,t){if(this.renderer=e,t===void 0){const r=e.getSize(new Di);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,t=new Oa(this._width*this._pixelRatio,this._height*this._pixelRatio),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new bB(v2),this.clock=new t1}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let r=!1;for(let c=0,p=this.passes.length;c<p;c++){const y=this.passes[c];if(y.enabled!==!1){if(y.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(c),y.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),y.needsSwap){if(r){const i=this.renderer.getContext(),C=this.renderer.state.buffers.stencil;C.setFunc(i.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),C.setFunc(i.EQUAL,1,4294967295)}this.swapBuffers()}cS!==void 0&&(y instanceof cS?r=!0:y instanceof eH&&(r=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new Di);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const r=this._width*this._pixelRatio,c=this._height*this._pixelRatio;this.renderTarget1.setSize(r,c),this.renderTarget2.setSize(r,c);for(let p=0;p<this.passes.length;p++)this.passes[p].setSize(r,c)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class hS extends Ty{constructor(e,t,r,c,p){super(),this.scene=e,this.camera=t,this.overrideMaterial=r,this.clearColor=c,this.clearAlpha=p!==void 0?p:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Dn}render(e,t,r){const c=e.autoClear;e.autoClear=!1;let p,y;this.overrideMaterial!==void 0&&(y=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),p=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,p),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=y),e.autoClear=c}}const uS={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Dn(0)},defaultOpacity:{value:0}},vertexShader:`
- varying vec2 vUv;
- void main() {
- vUv = uv;
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,fragmentShader:`
- uniform sampler2D tDiffuse;
- uniform vec3 defaultColor;
- uniform float defaultOpacity;
- uniform float luminosityThreshold;
- uniform float smoothWidth;
- varying vec2 vUv;
- void main() {
- vec4 texel = texture2D( tDiffuse, vUv );
- vec3 luma = vec3( 0.299, 0.587, 0.114 );
- float v = dot( texel.xyz, luma );
- vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
- float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
- gl_FragColor = mix( outputColor, texel, alpha );
- }`},Sv=class extends Ty{constructor(t,r,c,p){super();zi(this,"strength");zi(this,"radius");zi(this,"threshold");zi(this,"resolution");zi(this,"clearColor");zi(this,"renderTargetsHorizontal");zi(this,"renderTargetsVertical");zi(this,"nMips");zi(this,"renderTargetBright");zi(this,"highPassUniforms");zi(this,"materialHighPassFilter");zi(this,"separableBlurMaterials");zi(this,"compositeMaterial");zi(this,"bloomTintColors");zi(this,"copyUniforms");zi(this,"materialCopy");zi(this,"_oldClearColor");zi(this,"oldClearAlpha");zi(this,"basic");zi(this,"fsQuad");this.strength=r!==void 0?r:1,this.radius=c,this.threshold=p,this.resolution=t!==void 0?new Di(t.x,t.y):new Di(256,256),this.clearColor=new Dn(0,0,0);const y={minFilter:Xs,magFilter:Xs,format:Dl};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let i=Math.round(this.resolution.x/2),C=Math.round(this.resolution.y/2);this.renderTargetBright=new Oa(i,C,y),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let G=0;G<this.nMips;G++){const J=new Oa(i,C,y);J.texture.name="UnrealBloomPass.h"+G,J.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(J);const Y=new Oa(i,C,y);Y.texture.name="UnrealBloomPass.v"+G,Y.texture.generateMipmaps=!1,this.renderTargetsVertical.push(Y),i=Math.round(i/2),C=Math.round(C/2)}uS===void 0&&console.error("THREE.UnrealBloomPass relies on LuminosityHighPassShader");const D=uS;this.highPassUniforms=_f.clone(D.uniforms),this.highPassUniforms.luminosityThreshold.value=p,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new ko({uniforms:this.highPassUniforms,vertexShader:D.vertexShader,fragmentShader:D.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const U=[3,5,7,9,11];i=Math.round(this.resolution.x/2),C=Math.round(this.resolution.y/2);for(let G=0;G<this.nMips;G++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(U[G])),this.separableBlurMaterials[G].uniforms.texSize.value=new Di(i,C),i=Math.round(i/2),C=Math.round(C/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=r,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;const N=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=N,this.bloomTintColors=[new ft(1,1,1),new ft(1,1,1),new ft(1,1,1),new ft(1,1,1),new ft(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,v2===void 0&&console.error("THREE.UnrealBloomPass relies on CopyShader");const R=v2;this.copyUniforms=_f.clone(R.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new ko({uniforms:this.copyUniforms,vertexShader:R.vertexShader,fragmentShader:R.fragmentShader,blending:uv,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Dn,this.oldClearAlpha=1,this.basic=new na,this.fsQuad=new GF(null)}dispose(){for(let t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(let t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()}setSize(t,r){let c=Math.round(t/2),p=Math.round(r/2);this.renderTargetBright.setSize(c,p);for(let y=0;y<this.nMips;y++)this.renderTargetsHorizontal[y].setSize(c,p),this.renderTargetsVertical[y].setSize(c,p),this.separableBlurMaterials[y].uniforms.texSize.value=new Di(c,p),c=Math.round(c/2),p=Math.round(p/2)}render(t,r,c,p,y){t.getClearColor(this._oldClearColor),this.oldClearAlpha=t.getClearAlpha();const i=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),y&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=c.texture,t.setRenderTarget(null),t.clear(),this.fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=c.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this.fsQuad.render(t);let C=this.renderTargetBright;for(let D=0;D<this.nMips;D++)this.fsQuad.material=this.separableBlurMaterials[D],this.separableBlurMaterials[D].uniforms.colorTexture.value=C.texture,this.separableBlurMaterials[D].uniforms.direction.value=Sv.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[D]),t.clear(),this.fsQuad.render(t),this.separableBlurMaterials[D].uniforms.colorTexture.value=this.renderTargetsHorizontal[D].texture,this.separableBlurMaterials[D].uniforms.direction.value=Sv.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[D]),t.clear(),this.fsQuad.render(t),C=this.renderTargetsVertical[D];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this.fsQuad.render(t),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,y&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(c),this.fsQuad.render(t)),t.setClearColor(this._oldClearColor,this.oldClearAlpha),t.autoClear=i}getSeperableBlurMaterial(t){return new ko({defines:{KERNEL_RADIUS:t,SIGMA:t},uniforms:{colorTexture:{value:null},texSize:{value:new Di(.5,.5)},direction:{value:new Di(.5,.5)}},vertexShader:`varying vec2 vUv;
- void main() {
- vUv = uv;
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,fragmentShader:`#include <common>
- varying vec2 vUv;
- uniform sampler2D colorTexture;
- uniform vec2 texSize;
- uniform vec2 direction;
- float gaussianPdf(in float x, in float sigma) {
- return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
- }
- void main() {
- vec2 invSize = 1.0 / texSize; float fSigma = float(SIGMA); float weightSum = gaussianPdf(0.0, fSigma); float alphaSum = 0.0; vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum; for( int i = 1; i < KERNEL_RADIUS; i ++ ) { float x = float(i); float w = gaussianPdf(x, fSigma); vec2 uvOffset = direction * invSize * x; vec4 sample1 = texture2D( colorTexture, vUv + uvOffset); vec4 sample2 = texture2D( colorTexture, vUv - uvOffset); diffuseSum += (sample1.rgb + sample2.rgb) * w; alphaSum += (sample1.a + sample2.a) * w; weightSum += 2.0 * w; } gl_FragColor = vec4(diffuseSum/weightSum, alphaSum/weightSum);
- }`})}getCompositeMaterial(t){return new ko({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
- void main() {
- vUv = uv;
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,fragmentShader:`varying vec2 vUv;
- uniform sampler2D blurTexture1;
- uniform sampler2D blurTexture2;
- uniform sampler2D blurTexture3;
- uniform sampler2D blurTexture4;
- uniform sampler2D blurTexture5;
- uniform sampler2D dirtTexture;
- uniform float bloomStrength;
- uniform float bloomRadius;
- uniform float bloomFactors[NUM_MIPS];
- uniform vec3 bloomTintColors[NUM_MIPS];
- float lerpBloomFactor(const in float factor) {
- float mirrorFactor = 1.2 - factor;
- return mix(factor, mirrorFactor, bloomRadius);
- }
- void main() {
- gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
- lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
- lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
- lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
- lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
- }`})}};let Jd=Sv;zi(Jd,"BlurDirectionX"),zi(Jd,"BlurDirectionY");Jd.BlurDirectionX=new Di(1,0);Jd.BlurDirectionY=new Di(0,1);const tH={uniforms:{tDiffuse:{value:null},resolution:{value:new Di(1/1024,1/512)}},vertexShader:`
- varying vec2 vUv;
- void main() {
- vUv = uv;
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,fragmentShader:`
- precision highp float;
- uniform sampler2D tDiffuse;
- uniform vec2 resolution;
- varying vec2 vUv;
- // FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)
- //----------------------------------------------------------------------------------
- // File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag
- // SDK Version: v3.00
- // Email: gameworks@nvidia.com
- // Site: http://developer.nvidia.com/
- //
- // Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions
- // are met:
- // * Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- // * Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- // * Neither the name of NVIDIA CORPORATION nor the names of its
- // contributors may be used to endorse or promote products derived
- // from this software without specific prior written permission.
- //
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
- // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- //
- //----------------------------------------------------------------------------------
- #ifndef FXAA_DISCARD
- //
- // Only valid for PC OpenGL currently.
- // Probably will not work when FXAA_GREEN_AS_LUMA = 1.
- //
- // 1 = Use discard on pixels which don't need AA.
- // For APIs which enable concurrent TEX+ROP from same surface.
- // 0 = Return unchanged color on pixels which don't need AA.
- //
- #define FXAA_DISCARD 0
- #endif
- /*--------------------------------------------------------------------------*/
- #define FxaaTexTop(t, p) texture2D(t, p, -100.0)
- #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)
- /*--------------------------------------------------------------------------*/
- #define NUM_SAMPLES 5
- // assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha
- float contrast( vec4 a, vec4 b ) {
- vec4 diff = abs( a - b );
- return max( max( max( diff.r, diff.g ), diff.b ), diff.a );
- }
- /*============================================================================
- FXAA3 QUALITY - PC
- ============================================================================*/
- /*--------------------------------------------------------------------------*/
- vec4 FxaaPixelShader(
- vec2 posM,
- sampler2D tex,
- vec2 fxaaQualityRcpFrame,
- float fxaaQualityEdgeThreshold,
- float fxaaQualityinvEdgeThreshold
- ) {
- vec4 rgbaM = FxaaTexTop(tex, posM);
- vec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);
- vec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);
- vec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);
- vec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);
- // . S .
- // W M E
- // . N .
- bool earlyExit = max( max( max(
- contrast( rgbaM, rgbaN ),
- contrast( rgbaM, rgbaS ) ),
- contrast( rgbaM, rgbaE ) ),
- contrast( rgbaM, rgbaW ) )
- < fxaaQualityEdgeThreshold;
- // . 0 .
- // 0 0 0
- // . 0 .
- #if (FXAA_DISCARD == 1)
- if(earlyExit) FxaaDiscard;
- #else
- if(earlyExit) return rgbaM;
- #endif
- float contrastN = contrast( rgbaM, rgbaN );
- float contrastS = contrast( rgbaM, rgbaS );
- float contrastE = contrast( rgbaM, rgbaE );
- float contrastW = contrast( rgbaM, rgbaW );
- float relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );
- relativeVContrast *= fxaaQualityinvEdgeThreshold;
- bool horzSpan = relativeVContrast > 0.;
- // . 1 .
- // 0 0 0
- // . 1 .
- // 45 deg edge detection and corners of objects, aka V/H contrast is too similar
- if( abs( relativeVContrast ) < .3 ) {
- // locate the edge
- vec2 dirToEdge;
- dirToEdge.x = contrastE > contrastW ? 1. : -1.;
- dirToEdge.y = contrastS > contrastN ? 1. : -1.;
- // . 2 . . 1 .
- // 1 0 2 ~= 0 0 1
- // . 1 . . 0 .
- // tap 2 pixels and see which ones are "outside" the edge, to
- // determine if the edge is vertical or horizontal
- vec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);
- float matchAlongH = contrast( rgbaM, rgbaAlongH );
- // . 1 .
- // 0 0 1
- // . 0 H
- vec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);
- float matchAlongV = contrast( rgbaM, rgbaAlongV );
- // V 1 .
- // 0 0 1
- // . 0 .
- relativeVContrast = matchAlongV - matchAlongH;
- relativeVContrast *= fxaaQualityinvEdgeThreshold;
- if( abs( relativeVContrast ) < .3 ) { // 45 deg edge
- // 1 1 .
- // 0 0 1
- // . 0 1
- // do a simple blur
- return mix(
- rgbaM,
- (rgbaN + rgbaS + rgbaE + rgbaW) * .25,
- .4
- );
- }
- horzSpan = relativeVContrast > 0.;
- }
- if(!horzSpan) rgbaN = rgbaW;
- if(!horzSpan) rgbaS = rgbaE;
- // . 0 . 1
- // 1 0 1 -> 0
- // . 0 . 1
- bool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );
- if(!pairN) rgbaN = rgbaS;
- vec2 offNP;
- offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
- offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
- bool doneN = false;
- bool doneP = false;
- float nDist = 0.;
- float pDist = 0.;
- vec2 posN = posM;
- vec2 posP = posM;
- int iterationsUsed = 0;
- int iterationsUsedN = 0;
- int iterationsUsedP = 0;
- for( int i = 0; i < NUM_SAMPLES; i++ ) {
- iterationsUsed = i;
- float increment = float(i + 1);
- if(!doneN) {
- nDist += increment;
- posN = posM + offNP * nDist;
- vec4 rgbaEndN = FxaaTexTop(tex, posN.xy);
- doneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );
- iterationsUsedN = i;
- }
- if(!doneP) {
- pDist += increment;
- posP = posM - offNP * pDist;
- vec4 rgbaEndP = FxaaTexTop(tex, posP.xy);
- doneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );
- iterationsUsedP = i;
- }
- if(doneN || doneP) break;
- }
- if ( !doneP && !doneN ) return rgbaM; // failed to find end of edge
- float dist = min(
- doneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,
- doneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.
- );
- // hacky way of reduces blurriness of mostly diagonal edges
- // but reduces AA quality
- dist = pow(dist, .5);
- dist = 1. - dist;
- return mix(
- rgbaM,
- rgbaN,
- dist * .5
- );
- }
- void main() {
- const float edgeDetectionQuality = .2;
- const float invEdgeDetectionQuality = 1. / edgeDetectionQuality;
- gl_FragColor = FxaaPixelShader(
- vUv,
- tDiffuse,
- resolution,
- edgeDetectionQuality, // [0,1] contrast needed, otherwise early discard
- invEdgeDetectionQuality
- );
- }
- `},iH=`
- varying vec2 vUv;
- void main() {
- vUv = uv;
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }
- `,nH=`
- uniform sampler2D baseTexture;
- uniform sampler2D bloomTexture;
- varying vec2 vUv;
- void main() {
- gl_FragColor = ( texture2D( baseTexture, vUv ) + vec4( 1.0 ) * texture2D( bloomTexture, vUv ) );
- }
- `,rH=u=>{const e=window.innerWidth||1,t=window.innerHeight||1,r={minFilter:Xs,magFilter:Xs,format:Dl,stencilBuffer:!1},c=new Oa(e,t,r),p=new nb(u.renderer);p.renderToScreen=!1;const y=new hS(u.scene,u.camera),i=oH(p,u);p.addPass(y),p.addPass(i);const C=new nb(u.renderer,c),D=aH(p),U=sH(u);C.addPass(y),C.addPass(D),C.addPass(U);const N=new nb(u.renderer),R=new hS(u.scene,u.camera),G=new Jd(new Di(window.innerWidth,window.innerHeight),1.5,.4,.85);return N.addPass(R),N.addPass(G),{bloomComposer:p,finalComposer:C,composerOther:N}};function sH(u){let e=new bB(tH);const t=u.renderer.getPixelRatio();return e.material.uniforms.resolution.value.x=1/(window.innerWidth*t),e.material.uniforms.resolution.value.y=1/(window.innerHeight*t),e.renderToScreen=!0,e.material.transparent=!0,e}function oH(u,e){var p;const t={exposure:1,bloomThreshold:.3,bloomStrength:1.5,bloomRadius:.1,scene:"Scene with Glow"},r=new Jd(new Di(window.innerWidth,window.innerHeight),15e-5,4e-4,85e-5);r.threshold=t.bloomThreshold,r.strength=t.bloomStrength,r.radius=t.bloomRadius;const c=(p=e.gui)==null?void 0:p.addFolder("bloomPass");return c.add(t,"exposure",.1,2).onChange(function(y){e.renderer.toneMappingExposure=Math.pow(y,4)}),c.add(t,"bloomThreshold",0,1).onChange(function(y){r.threshold=Number(y)}),c.add(t,"bloomStrength",0,10).onChange(function(y){r.strength=Number(y)}),c.add(t,"bloomRadius",0,1).step(.01).onChange(function(y){r.radius=Number(y)}),r}function aH(u){const e=new ko({uniforms:{baseTexture:{value:null},bloomTexture:{value:u.renderTarget2.texture}},vertexShader:iH,fragmentShader:nH,defines:{}}),t=new bB(e,"baseTexture");return t.needsSwap=!0,t}function lH(u,e,t){return r=>{(r.isMesh||r.isSprite)&&u.test(r.layers)===!1&&(r.isSprite?(e[r.uuid]=r.material,r.material=new my({color:"#000"})):(e[r.uuid]=r.material,r.material=t))}}function cH(u){return e=>{u[e.uuid]&&(e.material=u[e.uuid],delete u[e.uuid])}}const AS=u=>{const e=new dy;return e.set(u),e.currentLayerNum=u,e};class BB{constructor(e=0,t=0){BB.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,c=e.elements;return this.x=c[0]*t+c[3]*r+c[6],this.y=c[1]*t+c[4]*r+c[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),c=Math.sin(t),p=this.x-e.x,y=this.y-e.y;return this.x=p*r-y*c+e.x,this.y=p*c+y*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const dS={type:"change"},rb={type:"start"},pS={type:"end"};class hH extends Xu{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new ft,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:$p.ROTATE,MIDDLE:$p.DOLLY,RIGHT:$p.PAN},this.touches={ONE:Zp.ROTATE,TWO:Zp.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return i.phi},this.getAzimuthalAngle=function(){return i.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(at){at.addEventListener("keydown",kn),this._domElementKeyEvents=at},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(dS),r.update(),p=c.NONE},this.update=function(){const at=new ft,ii=new sl().setFromUnitVectors(e.up,new ft(0,1,0)),hn=ii.clone().invert(),Xi=new ft,on=new sl,Cn=2*Math.PI;return function(){const nr=r.object.position;at.copy(nr).sub(r.target),at.applyQuaternion(ii),i.setFromVector3(at),r.autoRotate&&p===c.NONE&&Ke(it()),r.enableDamping?(i.theta+=C.theta*r.dampingFactor,i.phi+=C.phi*r.dampingFactor):(i.theta+=C.theta,i.phi+=C.phi);let Ii=r.minAzimuthAngle,bn=r.maxAzimuthAngle;return isFinite(Ii)&&isFinite(bn)&&(Ii<-Math.PI?Ii+=Cn:Ii>Math.PI&&(Ii-=Cn),bn<-Math.PI?bn+=Cn:bn>Math.PI&&(bn-=Cn),Ii<=bn?i.theta=Math.max(Ii,Math.min(bn,i.theta)):i.theta=i.theta>(Ii+bn)/2?Math.max(Ii,i.theta):Math.min(bn,i.theta)),i.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,i.phi)),i.makeSafe(),i.radius*=D,i.radius=Math.max(r.minDistance,Math.min(r.maxDistance,i.radius)),r.enableDamping===!0?r.target.addScaledVector(U,r.dampingFactor):r.target.add(U),at.setFromSpherical(i),at.applyQuaternion(hn),nr.copy(r.target).add(at),r.object.lookAt(r.target),r.enableDamping===!0?(C.theta*=1-r.dampingFactor,C.phi*=1-r.dampingFactor,U.multiplyScalar(1-r.dampingFactor)):(C.set(0,0,0),U.set(0,0,0)),D=1,N||Xi.distanceToSquared(r.object.position)>y||8*(1-on.dot(r.object.quaternion))>y?(r.dispatchEvent(dS),Xi.copy(r.object.position),on.copy(r.object.quaternion),N=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",ti),r.domElement.removeEventListener("pointerdown",Xt),r.domElement.removeEventListener("pointercancel",Gi),r.domElement.removeEventListener("wheel",Gn),r.domElement.removeEventListener("pointermove",mi),r.domElement.removeEventListener("pointerup",fi),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",kn)};const r=this,c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let p=c.NONE;const y=1e-6,i=new m2,C=new m2;let D=1;const U=new ft;let N=!1;const R=new Di,G=new Di,J=new Di,Y=new Di,B=new Di,ae=new Di,le=new Di,Ae=new Di,we=new Di,me=[],Pe={};function it(){return 2*Math.PI/60/60*r.autoRotateSpeed}function Me(){return Math.pow(.95,r.zoomSpeed)}function Ke(at){C.theta-=at}function Et(at){C.phi-=at}const oi=function(){const at=new ft;return function(hn,Xi){at.setFromMatrixColumn(Xi,0),at.multiplyScalar(-hn),U.add(at)}}(),Ci=function(){const at=new ft;return function(hn,Xi){r.screenSpacePanning===!0?at.setFromMatrixColumn(Xi,1):(at.setFromMatrixColumn(Xi,0),at.crossVectors(r.object.up,at)),at.multiplyScalar(hn),U.add(at)}}(),te=function(){const at=new ft;return function(hn,Xi){const on=r.domElement;if(r.object.isPerspectiveCamera){const Cn=r.object.position;at.copy(Cn).sub(r.target);let Tn=at.length();Tn*=Math.tan(r.object.fov/2*Math.PI/180),oi(2*hn*Tn/on.clientHeight,r.object.matrix),Ci(2*Xi*Tn/on.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(oi(hn*(r.object.right-r.object.left)/r.object.zoom/on.clientWidth,r.object.matrix),Ci(Xi*(r.object.top-r.object.bottom)/r.object.zoom/on.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function ce(at){r.object.isPerspectiveCamera?D/=at:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*at)),r.object.updateProjectionMatrix(),N=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function ye(at){r.object.isPerspectiveCamera?D*=at:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/at)),r.object.updateProjectionMatrix(),N=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function xe(at){R.set(at.clientX,at.clientY)}function ze(at){le.set(at.clientX,at.clientY)}function Ne(at){Y.set(at.clientX,at.clientY)}function Ge(at){G.set(at.clientX,at.clientY),J.subVectors(G,R).multiplyScalar(r.rotateSpeed);const ii=r.domElement;Ke(2*Math.PI*J.x/ii.clientHeight),Et(2*Math.PI*J.y/ii.clientHeight),R.copy(G),r.update()}function Ve(at){Ae.set(at.clientX,at.clientY),we.subVectors(Ae,le),we.y>0?ce(Me()):we.y<0&&ye(Me()),le.copy(Ae),r.update()}function Le(at){B.set(at.clientX,at.clientY),ae.subVectors(B,Y).multiplyScalar(r.panSpeed),te(ae.x,ae.y),Y.copy(B),r.update()}function Ie(at){at.deltaY<0?ye(Me()):at.deltaY>0&&ce(Me()),r.update()}function qe(at){let ii=!1;switch(at.code){case r.keys.UP:at.ctrlKey||at.metaKey||at.shiftKey?Et(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):te(0,r.keyPanSpeed),ii=!0;break;case r.keys.BOTTOM:at.ctrlKey||at.metaKey||at.shiftKey?Et(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):te(0,-r.keyPanSpeed),ii=!0;break;case r.keys.LEFT:at.ctrlKey||at.metaKey||at.shiftKey?Ke(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):te(r.keyPanSpeed,0),ii=!0;break;case r.keys.RIGHT:at.ctrlKey||at.metaKey||at.shiftKey?Ke(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):te(-r.keyPanSpeed,0),ii=!0;break}ii&&(at.preventDefault(),r.update())}function et(){if(me.length===1)R.set(me[0].pageX,me[0].pageY);else{const at=.5*(me[0].pageX+me[1].pageX),ii=.5*(me[0].pageY+me[1].pageY);R.set(at,ii)}}function vt(){if(me.length===1)Y.set(me[0].pageX,me[0].pageY);else{const at=.5*(me[0].pageX+me[1].pageX),ii=.5*(me[0].pageY+me[1].pageY);Y.set(at,ii)}}function Be(){const at=me[0].pageX-me[1].pageX,ii=me[0].pageY-me[1].pageY,hn=Math.sqrt(at*at+ii*ii);le.set(0,hn)}function dt(){r.enableZoom&&Be(),r.enablePan&&vt()}function ut(){r.enableZoom&&Be(),r.enableRotate&&et()}function Qt(at){if(me.length==1)G.set(at.pageX,at.pageY);else{const hn=$t(at),Xi=.5*(at.pageX+hn.x),on=.5*(at.pageY+hn.y);G.set(Xi,on)}J.subVectors(G,R).multiplyScalar(r.rotateSpeed);const ii=r.domElement;Ke(2*Math.PI*J.x/ii.clientHeight),Et(2*Math.PI*J.y/ii.clientHeight),R.copy(G)}function Wt(at){if(me.length===1)B.set(at.pageX,at.pageY);else{const ii=$t(at),hn=.5*(at.pageX+ii.x),Xi=.5*(at.pageY+ii.y);B.set(hn,Xi)}ae.subVectors(B,Y).multiplyScalar(r.panSpeed),te(ae.x,ae.y),Y.copy(B)}function Nt(at){const ii=$t(at),hn=at.pageX-ii.x,Xi=at.pageY-ii.y,on=Math.sqrt(hn*hn+Xi*Xi);Ae.set(0,on),we.set(0,Math.pow(Ae.y/le.y,r.zoomSpeed)),ce(we.y),le.copy(Ae)}function Ct(at){r.enableZoom&&Nt(at),r.enablePan&&Wt(at)}function Ft(at){r.enableZoom&&Nt(at),r.enableRotate&&Qt(at)}function Xt(at){r.enabled!==!1&&(me.length===0&&(r.domElement.setPointerCapture(at.pointerId),r.domElement.addEventListener("pointermove",mi),r.domElement.addEventListener("pointerup",fi)),Ni(at),at.pointerType==="touch"?yt(at):wn(at))}function mi(at){r.enabled!==!1&&(at.pointerType==="touch"?st(at):Qi(at))}function fi(at){qi(at),me.length===0&&(r.domElement.releasePointerCapture(at.pointerId),r.domElement.removeEventListener("pointermove",mi),r.domElement.removeEventListener("pointerup",fi)),r.dispatchEvent(pS),p=c.NONE}function Gi(at){qi(at)}function wn(at){let ii;switch(at.button){case 0:ii=r.mouseButtons.LEFT;break;case 1:ii=r.mouseButtons.MIDDLE;break;case 2:ii=r.mouseButtons.RIGHT;break;default:ii=-1}switch(ii){case $p.DOLLY:if(r.enableZoom===!1)return;ze(at),p=c.DOLLY;break;case $p.ROTATE:if(at.ctrlKey||at.metaKey||at.shiftKey){if(r.enablePan===!1)return;Ne(at),p=c.PAN}else{if(r.enableRotate===!1)return;xe(at),p=c.ROTATE}break;case $p.PAN:if(at.ctrlKey||at.metaKey||at.shiftKey){if(r.enableRotate===!1)return;xe(at),p=c.ROTATE}else{if(r.enablePan===!1)return;Ne(at),p=c.PAN}break;default:p=c.NONE}p!==c.NONE&&r.dispatchEvent(rb)}function Qi(at){switch(p){case c.ROTATE:if(r.enableRotate===!1)return;Ge(at);break;case c.DOLLY:if(r.enableZoom===!1)return;Ve(at);break;case c.PAN:if(r.enablePan===!1)return;Le(at);break}}function Gn(at){r.enabled===!1||r.enableZoom===!1||p!==c.NONE||(at.preventDefault(),r.dispatchEvent(rb),Ie(at),r.dispatchEvent(pS))}function kn(at){r.enabled===!1||r.enablePan===!1||qe(at)}function yt(at){switch(en(at),me.length){case 1:switch(r.touches.ONE){case Zp.ROTATE:if(r.enableRotate===!1)return;et(),p=c.TOUCH_ROTATE;break;case Zp.PAN:if(r.enablePan===!1)return;vt(),p=c.TOUCH_PAN;break;default:p=c.NONE}break;case 2:switch(r.touches.TWO){case Zp.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;dt(),p=c.TOUCH_DOLLY_PAN;break;case Zp.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;ut(),p=c.TOUCH_DOLLY_ROTATE;break;default:p=c.NONE}break;default:p=c.NONE}p!==c.NONE&&r.dispatchEvent(rb)}function st(at){switch(en(at),p){case c.TOUCH_ROTATE:if(r.enableRotate===!1)return;Qt(at),r.update();break;case c.TOUCH_PAN:if(r.enablePan===!1)return;Wt(at),r.update();break;case c.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ct(at),r.update();break;case c.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Ft(at),r.update();break;default:p=c.NONE}}function ti(at){r.enabled!==!1&&at.preventDefault()}function Ni(at){me.push(at)}function qi(at){delete Pe[at.pointerId];for(let ii=0;ii<me.length;ii++)if(me[ii].pointerId==at.pointerId){me.splice(ii,1);return}}function en(at){let ii=Pe[at.pointerId];ii===void 0&&(ii=new Di,Pe[at.pointerId]=ii),ii.set(at.pageX,at.pageY)}function $t(at){const ii=at.pointerId===me[0].pointerId?me[1]:me[0];return Pe[ii.pointerId]}r.domElement.addEventListener("contextmenu",ti),r.domElement.addEventListener("pointerdown",Xt),r.domElement.addEventListener("pointercancel",Gi),r.domElement.addEventListener("wheel",Gn,{passive:!1}),this.update()}}class uH extends cs{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const Sm=new ft,fS=new lr,mS=new lr,gS=new ft,_S=new ft;class AH{constructor(e={}){const t=this;let r,c,p,y;const i={objects:new WeakMap},C=e.element!==void 0?e.element:document.createElement("div");C.style.overflow="hidden",this.domElement=C,this.getSize=function(){return{width:r,height:c}},this.render=function(G,J){G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),J.parent===null&&J.matrixWorldAutoUpdate===!0&&J.updateMatrixWorld(),fS.copy(J.matrixWorldInverse),mS.multiplyMatrices(J.projectionMatrix,fS),D(G,G,J),R(G)},this.setSize=function(G,J){r=G,c=J,p=r/2,y=c/2,C.style.width=G+"px",C.style.height=J+"px"};function D(G,J,Y){if(G.isCSS2DObject){Sm.setFromMatrixPosition(G.matrixWorld),Sm.applyMatrix4(mS);const B=G.visible===!0&&Sm.z>=-1&&Sm.z<=1&&G.layers.test(Y.layers)===!0;if(G.element.style.display=B===!0?"":"none",B===!0){G.onBeforeRender(t,J,Y);const le=G.element;le.style.transform="translate(-50%,-50%) translate("+(Sm.x*p+p)+"px,"+(-Sm.y*y+y)+"px)",le.parentNode!==C&&C.appendChild(le),G.onAfterRender(t,J,Y)}const ae={distanceToCameraSquared:U(Y,G)};i.objects.set(G,ae)}for(let B=0,ae=G.children.length;B<ae;B++)D(G.children[B],J,Y)}function U(G,J){return gS.setFromMatrixPosition(G.matrixWorld),_S.setFromMatrixPosition(J.matrixWorld),gS.distanceToSquared(_S)}function N(G){const J=[];return G.traverse(function(Y){Y.isCSS2DObject&&J.push(Y)}),J}function R(G){const J=N(G).sort(function(B,ae){if(B.renderOrder!==ae.renderOrder)return ae.renderOrder-B.renderOrder;const le=i.objects.get(B).distanceToCameraSquared,Ae=i.objects.get(ae).distanceToCameraSquared;return le-Ae}),Y=J.length;for(let B=0,ae=J.length;B<ae;B++)J[B].element.style.zIndex=Y-B}}}En.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Di(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Fl.line={uniforms:_f.merge([En.common,En.fog,En.line]),vertexShader:`
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- uniform float linewidth;
- uniform vec2 resolution;
- attribute vec3 instanceStart;
- attribute vec3 instanceEnd;
- attribute vec3 instanceColorStart;
- attribute vec3 instanceColorEnd;
- #ifdef WORLD_UNITS
- varying vec4 worldPos;
- varying vec3 worldStart;
- varying vec3 worldEnd;
- #ifdef USE_DASH
- varying vec2 vUv;
- #endif
- #else
- varying vec2 vUv;
- #endif
- #ifdef USE_DASH
- uniform float dashScale;
- attribute float instanceDistanceStart;
- attribute float instanceDistanceEnd;
- varying float vLineDistance;
- #endif
- void trimSegment( const in vec4 start, inout vec4 end ) {
- // trim end segment so it terminates between the camera plane and the near plane
- // conservative estimate of the near plane
- float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
- float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
- float nearEstimate = - 0.5 * b / a;
- float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
- end.xyz = mix( start.xyz, end.xyz, alpha );
- }
- void main() {
- #ifdef USE_COLOR
- vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
- #endif
- #ifdef USE_DASH
- vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
- vUv = uv;
- #endif
- float aspect = resolution.x / resolution.y;
- // camera space
- vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
- vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
- #ifdef WORLD_UNITS
- worldStart = start.xyz;
- worldEnd = end.xyz;
- #else
- vUv = uv;
- #endif
- // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
- // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
- // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
- // perhaps there is a more elegant solution -- WestLangley
- bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
- if ( perspective ) {
- if ( start.z < 0.0 && end.z >= 0.0 ) {
- trimSegment( start, end );
- } else if ( end.z < 0.0 && start.z >= 0.0 ) {
- trimSegment( end, start );
- }
- }
- // clip space
- vec4 clipStart = projectionMatrix * start;
- vec4 clipEnd = projectionMatrix * end;
- // ndc space
- vec3 ndcStart = clipStart.xyz / clipStart.w;
- vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
- // direction
- vec2 dir = ndcEnd.xy - ndcStart.xy;
- // account for clip-space aspect ratio
- dir.x *= aspect;
- dir = normalize( dir );
- #ifdef WORLD_UNITS
- // get the offset direction as perpendicular to the view vector
- vec3 worldDir = normalize( end.xyz - start.xyz );
- vec3 offset;
- if ( position.y < 0.5 ) {
- offset = normalize( cross( start.xyz, worldDir ) );
- } else {
- offset = normalize( cross( end.xyz, worldDir ) );
- }
- // sign flip
- if ( position.x < 0.0 ) offset *= - 1.0;
- float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
- // don't extend the line if we're rendering dashes because we
- // won't be rendering the endcaps
- #ifndef USE_DASH
- // extend the line bounds to encompass endcaps
- start.xyz += - worldDir * linewidth * 0.5;
- end.xyz += worldDir * linewidth * 0.5;
- // shift the position of the quad so it hugs the forward edge of the line
- offset.xy -= dir * forwardOffset;
- offset.z += 0.5;
- #endif
- // endcaps
- if ( position.y > 1.0 || position.y < 0.0 ) {
- offset.xy += dir * 2.0 * forwardOffset;
- }
- // adjust for linewidth
- offset *= linewidth * 0.5;
- // set the world position
- worldPos = ( position.y < 0.5 ) ? start : end;
- worldPos.xyz += offset;
- // project the worldpos
- vec4 clip = projectionMatrix * worldPos;
- // shift the depth of the projected points so the line
- // segments overlap neatly
- vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
- clip.z = clipPose.z * clip.w;
- #else
- vec2 offset = vec2( dir.y, - dir.x );
- // undo aspect ratio adjustment
- dir.x /= aspect;
- offset.x /= aspect;
- // sign flip
- if ( position.x < 0.0 ) offset *= - 1.0;
- // endcaps
- if ( position.y < 0.0 ) {
- offset += - dir;
- } else if ( position.y > 1.0 ) {
- offset += dir;
- }
- // adjust for linewidth
- offset *= linewidth;
- // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
- offset /= resolution.y;
- // select end
- vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
- // back to clip space
- offset *= clip.w;
- clip.xy += offset;
- #endif
- gl_Position = clip;
- vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }
- `,fragmentShader:`
- uniform vec3 diffuse;
- uniform float opacity;
- uniform float linewidth;
- #ifdef USE_DASH
- uniform float dashOffset;
- uniform float dashSize;
- uniform float gapSize;
- #endif
- varying float vLineDistance;
- #ifdef WORLD_UNITS
- varying vec4 worldPos;
- varying vec3 worldStart;
- varying vec3 worldEnd;
- #ifdef USE_DASH
- varying vec2 vUv;
- #endif
- #else
- varying vec2 vUv;
- #endif
- #include <common>
- #include <color_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
- float mua;
- float mub;
- vec3 p13 = p1 - p3;
- vec3 p43 = p4 - p3;
- vec3 p21 = p2 - p1;
- float d1343 = dot( p13, p43 );
- float d4321 = dot( p43, p21 );
- float d1321 = dot( p13, p21 );
- float d4343 = dot( p43, p43 );
- float d2121 = dot( p21, p21 );
- float denom = d2121 * d4343 - d4321 * d4321;
- float numer = d1343 * d4321 - d1321 * d4343;
- mua = numer / denom;
- mua = clamp( mua, 0.0, 1.0 );
- mub = ( d1343 + d4321 * ( mua ) ) / d4343;
- mub = clamp( mub, 0.0, 1.0 );
- return vec2( mua, mub );
- }
- void main() {
- #include <clipping_planes_fragment>
- #ifdef USE_DASH
- if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
- if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
- #endif
- float alpha = opacity;
- #ifdef WORLD_UNITS
- // Find the closest points on the view ray and the line segment
- vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
- vec3 lineDir = worldEnd - worldStart;
- vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
- vec3 p1 = worldStart + lineDir * params.x;
- vec3 p2 = rayEnd * params.y;
- vec3 delta = p1 - p2;
- float len = length( delta );
- float norm = len / linewidth;
- #ifndef USE_DASH
- #ifdef USE_ALPHA_TO_COVERAGE
- float dnorm = fwidth( norm );
- alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
- #else
- if ( norm > 0.5 ) {
- discard;
- }
- #endif
- #endif
- #else
- #ifdef USE_ALPHA_TO_COVERAGE
- // artifacts appear on some hardware if a derivative is taken within a conditional
- float a = vUv.x;
- float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
- float len2 = a * a + b * b;
- float dlen = fwidth( len2 );
- if ( abs( vUv.y ) > 1.0 ) {
- alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
- }
- #else
- if ( abs( vUv.y ) > 1.0 ) {
- float a = vUv.x;
- float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
- float len2 = a * a + b * b;
- if ( len2 > 1.0 ) discard;
- }
- #endif
- #endif
- vec4 diffuseColor = vec4( diffuse, alpha );
- #include <logdepthbuf_fragment>
- #include <color_fragment>
- gl_FragColor = vec4( diffuseColor.rgb, alpha );
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }
- `};class Tv extends ko{constructor(e){super({type:"LineMaterial",uniforms:_f.clone(Fl.line.uniforms),vertexShader:Fl.line.vertexShader,fragmentShader:Fl.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const yS=new qu,Ox=new ft;class WF extends mB{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],r=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(r),this.setAttribute("position",new jn(e,3)),this.setAttribute("uv",new jn(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const r=new xv(t,6,1);return this.setAttribute("instanceStart",new Lc(r,3,0)),this.setAttribute("instanceEnd",new Lc(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const r=new xv(t,6,1);return this.setAttribute("instanceColorStart",new Lc(r,3,0)),this.setAttribute("instanceColorEnd",new Lc(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new nB(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qu);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),yS.setFromBufferAttribute(t),this.boundingBox.union(yS))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new qA),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const r=this.boundingSphere.center;this.boundingBox.getCenter(r);let c=0;for(let p=0,y=e.count;p<y;p++)Ox.fromBufferAttribute(e,p),c=Math.max(c,r.distanceToSquared(Ox)),Ox.fromBufferAttribute(t,p),c=Math.max(c,r.distanceToSquared(Ox));this.boundingSphere.radius=Math.sqrt(c),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class w2 extends WF{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,r=new Float32Array(2*t);for(let c=0;c<t;c+=3)r[2*c]=e[c],r[2*c+1]=e[c+1],r[2*c+2]=e[c+2],r[2*c+3]=e[c+3],r[2*c+4]=e[c+4],r[2*c+5]=e[c+5];return super.setPositions(r),this}setColors(e){const t=e.length-3,r=new Float32Array(2*t);for(let c=0;c<t;c+=3)r[2*c]=e[c],r[2*c+1]=e[c+1],r[2*c+2]=e[c+2],r[2*c+3]=e[c+3],r[2*c+4]=e[c+4],r[2*c+5]=e[c+5];return super.setColors(r),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}const xS=new ft,vS=new ft,Da=new ls,Pa=new ls,zu=new ls,sb=new ft,ob=new lr,Ra=new BF,wS=new ft,Nx=new qu,Qx=new qA,ku=new ls;let Nu,mf;function bS(u,e,t){return ku.set(0,0,-e,1).applyMatrix4(u.projectionMatrix),ku.multiplyScalar(1/ku.w),ku.x=mf/t.width,ku.y=mf/t.height,ku.applyMatrix4(u.projectionMatrixInverse),ku.multiplyScalar(1/ku.w),Math.abs(Math.max(ku.x,ku.y))}function dH(u,e){const t=u.matrixWorld,r=u.geometry,c=r.attributes.instanceStart,p=r.attributes.instanceEnd,y=Math.min(r.instanceCount,c.count);for(let i=0,C=y;i<C;i++){Ra.start.fromBufferAttribute(c,i),Ra.end.fromBufferAttribute(p,i),Ra.applyMatrix4(t);const D=new ft,U=new ft;Nu.distanceSqToSegment(Ra.start,Ra.end,U,D),U.distanceTo(D)<mf*.5&&e.push({point:U,pointOnLine:D,distance:Nu.origin.distanceTo(U),object:u,face:null,faceIndex:i,uv:null,uv2:null})}}function pH(u,e,t){const r=e.projectionMatrix,p=u.material.resolution,y=u.matrixWorld,i=u.geometry,C=i.attributes.instanceStart,D=i.attributes.instanceEnd,U=Math.min(i.instanceCount,C.count),N=-e.near;Nu.at(1,zu),zu.w=1,zu.applyMatrix4(e.matrixWorldInverse),zu.applyMatrix4(r),zu.multiplyScalar(1/zu.w),zu.x*=p.x/2,zu.y*=p.y/2,zu.z=0,sb.copy(zu),ob.multiplyMatrices(e.matrixWorldInverse,y);for(let R=0,G=U;R<G;R++){if(Da.fromBufferAttribute(C,R),Pa.fromBufferAttribute(D,R),Da.w=1,Pa.w=1,Da.applyMatrix4(ob),Pa.applyMatrix4(ob),Da.z>N&&Pa.z>N)continue;if(Da.z>N){const Ae=Da.z-Pa.z,we=(Da.z-N)/Ae;Da.lerp(Pa,we)}else if(Pa.z>N){const Ae=Pa.z-Da.z,we=(Pa.z-N)/Ae;Pa.lerp(Da,we)}Da.applyMatrix4(r),Pa.applyMatrix4(r),Da.multiplyScalar(1/Da.w),Pa.multiplyScalar(1/Pa.w),Da.x*=p.x/2,Da.y*=p.y/2,Pa.x*=p.x/2,Pa.y*=p.y/2,Ra.start.copy(Da),Ra.start.z=0,Ra.end.copy(Pa),Ra.end.z=0;const Y=Ra.closestPointToPointParameter(sb,!0);Ra.at(Y,wS);const B=LI.lerp(Da.z,Pa.z,Y),ae=B>=-1&&B<=1,le=sb.distanceTo(wS)<mf*.5;if(ae&&le){Ra.start.fromBufferAttribute(C,R),Ra.end.fromBufferAttribute(D,R),Ra.start.applyMatrix4(y),Ra.end.applyMatrix4(y);const Ae=new ft,we=new ft;Nu.distanceSqToSegment(Ra.start,Ra.end,we,Ae),t.push({point:we,pointOnLine:Ae,distance:Nu.origin.distanceTo(we),object:u,face:null,faceIndex:R,uv:null,uv2:null})}}}class fH extends is{constructor(e=new WF,t=new Tv({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,c=new Float32Array(2*t.count);for(let y=0,i=0,C=t.count;y<C;y++,i+=2)xS.fromBufferAttribute(t,y),vS.fromBufferAttribute(r,y),c[i]=i===0?0:c[i-1],c[i+1]=c[i]+xS.distanceTo(vS);const p=new xv(c,2,1);return e.setAttribute("instanceDistanceStart",new Lc(p,1,0)),e.setAttribute("instanceDistanceEnd",new Lc(p,1,1)),this}raycast(e,t){const r=this.material.worldUnits,c=e.camera;c===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const p=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Nu=e.ray;const y=this.matrixWorld,i=this.geometry,C=this.material;mf=C.linewidth+p,i.boundingSphere===null&&i.computeBoundingSphere(),Qx.copy(i.boundingSphere).applyMatrix4(y);let D;if(r)D=mf*.5;else{const N=Math.max(c.near,Qx.distanceToPoint(Nu.origin));D=bS(c,N,C.resolution)}if(Qx.radius+=D,Nu.intersectsSphere(Qx)===!1)return;i.boundingBox===null&&i.computeBoundingBox(),Nx.copy(i.boundingBox).applyMatrix4(y);let U;if(r)U=mf*.5;else{const N=Math.max(c.near,Nx.distanceToPoint(Nu.origin));U=bS(c,N,C.resolution)}Nx.expandByScalar(U),Nu.intersectsBox(Nx)!==!1&&(r?dH(this,t):pH(this,c,t))}}class BS extends fH{constructor(e=new w2,t=new Tv({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const mH={version:8,glyphs:"//localhost/fonts/{fontstack}/{range}.pbf",sources:{openmaptiles:{type:"vector",url:JSON.stringify({tiles:["//localhost/data/v3/{z}/{x}/{y}.pbf"],name:"OpenMapTiles",format:"pbf",basename:"2017-07-03_planet_z0_z14.mbtiles",id:"openmaptiles",center:[-12.2168,28.6135,4],maxzoom:14,minzoom:0,pixel_scale:"256",vector_layers:[],version:"3.6.1",maskLevel:"8",bounds:[-180,-85.0511,180,85.0511],planettime:"1499040000000",tilejson:"2.0.0"})}},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(69,81,110,0.0)"}}]};/**
- * lil-gui
- * https://lil-gui.georgealways.com
- * @version 0.17.0
- * @author George Michael Brower
- * @license MIT
- */class Gu{constructor(e,t,r,c,p="div"){this.parent=e,this.object=t,this.property=r,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(c),this.$name=document.createElement("div"),this.$name.classList.add("name"),Gu.nextNameID=Gu.nextNameID||0,this.$name.id="lil-gui-name-"+ ++Gu.nextNameID,this.$widget=document.createElement(p),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(r)}name(e){return this._name=e,this.$name.innerHTML=e,this}onChange(e){return this._onChange=e,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(e=!0){return this.disable(!e)}disable(e=!0){return e===this._disabled||(this._disabled=e,this.domElement.classList.toggle("disabled",e),this.$disable.toggleAttribute("disabled",e)),this}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(e){const t=this.parent.add(this.object,this.property,e);return t.name(this._name),this.destroy(),t}min(e){return this}max(e){return this}step(e){return this}decimals(e){return this}listen(e=!0){return this._listening=e,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const e=this.save();e!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=e}getValue(){return this.object[this.property]}setValue(e){return this.object[this.property]=e,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(e){return this.setValue(e),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class gH extends Gu{constructor(e,t,r){super(e,t,r,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function b2(u){let e,t;return(e=u.match(/(#|0x)?([a-f0-9]{6})/i))?t=e[2]:(e=u.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?t=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=u.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(t=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!t&&"#"+t}const _H={isPrimitive:!0,match:u=>typeof u=="string",fromHexString:b2,toHexString:b2},ay={isPrimitive:!0,match:u=>typeof u=="number",fromHexString:u=>parseInt(u.substring(1),16),toHexString:u=>"#"+u.toString(16).padStart(6,0)},yH={isPrimitive:!1,match:Array.isArray,fromHexString(u,e,t=1){const r=ay.fromHexString(u);e[0]=(r>>16&255)/255*t,e[1]=(r>>8&255)/255*t,e[2]=(255&r)/255*t},toHexString:([u,e,t],r=1)=>ay.toHexString(u*(r=255/r)<<16^e*r<<8^t*r<<0)},xH={isPrimitive:!1,match:u=>Object(u)===u,fromHexString(u,e,t=1){const r=ay.fromHexString(u);e.r=(r>>16&255)/255*t,e.g=(r>>8&255)/255*t,e.b=(255&r)/255*t},toHexString:({r:u,g:e,b:t},r=1)=>ay.toHexString(u*(r=255/r)<<16^e*r<<8^t*r<<0)},vH=[_H,ay,yH,xH];class wH extends Gu{constructor(e,t,r,c){var p;super(e,t,r,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(p=this.initialValue,vH.find(y=>y.match(p))),this._rgbScale=c,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const y=b2(this.$text.value);y&&this._setValueFromHexString(y)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(e){if(this._format.isPrimitive){const t=this._format.fromHexString(e);this.setValue(t)}else this._format.fromHexString(e,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(e){return this._setValueFromHexString(e),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class ab extends Gu{constructor(e,t,r){super(e,t,r,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",c=>{c.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class bH extends Gu{constructor(e,t,r,c,p,y){super(e,t,r,"number"),this._initInput(),this.min(c),this.max(p);const i=y!==void 0;this.step(i?y:this._getImplicitStep(),i),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,t=!0){return this._step=e,this._stepExplicit=t,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let t=(e-this._min)/(this._max-this._min);t=Math.max(0,Math.min(t,1)),this.$fill.style.width=100*t+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const e=U=>{const N=parseFloat(this.$input.value);isNaN(N)||(this._snapClampSetValue(N+U),this.$input.value=this.getValue())};let t,r,c,p,y,i=!1;const C=U=>{if(i){const N=U.clientX-t,R=U.clientY-r;Math.abs(R)>5?(U.preventDefault(),this.$input.blur(),i=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(N)>5&&D()}if(!i){const N=U.clientY-c;y-=N*this._step*this._arrowKeyMultiplier(U),p+y>this._max?y=this._max-p:p+y<this._min&&(y=this._min-p),this._snapClampSetValue(p+y)}c=U.clientY},D=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",D)};this.$input.addEventListener("input",()=>{let U=parseFloat(this.$input.value);isNaN(U)||(this._stepExplicit&&(U=this._snap(U)),this.setValue(this._clamp(U)))}),this.$input.addEventListener("keydown",U=>{U.code==="Enter"&&this.$input.blur(),U.code==="ArrowUp"&&(U.preventDefault(),e(this._step*this._arrowKeyMultiplier(U))),U.code==="ArrowDown"&&(U.preventDefault(),e(this._step*this._arrowKeyMultiplier(U)*-1))}),this.$input.addEventListener("wheel",U=>{this._inputFocused&&(U.preventDefault(),e(this._step*this._normalizeMouseWheel(U)))},{passive:!1}),this.$input.addEventListener("mousedown",U=>{t=U.clientX,r=c=U.clientY,i=!0,p=this.getValue(),y=0,window.addEventListener("mousemove",C),window.addEventListener("mouseup",D)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=R=>{const G=this.$slider.getBoundingClientRect();let J=(Y=R,B=G.left,ae=G.right,le=this._min,Ae=this._max,(Y-B)/(ae-B)*(Ae-le)+le);var Y,B,ae,le,Ae;this._snapClampSetValue(J)},t=R=>{e(R.clientX)},r=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",r)};let c,p,y=!1;const i=R=>{R.preventDefault(),this._setDraggingStyle(!0),e(R.touches[0].clientX),y=!1},C=R=>{if(y){const G=R.touches[0].clientX-c,J=R.touches[0].clientY-p;Math.abs(G)>Math.abs(J)?i(R):(window.removeEventListener("touchmove",C),window.removeEventListener("touchend",D))}else R.preventDefault(),e(R.touches[0].clientX)},D=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",C),window.removeEventListener("touchend",D)},U=this._callOnFinishChange.bind(this);let N;this.$slider.addEventListener("mousedown",R=>{this._setDraggingStyle(!0),e(R.clientX),window.addEventListener("mousemove",t),window.addEventListener("mouseup",r)}),this.$slider.addEventListener("touchstart",R=>{R.touches.length>1||(this._hasScrollBar?(c=R.touches[0].clientX,p=R.touches[0].clientY,y=!0):i(R),window.addEventListener("touchmove",C,{passive:!1}),window.addEventListener("touchend",D))},{passive:!1}),this.$slider.addEventListener("wheel",R=>{if(Math.abs(R.deltaX)<Math.abs(R.deltaY)&&this._hasScrollBar)return;R.preventDefault();const G=this._normalizeMouseWheel(R)*this._step;this._snapClampSetValue(this.getValue()+G),this.$input.value=this.getValue(),clearTimeout(N),N=setTimeout(U,400)},{passive:!1})}_setDraggingStyle(e,t="horizontal"){this.$slider&&this.$slider.classList.toggle("active",e),document.body.classList.toggle("lil-gui-dragging",e),document.body.classList.toggle("lil-gui-"+t,e)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(e){let{deltaX:t,deltaY:r}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(t=0,r=-e.wheelDelta/120,r*=this._stepExplicit?1:10),t+-r}_arrowKeyMultiplier(e){let t=this._stepExplicit?1:10;return e.shiftKey?t*=10:e.altKey&&(t/=10),t}_snap(e){const t=Math.round(e/this._step)*this._step;return parseFloat(t.toPrecision(15))}_clamp(e){return e<this._min&&(e=this._min),e>this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class BH extends Gu{constructor(e,t,r,c){super(e,t,r,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(c)?c:Object.values(c),this._names=Array.isArray(c)?c:Object.keys(c),this._names.forEach(p=>{const y=document.createElement("option");y.innerHTML=p,this.$select.appendChild(y)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const e=this.getValue(),t=this._values.indexOf(e);return this.$select.selectedIndex=t,this.$display.innerHTML=t===-1?e:this._names[t],this}}class CH extends Gu{constructor(e,t,r){super(e,t,r,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",c=>{c.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let CS=!1;class CB{constructor({parent:e,autoPlace:t=e===void 0,container:r,width:c,title:p="Controls",injectStyles:y=!0,touchStyles:i=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",C=>{C.code!=="Enter"&&C.code!=="Space"||(C.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(p),i&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!CS&&y&&(function(C){const D=document.createElement("style");D.innerHTML=C;const U=document.querySelector("head link[rel=stylesheet], head style");U?document.head.insertBefore(D,U):document.head.appendChild(D)}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"\u2195";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"\u25BE";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"\u25B8"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"\u2713";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),CS=!0),r?r.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),c&&this.domElement.style.setProperty("--width",c+"px"),this.domElement.addEventListener("keydown",C=>C.stopPropagation()),this.domElement.addEventListener("keyup",C=>C.stopPropagation())}add(e,t,r,c,p){if(Object(r)===r)return new BH(this,e,t,r);const y=e[t];switch(typeof y){case"number":return new bH(this,e,t,r,c,p);case"boolean":return new gH(this,e,t);case"string":return new CH(this,e,t);case"function":return new ab(this,e,t)}console.error(`gui.add failed
- property:`,t,`
- object:`,e,`
- value:`,y)}addColor(e,t,r=1){return new wH(this,e,t,r)}addFolder(e){return new CB({parent:this,title:e})}load(e,t=!0){return e.controllers&&this.controllers.forEach(r=>{r instanceof ab||r._name in e.controllers&&r.load(e.controllers[r._name])}),t&&e.folders&&this.folders.forEach(r=>{r._title in e.folders&&r.load(e.folders[r._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(r=>{if(!(r instanceof ab)){if(r._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${r._name}"`);t.controllers[r._name]=r.save()}}),e&&this.folders.forEach(r=>{if(r._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${r._title}"`);t.folders[r._title]=r.save()}),t}open(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const r=p=>{p.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",r))};this.$children.addEventListener("transitionend",r);const c=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=c+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}function lb(u,e){return function(){u.side=parseInt(u.side),u.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.normal.needsUpdate=!0,e.attributes.color.needsUpdate=!0}}window.THREE=LF;window.maplibre=vR;const rf=class{constructor(){zi(this,"containerDom");zi(this,"_s",1.5);zi(this,"map");zi(this,"THREE",LF);zi(this,"meterUnit");zi(this,"computeRatio",1e4);zi(this,"mapConfig",{container:null,style:mH,center:{lng:126.89350996267854,lat:42.87516601384456},zoom:6.848587811931847,pitch:60,maxBounds:[[-179,-85],[179,85]],antialias:!0});zi(this,"camera");zi(this,"cameraTransform");zi(this,"scene");zi(this,"renderer");zi(this,"labelRenderer");zi(this,"gui");zi(this,"controls");zi(this,"effectComposer");zi(this,"clock");zi(this,"zoomScale");zi(this,"objGroup",new As);zi(this,"lightGroup",new As);zi(this,"helperGroup",new As);zi(this,"usefulObjGroup",new As);zi(this,"gongquGroup",new As);zi(this,"peidianGroup",new As);zi(this,"biandianGroup",new As);zi(this,"pointerMarkerGroup",new As);zi(this,"flyLineGroup",new As);zi(this,"tubeGroup",new As);zi(this,"labelGroup",new As);zi(this,"tubeMirrorGroup",new As);zi(this,"mirrorGroup",new As);zi(this,"basicRenderLayer",AS(0));zi(this,"bloomRenderLayer",AS(2));zi(this,"centerPosition",[119.71302336052571,31.74532248901521]);zi(this,"depth",5e4);zi(this,"canTouchMesh",[]);zi(this,"markerList",[{name:"\u6D59\u6C5F",text:"\u6D59\u6C5F",position:[120.083297793,29.178829535]},{name:"\u676D\u5DDE",text:"\u676D\u5DDE",position:[120.19,30.26]},{name:"\u4E91\u5357",text:"\u4E91\u5357",position:[101.485787956,24.975218524]},{name:"\u65B0\u7586",text:"\u65B0\u7586",position:[85.209356427,41.118465291]},{name:"\u5185\u8499\u53E4",text:"\u5185\u8499\u53E4",position:[113.94832120696813,43.095300371726864]}]);zi(this,"LineData",[{fromName:"\u65B0\u7586",toName:"\u6D59\u6C5F",describe:""},{fromName:"\u65B0\u7586",toName:"\u676D\u5DDE",describe:""},{fromName:"\u5185\u8499\u53E4",toName:"\u676D\u5DDE",describe:""}]);zi(this,"uniforms_of_geojson",{iTime:{type:"f",value:0},opacity:{type:"f",value:1}});zi(this,"uniforms",{iTime:{type:"f",value:1}});zi(this,"users",{});zi(this,"config",{});zi(this,"mouseLocation",vv.exports.observable({lngLat:{lng:this.centerPosition[0],lat:this.centerPosition[1]}}));zi(this,"modelHigherZ",8e-4);zi(this,"modelTopZ",6e-4);zi(this,"modelMiddleZ",48e-5);zi(this,"modelBottomZ",2e-4);zi(this,"renderType");window.threeMap=this,this.pointerMarkerGroup.name="CityMarker_Group",this.usefulObjGroup.name="Userful_Group",this.lightGroup.name="Light_Group",this.helperGroup.name="Helper_Group",this.objGroup.name="Obj_Group",this.flyLineGroup.name="FlyLine_Group",this.flyLineGroup.position.z=this.modelHigherZ,this.tubeGroup.name="Tube_Group",this.tubeGroup.position.z=this.modelHigherZ,this.labelGroup.name="Label_Group",this.mirrorGroup.name="Mirror_Group",this.tubeMirrorGroup.name="Mirror_Group",this.gongquGroup=new As,this.peidianGroup=new As,this.biandianGroup=new As,this.pointerMarkerGroup.add(this.gongquGroup),this.pointerMarkerGroup.add(this.peidianGroup),this.pointerMarkerGroup.add(this.biandianGroup),this.usefulObjGroup.add(this.pointerMarkerGroup),this.usefulObjGroup.add(this.flyLineGroup),this.usefulObjGroup.add(this.tubeGroup),this.usefulObjGroup.add(this.labelGroup),this.objGroup.add(this.mirrorGroup),this.objGroup.add(this.tubeMirrorGroup),this.objGroup.add(this.helperGroup),this.objGroup.add(this.lightGroup),this.objGroup.add(this.usefulObjGroup),window.is=this,window.addEventListener("resize",this.onWindowResize.bind(this),!1)}static GetInstance(){return rf._instance==null&&(rf._instance=new rf),rf._instance}onWindowResize(){var e,t,r,c,p,y,i;(e=this.map)==null||e.resize(),(t=this.labelRenderer)==null||t.setSize(window.innerWidth,window.innerHeight),(r=this.renderer)==null||r.setSize(window.innerWidth,window.innerHeight),(p=(c=this.effectComposer)==null?void 0:c.bloomComposer)==null||p.setSize(window.innerWidth,window.innerHeight),(i=(y=this.effectComposer)==null?void 0:y.finalComposer)==null||i.setSize(window.innerWidth,window.innerHeight)}async Bootstrap(e,t){return this.renderType=t,new Promise(async r=>{fetch("/gis/static/threeMap/set.json").then(c=>c.json()).then(c=>{if(c&&(this.mapConfig=c.map),!e)throw new Error("\u5BB9\u5668\u4E0D\u5B58\u5728");return this.containerDom=document.querySelector(e),t==="map"?(this.mapConfig.container=this.containerDom,Ua.exports.accessToken="pk.eyJ1IjoiaWFtc2VlIiwiYSI6ImNrMWxsZzlnbjA2Ym8zbnBjenA5d2c1ZzAifQ.Y0cmxYFTIIAlHi2eBApGsg",this.map=new Ua.exports.Map(Object.assign(this.mapConfig,{})),this.map.on("load",async()=>{this.freshZoomScale(),await this.initThreeLayer(),r(this)})):t==="threejs"&&(this.initThreeCtx(),this.renderThreeCtx(),r(this)),window.map=this,parent.window.map=this,this})})}addUITempalte(){const t=$V(`
- <div id="mouse-location" data-bind="text:mouseLocation().lngLat.lng + ',' + mouseLocation().lngLat.lat"
- class="pointer-events-none"
- style="position: absolute;left:4px;bottom:2px;background-color: #000000;box-shadow: 0 -4px 0 -4px white;
- color: white; padding: 4px 4px;display: flex;align-items: center;justify-content: center;
- line-height: 1;border-radius: 2px;font-weight: bold;font-size: 14px">
- </div>
- `),r=Array.from(t.childNodes).filter(c=>c.nodeType===1||c.nodeType===8);this.containerDom.append(t),r.forEach(c=>{vv.exports.applyBindings(this,c)})}getLocation(){let e={lng:null,lat:null,source:null};return new Promise((t,r)=>{if("geolocation"in navigator){let p={enableHighAccuracy:!0,maximumAge:0,timeout:6e3};navigator.geolocation.getCurrentPosition(y=>{e.lng=y.coords.longitude,e.lat=y.coords.latitude,e.source="browser",t(e)},function(y){console.warn("\u83B7\u53D6\u4F4D\u7F6E\u5931\u8D25\uFF1A"+y.message)},p)}else r("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u83B7\u53D6\u5730\u7406\u4F4D\u7F6E");(()=>{const p="soSkgyGBsSKvMuLcvwhoMXVkaLU43y3X";let y=document.createElement("script");y.src=`https://api.map.baidu.com/api?v=3.0&ak=${p}&callback=baiduApiInit`,document.body.appendChild(y),window.baiduApiInit=function(){const i=window.BMap;i.AK=p,new i.Geolocation().getCurrentPosition(function(D){if(this.getStatus()===(window==null?void 0:window.BMAP_STATUS_SUCCESS)){const U=ib.transform([D.point.lng,D.point.lat],ib.BD09,ib.WGS84);e={lng:U[0],lat:U[1],source:"BMap"},t(e)}else console.warn("BMap failed:"+this.getStatus()),r("BMap failed:"+this.getStatus())})}})()})}freshZoomScale(){var t;let e=5.5/(((t=this.map)==null?void 0:t.getZoom())||1);e=e*e,this.zoomScale=e>12?12:e}initThreeLayer(){return new Promise(e=>{const t={id:"threejs_base_layer",type:"custom",renderingMode:"3d",onAdd:(r,c)=>{this.initThreeCtx(r,c),e(!0)},render:(r,c)=>{this.renderThreeCtx(c)}};this.map.addLayer(t)})}initThreeCtx(e,t){this.gui=new CB({name:"My GUI",width:300,closed:!0}),this.clock=new t1,this.scene=new j2,this.camera=new _a(28,window.innerWidth/window.innerHeight,1e-5,1e6);const r=this.scene.position.clone();this.camera.lookAt(r);let c=this.gui.addFolder("camera");if(c.add(this.camera.position,"x",-1,1),c.add(this.camera.position,"y",-1,1),c.add(this.camera.position,"z",-1,1),c.add(this.camera,"fov",0,100),c=this.gui.addFolder("lookVec3"),c.add(r,"x",-1,1).onChange(()=>this.camera.lookAt(r)),c.add(r,"y",-1,1).onChange(()=>this.camera.lookAt(r)),c.add(r,"z",-1,1).onChange(()=>this.camera.lookAt(r)),this.labelRenderer=new AH,this.labelRenderer.setSize(window.innerWidth,window.innerHeight),this.labelRenderer.domElement.style.position="absolute",this.labelRenderer.domElement.style.pointerEvents="none",this.labelRenderer.domElement.style.top="0px",this.labelRenderer.domElement.id="labelRenderer",this.containerDom.append(this.labelRenderer.domElement),this.renderType==="map"){const C=this.map.getCenter(),D=Ua.exports.MercatorCoordinate.fromLngLat(C,0),{x:U,y:N,z:R}=D;this.meterUnit=D.meterInMercatorCoordinateUnits();const G=new lr().makeScale(this.meterUnit,this.meterUnit,-this.meterUnit),J=new lr().multiplyMatrices(new lr().makeRotationX(.5*Math.PI),new lr().makeRotationY(Math.PI));this.cameraTransform=new lr().multiplyMatrices(G,J).setPosition(U,N,R),this.renderer=new mv({canvas:e.getCanvas(),context:t,antialias:!0,alpha:!0})}else this.camera.position.set(0,10,15),this.renderer=new mv({alpha:!0,antialias:!0}),this.containerDom.appendChild(this.renderer.domElement),this.controls=new hH(this.camera,this.renderer.domElement),this.controls.addEventListener("change",()=>{});this.renderer.setClearColor(16711680,0),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.toneMapping=U2,this.renderer.outputEncoding=Ss,this.renderer.autoClear=!1,this.scene.add(this.objGroup);const{bloomComposer:p,finalComposer:y,composerOther:i}=rH(this);this.effectComposer={bloomComposer:p,finalComposer:y,composerOther:i},this.initThreeHelper(),this.initEvent()}renderThreeCtx(e){var r,c,p;this.renderType==="map"?(this.camera.projectionMatrix=new lr().fromArray(e),this.map.triggerRepaint()):(requestAnimationFrame(this.renderThreeCtx.bind(this)),this.controls.update()),(c=(r=this.renderer)==null?void 0:r.state)==null||c.reset(),this.uniforms.iTime.value+=.05,this.labelRenderer.render(this.scene,this.camera);const t={};if(this.effectComposer.bloomComposer){const y=new na({color:"black"});this.scene.traverse(lH(this.bloomRenderLayer,t,y)),this.effectComposer.bloomComposer.render(),this.scene.traverse(cH(t)),this.effectComposer.finalComposer.render()}else this.renderer.render(this.scene,this.camera);N_.update(),this.freshZoomScale(),(p=this.scene.getObjectByName("CityMarker_Group"))==null||p.traverse(y=>{if(y.isMesh){y.rotateZ(.05),y.scale.set(this.zoomScale,this.zoomScale,this.zoomScale);let i=!1;if(y.name.indexOf("marker_ground")>-1){let C=this.zoomScale;C<-1&&(C*=2);let D=1.8;C=C>D?D:C,y.s<=C/5?i=!1:y.s>=C*2&&(i=!0),i?y.s=C/10:y.s+=.008*C,y.scale.set(y.s*y.scale.x,y.s*y.scale.y,y.s*y.scale.z),y.material.opacity=(C*D-y.s)/C}}}),this.uniforms_of_geojson.iTime.value+=.05}initEvent(){addEventListener("click",()=>{document.querySelectorAll("#map3dTag.mapboxgl-marker").forEach(c=>{c.remove()});const t=this.choose(event);let r="";if(Array.isArray(t)&&t.length>0){r=t[0].object.name,t[0].object;const c=r.split("_of_")[1];this.markerList.find(p=>p.name===c)}})}choose(e){var N,R,G,J,Y,B,ae;let t=e.clientX,r=e.clientY;const c=((N=this.map)==null?void 0:N.getCanvas())||this.containerDom,p=(R=c==null?void 0:c.getBoundingClientRect())==null?void 0:R.x,y=(G=c==null?void 0:c.getBoundingClientRect())==null?void 0:G.y;t=t-(p||0),r=r-(y||0);const i=t/c.offsetWidth*2-1,C=-(r/c.offsetHeight)*2+1,D=new p2;if(this.renderType==="map"){const le=this.camera.projectionMatrix.invert(),Ae=new ft().applyMatrix4(le),me=new ft(i,C,1).applyMatrix4(le).clone().sub(Ae).normalize();D.set(Ae,me)}else D.setFromCamera(new Di(i,C),this.camera);const U=D.intersectObjects(this.canTouchMesh);if(window.console.log("intersects",U),U.length>0){const le=(ae=(B=(Y=(J=U[0])==null?void 0:J.object)==null?void 0:Y.name)==null?void 0:B.match(/[\u4e00-\u9fa5]/g))==null?void 0:ae.join("");le&&this.sendMessage(le)}if(!this.map&&Array.isArray(U)&&U[0]){const le=U[0].point;console.log("lookAt",le),this.camera.lookAt(le)}return U}initThreeHelper(){const e=new IF(10);this.helperGroup.add(e);const t=new SF(this.camera);t.name="camera_helper",this.helperGroup.add(t);const r=new pB(16777215);r.name="directionalLight";const c=new TF(r,20,16777215);c.name="directionalLight_helper";const p=new fB(16777215,.75);p.name="ambientLight",this.lightGroup.add(p);let y=this.gui.addFolder("ambientLight");y.add(p,"intensity",0,1),y.addColor(p,"color").onChange(function(J){p.color.setStyle(J)});const i=new vF;i.name="ambientLightProbe",this.helperGroup.add(i);const C=16777215,D=1048575,U=new uB(C,D,.9);U.name="hemiLight",U.position.set(.5,.5,.5),this.lightGroup.add(U),y=this.gui.addFolder("hemiLight"),y.add(U.position,"x",0,1),y.add(U.position,"y",0,1),y.add(U.position,"z",0,1),y.add(U,"intensity",0,1),y.addColor(U,"color").onChange(function(J){U.color.setStyle(J)}),y.addColor(U,"groundColor").onChange(function(J){U.color.setStyle(J)});const N=new EF(U,.2,16777215);N.name="hemiLight_helper",this.helperGroup.add(N);const R=new p2,G=new MF(R.ray.direction,R.ray.origin,.5,16773360);G.name="arrHelper",this.helperGroup.add(G),this.helperGroup.visible=!0}async initThreeGeoJSON(){return new Promise(e=>{let t=new As;t.name="GeoJSON";let r=new sa({color:new Dn("rgb(12, 96, 168)")});const c=U=>{tb(U).forEach((R,G)=>{R.geo.forEach(J=>{const Y=[];J.forEach((le,Ae)=>{Y.push(new ft(le.x,le.y,le.z))});const B=new br().setFromPoints(Y);if(new _v(B,r).position.setZ(this.modelTopZ),R.name==="\u5409\u6797\u7701"){const le=[],Ae=[];J.forEach((Et,oi)=>{le.push(Et.x,Et.y,Et.z),Ae.push(255,0,0),Ae.push(255,0,0),Ae.push(255,0,0)});const we=new w2;we.setPositions(le),we.setColors(Ae);const me=new BB;this.renderer.getSize(me);const Pe=new Tv({color:"rgb(11,61,240)",linewidth:.0025,vertexColors:!1,dashed:!1,alphaToCoverage:!1,transparent:!0,opacity:1,side:Il}),it=new BS(we,Pe);it.position.setZ(this.modelTopZ),it.name="FATLINE_JL_BOUND",it.material.depthTest=!0,it.material.depthWrite=!1,it.renderOrder=20,it.layers.enable(this.bloomRenderLayer.currentLayerNum);const Me=it.clone();Me.material=it.material.clone(),Me.material.linewidth=.0015,Me.material.opacity=.2,Me.position.setZ(this.modelTopZ-1e-6),Me.name="FATLINE2_JL_BOUND",t.add(it);const Ke=this.buildFence(J,R.name);t.add(Ke)}})})},p=U=>{r=new sa({color:"rgb(11, 93, 162)"});const N=tb(U),R=new As;R.name="boundaryGroup",R.position.setZ(this.modelTopZ+1e-6),N.forEach((G,J)=>{G.geo.forEach((Y,B)=>{const ae=[];Y.forEach((we,me)=>{ae.push(new ft(we.x,we.y,we.z))});const le=new br().setFromPoints(ae);r=new sa({color:new Dn("rgb(11, 93, 162)"),transparent:!0,opacity:.6});const Ae=new _v(le,r);Ae.name=`jl_bount_road@${J}-${B}`,R.add(Ae)})}),t.add(R)},y=U=>{tb(U).forEach((R,G)=>{R.geo.forEach(J=>{const Y=[];if(J.forEach((B,ae)=>{Y.push(new ft(B.x,B.y,B.z))}),R.name==="\u94C1\u5CAD\u5E02"){const B=this.buildFence(J,R.name);t.add(B)}})})};let i=fetch("static/threeMap/JL_BOUND.json"),C=fetch("static/threeMap/JL.json"),D=fetch("static/threeMap/TL_BOUND.json");Promise.all([i,C,D]).then(U=>Promise.all(U.map(N=>N.json()))).then(U=>{c({features:[U[0]]}),p(U[1]),y({features:[U[2]]}),this.usefulObjGroup.add(t),e(!0)})})}initThreeCityMarkers(){const e=new jd,t=i=>{const C=Ua.exports.MercatorCoordinate.fromLngLat({lng:i.position[0],lat:i.position[1]}),D=e.load("./static/threeMap/\u7AEF\u70B9\u6807\u6CE8.png"),U=new na({color:65535,map:D,transparent:!0,side:Il,depthWrite:!1}),N=new $A(.002,.002),R=new is(N,U);return R.position.copy(C),R.s=this.zoomScale*Math.random(),R.name=`marker_ground_of_${i.name}`,R.position.z=this.modelTopZ+1e-4,R.layers.enable(this.bloomRenderLayer.currentLayerNum),R},r=i=>{const C=Ua.exports.MercatorCoordinate.fromLngLat({lng:i.position[0],lat:i.position[1]}),D=new yf(3/this.computeRatio,6/this.computeRatio,4);D.rotateX(-Math.PI/2);const U=new yv({color:4283863220}),N=new is(D,U),R=new yf(2/this.computeRatio,5/this.computeRatio,4);R.rotateX(-Math.PI/2);const G=new yv({color:4292870143}),J=new is(R,G),Y=new As;return N.name=`marker_head_outer_of_${i.name}`,J.name=`marker_head_inner_of_${i.name}`,Y.add(N),Y.add(J),Y.position.copy(C),Y.position.z=this.modelHigherZ+1e-4,Y.name=`marker_head_of_${i.name}`,Y.name=`marker_head_of_${i.name}`,Y},c=i=>{const C=Ua.exports.MercatorCoordinate.fromLngLat({lng:i.position[0],lat:i.position[1]}),D=new jd().load("/gis/static/threeMap/peidian.png"),U=new na({map:D,side:Il,transparent:!0}),N=new $A(6/this.computeRatio,6/this.computeRatio);N.rotateX(Math.PI/2);const R=new is(N,U);return R.name=`pointer_of_${i.name}`,R.position.copy(C),R.position.z=this.modelHigherZ+1e-4,R.layers.enable(this.bloomRenderLayer.currentLayerNum),R},p=i=>{const C=Ua.exports.MercatorCoordinate.fromLngLat({lng:i.position[0],lat:i.position[1]}),D=new jd().load("/gis/static/threeMap/biandian.png"),U=new na({map:D,side:Il,transparent:!0}),N=new $A(6/this.computeRatio,6/this.computeRatio);N.rotateX(Math.PI/2);const R=new is(N,U);return R.name=`pointer_of_${i.name}`,R.position.copy(C),R.position.z=this.modelHigherZ+1e-4,R.layers.enable(this.bloomRenderLayer.currentLayerNum),R},y=this.pointerMarkerGroup;y.name="CityMarker_Group",this.canTouchMesh.push(this.pointerMarkerGroup),this.markerList.forEach(async i=>{var C,D;if(((C=i.ident)==null?void 0:C.marker)!==!1)try{const U=new As,N=t(i);N.name=`marker_ground_of_${i.name}`;let R;const G=((D=i==null?void 0:i.ident)==null?void 0:D.type)||0;G===0?(R=r(i),N.renderOrder=1e3,N.pointerMarker=1e3,U.add(N),U.add(R),U.name=`markerPoint_of_${i.name}`,y.add(U),this.gongquGroup.add(U)):G===1?(R=c(i),this.peidianGroup.add(R)):G===2&&(R=p(i),this.biandianGroup.add(R))}catch{}})}initThreeUserSprites(){this.scene;const e=new As;e.name="userSpriteGroup";const t=this.markerList[0],r=new my({color:Math.random()*16777215}),c=new gv(r),p=Ua.exports.MercatorCoordinate.fromLngLat({lng:t.position[0],lat:t.position[1]});c.name="sprite_test",p.z=1.0013,c.position.copy(p),c.scale.set(.001,.001,.001),c.position.z=.003+this.depth/1e8,e.add(c)}initThreeFlyLineLayer(){const e=this.flyLineGroup,t=(r,c)=>{const p=RF(r.position,c.position),y=YV(r.position,c.position),i=Ua.exports.MercatorCoordinate.fromLngLat({lng:r.position[0],lat:r.position[1]}),C=Ua.exports.MercatorCoordinate.fromLngLat({lng:y[0],lat:y[1]}),D=Ua.exports.MercatorCoordinate.fromLngLat({lng:c.position[0],lat:c.position[1]}),U=[new ft(i.x,i.y,i.z),new ft(C.x,C.y,p/2e5),new ft(D.x,D.y,D.z)];try{const N=new As;N.name=`FlyLine_Group_${r.name}_to_${c.name}`;for(let R=1;R<=1;R++){let G=Math.trunc(p/1e3)+100;const J=new qV({vecs:U,num:G,size:5,color:{r:133/255,g:187/255,b:237/255},speed:Math.random()*R*1500+p/20});J.start(),N.add(J.particleSystem)}e.add(N)}catch{}};Array.isArray(this.LineData)&&this.LineData.length>=1&&this.LineData.forEach(r=>{let c=r.toName;c=this.markerList.find(y=>y.name===c);let p=r.fromName;p=this.markerList.find(y=>y.name===p),p&&c&&t(p,c)})}initThreeTubeLayer(e,t,r,c=64,p=6e-5,y=64,i=!1){const{visible:C,type:D}=r||{};if(D==="Dotted-Line"){const U=[];t.forEach(we=>{const me=Ua.exports.MercatorCoordinate.fromLngLat({lng:we[0],lat:we[1]});U.push(new ft(me.x,me.y,me.z))});const N=[],R=[],G=new X_(U),J=Math.round(12*U.length),Y=new ft,B=new Dn;for(let we=0,me=J;we<me;we++){const Pe=we/me;G.getPoint(Pe,Y),N.push(Y.x,Y.y,Y.z),B.setRGB(0,0,0),R.push(B.r,B.g,B.b)}const ae=new w2().setPositions(N);ae.setColors(R);const le=new Tv({color:4278320893,linewidth:.005,gapSize:2e-4,dashSize:3e-4,vertexColors:!1,dashed:!0,alphaToCoverage:!1,transparent:!0,side:Il}),Ae=new BS(ae,le);Ae.name=e,Ae.computeLineDistances(),this.flyLineGroup.add(Ae),C===!1&&(Ae.visible=!1)}else{const U=[];t.forEach(J=>{const Y=Ua.exports.MercatorCoordinate.fromLngLat({lng:J[0],lat:J[1]});U.push(new ft(Y.x,Y.y,Y.z))});const N=new ng(new X_(U,!1),c,p,y,i),R=new na({color:4278320893,opacity:1,transparent:!0}),G=new is(N,R);G.name=e,this.tubeGroup.add(G),C===!1&&(G.visible=!1)}}initThreeReflector(){const e=new FF(.052,.052,200,200),t=new sB({color:"rgba(7,46,130,1)",transparent:!0,opacity:1,shininess:11114,side:Il,depthTest:!0}),r=new is(e,t);r.name="floorMesh",r.position.set(.8448865555555555,.369164230229972,this.modelBottomZ),r.renderOrder=1,this.objGroup.add(r)}addMeshHelper(e){const t=[];if(e instanceof is||gv||e instanceof Ku){const r=new g2(e,16711680);r.name=`${e.name}_helper`,t.push(r),this.helperGroup.add(r)}else e instanceof As&&e.traverse(r=>{const c=new g2(r,16711680);c.name=`${e.name}_helper`,t.push(c),this.helperGroup.add(c)});return t}getMeshByName(e){return this.scene.getObjectByName(e)}disposeGroup(e){e.traverse(t=>{(t.type=="Mesh"||t.type=="Line")&&(t.geometry.dispose(),t.material.dispose())}),e.children.length&&(e.children=[])}Destory(){this.map.remove()}actionResize(){this.map&&this.map.resize&&this.map.resize()}buildFence(e,t){new na({side:ju,transparent:!0,opacity:.1});const r=new ko({uniforms:rf.GetInstance().uniforms_of_geojson,transparent:!0,side:ju,vertexShader:BV,fragmentShader:CV}),c=new br,p=[],y={r:33/255,g:168/255,b:255/255},i={r:8/255,g:61/255,b:102/255},C=[],D=new np;D.moveTo(e[0].x,e[0].y),e.forEach((ae,le)=>{const Ae=le+1>=e.length?e[0]:e[le+1];p.push(ae.x,ae.y,this.modelBottomZ,Ae.x,Ae.y,this.modelBottomZ,Ae.x,Ae.y,this.modelTopZ),C.push(y.r,y.g,y.b,y.r,y.g,y.b,i.r,i.g,i.b),p.push(ae.x,ae.y,this.modelBottomZ,Ae.x,Ae.y,this.modelTopZ,ae.x,ae.y,this.modelTopZ),C.push(y.r,y.g,y.b,i.r,i.g,i.b,i.r,i.g,i.b),D.lineTo(ae.x,ae.y)}),c.attributes.position=new ds(new Float32Array(p),3),c.attributes.color=new ds(new Float32Array(C),3);let U=new is(c,r);U.name=`active_area_${t}`;const N=new ig(D),R=new na({color:"#0b56ad",side:Il,opacity:.63,transparent:!0}),G=new is(N,R);G.name=`faceMesh_${t}`,G.position.z=this.modelTopZ;const J=G.clone();if(J.name=`faceMeshMiddle_${t}`,J.position.z=this.modelMiddleZ,J.material=new na({color:"rgb(0, 0, 0)",side:Il,opacity:.755,transparent:!0}),J.layers.enable(this.bloomRenderLayer.currentLayerNum),t==="\u5409\u6797\u7701"){let ae=this.gui.addFolder("faceMesh");ae.addColor(G.material,"color").onChange(le=>{G.material.color.setStyle(le),this.scene.getObjectByName("faceMesh_\u94C1\u5CAD\u5E02").material.color=le.clone()}),ae.add(G.material,"opacity",0,1).onChange(le=>{this.scene.getObjectByName("faceMesh_\u94C1\u5CAD\u5E02").material.opacity=le}),ae.add(G.position,"z",0,6e-4).onChange(le=>{this.scene.getObjectByName("faceMesh_\u94C1\u5CAD\u5E02").position.z=le}),ae=this.gui.addFolder("faceMeshMiddle"),ae.addColor(J.material,"color").onChange(le=>{J.material.color.setStyle(le),this.scene.getObjectByName("faceMeshMiddle_\u94C1\u5CAD\u5E02").material.color=le.clone()}),ae.add(J.material,"opacity",0,1).onChange(le=>{this.scene.getObjectByName("faceMeshMiddle_\u94C1\u5CAD\u5E02").material.opacity=le}),ae.add(J.position,"z",0,6e-4).onChange(le=>{this.scene.getObjectByName("faceMesh_\u94C1\u5CAD\u5E02").position.z=le})}const Y=G.clone();Y.material=G.material.clone(),Y.material=new na({transparent:!0,opacity:.6,color:new Dn(1,1,1),side:Il}),Y.name=`faceMeshBottom_${t}`,Y.position.z=this.modelBottomZ;const B=new As;return B.name=`City_Fence_Group_${t}`,B.add(G),B.add(J),B.add(Y),B.add(U),B}flipMatrix(){const e=new lr,t=new ft(0,0,1);return e.set(1-2*t.x*t.x,-2*t.x*t.y,-2*t.x*t.z,0,-2*t.x*t.y,1-2*t.y*t.y,-2*t.y*t.z,0,-2*t.x*t.z,-2*t.y*t.z,1-2*t.z*t.z,0,0,0,0,1),e}renderSiteTag(e){e=Array.isArray(e)?e:[];const t=(e==null?void 0:e.map(r=>r.title))||[];console.log("rgbSites",t),this.markerList.forEach(r=>{var N,R,G,J,Y,B,ae,le,Ae,we,me,Pe,it,Me,Ke,Et,oi;const c=(e.find(Ci=>Ci.title===r.name)||{}).data,p=!!(t.indexOf(r.name)>-1||r.showRGB),y=((N=r.event)==null?void 0:N.clickable)!==!1;let i=`
- <div class="site-tag-tpl" clickable="${y}" renderType="${((R=r.ident)==null?void 0:R.type)||0}" id="siteTag_${r.name}">
- <div class="siteDataWrap" style="display: ${p?"flex":"none"}">
- <div class="left o">
- <div class="ct t">${((G=c==null?void 0:c.\u53D8\u7535)==null?void 0:G[0])||0}</div>
- <div class="ct c">${((J=c==null?void 0:c.\u53D8\u7535)==null?void 0:J[1])||0}</div>
- <div class="ct b">${((Y=c==null?void 0:c.\u53D8\u7535)==null?void 0:Y[2])||0}</div>
- </div>
- <div class="mid o">
- <img src="/gis/static/threeMap/three color@2x.png"/>
- </div>
- <div class="right o">
- <div class="ct t">${((B=c==null?void 0:c.\u7535\u529B)==null?void 0:B[0])||0}</div>
- <div class="ct c">${((ae=c==null?void 0:c.\u7535\u529B)==null?void 0:ae[1])||0}</div>
- <div class="ct b">${((le=c==null?void 0:c.\u7535\u529B)==null?void 0:le[2])||0}</div>
- </div>
- </div>
- <div class="siteLabel" style="font-size: ${(Ae=r.style)!=null&&Ae.fontSize?((we=r.style)==null?void 0:we.fontSize)+"px":"unset"}">${r.name}</div>
- </div>
- `;const C=document.createElement("div");C.classList.add("map3dTag"),C.innerHTML=i;const D=Ua.exports.MercatorCoordinate.fromLngLat(r.position,8e4),U=new uH(C);U.name="markerLabel_"+r.name,U.position.copy(D),U.translateX((((Pe=(me=r==null?void 0:r.style)==null?void 0:me.offset)==null?void 0:Pe[0])||0)+-2e-4),U.translateY(((Me=(it=r==null?void 0:r.style)==null?void 0:it.offset)==null?void 0:Me[1])||0),U.translateZ(((Et=(Ke=r==null?void 0:r.style)==null?void 0:Ke.offset)==null?void 0:Et[2])||0),U.renderType=((oi=r==null?void 0:r.ident)==null?void 0:oi.type)||0,this.labelGroup.add(U),y&&(U.element.addEventListener("touchstart",()=>{this.sendMessage(r.name)}),U.element.addEventListener("click",()=>{this.sendMessage(r.name)}))}),this.canTouchMesh.push(this.labelGroup)}initDebugger(){const e=new jd().load("/gis/static/threeMap/textures/carbon/Carbon.png");e.encoding=Ss,e.wrapS=HA,e.wrapT=HA,e.repeat.x=.001,e.repeat.y=.001;const t=new jd().load("/gis/static/threeMap/textures/carbon/Carbon_Normal.png");t.wrapS=HA,t.wrapT=HA;const r=new Qu(5,64,32),c={color:new Dn("rgb(255,0,0)").getHex(),roughness:.5,clearcoat:1,clearcoatRoughness:.1},p=new rB({...c}),y=this.gui.addFolder("THREE.MeshPhysicalMaterial");y.add(p,"roughness",0,1),y.add(p,"metalness",0,1),y.add(p,"reflectivity",0,1),y.add(p,"clearcoat",0,1).step(.01),y.add(p,"clearcoatRoughness",0,1).step(.01),y.add(p,"flatShading").onChange(lb(p,r)),y.add(p,"wireframe"),y.add(p,"vertexColors").onChange(lb(p,r)),y.add(p,"fog").onChange(lb(p,r));const i=new is(r,p);i.position.x=100,i.position.y=100,i.position.set(.852,.367,.006),i.name="debugger";const C=new is(new Qu(2e-4,8,8),new na({color:16777215}));C.position.set(.852,.367,.0186),this.scene.add(C),C.add(new dB(16777215,1));const D=new YA(3,3,3,1,1,1),U=new is(D,p);this.scene.add(U),this.canTouchMesh.push(U);const N=new Qu(100,50,50);console.log(r);const R=new jd().load("https://storage.googleapis.com/umas_public_assets/michaelBay/free_star_sky_hdri_spherical_map_by_kirriaa_dbw8p0w%20(1).jpg"),G=new ty({map:R,side:Il}),J=new is(N,G);J.name="outer_sphere",this.scene.add(J),this.canTouchMesh.push(U);const Y=new Qu(5,50,50),B=new jd().load("https://storage.googleapis.com/umas_public_assets/michaelBay/1280px-Solarsystemscope_texture_8k_earth_daymap.jpeg"),ae=new ty({map:B,side:Il}),le=new is(Y,ae);le.name="earth",this.scene.add(le)}sendMessage(e){var r;const t=(r=this.markerList)==null?void 0:r.find(c=>c.name===e);t&&(console.log("sendMessage",t),window.postMessage({data:t},"*"))}};let ev=rf;zi(ev,"_instance");const km=class{constructor(){zi(this,"_MinMap");zi(this,"_SysMap");zi(this,"_Palette");zi(this,"_CacheTransfer");zi(this,"_Image");zi(this,"_Localforage");zi(this,"_HashTools");zi(this,"_Earth");zi(this,"_ThreeMap");zi(this,"_DxfRender")}static getInstance(){return km._instance==null&&(km._instance=new km),km._instance}BindTools(){return this._ThreeMap=ev,this}};let U_=km;zi(U_,"_instance");const Ic=class{constructor(){zi(this,"_trajectoryUnit",new J1);zi(this,"Fn",new Nm);zi(this,"CbFn",new M_);zi(this,"Tools",new U_);zi(this,"hasRender",!1)}static getInstance(){return Ic._instance==null&&(Ic._instance=new Ic,Ic._instance.Fn=Nm.getInstance()),Ic._instance}async bindFn(e=[],t){var c;(c=t==null?void 0:t.a)==null||c.b("a");let r;return r=await this.waitFns(e),t=t===void 0?{}:t,this.Fn=Nm.getInstance().BindFn(r),this.CbFn=M_.getInstance().BindCbFn(t),this.Tools=U_.getInstance().BindTools(),this}async waitFns(e){return new Promise((t,r)=>{let c={},p=function(){let y=!1;for(let i of e)if(i)c=Object.assign(c,i);else{y=!1;break}y||e.length===0?(window.Fns=c,t(c)):setTimeout(()=>{p()},500)};p()})}load(e){return Ic._instance.Fn.baseOption=Object.assign({container:e}),Ic._instance.Fn.domId=e,this.preRender(e)?Ic._instance:{msg:"dom \u4E0D\u5B58\u5728"}}preRender(e){return!!document.getElementById(e)}bootstrap(){return Ic._instance.Fn===null&&Ic._instance.CbFn===null?null:(this._trajectoryUnit=new J1,this._trajectoryUnit)}destory(){Ic._instance={},this._trajectoryUnit=null}};let tf=Ic;zi(tf,"_instance"),zi(tf,"Operation",{}),zi(tf,"Unit",{BaseUnit:Q3,TrajectoryUnit:J1});window.LibPresets=tf;setInterval(()=>{},2e3)});export default EH();
|