index.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.82
  5. */
  6. 'use strict';
  7. Object.defineProperty(exports, '__esModule', { value: true });
  8. /*!
  9. Stencil Mock Doc v2.15.1 | MIT Licensed | https://stenciljs.com
  10. */
  11. const CONTENT_REF_ID = 'r';
  12. const ORG_LOCATION_ID = 'o';
  13. const SLOT_NODE_ID = 's';
  14. const TEXT_NODE_ID = 't';
  15. const XLINK_NS = 'http://www.w3.org/1999/xlink';
  16. const attrHandler = {
  17. get(obj, prop) {
  18. if (prop in obj) {
  19. return obj[prop];
  20. }
  21. if (typeof prop !== 'symbol' && !isNaN(prop)) {
  22. return obj.__items[prop];
  23. }
  24. return undefined;
  25. },
  26. };
  27. const createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
  28. class MockAttributeMap {
  29. constructor(caseInsensitive = false) {
  30. this.caseInsensitive = caseInsensitive;
  31. this.__items = [];
  32. }
  33. get length() {
  34. return this.__items.length;
  35. }
  36. item(index) {
  37. return this.__items[index] || null;
  38. }
  39. setNamedItem(attr) {
  40. attr.namespaceURI = null;
  41. this.setNamedItemNS(attr);
  42. }
  43. setNamedItemNS(attr) {
  44. if (attr != null && attr.value != null) {
  45. attr.value = String(attr.value);
  46. }
  47. const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
  48. if (existingAttr != null) {
  49. existingAttr.value = attr.value;
  50. }
  51. else {
  52. this.__items.push(attr);
  53. }
  54. }
  55. getNamedItem(attrName) {
  56. if (this.caseInsensitive) {
  57. attrName = attrName.toLowerCase();
  58. }
  59. return this.getNamedItemNS(null, attrName);
  60. }
  61. getNamedItemNS(namespaceURI, attrName) {
  62. namespaceURI = getNamespaceURI(namespaceURI);
  63. return (this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null);
  64. }
  65. removeNamedItem(attr) {
  66. this.removeNamedItemNS(attr);
  67. }
  68. removeNamedItemNS(attr) {
  69. for (let i = 0, ii = this.__items.length; i < ii; i++) {
  70. if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
  71. this.__items.splice(i, 1);
  72. break;
  73. }
  74. }
  75. }
  76. [Symbol.iterator]() {
  77. let i = 0;
  78. return {
  79. next: () => ({
  80. done: i === this.length,
  81. value: this.item(i++),
  82. }),
  83. };
  84. }
  85. get [Symbol.toStringTag]() {
  86. return 'MockAttributeMap';
  87. }
  88. }
  89. function getNamespaceURI(namespaceURI) {
  90. return namespaceURI === XLINK_NS ? null : namespaceURI;
  91. }
  92. function cloneAttributes(srcAttrs, sortByName = false) {
  93. const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
  94. if (srcAttrs != null) {
  95. const attrLen = srcAttrs.length;
  96. if (sortByName && attrLen > 1) {
  97. const sortedAttrs = [];
  98. for (let i = 0; i < attrLen; i++) {
  99. const srcAttr = srcAttrs.item(i);
  100. const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
  101. sortedAttrs.push(dstAttr);
  102. }
  103. sortedAttrs.sort(sortAttributes).forEach((attr) => {
  104. dstAttrs.setNamedItemNS(attr);
  105. });
  106. }
  107. else {
  108. for (let i = 0; i < attrLen; i++) {
  109. const srcAttr = srcAttrs.item(i);
  110. const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
  111. dstAttrs.setNamedItemNS(dstAttr);
  112. }
  113. }
  114. }
  115. return dstAttrs;
  116. }
  117. function sortAttributes(a, b) {
  118. if (a.name < b.name)
  119. return -1;
  120. if (a.name > b.name)
  121. return 1;
  122. return 0;
  123. }
  124. class MockAttr {
  125. constructor(attrName, attrValue, namespaceURI = null) {
  126. this._name = attrName;
  127. this._value = String(attrValue);
  128. this._namespaceURI = namespaceURI;
  129. }
  130. get name() {
  131. return this._name;
  132. }
  133. set name(value) {
  134. this._name = value;
  135. }
  136. get value() {
  137. return this._value;
  138. }
  139. set value(value) {
  140. this._value = String(value);
  141. }
  142. get nodeName() {
  143. return this._name;
  144. }
  145. set nodeName(value) {
  146. this._name = value;
  147. }
  148. get nodeValue() {
  149. return this._value;
  150. }
  151. set nodeValue(value) {
  152. this._value = String(value);
  153. }
  154. get namespaceURI() {
  155. return this._namespaceURI;
  156. }
  157. set namespaceURI(namespaceURI) {
  158. this._namespaceURI = namespaceURI;
  159. }
  160. }
  161. class MockCustomElementRegistry {
  162. constructor(win) {
  163. this.win = win;
  164. }
  165. define(tagName, cstr, options) {
  166. if (tagName.toLowerCase() !== tagName) {
  167. throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name`);
  168. }
  169. if (this.__registry == null) {
  170. this.__registry = new Map();
  171. }
  172. this.__registry.set(tagName, { cstr, options });
  173. if (this.__whenDefined != null) {
  174. const whenDefinedResolveFns = this.__whenDefined.get(tagName);
  175. if (whenDefinedResolveFns != null) {
  176. whenDefinedResolveFns.forEach((whenDefinedResolveFn) => {
  177. whenDefinedResolveFn();
  178. });
  179. whenDefinedResolveFns.length = 0;
  180. this.__whenDefined.delete(tagName);
  181. }
  182. }
  183. const doc = this.win.document;
  184. if (doc != null) {
  185. const hosts = doc.querySelectorAll(tagName);
  186. hosts.forEach((host) => {
  187. if (upgradedElements.has(host) === false) {
  188. tempDisableCallbacks.add(doc);
  189. const upgradedCmp = createCustomElement(this, doc, tagName);
  190. for (let i = 0; i < host.childNodes.length; i++) {
  191. const childNode = host.childNodes[i];
  192. childNode.remove();
  193. upgradedCmp.appendChild(childNode);
  194. }
  195. tempDisableCallbacks.delete(doc);
  196. if (proxyElements.has(host)) {
  197. proxyElements.set(host, upgradedCmp);
  198. }
  199. }
  200. fireConnectedCallback(host);
  201. });
  202. }
  203. }
  204. get(tagName) {
  205. if (this.__registry != null) {
  206. const def = this.__registry.get(tagName.toLowerCase());
  207. if (def != null) {
  208. return def.cstr;
  209. }
  210. }
  211. return undefined;
  212. }
  213. upgrade(_rootNode) {
  214. //
  215. }
  216. clear() {
  217. if (this.__registry != null) {
  218. this.__registry.clear();
  219. }
  220. if (this.__whenDefined != null) {
  221. this.__whenDefined.clear();
  222. }
  223. }
  224. whenDefined(tagName) {
  225. tagName = tagName.toLowerCase();
  226. if (this.__registry != null && this.__registry.has(tagName) === true) {
  227. return Promise.resolve(this.__registry.get(tagName).cstr);
  228. }
  229. return new Promise((resolve) => {
  230. if (this.__whenDefined == null) {
  231. this.__whenDefined = new Map();
  232. }
  233. let whenDefinedResolveFns = this.__whenDefined.get(tagName);
  234. if (whenDefinedResolveFns == null) {
  235. whenDefinedResolveFns = [];
  236. this.__whenDefined.set(tagName, whenDefinedResolveFns);
  237. }
  238. whenDefinedResolveFns.push(resolve);
  239. });
  240. }
  241. }
  242. function createCustomElement(customElements, ownerDocument, tagName) {
  243. const Cstr = customElements.get(tagName);
  244. if (Cstr != null) {
  245. const cmp = new Cstr(ownerDocument);
  246. cmp.nodeName = tagName.toUpperCase();
  247. upgradedElements.add(cmp);
  248. return cmp;
  249. }
  250. const host = new Proxy({}, {
  251. get(obj, prop) {
  252. const elm = proxyElements.get(host);
  253. if (elm != null) {
  254. return elm[prop];
  255. }
  256. return obj[prop];
  257. },
  258. set(obj, prop, val) {
  259. const elm = proxyElements.get(host);
  260. if (elm != null) {
  261. elm[prop] = val;
  262. }
  263. else {
  264. obj[prop] = val;
  265. }
  266. return true;
  267. },
  268. has(obj, prop) {
  269. const elm = proxyElements.get(host);
  270. if (prop in elm) {
  271. return true;
  272. }
  273. if (prop in obj) {
  274. return true;
  275. }
  276. return false;
  277. },
  278. });
  279. const elm = new MockHTMLElement(ownerDocument, tagName);
  280. proxyElements.set(host, elm);
  281. return host;
  282. }
  283. const proxyElements = new WeakMap();
  284. const upgradedElements = new WeakSet();
  285. function connectNode(ownerDocument, node) {
  286. node.ownerDocument = ownerDocument;
  287. if (node.nodeType === 1 /* ELEMENT_NODE */) {
  288. if (ownerDocument != null && node.nodeName.includes('-')) {
  289. const win = ownerDocument.defaultView;
  290. if (win != null && typeof node.connectedCallback === 'function' && node.isConnected) {
  291. fireConnectedCallback(node);
  292. }
  293. const shadowRoot = node.shadowRoot;
  294. if (shadowRoot != null) {
  295. shadowRoot.childNodes.forEach((childNode) => {
  296. connectNode(ownerDocument, childNode);
  297. });
  298. }
  299. }
  300. node.childNodes.forEach((childNode) => {
  301. connectNode(ownerDocument, childNode);
  302. });
  303. }
  304. else {
  305. node.childNodes.forEach((childNode) => {
  306. childNode.ownerDocument = ownerDocument;
  307. });
  308. }
  309. }
  310. function fireConnectedCallback(node) {
  311. if (typeof node.connectedCallback === 'function') {
  312. if (tempDisableCallbacks.has(node.ownerDocument) === false) {
  313. try {
  314. node.connectedCallback();
  315. }
  316. catch (e) {
  317. console.error(e);
  318. }
  319. }
  320. }
  321. }
  322. function disconnectNode(node) {
  323. if (node.nodeType === 1 /* ELEMENT_NODE */) {
  324. if (node.nodeName.includes('-') === true && typeof node.disconnectedCallback === 'function') {
  325. if (tempDisableCallbacks.has(node.ownerDocument) === false) {
  326. try {
  327. node.disconnectedCallback();
  328. }
  329. catch (e) {
  330. console.error(e);
  331. }
  332. }
  333. }
  334. node.childNodes.forEach(disconnectNode);
  335. }
  336. }
  337. function attributeChanged(node, attrName, oldValue, newValue) {
  338. attrName = attrName.toLowerCase();
  339. const observedAttributes = node.constructor.observedAttributes;
  340. if (Array.isArray(observedAttributes) === true &&
  341. observedAttributes.some((obs) => obs.toLowerCase() === attrName) === true) {
  342. try {
  343. node.attributeChangedCallback(attrName, oldValue, newValue);
  344. }
  345. catch (e) {
  346. console.error(e);
  347. }
  348. }
  349. }
  350. function checkAttributeChanged(node) {
  351. return node.nodeName.includes('-') === true && typeof node.attributeChangedCallback === 'function';
  352. }
  353. const tempDisableCallbacks = new Set();
  354. function dataset(elm) {
  355. const ds = {};
  356. const attributes = elm.attributes;
  357. const attrLen = attributes.length;
  358. for (let i = 0; i < attrLen; i++) {
  359. const attr = attributes.item(i);
  360. const nodeName = attr.nodeName;
  361. if (nodeName.startsWith('data-')) {
  362. ds[dashToPascalCase(nodeName)] = attr.nodeValue;
  363. }
  364. }
  365. return new Proxy(ds, {
  366. get(_obj, camelCaseProp) {
  367. return ds[camelCaseProp];
  368. },
  369. set(_obj, camelCaseProp, value) {
  370. const dataAttr = toDataAttribute(camelCaseProp);
  371. elm.setAttribute(dataAttr, value);
  372. return true;
  373. },
  374. });
  375. }
  376. function toDataAttribute(str) {
  377. return ('data-' +
  378. String(str)
  379. .replace(/([A-Z0-9])/g, (g) => ' ' + g[0])
  380. .trim()
  381. .replace(/ /g, '-')
  382. .toLowerCase());
  383. }
  384. function dashToPascalCase(str) {
  385. str = String(str).slice(5);
  386. return str
  387. .split('-')
  388. .map((segment, index) => {
  389. if (index === 0) {
  390. return segment.charAt(0).toLowerCase() + segment.slice(1);
  391. }
  392. return segment.charAt(0).toUpperCase() + segment.slice(1);
  393. })
  394. .join('');
  395. }
  396. // Sizzle 2.3.6
  397. const Sizzle = (function() {
  398. const window = {
  399. document: {
  400. createElement() {
  401. return {};
  402. },
  403. nodeType: 9,
  404. documentElement: {
  405. nodeType: 1,
  406. nodeName: 'HTML'
  407. }
  408. }
  409. };
  410. const module = { exports: {} };
  411. /*! Sizzle v2.3.6 | (c) JS Foundation and other contributors | js.foundation */
  412. !function(e){var t,n,r,i,o,u,l,a,c,s,d,f,p,h,g,m,y,v,w,b="sizzle"+1*new Date,N=e.document,C=0,x=0,E=ae(),A=ae(),S=ae(),D=ae(),T=function(e,t){return e===t&&(d=!0),0},L={}.hasOwnProperty,q=[],I=q.pop,B=q.push,R=q.push,$=q.slice,k=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return -1},H="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",P="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",z="\\["+M+"*("+P+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+P+"))|)"+M+"*\\]",F=":("+P+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+z+")*)|.*)\\)|)",O=new RegExp(M+"+","g"),j=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),G=new RegExp("^"+M+"*,"+M+"*"),U=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),V=new RegExp(M+"|>"),X=new RegExp(F),J=new RegExp("^"+P+"$"),K={ID:new RegExp("^#("+P+")"),CLASS:new RegExp("^\\.("+P+")"),TAG:new RegExp("^("+P+"|[*])"),ATTR:new RegExp("^"+z),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+H+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/HTML$/i,W=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){f();},ue=ve(function(e){return !0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{R.apply(q=$.call(N.childNodes),N.childNodes),q[N.childNodes.length].nodeType;}catch(e){R={apply:q.length?function(e,t){B.apply(e,$.call(t));}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1;}};}function le(e,t,r,i){var o,l,c,s,d,h,y,v=t&&t.ownerDocument,N=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==N&&9!==N&&11!==N)return r;if(!i&&(f(t),t=t||p,g)){if(11!==N&&(d=_.exec(e)))if(o=d[1]){if(9===N){if(!(c=t.getElementById(o)))return r;if(c.id===o)return r.push(c),r}else if(v&&(c=v.getElementById(o))&&w(t,c)&&c.id===o)return r.push(c),r}else {if(d[2])return R.apply(r,t.getElementsByTagName(e)),r;if((o=d[3])&&n.getElementsByClassName&&t.getElementsByClassName)return R.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!D[e+" "]&&(!m||!m.test(e))&&(1!==N||"object"!==t.nodeName.toLowerCase())){if(y=e,v=t,1===N&&(V.test(e)||U.test(e))){(v=ee.test(e)&&ge(t.parentNode)||t)===t&&n.scope||((s=t.getAttribute("id"))?s=s.replace(re,ie):t.setAttribute("id",s=b)),l=(h=u(e)).length;while(l--)h[l]=(s?"#"+s:":scope")+" "+ye(h[l]);y=h.join(",");}try{return R.apply(r,v.querySelectorAll(y)),r}catch(t){D(e,!0);}finally{s===b&&t.removeAttribute("id");}}}return a(e.replace(j,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function ce(e){return e[b]=!0,e}function se(e){var t=p.createElement("fieldset");try{return !!e(t)}catch(e){return !1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null;}}function de(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t;}function fe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return -1;return e?1:-1}function pe(e){return function(t){return "form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ue(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return ce(function(t){return t=+t,ce(function(n,r){var i,o=e([],n.length,t),u=o.length;while(u--)n[i=o[u]]&&(n[i]=!(r[i]=n[i]));})})}function ge(e){return e&&void 0!==e.getElementsByTagName&&e}n=le.support={},o=le.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return !Q.test(t||n&&n.nodeName||"HTML")},f=le.setDocument=function(e){var t,i,u=e?e.ownerDocument||e:N;return u!=p&&9===u.nodeType&&u.documentElement?(p=u,h=p.documentElement,g=!o(p),N!=p&&(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.scope=se(function(e){return h.appendChild(e).appendChild(p.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),n.attributes=se(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=se(function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Z.test(p.getElementsByClassName),n.getById=se(function(e){return h.appendChild(e).id=b,!p.getElementsByName||!p.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return [o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return [o]}return []}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&g)return t.getElementsByClassName(e)},y=[],m=[],(n.qsa=Z.test(p.querySelectorAll))&&(se(function(e){var t;h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+M+"*(?:value|"+H+")"),e.querySelectorAll("[id~="+b+"-]").length||m.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||m.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||m.push(".#.+[+~]"),e.querySelectorAll("\\\f"),m.push("[\\r\\n\\f]");}),se(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:");})),(n.matchesSelector=Z.test(v=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&se(function(e){n.disconnectedMatch=v.call(e,"*"),v.call(e,"[s!='']:x"),y.push("!=",F);}),m=m.length&&new RegExp(m.join("|")),y=y.length&&new RegExp(y.join("|")),t=Z.test(h.compareDocumentPosition),w=t||Z.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return !0;return !1},T=t?function(e,t){if(e===t)return d=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==p||e.ownerDocument==N&&w(N,e)?-1:t==p||t.ownerDocument==N&&w(N,t)?1:s?k(s,e)-k(s,t):0:4&r?-1:1)}:function(e,t){if(e===t)return d=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,u=[e],l=[t];if(!i||!o)return e==p?-1:t==p?1:i?-1:o?1:s?k(s,e)-k(s,t):0;if(i===o)return fe(e,t);n=e;while(n=n.parentNode)u.unshift(n);n=t;while(n=n.parentNode)l.unshift(n);while(u[r]===l[r])r++;return r?fe(u[r],l[r]):u[r]==N?-1:l[r]==N?1:0},p):p},le.matches=function(e,t){return le(e,null,null,t)},le.matchesSelector=function(e,t){if(f(e),n.matchesSelector&&g&&!D[t+" "]&&(!y||!y.test(t))&&(!m||!m.test(t)))try{var r=v.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){D(t,!0);}return le(t,p,null,[e]).length>0},le.contains=function(e,t){return (e.ownerDocument||e)!=p&&f(e),w(e,t)},le.attr=function(e,t){(e.ownerDocument||e)!=p&&f(e);var i=r.attrHandle[t.toLowerCase()],o=i&&L.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},le.escape=function(e){return (e+"").replace(re,ie)},le.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},le.uniqueSort=function(e){var t,r=[],i=0,o=0;if(d=!n.detectDuplicates,s=!n.sortStable&&e.slice(0),e.sort(T),d){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1);}return s=null,e},i=le.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e);}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=le.selectors={cacheLength:50,createPseudo:ce,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||le.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&le.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=u(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return "*"===e?function(){return !0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=le.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(O," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),u="last"!==e.slice(-4),l="of-type"===t;return 1===r&&0===i?function(e){return !!e.parentNode}:function(t,n,a){var c,s,d,f,p,h,g=o!==u?"nextSibling":"previousSibling",m=t.parentNode,y=l&&t.nodeName.toLowerCase(),v=!a&&!l,w=!1;if(m){if(o){while(g){f=t;while(f=f[g])if(l?f.nodeName.toLowerCase()===y:1===f.nodeType)return !1;h=g="only"===e&&!h&&"nextSibling";}return !0}if(h=[u?m.firstChild:m.lastChild],u&&v){w=(p=(c=(s=(d=(f=m)[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]||[])[0]===C&&c[1])&&c[2],f=p&&m.childNodes[p];while(f=++p&&f&&f[g]||(w=p=0)||h.pop())if(1===f.nodeType&&++w&&f===t){s[e]=[C,p,w];break}}else if(v&&(w=p=(c=(s=(d=(f=t)[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]||[])[0]===C&&c[1]),!1===w)while(f=++p&&f&&f[g]||(w=p=0)||h.pop())if((l?f.nodeName.toLowerCase()===y:1===f.nodeType)&&++w&&(v&&((s=(d=f[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]=[C,w]),f===t))break;return (w-=i)===r||w%r==0&&w/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||le.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ce(function(e,n){var r,o=i(e,t),u=o.length;while(u--)e[r=k(e,o[u])]=!(n[r]=o[u]);}):function(e){return i(e,0,n)}):i}},pseudos:{not:ce(function(e){var t=[],n=[],r=l(e.replace(j,"$1"));return r[b]?ce(function(e,t,n,i){var o,u=r(e,null,i,[]),l=e.length;while(l--)(o=u[l])&&(e[l]=!(t[l]=o));}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:ce(function(e){return function(t){return le(e,t).length>0}}),contains:ce(function(e){return e=e.replace(te,ne),function(t){return (t.textContent||i(t)).indexOf(e)>-1}}),lang:ce(function(e){return J.test(e||"")||le.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return (n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return !1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:pe(!1),disabled:pe(!0),checked:function(e){var t=e.nodeName.toLowerCase();return "input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return !1;return !0},parent:function(e){return !r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return W.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return "input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return "input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return [0]}),last:he(function(e,t){return [t-1]}),eq:he(function(e,t,n){return [n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n>t?t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in {radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=function(e){return function(t){return "input"===t.nodeName.toLowerCase()&&t.type===e}}(t);for(t in {submit:!0,reset:!0})r.pseudos[t]=function(e){return function(t){var n=t.nodeName.toLowerCase();return ("input"===n||"button"===n)&&t.type===e}}(t);function me(){}me.prototype=r.filters=r.pseudos,r.setFilters=new me,u=le.tokenize=function(e,t){var n,i,o,u,l,a,c,s=A[e+" "];if(s)return t?0:s.slice(0);l=e,a=[],c=r.preFilter;while(l){n&&!(i=G.exec(l))||(i&&(l=l.slice(i[0].length)||l),a.push(o=[])),n=!1,(i=U.exec(l))&&(n=i.shift(),o.push({value:n,type:i[0].replace(j," ")}),l=l.slice(n.length));for(u in r.filter)!(i=K[u].exec(l))||c[u]&&!(i=c[u](i))||(n=i.shift(),o.push({value:n,type:u,matches:i}),l=l.slice(n.length));if(!n)break}return t?l.length:l?le.error(e):A(e,a).slice(0)};function ye(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function ve(e,t,n){var r=t.dir,i=t.next,o=i||r,u=n&&"parentNode"===o,l=x++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||u)return e(t,n,i);return !1}:function(t,n,a){var c,s,d,f=[C,l];if(a){while(t=t[r])if((1===t.nodeType||u)&&e(t,n,a))return !0}else while(t=t[r])if(1===t.nodeType||u)if(d=t[b]||(t[b]={}),s=d[t.uniqueID]||(d[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else {if((c=s[o])&&c[0]===C&&c[1]===l)return f[2]=c[2];if(s[o]=f,f[2]=e(t,n,a))return !0}return !1}}function we(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return !1;return !0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)le(e,t[r],n);return n}function Ne(e,t,n,r,i){for(var o,u=[],l=0,a=e.length,c=null!=t;l<a;l++)(o=e[l])&&(n&&!n(o,r,i)||(u.push(o),c&&t.push(l)));return u}function Ce(e,t,n,r,i,o){return r&&!r[b]&&(r=Ce(r)),i&&!i[b]&&(i=Ce(i,o)),ce(function(o,u,l,a){var c,s,d,f=[],p=[],h=u.length,g=o||be(t||"*",l.nodeType?[l]:l,[]),m=!e||!o&&t?g:Ne(g,f,e,l,a),y=n?i||(o?e:h||r)?[]:u:m;if(n&&n(m,y,l,a),r){c=Ne(y,p),r(c,[],l,a),s=c.length;while(s--)(d=c[s])&&(y[p[s]]=!(m[p[s]]=d));}if(o){if(i||e){if(i){c=[],s=y.length;while(s--)(d=y[s])&&c.push(m[s]=d);i(null,y=[],c,a);}s=y.length;while(s--)(d=y[s])&&(c=i?k(o,d):f[s])>-1&&(o[c]=!(u[c]=d));}}else y=Ne(y===u?y.splice(h,y.length):y),i?i(null,u,y,a):R.apply(u,y);})}function xe(e){for(var t,n,i,o=e.length,u=r.relative[e[0].type],l=u||r.relative[" "],a=u?1:0,s=ve(function(e){return e===t},l,!0),d=ve(function(e){return k(t,e)>-1},l,!0),f=[function(e,n,r){var i=!u&&(r||n!==c)||((t=n).nodeType?s(e,n,r):d(e,n,r));return t=null,i}];a<o;a++)if(n=r.relative[e[a].type])f=[ve(we(f),n)];else {if((n=r.filter[e[a].type].apply(null,e[a].matches))[b]){for(i=++a;i<o;i++)if(r.relative[e[i].type])break;return Ce(a>1&&we(f),a>1&&ye(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(j,"$1"),n,a<i&&xe(e.slice(a,i)),i<o&&xe(e=e.slice(i)),i<o&&ye(e))}f.push(n);}return we(f)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,u,l,a,s){var d,h,m,y=0,v="0",w=o&&[],b=[],N=c,x=o||i&&r.find.TAG("*",s),E=C+=null==N?1:Math.random()||.1,A=x.length;for(s&&(c=u==p||u||s);v!==A&&null!=(d=x[v]);v++){if(i&&d){h=0,u||d.ownerDocument==p||(f(d),l=!g);while(m=e[h++])if(m(d,u||p,l)){a.push(d);break}s&&(C=E);}n&&((d=!m&&d)&&y--,o&&w.push(d));}if(y+=v,n&&v!==y){h=0;while(m=t[h++])m(w,b,u,l);if(o){if(y>0)while(v--)w[v]||b[v]||(b[v]=I.call(a));b=Ne(b);}R.apply(a,b),s&&!o&&b.length>0&&y+t.length>1&&le.uniqueSort(a);}return s&&(C=E,c=N),w};return n?ce(o):o}l=le.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=u(e)),n=t.length;while(n--)(o=xe(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e;}return o},a=le.select=function(e,t,n,i){var o,a,c,s,d,f="function"==typeof e&&e,p=!i&&u(e=f.selector||e);if(n=n||[],1===p.length){if((a=p[0]=p[0].slice(0)).length>2&&"ID"===(c=a[0]).type&&9===t.nodeType&&g&&r.relative[a[1].type]){if(!(t=(r.find.ID(c.matches[0].replace(te,ne),t)||[])[0]))return n;f&&(t=t.parentNode),e=e.slice(a.shift().value.length);}o=K.needsContext.test(e)?0:a.length;while(o--){if(c=a[o],r.relative[s=c.type])break;if((d=r.find[s])&&(i=d(c.matches[0].replace(te,ne),ee.test(a[0].type)&&ge(t.parentNode)||t))){if(a.splice(o,1),!(e=i.length&&ye(a)))return R.apply(n,i),n;break}}}return (f||l(e,p))(i,t,!g,n,!t||ee.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(T).join("")===b,n.detectDuplicates=!!d,f(),n.sortDetached=se(function(e){return 1&e.compareDocumentPosition(p.createElement("fieldset"))}),se(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||de("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&se(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||de("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),se(function(e){return null==e.getAttribute("disabled")})||de(H,function(e,t,n){var r;if(!n)return !0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null});var Ae=e.Sizzle;le.noConflict=function(){return e.Sizzle===le&&(e.Sizzle=Ae),le},"function"==typeof define&&define.amd?define(function(){return le}):"undefined"!=typeof module&&module.exports?module.exports=le:e.Sizzle=le;}(window);
  413. //# sourceMappingURL=sizzle.min.map
  414. return module.exports;
  415. })();
  416. function matches(selector, elm) {
  417. const r = Sizzle.matches(selector, [elm]);
  418. return r.length > 0;
  419. }
  420. function selectOne(selector, elm) {
  421. const r = Sizzle(selector, elm);
  422. return r[0] || null;
  423. }
  424. function selectAll(selector, elm) {
  425. return Sizzle(selector, elm);
  426. }
  427. class MockClassList {
  428. constructor(elm) {
  429. this.elm = elm;
  430. }
  431. add(...classNames) {
  432. const clsNames = getItems(this.elm);
  433. let updated = false;
  434. classNames.forEach((className) => {
  435. className = String(className);
  436. validateClass(className);
  437. if (clsNames.includes(className) === false) {
  438. clsNames.push(className);
  439. updated = true;
  440. }
  441. });
  442. if (updated) {
  443. this.elm.setAttributeNS(null, 'class', clsNames.join(' '));
  444. }
  445. }
  446. remove(...classNames) {
  447. const clsNames = getItems(this.elm);
  448. let updated = false;
  449. classNames.forEach((className) => {
  450. className = String(className);
  451. validateClass(className);
  452. const index = clsNames.indexOf(className);
  453. if (index > -1) {
  454. clsNames.splice(index, 1);
  455. updated = true;
  456. }
  457. });
  458. if (updated) {
  459. this.elm.setAttributeNS(null, 'class', clsNames.filter((c) => c.length > 0).join(' '));
  460. }
  461. }
  462. contains(className) {
  463. className = String(className);
  464. return getItems(this.elm).includes(className);
  465. }
  466. toggle(className) {
  467. className = String(className);
  468. if (this.contains(className) === true) {
  469. this.remove(className);
  470. }
  471. else {
  472. this.add(className);
  473. }
  474. }
  475. get length() {
  476. return getItems(this.elm).length;
  477. }
  478. item(index) {
  479. return getItems(this.elm)[index];
  480. }
  481. toString() {
  482. return getItems(this.elm).join(' ');
  483. }
  484. }
  485. function validateClass(className) {
  486. if (className === '') {
  487. throw new Error('The token provided must not be empty.');
  488. }
  489. if (/\s/.test(className)) {
  490. throw new Error(`The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`);
  491. }
  492. }
  493. function getItems(elm) {
  494. const className = elm.getAttribute('class');
  495. if (typeof className === 'string' && className.length > 0) {
  496. return className
  497. .trim()
  498. .split(' ')
  499. .filter((c) => c.length > 0);
  500. }
  501. return [];
  502. }
  503. class MockCSSStyleDeclaration {
  504. constructor() {
  505. this._styles = new Map();
  506. }
  507. setProperty(prop, value) {
  508. prop = jsCaseToCssCase(prop);
  509. if (value == null || value === '') {
  510. this._styles.delete(prop);
  511. }
  512. else {
  513. this._styles.set(prop, String(value));
  514. }
  515. }
  516. getPropertyValue(prop) {
  517. prop = jsCaseToCssCase(prop);
  518. return String(this._styles.get(prop) || '');
  519. }
  520. removeProperty(prop) {
  521. prop = jsCaseToCssCase(prop);
  522. this._styles.delete(prop);
  523. }
  524. get length() {
  525. return this._styles.size;
  526. }
  527. get cssText() {
  528. const cssText = [];
  529. this._styles.forEach((value, prop) => {
  530. cssText.push(`${prop}: ${value};`);
  531. });
  532. return cssText.join(' ').trim();
  533. }
  534. set cssText(cssText) {
  535. if (cssText == null || cssText === '') {
  536. this._styles.clear();
  537. return;
  538. }
  539. cssText.split(';').forEach((rule) => {
  540. rule = rule.trim();
  541. if (rule.length > 0) {
  542. const splt = rule.split(':');
  543. if (splt.length > 1) {
  544. const prop = splt[0].trim();
  545. const value = splt.slice(1).join(':').trim();
  546. if (prop !== '' && value !== '') {
  547. this._styles.set(jsCaseToCssCase(prop), value);
  548. }
  549. }
  550. }
  551. });
  552. }
  553. }
  554. function createCSSStyleDeclaration() {
  555. return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
  556. }
  557. const cssProxyHandler = {
  558. get(cssStyle, prop) {
  559. if (prop in cssStyle) {
  560. return cssStyle[prop];
  561. }
  562. prop = cssCaseToJsCase(prop);
  563. return cssStyle.getPropertyValue(prop);
  564. },
  565. set(cssStyle, prop, value) {
  566. if (prop in cssStyle) {
  567. cssStyle[prop] = value;
  568. }
  569. else {
  570. cssStyle.setProperty(prop, value);
  571. }
  572. return true;
  573. },
  574. };
  575. function cssCaseToJsCase(str) {
  576. // font-size to fontSize
  577. if (str.length > 1 && str.includes('-') === true) {
  578. str = str
  579. .toLowerCase()
  580. .split('-')
  581. .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
  582. .join('');
  583. str = str.slice(0, 1).toLowerCase() + str.slice(1);
  584. }
  585. return str;
  586. }
  587. function jsCaseToCssCase(str) {
  588. // fontSize to font-size
  589. if (str.length > 1 && str.includes('-') === false && /[A-Z]/.test(str) === true) {
  590. str = str
  591. .replace(/([A-Z])/g, (g) => ' ' + g[0])
  592. .trim()
  593. .replace(/ /g, '-')
  594. .toLowerCase();
  595. }
  596. return str;
  597. }
  598. class MockEvent {
  599. constructor(type, eventInitDict) {
  600. this.bubbles = false;
  601. this.cancelBubble = false;
  602. this.cancelable = false;
  603. this.composed = false;
  604. this.currentTarget = null;
  605. this.defaultPrevented = false;
  606. this.srcElement = null;
  607. this.target = null;
  608. if (typeof type !== 'string') {
  609. throw new Error(`Event type required`);
  610. }
  611. this.type = type;
  612. this.timeStamp = Date.now();
  613. if (eventInitDict != null) {
  614. Object.assign(this, eventInitDict);
  615. }
  616. }
  617. preventDefault() {
  618. this.defaultPrevented = true;
  619. }
  620. stopPropagation() {
  621. this.cancelBubble = true;
  622. }
  623. stopImmediatePropagation() {
  624. this.cancelBubble = true;
  625. }
  626. composedPath() {
  627. const composedPath = [];
  628. let currentElement = this.target;
  629. while (currentElement) {
  630. composedPath.push(currentElement);
  631. if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
  632. // the current element doesn't have a parent, but we've detected it's our root document node. push the window
  633. // object associated with the document onto the path
  634. composedPath.push(currentElement.defaultView);
  635. break;
  636. }
  637. currentElement = currentElement.parentElement;
  638. }
  639. return composedPath;
  640. }
  641. }
  642. class MockCustomEvent extends MockEvent {
  643. constructor(type, customEventInitDic) {
  644. super(type);
  645. this.detail = null;
  646. if (customEventInitDic != null) {
  647. Object.assign(this, customEventInitDic);
  648. }
  649. }
  650. }
  651. class MockKeyboardEvent extends MockEvent {
  652. constructor(type, keyboardEventInitDic) {
  653. super(type);
  654. this.code = '';
  655. this.key = '';
  656. this.altKey = false;
  657. this.ctrlKey = false;
  658. this.metaKey = false;
  659. this.shiftKey = false;
  660. this.location = 0;
  661. this.repeat = false;
  662. if (keyboardEventInitDic != null) {
  663. Object.assign(this, keyboardEventInitDic);
  664. }
  665. }
  666. }
  667. class MockMouseEvent extends MockEvent {
  668. constructor(type, mouseEventInitDic) {
  669. super(type);
  670. this.screenX = 0;
  671. this.screenY = 0;
  672. this.clientX = 0;
  673. this.clientY = 0;
  674. this.ctrlKey = false;
  675. this.shiftKey = false;
  676. this.altKey = false;
  677. this.metaKey = false;
  678. this.button = 0;
  679. this.buttons = 0;
  680. this.relatedTarget = null;
  681. if (mouseEventInitDic != null) {
  682. Object.assign(this, mouseEventInitDic);
  683. }
  684. }
  685. }
  686. class MockEventListener {
  687. constructor(type, handler) {
  688. this.type = type;
  689. this.handler = handler;
  690. }
  691. }
  692. function addEventListener(elm, type, handler) {
  693. const target = elm;
  694. if (target.__listeners == null) {
  695. target.__listeners = [];
  696. }
  697. target.__listeners.push(new MockEventListener(type, handler));
  698. }
  699. function removeEventListener(elm, type, handler) {
  700. const target = elm;
  701. if (target != null && Array.isArray(target.__listeners) === true) {
  702. const elmListener = target.__listeners.find((e) => e.type === type && e.handler === handler);
  703. if (elmListener != null) {
  704. const index = target.__listeners.indexOf(elmListener);
  705. target.__listeners.splice(index, 1);
  706. }
  707. }
  708. }
  709. function resetEventListeners(target) {
  710. if (target != null && target.__listeners != null) {
  711. target.__listeners = null;
  712. }
  713. }
  714. function triggerEventListener(elm, ev) {
  715. if (elm == null || ev.cancelBubble === true) {
  716. return;
  717. }
  718. const target = elm;
  719. ev.currentTarget = elm;
  720. if (Array.isArray(target.__listeners) === true) {
  721. const listeners = target.__listeners.filter((e) => e.type === ev.type);
  722. listeners.forEach((listener) => {
  723. try {
  724. listener.handler.call(target, ev);
  725. }
  726. catch (err) {
  727. console.error(err);
  728. }
  729. });
  730. }
  731. if (ev.bubbles === false) {
  732. return;
  733. }
  734. if (elm.nodeName === "#document" /* DOCUMENT_NODE */) {
  735. triggerEventListener(elm.defaultView, ev);
  736. }
  737. else {
  738. triggerEventListener(elm.parentElement, ev);
  739. }
  740. }
  741. function dispatchEvent(currentTarget, ev) {
  742. ev.target = currentTarget;
  743. triggerEventListener(currentTarget, ev);
  744. return true;
  745. }
  746. function serializeNodeToHtml(elm, opts = {}) {
  747. const output = {
  748. currentLineWidth: 0,
  749. indent: 0,
  750. isWithinBody: false,
  751. text: [],
  752. };
  753. if (opts.prettyHtml) {
  754. if (typeof opts.indentSpaces !== 'number') {
  755. opts.indentSpaces = 2;
  756. }
  757. if (typeof opts.newLines !== 'boolean') {
  758. opts.newLines = true;
  759. }
  760. opts.approximateLineWidth = -1;
  761. }
  762. else {
  763. opts.prettyHtml = false;
  764. if (typeof opts.newLines !== 'boolean') {
  765. opts.newLines = false;
  766. }
  767. if (typeof opts.indentSpaces !== 'number') {
  768. opts.indentSpaces = 0;
  769. }
  770. }
  771. if (typeof opts.approximateLineWidth !== 'number') {
  772. opts.approximateLineWidth = -1;
  773. }
  774. if (typeof opts.removeEmptyAttributes !== 'boolean') {
  775. opts.removeEmptyAttributes = true;
  776. }
  777. if (typeof opts.removeAttributeQuotes !== 'boolean') {
  778. opts.removeAttributeQuotes = false;
  779. }
  780. if (typeof opts.removeBooleanAttributeQuotes !== 'boolean') {
  781. opts.removeBooleanAttributeQuotes = false;
  782. }
  783. if (typeof opts.removeHtmlComments !== 'boolean') {
  784. opts.removeHtmlComments = false;
  785. }
  786. if (typeof opts.serializeShadowRoot !== 'boolean') {
  787. opts.serializeShadowRoot = false;
  788. }
  789. if (opts.outerHtml) {
  790. serializeToHtml(elm, opts, output, false);
  791. }
  792. else {
  793. for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
  794. serializeToHtml(elm.childNodes[i], opts, output, false);
  795. }
  796. }
  797. if (output.text[0] === '\n') {
  798. output.text.shift();
  799. }
  800. if (output.text[output.text.length - 1] === '\n') {
  801. output.text.pop();
  802. }
  803. return output.text.join('');
  804. }
  805. function serializeToHtml(node, opts, output, isShadowRoot) {
  806. if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
  807. const tagName = isShadowRoot ? 'mock:shadow-root' : getTagName(node);
  808. if (tagName === 'body') {
  809. output.isWithinBody = true;
  810. }
  811. const ignoreTag = opts.excludeTags != null && opts.excludeTags.includes(tagName);
  812. if (ignoreTag === false) {
  813. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  814. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  815. output.text.push('\n');
  816. output.currentLineWidth = 0;
  817. }
  818. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  819. for (let i = 0; i < output.indent; i++) {
  820. output.text.push(' ');
  821. }
  822. output.currentLineWidth += output.indent;
  823. }
  824. output.text.push('<' + tagName);
  825. output.currentLineWidth += tagName.length + 1;
  826. const attrsLength = node.attributes.length;
  827. const attributes = opts.prettyHtml && attrsLength > 1
  828. ? cloneAttributes(node.attributes, true)
  829. : node.attributes;
  830. for (let i = 0; i < attrsLength; i++) {
  831. const attr = attributes.item(i);
  832. const attrName = attr.name;
  833. if (attrName === 'style') {
  834. continue;
  835. }
  836. let attrValue = attr.value;
  837. if (opts.removeEmptyAttributes && attrValue === '' && REMOVE_EMPTY_ATTR.has(attrName)) {
  838. continue;
  839. }
  840. const attrNamespaceURI = attr.namespaceURI;
  841. if (attrNamespaceURI == null) {
  842. output.currentLineWidth += attrName.length + 1;
  843. if (opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
  844. output.text.push('\n' + attrName);
  845. output.currentLineWidth = 0;
  846. }
  847. else {
  848. output.text.push(' ' + attrName);
  849. }
  850. }
  851. else if (attrNamespaceURI === 'http://www.w3.org/XML/1998/namespace') {
  852. output.text.push(' xml:' + attrName);
  853. output.currentLineWidth += attrName.length + 5;
  854. }
  855. else if (attrNamespaceURI === 'http://www.w3.org/2000/xmlns/') {
  856. if (attrName !== 'xmlns') {
  857. output.text.push(' xmlns:' + attrName);
  858. output.currentLineWidth += attrName.length + 7;
  859. }
  860. else {
  861. output.text.push(' ' + attrName);
  862. output.currentLineWidth += attrName.length + 1;
  863. }
  864. }
  865. else if (attrNamespaceURI === XLINK_NS) {
  866. output.text.push(' xlink:' + attrName);
  867. output.currentLineWidth += attrName.length + 7;
  868. }
  869. else {
  870. output.text.push(' ' + attrNamespaceURI + ':' + attrName);
  871. output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
  872. }
  873. if (opts.prettyHtml && attrName === 'class') {
  874. attrValue = attr.value = attrValue
  875. .split(' ')
  876. .filter((t) => t !== '')
  877. .sort()
  878. .join(' ')
  879. .trim();
  880. }
  881. if (attrValue === '') {
  882. if (opts.removeBooleanAttributeQuotes && BOOLEAN_ATTR.has(attrName)) {
  883. continue;
  884. }
  885. if (opts.removeEmptyAttributes && attrName.startsWith('data-')) {
  886. continue;
  887. }
  888. }
  889. if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
  890. output.text.push('=' + escapeString(attrValue, true));
  891. output.currentLineWidth += attrValue.length + 1;
  892. }
  893. else {
  894. output.text.push('="' + escapeString(attrValue, true) + '"');
  895. output.currentLineWidth += attrValue.length + 3;
  896. }
  897. }
  898. if (node.hasAttribute('style')) {
  899. const cssText = node.style.cssText;
  900. if (opts.approximateLineWidth > 0 &&
  901. output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
  902. output.text.push(`\nstyle="${cssText}">`);
  903. output.currentLineWidth = 0;
  904. }
  905. else {
  906. output.text.push(` style="${cssText}">`);
  907. output.currentLineWidth += cssText.length + 10;
  908. }
  909. }
  910. else {
  911. output.text.push('>');
  912. output.currentLineWidth += 1;
  913. }
  914. }
  915. if (EMPTY_ELEMENTS.has(tagName) === false) {
  916. if (opts.serializeShadowRoot && node.shadowRoot != null) {
  917. output.indent = output.indent + opts.indentSpaces;
  918. serializeToHtml(node.shadowRoot, opts, output, true);
  919. output.indent = output.indent - opts.indentSpaces;
  920. if (opts.newLines &&
  921. (node.childNodes.length === 0 ||
  922. (node.childNodes.length === 1 &&
  923. node.childNodes[0].nodeType === 3 /* TEXT_NODE */ &&
  924. node.childNodes[0].nodeValue.trim() === ''))) {
  925. output.text.push('\n');
  926. output.currentLineWidth = 0;
  927. for (let i = 0; i < output.indent; i++) {
  928. output.text.push(' ');
  929. }
  930. output.currentLineWidth += output.indent;
  931. }
  932. }
  933. if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
  934. const childNodes = tagName === 'template' ? node.content.childNodes : node.childNodes;
  935. const childNodeLength = childNodes.length;
  936. if (childNodeLength > 0) {
  937. if (childNodeLength === 1 &&
  938. childNodes[0].nodeType === 3 /* TEXT_NODE */ &&
  939. (typeof childNodes[0].nodeValue !== 'string' || childNodes[0].nodeValue.trim() === '')) ;
  940. else {
  941. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  942. if (!isWithinWhitespaceSensitiveNode && opts.indentSpaces > 0 && ignoreTag === false) {
  943. output.indent = output.indent + opts.indentSpaces;
  944. }
  945. for (let i = 0; i < childNodeLength; i++) {
  946. serializeToHtml(childNodes[i], opts, output, false);
  947. }
  948. if (ignoreTag === false) {
  949. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  950. output.text.push('\n');
  951. output.currentLineWidth = 0;
  952. }
  953. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  954. output.indent = output.indent - opts.indentSpaces;
  955. for (let i = 0; i < output.indent; i++) {
  956. output.text.push(' ');
  957. }
  958. output.currentLineWidth += output.indent;
  959. }
  960. }
  961. }
  962. }
  963. if (ignoreTag === false) {
  964. output.text.push('</' + tagName + '>');
  965. output.currentLineWidth += tagName.length + 3;
  966. }
  967. }
  968. }
  969. if (opts.approximateLineWidth > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
  970. output.text.push('\n');
  971. output.currentLineWidth = 0;
  972. }
  973. if (tagName === 'body') {
  974. output.isWithinBody = false;
  975. }
  976. }
  977. else if (node.nodeType === 3 /* TEXT_NODE */) {
  978. let textContent = node.nodeValue;
  979. if (typeof textContent === 'string') {
  980. const trimmedTextContent = textContent.trim();
  981. if (trimmedTextContent === '') {
  982. // this text node is whitespace only
  983. if (isWithinWhitespaceSensitive(node)) {
  984. // whitespace matters within this element
  985. // just add the exact text we were given
  986. output.text.push(textContent);
  987. output.currentLineWidth += textContent.length;
  988. }
  989. else if (opts.approximateLineWidth > 0 && !output.isWithinBody) ;
  990. else if (!opts.prettyHtml) {
  991. // this text node is only whitespace, and it's not
  992. // within a whitespace sensitive element like <pre> or <code>
  993. // so replace the entire white space with a single new line
  994. output.currentLineWidth += 1;
  995. if (opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
  996. // good enough for a new line
  997. // for perf these are all just estimates
  998. // we don't care to ensure exact line lengths
  999. output.text.push('\n');
  1000. output.currentLineWidth = 0;
  1001. }
  1002. else {
  1003. // let's keep it all on the same line yet
  1004. output.text.push(' ');
  1005. }
  1006. }
  1007. }
  1008. else {
  1009. // this text node has text content
  1010. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
  1011. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  1012. output.text.push('\n');
  1013. output.currentLineWidth = 0;
  1014. }
  1015. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  1016. for (let i = 0; i < output.indent; i++) {
  1017. output.text.push(' ');
  1018. }
  1019. output.currentLineWidth += output.indent;
  1020. }
  1021. let textContentLength = textContent.length;
  1022. if (textContentLength > 0) {
  1023. // this text node has text content
  1024. const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */
  1025. ? node.parentNode.nodeName
  1026. : null;
  1027. if (NON_ESCAPABLE_CONTENT.has(parentTagName)) {
  1028. // this text node cannot have its content escaped since it's going
  1029. // into an element like <style> or <script>
  1030. if (isWithinWhitespaceSensitive(node)) {
  1031. output.text.push(textContent);
  1032. }
  1033. else {
  1034. output.text.push(trimmedTextContent);
  1035. textContentLength = trimmedTextContent.length;
  1036. }
  1037. output.currentLineWidth += textContentLength;
  1038. }
  1039. else {
  1040. // this text node is going into a normal element and html can be escaped
  1041. if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
  1042. // pretty print the text node
  1043. output.text.push(escapeString(textContent.replace(/\s\s+/g, ' ').trim(), false));
  1044. output.currentLineWidth += textContentLength;
  1045. }
  1046. else {
  1047. // not pretty printing the text node
  1048. if (isWithinWhitespaceSensitive(node)) {
  1049. output.currentLineWidth += textContentLength;
  1050. }
  1051. else {
  1052. // this element is not a whitespace sensitive one, like <pre> or <code> so
  1053. // any whitespace at the start and end can be cleaned up to just be one space
  1054. if (/\s/.test(textContent.charAt(0))) {
  1055. textContent = ' ' + textContent.trimLeft();
  1056. }
  1057. textContentLength = textContent.length;
  1058. if (textContentLength > 1) {
  1059. if (/\s/.test(textContent.charAt(textContentLength - 1))) {
  1060. if (opts.approximateLineWidth > 0 &&
  1061. output.currentLineWidth + textContentLength > opts.approximateLineWidth) {
  1062. textContent = textContent.trimRight() + '\n';
  1063. output.currentLineWidth = 0;
  1064. }
  1065. else {
  1066. textContent = textContent.trimRight() + ' ';
  1067. }
  1068. }
  1069. }
  1070. output.currentLineWidth += textContentLength;
  1071. }
  1072. output.text.push(escapeString(textContent, false));
  1073. }
  1074. }
  1075. }
  1076. }
  1077. }
  1078. }
  1079. else if (node.nodeType === 8 /* COMMENT_NODE */) {
  1080. const nodeValue = node.nodeValue;
  1081. if (opts.removeHtmlComments) {
  1082. const isHydrateAnnotation = nodeValue.startsWith(CONTENT_REF_ID + '.') ||
  1083. nodeValue.startsWith(ORG_LOCATION_ID + '.') ||
  1084. nodeValue.startsWith(SLOT_NODE_ID + '.') ||
  1085. nodeValue.startsWith(TEXT_NODE_ID + '.');
  1086. if (!isHydrateAnnotation) {
  1087. return;
  1088. }
  1089. }
  1090. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  1091. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  1092. output.text.push('\n');
  1093. output.currentLineWidth = 0;
  1094. }
  1095. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  1096. for (let i = 0; i < output.indent; i++) {
  1097. output.text.push(' ');
  1098. }
  1099. output.currentLineWidth += output.indent;
  1100. }
  1101. output.text.push('<!--' + nodeValue + '-->');
  1102. output.currentLineWidth += nodeValue.length + 7;
  1103. }
  1104. else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
  1105. output.text.push('<!doctype html>');
  1106. }
  1107. }
  1108. const AMP_REGEX = /&/g;
  1109. const NBSP_REGEX = /\u00a0/g;
  1110. const DOUBLE_QUOTE_REGEX = /"/g;
  1111. const LT_REGEX = /</g;
  1112. const GT_REGEX = />/g;
  1113. const CAN_REMOVE_ATTR_QUOTES = /^[^ \t\n\f\r"'`=<>\/\\-]+$/;
  1114. function getTagName(element) {
  1115. if (element.namespaceURI === 'http://www.w3.org/1999/xhtml') {
  1116. return element.nodeName.toLowerCase();
  1117. }
  1118. else {
  1119. return element.nodeName;
  1120. }
  1121. }
  1122. function escapeString(str, attrMode) {
  1123. str = str.replace(AMP_REGEX, '&amp;').replace(NBSP_REGEX, '&nbsp;');
  1124. if (attrMode) {
  1125. return str.replace(DOUBLE_QUOTE_REGEX, '&quot;');
  1126. }
  1127. return str.replace(LT_REGEX, '&lt;').replace(GT_REGEX, '&gt;');
  1128. }
  1129. function isWithinWhitespaceSensitive(node) {
  1130. while (node != null) {
  1131. if (WHITESPACE_SENSITIVE.has(node.nodeName)) {
  1132. return true;
  1133. }
  1134. node = node.parentNode;
  1135. }
  1136. return false;
  1137. }
  1138. /*@__PURE__*/ const NON_ESCAPABLE_CONTENT = new Set([
  1139. 'STYLE',
  1140. 'SCRIPT',
  1141. 'IFRAME',
  1142. 'NOSCRIPT',
  1143. 'XMP',
  1144. 'NOEMBED',
  1145. 'NOFRAMES',
  1146. 'PLAINTEXT',
  1147. ]);
  1148. /*@__PURE__*/ const WHITESPACE_SENSITIVE = new Set([
  1149. 'CODE',
  1150. 'OUTPUT',
  1151. 'PLAINTEXT',
  1152. 'PRE',
  1153. 'SCRIPT',
  1154. 'TEMPLATE',
  1155. 'TEXTAREA',
  1156. ]);
  1157. /*@__PURE__*/ const EMPTY_ELEMENTS = new Set([
  1158. 'area',
  1159. 'base',
  1160. 'basefont',
  1161. 'bgsound',
  1162. 'br',
  1163. 'col',
  1164. 'embed',
  1165. 'frame',
  1166. 'hr',
  1167. 'img',
  1168. 'input',
  1169. 'keygen',
  1170. 'link',
  1171. 'meta',
  1172. 'param',
  1173. 'source',
  1174. 'trace',
  1175. 'wbr',
  1176. ]);
  1177. /*@__PURE__*/ const REMOVE_EMPTY_ATTR = new Set(['class', 'dir', 'id', 'lang', 'name', 'title']);
  1178. /*@__PURE__*/ const BOOLEAN_ATTR = new Set([
  1179. 'allowfullscreen',
  1180. 'async',
  1181. 'autofocus',
  1182. 'autoplay',
  1183. 'checked',
  1184. 'compact',
  1185. 'controls',
  1186. 'declare',
  1187. 'default',
  1188. 'defaultchecked',
  1189. 'defaultmuted',
  1190. 'defaultselected',
  1191. 'defer',
  1192. 'disabled',
  1193. 'enabled',
  1194. 'formnovalidate',
  1195. 'hidden',
  1196. 'indeterminate',
  1197. 'inert',
  1198. 'ismap',
  1199. 'itemscope',
  1200. 'loop',
  1201. 'multiple',
  1202. 'muted',
  1203. 'nohref',
  1204. 'nomodule',
  1205. 'noresize',
  1206. 'noshade',
  1207. 'novalidate',
  1208. 'nowrap',
  1209. 'open',
  1210. 'pauseonexit',
  1211. 'readonly',
  1212. 'required',
  1213. 'reversed',
  1214. 'scoped',
  1215. 'seamless',
  1216. 'selected',
  1217. 'sortable',
  1218. 'truespeed',
  1219. 'typemustmatch',
  1220. 'visible',
  1221. ]);
  1222. /*@__PURE__*/ const STRUCTURE_ELEMENTS = new Set([
  1223. 'html',
  1224. 'body',
  1225. 'head',
  1226. 'iframe',
  1227. 'meta',
  1228. 'link',
  1229. 'base',
  1230. 'title',
  1231. 'script',
  1232. 'style',
  1233. ]);
  1234. // Parse5 6.0.1
  1235. const e=function(e){const t=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];var n="�",s={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},r=function(e){return e>=55296&&e<=57343},i=function(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159},o=function(e){return e>=64976&&e<=65007||t.indexOf(e)>-1},a="unexpected-null-character",T="invalid-first-character-of-tag-name",E="missing-semicolon-after-character-reference",h="eof-before-tag-name",c="eof-in-tag",_="missing-whitespace-after-doctype-public-keyword",l="missing-whitespace-between-doctype-public-and-system-identifiers",m="missing-whitespace-after-doctype-system-keyword",p="missing-quote-before-doctype-public-identifier",A="missing-quote-before-doctype-system-identifier",u="missing-doctype-public-identifier",N="missing-doctype-system-identifier",d="abrupt-doctype-public-identifier",C="abrupt-doctype-system-identifier",O="eof-in-script-html-comment-like-text",f="eof-in-doctype",S="abrupt-closing-of-empty-comment",R="eof-in-comment",I="absence-of-digits-in-numeric-character-reference",L="end-tag-without-matching-open-element",k="misplaced-start-tag-for-head-element";const M=s;var g=new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4e3,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,1e4,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13e3,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]);const P=s,H={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},D={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},F="DATA_STATE",U="RCDATA_STATE",G="RAWTEXT_STATE",B="SCRIPT_DATA_STATE",K="PLAINTEXT_STATE",b="TAG_OPEN_STATE",x="END_TAG_OPEN_STATE",y="TAG_NAME_STATE",v="RCDATA_LESS_THAN_SIGN_STATE",Y="RCDATA_END_TAG_OPEN_STATE",w="RCDATA_END_TAG_NAME_STATE",Q="RAWTEXT_LESS_THAN_SIGN_STATE",X="RAWTEXT_END_TAG_OPEN_STATE",W="RAWTEXT_END_TAG_NAME_STATE",V="SCRIPT_DATA_LESS_THAN_SIGN_STATE",j="SCRIPT_DATA_END_TAG_OPEN_STATE",z="SCRIPT_DATA_END_TAG_NAME_STATE",q="SCRIPT_DATA_ESCAPE_START_STATE",J="SCRIPT_DATA_ESCAPE_START_DASH_STATE",Z="SCRIPT_DATA_ESCAPED_STATE",$="SCRIPT_DATA_ESCAPED_DASH_STATE",ee="SCRIPT_DATA_ESCAPED_DASH_DASH_STATE",te="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE",ne="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE",se="SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE",re="SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE",ie="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",oe="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",ae="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",Te="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",Ee="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",he="BEFORE_ATTRIBUTE_NAME_STATE",ce="ATTRIBUTE_NAME_STATE",_e="AFTER_ATTRIBUTE_NAME_STATE",le="BEFORE_ATTRIBUTE_VALUE_STATE",me="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",pe="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",Ae="ATTRIBUTE_VALUE_UNQUOTED_STATE",ue="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE",Ne="SELF_CLOSING_START_TAG_STATE",de="BOGUS_COMMENT_STATE",Ce="MARKUP_DECLARATION_OPEN_STATE",Oe="COMMENT_START_STATE",fe="COMMENT_START_DASH_STATE",Se="COMMENT_STATE",Re="COMMENT_LESS_THAN_SIGN_STATE",Ie="COMMENT_LESS_THAN_SIGN_BANG_STATE",Le="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE",ke="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE",Me="COMMENT_END_DASH_STATE",ge="COMMENT_END_STATE",Pe="COMMENT_END_BANG_STATE",He="DOCTYPE_STATE",De="BEFORE_DOCTYPE_NAME_STATE",Fe="DOCTYPE_NAME_STATE",Ue="AFTER_DOCTYPE_NAME_STATE",Ge="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE",Be="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE",Ke="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE",be="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE",xe="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE",ye="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE",ve="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE",Ye="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE",we="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE",Qe="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE",Xe="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE",We="BOGUS_DOCTYPE_STATE",Ve="CDATA_SECTION_STATE",je="CDATA_SECTION_BRACKET_STATE",ze="CDATA_SECTION_END_STATE",qe="CHARACTER_REFERENCE_STATE",Je="NAMED_CHARACTER_REFERENCE_STATE",Ze="AMBIGUOS_AMPERSAND_STATE",$e="NUMERIC_CHARACTER_REFERENCE_STATE",et="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE",tt="DECIMAL_CHARACTER_REFERENCE_START_STATE",nt="HEXADEMICAL_CHARACTER_REFERENCE_STATE",st="DECIMAL_CHARACTER_REFERENCE_STATE",rt="NUMERIC_CHARACTER_REFERENCE_END_STATE";function it(e){return e===P.SPACE||e===P.LINE_FEED||e===P.TABULATION||e===P.FORM_FEED}function ot(e){return e>=P.DIGIT_0&&e<=P.DIGIT_9}function at(e){return e>=P.LATIN_CAPITAL_A&&e<=P.LATIN_CAPITAL_Z}function Tt(e){return e>=P.LATIN_SMALL_A&&e<=P.LATIN_SMALL_Z}function Et(e){return Tt(e)||at(e)}function ht(e){return Et(e)||ot(e)}function ct(e){return e>=P.LATIN_CAPITAL_A&&e<=P.LATIN_CAPITAL_F}function _t(e){return e>=P.LATIN_SMALL_A&&e<=P.LATIN_SMALL_F}function lt(e){return e+32}function mt(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(e>>>10&1023|55296)+String.fromCharCode(56320|1023&e))}function pt(e){return String.fromCharCode(lt(e))}function At(e,t){const n=g[++e];let s=++e,r=s+n-1;for(;s<=r;){const e=s+r>>>1,i=g[e];if(i<t)s=e+1;else {if(!(i>t))return g[e+n];r=e-1;}}return -1}class ut{constructor(){this.preprocessor=new class{constructor(){this.html=null,this.pos=-1,this.lastGapPos=-1,this.lastCharPos=-1,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536;}_err(){}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos;}_processSurrogate(e){if(this.pos!==this.lastCharPos){const t=this.html.charCodeAt(this.pos+1);if(function(e){return e>=56320&&e<=57343}(t))return this.pos++,this._addGap(),1024*(e-55296)+9216+t}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,M.EOF;return this._err("surrogate-in-input-stream"),e}dropParsedChunk(){this.pos>this.bufferWaterline&&(this.lastCharPos-=this.pos,this.html=this.html.substring(this.pos),this.pos=0,this.lastGapPos=-1,this.gapStack=[]);}write(e,t){this.html?this.html+=e:this.html=e,this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1,this.lastChunkWritten=t;}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1,this.html.length),this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1;}advance(){if(this.pos++,this.pos>this.lastCharPos)return this.endOfChunkHit=!this.lastChunkWritten,M.EOF;let e=this.html.charCodeAt(this.pos);return this.skipNextNewLine&&e===M.LINE_FEED?(this.skipNextNewLine=!1,this._addGap(),this.advance()):e===M.CARRIAGE_RETURN?(this.skipNextNewLine=!0,M.LINE_FEED):(this.skipNextNewLine=!1,r(e)&&(e=this._processSurrogate(e)),e>31&&e<127||e===M.LINE_FEED||e===M.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){i(e)?this._err("control-character-in-input-stream"):o(e)&&this._err("noncharacter-in-input-stream");}retreat(){this.pos===this.lastGapPos&&(this.lastGapPos=this.gapStack.pop(),this.pos--),this.pos--;}},this.tokenQueue=[],this.allowCDATA=!1,this.state=F,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null;}_err(){}_errOnNextCodePoint(e){this._consume(),this._err(e),this._unconsume();}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this[this.state](e);}return this.tokenQueue.shift()}write(e,t){this.active=!0,this.preprocessor.write(e,t);}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e);}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:ut.HIBERNATION_TOKEN}),!0}return !1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat();}_reconsumeInState(e){this.state=e,this._unconsume();}_consumeSequenceIfMatch(e,t,n){let s=0,r=!0;const i=e.length;let o,a=0,T=t;for(;a<i;a++){if(a>0&&(T=this._consume(),s++),T===P.EOF){r=!1;break}if(o=e[a],T!==o&&(n||T!==lt(o))){r=!1;break}}if(!r)for(;s--;)this._unconsume();return r}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==H.SCRIPT_STRING.length)return !1;for(let e=0;e<this.tempBuff.length;e++)if(this.tempBuff[e]!==H.SCRIPT_STRING[e])return !1;return !0}_createStartTagToken(){this.currentToken={type:ut.START_TAG_TOKEN,tagName:"",selfClosing:!1,ackSelfClosing:!1,attrs:[]};}_createEndTagToken(){this.currentToken={type:ut.END_TAG_TOKEN,tagName:"",selfClosing:!1,attrs:[]};}_createCommentToken(){this.currentToken={type:ut.COMMENT_TOKEN,data:""};}_createDoctypeToken(e){this.currentToken={type:ut.DOCTYPE_TOKEN,name:e,forceQuirks:!1,publicId:null,systemId:null};}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t};}_createEOFToken(){this.currentToken={type:ut.EOF_TOKEN};}_createAttr(e){this.currentAttr={name:e,value:""};}_leaveAttrName(e){null===ut.getTokenAttr(this.currentToken,this.currentAttr.name)?this.currentToken.attrs.push(this.currentAttr):this._err("duplicate-attribute"),this.state=e;}_leaveAttrValue(e){this.state=e;}_emitCurrentToken(){this._emitCurrentCharacterToken();const e=this.currentToken;this.currentToken=null,e.type===ut.START_TAG_TOKEN?this.lastStartTagName=e.tagName:e.type===ut.END_TAG_TOKEN&&(e.attrs.length>0&&this._err("end-tag-with-attributes"),e.selfClosing&&this._err("end-tag-with-trailing-solidus")),this.tokenQueue.push(e);}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null);}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken();}_appendCharToCurrentCharacterToken(e,t){this.currentCharacterToken&&this.currentCharacterToken.type!==e&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=t:this._createCharacterToken(e,t);}_emitCodePoint(e){let t=ut.CHARACTER_TOKEN;it(e)?t=ut.WHITESPACE_CHARACTER_TOKEN:e===P.NULL&&(t=ut.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(t,mt(e));}_emitSeveralCodePoints(e){for(let t=0;t<e.length;t++)this._emitCodePoint(e[t]);}_emitChars(e){this._appendCharToCurrentCharacterToken(ut.CHARACTER_TOKEN,e);}_matchNamedCharacterReference(e){let t=null,n=1,s=At(0,e);for(this.tempBuff.push(e);s>-1;){const e=g[s],r=e<7;r&&1&e&&(t=2&e?[g[++s],g[++s]]:[g[++s]],n=0);const i=this._consume();if(this.tempBuff.push(i),n++,i===P.EOF)break;s=r?4&e?At(s,i):-1:i===e?++s:-1;}for(;n--;)this.tempBuff.pop(),this._unconsume();return t}_isCharacterReferenceInAttribute(){return this.returnState===me||this.returnState===pe||this.returnState===Ae}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){const e=this._consume();return this._unconsume(),e===P.EQUALS_SIGN||ht(e)}return !1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let e=0;e<this.tempBuff.length;e++)this.currentAttr.value+=mt(this.tempBuff[e]);else this._emitSeveralCodePoints(this.tempBuff);this.tempBuff=[];}[F](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=b:e===P.AMPERSAND?(this.returnState=F,this.state=qe):e===P.NULL?(this._err(a),this._emitCodePoint(e)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[U](e){this.preprocessor.dropParsedChunk(),e===P.AMPERSAND?(this.returnState=U,this.state=qe):e===P.LESS_THAN_SIGN?this.state=v:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[G](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=Q:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[B](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=V:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[K](e){this.preprocessor.dropParsedChunk(),e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[b](e){e===P.EXCLAMATION_MARK?this.state=Ce:e===P.SOLIDUS?this.state=x:Et(e)?(this._createStartTagToken(),this._reconsumeInState(y)):e===P.QUESTION_MARK?(this._err("unexpected-question-mark-instead-of-tag-name"),this._createCommentToken(),this._reconsumeInState(de)):e===P.EOF?(this._err(h),this._emitChars("<"),this._emitEOFToken()):(this._err(T),this._emitChars("<"),this._reconsumeInState(F));}[x](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(y)):e===P.GREATER_THAN_SIGN?(this._err("missing-end-tag-name"),this.state=F):e===P.EOF?(this._err(h),this._emitChars("</"),this._emitEOFToken()):(this._err(T),this._createCommentToken(),this._reconsumeInState(de));}[y](e){it(e)?this.state=he:e===P.SOLIDUS?this.state=Ne:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):at(e)?this.currentToken.tagName+=pt(e):e===P.NULL?(this._err(a),this.currentToken.tagName+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentToken.tagName+=mt(e);}[v](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=Y):(this._emitChars("<"),this._reconsumeInState(U));}[Y](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(w)):(this._emitChars("</"),this._reconsumeInState(U));}[w](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this.state=F,void this._emitCurrentToken()}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(U);}}[Q](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=X):(this._emitChars("<"),this._reconsumeInState(G));}[X](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(W)):(this._emitChars("</"),this._reconsumeInState(G));}[W](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(G);}}[V](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=j):e===P.EXCLAMATION_MARK?(this.state=q,this._emitChars("<!")):(this._emitChars("<"),this._reconsumeInState(B));}[j](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(z)):(this._emitChars("</"),this._reconsumeInState(B));}[z](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(B);}}[q](e){e===P.HYPHEN_MINUS?(this.state=J,this._emitChars("-")):this._reconsumeInState(B);}[J](e){e===P.HYPHEN_MINUS?(this.state=ee,this._emitChars("-")):this._reconsumeInState(B);}[Z](e){e===P.HYPHEN_MINUS?(this.state=$,this._emitChars("-")):e===P.LESS_THAN_SIGN?this.state=te:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):this._emitCodePoint(e);}[$](e){e===P.HYPHEN_MINUS?(this.state=ee,this._emitChars("-")):e===P.LESS_THAN_SIGN?this.state=te:e===P.NULL?(this._err(a),this.state=Z,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=Z,this._emitCodePoint(e));}[ee](e){e===P.HYPHEN_MINUS?this._emitChars("-"):e===P.LESS_THAN_SIGN?this.state=te:e===P.GREATER_THAN_SIGN?(this.state=B,this._emitChars(">")):e===P.NULL?(this._err(a),this.state=Z,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=Z,this._emitCodePoint(e));}[te](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=ne):Et(e)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState(re)):(this._emitChars("<"),this._reconsumeInState(Z));}[ne](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(se)):(this._emitChars("</"),this._reconsumeInState(Z));}[se](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(Z);}}[re](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?ie:Z,this._emitCodePoint(e)):at(e)?(this.tempBuff.push(lt(e)),this._emitCodePoint(e)):Tt(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(Z);}[ie](e){e===P.HYPHEN_MINUS?(this.state=oe,this._emitChars("-")):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):this._emitCodePoint(e);}[oe](e){e===P.HYPHEN_MINUS?(this.state=ae,this._emitChars("-")):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.NULL?(this._err(a),this.state=ie,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=ie,this._emitCodePoint(e));}[ae](e){e===P.HYPHEN_MINUS?this._emitChars("-"):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.GREATER_THAN_SIGN?(this.state=B,this._emitChars(">")):e===P.NULL?(this._err(a),this.state=ie,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=ie,this._emitCodePoint(e));}[Te](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=Ee,this._emitChars("/")):this._reconsumeInState(ie);}[Ee](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?Z:ie,this._emitCodePoint(e)):at(e)?(this.tempBuff.push(lt(e)),this._emitCodePoint(e)):Tt(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(ie);}[he](e){it(e)||(e===P.SOLIDUS||e===P.GREATER_THAN_SIGN||e===P.EOF?this._reconsumeInState(_e):e===P.EQUALS_SIGN?(this._err("unexpected-equals-sign-before-attribute-name"),this._createAttr("="),this.state=ce):(this._createAttr(""),this._reconsumeInState(ce)));}[ce](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN||e===P.EOF?(this._leaveAttrName(_e),this._unconsume()):e===P.EQUALS_SIGN?this._leaveAttrName(le):at(e)?this.currentAttr.name+=pt(e):e===P.QUOTATION_MARK||e===P.APOSTROPHE||e===P.LESS_THAN_SIGN?(this._err("unexpected-character-in-attribute-name"),this.currentAttr.name+=mt(e)):e===P.NULL?(this._err(a),this.currentAttr.name+=n):this.currentAttr.name+=mt(e);}[_e](e){it(e)||(e===P.SOLIDUS?this.state=Ne:e===P.EQUALS_SIGN?this.state=le:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState(ce)));}[le](e){it(e)||(e===P.QUOTATION_MARK?this.state=me:e===P.APOSTROPHE?this.state=pe:e===P.GREATER_THAN_SIGN?(this._err("missing-attribute-value"),this.state=F,this._emitCurrentToken()):this._reconsumeInState(Ae));}[me](e){e===P.QUOTATION_MARK?this.state=ue:e===P.AMPERSAND?(this.returnState=me,this.state=qe):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[pe](e){e===P.APOSTROPHE?this.state=ue:e===P.AMPERSAND?(this.returnState=pe,this.state=qe):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[Ae](e){it(e)?this._leaveAttrValue(he):e===P.AMPERSAND?(this.returnState=Ae,this.state=qe):e===P.GREATER_THAN_SIGN?(this._leaveAttrValue(F),this._emitCurrentToken()):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.QUOTATION_MARK||e===P.APOSTROPHE||e===P.LESS_THAN_SIGN||e===P.EQUALS_SIGN||e===P.GRAVE_ACCENT?(this._err("unexpected-character-in-unquoted-attribute-value"),this.currentAttr.value+=mt(e)):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[ue](e){it(e)?this._leaveAttrValue(he):e===P.SOLIDUS?this._leaveAttrValue(Ne):e===P.GREATER_THAN_SIGN?(this._leaveAttrValue(F),this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._err("missing-whitespace-between-attributes"),this._reconsumeInState(he));}[Ne](e){e===P.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._err("unexpected-solidus-in-tag"),this._reconsumeInState(he));}[de](e){e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._emitCurrentToken(),this._emitEOFToken()):e===P.NULL?(this._err(a),this.currentToken.data+=n):this.currentToken.data+=mt(e);}[Ce](e){this._consumeSequenceIfMatch(H.DASH_DASH_STRING,e,!0)?(this._createCommentToken(),this.state=Oe):this._consumeSequenceIfMatch(H.DOCTYPE_STRING,e,!1)?this.state=He:this._consumeSequenceIfMatch(H.CDATA_START_STRING,e,!0)?this.allowCDATA?this.state=Ve:(this._err("cdata-in-html-content"),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state=de):this._ensureHibernation()||(this._err("incorrectly-opened-comment"),this._createCommentToken(),this._reconsumeInState(de));}[Oe](e){e===P.HYPHEN_MINUS?this.state=fe:e===P.GREATER_THAN_SIGN?(this._err(S),this.state=F,this._emitCurrentToken()):this._reconsumeInState(Se);}[fe](e){e===P.HYPHEN_MINUS?this.state=ge:e===P.GREATER_THAN_SIGN?(this._err(S),this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Se));}[Se](e){e===P.HYPHEN_MINUS?this.state=Me:e===P.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state=Re):e===P.NULL?(this._err(a),this.currentToken.data+=n):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=mt(e);}[Re](e){e===P.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state=Ie):e===P.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState(Se);}[Ie](e){e===P.HYPHEN_MINUS?this.state=Le:this._reconsumeInState(Se);}[Le](e){e===P.HYPHEN_MINUS?this.state=ke:this._reconsumeInState(Me);}[ke](e){e!==P.GREATER_THAN_SIGN&&e!==P.EOF&&this._err("nested-comment"),this._reconsumeInState(ge);}[Me](e){e===P.HYPHEN_MINUS?this.state=ge:e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Se));}[ge](e){e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EXCLAMATION_MARK?this.state=Pe:e===P.HYPHEN_MINUS?this.currentToken.data+="-":e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState(Se));}[Pe](e){e===P.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state=Me):e===P.GREATER_THAN_SIGN?(this._err("incorrectly-closed-comment"),this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState(Se));}[He](e){it(e)?this.state=De:e===P.GREATER_THAN_SIGN?this._reconsumeInState(De):e===P.EOF?(this._err(f),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err("missing-whitespace-before-doctype-name"),this._reconsumeInState(De));}[De](e){it(e)||(at(e)?(this._createDoctypeToken(pt(e)),this.state=Fe):e===P.NULL?(this._err(a),this._createDoctypeToken(n),this.state=Fe):e===P.GREATER_THAN_SIGN?(this._err("missing-doctype-name"),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(mt(e)),this.state=Fe));}[Fe](e){it(e)?this.state=Ue:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):at(e)?this.currentToken.name+=pt(e):e===P.NULL?(this._err(a),this.currentToken.name+=n):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=mt(e);}[Ue](e){it(e)||(e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(H.PUBLIC_STRING,e,!1)?this.state=Ge:this._consumeSequenceIfMatch(H.SYSTEM_STRING,e,!1)?this.state=ve:this._ensureHibernation()||(this._err("invalid-character-sequence-after-doctype-name"),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[Ge](e){it(e)?this.state=Be:e===P.QUOTATION_MARK?(this._err(_),this.currentToken.publicId="",this.state=Ke):e===P.APOSTROPHE?(this._err(_),this.currentToken.publicId="",this.state=be):e===P.GREATER_THAN_SIGN?(this._err(u),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(p),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[Be](e){it(e)||(e===P.QUOTATION_MARK?(this.currentToken.publicId="",this.state=Ke):e===P.APOSTROPHE?(this.currentToken.publicId="",this.state=be):e===P.GREATER_THAN_SIGN?(this._err(u),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(p),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[Ke](e){e===P.QUOTATION_MARK?this.state=xe:e===P.NULL?(this._err(a),this.currentToken.publicId+=n):e===P.GREATER_THAN_SIGN?(this._err(d),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=mt(e);}[be](e){e===P.APOSTROPHE?this.state=xe:e===P.NULL?(this._err(a),this.currentToken.publicId+=n):e===P.GREATER_THAN_SIGN?(this._err(d),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=mt(e);}[xe](e){it(e)?this.state=ye:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.QUOTATION_MARK?(this._err(l),this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this._err(l),this.currentToken.systemId="",this.state=Qe):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[ye](e){it(e)||(e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.QUOTATION_MARK?(this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this.currentToken.systemId="",this.state=Qe):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[ve](e){it(e)?this.state=Ye:e===P.QUOTATION_MARK?(this._err(m),this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this._err(m),this.currentToken.systemId="",this.state=Qe):e===P.GREATER_THAN_SIGN?(this._err(N),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[Ye](e){it(e)||(e===P.QUOTATION_MARK?(this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this.currentToken.systemId="",this.state=Qe):e===P.GREATER_THAN_SIGN?(this._err(N),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[we](e){e===P.QUOTATION_MARK?this.state=Xe:e===P.NULL?(this._err(a),this.currentToken.systemId+=n):e===P.GREATER_THAN_SIGN?(this._err(C),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=mt(e);}[Qe](e){e===P.APOSTROPHE?this.state=Xe:e===P.NULL?(this._err(a),this.currentToken.systemId+=n):e===P.GREATER_THAN_SIGN?(this._err(C),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=mt(e);}[Xe](e){it(e)||(e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err("unexpected-character-after-doctype-system-identifier"),this._reconsumeInState(We)));}[We](e){e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.NULL?this._err(a):e===P.EOF&&(this._emitCurrentToken(),this._emitEOFToken());}[Ve](e){e===P.RIGHT_SQUARE_BRACKET?this.state=je:e===P.EOF?(this._err("eof-in-cdata"),this._emitEOFToken()):this._emitCodePoint(e);}[je](e){e===P.RIGHT_SQUARE_BRACKET?this.state=ze:(this._emitChars("]"),this._reconsumeInState(Ve));}[ze](e){e===P.GREATER_THAN_SIGN?this.state=F:e===P.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState(Ve));}[qe](e){this.tempBuff=[P.AMPERSAND],e===P.NUMBER_SIGN?(this.tempBuff.push(e),this.state=$e):ht(e)?this._reconsumeInState(Je):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState));}[Je](e){const t=this._matchNamedCharacterReference(e);if(this._ensureHibernation())this.tempBuff=[P.AMPERSAND];else if(t){const e=this.tempBuff[this.tempBuff.length-1]===P.SEMICOLON;this._isCharacterReferenceAttributeQuirk(e)||(e||this._errOnNextCodePoint(E),this.tempBuff=t),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState;}else this._flushCodePointsConsumedAsCharacterReference(),this.state=Ze;}[Ze](e){ht(e)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=mt(e):this._emitCodePoint(e):(e===P.SEMICOLON&&this._err("unknown-named-character-reference"),this._reconsumeInState(this.returnState));}[$e](e){this.charRefCode=0,e===P.LATIN_SMALL_X||e===P.LATIN_CAPITAL_X?(this.tempBuff.push(e),this.state=et):this._reconsumeInState(tt);}[et](e){!function(e){return ot(e)||ct(e)||_t(e)}(e)?(this._err(I),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState(nt);}[tt](e){ot(e)?this._reconsumeInState(st):(this._err(I),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState));}[nt](e){ct(e)?this.charRefCode=16*this.charRefCode+e-55:_t(e)?this.charRefCode=16*this.charRefCode+e-87:ot(e)?this.charRefCode=16*this.charRefCode+e-48:e===P.SEMICOLON?this.state=rt:(this._err(E),this._reconsumeInState(rt));}[st](e){ot(e)?this.charRefCode=10*this.charRefCode+e-48:e===P.SEMICOLON?this.state=rt:(this._err(E),this._reconsumeInState(rt));}[rt](){if(this.charRefCode===P.NULL)this._err("null-character-reference"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err("character-reference-outside-unicode-range"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(r(this.charRefCode))this._err("surrogate-character-reference"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(o(this.charRefCode))this._err("noncharacter-character-reference");else if(i(this.charRefCode)||this.charRefCode===P.CARRIAGE_RETURN){this._err("control-character-reference");const e=D[this.charRefCode];e&&(this.charRefCode=e);}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState);}}ut.CHARACTER_TOKEN="CHARACTER_TOKEN",ut.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",ut.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",ut.START_TAG_TOKEN="START_TAG_TOKEN",ut.END_TAG_TOKEN="END_TAG_TOKEN",ut.COMMENT_TOKEN="COMMENT_TOKEN",ut.DOCTYPE_TOKEN="DOCTYPE_TOKEN",ut.EOF_TOKEN="EOF_TOKEN",ut.HIBERNATION_TOKEN="HIBERNATION_TOKEN",ut.MODE={DATA:F,RCDATA:U,RAWTEXT:G,SCRIPT_DATA:B,PLAINTEXT:K},ut.getTokenAttr=function(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null};var Nt=ut;function dt(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var Ct=dt((function(e,t){const n=t.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};t.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},t.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const s=t.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};t.SPECIAL_ELEMENTS={[n.HTML]:{[s.ADDRESS]:!0,[s.APPLET]:!0,[s.AREA]:!0,[s.ARTICLE]:!0,[s.ASIDE]:!0,[s.BASE]:!0,[s.BASEFONT]:!0,[s.BGSOUND]:!0,[s.BLOCKQUOTE]:!0,[s.BODY]:!0,[s.BR]:!0,[s.BUTTON]:!0,[s.CAPTION]:!0,[s.CENTER]:!0,[s.COL]:!0,[s.COLGROUP]:!0,[s.DD]:!0,[s.DETAILS]:!0,[s.DIR]:!0,[s.DIV]:!0,[s.DL]:!0,[s.DT]:!0,[s.EMBED]:!0,[s.FIELDSET]:!0,[s.FIGCAPTION]:!0,[s.FIGURE]:!0,[s.FOOTER]:!0,[s.FORM]:!0,[s.FRAME]:!0,[s.FRAMESET]:!0,[s.H1]:!0,[s.H2]:!0,[s.H3]:!0,[s.H4]:!0,[s.H5]:!0,[s.H6]:!0,[s.HEAD]:!0,[s.HEADER]:!0,[s.HGROUP]:!0,[s.HR]:!0,[s.HTML]:!0,[s.IFRAME]:!0,[s.IMG]:!0,[s.INPUT]:!0,[s.LI]:!0,[s.LINK]:!0,[s.LISTING]:!0,[s.MAIN]:!0,[s.MARQUEE]:!0,[s.MENU]:!0,[s.META]:!0,[s.NAV]:!0,[s.NOEMBED]:!0,[s.NOFRAMES]:!0,[s.NOSCRIPT]:!0,[s.OBJECT]:!0,[s.OL]:!0,[s.P]:!0,[s.PARAM]:!0,[s.PLAINTEXT]:!0,[s.PRE]:!0,[s.SCRIPT]:!0,[s.SECTION]:!0,[s.SELECT]:!0,[s.SOURCE]:!0,[s.STYLE]:!0,[s.SUMMARY]:!0,[s.TABLE]:!0,[s.TBODY]:!0,[s.TD]:!0,[s.TEMPLATE]:!0,[s.TEXTAREA]:!0,[s.TFOOT]:!0,[s.TH]:!0,[s.THEAD]:!0,[s.TITLE]:!0,[s.TR]:!0,[s.TRACK]:!0,[s.UL]:!0,[s.WBR]:!0,[s.XMP]:!0},[n.MATHML]:{[s.MI]:!0,[s.MO]:!0,[s.MN]:!0,[s.MS]:!0,[s.MTEXT]:!0,[s.ANNOTATION_XML]:!0},[n.SVG]:{[s.TITLE]:!0,[s.FOREIGN_OBJECT]:!0,[s.DESC]:!0}};}));const Ot=Ct.TAG_NAMES,ft=Ct.NAMESPACES;function St(e){switch(e.length){case 1:return e===Ot.P;case 2:return e===Ot.RB||e===Ot.RP||e===Ot.RT||e===Ot.DD||e===Ot.DT||e===Ot.LI;case 3:return e===Ot.RTC;case 6:return e===Ot.OPTION;case 8:return e===Ot.OPTGROUP}return !1}function Rt(e){switch(e.length){case 1:return e===Ot.P;case 2:return e===Ot.RB||e===Ot.RP||e===Ot.RT||e===Ot.DD||e===Ot.DT||e===Ot.LI||e===Ot.TD||e===Ot.TH||e===Ot.TR;case 3:return e===Ot.RTC;case 5:return e===Ot.TBODY||e===Ot.TFOOT||e===Ot.THEAD;case 6:return e===Ot.OPTION;case 7:return e===Ot.CAPTION;case 8:return e===Ot.OPTGROUP||e===Ot.COLGROUP}return !1}function It(e,t){switch(e.length){case 2:if(e===Ot.TD||e===Ot.TH)return t===ft.HTML;if(e===Ot.MI||e===Ot.MO||e===Ot.MN||e===Ot.MS)return t===ft.MATHML;break;case 4:if(e===Ot.HTML)return t===ft.HTML;if(e===Ot.DESC)return t===ft.SVG;break;case 5:if(e===Ot.TABLE)return t===ft.HTML;if(e===Ot.MTEXT)return t===ft.MATHML;if(e===Ot.TITLE)return t===ft.SVG;break;case 6:return (e===Ot.APPLET||e===Ot.OBJECT)&&t===ft.HTML;case 7:return (e===Ot.CAPTION||e===Ot.MARQUEE)&&t===ft.HTML;case 8:return e===Ot.TEMPLATE&&t===ft.HTML;case 13:return e===Ot.FOREIGN_OBJECT&&t===ft.SVG;case 14:return e===Ot.ANNOTATION_XML&&t===ft.MATHML}return !1}class Lt{constructor(e){this.length=0,this.entries=[],this.treeAdapter=e,this.bookmark=null;}_getNoahArkConditionCandidates(e){const t=[];if(this.length>=3){const n=this.treeAdapter.getAttrList(e).length,s=this.treeAdapter.getTagName(e),r=this.treeAdapter.getNamespaceURI(e);for(let e=this.length-1;e>=0;e--){const i=this.entries[e];if(i.type===Lt.MARKER_ENTRY)break;const o=i.element,a=this.treeAdapter.getAttrList(o);this.treeAdapter.getTagName(o)===s&&this.treeAdapter.getNamespaceURI(o)===r&&a.length===n&&t.push({idx:e,attrs:a});}}return t.length<3?[]:t}_ensureNoahArkCondition(e){const t=this._getNoahArkConditionCandidates(e);let n=t.length;if(n){const s=this.treeAdapter.getAttrList(e),r=s.length,i=Object.create(null);for(let e=0;e<r;e++){const t=s[e];i[t.name]=t.value;}for(let e=0;e<r;e++)for(let s=0;s<n;s++){const r=t[s].attrs[e];if(i[r.name]!==r.value&&(t.splice(s,1),n--),t.length<3)return}for(let e=n-1;e>=2;e--)this.entries.splice(t[e].idx,1),this.length--;}}insertMarker(){this.entries.push({type:Lt.MARKER_ENTRY}),this.length++;}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.push({type:Lt.ELEMENT_ENTRY,element:e,token:t}),this.length++;}insertElementAfterBookmark(e,t){let n=this.length-1;for(;n>=0&&this.entries[n]!==this.bookmark;n--);this.entries.splice(n+1,0,{type:Lt.ELEMENT_ENTRY,element:e,token:t}),this.length++;}removeEntry(e){for(let t=this.length-1;t>=0;t--)if(this.entries[t]===e){this.entries.splice(t,1),this.length--;break}}clearToLastMarker(){for(;this.length;){const e=this.entries.pop();if(this.length--,e.type===Lt.MARKER_ENTRY)break}}getElementEntryInScopeWithTagName(e){for(let t=this.length-1;t>=0;t--){const n=this.entries[t];if(n.type===Lt.MARKER_ENTRY)return null;if(this.treeAdapter.getTagName(n.element)===e)return n}return null}getElementEntry(e){for(let t=this.length-1;t>=0;t--){const n=this.entries[t];if(n.type===Lt.ELEMENT_ENTRY&&n.element===e)return n}return null}}Lt.MARKER_ENTRY="MARKER_ENTRY",Lt.ELEMENT_ENTRY="ELEMENT_ENTRY";var kt=Lt;class Mt{constructor(e){const t={},n=this._getOverriddenMethods(this,t);for(const s of Object.keys(n))"function"==typeof n[s]&&(t[s]=e[s],e[s]=n[s]);}_getOverriddenMethods(){throw new Error("Not implemented")}}Mt.install=function(e,t,n){e.__mixins||(e.__mixins=[]);for(let n=0;n<e.__mixins.length;n++)if(e.__mixins[n].constructor===t)return e.__mixins[n];const s=new t(e,n);return e.__mixins.push(s),s};var gt=Mt,Pt=class extends gt{constructor(e){super(e),this.preprocessor=e,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.offset=0,this.col=0,this.line=1;}_getOverriddenMethods(e,t){return {advance(){const n=this.pos+1,s=this.html[n];return e.isEol&&(e.isEol=!1,e.line++,e.lineStartPos=n),("\n"===s||"\r"===s&&"\n"!==this.html[n+1])&&(e.isEol=!0),e.col=n-e.lineStartPos+1,e.offset=e.droppedBufferSize+n,t.advance.call(this)},retreat(){t.retreat.call(this),e.isEol=!1,e.col=this.pos-e.lineStartPos+1;},dropParsedChunk(){const n=this.pos;t.dropParsedChunk.call(this);const s=n-this.pos;e.lineStartPos-=s,e.droppedBufferSize+=s,e.offset=e.droppedBufferSize+this.pos;}}}},Ht=class extends gt{constructor(e){super(e),this.tokenizer=e,this.posTracker=gt.install(e.preprocessor,Pt),this.currentAttrLocation=null,this.ctLoc=null;}_getCurrentLocation(){return {startLine:this.posTracker.line,startCol:this.posTracker.col,startOffset:this.posTracker.offset,endLine:-1,endCol:-1,endOffset:-1}}_attachCurrentAttrLocationInfo(){this.currentAttrLocation.endLine=this.posTracker.line,this.currentAttrLocation.endCol=this.posTracker.col,this.currentAttrLocation.endOffset=this.posTracker.offset;const e=this.tokenizer.currentToken,t=this.tokenizer.currentAttr;e.location.attrs||(e.location.attrs=Object.create(null)),e.location.attrs[t.name]=this.currentAttrLocation;}_getOverriddenMethods(e,t){const n={_createStartTagToken(){t._createStartTagToken.call(this),this.currentToken.location=e.ctLoc;},_createEndTagToken(){t._createEndTagToken.call(this),this.currentToken.location=e.ctLoc;},_createCommentToken(){t._createCommentToken.call(this),this.currentToken.location=e.ctLoc;},_createDoctypeToken(n){t._createDoctypeToken.call(this,n),this.currentToken.location=e.ctLoc;},_createCharacterToken(n,s){t._createCharacterToken.call(this,n,s),this.currentCharacterToken.location=e.ctLoc;},_createEOFToken(){t._createEOFToken.call(this),this.currentToken.location=e._getCurrentLocation();},_createAttr(n){t._createAttr.call(this,n),e.currentAttrLocation=e._getCurrentLocation();},_leaveAttrName(n){t._leaveAttrName.call(this,n),e._attachCurrentAttrLocationInfo();},_leaveAttrValue(n){t._leaveAttrValue.call(this,n),e._attachCurrentAttrLocationInfo();},_emitCurrentToken(){const n=this.currentToken.location;this.currentCharacterToken&&(this.currentCharacterToken.location.endLine=n.startLine,this.currentCharacterToken.location.endCol=n.startCol,this.currentCharacterToken.location.endOffset=n.startOffset),this.currentToken.type===Nt.EOF_TOKEN?(n.endLine=n.startLine,n.endCol=n.startCol,n.endOffset=n.startOffset):(n.endLine=e.posTracker.line,n.endCol=e.posTracker.col+1,n.endOffset=e.posTracker.offset+1),t._emitCurrentToken.call(this);},_emitCurrentCharacterToken(){const n=this.currentCharacterToken&&this.currentCharacterToken.location;n&&-1===n.endOffset&&(n.endLine=e.posTracker.line,n.endCol=e.posTracker.col,n.endOffset=e.posTracker.offset),t._emitCurrentCharacterToken.call(this);}};return Object.keys(Nt.MODE).forEach((s=>{const r=Nt.MODE[s];n[r]=function(n){e.ctLoc=e._getCurrentLocation(),t[r].call(this,n);};})),n}},Dt=class extends gt{constructor(e,t){super(e),this.onItemPop=t.onItemPop;}_getOverriddenMethods(e,t){return {pop(){e.onItemPop(this.current),t.pop.call(this);},popAllUpToHtmlElement(){for(let t=this.stackTop;t>0;t--)e.onItemPop(this.items[t]);t.popAllUpToHtmlElement.call(this);},remove(n){e.onItemPop(this.current),t.remove.call(this,n);}}}};const Ft=Ct.TAG_NAMES;var Ut=class extends gt{constructor(e){super(e),this.parser=e,this.treeAdapter=this.parser.treeAdapter,this.posTracker=null,this.lastStartTagToken=null,this.lastFosterParentingLocation=null,this.currentToken=null;}_setStartLocation(e){let t=null;this.lastStartTagToken&&(t=Object.assign({},this.lastStartTagToken.location),t.startTag=this.lastStartTagToken.location),this.treeAdapter.setNodeSourceCodeLocation(e,t);}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const n=t.location,s=this.treeAdapter.getTagName(e),r={};t.type===Nt.END_TAG_TOKEN&&s===t.tagName?(r.endTag=Object.assign({},n),r.endLine=n.endLine,r.endCol=n.endCol,r.endOffset=n.endOffset):(r.endLine=n.startLine,r.endCol=n.startCol,r.endOffset=n.startOffset),this.treeAdapter.updateNodeSourceCodeLocation(e,r);}}_getOverriddenMethods(e,t){return {_bootstrap(n,s){t._bootstrap.call(this,n,s),e.lastStartTagToken=null,e.lastFosterParentingLocation=null,e.currentToken=null;const r=gt.install(this.tokenizer,Ht);e.posTracker=r.posTracker,gt.install(this.openElements,Dt,{onItemPop:function(t){e._setEndLocation(t,e.currentToken);}});},_runParsingLoop(n){t._runParsingLoop.call(this,n);for(let t=this.openElements.stackTop;t>=0;t--)e._setEndLocation(this.openElements.items[t],e.currentToken);},_processTokenInForeignContent(n){e.currentToken=n,t._processTokenInForeignContent.call(this,n);},_processToken(n){if(e.currentToken=n,t._processToken.call(this,n),n.type===Nt.END_TAG_TOKEN&&(n.tagName===Ft.HTML||n.tagName===Ft.BODY&&this.openElements.hasInScope(Ft.BODY)))for(let t=this.openElements.stackTop;t>=0;t--){const s=this.openElements.items[t];if(this.treeAdapter.getTagName(s)===n.tagName){e._setEndLocation(s,n);break}}},_setDocumentType(e){t._setDocumentType.call(this,e);const n=this.treeAdapter.getChildNodes(this.document),s=n.length;for(let t=0;t<s;t++){const s=n[t];if(this.treeAdapter.isDocumentTypeNode(s)){this.treeAdapter.setNodeSourceCodeLocation(s,e.location);break}}},_attachElementToTree(n){e._setStartLocation(n),e.lastStartTagToken=null,t._attachElementToTree.call(this,n);},_appendElement(n,s){e.lastStartTagToken=n,t._appendElement.call(this,n,s);},_insertElement(n,s){e.lastStartTagToken=n,t._insertElement.call(this,n,s);},_insertTemplate(n){e.lastStartTagToken=n,t._insertTemplate.call(this,n);const s=this.treeAdapter.getTemplateContent(this.openElements.current);this.treeAdapter.setNodeSourceCodeLocation(s,null);},_insertFakeRootElement(){t._insertFakeRootElement.call(this),this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current,null);},_appendCommentNode(e,n){t._appendCommentNode.call(this,e,n);const s=this.treeAdapter.getChildNodes(n),r=s[s.length-1];this.treeAdapter.setNodeSourceCodeLocation(r,e.location);},_findFosterParentingLocation(){return e.lastFosterParentingLocation=t._findFosterParentingLocation.call(this),e.lastFosterParentingLocation},_insertCharacters(n){t._insertCharacters.call(this,n);const s=this._shouldFosterParentOnInsertion(),r=s&&e.lastFosterParentingLocation.parent||this.openElements.currentTmplContent||this.openElements.current,i=this.treeAdapter.getChildNodes(r),o=s&&e.lastFosterParentingLocation.beforeElement?i.indexOf(e.lastFosterParentingLocation.beforeElement)-1:i.length-1,a=i[o];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:e,endCol:t,endOffset:s}=n.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:e,endCol:t,endOffset:s});}else this.treeAdapter.setNodeSourceCodeLocation(a,n.location);}}}},Gt=class extends gt{constructor(e,t){super(e),this.posTracker=null,this.onParseError=t.onParseError;}_setErrorLocation(e){e.startLine=e.endLine=this.posTracker.line,e.startCol=e.endCol=this.posTracker.col,e.startOffset=e.endOffset=this.posTracker.offset;}_reportError(e){const t={code:e,startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1};this._setErrorLocation(t),this.onParseError(t);}_getOverriddenMethods(e){return {_err(t){e._reportError(t);}}}},Bt=class extends Gt{constructor(e,t){super(e,t),this.posTracker=gt.install(e,Pt),this.lastErrOffset=-1;}_reportError(e){this.lastErrOffset!==this.posTracker.offset&&(this.lastErrOffset=this.posTracker.offset,super._reportError(e));}},Kt=class extends Gt{constructor(e,t){super(e,t);const n=gt.install(e.preprocessor,Bt,t);this.posTracker=n.posTracker;}},bt=class extends Gt{constructor(e,t){super(e,t),this.opts=t,this.ctLoc=null,this.locBeforeToken=!1;}_setErrorLocation(e){this.ctLoc&&(e.startLine=this.ctLoc.startLine,e.startCol=this.ctLoc.startCol,e.startOffset=this.ctLoc.startOffset,e.endLine=this.locBeforeToken?this.ctLoc.startLine:this.ctLoc.endLine,e.endCol=this.locBeforeToken?this.ctLoc.startCol:this.ctLoc.endCol,e.endOffset=this.locBeforeToken?this.ctLoc.startOffset:this.ctLoc.endOffset);}_getOverriddenMethods(e,t){return {_bootstrap(n,s){t._bootstrap.call(this,n,s),gt.install(this.tokenizer,Kt,e.opts),gt.install(this.tokenizer,Ht);},_processInputToken(n){e.ctLoc=n.location,t._processInputToken.call(this,n);},_err(t,n){e.locBeforeToken=n&&n.beforeToken,e._reportError(t);}}}},xt=dt((function(e,t){const{DOCUMENT_MODE:n}=Ct;t.createDocument=function(){return {nodeName:"#document",mode:n.NO_QUIRKS,childNodes:[]}},t.createDocumentFragment=function(){return {nodeName:"#document-fragment",childNodes:[]}},t.createElement=function(e,t,n){return {nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},t.createCommentNode=function(e){return {nodeName:"#comment",data:e,parentNode:null}};const s=function(e){return {nodeName:"#text",value:e,parentNode:null}},r=t.appendChild=function(e,t){e.childNodes.push(t),t.parentNode=e;},i=t.insertBefore=function(e,t,n){const s=e.childNodes.indexOf(n);e.childNodes.splice(s,0,t),t.parentNode=e;};t.setTemplateContent=function(e,t){e.content=t;},t.getTemplateContent=function(e){return e.content},t.setDocumentType=function(e,t,n,s){let i=null;for(let t=0;t<e.childNodes.length;t++)if("#documentType"===e.childNodes[t].nodeName){i=e.childNodes[t];break}i?(i.name=t,i.publicId=n,i.systemId=s):r(e,{nodeName:"#documentType",name:t,publicId:n,systemId:s});},t.setDocumentMode=function(e,t){e.mode=t;},t.getDocumentMode=function(e){return e.mode},t.detachNode=function(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null;}},t.insertText=function(e,t){if(e.childNodes.length){const n=e.childNodes[e.childNodes.length-1];if("#text"===n.nodeName)return void(n.value+=t)}r(e,s(t));},t.insertTextBefore=function(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&"#text"===r.nodeName?r.value+=t:i(e,s(t),n);},t.adoptAttributes=function(e,t){const n=[];for(let t=0;t<e.attrs.length;t++)n.push(e.attrs[t].name);for(let s=0;s<t.length;s++)-1===n.indexOf(t[s].name)&&e.attrs.push(t[s]);},t.getFirstChild=function(e){return e.childNodes[0]},t.getChildNodes=function(e){return e.childNodes},t.getParentNode=function(e){return e.parentNode},t.getAttrList=function(e){return e.attrs},t.getTagName=function(e){return e.tagName},t.getNamespaceURI=function(e){return e.namespaceURI},t.getTextNodeContent=function(e){return e.value},t.getCommentNodeContent=function(e){return e.data},t.getDocumentTypeNodeName=function(e){return e.name},t.getDocumentTypeNodePublicId=function(e){return e.publicId},t.getDocumentTypeNodeSystemId=function(e){return e.systemId},t.isTextNode=function(e){return "#text"===e.nodeName},t.isCommentNode=function(e){return "#comment"===e.nodeName},t.isDocumentTypeNode=function(e){return "#documentType"===e.nodeName},t.isElementNode=function(e){return !!e.tagName},t.setNodeSourceCodeLocation=function(e,t){e.sourceCodeLocation=t;},t.getNodeSourceCodeLocation=function(e){return e.sourceCodeLocation},t.updateNodeSourceCodeLocation=function(e,t){e.sourceCodeLocation=Object.assign(e.sourceCodeLocation,t);};}));const{DOCUMENT_MODE:yt}=Ct,vt="html",Yt=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],wt=Yt.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]),Qt=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"],Xt=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],Wt=Xt.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function Vt(e,t){for(let n=0;n<t.length;n++)if(0===e.indexOf(t[n]))return !0;return !1}var jt=dt((function(e,t){const n=Ct.TAG_NAMES,s=Ct.NAMESPACES,r=Ct.ATTRS,i={attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},o={"xlink:actuate":{prefix:"xlink",name:"actuate",namespace:s.XLINK},"xlink:arcrole":{prefix:"xlink",name:"arcrole",namespace:s.XLINK},"xlink:href":{prefix:"xlink",name:"href",namespace:s.XLINK},"xlink:role":{prefix:"xlink",name:"role",namespace:s.XLINK},"xlink:show":{prefix:"xlink",name:"show",namespace:s.XLINK},"xlink:title":{prefix:"xlink",name:"title",namespace:s.XLINK},"xlink:type":{prefix:"xlink",name:"type",namespace:s.XLINK},"xml:base":{prefix:"xml",name:"base",namespace:s.XML},"xml:lang":{prefix:"xml",name:"lang",namespace:s.XML},"xml:space":{prefix:"xml",name:"space",namespace:s.XML},xmlns:{prefix:"",name:"xmlns",namespace:s.XMLNS},"xmlns:xlink":{prefix:"xmlns",name:"xlink",namespace:s.XMLNS}},a=t.SVG_TAG_NAMES_ADJUSTMENT_MAP={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"},T={[n.B]:!0,[n.BIG]:!0,[n.BLOCKQUOTE]:!0,[n.BODY]:!0,[n.BR]:!0,[n.CENTER]:!0,[n.CODE]:!0,[n.DD]:!0,[n.DIV]:!0,[n.DL]:!0,[n.DT]:!0,[n.EM]:!0,[n.EMBED]:!0,[n.H1]:!0,[n.H2]:!0,[n.H3]:!0,[n.H4]:!0,[n.H5]:!0,[n.H6]:!0,[n.HEAD]:!0,[n.HR]:!0,[n.I]:!0,[n.IMG]:!0,[n.LI]:!0,[n.LISTING]:!0,[n.MENU]:!0,[n.META]:!0,[n.NOBR]:!0,[n.OL]:!0,[n.P]:!0,[n.PRE]:!0,[n.RUBY]:!0,[n.S]:!0,[n.SMALL]:!0,[n.SPAN]:!0,[n.STRONG]:!0,[n.STRIKE]:!0,[n.SUB]:!0,[n.SUP]:!0,[n.TABLE]:!0,[n.TT]:!0,[n.U]:!0,[n.UL]:!0,[n.VAR]:!0};t.causesExit=function(e){const t=e.tagName;return !(t!==n.FONT||null===Nt.getTokenAttr(e,r.COLOR)&&null===Nt.getTokenAttr(e,r.SIZE)&&null===Nt.getTokenAttr(e,r.FACE))||T[t]},t.adjustTokenMathMLAttrs=function(e){for(let t=0;t<e.attrs.length;t++)if("definitionurl"===e.attrs[t].name){e.attrs[t].name="definitionURL";break}},t.adjustTokenSVGAttrs=function(e){for(let t=0;t<e.attrs.length;t++){const n=i[e.attrs[t].name];n&&(e.attrs[t].name=n);}},t.adjustTokenXMLAttrs=function(e){for(let t=0;t<e.attrs.length;t++){const n=o[e.attrs[t].name];n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace);}},t.adjustTokenSVGTagName=function(e){const t=a[e.tagName];t&&(e.tagName=t);},t.isIntegrationPoint=function(e,t,i,o){return !(o&&o!==s.HTML||!function(e,t,i){if(t===s.MATHML&&e===n.ANNOTATION_XML)for(let e=0;e<i.length;e++)if(i[e].name===r.ENCODING){const t=i[e].value.toLowerCase();return "text/html"===t||"application/xhtml+xml"===t}return t===s.SVG&&(e===n.FOREIGN_OBJECT||e===n.DESC||e===n.TITLE)}(e,t,i))||!(o&&o!==s.MATHML||!function(e,t){return t===s.MATHML&&(e===n.MI||e===n.MO||e===n.MN||e===n.MS||e===n.MTEXT)}(e,t))};}));const zt=Ct.TAG_NAMES,qt=Ct.NAMESPACES,Jt=Ct.ATTRS,Zt={scriptingEnabled:!0,sourceCodeLocationInfo:!1,onParseError:null,treeAdapter:xt},$t="hidden",en="INITIAL_MODE",tn="BEFORE_HTML_MODE",nn="BEFORE_HEAD_MODE",sn="IN_HEAD_MODE",rn="IN_HEAD_NO_SCRIPT_MODE",on="AFTER_HEAD_MODE",an="IN_BODY_MODE",Tn="TEXT_MODE",En="IN_TABLE_MODE",hn="IN_TABLE_TEXT_MODE",cn="IN_CAPTION_MODE",_n="IN_COLUMN_GROUP_MODE",ln="IN_TABLE_BODY_MODE",mn="IN_ROW_MODE",pn="IN_CELL_MODE",An="IN_SELECT_MODE",un="IN_SELECT_IN_TABLE_MODE",Nn="IN_TEMPLATE_MODE",dn="AFTER_BODY_MODE",Cn="IN_FRAMESET_MODE",On="AFTER_FRAMESET_MODE",fn="AFTER_AFTER_BODY_MODE",Sn="AFTER_AFTER_FRAMESET_MODE",Rn={[zt.TR]:mn,[zt.TBODY]:ln,[zt.THEAD]:ln,[zt.TFOOT]:ln,[zt.CAPTION]:cn,[zt.COLGROUP]:_n,[zt.TABLE]:En,[zt.BODY]:an,[zt.FRAMESET]:Cn},In={[zt.CAPTION]:En,[zt.COLGROUP]:En,[zt.TBODY]:En,[zt.TFOOT]:En,[zt.THEAD]:En,[zt.COL]:_n,[zt.TR]:ln,[zt.TD]:mn,[zt.TH]:mn},Ln={[en]:{[Nt.CHARACTER_TOKEN]:vn,[Nt.NULL_CHARACTER_TOKEN]:vn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:function(e,t){e._setDocumentType(t);const n=t.forceQuirks?Ct.DOCUMENT_MODE.QUIRKS:function(e){if(e.name!==vt)return yt.QUIRKS;const t=e.systemId;if(t&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===t.toLowerCase())return yt.QUIRKS;let n=e.publicId;if(null!==n){if(n=n.toLowerCase(),Qt.indexOf(n)>-1)return yt.QUIRKS;let e=null===t?wt:Yt;if(Vt(n,e))return yt.QUIRKS;if(e=null===t?Xt:Wt,Vt(n,e))return yt.LIMITED_QUIRKS}return yt.NO_QUIRKS}(t);(function(e){return e.name===vt&&null===e.publicId&&(null===e.systemId||"about:legacy-compat"===e.systemId)})(t)||e._err("non-conforming-doctype"),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=tn;},[Nt.START_TAG_TOKEN]:vn,[Nt.END_TAG_TOKEN]:vn,[Nt.EOF_TOKEN]:vn},[tn]:{[Nt.CHARACTER_TOKEN]:Yn,[Nt.NULL_CHARACTER_TOKEN]:Yn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?(e._insertElement(t,qt.HTML),e.insertionMode=nn):Yn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n!==zt.HTML&&n!==zt.HEAD&&n!==zt.BODY&&n!==zt.BR||Yn(e,t);},[Nt.EOF_TOKEN]:Yn},[nn]:{[Nt.CHARACTER_TOKEN]:wn,[Nt.NULL_CHARACTER_TOKEN]:wn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.HEAD?(e._insertElement(t,qt.HTML),e.headElement=e.openElements.current,e.insertionMode=sn):wn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HEAD||n===zt.BODY||n===zt.HTML||n===zt.BR?wn(e,t):e._err(L);},[Nt.EOF_TOKEN]:wn},[sn]:{[Nt.CHARACTER_TOKEN]:Wn,[Nt.NULL_CHARACTER_TOKEN]:Wn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:Qn,[Nt.END_TAG_TOKEN]:Xn,[Nt.EOF_TOKEN]:Wn},[rn]:{[Nt.CHARACTER_TOKEN]:Vn,[Nt.NULL_CHARACTER_TOKEN]:Vn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BASEFONT||n===zt.BGSOUND||n===zt.HEAD||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.STYLE?Qn(e,t):n===zt.NOSCRIPT?e._err("nested-noscript-in-head"):Vn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.NOSCRIPT?(e.openElements.pop(),e.insertionMode=sn):n===zt.BR?Vn(e,t):e._err(L);},[Nt.EOF_TOKEN]:Vn},[on]:{[Nt.CHARACTER_TOKEN]:jn,[Nt.NULL_CHARACTER_TOKEN]:jn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BODY?(e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode=an):n===zt.FRAMESET?(e._insertElement(t,qt.HTML),e.insertionMode=Cn):n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.SCRIPT||n===zt.STYLE||n===zt.TEMPLATE||n===zt.TITLE?(e._err("abandoned-head-element-child"),e.openElements.push(e.headElement),Qn(e,t),e.openElements.remove(e.headElement)):n===zt.HEAD?e._err(k):jn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.BODY||n===zt.HTML||n===zt.BR?jn(e,t):n===zt.TEMPLATE?Xn(e,t):e._err(L);},[Nt.EOF_TOKEN]:jn},[an]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:as,[Nt.END_TAG_TOKEN]:cs,[Nt.EOF_TOKEN]:_s},[Tn]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:xn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Gn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:Gn,[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.SCRIPT&&(e.pendingScript=e.openElements.current),e.openElements.pop(),e.insertionMode=e.originalInsertionMode;},[Nt.EOF_TOKEN]:function(e,t){e._err("eof-in-element-that-can-contain-only-text"),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e._processToken(t);}},[En]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:ms,[Nt.END_TAG_TOKEN]:ps,[Nt.EOF_TOKEN]:_s},[hn]:{[Nt.CHARACTER_TOKEN]:function(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0;},[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:function(e,t){e.pendingCharacterTokens.push(t);},[Nt.COMMENT_TOKEN]:us,[Nt.DOCTYPE_TOKEN]:us,[Nt.START_TAG_TOKEN]:us,[Nt.END_TAG_TOKEN]:us,[Nt.EOF_TOKEN]:us},[cn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TD||n===zt.TFOOT||n===zt.TH||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(zt.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=En,e._processToken(t)):as(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE?e.openElements.hasInTableScope(zt.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=En,n===zt.TABLE&&e._processToken(t)):n!==zt.BODY&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&n!==zt.TBODY&&n!==zt.TD&&n!==zt.TFOOT&&n!==zt.TH&&n!==zt.THEAD&&n!==zt.TR&&cs(e,t);},[Nt.EOF_TOKEN]:_s},[_n]:{[Nt.CHARACTER_TOKEN]:Ns,[Nt.NULL_CHARACTER_TOKEN]:Ns,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.COL?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.TEMPLATE?Qn(e,t):Ns(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.COLGROUP?e.openElements.currentTagName===zt.COLGROUP&&(e.openElements.pop(),e.insertionMode=En):n===zt.TEMPLATE?Xn(e,t):n!==zt.COL&&Ns(e,t);},[Nt.EOF_TOKEN]:_s},[ln]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TR?(e.openElements.clearBackToTableBodyContext(),e._insertElement(t,qt.HTML),e.insertionMode=mn):n===zt.TH||n===zt.TD?(e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(zt.TR),e.insertionMode=mn,e._processToken(t)):n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En,e._processToken(t)):ms(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En):n===zt.TABLE?e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En,e._processToken(t)):(n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP||n!==zt.HTML&&n!==zt.TD&&n!==zt.TH&&n!==zt.TR)&&ps(e,t);},[Nt.EOF_TOKEN]:_s},[mn]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TH||n===zt.TD?(e.openElements.clearBackToTableRowContext(),e._insertElement(t,qt.HTML),e.insertionMode=pn,e.activeFormattingElements.insertMarker()):n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):ms(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TR?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln):n===zt.TABLE?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?(e.openElements.hasInTableScope(n)||e.openElements.hasInTableScope(zt.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):(n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP||n!==zt.HTML&&n!==zt.TD&&n!==zt.TH)&&ps(e,t);},[Nt.EOF_TOKEN]:_s},[pn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TD||n===zt.TFOOT||n===zt.TH||n===zt.THEAD||n===zt.TR?(e.openElements.hasInTableScope(zt.TD)||e.openElements.hasInTableScope(zt.TH))&&(e._closeTableCell(),e._processToken(t)):as(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TD||n===zt.TH?e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=mn):n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(n)&&(e._closeTableCell(),e._processToken(t)):n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&cs(e,t);},[Nt.EOF_TOKEN]:_s},[An]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:ds,[Nt.END_TAG_TOKEN]:Cs,[Nt.EOF_TOKEN]:_s},[un]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR||n===zt.TD||n===zt.TH?(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),e._processToken(t)):ds(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR||n===zt.TD||n===zt.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),e._processToken(t)):Cs(e,t);},[Nt.EOF_TOKEN]:_s},[Nn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;if(n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.SCRIPT||n===zt.STYLE||n===zt.TEMPLATE||n===zt.TITLE)Qn(e,t);else {const s=In[n]||an;e._popTmplInsertionMode(),e._pushTmplInsertionMode(s),e.insertionMode=s,e._processToken(t);}},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.TEMPLATE&&Xn(e,t);},[Nt.EOF_TOKEN]:Os},[dn]:{[Nt.CHARACTER_TOKEN]:fs,[Nt.NULL_CHARACTER_TOKEN]:fs,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:function(e,t){e._appendCommentNode(t,e.openElements.items[0]);},[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?as(e,t):fs(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?e.fragmentContext||(e.insertionMode=fn):fs(e,t);},[Nt.EOF_TOKEN]:yn},[Cn]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.FRAMESET?e._insertElement(t,qt.HTML):n===zt.FRAME?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName!==zt.FRAMESET||e.openElements.isRootHtmlElementCurrent()||(e.openElements.pop(),e.fragmentContext||e.openElements.currentTagName===zt.FRAMESET||(e.insertionMode=On));},[Nt.EOF_TOKEN]:yn},[On]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML&&(e.insertionMode=Sn);},[Nt.EOF_TOKEN]:yn},[fn]:{[Nt.CHARACTER_TOKEN]:Ss,[Nt.NULL_CHARACTER_TOKEN]:Ss,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:bn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?as(e,t):Ss(e,t);},[Nt.END_TAG_TOKEN]:Ss,[Nt.EOF_TOKEN]:yn},[Sn]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:bn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:Gn,[Nt.EOF_TOKEN]:yn}};var kn=class{constructor(e){this.options=function(e,t){return [e,t=t||Object.create(null)].reduce(((e,t)=>(Object.keys(t).forEach((n=>{e[n]=t[n];})),e)),Object.create(null))}(Zt,e),this.treeAdapter=this.options.treeAdapter,this.pendingScript=null,this.options.sourceCodeLocationInfo&&gt.install(this,Ut),this.options.onParseError&&gt.install(this,bt,{onParseError:this.options.onParseError});}parse(e){const t=this.treeAdapter.createDocument();return this._bootstrap(t,null),this.tokenizer.write(e,!0),this._runParsingLoop(null),t}parseFragment(e,t){t||(t=this.treeAdapter.createElement(zt.TEMPLATE,qt.HTML,[]));const n=this.treeAdapter.createElement("documentmock",qt.HTML,[]);this._bootstrap(n,t),this.treeAdapter.getTagName(t)===zt.TEMPLATE&&this._pushTmplInsertionMode(Nn),this._initTokenizerForFragmentParsing(),this._insertFakeRootElement(),this._resetInsertionMode(),this._findFormInFragmentContext(),this.tokenizer.write(e,!0),this._runParsingLoop(null);const s=this.treeAdapter.getFirstChild(n),r=this.treeAdapter.createDocumentFragment();return this._adoptNodes(s,r),r}_bootstrap(e,t){this.tokenizer=new Nt(this.options),this.stopped=!1,this.insertionMode=en,this.originalInsertionMode="",this.document=e,this.fragmentContext=t,this.headElement=null,this.formElement=null,this.openElements=new class{constructor(e,t){this.stackTop=-1,this.items=[],this.current=e,this.currentTagName=null,this.currentTmplContent=null,this.tmplCount=0,this.treeAdapter=t;}_indexOf(e){let t=-1;for(let n=this.stackTop;n>=0;n--)if(this.items[n]===e){t=n;break}return t}_isInTemplate(){return this.currentTagName===Ot.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===ft.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagName=this.current&&this.treeAdapter.getTagName(this.current),this.currentTmplContent=this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):null;}push(e){this.items[++this.stackTop]=e,this._updateCurrentElement(),this._isInTemplate()&&this.tmplCount++;}pop(){this.stackTop--,this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this._updateCurrentElement();}replace(e,t){const n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&this._updateCurrentElement();}insertAfter(e,t){const n=this._indexOf(e)+1;this.items.splice(n,0,t),n===++this.stackTop&&this._updateCurrentElement();}popUntilTagNamePopped(e){for(;this.stackTop>-1;){const t=this.currentTagName,n=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),t===e&&n===ft.HTML)break}}popUntilElementPopped(e){for(;this.stackTop>-1;){const t=this.current;if(this.pop(),t===e)break}}popUntilNumberedHeaderPopped(){for(;this.stackTop>-1;){const e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===Ot.H1||e===Ot.H2||e===Ot.H3||e===Ot.H4||e===Ot.H5||e===Ot.H6&&t===ft.HTML)break}}popUntilTableCellPopped(){for(;this.stackTop>-1;){const e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===Ot.TD||e===Ot.TH&&t===ft.HTML)break}}popAllUpToHtmlElement(){this.stackTop=0,this._updateCurrentElement();}clearBackToTableContext(){for(;this.currentTagName!==Ot.TABLE&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}clearBackToTableBodyContext(){for(;this.currentTagName!==Ot.TBODY&&this.currentTagName!==Ot.TFOOT&&this.currentTagName!==Ot.THEAD&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}clearBackToTableRowContext(){for(;this.currentTagName!==Ot.TR&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}remove(e){for(let t=this.stackTop;t>=0;t--)if(this.items[t]===e){this.items.splice(t,1),this.stackTop--,this._updateCurrentElement();break}}tryPeekProperlyNestedBodyElement(){const e=this.items[1];return e&&this.treeAdapter.getTagName(e)===Ot.BODY?e:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e);return --t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.currentTagName===Ot.HTML}hasInScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if(It(n,s))return !1}return !0}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]),n=this.treeAdapter.getNamespaceURI(this.items[e]);if((t===Ot.H1||t===Ot.H2||t===Ot.H3||t===Ot.H4||t===Ot.H5||t===Ot.H6)&&n===ft.HTML)return !0;if(It(t,n))return !1}return !0}hasInListItemScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if((n===Ot.UL||n===Ot.OL)&&s===ft.HTML||It(n,s))return !1}return !0}hasInButtonScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if(n===Ot.BUTTON&&s===ft.HTML||It(n,s))return !1}return !0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===ft.HTML){if(n===e)return !0;if(n===Ot.TABLE||n===Ot.TEMPLATE||n===Ot.HTML)return !1}}return !0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]);if(this.treeAdapter.getNamespaceURI(this.items[e])===ft.HTML){if(t===Ot.TBODY||t===Ot.THEAD||t===Ot.TFOOT)return !0;if(t===Ot.TABLE||t===Ot.HTML)return !1}}return !0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===ft.HTML){if(n===e)return !0;if(n!==Ot.OPTION&&n!==Ot.OPTGROUP)return !1}}return !0}generateImpliedEndTags(){for(;St(this.currentTagName);)this.pop();}generateImpliedEndTagsThoroughly(){for(;Rt(this.currentTagName);)this.pop();}generateImpliedEndTagsWithExclusion(e){for(;St(this.currentTagName)&&this.currentTagName!==e;)this.pop();}}(this.document,this.treeAdapter),this.activeFormattingElements=new kt(this.treeAdapter),this.tmplInsertionModeStack=[],this.tmplInsertionModeStackTop=-1,this.currentTmplInsertionMode=null,this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1;}_err(){}_runParsingLoop(e){for(;!this.stopped;){this._setupTokenizerCDATAMode();const t=this.tokenizer.getNextToken();if(t.type===Nt.HIBERNATION_TOKEN)break;if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.type===Nt.WHITESPACE_CHARACTER_TOKEN&&"\n"===t.chars[0])){if(1===t.chars.length)continue;t.chars=t.chars.substr(1);}if(this._processInputToken(t),e&&this.pendingScript)break}}runParsingLoopForCurrentChunk(e,t){if(this._runParsingLoop(t),t&&this.pendingScript){const e=this.pendingScript;return this.pendingScript=null,void t(e)}e&&e();}_setupTokenizerCDATAMode(){const e=this._getAdjustedCurrentElement();this.tokenizer.allowCDATA=e&&e!==this.document&&this.treeAdapter.getNamespaceURI(e)!==qt.HTML&&!this._isIntegrationPoint(e);}_switchToTextParsing(e,t){this._insertElement(e,qt.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Tn;}switchToPlaintextParsing(){this.insertionMode=Tn,this.originalInsertionMode=an,this.tokenizer.state=Nt.MODE.PLAINTEXT;}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;do{if(this.treeAdapter.getTagName(e)===zt.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e);}while(e)}_initTokenizerForFragmentParsing(){if(this.treeAdapter.getNamespaceURI(this.fragmentContext)===qt.HTML){const e=this.treeAdapter.getTagName(this.fragmentContext);e===zt.TITLE||e===zt.TEXTAREA?this.tokenizer.state=Nt.MODE.RCDATA:e===zt.STYLE||e===zt.XMP||e===zt.IFRAME||e===zt.NOEMBED||e===zt.NOFRAMES||e===zt.NOSCRIPT?this.tokenizer.state=Nt.MODE.RAWTEXT:e===zt.SCRIPT?this.tokenizer.state=Nt.MODE.SCRIPT_DATA:e===zt.PLAINTEXT&&(this.tokenizer.state=Nt.MODE.PLAINTEXT);}}_setDocumentType(e){const t=e.name||"",n=e.publicId||"",s=e.systemId||"";this.treeAdapter.setDocumentType(this.document,t,n,s);}_attachElementToTree(e){if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else {const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.appendChild(t,e);}}_appendElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n);}_insertElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n),this.openElements.push(n);}_insertFakeElement(e){const t=this.treeAdapter.createElement(e,qt.HTML,[]);this._attachElementToTree(t),this.openElements.push(t);}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,qt.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t),this.openElements.push(t);}_insertFakeRootElement(){const e=this.treeAdapter.createElement(zt.HTML,qt.HTML,[]);this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e);}_appendCommentNode(e,t){const n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n);}_insertCharacters(e){if(this._shouldFosterParentOnInsertion())this._fosterParentText(e.chars);else {const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.insertText(t,e.chars);}}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n);}_shouldProcessTokenInForeignContent(e){const t=this._getAdjustedCurrentElement();if(!t||t===this.document)return !1;const n=this.treeAdapter.getNamespaceURI(t);if(n===qt.HTML)return !1;if(this.treeAdapter.getTagName(t)===zt.ANNOTATION_XML&&n===qt.MATHML&&e.type===Nt.START_TAG_TOKEN&&e.tagName===zt.SVG)return !1;const s=e.type===Nt.CHARACTER_TOKEN||e.type===Nt.NULL_CHARACTER_TOKEN||e.type===Nt.WHITESPACE_CHARACTER_TOKEN;return !((e.type===Nt.START_TAG_TOKEN&&e.tagName!==zt.MGLYPH&&e.tagName!==zt.MALIGNMARK||s)&&this._isIntegrationPoint(t,qt.MATHML)||(e.type===Nt.START_TAG_TOKEN||s)&&this._isIntegrationPoint(t,qt.HTML)||e.type===Nt.EOF_TOKEN)}_processToken(e){Ln[this.insertionMode][e.type](this,e);}_processTokenInBodyMode(e){Ln.IN_BODY_MODE[e.type](this,e);}_processTokenInForeignContent(e){e.type===Nt.CHARACTER_TOKEN?function(e,t){e._insertCharacters(t),e.framesetOk=!1;}(this,e):e.type===Nt.NULL_CHARACTER_TOKEN?function(e,t){t.chars=n,e._insertCharacters(t);}(this,e):e.type===Nt.WHITESPACE_CHARACTER_TOKEN?xn(this,e):e.type===Nt.COMMENT_TOKEN?Kn(this,e):e.type===Nt.START_TAG_TOKEN?function(e,t){if(jt.causesExit(t)&&!e.fragmentContext){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==qt.HTML&&!e._isIntegrationPoint(e.openElements.current);)e.openElements.pop();e._processToken(t);}else {const n=e._getAdjustedCurrentElement(),s=e.treeAdapter.getNamespaceURI(n);s===qt.MATHML?jt.adjustTokenMathMLAttrs(t):s===qt.SVG&&(jt.adjustTokenSVGTagName(t),jt.adjustTokenSVGAttrs(t)),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,s):e._insertElement(t,s),t.ackSelfClosing=!0;}}(this,e):e.type===Nt.END_TAG_TOKEN&&function(e,t){for(let n=e.openElements.stackTop;n>0;n--){const s=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(s)===qt.HTML){e._processToken(t);break}if(e.treeAdapter.getTagName(s).toLowerCase()===t.tagName){e.openElements.popUntilElementPopped(s);break}}}(this,e);}_processInputToken(e){this._shouldProcessTokenInForeignContent(e)?this._processTokenInForeignContent(e):this._processToken(e),e.type===Nt.START_TAG_TOKEN&&e.selfClosing&&!e.ackSelfClosing&&this._err("non-void-html-element-start-tag-with-trailing-solidus");}_isIntegrationPoint(e,t){const n=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e),r=this.treeAdapter.getAttrList(e);return jt.isIntegrationPoint(n,s,r,t)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.length;if(e){let t=e,n=null;do{if(t--,n=this.activeFormattingElements.entries[t],n.type===kt.MARKER_ENTRY||this.openElements.contains(n.element)){t++;break}}while(t>0);for(let s=t;s<e;s++)n=this.activeFormattingElements.entries[s],this._insertElement(n.token,this.treeAdapter.getNamespaceURI(n.element)),n.element=this.openElements.current;}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=mn;}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(zt.P),this.openElements.popUntilTagNamePopped(zt.P);}_resetInsertionMode(){for(let e=this.openElements.stackTop,t=!1;e>=0;e--){let n=this.openElements.items[e];0===e&&(t=!0,this.fragmentContext&&(n=this.fragmentContext));const s=this.treeAdapter.getTagName(n),r=Rn[s];if(r){this.insertionMode=r;break}if(!(t||s!==zt.TD&&s!==zt.TH)){this.insertionMode=pn;break}if(!t&&s===zt.HEAD){this.insertionMode=sn;break}if(s===zt.SELECT){this._resetInsertionModeForSelect(e);break}if(s===zt.TEMPLATE){this.insertionMode=this.currentTmplInsertionMode;break}if(s===zt.HTML){this.insertionMode=this.headElement?on:nn;break}if(t){this.insertionMode=an;break}}}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const e=this.openElements.items[t],n=this.treeAdapter.getTagName(e);if(n===zt.TEMPLATE)break;if(n===zt.TABLE)return void(this.insertionMode=un)}this.insertionMode=An;}_pushTmplInsertionMode(e){this.tmplInsertionModeStack.push(e),this.tmplInsertionModeStackTop++,this.currentTmplInsertionMode=e;}_popTmplInsertionMode(){this.tmplInsertionModeStack.pop(),this.tmplInsertionModeStackTop--,this.currentTmplInsertionMode=this.tmplInsertionModeStack[this.tmplInsertionModeStackTop];}_isElementCausesFosterParenting(e){const t=this.treeAdapter.getTagName(e);return t===zt.TABLE||t===zt.TBODY||t===zt.TFOOT||t===zt.THEAD||t===zt.TR}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.current)}_findFosterParentingLocation(){const e={parent:null,beforeElement:null};for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t],s=this.treeAdapter.getTagName(n),r=this.treeAdapter.getNamespaceURI(n);if(s===zt.TEMPLATE&&r===qt.HTML){e.parent=this.treeAdapter.getTemplateContent(n);break}if(s===zt.TABLE){e.parent=this.treeAdapter.getParentNode(n),e.parent?e.beforeElement=n:e.parent=this.openElements.items[t-1];break}}return e.parent||(e.parent=this.openElements.items[0]),e}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e);}_fosterParentText(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertTextBefore(t.parent,e,t.beforeElement):this.treeAdapter.insertText(t.parent,e);}_isSpecialElement(e){const t=this.treeAdapter.getTagName(e),n=this.treeAdapter.getNamespaceURI(e);return Ct.SPECIAL_ELEMENTS[n][t]}};function Mn(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagName)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):hs(e,t),n}function gn(e,t){let n=null;for(let s=e.openElements.stackTop;s>=0;s--){const r=e.openElements.items[s];if(r===t.element)break;e._isSpecialElement(r)&&(n=r);}return n||(e.openElements.popUntilElementPopped(t.element),e.activeFormattingElements.removeEntry(t)),n}function Pn(e,t,n){let s=t,r=e.openElements.getCommonAncestor(t);for(let i=0,o=r;o!==n;i++,o=r){r=e.openElements.getCommonAncestor(o);const n=e.activeFormattingElements.getElementEntry(o),a=n&&i>=3;!n||a?(a&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=Hn(e,n),s===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(s),e.treeAdapter.appendChild(o,s),s=o);}return s}function Hn(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),s=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,s),t.element=s,s}function Dn(e,t,n){if(e._isElementCausesFosterParenting(t))e._fosterParentElement(n);else {const s=e.treeAdapter.getTagName(t),r=e.treeAdapter.getNamespaceURI(t);s===zt.TEMPLATE&&r===qt.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n);}}function Fn(e,t,n){const s=e.treeAdapter.getNamespaceURI(n.element),r=n.token,i=e.treeAdapter.createElement(r.tagName,s,r.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,n.token),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i);}function Un(e,t){let n;for(let s=0;s<8&&(n=Mn(e,t),n);s++){const t=gn(e,n);if(!t)break;e.activeFormattingElements.bookmark=n;const s=Pn(e,t,n.element),r=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(s),Dn(e,r,s),Fn(e,t,n);}}function Gn(){}function Bn(e){e._err("misplaced-doctype");}function Kn(e,t){e._appendCommentNode(t,e.openElements.currentTmplContent||e.openElements.current);}function bn(e,t){e._appendCommentNode(t,e.document);}function xn(e,t){e._insertCharacters(t);}function yn(e){e.stopped=!0;}function vn(e,t){e._err("missing-doctype",{beforeToken:!0}),e.treeAdapter.setDocumentMode(e.document,Ct.DOCUMENT_MODE.QUIRKS),e.insertionMode=tn,e._processToken(t);}function Yn(e,t){e._insertFakeRootElement(),e.insertionMode=nn,e._processToken(t);}function wn(e,t){e._insertFakeElement(zt.HEAD),e.headElement=e.openElements.current,e.insertionMode=sn,e._processToken(t);}function Qn(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.TITLE?e._switchToTextParsing(t,Nt.MODE.RCDATA):n===zt.NOSCRIPT?e.options.scriptingEnabled?e._switchToTextParsing(t,Nt.MODE.RAWTEXT):(e._insertElement(t,qt.HTML),e.insertionMode=rn):n===zt.NOFRAMES||n===zt.STYLE?e._switchToTextParsing(t,Nt.MODE.RAWTEXT):n===zt.SCRIPT?e._switchToTextParsing(t,Nt.MODE.SCRIPT_DATA):n===zt.TEMPLATE?(e._insertTemplate(t,qt.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Nn,e._pushTmplInsertionMode(Nn)):n===zt.HEAD?e._err(k):Wn(e,t);}function Xn(e,t){const n=t.tagName;n===zt.HEAD?(e.openElements.pop(),e.insertionMode=on):n===zt.BODY||n===zt.BR||n===zt.HTML?Wn(e,t):n===zt.TEMPLATE&&e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagName!==zt.TEMPLATE&&e._err("closing-of-element-with-open-child-elements"),e.openElements.popUntilTagNamePopped(zt.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e._popTmplInsertionMode(),e._resetInsertionMode()):e._err(L);}function Wn(e,t){e.openElements.pop(),e.insertionMode=on,e._processToken(t);}function Vn(e,t){const n=t.type===Nt.EOF_TOKEN?"open-elements-left-after-eof":"disallowed-content-in-noscript-in-head";e._err(n),e.openElements.pop(),e.insertionMode=sn,e._processToken(t);}function jn(e,t){e._insertFakeElement(zt.BODY),e.insertionMode=an,e._processToken(t);}function zn(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t);}function qn(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1;}function Jn(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}function Zn(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.skipNextNewLine=!0,e.framesetOk=!1;}function $n(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}function es(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1;}function ts(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,qt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0;}function ns(e,t){e._appendElement(t,qt.HTML),t.ackSelfClosing=!0;}function ss(e,t){e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}function rs(e,t){e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML);}function is(e,t){e.openElements.hasInScope(zt.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,qt.HTML);}function os(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML);}function as(e,t){const n=t.tagName;switch(n.length){case 1:n===zt.I||n===zt.S||n===zt.B||n===zt.U?$n(e,t):n===zt.P?Jn(e,t):n===zt.A?function(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(zt.A);n&&(Un(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}(e,t):os(e,t);break;case 2:n===zt.DL||n===zt.OL||n===zt.UL?Jn(e,t):n===zt.H1||n===zt.H2||n===zt.H3||n===zt.H4||n===zt.H5||n===zt.H6?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement();const n=e.openElements.currentTagName;n!==zt.H1&&n!==zt.H2&&n!==zt.H3&&n!==zt.H4&&n!==zt.H5&&n!==zt.H6||e.openElements.pop(),e._insertElement(t,qt.HTML);}(e,t):n===zt.LI||n===zt.DD||n===zt.DT?function(e,t){e.framesetOk=!1;const n=t.tagName;for(let t=e.openElements.stackTop;t>=0;t--){const s=e.openElements.items[t],r=e.treeAdapter.getTagName(s);let i=null;if(n===zt.LI&&r===zt.LI?i=zt.LI:n!==zt.DD&&n!==zt.DT||r!==zt.DD&&r!==zt.DT||(i=r),i){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(r!==zt.ADDRESS&&r!==zt.DIV&&r!==zt.P&&e._isSpecialElement(s))break}e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}(e,t):n===zt.EM||n===zt.TT?$n(e,t):n===zt.BR?ts(e,t):n===zt.HR?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._appendElement(t,qt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0;}(e,t):n===zt.RB?is(e,t):n===zt.RT||n===zt.RP?function(e,t){e.openElements.hasInScope(zt.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(zt.RTC),e._insertElement(t,qt.HTML);}(e,t):n!==zt.TH&&n!==zt.TD&&n!==zt.TR&&os(e,t);break;case 3:n===zt.DIV||n===zt.DIR||n===zt.NAV?Jn(e,t):n===zt.PRE?Zn(e,t):n===zt.BIG?$n(e,t):n===zt.IMG||n===zt.WBR?ts(e,t):n===zt.XMP?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}(e,t):n===zt.SVG?function(e,t){e._reconstructActiveFormattingElements(),jt.adjustTokenSVGAttrs(t),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,qt.SVG):e._insertElement(t,qt.SVG),t.ackSelfClosing=!0;}(e,t):n===zt.RTC?is(e,t):n!==zt.COL&&os(e,t);break;case 4:n===zt.HTML?function(e,t){0===e.openElements.tmplCount&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs);}(e,t):n===zt.BASE||n===zt.LINK||n===zt.META?Qn(e,t):n===zt.BODY?function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&0===e.openElements.tmplCount&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs));}(e,t):n===zt.MAIN||n===zt.MENU?Jn(e,t):n===zt.FORM?function(e,t){const n=e.openElements.tmplCount>0;e.formElement&&!n||(e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),n||(e.formElement=e.openElements.current));}(e,t):n===zt.CODE||n===zt.FONT?$n(e,t):n===zt.NOBR?function(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(zt.NOBR)&&(Un(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}(e,t):n===zt.AREA?ts(e,t):n===zt.MATH?function(e,t){e._reconstructActiveFormattingElements(),jt.adjustTokenMathMLAttrs(t),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,qt.MATHML):e._insertElement(t,qt.MATHML),t.ackSelfClosing=!0;}(e,t):n===zt.MENU?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}(e,t):n!==zt.HEAD&&os(e,t);break;case 5:n===zt.STYLE||n===zt.TITLE?Qn(e,t):n===zt.ASIDE?Jn(e,t):n===zt.SMALL?$n(e,t):n===zt.TABLE?function(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ct.DOCUMENT_MODE.QUIRKS&&e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode=En;}(e,t):n===zt.EMBED?ts(e,t):n===zt.INPUT?function(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,qt.HTML);const n=Nt.getTokenAttr(t,Jt.TYPE);n&&n.toLowerCase()===$t||(e.framesetOk=!1),t.ackSelfClosing=!0;}(e,t):n===zt.PARAM||n===zt.TRACK?ns(e,t):n===zt.IMAGE?function(e,t){t.tagName=zt.IMG,ts(e,t);}(e,t):n!==zt.FRAME&&n!==zt.TBODY&&n!==zt.TFOOT&&n!==zt.THEAD&&os(e,t);break;case 6:n===zt.SCRIPT?Qn(e,t):n===zt.CENTER||n===zt.FIGURE||n===zt.FOOTER||n===zt.HEADER||n===zt.HGROUP||n===zt.DIALOG?Jn(e,t):n===zt.BUTTON?function(e,t){e.openElements.hasInScope(zt.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.framesetOk=!1;}(e,t):n===zt.STRIKE||n===zt.STRONG?$n(e,t):n===zt.APPLET||n===zt.OBJECT?es(e,t):n===zt.KEYGEN?ts(e,t):n===zt.SOURCE?ns(e,t):n===zt.IFRAME?function(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}(e,t):n===zt.SELECT?function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode===En||e.insertionMode===cn||e.insertionMode===ln||e.insertionMode===mn||e.insertionMode===pn?e.insertionMode=un:e.insertionMode=An;}(e,t):n===zt.OPTION?rs(e,t):os(e,t);break;case 7:n===zt.BGSOUND?Qn(e,t):n===zt.DETAILS||n===zt.ADDRESS||n===zt.ARTICLE||n===zt.SECTION||n===zt.SUMMARY?Jn(e,t):n===zt.LISTING?Zn(e,t):n===zt.MARQUEE?es(e,t):n===zt.NOEMBED?ss(e,t):n!==zt.CAPTION&&os(e,t);break;case 8:n===zt.BASEFONT?Qn(e,t):n===zt.FRAMESET?function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,qt.HTML),e.insertionMode=Cn);}(e,t):n===zt.FIELDSET?Jn(e,t):n===zt.TEXTAREA?function(e,t){e._insertElement(t,qt.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Nt.MODE.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Tn;}(e,t):n===zt.TEMPLATE?Qn(e,t):n===zt.NOSCRIPT?e.options.scriptingEnabled?ss(e,t):os(e,t):n===zt.OPTGROUP?rs(e,t):n!==zt.COLGROUP&&os(e,t);break;case 9:n===zt.PLAINTEXT?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.tokenizer.state=Nt.MODE.PLAINTEXT;}(e,t):os(e,t);break;case 10:n===zt.BLOCKQUOTE||n===zt.FIGCAPTION?Jn(e,t):os(e,t);break;default:os(e,t);}}function Ts(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n));}function Es(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker());}function hs(e,t){const n=t.tagName;for(let t=e.openElements.stackTop;t>0;t--){const s=e.openElements.items[t];if(e.treeAdapter.getTagName(s)===n){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilElementPopped(s);break}if(e._isSpecialElement(s))break}}function cs(e,t){const n=t.tagName;switch(n.length){case 1:n===zt.A||n===zt.B||n===zt.I||n===zt.S||n===zt.U?Un(e,t):n===zt.P?function(e){e.openElements.hasInButtonScope(zt.P)||e._insertFakeElement(zt.P),e._closePElement();}(e):hs(e,t);break;case 2:n===zt.DL||n===zt.UL||n===zt.OL?Ts(e,t):n===zt.LI?function(e){e.openElements.hasInListItemScope(zt.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(zt.LI),e.openElements.popUntilTagNamePopped(zt.LI));}(e):n===zt.DD||n===zt.DT?function(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n));}(e,t):n===zt.H1||n===zt.H2||n===zt.H3||n===zt.H4||n===zt.H5||n===zt.H6?function(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped());}(e):n===zt.BR?function(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(zt.BR),e.openElements.pop(),e.framesetOk=!1;}(e):n===zt.EM||n===zt.TT?Un(e,t):hs(e,t);break;case 3:n===zt.BIG?Un(e,t):n===zt.DIR||n===zt.DIV||n===zt.NAV||n===zt.PRE?Ts(e,t):hs(e,t);break;case 4:n===zt.BODY?function(e){e.openElements.hasInScope(zt.BODY)&&(e.insertionMode=dn);}(e):n===zt.HTML?function(e,t){e.openElements.hasInScope(zt.BODY)&&(e.insertionMode=dn,e._processToken(t));}(e,t):n===zt.FORM?function(e){const t=e.openElements.tmplCount>0,n=e.formElement;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(zt.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(zt.FORM):e.openElements.remove(n));}(e):n===zt.CODE||n===zt.FONT||n===zt.NOBR?Un(e,t):n===zt.MAIN||n===zt.MENU?Ts(e,t):hs(e,t);break;case 5:n===zt.ASIDE?Ts(e,t):n===zt.SMALL?Un(e,t):hs(e,t);break;case 6:n===zt.CENTER||n===zt.FIGURE||n===zt.FOOTER||n===zt.HEADER||n===zt.HGROUP||n===zt.DIALOG?Ts(e,t):n===zt.APPLET||n===zt.OBJECT?Es(e,t):n===zt.STRIKE||n===zt.STRONG?Un(e,t):hs(e,t);break;case 7:n===zt.ADDRESS||n===zt.ARTICLE||n===zt.DETAILS||n===zt.SECTION||n===zt.SUMMARY||n===zt.LISTING?Ts(e,t):n===zt.MARQUEE?Es(e,t):hs(e,t);break;case 8:n===zt.FIELDSET?Ts(e,t):n===zt.TEMPLATE?Xn(e,t):hs(e,t);break;case 10:n===zt.BLOCKQUOTE||n===zt.FIGCAPTION?Ts(e,t):hs(e,t);break;default:hs(e,t);}}function _s(e,t){e.tmplInsertionModeStackTop>-1?Os(e,t):e.stopped=!0;}function ls(e,t){const n=e.openElements.currentTagName;n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?(e.pendingCharacterTokens=[],e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=hn,e._processToken(t)):As(e,t);}function ms(e,t){const n=t.tagName;switch(n.length){case 2:n===zt.TD||n===zt.TH||n===zt.TR?function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(zt.TBODY),e.insertionMode=ln,e._processToken(t);}(e,t):As(e,t);break;case 3:n===zt.COL?function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(zt.COLGROUP),e.insertionMode=_n,e._processToken(t);}(e,t):As(e,t);break;case 4:n===zt.FORM?function(e,t){e.formElement||0!==e.openElements.tmplCount||(e._insertElement(t,qt.HTML),e.formElement=e.openElements.current,e.openElements.pop());}(e,t):As(e,t);break;case 5:n===zt.TABLE?function(e,t){e.openElements.hasInTableScope(zt.TABLE)&&(e.openElements.popUntilTagNamePopped(zt.TABLE),e._resetInsertionMode(),e._processToken(t));}(e,t):n===zt.STYLE?Qn(e,t):n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,qt.HTML),e.insertionMode=ln;}(e,t):n===zt.INPUT?function(e,t){const n=Nt.getTokenAttr(t,Jt.TYPE);n&&n.toLowerCase()===$t?e._appendElement(t,qt.HTML):As(e,t),t.ackSelfClosing=!0;}(e,t):As(e,t);break;case 6:n===zt.SCRIPT?Qn(e,t):As(e,t);break;case 7:n===zt.CAPTION?function(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,qt.HTML),e.insertionMode=cn;}(e,t):As(e,t);break;case 8:n===zt.COLGROUP?function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,qt.HTML),e.insertionMode=_n;}(e,t):n===zt.TEMPLATE?Qn(e,t):As(e,t);break;default:As(e,t);}}function ps(e,t){const n=t.tagName;n===zt.TABLE?e.openElements.hasInTableScope(zt.TABLE)&&(e.openElements.popUntilTagNamePopped(zt.TABLE),e._resetInsertionMode()):n===zt.TEMPLATE?Xn(e,t):n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&n!==zt.TBODY&&n!==zt.TD&&n!==zt.TFOOT&&n!==zt.TH&&n!==zt.THEAD&&n!==zt.TR&&As(e,t);}function As(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,e._processTokenInBodyMode(t),e.fosterParentingEnabled=n;}function us(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)As(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t);}function Ns(e,t){e.openElements.currentTagName===zt.COLGROUP&&(e.openElements.pop(),e.insertionMode=En,e._processToken(t));}function ds(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.OPTION?(e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e._insertElement(t,qt.HTML)):n===zt.OPTGROUP?(e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e.openElements.currentTagName===zt.OPTGROUP&&e.openElements.pop(),e._insertElement(t,qt.HTML)):n===zt.INPUT||n===zt.KEYGEN||n===zt.TEXTAREA||n===zt.SELECT?e.openElements.hasInSelectScope(zt.SELECT)&&(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),n!==zt.SELECT&&e._processToken(t)):n!==zt.SCRIPT&&n!==zt.TEMPLATE||Qn(e,t);}function Cs(e,t){const n=t.tagName;if(n===zt.OPTGROUP){const t=e.openElements.items[e.openElements.stackTop-1],n=t&&e.treeAdapter.getTagName(t);e.openElements.currentTagName===zt.OPTION&&n===zt.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagName===zt.OPTGROUP&&e.openElements.pop();}else n===zt.OPTION?e.openElements.currentTagName===zt.OPTION&&e.openElements.pop():n===zt.SELECT&&e.openElements.hasInSelectScope(zt.SELECT)?(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode()):n===zt.TEMPLATE&&Xn(e,t);}function Os(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(zt.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e._popTmplInsertionMode(),e._resetInsertionMode(),e._processToken(t)):e.stopped=!0;}function fs(e,t){e.insertionMode=an,e._processToken(t);}function Ss(e,t){e.insertionMode=an,e._processToken(t);}return Ct.TAG_NAMES,Ct.NAMESPACES,e.parse=function(e,t){return new kn(t).parse(e)},e.parseFragment=function(e,t,n){return "string"==typeof e&&(n=t,t=e,e=null),new kn(n).parseFragment(t,e)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});const parse=e.parse;const parseFragment=e.parseFragment;
  1236. const docParser = new WeakMap();
  1237. function parseDocumentUtil(ownerDocument, html) {
  1238. const doc = parse(html.trim(), getParser(ownerDocument));
  1239. doc.documentElement = doc.firstElementChild;
  1240. doc.head = doc.documentElement.firstElementChild;
  1241. doc.body = doc.head.nextElementSibling;
  1242. return doc;
  1243. }
  1244. function parseFragmentUtil(ownerDocument, html) {
  1245. if (typeof html === 'string') {
  1246. html = html.trim();
  1247. }
  1248. else {
  1249. html = '';
  1250. }
  1251. const frag = parseFragment(html, getParser(ownerDocument));
  1252. return frag;
  1253. }
  1254. function getParser(ownerDocument) {
  1255. let parseOptions = docParser.get(ownerDocument);
  1256. if (parseOptions != null) {
  1257. return parseOptions;
  1258. }
  1259. const treeAdapter = {
  1260. createDocument() {
  1261. const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
  1262. doc['x-mode'] = 'no-quirks';
  1263. return doc;
  1264. },
  1265. setNodeSourceCodeLocation(node, location) {
  1266. node.sourceCodeLocation = location;
  1267. },
  1268. getNodeSourceCodeLocation(node) {
  1269. return node.sourceCodeLocation;
  1270. },
  1271. createDocumentFragment() {
  1272. return ownerDocument.createDocumentFragment();
  1273. },
  1274. createElement(tagName, namespaceURI, attrs) {
  1275. const elm = ownerDocument.createElementNS(namespaceURI, tagName);
  1276. for (let i = 0; i < attrs.length; i++) {
  1277. const attr = attrs[i];
  1278. if (attr.namespace == null || attr.namespace === 'http://www.w3.org/1999/xhtml') {
  1279. elm.setAttribute(attr.name, attr.value);
  1280. }
  1281. else {
  1282. elm.setAttributeNS(attr.namespace, attr.name, attr.value);
  1283. }
  1284. }
  1285. return elm;
  1286. },
  1287. createCommentNode(data) {
  1288. return ownerDocument.createComment(data);
  1289. },
  1290. appendChild(parentNode, newNode) {
  1291. parentNode.appendChild(newNode);
  1292. },
  1293. insertBefore(parentNode, newNode, referenceNode) {
  1294. parentNode.insertBefore(newNode, referenceNode);
  1295. },
  1296. setTemplateContent(templateElement, contentElement) {
  1297. templateElement.content = contentElement;
  1298. },
  1299. getTemplateContent(templateElement) {
  1300. return templateElement.content;
  1301. },
  1302. setDocumentType(doc, name, publicId, systemId) {
  1303. let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
  1304. if (doctypeNode == null) {
  1305. doctypeNode = ownerDocument.createDocumentTypeNode();
  1306. doc.insertBefore(doctypeNode, doc.firstChild);
  1307. }
  1308. doctypeNode.nodeValue = '!DOCTYPE';
  1309. doctypeNode['x-name'] = name;
  1310. doctypeNode['x-publicId'] = publicId;
  1311. doctypeNode['x-systemId'] = systemId;
  1312. },
  1313. setDocumentMode(doc, mode) {
  1314. doc['x-mode'] = mode;
  1315. },
  1316. getDocumentMode(doc) {
  1317. return doc['x-mode'];
  1318. },
  1319. detachNode(node) {
  1320. node.remove();
  1321. },
  1322. insertText(parentNode, text) {
  1323. const lastChild = parentNode.lastChild;
  1324. if (lastChild != null && lastChild.nodeType === 3 /* TEXT_NODE */) {
  1325. lastChild.nodeValue += text;
  1326. }
  1327. else {
  1328. parentNode.appendChild(ownerDocument.createTextNode(text));
  1329. }
  1330. },
  1331. insertTextBefore(parentNode, text, referenceNode) {
  1332. const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
  1333. if (prevNode != null && prevNode.nodeType === 3 /* TEXT_NODE */) {
  1334. prevNode.nodeValue += text;
  1335. }
  1336. else {
  1337. parentNode.insertBefore(ownerDocument.createTextNode(text), referenceNode);
  1338. }
  1339. },
  1340. adoptAttributes(recipient, attrs) {
  1341. for (let i = 0; i < attrs.length; i++) {
  1342. const attr = attrs[i];
  1343. if (recipient.hasAttributeNS(attr.namespace, attr.name) === false) {
  1344. recipient.setAttributeNS(attr.namespace, attr.name, attr.value);
  1345. }
  1346. }
  1347. },
  1348. getFirstChild(node) {
  1349. return node.childNodes[0];
  1350. },
  1351. getChildNodes(node) {
  1352. return node.childNodes;
  1353. },
  1354. getParentNode(node) {
  1355. return node.parentNode;
  1356. },
  1357. getAttrList(element) {
  1358. const attrs = element.attributes.__items.map((attr) => {
  1359. return {
  1360. name: attr.name,
  1361. value: attr.value,
  1362. namespace: attr.namespaceURI,
  1363. prefix: null,
  1364. };
  1365. });
  1366. return attrs;
  1367. },
  1368. getTagName(element) {
  1369. if (element.namespaceURI === 'http://www.w3.org/1999/xhtml') {
  1370. return element.nodeName.toLowerCase();
  1371. }
  1372. else {
  1373. return element.nodeName;
  1374. }
  1375. },
  1376. getNamespaceURI(element) {
  1377. return element.namespaceURI;
  1378. },
  1379. getTextNodeContent(textNode) {
  1380. return textNode.nodeValue;
  1381. },
  1382. getCommentNodeContent(commentNode) {
  1383. return commentNode.nodeValue;
  1384. },
  1385. getDocumentTypeNodeName(doctypeNode) {
  1386. return doctypeNode['x-name'];
  1387. },
  1388. getDocumentTypeNodePublicId(doctypeNode) {
  1389. return doctypeNode['x-publicId'];
  1390. },
  1391. getDocumentTypeNodeSystemId(doctypeNode) {
  1392. return doctypeNode['x-systemId'];
  1393. },
  1394. isTextNode(node) {
  1395. return node.nodeType === 3 /* TEXT_NODE */;
  1396. },
  1397. isCommentNode(node) {
  1398. return node.nodeType === 8 /* COMMENT_NODE */;
  1399. },
  1400. isDocumentTypeNode(node) {
  1401. return node.nodeType === 10 /* DOCUMENT_TYPE_NODE */;
  1402. },
  1403. isElementNode(node) {
  1404. return node.nodeType === 1 /* ELEMENT_NODE */;
  1405. },
  1406. };
  1407. parseOptions = {
  1408. treeAdapter: treeAdapter,
  1409. };
  1410. docParser.set(ownerDocument, parseOptions);
  1411. return parseOptions;
  1412. }
  1413. class MockNode {
  1414. constructor(ownerDocument, nodeType, nodeName, nodeValue) {
  1415. this.ownerDocument = ownerDocument;
  1416. this.nodeType = nodeType;
  1417. this.nodeName = nodeName;
  1418. this._nodeValue = nodeValue;
  1419. this.parentNode = null;
  1420. this.childNodes = [];
  1421. }
  1422. appendChild(newNode) {
  1423. if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
  1424. const nodes = newNode.childNodes.slice();
  1425. for (const child of nodes) {
  1426. this.appendChild(child);
  1427. }
  1428. }
  1429. else {
  1430. newNode.remove();
  1431. newNode.parentNode = this;
  1432. this.childNodes.push(newNode);
  1433. connectNode(this.ownerDocument, newNode);
  1434. }
  1435. return newNode;
  1436. }
  1437. append(...items) {
  1438. items.forEach((item) => {
  1439. const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
  1440. this.appendChild(isNode ? item : this.ownerDocument.createTextNode(String(item)));
  1441. });
  1442. }
  1443. prepend(...items) {
  1444. const firstChild = this.firstChild;
  1445. items.forEach((item) => {
  1446. const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
  1447. this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
  1448. });
  1449. }
  1450. cloneNode(deep) {
  1451. throw new Error(`invalid node type to clone: ${this.nodeType}, deep: ${deep}`);
  1452. }
  1453. compareDocumentPosition(_other) {
  1454. // unimplemented
  1455. // https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
  1456. return -1;
  1457. }
  1458. get firstChild() {
  1459. return this.childNodes[0] || null;
  1460. }
  1461. insertBefore(newNode, referenceNode) {
  1462. if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
  1463. for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
  1464. insertBefore(this, newNode.childNodes[i], referenceNode);
  1465. }
  1466. }
  1467. else {
  1468. insertBefore(this, newNode, referenceNode);
  1469. }
  1470. return newNode;
  1471. }
  1472. get isConnected() {
  1473. let node = this;
  1474. while (node != null) {
  1475. if (node.nodeType === 9 /* DOCUMENT_NODE */) {
  1476. return true;
  1477. }
  1478. node = node.parentNode;
  1479. if (node != null && node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
  1480. node = node.host;
  1481. }
  1482. }
  1483. return false;
  1484. }
  1485. isSameNode(node) {
  1486. return this === node;
  1487. }
  1488. get lastChild() {
  1489. return this.childNodes[this.childNodes.length - 1] || null;
  1490. }
  1491. get nextSibling() {
  1492. if (this.parentNode != null) {
  1493. const index = this.parentNode.childNodes.indexOf(this) + 1;
  1494. return this.parentNode.childNodes[index] || null;
  1495. }
  1496. return null;
  1497. }
  1498. get nodeValue() {
  1499. return this._nodeValue;
  1500. }
  1501. set nodeValue(value) {
  1502. this._nodeValue = value;
  1503. }
  1504. get parentElement() {
  1505. return this.parentNode || null;
  1506. }
  1507. set parentElement(value) {
  1508. this.parentNode = value;
  1509. }
  1510. get previousSibling() {
  1511. if (this.parentNode != null) {
  1512. const index = this.parentNode.childNodes.indexOf(this) - 1;
  1513. return this.parentNode.childNodes[index] || null;
  1514. }
  1515. return null;
  1516. }
  1517. contains(otherNode) {
  1518. if (otherNode === this) {
  1519. return true;
  1520. }
  1521. return this.childNodes.includes(otherNode);
  1522. }
  1523. removeChild(childNode) {
  1524. const index = this.childNodes.indexOf(childNode);
  1525. if (index > -1) {
  1526. this.childNodes.splice(index, 1);
  1527. if (this.nodeType === 1 /* ELEMENT_NODE */) {
  1528. const wasConnected = this.isConnected;
  1529. childNode.parentNode = null;
  1530. if (wasConnected === true) {
  1531. disconnectNode(childNode);
  1532. }
  1533. }
  1534. else {
  1535. childNode.parentNode = null;
  1536. }
  1537. }
  1538. else {
  1539. throw new Error(`node not found within childNodes during removeChild`);
  1540. }
  1541. return childNode;
  1542. }
  1543. remove() {
  1544. if (this.parentNode != null) {
  1545. this.parentNode.removeChild(this);
  1546. }
  1547. }
  1548. replaceChild(newChild, oldChild) {
  1549. if (oldChild.parentNode === this) {
  1550. this.insertBefore(newChild, oldChild);
  1551. oldChild.remove();
  1552. return newChild;
  1553. }
  1554. return null;
  1555. }
  1556. get textContent() {
  1557. return this._nodeValue;
  1558. }
  1559. set textContent(value) {
  1560. this._nodeValue = String(value);
  1561. }
  1562. }
  1563. MockNode.ELEMENT_NODE = 1;
  1564. MockNode.TEXT_NODE = 3;
  1565. MockNode.PROCESSING_INSTRUCTION_NODE = 7;
  1566. MockNode.COMMENT_NODE = 8;
  1567. MockNode.DOCUMENT_NODE = 9;
  1568. MockNode.DOCUMENT_TYPE_NODE = 10;
  1569. MockNode.DOCUMENT_FRAGMENT_NODE = 11;
  1570. class MockNodeList {
  1571. constructor(ownerDocument, childNodes, length) {
  1572. this.ownerDocument = ownerDocument;
  1573. this.childNodes = childNodes;
  1574. this.length = length;
  1575. }
  1576. }
  1577. class MockElement extends MockNode {
  1578. constructor(ownerDocument, nodeName) {
  1579. super(ownerDocument, 1 /* ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
  1580. this.namespaceURI = null;
  1581. }
  1582. addEventListener(type, handler) {
  1583. addEventListener(this, type, handler);
  1584. }
  1585. attachShadow(_opts) {
  1586. const shadowRoot = this.ownerDocument.createDocumentFragment();
  1587. this.shadowRoot = shadowRoot;
  1588. return shadowRoot;
  1589. }
  1590. get shadowRoot() {
  1591. return this.__shadowRoot || null;
  1592. }
  1593. set shadowRoot(shadowRoot) {
  1594. if (shadowRoot != null) {
  1595. shadowRoot.host = this;
  1596. this.__shadowRoot = shadowRoot;
  1597. }
  1598. else {
  1599. delete this.__shadowRoot;
  1600. }
  1601. }
  1602. get attributes() {
  1603. if (this.__attributeMap == null) {
  1604. this.__attributeMap = createAttributeProxy(false);
  1605. }
  1606. return this.__attributeMap;
  1607. }
  1608. set attributes(attrs) {
  1609. this.__attributeMap = attrs;
  1610. }
  1611. get children() {
  1612. return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */);
  1613. }
  1614. get childElementCount() {
  1615. return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */).length;
  1616. }
  1617. get className() {
  1618. return this.getAttributeNS(null, 'class') || '';
  1619. }
  1620. set className(value) {
  1621. this.setAttributeNS(null, 'class', value);
  1622. }
  1623. get classList() {
  1624. return new MockClassList(this);
  1625. }
  1626. click() {
  1627. dispatchEvent(this, new MockEvent('click', { bubbles: true, cancelable: true, composed: true }));
  1628. }
  1629. cloneNode(_deep) {
  1630. // implemented on MockElement.prototype from within element.ts
  1631. return null;
  1632. }
  1633. closest(selector) {
  1634. let elm = this;
  1635. while (elm != null) {
  1636. if (elm.matches(selector)) {
  1637. return elm;
  1638. }
  1639. elm = elm.parentNode;
  1640. }
  1641. return null;
  1642. }
  1643. get dataset() {
  1644. return dataset(this);
  1645. }
  1646. get dir() {
  1647. return this.getAttributeNS(null, 'dir') || '';
  1648. }
  1649. set dir(value) {
  1650. this.setAttributeNS(null, 'dir', value);
  1651. }
  1652. dispatchEvent(ev) {
  1653. return dispatchEvent(this, ev);
  1654. }
  1655. get firstElementChild() {
  1656. return this.children[0] || null;
  1657. }
  1658. getAttribute(attrName) {
  1659. if (attrName === 'style') {
  1660. if (this.__style != null && this.__style.length > 0) {
  1661. return this.style.cssText;
  1662. }
  1663. return null;
  1664. }
  1665. const attr = this.attributes.getNamedItem(attrName);
  1666. if (attr != null) {
  1667. return attr.value;
  1668. }
  1669. return null;
  1670. }
  1671. getAttributeNS(namespaceURI, attrName) {
  1672. const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
  1673. if (attr != null) {
  1674. return attr.value;
  1675. }
  1676. return null;
  1677. }
  1678. getBoundingClientRect() {
  1679. return { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 };
  1680. }
  1681. getRootNode(opts) {
  1682. const isComposed = opts != null && opts.composed === true;
  1683. let node = this;
  1684. while (node.parentNode != null) {
  1685. node = node.parentNode;
  1686. if (isComposed === true && node.parentNode == null && node.host != null) {
  1687. node = node.host;
  1688. }
  1689. }
  1690. return node;
  1691. }
  1692. get draggable() {
  1693. return this.getAttributeNS(null, 'draggable') === 'true';
  1694. }
  1695. set draggable(value) {
  1696. this.setAttributeNS(null, 'draggable', value);
  1697. }
  1698. hasChildNodes() {
  1699. return this.childNodes.length > 0;
  1700. }
  1701. get id() {
  1702. return this.getAttributeNS(null, 'id') || '';
  1703. }
  1704. set id(value) {
  1705. this.setAttributeNS(null, 'id', value);
  1706. }
  1707. get innerHTML() {
  1708. if (this.childNodes.length === 0) {
  1709. return '';
  1710. }
  1711. return serializeNodeToHtml(this, {
  1712. newLines: false,
  1713. indentSpaces: 0,
  1714. });
  1715. }
  1716. set innerHTML(html) {
  1717. if (NON_ESCAPABLE_CONTENT.has(this.nodeName) === true) {
  1718. setTextContent(this, html);
  1719. }
  1720. else {
  1721. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  1722. this.removeChild(this.childNodes[i]);
  1723. }
  1724. if (typeof html === 'string') {
  1725. const frag = parseFragmentUtil(this.ownerDocument, html);
  1726. while (frag.childNodes.length > 0) {
  1727. this.appendChild(frag.childNodes[0]);
  1728. }
  1729. }
  1730. }
  1731. }
  1732. get innerText() {
  1733. const text = [];
  1734. getTextContent(this.childNodes, text);
  1735. return text.join('');
  1736. }
  1737. set innerText(value) {
  1738. setTextContent(this, value);
  1739. }
  1740. insertAdjacentElement(position, elm) {
  1741. if (position === 'beforebegin') {
  1742. insertBefore(this.parentNode, elm, this);
  1743. }
  1744. else if (position === 'afterbegin') {
  1745. this.prepend(elm);
  1746. }
  1747. else if (position === 'beforeend') {
  1748. this.appendChild(elm);
  1749. }
  1750. else if (position === 'afterend') {
  1751. insertBefore(this.parentNode, elm, this.nextSibling);
  1752. }
  1753. return elm;
  1754. }
  1755. insertAdjacentHTML(position, html) {
  1756. const frag = parseFragmentUtil(this.ownerDocument, html);
  1757. if (position === 'beforebegin') {
  1758. while (frag.childNodes.length > 0) {
  1759. insertBefore(this.parentNode, frag.childNodes[0], this);
  1760. }
  1761. }
  1762. else if (position === 'afterbegin') {
  1763. while (frag.childNodes.length > 0) {
  1764. this.prepend(frag.childNodes[frag.childNodes.length - 1]);
  1765. }
  1766. }
  1767. else if (position === 'beforeend') {
  1768. while (frag.childNodes.length > 0) {
  1769. this.appendChild(frag.childNodes[0]);
  1770. }
  1771. }
  1772. else if (position === 'afterend') {
  1773. while (frag.childNodes.length > 0) {
  1774. insertBefore(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
  1775. }
  1776. }
  1777. }
  1778. insertAdjacentText(position, text) {
  1779. const elm = this.ownerDocument.createTextNode(text);
  1780. if (position === 'beforebegin') {
  1781. insertBefore(this.parentNode, elm, this);
  1782. }
  1783. else if (position === 'afterbegin') {
  1784. this.prepend(elm);
  1785. }
  1786. else if (position === 'beforeend') {
  1787. this.appendChild(elm);
  1788. }
  1789. else if (position === 'afterend') {
  1790. insertBefore(this.parentNode, elm, this.nextSibling);
  1791. }
  1792. }
  1793. hasAttribute(attrName) {
  1794. if (attrName === 'style') {
  1795. return this.__style != null && this.__style.length > 0;
  1796. }
  1797. return this.getAttribute(attrName) !== null;
  1798. }
  1799. hasAttributeNS(namespaceURI, name) {
  1800. return this.getAttributeNS(namespaceURI, name) !== null;
  1801. }
  1802. get hidden() {
  1803. return this.hasAttributeNS(null, 'hidden');
  1804. }
  1805. set hidden(isHidden) {
  1806. if (isHidden === true) {
  1807. this.setAttributeNS(null, 'hidden', '');
  1808. }
  1809. else {
  1810. this.removeAttributeNS(null, 'hidden');
  1811. }
  1812. }
  1813. get lang() {
  1814. return this.getAttributeNS(null, 'lang') || '';
  1815. }
  1816. set lang(value) {
  1817. this.setAttributeNS(null, 'lang', value);
  1818. }
  1819. get lastElementChild() {
  1820. const children = this.children;
  1821. return children[children.length - 1] || null;
  1822. }
  1823. matches(selector) {
  1824. return matches(selector, this);
  1825. }
  1826. get nextElementSibling() {
  1827. const parentElement = this.parentElement;
  1828. if (parentElement != null &&
  1829. (parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
  1830. parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
  1831. parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
  1832. const children = parentElement.children;
  1833. const index = children.indexOf(this) + 1;
  1834. return parentElement.children[index] || null;
  1835. }
  1836. return null;
  1837. }
  1838. get outerHTML() {
  1839. return serializeNodeToHtml(this, {
  1840. newLines: false,
  1841. outerHtml: true,
  1842. indentSpaces: 0,
  1843. });
  1844. }
  1845. get previousElementSibling() {
  1846. const parentElement = this.parentElement;
  1847. if (parentElement != null &&
  1848. (parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
  1849. parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
  1850. parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
  1851. const children = parentElement.children;
  1852. const index = children.indexOf(this) - 1;
  1853. return parentElement.children[index] || null;
  1854. }
  1855. return null;
  1856. }
  1857. getElementsByClassName(classNames) {
  1858. const classes = classNames
  1859. .trim()
  1860. .split(' ')
  1861. .filter((c) => c.length > 0);
  1862. const results = [];
  1863. getElementsByClassName(this, classes, results);
  1864. return results;
  1865. }
  1866. getElementsByTagName(tagName) {
  1867. const results = [];
  1868. getElementsByTagName(this, tagName.toLowerCase(), results);
  1869. return results;
  1870. }
  1871. querySelector(selector) {
  1872. return selectOne(selector, this);
  1873. }
  1874. querySelectorAll(selector) {
  1875. return selectAll(selector, this);
  1876. }
  1877. removeAttribute(attrName) {
  1878. if (attrName === 'style') {
  1879. delete this.__style;
  1880. }
  1881. else {
  1882. const attr = this.attributes.getNamedItem(attrName);
  1883. if (attr != null) {
  1884. this.attributes.removeNamedItemNS(attr);
  1885. if (checkAttributeChanged(this) === true) {
  1886. attributeChanged(this, attrName, attr.value, null);
  1887. }
  1888. }
  1889. }
  1890. }
  1891. removeAttributeNS(namespaceURI, attrName) {
  1892. const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
  1893. if (attr != null) {
  1894. this.attributes.removeNamedItemNS(attr);
  1895. if (checkAttributeChanged(this) === true) {
  1896. attributeChanged(this, attrName, attr.value, null);
  1897. }
  1898. }
  1899. }
  1900. removeEventListener(type, handler) {
  1901. removeEventListener(this, type, handler);
  1902. }
  1903. setAttribute(attrName, value) {
  1904. if (attrName === 'style') {
  1905. this.style = value;
  1906. }
  1907. else {
  1908. const attributes = this.attributes;
  1909. let attr = attributes.getNamedItem(attrName);
  1910. const checkAttrChanged = checkAttributeChanged(this);
  1911. if (attr != null) {
  1912. if (checkAttrChanged === true) {
  1913. const oldValue = attr.value;
  1914. attr.value = value;
  1915. if (oldValue !== attr.value) {
  1916. attributeChanged(this, attr.name, oldValue, attr.value);
  1917. }
  1918. }
  1919. else {
  1920. attr.value = value;
  1921. }
  1922. }
  1923. else {
  1924. if (attributes.caseInsensitive) {
  1925. attrName = attrName.toLowerCase();
  1926. }
  1927. attr = new MockAttr(attrName, value);
  1928. attributes.__items.push(attr);
  1929. if (checkAttrChanged === true) {
  1930. attributeChanged(this, attrName, null, attr.value);
  1931. }
  1932. }
  1933. }
  1934. }
  1935. setAttributeNS(namespaceURI, attrName, value) {
  1936. const attributes = this.attributes;
  1937. let attr = attributes.getNamedItemNS(namespaceURI, attrName);
  1938. const checkAttrChanged = checkAttributeChanged(this);
  1939. if (attr != null) {
  1940. if (checkAttrChanged === true) {
  1941. const oldValue = attr.value;
  1942. attr.value = value;
  1943. if (oldValue !== attr.value) {
  1944. attributeChanged(this, attr.name, oldValue, attr.value);
  1945. }
  1946. }
  1947. else {
  1948. attr.value = value;
  1949. }
  1950. }
  1951. else {
  1952. attr = new MockAttr(attrName, value, namespaceURI);
  1953. attributes.__items.push(attr);
  1954. if (checkAttrChanged === true) {
  1955. attributeChanged(this, attrName, null, attr.value);
  1956. }
  1957. }
  1958. }
  1959. get style() {
  1960. if (this.__style == null) {
  1961. this.__style = createCSSStyleDeclaration();
  1962. }
  1963. return this.__style;
  1964. }
  1965. set style(val) {
  1966. if (typeof val === 'string') {
  1967. if (this.__style == null) {
  1968. this.__style = createCSSStyleDeclaration();
  1969. }
  1970. this.__style.cssText = val;
  1971. }
  1972. else {
  1973. this.__style = val;
  1974. }
  1975. }
  1976. get tabIndex() {
  1977. return parseInt(this.getAttributeNS(null, 'tabindex') || '-1', 10);
  1978. }
  1979. set tabIndex(value) {
  1980. this.setAttributeNS(null, 'tabindex', value);
  1981. }
  1982. get tagName() {
  1983. return this.nodeName;
  1984. }
  1985. set tagName(value) {
  1986. this.nodeName = value;
  1987. }
  1988. get textContent() {
  1989. const text = [];
  1990. getTextContent(this.childNodes, text);
  1991. return text.join('');
  1992. }
  1993. set textContent(value) {
  1994. setTextContent(this, value);
  1995. }
  1996. get title() {
  1997. return this.getAttributeNS(null, 'title') || '';
  1998. }
  1999. set title(value) {
  2000. this.setAttributeNS(null, 'title', value);
  2001. }
  2002. onanimationstart() {
  2003. /**/
  2004. }
  2005. onanimationend() {
  2006. /**/
  2007. }
  2008. onanimationiteration() {
  2009. /**/
  2010. }
  2011. onabort() {
  2012. /**/
  2013. }
  2014. onauxclick() {
  2015. /**/
  2016. }
  2017. onbeforecopy() {
  2018. /**/
  2019. }
  2020. onbeforecut() {
  2021. /**/
  2022. }
  2023. onbeforepaste() {
  2024. /**/
  2025. }
  2026. onblur() {
  2027. /**/
  2028. }
  2029. oncancel() {
  2030. /**/
  2031. }
  2032. oncanplay() {
  2033. /**/
  2034. }
  2035. oncanplaythrough() {
  2036. /**/
  2037. }
  2038. onchange() {
  2039. /**/
  2040. }
  2041. onclick() {
  2042. /**/
  2043. }
  2044. onclose() {
  2045. /**/
  2046. }
  2047. oncontextmenu() {
  2048. /**/
  2049. }
  2050. oncopy() {
  2051. /**/
  2052. }
  2053. oncuechange() {
  2054. /**/
  2055. }
  2056. oncut() {
  2057. /**/
  2058. }
  2059. ondblclick() {
  2060. /**/
  2061. }
  2062. ondrag() {
  2063. /**/
  2064. }
  2065. ondragend() {
  2066. /**/
  2067. }
  2068. ondragenter() {
  2069. /**/
  2070. }
  2071. ondragleave() {
  2072. /**/
  2073. }
  2074. ondragover() {
  2075. /**/
  2076. }
  2077. ondragstart() {
  2078. /**/
  2079. }
  2080. ondrop() {
  2081. /**/
  2082. }
  2083. ondurationchange() {
  2084. /**/
  2085. }
  2086. onemptied() {
  2087. /**/
  2088. }
  2089. onended() {
  2090. /**/
  2091. }
  2092. onerror() {
  2093. /**/
  2094. }
  2095. onfocus() {
  2096. /**/
  2097. }
  2098. onfocusin() {
  2099. /**/
  2100. }
  2101. onfocusout() {
  2102. /**/
  2103. }
  2104. onformdata() {
  2105. /**/
  2106. }
  2107. onfullscreenchange() {
  2108. /**/
  2109. }
  2110. onfullscreenerror() {
  2111. /**/
  2112. }
  2113. ongotpointercapture() {
  2114. /**/
  2115. }
  2116. oninput() {
  2117. /**/
  2118. }
  2119. oninvalid() {
  2120. /**/
  2121. }
  2122. onkeydown() {
  2123. /**/
  2124. }
  2125. onkeypress() {
  2126. /**/
  2127. }
  2128. onkeyup() {
  2129. /**/
  2130. }
  2131. onload() {
  2132. /**/
  2133. }
  2134. onloadeddata() {
  2135. /**/
  2136. }
  2137. onloadedmetadata() {
  2138. /**/
  2139. }
  2140. onloadstart() {
  2141. /**/
  2142. }
  2143. onlostpointercapture() {
  2144. /**/
  2145. }
  2146. onmousedown() {
  2147. /**/
  2148. }
  2149. onmouseenter() {
  2150. /**/
  2151. }
  2152. onmouseleave() {
  2153. /**/
  2154. }
  2155. onmousemove() {
  2156. /**/
  2157. }
  2158. onmouseout() {
  2159. /**/
  2160. }
  2161. onmouseover() {
  2162. /**/
  2163. }
  2164. onmouseup() {
  2165. /**/
  2166. }
  2167. onmousewheel() {
  2168. /**/
  2169. }
  2170. onpaste() {
  2171. /**/
  2172. }
  2173. onpause() {
  2174. /**/
  2175. }
  2176. onplay() {
  2177. /**/
  2178. }
  2179. onplaying() {
  2180. /**/
  2181. }
  2182. onpointercancel() {
  2183. /**/
  2184. }
  2185. onpointerdown() {
  2186. /**/
  2187. }
  2188. onpointerenter() {
  2189. /**/
  2190. }
  2191. onpointerleave() {
  2192. /**/
  2193. }
  2194. onpointermove() {
  2195. /**/
  2196. }
  2197. onpointerout() {
  2198. /**/
  2199. }
  2200. onpointerover() {
  2201. /**/
  2202. }
  2203. onpointerup() {
  2204. /**/
  2205. }
  2206. onprogress() {
  2207. /**/
  2208. }
  2209. onratechange() {
  2210. /**/
  2211. }
  2212. onreset() {
  2213. /**/
  2214. }
  2215. onresize() {
  2216. /**/
  2217. }
  2218. onscroll() {
  2219. /**/
  2220. }
  2221. onsearch() {
  2222. /**/
  2223. }
  2224. onseeked() {
  2225. /**/
  2226. }
  2227. onseeking() {
  2228. /**/
  2229. }
  2230. onselect() {
  2231. /**/
  2232. }
  2233. onselectstart() {
  2234. /**/
  2235. }
  2236. onstalled() {
  2237. /**/
  2238. }
  2239. onsubmit() {
  2240. /**/
  2241. }
  2242. onsuspend() {
  2243. /**/
  2244. }
  2245. ontimeupdate() {
  2246. /**/
  2247. }
  2248. ontoggle() {
  2249. /**/
  2250. }
  2251. onvolumechange() {
  2252. /**/
  2253. }
  2254. onwaiting() {
  2255. /**/
  2256. }
  2257. onwebkitfullscreenchange() {
  2258. /**/
  2259. }
  2260. onwebkitfullscreenerror() {
  2261. /**/
  2262. }
  2263. onwheel() {
  2264. /**/
  2265. }
  2266. toString(opts) {
  2267. return serializeNodeToHtml(this, opts);
  2268. }
  2269. }
  2270. function getElementsByClassName(elm, classNames, foundElms) {
  2271. const children = elm.children;
  2272. for (let i = 0, ii = children.length; i < ii; i++) {
  2273. const childElm = children[i];
  2274. for (let j = 0, jj = classNames.length; j < jj; j++) {
  2275. if (childElm.classList.contains(classNames[j])) {
  2276. foundElms.push(childElm);
  2277. }
  2278. }
  2279. getElementsByClassName(childElm, classNames, foundElms);
  2280. }
  2281. }
  2282. function getElementsByTagName(elm, tagName, foundElms) {
  2283. const children = elm.children;
  2284. for (let i = 0, ii = children.length; i < ii; i++) {
  2285. const childElm = children[i];
  2286. if (tagName === '*' || childElm.nodeName.toLowerCase() === tagName) {
  2287. foundElms.push(childElm);
  2288. }
  2289. getElementsByTagName(childElm, tagName, foundElms);
  2290. }
  2291. }
  2292. function resetElement(elm) {
  2293. resetEventListeners(elm);
  2294. delete elm.__attributeMap;
  2295. delete elm.__shadowRoot;
  2296. delete elm.__style;
  2297. }
  2298. function insertBefore(parentNode, newNode, referenceNode) {
  2299. if (newNode !== referenceNode) {
  2300. newNode.remove();
  2301. newNode.parentNode = parentNode;
  2302. newNode.ownerDocument = parentNode.ownerDocument;
  2303. if (referenceNode != null) {
  2304. const index = parentNode.childNodes.indexOf(referenceNode);
  2305. if (index > -1) {
  2306. parentNode.childNodes.splice(index, 0, newNode);
  2307. }
  2308. else {
  2309. throw new Error(`referenceNode not found in parentNode.childNodes`);
  2310. }
  2311. }
  2312. else {
  2313. parentNode.childNodes.push(newNode);
  2314. }
  2315. connectNode(parentNode.ownerDocument, newNode);
  2316. }
  2317. return newNode;
  2318. }
  2319. class MockHTMLElement extends MockElement {
  2320. constructor(ownerDocument, nodeName) {
  2321. super(ownerDocument, typeof nodeName === 'string' ? nodeName.toUpperCase() : null);
  2322. this.namespaceURI = 'http://www.w3.org/1999/xhtml';
  2323. }
  2324. get tagName() {
  2325. return this.nodeName;
  2326. }
  2327. set tagName(value) {
  2328. this.nodeName = value;
  2329. }
  2330. get attributes() {
  2331. if (this.__attributeMap == null) {
  2332. this.__attributeMap = createAttributeProxy(true);
  2333. }
  2334. return this.__attributeMap;
  2335. }
  2336. set attributes(attrs) {
  2337. this.__attributeMap = attrs;
  2338. }
  2339. }
  2340. class MockTextNode extends MockNode {
  2341. constructor(ownerDocument, text) {
  2342. super(ownerDocument, 3 /* TEXT_NODE */, "#text" /* TEXT_NODE */, text);
  2343. }
  2344. cloneNode(_deep) {
  2345. return new MockTextNode(null, this.nodeValue);
  2346. }
  2347. get textContent() {
  2348. return this.nodeValue;
  2349. }
  2350. set textContent(text) {
  2351. this.nodeValue = text;
  2352. }
  2353. get data() {
  2354. return this.nodeValue;
  2355. }
  2356. set data(text) {
  2357. this.nodeValue = text;
  2358. }
  2359. get wholeText() {
  2360. if (this.parentNode != null) {
  2361. const text = [];
  2362. for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
  2363. const childNode = this.parentNode.childNodes[i];
  2364. if (childNode.nodeType === 3 /* TEXT_NODE */) {
  2365. text.push(childNode.nodeValue);
  2366. }
  2367. }
  2368. return text.join('');
  2369. }
  2370. return this.nodeValue;
  2371. }
  2372. }
  2373. function getTextContent(childNodes, text) {
  2374. for (let i = 0, ii = childNodes.length; i < ii; i++) {
  2375. const childNode = childNodes[i];
  2376. if (childNode.nodeType === 3 /* TEXT_NODE */) {
  2377. text.push(childNode.nodeValue);
  2378. }
  2379. else if (childNode.nodeType === 1 /* ELEMENT_NODE */) {
  2380. getTextContent(childNode.childNodes, text);
  2381. }
  2382. }
  2383. }
  2384. function setTextContent(elm, text) {
  2385. for (let i = elm.childNodes.length - 1; i >= 0; i--) {
  2386. elm.removeChild(elm.childNodes[i]);
  2387. }
  2388. const textNode = new MockTextNode(elm.ownerDocument, text);
  2389. elm.appendChild(textNode);
  2390. }
  2391. class MockComment extends MockNode {
  2392. constructor(ownerDocument, data) {
  2393. super(ownerDocument, 8 /* COMMENT_NODE */, "#comment" /* COMMENT_NODE */, data);
  2394. }
  2395. cloneNode(_deep) {
  2396. return new MockComment(null, this.nodeValue);
  2397. }
  2398. get textContent() {
  2399. return this.nodeValue;
  2400. }
  2401. set textContent(text) {
  2402. this.nodeValue = text;
  2403. }
  2404. }
  2405. class MockDocumentFragment extends MockHTMLElement {
  2406. constructor(ownerDocument) {
  2407. super(ownerDocument, null);
  2408. this.nodeName = "#document-fragment" /* DOCUMENT_FRAGMENT_NODE */;
  2409. this.nodeType = 11 /* DOCUMENT_FRAGMENT_NODE */;
  2410. }
  2411. getElementById(id) {
  2412. return getElementById(this, id);
  2413. }
  2414. cloneNode(deep) {
  2415. const cloned = new MockDocumentFragment(null);
  2416. if (deep) {
  2417. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  2418. const childNode = this.childNodes[i];
  2419. if (childNode.nodeType === 1 /* ELEMENT_NODE */ ||
  2420. childNode.nodeType === 3 /* TEXT_NODE */ ||
  2421. childNode.nodeType === 8 /* COMMENT_NODE */) {
  2422. const clonedChildNode = this.childNodes[i].cloneNode(true);
  2423. cloned.appendChild(clonedChildNode);
  2424. }
  2425. }
  2426. }
  2427. return cloned;
  2428. }
  2429. }
  2430. class MockDocumentTypeNode extends MockHTMLElement {
  2431. constructor(ownerDocument) {
  2432. super(ownerDocument, '!DOCTYPE');
  2433. this.nodeType = 10 /* DOCUMENT_TYPE_NODE */;
  2434. this.setAttribute('html', '');
  2435. }
  2436. }
  2437. class MockCSSRule {
  2438. constructor(parentStyleSheet) {
  2439. this.parentStyleSheet = parentStyleSheet;
  2440. this.cssText = '';
  2441. this.type = 0;
  2442. }
  2443. }
  2444. class MockCSSStyleSheet {
  2445. constructor(ownerNode) {
  2446. this.type = 'text/css';
  2447. this.parentStyleSheet = null;
  2448. this.cssRules = [];
  2449. this.ownerNode = ownerNode;
  2450. }
  2451. get rules() {
  2452. return this.cssRules;
  2453. }
  2454. set rules(rules) {
  2455. this.cssRules = rules;
  2456. }
  2457. deleteRule(index) {
  2458. if (index >= 0 && index < this.cssRules.length) {
  2459. this.cssRules.splice(index, 1);
  2460. updateStyleTextNode(this.ownerNode);
  2461. }
  2462. }
  2463. insertRule(rule, index = 0) {
  2464. if (typeof index !== 'number') {
  2465. index = 0;
  2466. }
  2467. if (index < 0) {
  2468. index = 0;
  2469. }
  2470. if (index > this.cssRules.length) {
  2471. index = this.cssRules.length;
  2472. }
  2473. const cssRule = new MockCSSRule(this);
  2474. cssRule.cssText = rule;
  2475. this.cssRules.splice(index, 0, cssRule);
  2476. updateStyleTextNode(this.ownerNode);
  2477. return index;
  2478. }
  2479. }
  2480. function getStyleElementText(styleElm) {
  2481. const output = [];
  2482. for (let i = 0; i < styleElm.childNodes.length; i++) {
  2483. output.push(styleElm.childNodes[i].nodeValue);
  2484. }
  2485. return output.join('');
  2486. }
  2487. function setStyleElementText(styleElm, text) {
  2488. // keeping the innerHTML and the sheet.cssRules connected
  2489. // is not technically correct, but since we're doing
  2490. // SSR we'll need to turn any assigned cssRules into
  2491. // real text, not just properties that aren't rendered
  2492. const sheet = styleElm.sheet;
  2493. sheet.cssRules.length = 0;
  2494. sheet.insertRule(text);
  2495. updateStyleTextNode(styleElm);
  2496. }
  2497. function updateStyleTextNode(styleElm) {
  2498. const childNodeLen = styleElm.childNodes.length;
  2499. if (childNodeLen > 1) {
  2500. for (let i = childNodeLen - 1; i >= 1; i--) {
  2501. styleElm.removeChild(styleElm.childNodes[i]);
  2502. }
  2503. }
  2504. else if (childNodeLen < 1) {
  2505. styleElm.appendChild(styleElm.ownerDocument.createTextNode(''));
  2506. }
  2507. const textNode = styleElm.childNodes[0];
  2508. textNode.nodeValue = styleElm.sheet.cssRules.map((r) => r.cssText).join('\n');
  2509. }
  2510. function createElement(ownerDocument, tagName) {
  2511. if (typeof tagName !== 'string' || tagName === '' || !/^[a-z0-9-_:]+$/i.test(tagName)) {
  2512. throw new Error(`The tag name provided (${tagName}) is not a valid name.`);
  2513. }
  2514. tagName = tagName.toLowerCase();
  2515. switch (tagName) {
  2516. case 'a':
  2517. return new MockAnchorElement(ownerDocument);
  2518. case 'base':
  2519. return new MockBaseElement(ownerDocument);
  2520. case 'button':
  2521. return new MockButtonElement(ownerDocument);
  2522. case 'canvas':
  2523. return new MockCanvasElement(ownerDocument);
  2524. case 'form':
  2525. return new MockFormElement(ownerDocument);
  2526. case 'img':
  2527. return new MockImageElement(ownerDocument);
  2528. case 'input':
  2529. return new MockInputElement(ownerDocument);
  2530. case 'link':
  2531. return new MockLinkElement(ownerDocument);
  2532. case 'meta':
  2533. return new MockMetaElement(ownerDocument);
  2534. case 'script':
  2535. return new MockScriptElement(ownerDocument);
  2536. case 'style':
  2537. return new MockStyleElement(ownerDocument);
  2538. case 'template':
  2539. return new MockTemplateElement(ownerDocument);
  2540. case 'title':
  2541. return new MockTitleElement(ownerDocument);
  2542. }
  2543. if (ownerDocument != null && tagName.includes('-')) {
  2544. const win = ownerDocument.defaultView;
  2545. if (win != null && win.customElements != null) {
  2546. return createCustomElement(win.customElements, ownerDocument, tagName);
  2547. }
  2548. }
  2549. return new MockHTMLElement(ownerDocument, tagName);
  2550. }
  2551. function createElementNS(ownerDocument, namespaceURI, tagName) {
  2552. if (namespaceURI === 'http://www.w3.org/1999/xhtml') {
  2553. return createElement(ownerDocument, tagName);
  2554. }
  2555. else if (namespaceURI === 'http://www.w3.org/2000/svg') {
  2556. return new MockSVGElement(ownerDocument, tagName);
  2557. }
  2558. else {
  2559. return new MockElement(ownerDocument, tagName);
  2560. }
  2561. }
  2562. class MockAnchorElement extends MockHTMLElement {
  2563. constructor(ownerDocument) {
  2564. super(ownerDocument, 'a');
  2565. }
  2566. get href() {
  2567. return fullUrl(this, 'href');
  2568. }
  2569. set href(value) {
  2570. this.setAttribute('href', value);
  2571. }
  2572. get pathname() {
  2573. return new URL(this.href).pathname;
  2574. }
  2575. }
  2576. class MockButtonElement extends MockHTMLElement {
  2577. constructor(ownerDocument) {
  2578. super(ownerDocument, 'button');
  2579. }
  2580. }
  2581. patchPropAttributes(MockButtonElement.prototype, {
  2582. type: String,
  2583. }, {
  2584. type: 'submit',
  2585. });
  2586. class MockImageElement extends MockHTMLElement {
  2587. constructor(ownerDocument) {
  2588. super(ownerDocument, 'img');
  2589. }
  2590. get draggable() {
  2591. return this.getAttributeNS(null, 'draggable') !== 'false';
  2592. }
  2593. set draggable(value) {
  2594. this.setAttributeNS(null, 'draggable', value);
  2595. }
  2596. get src() {
  2597. return fullUrl(this, 'src');
  2598. }
  2599. set src(value) {
  2600. this.setAttribute('src', value);
  2601. }
  2602. }
  2603. patchPropAttributes(MockImageElement.prototype, {
  2604. height: Number,
  2605. width: Number,
  2606. });
  2607. class MockInputElement extends MockHTMLElement {
  2608. constructor(ownerDocument) {
  2609. super(ownerDocument, 'input');
  2610. }
  2611. get list() {
  2612. const listId = this.getAttribute('list');
  2613. if (listId) {
  2614. return this.ownerDocument.getElementById(listId);
  2615. }
  2616. return null;
  2617. }
  2618. }
  2619. patchPropAttributes(MockInputElement.prototype, {
  2620. accept: String,
  2621. autocomplete: String,
  2622. autofocus: Boolean,
  2623. capture: String,
  2624. checked: Boolean,
  2625. disabled: Boolean,
  2626. form: String,
  2627. formaction: String,
  2628. formenctype: String,
  2629. formmethod: String,
  2630. formnovalidate: String,
  2631. formtarget: String,
  2632. height: Number,
  2633. inputmode: String,
  2634. max: String,
  2635. maxLength: Number,
  2636. min: String,
  2637. minLength: Number,
  2638. multiple: Boolean,
  2639. name: String,
  2640. pattern: String,
  2641. placeholder: String,
  2642. required: Boolean,
  2643. readOnly: Boolean,
  2644. size: Number,
  2645. spellCheck: Boolean,
  2646. src: String,
  2647. step: String,
  2648. type: String,
  2649. value: String,
  2650. width: Number,
  2651. }, {
  2652. type: 'text',
  2653. });
  2654. class MockFormElement extends MockHTMLElement {
  2655. constructor(ownerDocument) {
  2656. super(ownerDocument, 'form');
  2657. }
  2658. }
  2659. patchPropAttributes(MockFormElement.prototype, {
  2660. name: String,
  2661. });
  2662. class MockLinkElement extends MockHTMLElement {
  2663. constructor(ownerDocument) {
  2664. super(ownerDocument, 'link');
  2665. }
  2666. get href() {
  2667. return fullUrl(this, 'href');
  2668. }
  2669. set href(value) {
  2670. this.setAttribute('href', value);
  2671. }
  2672. }
  2673. patchPropAttributes(MockLinkElement.prototype, {
  2674. crossorigin: String,
  2675. media: String,
  2676. rel: String,
  2677. type: String,
  2678. });
  2679. class MockMetaElement extends MockHTMLElement {
  2680. constructor(ownerDocument) {
  2681. super(ownerDocument, 'meta');
  2682. }
  2683. }
  2684. patchPropAttributes(MockMetaElement.prototype, {
  2685. charset: String,
  2686. content: String,
  2687. name: String,
  2688. });
  2689. class MockScriptElement extends MockHTMLElement {
  2690. constructor(ownerDocument) {
  2691. super(ownerDocument, 'script');
  2692. }
  2693. get src() {
  2694. return fullUrl(this, 'src');
  2695. }
  2696. set src(value) {
  2697. this.setAttribute('src', value);
  2698. }
  2699. }
  2700. patchPropAttributes(MockScriptElement.prototype, {
  2701. type: String,
  2702. });
  2703. class MockStyleElement extends MockHTMLElement {
  2704. constructor(ownerDocument) {
  2705. super(ownerDocument, 'style');
  2706. this.sheet = new MockCSSStyleSheet(this);
  2707. }
  2708. get innerHTML() {
  2709. return getStyleElementText(this);
  2710. }
  2711. set innerHTML(value) {
  2712. setStyleElementText(this, value);
  2713. }
  2714. get innerText() {
  2715. return getStyleElementText(this);
  2716. }
  2717. set innerText(value) {
  2718. setStyleElementText(this, value);
  2719. }
  2720. get textContent() {
  2721. return getStyleElementText(this);
  2722. }
  2723. set textContent(value) {
  2724. setStyleElementText(this, value);
  2725. }
  2726. }
  2727. class MockSVGElement extends MockElement {
  2728. // SVGElement properties and methods
  2729. get ownerSVGElement() {
  2730. return null;
  2731. }
  2732. get viewportElement() {
  2733. return null;
  2734. }
  2735. focus() {
  2736. /**/
  2737. }
  2738. onunload() {
  2739. /**/
  2740. }
  2741. // SVGGeometryElement properties and methods
  2742. get pathLength() {
  2743. return 0;
  2744. }
  2745. isPointInFill(_pt) {
  2746. return false;
  2747. }
  2748. isPointInStroke(_pt) {
  2749. return false;
  2750. }
  2751. getTotalLength() {
  2752. return 0;
  2753. }
  2754. }
  2755. class MockBaseElement extends MockHTMLElement {
  2756. constructor(ownerDocument) {
  2757. super(ownerDocument, 'base');
  2758. }
  2759. get href() {
  2760. return fullUrl(this, 'href');
  2761. }
  2762. set href(value) {
  2763. this.setAttribute('href', value);
  2764. }
  2765. }
  2766. class MockTemplateElement extends MockHTMLElement {
  2767. constructor(ownerDocument) {
  2768. super(ownerDocument, 'template');
  2769. this.content = new MockDocumentFragment(ownerDocument);
  2770. }
  2771. get innerHTML() {
  2772. return this.content.innerHTML;
  2773. }
  2774. set innerHTML(html) {
  2775. this.content.innerHTML = html;
  2776. }
  2777. cloneNode(deep) {
  2778. const cloned = new MockTemplateElement(null);
  2779. cloned.attributes = cloneAttributes(this.attributes);
  2780. const styleCssText = this.getAttribute('style');
  2781. if (styleCssText != null && styleCssText.length > 0) {
  2782. cloned.setAttribute('style', styleCssText);
  2783. }
  2784. cloned.content = this.content.cloneNode(deep);
  2785. if (deep) {
  2786. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  2787. const clonedChildNode = this.childNodes[i].cloneNode(true);
  2788. cloned.appendChild(clonedChildNode);
  2789. }
  2790. }
  2791. return cloned;
  2792. }
  2793. }
  2794. class MockTitleElement extends MockHTMLElement {
  2795. constructor(ownerDocument) {
  2796. super(ownerDocument, 'title');
  2797. }
  2798. get text() {
  2799. return this.textContent;
  2800. }
  2801. set text(value) {
  2802. this.textContent = value;
  2803. }
  2804. }
  2805. class MockCanvasElement extends MockHTMLElement {
  2806. constructor(ownerDocument) {
  2807. super(ownerDocument, 'canvas');
  2808. }
  2809. getContext() {
  2810. return {
  2811. fillRect() {
  2812. return;
  2813. },
  2814. clearRect() { },
  2815. getImageData: function (_, __, w, h) {
  2816. return {
  2817. data: new Array(w * h * 4),
  2818. };
  2819. },
  2820. putImageData() { },
  2821. createImageData: function () {
  2822. return [];
  2823. },
  2824. setTransform() { },
  2825. drawImage() { },
  2826. save() { },
  2827. fillText() { },
  2828. restore() { },
  2829. beginPath() { },
  2830. moveTo() { },
  2831. lineTo() { },
  2832. closePath() { },
  2833. stroke() { },
  2834. translate() { },
  2835. scale() { },
  2836. rotate() { },
  2837. arc() { },
  2838. fill() { },
  2839. measureText() {
  2840. return { width: 0 };
  2841. },
  2842. transform() { },
  2843. rect() { },
  2844. clip() { },
  2845. };
  2846. }
  2847. }
  2848. function fullUrl(elm, attrName) {
  2849. const val = elm.getAttribute(attrName) || '';
  2850. if (elm.ownerDocument != null) {
  2851. const win = elm.ownerDocument.defaultView;
  2852. if (win != null) {
  2853. const loc = win.location;
  2854. if (loc != null) {
  2855. try {
  2856. const url = new URL(val, loc.href);
  2857. return url.href;
  2858. }
  2859. catch (e) { }
  2860. }
  2861. }
  2862. }
  2863. return val.replace(/\'|\"/g, '').trim();
  2864. }
  2865. function patchPropAttributes(prototype, attrs, defaults = {}) {
  2866. Object.keys(attrs).forEach((propName) => {
  2867. const attr = attrs[propName];
  2868. const defaultValue = defaults[propName];
  2869. if (attr === Boolean) {
  2870. Object.defineProperty(prototype, propName, {
  2871. get() {
  2872. return this.hasAttribute(propName);
  2873. },
  2874. set(value) {
  2875. if (value) {
  2876. this.setAttribute(propName, '');
  2877. }
  2878. else {
  2879. this.removeAttribute(propName);
  2880. }
  2881. },
  2882. });
  2883. }
  2884. else if (attr === Number) {
  2885. Object.defineProperty(prototype, propName, {
  2886. get() {
  2887. const value = this.getAttribute(propName);
  2888. return value ? parseInt(value, 10) : defaultValue === undefined ? 0 : defaultValue;
  2889. },
  2890. set(value) {
  2891. this.setAttribute(propName, value);
  2892. },
  2893. });
  2894. }
  2895. else {
  2896. Object.defineProperty(prototype, propName, {
  2897. get() {
  2898. return this.hasAttribute(propName) ? this.getAttribute(propName) : defaultValue || '';
  2899. },
  2900. set(value) {
  2901. this.setAttribute(propName, value);
  2902. },
  2903. });
  2904. }
  2905. });
  2906. }
  2907. MockElement.prototype.cloneNode = function (deep) {
  2908. // because we're creating elements, which extending specific HTML base classes there
  2909. // is a MockElement circular reference that bundling has trouble dealing with so
  2910. // the fix is to add cloneNode() to MockElement's prototype after the HTML classes
  2911. const cloned = createElement(this.ownerDocument, this.nodeName);
  2912. cloned.attributes = cloneAttributes(this.attributes);
  2913. const styleCssText = this.getAttribute('style');
  2914. if (styleCssText != null && styleCssText.length > 0) {
  2915. cloned.setAttribute('style', styleCssText);
  2916. }
  2917. if (deep) {
  2918. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  2919. const clonedChildNode = this.childNodes[i].cloneNode(true);
  2920. cloned.appendChild(clonedChildNode);
  2921. }
  2922. }
  2923. return cloned;
  2924. };
  2925. let sharedDocument;
  2926. function parseHtmlToDocument(html, ownerDocument = null) {
  2927. if (ownerDocument == null) {
  2928. if (sharedDocument == null) {
  2929. sharedDocument = new MockDocument();
  2930. }
  2931. ownerDocument = sharedDocument;
  2932. }
  2933. return parseDocumentUtil(ownerDocument, html);
  2934. }
  2935. function parseHtmlToFragment(html, ownerDocument = null) {
  2936. if (ownerDocument == null) {
  2937. if (sharedDocument == null) {
  2938. sharedDocument = new MockDocument();
  2939. }
  2940. ownerDocument = sharedDocument;
  2941. }
  2942. return parseFragmentUtil(ownerDocument, html);
  2943. }
  2944. class MockHeaders {
  2945. constructor(init) {
  2946. this._values = [];
  2947. if (typeof init === 'object') {
  2948. if (typeof init[Symbol.iterator] === 'function') {
  2949. const kvs = [];
  2950. for (const kv of init) {
  2951. if (typeof kv[Symbol.iterator] === 'function') {
  2952. kvs.push([...kv]);
  2953. }
  2954. }
  2955. for (const kv of kvs) {
  2956. this.append(kv[0], kv[1]);
  2957. }
  2958. }
  2959. else {
  2960. for (const key in init) {
  2961. this.append(key, init[key]);
  2962. }
  2963. }
  2964. }
  2965. }
  2966. append(key, value) {
  2967. this._values.push([key, value + '']);
  2968. }
  2969. delete(key) {
  2970. key = key.toLowerCase();
  2971. for (let i = this._values.length - 1; i >= 0; i--) {
  2972. if (this._values[i][0].toLowerCase() === key) {
  2973. this._values.splice(i, 1);
  2974. }
  2975. }
  2976. }
  2977. entries() {
  2978. const entries = [];
  2979. for (const kv of this.keys()) {
  2980. entries.push([kv, this.get(kv)]);
  2981. }
  2982. let index = -1;
  2983. return {
  2984. next() {
  2985. index++;
  2986. return {
  2987. value: entries[index],
  2988. done: !entries[index],
  2989. };
  2990. },
  2991. [Symbol.iterator]() {
  2992. return this;
  2993. },
  2994. };
  2995. }
  2996. forEach(cb) {
  2997. for (const kv of this.entries()) {
  2998. cb(kv[1], kv[0]);
  2999. }
  3000. }
  3001. get(key) {
  3002. const rtn = [];
  3003. key = key.toLowerCase();
  3004. for (const kv of this._values) {
  3005. if (kv[0].toLowerCase() === key) {
  3006. rtn.push(kv[1]);
  3007. }
  3008. }
  3009. return rtn.length > 0 ? rtn.join(', ') : null;
  3010. }
  3011. has(key) {
  3012. key = key.toLowerCase();
  3013. for (const kv of this._values) {
  3014. if (kv[0].toLowerCase() === key) {
  3015. return true;
  3016. }
  3017. }
  3018. return false;
  3019. }
  3020. keys() {
  3021. const keys = [];
  3022. for (const kv of this._values) {
  3023. const key = kv[0].toLowerCase();
  3024. if (!keys.includes(key)) {
  3025. keys.push(key);
  3026. }
  3027. }
  3028. let index = -1;
  3029. return {
  3030. next() {
  3031. index++;
  3032. return {
  3033. value: keys[index],
  3034. done: !keys[index],
  3035. };
  3036. },
  3037. [Symbol.iterator]() {
  3038. return this;
  3039. },
  3040. };
  3041. }
  3042. set(key, value) {
  3043. for (const kv of this._values) {
  3044. if (kv[0].toLowerCase() === key.toLowerCase()) {
  3045. kv[1] = value + '';
  3046. return;
  3047. }
  3048. }
  3049. this.append(key, value);
  3050. }
  3051. values() {
  3052. const values = this._values;
  3053. let index = -1;
  3054. return {
  3055. next() {
  3056. index++;
  3057. const done = !values[index];
  3058. return {
  3059. value: done ? undefined : values[index][1],
  3060. done,
  3061. };
  3062. },
  3063. [Symbol.iterator]() {
  3064. return this;
  3065. },
  3066. };
  3067. }
  3068. [Symbol.iterator]() {
  3069. return this.entries();
  3070. }
  3071. }
  3072. class MockRequest {
  3073. constructor(input, init = {}) {
  3074. this._method = 'GET';
  3075. this._url = '/';
  3076. this.bodyUsed = false;
  3077. this.cache = 'default';
  3078. this.credentials = 'same-origin';
  3079. this.integrity = '';
  3080. this.keepalive = false;
  3081. this.mode = 'cors';
  3082. this.redirect = 'follow';
  3083. this.referrer = 'about:client';
  3084. this.referrerPolicy = '';
  3085. if (typeof input === 'string') {
  3086. this.url = input;
  3087. }
  3088. else if (input) {
  3089. Object.assign(this, input);
  3090. this.headers = new MockHeaders(input.headers);
  3091. }
  3092. Object.assign(this, init);
  3093. if (init.headers) {
  3094. this.headers = new MockHeaders(init.headers);
  3095. }
  3096. if (!this.headers) {
  3097. this.headers = new MockHeaders();
  3098. }
  3099. }
  3100. get url() {
  3101. if (typeof this._url === 'string') {
  3102. return new URL(this._url, location.href).href;
  3103. }
  3104. return new URL('/', location.href).href;
  3105. }
  3106. set url(value) {
  3107. this._url = value;
  3108. }
  3109. get method() {
  3110. if (typeof this._method === 'string') {
  3111. return this._method.toUpperCase();
  3112. }
  3113. return 'GET';
  3114. }
  3115. set method(value) {
  3116. this._method = value;
  3117. }
  3118. clone() {
  3119. const clone = { ...this };
  3120. clone.headers = new MockHeaders(this.headers);
  3121. return new MockRequest(clone);
  3122. }
  3123. }
  3124. class MockResponse {
  3125. constructor(body, init = {}) {
  3126. this.ok = true;
  3127. this.status = 200;
  3128. this.statusText = '';
  3129. this.type = 'default';
  3130. this.url = '';
  3131. this._body = body;
  3132. if (init) {
  3133. Object.assign(this, init);
  3134. }
  3135. this.headers = new MockHeaders(init.headers);
  3136. }
  3137. async json() {
  3138. return JSON.parse(this._body);
  3139. }
  3140. async text() {
  3141. return this._body;
  3142. }
  3143. clone() {
  3144. const initClone = { ...this };
  3145. initClone.headers = new MockHeaders(this.headers);
  3146. return new MockResponse(this._body, initClone);
  3147. }
  3148. }
  3149. class MockDOMParser {
  3150. parseFromString(htmlToParse, mimeType) {
  3151. if (mimeType !== 'text/html') {
  3152. console.error('XML parsing not implemented yet, continuing as html');
  3153. }
  3154. return parseHtmlToDocument(htmlToParse);
  3155. }
  3156. }
  3157. function setupGlobal(gbl) {
  3158. if (gbl.window == null) {
  3159. const win = (gbl.window = new MockWindow());
  3160. WINDOW_FUNCTIONS.forEach((fnName) => {
  3161. if (!(fnName in gbl)) {
  3162. gbl[fnName] = win[fnName].bind(win);
  3163. }
  3164. });
  3165. WINDOW_PROPS.forEach((propName) => {
  3166. if (!(propName in gbl)) {
  3167. Object.defineProperty(gbl, propName, {
  3168. get() {
  3169. return win[propName];
  3170. },
  3171. set(val) {
  3172. win[propName] = val;
  3173. },
  3174. configurable: true,
  3175. enumerable: true,
  3176. });
  3177. }
  3178. });
  3179. GLOBAL_CONSTRUCTORS.forEach(([cstrName]) => {
  3180. gbl[cstrName] = win[cstrName];
  3181. });
  3182. }
  3183. return gbl.window;
  3184. }
  3185. function teardownGlobal(gbl) {
  3186. const win = gbl.window;
  3187. if (win && typeof win.close === 'function') {
  3188. win.close();
  3189. }
  3190. }
  3191. function patchWindow(winToBePatched) {
  3192. const mockWin = new MockWindow(false);
  3193. WINDOW_FUNCTIONS.forEach((fnName) => {
  3194. if (typeof winToBePatched[fnName] !== 'function') {
  3195. winToBePatched[fnName] = mockWin[fnName].bind(mockWin);
  3196. }
  3197. });
  3198. WINDOW_PROPS.forEach((propName) => {
  3199. if (winToBePatched === undefined) {
  3200. Object.defineProperty(winToBePatched, propName, {
  3201. get() {
  3202. return mockWin[propName];
  3203. },
  3204. set(val) {
  3205. mockWin[propName] = val;
  3206. },
  3207. configurable: true,
  3208. enumerable: true,
  3209. });
  3210. }
  3211. });
  3212. }
  3213. function addGlobalsToWindowPrototype(mockWinPrototype) {
  3214. GLOBAL_CONSTRUCTORS.forEach(([cstrName, Cstr]) => {
  3215. Object.defineProperty(mockWinPrototype, cstrName, {
  3216. get() {
  3217. return this['__' + cstrName] || Cstr;
  3218. },
  3219. set(cstr) {
  3220. this['__' + cstrName] = cstr;
  3221. },
  3222. configurable: true,
  3223. enumerable: true,
  3224. });
  3225. });
  3226. }
  3227. const WINDOW_FUNCTIONS = [
  3228. 'addEventListener',
  3229. 'alert',
  3230. 'blur',
  3231. 'cancelAnimationFrame',
  3232. 'cancelIdleCallback',
  3233. 'clearInterval',
  3234. 'clearTimeout',
  3235. 'close',
  3236. 'confirm',
  3237. 'dispatchEvent',
  3238. 'focus',
  3239. 'getComputedStyle',
  3240. 'matchMedia',
  3241. 'open',
  3242. 'prompt',
  3243. 'removeEventListener',
  3244. 'requestAnimationFrame',
  3245. 'requestIdleCallback',
  3246. 'URL',
  3247. ];
  3248. const WINDOW_PROPS = [
  3249. 'customElements',
  3250. 'devicePixelRatio',
  3251. 'document',
  3252. 'history',
  3253. 'innerHeight',
  3254. 'innerWidth',
  3255. 'localStorage',
  3256. 'location',
  3257. 'navigator',
  3258. 'pageXOffset',
  3259. 'pageYOffset',
  3260. 'performance',
  3261. 'screenLeft',
  3262. 'screenTop',
  3263. 'screenX',
  3264. 'screenY',
  3265. 'scrollX',
  3266. 'scrollY',
  3267. 'sessionStorage',
  3268. 'CSS',
  3269. 'CustomEvent',
  3270. 'Event',
  3271. 'Element',
  3272. 'HTMLElement',
  3273. 'Node',
  3274. 'NodeList',
  3275. 'KeyboardEvent',
  3276. 'MouseEvent',
  3277. ];
  3278. const GLOBAL_CONSTRUCTORS = [
  3279. ['CustomEvent', MockCustomEvent],
  3280. ['Event', MockEvent],
  3281. ['Headers', MockHeaders],
  3282. ['KeyboardEvent', MockKeyboardEvent],
  3283. ['MouseEvent', MockMouseEvent],
  3284. ['Request', MockRequest],
  3285. ['Response', MockResponse],
  3286. ['DOMParser', MockDOMParser],
  3287. ['HTMLAnchorElement', MockAnchorElement],
  3288. ['HTMLBaseElement', MockBaseElement],
  3289. ['HTMLButtonElement', MockButtonElement],
  3290. ['HTMLCanvasElement', MockCanvasElement],
  3291. ['HTMLFormElement', MockFormElement],
  3292. ['HTMLImageElement', MockImageElement],
  3293. ['HTMLInputElement', MockInputElement],
  3294. ['HTMLLinkElement', MockLinkElement],
  3295. ['HTMLMetaElement', MockMetaElement],
  3296. ['HTMLScriptElement', MockScriptElement],
  3297. ['HTMLStyleElement', MockStyleElement],
  3298. ['HTMLTemplateElement', MockTemplateElement],
  3299. ['HTMLTitleElement', MockTitleElement],
  3300. ];
  3301. const consoleNoop = () => {
  3302. /**/
  3303. };
  3304. function createConsole() {
  3305. return {
  3306. debug: consoleNoop,
  3307. error: consoleNoop,
  3308. info: consoleNoop,
  3309. log: consoleNoop,
  3310. warn: consoleNoop,
  3311. dir: consoleNoop,
  3312. dirxml: consoleNoop,
  3313. table: consoleNoop,
  3314. trace: consoleNoop,
  3315. group: consoleNoop,
  3316. groupCollapsed: consoleNoop,
  3317. groupEnd: consoleNoop,
  3318. clear: consoleNoop,
  3319. count: consoleNoop,
  3320. countReset: consoleNoop,
  3321. assert: consoleNoop,
  3322. profile: consoleNoop,
  3323. profileEnd: consoleNoop,
  3324. time: consoleNoop,
  3325. timeLog: consoleNoop,
  3326. timeEnd: consoleNoop,
  3327. timeStamp: consoleNoop,
  3328. context: consoleNoop,
  3329. memory: consoleNoop,
  3330. };
  3331. }
  3332. class MockHistory {
  3333. constructor() {
  3334. this.items = [];
  3335. }
  3336. get length() {
  3337. return this.items.length;
  3338. }
  3339. back() {
  3340. this.go(-1);
  3341. }
  3342. forward() {
  3343. this.go(1);
  3344. }
  3345. go(_value) {
  3346. //
  3347. }
  3348. pushState(_state, _title, _url) {
  3349. //
  3350. }
  3351. replaceState(_state, _title, _url) {
  3352. //
  3353. }
  3354. }
  3355. class MockIntersectionObserver {
  3356. constructor() {
  3357. /**/
  3358. }
  3359. disconnect() {
  3360. /**/
  3361. }
  3362. observe() {
  3363. /**/
  3364. }
  3365. takeRecords() {
  3366. return [];
  3367. }
  3368. unobserve() {
  3369. /**/
  3370. }
  3371. }
  3372. class MockLocation {
  3373. constructor() {
  3374. this.ancestorOrigins = null;
  3375. this.protocol = '';
  3376. this.host = '';
  3377. this.hostname = '';
  3378. this.port = '';
  3379. this.pathname = '';
  3380. this.search = '';
  3381. this.hash = '';
  3382. this.username = '';
  3383. this.password = '';
  3384. this.origin = '';
  3385. this._href = '';
  3386. }
  3387. get href() {
  3388. return this._href;
  3389. }
  3390. set href(value) {
  3391. const url = new URL(value, 'http://mockdoc.stenciljs.com');
  3392. this._href = url.href;
  3393. this.protocol = url.protocol;
  3394. this.host = url.host;
  3395. this.hostname = url.hostname;
  3396. this.port = url.port;
  3397. this.pathname = url.pathname;
  3398. this.search = url.search;
  3399. this.hash = url.hash;
  3400. this.username = url.username;
  3401. this.password = url.password;
  3402. this.origin = url.origin;
  3403. }
  3404. assign(_url) {
  3405. //
  3406. }
  3407. reload(_forcedReload) {
  3408. //
  3409. }
  3410. replace(_url) {
  3411. //
  3412. }
  3413. toString() {
  3414. return this.href;
  3415. }
  3416. }
  3417. class MockNavigator {
  3418. constructor() {
  3419. this.appCodeName = 'MockNavigator';
  3420. this.appName = 'MockNavigator';
  3421. this.appVersion = 'MockNavigator';
  3422. this.platform = 'MockNavigator';
  3423. this.userAgent = 'MockNavigator';
  3424. }
  3425. }
  3426. /**
  3427. * https://developer.mozilla.org/en-US/docs/Web/API/Performance
  3428. */
  3429. class MockPerformance {
  3430. constructor() {
  3431. this.timeOrigin = Date.now();
  3432. }
  3433. addEventListener() {
  3434. //
  3435. }
  3436. clearMarks() {
  3437. //
  3438. }
  3439. clearMeasures() {
  3440. //
  3441. }
  3442. clearResourceTimings() {
  3443. //
  3444. }
  3445. dispatchEvent() {
  3446. return true;
  3447. }
  3448. getEntries() {
  3449. return [];
  3450. }
  3451. getEntriesByName() {
  3452. return [];
  3453. }
  3454. getEntriesByType() {
  3455. return [];
  3456. }
  3457. // Stencil's implementation of `mark` is non-compliant with the `Performance` interface. Because Stencil will
  3458. // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
  3459. // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
  3460. // associated errors returned by the type checker)
  3461. // @ts-ignore
  3462. mark() {
  3463. //
  3464. }
  3465. // Stencil's implementation of `measure` is non-compliant with the `Performance` interface. Because Stencil will
  3466. // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
  3467. // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
  3468. // associated errors returned by the type checker)
  3469. // @ts-ignore
  3470. measure() {
  3471. //
  3472. }
  3473. get navigation() {
  3474. return {};
  3475. }
  3476. now() {
  3477. return Date.now() - this.timeOrigin;
  3478. }
  3479. get onresourcetimingbufferfull() {
  3480. return null;
  3481. }
  3482. removeEventListener() {
  3483. //
  3484. }
  3485. setResourceTimingBufferSize() {
  3486. //
  3487. }
  3488. get timing() {
  3489. return {};
  3490. }
  3491. toJSON() {
  3492. //
  3493. }
  3494. }
  3495. function resetPerformance(perf) {
  3496. if (perf != null) {
  3497. try {
  3498. perf.timeOrigin = Date.now();
  3499. }
  3500. catch (e) { }
  3501. }
  3502. }
  3503. class MockStorage {
  3504. constructor() {
  3505. this.items = new Map();
  3506. }
  3507. key(_value) {
  3508. //
  3509. }
  3510. getItem(key) {
  3511. key = String(key);
  3512. if (this.items.has(key)) {
  3513. return this.items.get(key);
  3514. }
  3515. return null;
  3516. }
  3517. setItem(key, value) {
  3518. if (value == null) {
  3519. value = 'null';
  3520. }
  3521. this.items.set(String(key), String(value));
  3522. }
  3523. removeItem(key) {
  3524. this.items.delete(String(key));
  3525. }
  3526. clear() {
  3527. this.items.clear();
  3528. }
  3529. }
  3530. const nativeClearInterval = clearInterval;
  3531. const nativeClearTimeout = clearTimeout;
  3532. const nativeSetInterval = setInterval;
  3533. const nativeSetTimeout = setTimeout;
  3534. const nativeURL = URL;
  3535. class MockWindow {
  3536. constructor(html = null) {
  3537. if (html !== false) {
  3538. this.document = new MockDocument(html, this);
  3539. }
  3540. else {
  3541. this.document = null;
  3542. }
  3543. this.performance = new MockPerformance();
  3544. this.customElements = new MockCustomElementRegistry(this);
  3545. this.console = createConsole();
  3546. resetWindowDefaults(this);
  3547. resetWindowDimensions(this);
  3548. }
  3549. addEventListener(type, handler) {
  3550. addEventListener(this, type, handler);
  3551. }
  3552. alert(msg) {
  3553. if (this.console) {
  3554. this.console.debug(msg);
  3555. }
  3556. else {
  3557. console.debug(msg);
  3558. }
  3559. }
  3560. blur() {
  3561. /**/
  3562. }
  3563. cancelAnimationFrame(id) {
  3564. this.__clearTimeout(id);
  3565. }
  3566. cancelIdleCallback(id) {
  3567. this.__clearTimeout(id);
  3568. }
  3569. get CharacterData() {
  3570. if (this.__charDataCstr == null) {
  3571. const ownerDocument = this.document;
  3572. this.__charDataCstr = class extends MockNode {
  3573. constructor() {
  3574. super(ownerDocument, 0, 'test', '');
  3575. throw new Error('Illegal constructor: cannot construct CharacterData');
  3576. }
  3577. };
  3578. }
  3579. return this.__charDataCstr;
  3580. }
  3581. set CharacterData(charDataCstr) {
  3582. this.__charDataCstr = charDataCstr;
  3583. }
  3584. clearInterval(id) {
  3585. this.__clearInterval(id);
  3586. }
  3587. clearTimeout(id) {
  3588. this.__clearTimeout(id);
  3589. }
  3590. close() {
  3591. resetWindow(this);
  3592. }
  3593. confirm() {
  3594. return false;
  3595. }
  3596. get CSS() {
  3597. return {
  3598. supports: () => true,
  3599. };
  3600. }
  3601. get Document() {
  3602. if (this.__docCstr == null) {
  3603. const win = this;
  3604. this.__docCstr = class extends MockDocument {
  3605. constructor() {
  3606. super(false, win);
  3607. throw new Error('Illegal constructor: cannot construct Document');
  3608. }
  3609. };
  3610. }
  3611. return this.__docCstr;
  3612. }
  3613. set Document(docCstr) {
  3614. this.__docCstr = docCstr;
  3615. }
  3616. get DocumentFragment() {
  3617. if (this.__docFragCstr == null) {
  3618. const ownerDocument = this.document;
  3619. this.__docFragCstr = class extends MockDocumentFragment {
  3620. constructor() {
  3621. super(ownerDocument);
  3622. throw new Error('Illegal constructor: cannot construct DocumentFragment');
  3623. }
  3624. };
  3625. }
  3626. return this.__docFragCstr;
  3627. }
  3628. set DocumentFragment(docFragCstr) {
  3629. this.__docFragCstr = docFragCstr;
  3630. }
  3631. get DocumentType() {
  3632. if (this.__docTypeCstr == null) {
  3633. const ownerDocument = this.document;
  3634. this.__docTypeCstr = class extends MockNode {
  3635. constructor() {
  3636. super(ownerDocument, 0, 'test', '');
  3637. throw new Error('Illegal constructor: cannot construct DocumentType');
  3638. }
  3639. };
  3640. }
  3641. return this.__docTypeCstr;
  3642. }
  3643. set DocumentType(docTypeCstr) {
  3644. this.__docTypeCstr = docTypeCstr;
  3645. }
  3646. get DOMTokenList() {
  3647. if (this.__domTokenListCstr == null) {
  3648. this.__domTokenListCstr = class MockDOMTokenList {
  3649. };
  3650. }
  3651. return this.__domTokenListCstr;
  3652. }
  3653. set DOMTokenList(domTokenListCstr) {
  3654. this.__domTokenListCstr = domTokenListCstr;
  3655. }
  3656. dispatchEvent(ev) {
  3657. return dispatchEvent(this, ev);
  3658. }
  3659. get Element() {
  3660. if (this.__elementCstr == null) {
  3661. const ownerDocument = this.document;
  3662. this.__elementCstr = class extends MockElement {
  3663. constructor() {
  3664. super(ownerDocument, '');
  3665. throw new Error('Illegal constructor: cannot construct Element');
  3666. }
  3667. };
  3668. }
  3669. return this.__elementCstr;
  3670. }
  3671. fetch(input, init) {
  3672. if (typeof fetch === 'function') {
  3673. return fetch(input, init);
  3674. }
  3675. throw new Error(`fetch() not implemented`);
  3676. }
  3677. focus() {
  3678. /**/
  3679. }
  3680. getComputedStyle(_) {
  3681. return {
  3682. cssText: '',
  3683. length: 0,
  3684. parentRule: null,
  3685. getPropertyPriority() {
  3686. return null;
  3687. },
  3688. getPropertyValue() {
  3689. return '';
  3690. },
  3691. item() {
  3692. return null;
  3693. },
  3694. removeProperty() {
  3695. return null;
  3696. },
  3697. setProperty() {
  3698. return null;
  3699. },
  3700. };
  3701. }
  3702. get globalThis() {
  3703. return this;
  3704. }
  3705. get history() {
  3706. if (this.__history == null) {
  3707. this.__history = new MockHistory();
  3708. }
  3709. return this.__history;
  3710. }
  3711. set history(hsty) {
  3712. this.__history = hsty;
  3713. }
  3714. get JSON() {
  3715. return JSON;
  3716. }
  3717. get HTMLElement() {
  3718. if (this.__htmlElementCstr == null) {
  3719. const ownerDocument = this.document;
  3720. this.__htmlElementCstr = class extends MockHTMLElement {
  3721. constructor() {
  3722. super(ownerDocument, '');
  3723. const observedAttributes = this.constructor.observedAttributes;
  3724. if (Array.isArray(observedAttributes) && typeof this.attributeChangedCallback === 'function') {
  3725. observedAttributes.forEach((attrName) => {
  3726. const attrValue = this.getAttribute(attrName);
  3727. if (attrValue != null) {
  3728. this.attributeChangedCallback(attrName, null, attrValue);
  3729. }
  3730. });
  3731. }
  3732. }
  3733. };
  3734. }
  3735. return this.__htmlElementCstr;
  3736. }
  3737. set HTMLElement(htmlElementCstr) {
  3738. this.__htmlElementCstr = htmlElementCstr;
  3739. }
  3740. get IntersectionObserver() {
  3741. return MockIntersectionObserver;
  3742. }
  3743. get localStorage() {
  3744. if (this.__localStorage == null) {
  3745. this.__localStorage = new MockStorage();
  3746. }
  3747. return this.__localStorage;
  3748. }
  3749. set localStorage(locStorage) {
  3750. this.__localStorage = locStorage;
  3751. }
  3752. get location() {
  3753. if (this.__location == null) {
  3754. this.__location = new MockLocation();
  3755. }
  3756. return this.__location;
  3757. }
  3758. set location(val) {
  3759. if (typeof val === 'string') {
  3760. if (this.__location == null) {
  3761. this.__location = new MockLocation();
  3762. }
  3763. this.__location.href = val;
  3764. }
  3765. else {
  3766. this.__location = val;
  3767. }
  3768. }
  3769. matchMedia() {
  3770. return {
  3771. matches: false,
  3772. };
  3773. }
  3774. get Node() {
  3775. if (this.__nodeCstr == null) {
  3776. const ownerDocument = this.document;
  3777. this.__nodeCstr = class extends MockNode {
  3778. constructor() {
  3779. super(ownerDocument, 0, 'test', '');
  3780. throw new Error('Illegal constructor: cannot construct Node');
  3781. }
  3782. };
  3783. }
  3784. return this.__nodeCstr;
  3785. }
  3786. get NodeList() {
  3787. if (this.__nodeListCstr == null) {
  3788. const ownerDocument = this.document;
  3789. this.__nodeListCstr = class extends MockNodeList {
  3790. constructor() {
  3791. super(ownerDocument, [], 0);
  3792. throw new Error('Illegal constructor: cannot construct NodeList');
  3793. }
  3794. };
  3795. }
  3796. return this.__nodeListCstr;
  3797. }
  3798. get navigator() {
  3799. if (this.__navigator == null) {
  3800. this.__navigator = new MockNavigator();
  3801. }
  3802. return this.__navigator;
  3803. }
  3804. set navigator(nav) {
  3805. this.__navigator = nav;
  3806. }
  3807. get parent() {
  3808. return null;
  3809. }
  3810. prompt() {
  3811. return '';
  3812. }
  3813. open() {
  3814. return null;
  3815. }
  3816. get origin() {
  3817. return this.location.origin;
  3818. }
  3819. removeEventListener(type, handler) {
  3820. removeEventListener(this, type, handler);
  3821. }
  3822. requestAnimationFrame(callback) {
  3823. return this.setTimeout(() => {
  3824. callback(Date.now());
  3825. }, 0);
  3826. }
  3827. requestIdleCallback(callback) {
  3828. return this.setTimeout(() => {
  3829. callback({
  3830. didTimeout: false,
  3831. timeRemaining: () => 0,
  3832. });
  3833. }, 0);
  3834. }
  3835. scroll(_x, _y) {
  3836. /**/
  3837. }
  3838. scrollBy(_x, _y) {
  3839. /**/
  3840. }
  3841. scrollTo(_x, _y) {
  3842. /**/
  3843. }
  3844. get self() {
  3845. return this;
  3846. }
  3847. get sessionStorage() {
  3848. if (this.__sessionStorage == null) {
  3849. this.__sessionStorage = new MockStorage();
  3850. }
  3851. return this.__sessionStorage;
  3852. }
  3853. set sessionStorage(locStorage) {
  3854. this.__sessionStorage = locStorage;
  3855. }
  3856. setInterval(callback, ms, ...args) {
  3857. if (this.__timeouts == null) {
  3858. this.__timeouts = new Set();
  3859. }
  3860. ms = Math.min(ms, this.__maxTimeout);
  3861. if (this.__allowInterval) {
  3862. const intervalId = this.__setInterval(() => {
  3863. if (this.__timeouts) {
  3864. this.__timeouts.delete(intervalId);
  3865. try {
  3866. callback(...args);
  3867. }
  3868. catch (e) {
  3869. if (this.console) {
  3870. this.console.error(e);
  3871. }
  3872. else {
  3873. console.error(e);
  3874. }
  3875. }
  3876. }
  3877. }, ms);
  3878. if (this.__timeouts) {
  3879. this.__timeouts.add(intervalId);
  3880. }
  3881. return intervalId;
  3882. }
  3883. const timeoutId = this.__setTimeout(() => {
  3884. if (this.__timeouts) {
  3885. this.__timeouts.delete(timeoutId);
  3886. try {
  3887. callback(...args);
  3888. }
  3889. catch (e) {
  3890. if (this.console) {
  3891. this.console.error(e);
  3892. }
  3893. else {
  3894. console.error(e);
  3895. }
  3896. }
  3897. }
  3898. }, ms);
  3899. if (this.__timeouts) {
  3900. this.__timeouts.add(timeoutId);
  3901. }
  3902. return timeoutId;
  3903. }
  3904. setTimeout(callback, ms, ...args) {
  3905. if (this.__timeouts == null) {
  3906. this.__timeouts = new Set();
  3907. }
  3908. ms = Math.min(ms, this.__maxTimeout);
  3909. const timeoutId = this.__setTimeout(() => {
  3910. if (this.__timeouts) {
  3911. this.__timeouts.delete(timeoutId);
  3912. try {
  3913. callback(...args);
  3914. }
  3915. catch (e) {
  3916. if (this.console) {
  3917. this.console.error(e);
  3918. }
  3919. else {
  3920. console.error(e);
  3921. }
  3922. }
  3923. }
  3924. }, ms);
  3925. if (this.__timeouts) {
  3926. this.__timeouts.add(timeoutId);
  3927. }
  3928. return timeoutId;
  3929. }
  3930. get top() {
  3931. return this;
  3932. }
  3933. get window() {
  3934. return this;
  3935. }
  3936. onanimationstart() {
  3937. /**/
  3938. }
  3939. onanimationend() {
  3940. /**/
  3941. }
  3942. onanimationiteration() {
  3943. /**/
  3944. }
  3945. onabort() {
  3946. /**/
  3947. }
  3948. onauxclick() {
  3949. /**/
  3950. }
  3951. onbeforecopy() {
  3952. /**/
  3953. }
  3954. onbeforecut() {
  3955. /**/
  3956. }
  3957. onbeforepaste() {
  3958. /**/
  3959. }
  3960. onblur() {
  3961. /**/
  3962. }
  3963. oncancel() {
  3964. /**/
  3965. }
  3966. oncanplay() {
  3967. /**/
  3968. }
  3969. oncanplaythrough() {
  3970. /**/
  3971. }
  3972. onchange() {
  3973. /**/
  3974. }
  3975. onclick() {
  3976. /**/
  3977. }
  3978. onclose() {
  3979. /**/
  3980. }
  3981. oncontextmenu() {
  3982. /**/
  3983. }
  3984. oncopy() {
  3985. /**/
  3986. }
  3987. oncuechange() {
  3988. /**/
  3989. }
  3990. oncut() {
  3991. /**/
  3992. }
  3993. ondblclick() {
  3994. /**/
  3995. }
  3996. ondrag() {
  3997. /**/
  3998. }
  3999. ondragend() {
  4000. /**/
  4001. }
  4002. ondragenter() {
  4003. /**/
  4004. }
  4005. ondragleave() {
  4006. /**/
  4007. }
  4008. ondragover() {
  4009. /**/
  4010. }
  4011. ondragstart() {
  4012. /**/
  4013. }
  4014. ondrop() {
  4015. /**/
  4016. }
  4017. ondurationchange() {
  4018. /**/
  4019. }
  4020. onemptied() {
  4021. /**/
  4022. }
  4023. onended() {
  4024. /**/
  4025. }
  4026. onerror() {
  4027. /**/
  4028. }
  4029. onfocus() {
  4030. /**/
  4031. }
  4032. onfocusin() {
  4033. /**/
  4034. }
  4035. onfocusout() {
  4036. /**/
  4037. }
  4038. onformdata() {
  4039. /**/
  4040. }
  4041. onfullscreenchange() {
  4042. /**/
  4043. }
  4044. onfullscreenerror() {
  4045. /**/
  4046. }
  4047. ongotpointercapture() {
  4048. /**/
  4049. }
  4050. oninput() {
  4051. /**/
  4052. }
  4053. oninvalid() {
  4054. /**/
  4055. }
  4056. onkeydown() {
  4057. /**/
  4058. }
  4059. onkeypress() {
  4060. /**/
  4061. }
  4062. onkeyup() {
  4063. /**/
  4064. }
  4065. onload() {
  4066. /**/
  4067. }
  4068. onloadeddata() {
  4069. /**/
  4070. }
  4071. onloadedmetadata() {
  4072. /**/
  4073. }
  4074. onloadstart() {
  4075. /**/
  4076. }
  4077. onlostpointercapture() {
  4078. /**/
  4079. }
  4080. onmousedown() {
  4081. /**/
  4082. }
  4083. onmouseenter() {
  4084. /**/
  4085. }
  4086. onmouseleave() {
  4087. /**/
  4088. }
  4089. onmousemove() {
  4090. /**/
  4091. }
  4092. onmouseout() {
  4093. /**/
  4094. }
  4095. onmouseover() {
  4096. /**/
  4097. }
  4098. onmouseup() {
  4099. /**/
  4100. }
  4101. onmousewheel() {
  4102. /**/
  4103. }
  4104. onpaste() {
  4105. /**/
  4106. }
  4107. onpause() {
  4108. /**/
  4109. }
  4110. onplay() {
  4111. /**/
  4112. }
  4113. onplaying() {
  4114. /**/
  4115. }
  4116. onpointercancel() {
  4117. /**/
  4118. }
  4119. onpointerdown() {
  4120. /**/
  4121. }
  4122. onpointerenter() {
  4123. /**/
  4124. }
  4125. onpointerleave() {
  4126. /**/
  4127. }
  4128. onpointermove() {
  4129. /**/
  4130. }
  4131. onpointerout() {
  4132. /**/
  4133. }
  4134. onpointerover() {
  4135. /**/
  4136. }
  4137. onpointerup() {
  4138. /**/
  4139. }
  4140. onprogress() {
  4141. /**/
  4142. }
  4143. onratechange() {
  4144. /**/
  4145. }
  4146. onreset() {
  4147. /**/
  4148. }
  4149. onresize() {
  4150. /**/
  4151. }
  4152. onscroll() {
  4153. /**/
  4154. }
  4155. onsearch() {
  4156. /**/
  4157. }
  4158. onseeked() {
  4159. /**/
  4160. }
  4161. onseeking() {
  4162. /**/
  4163. }
  4164. onselect() {
  4165. /**/
  4166. }
  4167. onselectstart() {
  4168. /**/
  4169. }
  4170. onstalled() {
  4171. /**/
  4172. }
  4173. onsubmit() {
  4174. /**/
  4175. }
  4176. onsuspend() {
  4177. /**/
  4178. }
  4179. ontimeupdate() {
  4180. /**/
  4181. }
  4182. ontoggle() {
  4183. /**/
  4184. }
  4185. onvolumechange() {
  4186. /**/
  4187. }
  4188. onwaiting() {
  4189. /**/
  4190. }
  4191. onwebkitfullscreenchange() {
  4192. /**/
  4193. }
  4194. onwebkitfullscreenerror() {
  4195. /**/
  4196. }
  4197. onwheel() {
  4198. /**/
  4199. }
  4200. }
  4201. addGlobalsToWindowPrototype(MockWindow.prototype);
  4202. function resetWindowDefaults(win) {
  4203. win.__clearInterval = nativeClearInterval;
  4204. win.__clearTimeout = nativeClearTimeout;
  4205. win.__setInterval = nativeSetInterval;
  4206. win.__setTimeout = nativeSetTimeout;
  4207. win.__maxTimeout = 30000;
  4208. win.__allowInterval = true;
  4209. win.URL = nativeURL;
  4210. }
  4211. function cloneWindow(srcWin, opts = {}) {
  4212. if (srcWin == null) {
  4213. return null;
  4214. }
  4215. const clonedWin = new MockWindow(false);
  4216. if (!opts.customElementProxy) {
  4217. // TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
  4218. // @ts-ignore
  4219. srcWin.customElements = null;
  4220. }
  4221. if (srcWin.document != null) {
  4222. const clonedDoc = new MockDocument(false, clonedWin);
  4223. clonedWin.document = clonedDoc;
  4224. clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
  4225. }
  4226. else {
  4227. clonedWin.document = new MockDocument(null, clonedWin);
  4228. }
  4229. return clonedWin;
  4230. }
  4231. function cloneDocument(srcDoc) {
  4232. if (srcDoc == null) {
  4233. return null;
  4234. }
  4235. const dstWin = cloneWindow(srcDoc.defaultView);
  4236. return dstWin.document;
  4237. }
  4238. /**
  4239. * Constrain setTimeout() to 1ms, but still async. Also
  4240. * only allow setInterval() to fire once, also constrained to 1ms.
  4241. */
  4242. function constrainTimeouts(win) {
  4243. win.__allowInterval = false;
  4244. win.__maxTimeout = 0;
  4245. }
  4246. function resetWindow(win) {
  4247. if (win != null) {
  4248. if (win.__timeouts) {
  4249. win.__timeouts.forEach((timeoutId) => {
  4250. nativeClearInterval(timeoutId);
  4251. nativeClearTimeout(timeoutId);
  4252. });
  4253. win.__timeouts.clear();
  4254. }
  4255. if (win.customElements && win.customElements.clear) {
  4256. win.customElements.clear();
  4257. }
  4258. resetDocument(win.document);
  4259. resetPerformance(win.performance);
  4260. for (const key in win) {
  4261. if (win.hasOwnProperty(key) && key !== 'document' && key !== 'performance' && key !== 'customElements') {
  4262. delete win[key];
  4263. }
  4264. }
  4265. resetWindowDefaults(win);
  4266. resetWindowDimensions(win);
  4267. resetEventListeners(win);
  4268. if (win.document != null) {
  4269. try {
  4270. win.document.defaultView = win;
  4271. }
  4272. catch (e) { }
  4273. }
  4274. // ensure we don't hold onto nodeFetch values
  4275. win.fetch = null;
  4276. win.Headers = null;
  4277. win.Request = null;
  4278. win.Response = null;
  4279. win.FetchError = null;
  4280. }
  4281. }
  4282. function resetWindowDimensions(win) {
  4283. try {
  4284. win.devicePixelRatio = 1;
  4285. win.innerHeight = 768;
  4286. win.innerWidth = 1366;
  4287. win.pageXOffset = 0;
  4288. win.pageYOffset = 0;
  4289. win.screenLeft = 0;
  4290. win.screenTop = 0;
  4291. win.screenX = 0;
  4292. win.screenY = 0;
  4293. win.scrollX = 0;
  4294. win.scrollY = 0;
  4295. win.screen = {
  4296. availHeight: win.innerHeight,
  4297. availLeft: 0,
  4298. availTop: 0,
  4299. availWidth: win.innerWidth,
  4300. colorDepth: 24,
  4301. height: win.innerHeight,
  4302. keepAwake: false,
  4303. orientation: {
  4304. angle: 0,
  4305. type: 'portrait-primary',
  4306. },
  4307. pixelDepth: 24,
  4308. width: win.innerWidth,
  4309. };
  4310. }
  4311. catch (e) { }
  4312. }
  4313. class MockDocument extends MockHTMLElement {
  4314. constructor(html = null, win = null) {
  4315. super(null, null);
  4316. this.nodeName = "#document" /* DOCUMENT_NODE */;
  4317. this.nodeType = 9 /* DOCUMENT_NODE */;
  4318. this.defaultView = win;
  4319. this.cookie = '';
  4320. this.referrer = '';
  4321. this.appendChild(this.createDocumentTypeNode());
  4322. if (typeof html === 'string') {
  4323. const parsedDoc = parseDocumentUtil(this, html);
  4324. const documentElement = parsedDoc.children.find((elm) => elm.nodeName === 'HTML');
  4325. if (documentElement != null) {
  4326. this.appendChild(documentElement);
  4327. setOwnerDocument(documentElement, this);
  4328. }
  4329. }
  4330. else if (html !== false) {
  4331. const documentElement = new MockHTMLElement(this, 'html');
  4332. this.appendChild(documentElement);
  4333. documentElement.appendChild(new MockHTMLElement(this, 'head'));
  4334. documentElement.appendChild(new MockHTMLElement(this, 'body'));
  4335. }
  4336. }
  4337. get dir() {
  4338. return this.documentElement.dir;
  4339. }
  4340. set dir(value) {
  4341. this.documentElement.dir = value;
  4342. }
  4343. get location() {
  4344. if (this.defaultView != null) {
  4345. return this.defaultView.location;
  4346. }
  4347. return null;
  4348. }
  4349. set location(val) {
  4350. if (this.defaultView != null) {
  4351. this.defaultView.location = val;
  4352. }
  4353. }
  4354. get baseURI() {
  4355. const baseNode = this.head.childNodes.find((node) => node.nodeName === 'BASE');
  4356. if (baseNode) {
  4357. return baseNode.href;
  4358. }
  4359. return this.URL;
  4360. }
  4361. get URL() {
  4362. return this.location.href;
  4363. }
  4364. get styleSheets() {
  4365. return this.querySelectorAll('style');
  4366. }
  4367. get scripts() {
  4368. return this.querySelectorAll('script');
  4369. }
  4370. get forms() {
  4371. return this.querySelectorAll('form');
  4372. }
  4373. get images() {
  4374. return this.querySelectorAll('img');
  4375. }
  4376. get scrollingElement() {
  4377. return this.documentElement;
  4378. }
  4379. get documentElement() {
  4380. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  4381. if (this.childNodes[i].nodeName === 'HTML') {
  4382. return this.childNodes[i];
  4383. }
  4384. }
  4385. const documentElement = new MockHTMLElement(this, 'html');
  4386. this.appendChild(documentElement);
  4387. return documentElement;
  4388. }
  4389. set documentElement(documentElement) {
  4390. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  4391. if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
  4392. this.childNodes[i].remove();
  4393. }
  4394. }
  4395. if (documentElement != null) {
  4396. this.appendChild(documentElement);
  4397. setOwnerDocument(documentElement, this);
  4398. }
  4399. }
  4400. get head() {
  4401. const documentElement = this.documentElement;
  4402. for (let i = 0; i < documentElement.childNodes.length; i++) {
  4403. if (documentElement.childNodes[i].nodeName === 'HEAD') {
  4404. return documentElement.childNodes[i];
  4405. }
  4406. }
  4407. const head = new MockHTMLElement(this, 'head');
  4408. documentElement.insertBefore(head, documentElement.firstChild);
  4409. return head;
  4410. }
  4411. set head(head) {
  4412. const documentElement = this.documentElement;
  4413. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  4414. if (documentElement.childNodes[i].nodeName === 'HEAD') {
  4415. documentElement.childNodes[i].remove();
  4416. }
  4417. }
  4418. if (head != null) {
  4419. documentElement.insertBefore(head, documentElement.firstChild);
  4420. setOwnerDocument(head, this);
  4421. }
  4422. }
  4423. get body() {
  4424. const documentElement = this.documentElement;
  4425. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  4426. if (documentElement.childNodes[i].nodeName === 'BODY') {
  4427. return documentElement.childNodes[i];
  4428. }
  4429. }
  4430. const body = new MockHTMLElement(this, 'body');
  4431. documentElement.appendChild(body);
  4432. return body;
  4433. }
  4434. set body(body) {
  4435. const documentElement = this.documentElement;
  4436. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  4437. if (documentElement.childNodes[i].nodeName === 'BODY') {
  4438. documentElement.childNodes[i].remove();
  4439. }
  4440. }
  4441. if (body != null) {
  4442. documentElement.appendChild(body);
  4443. setOwnerDocument(body, this);
  4444. }
  4445. }
  4446. appendChild(newNode) {
  4447. newNode.remove();
  4448. newNode.parentNode = this;
  4449. this.childNodes.push(newNode);
  4450. return newNode;
  4451. }
  4452. createComment(data) {
  4453. return new MockComment(this, data);
  4454. }
  4455. createAttribute(attrName) {
  4456. return new MockAttr(attrName.toLowerCase(), '');
  4457. }
  4458. createAttributeNS(namespaceURI, attrName) {
  4459. return new MockAttr(attrName, '', namespaceURI);
  4460. }
  4461. createElement(tagName) {
  4462. if (tagName === "#document" /* DOCUMENT_NODE */) {
  4463. const doc = new MockDocument(false);
  4464. doc.nodeName = tagName;
  4465. doc.parentNode = null;
  4466. return doc;
  4467. }
  4468. return createElement(this, tagName);
  4469. }
  4470. createElementNS(namespaceURI, tagName) {
  4471. const elmNs = createElementNS(this, namespaceURI, tagName);
  4472. elmNs.namespaceURI = namespaceURI;
  4473. return elmNs;
  4474. }
  4475. createTextNode(text) {
  4476. return new MockTextNode(this, text);
  4477. }
  4478. createDocumentFragment() {
  4479. return new MockDocumentFragment(this);
  4480. }
  4481. createDocumentTypeNode() {
  4482. return new MockDocumentTypeNode(this);
  4483. }
  4484. getElementById(id) {
  4485. return getElementById(this, id);
  4486. }
  4487. getElementsByName(elmName) {
  4488. return getElementsByName(this, elmName.toLowerCase());
  4489. }
  4490. get title() {
  4491. const title = this.head.childNodes.find((elm) => elm.nodeName === 'TITLE');
  4492. if (title != null && typeof title.textContent === 'string') {
  4493. return title.textContent.trim();
  4494. }
  4495. return '';
  4496. }
  4497. set title(value) {
  4498. const head = this.head;
  4499. let title = head.childNodes.find((elm) => elm.nodeName === 'TITLE');
  4500. if (title == null) {
  4501. title = this.createElement('title');
  4502. head.appendChild(title);
  4503. }
  4504. title.textContent = value;
  4505. }
  4506. }
  4507. function createDocument(html = null) {
  4508. return new MockWindow(html).document;
  4509. }
  4510. function createFragment(html) {
  4511. return parseHtmlToFragment(html, null);
  4512. }
  4513. function resetDocument(doc) {
  4514. if (doc != null) {
  4515. resetEventListeners(doc);
  4516. const documentElement = doc.documentElement;
  4517. if (documentElement != null) {
  4518. resetElement(documentElement);
  4519. for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
  4520. const childNode = documentElement.childNodes[i];
  4521. resetElement(childNode);
  4522. childNode.childNodes.length = 0;
  4523. }
  4524. }
  4525. for (const key in doc) {
  4526. if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
  4527. delete doc[key];
  4528. }
  4529. }
  4530. try {
  4531. doc.nodeName = "#document" /* DOCUMENT_NODE */;
  4532. }
  4533. catch (e) { }
  4534. try {
  4535. doc.nodeType = 9 /* DOCUMENT_NODE */;
  4536. }
  4537. catch (e) { }
  4538. try {
  4539. doc.cookie = '';
  4540. }
  4541. catch (e) { }
  4542. try {
  4543. doc.referrer = '';
  4544. }
  4545. catch (e) { }
  4546. }
  4547. }
  4548. const DOC_KEY_KEEPERS = new Set([
  4549. 'nodeName',
  4550. 'nodeType',
  4551. 'nodeValue',
  4552. 'ownerDocument',
  4553. 'parentNode',
  4554. 'childNodes',
  4555. '_shadowRoot',
  4556. ]);
  4557. function getElementById(elm, id) {
  4558. const children = elm.children;
  4559. for (let i = 0, ii = children.length; i < ii; i++) {
  4560. const childElm = children[i];
  4561. if (childElm.id === id) {
  4562. return childElm;
  4563. }
  4564. const childElmFound = getElementById(childElm, id);
  4565. if (childElmFound != null) {
  4566. return childElmFound;
  4567. }
  4568. }
  4569. return null;
  4570. }
  4571. function getElementsByName(elm, elmName, foundElms = []) {
  4572. const children = elm.children;
  4573. for (let i = 0, ii = children.length; i < ii; i++) {
  4574. const childElm = children[i];
  4575. if (childElm.name && childElm.name.toLowerCase() === elmName) {
  4576. foundElms.push(childElm);
  4577. }
  4578. getElementsByName(childElm, elmName, foundElms);
  4579. }
  4580. return foundElms;
  4581. }
  4582. function setOwnerDocument(elm, ownerDocument) {
  4583. for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
  4584. elm.childNodes[i].ownerDocument = ownerDocument;
  4585. if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
  4586. setOwnerDocument(elm.childNodes[i], ownerDocument);
  4587. }
  4588. }
  4589. }
  4590. function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) {
  4591. var globalThis = $stencilWindow;
  4592. var self = $stencilWindow;
  4593. var top = $stencilWindow;
  4594. var parent = $stencilWindow;
  4595. var addEventListener = $stencilWindow.addEventListener.bind($stencilWindow);
  4596. var alert = $stencilWindow.alert.bind($stencilWindow);
  4597. var blur = $stencilWindow.blur.bind($stencilWindow);
  4598. var cancelAnimationFrame = $stencilWindow.cancelAnimationFrame.bind($stencilWindow);
  4599. var cancelIdleCallback = $stencilWindow.cancelIdleCallback.bind($stencilWindow);
  4600. var clearInterval = $stencilWindow.clearInterval.bind($stencilWindow);
  4601. var clearTimeout = $stencilWindow.clearTimeout.bind($stencilWindow);
  4602. var close = () => {};
  4603. var confirm = $stencilWindow.confirm.bind($stencilWindow);
  4604. var dispatchEvent = $stencilWindow.dispatchEvent.bind($stencilWindow);
  4605. var focus = $stencilWindow.focus.bind($stencilWindow);
  4606. var getComputedStyle = $stencilWindow.getComputedStyle.bind($stencilWindow);
  4607. var matchMedia = $stencilWindow.matchMedia.bind($stencilWindow);
  4608. var open = $stencilWindow.open.bind($stencilWindow);
  4609. var prompt = $stencilWindow.prompt.bind($stencilWindow);
  4610. var removeEventListener = $stencilWindow.removeEventListener.bind($stencilWindow);
  4611. var requestAnimationFrame = $stencilWindow.requestAnimationFrame.bind($stencilWindow);
  4612. var requestIdleCallback = $stencilWindow.requestIdleCallback.bind($stencilWindow);
  4613. var setInterval = $stencilWindow.setInterval.bind($stencilWindow);
  4614. var setTimeout = $stencilWindow.setTimeout.bind($stencilWindow);
  4615. var CharacterData = $stencilWindow.CharacterData;
  4616. var CSS = $stencilWindow.CSS;
  4617. var CustomEvent = $stencilWindow.CustomEvent;
  4618. var Document = $stencilWindow.Document;
  4619. var DocumentFragment = $stencilWindow.DocumentFragment;
  4620. var DocumentType = $stencilWindow.DocumentType;
  4621. var DOMTokenList = $stencilWindow.DOMTokenList;
  4622. var Element = $stencilWindow.Element;
  4623. var Event = $stencilWindow.Event;
  4624. var HTMLAnchorElement = $stencilWindow.HTMLAnchorElement;
  4625. var HTMLBaseElement = $stencilWindow.HTMLBaseElement;
  4626. var HTMLButtonElement = $stencilWindow.HTMLButtonElement;
  4627. var HTMLCanvasElement = $stencilWindow.HTMLCanvasElement;
  4628. var HTMLElement = $stencilWindow.HTMLElement;
  4629. var HTMLFormElement = $stencilWindow.HTMLFormElement;
  4630. var HTMLImageElement = $stencilWindow.HTMLImageElement;
  4631. var HTMLInputElement = $stencilWindow.HTMLInputElement;
  4632. var HTMLLinkElement = $stencilWindow.HTMLLinkElement;
  4633. var HTMLMetaElement = $stencilWindow.HTMLMetaElement;
  4634. var HTMLScriptElement = $stencilWindow.HTMLScriptElement;
  4635. var HTMLStyleElement = $stencilWindow.HTMLStyleElement;
  4636. var HTMLTemplateElement = $stencilWindow.HTMLTemplateElement;
  4637. var HTMLTitleElement = $stencilWindow.HTMLTitleElement;
  4638. var IntersectionObserver = $stencilWindow.IntersectionObserver;
  4639. var KeyboardEvent = $stencilWindow.KeyboardEvent;
  4640. var MouseEvent = $stencilWindow.MouseEvent;
  4641. var Node = $stencilWindow.Node;
  4642. var NodeList = $stencilWindow.NodeList;
  4643. var URL = $stencilWindow.URL;
  4644. var console = $stencilWindow.console;
  4645. var customElements = $stencilWindow.customElements;
  4646. var history = $stencilWindow.history;
  4647. var localStorage = $stencilWindow.localStorage;
  4648. var location = $stencilWindow.location;
  4649. var navigator = $stencilWindow.navigator;
  4650. var performance = $stencilWindow.performance;
  4651. var sessionStorage = $stencilWindow.sessionStorage;
  4652. var devicePixelRatio = $stencilWindow.devicePixelRatio;
  4653. var innerHeight = $stencilWindow.innerHeight;
  4654. var innerWidth = $stencilWindow.innerWidth;
  4655. var origin = $stencilWindow.origin;
  4656. var pageXOffset = $stencilWindow.pageXOffset;
  4657. var pageYOffset = $stencilWindow.pageYOffset;
  4658. var screen = $stencilWindow.screen;
  4659. var screenLeft = $stencilWindow.screenLeft;
  4660. var screenTop = $stencilWindow.screenTop;
  4661. var screenX = $stencilWindow.screenX;
  4662. var screenY = $stencilWindow.screenY;
  4663. var scrollX = $stencilWindow.scrollX;
  4664. var scrollY = $stencilWindow.scrollY;
  4665. var exports = {};
  4666. var fetch, FetchError, Headers, Request, Response;
  4667. if (typeof $stencilWindow.fetch === 'function') {
  4668. fetch = $stencilWindow.fetch;
  4669. } else {
  4670. fetch = $stencilWindow.fetch = function() { throw new Error('fetch() is not implemented'); };
  4671. }
  4672. if (typeof $stencilWindow.FetchError === 'function') {
  4673. FetchError = $stencilWindow.FetchError;
  4674. } else {
  4675. FetchError = $stencilWindow.FetchError = class FetchError { constructor() { throw new Error('FetchError is not implemented'); } };
  4676. }
  4677. if (typeof $stencilWindow.Headers === 'function') {
  4678. Headers = $stencilWindow.Headers;
  4679. } else {
  4680. Headers = $stencilWindow.Headers = class Headers { constructor() { throw new Error('Headers is not implemented'); } };
  4681. }
  4682. if (typeof $stencilWindow.Request === 'function') {
  4683. Request = $stencilWindow.Request;
  4684. } else {
  4685. Request = $stencilWindow.Request = class Request { constructor() { throw new Error('Request is not implemented'); } };
  4686. }
  4687. if (typeof $stencilWindow.Response === 'function') {
  4688. Response = $stencilWindow.Response;
  4689. } else {
  4690. Response = $stencilWindow.Response = class Response { constructor() { throw new Error('Response is not implemented'); } };
  4691. }
  4692. function hydrateAppClosure($stencilWindow) {
  4693. const window = $stencilWindow;
  4694. const document = $stencilWindow.document;
  4695. /*hydrateAppClosure start*/
  4696. const NAMESPACE = 'calcite';
  4697. const BUILD = /* calcite */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: true, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: false, cssAnnotations: true, cssVarShim: false, devTools: false, disconnectedCallback: true, dynamicImportShim: false, element: false, event: true, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: true, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: true, hydratedAttribute: false, hydratedClass: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, safari10: false, scoped: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, shadowDomShim: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
  4698. function componentOnReady() {
  4699. return getHostRef(this).$onReadyPromise$;
  4700. }
  4701. function forceUpdate() {}
  4702. function hydrateApp(e, t, o, n, s) {
  4703. function l() {
  4704. if (global.clearTimeout(p), i.clear(), r.clear(), !h) {
  4705. h = !0;
  4706. try {
  4707. t.clientHydrateAnnotations && insertVdomAnnotations(e.document, t.staticComponents),
  4708. e.dispatchEvent(new e.Event("DOMContentLoaded")), e.document.createElement = c,
  4709. e.document.createElementNS = $;
  4710. } catch (e) {
  4711. renderCatchError(t, o, e);
  4712. }
  4713. }
  4714. n(e, t, o, s);
  4715. }
  4716. function a(e) {
  4717. renderCatchError(t, o, e), l();
  4718. }
  4719. const r = new Set, i = new Set, d = new Set, c = e.document.createElement, $ = e.document.createElementNS, m = Promise.resolve();
  4720. let p, h = !1;
  4721. try {
  4722. function u() {
  4723. return g(this);
  4724. }
  4725. function f(e) {
  4726. if (isValidComponent(e, t) && !getHostRef(e)) {
  4727. const t = loadModule({
  4728. $tagName$: e.nodeName.toLowerCase(),
  4729. $flags$: null
  4730. });
  4731. null != t && null != t.cmpMeta && (i.add(e), e.connectedCallback = u, registerHost(e, t.cmpMeta),
  4732. function o(e, t) {
  4733. if ("function" != typeof e.componentOnReady && (e.componentOnReady = componentOnReady),
  4734. "function" != typeof e.forceUpdate && (e.forceUpdate = forceUpdate), 1 & t.$flags$ && (e.shadowRoot = e),
  4735. null != t.$members$) {
  4736. const o = getHostRef(e);
  4737. Object.entries(t.$members$).forEach((([n, s]) => {
  4738. const l = s[0];
  4739. if (31 & l) {
  4740. const a = s[1] || n, r = e.getAttribute(a);
  4741. if (null != r) {
  4742. const e = parsePropertyValue(r, l);
  4743. o.$instanceValues$.set(n, e);
  4744. }
  4745. const i = e[n];
  4746. void 0 !== i && (o.$instanceValues$.set(n, i), delete e[n]), Object.defineProperty(e, n, {
  4747. get() {
  4748. return getValue(this, n);
  4749. },
  4750. set(e) {
  4751. setValue(this, n, e, t);
  4752. },
  4753. configurable: !0,
  4754. enumerable: !0
  4755. });
  4756. } else 64 & l && Object.defineProperty(e, n, {
  4757. value() {
  4758. const e = getHostRef(this), t = arguments;
  4759. return e.$onInstancePromise$.then((() => e.$lazyInstance$[n].apply(e.$lazyInstance$, t))).catch(consoleError);
  4760. }
  4761. });
  4762. }));
  4763. }
  4764. }(e, t.cmpMeta));
  4765. }
  4766. }
  4767. function g(n) {
  4768. return i.delete(n), isValidComponent(n, t) && o.hydratedCount < t.maxHydrateCount && !r.has(n) && shouldHydrate(n) ? (r.add(n),
  4769. async function s(e, t, o, n, l) {
  4770. o = o.toLowerCase();
  4771. const a = loadModule({
  4772. $tagName$: o,
  4773. $flags$: null
  4774. });
  4775. if (null != a && null != a.cmpMeta) {
  4776. l.add(n);
  4777. try {
  4778. connectedCallback(n), await n.componentOnReady(), t.hydratedCount++;
  4779. const e = getHostRef(n), s = e.$modeName$ ? e.$modeName$ : "$";
  4780. t.components.some((e => e.tag === o && e.mode === s)) || t.components.push({
  4781. tag: o,
  4782. mode: s,
  4783. count: 0,
  4784. depth: -1
  4785. });
  4786. } catch (t) {
  4787. e.console.error(t);
  4788. }
  4789. l.delete(n);
  4790. }
  4791. }(e, o, n.nodeName, n, d)) : m;
  4792. }
  4793. e.document.createElement = function t(o) {
  4794. const n = c.call(e.document, o);
  4795. return f(n), n;
  4796. }, e.document.createElementNS = function t(o, n) {
  4797. const s = $.call(e.document, o, n);
  4798. return f(s), s;
  4799. }, p = global.setTimeout((function L() {
  4800. a(`Hydrate exceeded timeout${function e(t) {
  4801. return Array.from(t).map(waitingOnElementMsg);
  4802. }(d)}`);
  4803. }), t.timeout), plt.$resourcesUrl$ = new URL(t.resourcesUrl || "./", doc.baseURI).href,
  4804. function e(t) {
  4805. if (null != t && 1 === t.nodeType) {
  4806. f(t);
  4807. const o = t.children;
  4808. for (let t = 0, n = o.length; t < n; t++) e(o[t]);
  4809. }
  4810. }(e.document.body), function e() {
  4811. const t = Array.from(i).filter((e => e.parentElement));
  4812. return t.length > 0 ? Promise.all(t.map(g)).then(e) : m;
  4813. }().then(l).catch(a);
  4814. } catch (e) {
  4815. a(e);
  4816. }
  4817. }
  4818. function isValidComponent(e, t) {
  4819. if (null != e && 1 === e.nodeType) {
  4820. const o = e.nodeName;
  4821. if ("string" == typeof o && o.includes("-")) return !t.excludeComponents.includes(o.toLowerCase());
  4822. }
  4823. return !1;
  4824. }
  4825. function shouldHydrate(e) {
  4826. if (9 === e.nodeType) return !0;
  4827. if (NO_HYDRATE_TAGS.has(e.nodeName)) return !1;
  4828. if (e.hasAttribute("no-prerender")) return !1;
  4829. const t = e.parentNode;
  4830. return null == t || shouldHydrate(t);
  4831. }
  4832. function renderCatchError(e, t, o) {
  4833. const n = {
  4834. level: "error",
  4835. type: "build",
  4836. header: "Hydrate Error",
  4837. messageText: "",
  4838. relFilePath: null,
  4839. absFilePath: null,
  4840. lines: []
  4841. };
  4842. if (e.url) try {
  4843. const t = new URL(e.url);
  4844. "/" !== t.pathname && (n.header += ": " + t.pathname);
  4845. } catch (e) {}
  4846. null != o && (null != o.stack ? n.messageText = o.stack.toString() : null != o.message ? n.messageText = o.message.toString() : n.messageText = o.toString()),
  4847. t.diagnostics.push(n);
  4848. }
  4849. function printTag(e) {
  4850. let t = `<${e.nodeName.toLowerCase()}`;
  4851. if (Array.isArray(e.attributes)) for (let o = 0; o < e.attributes.length; o++) {
  4852. const n = e.attributes[o];
  4853. t += ` ${n.name}`, "" !== n.value && (t += `="${n.value}"`);
  4854. }
  4855. return t += ">", t;
  4856. }
  4857. function waitingOnElementMsg(e) {
  4858. let t = "";
  4859. if (e) {
  4860. const o = [];
  4861. t = " - waiting on:";
  4862. let n = e;
  4863. for (;n && 9 !== n.nodeType && "BODY" !== n.nodeName; ) o.unshift(printTag(n)),
  4864. n = n.parentElement;
  4865. let s = "";
  4866. for (const e of o) s += " ", t += `\n${s}${e}`;
  4867. }
  4868. return t;
  4869. }
  4870. const addHostEventListeners = (e, t, o, n) => {
  4871. o && (o.map((([o, n, s]) => {
  4872. const l = getHostListenerTarget(e, o) , a = hostListenerProxy(t, s), r = hostListenerOpts(o);
  4873. plt.ael(l, n, a, r), (t.$rmListeners$ = t.$rmListeners$ || []).push((() => plt.rel(l, n, a, r)));
  4874. })));
  4875. }, hostListenerProxy = (e, t) => o => {
  4876. try {
  4877. 256 & e.$flags$ ? e.$lazyInstance$[t](o) : (e.$queuedListeners$ = e.$queuedListeners$ || []).push([ t, o ]) ;
  4878. } catch (e) {
  4879. consoleError(e);
  4880. }
  4881. }, getHostListenerTarget = (e, t) => 4 & t ? doc : 8 & t ? win : 16 & t ? doc.body : e, hostListenerOpts = e => 0 != (2 & e), XLINK_NS = "http://www.w3.org/1999/xlink";
  4882. const createTime = (e, t = "") => {
  4883. return () => {};
  4884. }, rootAppliedStyles = new WeakMap, registerStyle = (e, t, o) => {
  4885. let n = styles.get(e);
  4886. n = t, styles.set(e, n);
  4887. }, addStyle = (e, t, o, n) => {
  4888. let s = getScopeId(t), l = styles.get(s);
  4889. if (e = 11 === e.nodeType ? e : doc, l) if ("string" == typeof l) {
  4890. e = e.head || e;
  4891. let o, a = rootAppliedStyles.get(e);
  4892. if (a || rootAppliedStyles.set(e, a = new Set), !a.has(s)) {
  4893. if (e.host && (o = e.querySelector(`[sty-id="${s}"]`))) o.innerHTML = l; else {
  4894. o = doc.createElement("style"), o.innerHTML = l;
  4895. o.setAttribute("sty-id", s),
  4896. e.insertBefore(o, e.querySelector("link"));
  4897. }
  4898. a && a.add(s);
  4899. }
  4900. }
  4901. return s;
  4902. }, attachStyles = e => {
  4903. const t = e.$cmpMeta$, o = e.$hostElement$, n = t.$flags$, s = createTime("attachStyles", t.$tagName$), l = addStyle(o.getRootNode(), t);
  4904. 10 & n && (o["s-sc"] = l,
  4905. o.classList.add(l + "-h"), BUILD.scoped ),
  4906. s();
  4907. }, getScopeId = (e, t) => "sc-" + (e.$tagName$), EMPTY_OBJ = {}, isComplexType = e => "object" == (e = typeof e) || "function" === e, isPromise = e => !!e && ("object" == typeof e || "function" == typeof e) && "function" == typeof e.then, h = (e, t, ...o) => {
  4908. let n = null, s = null, l = null, a = !1, r = !1, i = [];
  4909. const d = t => {
  4910. for (let o = 0; o < t.length; o++) n = t[o], Array.isArray(n) ? d(n) : null != n && "boolean" != typeof n && ((a = "function" != typeof e && !isComplexType(n)) ? n = String(n) : BUILD.isDev ,
  4911. a && r ? i[i.length - 1].$text$ += n : i.push(a ? newVNode(null, n) : n), r = a);
  4912. };
  4913. if (d(o), t && (t.key && (s = t.key),
  4914. t.name && (l = t.name), BUILD.vdomClass)) {
  4915. const e = t.className || t.class;
  4916. e && (t.class = "object" != typeof e ? e : Object.keys(e).filter((t => e[t])).join(" "));
  4917. }
  4918. if ("function" == typeof e) return e(null === t ? {} : t, i, vdomFnUtils);
  4919. const c = newVNode(e, null);
  4920. return c.$attrs$ = t, i.length > 0 && (c.$children$ = i), (c.$key$ = s),
  4921. (c.$name$ = l), c;
  4922. }, newVNode = (e, t) => {
  4923. const o = {
  4924. $flags$: 0,
  4925. $tag$: e,
  4926. $text$: t,
  4927. $elm$: null,
  4928. $children$: null
  4929. };
  4930. return (o.$attrs$ = null), (o.$key$ = null),
  4931. (o.$name$ = null), o;
  4932. }, Host = {}, isHost = e => e && e.$tag$ === Host, vdomFnUtils = {
  4933. forEach: (e, t) => e.map(convertToPublic).forEach(t),
  4934. map: (e, t) => e.map(convertToPublic).map(t).map(convertToPrivate)
  4935. }, convertToPublic = e => ({
  4936. vattrs: e.$attrs$,
  4937. vchildren: e.$children$,
  4938. vkey: e.$key$,
  4939. vname: e.$name$,
  4940. vtag: e.$tag$,
  4941. vtext: e.$text$
  4942. }), convertToPrivate = e => {
  4943. if ("function" == typeof e.vtag) {
  4944. const t = {
  4945. ...e.vattrs
  4946. };
  4947. return e.vkey && (t.key = e.vkey), e.vname && (t.name = e.vname), h(e.vtag, t, ...e.vchildren || []);
  4948. }
  4949. const t = newVNode(e.vtag, e.vtext);
  4950. return t.$attrs$ = e.vattrs, t.$children$ = e.vchildren, t.$key$ = e.vkey, t.$name$ = e.vname,
  4951. t;
  4952. }, setAccessor = (e, t, o, n, s, l) => {
  4953. if (o !== n) {
  4954. let a = isMemberInElement(e, t), r = t.toLowerCase();
  4955. if ("class" === t) {
  4956. const t = e.classList, s = parseClassList(o), l = parseClassList(n);
  4957. t.remove(...s.filter((e => e && !l.includes(e)))), t.add(...l.filter((e => e && !s.includes(e))));
  4958. } else if ("style" === t) {
  4959. for (const t in o) n && null != n[t] || (e.style[t] = "");
  4960. for (const t in n) o && n[t] === o[t] || (e.style[t] = n[t]);
  4961. } else if ("key" === t) ; else if ("ref" === t) n && n(e); else if ((a ) || "o" !== t[0] || "n" !== t[1]) {
  4962. {
  4963. const i = isComplexType(n);
  4964. if ((a || i && null !== n) && !s) try {
  4965. if (e.tagName.includes("-")) e[t] = n; else {
  4966. let s = null == n ? "" : n;
  4967. "list" === t ? a = !1 : null != o && e[t] == s || (e[t] = s);
  4968. }
  4969. } catch (e) {}
  4970. let d = !1;
  4971. r !== (r = r.replace(/^xlink\:?/, "")) && (t = r, d = !0), null == n || !1 === n ? !1 === n && "" !== e.getAttribute(t) || (d ? e.removeAttributeNS(XLINK_NS, t) : e.removeAttribute(t)) : (!a || 4 & l || s) && !i && (n = !0 === n ? "" : n,
  4972. d ? e.setAttributeNS(XLINK_NS, t, n) : e.setAttribute(t, n));
  4973. }
  4974. } else t = "-" === t[2] ? t.slice(3) : isMemberInElement(win, r) ? r.slice(2) : r[2] + t.slice(3),
  4975. o && plt.rel(e, t, o, !1), n && plt.ael(e, t, n, !1);
  4976. }
  4977. }, parseClassListRegex = /\s/, parseClassList = e => e ? e.split(parseClassListRegex) : [], updateElement = (e, t, o, n) => {
  4978. const s = 11 === t.$elm$.nodeType && t.$elm$.host ? t.$elm$.host : t.$elm$, l = e && e.$attrs$ || EMPTY_OBJ, a = t.$attrs$ || EMPTY_OBJ;
  4979. for (n in l) n in a || setAccessor(s, n, l[n], void 0, o, t.$flags$);
  4980. for (n in a) setAccessor(s, n, l[n], a[n], o, t.$flags$);
  4981. };
  4982. let scopeId, contentRef, hostTagName, useNativeShadowDom = !1, checkSlotFallbackVisibility = !1, checkSlotRelocate = !1, isSvgMode = !1;
  4983. const createElm = (e, t, o, n) => {
  4984. let s, l, a, r = t.$children$[o], i = 0;
  4985. if (!useNativeShadowDom && (checkSlotRelocate = !0, "slot" === r.$tag$ && (scopeId && n.classList.add(scopeId + "-s"),
  4986. r.$flags$ |= r.$children$ ? 2 : 1)), null !== r.$text$) s = r.$elm$ = doc.createTextNode(r.$text$); else if (1 & r.$flags$) s = r.$elm$ = slotReferenceDebugNode(r) ; else {
  4987. if (!isSvgMode && (isSvgMode = "svg" === r.$tag$), s = r.$elm$ = doc.createElementNS(isSvgMode ? "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", 2 & r.$flags$ ? "slot-fb" : r.$tag$) ,
  4988. isSvgMode && "foreignObject" === r.$tag$ && (isSvgMode = !1), updateElement(null, r, isSvgMode),
  4989. null != scopeId && s["s-si"] !== scopeId && s.classList.add(s["s-si"] = scopeId),
  4990. r.$children$) for (i = 0; i < r.$children$.length; ++i) l = createElm(e, r, i, s),
  4991. l && s.appendChild(l);
  4992. ("svg" === r.$tag$ ? isSvgMode = !1 : "foreignObject" === s.tagName && (isSvgMode = !0));
  4993. }
  4994. return (s["s-hn"] = hostTagName, 3 & r.$flags$ && (s["s-sr"] = !0,
  4995. s["s-cr"] = contentRef, s["s-sn"] = r.$name$ || "", a = e && e.$children$ && e.$children$[o],
  4996. a && a.$tag$ === r.$tag$ && e.$elm$ && putBackInOriginalLocation(e.$elm$, !1))),
  4997. s;
  4998. }, putBackInOriginalLocation = (e, t) => {
  4999. plt.$flags$ |= 1;
  5000. const o = e.childNodes;
  5001. for (let e = o.length - 1; e >= 0; e--) {
  5002. const n = o[e];
  5003. n["s-hn"] !== hostTagName && n["s-ol"] && (parentReferenceNode(n).insertBefore(n, referenceNode(n)),
  5004. n["s-ol"].remove(), n["s-ol"] = void 0, checkSlotRelocate = !0), t && putBackInOriginalLocation(n, t);
  5005. }
  5006. plt.$flags$ &= -2;
  5007. }, addVnodes = (e, t, o, n, s, l) => {
  5008. let a, r = e["s-cr"] && e["s-cr"].parentNode || e;
  5009. for (r.shadowRoot && r.tagName === hostTagName && (r = r.shadowRoot); s <= l; ++s) n[s] && (a = createElm(null, o, s, e),
  5010. a && (n[s].$elm$ = a, r.insertBefore(a, referenceNode(t) )));
  5011. }, removeVnodes = (e, t, o, n, s) => {
  5012. for (;t <= o; ++t) (n = e[t]) && (s = n.$elm$, callNodeRefs(n), (checkSlotFallbackVisibility = !0,
  5013. s["s-ol"] ? s["s-ol"].remove() : putBackInOriginalLocation(s, !0)), s.remove());
  5014. }, isSameVnode = (e, t) => e.$tag$ === t.$tag$ && ("slot" === e.$tag$ ? e.$name$ === t.$name$ : e.$key$ === t.$key$), referenceNode = e => e && e["s-ol"] || e, parentReferenceNode = e => (e["s-ol"] ? e["s-ol"] : e).parentNode, patch = (e, t) => {
  5015. const o = t.$elm$ = e.$elm$, n = e.$children$, s = t.$children$, l = t.$tag$, a = t.$text$;
  5016. let r;
  5017. null !== a ? (r = o["s-cr"]) ? r.parentNode.textContent = a : e.$text$ !== a && (o.data = a) : ((isSvgMode = "svg" === l || "foreignObject" !== l && isSvgMode),
  5018. ("slot" === l || updateElement(e, t, isSvgMode)),
  5019. null !== n && null !== s ? ((e, t, o, n) => {
  5020. let s, l, a = 0, r = 0, i = 0, d = 0, c = t.length - 1, $ = t[0], m = t[c], p = n.length - 1, h = n[0], u = n[p];
  5021. for (;a <= c && r <= p; ) if (null == $) $ = t[++a]; else if (null == m) m = t[--c]; else if (null == h) h = n[++r]; else if (null == u) u = n[--p]; else if (isSameVnode($, h)) patch($, h),
  5022. $ = t[++a], h = n[++r]; else if (isSameVnode(m, u)) patch(m, u), m = t[--c], u = n[--p]; else if (isSameVnode($, u)) "slot" !== $.$tag$ && "slot" !== u.$tag$ || putBackInOriginalLocation($.$elm$.parentNode, !1),
  5023. patch($, u), e.insertBefore($.$elm$, m.$elm$.nextSibling), $ = t[++a], u = n[--p]; else if (isSameVnode(m, h)) "slot" !== $.$tag$ && "slot" !== u.$tag$ || putBackInOriginalLocation(m.$elm$.parentNode, !1),
  5024. patch(m, h), e.insertBefore(m.$elm$, $.$elm$), m = t[--c], h = n[++r]; else {
  5025. if (i = -1, BUILD.vdomKey) for (d = a; d <= c; ++d) if (t[d] && null !== t[d].$key$ && t[d].$key$ === h.$key$) {
  5026. i = d;
  5027. break;
  5028. }
  5029. i >= 0 ? (l = t[i], l.$tag$ !== h.$tag$ ? s = createElm(t && t[r], o, i, e) : (patch(l, h),
  5030. t[i] = void 0, s = l.$elm$), h = n[++r]) : (s = createElm(t && t[r], o, r, e), h = n[++r]),
  5031. s && (parentReferenceNode($.$elm$).insertBefore(s, referenceNode($.$elm$)) );
  5032. }
  5033. a > c ? addVnodes(e, null == n[p + 1] ? null : n[p + 1].$elm$, o, n, r, p) : r > p && removeVnodes(t, a, c);
  5034. })(o, n, t, s) : null !== s ? (null !== e.$text$ && (o.textContent = ""),
  5035. addVnodes(o, null, t, s, 0, s.length - 1)) : null !== n && removeVnodes(n, 0, n.length - 1),
  5036. isSvgMode && "svg" === l && (isSvgMode = !1));
  5037. }, updateFallbackSlotVisibility = e => {
  5038. let t, o, n, s, l, a, r = e.childNodes;
  5039. for (o = 0, n = r.length; o < n; o++) if (t = r[o], 1 === t.nodeType) {
  5040. if (t["s-sr"]) for (l = t["s-sn"], t.hidden = !1, s = 0; s < n; s++) if (a = r[s].nodeType,
  5041. r[s]["s-hn"] !== t["s-hn"] || "" !== l) {
  5042. if (1 === a && l === r[s].getAttribute("slot")) {
  5043. t.hidden = !0;
  5044. break;
  5045. }
  5046. } else if (1 === a || 3 === a && "" !== r[s].textContent.trim()) {
  5047. t.hidden = !0;
  5048. break;
  5049. }
  5050. updateFallbackSlotVisibility(t);
  5051. }
  5052. }, relocateNodes = [], relocateSlotContent = e => {
  5053. let t, o, n, s, l, a, r = 0, i = e.childNodes, d = i.length;
  5054. for (;r < d; r++) {
  5055. if (t = i[r], t["s-sr"] && (o = t["s-cr"]) && o.parentNode) for (n = o.parentNode.childNodes,
  5056. s = t["s-sn"], a = n.length - 1; a >= 0; a--) o = n[a], o["s-cn"] || o["s-nr"] || o["s-hn"] === t["s-hn"] || (isNodeLocatedInSlot(o, s) ? (l = relocateNodes.find((e => e.$nodeToRelocate$ === o)),
  5057. checkSlotFallbackVisibility = !0, o["s-sn"] = o["s-sn"] || s, l ? l.$slotRefNode$ = t : relocateNodes.push({
  5058. $slotRefNode$: t,
  5059. $nodeToRelocate$: o
  5060. }), o["s-sr"] && relocateNodes.map((e => {
  5061. isNodeLocatedInSlot(e.$nodeToRelocate$, o["s-sn"]) && (l = relocateNodes.find((e => e.$nodeToRelocate$ === o)),
  5062. l && !e.$slotRefNode$ && (e.$slotRefNode$ = l.$slotRefNode$));
  5063. }))) : relocateNodes.some((e => e.$nodeToRelocate$ === o)) || relocateNodes.push({
  5064. $nodeToRelocate$: o
  5065. }));
  5066. 1 === t.nodeType && relocateSlotContent(t);
  5067. }
  5068. }, isNodeLocatedInSlot = (e, t) => 1 === e.nodeType ? null === e.getAttribute("slot") && "" === t || e.getAttribute("slot") === t : e["s-sn"] === t || "" === t, callNodeRefs = e => {
  5069. (e.$attrs$ && e.$attrs$.ref && e.$attrs$.ref(null), e.$children$ && e.$children$.map(callNodeRefs));
  5070. }, renderVdom = (e, t) => {
  5071. const o = e.$hostElement$, n = e.$cmpMeta$, s = e.$vnode$ || newVNode(null, null), l = isHost(t) ? t : h(null, null, t);
  5072. if (hostTagName = o.tagName, BUILD.isDev ) ;
  5073. if (n.$attrsToReflect$ && (l.$attrs$ = l.$attrs$ || {}, n.$attrsToReflect$.map((([e, t]) => l.$attrs$[t] = o[e]))),
  5074. l.$tag$ = null, l.$flags$ |= 4, e.$vnode$ = l, l.$elm$ = s.$elm$ = o.shadowRoot || o,
  5075. (scopeId = o["s-sc"]), (contentRef = o["s-cr"],
  5076. useNativeShadowDom = supportsShadow, checkSlotFallbackVisibility = !1), patch(s, l),
  5077. BUILD.slotRelocation) {
  5078. if (plt.$flags$ |= 1, checkSlotRelocate) {
  5079. let e, t, o, n, s, a;
  5080. relocateSlotContent(l.$elm$);
  5081. let r = 0;
  5082. for (;r < relocateNodes.length; r++) e = relocateNodes[r], t = e.$nodeToRelocate$,
  5083. t["s-ol"] || (o = originalLocationDebugNode(t) ,
  5084. o["s-nr"] = t, t.parentNode.insertBefore(t["s-ol"] = o, t));
  5085. for (r = 0; r < relocateNodes.length; r++) if (e = relocateNodes[r], t = e.$nodeToRelocate$,
  5086. e.$slotRefNode$) {
  5087. for (n = e.$slotRefNode$.parentNode, s = e.$slotRefNode$.nextSibling, o = t["s-ol"]; o = o.previousSibling; ) if (a = o["s-nr"],
  5088. a && a["s-sn"] === t["s-sn"] && n === a.parentNode && (a = a.nextSibling, !a || !a["s-nr"])) {
  5089. s = a;
  5090. break;
  5091. }
  5092. (!s && n !== t.parentNode || t.nextSibling !== s) && t !== s && (!t["s-hn"] && t["s-ol"] && (t["s-hn"] = t["s-ol"].parentNode.nodeName),
  5093. n.insertBefore(t, s));
  5094. } else 1 === t.nodeType && (t.hidden = !0);
  5095. }
  5096. checkSlotFallbackVisibility && updateFallbackSlotVisibility(l.$elm$), plt.$flags$ &= -2,
  5097. relocateNodes.length = 0;
  5098. }
  5099. }, slotReferenceDebugNode = e => doc.createComment(`<slot${e.$name$ ? ' name="' + e.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`), originalLocationDebugNode = e => doc.createComment("org-location for " + (e.localName ? `<${e.localName}> (host=${e["s-hn"]})` : `[${e.textContent}]`)), getElement = e => getHostRef(e).$hostElement$ , createEvent = (e, t, o) => {
  5100. const n = getElement(e);
  5101. return {
  5102. emit: e => (emitEvent(n, t, {
  5103. bubbles: !!(4 & o),
  5104. composed: !!(2 & o),
  5105. cancelable: !!(1 & o),
  5106. detail: e
  5107. }))
  5108. };
  5109. }, emitEvent = (e, t, o) => {
  5110. const n = plt.ce(t, o);
  5111. return e.dispatchEvent(n), n;
  5112. }, attachToAncestor = (e, t) => {
  5113. t && !e.$onRenderResolve$ && t["s-p"] && t["s-p"].push(new Promise((t => e.$onRenderResolve$ = t)));
  5114. }, scheduleUpdate = (e, t) => {
  5115. if ((e.$flags$ |= 16), 4 & e.$flags$) return void (e.$flags$ |= 512);
  5116. attachToAncestor(e, e.$ancestorComponent$);
  5117. const o = () => dispatchHooks(e, t);
  5118. return writeTask(o) ;
  5119. }, dispatchHooks = (e, t) => {
  5120. const n = createTime("scheduleUpdate", e.$cmpMeta$.$tagName$), s = e.$lazyInstance$ ;
  5121. let l;
  5122. return t ? ((e.$flags$ |= 256, e.$queuedListeners$ && (e.$queuedListeners$.map((([e, t]) => safeCall(s, e, t))),
  5123. e.$queuedListeners$ = null)), (l = safeCall(s, "componentWillLoad"))) : (BUILD.cmpWillUpdate ), (l = then(l, (() => safeCall(s, "componentWillRender")))),
  5124. n(), then(l, (() => updateComponent(e, s, t)));
  5125. }, updateComponent = async (e, t, o) => {
  5126. const n = e.$hostElement$, s = createTime("update", e.$cmpMeta$.$tagName$), l = n["s-rc"];
  5127. o && attachStyles(e);
  5128. const a = createTime("render", e.$cmpMeta$.$tagName$);
  5129. if (await callRender(e, t) ,
  5130. BUILD.hydrateServerSide) try {
  5131. serverSideConnected(n), o && (1 & e.$cmpMeta$.$flags$ ? n["s-en"] = "" : 2 & e.$cmpMeta$.$flags$ && (n["s-en"] = "c"));
  5132. } catch (e) {
  5133. consoleError(e, n);
  5134. }
  5135. if (l && (l.map((e => e())), n["s-rc"] = void 0), a(), s(),
  5136. BUILD.asyncLoading) {
  5137. const t = n["s-p"], o = () => postUpdateComponent(e);
  5138. 0 === t.length ? o() : (Promise.all(t).then(o), e.$flags$ |= 4, t.length = 0);
  5139. }
  5140. };
  5141. const callRender = (e, t, o) => {
  5142. try {
  5143. if (t = t.render(), (e.$flags$ &= -17),
  5144. (e.$flags$ |= 2), BUILD.hasRenderFn ) {
  5145. return Promise.resolve(t).then((t => renderVdom(e, t)));
  5146. }
  5147. } catch (t) {
  5148. consoleError(t, e.$hostElement$);
  5149. }
  5150. return null;
  5151. }, postUpdateComponent = e => {
  5152. const t = e.$cmpMeta$.$tagName$, o = e.$hostElement$, n = createTime("postUpdate", t), s = e.$lazyInstance$ , l = e.$ancestorComponent$;
  5153. (safeCall(s, "componentDidRender"),
  5154. BUILD.isDev ), 64 & e.$flags$ ? (n()) : (e.$flags$ |= 64, addHydratedFlag(o),
  5155. (safeCall(s, "componentDidLoad"),
  5156. BUILD.isDev ), n(), (e.$onReadyResolve$(o), l || appDidLoad())), e.$onInstanceResolve$(o), (e.$onRenderResolve$ && (e.$onRenderResolve$(),
  5157. e.$onRenderResolve$ = void 0), 512 & e.$flags$ && nextTick((() => scheduleUpdate(e, !1))),
  5158. e.$flags$ &= -517);
  5159. }, forceUpdate$1 = e => {
  5160. {
  5161. const t = getHostRef(e), o = t.$hostElement$.isConnected;
  5162. return o && 2 == (18 & t.$flags$) && scheduleUpdate(t, !1), o;
  5163. }
  5164. }, appDidLoad = e => {
  5165. addHydratedFlag(doc.documentElement), nextTick((() => emitEvent(win, "appload", {
  5166. detail: {
  5167. namespace: NAMESPACE
  5168. }
  5169. }))), BUILD.profile ;
  5170. }, safeCall = (e, t, o) => {
  5171. if (e && e[t]) try {
  5172. return e[t](o);
  5173. } catch (e) {
  5174. consoleError(e);
  5175. }
  5176. }, then = (e, t) => e && e.then ? e.then(t) : t(), addHydratedFlag = e => e.classList.add("calcite-hydrated") , serverSideConnected = e => {
  5177. const t = e.children;
  5178. if (null != t) for (let e = 0, o = t.length; e < o; e++) {
  5179. const o = t[e];
  5180. "function" == typeof o.connectedCallback && o.connectedCallback(), serverSideConnected(o);
  5181. }
  5182. }, clientHydrate = (e, t, o, n, s, l, a) => {
  5183. let r, i, d, c;
  5184. if (1 === l.nodeType) {
  5185. for (r = l.getAttribute("c-id"), r && (i = r.split("."), i[0] !== a && "0" !== i[0] || (d = {
  5186. $flags$: 0,
  5187. $hostId$: i[0],
  5188. $nodeId$: i[1],
  5189. $depth$: i[2],
  5190. $index$: i[3],
  5191. $tag$: l.tagName.toLowerCase(),
  5192. $elm$: l,
  5193. $attrs$: null,
  5194. $children$: null,
  5195. $key$: null,
  5196. $name$: null,
  5197. $text$: null
  5198. }, t.push(d), l.removeAttribute("c-id"), e.$children$ || (e.$children$ = []), e.$children$[d.$index$] = d,
  5199. e = d, n && "0" === d.$depth$ && (n[d.$index$] = d.$elm$))), c = l.childNodes.length - 1; c >= 0; c--) clientHydrate(e, t, o, n, s, l.childNodes[c], a);
  5200. if (l.shadowRoot) for (c = l.shadowRoot.childNodes.length - 1; c >= 0; c--) clientHydrate(e, t, o, n, s, l.shadowRoot.childNodes[c], a);
  5201. } else if (8 === l.nodeType) i = l.nodeValue.split("."), i[1] !== a && "0" !== i[1] || (r = i[0],
  5202. d = {
  5203. $flags$: 0,
  5204. $hostId$: i[1],
  5205. $nodeId$: i[2],
  5206. $depth$: i[3],
  5207. $index$: i[4],
  5208. $elm$: l,
  5209. $attrs$: null,
  5210. $children$: null,
  5211. $key$: null,
  5212. $name$: null,
  5213. $tag$: null,
  5214. $text$: null
  5215. }, "t" === r ? (d.$elm$ = l.nextSibling, d.$elm$ && 3 === d.$elm$.nodeType && (d.$text$ = d.$elm$.textContent,
  5216. t.push(d), l.remove(), e.$children$ || (e.$children$ = []), e.$children$[d.$index$] = d,
  5217. n && "0" === d.$depth$ && (n[d.$index$] = d.$elm$))) : d.$hostId$ === a && ("s" === r ? (d.$tag$ = "slot",
  5218. i[5] ? l["s-sn"] = d.$name$ = i[5] : l["s-sn"] = "", l["s-sr"] = !0, n && (d.$elm$ = doc.createElement(d.$tag$),
  5219. d.$name$ && d.$elm$.setAttribute("name", d.$name$), l.parentNode.insertBefore(d.$elm$, l),
  5220. l.remove(), "0" === d.$depth$ && (n[d.$index$] = d.$elm$)), o.push(d), e.$children$ || (e.$children$ = []),
  5221. e.$children$[d.$index$] = d) : "r" === r && (n ? l.remove() : (s["s-cr"] = l,
  5222. l["s-cn"] = !0)))); else if (e && "style" === e.$tag$) {
  5223. const t = newVNode(null, l.textContent);
  5224. t.$elm$ = l, t.$index$ = "0", e.$children$ = [ t ];
  5225. }
  5226. }, initializeDocumentHydrate = (e, t) => {
  5227. if (1 === e.nodeType) {
  5228. let o = 0;
  5229. for (;o < e.childNodes.length; o++) initializeDocumentHydrate(e.childNodes[o], t);
  5230. if (e.shadowRoot) for (o = 0; o < e.shadowRoot.childNodes.length; o++) initializeDocumentHydrate(e.shadowRoot.childNodes[o], t);
  5231. } else if (8 === e.nodeType) {
  5232. const o = e.nodeValue.split(".");
  5233. "o" === o[0] && (t.set(o[1] + "." + o[2], e), e.nodeValue = "", e["s-en"] = o[3]);
  5234. }
  5235. }, parsePropertyValue = (e, t) => null == e || isComplexType(e) ? e : 4 & t ? "false" !== e && ("" === e || !!e) : 2 & t ? parseFloat(e) : 1 & t ? String(e) : e, getValue = (e, t) => getHostRef(e).$instanceValues$.get(t), setValue = (e, t, o, n) => {
  5236. const s = getHostRef(e), l = s.$hostElement$ , a = s.$instanceValues$.get(t), r = s.$flags$, i = s.$lazyInstance$ ;
  5237. o = parsePropertyValue(o, n.$members$[t][0]);
  5238. const d = Number.isNaN(a) && Number.isNaN(o), c = o !== a && !d;
  5239. if ((!(8 & r) || void 0 === a) && c && (s.$instanceValues$.set(t, o),
  5240. i)) {
  5241. if (n.$watchers$ && 128 & r) {
  5242. const e = n.$watchers$[t];
  5243. e && e.map((e => {
  5244. try {
  5245. i[e](o, a, t);
  5246. } catch (e) {
  5247. consoleError(e, l);
  5248. }
  5249. }));
  5250. }
  5251. if (2 == (18 & r)) {
  5252. if (i.componentShouldUpdate && !1 === i.componentShouldUpdate(o, a, t)) return;
  5253. scheduleUpdate(s, !1);
  5254. }
  5255. }
  5256. }, proxyComponent = (e, t, o) => {
  5257. if (t.$members$) {
  5258. e.watchers && (t.$watchers$ = e.watchers);
  5259. const n = Object.entries(t.$members$), s = e.prototype;
  5260. if (n.map((([e, [n]]) => {
  5261. (31 & n || (2 & o) && 32 & n) ? Object.defineProperty(s, e, {
  5262. get() {
  5263. return getValue(this, e);
  5264. },
  5265. set(s) {
  5266. setValue(this, e, s, t);
  5267. },
  5268. configurable: !0,
  5269. enumerable: !0
  5270. }) : 1 & o && 64 & n && Object.defineProperty(s, e, {
  5271. value(...t) {
  5272. const o = getHostRef(this);
  5273. return o.$onInstancePromise$.then((() => o.$lazyInstance$[e](...t)));
  5274. }
  5275. });
  5276. })), (1 & o)) {
  5277. const o = new Map;
  5278. s.attributeChangedCallback = function(e, t, n) {
  5279. plt.jmp((() => {
  5280. const t = o.get(e);
  5281. if (this.hasOwnProperty(t)) n = this[t], delete this[t]; else if (s.hasOwnProperty(t) && "number" == typeof this[t] && this[t] == n) return;
  5282. this[t] = (null !== n || "boolean" != typeof this[t]) && n;
  5283. }));
  5284. }, e.observedAttributes = n.filter((([e, t]) => 15 & t[0])).map((([e, n]) => {
  5285. const s = n[1] || e;
  5286. return o.set(s, e), 512 & n[0] && t.$attrsToReflect$.push([ e, s ]),
  5287. s;
  5288. }));
  5289. }
  5290. }
  5291. return e;
  5292. }, initializeComponent = async (e, t, o, n, s) => {
  5293. if (0 == (32 & t.$flags$)) {
  5294. {
  5295. if (t.$flags$ |= 32, (s = loadModule(o)).then) {
  5296. const e = (() => {});
  5297. s = await s, e();
  5298. }
  5299. !s.isProxied && ((o.$watchers$ = s.watchers),
  5300. proxyComponent(s, o, 2), s.isProxied = !0);
  5301. const e = createTime("createInstance", o.$tagName$);
  5302. (t.$flags$ |= 8);
  5303. try {
  5304. new s(t);
  5305. } catch (e) {
  5306. consoleError(e);
  5307. }
  5308. (t.$flags$ &= -9), (t.$flags$ |= 128), e(),
  5309. fireConnectedCallback(t.$lazyInstance$);
  5310. }
  5311. if (s.style) {
  5312. let n = s.style;
  5313. const l = getScopeId(o);
  5314. if (!styles.has(l)) {
  5315. const e = createTime("registerStyles", o.$tagName$);
  5316. registerStyle(l, n), e();
  5317. }
  5318. }
  5319. }
  5320. const r = t.$ancestorComponent$, i = () => scheduleUpdate(t, !0);
  5321. r && r["s-rc"] ? r["s-rc"].push(i) : i();
  5322. }, fireConnectedCallback = e => {
  5323. safeCall(e, "connectedCallback");
  5324. }, connectedCallback = e => {
  5325. if (0 == (1 & plt.$flags$)) {
  5326. const t = getHostRef(e), o = t.$cmpMeta$, n = createTime("connectedCallback", o.$tagName$);
  5327. if (1 & t.$flags$) addHostEventListeners(e, t, o.$listeners$), fireConnectedCallback(t.$lazyInstance$); else {
  5328. let n;
  5329. if (t.$flags$ |= 1, (n = e.getAttribute("s-id"), n)) {
  5330. ((e, t, o, n) => {
  5331. const s = createTime("hydrateClient", t), l = e.shadowRoot, a = [], r = l ? [] : null, i = n.$vnode$ = newVNode(t, null);
  5332. plt.$orgLocNodes$ || initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map),
  5333. e["s-id"] = o, e.removeAttribute("s-id"), clientHydrate(i, a, [], r, e, e, o), a.map((e => {
  5334. const o = e.$hostId$ + "." + e.$nodeId$, n = plt.$orgLocNodes$.get(o), s = e.$elm$;
  5335. n && supportsShadow && "" === n["s-en"] && n.parentNode.insertBefore(s, n.nextSibling),
  5336. l || (s["s-hn"] = t, n && (s["s-ol"] = n, s["s-ol"]["s-nr"] = s)), plt.$orgLocNodes$.delete(o);
  5337. })), l && r.map((e => {
  5338. e && l.appendChild(e);
  5339. })), s();
  5340. })(e, o.$tagName$, n, t);
  5341. }
  5342. if (!n && (BUILD.hydrateServerSide ) && setContentReference(e),
  5343. BUILD.asyncLoading) {
  5344. let o = e;
  5345. for (;o = o.parentNode || o.host; ) if (1 === o.nodeType && o.hasAttribute("s-id") && o["s-p"] || o["s-p"]) {
  5346. attachToAncestor(t, t.$ancestorComponent$ = o);
  5347. break;
  5348. }
  5349. }
  5350. initializeComponent(e, t, o);
  5351. }
  5352. n();
  5353. }
  5354. }, setContentReference = e => {
  5355. const t = e["s-cr"] = doc.createComment("");
  5356. t["s-cn"] = !0, e.insertBefore(t, e.firstChild);
  5357. }, insertVdomAnnotations = (e, t) => {
  5358. if (null != e) {
  5359. const o = {
  5360. hostIds: 0,
  5361. rootLevelIds: 0,
  5362. staticComponents: new Set(t)
  5363. }, n = [];
  5364. parseVNodeAnnotations(e, e.body, o, n), n.forEach((t => {
  5365. if (null != t) {
  5366. const n = t["s-nr"];
  5367. let s = n["s-host-id"], l = n["s-node-id"], a = `${s}.${l}`;
  5368. if (null == s) if (s = 0, o.rootLevelIds++, l = o.rootLevelIds, a = `${s}.${l}`,
  5369. 1 === n.nodeType) n.setAttribute("c-id", a); else if (3 === n.nodeType) {
  5370. if (0 === s && "" === n.nodeValue.trim()) return void t.remove();
  5371. const o = e.createComment(a);
  5372. o.nodeValue = `t.${a}`, n.parentNode.insertBefore(o, n);
  5373. }
  5374. let r = `o.${a}`;
  5375. const i = t.parentElement;
  5376. i && ("" === i["s-en"] ? r += "." : "c" === i["s-en"] && (r += ".c")), t.nodeValue = r;
  5377. }
  5378. }));
  5379. }
  5380. }, parseVNodeAnnotations = (e, t, o, n) => {
  5381. null != t && (null != t["s-nr"] && n.push(t), 1 === t.nodeType && t.childNodes.forEach((t => {
  5382. const s = getHostRef(t);
  5383. if (null != s && !o.staticComponents.has(t.nodeName.toLowerCase())) {
  5384. const n = {
  5385. nodeIds: 0
  5386. };
  5387. insertVNodeAnnotations(e, t, s.$vnode$, o, n);
  5388. }
  5389. parseVNodeAnnotations(e, t, o, n);
  5390. })));
  5391. }, insertVNodeAnnotations = (e, t, o, n, s) => {
  5392. if (null != o) {
  5393. const l = ++n.hostIds;
  5394. if (t.setAttribute("s-id", l), null != t["s-cr"] && (t["s-cr"].nodeValue = `r.${l}`),
  5395. null != o.$children$) {
  5396. const t = 0;
  5397. o.$children$.forEach(((o, n) => {
  5398. insertChildVNodeAnnotations(e, o, s, l, t, n);
  5399. }));
  5400. }
  5401. if (t && o && o.$elm$ && !t.hasAttribute("c-id")) {
  5402. const e = t.parentElement;
  5403. if (e && e.childNodes) {
  5404. const n = Array.from(e.childNodes), s = n.find((e => 8 === e.nodeType && e["s-sr"]));
  5405. if (s) {
  5406. const e = n.indexOf(t) - 1;
  5407. o.$elm$.setAttribute("c-id", `${s["s-host-id"]}.${s["s-node-id"]}.0.${e}`);
  5408. }
  5409. }
  5410. }
  5411. }
  5412. }, insertChildVNodeAnnotations = (e, t, o, n, s, l) => {
  5413. const a = t.$elm$;
  5414. if (null == a) return;
  5415. const r = o.nodeIds++, i = `${n}.${r}.${s}.${l}`;
  5416. if (a["s-host-id"] = n, a["s-node-id"] = r, 1 === a.nodeType) a.setAttribute("c-id", i); else if (3 === a.nodeType) {
  5417. const t = a.parentNode, o = t.nodeName;
  5418. if ("STYLE" !== o && "SCRIPT" !== o) {
  5419. const o = `t.${i}`, n = e.createComment(o);
  5420. t.insertBefore(n, a);
  5421. }
  5422. } else if (8 === a.nodeType && a["s-sr"]) {
  5423. const e = `s.${i}.${a["s-sn"] || ""}`;
  5424. a.nodeValue = e;
  5425. }
  5426. if (null != t.$children$) {
  5427. const l = s + 1;
  5428. t.$children$.forEach(((t, s) => {
  5429. insertChildVNodeAnnotations(e, t, o, n, l, s);
  5430. }));
  5431. }
  5432. }, Fragment = (e, t) => t, NO_HYDRATE_TAGS = new Set([ "CODE", "HEAD", "IFRAME", "INPUT", "OBJECT", "OUTPUT", "NOSCRIPT", "PRE", "SCRIPT", "SELECT", "STYLE", "TEMPLATE", "TEXTAREA" ]), hAsync = (e, t, ...o) => {
  5433. if (Array.isArray(o) && o.length > 0) {
  5434. const n = o.flat(1 / 0);
  5435. return n.some(isPromise) ? Promise.all(n).then((o => h(e, t, ...o))).catch((o => h(e, t))) : h(e, t, ...o);
  5436. }
  5437. return h(e, t);
  5438. };
  5439. const cmpModules = new Map, getModule = e => {
  5440. if ("string" == typeof e) {
  5441. e = e.toLowerCase();
  5442. const t = cmpModules.get(e);
  5443. if (null != t) return t[e];
  5444. }
  5445. return null;
  5446. }, loadModule = (e, t, o) => getModule(e.$tagName$), isMemberInElement = (e, t) => {
  5447. if (null != e) {
  5448. if (t in e) return !0;
  5449. const o = getModule(e.nodeName);
  5450. if (null != o) {
  5451. const e = o;
  5452. if (null != e && null != e.cmpMeta && null != e.cmpMeta.$members$) return t in e.cmpMeta.$members$;
  5453. }
  5454. }
  5455. return !1;
  5456. }, registerComponents = e => {
  5457. for (const t of e) {
  5458. const e = t.cmpMeta.$tagName$;
  5459. cmpModules.set(e, {
  5460. [e]: t
  5461. });
  5462. }
  5463. }, win = window, doc = win.document, writeTask = e => {
  5464. process.nextTick((() => {
  5465. try {
  5466. e();
  5467. } catch (e) {
  5468. consoleError(e);
  5469. }
  5470. }));
  5471. }, resolved = Promise.resolve(), nextTick = e => resolved.then(e), defaultConsoleError = e => {
  5472. null != e && console.error(e.stack || e.message || e);
  5473. }, consoleError = (e, t) => (defaultConsoleError)(e, t), plt = {
  5474. $flags$: 0,
  5475. $resourcesUrl$: "",
  5476. jmp: e => e(),
  5477. raf: e => requestAnimationFrame(e),
  5478. ael: (e, t, o, n) => e.addEventListener(t, o, n),
  5479. rel: (e, t, o, n) => e.removeEventListener(t, o, n),
  5480. ce: (e, t) => new win.CustomEvent(e, t)
  5481. }, supportsShadow = !1, hostRefs = new WeakMap, getHostRef = e => hostRefs.get(e), registerInstance = (e, t) => hostRefs.set(t.$lazyInstance$ = e, t), registerHost = (e, t) => {
  5482. const o = {
  5483. $flags$: 0,
  5484. $cmpMeta$: t,
  5485. $hostElement$: e,
  5486. $instanceValues$: new Map,
  5487. $renderCount$: 0
  5488. };
  5489. return o.$onInstancePromise$ = new Promise((e => o.$onInstanceResolve$ = e)), o.$onReadyPromise$ = new Promise((e => o.$onReadyResolve$ = e)),
  5490. e["s-p"] = [], e["s-rc"] = [], addHostEventListeners(e, o, t.$listeners$), hostRefs.set(e, o);
  5491. }, styles = new Map;
  5492. const accordionCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-accordion:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-accordion{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-accordion{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-accordion{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-accordion{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-accordion{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-accordion:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-accordion-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-accordion-h{--calcite-accordion-item-spacing-unit:0.25rem;--calcite-accordion-icon-margin:0.5rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-accordion-h{--calcite-accordion-item-spacing-unit:0.5rem;--calcite-accordion-icon-margin:0.75rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-accordion-h{--calcite-accordion-item-spacing-unit:0.75rem;--calcite-accordion-icon-margin:1rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host*/.sc-calcite-accordion-h{position:relative;display:block;max-width:100%;line-height:1.5rem;--calcite-accordion-item-border:var(--calcite-ui-border-2);--calcite-accordion-item-background:var(--calcite-ui-foreground-1)}/*!@.accordion--transparent*/.accordion--transparent.sc-calcite-accordion{--calcite-accordion-item-border:transparent;--calcite-accordion-item-background:transparent}/*!@.accordion--minimal*/.accordion--minimal.sc-calcite-accordion{--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0}/*!@.accordion*/.accordion.sc-calcite-accordion{border-width:1px;border-bottom-width:0px;border-style:solid;border-color:var(--calcite-ui-border-2)}";
  5493. /**
  5494. * @slot - A slot for adding `calcite-accordion-item`s. `calcite-accordion` cannot be nested, however calcite-accordion-item`s can.
  5495. */
  5496. class Accordion {
  5497. constructor(hostRef) {
  5498. registerInstance(this, hostRef);
  5499. this.calciteAccordionChange = createEvent(this, "calciteAccordionChange", 7);
  5500. //--------------------------------------------------------------------------
  5501. //
  5502. // Public Properties
  5503. //
  5504. //--------------------------------------------------------------------------
  5505. /** specify the appearance - default (containing border), or minimal (no containing border), defaults to default */
  5506. this.appearance = "default";
  5507. /** specify the placement of the icon in the header, defaults to end */
  5508. this.iconPosition = "end";
  5509. /** specify the type of the icon in the header, defaults to chevron */
  5510. this.iconType = "chevron";
  5511. /** specify the scale of accordion, defaults to m */
  5512. this.scale = "m";
  5513. /** specify the selection mode - multi (allow any number of open items), single (allow one open item),
  5514. * or single-persist (allow and require one open item), defaults to multi */
  5515. this.selectionMode = "multi";
  5516. //--------------------------------------------------------------------------
  5517. //
  5518. // Private State/Props
  5519. //
  5520. //--------------------------------------------------------------------------
  5521. /** created list of Accordion items */
  5522. this.items = [];
  5523. /** keep track of whether the items have been sorted so we don't re-sort */
  5524. this.sorted = false;
  5525. this.sortItems = (items) => items.sort((a, b) => a.position - b.position).map((a) => a.item);
  5526. }
  5527. //--------------------------------------------------------------------------
  5528. //
  5529. // Lifecycle
  5530. //
  5531. //--------------------------------------------------------------------------
  5532. componentDidLoad() {
  5533. if (!this.sorted) {
  5534. this.items = this.sortItems(this.items);
  5535. this.sorted = true;
  5536. }
  5537. }
  5538. render() {
  5539. return (hAsync("div", { class: {
  5540. "accordion--transparent": this.appearance === "transparent",
  5541. "accordion--minimal": this.appearance === "minimal",
  5542. accordion: this.appearance === "default"
  5543. } }, hAsync("slot", null)));
  5544. }
  5545. //--------------------------------------------------------------------------
  5546. //
  5547. // Event Listeners
  5548. //
  5549. //--------------------------------------------------------------------------
  5550. calciteAccordionItemKeyEvent(e) {
  5551. const item = e.detail.item;
  5552. const parent = e.detail.parent;
  5553. if (this.el === parent) {
  5554. const key = item.key;
  5555. const itemToFocus = e.target;
  5556. const isFirstItem = this.itemIndex(itemToFocus) === 0;
  5557. const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
  5558. switch (key) {
  5559. case "ArrowDown":
  5560. if (isLastItem) {
  5561. this.focusFirstItem();
  5562. }
  5563. else {
  5564. this.focusNextItem(itemToFocus);
  5565. }
  5566. break;
  5567. case "ArrowUp":
  5568. if (isFirstItem) {
  5569. this.focusLastItem();
  5570. }
  5571. else {
  5572. this.focusPrevItem(itemToFocus);
  5573. }
  5574. break;
  5575. case "Home":
  5576. this.focusFirstItem();
  5577. break;
  5578. case "End":
  5579. this.focusLastItem();
  5580. break;
  5581. }
  5582. }
  5583. }
  5584. registerCalciteAccordionItem(e) {
  5585. const item = {
  5586. item: e.target,
  5587. parent: e.detail.parent,
  5588. position: e.detail.position
  5589. };
  5590. if (this.el === item.parent) {
  5591. this.items.push(item);
  5592. }
  5593. }
  5594. updateActiveItemOnChange(event) {
  5595. this.requestedAccordionItem = event.detail.requestedAccordionItem;
  5596. this.calciteAccordionChange.emit({
  5597. requestedAccordionItem: this.requestedAccordionItem
  5598. });
  5599. }
  5600. //--------------------------------------------------------------------------
  5601. //
  5602. // Private Methods
  5603. //
  5604. //--------------------------------------------------------------------------
  5605. focusFirstItem() {
  5606. const firstItem = this.items[0];
  5607. this.focusElement(firstItem);
  5608. }
  5609. focusLastItem() {
  5610. const lastItem = this.items[this.items.length - 1];
  5611. this.focusElement(lastItem);
  5612. }
  5613. focusNextItem(e) {
  5614. const index = this.itemIndex(e);
  5615. const nextItem = this.items[index + 1] || this.items[0];
  5616. this.focusElement(nextItem);
  5617. }
  5618. focusPrevItem(e) {
  5619. const index = this.itemIndex(e);
  5620. const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
  5621. this.focusElement(prevItem);
  5622. }
  5623. itemIndex(e) {
  5624. return this.items.indexOf(e);
  5625. }
  5626. focusElement(item) {
  5627. const target = item;
  5628. target.focus();
  5629. }
  5630. get el() { return getElement(this); }
  5631. static get style() { return accordionCss; }
  5632. static get cmpMeta() { return {
  5633. "$flags$": 9,
  5634. "$tagName$": "calcite-accordion",
  5635. "$members$": {
  5636. "appearance": [513],
  5637. "iconPosition": [513, "icon-position"],
  5638. "iconType": [513, "icon-type"],
  5639. "scale": [513],
  5640. "selectionMode": [513, "selection-mode"]
  5641. },
  5642. "$listeners$": [[0, "calciteAccordionItemKeyEvent", "calciteAccordionItemKeyEvent"], [0, "calciteAccordionItemRegister", "registerCalciteAccordionItem"], [0, "calciteAccordionItemSelect", "updateActiveItemOnChange"]],
  5643. "$lazyBundleId$": "-",
  5644. "$attrsToReflect$": [["appearance", "appearance"], ["iconPosition", "icon-position"], ["iconType", "icon-type"], ["scale", "scale"], ["selectionMode", "selection-mode"]]
  5645. }; }
  5646. }
  5647. const autoTheme = "calcite-theme-auto";
  5648. const darkTheme = "calcite-theme-dark";
  5649. const lightTheme = "calcite-theme-light";
  5650. const CSS_UTILITY = {
  5651. autoTheme,
  5652. darkTheme,
  5653. lightTheme,
  5654. rtl: "calcite--rtl"
  5655. };
  5656. const TEXT$s = {
  5657. loading: "Loading"
  5658. };
  5659. function gen(counts) {
  5660. return counts
  5661. .map((count) => {
  5662. let out = "";
  5663. for (let i = 0; i < count; i++) {
  5664. out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  5665. }
  5666. return out;
  5667. })
  5668. .join("-");
  5669. }
  5670. const guid = () => gen([2, 1, 1, 1, 3]);
  5671. /**
  5672. * This helper will guarantee an ID on the provided element.
  5673. *
  5674. * If it already has an ID, it will be preserved, otherwise a unique one will be generated and assigned.
  5675. *
  5676. * @returns {string} The element's ID.
  5677. */
  5678. function ensureId(el) {
  5679. if (!el) {
  5680. return "";
  5681. }
  5682. return (el.id = el.id || `${el.tagName.toLowerCase()}-${guid()}`);
  5683. }
  5684. function nodeListToArray(nodeList) {
  5685. return Array.isArray(nodeList) ? nodeList : Array.from(nodeList);
  5686. }
  5687. function getThemeName(el) {
  5688. const closestElWithTheme = closestElementCrossShadowBoundary(el, `.${CSS_UTILITY.darkTheme}, .${CSS_UTILITY.lightTheme}`);
  5689. return (closestElWithTheme === null || closestElWithTheme === void 0 ? void 0 : closestElWithTheme.classList.contains("calcite-theme-dark")) ? "dark" : "light";
  5690. }
  5691. function getElementDir(el) {
  5692. const prop = "dir";
  5693. const selector = `[${prop}]`;
  5694. const closest = closestElementCrossShadowBoundary(el, selector);
  5695. return closest ? closest.getAttribute(prop) : "ltr";
  5696. }
  5697. function getElementProp(el, prop, fallbackValue) {
  5698. const selector = `[${prop}]`;
  5699. const closest = el.closest(selector);
  5700. return closest ? closest.getAttribute(prop) : fallbackValue;
  5701. }
  5702. function getRootNode(el) {
  5703. return el.getRootNode();
  5704. }
  5705. function getHost(root) {
  5706. return root.host || null;
  5707. }
  5708. /**
  5709. * This helper queries an element's rootNodes and any ancestor rootNodes.
  5710. *
  5711. * @returns {Element[]} The elements.
  5712. */
  5713. function queryElementsRoots(element, selector) {
  5714. // Gets the rootNode and any ancestor rootNodes (shadowRoot or document) of an element and queries them for a selector.
  5715. // Based on: https://stackoverflow.com/q/54520554/194216
  5716. function queryFromAll(el, allResults) {
  5717. if (!el) {
  5718. return allResults;
  5719. }
  5720. if (el.assignedSlot) {
  5721. el = el.assignedSlot;
  5722. }
  5723. const rootNode = getRootNode(el);
  5724. const results = Array.from(rootNode.querySelectorAll(selector));
  5725. const uniqueResults = results.filter((result) => !allResults.includes(result));
  5726. allResults = [...allResults, ...uniqueResults];
  5727. const host = getHost(rootNode);
  5728. return host ? queryFromAll(host, allResults) : allResults;
  5729. }
  5730. return queryFromAll(element, []);
  5731. }
  5732. /**
  5733. * This helper queries an element's rootNode and any ancestor rootNodes.
  5734. *
  5735. * If both an 'id' and 'selector' are supplied, 'id' will take precedence over 'selector'.
  5736. *
  5737. * @returns {Element} The element.
  5738. */
  5739. function queryElementRoots(element, { selector, id }) {
  5740. // Gets the rootNode and any ancestor rootNodes (shadowRoot or document) of an element and queries them for a selector.
  5741. // Based on: https://stackoverflow.com/q/54520554/194216
  5742. function queryFrom(el) {
  5743. if (!el) {
  5744. return null;
  5745. }
  5746. if (el.assignedSlot) {
  5747. el = el.assignedSlot;
  5748. }
  5749. const rootNode = getRootNode(el);
  5750. const found = id
  5751. ? "getElementById" in rootNode
  5752. ? /*
  5753. Check to make sure 'getElementById' exists in cases where element is no longer connected to the DOM and getRootNode() returns the element.
  5754. https://github.com/Esri/calcite-components/pull/4280
  5755. */
  5756. rootNode.getElementById(id)
  5757. : null
  5758. : selector
  5759. ? rootNode.querySelector(selector)
  5760. : null;
  5761. const host = getHost(rootNode);
  5762. return found ? found : host ? queryFrom(host) : null;
  5763. }
  5764. return queryFrom(element);
  5765. }
  5766. function closestElementCrossShadowBoundary(element, selector) {
  5767. // based on https://stackoverflow.com/q/54520554/194216
  5768. function closestFrom(el) {
  5769. return el ? el.closest(selector) || closestFrom(getHost(getRootNode(el))) : null;
  5770. }
  5771. return closestFrom(element);
  5772. }
  5773. function isCalciteFocusable(el) {
  5774. return typeof (el === null || el === void 0 ? void 0 : el.setFocus) === "function";
  5775. }
  5776. async function focusElement(el) {
  5777. if (!el) {
  5778. return;
  5779. }
  5780. return isCalciteFocusable(el) ? el.setFocus() : el.focus();
  5781. }
  5782. const defaultSlotSelector = ":not([slot])";
  5783. function getSlotted(element, slotName, options) {
  5784. if (slotName && !Array.isArray(slotName) && typeof slotName !== "string") {
  5785. options = slotName;
  5786. slotName = null;
  5787. }
  5788. const slotSelector = slotName
  5789. ? Array.isArray(slotName)
  5790. ? slotName.map((name) => `[slot="${name}"]`).join(",")
  5791. : `[slot="${slotName}"]`
  5792. : defaultSlotSelector;
  5793. if (options === null || options === void 0 ? void 0 : options.all) {
  5794. return queryMultiple(element, slotSelector, options);
  5795. }
  5796. return querySingle(element, slotSelector, options);
  5797. }
  5798. function getDirectChildren(el, selector) {
  5799. return el ? Array.from(el.children || []).filter((child) => child === null || child === void 0 ? void 0 : child.matches(selector)) : [];
  5800. }
  5801. function queryMultiple(element, slotSelector, options) {
  5802. let matches = slotSelector === defaultSlotSelector
  5803. ? getDirectChildren(element, defaultSlotSelector)
  5804. : Array.from(element.querySelectorAll(slotSelector));
  5805. matches = options && options.direct === false ? matches : matches.filter((el) => el.parentElement === element);
  5806. matches = (options === null || options === void 0 ? void 0 : options.matches) ? matches.filter((el) => el === null || el === void 0 ? void 0 : el.matches(options.matches)) : matches;
  5807. const selector = options === null || options === void 0 ? void 0 : options.selector;
  5808. return selector
  5809. ? matches
  5810. .map((item) => Array.from(item.querySelectorAll(selector)))
  5811. .reduce((previousValue, currentValue) => [...previousValue, ...currentValue], [])
  5812. .filter((match) => !!match)
  5813. : matches;
  5814. }
  5815. function querySingle(element, slotSelector, options) {
  5816. let match = slotSelector === defaultSlotSelector
  5817. ? getDirectChildren(element, defaultSlotSelector)[0] || null
  5818. : element.querySelector(slotSelector);
  5819. match = options && options.direct === false ? match : (match === null || match === void 0 ? void 0 : match.parentElement) === element ? match : null;
  5820. match = (options === null || options === void 0 ? void 0 : options.matches) ? ((match === null || match === void 0 ? void 0 : match.matches(options.matches)) ? match : null) : match;
  5821. const selector = options === null || options === void 0 ? void 0 : options.selector;
  5822. return selector ? match === null || match === void 0 ? void 0 : match.querySelector(selector) : match;
  5823. }
  5824. function filterDirectChildren(el, selector) {
  5825. return Array.from(el.children).filter((child) => child.matches(selector));
  5826. }
  5827. // set a default icon from a defined set or allow an override with an icon name string
  5828. function setRequestedIcon(iconObject, iconValue, matchedValue) {
  5829. if (typeof iconValue === "string" && iconValue !== "") {
  5830. return iconValue;
  5831. }
  5832. else if (iconValue === "") {
  5833. return iconObject[matchedValue];
  5834. }
  5835. }
  5836. function intersects(rect1, rect2) {
  5837. return !(rect2.left > rect1.right ||
  5838. rect2.right < rect1.left ||
  5839. rect2.top > rect1.bottom ||
  5840. rect2.bottom < rect1.top);
  5841. }
  5842. /**
  5843. * This helper makes sure that boolean aria attributes are properly converted to a string.
  5844. *
  5845. * It should only be used for aria attributes that require a string value of "true" or "false".
  5846. *
  5847. * @returns {string} The string conversion of a boolean value ("true" | "false").
  5848. */
  5849. function toAriaBoolean(value) {
  5850. return (!!value).toString();
  5851. }
  5852. const accordionItemCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-accordion-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-accordion-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-accordion-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-accordion-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-accordion-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-accordion-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-accordion-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-accordion-item-h{display:none}/*!@.icon-position--end, .icon-position--start*/.icon-position--end.sc-calcite-accordion-item,.icon-position--start.sc-calcite-accordion-item{--calcite-accordion-item-icon-rotation:calc(90deg * -1);--calcite-accordion-item-active-icon-rotation:0deg;--calcite-accordion-item-icon-rotation-rtl:90deg;--calcite-accordion-item-active-icon-rotation-rtl:0deg}/*!@.icon-position--start*/.icon-position--start.sc-calcite-accordion-item{--calcite-accordion-item-flex-direction:row-reverse;--calcite-accordion-item-icon-spacing-start:0;--calcite-accordion-item-icon-spacing-end:var(--calcite-accordion-icon-margin)}/*!@.icon-position--end*/.icon-position--end.sc-calcite-accordion-item{--calcite-accordion-item-flex-direction:row;--calcite-accordion-item-icon-spacing-start:var(--calcite-accordion-icon-margin);--calcite-accordion-item-icon-spacing-end:0}/*!@.icon-position--end:not(.icon-type--plus-minus)*/.icon-position--end.sc-calcite-accordion-item:not(.icon-type--plus-minus){--calcite-accordion-item-icon-rotation:0deg;--calcite-accordion-item-active-icon-rotation:180deg;--calcite-accordion-item-icon-rotation-rtl:0deg;--calcite-accordion-item-active-icon-rotation-rtl:calc(180deg * -1)}/*!@:host*/.sc-calcite-accordion-item-h{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;background-color:var(--calcite-accordion-item-background, var(--calcite-ui-foreground-1))}/*!@:host .accordion-item-header*/.sc-calcite-accordion-item-h .accordion-item-header.sc-calcite-accordion-item{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host(:focus) .accordion-item-header*/.sc-calcite-accordion-item-h:focus .accordion-item-header.sc-calcite-accordion-item{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([active])*/[active].sc-calcite-accordion-item-h{color:var(--calcite-ui-text-1)}/*!@:host([active]) .accordion-item-content*/[active].sc-calcite-accordion-item-h .accordion-item-content.sc-calcite-accordion-item{display:block;color:var(--calcite-ui-text-1)}/*!@:host([active]) .accordion-item-header*/[active].sc-calcite-accordion-item-h .accordion-item-header.sc-calcite-accordion-item{border-bottom-color:transparent}/*!@:host .accordion-item-header*/.sc-calcite-accordion-item-h .accordion-item-header.sc-calcite-accordion-item{display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-direction:var(--calcite-accordion-item-flex-direction);flex-direction:var(--calcite-accordion-item-flex-direction)}/*!@:host .accordion-item-icon*/.sc-calcite-accordion-item-h .accordion-item-icon.sc-calcite-accordion-item{position:relative;margin:0px;display:-ms-inline-flexbox;display:inline-flex;color:var(--calcite-ui-text-3);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-margin-end:var(--calcite-accordion-item-icon-spacing-start);margin-inline-end:var(--calcite-accordion-item-icon-spacing-start);-webkit-margin-start:var(--calcite-accordion-item-icon-spacing-end);margin-inline-start:var(--calcite-accordion-item-icon-spacing-end)}/*!@:host .accordion-item-content,\n:host .accordion-item-header*/.sc-calcite-accordion-item-h .accordion-item-content.sc-calcite-accordion-item,.sc-calcite-accordion-item-h .accordion-item-header.sc-calcite-accordion-item{padding:var(--calcite-accordion-item-padding);border-bottom:1px solid var(--calcite-accordion-item-border, var(--calcite-ui-border-2))}/*!@:host .accordion-item-header **/.sc-calcite-accordion-item-h .accordion-item-header.sc-calcite-accordion-item *.sc-calcite-accordion-item{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .accordion-item-content*/.sc-calcite-accordion-item-h .accordion-item-content.sc-calcite-accordion-item{display:none;padding-top:0px;color:var(--calcite-ui-text-3);text-align:initial}/*!@:host .accordion-item-expand-icon*/.sc-calcite-accordion-item-h .accordion-item-expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-3);-webkit-margin-start:var(--calcite-accordion-item-icon-spacing-start);margin-inline-start:var(--calcite-accordion-item-icon-spacing-start);-webkit-margin-end:var(--calcite-accordion-item-icon-spacing-end);margin-inline-end:var(--calcite-accordion-item-icon-spacing-end);-webkit-transform:rotate(var(--calcite-accordion-item-icon-rotation));transform:rotate(var(--calcite-accordion-item-icon-rotation))}/*!@.calcite--rtl .accordion-item-expand-icon*/.calcite--rtl.sc-calcite-accordion-item .accordion-item-expand-icon.sc-calcite-accordion-item{-webkit-transform:rotate(var(--calcite-accordion-item-icon-rotation-rtl));transform:rotate(var(--calcite-accordion-item-icon-rotation-rtl))}/*!@:host([active]) .accordion-item-expand-icon*/[active].sc-calcite-accordion-item-h .accordion-item-expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1);-webkit-transform:rotate(var(--calcite-accordion-item-active-icon-rotation));transform:rotate(var(--calcite-accordion-item-active-icon-rotation))}/*!@:host([active]) .calcite--rtl .accordion-item-expand-icon*/[active].sc-calcite-accordion-item-h .calcite--rtl.sc-calcite-accordion-item .accordion-item-expand-icon.sc-calcite-accordion-item{-webkit-transform:rotate(var(--calcite-accordion-item-active-icon-rotation-rtl));transform:rotate(var(--calcite-accordion-item-active-icon-rotation-rtl))}/*!@:host .accordion-item-header-text*/.sc-calcite-accordion-item-h .accordion-item-header-text.sc-calcite-accordion-item{margin-top:0px;margin-bottom:0px;-ms-flex-positive:1;flex-grow:1;-ms-flex-direction:column;flex-direction:column;padding-top:0px;padding-bottom:0px;text-align:initial;-webkit-margin-end:auto;margin-inline-end:auto}/*!@:host .accordion-item-title, :host .accordion-item-subtitle*/.sc-calcite-accordion-item-h .accordion-item-title.sc-calcite-accordion-item,.sc-calcite-accordion-item-h .accordion-item-subtitle.sc-calcite-accordion-item{display:-ms-flexbox;display:flex;width:100%}/*!@:host .accordion-item-title*/.sc-calcite-accordion-item-h .accordion-item-title.sc-calcite-accordion-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}/*!@:host .accordion-item-subtitle*/.sc-calcite-accordion-item-h .accordion-item-subtitle.sc-calcite-accordion-item{margin-top:0.25rem;color:var(--calcite-ui-text-3)}/*!@:host(:focus) .accordion-item-title, :host(:hover) .accordion-item-title*/.sc-calcite-accordion-item-h:focus .accordion-item-title.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .accordion-item-title.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .accordion-item-icon, :host(:hover) .accordion-item-icon*/.sc-calcite-accordion-item-h:focus .accordion-item-icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .accordion-item-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .accordion-item-expand-icon, :host(:hover) .accordion-item-expand-icon*/.sc-calcite-accordion-item-h:focus .accordion-item-expand-icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .accordion-item-expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .accordion-item-subtitle, :host(:hover) .accordion-item-subtitle*/.sc-calcite-accordion-item-h:focus .accordion-item-subtitle.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .accordion-item-subtitle.sc-calcite-accordion-item{color:var(--calcite-ui-text-2)}/*!@:host(:focus) .accordion-item-title, :host(:active) .accordion-item-title, :host([active]) .accordion-item-title*/.sc-calcite-accordion-item-h:focus .accordion-item-title.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .accordion-item-title.sc-calcite-accordion-item,[active].sc-calcite-accordion-item-h .accordion-item-title.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .accordion-item-icon, :host(:active) .accordion-item-icon, :host([active]) .accordion-item-icon*/.sc-calcite-accordion-item-h:focus .accordion-item-icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .accordion-item-icon.sc-calcite-accordion-item,[active].sc-calcite-accordion-item-h .accordion-item-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .accordion-item-expand-icon, :host(:active) .accordion-item-expand-icon, :host([active]) .accordion-item-expand-icon*/.sc-calcite-accordion-item-h:focus .accordion-item-expand-icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .accordion-item-expand-icon.sc-calcite-accordion-item,[active].sc-calcite-accordion-item-h .accordion-item-expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .accordion-item-subtitle, :host(:active) .accordion-item-subtitle, :host([active]) .accordion-item-subtitle*/.sc-calcite-accordion-item-h:focus .accordion-item-subtitle.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .accordion-item-subtitle.sc-calcite-accordion-item,[active].sc-calcite-accordion-item-h .accordion-item-subtitle.sc-calcite-accordion-item{color:var(--calcite-ui-text-2)}";
  5853. /**
  5854. * @slot - A slot for adding custom content, including nested `calcite-accordion-item`s.
  5855. */
  5856. class AccordionItem {
  5857. constructor(hostRef) {
  5858. registerInstance(this, hostRef);
  5859. this.calciteAccordionItemKeyEvent = createEvent(this, "calciteAccordionItemKeyEvent", 7);
  5860. this.calciteAccordionItemSelect = createEvent(this, "calciteAccordionItemSelect", 7);
  5861. this.calciteAccordionItemClose = createEvent(this, "calciteAccordionItemClose", 7);
  5862. this.calciteAccordionItemRegister = createEvent(this, "calciteAccordionItemRegister", 7);
  5863. //--------------------------------------------------------------------------
  5864. //
  5865. // Public Properties
  5866. //
  5867. //--------------------------------------------------------------------------
  5868. /** Indicates whether the item is active. */
  5869. this.active = false;
  5870. //--------------------------------------------------------------------------
  5871. //
  5872. // Private State/Props
  5873. //
  5874. //--------------------------------------------------------------------------
  5875. this.guid = guid();
  5876. /** what icon position does the parent accordion specify */
  5877. this.iconPosition = "end";
  5878. /** handle clicks on item header */
  5879. this.itemHeaderClickHandler = () => this.emitRequestedItem();
  5880. }
  5881. //--------------------------------------------------------------------------
  5882. //
  5883. // Lifecycle
  5884. //
  5885. //--------------------------------------------------------------------------
  5886. connectedCallback() {
  5887. this.parent = this.el.parentElement;
  5888. this.selectionMode = getElementProp(this.el, "selection-mode", "multi");
  5889. this.iconType = getElementProp(this.el, "icon-type", "chevron");
  5890. this.iconPosition = getElementProp(this.el, "icon-position", this.iconPosition);
  5891. }
  5892. componentDidLoad() {
  5893. this.itemPosition = this.getItemPosition();
  5894. this.calciteAccordionItemRegister.emit({
  5895. parent: this.parent,
  5896. position: this.itemPosition
  5897. });
  5898. }
  5899. render() {
  5900. const dir = getElementDir(this.el);
  5901. const iconEl = hAsync("calcite-icon", { class: "accordion-item-icon", icon: this.icon, scale: "s" });
  5902. const { guid } = this;
  5903. const regionId = `${guid}-region`;
  5904. const buttonId = `${guid}-button`;
  5905. return (hAsync(Host, { tabindex: "0" }, hAsync("div", { class: {
  5906. [`icon-position--${this.iconPosition}`]: true,
  5907. [`icon-type--${this.iconType}`]: true
  5908. } }, hAsync("div", { "aria-controls": regionId, class: { "accordion-item-header": true, [CSS_UTILITY.rtl]: dir === "rtl" }, id: buttonId, onClick: this.itemHeaderClickHandler, role: "button" }, this.icon ? iconEl : null, hAsync("div", { class: "accordion-item-header-text" }, hAsync("span", { class: "accordion-item-title" }, this.itemTitle), this.itemSubtitle ? (hAsync("span", { class: "accordion-item-subtitle" }, this.itemSubtitle)) : null), hAsync("calcite-icon", { class: "accordion-item-expand-icon", icon: this.iconType === "chevron"
  5909. ? "chevronDown"
  5910. : this.iconType === "caret"
  5911. ? "caretDown"
  5912. : this.active
  5913. ? "minus"
  5914. : "plus", scale: "s" })), hAsync("div", { "aria-expanded": toAriaBoolean(this.active), "aria-labelledby": buttonId, class: "accordion-item-content", id: regionId, role: "region" }, hAsync("slot", null)))));
  5915. }
  5916. //--------------------------------------------------------------------------
  5917. //
  5918. // Event Listeners
  5919. //
  5920. //--------------------------------------------------------------------------
  5921. keyDownHandler(e) {
  5922. if (e.target === this.el) {
  5923. switch (e.key) {
  5924. case " ":
  5925. case "Enter":
  5926. this.emitRequestedItem();
  5927. e.preventDefault();
  5928. break;
  5929. case "ArrowUp":
  5930. case "ArrowDown":
  5931. case "Home":
  5932. case "End":
  5933. this.calciteAccordionItemKeyEvent.emit({
  5934. parent: this.parent,
  5935. item: e
  5936. });
  5937. e.preventDefault();
  5938. break;
  5939. }
  5940. }
  5941. }
  5942. updateActiveItemOnChange(event) {
  5943. this.requestedAccordionItem = event.detail
  5944. .requestedAccordionItem;
  5945. if (this.el.parentNode !== this.requestedAccordionItem.parentNode) {
  5946. return;
  5947. }
  5948. this.determineActiveItem();
  5949. }
  5950. //--------------------------------------------------------------------------
  5951. //
  5952. // Private Methods
  5953. //
  5954. //--------------------------------------------------------------------------
  5955. determineActiveItem() {
  5956. switch (this.selectionMode) {
  5957. case "multi":
  5958. if (this.el === this.requestedAccordionItem) {
  5959. this.active = !this.active;
  5960. }
  5961. break;
  5962. case "single":
  5963. this.active = this.el === this.requestedAccordionItem ? !this.active : false;
  5964. break;
  5965. case "single-persist":
  5966. this.active = this.el === this.requestedAccordionItem;
  5967. break;
  5968. }
  5969. }
  5970. emitRequestedItem() {
  5971. this.calciteAccordionItemSelect.emit({
  5972. requestedAccordionItem: this.el
  5973. });
  5974. }
  5975. getItemPosition() {
  5976. return Array.prototype.indexOf.call(this.parent.querySelectorAll("calcite-accordion-item"), this.el);
  5977. }
  5978. get el() { return getElement(this); }
  5979. static get style() { return accordionItemCss; }
  5980. static get cmpMeta() { return {
  5981. "$flags$": 9,
  5982. "$tagName$": "calcite-accordion-item",
  5983. "$members$": {
  5984. "active": [1540],
  5985. "itemTitle": [1, "item-title"],
  5986. "itemSubtitle": [1, "item-subtitle"],
  5987. "icon": [513]
  5988. },
  5989. "$listeners$": [[0, "keydown", "keyDownHandler"], [16, "calciteAccordionChange", "updateActiveItemOnChange"]],
  5990. "$lazyBundleId$": "-",
  5991. "$attrsToReflect$": [["active", "active"], ["icon", "icon"]]
  5992. }; }
  5993. }
  5994. const CSS$P = {
  5995. button: "button",
  5996. buttonTextVisible: "button--text-visible",
  5997. buttonCompact: "button--compact",
  5998. iconContainer: "icon-container",
  5999. slotContainer: "slot-container",
  6000. slotContainerHidden: "slot-container--hidden",
  6001. textContainer: "text-container",
  6002. textContainerVisible: "text-container--visible"
  6003. };
  6004. const TEXT$r = {
  6005. loading: "Loading"
  6006. };
  6007. /**
  6008. * This utility ensures observers are created only for browser contexts.
  6009. *
  6010. * @param type - the type of observer to create
  6011. * @param callback - the observer callback
  6012. * @param options - the observer options
  6013. */
  6014. function createObserver(type, callback, options) {
  6015. return undefined;
  6016. }
  6017. function noopClick() {
  6018. /** noop **/
  6019. }
  6020. /**
  6021. * This helper updates the host element to prevent keyboard interaction on its subtree and sets the appropriate aria attribute for accessibility.
  6022. *
  6023. * This should be used in the `componentDidRender` lifecycle hook.
  6024. *
  6025. * **Notes**
  6026. *
  6027. * * this util is not needed for simple components whose root element or elements are an interactive component (custom element or native control). For those cases, set the `disabled` props on the root components instead.
  6028. * * technically, users can override `tabindex` and restore keyboard navigation, but this will be considered user error
  6029. */
  6030. function updateHostInteraction(component, hostIsTabbable = false) {
  6031. if (component.disabled) {
  6032. component.el.setAttribute("tabindex", "-1");
  6033. component.el.setAttribute("aria-disabled", "true");
  6034. if (component.el.contains(document.activeElement)) {
  6035. document.activeElement.blur();
  6036. }
  6037. component.el.click = noopClick;
  6038. return;
  6039. }
  6040. component.el.click = HTMLElement.prototype.click;
  6041. if (typeof hostIsTabbable === "function") {
  6042. component.el.setAttribute("tabindex", hostIsTabbable.call(component) ? "0" : "-1");
  6043. }
  6044. else if (hostIsTabbable === true) {
  6045. component.el.setAttribute("tabindex", "0");
  6046. }
  6047. else if (hostIsTabbable === false) {
  6048. component.el.removeAttribute("tabindex");
  6049. }
  6050. else ;
  6051. component.el.removeAttribute("aria-disabled");
  6052. }
  6053. const actionCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-action-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-action-h *.sc-calcite-action{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-action:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-h{display:none}/*!@:host*/.sc-calcite-action-h{display:-ms-flexbox;display:flex;background-color:transparent}/*!@:host([disabled])*/[disabled].sc-calcite-action-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-action-h[disabled] .sc-calcite-action-s>[calcite-hydrated][disabled],[disabled].sc-calcite-action-h [calcite-hydrated][disabled].sc-calcite-action{opacity:1}/*!@.button*/.button.sc-calcite-action{position:relative;margin:0px;display:-ms-flexbox;display:flex;width:auto;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start;border-style:none;background-color:var(--calcite-ui-foreground-1);fill:var(--calcite-ui-text-3);font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-3);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;text-align:unset;-ms-flex:1 0 auto;flex:1 0 auto}/*!@.button:hover*/.button.sc-calcite-action:hover{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}/*!@.button:focus*/.button.sc-calcite-action:focus{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.button:active*/.button.sc-calcite-action:active{background-color:var(--calcite-ui-foreground-3)}/*!@.button .icon-container*/.button.sc-calcite-action .icon-container.sc-calcite-action{pointer-events:none;margin:0px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:1rem;min-height:1rem}/*!@.button .text-container*/.button.sc-calcite-action .text-container.sc-calcite-action{margin:0px;width:0px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1rem;opacity:0;-webkit-transition-property:opacity;transition-property:opacity;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-property:margin;transition-property:margin;-webkit-transition-property:width;transition-property:width}/*!@.button .text-container--visible*/.button.sc-calcite-action .text-container--visible.sc-calcite-action{width:auto;-ms-flex:1 1 auto;flex:1 1 auto;opacity:1}/*!@:host([scale=s]) .button*/[scale=s].sc-calcite-action-h .button.sc-calcite-action{padding:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}/*!@:host([scale=s]) .button--text-visible .icon-container*/[scale=s].sc-calcite-action-h .button--text-visible.sc-calcite-action .icon-container.sc-calcite-action{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}/*!@:host([scale=m]) .button*/[scale=m].sc-calcite-action-h .button.sc-calcite-action{padding:1rem;font-size:var(--calcite-font-size--1);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}/*!@:host([scale=m]) .button--text-visible .icon-container*/[scale=m].sc-calcite-action-h .button--text-visible.sc-calcite-action .icon-container.sc-calcite-action{-webkit-margin-end:0.75rem;margin-inline-end:0.75rem}/*!@:host([scale=l]) .button*/[scale=l].sc-calcite-action-h .button.sc-calcite-action{padding:1.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-normal)}/*!@:host([scale=l]) .button--text-visible .icon-container*/[scale=l].sc-calcite-action-h .button--text-visible.sc-calcite-action .icon-container.sc-calcite-action{-webkit-margin-end:1rem;margin-inline-end:1rem}/*!@:host([alignment=center]) .button*/[alignment=center].sc-calcite-action-h .button.sc-calcite-action{-ms-flex-pack:center;justify-content:center}/*!@:host([alignment=end]) .button*/[alignment=end].sc-calcite-action-h .button.sc-calcite-action{-ms-flex-pack:end;justify-content:flex-end}/*!@:host([alignment=center]) .button .text-container--visible, :host([alignment=end]) .button .text-container--visible*/[alignment=center].sc-calcite-action-h .button.sc-calcite-action .text-container--visible.sc-calcite-action,[alignment=end].sc-calcite-action-h .button.sc-calcite-action .text-container--visible.sc-calcite-action{-ms-flex:0 1 auto;flex:0 1 auto}/*!@:host([scale=s][compact]) .button, :host([scale=m][compact]) .button, :host([scale=l][compact]) .button*/[scale=s][compact].sc-calcite-action-h .button.sc-calcite-action,[scale=m][compact].sc-calcite-action-h .button.sc-calcite-action,[scale=l][compact].sc-calcite-action-h .button.sc-calcite-action{padding-left:0px;padding-right:0px}/*!@.slot-container*/.slot-container.sc-calcite-action{display:-ms-flexbox;display:flex}/*!@.slot-container--hidden*/.slot-container--hidden.sc-calcite-action{display:none}/*!@.button--text-visible*/.button--text-visible.sc-calcite-action{width:100%}/*!@:host([active]) .button, :host([active]) .button:hover, :host([active]) .button:focus, :host([active][loading]) .button*/[active].sc-calcite-action-h .button.sc-calcite-action,[active].sc-calcite-action-h .button.sc-calcite-action:hover,[active].sc-calcite-action-h .button.sc-calcite-action:focus,[active][loading].sc-calcite-action-h .button.sc-calcite-action{background-color:var(--calcite-ui-foreground-3);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}/*!@:host([active]) .button:active*/[active].sc-calcite-action-h .button.sc-calcite-action:active{background-color:var(--calcite-ui-foreground-1)}/*!@:host([appearance=clear]) .button*/[appearance=clear].sc-calcite-action-h .button.sc-calcite-action{background-color:transparent;-webkit-transition-property:-webkit-box-shadow;transition-property:-webkit-box-shadow;transition-property:box-shadow;transition-property:box-shadow, -webkit-box-shadow;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host([appearance=clear]) .button:hover, :host([appearance=clear]) .button:focus*/[appearance=clear].sc-calcite-action-h .button.sc-calcite-action:hover,[appearance=clear].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:transparent;-webkit-box-shadow:0 0 0 2px var(--calcite-ui-border-1) inset;box-shadow:0 0 0 2px var(--calcite-ui-border-1) inset}/*!@:host([active][appearance=clear]) .button, :host([active][appearance=clear]) .button:hover, :host([active][appearance=clear]) .button:focus*/[active][appearance=clear].sc-calcite-action-h .button.sc-calcite-action,[active][appearance=clear].sc-calcite-action-h .button.sc-calcite-action:hover,[active][appearance=clear].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:var(--calcite-ui-foreground-3);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}/*!@:host([appearance=clear][loading]) .button, :host([appearance=clear][disabled]) .button*/[appearance=clear][loading].sc-calcite-action-h .button.sc-calcite-action,[appearance=clear][disabled].sc-calcite-action-h .button.sc-calcite-action{background-color:transparent}/*!@:host([loading]) .button, :host([loading]) .button:hover, :host([loading]) .button:focus*/[loading].sc-calcite-action-h .button.sc-calcite-action,[loading].sc-calcite-action-h .button.sc-calcite-action:hover,[loading].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:var(--calcite-ui-foreground-1)}/*!@:host([loading]) .button .text-container, :host([loading]) .button:hover .text-container, :host([loading]) .button:focus .text-container*/[loading].sc-calcite-action-h .button.sc-calcite-action .text-container.sc-calcite-action,[loading].sc-calcite-action-h .button.sc-calcite-action:hover .text-container.sc-calcite-action,[loading].sc-calcite-action-h .button.sc-calcite-action:focus .text-container.sc-calcite-action{opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([loading]) calcite-loader[inline]*/[loading].sc-calcite-action-h calcite-loader[inline].sc-calcite-action{margin-right:0px;color:var(--calcite-ui-text-3)}/*!@:host([disabled]) .button, :host([disabled]) .button:hover, :host([disabled]) .button:focus*/[disabled].sc-calcite-action-h .button.sc-calcite-action,[disabled].sc-calcite-action-h .button.sc-calcite-action:hover,[disabled].sc-calcite-action-h .button.sc-calcite-action:focus{cursor:default;background-color:var(--calcite-ui-foreground-1);opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled][active]) .button, :host([disabled][active]) .button:hover, :host([disabled][active]) .button:focus*/[disabled][active].sc-calcite-action-h .button.sc-calcite-action,[disabled][active].sc-calcite-action-h .button.sc-calcite-action:hover,[disabled][active].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:var(--calcite-ui-foreground-3);opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([indicator]) .button::after*/[indicator].sc-calcite-action-h .button.sc-calcite-action::after{content:\"\";position:absolute;z-index:10;height:0.5rem;width:0.5rem;border-radius:9999px;border-width:2px;background-color:var(--calcite-ui-brand);border-color:var(--calcite-ui-foreground-1);inset-block-end:0.75rem;inset-inline-end:0.75rem}/*!@:host([indicator]) .button--text-visible::after*/[indicator].sc-calcite-action-h .button--text-visible.sc-calcite-action::after{inset-block-end:auto}/*!@:host([indicator]) .button--text-visible .text-container--visible*/[indicator].sc-calcite-action-h .button--text-visible.sc-calcite-action .text-container--visible.sc-calcite-action{-webkit-margin-end:1rem;margin-inline-end:1rem}/*!@:host([indicator]) .button:hover::after,\n:host([indicator]) .button:focus::after*/[indicator].sc-calcite-action-h .button.sc-calcite-action:hover::after,[indicator].sc-calcite-action-h .button.sc-calcite-action:focus::after{border-color:var(--calcite-ui-foreground-1)}/*!@:host([indicator][scale=s]) .button::after*/[indicator][scale=s].sc-calcite-action-h .button.sc-calcite-action::after{inset-block-end:0.25rem;inset-inline-end:0.25rem}/*!@:host([indicator][scale=s]) .button--text-visible::after*/[indicator][scale=s].sc-calcite-action-h .button--text-visible.sc-calcite-action::after{inset-block-end:auto;inset-inline-end:0.5rem}/*!@:host([indicator][active]) .button::after*/[indicator][active].sc-calcite-action-h .button.sc-calcite-action::after{border-color:var(--calcite-ui-foreground-3)}";
  6054. /**
  6055. * @slot - A slot for adding a `calcite-icon`.
  6056. */
  6057. class Action {
  6058. constructor(hostRef) {
  6059. registerInstance(this, hostRef);
  6060. this.calciteActionClick = createEvent(this, "calciteActionClick", 7);
  6061. // --------------------------------------------------------------------------
  6062. //
  6063. // Properties
  6064. //
  6065. // --------------------------------------------------------------------------
  6066. /**
  6067. * Indicates whether the action is highlighted.
  6068. */
  6069. this.active = false;
  6070. /** Specify the appearance style of the action, defaults to solid. */
  6071. this.appearance = "solid";
  6072. /**
  6073. * Compact mode is used internally by components to reduce side padding, e.g. calcite-block-section.
  6074. */
  6075. this.compact = false;
  6076. /**
  6077. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  6078. */
  6079. this.disabled = false;
  6080. /**
  6081. * Indicates unread changes.
  6082. */
  6083. this.indicator = false;
  6084. /** string to override English loading text
  6085. * @default "Loading"
  6086. */
  6087. this.intlLoading = TEXT$r.loading;
  6088. /**
  6089. * When true, content is waiting to be loaded. This state shows a busy indicator.
  6090. */
  6091. this.loading = false;
  6092. /**
  6093. * Specifies the size of the action.
  6094. */
  6095. this.scale = "m";
  6096. /**
  6097. * Indicates whether the text is displayed.
  6098. */
  6099. this.textEnabled = false;
  6100. this.mutationObserver = createObserver();
  6101. // --------------------------------------------------------------------------
  6102. //
  6103. // Private Methods
  6104. //
  6105. // --------------------------------------------------------------------------
  6106. this.calciteActionClickHandler = () => {
  6107. if (!this.disabled) {
  6108. this.calciteActionClick.emit();
  6109. }
  6110. };
  6111. }
  6112. // --------------------------------------------------------------------------
  6113. //
  6114. // Lifecycle
  6115. //
  6116. // --------------------------------------------------------------------------
  6117. connectedCallback() {
  6118. var _a;
  6119. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  6120. }
  6121. disconnectedCallback() {
  6122. var _a;
  6123. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  6124. }
  6125. componentDidRender() {
  6126. updateHostInteraction(this);
  6127. }
  6128. // --------------------------------------------------------------------------
  6129. //
  6130. // Methods
  6131. //
  6132. // --------------------------------------------------------------------------
  6133. /** Sets focus on the component. */
  6134. async setFocus() {
  6135. this.buttonEl.focus();
  6136. }
  6137. // --------------------------------------------------------------------------
  6138. //
  6139. // Render Methods
  6140. //
  6141. // --------------------------------------------------------------------------
  6142. renderTextContainer() {
  6143. const { text, textEnabled } = this;
  6144. const textContainerClasses = {
  6145. [CSS$P.textContainer]: true,
  6146. [CSS$P.textContainerVisible]: textEnabled
  6147. };
  6148. return text ? (hAsync("div", { class: textContainerClasses, key: "text-container" }, text)) : null;
  6149. }
  6150. renderIconContainer() {
  6151. var _a;
  6152. const { loading, icon, scale, el, intlLoading } = this;
  6153. const iconScale = scale === "l" ? "m" : "s";
  6154. const loaderScale = scale === "l" ? "l" : "m";
  6155. const calciteLoaderNode = loading ? (hAsync("calcite-loader", { active: true, inline: true, label: intlLoading, scale: loaderScale })) : null;
  6156. const calciteIconNode = icon ? hAsync("calcite-icon", { icon: icon, scale: iconScale }) : null;
  6157. const iconNode = calciteLoaderNode || calciteIconNode;
  6158. const hasIconToDisplay = iconNode || ((_a = el.children) === null || _a === void 0 ? void 0 : _a.length);
  6159. const slotContainerNode = (hAsync("div", { class: {
  6160. [CSS$P.slotContainer]: true,
  6161. [CSS$P.slotContainerHidden]: loading
  6162. } }, hAsync("slot", null)));
  6163. return hasIconToDisplay ? (hAsync("div", { "aria-hidden": "true", class: CSS$P.iconContainer, key: "icon-container" }, iconNode, slotContainerNode)) : null;
  6164. }
  6165. render() {
  6166. const { compact, disabled, loading, textEnabled, label, text } = this;
  6167. const ariaLabel = label || text;
  6168. const buttonClasses = {
  6169. [CSS$P.button]: true,
  6170. [CSS$P.buttonTextVisible]: textEnabled,
  6171. [CSS$P.buttonCompact]: compact
  6172. };
  6173. return (hAsync(Host, { onClick: this.calciteActionClickHandler }, hAsync("button", { "aria-busy": toAriaBoolean(loading), "aria-disabled": toAriaBoolean(disabled), "aria-label": ariaLabel, class: buttonClasses, disabled: disabled, ref: (buttonEl) => (this.buttonEl = buttonEl) }, this.renderIconContainer(), this.renderTextContainer())));
  6174. }
  6175. get el() { return getElement(this); }
  6176. static get style() { return actionCss; }
  6177. static get cmpMeta() { return {
  6178. "$flags$": 9,
  6179. "$tagName$": "calcite-action",
  6180. "$members$": {
  6181. "active": [516],
  6182. "alignment": [513],
  6183. "appearance": [513],
  6184. "compact": [516],
  6185. "disabled": [516],
  6186. "icon": [1],
  6187. "indicator": [516],
  6188. "intlLoading": [1, "intl-loading"],
  6189. "label": [1],
  6190. "loading": [516],
  6191. "scale": [513],
  6192. "text": [1],
  6193. "textEnabled": [516, "text-enabled"],
  6194. "setFocus": [64]
  6195. },
  6196. "$listeners$": undefined,
  6197. "$lazyBundleId$": "-",
  6198. "$attrsToReflect$": [["active", "active"], ["alignment", "alignment"], ["appearance", "appearance"], ["compact", "compact"], ["disabled", "disabled"], ["indicator", "indicator"], ["loading", "loading"], ["scale", "scale"], ["textEnabled", "text-enabled"]]
  6199. }; }
  6200. }
  6201. const CSS$O = {
  6202. menu: "menu",
  6203. defaultTrigger: "default-trigger"
  6204. };
  6205. const SLOTS$p = {
  6206. tooltip: "tooltip",
  6207. trigger: "trigger"
  6208. };
  6209. const ICONS$f = {
  6210. menu: "ellipsis"
  6211. };
  6212. const SLOTS$o = {
  6213. menuActions: "menu-actions",
  6214. menuTooltip: "menu-tooltip"
  6215. };
  6216. const TEXT$q = {
  6217. more: "More"
  6218. };
  6219. const ICONS$e = {
  6220. menu: "ellipsis"
  6221. };
  6222. const overflowActionsDebounceInMs = 150;
  6223. const groupBufferHeight = 2;
  6224. const getMaxActionCount = ({ height, actionHeight, groupCount }) => {
  6225. return Math.floor((height - groupCount * groupBufferHeight) / actionHeight);
  6226. };
  6227. const getOverflowCount = ({ actionCount, actionHeight, height, groupCount }) => {
  6228. return Math.max(actionCount - getMaxActionCount({ height, actionHeight, groupCount }), 0);
  6229. };
  6230. const queryActions = (el) => {
  6231. return Array.from(el.querySelectorAll("calcite-action")).filter((action) => action.closest("calcite-action-menu") ? action.slot === SLOTS$p.trigger : true);
  6232. };
  6233. const overflowActions = ({ actionGroups, expanded, overflowCount }) => {
  6234. let needToSlotCount = overflowCount;
  6235. actionGroups.reverse().forEach((group) => {
  6236. let slottedWithinGroupCount = 0;
  6237. const groupActions = queryActions(group).reverse();
  6238. groupActions.forEach((groupAction) => {
  6239. if (groupAction.slot === SLOTS$o.menuActions) {
  6240. groupAction.removeAttribute("slot");
  6241. groupAction.textEnabled = expanded;
  6242. }
  6243. });
  6244. if (needToSlotCount > 0) {
  6245. groupActions.some((groupAction) => {
  6246. const unslottedActions = groupActions.filter((action) => !action.slot);
  6247. if (unslottedActions.length > 1 && groupActions.length > 2 && !groupAction.closest("calcite-action-menu")) {
  6248. groupAction.textEnabled = true;
  6249. groupAction.setAttribute("slot", SLOTS$o.menuActions);
  6250. slottedWithinGroupCount++;
  6251. if (slottedWithinGroupCount > 1) {
  6252. needToSlotCount--;
  6253. }
  6254. }
  6255. return needToSlotCount < 1;
  6256. });
  6257. }
  6258. forceUpdate$1(group);
  6259. });
  6260. };
  6261. const ICONS$d = {
  6262. chevronsLeft: "chevrons-left",
  6263. chevronsRight: "chevrons-right"
  6264. };
  6265. function getCalcitePosition(position, el) {
  6266. var _a;
  6267. return position || ((_a = el.closest("calcite-shell-panel")) === null || _a === void 0 ? void 0 : _a.position) || "start";
  6268. }
  6269. function toggleChildActionText({ parent, expanded }) {
  6270. queryActions(parent)
  6271. .filter((el) => el.slot !== SLOTS$o.menuActions)
  6272. .forEach((action) => (action.textEnabled = expanded));
  6273. parent.querySelectorAll("calcite-action-group").forEach((group) => (group.expanded = expanded));
  6274. }
  6275. const setTooltipReference = ({ tooltip, referenceElement, expanded, ref }) => {
  6276. if (tooltip) {
  6277. tooltip.referenceElement = !expanded && referenceElement ? referenceElement : null;
  6278. }
  6279. if (ref) {
  6280. ref(referenceElement);
  6281. }
  6282. return referenceElement;
  6283. };
  6284. const ExpandToggle = ({ expanded, intlExpand, intlCollapse, toggle, el, position, tooltip, ref, scale }) => {
  6285. const rtl = getElementDir(el) === "rtl";
  6286. const expandText = expanded ? intlCollapse : intlExpand;
  6287. const icons = [ICONS$d.chevronsLeft, ICONS$d.chevronsRight];
  6288. if (rtl) {
  6289. icons.reverse();
  6290. }
  6291. const end = getCalcitePosition(position, el) === "end";
  6292. const expandIcon = end ? icons[1] : icons[0];
  6293. const collapseIcon = end ? icons[0] : icons[1];
  6294. const actionNode = (hAsync("calcite-action", { icon: expanded ? expandIcon : collapseIcon, onClick: toggle, ref: (referenceElement) => setTooltipReference({ tooltip, referenceElement, expanded, ref }), scale: scale, text: expandText, textEnabled: expanded }));
  6295. return actionNode;
  6296. };
  6297. const CSS$N = {
  6298. actionGroupBottom: "action-group--bottom"
  6299. };
  6300. const SLOTS$n = {
  6301. bottomActions: "bottom-actions",
  6302. expandTooltip: "expand-tooltip"
  6303. };
  6304. const TEXT$p = {
  6305. expand: "Expand",
  6306. collapse: "Collapse"
  6307. };
  6308. /** Detect free variable `global` from Node.js. */
  6309. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  6310. /** Detect free variable `self`. */
  6311. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  6312. /** Used as a reference to the global object. */
  6313. var root = freeGlobal || freeSelf || Function('return this')();
  6314. /** Built-in value references. */
  6315. var Symbol$1 = root.Symbol;
  6316. /** Used for built-in method references. */
  6317. var objectProto$5 = Object.prototype;
  6318. /** Used to check objects for own properties. */
  6319. var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
  6320. /**
  6321. * Used to resolve the
  6322. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  6323. * of values.
  6324. */
  6325. var nativeObjectToString$1 = objectProto$5.toString;
  6326. /** Built-in value references. */
  6327. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
  6328. /**
  6329. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6330. *
  6331. * @private
  6332. * @param {*} value The value to query.
  6333. * @returns {string} Returns the raw `toStringTag`.
  6334. */
  6335. function getRawTag(value) {
  6336. var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
  6337. tag = value[symToStringTag$1];
  6338. try {
  6339. value[symToStringTag$1] = undefined;
  6340. var unmasked = true;
  6341. } catch (e) {}
  6342. var result = nativeObjectToString$1.call(value);
  6343. if (unmasked) {
  6344. if (isOwn) {
  6345. value[symToStringTag$1] = tag;
  6346. } else {
  6347. delete value[symToStringTag$1];
  6348. }
  6349. }
  6350. return result;
  6351. }
  6352. /** Used for built-in method references. */
  6353. var objectProto$4 = Object.prototype;
  6354. /**
  6355. * Used to resolve the
  6356. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  6357. * of values.
  6358. */
  6359. var nativeObjectToString = objectProto$4.toString;
  6360. /**
  6361. * Converts `value` to a string using `Object.prototype.toString`.
  6362. *
  6363. * @private
  6364. * @param {*} value The value to convert.
  6365. * @returns {string} Returns the converted string.
  6366. */
  6367. function objectToString(value) {
  6368. return nativeObjectToString.call(value);
  6369. }
  6370. /** `Object#toString` result references. */
  6371. var nullTag = '[object Null]',
  6372. undefinedTag = '[object Undefined]';
  6373. /** Built-in value references. */
  6374. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
  6375. /**
  6376. * The base implementation of `getTag` without fallbacks for buggy environments.
  6377. *
  6378. * @private
  6379. * @param {*} value The value to query.
  6380. * @returns {string} Returns the `toStringTag`.
  6381. */
  6382. function baseGetTag(value) {
  6383. if (value == null) {
  6384. return value === undefined ? undefinedTag : nullTag;
  6385. }
  6386. return (symToStringTag && symToStringTag in Object(value))
  6387. ? getRawTag(value)
  6388. : objectToString(value);
  6389. }
  6390. /**
  6391. * Checks if `value` is object-like. A value is object-like if it's not `null`
  6392. * and has a `typeof` result of "object".
  6393. *
  6394. * @static
  6395. * @memberOf _
  6396. * @since 4.0.0
  6397. * @category Lang
  6398. * @param {*} value The value to check.
  6399. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  6400. * @example
  6401. *
  6402. * _.isObjectLike({});
  6403. * // => true
  6404. *
  6405. * _.isObjectLike([1, 2, 3]);
  6406. * // => true
  6407. *
  6408. * _.isObjectLike(_.noop);
  6409. * // => false
  6410. *
  6411. * _.isObjectLike(null);
  6412. * // => false
  6413. */
  6414. function isObjectLike(value) {
  6415. return value != null && typeof value == 'object';
  6416. }
  6417. /** `Object#toString` result references. */
  6418. var symbolTag = '[object Symbol]';
  6419. /**
  6420. * Checks if `value` is classified as a `Symbol` primitive or object.
  6421. *
  6422. * @static
  6423. * @memberOf _
  6424. * @since 4.0.0
  6425. * @category Lang
  6426. * @param {*} value The value to check.
  6427. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  6428. * @example
  6429. *
  6430. * _.isSymbol(Symbol.iterator);
  6431. * // => true
  6432. *
  6433. * _.isSymbol('abc');
  6434. * // => false
  6435. */
  6436. function isSymbol(value) {
  6437. return typeof value == 'symbol' ||
  6438. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  6439. }
  6440. /**
  6441. * A specialized version of `_.map` for arrays without support for iteratee
  6442. * shorthands.
  6443. *
  6444. * @private
  6445. * @param {Array} [array] The array to iterate over.
  6446. * @param {Function} iteratee The function invoked per iteration.
  6447. * @returns {Array} Returns the new mapped array.
  6448. */
  6449. function arrayMap(array, iteratee) {
  6450. var index = -1,
  6451. length = array == null ? 0 : array.length,
  6452. result = Array(length);
  6453. while (++index < length) {
  6454. result[index] = iteratee(array[index], index, array);
  6455. }
  6456. return result;
  6457. }
  6458. /**
  6459. * Checks if `value` is classified as an `Array` object.
  6460. *
  6461. * @static
  6462. * @memberOf _
  6463. * @since 0.1.0
  6464. * @category Lang
  6465. * @param {*} value The value to check.
  6466. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  6467. * @example
  6468. *
  6469. * _.isArray([1, 2, 3]);
  6470. * // => true
  6471. *
  6472. * _.isArray(document.body.children);
  6473. * // => false
  6474. *
  6475. * _.isArray('abc');
  6476. * // => false
  6477. *
  6478. * _.isArray(_.noop);
  6479. * // => false
  6480. */
  6481. var isArray = Array.isArray;
  6482. /** Used as references for various `Number` constants. */
  6483. var INFINITY = 1 / 0;
  6484. /** Used to convert symbols to primitives and strings. */
  6485. var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
  6486. symbolToString = symbolProto ? symbolProto.toString : undefined;
  6487. /**
  6488. * The base implementation of `_.toString` which doesn't convert nullish
  6489. * values to empty strings.
  6490. *
  6491. * @private
  6492. * @param {*} value The value to process.
  6493. * @returns {string} Returns the string.
  6494. */
  6495. function baseToString(value) {
  6496. // Exit early for strings to avoid a performance hit in some environments.
  6497. if (typeof value == 'string') {
  6498. return value;
  6499. }
  6500. if (isArray(value)) {
  6501. // Recursively convert values (susceptible to call stack limits).
  6502. return arrayMap(value, baseToString) + '';
  6503. }
  6504. if (isSymbol(value)) {
  6505. return symbolToString ? symbolToString.call(value) : '';
  6506. }
  6507. var result = (value + '');
  6508. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  6509. }
  6510. /** Used to match a single whitespace character. */
  6511. var reWhitespace = /\s/;
  6512. /**
  6513. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  6514. * character of `string`.
  6515. *
  6516. * @private
  6517. * @param {string} string The string to inspect.
  6518. * @returns {number} Returns the index of the last non-whitespace character.
  6519. */
  6520. function trimmedEndIndex(string) {
  6521. var index = string.length;
  6522. while (index-- && reWhitespace.test(string.charAt(index))) {}
  6523. return index;
  6524. }
  6525. /** Used to match leading whitespace. */
  6526. var reTrimStart = /^\s+/;
  6527. /**
  6528. * The base implementation of `_.trim`.
  6529. *
  6530. * @private
  6531. * @param {string} string The string to trim.
  6532. * @returns {string} Returns the trimmed string.
  6533. */
  6534. function baseTrim(string) {
  6535. return string
  6536. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  6537. : string;
  6538. }
  6539. /**
  6540. * Checks if `value` is the
  6541. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  6542. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  6543. *
  6544. * @static
  6545. * @memberOf _
  6546. * @since 0.1.0
  6547. * @category Lang
  6548. * @param {*} value The value to check.
  6549. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  6550. * @example
  6551. *
  6552. * _.isObject({});
  6553. * // => true
  6554. *
  6555. * _.isObject([1, 2, 3]);
  6556. * // => true
  6557. *
  6558. * _.isObject(_.noop);
  6559. * // => true
  6560. *
  6561. * _.isObject(null);
  6562. * // => false
  6563. */
  6564. function isObject(value) {
  6565. var type = typeof value;
  6566. return value != null && (type == 'object' || type == 'function');
  6567. }
  6568. /** Used as references for various `Number` constants. */
  6569. var NAN = 0 / 0;
  6570. /** Used to detect bad signed hexadecimal string values. */
  6571. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  6572. /** Used to detect binary string values. */
  6573. var reIsBinary = /^0b[01]+$/i;
  6574. /** Used to detect octal string values. */
  6575. var reIsOctal = /^0o[0-7]+$/i;
  6576. /** Built-in method references without a dependency on `root`. */
  6577. var freeParseInt = parseInt;
  6578. /**
  6579. * Converts `value` to a number.
  6580. *
  6581. * @static
  6582. * @memberOf _
  6583. * @since 4.0.0
  6584. * @category Lang
  6585. * @param {*} value The value to process.
  6586. * @returns {number} Returns the number.
  6587. * @example
  6588. *
  6589. * _.toNumber(3.2);
  6590. * // => 3.2
  6591. *
  6592. * _.toNumber(Number.MIN_VALUE);
  6593. * // => 5e-324
  6594. *
  6595. * _.toNumber(Infinity);
  6596. * // => Infinity
  6597. *
  6598. * _.toNumber('3.2');
  6599. * // => 3.2
  6600. */
  6601. function toNumber(value) {
  6602. if (typeof value == 'number') {
  6603. return value;
  6604. }
  6605. if (isSymbol(value)) {
  6606. return NAN;
  6607. }
  6608. if (isObject(value)) {
  6609. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  6610. value = isObject(other) ? (other + '') : other;
  6611. }
  6612. if (typeof value != 'string') {
  6613. return value === 0 ? value : +value;
  6614. }
  6615. value = baseTrim(value);
  6616. var isBinary = reIsBinary.test(value);
  6617. return (isBinary || reIsOctal.test(value))
  6618. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  6619. : (reIsBadHex.test(value) ? NAN : +value);
  6620. }
  6621. /**
  6622. * This method returns the first argument it receives.
  6623. *
  6624. * @static
  6625. * @since 0.1.0
  6626. * @memberOf _
  6627. * @category Util
  6628. * @param {*} value Any value.
  6629. * @returns {*} Returns `value`.
  6630. * @example
  6631. *
  6632. * var object = { 'a': 1 };
  6633. *
  6634. * console.log(_.identity(object) === object);
  6635. * // => true
  6636. */
  6637. function identity(value) {
  6638. return value;
  6639. }
  6640. /** `Object#toString` result references. */
  6641. var asyncTag = '[object AsyncFunction]',
  6642. funcTag$1 = '[object Function]',
  6643. genTag = '[object GeneratorFunction]',
  6644. proxyTag = '[object Proxy]';
  6645. /**
  6646. * Checks if `value` is classified as a `Function` object.
  6647. *
  6648. * @static
  6649. * @memberOf _
  6650. * @since 0.1.0
  6651. * @category Lang
  6652. * @param {*} value The value to check.
  6653. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  6654. * @example
  6655. *
  6656. * _.isFunction(_);
  6657. * // => true
  6658. *
  6659. * _.isFunction(/abc/);
  6660. * // => false
  6661. */
  6662. function isFunction(value) {
  6663. if (!isObject(value)) {
  6664. return false;
  6665. }
  6666. // The use of `Object#toString` avoids issues with the `typeof` operator
  6667. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  6668. var tag = baseGetTag(value);
  6669. return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
  6670. }
  6671. /** Used as references for various `Number` constants. */
  6672. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  6673. /** Used to detect unsigned integer values. */
  6674. var reIsUint = /^(?:0|[1-9]\d*)$/;
  6675. /**
  6676. * Checks if `value` is a valid array-like index.
  6677. *
  6678. * @private
  6679. * @param {*} value The value to check.
  6680. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  6681. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  6682. */
  6683. function isIndex(value, length) {
  6684. var type = typeof value;
  6685. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  6686. return !!length &&
  6687. (type == 'number' ||
  6688. (type != 'symbol' && reIsUint.test(value))) &&
  6689. (value > -1 && value % 1 == 0 && value < length);
  6690. }
  6691. /** Used as references for various `Number` constants. */
  6692. var MAX_SAFE_INTEGER = 9007199254740991;
  6693. /**
  6694. * Checks if `value` is a valid array-like length.
  6695. *
  6696. * **Note:** This method is loosely based on
  6697. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  6698. *
  6699. * @static
  6700. * @memberOf _
  6701. * @since 4.0.0
  6702. * @category Lang
  6703. * @param {*} value The value to check.
  6704. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  6705. * @example
  6706. *
  6707. * _.isLength(3);
  6708. * // => true
  6709. *
  6710. * _.isLength(Number.MIN_VALUE);
  6711. * // => false
  6712. *
  6713. * _.isLength(Infinity);
  6714. * // => false
  6715. *
  6716. * _.isLength('3');
  6717. * // => false
  6718. */
  6719. function isLength(value) {
  6720. return typeof value == 'number' &&
  6721. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  6722. }
  6723. /**
  6724. * Checks if `value` is array-like. A value is considered array-like if it's
  6725. * not a function and has a `value.length` that's an integer greater than or
  6726. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  6727. *
  6728. * @static
  6729. * @memberOf _
  6730. * @since 4.0.0
  6731. * @category Lang
  6732. * @param {*} value The value to check.
  6733. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  6734. * @example
  6735. *
  6736. * _.isArrayLike([1, 2, 3]);
  6737. * // => true
  6738. *
  6739. * _.isArrayLike(document.body.children);
  6740. * // => true
  6741. *
  6742. * _.isArrayLike('abc');
  6743. * // => true
  6744. *
  6745. * _.isArrayLike(_.noop);
  6746. * // => false
  6747. */
  6748. function isArrayLike(value) {
  6749. return value != null && isLength(value.length) && !isFunction(value);
  6750. }
  6751. /** Used for built-in method references. */
  6752. var objectProto$3 = Object.prototype;
  6753. /**
  6754. * Checks if `value` is likely a prototype object.
  6755. *
  6756. * @private
  6757. * @param {*} value The value to check.
  6758. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  6759. */
  6760. function isPrototype(value) {
  6761. var Ctor = value && value.constructor,
  6762. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
  6763. return value === proto;
  6764. }
  6765. /**
  6766. * The base implementation of `_.times` without support for iteratee shorthands
  6767. * or max array length checks.
  6768. *
  6769. * @private
  6770. * @param {number} n The number of times to invoke `iteratee`.
  6771. * @param {Function} iteratee The function invoked per iteration.
  6772. * @returns {Array} Returns the array of results.
  6773. */
  6774. function baseTimes(n, iteratee) {
  6775. var index = -1,
  6776. result = Array(n);
  6777. while (++index < n) {
  6778. result[index] = iteratee(index);
  6779. }
  6780. return result;
  6781. }
  6782. /** `Object#toString` result references. */
  6783. var argsTag$1 = '[object Arguments]';
  6784. /**
  6785. * The base implementation of `_.isArguments`.
  6786. *
  6787. * @private
  6788. * @param {*} value The value to check.
  6789. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  6790. */
  6791. function baseIsArguments(value) {
  6792. return isObjectLike(value) && baseGetTag(value) == argsTag$1;
  6793. }
  6794. /** Used for built-in method references. */
  6795. var objectProto$2 = Object.prototype;
  6796. /** Used to check objects for own properties. */
  6797. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  6798. /** Built-in value references. */
  6799. var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
  6800. /**
  6801. * Checks if `value` is likely an `arguments` object.
  6802. *
  6803. * @static
  6804. * @memberOf _
  6805. * @since 0.1.0
  6806. * @category Lang
  6807. * @param {*} value The value to check.
  6808. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  6809. * else `false`.
  6810. * @example
  6811. *
  6812. * _.isArguments(function() { return arguments; }());
  6813. * // => true
  6814. *
  6815. * _.isArguments([1, 2, 3]);
  6816. * // => false
  6817. */
  6818. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  6819. return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') &&
  6820. !propertyIsEnumerable.call(value, 'callee');
  6821. };
  6822. /**
  6823. * This method returns `false`.
  6824. *
  6825. * @static
  6826. * @memberOf _
  6827. * @since 4.13.0
  6828. * @category Util
  6829. * @returns {boolean} Returns `false`.
  6830. * @example
  6831. *
  6832. * _.times(2, _.stubFalse);
  6833. * // => [false, false]
  6834. */
  6835. function stubFalse() {
  6836. return false;
  6837. }
  6838. /** Detect free variable `exports`. */
  6839. var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
  6840. /** Detect free variable `module`. */
  6841. var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
  6842. /** Detect the popular CommonJS extension `module.exports`. */
  6843. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  6844. /** Built-in value references. */
  6845. var Buffer = moduleExports$1 ? root.Buffer : undefined;
  6846. /* Built-in method references for those with the same name as other `lodash` methods. */
  6847. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  6848. /**
  6849. * Checks if `value` is a buffer.
  6850. *
  6851. * @static
  6852. * @memberOf _
  6853. * @since 4.3.0
  6854. * @category Lang
  6855. * @param {*} value The value to check.
  6856. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  6857. * @example
  6858. *
  6859. * _.isBuffer(new Buffer(2));
  6860. * // => true
  6861. *
  6862. * _.isBuffer(new Uint8Array(2));
  6863. * // => false
  6864. */
  6865. var isBuffer = nativeIsBuffer || stubFalse;
  6866. /** `Object#toString` result references. */
  6867. var argsTag = '[object Arguments]',
  6868. arrayTag = '[object Array]',
  6869. boolTag = '[object Boolean]',
  6870. dateTag = '[object Date]',
  6871. errorTag = '[object Error]',
  6872. funcTag = '[object Function]',
  6873. mapTag = '[object Map]',
  6874. numberTag = '[object Number]',
  6875. objectTag = '[object Object]',
  6876. regexpTag = '[object RegExp]',
  6877. setTag = '[object Set]',
  6878. stringTag = '[object String]',
  6879. weakMapTag = '[object WeakMap]';
  6880. var arrayBufferTag = '[object ArrayBuffer]',
  6881. dataViewTag = '[object DataView]',
  6882. float32Tag = '[object Float32Array]',
  6883. float64Tag = '[object Float64Array]',
  6884. int8Tag = '[object Int8Array]',
  6885. int16Tag = '[object Int16Array]',
  6886. int32Tag = '[object Int32Array]',
  6887. uint8Tag = '[object Uint8Array]',
  6888. uint8ClampedTag = '[object Uint8ClampedArray]',
  6889. uint16Tag = '[object Uint16Array]',
  6890. uint32Tag = '[object Uint32Array]';
  6891. /** Used to identify `toStringTag` values of typed arrays. */
  6892. var typedArrayTags = {};
  6893. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  6894. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  6895. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  6896. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  6897. typedArrayTags[uint32Tag] = true;
  6898. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  6899. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  6900. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  6901. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  6902. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  6903. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  6904. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  6905. typedArrayTags[weakMapTag] = false;
  6906. /**
  6907. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  6908. *
  6909. * @private
  6910. * @param {*} value The value to check.
  6911. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  6912. */
  6913. function baseIsTypedArray(value) {
  6914. return isObjectLike(value) &&
  6915. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  6916. }
  6917. /**
  6918. * The base implementation of `_.unary` without support for storing metadata.
  6919. *
  6920. * @private
  6921. * @param {Function} func The function to cap arguments for.
  6922. * @returns {Function} Returns the new capped function.
  6923. */
  6924. function baseUnary(func) {
  6925. return function(value) {
  6926. return func(value);
  6927. };
  6928. }
  6929. /** Detect free variable `exports`. */
  6930. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  6931. /** Detect free variable `module`. */
  6932. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  6933. /** Detect the popular CommonJS extension `module.exports`. */
  6934. var moduleExports = freeModule && freeModule.exports === freeExports;
  6935. /** Detect free variable `process` from Node.js. */
  6936. var freeProcess = moduleExports && freeGlobal.process;
  6937. /** Used to access faster Node.js helpers. */
  6938. var nodeUtil = (function() {
  6939. try {
  6940. // Use `util.types` for Node.js 10+.
  6941. var types = freeModule && freeModule.require && freeModule.require('util').types;
  6942. if (types) {
  6943. return types;
  6944. }
  6945. // Legacy `process.binding('util')` for Node.js < 10.
  6946. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  6947. } catch (e) {}
  6948. }());
  6949. /* Node.js helper references. */
  6950. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  6951. /**
  6952. * Checks if `value` is classified as a typed array.
  6953. *
  6954. * @static
  6955. * @memberOf _
  6956. * @since 3.0.0
  6957. * @category Lang
  6958. * @param {*} value The value to check.
  6959. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  6960. * @example
  6961. *
  6962. * _.isTypedArray(new Uint8Array);
  6963. * // => true
  6964. *
  6965. * _.isTypedArray([]);
  6966. * // => false
  6967. */
  6968. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  6969. /** Used for built-in method references. */
  6970. var objectProto$1 = Object.prototype;
  6971. /** Used to check objects for own properties. */
  6972. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  6973. /**
  6974. * Creates an array of the enumerable property names of the array-like `value`.
  6975. *
  6976. * @private
  6977. * @param {*} value The value to query.
  6978. * @param {boolean} inherited Specify returning inherited property names.
  6979. * @returns {Array} Returns the array of property names.
  6980. */
  6981. function arrayLikeKeys(value, inherited) {
  6982. var isArr = isArray(value),
  6983. isArg = !isArr && isArguments(value),
  6984. isBuff = !isArr && !isArg && isBuffer(value),
  6985. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  6986. skipIndexes = isArr || isArg || isBuff || isType,
  6987. result = skipIndexes ? baseTimes(value.length, String) : [],
  6988. length = result.length;
  6989. for (var key in value) {
  6990. if ((inherited || hasOwnProperty$1.call(value, key)) &&
  6991. !(skipIndexes && (
  6992. // Safari 9 has enumerable `arguments.length` in strict mode.
  6993. key == 'length' ||
  6994. // Node.js 0.10 has enumerable non-index properties on buffers.
  6995. (isBuff && (key == 'offset' || key == 'parent')) ||
  6996. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  6997. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  6998. // Skip index properties.
  6999. isIndex(key, length)
  7000. ))) {
  7001. result.push(key);
  7002. }
  7003. }
  7004. return result;
  7005. }
  7006. /**
  7007. * This function is like
  7008. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7009. * except that it includes inherited enumerable properties.
  7010. *
  7011. * @private
  7012. * @param {Object} object The object to query.
  7013. * @returns {Array} Returns the array of property names.
  7014. */
  7015. function nativeKeysIn(object) {
  7016. var result = [];
  7017. if (object != null) {
  7018. for (var key in Object(object)) {
  7019. result.push(key);
  7020. }
  7021. }
  7022. return result;
  7023. }
  7024. /** Used for built-in method references. */
  7025. var objectProto = Object.prototype;
  7026. /** Used to check objects for own properties. */
  7027. var hasOwnProperty = objectProto.hasOwnProperty;
  7028. /**
  7029. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  7030. *
  7031. * @private
  7032. * @param {Object} object The object to query.
  7033. * @returns {Array} Returns the array of property names.
  7034. */
  7035. function baseKeysIn(object) {
  7036. if (!isObject(object)) {
  7037. return nativeKeysIn(object);
  7038. }
  7039. var isProto = isPrototype(object),
  7040. result = [];
  7041. for (var key in object) {
  7042. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  7043. result.push(key);
  7044. }
  7045. }
  7046. return result;
  7047. }
  7048. /**
  7049. * Creates an array of the own and inherited enumerable property names of `object`.
  7050. *
  7051. * **Note:** Non-object values are coerced to objects.
  7052. *
  7053. * @static
  7054. * @memberOf _
  7055. * @since 3.0.0
  7056. * @category Object
  7057. * @param {Object} object The object to query.
  7058. * @returns {Array} Returns the array of property names.
  7059. * @example
  7060. *
  7061. * function Foo() {
  7062. * this.a = 1;
  7063. * this.b = 2;
  7064. * }
  7065. *
  7066. * Foo.prototype.c = 3;
  7067. *
  7068. * _.keysIn(new Foo);
  7069. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  7070. */
  7071. function keysIn(object) {
  7072. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  7073. }
  7074. /**
  7075. * Converts `value` to a string. An empty string is returned for `null`
  7076. * and `undefined` values. The sign of `-0` is preserved.
  7077. *
  7078. * @static
  7079. * @memberOf _
  7080. * @since 4.0.0
  7081. * @category Lang
  7082. * @param {*} value The value to convert.
  7083. * @returns {string} Returns the converted string.
  7084. * @example
  7085. *
  7086. * _.toString(null);
  7087. * // => ''
  7088. *
  7089. * _.toString(-0);
  7090. * // => '-0'
  7091. *
  7092. * _.toString([1, 2, 3]);
  7093. * // => '1,2,3'
  7094. */
  7095. function toString(value) {
  7096. return value == null ? '' : baseToString(value);
  7097. }
  7098. /**
  7099. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  7100. *
  7101. * @private
  7102. * @param {boolean} [fromRight] Specify iterating from right to left.
  7103. * @returns {Function} Returns the new base function.
  7104. */
  7105. function createBaseFor(fromRight) {
  7106. return function(object, iteratee, keysFunc) {
  7107. var index = -1,
  7108. iterable = Object(object),
  7109. props = keysFunc(object),
  7110. length = props.length;
  7111. while (length--) {
  7112. var key = props[fromRight ? length : ++index];
  7113. if (iteratee(iterable[key], key, iterable) === false) {
  7114. break;
  7115. }
  7116. }
  7117. return object;
  7118. };
  7119. }
  7120. /**
  7121. * The base implementation of `baseForOwn` which iterates over `object`
  7122. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  7123. * Iteratee functions may exit iteration early by explicitly returning `false`.
  7124. *
  7125. * @private
  7126. * @param {Object} object The object to iterate over.
  7127. * @param {Function} iteratee The function invoked per iteration.
  7128. * @param {Function} keysFunc The function to get the keys of `object`.
  7129. * @returns {Object} Returns `object`.
  7130. */
  7131. var baseFor = createBaseFor();
  7132. /**
  7133. * Gets the timestamp of the number of milliseconds that have elapsed since
  7134. * the Unix epoch (1 January 1970 00:00:00 UTC).
  7135. *
  7136. * @static
  7137. * @memberOf _
  7138. * @since 2.4.0
  7139. * @category Date
  7140. * @returns {number} Returns the timestamp.
  7141. * @example
  7142. *
  7143. * _.defer(function(stamp) {
  7144. * console.log(_.now() - stamp);
  7145. * }, _.now());
  7146. * // => Logs the number of milliseconds it took for the deferred invocation.
  7147. */
  7148. var now = function() {
  7149. return root.Date.now();
  7150. };
  7151. /** Error message constants. */
  7152. var FUNC_ERROR_TEXT$1 = 'Expected a function';
  7153. /* Built-in method references for those with the same name as other `lodash` methods. */
  7154. var nativeMax = Math.max,
  7155. nativeMin = Math.min;
  7156. /**
  7157. * Creates a debounced function that delays invoking `func` until after `wait`
  7158. * milliseconds have elapsed since the last time the debounced function was
  7159. * invoked. The debounced function comes with a `cancel` method to cancel
  7160. * delayed `func` invocations and a `flush` method to immediately invoke them.
  7161. * Provide `options` to indicate whether `func` should be invoked on the
  7162. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  7163. * with the last arguments provided to the debounced function. Subsequent
  7164. * calls to the debounced function return the result of the last `func`
  7165. * invocation.
  7166. *
  7167. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  7168. * invoked on the trailing edge of the timeout only if the debounced function
  7169. * is invoked more than once during the `wait` timeout.
  7170. *
  7171. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  7172. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  7173. *
  7174. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  7175. * for details over the differences between `_.debounce` and `_.throttle`.
  7176. *
  7177. * @static
  7178. * @memberOf _
  7179. * @since 0.1.0
  7180. * @category Function
  7181. * @param {Function} func The function to debounce.
  7182. * @param {number} [wait=0] The number of milliseconds to delay.
  7183. * @param {Object} [options={}] The options object.
  7184. * @param {boolean} [options.leading=false]
  7185. * Specify invoking on the leading edge of the timeout.
  7186. * @param {number} [options.maxWait]
  7187. * The maximum time `func` is allowed to be delayed before it's invoked.
  7188. * @param {boolean} [options.trailing=true]
  7189. * Specify invoking on the trailing edge of the timeout.
  7190. * @returns {Function} Returns the new debounced function.
  7191. * @example
  7192. *
  7193. * // Avoid costly calculations while the window size is in flux.
  7194. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  7195. *
  7196. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  7197. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  7198. * 'leading': true,
  7199. * 'trailing': false
  7200. * }));
  7201. *
  7202. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  7203. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  7204. * var source = new EventSource('/stream');
  7205. * jQuery(source).on('message', debounced);
  7206. *
  7207. * // Cancel the trailing debounced invocation.
  7208. * jQuery(window).on('popstate', debounced.cancel);
  7209. */
  7210. function debounce$1(func, wait, options) {
  7211. var lastArgs,
  7212. lastThis,
  7213. maxWait,
  7214. result,
  7215. timerId,
  7216. lastCallTime,
  7217. lastInvokeTime = 0,
  7218. leading = false,
  7219. maxing = false,
  7220. trailing = true;
  7221. if (typeof func != 'function') {
  7222. throw new TypeError(FUNC_ERROR_TEXT$1);
  7223. }
  7224. wait = toNumber(wait) || 0;
  7225. if (isObject(options)) {
  7226. leading = !!options.leading;
  7227. maxing = 'maxWait' in options;
  7228. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  7229. trailing = 'trailing' in options ? !!options.trailing : trailing;
  7230. }
  7231. function invokeFunc(time) {
  7232. var args = lastArgs,
  7233. thisArg = lastThis;
  7234. lastArgs = lastThis = undefined;
  7235. lastInvokeTime = time;
  7236. result = func.apply(thisArg, args);
  7237. return result;
  7238. }
  7239. function leadingEdge(time) {
  7240. // Reset any `maxWait` timer.
  7241. lastInvokeTime = time;
  7242. // Start the timer for the trailing edge.
  7243. timerId = setTimeout(timerExpired, wait);
  7244. // Invoke the leading edge.
  7245. return leading ? invokeFunc(time) : result;
  7246. }
  7247. function remainingWait(time) {
  7248. var timeSinceLastCall = time - lastCallTime,
  7249. timeSinceLastInvoke = time - lastInvokeTime,
  7250. timeWaiting = wait - timeSinceLastCall;
  7251. return maxing
  7252. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  7253. : timeWaiting;
  7254. }
  7255. function shouldInvoke(time) {
  7256. var timeSinceLastCall = time - lastCallTime,
  7257. timeSinceLastInvoke = time - lastInvokeTime;
  7258. // Either this is the first call, activity has stopped and we're at the
  7259. // trailing edge, the system time has gone backwards and we're treating
  7260. // it as the trailing edge, or we've hit the `maxWait` limit.
  7261. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  7262. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  7263. }
  7264. function timerExpired() {
  7265. var time = now();
  7266. if (shouldInvoke(time)) {
  7267. return trailingEdge(time);
  7268. }
  7269. // Restart the timer.
  7270. timerId = setTimeout(timerExpired, remainingWait(time));
  7271. }
  7272. function trailingEdge(time) {
  7273. timerId = undefined;
  7274. // Only invoke if we have `lastArgs` which means `func` has been
  7275. // debounced at least once.
  7276. if (trailing && lastArgs) {
  7277. return invokeFunc(time);
  7278. }
  7279. lastArgs = lastThis = undefined;
  7280. return result;
  7281. }
  7282. function cancel() {
  7283. if (timerId !== undefined) {
  7284. clearTimeout(timerId);
  7285. }
  7286. lastInvokeTime = 0;
  7287. lastArgs = lastCallTime = lastThis = timerId = undefined;
  7288. }
  7289. function flush() {
  7290. return timerId === undefined ? result : trailingEdge(now());
  7291. }
  7292. function debounced() {
  7293. var time = now(),
  7294. isInvoking = shouldInvoke(time);
  7295. lastArgs = arguments;
  7296. lastThis = this;
  7297. lastCallTime = time;
  7298. if (isInvoking) {
  7299. if (timerId === undefined) {
  7300. return leadingEdge(lastCallTime);
  7301. }
  7302. if (maxing) {
  7303. // Handle invocations in a tight loop.
  7304. clearTimeout(timerId);
  7305. timerId = setTimeout(timerExpired, wait);
  7306. return invokeFunc(lastCallTime);
  7307. }
  7308. }
  7309. if (timerId === undefined) {
  7310. timerId = setTimeout(timerExpired, wait);
  7311. }
  7312. return result;
  7313. }
  7314. debounced.cancel = cancel;
  7315. debounced.flush = flush;
  7316. return debounced;
  7317. }
  7318. /**
  7319. * Casts `value` to `identity` if it's not a function.
  7320. *
  7321. * @private
  7322. * @param {*} value The value to inspect.
  7323. * @returns {Function} Returns cast function.
  7324. */
  7325. function castFunction(value) {
  7326. return typeof value == 'function' ? value : identity;
  7327. }
  7328. /**
  7329. * Used to match `RegExp`
  7330. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  7331. */
  7332. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  7333. reHasRegExpChar = RegExp(reRegExpChar.source);
  7334. /**
  7335. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  7336. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  7337. *
  7338. * @static
  7339. * @memberOf _
  7340. * @since 3.0.0
  7341. * @category String
  7342. * @param {string} [string=''] The string to escape.
  7343. * @returns {string} Returns the escaped string.
  7344. * @example
  7345. *
  7346. * _.escapeRegExp('[lodash](https://lodash.com/)');
  7347. * // => '\[lodash\]\(https://lodash\.com/\)'
  7348. */
  7349. function escapeRegExp(string) {
  7350. string = toString(string);
  7351. return (string && reHasRegExpChar.test(string))
  7352. ? string.replace(reRegExpChar, '\\$&')
  7353. : string;
  7354. }
  7355. /**
  7356. * Iterates over own and inherited enumerable string keyed properties of an
  7357. * object and invokes `iteratee` for each property. The iteratee is invoked
  7358. * with three arguments: (value, key, object). Iteratee functions may exit
  7359. * iteration early by explicitly returning `false`.
  7360. *
  7361. * @static
  7362. * @memberOf _
  7363. * @since 0.3.0
  7364. * @category Object
  7365. * @param {Object} object The object to iterate over.
  7366. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7367. * @returns {Object} Returns `object`.
  7368. * @see _.forInRight
  7369. * @example
  7370. *
  7371. * function Foo() {
  7372. * this.a = 1;
  7373. * this.b = 2;
  7374. * }
  7375. *
  7376. * Foo.prototype.c = 3;
  7377. *
  7378. * _.forIn(new Foo, function(value, key) {
  7379. * console.log(key);
  7380. * });
  7381. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  7382. */
  7383. function forIn(object, iteratee) {
  7384. return object == null
  7385. ? object
  7386. : baseFor(object, castFunction(iteratee), keysIn);
  7387. }
  7388. /** Error message constants. */
  7389. var FUNC_ERROR_TEXT = 'Expected a function';
  7390. /**
  7391. * Creates a throttled function that only invokes `func` at most once per
  7392. * every `wait` milliseconds. The throttled function comes with a `cancel`
  7393. * method to cancel delayed `func` invocations and a `flush` method to
  7394. * immediately invoke them. Provide `options` to indicate whether `func`
  7395. * should be invoked on the leading and/or trailing edge of the `wait`
  7396. * timeout. The `func` is invoked with the last arguments provided to the
  7397. * throttled function. Subsequent calls to the throttled function return the
  7398. * result of the last `func` invocation.
  7399. *
  7400. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  7401. * invoked on the trailing edge of the timeout only if the throttled function
  7402. * is invoked more than once during the `wait` timeout.
  7403. *
  7404. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  7405. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  7406. *
  7407. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  7408. * for details over the differences between `_.throttle` and `_.debounce`.
  7409. *
  7410. * @static
  7411. * @memberOf _
  7412. * @since 0.1.0
  7413. * @category Function
  7414. * @param {Function} func The function to throttle.
  7415. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  7416. * @param {Object} [options={}] The options object.
  7417. * @param {boolean} [options.leading=true]
  7418. * Specify invoking on the leading edge of the timeout.
  7419. * @param {boolean} [options.trailing=true]
  7420. * Specify invoking on the trailing edge of the timeout.
  7421. * @returns {Function} Returns the new throttled function.
  7422. * @example
  7423. *
  7424. * // Avoid excessively updating the position while scrolling.
  7425. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  7426. *
  7427. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  7428. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  7429. * jQuery(element).on('click', throttled);
  7430. *
  7431. * // Cancel the trailing throttled invocation.
  7432. * jQuery(window).on('popstate', throttled.cancel);
  7433. */
  7434. function throttle$1(func, wait, options) {
  7435. var leading = true,
  7436. trailing = true;
  7437. if (typeof func != 'function') {
  7438. throw new TypeError(FUNC_ERROR_TEXT);
  7439. }
  7440. if (isObject(options)) {
  7441. leading = 'leading' in options ? !!options.leading : leading;
  7442. trailing = 'trailing' in options ? !!options.trailing : trailing;
  7443. }
  7444. return debounce$1(func, wait, {
  7445. 'leading': leading,
  7446. 'maxWait': wait,
  7447. 'trailing': trailing
  7448. });
  7449. }
  7450. const observed = new Set();
  7451. let mutationObserver;
  7452. const observerOptions = { childList: true };
  7453. /**
  7454. * Helper to set up a conditional slot component on connectedCallback.
  7455. */
  7456. function connectConditionalSlotComponent(component) {
  7457. if (!mutationObserver) {
  7458. mutationObserver = createObserver();
  7459. }
  7460. mutationObserver.observe(component.el, observerOptions);
  7461. }
  7462. /**
  7463. * Helper to tear down a conditional slot component on disconnectedCallback.
  7464. */
  7465. function disconnectConditionalSlotComponent(component) {
  7466. observed.delete(component.el);
  7467. // we explicitly process queued mutations and disconnect and reconnect
  7468. // the observer until MutationObserver gets an `unobserve` method
  7469. // see https://github.com/whatwg/dom/issues/126
  7470. processMutations(mutationObserver.takeRecords());
  7471. mutationObserver.disconnect();
  7472. for (const [element] of observed.entries()) {
  7473. mutationObserver.observe(element, observerOptions);
  7474. }
  7475. }
  7476. function processMutations(mutations) {
  7477. mutations.forEach(({ target }) => {
  7478. forceUpdate$1(target);
  7479. });
  7480. }
  7481. const actionBarCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action-bar:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action-bar{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-bar{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-bar{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-bar{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-bar{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-action-bar-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-action-bar-h *.sc-calcite-action-bar{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-action-bar:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-bar-h{display:none}/*!@:host*/.sc-calcite-action-bar-h{pointer-events:auto;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-item-align:stretch;align-self:stretch;max-width:15vw}/*!@:host([overflow-actions-disabled])*/[overflow-actions-disabled].sc-calcite-action-bar-h{overflow-y:auto}/*!@:host([expanded])*/[expanded].sc-calcite-action-bar-h{max-width:20vw}/*!@::slotted(calcite-action-group)*/.sc-calcite-action-bar-s>calcite-action-group{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}/*!@::slotted(calcite-action-group:last-child)*/.sc-calcite-action-bar-s>calcite-action-group:last-child{border-bottom-width:0px}/*!@.action-group--bottom*/.action-group--bottom.sc-calcite-action-bar{-ms-flex-positive:1;flex-grow:1;-ms-flex-pack:end;justify-content:flex-end;padding-bottom:0px}";
  7482. /**
  7483. * @slot - A slot for adding `calcite-action`s that will appear at the top of the action bar.
  7484. * @slot bottom-actions - A slot for adding `calcite-action`s that will appear at the bottom of the action bar, above the collapse/expand button.
  7485. * @slot expand-tooltip - Used to set the tooltip for the expand toggle.
  7486. */
  7487. class ActionBar {
  7488. constructor(hostRef) {
  7489. registerInstance(this, hostRef);
  7490. this.calciteActionBarToggle = createEvent(this, "calciteActionBarToggle", 7);
  7491. // --------------------------------------------------------------------------
  7492. //
  7493. // Properties
  7494. //
  7495. // --------------------------------------------------------------------------
  7496. /**
  7497. * When set to true, the expand-toggling behavior will be disabled.
  7498. */
  7499. this.expandDisabled = false;
  7500. /**
  7501. * Indicates whether widget is expanded.
  7502. */
  7503. this.expanded = false;
  7504. /**
  7505. * Disables automatically overflowing actions that won't fit into menus.
  7506. */
  7507. this.overflowActionsDisabled = false;
  7508. this.mutationObserver = createObserver();
  7509. this.resizeObserver = createObserver();
  7510. // --------------------------------------------------------------------------
  7511. //
  7512. // Private Methods
  7513. //
  7514. // --------------------------------------------------------------------------
  7515. this.actionMenuOpenChangeHandler = (event) => {
  7516. if (event.detail) {
  7517. const composedPath = event.composedPath();
  7518. Array.from(this.el.querySelectorAll("calcite-action-group")).forEach((group) => {
  7519. if (!composedPath.includes(group)) {
  7520. group.menuOpen = false;
  7521. }
  7522. });
  7523. }
  7524. };
  7525. this.resizeHandlerEntries = (entries) => {
  7526. entries.forEach(this.resizeHandler);
  7527. };
  7528. this.resizeHandler = (entry) => {
  7529. const { height } = entry.contentRect;
  7530. this.resize(height);
  7531. };
  7532. this.resize = debounce$1((height) => {
  7533. var _a;
  7534. const { el, expanded, expandDisabled } = this;
  7535. if (!height) {
  7536. return;
  7537. }
  7538. const actions = queryActions(el);
  7539. const actionCount = expandDisabled ? actions.length : actions.length + 1;
  7540. const actionGroups = Array.from(el.querySelectorAll("calcite-action-group"));
  7541. const groupCount = getSlotted(el, SLOTS$n.bottomActions) || !expandDisabled
  7542. ? actionGroups.length + 1
  7543. : actionGroups.length;
  7544. const overflowCount = getOverflowCount({
  7545. actionCount,
  7546. actionHeight: (_a = actions[0]) === null || _a === void 0 ? void 0 : _a.clientHeight,
  7547. height,
  7548. groupCount
  7549. });
  7550. overflowActions({
  7551. actionGroups,
  7552. expanded,
  7553. overflowCount
  7554. });
  7555. }, overflowActionsDebounceInMs);
  7556. this.conditionallyOverflowActions = () => {
  7557. if (!this.overflowActionsDisabled) {
  7558. this.overflowActions();
  7559. }
  7560. };
  7561. this.toggleExpand = () => {
  7562. this.expanded = !this.expanded;
  7563. this.calciteActionBarToggle.emit();
  7564. };
  7565. this.setExpandToggleRef = (el) => {
  7566. this.expandToggleEl = el;
  7567. };
  7568. }
  7569. expandHandler() {
  7570. this.conditionallyOverflowActions();
  7571. }
  7572. expandedHandler(expanded) {
  7573. toggleChildActionText({ parent: this.el, expanded });
  7574. }
  7575. overflowDisabledHandler(overflowActionsDisabled) {
  7576. overflowActionsDisabled
  7577. ? this.resizeObserver.disconnect()
  7578. : this.resizeObserver.observe(this.el);
  7579. }
  7580. // --------------------------------------------------------------------------
  7581. //
  7582. // Lifecycle
  7583. //
  7584. // --------------------------------------------------------------------------
  7585. componentDidLoad() {
  7586. this.conditionallyOverflowActions();
  7587. }
  7588. connectedCallback() {
  7589. var _a, _b;
  7590. const { el, expanded } = this;
  7591. toggleChildActionText({ parent: el, expanded });
  7592. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(el, { childList: true, subtree: true });
  7593. if (!this.overflowActionsDisabled) {
  7594. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
  7595. }
  7596. this.conditionallyOverflowActions();
  7597. connectConditionalSlotComponent(this);
  7598. }
  7599. disconnectedCallback() {
  7600. var _a, _b;
  7601. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  7602. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
  7603. disconnectConditionalSlotComponent(this);
  7604. }
  7605. // --------------------------------------------------------------------------
  7606. //
  7607. // Methods
  7608. //
  7609. // --------------------------------------------------------------------------
  7610. /**
  7611. * Overflows actions that won't fit into menus.
  7612. * @internal
  7613. */
  7614. async overflowActions() {
  7615. this.resize(this.el.clientHeight);
  7616. }
  7617. /** Sets focus on the component. */
  7618. async setFocus(focusId) {
  7619. if (focusId === "expand-toggle") {
  7620. await focusElement(this.expandToggleEl);
  7621. return;
  7622. }
  7623. this.el.focus();
  7624. }
  7625. // --------------------------------------------------------------------------
  7626. //
  7627. // Render Methods
  7628. //
  7629. // --------------------------------------------------------------------------
  7630. renderBottomActionGroup() {
  7631. const { expanded, expandDisabled, intlExpand, intlCollapse, el, position, toggleExpand, scale } = this;
  7632. const tooltip = getSlotted(el, SLOTS$n.expandTooltip);
  7633. const expandLabel = intlExpand || TEXT$p.expand;
  7634. const collapseLabel = intlCollapse || TEXT$p.collapse;
  7635. const expandToggleNode = !expandDisabled ? (hAsync(ExpandToggle, { el: el, expanded: expanded, intlCollapse: collapseLabel, intlExpand: expandLabel, position: position, ref: this.setExpandToggleRef, scale: scale, toggle: toggleExpand, tooltip: tooltip })) : null;
  7636. return getSlotted(el, SLOTS$n.bottomActions) || expandToggleNode ? (hAsync("calcite-action-group", { class: CSS$N.actionGroupBottom, scale: scale }, hAsync("slot", { name: SLOTS$n.bottomActions }), hAsync("slot", { name: SLOTS$n.expandTooltip }), expandToggleNode)) : null;
  7637. }
  7638. render() {
  7639. return (hAsync(Host, { onCalciteActionMenuOpenChange: this.actionMenuOpenChangeHandler }, hAsync("slot", null), this.renderBottomActionGroup()));
  7640. }
  7641. get el() { return getElement(this); }
  7642. static get watchers() { return {
  7643. "expandDisabled": ["expandHandler"],
  7644. "expanded": ["expandedHandler"],
  7645. "overflowActionsDisabled": ["overflowDisabledHandler"]
  7646. }; }
  7647. static get style() { return actionBarCss; }
  7648. static get cmpMeta() { return {
  7649. "$flags$": 9,
  7650. "$tagName$": "calcite-action-bar",
  7651. "$members$": {
  7652. "expandDisabled": [516, "expand-disabled"],
  7653. "expanded": [1540],
  7654. "intlExpand": [1, "intl-expand"],
  7655. "intlCollapse": [1, "intl-collapse"],
  7656. "overflowActionsDisabled": [4, "overflow-actions-disabled"],
  7657. "position": [513],
  7658. "scale": [513],
  7659. "overflowActions": [64],
  7660. "setFocus": [64]
  7661. },
  7662. "$listeners$": undefined,
  7663. "$lazyBundleId$": "-",
  7664. "$attrsToReflect$": [["expandDisabled", "expand-disabled"], ["expanded", "expanded"], ["position", "position"], ["scale", "scale"]]
  7665. }; }
  7666. }
  7667. const actionGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-action-group-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-action-group-h *.sc-calcite-action-group{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-action-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-group-h{display:none}/*!@:host*/.sc-calcite-action-group-h{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:0px;--calcite-action-group-columns:3}/*!@:host([columns=\"1\"])*/[columns=\"1\"].sc-calcite-action-group-h{--calcite-action-group-columns:1}/*!@:host([columns=\"2\"])*/[columns=\"2\"].sc-calcite-action-group-h{--calcite-action-group-columns:2}/*!@:host([columns=\"3\"])*/[columns=\"3\"].sc-calcite-action-group-h{--calcite-action-group-columns:3}/*!@:host([columns=\"4\"])*/[columns=\"4\"].sc-calcite-action-group-h{--calcite-action-group-columns:4}/*!@:host([columns=\"5\"])*/[columns=\"5\"].sc-calcite-action-group-h{--calcite-action-group-columns:5}/*!@:host([columns=\"6\"])*/[columns=\"6\"].sc-calcite-action-group-h{--calcite-action-group-columns:6}/*!@:host(:first-child)*/.sc-calcite-action-group-h:first-child{padding-top:0px}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-action-group-h{-ms-flex-direction:row;flex-direction:row}/*!@:host([layout=grid])*/[layout=grid].sc-calcite-action-group-h{display:grid;place-content:stretch;gap:1px;background-color:var(--calcite-ui-background);padding:1px;grid-template-columns:repeat(var(--calcite-action-group-columns), auto)}";
  7668. /**
  7669. * @slot - A slot for adding a group of `calcite-action`s.
  7670. * @slot menu-actions - a slot for adding an overflow menu with actions inside a dropdown.
  7671. * @slot menu-tooltip - a slot for adding an tooltip for the menu.
  7672. */
  7673. class ActionGroup {
  7674. constructor(hostRef) {
  7675. registerInstance(this, hostRef);
  7676. // --------------------------------------------------------------------------
  7677. //
  7678. // Properties
  7679. //
  7680. // --------------------------------------------------------------------------
  7681. /**
  7682. * Indicates whether widget is expanded.
  7683. */
  7684. this.expanded = false;
  7685. /**
  7686. * Indicates the horizontal, vertical, or grid layout of the component.
  7687. */
  7688. this.layout = "vertical";
  7689. /**
  7690. * Opens the action menu.
  7691. */
  7692. this.menuOpen = false;
  7693. // --------------------------------------------------------------------------
  7694. //
  7695. // Private Methods
  7696. //
  7697. // --------------------------------------------------------------------------
  7698. this.setMenuOpen = (event) => {
  7699. this.menuOpen = !!event.detail;
  7700. };
  7701. }
  7702. expandedHandler() {
  7703. this.menuOpen = false;
  7704. }
  7705. // --------------------------------------------------------------------------
  7706. //
  7707. // Lifecycle
  7708. //
  7709. // --------------------------------------------------------------------------
  7710. connectedCallback() {
  7711. connectConditionalSlotComponent(this);
  7712. }
  7713. disconnectedCallback() {
  7714. disconnectConditionalSlotComponent(this);
  7715. }
  7716. // --------------------------------------------------------------------------
  7717. //
  7718. // Component Methods
  7719. //
  7720. // --------------------------------------------------------------------------
  7721. renderTooltip() {
  7722. const { el } = this;
  7723. const hasTooltip = getSlotted(el, SLOTS$o.menuTooltip);
  7724. return hasTooltip ? hAsync("slot", { name: SLOTS$o.menuTooltip, slot: SLOTS$p.tooltip }) : null;
  7725. }
  7726. renderMenu() {
  7727. const { el, expanded, intlMore, menuOpen, scale } = this;
  7728. const hasMenuItems = getSlotted(el, SLOTS$o.menuActions);
  7729. return hasMenuItems ? (hAsync("calcite-action-menu", { expanded: expanded, flipPlacements: ["left", "right"], label: intlMore || TEXT$q.more, onCalciteActionMenuOpenChange: this.setMenuOpen, open: menuOpen, placement: "leading-start", scale: scale }, hAsync("calcite-action", { icon: ICONS$e.menu, scale: scale, slot: SLOTS$p.trigger, text: intlMore || TEXT$q.more, textEnabled: expanded }), hAsync("slot", { name: SLOTS$o.menuActions }), this.renderTooltip())) : null;
  7730. }
  7731. render() {
  7732. return (hAsync(Fragment, null, hAsync("slot", null), this.renderMenu()));
  7733. }
  7734. get el() { return getElement(this); }
  7735. static get watchers() { return {
  7736. "expanded": ["expandedHandler"]
  7737. }; }
  7738. static get style() { return actionGroupCss; }
  7739. static get cmpMeta() { return {
  7740. "$flags$": 9,
  7741. "$tagName$": "calcite-action-group",
  7742. "$members$": {
  7743. "expanded": [516],
  7744. "layout": [513],
  7745. "columns": [514],
  7746. "intlMore": [1, "intl-more"],
  7747. "menuOpen": [1540, "menu-open"],
  7748. "scale": [513]
  7749. },
  7750. "$listeners$": undefined,
  7751. "$lazyBundleId$": "-",
  7752. "$attrsToReflect$": [["expanded", "expanded"], ["layout", "layout"], ["columns", "columns"], ["menuOpen", "menu-open"], ["scale", "scale"]]
  7753. }; }
  7754. }
  7755. function getRoundRobinIndex(index, total) {
  7756. return (index + total) % total;
  7757. }
  7758. const actionMenuCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action-menu:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action-menu{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-menu{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-menu{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-menu{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-menu{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-action-menu:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-menu-h{display:none}/*!@:host*/.sc-calcite-action-menu-h{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size-1);color:var(--calcite-ui-text-2)}/*!@.menu ::slotted(calcite-action)*/.menu .sc-calcite-action-menu-s>calcite-action{margin:0.125rem;display:-ms-flexbox;display:flex;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@::slotted(calcite-action[active])*/.sc-calcite-action-menu-s>calcite-action[active]{outline:2px solid var(--calcite-ui-brand);outline-offset:0px}/*!@.default-trigger*/.default-trigger.sc-calcite-action-menu{position:relative;height:100%;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:stretch;align-self:stretch}/*!@slot[name=trigger]::slotted(calcite-action), calcite-action::slotted([slot=trigger])*/slot[name=trigger].sc-calcite-action-menu-s>calcite-action,calcite-action.sc-calcite-action-menu-s>[slot=trigger]{position:relative;height:100%;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:stretch;align-self:stretch}/*!@.menu*/.menu.sc-calcite-action-menu{-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;outline:2px solid transparent;outline-offset:2px}";
  7759. const SUPPORTED_BUTTON_NAV_KEYS = ["ArrowUp", "ArrowDown"];
  7760. const SUPPORTED_MENU_NAV_KEYS = ["ArrowUp", "ArrowDown", "End", "Home"];
  7761. /**
  7762. * @slot - A slot for adding `calcite-action`s.
  7763. * @slot trigger - A slot for adding a `calcite-action` to trigger opening the menu.
  7764. * @slot tooltip - A slot for adding an tooltip for the menu.
  7765. */
  7766. class ActionMenu {
  7767. constructor(hostRef) {
  7768. registerInstance(this, hostRef);
  7769. this.calciteActionMenuOpenChange = createEvent(this, "calciteActionMenuOpenChange", 7);
  7770. // --------------------------------------------------------------------------
  7771. //
  7772. // Properties
  7773. //
  7774. // --------------------------------------------------------------------------
  7775. /**
  7776. * Indicates whether widget is expanded.
  7777. */
  7778. this.expanded = false;
  7779. /**
  7780. * Opens the action menu.
  7781. */
  7782. this.open = false;
  7783. /** Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value. */
  7784. this.overlayPositioning = "absolute";
  7785. /**
  7786. * Determines where the component will be positioned relative to the referenceElement.
  7787. * @see [PopperPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/popper.ts#L25)
  7788. */
  7789. this.placement = "auto";
  7790. this.actionElements = [];
  7791. this.mutationObserver = createObserver();
  7792. this.guid = `calcite-action-menu-${guid()}`;
  7793. this.menuId = `${this.guid}-menu`;
  7794. this.menuButtonId = `${this.guid}-menu-button`;
  7795. this.activeMenuItemIndex = -1;
  7796. // --------------------------------------------------------------------------
  7797. //
  7798. // Component Methods
  7799. //
  7800. // --------------------------------------------------------------------------
  7801. this.connectMenuButtonEl = () => {
  7802. const { el, menuButtonId, menuId, open, label } = this;
  7803. const menuButtonEl = getSlotted(el, SLOTS$p.trigger) || this.defaultMenuButtonEl;
  7804. if (this.menuButtonEl === menuButtonEl) {
  7805. return;
  7806. }
  7807. this.disconnectMenuButtonEl();
  7808. this.menuButtonEl = menuButtonEl;
  7809. this.setTooltipReferenceElement();
  7810. if (!menuButtonEl) {
  7811. return;
  7812. }
  7813. menuButtonEl.active = open;
  7814. menuButtonEl.setAttribute("aria-controls", menuId);
  7815. menuButtonEl.setAttribute("aria-expanded", toAriaBoolean(open));
  7816. menuButtonEl.setAttribute("aria-haspopup", "true");
  7817. if (!menuButtonEl.id) {
  7818. menuButtonEl.id = menuButtonId;
  7819. }
  7820. if (!menuButtonEl.label) {
  7821. menuButtonEl.label = label;
  7822. }
  7823. if (!menuButtonEl.text) {
  7824. menuButtonEl.text = label;
  7825. }
  7826. menuButtonEl.addEventListener("click", this.menuButtonClick);
  7827. menuButtonEl.addEventListener("keydown", this.menuButtonKeyDown);
  7828. menuButtonEl.addEventListener("keyup", this.menuButtonKeyUp);
  7829. };
  7830. this.disconnectMenuButtonEl = () => {
  7831. const { menuButtonEl } = this;
  7832. if (!menuButtonEl) {
  7833. return;
  7834. }
  7835. menuButtonEl.removeEventListener("click", this.menuButtonClick);
  7836. menuButtonEl.removeEventListener("keydown", this.menuButtonKeyDown);
  7837. menuButtonEl.removeEventListener("keyup", this.menuButtonKeyUp);
  7838. };
  7839. this.setDefaultMenuButtonEl = (el) => {
  7840. this.defaultMenuButtonEl = el;
  7841. this.connectMenuButtonEl();
  7842. };
  7843. // --------------------------------------------------------------------------
  7844. //
  7845. // Private Methods
  7846. //
  7847. // --------------------------------------------------------------------------
  7848. this.handleCalciteActionClick = () => {
  7849. this.open = false;
  7850. this.setFocus();
  7851. };
  7852. this.menuButtonClick = () => {
  7853. this.toggleOpen();
  7854. };
  7855. this.updateTooltip = (event) => {
  7856. const tooltips = event.target
  7857. .assignedElements({
  7858. flatten: true
  7859. })
  7860. .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-tooltip"));
  7861. this.tooltipEl = tooltips[0];
  7862. this.setTooltipReferenceElement();
  7863. };
  7864. this.setTooltipReferenceElement = () => {
  7865. const { tooltipEl, expanded, menuButtonEl } = this;
  7866. if (tooltipEl) {
  7867. tooltipEl.referenceElement = !expanded ? menuButtonEl : null;
  7868. }
  7869. };
  7870. this.updateAction = (action, index) => {
  7871. const { guid, activeMenuItemIndex } = this;
  7872. const id = `${guid}-action-${index}`;
  7873. action.tabIndex = -1;
  7874. action.setAttribute("role", "menuitem");
  7875. if (!action.id) {
  7876. action.id = id;
  7877. }
  7878. action.active = index === activeMenuItemIndex;
  7879. };
  7880. this.updateActions = (actions) => {
  7881. actions === null || actions === void 0 ? void 0 : actions.forEach(this.updateAction);
  7882. };
  7883. this.getActions = () => {
  7884. const { el } = this;
  7885. const actionElements = getSlotted(el, { all: true, matches: "calcite-action" });
  7886. this.updateActions(actionElements);
  7887. this.actionElements = actionElements;
  7888. this.connectMenuButtonEl();
  7889. };
  7890. this.menuButtonKeyUp = (event) => {
  7891. const { key } = event;
  7892. const { actionElements } = this;
  7893. if (!this.isValidKey(key, SUPPORTED_BUTTON_NAV_KEYS)) {
  7894. return;
  7895. }
  7896. event.preventDefault();
  7897. if (!actionElements.length) {
  7898. return;
  7899. }
  7900. this.toggleOpen(true);
  7901. this.handleActionNavigation(key, actionElements);
  7902. };
  7903. this.menuButtonKeyDown = (event) => {
  7904. const { key } = event;
  7905. if (!this.isValidKey(key, SUPPORTED_BUTTON_NAV_KEYS)) {
  7906. return;
  7907. }
  7908. event.preventDefault();
  7909. };
  7910. this.menuActionsContainerKeyDown = (event) => {
  7911. const { key } = event;
  7912. const { actionElements, activeMenuItemIndex } = this;
  7913. if (key === "Tab") {
  7914. this.open = false;
  7915. return;
  7916. }
  7917. if (key === " " || key === "Enter") {
  7918. event.preventDefault();
  7919. const action = actionElements[activeMenuItemIndex];
  7920. action ? action.click() : this.toggleOpen(false);
  7921. return;
  7922. }
  7923. if (this.isValidKey(key, SUPPORTED_MENU_NAV_KEYS)) {
  7924. event.preventDefault();
  7925. }
  7926. };
  7927. this.menuActionsContainerKeyUp = (event) => {
  7928. const { key } = event;
  7929. const { actionElements } = this;
  7930. if (key === "Escape") {
  7931. this.toggleOpen(false);
  7932. return;
  7933. }
  7934. if (!this.isValidKey(key, SUPPORTED_MENU_NAV_KEYS)) {
  7935. return;
  7936. }
  7937. event.preventDefault();
  7938. if (!actionElements.length) {
  7939. return;
  7940. }
  7941. this.handleActionNavigation(key, actionElements);
  7942. };
  7943. this.handleActionNavigation = (key, actions) => {
  7944. const currentIndex = this.activeMenuItemIndex;
  7945. if (key === "Home") {
  7946. this.activeMenuItemIndex = 0;
  7947. }
  7948. if (key === "End") {
  7949. this.activeMenuItemIndex = actions.length - 1;
  7950. }
  7951. if (key === "ArrowUp") {
  7952. this.activeMenuItemIndex = getRoundRobinIndex(Math.max(currentIndex - 1, -1), actions.length);
  7953. }
  7954. if (key === "ArrowDown") {
  7955. this.activeMenuItemIndex = getRoundRobinIndex(currentIndex + 1, actions.length);
  7956. }
  7957. };
  7958. this.toggleOpenEnd = () => {
  7959. this.setFocus();
  7960. this.el.removeEventListener("calcitePopoverOpen", this.toggleOpenEnd);
  7961. };
  7962. this.toggleOpen = (value = !this.open) => {
  7963. this.el.addEventListener("calcitePopoverOpen", this.toggleOpenEnd);
  7964. this.open = value;
  7965. };
  7966. }
  7967. // --------------------------------------------------------------------------
  7968. //
  7969. // Lifecycle
  7970. //
  7971. // --------------------------------------------------------------------------
  7972. connectedCallback() {
  7973. var _a;
  7974. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  7975. this.getActions();
  7976. connectConditionalSlotComponent(this);
  7977. }
  7978. disconnectedCallback() {
  7979. var _a;
  7980. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  7981. this.disconnectMenuButtonEl();
  7982. disconnectConditionalSlotComponent(this);
  7983. }
  7984. expandedHandler() {
  7985. this.open = false;
  7986. this.setTooltipReferenceElement();
  7987. }
  7988. openHandler(open) {
  7989. this.activeMenuItemIndex = this.open ? 0 : -1;
  7990. if (this.menuButtonEl) {
  7991. this.menuButtonEl.active = open;
  7992. }
  7993. this.calciteActionMenuOpenChange.emit(open);
  7994. }
  7995. closeCalciteActionMenuOnClick(event) {
  7996. const composedPath = event.composedPath();
  7997. if (composedPath.includes(this.el)) {
  7998. return;
  7999. }
  8000. this.open = false;
  8001. }
  8002. activeMenuItemIndexHandler() {
  8003. this.updateActions(this.actionElements);
  8004. }
  8005. // --------------------------------------------------------------------------
  8006. //
  8007. // Methods
  8008. //
  8009. // --------------------------------------------------------------------------
  8010. /** Sets focus on the component. */
  8011. async setFocus() {
  8012. focusElement(this.open ? this.menuEl : this.menuButtonEl);
  8013. }
  8014. renderMenuButton() {
  8015. const { label, scale } = this;
  8016. const menuButtonSlot = (hAsync("slot", { name: SLOTS$p.trigger }, hAsync("calcite-action", { class: CSS$O.defaultTrigger, icon: ICONS$f.menu, ref: this.setDefaultMenuButtonEl, scale: scale, text: label })));
  8017. return menuButtonSlot;
  8018. }
  8019. renderMenuItems() {
  8020. const { actionElements, activeMenuItemIndex, open, menuId, menuButtonEl, label, placement, overlayPositioning, flipPlacements } = this;
  8021. const activeAction = actionElements[activeMenuItemIndex];
  8022. const activeDescendantId = (activeAction === null || activeAction === void 0 ? void 0 : activeAction.id) || null;
  8023. return (hAsync("calcite-popover", { disablePointer: true, flipPlacements: flipPlacements, label: label, offsetDistance: 0, open: open, overlayPositioning: overlayPositioning, placement: placement, referenceElement: menuButtonEl }, hAsync("div", { "aria-activedescendant": activeDescendantId, "aria-labelledby": menuButtonEl === null || menuButtonEl === void 0 ? void 0 : menuButtonEl.id, class: CSS$O.menu, id: menuId, onClick: this.handleCalciteActionClick, onKeyDown: this.menuActionsContainerKeyDown, onKeyUp: this.menuActionsContainerKeyUp, ref: (el) => (this.menuEl = el), role: "menu", tabIndex: -1 }, hAsync("slot", null))));
  8024. }
  8025. render() {
  8026. return (hAsync(Fragment, null, this.renderMenuButton(), this.renderMenuItems(), hAsync("slot", { name: SLOTS$p.tooltip, onSlotchange: this.updateTooltip })));
  8027. }
  8028. isValidKey(key, supportedKeys) {
  8029. return !!supportedKeys.find((k) => k === key);
  8030. }
  8031. get el() { return getElement(this); }
  8032. static get watchers() { return {
  8033. "expanded": ["expandedHandler"],
  8034. "open": ["openHandler"],
  8035. "activeMenuItemIndex": ["activeMenuItemIndexHandler"]
  8036. }; }
  8037. static get style() { return actionMenuCss; }
  8038. static get cmpMeta() { return {
  8039. "$flags$": 9,
  8040. "$tagName$": "calcite-action-menu",
  8041. "$members$": {
  8042. "expanded": [516],
  8043. "flipPlacements": [16],
  8044. "label": [1],
  8045. "open": [1540],
  8046. "overlayPositioning": [1, "overlay-positioning"],
  8047. "placement": [513],
  8048. "scale": [513],
  8049. "activeMenuItemIndex": [32],
  8050. "setFocus": [64]
  8051. },
  8052. "$listeners$": [[8, "click", "closeCalciteActionMenuOnClick"]],
  8053. "$lazyBundleId$": "-",
  8054. "$attrsToReflect$": [["expanded", "expanded"], ["open", "open"], ["placement", "placement"], ["scale", "scale"]]
  8055. }; }
  8056. }
  8057. const CSS$M = {
  8058. actionGroupBottom: "action-group--bottom",
  8059. container: "container"
  8060. };
  8061. const TEXT$o = {
  8062. expand: "Expand",
  8063. collapse: "Collapse"
  8064. };
  8065. const SLOTS$m = {
  8066. expandTooltip: "expand-tooltip"
  8067. };
  8068. const actionPadCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action-pad:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action-pad{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-pad{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-pad{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-pad{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-pad{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-action-pad-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-action-pad-h *.sc-calcite-action-pad{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-action-pad:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-pad-h{display:none}/*!@:host*/.sc-calcite-action-pad-h{display:block}@keyframes in{0%{opacity:0}100%{opacity:1}}/*!@:host*/.sc-calcite-action-pad-h{-webkit-animation:in var(--calcite-internal-animation-timing-slow) ease-in-out;animation:in var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.125rem}/*!@:host([expanded])*/[expanded].sc-calcite-action-pad-h{max-width:20vw}/*!@::slotted(calcite-action-group)*/.sc-calcite-action-pad-s>calcite-action-group{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-bottom:0px;padding-top:0px}/*!@.container*/.container.sc-calcite-action-pad{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;overflow-y:auto;border-radius:0.25rem;background-color:var(--calcite-ui-background);--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);max-width:15vw}/*!@.action-group--bottom*/.action-group--bottom.sc-calcite-action-pad{-ms-flex-positive:1;flex-grow:1;-ms-flex-pack:end;justify-content:flex-end;padding-bottom:0px}/*!@:host([layout=horizontal]) .container*/[layout=horizontal].sc-calcite-action-pad-h .container.sc-calcite-action-pad{-ms-flex-direction:row;flex-direction:row;max-width:unset}/*!@:host([layout=horizontal]) .container .action-group--bottom*/[layout=horizontal].sc-calcite-action-pad-h .container.sc-calcite-action-pad .action-group--bottom.sc-calcite-action-pad{padding:0px}/*!@:host([layout=horizontal]) .container ::slotted(calcite-action-group)*/.sc-calcite-action-pad-h[layout=horizontal] .container .sc-calcite-action-pad-s>calcite-action-group{border-width:0px;padding:0px;border-inline-end-width:1px}/*!@::slotted(calcite-action-group:last-child)*/.sc-calcite-action-pad-s>calcite-action-group:last-child{border-bottom-width:0px}";
  8069. /**
  8070. * @slot - A slot for adding `calcite-action`s to the action pad.
  8071. * @slot expand-tooltip - Used to set the tooltip for the expand toggle.
  8072. */
  8073. class ActionPad {
  8074. constructor(hostRef) {
  8075. registerInstance(this, hostRef);
  8076. this.calciteActionPadToggle = createEvent(this, "calciteActionPadToggle", 7);
  8077. // --------------------------------------------------------------------------
  8078. //
  8079. // Properties
  8080. //
  8081. // --------------------------------------------------------------------------
  8082. /**
  8083. * When set to true, the expand-toggling behavior will be disabled.
  8084. */
  8085. this.expandDisabled = false;
  8086. /**
  8087. * Indicates whether widget is expanded.
  8088. */
  8089. this.expanded = false;
  8090. /**
  8091. * Indicates the horizontal or vertical layout of the component.
  8092. */
  8093. this.layout = "vertical";
  8094. // --------------------------------------------------------------------------
  8095. //
  8096. // Private Methods
  8097. //
  8098. // --------------------------------------------------------------------------
  8099. this.actionMenuOpenChangeHandler = (event) => {
  8100. if (event.detail) {
  8101. const composedPath = event.composedPath();
  8102. Array.from(this.el.querySelectorAll("calcite-action-group")).forEach((group) => {
  8103. if (!composedPath.includes(group)) {
  8104. group.menuOpen = false;
  8105. }
  8106. });
  8107. }
  8108. };
  8109. this.toggleExpand = () => {
  8110. this.expanded = !this.expanded;
  8111. this.calciteActionPadToggle.emit();
  8112. };
  8113. this.setExpandToggleRef = (el) => {
  8114. this.expandToggleEl = el;
  8115. };
  8116. }
  8117. expandedHandler(expanded) {
  8118. toggleChildActionText({ parent: this.el, expanded });
  8119. }
  8120. // --------------------------------------------------------------------------
  8121. //
  8122. // Lifecycle
  8123. //
  8124. // --------------------------------------------------------------------------
  8125. connectedCallback() {
  8126. connectConditionalSlotComponent(this);
  8127. }
  8128. disconnectedCallback() {
  8129. disconnectConditionalSlotComponent(this);
  8130. }
  8131. componentWillLoad() {
  8132. const { el, expanded } = this;
  8133. toggleChildActionText({ parent: el, expanded });
  8134. }
  8135. // --------------------------------------------------------------------------
  8136. //
  8137. // Methods
  8138. //
  8139. // --------------------------------------------------------------------------
  8140. /** Sets focus on the component. */
  8141. async setFocus(focusId) {
  8142. if (focusId === "expand-toggle") {
  8143. await focusElement(this.expandToggleEl);
  8144. return;
  8145. }
  8146. this.el.focus();
  8147. }
  8148. // --------------------------------------------------------------------------
  8149. //
  8150. // Component Methods
  8151. //
  8152. // --------------------------------------------------------------------------
  8153. renderBottomActionGroup() {
  8154. const { expanded, expandDisabled, intlExpand, intlCollapse, el, position, toggleExpand, scale } = this;
  8155. const tooltip = getSlotted(el, SLOTS$m.expandTooltip);
  8156. const expandLabel = intlExpand || TEXT$o.expand;
  8157. const collapseLabel = intlCollapse || TEXT$o.collapse;
  8158. const expandToggleNode = !expandDisabled ? (hAsync(ExpandToggle, { el: el, expanded: expanded, intlCollapse: collapseLabel, intlExpand: expandLabel, position: position, ref: this.setExpandToggleRef, scale: scale, toggle: toggleExpand, tooltip: tooltip })) : null;
  8159. return expandToggleNode ? (hAsync("calcite-action-group", { class: CSS$M.actionGroupBottom, scale: scale }, hAsync("slot", { name: SLOTS$m.expandTooltip }), expandToggleNode)) : null;
  8160. }
  8161. render() {
  8162. return (hAsync(Host, { onCalciteActionMenuOpenChange: this.actionMenuOpenChangeHandler }, hAsync("div", { class: CSS$M.container }, hAsync("slot", null), this.renderBottomActionGroup())));
  8163. }
  8164. get el() { return getElement(this); }
  8165. static get watchers() { return {
  8166. "expanded": ["expandedHandler"]
  8167. }; }
  8168. static get style() { return actionPadCss; }
  8169. static get cmpMeta() { return {
  8170. "$flags$": 9,
  8171. "$tagName$": "calcite-action-pad",
  8172. "$members$": {
  8173. "expandDisabled": [516, "expand-disabled"],
  8174. "expanded": [1540],
  8175. "layout": [513],
  8176. "intlExpand": [1, "intl-expand"],
  8177. "intlCollapse": [1, "intl-collapse"],
  8178. "position": [513],
  8179. "scale": [513],
  8180. "setFocus": [64]
  8181. },
  8182. "$listeners$": undefined,
  8183. "$lazyBundleId$": "-",
  8184. "$attrsToReflect$": [["expandDisabled", "expand-disabled"], ["expanded", "expanded"], ["layout", "layout"], ["position", "position"], ["scale", "scale"]]
  8185. }; }
  8186. }
  8187. const TEXT$n = {
  8188. intlClose: "Close"
  8189. };
  8190. const DURATIONS = {
  8191. slow: 14000,
  8192. medium: 10000,
  8193. fast: 6000
  8194. };
  8195. const SLOTS$l = {
  8196. title: "title",
  8197. message: "message",
  8198. link: "link"
  8199. };
  8200. var StatusIcons;
  8201. (function (StatusIcons) {
  8202. StatusIcons["green"] = "checkCircle";
  8203. StatusIcons["yellow"] = "exclamationMarkTriangle";
  8204. StatusIcons["red"] = "exclamationMarkTriangle";
  8205. StatusIcons["blue"] = "lightbulb";
  8206. })(StatusIcons || (StatusIcons = {}));
  8207. const alertCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-alert:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-alert{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-alert{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-alert{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-alert{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-alert{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-alert:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-alert-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-alert-h{--calcite-alert-width:40em;--calcite-alert-spacing-token-small:0.5rem;--calcite-alert-spacing-token-large:0.75rem}/*!@:host([scale=s]) slot[name=title]::slotted(*), :host([scale=s]) *::slotted([slot=title])*/.sc-calcite-alert-h[scale=s] slot[name=title].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=s] *.sc-calcite-alert-s>[slot=title]{font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=s]) slot[name=message]::slotted(*), :host([scale=s]) *::slotted([slot=message])*/.sc-calcite-alert-h[scale=s] slot[name=message].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=s] *.sc-calcite-alert-s>[slot=message]{font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host([scale=s]) slot[name=link]::slotted(*), :host([scale=s]) *::slotted([slot=link])*/.sc-calcite-alert-h[scale=s] slot[name=link].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=s] *.sc-calcite-alert-s>[slot=link]{font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host([scale=s]) .alert-queue-count*/[scale=s].sc-calcite-alert-h .alert-queue-count.sc-calcite-alert{margin-left:0.5rem;margin-right:0.5rem}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-alert-h .container.sc-calcite-alert{--calcite-alert-min-height:3.5rem}/*!@:host([scale=s]) .alert-close*/[scale=s].sc-calcite-alert-h .alert-close.sc-calcite-alert{padding:0.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-alert-h{--calcite-alert-width:50em;--calcite-alert-spacing-token-small:0.75rem;--calcite-alert-spacing-token-large:1rem}/*!@:host([scale=m]) slot[name=title]::slotted(*), :host([scale=m]) *::slotted([slot=title])*/.sc-calcite-alert-h[scale=m] slot[name=title].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=m] *.sc-calcite-alert-s>[slot=title]{font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=m]) slot[name=message]::slotted(*), :host([scale=m]) *::slotted([slot=message])*/.sc-calcite-alert-h[scale=m] slot[name=message].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=m] *.sc-calcite-alert-s>[slot=message]{font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=m]) slot[name=link]::slotted(*), :host([scale=m]) *::slotted([slot=link])*/.sc-calcite-alert-h[scale=m] slot[name=link].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=m] *.sc-calcite-alert-s>[slot=link]{font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=m]) .alert-queue-count*/[scale=m].sc-calcite-alert-h .alert-queue-count.sc-calcite-alert{margin-left:0.75rem;margin-right:0.75rem}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-alert-h .container.sc-calcite-alert{--calcite-alert-min-height:4.1875rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-alert-h{--calcite-alert-width:60em;--calcite-alert-spacing-token-small:1rem;--calcite-alert-spacing-token-large:1.25rem}/*!@:host([scale=l]) slot[name=title]::slotted(*), :host([scale=l]) *::slotted([slot=title])*/.sc-calcite-alert-h[scale=l] slot[name=title].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=l] *.sc-calcite-alert-s>[slot=title]{margin-bottom:0.25rem;font-size:var(--calcite-font-size-1);line-height:1.375}/*!@:host([scale=l]) slot[name=message]::slotted(*), :host([scale=l]) *::slotted([slot=message])*/.sc-calcite-alert-h[scale=l] slot[name=message].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=l] *.sc-calcite-alert-s>[slot=message]{font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=l]) slot[name=link]::slotted(*), :host([scale=l]) *::slotted([slot=link])*/.sc-calcite-alert-h[scale=l] slot[name=link].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=l] *.sc-calcite-alert-s>[slot=link]{font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=l]) .alert-queue-count*/[scale=l].sc-calcite-alert-h .alert-queue-count.sc-calcite-alert{margin-left:1rem;margin-right:1rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-alert-h .container.sc-calcite-alert{--calcite-alert-min-height:5.625rem}/*!@:host*/.sc-calcite-alert-h{--calcite-alert-edge-distance:2rem;display:block}/*!@:host .container*/.sc-calcite-alert-h .container.sc-calcite-alert{pointer-events:none;position:fixed;margin-top:0px;margin-bottom:0px;margin-left:auto;margin-right:auto;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--calcite-ui-foreground-1);opacity:0;--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-radius:var(--calcite-border-radius);border-top:0px solid transparent;border-left:1px solid var(--calcite-ui-border-3);border-right:1px solid var(--calcite-ui-border-3);border-bottom:1px solid var(--calcite-ui-border-3);min-height:var(--calcite-alert-min-height);width:var(--calcite-alert-width);max-width:calc(100% - (var(--calcite-alert-edge-distance) * 2 + 2px));max-height:0;z-index:101;-webkit-transition:var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out;transition:var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out}/*!@:host .container.bottom, :host .container.top*/.sc-calcite-alert-h .container.bottom.sc-calcite-alert,.sc-calcite-alert-h .container.top.sc-calcite-alert{inset-inline-end:0;inset-inline-start:0}/*!@:host .container[class*=bottom]*/.sc-calcite-alert-h .container[class*=bottom].sc-calcite-alert{-webkit-transform:translate3d(0, var(--calcite-alert-edge-distance), 0);transform:translate3d(0, var(--calcite-alert-edge-distance), 0);inset-block-end:var(--calcite-alert-edge-distance)}/*!@:host .container[class*=top]*/.sc-calcite-alert-h .container[class*=top].sc-calcite-alert{-webkit-transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), 0);transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), 0);inset-block-start:var(--calcite-alert-edge-distance)}/*!@:host .container[class*=-start]*/.sc-calcite-alert-h .container[class*=-start].sc-calcite-alert{inset-inline-start:var(--calcite-alert-edge-distance);inset-inline-end:auto}/*!@:host .container[class*=-end]*/.sc-calcite-alert-h .container[class*=-end].sc-calcite-alert{inset-inline-end:var(--calcite-alert-edge-distance);inset-inline-start:auto}/*!@.container*/.container.sc-calcite-alert{display:-ms-flexbox;display:flex;width:100%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}/*!@.alert-close*/.alert-close.sc-calcite-alert{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@.alert-close:focus*/.alert-close.sc-calcite-alert:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([active]) .container:not(.queued)*/[active].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued){max-height:100%;border-top-width:2px;opacity:1;pointer-events:initial}/*!@:host([active]) .container:not(.queued)[class*=bottom]*/[active].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued)[class*=bottom]{-webkit-transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit);transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit)}/*!@:host([active]) .container:not(.queued)[class*=top]*/[active].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued)[class*=top]{-webkit-transform:translate3d(0, var(--calcite-alert-edge-distance), inherit);transform:translate3d(0, var(--calcite-alert-edge-distance), inherit)}/*!@slot[name=title]::slotted(*), *::slotted([slot=title])*/slot[name=title].sc-calcite-alert-s>*,*.sc-calcite-alert-s>[slot=title]{font-size:var(--calcite-font-size-0);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@slot[name=message]::slotted(*), *::slotted([slot=message])*/slot[name=message].sc-calcite-alert-s>*,*.sc-calcite-alert-s>[slot=message]{margin:0px;display:inline;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}/*!@slot[name=link]::slotted(*), *::slotted([slot=link])*/slot[name=link].sc-calcite-alert-s>*,*.sc-calcite-alert-s>[slot=link]{display:-ms-inline-flexbox;display:inline-flex;color:var(--calcite-ui-text-link)}/*!@.alert-content*/.alert-content.sc-calcite-alert{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto;overflow-wrap:break-word;background-color:var(--calcite-ui-foreground-1);-ms-flex:1 1 auto;flex:1 1 auto;min-width:0;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:0 var(--calcite-alert-spacing-token-small);border-bottom-left-radius:var(--calcite-border-radius);border-bottom-right-radius:var(--calcite-border-radius)}/*!@.alert-content:first-of-type:not(:only-child)*/.alert-content.sc-calcite-alert:first-of-type:not(:only-child){-webkit-padding-start:var(--calcite-alert-spacing-token-large);padding-inline-start:var(--calcite-alert-spacing-token-large)}/*!@.alert-content:only-child*/.alert-content.sc-calcite-alert:only-child{padding:var(--calcite-alert-spacing-token-small)}/*!@.alert-icon*/.alert-icon.sc-calcite-alert{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-item-align:stretch;align-self:stretch;background-color:var(--calcite-ui-foreground-1);padding-top:0px;padding-bottom:0px}/*!@.alert-close*/.alert-close.sc-calcite-alert{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto;cursor:pointer;-ms-flex-item-align:stretch;align-self:stretch;overflow:hidden;border-style:none;background-color:var(--calcite-ui-foreground-1);padding-top:0px;padding-bottom:0px;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;border-end-end-radius:var(--calcite-border-radius)}/*!@.alert-close:hover, .alert-close:focus*/.alert-close.sc-calcite-alert:hover,.alert-close.sc-calcite-alert:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.alert-close:active*/.alert-close.sc-calcite-alert:active{background-color:var(--calcite-ui-foreground-3)}/*!@.alert-queue-count*/.alert-queue-count.sc-calcite-alert{visibility:hidden;display:-ms-flexbox;display:flex;cursor:default;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around;-ms-flex-item-align:stretch;align-self:stretch;overflow:hidden;background-color:var(--calcite-ui-foreground-1);text-align:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);opacity:0;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;border-left:0px solid transparent;border-right:0px solid transparent;border-top-right-radius:0}/*!@.alert-queue-count.active*/.alert-queue-count.active.sc-calcite-alert{visibility:visible;opacity:1}/*!@:host([auto-dismiss]) > .alert-queue-count*/[auto-dismiss].sc-calcite-alert-h>.alert-queue-count.sc-calcite-alert{-webkit-border-end:0px solid transparent;border-inline-end:0px solid transparent}/*!@.alert-dismiss-progress*/.alert-dismiss-progress.sc-calcite-alert{position:absolute;left:0px;right:0px;display:block;width:100%;overflow:hidden;top:-2px;height:2px;z-index:103;border-radius:var(--calcite-border-radius) var(--calcite-border-radius) 0 0}/*!@.alert-dismiss-progress:after*/.alert-dismiss-progress.sc-calcite-alert:after{position:absolute;top:0px;display:block;height:2px;content:\"\";background-color:var(--calcite-alert-dismiss-progress-background);z-index:104;inset-inline-end:0}/*!@:host([color=blue]) .container*/[color=blue].sc-calcite-alert-h .container.sc-calcite-alert{border-top-color:var(--calcite-ui-info)}/*!@:host([color=blue]) .container .alert-icon*/[color=blue].sc-calcite-alert-h .container.sc-calcite-alert .alert-icon.sc-calcite-alert{color:var(--calcite-ui-info)}/*!@:host([color=red]) .container*/[color=red].sc-calcite-alert-h .container.sc-calcite-alert{border-top-color:var(--calcite-ui-danger)}/*!@:host([color=red]) .container .alert-icon*/[color=red].sc-calcite-alert-h .container.sc-calcite-alert .alert-icon.sc-calcite-alert{color:var(--calcite-ui-danger)}/*!@:host([color=yellow]) .container*/[color=yellow].sc-calcite-alert-h .container.sc-calcite-alert{border-top-color:var(--calcite-ui-warning)}/*!@:host([color=yellow]) .container .alert-icon*/[color=yellow].sc-calcite-alert-h .container.sc-calcite-alert .alert-icon.sc-calcite-alert{color:var(--calcite-ui-warning)}/*!@:host([color=green]) .container*/[color=green].sc-calcite-alert-h .container.sc-calcite-alert{border-top-color:var(--calcite-ui-success)}/*!@:host([color=green]) .container .alert-icon*/[color=green].sc-calcite-alert-h .container.sc-calcite-alert .alert-icon.sc-calcite-alert{color:var(--calcite-ui-success)}/*!@:host([auto-dismiss-duration=fast]) .alert-dismiss-progress:after*/[auto-dismiss-duration=fast].sc-calcite-alert-h .alert-dismiss-progress.sc-calcite-alert:after{-webkit-animation:dismissProgress 6000ms ease-out;animation:dismissProgress 6000ms ease-out}/*!@:host([auto-dismiss-duration=medium]) .alert-dismiss-progress:after*/[auto-dismiss-duration=medium].sc-calcite-alert-h .alert-dismiss-progress.sc-calcite-alert:after{-webkit-animation:dismissProgress 10000ms ease-out;animation:dismissProgress 10000ms ease-out}/*!@:host([auto-dismiss-duration=slow]) .alert-dismiss-progress:after*/[auto-dismiss-duration=slow].sc-calcite-alert-h .alert-dismiss-progress.sc-calcite-alert:after{-webkit-animation:dismissProgress 14000ms ease-out;animation:dismissProgress 14000ms ease-out}@-webkit-keyframes dismissProgress{0%{width:0px;opacity:0.75}100%{width:100%;opacity:1}}@keyframes dismissProgress{0%{width:0px;opacity:0.75}100%{width:100%;opacity:1}}";
  8208. /** Alerts are meant to provide a way to communicate urgent or important information to users, frequently as a result of an action they took in your app. Alerts are positioned
  8209. * at the bottom of the page. Multiple opened alerts will be added to a queue, allowing users to dismiss them in the order they are provided.
  8210. */
  8211. /**
  8212. * @slot title - Title of the alert (optional)
  8213. * @slot message - Main text of the alert
  8214. * @slot link - Optional action to take from the alert (undo, try again, link to page, etc.)
  8215. */
  8216. class Alert {
  8217. constructor(hostRef) {
  8218. registerInstance(this, hostRef);
  8219. this.calciteAlertClose = createEvent(this, "calciteAlertClose", 7);
  8220. this.calciteAlertOpen = createEvent(this, "calciteAlertOpen", 7);
  8221. this.calciteAlertSync = createEvent(this, "calciteAlertSync", 7);
  8222. this.calciteAlertRegister = createEvent(this, "calciteAlertRegister", 7);
  8223. //--------------------------------------------------------------------------
  8224. //
  8225. // Properties
  8226. //
  8227. //---------------------------------------------------------------------------
  8228. /** Is the alert currently active or not */
  8229. this.active = false;
  8230. /** Close the alert automatically (recommended for passive, non-blocking alerts) */
  8231. this.autoDismiss = false;
  8232. /** Duration of autoDismiss (only used with `autoDismiss`) */
  8233. this.autoDismissDuration = this.autoDismiss ? "medium" : null;
  8234. /** Color for the alert (will apply to top border and icon) */
  8235. this.color = "blue";
  8236. /** string to override English close text
  8237. * @default "Close"
  8238. */
  8239. this.intlClose = TEXT$n.intlClose;
  8240. /** specify the placement of the alert */
  8241. this.placement = "bottom";
  8242. /** specify the scale of the alert, defaults to m */
  8243. this.scale = "m";
  8244. //--------------------------------------------------------------------------
  8245. //
  8246. // Private State/Props
  8247. //
  8248. //--------------------------------------------------------------------------
  8249. /** the list of queued alerts */
  8250. this.queue = [];
  8251. /** the count of queued alerts */
  8252. this.queueLength = 0;
  8253. /** is the alert queued */
  8254. this.queued = false;
  8255. this.autoDismissTimeoutId = null;
  8256. this.trackTimer = Date.now();
  8257. this.activeTransitionProp = "opacity";
  8258. /** close and emit the closed alert and the queue */
  8259. this.closeAlert = () => {
  8260. this.autoDismissTimeoutId = null;
  8261. this.queued = false;
  8262. this.active = false;
  8263. this.queue = this.queue.filter((e) => e !== this.el);
  8264. this.determineActiveAlert();
  8265. this.calciteAlertSync.emit({ queue: this.queue });
  8266. };
  8267. this.transitionEnd = (event) => {
  8268. if (event.propertyName === this.activeTransitionProp) {
  8269. this.active
  8270. ? this.calciteAlertOpen.emit({
  8271. el: this.el,
  8272. queue: this.queue
  8273. })
  8274. : this.calciteAlertClose.emit({
  8275. el: this.el,
  8276. queue: this.queue
  8277. });
  8278. }
  8279. };
  8280. }
  8281. watchActive() {
  8282. if (this.active && !this.queued) {
  8283. this.calciteAlertRegister.emit();
  8284. }
  8285. if (!this.active) {
  8286. this.queue = this.queue.filter((e) => e !== this.el);
  8287. this.calciteAlertSync.emit({ queue: this.queue });
  8288. }
  8289. }
  8290. updateRequestedIcon() {
  8291. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  8292. }
  8293. updateDuration() {
  8294. if (this.autoDismiss && this.autoDismissTimeoutId) {
  8295. window.clearTimeout(this.autoDismissTimeoutId);
  8296. this.autoDismissTimeoutId = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration] - (Date.now() - this.trackTimer));
  8297. }
  8298. }
  8299. //--------------------------------------------------------------------------
  8300. //
  8301. // Lifecycle
  8302. //
  8303. //--------------------------------------------------------------------------
  8304. connectedCallback() {
  8305. if (this.active && !this.queued) {
  8306. this.calciteAlertRegister.emit();
  8307. }
  8308. }
  8309. componentWillLoad() {
  8310. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  8311. }
  8312. disconnectedCallback() {
  8313. window.clearTimeout(this.autoDismissTimeoutId);
  8314. }
  8315. render() {
  8316. const closeButton = (hAsync("button", { "aria-label": this.intlClose, class: "alert-close", onClick: this.closeAlert, ref: (el) => (this.closeButton = el), type: "button" }, hAsync("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
  8317. const queueText = `+${this.queueLength > 2 ? this.queueLength - 1 : 1}`;
  8318. const queueCount = (hAsync("div", { class: `${this.queueLength > 1 ? "active " : ""}alert-queue-count` }, hAsync("calcite-chip", { scale: this.scale, value: queueText }, queueText)));
  8319. const { active, autoDismiss, label, placement, queued, requestedIcon } = this;
  8320. const role = autoDismiss ? "alert" : "alertdialog";
  8321. const hidden = !active;
  8322. return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "calcite-hydrated-hidden": hidden, role: role }, hAsync("div", { class: {
  8323. container: true,
  8324. queued,
  8325. [placement]: true
  8326. }, onTransitionEnd: this.transitionEnd }, requestedIcon ? (hAsync("div", { class: "alert-icon" }, hAsync("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, hAsync("div", { class: "alert-content" }, hAsync("slot", { name: SLOTS$l.title }), hAsync("slot", { name: SLOTS$l.message }), hAsync("slot", { name: SLOTS$l.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ? hAsync("div", { class: "alert-dismiss-progress" }) : null)));
  8327. }
  8328. // when an alert is opened or closed, update queue and determine active alert
  8329. alertSync(event) {
  8330. if (this.queue !== event.detail.queue) {
  8331. this.queue = event.detail.queue;
  8332. }
  8333. this.queueLength = this.queue.length;
  8334. this.determineActiveAlert();
  8335. }
  8336. // when an alert is first registered, trigger a queue sync to get queue
  8337. alertRegister() {
  8338. if (this.active && !this.queue.includes(this.el)) {
  8339. this.queued = true;
  8340. this.queue.push(this.el);
  8341. }
  8342. this.calciteAlertSync.emit({ queue: this.queue });
  8343. this.determineActiveAlert();
  8344. }
  8345. //--------------------------------------------------------------------------
  8346. //
  8347. // Public Methods
  8348. //
  8349. //--------------------------------------------------------------------------
  8350. /** Sets focus on the component. */
  8351. async setFocus() {
  8352. const alertLinkEl = getSlotted(this.el, { selector: "calcite-link" });
  8353. if (!this.closeButton && !alertLinkEl) {
  8354. return;
  8355. }
  8356. else if (alertLinkEl) {
  8357. alertLinkEl.setFocus();
  8358. }
  8359. else if (this.closeButton) {
  8360. this.closeButton.focus();
  8361. }
  8362. }
  8363. //--------------------------------------------------------------------------
  8364. //
  8365. // Private Methods
  8366. //
  8367. //--------------------------------------------------------------------------
  8368. /** determine which alert is active */
  8369. determineActiveAlert() {
  8370. var _a;
  8371. if (((_a = this.queue) === null || _a === void 0 ? void 0 : _a[0]) === this.el) {
  8372. this.openAlert();
  8373. if (this.autoDismiss && !this.autoDismissTimeoutId) {
  8374. this.trackTimer = Date.now();
  8375. this.autoDismissTimeoutId = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration]);
  8376. }
  8377. }
  8378. else {
  8379. return;
  8380. }
  8381. }
  8382. /** emit the opened alert and the queue */
  8383. openAlert() {
  8384. window.clearTimeout(this.queueTimeout);
  8385. this.queueTimeout = window.setTimeout(() => (this.queued = false), 300);
  8386. }
  8387. get el() { return getElement(this); }
  8388. static get watchers() { return {
  8389. "active": ["watchActive"],
  8390. "icon": ["updateRequestedIcon"],
  8391. "color": ["updateRequestedIcon"],
  8392. "autoDismissDuration": ["updateDuration"]
  8393. }; }
  8394. static get style() { return alertCss; }
  8395. static get cmpMeta() { return {
  8396. "$flags$": 9,
  8397. "$tagName$": "calcite-alert",
  8398. "$members$": {
  8399. "active": [1540],
  8400. "autoDismiss": [4, "auto-dismiss"],
  8401. "autoDismissDuration": [513, "auto-dismiss-duration"],
  8402. "color": [513],
  8403. "icon": [520],
  8404. "intlClose": [1, "intl-close"],
  8405. "label": [1],
  8406. "placement": [1],
  8407. "scale": [513],
  8408. "queue": [32],
  8409. "queueLength": [32],
  8410. "queued": [32],
  8411. "requestedIcon": [32],
  8412. "setFocus": [64]
  8413. },
  8414. "$listeners$": [[8, "calciteAlertSync", "alertSync"], [8, "calciteAlertRegister", "alertRegister"]],
  8415. "$lazyBundleId$": "-",
  8416. "$attrsToReflect$": [["active", "active"], ["autoDismissDuration", "auto-dismiss-duration"], ["color", "color"], ["icon", "icon"], ["scale", "scale"]]
  8417. }; }
  8418. }
  8419. function rgbToHex(color) {
  8420. const { r, g, b } = color;
  8421. return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b
  8422. .toString(16)
  8423. .padStart(2, "0")}`.toLowerCase();
  8424. }
  8425. const hexChar = /^[0-9A-F]$/i;
  8426. const shortHandHex = /^#[0-9A-F]{3}$/i;
  8427. const longhandHex = /^#[0-9A-F]{6}$/i;
  8428. function isValidHex(hex) {
  8429. return isShorthandHex(hex) || isLonghandHex(hex);
  8430. }
  8431. function isShorthandHex(hex) {
  8432. return hex && hex.length === 4 && shortHandHex.test(hex);
  8433. }
  8434. function isLonghandHex(hex) {
  8435. return hex && hex.length === 7 && longhandHex.test(hex);
  8436. }
  8437. function normalizeHex(hex) {
  8438. hex = hex.toLowerCase();
  8439. if (!hex.startsWith("#")) {
  8440. hex = `#${hex}`;
  8441. }
  8442. if (isShorthandHex(hex)) {
  8443. return rgbToHex(hexToRGB(hex));
  8444. }
  8445. return hex;
  8446. }
  8447. function hexToRGB(hex) {
  8448. if (!isValidHex(hex)) {
  8449. return null;
  8450. }
  8451. hex = hex.replace("#", "");
  8452. if (hex.length === 3) {
  8453. const [first, second, third] = hex.split("");
  8454. const r = parseInt(`${first}${first}`, 16);
  8455. const g = parseInt(`${second}${second}`, 16);
  8456. const b = parseInt(`${third}${third}`, 16);
  8457. return { r, g, b };
  8458. }
  8459. const r = parseInt(hex.slice(0, 2), 16);
  8460. const g = parseInt(hex.slice(2, 4), 16);
  8461. const b = parseInt(hex.slice(4, 6), 16);
  8462. return { r, g, b };
  8463. }
  8464. // these utils allow users to pass enum values as strings without having to access the enum
  8465. // based on the approach suggested by https://github.com/microsoft/TypeScript/issues/17690#issuecomment-321365759,
  8466. const enumify = (x) => x;
  8467. const CSSColorMode = enumify({
  8468. HEX: "hex",
  8469. HEXA: "hexa",
  8470. RGB_CSS: "rgb-css",
  8471. RGBA_CSS: "rgba-css",
  8472. HSL_CSS: "hsl-css",
  8473. HSLA_CSS: "hsla-css"
  8474. });
  8475. const ObjectColorMode = enumify({
  8476. RGB: "rgb",
  8477. RGBA: "rgba",
  8478. HSL: "hsl",
  8479. HSLA: "hsla",
  8480. HSV: "hsv",
  8481. HSVA: "hsva"
  8482. });
  8483. function parseMode(colorValue) {
  8484. if (typeof colorValue === "string") {
  8485. if (colorValue.startsWith("#")) {
  8486. const { length } = colorValue;
  8487. if (length === 4 || length === 7) {
  8488. return CSSColorMode.HEX;
  8489. }
  8490. if (length === 5 || length === 9) {
  8491. return CSSColorMode.HEXA;
  8492. }
  8493. }
  8494. if (colorValue.startsWith("rgba(")) {
  8495. return CSSColorMode.RGBA_CSS;
  8496. }
  8497. if (colorValue.startsWith("rgb(")) {
  8498. return CSSColorMode.RGB_CSS;
  8499. }
  8500. if (colorValue.startsWith("hsl(")) {
  8501. return CSSColorMode.HSL_CSS;
  8502. }
  8503. if (colorValue.startsWith("hsla(")) {
  8504. return CSSColorMode.HSLA_CSS;
  8505. }
  8506. }
  8507. if (typeof colorValue === "object") {
  8508. if (hasChannels(colorValue, "r", "g", "b")) {
  8509. return hasChannels(colorValue, "a") ? ObjectColorMode.RGBA : ObjectColorMode.RGB;
  8510. }
  8511. if (hasChannels(colorValue, "h", "s", "l")) {
  8512. return hasChannels(colorValue, "a") ? ObjectColorMode.HSLA : ObjectColorMode.HSL;
  8513. }
  8514. if (hasChannels(colorValue, "h", "s", "v")) {
  8515. return hasChannels(colorValue, "a") ? ObjectColorMode.HSVA : ObjectColorMode.HSV;
  8516. }
  8517. }
  8518. return null;
  8519. }
  8520. function hasChannels(colorObject, ...channels) {
  8521. return channels.every((channel) => channel && colorObject && `${channel}` in colorObject);
  8522. }
  8523. function colorEqual(value1, value2) {
  8524. return (value1 === null || value1 === void 0 ? void 0 : value1.rgbNumber()) === (value2 === null || value2 === void 0 ? void 0 : value2.rgbNumber());
  8525. }
  8526. /**
  8527. * Convert a string to a valid hex by hashing its contents
  8528. * and using the hash as a seed for three distinct color values
  8529. */
  8530. function stringToHex(str) {
  8531. let hash = 0;
  8532. for (let i = 0; i < str.length; i++) {
  8533. hash = str.charCodeAt(i) + ((hash << 5) - hash);
  8534. }
  8535. let hex = "#";
  8536. for (let j = 0; j < 3; j++) {
  8537. const value = (hash >> (j * 8)) & 0xff;
  8538. hex += ("00" + value.toString(16)).substr(-2);
  8539. }
  8540. return hex;
  8541. }
  8542. /**
  8543. * Find the hue of a color given the separate RGB color channels
  8544. */
  8545. function rgbToHue(rgb) {
  8546. let { r, g, b } = rgb;
  8547. r /= 255;
  8548. g /= 255;
  8549. b /= 255;
  8550. const max = Math.max(r, g, b);
  8551. const min = Math.min(r, g, b);
  8552. const delta = max - min;
  8553. if (max === min) {
  8554. return 0;
  8555. }
  8556. let hue = (max + min) / 2;
  8557. switch (max) {
  8558. case r:
  8559. hue = (g - b) / delta + (g < b ? 6 : 0);
  8560. break;
  8561. case g:
  8562. hue = (b - r) / delta + 2;
  8563. break;
  8564. case b:
  8565. hue = (r - g) / delta + 4;
  8566. break;
  8567. }
  8568. return Math.round(hue * 60);
  8569. }
  8570. /**
  8571. * For a hex color, find the hue
  8572. * @param hex {string} - form of "#------"
  8573. */
  8574. function hexToHue(hex) {
  8575. return rgbToHue(hexToRGB(hex));
  8576. }
  8577. const avatarCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-avatar:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-avatar{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-avatar{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-avatar{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-avatar{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-avatar{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-avatar:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-avatar-h{display:none}/*!@:host*/.sc-calcite-avatar-h{display:inline-block;overflow:hidden;border-radius:50%}/*!@:host([scale=s])*/[scale=s].sc-calcite-avatar-h{height:1.5rem;width:1.5rem;font-size:var(--calcite-font-size--3)}/*!@:host([scale=m])*/[scale=m].sc-calcite-avatar-h{height:2rem;width:2rem;font-size:var(--calcite-font-size--2)}/*!@:host([scale=l])*/[scale=l].sc-calcite-avatar-h{height:2.75rem;width:2.75rem;font-size:var(--calcite-font-size-0)}/*!@.icon*/.icon.sc-calcite-avatar{display:-ms-flexbox;display:flex}/*!@.background*/.background.sc-calcite-avatar{display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:50%}/*!@.initials*/.initials.sc-calcite-avatar{font-weight:var(--calcite-font-weight-bold);text-transform:uppercase;color:var(--calcite-ui-text-3)}/*!@.thumbnail*/.thumbnail.sc-calcite-avatar{height:100%;width:100%;border-radius:50%}";
  8578. class Avatar {
  8579. constructor(hostRef) {
  8580. registerInstance(this, hostRef);
  8581. //--------------------------------------------------------------------------
  8582. //
  8583. // Properties
  8584. //
  8585. //--------------------------------------------------------------------------
  8586. /** specify the scale of the avatar, defaults to m */
  8587. this.scale = "m";
  8588. //--------------------------------------------------------------------------
  8589. //
  8590. // Private State/Props
  8591. //
  8592. //--------------------------------------------------------------------------
  8593. /** True if thumnail fails to load */
  8594. this.error = false;
  8595. }
  8596. //--------------------------------------------------------------------------
  8597. //
  8598. // Lifecycle
  8599. //
  8600. //--------------------------------------------------------------------------
  8601. render() {
  8602. return this.determineContent();
  8603. }
  8604. //--------------------------------------------------------------------------
  8605. //
  8606. // Private Methods
  8607. //
  8608. //--------------------------------------------------------------------------
  8609. determineContent() {
  8610. if (this.thumbnail && !this.error) {
  8611. return (hAsync("img", { alt: "", class: "thumbnail", onError: () => (this.error = true), src: this.thumbnail }));
  8612. }
  8613. const initials = this.generateInitials();
  8614. const backgroundColor = this.generateFillColor();
  8615. return (hAsync("span", { class: "background", style: { backgroundColor } }, initials ? (hAsync("span", { "aria-hidden": "true", class: "initials" }, initials)) : (hAsync("calcite-icon", { class: "icon", icon: "user", scale: this.scale }))));
  8616. }
  8617. /**
  8618. * Generate a valid background color that is consistent and unique to this user
  8619. */
  8620. generateFillColor() {
  8621. const { userId, username, fullName, el } = this;
  8622. const theme = getThemeName(el);
  8623. const id = userId && `#${userId.substr(userId.length - 6)}`;
  8624. const name = username || fullName || "";
  8625. const hex = id && isValidHex(id) ? id : stringToHex(name);
  8626. // if there is not unique information, or an invalid hex is produced, return a default
  8627. if ((!userId && !name) || !isValidHex(hex)) {
  8628. return `var(--calcite-ui-foreground-2)`;
  8629. }
  8630. const hue = hexToHue(hex);
  8631. const l = theme === "dark" ? 20 : 90;
  8632. return `hsl(${hue}, 60%, ${l}%)`;
  8633. }
  8634. /**
  8635. * Use fullname or username to generate initials
  8636. */
  8637. generateInitials() {
  8638. const { fullName, username } = this;
  8639. if (fullName) {
  8640. return fullName
  8641. .trim()
  8642. .split(" ")
  8643. .map((name) => name.substring(0, 1))
  8644. .join("");
  8645. }
  8646. else if (username) {
  8647. return username.substring(0, 2);
  8648. }
  8649. return false;
  8650. }
  8651. get el() { return getElement(this); }
  8652. static get style() { return avatarCss; }
  8653. static get cmpMeta() { return {
  8654. "$flags$": 9,
  8655. "$tagName$": "calcite-avatar",
  8656. "$members$": {
  8657. "scale": [513],
  8658. "thumbnail": [1],
  8659. "fullName": [1, "full-name"],
  8660. "username": [1],
  8661. "userId": [1, "user-id"],
  8662. "error": [32]
  8663. },
  8664. "$listeners$": undefined,
  8665. "$lazyBundleId$": "-",
  8666. "$attrsToReflect$": [["scale", "scale"]]
  8667. }; }
  8668. }
  8669. const CSS$L = {
  8670. article: "article",
  8671. content: "content",
  8672. headerContainer: "header-container",
  8673. icon: "icon",
  8674. statusIcon: "status-icon",
  8675. toggle: "toggle",
  8676. toggleIcon: "toggle-icon",
  8677. title: "title",
  8678. heading: "heading",
  8679. header: "header",
  8680. button: "button",
  8681. summary: "summary",
  8682. controlContainer: "control-container",
  8683. valid: "valid",
  8684. invalid: "invalid",
  8685. loading: "loading"
  8686. };
  8687. const TEXT$m = {
  8688. collapse: "Collapse",
  8689. expand: "Expand",
  8690. loading: "Loading",
  8691. options: "Options"
  8692. };
  8693. const SLOTS$k = {
  8694. icon: "icon",
  8695. control: "control",
  8696. headerMenuActions: "header-menu-actions"
  8697. };
  8698. const ICONS$c = {
  8699. opened: "chevron-up",
  8700. closed: "chevron-down",
  8701. valid: "check-circle",
  8702. invalid: "exclamation-mark-triangle",
  8703. refresh: "refresh"
  8704. };
  8705. const HEADING_LEVEL$7 = 4;
  8706. function constrainHeadingLevel(level) {
  8707. return Math.min(Math.max(Math.ceil(level), 1), 6);
  8708. }
  8709. const Heading = (props, children) => {
  8710. const HeadingTag = `h${props.level}`;
  8711. delete props.level;
  8712. return hAsync(HeadingTag, Object.assign({}, props), children);
  8713. };
  8714. const blockCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-block:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-block{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-block{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-block{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-block{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-block{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-block-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-block-h *.sc-calcite-block{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:host*/.sc-calcite-block-h{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}/*!@:root*/.sc-calcite-block:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-block-h{display:none}/*!@:host*/.sc-calcite-block-h{display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-direction:column;flex-direction:column;border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding:0px;-webkit-transition-property:margin;transition-property:margin;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.215, 0.440, 0.420, 0.880);transition-timing-function:cubic-bezier(0.215, 0.440, 0.420, 0.880);-ms-flex-preferred-size:auto;flex-basis:auto}/*!@:host([disabled])*/[disabled].sc-calcite-block-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-block-h[disabled] .sc-calcite-block-s>[calcite-hydrated][disabled],[disabled].sc-calcite-block-h [calcite-hydrated][disabled].sc-calcite-block{opacity:1}/*!@.header*/.header.sc-calcite-block{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-line-pack:justify;align-content:space-between;-ms-flex-align:center;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-block{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-block .heading.sc-calcite-block{-ms-flex:1 1 auto;flex:1 1 auto;padding:0.5rem}/*!@h1.heading*/h1.heading.sc-calcite-block{font-size:var(--calcite-font-size-2);line-height:1.5rem}/*!@h2.heading*/h2.heading.sc-calcite-block{font-size:var(--calcite-font-size-1);line-height:1.5rem}/*!@h3.heading*/h3.heading.sc-calcite-block{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@h4.heading, h5.heading*/h4.heading.sc-calcite-block,h5.heading.sc-calcite-block{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.header*/.header.sc-calcite-block{-ms-flex-pack:start;justify-content:flex-start;padding:0px}/*!@.header,\n.toggle*/.header.sc-calcite-block,.toggle.sc-calcite-block{grid-area:header}/*!@.header-container*/.header-container.sc-calcite-block{display:grid;-ms-flex-align:stretch;align-items:stretch;grid-template:auto/auto 1fr auto auto;grid-template-areas:\"handle header control menu\";grid-column:header-start/menu-end;grid-row:1/2}/*!@.toggle*/.toggle.sc-calcite-block{margin:0px;display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;border-style:none;padding:0px;font-family:inherit;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;text-align:initial;background-color:transparent}/*!@.toggle:hover*/.toggle.sc-calcite-block:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.toggle:focus*/.toggle.sc-calcite-block:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@calcite-loader[inline]*/calcite-loader[inline].sc-calcite-block{grid-area:control;align-self:center}/*!@calcite-handle*/calcite-handle.sc-calcite-block{grid-area:handle}/*!@.title*/.title.sc-calcite-block{margin:0px;padding:0.75rem}/*!@.header .title .heading*/.header.sc-calcite-block .title.sc-calcite-block .heading.sc-calcite-block{padding:0px;font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-medium);line-height:1.25;color:var(--calcite-ui-text-2);-webkit-transition-property:color;transition-property:color;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);word-wrap:break-word;word-break:break-word}/*!@.summary*/.summary.sc-calcite-block{margin-top:0.125rem;padding:0px;font-size:var(--calcite-font-size--2);color:var(--calcite-ui-text-3);word-wrap:break-word;word-break:break-word}/*!@.icon*/.icon.sc-calcite-block{-webkit-margin-start:0.75rem;margin-inline-start:0.75rem;-webkit-margin-end:0px;margin-inline-end:0px;margin-block:0.75rem}/*!@.status-icon.valid*/.status-icon.valid.sc-calcite-block{color:var(--calcite-ui-success)}/*!@.status-icon.invalid*/.status-icon.invalid.sc-calcite-block{color:var(--calcite-ui-danger)}/*!@.status-icon.loading*/.status-icon.loading.sc-calcite-block{-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}/*!@.toggle-icon*/.toggle-icon.sc-calcite-block{margin-top:0.75rem;margin-bottom:0.75rem;-ms-flex-item-align:center;align-self:center;justify-self:end;color:var(--calcite-ui-text-3);-webkit-transition-property:color;transition-property:color;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-margin-end:1rem;margin-inline-end:1rem;-webkit-margin-start:auto;margin-inline-start:auto}/*!@.toggle:hover .toggle-icon*/.toggle.sc-calcite-block:hover .toggle-icon.sc-calcite-block{color:var(--calcite-ui-text-1)}/*!@.content*/.content.sc-calcite-block{position:relative}@keyframes in{0%{opacity:0}100%{opacity:1}}/*!@.content*/.content.sc-calcite-block{-webkit-animation:in var(--calcite-internal-animation-timing-slow) ease-in-out;animation:in var(--calcite-internal-animation-timing-slow) ease-in-out;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}/*!@.control-container*/.control-container.sc-calcite-block{margin:0px;display:-ms-flexbox;display:flex;grid-area:control}/*!@calcite-action-menu*/calcite-action-menu.sc-calcite-block{grid-area:menu}/*!@:host([open])*/[open].sc-calcite-block-h{margin-top:0.5rem;margin-bottom:0.5rem}/*!@:host([open]) .header .title .heading*/[open].sc-calcite-block-h .header.sc-calcite-block .title.sc-calcite-block .heading.sc-calcite-block{color:var(--calcite-ui-text-1)}";
  8715. /**
  8716. * @slot - A slot for adding content to the block.
  8717. * @slot icon - A slot for adding a leading header icon.
  8718. * @slot control - A slot for adding a single HTML input element in a header.
  8719. * @slot header-menu-actions - a slot for adding an overflow menu with actions inside a dropdown.
  8720. */
  8721. class Block {
  8722. constructor(hostRef) {
  8723. registerInstance(this, hostRef);
  8724. this.calciteBlockToggle = createEvent(this, "calciteBlockToggle", 7);
  8725. // --------------------------------------------------------------------------
  8726. //
  8727. // Properties
  8728. //
  8729. // --------------------------------------------------------------------------
  8730. /**
  8731. * When true, this block will be collapsible.
  8732. */
  8733. this.collapsible = false;
  8734. /**
  8735. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  8736. */
  8737. this.disabled = false;
  8738. /**
  8739. * When true, displays a drag handle in the header.
  8740. */
  8741. this.dragHandle = false;
  8742. /**
  8743. * Aria-label for collapsing the toggle and tooltip used for the toggle when expanded.
  8744. */
  8745. this.intlCollapse = TEXT$m.collapse;
  8746. /**
  8747. * Aria-label for expanding the toggle and tooltip used for the toggle when collapsed.
  8748. */
  8749. this.intlExpand = TEXT$m.expand;
  8750. /** string to override English loading text
  8751. * @default "Loading"
  8752. */
  8753. this.intlLoading = TEXT$m.loading;
  8754. /** Text string used for the actions menu
  8755. * @default "Options"
  8756. */
  8757. this.intlOptions = TEXT$m.options;
  8758. /**
  8759. * When true, content is waiting to be loaded. This state shows a busy indicator.
  8760. */
  8761. this.loading = false;
  8762. /**
  8763. * When true, the block's content will be displayed.
  8764. */
  8765. this.open = false;
  8766. this.guid = guid();
  8767. // --------------------------------------------------------------------------
  8768. //
  8769. // Private Methods
  8770. //
  8771. // --------------------------------------------------------------------------
  8772. this.onHeaderClick = () => {
  8773. this.open = !this.open;
  8774. this.calciteBlockToggle.emit();
  8775. };
  8776. }
  8777. //--------------------------------------------------------------------------
  8778. //
  8779. // Lifecycle
  8780. //
  8781. //--------------------------------------------------------------------------
  8782. componentDidRender() {
  8783. updateHostInteraction(this);
  8784. }
  8785. // --------------------------------------------------------------------------
  8786. //
  8787. // Lifecycle
  8788. //
  8789. // --------------------------------------------------------------------------
  8790. connectedCallback() {
  8791. connectConditionalSlotComponent(this);
  8792. }
  8793. disconnectedCallback() {
  8794. disconnectConditionalSlotComponent(this);
  8795. }
  8796. // --------------------------------------------------------------------------
  8797. //
  8798. // Render Methods
  8799. //
  8800. // --------------------------------------------------------------------------
  8801. renderScrim() {
  8802. const { loading } = this;
  8803. const defaultSlot = hAsync("slot", null);
  8804. return [loading ? hAsync("calcite-scrim", { loading: loading }) : null, defaultSlot];
  8805. }
  8806. renderIcon() {
  8807. const { el, status } = this;
  8808. const showingLoadingStatus = this.loading && !this.open;
  8809. const statusIcon = showingLoadingStatus ? ICONS$c.refresh : ICONS$c[status];
  8810. const hasIcon = getSlotted(el, SLOTS$k.icon) || statusIcon;
  8811. const iconEl = !statusIcon ? (hAsync("slot", { key: "icon-slot", name: SLOTS$k.icon })) : (hAsync("calcite-icon", { class: {
  8812. [CSS$L.statusIcon]: true,
  8813. [CSS$L.valid]: status == "valid",
  8814. [CSS$L.invalid]: status == "invalid",
  8815. [CSS$L.loading]: showingLoadingStatus
  8816. }, icon: statusIcon, scale: "m" }));
  8817. return hasIcon ? hAsync("div", { class: CSS$L.icon }, iconEl) : null;
  8818. }
  8819. renderTitle() {
  8820. const { heading, headingLevel, summary } = this;
  8821. return heading || summary ? (hAsync("div", { class: CSS$L.title }, hAsync(Heading, { class: CSS$L.heading, level: headingLevel || HEADING_LEVEL$7 }, heading), summary ? hAsync("div", { class: CSS$L.summary }, summary) : null)) : null;
  8822. }
  8823. render() {
  8824. const { collapsible, el, intlCollapse, intlExpand, loading, open, intlLoading } = this;
  8825. const toggleLabel = open ? intlCollapse || TEXT$m.collapse : intlExpand || TEXT$m.expand;
  8826. const headerContent = (hAsync("header", { class: CSS$L.header }, this.renderIcon(), this.renderTitle()));
  8827. const hasControl = !!getSlotted(el, SLOTS$k.control);
  8828. const hasMenuActions = !!getSlotted(el, SLOTS$k.headerMenuActions);
  8829. const collapseIcon = open ? ICONS$c.opened : ICONS$c.closed;
  8830. const { guid } = this;
  8831. const regionId = `${guid}-region`;
  8832. const buttonId = `${guid}-button`;
  8833. const headerNode = (hAsync("div", { class: CSS$L.headerContainer }, this.dragHandle ? hAsync("calcite-handle", null) : null, collapsible ? (hAsync("button", { "aria-controls": regionId, "aria-expanded": collapsible ? toAriaBoolean(open) : null, "aria-label": toggleLabel, class: CSS$L.toggle, id: buttonId, onClick: this.onHeaderClick, title: toggleLabel }, headerContent, !hasControl && !hasMenuActions ? (hAsync("calcite-icon", { "aria-hidden": "true", class: CSS$L.toggleIcon, icon: collapseIcon, scale: "s" })) : null)) : (headerContent), loading ? (hAsync("calcite-loader", { inline: true, "is-active": true, label: intlLoading })) : hasControl ? (hAsync("div", { class: CSS$L.controlContainer }, hAsync("slot", { name: SLOTS$k.control }))) : null, hasMenuActions ? (hAsync("calcite-action-menu", { label: this.intlOptions || TEXT$m.options }, hAsync("slot", { name: SLOTS$k.headerMenuActions }))) : null));
  8834. return (hAsync(Host, null, hAsync("article", { "aria-busy": toAriaBoolean(loading), class: {
  8835. [CSS$L.article]: true
  8836. } }, headerNode, hAsync("section", { "aria-expanded": toAriaBoolean(open), "aria-labelledby": buttonId, class: CSS$L.content, hidden: !open, id: regionId }, this.renderScrim()))));
  8837. }
  8838. get el() { return getElement(this); }
  8839. static get style() { return blockCss; }
  8840. static get cmpMeta() { return {
  8841. "$flags$": 9,
  8842. "$tagName$": "calcite-block",
  8843. "$members$": {
  8844. "collapsible": [4],
  8845. "disabled": [516],
  8846. "dragHandle": [516, "drag-handle"],
  8847. "heading": [1],
  8848. "headingLevel": [2, "heading-level"],
  8849. "intlCollapse": [1, "intl-collapse"],
  8850. "intlExpand": [1, "intl-expand"],
  8851. "intlLoading": [1, "intl-loading"],
  8852. "intlOptions": [1, "intl-options"],
  8853. "loading": [516],
  8854. "open": [1540],
  8855. "status": [513],
  8856. "summary": [1]
  8857. },
  8858. "$listeners$": undefined,
  8859. "$lazyBundleId$": "-",
  8860. "$attrsToReflect$": [["disabled", "disabled"], ["dragHandle", "drag-handle"], ["loading", "loading"], ["open", "open"], ["status", "status"]]
  8861. }; }
  8862. }
  8863. const CSS$K = {
  8864. content: "content",
  8865. invalid: "invalid",
  8866. toggle: "toggle",
  8867. toggleSwitch: "toggle--switch",
  8868. toggleSwitchContent: "toggle--switch__content",
  8869. toggleSwitchText: "toggle--switch__text",
  8870. sectionHeader: "section-header",
  8871. sectionHeaderText: "section-header__text",
  8872. statusIcon: "status-icon",
  8873. valid: "valid"
  8874. };
  8875. const TEXT$l = {
  8876. collapse: "Collapse",
  8877. expand: "Expand"
  8878. };
  8879. const ICONS$b = {
  8880. menuOpen: "chevron-down",
  8881. menuClosedLeft: "chevron-left",
  8882. menuClosedRight: "chevron-right",
  8883. valid: "check-circle",
  8884. invalid: "exclamation-mark-triangle"
  8885. };
  8886. const blockSectionCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-block-section:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-block-section{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-block-section{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-block-section{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-block-section{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-block-section{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-block-section:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-block-section-h{display:none}/*!@:host*/.sc-calcite-block-section-h{-webkit-box-sizing:border-box;box-sizing:border-box;display:block;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}/*!@:host([open])*/[open].sc-calcite-block-section-h{border-width:0px;border-bottom-width:1px;border-style:solid;border-bottom-color:var(--calcite-ui-border-3)}/*!@:host(:last-child)*/.sc-calcite-block-section-h:last-child{border-bottom-width:0px}/*!@.toggle*/.toggle.sc-calcite-block-section{width:100%;border-width:0px;background-color:transparent;font-family:var(--calcite-sans-family);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}/*!@.toggle--switch, .section-header*/.toggle--switch.sc-calcite-block-section,.section-header.sc-calcite-block-section{margin-left:0px;margin-right:0px;margin-top:0.25rem;margin-bottom:0.25rem;display:-ms-flexbox;display:flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-align:center;align-items:center;padding-left:0px;padding-right:0px;padding-top:0.5rem;padding-bottom:0.5rem;font-size:var(--calcite-font-size--1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@.toggle--switch:focus, .section-header:focus*/.toggle--switch.sc-calcite-block-section:focus,.section-header.sc-calcite-block-section:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.toggle--switch:hover, .section-header:hover*/.toggle--switch.sc-calcite-block-section:hover,.section-header.sc-calcite-block-section:hover{color:var(--calcite-ui-text-1)}/*!@.section-header .status-icon*/.section-header.sc-calcite-block-section .status-icon.sc-calcite-block-section{-ms-flex-item-align:end;align-self:flex-end}/*!@.section-header__text*/.section-header__text.sc-calcite-block-section{margin-left:0.75rem;margin-right:0.75rem;margin-top:0px;margin-bottom:0px;-ms-flex:1 1 auto;flex:1 1 auto;text-align:initial;word-wrap:anywhere}/*!@.toggle--switch calcite-switch*/.toggle--switch.sc-calcite-block-section calcite-switch.sc-calcite-block-section{pointer-events:none;-webkit-margin-start:0.25rem;margin-inline-start:0.25rem}/*!@.toggle--switch .status-icon*/.toggle--switch.sc-calcite-block-section .status-icon.sc-calcite-block-section{-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}/*!@.toggle--switch__content*/.toggle--switch__content.sc-calcite-block-section{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:center;align-items:center}/*!@.status-icon.valid*/.status-icon.valid.sc-calcite-block-section{color:var(--calcite-ui-success)}/*!@.status-icon.invalid*/.status-icon.invalid.sc-calcite-block-section{color:var(--calcite-ui-danger)}";
  8887. /**
  8888. * @slot - A slot for adding content to the block section.
  8889. */
  8890. class BlockSection {
  8891. constructor(hostRef) {
  8892. registerInstance(this, hostRef);
  8893. this.calciteBlockSectionToggle = createEvent(this, "calciteBlockSectionToggle", 7);
  8894. /**
  8895. * When true, the block's section content will be displayed.
  8896. */
  8897. this.open = false;
  8898. /**
  8899. * This property determines the look of the section toggle.
  8900. * If the value is "switch", a toggle-switch will be displayed.
  8901. * If the value is "button", a clickable header is displayed.
  8902. */
  8903. this.toggleDisplay = "button";
  8904. this.guid = guid();
  8905. // --------------------------------------------------------------------------
  8906. //
  8907. // Private Methods
  8908. //
  8909. // --------------------------------------------------------------------------
  8910. this.handleHeaderKeyDown = (event) => {
  8911. if (event.key === " " || event.key === "Enter") {
  8912. this.toggleSection();
  8913. event.preventDefault();
  8914. event.stopPropagation();
  8915. }
  8916. };
  8917. this.toggleSection = () => {
  8918. this.open = !this.open;
  8919. this.calciteBlockSectionToggle.emit();
  8920. };
  8921. }
  8922. // --------------------------------------------------------------------------
  8923. //
  8924. // Render Methods
  8925. //
  8926. // --------------------------------------------------------------------------
  8927. renderStatusIcon() {
  8928. var _a;
  8929. const { status } = this;
  8930. const statusIcon = (_a = ICONS$b[status]) !== null && _a !== void 0 ? _a : false;
  8931. const statusIconClasses = {
  8932. [CSS$K.statusIcon]: true,
  8933. [CSS$K.valid]: status == "valid",
  8934. [CSS$K.invalid]: status == "invalid"
  8935. };
  8936. return !!statusIcon ? (hAsync("calcite-icon", { class: statusIconClasses, icon: statusIcon, scale: "s" })) : null;
  8937. }
  8938. render() {
  8939. const { el, intlCollapse, intlExpand, open, text, toggleDisplay } = this;
  8940. const dir = getElementDir(el);
  8941. const arrowIcon = open
  8942. ? ICONS$b.menuOpen
  8943. : dir === "rtl"
  8944. ? ICONS$b.menuClosedLeft
  8945. : ICONS$b.menuClosedRight;
  8946. const toggleLabel = open ? intlCollapse || TEXT$l.collapse : intlExpand || TEXT$l.expand;
  8947. const { guid } = this;
  8948. const regionId = `${guid}-region`;
  8949. const buttonId = `${guid}-button`;
  8950. const headerNode = toggleDisplay === "switch" ? (hAsync("div", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
  8951. [CSS$K.toggle]: true,
  8952. [CSS$K.toggleSwitch]: true
  8953. }, id: buttonId, onClick: this.toggleSection, onKeyDown: this.handleHeaderKeyDown, tabIndex: 0, title: toggleLabel }, hAsync("div", { class: CSS$K.toggleSwitchContent }, hAsync("span", { class: CSS$K.toggleSwitchText }, text)), hAsync("calcite-switch", { checked: open, label: toggleLabel, scale: "s", tabIndex: -1 }), this.renderStatusIcon())) : (hAsync("button", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
  8954. [CSS$K.sectionHeader]: true,
  8955. [CSS$K.toggle]: true
  8956. }, id: buttonId, name: toggleLabel, onClick: this.toggleSection }, hAsync("calcite-icon", { icon: arrowIcon, scale: "s" }), hAsync("span", { class: CSS$K.sectionHeaderText }, text), this.renderStatusIcon()));
  8957. return (hAsync(Host, null, headerNode, hAsync("section", { "aria-expanded": toAriaBoolean(open), "aria-labelledby": buttonId, class: CSS$K.content, hidden: !open, id: regionId }, hAsync("slot", null))));
  8958. }
  8959. get el() { return getElement(this); }
  8960. static get style() { return blockSectionCss; }
  8961. static get cmpMeta() { return {
  8962. "$flags$": 9,
  8963. "$tagName$": "calcite-block-section",
  8964. "$members$": {
  8965. "intlCollapse": [1, "intl-collapse"],
  8966. "intlExpand": [1, "intl-expand"],
  8967. "open": [1540],
  8968. "status": [513],
  8969. "text": [1],
  8970. "toggleDisplay": [513, "toggle-display"]
  8971. },
  8972. "$listeners$": undefined,
  8973. "$lazyBundleId$": "-",
  8974. "$attrsToReflect$": [["open", "open"], ["status", "status"], ["toggleDisplay", "toggle-display"]]
  8975. }; }
  8976. }
  8977. (function(prototype) {
  8978. if (typeof prototype.requestSubmit == "function") return
  8979. prototype.requestSubmit = function(submitter) {
  8980. if (submitter) {
  8981. validateSubmitter(submitter, this);
  8982. submitter.click();
  8983. } else {
  8984. submitter = document.createElement("input");
  8985. submitter.type = "submit";
  8986. submitter.hidden = true;
  8987. this.appendChild(submitter);
  8988. submitter.click();
  8989. this.removeChild(submitter);
  8990. }
  8991. };
  8992. function validateSubmitter(submitter, form) {
  8993. submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
  8994. submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button");
  8995. submitter.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError");
  8996. }
  8997. function raise(errorConstructor, message, name) {
  8998. throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".", name)
  8999. }
  9000. })(HTMLFormElement.prototype);
  9001. const CSS$J = {
  9002. buttonLoader: "calcite-button--loader",
  9003. content: "content",
  9004. contentSlotted: "content--slotted",
  9005. icon: "icon",
  9006. iconStart: "icon--start",
  9007. iconEnd: "icon--end",
  9008. loadingIn: "loading-in",
  9009. loadingOut: "loading-out",
  9010. iconStartEmpty: "icon-start-empty",
  9011. iconEndEmpty: "icon-end-empty"
  9012. };
  9013. const TEXT$k = {
  9014. loading: "Loading"
  9015. };
  9016. /**
  9017. * Exported for testing purposes only
  9018. * @internal
  9019. */
  9020. const labelClickEvent = "calciteInternalLabelClick";
  9021. const labelConnectedEvent = "calciteInternalLabelConnected";
  9022. const labelDisconnectedEvent = "calciteInternaLabelDisconnected";
  9023. const labelTagName = "calcite-label";
  9024. const onLabelClickMap = new WeakMap();
  9025. const onLabelConnectedMap = new WeakMap();
  9026. const onLabelDisconnectedMap = new WeakMap();
  9027. const unlabeledComponents = new Set();
  9028. const findLabelForComponent = (componentEl) => {
  9029. const { id } = componentEl;
  9030. const forLabel = id && queryElementRoots(componentEl, { selector: `${labelTagName}[for="${id}"]` });
  9031. if (forLabel) {
  9032. return forLabel;
  9033. }
  9034. const parentLabel = closestElementCrossShadowBoundary(componentEl, labelTagName);
  9035. if (!parentLabel ||
  9036. // labelable components within other custom elements are not considered labelable
  9037. hasAncestorCustomElements(parentLabel, componentEl)) {
  9038. return null;
  9039. }
  9040. return parentLabel;
  9041. };
  9042. function hasAncestorCustomElements(label, componentEl) {
  9043. let traversedElements;
  9044. const customElementAncestorCheckEventType = "custom-element-ancestor-check";
  9045. const listener = (event) => {
  9046. event.stopImmediatePropagation();
  9047. const composedPath = event.composedPath();
  9048. traversedElements = composedPath.slice(composedPath.indexOf(componentEl), composedPath.indexOf(label));
  9049. };
  9050. label.addEventListener(customElementAncestorCheckEventType, listener, { once: true });
  9051. componentEl.dispatchEvent(new CustomEvent(customElementAncestorCheckEventType, { composed: true, bubbles: true }));
  9052. label.removeEventListener(customElementAncestorCheckEventType, listener);
  9053. const ancestorCustomElements = traversedElements
  9054. .filter((el) => el !== componentEl && el !== label)
  9055. .filter((el) => { var _a; return (_a = el.tagName) === null || _a === void 0 ? void 0 : _a.includes("-"); });
  9056. return ancestorCustomElements.length > 0;
  9057. }
  9058. /**
  9059. * Helper to set up label interactions on connectedCallback.
  9060. */
  9061. function connectLabel(component) {
  9062. const labelEl = findLabelForComponent(component.el);
  9063. if (onLabelClickMap.has(labelEl) || (!labelEl && unlabeledComponents.has(component))) {
  9064. return;
  9065. }
  9066. const boundOnLabelDisconnected = onLabelDisconnected.bind(component);
  9067. if (labelEl) {
  9068. component.labelEl = labelEl;
  9069. const boundOnLabelClick = onLabelClick.bind(component);
  9070. onLabelClickMap.set(component.labelEl, boundOnLabelClick);
  9071. component.labelEl.addEventListener(labelClickEvent, boundOnLabelClick);
  9072. unlabeledComponents.delete(component);
  9073. document.removeEventListener(labelConnectedEvent, onLabelConnectedMap.get(component));
  9074. onLabelDisconnectedMap.set(component, boundOnLabelDisconnected);
  9075. document.addEventListener(labelDisconnectedEvent, boundOnLabelDisconnected);
  9076. }
  9077. else if (!unlabeledComponents.has(component)) {
  9078. boundOnLabelDisconnected();
  9079. document.removeEventListener(labelDisconnectedEvent, onLabelDisconnectedMap.get(component));
  9080. }
  9081. }
  9082. /**
  9083. * Helper to tear down label interactions on disconnectedCallback on labelable components.
  9084. */
  9085. function disconnectLabel(component) {
  9086. unlabeledComponents.delete(component);
  9087. document.removeEventListener(labelConnectedEvent, onLabelConnectedMap.get(component));
  9088. document.removeEventListener(labelDisconnectedEvent, onLabelDisconnectedMap.get(component));
  9089. onLabelConnectedMap.delete(component);
  9090. onLabelDisconnectedMap.delete(component);
  9091. if (!component.labelEl) {
  9092. return;
  9093. }
  9094. const boundOnLabelClick = onLabelClickMap.get(component.labelEl);
  9095. component.labelEl.removeEventListener(labelClickEvent, boundOnLabelClick);
  9096. onLabelClickMap.delete(component.labelEl);
  9097. }
  9098. /**
  9099. * Helper to get the label text from a component.
  9100. */
  9101. function getLabelText(component) {
  9102. var _a, _b;
  9103. return component.label || ((_b = (_a = component.labelEl) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || "";
  9104. }
  9105. function onLabelClick(event) {
  9106. if (this.disabled) {
  9107. return;
  9108. }
  9109. const containedLabelableChildClicked = this.el.contains(event.detail.sourceEvent.target);
  9110. if (containedLabelableChildClicked) {
  9111. return;
  9112. }
  9113. this.onLabelClick(event);
  9114. }
  9115. function onLabelConnected() {
  9116. if (unlabeledComponents.has(this)) {
  9117. connectLabel(this);
  9118. }
  9119. }
  9120. function onLabelDisconnected() {
  9121. unlabeledComponents.add(this);
  9122. const boundOnLabelConnected = onLabelConnectedMap.get(this) || onLabelConnected.bind(this);
  9123. onLabelConnectedMap.set(this, boundOnLabelConnected);
  9124. document.addEventListener(labelConnectedEvent, boundOnLabelConnected);
  9125. }
  9126. /**
  9127. * Exported for testing purposes.
  9128. */
  9129. const hiddenFormInputSlotName = "hidden-form-input";
  9130. function isCheckable(component) {
  9131. return "checked" in component;
  9132. }
  9133. const onFormResetMap = new WeakMap();
  9134. const formComponentSet = new WeakSet();
  9135. function hasRegisteredFormComponentParent(form, formComponentEl) {
  9136. // we use events as a way to test for nested form-associated components across shadow bounds
  9137. const formComponentRegisterEventName = "calciteInternalFormComponentRegister";
  9138. let hasRegisteredFormComponentParent = false;
  9139. form.addEventListener(formComponentRegisterEventName, (event) => {
  9140. hasRegisteredFormComponentParent = event
  9141. .composedPath()
  9142. .some((element) => formComponentSet.has(element));
  9143. event.stopPropagation();
  9144. }, { once: true });
  9145. formComponentEl.dispatchEvent(new CustomEvent(formComponentRegisterEventName, {
  9146. bubbles: true,
  9147. composed: true
  9148. }));
  9149. return hasRegisteredFormComponentParent;
  9150. }
  9151. /**
  9152. * Helper to submit a form.
  9153. */
  9154. function submitForm(component) {
  9155. var _a;
  9156. (_a = component.formEl) === null || _a === void 0 ? void 0 : _a.requestSubmit();
  9157. }
  9158. /**
  9159. * Helper to reset a form.
  9160. */
  9161. function resetForm(component) {
  9162. var _a;
  9163. (_a = component.formEl) === null || _a === void 0 ? void 0 : _a.reset();
  9164. }
  9165. /**
  9166. * Helper to set up form interactions on connectedCallback.
  9167. */
  9168. function connectForm(component) {
  9169. const { el, value } = component;
  9170. const form = closestElementCrossShadowBoundary(el, "form");
  9171. if (!form || hasRegisteredFormComponentParent(form, el)) {
  9172. return;
  9173. }
  9174. component.formEl = form;
  9175. component.defaultValue = value;
  9176. if (isCheckable(component)) {
  9177. component.defaultChecked = component.checked;
  9178. }
  9179. const boundOnFormReset = (component.onFormReset || onFormReset).bind(component);
  9180. form.addEventListener("reset", boundOnFormReset);
  9181. onFormResetMap.set(component.el, boundOnFormReset);
  9182. formComponentSet.add(el);
  9183. }
  9184. function onFormReset() {
  9185. if (isCheckable(this)) {
  9186. this.checked = this.defaultChecked;
  9187. return;
  9188. }
  9189. this.value = this.defaultValue;
  9190. }
  9191. /**
  9192. * Helper to tear down form interactions on disconnectedCallback.
  9193. */
  9194. function disconnectForm(component) {
  9195. const { el, formEl } = component;
  9196. if (!formEl) {
  9197. return;
  9198. }
  9199. const boundOnFormReset = onFormResetMap.get(el);
  9200. formEl.removeEventListener("reset", boundOnFormReset);
  9201. onFormResetMap.delete(el);
  9202. component.formEl = null;
  9203. formComponentSet.delete(el);
  9204. }
  9205. /**
  9206. * Helper for setting the default value on initialization after connectedCallback.
  9207. *
  9208. * Note that this is only needed if the default value cannot be determined on connectedCallback.
  9209. */
  9210. function afterConnectDefaultValueSet(component, value) {
  9211. component.defaultValue = value;
  9212. }
  9213. /**
  9214. * Helper for maintaining a form-associated's hidden input in sync with the component.
  9215. *
  9216. * Based on Ionic's approach: https://github.com/ionic-team/ionic-framework/blob/e4bf052794af9aac07f887013b9250d2a045eba3/core/src/utils/helpers.ts#L198
  9217. */
  9218. function syncHiddenFormInput(component) {
  9219. const { el, formEl, name, value } = component;
  9220. const { ownerDocument } = el;
  9221. const inputs = el.querySelectorAll(`input[slot="${hiddenFormInputSlotName}"]`);
  9222. if (!formEl || !name) {
  9223. inputs.forEach((input) => input.remove());
  9224. return;
  9225. }
  9226. const values = Array.isArray(value) ? value : [value];
  9227. const extra = [];
  9228. const seen = new Set();
  9229. inputs.forEach((input) => {
  9230. const valueMatch = values.find((val) =>
  9231. /* intentional non-strict equality check */
  9232. val == input.value);
  9233. if (valueMatch != null) {
  9234. seen.add(valueMatch);
  9235. defaultSyncHiddenFormInput(component, input, valueMatch);
  9236. }
  9237. else {
  9238. extra.push(input);
  9239. }
  9240. });
  9241. let docFrag;
  9242. values.forEach((value) => {
  9243. if (seen.has(value)) {
  9244. return;
  9245. }
  9246. let input = extra.pop();
  9247. if (!input) {
  9248. input = ownerDocument.createElement("input");
  9249. input.slot = hiddenFormInputSlotName;
  9250. }
  9251. if (!docFrag) {
  9252. docFrag = ownerDocument.createDocumentFragment();
  9253. }
  9254. docFrag.append(input);
  9255. defaultSyncHiddenFormInput(component, input, value);
  9256. });
  9257. if (docFrag) {
  9258. el.append(docFrag);
  9259. }
  9260. extra.forEach((input) => input.remove());
  9261. }
  9262. function defaultSyncHiddenFormInput(component, input, value) {
  9263. var _a;
  9264. const { defaultValue, disabled, name, required } = component;
  9265. // keep in sync to prevent losing reset value
  9266. input.defaultValue = defaultValue;
  9267. input.disabled = disabled;
  9268. input.name = name;
  9269. input.required = required;
  9270. input.tabIndex = -1;
  9271. if (isCheckable(component)) {
  9272. // keep in sync to prevent losing reset value
  9273. input.defaultChecked = component.defaultChecked;
  9274. // heuristic to support default/on mode from https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on
  9275. input.value = component.checked ? value || "on" : "";
  9276. // we disable the component when not checked to avoid having its value submitted
  9277. if (!disabled && !component.checked) {
  9278. input.disabled = true;
  9279. }
  9280. }
  9281. else {
  9282. input.value = value || "";
  9283. }
  9284. (_a = component.syncHiddenFormInput) === null || _a === void 0 ? void 0 : _a.call(component, input);
  9285. }
  9286. /**
  9287. * Helper to render the slot for form-associated component's hidden input.
  9288. *
  9289. * If the component has a default slot, this must be placed at the bottom of the component's root container to ensure it is the last child.
  9290. *
  9291. * render(): VNode {
  9292. * <Host>
  9293. * <div class={CSS.container}>
  9294. * // ...
  9295. * <HiddenFormInputSlot component={this} />
  9296. * </div>
  9297. * </Host>
  9298. * }
  9299. *
  9300. * Note that the hidden-form-input Sass mixin must be added to the component's style to apply specific styles.
  9301. */
  9302. const HiddenFormInputSlot = ({ component }) => {
  9303. syncHiddenFormInput(component);
  9304. return hAsync("slot", { name: hiddenFormInputSlotName });
  9305. };
  9306. const buttonCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-button:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-button{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-button{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-button{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-button{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-button{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-button:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-button-h{display:none}/*!@:host*/.sc-calcite-button-h{display:inline-block;width:auto;vertical-align:middle}/*!@:host([round])*/[round].sc-calcite-button-h{border-radius:50px}/*!@:host([round]) a, :host([round]) button*/[round].sc-calcite-button-h a.sc-calcite-button,[round].sc-calcite-button-h button.sc-calcite-button{border-radius:50px}/*!@:host button, :host a*/.sc-calcite-button-h button.sc-calcite-button,.sc-calcite-button-h a.sc-calcite-button{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host button:focus, :host a:focus*/.sc-calcite-button-h button.sc-calcite-button:focus,.sc-calcite-button-h a.sc-calcite-button:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@:host button,\n:host a*/.sc-calcite-button-h button.sc-calcite-button,.sc-calcite-button-h a.sc-calcite-button{--calcite-button-content-margin:0.5rem;--calcite-button-padding-x:7px;--calcite-button-padding-y:3px;padding:var(--calcite-button-padding-y) var(--calcite-button-padding-x) var(--calcite-button-padding-y) var(--calcite-button-padding-x);position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;height:100%;width:100%;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:0px;border-style:none;text-align:center;font-family:inherit;font-weight:var(--calcite-font-weight-normal);-webkit-text-decoration-line:none;text-decoration-line:none;-webkit-transition:color var(--calcite-animation-timing) ease-in-out, background-color var(--calcite-animation-timing) ease-in-out, outline-offset var(--calcite-internal-animation-timing-fast) ease-in-out, outline-color var(--calcite-internal-animation-timing-fast) ease-in-out, -webkit-box-shadow var(--calcite-animation-timing) ease-in-out;transition:color var(--calcite-animation-timing) ease-in-out, background-color var(--calcite-animation-timing) ease-in-out, outline-offset var(--calcite-internal-animation-timing-fast) ease-in-out, outline-color var(--calcite-internal-animation-timing-fast) ease-in-out, -webkit-box-shadow var(--calcite-animation-timing) ease-in-out;transition:color var(--calcite-animation-timing) ease-in-out, background-color var(--calcite-animation-timing) ease-in-out, box-shadow var(--calcite-animation-timing) ease-in-out, outline-offset var(--calcite-internal-animation-timing-fast) ease-in-out, outline-color var(--calcite-internal-animation-timing-fast) ease-in-out;transition:color var(--calcite-animation-timing) ease-in-out, background-color var(--calcite-animation-timing) ease-in-out, box-shadow var(--calcite-animation-timing) ease-in-out, outline-offset var(--calcite-internal-animation-timing-fast) ease-in-out, outline-color var(--calcite-internal-animation-timing-fast) ease-in-out, -webkit-box-shadow var(--calcite-animation-timing) ease-in-out}/*!@:host button:hover, :host a:hover*/.sc-calcite-button-h button.sc-calcite-button:hover,.sc-calcite-button-h a.sc-calcite-button:hover{-webkit-text-decoration-line:none;text-decoration-line:none}/*!@.content*/.content.sc-calcite-button{display:-ms-flexbox;display:flex;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-margin-start:var(--calcite-button-content-margin);margin-inline-start:var(--calcite-button-content-margin);-webkit-margin-end:var(--calcite-button-content-margin);margin-inline-end:var(--calcite-button-content-margin)}/*!@.icon-start-empty .content*/.icon-start-empty.sc-calcite-button .content.sc-calcite-button{-webkit-margin-start:unset;margin-inline-start:unset}/*!@.icon-end-empty .content*/.icon-end-empty.sc-calcite-button .content.sc-calcite-button{-webkit-margin-end:unset;margin-inline-end:unset}/*!@:host([scale=m]) button,\n:host([scale=m]) a*/[scale=m].sc-calcite-button-h button.sc-calcite-button,[scale=m].sc-calcite-button-h a.sc-calcite-button{--calcite-button-content-margin:0.75rem}/*!@:host([scale=l]) button,\n:host([scale=l]) a*/[scale=l].sc-calcite-button-h button.sc-calcite-button,[scale=l].sc-calcite-button-h a.sc-calcite-button{--calcite-button-content-margin:1rem}/*!@:host([width=auto])*/[width=auto].sc-calcite-button-h{width:auto}/*!@:host([width=half])*/[width=half].sc-calcite-button-h{width:50%}/*!@:host([width=full])*/[width=full].sc-calcite-button-h{width:100%}/*!@:host([alignment=center]:not([width=auto])) a, :host([alignment=center]:not([width=auto])) button*/[alignment=center].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=center].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{-ms-flex-pack:center;justify-content:center}/*!@:host([alignment=start]:not([width=auto])) a, :host([alignment=start]:not([width=auto])) button*/[alignment=start].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=start].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{-ms-flex-pack:start;justify-content:flex-start}/*!@:host([alignment=end]:not([width=auto])) a, :host([alignment=end]:not([width=auto])) button*/[alignment=end].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=end].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{-ms-flex-pack:end;justify-content:flex-end}/*!@:host([alignment*=space-between]:not([width=auto])) a, :host([alignment*=space-between]:not([width=auto])) button*/[alignment*=space-between].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment*=space-between].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{-ms-flex-pack:justify;justify-content:space-between}/*!@:host([alignment=icon-start-space-between]:not([width=auto])) .icon--start*/[alignment=icon-start-space-between].sc-calcite-button-h:not([width=auto]) .icon--start.sc-calcite-button{-webkit-margin-end:auto;margin-inline-end:auto}/*!@:host([alignment=icon-start-space-between]:not([width=auto])) a,\n:host([alignment=icon-start-space-between]:not([width=auto])) button*/[alignment=icon-start-space-between].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=icon-start-space-between].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{text-align:unset}/*!@:host([alignment=icon-end-space-between]:not([width=auto])) .icon--end*/[alignment=icon-end-space-between].sc-calcite-button-h:not([width=auto]) .icon--end.sc-calcite-button{-webkit-margin-start:auto;margin-inline-start:auto}/*!@:host([alignment=icon-end-space-between]:not([width=auto])) a,\n:host([alignment=icon-end-space-between]:not([width=auto])) button*/[alignment=icon-end-space-between].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=icon-end-space-between].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{text-align:unset}/*!@:host([alignment=center]) a:not(.content--slotted) .icon--start + .icon--end,\n:host([alignment=center]) button:not(.content--slotted) .icon--start + .icon--end*/[alignment=center].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button+.icon--end.sc-calcite-button,[alignment=center].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button+.icon--end.sc-calcite-button{-webkit-margin-start:var(--calcite-button-content-margin);margin-inline-start:var(--calcite-button-content-margin)}/*!@.icon*/.icon.sc-calcite-button{position:relative;margin:0px;display:-ms-inline-flexbox;display:inline-flex;font-weight:var(--calcite-font-weight-normal);line-height:inherit}/*!@:host([disabled])*/[disabled].sc-calcite-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-button-h[disabled] .sc-calcite-button-s>[calcite-hydrated][disabled],[disabled].sc-calcite-button-h [calcite-hydrated][disabled].sc-calcite-button{opacity:1}/*!@:host([loading])*/[loading].sc-calcite-button-h{pointer-events:none}/*!@:host([loading]) button, :host([loading]) a*/[loading].sc-calcite-button-h button.sc-calcite-button,[loading].sc-calcite-button-h a.sc-calcite-button{pointer-events:none;opacity:var(--calcite-ui-opacity-disabled)}@-webkit-keyframes loader-in{0%{width:0;opacity:0;-webkit-transform:scale(0.5);transform:scale(0.5)}100%{width:1em;opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes loader-in{0%{width:0;opacity:0;-webkit-transform:scale(0.5);transform:scale(0.5)}100%{width:1em;opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes loader-out{0%{width:1em;opacity:1;-webkit-transform:scale(1);transform:scale(1)}100%{width:0;opacity:0;-webkit-transform:scale(0.5);transform:scale(0.5)}}@keyframes loader-out{0%{width:1em;opacity:1;-webkit-transform:scale(1);transform:scale(1)}100%{width:0;opacity:0;-webkit-transform:scale(0.5);transform:scale(0.5)}}/*!@.calcite-button--loader*/.calcite-button--loader.sc-calcite-button{display:-ms-flexbox;display:flex}/*!@.calcite-button--loader calcite-loader*/.calcite-button--loader.sc-calcite-button calcite-loader.sc-calcite-button{margin:0px;-webkit-transition:width var(--calcite-internal-animation-timing-slow) ease-in-out, opacity var(--calcite-internal-animation-timing-slow) ease-in-out, -webkit-transform var(--calcite-internal-animation-timing-slow) ease-in-out;transition:width var(--calcite-internal-animation-timing-slow) ease-in-out, opacity var(--calcite-internal-animation-timing-slow) ease-in-out, -webkit-transform var(--calcite-internal-animation-timing-slow) ease-in-out;transition:width var(--calcite-internal-animation-timing-slow) ease-in-out, opacity var(--calcite-internal-animation-timing-slow) ease-in-out, transform var(--calcite-internal-animation-timing-slow) ease-in-out;transition:width var(--calcite-internal-animation-timing-slow) ease-in-out, opacity var(--calcite-internal-animation-timing-slow) ease-in-out, transform var(--calcite-internal-animation-timing-slow) ease-in-out, -webkit-transform var(--calcite-internal-animation-timing-slow) ease-in-out}/*!@.calcite-button--loader calcite-loader.loading-in*/.calcite-button--loader.sc-calcite-button calcite-loader.loading-in.sc-calcite-button{-webkit-animation-name:loader-in;animation-name:loader-in;-webkit-animation-duration:310ms;animation-duration:310ms}/*!@.calcite-button--loader calcite-loader.loading-out*/.calcite-button--loader.sc-calcite-button calcite-loader.loading-out.sc-calcite-button{-webkit-animation-name:loader-out;animation-name:loader-out;-webkit-animation-duration:310ms;animation-duration:310ms}/*!@:host([loading]) button.content--slotted .calcite-button--loader calcite-loader,\n:host([loading]) a.content--slotted .calcite-button--loader calcite-loader*/[loading].sc-calcite-button-h button.content--slotted.sc-calcite-button .calcite-button--loader.sc-calcite-button calcite-loader.sc-calcite-button,[loading].sc-calcite-button-h a.content--slotted.sc-calcite-button .calcite-button--loader.sc-calcite-button calcite-loader.sc-calcite-button{-webkit-margin-end:var(--calcite-button-content-margin);margin-inline-end:var(--calcite-button-content-margin)}/*!@:host([loading]) button:not(.content--slotted) .icon--start, :host([loading]) button:not(.content--slotted) .icon--end, :host([loading]) a:not(.content--slotted) .icon--start, :host([loading]) a:not(.content--slotted) .icon--end*/[loading].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button,[loading].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted) .icon--end.sc-calcite-button,[loading].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button,[loading].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted) .icon--end.sc-calcite-button{display:none}/*!@:host([appearance=solid]) button, :host([appearance=solid]) a*/[appearance=solid].sc-calcite-button-h button.sc-calcite-button,[appearance=solid].sc-calcite-button-h a.sc-calcite-button{border-width:1px;border-style:solid;border-color:transparent}/*!@:host([appearance=solid][color=blue]) button, :host([appearance=solid][color=blue]) a*/[appearance=solid][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=solid][color=blue].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-inverse)}/*!@:host([appearance=solid][color=blue]) button:hover, :host([appearance=solid][color=blue]) button:focus, :host([appearance=solid][color=blue]) a:hover, :host([appearance=solid][color=blue]) a:focus*/[appearance=solid][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=solid][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=solid][color=blue].sc-calcite-button-h a.sc-calcite-button:hover,[appearance=solid][color=blue].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-brand-hover)}/*!@:host([appearance=solid][color=blue]) button:active, :host([appearance=solid][color=blue]) a:active*/[appearance=solid][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=solid][color=blue].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-brand-press)}/*!@:host([appearance=solid][color=blue]) button calcite-loader, :host([appearance=solid][color=blue]) a calcite-loader*/[appearance=solid][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=solid][color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([appearance=solid][color=red]) button, :host([appearance=solid][color=red]) a*/[appearance=solid][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=solid][color=red].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}/*!@:host([appearance=solid][color=red]) button:hover, :host([appearance=solid][color=red]) button:focus, :host([appearance=solid][color=red]) a:hover, :host([appearance=solid][color=red]) a:focus*/[appearance=solid][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=solid][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=solid][color=red].sc-calcite-button-h a.sc-calcite-button:hover,[appearance=solid][color=red].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-danger-hover)}/*!@:host([appearance=solid][color=red]) button:active, :host([appearance=solid][color=red]) a:active*/[appearance=solid][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=solid][color=red].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-danger-press)}/*!@:host([appearance=solid][color=red]) button calcite-loader, :host([appearance=solid][color=red]) a calcite-loader*/[appearance=solid][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=solid][color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([appearance=solid][color=neutral]) button, :host([appearance=solid][color=neutral]) a*/[appearance=solid][color=neutral].sc-calcite-button-h button.sc-calcite-button,[appearance=solid][color=neutral].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}/*!@:host([appearance=solid][color=neutral]) button:hover, :host([appearance=solid][color=neutral]) button:focus, :host([appearance=solid][color=neutral]) a:hover, :host([appearance=solid][color=neutral]) a:focus*/[appearance=solid][color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=solid][color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=solid][color=neutral].sc-calcite-button-h a.sc-calcite-button:hover,[appearance=solid][color=neutral].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-foreground-2)}/*!@:host([appearance=solid][color=neutral]) button:active, :host([appearance=solid][color=neutral]) a:active*/[appearance=solid][color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[appearance=solid][color=neutral].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-foreground-1)}/*!@:host([appearance=solid][color=neutral]) button calcite-loader, :host([appearance=solid][color=neutral]) a calcite-loader*/[appearance=solid][color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=solid][color=neutral].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=solid][color=inverse]) button, :host([appearance=solid][color=inverse]) a*/[appearance=solid][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=solid][color=inverse].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-text-inverse);background-color:var(--calcite-ui-inverse)}/*!@:host([appearance=solid][color=inverse]) button:hover, :host([appearance=solid][color=inverse]) button:focus,\n:host([appearance=solid][color=inverse]) a:hover,\n:host([appearance=solid][color=inverse]) a:focus*/[appearance=solid][color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=solid][color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=solid][color=inverse].sc-calcite-button-h a.sc-calcite-button:hover,[appearance=solid][color=inverse].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-inverse-hover)}/*!@:host([appearance=solid][color=inverse]) button:active,\n:host([appearance=solid][color=inverse]) a:active*/[appearance=solid][color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[appearance=solid][color=inverse].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-inverse-press)}/*!@:host([appearance=solid][color=inverse]) button calcite-loader, :host([appearance=solid][color=inverse]) a calcite-loader*/[appearance=solid][color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=solid][color=inverse].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([appearance=outline]) button, :host([appearance=outline]) a*/[appearance=outline].sc-calcite-button-h button.sc-calcite-button,[appearance=outline].sc-calcite-button-h a.sc-calcite-button{border-width:1px;border-style:solid;background-color:var(--calcite-ui-foreground-1);-webkit-box-shadow:inset 0 0 0 1px transparent;box-shadow:inset 0 0 0 1px transparent}/*!@:host([appearance=outline][color=blue]) button, :host([appearance=outline][color=blue]) a*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-brand)}/*!@:host([appearance=outline][color=blue]) button:hover, :host([appearance=outline][color=blue]) a:hover*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-brand-hover);color:var(--calcite-ui-brand-hover);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover)}/*!@:host([appearance=outline][color=blue]) button:focus, :host([appearance=outline][color=blue]) a:focus*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-brand);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([appearance=outline][color=blue]) button:active, :host([appearance=outline][color=blue]) a:active*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-brand-press);color:var(--calcite-ui-brand-press);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand-press)}/*!@:host([appearance=outline][color=blue]) button calcite-loader,\n:host([appearance=outline][color=blue]) a calcite-loader*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-brand)}/*!@:host([appearance=outline][color=red]) button, :host([appearance=outline][color=red]) a*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-danger);color:var(--calcite-ui-danger)}/*!@:host([appearance=outline][color=red]) button:hover, :host([appearance=outline][color=red]) a:hover*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-danger-hover);color:var(--calcite-ui-danger-hover);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-danger-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-danger-hover)}/*!@:host([appearance=outline][color=red]) button:focus, :host([appearance=outline][color=red]) a:focus*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-danger);color:var(--calcite-ui-danger);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-danger);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger)}/*!@:host([appearance=outline][color=red]) button:active, :host([appearance=outline][color=red]) a:active*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-danger-press);color:var(--calcite-ui-danger-press);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-danger-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger-press)}/*!@:host([appearance=outline][color=red]) button calcite-loader,\n:host([appearance=outline][color=red]) a calcite-loader*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-danger)}/*!@:host([appearance=outline][color=neutral]) button, :host([appearance=outline][color=neutral]) a*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-text-1);border-color:var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button:hover,\n:host([appearance=outline][color=neutral]) a:hover*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button:hover{-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-foreground-3);box-shadow:inset 0 0 0 1px var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button:focus,\n:host([appearance=outline][color=neutral]) a:focus*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button:focus{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3);box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button:active,\n:host([appearance=outline][color=neutral]) a:active*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button:active{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3);box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button calcite-loader, :host([appearance=outline][color=neutral]) a calcite-loader*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=outline][color=inverse]) button, :host([appearance=outline][color=inverse]) a*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-text-1);border-color:var(--calcite-ui-inverse)}/*!@:host([appearance=outline][color=inverse]) button:hover,\n:host([appearance=outline][color=inverse]) a:hover*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-inverse-hover);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-inverse-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-inverse-hover)}/*!@:host([appearance=outline][color=inverse]) button:focus,\n:host([appearance=outline][color=inverse]) a:focus*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-inverse);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse)}/*!@:host([appearance=outline][color=inverse]) button:active,\n:host([appearance=outline][color=inverse]) a:active*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-inverse-press);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse-press)}/*!@:host([appearance=outline][color=inverse]) button calcite-loader, :host([appearance=outline][color=inverse]) a calcite-loader*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=clear]) button, :host([appearance=clear]) a*/[appearance=clear].sc-calcite-button-h button.sc-calcite-button,[appearance=clear].sc-calcite-button-h a.sc-calcite-button{border-width:1px;border-style:solid;background-color:transparent;-webkit-box-shadow:inset 0 0 0 1px transparent;box-shadow:inset 0 0 0 1px transparent}/*!@:host([appearance=clear][color=blue]) button, :host([appearance=clear][color=blue]) a*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-brand)}/*!@:host([appearance=clear][color=blue]) button:hover, :host([appearance=clear][color=blue]) a:hover*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-brand-hover);color:var(--calcite-ui-brand-hover);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover)}/*!@:host([appearance=clear][color=blue]) button:focus, :host([appearance=clear][color=blue]) a:focus*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-brand);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([appearance=clear][color=blue]) button:active, :host([appearance=clear][color=blue]) a:active*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-brand-press);color:var(--calcite-ui-brand-press);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand-press)}/*!@:host([appearance=clear][color=blue]) button calcite-loader,\n:host([appearance=clear][color=blue]) a calcite-loader*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-brand)}/*!@:host([appearance=clear][color=red]) button, :host([appearance=clear][color=red]) a*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-danger);color:var(--calcite-ui-danger)}/*!@:host([appearance=clear][color=red]) button:hover, :host([appearance=clear][color=red]) a:hover*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-danger-hover);color:var(--calcite-ui-danger-hover);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-danger-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-danger-hover)}/*!@:host([appearance=clear][color=red]) button:focus, :host([appearance=clear][color=red]) a:focus*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-danger);color:var(--calcite-ui-danger);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-danger);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger)}/*!@:host([appearance=clear][color=red]) button:active, :host([appearance=clear][color=red]) a:active*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-danger-press);color:var(--calcite-ui-danger-press);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-danger-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger-press)}/*!@:host([appearance=clear][color=red]) button calcite-loader,\n:host([appearance=clear][color=red]) a calcite-loader*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-danger)}/*!@:host([appearance=clear][color=neutral]) button, :host([appearance=clear][color=neutral]) a*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-text-1);border-color:var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button:hover,\n:host([appearance=clear][color=neutral]) a:hover*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button:hover{-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-foreground-3);box-shadow:inset 0 0 0 1px var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button:focus,\n:host([appearance=clear][color=neutral]) a:focus*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button:focus{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3);box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button:active,\n:host([appearance=clear][color=neutral]) a:active*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button:active{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3);box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button calcite-loader, :host([appearance=clear][color=neutral]) a calcite-loader*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=clear][color=inverse]) button, :host([appearance=clear][color=inverse]) a*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-text-1);border-color:var(--calcite-ui-inverse)}/*!@:host([appearance=clear][color=inverse]) button:hover,\n:host([appearance=clear][color=inverse]) a:hover*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-inverse-hover);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-inverse-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-inverse-hover)}/*!@:host([appearance=clear][color=inverse]) button:focus,\n:host([appearance=clear][color=inverse]) a:focus*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-inverse);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse)}/*!@:host([appearance=clear][color=inverse]) button:active,\n:host([appearance=clear][color=inverse]) a:active*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-inverse-press);-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse-press)}/*!@:host([appearance=clear][color=inverse]) button calcite-loader, :host([appearance=clear][color=inverse]) a calcite-loader*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=outline][split-child=primary]) button,\n:host([appearance=clear][split-child=primary]) button*/[appearance=outline][split-child=primary].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][split-child=primary].sc-calcite-button-h button.sc-calcite-button{border-inline-end-width:0;border-inline-start-width:1px}/*!@:host([appearance=outline][split-child=secondary]) button,\n:host([appearance=clear][split-child=secondary]) button*/[appearance=outline][split-child=secondary].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][split-child=secondary].sc-calcite-button-h button.sc-calcite-button{border-inline-start-width:0;border-inline-end-width:1px}/*!@:host([appearance=transparent]:not(.enable-editing-button)) button, :host([appearance=transparent]:not(.enable-editing-button)) a*/[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) button.sc-calcite-button,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) a.sc-calcite-button{background-color:transparent}/*!@:host([appearance=transparent]:not(.enable-editing-button)) button:hover, :host([appearance=transparent]:not(.enable-editing-button)) button:focus,\n:host([appearance=transparent]:not(.enable-editing-button)) a:hover,\n:host([appearance=transparent]:not(.enable-editing-button)) a:focus*/[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) button.sc-calcite-button:hover,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) button.sc-calcite-button:focus,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) a.sc-calcite-button:hover,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) a.sc-calcite-button:focus{background-color:var(--calcite-button-transparent-hover)}/*!@:host([appearance=transparent]:not(.enable-editing-button)) button:active,\n:host([appearance=transparent]:not(.enable-editing-button)) a:active*/[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) button.sc-calcite-button:active,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) a.sc-calcite-button:active{background-color:var(--calcite-button-transparent-press)}/*!@:host([appearance=transparent][color=blue]) button,\n:host([appearance=transparent][color=blue]) a*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-brand)}/*!@:host([appearance=transparent][color=blue]) button:hover,\n:host([appearance=transparent][color=blue]) a:hover*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button:hover{color:var(--calcite-ui-brand-hover)}/*!@:host([appearance=transparent][color=blue]) button:focus,\n:host([appearance=transparent][color=blue]) a:focus*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button:focus{color:var(--calcite-ui-brand)}/*!@:host([appearance=transparent][color=blue]) button:active,\n:host([appearance=transparent][color=blue]) a:active*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button:active{color:var(--calcite-ui-brand-press)}/*!@:host([appearance=transparent][color=blue]) button calcite-loader,\n:host([appearance=transparent][color=blue]) a calcite-loader*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-brand)}/*!@:host([appearance=transparent][color=red]) button,\n:host([appearance=transparent][color=red]) a*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-danger)}/*!@:host([appearance=transparent][color=red]) button:hover,\n:host([appearance=transparent][color=red]) a:hover*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button:hover{color:var(--calcite-ui-danger-hover)}/*!@:host([appearance=transparent][color=red]) button:focus,\n:host([appearance=transparent][color=red]) a:focus*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button:focus{color:var(--calcite-ui-danger)}/*!@:host([appearance=transparent][color=red]) button:active,\n:host([appearance=transparent][color=red]) a:active*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button:active{color:var(--calcite-ui-danger-press)}/*!@:host([appearance=transparent][color=red]) button calcite-loader,\n:host([appearance=transparent][color=red]) a calcite-loader*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-danger)}/*!@:host([appearance=transparent][color=neutral]:not(.cancel-editing-button)) button, :host([appearance=transparent][color=neutral]:not(.cancel-editing-button)) a, :host([appearance=transparent][color=neutral]:not(.cancel-editing-button)) calcite-loader*/[appearance=transparent][color=neutral].sc-calcite-button-h:not(.cancel-editing-button) button.sc-calcite-button,[appearance=transparent][color=neutral].sc-calcite-button-h:not(.cancel-editing-button) a.sc-calcite-button,[appearance=transparent][color=neutral].sc-calcite-button-h:not(.cancel-editing-button) calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=transparent][color=neutral].cancel-editing-button) button*/[appearance=transparent][color=neutral].cancel-editing-button.sc-calcite-button-h button.sc-calcite-button{border-top-width:1px;border-bottom-width:1px;color:var(--calcite-ui-text-3);border-top-color:var(--calcite-ui-border-input);border-bottom-color:var(--calcite-ui-border-input);border-bottom-style:solid;border-top-style:solid}/*!@:host([appearance=transparent][color=neutral].cancel-editing-button) button:not(.content--slotted)*/[appearance=transparent][color=neutral].cancel-editing-button.sc-calcite-button-h button.sc-calcite-button:not(.content--slotted){--calcite-button-padding-y:0}/*!@:host([appearance=transparent][color=neutral].cancel-editing-button) button:hover*/[appearance=transparent][color=neutral].cancel-editing-button.sc-calcite-button-h button.sc-calcite-button:hover{color:var(--calcite-ui-text-1)}/*!@:host([appearance=transparent][color=neutral].enable-editing-button) button*/[appearance=transparent][color=neutral].enable-editing-button.sc-calcite-button-h button.sc-calcite-button{background-color:transparent}/*!@:host(.confirm-changes-button) button:focus,\n:host(.cancel-editing-button) button:focus,\n:host(.enable-editing-button) button:focus*/.confirm-changes-button.sc-calcite-button-h button.sc-calcite-button:focus,.cancel-editing-button.sc-calcite-button-h button.sc-calcite-button:focus,.enable-editing-button.sc-calcite-button-h button.sc-calcite-button:focus{outline-offset:-2px}/*!@:host([appearance=transparent][color=inverse]) button, :host([appearance=transparent][color=inverse]) a, :host([appearance=transparent][color=inverse]) calcite-loader*/[appearance=transparent][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=transparent][color=inverse].sc-calcite-button-h a.sc-calcite-button,[appearance=transparent][color=inverse].sc-calcite-button-h calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([scale=s]) button.content--slotted, :host([scale=s]) a.content--slotted*/[scale=s].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=s].sc-calcite-button-h a.content--slotted.sc-calcite-button{font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s][appearance=transparent]) button.content--slotted,\n:host([scale=s][appearance=transparent]) a.content--slotted*/[scale=s][appearance=transparent].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=s][appearance=transparent].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:0.5rem;--calcite-button-padding-y:0.25rem}/*!@:host([scale=m]) button.content--slotted,\n:host([scale=m]) a.content--slotted*/[scale=m].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=m].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:11px;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]:not([appearance=transparent])) button.content--slotted,\n:host([scale=m]:not([appearance=transparent])) a.content--slotted*/[scale=m].sc-calcite-button-h:not([appearance=transparent]) button.content--slotted.sc-calcite-button,[scale=m].sc-calcite-button-h:not([appearance=transparent]) a.content--slotted.sc-calcite-button{--calcite-button-padding-y:7px}/*!@:host([scale=m][appearance=transparent]) button.content--slotted,\n:host([scale=m][appearance=transparent]) a.content--slotted*/[scale=m][appearance=transparent].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=m][appearance=transparent].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:0.75rem;--calcite-button-padding-y:0.5rem}/*!@:host([scale=l]) button.content--slotted,\n:host([scale=l]) a.content--slotted*/[scale=l].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=l].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:15px;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]:not([appearance=transparent])) button.content--slotted,\n:host([scale=l]:not([appearance=transparent])) a.content--slotted*/[scale=l].sc-calcite-button-h:not([appearance=transparent]) button.content--slotted.sc-calcite-button,[scale=l].sc-calcite-button-h:not([appearance=transparent]) a.content--slotted.sc-calcite-button{--calcite-button-padding-y:11px}/*!@:host([scale=l][appearance=transparent]) button.content--slotted,\n:host([scale=l][appearance=transparent]) a.content--slotted*/[scale=l][appearance=transparent].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=l][appearance=transparent].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:1rem;--calcite-button-padding-y:0.75rem}/*!@:host([scale=s]) button:not(.content--slotted),\n:host([scale=s]) a:not(.content--slotted)*/[scale=s].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=s].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:0.125rem;--calcite-button-padding-y:3px;width:1.5rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-height:1.5rem}/*!@:host([scale=s][appearance=transparent]) button:not(.content--slotted),\n:host([scale=s][appearance=transparent]) a:not(.content--slotted)*/[scale=s][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=s][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-y:0.25rem}/*!@:host([scale=m]) button:not(.content--slotted),\n:host([scale=m]) a:not(.content--slotted)*/[scale=m].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=m].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:0.125rem;--calcite-button-padding-y:7px;width:2rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-height:2rem}/*!@:host([scale=m][appearance=transparent]) button:not(.content--slotted),\n:host([scale=m][appearance=transparent]) a:not(.content--slotted)*/[scale=m][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=m][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-y:0.5rem}/*!@:host([scale=l]) button:not(.content--slotted),\n:host([scale=l]) a:not(.content--slotted)*/[scale=l].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=l].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:0.125rem;--calcite-button-padding-y:9px;width:2.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-height:2.75rem}/*!@:host([scale=l][appearance=transparent]) button:not(.content--slotted),\n:host([scale=l][appearance=transparent]) a:not(.content--slotted)*/[scale=l][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=l][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-y:0.625rem}/*!@:host([scale=s][icon-start][icon-end]) button:not(.content--slotted),\n:host([scale=s][icon-start][icon-end]) a:not(.content--slotted)*/[scale=s][icon-start][icon-end].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=s][icon-start][icon-end].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:23px;height:1.5rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=s][icon-start][icon-end][appearance=transparent]) button:not(.content--slotted),\n:host([scale=s][icon-start][icon-end][appearance=transparent]) a:not(.content--slotted)*/[scale=s][icon-start][icon-end][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=s][icon-start][icon-end][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:1.5rem}/*!@:host([scale=m][icon-start][icon-end]) button:not(.content--slotted),\n:host([scale=m][icon-start][icon-end]) a:not(.content--slotted)*/[scale=m][icon-start][icon-end].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=m][icon-start][icon-end].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:2rem;height:2rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=m][icon-start][icon-end][appearance=transparent]) button:not(.content--slotted),\n:host([scale=m][icon-start][icon-end][appearance=transparent]) a:not(.content--slotted)*/[scale=m][icon-start][icon-end][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=m][icon-start][icon-end][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:33px}/*!@:host([scale=l][icon-start][icon-end]) button:not(.content--slotted),\n:host([scale=l][icon-start][icon-end]) a:not(.content--slotted)*/[scale=l][icon-start][icon-end].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=l][icon-start][icon-end].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:43px;height:2.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l][icon-start][icon-end]) button:not(.content--slotted) .icon--start + .icon--end,\n:host([scale=l][icon-start][icon-end]) a:not(.content--slotted) .icon--start + .icon--end*/[scale=l][icon-start][icon-end].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button+.icon--end.sc-calcite-button,[scale=l][icon-start][icon-end].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button+.icon--end.sc-calcite-button{-webkit-margin-start:1rem;margin-inline-start:1rem}/*!@:host([scale=l][icon-start][icon-end][appearance=transparent]) button:not(.content--slotted),\n:host([scale=l][icon-start][icon-end][appearance=transparent]) a:not(.content--slotted)*/[scale=l][icon-start][icon-end][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=l][icon-start][icon-end][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:2.75rem}";
  9307. /** Passing a 'href' will render an anchor link, instead of a button. Role will be set to link, or button, depending on this. */
  9308. /** It is the consumers responsibility to add aria information, rel, target, for links, and any button attributes for form submission */
  9309. /** @slot - A slot for adding text. */
  9310. class Button {
  9311. constructor(hostRef) {
  9312. registerInstance(this, hostRef);
  9313. //--------------------------------------------------------------------------
  9314. //
  9315. // Properties
  9316. //
  9317. //--------------------------------------------------------------------------
  9318. /** optionally specify alignment of button elements. */
  9319. this.alignment = "center";
  9320. /** specify the appearance style of the button, defaults to solid. */
  9321. this.appearance = "solid";
  9322. /** specify the color of the button, defaults to blue */
  9323. this.color = "blue";
  9324. /** is the button disabled */
  9325. this.disabled = false;
  9326. /** string to override English loading text
  9327. * @default "Loading"
  9328. */
  9329. this.intlLoading = TEXT$k.loading;
  9330. /** optionally add a calcite-loader component to the button, disabling interaction. */
  9331. this.loading = false;
  9332. /** optionally add a round style to the button */
  9333. this.round = false;
  9334. /** specify the scale of the button, defaults to m */
  9335. this.scale = "m";
  9336. /** is the button a child of a calcite-split-button */
  9337. this.splitChild = false;
  9338. /** The type attribute to apply to the button */
  9339. this.type = "button";
  9340. /** specify the width of the button, defaults to auto */
  9341. this.width = "auto";
  9342. /** watches for changing text content **/
  9343. this.mutationObserver = createObserver();
  9344. /** determine if there is slotted content for styling purposes */
  9345. this.hasContent = false;
  9346. /** determine if loader present for styling purposes */
  9347. this.hasLoader = false;
  9348. // act on a requested or nearby form based on type
  9349. this.handleClick = () => {
  9350. const { type } = this;
  9351. if (this.href) {
  9352. return;
  9353. }
  9354. // this.type refers to type attribute, not child element type
  9355. if (type === "submit") {
  9356. submitForm(this);
  9357. }
  9358. else if (type === "reset") {
  9359. resetForm(this);
  9360. }
  9361. };
  9362. }
  9363. loadingChanged(newValue, oldValue) {
  9364. if (!!newValue && !oldValue) {
  9365. this.hasLoader = true;
  9366. }
  9367. if (!newValue && !!oldValue) {
  9368. window.setTimeout(() => {
  9369. this.hasLoader = false;
  9370. }, 300);
  9371. }
  9372. }
  9373. //--------------------------------------------------------------------------
  9374. //
  9375. // Lifecycle
  9376. //
  9377. //--------------------------------------------------------------------------
  9378. connectedCallback() {
  9379. this.hasLoader = this.loading;
  9380. this.setupTextContentObserver();
  9381. connectLabel(this);
  9382. this.formEl = closestElementCrossShadowBoundary(this.el, this.form ? `#${this.form}` : "form");
  9383. }
  9384. disconnectedCallback() {
  9385. var _a;
  9386. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  9387. disconnectLabel(this);
  9388. this.formEl = null;
  9389. }
  9390. componentWillLoad() {
  9391. }
  9392. componentDidRender() {
  9393. updateHostInteraction(this);
  9394. }
  9395. render() {
  9396. const childElType = this.href ? "a" : "button";
  9397. const Tag = childElType;
  9398. const loaderNode = this.hasLoader ? (hAsync("div", { class: CSS$J.buttonLoader }, hAsync("calcite-loader", { active: true, class: this.loading ? CSS$J.loadingIn : CSS$J.loadingOut, inline: true, label: this.intlLoading, scale: "m" }))) : null;
  9399. const iconStartEl = (hAsync("calcite-icon", { class: { [CSS$J.icon]: true, [CSS$J.iconStart]: true }, flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
  9400. const iconEndEl = (hAsync("calcite-icon", { class: { [CSS$J.icon]: true, [CSS$J.iconEnd]: true }, flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
  9401. const contentEl = (hAsync("span", { class: CSS$J.content }, hAsync("slot", null)));
  9402. return (hAsync(Tag, { "aria-label": getLabelText(this), class: {
  9403. [CSS$J.contentSlotted]: this.hasContent,
  9404. [CSS$J.iconStartEmpty]: !this.iconStart,
  9405. [CSS$J.iconEndEmpty]: !this.iconEnd
  9406. }, disabled: this.disabled || this.loading, href: childElType === "a" && this.href, name: childElType === "button" && this.name, onClick: this.handleClick, ref: (el) => (this.childEl = el), rel: childElType === "a" && this.rel, tabIndex: this.disabled || this.loading ? -1 : null, target: childElType === "a" && this.target, type: childElType === "button" && this.type }, loaderNode, this.iconStart ? iconStartEl : null, this.hasContent ? contentEl : null, this.iconEnd ? iconEndEl : null));
  9407. }
  9408. //--------------------------------------------------------------------------
  9409. //
  9410. // Public Methods
  9411. //
  9412. //--------------------------------------------------------------------------
  9413. /** Sets focus on the component. */
  9414. async setFocus() {
  9415. this.childEl.focus();
  9416. }
  9417. updateHasContent() {
  9418. var _a, _b;
  9419. const slottedContent = this.el.textContent.trim().length > 0 || this.el.childNodes.length > 0;
  9420. this.hasContent =
  9421. this.el.childNodes.length === 1 && ((_a = this.el.childNodes[0]) === null || _a === void 0 ? void 0 : _a.nodeName) === "#text"
  9422. ? ((_b = this.el.textContent) === null || _b === void 0 ? void 0 : _b.trim().length) > 0
  9423. : slottedContent;
  9424. }
  9425. setupTextContentObserver() {
  9426. var _a;
  9427. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  9428. }
  9429. //--------------------------------------------------------------------------
  9430. //
  9431. // Private Methods
  9432. //
  9433. //--------------------------------------------------------------------------
  9434. onLabelClick() {
  9435. this.handleClick();
  9436. this.setFocus();
  9437. }
  9438. get el() { return getElement(this); }
  9439. static get watchers() { return {
  9440. "loading": ["loadingChanged"]
  9441. }; }
  9442. static get style() { return buttonCss; }
  9443. static get cmpMeta() { return {
  9444. "$flags$": 9,
  9445. "$tagName$": "calcite-button",
  9446. "$members$": {
  9447. "alignment": [513],
  9448. "appearance": [513],
  9449. "label": [1],
  9450. "color": [513],
  9451. "disabled": [516],
  9452. "href": [513],
  9453. "iconEnd": [513, "icon-end"],
  9454. "iconFlipRtl": [513, "icon-flip-rtl"],
  9455. "iconStart": [513, "icon-start"],
  9456. "intlLoading": [1, "intl-loading"],
  9457. "loading": [516],
  9458. "name": [1],
  9459. "rel": [1],
  9460. "form": [1],
  9461. "round": [516],
  9462. "scale": [513],
  9463. "splitChild": [520, "split-child"],
  9464. "target": [1],
  9465. "type": [1025],
  9466. "width": [513],
  9467. "hasContent": [32],
  9468. "hasLoader": [32],
  9469. "setFocus": [64]
  9470. },
  9471. "$listeners$": undefined,
  9472. "$lazyBundleId$": "-",
  9473. "$attrsToReflect$": [["alignment", "alignment"], ["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["href", "href"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["loading", "loading"], ["round", "round"], ["scale", "scale"], ["splitChild", "split-child"], ["width", "width"]]
  9474. }; }
  9475. }
  9476. const CSS$I = {
  9477. container: "container",
  9478. header: "header",
  9479. footer: "footer",
  9480. title: "title",
  9481. subtitle: "subtitle",
  9482. thumbnailWrapper: "thumbnail-wrapper",
  9483. checkboxWrapper: "checkbox-wrapper"
  9484. };
  9485. const SLOTS$j = {
  9486. thumbnail: "thumbnail",
  9487. title: "title",
  9488. subtitle: "subtitle",
  9489. footerLeading: "footer-leading",
  9490. footerTrailing: "footer-trailing"
  9491. };
  9492. const TEXT$j = {
  9493. select: "Select",
  9494. deselect: "Deselect",
  9495. loading: "Loading"
  9496. };
  9497. const cardCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-card:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-card{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-card{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-card{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-card{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-card{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-card:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-card-h{display:none}/*!@:host*/.sc-calcite-card-h{display:block;max-width:100%}/*!@:host .calcite-card-container*/.sc-calcite-card-h .calcite-card-container.sc-calcite-card{position:relative;display:-ms-flexbox;display:flex;height:100%;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3);--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);border-radius:var(--calcite-border-radius-base)}/*!@:host .calcite-card-container:hover*/.sc-calcite-card-h .calcite-card-container.sc-calcite-card:hover{--tw-shadow:0 4px 16px 0 rgba(0, 0, 0, 0.08), 0 2px 8px 0 rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 16px 0 var(--tw-shadow-color), 0 2px 8px 0 var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);z-index:1}/*!@:host .calcite-card-container:active*/.sc-calcite-card-h .calcite-card-container.sc-calcite-card:active{--tw-shadow:0 1px 6px -1px rgba(0, 0, 0, 0.16), 0 1px 2px -1px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-transition-duration:75ms;transition-duration:75ms;z-index:1}/*!@.container*/.container.sc-calcite-card{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column}/*!@:host([loading]) .calcite-card-container *:not(calcite-loader):not(.calcite-card-loader-container)*/[loading].sc-calcite-card-h .calcite-card-container.sc-calcite-card *.sc-calcite-card:not(calcite-loader):not(.calcite-card-loader-container){pointer-events:none;opacity:0}/*!@:host([loading]) .calcite-card-loader-container*/[loading].sc-calcite-card-h .calcite-card-loader-container.sc-calcite-card{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}/*!@.header, .footer*/.header.sc-calcite-card,.footer.sc-calcite-card{display:-ms-flexbox;display:flex;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.75rem;padding-bottom:0.25rem}/*!@.header*/.header.sc-calcite-card{-ms-flex-direction:column;flex-direction:column}/*!@.footer*/.footer.sc-calcite-card{margin-top:auto;-ms-flex-direction:row;flex-direction:row;-ms-flex-line-pack:justify;align-content:space-between;-ms-flex-pack:justify;justify-content:space-between;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.75rem}/*!@.card-content*/.card-content.sc-calcite-card{padding:0.75rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-ui-text-3)}/*!@:host([selectable]) .calcite-card-container:active*/[selectable].sc-calcite-card-h .calcite-card-container.sc-calcite-card:active{--tw-shadow:0 1px 6px -1px rgba(0, 0, 0, 0.16), 0 1px 2px -1px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([selected]) .calcite-card-container*/[selected].sc-calcite-card-h .calcite-card-container.sc-calcite-card{border-color:var(--calcite-ui-brand)}/*!@slot[name=title]::slotted(*), *::slotted([slot=title])*/slot[name=title].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=title]{margin:0px;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@slot[name=subtitle]::slotted(*), *::slotted([slot=subtitle])*/slot[name=subtitle].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=subtitle]{margin:0px;margin-top:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2)}/*!@slot[name=thumbnail]::slotted(img), img::slotted([slot=thumbnail])*/slot[name=thumbnail].sc-calcite-card-s>img,img.sc-calcite-card-s>[slot=thumbnail]{min-width:100%;max-width:100%}/*!@slot[name=footer-leading]::slotted(*), *::slotted([slot=footer-leading])*/slot[name=footer-leading].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=footer-leading]{-ms-flex-item-align:center;align-self:center;font-size:var(--calcite-font-size--2);line-height:1.375;-webkit-margin-end:auto;margin-inline-end:auto}/*!@slot[name=footer-trailing]::slotted(*), *::slotted([slot=footer-trailing])*/slot[name=footer-trailing].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=footer-trailing]{-ms-flex-item-align:center;align-self:center;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@.thumbnail-wrapper*/.thumbnail-wrapper.sc-calcite-card{font-size:var(--calcite-font-size-0);line-height:1.375}/*!@.checkbox-wrapper*/.checkbox-wrapper.sc-calcite-card{position:absolute;margin:0px;padding:0px;top:0.5rem;inset-inline-end:0.5rem}";
  9498. /** Cards do not include a grid or bounding container
  9499. * - cards will expand to fit the width of their container
  9500. */
  9501. /**
  9502. * @slot - A slot for adding subheader/description content.
  9503. * @slot thumbnail - A slot for adding a thumbnail to the card.
  9504. * @slot title - A slot for adding a card title.
  9505. * @slot subtitle - A slot for adding a card subtitle or short summary.
  9506. * @slot footer-leading - A slot for adding a leading footer.
  9507. * @slot footer-trailing - A slot for adding a trailing footer.
  9508. */
  9509. class Card {
  9510. constructor(hostRef) {
  9511. registerInstance(this, hostRef);
  9512. this.calciteCardSelect = createEvent(this, "calciteCardSelect", 7);
  9513. //--------------------------------------------------------------------------
  9514. //
  9515. // Public Properties
  9516. //
  9517. //--------------------------------------------------------------------------
  9518. /** When true, the cards content is waiting to be loaded. This state shows a busy indicator.*/
  9519. this.loading = false;
  9520. /** Indicates whether the card is selected. */
  9521. this.selected = false;
  9522. /** Indicates whether the card is selectable. */
  9523. this.selectable = false;
  9524. /** string to override English loading text
  9525. * @default "Loading"
  9526. */
  9527. this.intlLoading = TEXT$j.loading;
  9528. /** string to override English select text for checkbox when selectable is true
  9529. * @default "Select"
  9530. */
  9531. this.intlSelect = TEXT$j.select;
  9532. /** string to override English deselect text for checkbox when selectable is true
  9533. * @default "Deselect"
  9534. */
  9535. this.intlDeselect = TEXT$j.deselect;
  9536. //--------------------------------------------------------------------------
  9537. //
  9538. // Private State/Props
  9539. //
  9540. //--------------------------------------------------------------------------
  9541. //--------------------------------------------------------------------------
  9542. //
  9543. // Private Methods
  9544. //
  9545. //--------------------------------------------------------------------------
  9546. this.cardSelectClick = () => {
  9547. this.selectCard();
  9548. };
  9549. this.cardSelectKeyDown = (e) => {
  9550. switch (e.key) {
  9551. case " ":
  9552. case "Enter":
  9553. this.selectCard();
  9554. e.preventDefault();
  9555. break;
  9556. }
  9557. };
  9558. }
  9559. // --------------------------------------------------------------------------
  9560. //
  9561. // Lifecycle
  9562. //
  9563. // --------------------------------------------------------------------------
  9564. connectedCallback() {
  9565. connectConditionalSlotComponent(this);
  9566. }
  9567. disonnectedCallback() {
  9568. disconnectConditionalSlotComponent(this);
  9569. }
  9570. render() {
  9571. return (hAsync("div", { class: "calcite-card-container" }, this.loading ? (hAsync("div", { class: "calcite-card-loader-container" }, hAsync("calcite-loader", { active: true, label: this.intlLoading }))) : null, hAsync("section", { "aria-busy": toAriaBoolean(this.loading), class: { [CSS$I.container]: true } }, this.selectable ? this.renderCheckbox() : null, this.renderThumbnail(), this.renderHeader(), hAsync("div", { class: "card-content" }, hAsync("slot", null)), this.renderFooter())));
  9572. }
  9573. selectCard() {
  9574. this.selected = !this.selected;
  9575. this.calciteCardSelect.emit();
  9576. }
  9577. renderThumbnail() {
  9578. return getSlotted(this.el, SLOTS$j.thumbnail) ? (hAsync("div", { class: CSS$I.thumbnailWrapper, key: "thumbnail-wrapper" }, hAsync("slot", { name: SLOTS$j.thumbnail }))) : null;
  9579. }
  9580. renderCheckbox() {
  9581. const checkboxLabel = this.selected ? this.intlDeselect : this.intlSelect;
  9582. return (hAsync("calcite-label", { class: CSS$I.checkboxWrapper, onClick: this.cardSelectClick, onKeyDown: this.cardSelectKeyDown }, hAsync("calcite-checkbox", { checked: this.selected, label: checkboxLabel })));
  9583. }
  9584. renderHeader() {
  9585. const { el } = this;
  9586. const title = getSlotted(el, SLOTS$j.title);
  9587. const subtitle = getSlotted(el, SLOTS$j.subtitle);
  9588. const hasHeader = title || subtitle;
  9589. return hasHeader ? (hAsync("header", { class: CSS$I.header }, hAsync("slot", { name: SLOTS$j.title }), hAsync("slot", { name: SLOTS$j.subtitle }))) : null;
  9590. }
  9591. renderFooter() {
  9592. const { el } = this;
  9593. const leadingFooter = getSlotted(el, SLOTS$j.footerLeading);
  9594. const trailingFooter = getSlotted(el, SLOTS$j.footerTrailing);
  9595. const hasFooter = leadingFooter || trailingFooter;
  9596. return hasFooter ? (hAsync("footer", { class: CSS$I.footer }, hAsync("slot", { name: SLOTS$j.footerLeading }), hAsync("slot", { name: SLOTS$j.footerTrailing }))) : null;
  9597. }
  9598. get el() { return getElement(this); }
  9599. static get style() { return cardCss; }
  9600. static get cmpMeta() { return {
  9601. "$flags$": 9,
  9602. "$tagName$": "calcite-card",
  9603. "$members$": {
  9604. "loading": [516],
  9605. "selected": [1540],
  9606. "selectable": [516],
  9607. "intlLoading": [1, "intl-loading"],
  9608. "intlSelect": [1, "intl-select"],
  9609. "intlDeselect": [1, "intl-deselect"]
  9610. },
  9611. "$listeners$": undefined,
  9612. "$lazyBundleId$": "-",
  9613. "$attrsToReflect$": [["loading", "loading"], ["selected", "selected"], ["selectable", "selectable"]]
  9614. }; }
  9615. }
  9616. const checkboxCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-checkbox:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-checkbox{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-checkbox{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-checkbox{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-checkbox{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-checkbox{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-checkbox:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-checkbox-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-checkbox-h{--calcite-checkbox-size:0.75rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-checkbox-h{--calcite-checkbox-size:var(--calcite-font-size--1)}/*!@:host([scale=l])*/[scale=l].sc-calcite-checkbox-h{--calcite-checkbox-size:1rem}/*!@:host*/.sc-calcite-checkbox-h{position:relative;display:-ms-inline-flexbox;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}/*!@:host .check-svg*/.sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox{pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box;display:block;overflow:hidden;background-color:var(--calcite-ui-foreground-1);fill:currentColor;stroke:currentColor;stroke-width:1;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);width:var(--calcite-checkbox-size);height:var(--calcite-checkbox-size);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);color:var(--calcite-ui-background)}/*!@:host([checked]) .check-svg, :host([indeterminate]) .check-svg*/[checked].sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox,[indeterminate].sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox{background-color:var(--calcite-ui-brand);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-brand);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand)}/*!@:host([hovered]) .toggle .check-svg,\n:host .toggle:hover .check-svg*/[hovered].sc-calcite-checkbox-h .toggle.sc-calcite-checkbox .check-svg.sc-calcite-checkbox,.sc-calcite-checkbox-h .toggle.sc-calcite-checkbox:hover .check-svg.sc-calcite-checkbox{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host .toggle:focus .check-svg,\n:host .toggle:active .check-svg*/.sc-calcite-checkbox-h .toggle.sc-calcite-checkbox:focus .check-svg.sc-calcite-checkbox,.sc-calcite-checkbox-h .toggle.sc-calcite-checkbox:active .check-svg.sc-calcite-checkbox{-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);-webkit-transition:var(--calcite-animation-timing);transition:var(--calcite-animation-timing)}/*!@.toggle:focus-visible*/.toggle.sc-calcite-checkbox:focus-visible{outline:none}/*!@:host([disabled])*/[disabled].sc-calcite-checkbox-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-checkbox-h[disabled] .sc-calcite-checkbox-s>[calcite-hydrated][disabled],[disabled].sc-calcite-checkbox-h [calcite-hydrated][disabled].sc-calcite-checkbox{opacity:1}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-checkbox-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  9617. class Checkbox {
  9618. constructor(hostRef) {
  9619. registerInstance(this, hostRef);
  9620. this.calciteInternalCheckboxBlur = createEvent(this, "calciteInternalCheckboxBlur", 7);
  9621. this.calciteCheckboxChange = createEvent(this, "calciteCheckboxChange", 7);
  9622. this.calciteInternalCheckboxFocus = createEvent(this, "calciteInternalCheckboxFocus", 7);
  9623. //--------------------------------------------------------------------------
  9624. //
  9625. // Properties
  9626. //
  9627. //--------------------------------------------------------------------------
  9628. /** The checked state of the checkbox. */
  9629. this.checked = false;
  9630. /** True if the checkbox is disabled */
  9631. this.disabled = false;
  9632. /**
  9633. * The hovered state of the checkbox.
  9634. * @internal
  9635. */
  9636. this.hovered = false;
  9637. /**
  9638. * True if the checkbox is initially indeterminate,
  9639. * which is independent from its checked state
  9640. * https://css-tricks.com/indeterminate-checkboxes/
  9641. * */
  9642. this.indeterminate = false;
  9643. /**
  9644. * When true, makes the component required for form-submission.
  9645. *
  9646. * @internal
  9647. */
  9648. this.required = false;
  9649. /** specify the scale of the checkbox, defaults to m */
  9650. this.scale = "m";
  9651. //--------------------------------------------------------------------------
  9652. //
  9653. // Private Properties
  9654. //
  9655. //--------------------------------------------------------------------------
  9656. this.checkedPath = "M5.5 12L2 8.689l.637-.636L5.5 10.727l8.022-7.87.637.637z";
  9657. this.indeterminatePath = "M13 8v1H3V8z";
  9658. //--------------------------------------------------------------------------
  9659. //
  9660. // Private Methods
  9661. //
  9662. //--------------------------------------------------------------------------
  9663. this.getPath = () => this.indeterminate ? this.indeterminatePath : this.checked ? this.checkedPath : "";
  9664. this.toggle = () => {
  9665. if (!this.disabled) {
  9666. this.checked = !this.checked;
  9667. this.setFocus();
  9668. this.indeterminate = false;
  9669. this.calciteCheckboxChange.emit();
  9670. }
  9671. };
  9672. this.keyDownHandler = (event) => {
  9673. if (event.key === " " || event.key === "Enter") {
  9674. this.toggle();
  9675. event.preventDefault();
  9676. }
  9677. };
  9678. this.clickHandler = () => {
  9679. this.toggle();
  9680. };
  9681. //--------------------------------------------------------------------------
  9682. //
  9683. // Event Listeners
  9684. //
  9685. //--------------------------------------------------------------------------
  9686. this.onToggleBlur = () => {
  9687. this.calciteInternalCheckboxBlur.emit(false);
  9688. };
  9689. this.onToggleFocus = () => {
  9690. this.calciteInternalCheckboxFocus.emit(true);
  9691. };
  9692. this.onLabelClick = () => {
  9693. this.toggle();
  9694. };
  9695. }
  9696. //--------------------------------------------------------------------------
  9697. //
  9698. // Public Methods
  9699. //
  9700. //--------------------------------------------------------------------------
  9701. /** Sets focus on the component. */
  9702. async setFocus() {
  9703. var _a;
  9704. (_a = this.toggleEl) === null || _a === void 0 ? void 0 : _a.focus();
  9705. }
  9706. //--------------------------------------------------------------------------
  9707. //
  9708. // Lifecycle
  9709. //
  9710. //--------------------------------------------------------------------------
  9711. connectedCallback() {
  9712. this.guid = this.el.id || `calcite-checkbox-${guid()}`;
  9713. connectLabel(this);
  9714. connectForm(this);
  9715. }
  9716. disconnectedCallback() {
  9717. disconnectLabel(this);
  9718. disconnectForm(this);
  9719. }
  9720. componentDidRender() {
  9721. updateHostInteraction(this);
  9722. }
  9723. // --------------------------------------------------------------------------
  9724. //
  9725. // Render Methods
  9726. //
  9727. // --------------------------------------------------------------------------
  9728. render() {
  9729. return (hAsync(Host, { onClick: this.clickHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { "aria-checked": toAriaBoolean(this.checked), "aria-label": getLabelText(this), class: "toggle", onBlur: this.onToggleBlur, onFocus: this.onToggleFocus, ref: (toggleEl) => (this.toggleEl = toggleEl), role: "checkbox", tabIndex: this.disabled ? undefined : 0 }, hAsync("svg", { class: "check-svg", viewBox: "0 0 16 16" }, hAsync("path", { d: this.getPath() })), hAsync("slot", null)), hAsync(HiddenFormInputSlot, { component: this })));
  9730. }
  9731. get el() { return getElement(this); }
  9732. static get style() { return checkboxCss; }
  9733. static get cmpMeta() { return {
  9734. "$flags$": 9,
  9735. "$tagName$": "calcite-checkbox",
  9736. "$members$": {
  9737. "checked": [1540],
  9738. "disabled": [516],
  9739. "guid": [1537],
  9740. "hovered": [1540],
  9741. "indeterminate": [1540],
  9742. "label": [1],
  9743. "name": [520],
  9744. "required": [516],
  9745. "scale": [513],
  9746. "value": [8],
  9747. "setFocus": [64]
  9748. },
  9749. "$listeners$": undefined,
  9750. "$lazyBundleId$": "-",
  9751. "$attrsToReflect$": [["checked", "checked"], ["disabled", "disabled"], ["guid", "guid"], ["hovered", "hovered"], ["indeterminate", "indeterminate"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
  9752. }; }
  9753. }
  9754. const CSS$H = {
  9755. title: "title",
  9756. close: "close",
  9757. imageContainer: "image-container",
  9758. chipIcon: "chip-icon",
  9759. closeIcon: "close-icon"
  9760. };
  9761. const TEXT$i = {
  9762. close: "Close"
  9763. };
  9764. const SLOTS$i = {
  9765. image: "image"
  9766. };
  9767. const ICONS$a = {
  9768. close: "x"
  9769. };
  9770. const chipCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-chip:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-chip{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-chip{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-chip{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-chip{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-chip{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-chip:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-chip-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-chip-h{height:1.5rem;font-size:var(--calcite-font-size--2);--calcite-chip-spacing-unit-l:0.5rem;--calcite-chip-spacing-unit-s:0.25rem}/*!@:host([scale=s]) .image-container*/[scale=s].sc-calcite-chip-h .image-container.sc-calcite-chip{height:1.25rem;width:1.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-chip-h{height:2rem;font-size:var(--calcite-font-size--1);--calcite-chip-spacing-unit-l:0.75rem;--calcite-chip-spacing-unit-s:6px}/*!@:host([scale=m]) .image-container*/[scale=m].sc-calcite-chip-h .image-container.sc-calcite-chip{height:1.5rem;width:1.5rem;-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-chip-h{height:2.75rem;font-size:var(--calcite-font-size-0);--calcite-chip-spacing-unit-l:1rem;--calcite-chip-spacing-unit-s:0.5rem}/*!@:host([scale=l]) .image-container*/[scale=l].sc-calcite-chip-h .image-container.sc-calcite-chip{height:2rem;width:2rem;padding-left:0.25rem}/*!@:host*/.sc-calcite-chip-h{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-inline-flexbox;display:inline-flex;cursor:default;-ms-flex-align:center;align-items:center;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@.container*/.container.sc-calcite-chip{display:-ms-inline-flexbox;display:inline-flex;height:100%;max-width:100%;-ms-flex-align:center;align-items:center}/*!@.title*/.title.sc-calcite-chip{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}/*!@:host span*/.sc-calcite-chip-h span.sc-calcite-chip{padding:0 var(--calcite-chip-spacing-unit-l)}/*!@:host([dismissible]) span*/[dismissible].sc-calcite-chip-h span.sc-calcite-chip{padding-inline:var(--calcite-chip-spacing-unit-l) var(--calcite-chip-spacing-unit-s)}/*!@:host([icon]:not([dismissible])) span*/[icon].sc-calcite-chip-h:not([dismissible]) span.sc-calcite-chip{padding:0 var(--calcite-chip-spacing-unit-l)}/*!@:host button*/.sc-calcite-chip-h button.sc-calcite-chip{margin:0px;display:-ms-inline-flexbox;display:inline-flex;max-height:100%;min-height:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-item-align:stretch;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;-webkit-appearance:none;border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0;padding:0 var(--calcite-chip-spacing-unit-s);color:inherit;--calcite-chip-transparent-hover:var(--calcite-button-transparent-hover);--calcite-chip-transparent-press:var(--calcite-button-transparent-press)}/*!@:host button:hover*/.sc-calcite-chip-h button.sc-calcite-chip:hover{background-color:var(--calcite-chip-transparent-hover)}/*!@:host button:focus*/.sc-calcite-chip-h button.sc-calcite-chip:focus{background-color:var(--calcite-chip-transparent-hover);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host button:active*/.sc-calcite-chip-h button.sc-calcite-chip:active{background-color:var(--calcite-chip-transparent-press)}/*!@.image-container*/.image-container.sc-calcite-chip{display:-ms-inline-flexbox;display:inline-flex;overflow:hidden;border-radius:50%}/*!@:host slot[name=image]::slotted(*)*/.sc-calcite-chip-h slot[name=image].sc-calcite-chip-s>*{display:-ms-flexbox;display:flex;height:100%;width:100%;overflow:hidden;border-radius:50%}/*!@.chip-icon*/.chip-icon.sc-calcite-chip{position:relative;margin-top:0px;margin-bottom:0px;display:-ms-inline-flexbox;display:inline-flex;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-margin-end:0;margin-inline-end:0;-webkit-margin-start:var(--calcite-chip-spacing-unit-l);margin-inline-start:var(--calcite-chip-spacing-unit-l);border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0}/*!@:host([color=blue][appearance=solid])*/[color=blue][appearance=solid].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-info);color:var(--calcite-ui-text-inverse)}/*!@:host([color=red][appearance=solid])*/[color=red][appearance=solid].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}/*!@:host([color=yellow][appearance=solid])*/[color=yellow][appearance=solid].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-warning);color:#151515}/*!@:host([color=green][appearance=solid])*/[color=green][appearance=solid].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-success);color:#151515}/*!@:host([color=grey][appearance=solid])*/[color=grey][appearance=solid].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@:host([color=grey][appearance=solid]) button,\n:host([color=grey][appearance=solid]) .close-icon*/[color=grey][appearance=solid].sc-calcite-chip-h button.sc-calcite-chip,[color=grey][appearance=solid].sc-calcite-chip-h .close-icon.sc-calcite-chip{color:var(--calcite-ui-text-3)}/*!@:host([color=grey][appearance=solid]) .chip-icon*/[color=grey][appearance=solid].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}/*!@:host([color=blue][appearance=clear])*/[color=blue][appearance=clear].sc-calcite-chip-h{border-color:var(--calcite-ui-info)}/*!@:host([color=blue][appearance=clear]) .chip-icon*/[color=blue][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-info))}/*!@:host([color=red][appearance=clear])*/[color=red][appearance=clear].sc-calcite-chip-h{border-color:var(--calcite-ui-danger)}/*!@:host([color=red][appearance=clear]) .chip-icon*/[color=red][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-danger))}/*!@:host([color=yellow][appearance=clear])*/[color=yellow][appearance=clear].sc-calcite-chip-h{border-color:var(--calcite-ui-warning)}/*!@:host([color=yellow][appearance=clear]) .chip-icon*/[color=yellow][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-warning))}/*!@:host([color=green][appearance=clear])*/[color=green][appearance=clear].sc-calcite-chip-h{border-color:var(--calcite-ui-success)}/*!@:host([color=green][appearance=clear]) .chip-icon*/[color=green][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-success))}/*!@:host([color=grey][appearance=clear])*/[color=grey][appearance=clear].sc-calcite-chip-h{border-color:var(--calcite-ui-border-1)}/*!@:host([color=grey][appearance=clear]) .chip-icon*/[color=grey][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}";
  9771. /**
  9772. * @slot - A slot for adding text.
  9773. * @slot image - A slot for adding an image.
  9774. */
  9775. class Chip {
  9776. constructor(hostRef) {
  9777. registerInstance(this, hostRef);
  9778. this.calciteChipDismiss = createEvent(this, "calciteChipDismiss", 7);
  9779. //--------------------------------------------------------------------------
  9780. //
  9781. // Public Properties
  9782. //
  9783. //--------------------------------------------------------------------------
  9784. /** specify the appearance style of the button, defaults to solid. */
  9785. this.appearance = "solid";
  9786. /** specify the color of the button, defaults to blue */
  9787. this.color = "grey";
  9788. /** Optionally show a button the user can click to dismiss the chip */
  9789. this.dismissible = false;
  9790. /** Aria label for the "x" button
  9791. * @default "Close"
  9792. */
  9793. this.dismissLabel = TEXT$i.close;
  9794. /** flip the icon in rtl */
  9795. this.iconFlipRtl = false;
  9796. /** specify the scale of the chip, defaults to m */
  9797. this.scale = "m";
  9798. // --------------------------------------------------------------------------
  9799. //
  9800. // Private Methods
  9801. //
  9802. // --------------------------------------------------------------------------
  9803. this.closeClickHandler = (event) => {
  9804. event.preventDefault();
  9805. this.calciteChipDismiss.emit(this.el);
  9806. };
  9807. this.guid = guid();
  9808. }
  9809. // --------------------------------------------------------------------------
  9810. //
  9811. // Lifecycle
  9812. //
  9813. // --------------------------------------------------------------------------
  9814. connectedCallback() {
  9815. connectConditionalSlotComponent(this);
  9816. }
  9817. disconnectedCallback() {
  9818. disconnectConditionalSlotComponent(this);
  9819. }
  9820. //--------------------------------------------------------------------------
  9821. //
  9822. // Public Methods
  9823. //
  9824. //--------------------------------------------------------------------------
  9825. /** Sets focus on the component. */
  9826. async setFocus() {
  9827. var _a;
  9828. (_a = this.closeButton) === null || _a === void 0 ? void 0 : _a.focus();
  9829. }
  9830. //--------------------------------------------------------------------------
  9831. //
  9832. // Render Methods
  9833. //
  9834. //--------------------------------------------------------------------------
  9835. renderChipImage() {
  9836. const { el } = this;
  9837. const hasChipImage = getSlotted(el, SLOTS$i.image);
  9838. return hasChipImage ? (hAsync("div", { class: CSS$H.imageContainer, key: "image" }, hAsync("slot", { name: SLOTS$i.image }))) : null;
  9839. }
  9840. render() {
  9841. const iconEl = (hAsync("calcite-icon", { class: CSS$H.chipIcon, flipRtl: this.iconFlipRtl, icon: this.icon, scale: "s" }));
  9842. const closeButton = (hAsync("button", { "aria-describedby": this.guid, "aria-label": this.dismissLabel, class: CSS$H.close, onClick: this.closeClickHandler, ref: (el) => (this.closeButton = el) }, hAsync("calcite-icon", { class: CSS$H.closeIcon, icon: ICONS$a.close, scale: "s" })));
  9843. return (hAsync("div", { class: "container" }, this.renderChipImage(), this.icon ? iconEl : null, hAsync("span", { class: CSS$H.title, id: this.guid }, hAsync("slot", null)), this.dismissible ? closeButton : null));
  9844. }
  9845. get el() { return getElement(this); }
  9846. static get style() { return chipCss; }
  9847. static get cmpMeta() { return {
  9848. "$flags$": 9,
  9849. "$tagName$": "calcite-chip",
  9850. "$members$": {
  9851. "appearance": [513],
  9852. "color": [513],
  9853. "dismissible": [516],
  9854. "dismissLabel": [1, "dismiss-label"],
  9855. "icon": [513],
  9856. "iconFlipRtl": [516, "icon-flip-rtl"],
  9857. "scale": [513],
  9858. "value": [8],
  9859. "setFocus": [64]
  9860. },
  9861. "$listeners$": undefined,
  9862. "$lazyBundleId$": "-",
  9863. "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["dismissible", "dismissible"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["scale", "scale"]]
  9864. }; }
  9865. }
  9866. function createCommonjsModule(fn, basedir, module) {
  9867. return module = {
  9868. path: basedir,
  9869. exports: {},
  9870. require: function (path, base) {
  9871. return commonjsRequire();
  9872. }
  9873. }, fn(module, module.exports), module.exports;
  9874. }
  9875. function commonjsRequire () {
  9876. throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
  9877. }
  9878. var colorName$1 = {
  9879. "aliceblue": [240, 248, 255],
  9880. "antiquewhite": [250, 235, 215],
  9881. "aqua": [0, 255, 255],
  9882. "aquamarine": [127, 255, 212],
  9883. "azure": [240, 255, 255],
  9884. "beige": [245, 245, 220],
  9885. "bisque": [255, 228, 196],
  9886. "black": [0, 0, 0],
  9887. "blanchedalmond": [255, 235, 205],
  9888. "blue": [0, 0, 255],
  9889. "blueviolet": [138, 43, 226],
  9890. "brown": [165, 42, 42],
  9891. "burlywood": [222, 184, 135],
  9892. "cadetblue": [95, 158, 160],
  9893. "chartreuse": [127, 255, 0],
  9894. "chocolate": [210, 105, 30],
  9895. "coral": [255, 127, 80],
  9896. "cornflowerblue": [100, 149, 237],
  9897. "cornsilk": [255, 248, 220],
  9898. "crimson": [220, 20, 60],
  9899. "cyan": [0, 255, 255],
  9900. "darkblue": [0, 0, 139],
  9901. "darkcyan": [0, 139, 139],
  9902. "darkgoldenrod": [184, 134, 11],
  9903. "darkgray": [169, 169, 169],
  9904. "darkgreen": [0, 100, 0],
  9905. "darkgrey": [169, 169, 169],
  9906. "darkkhaki": [189, 183, 107],
  9907. "darkmagenta": [139, 0, 139],
  9908. "darkolivegreen": [85, 107, 47],
  9909. "darkorange": [255, 140, 0],
  9910. "darkorchid": [153, 50, 204],
  9911. "darkred": [139, 0, 0],
  9912. "darksalmon": [233, 150, 122],
  9913. "darkseagreen": [143, 188, 143],
  9914. "darkslateblue": [72, 61, 139],
  9915. "darkslategray": [47, 79, 79],
  9916. "darkslategrey": [47, 79, 79],
  9917. "darkturquoise": [0, 206, 209],
  9918. "darkviolet": [148, 0, 211],
  9919. "deeppink": [255, 20, 147],
  9920. "deepskyblue": [0, 191, 255],
  9921. "dimgray": [105, 105, 105],
  9922. "dimgrey": [105, 105, 105],
  9923. "dodgerblue": [30, 144, 255],
  9924. "firebrick": [178, 34, 34],
  9925. "floralwhite": [255, 250, 240],
  9926. "forestgreen": [34, 139, 34],
  9927. "fuchsia": [255, 0, 255],
  9928. "gainsboro": [220, 220, 220],
  9929. "ghostwhite": [248, 248, 255],
  9930. "gold": [255, 215, 0],
  9931. "goldenrod": [218, 165, 32],
  9932. "gray": [128, 128, 128],
  9933. "green": [0, 128, 0],
  9934. "greenyellow": [173, 255, 47],
  9935. "grey": [128, 128, 128],
  9936. "honeydew": [240, 255, 240],
  9937. "hotpink": [255, 105, 180],
  9938. "indianred": [205, 92, 92],
  9939. "indigo": [75, 0, 130],
  9940. "ivory": [255, 255, 240],
  9941. "khaki": [240, 230, 140],
  9942. "lavender": [230, 230, 250],
  9943. "lavenderblush": [255, 240, 245],
  9944. "lawngreen": [124, 252, 0],
  9945. "lemonchiffon": [255, 250, 205],
  9946. "lightblue": [173, 216, 230],
  9947. "lightcoral": [240, 128, 128],
  9948. "lightcyan": [224, 255, 255],
  9949. "lightgoldenrodyellow": [250, 250, 210],
  9950. "lightgray": [211, 211, 211],
  9951. "lightgreen": [144, 238, 144],
  9952. "lightgrey": [211, 211, 211],
  9953. "lightpink": [255, 182, 193],
  9954. "lightsalmon": [255, 160, 122],
  9955. "lightseagreen": [32, 178, 170],
  9956. "lightskyblue": [135, 206, 250],
  9957. "lightslategray": [119, 136, 153],
  9958. "lightslategrey": [119, 136, 153],
  9959. "lightsteelblue": [176, 196, 222],
  9960. "lightyellow": [255, 255, 224],
  9961. "lime": [0, 255, 0],
  9962. "limegreen": [50, 205, 50],
  9963. "linen": [250, 240, 230],
  9964. "magenta": [255, 0, 255],
  9965. "maroon": [128, 0, 0],
  9966. "mediumaquamarine": [102, 205, 170],
  9967. "mediumblue": [0, 0, 205],
  9968. "mediumorchid": [186, 85, 211],
  9969. "mediumpurple": [147, 112, 219],
  9970. "mediumseagreen": [60, 179, 113],
  9971. "mediumslateblue": [123, 104, 238],
  9972. "mediumspringgreen": [0, 250, 154],
  9973. "mediumturquoise": [72, 209, 204],
  9974. "mediumvioletred": [199, 21, 133],
  9975. "midnightblue": [25, 25, 112],
  9976. "mintcream": [245, 255, 250],
  9977. "mistyrose": [255, 228, 225],
  9978. "moccasin": [255, 228, 181],
  9979. "navajowhite": [255, 222, 173],
  9980. "navy": [0, 0, 128],
  9981. "oldlace": [253, 245, 230],
  9982. "olive": [128, 128, 0],
  9983. "olivedrab": [107, 142, 35],
  9984. "orange": [255, 165, 0],
  9985. "orangered": [255, 69, 0],
  9986. "orchid": [218, 112, 214],
  9987. "palegoldenrod": [238, 232, 170],
  9988. "palegreen": [152, 251, 152],
  9989. "paleturquoise": [175, 238, 238],
  9990. "palevioletred": [219, 112, 147],
  9991. "papayawhip": [255, 239, 213],
  9992. "peachpuff": [255, 218, 185],
  9993. "peru": [205, 133, 63],
  9994. "pink": [255, 192, 203],
  9995. "plum": [221, 160, 221],
  9996. "powderblue": [176, 224, 230],
  9997. "purple": [128, 0, 128],
  9998. "rebeccapurple": [102, 51, 153],
  9999. "red": [255, 0, 0],
  10000. "rosybrown": [188, 143, 143],
  10001. "royalblue": [65, 105, 225],
  10002. "saddlebrown": [139, 69, 19],
  10003. "salmon": [250, 128, 114],
  10004. "sandybrown": [244, 164, 96],
  10005. "seagreen": [46, 139, 87],
  10006. "seashell": [255, 245, 238],
  10007. "sienna": [160, 82, 45],
  10008. "silver": [192, 192, 192],
  10009. "skyblue": [135, 206, 235],
  10010. "slateblue": [106, 90, 205],
  10011. "slategray": [112, 128, 144],
  10012. "slategrey": [112, 128, 144],
  10013. "snow": [255, 250, 250],
  10014. "springgreen": [0, 255, 127],
  10015. "steelblue": [70, 130, 180],
  10016. "tan": [210, 180, 140],
  10017. "teal": [0, 128, 128],
  10018. "thistle": [216, 191, 216],
  10019. "tomato": [255, 99, 71],
  10020. "turquoise": [64, 224, 208],
  10021. "violet": [238, 130, 238],
  10022. "wheat": [245, 222, 179],
  10023. "white": [255, 255, 255],
  10024. "whitesmoke": [245, 245, 245],
  10025. "yellow": [255, 255, 0],
  10026. "yellowgreen": [154, 205, 50]
  10027. };
  10028. var isArrayish = function isArrayish(obj) {
  10029. if (!obj || typeof obj === 'string') {
  10030. return false;
  10031. }
  10032. return obj instanceof Array || Array.isArray(obj) ||
  10033. (obj.length >= 0 && (obj.splice instanceof Function ||
  10034. (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
  10035. };
  10036. var simpleSwizzle = createCommonjsModule(function (module) {
  10037. var concat = Array.prototype.concat;
  10038. var slice = Array.prototype.slice;
  10039. var swizzle = module.exports = function swizzle(args) {
  10040. var results = [];
  10041. for (var i = 0, len = args.length; i < len; i++) {
  10042. var arg = args[i];
  10043. if (isArrayish(arg)) {
  10044. // http://jsperf.com/javascript-array-concat-vs-push/98
  10045. results = concat.call(results, slice.call(arg));
  10046. } else {
  10047. results.push(arg);
  10048. }
  10049. }
  10050. return results;
  10051. };
  10052. swizzle.wrap = function (fn) {
  10053. return function () {
  10054. return fn(swizzle(arguments));
  10055. };
  10056. };
  10057. });
  10058. var colorString = createCommonjsModule(function (module) {
  10059. /* MIT license */
  10060. var hasOwnProperty = Object.hasOwnProperty;
  10061. var reverseNames = {};
  10062. // create a list of reverse color names
  10063. for (var name in colorName$1) {
  10064. if (hasOwnProperty.call(colorName$1, name)) {
  10065. reverseNames[colorName$1[name]] = name;
  10066. }
  10067. }
  10068. var cs = module.exports = {
  10069. to: {},
  10070. get: {}
  10071. };
  10072. cs.get = function (string) {
  10073. var prefix = string.substring(0, 3).toLowerCase();
  10074. var val;
  10075. var model;
  10076. switch (prefix) {
  10077. case 'hsl':
  10078. val = cs.get.hsl(string);
  10079. model = 'hsl';
  10080. break;
  10081. case 'hwb':
  10082. val = cs.get.hwb(string);
  10083. model = 'hwb';
  10084. break;
  10085. default:
  10086. val = cs.get.rgb(string);
  10087. model = 'rgb';
  10088. break;
  10089. }
  10090. if (!val) {
  10091. return null;
  10092. }
  10093. return {model: model, value: val};
  10094. };
  10095. cs.get.rgb = function (string) {
  10096. if (!string) {
  10097. return null;
  10098. }
  10099. var abbr = /^#([a-f0-9]{3,4})$/i;
  10100. var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
  10101. var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
  10102. var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
  10103. var keyword = /^(\w+)$/;
  10104. var rgb = [0, 0, 0, 1];
  10105. var match;
  10106. var i;
  10107. var hexAlpha;
  10108. if (match = string.match(hex)) {
  10109. hexAlpha = match[2];
  10110. match = match[1];
  10111. for (i = 0; i < 3; i++) {
  10112. // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
  10113. var i2 = i * 2;
  10114. rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
  10115. }
  10116. if (hexAlpha) {
  10117. rgb[3] = parseInt(hexAlpha, 16) / 255;
  10118. }
  10119. } else if (match = string.match(abbr)) {
  10120. match = match[1];
  10121. hexAlpha = match[3];
  10122. for (i = 0; i < 3; i++) {
  10123. rgb[i] = parseInt(match[i] + match[i], 16);
  10124. }
  10125. if (hexAlpha) {
  10126. rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
  10127. }
  10128. } else if (match = string.match(rgba)) {
  10129. for (i = 0; i < 3; i++) {
  10130. rgb[i] = parseInt(match[i + 1], 0);
  10131. }
  10132. if (match[4]) {
  10133. if (match[5]) {
  10134. rgb[3] = parseFloat(match[4]) * 0.01;
  10135. } else {
  10136. rgb[3] = parseFloat(match[4]);
  10137. }
  10138. }
  10139. } else if (match = string.match(per)) {
  10140. for (i = 0; i < 3; i++) {
  10141. rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
  10142. }
  10143. if (match[4]) {
  10144. if (match[5]) {
  10145. rgb[3] = parseFloat(match[4]) * 0.01;
  10146. } else {
  10147. rgb[3] = parseFloat(match[4]);
  10148. }
  10149. }
  10150. } else if (match = string.match(keyword)) {
  10151. if (match[1] === 'transparent') {
  10152. return [0, 0, 0, 0];
  10153. }
  10154. if (!hasOwnProperty.call(colorName$1, match[1])) {
  10155. return null;
  10156. }
  10157. rgb = colorName$1[match[1]];
  10158. rgb[3] = 1;
  10159. return rgb;
  10160. } else {
  10161. return null;
  10162. }
  10163. for (i = 0; i < 3; i++) {
  10164. rgb[i] = clamp(rgb[i], 0, 255);
  10165. }
  10166. rgb[3] = clamp(rgb[3], 0, 1);
  10167. return rgb;
  10168. };
  10169. cs.get.hsl = function (string) {
  10170. if (!string) {
  10171. return null;
  10172. }
  10173. var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
  10174. var match = string.match(hsl);
  10175. if (match) {
  10176. var alpha = parseFloat(match[4]);
  10177. var h = ((parseFloat(match[1]) % 360) + 360) % 360;
  10178. var s = clamp(parseFloat(match[2]), 0, 100);
  10179. var l = clamp(parseFloat(match[3]), 0, 100);
  10180. var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
  10181. return [h, s, l, a];
  10182. }
  10183. return null;
  10184. };
  10185. cs.get.hwb = function (string) {
  10186. if (!string) {
  10187. return null;
  10188. }
  10189. var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
  10190. var match = string.match(hwb);
  10191. if (match) {
  10192. var alpha = parseFloat(match[4]);
  10193. var h = ((parseFloat(match[1]) % 360) + 360) % 360;
  10194. var w = clamp(parseFloat(match[2]), 0, 100);
  10195. var b = clamp(parseFloat(match[3]), 0, 100);
  10196. var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
  10197. return [h, w, b, a];
  10198. }
  10199. return null;
  10200. };
  10201. cs.to.hex = function () {
  10202. var rgba = simpleSwizzle(arguments);
  10203. return (
  10204. '#' +
  10205. hexDouble(rgba[0]) +
  10206. hexDouble(rgba[1]) +
  10207. hexDouble(rgba[2]) +
  10208. (rgba[3] < 1
  10209. ? (hexDouble(Math.round(rgba[3] * 255)))
  10210. : '')
  10211. );
  10212. };
  10213. cs.to.rgb = function () {
  10214. var rgba = simpleSwizzle(arguments);
  10215. return rgba.length < 4 || rgba[3] === 1
  10216. ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
  10217. : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
  10218. };
  10219. cs.to.rgb.percent = function () {
  10220. var rgba = simpleSwizzle(arguments);
  10221. var r = Math.round(rgba[0] / 255 * 100);
  10222. var g = Math.round(rgba[1] / 255 * 100);
  10223. var b = Math.round(rgba[2] / 255 * 100);
  10224. return rgba.length < 4 || rgba[3] === 1
  10225. ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
  10226. : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
  10227. };
  10228. cs.to.hsl = function () {
  10229. var hsla = simpleSwizzle(arguments);
  10230. return hsla.length < 4 || hsla[3] === 1
  10231. ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
  10232. : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
  10233. };
  10234. // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
  10235. // (hwb have alpha optional & 1 is default value)
  10236. cs.to.hwb = function () {
  10237. var hwba = simpleSwizzle(arguments);
  10238. var a = '';
  10239. if (hwba.length >= 4 && hwba[3] !== 1) {
  10240. a = ', ' + hwba[3];
  10241. }
  10242. return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
  10243. };
  10244. cs.to.keyword = function (rgb) {
  10245. return reverseNames[rgb.slice(0, 3)];
  10246. };
  10247. // helpers
  10248. function clamp(num, min, max) {
  10249. return Math.min(Math.max(min, num), max);
  10250. }
  10251. function hexDouble(num) {
  10252. var str = Math.round(num).toString(16).toUpperCase();
  10253. return (str.length < 2) ? '0' + str : str;
  10254. }
  10255. });
  10256. var colorName = {
  10257. "aliceblue": [240, 248, 255],
  10258. "antiquewhite": [250, 235, 215],
  10259. "aqua": [0, 255, 255],
  10260. "aquamarine": [127, 255, 212],
  10261. "azure": [240, 255, 255],
  10262. "beige": [245, 245, 220],
  10263. "bisque": [255, 228, 196],
  10264. "black": [0, 0, 0],
  10265. "blanchedalmond": [255, 235, 205],
  10266. "blue": [0, 0, 255],
  10267. "blueviolet": [138, 43, 226],
  10268. "brown": [165, 42, 42],
  10269. "burlywood": [222, 184, 135],
  10270. "cadetblue": [95, 158, 160],
  10271. "chartreuse": [127, 255, 0],
  10272. "chocolate": [210, 105, 30],
  10273. "coral": [255, 127, 80],
  10274. "cornflowerblue": [100, 149, 237],
  10275. "cornsilk": [255, 248, 220],
  10276. "crimson": [220, 20, 60],
  10277. "cyan": [0, 255, 255],
  10278. "darkblue": [0, 0, 139],
  10279. "darkcyan": [0, 139, 139],
  10280. "darkgoldenrod": [184, 134, 11],
  10281. "darkgray": [169, 169, 169],
  10282. "darkgreen": [0, 100, 0],
  10283. "darkgrey": [169, 169, 169],
  10284. "darkkhaki": [189, 183, 107],
  10285. "darkmagenta": [139, 0, 139],
  10286. "darkolivegreen": [85, 107, 47],
  10287. "darkorange": [255, 140, 0],
  10288. "darkorchid": [153, 50, 204],
  10289. "darkred": [139, 0, 0],
  10290. "darksalmon": [233, 150, 122],
  10291. "darkseagreen": [143, 188, 143],
  10292. "darkslateblue": [72, 61, 139],
  10293. "darkslategray": [47, 79, 79],
  10294. "darkslategrey": [47, 79, 79],
  10295. "darkturquoise": [0, 206, 209],
  10296. "darkviolet": [148, 0, 211],
  10297. "deeppink": [255, 20, 147],
  10298. "deepskyblue": [0, 191, 255],
  10299. "dimgray": [105, 105, 105],
  10300. "dimgrey": [105, 105, 105],
  10301. "dodgerblue": [30, 144, 255],
  10302. "firebrick": [178, 34, 34],
  10303. "floralwhite": [255, 250, 240],
  10304. "forestgreen": [34, 139, 34],
  10305. "fuchsia": [255, 0, 255],
  10306. "gainsboro": [220, 220, 220],
  10307. "ghostwhite": [248, 248, 255],
  10308. "gold": [255, 215, 0],
  10309. "goldenrod": [218, 165, 32],
  10310. "gray": [128, 128, 128],
  10311. "green": [0, 128, 0],
  10312. "greenyellow": [173, 255, 47],
  10313. "grey": [128, 128, 128],
  10314. "honeydew": [240, 255, 240],
  10315. "hotpink": [255, 105, 180],
  10316. "indianred": [205, 92, 92],
  10317. "indigo": [75, 0, 130],
  10318. "ivory": [255, 255, 240],
  10319. "khaki": [240, 230, 140],
  10320. "lavender": [230, 230, 250],
  10321. "lavenderblush": [255, 240, 245],
  10322. "lawngreen": [124, 252, 0],
  10323. "lemonchiffon": [255, 250, 205],
  10324. "lightblue": [173, 216, 230],
  10325. "lightcoral": [240, 128, 128],
  10326. "lightcyan": [224, 255, 255],
  10327. "lightgoldenrodyellow": [250, 250, 210],
  10328. "lightgray": [211, 211, 211],
  10329. "lightgreen": [144, 238, 144],
  10330. "lightgrey": [211, 211, 211],
  10331. "lightpink": [255, 182, 193],
  10332. "lightsalmon": [255, 160, 122],
  10333. "lightseagreen": [32, 178, 170],
  10334. "lightskyblue": [135, 206, 250],
  10335. "lightslategray": [119, 136, 153],
  10336. "lightslategrey": [119, 136, 153],
  10337. "lightsteelblue": [176, 196, 222],
  10338. "lightyellow": [255, 255, 224],
  10339. "lime": [0, 255, 0],
  10340. "limegreen": [50, 205, 50],
  10341. "linen": [250, 240, 230],
  10342. "magenta": [255, 0, 255],
  10343. "maroon": [128, 0, 0],
  10344. "mediumaquamarine": [102, 205, 170],
  10345. "mediumblue": [0, 0, 205],
  10346. "mediumorchid": [186, 85, 211],
  10347. "mediumpurple": [147, 112, 219],
  10348. "mediumseagreen": [60, 179, 113],
  10349. "mediumslateblue": [123, 104, 238],
  10350. "mediumspringgreen": [0, 250, 154],
  10351. "mediumturquoise": [72, 209, 204],
  10352. "mediumvioletred": [199, 21, 133],
  10353. "midnightblue": [25, 25, 112],
  10354. "mintcream": [245, 255, 250],
  10355. "mistyrose": [255, 228, 225],
  10356. "moccasin": [255, 228, 181],
  10357. "navajowhite": [255, 222, 173],
  10358. "navy": [0, 0, 128],
  10359. "oldlace": [253, 245, 230],
  10360. "olive": [128, 128, 0],
  10361. "olivedrab": [107, 142, 35],
  10362. "orange": [255, 165, 0],
  10363. "orangered": [255, 69, 0],
  10364. "orchid": [218, 112, 214],
  10365. "palegoldenrod": [238, 232, 170],
  10366. "palegreen": [152, 251, 152],
  10367. "paleturquoise": [175, 238, 238],
  10368. "palevioletred": [219, 112, 147],
  10369. "papayawhip": [255, 239, 213],
  10370. "peachpuff": [255, 218, 185],
  10371. "peru": [205, 133, 63],
  10372. "pink": [255, 192, 203],
  10373. "plum": [221, 160, 221],
  10374. "powderblue": [176, 224, 230],
  10375. "purple": [128, 0, 128],
  10376. "rebeccapurple": [102, 51, 153],
  10377. "red": [255, 0, 0],
  10378. "rosybrown": [188, 143, 143],
  10379. "royalblue": [65, 105, 225],
  10380. "saddlebrown": [139, 69, 19],
  10381. "salmon": [250, 128, 114],
  10382. "sandybrown": [244, 164, 96],
  10383. "seagreen": [46, 139, 87],
  10384. "seashell": [255, 245, 238],
  10385. "sienna": [160, 82, 45],
  10386. "silver": [192, 192, 192],
  10387. "skyblue": [135, 206, 235],
  10388. "slateblue": [106, 90, 205],
  10389. "slategray": [112, 128, 144],
  10390. "slategrey": [112, 128, 144],
  10391. "snow": [255, 250, 250],
  10392. "springgreen": [0, 255, 127],
  10393. "steelblue": [70, 130, 180],
  10394. "tan": [210, 180, 140],
  10395. "teal": [0, 128, 128],
  10396. "thistle": [216, 191, 216],
  10397. "tomato": [255, 99, 71],
  10398. "turquoise": [64, 224, 208],
  10399. "violet": [238, 130, 238],
  10400. "wheat": [245, 222, 179],
  10401. "white": [255, 255, 255],
  10402. "whitesmoke": [245, 245, 245],
  10403. "yellow": [255, 255, 0],
  10404. "yellowgreen": [154, 205, 50]
  10405. };
  10406. /* MIT license */
  10407. /* eslint-disable no-mixed-operators */
  10408. // NOTE: conversions should only return primitive values (i.e. arrays, or
  10409. // values that give correct `typeof` results).
  10410. // do not use box values types (i.e. Number(), String(), etc.)
  10411. const reverseKeywords = {};
  10412. for (const key of Object.keys(colorName)) {
  10413. reverseKeywords[colorName[key]] = key;
  10414. }
  10415. const convert$1 = {
  10416. rgb: {channels: 3, labels: 'rgb'},
  10417. hsl: {channels: 3, labels: 'hsl'},
  10418. hsv: {channels: 3, labels: 'hsv'},
  10419. hwb: {channels: 3, labels: 'hwb'},
  10420. cmyk: {channels: 4, labels: 'cmyk'},
  10421. xyz: {channels: 3, labels: 'xyz'},
  10422. lab: {channels: 3, labels: 'lab'},
  10423. lch: {channels: 3, labels: 'lch'},
  10424. hex: {channels: 1, labels: ['hex']},
  10425. keyword: {channels: 1, labels: ['keyword']},
  10426. ansi16: {channels: 1, labels: ['ansi16']},
  10427. ansi256: {channels: 1, labels: ['ansi256']},
  10428. hcg: {channels: 3, labels: ['h', 'c', 'g']},
  10429. apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
  10430. gray: {channels: 1, labels: ['gray']}
  10431. };
  10432. var conversions = convert$1;
  10433. // Hide .channels and .labels properties
  10434. for (const model of Object.keys(convert$1)) {
  10435. if (!('channels' in convert$1[model])) {
  10436. throw new Error('missing channels property: ' + model);
  10437. }
  10438. if (!('labels' in convert$1[model])) {
  10439. throw new Error('missing channel labels property: ' + model);
  10440. }
  10441. if (convert$1[model].labels.length !== convert$1[model].channels) {
  10442. throw new Error('channel and label counts mismatch: ' + model);
  10443. }
  10444. const {channels, labels} = convert$1[model];
  10445. delete convert$1[model].channels;
  10446. delete convert$1[model].labels;
  10447. Object.defineProperty(convert$1[model], 'channels', {value: channels});
  10448. Object.defineProperty(convert$1[model], 'labels', {value: labels});
  10449. }
  10450. convert$1.rgb.hsl = function (rgb) {
  10451. const r = rgb[0] / 255;
  10452. const g = rgb[1] / 255;
  10453. const b = rgb[2] / 255;
  10454. const min = Math.min(r, g, b);
  10455. const max = Math.max(r, g, b);
  10456. const delta = max - min;
  10457. let h;
  10458. let s;
  10459. if (max === min) {
  10460. h = 0;
  10461. } else if (r === max) {
  10462. h = (g - b) / delta;
  10463. } else if (g === max) {
  10464. h = 2 + (b - r) / delta;
  10465. } else if (b === max) {
  10466. h = 4 + (r - g) / delta;
  10467. }
  10468. h = Math.min(h * 60, 360);
  10469. if (h < 0) {
  10470. h += 360;
  10471. }
  10472. const l = (min + max) / 2;
  10473. if (max === min) {
  10474. s = 0;
  10475. } else if (l <= 0.5) {
  10476. s = delta / (max + min);
  10477. } else {
  10478. s = delta / (2 - max - min);
  10479. }
  10480. return [h, s * 100, l * 100];
  10481. };
  10482. convert$1.rgb.hsv = function (rgb) {
  10483. let rdif;
  10484. let gdif;
  10485. let bdif;
  10486. let h;
  10487. let s;
  10488. const r = rgb[0] / 255;
  10489. const g = rgb[1] / 255;
  10490. const b = rgb[2] / 255;
  10491. const v = Math.max(r, g, b);
  10492. const diff = v - Math.min(r, g, b);
  10493. const diffc = function (c) {
  10494. return (v - c) / 6 / diff + 1 / 2;
  10495. };
  10496. if (diff === 0) {
  10497. h = 0;
  10498. s = 0;
  10499. } else {
  10500. s = diff / v;
  10501. rdif = diffc(r);
  10502. gdif = diffc(g);
  10503. bdif = diffc(b);
  10504. if (r === v) {
  10505. h = bdif - gdif;
  10506. } else if (g === v) {
  10507. h = (1 / 3) + rdif - bdif;
  10508. } else if (b === v) {
  10509. h = (2 / 3) + gdif - rdif;
  10510. }
  10511. if (h < 0) {
  10512. h += 1;
  10513. } else if (h > 1) {
  10514. h -= 1;
  10515. }
  10516. }
  10517. return [
  10518. h * 360,
  10519. s * 100,
  10520. v * 100
  10521. ];
  10522. };
  10523. convert$1.rgb.hwb = function (rgb) {
  10524. const r = rgb[0];
  10525. const g = rgb[1];
  10526. let b = rgb[2];
  10527. const h = convert$1.rgb.hsl(rgb)[0];
  10528. const w = 1 / 255 * Math.min(r, Math.min(g, b));
  10529. b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
  10530. return [h, w * 100, b * 100];
  10531. };
  10532. convert$1.rgb.cmyk = function (rgb) {
  10533. const r = rgb[0] / 255;
  10534. const g = rgb[1] / 255;
  10535. const b = rgb[2] / 255;
  10536. const k = Math.min(1 - r, 1 - g, 1 - b);
  10537. const c = (1 - r - k) / (1 - k) || 0;
  10538. const m = (1 - g - k) / (1 - k) || 0;
  10539. const y = (1 - b - k) / (1 - k) || 0;
  10540. return [c * 100, m * 100, y * 100, k * 100];
  10541. };
  10542. function comparativeDistance(x, y) {
  10543. /*
  10544. See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
  10545. */
  10546. return (
  10547. ((x[0] - y[0]) ** 2) +
  10548. ((x[1] - y[1]) ** 2) +
  10549. ((x[2] - y[2]) ** 2)
  10550. );
  10551. }
  10552. convert$1.rgb.keyword = function (rgb) {
  10553. const reversed = reverseKeywords[rgb];
  10554. if (reversed) {
  10555. return reversed;
  10556. }
  10557. let currentClosestDistance = Infinity;
  10558. let currentClosestKeyword;
  10559. for (const keyword of Object.keys(colorName)) {
  10560. const value = colorName[keyword];
  10561. // Compute comparative distance
  10562. const distance = comparativeDistance(rgb, value);
  10563. // Check if its less, if so set as closest
  10564. if (distance < currentClosestDistance) {
  10565. currentClosestDistance = distance;
  10566. currentClosestKeyword = keyword;
  10567. }
  10568. }
  10569. return currentClosestKeyword;
  10570. };
  10571. convert$1.keyword.rgb = function (keyword) {
  10572. return colorName[keyword];
  10573. };
  10574. convert$1.rgb.xyz = function (rgb) {
  10575. let r = rgb[0] / 255;
  10576. let g = rgb[1] / 255;
  10577. let b = rgb[2] / 255;
  10578. // Assume sRGB
  10579. r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
  10580. g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
  10581. b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
  10582. const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
  10583. const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
  10584. const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
  10585. return [x * 100, y * 100, z * 100];
  10586. };
  10587. convert$1.rgb.lab = function (rgb) {
  10588. const xyz = convert$1.rgb.xyz(rgb);
  10589. let x = xyz[0];
  10590. let y = xyz[1];
  10591. let z = xyz[2];
  10592. x /= 95.047;
  10593. y /= 100;
  10594. z /= 108.883;
  10595. x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
  10596. y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
  10597. z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
  10598. const l = (116 * y) - 16;
  10599. const a = 500 * (x - y);
  10600. const b = 200 * (y - z);
  10601. return [l, a, b];
  10602. };
  10603. convert$1.hsl.rgb = function (hsl) {
  10604. const h = hsl[0] / 360;
  10605. const s = hsl[1] / 100;
  10606. const l = hsl[2] / 100;
  10607. let t2;
  10608. let t3;
  10609. let val;
  10610. if (s === 0) {
  10611. val = l * 255;
  10612. return [val, val, val];
  10613. }
  10614. if (l < 0.5) {
  10615. t2 = l * (1 + s);
  10616. } else {
  10617. t2 = l + s - l * s;
  10618. }
  10619. const t1 = 2 * l - t2;
  10620. const rgb = [0, 0, 0];
  10621. for (let i = 0; i < 3; i++) {
  10622. t3 = h + 1 / 3 * -(i - 1);
  10623. if (t3 < 0) {
  10624. t3++;
  10625. }
  10626. if (t3 > 1) {
  10627. t3--;
  10628. }
  10629. if (6 * t3 < 1) {
  10630. val = t1 + (t2 - t1) * 6 * t3;
  10631. } else if (2 * t3 < 1) {
  10632. val = t2;
  10633. } else if (3 * t3 < 2) {
  10634. val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
  10635. } else {
  10636. val = t1;
  10637. }
  10638. rgb[i] = val * 255;
  10639. }
  10640. return rgb;
  10641. };
  10642. convert$1.hsl.hsv = function (hsl) {
  10643. const h = hsl[0];
  10644. let s = hsl[1] / 100;
  10645. let l = hsl[2] / 100;
  10646. let smin = s;
  10647. const lmin = Math.max(l, 0.01);
  10648. l *= 2;
  10649. s *= (l <= 1) ? l : 2 - l;
  10650. smin *= lmin <= 1 ? lmin : 2 - lmin;
  10651. const v = (l + s) / 2;
  10652. const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
  10653. return [h, sv * 100, v * 100];
  10654. };
  10655. convert$1.hsv.rgb = function (hsv) {
  10656. const h = hsv[0] / 60;
  10657. const s = hsv[1] / 100;
  10658. let v = hsv[2] / 100;
  10659. const hi = Math.floor(h) % 6;
  10660. const f = h - Math.floor(h);
  10661. const p = 255 * v * (1 - s);
  10662. const q = 255 * v * (1 - (s * f));
  10663. const t = 255 * v * (1 - (s * (1 - f)));
  10664. v *= 255;
  10665. switch (hi) {
  10666. case 0:
  10667. return [v, t, p];
  10668. case 1:
  10669. return [q, v, p];
  10670. case 2:
  10671. return [p, v, t];
  10672. case 3:
  10673. return [p, q, v];
  10674. case 4:
  10675. return [t, p, v];
  10676. case 5:
  10677. return [v, p, q];
  10678. }
  10679. };
  10680. convert$1.hsv.hsl = function (hsv) {
  10681. const h = hsv[0];
  10682. const s = hsv[1] / 100;
  10683. const v = hsv[2] / 100;
  10684. const vmin = Math.max(v, 0.01);
  10685. let sl;
  10686. let l;
  10687. l = (2 - s) * v;
  10688. const lmin = (2 - s) * vmin;
  10689. sl = s * vmin;
  10690. sl /= (lmin <= 1) ? lmin : 2 - lmin;
  10691. sl = sl || 0;
  10692. l /= 2;
  10693. return [h, sl * 100, l * 100];
  10694. };
  10695. // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
  10696. convert$1.hwb.rgb = function (hwb) {
  10697. const h = hwb[0] / 360;
  10698. let wh = hwb[1] / 100;
  10699. let bl = hwb[2] / 100;
  10700. const ratio = wh + bl;
  10701. let f;
  10702. // Wh + bl cant be > 1
  10703. if (ratio > 1) {
  10704. wh /= ratio;
  10705. bl /= ratio;
  10706. }
  10707. const i = Math.floor(6 * h);
  10708. const v = 1 - bl;
  10709. f = 6 * h - i;
  10710. if ((i & 0x01) !== 0) {
  10711. f = 1 - f;
  10712. }
  10713. const n = wh + f * (v - wh); // Linear interpolation
  10714. let r;
  10715. let g;
  10716. let b;
  10717. /* eslint-disable max-statements-per-line,no-multi-spaces */
  10718. switch (i) {
  10719. default:
  10720. case 6:
  10721. case 0: r = v; g = n; b = wh; break;
  10722. case 1: r = n; g = v; b = wh; break;
  10723. case 2: r = wh; g = v; b = n; break;
  10724. case 3: r = wh; g = n; b = v; break;
  10725. case 4: r = n; g = wh; b = v; break;
  10726. case 5: r = v; g = wh; b = n; break;
  10727. }
  10728. /* eslint-enable max-statements-per-line,no-multi-spaces */
  10729. return [r * 255, g * 255, b * 255];
  10730. };
  10731. convert$1.cmyk.rgb = function (cmyk) {
  10732. const c = cmyk[0] / 100;
  10733. const m = cmyk[1] / 100;
  10734. const y = cmyk[2] / 100;
  10735. const k = cmyk[3] / 100;
  10736. const r = 1 - Math.min(1, c * (1 - k) + k);
  10737. const g = 1 - Math.min(1, m * (1 - k) + k);
  10738. const b = 1 - Math.min(1, y * (1 - k) + k);
  10739. return [r * 255, g * 255, b * 255];
  10740. };
  10741. convert$1.xyz.rgb = function (xyz) {
  10742. const x = xyz[0] / 100;
  10743. const y = xyz[1] / 100;
  10744. const z = xyz[2] / 100;
  10745. let r;
  10746. let g;
  10747. let b;
  10748. r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
  10749. g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
  10750. b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
  10751. // Assume sRGB
  10752. r = r > 0.0031308
  10753. ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
  10754. : r * 12.92;
  10755. g = g > 0.0031308
  10756. ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
  10757. : g * 12.92;
  10758. b = b > 0.0031308
  10759. ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
  10760. : b * 12.92;
  10761. r = Math.min(Math.max(0, r), 1);
  10762. g = Math.min(Math.max(0, g), 1);
  10763. b = Math.min(Math.max(0, b), 1);
  10764. return [r * 255, g * 255, b * 255];
  10765. };
  10766. convert$1.xyz.lab = function (xyz) {
  10767. let x = xyz[0];
  10768. let y = xyz[1];
  10769. let z = xyz[2];
  10770. x /= 95.047;
  10771. y /= 100;
  10772. z /= 108.883;
  10773. x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
  10774. y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
  10775. z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
  10776. const l = (116 * y) - 16;
  10777. const a = 500 * (x - y);
  10778. const b = 200 * (y - z);
  10779. return [l, a, b];
  10780. };
  10781. convert$1.lab.xyz = function (lab) {
  10782. const l = lab[0];
  10783. const a = lab[1];
  10784. const b = lab[2];
  10785. let x;
  10786. let y;
  10787. let z;
  10788. y = (l + 16) / 116;
  10789. x = a / 500 + y;
  10790. z = y - b / 200;
  10791. const y2 = y ** 3;
  10792. const x2 = x ** 3;
  10793. const z2 = z ** 3;
  10794. y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
  10795. x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
  10796. z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
  10797. x *= 95.047;
  10798. y *= 100;
  10799. z *= 108.883;
  10800. return [x, y, z];
  10801. };
  10802. convert$1.lab.lch = function (lab) {
  10803. const l = lab[0];
  10804. const a = lab[1];
  10805. const b = lab[2];
  10806. let h;
  10807. const hr = Math.atan2(b, a);
  10808. h = hr * 360 / 2 / Math.PI;
  10809. if (h < 0) {
  10810. h += 360;
  10811. }
  10812. const c = Math.sqrt(a * a + b * b);
  10813. return [l, c, h];
  10814. };
  10815. convert$1.lch.lab = function (lch) {
  10816. const l = lch[0];
  10817. const c = lch[1];
  10818. const h = lch[2];
  10819. const hr = h / 360 * 2 * Math.PI;
  10820. const a = c * Math.cos(hr);
  10821. const b = c * Math.sin(hr);
  10822. return [l, a, b];
  10823. };
  10824. convert$1.rgb.ansi16 = function (args, saturation = null) {
  10825. const [r, g, b] = args;
  10826. let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
  10827. value = Math.round(value / 50);
  10828. if (value === 0) {
  10829. return 30;
  10830. }
  10831. let ansi = 30
  10832. + ((Math.round(b / 255) << 2)
  10833. | (Math.round(g / 255) << 1)
  10834. | Math.round(r / 255));
  10835. if (value === 2) {
  10836. ansi += 60;
  10837. }
  10838. return ansi;
  10839. };
  10840. convert$1.hsv.ansi16 = function (args) {
  10841. // Optimization here; we already know the value and don't need to get
  10842. // it converted for us.
  10843. return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
  10844. };
  10845. convert$1.rgb.ansi256 = function (args) {
  10846. const r = args[0];
  10847. const g = args[1];
  10848. const b = args[2];
  10849. // We use the extended greyscale palette here, with the exception of
  10850. // black and white. normal palette only has 4 greyscale shades.
  10851. if (r === g && g === b) {
  10852. if (r < 8) {
  10853. return 16;
  10854. }
  10855. if (r > 248) {
  10856. return 231;
  10857. }
  10858. return Math.round(((r - 8) / 247) * 24) + 232;
  10859. }
  10860. const ansi = 16
  10861. + (36 * Math.round(r / 255 * 5))
  10862. + (6 * Math.round(g / 255 * 5))
  10863. + Math.round(b / 255 * 5);
  10864. return ansi;
  10865. };
  10866. convert$1.ansi16.rgb = function (args) {
  10867. let color = args % 10;
  10868. // Handle greyscale
  10869. if (color === 0 || color === 7) {
  10870. if (args > 50) {
  10871. color += 3.5;
  10872. }
  10873. color = color / 10.5 * 255;
  10874. return [color, color, color];
  10875. }
  10876. const mult = (~~(args > 50) + 1) * 0.5;
  10877. const r = ((color & 1) * mult) * 255;
  10878. const g = (((color >> 1) & 1) * mult) * 255;
  10879. const b = (((color >> 2) & 1) * mult) * 255;
  10880. return [r, g, b];
  10881. };
  10882. convert$1.ansi256.rgb = function (args) {
  10883. // Handle greyscale
  10884. if (args >= 232) {
  10885. const c = (args - 232) * 10 + 8;
  10886. return [c, c, c];
  10887. }
  10888. args -= 16;
  10889. let rem;
  10890. const r = Math.floor(args / 36) / 5 * 255;
  10891. const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
  10892. const b = (rem % 6) / 5 * 255;
  10893. return [r, g, b];
  10894. };
  10895. convert$1.rgb.hex = function (args) {
  10896. const integer = ((Math.round(args[0]) & 0xFF) << 16)
  10897. + ((Math.round(args[1]) & 0xFF) << 8)
  10898. + (Math.round(args[2]) & 0xFF);
  10899. const string = integer.toString(16).toUpperCase();
  10900. return '000000'.substring(string.length) + string;
  10901. };
  10902. convert$1.hex.rgb = function (args) {
  10903. const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  10904. if (!match) {
  10905. return [0, 0, 0];
  10906. }
  10907. let colorString = match[0];
  10908. if (match[0].length === 3) {
  10909. colorString = colorString.split('').map(char => {
  10910. return char + char;
  10911. }).join('');
  10912. }
  10913. const integer = parseInt(colorString, 16);
  10914. const r = (integer >> 16) & 0xFF;
  10915. const g = (integer >> 8) & 0xFF;
  10916. const b = integer & 0xFF;
  10917. return [r, g, b];
  10918. };
  10919. convert$1.rgb.hcg = function (rgb) {
  10920. const r = rgb[0] / 255;
  10921. const g = rgb[1] / 255;
  10922. const b = rgb[2] / 255;
  10923. const max = Math.max(Math.max(r, g), b);
  10924. const min = Math.min(Math.min(r, g), b);
  10925. const chroma = (max - min);
  10926. let grayscale;
  10927. let hue;
  10928. if (chroma < 1) {
  10929. grayscale = min / (1 - chroma);
  10930. } else {
  10931. grayscale = 0;
  10932. }
  10933. if (chroma <= 0) {
  10934. hue = 0;
  10935. } else
  10936. if (max === r) {
  10937. hue = ((g - b) / chroma) % 6;
  10938. } else
  10939. if (max === g) {
  10940. hue = 2 + (b - r) / chroma;
  10941. } else {
  10942. hue = 4 + (r - g) / chroma;
  10943. }
  10944. hue /= 6;
  10945. hue %= 1;
  10946. return [hue * 360, chroma * 100, grayscale * 100];
  10947. };
  10948. convert$1.hsl.hcg = function (hsl) {
  10949. const s = hsl[1] / 100;
  10950. const l = hsl[2] / 100;
  10951. const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
  10952. let f = 0;
  10953. if (c < 1.0) {
  10954. f = (l - 0.5 * c) / (1.0 - c);
  10955. }
  10956. return [hsl[0], c * 100, f * 100];
  10957. };
  10958. convert$1.hsv.hcg = function (hsv) {
  10959. const s = hsv[1] / 100;
  10960. const v = hsv[2] / 100;
  10961. const c = s * v;
  10962. let f = 0;
  10963. if (c < 1.0) {
  10964. f = (v - c) / (1 - c);
  10965. }
  10966. return [hsv[0], c * 100, f * 100];
  10967. };
  10968. convert$1.hcg.rgb = function (hcg) {
  10969. const h = hcg[0] / 360;
  10970. const c = hcg[1] / 100;
  10971. const g = hcg[2] / 100;
  10972. if (c === 0.0) {
  10973. return [g * 255, g * 255, g * 255];
  10974. }
  10975. const pure = [0, 0, 0];
  10976. const hi = (h % 1) * 6;
  10977. const v = hi % 1;
  10978. const w = 1 - v;
  10979. let mg = 0;
  10980. /* eslint-disable max-statements-per-line */
  10981. switch (Math.floor(hi)) {
  10982. case 0:
  10983. pure[0] = 1; pure[1] = v; pure[2] = 0; break;
  10984. case 1:
  10985. pure[0] = w; pure[1] = 1; pure[2] = 0; break;
  10986. case 2:
  10987. pure[0] = 0; pure[1] = 1; pure[2] = v; break;
  10988. case 3:
  10989. pure[0] = 0; pure[1] = w; pure[2] = 1; break;
  10990. case 4:
  10991. pure[0] = v; pure[1] = 0; pure[2] = 1; break;
  10992. default:
  10993. pure[0] = 1; pure[1] = 0; pure[2] = w;
  10994. }
  10995. /* eslint-enable max-statements-per-line */
  10996. mg = (1.0 - c) * g;
  10997. return [
  10998. (c * pure[0] + mg) * 255,
  10999. (c * pure[1] + mg) * 255,
  11000. (c * pure[2] + mg) * 255
  11001. ];
  11002. };
  11003. convert$1.hcg.hsv = function (hcg) {
  11004. const c = hcg[1] / 100;
  11005. const g = hcg[2] / 100;
  11006. const v = c + g * (1.0 - c);
  11007. let f = 0;
  11008. if (v > 0.0) {
  11009. f = c / v;
  11010. }
  11011. return [hcg[0], f * 100, v * 100];
  11012. };
  11013. convert$1.hcg.hsl = function (hcg) {
  11014. const c = hcg[1] / 100;
  11015. const g = hcg[2] / 100;
  11016. const l = g * (1.0 - c) + 0.5 * c;
  11017. let s = 0;
  11018. if (l > 0.0 && l < 0.5) {
  11019. s = c / (2 * l);
  11020. } else
  11021. if (l >= 0.5 && l < 1.0) {
  11022. s = c / (2 * (1 - l));
  11023. }
  11024. return [hcg[0], s * 100, l * 100];
  11025. };
  11026. convert$1.hcg.hwb = function (hcg) {
  11027. const c = hcg[1] / 100;
  11028. const g = hcg[2] / 100;
  11029. const v = c + g * (1.0 - c);
  11030. return [hcg[0], (v - c) * 100, (1 - v) * 100];
  11031. };
  11032. convert$1.hwb.hcg = function (hwb) {
  11033. const w = hwb[1] / 100;
  11034. const b = hwb[2] / 100;
  11035. const v = 1 - b;
  11036. const c = v - w;
  11037. let g = 0;
  11038. if (c < 1) {
  11039. g = (v - c) / (1 - c);
  11040. }
  11041. return [hwb[0], c * 100, g * 100];
  11042. };
  11043. convert$1.apple.rgb = function (apple) {
  11044. return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
  11045. };
  11046. convert$1.rgb.apple = function (rgb) {
  11047. return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
  11048. };
  11049. convert$1.gray.rgb = function (args) {
  11050. return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  11051. };
  11052. convert$1.gray.hsl = function (args) {
  11053. return [0, 0, args[0]];
  11054. };
  11055. convert$1.gray.hsv = convert$1.gray.hsl;
  11056. convert$1.gray.hwb = function (gray) {
  11057. return [0, 100, gray[0]];
  11058. };
  11059. convert$1.gray.cmyk = function (gray) {
  11060. return [0, 0, 0, gray[0]];
  11061. };
  11062. convert$1.gray.lab = function (gray) {
  11063. return [gray[0], 0, 0];
  11064. };
  11065. convert$1.gray.hex = function (gray) {
  11066. const val = Math.round(gray[0] / 100 * 255) & 0xFF;
  11067. const integer = (val << 16) + (val << 8) + val;
  11068. const string = integer.toString(16).toUpperCase();
  11069. return '000000'.substring(string.length) + string;
  11070. };
  11071. convert$1.rgb.gray = function (rgb) {
  11072. const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
  11073. return [val / 255 * 100];
  11074. };
  11075. /*
  11076. This function routes a model to all other models.
  11077. all functions that are routed have a property `.conversion` attached
  11078. to the returned synthetic function. This property is an array
  11079. of strings, each with the steps in between the 'from' and 'to'
  11080. color models (inclusive).
  11081. conversions that are not possible simply are not included.
  11082. */
  11083. function buildGraph() {
  11084. const graph = {};
  11085. // https://jsperf.com/object-keys-vs-for-in-with-closure/3
  11086. const models = Object.keys(conversions);
  11087. for (let len = models.length, i = 0; i < len; i++) {
  11088. graph[models[i]] = {
  11089. // http://jsperf.com/1-vs-infinity
  11090. // micro-opt, but this is simple.
  11091. distance: -1,
  11092. parent: null
  11093. };
  11094. }
  11095. return graph;
  11096. }
  11097. // https://en.wikipedia.org/wiki/Breadth-first_search
  11098. function deriveBFS(fromModel) {
  11099. const graph = buildGraph();
  11100. const queue = [fromModel]; // Unshift -> queue -> pop
  11101. graph[fromModel].distance = 0;
  11102. while (queue.length) {
  11103. const current = queue.pop();
  11104. const adjacents = Object.keys(conversions[current]);
  11105. for (let len = adjacents.length, i = 0; i < len; i++) {
  11106. const adjacent = adjacents[i];
  11107. const node = graph[adjacent];
  11108. if (node.distance === -1) {
  11109. node.distance = graph[current].distance + 1;
  11110. node.parent = current;
  11111. queue.unshift(adjacent);
  11112. }
  11113. }
  11114. }
  11115. return graph;
  11116. }
  11117. function link(from, to) {
  11118. return function (args) {
  11119. return to(from(args));
  11120. };
  11121. }
  11122. function wrapConversion(toModel, graph) {
  11123. const path = [graph[toModel].parent, toModel];
  11124. let fn = conversions[graph[toModel].parent][toModel];
  11125. let cur = graph[toModel].parent;
  11126. while (graph[cur].parent) {
  11127. path.unshift(graph[cur].parent);
  11128. fn = link(conversions[graph[cur].parent][cur], fn);
  11129. cur = graph[cur].parent;
  11130. }
  11131. fn.conversion = path;
  11132. return fn;
  11133. }
  11134. var route = function (fromModel) {
  11135. const graph = deriveBFS(fromModel);
  11136. const conversion = {};
  11137. const models = Object.keys(graph);
  11138. for (let len = models.length, i = 0; i < len; i++) {
  11139. const toModel = models[i];
  11140. const node = graph[toModel];
  11141. if (node.parent === null) {
  11142. // No possible conversion, or this node is the source model.
  11143. continue;
  11144. }
  11145. conversion[toModel] = wrapConversion(toModel, graph);
  11146. }
  11147. return conversion;
  11148. };
  11149. const convert = {};
  11150. const models = Object.keys(conversions);
  11151. function wrapRaw(fn) {
  11152. const wrappedFn = function (...args) {
  11153. const arg0 = args[0];
  11154. if (arg0 === undefined || arg0 === null) {
  11155. return arg0;
  11156. }
  11157. if (arg0.length > 1) {
  11158. args = arg0;
  11159. }
  11160. return fn(args);
  11161. };
  11162. // Preserve .conversion property if there is one
  11163. if ('conversion' in fn) {
  11164. wrappedFn.conversion = fn.conversion;
  11165. }
  11166. return wrappedFn;
  11167. }
  11168. function wrapRounded(fn) {
  11169. const wrappedFn = function (...args) {
  11170. const arg0 = args[0];
  11171. if (arg0 === undefined || arg0 === null) {
  11172. return arg0;
  11173. }
  11174. if (arg0.length > 1) {
  11175. args = arg0;
  11176. }
  11177. const result = fn(args);
  11178. // We're assuming the result is an array here.
  11179. // see notice in conversions.js; don't use box types
  11180. // in conversion functions.
  11181. if (typeof result === 'object') {
  11182. for (let len = result.length, i = 0; i < len; i++) {
  11183. result[i] = Math.round(result[i]);
  11184. }
  11185. }
  11186. return result;
  11187. };
  11188. // Preserve .conversion property if there is one
  11189. if ('conversion' in fn) {
  11190. wrappedFn.conversion = fn.conversion;
  11191. }
  11192. return wrappedFn;
  11193. }
  11194. models.forEach(fromModel => {
  11195. convert[fromModel] = {};
  11196. Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
  11197. Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
  11198. const routes = route(fromModel);
  11199. const routeModels = Object.keys(routes);
  11200. routeModels.forEach(toModel => {
  11201. const fn = routes[toModel];
  11202. convert[fromModel][toModel] = wrapRounded(fn);
  11203. convert[fromModel][toModel].raw = wrapRaw(fn);
  11204. });
  11205. });
  11206. var colorConvert = convert;
  11207. const skippedModels = [
  11208. // To be honest, I don't really feel like keyword belongs in color convert, but eh.
  11209. 'keyword',
  11210. // Gray conflicts with some method names, and has its own method defined.
  11211. 'gray',
  11212. // Shouldn't really be in color-convert either...
  11213. 'hex',
  11214. ];
  11215. const hashedModelKeys = {};
  11216. for (const model of Object.keys(colorConvert)) {
  11217. hashedModelKeys[[...colorConvert[model].labels].sort().join('')] = model;
  11218. }
  11219. const limiters = {};
  11220. function Color(object, model) {
  11221. if (!(this instanceof Color)) {
  11222. return new Color(object, model);
  11223. }
  11224. if (model && model in skippedModels) {
  11225. model = null;
  11226. }
  11227. if (model && !(model in colorConvert)) {
  11228. throw new Error('Unknown model: ' + model);
  11229. }
  11230. let i;
  11231. let channels;
  11232. if (object == null) { // eslint-disable-line no-eq-null,eqeqeq
  11233. this.model = 'rgb';
  11234. this.color = [0, 0, 0];
  11235. this.valpha = 1;
  11236. } else if (object instanceof Color) {
  11237. this.model = object.model;
  11238. this.color = [...object.color];
  11239. this.valpha = object.valpha;
  11240. } else if (typeof object === 'string') {
  11241. const result = colorString.get(object);
  11242. if (result === null) {
  11243. throw new Error('Unable to parse color from string: ' + object);
  11244. }
  11245. this.model = result.model;
  11246. channels = colorConvert[this.model].channels;
  11247. this.color = result.value.slice(0, channels);
  11248. this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
  11249. } else if (object.length > 0) {
  11250. this.model = model || 'rgb';
  11251. channels = colorConvert[this.model].channels;
  11252. const newArray = Array.prototype.slice.call(object, 0, channels);
  11253. this.color = zeroArray(newArray, channels);
  11254. this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
  11255. } else if (typeof object === 'number') {
  11256. // This is always RGB - can be converted later on.
  11257. this.model = 'rgb';
  11258. this.color = [
  11259. (object >> 16) & 0xFF,
  11260. (object >> 8) & 0xFF,
  11261. object & 0xFF,
  11262. ];
  11263. this.valpha = 1;
  11264. } else {
  11265. this.valpha = 1;
  11266. const keys = Object.keys(object);
  11267. if ('alpha' in object) {
  11268. keys.splice(keys.indexOf('alpha'), 1);
  11269. this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
  11270. }
  11271. const hashedKeys = keys.sort().join('');
  11272. if (!(hashedKeys in hashedModelKeys)) {
  11273. throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
  11274. }
  11275. this.model = hashedModelKeys[hashedKeys];
  11276. const {labels} = colorConvert[this.model];
  11277. const color = [];
  11278. for (i = 0; i < labels.length; i++) {
  11279. color.push(object[labels[i]]);
  11280. }
  11281. this.color = zeroArray(color);
  11282. }
  11283. // Perform limitations (clamping, etc.)
  11284. if (limiters[this.model]) {
  11285. channels = colorConvert[this.model].channels;
  11286. for (i = 0; i < channels; i++) {
  11287. const limit = limiters[this.model][i];
  11288. if (limit) {
  11289. this.color[i] = limit(this.color[i]);
  11290. }
  11291. }
  11292. }
  11293. this.valpha = Math.max(0, Math.min(1, this.valpha));
  11294. if (Object.freeze) {
  11295. Object.freeze(this);
  11296. }
  11297. }
  11298. Color.prototype = {
  11299. toString() {
  11300. return this.string();
  11301. },
  11302. toJSON() {
  11303. return this[this.model]();
  11304. },
  11305. string(places) {
  11306. let self = this.model in colorString.to ? this : this.rgb();
  11307. self = self.round(typeof places === 'number' ? places : 1);
  11308. const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
  11309. return colorString.to[self.model](args);
  11310. },
  11311. percentString(places) {
  11312. const self = this.rgb().round(typeof places === 'number' ? places : 1);
  11313. const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
  11314. return colorString.to.rgb.percent(args);
  11315. },
  11316. array() {
  11317. return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
  11318. },
  11319. object() {
  11320. const result = {};
  11321. const {channels} = colorConvert[this.model];
  11322. const {labels} = colorConvert[this.model];
  11323. for (let i = 0; i < channels; i++) {
  11324. result[labels[i]] = this.color[i];
  11325. }
  11326. if (this.valpha !== 1) {
  11327. result.alpha = this.valpha;
  11328. }
  11329. return result;
  11330. },
  11331. unitArray() {
  11332. const rgb = this.rgb().color;
  11333. rgb[0] /= 255;
  11334. rgb[1] /= 255;
  11335. rgb[2] /= 255;
  11336. if (this.valpha !== 1) {
  11337. rgb.push(this.valpha);
  11338. }
  11339. return rgb;
  11340. },
  11341. unitObject() {
  11342. const rgb = this.rgb().object();
  11343. rgb.r /= 255;
  11344. rgb.g /= 255;
  11345. rgb.b /= 255;
  11346. if (this.valpha !== 1) {
  11347. rgb.alpha = this.valpha;
  11348. }
  11349. return rgb;
  11350. },
  11351. round(places) {
  11352. places = Math.max(places || 0, 0);
  11353. return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
  11354. },
  11355. alpha(value) {
  11356. if (value !== undefined) {
  11357. return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
  11358. }
  11359. return this.valpha;
  11360. },
  11361. // Rgb
  11362. red: getset('rgb', 0, maxfn(255)),
  11363. green: getset('rgb', 1, maxfn(255)),
  11364. blue: getset('rgb', 2, maxfn(255)),
  11365. hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),
  11366. saturationl: getset('hsl', 1, maxfn(100)),
  11367. lightness: getset('hsl', 2, maxfn(100)),
  11368. saturationv: getset('hsv', 1, maxfn(100)),
  11369. value: getset('hsv', 2, maxfn(100)),
  11370. chroma: getset('hcg', 1, maxfn(100)),
  11371. gray: getset('hcg', 2, maxfn(100)),
  11372. white: getset('hwb', 1, maxfn(100)),
  11373. wblack: getset('hwb', 2, maxfn(100)),
  11374. cyan: getset('cmyk', 0, maxfn(100)),
  11375. magenta: getset('cmyk', 1, maxfn(100)),
  11376. yellow: getset('cmyk', 2, maxfn(100)),
  11377. black: getset('cmyk', 3, maxfn(100)),
  11378. x: getset('xyz', 0, maxfn(95.047)),
  11379. y: getset('xyz', 1, maxfn(100)),
  11380. z: getset('xyz', 2, maxfn(108.833)),
  11381. l: getset('lab', 0, maxfn(100)),
  11382. a: getset('lab', 1),
  11383. b: getset('lab', 2),
  11384. keyword(value) {
  11385. if (value !== undefined) {
  11386. return new Color(value);
  11387. }
  11388. return colorConvert[this.model].keyword(this.color);
  11389. },
  11390. hex(value) {
  11391. if (value !== undefined) {
  11392. return new Color(value);
  11393. }
  11394. return colorString.to.hex(this.rgb().round().color);
  11395. },
  11396. hexa(value) {
  11397. if (value !== undefined) {
  11398. return new Color(value);
  11399. }
  11400. const rgbArray = this.rgb().round().color;
  11401. let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
  11402. if (alphaHex.length === 1) {
  11403. alphaHex = '0' + alphaHex;
  11404. }
  11405. return colorString.to.hex(rgbArray) + alphaHex;
  11406. },
  11407. rgbNumber() {
  11408. const rgb = this.rgb().color;
  11409. return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
  11410. },
  11411. luminosity() {
  11412. // http://www.w3.org/TR/WCAG20/#relativeluminancedef
  11413. const rgb = this.rgb().color;
  11414. const lum = [];
  11415. for (const [i, element] of rgb.entries()) {
  11416. const chan = element / 255;
  11417. lum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
  11418. }
  11419. return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
  11420. },
  11421. contrast(color2) {
  11422. // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
  11423. const lum1 = this.luminosity();
  11424. const lum2 = color2.luminosity();
  11425. if (lum1 > lum2) {
  11426. return (lum1 + 0.05) / (lum2 + 0.05);
  11427. }
  11428. return (lum2 + 0.05) / (lum1 + 0.05);
  11429. },
  11430. level(color2) {
  11431. // https://www.w3.org/TR/WCAG/#contrast-enhanced
  11432. const contrastRatio = this.contrast(color2);
  11433. if (contrastRatio >= 7) {
  11434. return 'AAA';
  11435. }
  11436. return (contrastRatio >= 4.5) ? 'AA' : '';
  11437. },
  11438. isDark() {
  11439. // YIQ equation from http://24ways.org/2010/calculating-color-contrast
  11440. const rgb = this.rgb().color;
  11441. const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
  11442. return yiq < 128;
  11443. },
  11444. isLight() {
  11445. return !this.isDark();
  11446. },
  11447. negate() {
  11448. const rgb = this.rgb();
  11449. for (let i = 0; i < 3; i++) {
  11450. rgb.color[i] = 255 - rgb.color[i];
  11451. }
  11452. return rgb;
  11453. },
  11454. lighten(ratio) {
  11455. const hsl = this.hsl();
  11456. hsl.color[2] += hsl.color[2] * ratio;
  11457. return hsl;
  11458. },
  11459. darken(ratio) {
  11460. const hsl = this.hsl();
  11461. hsl.color[2] -= hsl.color[2] * ratio;
  11462. return hsl;
  11463. },
  11464. saturate(ratio) {
  11465. const hsl = this.hsl();
  11466. hsl.color[1] += hsl.color[1] * ratio;
  11467. return hsl;
  11468. },
  11469. desaturate(ratio) {
  11470. const hsl = this.hsl();
  11471. hsl.color[1] -= hsl.color[1] * ratio;
  11472. return hsl;
  11473. },
  11474. whiten(ratio) {
  11475. const hwb = this.hwb();
  11476. hwb.color[1] += hwb.color[1] * ratio;
  11477. return hwb;
  11478. },
  11479. blacken(ratio) {
  11480. const hwb = this.hwb();
  11481. hwb.color[2] += hwb.color[2] * ratio;
  11482. return hwb;
  11483. },
  11484. grayscale() {
  11485. // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
  11486. const rgb = this.rgb().color;
  11487. const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
  11488. return Color.rgb(value, value, value);
  11489. },
  11490. fade(ratio) {
  11491. return this.alpha(this.valpha - (this.valpha * ratio));
  11492. },
  11493. opaquer(ratio) {
  11494. return this.alpha(this.valpha + (this.valpha * ratio));
  11495. },
  11496. rotate(degrees) {
  11497. const hsl = this.hsl();
  11498. let hue = hsl.color[0];
  11499. hue = (hue + degrees) % 360;
  11500. hue = hue < 0 ? 360 + hue : hue;
  11501. hsl.color[0] = hue;
  11502. return hsl;
  11503. },
  11504. mix(mixinColor, weight) {
  11505. // Ported from sass implementation in C
  11506. // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
  11507. if (!mixinColor || !mixinColor.rgb) {
  11508. throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
  11509. }
  11510. const color1 = mixinColor.rgb();
  11511. const color2 = this.rgb();
  11512. const p = weight === undefined ? 0.5 : weight;
  11513. const w = 2 * p - 1;
  11514. const a = color1.alpha() - color2.alpha();
  11515. const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;
  11516. const w2 = 1 - w1;
  11517. return Color.rgb(
  11518. w1 * color1.red() + w2 * color2.red(),
  11519. w1 * color1.green() + w2 * color2.green(),
  11520. w1 * color1.blue() + w2 * color2.blue(),
  11521. color1.alpha() * p + color2.alpha() * (1 - p));
  11522. },
  11523. };
  11524. // Model conversion methods and static constructors
  11525. for (const model of Object.keys(colorConvert)) {
  11526. if (skippedModels.includes(model)) {
  11527. continue;
  11528. }
  11529. const {channels} = colorConvert[model];
  11530. // Conversion methods
  11531. Color.prototype[model] = function (...args) {
  11532. if (this.model === model) {
  11533. return new Color(this);
  11534. }
  11535. if (args.length > 0) {
  11536. return new Color(args, model);
  11537. }
  11538. return new Color([...assertArray(colorConvert[this.model][model].raw(this.color)), this.valpha], model);
  11539. };
  11540. // 'static' construction methods
  11541. Color[model] = function (...args) {
  11542. let color = args[0];
  11543. if (typeof color === 'number') {
  11544. color = zeroArray(args, channels);
  11545. }
  11546. return new Color(color, model);
  11547. };
  11548. }
  11549. function roundTo(number, places) {
  11550. return Number(number.toFixed(places));
  11551. }
  11552. function roundToPlace(places) {
  11553. return function (number) {
  11554. return roundTo(number, places);
  11555. };
  11556. }
  11557. function getset(model, channel, modifier) {
  11558. model = Array.isArray(model) ? model : [model];
  11559. for (const m of model) {
  11560. (limiters[m] || (limiters[m] = []))[channel] = modifier;
  11561. }
  11562. model = model[0];
  11563. return function (value) {
  11564. let result;
  11565. if (value !== undefined) {
  11566. if (modifier) {
  11567. value = modifier(value);
  11568. }
  11569. result = this[model]();
  11570. result.color[channel] = value;
  11571. return result;
  11572. }
  11573. result = this[model]().color[channel];
  11574. if (modifier) {
  11575. result = modifier(result);
  11576. }
  11577. return result;
  11578. };
  11579. }
  11580. function maxfn(max) {
  11581. return function (v) {
  11582. return Math.max(0, Math.min(max, v));
  11583. };
  11584. }
  11585. function assertArray(value) {
  11586. return Array.isArray(value) ? value : [value];
  11587. }
  11588. function zeroArray(array, length) {
  11589. for (let i = 0; i < length; i++) {
  11590. if (typeof array[i] !== 'number') {
  11591. array[i] = 0;
  11592. }
  11593. }
  11594. return array;
  11595. }
  11596. var color = Color;
  11597. const CSS$G = {
  11598. container: "container",
  11599. controlSection: "control-section",
  11600. hexOptions: "color-hex-options",
  11601. section: "section",
  11602. header: "header",
  11603. control: "control",
  11604. splitSection: "section--split",
  11605. colorModeContainer: "color-mode-container",
  11606. colorMode: "color-mode",
  11607. channels: "channels",
  11608. channel: "channel",
  11609. savedColors: "saved-colors",
  11610. savedColorsSection: "saved-colors-section",
  11611. saveColor: "save-color",
  11612. deleteColor: "delete-color",
  11613. savedColorsButtons: "saved-colors-buttons",
  11614. headerHex: "header--hex",
  11615. colorFieldAndSlider: "color-field-and-slider",
  11616. colorFieldAndSliderInteractive: "color-field-and-slider--interactive",
  11617. colorFieldAndSliderWrap: "color-field-and-slider-wrap",
  11618. scope: "scope",
  11619. hueScope: "scope--hue",
  11620. colorFieldScope: "scope--color-field",
  11621. savedColor: "saved-color"
  11622. };
  11623. const DEFAULT_COLOR$1 = color("#007AC2");
  11624. const DEFAULT_STORAGE_KEY_PREFIX = "calcite-color-";
  11625. const RGB_LIMITS = {
  11626. r: 255,
  11627. g: 255,
  11628. b: 255
  11629. };
  11630. const HSV_LIMITS = {
  11631. h: 360,
  11632. s: 100,
  11633. v: 100
  11634. };
  11635. const TEXT$h = {
  11636. b: "B",
  11637. blue: "Blue",
  11638. deleteColor: "Delete color",
  11639. g: "G",
  11640. green: "Green",
  11641. h: "H",
  11642. hsv: "HSV",
  11643. hex: "Hex",
  11644. hue: "Hue",
  11645. noColor: "No color",
  11646. r: "R",
  11647. red: "Red",
  11648. rgb: "RGB",
  11649. s: "S",
  11650. saturation: "Saturation",
  11651. saveColor: "Save color",
  11652. saved: "Saved",
  11653. v: "V",
  11654. value: "Value"
  11655. };
  11656. const DIMENSIONS = {
  11657. s: {
  11658. slider: {
  11659. height: 10,
  11660. width: 160
  11661. },
  11662. colorField: {
  11663. height: 80,
  11664. width: 160
  11665. },
  11666. thumb: {
  11667. radius: 8
  11668. }
  11669. },
  11670. m: {
  11671. slider: {
  11672. height: 14,
  11673. width: 272
  11674. },
  11675. colorField: {
  11676. height: 150,
  11677. width: 272
  11678. },
  11679. thumb: {
  11680. radius: 10
  11681. }
  11682. },
  11683. l: {
  11684. slider: {
  11685. height: 16,
  11686. width: 464
  11687. },
  11688. colorField: {
  11689. height: 200,
  11690. width: 464
  11691. },
  11692. thumb: {
  11693. radius: 12
  11694. }
  11695. }
  11696. };
  11697. const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
  11698. const decimalPlaces = (value) => {
  11699. const match = ("" + value).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
  11700. if (!match) {
  11701. return 0;
  11702. }
  11703. return Math.max(0,
  11704. // Number of digits right of decimal point.
  11705. (match[1] ? match[1].length : 0) -
  11706. // Adjust for scientific notation.
  11707. (match[2] ? +match[2] : 0));
  11708. };
  11709. const colorPickerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-color-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-color-picker{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-color-picker:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-color-picker-h{display:none}/*!@:host*/.sc-calcite-color-picker-h{display:inline-block;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}/*!@:host([disabled])*/[disabled].sc-calcite-color-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-color-picker-h[disabled] .sc-calcite-color-picker-s>[calcite-hydrated][disabled],[disabled].sc-calcite-color-picker-h [calcite-hydrated][disabled].sc-calcite-color-picker{opacity:1}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-color-picker-h .container.sc-calcite-color-picker{width:160px}/*!@:host([scale=s]) .saved-colors*/[scale=s].sc-calcite-color-picker-h .saved-colors.sc-calcite-color-picker{grid-template-columns:repeat(auto-fill, minmax(20px, 1fr))}/*!@:host([scale=s]) .channels*/[scale=s].sc-calcite-color-picker-h .channels.sc-calcite-color-picker{-ms-flex-direction:column;flex-direction:column}/*!@:host([scale=s]) .channel*/[scale=s].sc-calcite-color-picker-h .channel.sc-calcite-color-picker{width:100%;margin-bottom:4px}/*!@:host([scale=s]) .channel:last-child*/[scale=s].sc-calcite-color-picker-h .channel.sc-calcite-color-picker:last-child{margin-bottom:0}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-color-picker-h .container.sc-calcite-color-picker{width:272px}/*!@:host([scale=l]) .header*/[scale=l].sc-calcite-color-picker-h .header.sc-calcite-color-picker{padding-bottom:0px}/*!@:host([scale=l])*/[scale=l].sc-calcite-color-picker-h{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-color-picker-h .container.sc-calcite-color-picker{width:464px}/*!@:host([scale=l]) .color-field-and-slider*/[scale=l].sc-calcite-color-picker-h .color-field-and-slider.sc-calcite-color-picker{margin-bottom:-20px}/*!@:host([scale=l]) .section*/[scale=l].sc-calcite-color-picker-h .section.sc-calcite-color-picker{padding:0 16px 16px}/*!@:host([scale=l]) .section:first-of-type*/[scale=l].sc-calcite-color-picker-h .section.sc-calcite-color-picker:first-of-type{padding-top:16px}/*!@:host([scale=l]) .saved-colors*/[scale=l].sc-calcite-color-picker-h .saved-colors.sc-calcite-color-picker{grid-template-columns:repeat(auto-fill, minmax(28px, 1fr));grid-gap:12px;padding-top:16px}/*!@:host([scale=l]) .control-section*/[scale=l].sc-calcite-color-picker-h .control-section.sc-calcite-color-picker{-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:baseline;align-items:baseline}/*!@:host([scale=l]) .control-section > :nth-child(2)*/[scale=l].sc-calcite-color-picker-h .control-section.sc-calcite-color-picker>.sc-calcite-color-picker:nth-child(2){-webkit-margin-start:12px;margin-inline-start:12px}/*!@:host([scale=l]) .color-hex-options*/[scale=l].sc-calcite-color-picker-h .color-hex-options.sc-calcite-color-picker{display:-ms-flexbox;display:flex;-ms-flex-negative:1;flex-shrink:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:distribute;justify-content:space-around;min-height:98px;width:160px}/*!@:host([scale=l]) .color-mode-container*/[scale=l].sc-calcite-color-picker-h .color-mode-container.sc-calcite-color-picker{-ms-flex-negative:3;flex-shrink:3}/*!@:host([appearance=minimal]) .container*/[appearance=minimal].sc-calcite-color-picker-h .container.sc-calcite-color-picker{border:none}/*!@.container*/.container.sc-calcite-color-picker{background-color:var(--calcite-ui-foreground-1);display:inline-block;border:1px solid var(--calcite-ui-border-1)}/*!@.color-field-and-slider-wrap*/.color-field-and-slider-wrap.sc-calcite-color-picker{position:relative}/*!@.scope*/.scope.sc-calcite-color-picker{pointer-events:none;position:absolute;font-size:var(--calcite-font-size--1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;outline-offset:14px}/*!@.scope:focus*/.scope.sc-calcite-color-picker:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:16px}/*!@.color-field-and-slider*/.color-field-and-slider.sc-calcite-color-picker{margin-bottom:-16px}/*!@.color-field-and-slider--interactive*/.color-field-and-slider--interactive.sc-calcite-color-picker{cursor:pointer}/*!@.control-section*/.control-section.sc-calcite-color-picker{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}/*!@.section*/.section.sc-calcite-color-picker{padding:0 12px 12px}/*!@.section:first-of-type*/.section.sc-calcite-color-picker:first-of-type{padding-top:12px}/*!@.color-hex-options,\n.section--split*/.color-hex-options.sc-calcite-color-picker,.section--split.sc-calcite-color-picker{-ms-flex-positive:1;flex-grow:1}/*!@.header*/.header.sc-calcite-color-picker{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding-bottom:0.25rem;color:var(--calcite-ui-text-1)}/*!@.header--hex,\n.color-mode-container*/.header--hex.sc-calcite-color-picker,.color-mode-container.sc-calcite-color-picker{padding-top:12px}/*!@.channels*/.channels.sc-calcite-color-picker{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}/*!@.channel*/.channel.sc-calcite-color-picker{width:31%}/*!@.saved-colors*/.saved-colors.sc-calcite-color-picker{padding-top:12px;display:grid;grid-template-columns:repeat(auto-fill, minmax(24px, 1fr));grid-gap:8px;width:100%}/*!@.saved-colors-buttons*/.saved-colors-buttons.sc-calcite-color-picker{display:-ms-flexbox;display:flex}/*!@.saved-color*/.saved-color.sc-calcite-color-picker{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;cursor:pointer}/*!@.saved-color:focus*/.saved-color.sc-calcite-color-picker:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.saved-color:hover*/.saved-color.sc-calcite-color-picker:hover{-webkit-transition:outline-color var(--calcite-internal-animation-timing-fast) ease-in-out;transition:outline-color var(--calcite-internal-animation-timing-fast) ease-in-out;outline:2px solid var(--calcite-ui-border-2);outline-offset:2px}";
  11710. const throttleFor60FpsInMs = 16;
  11711. const defaultValue = normalizeHex(DEFAULT_COLOR$1.hex());
  11712. const defaultFormat = "auto";
  11713. class ColorPicker {
  11714. constructor(hostRef) {
  11715. registerInstance(this, hostRef);
  11716. this.calciteColorPickerChange = createEvent(this, "calciteColorPickerChange", 7);
  11717. this.calciteColorPickerInput = createEvent(this, "calciteColorPickerInput", 7);
  11718. //--------------------------------------------------------------------------
  11719. //
  11720. // Public properties
  11721. //
  11722. //--------------------------------------------------------------------------
  11723. /**
  11724. * When false, empty color (null) will be allowed as a value. Otherwise, a color value is always enforced by the component.
  11725. *
  11726. * When true, clearing the input and blurring will restore the last valid color set. When false, it will set it to empty.
  11727. */
  11728. this.allowEmpty = false;
  11729. /** specify the appearance - default (containing border), or minimal (no containing border) */
  11730. this.appearance = "default";
  11731. /**
  11732. * Internal prop for advanced use-cases.
  11733. *
  11734. * @internal
  11735. */
  11736. this.color = DEFAULT_COLOR$1;
  11737. /**
  11738. * When true, disabled prevents user interaction.
  11739. */
  11740. this.disabled = false;
  11741. /**
  11742. * The format of the value property.
  11743. *
  11744. * When "auto", the format will be inferred from `value` when set.
  11745. * @default "auto"
  11746. */
  11747. this.format = defaultFormat;
  11748. /** When true, hides the hex input */
  11749. this.hideHex = false;
  11750. /** When true, hides the RGB/HSV channel inputs */
  11751. this.hideChannels = false;
  11752. /** When true, hides the saved colors section */
  11753. this.hideSaved = false;
  11754. /** Label used for the blue channel
  11755. * @default "B"
  11756. */
  11757. this.intlB = TEXT$h.b;
  11758. /** Label used for the blue channel description
  11759. * @default "Blue"
  11760. */
  11761. this.intlBlue = TEXT$h.blue;
  11762. /** Label used for the delete color button.
  11763. * @default "Delete color"
  11764. */
  11765. this.intlDeleteColor = TEXT$h.deleteColor;
  11766. /** Label used for the green channel
  11767. * @default "G"
  11768. */
  11769. this.intlG = TEXT$h.g;
  11770. /** Label used for the green channel description
  11771. * @default "Green"
  11772. */
  11773. this.intlGreen = TEXT$h.green;
  11774. /** Label used for the hue channel
  11775. * @default "H"
  11776. */
  11777. this.intlH = TEXT$h.h;
  11778. /** Label used for the HSV mode
  11779. * @default "HSV"
  11780. */
  11781. this.intlHsv = TEXT$h.hsv;
  11782. /** Label used for the hex input
  11783. * @default "Hex"
  11784. */
  11785. this.intlHex = TEXT$h.hex;
  11786. /** Label used for the hue channel description
  11787. * @default "Hue"
  11788. */
  11789. this.intlHue = TEXT$h.hue;
  11790. /**
  11791. * Label used for the hex input when there is no color selected.
  11792. * @default "No color"
  11793. */
  11794. this.intlNoColor = TEXT$h.noColor;
  11795. /** Label used for the red channel
  11796. * @default "R"
  11797. */
  11798. this.intlR = TEXT$h.r;
  11799. /** Label used for the red channel description
  11800. * @default "Red"
  11801. */
  11802. this.intlRed = TEXT$h.red;
  11803. /** Label used for the RGB mode
  11804. * @default "RGB"
  11805. */
  11806. this.intlRgb = TEXT$h.rgb;
  11807. /** Label used for the saturation channel
  11808. * @default "S"
  11809. */
  11810. this.intlS = TEXT$h.s;
  11811. /** Label used for the saturation channel description
  11812. * @default "Saturation"
  11813. */
  11814. this.intlSaturation = TEXT$h.saturation;
  11815. /** Label used for the save color button.
  11816. * @default "Save color"
  11817. */
  11818. this.intlSaveColor = TEXT$h.saveColor;
  11819. /** Label used for the saved colors section
  11820. * @default "Saved"
  11821. */
  11822. this.intlSaved = TEXT$h.saved;
  11823. /** Label used for the value channel
  11824. * @default "V"
  11825. */
  11826. this.intlV = TEXT$h.v;
  11827. /** Label used for the
  11828. * @default "Value"
  11829. */
  11830. this.intlValue = TEXT$h.value;
  11831. /**
  11832. * The scale of the color picker.
  11833. */
  11834. this.scale = "m";
  11835. /**
  11836. * The color value.
  11837. *
  11838. * This value can be either a {@link https://developer.mozilla.org/en-US/docs/Web/CSS/color|CSS string}
  11839. * a RGB, HSL or HSV object.
  11840. *
  11841. * The type will be preserved as the color is updated.
  11842. * @default "#007ac2"
  11843. * @see [ColorValue](https://github.com/Esri/calcite-components/blob/master/src/components/color-picker/interfaces.ts#L10)
  11844. */
  11845. this.value = defaultValue;
  11846. this.colorFieldAndSliderHovered = false;
  11847. this.hueThumbState = "idle";
  11848. this.internalColorUpdateContext = null;
  11849. this.mode = CSSColorMode.HEX;
  11850. this.shiftKeyChannelAdjustment = 0;
  11851. this.sliderThumbState = "idle";
  11852. this.colorFieldAndSliderInteractive = false;
  11853. this.channelMode = "rgb";
  11854. this.channels = this.toChannels(DEFAULT_COLOR$1);
  11855. this.dimensions = DIMENSIONS.m;
  11856. this.savedColors = [];
  11857. this.handleTabActivate = (event) => {
  11858. this.channelMode = event.currentTarget.getAttribute("data-color-mode");
  11859. this.updateChannelsFromColor(this.color);
  11860. };
  11861. this.handleColorFieldScopeKeyDown = (event) => {
  11862. const key = event.key;
  11863. const arrowKeyToXYOffset = {
  11864. ArrowUp: { x: 0, y: -10 },
  11865. ArrowRight: { x: 10, y: 0 },
  11866. ArrowDown: { x: 0, y: 10 },
  11867. ArrowLeft: { x: -10, y: 0 }
  11868. };
  11869. if (arrowKeyToXYOffset[key]) {
  11870. event.preventDefault();
  11871. this.scopeOrientation = key === "ArrowDown" || key === "ArrowUp" ? "vertical" : "horizontal";
  11872. this.captureColorFieldColor(this.colorFieldScopeLeft + arrowKeyToXYOffset[key].x || 0, this.colorFieldScopeTop + arrowKeyToXYOffset[key].y || 0, false);
  11873. }
  11874. };
  11875. this.handleHueScopeKeyDown = (event) => {
  11876. const modifier = event.shiftKey ? 10 : 1;
  11877. const key = event.key;
  11878. const arrowKeyToXOffset = {
  11879. ArrowUp: 1,
  11880. ArrowRight: 1,
  11881. ArrowDown: -1,
  11882. ArrowLeft: -1
  11883. };
  11884. if (arrowKeyToXOffset[key]) {
  11885. event.preventDefault();
  11886. const delta = arrowKeyToXOffset[key] * modifier;
  11887. const hue = this.baseColorFieldColor.hue();
  11888. const color = this.baseColorFieldColor.hue(hue + delta);
  11889. this.internalColorSet(color, false);
  11890. }
  11891. };
  11892. this.handleHexInputChange = (event) => {
  11893. event.stopPropagation();
  11894. const { allowEmpty, color: color$1 } = this;
  11895. const input = event.target;
  11896. const hex = input.value;
  11897. if (allowEmpty && !hex) {
  11898. this.internalColorSet(null);
  11899. return;
  11900. }
  11901. const normalizedHex = color$1 && normalizeHex(color$1.hex());
  11902. if (hex !== normalizedHex) {
  11903. this.internalColorSet(color(hex));
  11904. }
  11905. };
  11906. this.handleSavedColorSelect = (event) => {
  11907. const swatch = event.currentTarget;
  11908. this.internalColorSet(color(swatch.color));
  11909. };
  11910. this.handleChannelInput = (event) => {
  11911. const input = event.currentTarget;
  11912. const internalInput = event.detail.nativeEvent.target;
  11913. const channelIndex = Number(input.getAttribute("data-channel-index"));
  11914. const limit = this.channelMode === "rgb"
  11915. ? RGB_LIMITS[Object.keys(RGB_LIMITS)[channelIndex]]
  11916. : HSV_LIMITS[Object.keys(HSV_LIMITS)[channelIndex]];
  11917. let inputValue;
  11918. if (this.allowEmpty && !input.value) {
  11919. inputValue = "";
  11920. }
  11921. else {
  11922. const value = Number(input.value) + this.shiftKeyChannelAdjustment;
  11923. const clamped = clamp(value, 0, limit);
  11924. inputValue = clamped.toString();
  11925. }
  11926. input.value = inputValue;
  11927. internalInput.value = inputValue;
  11928. };
  11929. this.handleChannelChange = (event) => {
  11930. const input = event.currentTarget;
  11931. const channelIndex = Number(input.getAttribute("data-channel-index"));
  11932. const channels = [...this.channels];
  11933. const shouldClearChannels = this.allowEmpty && !input.value;
  11934. if (shouldClearChannels) {
  11935. this.channels = [null, null, null];
  11936. this.internalColorSet(null);
  11937. return;
  11938. }
  11939. channels[channelIndex] = Number(input.value);
  11940. this.updateColorFromChannels(channels);
  11941. };
  11942. this.handleSavedColorKeyDown = (event) => {
  11943. if (event.key === " " || event.key === "Enter") {
  11944. event.preventDefault();
  11945. event.stopPropagation();
  11946. this.handleSavedColorSelect(event);
  11947. }
  11948. };
  11949. this.handleColorFieldAndSliderMouseLeave = () => {
  11950. this.colorFieldAndSliderInteractive = false;
  11951. this.colorFieldAndSliderHovered = false;
  11952. if (this.sliderThumbState !== "drag" && this.hueThumbState !== "drag") {
  11953. this.hueThumbState = "idle";
  11954. this.sliderThumbState = "idle";
  11955. this.drawColorFieldAndSlider();
  11956. }
  11957. };
  11958. this.handleColorFieldAndSliderMouseDown = (event) => {
  11959. const { offsetX, offsetY } = event;
  11960. const region = this.getCanvasRegion(offsetY);
  11961. if (region === "color-field") {
  11962. this.hueThumbState = "drag";
  11963. this.captureColorFieldColor(offsetX, offsetY);
  11964. this.colorFieldScopeNode.focus();
  11965. }
  11966. else if (region === "slider") {
  11967. this.sliderThumbState = "drag";
  11968. this.captureHueSliderColor(offsetX);
  11969. this.hueScopeNode.focus();
  11970. }
  11971. // prevent text selection outside of color field & slider area
  11972. event.preventDefault();
  11973. document.addEventListener("mousemove", this.globalMouseMoveHandler);
  11974. document.addEventListener("mouseup", this.globalMouseUpHandler, { once: true });
  11975. this.activeColorFieldAndSliderRect =
  11976. this.fieldAndSliderRenderingContext.canvas.getBoundingClientRect();
  11977. };
  11978. this.globalMouseUpHandler = () => {
  11979. const previouslyDragging = this.sliderThumbState === "drag" || this.hueThumbState === "drag";
  11980. this.hueThumbState = "idle";
  11981. this.sliderThumbState = "idle";
  11982. this.activeColorFieldAndSliderRect = null;
  11983. this.drawColorFieldAndSlider();
  11984. if (previouslyDragging) {
  11985. this.calciteColorPickerChange.emit();
  11986. }
  11987. };
  11988. this.globalMouseMoveHandler = (event) => {
  11989. const { el, dimensions } = this;
  11990. const sliderThumbDragging = this.sliderThumbState === "drag";
  11991. const hueThumbDragging = this.hueThumbState === "drag";
  11992. if (!el.isConnected || (!sliderThumbDragging && !hueThumbDragging)) {
  11993. return;
  11994. }
  11995. let samplingX;
  11996. let samplingY;
  11997. const colorFieldAndSliderRect = this.activeColorFieldAndSliderRect;
  11998. const { clientX, clientY } = event;
  11999. if (this.colorFieldAndSliderHovered) {
  12000. samplingX = clientX - colorFieldAndSliderRect.x;
  12001. samplingY = clientY - colorFieldAndSliderRect.y;
  12002. }
  12003. else {
  12004. const colorFieldWidth = dimensions.colorField.width;
  12005. const colorFieldHeight = dimensions.colorField.height;
  12006. const hueSliderHeight = dimensions.slider.height;
  12007. if (clientX < colorFieldAndSliderRect.x + colorFieldWidth &&
  12008. clientX > colorFieldAndSliderRect.x) {
  12009. samplingX = clientX - colorFieldAndSliderRect.x;
  12010. }
  12011. else if (clientX < colorFieldAndSliderRect.x) {
  12012. samplingX = 0;
  12013. }
  12014. else {
  12015. samplingX = colorFieldWidth;
  12016. }
  12017. if (clientY < colorFieldAndSliderRect.y + colorFieldHeight + hueSliderHeight &&
  12018. clientY > colorFieldAndSliderRect.y) {
  12019. samplingY = clientY - colorFieldAndSliderRect.y;
  12020. }
  12021. else if (clientY < colorFieldAndSliderRect.y) {
  12022. samplingY = 0;
  12023. }
  12024. else {
  12025. samplingY = colorFieldHeight + hueSliderHeight;
  12026. }
  12027. }
  12028. if (hueThumbDragging) {
  12029. this.captureColorFieldColor(samplingX, samplingY, false);
  12030. }
  12031. else {
  12032. this.captureHueSliderColor(samplingX);
  12033. }
  12034. };
  12035. this.handleColorFieldAndSliderMouseEnterOrMove = ({ offsetX, offsetY }) => {
  12036. const { dimensions: { colorField, slider, thumb } } = this;
  12037. this.colorFieldAndSliderInteractive = offsetY <= colorField.height + slider.height;
  12038. this.colorFieldAndSliderHovered = true;
  12039. const region = this.getCanvasRegion(offsetY);
  12040. if (region === "color-field") {
  12041. const prevHueThumbState = this.hueThumbState;
  12042. const color = this.baseColorFieldColor.hsv();
  12043. const centerX = Math.round(color.saturationv() / (HSV_LIMITS.s / colorField.width));
  12044. const centerY = Math.round(colorField.height - color.value() / (HSV_LIMITS.v / colorField.height));
  12045. const hoveringThumb = this.containsPoint(offsetX, offsetY, centerX, centerY, thumb.radius);
  12046. let transitionedBetweenHoverAndIdle = false;
  12047. if (prevHueThumbState === "idle" && hoveringThumb) {
  12048. this.hueThumbState = "hover";
  12049. transitionedBetweenHoverAndIdle = true;
  12050. }
  12051. else if (prevHueThumbState === "hover" && !hoveringThumb) {
  12052. this.hueThumbState = "idle";
  12053. transitionedBetweenHoverAndIdle = true;
  12054. }
  12055. if (this.hueThumbState !== "drag") {
  12056. if (transitionedBetweenHoverAndIdle) {
  12057. // refresh since we won't update color and thus no redraw
  12058. this.drawColorFieldAndSlider();
  12059. }
  12060. }
  12061. }
  12062. else if (region === "slider") {
  12063. const sliderThumbColor = this.baseColorFieldColor.hsv().saturationv(100).value(100);
  12064. const prevSliderThumbState = this.sliderThumbState;
  12065. const sliderThumbCenterX = Math.round(sliderThumbColor.hue() / (360 / slider.width));
  12066. const sliderThumbCenterY = Math.round((slider.height + this.getSliderCapSpacing()) / 2) + colorField.height;
  12067. const hoveringSliderThumb = this.containsPoint(offsetX, offsetY, sliderThumbCenterX, sliderThumbCenterY, thumb.radius);
  12068. let sliderThumbTransitionedBetweenHoverAndIdle = false;
  12069. if (prevSliderThumbState === "idle" && hoveringSliderThumb) {
  12070. this.sliderThumbState = "hover";
  12071. sliderThumbTransitionedBetweenHoverAndIdle = true;
  12072. }
  12073. else if (prevSliderThumbState === "hover" && !hoveringSliderThumb) {
  12074. this.sliderThumbState = "idle";
  12075. sliderThumbTransitionedBetweenHoverAndIdle = true;
  12076. }
  12077. if (this.sliderThumbState !== "drag") {
  12078. if (sliderThumbTransitionedBetweenHoverAndIdle) {
  12079. // refresh since we won't update color and thus no redraw
  12080. this.drawColorFieldAndSlider();
  12081. }
  12082. }
  12083. }
  12084. };
  12085. this.storeColorFieldScope = (node) => {
  12086. this.colorFieldScopeNode = node;
  12087. };
  12088. this.storeHueScope = (node) => {
  12089. this.hueScopeNode = node;
  12090. };
  12091. this.renderChannelsTabTitle = (channelMode) => {
  12092. const { channelMode: activeChannelMode, intlRgb, intlHsv } = this;
  12093. const active = channelMode === activeChannelMode;
  12094. const label = channelMode === "rgb" ? intlRgb : intlHsv;
  12095. return (hAsync("calcite-tab-title", { active: active, class: CSS$G.colorMode, "data-color-mode": channelMode, key: channelMode, onCalciteTabsActivate: this.handleTabActivate }, label));
  12096. };
  12097. this.renderChannelsTab = (channelMode) => {
  12098. const { channelMode: activeChannelMode, channels, intlB, intlBlue, intlG, intlGreen, intlH, intlHue, intlR, intlRed, intlS, intlSaturation, intlV, intlValue } = this;
  12099. const active = channelMode === activeChannelMode;
  12100. const isRgb = channelMode === "rgb";
  12101. const channelLabels = isRgb ? [intlR, intlG, intlB] : [intlH, intlS, intlV];
  12102. const channelAriaLabels = isRgb
  12103. ? [intlRed, intlGreen, intlBlue]
  12104. : [intlHue, intlSaturation, intlValue];
  12105. const direction = getElementDir(this.el);
  12106. return (hAsync("calcite-tab", { active: active, class: CSS$G.control, key: channelMode }, hAsync("div", { class: CSS$G.channels, dir: "ltr" }, channels.map((channel, index) =>
  12107. /* the channel container is ltr, so we apply the host's direction */
  12108. this.renderChannel(channel, index, channelLabels[index], channelAriaLabels[index], direction)))));
  12109. };
  12110. this.renderChannel = (value, index, label, ariaLabel, direction) => (hAsync("calcite-input", { class: CSS$G.channel, "data-channel-index": index, dir: direction, label: ariaLabel, numberButtonType: "none", onCalciteInputChange: this.handleChannelChange, onCalciteInputInput: this.handleChannelInput, onKeyDown: this.handleKeyDown, prefixText: label, scale: this.scale === "l" ? "m" : "s", type: "number", value: value === null || value === void 0 ? void 0 : value.toString() }));
  12111. this.deleteColor = () => {
  12112. const colorToDelete = this.color.hex();
  12113. const inStorage = this.savedColors.indexOf(colorToDelete) > -1;
  12114. if (!inStorage) {
  12115. return;
  12116. }
  12117. const savedColors = this.savedColors.filter((color) => color !== colorToDelete);
  12118. this.savedColors = savedColors;
  12119. const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
  12120. if (this.storageId) {
  12121. localStorage.setItem(storageKey, JSON.stringify(savedColors));
  12122. }
  12123. };
  12124. this.saveColor = () => {
  12125. const colorToSave = this.color.hex();
  12126. const alreadySaved = this.savedColors.indexOf(colorToSave) > -1;
  12127. if (alreadySaved) {
  12128. return;
  12129. }
  12130. const savedColors = [...this.savedColors, colorToSave];
  12131. this.savedColors = savedColors;
  12132. const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
  12133. if (this.storageId) {
  12134. localStorage.setItem(storageKey, JSON.stringify(savedColors));
  12135. }
  12136. };
  12137. this.drawColorFieldAndSlider = throttle$1(() => {
  12138. if (!this.fieldAndSliderRenderingContext) {
  12139. return;
  12140. }
  12141. this.drawColorField();
  12142. this.drawHueSlider();
  12143. }, throttleFor60FpsInMs);
  12144. this.captureColorFieldColor = (x, y, skipEqual = true) => {
  12145. const { dimensions: { colorField: { height, width } } } = this;
  12146. const saturation = Math.round((HSV_LIMITS.s / width) * x);
  12147. const value = Math.round((HSV_LIMITS.v / height) * (height - y));
  12148. this.internalColorSet(this.baseColorFieldColor.hsv().saturationv(saturation).value(value), skipEqual);
  12149. };
  12150. this.initColorFieldAndSlider = (canvas) => {
  12151. this.fieldAndSliderRenderingContext = canvas.getContext("2d");
  12152. this.setCanvasContextSize(canvas, {
  12153. width: this.dimensions.colorField.width,
  12154. height: this.dimensions.colorField.height +
  12155. this.dimensions.slider.height +
  12156. this.getSliderCapSpacing() * 2
  12157. });
  12158. this.drawColorFieldAndSlider();
  12159. };
  12160. }
  12161. handleColorChange(color, oldColor) {
  12162. this.drawColorFieldAndSlider();
  12163. this.updateChannelsFromColor(color);
  12164. this.previousColor = oldColor;
  12165. }
  12166. handleFormatChange(format) {
  12167. this.setMode(format);
  12168. this.internalColorSet(this.color, false, "internal");
  12169. }
  12170. handleScaleChange(scale = "m") {
  12171. this.updateDimensions(scale);
  12172. }
  12173. handleValueChange(value, oldValue) {
  12174. const { allowEmpty, format } = this;
  12175. const checkMode = !allowEmpty || value;
  12176. let modeChanged = false;
  12177. if (checkMode) {
  12178. const nextMode = parseMode(value);
  12179. if (!nextMode || (format !== "auto" && nextMode !== format)) {
  12180. this.showIncompatibleColorWarning(value, format);
  12181. this.value = oldValue;
  12182. return;
  12183. }
  12184. modeChanged = this.mode !== nextMode;
  12185. this.setMode(nextMode);
  12186. }
  12187. const dragging = this.sliderThumbState === "drag" || this.hueThumbState === "drag";
  12188. if (this.internalColorUpdateContext === "initial") {
  12189. return;
  12190. }
  12191. if (this.internalColorUpdateContext === "user-interaction") {
  12192. this.calciteColorPickerInput.emit();
  12193. if (!dragging) {
  12194. this.calciteColorPickerChange.emit();
  12195. }
  12196. return;
  12197. }
  12198. const color$1 = allowEmpty && !value ? null : color(value);
  12199. const colorChanged = !colorEqual(color$1, this.color);
  12200. if (modeChanged || colorChanged) {
  12201. this.internalColorSet(color$1, true, "internal");
  12202. }
  12203. }
  12204. //--------------------------------------------------------------------------
  12205. //
  12206. // Internal State/Props
  12207. //
  12208. //--------------------------------------------------------------------------
  12209. get baseColorFieldColor() {
  12210. return this.color || this.previousColor || DEFAULT_COLOR$1;
  12211. }
  12212. // using @Listen as a workaround for VDOM listener not firing
  12213. handleChannelKeyUpOrDown(event) {
  12214. this.shiftKeyChannelAdjustment = 0;
  12215. const key = event.key;
  12216. if ((key !== "ArrowUp" && key !== "ArrowDown") ||
  12217. !event.composedPath().some((node) => { var _a; return (_a = node.classList) === null || _a === void 0 ? void 0 : _a.contains(CSS$G.channel); })) {
  12218. return;
  12219. }
  12220. const { shiftKey } = event;
  12221. event.preventDefault();
  12222. if (!this.color) {
  12223. this.internalColorSet(this.previousColor);
  12224. event.stopPropagation();
  12225. return;
  12226. }
  12227. // this gets applied to the input's up/down arrow increment/decrement
  12228. const complementaryBump = 9;
  12229. this.shiftKeyChannelAdjustment =
  12230. key === "ArrowUp" && shiftKey
  12231. ? complementaryBump
  12232. : key === "ArrowDown" && shiftKey
  12233. ? -complementaryBump
  12234. : 0;
  12235. }
  12236. //--------------------------------------------------------------------------
  12237. //
  12238. // Public Methods
  12239. //
  12240. //--------------------------------------------------------------------------
  12241. /** Sets focus on the component. */
  12242. async setFocus() {
  12243. return focusElement(this.colorFieldScopeNode);
  12244. }
  12245. //--------------------------------------------------------------------------
  12246. //
  12247. // Lifecycle
  12248. //
  12249. //--------------------------------------------------------------------------
  12250. componentWillLoad() {
  12251. const { allowEmpty, color: color$1, format, value } = this;
  12252. const willSetNoColor = allowEmpty && !value;
  12253. const parsedMode = parseMode(value);
  12254. const valueIsCompatible = willSetNoColor || (format === "auto" && parsedMode) || format === parsedMode;
  12255. const initialColor = willSetNoColor ? null : valueIsCompatible ? color(value) : color$1;
  12256. if (!valueIsCompatible) {
  12257. this.showIncompatibleColorWarning(value, format);
  12258. }
  12259. this.setMode(format);
  12260. this.internalColorSet(initialColor, false, "initial");
  12261. this.updateDimensions(this.scale);
  12262. const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
  12263. if (this.storageId && localStorage.getItem(storageKey)) {
  12264. this.savedColors = JSON.parse(localStorage.getItem(storageKey));
  12265. }
  12266. }
  12267. disconnectedCallback() {
  12268. document.removeEventListener("mousemove", this.globalMouseMoveHandler);
  12269. document.removeEventListener("mouseup", this.globalMouseUpHandler);
  12270. }
  12271. componentDidRender() {
  12272. updateHostInteraction(this);
  12273. }
  12274. //--------------------------------------------------------------------------
  12275. //
  12276. // Render Methods
  12277. //
  12278. //--------------------------------------------------------------------------
  12279. render() {
  12280. const { allowEmpty, color, intlDeleteColor, hideHex, hideChannels, hideSaved, intlHex, intlSaved, intlSaveColor, savedColors, scale } = this;
  12281. const selectedColorInHex = color ? color.hex() : null;
  12282. const hexInputScale = scale === "l" ? "m" : "s";
  12283. const { colorFieldAndSliderInteractive, colorFieldScopeTop, colorFieldScopeLeft, hueScopeLeft, hueScopeTop, scopeOrientation, dimensions: { colorField: { height: colorFieldHeight, width: colorFieldWidth }, slider: { height: sliderHeight } } } = this;
  12284. const hueTop = hueScopeTop !== null && hueScopeTop !== void 0 ? hueScopeTop : sliderHeight / 2 + colorFieldHeight;
  12285. const hueLeft = hueScopeLeft !== null && hueScopeLeft !== void 0 ? hueScopeLeft : (colorFieldWidth * DEFAULT_COLOR$1.hue()) / HSV_LIMITS.h;
  12286. const noColor = color === null;
  12287. const vertical = scopeOrientation === "vertical";
  12288. return (hAsync("div", { class: CSS$G.container }, hAsync("div", { class: CSS$G.colorFieldAndSliderWrap }, hAsync("canvas", { class: {
  12289. [CSS$G.colorFieldAndSlider]: true,
  12290. [CSS$G.colorFieldAndSliderInteractive]: colorFieldAndSliderInteractive
  12291. }, onMouseDown: this.handleColorFieldAndSliderMouseDown, onMouseEnter: this.handleColorFieldAndSliderMouseEnterOrMove, onMouseLeave: this.handleColorFieldAndSliderMouseLeave, onMouseMove: this.handleColorFieldAndSliderMouseEnterOrMove, ref: this.initColorFieldAndSlider }), hAsync("div", { "aria-label": vertical ? this.intlValue : this.intlSaturation, "aria-valuemax": vertical ? HSV_LIMITS.v : HSV_LIMITS.s, "aria-valuemin": "0", "aria-valuenow": (vertical ? color === null || color === void 0 ? void 0 : color.saturationv() : color === null || color === void 0 ? void 0 : color.value()) || "0", class: { [CSS$G.scope]: true, [CSS$G.colorFieldScope]: true }, onKeyDown: this.handleColorFieldScopeKeyDown, ref: this.storeColorFieldScope, role: "slider", style: { top: `${colorFieldScopeTop || 0}px`, left: `${colorFieldScopeLeft || 0}px` }, tabindex: "0" }), hAsync("div", { "aria-label": this.intlHue, "aria-valuemax": HSV_LIMITS.h, "aria-valuemin": "0", "aria-valuenow": (color === null || color === void 0 ? void 0 : color.round().hue()) || DEFAULT_COLOR$1.round().hue(), class: { [CSS$G.scope]: true, [CSS$G.hueScope]: true }, onKeyDown: this.handleHueScopeKeyDown, ref: this.storeHueScope, role: "slider", style: { top: `${hueTop}px`, left: `${hueLeft}px` }, tabindex: "0" })), hideHex && hideChannels ? null : (hAsync("div", { class: {
  12292. [CSS$G.controlSection]: true,
  12293. [CSS$G.section]: true
  12294. } }, hideHex ? null : (hAsync("div", { class: CSS$G.hexOptions }, hAsync("span", { class: {
  12295. [CSS$G.header]: true,
  12296. [CSS$G.headerHex]: true
  12297. } }, intlHex), hAsync("calcite-color-picker-hex-input", { allowEmpty: allowEmpty, class: CSS$G.control, onCalciteColorPickerHexInputChange: this.handleHexInputChange, scale: hexInputScale, value: selectedColorInHex }))), hideChannels ? null : (hAsync("calcite-tabs", { class: {
  12298. [CSS$G.colorModeContainer]: true,
  12299. [CSS$G.splitSection]: true
  12300. }, scale: hexInputScale }, hAsync("calcite-tab-nav", { slot: "tab-nav" }, this.renderChannelsTabTitle("rgb"), this.renderChannelsTabTitle("hsv")), this.renderChannelsTab("rgb"), this.renderChannelsTab("hsv"))))), hideSaved ? null : (hAsync("div", { class: { [CSS$G.savedColorsSection]: true, [CSS$G.section]: true } }, hAsync("div", { class: CSS$G.header }, hAsync("label", null, intlSaved), hAsync("div", { class: CSS$G.savedColorsButtons }, hAsync("calcite-button", { appearance: "transparent", class: CSS$G.deleteColor, color: "neutral", disabled: noColor, iconStart: "minus", label: intlDeleteColor, onClick: this.deleteColor, scale: hexInputScale, type: "button" }), hAsync("calcite-button", { appearance: "transparent", class: CSS$G.saveColor, color: "neutral", disabled: noColor, iconStart: "plus", label: intlSaveColor, onClick: this.saveColor, scale: hexInputScale, type: "button" }))), savedColors.length > 0 ? (hAsync("div", { class: CSS$G.savedColors }, [
  12301. ...savedColors.map((color) => (hAsync("calcite-color-picker-swatch", { active: selectedColorInHex === color, class: CSS$G.savedColor, color: color, key: color, onClick: this.handleSavedColorSelect, onKeyDown: this.handleSavedColorKeyDown, scale: scale, tabIndex: 0 })))
  12302. ])) : null))));
  12303. }
  12304. // --------------------------------------------------------------------------
  12305. //
  12306. // Private Methods
  12307. //
  12308. //--------------------------------------------------------------------------
  12309. handleKeyDown(event) {
  12310. if (event.key === "Enter") {
  12311. event.preventDefault();
  12312. }
  12313. }
  12314. showIncompatibleColorWarning(value, format) {
  12315. console.warn(`ignoring color value (${value}) as it is not compatible with the current format (${format})`);
  12316. }
  12317. setMode(format) {
  12318. this.mode = format === "auto" ? this.mode : format;
  12319. }
  12320. captureHueSliderColor(x) {
  12321. const { dimensions: { slider: { width } } } = this;
  12322. const hue = (360 / width) * x;
  12323. this.internalColorSet(this.baseColorFieldColor.hue(hue), false);
  12324. }
  12325. getCanvasRegion(y) {
  12326. const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height: sliderHeight } } } = this;
  12327. if (y <= colorFieldHeight) {
  12328. return "color-field";
  12329. }
  12330. if (y <= colorFieldHeight + sliderHeight) {
  12331. return "slider";
  12332. }
  12333. return "none";
  12334. }
  12335. internalColorSet(color, skipEqual = true, context = "user-interaction") {
  12336. if (skipEqual && colorEqual(color, this.color)) {
  12337. return;
  12338. }
  12339. this.internalColorUpdateContext = context;
  12340. this.color = color;
  12341. this.value = this.toValue(color);
  12342. this.internalColorUpdateContext = null;
  12343. }
  12344. toValue(color, format = this.mode) {
  12345. if (!color) {
  12346. return null;
  12347. }
  12348. const hexMode = "hex";
  12349. if (format.includes(hexMode)) {
  12350. return normalizeHex(color.round()[hexMode]());
  12351. }
  12352. if (format.includes("-css")) {
  12353. return color[format.replace("-css", "").replace("a", "")]().round().string();
  12354. }
  12355. const colorObject = color[format]().round().object();
  12356. if (format.endsWith("a")) {
  12357. // normalize alpha prop
  12358. colorObject.a = colorObject.alpha;
  12359. delete colorObject.alpha;
  12360. }
  12361. return colorObject;
  12362. }
  12363. getSliderCapSpacing() {
  12364. const { dimensions: { slider: { height }, thumb: { radius } } } = this;
  12365. return radius * 2 - height;
  12366. }
  12367. updateDimensions(scale = "m") {
  12368. this.dimensions = DIMENSIONS[scale];
  12369. }
  12370. drawColorField() {
  12371. const context = this.fieldAndSliderRenderingContext;
  12372. const { dimensions: { colorField: { height, width } } } = this;
  12373. context.fillStyle = this.baseColorFieldColor.hsv().saturationv(100).value(100).string();
  12374. context.fillRect(0, 0, width, height);
  12375. const whiteGradient = context.createLinearGradient(0, 0, width, 0);
  12376. whiteGradient.addColorStop(0, "rgba(255,255,255,1)");
  12377. whiteGradient.addColorStop(1, "rgba(255,255,255,0)");
  12378. context.fillStyle = whiteGradient;
  12379. context.fillRect(0, 0, width, height);
  12380. const blackGradient = context.createLinearGradient(0, 0, 0, height);
  12381. blackGradient.addColorStop(0, "rgba(0,0,0,0)");
  12382. blackGradient.addColorStop(1, "rgba(0,0,0,1)");
  12383. context.fillStyle = blackGradient;
  12384. context.fillRect(0, 0, width, height);
  12385. this.drawActiveColorFieldColor();
  12386. }
  12387. setCanvasContextSize(canvas, { height, width }) {
  12388. const devicePixelRatio = window.devicePixelRatio || 1;
  12389. canvas.width = width * devicePixelRatio;
  12390. canvas.height = height * devicePixelRatio;
  12391. canvas.style.height = `${height}px`;
  12392. canvas.style.width = `${width}px`;
  12393. const context = canvas.getContext("2d");
  12394. context.scale(devicePixelRatio, devicePixelRatio);
  12395. }
  12396. containsPoint(testPointX, testPointY, boundsX, boundsY, boundsRadius) {
  12397. return (Math.pow(testPointX - boundsX, 2) + Math.pow(testPointY - boundsY, 2) <=
  12398. Math.pow(boundsRadius, 2));
  12399. }
  12400. drawActiveColorFieldColor() {
  12401. const { color } = this;
  12402. if (!color) {
  12403. return;
  12404. }
  12405. const hsvColor = color.hsv();
  12406. const { dimensions: { colorField: { height, width }, thumb: { radius } } } = this;
  12407. const x = hsvColor.saturationv() / (HSV_LIMITS.s / width);
  12408. const y = height - hsvColor.value() / (HSV_LIMITS.v / height);
  12409. requestAnimationFrame(() => {
  12410. this.colorFieldScopeLeft = x;
  12411. this.colorFieldScopeTop = y;
  12412. });
  12413. this.drawThumb(this.fieldAndSliderRenderingContext, radius, x, y, hsvColor, this.hueThumbState);
  12414. }
  12415. drawThumb(context, radius, x, y, color, state) {
  12416. const startAngle = 0;
  12417. const endAngle = 2 * Math.PI;
  12418. context.beginPath();
  12419. context.arc(x, y, radius, startAngle, endAngle);
  12420. context.shadowBlur = state === "hover" ? 32 : 16;
  12421. context.shadowColor = `rgba(0, 0, 0, ${state === "drag" ? 0.32 : 0.16})`;
  12422. context.fillStyle = "#fff";
  12423. context.fill();
  12424. context.beginPath();
  12425. context.arc(x, y, radius - 3, startAngle, endAngle);
  12426. context.shadowBlur = 0;
  12427. context.shadowColor = "transparent";
  12428. context.fillStyle = color.rgb().string();
  12429. context.fill();
  12430. }
  12431. drawActiveHueSliderColor() {
  12432. const { color } = this;
  12433. if (!color) {
  12434. return;
  12435. }
  12436. const hsvColor = color.hsv().saturationv(100).value(100);
  12437. const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height, width }, thumb: { radius } } } = this;
  12438. const x = hsvColor.hue() / (360 / width);
  12439. const y = height / 2 + colorFieldHeight;
  12440. requestAnimationFrame(() => {
  12441. this.hueScopeLeft = x;
  12442. this.hueScopeTop = y;
  12443. });
  12444. this.drawThumb(this.fieldAndSliderRenderingContext, radius, x, y, hsvColor, this.sliderThumbState);
  12445. }
  12446. drawHueSlider() {
  12447. const context = this.fieldAndSliderRenderingContext;
  12448. const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height, width } } } = this;
  12449. const gradient = context.createLinearGradient(0, 0, width, 0);
  12450. const hueSliderColorStopKeywords = ["red", "yellow", "lime", "cyan", "blue", "magenta", "red"];
  12451. const offset = 1 / (hueSliderColorStopKeywords.length - 1);
  12452. let currentOffset = 0;
  12453. hueSliderColorStopKeywords.forEach((keyword) => {
  12454. gradient.addColorStop(currentOffset, color(keyword).string());
  12455. currentOffset += offset;
  12456. });
  12457. context.fillStyle = gradient;
  12458. context.clearRect(0, colorFieldHeight, width, height + this.getSliderCapSpacing() * 2);
  12459. context.fillRect(0, colorFieldHeight, width, height);
  12460. this.drawActiveHueSliderColor();
  12461. }
  12462. updateColorFromChannels(channels) {
  12463. this.internalColorSet(color(channels, this.channelMode));
  12464. }
  12465. updateChannelsFromColor(color) {
  12466. this.channels = color ? this.toChannels(color) : [null, null, null];
  12467. }
  12468. toChannels(color) {
  12469. const { channelMode } = this;
  12470. return color[channelMode]()
  12471. .array()
  12472. .map((value) => Math.floor(value));
  12473. }
  12474. get el() { return getElement(this); }
  12475. static get watchers() { return {
  12476. "color": ["handleColorChange"],
  12477. "format": ["handleFormatChange"],
  12478. "scale": ["handleScaleChange"],
  12479. "value": ["handleValueChange"]
  12480. }; }
  12481. static get style() { return colorPickerCss; }
  12482. static get cmpMeta() { return {
  12483. "$flags$": 9,
  12484. "$tagName$": "calcite-color-picker",
  12485. "$members$": {
  12486. "allowEmpty": [4, "allow-empty"],
  12487. "appearance": [513],
  12488. "color": [1040],
  12489. "disabled": [516],
  12490. "format": [1],
  12491. "hideHex": [4, "hide-hex"],
  12492. "hideChannels": [4, "hide-channels"],
  12493. "hideSaved": [4, "hide-saved"],
  12494. "intlB": [1, "intl-b"],
  12495. "intlBlue": [1, "intl-blue"],
  12496. "intlDeleteColor": [1, "intl-delete-color"],
  12497. "intlG": [1, "intl-g"],
  12498. "intlGreen": [1, "intl-green"],
  12499. "intlH": [1, "intl-h"],
  12500. "intlHsv": [1, "intl-hsv"],
  12501. "intlHex": [1, "intl-hex"],
  12502. "intlHue": [1, "intl-hue"],
  12503. "intlNoColor": [1, "intl-no-color"],
  12504. "intlR": [1, "intl-r"],
  12505. "intlRed": [1, "intl-red"],
  12506. "intlRgb": [1, "intl-rgb"],
  12507. "intlS": [1, "intl-s"],
  12508. "intlSaturation": [1, "intl-saturation"],
  12509. "intlSaveColor": [1, "intl-save-color"],
  12510. "intlSaved": [1, "intl-saved"],
  12511. "intlV": [1, "intl-v"],
  12512. "intlValue": [1, "intl-value"],
  12513. "scale": [513],
  12514. "storageId": [1, "storage-id"],
  12515. "value": [1025],
  12516. "colorFieldAndSliderInteractive": [32],
  12517. "channelMode": [32],
  12518. "channels": [32],
  12519. "dimensions": [32],
  12520. "savedColors": [32],
  12521. "colorFieldScopeTop": [32],
  12522. "colorFieldScopeLeft": [32],
  12523. "scopeOrientation": [32],
  12524. "hueScopeLeft": [32],
  12525. "hueScopeTop": [32],
  12526. "setFocus": [64]
  12527. },
  12528. "$listeners$": [[2, "keydown", "handleChannelKeyUpOrDown"], [2, "keyup", "handleChannelKeyUpOrDown"]],
  12529. "$lazyBundleId$": "-",
  12530. "$attrsToReflect$": [["appearance", "appearance"], ["disabled", "disabled"], ["scale", "scale"]]
  12531. }; }
  12532. }
  12533. const CSS$F = {
  12534. container: "container",
  12535. preview: "preview",
  12536. input: "input"
  12537. };
  12538. const colorPickerHexInputCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-color-picker-hex-input:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-color-picker-hex-input{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker-hex-input{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker-hex-input{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker-hex-input{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker-hex-input{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-color-picker-hex-input:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-color-picker-hex-input-h{display:none}/*!@:host*/.sc-calcite-color-picker-hex-input-h{display:block}/*!@.container*/.container.sc-calcite-color-picker-hex-input{display:inline-grid;width:100%;-ms-flex-align:center;align-items:center;grid-template-columns:1fr auto}/*!@.preview*/.preview.sc-calcite-color-picker-hex-input{grid-column:2/3;pointer-events:none;margin-top:0px;margin-bottom:0px;margin-left:0.25rem;margin-right:0.25rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;z-index:1}/*!@.preview,\n.input*/.preview.sc-calcite-color-picker-hex-input,.input.sc-calcite-color-picker-hex-input{grid-row:1}/*!@.input*/.input.sc-calcite-color-picker-hex-input{grid-column:1/3;width:100%;text-transform:uppercase}";
  12539. const DEFAULT_COLOR = color();
  12540. class ColorPickerHexInput {
  12541. constructor(hostRef) {
  12542. registerInstance(this, hostRef);
  12543. this.calciteColorPickerHexInputChange = createEvent(this, "calciteColorPickerHexInputChange", 7);
  12544. //--------------------------------------------------------------------------
  12545. //
  12546. // Public Properties
  12547. //
  12548. //--------------------------------------------------------------------------
  12549. /**
  12550. * When false, empty color (null) will be allowed as a value. Otherwise, a color value is always enforced by the component.
  12551. *
  12552. * When true, clearing the input and blurring will restore the last valid color set. When false, it will set it to empty.
  12553. */
  12554. this.allowEmpty = false;
  12555. /**
  12556. * Label used for the hex input.
  12557. * @default "Hex"
  12558. */
  12559. this.intlHex = TEXT$h.hex;
  12560. /**
  12561. * Label used for the hex input when there is no color selected.
  12562. * @default "No color"
  12563. */
  12564. this.intlNoColor = TEXT$h.noColor;
  12565. /**
  12566. * The component's scale.
  12567. */
  12568. this.scale = "m";
  12569. /**
  12570. * The hex value.
  12571. */
  12572. this.value = normalizeHex(DEFAULT_COLOR.hex());
  12573. this.onCalciteInputBlur = () => {
  12574. const node = this.inputNode;
  12575. const inputValue = node.value;
  12576. const hex = `#${inputValue}`;
  12577. const willClearValue = this.allowEmpty && !inputValue;
  12578. if (willClearValue || (isValidHex(hex) && isLonghandHex(hex))) {
  12579. return;
  12580. }
  12581. // manipulating DOM directly since rerender doesn't update input value
  12582. node.value =
  12583. this.allowEmpty && !this.internalColor
  12584. ? ""
  12585. : this.formatForInternalInput(rgbToHex(this.internalColor.object()));
  12586. };
  12587. this.onInputChange = () => {
  12588. this.internalSetValue(this.inputNode.value, this.value);
  12589. };
  12590. /**
  12591. * The last valid/selected color. Used as a fallback if an invalid hex code is entered.
  12592. */
  12593. this.internalColor = DEFAULT_COLOR;
  12594. this.previousNonNullValue = this.value;
  12595. this.storeInputRef = (node) => {
  12596. this.inputNode = node;
  12597. };
  12598. }
  12599. //--------------------------------------------------------------------------
  12600. //
  12601. // Lifecycle
  12602. //
  12603. //--------------------------------------------------------------------------
  12604. connectedCallback() {
  12605. const { allowEmpty, value } = this;
  12606. if (value) {
  12607. const normalized = normalizeHex(value);
  12608. if (isValidHex(normalized)) {
  12609. this.internalSetValue(normalized, normalized, false);
  12610. }
  12611. return;
  12612. }
  12613. if (allowEmpty) {
  12614. this.internalSetValue(null, null, false);
  12615. }
  12616. }
  12617. handleValueChange(value, oldValue) {
  12618. this.internalSetValue(value, oldValue, false);
  12619. }
  12620. // using @Listen as a workaround for VDOM listener not firing
  12621. onInputKeyDown(event) {
  12622. const { altKey, ctrlKey, metaKey, shiftKey } = event;
  12623. const { internalColor, value } = this;
  12624. const key = event.key;
  12625. if (key === "Tab" || key === "Enter") {
  12626. this.onInputChange();
  12627. return;
  12628. }
  12629. const isNudgeKey = key === "ArrowDown" || key === "ArrowUp";
  12630. const oldValue = this.value;
  12631. if (isNudgeKey) {
  12632. if (!value) {
  12633. this.internalSetValue(this.previousNonNullValue, oldValue);
  12634. event.preventDefault();
  12635. return;
  12636. }
  12637. const direction = key === "ArrowUp" ? 1 : -1;
  12638. const bump = shiftKey ? 10 : 1;
  12639. this.internalSetValue(normalizeHex(this.nudgeRGBChannels(internalColor, bump * direction).hex()), oldValue);
  12640. event.preventDefault();
  12641. return;
  12642. }
  12643. const withModifiers = altKey || ctrlKey || metaKey;
  12644. const singleChar = key.length === 1;
  12645. const validHexChar = hexChar.test(key);
  12646. if (singleChar && !withModifiers && !validHexChar) {
  12647. event.preventDefault();
  12648. }
  12649. }
  12650. //--------------------------------------------------------------------------
  12651. //
  12652. // Lifecycle
  12653. //
  12654. //--------------------------------------------------------------------------
  12655. render() {
  12656. const { intlHex, value } = this;
  12657. const hexInputValue = this.formatForInternalInput(value);
  12658. return (hAsync("div", { class: CSS$F.container }, hAsync("calcite-input", { class: CSS$F.input, label: intlHex, maxLength: 6, onCalciteInputBlur: this.onCalciteInputBlur, onCalciteInputChange: this.onInputChange, onKeyDown: this.handleKeyDown, prefixText: "#", ref: this.storeInputRef, scale: this.scale, value: hexInputValue }), hexInputValue ? (hAsync("calcite-color-picker-swatch", { active: true, class: CSS$F.preview, color: `#${hexInputValue}`, scale: this.scale })) : null));
  12659. }
  12660. //--------------------------------------------------------------------------
  12661. //
  12662. // Public Methods
  12663. //
  12664. //--------------------------------------------------------------------------
  12665. /** Sets focus on the component. */
  12666. async setFocus() {
  12667. focusElement(this.inputNode);
  12668. }
  12669. //--------------------------------------------------------------------------
  12670. //
  12671. // Private Methods
  12672. //
  12673. //--------------------------------------------------------------------------
  12674. internalSetValue(value, oldValue, emit = true) {
  12675. if (value) {
  12676. const normalized = normalizeHex(value);
  12677. if (isValidHex(normalized)) {
  12678. const { internalColor } = this;
  12679. const changed = !internalColor || normalized !== normalizeHex(internalColor.hex());
  12680. this.internalColor = color(normalized);
  12681. this.previousNonNullValue = normalized;
  12682. this.value = normalized;
  12683. if (changed && emit) {
  12684. this.calciteColorPickerHexInputChange.emit();
  12685. }
  12686. return;
  12687. }
  12688. }
  12689. else if (this.allowEmpty) {
  12690. this.internalColor = null;
  12691. this.value = null;
  12692. if (emit) {
  12693. this.calciteColorPickerHexInputChange.emit();
  12694. }
  12695. return;
  12696. }
  12697. this.value = oldValue;
  12698. }
  12699. formatForInternalInput(hex) {
  12700. return hex ? hex.replace("#", "") : "";
  12701. }
  12702. nudgeRGBChannels(color$1, amount) {
  12703. return color.rgb(color$1.array().map((channel) => channel + amount));
  12704. }
  12705. handleKeyDown(event) {
  12706. if (event.key === "Enter") {
  12707. event.preventDefault();
  12708. }
  12709. }
  12710. get el() { return getElement(this); }
  12711. static get watchers() { return {
  12712. "value": ["handleValueChange"]
  12713. }; }
  12714. static get style() { return colorPickerHexInputCss; }
  12715. static get cmpMeta() { return {
  12716. "$flags$": 9,
  12717. "$tagName$": "calcite-color-picker-hex-input",
  12718. "$members$": {
  12719. "allowEmpty": [4, "allow-empty"],
  12720. "intlHex": [1, "intl-hex"],
  12721. "intlNoColor": [1, "intl-no-color"],
  12722. "scale": [513],
  12723. "value": [1537],
  12724. "internalColor": [32],
  12725. "setFocus": [64]
  12726. },
  12727. "$listeners$": [[2, "keydown", "onInputKeyDown"]],
  12728. "$lazyBundleId$": "-",
  12729. "$attrsToReflect$": [["scale", "scale"], ["value", "value"]]
  12730. }; }
  12731. }
  12732. const CSS$E = {
  12733. swatch: "swatch",
  12734. noColorIcon: "no-color-icon"
  12735. };
  12736. const COLORS = {
  12737. borderLight: "rgba(0, 0, 0, 0.3)",
  12738. borderDark: "rgba(255, 255, 255, 0.15)"
  12739. };
  12740. const colorPickerSwatchCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-color-picker-swatch:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-color-picker-swatch{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker-swatch{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker-swatch{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker-swatch{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker-swatch{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-color-picker-swatch:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-color-picker-swatch-h{display:none}/*!@:host*/.sc-calcite-color-picker-swatch-h{position:relative;display:-ms-inline-flexbox;display:inline-flex}/*!@:host([scale=s])*/[scale=s].sc-calcite-color-picker-swatch-h{height:1.25rem;width:1.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-color-picker-swatch-h{height:1.5rem;width:1.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-color-picker-swatch-h{height:2rem;width:2rem}/*!@.swatch*/.swatch.sc-calcite-color-picker-swatch{overflow:visible;height:inherit;width:inherit}/*!@.swatch rect*/.swatch.sc-calcite-color-picker-swatch rect.sc-calcite-color-picker-swatch{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@.no-color-icon*/.no-color-icon.sc-calcite-color-picker-swatch{position:absolute;top:0px;right:0px;bottom:0px;left:0px;height:100%;width:100%}";
  12741. class ColorPickerSwatch {
  12742. constructor(hostRef) {
  12743. registerInstance(this, hostRef);
  12744. //--------------------------------------------------------------------------
  12745. //
  12746. // Properties
  12747. //
  12748. //--------------------------------------------------------------------------
  12749. /**
  12750. * Used to display whether the swatch is active or not.
  12751. */
  12752. this.active = false;
  12753. /**
  12754. * The component scale.
  12755. */
  12756. this.scale = "m";
  12757. }
  12758. handleColorChange(color$1) {
  12759. this.internalColor = color(color$1);
  12760. }
  12761. //--------------------------------------------------------------------------
  12762. //
  12763. // Lifecycle
  12764. //
  12765. //--------------------------------------------------------------------------
  12766. componentWillLoad() {
  12767. this.handleColorChange(this.color);
  12768. }
  12769. render() {
  12770. const { active, el, internalColor } = this;
  12771. const borderRadius = active ? "100%" : "0";
  12772. const hex = internalColor.hex();
  12773. const theme = getThemeName(el);
  12774. const borderColor = theme === "light" ? COLORS.borderLight : COLORS.borderDark;
  12775. return (hAsync("svg", { class: CSS$E.swatch, xmlns: "http://www.w3.org/2000/svg" }, hAsync("title", null, hex), hAsync("rect", { fill: hex, height: "100%", id: "swatch", rx: borderRadius, stroke: borderColor, "stroke-width": "2", style: { "clip-path": `inset(0 round ${borderRadius})` }, width: "100%" })));
  12776. }
  12777. get el() { return getElement(this); }
  12778. static get watchers() { return {
  12779. "color": ["handleColorChange"]
  12780. }; }
  12781. static get style() { return colorPickerSwatchCss; }
  12782. static get cmpMeta() { return {
  12783. "$flags$": 9,
  12784. "$tagName$": "calcite-color-picker-swatch",
  12785. "$members$": {
  12786. "active": [516],
  12787. "color": [1],
  12788. "scale": [513]
  12789. },
  12790. "$listeners$": undefined,
  12791. "$lazyBundleId$": "-",
  12792. "$attrsToReflect$": [["active", "active"], ["scale", "scale"]]
  12793. }; }
  12794. }
  12795. const filter = (data, value) => {
  12796. const escapedValue = escapeRegExp(value);
  12797. const regex = new RegExp(escapedValue, "i");
  12798. if (data.length === 0) {
  12799. console.warn(`No data was passed to the filter function.
  12800. The data argument should be an array of objects`);
  12801. }
  12802. const find = (input, RE) => {
  12803. var _a;
  12804. if ((_a = input) === null || _a === void 0 ? void 0 : _a.constant) {
  12805. return true;
  12806. }
  12807. let found = false;
  12808. forIn(input, (val) => {
  12809. if (typeof val === "function" || val == null /* intentional == to catch undefined */) {
  12810. return;
  12811. }
  12812. if (Array.isArray(val) || (typeof val === "object" && val !== null)) {
  12813. if (find(val, RE)) {
  12814. found = true;
  12815. }
  12816. }
  12817. else if (RE.test(val)) {
  12818. found = true;
  12819. }
  12820. });
  12821. return found;
  12822. };
  12823. const result = data.filter((item) => {
  12824. return find(item, regex);
  12825. });
  12826. return result;
  12827. };
  12828. var top = 'top';
  12829. var bottom = 'bottom';
  12830. var right = 'right';
  12831. var left = 'left';
  12832. var auto = 'auto';
  12833. var basePlacements = [top, bottom, right, left];
  12834. var start = 'start';
  12835. var end = 'end';
  12836. var clippingParents = 'clippingParents';
  12837. var viewport = 'viewport';
  12838. var popper = 'popper';
  12839. var reference = 'reference';
  12840. var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
  12841. return acc.concat([placement + "-" + start, placement + "-" + end]);
  12842. }, []);
  12843. var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
  12844. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  12845. }, []); // modifiers that need to read the DOM
  12846. var beforeRead = 'beforeRead';
  12847. var read = 'read';
  12848. var afterRead = 'afterRead'; // pure-logic modifiers
  12849. var beforeMain = 'beforeMain';
  12850. var main = 'main';
  12851. var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
  12852. var beforeWrite = 'beforeWrite';
  12853. var write = 'write';
  12854. var afterWrite = 'afterWrite';
  12855. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  12856. function getNodeName(element) {
  12857. return element ? (element.nodeName || '').toLowerCase() : null;
  12858. }
  12859. function getWindow(node) {
  12860. if (node == null) {
  12861. return window;
  12862. }
  12863. if (node.toString() !== '[object Window]') {
  12864. var ownerDocument = node.ownerDocument;
  12865. return ownerDocument ? ownerDocument.defaultView || window : window;
  12866. }
  12867. return node;
  12868. }
  12869. function isElement(node) {
  12870. var OwnElement = getWindow(node).Element;
  12871. return node instanceof OwnElement || node instanceof Element;
  12872. }
  12873. function isHTMLElement(node) {
  12874. var OwnElement = getWindow(node).HTMLElement;
  12875. return node instanceof OwnElement || node instanceof HTMLElement;
  12876. }
  12877. function isShadowRoot(node) {
  12878. // IE 11 has no ShadowRoot
  12879. if (typeof ShadowRoot === 'undefined') {
  12880. return false;
  12881. }
  12882. var OwnElement = getWindow(node).ShadowRoot;
  12883. return node instanceof OwnElement || node instanceof ShadowRoot;
  12884. }
  12885. // and applies them to the HTMLElements such as popper and arrow
  12886. function applyStyles(_ref) {
  12887. var state = _ref.state;
  12888. Object.keys(state.elements).forEach(function (name) {
  12889. var style = state.styles[name] || {};
  12890. var attributes = state.attributes[name] || {};
  12891. var element = state.elements[name]; // arrow is optional + virtual elements
  12892. if (!isHTMLElement(element) || !getNodeName(element)) {
  12893. return;
  12894. } // Flow doesn't support to extend this property, but it's the most
  12895. // effective way to apply styles to an HTMLElement
  12896. // $FlowFixMe[cannot-write]
  12897. Object.assign(element.style, style);
  12898. Object.keys(attributes).forEach(function (name) {
  12899. var value = attributes[name];
  12900. if (value === false) {
  12901. element.removeAttribute(name);
  12902. } else {
  12903. element.setAttribute(name, value === true ? '' : value);
  12904. }
  12905. });
  12906. });
  12907. }
  12908. function effect$2(_ref2) {
  12909. var state = _ref2.state;
  12910. var initialStyles = {
  12911. popper: {
  12912. position: state.options.strategy,
  12913. left: '0',
  12914. top: '0',
  12915. margin: '0'
  12916. },
  12917. arrow: {
  12918. position: 'absolute'
  12919. },
  12920. reference: {}
  12921. };
  12922. Object.assign(state.elements.popper.style, initialStyles.popper);
  12923. state.styles = initialStyles;
  12924. if (state.elements.arrow) {
  12925. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  12926. }
  12927. return function () {
  12928. Object.keys(state.elements).forEach(function (name) {
  12929. var element = state.elements[name];
  12930. var attributes = state.attributes[name] || {};
  12931. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
  12932. var style = styleProperties.reduce(function (style, property) {
  12933. style[property] = '';
  12934. return style;
  12935. }, {}); // arrow is optional + virtual elements
  12936. if (!isHTMLElement(element) || !getNodeName(element)) {
  12937. return;
  12938. }
  12939. Object.assign(element.style, style);
  12940. Object.keys(attributes).forEach(function (attribute) {
  12941. element.removeAttribute(attribute);
  12942. });
  12943. });
  12944. };
  12945. } // eslint-disable-next-line import/no-unused-modules
  12946. var applyStyles$1 = {
  12947. name: 'applyStyles',
  12948. enabled: true,
  12949. phase: 'write',
  12950. fn: applyStyles,
  12951. effect: effect$2,
  12952. requires: ['computeStyles']
  12953. };
  12954. function getBasePlacement(placement) {
  12955. return placement.split('-')[0];
  12956. }
  12957. var max = Math.max;
  12958. var min = Math.min;
  12959. var round = Math.round;
  12960. function getBoundingClientRect(element, includeScale) {
  12961. if (includeScale === void 0) {
  12962. includeScale = false;
  12963. }
  12964. var rect = element.getBoundingClientRect();
  12965. var scaleX = 1;
  12966. var scaleY = 1;
  12967. if (isHTMLElement(element) && includeScale) {
  12968. var offsetHeight = element.offsetHeight;
  12969. var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
  12970. // Fallback to 1 in case both values are `0`
  12971. if (offsetWidth > 0) {
  12972. scaleX = round(rect.width) / offsetWidth || 1;
  12973. }
  12974. if (offsetHeight > 0) {
  12975. scaleY = round(rect.height) / offsetHeight || 1;
  12976. }
  12977. }
  12978. return {
  12979. width: rect.width / scaleX,
  12980. height: rect.height / scaleY,
  12981. top: rect.top / scaleY,
  12982. right: rect.right / scaleX,
  12983. bottom: rect.bottom / scaleY,
  12984. left: rect.left / scaleX,
  12985. x: rect.left / scaleX,
  12986. y: rect.top / scaleY
  12987. };
  12988. }
  12989. // means it doesn't take into account transforms.
  12990. function getLayoutRect(element) {
  12991. var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
  12992. // Fixes https://github.com/popperjs/popper-core/issues/1223
  12993. var width = element.offsetWidth;
  12994. var height = element.offsetHeight;
  12995. if (Math.abs(clientRect.width - width) <= 1) {
  12996. width = clientRect.width;
  12997. }
  12998. if (Math.abs(clientRect.height - height) <= 1) {
  12999. height = clientRect.height;
  13000. }
  13001. return {
  13002. x: element.offsetLeft,
  13003. y: element.offsetTop,
  13004. width: width,
  13005. height: height
  13006. };
  13007. }
  13008. function contains(parent, child) {
  13009. var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
  13010. if (parent.contains(child)) {
  13011. return true;
  13012. } // then fallback to custom implementation with Shadow DOM support
  13013. else if (rootNode && isShadowRoot(rootNode)) {
  13014. var next = child;
  13015. do {
  13016. if (next && parent.isSameNode(next)) {
  13017. return true;
  13018. } // $FlowFixMe[prop-missing]: need a better way to handle this...
  13019. next = next.parentNode || next.host;
  13020. } while (next);
  13021. } // Give up, the result is false
  13022. return false;
  13023. }
  13024. function getComputedStyle$1(element) {
  13025. return getWindow(element).getComputedStyle(element);
  13026. }
  13027. function isTableElement(element) {
  13028. return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
  13029. }
  13030. function getDocumentElement(element) {
  13031. // $FlowFixMe[incompatible-return]: assume body is always available
  13032. return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
  13033. element.document) || window.document).documentElement;
  13034. }
  13035. function getParentNode(element) {
  13036. if (getNodeName(element) === 'html') {
  13037. return element;
  13038. }
  13039. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  13040. // $FlowFixMe[incompatible-return]
  13041. // $FlowFixMe[prop-missing]
  13042. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  13043. element.parentNode || ( // DOM Element detected
  13044. isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  13045. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  13046. getDocumentElement(element) // fallback
  13047. );
  13048. }
  13049. function getTrueOffsetParent(element) {
  13050. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  13051. getComputedStyle$1(element).position === 'fixed') {
  13052. return null;
  13053. }
  13054. return element.offsetParent;
  13055. } // `.offsetParent` reports `null` for fixed elements, while absolute elements
  13056. // return the containing block
  13057. function getContainingBlock(element) {
  13058. var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
  13059. var isIE = navigator.userAgent.indexOf('Trident') !== -1;
  13060. if (isIE && isHTMLElement(element)) {
  13061. // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
  13062. var elementCss = getComputedStyle$1(element);
  13063. if (elementCss.position === 'fixed') {
  13064. return null;
  13065. }
  13066. }
  13067. var currentNode = getParentNode(element);
  13068. if (isShadowRoot(currentNode)) {
  13069. currentNode = currentNode.host;
  13070. }
  13071. while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
  13072. var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that
  13073. // create a containing block.
  13074. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  13075. if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
  13076. return currentNode;
  13077. } else {
  13078. currentNode = currentNode.parentNode;
  13079. }
  13080. }
  13081. return null;
  13082. } // Gets the closest ancestor positioned element. Handles some edge cases,
  13083. // such as table ancestors and cross browser bugs.
  13084. function getOffsetParent(element) {
  13085. var window = getWindow(element);
  13086. var offsetParent = getTrueOffsetParent(element);
  13087. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  13088. offsetParent = getTrueOffsetParent(offsetParent);
  13089. }
  13090. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) {
  13091. return window;
  13092. }
  13093. return offsetParent || getContainingBlock(element) || window;
  13094. }
  13095. function getMainAxisFromPlacement(placement) {
  13096. return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
  13097. }
  13098. function within(min$1, value, max$1) {
  13099. return max(min$1, min(value, max$1));
  13100. }
  13101. function withinMaxClamp(min, value, max) {
  13102. var v = within(min, value, max);
  13103. return v > max ? max : v;
  13104. }
  13105. function getFreshSideObject() {
  13106. return {
  13107. top: 0,
  13108. right: 0,
  13109. bottom: 0,
  13110. left: 0
  13111. };
  13112. }
  13113. function mergePaddingObject(paddingObject) {
  13114. return Object.assign({}, getFreshSideObject(), paddingObject);
  13115. }
  13116. function expandToHashMap(value, keys) {
  13117. return keys.reduce(function (hashMap, key) {
  13118. hashMap[key] = value;
  13119. return hashMap;
  13120. }, {});
  13121. }
  13122. var toPaddingObject = function toPaddingObject(padding, state) {
  13123. padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
  13124. placement: state.placement
  13125. })) : padding;
  13126. return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  13127. };
  13128. function arrow(_ref) {
  13129. var _state$modifiersData$;
  13130. var state = _ref.state,
  13131. name = _ref.name,
  13132. options = _ref.options;
  13133. var arrowElement = state.elements.arrow;
  13134. var popperOffsets = state.modifiersData.popperOffsets;
  13135. var basePlacement = getBasePlacement(state.placement);
  13136. var axis = getMainAxisFromPlacement(basePlacement);
  13137. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  13138. var len = isVertical ? 'height' : 'width';
  13139. if (!arrowElement || !popperOffsets) {
  13140. return;
  13141. }
  13142. var paddingObject = toPaddingObject(options.padding, state);
  13143. var arrowRect = getLayoutRect(arrowElement);
  13144. var minProp = axis === 'y' ? top : left;
  13145. var maxProp = axis === 'y' ? bottom : right;
  13146. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
  13147. var startDiff = popperOffsets[axis] - state.rects.reference[axis];
  13148. var arrowOffsetParent = getOffsetParent(arrowElement);
  13149. var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  13150. var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
  13151. // outside of the popper bounds
  13152. var min = paddingObject[minProp];
  13153. var max = clientSize - arrowRect[len] - paddingObject[maxProp];
  13154. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  13155. var offset = within(min, center, max); // Prevents breaking syntax highlighting...
  13156. var axisProp = axis;
  13157. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
  13158. }
  13159. function effect$1(_ref2) {
  13160. var state = _ref2.state,
  13161. options = _ref2.options;
  13162. var _options$element = options.element,
  13163. arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
  13164. if (arrowElement == null) {
  13165. return;
  13166. } // CSS selector
  13167. if (typeof arrowElement === 'string') {
  13168. arrowElement = state.elements.popper.querySelector(arrowElement);
  13169. if (!arrowElement) {
  13170. return;
  13171. }
  13172. }
  13173. if (!contains(state.elements.popper, arrowElement)) {
  13174. return;
  13175. }
  13176. state.elements.arrow = arrowElement;
  13177. } // eslint-disable-next-line import/no-unused-modules
  13178. var arrow$1 = {
  13179. name: 'arrow',
  13180. enabled: true,
  13181. phase: 'main',
  13182. fn: arrow,
  13183. effect: effect$1,
  13184. requires: ['popperOffsets'],
  13185. requiresIfExists: ['preventOverflow']
  13186. };
  13187. function getVariation(placement) {
  13188. return placement.split('-')[1];
  13189. }
  13190. var unsetSides = {
  13191. top: 'auto',
  13192. right: 'auto',
  13193. bottom: 'auto',
  13194. left: 'auto'
  13195. }; // Round the offsets to the nearest suitable subpixel based on the DPR.
  13196. // Zooming can change the DPR, but it seems to report a value that will
  13197. // cleanly divide the values into the appropriate subpixels.
  13198. function roundOffsetsByDPR(_ref) {
  13199. var x = _ref.x,
  13200. y = _ref.y;
  13201. var win = window;
  13202. var dpr = win.devicePixelRatio || 1;
  13203. return {
  13204. x: round(x * dpr) / dpr || 0,
  13205. y: round(y * dpr) / dpr || 0
  13206. };
  13207. }
  13208. function mapToStyles(_ref2) {
  13209. var _Object$assign2;
  13210. var popper = _ref2.popper,
  13211. popperRect = _ref2.popperRect,
  13212. placement = _ref2.placement,
  13213. variation = _ref2.variation,
  13214. offsets = _ref2.offsets,
  13215. position = _ref2.position,
  13216. gpuAcceleration = _ref2.gpuAcceleration,
  13217. adaptive = _ref2.adaptive,
  13218. roundOffsets = _ref2.roundOffsets,
  13219. isFixed = _ref2.isFixed;
  13220. var _offsets$x = offsets.x,
  13221. x = _offsets$x === void 0 ? 0 : _offsets$x,
  13222. _offsets$y = offsets.y,
  13223. y = _offsets$y === void 0 ? 0 : _offsets$y;
  13224. var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
  13225. x: x,
  13226. y: y
  13227. }) : {
  13228. x: x,
  13229. y: y
  13230. };
  13231. x = _ref3.x;
  13232. y = _ref3.y;
  13233. var hasX = offsets.hasOwnProperty('x');
  13234. var hasY = offsets.hasOwnProperty('y');
  13235. var sideX = left;
  13236. var sideY = top;
  13237. var win = window;
  13238. if (adaptive) {
  13239. var offsetParent = getOffsetParent(popper);
  13240. var heightProp = 'clientHeight';
  13241. var widthProp = 'clientWidth';
  13242. if (offsetParent === getWindow(popper)) {
  13243. offsetParent = getDocumentElement(popper);
  13244. if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') {
  13245. heightProp = 'scrollHeight';
  13246. widthProp = 'scrollWidth';
  13247. }
  13248. } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
  13249. offsetParent = offsetParent;
  13250. if (placement === top || (placement === left || placement === right) && variation === end) {
  13251. sideY = bottom;
  13252. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
  13253. offsetParent[heightProp];
  13254. y -= offsetY - popperRect.height;
  13255. y *= gpuAcceleration ? 1 : -1;
  13256. }
  13257. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  13258. sideX = right;
  13259. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
  13260. offsetParent[widthProp];
  13261. x -= offsetX - popperRect.width;
  13262. x *= gpuAcceleration ? 1 : -1;
  13263. }
  13264. }
  13265. var commonStyles = Object.assign({
  13266. position: position
  13267. }, adaptive && unsetSides);
  13268. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  13269. x: x,
  13270. y: y
  13271. }) : {
  13272. x: x,
  13273. y: y
  13274. };
  13275. x = _ref4.x;
  13276. y = _ref4.y;
  13277. if (gpuAcceleration) {
  13278. var _Object$assign;
  13279. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  13280. }
  13281. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
  13282. }
  13283. function computeStyles(_ref5) {
  13284. var state = _ref5.state,
  13285. options = _ref5.options;
  13286. var _options$gpuAccelerat = options.gpuAcceleration,
  13287. gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
  13288. _options$adaptive = options.adaptive,
  13289. adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
  13290. _options$roundOffsets = options.roundOffsets,
  13291. roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  13292. var commonStyles = {
  13293. placement: getBasePlacement(state.placement),
  13294. variation: getVariation(state.placement),
  13295. popper: state.elements.popper,
  13296. popperRect: state.rects.popper,
  13297. gpuAcceleration: gpuAcceleration,
  13298. isFixed: state.options.strategy === 'fixed'
  13299. };
  13300. if (state.modifiersData.popperOffsets != null) {
  13301. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  13302. offsets: state.modifiersData.popperOffsets,
  13303. position: state.options.strategy,
  13304. adaptive: adaptive,
  13305. roundOffsets: roundOffsets
  13306. })));
  13307. }
  13308. if (state.modifiersData.arrow != null) {
  13309. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  13310. offsets: state.modifiersData.arrow,
  13311. position: 'absolute',
  13312. adaptive: false,
  13313. roundOffsets: roundOffsets
  13314. })));
  13315. }
  13316. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  13317. 'data-popper-placement': state.placement
  13318. });
  13319. } // eslint-disable-next-line import/no-unused-modules
  13320. var computeStyles$1 = {
  13321. name: 'computeStyles',
  13322. enabled: true,
  13323. phase: 'beforeWrite',
  13324. fn: computeStyles,
  13325. data: {}
  13326. };
  13327. var passive = {
  13328. passive: true
  13329. };
  13330. function effect(_ref) {
  13331. var state = _ref.state,
  13332. instance = _ref.instance,
  13333. options = _ref.options;
  13334. var _options$scroll = options.scroll,
  13335. scroll = _options$scroll === void 0 ? true : _options$scroll,
  13336. _options$resize = options.resize,
  13337. resize = _options$resize === void 0 ? true : _options$resize;
  13338. var window = getWindow(state.elements.popper);
  13339. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  13340. if (scroll) {
  13341. scrollParents.forEach(function (scrollParent) {
  13342. scrollParent.addEventListener('scroll', instance.update, passive);
  13343. });
  13344. }
  13345. if (resize) {
  13346. window.addEventListener('resize', instance.update, passive);
  13347. }
  13348. return function () {
  13349. if (scroll) {
  13350. scrollParents.forEach(function (scrollParent) {
  13351. scrollParent.removeEventListener('scroll', instance.update, passive);
  13352. });
  13353. }
  13354. if (resize) {
  13355. window.removeEventListener('resize', instance.update, passive);
  13356. }
  13357. };
  13358. } // eslint-disable-next-line import/no-unused-modules
  13359. var eventListeners = {
  13360. name: 'eventListeners',
  13361. enabled: true,
  13362. phase: 'write',
  13363. fn: function fn() {},
  13364. effect: effect,
  13365. data: {}
  13366. };
  13367. var hash$1 = {
  13368. left: 'right',
  13369. right: 'left',
  13370. bottom: 'top',
  13371. top: 'bottom'
  13372. };
  13373. function getOppositePlacement(placement) {
  13374. return placement.replace(/left|right|bottom|top/g, function (matched) {
  13375. return hash$1[matched];
  13376. });
  13377. }
  13378. var hash = {
  13379. start: 'end',
  13380. end: 'start'
  13381. };
  13382. function getOppositeVariationPlacement(placement) {
  13383. return placement.replace(/start|end/g, function (matched) {
  13384. return hash[matched];
  13385. });
  13386. }
  13387. function getWindowScroll(node) {
  13388. var win = getWindow(node);
  13389. var scrollLeft = win.pageXOffset;
  13390. var scrollTop = win.pageYOffset;
  13391. return {
  13392. scrollLeft: scrollLeft,
  13393. scrollTop: scrollTop
  13394. };
  13395. }
  13396. function getWindowScrollBarX(element) {
  13397. // If <html> has a CSS width greater than the viewport, then this will be
  13398. // incorrect for RTL.
  13399. // Popper 1 is broken in this case and never had a bug report so let's assume
  13400. // it's not an issue. I don't think anyone ever specifies width on <html>
  13401. // anyway.
  13402. // Browsers where the left scrollbar doesn't cause an issue report `0` for
  13403. // this (e.g. Edge 2019, IE11, Safari)
  13404. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  13405. }
  13406. function getViewportRect(element) {
  13407. var win = getWindow(element);
  13408. var html = getDocumentElement(element);
  13409. var visualViewport = win.visualViewport;
  13410. var width = html.clientWidth;
  13411. var height = html.clientHeight;
  13412. var x = 0;
  13413. var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
  13414. // can be obscured underneath it.
  13415. // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
  13416. // if it isn't open, so if this isn't available, the popper will be detected
  13417. // to overflow the bottom of the screen too early.
  13418. if (visualViewport) {
  13419. width = visualViewport.width;
  13420. height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
  13421. // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
  13422. // errors due to floating point numbers, so we need to check precision.
  13423. // Safari returns a number <= 0, usually < -1 when pinch-zoomed
  13424. // Feature detection fails in mobile emulation mode in Chrome.
  13425. // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
  13426. // 0.001
  13427. // Fallback here: "Not Safari" userAgent
  13428. if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
  13429. x = visualViewport.offsetLeft;
  13430. y = visualViewport.offsetTop;
  13431. }
  13432. }
  13433. return {
  13434. width: width,
  13435. height: height,
  13436. x: x + getWindowScrollBarX(element),
  13437. y: y
  13438. };
  13439. }
  13440. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  13441. function getDocumentRect(element) {
  13442. var _element$ownerDocumen;
  13443. var html = getDocumentElement(element);
  13444. var winScroll = getWindowScroll(element);
  13445. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  13446. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  13447. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  13448. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  13449. var y = -winScroll.scrollTop;
  13450. if (getComputedStyle$1(body || html).direction === 'rtl') {
  13451. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  13452. }
  13453. return {
  13454. width: width,
  13455. height: height,
  13456. x: x,
  13457. y: y
  13458. };
  13459. }
  13460. function isScrollParent(element) {
  13461. // Firefox wants us to check `-x` and `-y` variations as well
  13462. var _getComputedStyle = getComputedStyle$1(element),
  13463. overflow = _getComputedStyle.overflow,
  13464. overflowX = _getComputedStyle.overflowX,
  13465. overflowY = _getComputedStyle.overflowY;
  13466. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  13467. }
  13468. function getScrollParent(node) {
  13469. if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
  13470. // $FlowFixMe[incompatible-return]: assume body is always available
  13471. return node.ownerDocument.body;
  13472. }
  13473. if (isHTMLElement(node) && isScrollParent(node)) {
  13474. return node;
  13475. }
  13476. return getScrollParent(getParentNode(node));
  13477. }
  13478. /*
  13479. given a DOM element, return the list of all scroll parents, up the list of ancesors
  13480. until we get to the top window object. This list is what we attach scroll listeners
  13481. to, because if any of these parent elements scroll, we'll need to re-calculate the
  13482. reference element's position.
  13483. */
  13484. function listScrollParents(element, list) {
  13485. var _element$ownerDocumen;
  13486. if (list === void 0) {
  13487. list = [];
  13488. }
  13489. var scrollParent = getScrollParent(element);
  13490. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  13491. var win = getWindow(scrollParent);
  13492. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  13493. var updatedList = list.concat(target);
  13494. return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  13495. updatedList.concat(listScrollParents(getParentNode(target)));
  13496. }
  13497. function rectToClientRect(rect) {
  13498. return Object.assign({}, rect, {
  13499. left: rect.x,
  13500. top: rect.y,
  13501. right: rect.x + rect.width,
  13502. bottom: rect.y + rect.height
  13503. });
  13504. }
  13505. function getInnerBoundingClientRect(element) {
  13506. var rect = getBoundingClientRect(element);
  13507. rect.top = rect.top + element.clientTop;
  13508. rect.left = rect.left + element.clientLeft;
  13509. rect.bottom = rect.top + element.clientHeight;
  13510. rect.right = rect.left + element.clientWidth;
  13511. rect.width = element.clientWidth;
  13512. rect.height = element.clientHeight;
  13513. rect.x = rect.left;
  13514. rect.y = rect.top;
  13515. return rect;
  13516. }
  13517. function getClientRectFromMixedType(element, clippingParent) {
  13518. return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  13519. } // A "clipping parent" is an overflowable container with the characteristic of
  13520. // clipping (or hiding) overflowing elements with a position different from
  13521. // `initial`
  13522. function getClippingParents(element) {
  13523. var clippingParents = listScrollParents(getParentNode(element));
  13524. var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0;
  13525. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  13526. if (!isElement(clipperElement)) {
  13527. return [];
  13528. } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
  13529. return clippingParents.filter(function (clippingParent) {
  13530. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
  13531. });
  13532. } // Gets the maximum area that the element is visible in due to any number of
  13533. // clipping parents
  13534. function getClippingRect(element, boundary, rootBoundary) {
  13535. var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
  13536. var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
  13537. var firstClippingParent = clippingParents[0];
  13538. var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
  13539. var rect = getClientRectFromMixedType(element, clippingParent);
  13540. accRect.top = max(rect.top, accRect.top);
  13541. accRect.right = min(rect.right, accRect.right);
  13542. accRect.bottom = min(rect.bottom, accRect.bottom);
  13543. accRect.left = max(rect.left, accRect.left);
  13544. return accRect;
  13545. }, getClientRectFromMixedType(element, firstClippingParent));
  13546. clippingRect.width = clippingRect.right - clippingRect.left;
  13547. clippingRect.height = clippingRect.bottom - clippingRect.top;
  13548. clippingRect.x = clippingRect.left;
  13549. clippingRect.y = clippingRect.top;
  13550. return clippingRect;
  13551. }
  13552. function computeOffsets(_ref) {
  13553. var reference = _ref.reference,
  13554. element = _ref.element,
  13555. placement = _ref.placement;
  13556. var basePlacement = placement ? getBasePlacement(placement) : null;
  13557. var variation = placement ? getVariation(placement) : null;
  13558. var commonX = reference.x + reference.width / 2 - element.width / 2;
  13559. var commonY = reference.y + reference.height / 2 - element.height / 2;
  13560. var offsets;
  13561. switch (basePlacement) {
  13562. case top:
  13563. offsets = {
  13564. x: commonX,
  13565. y: reference.y - element.height
  13566. };
  13567. break;
  13568. case bottom:
  13569. offsets = {
  13570. x: commonX,
  13571. y: reference.y + reference.height
  13572. };
  13573. break;
  13574. case right:
  13575. offsets = {
  13576. x: reference.x + reference.width,
  13577. y: commonY
  13578. };
  13579. break;
  13580. case left:
  13581. offsets = {
  13582. x: reference.x - element.width,
  13583. y: commonY
  13584. };
  13585. break;
  13586. default:
  13587. offsets = {
  13588. x: reference.x,
  13589. y: reference.y
  13590. };
  13591. }
  13592. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  13593. if (mainAxis != null) {
  13594. var len = mainAxis === 'y' ? 'height' : 'width';
  13595. switch (variation) {
  13596. case start:
  13597. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  13598. break;
  13599. case end:
  13600. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  13601. break;
  13602. }
  13603. }
  13604. return offsets;
  13605. }
  13606. function detectOverflow(state, options) {
  13607. if (options === void 0) {
  13608. options = {};
  13609. }
  13610. var _options = options,
  13611. _options$placement = _options.placement,
  13612. placement = _options$placement === void 0 ? state.placement : _options$placement,
  13613. _options$boundary = _options.boundary,
  13614. boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
  13615. _options$rootBoundary = _options.rootBoundary,
  13616. rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
  13617. _options$elementConte = _options.elementContext,
  13618. elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
  13619. _options$altBoundary = _options.altBoundary,
  13620. altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
  13621. _options$padding = _options.padding,
  13622. padding = _options$padding === void 0 ? 0 : _options$padding;
  13623. var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  13624. var altContext = elementContext === popper ? reference : popper;
  13625. var popperRect = state.rects.popper;
  13626. var element = state.elements[altBoundary ? altContext : elementContext];
  13627. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
  13628. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  13629. var popperOffsets = computeOffsets({
  13630. reference: referenceClientRect,
  13631. element: popperRect,
  13632. strategy: 'absolute',
  13633. placement: placement
  13634. });
  13635. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
  13636. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
  13637. // 0 or negative = within the clipping rect
  13638. var overflowOffsets = {
  13639. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  13640. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  13641. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  13642. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  13643. };
  13644. var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
  13645. if (elementContext === popper && offsetData) {
  13646. var offset = offsetData[placement];
  13647. Object.keys(overflowOffsets).forEach(function (key) {
  13648. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  13649. var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
  13650. overflowOffsets[key] += offset[axis] * multiply;
  13651. });
  13652. }
  13653. return overflowOffsets;
  13654. }
  13655. function computeAutoPlacement(state, options) {
  13656. if (options === void 0) {
  13657. options = {};
  13658. }
  13659. var _options = options,
  13660. placement = _options.placement,
  13661. boundary = _options.boundary,
  13662. rootBoundary = _options.rootBoundary,
  13663. padding = _options.padding,
  13664. flipVariations = _options.flipVariations,
  13665. _options$allowedAutoP = _options.allowedAutoPlacements,
  13666. allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  13667. var variation = getVariation(placement);
  13668. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
  13669. return getVariation(placement) === variation;
  13670. }) : basePlacements;
  13671. var allowedPlacements = placements$1.filter(function (placement) {
  13672. return allowedAutoPlacements.indexOf(placement) >= 0;
  13673. });
  13674. if (allowedPlacements.length === 0) {
  13675. allowedPlacements = placements$1;
  13676. } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
  13677. var overflows = allowedPlacements.reduce(function (acc, placement) {
  13678. acc[placement] = detectOverflow(state, {
  13679. placement: placement,
  13680. boundary: boundary,
  13681. rootBoundary: rootBoundary,
  13682. padding: padding
  13683. })[getBasePlacement(placement)];
  13684. return acc;
  13685. }, {});
  13686. return Object.keys(overflows).sort(function (a, b) {
  13687. return overflows[a] - overflows[b];
  13688. });
  13689. }
  13690. function getExpandedFallbackPlacements(placement) {
  13691. if (getBasePlacement(placement) === auto) {
  13692. return [];
  13693. }
  13694. var oppositePlacement = getOppositePlacement(placement);
  13695. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  13696. }
  13697. function flip(_ref) {
  13698. var state = _ref.state,
  13699. options = _ref.options,
  13700. name = _ref.name;
  13701. if (state.modifiersData[name]._skip) {
  13702. return;
  13703. }
  13704. var _options$mainAxis = options.mainAxis,
  13705. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  13706. _options$altAxis = options.altAxis,
  13707. checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
  13708. specifiedFallbackPlacements = options.fallbackPlacements,
  13709. padding = options.padding,
  13710. boundary = options.boundary,
  13711. rootBoundary = options.rootBoundary,
  13712. altBoundary = options.altBoundary,
  13713. _options$flipVariatio = options.flipVariations,
  13714. flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
  13715. allowedAutoPlacements = options.allowedAutoPlacements;
  13716. var preferredPlacement = state.options.placement;
  13717. var basePlacement = getBasePlacement(preferredPlacement);
  13718. var isBasePlacement = basePlacement === preferredPlacement;
  13719. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  13720. var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
  13721. return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
  13722. placement: placement,
  13723. boundary: boundary,
  13724. rootBoundary: rootBoundary,
  13725. padding: padding,
  13726. flipVariations: flipVariations,
  13727. allowedAutoPlacements: allowedAutoPlacements
  13728. }) : placement);
  13729. }, []);
  13730. var referenceRect = state.rects.reference;
  13731. var popperRect = state.rects.popper;
  13732. var checksMap = new Map();
  13733. var makeFallbackChecks = true;
  13734. var firstFittingPlacement = placements[0];
  13735. for (var i = 0; i < placements.length; i++) {
  13736. var placement = placements[i];
  13737. var _basePlacement = getBasePlacement(placement);
  13738. var isStartVariation = getVariation(placement) === start;
  13739. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  13740. var len = isVertical ? 'width' : 'height';
  13741. var overflow = detectOverflow(state, {
  13742. placement: placement,
  13743. boundary: boundary,
  13744. rootBoundary: rootBoundary,
  13745. altBoundary: altBoundary,
  13746. padding: padding
  13747. });
  13748. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  13749. if (referenceRect[len] > popperRect[len]) {
  13750. mainVariationSide = getOppositePlacement(mainVariationSide);
  13751. }
  13752. var altVariationSide = getOppositePlacement(mainVariationSide);
  13753. var checks = [];
  13754. if (checkMainAxis) {
  13755. checks.push(overflow[_basePlacement] <= 0);
  13756. }
  13757. if (checkAltAxis) {
  13758. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  13759. }
  13760. if (checks.every(function (check) {
  13761. return check;
  13762. })) {
  13763. firstFittingPlacement = placement;
  13764. makeFallbackChecks = false;
  13765. break;
  13766. }
  13767. checksMap.set(placement, checks);
  13768. }
  13769. if (makeFallbackChecks) {
  13770. // `2` may be desired in some cases – research later
  13771. var numberOfChecks = flipVariations ? 3 : 1;
  13772. var _loop = function _loop(_i) {
  13773. var fittingPlacement = placements.find(function (placement) {
  13774. var checks = checksMap.get(placement);
  13775. if (checks) {
  13776. return checks.slice(0, _i).every(function (check) {
  13777. return check;
  13778. });
  13779. }
  13780. });
  13781. if (fittingPlacement) {
  13782. firstFittingPlacement = fittingPlacement;
  13783. return "break";
  13784. }
  13785. };
  13786. for (var _i = numberOfChecks; _i > 0; _i--) {
  13787. var _ret = _loop(_i);
  13788. if (_ret === "break") break;
  13789. }
  13790. }
  13791. if (state.placement !== firstFittingPlacement) {
  13792. state.modifiersData[name]._skip = true;
  13793. state.placement = firstFittingPlacement;
  13794. state.reset = true;
  13795. }
  13796. } // eslint-disable-next-line import/no-unused-modules
  13797. var flip$1 = {
  13798. name: 'flip',
  13799. enabled: true,
  13800. phase: 'main',
  13801. fn: flip,
  13802. requiresIfExists: ['offset'],
  13803. data: {
  13804. _skip: false
  13805. }
  13806. };
  13807. function getSideOffsets(overflow, rect, preventedOffsets) {
  13808. if (preventedOffsets === void 0) {
  13809. preventedOffsets = {
  13810. x: 0,
  13811. y: 0
  13812. };
  13813. }
  13814. return {
  13815. top: overflow.top - rect.height - preventedOffsets.y,
  13816. right: overflow.right - rect.width + preventedOffsets.x,
  13817. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  13818. left: overflow.left - rect.width - preventedOffsets.x
  13819. };
  13820. }
  13821. function isAnySideFullyClipped(overflow) {
  13822. return [top, right, bottom, left].some(function (side) {
  13823. return overflow[side] >= 0;
  13824. });
  13825. }
  13826. function hide(_ref) {
  13827. var state = _ref.state,
  13828. name = _ref.name;
  13829. var referenceRect = state.rects.reference;
  13830. var popperRect = state.rects.popper;
  13831. var preventedOffsets = state.modifiersData.preventOverflow;
  13832. var referenceOverflow = detectOverflow(state, {
  13833. elementContext: 'reference'
  13834. });
  13835. var popperAltOverflow = detectOverflow(state, {
  13836. altBoundary: true
  13837. });
  13838. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  13839. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  13840. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  13841. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  13842. state.modifiersData[name] = {
  13843. referenceClippingOffsets: referenceClippingOffsets,
  13844. popperEscapeOffsets: popperEscapeOffsets,
  13845. isReferenceHidden: isReferenceHidden,
  13846. hasPopperEscaped: hasPopperEscaped
  13847. };
  13848. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  13849. 'data-popper-reference-hidden': isReferenceHidden,
  13850. 'data-popper-escaped': hasPopperEscaped
  13851. });
  13852. } // eslint-disable-next-line import/no-unused-modules
  13853. var hide$1 = {
  13854. name: 'hide',
  13855. enabled: true,
  13856. phase: 'main',
  13857. requiresIfExists: ['preventOverflow'],
  13858. fn: hide
  13859. };
  13860. function distanceAndSkiddingToXY(placement, rects, offset) {
  13861. var basePlacement = getBasePlacement(placement);
  13862. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  13863. var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
  13864. placement: placement
  13865. })) : offset,
  13866. skidding = _ref[0],
  13867. distance = _ref[1];
  13868. skidding = skidding || 0;
  13869. distance = (distance || 0) * invertDistance;
  13870. return [left, right].indexOf(basePlacement) >= 0 ? {
  13871. x: distance,
  13872. y: skidding
  13873. } : {
  13874. x: skidding,
  13875. y: distance
  13876. };
  13877. }
  13878. function offset(_ref2) {
  13879. var state = _ref2.state,
  13880. options = _ref2.options,
  13881. name = _ref2.name;
  13882. var _options$offset = options.offset,
  13883. offset = _options$offset === void 0 ? [0, 0] : _options$offset;
  13884. var data = placements.reduce(function (acc, placement) {
  13885. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
  13886. return acc;
  13887. }, {});
  13888. var _data$state$placement = data[state.placement],
  13889. x = _data$state$placement.x,
  13890. y = _data$state$placement.y;
  13891. if (state.modifiersData.popperOffsets != null) {
  13892. state.modifiersData.popperOffsets.x += x;
  13893. state.modifiersData.popperOffsets.y += y;
  13894. }
  13895. state.modifiersData[name] = data;
  13896. } // eslint-disable-next-line import/no-unused-modules
  13897. var offset$1 = {
  13898. name: 'offset',
  13899. enabled: true,
  13900. phase: 'main',
  13901. requires: ['popperOffsets'],
  13902. fn: offset
  13903. };
  13904. function popperOffsets(_ref) {
  13905. var state = _ref.state,
  13906. name = _ref.name;
  13907. // Offsets are the actual position the popper needs to have to be
  13908. // properly positioned near its reference element
  13909. // This is the most basic placement, and will be adjusted by
  13910. // the modifiers in the next step
  13911. state.modifiersData[name] = computeOffsets({
  13912. reference: state.rects.reference,
  13913. element: state.rects.popper,
  13914. strategy: 'absolute',
  13915. placement: state.placement
  13916. });
  13917. } // eslint-disable-next-line import/no-unused-modules
  13918. var popperOffsets$1 = {
  13919. name: 'popperOffsets',
  13920. enabled: true,
  13921. phase: 'read',
  13922. fn: popperOffsets,
  13923. data: {}
  13924. };
  13925. function getAltAxis(axis) {
  13926. return axis === 'x' ? 'y' : 'x';
  13927. }
  13928. function preventOverflow(_ref) {
  13929. var state = _ref.state,
  13930. options = _ref.options,
  13931. name = _ref.name;
  13932. var _options$mainAxis = options.mainAxis,
  13933. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  13934. _options$altAxis = options.altAxis,
  13935. checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
  13936. boundary = options.boundary,
  13937. rootBoundary = options.rootBoundary,
  13938. altBoundary = options.altBoundary,
  13939. padding = options.padding,
  13940. _options$tether = options.tether,
  13941. tether = _options$tether === void 0 ? true : _options$tether,
  13942. _options$tetherOffset = options.tetherOffset,
  13943. tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  13944. var overflow = detectOverflow(state, {
  13945. boundary: boundary,
  13946. rootBoundary: rootBoundary,
  13947. padding: padding,
  13948. altBoundary: altBoundary
  13949. });
  13950. var basePlacement = getBasePlacement(state.placement);
  13951. var variation = getVariation(state.placement);
  13952. var isBasePlacement = !variation;
  13953. var mainAxis = getMainAxisFromPlacement(basePlacement);
  13954. var altAxis = getAltAxis(mainAxis);
  13955. var popperOffsets = state.modifiersData.popperOffsets;
  13956. var referenceRect = state.rects.reference;
  13957. var popperRect = state.rects.popper;
  13958. var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
  13959. placement: state.placement
  13960. })) : tetherOffset;
  13961. var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
  13962. mainAxis: tetherOffsetValue,
  13963. altAxis: tetherOffsetValue
  13964. } : Object.assign({
  13965. mainAxis: 0,
  13966. altAxis: 0
  13967. }, tetherOffsetValue);
  13968. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  13969. var data = {
  13970. x: 0,
  13971. y: 0
  13972. };
  13973. if (!popperOffsets) {
  13974. return;
  13975. }
  13976. if (checkMainAxis) {
  13977. var _offsetModifierState$;
  13978. var mainSide = mainAxis === 'y' ? top : left;
  13979. var altSide = mainAxis === 'y' ? bottom : right;
  13980. var len = mainAxis === 'y' ? 'height' : 'width';
  13981. var offset = popperOffsets[mainAxis];
  13982. var min$1 = offset + overflow[mainSide];
  13983. var max$1 = offset - overflow[altSide];
  13984. var additive = tether ? -popperRect[len] / 2 : 0;
  13985. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  13986. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
  13987. // outside the reference bounds
  13988. var arrowElement = state.elements.arrow;
  13989. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  13990. width: 0,
  13991. height: 0
  13992. };
  13993. var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
  13994. var arrowPaddingMin = arrowPaddingObject[mainSide];
  13995. var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
  13996. // to include its full size in the calculation. If the reference is small
  13997. // and near the edge of a boundary, the popper can overflow even if the
  13998. // reference is not overflowing as well (e.g. virtual elements with no
  13999. // width or height)
  14000. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  14001. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  14002. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  14003. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  14004. var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  14005. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  14006. var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
  14007. var tetherMax = offset + maxOffset - offsetModifierValue;
  14008. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
  14009. popperOffsets[mainAxis] = preventedOffset;
  14010. data[mainAxis] = preventedOffset - offset;
  14011. }
  14012. if (checkAltAxis) {
  14013. var _offsetModifierState$2;
  14014. var _mainSide = mainAxis === 'x' ? top : left;
  14015. var _altSide = mainAxis === 'x' ? bottom : right;
  14016. var _offset = popperOffsets[altAxis];
  14017. var _len = altAxis === 'y' ? 'height' : 'width';
  14018. var _min = _offset + overflow[_mainSide];
  14019. var _max = _offset - overflow[_altSide];
  14020. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  14021. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  14022. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  14023. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  14024. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  14025. popperOffsets[altAxis] = _preventedOffset;
  14026. data[altAxis] = _preventedOffset - _offset;
  14027. }
  14028. state.modifiersData[name] = data;
  14029. } // eslint-disable-next-line import/no-unused-modules
  14030. var preventOverflow$1 = {
  14031. name: 'preventOverflow',
  14032. enabled: true,
  14033. phase: 'main',
  14034. fn: preventOverflow,
  14035. requiresIfExists: ['offset']
  14036. };
  14037. function getHTMLElementScroll(element) {
  14038. return {
  14039. scrollLeft: element.scrollLeft,
  14040. scrollTop: element.scrollTop
  14041. };
  14042. }
  14043. function getNodeScroll(node) {
  14044. if (node === getWindow(node) || !isHTMLElement(node)) {
  14045. return getWindowScroll(node);
  14046. } else {
  14047. return getHTMLElementScroll(node);
  14048. }
  14049. }
  14050. function isElementScaled(element) {
  14051. var rect = element.getBoundingClientRect();
  14052. var scaleX = round(rect.width) / element.offsetWidth || 1;
  14053. var scaleY = round(rect.height) / element.offsetHeight || 1;
  14054. return scaleX !== 1 || scaleY !== 1;
  14055. } // Returns the composite rect of an element relative to its offsetParent.
  14056. // Composite means it takes into account transforms as well as layout.
  14057. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  14058. if (isFixed === void 0) {
  14059. isFixed = false;
  14060. }
  14061. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  14062. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  14063. var documentElement = getDocumentElement(offsetParent);
  14064. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
  14065. var scroll = {
  14066. scrollLeft: 0,
  14067. scrollTop: 0
  14068. };
  14069. var offsets = {
  14070. x: 0,
  14071. y: 0
  14072. };
  14073. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  14074. if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
  14075. isScrollParent(documentElement)) {
  14076. scroll = getNodeScroll(offsetParent);
  14077. }
  14078. if (isHTMLElement(offsetParent)) {
  14079. offsets = getBoundingClientRect(offsetParent, true);
  14080. offsets.x += offsetParent.clientLeft;
  14081. offsets.y += offsetParent.clientTop;
  14082. } else if (documentElement) {
  14083. offsets.x = getWindowScrollBarX(documentElement);
  14084. }
  14085. }
  14086. return {
  14087. x: rect.left + scroll.scrollLeft - offsets.x,
  14088. y: rect.top + scroll.scrollTop - offsets.y,
  14089. width: rect.width,
  14090. height: rect.height
  14091. };
  14092. }
  14093. function order(modifiers) {
  14094. var map = new Map();
  14095. var visited = new Set();
  14096. var result = [];
  14097. modifiers.forEach(function (modifier) {
  14098. map.set(modifier.name, modifier);
  14099. }); // On visiting object, check for its dependencies and visit them recursively
  14100. function sort(modifier) {
  14101. visited.add(modifier.name);
  14102. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  14103. requires.forEach(function (dep) {
  14104. if (!visited.has(dep)) {
  14105. var depModifier = map.get(dep);
  14106. if (depModifier) {
  14107. sort(depModifier);
  14108. }
  14109. }
  14110. });
  14111. result.push(modifier);
  14112. }
  14113. modifiers.forEach(function (modifier) {
  14114. if (!visited.has(modifier.name)) {
  14115. // check for visited object
  14116. sort(modifier);
  14117. }
  14118. });
  14119. return result;
  14120. }
  14121. function orderModifiers(modifiers) {
  14122. // order based on dependencies
  14123. var orderedModifiers = order(modifiers); // order based on phase
  14124. return modifierPhases.reduce(function (acc, phase) {
  14125. return acc.concat(orderedModifiers.filter(function (modifier) {
  14126. return modifier.phase === phase;
  14127. }));
  14128. }, []);
  14129. }
  14130. function debounce(fn) {
  14131. var pending;
  14132. return function () {
  14133. if (!pending) {
  14134. pending = new Promise(function (resolve) {
  14135. Promise.resolve().then(function () {
  14136. pending = undefined;
  14137. resolve(fn());
  14138. });
  14139. });
  14140. }
  14141. return pending;
  14142. };
  14143. }
  14144. function mergeByName(modifiers) {
  14145. var merged = modifiers.reduce(function (merged, current) {
  14146. var existing = merged[current.name];
  14147. merged[current.name] = existing ? Object.assign({}, existing, current, {
  14148. options: Object.assign({}, existing.options, current.options),
  14149. data: Object.assign({}, existing.data, current.data)
  14150. }) : current;
  14151. return merged;
  14152. }, {}); // IE11 does not support Object.values
  14153. return Object.keys(merged).map(function (key) {
  14154. return merged[key];
  14155. });
  14156. }
  14157. var DEFAULT_OPTIONS = {
  14158. placement: 'bottom',
  14159. modifiers: [],
  14160. strategy: 'absolute'
  14161. };
  14162. function areValidElements() {
  14163. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  14164. args[_key] = arguments[_key];
  14165. }
  14166. return !args.some(function (element) {
  14167. return !(element && typeof element.getBoundingClientRect === 'function');
  14168. });
  14169. }
  14170. function popperGenerator(generatorOptions) {
  14171. if (generatorOptions === void 0) {
  14172. generatorOptions = {};
  14173. }
  14174. var _generatorOptions = generatorOptions,
  14175. _generatorOptions$def = _generatorOptions.defaultModifiers,
  14176. defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
  14177. _generatorOptions$def2 = _generatorOptions.defaultOptions,
  14178. defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  14179. return function createPopper(reference, popper, options) {
  14180. if (options === void 0) {
  14181. options = defaultOptions;
  14182. }
  14183. var state = {
  14184. placement: 'bottom',
  14185. orderedModifiers: [],
  14186. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  14187. modifiersData: {},
  14188. elements: {
  14189. reference: reference,
  14190. popper: popper
  14191. },
  14192. attributes: {},
  14193. styles: {}
  14194. };
  14195. var effectCleanupFns = [];
  14196. var isDestroyed = false;
  14197. var instance = {
  14198. state: state,
  14199. setOptions: function setOptions(setOptionsAction) {
  14200. var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
  14201. cleanupModifierEffects();
  14202. state.options = Object.assign({}, defaultOptions, state.options, options);
  14203. state.scrollParents = {
  14204. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  14205. popper: listScrollParents(popper)
  14206. }; // Orders the modifiers based on their dependencies and `phase`
  14207. // properties
  14208. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
  14209. state.orderedModifiers = orderedModifiers.filter(function (m) {
  14210. return m.enabled;
  14211. }); // Validate the provided modifiers so that the consumer will get warned
  14212. runModifierEffects();
  14213. return instance.update();
  14214. },
  14215. // Sync update – it will always be executed, even if not necessary. This
  14216. // is useful for low frequency updates where sync behavior simplifies the
  14217. // logic.
  14218. // For high frequency updates (e.g. `resize` and `scroll` events), always
  14219. // prefer the async Popper#update method
  14220. forceUpdate: function forceUpdate() {
  14221. if (isDestroyed) {
  14222. return;
  14223. }
  14224. var _state$elements = state.elements,
  14225. reference = _state$elements.reference,
  14226. popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
  14227. // anymore
  14228. if (!areValidElements(reference, popper)) {
  14229. return;
  14230. } // Store the reference and popper rects to be read by modifiers
  14231. state.rects = {
  14232. reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
  14233. popper: getLayoutRect(popper)
  14234. }; // Modifiers have the ability to reset the current update cycle. The
  14235. // most common use case for this is the `flip` modifier changing the
  14236. // placement, which then needs to re-run all the modifiers, because the
  14237. // logic was previously ran for the previous placement and is therefore
  14238. // stale/incorrect
  14239. state.reset = false;
  14240. state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
  14241. // is filled with the initial data specified by the modifier. This means
  14242. // it doesn't persist and is fresh on each update.
  14243. // To ensure persistent data, use `${name}#persistent`
  14244. state.orderedModifiers.forEach(function (modifier) {
  14245. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  14246. });
  14247. for (var index = 0; index < state.orderedModifiers.length; index++) {
  14248. if (state.reset === true) {
  14249. state.reset = false;
  14250. index = -1;
  14251. continue;
  14252. }
  14253. var _state$orderedModifie = state.orderedModifiers[index],
  14254. fn = _state$orderedModifie.fn,
  14255. _state$orderedModifie2 = _state$orderedModifie.options,
  14256. _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
  14257. name = _state$orderedModifie.name;
  14258. if (typeof fn === 'function') {
  14259. state = fn({
  14260. state: state,
  14261. options: _options,
  14262. name: name,
  14263. instance: instance
  14264. }) || state;
  14265. }
  14266. }
  14267. },
  14268. // Async and optimistically optimized update – it will not be executed if
  14269. // not necessary (debounced to run at most once-per-tick)
  14270. update: debounce(function () {
  14271. return new Promise(function (resolve) {
  14272. instance.forceUpdate();
  14273. resolve(state);
  14274. });
  14275. }),
  14276. destroy: function destroy() {
  14277. cleanupModifierEffects();
  14278. isDestroyed = true;
  14279. }
  14280. };
  14281. if (!areValidElements(reference, popper)) {
  14282. return instance;
  14283. }
  14284. instance.setOptions(options).then(function (state) {
  14285. if (!isDestroyed && options.onFirstUpdate) {
  14286. options.onFirstUpdate(state);
  14287. }
  14288. }); // Modifiers have the ability to execute arbitrary code before the first
  14289. // update cycle runs. They will be executed in the same order as the update
  14290. // cycle. This is useful when a modifier adds some persistent data that
  14291. // other modifiers need to use, but the modifier is run after the dependent
  14292. // one.
  14293. function runModifierEffects() {
  14294. state.orderedModifiers.forEach(function (_ref3) {
  14295. var name = _ref3.name,
  14296. _ref3$options = _ref3.options,
  14297. options = _ref3$options === void 0 ? {} : _ref3$options,
  14298. effect = _ref3.effect;
  14299. if (typeof effect === 'function') {
  14300. var cleanupFn = effect({
  14301. state: state,
  14302. name: name,
  14303. instance: instance,
  14304. options: options
  14305. });
  14306. var noopFn = function noopFn() {};
  14307. effectCleanupFns.push(cleanupFn || noopFn);
  14308. }
  14309. });
  14310. }
  14311. function cleanupModifierEffects() {
  14312. effectCleanupFns.forEach(function (fn) {
  14313. return fn();
  14314. });
  14315. effectCleanupFns = [];
  14316. }
  14317. return instance;
  14318. };
  14319. }
  14320. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  14321. var createPopper$1 = /*#__PURE__*/popperGenerator({
  14322. defaultModifiers: defaultModifiers
  14323. }); // eslint-disable-next-line import/no-unused-modules
  14324. const popperComputedPlacements = [
  14325. "top",
  14326. "bottom",
  14327. "right",
  14328. "left",
  14329. "top-start",
  14330. "top-end",
  14331. "bottom-start",
  14332. "bottom-end",
  14333. "right-start",
  14334. "right-end",
  14335. "left-start",
  14336. "left-end"
  14337. ];
  14338. const defaultMenuPlacement = "bottom-leading";
  14339. const popperMenuComputedPlacements = [
  14340. "top-start",
  14341. "top",
  14342. "top-end",
  14343. "bottom-start",
  14344. "bottom",
  14345. "bottom-end"
  14346. ];
  14347. const CSS$D = {
  14348. animation: "calcite-popper-anim",
  14349. animationActive: "calcite-popper-anim--active"
  14350. };
  14351. function filterComputedPlacements(placements, el) {
  14352. const filteredPlacements = placements.filter((placement) => popperComputedPlacements.includes(placement));
  14353. if (filteredPlacements.length !== placements.length) {
  14354. console.warn(`${el.tagName}: Invalid value found in: flipPlacements. Try any of these: ${popperComputedPlacements
  14355. .map((placement) => `"${placement}"`)
  14356. .join(", ")
  14357. .trim()}`, { el });
  14358. }
  14359. return filteredPlacements;
  14360. }
  14361. function getPlacement(el, placement) {
  14362. const placements = ["left", "right"];
  14363. const variations = ["start", "end"];
  14364. if (getElementDir(el) === "rtl") {
  14365. placements.reverse();
  14366. variations.reverse();
  14367. }
  14368. return placement
  14369. .replace(/-leading/gi, `-${variations[0]}`)
  14370. .replace(/-trailing/gi, `-${variations[1]}`)
  14371. .replace(/leading/gi, placements[0])
  14372. .replace(/trailing/gi, placements[1]);
  14373. }
  14374. function createPopper({ referenceEl, el, placement, overlayPositioning = "absolute", modifiers }) {
  14375. if (!referenceEl) {
  14376. return null;
  14377. }
  14378. return createPopper$1(referenceEl, el, {
  14379. strategy: overlayPositioning,
  14380. placement: getPlacement(el, placement),
  14381. modifiers
  14382. });
  14383. }
  14384. async function updatePopper({ el, modifiers, placement: PopperPlacement, popper }) {
  14385. const placement = getPlacement(el, PopperPlacement);
  14386. await popper.setOptions({
  14387. modifiers,
  14388. placement
  14389. });
  14390. }
  14391. function hypotenuse(sideA, sideB) {
  14392. return Math.sqrt(Math.pow(sideA, 2) + Math.pow(sideB, 2));
  14393. }
  14394. const visiblePointerSize = 4;
  14395. const defaultOffsetDistance = Math.ceil(hypotenuse(visiblePointerSize, visiblePointerSize));
  14396. const ComboboxItem$1 = "CALCITE-COMBOBOX-ITEM";
  14397. const ComboboxItemGroup$1 = "CALCITE-COMBOBOX-ITEM-GROUP";
  14398. const ComboboxChildSelector = `${ComboboxItem$1}, ${ComboboxItemGroup$1}`;
  14399. const TEXT$g = {
  14400. removeTag: "Remove tag"
  14401. };
  14402. function getAncestors(element) {
  14403. var _a, _b;
  14404. const parent = (_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.closest(ComboboxChildSelector);
  14405. const grandparent = (_b = parent === null || parent === void 0 ? void 0 : parent.parentElement) === null || _b === void 0 ? void 0 : _b.closest(ComboboxChildSelector);
  14406. return [parent, grandparent].filter((el) => el);
  14407. }
  14408. function getItemAncestors(item) {
  14409. var _a;
  14410. return (((_a = item.ancestors) === null || _a === void 0 ? void 0 : _a.filter((el) => el.nodeName === "CALCITE-COMBOBOX-ITEM")) || []);
  14411. }
  14412. function getItemChildren(item) {
  14413. return nodeListToArray(item.querySelectorAll("calcite-combobox-item"));
  14414. }
  14415. function hasActiveChildren(node) {
  14416. const items = nodeListToArray(node.querySelectorAll("calcite-combobox-item"));
  14417. return items.filter((item) => item.selected).length > 0;
  14418. }
  14419. function getDepth(element) {
  14420. {
  14421. return 0;
  14422. }
  14423. }
  14424. const comboboxCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-combobox:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-combobox{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-combobox:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-combobox-h{display:none}/*!@:host*/.sc-calcite-combobox-h{position:relative;display:block}/*!@:host([disabled])*/[disabled].sc-calcite-combobox-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-combobox-h[disabled] .sc-calcite-combobox-s>[calcite-hydrated][disabled],[disabled].sc-calcite-combobox-h [calcite-hydrated][disabled].sc-calcite-combobox{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-combobox-h{font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-combobox-h{font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:2rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-combobox-h{font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:2.75rem}/*!@.wrapper*/.wrapper.sc-calcite-combobox{display:-ms-flexbox;display:flex;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);padding:calc(var(--calcite-combobox-item-spacing-unit-s) / 4) var(--calcite-combobox-item-spacing-unit-l)}/*!@:host(:focus-within) .wrapper, .wrapper--active*/.sc-calcite-combobox-h:focus-within .wrapper.sc-calcite-combobox,.wrapper--active.sc-calcite-combobox{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.wrapper--single*/.wrapper--single.sc-calcite-combobox{padding:0 var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;-ms-flex-wrap:nowrap;flex-wrap:nowrap}/*!@.grid-input*/.grid-input.sc-calcite-combobox{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}/*!@.input*/.input.sc-calcite-combobox{-ms-flex-positive:1;flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;height:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-width:120px;margin-bottom:var(--calcite-combobox-item-spacing-unit-s)}/*!@.input:focus*/.input.sc-calcite-combobox:focus{outline:2px solid transparent;outline-offset:2px}/*!@.input--transparent*/.input--transparent.sc-calcite-combobox{opacity:0}/*!@.input--single*/.input--single.sc-calcite-combobox{margin-bottom:0px;margin-top:0px;padding:0px}/*!@.wrapper--active .input-single*/.wrapper--active.sc-calcite-combobox .input-single.sc-calcite-combobox{cursor:text}/*!@.input--hidden*/.input--hidden.sc-calcite-combobox{pointer-events:none;width:0px;min-width:0px;opacity:0}/*!@.input--icon*/.input--icon.sc-calcite-combobox{padding:0 var(--calcite-combobox-item-spacing-unit-l)}/*!@.input-wrap*/.input-wrap.sc-calcite-combobox{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1}/*!@.input-wrap--single*/.input-wrap--single.sc-calcite-combobox{-ms-flex:1 1 0%;flex:1 1 0%;overflow:hidden}/*!@.label*/.label.sc-calcite-combobox{pointer-events:none;display:-ms-flexbox;display:flex;max-width:100%;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);height:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}/*!@.label--spaced*/.label--spaced.sc-calcite-combobox{padding-top:0px;padding-bottom:0px;padding-left:var(--calcite-combobox-item-spacing-unit-l);padding-right:var(--calcite-combobox-item-spacing-unit-l)}/*!@.icon-end, .icon-start*/.icon-end.sc-calcite-combobox,.icon-start.sc-calcite-combobox{display:-ms-flexbox;display:flex;width:1rem;cursor:pointer;-ms-flex-align:center;align-items:center}/*!@.icon-end*/.icon-end.sc-calcite-combobox{-ms-flex:none;flex:none}/*!@.popper-container*/.popper-container.sc-calcite-combobox{width:100%;display:block;position:absolute;z-index:900;-webkit-transform:scale(0);transform:scale(0);visibility:hidden;pointer-events:none}/*!@.popper-container .calcite-popper-anim*/.popper-container.sc-calcite-combobox .calcite-popper-anim.sc-calcite-combobox{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}/*!@.popper-container[data-popper-placement^=bottom] .calcite-popper-anim*/.popper-container[data-popper-placement^=bottom].sc-calcite-combobox .calcite-popper-anim.sc-calcite-combobox{-webkit-transform:translateY(-5px);transform:translateY(-5px)}/*!@.popper-container[data-popper-placement^=top] .calcite-popper-anim*/.popper-container[data-popper-placement^=top].sc-calcite-combobox .calcite-popper-anim.sc-calcite-combobox{-webkit-transform:translateY(5px);transform:translateY(5px)}/*!@.popper-container[data-popper-placement^=left] .calcite-popper-anim*/.popper-container[data-popper-placement^=left].sc-calcite-combobox .calcite-popper-anim.sc-calcite-combobox{-webkit-transform:translateX(5px);transform:translateX(5px)}/*!@.popper-container[data-popper-placement^=right] .calcite-popper-anim*/.popper-container[data-popper-placement^=right].sc-calcite-combobox .calcite-popper-anim.sc-calcite-combobox{-webkit-transform:translateX(-5px);transform:translateX(-5px)}/*!@.popper-container[data-popper-placement] .calcite-popper-anim--active*/.popper-container[data-popper-placement].sc-calcite-combobox .calcite-popper-anim--active.sc-calcite-combobox{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}/*!@.popper-container--active*/.popper-container--active.sc-calcite-combobox{pointer-events:initial;visibility:visible}/*!@.screen-readers-only*/.screen-readers-only.sc-calcite-combobox{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}/*!@.list-container*/.list-container.sc-calcite-combobox{max-height:100vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);width:var(--calcite-dropdown-width)}/*!@.list*/.list.sc-calcite-combobox{margin:0px;display:block;padding:0px}/*!@.list--hide*/.list--hide.sc-calcite-combobox{height:0px;overflow:hidden}/*!@.chip*/.chip.sc-calcite-combobox{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);margin-inline:0 var(--calcite-combobox-item-spacing-unit-s);max-width:100%}/*!@.chip--active*/.chip--active.sc-calcite-combobox{background-color:var(--calcite-ui-foreground-3)}/*!@.item*/.item.sc-calcite-combobox{display:block}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-combobox-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  14425. const isGroup = (el) => el.tagName === ComboboxItemGroup$1;
  14426. const itemUidPrefix = "combobox-item-";
  14427. const chipUidPrefix = "combobox-chip-";
  14428. const labelUidPrefix = "combobox-label-";
  14429. const listboxUidPrefix = "combobox-listbox-";
  14430. const inputUidPrefix = "combobox-input-";
  14431. /**
  14432. * @slot - A slot for adding `calcite-combobox-item`s.
  14433. */
  14434. class Combobox {
  14435. constructor(hostRef) {
  14436. registerInstance(this, hostRef);
  14437. this.calciteLookupChange = createEvent(this, "calciteLookupChange", 7);
  14438. this.calciteComboboxChange = createEvent(this, "calciteComboboxChange", 7);
  14439. this.calciteComboboxFilterChange = createEvent(this, "calciteComboboxFilterChange", 7);
  14440. this.calciteComboboxChipDismiss = createEvent(this, "calciteComboboxChipDismiss", 7);
  14441. this.calciteComboboxOpen = createEvent(this, "calciteComboboxOpen", 7);
  14442. this.calciteComboboxClose = createEvent(this, "calciteComboboxClose", 7);
  14443. //--------------------------------------------------------------------------
  14444. //
  14445. // Public Properties
  14446. //
  14447. //--------------------------------------------------------------------------
  14448. /** Opens or closes the combobox */
  14449. this.active = false;
  14450. /** Disable combobox input */
  14451. this.disabled = false;
  14452. /** Specify the maximum number of combobox items (including nested children) to display before showing the scroller */
  14453. this.maxItems = 0;
  14454. /** Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value. */
  14455. this.overlayPositioning = "absolute";
  14456. /**
  14457. * When true, makes the component required for form-submission.
  14458. *
  14459. * @internal
  14460. */
  14461. this.required = false;
  14462. /** specify the selection mode
  14463. * - multi: allow any number of selected items (default)
  14464. * - single: only one selection)
  14465. * - ancestors: like multi, but show ancestors of selected items as selected, only deepest children shown in chips
  14466. */
  14467. this.selectionMode = "multi";
  14468. /** Specify the scale of the combobox, defaults to m */
  14469. this.scale = "m";
  14470. /** The value(s) of the selectedItem(s) */
  14471. this.value = null;
  14472. /** string to override the English "Remove tag" text for when an item is selected.
  14473. * @default "Remove tag"
  14474. */
  14475. this.intlRemoveTag = TEXT$g.removeTag;
  14476. this.internalValueChangeFlag = false;
  14477. this.items = [];
  14478. this.groupItems = [];
  14479. this.selectedItems = [];
  14480. this.visibleItems = [];
  14481. this.activeItemIndex = -1;
  14482. this.activeChipIndex = -1;
  14483. this.activeDescendant = "";
  14484. this.text = "";
  14485. this.textInput = null;
  14486. this.mutationObserver = createObserver();
  14487. this.resizeObserver = createObserver();
  14488. this.guid = guid();
  14489. this.inputHeight = 0;
  14490. this.ignoreSelectedEventsFlag = false;
  14491. this.activeTransitionProp = "opacity";
  14492. // --------------------------------------------------------------------------
  14493. //
  14494. // Private Methods
  14495. //
  14496. // --------------------------------------------------------------------------
  14497. this.setFilteredPlacements = () => {
  14498. const { el, flipPlacements } = this;
  14499. this.filteredFlipPlacements = flipPlacements
  14500. ? filterComputedPlacements(flipPlacements, el)
  14501. : null;
  14502. };
  14503. this.getValue = () => {
  14504. const items = this.selectedItems.map((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.toString(); });
  14505. return (items === null || items === void 0 ? void 0 : items.length) ? (items.length > 1 ? items : items[0]) : "";
  14506. };
  14507. this.onLabelClick = () => {
  14508. this.setFocus();
  14509. };
  14510. this.keydownHandler = (event) => {
  14511. const { key } = event;
  14512. switch (key) {
  14513. case "Tab":
  14514. this.activeChipIndex = -1;
  14515. this.activeItemIndex = -1;
  14516. if (this.allowCustomValues && this.text) {
  14517. this.addCustomChip(this.text, true);
  14518. event.preventDefault();
  14519. }
  14520. else if (this.active) {
  14521. this.active = false;
  14522. event.preventDefault();
  14523. }
  14524. break;
  14525. case "ArrowLeft":
  14526. this.previousChip();
  14527. break;
  14528. case "ArrowRight":
  14529. this.nextChip();
  14530. break;
  14531. case "ArrowUp":
  14532. this.shiftActiveItemIndex(-1);
  14533. if (!this.comboboxInViewport()) {
  14534. this.el.scrollIntoView();
  14535. }
  14536. break;
  14537. case "ArrowDown":
  14538. if (!this.active) {
  14539. event.preventDefault();
  14540. this.active = true;
  14541. }
  14542. this.shiftActiveItemIndex(1);
  14543. if (!this.comboboxInViewport()) {
  14544. this.el.scrollIntoView();
  14545. }
  14546. break;
  14547. case " ":
  14548. if (!this.textInput.value) {
  14549. event.preventDefault();
  14550. this.active = true;
  14551. this.shiftActiveItemIndex(1);
  14552. }
  14553. break;
  14554. case "Home":
  14555. if (this.active) {
  14556. event.preventDefault();
  14557. }
  14558. this.updateActiveItemIndex(0);
  14559. this.scrollToActiveItem();
  14560. if (!this.comboboxInViewport()) {
  14561. this.el.scrollIntoView();
  14562. }
  14563. break;
  14564. case "End":
  14565. if (this.active) {
  14566. event.preventDefault();
  14567. }
  14568. this.updateActiveItemIndex(this.visibleItems.length - 1);
  14569. this.scrollToActiveItem();
  14570. if (!this.comboboxInViewport()) {
  14571. this.el.scrollIntoView();
  14572. }
  14573. break;
  14574. case "Escape":
  14575. this.active = false;
  14576. break;
  14577. case "Enter":
  14578. if (this.activeItemIndex > -1) {
  14579. this.toggleSelection(this.visibleItems[this.activeItemIndex]);
  14580. }
  14581. else if (this.activeChipIndex > -1) {
  14582. this.removeActiveChip();
  14583. }
  14584. else if (this.allowCustomValues && this.text) {
  14585. this.addCustomChip(this.text, true);
  14586. }
  14587. else if (!event.defaultPrevented) {
  14588. submitForm(this);
  14589. }
  14590. break;
  14591. case "Delete":
  14592. case "Backspace":
  14593. if (this.activeChipIndex > -1) {
  14594. this.removeActiveChip();
  14595. }
  14596. else if (!this.text && this.isMulti()) {
  14597. this.removeLastChip();
  14598. }
  14599. break;
  14600. }
  14601. };
  14602. this.toggleCloseEnd = () => {
  14603. this.active = false;
  14604. this.el.removeEventListener("calciteComboboxClose", this.toggleCloseEnd);
  14605. };
  14606. this.toggleOpenEnd = () => {
  14607. this.active = true;
  14608. this.el.removeEventListener("calciteComboboxOpen", this.toggleOpenEnd);
  14609. };
  14610. this.transitionEnd = (event) => {
  14611. if (event.propertyName === this.activeTransitionProp) {
  14612. this.active ? this.calciteComboboxOpen.emit() : this.calciteComboboxClose.emit();
  14613. }
  14614. };
  14615. this.setMaxScrollerHeight = () => {
  14616. const { active, listContainerEl } = this;
  14617. if (!listContainerEl || !active) {
  14618. return;
  14619. }
  14620. this.reposition();
  14621. const maxScrollerHeight = this.getMaxScrollerHeight();
  14622. listContainerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
  14623. this.reposition();
  14624. };
  14625. this.calciteChipDismissHandler = (event, comboboxItem) => {
  14626. this.active = false;
  14627. const selection = this.items.find((item) => item === comboboxItem);
  14628. if (selection) {
  14629. this.toggleSelection(selection, false);
  14630. }
  14631. this.calciteComboboxChipDismiss.emit(event.detail);
  14632. };
  14633. this.clickHandler = (event) => {
  14634. if (event.composedPath().some((node) => node.tagName === "CALCITE-CHIP")) {
  14635. return;
  14636. }
  14637. this.active = !this.active;
  14638. this.updateActiveItemIndex(0);
  14639. this.setFocus();
  14640. };
  14641. this.setInactiveIfNotContained = (event) => {
  14642. const composedPath = event.composedPath();
  14643. if (!this.active || composedPath.includes(this.el) || composedPath.includes(this.referenceEl)) {
  14644. return;
  14645. }
  14646. if (this.allowCustomValues && this.text.trim().length) {
  14647. this.addCustomChip(this.text);
  14648. }
  14649. if (this.selectionMode === "single") {
  14650. if (this.textInput) {
  14651. this.textInput.value = "";
  14652. }
  14653. this.text = "";
  14654. this.filterItems("");
  14655. this.updateActiveItemIndex(-1);
  14656. }
  14657. this.active = false;
  14658. };
  14659. this.setMenuEl = (el) => {
  14660. this.menuEl = el;
  14661. };
  14662. this.setListContainerEl = (el) => {
  14663. this.resizeObserver.observe(el);
  14664. this.listContainerEl = el;
  14665. };
  14666. this.setReferenceEl = (el) => {
  14667. this.referenceEl = el;
  14668. };
  14669. this.inputHandler = (event) => {
  14670. const value = event.target.value;
  14671. this.text = value;
  14672. this.filterItems(value);
  14673. if (value) {
  14674. this.activeChipIndex = -1;
  14675. }
  14676. };
  14677. this.filterItems = (() => {
  14678. const find = (item, filteredData) => item &&
  14679. filteredData.some(({ label, value }) => {
  14680. if (isGroup(item)) {
  14681. return value === item.label;
  14682. }
  14683. return (value === item.textLabel ||
  14684. value === item.value ||
  14685. label === item.textLabel ||
  14686. label === item.value);
  14687. });
  14688. return debounce$1((text) => {
  14689. const filteredData = filter(this.data, text);
  14690. const items = this.getCombinedItems();
  14691. items.forEach((item) => {
  14692. const hidden = !find(item, filteredData);
  14693. item.hidden = hidden;
  14694. const [parent, grandparent] = item.ancestors;
  14695. if (find(parent, filteredData) || find(grandparent, filteredData)) {
  14696. item.hidden = false;
  14697. }
  14698. if (!hidden) {
  14699. item.ancestors.forEach((ancestor) => (ancestor.hidden = false));
  14700. }
  14701. });
  14702. this.visibleItems = this.getVisibleItems();
  14703. this.calciteComboboxFilterChange.emit({ visibleItems: [...this.visibleItems], text: text });
  14704. }, 100);
  14705. })();
  14706. this.internalCalciteLookupChangeEvent = () => {
  14707. this.calciteLookupChange.emit(this.selectedItems);
  14708. };
  14709. this.emitCalciteLookupChange = debounce$1(this.internalCalciteLookupChangeEvent, 0);
  14710. this.internalComboboxChangeEvent = () => {
  14711. const { selectedItems } = this;
  14712. this.calciteComboboxChange.emit({ selectedItems });
  14713. };
  14714. this.emitComboboxChange = debounce$1(this.internalComboboxChangeEvent, 0);
  14715. this.updateItems = () => {
  14716. this.items = this.getItems();
  14717. this.groupItems = this.getGroupItems();
  14718. this.data = this.getData();
  14719. this.selectedItems = this.getSelectedItems();
  14720. this.visibleItems = this.getVisibleItems();
  14721. this.needsIcon = this.getNeedsIcon();
  14722. if (!this.allowCustomValues) {
  14723. this.setMaxScrollerHeight();
  14724. }
  14725. };
  14726. this.scrollToActiveItem = () => {
  14727. const activeItem = this.visibleItems[this.activeItemIndex];
  14728. const height = this.calculateSingleItemHeight(activeItem);
  14729. const { offsetHeight, scrollTop } = this.listContainerEl;
  14730. if (offsetHeight + scrollTop < activeItem.offsetTop + height) {
  14731. this.listContainerEl.scrollTop = activeItem.offsetTop - offsetHeight + height;
  14732. }
  14733. else if (activeItem.offsetTop < scrollTop) {
  14734. this.listContainerEl.scrollTop = activeItem.offsetTop;
  14735. }
  14736. };
  14737. this.comboboxFocusHandler = () => {
  14738. var _a;
  14739. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  14740. };
  14741. this.comboboxBlurHandler = (event) => {
  14742. this.setInactiveIfNotContained(event);
  14743. };
  14744. }
  14745. activeHandler() {
  14746. if (this.disabled) {
  14747. this.active = false;
  14748. return;
  14749. }
  14750. this.reposition();
  14751. }
  14752. handleDisabledChange(value) {
  14753. if (!value) {
  14754. this.active = false;
  14755. }
  14756. }
  14757. maxItemsHandler() {
  14758. this.setMaxScrollerHeight();
  14759. }
  14760. valueHandler(value) {
  14761. if (!this.internalValueChangeFlag) {
  14762. const items = this.getItems();
  14763. if (Array.isArray(value)) {
  14764. items.forEach((item) => (item.selected = value.includes(item.value)));
  14765. }
  14766. else if (value) {
  14767. items.forEach((item) => (item.selected = value === item.value));
  14768. }
  14769. else {
  14770. items.forEach((item) => (item.selected = false));
  14771. }
  14772. this.updateItems();
  14773. }
  14774. }
  14775. flipPlacementsHandler() {
  14776. this.setFilteredPlacements();
  14777. }
  14778. //--------------------------------------------------------------------------
  14779. //
  14780. // Event Listeners
  14781. //
  14782. //--------------------------------------------------------------------------
  14783. documentClickHandler(event) {
  14784. this.setInactiveIfNotContained(event);
  14785. }
  14786. calciteComboboxItemChangeHandler(event) {
  14787. if (this.ignoreSelectedEventsFlag) {
  14788. return;
  14789. }
  14790. const target = event.target;
  14791. const newIndex = this.visibleItems.indexOf(target);
  14792. this.updateActiveItemIndex(newIndex);
  14793. this.toggleSelection(target, target.selected);
  14794. }
  14795. //--------------------------------------------------------------------------
  14796. //
  14797. // Public Methods
  14798. //
  14799. //--------------------------------------------------------------------------
  14800. /** Updates the position of the component. */
  14801. async reposition() {
  14802. const { popper, menuEl } = this;
  14803. const modifiers = this.getModifiers();
  14804. popper
  14805. ? await updatePopper({
  14806. el: menuEl,
  14807. modifiers,
  14808. placement: defaultMenuPlacement,
  14809. popper
  14810. })
  14811. : this.createPopper();
  14812. }
  14813. /** Sets focus on the component. */
  14814. async setFocus() {
  14815. var _a;
  14816. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  14817. this.activeChipIndex = -1;
  14818. this.activeItemIndex = -1;
  14819. }
  14820. // --------------------------------------------------------------------------
  14821. //
  14822. // Lifecycle
  14823. //
  14824. // --------------------------------------------------------------------------
  14825. connectedCallback() {
  14826. var _a;
  14827. this.internalValueChangeFlag = true;
  14828. this.value = this.getValue();
  14829. this.internalValueChangeFlag = false;
  14830. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  14831. this.createPopper();
  14832. connectLabel(this);
  14833. connectForm(this);
  14834. this.setFilteredPlacements();
  14835. }
  14836. componentWillLoad() {
  14837. this.updateItems();
  14838. }
  14839. componentDidLoad() {
  14840. afterConnectDefaultValueSet(this, this.getValue());
  14841. }
  14842. componentDidRender() {
  14843. if (this.el.offsetHeight !== this.inputHeight) {
  14844. this.reposition();
  14845. this.inputHeight = this.el.offsetHeight;
  14846. }
  14847. updateHostInteraction(this);
  14848. }
  14849. disconnectedCallback() {
  14850. var _a, _b;
  14851. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  14852. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
  14853. this.destroyPopper();
  14854. disconnectLabel(this);
  14855. disconnectForm(this);
  14856. }
  14857. selectedItemsHandler() {
  14858. this.internalValueChangeFlag = true;
  14859. this.value = this.getValue();
  14860. this.internalValueChangeFlag = false;
  14861. }
  14862. /** when search text is cleared, reset active to */
  14863. textHandler() {
  14864. this.updateActiveItemIndex(-1);
  14865. }
  14866. comboboxInViewport() {
  14867. const bounding = this.el.getBoundingClientRect();
  14868. return (bounding.top >= 0 &&
  14869. bounding.left >= 0 &&
  14870. bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
  14871. bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight));
  14872. }
  14873. getModifiers() {
  14874. const flipModifier = {
  14875. name: "flip",
  14876. enabled: true
  14877. };
  14878. flipModifier.options = {
  14879. fallbackPlacements: this.filteredFlipPlacements || popperMenuComputedPlacements
  14880. };
  14881. const eventListenerModifier = {
  14882. name: "eventListeners",
  14883. enabled: this.active
  14884. };
  14885. return [flipModifier, eventListenerModifier];
  14886. }
  14887. createPopper() {
  14888. this.destroyPopper();
  14889. const { menuEl, referenceEl, overlayPositioning } = this;
  14890. const modifiers = this.getModifiers();
  14891. this.popper = createPopper({
  14892. el: menuEl,
  14893. modifiers,
  14894. overlayPositioning,
  14895. placement: defaultMenuPlacement,
  14896. referenceEl
  14897. });
  14898. }
  14899. destroyPopper() {
  14900. const { popper } = this;
  14901. if (popper) {
  14902. popper.destroy();
  14903. }
  14904. this.popper = null;
  14905. }
  14906. getMaxScrollerHeight() {
  14907. const items = this.getCombinedItems().filter((item) => !item.hidden);
  14908. const { maxItems } = this;
  14909. let itemsToProcess = 0;
  14910. let maxScrollerHeight = 0;
  14911. if (items.length > maxItems) {
  14912. items.forEach((item) => {
  14913. if (itemsToProcess < maxItems && maxItems > 0) {
  14914. const height = this.calculateSingleItemHeight(item);
  14915. if (height > 0) {
  14916. maxScrollerHeight += height;
  14917. itemsToProcess++;
  14918. }
  14919. }
  14920. });
  14921. }
  14922. return maxScrollerHeight;
  14923. }
  14924. calculateSingleItemHeight(item) {
  14925. let height = item.offsetHeight;
  14926. // if item has children items, don't count their height twice
  14927. const children = Array.from(item.querySelectorAll(ComboboxChildSelector));
  14928. children
  14929. .map((child) => child === null || child === void 0 ? void 0 : child.offsetHeight)
  14930. .forEach((offsetHeight) => {
  14931. height -= offsetHeight;
  14932. });
  14933. return height;
  14934. }
  14935. getCombinedItems() {
  14936. return [...this.groupItems, ...this.items];
  14937. }
  14938. toggleSelection(item, value = !item.selected) {
  14939. if (!item) {
  14940. return;
  14941. }
  14942. if (this.isMulti()) {
  14943. item.selected = value;
  14944. this.updateAncestors(item);
  14945. this.selectedItems = this.getSelectedItems();
  14946. this.emitCalciteLookupChange();
  14947. this.emitComboboxChange();
  14948. this.resetText();
  14949. this.filterItems("");
  14950. }
  14951. else {
  14952. this.ignoreSelectedEventsFlag = true;
  14953. this.items.forEach((el) => (el.selected = el === item ? value : false));
  14954. this.ignoreSelectedEventsFlag = false;
  14955. this.selectedItems = this.getSelectedItems();
  14956. this.emitComboboxChange();
  14957. if (this.textInput) {
  14958. this.textInput.value = item.textLabel;
  14959. }
  14960. this.active = false;
  14961. this.updateActiveItemIndex(-1);
  14962. this.resetText();
  14963. this.filterItems("");
  14964. }
  14965. }
  14966. updateAncestors(item) {
  14967. if (this.selectionMode !== "ancestors") {
  14968. return;
  14969. }
  14970. const ancestors = getItemAncestors(item);
  14971. const children = getItemChildren(item);
  14972. if (item.selected) {
  14973. ancestors.forEach((el) => {
  14974. el.selected = true;
  14975. });
  14976. }
  14977. else {
  14978. children.forEach((el) => (el.selected = false));
  14979. [...ancestors].forEach((el) => {
  14980. if (!hasActiveChildren(el)) {
  14981. el.selected = false;
  14982. }
  14983. });
  14984. }
  14985. }
  14986. getVisibleItems() {
  14987. return this.items.filter((item) => !item.hidden);
  14988. }
  14989. getSelectedItems() {
  14990. if (!this.isMulti()) {
  14991. const match = this.items.find(({ selected }) => selected);
  14992. return match ? [match] : [];
  14993. }
  14994. return (this.items
  14995. .filter((item) => item.selected && (this.selectionMode !== "ancestors" || !hasActiveChildren(item)))
  14996. /** Preserve order of entered tags */
  14997. .sort((a, b) => {
  14998. const aIdx = this.selectedItems.indexOf(a);
  14999. const bIdx = this.selectedItems.indexOf(b);
  15000. if (aIdx > -1 && bIdx > -1) {
  15001. return aIdx - bIdx;
  15002. }
  15003. return bIdx - aIdx;
  15004. }));
  15005. }
  15006. getData() {
  15007. return this.items.map((item) => ({
  15008. constant: item.constant,
  15009. value: item.value,
  15010. label: item.textLabel
  15011. }));
  15012. }
  15013. getNeedsIcon() {
  15014. return this.selectionMode === "single" && this.items.some((item) => item.icon);
  15015. }
  15016. resetText() {
  15017. if (this.textInput) {
  15018. this.textInput.value = "";
  15019. }
  15020. this.text = "";
  15021. }
  15022. getItems() {
  15023. const items = Array.from(this.el.querySelectorAll(ComboboxItem$1));
  15024. return items.filter((item) => !item.disabled);
  15025. }
  15026. getGroupItems() {
  15027. return Array.from(this.el.querySelectorAll(ComboboxItemGroup$1));
  15028. }
  15029. addCustomChip(value, focus) {
  15030. const existingItem = this.items.find((el) => el.textLabel === value);
  15031. if (existingItem) {
  15032. this.toggleSelection(existingItem, true);
  15033. }
  15034. else {
  15035. if (!this.isMulti()) {
  15036. this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
  15037. }
  15038. const item = document.createElement(ComboboxItem$1);
  15039. item.value = value;
  15040. item.textLabel = value;
  15041. item.selected = true;
  15042. this.el.appendChild(item);
  15043. this.resetText();
  15044. if (focus) {
  15045. this.setFocus();
  15046. }
  15047. this.updateItems();
  15048. this.filterItems("");
  15049. this.emitCalciteLookupChange();
  15050. this.emitComboboxChange();
  15051. }
  15052. }
  15053. removeActiveChip() {
  15054. this.toggleSelection(this.selectedItems[this.activeChipIndex], false);
  15055. this.setFocus();
  15056. }
  15057. removeLastChip() {
  15058. this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
  15059. this.setFocus();
  15060. }
  15061. previousChip() {
  15062. if (this.text) {
  15063. return;
  15064. }
  15065. const length = this.selectedItems.length - 1;
  15066. const active = this.activeChipIndex;
  15067. this.activeChipIndex = active === -1 ? length : Math.max(active - 1, 0);
  15068. this.updateActiveItemIndex(-1);
  15069. this.focusChip();
  15070. }
  15071. nextChip() {
  15072. if (this.text || this.activeChipIndex === -1) {
  15073. return;
  15074. }
  15075. const last = this.selectedItems.length - 1;
  15076. const newIndex = this.activeChipIndex + 1;
  15077. if (newIndex > last) {
  15078. this.activeChipIndex = -1;
  15079. this.setFocus();
  15080. }
  15081. else {
  15082. this.activeChipIndex = newIndex;
  15083. this.focusChip();
  15084. }
  15085. this.updateActiveItemIndex(-1);
  15086. }
  15087. focusChip() {
  15088. var _a;
  15089. const guid = (_a = this.selectedItems[this.activeChipIndex]) === null || _a === void 0 ? void 0 : _a.guid;
  15090. const chip = guid
  15091. ? this.referenceEl.querySelector(`#${chipUidPrefix}${guid}`)
  15092. : null;
  15093. chip === null || chip === void 0 ? void 0 : chip.setFocus();
  15094. }
  15095. shiftActiveItemIndex(delta) {
  15096. const { length } = this.visibleItems;
  15097. const newIndex = (this.activeItemIndex + length + delta) % length;
  15098. this.updateActiveItemIndex(newIndex);
  15099. this.scrollToActiveItem();
  15100. }
  15101. updateActiveItemIndex(index) {
  15102. var _a;
  15103. this.activeItemIndex = index;
  15104. let activeDescendant = null;
  15105. this.visibleItems.forEach((el, i) => {
  15106. if (i === index) {
  15107. el.active = true;
  15108. activeDescendant = el.guid;
  15109. }
  15110. else {
  15111. el.active = false;
  15112. }
  15113. });
  15114. this.activeDescendant = activeDescendant;
  15115. if (this.activeItemIndex > -1) {
  15116. this.activeChipIndex = -1;
  15117. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  15118. }
  15119. }
  15120. isMulti() {
  15121. return this.selectionMode !== "single";
  15122. }
  15123. //--------------------------------------------------------------------------
  15124. //
  15125. // Render Methods
  15126. //
  15127. //--------------------------------------------------------------------------
  15128. renderChips() {
  15129. const { activeChipIndex, scale, selectionMode, intlRemoveTag } = this;
  15130. return this.selectedItems.map((item, i) => {
  15131. const chipClasses = {
  15132. chip: true,
  15133. "chip--active": activeChipIndex === i
  15134. };
  15135. const ancestors = [...getItemAncestors(item)].reverse();
  15136. const pathLabel = [...ancestors, item].map((el) => el.textLabel);
  15137. const label = selectionMode !== "ancestors" ? item.textLabel : pathLabel.join(" / ");
  15138. return (hAsync("calcite-chip", { class: chipClasses, dismissLabel: intlRemoveTag, dismissible: true, icon: item.icon, id: item.guid ? `${chipUidPrefix}${item.guid}` : null, key: item.textLabel, onCalciteChipDismiss: (event) => this.calciteChipDismissHandler(event, item), scale: scale, title: label, value: item.value }, label));
  15139. });
  15140. }
  15141. renderInput() {
  15142. const { guid, active, disabled, placeholder, selectionMode, needsIcon, selectedItems } = this;
  15143. const single = selectionMode === "single";
  15144. const selectedItem = selectedItems[0];
  15145. const showLabel = !active && single && !!selectedItem;
  15146. return (hAsync("span", { class: {
  15147. "input-wrap": true,
  15148. "input-wrap--single": single
  15149. } }, showLabel && (hAsync("span", { class: {
  15150. label: true,
  15151. "label--spaced": needsIcon
  15152. }, key: "label" }, selectedItem.textLabel)), hAsync("input", { "aria-activedescendant": this.activeDescendant, "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-label": getLabelText(this), class: {
  15153. input: true,
  15154. "input--single": true,
  15155. "input--transparent": this.activeChipIndex > -1,
  15156. "input--hidden": showLabel,
  15157. "input--icon": single && needsIcon
  15158. }, disabled: disabled, id: `${inputUidPrefix}${guid}`, key: "input", onBlur: this.comboboxBlurHandler, onFocus: this.comboboxFocusHandler, onInput: this.inputHandler, placeholder: placeholder, ref: (el) => (this.textInput = el), type: "text" })));
  15159. }
  15160. renderListBoxOptions() {
  15161. return this.visibleItems.map((item) => (hAsync("li", { "aria-selected": toAriaBoolean(item.selected), id: item.guid ? `${itemUidPrefix}${item.guid}` : null, role: "option", tabindex: "-1" }, item.textLabel)));
  15162. }
  15163. renderPopperContainer() {
  15164. const { active, setMenuEl, setListContainerEl } = this;
  15165. const classes = {
  15166. "list-container": true,
  15167. [CSS$D.animation]: true,
  15168. [CSS$D.animationActive]: active
  15169. };
  15170. return (hAsync("div", { "aria-hidden": "true", class: { "popper-container": true, "popper-container--active": active }, ref: setMenuEl }, hAsync("div", { class: classes, onTransitionEnd: this.transitionEnd, ref: setListContainerEl }, hAsync("ul", { class: { list: true, "list--hide": !active } }, hAsync("slot", null)))));
  15171. }
  15172. renderIconStart() {
  15173. const { selectionMode, needsIcon, selectedItems } = this;
  15174. const selectedItem = selectedItems[0];
  15175. return (selectionMode === "single" &&
  15176. needsIcon && (hAsync("span", { class: "icon-start" }, (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon) && (hAsync("calcite-icon", { class: "selected-icon", icon: selectedItem.icon, scale: "s" })))));
  15177. }
  15178. renderIconEnd() {
  15179. const { active } = this;
  15180. return (hAsync("span", { class: "icon-end" }, hAsync("calcite-icon", { icon: active ? "chevron-up" : "chevron-down", scale: "s" })));
  15181. }
  15182. render() {
  15183. const { active, guid, label } = this;
  15184. const single = this.selectionMode === "single";
  15185. return (hAsync(Host, { onKeyDown: this.keydownHandler }, hAsync("div", { "aria-autocomplete": "list", "aria-expanded": toAriaBoolean(active), "aria-haspopup": "listbox", "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-owns": `${listboxUidPrefix}${guid}`, class: {
  15186. wrapper: true,
  15187. "wrapper--single": single || !this.selectedItems.length,
  15188. "wrapper--active": active
  15189. }, onClick: this.clickHandler, ref: this.setReferenceEl, role: "combobox" }, hAsync("div", { class: "grid-input" }, this.renderIconStart(), !single && this.renderChips(), hAsync("label", { class: "screen-readers-only", htmlFor: `${inputUidPrefix}${guid}`, id: `${labelUidPrefix}${guid}` }, label), this.renderInput()), this.renderIconEnd()), hAsync("ul", { "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-multiselectable": "true", class: "screen-readers-only", id: `${listboxUidPrefix}${guid}`, role: "listbox", tabIndex: -1 }, this.renderListBoxOptions()), this.renderPopperContainer(), hAsync(HiddenFormInputSlot, { component: this })));
  15190. }
  15191. get el() { return getElement(this); }
  15192. static get watchers() { return {
  15193. "active": ["activeHandler"],
  15194. "disabled": ["handleDisabledChange"],
  15195. "maxItems": ["maxItemsHandler"],
  15196. "value": ["valueHandler"],
  15197. "flipPlacements": ["flipPlacementsHandler"],
  15198. "selectedItems": ["selectedItemsHandler"],
  15199. "text": ["textHandler"]
  15200. }; }
  15201. static get style() { return comboboxCss; }
  15202. static get cmpMeta() { return {
  15203. "$flags$": 9,
  15204. "$tagName$": "calcite-combobox",
  15205. "$members$": {
  15206. "active": [1540],
  15207. "disabled": [516],
  15208. "label": [1],
  15209. "placeholder": [1],
  15210. "maxItems": [2, "max-items"],
  15211. "name": [513],
  15212. "allowCustomValues": [4, "allow-custom-values"],
  15213. "overlayPositioning": [1, "overlay-positioning"],
  15214. "required": [4],
  15215. "selectionMode": [513, "selection-mode"],
  15216. "scale": [513],
  15217. "value": [1025],
  15218. "intlRemoveTag": [1, "intl-remove-tag"],
  15219. "flipPlacements": [16],
  15220. "items": [32],
  15221. "groupItems": [32],
  15222. "selectedItems": [32],
  15223. "visibleItems": [32],
  15224. "needsIcon": [32],
  15225. "activeItemIndex": [32],
  15226. "activeChipIndex": [32],
  15227. "activeDescendant": [32],
  15228. "text": [32],
  15229. "reposition": [64],
  15230. "setFocus": [64]
  15231. },
  15232. "$listeners$": [[4, "click", "documentClickHandler"], [0, "calciteComboboxItemChange", "calciteComboboxItemChangeHandler"]],
  15233. "$lazyBundleId$": "-",
  15234. "$attrsToReflect$": [["active", "active"], ["disabled", "disabled"], ["name", "name"], ["selectionMode", "selection-mode"], ["scale", "scale"]]
  15235. }; }
  15236. }
  15237. const CSS$C = {
  15238. icon: "icon",
  15239. iconActive: "icon--active",
  15240. custom: "icon--custom",
  15241. dot: "icon--dot",
  15242. single: "label--single",
  15243. label: "label",
  15244. active: "label--active",
  15245. selected: "label--selected",
  15246. title: "title",
  15247. textContainer: "text-container"
  15248. };
  15249. const comboboxItemCss = "@charset \"UTF-8\";@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-combobox-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-combobox-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-combobox-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-combobox-item-h{display:none}/*!@.scale--s*/.scale--s.sc-calcite-combobox-item{font-size:var(--calcite-font-size--2);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-item-spacing-indent:0.5rem}/*!@.scale--m*/.scale--m.sc-calcite-combobox-item{font-size:var(--calcite-font-size--1);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-item-spacing-indent:0.75rem}/*!@.scale--l*/.scale--l.sc-calcite-combobox-item{font-size:var(--calcite-font-size-0);line-height:1.25rem;--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-item-spacing-indent:1rem}/*!@.container*/.container.sc-calcite-combobox-item{--calcite-combobox-item-indent-value:calc(\n var(--calcite-combobox-item-spacing-indent) * var(--calcite-combobox-item-spacing-indent-multiplier)\n )}/*!@:host(:focus)*/.sc-calcite-combobox-item-h:focus{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([disabled])*/[disabled].sc-calcite-combobox-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-combobox-item-h[disabled] .sc-calcite-combobox-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-combobox-item-h [calcite-hydrated][disabled].sc-calcite-combobox-item{opacity:1}/*!@:host, ul*/.sc-calcite-combobox-item-h,ul.sc-calcite-combobox-item{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:0px;outline:2px solid transparent;outline-offset:2px}/*!@.label*/.label.sc-calcite-combobox-item{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;width:100%;min-width:100%;cursor:pointer;-ms-flex-align:center;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;padding:var(--calcite-combobox-item-spacing-unit-s) var(--calcite-combobox-item-spacing-unit-l)}/*!@:host([disabled]) .label*/[disabled].sc-calcite-combobox-item-h .label.sc-calcite-combobox-item{cursor:default}/*!@.label--selected*/.label--selected.sc-calcite-combobox-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@.label--active*/.label--active.sc-calcite-combobox-item{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.label:hover, .label:active*/.label.sc-calcite-combobox-item:hover,.label.sc-calcite-combobox-item:active{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@.title*/.title.sc-calcite-combobox-item{padding:0 var(--calcite-combobox-item-spacing-unit-l)}/*!@.icon*/.icon.sc-calcite-combobox-item{display:-ms-inline-flexbox;display:inline-flex;opacity:0;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);color:var(--calcite-ui-border-1)}/*!@.icon--indent*/.icon--indent.sc-calcite-combobox-item{-webkit-padding-start:var(--calcite-combobox-item-indent-value);padding-inline-start:var(--calcite-combobox-item-indent-value)}/*!@.icon--custom*/.icon--custom.sc-calcite-combobox-item{margin-top:-1px;color:var(--calcite-ui-text-3)}/*!@.icon--active*/.icon--active.sc-calcite-combobox-item{color:var(--calcite-ui-text-1)}/*!@.icon--dot*/.icon--dot.sc-calcite-combobox-item{display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:flex-end;min-width:var(--calcite-combobox-item-spacing-unit-l)}/*!@.icon--dot:before*/.icon--dot.sc-calcite-combobox-item:before{text-align:start;content:\"•\"}/*!@.label--active .icon*/.label--active.sc-calcite-combobox-item .icon.sc-calcite-combobox-item{opacity:1}/*!@.label--selected .icon*/.label--selected.sc-calcite-combobox-item .icon.sc-calcite-combobox-item{opacity:1;color:var(--calcite-ui-brand)}/*!@:host(:hover[disabled]) .icon*/.sc-calcite-combobox-item-h:hover[disabled] .icon.sc-calcite-combobox-item{opacity:1}";
  15250. /**
  15251. * @slot - A slot for adding nested `calcite-combobox-item`s.
  15252. */
  15253. class ComboboxItem {
  15254. constructor(hostRef) {
  15255. registerInstance(this, hostRef);
  15256. this.calciteComboboxItemChange = createEvent(this, "calciteComboboxItemChange", 7);
  15257. // --------------------------------------------------------------------------
  15258. //
  15259. // Properties
  15260. //
  15261. // --------------------------------------------------------------------------
  15262. /** When true, the item cannot be clicked and is visually muted. */
  15263. this.disabled = false;
  15264. /** Set this to true to pre-select an item. Toggles when an item is checked/unchecked. */
  15265. this.selected = false;
  15266. /** True when item is highlighted either from keyboard or mouse hover */
  15267. this.active = false;
  15268. /** Unique identifier, used for accessibility */
  15269. this.guid = guid();
  15270. this.scale = "m";
  15271. // --------------------------------------------------------------------------
  15272. //
  15273. // Private Methods
  15274. //
  15275. // --------------------------------------------------------------------------
  15276. this.itemClickHandler = (event) => {
  15277. event.preventDefault();
  15278. if (this.disabled) {
  15279. return;
  15280. }
  15281. this.selected = !this.selected;
  15282. };
  15283. }
  15284. selectedWatchHandler() {
  15285. this.calciteComboboxItemChange.emit(this.el);
  15286. }
  15287. // --------------------------------------------------------------------------
  15288. //
  15289. // Lifecycle
  15290. //
  15291. // --------------------------------------------------------------------------
  15292. connectedCallback() {
  15293. this.ancestors = getAncestors(this.el);
  15294. this.scale = getElementProp(this.el, "scale", this.scale);
  15295. connectConditionalSlotComponent(this);
  15296. }
  15297. disconnectedCallback() {
  15298. disconnectConditionalSlotComponent(this);
  15299. }
  15300. componentDidRender() {
  15301. updateHostInteraction(this);
  15302. }
  15303. // --------------------------------------------------------------------------
  15304. //
  15305. // Public Methods
  15306. //
  15307. // --------------------------------------------------------------------------
  15308. /**
  15309. * Used to toggle the selection state. By default this won't trigger an event.
  15310. * The first argument allows the value to be coerced, rather than swapping values.
  15311. */
  15312. async toggleSelected(coerce) {
  15313. if (this.disabled) {
  15314. return;
  15315. }
  15316. this.selected = typeof coerce === "boolean" ? coerce : !this.selected;
  15317. }
  15318. // --------------------------------------------------------------------------
  15319. //
  15320. // Render Methods
  15321. //
  15322. // --------------------------------------------------------------------------
  15323. renderIcon(isSingle) {
  15324. const { icon, disabled, selected } = this;
  15325. const level = `${CSS$C.icon}--indent`;
  15326. const defaultIcon = isSingle ? "dot" : "check";
  15327. const iconPath = disabled ? "circle-disallowed" : defaultIcon;
  15328. const showDot = isSingle && !icon && !disabled;
  15329. return showDot ? (hAsync("span", { class: {
  15330. [CSS$C.icon]: true,
  15331. [CSS$C.dot]: true,
  15332. [level]: true
  15333. } })) : (hAsync("calcite-icon", { class: {
  15334. [CSS$C.icon]: !icon,
  15335. [CSS$C.custom]: !!icon,
  15336. [CSS$C.iconActive]: icon && selected,
  15337. [level]: true
  15338. }, icon: icon || iconPath, scale: "s" }));
  15339. }
  15340. renderChildren() {
  15341. if (getSlotted(this.el)) {
  15342. return (hAsync("ul", { key: "default-slot-container" }, hAsync("slot", null)));
  15343. }
  15344. return null;
  15345. }
  15346. render() {
  15347. const isSingleSelect = getElementProp(this.el, "selection-mode", "multi") === "single";
  15348. const classes = {
  15349. [CSS$C.label]: true,
  15350. [CSS$C.selected]: this.selected,
  15351. [CSS$C.active]: this.active,
  15352. [CSS$C.single]: isSingleSelect
  15353. };
  15354. const depth = getDepth();
  15355. return (hAsync(Host, { "aria-hidden": "true" }, hAsync("div", { class: `container scale--${this.scale}`, style: { "--calcite-combobox-item-spacing-indent-multiplier": `${depth}` } }, hAsync("li", { class: classes, id: this.guid, onClick: this.itemClickHandler }, this.renderIcon(isSingleSelect), hAsync("span", { class: CSS$C.title }, this.textLabel)), this.renderChildren())));
  15356. }
  15357. get el() { return getElement(this); }
  15358. static get watchers() { return {
  15359. "selected": ["selectedWatchHandler"]
  15360. }; }
  15361. static get style() { return comboboxItemCss; }
  15362. static get cmpMeta() { return {
  15363. "$flags$": 9,
  15364. "$tagName$": "calcite-combobox-item",
  15365. "$members$": {
  15366. "disabled": [516],
  15367. "selected": [1540],
  15368. "active": [4],
  15369. "ancestors": [1040],
  15370. "guid": [1],
  15371. "icon": [1],
  15372. "textLabel": [513, "text-label"],
  15373. "value": [8],
  15374. "constant": [516],
  15375. "toggleSelected": [64]
  15376. },
  15377. "$listeners$": undefined,
  15378. "$lazyBundleId$": "-",
  15379. "$attrsToReflect$": [["disabled", "disabled"], ["selected", "selected"], ["textLabel", "text-label"], ["constant", "constant"]]
  15380. }; }
  15381. }
  15382. const CSS$B = {
  15383. list: "list",
  15384. label: "label",
  15385. title: "title"
  15386. };
  15387. const comboboxItemGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-combobox-item-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-combobox-item-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox-item-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox-item-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox-item-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox-item-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-combobox-item-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-combobox-item-group-h{display:none}/*!@.scale--s*/.scale--s.sc-calcite-combobox-item-group{font-size:var(--calcite-font-size--2);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-item-spacing-indent-1:0.5rem;--calcite-combobox-item-spacing-indent-2:1rem}/*!@.scale--m*/.scale--m.sc-calcite-combobox-item-group{font-size:var(--calcite-font-size--1);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-item-spacing-indent-1:0.75rem;--calcite-combobox-item-spacing-indent-2:1.5rem}/*!@.scale--l*/.scale--l.sc-calcite-combobox-item-group{font-size:var(--calcite-font-size-0);line-height:1.25rem;--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-item-spacing-indent-1:1rem;--calcite-combobox-item-spacing-indent-2:2rem}/*!@:host, .list*/.sc-calcite-combobox-item-group-h,.list.sc-calcite-combobox-item-group{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:0px;outline:2px solid transparent;outline-offset:2px}/*!@.label*/.label.sc-calcite-combobox-item-group{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;width:100%;min-width:0px;max-width:100%;color:var(--calcite-ui-text-3)}/*!@.label--indent-1*/.label--indent-1.sc-calcite-combobox-item-group{-webkit-padding-start:var(--calcite-combobox-item-spacing-indent-1);padding-inline-start:var(--calcite-combobox-item-spacing-indent-1)}/*!@.label--indent-2*/.label--indent-2.sc-calcite-combobox-item-group{-webkit-padding-start:var(--calcite-combobox-item-spacing-indent-2);padding-inline-start:var(--calcite-combobox-item-spacing-indent-2)}/*!@.title*/.title.sc-calcite-combobox-item-group{border:0 solid;display:block;-ms-flex:1 1 0%;flex:1 1 0%;border-bottom-width:1px;font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-2);word-wrap:break-word;word-break:break-word;border-bottom-color:var(--calcite-ui-border-3);padding:var(--calcite-combobox-item-spacing-unit-l) 0;margin-left:var(--calcite-combobox-item-spacing-unit-s);margin-right:var(--calcite-combobox-item-spacing-unit-s)}";
  15388. /**
  15389. * @slot - A slot for adding `calcite-combobox-item`s.
  15390. */
  15391. class ComboboxItemGroup {
  15392. constructor(hostRef) {
  15393. registerInstance(this, hostRef);
  15394. this.guid = guid();
  15395. this.scale = "m";
  15396. }
  15397. // --------------------------------------------------------------------------
  15398. //
  15399. // Lifecycle
  15400. //
  15401. // --------------------------------------------------------------------------
  15402. connectedCallback() {
  15403. this.ancestors = getAncestors(this.el);
  15404. this.scale = getElementProp(this.el, "scale", this.scale);
  15405. }
  15406. // --------------------------------------------------------------------------
  15407. //
  15408. // Render Methods
  15409. //
  15410. // --------------------------------------------------------------------------
  15411. render() {
  15412. const { el, scale } = this;
  15413. const indent = `${CSS$B.label}--indent-${getDepth()}`;
  15414. return (hAsync("ul", { "aria-labelledby": this.guid, class: { [CSS$B.list]: true, [`scale--${scale}`]: true }, role: "group" }, hAsync("li", { class: { [CSS$B.label]: true, [indent]: true }, id: this.guid, role: "presentation" }, hAsync("span", { class: CSS$B.title }, this.label)), hAsync("slot", null)));
  15415. }
  15416. get el() { return getElement(this); }
  15417. static get style() { return comboboxItemGroupCss; }
  15418. static get cmpMeta() { return {
  15419. "$flags$": 9,
  15420. "$tagName$": "calcite-combobox-item-group",
  15421. "$members$": {
  15422. "ancestors": [1040],
  15423. "label": [1]
  15424. },
  15425. "$listeners$": undefined,
  15426. "$lazyBundleId$": "-",
  15427. "$attrsToReflect$": []
  15428. }; }
  15429. }
  15430. function isActivationKey(key) {
  15431. return key === "Enter" || key === " ";
  15432. }
  15433. const numberKeys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
  15434. function isValidNumber(numberString) {
  15435. return !(!numberString || isNaN(Number(numberString)));
  15436. }
  15437. function parseNumberString(numberString) {
  15438. if (!numberString || !stringContainsNumbers(numberString)) {
  15439. return "";
  15440. }
  15441. return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
  15442. let containsDecimal = false;
  15443. const result = nonExpoNumString
  15444. .split("")
  15445. .filter((value, i) => {
  15446. if (value.match(/\./g) && !containsDecimal) {
  15447. containsDecimal = true;
  15448. return true;
  15449. }
  15450. if (value.match(/\-/g) && i === 0) {
  15451. return true;
  15452. }
  15453. return numberKeys.includes(value);
  15454. })
  15455. .reduce((string, part) => string + part);
  15456. return isValidNumber(result) ? Number(result).toString() : "";
  15457. });
  15458. }
  15459. function sanitizeDecimalString(decimalString) {
  15460. const decimalAtEndOfStringButNotStart = /(?!^\.)\.$/;
  15461. return decimalString.replace(decimalAtEndOfStringButNotStart, "");
  15462. }
  15463. function sanitizeNegativeString(negativeString) {
  15464. const allHyphensExceptTheStart = /(?!^-)-/g;
  15465. return negativeString.replace(allHyphensExceptTheStart, "");
  15466. }
  15467. function sanitizeLeadingZeroString(zeroString) {
  15468. const allLeadingZerosOptionallyNegative = /^([-0])0+(?=\d)/;
  15469. return zeroString.replace(allLeadingZerosOptionallyNegative, "$1");
  15470. }
  15471. function sanitizeNumberString(numberString) {
  15472. return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
  15473. const sanitizedValue = sanitizeNegativeString(sanitizeDecimalString(sanitizeLeadingZeroString(nonExpoNumString)));
  15474. const isNegativeDecimalOnlyZeros = /^-\b0\b\.?0*$/;
  15475. return isValidNumber(sanitizedValue)
  15476. ? isNegativeDecimalOnlyZeros.test(sanitizedValue)
  15477. ? sanitizedValue
  15478. : Number(sanitizedValue).toString()
  15479. : nonExpoNumString;
  15480. });
  15481. }
  15482. function sanitizeExponentialNumberString(numberString, func) {
  15483. if (!numberString) {
  15484. return numberString;
  15485. }
  15486. const firstE = numberString.toLowerCase().indexOf("e") + 1;
  15487. return numberString
  15488. .replace(/[eE]*$/g, "")
  15489. .substring(0, firstE)
  15490. .concat(numberString.slice(firstE).replace(/[eE]/g, ""))
  15491. .split(/[eE]/)
  15492. .map((section, i) => (i === 1 ? func(section.replace(/\./g, "")) : func(section)))
  15493. .join("e")
  15494. .replace(/^e/, "1e");
  15495. }
  15496. function stringContainsNumbers(string) {
  15497. return numberKeys.some((number) => string.includes(number));
  15498. }
  15499. const allDecimalsExceptLast = new RegExp(`[.](?=.*[.])`, "g");
  15500. const everythingExceptNumbersDecimalsAndMinusSigns = new RegExp("[^0-9-.]", "g");
  15501. const defaultGroupSeparator = new RegExp(",", "g");
  15502. function createLocaleNumberFormatter(locale) {
  15503. return new Intl.NumberFormat(locale, {
  15504. minimumFractionDigits: 0,
  15505. maximumFractionDigits: 20
  15506. });
  15507. }
  15508. function delocalizeNumberString(numberString, locale) {
  15509. return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
  15510. const delocalizedNumberString = nonExpoNumString
  15511. .replace(getMinusSign(locale), "-")
  15512. .replace(getGroupSeparator(locale), "")
  15513. .replace(getDecimalSeparator(locale), ".")
  15514. .replace(allDecimalsExceptLast, "")
  15515. .replace(everythingExceptNumbersDecimalsAndMinusSigns, "");
  15516. return isValidNumber(delocalizedNumberString) ? delocalizedNumberString : nonExpoNumString;
  15517. });
  15518. }
  15519. function getGroupSeparator(locale) {
  15520. const formatter = createLocaleNumberFormatter(locale);
  15521. const parts = formatter.formatToParts(1234567);
  15522. const value = parts.find((part) => part.type === "group").value;
  15523. // change whitespace group characters that don't render correctly
  15524. return value.trim().length === 0 ? " " : value;
  15525. }
  15526. function getDecimalSeparator(locale) {
  15527. const formatter = createLocaleNumberFormatter(locale);
  15528. const parts = formatter.formatToParts(1.1);
  15529. return parts.find((part) => part.type === "decimal").value;
  15530. }
  15531. function getMinusSign(locale) {
  15532. const formatter = createLocaleNumberFormatter(locale);
  15533. const parts = formatter.formatToParts(-9);
  15534. return parts.find((part) => part.type === "minusSign").value;
  15535. }
  15536. function localizeNumberString(numberString, locale, displayGroupSeparator = false) {
  15537. return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
  15538. if (nonExpoNumString) {
  15539. const number = Number(sanitizeDecimalString(nonExpoNumString.replace(defaultGroupSeparator, "")));
  15540. if (!isNaN(number)) {
  15541. const formatter = createLocaleNumberFormatter(locale);
  15542. const parts = formatter.formatToParts(number);
  15543. const localizedNumberString = parts
  15544. .map(({ type, value }) => {
  15545. switch (type) {
  15546. case "group":
  15547. return displayGroupSeparator ? getGroupSeparator(locale) : "";
  15548. case "decimal":
  15549. return getDecimalSeparator(locale);
  15550. case "minusSign":
  15551. return getMinusSign(locale);
  15552. default:
  15553. return value;
  15554. }
  15555. })
  15556. .reduce((string, part) => string + part);
  15557. return localizedNumberString;
  15558. }
  15559. }
  15560. return nonExpoNumString;
  15561. });
  15562. }
  15563. /**
  15564. * Check if date is within a min and max
  15565. */
  15566. function inRange(date, min, max) {
  15567. const time = date.getTime();
  15568. const afterMin = !(min instanceof Date) || time >= min.getTime();
  15569. const beforeMax = !(max instanceof Date) || time <= max.getTime();
  15570. return afterMin && beforeMax;
  15571. }
  15572. /**
  15573. * Ensures date is within range,
  15574. * returns min or max if out of bounds
  15575. */
  15576. function dateFromRange(date, min, max) {
  15577. if (!(date instanceof Date)) {
  15578. return null;
  15579. }
  15580. const time = date.getTime();
  15581. const beforeMin = min instanceof Date && time < min.getTime();
  15582. const afterMax = max instanceof Date && time > max.getTime();
  15583. if (beforeMin) {
  15584. return min;
  15585. }
  15586. if (afterMax) {
  15587. return max;
  15588. }
  15589. return date;
  15590. }
  15591. /**
  15592. * Parse an iso8601 string (YYYY-mm-dd) into a valid date.
  15593. * TODO: handle time when time of day UI is added
  15594. */
  15595. function dateFromISO(iso8601) {
  15596. if (iso8601 instanceof Date) {
  15597. return iso8601;
  15598. }
  15599. if (!iso8601 || typeof iso8601 !== "string") {
  15600. return null;
  15601. }
  15602. const d = iso8601.split(/[: T-]/).map(parseFloat);
  15603. const date = new Date(d[0], (d[1] || 1) - 1, d[2] || 1);
  15604. date.setFullYear(d[0]);
  15605. if (isNaN(date.getTime())) {
  15606. throw new Error(`Invalid ISO 8601 date: "${iso8601}"`);
  15607. }
  15608. return date;
  15609. }
  15610. /**
  15611. * Return first portion of ISO string (YYYY-mm-dd)
  15612. */
  15613. function dateToISO(date) {
  15614. if (typeof date === "string") {
  15615. return date;
  15616. }
  15617. if (date instanceof Date) {
  15618. return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().split("T")[0];
  15619. }
  15620. return "";
  15621. }
  15622. /**
  15623. * Check if two dates are the same day, month, year
  15624. */
  15625. function sameDate(d1, d2) {
  15626. return (d1 instanceof Date &&
  15627. d2 instanceof Date &&
  15628. d1.getDate() === d2.getDate() &&
  15629. d1.getMonth() === d2.getMonth() &&
  15630. d1.getFullYear() === d2.getFullYear());
  15631. }
  15632. /**
  15633. * Get a date one month in the past
  15634. */
  15635. function prevMonth(date) {
  15636. const month = date.getMonth();
  15637. const nextDate = new Date(date);
  15638. nextDate.setMonth(month - 1);
  15639. // date doesn't exist in new month, use last day
  15640. if (month === nextDate.getMonth()) {
  15641. return new Date(date.getFullYear(), month, 0);
  15642. }
  15643. return nextDate;
  15644. }
  15645. /**
  15646. * Get a date one month in the future
  15647. */
  15648. function nextMonth(date) {
  15649. const month = date.getMonth();
  15650. const nextDate = new Date(date);
  15651. nextDate.setMonth(month + 1);
  15652. // date doesn't exist in new month, use last day
  15653. if ((month + 2) % 7 === nextDate.getMonth() % 7) {
  15654. return new Date(date.getFullYear(), month + 2, 0);
  15655. }
  15656. return nextDate;
  15657. }
  15658. /**
  15659. * Translate a number into a given locals numeral system
  15660. */
  15661. function localizeNumber(num, localeData) {
  15662. return String(num)
  15663. .split("")
  15664. .map((i) => localeData.numerals[i])
  15665. .join("");
  15666. }
  15667. /**
  15668. * Calculate actual number from localized string
  15669. */
  15670. function parseNumber(str, localeData) {
  15671. const numerals = "0123456789";
  15672. return parseInt(str
  15673. .split("")
  15674. .map((i) => numerals[localeData.numerals.indexOf(i)])
  15675. .filter((num) => num)
  15676. .join(""));
  15677. }
  15678. /**
  15679. * Parse numeric units for day, month, and year from a localized string
  15680. * month starts at 0 (can pass to date constructor)
  15681. */
  15682. function parseDateString(str, localeData) {
  15683. const { separator, unitOrder } = localeData;
  15684. const order = getOrder(unitOrder);
  15685. const values = replaceArabicNumerals(str).split(separator);
  15686. return {
  15687. day: parseInt(values[order.indexOf("d")]),
  15688. month: parseInt(values[order.indexOf("m")]) - 1,
  15689. year: parseInt(values[order.indexOf("y")])
  15690. };
  15691. }
  15692. /**
  15693. * Convert eastern arbic numerals
  15694. */
  15695. function replaceArabicNumerals(str = "") {
  15696. return str
  15697. .replace(/[\u0660-\u0669]/g, (c) => (c.charCodeAt(0) - 0x0660))
  15698. .replace(/[\u06f0-\u06f9]/g, (c) => (c.charCodeAt(0) - 0x06f0));
  15699. }
  15700. /**
  15701. * Based on the unitOrder string, find order of month, day, and year for locale
  15702. */
  15703. function getOrder(unitOrder) {
  15704. const signifiers = ["d", "m", "y"];
  15705. const order = unitOrder.toLowerCase();
  15706. return signifiers.sort((a, b) => order.indexOf(a) - order.indexOf(b));
  15707. }
  15708. /**
  15709. * Get number of days between two dates
  15710. */
  15711. function getDaysDiff(date1, date2) {
  15712. const ts1 = date1.getTime();
  15713. const ts2 = date2.getTime();
  15714. return (ts1 - ts2) / (1000 * 3600 * 24);
  15715. }
  15716. const HEADING_LEVEL$6 = 2;
  15717. const TEXT$f = {
  15718. nextMonth: "Next month",
  15719. prevMonth: "Previous month",
  15720. year: "Year"
  15721. };
  15722. const datePickerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-date-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-date-picker{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-date-picker:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-h{display:none}/*!@:host*/.sc-calcite-date-picker-h{position:relative;display:inline-block;width:100%;overflow:visible;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-1);vertical-align:top}/*!@:host([scale=s])*/[scale=s].sc-calcite-date-picker-h{max-width:216px}/*!@:host([scale=m])*/[scale=m].sc-calcite-date-picker-h{max-width:286px}/*!@:host([scale=l])*/[scale=l].sc-calcite-date-picker-h{max-width:398px}";
  15723. class DatePicker {
  15724. constructor(hostRef) {
  15725. registerInstance(this, hostRef);
  15726. this.calciteDatePickerChange = createEvent(this, "calciteDatePickerChange", 7);
  15727. this.calciteDatePickerRangeChange = createEvent(this, "calciteDatePickerRangeChange", 7);
  15728. /** Localized string for "previous month" (used for aria label)
  15729. * @default "Previous month"
  15730. */
  15731. this.intlPrevMonth = TEXT$f.prevMonth;
  15732. /** Localized string for "next month" (used for aria label)
  15733. * @default "Next month"
  15734. */
  15735. this.intlNextMonth = TEXT$f.nextMonth;
  15736. /** Localized string for "year" (used for aria label)
  15737. * @default "Year"
  15738. */
  15739. this.intlYear = TEXT$f.year;
  15740. /** BCP 47 language tag for desired language and country format */
  15741. this.locale = document.documentElement.lang || "en";
  15742. /** specify the scale of the date picker */
  15743. this.scale = "m";
  15744. /** Range mode activation */
  15745. this.range = false;
  15746. /** Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range. */
  15747. this.proximitySelectionDisabled = false;
  15748. //--------------------------------------------------------------------------
  15749. //
  15750. // Private Methods
  15751. //
  15752. //--------------------------------------------------------------------------
  15753. this.keyUpHandler = (e) => {
  15754. if (e.key === "Escape") {
  15755. this.reset();
  15756. }
  15757. };
  15758. this.monthHeaderSelectChange = (e) => {
  15759. const date = new Date(e.detail);
  15760. if (!this.range) {
  15761. this.activeDate = date;
  15762. }
  15763. else {
  15764. if (this.activeRange === "end") {
  15765. this.activeEndDate = date;
  15766. }
  15767. else {
  15768. this.activeStartDate = date;
  15769. }
  15770. this.mostRecentRangeValue = date;
  15771. }
  15772. };
  15773. this.monthActiveDateChange = (e) => {
  15774. const date = new Date(e.detail);
  15775. if (!this.range) {
  15776. this.activeDate = date;
  15777. }
  15778. else {
  15779. if (this.activeRange === "end") {
  15780. this.activeEndDate = date;
  15781. }
  15782. else {
  15783. this.activeStartDate = date;
  15784. }
  15785. this.mostRecentRangeValue = date;
  15786. }
  15787. };
  15788. this.monthHoverChange = (e) => {
  15789. if (!this.startAsDate) {
  15790. this.hoverRange = undefined;
  15791. return;
  15792. }
  15793. const date = new Date(e.detail);
  15794. this.hoverRange = {
  15795. focused: this.activeRange || "start",
  15796. start: this.startAsDate,
  15797. end: this.endAsDate
  15798. };
  15799. if (!this.proximitySelectionDisabled) {
  15800. if (this.endAsDate) {
  15801. const startDiff = getDaysDiff(date, this.startAsDate);
  15802. const endDiff = getDaysDiff(date, this.endAsDate);
  15803. if (endDiff > 0) {
  15804. this.hoverRange.end = date;
  15805. this.hoverRange.focused = "end";
  15806. }
  15807. else if (startDiff < 0) {
  15808. this.hoverRange.start = date;
  15809. this.hoverRange.focused = "start";
  15810. }
  15811. else if (startDiff > endDiff) {
  15812. this.hoverRange.start = date;
  15813. this.hoverRange.focused = "start";
  15814. }
  15815. else {
  15816. this.hoverRange.end = date;
  15817. this.hoverRange.focused = "end";
  15818. }
  15819. }
  15820. else {
  15821. if (date < this.startAsDate) {
  15822. this.hoverRange = {
  15823. focused: "start",
  15824. start: date,
  15825. end: this.startAsDate
  15826. };
  15827. }
  15828. else {
  15829. this.hoverRange.end = date;
  15830. this.hoverRange.focused = "end";
  15831. }
  15832. }
  15833. }
  15834. else {
  15835. if (!this.endAsDate) {
  15836. if (date < this.startAsDate) {
  15837. this.hoverRange = {
  15838. focused: "start",
  15839. start: date,
  15840. end: this.startAsDate
  15841. };
  15842. }
  15843. else {
  15844. this.hoverRange.end = date;
  15845. this.hoverRange.focused = "end";
  15846. }
  15847. }
  15848. else {
  15849. this.hoverRange = undefined;
  15850. }
  15851. }
  15852. };
  15853. this.monthMouseOutChange = () => {
  15854. if (this.hoverRange) {
  15855. this.hoverRange = undefined;
  15856. }
  15857. };
  15858. /**
  15859. * Reset active date and close
  15860. */
  15861. this.reset = () => {
  15862. var _a, _b, _c, _d, _e, _f;
  15863. if (!Array.isArray(this.valueAsDate) &&
  15864. this.valueAsDate &&
  15865. ((_a = this.valueAsDate) === null || _a === void 0 ? void 0 : _a.getTime()) !== ((_b = this.activeDate) === null || _b === void 0 ? void 0 : _b.getTime())) {
  15866. this.activeDate = new Date(this.valueAsDate);
  15867. }
  15868. if (this.startAsDate && ((_c = this.startAsDate) === null || _c === void 0 ? void 0 : _c.getTime()) !== ((_d = this.activeStartDate) === null || _d === void 0 ? void 0 : _d.getTime())) {
  15869. this.activeStartDate = new Date(this.startAsDate);
  15870. }
  15871. if (this.endAsDate && ((_e = this.endAsDate) === null || _e === void 0 ? void 0 : _e.getTime()) !== ((_f = this.activeEndDate) === null || _f === void 0 ? void 0 : _f.getTime())) {
  15872. this.activeEndDate = new Date(this.endAsDate);
  15873. }
  15874. };
  15875. /**
  15876. * Event handler for when the selected date changes
  15877. */
  15878. this.monthDateChange = (e) => {
  15879. const date = new Date(e.detail);
  15880. if (!this.range) {
  15881. this.value = date ? dateToISO(date) : "";
  15882. this.valueAsDate = date || null;
  15883. this.activeDate = date || null;
  15884. this.calciteDatePickerChange.emit(date);
  15885. return;
  15886. }
  15887. if (!this.startAsDate || (!this.endAsDate && date < this.startAsDate)) {
  15888. if (this.startAsDate) {
  15889. this.setEndDate(new Date(this.startAsDate));
  15890. }
  15891. if (this.activeRange == "end") {
  15892. this.setEndDate(date);
  15893. }
  15894. else {
  15895. this.setStartDate(date);
  15896. }
  15897. }
  15898. else if (!this.endAsDate) {
  15899. this.setEndDate(date);
  15900. }
  15901. else {
  15902. if (!this.proximitySelectionDisabled) {
  15903. if (this.activeRange) {
  15904. if (this.activeRange == "end") {
  15905. this.setEndDate(date);
  15906. }
  15907. else {
  15908. this.setStartDate(date);
  15909. }
  15910. }
  15911. else {
  15912. const startDiff = getDaysDiff(date, this.startAsDate);
  15913. const endDiff = getDaysDiff(date, this.endAsDate);
  15914. if (endDiff === 0 || startDiff < 0) {
  15915. this.setStartDate(date);
  15916. }
  15917. else if (startDiff === 0 || endDiff < 0) {
  15918. this.setEndDate(date);
  15919. }
  15920. else if (startDiff < endDiff) {
  15921. this.setStartDate(date);
  15922. }
  15923. else {
  15924. this.setEndDate(date);
  15925. }
  15926. }
  15927. }
  15928. else {
  15929. this.setStartDate(date);
  15930. this.endAsDate = this.activeEndDate = this.end = undefined;
  15931. }
  15932. }
  15933. this.calciteDatePickerChange.emit(date);
  15934. };
  15935. }
  15936. handleValueAsDate(date) {
  15937. if (!Array.isArray(date) && date && date !== this.activeDate) {
  15938. this.activeDate = date;
  15939. }
  15940. }
  15941. handleRangeChange() {
  15942. const { startAsDate: startDate, endAsDate: endDate } = this;
  15943. this.activeEndDate = endDate;
  15944. this.activeStartDate = startDate;
  15945. }
  15946. onMinChanged(min) {
  15947. if (min) {
  15948. this.minAsDate = dateFromISO(min);
  15949. }
  15950. }
  15951. onMaxChanged(max) {
  15952. if (max) {
  15953. this.maxAsDate = dateFromISO(max);
  15954. }
  15955. }
  15956. // --------------------------------------------------------------------------
  15957. //
  15958. // Lifecycle
  15959. //
  15960. // --------------------------------------------------------------------------
  15961. connectedCallback() {
  15962. if (Array.isArray(this.value)) {
  15963. this.valueAsDate = this.value.map((v) => dateFromISO(v));
  15964. this.start = this.value[0];
  15965. this.end = this.value[1];
  15966. }
  15967. else if (this.value) {
  15968. this.valueAsDate = dateFromISO(this.value);
  15969. }
  15970. if (this.start) {
  15971. this.setStartAsDate(dateFromISO(this.start));
  15972. }
  15973. if (this.end) {
  15974. this.setEndAsDate(dateFromISO(this.end));
  15975. }
  15976. if (this.min) {
  15977. this.minAsDate = dateFromISO(this.min);
  15978. }
  15979. if (this.max) {
  15980. this.maxAsDate = dateFromISO(this.max);
  15981. }
  15982. }
  15983. async componentWillLoad() {
  15984. await this.loadLocaleData();
  15985. this.onMinChanged(this.min);
  15986. this.onMaxChanged(this.max);
  15987. }
  15988. render() {
  15989. var _a;
  15990. const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
  15991. const activeStartDate = this.range
  15992. ? this.getActiveStartDate(date, this.minAsDate, this.maxAsDate)
  15993. : this.getActiveDate(date, this.minAsDate, this.maxAsDate);
  15994. let activeDate = activeStartDate;
  15995. const endDate = this.range
  15996. ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
  15997. : null;
  15998. const activeEndDate = this.getActiveEndDate(endDate, this.minAsDate, this.maxAsDate);
  15999. if ((this.activeRange === "end" ||
  16000. (((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "end" && (!this.proximitySelectionDisabled || endDate))) &&
  16001. activeEndDate) {
  16002. activeDate = activeEndDate;
  16003. }
  16004. if (this.range && this.mostRecentRangeValue) {
  16005. activeDate = this.mostRecentRangeValue;
  16006. }
  16007. const minDate = this.range && this.activeRange
  16008. ? this.activeRange === "start"
  16009. ? this.minAsDate
  16010. : date || this.minAsDate
  16011. : this.minAsDate;
  16012. const maxDate = this.range && this.activeRange
  16013. ? this.activeRange === "start"
  16014. ? endDate || this.maxAsDate
  16015. : this.maxAsDate
  16016. : this.maxAsDate;
  16017. return (hAsync(Host, { onBlur: this.reset, onKeyUp: this.keyUpHandler, role: "application" }, this.renderCalendar(activeDate, maxDate, minDate, date, endDate)));
  16018. }
  16019. valueHandler(value) {
  16020. if (Array.isArray(value)) {
  16021. this.valueAsDate = value.map((v) => dateFromISO(v));
  16022. this.start = value[0];
  16023. this.end = value[1];
  16024. }
  16025. else if (value) {
  16026. this.valueAsDate = dateFromISO(value);
  16027. this.start = "";
  16028. this.end = "";
  16029. }
  16030. }
  16031. startWatcher(start) {
  16032. this.setStartAsDate(dateFromISO(start));
  16033. }
  16034. endWatcher(end) {
  16035. this.setEndAsDate(dateFromISO(end));
  16036. }
  16037. async loadLocaleData() {
  16038. {
  16039. return;
  16040. }
  16041. }
  16042. /**
  16043. * Render calcite-date-picker-month-header and calcite-date-picker-month
  16044. */
  16045. renderCalendar(activeDate, maxDate, minDate, date, endDate) {
  16046. return (this.localeData && [
  16047. hAsync("calcite-date-picker-month-header", { activeDate: activeDate, headingLevel: this.headingLevel || HEADING_LEVEL$6, intlNextMonth: this.intlNextMonth, intlPrevMonth: this.intlPrevMonth, intlYear: this.intlYear, localeData: this.localeData, max: maxDate, min: minDate, onCalciteDatePickerSelect: this.monthHeaderSelectChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date || new Date() }),
  16048. hAsync("calcite-date-picker-month", { activeDate: activeDate, endDate: this.range ? endDate : undefined, hoverRange: this.hoverRange, localeData: this.localeData, max: maxDate, min: minDate, onCalciteDatePickerActiveDateChange: this.monthActiveDateChange, onCalciteDatePickerHover: this.monthHoverChange, onCalciteDatePickerMouseOut: this.monthMouseOutChange, onCalciteDatePickerSelect: this.monthDateChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date, startDate: this.range ? date : undefined })
  16049. ]);
  16050. }
  16051. /**
  16052. * Update date instance of start if valid
  16053. */
  16054. setStartAsDate(startDate, emit) {
  16055. this.startAsDate = startDate;
  16056. this.mostRecentRangeValue = this.startAsDate;
  16057. if (emit) {
  16058. this.calciteDatePickerRangeChange.emit({
  16059. startDate,
  16060. endDate: this.endAsDate
  16061. });
  16062. }
  16063. }
  16064. /**
  16065. * Update date instance of end if valid
  16066. */
  16067. setEndAsDate(endDate, emit) {
  16068. this.endAsDate = endDate;
  16069. this.mostRecentRangeValue = this.endAsDate;
  16070. if (emit) {
  16071. this.calciteDatePickerRangeChange.emit({
  16072. startDate: this.startAsDate,
  16073. endDate
  16074. });
  16075. }
  16076. }
  16077. setEndDate(date) {
  16078. this.end = date ? dateToISO(date) : "";
  16079. this.setEndAsDate(date, true);
  16080. this.activeEndDate = date || null;
  16081. }
  16082. setStartDate(date) {
  16083. this.start = date ? dateToISO(date) : "";
  16084. this.setStartAsDate(date, true);
  16085. this.activeStartDate = date || null;
  16086. }
  16087. /**
  16088. * Get an active date using the value, or current date as default
  16089. */
  16090. getActiveDate(value, min, max) {
  16091. return dateFromRange(this.activeDate, min, max) || value || dateFromRange(new Date(), min, max);
  16092. }
  16093. getActiveStartDate(value, min, max) {
  16094. return (dateFromRange(this.activeStartDate, min, max) || value || dateFromRange(new Date(), min, max));
  16095. }
  16096. getActiveEndDate(value, min, max) {
  16097. return (dateFromRange(this.activeEndDate, min, max) || value || dateFromRange(new Date(), min, max));
  16098. }
  16099. static get assetsDirs() { return ["assets"]; }
  16100. get el() { return getElement(this); }
  16101. static get watchers() { return {
  16102. "valueAsDate": ["handleValueAsDate"],
  16103. "startAsDate": ["handleRangeChange"],
  16104. "endAsDate": ["handleRangeChange"],
  16105. "min": ["onMinChanged"],
  16106. "max": ["onMaxChanged"],
  16107. "value": ["valueHandler"],
  16108. "start": ["startWatcher"],
  16109. "end": ["endWatcher"],
  16110. "locale": ["loadLocaleData"]
  16111. }; }
  16112. static get style() { return datePickerCss; }
  16113. static get cmpMeta() { return {
  16114. "$flags$": 9,
  16115. "$tagName$": "calcite-date-picker",
  16116. "$members$": {
  16117. "activeRange": [1, "active-range"],
  16118. "value": [1025],
  16119. "headingLevel": [2, "heading-level"],
  16120. "valueAsDate": [1040],
  16121. "startAsDate": [1040],
  16122. "endAsDate": [1040],
  16123. "minAsDate": [1040],
  16124. "maxAsDate": [1040],
  16125. "min": [1025],
  16126. "max": [1025],
  16127. "intlPrevMonth": [1, "intl-prev-month"],
  16128. "intlNextMonth": [1, "intl-next-month"],
  16129. "intlYear": [1, "intl-year"],
  16130. "locale": [1],
  16131. "scale": [513],
  16132. "range": [516],
  16133. "start": [1025],
  16134. "end": [1025],
  16135. "proximitySelectionDisabled": [4, "proximity-selection-disabled"],
  16136. "activeDate": [32],
  16137. "activeStartDate": [32],
  16138. "activeEndDate": [32],
  16139. "localeData": [32],
  16140. "hoverRange": [32]
  16141. },
  16142. "$listeners$": undefined,
  16143. "$lazyBundleId$": "-",
  16144. "$attrsToReflect$": [["scale", "scale"], ["range", "range"]]
  16145. }; }
  16146. }
  16147. const datePickerDayCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-date-picker-day:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-date-picker-day{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-day{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-day{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-day{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-day{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-date-picker-day:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-day-h{display:none}/*!@:host*/.sc-calcite-date-picker-day-h{display:-ms-flexbox;display:flex;min-width:0px;cursor:pointer;-ms-flex-pack:center;justify-content:center;color:var(--calcite-ui-text-3);width:14.2857142857%}/*!@:host([disabled])*/[disabled].sc-calcite-date-picker-day-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-date-picker-day-h[disabled] .sc-calcite-date-picker-day-s>[calcite-hydrated][disabled],[disabled].sc-calcite-date-picker-day-h [calcite-hydrated][disabled].sc-calcite-date-picker-day{opacity:1}/*!@.day-v-wrapper*/.day-v-wrapper.sc-calcite-date-picker-day{-ms-flex:1 1 auto;flex:1 1 auto}/*!@.day-wrapper*/.day-wrapper.sc-calcite-date-picker-day{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center}/*!@.day*/.day.sc-calcite-date-picker-day{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:9999px;font-size:var(--calcite-font-size--2);line-height:1rem;line-height:1;color:var(--calcite-ui-text-3);opacity:var(--calcite-ui-opacity-disabled);-webkit-transition-property:all;transition-property:all;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms;background:none;-webkit-box-shadow:0 0 0 2px transparent, 0 0 0 0px transparent;box-shadow:0 0 0 2px transparent, 0 0 0 0px transparent}/*!@.text*/.text.sc-calcite-date-picker-day{margin-top:1px;margin-right:0px;margin-bottom:0px;margin-left:1px}/*!@:host([scale=s]) .day-v-wrapper*/[scale=s].sc-calcite-date-picker-day-h .day-v-wrapper.sc-calcite-date-picker-day{padding-top:0.125rem;padding-bottom:0.125rem}/*!@:host([scale=s]) .day-wrapper*/[scale=s].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{padding:0px}/*!@:host([scale=s]) .day*/[scale=s].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{height:27px;width:27px;font-size:var(--calcite-font-size--2)}/*!@:host([scale=m]) .day-v-wrapper*/[scale=m].sc-calcite-date-picker-day-h .day-v-wrapper.sc-calcite-date-picker-day{padding-top:0.25rem;padding-bottom:0.25rem}/*!@:host([scale=m]) .day-wrapper*/[scale=m].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{padding-left:0.25rem;padding-right:0.25rem}/*!@:host([scale=m]) .day*/[scale=m].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{height:33px;width:33px;font-size:var(--calcite-font-size--1)}/*!@:host([scale=l]) .day-v-wrapper*/[scale=l].sc-calcite-date-picker-day-h .day-v-wrapper.sc-calcite-date-picker-day{padding-top:0.25rem;padding-bottom:0.25rem}/*!@:host([scale=l]) .day-wrapper*/[scale=l].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{padding-left:0.25rem;padding-right:0.25rem}/*!@:host([scale=l]) .day*/[scale=l].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{height:43px;width:43px;font-size:var(--calcite-font-size-0)}/*!@:host([current-month]) .day*/[current-month].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{opacity:1}/*!@:host(:hover:not([disabled])) .day, :host([active]:not([range])) .day*/.sc-calcite-date-picker-day-h:hover:not([disabled]) .day.sc-calcite-date-picker-day,[active].sc-calcite-date-picker-day-h:not([range]) .day.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@:host(:focus), :host([active])*/.sc-calcite-date-picker-day-h:focus,[active].sc-calcite-date-picker-day-h{outline:2px solid transparent;outline-offset:2px;z-index:1}/*!@:host(:focus:not([disabled])) .day*/.sc-calcite-date-picker-day-h:focus:not([disabled]) .day.sc-calcite-date-picker-day{-webkit-box-shadow:0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);box-shadow:0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand)}/*!@:host([selected]) .day*/[selected].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{font-weight:var(--calcite-font-weight-medium);background-color:var(--calcite-ui-brand) !important;color:var(--calcite-ui-foreground-1) !important;z-index:1}/*!@:host([range][selected]) .day-wrapper*/[range][selected].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-current)}/*!@:host([start-of-range]) .day-wrapper*/[start-of-range].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{border-start-start-radius:40%;border-end-start-radius:40%}/*!@:host([end-of-range]) .day-wrapper*/[end-of-range].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{border-start-end-radius:40%;border-end-end-radius:40%}/*!@:host([start-of-range]) :not(.calcite--rtl) .day-wrapper,\n:host([end-of-range]) .calcite--rtl .day-wrapper*/[start-of-range].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[end-of-range].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset 4px 0 var(--calcite-ui-foreground-1);box-shadow:inset 4px 0 var(--calcite-ui-foreground-1)}/*!@:host([start-of-range]) :not(.calcite--rtl) .day,\n:host([end-of-range]) .calcite--rtl .day*/[start-of-range].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,[end-of-range].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{opacity:1}/*!@:host([start-of-range]:not(:focus)) :not(.calcite--rtl) .day,\n:host([end-of-range]:not(:focus)) .calcite--rtl .day*/[start-of-range].sc-calcite-date-picker-day-h:not(:focus) .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,[end-of-range].sc-calcite-date-picker-day-h:not(:focus) .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{-webkit-box-shadow:0 0 0 2px var(--calcite-ui-foreground-1);box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]) :not(.calcite--rtl) .day-wrapper,\n:host([start-of-range]) .calcite--rtl .day-wrapper*/[end-of-range].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[start-of-range].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset -4px 0 var(--calcite-ui-foreground-1);box-shadow:inset -4px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]) :not(.calcite--rtl) .day,\n:host([start-of-range]) .calcite--rtl .day*/[end-of-range].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,[start-of-range].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{opacity:1}/*!@:host([end-of-range]:not(:focus)) :not(.calcite--rtl) .day,\n:host([start-of-range]:not(:focus)) .calcite--rtl .day*/[end-of-range].sc-calcite-date-picker-day-h:not(:focus) .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,[start-of-range].sc-calcite-date-picker-day-h:not(:focus) .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{-webkit-box-shadow:0 0 0 2px var(--calcite-ui-foreground-1);box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([end-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper,\n:host([start-of-range][scale=l]) .calcite--rtl .day-wrapper*/[end-of-range][scale=l].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[start-of-range][scale=l].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset -8px 0 var(--calcite-ui-foreground-1);box-shadow:inset -8px 0 var(--calcite-ui-foreground-1)}/*!@:host([start-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper,\n:host([end-of-range][scale=l]) .calcite--rtl .day-wrapper*/[start-of-range][scale=l].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[end-of-range][scale=l].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset 8px 0 var(--calcite-ui-foreground-1);box-shadow:inset 8px 0 var(--calcite-ui-foreground-1)}/*!@:host([highlighted]) .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-current)}/*!@:host([highlighted]) .day-wrapper .day*/[highlighted].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{color:var(--calcite-ui-text-1)}/*!@:host([highlighted]:not([active]:focus)) .day*/[highlighted].sc-calcite-date-picker-day-h:not([active]:focus) .day.sc-calcite-date-picker-day{border-radius:0px;color:var(--calcite-ui-text-1)}/*!@:host([range-hover]:not([selected])) .day-wrapper*/[range-hover].sc-calcite-date-picker-day-h:not([selected]) .day-wrapper.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-2)}/*!@:host([range-hover]:not([selected])) .day*/[range-hover].sc-calcite-date-picker-day-h:not([selected]) .day.sc-calcite-date-picker-day{border-radius:0px}/*!@:host([end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,\n:host([start-of-range][range-hover]) .calcite--rtl .day-wrapper*/[end-of-range][range-hover].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[start-of-range][range-hover].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:-webkit-gradient(linear, left top, right top, from(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-2)), to(var(--calcite-ui-foreground-2)));background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,\n:host([end-of-range][range-hover]) .calcite--rtl .day-wrapper*/[start-of-range][range-hover].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[end-of-range][range-hover].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:-webkit-gradient(linear, right top, left top, from(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-2)), to(var(--calcite-ui-foreground-2)));background-image:linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host(:hover[end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[start-of-range][range-hover]) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[end-of-range][range-hover] .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[start-of-range][range-hover] .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:-webkit-gradient(linear, left top, right top, from(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-1)), to(var(--calcite-ui-foreground-1)));background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host(:hover[start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[end-of-range][range-hover]) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[start-of-range][range-hover] .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[end-of-range][range-hover] .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:-webkit-gradient(linear, right top, left top, from(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-1)), to(var(--calcite-ui-foreground-1)));background-image:linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host(:hover[range-hover]:not([selected]).focused--end) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[range-hover]:not([selected]).focused--start) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:-webkit-gradient(linear, left top, right top, from(var(--calcite-ui-foreground-2)), color-stop(var(--calcite-ui-foreground-2)), color-stop(var(--calcite-ui-foreground-current)), to(var(--calcite-ui-foreground-current)));background-image:linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current))}/*!@:host(:hover[range-hover]:not([selected]).focused--end) :not(.calcite--rtl) .day, :host(:hover[range-hover]:not([selected]).focused--start) .calcite--rtl .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;-webkit-box-shadow:0 0 0 2px var(--calcite-ui-foreground-1);box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[range-hover]:not([selected]).focused--start) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[range-hover]:not([selected]).focused--end) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:-webkit-gradient(linear, left top, right top, from(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-current)), color-stop(var(--calcite-ui-foreground-2)), to(var(--calcite-ui-foreground-2)));background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2))}/*!@:host(:hover[range-hover]:not([selected]).focused--start) :not(.calcite--rtl) .day, :host(:hover[range-hover]:not([selected]).focused--end) .calcite--rtl .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;-webkit-box-shadow:0 0 0 2px var(--calcite-ui-foreground-1);box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start.hover--outside-range .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end.hover--outside-range .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:-webkit-gradient(linear, left top, right top, from(var(--calcite-ui-foreground-1)), color-stop(var(--calcite-ui-foreground-1)), color-stop(var(--calcite-ui-foreground-2)), to(var(--calcite-ui-foreground-2)));background-image:linear-gradient(to right, var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2))}/*!@:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day, :host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start.hover--outside-range .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end.hover--outside-range .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;-webkit-box-shadow:0 0 0 2px var(--calcite-ui-foreground-1);box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end.hover--outside-range .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start.hover--outside-range .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:-webkit-gradient(linear, left top, right top, from(var(--calcite-ui-foreground-2)), color-stop(var(--calcite-ui-foreground-2)), color-stop(var(--calcite-ui-foreground-1)), to(var(--calcite-ui-foreground-1)));background-image:linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1))}/*!@:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day, :host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end.hover--outside-range .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start.hover--outside-range .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;-webkit-box-shadow:0 0 0 2px var(--calcite-ui-foreground-1);box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[start-of-range].hover--inside-range.focused--end) .day-wrapper, :host(:hover[end-of-range].hover--inside-range.focused--start) .day-wrapper*/.sc-calcite-date-picker-day-h:hover[start-of-range].hover--inside-range.focused--end .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[end-of-range].hover--inside-range.focused--start .day-wrapper.sc-calcite-date-picker-day{background-image:none}/*!@:host([start-of-range].hover--inside-range.focused--end) .day-wrapper, :host([end-of-range].hover--inside-range.focused--start) .day-wrapper*/[start-of-range].hover--inside-range.focused--end.sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day,[end-of-range].hover--inside-range.focused--start.sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-2)}/*!@:host([highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([highlighted]:first-child) .calcite--rtl .day-wrapper,\n:host([range-hover]:first-child) .calcite--rtl .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[highlighted].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset -4px 0px 0px 0px var(--calcite-ui-foreground-1);box-shadow:inset -4px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([highlighted]:last-child) .calcite--rtl .day-wrapper,\n:host([range-hover]:last-child) .calcite--rtl .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[highlighted].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset 4px 0px 0px 0px var(--calcite-ui-foreground-1);box-shadow:inset 4px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([scale=s][highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=s][range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=s][highlighted]:first-child) .calcite--rtl .day-wrapper,\n:host([scale=s][range-hover]:first-child) .calcite--rtl .day-wrapper*/[scale=s][highlighted].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=s][range-hover].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=s][highlighted].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[scale=s][range-hover].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset -1px 0px 0px 0px var(--calcite-ui-foreground-1);box-shadow:inset -1px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([scale=s][highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=s][range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=s][highlighted]:last-child) .calcite--rtl .day-wrapper,\n:host([scale=s][range-hover]:last-child) .calcite--rtl .day-wrapper*/[scale=s][highlighted].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=s][range-hover].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=s][highlighted].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[scale=s][range-hover].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset 1px 0px 0px 0px var(--calcite-ui-foreground-1);box-shadow:inset 1px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([scale=l][highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=l][range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=l][highlighted]:last-child) .calcite--rtl .day-wrapper,\n:host([scale=l][range-hover]:last-child) .calcite--rtl .day-wrapper*/[scale=l][highlighted].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=l][range-hover].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=l][highlighted].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[scale=l][range-hover].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset 6px 0px 0px 0px var(--calcite-ui-foreground-1);box-shadow:inset 6px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([highlighted]:first-child) .day-wrapper,\n:host([range-hover]:first-child) .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h:first-child .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:first-child .day-wrapper.sc-calcite-date-picker-day{border-start-start-radius:45%;border-end-start-radius:45%}/*!@:host([highlighted]:last-child) .day-wrapper,\n:host([range-hover]:last-child) .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h:last-child .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:last-child .day-wrapper.sc-calcite-date-picker-day{border-start-end-radius:45%;border-end-end-radius:45%}/*!@:host([scale=l][highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=l][range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=l][highlighted]:first-child) .calcite--rtl .day-wrapper,\n:host([scale=l][range-hover]:first-child) .calcite--rtl .day-wrapper*/[scale=l][highlighted].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=l][range-hover].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=l][highlighted].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[scale=l][range-hover].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{-webkit-box-shadow:inset -6px 0px 0px 0px var(--calcite-ui-foreground-1);box-shadow:inset -6px 0px 0px 0px var(--calcite-ui-foreground-1)}@media (forced-colors: active){/*!@:host(:hover:not([disabled])) .day, :host([active]:not([range])) .day*/.sc-calcite-date-picker-day-h:hover:not([disabled]) .day.sc-calcite-date-picker-day,[active].sc-calcite-date-picker-day-h:not([range]) .day.sc-calcite-date-picker-day{border-radius:0px}/*!@:host([selected])*/[selected].sc-calcite-date-picker-day-h{outline:2px solid canvasText;z-index:1}/*!@:host([selected]) .day*/[selected].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{border-radius:0px;background-color:highlight}/*!@:host([range][selected]) .day-wrapper,\n:host([highlighted]) .day-wrapper,\n:host([range-hover]:not([selected])) .day-wrapper*/[range][selected].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day,[highlighted].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:not([selected]) .day-wrapper.sc-calcite-date-picker-day{background-color:highlight}/*!@:host([range][selected][start-of-range]) .day-wrapper,\n:host([range][selected][end-of-range]) .day-wrapper*/[range][selected][start-of-range].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day,[range][selected][end-of-range].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{background-color:canvas}}";
  16148. class DatePickerDay {
  16149. constructor(hostRef) {
  16150. registerInstance(this, hostRef);
  16151. this.calciteDaySelect = createEvent(this, "calciteDaySelect", 7);
  16152. this.calciteDayHover = createEvent(this, "calciteDayHover", 7);
  16153. /** Date is outside of range and can't be selected */
  16154. this.disabled = false;
  16155. /** Date is in the current month. */
  16156. this.currentMonth = false;
  16157. /** Date is the current selected date of the picker */
  16158. this.selected = false;
  16159. /** Date is currently highlighted as part of the range */
  16160. this.highlighted = false;
  16161. /** Showing date range */
  16162. this.range = false;
  16163. /** Date is the start of date range */
  16164. this.startOfRange = false;
  16165. /** Date is the end of date range */
  16166. this.endOfRange = false;
  16167. /** Date is being hovered and within the set range */
  16168. this.rangeHover = false;
  16169. /** Date is actively in focus for keyboard navigation */
  16170. this.active = false;
  16171. //--------------------------------------------------------------------------
  16172. //
  16173. // Event Listeners
  16174. //
  16175. //--------------------------------------------------------------------------
  16176. this.onClick = () => {
  16177. !this.disabled && this.calciteDaySelect.emit();
  16178. };
  16179. this.keyDownHandler = (e) => {
  16180. const key = e.key;
  16181. if (key === " " || key === "Enter") {
  16182. !this.disabled && this.calciteDaySelect.emit();
  16183. }
  16184. };
  16185. }
  16186. mouseoverHandler() {
  16187. this.calciteDayHover.emit({
  16188. disabled: this.disabled
  16189. });
  16190. }
  16191. //--------------------------------------------------------------------------
  16192. //
  16193. // Lifecycle
  16194. //
  16195. //--------------------------------------------------------------------------
  16196. render() {
  16197. const formattedDay = String(this.day)
  16198. .split("")
  16199. .map((i) => this.localeData.numerals[i])
  16200. .join("");
  16201. const dir = getElementDir(this.el);
  16202. return (hAsync(Host, { onClick: this.onClick, onKeyDown: this.keyDownHandler, role: "gridcell" }, hAsync("div", { class: { "day-v-wrapper": true, [CSS_UTILITY.rtl]: dir === "rtl" } }, hAsync("div", { class: "day-wrapper" }, hAsync("span", { class: "day" }, hAsync("span", { class: "text" }, formattedDay))))));
  16203. }
  16204. componentDidRender() {
  16205. updateHostInteraction(this, this.isTabbable);
  16206. }
  16207. isTabbable() {
  16208. return this.active;
  16209. }
  16210. get el() { return getElement(this); }
  16211. static get style() { return datePickerDayCss; }
  16212. static get cmpMeta() { return {
  16213. "$flags$": 9,
  16214. "$tagName$": "calcite-date-picker-day",
  16215. "$members$": {
  16216. "day": [2],
  16217. "disabled": [516],
  16218. "currentMonth": [516, "current-month"],
  16219. "selected": [516],
  16220. "highlighted": [516],
  16221. "range": [516],
  16222. "startOfRange": [516, "start-of-range"],
  16223. "endOfRange": [516, "end-of-range"],
  16224. "rangeHover": [516, "range-hover"],
  16225. "active": [516],
  16226. "localeData": [16],
  16227. "scale": [513],
  16228. "value": [16]
  16229. },
  16230. "$listeners$": [[1, "mouseover", "mouseoverHandler"]],
  16231. "$lazyBundleId$": "-",
  16232. "$attrsToReflect$": [["disabled", "disabled"], ["currentMonth", "current-month"], ["selected", "selected"], ["highlighted", "highlighted"], ["range", "range"], ["startOfRange", "start-of-range"], ["endOfRange", "end-of-range"], ["rangeHover", "range-hover"], ["active", "active"], ["scale", "scale"]]
  16233. }; }
  16234. }
  16235. const datePickerMonthCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-date-picker-month:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-date-picker-month{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-month{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-month{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-month{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-month{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-date-picker-month:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-month-h{display:none}/*!@.calender*/.calender.sc-calcite-date-picker-month{margin-bottom:0.25rem}/*!@.week-headers*/.week-headers.sc-calcite-date-picker-month{display:-ms-flexbox;display:flex;border-width:0px;border-top-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-top:0px;padding-bottom:0px;padding-left:0.25rem;padding-right:0.25rem}/*!@.week-header*/.week-header.sc-calcite-date-picker-month{text-align:center;font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-3);width:14.2857142857%}/*!@:host([scale=s]) .week-header*/[scale=s].sc-calcite-date-picker-month-h .week-header.sc-calcite-date-picker-month{padding-left:0px;padding-right:0px;padding-top:0.5rem;padding-bottom:0.75rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m]) .week-header*/[scale=m].sc-calcite-date-picker-month-h .week-header.sc-calcite-date-picker-month{padding-left:0px;padding-right:0px;padding-top:0.75rem;padding-bottom:1rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=l]) .week-header*/[scale=l].sc-calcite-date-picker-month-h .week-header.sc-calcite-date-picker-month{padding-left:0px;padding-right:0px;padding-top:1rem;padding-bottom:1.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.week-days*/.week-days.sc-calcite-date-picker-month{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;padding-top:0px;padding-bottom:0px;padding-left:6px;padding-right:6px}/*!@.week-days:focus*/.week-days.sc-calcite-date-picker-month:focus{outline:2px solid transparent;outline-offset:2px}";
  16236. class DatePickerMonth {
  16237. constructor(hostRef) {
  16238. registerInstance(this, hostRef);
  16239. this.calciteDatePickerSelect = createEvent(this, "calciteDatePickerSelect", 7);
  16240. this.calciteDatePickerHover = createEvent(this, "calciteDatePickerHover", 7);
  16241. this.calciteDatePickerActiveDateChange = createEvent(this, "calciteDatePickerActiveDateChange", 7);
  16242. this.calciteDatePickerMouseOut = createEvent(this, "calciteDatePickerMouseOut", 7);
  16243. /** Date currently active.*/
  16244. this.activeDate = new Date();
  16245. //--------------------------------------------------------------------------
  16246. //
  16247. // Event Listeners
  16248. //
  16249. //--------------------------------------------------------------------------
  16250. this.keyDownHandler = (e) => {
  16251. const isRTL = this.el.dir === "rtl";
  16252. switch (e.key) {
  16253. case "ArrowUp":
  16254. e.preventDefault();
  16255. this.addDays(-7);
  16256. break;
  16257. case "ArrowRight":
  16258. e.preventDefault();
  16259. this.addDays(isRTL ? -1 : 1);
  16260. break;
  16261. case "ArrowDown":
  16262. e.preventDefault();
  16263. this.addDays(7);
  16264. break;
  16265. case "ArrowLeft":
  16266. e.preventDefault();
  16267. this.addDays(isRTL ? 1 : -1);
  16268. break;
  16269. case "PageUp":
  16270. e.preventDefault();
  16271. this.addMonths(-1);
  16272. break;
  16273. case "PageDown":
  16274. e.preventDefault();
  16275. this.addMonths(1);
  16276. break;
  16277. case "Home":
  16278. e.preventDefault();
  16279. this.activeDate.setDate(1);
  16280. this.addDays();
  16281. break;
  16282. case "End":
  16283. e.preventDefault();
  16284. this.activeDate.setDate(new Date(this.activeDate.getFullYear(), this.activeDate.getMonth() + 1, 0).getDate());
  16285. this.addDays();
  16286. break;
  16287. case "Enter":
  16288. case " ":
  16289. e.preventDefault();
  16290. break;
  16291. case "Tab":
  16292. this.activeFocus = false;
  16293. }
  16294. };
  16295. /**
  16296. * Once user is not interacting via keyboard,
  16297. * disable auto focusing of active date
  16298. */
  16299. this.disableActiveFocus = () => {
  16300. this.activeFocus = false;
  16301. };
  16302. this.dayHover = (e) => {
  16303. const target = e.target;
  16304. if (e.detail.disabled) {
  16305. this.calciteDatePickerMouseOut.emit();
  16306. }
  16307. else {
  16308. this.calciteDatePickerHover.emit(target.value);
  16309. }
  16310. };
  16311. this.daySelect = (e) => {
  16312. const target = e.target;
  16313. this.calciteDatePickerSelect.emit(target.value);
  16314. };
  16315. }
  16316. mouseoutHandler() {
  16317. this.calciteDatePickerMouseOut.emit();
  16318. }
  16319. //--------------------------------------------------------------------------
  16320. //
  16321. // Lifecycle
  16322. //
  16323. //--------------------------------------------------------------------------
  16324. render() {
  16325. const month = this.activeDate.getMonth();
  16326. const year = this.activeDate.getFullYear();
  16327. const startOfWeek = this.localeData.weekStart % 7;
  16328. const { abbreviated, short, narrow } = this.localeData.days;
  16329. const weekDays = this.scale === "s" ? narrow || short || abbreviated : short || abbreviated || narrow;
  16330. const adjustedWeekDays = [...weekDays.slice(startOfWeek, 7), ...weekDays.slice(0, startOfWeek)];
  16331. const curMonDays = this.getCurrentMonthDays(month, year);
  16332. const prevMonDays = this.getPrevMonthdays(month, year, startOfWeek);
  16333. const nextMonDays = this.getNextMonthDays(month, year, startOfWeek);
  16334. const days = [
  16335. ...prevMonDays.map((day) => {
  16336. const date = new Date(year, month - 1, day);
  16337. return this.renderDateDay(false, day, date);
  16338. }),
  16339. ...curMonDays.map((day) => {
  16340. const date = new Date(year, month, day);
  16341. const active = sameDate(date, this.activeDate);
  16342. return this.renderDateDay(active, day, date, true, true);
  16343. }),
  16344. ...nextMonDays.map((day) => {
  16345. const date = new Date(year, month + 1, day);
  16346. return this.renderDateDay(false, day, date);
  16347. })
  16348. ];
  16349. const weeks = [];
  16350. for (let i = 0; i < days.length; i += 7) {
  16351. weeks.push(days.slice(i, i + 7));
  16352. }
  16353. return (hAsync(Host, { onFocusOut: this.disableActiveFocus, onKeyDown: this.keyDownHandler }, hAsync("div", { class: "calender", role: "grid" }, hAsync("div", { class: "week-headers", role: "row" }, adjustedWeekDays.map((weekday) => (hAsync("span", { class: "week-header", role: "columnheader" }, weekday)))), weeks.map((days) => (hAsync("div", { class: "week-days", role: "row" }, days))))));
  16354. }
  16355. //--------------------------------------------------------------------------
  16356. //
  16357. // Private Methods
  16358. //
  16359. //--------------------------------------------------------------------------
  16360. /**
  16361. * Add n months to the current month
  16362. */
  16363. addMonths(step) {
  16364. const nextDate = new Date(this.activeDate);
  16365. nextDate.setMonth(this.activeDate.getMonth() + step);
  16366. this.calciteDatePickerActiveDateChange.emit(dateFromRange(nextDate, this.min, this.max));
  16367. this.activeFocus = true;
  16368. }
  16369. /**
  16370. * Add n days to the current date
  16371. */
  16372. addDays(step = 0) {
  16373. const nextDate = new Date(this.activeDate);
  16374. nextDate.setDate(this.activeDate.getDate() + step);
  16375. this.calciteDatePickerActiveDateChange.emit(dateFromRange(nextDate, this.min, this.max));
  16376. this.activeFocus = true;
  16377. }
  16378. /**
  16379. * Get dates for last days of the previous month
  16380. */
  16381. getPrevMonthdays(month, year, startOfWeek) {
  16382. const lastDate = new Date(year, month, 0);
  16383. const date = lastDate.getDate();
  16384. const day = lastDate.getDay();
  16385. const days = [];
  16386. if (day - 6 === startOfWeek) {
  16387. return days;
  16388. }
  16389. for (let i = Math.abs(lastDate.getDay() - startOfWeek); i >= 0; i--) {
  16390. days.push(date - i);
  16391. }
  16392. return days;
  16393. }
  16394. /**
  16395. * Get dates for the current month
  16396. */
  16397. getCurrentMonthDays(month, year) {
  16398. const num = new Date(year, month + 1, 0).getDate();
  16399. const days = [];
  16400. for (let i = 0; i < num; i++) {
  16401. days.push(i + 1);
  16402. }
  16403. return days;
  16404. }
  16405. /**
  16406. * Get dates for first days of the next month
  16407. */
  16408. getNextMonthDays(month, year, startOfWeek) {
  16409. const endDay = new Date(year, month + 1, 0).getDay();
  16410. const days = [];
  16411. if (endDay === (startOfWeek + 6) % 7) {
  16412. return days;
  16413. }
  16414. for (let i = 0; i < (6 - (endDay - startOfWeek)) % 7; i++) {
  16415. days.push(i + 1);
  16416. }
  16417. return days;
  16418. }
  16419. /**
  16420. * Determine if the date is in between the start and end dates
  16421. */
  16422. betweenSelectedRange(date) {
  16423. return !!(this.startDate &&
  16424. this.endDate &&
  16425. date > this.startDate &&
  16426. date < this.endDate &&
  16427. !this.isRangeHover(date));
  16428. }
  16429. /**
  16430. * Determine if the date should be in selected state
  16431. */
  16432. isSelected(date) {
  16433. return !!(sameDate(date, this.selectedDate) ||
  16434. (this.startDate && sameDate(date, this.startDate)) ||
  16435. (this.endDate && sameDate(date, this.endDate)));
  16436. }
  16437. /**
  16438. * Determine if the date is the start of the date range
  16439. */
  16440. isStartOfRange(date) {
  16441. return !!(this.startDate &&
  16442. !sameDate(this.startDate, this.endDate) &&
  16443. sameDate(this.startDate, date) &&
  16444. !this.isEndOfRange(date));
  16445. }
  16446. isEndOfRange(date) {
  16447. return !!((this.endDate && !sameDate(this.startDate, this.endDate) && sameDate(this.endDate, date)) ||
  16448. (!this.endDate &&
  16449. this.hoverRange &&
  16450. sameDate(this.startDate, this.hoverRange.end) &&
  16451. sameDate(date, this.hoverRange.end)));
  16452. }
  16453. /**
  16454. * Render calcite-date-picker-day
  16455. */
  16456. renderDateDay(active, day, date, currentMonth, ref) {
  16457. var _a;
  16458. const isFocusedOnStart = this.isFocusedOnStart();
  16459. const isHoverInRange = this.isHoverInRange() ||
  16460. (!this.endDate && this.hoverRange && sameDate((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.end, this.startDate));
  16461. return (hAsync("calcite-date-picker-day", { active: active, class: {
  16462. "hover--inside-range": this.startDate && isHoverInRange,
  16463. "hover--outside-range": this.startDate && !isHoverInRange,
  16464. "focused--start": isFocusedOnStart,
  16465. "focused--end": !isFocusedOnStart
  16466. }, currentMonth: currentMonth, day: day, disabled: !inRange(date, this.min, this.max), endOfRange: this.isEndOfRange(date), highlighted: this.betweenSelectedRange(date), key: date.toDateString(), localeData: this.localeData, onCalciteDayHover: this.dayHover, onCalciteDaySelect: this.daySelect, range: !!this.startDate && !!this.endDate && !sameDate(this.startDate, this.endDate), rangeHover: this.isRangeHover(date), ref: (el) => {
  16467. // when moving via keyboard, focus must be updated on active date
  16468. if (ref && active && this.activeFocus) {
  16469. el === null || el === void 0 ? void 0 : el.focus();
  16470. }
  16471. }, scale: this.scale, selected: this.isSelected(date), startOfRange: this.isStartOfRange(date), value: date }));
  16472. }
  16473. isFocusedOnStart() {
  16474. var _a;
  16475. return ((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "start";
  16476. }
  16477. isHoverInRange() {
  16478. if (!this.hoverRange) {
  16479. return false;
  16480. }
  16481. const { start, end } = this.hoverRange;
  16482. return !!((!this.isFocusedOnStart() && this.startDate && (!this.endDate || end < this.endDate)) ||
  16483. (this.isFocusedOnStart() && this.startDate && start > this.startDate));
  16484. }
  16485. isRangeHover(date) {
  16486. if (!this.hoverRange) {
  16487. return false;
  16488. }
  16489. const { start, end } = this.hoverRange;
  16490. const isStart = this.isFocusedOnStart();
  16491. const insideRange = this.isHoverInRange();
  16492. const cond1 = insideRange &&
  16493. ((!isStart && date > this.startDate && (date < end || sameDate(date, end))) ||
  16494. (isStart && date < this.endDate && (date > start || sameDate(date, start))));
  16495. const cond2 = !insideRange &&
  16496. ((!isStart && date >= this.endDate && (date < end || sameDate(date, end))) ||
  16497. (isStart &&
  16498. (date < this.startDate || (this.endDate && sameDate(date, this.startDate))) &&
  16499. (date > start || sameDate(date, start))));
  16500. return cond1 || cond2;
  16501. }
  16502. get el() { return getElement(this); }
  16503. static get style() { return datePickerMonthCss; }
  16504. static get cmpMeta() { return {
  16505. "$flags$": 9,
  16506. "$tagName$": "calcite-date-picker-month",
  16507. "$members$": {
  16508. "selectedDate": [16],
  16509. "activeDate": [16],
  16510. "startDate": [16],
  16511. "endDate": [16],
  16512. "min": [16],
  16513. "max": [16],
  16514. "scale": [513],
  16515. "localeData": [16],
  16516. "hoverRange": [16]
  16517. },
  16518. "$listeners$": [[1, "mouseout", "mouseoutHandler"]],
  16519. "$lazyBundleId$": "-",
  16520. "$attrsToReflect$": [["scale", "scale"]]
  16521. }; }
  16522. }
  16523. const datePickerMonthHeaderCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-date-picker-month-header:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-date-picker-month-header{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-month-header{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-month-header{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-month-header{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-month-header{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-date-picker-month-header:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-month-header-h{display:none}/*!@:host*/.sc-calcite-date-picker-month-header-h{display:block}/*!@.header*/.header.sc-calcite-date-picker-month-header{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding-top:0px;padding-bottom:0px;padding-left:0.25rem;padding-right:0.25rem}/*!@:host([scale=s]) .text*/[scale=s].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-top:0.5rem;margin-bottom:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=s]) .chevron*/[scale=s].sc-calcite-date-picker-month-header-h .chevron.sc-calcite-date-picker-month-header{height:2.25rem}/*!@:host([scale=m]) .text*/[scale=m].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-top:0.75rem;margin-bottom:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=m]) .chevron*/[scale=m].sc-calcite-date-picker-month-header-h .chevron.sc-calcite-date-picker-month-header{height:3rem}/*!@:host([scale=l]) .text*/[scale=l].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-top:1rem;margin-bottom:1rem;font-size:var(--calcite-font-size-1);line-height:1.5rem}/*!@:host([scale=l]) .chevron*/[scale=l].sc-calcite-date-picker-month-header-h .chevron.sc-calcite-date-picker-month-header{height:3.5rem}/*!@.chevron*/.chevron.sc-calcite-date-picker-month-header{margin-left:-0.25rem;margin-right:-0.25rem;-webkit-box-sizing:content-box;box-sizing:content-box;display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-style:none;background-color:var(--calcite-ui-foreground-1);padding-left:0.25rem;padding-right:0.25rem;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;width:14.2857142857%}/*!@.chevron:focus*/.chevron.sc-calcite-date-picker-month-header:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.chevron:hover, .chevron:focus*/.chevron.sc-calcite-date-picker-month-header:hover,.chevron.sc-calcite-date-picker-month-header:focus{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}/*!@.chevron:active*/.chevron.sc-calcite-date-picker-month-header:active{background-color:var(--calcite-ui-foreground-3)}/*!@.chevron[aria-disabled=true]*/.chevron[aria-disabled=true].sc-calcite-date-picker-month-header{pointer-events:none;opacity:0}/*!@.text*/.text.sc-calcite-date-picker-month-header{margin-top:auto;margin-bottom:auto;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;text-align:center;line-height:1}/*!@.text-nreverse*/.text-nreverse.sc-calcite-date-picker-month-header{-ms-flex-direction:row-reverse;flex-direction:row-reverse}/*!@.month, .year, .suffix*/.month.sc-calcite-date-picker-month-header,.year.sc-calcite-date-picker-month-header,.suffix.sc-calcite-date-picker-month-header{margin-left:0.25rem;margin-right:0.25rem;margin-top:auto;margin-bottom:auto;display:inline-block;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium);line-height:1.25;color:var(--calcite-ui-text-1);font-size:inherit}/*!@.year*/.year.sc-calcite-date-picker-month-header{position:relative;width:3rem;border-style:none;background-color:transparent;text-align:center;font-family:inherit;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;z-index:2}/*!@.year:hover*/.year.sc-calcite-date-picker-month-header:hover{-webkit-transition-duration:100ms;transition-duration:100ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-property:outline-color;transition-property:outline-color;outline:2px solid var(--calcite-ui-border-2);outline-offset:2px}/*!@.year:focus*/.year.sc-calcite-date-picker-month-header:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.year--suffix*/.year--suffix.sc-calcite-date-picker-month-header{width:4rem;text-align:left}/*!@.year-wrap*/.year-wrap.sc-calcite-date-picker-month-header{position:relative}/*!@.suffix*/.suffix.sc-calcite-date-picker-month-header{position:absolute;top:0px;left:0px;width:4rem;white-space:nowrap;text-align:left}/*!@.suffix__invisible*/.suffix__invisible.sc-calcite-date-picker-month-header{visibility:hidden}";
  16524. class DatePickerMonthHeader {
  16525. constructor(hostRef) {
  16526. registerInstance(this, hostRef);
  16527. this.calciteDatePickerSelect = createEvent(this, "calciteDatePickerSelect", 7);
  16528. //--------------------------------------------------------------------------
  16529. //
  16530. // Private Methods
  16531. //
  16532. //--------------------------------------------------------------------------
  16533. /**
  16534. * Increment year on UP/DOWN keys
  16535. */
  16536. this.onYearKey = (e) => {
  16537. const localizedYear = e.target.value;
  16538. switch (e.key) {
  16539. case "ArrowDown":
  16540. e.preventDefault();
  16541. this.setYear({ localizedYear, offset: -1 });
  16542. break;
  16543. case "ArrowUp":
  16544. e.preventDefault();
  16545. this.setYear({ localizedYear, offset: 1 });
  16546. break;
  16547. }
  16548. };
  16549. this.onYearChange = (event) => {
  16550. this.setYear({ localizedYear: event.target.value });
  16551. };
  16552. this.onYearInput = (event) => {
  16553. this.setYear({ localizedYear: event.target.value, commit: false });
  16554. };
  16555. this.prevMonthClick = (e) => {
  16556. this.handleArrowClick(e, this.prevMonthDate);
  16557. };
  16558. this.prevMonthKeydown = (e) => {
  16559. const key = e.key;
  16560. if (key === " " || key === "Enter") {
  16561. this.prevMonthClick(e);
  16562. }
  16563. };
  16564. this.nextMonthClick = (e) => {
  16565. this.handleArrowClick(e, this.nextMonthDate);
  16566. };
  16567. this.nextMonthKeydown = (e) => {
  16568. const key = e.key;
  16569. if (key === " " || key === "Enter") {
  16570. this.nextMonthClick(e);
  16571. }
  16572. };
  16573. /*
  16574. * Update active month on clicks of left/right arrows
  16575. */
  16576. this.handleArrowClick = (e, date) => {
  16577. e === null || e === void 0 ? void 0 : e.preventDefault();
  16578. e.stopPropagation();
  16579. this.calciteDatePickerSelect.emit(date);
  16580. };
  16581. }
  16582. //--------------------------------------------------------------------------
  16583. //
  16584. // Lifecycle
  16585. //
  16586. //--------------------------------------------------------------------------
  16587. connectedCallback() {
  16588. this.setNextPrevMonthDates();
  16589. }
  16590. render() {
  16591. return hAsync("div", { class: "header" }, this.renderContent());
  16592. }
  16593. renderContent() {
  16594. var _a;
  16595. if (!this.activeDate || !this.localeData) {
  16596. return null;
  16597. }
  16598. const activeMonth = this.activeDate.getMonth();
  16599. const { months, unitOrder } = this.localeData;
  16600. const localizedMonth = (months.wide || months.narrow || months.abbreviated)[activeMonth];
  16601. const localizedYear = localizeNumber(this.activeDate.getFullYear(), this.localeData);
  16602. const iconScale = this.scale === "l" ? "m" : "s";
  16603. const order = getOrder(unitOrder);
  16604. const reverse = order.indexOf("y") < order.indexOf("m");
  16605. const suffix = (_a = this.localeData.year) === null || _a === void 0 ? void 0 : _a.suffix;
  16606. return (hAsync(Fragment, null, hAsync("a", { "aria-disabled": (this.prevMonthDate.getMonth() === activeMonth).toString(), "aria-label": this.intlPrevMonth, class: "chevron", href: "#", onClick: this.prevMonthClick, onKeyDown: this.prevMonthKeydown, role: "button", tabindex: this.prevMonthDate.getMonth() === activeMonth ? -1 : 0 }, hAsync("calcite-icon", { "flip-rtl": true, icon: "chevron-left", scale: iconScale })), hAsync("div", { class: { text: true, "text--reverse": reverse } }, hAsync(Heading, { class: "month", level: this.headingLevel }, localizedMonth), hAsync("span", { class: "year-wrap" }, hAsync("input", { "aria-label": this.intlYear, class: {
  16607. year: true,
  16608. "year--suffix": !!suffix
  16609. }, inputmode: "numeric", maxlength: "4", minlength: "1", onChange: this.onYearChange, onInput: this.onYearInput, onKeyDown: this.onYearKey, pattern: "\\d*", ref: (el) => (this.yearInput = el), type: "text", value: localizedYear }), suffix && (hAsync("span", { class: "suffix" }, hAsync("span", { "aria-hidden": "true", class: "suffix__invisible" }, localizedYear), " " + suffix)))), hAsync("a", { "aria-disabled": (this.nextMonthDate.getMonth() === activeMonth).toString(), "aria-label": this.intlNextMonth, class: "chevron", href: "#", onClick: this.nextMonthClick, onKeyDown: this.nextMonthKeydown, role: "button", tabindex: this.nextMonthDate.getMonth() === activeMonth ? -1 : 0 }, hAsync("calcite-icon", { "flip-rtl": true, icon: "chevron-right", scale: iconScale }))));
  16610. }
  16611. setNextPrevMonthDates() {
  16612. if (!this.activeDate) {
  16613. return;
  16614. }
  16615. this.nextMonthDate = dateFromRange(nextMonth(this.activeDate), this.min, this.max);
  16616. this.prevMonthDate = dateFromRange(prevMonth(this.activeDate), this.min, this.max);
  16617. }
  16618. getInRangeDate({ localizedYear, offset = 0 }) {
  16619. const { min, max, activeDate, localeData } = this;
  16620. const parsedYear = parseNumber(localizedYear, localeData);
  16621. const length = parsedYear.toString().length;
  16622. const year = isNaN(parsedYear) ? false : parsedYear + offset;
  16623. const inRange = year && (!min || min.getFullYear() <= year) && (!max || max.getFullYear() >= year);
  16624. // if you've supplied a year and it's in range
  16625. if (year && inRange && length === localizedYear.length) {
  16626. const nextDate = new Date(activeDate);
  16627. nextDate.setFullYear(year);
  16628. return dateFromRange(nextDate, min, max);
  16629. }
  16630. }
  16631. /**
  16632. * Parse localized year string from input,
  16633. * set to active if in range
  16634. */
  16635. setYear({ localizedYear, commit = true, offset = 0 }) {
  16636. const { yearInput, activeDate, localeData } = this;
  16637. const inRangeDate = this.getInRangeDate({ localizedYear, offset });
  16638. // if you've supplied a year and it's in range, update active date
  16639. if (inRangeDate) {
  16640. this.calciteDatePickerSelect.emit(inRangeDate);
  16641. }
  16642. if (commit) {
  16643. yearInput.value = localizeNumber((inRangeDate || activeDate).getFullYear(), localeData);
  16644. }
  16645. }
  16646. get el() { return getElement(this); }
  16647. static get watchers() { return {
  16648. "min": ["setNextPrevMonthDates"],
  16649. "max": ["setNextPrevMonthDates"],
  16650. "activeDate": ["setNextPrevMonthDates"]
  16651. }; }
  16652. static get style() { return datePickerMonthHeaderCss; }
  16653. static get cmpMeta() { return {
  16654. "$flags$": 9,
  16655. "$tagName$": "calcite-date-picker-month-header",
  16656. "$members$": {
  16657. "selectedDate": [16],
  16658. "activeDate": [16],
  16659. "headingLevel": [2, "heading-level"],
  16660. "min": [16],
  16661. "max": [16],
  16662. "locale": [1],
  16663. "intlPrevMonth": [1, "intl-prev-month"],
  16664. "intlNextMonth": [1, "intl-next-month"],
  16665. "intlYear": [1, "intl-year"],
  16666. "scale": [513],
  16667. "localeData": [16],
  16668. "nextMonthDate": [32],
  16669. "prevMonthDate": [32]
  16670. },
  16671. "$listeners$": undefined,
  16672. "$lazyBundleId$": "-",
  16673. "$attrsToReflect$": [["scale", "scale"]]
  16674. }; }
  16675. }
  16676. const SLOTS$h = {
  16677. dropdownTrigger: "dropdown-trigger"
  16678. };
  16679. const dropdownCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-dropdown:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-dropdown{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-dropdown:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-h{display:none}/*!@:host*/.sc-calcite-dropdown-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex:0 1 auto;flex:0 1 auto}/*!@:host([disabled])*/[disabled].sc-calcite-dropdown-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-dropdown-h[disabled] .sc-calcite-dropdown-s>[calcite-hydrated][disabled],[disabled].sc-calcite-dropdown-h [calcite-hydrated][disabled].sc-calcite-dropdown{opacity:1}/*!@:host .calcite-dropdown-wrapper*/.sc-calcite-dropdown-h .calcite-dropdown-wrapper.sc-calcite-dropdown{display:block;position:absolute;z-index:900;-webkit-transform:scale(0);transform:scale(0);visibility:hidden;pointer-events:none}/*!@.calcite-dropdown-wrapper .calcite-popper-anim*/.calcite-dropdown-wrapper.sc-calcite-dropdown .calcite-popper-anim.sc-calcite-dropdown{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}/*!@.calcite-dropdown-wrapper[data-popper-placement^=bottom] .calcite-popper-anim*/.calcite-dropdown-wrapper[data-popper-placement^=bottom].sc-calcite-dropdown .calcite-popper-anim.sc-calcite-dropdown{-webkit-transform:translateY(-5px);transform:translateY(-5px)}/*!@.calcite-dropdown-wrapper[data-popper-placement^=top] .calcite-popper-anim*/.calcite-dropdown-wrapper[data-popper-placement^=top].sc-calcite-dropdown .calcite-popper-anim.sc-calcite-dropdown{-webkit-transform:translateY(5px);transform:translateY(5px)}/*!@.calcite-dropdown-wrapper[data-popper-placement^=left] .calcite-popper-anim*/.calcite-dropdown-wrapper[data-popper-placement^=left].sc-calcite-dropdown .calcite-popper-anim.sc-calcite-dropdown{-webkit-transform:translateX(5px);transform:translateX(5px)}/*!@.calcite-dropdown-wrapper[data-popper-placement^=right] .calcite-popper-anim*/.calcite-dropdown-wrapper[data-popper-placement^=right].sc-calcite-dropdown .calcite-popper-anim.sc-calcite-dropdown{-webkit-transform:translateX(-5px);transform:translateX(-5px)}/*!@.calcite-dropdown-wrapper[data-popper-placement] .calcite-popper-anim--active*/.calcite-dropdown-wrapper[data-popper-placement].sc-calcite-dropdown .calcite-popper-anim--active.sc-calcite-dropdown{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}/*!@:host([active]) .calcite-dropdown-wrapper*/[active].sc-calcite-dropdown-h .calcite-dropdown-wrapper.sc-calcite-dropdown{pointer-events:initial;visibility:visible}/*!@:host .calcite-dropdown-content*/.sc-calcite-dropdown-h .calcite-dropdown-content.sc-calcite-dropdown{width:auto;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-ui-foreground-1);max-height:90vh;width:var(--calcite-dropdown-width)}/*!@.calcite-dropdown-trigger-container*/.calcite-dropdown-trigger-container.sc-calcite-dropdown{position:relative;display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto}/*!@:host([width=s])*/[width=s].sc-calcite-dropdown-h{--calcite-dropdown-width:12rem}/*!@:host([width=m])*/[width=m].sc-calcite-dropdown-h{--calcite-dropdown-width:14rem}/*!@:host([width=l])*/[width=l].sc-calcite-dropdown-h{--calcite-dropdown-width:16rem}";
  16680. /**
  16681. * @slot - A slot for adding `calcite-dropdown-group`s or `calcite-dropdown-item`s.
  16682. * @slot dropdown-trigger - A slot for the element that triggers the dropdown.
  16683. */
  16684. class Dropdown {
  16685. constructor(hostRef) {
  16686. registerInstance(this, hostRef);
  16687. this.calciteDropdownSelect = createEvent(this, "calciteDropdownSelect", 7);
  16688. this.calciteDropdownOpen = createEvent(this, "calciteDropdownOpen", 7);
  16689. this.calciteDropdownClose = createEvent(this, "calciteDropdownClose", 7);
  16690. //--------------------------------------------------------------------------
  16691. //
  16692. // Public Properties
  16693. //
  16694. //--------------------------------------------------------------------------
  16695. /** Opens or closes the dropdown */
  16696. this.active = false;
  16697. /**
  16698. allow the dropdown to remain open after a selection is made
  16699. if the selection-mode of the selected item's containing group is "none", the dropdown will always close
  16700. */
  16701. this.disableCloseOnSelect = false;
  16702. /** is the dropdown disabled */
  16703. this.disabled = false;
  16704. /**
  16705. specify the maximum number of calcite-dropdown-items to display before showing the scroller, must be greater than 0 -
  16706. this value does not include groupTitles passed to calcite-dropdown-group
  16707. */
  16708. this.maxItems = 0;
  16709. /** Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value. */
  16710. this.overlayPositioning = "absolute";
  16711. /**
  16712. * Determines where the dropdown will be positioned relative to the button.
  16713. * @default "bottom-leading"
  16714. */
  16715. this.placement = defaultMenuPlacement;
  16716. /** specify the scale of dropdown, defaults to m */
  16717. this.scale = "m";
  16718. /**
  16719. * **read-only** The currently selected items
  16720. *
  16721. * @readonly
  16722. */
  16723. this.selectedItems = [];
  16724. /** specify whether the dropdown is opened by hover or click of a trigger element */
  16725. this.type = "click";
  16726. /** specify the width of dropdown, defaults to m */
  16727. this.width = "m";
  16728. this.items = [];
  16729. this.groups = [];
  16730. this.activeTransitionProp = "visibility";
  16731. this.mutationObserver = createObserver();
  16732. this.resizeObserver = createObserver();
  16733. //--------------------------------------------------------------------------
  16734. //
  16735. // Private Methods
  16736. //
  16737. //--------------------------------------------------------------------------
  16738. this.setFilteredPlacements = () => {
  16739. const { el, flipPlacements } = this;
  16740. this.filteredFlipPlacements = flipPlacements
  16741. ? filterComputedPlacements(flipPlacements, el)
  16742. : null;
  16743. };
  16744. this.updateTriggers = (event) => {
  16745. this.triggers = event.target.assignedElements({
  16746. flatten: true
  16747. });
  16748. this.reposition();
  16749. };
  16750. this.updateItems = () => {
  16751. this.items = this.groups
  16752. .map((group) => Array.from(group === null || group === void 0 ? void 0 : group.querySelectorAll("calcite-dropdown-item")))
  16753. .reduce((previousValue, currentValue) => [...previousValue, ...currentValue], []);
  16754. this.updateSelectedItems();
  16755. this.reposition();
  16756. };
  16757. this.updateGroups = (event) => {
  16758. const groups = event.target
  16759. .assignedElements({ flatten: true })
  16760. .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-dropdown-group"));
  16761. this.groups = groups;
  16762. this.updateItems();
  16763. };
  16764. this.setMaxScrollerHeight = () => {
  16765. const { active, scrollerEl } = this;
  16766. if (!scrollerEl || !active) {
  16767. return;
  16768. }
  16769. this.reposition();
  16770. const maxScrollerHeight = this.getMaxScrollerHeight();
  16771. scrollerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
  16772. this.reposition();
  16773. };
  16774. this.setScrollerEl = (scrollerEl) => {
  16775. this.resizeObserver.observe(scrollerEl);
  16776. this.scrollerEl = scrollerEl;
  16777. };
  16778. this.transitionEnd = (event) => {
  16779. if (event.propertyName === this.activeTransitionProp) {
  16780. this.active ? this.calciteDropdownOpen.emit() : this.calciteDropdownClose.emit();
  16781. }
  16782. };
  16783. this.setReferenceEl = (el) => {
  16784. this.referenceEl = el;
  16785. };
  16786. this.setMenuEl = (el) => {
  16787. this.menuEl = el;
  16788. };
  16789. this.keyDownHandler = (e) => {
  16790. const target = e.target;
  16791. if (target !== this.referenceEl) {
  16792. return;
  16793. }
  16794. const key = e.key;
  16795. if (this.active && (key === "Escape" || (e.shiftKey && key === "Tab"))) {
  16796. this.closeCalciteDropdown();
  16797. return;
  16798. }
  16799. switch (key) {
  16800. case " ":
  16801. case "Enter":
  16802. this.openCalciteDropdown();
  16803. break;
  16804. case "Escape":
  16805. this.closeCalciteDropdown();
  16806. break;
  16807. }
  16808. };
  16809. this.focusOnFirstActiveOrFirstItem = () => {
  16810. this.getFocusableElement(this.items.find((item) => item.active) || this.items[0]);
  16811. };
  16812. this.toggleOpenEnd = () => {
  16813. this.focusOnFirstActiveOrFirstItem();
  16814. this.el.removeEventListener("calciteDropdownOpen", this.toggleOpenEnd);
  16815. };
  16816. this.openCalciteDropdown = () => {
  16817. this.active = !this.active;
  16818. if (this.active) {
  16819. this.el.addEventListener("calciteDropdownOpen", this.toggleOpenEnd);
  16820. }
  16821. };
  16822. }
  16823. activeHandler() {
  16824. if (!this.disabled) {
  16825. this.reposition();
  16826. return;
  16827. }
  16828. this.active = false;
  16829. }
  16830. handleDisabledChange(value) {
  16831. if (!value) {
  16832. this.active = false;
  16833. }
  16834. }
  16835. flipPlacementsHandler() {
  16836. this.setFilteredPlacements();
  16837. }
  16838. maxItemsHandler() {
  16839. this.setMaxScrollerHeight();
  16840. }
  16841. placementHandler() {
  16842. this.reposition();
  16843. }
  16844. //--------------------------------------------------------------------------
  16845. //
  16846. // Lifecycle
  16847. //
  16848. //--------------------------------------------------------------------------
  16849. connectedCallback() {
  16850. var _a;
  16851. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  16852. this.createPopper();
  16853. this.setFilteredPlacements();
  16854. }
  16855. componentDidLoad() {
  16856. this.reposition();
  16857. }
  16858. componentDidRender() {
  16859. updateHostInteraction(this);
  16860. }
  16861. disconnectedCallback() {
  16862. var _a, _b;
  16863. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  16864. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
  16865. this.destroyPopper();
  16866. }
  16867. render() {
  16868. const { active } = this;
  16869. return (hAsync(Host, null, hAsync("div", { class: "calcite-dropdown-trigger-container", onClick: this.openCalciteDropdown, onKeyDown: this.keyDownHandler, ref: this.setReferenceEl }, hAsync("slot", { "aria-expanded": toAriaBoolean(active), "aria-haspopup": "true", name: SLOTS$h.dropdownTrigger, onSlotchange: this.updateTriggers })), hAsync("div", { "aria-hidden": toAriaBoolean(!active), class: "calcite-dropdown-wrapper", ref: this.setMenuEl }, hAsync("div", { class: {
  16870. ["calcite-dropdown-content"]: true,
  16871. [CSS$D.animation]: true,
  16872. [CSS$D.animationActive]: active
  16873. }, onTransitionEnd: this.transitionEnd, ref: this.setScrollerEl }, hAsync("div", { hidden: !this.active }, hAsync("slot", { onSlotchange: this.updateGroups }))))));
  16874. }
  16875. //--------------------------------------------------------------------------
  16876. //
  16877. // Public Methods
  16878. //
  16879. //--------------------------------------------------------------------------
  16880. /** Updates the position of the component. */
  16881. async reposition() {
  16882. const { popper, menuEl, placement } = this;
  16883. const modifiers = this.getModifiers();
  16884. popper
  16885. ? await updatePopper({
  16886. el: menuEl,
  16887. modifiers,
  16888. placement,
  16889. popper
  16890. })
  16891. : this.createPopper();
  16892. }
  16893. closeCalciteDropdownOnClick(e) {
  16894. if (!this.active || e.composedPath().includes(this.el)) {
  16895. return;
  16896. }
  16897. this.closeCalciteDropdown(false);
  16898. }
  16899. closeCalciteDropdownOnEvent() {
  16900. this.closeCalciteDropdown();
  16901. }
  16902. closeCalciteDropdownOnOpenEvent(e) {
  16903. if (e.composedPath().includes(this.el)) {
  16904. return;
  16905. }
  16906. this.active = false;
  16907. }
  16908. mouseEnterHandler() {
  16909. if (this.type === "hover") {
  16910. this.openCalciteDropdown();
  16911. }
  16912. }
  16913. mouseLeaveHandler() {
  16914. if (this.type === "hover") {
  16915. this.closeCalciteDropdown();
  16916. }
  16917. }
  16918. calciteDropdownItemKeyEvent(e) {
  16919. const { keyboardEvent } = e.detail;
  16920. // handle edge
  16921. const target = keyboardEvent.target;
  16922. const itemToFocus = target.nodeName !== "A" ? target : target.parentNode;
  16923. const isFirstItem = this.itemIndex(itemToFocus) === 0;
  16924. const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
  16925. switch (keyboardEvent.key) {
  16926. case "Tab":
  16927. if (isLastItem && !keyboardEvent.shiftKey) {
  16928. this.closeCalciteDropdown();
  16929. }
  16930. else if (isFirstItem && keyboardEvent.shiftKey) {
  16931. this.closeCalciteDropdown();
  16932. }
  16933. else if (keyboardEvent.shiftKey) {
  16934. this.focusPrevItem(itemToFocus);
  16935. }
  16936. else {
  16937. this.focusNextItem(itemToFocus);
  16938. }
  16939. break;
  16940. case "ArrowDown":
  16941. this.focusNextItem(itemToFocus);
  16942. break;
  16943. case "ArrowUp":
  16944. this.focusPrevItem(itemToFocus);
  16945. break;
  16946. case "Home":
  16947. this.focusFirstItem();
  16948. break;
  16949. case "End":
  16950. this.focusLastItem();
  16951. break;
  16952. }
  16953. e.stopPropagation();
  16954. }
  16955. handleItemSelect(event) {
  16956. this.updateSelectedItems();
  16957. event.stopPropagation();
  16958. this.calciteDropdownSelect.emit();
  16959. if (!this.disableCloseOnSelect ||
  16960. event.detail.requestedDropdownGroup.selectionMode === "none") {
  16961. this.closeCalciteDropdown();
  16962. }
  16963. }
  16964. getModifiers() {
  16965. const flipModifier = {
  16966. name: "flip",
  16967. enabled: true
  16968. };
  16969. flipModifier.options = {
  16970. fallbackPlacements: this.filteredFlipPlacements || popperMenuComputedPlacements
  16971. };
  16972. const eventListenerModifier = {
  16973. name: "eventListeners",
  16974. enabled: this.active
  16975. };
  16976. return [flipModifier, eventListenerModifier];
  16977. }
  16978. createPopper() {
  16979. this.destroyPopper();
  16980. const { menuEl, referenceEl, placement, overlayPositioning } = this;
  16981. const modifiers = this.getModifiers();
  16982. this.popper = createPopper({
  16983. el: menuEl,
  16984. modifiers,
  16985. overlayPositioning,
  16986. placement,
  16987. referenceEl
  16988. });
  16989. }
  16990. destroyPopper() {
  16991. const { popper } = this;
  16992. if (popper) {
  16993. popper.destroy();
  16994. }
  16995. this.popper = null;
  16996. }
  16997. updateSelectedItems() {
  16998. this.selectedItems = this.items.filter((item) => item.active);
  16999. }
  17000. getMaxScrollerHeight() {
  17001. const { maxItems } = this;
  17002. let itemsToProcess = 0;
  17003. let maxScrollerHeight = 0;
  17004. let groupHeaderHeight;
  17005. this.groups.forEach((group) => {
  17006. if (maxItems > 0 && itemsToProcess < maxItems) {
  17007. Array.from(group.children).forEach((item, index) => {
  17008. if (index === 0) {
  17009. if (isNaN(groupHeaderHeight)) {
  17010. groupHeaderHeight = item.offsetTop;
  17011. }
  17012. maxScrollerHeight += groupHeaderHeight;
  17013. }
  17014. if (itemsToProcess < maxItems) {
  17015. maxScrollerHeight += item.offsetHeight;
  17016. itemsToProcess += 1;
  17017. }
  17018. });
  17019. }
  17020. });
  17021. return maxScrollerHeight;
  17022. }
  17023. closeCalciteDropdown(focusTrigger = true) {
  17024. this.active = false;
  17025. if (focusTrigger) {
  17026. focusElement(this.triggers[0]);
  17027. }
  17028. }
  17029. focusFirstItem() {
  17030. const firstItem = this.items[0];
  17031. this.getFocusableElement(firstItem);
  17032. }
  17033. focusLastItem() {
  17034. const lastItem = this.items[this.items.length - 1];
  17035. this.getFocusableElement(lastItem);
  17036. }
  17037. focusNextItem(e) {
  17038. const index = this.itemIndex(e);
  17039. const nextItem = this.items[index + 1] || this.items[0];
  17040. this.getFocusableElement(nextItem);
  17041. }
  17042. focusPrevItem(e) {
  17043. const index = this.itemIndex(e);
  17044. const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
  17045. this.getFocusableElement(prevItem);
  17046. }
  17047. itemIndex(e) {
  17048. return this.items.indexOf(e);
  17049. }
  17050. getFocusableElement(item) {
  17051. if (!item) {
  17052. return;
  17053. }
  17054. const target = item.attributes.isLink
  17055. ? item.shadowRoot.querySelector("a")
  17056. : item;
  17057. focusElement(target);
  17058. }
  17059. get el() { return getElement(this); }
  17060. static get watchers() { return {
  17061. "active": ["activeHandler"],
  17062. "disabled": ["handleDisabledChange"],
  17063. "flipPlacements": ["flipPlacementsHandler"],
  17064. "maxItems": ["maxItemsHandler"],
  17065. "placement": ["placementHandler"]
  17066. }; }
  17067. static get style() { return dropdownCss; }
  17068. static get cmpMeta() { return {
  17069. "$flags$": 9,
  17070. "$tagName$": "calcite-dropdown",
  17071. "$members$": {
  17072. "active": [1540],
  17073. "disableCloseOnSelect": [516, "disable-close-on-select"],
  17074. "disabled": [516],
  17075. "flipPlacements": [16],
  17076. "maxItems": [2, "max-items"],
  17077. "overlayPositioning": [1, "overlay-positioning"],
  17078. "placement": [513],
  17079. "scale": [513],
  17080. "selectedItems": [1040],
  17081. "type": [513],
  17082. "width": [513],
  17083. "reposition": [64]
  17084. },
  17085. "$listeners$": [[8, "click", "closeCalciteDropdownOnClick"], [0, "calciteDropdownCloseRequest", "closeCalciteDropdownOnEvent"], [8, "calciteDropdownOpen", "closeCalciteDropdownOnOpenEvent"], [1, "mouseenter", "mouseEnterHandler"], [1, "mouseleave", "mouseLeaveHandler"], [0, "calciteDropdownItemKeyEvent", "calciteDropdownItemKeyEvent"], [0, "calciteDropdownItemSelect", "handleItemSelect"]],
  17086. "$lazyBundleId$": "-",
  17087. "$attrsToReflect$": [["active", "active"], ["disableCloseOnSelect", "disable-close-on-select"], ["disabled", "disabled"], ["placement", "placement"], ["scale", "scale"], ["type", "type"], ["width", "width"]]
  17088. }; }
  17089. }
  17090. const CSS$A = {
  17091. containerSmall: "container--s",
  17092. containerMedium: "container--m",
  17093. containerLarge: "container--l"
  17094. };
  17095. const dropdownGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-dropdown-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-dropdown-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-dropdown-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-group-h{display:none}/*!@:host*/.sc-calcite-dropdown-group-h{display:block}/*!@.container--s*/.container--s.sc-calcite-dropdown-group{font-size:var(--calcite-font-size--2);line-height:1rem}/*!@.container--s .dropdown-title*/.container--s.sc-calcite-dropdown-group .dropdown-title.sc-calcite-dropdown-group{padding:0.5rem}/*!@.container--m*/.container--m.sc-calcite-dropdown-group{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.container--m .dropdown-title*/.container--m.sc-calcite-dropdown-group .dropdown-title.sc-calcite-dropdown-group{padding:0.75rem}/*!@.container--l*/.container--l.sc-calcite-dropdown-group{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@.container--l .dropdown-title*/.container--l.sc-calcite-dropdown-group .dropdown-title.sc-calcite-dropdown-group{padding:1rem}/*!@.dropdown-title*/.dropdown-title.sc-calcite-dropdown-group{margin-bottom:-1px;display:block;cursor:default;overflow-wrap:break-word;border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-2)}/*!@.dropdown-separator*/.dropdown-separator.sc-calcite-dropdown-group{display:block;height:1px;background-color:var(--calcite-ui-border-3)}";
  17096. /**
  17097. * @slot - A slot for adding `calcite-dropdown-item`s.
  17098. */
  17099. class DropdownGroup {
  17100. constructor(hostRef) {
  17101. registerInstance(this, hostRef);
  17102. this.calciteDropdownItemChange = createEvent(this, "calciteDropdownItemChange", 7);
  17103. /** specify the selection mode - multi (allow any number of (or no) active items), single (allow and require one active item),
  17104. none (no active items), defaults to single */
  17105. this.selectionMode = "single";
  17106. }
  17107. //--------------------------------------------------------------------------
  17108. //
  17109. // Lifecycle
  17110. //
  17111. //--------------------------------------------------------------------------
  17112. componentWillLoad() {
  17113. this.groupPosition = this.getGroupPosition();
  17114. }
  17115. render() {
  17116. const scale = this.scale || getElementProp(this.el, "scale", "m");
  17117. const groupTitle = this.groupTitle ? (hAsync("span", { "aria-hidden": "true", class: "dropdown-title" }, this.groupTitle)) : null;
  17118. const dropdownSeparator = this.groupPosition > 0 ? hAsync("div", { class: "dropdown-separator", role: "separator" }) : null;
  17119. return (hAsync(Host, { role: "menu" }, hAsync("div", { class: {
  17120. container: true,
  17121. [CSS$A.containerSmall]: scale === "s",
  17122. [CSS$A.containerMedium]: scale === "m",
  17123. [CSS$A.containerLarge]: scale === "l"
  17124. }, title: this.groupTitle }, dropdownSeparator, groupTitle, hAsync("slot", null))));
  17125. }
  17126. //--------------------------------------------------------------------------
  17127. //
  17128. // Event Listeners
  17129. //
  17130. //--------------------------------------------------------------------------
  17131. updateActiveItemOnChange(event) {
  17132. this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
  17133. this.requestedDropdownItem = event.detail.requestedDropdownItem;
  17134. this.calciteDropdownItemChange.emit({
  17135. requestedDropdownGroup: this.requestedDropdownGroup,
  17136. requestedDropdownItem: this.requestedDropdownItem
  17137. });
  17138. }
  17139. //--------------------------------------------------------------------------
  17140. //
  17141. // Private Methods
  17142. //
  17143. //--------------------------------------------------------------------------
  17144. getGroupPosition() {
  17145. return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-dropdown-group"), this.el);
  17146. }
  17147. get el() { return getElement(this); }
  17148. static get style() { return dropdownGroupCss; }
  17149. static get cmpMeta() { return {
  17150. "$flags$": 9,
  17151. "$tagName$": "calcite-dropdown-group",
  17152. "$members$": {
  17153. "groupTitle": [513, "group-title"],
  17154. "selectionMode": [513, "selection-mode"],
  17155. "scale": [513]
  17156. },
  17157. "$listeners$": [[0, "calciteDropdownItemSelect", "updateActiveItemOnChange"]],
  17158. "$lazyBundleId$": "-",
  17159. "$attrsToReflect$": [["groupTitle", "group-title"], ["selectionMode", "selection-mode"], ["scale", "scale"]]
  17160. }; }
  17161. }
  17162. const CSS$z = {
  17163. containerLink: "container--link",
  17164. containerSmall: "container--s",
  17165. containerMedium: "container--m",
  17166. containerLarge: "container--l",
  17167. containerMulti: "container--multi-selection",
  17168. containerSingle: "container--single-selection",
  17169. containerNone: "container--none-selection"
  17170. };
  17171. const dropdownItemCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-dropdown-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-dropdown-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-dropdown-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-item-h{display:none}/*!@.container--s*/.container--s.sc-calcite-dropdown-item{padding-top:0.25rem;padding-bottom:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;-webkit-padding-end:0.5rem;padding-inline-end:0.5rem;-webkit-padding-start:1.5rem;padding-inline-start:1.5rem}/*!@.container--m*/.container--m.sc-calcite-dropdown-item{padding-top:0.5rem;padding-bottom:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;-webkit-padding-end:0.75rem;padding-inline-end:0.75rem;-webkit-padding-start:2rem;padding-inline-start:2rem}/*!@.container--l*/.container--l.sc-calcite-dropdown-item{padding-top:0.75rem;padding-bottom:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;-webkit-padding-end:1rem;padding-inline-end:1rem;-webkit-padding-start:2.5rem;padding-inline-start:2.5rem}/*!@.container--s.container--none-selection*/.container--s.container--none-selection.sc-calcite-dropdown-item{-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}/*!@.container--s.container--none-selection .dropdown-link*/.container--s.container--none-selection.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{-webkit-padding-start:0px;padding-inline-start:0px}/*!@.container--m.container--none-selection*/.container--m.container--none-selection.sc-calcite-dropdown-item{-webkit-padding-start:0.5rem;padding-inline-start:0.5rem}/*!@.container--m.container--none-selection .dropdown-link*/.container--m.container--none-selection.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{-webkit-padding-start:0px;padding-inline-start:0px}/*!@.container--l.container--none-selection*/.container--l.container--none-selection.sc-calcite-dropdown-item{-webkit-padding-start:0.75rem;padding-inline-start:0.75rem}/*!@.container--l.container--none-selection .dropdown-link*/.container--l.container--none-selection.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{-webkit-padding-start:0px;padding-inline-start:0px}/*!@:host*/.sc-calcite-dropdown-item-h{position:relative;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center}/*!@.container*/.container.sc-calcite-dropdown-item{position:relative;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;cursor:pointer;-ms-flex-align:center;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@.dropdown-item-content*/.dropdown-item-content.sc-calcite-dropdown-item{-ms-flex:1 1 auto;flex:1 1 auto;-webkit-padding-end:auto;padding-inline-end:auto;-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}/*!@:host, .container--link a*/.sc-calcite-dropdown-item-h,.container--link.sc-calcite-dropdown-item a.sc-calcite-dropdown-item{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host(:focus)*/.sc-calcite-dropdown-item-h:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.container--link*/.container--link.sc-calcite-dropdown-item{padding:0px}/*!@.container--link a*/.container--link.sc-calcite-dropdown-item a.sc-calcite-dropdown-item{position:relative;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;cursor:pointer;-ms-flex-align:center;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@.container--s .dropdown-link*/.container--s.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-top:0.25rem;padding-bottom:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;-webkit-padding-end:0.5rem;padding-inline-end:0.5rem;-webkit-padding-start:1.5rem;padding-inline-start:1.5rem}/*!@.container--m .dropdown-link*/.container--m.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-top:0.5rem;padding-bottom:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;-webkit-padding-end:0.75rem;padding-inline-end:0.75rem;-webkit-padding-start:2rem;padding-inline-start:2rem}/*!@.container--l .dropdown-link*/.container--l.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-top:0.75rem;padding-bottom:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;-webkit-padding-end:1rem;padding-inline-end:1rem;-webkit-padding-start:2.5rem;padding-inline-start:2.5rem}/*!@:host(:hover) .container, :host(:active) .container*/.sc-calcite-dropdown-item-h:hover .container.sc-calcite-dropdown-item,.sc-calcite-dropdown-item-h:active .container.sc-calcite-dropdown-item{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none}/*!@:host(:hover) .container--link .dropdown-link, :host(:active) .container--link .dropdown-link*/.sc-calcite-dropdown-item-h:hover .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item,.sc-calcite-dropdown-item-h:active .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .container*/.sc-calcite-dropdown-item-h:focus .container.sc-calcite-dropdown-item{color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none}/*!@:host(:active) .container*/.sc-calcite-dropdown-item-h:active .container.sc-calcite-dropdown-item{background-color:var(--calcite-ui-foreground-3)}/*!@:host(:hover) .container:before, :host(:active) .container:before, :host(:focus) .container:before*/.sc-calcite-dropdown-item-h:hover .container.sc-calcite-dropdown-item:before,.sc-calcite-dropdown-item-h:active .container.sc-calcite-dropdown-item:before,.sc-calcite-dropdown-item-h:focus .container.sc-calcite-dropdown-item:before{opacity:1}/*!@:host([active]) .container:not(.container--none-selection), :host([active]) .container--link .dropdown-link*/[active].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection),[active].sc-calcite-dropdown-item-h .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@:host([active]) .container:not(.container--none-selection):before, :host([active]) .container--link .dropdown-link:before*/[active].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection):before,[active].sc-calcite-dropdown-item-h .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item:before{opacity:1;color:var(--calcite-ui-brand)}/*!@:host([active]) .container:not(.container--none-selection) calcite-icon,\n:host([active]) .container--link .dropdown-link calcite-icon*/[active].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection) calcite-icon.sc-calcite-dropdown-item,[active].sc-calcite-dropdown-item-h .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item calcite-icon.sc-calcite-dropdown-item{color:var(--calcite-ui-brand)}/*!@.container--multi-selection:before, .container--none-selection:before*/.container--multi-selection.sc-calcite-dropdown-item:before,.container--none-selection.sc-calcite-dropdown-item:before{display:none}/*!@.container--s:before*/.container--s.sc-calcite-dropdown-item:before{inset-inline-start:0.5rem}/*!@.container--m:before*/.container--m.sc-calcite-dropdown-item:before{inset-inline-start:0.75rem}/*!@.container--l:before*/.container--l.sc-calcite-dropdown-item:before{inset-inline-start:1rem}/*!@.dropdown-item-icon*/.dropdown-item-icon.sc-calcite-dropdown-item{position:absolute;opacity:0;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transform:scale(0.9);transform:scale(0.9)}/*!@.container--s .dropdown-item-icon*/.container--s.sc-calcite-dropdown-item .dropdown-item-icon.sc-calcite-dropdown-item{inset-inline-start:0.25rem}/*!@.container--m .dropdown-item-icon*/.container--m.sc-calcite-dropdown-item .dropdown-item-icon.sc-calcite-dropdown-item{inset-inline-start:0.5rem}/*!@.container--l .dropdown-item-icon*/.container--l.sc-calcite-dropdown-item .dropdown-item-icon.sc-calcite-dropdown-item{inset-inline-start:0.75rem}/*!@:host(:hover) .dropdown-item-icon*/.sc-calcite-dropdown-item-h:hover .dropdown-item-icon.sc-calcite-dropdown-item{color:var(--calcite-ui-border-1);opacity:1}/*!@:host([active]) .dropdown-item-icon*/[active].sc-calcite-dropdown-item-h .dropdown-item-icon.sc-calcite-dropdown-item{color:var(--calcite-ui-brand);opacity:1}/*!@.container--s .dropdown-item-icon-start*/.container--s.sc-calcite-dropdown-item .dropdown-item-icon-start.sc-calcite-dropdown-item{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem;-webkit-margin-start:0.25rem;margin-inline-start:0.25rem}/*!@.container--s .dropdown-item-icon-end*/.container--s.sc-calcite-dropdown-item .dropdown-item-icon-end.sc-calcite-dropdown-item{-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}/*!@.container--m .dropdown-item-icon-start*/.container--m.sc-calcite-dropdown-item .dropdown-item-icon-start.sc-calcite-dropdown-item{-webkit-margin-end:0.75rem;margin-inline-end:0.75rem;-webkit-margin-start:0.25rem;margin-inline-start:0.25rem}/*!@.container--m .dropdown-item-icon-end*/.container--m.sc-calcite-dropdown-item .dropdown-item-icon-end.sc-calcite-dropdown-item{-webkit-margin-start:0.75rem;margin-inline-start:0.75rem}/*!@.container--l .dropdown-item-icon-start*/.container--l.sc-calcite-dropdown-item .dropdown-item-icon-start.sc-calcite-dropdown-item{-webkit-margin-end:1rem;margin-inline-end:1rem;-webkit-margin-start:0.25rem;margin-inline-start:0.25rem}/*!@.container--l .dropdown-item-icon-end*/.container--l.sc-calcite-dropdown-item .dropdown-item-icon-end.sc-calcite-dropdown-item{-webkit-margin-start:1rem;margin-inline-start:1rem}";
  17172. /**
  17173. * @slot - A slot for adding text.
  17174. */
  17175. class DropdownItem {
  17176. constructor(hostRef) {
  17177. registerInstance(this, hostRef);
  17178. this.calciteDropdownItemSelect = createEvent(this, "calciteDropdownItemSelect", 7);
  17179. this.calciteDropdownItemKeyEvent = createEvent(this, "calciteDropdownItemKeyEvent", 7);
  17180. this.calciteDropdownCloseRequest = createEvent(this, "calciteDropdownCloseRequest", 7);
  17181. //--------------------------------------------------------------------------
  17182. //
  17183. // Public Properties
  17184. //
  17185. //--------------------------------------------------------------------------
  17186. /** Indicates whether the item is active. */
  17187. this.active = false;
  17188. }
  17189. //--------------------------------------------------------------------------
  17190. //
  17191. // Public Methods
  17192. //
  17193. //--------------------------------------------------------------------------
  17194. /** Sets focus on the component. */
  17195. async setFocus() {
  17196. this.el.focus();
  17197. }
  17198. //--------------------------------------------------------------------------
  17199. //
  17200. // Lifecycle
  17201. //
  17202. //--------------------------------------------------------------------------
  17203. componentWillLoad() {
  17204. this.initialize();
  17205. }
  17206. connectedCallback() {
  17207. this.initialize();
  17208. }
  17209. render() {
  17210. const scale = getElementProp(this.el, "scale", "m");
  17211. const iconStartEl = (hAsync("calcite-icon", { class: "dropdown-item-icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
  17212. const contentNode = (hAsync("span", { class: "dropdown-item-content" }, hAsync("slot", null)));
  17213. const iconEndEl = (hAsync("calcite-icon", { class: "dropdown-item-icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
  17214. const slottedContent = this.iconStart && this.iconEnd
  17215. ? [iconStartEl, contentNode, iconEndEl]
  17216. : this.iconStart
  17217. ? [iconStartEl, hAsync("slot", null)]
  17218. : this.iconEnd
  17219. ? [contentNode, iconEndEl]
  17220. : contentNode;
  17221. const contentEl = !this.href ? (slottedContent) : (hAsync("a", { "aria-label": this.label, class: "dropdown-link", href: this.href, ref: (el) => (this.childLink = el), rel: this.rel, target: this.target }, slottedContent));
  17222. const itemRole = this.href
  17223. ? null
  17224. : this.selectionMode === "single"
  17225. ? "menuitemradio"
  17226. : this.selectionMode === "multi"
  17227. ? "menuitemcheckbox"
  17228. : "menuitem";
  17229. const itemAria = this.selectionMode !== "none" ? toAriaBoolean(this.active) : null;
  17230. return (hAsync(Host, { "aria-checked": itemAria, role: itemRole, tabindex: "0" }, hAsync("div", { class: {
  17231. container: true,
  17232. [CSS$z.containerLink]: !!this.href,
  17233. [CSS$z.containerSmall]: scale === "s",
  17234. [CSS$z.containerMedium]: scale === "m",
  17235. [CSS$z.containerLarge]: scale === "l",
  17236. [CSS$z.containerMulti]: this.selectionMode === "multi",
  17237. [CSS$z.containerSingle]: this.selectionMode === "single",
  17238. [CSS$z.containerNone]: this.selectionMode === "none"
  17239. } }, this.selectionMode !== "none" ? (hAsync("calcite-icon", { class: "dropdown-item-icon", icon: this.selectionMode === "multi" ? "check" : "bullet-point", scale: "s" })) : null, contentEl)));
  17240. }
  17241. //--------------------------------------------------------------------------
  17242. //
  17243. // Event Listeners
  17244. //
  17245. //--------------------------------------------------------------------------
  17246. onClick() {
  17247. this.emitRequestedItem();
  17248. }
  17249. keyDownHandler(e) {
  17250. switch (e.key) {
  17251. case " ":
  17252. this.emitRequestedItem();
  17253. if (this.href) {
  17254. e.preventDefault();
  17255. this.childLink.click();
  17256. }
  17257. break;
  17258. case "Enter":
  17259. this.emitRequestedItem();
  17260. if (this.href) {
  17261. this.childLink.click();
  17262. }
  17263. break;
  17264. case "Escape":
  17265. this.calciteDropdownCloseRequest.emit();
  17266. break;
  17267. case "Tab":
  17268. case "ArrowUp":
  17269. case "ArrowDown":
  17270. case "Home":
  17271. case "End":
  17272. this.calciteDropdownItemKeyEvent.emit({ keyboardEvent: e });
  17273. break;
  17274. }
  17275. e.preventDefault();
  17276. }
  17277. updateActiveItemOnChange(event) {
  17278. const parentEmittedChange = event.composedPath().includes(this.parentDropdownGroupEl);
  17279. if (parentEmittedChange) {
  17280. this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
  17281. this.requestedDropdownItem = event.detail.requestedDropdownItem;
  17282. this.determineActiveItem();
  17283. }
  17284. }
  17285. //--------------------------------------------------------------------------
  17286. //
  17287. // Private Methods
  17288. //
  17289. //--------------------------------------------------------------------------
  17290. initialize() {
  17291. this.selectionMode = getElementProp(this.el, "selection-mode", "single");
  17292. this.parentDropdownGroupEl = this.el.closest("calcite-dropdown-group");
  17293. if (this.selectionMode === "none") {
  17294. this.active = false;
  17295. }
  17296. }
  17297. determineActiveItem() {
  17298. switch (this.selectionMode) {
  17299. case "multi":
  17300. if (this.el === this.requestedDropdownItem) {
  17301. this.active = !this.active;
  17302. }
  17303. break;
  17304. case "single":
  17305. if (this.el === this.requestedDropdownItem) {
  17306. this.active = true;
  17307. }
  17308. else if (this.requestedDropdownGroup === this.parentDropdownGroupEl) {
  17309. this.active = false;
  17310. }
  17311. break;
  17312. case "none":
  17313. this.active = false;
  17314. break;
  17315. }
  17316. }
  17317. emitRequestedItem() {
  17318. this.calciteDropdownItemSelect.emit({
  17319. requestedDropdownItem: this.el,
  17320. requestedDropdownGroup: this.parentDropdownGroupEl
  17321. });
  17322. }
  17323. get el() { return getElement(this); }
  17324. static get style() { return dropdownItemCss; }
  17325. static get cmpMeta() { return {
  17326. "$flags$": 9,
  17327. "$tagName$": "calcite-dropdown-item",
  17328. "$members$": {
  17329. "active": [1540],
  17330. "iconFlipRtl": [513, "icon-flip-rtl"],
  17331. "iconStart": [513, "icon-start"],
  17332. "iconEnd": [513, "icon-end"],
  17333. "href": [513],
  17334. "label": [1],
  17335. "rel": [1],
  17336. "target": [1],
  17337. "setFocus": [64]
  17338. },
  17339. "$listeners$": [[0, "click", "onClick"], [0, "keydown", "keyDownHandler"], [16, "calciteDropdownItemChange", "updateActiveItemOnChange"]],
  17340. "$lazyBundleId$": "-",
  17341. "$attrsToReflect$": [["active", "active"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["iconEnd", "icon-end"], ["href", "href"]]
  17342. }; }
  17343. }
  17344. const CSS$y = {
  17345. button: "button"
  17346. };
  17347. const ICONS$9 = {
  17348. plus: "plus"
  17349. };
  17350. const fabCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-fab:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-fab{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-fab{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-fab{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-fab{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-fab{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-fab:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-fab-h{display:none}/*!@:host*/.sc-calcite-fab-h{display:-ms-flexbox;display:flex;background-color:transparent}/*!@:host([disabled])*/[disabled].sc-calcite-fab-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-fab-h[disabled] .sc-calcite-fab-s>[calcite-hydrated][disabled],[disabled].sc-calcite-fab-h [calcite-hydrated][disabled].sc-calcite-fab{opacity:1}/*!@calcite-button*/calcite-button.sc-calcite-fab{--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@calcite-button:hover*/calcite-button.sc-calcite-fab:hover{--tw-shadow:0 12px 32px -2px rgba(0, 0, 0, 0.1), 0 4px 20px 0 rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 12px 32px -2px var(--tw-shadow-color), 0 4px 20px 0 var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@calcite-button:active*/calcite-button.sc-calcite-fab:active{--tw-shadow:0 2px 12px -4px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.16);--tw-shadow-colored:0 2px 12px -4px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";
  17351. class Fab {
  17352. constructor(hostRef) {
  17353. registerInstance(this, hostRef);
  17354. // --------------------------------------------------------------------------
  17355. //
  17356. // Properties
  17357. //
  17358. // --------------------------------------------------------------------------
  17359. /**
  17360. * Used to set the button's appearance. Default is outline.
  17361. */
  17362. this.appearance = "outline";
  17363. /**
  17364. * Used to set the button's color. Default is light.
  17365. */
  17366. this.color = "neutral";
  17367. /**
  17368. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  17369. */
  17370. this.disabled = false;
  17371. /**
  17372. * The name of the icon to display. The value of this property must match the icon name from https://esri.github.io/calcite-ui-icons/.
  17373. * @default "plus"
  17374. */
  17375. this.icon = ICONS$9.plus;
  17376. /**
  17377. * When true, content is waiting to be loaded. This state shows a busy indicator.
  17378. */
  17379. this.loading = false;
  17380. /**
  17381. * Specifies the size of the fab.
  17382. */
  17383. this.scale = "m";
  17384. /**
  17385. * Indicates whether the text is displayed.
  17386. */
  17387. this.textEnabled = false;
  17388. }
  17389. //--------------------------------------------------------------------------
  17390. //
  17391. // Lifecycle
  17392. //
  17393. //--------------------------------------------------------------------------
  17394. componentDidRender() {
  17395. updateHostInteraction(this);
  17396. }
  17397. // --------------------------------------------------------------------------
  17398. //
  17399. // Methods
  17400. //
  17401. // --------------------------------------------------------------------------
  17402. /** Sets focus on the component. */
  17403. async setFocus() {
  17404. focusElement(this.buttonEl);
  17405. }
  17406. // --------------------------------------------------------------------------
  17407. //
  17408. // Render Methods
  17409. //
  17410. // --------------------------------------------------------------------------
  17411. render() {
  17412. const { appearance, color, disabled, loading, scale, textEnabled, icon, label, text } = this;
  17413. const title = !textEnabled ? label || text || null : null;
  17414. return (hAsync("calcite-button", { appearance: appearance === "solid" ? "solid" : "outline", class: CSS$y.button, color: color, disabled: disabled, iconStart: icon, label: label, loading: loading, ref: (buttonEl) => {
  17415. this.buttonEl = buttonEl;
  17416. }, round: true, scale: scale, title: title, type: "button", width: "auto" }, this.textEnabled ? this.text : null));
  17417. }
  17418. get el() { return getElement(this); }
  17419. static get style() { return fabCss; }
  17420. static get cmpMeta() { return {
  17421. "$flags$": 9,
  17422. "$tagName$": "calcite-fab",
  17423. "$members$": {
  17424. "appearance": [513],
  17425. "color": [513],
  17426. "disabled": [516],
  17427. "icon": [1],
  17428. "label": [1],
  17429. "loading": [516],
  17430. "scale": [513],
  17431. "text": [1],
  17432. "textEnabled": [516, "text-enabled"],
  17433. "setFocus": [64]
  17434. },
  17435. "$listeners$": undefined,
  17436. "$lazyBundleId$": "-",
  17437. "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["loading", "loading"], ["scale", "scale"], ["textEnabled", "text-enabled"]]
  17438. }; }
  17439. }
  17440. const CSS$x = {
  17441. container: "container",
  17442. searchIcon: "search-icon"
  17443. };
  17444. const TEXT$e = {
  17445. filterLabel: "Filter",
  17446. clear: "Clear filter"
  17447. };
  17448. const ICONS$8 = {
  17449. search: "search",
  17450. close: "x"
  17451. };
  17452. const DEBOUNCE_TIMEOUT = 250;
  17453. const filterCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-filter:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-filter{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-filter{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-filter{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-filter{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-filter{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-filter-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-filter-h *.sc-calcite-filter{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-filter:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-filter-h{display:none}/*!@:host*/.sc-calcite-filter-h{display:-ms-flexbox;display:flex;width:100%}/*!@:host([disabled])*/[disabled].sc-calcite-filter-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-filter-h[disabled] .sc-calcite-filter-s>[calcite-hydrated][disabled],[disabled].sc-calcite-filter-h [calcite-hydrated][disabled].sc-calcite-filter{opacity:1}/*!@.container*/.container.sc-calcite-filter{display:-ms-flexbox;display:flex;width:100%;padding:0.5rem}/*!@label*/label.sc-calcite-filter{position:relative;margin-left:0.25rem;margin-right:0.25rem;margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;width:100%;-ms-flex-align:center;align-items:center;overflow:hidden}/*!@input[type=text]*/input[type=text].sc-calcite-filter{margin-bottom:0.25rem;width:100%;border-style:none;background-color:transparent;padding-top:0.25rem;padding-bottom:0.25rem;padding-right:0.25rem;padding-left:1.5rem;font-family:inherit;font-size:var(--calcite-font-size--2);line-height:1rem;color:var(--calcite-ui-text-1);-webkit-transition:padding var(--calcite-animation-timing), -webkit-box-shadow var(--calcite-animation-timing);transition:padding var(--calcite-animation-timing), -webkit-box-shadow var(--calcite-animation-timing);transition:padding var(--calcite-animation-timing), box-shadow var(--calcite-animation-timing);transition:padding var(--calcite-animation-timing), box-shadow var(--calcite-animation-timing), -webkit-box-shadow var(--calcite-animation-timing)}/*!@input[type=text]::-ms-clear*/input[type=text].sc-calcite-filter::-ms-clear{display:none}/*!@calcite-input*/calcite-input.sc-calcite-filter{width:100%}/*!@.search-icon*/.search-icon.sc-calcite-filter{position:absolute;display:-ms-flexbox;display:flex;color:var(--calcite-ui-text-2);inset-inline-start:0;-webkit-transition:left var(--calcite-animation-timing), right var(--calcite-animation-timing), opacity var(--calcite-animation-timing);transition:left var(--calcite-animation-timing), right var(--calcite-animation-timing), opacity var(--calcite-animation-timing)}/*!@input[type=text]:focus*/input[type=text].sc-calcite-filter:focus{border-color:var(--calcite-ui-brand);outline:2px solid transparent;outline-offset:2px;padding-inline:0.25rem}/*!@input[type=text]:focus ~ .search-icon*/input[type=text].sc-calcite-filter:focus~.search-icon.sc-calcite-filter{inset-inline-start:calc(1rem * -1);opacity:0}/*!@.clear-button*/.clear-button.sc-calcite-filter{display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;border-width:0px;background-color:transparent;color:var(--calcite-ui-text-2)}/*!@.clear-button:hover, .clear-button:focus*/.clear-button.sc-calcite-filter:hover,.clear-button.sc-calcite-filter:focus{color:var(--calcite-ui-text-1)}";
  17454. class Filter {
  17455. constructor(hostRef) {
  17456. registerInstance(this, hostRef);
  17457. this.calciteFilterChange = createEvent(this, "calciteFilterChange", 7);
  17458. // --------------------------------------------------------------------------
  17459. //
  17460. // Properties
  17461. //
  17462. // --------------------------------------------------------------------------
  17463. /**
  17464. * The items to filter through. The filter uses this as the starting point, and returns items
  17465. * that contain the string entered in the input, using a partial match and recursive search.
  17466. *
  17467. * This property is required.
  17468. */
  17469. this.items = [];
  17470. /**
  17471. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  17472. */
  17473. this.disabled = false;
  17474. /**
  17475. * The resulting items after filtering.
  17476. *
  17477. * @readonly
  17478. */
  17479. this.filteredItems = [];
  17480. /** specify the scale of filter, defaults to m */
  17481. this.scale = "m";
  17482. /**
  17483. * Filter value.
  17484. */
  17485. this.value = "";
  17486. // --------------------------------------------------------------------------
  17487. //
  17488. // Private Methods
  17489. //
  17490. // --------------------------------------------------------------------------
  17491. this.filter = debounce$1((value, emit = false) => {
  17492. const regex = new RegExp(value, "i");
  17493. if (this.items.length === 0) {
  17494. this.updateFiltered([], emit);
  17495. return;
  17496. }
  17497. const find = (input, RE) => {
  17498. let found = false;
  17499. forIn(input, (val) => {
  17500. if (typeof val === "function" || val == null /* intentional == to catch undefined */) {
  17501. return;
  17502. }
  17503. if (Array.isArray(val) || (typeof val === "object" && val !== null)) {
  17504. if (find(val, RE)) {
  17505. found = true;
  17506. }
  17507. }
  17508. else if (RE.test(val)) {
  17509. found = true;
  17510. }
  17511. });
  17512. return found;
  17513. };
  17514. const result = this.items.filter((item) => {
  17515. return find(item, regex);
  17516. });
  17517. this.updateFiltered(result, emit);
  17518. }, DEBOUNCE_TIMEOUT);
  17519. this.inputHandler = (event) => {
  17520. const target = event.target;
  17521. this.value = target.value;
  17522. this.filter(target.value, true);
  17523. };
  17524. this.keyDownHandler = (event) => {
  17525. if (event.key === "Escape") {
  17526. this.clear();
  17527. }
  17528. if (event.key === "Enter") {
  17529. event.preventDefault();
  17530. }
  17531. };
  17532. this.clear = () => {
  17533. this.value = "";
  17534. this.filter("", true);
  17535. this.setFocus();
  17536. };
  17537. }
  17538. watchItemsHandler() {
  17539. this.filter(this.value);
  17540. }
  17541. valueHandler(value) {
  17542. this.filter(value);
  17543. }
  17544. //--------------------------------------------------------------------------
  17545. //
  17546. // Lifecycle
  17547. //
  17548. //--------------------------------------------------------------------------
  17549. componentDidRender() {
  17550. updateHostInteraction(this);
  17551. }
  17552. //--------------------------------------------------------------------------
  17553. //
  17554. // Lifecycle
  17555. //
  17556. //--------------------------------------------------------------------------
  17557. componentWillLoad() {
  17558. this.filter(this.value);
  17559. }
  17560. // --------------------------------------------------------------------------
  17561. //
  17562. // Public Methods
  17563. //
  17564. // --------------------------------------------------------------------------
  17565. /** Sets focus on the component. */
  17566. async setFocus() {
  17567. focusElement(this.textInput);
  17568. }
  17569. updateFiltered(filtered, emit = false) {
  17570. this.filteredItems.length = 0;
  17571. this.filteredItems = this.filteredItems.concat(filtered);
  17572. if (emit) {
  17573. this.calciteFilterChange.emit();
  17574. }
  17575. }
  17576. // --------------------------------------------------------------------------
  17577. //
  17578. // Render Methods
  17579. //
  17580. // --------------------------------------------------------------------------
  17581. render() {
  17582. const { disabled, scale } = this;
  17583. return (hAsync(Fragment, null, hAsync("div", { class: CSS$x.container }, hAsync("label", null, hAsync("calcite-input", { "aria-label": this.intlLabel || TEXT$e.filterLabel, clearable: true, disabled: disabled, icon: ICONS$8.search, intlClear: this.intlClear || TEXT$e.clear, onCalciteInputInput: this.inputHandler, onKeyDown: this.keyDownHandler, placeholder: this.placeholder, ref: (el) => {
  17584. this.textInput = el;
  17585. }, scale: scale, type: "text", value: this.value })))));
  17586. }
  17587. get el() { return getElement(this); }
  17588. static get watchers() { return {
  17589. "items": ["watchItemsHandler"],
  17590. "value": ["valueHandler"]
  17591. }; }
  17592. static get style() { return filterCss; }
  17593. static get cmpMeta() { return {
  17594. "$flags$": 9,
  17595. "$tagName$": "calcite-filter",
  17596. "$members$": {
  17597. "items": [1040],
  17598. "disabled": [516],
  17599. "filteredItems": [1040],
  17600. "intlClear": [1, "intl-clear"],
  17601. "intlLabel": [1, "intl-label"],
  17602. "placeholder": [1],
  17603. "scale": [513],
  17604. "value": [1025],
  17605. "setFocus": [64]
  17606. },
  17607. "$listeners$": undefined,
  17608. "$lazyBundleId$": "-",
  17609. "$attrsToReflect$": [["disabled", "disabled"], ["scale", "scale"]]
  17610. }; }
  17611. }
  17612. const CSS$w = {
  17613. frame: "frame",
  17614. frameAdvancing: "frame--advancing",
  17615. frameRetreating: "frame--retreating"
  17616. };
  17617. const flowCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-flow:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-flow{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-flow{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-flow{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-flow{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-flow{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-flow-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-flow-h *.sc-calcite-flow{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-flow:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-flow-h{display:none}/*!@:host*/.sc-calcite-flow-h{position:relative;display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:stretch;align-items:stretch;overflow:hidden;background-color:transparent}/*!@:host .frame*/.sc-calcite-flow-h .frame.sc-calcite-flow{position:relative;margin:0px;display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;padding:0px}/*!@:host ::slotted(calcite-panel)*/.sc-calcite-flow-h .sc-calcite-flow-s>calcite-panel{height:100%}/*!@:host ::slotted(.calcite-match-height:last-child)*/.sc-calcite-flow-h .sc-calcite-flow-s>.calcite-match-height:last-child{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden}/*!@:host .frame--advancing*/.sc-calcite-flow-h .frame--advancing.sc-calcite-flow{-webkit-animation:calcite-frame-advance var(--calcite-animation-timing);animation:calcite-frame-advance var(--calcite-animation-timing)}/*!@:host .frame--retreating*/.sc-calcite-flow-h .frame--retreating.sc-calcite-flow{-webkit-animation:calcite-frame-retreat var(--calcite-animation-timing);animation:calcite-frame-retreat var(--calcite-animation-timing)}@-webkit-keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;-webkit-transform:translate3d(50px, 0, 0);transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;-webkit-transform:translate3d(50px, 0, 0);transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}}@-webkit-keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;-webkit-transform:translate3d(-50px, 0, 0);transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;-webkit-transform:translate3d(-50px, 0, 0);transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}}";
  17618. /**
  17619. * @slot - A slot for adding `calcite-panel`s to the flow.
  17620. */
  17621. class Flow {
  17622. constructor(hostRef) {
  17623. registerInstance(this, hostRef);
  17624. this.panelCount = 0;
  17625. this.flowDirection = null;
  17626. this.panels = [];
  17627. this.getFlowDirection = (oldPanelCount, newPanelCount) => {
  17628. const allowRetreatingDirection = oldPanelCount > 1;
  17629. const allowAdvancingDirection = oldPanelCount && newPanelCount > 1;
  17630. if (!allowAdvancingDirection && !allowRetreatingDirection) {
  17631. return null;
  17632. }
  17633. return newPanelCount < oldPanelCount ? "retreating" : "advancing";
  17634. };
  17635. this.updateFlowProps = () => {
  17636. const { panels } = this;
  17637. const newPanels = Array.from(this.el.querySelectorAll("calcite-panel"));
  17638. const oldPanelCount = panels.length;
  17639. const newPanelCount = newPanels.length;
  17640. const activePanel = newPanels[newPanelCount - 1];
  17641. const previousPanel = newPanels[newPanelCount - 2];
  17642. if (newPanelCount && activePanel) {
  17643. newPanels.forEach((panelNode) => {
  17644. panelNode.showBackButton = newPanelCount > 1;
  17645. panelNode.hidden = panelNode !== activePanel;
  17646. });
  17647. }
  17648. if (previousPanel) {
  17649. previousPanel.menuOpen = false;
  17650. }
  17651. this.panels = newPanels;
  17652. if (oldPanelCount !== newPanelCount) {
  17653. const flowDirection = this.getFlowDirection(oldPanelCount, newPanelCount);
  17654. this.panelCount = newPanelCount;
  17655. this.flowDirection = flowDirection;
  17656. }
  17657. };
  17658. this.panelItemMutationObserver = createObserver();
  17659. }
  17660. // --------------------------------------------------------------------------
  17661. //
  17662. // Public Methods
  17663. //
  17664. // --------------------------------------------------------------------------
  17665. /**
  17666. * Removes the currently active `calcite-panel`.
  17667. */
  17668. async back() {
  17669. const lastItem = this.el.querySelector("calcite-panel:last-child");
  17670. if (!lastItem) {
  17671. return;
  17672. }
  17673. const beforeBack = lastItem.beforeBack
  17674. ? lastItem.beforeBack
  17675. : () => Promise.resolve();
  17676. return beforeBack.call(lastItem).then(() => {
  17677. lastItem.remove();
  17678. return lastItem;
  17679. });
  17680. }
  17681. // --------------------------------------------------------------------------
  17682. //
  17683. // Lifecycle
  17684. //
  17685. // --------------------------------------------------------------------------
  17686. connectedCallback() {
  17687. var _a;
  17688. (_a = this.panelItemMutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  17689. this.updateFlowProps();
  17690. }
  17691. disconnectedCallback() {
  17692. var _a;
  17693. (_a = this.panelItemMutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  17694. }
  17695. // --------------------------------------------------------------------------
  17696. //
  17697. // Private Methods
  17698. //
  17699. // --------------------------------------------------------------------------
  17700. handleCalcitePanelBackClick() {
  17701. this.back();
  17702. }
  17703. // --------------------------------------------------------------------------
  17704. //
  17705. // Render Methods
  17706. //
  17707. // --------------------------------------------------------------------------
  17708. render() {
  17709. const { flowDirection, panelCount } = this;
  17710. const frameDirectionClasses = {
  17711. [CSS$w.frame]: true,
  17712. [CSS$w.frameAdvancing]: flowDirection === "advancing",
  17713. [CSS$w.frameRetreating]: flowDirection === "retreating"
  17714. };
  17715. return (hAsync("div", { class: frameDirectionClasses, key: panelCount }, hAsync("slot", null)));
  17716. }
  17717. get el() { return getElement(this); }
  17718. static get style() { return flowCss; }
  17719. static get cmpMeta() { return {
  17720. "$flags$": 9,
  17721. "$tagName$": "calcite-flow",
  17722. "$members$": {
  17723. "panelCount": [32],
  17724. "flowDirection": [32],
  17725. "panels": [32],
  17726. "back": [64]
  17727. },
  17728. "$listeners$": [[0, "calcitePanelBackClick", "handleCalcitePanelBackClick"]],
  17729. "$lazyBundleId$": "-",
  17730. "$attrsToReflect$": []
  17731. }; }
  17732. }
  17733. /**
  17734. * Calculate slope of the tangents
  17735. * uses Steffen interpolation as it's monotonic
  17736. * http://jrwalsh1.github.io/posts/interpolations/
  17737. */
  17738. function slope(p0, p1, p2) {
  17739. const dx = p1[0] - p0[0];
  17740. const dx1 = p2[0] - p1[0];
  17741. const dy = p1[1] - p0[1];
  17742. const dy1 = p2[1] - p1[1];
  17743. const m = dy / (dx || (dx1 < 0 && 0));
  17744. const m1 = dy1 / (dx1 || (dx < 0 && 0));
  17745. const p = (m * dx1 + m1 * dx) / (dx + dx1);
  17746. return (Math.sign(m) + Math.sign(m1)) * Math.min(Math.abs(m), Math.abs(m1), 0.5 * Math.abs(p)) || 0;
  17747. }
  17748. /**
  17749. * Calculate slope for just one tangent (single-sided)
  17750. */
  17751. function slopeSingle(p0, p1, m) {
  17752. const dx = p1[0] - p0[0];
  17753. const dy = p1[1] - p0[1];
  17754. return dx ? ((3 * dy) / dx - m) / 2 : m;
  17755. }
  17756. /**
  17757. * Given two points and their tangent slopes,
  17758. * calculate the bezier handle coordinates and return draw command.
  17759. *
  17760. * Translates Hermite Spline to Beziér curve:
  17761. * stackoverflow.com/questions/42574940/
  17762. */
  17763. function bezier(p0, p1, m0, m1, t) {
  17764. const [x0, y0] = p0;
  17765. const [x1, y1] = p1;
  17766. const dx = (x1 - x0) / 3;
  17767. const h1 = t([x0 + dx, y0 + dx * m0]).join(",");
  17768. const h2 = t([x1 - dx, y1 - dx * m1]).join(",");
  17769. const p = t([x1, y1]).join(",");
  17770. return `C ${h1} ${h2} ${p}`;
  17771. }
  17772. /**
  17773. * Generate a function which will translate a point
  17774. * from the data coordinate space to svg viewbox oriented pixels
  17775. */
  17776. function translate({ width, height, min, max }) {
  17777. const rangeX = max[0] - min[0];
  17778. const rangeY = max[1] - min[1];
  17779. return (point) => {
  17780. const x = ((point[0] - min[0]) / rangeX) * width;
  17781. const y = height - (point[1] / rangeY) * height;
  17782. return [x, y];
  17783. };
  17784. }
  17785. /**
  17786. * Get the min and max values from the dataset
  17787. */
  17788. function range(data) {
  17789. const [startX, startY] = data[0];
  17790. const min = [startX, startY];
  17791. const max = [startX, startY];
  17792. return data.reduce(({ min, max }, [x, y]) => ({
  17793. min: [Math.min(min[0], x), Math.min(min[1], y)],
  17794. max: [Math.max(max[0], x), Math.max(max[1], y)]
  17795. }), { min, max });
  17796. }
  17797. /**
  17798. * Generate drawing commands for an area graph
  17799. * returns a string can can be passed directly to a path element's `d` attribute
  17800. */
  17801. function area({ data, min, max, t }) {
  17802. if (data.length === 0) {
  17803. return "";
  17804. }
  17805. // important points for beginning and ending the path
  17806. const [startX, startY] = t(data[0]);
  17807. const [minX, minY] = t(min);
  17808. const [maxX] = t(max);
  17809. // keep track of previous slope/points
  17810. let m;
  17811. let p0;
  17812. let p1;
  17813. // iterate over data points, calculating command for each
  17814. const commands = data.reduce((acc, point, i) => {
  17815. p0 = data[i - 2];
  17816. p1 = data[i - 1];
  17817. if (i > 1) {
  17818. const m1 = slope(p0, p1, point);
  17819. const m0 = m === undefined ? slopeSingle(p0, p1, m1) : m;
  17820. const command = bezier(p0, p1, m0, m1, t);
  17821. m = m1;
  17822. return `${acc} ${command}`;
  17823. }
  17824. return acc;
  17825. }, `M ${minX},${minY} L ${minX},${startY} L ${startX},${startY}`);
  17826. // close the path
  17827. const last = data[data.length - 1];
  17828. const end = bezier(p1, last, m, slopeSingle(p1, last, m), t);
  17829. return `${commands} ${end} L ${maxX},${minY} Z`;
  17830. }
  17831. const graphCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-graph:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-graph{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-graph{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-graph{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-graph{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-graph{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-graph:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-graph-h{display:none}/*!@:host*/.sc-calcite-graph-h{display:block}/*!@.svg*/.svg.sc-calcite-graph{fill:currentColor;stroke:transparent;margin:0px;display:block;height:100%;width:100%;padding:0px}/*!@.svg .graph-path--highlight*/.svg.sc-calcite-graph .graph-path--highlight.sc-calcite-graph{fill:var(--calcite-ui-brand);opacity:0.5}";
  17832. class Graph {
  17833. constructor(hostRef) {
  17834. registerInstance(this, hostRef);
  17835. //--------------------------------------------------------------------------
  17836. //
  17837. // Properties
  17838. //
  17839. //--------------------------------------------------------------------------
  17840. /**
  17841. * Array of tuples describing a single data point ([x, y])
  17842. * These data points should be sorted by x-axis value
  17843. */
  17844. this.data = [];
  17845. //--------------------------------------------------------------------------
  17846. //
  17847. // Private State/Props
  17848. //
  17849. //--------------------------------------------------------------------------
  17850. this.graphId = `calcite-graph-${guid()}`;
  17851. this.resizeObserver = createObserver();
  17852. }
  17853. //--------------------------------------------------------------------------
  17854. //
  17855. // Lifecycle
  17856. //
  17857. //--------------------------------------------------------------------------
  17858. connectedCallback() {
  17859. var _a;
  17860. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el);
  17861. }
  17862. disconnectedCallback() {
  17863. var _a;
  17864. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  17865. }
  17866. render() {
  17867. const { data, colorStops, el, highlightMax, highlightMin, min, max } = this;
  17868. const id = this.graphId;
  17869. const { clientHeight: height, clientWidth: width } = el;
  17870. // if we have no data, return empty svg
  17871. if (!data || data.length === 0) {
  17872. return (hAsync("svg", { class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }));
  17873. }
  17874. const { min: rangeMin, max: rangeMax } = range(data);
  17875. let currentMin = rangeMin;
  17876. let currentMax = rangeMax;
  17877. if (min < rangeMin[0] || min > rangeMin[0]) {
  17878. currentMin = [min, 0];
  17879. }
  17880. if (max > rangeMax[0] || max < rangeMax[0]) {
  17881. currentMax = [max, rangeMax[1]];
  17882. }
  17883. const t = translate({ min: currentMin, max: currentMax, width, height });
  17884. const [hMinX] = t([highlightMin, currentMax[1]]);
  17885. const [hMaxX] = t([highlightMax, currentMax[1]]);
  17886. const areaPath = area({ data, min: rangeMin, max: rangeMax, t });
  17887. const fill = colorStops ? `url(#linear-gradient-${id})` : undefined;
  17888. return (hAsync("svg", { class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }, colorStops ? (hAsync("defs", null, hAsync("linearGradient", { id: `linear-gradient-${id}`, x1: "0", x2: "1", y1: "0", y2: "0" }, colorStops.map(({ offset, color, opacity }) => (hAsync("stop", { offset: `${offset * 100}%`, "stop-color": color, "stop-opacity": opacity })))))) : null, highlightMin !== undefined ? ([
  17889. hAsync("mask", { height: "100%", id: `${id}1`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
  17890. M 0,0
  17891. L ${hMinX - 1},0
  17892. L ${hMinX - 1},${height}
  17893. L 0,${height}
  17894. Z
  17895. `, fill: "white" })),
  17896. hAsync("mask", { height: "100%", id: `${id}2`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
  17897. M ${hMinX + 1},0
  17898. L ${hMaxX - 1},0
  17899. L ${hMaxX - 1},${height}
  17900. L ${hMinX + 1}, ${height}
  17901. Z
  17902. `, fill: "white" })),
  17903. hAsync("mask", { height: "100%", id: `${id}3`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
  17904. M ${hMaxX + 1},0
  17905. L ${width},0
  17906. L ${width},${height}
  17907. L ${hMaxX + 1}, ${height}
  17908. Z
  17909. `, fill: "white" })),
  17910. hAsync("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}1)` }),
  17911. hAsync("path", { class: "graph-path--highlight", d: areaPath, fill: fill, mask: `url(#${id}2)` }),
  17912. hAsync("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}3)` })
  17913. ]) : (hAsync("path", { class: "graph-path", d: areaPath, fill: fill }))));
  17914. }
  17915. get el() { return getElement(this); }
  17916. static get style() { return graphCss; }
  17917. static get cmpMeta() { return {
  17918. "$flags$": 9,
  17919. "$tagName$": "calcite-graph",
  17920. "$members$": {
  17921. "data": [16],
  17922. "colorStops": [16],
  17923. "highlightMin": [2, "highlight-min"],
  17924. "highlightMax": [2, "highlight-max"],
  17925. "min": [2],
  17926. "max": [2]
  17927. },
  17928. "$listeners$": undefined,
  17929. "$lazyBundleId$": "-",
  17930. "$attrsToReflect$": []
  17931. }; }
  17932. }
  17933. const CSS$v = {
  17934. handle: "handle",
  17935. handleActivated: "handle--activated"
  17936. };
  17937. const ICONS$7 = {
  17938. drag: "drag"
  17939. };
  17940. const handleCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-handle:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-handle{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-handle{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-handle{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-handle{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-handle{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-handle:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-handle-h{display:none}/*!@:host*/.sc-calcite-handle-h{display:-ms-flexbox;display:flex}/*!@.handle*/.handle.sc-calcite-handle{display:-ms-flexbox;display:flex;cursor:move;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-item-align:stretch;align-self:stretch;border-style:none;background-color:transparent;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;color:var(--calcite-ui-border-3);padding:0.75rem 0.25rem;line-height:0}/*!@.handle:hover*/.handle.sc-calcite-handle:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.handle:focus*/.handle.sc-calcite-handle:focus{color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.handle--activated*/.handle--activated.sc-calcite-handle{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}/*!@.handle calcite-icon*/.handle.sc-calcite-handle calcite-icon.sc-calcite-handle{color:inherit}";
  17941. class Handle {
  17942. constructor(hostRef) {
  17943. registerInstance(this, hostRef);
  17944. this.calciteHandleNudge = createEvent(this, "calciteHandleNudge", 7);
  17945. // --------------------------------------------------------------------------
  17946. //
  17947. // Properties
  17948. //
  17949. // --------------------------------------------------------------------------
  17950. /**
  17951. * @internal - stores the activated state of the drag handle.
  17952. */
  17953. this.activated = false;
  17954. /**
  17955. * Value for the button title attribute
  17956. */
  17957. this.textTitle = "handle";
  17958. // --------------------------------------------------------------------------
  17959. //
  17960. // Private Methods
  17961. //
  17962. // --------------------------------------------------------------------------
  17963. this.handleKeyDown = (event) => {
  17964. switch (event.key) {
  17965. case " ":
  17966. this.activated = !this.activated;
  17967. break;
  17968. case "ArrowUp":
  17969. case "ArrowDown":
  17970. if (!this.activated) {
  17971. return;
  17972. }
  17973. const direction = event.key.toLowerCase().replace("arrow", "");
  17974. this.calciteHandleNudge.emit({ handle: this.el, direction });
  17975. break;
  17976. }
  17977. };
  17978. this.handleBlur = () => {
  17979. this.activated = false;
  17980. };
  17981. }
  17982. // --------------------------------------------------------------------------
  17983. //
  17984. // Methods
  17985. //
  17986. // --------------------------------------------------------------------------
  17987. /** Sets focus on the component. */
  17988. async setFocus() {
  17989. this.handleButton.focus();
  17990. }
  17991. // --------------------------------------------------------------------------
  17992. //
  17993. // Render Methods
  17994. //
  17995. // --------------------------------------------------------------------------
  17996. render() {
  17997. return (
  17998. // Needs to be a span because of https://github.com/SortableJS/Sortable/issues/1486
  17999. hAsync("span", { "aria-pressed": toAriaBoolean(this.activated), class: { [CSS$v.handle]: true, [CSS$v.handleActivated]: this.activated }, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
  18000. this.handleButton = el;
  18001. }, role: "button", tabindex: "0", title: this.textTitle }, hAsync("calcite-icon", { icon: ICONS$7.drag, scale: "s" })));
  18002. }
  18003. get el() { return getElement(this); }
  18004. static get style() { return handleCss; }
  18005. static get cmpMeta() { return {
  18006. "$flags$": 9,
  18007. "$tagName$": "calcite-handle",
  18008. "$members$": {
  18009. "activated": [1540],
  18010. "textTitle": [513, "text-title"],
  18011. "setFocus": [64]
  18012. },
  18013. "$listeners$": undefined,
  18014. "$lazyBundleId$": "-",
  18015. "$attrsToReflect$": [["activated", "activated"], ["textTitle", "text-title"]]
  18016. }; }
  18017. }
  18018. const CSS$u = {
  18019. icon: "icon",
  18020. flipRtl: "flip-rtl"
  18021. };
  18022. const scaleToPx = {
  18023. s: 16,
  18024. m: 24,
  18025. l: 32
  18026. };
  18027. const iconCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-icon:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-icon{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-icon{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-icon{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-icon{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-icon{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-icon:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-icon-h{display:none}/*!@:host*/.sc-calcite-icon-h{display:-ms-inline-flexbox;display:inline-flex;color:var(--calcite-ui-icon-color)}/*!@:host([scale=s])*/[scale=s].sc-calcite-icon-h{height:1rem;width:1rem;min-width:1rem;min-height:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-icon-h{height:1.5rem;width:1.5rem;min-width:1.5rem;min-height:1.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-icon-h{height:2rem;width:2rem;min-width:2rem;min-height:2rem}/*!@.flip-rtl*/.flip-rtl.sc-calcite-icon{-webkit-transform:scaleX(-1);transform:scaleX(-1)}/*!@.svg*/.svg.sc-calcite-icon{display:block}";
  18028. class Icon {
  18029. constructor(hostRef) {
  18030. registerInstance(this, hostRef);
  18031. //--------------------------------------------------------------------------
  18032. //
  18033. // Properties
  18034. //
  18035. //--------------------------------------------------------------------------
  18036. /**
  18037. * The name of the icon to display. The value of this property must match the icon name from https://esri.github.io/calcite-ui-icons/.
  18038. */
  18039. this.icon = null;
  18040. /**
  18041. * When true, the icon will be flipped when the element direction is 'rtl'.
  18042. */
  18043. this.flipRtl = false;
  18044. /**
  18045. * Icon scale.
  18046. */
  18047. this.scale = "m";
  18048. this.visible = false;
  18049. }
  18050. //--------------------------------------------------------------------------
  18051. //
  18052. // Lifecycle
  18053. //
  18054. //--------------------------------------------------------------------------
  18055. connectedCallback() {
  18056. this.waitUntilVisible(() => {
  18057. this.visible = true;
  18058. this.loadIconPathData();
  18059. });
  18060. }
  18061. disconnectedCallback() {
  18062. var _a;
  18063. (_a = this.intersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  18064. this.intersectionObserver = null;
  18065. }
  18066. async componentWillLoad() {
  18067. this.loadIconPathData();
  18068. }
  18069. render() {
  18070. const { el, flipRtl, pathData, scale, textLabel } = this;
  18071. const dir = getElementDir(el);
  18072. const size = scaleToPx[scale];
  18073. const semantic = !!textLabel;
  18074. const paths = [].concat(pathData || "");
  18075. return (hAsync(Host, { "aria-hidden": toAriaBoolean(!semantic), "aria-label": semantic ? textLabel : null, role: semantic ? "img" : null }, hAsync("svg", { class: {
  18076. [CSS$u.flipRtl]: dir === "rtl" && flipRtl,
  18077. svg: true
  18078. }, fill: "currentColor", height: "100%", viewBox: `0 0 ${size} ${size}`, width: "100%", xmlns: "http://www.w3.org/2000/svg" }, paths.map((path) => typeof path === "string" ? (hAsync("path", { d: path })) : (hAsync("path", { d: path.d, opacity: "opacity" in path ? path.opacity : 1 }))))));
  18079. }
  18080. //--------------------------------------------------------------------------
  18081. //
  18082. // Private Methods
  18083. //
  18084. //--------------------------------------------------------------------------
  18085. async loadIconPathData() {
  18086. {
  18087. return;
  18088. }
  18089. }
  18090. waitUntilVisible(callback) {
  18091. this.intersectionObserver = createObserver();
  18092. if (!this.intersectionObserver) {
  18093. callback();
  18094. return;
  18095. }
  18096. this.intersectionObserver.observe(this.el);
  18097. }
  18098. static get assetsDirs() { return ["assets"]; }
  18099. get el() { return getElement(this); }
  18100. static get watchers() { return {
  18101. "icon": ["loadIconPathData"],
  18102. "scale": ["loadIconPathData"]
  18103. }; }
  18104. static get style() { return iconCss; }
  18105. static get cmpMeta() { return {
  18106. "$flags$": 9,
  18107. "$tagName$": "calcite-icon",
  18108. "$members$": {
  18109. "icon": [513],
  18110. "flipRtl": [516, "flip-rtl"],
  18111. "scale": [513],
  18112. "textLabel": [1, "text-label"],
  18113. "pathData": [32],
  18114. "visible": [32]
  18115. },
  18116. "$listeners$": undefined,
  18117. "$lazyBundleId$": "-",
  18118. "$attrsToReflect$": [["icon", "icon"], ["flipRtl", "flip-rtl"], ["scale", "scale"]]
  18119. }; }
  18120. }
  18121. const CSS$t = {
  18122. wrapper: "wrapper",
  18123. confirmChangesButton: "confirm-changes-button",
  18124. cancelEditingButton: "cancel-editing-button",
  18125. inputWrapper: "input-wrapper",
  18126. cancelEditingButtonWrapper: "cancel-editing-button-wrapper",
  18127. enableEditingButton: "enable-editing-button",
  18128. controlsWrapper: "controls-wrapper"
  18129. };
  18130. const TEXT$d = {
  18131. intlEnablingEditing: "Click to edit",
  18132. intlCancelEditing: "Cancel",
  18133. intlConfirmChanges: "Save"
  18134. };
  18135. const inlineEditableCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-inline-editable:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-inline-editable{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-inline-editable{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-inline-editable{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-inline-editable{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-inline-editable{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-inline-editable:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-inline-editable-h{display:none}/*!@:host*/.sc-calcite-inline-editable-h{display:block}/*!@:host([scale=s]) .controls-wrapper*/[scale=s].sc-calcite-inline-editable-h .controls-wrapper.sc-calcite-inline-editable{height:1.5rem}/*!@:host([scale=m]) .controls-wrapper*/[scale=m].sc-calcite-inline-editable-h .controls-wrapper.sc-calcite-inline-editable{height:2rem}/*!@:host([scale=l]) .controls-wrapper*/[scale=l].sc-calcite-inline-editable-h .controls-wrapper.sc-calcite-inline-editable{height:2.75rem}/*!@:host(:not([editing-enabled]):not([disabled])) .wrapper:hover*/.sc-calcite-inline-editable-h:not([editing-enabled]):not([disabled]) .wrapper.sc-calcite-inline-editable:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.wrapper*/.wrapper.sc-calcite-inline-editable{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;background-color:var(--calcite-ui-foreground-1);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@.wrapper .input-wrapper*/.wrapper.sc-calcite-inline-editable .input-wrapper.sc-calcite-inline-editable{-ms-flex:1 1 0%;flex:1 1 0%}/*!@.controls-wrapper*/.controls-wrapper.sc-calcite-inline-editable{display:-ms-flexbox;display:flex}/*!@:host([disabled])*/[disabled].sc-calcite-inline-editable-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) .cancel-editing-button-wrapper*/[disabled].sc-calcite-inline-editable-h .cancel-editing-button-wrapper.sc-calcite-inline-editable{border-color:var(--calcite-ui-border-2)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-inline-editable-h[disabled] .sc-calcite-inline-editable-s>[calcite-hydrated][disabled],[disabled].sc-calcite-inline-editable-h [calcite-hydrated][disabled].sc-calcite-inline-editable{opacity:1}";
  18136. /**
  18137. * @slot - A slot for adding a `calcite-input`.
  18138. */
  18139. class InlineEditable {
  18140. constructor(hostRef) {
  18141. registerInstance(this, hostRef);
  18142. this.calciteInlineEditableEditCancel = createEvent(this, "calciteInlineEditableEditCancel", 7);
  18143. this.calciteInlineEditableEditConfirm = createEvent(this, "calciteInlineEditableEditConfirm", 7);
  18144. this.calciteInlineEditableEnableEditingChange = createEvent(this, "calciteInlineEditableEnableEditingChange", 7);
  18145. //--------------------------------------------------------------------------
  18146. //
  18147. // Props
  18148. //
  18149. //--------------------------------------------------------------------------
  18150. /** specify whether editing can be enabled */
  18151. this.disabled = false;
  18152. /** specify whether the wrapped input element is editable, defaults to false */
  18153. this.editingEnabled = false;
  18154. /** specify whether the confirm button should display a loading state, defaults to false */
  18155. this.loading = false;
  18156. /** specify whether save/cancel controls should be displayed when editingEnabled is true, defaults to false */
  18157. this.controls = false;
  18158. /** specify text to be user for the enable editing button's aria-label, defaults to `Click to edit`
  18159. * @default "Click to edit"
  18160. */
  18161. this.intlEnableEditing = TEXT$d.intlEnablingEditing;
  18162. /** specify text to be user for the cancel editing button's aria-label, defaults to `Cancel`
  18163. * @default "Cancel"
  18164. */
  18165. this.intlCancelEditing = TEXT$d.intlCancelEditing;
  18166. /** specify text to be user for the confirm changes button's aria-label, defaults to `Save`
  18167. * @default "Save"
  18168. */
  18169. this.intlConfirmChanges = TEXT$d.intlConfirmChanges;
  18170. this.mutationObserver = createObserver();
  18171. this.enableEditing = () => {
  18172. var _a, _b;
  18173. this.valuePriorToEditing = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value;
  18174. this.editingEnabled = true;
  18175. (_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.setFocus();
  18176. this.calciteInlineEditableEnableEditingChange.emit();
  18177. };
  18178. this.disableEditing = () => {
  18179. this.editingEnabled = false;
  18180. };
  18181. this.cancelEditing = () => {
  18182. if (this.inputElement) {
  18183. this.inputElement.value = this.valuePriorToEditing;
  18184. }
  18185. this.disableEditing();
  18186. this.enableEditingButton.setFocus();
  18187. if (!this.editingEnabled && !!this.shouldEmitCancel) {
  18188. this.calciteInlineEditableEditCancel.emit();
  18189. }
  18190. };
  18191. this.escapeKeyHandler = async (e) => {
  18192. var _a;
  18193. if (e.key !== "Escape") {
  18194. if (e.key === "Tab" && this.shouldShowControls) {
  18195. if (!e.shiftKey && e.target === this.inputElement) {
  18196. e.preventDefault();
  18197. this.cancelEditingButton.setFocus();
  18198. }
  18199. if (!!e.shiftKey && e.target === this.cancelEditingButton) {
  18200. e.preventDefault();
  18201. (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setFocus();
  18202. }
  18203. }
  18204. return;
  18205. }
  18206. this.cancelEditing();
  18207. };
  18208. this.cancelEditingHandler = async (e) => {
  18209. e.preventDefault();
  18210. this.cancelEditing();
  18211. };
  18212. this.enableEditingHandler = async (e) => {
  18213. if (this.disabled ||
  18214. e.target === this.cancelEditingButton ||
  18215. e.target === this.confirmEditingButton) {
  18216. return;
  18217. }
  18218. e.preventDefault();
  18219. if (!this.editingEnabled) {
  18220. this.enableEditing();
  18221. }
  18222. };
  18223. this.confirmChangesHandler = async (e) => {
  18224. e.preventDefault();
  18225. this.calciteInlineEditableEditConfirm.emit();
  18226. try {
  18227. if (this.afterConfirm) {
  18228. this.loading = true;
  18229. await this.afterConfirm();
  18230. this.disableEditing();
  18231. this.enableEditingButton.setFocus();
  18232. }
  18233. }
  18234. catch (e) {
  18235. }
  18236. finally {
  18237. this.loading = false;
  18238. }
  18239. };
  18240. }
  18241. disabledWatcher(disabled) {
  18242. if (this.inputElement) {
  18243. this.inputElement.disabled = disabled;
  18244. }
  18245. }
  18246. editingEnabledWatcher(newValue, oldValue) {
  18247. if (this.inputElement) {
  18248. this.inputElement.editingEnabled = newValue;
  18249. }
  18250. if (!newValue && !!oldValue) {
  18251. this.shouldEmitCancel = true;
  18252. }
  18253. }
  18254. //--------------------------------------------------------------------------
  18255. //
  18256. // Lifecycle
  18257. //
  18258. //--------------------------------------------------------------------------
  18259. connectedCallback() {
  18260. var _a;
  18261. connectLabel(this);
  18262. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
  18263. this.mutationObserverCallback();
  18264. }
  18265. disconnectedCallback() {
  18266. var _a;
  18267. disconnectLabel(this);
  18268. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  18269. }
  18270. componentDidRender() {
  18271. updateHostInteraction(this);
  18272. }
  18273. render() {
  18274. return (hAsync("div", { class: CSS$t.wrapper, onClick: this.enableEditingHandler, onKeyDown: this.escapeKeyHandler }, hAsync("div", { class: CSS$t.inputWrapper }, hAsync("slot", null)), hAsync("div", { class: CSS$t.controlsWrapper }, hAsync("calcite-button", { appearance: "transparent", class: CSS$t.enableEditingButton, color: "neutral", disabled: this.disabled, iconStart: "pencil", label: this.intlEnableEditing, onClick: this.enableEditingHandler, ref: (el) => (this.enableEditingButton = el), scale: this.scale, style: {
  18275. opacity: this.editingEnabled ? "0" : "1",
  18276. width: this.editingEnabled ? "0" : "inherit"
  18277. }, type: "button" }), this.shouldShowControls && [
  18278. hAsync("div", { class: CSS$t.cancelEditingButtonWrapper }, hAsync("calcite-button", { appearance: "transparent", class: CSS$t.cancelEditingButton, color: "neutral", disabled: this.disabled, iconStart: "x", label: this.intlCancelEditing, onClick: this.cancelEditingHandler, ref: (el) => (this.cancelEditingButton = el), scale: this.scale, type: "button" })),
  18279. hAsync("calcite-button", { appearance: "solid", class: CSS$t.confirmChangesButton, color: "blue", disabled: this.disabled, iconStart: "check", label: this.intlConfirmChanges, loading: this.loading, onClick: this.confirmChangesHandler, ref: (el) => (this.confirmEditingButton = el), scale: this.scale, type: "button" })
  18280. ])));
  18281. }
  18282. //--------------------------------------------------------------------------
  18283. //
  18284. // Event Listeners
  18285. //
  18286. //--------------------------------------------------------------------------
  18287. blurHandler() {
  18288. if (!this.controls) {
  18289. this.disableEditing();
  18290. }
  18291. }
  18292. //--------------------------------------------------------------------------
  18293. //
  18294. // Public Methods
  18295. //
  18296. //--------------------------------------------------------------------------
  18297. async setFocus() {
  18298. var _a, _b;
  18299. if (this.editingEnabled) {
  18300. (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setFocus();
  18301. }
  18302. else {
  18303. (_b = this.enableEditingButton) === null || _b === void 0 ? void 0 : _b.setFocus();
  18304. }
  18305. }
  18306. //--------------------------------------------------------------------------
  18307. //
  18308. // Private Methods
  18309. //
  18310. //--------------------------------------------------------------------------
  18311. mutationObserverCallback() {
  18312. var _a;
  18313. this.updateSlottedInput();
  18314. this.scale =
  18315. this.scale || ((_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.scale) || getElementProp(this.el, "scale", undefined);
  18316. }
  18317. onLabelClick() {
  18318. this.setFocus();
  18319. }
  18320. updateSlottedInput() {
  18321. const inputElement = getSlotted(this.el, {
  18322. matches: "calcite-input"
  18323. });
  18324. this.inputElement = inputElement;
  18325. if (!inputElement) {
  18326. return;
  18327. }
  18328. this.inputElement.disabled = this.disabled;
  18329. this.inputElement.label = this.inputElement.label || getLabelText(this);
  18330. }
  18331. get shouldShowControls() {
  18332. return this.editingEnabled && this.controls;
  18333. }
  18334. get el() { return getElement(this); }
  18335. static get watchers() { return {
  18336. "disabled": ["disabledWatcher"],
  18337. "editingEnabled": ["editingEnabledWatcher"]
  18338. }; }
  18339. static get style() { return inlineEditableCss; }
  18340. static get cmpMeta() { return {
  18341. "$flags$": 9,
  18342. "$tagName$": "calcite-inline-editable",
  18343. "$members$": {
  18344. "disabled": [516],
  18345. "editingEnabled": [1540, "editing-enabled"],
  18346. "loading": [1540],
  18347. "controls": [516],
  18348. "intlEnableEditing": [513, "intl-enable-editing"],
  18349. "intlCancelEditing": [513, "intl-cancel-editing"],
  18350. "intlConfirmChanges": [513, "intl-confirm-changes"],
  18351. "scale": [1537],
  18352. "afterConfirm": [16],
  18353. "setFocus": [64]
  18354. },
  18355. "$listeners$": [[0, "calciteInputBlur", "blurHandler"]],
  18356. "$lazyBundleId$": "-",
  18357. "$attrsToReflect$": [["disabled", "disabled"], ["editingEnabled", "editing-enabled"], ["loading", "loading"], ["controls", "controls"], ["intlEnableEditing", "intl-enable-editing"], ["intlCancelEditing", "intl-cancel-editing"], ["intlConfirmChanges", "intl-confirm-changes"], ["scale", "scale"]]
  18358. }; }
  18359. }
  18360. const CSS$s = {
  18361. loader: "loader",
  18362. clearButton: "clear-button",
  18363. editingEnabled: "editing-enabled",
  18364. inlineChild: "inline-child",
  18365. inputIcon: "icon",
  18366. prefix: "prefix",
  18367. suffix: "suffix",
  18368. numberButtonWrapper: "number-button-wrapper",
  18369. buttonItemHorizontal: "number-button-item--horizontal",
  18370. wrapper: "element-wrapper",
  18371. inputWrapper: "wrapper",
  18372. actionWrapper: "action-wrapper",
  18373. resizeIconWrapper: "resize-icon-wrapper",
  18374. numberButtonItem: "number-button-item"
  18375. };
  18376. const INPUT_TYPE_ICONS = {
  18377. tel: "phone",
  18378. password: "lock",
  18379. email: "email-address",
  18380. date: "calendar",
  18381. time: "clock",
  18382. search: "search"
  18383. };
  18384. const SLOTS$g = {
  18385. action: "action"
  18386. };
  18387. const TEXT$c = {
  18388. clear: "Clear value"
  18389. };
  18390. const inputCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-input:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-h{display:none}/*!@:host*/.sc-calcite-input-h{display:block}/*!@:host([scale=s]) input, :host([scale=s]) .prefix, :host([scale=s]) .suffix*/[scale=s].sc-calcite-input-h input.sc-calcite-input,[scale=s].sc-calcite-input-h .prefix.sc-calcite-input,[scale=s].sc-calcite-input-h .suffix.sc-calcite-input{height:1.5rem;padding:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) textarea*/[scale=s].sc-calcite-input-h textarea.sc-calcite-input{height:1.5rem;min-height:1.5rem}/*!@:host([scale=s]) .number-button-wrapper, :host([scale=s]) .action-wrapper calcite-button, :host([scale=s]) .action-wrapper calcite-button button*/[scale=s].sc-calcite-input-h .number-button-wrapper.sc-calcite-input,[scale=s].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input,[scale=s].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input button.sc-calcite-input{height:1.5rem}/*!@:host([scale=s]) input[type=file]*/[scale=s].sc-calcite-input-h input[type=file].sc-calcite-input{height:1.5rem}/*!@:host([scale=s]) .clear-button*/[scale=s].sc-calcite-input-h .clear-button.sc-calcite-input{min-height:1.5rem;min-width:1.5rem}/*!@:host([scale=s]) textarea*/[scale=s].sc-calcite-input-h textarea.sc-calcite-input{height:auto;padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.5rem;padding-right:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m]) input, :host([scale=m]) .prefix, :host([scale=m]) .suffix*/[scale=m].sc-calcite-input-h input.sc-calcite-input,[scale=m].sc-calcite-input-h .prefix.sc-calcite-input,[scale=m].sc-calcite-input-h .suffix.sc-calcite-input{height:2rem;padding:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) textarea*/[scale=m].sc-calcite-input-h textarea.sc-calcite-input{min-height:2rem}/*!@:host([scale=m]) .number-button-wrapper, :host([scale=m]) .action-wrapper calcite-button, :host([scale=m]) .action-wrapper calcite-button button*/[scale=m].sc-calcite-input-h .number-button-wrapper.sc-calcite-input,[scale=m].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input,[scale=m].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input button.sc-calcite-input{height:2rem}/*!@:host([scale=m]) input[type=file]*/[scale=m].sc-calcite-input-h input[type=file].sc-calcite-input{height:2rem}/*!@:host([scale=m]) .clear-button*/[scale=m].sc-calcite-input-h .clear-button.sc-calcite-input{min-height:2rem;min-width:2rem}/*!@:host([scale=m]) textarea*/[scale=m].sc-calcite-input-h textarea.sc-calcite-input{height:auto;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l]) input, :host([scale=l]) .prefix, :host([scale=l]) .suffix*/[scale=l].sc-calcite-input-h input.sc-calcite-input,[scale=l].sc-calcite-input-h .prefix.sc-calcite-input,[scale=l].sc-calcite-input-h .suffix.sc-calcite-input{height:2.75rem;padding:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) textarea*/[scale=l].sc-calcite-input-h textarea.sc-calcite-input{min-height:2.75rem}/*!@:host([scale=l]) .number-button-wrapper, :host([scale=l]) .action-wrapper calcite-button, :host([scale=l]) .action-wrapper calcite-button button*/[scale=l].sc-calcite-input-h .number-button-wrapper.sc-calcite-input,[scale=l].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input,[scale=l].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input button.sc-calcite-input{height:2.75rem}/*!@:host([scale=l]) input[type=file]*/[scale=l].sc-calcite-input-h input[type=file].sc-calcite-input{height:2.75rem}/*!@:host([scale=l]) .clear-button*/[scale=l].sc-calcite-input-h .clear-button.sc-calcite-input{min-height:2.75rem;min-width:2.75rem}/*!@:host([scale=l]) textarea*/[scale=l].sc-calcite-input-h textarea.sc-calcite-input{height:auto;padding-top:0.75rem;padding-bottom:0.75rem;padding-left:1rem;padding-right:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([disabled])*/[disabled].sc-calcite-input-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) textarea*/[disabled].sc-calcite-input-h textarea.sc-calcite-input{resize:none}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-h[disabled] .sc-calcite-input-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-h [calcite-hydrated][disabled].sc-calcite-input{opacity:1}/*!@:host textarea,\n:host input*/.sc-calcite-input-h textarea.sc-calcite-input,.sc-calcite-input-h input.sc-calcite-input{-webkit-transition:var(--calcite-animation-timing), height 0s;transition:var(--calcite-animation-timing), height 0s;-webkit-appearance:none;position:relative;margin:0px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;max-height:100%;width:100%;max-width:100%;-ms-flex:1 1 0%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1)}/*!@:host input[type=search]::-webkit-search-decoration*/.sc-calcite-input-h input[type=search].sc-calcite-input::-webkit-search-decoration{-webkit-appearance:none}/*!@:host input, :host textarea*/.sc-calcite-input-h input.sc-calcite-input,.sc-calcite-input-h textarea.sc-calcite-input{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);color:var(--calcite-ui-text-1)}/*!@:host input::placeholder, :host input:-ms-input-placeholder, :host input::-ms-input-placeholder, :host textarea::placeholder, :host textarea:-ms-input-placeholder, :host textarea::-ms-input-placeholder*/.sc-calcite-input-h input.sc-calcite-input:-ms-input-placeholder,.sc-calcite-input-h textarea.sc-calcite-input:-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}.sc-calcite-input-h input.sc-calcite-input::-ms-input-placeholder,.sc-calcite-input-h textarea.sc-calcite-input::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}.sc-calcite-input-h input.sc-calcite-input::placeholder,.sc-calcite-input-h input.sc-calcite-input:-ms-input-placeholder,.sc-calcite-input-h input.sc-calcite-input::-ms-input-placeholder,.sc-calcite-input-h textarea.sc-calcite-input::placeholder,.sc-calcite-input-h textarea.sc-calcite-input:-ms-input-placeholder,.sc-calcite-input-h textarea.sc-calcite-input::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@:host input:focus, :host textarea:focus*/.sc-calcite-input-h input.sc-calcite-input:focus,.sc-calcite-input-h textarea.sc-calcite-input:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}/*!@:host input[readonly], :host textarea[readonly]*/.sc-calcite-input-h input[readonly].sc-calcite-input,.sc-calcite-input-h textarea[readonly].sc-calcite-input{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}/*!@:host input[readonly]:focus, :host textarea[readonly]:focus*/.sc-calcite-input-h input[readonly].sc-calcite-input:focus,.sc-calcite-input-h textarea[readonly].sc-calcite-input:focus{color:var(--calcite-ui-text-1)}/*!@:host calcite-icon*/.sc-calcite-input-h calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-3)}/*!@:host textarea, :host input*/.sc-calcite-input-h textarea.sc-calcite-input,.sc-calcite-input-h input.sc-calcite-input{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host textarea:focus, :host input:focus*/.sc-calcite-input-h textarea.sc-calcite-input:focus,.sc-calcite-input-h input.sc-calcite-input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([status=invalid]) input, :host([status=invalid]) textarea*/[status=invalid].sc-calcite-input-h input.sc-calcite-input,[status=invalid].sc-calcite-input-h textarea.sc-calcite-input{border-color:var(--calcite-ui-danger)}/*!@:host([status=invalid]) input:focus, :host([status=invalid]) textarea:focus*/[status=invalid].sc-calcite-input-h input.sc-calcite-input:focus,[status=invalid].sc-calcite-input-h textarea.sc-calcite-input:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}/*!@:host([scale=s]) .icon*/[scale=s].sc-calcite-input-h .icon.sc-calcite-input{inset-inline-start:0.5rem}/*!@:host([scale=m]) .icon*/[scale=m].sc-calcite-input-h .icon.sc-calcite-input{inset-inline-start:0.75rem}/*!@:host([scale=l]) .icon*/[scale=l].sc-calcite-input-h .icon.sc-calcite-input{inset-inline-start:1rem}/*!@:host([icon][scale=s]) input*/[icon][scale=s].sc-calcite-input-h input.sc-calcite-input{-webkit-padding-start:2rem;padding-inline-start:2rem}/*!@:host([icon][scale=m]) input*/[icon][scale=m].sc-calcite-input-h input.sc-calcite-input{-webkit-padding-start:2.5rem;padding-inline-start:2.5rem}/*!@:host([icon][scale=l]) input*/[icon][scale=l].sc-calcite-input-h input.sc-calcite-input{-webkit-padding-start:3rem;padding-inline-start:3rem}/*!@.element-wrapper*/.element-wrapper.sc-calcite-input{position:relative;-ms-flex-order:3;order:3;display:-ms-inline-flexbox;display:inline-flex;-ms-flex:1 1 0%;flex:1 1 0%;-ms-flex-align:center;align-items:center}/*!@.icon*/.icon.sc-calcite-input{pointer-events:none;position:absolute;z-index:10;display:block;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@input[type=text]::-ms-clear, input[type=text]::-ms-reveal*/input[type=text].sc-calcite-input::-ms-clear,input[type=text].sc-calcite-input::-ms-reveal{display:none;height:0px;width:0px}/*!@input[type=search]::-webkit-search-decoration, input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-results-button, input[type=search]::-webkit-search-results-decoration, input[type=date]::-webkit-clear-button, input[type=time]::-webkit-clear-button*/input[type=search].sc-calcite-input::-webkit-search-decoration,input[type=search].sc-calcite-input::-webkit-search-cancel-button,input[type=search].sc-calcite-input::-webkit-search-results-button,input[type=search].sc-calcite-input::-webkit-search-results-decoration,input[type=date].sc-calcite-input::-webkit-clear-button,input[type=time].sc-calcite-input::-webkit-clear-button{display:none}/*!@.clear-button*/.clear-button.sc-calcite-input{pointer-events:initial;-ms-flex-order:4;order:4;margin:0px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;min-height:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-item-align:stretch;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;border-inline-start-width:0px}/*!@.clear-button:hover*/.clear-button.sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@.clear-button:hover calcite-icon*/.clear-button.sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@.clear-button:active*/.clear-button.sc-calcite-input:active{background-color:var(--calcite-ui-foreground-3)}/*!@.clear-button:active calcite-icon*/.clear-button.sc-calcite-input:active calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@.clear-button:focus*/.clear-button.sc-calcite-input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.clear-button:disabled*/.clear-button.sc-calcite-input:disabled{opacity:var(--calcite-ui-opacity-disabled)}/*!@.loader*/.loader.sc-calcite-input{top:1px;left:1px;right:1px;pointer-events:none;position:absolute;display:block}/*!@.action-wrapper*/.action-wrapper.sc-calcite-input{-ms-flex-order:7;order:7;display:-ms-flexbox;display:flex}/*!@.prefix, .suffix*/.prefix.sc-calcite-input,.suffix.sc-calcite-input{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;height:auto;min-height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-line-pack:center;align-content:center;-ms-flex-align:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}/*!@.prefix*/.prefix.sc-calcite-input{-ms-flex-order:2;order:2;border-inline-end-width:0px}/*!@.suffix*/.suffix.sc-calcite-input{-ms-flex-order:5;order:5;border-inline-start-width:0px}/*!@:host([alignment=start]) textarea, :host([alignment=start]) input*/[alignment=start].sc-calcite-input-h textarea.sc-calcite-input,[alignment=start].sc-calcite-input-h input.sc-calcite-input{text-align:start}/*!@:host([alignment=end]) textarea, :host([alignment=end]) input*/[alignment=end].sc-calcite-input-h textarea.sc-calcite-input,[alignment=end].sc-calcite-input-h input.sc-calcite-input{text-align:end}/*!@:host input[type=number]*/.sc-calcite-input-h input[type=number].sc-calcite-input{-moz-appearance:textfield}/*!@:host input[type=number]::-webkit-inner-spin-button, :host input[type=number]::-webkit-outer-spin-button*/.sc-calcite-input-h input[type=number].sc-calcite-input::-webkit-inner-spin-button,.sc-calcite-input-h input[type=number].sc-calcite-input::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield;margin:0px}/*!@.number-button-wrapper*/.number-button-wrapper.sc-calcite-input{pointer-events:none;-ms-flex-order:6;order:6;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@:host([number-button-type=vertical]) .wrapper*/[number-button-type=vertical].sc-calcite-input-h .wrapper.sc-calcite-input{-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex}/*!@:host([number-button-type=vertical]) input, :host([number-button-type=vertical]) textarea*/[number-button-type=vertical].sc-calcite-input-h input.sc-calcite-input,[number-button-type=vertical].sc-calcite-input-h textarea.sc-calcite-input{-ms-flex-order:2;order:2}/*!@:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon*/[number-button-type=horizontal].sc-calcite-input-h .calcite--rtl.sc-calcite-input .number-button-item[data-adjustment=down].sc-calcite-input calcite-icon.sc-calcite-input{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}/*!@:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon*/[number-button-type=horizontal].sc-calcite-input-h .calcite--rtl.sc-calcite-input .number-button-item[data-adjustment=up].sc-calcite-input calcite-icon.sc-calcite-input{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down], .number-button-item.number-button-item--horizontal[data-adjustment=up]*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input,.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input{-ms-flex-order:1;order:1;max-height:100%;min-height:100%;-ms-flex-item-align:stretch;align-self:stretch}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon, .number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input calcite-icon.sc-calcite-input,.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input calcite-icon.sc-calcite-input{-webkit-transform:rotate(90deg);transform:rotate(90deg)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-inline-end-width:0px}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input{-ms-flex-order:5;order:5}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=down].sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=down].sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=up].sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=up].sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=down].sc-calcite-input{border-top-width:0px}/*!@.number-button-item*/.number-button-item.sc-calcite-input{max-height:50%;min-height:50%;pointer-events:initial;margin:0px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-item-align:center;align-self:center;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);padding-top:0px;padding-bottom:0px;padding-left:0.5rem;padding-right:0.5rem;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;border-inline-start-width:0px}/*!@.number-button-item calcite-icon*/.number-button-item.sc-calcite-input calcite-icon.sc-calcite-input{pointer-events:none;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@.number-button-item:focus*/.number-button-item.sc-calcite-input:focus{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item:focus calcite-icon*/.number-button-item.sc-calcite-input:focus calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@.number-button-item:active*/.number-button-item.sc-calcite-input:active{background-color:var(--calcite-ui-foreground-3)}/*!@.wrapper*/.wrapper.sc-calcite-input{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}/*!@:host input::-webkit-calendar-picker-indicator*/.sc-calcite-input-h input.sc-calcite-input::-webkit-calendar-picker-indicator{display:none}/*!@:host input[type=date]::-webkit-input-placeholder*/.sc-calcite-input-h input[type=date].sc-calcite-input::-webkit-input-placeholder{visibility:hidden !important}/*!@:host textarea::-webkit-resizer*/.sc-calcite-input-h textarea.sc-calcite-input::-webkit-resizer{position:absolute;bottom:0px;-webkit-box-sizing:border-box;box-sizing:border-box;padding-top:0px;padding-bottom:0px;padding-left:0.25rem;padding-right:0.25rem;inset-inline-end:0}/*!@.resize-icon-wrapper*/.resize-icon-wrapper.sc-calcite-input{bottom:2px;inset-inline-end:2px;pointer-events:none;position:absolute;z-index:10;height:0.75rem;width:0.75rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3)}/*!@.resize-icon-wrapper calcite-icon*/.resize-icon-wrapper.sc-calcite-input calcite-icon.sc-calcite-input{bottom:0.25rem;inset-inline-end:0.25rem;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}/*!@.calcite--rtl .resize-icon-wrapper calcite-icon*/.calcite--rtl.sc-calcite-input .resize-icon-wrapper.sc-calcite-input calcite-icon.sc-calcite-input{-webkit-transform:rotate(45deg);transform:rotate(45deg)}/*!@:host([type=color]) input*/[type=color].sc-calcite-input-h input.sc-calcite-input{padding:0.25rem}/*!@:host([type=file]) input*/[type=file].sc-calcite-input-h input.sc-calcite-input{cursor:pointer;border-width:1px;border-style:dashed;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);text-align:center}/*!@:host([type=file][scale=s]) input*/[type=file][scale=s].sc-calcite-input-h input.sc-calcite-input{padding-top:1px;padding-bottom:1px;padding-left:0.5rem;padding-right:0.5rem}/*!@:host([type=file][scale=m]) input*/[type=file][scale=m].sc-calcite-input-h input.sc-calcite-input{padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}/*!@:host([type=file][scale=l]) input*/[type=file][scale=l].sc-calcite-input-h input.sc-calcite-input{padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem}/*!@:host(.no-bottom-border) input*/.no-bottom-border.sc-calcite-input-h input.sc-calcite-input{border-bottom-width:0px}/*!@:host(.border-top-color-one) input*/.border-top-color-one.sc-calcite-input-h input.sc-calcite-input{border-top-color:var(--calcite-ui-border-1)}/*!@:host .inline-child*/.sc-calcite-input-h .inline-child.sc-calcite-input{background-color:transparent;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@:host .inline-child .editing-enabled*/.sc-calcite-input-h .inline-child.sc-calcite-input .editing-enabled.sc-calcite-input{background-color:inherit}/*!@:host .inline-child:not(.editing-enabled)*/.sc-calcite-input-h .inline-child.sc-calcite-input:not(.editing-enabled){display:-ms-flexbox;display:flex;cursor:pointer;border-color:transparent;-webkit-padding-start:0;padding-inline-start:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  18391. /**
  18392. * @slot action - A slot for positioning a button next to an input
  18393. */
  18394. class Input {
  18395. constructor(hostRef) {
  18396. registerInstance(this, hostRef);
  18397. this.calciteInputFocus = createEvent(this, "calciteInputFocus", 7);
  18398. this.calciteInputBlur = createEvent(this, "calciteInputBlur", 7);
  18399. this.calciteInputInput = createEvent(this, "calciteInputInput", 7);
  18400. this.calciteInputChange = createEvent(this, "calciteInputChange", 7);
  18401. //--------------------------------------------------------------------------
  18402. //
  18403. // Properties
  18404. //
  18405. //--------------------------------------------------------------------------
  18406. /** specify the alignment of the value of the input */
  18407. this.alignment = "start";
  18408. /** should the input autofocus */
  18409. this.autofocus = false;
  18410. /** optionally display a clear button that displays when field has a value
  18411. * shows by default for search, time, date
  18412. * will not display for type="textarea" */
  18413. this.clearable = false;
  18414. /** is the input disabled */
  18415. this.disabled = false;
  18416. /** for number values, displays the locale's group separator */
  18417. this.groupSeparator = false;
  18418. /** when true, the component will not be visible */
  18419. this.hidden = false;
  18420. /**
  18421. * string to override English loading text
  18422. * @default "Loading"
  18423. */
  18424. this.intlLoading = TEXT$s.loading;
  18425. /** flip the icon in rtl */
  18426. this.iconFlipRtl = false;
  18427. /** specify if the input is in loading state */
  18428. this.loading = false;
  18429. /** BCP 47 language tag for desired language and country format */
  18430. this.locale = document.documentElement.lang || "en";
  18431. /**
  18432. * Toggles locale formatting for numbers.
  18433. * @internal
  18434. */
  18435. this.localeFormat = false;
  18436. /** specify the placement of the number buttons */
  18437. this.numberButtonType = "vertical";
  18438. /** When true, a field cannot be modified. */
  18439. this.readOnly = false;
  18440. /** is the input required */
  18441. this.required = false;
  18442. /** specify the scale of the input, defaults to m */
  18443. this.scale = "m";
  18444. /** specify the status of the input field, determines message and icons */
  18445. this.status = "idle";
  18446. /** @internal adds inline styles for text input when slotted in calcite-inline-editable */
  18447. this.editingEnabled = false;
  18448. /**
  18449. * specify the input type
  18450. *
  18451. * Note that the following types add type-specific icons by default: `date`, `email`, `password`, `search`, `tel`, `time`
  18452. */
  18453. this.type = "text";
  18454. /** input value */
  18455. this.value = "";
  18456. /** keep track of the rendered child type */
  18457. this.childElType = "input";
  18458. this.previousValueOrigin = "initial";
  18459. this.mutationObserver = createObserver();
  18460. this.userChangedValue = false;
  18461. //--------------------------------------------------------------------------
  18462. //
  18463. // Private Methods
  18464. //
  18465. //--------------------------------------------------------------------------
  18466. this.keyDownHandler = (event) => {
  18467. if (this.readOnly || this.disabled) {
  18468. return;
  18469. }
  18470. if (this.isClearable && event.key === "Escape") {
  18471. this.clearInputValue(event);
  18472. event.preventDefault();
  18473. }
  18474. if (event.key === "Enter" && !event.defaultPrevented) {
  18475. submitForm(this);
  18476. }
  18477. };
  18478. this.clearInputValue = (nativeEvent) => {
  18479. this.setValue({
  18480. committing: true,
  18481. nativeEvent,
  18482. origin: "user",
  18483. value: ""
  18484. });
  18485. };
  18486. this.emitChangeIfUserModified = () => {
  18487. if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
  18488. this.calciteInputChange.emit();
  18489. }
  18490. this.previousEmittedValue = this.value;
  18491. };
  18492. this.inputBlurHandler = () => {
  18493. this.calciteInputBlur.emit({
  18494. element: this.childEl,
  18495. value: this.value
  18496. });
  18497. this.emitChangeIfUserModified();
  18498. };
  18499. this.inputFocusHandler = (event) => {
  18500. const slottedActionEl = getSlotted(this.el, "action");
  18501. if (event.target !== slottedActionEl) {
  18502. this.setFocus();
  18503. }
  18504. this.calciteInputFocus.emit({
  18505. element: this.childEl,
  18506. value: this.value
  18507. });
  18508. };
  18509. this.inputInputHandler = (nativeEvent) => {
  18510. if (this.disabled || this.readOnly) {
  18511. return;
  18512. }
  18513. this.setValue({
  18514. nativeEvent,
  18515. origin: "user",
  18516. value: nativeEvent.target.value
  18517. });
  18518. };
  18519. this.inputKeyDownHandler = (event) => {
  18520. if (this.disabled || this.readOnly) {
  18521. return;
  18522. }
  18523. if (event.key === "Enter") {
  18524. this.emitChangeIfUserModified();
  18525. }
  18526. };
  18527. this.inputNumberInputHandler = (nativeEvent) => {
  18528. if (this.disabled || this.readOnly) {
  18529. return;
  18530. }
  18531. const value = nativeEvent.target.value;
  18532. const delocalizedValue = delocalizeNumberString(value, this.locale);
  18533. if (nativeEvent.inputType === "insertFromPaste") {
  18534. if (!isValidNumber(delocalizedValue)) {
  18535. nativeEvent.preventDefault();
  18536. }
  18537. this.setValue({
  18538. nativeEvent,
  18539. origin: "user",
  18540. value: parseNumberString(delocalizedValue)
  18541. });
  18542. this.childNumberEl.value = this.localizedValue;
  18543. }
  18544. else {
  18545. this.setValue({
  18546. nativeEvent,
  18547. origin: "user",
  18548. value: delocalizedValue
  18549. });
  18550. }
  18551. };
  18552. this.inputNumberKeyDownHandler = (event) => {
  18553. if (this.type !== "number" || this.disabled || this.readOnly) {
  18554. return;
  18555. }
  18556. if (event.key === "ArrowUp") {
  18557. /* prevent default behavior of moving cursor to the beginning of the input when holding down ArrowUp */
  18558. event.preventDefault();
  18559. this.nudgeNumberValue("up", event);
  18560. return;
  18561. }
  18562. if (event.key === "ArrowDown") {
  18563. this.nudgeNumberValue("down", event);
  18564. return;
  18565. }
  18566. const supportedKeys = [
  18567. ...numberKeys,
  18568. "ArrowLeft",
  18569. "ArrowRight",
  18570. "Backspace",
  18571. "Delete",
  18572. "Enter",
  18573. "Escape",
  18574. "Tab"
  18575. ];
  18576. if (event.altKey || event.ctrlKey || event.metaKey) {
  18577. return;
  18578. }
  18579. const isShiftTabEvent = event.shiftKey && event.key === "Tab";
  18580. if (supportedKeys.includes(event.key) && (!event.shiftKey || isShiftTabEvent)) {
  18581. if (event.key === "Enter") {
  18582. this.emitChangeIfUserModified();
  18583. }
  18584. return;
  18585. }
  18586. const decimalSeparator = getDecimalSeparator(this.locale);
  18587. if (event.key === decimalSeparator) {
  18588. if (!this.value && !this.childNumberEl.value) {
  18589. return;
  18590. }
  18591. if (this.value && this.childNumberEl.value.indexOf(decimalSeparator) === -1) {
  18592. return;
  18593. }
  18594. }
  18595. if (/[eE]/.test(event.key)) {
  18596. if (!this.value && !this.childNumberEl.value) {
  18597. return;
  18598. }
  18599. if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
  18600. return;
  18601. }
  18602. }
  18603. if (event.key === "-") {
  18604. if (!this.value && !this.childNumberEl.value) {
  18605. return;
  18606. }
  18607. if (this.value && this.childNumberEl.value.split("-").length <= 2) {
  18608. return;
  18609. }
  18610. }
  18611. event.preventDefault();
  18612. };
  18613. this.nudgeNumberValue = (direction, nativeEvent) => {
  18614. if ((nativeEvent instanceof KeyboardEvent && nativeEvent.repeat) || this.type !== "number") {
  18615. return;
  18616. }
  18617. const inputMax = this.maxString ? parseFloat(this.maxString) : null;
  18618. const inputMin = this.minString ? parseFloat(this.minString) : null;
  18619. const valueNudgeDelayInMs = 100;
  18620. this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
  18621. if (this.nudgeNumberValueIntervalId) {
  18622. window.clearInterval(this.nudgeNumberValueIntervalId);
  18623. }
  18624. let firstValueNudge = true;
  18625. this.nudgeNumberValueIntervalId = window.setInterval(() => {
  18626. if (firstValueNudge) {
  18627. firstValueNudge = false;
  18628. return;
  18629. }
  18630. this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
  18631. }, valueNudgeDelayInMs);
  18632. };
  18633. this.numberButtonMouseUpAndMouseOutHandler = () => {
  18634. window.clearInterval(this.nudgeNumberValueIntervalId);
  18635. };
  18636. this.numberButtonMouseDownHandler = (event) => {
  18637. event.preventDefault();
  18638. const direction = event.target.dataset.adjustment;
  18639. this.nudgeNumberValue(direction, event);
  18640. };
  18641. this.setChildElRef = (el) => {
  18642. this.childEl = el;
  18643. };
  18644. this.setChildNumberElRef = (el) => {
  18645. this.childNumberEl = el;
  18646. };
  18647. this.setInputValue = (newInputValue) => {
  18648. if (this.type === "text" && !this.childEl) {
  18649. return;
  18650. }
  18651. if (this.type === "number" && !this.childNumberEl) {
  18652. return;
  18653. }
  18654. this[`child${this.type === "number" ? "Number" : ""}El`].value = newInputValue;
  18655. };
  18656. this.setPreviousEmittedValue = (newPreviousEmittedValue) => {
  18657. this.previousEmittedValue =
  18658. this.type === "number"
  18659. ? isValidNumber(newPreviousEmittedValue)
  18660. ? newPreviousEmittedValue
  18661. : ""
  18662. : newPreviousEmittedValue;
  18663. };
  18664. this.setPreviousValue = (newPreviousValue) => {
  18665. this.previousValue =
  18666. this.type === "number"
  18667. ? isValidNumber(newPreviousValue)
  18668. ? newPreviousValue
  18669. : ""
  18670. : newPreviousValue;
  18671. };
  18672. this.setValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
  18673. const previousLocalizedValue = this.type === "number"
  18674. ? localizeNumberString(this.previousValue, this.locale, this.groupSeparator)
  18675. : "";
  18676. const sanitizedValue = this.type === "number" ? sanitizeNumberString(value) : value;
  18677. const newValue = this.type === "number" && value && !sanitizedValue
  18678. ? isValidNumber(this.previousValue)
  18679. ? this.previousValue
  18680. : ""
  18681. : sanitizedValue;
  18682. const newLocalizedValue = this.type === "number"
  18683. ? localizeNumberString(newValue, this.locale, this.groupSeparator)
  18684. : "";
  18685. this.setPreviousValue(previousValue || this.value);
  18686. this.previousValueOrigin = origin;
  18687. this.userChangedValue = origin === "user" && this.value !== newValue;
  18688. this.value = newValue;
  18689. if (this.type === "number") {
  18690. this.localizedValue = newLocalizedValue;
  18691. }
  18692. if (origin === "direct") {
  18693. this.setInputValue(this.type === "number" ? newLocalizedValue : newValue);
  18694. }
  18695. if (nativeEvent) {
  18696. const calciteInputInputEvent = this.calciteInputInput.emit({
  18697. element: this.childEl,
  18698. nativeEvent,
  18699. value: this.value
  18700. });
  18701. if (calciteInputInputEvent.defaultPrevented) {
  18702. this.value = this.previousValue;
  18703. this.localizedValue = previousLocalizedValue;
  18704. }
  18705. else if (committing) {
  18706. this.emitChangeIfUserModified();
  18707. }
  18708. }
  18709. };
  18710. this.inputKeyUpHandler = () => {
  18711. window.clearInterval(this.nudgeNumberValueIntervalId);
  18712. };
  18713. }
  18714. disabledWatcher() {
  18715. this.setDisabledAction();
  18716. }
  18717. /** watcher to update number-to-string for max */
  18718. maxWatcher() {
  18719. var _a;
  18720. this.maxString = ((_a = this.max) === null || _a === void 0 ? void 0 : _a.toString()) || null;
  18721. }
  18722. /** watcher to update number-to-string for min */
  18723. minWatcher() {
  18724. var _a;
  18725. this.minString = ((_a = this.min) === null || _a === void 0 ? void 0 : _a.toString()) || null;
  18726. }
  18727. valueWatcher(newValue, previousValue) {
  18728. if (!this.userChangedValue) {
  18729. this.setValue({
  18730. origin: "direct",
  18731. previousValue,
  18732. value: newValue == null || newValue == ""
  18733. ? ""
  18734. : this.type === "number"
  18735. ? isValidNumber(newValue)
  18736. ? newValue
  18737. : this.previousValue || ""
  18738. : newValue
  18739. });
  18740. this.warnAboutInvalidNumberValue(newValue);
  18741. }
  18742. this.userChangedValue = false;
  18743. }
  18744. updateRequestedIcon() {
  18745. this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
  18746. }
  18747. get isClearable() {
  18748. return !this.isTextarea && (this.clearable || this.type === "search") && this.value.length > 0;
  18749. }
  18750. get isTextarea() {
  18751. return this.childElType === "textarea";
  18752. }
  18753. //--------------------------------------------------------------------------
  18754. //
  18755. // Lifecycle
  18756. //
  18757. //--------------------------------------------------------------------------
  18758. connectedCallback() {
  18759. var _a;
  18760. this.scale = getElementProp(this.el, "scale", this.scale);
  18761. this.status = getElementProp(this.el, "status", this.status);
  18762. this.inlineEditableEl = this.el.closest("calcite-inline-editable");
  18763. if (this.inlineEditableEl) {
  18764. this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
  18765. }
  18766. this.setPreviousEmittedValue(this.value);
  18767. this.setPreviousValue(this.value);
  18768. if (this.type === "number") {
  18769. this.warnAboutInvalidNumberValue(this.value);
  18770. this.setValue({
  18771. origin: "connected",
  18772. value: isValidNumber(this.value) ? this.value : ""
  18773. });
  18774. }
  18775. connectLabel(this);
  18776. connectForm(this);
  18777. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
  18778. this.setDisabledAction();
  18779. }
  18780. disconnectedCallback() {
  18781. var _a;
  18782. disconnectLabel(this);
  18783. disconnectForm(this);
  18784. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  18785. }
  18786. componentWillLoad() {
  18787. var _a, _b;
  18788. this.childElType = this.type === "textarea" ? "textarea" : "input";
  18789. this.maxString = (_a = this.max) === null || _a === void 0 ? void 0 : _a.toString();
  18790. this.minString = (_b = this.min) === null || _b === void 0 ? void 0 : _b.toString();
  18791. this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
  18792. }
  18793. componentShouldUpdate(newValue, oldValue, property) {
  18794. if (this.type === "number" && property === "value" && newValue && !isValidNumber(newValue)) {
  18795. this.setValue({
  18796. origin: "reset",
  18797. value: oldValue
  18798. });
  18799. return false;
  18800. }
  18801. return true;
  18802. }
  18803. componentDidRender() {
  18804. updateHostInteraction(this);
  18805. }
  18806. //--------------------------------------------------------------------------
  18807. //
  18808. // Public Methods
  18809. //
  18810. //--------------------------------------------------------------------------
  18811. /** Sets focus on the component. */
  18812. async setFocus() {
  18813. var _a, _b;
  18814. if (this.type === "number") {
  18815. (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.focus();
  18816. }
  18817. else {
  18818. (_b = this.childEl) === null || _b === void 0 ? void 0 : _b.focus();
  18819. }
  18820. }
  18821. onLabelClick() {
  18822. this.setFocus();
  18823. }
  18824. incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent) {
  18825. const { value } = this;
  18826. const inputStep = this.step === "any" ? 1 : Math.abs(this.step || 1);
  18827. const inputVal = value && value !== "" ? parseFloat(value) : 0;
  18828. const adjustment = direction === "up" ? 1 : -1;
  18829. const nudgedValue = inputVal + inputStep * adjustment;
  18830. const finalValue = (typeof inputMin === "number" && !isNaN(inputMin) && nudgedValue < inputMin) ||
  18831. (typeof inputMax === "number" && !isNaN(inputMax) && nudgedValue > inputMax)
  18832. ? inputVal
  18833. : nudgedValue;
  18834. const inputValPlaces = decimalPlaces(inputVal);
  18835. const inputStepPlaces = decimalPlaces(inputStep);
  18836. this.setValue({
  18837. committing: true,
  18838. nativeEvent,
  18839. origin: "user",
  18840. value: finalValue.toFixed(Math.max(inputValPlaces, inputStepPlaces))
  18841. });
  18842. }
  18843. onFormReset() {
  18844. this.setValue({
  18845. origin: "reset",
  18846. value: this.defaultValue
  18847. });
  18848. }
  18849. syncHiddenFormInput(input) {
  18850. var _a, _b, _c, _d;
  18851. if (this.type === "number") {
  18852. input.type = "number";
  18853. input.min = (_b = (_a = this.min) === null || _a === void 0 ? void 0 : _a.toString(10)) !== null && _b !== void 0 ? _b : "";
  18854. input.max = (_d = (_c = this.max) === null || _c === void 0 ? void 0 : _c.toString(10)) !== null && _d !== void 0 ? _d : "";
  18855. }
  18856. else if (this.type === "text") {
  18857. input.type = "text";
  18858. if (this.minLength != null) {
  18859. input.minLength = this.minLength;
  18860. }
  18861. if (this.maxLength != null) {
  18862. input.maxLength = this.maxLength;
  18863. }
  18864. }
  18865. else if (this.type === "password") {
  18866. input.type = "password";
  18867. }
  18868. }
  18869. setDisabledAction() {
  18870. const slottedActionEl = getSlotted(this.el, "action");
  18871. if (!slottedActionEl) {
  18872. return;
  18873. }
  18874. this.disabled
  18875. ? slottedActionEl.setAttribute("disabled", "")
  18876. : slottedActionEl.removeAttribute("disabled");
  18877. }
  18878. warnAboutInvalidNumberValue(value) {
  18879. if (this.type === "number" && value && !isValidNumber(value)) {
  18880. console.warn(`The specified value "${value}" cannot be parsed, or is out of range.`);
  18881. }
  18882. }
  18883. // --------------------------------------------------------------------------
  18884. //
  18885. // Render Methods
  18886. //
  18887. // --------------------------------------------------------------------------
  18888. render() {
  18889. const dir = getElementDir(this.el);
  18890. const loader = (hAsync("div", { class: CSS$s.loader }, hAsync("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
  18891. const inputClearButton = (hAsync("button", { "aria-label": this.intlClear || TEXT$c.clear, class: CSS$s.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputValue, tabIndex: this.disabled ? -1 : 0, type: "button" }, hAsync("calcite-icon", { icon: "x", scale: "s" })));
  18892. const iconEl = (hAsync("calcite-icon", { class: CSS$s.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
  18893. const isHorizontalNumberButton = this.numberButtonType === "horizontal";
  18894. const numberButtonsHorizontalUp = (hAsync("button", { class: {
  18895. [CSS$s.numberButtonItem]: true,
  18896. [CSS$s.buttonItemHorizontal]: isHorizontalNumberButton
  18897. }, "data-adjustment": "up", disabled: this.disabled || this.readOnly, onMouseDown: this.numberButtonMouseDownHandler, onMouseOut: this.numberButtonMouseUpAndMouseOutHandler, onMouseUp: this.numberButtonMouseUpAndMouseOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-up", scale: "s" })));
  18898. const numberButtonsHorizontalDown = (hAsync("button", { class: {
  18899. [CSS$s.numberButtonItem]: true,
  18900. [CSS$s.buttonItemHorizontal]: isHorizontalNumberButton
  18901. }, "data-adjustment": "down", disabled: this.disabled || this.readOnly, onMouseDown: this.numberButtonMouseDownHandler, onMouseOut: this.numberButtonMouseUpAndMouseOutHandler, onMouseUp: this.numberButtonMouseUpAndMouseOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-down", scale: "s" })));
  18902. const numberButtonsVertical = (hAsync("div", { class: CSS$s.numberButtonWrapper }, numberButtonsHorizontalUp, numberButtonsHorizontalDown));
  18903. const prefixText = hAsync("div", { class: CSS$s.prefix }, this.prefixText);
  18904. const suffixText = hAsync("div", { class: CSS$s.suffix }, this.suffixText);
  18905. const localeNumberInput = this.type === "number" ? (hAsync("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, name: undefined, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef, type: "text", value: this.localizedValue })) : null;
  18906. const childEl = this.type !== "number"
  18907. ? [
  18908. hAsync(this.childElType, { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, class: {
  18909. [CSS$s.editingEnabled]: this.editingEnabled,
  18910. [CSS$s.inlineChild]: !!this.inlineEditableEl
  18911. }, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, max: this.maxString, maxLength: this.maxLength, min: this.minString, minLength: this.minLength, name: this.name, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputInputHandler, onKeyDown: this.inputKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildElRef, required: this.required ? true : null, step: this.step, tabIndex: this.disabled || (this.inlineEditableEl && !this.editingEnabled) ? -1 : null, type: this.type, value: this.value }),
  18912. this.isTextarea ? (hAsync("div", { class: CSS$s.resizeIconWrapper }, hAsync("calcite-icon", { icon: "chevron-down", scale: "s" }))) : null
  18913. ]
  18914. : null;
  18915. return (hAsync(Host, { onClick: this.inputFocusHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { class: { [CSS$s.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
  18916. ? numberButtonsHorizontalDown
  18917. : null, this.prefixText ? prefixText : null, hAsync("div", { class: CSS$s.wrapper }, localeNumberInput, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), hAsync("div", { class: CSS$s.actionWrapper }, hAsync("slot", { name: SLOTS$g.action })), this.type === "number" && this.numberButtonType === "vertical" && !this.readOnly
  18918. ? numberButtonsVertical
  18919. : null, this.suffixText ? suffixText : null, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
  18920. ? numberButtonsHorizontalUp
  18921. : null, hAsync(HiddenFormInputSlot, { component: this }))));
  18922. }
  18923. get el() { return getElement(this); }
  18924. static get watchers() { return {
  18925. "disabled": ["disabledWatcher"],
  18926. "max": ["maxWatcher"],
  18927. "min": ["minWatcher"],
  18928. "value": ["valueWatcher"],
  18929. "icon": ["updateRequestedIcon"],
  18930. "type": ["updateRequestedIcon"]
  18931. }; }
  18932. static get style() { return inputCss; }
  18933. static get cmpMeta() { return {
  18934. "$flags$": 9,
  18935. "$tagName$": "calcite-input",
  18936. "$members$": {
  18937. "alignment": [513],
  18938. "autofocus": [4],
  18939. "clearable": [516],
  18940. "disabled": [516],
  18941. "groupSeparator": [4, "group-separator"],
  18942. "hidden": [4],
  18943. "icon": [520],
  18944. "intlClear": [1, "intl-clear"],
  18945. "intlLoading": [1, "intl-loading"],
  18946. "iconFlipRtl": [516, "icon-flip-rtl"],
  18947. "label": [1],
  18948. "loading": [516],
  18949. "locale": [1],
  18950. "localeFormat": [4, "locale-format"],
  18951. "max": [514],
  18952. "min": [514],
  18953. "maxlength": [514],
  18954. "maxLength": [514, "max-length"],
  18955. "minLength": [514, "min-length"],
  18956. "name": [513],
  18957. "numberButtonType": [513, "number-button-type"],
  18958. "placeholder": [1],
  18959. "prefixText": [1, "prefix-text"],
  18960. "readOnly": [4, "read-only"],
  18961. "required": [4],
  18962. "scale": [1537],
  18963. "status": [1537],
  18964. "step": [520],
  18965. "suffixText": [1, "suffix-text"],
  18966. "editingEnabled": [1540, "editing-enabled"],
  18967. "type": [513],
  18968. "value": [1025],
  18969. "localizedValue": [32],
  18970. "setFocus": [64]
  18971. },
  18972. "$listeners$": undefined,
  18973. "$lazyBundleId$": "-",
  18974. "$attrsToReflect$": [["alignment", "alignment"], ["clearable", "clearable"], ["disabled", "disabled"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["loading", "loading"], ["max", "max"], ["min", "min"], ["maxlength", "maxlength"], ["maxLength", "max-length"], ["minLength", "min-length"], ["name", "name"], ["numberButtonType", "number-button-type"], ["scale", "scale"], ["status", "status"], ["step", "step"], ["editingEnabled", "editing-enabled"], ["type", "type"]]
  18975. }; }
  18976. }
  18977. const inputDatePickerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-date-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input-date-picker{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-date-picker{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-date-picker{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-date-picker{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-date-picker{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-input-date-picker-h{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}/*!@:root*/.sc-calcite-input-date-picker:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-date-picker-h{display:none}/*!@:host*/.sc-calcite-input-date-picker-h{position:relative;display:inline-block;width:100%;overflow:visible;vertical-align:top;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([disabled])*/[disabled].sc-calcite-input-date-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-date-picker-h[disabled] .sc-calcite-input-date-picker-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-date-picker-h [calcite-hydrated][disabled].sc-calcite-input-date-picker{opacity:1}/*!@.calendar-picker-wrapper*/.calendar-picker-wrapper.sc-calcite-input-date-picker{position:static;width:100%;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}/*!@.input-wrapper*/.input-wrapper.sc-calcite-input-date-picker{position:relative}/*!@:host([range]) .input-container*/[range].sc-calcite-input-date-picker-h .input-container.sc-calcite-input-date-picker{display:-ms-flexbox;display:flex}/*!@:host([range]) .input-wrapper*/[range].sc-calcite-input-date-picker-h .input-wrapper.sc-calcite-input-date-picker{-ms-flex:1 1 auto;flex:1 1 auto}/*!@:host([range]) .horizontal-arrow-container*/[range].sc-calcite-input-date-picker-h .horizontal-arrow-container.sc-calcite-input-date-picker{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-width:1px;border-left-width:0px;border-right-width:0px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);padding-top:0px;padding-bottom:0px;padding-left:0.25rem;padding-right:0.25rem}/*!@:host([range][layout=vertical]) .input-wrapper*/[range][layout=vertical].sc-calcite-input-date-picker-h .input-wrapper.sc-calcite-input-date-picker{width:100%}/*!@:host([range][layout=vertical]) .input-container*/[range][layout=vertical].sc-calcite-input-date-picker-h .input-container.sc-calcite-input-date-picker{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}/*!@:host([range][layout=vertical]) .calendar-picker-wrapper--end*/[range][layout=vertical].sc-calcite-input-date-picker-h .calendar-picker-wrapper--end.sc-calcite-input-date-picker{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}/*!@:host([range][layout=vertical]) .vertical-arrow-container*/[range][layout=vertical].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker{top:1.5rem;position:absolute;left:0px;z-index:10;margin-left:1px;margin-right:1px;background-color:var(--calcite-ui-foreground-1);padding-left:0.625rem;padding-right:0.625rem}/*!@:host([scale=s][range]:not([layout=vertical])) .calendar-picker-wrapper*/[scale=s][range].sc-calcite-input-date-picker-h:not([layout=vertical]) .calendar-picker-wrapper.sc-calcite-input-date-picker{width:216px}/*!@:host([scale=m][range]:not([layout=vertical])) .calendar-picker-wrapper*/[scale=m][range].sc-calcite-input-date-picker-h:not([layout=vertical]) .calendar-picker-wrapper.sc-calcite-input-date-picker{width:286px}/*!@:host([scale=l][range]:not([layout=vertical])) .calendar-picker-wrapper*/[scale=l][range].sc-calcite-input-date-picker-h:not([layout=vertical]) .calendar-picker-wrapper.sc-calcite-input-date-picker{width:398px}/*!@.menu-container*/.menu-container.sc-calcite-input-date-picker{display:block;position:absolute;z-index:900;-webkit-transform:scale(0);transform:scale(0);visibility:hidden;pointer-events:none}/*!@.menu-container .calcite-popper-anim*/.menu-container.sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}/*!@.menu-container[data-popper-placement^=bottom] .calcite-popper-anim*/.menu-container[data-popper-placement^=bottom].sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{-webkit-transform:translateY(-5px);transform:translateY(-5px)}/*!@.menu-container[data-popper-placement^=top] .calcite-popper-anim*/.menu-container[data-popper-placement^=top].sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{-webkit-transform:translateY(5px);transform:translateY(5px)}/*!@.menu-container[data-popper-placement^=left] .calcite-popper-anim*/.menu-container[data-popper-placement^=left].sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{-webkit-transform:translateX(5px);transform:translateX(5px)}/*!@.menu-container[data-popper-placement^=right] .calcite-popper-anim*/.menu-container[data-popper-placement^=right].sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{-webkit-transform:translateX(-5px);transform:translateX(-5px)}/*!@.menu-container[data-popper-placement] .calcite-popper-anim--active*/.menu-container[data-popper-placement].sc-calcite-input-date-picker .calcite-popper-anim--active.sc-calcite-input-date-picker{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}/*!@:host([active]) .menu-container*/[active].sc-calcite-input-date-picker-h .menu-container.sc-calcite-input-date-picker{pointer-events:initial;visibility:visible}/*!@.menu-container--active .menu-container .calcite-popper-anim*/.menu-container--active.sc-calcite-input-date-picker .menu-container.sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}/*!@.menu-container--active .menu-container[data-popper-placement^=bottom] .calcite-popper-anim*/.menu-container--active.sc-calcite-input-date-picker .menu-container[data-popper-placement^=bottom].sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{-webkit-transform:translateY(-5px);transform:translateY(-5px)}/*!@.menu-container--active .menu-container[data-popper-placement^=top] .calcite-popper-anim*/.menu-container--active.sc-calcite-input-date-picker .menu-container[data-popper-placement^=top].sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{-webkit-transform:translateY(5px);transform:translateY(5px)}/*!@.menu-container--active .menu-container[data-popper-placement^=left] .calcite-popper-anim*/.menu-container--active.sc-calcite-input-date-picker .menu-container[data-popper-placement^=left].sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{-webkit-transform:translateX(5px);transform:translateX(5px)}/*!@.menu-container--active .menu-container[data-popper-placement^=right] .calcite-popper-anim*/.menu-container--active.sc-calcite-input-date-picker .menu-container[data-popper-placement^=right].sc-calcite-input-date-picker .calcite-popper-anim.sc-calcite-input-date-picker{-webkit-transform:translateX(-5px);transform:translateX(-5px)}/*!@.menu-container--active .menu-container[data-popper-placement] .calcite-popper-anim--active*/.menu-container--active.sc-calcite-input-date-picker .menu-container[data-popper-placement].sc-calcite-input-date-picker .calcite-popper-anim--active.sc-calcite-input-date-picker{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}/*!@.input .calcite-input__wrapper*/.input.sc-calcite-input-date-picker .calcite-input__wrapper.sc-calcite-input-date-picker{margin-top:0px}/*!@:host([range][layout=vertical][scale=m]) .vertical-arrow-container*/[range][layout=vertical][scale=m].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker{top:1.5rem;padding-left:0.75rem}/*!@:host([range][layout=vertical][scale=m]) .vertical-arrow-container calcite-icon*/[range][layout=vertical][scale=m].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker calcite-icon.sc-calcite-input-date-picker{height:0.75rem;width:0.75rem;min-width:0px}/*!@:host([range][layout=vertical][scale=l]) .vertical-arrow-container*/[range][layout=vertical][scale=l].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker{top:2.25rem;padding-left:0.875rem;padding-right:0.875rem}/*!@:host([range][layout=vertical][active]) .vertical-arrow-container*/[range][layout=vertical][active].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker{display:none}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-date-picker-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  18978. class InputDatePicker {
  18979. constructor(hostRef) {
  18980. registerInstance(this, hostRef);
  18981. this.calciteDatePickerChange = createEvent(this, "calciteDatePickerChange", 7);
  18982. this.calciteDatePickerRangeChange = createEvent(this, "calciteDatePickerRangeChange", 7);
  18983. this.calciteInputDatePickerChange = createEvent(this, "calciteInputDatePickerChange", 7);
  18984. this.calciteInputDatePickerOpen = createEvent(this, "calciteInputDatePickerOpen", 7);
  18985. this.calciteInputDatePickerClose = createEvent(this, "calciteInputDatePickerClose", 7);
  18986. //--------------------------------------------------------------------------
  18987. //
  18988. // Public Properties
  18989. //
  18990. //--------------------------------------------------------------------------
  18991. /**
  18992. * When false, the component won't be interactive.
  18993. */
  18994. this.disabled = false;
  18995. /** Expand or collapse when calendar does not have input */
  18996. this.active = false;
  18997. /** Localized string for "previous month" (used for aria label)
  18998. * @default "Previous month"
  18999. */
  19000. this.intlPrevMonth = TEXT$f.prevMonth;
  19001. /** Localized string for "next month" (used for aria label)
  19002. * @default "Next month"
  19003. */
  19004. this.intlNextMonth = TEXT$f.nextMonth;
  19005. /** Localized string for "year" (used for aria label)
  19006. * @default "Year"
  19007. */
  19008. this.intlYear = TEXT$f.year;
  19009. /** BCP 47 language tag for desired language and country format */
  19010. this.locale = document.documentElement.lang || "en";
  19011. /** specify the scale of the date picker */
  19012. this.scale = "m";
  19013. /**
  19014. * Determines where the date-picker component will be positioned relative to the input.
  19015. * @default "bottom-leading"
  19016. */
  19017. this.placement = defaultMenuPlacement;
  19018. /** Range mode activation */
  19019. this.range = false;
  19020. /**
  19021. * When true, makes the component required for form-submission.
  19022. *
  19023. * @internal
  19024. */
  19025. this.required = false;
  19026. /** Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value. */
  19027. this.overlayPositioning = "absolute";
  19028. /** Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range. */
  19029. this.proximitySelectionDisabled = false;
  19030. /** Layout */
  19031. this.layout = "horizontal";
  19032. this.focusedInput = "start";
  19033. this.activeTransitionProp = "opacity";
  19034. //--------------------------------------------------------------------------
  19035. //
  19036. // Private Methods
  19037. //
  19038. //--------------------------------------------------------------------------
  19039. this.setFilteredPlacements = () => {
  19040. const { el, flipPlacements } = this;
  19041. this.filteredFlipPlacements = flipPlacements
  19042. ? filterComputedPlacements(flipPlacements, el)
  19043. : null;
  19044. };
  19045. this.transitionEnd = (event) => {
  19046. if (event.propertyName === this.activeTransitionProp) {
  19047. this.active
  19048. ? this.calciteInputDatePickerOpen.emit()
  19049. : this.calciteInputDatePickerClose.emit();
  19050. }
  19051. };
  19052. this.setStartInput = (el) => {
  19053. this.startInput = el;
  19054. };
  19055. this.setEndInput = (el) => {
  19056. this.endInput = el;
  19057. };
  19058. this.deactivate = () => {
  19059. this.active = false;
  19060. };
  19061. this.keyDownHandler = (event) => {
  19062. if (event.key === "Enter" && !event.defaultPrevented) {
  19063. submitForm(this);
  19064. }
  19065. };
  19066. this.keyUpHandler = (e) => {
  19067. if (e.key === "Escape") {
  19068. this.active = false;
  19069. }
  19070. };
  19071. this.inputBlur = (e) => {
  19072. this.blur(e.detail);
  19073. };
  19074. this.startInputFocus = () => {
  19075. this.active = true;
  19076. this.focusedInput = "start";
  19077. };
  19078. this.endInputFocus = () => {
  19079. this.active = true;
  19080. this.focusedInput = "end";
  19081. };
  19082. this.inputInput = (e) => {
  19083. this.input(e.detail.value);
  19084. };
  19085. this.setMenuEl = (el) => {
  19086. if (el) {
  19087. this.menuEl = el;
  19088. this.createPopper();
  19089. }
  19090. };
  19091. this.setStartWrapper = (el) => {
  19092. this.startWrapper = el;
  19093. this.setReferenceEl();
  19094. };
  19095. this.setEndWrapper = (el) => {
  19096. this.endWrapper = el;
  19097. this.setReferenceEl();
  19098. };
  19099. /**
  19100. * Event handler for when the selected date changes
  19101. */
  19102. this.handleDateChange = (event) => {
  19103. if (this.range) {
  19104. return;
  19105. }
  19106. this.value = dateToISO(event.detail);
  19107. };
  19108. this.handleDateRangeChange = (event) => {
  19109. var _a, _b;
  19110. if (!this.range || !event.detail) {
  19111. return;
  19112. }
  19113. const { startDate, endDate } = event.detail;
  19114. this.start = dateToISO(startDate);
  19115. this.end = dateToISO(endDate);
  19116. this.value = [this.start, this.end];
  19117. if (this.shouldFocusRangeEnd()) {
  19118. (_a = this.endInput) === null || _a === void 0 ? void 0 : _a.setFocus();
  19119. }
  19120. else if (this.shouldFocusRangeStart()) {
  19121. (_b = this.startInput) === null || _b === void 0 ? void 0 : _b.setFocus();
  19122. }
  19123. };
  19124. }
  19125. handleDisabledChange(value) {
  19126. if (!value) {
  19127. this.active = false;
  19128. }
  19129. }
  19130. valueHandler(value) {
  19131. if (Array.isArray(value)) {
  19132. this.valueAsDate = value.map((v) => dateFromISO(v));
  19133. this.start = value[0];
  19134. this.end = value[1];
  19135. }
  19136. else if (value) {
  19137. this.valueAsDate = dateFromISO(value);
  19138. this.start = "";
  19139. this.end = "";
  19140. }
  19141. else {
  19142. this.valueAsDate = undefined;
  19143. this.start = undefined;
  19144. this.end = undefined;
  19145. }
  19146. }
  19147. flipPlacementsHandler() {
  19148. this.setFilteredPlacements();
  19149. }
  19150. onMinChanged(min) {
  19151. if (min) {
  19152. this.minAsDate = dateFromISO(min);
  19153. }
  19154. }
  19155. onMaxChanged(max) {
  19156. if (max) {
  19157. this.maxAsDate = dateFromISO(max);
  19158. }
  19159. }
  19160. activeHandler() {
  19161. if (!this.disabled) {
  19162. this.reposition();
  19163. return;
  19164. }
  19165. this.active = false;
  19166. }
  19167. //--------------------------------------------------------------------------
  19168. //
  19169. // Event Listeners
  19170. //
  19171. //--------------------------------------------------------------------------
  19172. handleDateOrRangeChange() {
  19173. this.calciteInputDatePickerChange.emit();
  19174. }
  19175. calciteDaySelectHandler() {
  19176. if (this.shouldFocusRangeStart() || this.shouldFocusRangeEnd()) {
  19177. return;
  19178. }
  19179. this.active = false;
  19180. }
  19181. // --------------------------------------------------------------------------
  19182. //
  19183. // Public Methods
  19184. //
  19185. // --------------------------------------------------------------------------
  19186. /** Updates the position of the component. */
  19187. async setFocus() {
  19188. var _a;
  19189. (_a = this.startInput) === null || _a === void 0 ? void 0 : _a.setFocus();
  19190. }
  19191. /** Updates the position of the component. */
  19192. async reposition() {
  19193. const { placement, popper, menuEl } = this;
  19194. const modifiers = this.getModifiers();
  19195. popper
  19196. ? await updatePopper({
  19197. el: menuEl,
  19198. modifiers,
  19199. placement,
  19200. popper
  19201. })
  19202. : this.createPopper();
  19203. }
  19204. // --------------------------------------------------------------------------
  19205. //
  19206. // Lifecycle
  19207. //
  19208. // --------------------------------------------------------------------------
  19209. connectedCallback() {
  19210. if (Array.isArray(this.value)) {
  19211. this.valueAsDate = this.value.map((v) => dateFromISO(v));
  19212. this.start = this.value[0];
  19213. this.end = this.value[1];
  19214. }
  19215. else if (this.value) {
  19216. this.valueAsDate = dateFromISO(this.value);
  19217. this.start = "";
  19218. this.end = "";
  19219. }
  19220. if (this.start) {
  19221. this.startAsDate = dateFromISO(this.start);
  19222. }
  19223. if (this.end) {
  19224. this.endAsDate = dateFromISO(this.end);
  19225. }
  19226. if (this.min) {
  19227. this.minAsDate = dateFromISO(this.min);
  19228. }
  19229. if (this.max) {
  19230. this.maxAsDate = dateFromISO(this.max);
  19231. }
  19232. this.createPopper();
  19233. connectLabel(this);
  19234. connectForm(this);
  19235. this.setFilteredPlacements();
  19236. }
  19237. async componentWillLoad() {
  19238. await this.loadLocaleData();
  19239. this.onMinChanged(this.min);
  19240. this.onMaxChanged(this.max);
  19241. }
  19242. disconnectedCallback() {
  19243. this.destroyPopper();
  19244. disconnectLabel(this);
  19245. disconnectForm(this);
  19246. }
  19247. componentDidRender() {
  19248. updateHostInteraction(this);
  19249. }
  19250. render() {
  19251. var _a, _b;
  19252. const { disabled } = this;
  19253. const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
  19254. const endDate = this.range
  19255. ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
  19256. : null;
  19257. const formattedEndDate = endDate ? endDate.toLocaleDateString(this.locale) : "";
  19258. const formattedDate = date ? date.toLocaleDateString(this.locale) : "";
  19259. return (hAsync(Host, { onBlur: this.deactivate, onKeyDown: this.keyDownHandler, onKeyUp: this.keyUpHandler, role: "application" }, this.localeData && (hAsync("div", { "aria-expanded": toAriaBoolean(this.active), class: "input-container", role: "application" }, hAsync("div", { class: "input-wrapper", ref: this.setStartWrapper }, hAsync("calcite-input", { class: `input ${this.layout === "vertical" && this.range ? `no-bottom-border` : ``}`, disabled: disabled, icon: "calendar", label: getLabelText(this), "number-button-type": "none", onCalciteInputBlur: this.inputBlur, onCalciteInputFocus: this.startInputFocus, onCalciteInputInput: this.inputInput, placeholder: (_a = this.localeData) === null || _a === void 0 ? void 0 : _a.placeholder, ref: this.setStartInput, scale: this.scale, type: "text", value: formattedDate })), hAsync("div", { "aria-hidden": toAriaBoolean(!this.active), class: {
  19260. "menu-container": true,
  19261. "menu-container--active": this.active
  19262. }, ref: this.setMenuEl }, hAsync("div", { class: {
  19263. ["calendar-picker-wrapper"]: true,
  19264. ["calendar-picker-wrapper--end"]: this.focusedInput === "end",
  19265. [CSS$D.animation]: true,
  19266. [CSS$D.animationActive]: this.active
  19267. }, onTransitionEnd: this.transitionEnd }, hAsync("calcite-date-picker", { activeRange: this.focusedInput, endAsDate: this.endAsDate, headingLevel: this.headingLevel, intlNextMonth: this.intlNextMonth, intlPrevMonth: this.intlPrevMonth, intlYear: this.intlYear, locale: this.locale, max: this.max, maxAsDate: this.maxAsDate, min: this.min, minAsDate: this.minAsDate, onCalciteDatePickerChange: this.handleDateChange, onCalciteDatePickerRangeChange: this.handleDateRangeChange, proximitySelectionDisabled: this.proximitySelectionDisabled, range: this.range, scale: this.scale, startAsDate: this.startAsDate, tabIndex: 0, valueAsDate: this.valueAsDate }))), this.range && this.layout === "horizontal" && (hAsync("div", { class: "horizontal-arrow-container" }, hAsync("calcite-icon", { flipRtl: true, icon: "arrow-right", scale: "s" }))), this.range && this.layout === "vertical" && this.scale !== "s" && (hAsync("div", { class: "vertical-arrow-container" }, hAsync("calcite-icon", { icon: "arrow-down", scale: "s" }))), this.range && (hAsync("div", { class: "input-wrapper", ref: this.setEndWrapper }, hAsync("calcite-input", { class: {
  19268. input: true,
  19269. "border-top-color-one": this.layout === "vertical" && this.range
  19270. }, disabled: disabled, icon: "calendar", "number-button-type": "none", onCalciteInputBlur: this.inputBlur, onCalciteInputFocus: this.endInputFocus, onCalciteInputInput: this.inputInput, placeholder: (_b = this.localeData) === null || _b === void 0 ? void 0 : _b.placeholder, ref: this.setEndInput, scale: this.scale, type: "text", value: formattedEndDate }))))), hAsync(HiddenFormInputSlot, { component: this })));
  19271. }
  19272. setReferenceEl() {
  19273. const { focusedInput, layout, endWrapper, startWrapper } = this;
  19274. this.referenceEl =
  19275. focusedInput === "end" || layout === "vertical"
  19276. ? endWrapper || startWrapper
  19277. : startWrapper || endWrapper;
  19278. this.createPopper();
  19279. }
  19280. onLabelClick() {
  19281. this.setFocus();
  19282. }
  19283. getModifiers() {
  19284. const flipModifier = {
  19285. name: "flip",
  19286. enabled: true
  19287. };
  19288. flipModifier.options = {
  19289. fallbackPlacements: this.filteredFlipPlacements || popperMenuComputedPlacements
  19290. };
  19291. const eventListenerModifier = {
  19292. name: "eventListeners",
  19293. enabled: this.active
  19294. };
  19295. return [flipModifier, eventListenerModifier];
  19296. }
  19297. createPopper() {
  19298. this.destroyPopper();
  19299. const { menuEl, placement, referenceEl, overlayPositioning } = this;
  19300. if (!menuEl || !referenceEl) {
  19301. return;
  19302. }
  19303. const modifiers = this.getModifiers();
  19304. this.popper = createPopper({
  19305. el: menuEl,
  19306. modifiers,
  19307. overlayPositioning,
  19308. placement,
  19309. referenceEl
  19310. });
  19311. }
  19312. destroyPopper() {
  19313. const { popper } = this;
  19314. if (popper) {
  19315. popper.destroy();
  19316. }
  19317. this.popper = null;
  19318. }
  19319. startWatcher(start) {
  19320. this.startAsDate = dateFromISO(start);
  19321. }
  19322. endWatcher(end) {
  19323. this.endAsDate = dateFromISO(end);
  19324. }
  19325. async loadLocaleData() {
  19326. {
  19327. return;
  19328. }
  19329. }
  19330. clearCurrentValue() {
  19331. if (!this.range) {
  19332. if (typeof this.value === "string" && this.value) {
  19333. this.calciteDatePickerChange.emit();
  19334. }
  19335. this.value = "";
  19336. return;
  19337. }
  19338. const { focusedInput } = this;
  19339. if (focusedInput === "start") {
  19340. if (this.start) {
  19341. this.calciteDatePickerRangeChange.emit();
  19342. }
  19343. this.value = Array.isArray(this.value) ? ["", this.value[1] || ""] : [""];
  19344. this.start = undefined;
  19345. }
  19346. else if (focusedInput === "end") {
  19347. if (this.end) {
  19348. this.calciteDatePickerRangeChange.emit();
  19349. }
  19350. this.value = Array.isArray(this.value) ? [this.value[0] || "", ""] : ["", ""];
  19351. this.end = undefined;
  19352. }
  19353. }
  19354. /**
  19355. * If inputted string is a valid date, update value/active
  19356. */
  19357. input(value) {
  19358. const date = this.getDateFromInput(value);
  19359. if (!date) {
  19360. this.clearCurrentValue();
  19361. return;
  19362. }
  19363. if (!this.range) {
  19364. this.value = dateToISO(date);
  19365. this.calciteDatePickerChange.emit(date);
  19366. return;
  19367. }
  19368. const { focusedInput } = this;
  19369. if (focusedInput === "start") {
  19370. if (!this.startAsDate || !sameDate(date, this.startAsDate)) {
  19371. const startDateISO = dateToISO(date);
  19372. this.value = Array.isArray(this.value)
  19373. ? [startDateISO, this.value[1] || ""]
  19374. : [startDateISO];
  19375. this.start = startDateISO;
  19376. this.calciteDatePickerRangeChange.emit({
  19377. startDate: date,
  19378. endDate: this.endAsDate
  19379. });
  19380. }
  19381. }
  19382. else if (focusedInput === "end") {
  19383. if (!this.endAsDate || !sameDate(date, this.endAsDate)) {
  19384. const endDateISO = dateToISO(date);
  19385. this.value = Array.isArray(this.value)
  19386. ? [this.value[0] || "", endDateISO]
  19387. : ["", endDateISO];
  19388. this.end = endDateISO;
  19389. this.calciteDatePickerRangeChange.emit({
  19390. startDate: this.startAsDate,
  19391. endDate: date
  19392. });
  19393. }
  19394. }
  19395. }
  19396. /**
  19397. * Clean up invalid date from input on blur
  19398. */
  19399. blur(target) {
  19400. const { locale, focusedInput, endAsDate, range, startAsDate, valueAsDate } = this;
  19401. const date = this.getDateFromInput(target.value);
  19402. if (!date) {
  19403. if (!range && valueAsDate) {
  19404. target.value = Array.isArray(valueAsDate)
  19405. ? valueAsDate[focusedInput === "end" ? 1 : 0].toLocaleDateString(locale)
  19406. : valueAsDate.toLocaleDateString(locale);
  19407. }
  19408. else if (focusedInput === "start" && startAsDate) {
  19409. target.value = startAsDate.toLocaleDateString(locale);
  19410. }
  19411. else if (focusedInput === "end" && endAsDate) {
  19412. target.value = endAsDate.toLocaleDateString(locale);
  19413. }
  19414. }
  19415. }
  19416. shouldFocusRangeStart() {
  19417. return !!(this.endAsDate &&
  19418. !this.startAsDate &&
  19419. this.focusedInput === "end" &&
  19420. this.startInput);
  19421. }
  19422. shouldFocusRangeEnd() {
  19423. return !!(this.startAsDate &&
  19424. !this.endAsDate &&
  19425. this.focusedInput === "start" &&
  19426. this.endInput);
  19427. }
  19428. /**
  19429. * Find a date from input string
  19430. * return false if date is invalid, or out of range
  19431. */
  19432. getDateFromInput(value) {
  19433. if (!this.localeData) {
  19434. return false;
  19435. }
  19436. const { separator } = this.localeData;
  19437. const { day, month, year } = parseDateString(value, this.localeData);
  19438. const validDay = day > 0;
  19439. const validMonth = month > -1;
  19440. const date = new Date(year, month, day);
  19441. date.setFullYear(year);
  19442. const validDate = !isNaN(date.getTime());
  19443. const validLength = value.split(separator).filter((c) => c).length > 2;
  19444. const validYear = year.toString().length > 0;
  19445. if (validDay &&
  19446. validMonth &&
  19447. validDate &&
  19448. validLength &&
  19449. validYear &&
  19450. inRange(date, this.min, this.max)) {
  19451. return date;
  19452. }
  19453. return false;
  19454. }
  19455. get el() { return getElement(this); }
  19456. static get watchers() { return {
  19457. "disabled": ["handleDisabledChange"],
  19458. "value": ["valueHandler"],
  19459. "flipPlacements": ["flipPlacementsHandler"],
  19460. "min": ["onMinChanged"],
  19461. "max": ["onMaxChanged"],
  19462. "active": ["activeHandler"],
  19463. "layout": ["setReferenceEl"],
  19464. "focusedInput": ["setReferenceEl"],
  19465. "start": ["startWatcher"],
  19466. "end": ["endWatcher"],
  19467. "locale": ["loadLocaleData"]
  19468. }; }
  19469. static get style() { return inputDatePickerCss; }
  19470. static get cmpMeta() { return {
  19471. "$flags$": 9,
  19472. "$tagName$": "calcite-input-date-picker",
  19473. "$members$": {
  19474. "disabled": [516],
  19475. "value": [1025],
  19476. "flipPlacements": [16],
  19477. "headingLevel": [2, "heading-level"],
  19478. "valueAsDate": [1040],
  19479. "startAsDate": [1040],
  19480. "endAsDate": [1040],
  19481. "minAsDate": [1040],
  19482. "maxAsDate": [1040],
  19483. "min": [1025],
  19484. "max": [1025],
  19485. "active": [1540],
  19486. "name": [1],
  19487. "intlPrevMonth": [1, "intl-prev-month"],
  19488. "intlNextMonth": [1, "intl-next-month"],
  19489. "intlYear": [1, "intl-year"],
  19490. "locale": [1],
  19491. "scale": [513],
  19492. "placement": [513],
  19493. "range": [516],
  19494. "required": [516],
  19495. "start": [1025],
  19496. "end": [1025],
  19497. "overlayPositioning": [1, "overlay-positioning"],
  19498. "proximitySelectionDisabled": [4, "proximity-selection-disabled"],
  19499. "layout": [513],
  19500. "focusedInput": [32],
  19501. "localeData": [32],
  19502. "setFocus": [64],
  19503. "reposition": [64]
  19504. },
  19505. "$listeners$": [[0, "calciteDatePickerChange", "handleDateOrRangeChange"], [0, "calciteDatePickerRangeChange", "handleDateOrRangeChange"], [0, "calciteDaySelect", "calciteDaySelectHandler"]],
  19506. "$lazyBundleId$": "-",
  19507. "$attrsToReflect$": [["disabled", "disabled"], ["active", "active"], ["scale", "scale"], ["placement", "placement"], ["range", "range"], ["required", "required"], ["layout", "layout"]]
  19508. }; }
  19509. }
  19510. var StatusIconDefaults;
  19511. (function (StatusIconDefaults) {
  19512. StatusIconDefaults["valid"] = "check-circle";
  19513. StatusIconDefaults["invalid"] = "exclamation-mark-triangle";
  19514. StatusIconDefaults["idle"] = "information";
  19515. })(StatusIconDefaults || (StatusIconDefaults = {}));
  19516. const inputMessageCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-message:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input-message{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-message{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-message{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-message{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-message{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-input-message:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-message-h{display:none}/*!@:host([active][scale=m]),\n:host([active][scale=l])*/[active][scale=m].sc-calcite-input-message-h,[active][scale=l].sc-calcite-input-message-h{--calcite-input-message-spacing-value:0.25rem}/*!@:host*/.sc-calcite-input-message-h{visibility:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;height:0px;width:100%;-ms-flex-align:center;align-items:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);opacity:0;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@:host([active])*/[active].sc-calcite-input-message-h{visibility:visible;height:auto;opacity:1;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@:host([active][scale=m]),\n:host([active][scale=l])*/[active][scale=m].sc-calcite-input-message-h,[active][scale=l].sc-calcite-input-message-h{margin-top:var(--calcite-input-message-spacing-value)}/*!@.calcite-input-message-icon*/.calcite-input-message-icon.sc-calcite-input-message{pointer-events:none;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}/*!@:host([status=invalid]) .calcite-input-message-icon*/[status=invalid].sc-calcite-input-message-h .calcite-input-message-icon.sc-calcite-input-message{color:var(--calcite-ui-danger)}/*!@:host([status=warning]) .calcite-input-message-icon*/[status=warning].sc-calcite-input-message-h .calcite-input-message-icon.sc-calcite-input-message{color:var(--calcite-ui-warning)}/*!@:host([status=valid]) .calcite-input-message-icon*/[status=valid].sc-calcite-input-message-h .calcite-input-message-icon.sc-calcite-input-message{color:var(--calcite-ui-success)}/*!@:host([status=idle]) .calcite-input-message-icon*/[status=idle].sc-calcite-input-message-h .calcite-input-message-icon.sc-calcite-input-message{color:var(--calcite-ui-brand)}/*!@:host([status][active])*/[status][active].sc-calcite-input-message-h{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@:host([status][active][scale=s])*/[status][active][scale=s].sc-calcite-input-message-h{font-size:var(--calcite-font-size--3);line-height:0.75rem}/*!@:host([status][active][scale=m])*/[status][active][scale=m].sc-calcite-input-message-h{margin-top:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([status][active][scale=l])*/[status][active][scale=l].sc-calcite-input-message-h{margin-top:0.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}";
  19517. /**
  19518. * @slot - A slot for adding text.
  19519. */
  19520. class InputMessage {
  19521. constructor(hostRef) {
  19522. registerInstance(this, hostRef);
  19523. //--------------------------------------------------------------------------
  19524. //
  19525. // Properties
  19526. //
  19527. //--------------------------------------------------------------------------
  19528. /** Indicates whether the message is displayed. */
  19529. this.active = false;
  19530. /** specify the scale of the input, defaults to m */
  19531. this.scale = "m";
  19532. /** specify the status of the input field, determines message and icons */
  19533. this.status = "idle";
  19534. }
  19535. handleIconEl() {
  19536. this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
  19537. }
  19538. //--------------------------------------------------------------------------
  19539. //
  19540. // Lifecycle
  19541. //
  19542. //--------------------------------------------------------------------------
  19543. connectedCallback() {
  19544. this.status = getElementProp(this.el, "status", this.status);
  19545. this.scale = getElementProp(this.el, "scale", this.scale);
  19546. this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
  19547. }
  19548. render() {
  19549. const hidden = !this.active;
  19550. return (hAsync(Host, { "calcite-hydrated-hidden": hidden }, this.renderIcon(this.requestedIcon), hAsync("slot", null)));
  19551. }
  19552. //--------------------------------------------------------------------------
  19553. //
  19554. // Private Methods
  19555. //
  19556. //--------------------------------------------------------------------------
  19557. renderIcon(iconName) {
  19558. if (iconName) {
  19559. return hAsync("calcite-icon", { class: "calcite-input-message-icon", icon: iconName, scale: "s" });
  19560. }
  19561. }
  19562. get el() { return getElement(this); }
  19563. static get watchers() { return {
  19564. "status": ["handleIconEl"],
  19565. "icon": ["handleIconEl"]
  19566. }; }
  19567. static get style() { return inputMessageCss; }
  19568. static get cmpMeta() { return {
  19569. "$flags$": 9,
  19570. "$tagName$": "calcite-input-message",
  19571. "$members$": {
  19572. "active": [516],
  19573. "icon": [520],
  19574. "scale": [1537],
  19575. "status": [1537],
  19576. "type": [513]
  19577. },
  19578. "$listeners$": undefined,
  19579. "$lazyBundleId$": "-",
  19580. "$attrsToReflect$": [["active", "active"], ["icon", "icon"], ["scale", "scale"], ["status", "status"], ["type", "type"]]
  19581. }; }
  19582. }
  19583. const maxTenthForMinuteAndSecond = 5;
  19584. function createLocaleDateTimeFormatter(locale, includeSeconds = true) {
  19585. try {
  19586. const options = {
  19587. hour: "2-digit",
  19588. minute: "2-digit",
  19589. timeZone: "UTC"
  19590. };
  19591. if (includeSeconds) {
  19592. options.second = "2-digit";
  19593. }
  19594. return new Intl.DateTimeFormat(locale, options);
  19595. }
  19596. catch (e) {
  19597. throw new Error(`Invalid locale supplied while attempting to create a DateTime formatter: ${locale}`);
  19598. }
  19599. }
  19600. function formatTimePart(number) {
  19601. const numberAsString = number.toString();
  19602. return number >= 0 && number <= 9 ? numberAsString.padStart(2, "0") : numberAsString;
  19603. }
  19604. function formatTimeString(value) {
  19605. if (!isValidTime(value)) {
  19606. return null;
  19607. }
  19608. const [hourString, minuteString, secondString] = value.split(":");
  19609. const hour = formatTimePart(parseInt(hourString));
  19610. const minute = formatTimePart(parseInt(minuteString));
  19611. if (secondString) {
  19612. const second = formatTimePart(parseInt(secondString));
  19613. return `${hour}:${minute}:${second}`;
  19614. }
  19615. return `${hour}:${minute}`;
  19616. }
  19617. function getLocaleHourCycle(locale) {
  19618. const formatter = createLocaleDateTimeFormatter(locale);
  19619. const parts = formatter.formatToParts(new Date(Date.UTC(0, 0, 0, 0, 0, 0)));
  19620. return getLocalizedTimePart("meridiem", parts) ? "12" : "24";
  19621. }
  19622. function getLocalizedTimePart(part, parts) {
  19623. var _a, _b, _c, _d;
  19624. if (!part || !parts) {
  19625. return null;
  19626. }
  19627. if (part === "hourSuffix") {
  19628. const hourIndex = parts.indexOf(parts.find(({ type }) => type === "hour"));
  19629. const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
  19630. const hourSuffix = parts[hourIndex + 1];
  19631. return hourSuffix && hourSuffix.type === "literal" && minuteIndex - hourIndex === 2
  19632. ? ((_a = hourSuffix.value) === null || _a === void 0 ? void 0 : _a.trim()) || null
  19633. : null;
  19634. }
  19635. if (part === "minuteSuffix") {
  19636. const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
  19637. const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
  19638. const minuteSuffix = parts[minuteIndex + 1];
  19639. return minuteSuffix && minuteSuffix.type === "literal" && secondIndex - minuteIndex === 2
  19640. ? ((_b = minuteSuffix.value) === null || _b === void 0 ? void 0 : _b.trim()) || null
  19641. : null;
  19642. }
  19643. if (part === "secondSuffix") {
  19644. const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
  19645. const secondSuffix = parts[secondIndex + 1];
  19646. return secondSuffix && secondSuffix.type === "literal" ? ((_c = secondSuffix.value) === null || _c === void 0 ? void 0 : _c.trim()) || null : null;
  19647. }
  19648. return ((_d = parts.find(({ type }) => (part == "meridiem" ? type === "dayPeriod" : type === part))) === null || _d === void 0 ? void 0 : _d.value) || null;
  19649. }
  19650. function getMeridiem(hour) {
  19651. if (!isValidNumber(hour)) {
  19652. return null;
  19653. }
  19654. const hourAsNumber = parseInt(hour);
  19655. return hourAsNumber >= 0 && hourAsNumber <= 11 ? "AM" : "PM";
  19656. }
  19657. function isValidTime(value) {
  19658. if (!value || value.startsWith(":") || value.endsWith(":")) {
  19659. return false;
  19660. }
  19661. const splitValue = value.split(":");
  19662. const validLength = splitValue.length > 1 && splitValue.length < 4;
  19663. if (!validLength) {
  19664. return false;
  19665. }
  19666. const [hour, minute, second] = splitValue;
  19667. const hourAsNumber = parseInt(splitValue[0]);
  19668. const minuteAsNumber = parseInt(splitValue[1]);
  19669. const secondAsNumber = parseInt(splitValue[2]);
  19670. const hourValid = isValidNumber(hour) && hourAsNumber >= 0 && hourAsNumber < 24;
  19671. const minuteValid = isValidNumber(minute) && minuteAsNumber >= 0 && minuteAsNumber < 60;
  19672. const secondValid = isValidNumber(second) && secondAsNumber >= 0 && secondAsNumber < 60;
  19673. if ((hourValid && minuteValid && !second) || (hourValid && minuteValid && secondValid)) {
  19674. return true;
  19675. }
  19676. }
  19677. function isValidTimePart(value, part) {
  19678. if (part === "meridiem") {
  19679. return value === "AM" || value === "PM";
  19680. }
  19681. if (!isValidNumber(value)) {
  19682. return false;
  19683. }
  19684. const valueAsNumber = Number(value);
  19685. return part === "hour" ? valueAsNumber >= 0 && valueAsNumber < 24 : valueAsNumber >= 0 && valueAsNumber < 60;
  19686. }
  19687. function localizeTimePart(value, part, locale) {
  19688. if (!isValidTimePart(value, part)) {
  19689. return;
  19690. }
  19691. const valueAsNumber = parseInt(value);
  19692. const date = new Date(Date.UTC(0, 0, 0, part === "hour" ? valueAsNumber : part === "meridiem" ? (value === "AM" ? 0 : 12) : 0, part === "minute" ? valueAsNumber : 0, part === "second" ? valueAsNumber : 0));
  19693. if (!date) {
  19694. return;
  19695. }
  19696. const formatter = createLocaleDateTimeFormatter(locale);
  19697. const parts = formatter.formatToParts(date);
  19698. return getLocalizedTimePart(part, parts);
  19699. }
  19700. function localizeTimeString(value, locale = "en", includeSeconds = true) {
  19701. if (!isValidTime(value)) {
  19702. return null;
  19703. }
  19704. const { hour, minute, second = "0" } = parseTimeString(value);
  19705. const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
  19706. const formatter = createLocaleDateTimeFormatter(locale, includeSeconds);
  19707. return (formatter === null || formatter === void 0 ? void 0 : formatter.format(dateFromTimeString)) || null;
  19708. }
  19709. function localizeTimeStringToParts(value, locale = "en") {
  19710. if (!isValidTime(value)) {
  19711. return null;
  19712. }
  19713. const { hour, minute, second = "0" } = parseTimeString(value);
  19714. const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
  19715. if (dateFromTimeString) {
  19716. const formatter = createLocaleDateTimeFormatter(locale);
  19717. const parts = formatter.formatToParts(dateFromTimeString);
  19718. return {
  19719. localizedHour: getLocalizedTimePart("hour", parts),
  19720. localizedHourSuffix: getLocalizedTimePart("hourSuffix", parts),
  19721. localizedMinute: getLocalizedTimePart("minute", parts),
  19722. localizedMinuteSuffix: getLocalizedTimePart("minuteSuffix", parts),
  19723. localizedSecond: getLocalizedTimePart("second", parts),
  19724. localizedSecondSuffix: getLocalizedTimePart("secondSuffix", parts),
  19725. localizedMeridiem: getLocalizedTimePart("meridiem", parts)
  19726. };
  19727. }
  19728. return null;
  19729. }
  19730. function getTimeParts(value, locale = "en") {
  19731. if (!isValidTime(value)) {
  19732. return null;
  19733. }
  19734. const { hour, minute, second = "0" } = parseTimeString(value);
  19735. const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
  19736. if (dateFromTimeString) {
  19737. const formatter = createLocaleDateTimeFormatter(locale);
  19738. const parts = formatter.formatToParts(dateFromTimeString);
  19739. return parts;
  19740. }
  19741. return null;
  19742. }
  19743. function parseTimeString(value) {
  19744. if (isValidTime(value)) {
  19745. const [hour, minute, second] = value.split(":");
  19746. return {
  19747. hour,
  19748. minute,
  19749. second
  19750. };
  19751. }
  19752. return {
  19753. hour: null,
  19754. minute: null,
  19755. second: null
  19756. };
  19757. }
  19758. const inputTimePickerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-time-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input-time-picker{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-time-picker{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-time-picker{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-time-picker{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-time-picker{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-input-time-picker:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-time-picker-h{display:none}/*!@:host*/.sc-calcite-input-time-picker-h{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-time-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-time-picker-h[disabled] .sc-calcite-input-time-picker-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-time-picker-h [calcite-hydrated][disabled].sc-calcite-input-time-picker{opacity:1}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-time-picker-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  19759. class InputTimePicker {
  19760. constructor(hostRef) {
  19761. registerInstance(this, hostRef);
  19762. this.calciteInputTimePickerChange = createEvent(this, "calciteInputTimePickerChange", 7);
  19763. //--------------------------------------------------------------------------
  19764. //
  19765. // Properties
  19766. //
  19767. //--------------------------------------------------------------------------
  19768. /** The active state of the time input */
  19769. this.active = false;
  19770. /** The disabled state of the time input */
  19771. this.disabled = false;
  19772. /**
  19773. * BCP 47 language tag for desired language and country format
  19774. * @internal
  19775. */
  19776. this.locale = document.documentElement.lang || navigator.language || "en";
  19777. /**
  19778. * When true, makes the component required for form-submission.
  19779. *
  19780. * @internal
  19781. */
  19782. this.required = false;
  19783. /** The scale (size) of the time input */
  19784. this.scale = "m";
  19785. /**
  19786. * Determines where the popover will be positioned relative to the input.
  19787. * @see [PopperPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/popper.ts#L25)
  19788. */
  19789. this.placement = "auto";
  19790. /** number (seconds) that specifies the granularity that the value must adhere to */
  19791. this.step = 60;
  19792. /** The selected time in UTC (always 24-hour format) */
  19793. this.value = null;
  19794. /** whether the value of the input was changed as a result of user typing or not */
  19795. this.internalValueChange = false;
  19796. this.previousValidValue = null;
  19797. this.referenceElementId = `input-time-picker-${guid()}`;
  19798. //--------------------------------------------------------------------------
  19799. //
  19800. // Event Listeners
  19801. //
  19802. //--------------------------------------------------------------------------
  19803. this.calciteInputBlurHandler = () => {
  19804. this.active = false;
  19805. const shouldIncludeSeconds = this.shouldIncludeSeconds();
  19806. const localizedInputValue = localizeTimeString(this.calciteInputEl.value, this.locale, shouldIncludeSeconds);
  19807. this.setInputValue(localizedInputValue || localizeTimeString(this.value, this.locale, shouldIncludeSeconds));
  19808. };
  19809. this.calciteInputFocusHandler = () => {
  19810. this.active = true;
  19811. };
  19812. this.calciteInputInputHandler = (event) => {
  19813. const target = event.target;
  19814. this.setValue({ value: target.value });
  19815. };
  19816. this.timePickerChangeHandler = (event) => {
  19817. event.stopPropagation();
  19818. const target = event.target;
  19819. const value = target.value;
  19820. this.setValue({ value, origin: "time-picker" });
  19821. };
  19822. // --------------------------------------------------------------------------
  19823. //
  19824. // Private Methods
  19825. //
  19826. // --------------------------------------------------------------------------
  19827. this.keyDownHandler = (event) => {
  19828. if (event.key === "Enter" && !event.defaultPrevented) {
  19829. submitForm(this);
  19830. }
  19831. };
  19832. this.setCalcitePopoverEl = (el) => {
  19833. this.popoverEl = el;
  19834. };
  19835. this.setCalciteInputEl = (el) => {
  19836. this.calciteInputEl = el;
  19837. };
  19838. this.setCalciteTimePickerEl = (el) => {
  19839. this.calciteTimePickerEl = el;
  19840. };
  19841. this.setInputValue = (newInputValue) => {
  19842. if (!this.calciteInputEl) {
  19843. return;
  19844. }
  19845. this.calciteInputEl.value = newInputValue;
  19846. };
  19847. this.setValue = ({ value, origin = "input" }) => {
  19848. const previousValue = this.value;
  19849. const newValue = formatTimeString(value);
  19850. const newLocalizedValue = localizeTimeString(newValue, this.locale, this.shouldIncludeSeconds());
  19851. this.internalValueChange = origin !== "external" && origin !== "loading";
  19852. const shouldEmit = origin !== "loading" &&
  19853. origin !== "external" &&
  19854. ((value !== this.previousValidValue && !value) ||
  19855. !!(!this.previousValidValue && newValue) ||
  19856. (newValue !== this.previousValidValue && newValue));
  19857. if (value) {
  19858. if (shouldEmit) {
  19859. this.previousValidValue = newValue;
  19860. }
  19861. if (newValue && newValue !== this.value) {
  19862. this.value = newValue;
  19863. }
  19864. this.localizedValue = newLocalizedValue;
  19865. }
  19866. else {
  19867. this.value = value;
  19868. this.localizedValue = null;
  19869. }
  19870. if (origin === "time-picker" || origin === "external") {
  19871. this.setInputValue(newLocalizedValue);
  19872. }
  19873. if (shouldEmit) {
  19874. const changeEvent = this.calciteInputTimePickerChange.emit();
  19875. if (changeEvent.defaultPrevented) {
  19876. this.internalValueChange = false;
  19877. this.value = previousValue;
  19878. this.setInputValue(previousValue);
  19879. this.previousValidValue = previousValue;
  19880. }
  19881. else {
  19882. this.previousValidValue = newValue;
  19883. }
  19884. }
  19885. };
  19886. }
  19887. activeHandler() {
  19888. if (this.disabled) {
  19889. this.active = false;
  19890. return;
  19891. }
  19892. this.reposition();
  19893. }
  19894. handleDisabledChange(value) {
  19895. if (!value) {
  19896. this.active = false;
  19897. }
  19898. }
  19899. localeWatcher(newLocale) {
  19900. this.setInputValue(localizeTimeString(this.value, newLocale, this.shouldIncludeSeconds()));
  19901. }
  19902. valueWatcher(newValue) {
  19903. if (!this.internalValueChange) {
  19904. this.setValue({ value: newValue, origin: "external" });
  19905. }
  19906. this.internalValueChange = false;
  19907. }
  19908. clickHandler(event) {
  19909. if (event.composedPath().includes(this.calciteTimePickerEl)) {
  19910. return;
  19911. }
  19912. this.setFocus();
  19913. }
  19914. keyUpHandler(event) {
  19915. if (event.key === "Escape" && this.active) {
  19916. this.active = false;
  19917. }
  19918. }
  19919. timePickerBlurHandler(event) {
  19920. event.preventDefault();
  19921. event.stopPropagation();
  19922. this.active = false;
  19923. }
  19924. timePickerFocusHandler(event) {
  19925. event.preventDefault();
  19926. event.stopPropagation();
  19927. this.active = true;
  19928. }
  19929. // --------------------------------------------------------------------------
  19930. //
  19931. // Public Methods
  19932. //
  19933. // --------------------------------------------------------------------------
  19934. /** Sets focus on the component. */
  19935. async setFocus() {
  19936. this.calciteInputEl.setFocus();
  19937. }
  19938. /** Updates the position of the component. */
  19939. async reposition() {
  19940. var _a;
  19941. (_a = this.popoverEl) === null || _a === void 0 ? void 0 : _a.reposition();
  19942. }
  19943. onLabelClick() {
  19944. this.setFocus();
  19945. }
  19946. shouldIncludeSeconds() {
  19947. return this.step < 60;
  19948. }
  19949. //--------------------------------------------------------------------------
  19950. //
  19951. // Lifecycle
  19952. //
  19953. //--------------------------------------------------------------------------
  19954. connectedCallback() {
  19955. if (this.value) {
  19956. this.setValue({ value: isValidTime(this.value) ? this.value : undefined, origin: "loading" });
  19957. }
  19958. connectLabel(this);
  19959. connectForm(this);
  19960. }
  19961. componentDidLoad() {
  19962. this.setInputValue(this.localizedValue);
  19963. }
  19964. disconnectedCallback() {
  19965. disconnectLabel(this);
  19966. disconnectForm(this);
  19967. }
  19968. componentDidRender() {
  19969. updateHostInteraction(this);
  19970. }
  19971. // --------------------------------------------------------------------------
  19972. //
  19973. // Render Methods
  19974. //
  19975. // --------------------------------------------------------------------------
  19976. render() {
  19977. const popoverId = `${this.referenceElementId}-popover`;
  19978. return (hAsync(Host, { onKeyDown: this.keyDownHandler }, hAsync("div", { "aria-controls": popoverId, "aria-haspopup": "dialog", "aria-label": this.name, "aria-owns": popoverId, id: this.referenceElementId, role: "combobox" }, hAsync("calcite-input", { disabled: this.disabled, icon: "clock", label: getLabelText(this), onCalciteInputBlur: this.calciteInputBlurHandler, onCalciteInputFocus: this.calciteInputFocusHandler, onCalciteInputInput: this.calciteInputInputHandler, ref: this.setCalciteInputEl, scale: this.scale, step: this.step })), hAsync("calcite-popover", { id: popoverId, label: "Time Picker", open: this.active, placement: this.placement, ref: this.setCalcitePopoverEl, referenceElement: this.referenceElementId }, hAsync("calcite-time-picker", { intlHour: this.intlHour, intlHourDown: this.intlHourDown, intlHourUp: this.intlHourUp, intlMeridiem: this.intlMeridiem, intlMeridiemDown: this.intlMeridiemDown, intlMeridiemUp: this.intlMeridiemUp, intlMinute: this.intlMinute, intlMinuteDown: this.intlMinuteDown, intlMinuteUp: this.intlMinuteUp, intlSecond: this.intlSecond, intlSecondDown: this.intlSecondDown, intlSecondUp: this.intlSecondUp, lang: this.locale, onCalciteTimePickerChange: this.timePickerChangeHandler, ref: this.setCalciteTimePickerEl, scale: this.scale, step: this.step, value: this.value })), hAsync(HiddenFormInputSlot, { component: this })));
  19979. }
  19980. get el() { return getElement(this); }
  19981. static get watchers() { return {
  19982. "active": ["activeHandler"],
  19983. "disabled": ["handleDisabledChange"],
  19984. "locale": ["localeWatcher"],
  19985. "value": ["valueWatcher"]
  19986. }; }
  19987. static get style() { return inputTimePickerCss; }
  19988. static get cmpMeta() { return {
  19989. "$flags$": 9,
  19990. "$tagName$": "calcite-input-time-picker",
  19991. "$members$": {
  19992. "active": [1540],
  19993. "disabled": [516],
  19994. "intlHour": [1, "intl-hour"],
  19995. "intlHourDown": [1, "intl-hour-down"],
  19996. "intlHourUp": [1, "intl-hour-up"],
  19997. "intlMeridiem": [1, "intl-meridiem"],
  19998. "intlMeridiemDown": [1, "intl-meridiem-down"],
  19999. "intlMeridiemUp": [1, "intl-meridiem-up"],
  20000. "intlMinute": [1, "intl-minute"],
  20001. "intlMinuteDown": [1, "intl-minute-down"],
  20002. "intlMinuteUp": [1, "intl-minute-up"],
  20003. "intlSecond": [1, "intl-second"],
  20004. "intlSecondDown": [1, "intl-second-down"],
  20005. "intlSecondUp": [1, "intl-second-up"],
  20006. "locale": [1025, "lang"],
  20007. "name": [1],
  20008. "required": [516],
  20009. "scale": [513],
  20010. "placement": [513],
  20011. "step": [2],
  20012. "value": [1025],
  20013. "localizedValue": [32],
  20014. "setFocus": [64],
  20015. "reposition": [64]
  20016. },
  20017. "$listeners$": [[0, "click", "clickHandler"], [0, "keyup", "keyUpHandler"], [0, "calciteTimePickerBlur", "timePickerBlurHandler"], [0, "calciteTimePickerFocus", "timePickerFocusHandler"]],
  20018. "$lazyBundleId$": "-",
  20019. "$attrsToReflect$": [["active", "active"], ["disabled", "disabled"], ["required", "required"], ["scale", "scale"], ["placement", "placement"]]
  20020. }; }
  20021. }
  20022. const CSS$r = {
  20023. container: "container"
  20024. };
  20025. const labelCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-label:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-label{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-label{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-label{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-label{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-label{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-label:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-label-h{display:none}/*!@:host*/.sc-calcite-label-h{display:inline}/*!@:host([alignment=start])*/[alignment=start].sc-calcite-label-h{text-align:start}/*!@:host([alignment=end])*/[alignment=end].sc-calcite-label-h{text-align:end}/*!@:host([alignment=center])*/[alignment=center].sc-calcite-label-h{text-align:center}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-label-h .container.sc-calcite-label{margin-bottom:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-label-h .container.sc-calcite-label{margin-bottom:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-label-h .container.sc-calcite-label{margin-bottom:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host .container*/.sc-calcite-label-h .container.sc-calcite-label{margin-top:0px;margin-right:0px;margin-left:0px;width:100%;line-height:1.375;color:var(--calcite-ui-text-1)}/*!@:host([layout=default]) .container*/[layout=default].sc-calcite-label-h .container.sc-calcite-label{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:0.25rem}/*!@:host([layout=inline]) .container, :host([layout=inline-space-between]) .container*/[layout=inline].sc-calcite-label-h .container.sc-calcite-label,[layout=inline-space-between].sc-calcite-label-h .container.sc-calcite-label{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;gap:0.5rem}/*!@:host([layout=inline][scale=l]) .container*/[layout=inline][scale=l].sc-calcite-label-h .container.sc-calcite-label{gap:0.75rem}/*!@:host([layout=inline-space-between]) .container*/[layout=inline-space-between].sc-calcite-label-h .container.sc-calcite-label{-ms-flex-pack:justify;justify-content:space-between}/*!@:host([disabled])*/[disabled].sc-calcite-label-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) > .container*/[disabled].sc-calcite-label-h>.container.sc-calcite-label{pointer-events:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted(*)*/.sc-calcite-label-h[disabled] .sc-calcite-label-s>*{pointer-events:none}/*!@:host([disabled]) ::slotted(*[disabled]), :host([disabled]) ::slotted(*[disabled] *)*/.sc-calcite-label-h[disabled] .sc-calcite-label-s>*[disabled],.sc-calcite-label-h[disabled] .sc-calcite-label-s>*[disabled] *{--tw-bg-opacity:1}/*!@:host([disabled]) ::slotted(calcite-input-message:not([active]))*/.sc-calcite-label-h[disabled] .sc-calcite-label-s>calcite-input-message:not([active]){--tw-bg-opacity:0}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-label-h[disabled] .sc-calcite-label-s>[calcite-hydrated][disabled],[disabled].sc-calcite-label-h [calcite-hydrated][disabled].sc-calcite-label{opacity:1}/*!@:host([disable-spacing]) .container*/[disable-spacing].sc-calcite-label-h .container.sc-calcite-label{margin:0px;gap:0px}";
  20026. /**
  20027. * @slot - A slot for adding text and a component that can be labeled.
  20028. */
  20029. class Label {
  20030. constructor(hostRef) {
  20031. registerInstance(this, hostRef);
  20032. this.calciteInternalLabelClick = createEvent(this, "calciteInternalLabelClick", 3);
  20033. //--------------------------------------------------------------------------
  20034. //
  20035. // Properties
  20036. //
  20037. //--------------------------------------------------------------------------
  20038. /** specify the text alignment of the label */
  20039. this.alignment = "start";
  20040. /**
  20041. * specify the status of the label and any child input / input messages
  20042. * @deprecated set directly on child element instead
  20043. */
  20044. this.status = "idle";
  20045. /** specify the scale of the label, defaults to m */
  20046. this.scale = "m";
  20047. /** is the wrapped element positioned inline with the label slotted text */
  20048. this.layout = "default";
  20049. /** eliminates any space around the label */
  20050. this.disableSpacing = false;
  20051. /**
  20052. * is the label disabled
  20053. *
  20054. * @deprecated use the `disabled` property on the interactive components instead
  20055. */
  20056. this.disabled = false;
  20057. //--------------------------------------------------------------------------
  20058. //
  20059. // Private Methods
  20060. //
  20061. //--------------------------------------------------------------------------
  20062. this.labelClickHandler = (event) => {
  20063. this.calciteInternalLabelClick.emit({
  20064. sourceEvent: event
  20065. });
  20066. };
  20067. }
  20068. //--------------------------------------------------------------------------
  20069. //
  20070. // Lifecycle
  20071. //
  20072. //--------------------------------------------------------------------------
  20073. connectedCallback() {
  20074. document.dispatchEvent(new CustomEvent(labelConnectedEvent));
  20075. }
  20076. disconnectedCallback() {
  20077. document.dispatchEvent(new CustomEvent(labelDisconnectedEvent));
  20078. }
  20079. render() {
  20080. return (hAsync(Host, { onClick: this.labelClickHandler }, hAsync("div", { class: CSS$r.container }, hAsync("slot", null))));
  20081. }
  20082. get el() { return getElement(this); }
  20083. static get style() { return labelCss; }
  20084. static get cmpMeta() { return {
  20085. "$flags$": 9,
  20086. "$tagName$": "calcite-label",
  20087. "$members$": {
  20088. "alignment": [513],
  20089. "status": [513],
  20090. "for": [513],
  20091. "scale": [513],
  20092. "layout": [513],
  20093. "disableSpacing": [4, "disable-spacing"],
  20094. "disabled": [516]
  20095. },
  20096. "$listeners$": undefined,
  20097. "$lazyBundleId$": "-",
  20098. "$attrsToReflect$": [["alignment", "alignment"], ["status", "status"], ["for", "for"], ["scale", "scale"], ["layout", "layout"], ["disabled", "disabled"]]
  20099. }; }
  20100. }
  20101. const linkCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-link:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-link{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-link{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-link{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-link{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-link{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-link:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-link-h{display:none}/*!@:host*/.sc-calcite-link-h{display:inline}/*!@:host a, :host span*/.sc-calcite-link-h a.sc-calcite-link,.sc-calcite-link-h span.sc-calcite-link{position:relative;display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:0px;border-style:none;font-family:inherit;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;text-decoration:none;line-height:inherit;font-size:inherit;-webkit-appearance:none}/*!@:host a:hover,\n:host span:hover*/.sc-calcite-link-h a.sc-calcite-link:hover,.sc-calcite-link-h span.sc-calcite-link:hover{text-decoration:none}/*!@:host a, :host span*/.sc-calcite-link-h a.sc-calcite-link,.sc-calcite-link-h span.sc-calcite-link{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host a:focus, :host span:focus*/.sc-calcite-link-h a.sc-calcite-link:focus,.sc-calcite-link-h span.sc-calcite-link:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@calcite-icon*/calcite-icon.sc-calcite-link{width:1em;height:1em;min-width:unset;min-height:unset}/*!@.calcite-link--icon*/.calcite-link--icon.sc-calcite-link{vertical-align:text-top;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;margin-top:0.125rem}/*!@:host .calcite-link--icon.icon-start*/.sc-calcite-link-h .calcite-link--icon.icon-start.sc-calcite-link{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}/*!@:host .calcite-link--icon.icon-end*/.sc-calcite-link-h .calcite-link--icon.icon-end.sc-calcite-link{-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}/*!@:host span, :host a*/.sc-calcite-link-h span.sc-calcite-link,.sc-calcite-link-h a.sc-calcite-link{position:relative;display:inline;border-style:none;background-color:transparent;padding:0px;color:var(--calcite-ui-text-link);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;line-height:inherit;white-space:initial;background-image:-webkit-gradient(linear, left top, left bottom, from(currentColor), to(currentColor)), -webkit-gradient(linear, left top, left bottom, from(var(--calcite-link-blue-underline)), to(var(--calcite-link-blue-underline)));background-image:linear-gradient(currentColor, currentColor), linear-gradient(var(--calcite-link-blue-underline), var(--calcite-link-blue-underline));background-position:0% 100%, 100% 100%;background-repeat:no-repeat, no-repeat;background-size:0% 1px, 100% 1px}/*!@:host span:hover, :host span:focus,\n:host a:hover,\n:host a:focus*/.sc-calcite-link-h span.sc-calcite-link:hover,.sc-calcite-link-h span.sc-calcite-link:focus,.sc-calcite-link-h a.sc-calcite-link:hover,.sc-calcite-link-h a.sc-calcite-link:focus{background-size:100% 1px, 100% 1px}/*!@:host span:active,\n:host a:active*/.sc-calcite-link-h span.sc-calcite-link:active,.sc-calcite-link-h a.sc-calcite-link:active{background-size:100% 2px, 100% 2px}/*!@:host span.calcite--rtl,\n:host a.calcite--rtl*/.sc-calcite-link-h span.calcite--rtl.sc-calcite-link,.sc-calcite-link-h a.calcite--rtl.sc-calcite-link{background-position:100% 100%, 100% 100%}/*!@:host([disabled])*/[disabled].sc-calcite-link-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-link-h[disabled] .sc-calcite-link-s>[calcite-hydrated][disabled],[disabled].sc-calcite-link-h [calcite-hydrated][disabled].sc-calcite-link{opacity:1}";
  20102. /** Any attributes placed on <calcite-link> component will propagate to the rendered child */
  20103. /** Passing a 'href' will render an anchor link, instead of a span. Role will be set to link, or link, depending on this. */
  20104. /** It is the consumers responsibility to add aria information, rel, target, for links, and any link attributes for form submission */
  20105. /** @slot - A slot for adding text. */
  20106. class Link {
  20107. constructor(hostRef) {
  20108. registerInstance(this, hostRef);
  20109. //--------------------------------------------------------------------------
  20110. //
  20111. // Properties
  20112. //
  20113. //--------------------------------------------------------------------------
  20114. /** is the link disabled */
  20115. this.disabled = false;
  20116. /** Prompts the user to save the linked URL instead of navigating to it. Can be used with or without a value:
  20117. * Without a value, the browser will suggest a filename/extension
  20118. * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download
  20119. */
  20120. this.download = false;
  20121. //--------------------------------------------------------------------------
  20122. //
  20123. // Private Methods
  20124. //
  20125. //--------------------------------------------------------------------------
  20126. this.storeTagRef = (el) => {
  20127. this.childEl = el;
  20128. };
  20129. }
  20130. //--------------------------------------------------------------------------
  20131. //
  20132. // Lifecycle
  20133. //
  20134. //--------------------------------------------------------------------------
  20135. componentDidRender() {
  20136. updateHostInteraction(this);
  20137. }
  20138. render() {
  20139. const { download, el } = this;
  20140. const dir = getElementDir(el);
  20141. const childElType = this.href ? "a" : "span";
  20142. const iconStartEl = (hAsync("calcite-icon", { class: "calcite-link--icon icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
  20143. const iconEndEl = (hAsync("calcite-icon", { class: "calcite-link--icon icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
  20144. const Tag = childElType;
  20145. const role = childElType === "span" ? "link" : null;
  20146. const tabIndex = childElType === "span" ? 0 : null;
  20147. return (hAsync(Host, { role: "presentation" }, hAsync(Tag, { class: { [CSS_UTILITY.rtl]: dir === "rtl" },
  20148. /*
  20149. When the 'download' property of type 'boolean | string' is set to true, the value is "".
  20150. This works around that issue for now.
  20151. */
  20152. download: Tag === "a" && (download === "" || download) ? download : null, href: Tag === "a" && this.href, ref: this.storeTagRef, rel: Tag === "a" && this.rel, role: role, tabIndex: tabIndex, target: Tag === "a" && this.target }, this.iconStart ? iconStartEl : null, hAsync("slot", null), this.iconEnd ? iconEndEl : null)));
  20153. }
  20154. //--------------------------------------------------------------------------
  20155. //
  20156. // Public Methods
  20157. //
  20158. //--------------------------------------------------------------------------
  20159. /** Sets focus on the component. */
  20160. async setFocus() {
  20161. focusElement(this.childEl);
  20162. }
  20163. get el() { return getElement(this); }
  20164. static get style() { return linkCss; }
  20165. static get cmpMeta() { return {
  20166. "$flags$": 9,
  20167. "$tagName$": "calcite-link",
  20168. "$members$": {
  20169. "disabled": [516],
  20170. "download": [520],
  20171. "href": [513],
  20172. "iconEnd": [513, "icon-end"],
  20173. "iconFlipRtl": [513, "icon-flip-rtl"],
  20174. "iconStart": [513, "icon-start"],
  20175. "rel": [1],
  20176. "target": [1],
  20177. "setFocus": [64]
  20178. },
  20179. "$listeners$": undefined,
  20180. "$lazyBundleId$": "-",
  20181. "$attrsToReflect$": [["disabled", "disabled"], ["download", "download"], ["href", "href"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"]]
  20182. }; }
  20183. }
  20184. const CSS$q = {
  20185. container: "container"
  20186. };
  20187. const listCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-list:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-list{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-list:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-h{display:none}/*!@:host*/.sc-calcite-list-h{display:block}/*!@:host([disabled])*/[disabled].sc-calcite-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-list-h[disabled] .sc-calcite-list-s>[calcite-hydrated][disabled],[disabled].sc-calcite-list-h [calcite-hydrated][disabled].sc-calcite-list{opacity:1}/*!@.container*/.container.sc-calcite-list{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;width:100%;-ms-flex-direction:column;flex-direction:column;background-color:transparent}/*!@.container **/.container.sc-calcite-list *.sc-calcite-list{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@::slotted(calcite-list-item)*/.sc-calcite-list-s>calcite-list-item{margin-bottom:1px;--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@::slotted(calcite-list-item:last-child)*/.sc-calcite-list-s>calcite-list-item:last-child{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";
  20188. /**
  20189. * A general purpose list that enables users to construct list items that conform to Calcite styling.
  20190. * @slot - A slot for adding `calcite-list-item` elements.
  20191. */
  20192. class List$1 {
  20193. constructor(hostRef) {
  20194. registerInstance(this, hostRef);
  20195. // --------------------------------------------------------------------------
  20196. //
  20197. // Properties
  20198. //
  20199. // --------------------------------------------------------------------------
  20200. /**
  20201. * When true, disabled prevents user interaction.
  20202. */
  20203. this.disabled = false;
  20204. }
  20205. //--------------------------------------------------------------------------
  20206. //
  20207. // Lifecycle
  20208. //
  20209. //--------------------------------------------------------------------------
  20210. componentDidRender() {
  20211. updateHostInteraction(this);
  20212. }
  20213. // --------------------------------------------------------------------------
  20214. //
  20215. // Public Methods
  20216. //
  20217. // --------------------------------------------------------------------------
  20218. /** Sets focus on the component. */
  20219. async setFocus() {
  20220. const firstListItem = this.el.querySelector(`calcite-list-item:not([non-interactive])`);
  20221. firstListItem === null || firstListItem === void 0 ? void 0 : firstListItem.setFocus();
  20222. }
  20223. // --------------------------------------------------------------------------
  20224. //
  20225. // Render Methods
  20226. //
  20227. // --------------------------------------------------------------------------
  20228. render() {
  20229. return (hAsync(Host, { role: "list" }, hAsync("div", { class: CSS$q.container }, hAsync("slot", null))));
  20230. }
  20231. get el() { return getElement(this); }
  20232. static get style() { return listCss; }
  20233. static get cmpMeta() { return {
  20234. "$flags$": 9,
  20235. "$tagName$": "calcite-list",
  20236. "$members$": {
  20237. "disabled": [516],
  20238. "headingLevel": [2, "heading-level"],
  20239. "setFocus": [64]
  20240. },
  20241. "$listeners$": undefined,
  20242. "$lazyBundleId$": "-",
  20243. "$attrsToReflect$": [["disabled", "disabled"]]
  20244. }; }
  20245. }
  20246. const CSS$p = {
  20247. container: "container",
  20248. contentContainer: "content-container",
  20249. nestedContainer: "nested-container",
  20250. contentContainerButton: "content-container--button",
  20251. content: "content",
  20252. actionsStart: "actions-start",
  20253. contentStart: "content-start",
  20254. label: "label",
  20255. description: "description",
  20256. contentEnd: "content-end",
  20257. actionsEnd: "actions-end",
  20258. hasCenterContent: "has-center-content"
  20259. };
  20260. const SLOTS$f = {
  20261. actionsStart: "actions-start",
  20262. contentStart: "content-start",
  20263. contentEnd: "content-end",
  20264. actionsEnd: "actions-end"
  20265. };
  20266. const listItemCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-list-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-list-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-list-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-item-h{display:none}/*!@:host*/.sc-calcite-list-item-h{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}/*!@:host([disabled])*/[disabled].sc-calcite-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-list-item-h[disabled] .sc-calcite-list-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-list-item-h [calcite-hydrated][disabled].sc-calcite-list-item{opacity:1}/*!@.container*/.container.sc-calcite-list-item{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex:1 1 0%;flex:1 1 0%;background-color:var(--calcite-ui-foreground-1);font-family:var(--calcite-sans-family)}/*!@.container **/.container.sc-calcite-list-item *.sc-calcite-list-item{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@.nested-container*/.nested-container.sc-calcite-list-item{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:var(--calcite-ui-foreground-1)}/*!@.content-container*/.content-container.sc-calcite-list-item{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:stretch;align-items:stretch;padding:0px;font-family:var(--calcite-sans-family);font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@.content-container--button*/.content-container--button.sc-calcite-list-item{cursor:pointer;border-style:none;background-color:var(--calcite-ui-foreground-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;text-align:initial}/*!@.content-container--button:hover*/.content-container--button.sc-calcite-list-item:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.content-container--button:hover .label, .content-container--button:hover .description*/.content-container--button.sc-calcite-list-item:hover .label.sc-calcite-list-item,.content-container--button.sc-calcite-list-item:hover .description.sc-calcite-list-item{color:var(--calcite-ui-text-1)}/*!@.content-container--button:focus*/.content-container--button.sc-calcite-list-item:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.content-container--button .content-start, .content-container--button .content-end*/.content-container--button.sc-calcite-list-item .content-start.sc-calcite-list-item,.content-container--button.sc-calcite-list-item .content-end.sc-calcite-list-item{pointer-events:none}/*!@.content*/.content.sc-calcite-list-item{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@.label, .description*/.label.sc-calcite-list-item,.description.sc-calcite-list-item{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);word-wrap:break-word;word-break:break-word}/*!@.label:only-child, .description:only-child*/.label.sc-calcite-list-item:only-child,.description.sc-calcite-list-item:only-child{margin:0px;padding-top:0.25rem;padding-bottom:0.25rem}/*!@.label*/.label.sc-calcite-list-item{color:var(--calcite-ui-text-1)}/*!@.description*/.description.sc-calcite-list-item{margin-top:0.125rem;color:var(--calcite-ui-text-3)}/*!@.content-start*/.content-start.sc-calcite-list-item{-ms-flex-pack:start;justify-content:flex-start}/*!@.content-end*/.content-end.sc-calcite-list-item{-ms-flex-pack:end;justify-content:flex-end}/*!@.content-start, .content-end*/.content-start.sc-calcite-list-item,.content-end.sc-calcite-list-item{-ms-flex:1 1 auto;flex:1 1 auto}/*!@.has-center-content .content-start, .has-center-content .content-end*/.has-center-content.sc-calcite-list-item .content-start.sc-calcite-list-item,.has-center-content.sc-calcite-list-item .content-end.sc-calcite-list-item{-ms-flex:0 1 auto;flex:0 1 auto}/*!@.actions-start, .actions-end, .content-start, .content-end*/.actions-start.sc-calcite-list-item,.actions-end.sc-calcite-list-item,.content-start.sc-calcite-list-item,.content-end.sc-calcite-list-item{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}/*!@.content-start ::slotted(calcite-icon), .content-end ::slotted(calcite-icon)*/.content-start .sc-calcite-list-item-s>calcite-icon,.content-end.sc-calcite-list-item-s>calcite-icon,.content-end .sc-calcite-list-item-s>calcite-icon{-ms-flex-item-align:center;align-self:center;padding-left:0.75rem;padding-right:0.75rem}/*!@.actions-start ::slotted(calcite-action), .actions-end ::slotted(calcite-action)*/.actions-start .sc-calcite-list-item-s>calcite-action,.actions-end.sc-calcite-list-item-s>calcite-action,.actions-end .sc-calcite-list-item-s>calcite-action{-ms-flex-item-align:stretch;align-self:stretch;color:inherit}/*!@::slotted(calcite-list-item-group), ::slotted(calcite-list-item)*/.sc-calcite-list-item-s>calcite-list-item-group,.sc-calcite-list-item-s>calcite-list-item{padding-left:0.5rem}";
  20267. /**
  20268. * @slot - A slot for adding `calcite-list-item` and `calcite-list-item-group` elements.
  20269. * @slot actions-start - A slot for adding actionable `calcite-action` elements before the content of the list item.
  20270. * @slot content-start - A slot for adding non-actionable elements before the label and description of the list item.
  20271. * @slot content-end - A slot for adding non-actionable elements after the label and description of the list item.
  20272. * @slot actions-end - A slot for adding actionable `calcite-action` elements after the content of the list item.
  20273. */
  20274. class ListItem {
  20275. constructor(hostRef) {
  20276. registerInstance(this, hostRef);
  20277. // --------------------------------------------------------------------------
  20278. //
  20279. // Properties
  20280. //
  20281. // --------------------------------------------------------------------------
  20282. /**
  20283. * When true, prevents the content of the list item from user interaction.
  20284. */
  20285. this.nonInteractive = false;
  20286. /**
  20287. * When true, disabled prevents interaction.
  20288. */
  20289. this.disabled = false;
  20290. }
  20291. //--------------------------------------------------------------------------
  20292. //
  20293. // Lifecycle
  20294. //
  20295. //--------------------------------------------------------------------------
  20296. componentDidRender() {
  20297. updateHostInteraction(this);
  20298. }
  20299. // --------------------------------------------------------------------------
  20300. //
  20301. // Lifecycle
  20302. //
  20303. // --------------------------------------------------------------------------
  20304. connectedCallback() {
  20305. connectConditionalSlotComponent(this);
  20306. }
  20307. disconnectedCallback() {
  20308. disconnectConditionalSlotComponent(this);
  20309. }
  20310. // --------------------------------------------------------------------------
  20311. //
  20312. // Public Methods
  20313. //
  20314. // --------------------------------------------------------------------------
  20315. /** Sets focus on the component. */
  20316. async setFocus() {
  20317. var _a;
  20318. (_a = this.focusEl) === null || _a === void 0 ? void 0 : _a.focus();
  20319. }
  20320. // --------------------------------------------------------------------------
  20321. //
  20322. // Render Methods
  20323. //
  20324. // --------------------------------------------------------------------------
  20325. renderActionsStart() {
  20326. const { el } = this;
  20327. return getSlotted(el, SLOTS$f.actionsStart) ? (hAsync("div", { class: CSS$p.actionsStart }, hAsync("slot", { name: SLOTS$f.actionsStart }))) : null;
  20328. }
  20329. renderActionsEnd() {
  20330. const { el } = this;
  20331. return getSlotted(el, SLOTS$f.actionsEnd) ? (hAsync("div", { class: CSS$p.actionsEnd }, hAsync("slot", { name: SLOTS$f.actionsEnd }))) : null;
  20332. }
  20333. renderContentStart() {
  20334. const { el } = this;
  20335. return getSlotted(el, SLOTS$f.contentStart) ? (hAsync("div", { class: CSS$p.contentStart }, hAsync("slot", { name: SLOTS$f.contentStart }))) : null;
  20336. }
  20337. renderContentEnd() {
  20338. const { el } = this;
  20339. return getSlotted(el, SLOTS$f.contentEnd) ? (hAsync("div", { class: CSS$p.contentEnd }, hAsync("slot", { name: SLOTS$f.contentEnd }))) : null;
  20340. }
  20341. renderContent() {
  20342. const { label, description } = this;
  20343. return !!label || !!description ? (hAsync("div", { class: CSS$p.content }, label ? hAsync("div", { class: CSS$p.label }, label) : null, description ? hAsync("div", { class: CSS$p.description }, description) : null)) : null;
  20344. }
  20345. renderContentContainer() {
  20346. const { description, disabled, label, nonInteractive } = this;
  20347. const hasCenterContent = !!label || !!description;
  20348. const content = [this.renderContentStart(), this.renderContent(), this.renderContentEnd()];
  20349. return !nonInteractive ? (hAsync("button", { class: {
  20350. [CSS$p.contentContainer]: true,
  20351. [CSS$p.contentContainerButton]: true,
  20352. [CSS$p.hasCenterContent]: hasCenterContent
  20353. }, disabled: disabled, ref: (focusEl) => (this.focusEl = focusEl) }, content)) : (hAsync("div", { class: { [CSS$p.contentContainer]: true, [CSS$p.hasCenterContent]: hasCenterContent }, ref: () => (this.focusEl = null) }, content));
  20354. }
  20355. render() {
  20356. return (hAsync(Host, { role: "listitem" }, hAsync("div", { class: CSS$p.container }, this.renderActionsStart(), this.renderContentContainer(), this.renderActionsEnd()), hAsync("div", { class: CSS$p.nestedContainer }, hAsync("slot", null))));
  20357. }
  20358. get el() { return getElement(this); }
  20359. static get style() { return listItemCss; }
  20360. static get cmpMeta() { return {
  20361. "$flags$": 9,
  20362. "$tagName$": "calcite-list-item",
  20363. "$members$": {
  20364. "nonInteractive": [516, "non-interactive"],
  20365. "description": [1],
  20366. "disabled": [516],
  20367. "label": [1],
  20368. "setFocus": [64]
  20369. },
  20370. "$listeners$": undefined,
  20371. "$lazyBundleId$": "-",
  20372. "$attrsToReflect$": [["nonInteractive", "non-interactive"], ["disabled", "disabled"]]
  20373. }; }
  20374. }
  20375. const CSS$o = {
  20376. heading: "heading",
  20377. container: "container"
  20378. };
  20379. const HEADING_LEVEL$5 = 3;
  20380. const listItemGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-list-item-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-list-item-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list-item-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list-item-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list-item-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list-item-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-list-item-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-item-group-h{display:none}/*!@:host*/.sc-calcite-list-item-group-h{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}/*!@.heading*/.heading.sc-calcite-list-item-group{margin:0px;display:-ms-flexbox;display:flex;-ms-flex:1 1 0%;flex:1 1 0%;background-color:var(--calcite-ui-foreground-2);padding:0.75rem;font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-2)}/*!@.container*/.container.sc-calcite-list-item-group{display:-ms-flexbox;display:flex;width:100%;-ms-flex-direction:column;flex-direction:column;background-color:var(--calcite-ui-foreground-1)}/*!@::slotted(calcite-list-item-group)*/.sc-calcite-list-item-group-s>calcite-list-item-group{padding-left:0.5rem}";
  20381. /**
  20382. * @slot - A slot for adding `calcite-list-item` and `calcite-list-item-group` elements.
  20383. */
  20384. class ListItemGroup {
  20385. constructor(hostRef) {
  20386. registerInstance(this, hostRef);
  20387. }
  20388. // --------------------------------------------------------------------------
  20389. //
  20390. // Render Methods
  20391. //
  20392. // --------------------------------------------------------------------------
  20393. render() {
  20394. var _a;
  20395. const { el, heading, headingLevel } = this;
  20396. const parentLevel = (_a = el.closest("calcite-list, calcite-list-item-group")) === null || _a === void 0 ? void 0 : _a.headingLevel;
  20397. const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
  20398. const level = headingLevel || relativeLevel || HEADING_LEVEL$5;
  20399. return (hAsync(Host, null, heading ? (hAsync(Heading, { class: CSS$o.heading, level: level }, heading)) : null, hAsync("div", { class: CSS$o.container, role: "group" }, hAsync("slot", null))));
  20400. }
  20401. get el() { return getElement(this); }
  20402. static get style() { return listItemGroupCss; }
  20403. static get cmpMeta() { return {
  20404. "$flags$": 9,
  20405. "$tagName$": "calcite-list-item-group",
  20406. "$members$": {
  20407. "heading": [513],
  20408. "headingLevel": [2, "heading-level"]
  20409. },
  20410. "$listeners$": undefined,
  20411. "$lazyBundleId$": "-",
  20412. "$attrsToReflect$": [["heading", "heading"]]
  20413. }; }
  20414. }
  20415. const loaderCss = "@charset \"UTF-8\";@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-loader:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-loader{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-loader{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-loader{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-loader{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-loader{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-loader:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-loader-h{display:none}/*!@:host*/.sc-calcite-loader-h{position:relative;margin-left:auto;margin-right:auto;display:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-top:4rem;padding-bottom:4rem;opacity:1;min-height:var(--calcite-loader-size);font-size:var(--calcite-loader-font-size);stroke:var(--calcite-ui-brand);stroke-width:3;fill:none;-webkit-transform:scale(1, 1);transform:scale(1, 1);animation:loader-color-shift 6s alternate-reverse infinite linear}/*!@:host([scale=s])*/[scale=s].sc-calcite-loader-h{--calcite-loader-font-size:var(--calcite-font-size--2);--calcite-loader-size:2rem;--calcite-loader-size-inline:0.75rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-loader-h{--calcite-loader-font-size:var(--calcite-font-size-0);--calcite-loader-size:4rem;--calcite-loader-size-inline:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-loader-h{--calcite-loader-font-size:var(--calcite-font-size-2);--calcite-loader-size:6rem;--calcite-loader-size-inline:1.5rem}/*!@:host([no-padding])*/[no-padding].sc-calcite-loader-h{padding-top:0px;padding-bottom:0px}/*!@:host*/.sc-calcite-loader-h{display:none}/*!@:host([active])*/[active].sc-calcite-loader-h{display:-ms-flexbox;display:flex}/*!@.loader__text*/.loader__text.sc-calcite-loader{display:block;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;color:var(--calcite-ui-text-1);margin-top:calc(var(--calcite-loader-size) + 1.5rem)}/*!@.loader__percentage*/.loader__percentage.sc-calcite-loader{position:absolute;display:block;text-align:center;color:var(--calcite-ui-text-1);font-size:var(--calcite-loader-font-size);width:var(--calcite-loader-size);left:50%;margin-left:calc(var(--calcite-loader-size) / 2 * -1);line-height:0.25;-webkit-transform:scale(1, 1);transform:scale(1, 1)}/*!@.loader__svgs*/.loader__svgs.sc-calcite-loader{position:absolute;overflow:visible;opacity:1;width:var(--calcite-loader-size);height:var(--calcite-loader-size);left:50%;margin-left:calc(var(--calcite-loader-size) / 2 * -1);-webkit-transform:scale(1, 1);transform:scale(1, 1)}/*!@.loader__svg*/.loader__svg.sc-calcite-loader{position:absolute;top:0px;left:0px;-webkit-transform-origin:center;transform-origin:center;overflow:visible;width:var(--calcite-loader-size);height:var(--calcite-loader-size);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-name:loader-clockwise;animation-name:loader-clockwise}@supports (display: grid){/*!@.loader__svg--1*/.loader__svg--1.sc-calcite-loader{-webkit-animation-name:loader-offset-1;animation-name:loader-offset-1}/*!@.loader__svg--2*/.loader__svg--2.sc-calcite-loader{-webkit-animation-name:loader-offset-2;animation-name:loader-offset-2}/*!@.loader__svg--3*/.loader__svg--3.sc-calcite-loader{-webkit-animation-name:loader-offset-3;animation-name:loader-offset-3}}/*!@:host([type=determinate])*/[type=determinate].sc-calcite-loader-h{-webkit-animation:none;animation:none;stroke:var(--calcite-ui-border-3)}/*!@:host([type=determinate]) .loader__svg--3*/[type=determinate].sc-calcite-loader-h .loader__svg--3.sc-calcite-loader{-webkit-animation:none;animation:none;stroke:var(--calcite-ui-brand);stroke-dasharray:150.79632;-webkit-transform:rotate(-90deg);transform:rotate(-90deg);-webkit-transition:all var(--calcite-internal-animation-timing-fast) linear;transition:all var(--calcite-internal-animation-timing-fast) linear}/*!@:host([inline])*/[inline].sc-calcite-loader-h{position:relative;margin:0px;-webkit-animation:none;animation:none;stroke:currentColor;stroke-width:2;padding-top:0px;padding-bottom:0px;height:var(--calcite-loader-size-inline);min-height:var(--calcite-loader-size-inline);width:var(--calcite-loader-size-inline);-webkit-margin-end:calc(var(--calcite-loader-size-inline) * 0.5);margin-inline-end:calc(var(--calcite-loader-size-inline) * 0.5);vertical-align:calc(var(--calcite-loader-size-inline) * -1 * 0.2)}/*!@:host([active][inline])*/[active][inline].sc-calcite-loader-h{display:inline-block}/*!@:host([inline]) .loader__svgs*/[inline].sc-calcite-loader-h .loader__svgs.sc-calcite-loader{top:0px;left:0px;margin:0px;width:var(--calcite-loader-size-inline);height:var(--calcite-loader-size-inline)}/*!@:host([inline]) .loader__svg*/[inline].sc-calcite-loader-h .loader__svg.sc-calcite-loader{width:var(--calcite-loader-size-inline);height:var(--calcite-loader-size-inline)}/*!@:host([complete])*/[complete].sc-calcite-loader-h{opacity:0;-webkit-transform:scale(0.75, 0.75);transform:scale(0.75, 0.75);-webkit-transform-origin:center;transform-origin:center;-webkit-transition:opacity var(--calcite-internal-animation-timing-medium) linear 1000ms, -webkit-transform var(--calcite-internal-animation-timing-medium) linear 1000ms;transition:opacity var(--calcite-internal-animation-timing-medium) linear 1000ms, -webkit-transform var(--calcite-internal-animation-timing-medium) linear 1000ms;transition:opacity var(--calcite-internal-animation-timing-medium) linear 1000ms, transform var(--calcite-internal-animation-timing-medium) linear 1000ms;transition:opacity var(--calcite-internal-animation-timing-medium) linear 1000ms, transform var(--calcite-internal-animation-timing-medium) linear 1000ms, -webkit-transform var(--calcite-internal-animation-timing-medium) linear 1000ms}/*!@:host([complete]) .loader__svgs*/[complete].sc-calcite-loader-h .loader__svgs.sc-calcite-loader{opacity:0;-webkit-transform:scale(0.75, 0.75);transform:scale(0.75, 0.75);-webkit-transform-origin:center;transform-origin:center;-webkit-transition:opacity calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, -webkit-transform calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms;transition:opacity calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, -webkit-transform calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms;transition:opacity calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, transform calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms;transition:opacity calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, transform calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, -webkit-transform calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms}/*!@:host([complete]) .loader__percentage*/[complete].sc-calcite-loader-h .loader__percentage.sc-calcite-loader{color:var(--calcite-ui-brand);-webkit-transform:scale(1.05, 1.05);transform:scale(1.05, 1.05);-webkit-transform-origin:center;transform-origin:center;-webkit-transition:color var(--calcite-internal-animation-timing-medium) linear, -webkit-transform var(--calcite-internal-animation-timing-medium) linear;transition:color var(--calcite-internal-animation-timing-medium) linear, -webkit-transform var(--calcite-internal-animation-timing-medium) linear;transition:color var(--calcite-internal-animation-timing-medium) linear, transform var(--calcite-internal-animation-timing-medium) linear;transition:color var(--calcite-internal-animation-timing-medium) linear, transform var(--calcite-internal-animation-timing-medium) linear, -webkit-transform var(--calcite-internal-animation-timing-medium) linear}/*!@.loader__svg--1*/.loader__svg--1.sc-calcite-loader{stroke-dasharray:27.9252444444% 139.6262222222%;-webkit-animation-duration:0.72s;animation-duration:0.72s}@-webkit-keyframes loader-offset-1{0%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-83.7757333333%}100%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:-279.2524444444%}}@keyframes loader-offset-1{0%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-83.7757333333%}100%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:-279.2524444444%}}/*!@.loader__svg--2*/.loader__svg--2.sc-calcite-loader{stroke-dasharray:55.8504888889% 139.6262222222%;-webkit-animation-duration:0.96s;animation-duration:0.96s}@-webkit-keyframes loader-offset-2{0%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-97.7383555556%}100%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:-279.2524444444%}}@keyframes loader-offset-2{0%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-97.7383555556%}100%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:-279.2524444444%}}/*!@.loader__svg--3*/.loader__svg--3.sc-calcite-loader{stroke-dasharray:13.9626222222% 139.6262222222%;-webkit-animation-duration:1.16s;animation-duration:1.16s}@-webkit-keyframes loader-offset-3{0%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-76.7944222222%}100%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:-279.2524444444%}}@keyframes loader-offset-3{0%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-76.7944222222%}100%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:-279.2524444444%}}@-webkit-keyframes loader-color-shift{0%{stroke:var(--calcite-ui-brand)}33%{stroke:var(--calcite-ui-brand-press)}66%{stroke:var(--calcite-ui-brand-hover)}100%{stroke:var(--calcite-ui-brand)}}@keyframes loader-color-shift{0%{stroke:var(--calcite-ui-brand)}33%{stroke:var(--calcite-ui-brand-press)}66%{stroke:var(--calcite-ui-brand-hover)}100%{stroke:var(--calcite-ui-brand)}}@-webkit-keyframes loader-clockwise{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loader-clockwise{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}";
  20416. class Loader {
  20417. constructor(hostRef) {
  20418. registerInstance(this, hostRef);
  20419. //--------------------------------------------------------------------------
  20420. //
  20421. // Properties
  20422. //
  20423. //--------------------------------------------------------------------------
  20424. /** Show the loader */
  20425. this.active = false;
  20426. /** Inline loaders are smaller and will appear to the left of the text */
  20427. this.inline = false;
  20428. /** Speficy the scale of the loader. Defaults to "m" */
  20429. this.scale = "m";
  20430. /** Percent complete of 100, only valid for determinate indicators */
  20431. this.value = 0;
  20432. /** Text which should appear under the loading indicator (optional) */
  20433. this.text = "";
  20434. /** Turn off spacing around the loader */
  20435. this.noPadding = false;
  20436. }
  20437. //--------------------------------------------------------------------------
  20438. //
  20439. // Lifecycle
  20440. //
  20441. //--------------------------------------------------------------------------
  20442. render() {
  20443. const { el, inline, label, scale, text, type, value } = this;
  20444. const id = el.id || guid();
  20445. const radiusRatio = 0.45;
  20446. const size = inline ? this.getInlineSize(scale) : this.getSize(scale);
  20447. const radius = size * radiusRatio;
  20448. const viewbox = `0 0 ${size} ${size}`;
  20449. const isDeterminate = type === "determinate";
  20450. const circumference = 2 * radius * Math.PI;
  20451. const progress = (value / 100) * circumference;
  20452. const remaining = circumference - progress;
  20453. const valueNow = Math.floor(value);
  20454. const hostAttributes = {
  20455. "aria-valuenow": valueNow,
  20456. "aria-valuemin": 0,
  20457. "aria-valuemax": 100,
  20458. complete: valueNow === 100
  20459. };
  20460. const svgAttributes = { r: radius, cx: size / 2, cy: size / 2 };
  20461. const determinateStyle = { "stroke-dasharray": `${progress} ${remaining}` };
  20462. return (hAsync(Host, Object.assign({ "aria-label": label, id: id, role: "progressbar" }, (isDeterminate ? hostAttributes : {})), hAsync("div", { class: "loader__svgs" }, hAsync("svg", { class: "loader__svg loader__svg--1", viewBox: viewbox }, hAsync("circle", Object.assign({}, svgAttributes))), hAsync("svg", { class: "loader__svg loader__svg--2", viewBox: viewbox }, hAsync("circle", Object.assign({}, svgAttributes))), hAsync("svg", Object.assign({ class: "loader__svg loader__svg--3", viewBox: viewbox }, (isDeterminate ? { style: determinateStyle } : {})), hAsync("circle", Object.assign({}, svgAttributes)))), text && hAsync("div", { class: "loader__text" }, text), isDeterminate && hAsync("div", { class: "loader__percentage" }, value)));
  20463. }
  20464. //--------------------------------------------------------------------------
  20465. //
  20466. // Private Methods
  20467. //
  20468. //--------------------------------------------------------------------------
  20469. /**
  20470. * Return the proper sizes based on the scale property
  20471. */
  20472. getSize(scale) {
  20473. return {
  20474. s: 32,
  20475. m: 56,
  20476. l: 80
  20477. }[scale];
  20478. }
  20479. getInlineSize(scale) {
  20480. return {
  20481. s: 12,
  20482. m: 16,
  20483. l: 20
  20484. }[scale];
  20485. }
  20486. get el() { return getElement(this); }
  20487. static get style() { return loaderCss; }
  20488. static get cmpMeta() { return {
  20489. "$flags$": 9,
  20490. "$tagName$": "calcite-loader",
  20491. "$members$": {
  20492. "active": [516],
  20493. "inline": [516],
  20494. "label": [1],
  20495. "scale": [513],
  20496. "type": [513],
  20497. "value": [2],
  20498. "text": [1],
  20499. "noPadding": [4, "no-padding"]
  20500. },
  20501. "$listeners$": undefined,
  20502. "$lazyBundleId$": "-",
  20503. "$attrsToReflect$": [["active", "active"], ["inline", "inline"], ["scale", "scale"], ["type", "type"]]
  20504. }; }
  20505. }
  20506. /**
  20507. * Traverses the slots of the open shadowroots and returns all children matching the query.
  20508. * @param {ShadowRoot | HTMLElement} root
  20509. * @param skipNode
  20510. * @param isMatch
  20511. * @param {number} maxDepth
  20512. * @param {number} depth
  20513. * @returns {HTMLElement[]}
  20514. */
  20515. function queryShadowRoot(root, skipNode, isMatch, maxDepth = 20, depth = 0) {
  20516. let matches = [];
  20517. // If the depth is above the max depth, abort the searching here.
  20518. if (depth >= maxDepth) {
  20519. return matches;
  20520. }
  20521. // Traverses a slot element
  20522. const traverseSlot = ($slot) => {
  20523. // Only check nodes that are of the type Node.ELEMENT_NODE
  20524. // Read more here https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
  20525. const assignedNodes = $slot.assignedNodes().filter(node => node.nodeType === 1);
  20526. if (assignedNodes.length > 0) {
  20527. return queryShadowRoot(assignedNodes[0].parentElement, skipNode, isMatch, maxDepth, depth + 1);
  20528. }
  20529. return [];
  20530. };
  20531. // Go through each child and continue the traversing if necessary
  20532. // Even though the typing says that children can't be undefined, Edge 15 sometimes gives an undefined value.
  20533. // Therefore we fallback to an empty array if it is undefined.
  20534. const children = Array.from(root.children || []);
  20535. for (const $child of children) {
  20536. // Check if the node and its descendants should be skipped
  20537. if (skipNode($child)) {
  20538. continue;
  20539. }
  20540. // If the child matches we always add it
  20541. if (isMatch($child)) {
  20542. matches.push($child);
  20543. }
  20544. if ($child.shadowRoot != null) {
  20545. matches.push(...queryShadowRoot($child.shadowRoot, skipNode, isMatch, maxDepth, depth + 1));
  20546. }
  20547. else if ($child.tagName === "SLOT") {
  20548. matches.push(...traverseSlot($child));
  20549. }
  20550. else {
  20551. matches.push(...queryShadowRoot($child, skipNode, isMatch, maxDepth, depth + 1));
  20552. }
  20553. }
  20554. return matches;
  20555. }
  20556. /**
  20557. * Returns whether the element is hidden.
  20558. * @param $elem
  20559. */
  20560. function isHidden($elem) {
  20561. return $elem.hasAttribute("hidden")
  20562. || ($elem.hasAttribute("aria-hidden") && $elem.getAttribute("aria-hidden") !== "false")
  20563. // A quick and dirty way to check whether the element is hidden.
  20564. // For a more fine-grained check we could use "window.getComputedStyle" but we don't because of bad performance.
  20565. // If the element has visibility set to "hidden" or "collapse", display set to "none" or opacity set to "0" through CSS
  20566. // we won't be able to catch it here. We accept it due to the huge performance benefits.
  20567. || $elem.style.display === `none`
  20568. || $elem.style.opacity === `0`
  20569. || $elem.style.visibility === `hidden`
  20570. || $elem.style.visibility === `collapse`;
  20571. // If offsetParent is null we can assume that the element is hidden
  20572. // https://stackoverflow.com/questions/306305/what-would-make-offsetparent-null
  20573. //|| $elem.offsetParent == null;
  20574. }
  20575. /**
  20576. * Returns whether the element is disabled.
  20577. * @param $elem
  20578. */
  20579. function isDisabled($elem) {
  20580. return $elem.hasAttribute("disabled")
  20581. || ($elem.hasAttribute("aria-disabled") && $elem.getAttribute("aria-disabled") !== "false");
  20582. }
  20583. /**
  20584. * Determines whether an element is focusable.
  20585. * Read more here: https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus/1600194#1600194
  20586. * Or here: https://stackoverflow.com/questions/18261595/how-to-check-if-a-dom-element-is-focusable
  20587. * @param $elem
  20588. */
  20589. function isFocusable($elem) {
  20590. // Discard elements that are removed from the tab order.
  20591. if ($elem.getAttribute("tabindex") === "-1" || isHidden($elem) || isDisabled($elem)) {
  20592. return false;
  20593. }
  20594. return (
  20595. // At this point we know that the element can have focus (eg. won't be -1) if the tabindex attribute exists
  20596. $elem.hasAttribute("tabindex")
  20597. // Anchor tags or area tags with a href set
  20598. || ($elem instanceof HTMLAnchorElement || $elem instanceof HTMLAreaElement) && $elem.hasAttribute("href")
  20599. // Form elements which are not disabled
  20600. || ($elem instanceof HTMLButtonElement
  20601. || $elem instanceof HTMLInputElement
  20602. || $elem instanceof HTMLTextAreaElement
  20603. || $elem instanceof HTMLSelectElement)
  20604. // IFrames
  20605. || $elem instanceof HTMLIFrameElement);
  20606. }
  20607. const CSS$n = {
  20608. title: "title",
  20609. header: "header",
  20610. footer: "footer",
  20611. scrim: "scrim",
  20612. back: "back",
  20613. close: "close",
  20614. secondary: "secondary",
  20615. primary: "primary",
  20616. overflowHidden: "overflow-hidden"
  20617. };
  20618. const ICONS$6 = {
  20619. close: "x"
  20620. };
  20621. const SLOTS$e = {
  20622. content: "content",
  20623. header: "header",
  20624. back: "back",
  20625. secondary: "secondary",
  20626. primary: "primary"
  20627. };
  20628. const TEXT$b = {
  20629. close: "Close"
  20630. };
  20631. const modalCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-modal:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-modal{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-modal{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-modal{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-modal{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-modal{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-modal:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-modal-h{display:none}/*!@:host*/.sc-calcite-modal-h{position:fixed;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;overflow-y:hidden;color:var(--calcite-ui-text-2);opacity:0;visibility:hidden !important;-webkit-transition:visibility 0ms linear 300ms, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition:visibility 0ms linear 300ms, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);z-index:101}/*!@:host([scale=s])*/[scale=s].sc-calcite-modal-h{--calcite-modal-padding:0.75rem;--calcite-modal-padding-large:1rem;--calcite-modal-title-text:var(--calcite-font-size-1);--calcite-modal-content-text:var(--calcite-font-size--1)}/*!@:host([scale=m])*/[scale=m].sc-calcite-modal-h{--calcite-modal-padding:1rem;--calcite-modal-padding-large:1.25rem;--calcite-modal-title-text:var(--calcite-font-size-2);--calcite-modal-content-text:var(--calcite-font-size-0)}/*!@:host([scale=l])*/[scale=l].sc-calcite-modal-h{--calcite-modal-padding:1.25rem;--calcite-modal-padding-large:1.5rem;--calcite-modal-title-text:var(--calcite-font-size-3);--calcite-modal-content-text:var(--calcite-font-size-1)}/*!@.scrim*/.scrim.sc-calcite-modal{--calcite-scrim-background:rgba(0, 0, 0, 0.75);position:fixed;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;overflow-y:hidden}/*!@.modal*/.modal.sc-calcite-modal{pointer-events:none;float:none;margin:1.5rem;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;width:100%;-ms-flex-direction:column;flex-direction:column;overflow:hidden;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);opacity:0;--tw-shadow:0 2px 12px -4px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.16);--tw-shadow-colored:0 2px 12px -4px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);z-index:102;-webkit-overflow-scrolling:touch;visibility:hidden;-webkit-transition:visibility 0ms linear 300ms, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), -webkit-transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition:visibility 0ms linear 300ms, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), -webkit-transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear 300ms, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear 300ms, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), -webkit-transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);-webkit-transform:translate3d(0, 20px, 0);transform:translate3d(0, 20px, 0)}/*!@:host([active])*/[active].sc-calcite-modal-h{opacity:1;visibility:visible !important;-webkit-transition-delay:0ms;transition-delay:0ms}/*!@:host([active]) .modal*/[active].sc-calcite-modal-h .modal.sc-calcite-modal{pointer-events:auto;visibility:visible;opacity:1;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);-webkit-transition:visibility 0ms linear, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-width var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-height var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), -webkit-transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition:visibility 0ms linear, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-width var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-height var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), -webkit-transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-width var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-height var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-width var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-height var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), -webkit-transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);-webkit-transition-delay:0ms;transition-delay:0ms}/*!@.header*/.header.sc-calcite-modal{display:-ms-flexbox;display:flex;min-width:0px;max-width:100%;border-top-left-radius:0.25rem;border-top-right-radius:0.25rem;border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1);-ms-flex:0 0 auto;flex:0 0 auto;z-index:2}/*!@.close*/.close.sc-calcite-modal{-ms-flex-order:2;order:2;margin:0px;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;border-start-end-radius:0.25rem;padding:var(--calcite-modal-padding);-ms-flex:0 0 auto;flex:0 0 auto}/*!@.close calcite-icon*/.close.sc-calcite-modal calcite-icon.sc-calcite-modal{pointer-events:none;vertical-align:-2px}/*!@.close:focus*/.close.sc-calcite-modal:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.close:hover, .close:focus, .close:active*/.close.sc-calcite-modal:hover,.close.sc-calcite-modal:focus,.close.sc-calcite-modal:active{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.title*/.title.sc-calcite-modal{-ms-flex-order:1;order:1;display:-ms-flexbox;display:flex;min-width:0px;-ms-flex-align:center;align-items:center;-ms-flex:1 1 auto;flex:1 1 auto;padding:var(--calcite-modal-padding) var(--calcite-modal-padding-large)}/*!@slot[name=header]::slotted(*), *::slotted([slot=header])*/slot[name=header].sc-calcite-modal-s>*,*.sc-calcite-modal-s>[slot=header]{margin:0px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1);font-size:var(--calcite-modal-title-text)}/*!@.content*/.content.sc-calcite-modal{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;display:block;height:100%;overflow:auto;background-color:var(--calcite-ui-foreground-1);padding:0px;max-height:calc(100vh - 12rem);z-index:1}/*!@.content--spaced*/.content--spaced.sc-calcite-modal{padding:var(--calcite-modal-padding) var(--calcite-modal-padding-large)}/*!@.content--no-footer*/.content--no-footer.sc-calcite-modal{border-bottom-right-radius:0.25rem;border-bottom-left-radius:0.25rem}/*!@slot[name=content]::slotted(*),\n*::slotted([slot=content])*/slot[name=content].sc-calcite-modal-s>*,*.sc-calcite-modal-s>[slot=content]{font-size:var(--calcite-modal-content-text)}/*!@:host([background-color=grey]) .content*/[background-color=grey].sc-calcite-modal-h .content.sc-calcite-modal{background-color:var(--calcite-ui-background)}/*!@.footer*/.footer.sc-calcite-modal{margin-top:auto;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;width:100%;-ms-flex-pack:justify;justify-content:space-between;border-bottom-right-radius:0.25rem;border-bottom-left-radius:0.25rem;border-width:0px;border-top-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1);-ms-flex:0 0 auto;flex:0 0 auto;padding:var(--calcite-modal-padding) var(--calcite-modal-padding-large);z-index:2}/*!@.footer--hide-back .back, .footer--hide-secondary .secondary*/.footer--hide-back.sc-calcite-modal .back.sc-calcite-modal,.footer--hide-secondary.sc-calcite-modal .secondary.sc-calcite-modal{display:none}/*!@.back*/.back.sc-calcite-modal{display:block;-webkit-margin-end:auto;margin-inline-end:auto}/*!@.secondary*/.secondary.sc-calcite-modal{margin-left:0.25rem;margin-right:0.25rem;display:block}/*!@slot[name=primary]*/slot[name=primary].sc-calcite-modal{display:block}/*!@:host([width=small]) .modal*/[width=small].sc-calcite-modal-h .modal.sc-calcite-modal{width:auto}/*!@:host([width=s]) .modal*/[width=s].sc-calcite-modal-h .modal.sc-calcite-modal{max-width:32rem}@media screen and (max-width: 35rem){/*!@:host([width=s]) .modal*/[width=s].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;height:100%;max-height:100%;width:100%;max-width:100%;border-radius:0px}/*!@:host([width=s]) .content*/[width=s].sc-calcite-modal-h .content.sc-calcite-modal{-ms-flex:1 1 auto;flex:1 1 auto;max-height:unset}/*!@:host([width=s][docked])*/[width=s][docked].sc-calcite-modal-h{-ms-flex-align:end;align-items:flex-end}}/*!@:host([width=m]) .modal*/[width=m].sc-calcite-modal-h .modal.sc-calcite-modal{max-width:48rem}@media screen and (max-width: 51rem){/*!@:host([width=m]) .modal*/[width=m].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;height:100%;max-height:100%;width:100%;max-width:100%;border-radius:0px}/*!@:host([width=m]) .content*/[width=m].sc-calcite-modal-h .content.sc-calcite-modal{-ms-flex:1 1 auto;flex:1 1 auto;max-height:unset}/*!@:host([width=m][docked])*/[width=m][docked].sc-calcite-modal-h{-ms-flex-align:end;align-items:flex-end}}/*!@:host([width=l]) .modal*/[width=l].sc-calcite-modal-h .modal.sc-calcite-modal{max-width:94rem}@media screen and (max-width: 97rem){/*!@:host([width=l]) .modal*/[width=l].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;height:100%;max-height:100%;width:100%;max-width:100%;border-radius:0px}/*!@:host([width=l]) .content*/[width=l].sc-calcite-modal-h .content.sc-calcite-modal{-ms-flex:1 1 auto;flex:1 1 auto;max-height:unset}/*!@:host([width=l][docked])*/[width=l][docked].sc-calcite-modal-h{-ms-flex-align:end;align-items:flex-end}}/*!@:host([fullscreen])*/[fullscreen].sc-calcite-modal-h{background-color:transparent}/*!@:host([fullscreen]) .modal*/[fullscreen].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;height:100%;max-height:100%;width:100%;max-width:100%;-webkit-transform:translate3D(0, 20px, 0) scale(0.95);transform:translate3D(0, 20px, 0) scale(0.95)}/*!@:host([fullscreen]) .content*/[fullscreen].sc-calcite-modal-h .content.sc-calcite-modal{max-height:100%;-ms-flex:1 1 auto;flex:1 1 auto}/*!@:host([active][fullscreen]) .modal*/[active][fullscreen].sc-calcite-modal-h .modal.sc-calcite-modal{-webkit-transform:translate3D(0, 0, 0) scale(1);transform:translate3D(0, 0, 0) scale(1)}/*!@:host([active][fullscreen]) .header*/[active][fullscreen].sc-calcite-modal-h .header.sc-calcite-modal{border-radius:0}/*!@:host([active][fullscreen]) .footer*/[active][fullscreen].sc-calcite-modal-h .footer.sc-calcite-modal{border-radius:0}/*!@:host([docked]) .modal*/[docked].sc-calcite-modal-h .modal.sc-calcite-modal{height:auto}/*!@:host([docked]) .content*/[docked].sc-calcite-modal-h .content.sc-calcite-modal{height:auto;-ms-flex:1 1 auto;flex:1 1 auto}@media screen and (max-width: 860px){/*!@:host([docked]) .modal*/[docked].sc-calcite-modal-h .modal.sc-calcite-modal{border-radius:var(--calcite-border-radius) var(--calcite-border-radius) 0 0}/*!@:host([docked]) .close*/[docked].sc-calcite-modal-h .close.sc-calcite-modal{border-start-end-radius:var(--calcite-border-radius)}}/*!@:host([color=red]) .modal*/[color=red].sc-calcite-modal-h .modal.sc-calcite-modal{border-color:var(--calcite-ui-danger)}/*!@:host([color=blue]) .modal*/[color=blue].sc-calcite-modal-h .modal.sc-calcite-modal{border-color:var(--calcite-ui-info)}/*!@:host([color=red]) .modal, :host([color=blue]) .modal*/[color=red].sc-calcite-modal-h .modal.sc-calcite-modal,[color=blue].sc-calcite-modal-h .modal.sc-calcite-modal{border-width:0px;border-top-width:4px;border-style:solid}/*!@:host([color=red]) .header, :host([color=blue]) .header*/[color=red].sc-calcite-modal-h .header.sc-calcite-modal,[color=blue].sc-calcite-modal-h .header.sc-calcite-modal{border-radius:0.25rem;border-bottom-right-radius:0px;border-bottom-left-radius:0px}@media screen and (max-width: 860px){/*!@slot[name=header]::slotted(*), *::slotted([slot=header])*/slot[name=header].sc-calcite-modal-s>*,*.sc-calcite-modal-s>[slot=header]{font-size:var(--calcite-font-size-1)}/*!@.footer*/.footer.sc-calcite-modal{position:-webkit-sticky;position:sticky;bottom:0px}}@media screen and (max-width: 480px){/*!@.footer*/.footer.sc-calcite-modal{-ms-flex-direction:column;flex-direction:column}/*!@.back, .secondary*/.back.sc-calcite-modal,.secondary.sc-calcite-modal{margin:0px;margin-bottom:0.25rem}}";
  20632. const isFocusableExtended = (el) => {
  20633. return isCalciteFocusable(el) || isFocusable(el);
  20634. };
  20635. const getFocusableElements = (el) => {
  20636. return queryShadowRoot(el, isHidden, isFocusableExtended);
  20637. };
  20638. /**
  20639. * @slot header - a slot for adding a modal header
  20640. * @slot content - a slot for adding modal content
  20641. * @slot primary - a slot for adding a primary button
  20642. * @slot secondary - a slot for adding a secondary button
  20643. * @slot back - a slot for adding a back button
  20644. */
  20645. class Modal {
  20646. constructor(hostRef) {
  20647. registerInstance(this, hostRef);
  20648. this.calciteModalOpen = createEvent(this, "calciteModalOpen", 7);
  20649. this.calciteModalClose = createEvent(this, "calciteModalClose", 7);
  20650. //--------------------------------------------------------------------------
  20651. //
  20652. // Properties
  20653. //
  20654. //--------------------------------------------------------------------------
  20655. /** Add the active attribute to open the modal */
  20656. this.active = false;
  20657. /** Optionally pass a function to run before close */
  20658. this.beforeClose = () => Promise.resolve();
  20659. /** Disables the display a close button within the Modal */
  20660. this.disableCloseButton = false;
  20661. /** Disables the closing of the Modal when clicked outside. */
  20662. this.disableOutsideClose = false;
  20663. /** Aria label for the close button */
  20664. this.intlClose = TEXT$b.close;
  20665. /** Flag to disable the default close on escape behavior */
  20666. this.disableEscape = false;
  20667. /** specify the scale of modal, defaults to m */
  20668. this.scale = "m";
  20669. /** Set the width of the modal. Can use stock sizes or pass a number (in pixels) */
  20670. this.width = "m";
  20671. /** Background color of modal content */
  20672. this.backgroundColor = "white";
  20673. /** Turn off spacing around the content area slot */
  20674. this.noPadding = false;
  20675. //--------------------------------------------------------------------------
  20676. //
  20677. // Variables
  20678. //
  20679. //--------------------------------------------------------------------------
  20680. this.hasFooter = true;
  20681. this.mutationObserver = createObserver();
  20682. this.activeTransitionProp = "opacity";
  20683. //--------------------------------------------------------------------------
  20684. //
  20685. // Private Methods
  20686. //
  20687. //--------------------------------------------------------------------------
  20688. this.transitionEnd = (event) => {
  20689. if (event.propertyName === this.activeTransitionProp) {
  20690. this.active ? this.calciteModalOpen.emit() : this.calciteModalClose.emit();
  20691. }
  20692. };
  20693. this.openEnd = () => {
  20694. this.setFocus();
  20695. this.el.removeEventListener("calciteModalOpen", this.openEnd);
  20696. };
  20697. this.handleOutsideClose = () => {
  20698. if (this.disableOutsideClose) {
  20699. return;
  20700. }
  20701. this.close();
  20702. };
  20703. /** Close the modal, first running the `beforeClose` method */
  20704. this.close = () => {
  20705. return this.beforeClose(this.el).then(() => {
  20706. this.active = false;
  20707. focusElement(this.previousActiveElement);
  20708. this.removeOverflowHiddenClass();
  20709. });
  20710. };
  20711. this.focusFirstElement = () => {
  20712. focusElement(this.disableCloseButton ? getFocusableElements(this.el)[0] : this.closeButtonEl);
  20713. };
  20714. this.focusLastElement = () => {
  20715. const focusableElements = getFocusableElements(this.el).filter((el) => !el.getAttribute("data-focus-fence"));
  20716. if (focusableElements.length > 0) {
  20717. focusElement(focusableElements[focusableElements.length - 1]);
  20718. }
  20719. else {
  20720. focusElement(this.closeButtonEl);
  20721. }
  20722. };
  20723. this.updateFooterVisibility = () => {
  20724. this.hasFooter = !!getSlotted(this.el, [SLOTS$e.back, SLOTS$e.primary, SLOTS$e.secondary]);
  20725. };
  20726. }
  20727. //--------------------------------------------------------------------------
  20728. //
  20729. // Lifecycle
  20730. //
  20731. //--------------------------------------------------------------------------
  20732. componentWillLoad() {
  20733. // when modal initially renders, if active was set we need to open as watcher doesn't fire
  20734. if (this.active) {
  20735. this.open();
  20736. }
  20737. }
  20738. connectedCallback() {
  20739. var _a;
  20740. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  20741. this.updateFooterVisibility();
  20742. connectConditionalSlotComponent(this);
  20743. }
  20744. disconnectedCallback() {
  20745. var _a;
  20746. this.removeOverflowHiddenClass();
  20747. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  20748. disconnectConditionalSlotComponent(this);
  20749. }
  20750. render() {
  20751. return (hAsync(Host, { "aria-describedby": this.contentId, "aria-labelledby": this.titleId, "aria-modal": "true", role: "dialog" }, hAsync("calcite-scrim", { class: CSS$n.scrim, onClick: this.handleOutsideClose }), this.renderStyle(), hAsync("div", { class: "modal", onTransitionEnd: this.transitionEnd }, hAsync("div", { "data-focus-fence": true, onFocus: this.focusLastElement, tabindex: "0" }), hAsync("div", { class: CSS$n.header }, this.renderCloseButton(), hAsync("header", { class: CSS$n.title }, hAsync("slot", { name: CSS$n.header }))), hAsync("div", { class: {
  20752. content: true,
  20753. "content--spaced": !this.noPadding,
  20754. "content--no-footer": !this.hasFooter
  20755. }, ref: (el) => (this.modalContent = el) }, hAsync("slot", { name: SLOTS$e.content })), this.renderFooter(), hAsync("div", { "data-focus-fence": true, onFocus: this.focusFirstElement, tabindex: "0" }))));
  20756. }
  20757. renderFooter() {
  20758. return this.hasFooter ? (hAsync("div", { class: CSS$n.footer, key: "footer" }, hAsync("span", { class: CSS$n.back }, hAsync("slot", { name: SLOTS$e.back })), hAsync("span", { class: CSS$n.secondary }, hAsync("slot", { name: SLOTS$e.secondary })), hAsync("span", { class: CSS$n.primary }, hAsync("slot", { name: SLOTS$e.primary })))) : null;
  20759. }
  20760. renderCloseButton() {
  20761. return !this.disableCloseButton ? (hAsync("button", { "aria-label": this.intlClose, class: CSS$n.close, key: "button", onClick: this.close, ref: (el) => (this.closeButtonEl = el), title: this.intlClose }, hAsync("calcite-icon", { icon: ICONS$6.close, scale: this.scale === "s" ? "s" : this.scale === "m" ? "m" : this.scale === "l" ? "l" : null }))) : null;
  20762. }
  20763. renderStyle() {
  20764. const hasCustomWidth = !isNaN(parseInt(`${this.width}`));
  20765. return hasCustomWidth ? (hAsync("style", null, `
  20766. .modal {
  20767. max-width: ${this.width}px !important;
  20768. }
  20769. @media screen and (max-width: ${this.width}px) {
  20770. .modal {
  20771. height: 100% !important;
  20772. max-height: 100% !important;
  20773. width: 100% !important;
  20774. max-width: 100% !important;
  20775. margin: 0 !important;
  20776. border-radius: 0 !important;
  20777. }
  20778. .content {
  20779. flex: 1 1 auto !important;
  20780. max-height: unset !important;
  20781. }
  20782. }
  20783. `)) : null;
  20784. }
  20785. //--------------------------------------------------------------------------
  20786. //
  20787. // Event Listeners
  20788. //
  20789. //--------------------------------------------------------------------------
  20790. handleEscape(e) {
  20791. if (this.active && !this.disableEscape && e.key === "Escape") {
  20792. this.close();
  20793. }
  20794. }
  20795. //--------------------------------------------------------------------------
  20796. //
  20797. // Public Methods
  20798. //
  20799. //--------------------------------------------------------------------------
  20800. /**
  20801. * Focus first interactive element
  20802. * @deprecated use `setFocus` instead.
  20803. */
  20804. async focusElement(el) {
  20805. if (el) {
  20806. el.focus();
  20807. }
  20808. return this.setFocus();
  20809. }
  20810. /**
  20811. * Sets focus on the component.
  20812. *
  20813. * By default, will try to focus on any focusable content. If there is none, it will focus on the close button.
  20814. * If you want to focus on the close button, you can use the `close-button` focus ID.
  20815. */
  20816. async setFocus(focusId) {
  20817. const closeButton = this.closeButtonEl;
  20818. return focusElement(focusId === "close-button" ? closeButton : getFocusableElements(this.el)[0] || closeButton);
  20819. }
  20820. /** Set the scroll top of the modal content */
  20821. async scrollContent(top = 0, left = 0) {
  20822. if (this.modalContent) {
  20823. if (this.modalContent.scrollTo) {
  20824. this.modalContent.scrollTo({ top, left, behavior: "smooth" });
  20825. }
  20826. else {
  20827. this.modalContent.scrollTop = top;
  20828. this.modalContent.scrollLeft = left;
  20829. }
  20830. }
  20831. }
  20832. async toggleModal(value, oldValue) {
  20833. if (value !== oldValue) {
  20834. if (value) {
  20835. this.open();
  20836. }
  20837. else if (!value) {
  20838. this.close();
  20839. }
  20840. }
  20841. }
  20842. /** Open the modal */
  20843. open() {
  20844. this.previousActiveElement = document.activeElement;
  20845. this.el.addEventListener("calciteModalOpen", this.openEnd);
  20846. this.active = true;
  20847. const titleEl = getSlotted(this.el, SLOTS$e.header);
  20848. const contentEl = getSlotted(this.el, SLOTS$e.content);
  20849. this.titleId = ensureId(titleEl);
  20850. this.contentId = ensureId(contentEl);
  20851. document.documentElement.classList.add(CSS$n.overflowHidden);
  20852. }
  20853. removeOverflowHiddenClass() {
  20854. document.documentElement.classList.remove(CSS$n.overflowHidden);
  20855. }
  20856. get el() { return getElement(this); }
  20857. static get watchers() { return {
  20858. "active": ["toggleModal"]
  20859. }; }
  20860. static get style() { return modalCss; }
  20861. static get cmpMeta() { return {
  20862. "$flags$": 9,
  20863. "$tagName$": "calcite-modal",
  20864. "$members$": {
  20865. "active": [1540],
  20866. "beforeClose": [16],
  20867. "disableCloseButton": [4, "disable-close-button"],
  20868. "disableOutsideClose": [4, "disable-outside-close"],
  20869. "intlClose": [1, "intl-close"],
  20870. "docked": [516],
  20871. "firstFocus": [16],
  20872. "disableEscape": [4, "disable-escape"],
  20873. "scale": [513],
  20874. "width": [520],
  20875. "fullscreen": [516],
  20876. "color": [513],
  20877. "backgroundColor": [513, "background-color"],
  20878. "noPadding": [4, "no-padding"],
  20879. "hasFooter": [32],
  20880. "focusElement": [64],
  20881. "setFocus": [64],
  20882. "scrollContent": [64]
  20883. },
  20884. "$listeners$": [[8, "keyup", "handleEscape"]],
  20885. "$lazyBundleId$": "-",
  20886. "$attrsToReflect$": [["active", "active"], ["docked", "docked"], ["scale", "scale"], ["width", "width"], ["fullscreen", "fullscreen"], ["color", "color"], ["backgroundColor", "background-color"]]
  20887. }; }
  20888. }
  20889. const TEXT$a = {
  20890. close: "Close"
  20891. };
  20892. const SLOTS$d = {
  20893. title: "title",
  20894. message: "message",
  20895. link: "link",
  20896. actionsEnd: "actions-end"
  20897. };
  20898. const CSS$m = {
  20899. actionsEnd: "actions-end",
  20900. close: "notice-close",
  20901. container: "container",
  20902. content: "notice-content",
  20903. icon: "notice-icon"
  20904. };
  20905. const noticeCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-notice:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-notice{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-notice{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-notice{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-notice{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-notice{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-notice:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-notice-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-notice-h{--calcite-notice-spacing-token-small:0.5rem;--calcite-notice-spacing-token-large:0.75rem}/*!@:host([scale=s]) .container slot[name=title]::slotted(*), :host([scale=s]) .container *::slotted([slot=title])*/.sc-calcite-notice-h[scale=s] .container slot[name=title].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=s] .container *.sc-calcite-notice-s>[slot=title]{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=s]) .container slot[name=message]::slotted(*), :host([scale=s]) .container *::slotted([slot=message])*/.sc-calcite-notice-h[scale=s] .container slot[name=message].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=s] .container *.sc-calcite-notice-s>[slot=message]{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host([scale=s]) ::slotted(calcite-link)*/.sc-calcite-notice-h[scale=s] .sc-calcite-notice-s>calcite-link{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host([scale=s]) .notice-close*/[scale=s].sc-calcite-notice-h .notice-close.sc-calcite-notice{padding:0.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-notice-h{--calcite-notice-spacing-token-small:0.75rem;--calcite-notice-spacing-token-large:1rem}/*!@:host([scale=m]) .container slot[name=title]::slotted(*), :host([scale=m]) .container *::slotted([slot=title])*/.sc-calcite-notice-h[scale=m] .container slot[name=title].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=m] .container *.sc-calcite-notice-s>[slot=title]{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=m]) .container slot[name=message]::slotted(*), :host([scale=m]) .container *::slotted([slot=message])*/.sc-calcite-notice-h[scale=m] .container slot[name=message].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=m] .container *.sc-calcite-notice-s>[slot=message]{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=m]) ::slotted(calcite-link)*/.sc-calcite-notice-h[scale=m] .sc-calcite-notice-s>calcite-link{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=l])*/[scale=l].sc-calcite-notice-h{--calcite-notice-spacing-token-small:1rem;--calcite-notice-spacing-token-large:1.25rem}/*!@:host([scale=l]) .container slot[name=title]::slotted(*), :host([scale=l]) .container *::slotted([slot=title])*/.sc-calcite-notice-h[scale=l] .container slot[name=title].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=l] .container *.sc-calcite-notice-s>[slot=title]{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size-1);line-height:1.375}/*!@:host([scale=l]) .container slot[name=message]::slotted(*), :host([scale=l]) .container *::slotted([slot=message])*/.sc-calcite-notice-h[scale=l] .container slot[name=message].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=l] .container *.sc-calcite-notice-s>[slot=message]{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=l]) ::slotted(calcite-link)*/.sc-calcite-notice-h[scale=l] .sc-calcite-notice-s>calcite-link{margin-top:0.125rem;margin-bottom:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([width=auto])*/[width=auto].sc-calcite-notice-h{--calcite-notice-width:auto}/*!@:host([width=half])*/[width=half].sc-calcite-notice-h{--calcite-notice-width:50%}/*!@:host([width=full])*/[width=full].sc-calcite-notice-h{--calcite-notice-width:100%}/*!@:host*/.sc-calcite-notice-h{margin-left:auto;margin-right:auto;display:none;max-width:100%;-ms-flex-align:center;align-items:center;width:var(--calcite-notice-width)}/*!@.container*/.container.sc-calcite-notice{pointer-events:none;margin-top:0px;margin-bottom:0px;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;width:100%;background-color:var(--calcite-ui-foreground-1);opacity:0;max-height:0;text-align:start;-webkit-transition:var(--calcite-animation-timing);transition:var(--calcite-animation-timing);-webkit-border-start:0px solid;border-inline-start:0px solid;-webkit-box-shadow:0 0 0 0 transparent;box-shadow:0 0 0 0 transparent}/*!@.notice-close*/.notice-close.sc-calcite-notice{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@.notice-close:focus*/.notice-close.sc-calcite-notice:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host*/.sc-calcite-notice-h{display:-ms-flexbox;display:flex}/*!@:host([active]) .container*/[active].sc-calcite-notice-h .container.sc-calcite-notice{pointer-events:auto;display:-ms-flexbox;display:flex;max-height:100%;-ms-flex-align:center;align-items:center;border-width:2px;opacity:1;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@.container slot[name=title]::slotted(*), .container *::slotted([slot=title])*/.container slot[name=title].sc-calcite-notice-s>*,.container *.sc-calcite-notice-s>[slot=title]{margin:0px;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@.container slot[name=message]::slotted(*), .container *::slotted([slot=message])*/.container slot[name=message].sc-calcite-notice-s>*,.container *.sc-calcite-notice-s>[slot=message]{margin:0px;display:inline;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);-webkit-margin-end:var(--calcite-notice-spacing-token-small);margin-inline-end:var(--calcite-notice-spacing-token-small)}/*!@.notice-content*/.notice-content.sc-calcite-notice{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto;display:-ms-flexbox;display:flex;min-width:0px;-ms-flex-direction:column;flex-direction:column;overflow-wrap:break-word;-ms-flex:1 1 0px;flex:1 1 0;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:0 var(--calcite-notice-spacing-token-small)}/*!@.notice-content:first-of-type:not(:only-child)*/.notice-content.sc-calcite-notice:first-of-type:not(:only-child){-webkit-padding-start:var(--calcite-notice-spacing-token-large);padding-inline-start:var(--calcite-notice-spacing-token-large)}/*!@.notice-content:only-of-type*/.notice-content.sc-calcite-notice:only-of-type{padding:var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large)}/*!@.notice-icon*/.notice-icon.sc-calcite-notice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto}/*!@.notice-close*/.notice-close.sc-calcite-notice{display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-item-align:stretch;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto;-webkit-appearance:none}/*!@.notice-close:hover, .notice-close:focus*/.notice-close.sc-calcite-notice:hover,.notice-close.sc-calcite-notice:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.notice-close:active*/.notice-close.sc-calcite-notice:active{background-color:var(--calcite-ui-foreground-3)}/*!@.actions-end*/.actions-end.sc-calcite-notice{display:-ms-flexbox;display:flex;-ms-flex-item-align:stretch;align-self:stretch}/*!@:host([color=blue]) .container*/[color=blue].sc-calcite-notice-h .container.sc-calcite-notice{border-color:var(--calcite-ui-brand)}/*!@:host([color=blue]) .container .notice-icon*/[color=blue].sc-calcite-notice-h .container.sc-calcite-notice .notice-icon.sc-calcite-notice{color:var(--calcite-ui-brand)}/*!@:host([color=red]) .container*/[color=red].sc-calcite-notice-h .container.sc-calcite-notice{border-color:var(--calcite-ui-danger)}/*!@:host([color=red]) .container .notice-icon*/[color=red].sc-calcite-notice-h .container.sc-calcite-notice .notice-icon.sc-calcite-notice{color:var(--calcite-ui-danger)}/*!@:host([color=yellow]) .container*/[color=yellow].sc-calcite-notice-h .container.sc-calcite-notice{border-color:var(--calcite-ui-warning)}/*!@:host([color=yellow]) .container .notice-icon*/[color=yellow].sc-calcite-notice-h .container.sc-calcite-notice .notice-icon.sc-calcite-notice{color:var(--calcite-ui-warning)}/*!@:host([color=green]) .container*/[color=green].sc-calcite-notice-h .container.sc-calcite-notice{border-color:var(--calcite-ui-success)}/*!@:host([color=green]) .container .notice-icon*/[color=green].sc-calcite-notice-h .container.sc-calcite-notice .notice-icon.sc-calcite-notice{color:var(--calcite-ui-success)}";
  20906. /** Notices are intended to be used to present users with important-but-not-crucial contextual tips or copy. Because
  20907. * notices are displayed inline, a common use case is displaying them on page-load to present users with short hints or contextual copy.
  20908. * They are optionally dismissible - useful for keeping track of whether or not a user has dismissed the notice. You can also choose not
  20909. * to display a notice on page load and set the "active" attribute as needed to contextually provide inline messaging to users.
  20910. */
  20911. /**
  20912. * @slot title - Title of the notice (optional)
  20913. * @slot message - Main text of the notice
  20914. * @slot link - Optional action to take from the notice (undo, try again, link to page, etc.)
  20915. * @slot actions-end - Allows adding a `calcite-action` at the end of the notice. It is recommended to use 2 or less actions.
  20916. */
  20917. class Notice {
  20918. constructor(hostRef) {
  20919. registerInstance(this, hostRef);
  20920. this.calciteNoticeClose = createEvent(this, "calciteNoticeClose", 7);
  20921. this.calciteNoticeOpen = createEvent(this, "calciteNoticeOpen", 7);
  20922. //--------------------------------------------------------------------------
  20923. //
  20924. // Properties
  20925. //
  20926. //---------------------------------------------------------------------------
  20927. /** Is the notice currently active or not */
  20928. this.active = false;
  20929. /** Color for the notice (will apply to top border and icon) */
  20930. this.color = "blue";
  20931. /** Optionally show a button the user can click to dismiss the notice */
  20932. this.dismissible = false;
  20933. /** String for the close button.
  20934. * @default "Close"
  20935. */
  20936. this.intlClose = TEXT$a.close;
  20937. /** specify the scale of the notice, defaults to m */
  20938. this.scale = "m";
  20939. /** specify the width of the notice, defaults to auto */
  20940. this.width = "auto";
  20941. //--------------------------------------------------------------------------
  20942. //
  20943. // Private Methods
  20944. //
  20945. //--------------------------------------------------------------------------
  20946. this.close = () => {
  20947. this.active = false;
  20948. this.calciteNoticeClose.emit();
  20949. };
  20950. }
  20951. updateRequestedIcon() {
  20952. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  20953. }
  20954. //--------------------------------------------------------------------------
  20955. //
  20956. // Lifecycle
  20957. //
  20958. //--------------------------------------------------------------------------
  20959. connectedCallback() {
  20960. connectConditionalSlotComponent(this);
  20961. }
  20962. disconnectedCallback() {
  20963. disconnectConditionalSlotComponent(this);
  20964. }
  20965. componentWillLoad() {
  20966. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  20967. }
  20968. render() {
  20969. const { el } = this;
  20970. const closeButton = (hAsync("button", { "aria-label": this.intlClose, class: CSS$m.close, onClick: this.close, ref: (el) => (this.closeButton = el) }, hAsync("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
  20971. const hasActionEnd = getSlotted(el, SLOTS$d.actionsEnd);
  20972. return (hAsync("div", { class: CSS$m.container }, this.requestedIcon ? (hAsync("div", { class: CSS$m.icon }, hAsync("calcite-icon", { icon: this.requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, hAsync("div", { class: CSS$m.content }, hAsync("slot", { name: SLOTS$d.title }), hAsync("slot", { name: SLOTS$d.message }), hAsync("slot", { name: SLOTS$d.link })), hasActionEnd ? (hAsync("div", { class: CSS$m.actionsEnd }, hAsync("slot", { name: SLOTS$d.actionsEnd }))) : null, this.dismissible ? closeButton : null));
  20973. }
  20974. //--------------------------------------------------------------------------
  20975. //
  20976. // Public Methods
  20977. //
  20978. //--------------------------------------------------------------------------
  20979. /** Sets focus on the component. */
  20980. async setFocus() {
  20981. const noticeLinkEl = this.el.querySelector("calcite-link");
  20982. if (!this.closeButton && !noticeLinkEl) {
  20983. return;
  20984. }
  20985. if (noticeLinkEl) {
  20986. noticeLinkEl.setFocus();
  20987. }
  20988. else if (this.closeButton) {
  20989. this.closeButton.focus();
  20990. }
  20991. }
  20992. get el() { return getElement(this); }
  20993. static get watchers() { return {
  20994. "icon": ["updateRequestedIcon"],
  20995. "color": ["updateRequestedIcon"]
  20996. }; }
  20997. static get style() { return noticeCss; }
  20998. static get cmpMeta() { return {
  20999. "$flags$": 9,
  21000. "$tagName$": "calcite-notice",
  21001. "$members$": {
  21002. "active": [1540],
  21003. "color": [513],
  21004. "dismissible": [516],
  21005. "icon": [520],
  21006. "intlClose": [1, "intl-close"],
  21007. "scale": [513],
  21008. "width": [513],
  21009. "setFocus": [64]
  21010. },
  21011. "$listeners$": undefined,
  21012. "$lazyBundleId$": "-",
  21013. "$attrsToReflect$": [["active", "active"], ["color", "color"], ["dismissible", "dismissible"], ["icon", "icon"], ["scale", "scale"], ["width", "width"]]
  21014. }; }
  21015. }
  21016. const optionCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-option:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-option{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-option{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-option{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-option{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-option{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-option:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-option-h{display:none}/*!@:host*/.sc-calcite-option-h{display:block}";
  21017. class Option {
  21018. constructor(hostRef) {
  21019. registerInstance(this, hostRef);
  21020. this.calciteOptionChange = createEvent(this, "calciteOptionChange", 7);
  21021. //--------------------------------------------------------------------------
  21022. //
  21023. // Properties
  21024. //
  21025. //--------------------------------------------------------------------------
  21026. /**
  21027. * When true, it prevents the option from being selected.
  21028. */
  21029. this.disabled = false;
  21030. this.mutationObserver = createObserver();
  21031. }
  21032. handlePropChange(_newValue, _oldValue, propName) {
  21033. if (propName === "label" || propName === "value") {
  21034. this.ensureTextContentDependentProps();
  21035. }
  21036. this.calciteOptionChange.emit();
  21037. }
  21038. //--------------------------------------------------------------------------
  21039. //
  21040. // Private Methods
  21041. //
  21042. //--------------------------------------------------------------------------
  21043. ensureTextContentDependentProps() {
  21044. const { el: { textContent } } = this;
  21045. if (!this.label || this.label === this.internallySetLabel) {
  21046. this.label = textContent;
  21047. this.internallySetLabel = textContent;
  21048. }
  21049. if (!this.value || this.value === this.internallySetValue) {
  21050. this.value = textContent;
  21051. this.internallySetValue = textContent;
  21052. }
  21053. }
  21054. //--------------------------------------------------------------------------
  21055. //
  21056. // Lifecycle
  21057. //
  21058. //--------------------------------------------------------------------------
  21059. connectedCallback() {
  21060. var _a;
  21061. this.ensureTextContentDependentProps();
  21062. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, {
  21063. attributeFilter: ["label", "value"],
  21064. characterData: true,
  21065. childList: true,
  21066. subtree: true
  21067. });
  21068. }
  21069. disconnectedCallback() {
  21070. var _a;
  21071. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  21072. }
  21073. //--------------------------------------------------------------------------
  21074. //
  21075. // Render Methods
  21076. //
  21077. //--------------------------------------------------------------------------
  21078. render() {
  21079. return hAsync("slot", null, this.label);
  21080. }
  21081. get el() { return getElement(this); }
  21082. static get watchers() { return {
  21083. "disabled": ["handlePropChange"],
  21084. "label": ["handlePropChange"],
  21085. "selected": ["handlePropChange"],
  21086. "value": ["handlePropChange"]
  21087. }; }
  21088. static get style() { return optionCss; }
  21089. static get cmpMeta() { return {
  21090. "$flags$": 9,
  21091. "$tagName$": "calcite-option",
  21092. "$members$": {
  21093. "disabled": [516],
  21094. "label": [1025],
  21095. "selected": [516],
  21096. "value": [1032]
  21097. },
  21098. "$listeners$": undefined,
  21099. "$lazyBundleId$": "-",
  21100. "$attrsToReflect$": [["disabled", "disabled"], ["selected", "selected"]]
  21101. }; }
  21102. }
  21103. const optionGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-option-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-option-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-option-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-option-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-option-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-option-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-option-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-option-group-h{display:none}/*!@:host*/.sc-calcite-option-group-h{display:block}";
  21104. /**
  21105. * @slot - A slot for adding `calcite-option`s.
  21106. */
  21107. class OptionGroup {
  21108. constructor(hostRef) {
  21109. registerInstance(this, hostRef);
  21110. this.calciteOptionGroupChange = createEvent(this, "calciteOptionGroupChange", 7);
  21111. //--------------------------------------------------------------------------
  21112. //
  21113. // Properties
  21114. //
  21115. //--------------------------------------------------------------------------
  21116. /**
  21117. * When true, it prevents selection from any of its associated options.
  21118. */
  21119. this.disabled = false;
  21120. }
  21121. handlePropChange() {
  21122. this.calciteOptionGroupChange.emit();
  21123. }
  21124. //--------------------------------------------------------------------------
  21125. //
  21126. // Render Methods
  21127. //
  21128. //--------------------------------------------------------------------------
  21129. render() {
  21130. return (hAsync(Fragment, null, hAsync("div", null, this.label), hAsync("slot", null)));
  21131. }
  21132. static get watchers() { return {
  21133. "disabled": ["handlePropChange"],
  21134. "label": ["handlePropChange"]
  21135. }; }
  21136. static get style() { return optionGroupCss; }
  21137. static get cmpMeta() { return {
  21138. "$flags$": 9,
  21139. "$tagName$": "calcite-option-group",
  21140. "$members$": {
  21141. "disabled": [516],
  21142. "label": [1]
  21143. },
  21144. "$listeners$": undefined,
  21145. "$lazyBundleId$": "-",
  21146. "$attrsToReflect$": [["disabled", "disabled"]]
  21147. }; }
  21148. }
  21149. const CSS$l = {
  21150. page: "page",
  21151. selected: "is-selected",
  21152. previous: "previous",
  21153. next: "next",
  21154. disabled: "is-disabled",
  21155. ellipsis: "ellipsis",
  21156. ellipsisStart: "ellipsis--start",
  21157. ellipsisEnd: "ellipsis--end"
  21158. };
  21159. const TEXT$9 = {
  21160. nextLabel: "Next",
  21161. previousLabel: "Previous"
  21162. };
  21163. const paginationCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-pagination:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-pagination{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pagination{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pagination{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pagination{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pagination{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-pagination:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pagination-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-pagination-h{--calcite-pagination-spacing:0.25rem 0.5rem}/*!@:host([scale=s]) .previous, :host([scale=s]) .next, :host([scale=s]) .page*/[scale=s].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=s].sc-calcite-pagination-h .next.sc-calcite-pagination,[scale=s].sc-calcite-pagination-h .page.sc-calcite-pagination{height:1.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) .previous, :host([scale=s]) .next*/[scale=s].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=s].sc-calcite-pagination-h .next.sc-calcite-pagination{padding-left:0.25rem;padding-right:0.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-pagination-h{--calcite-pagination-spacing:0.5rem 0.75rem}/*!@:host([scale=m]) .previous, :host([scale=m]) .next, :host([scale=m]) .page*/[scale=m].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=m].sc-calcite-pagination-h .next.sc-calcite-pagination,[scale=m].sc-calcite-pagination-h .page.sc-calcite-pagination{height:2rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) .previous, :host([scale=m]) .next*/[scale=m].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=m].sc-calcite-pagination-h .next.sc-calcite-pagination{padding-left:0.5rem;padding-right:0.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-pagination-h{--calcite-pagination-spacing:0.75rem 1rem}/*!@:host([scale=l]) .previous, :host([scale=l]) .next, :host([scale=l]) .page*/[scale=l].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=l].sc-calcite-pagination-h .next.sc-calcite-pagination,[scale=l].sc-calcite-pagination-h .page.sc-calcite-pagination{height:2.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) .previous, :host([scale=l]) .next*/[scale=l].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=l].sc-calcite-pagination-h .next.sc-calcite-pagination{padding-left:1rem;padding-right:1rem}/*!@:host*/.sc-calcite-pagination-h{display:-ms-flexbox;display:flex;-webkit-writing-mode:horizontal-tb;-ms-writing-mode:lr-tb;writing-mode:horizontal-tb}/*!@:host button*/.sc-calcite-pagination-h button.sc-calcite-pagination{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host button:focus*/.sc-calcite-pagination-h button.sc-calcite-pagination:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.previous, .next, .page*/.previous.sc-calcite-pagination,.next.sc-calcite-pagination,.page.sc-calcite-pagination{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;border-style:none;--tw-border-opacity:0;background-color:transparent;font-family:inherit;font-size:var(--calcite-font-size-0);line-height:1.25rem;color:var(--calcite-ui-text-3);border-top:2px solid transparent;border-bottom:2px solid transparent}/*!@.previous:hover, .next:hover, .page:hover*/.previous.sc-calcite-pagination:hover,.next.sc-calcite-pagination:hover,.page.sc-calcite-pagination:hover{color:var(--calcite-ui-text-1);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@.page:hover*/.page.sc-calcite-pagination:hover{border-bottom-color:var(--calcite-ui-border-2)}/*!@.page.is-selected*/.page.is-selected.sc-calcite-pagination{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);border-bottom-color:var(--calcite-ui-brand)}/*!@.previous:hover, .next:hover*/.previous.sc-calcite-pagination:hover,.next.sc-calcite-pagination:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-brand)}/*!@.previous:active, .next:active*/.previous.sc-calcite-pagination:active,.next.sc-calcite-pagination:active{background-color:var(--calcite-ui-foreground-3)}/*!@.previous.is-disabled, .next.is-disabled*/.previous.is-disabled.sc-calcite-pagination,.next.is-disabled.sc-calcite-pagination{pointer-events:none;background-color:transparent}/*!@.previous.is-disabled > calcite-icon, .next.is-disabled > calcite-icon*/.previous.is-disabled.sc-calcite-pagination>calcite-icon.sc-calcite-pagination,.next.is-disabled.sc-calcite-pagination>calcite-icon.sc-calcite-pagination{opacity:var(--calcite-ui-opacity-disabled)}/*!@.next*/.next.sc-calcite-pagination{margin-right:0px}/*!@.page,\n.ellipsis*/.page.sc-calcite-pagination,.ellipsis.sc-calcite-pagination{padding:var(--calcite-pagination-spacing)}/*!@.ellipsis*/.ellipsis.sc-calcite-pagination{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;color:var(--calcite-ui-text-3)}";
  21164. const maxPagesDisplayed = 5;
  21165. class Pagination {
  21166. constructor(hostRef) {
  21167. registerInstance(this, hostRef);
  21168. this.calcitePaginationUpdate = createEvent(this, "calcitePaginationUpdate", 7);
  21169. this.calcitePaginationChange = createEvent(this, "calcitePaginationChange", 7);
  21170. //--------------------------------------------------------------------------
  21171. //
  21172. // Public Properties
  21173. //
  21174. //--------------------------------------------------------------------------
  21175. /** number of items per page */
  21176. this.num = 20;
  21177. /** index of item that should begin the page */
  21178. this.start = 1;
  21179. /** total number of items */
  21180. this.total = 0;
  21181. /** Used as an accessible label (aria-label) for the next button
  21182. * @default "Next"
  21183. */
  21184. this.textLabelNext = TEXT$9.nextLabel;
  21185. /** Used as an accessible label (aria-label) of the previous button
  21186. * @default "Previous"
  21187. */
  21188. this.textLabelPrevious = TEXT$9.previousLabel;
  21189. /** The scale of the pagination */
  21190. this.scale = "m";
  21191. this.previousClicked = () => {
  21192. this.previousPage().then();
  21193. this.emitUpdate();
  21194. };
  21195. this.nextClicked = () => {
  21196. this.nextPage();
  21197. this.emitUpdate();
  21198. };
  21199. }
  21200. // --------------------------------------------------------------------------
  21201. //
  21202. // Public Methods
  21203. //
  21204. // --------------------------------------------------------------------------
  21205. /** Go to the next page of results */
  21206. async nextPage() {
  21207. this.start = Math.min(this.getLastStart(), this.start + this.num);
  21208. }
  21209. /** Go to the previous page of results */
  21210. async previousPage() {
  21211. this.start = Math.max(1, this.start - this.num);
  21212. }
  21213. // --------------------------------------------------------------------------
  21214. //
  21215. // Private Methods
  21216. //
  21217. // --------------------------------------------------------------------------
  21218. getLastStart() {
  21219. const { total, num } = this;
  21220. const lastStart = total % num === 0 ? total - num : Math.floor(total / num) * num;
  21221. return lastStart + 1;
  21222. }
  21223. showLeftEllipsis() {
  21224. return Math.floor(this.start / this.num) > 3;
  21225. }
  21226. showRightEllipsis() {
  21227. return (this.total - this.start) / this.num > 3;
  21228. }
  21229. emitUpdate() {
  21230. const changePayload = {
  21231. start: this.start,
  21232. total: this.total,
  21233. num: this.num
  21234. };
  21235. this.calcitePaginationChange.emit(changePayload);
  21236. this.calcitePaginationUpdate.emit(changePayload);
  21237. }
  21238. //--------------------------------------------------------------------------
  21239. //
  21240. // Render Methods
  21241. //
  21242. //--------------------------------------------------------------------------
  21243. renderPages() {
  21244. const lastStart = this.getLastStart();
  21245. let end;
  21246. let nextStart;
  21247. // if we don't need ellipses render the whole set
  21248. if (this.total / this.num <= maxPagesDisplayed) {
  21249. nextStart = 1 + this.num;
  21250. end = lastStart - this.num;
  21251. }
  21252. else {
  21253. // if we're within max pages of page 1
  21254. if (this.start / this.num < maxPagesDisplayed - 1) {
  21255. nextStart = 1 + this.num;
  21256. end = 1 + 4 * this.num;
  21257. }
  21258. else {
  21259. // if we're within max pages of last page
  21260. if (this.start + 3 * this.num >= this.total) {
  21261. nextStart = lastStart - 4 * this.num;
  21262. end = lastStart - this.num;
  21263. }
  21264. else {
  21265. nextStart = this.start - this.num;
  21266. end = this.start + this.num;
  21267. }
  21268. }
  21269. }
  21270. const pages = [];
  21271. while (nextStart <= end) {
  21272. pages.push(nextStart);
  21273. nextStart = nextStart + this.num;
  21274. }
  21275. return pages.map((page) => this.renderPage(page));
  21276. }
  21277. renderPage(start) {
  21278. const page = Math.floor(start / this.num) + (this.num === 1 ? 0 : 1);
  21279. return (hAsync("button", { class: {
  21280. [CSS$l.page]: true,
  21281. [CSS$l.selected]: start === this.start
  21282. }, onClick: () => {
  21283. this.start = start;
  21284. this.emitUpdate();
  21285. } }, page));
  21286. }
  21287. renderLeftEllipsis() {
  21288. if (this.total / this.num > maxPagesDisplayed && this.showLeftEllipsis()) {
  21289. return hAsync("span", { class: `${CSS$l.ellipsis} ${CSS$l.ellipsisStart}` }, "\u2026");
  21290. }
  21291. }
  21292. renderRightEllipsis() {
  21293. if (this.total / this.num > maxPagesDisplayed && this.showRightEllipsis()) {
  21294. return hAsync("span", { class: `${CSS$l.ellipsis} ${CSS$l.ellipsisEnd}` }, "\u2026");
  21295. }
  21296. }
  21297. render() {
  21298. const { total, num, start } = this;
  21299. const prevDisabled = num === 1 ? start <= num : start < num;
  21300. const nextDisabled = num === 1 ? start + num > total : start + num > total;
  21301. return (hAsync(Fragment, null, hAsync("button", { "aria-label": this.textLabelPrevious, class: {
  21302. [CSS$l.previous]: true,
  21303. [CSS$l.disabled]: prevDisabled
  21304. }, disabled: prevDisabled, onClick: this.previousClicked }, hAsync("calcite-icon", { flipRtl: true, icon: "chevronLeft", scale: "s" })), total > num ? this.renderPage(1) : null, this.renderLeftEllipsis(), this.renderPages(), this.renderRightEllipsis(), this.renderPage(this.getLastStart()), hAsync("button", { "aria-label": this.textLabelNext, class: {
  21305. [CSS$l.next]: true,
  21306. [CSS$l.disabled]: nextDisabled
  21307. }, disabled: nextDisabled, onClick: this.nextClicked }, hAsync("calcite-icon", { flipRtl: true, icon: "chevronRight", scale: "s" }))));
  21308. }
  21309. get el() { return getElement(this); }
  21310. static get style() { return paginationCss; }
  21311. static get cmpMeta() { return {
  21312. "$flags$": 9,
  21313. "$tagName$": "calcite-pagination",
  21314. "$members$": {
  21315. "num": [2],
  21316. "start": [1026],
  21317. "total": [2],
  21318. "textLabelNext": [1, "text-label-next"],
  21319. "textLabelPrevious": [1, "text-label-previous"],
  21320. "scale": [513],
  21321. "nextPage": [64],
  21322. "previousPage": [64]
  21323. },
  21324. "$listeners$": undefined,
  21325. "$lazyBundleId$": "-",
  21326. "$attrsToReflect$": [["scale", "scale"]]
  21327. }; }
  21328. }
  21329. const CSS$k = {
  21330. backButton: "back-button",
  21331. container: "container",
  21332. header: "header",
  21333. heading: "heading",
  21334. summary: "summary",
  21335. headerContent: "header-content",
  21336. headerActions: "header-actions",
  21337. headerActionsEnd: "header-actions--end",
  21338. headerActionsStart: "header-actions--start",
  21339. contentWrapper: "content-wrapper",
  21340. contentContainer: "content-container",
  21341. contentHeight: "content-height",
  21342. fabContainer: "fab-container",
  21343. footer: "footer",
  21344. menuContainer: "menu-container",
  21345. menuButton: "menu-button",
  21346. menu: "menu",
  21347. menuOpen: "menu--open"
  21348. };
  21349. const ICONS$5 = {
  21350. close: "x",
  21351. menu: "ellipsis",
  21352. backLeft: "chevron-left",
  21353. backRight: "chevron-right"
  21354. };
  21355. const SLOTS$c = {
  21356. headerActionsStart: "header-actions-start",
  21357. headerActionsEnd: "header-actions-end",
  21358. headerMenuActions: "header-menu-actions",
  21359. headerContent: "header-content",
  21360. fab: "fab",
  21361. footer: "footer",
  21362. footerActions: "footer-actions"
  21363. };
  21364. const TEXT$8 = {
  21365. back: "Back",
  21366. close: "Close",
  21367. open: "Open",
  21368. options: "Options"
  21369. };
  21370. const HEADING_LEVEL$4 = 3;
  21371. const panelCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-panel:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-panel{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-panel{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-panel{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-panel{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-panel{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-panel-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-panel-h *.sc-calcite-panel{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-panel:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-panel-h{display:none}/*!@:host*/.sc-calcite-panel-h{position:relative;display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden;--calcite-min-header-height:calc(var(--calcite-icon-size) * 3);--calcite-panel-max-height:unset;--calcite-panel-width:100%;--calcite-panel-min-width:unset;--calcite-panel-max-width:unset}/*!@:host([disabled])*/[disabled].sc-calcite-panel-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-panel-h[disabled] .sc-calcite-panel-s>[calcite-hydrated][disabled],[disabled].sc-calcite-panel-h [calcite-hydrated][disabled].sc-calcite-panel{opacity:1}/*!@.header*/.header.sc-calcite-panel{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-line-pack:justify;align-content:space-between;-ms-flex-align:center;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-panel{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-panel .heading.sc-calcite-panel{-ms-flex:1 1 auto;flex:1 1 auto;padding:0.5rem}/*!@h1.heading*/h1.heading.sc-calcite-panel{font-size:var(--calcite-font-size-2);line-height:1.5rem}/*!@h2.heading*/h2.heading.sc-calcite-panel{font-size:var(--calcite-font-size-1);line-height:1.5rem}/*!@h3.heading*/h3.heading.sc-calcite-panel{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@h4.heading, h5.heading*/h4.heading.sc-calcite-panel,h5.heading.sc-calcite-panel{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.container*/.container.sc-calcite-panel{margin:0px;display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;max-height:var(--calcite-panel-max-height);width:var(--calcite-panel-width);max-width:var(--calcite-panel-max-width);min-width:var(--calcite-panel-min-width);-webkit-transition:max-height var(--calcite-animation-timing), width var(--calcite-animation-timing);transition:max-height var(--calcite-animation-timing), width var(--calcite-animation-timing)}/*!@:host([height-scale=s])*/[height-scale=s].sc-calcite-panel-h{--calcite-panel-max-height:40vh}/*!@:host([height-scale=m])*/[height-scale=m].sc-calcite-panel-h{--calcite-panel-max-height:60vh}/*!@:host([height-scale=l])*/[height-scale=l].sc-calcite-panel-h{--calcite-panel-max-height:80vh}/*!@:host([width-scale=s])*/[width-scale=s].sc-calcite-panel-h{--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 12vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 300px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 150px)}/*!@:host([width-scale=m])*/[width-scale=m].sc-calcite-panel-h{--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 20vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 420px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 240px)}/*!@:host([width-scale=l])*/[width-scale=l].sc-calcite-panel-h{--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 45vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 680px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 340px)}/*!@.container[hidden]*/.container[hidden].sc-calcite-panel{display:none}/*!@:host([loading]) .container, :host([disabled]) .container*/[loading].sc-calcite-panel-h .container.sc-calcite-panel,[disabled].sc-calcite-panel-h .container.sc-calcite-panel{position:relative}/*!@.header*/.header.sc-calcite-panel{border-bottom:1px solid;position:-webkit-sticky;position:sticky;top:0px;width:100%;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:start;justify-content:flex-start;background-color:var(--calcite-ui-foreground-1);border-bottom-color:var(--calcite-ui-border-3);-ms-flex:0 0 auto;flex:0 0 auto}/*!@.header-content*/.header-content.sc-calcite-panel{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.875rem;padding-bottom:0.875rem;-webkit-margin-end:auto;margin-inline-end:auto}/*!@.header-content .heading, .header-content .summary*/.header-content.sc-calcite-panel .heading.sc-calcite-panel,.header-content.sc-calcite-panel .summary.sc-calcite-panel{display:block;overflow-wrap:break-word;padding:0px}/*!@.header-content .heading*/.header-content.sc-calcite-panel .heading.sc-calcite-panel{margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-medium)}/*!@.header-content .heading:only-child*/.header-content.sc-calcite-panel .heading.sc-calcite-panel:only-child{margin-bottom:0px}/*!@.header-content .summary*/.header-content.sc-calcite-panel .summary.sc-calcite-panel{font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}/*!@.back-button*/.back-button.sc-calcite-panel{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}/*!@.header-actions*/.header-actions.sc-calcite-panel{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch}/*!@.header-actions--end,\n.menu-container:only-child*/.header-actions--end.sc-calcite-panel,.menu-container.sc-calcite-panel:only-child{-webkit-margin-start:auto;margin-inline-start:auto}/*!@.menu-button*/.menu-button.sc-calcite-panel{position:relative;height:100%;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:stretch;align-self:stretch}/*!@.menu*/.menu.sc-calcite-panel{min-width:10rem;-ms-flex-flow:column nowrap;flex-flow:column nowrap}/*!@.content-wrapper*/.content-wrapper.sc-calcite-panel{overflow:auto}/*!@.content-height*/.content-height.sc-calcite-panel{height:100%}/*!@.content-container*/.content-container.sc-calcite-panel{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch;background-color:var(--calcite-ui-background)}/*!@.footer*/.footer.sc-calcite-panel{border-top:1px solid;position:-webkit-sticky;position:sticky;bottom:0px;display:-ms-flexbox;display:flex;width:100%;-ms-flex-pack:space-evenly;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);border-top-color:var(--calcite-ui-border-3);-ms-flex:0 0 auto;flex:0 0 auto;min-height:3rem;padding:0.5rem}/*!@.fab-container*/.fab-container.sc-calcite-panel{position:-webkit-sticky;position:sticky;bottom:0px;left:0px;right:0px;margin-top:0px;margin-bottom:0px;margin-left:auto;margin-right:auto;display:block;padding:0.5rem;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content}";
  21372. /**
  21373. * @slot - A slot for adding custom content.
  21374. * @slot header-actions-start - A slot for adding actions or content to the start side of the panel header.
  21375. * @slot header-actions-end - A slot for adding actions or content to the end side of the panel header.
  21376. * @slot header-content - A slot for adding custom content to the header.
  21377. * @slot header-menu-actions - A slot for adding an overflow menu with actions inside a dropdown.
  21378. * @slot fab - A slot for adding a `calcite-fab` (floating action button) to perform an action.
  21379. * @slot footer-actions - A slot for adding buttons to the footer.
  21380. * @slot footer - A slot for adding custom content to the footer.
  21381. */
  21382. class Panel {
  21383. constructor(hostRef) {
  21384. registerInstance(this, hostRef);
  21385. this.calcitePanelDismiss = createEvent(this, "calcitePanelDismiss", 7);
  21386. this.calcitePanelDismissedChange = createEvent(this, "calcitePanelDismissedChange", 7);
  21387. this.calcitePanelScroll = createEvent(this, "calcitePanelScroll", 7);
  21388. this.calcitePanelBackClick = createEvent(this, "calcitePanelBackClick", 7);
  21389. // --------------------------------------------------------------------------
  21390. //
  21391. // Properties
  21392. //
  21393. // --------------------------------------------------------------------------
  21394. /**
  21395. * Hides the panel.
  21396. */
  21397. this.dismissed = false;
  21398. /**
  21399. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  21400. */
  21401. this.disabled = false;
  21402. /**
  21403. * Displays a close button in the trailing side of the header.
  21404. */
  21405. this.dismissible = false;
  21406. /**
  21407. * Shows a back button in the header.
  21408. */
  21409. this.showBackButton = false;
  21410. /**
  21411. * When true, content is waiting to be loaded. This state shows a busy indicator.
  21412. */
  21413. this.loading = false;
  21414. /**
  21415. * Opens the action menu.
  21416. */
  21417. this.menuOpen = false;
  21418. this.resizeObserver = createObserver();
  21419. // --------------------------------------------------------------------------
  21420. //
  21421. // Private Methods
  21422. //
  21423. // --------------------------------------------------------------------------
  21424. this.resizeHandler = () => {
  21425. const { panelScrollEl } = this;
  21426. if (!panelScrollEl ||
  21427. typeof panelScrollEl.scrollHeight !== "number" ||
  21428. typeof panelScrollEl.offsetHeight !== "number") {
  21429. return;
  21430. }
  21431. panelScrollEl.tabIndex = panelScrollEl.scrollHeight > panelScrollEl.offsetHeight ? 0 : -1;
  21432. };
  21433. this.setContainerRef = (node) => {
  21434. this.containerEl = node;
  21435. };
  21436. this.setDismissRef = (node) => {
  21437. this.dismissButtonEl = node;
  21438. };
  21439. this.setBackRef = (node) => {
  21440. this.backButtonEl = node;
  21441. };
  21442. this.panelKeyDownHandler = (event) => {
  21443. if (event.key === "Escape") {
  21444. this.dismiss();
  21445. }
  21446. };
  21447. this.dismiss = () => {
  21448. this.dismissed = true;
  21449. this.calcitePanelDismiss.emit();
  21450. };
  21451. this.panelScrollHandler = () => {
  21452. this.calcitePanelScroll.emit();
  21453. };
  21454. this.backButtonClick = () => {
  21455. this.calcitePanelBackClick.emit();
  21456. };
  21457. this.setPanelScrollEl = (el) => {
  21458. var _a, _b;
  21459. this.panelScrollEl = el;
  21460. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  21461. if (el) {
  21462. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
  21463. this.resizeHandler();
  21464. }
  21465. };
  21466. }
  21467. dismissedHandler() {
  21468. this.calcitePanelDismissedChange.emit();
  21469. }
  21470. //--------------------------------------------------------------------------
  21471. //
  21472. // Lifecycle
  21473. //
  21474. //--------------------------------------------------------------------------
  21475. componentDidRender() {
  21476. updateHostInteraction(this);
  21477. }
  21478. // --------------------------------------------------------------------------
  21479. //
  21480. // Lifecycle
  21481. //
  21482. // --------------------------------------------------------------------------
  21483. connectedCallback() {
  21484. connectConditionalSlotComponent(this);
  21485. }
  21486. disconnectedCallback() {
  21487. var _a;
  21488. disconnectConditionalSlotComponent(this);
  21489. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  21490. }
  21491. // --------------------------------------------------------------------------
  21492. //
  21493. // Methods
  21494. //
  21495. // --------------------------------------------------------------------------
  21496. /** Sets focus on the component. */
  21497. async setFocus(focusId) {
  21498. var _a, _b, _c;
  21499. if (focusId === "dismiss-button") {
  21500. (_a = this.dismissButtonEl) === null || _a === void 0 ? void 0 : _a.setFocus();
  21501. return;
  21502. }
  21503. if (focusId === "back-button") {
  21504. (_b = this.backButtonEl) === null || _b === void 0 ? void 0 : _b.setFocus();
  21505. return;
  21506. }
  21507. (_c = this.containerEl) === null || _c === void 0 ? void 0 : _c.focus();
  21508. }
  21509. /** Scrolls panel content to a particular set of coordinates.
  21510. *
  21511. * ```
  21512. * myCalcitePanel.scrollContentTo({
  21513. * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element.
  21514. * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element
  21515. * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value).
  21516. * });
  21517. * ```
  21518. */
  21519. async scrollContentTo(options) {
  21520. var _a;
  21521. (_a = this.panelScrollEl) === null || _a === void 0 ? void 0 : _a.scrollTo(options);
  21522. }
  21523. // --------------------------------------------------------------------------
  21524. //
  21525. // Render Methods
  21526. //
  21527. // --------------------------------------------------------------------------
  21528. renderBackButton() {
  21529. const { el } = this;
  21530. const rtl = getElementDir(el) === "rtl";
  21531. const { showBackButton, intlBack, backButtonClick } = this;
  21532. const label = intlBack || TEXT$8.back;
  21533. const icon = rtl ? ICONS$5.backRight : ICONS$5.backLeft;
  21534. return showBackButton ? (hAsync("calcite-action", { "aria-label": label, class: CSS$k.backButton, icon: icon, key: "back-button", onClick: backButtonClick, ref: this.setBackRef, scale: "s", slot: SLOTS$c.headerActionsStart, text: label })) : null;
  21535. }
  21536. renderHeaderContent() {
  21537. const { heading, headingLevel, summary } = this;
  21538. const headingNode = heading ? (hAsync(Heading, { class: CSS$k.heading, level: headingLevel || HEADING_LEVEL$4 }, heading)) : null;
  21539. const summaryNode = summary ? hAsync("span", { class: CSS$k.summary }, summary) : null;
  21540. return headingNode || summaryNode ? (hAsync("div", { class: CSS$k.headerContent, key: "header-content" }, headingNode, summaryNode)) : null;
  21541. }
  21542. /**
  21543. * Allows user to override the entire header-content node.
  21544. */
  21545. renderHeaderSlottedContent() {
  21546. return (hAsync("div", { class: CSS$k.headerContent, key: "slotted-header-content" }, hAsync("slot", { name: SLOTS$c.headerContent })));
  21547. }
  21548. renderHeaderStartActions() {
  21549. const { el } = this;
  21550. const hasStartActions = getSlotted(el, SLOTS$c.headerActionsStart);
  21551. return hasStartActions ? (hAsync("div", { class: { [CSS$k.headerActionsStart]: true, [CSS$k.headerActions]: true }, key: "header-actions-start" }, hAsync("slot", { name: SLOTS$c.headerActionsStart }))) : null;
  21552. }
  21553. renderHeaderActionsEnd() {
  21554. const { dismiss, dismissible, el, intlClose } = this;
  21555. const text = intlClose || TEXT$8.close;
  21556. const dismissibleNode = dismissible ? (hAsync("calcite-action", { "aria-label": text, icon: ICONS$5.close, onClick: dismiss, ref: this.setDismissRef, text: text })) : null;
  21557. const slotNode = hAsync("slot", { name: SLOTS$c.headerActionsEnd });
  21558. const hasEndActions = getSlotted(el, SLOTS$c.headerActionsEnd);
  21559. return hasEndActions || dismissibleNode ? (hAsync("div", { class: { [CSS$k.headerActionsEnd]: true, [CSS$k.headerActions]: true }, key: "header-actions-end" }, slotNode, dismissibleNode)) : null;
  21560. }
  21561. renderMenu() {
  21562. const { el, intlOptions, menuOpen } = this;
  21563. const hasMenuItems = getSlotted(el, SLOTS$c.headerMenuActions);
  21564. return hasMenuItems ? (hAsync("calcite-action-menu", { flipPlacements: ["top", "bottom"], key: "menu", label: intlOptions || TEXT$8.options, open: menuOpen, placement: "bottom-end" }, hAsync("calcite-action", { icon: ICONS$5.menu, slot: SLOTS$p.trigger, text: intlOptions || TEXT$8.options }), hAsync("slot", { name: SLOTS$c.headerMenuActions }))) : null;
  21565. }
  21566. renderHeaderNode() {
  21567. const { el, showBackButton } = this;
  21568. const backButtonNode = this.renderBackButton();
  21569. const hasHeaderSlottedContent = getSlotted(el, SLOTS$c.headerContent);
  21570. const headerContentNode = hasHeaderSlottedContent
  21571. ? this.renderHeaderSlottedContent()
  21572. : this.renderHeaderContent();
  21573. const actionsNodeStart = this.renderHeaderStartActions();
  21574. const actionsNodeEnd = this.renderHeaderActionsEnd();
  21575. const headerMenuNode = this.renderMenu();
  21576. return actionsNodeStart ||
  21577. headerContentNode ||
  21578. actionsNodeEnd ||
  21579. headerMenuNode ||
  21580. showBackButton ? (hAsync("header", { class: CSS$k.header }, backButtonNode, actionsNodeStart, headerContentNode, actionsNodeEnd, headerMenuNode)) : null;
  21581. }
  21582. renderFooterNode() {
  21583. const { el } = this;
  21584. const hasFooterSlottedContent = getSlotted(el, SLOTS$c.footer);
  21585. const hasFooterActions = getSlotted(el, SLOTS$c.footerActions);
  21586. return hasFooterSlottedContent || hasFooterActions ? (hAsync("footer", { class: CSS$k.footer, key: "footer" }, hasFooterSlottedContent ? hAsync("slot", { key: "footer-slot", name: SLOTS$c.footer }) : null, hasFooterActions ? hAsync("slot", { key: "footer-actions-slot", name: SLOTS$c.footerActions }) : null)) : null;
  21587. }
  21588. renderContent() {
  21589. const { el } = this;
  21590. const hasFab = getSlotted(el, SLOTS$c.fab);
  21591. const defaultSlotNode = hAsync("slot", { key: "default-slot" });
  21592. const contentWrapperKey = "content-wrapper";
  21593. return hasFab ? (hAsync("div", { class: { [CSS$k.contentWrapper]: true, [CSS$k.contentHeight]: true }, key: contentWrapperKey, onScroll: this.panelScrollHandler, ref: this.setPanelScrollEl }, hAsync("section", { class: CSS$k.contentContainer }, defaultSlotNode), this.renderFab())) : (hAsync("section", { class: { [CSS$k.contentWrapper]: true, [CSS$k.contentContainer]: true }, key: contentWrapperKey, onScroll: this.panelScrollHandler, ref: this.setPanelScrollEl }, defaultSlotNode));
  21594. }
  21595. renderFab() {
  21596. return (hAsync("div", { class: CSS$k.fabContainer }, hAsync("slot", { name: SLOTS$c.fab })));
  21597. }
  21598. render() {
  21599. const { dismissed, dismissible, loading, panelKeyDownHandler } = this;
  21600. const panelNode = (hAsync("article", { "aria-busy": toAriaBoolean(loading), class: CSS$k.container, hidden: dismissible && dismissed, onKeyDown: panelKeyDownHandler, ref: this.setContainerRef, tabIndex: dismissible ? 0 : -1 }, this.renderHeaderNode(), this.renderContent(), this.renderFooterNode()));
  21601. return (hAsync(Fragment, null, loading ? hAsync("calcite-scrim", { loading: loading }) : null, panelNode));
  21602. }
  21603. get el() { return getElement(this); }
  21604. static get watchers() { return {
  21605. "dismissed": ["dismissedHandler"]
  21606. }; }
  21607. static get style() { return panelCss; }
  21608. static get cmpMeta() { return {
  21609. "$flags$": 9,
  21610. "$tagName$": "calcite-panel",
  21611. "$members$": {
  21612. "dismissed": [1540],
  21613. "beforeBack": [16],
  21614. "disabled": [516],
  21615. "dismissible": [516],
  21616. "headingLevel": [2, "heading-level"],
  21617. "showBackButton": [516, "show-back-button"],
  21618. "intlBack": [1, "intl-back"],
  21619. "heightScale": [513, "height-scale"],
  21620. "widthScale": [513, "width-scale"],
  21621. "loading": [516],
  21622. "intlClose": [1, "intl-close"],
  21623. "intlOptions": [1, "intl-options"],
  21624. "heading": [1],
  21625. "summary": [1],
  21626. "menuOpen": [516, "menu-open"],
  21627. "setFocus": [64],
  21628. "scrollContentTo": [64]
  21629. },
  21630. "$listeners$": undefined,
  21631. "$lazyBundleId$": "-",
  21632. "$attrsToReflect$": [["dismissed", "dismissed"], ["disabled", "disabled"], ["dismissible", "dismissible"], ["showBackButton", "show-back-button"], ["heightScale", "height-scale"], ["widthScale", "width-scale"], ["loading", "loading"], ["menuOpen", "menu-open"]]
  21633. }; }
  21634. }
  21635. const CSS$j = {
  21636. sticky: "sticky-pos"
  21637. };
  21638. var ICON_TYPES$1;
  21639. (function (ICON_TYPES) {
  21640. ICON_TYPES["circle"] = "circle";
  21641. ICON_TYPES["square"] = "square";
  21642. ICON_TYPES["grip"] = "grip";
  21643. })(ICON_TYPES$1 || (ICON_TYPES$1 = {}));
  21644. const SLOTS$b = {
  21645. menuActions: "menu-actions"
  21646. };
  21647. const CSS$i = {
  21648. heading: "heading",
  21649. container: "container",
  21650. indented: "container--indented"
  21651. };
  21652. const SLOTS$a = {
  21653. parentItem: "parent-item"
  21654. };
  21655. const HEADING_LEVEL$3 = 3;
  21656. function mutationObserverCallback() {
  21657. this.setUpItems();
  21658. this.setUpFilter();
  21659. this.deselectRemovedItems();
  21660. }
  21661. const SUPPORTED_ARROW_KEYS = ["ArrowUp", "ArrowDown"];
  21662. // --------------------------------------------------------------------------
  21663. //
  21664. // Lifecycle
  21665. //
  21666. // --------------------------------------------------------------------------
  21667. function initialize() {
  21668. this.setUpItems();
  21669. this.setUpFilter();
  21670. this.emitCalciteListChange = debounce$1(internalCalciteListChangeEvent.bind(this), 0);
  21671. }
  21672. function initializeObserver() {
  21673. var _a;
  21674. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  21675. }
  21676. function cleanUpObserver() {
  21677. var _a;
  21678. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  21679. }
  21680. // --------------------------------------------------------------------------
  21681. //
  21682. // Listeners
  21683. //
  21684. // --------------------------------------------------------------------------
  21685. function calciteListItemChangeHandler(event) {
  21686. const { selectedValues } = this;
  21687. const { item, value, selected, shiftPressed } = event.detail;
  21688. if (selected) {
  21689. if (this.multiple && shiftPressed) {
  21690. this.selectSiblings(item);
  21691. }
  21692. if (!this.multiple) {
  21693. this.deselectSiblingItems(item);
  21694. }
  21695. selectedValues.set(value, item);
  21696. }
  21697. else {
  21698. selectedValues.delete(value);
  21699. if (this.multiple && shiftPressed) {
  21700. this.selectSiblings(item, true);
  21701. }
  21702. }
  21703. if (!this.multiple) {
  21704. toggleSingleSelectItemTabbing(item, selected);
  21705. if (selected) {
  21706. focusElement(item);
  21707. }
  21708. }
  21709. this.lastSelectedItem = item;
  21710. this.emitCalciteListChange();
  21711. }
  21712. function calciteListItemValueChangeHandler(event) {
  21713. event.stopPropagation();
  21714. const oldValue = event.detail.oldValue;
  21715. const selectedValues = this.selectedValues;
  21716. if (selectedValues.has(oldValue)) {
  21717. const item = selectedValues.get(oldValue);
  21718. selectedValues.delete(oldValue);
  21719. selectedValues.set(event.detail.newValue, item);
  21720. }
  21721. }
  21722. // --------------------------------------------------------------------------
  21723. //
  21724. // Private Methods
  21725. //
  21726. // --------------------------------------------------------------------------
  21727. function isValidNavigationKey(key) {
  21728. return !!SUPPORTED_ARROW_KEYS.find((k) => k === key);
  21729. }
  21730. function calciteListFocusOutHandler(event) {
  21731. const { el, items, multiple, selectedValues } = this;
  21732. if (multiple) {
  21733. return;
  21734. }
  21735. const focusedInside = el.contains(event.relatedTarget);
  21736. if (focusedInside) {
  21737. return;
  21738. }
  21739. filterOutDisabled(items).forEach((item) => {
  21740. toggleSingleSelectItemTabbing(item, selectedValues.size === 0 ? item.contains(event.target) || event.target === item : item.selected);
  21741. });
  21742. }
  21743. function keyDownHandler(event) {
  21744. const { key, target } = event;
  21745. if (!isValidNavigationKey(key)) {
  21746. return;
  21747. }
  21748. const { items, multiple, selectionFollowsFocus } = this;
  21749. const { length: totalItems } = items;
  21750. const currentIndex = items.indexOf(target);
  21751. if (!totalItems || currentIndex === -1) {
  21752. return;
  21753. }
  21754. event.preventDefault();
  21755. const index = moveItemIndex(this, target, key === "ArrowUp" ? "up" : "down");
  21756. const item = items[index];
  21757. items.forEach((i) => toggleSingleSelectItemTabbing(i, i === item));
  21758. if (!multiple && selectionFollowsFocus) {
  21759. item.selected = true;
  21760. }
  21761. focusElement(item);
  21762. }
  21763. function moveItemIndex(list, item, direction) {
  21764. const { items } = list;
  21765. const { length: totalItems } = items;
  21766. const currentIndex = items.indexOf(item);
  21767. const directionFactor = direction === "up" ? -1 : 1;
  21768. let moveOffset = 1;
  21769. let index = getRoundRobinIndex(currentIndex + directionFactor * moveOffset++, totalItems);
  21770. const firstMovedIndex = index;
  21771. while (items[index].disabled) {
  21772. index = getRoundRobinIndex(currentIndex + directionFactor * moveOffset++, totalItems);
  21773. if (index === firstMovedIndex) {
  21774. break;
  21775. }
  21776. }
  21777. return index;
  21778. }
  21779. function filterOutDisabled(items) {
  21780. return items.filter((item) => !item.disabled);
  21781. }
  21782. function internalCalciteListChangeEvent() {
  21783. this.calciteListChange.emit(this.selectedValues);
  21784. }
  21785. function removeItem(event) {
  21786. if (event.defaultPrevented) {
  21787. return;
  21788. }
  21789. const item = event.target;
  21790. const selectedValues = this.selectedValues;
  21791. if (item.parentElement.tagName === "CALCITE-PICK-LIST-GROUP" && item.slot === SLOTS$a.parentItem) {
  21792. item.parentElement.remove();
  21793. Array.from(item.parentElement.children).forEach((item) => selectedValues.delete(item.value));
  21794. }
  21795. else {
  21796. item.remove();
  21797. selectedValues.delete(item.value);
  21798. }
  21799. this.emitCalciteListChange();
  21800. }
  21801. function toggleSingleSelectItemTabbing(item, selectable) {
  21802. if (item.disabled) {
  21803. return;
  21804. }
  21805. // using attribute intentionally
  21806. if (selectable) {
  21807. item.removeAttribute("tabindex");
  21808. }
  21809. else {
  21810. item.setAttribute("tabindex", "-1");
  21811. }
  21812. }
  21813. async function setFocus(focusId) {
  21814. var _a;
  21815. if (this.filterEnabled && focusId === "filter") {
  21816. await focusElement(this.filterEl);
  21817. return;
  21818. }
  21819. const { items, multiple, selectionFollowsFocus } = this;
  21820. if (items.length === 0) {
  21821. return;
  21822. }
  21823. if (multiple) {
  21824. return (_a = filterOutDisabled(items)[0]) === null || _a === void 0 ? void 0 : _a.setFocus();
  21825. }
  21826. const filtered = filterOutDisabled(items);
  21827. const focusTarget = filtered.find((item) => item.selected) || filtered[0];
  21828. if (selectionFollowsFocus && focusTarget) {
  21829. focusTarget.selected = true;
  21830. }
  21831. return focusTarget.setFocus();
  21832. }
  21833. function setUpItems(tagName) {
  21834. this.items = Array.from(this.el.querySelectorAll(tagName));
  21835. let hasSelected = false;
  21836. const { items } = this;
  21837. items.forEach((item) => {
  21838. item.icon = this.getIconType();
  21839. if (!this.multiple) {
  21840. item.disableDeselect = true;
  21841. toggleSingleSelectItemTabbing(item, false);
  21842. }
  21843. if (item.selected) {
  21844. hasSelected = true;
  21845. toggleSingleSelectItemTabbing(item, true);
  21846. this.selectedValues.set(item.value, item);
  21847. }
  21848. });
  21849. const [first] = items;
  21850. if (!hasSelected && first && !first.disabled) {
  21851. toggleSingleSelectItemTabbing(first, true);
  21852. }
  21853. }
  21854. function deselectRemovedItems() {
  21855. const selectedValues = this.selectedValues;
  21856. const itemValues = this.items.map(({ value }) => value);
  21857. selectedValues.forEach((selectedItem) => {
  21858. if (!itemValues.includes(selectedItem.value)) {
  21859. this.selectedValues.delete(selectedItem.value);
  21860. }
  21861. });
  21862. }
  21863. function deselectSiblingItems(item) {
  21864. this.items.forEach((currentItem) => {
  21865. if (currentItem.value !== item.value) {
  21866. currentItem.toggleSelected(false);
  21867. if (this.selectedValues.has(currentItem.value)) {
  21868. this.selectedValues.delete(currentItem.value);
  21869. }
  21870. }
  21871. });
  21872. }
  21873. function selectSiblings(item, deselect = false) {
  21874. if (!this.lastSelectedItem) {
  21875. return;
  21876. }
  21877. const { items } = this;
  21878. const start = items.findIndex((currentItem) => {
  21879. return currentItem.value === this.lastSelectedItem.value;
  21880. });
  21881. const end = items.findIndex((currentItem) => {
  21882. return currentItem.value === item.value;
  21883. });
  21884. items.slice(Math.min(start, end), Math.max(start, end)).forEach((currentItem) => {
  21885. currentItem.toggleSelected(!deselect);
  21886. if (!deselect) {
  21887. this.selectedValues.set(currentItem.value, currentItem);
  21888. }
  21889. else {
  21890. this.selectedValues.delete(currentItem.value);
  21891. }
  21892. });
  21893. }
  21894. let groups;
  21895. function handleFilter(event) {
  21896. const { filteredItems } = event.currentTarget;
  21897. const values = filteredItems.map((item) => item.value);
  21898. let hasSelectedMatch = false;
  21899. if (!groups) {
  21900. groups = new Set();
  21901. }
  21902. const matchedItems = this.items.filter((item) => {
  21903. const parent = item.parentElement;
  21904. const grouped = parent.matches("calcite-pick-list-group");
  21905. if (grouped) {
  21906. groups.add(parent);
  21907. }
  21908. const matches = values.includes(item.value);
  21909. item.hidden = !matches;
  21910. if (!hasSelectedMatch) {
  21911. hasSelectedMatch = matches && item.selected;
  21912. }
  21913. return matches;
  21914. });
  21915. groups.forEach((group) => {
  21916. const hasAtLeastOneMatch = matchedItems.some((item) => group.contains(item));
  21917. group.hidden = !hasAtLeastOneMatch;
  21918. if (!hasAtLeastOneMatch) {
  21919. return;
  21920. }
  21921. const parentItem = getSlotted(group, "parent-item");
  21922. if (parentItem) {
  21923. parentItem.hidden = false;
  21924. if (matchedItems.includes(parentItem)) {
  21925. Array.from(group.children).forEach((child) => (child.hidden = false));
  21926. }
  21927. }
  21928. });
  21929. groups.clear();
  21930. if (matchedItems.length > 0 && !hasSelectedMatch && !this.multiple) {
  21931. toggleSingleSelectItemTabbing(matchedItems[0], true);
  21932. }
  21933. }
  21934. function getItemData() {
  21935. return this.items.map((item) => ({
  21936. label: item.label,
  21937. description: item.description,
  21938. metadata: item.metadata,
  21939. value: item.value
  21940. }));
  21941. }
  21942. var __rest = (undefined && undefined.__rest) || function (s, e) {
  21943. var t = {};
  21944. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  21945. t[p] = s[p];
  21946. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  21947. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  21948. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  21949. t[p[i]] = s[p[i]];
  21950. }
  21951. return t;
  21952. };
  21953. const List = (_a) => {
  21954. var { props: { disabled, loading, filterEnabled, dataForFilter, handleFilter, filterPlaceholder, setFilterEl } } = _a, rest = __rest(_a, ["props"]);
  21955. const defaultSlot = hAsync("slot", null);
  21956. return (hAsync(Host, Object.assign({ "aria-busy": toAriaBoolean(loading), role: "menu" }, rest),
  21957. hAsync("section", null,
  21958. hAsync("header", { class: { [CSS$j.sticky]: true } },
  21959. filterEnabled ? (hAsync("calcite-filter", { "aria-label": filterPlaceholder, disabled: loading || disabled, items: dataForFilter, onCalciteFilterChange: handleFilter, placeholder: filterPlaceholder, ref: setFilterEl })) : null,
  21960. hAsync("slot", { name: SLOTS$b.menuActions })),
  21961. loading ? hAsync("calcite-scrim", { loading: loading }) : null,
  21962. defaultSlot)));
  21963. };
  21964. const pickListCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-pick-list:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-pick-list{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-pick-list:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-h{display:none}/*!@:host*/.sc-calcite-pick-list-h{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;-ms-flex-positive:1;flex-grow:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;background-color:transparent;font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}/*!@:host **/.sc-calcite-pick-list-h *.sc-calcite-pick-list{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:host([disabled])*/[disabled].sc-calcite-pick-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-pick-list-h[disabled] .sc-calcite-pick-list-s>[calcite-hydrated][disabled],[disabled].sc-calcite-pick-list-h [calcite-hydrated][disabled].sc-calcite-pick-list{opacity:1}/*!@:host([filter-enabled]) header*/[filter-enabled].sc-calcite-pick-list-h header.sc-calcite-pick-list{margin-bottom:0.25rem;display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:end;justify-content:flex-end;background-color:var(--calcite-ui-foreground-1);--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([filter-enabled]) header.sticky-pos*/[filter-enabled].sc-calcite-pick-list-h header.sticky-pos.sc-calcite-pick-list{position:-webkit-sticky;position:sticky;top:0px;z-index:1}/*!@calcite-filter*/calcite-filter.sc-calcite-pick-list{margin-bottom:0px}/*!@:host([loading][disabled])*/[loading][disabled].sc-calcite-pick-list-h{min-height:2rem}";
  21965. /**
  21966. * @slot - A slot for adding `calcite-pick-list-item` elements or `calcite-pick-list-group` elements. Items are displayed as a vertical list.
  21967. * @slot menu-actions - A slot for adding a button + menu combo for performing actions like sorting.
  21968. */
  21969. class PickList {
  21970. constructor(hostRef) {
  21971. registerInstance(this, hostRef);
  21972. this.calciteListChange = createEvent(this, "calciteListChange", 7);
  21973. // --------------------------------------------------------------------------
  21974. //
  21975. // Properties
  21976. //
  21977. // --------------------------------------------------------------------------
  21978. /**
  21979. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  21980. */
  21981. this.disabled = false;
  21982. /**
  21983. * When true, an input appears at the top of the list that can be used by end users to filter items in the list.
  21984. */
  21985. this.filterEnabled = false;
  21986. /**
  21987. * When true, content is waiting to be loaded. This state shows a busy indicator.
  21988. */
  21989. this.loading = false;
  21990. /**
  21991. * Multiple works similar to standard radio buttons and checkboxes.
  21992. * When true, a user can select multiple items at a time.
  21993. * When false, only a single item can be selected at a time
  21994. * and selecting a new item will deselect any other selected items.
  21995. */
  21996. this.multiple = false;
  21997. /**
  21998. * When true and single-selection is enabled, the selection will change when navigating items via the keyboard.
  21999. */
  22000. this.selectionFollowsFocus = false;
  22001. // --------------------------------------------------------------------------
  22002. //
  22003. // Private Properties
  22004. //
  22005. // --------------------------------------------------------------------------
  22006. this.selectedValues = new Map();
  22007. this.dataForFilter = [];
  22008. this.lastSelectedItem = null;
  22009. this.mutationObserver = createObserver("mutation", mutationObserverCallback.bind(this));
  22010. this.setFilterEl = (el) => {
  22011. this.filterEl = el;
  22012. };
  22013. this.deselectRemovedItems = deselectRemovedItems.bind(this);
  22014. this.deselectSiblingItems = deselectSiblingItems.bind(this);
  22015. this.selectSiblings = selectSiblings.bind(this);
  22016. this.handleFilter = handleFilter.bind(this);
  22017. this.getItemData = getItemData.bind(this);
  22018. this.keyDownHandler = keyDownHandler.bind(this);
  22019. }
  22020. // --------------------------------------------------------------------------
  22021. //
  22022. // Lifecycle
  22023. //
  22024. // --------------------------------------------------------------------------
  22025. connectedCallback() {
  22026. initialize.call(this);
  22027. initializeObserver.call(this);
  22028. }
  22029. disconnectedCallback() {
  22030. cleanUpObserver.call(this);
  22031. }
  22032. componentDidRender() {
  22033. updateHostInteraction(this);
  22034. }
  22035. calciteListItemRemoveHandler(event) {
  22036. removeItem.call(this, event);
  22037. }
  22038. calciteListItemChangeHandler(event) {
  22039. calciteListItemChangeHandler.call(this, event);
  22040. }
  22041. calciteListItemPropsChangeHandler(event) {
  22042. event.stopPropagation();
  22043. this.setUpFilter();
  22044. }
  22045. calciteListItemValueChangeHandler(event) {
  22046. calciteListItemValueChangeHandler.call(this, event);
  22047. }
  22048. calciteListFocusOutHandler(event) {
  22049. calciteListFocusOutHandler.call(this, event);
  22050. }
  22051. // --------------------------------------------------------------------------
  22052. //
  22053. // Private Methods
  22054. //
  22055. // --------------------------------------------------------------------------
  22056. setUpItems() {
  22057. setUpItems.call(this, "calcite-pick-list-item");
  22058. }
  22059. setUpFilter() {
  22060. if (this.filterEnabled) {
  22061. this.dataForFilter = this.getItemData();
  22062. }
  22063. }
  22064. // --------------------------------------------------------------------------
  22065. //
  22066. // Public Methods
  22067. //
  22068. // --------------------------------------------------------------------------
  22069. /** Returns the currently selected items */
  22070. async getSelectedItems() {
  22071. return this.selectedValues;
  22072. }
  22073. /** Sets focus on the component. */
  22074. async setFocus(focusId) {
  22075. return setFocus.call(this, focusId);
  22076. }
  22077. // --------------------------------------------------------------------------
  22078. //
  22079. // Render Methods
  22080. //
  22081. // --------------------------------------------------------------------------
  22082. getIconType() {
  22083. return this.multiple ? ICON_TYPES$1.square : ICON_TYPES$1.circle;
  22084. }
  22085. render() {
  22086. return hAsync(List, { onKeyDown: this.keyDownHandler, props: this });
  22087. }
  22088. get el() { return getElement(this); }
  22089. static get style() { return pickListCss; }
  22090. static get cmpMeta() { return {
  22091. "$flags$": 9,
  22092. "$tagName$": "calcite-pick-list",
  22093. "$members$": {
  22094. "disabled": [516],
  22095. "filterEnabled": [516, "filter-enabled"],
  22096. "filterPlaceholder": [513, "filter-placeholder"],
  22097. "headingLevel": [2, "heading-level"],
  22098. "loading": [516],
  22099. "multiple": [516],
  22100. "selectionFollowsFocus": [4, "selection-follows-focus"],
  22101. "selectedValues": [32],
  22102. "dataForFilter": [32],
  22103. "getSelectedItems": [64],
  22104. "setFocus": [64]
  22105. },
  22106. "$listeners$": [[0, "calciteListItemRemove", "calciteListItemRemoveHandler"], [0, "calciteListItemChange", "calciteListItemChangeHandler"], [0, "calciteListItemPropsChange", "calciteListItemPropsChangeHandler"], [0, "calciteListItemValueChange", "calciteListItemValueChangeHandler"], [0, "focusout", "calciteListFocusOutHandler"]],
  22107. "$lazyBundleId$": "-",
  22108. "$attrsToReflect$": [["disabled", "disabled"], ["filterEnabled", "filter-enabled"], ["filterPlaceholder", "filter-placeholder"], ["loading", "loading"], ["multiple", "multiple"]]
  22109. }; }
  22110. }
  22111. const pickListGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-pick-list-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-pick-list-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-pick-list-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-group-h{display:none}/*!@:host*/.sc-calcite-pick-list-group-h{margin-bottom:0.25rem;-webkit-box-sizing:border-box;box-sizing:border-box;display:block;background-color:transparent;font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}/*!@:host **/.sc-calcite-pick-list-group-h *.sc-calcite-pick-list-group{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:host(:last-child)*/.sc-calcite-pick-list-group-h:last-child{margin-bottom:0px}/*!@.header*/.header.sc-calcite-pick-list-group{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-line-pack:justify;align-content:space-between;-ms-flex-align:center;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-pick-list-group{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-pick-list-group .heading.sc-calcite-pick-list-group{-ms-flex:1 1 auto;flex:1 1 auto;padding:0.5rem}/*!@h1.heading*/h1.heading.sc-calcite-pick-list-group{font-size:var(--calcite-font-size-2);line-height:1.5rem}/*!@h2.heading*/h2.heading.sc-calcite-pick-list-group{font-size:var(--calcite-font-size-1);line-height:1.5rem}/*!@h3.heading*/h3.heading.sc-calcite-pick-list-group{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@h4.heading, h5.heading*/h4.heading.sc-calcite-pick-list-group,h5.heading.sc-calcite-pick-list-group{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@h3.heading*/h3.heading.sc-calcite-pick-list-group{margin-top:0.5rem;margin-bottom:0.5rem;margin-left:1rem;margin-right:1rem;font-size:var(--calcite-font-size--1);line-height:1.375;color:var(--calcite-ui-text-3)}/*!@.container--indented*/.container--indented.sc-calcite-pick-list-group{-webkit-margin-start:1.5rem;margin-inline-start:1.5rem}";
  22112. /**
  22113. * @slot - A slot for adding `calcite-pick-list-item` elements.
  22114. */
  22115. class PickListGroup {
  22116. constructor(hostRef) {
  22117. registerInstance(this, hostRef);
  22118. }
  22119. // --------------------------------------------------------------------------
  22120. //
  22121. // Lifecycle
  22122. //
  22123. // --------------------------------------------------------------------------
  22124. connectedCallback() {
  22125. connectConditionalSlotComponent(this);
  22126. }
  22127. disconnectedCallback() {
  22128. disconnectConditionalSlotComponent(this);
  22129. }
  22130. // --------------------------------------------------------------------------
  22131. //
  22132. // Render Methods
  22133. //
  22134. // --------------------------------------------------------------------------
  22135. render() {
  22136. var _a;
  22137. const { el, groupTitle, headingLevel } = this;
  22138. const hasParentItem = getSlotted(el, SLOTS$a.parentItem) !== null;
  22139. const sectionClasses = {
  22140. [CSS$i.container]: true,
  22141. [CSS$i.indented]: hasParentItem
  22142. };
  22143. const title = groupTitle;
  22144. const parentLevel = (_a = el.closest("calcite-pick-list")) === null || _a === void 0 ? void 0 : _a.headingLevel;
  22145. const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
  22146. const level = headingLevel || relativeLevel || HEADING_LEVEL$3;
  22147. return (hAsync(Fragment, null, title ? (hAsync(Heading, { class: CSS$i.heading, level: level }, title)) : null, hAsync("slot", { name: SLOTS$a.parentItem }), hAsync("section", { class: sectionClasses }, hAsync("slot", null))));
  22148. }
  22149. get el() { return getElement(this); }
  22150. static get style() { return pickListGroupCss; }
  22151. static get cmpMeta() { return {
  22152. "$flags$": 9,
  22153. "$tagName$": "calcite-pick-list-group",
  22154. "$members$": {
  22155. "groupTitle": [513, "group-title"],
  22156. "headingLevel": [2, "heading-level"]
  22157. },
  22158. "$listeners$": undefined,
  22159. "$lazyBundleId$": "-",
  22160. "$attrsToReflect$": [["groupTitle", "group-title"]]
  22161. }; }
  22162. }
  22163. const CSS$h = {
  22164. actions: "actions",
  22165. actionsEnd: "actions--end",
  22166. actionsStart: "actions--start",
  22167. description: "description",
  22168. handle: "handle",
  22169. handleActivated: "handle--activated",
  22170. highlight: "highlight",
  22171. icon: "icon",
  22172. iconDot: "icon-dot",
  22173. label: "label",
  22174. remove: "remove",
  22175. title: "title",
  22176. textContainer: "text-container"
  22177. };
  22178. const ICONS$4 = {
  22179. checked: "check",
  22180. remove: "x"
  22181. };
  22182. const SLOTS$9 = {
  22183. actionsEnd: "actions-end",
  22184. actionsStart: "actions-start"
  22185. };
  22186. const TEXT$7 = {
  22187. remove: "Remove"
  22188. };
  22189. const pickListItemCss = "@charset \"UTF-8\";@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-pick-list-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-pick-list-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-pick-list-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-item-h{display:none}/*!@:host*/.sc-calcite-pick-list-item-h{margin:0px;margin-bottom:1px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-1);--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-transition:background-color var(--calcite-animation-timing);transition:background-color var(--calcite-animation-timing);-webkit-animation:calcite-fade-in var(--calcite-animation-timing);animation:calcite-fade-in var(--calcite-animation-timing)}/*!@:host **/.sc-calcite-pick-list-item-h *.sc-calcite-pick-list-item{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@.label*/.label.sc-calcite-pick-list-item{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;cursor:pointer;-ms-flex-align:center;align-items:center;background-color:transparent;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@.label:focus*/.label.sc-calcite-pick-list-item:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.label:hover*/.label.sc-calcite-pick-list-item:hover{background-color:var(--calcite-ui-foreground-2)}/*!@:host([non-interactive]:hover)*/[non-interactive].sc-calcite-pick-list-item-h:hover{background-color:var(--calcite-ui-foreground-1)}/*!@:host([non-interactive]) .label, :host([non-interactive]) .icon*/[non-interactive].sc-calcite-pick-list-item-h .label.sc-calcite-pick-list-item,[non-interactive].sc-calcite-pick-list-item-h .icon.sc-calcite-pick-list-item{pointer-events:none}/*!@.icon*/.icon.sc-calcite-pick-list-item{margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;padding:0.25rem;color:var(--calcite-ui-brand);-ms-flex:0 0 auto;flex:0 0 auto;line-height:0}/*!@.icon:hover*/.icon.sc-calcite-pick-list-item:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.icon-dot*/.icon-dot.sc-calcite-pick-list-item{display:-ms-flexbox;display:flex;width:1.5rem;-ms-flex-align:center;align-items:center;padding:0.5rem}/*!@.icon-dot:before*/.icon-dot.sc-calcite-pick-list-item:before{opacity:0;content:\"•\"}/*!@.icon calcite-icon*/.icon.sc-calcite-pick-list-item calcite-icon.sc-calcite-pick-list-item{opacity:0}/*!@:host([selected]) .icon-dot:before,\n:host([selected]) .icon calcite-icon*/[selected].sc-calcite-pick-list-item-h .icon-dot.sc-calcite-pick-list-item:before,[selected].sc-calcite-pick-list-item-h .icon.sc-calcite-pick-list-item calcite-icon.sc-calcite-pick-list-item{-webkit-transition:opacity var(--calcite-animation-timing);transition:opacity var(--calcite-animation-timing);opacity:1}/*!@.text-container*/.text-container.sc-calcite-pick-list-item{pointer-events:none;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;overflow:hidden;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;font-size:var(--calcite-font-size--2);line-height:1.375;word-wrap:break-word;word-break:break-word}/*!@.title*/.title.sc-calcite-pick-list-item{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1)}/*!@.description*/.description.sc-calcite-pick-list-item{margin-top:0.125rem;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@.actions*/.actions.sc-calcite-pick-list-item{margin:0px;display:-ms-flexbox;display:flex;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:end;justify-content:flex-end}/*!@.actions--start ~ .label*/.actions--start.sc-calcite-pick-list-item~.label.sc-calcite-pick-list-item{-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}/*!@:host([disabled])*/[disabled].sc-calcite-pick-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-pick-list-item-h[disabled] .sc-calcite-pick-list-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-pick-list-item-h [calcite-hydrated][disabled].sc-calcite-pick-list-item{opacity:1}";
  22190. /**
  22191. * @slot actions-end - a slot for adding actions or content to the end side of the item.
  22192. * @slot actions-start - a slot for adding actions or content to the start side of the item.
  22193. */
  22194. class PickListItem {
  22195. constructor(hostRef) {
  22196. registerInstance(this, hostRef);
  22197. this.calciteListItemChange = createEvent(this, "calciteListItemChange", 7);
  22198. this.calciteListItemRemove = createEvent(this, "calciteListItemRemove", 7);
  22199. this.calciteListItemPropsChange = createEvent(this, "calciteListItemPropsChange", 7);
  22200. this.calciteListItemValueChange = createEvent(this, "calciteListItemValueChange", 7);
  22201. /**
  22202. * When true, the item cannot be clicked and is visually muted.
  22203. */
  22204. this.disabled = false;
  22205. /**
  22206. * When false, the item cannot be deselected by user interaction.
  22207. */
  22208. this.disableDeselect = false;
  22209. /**
  22210. * @internal When true, the item cannot be selected by user interaction.
  22211. */
  22212. this.nonInteractive = false;
  22213. /**
  22214. * Determines the icon SVG symbol that will be shown. Options are circle, square, grip or null.
  22215. * @see [ICON_TYPES](https://github.com/Esri/calcite-components/blob/master/src/components/pick-list/resources.ts#L5)
  22216. */
  22217. this.icon = null;
  22218. /**
  22219. * Set this to true to display a remove action that removes the item from the list.
  22220. */
  22221. this.removable = false;
  22222. /**
  22223. * Set this to true to pre-select an item. Toggles when an item is checked/unchecked.
  22224. */
  22225. this.selected = false;
  22226. /**
  22227. * Used as an accessible label (aria-label) for the "remove item" action. Only applicable if removable is true.
  22228. * @default "Remove"
  22229. */
  22230. this.intlRemove = TEXT$7.remove;
  22231. // --------------------------------------------------------------------------
  22232. //
  22233. // Private Methods
  22234. //
  22235. // --------------------------------------------------------------------------
  22236. this.pickListClickHandler = (event) => {
  22237. if (this.disabled || (this.disableDeselect && this.selected) || this.nonInteractive) {
  22238. return;
  22239. }
  22240. this.shiftPressed = event.shiftKey;
  22241. this.selected = !this.selected;
  22242. };
  22243. this.pickListKeyDownHandler = (event) => {
  22244. if (event.key === " ") {
  22245. event.preventDefault();
  22246. if ((this.disableDeselect && this.selected) || this.nonInteractive) {
  22247. return;
  22248. }
  22249. this.selected = !this.selected;
  22250. }
  22251. };
  22252. this.removeClickHandler = () => {
  22253. this.calciteListItemRemove.emit();
  22254. };
  22255. }
  22256. descriptionWatchHandler() {
  22257. this.calciteListItemPropsChange.emit();
  22258. }
  22259. labelWatchHandler() {
  22260. this.calciteListItemPropsChange.emit();
  22261. }
  22262. metadataWatchHandler() {
  22263. this.calciteListItemPropsChange.emit();
  22264. }
  22265. selectedWatchHandler() {
  22266. this.calciteListItemChange.emit({
  22267. item: this.el,
  22268. value: this.value,
  22269. selected: this.selected,
  22270. shiftPressed: this.shiftPressed
  22271. });
  22272. this.shiftPressed = false;
  22273. }
  22274. valueWatchHandler(newValue, oldValue) {
  22275. this.calciteListItemValueChange.emit({ oldValue, newValue });
  22276. }
  22277. // --------------------------------------------------------------------------
  22278. //
  22279. // Lifecycle
  22280. //
  22281. // --------------------------------------------------------------------------
  22282. connectedCallback() {
  22283. connectConditionalSlotComponent(this);
  22284. }
  22285. disconnectedCallback() {
  22286. disconnectConditionalSlotComponent(this);
  22287. }
  22288. componentDidRender() {
  22289. updateHostInteraction(this, this.el.closest("calcite-pick-list") ? "managed" : false);
  22290. }
  22291. // --------------------------------------------------------------------------
  22292. //
  22293. // Public Methods
  22294. //
  22295. // --------------------------------------------------------------------------
  22296. /**
  22297. * Used to toggle the selection state. By default this won't trigger an event.
  22298. * The first argument allows the value to be coerced, rather than swapping values.
  22299. */
  22300. async toggleSelected(coerce) {
  22301. this.selected = typeof coerce === "boolean" ? coerce : !this.selected;
  22302. }
  22303. /** Sets focus on the component. */
  22304. async setFocus() {
  22305. var _a;
  22306. (_a = this.focusEl) === null || _a === void 0 ? void 0 : _a.focus();
  22307. }
  22308. // --------------------------------------------------------------------------
  22309. //
  22310. // Render Methods
  22311. //
  22312. // --------------------------------------------------------------------------
  22313. renderIcon() {
  22314. const { icon } = this;
  22315. if (!icon) {
  22316. return null;
  22317. }
  22318. return (hAsync("span", { class: {
  22319. [CSS$h.icon]: true,
  22320. [CSS$h.iconDot]: icon === ICON_TYPES$1.circle
  22321. }, onClick: this.pickListClickHandler }, icon === ICON_TYPES$1.square ? hAsync("calcite-icon", { icon: ICONS$4.checked, scale: "s" }) : null));
  22322. }
  22323. renderRemoveAction() {
  22324. return this.removable ? (hAsync("calcite-action", { class: CSS$h.remove, icon: ICONS$4.remove, onCalciteActionClick: this.removeClickHandler, slot: SLOTS$9.actionsEnd, text: this.intlRemove })) : null;
  22325. }
  22326. renderActionsStart() {
  22327. const { el } = this;
  22328. const hasActionsStart = getSlotted(el, SLOTS$9.actionsStart);
  22329. return hasActionsStart ? (hAsync("div", { class: { [CSS$h.actions]: true, [CSS$h.actionsStart]: true } }, hAsync("slot", { name: SLOTS$9.actionsStart }))) : null;
  22330. }
  22331. renderActionsEnd() {
  22332. const { el, removable } = this;
  22333. const hasActionsEnd = getSlotted(el, SLOTS$9.actionsEnd);
  22334. return hasActionsEnd || removable ? (hAsync("div", { class: { [CSS$h.actions]: true, [CSS$h.actionsEnd]: true } }, hAsync("slot", { name: SLOTS$9.actionsEnd }), this.renderRemoveAction())) : null;
  22335. }
  22336. render() {
  22337. const { description, label } = this;
  22338. return (hAsync(Fragment, null, this.renderIcon(), this.renderActionsStart(), hAsync("label", { "aria-label": label, class: CSS$h.label, onClick: this.pickListClickHandler, onKeyDown: this.pickListKeyDownHandler, ref: (focusEl) => (this.focusEl = focusEl), tabIndex: 0 }, hAsync("div", { "aria-checked": toAriaBoolean(this.selected), class: CSS$h.textContainer, role: "menuitemcheckbox" }, hAsync("span", { class: CSS$h.title }, label), description ? hAsync("span", { class: CSS$h.description }, description) : null)), this.renderActionsEnd()));
  22339. }
  22340. get el() { return getElement(this); }
  22341. static get watchers() { return {
  22342. "description": ["descriptionWatchHandler"],
  22343. "label": ["labelWatchHandler"],
  22344. "metadata": ["metadataWatchHandler"],
  22345. "selected": ["selectedWatchHandler"],
  22346. "value": ["valueWatchHandler"]
  22347. }; }
  22348. static get style() { return pickListItemCss; }
  22349. static get cmpMeta() { return {
  22350. "$flags$": 9,
  22351. "$tagName$": "calcite-pick-list-item",
  22352. "$members$": {
  22353. "description": [513],
  22354. "disabled": [516],
  22355. "disableDeselect": [4, "disable-deselect"],
  22356. "nonInteractive": [516, "non-interactive"],
  22357. "icon": [513],
  22358. "label": [513],
  22359. "metadata": [16],
  22360. "removable": [516],
  22361. "selected": [1540],
  22362. "intlRemove": [513, "intl-remove"],
  22363. "value": [8],
  22364. "toggleSelected": [64],
  22365. "setFocus": [64]
  22366. },
  22367. "$listeners$": undefined,
  22368. "$lazyBundleId$": "-",
  22369. "$attrsToReflect$": [["description", "description"], ["disabled", "disabled"], ["nonInteractive", "non-interactive"], ["icon", "icon"], ["label", "label"], ["removable", "removable"], ["selected", "selected"], ["intlRemove", "intl-remove"]]
  22370. }; }
  22371. }
  22372. const CSS$g = {
  22373. container: "container",
  22374. arrow: "arrow",
  22375. imageContainer: "image-container",
  22376. closeButtonContainer: "close-button-container",
  22377. closeButton: "close-button",
  22378. content: "content",
  22379. hasHeader: "has-header",
  22380. header: "header",
  22381. headerContent: "header-content",
  22382. heading: "heading"
  22383. };
  22384. const TEXT$6 = {
  22385. close: "Close"
  22386. };
  22387. const defaultPopoverPlacement = "auto";
  22388. const ARIA_CONTROLS = "aria-controls";
  22389. const ARIA_EXPANDED = "aria-expanded";
  22390. const HEADING_LEVEL$2 = 2;
  22391. class PopoverManager$1 {
  22392. constructor() {
  22393. // --------------------------------------------------------------------------
  22394. //
  22395. // Private Properties
  22396. //
  22397. // --------------------------------------------------------------------------
  22398. this.registeredElements = new WeakMap();
  22399. this.registeredElementCount = 0;
  22400. // --------------------------------------------------------------------------
  22401. //
  22402. // Private Methods
  22403. //
  22404. // --------------------------------------------------------------------------
  22405. this.queryPopover = (composedPath) => {
  22406. const { registeredElements } = this;
  22407. const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
  22408. return registeredElements.get(registeredElement);
  22409. };
  22410. this.clickHandler = (event) => {
  22411. const composedPath = event.composedPath();
  22412. const popover = this.queryPopover(composedPath);
  22413. if (popover) {
  22414. popover.toggle();
  22415. return;
  22416. }
  22417. queryElementsRoots(event.target, "calcite-popover")
  22418. .filter((popover) => popover.autoClose && popover.open && !composedPath.includes(popover))
  22419. .forEach((popover) => popover.toggle(false));
  22420. };
  22421. }
  22422. // --------------------------------------------------------------------------
  22423. //
  22424. // Public Methods
  22425. //
  22426. // --------------------------------------------------------------------------
  22427. registerElement(referenceEl, popover) {
  22428. this.registeredElementCount++;
  22429. this.registeredElements.set(referenceEl, popover);
  22430. if (this.registeredElementCount === 1) {
  22431. this.addListeners();
  22432. }
  22433. }
  22434. unregisterElement(referenceEl) {
  22435. if (this.registeredElements.delete(referenceEl)) {
  22436. this.registeredElementCount--;
  22437. }
  22438. if (this.registeredElementCount === 0) {
  22439. this.removeListeners();
  22440. }
  22441. }
  22442. addListeners() {
  22443. document.addEventListener("pointerdown", this.clickHandler, { capture: true });
  22444. }
  22445. removeListeners() {
  22446. document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
  22447. }
  22448. }
  22449. const popoverCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-popover:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-popover{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-popover{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-popover{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-popover{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-popover{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-popover:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-popover-h{display:none}/*!@:host*/.sc-calcite-popover-h{display:block;position:absolute;z-index:900;-webkit-transform:scale(0);transform:scale(0)}/*!@.calcite-popper-anim*/.calcite-popper-anim.sc-calcite-popover{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}/*!@:host([data-popper-placement^=bottom]) .calcite-popper-anim*/[data-popper-placement^=bottom].sc-calcite-popover-h .calcite-popper-anim.sc-calcite-popover{-webkit-transform:translateY(-5px);transform:translateY(-5px)}/*!@:host([data-popper-placement^=top]) .calcite-popper-anim*/[data-popper-placement^=top].sc-calcite-popover-h .calcite-popper-anim.sc-calcite-popover{-webkit-transform:translateY(5px);transform:translateY(5px)}/*!@:host([data-popper-placement^=left]) .calcite-popper-anim*/[data-popper-placement^=left].sc-calcite-popover-h .calcite-popper-anim.sc-calcite-popover{-webkit-transform:translateX(5px);transform:translateX(5px)}/*!@:host([data-popper-placement^=right]) .calcite-popper-anim*/[data-popper-placement^=right].sc-calcite-popover-h .calcite-popper-anim.sc-calcite-popover{-webkit-transform:translateX(-5px);transform:translateX(-5px)}/*!@:host([data-popper-placement]) .calcite-popper-anim--active*/[data-popper-placement].sc-calcite-popover-h .calcite-popper-anim--active.sc-calcite-popover{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}/*!@:host([data-popper-placement][data-popper-reference-hidden])*/[data-popper-placement][data-popper-reference-hidden].sc-calcite-popover-h{pointer-events:none;opacity:0}/*!@.arrow,\n.arrow::before*/.arrow.sc-calcite-popover,.arrow.sc-calcite-popover::before{position:absolute;width:8px;height:8px;z-index:-1}/*!@.arrow::before*/.arrow.sc-calcite-popover::before{content:\"\";--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-transform:rotate(45deg);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}/*!@:host([data-popper-placement^=top]) .arrow*/[data-popper-placement^=top].sc-calcite-popover-h .arrow.sc-calcite-popover{bottom:-4px}/*!@:host([data-popper-placement^=bottom]) .arrow*/[data-popper-placement^=bottom].sc-calcite-popover-h .arrow.sc-calcite-popover{top:-4px}/*!@:host([data-popper-placement^=left]) .arrow*/[data-popper-placement^=left].sc-calcite-popover-h .arrow.sc-calcite-popover{right:-4px}/*!@:host([data-popper-placement^=right]) .arrow*/[data-popper-placement^=right].sc-calcite-popover-h .arrow.sc-calcite-popover{left:-4px}/*!@:host*/.sc-calcite-popover-h{pointer-events:none}/*!@:host([open])*/[open].sc-calcite-popover-h{pointer-events:initial}/*!@.calcite-popper-anim*/.calcite-popper-anim.sc-calcite-popover{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}/*!@.arrow::before*/.arrow.sc-calcite-popover::before{outline:1px solid var(--calcite-ui-border-3)}/*!@.header*/.header.sc-calcite-popover{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:start;justify-content:flex-start;border-width:0px;border-bottom-width:1px;border-style:solid;background-color:var(--calcite-ui-foreground-1);border-bottom-color:var(--calcite-ui-border-3)}/*!@.heading*/.heading.sc-calcite-popover{margin:0px;display:block;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-item-align:center;align-self:center;white-space:normal;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);word-wrap:break-word;word-break:break-word}/*!@.container*/.container.sc-calcite-popover{position:relative;display:-ms-flexbox;display:flex;height:100%;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1)}/*!@.container.has-header*/.container.has-header.sc-calcite-popover{-ms-flex-direction:column;flex-direction:column}/*!@.content*/.content.sc-calcite-popover{display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-item-align:center;align-self:center;word-wrap:break-word;word-break:break-word}/*!@.close-button-container*/.close-button-container.sc-calcite-popover{display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex:0 0 auto;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}/*!@::slotted(calcite-panel), ::slotted(calcite-flow)*/.sc-calcite-popover-s>calcite-panel,.sc-calcite-popover-s>calcite-flow{height:100%}";
  22450. const manager$1 = new PopoverManager$1();
  22451. /**
  22452. * @slot - A slot for adding custom content.
  22453. */
  22454. class Popover {
  22455. constructor(hostRef) {
  22456. registerInstance(this, hostRef);
  22457. this.calcitePopoverClose = createEvent(this, "calcitePopoverClose", 7);
  22458. this.calcitePopoverOpen = createEvent(this, "calcitePopoverOpen", 7);
  22459. // --------------------------------------------------------------------------
  22460. //
  22461. // Properties
  22462. //
  22463. // --------------------------------------------------------------------------
  22464. /**
  22465. * Automatically closes any currently open popovers when clicking outside of a popover.
  22466. */
  22467. this.autoClose = false;
  22468. /**
  22469. * Display a close button within the Popover.
  22470. * @deprecated use dismissible instead.
  22471. */
  22472. this.closeButton = false;
  22473. /**
  22474. * Display a close button within the Popover.
  22475. */
  22476. this.dismissible = false;
  22477. /**
  22478. * Prevents flipping the popover's placement when it starts to overlap its reference element.
  22479. */
  22480. this.disableFlip = false;
  22481. /**
  22482. * Removes the caret pointer.
  22483. */
  22484. this.disablePointer = false;
  22485. /**
  22486. * Offset the position of the popover away from the reference element.
  22487. * @default 6
  22488. */
  22489. this.offsetDistance = defaultOffsetDistance;
  22490. /**
  22491. * Offset the position of the popover along the reference element.
  22492. */
  22493. this.offsetSkidding = 0;
  22494. /**
  22495. * Display and position the component.
  22496. */
  22497. this.open = false;
  22498. /** Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value. */
  22499. this.overlayPositioning = "absolute";
  22500. /**
  22501. * Determines where the component will be positioned relative to the referenceElement.
  22502. * @see [PopperPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/popper.ts#L25)
  22503. */
  22504. this.placement = defaultPopoverPlacement;
  22505. /** Text for close button.
  22506. * @default "Close"
  22507. */
  22508. this.intlClose = TEXT$6.close;
  22509. this.guid = `calcite-popover-${guid()}`;
  22510. this.activeTransitionProp = "opacity";
  22511. // --------------------------------------------------------------------------
  22512. //
  22513. // Private Methods
  22514. //
  22515. // --------------------------------------------------------------------------
  22516. this.setFilteredPlacements = () => {
  22517. const { el, flipPlacements } = this;
  22518. this.filteredFlipPlacements = flipPlacements
  22519. ? filterComputedPlacements(flipPlacements, el)
  22520. : null;
  22521. };
  22522. this.setUpReferenceElement = () => {
  22523. this.removeReferences();
  22524. this.effectiveReferenceElement = this.getReferenceElement();
  22525. const { el, referenceElement, effectiveReferenceElement } = this;
  22526. if (referenceElement && !effectiveReferenceElement) {
  22527. console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
  22528. el
  22529. });
  22530. }
  22531. this.addReferences();
  22532. this.createPopper();
  22533. };
  22534. this.getId = () => {
  22535. return this.el.id || this.guid;
  22536. };
  22537. this.setExpandedAttr = () => {
  22538. const { effectiveReferenceElement, open } = this;
  22539. if (!effectiveReferenceElement) {
  22540. return;
  22541. }
  22542. effectiveReferenceElement.setAttribute(ARIA_EXPANDED, toAriaBoolean(open));
  22543. };
  22544. this.addReferences = () => {
  22545. const { effectiveReferenceElement } = this;
  22546. if (!effectiveReferenceElement) {
  22547. return;
  22548. }
  22549. const id = this.getId();
  22550. effectiveReferenceElement.setAttribute(ARIA_CONTROLS, id);
  22551. manager$1.registerElement(effectiveReferenceElement, this.el);
  22552. this.setExpandedAttr();
  22553. };
  22554. this.removeReferences = () => {
  22555. const { effectiveReferenceElement } = this;
  22556. if (!effectiveReferenceElement) {
  22557. return;
  22558. }
  22559. effectiveReferenceElement.removeAttribute(ARIA_CONTROLS);
  22560. effectiveReferenceElement.removeAttribute(ARIA_EXPANDED);
  22561. manager$1.unregisterElement(effectiveReferenceElement);
  22562. };
  22563. this.hide = () => {
  22564. this.open = false;
  22565. };
  22566. this.transitionEnd = (event) => {
  22567. if (event.propertyName === this.activeTransitionProp) {
  22568. this.open ? this.calcitePopoverOpen.emit() : this.calcitePopoverClose.emit();
  22569. }
  22570. };
  22571. }
  22572. flipPlacementsHandler() {
  22573. this.setFilteredPlacements();
  22574. }
  22575. offsetDistanceOffsetHandler() {
  22576. this.reposition();
  22577. }
  22578. offsetSkiddingHandler() {
  22579. this.reposition();
  22580. }
  22581. openHandler() {
  22582. this.reposition();
  22583. this.setExpandedAttr();
  22584. }
  22585. placementHandler() {
  22586. this.reposition();
  22587. }
  22588. referenceElementHandler() {
  22589. this.setUpReferenceElement();
  22590. }
  22591. // --------------------------------------------------------------------------
  22592. //
  22593. // Lifecycle
  22594. //
  22595. // --------------------------------------------------------------------------
  22596. connectedCallback() {
  22597. this.setFilteredPlacements();
  22598. }
  22599. componentWillLoad() {
  22600. this.setUpReferenceElement();
  22601. }
  22602. componentDidLoad() {
  22603. this.reposition();
  22604. }
  22605. disconnectedCallback() {
  22606. this.removeReferences();
  22607. this.destroyPopper();
  22608. }
  22609. // --------------------------------------------------------------------------
  22610. //
  22611. // Public Methods
  22612. //
  22613. // --------------------------------------------------------------------------
  22614. /** Updates the position of the component. */
  22615. async reposition() {
  22616. const { popper, el, placement } = this;
  22617. const modifiers = this.getModifiers();
  22618. popper
  22619. ? await updatePopper({
  22620. el,
  22621. modifiers,
  22622. placement,
  22623. popper
  22624. })
  22625. : this.createPopper();
  22626. }
  22627. /** Sets focus on the component. */
  22628. async setFocus(focusId) {
  22629. var _a;
  22630. const { closeButtonEl } = this;
  22631. if (focusId === "close-button" && closeButtonEl) {
  22632. forceUpdate$1(closeButtonEl);
  22633. closeButtonEl.setFocus();
  22634. return;
  22635. }
  22636. (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
  22637. }
  22638. /** Toggles the popover's open property. */
  22639. async toggle(value = !this.open) {
  22640. this.open = value;
  22641. }
  22642. getReferenceElement() {
  22643. const { referenceElement, el } = this;
  22644. return ((typeof referenceElement === "string"
  22645. ? queryElementRoots(el, { id: referenceElement })
  22646. : referenceElement) || null);
  22647. }
  22648. getModifiers() {
  22649. const { arrowEl, disableFlip, disablePointer, offsetDistance, offsetSkidding, filteredFlipPlacements } = this;
  22650. const flipModifier = {
  22651. name: "flip",
  22652. enabled: !disableFlip
  22653. };
  22654. if (filteredFlipPlacements) {
  22655. flipModifier.options = {
  22656. fallbackPlacements: filteredFlipPlacements
  22657. };
  22658. }
  22659. const arrowModifier = {
  22660. name: "arrow",
  22661. enabled: !disablePointer
  22662. };
  22663. if (arrowEl) {
  22664. arrowModifier.options = {
  22665. element: arrowEl
  22666. };
  22667. }
  22668. const offsetModifier = {
  22669. name: "offset",
  22670. enabled: true,
  22671. options: {
  22672. offset: [offsetSkidding, offsetDistance]
  22673. }
  22674. };
  22675. const eventListenerModifier = {
  22676. name: "eventListeners",
  22677. enabled: this.open
  22678. };
  22679. return [arrowModifier, flipModifier, offsetModifier, eventListenerModifier];
  22680. }
  22681. createPopper() {
  22682. this.destroyPopper();
  22683. const { el, placement, effectiveReferenceElement: referenceEl, overlayPositioning } = this;
  22684. const modifiers = this.getModifiers();
  22685. this.popper = createPopper({
  22686. el,
  22687. modifiers,
  22688. overlayPositioning,
  22689. placement,
  22690. referenceEl
  22691. });
  22692. }
  22693. destroyPopper() {
  22694. const { popper } = this;
  22695. if (popper) {
  22696. popper.destroy();
  22697. }
  22698. this.popper = null;
  22699. }
  22700. // --------------------------------------------------------------------------
  22701. //
  22702. // Render Methods
  22703. //
  22704. // --------------------------------------------------------------------------
  22705. renderCloseButton() {
  22706. const { dismissible, closeButton, intlClose } = this;
  22707. return dismissible || closeButton ? (hAsync("div", { class: CSS$g.closeButtonContainer }, hAsync("calcite-action", { class: CSS$g.closeButton, onClick: this.hide, ref: (closeButtonEl) => (this.closeButtonEl = closeButtonEl), text: intlClose }, hAsync("calcite-icon", { icon: "x", scale: "m" })))) : null;
  22708. }
  22709. renderHeader() {
  22710. const { heading, headingLevel } = this;
  22711. const headingNode = heading ? (hAsync(Heading, { class: CSS$g.heading, level: headingLevel || HEADING_LEVEL$2 }, heading)) : null;
  22712. return headingNode ? (hAsync("div", { class: CSS$g.header }, headingNode, this.renderCloseButton())) : null;
  22713. }
  22714. render() {
  22715. const { effectiveReferenceElement, heading, label, open, disablePointer } = this;
  22716. const displayed = effectiveReferenceElement && open;
  22717. const hidden = !displayed;
  22718. const arrowNode = !disablePointer ? (hAsync("div", { class: CSS$g.arrow, ref: (arrowEl) => (this.arrowEl = arrowEl) })) : null;
  22719. return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "calcite-hydrated-hidden": hidden, id: this.getId(), role: "dialog" }, hAsync("div", { class: {
  22720. [CSS$D.animation]: true,
  22721. [CSS$D.animationActive]: displayed
  22722. }, onTransitionEnd: this.transitionEnd }, arrowNode, hAsync("div", { class: {
  22723. [CSS$g.hasHeader]: !!heading,
  22724. [CSS$g.container]: true
  22725. } }, this.renderHeader(), hAsync("div", { class: CSS$g.content }, hAsync("slot", null)), !heading ? this.renderCloseButton() : null))));
  22726. }
  22727. get el() { return getElement(this); }
  22728. static get watchers() { return {
  22729. "flipPlacements": ["flipPlacementsHandler"],
  22730. "offsetDistance": ["offsetDistanceOffsetHandler"],
  22731. "offsetSkidding": ["offsetSkiddingHandler"],
  22732. "open": ["openHandler"],
  22733. "placement": ["placementHandler"],
  22734. "referenceElement": ["referenceElementHandler"]
  22735. }; }
  22736. static get style() { return popoverCss; }
  22737. static get cmpMeta() { return {
  22738. "$flags$": 9,
  22739. "$tagName$": "calcite-popover",
  22740. "$members$": {
  22741. "autoClose": [516, "auto-close"],
  22742. "closeButton": [516, "close-button"],
  22743. "dismissible": [516],
  22744. "disableFlip": [516, "disable-flip"],
  22745. "disablePointer": [516, "disable-pointer"],
  22746. "flipPlacements": [16],
  22747. "heading": [1],
  22748. "headingLevel": [2, "heading-level"],
  22749. "label": [1],
  22750. "offsetDistance": [514, "offset-distance"],
  22751. "offsetSkidding": [514, "offset-skidding"],
  22752. "open": [1540],
  22753. "overlayPositioning": [1, "overlay-positioning"],
  22754. "placement": [513],
  22755. "referenceElement": [1, "reference-element"],
  22756. "intlClose": [1, "intl-close"],
  22757. "effectiveReferenceElement": [32],
  22758. "reposition": [64],
  22759. "setFocus": [64],
  22760. "toggle": [64]
  22761. },
  22762. "$listeners$": undefined,
  22763. "$lazyBundleId$": "-",
  22764. "$attrsToReflect$": [["autoClose", "auto-close"], ["closeButton", "close-button"], ["dismissible", "dismissible"], ["disableFlip", "disable-flip"], ["disablePointer", "disable-pointer"], ["offsetDistance", "offset-distance"], ["offsetSkidding", "offset-skidding"], ["open", "open"], ["placement", "placement"]]
  22765. }; }
  22766. }
  22767. const popoverManagerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-popover-manager:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-popover-manager{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-popover-manager{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-popover-manager{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-popover-manager{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-popover-manager{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-popover-manager:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-popover-manager-h{display:none}/*!@:host*/.sc-calcite-popover-manager-h{position:relative;display:block}";
  22768. /**
  22769. * @slot - A slot for adding elements that reference a 'calcite-popover' by the 'selector' property.
  22770. * @deprecated No longer required for popover usage.
  22771. */
  22772. class PopoverManager {
  22773. constructor(hostRef) {
  22774. registerInstance(this, hostRef);
  22775. this.mutationObserver = createObserver();
  22776. // --------------------------------------------------------------------------
  22777. //
  22778. // Properties
  22779. //
  22780. // --------------------------------------------------------------------------
  22781. /**
  22782. * CSS Selector to match reference elements for popovers. Reference elements will be identified by this selector in order to open their associated popover.
  22783. * @default `[data-calcite-popover-reference]`
  22784. */
  22785. this.selector = "[data-calcite-popover-reference]";
  22786. /**
  22787. * Automatically closes any currently open popovers when clicking outside of a popover.
  22788. */
  22789. this.autoClose = false;
  22790. }
  22791. autoCloseHandler() {
  22792. this.setAutoClose();
  22793. }
  22794. // --------------------------------------------------------------------------
  22795. //
  22796. // Lifecycle
  22797. //
  22798. // --------------------------------------------------------------------------
  22799. connectedCallback() {
  22800. var _a;
  22801. this.setAutoClose();
  22802. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  22803. }
  22804. disconnectedCallback() {
  22805. var _a;
  22806. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  22807. }
  22808. // --------------------------------------------------------------------------
  22809. //
  22810. // Render Methods
  22811. //
  22812. // --------------------------------------------------------------------------
  22813. render() {
  22814. return hAsync("slot", null);
  22815. }
  22816. // --------------------------------------------------------------------------
  22817. //
  22818. // Private Methods
  22819. //
  22820. // --------------------------------------------------------------------------
  22821. setAutoClose() {
  22822. const { autoClose, el } = this;
  22823. el.querySelectorAll("calcite-popover").forEach((popover) => (popover.autoClose = autoClose));
  22824. }
  22825. get el() { return getElement(this); }
  22826. static get watchers() { return {
  22827. "autoClose": ["autoCloseHandler"]
  22828. }; }
  22829. static get style() { return popoverManagerCss; }
  22830. static get cmpMeta() { return {
  22831. "$flags$": 9,
  22832. "$tagName$": "calcite-popover-manager",
  22833. "$members$": {
  22834. "selector": [1],
  22835. "autoClose": [516, "auto-close"]
  22836. },
  22837. "$listeners$": undefined,
  22838. "$lazyBundleId$": "-",
  22839. "$attrsToReflect$": [["autoClose", "auto-close"]]
  22840. }; }
  22841. }
  22842. const progressCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-progress:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-progress{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-progress{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-progress{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-progress{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-progress{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-progress:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-progress-h{display:none}/*!@:host*/.sc-calcite-progress-h{position:relative;display:block;width:100%}/*!@.track, .bar*/.track.sc-calcite-progress,.bar.sc-calcite-progress{position:absolute;top:0px;height:2px}/*!@.track*/.track.sc-calcite-progress{z-index:0;width:100%;overflow:hidden;background:var(--calcite-ui-border-3)}/*!@.bar*/.bar.sc-calcite-progress{z-index:0;background-color:var(--calcite-ui-brand)}@media (forced-colors: active){/*!@.track*/.track.sc-calcite-progress{background-color:highlightText}/*!@.bar*/.bar.sc-calcite-progress{background-color:linkText}}/*!@.indeterminate*/.indeterminate.sc-calcite-progress{width:20%;-webkit-animation:looping-progress-bar-ani 2200ms linear infinite;animation:looping-progress-bar-ani 2200ms linear infinite}/*!@.reversed*/.reversed.sc-calcite-progress{animation-direction:reverse}/*!@.text*/.text.sc-calcite-progress{padding-left:0px;padding-right:0px;padding-top:1rem;padding-bottom:0px;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-medium)}@-webkit-keyframes looping-progress-bar-ani{0%{-webkit-transform:translate3d(-100%, 0, 0);transform:translate3d(-100%, 0, 0)}50%{width:40%}100%{-webkit-transform:translate3d(600%, 0, 0);transform:translate3d(600%, 0, 0)}}@keyframes looping-progress-bar-ani{0%{-webkit-transform:translate3d(-100%, 0, 0);transform:translate3d(-100%, 0, 0)}50%{width:40%}100%{-webkit-transform:translate3d(600%, 0, 0);transform:translate3d(600%, 0, 0)}}";
  22843. class Progress {
  22844. constructor(hostRef) {
  22845. registerInstance(this, hostRef);
  22846. /** Use indeterminate if finding actual progress value is impossible */
  22847. this.type = "determinate";
  22848. /** Fraction completed, in the range of 0 - 1.0 */
  22849. this.value = 0;
  22850. /** For indeterminate progress bars, reverse the animation direction */
  22851. this.reversed = false;
  22852. }
  22853. render() {
  22854. const isDeterminate = this.type === "determinate";
  22855. const barStyles = isDeterminate ? { width: `${this.value * 100}%` } : {};
  22856. return (hAsync("div", { "aria-label": this.label || this.text, "aria-valuemax": 1, "aria-valuemin": 0, "aria-valuenow": this.value, role: "progressbar" }, hAsync("div", { class: "track" }, hAsync("div", { class: {
  22857. bar: true,
  22858. indeterminate: this.type === "indeterminate",
  22859. reversed: this.reversed
  22860. }, style: barStyles })), this.text ? hAsync("div", { class: "text" }, this.text) : null));
  22861. }
  22862. get el() { return getElement(this); }
  22863. static get style() { return progressCss; }
  22864. static get cmpMeta() { return {
  22865. "$flags$": 9,
  22866. "$tagName$": "calcite-progress",
  22867. "$members$": {
  22868. "type": [1],
  22869. "value": [2],
  22870. "label": [1],
  22871. "text": [1],
  22872. "reversed": [4]
  22873. },
  22874. "$listeners$": undefined,
  22875. "$lazyBundleId$": "-",
  22876. "$attrsToReflect$": []
  22877. }; }
  22878. }
  22879. const CSS$f = {
  22880. container: "container"
  22881. };
  22882. const radioButtonCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-radio-button:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-radio-button{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-button{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-button{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-button{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-button{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-radio-button:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-button-h{display:none}/*!@:host*/.sc-calcite-radio-button-h{display:block;cursor:pointer}/*!@:host .container*/.sc-calcite-radio-button-h .container.sc-calcite-radio-button{position:relative;outline:2px solid transparent;outline-offset:2px}/*!@:host .radio*/.sc-calcite-radio-button-h .radio.sc-calcite-radio-button{cursor:pointer;border-radius:9999px;background-color:var(--calcite-ui-foreground-1);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input)}/*!@:host([hovered]) .radio,\n:host(:not([checked])[focused]:not([disabled])) .radio*/[hovered].sc-calcite-radio-button-h .radio.sc-calcite-radio-button,.sc-calcite-radio-button-h:not([checked])[focused]:not([disabled]) .radio.sc-calcite-radio-button{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([disabled])*/[disabled].sc-calcite-radio-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) .radio*/[disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{cursor:default;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-radio-button-h[disabled] .sc-calcite-radio-button-s>[calcite-hydrated][disabled],[disabled].sc-calcite-radio-button-h [calcite-hydrated][disabled].sc-calcite-radio-button{opacity:1}/*!@:host([hovered][disabled]) .radio*/[hovered][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input)}/*!@:host([scale=s])*/[scale=s].sc-calcite-radio-button-h{--calcite-radio-size:var(--calcite-font-size--2)}/*!@:host([scale=m])*/[scale=m].sc-calcite-radio-button-h{--calcite-radio-size:var(--calcite-font-size--1)}/*!@:host([scale=l])*/[scale=l].sc-calcite-radio-button-h{--calcite-radio-size:var(--calcite-font-size-0)}/*!@.radio*/.radio.sc-calcite-radio-button{height:var(--calcite-radio-size);max-width:var(--calcite-radio-size);min-width:var(--calcite-radio-size)}/*!@:host([scale=s][checked]) .radio,\n:host([hovered][scale=s][checked][disabled]) .radio*/[scale=s][checked].sc-calcite-radio-button-h .radio.sc-calcite-radio-button,[hovered][scale=s][checked][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{-webkit-box-shadow:inset 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 4px var(--calcite-ui-brand)}/*!@:host([scale=s][focused][checked]:not([disabled])) .radio*/[scale=s][focused][checked].sc-calcite-radio-button-h:not([disabled]) .radio.sc-calcite-radio-button{-webkit-box-shadow:inset 0 0 0 4px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 4px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand)}/*!@:host([scale=m][checked]) .radio,\n:host([hovered][scale=m][checked][disabled]) .radio*/[scale=m][checked].sc-calcite-radio-button-h .radio.sc-calcite-radio-button,[hovered][scale=m][checked][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{-webkit-box-shadow:inset 0 0 0 5px var(--calcite-ui-brand);box-shadow:inset 0 0 0 5px var(--calcite-ui-brand)}/*!@:host([scale=m][focused][checked]:not([disabled])) .radio*/[scale=m][focused][checked].sc-calcite-radio-button-h:not([disabled]) .radio.sc-calcite-radio-button{-webkit-box-shadow:inset 0 0 0 5px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 5px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand)}/*!@:host([scale=l][checked]) .radio,\n:host([hovered][scale=l][checked][disabled]) .radio*/[scale=l][checked].sc-calcite-radio-button-h .radio.sc-calcite-radio-button,[hovered][scale=l][checked][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{-webkit-box-shadow:inset 0 0 0 6px var(--calcite-ui-brand);box-shadow:inset 0 0 0 6px var(--calcite-ui-brand)}/*!@:host([scale=l][focused][checked]:not([disabled])) .radio*/[scale=l][focused][checked].sc-calcite-radio-button-h:not([disabled]) .radio.sc-calcite-radio-button{-webkit-box-shadow:inset 0 0 0 6px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 6px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand)}@media (forced-colors: active){/*!@:host([checked]) .radio::after,\n:host([checked][disabled]) .radio::after*/[checked].sc-calcite-radio-button-h .radio.sc-calcite-radio-button::after,[checked][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button::after{content:\"\";width:var(--calcite-radio-size);height:var(--calcite-radio-size);background-color:windowText;display:block}}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-radio-button-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  22883. class RadioButton {
  22884. constructor(hostRef) {
  22885. registerInstance(this, hostRef);
  22886. this.calciteInternalRadioButtonBlur = createEvent(this, "calciteInternalRadioButtonBlur", 7);
  22887. this.calciteRadioButtonChange = createEvent(this, "calciteRadioButtonChange", 7);
  22888. this.calciteInternalRadioButtonCheckedChange = createEvent(this, "calciteInternalRadioButtonCheckedChange", 7);
  22889. this.calciteInternalRadioButtonFocus = createEvent(this, "calciteInternalRadioButtonFocus", 7);
  22890. //--------------------------------------------------------------------------
  22891. //
  22892. // Properties
  22893. //
  22894. //--------------------------------------------------------------------------
  22895. /** The checked state of the radio button. */
  22896. this.checked = false;
  22897. /** The disabled state of the radio button. */
  22898. this.disabled = false;
  22899. /**
  22900. * The focused state of the radio button.
  22901. * @internal
  22902. */
  22903. this.focused = false;
  22904. /** The radio button's hidden status. When a radio button is hidden it is not focusable or checkable. */
  22905. this.hidden = false;
  22906. /**
  22907. * The hovered state of the radio button.
  22908. * @internal
  22909. */
  22910. this.hovered = false;
  22911. /** Requires that a value is selected for the radio button group before the parent form will submit. */
  22912. this.required = false;
  22913. /** The scale (size) of the radio button. `scale` is passed as a property automatically from `calcite-radio-button-group`. */
  22914. this.scale = "m";
  22915. //--------------------------------------------------------------------------
  22916. //
  22917. // Private Methods
  22918. //
  22919. //--------------------------------------------------------------------------
  22920. this.selectItem = (items, selectedIndex) => {
  22921. items[selectedIndex].click();
  22922. };
  22923. this.queryButtons = () => {
  22924. return Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden])")).filter((radioButton) => radioButton.name === this.name);
  22925. };
  22926. this.isDefaultSelectable = () => {
  22927. const radioButtons = this.queryButtons();
  22928. return !radioButtons.some((radioButton) => radioButton.checked) && radioButtons[0] === this.el;
  22929. };
  22930. this.check = () => {
  22931. if (this.disabled) {
  22932. return;
  22933. }
  22934. this.uncheckAllRadioButtonsInGroup();
  22935. this.checked = true;
  22936. this.calciteRadioButtonChange.emit();
  22937. this.setFocus();
  22938. };
  22939. this.clickHandler = () => {
  22940. this.check();
  22941. };
  22942. this.setContainerEl = (el) => {
  22943. this.containerEl = el;
  22944. };
  22945. this.handleKeyDown = (event) => {
  22946. const keys = ["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", " "];
  22947. const key = event.key;
  22948. const { el } = this;
  22949. if (keys.indexOf(key) === -1) {
  22950. return;
  22951. }
  22952. if (key === " ") {
  22953. this.check();
  22954. return;
  22955. }
  22956. let adjustedKey = key;
  22957. if (getElementDir(el) === "rtl") {
  22958. if (key === "ArrowRight") {
  22959. adjustedKey = "ArrowLeft";
  22960. }
  22961. if (key === "ArrowLeft") {
  22962. adjustedKey = "ArrowRight";
  22963. }
  22964. }
  22965. const radioButtons = Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden]")).filter((radioButton) => radioButton.name === this.name);
  22966. let currentIndex = 0;
  22967. const radioButtonsLength = radioButtons.length;
  22968. radioButtons.some((item, index) => {
  22969. if (item.checked) {
  22970. currentIndex = index;
  22971. return true;
  22972. }
  22973. });
  22974. switch (adjustedKey) {
  22975. case "ArrowLeft":
  22976. case "ArrowUp":
  22977. event.preventDefault();
  22978. this.selectItem(radioButtons, getRoundRobinIndex(Math.max(currentIndex - 1, -1), radioButtonsLength));
  22979. return;
  22980. case "ArrowRight":
  22981. case "ArrowDown":
  22982. event.preventDefault();
  22983. this.selectItem(radioButtons, getRoundRobinIndex(currentIndex + 1, radioButtonsLength));
  22984. return;
  22985. default:
  22986. return;
  22987. }
  22988. };
  22989. this.onContainerBlur = () => {
  22990. this.focused = false;
  22991. this.calciteInternalRadioButtonBlur.emit();
  22992. };
  22993. this.onContainerFocus = () => {
  22994. if (!this.disabled) {
  22995. this.focused = true;
  22996. this.calciteInternalRadioButtonFocus.emit();
  22997. }
  22998. };
  22999. }
  23000. checkedChanged(newChecked) {
  23001. if (newChecked) {
  23002. this.uncheckOtherRadioButtonsInGroup();
  23003. }
  23004. this.calciteInternalRadioButtonCheckedChange.emit(newChecked);
  23005. }
  23006. nameChanged() {
  23007. this.checkLastRadioButton();
  23008. }
  23009. //--------------------------------------------------------------------------
  23010. //
  23011. // Public Methods
  23012. //
  23013. //--------------------------------------------------------------------------
  23014. /** Sets focus on the component. */
  23015. async setFocus() {
  23016. if (!this.disabled) {
  23017. focusElement(this.containerEl);
  23018. }
  23019. }
  23020. onLabelClick(event) {
  23021. if (!this.disabled && !this.hidden) {
  23022. this.uncheckOtherRadioButtonsInGroup();
  23023. const label = event.currentTarget;
  23024. const radioButton = label.for
  23025. ? this.rootNode.querySelector(`calcite-radio-button[id="${label.for}"]`)
  23026. : label.querySelector(`calcite-radio-button[name="${this.name}"]`);
  23027. if (radioButton) {
  23028. radioButton.checked = true;
  23029. radioButton.focused = true;
  23030. }
  23031. this.calciteRadioButtonChange.emit();
  23032. this.setFocus();
  23033. }
  23034. }
  23035. checkLastRadioButton() {
  23036. const radioButtons = this.queryButtons();
  23037. const checkedRadioButtons = radioButtons.filter((radioButton) => radioButton.checked);
  23038. if ((checkedRadioButtons === null || checkedRadioButtons === void 0 ? void 0 : checkedRadioButtons.length) > 1) {
  23039. const lastCheckedRadioButton = checkedRadioButtons[checkedRadioButtons.length - 1];
  23040. checkedRadioButtons
  23041. .filter((checkedRadioButton) => checkedRadioButton !== lastCheckedRadioButton)
  23042. .forEach((checkedRadioButton) => {
  23043. checkedRadioButton.checked = false;
  23044. checkedRadioButton.emitCheckedChange();
  23045. });
  23046. }
  23047. }
  23048. /** @internal */
  23049. async emitCheckedChange() {
  23050. this.calciteInternalRadioButtonCheckedChange.emit();
  23051. }
  23052. uncheckAllRadioButtonsInGroup() {
  23053. const radioButtons = this.queryButtons();
  23054. radioButtons.forEach((radioButton) => {
  23055. if (radioButton.checked) {
  23056. radioButton.checked = false;
  23057. radioButton.focused = false;
  23058. }
  23059. });
  23060. }
  23061. uncheckOtherRadioButtonsInGroup() {
  23062. const radioButtons = this.queryButtons();
  23063. const otherRadioButtons = radioButtons.filter((radioButton) => radioButton.guid !== this.guid);
  23064. otherRadioButtons.forEach((otherRadioButton) => {
  23065. if (otherRadioButton.checked) {
  23066. otherRadioButton.checked = false;
  23067. otherRadioButton.focused = false;
  23068. }
  23069. });
  23070. }
  23071. getTabIndex() {
  23072. if (this.disabled) {
  23073. return undefined;
  23074. }
  23075. return this.checked || this.isDefaultSelectable() ? 0 : -1;
  23076. }
  23077. //--------------------------------------------------------------------------
  23078. //
  23079. // Event Listeners
  23080. //
  23081. //--------------------------------------------------------------------------
  23082. mouseenter() {
  23083. this.hovered = true;
  23084. }
  23085. mouseleave() {
  23086. this.hovered = false;
  23087. }
  23088. //--------------------------------------------------------------------------
  23089. //
  23090. // Lifecycle
  23091. //
  23092. //--------------------------------------------------------------------------
  23093. connectedCallback() {
  23094. this.rootNode = this.el.getRootNode();
  23095. this.guid = this.el.id || `calcite-radio-button-${guid()}`;
  23096. if (this.name) {
  23097. this.checkLastRadioButton();
  23098. }
  23099. connectLabel(this);
  23100. connectForm(this);
  23101. }
  23102. componentDidLoad() {
  23103. if (this.focused && !this.disabled) {
  23104. this.setFocus();
  23105. }
  23106. }
  23107. disconnectedCallback() {
  23108. disconnectLabel(this);
  23109. disconnectForm(this);
  23110. }
  23111. componentDidRender() {
  23112. updateHostInteraction(this);
  23113. }
  23114. // --------------------------------------------------------------------------
  23115. //
  23116. // Render Methods
  23117. //
  23118. // --------------------------------------------------------------------------
  23119. render() {
  23120. const tabIndex = this.getTabIndex();
  23121. return (hAsync(Host, { onClick: this.clickHandler, onKeyDown: this.handleKeyDown }, hAsync("div", { "aria-checked": toAriaBoolean(this.checked), "aria-label": getLabelText(this), class: CSS$f.container, onBlur: this.onContainerBlur, onFocus: this.onContainerFocus, ref: this.setContainerEl, role: "radio", tabIndex: tabIndex }, hAsync("div", { class: "radio" })), hAsync(HiddenFormInputSlot, { component: this })));
  23122. }
  23123. get el() { return getElement(this); }
  23124. static get watchers() { return {
  23125. "checked": ["checkedChanged"],
  23126. "name": ["nameChanged"]
  23127. }; }
  23128. static get style() { return radioButtonCss; }
  23129. static get cmpMeta() { return {
  23130. "$flags$": 9,
  23131. "$tagName$": "calcite-radio-button",
  23132. "$members$": {
  23133. "checked": [1540],
  23134. "disabled": [516],
  23135. "focused": [1540],
  23136. "guid": [1537],
  23137. "hidden": [516],
  23138. "hovered": [1540],
  23139. "label": [1],
  23140. "name": [513],
  23141. "required": [516],
  23142. "scale": [513],
  23143. "value": [1032],
  23144. "setFocus": [64],
  23145. "emitCheckedChange": [64]
  23146. },
  23147. "$listeners$": [[1, "mouseenter", "mouseenter"], [1, "mouseleave", "mouseleave"]],
  23148. "$lazyBundleId$": "-",
  23149. "$attrsToReflect$": [["checked", "checked"], ["disabled", "disabled"], ["focused", "focused"], ["guid", "guid"], ["hidden", "hidden"], ["hovered", "hovered"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
  23150. }; }
  23151. }
  23152. const radioButtonGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-radio-button-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-radio-button-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-button-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-button-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-button-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-button-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-radio-button-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-button-group-h{display:none}/*!@:host*/.sc-calcite-radio-button-group-h{display:-ms-flexbox;display:flex;max-width:100vw}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-radio-button-group-h{-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}/*!@:host([layout=horizontal][scale=s])*/[layout=horizontal][scale=s].sc-calcite-radio-button-group-h{gap:1rem}/*!@:host([layout=horizontal][scale=m])*/[layout=horizontal][scale=m].sc-calcite-radio-button-group-h{gap:1.25rem}/*!@:host([layout=horizontal][scale=l])*/[layout=horizontal][scale=l].sc-calcite-radio-button-group-h{gap:1.5rem}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-radio-button-group-h{-ms-flex-direction:column;flex-direction:column}";
  23153. /**
  23154. * @slot - A slot for adding `calcite-radio-button`s.
  23155. */
  23156. class RadioButtonGroup {
  23157. constructor(hostRef) {
  23158. registerInstance(this, hostRef);
  23159. this.calciteRadioButtonGroupChange = createEvent(this, "calciteRadioButtonGroupChange", 7);
  23160. //--------------------------------------------------------------------------
  23161. //
  23162. // Properties
  23163. //
  23164. //--------------------------------------------------------------------------
  23165. /** The disabled state of the radio button group. */
  23166. this.disabled = false;
  23167. /** The radio button group's hidden status. When a radio button group is hidden none of its options are focusable or checkable. */
  23168. this.hidden = false;
  23169. /** The layout direction of the radio buttons in a group. */
  23170. this.layout = "horizontal";
  23171. /** Requires that a value is selected for the radio button group before the parent form will submit. */
  23172. this.required = false;
  23173. /** The scale (size) of the radio button group. */
  23174. this.scale = "m";
  23175. // --------------------------------------------------------------------------
  23176. //
  23177. // Private Properties
  23178. //
  23179. // --------------------------------------------------------------------------
  23180. this.mutationObserver = createObserver();
  23181. //--------------------------------------------------------------------------
  23182. //
  23183. // Private Methods
  23184. //
  23185. //--------------------------------------------------------------------------
  23186. this.passPropsToRadioButtons = () => {
  23187. const radioButtons = this.el.querySelectorAll("calcite-radio-button");
  23188. if (radioButtons.length > 0) {
  23189. radioButtons.forEach((radioButton) => {
  23190. radioButton.disabled = this.disabled || radioButton.disabled;
  23191. radioButton.hidden = this.hidden;
  23192. radioButton.name = this.name;
  23193. radioButton.required = this.required;
  23194. radioButton.scale = this.scale;
  23195. });
  23196. }
  23197. };
  23198. }
  23199. onDisabledChange() {
  23200. this.passPropsToRadioButtons();
  23201. }
  23202. onHiddenChange() {
  23203. this.passPropsToRadioButtons();
  23204. }
  23205. onLayoutChange() {
  23206. this.passPropsToRadioButtons();
  23207. }
  23208. onScaleChange() {
  23209. this.passPropsToRadioButtons();
  23210. }
  23211. //--------------------------------------------------------------------------
  23212. //
  23213. // Lifecycle
  23214. //
  23215. //--------------------------------------------------------------------------
  23216. connectedCallback() {
  23217. var _a;
  23218. this.passPropsToRadioButtons();
  23219. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  23220. }
  23221. disconnectedCallback() {
  23222. var _a;
  23223. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  23224. }
  23225. //--------------------------------------------------------------------------
  23226. //
  23227. // Event Listeners
  23228. //
  23229. //--------------------------------------------------------------------------
  23230. radioButtonChangeHandler(event) {
  23231. this.calciteRadioButtonGroupChange.emit(event.target.value);
  23232. }
  23233. // --------------------------------------------------------------------------
  23234. //
  23235. // Render Methods
  23236. //
  23237. // --------------------------------------------------------------------------
  23238. render() {
  23239. return (hAsync(Host, { role: "radiogroup" }, hAsync("slot", null)));
  23240. }
  23241. get el() { return getElement(this); }
  23242. static get watchers() { return {
  23243. "disabled": ["onDisabledChange"],
  23244. "hidden": ["onHiddenChange"],
  23245. "layout": ["onLayoutChange"],
  23246. "scale": ["onScaleChange"]
  23247. }; }
  23248. static get style() { return radioButtonGroupCss; }
  23249. static get cmpMeta() { return {
  23250. "$flags$": 9,
  23251. "$tagName$": "calcite-radio-button-group",
  23252. "$members$": {
  23253. "disabled": [516],
  23254. "hidden": [516],
  23255. "layout": [513],
  23256. "name": [513],
  23257. "required": [516],
  23258. "scale": [513]
  23259. },
  23260. "$listeners$": [[0, "calciteRadioButtonChange", "radioButtonChangeHandler"]],
  23261. "$lazyBundleId$": "-",
  23262. "$attrsToReflect$": [["disabled", "disabled"], ["hidden", "hidden"], ["layout", "layout"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
  23263. }; }
  23264. }
  23265. const radioGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-radio-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-radio-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-radio-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-group-h{display:none}/*!@:host*/.sc-calcite-radio-group-h{display:-ms-flexbox;display:flex;background-color:var(--calcite-ui-foreground-1);width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;outline:1px solid var(--calcite-ui-border-input);outline-offset:-1px}/*!@:host([disabled])*/[disabled].sc-calcite-radio-group-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-radio-group-h[disabled] .sc-calcite-radio-group-s>[calcite-hydrated][disabled],[disabled].sc-calcite-radio-group-h [calcite-hydrated][disabled].sc-calcite-radio-group{opacity:1}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-radio-group-h{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start;-ms-flex-item-align:start;align-self:flex-start}/*!@:host([width=full])*/[width=full].sc-calcite-radio-group-h{width:100%;min-width:-moz-fit-content;min-width:-webkit-fit-content;min-width:fit-content}/*!@:host([width=full]) ::slotted(calcite-radio-group-item)*/.sc-calcite-radio-group-h[width=full] .sc-calcite-radio-group-s>calcite-radio-group-item{-ms-flex:1 1 auto;flex:1 1 auto}/*!@:host([width=full][layout=vertical]) ::slotted(calcite-radio-group-item)*/.sc-calcite-radio-group-h[width=full][layout=vertical] .sc-calcite-radio-group-s>calcite-radio-group-item{-ms-flex-pack:start;justify-content:flex-start}/*!@::slotted(calcite-radio-group-item[checked]), ::slotted(calcite-radio-group-item:focus)*/.sc-calcite-radio-group-s>calcite-radio-group-item[checked],.sc-calcite-radio-group-s>calcite-radio-group-item:focus{z-index:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-radio-group-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  23266. /**
  23267. * @slot - A slot for adding `calcite-radio-group-item`s.
  23268. */
  23269. class RadioGroup {
  23270. constructor(hostRef) {
  23271. registerInstance(this, hostRef);
  23272. this.calciteRadioGroupChange = createEvent(this, "calciteRadioGroupChange", 7);
  23273. //--------------------------------------------------------------------------
  23274. //
  23275. // Properties
  23276. //
  23277. //--------------------------------------------------------------------------
  23278. /** specify the appearance style of the radio group, defaults to solid. */
  23279. this.appearance = "solid";
  23280. /** is the radio group disabled */
  23281. this.disabled = false;
  23282. /**
  23283. * When true, makes the component required for form-submission.
  23284. *
  23285. * @internal
  23286. */
  23287. this.required = false;
  23288. /** specify the layout of the radio group, defaults to horizontal */
  23289. this.layout = "horizontal";
  23290. /** The scale of the radio group */
  23291. this.scale = "m";
  23292. /** The value of the selectedItem */
  23293. this.value = null;
  23294. /** specify the width of the group, defaults to auto */
  23295. this.width = "auto";
  23296. //--------------------------------------------------------------------------
  23297. //
  23298. // Event Listeners
  23299. //
  23300. //--------------------------------------------------------------------------
  23301. this.handleClick = (event) => {
  23302. if (event.target.localName === "calcite-radio-group-item") {
  23303. this.selectItem(event.target, true);
  23304. }
  23305. };
  23306. }
  23307. valueHandler(value) {
  23308. const items = this.getItems();
  23309. items.forEach((item) => (item.checked = item.value === value));
  23310. }
  23311. handleSelectedItemChange(newItem, oldItem) {
  23312. this.value = newItem === null || newItem === void 0 ? void 0 : newItem.value;
  23313. if (newItem === oldItem) {
  23314. return;
  23315. }
  23316. const items = this.getItems();
  23317. const match = Array.from(items)
  23318. .filter((item) => item === newItem)
  23319. .pop();
  23320. if (match) {
  23321. this.selectItem(match);
  23322. }
  23323. else if (items[0]) {
  23324. items[0].tabIndex = 0;
  23325. }
  23326. }
  23327. //--------------------------------------------------------------------------
  23328. //
  23329. // Lifecycle
  23330. //
  23331. //--------------------------------------------------------------------------
  23332. componentWillLoad() {
  23333. const items = this.getItems();
  23334. const lastChecked = Array.from(items)
  23335. .filter((item) => item.checked)
  23336. .pop();
  23337. if (lastChecked) {
  23338. this.selectItem(lastChecked);
  23339. }
  23340. else if (items[0]) {
  23341. items[0].tabIndex = 0;
  23342. }
  23343. }
  23344. connectedCallback() {
  23345. connectLabel(this);
  23346. connectForm(this);
  23347. }
  23348. disconnectedCallback() {
  23349. disconnectLabel(this);
  23350. disconnectForm(this);
  23351. }
  23352. componentDidRender() {
  23353. updateHostInteraction(this);
  23354. }
  23355. render() {
  23356. return (hAsync(Host, { onClick: this.handleClick, role: "radiogroup" }, hAsync("slot", null), hAsync(HiddenFormInputSlot, { component: this })));
  23357. }
  23358. handleSelected(event) {
  23359. event.stopPropagation();
  23360. event.preventDefault();
  23361. this.selectItem(event.target);
  23362. }
  23363. handleKeyDown(event) {
  23364. const keys = ["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", " "];
  23365. const key = event.key;
  23366. const { el, selectedItem } = this;
  23367. if (keys.indexOf(key) === -1) {
  23368. return;
  23369. }
  23370. let adjustedKey = key;
  23371. if (getElementDir(el) === "rtl") {
  23372. if (key === "ArrowRight") {
  23373. adjustedKey = "ArrowLeft";
  23374. }
  23375. if (key === "ArrowLeft") {
  23376. adjustedKey = "ArrowRight";
  23377. }
  23378. }
  23379. const items = this.getItems();
  23380. let selectedIndex = -1;
  23381. items.forEach((item, index) => {
  23382. if (item === selectedItem) {
  23383. selectedIndex = index;
  23384. }
  23385. });
  23386. switch (adjustedKey) {
  23387. case "ArrowLeft":
  23388. case "ArrowUp":
  23389. event.preventDefault();
  23390. const previous = selectedIndex < 1 ? items.item(items.length - 1) : items.item(selectedIndex - 1);
  23391. this.selectItem(previous, true);
  23392. return;
  23393. case "ArrowRight":
  23394. case "ArrowDown":
  23395. event.preventDefault();
  23396. const next = selectedIndex === -1 ? items.item(1) : items.item(selectedIndex + 1) || items.item(0);
  23397. this.selectItem(next, true);
  23398. return;
  23399. case " ":
  23400. event.preventDefault();
  23401. this.selectItem(event.target, true);
  23402. return;
  23403. default:
  23404. return;
  23405. }
  23406. }
  23407. // --------------------------------------------------------------------------
  23408. //
  23409. // Methods
  23410. //
  23411. // --------------------------------------------------------------------------
  23412. /** Sets focus on the component. */
  23413. async setFocus() {
  23414. var _a;
  23415. (_a = (this.selectedItem || this.getItems()[0])) === null || _a === void 0 ? void 0 : _a.focus();
  23416. }
  23417. //--------------------------------------------------------------------------
  23418. //
  23419. // Private Methods
  23420. //
  23421. //--------------------------------------------------------------------------
  23422. onLabelClick() {
  23423. this.setFocus();
  23424. }
  23425. getItems() {
  23426. return this.el.querySelectorAll("calcite-radio-group-item");
  23427. }
  23428. selectItem(selected, emit = false) {
  23429. if (selected === this.selectedItem) {
  23430. return;
  23431. }
  23432. const items = this.getItems();
  23433. let match = null;
  23434. items.forEach((item) => {
  23435. const matches = item.value === selected.value;
  23436. if ((matches && !item.checked) || (!matches && item.checked)) {
  23437. item.checked = matches;
  23438. }
  23439. item.tabIndex = matches ? 0 : -1;
  23440. if (matches) {
  23441. match = item;
  23442. if (emit) {
  23443. this.calciteRadioGroupChange.emit(match.value);
  23444. }
  23445. }
  23446. });
  23447. this.selectedItem = match;
  23448. }
  23449. get el() { return getElement(this); }
  23450. static get watchers() { return {
  23451. "value": ["valueHandler"],
  23452. "selectedItem": ["handleSelectedItemChange"]
  23453. }; }
  23454. static get style() { return radioGroupCss; }
  23455. static get cmpMeta() { return {
  23456. "$flags$": 9,
  23457. "$tagName$": "calcite-radio-group",
  23458. "$members$": {
  23459. "appearance": [513],
  23460. "disabled": [516],
  23461. "required": [516],
  23462. "layout": [513],
  23463. "name": [1],
  23464. "scale": [513],
  23465. "value": [1025],
  23466. "selectedItem": [1040],
  23467. "width": [513],
  23468. "setFocus": [64]
  23469. },
  23470. "$listeners$": [[0, "calciteRadioGroupItemChange", "handleSelected"], [0, "keydown", "handleKeyDown"]],
  23471. "$lazyBundleId$": "-",
  23472. "$attrsToReflect$": [["appearance", "appearance"], ["disabled", "disabled"], ["required", "required"], ["layout", "layout"], ["scale", "scale"], ["width", "width"]]
  23473. }; }
  23474. }
  23475. const SLOTS$8 = {
  23476. input: "input"
  23477. };
  23478. const CSS$e = {
  23479. radioGroupItemIcon: "radio-group-item-icon"
  23480. };
  23481. const radioGroupItemCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-radio-group-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-radio-group-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-group-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-group-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-group-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-group-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-radio-group-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-group-item-h{display:none}/*!@:host*/.sc-calcite-radio-group-item-h{display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-item-align:stretch;align-self:stretch;font-weight:var(--calcite-font-weight-normal);-webkit-transition:background-color var(--calcite-internal-animation-timing-fast) ease-in-out, border-color var(--calcite-animation-timing) ease-in-out;transition:background-color var(--calcite-internal-animation-timing-fast) ease-in-out, border-color var(--calcite-animation-timing) ease-in-out}/*!@:host label*/.sc-calcite-radio-group-item-h label.sc-calcite-radio-group-item{pointer-events:none;margin:0.125rem;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex:1 1 0%;flex:1 1 0%;-ms-flex-align:center;align-items:center;color:var(--calcite-ui-text-3);-webkit-transition:background-color var(--calcite-internal-animation-timing-fast) ease-in-out, border-color var(--calcite-internal-animation-timing-fast) ease-in-out, color var(--calcite-internal-animation-timing-fast) ease-in-out;transition:background-color var(--calcite-internal-animation-timing-fast) ease-in-out, border-color var(--calcite-internal-animation-timing-fast) ease-in-out, color var(--calcite-internal-animation-timing-fast) ease-in-out}/*!@.label--horizontal*/.label--horizontal.sc-calcite-radio-group-item{-ms-flex-pack:center;justify-content:center}/*!@:host*/.sc-calcite-radio-group-item-h{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host(:focus)*/.sc-calcite-radio-group-item-h:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-1px}/*!@.label--scale-s*/.label--scale-s.sc-calcite-radio-group-item{padding-left:0.5rem;padding-right:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-top:0.125rem;padding-bottom:0.125rem}/*!@.label--scale-m*/.label--scale-m.sc-calcite-radio-group-item{padding-left:0.75rem;padding-right:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-top:0.375rem;padding-bottom:0.375rem}/*!@.label--scale-l*/.label--scale-l.sc-calcite-radio-group-item{padding-left:1rem;padding-right:1rem;padding-top:0.625rem;padding-bottom:0.625rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host(:hover) label*/.sc-calcite-radio-group-item-h:hover label.sc-calcite-radio-group-item{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@:host(:active) label*/.sc-calcite-radio-group-item-h:active label.sc-calcite-radio-group-item{background-color:var(--calcite-ui-foreground-3)}/*!@:host([checked]) label*/[checked].sc-calcite-radio-group-item-h label.sc-calcite-radio-group-item{cursor:default;border-color:var(--calcite-ui-brand);background-color:var(--calcite-ui-brand);color:var(--calcite-ui-background)}/*!@:host([checked]) .label--outline*/[checked].sc-calcite-radio-group-item-h .label--outline.sc-calcite-radio-group-item{border-color:var(--calcite-ui-brand);background-color:var(--calcite-ui-foreground-1);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-brand);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand);color:var(--calcite-ui-brand)}/*!@::slotted(input)*/.sc-calcite-radio-group-item-s>input{display:none}/*!@.radio-group-item-icon*/.radio-group-item-icon.sc-calcite-radio-group-item{position:relative;margin:0px;display:-ms-inline-flexbox;display:inline-flex;line-height:inherit}/*!@:host([icon-position=start]) .label--scale-s .radio-group-item-icon*/[icon-position=start].sc-calcite-radio-group-item-h .label--scale-s.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}/*!@:host([icon-position=end]) .label--scale-s .radio-group-item-icon*/[icon-position=end].sc-calcite-radio-group-item-h .label--scale-s.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{-webkit-margin-end:unset;margin-inline-end:unset;-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}/*!@:host([icon-position=start]) .label--scale-m .radio-group-item-icon*/[icon-position=start].sc-calcite-radio-group-item-h .label--scale-m.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{-webkit-margin-end:0.75rem;margin-inline-end:0.75rem}/*!@:host([icon-position=end]) .label--scale-m .radio-group-item-icon*/[icon-position=end].sc-calcite-radio-group-item-h .label--scale-m.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{-webkit-margin-end:unset;margin-inline-end:unset;-webkit-margin-start:0.75rem;margin-inline-start:0.75rem}/*!@:host([icon-position=start]) .label--scale-l .radio-group-item-icon*/[icon-position=start].sc-calcite-radio-group-item-h .label--scale-l.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{-webkit-margin-end:1rem;margin-inline-end:1rem}/*!@:host([icon-position=end]) .label--scale-l .radio-group-item-icon*/[icon-position=end].sc-calcite-radio-group-item-h .label--scale-l.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{-webkit-margin-end:unset;margin-inline-end:unset;-webkit-margin-start:1rem;margin-inline-start:1rem}";
  23482. class RadioGroupItem {
  23483. constructor(hostRef) {
  23484. registerInstance(this, hostRef);
  23485. this.calciteRadioGroupItemChange = createEvent(this, "calciteRadioGroupItemChange", 7);
  23486. //--------------------------------------------------------------------------
  23487. //
  23488. // Properties
  23489. //
  23490. //--------------------------------------------------------------------------
  23491. /** Indicates whether the control is checked. */
  23492. this.checked = false;
  23493. /** flip the icon in rtl */
  23494. this.iconFlipRtl = false;
  23495. /** optionally used with icon, select where to position the icon */
  23496. this.iconPosition = "start";
  23497. }
  23498. handleCheckedChange() {
  23499. this.calciteRadioGroupItemChange.emit();
  23500. }
  23501. render() {
  23502. const { checked, value } = this;
  23503. const scale = getElementProp(this.el, "scale", "m");
  23504. const appearance = getElementProp(this.el, "appearance", "solid");
  23505. const layout = getElementProp(this.el, "layout", "horizontal");
  23506. const iconEl = (hAsync("calcite-icon", { class: CSS$e.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.icon, scale: "s" }));
  23507. return (hAsync(Host, { "aria-checked": toAriaBoolean(checked), role: "radio" }, hAsync("label", { class: {
  23508. "label--scale-s": scale === "s",
  23509. "label--scale-m": scale === "m",
  23510. "label--scale-l": scale === "l",
  23511. "label--horizontal": layout === "horizontal",
  23512. "label--outline": appearance === "outline"
  23513. } }, this.icon && this.iconPosition === "start" ? iconEl : null, hAsync("slot", null, value), hAsync("slot", { name: SLOTS$8.input }), this.icon && this.iconPosition === "end" ? iconEl : null)));
  23514. }
  23515. get el() { return getElement(this); }
  23516. static get watchers() { return {
  23517. "checked": ["handleCheckedChange"]
  23518. }; }
  23519. static get style() { return radioGroupItemCss; }
  23520. static get cmpMeta() { return {
  23521. "$flags$": 9,
  23522. "$tagName$": "calcite-radio-group-item",
  23523. "$members$": {
  23524. "checked": [1540],
  23525. "icon": [513],
  23526. "iconFlipRtl": [516, "icon-flip-rtl"],
  23527. "iconPosition": [513, "icon-position"],
  23528. "value": [1032]
  23529. },
  23530. "$listeners$": undefined,
  23531. "$lazyBundleId$": "-",
  23532. "$attrsToReflect$": [["checked", "checked"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["iconPosition", "icon-position"]]
  23533. }; }
  23534. }
  23535. const TEXT$5 = {
  23536. rating: "Rating",
  23537. stars: "Stars: ${num}"
  23538. };
  23539. const ratingCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-rating:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-rating{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-rating{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-rating{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-rating{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-rating{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-rating:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-rating-h{display:none}/*!@:host*/.sc-calcite-rating-h{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content}/*!@:host([disabled])*/[disabled].sc-calcite-rating-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-rating-h[disabled] .sc-calcite-rating-s>[calcite-hydrated][disabled],[disabled].sc-calcite-rating-h [calcite-hydrated][disabled].sc-calcite-rating{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-rating-h{height:1.5rem;--calcite-rating-spacing-unit:0.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-rating-h{height:2rem;--calcite-rating-spacing-unit:0.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-rating-h{height:2.75rem;--calcite-rating-spacing-unit:0.75rem}/*!@:host([read-only])*/[read-only].sc-calcite-rating-h{pointer-events:none}/*!@.fieldset*/.fieldset.sc-calcite-rating{margin:0px;display:-ms-flexbox;display:flex;border-width:0px;padding:0px}/*!@.wrapper*/.wrapper.sc-calcite-rating{display:inline-block;-webkit-margin-end:var(--calcite-rating-spacing-unit);margin-inline-end:var(--calcite-rating-spacing-unit)}/*!@.star*/.star.sc-calcite-rating{position:relative;display:-ms-flexbox;display:flex;cursor:pointer;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;color:var(--calcite-ui-border-input);-webkit-transition:var(--calcite-animation-timing);transition:var(--calcite-animation-timing);-webkit-transform:scale(1);transform:scale(1)}/*!@.star:active*/.star.sc-calcite-rating:active{-webkit-transform:scale(1.1);transform:scale(1.1)}/*!@.focused*/.focused.sc-calcite-rating{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.average,\n.fraction*/.average.sc-calcite-rating,.fraction.sc-calcite-rating{color:var(--calcite-ui-warning)}/*!@.hovered,\n.selected,\n:host([read-only]) .average,\n:host([read-only]) .fraction*/.hovered.sc-calcite-rating,.selected.sc-calcite-rating,[read-only].sc-calcite-rating-h .average.sc-calcite-rating,[read-only].sc-calcite-rating-h .fraction.sc-calcite-rating{color:var(--calcite-ui-brand)}/*!@.hovered:not(.selected)*/.hovered.sc-calcite-rating:not(.selected){-webkit-transform:scale(0.9);transform:scale(0.9)}/*!@:host .fraction*/.sc-calcite-rating-h .fraction.sc-calcite-rating{pointer-events:none;position:absolute;top:0px;overflow:hidden;-webkit-transition:var(--calcite-animation-timing);transition:var(--calcite-animation-timing);inset-inline-start:0}/*!@calcite-chip*/calcite-chip.sc-calcite-rating{pointer-events:none;cursor:default}/*!@.number--average*/.number--average.sc-calcite-rating{font-weight:var(--calcite-font-weight-bold)}/*!@.number--count*/.number--count.sc-calcite-rating{color:var(--calcite-ui-text-2);font-style:italic}/*!@.number--count:not(:first-child)*/.number--count.sc-calcite-rating:not(:first-child){-webkit-margin-start:var(--calcite-rating-spacing-unit);margin-inline-start:var(--calcite-rating-spacing-unit)}/*!@.visually-hidden*/.visually-hidden.sc-calcite-rating{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-rating-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  23540. class Rating {
  23541. constructor(hostRef) {
  23542. registerInstance(this, hostRef);
  23543. this.calciteRatingChange = createEvent(this, "calciteRatingChange", 7);
  23544. // --------------------------------------------------------------------------
  23545. //
  23546. // Properties
  23547. //
  23548. // --------------------------------------------------------------------------
  23549. /** specify the scale of the component, defaults to m */
  23550. this.scale = "m";
  23551. /** the value of the rating component */
  23552. this.value = 0;
  23553. /** is the rating component in a selectable mode */
  23554. this.readOnly = false;
  23555. /** is the rating component in a selectable mode */
  23556. this.disabled = false;
  23557. /** Show average and count data summary chip (if available) */
  23558. this.showChip = false;
  23559. /** Localized string for "Rating" (used for aria label)
  23560. * @default "Rating"
  23561. */
  23562. this.intlRating = TEXT$5.rating;
  23563. /** Localized string for labelling each star, `${num}` in the string will be replaced by the number
  23564. * @default "Stars: ${num}"
  23565. */
  23566. this.intlStars = TEXT$5.stars;
  23567. /**
  23568. * When true, makes the component required for form-submission.
  23569. *
  23570. * @internal
  23571. */
  23572. this.required = false;
  23573. this.guid = `calcite-ratings-${guid()}`;
  23574. }
  23575. //--------------------------------------------------------------------------
  23576. //
  23577. // Lifecycle
  23578. //
  23579. //--------------------------------------------------------------------------
  23580. connectedCallback() {
  23581. connectLabel(this);
  23582. connectForm(this);
  23583. }
  23584. disconnectedCallback() {
  23585. disconnectLabel(this);
  23586. disconnectForm(this);
  23587. }
  23588. componentDidRender() {
  23589. updateHostInteraction(this);
  23590. }
  23591. //--------------------------------------------------------------------------
  23592. //
  23593. // Event Listeners
  23594. //
  23595. //--------------------------------------------------------------------------
  23596. blurHandler() {
  23597. this.hasFocus = false;
  23598. }
  23599. // --------------------------------------------------------------------------
  23600. //
  23601. // Render Methods
  23602. //
  23603. // --------------------------------------------------------------------------
  23604. renderStars() {
  23605. return [1, 2, 3, 4, 5].map((i) => {
  23606. const selected = this.value >= i;
  23607. const average = this.average && !this.value && i <= this.average;
  23608. const hovered = i <= this.hoverValue;
  23609. const fraction = this.average && this.average + 1 - i;
  23610. const partial = !this.value && !hovered && fraction > 0 && fraction < 1;
  23611. const focused = this.hasFocus && this.focusValue === i;
  23612. return (hAsync("span", { class: { wrapper: true } }, hAsync("label", { class: { star: true, focused, selected, average, hovered, partial }, htmlFor: `${this.guid}-${i}`, onMouseOver: () => {
  23613. this.hoverValue = i;
  23614. } }, hAsync("calcite-icon", { "aria-hidden": "true", class: "icon", icon: selected || average || this.readOnly ? "star-f" : "star", scale: this.scale }), partial && (hAsync("div", { class: "fraction", style: { width: `${fraction * 100}%` } }, hAsync("calcite-icon", { icon: "star-f", scale: this.scale }))), hAsync("span", { class: "visually-hidden" }, this.intlStars.replace("${num}", `${i}`))), hAsync("input", { checked: i === this.value, class: "visually-hidden", disabled: this.disabled || this.readOnly, id: `${this.guid}-${i}`, name: this.guid, onChange: () => this.updateValue(i), onClick: (event) =>
  23615. // click is fired from the the component's label, so we treat this as an internal event
  23616. event.stopPropagation(), onFocus: () => {
  23617. this.hasFocus = true;
  23618. this.focusValue = i;
  23619. }, ref: (el) => (i === 1 || i === this.value) && (this.inputFocusRef = el), type: "radio", value: i })));
  23620. });
  23621. }
  23622. render() {
  23623. const { disabled, intlRating, showChip, scale, count, average } = this;
  23624. return (hAsync(Fragment, null, hAsync("fieldset", { class: "fieldset", disabled: disabled, onBlur: () => (this.hoverValue = null), onMouseLeave: () => (this.hoverValue = null), onTouchEnd: () => (this.hoverValue = null) }, hAsync("legend", { class: "visually-hidden" }, intlRating), this.renderStars()), (count || average) && showChip ? (hAsync("calcite-chip", { scale: scale, value: count === null || count === void 0 ? void 0 : count.toString() }, !!average && hAsync("span", { class: "number--average" }, average.toString()), !!count && hAsync("span", { class: "number--count" }, "(", count === null || count === void 0 ? void 0 :
  23625. count.toString(), ")"))) : null, hAsync(HiddenFormInputSlot, { component: this })));
  23626. }
  23627. //--------------------------------------------------------------------------
  23628. //
  23629. // Private Methods
  23630. //
  23631. //--------------------------------------------------------------------------
  23632. onLabelClick() {
  23633. this.setFocus();
  23634. }
  23635. updateValue(value) {
  23636. this.value = value;
  23637. this.calciteRatingChange.emit({ value });
  23638. }
  23639. //--------------------------------------------------------------------------
  23640. //
  23641. // Public Methods
  23642. //
  23643. //--------------------------------------------------------------------------
  23644. /** Sets focus on the component. */
  23645. async setFocus() {
  23646. this.inputFocusRef.focus();
  23647. }
  23648. get el() { return getElement(this); }
  23649. static get style() { return ratingCss; }
  23650. static get cmpMeta() { return {
  23651. "$flags$": 9,
  23652. "$tagName$": "calcite-rating",
  23653. "$members$": {
  23654. "scale": [513],
  23655. "value": [1538],
  23656. "readOnly": [516, "read-only"],
  23657. "disabled": [516],
  23658. "showChip": [516, "show-chip"],
  23659. "count": [514],
  23660. "average": [514],
  23661. "name": [513],
  23662. "intlRating": [1, "intl-rating"],
  23663. "intlStars": [1, "intl-stars"],
  23664. "required": [516],
  23665. "hoverValue": [32],
  23666. "focusValue": [32],
  23667. "hasFocus": [32],
  23668. "setFocus": [64]
  23669. },
  23670. "$listeners$": [[0, "blur", "blurHandler"]],
  23671. "$lazyBundleId$": "-",
  23672. "$attrsToReflect$": [["scale", "scale"], ["value", "value"], ["readOnly", "read-only"], ["disabled", "disabled"], ["showChip", "show-chip"], ["count", "count"], ["average", "average"], ["name", "name"], ["required", "required"]]
  23673. }; }
  23674. }
  23675. const CSS$d = {
  23676. scrim: "scrim",
  23677. content: "content"
  23678. };
  23679. const TEXT$4 = {
  23680. loading: "Loading"
  23681. };
  23682. const scrimCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-scrim:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-scrim{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-scrim{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-scrim{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-scrim{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-scrim{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-scrim:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-scrim-h{display:none}/*!@:host*/.sc-calcite-scrim-h{position:absolute;top:0px;right:0px;bottom:0px;left:0px;z-index:50;display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch}@-webkit-keyframes calcite-scrim-fade-in{0%{--tw-bg-opacity:0}100%{--tw-text-opacity:1}}@keyframes calcite-scrim-fade-in{0%{--tw-bg-opacity:0}100%{--tw-text-opacity:1}}/*!@.scrim*/.scrim.sc-calcite-scrim{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-line-pack:center;align-content:center;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;overflow:hidden;-webkit-animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-scrim-background)}/*!@.content*/.content.sc-calcite-scrim{padding:1rem}";
  23683. /**
  23684. * @slot - A slot for adding custom content, primarily loading information.
  23685. */
  23686. class Scrim {
  23687. constructor(hostRef) {
  23688. registerInstance(this, hostRef);
  23689. // --------------------------------------------------------------------------
  23690. //
  23691. // Properties
  23692. //
  23693. // --------------------------------------------------------------------------
  23694. /** string to override English loading text
  23695. * @default "Loading"
  23696. */
  23697. this.intlLoading = TEXT$4.loading;
  23698. /**
  23699. * Determines if the component will have the loader overlay.
  23700. * Otherwise, will render opaque disabled state.
  23701. */
  23702. this.loading = false;
  23703. }
  23704. // --------------------------------------------------------------------------
  23705. //
  23706. // Render Method
  23707. //
  23708. // --------------------------------------------------------------------------
  23709. render() {
  23710. const { el, loading, intlLoading } = this;
  23711. const hasContent = el.innerHTML.trim().length > 0;
  23712. const loaderNode = loading ? hAsync("calcite-loader", { active: true, label: intlLoading }) : null;
  23713. const contentNode = hasContent ? (hAsync("div", { class: CSS$d.content }, hAsync("slot", null))) : null;
  23714. return (hAsync("div", { class: CSS$d.scrim }, loaderNode, contentNode));
  23715. }
  23716. get el() { return getElement(this); }
  23717. static get style() { return scrimCss; }
  23718. static get cmpMeta() { return {
  23719. "$flags$": 9,
  23720. "$tagName$": "calcite-scrim",
  23721. "$members$": {
  23722. "intlLoading": [1, "intl-loading"],
  23723. "loading": [516]
  23724. },
  23725. "$listeners$": undefined,
  23726. "$lazyBundleId$": "-",
  23727. "$attrsToReflect$": [["loading", "loading"]]
  23728. }; }
  23729. }
  23730. const CSS$c = {
  23731. icon: "icon",
  23732. iconContainer: "icon-container",
  23733. select: "select"
  23734. };
  23735. const selectCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-select:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-select{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-select{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-select{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-select{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-select{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-select-h{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}/*!@:root*/.sc-calcite-select:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-select-h{display:none}/*!@:host*/.sc-calcite-select-h{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch;width:var(--select-width)}/*!@:host([disabled])*/[disabled].sc-calcite-select-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-select-h[disabled] .sc-calcite-select-s>[calcite-hydrated][disabled],[disabled].sc-calcite-select-h [calcite-hydrated][disabled].sc-calcite-select{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-select-h{height:1.5rem;--calcite-select-font-size:var(--calcite-font-size--2);--calcite-select-spacing-inline:0.5rem 2rem}/*!@:host([scale=s]) .icon-container*/[scale=s].sc-calcite-select-h .icon-container.sc-calcite-select{padding-left:0.5rem;padding-right:0.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-select-h{height:2rem;--calcite-select-font-size:var(--calcite-font-size--1);--calcite-select-spacing-inline:0.75rem 2.5rem}/*!@:host([scale=m]) .icon-container*/[scale=m].sc-calcite-select-h .icon-container.sc-calcite-select{padding-left:0.75rem;padding-right:0.75rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-select-h{height:44px;--calcite-select-font-size:var(--calcite-font-size-0);--calcite-select-spacing-inline:1rem 3rem}/*!@:host([scale=l]) .icon-container*/[scale=l].sc-calcite-select-h .icon-container.sc-calcite-select{padding-left:1rem;padding-right:1rem}/*!@:host([width=auto])*/[width=auto].sc-calcite-select-h{width:auto}/*!@:host([width=half])*/[width=half].sc-calcite-select-h{width:50%}/*!@:host([width=full])*/[width=full].sc-calcite-select-h{width:100%}/*!@.select*/.select.sc-calcite-select{margin:0px;-webkit-box-sizing:border-box;box-sizing:border-box;width:100%;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);font-family:inherit;color:var(--calcite-ui-text-2);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;font-size:var(--calcite-select-font-size);padding-inline:var(--calcite-select-spacing-inline);border-inline-end-width:0px}/*!@.select:focus*/.select.sc-calcite-select:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.select:hover*/.select.sc-calcite-select:hover{background-color:var(--calcite-ui-foreground-2)}/*!@select:disabled*/select.sc-calcite-select:disabled{border-color:var(--calcite-ui-border-input);--tw-bg-opacity:1}/*!@.icon-container*/.icon-container.sc-calcite-select{pointer-events:none;position:absolute;top:0px;bottom:0px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:transparent;color:var(--calcite-ui-text-2);inset-inline-end:0px;border-inline-width:0px 1px}/*!@.select:focus ~ .icon-container*/.select.sc-calcite-select:focus~.icon-container.sc-calcite-select{border-color:transparent}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-select-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  23736. function isOption(optionOrGroup) {
  23737. return optionOrGroup.tagName === "CALCITE-OPTION";
  23738. }
  23739. function isOptionGroup(optionOrGroup) {
  23740. return optionOrGroup.tagName === "CALCITE-OPTION-GROUP";
  23741. }
  23742. /**
  23743. * @slot - A slot for adding `calcite-option`s.
  23744. */
  23745. class Select {
  23746. constructor(hostRef) {
  23747. registerInstance(this, hostRef);
  23748. this.calciteSelectChange = createEvent(this, "calciteSelectChange", 7);
  23749. //--------------------------------------------------------------------------
  23750. //
  23751. // Properties
  23752. //
  23753. //--------------------------------------------------------------------------
  23754. /**
  23755. * When true, it prevents the option from being selected.
  23756. */
  23757. this.disabled = false;
  23758. /**
  23759. * When true, makes the component required for form-submission.
  23760. *
  23761. * @internal
  23762. */
  23763. this.required = false;
  23764. /**
  23765. * The component scale.
  23766. */
  23767. this.scale = "m";
  23768. /** The value of the selectedOption */
  23769. this.value = null;
  23770. /**
  23771. * The component width.
  23772. */
  23773. this.width = "auto";
  23774. this.componentToNativeEl = new Map();
  23775. this.mutationObserver = createObserver();
  23776. this.handleInternalSelectChange = () => {
  23777. const selected = this.selectEl.selectedOptions[0];
  23778. this.selectFromNativeOption(selected);
  23779. requestAnimationFrame(() => this.emitChangeEvent());
  23780. };
  23781. this.populateInternalSelect = () => {
  23782. const optionsAndGroups = Array.from(this.el.children).filter((child) => child.tagName === "CALCITE-OPTION" || child.tagName === "CALCITE-OPTION-GROUP");
  23783. this.clearInternalSelect();
  23784. optionsAndGroups.forEach((optionOrGroup) => { var _a; return (_a = this.selectEl) === null || _a === void 0 ? void 0 : _a.append(this.toNativeElement(optionOrGroup)); });
  23785. };
  23786. this.storeSelectRef = (node) => {
  23787. this.selectEl = node;
  23788. this.populateInternalSelect();
  23789. const selected = this.selectEl.selectedOptions[0];
  23790. this.selectFromNativeOption(selected);
  23791. };
  23792. this.emitChangeEvent = () => {
  23793. this.calciteSelectChange.emit();
  23794. };
  23795. }
  23796. valueHandler(value) {
  23797. const items = this.el.querySelectorAll("calcite-option");
  23798. items.forEach((item) => (item.selected = item.value === value));
  23799. }
  23800. selectedOptionHandler(selectedOption) {
  23801. this.value = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value;
  23802. }
  23803. //--------------------------------------------------------------------------
  23804. //
  23805. // Lifecycle
  23806. //
  23807. //--------------------------------------------------------------------------
  23808. connectedCallback() {
  23809. var _a;
  23810. const { el } = this;
  23811. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(el, {
  23812. subtree: true,
  23813. childList: true
  23814. });
  23815. connectLabel(this);
  23816. connectForm(this);
  23817. }
  23818. disconnectedCallback() {
  23819. var _a;
  23820. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  23821. disconnectLabel(this);
  23822. disconnectForm(this);
  23823. }
  23824. componentDidLoad() {
  23825. var _a, _b;
  23826. afterConnectDefaultValueSet(this, (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "");
  23827. }
  23828. componentDidRender() {
  23829. updateHostInteraction(this);
  23830. }
  23831. //--------------------------------------------------------------------------
  23832. //
  23833. // Public Methods
  23834. //
  23835. //--------------------------------------------------------------------------
  23836. /** Sets focus on the component. */
  23837. async setFocus() {
  23838. focusElement(this.selectEl);
  23839. }
  23840. handleOptionOrGroupChange(event) {
  23841. event.stopPropagation();
  23842. const optionOrGroup = event.target;
  23843. const nativeEl = this.componentToNativeEl.get(optionOrGroup);
  23844. if (!nativeEl) {
  23845. return;
  23846. }
  23847. this.updateNativeElement(optionOrGroup, nativeEl);
  23848. if (isOption(optionOrGroup) && optionOrGroup.selected) {
  23849. this.deselectAllExcept(optionOrGroup);
  23850. this.selectedOption = optionOrGroup;
  23851. }
  23852. }
  23853. //--------------------------------------------------------------------------
  23854. //
  23855. // Private Methods
  23856. //
  23857. //--------------------------------------------------------------------------
  23858. onLabelClick() {
  23859. this.setFocus();
  23860. }
  23861. updateNativeElement(optionOrGroup, nativeOptionOrGroup) {
  23862. nativeOptionOrGroup.disabled = optionOrGroup.disabled;
  23863. nativeOptionOrGroup.label = optionOrGroup.label;
  23864. if (isOption(optionOrGroup)) {
  23865. const option = nativeOptionOrGroup;
  23866. option.selected = optionOrGroup.selected;
  23867. option.value = optionOrGroup.value;
  23868. // need to set innerText for mobile
  23869. // see https://stackoverflow.com/questions/35021620/ios-safari-not-showing-all-options-for-select-menu/41749701
  23870. option.innerText = optionOrGroup.label;
  23871. }
  23872. }
  23873. clearInternalSelect() {
  23874. this.componentToNativeEl.forEach((value) => value.remove());
  23875. this.componentToNativeEl.clear();
  23876. }
  23877. selectFromNativeOption(nativeOption) {
  23878. if (!nativeOption) {
  23879. return;
  23880. }
  23881. let futureSelected;
  23882. this.componentToNativeEl.forEach((nativeOptionOrGroup, optionOrGroup) => {
  23883. if (isOption(optionOrGroup) && nativeOptionOrGroup === nativeOption) {
  23884. optionOrGroup.selected = true;
  23885. futureSelected = optionOrGroup;
  23886. this.deselectAllExcept(optionOrGroup);
  23887. }
  23888. });
  23889. if (futureSelected) {
  23890. this.selectedOption = futureSelected;
  23891. }
  23892. }
  23893. toNativeElement(optionOrGroup) {
  23894. if (isOption(optionOrGroup)) {
  23895. const option = document.createElement("option");
  23896. this.updateNativeElement(optionOrGroup, option);
  23897. this.componentToNativeEl.set(optionOrGroup, option);
  23898. return option;
  23899. }
  23900. if (isOptionGroup(optionOrGroup)) {
  23901. const group = document.createElement("optgroup");
  23902. this.updateNativeElement(optionOrGroup, group);
  23903. Array.from(optionOrGroup.children).forEach((option) => {
  23904. const nativeOption = this.toNativeElement(option);
  23905. group.append(nativeOption);
  23906. this.componentToNativeEl.set(optionOrGroup, nativeOption);
  23907. });
  23908. this.componentToNativeEl.set(optionOrGroup, group);
  23909. return group;
  23910. }
  23911. throw new Error("unsupported element child provided");
  23912. }
  23913. deselectAllExcept(except) {
  23914. this.el.querySelectorAll("calcite-option").forEach((option) => {
  23915. if (option === except) {
  23916. return;
  23917. }
  23918. option.selected = false;
  23919. });
  23920. }
  23921. //--------------------------------------------------------------------------
  23922. //
  23923. // Render Methods
  23924. //
  23925. //--------------------------------------------------------------------------
  23926. renderChevron() {
  23927. return (hAsync("div", { class: CSS$c.iconContainer }, hAsync("calcite-icon", { class: CSS$c.icon, icon: "chevron-down", scale: "s" })));
  23928. }
  23929. render() {
  23930. return (hAsync(Fragment, null, hAsync("select", { "aria-label": this.label, class: CSS$c.select, disabled: this.disabled, onChange: this.handleInternalSelectChange, ref: this.storeSelectRef }, hAsync("slot", null)), this.renderChevron(), hAsync(HiddenFormInputSlot, { component: this })));
  23931. }
  23932. get el() { return getElement(this); }
  23933. static get watchers() { return {
  23934. "value": ["valueHandler"],
  23935. "selectedOption": ["selectedOptionHandler"]
  23936. }; }
  23937. static get style() { return selectCss; }
  23938. static get cmpMeta() { return {
  23939. "$flags$": 9,
  23940. "$tagName$": "calcite-select",
  23941. "$members$": {
  23942. "disabled": [516],
  23943. "label": [1],
  23944. "name": [1],
  23945. "required": [516],
  23946. "scale": [513],
  23947. "value": [1025],
  23948. "selectedOption": [1040],
  23949. "width": [513],
  23950. "setFocus": [64]
  23951. },
  23952. "$listeners$": [[0, "calciteOptionChange", "handleOptionOrGroupChange"], [0, "calciteOptionGroupChange", "handleOptionOrGroupChange"]],
  23953. "$lazyBundleId$": "-",
  23954. "$attrsToReflect$": [["disabled", "disabled"], ["required", "required"], ["scale", "scale"], ["width", "width"]]
  23955. }; }
  23956. }
  23957. const CSS$b = {
  23958. main: "main",
  23959. mainReversed: "main--reversed",
  23960. content: "content",
  23961. contentBehind: "content--behind",
  23962. footer: "footer"
  23963. };
  23964. const SLOTS$7 = {
  23965. centerRow: "center-row",
  23966. primaryPanel: "primary-panel",
  23967. contextualPanel: "contextual-panel",
  23968. header: "header",
  23969. footer: "footer"
  23970. };
  23971. const shellCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-shell:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-shell{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-shell-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-shell-h *.sc-calcite-shell{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-shell:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-shell-h{display:none}/*!@:host*/.sc-calcite-shell-h{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex-direction:column;flex-direction:column;overflow:hidden;--calcite-shell-tip-spacing:26vw}/*!@.main*/.main.sc-calcite-shell{position:relative;display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;overflow:hidden}/*!@.main--reversed*/.main--reversed.sc-calcite-shell{-ms-flex-direction:row-reverse;flex-direction:row-reverse}/*!@.content*/.content.sc-calcite-shell{display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;overflow:auto}/*!@.content ::slotted(calcite-shell-center-row), .content ::slotted(calcite-panel), .content ::slotted(calcite-flow)*/.content .sc-calcite-shell-s>calcite-shell-center-row,.content.sc-calcite-shell-s>calcite-panel,.content .sc-calcite-shell-s>calcite-panel,.content.sc-calcite-shell-s>calcite-flow,.content .sc-calcite-shell-s>calcite-flow{-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-item-align:stretch;align-self:stretch;max-height:unset}/*!@.content--behind*/.content--behind.sc-calcite-shell{position:absolute;top:0px;right:0px;bottom:0px;left:0px;z-index:0;border-width:0px;display:initial}/*!@::slotted(calcite-shell-center-row)*/.sc-calcite-shell-s>calcite-shell-center-row{width:unset}/*!@::slotted(.header .heading)*/.sc-calcite-shell-s>.header .heading{font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-normal)}/*!@::slotted(calcite-shell-panel), ::slotted(calcite-shell-center-row)*/.sc-calcite-shell-s>calcite-shell-panel,.sc-calcite-shell-s>calcite-shell-center-row{position:relative;z-index:1}/*!@::slotted(calcite-panel), ::slotted(calcite-flow)*/.sc-calcite-shell-s>calcite-panel,.sc-calcite-shell-s>calcite-flow{border-width:1px;border-left-width:0px;border-right-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3)}/*!@slot[name=center-row]::slotted(calcite-shell-center-row:not([detached]))*/slot[name=center-row].sc-calcite-shell-s>calcite-shell-center-row:not([detached]){border-left-width:1px;border-right-width:1px;border-color:var(--calcite-ui-border-3)}/*!@::slotted(calcite-tip-manager)*/.sc-calcite-shell-s>calcite-tip-manager{position:absolute;-webkit-box-sizing:border-box;box-sizing:border-box}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}/*!@::slotted(calcite-tip-manager)*/.sc-calcite-shell-s>calcite-tip-manager{-webkit-animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.25rem;--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);bottom:0.5rem;left:var(--calcite-shell-tip-spacing);right:var(--calcite-shell-tip-spacing);z-index:2}";
  23972. /**
  23973. * @slot - A slot for adding content to the shell. This content will appear between any leading and trailing panels added to the shell. (eg. a map)
  23974. * @slot header - A slot for adding header content. This content will be positioned at the top of the shell.
  23975. * @slot footer - A slot for adding footer content. This content will be positioned at the bottom of the shell.
  23976. * @slot primary-panel - A slot for adding the leading `calcite-shell-panel`.
  23977. * @slot contextual-panel - A slot for adding the trailing `calcite-shell-panel`.
  23978. * @slot center-row - A slot for adding custom content in the center row.
  23979. */
  23980. class Shell {
  23981. constructor(hostRef) {
  23982. registerInstance(this, hostRef);
  23983. // --------------------------------------------------------------------------
  23984. //
  23985. // Properties
  23986. //
  23987. // --------------------------------------------------------------------------
  23988. /**
  23989. * Positions the center content behind any calcite-shell-panels.
  23990. */
  23991. this.contentBehind = false;
  23992. }
  23993. // --------------------------------------------------------------------------
  23994. //
  23995. // Lifecycle
  23996. //
  23997. // --------------------------------------------------------------------------
  23998. connectedCallback() {
  23999. connectConditionalSlotComponent(this);
  24000. }
  24001. disconnectedCallback() {
  24002. disconnectConditionalSlotComponent(this);
  24003. }
  24004. // --------------------------------------------------------------------------
  24005. //
  24006. // Render Methods
  24007. //
  24008. // --------------------------------------------------------------------------
  24009. renderHeader() {
  24010. const hasHeader = !!getSlotted(this.el, SLOTS$7.header);
  24011. return hasHeader ? hAsync("slot", { key: "header", name: SLOTS$7.header }) : null;
  24012. }
  24013. renderContent() {
  24014. const defaultSlotNode = hAsync("slot", { key: "default-slot" });
  24015. const centerRowSlotNode = hAsync("slot", { key: "center-row-slot", name: SLOTS$7.centerRow });
  24016. const contentContainerKey = "content-container";
  24017. const content = !!this.contentBehind
  24018. ? [
  24019. hAsync("div", { class: {
  24020. [CSS$b.content]: true,
  24021. [CSS$b.contentBehind]: true
  24022. }, key: contentContainerKey }, defaultSlotNode),
  24023. centerRowSlotNode
  24024. ]
  24025. : [
  24026. hAsync("div", { class: CSS$b.content, key: contentContainerKey }, defaultSlotNode, centerRowSlotNode)
  24027. ];
  24028. return content;
  24029. }
  24030. renderFooter() {
  24031. const hasFooter = !!getSlotted(this.el, SLOTS$7.footer);
  24032. return hasFooter ? (hAsync("div", { class: CSS$b.footer, key: "footer" }, hAsync("slot", { name: SLOTS$7.footer }))) : null;
  24033. }
  24034. renderMain() {
  24035. const primaryPanel = getSlotted(this.el, SLOTS$7.primaryPanel);
  24036. const mainClasses = {
  24037. [CSS$b.main]: true,
  24038. [CSS$b.mainReversed]: (primaryPanel === null || primaryPanel === void 0 ? void 0 : primaryPanel.position) === "end"
  24039. };
  24040. return (hAsync("div", { class: mainClasses }, hAsync("slot", { name: SLOTS$7.primaryPanel }), this.renderContent(), hAsync("slot", { name: SLOTS$7.contextualPanel })));
  24041. }
  24042. render() {
  24043. return (hAsync(Fragment, null, this.renderHeader(), this.renderMain(), this.renderFooter()));
  24044. }
  24045. get el() { return getElement(this); }
  24046. static get style() { return shellCss; }
  24047. static get cmpMeta() { return {
  24048. "$flags$": 9,
  24049. "$tagName$": "calcite-shell",
  24050. "$members$": {
  24051. "contentBehind": [516, "content-behind"]
  24052. },
  24053. "$listeners$": undefined,
  24054. "$lazyBundleId$": "-",
  24055. "$attrsToReflect$": [["contentBehind", "content-behind"]]
  24056. }; }
  24057. }
  24058. const CSS$a = {
  24059. actionBarContainer: "action-bar-container",
  24060. content: "content"
  24061. };
  24062. const SLOTS$6 = {
  24063. actionBar: "action-bar"
  24064. };
  24065. const shellCenterRowCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-shell-center-row:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-shell-center-row{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell-center-row{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell-center-row{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell-center-row{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell-center-row{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:host*/.sc-calcite-shell-center-row-h{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-shell-center-row-h *.sc-calcite-shell-center-row{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:root*/.sc-calcite-shell-center-row:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-shell-center-row-h{display:none}/*!@:host*/.sc-calcite-shell-center-row-h{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden;background-color:transparent}/*!@.content*/.content.sc-calcite-shell-center-row{margin:0px;display:-ms-flexbox;display:flex;height:100%;width:100%;overflow:hidden;-ms-flex:1 0 0px;flex:1 0 0}/*!@.action-bar-container*/.action-bar-container.sc-calcite-shell-center-row{display:-ms-flexbox;display:flex}/*!@:host([detached])*/[detached].sc-calcite-shell-center-row-h{margin-left:0.5rem;margin-right:0.5rem;margin-top:0.5rem;margin-bottom:1.5rem}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}/*!@:host([detached])*/[detached].sc-calcite-shell-center-row-h{-webkit-animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.25rem;border-width:0px;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([position=end])*/[position=end].sc-calcite-shell-center-row-h{-ms-flex-item-align:end;align-self:flex-end}/*!@:host([position=start])*/[position=start].sc-calcite-shell-center-row-h{-ms-flex-item-align:start;align-self:flex-start}/*!@:host([height-scale=s])*/[height-scale=s].sc-calcite-shell-center-row-h{height:33.333333%}/*!@:host([height-scale=m])*/[height-scale=m].sc-calcite-shell-center-row-h{height:70%}/*!@:host([height-scale=l])*/[height-scale=l].sc-calcite-shell-center-row-h{height:100%}/*!@:host([height-scale=l][detached])*/[height-scale=l][detached].sc-calcite-shell-center-row-h{height:calc(100% - 2rem)}/*!@::slotted(calcite-panel)*/.sc-calcite-shell-center-row-s>calcite-panel{height:100%;width:100%}/*!@::slotted(calcite-action-bar),\n::slotted(calcite-action-bar[position=end])*/.sc-calcite-shell-center-row-s>calcite-action-bar,.sc-calcite-shell-center-row-s>calcite-action-bar[position=end]{-webkit-border-end:1px solid;border-inline-end:1px solid;border-color:var(--calcite-ui-border-3)}";
  24066. /**
  24067. * @slot - A slot for adding content to the shell panel.
  24068. * @slot action-bar - A slot for adding a `calcite-action-bar` to the panel.
  24069. */
  24070. class ShellCenterRow {
  24071. constructor(hostRef) {
  24072. registerInstance(this, hostRef);
  24073. // --------------------------------------------------------------------------
  24074. //
  24075. // Properties
  24076. //
  24077. // --------------------------------------------------------------------------
  24078. /**
  24079. * This property makes the content area appear like a "floating" panel.
  24080. */
  24081. this.detached = false;
  24082. /**
  24083. * Specifies the maximum height of the row.
  24084. */
  24085. this.heightScale = "s";
  24086. /**
  24087. * Arranges the component depending on the elements 'dir' property.
  24088. */
  24089. this.position = "end";
  24090. }
  24091. // --------------------------------------------------------------------------
  24092. //
  24093. // Lifecycle
  24094. //
  24095. // --------------------------------------------------------------------------
  24096. connectedCallback() {
  24097. connectConditionalSlotComponent(this);
  24098. }
  24099. disconnectedCallback() {
  24100. disconnectConditionalSlotComponent(this);
  24101. }
  24102. // --------------------------------------------------------------------------
  24103. //
  24104. // Render Methods
  24105. //
  24106. // --------------------------------------------------------------------------
  24107. render() {
  24108. const { el } = this;
  24109. const contentNode = (hAsync("div", { class: CSS$a.content }, hAsync("slot", null)));
  24110. const actionBar = getSlotted(el, SLOTS$6.actionBar);
  24111. const actionBarNode = actionBar ? (hAsync("div", { class: CSS$a.actionBarContainer, key: "action-bar" }, hAsync("slot", { name: SLOTS$6.actionBar }))) : null;
  24112. const children = [actionBarNode, contentNode];
  24113. if ((actionBar === null || actionBar === void 0 ? void 0 : actionBar.position) === "end") {
  24114. children.reverse();
  24115. }
  24116. return hAsync(Fragment, null, children);
  24117. }
  24118. get el() { return getElement(this); }
  24119. static get style() { return shellCenterRowCss; }
  24120. static get cmpMeta() { return {
  24121. "$flags$": 9,
  24122. "$tagName$": "calcite-shell-center-row",
  24123. "$members$": {
  24124. "detached": [516],
  24125. "heightScale": [513, "height-scale"],
  24126. "position": [513]
  24127. },
  24128. "$listeners$": undefined,
  24129. "$lazyBundleId$": "-",
  24130. "$attrsToReflect$": [["detached", "detached"], ["heightScale", "height-scale"], ["position", "position"]]
  24131. }; }
  24132. }
  24133. const CSS$9 = {
  24134. container: "container",
  24135. content: "content",
  24136. contentHeader: "content__header",
  24137. contentBody: "content__body",
  24138. contentDetached: "content--detached",
  24139. separator: "separator"
  24140. };
  24141. const SLOTS$5 = {
  24142. actionBar: "action-bar",
  24143. header: "header"
  24144. };
  24145. const TEXT$3 = {
  24146. resize: "Resize"
  24147. };
  24148. const shellPanelCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-shell-panel:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-shell-panel{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell-panel{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell-panel{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell-panel{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell-panel{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-shell-panel:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-shell-panel-h{display:none}/*!@:host*/.sc-calcite-shell-panel-h{pointer-events:none;display:-ms-flexbox;display:flex;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-align:stretch;align-items:stretch;--calcite-shell-panel-detached-max-height:unset}/*!@.container*/.container.sc-calcite-shell-panel{pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:stretch;align-items:stretch;background-color:transparent;font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}/*!@.container **/.container.sc-calcite-shell-panel *.sc-calcite-shell-panel{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:host(:hover) .separator:not(:hover):not(:focus), :host(:focus-within) .separator:not(:hover):not(:focus)*/.sc-calcite-shell-panel-h:hover .separator.sc-calcite-shell-panel:not(:hover):not(:focus),.sc-calcite-shell-panel-h:focus-within .separator.sc-calcite-shell-panel:not(:hover):not(:focus){opacity:1;background-color:var(--calcite-ui-border-3)}/*!@.separator*/.separator.sc-calcite-shell-panel{pointer-events:auto;position:absolute;bottom:0px;top:0px;z-index:10;display:-ms-flexbox;display:flex;height:100%;width:0.125rem;background-color:transparent;opacity:0;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;cursor:col-resize;outline:none}/*!@.separator:hover*/.separator.sc-calcite-shell-panel:hover{opacity:1;background-color:var(--calcite-ui-border-2)}/*!@.separator:focus*/.separator.sc-calcite-shell-panel:focus{background-color:var(--calcite-ui-brand);opacity:1}/*!@:host([position=start]) .separator*/[position=start].sc-calcite-shell-panel-h .separator.sc-calcite-shell-panel{inset-inline-end:-2px}/*!@:host([position=end]) .separator*/[position=end].sc-calcite-shell-panel-h .separator.sc-calcite-shell-panel{inset-inline-start:-2px}/*!@::slotted(calcite-panel), ::slotted(calcite-flow)*/.sc-calcite-shell-panel-s>calcite-panel,.sc-calcite-shell-panel-s>calcite-flow{height:100%;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;max-height:unset;max-width:unset}/*!@::slotted(.calcite-match-height)*/.sc-calcite-shell-panel-s>.calcite-match-height{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden}/*!@.content*/.content.sc-calcite-shell-panel{pointer-events:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch;-ms-flex-item-align:stretch;align-self:stretch;background-color:var(--calcite-ui-background);padding:0px;width:var(--calcite-shell-panel-width);max-width:var(--calcite-shell-panel-max-width);min-width:var(--calcite-shell-panel-min-width);-webkit-transition:max-height var(--calcite-animation-timing), max-width var(--calcite-animation-timing);transition:max-height var(--calcite-animation-timing), max-width var(--calcite-animation-timing)}/*!@.content__header*/.content__header.sc-calcite-shell-panel{display:-ms-flexbox;display:flex;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch}/*!@.content__body*/.content__body.sc-calcite-shell-panel{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;overflow:hidden}/*!@:host([width-scale=s]) .content*/[width-scale=s].sc-calcite-shell-panel-h .content.sc-calcite-shell-panel{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 12vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 300px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 150px)}/*!@:host([width-scale=m]) .content*/[width-scale=m].sc-calcite-shell-panel-h .content.sc-calcite-shell-panel{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 20vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 420px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 240px)}/*!@:host([width-scale=l]) .content*/[width-scale=l].sc-calcite-shell-panel-h .content.sc-calcite-shell-panel{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 45vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 680px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 340px)}/*!@:host([detached-height-scale=s]) .content--detached*/[detached-height-scale=s].sc-calcite-shell-panel-h .content--detached.sc-calcite-shell-panel{--calcite-shell-panel-detached-max-height:40vh}/*!@:host([detached-height-scale=m]) .content--detached*/[detached-height-scale=m].sc-calcite-shell-panel-h .content--detached.sc-calcite-shell-panel{--calcite-shell-panel-detached-max-height:60vh}/*!@:host([detached-height-scale=l]) .content--detached*/[detached-height-scale=l].sc-calcite-shell-panel-h .content--detached.sc-calcite-shell-panel{--calcite-shell-panel-detached-max-height:80vh}/*!@.content--detached*/.content--detached.sc-calcite-shell-panel{margin-left:0.5rem;margin-right:0.5rem;margin-top:0.5rem;margin-bottom:auto;height:auto;overflow:hidden;border-radius:0.25rem;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);max-height:var(--calcite-shell-panel-detached-max-height)}/*!@.content--detached ::slotted(calcite-panel),\n.content--detached ::slotted(calcite-flow)*/.content--detached .sc-calcite-shell-panel-s>calcite-panel,.content--detached .sc-calcite-shell-panel-s>calcite-flow{max-height:unset}/*!@:host([position=start]) .content--detached ::slotted(calcite-panel), :host([position=start]) .content--detached ::slotted(calcite-flow), :host([position=end]) .content--detached ::slotted(calcite-panel), :host([position=end]) .content--detached ::slotted(calcite-flow)*/.sc-calcite-shell-panel-h[position=start] .content--detached .sc-calcite-shell-panel-s>calcite-panel,.sc-calcite-shell-panel-h[position=start] .content--detached .sc-calcite-shell-panel-s>calcite-flow,.sc-calcite-shell-panel-h[position=end] .content--detached .sc-calcite-shell-panel-s>calcite-panel,.sc-calcite-shell-panel-h[position=end] .content--detached .sc-calcite-shell-panel-s>calcite-flow{border-style:none}/*!@.content[hidden]*/.content[hidden].sc-calcite-shell-panel{display:none}/*!@slot[name=action-bar]::slotted(calcite-action-bar), .content ::slotted(calcite-flow), .content ::slotted(calcite-panel:not([dismissed]))*/slot[name=action-bar].sc-calcite-shell-panel-s>calcite-action-bar,.content.sc-calcite-shell-panel-s>calcite-flow,.content .sc-calcite-shell-panel-s>calcite-flow,.content.sc-calcite-shell-panel-s>calcite-panel:not([dismissed]),.content .sc-calcite-shell-panel-s>calcite-panel:not([dismissed]){border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}/*!@:host([position=start]) slot[name=action-bar]::slotted(calcite-action-bar),\n:host([position=start]) .content ::slotted(calcite-flow),\n:host([position=start]) .content ::slotted(calcite-panel)*/.sc-calcite-shell-panel-h[position=start] slot[name=action-bar].sc-calcite-shell-panel-s>calcite-action-bar,.sc-calcite-shell-panel-h[position=start] .content .sc-calcite-shell-panel-s>calcite-flow,.sc-calcite-shell-panel-h[position=start] .content .sc-calcite-shell-panel-s>calcite-panel{-webkit-border-start:none;border-inline-start:none}/*!@:host([position=end]) slot[name=action-bar]::slotted(calcite-action-bar),\n:host([position=end]) .content ::slotted(calcite-flow),\n:host([position=end]) .content ::slotted(calcite-panel)*/.sc-calcite-shell-panel-h[position=end] slot[name=action-bar].sc-calcite-shell-panel-s>calcite-action-bar,.sc-calcite-shell-panel-h[position=end] .content .sc-calcite-shell-panel-s>calcite-flow,.sc-calcite-shell-panel-h[position=end] .content .sc-calcite-shell-panel-s>calcite-panel{-webkit-border-end:none;border-inline-end:none}";
  24149. /**
  24150. * @slot - A slot for adding content to the shell panel.
  24151. * @slot action-bar - A slot for adding a `calcite-action-bar` to the panel.
  24152. */
  24153. class ShellPanel {
  24154. constructor(hostRef) {
  24155. registerInstance(this, hostRef);
  24156. this.calciteShellPanelToggle = createEvent(this, "calciteShellPanelToggle", 7);
  24157. // --------------------------------------------------------------------------
  24158. //
  24159. // Properties
  24160. //
  24161. // --------------------------------------------------------------------------
  24162. /**
  24163. * Hide the content panel.
  24164. */
  24165. this.collapsed = false;
  24166. /**
  24167. * This property makes the content area appear like a "floating" panel.
  24168. */
  24169. this.detached = false;
  24170. /**
  24171. * Specifies the maximum height of the contents when detached.
  24172. */
  24173. this.detachedHeightScale = "l";
  24174. /**
  24175. * This sets width of the content area.
  24176. */
  24177. this.widthScale = "m";
  24178. /**
  24179. * Accessible label for resize separator.
  24180. * @default "Resize"
  24181. */
  24182. this.intlResize = TEXT$3.resize;
  24183. /**
  24184. * This property makes the content area resizable if the calcite-shell-panel is not 'detached'.
  24185. */
  24186. this.resizable = false;
  24187. this.contentWidth = null;
  24188. this.initialContentWidth = null;
  24189. this.initialClientX = null;
  24190. this.contentWidthMax = null;
  24191. this.contentWidthMin = null;
  24192. this.step = 1;
  24193. this.stepMultiplier = 10;
  24194. this.storeContentEl = (contentEl) => {
  24195. this.contentEl = contentEl;
  24196. };
  24197. this.getKeyAdjustedWidth = (event) => {
  24198. const { key } = event;
  24199. const { el, step, stepMultiplier, contentWidthMin, contentWidthMax, initialContentWidth, position } = this;
  24200. const multipliedStep = step * stepMultiplier;
  24201. const MOVEMENT_KEYS = [
  24202. "ArrowUp",
  24203. "ArrowDown",
  24204. "ArrowLeft",
  24205. "ArrowRight",
  24206. "Home",
  24207. "End",
  24208. "PageUp",
  24209. "PageDown"
  24210. ];
  24211. if (MOVEMENT_KEYS.indexOf(key) > -1) {
  24212. event.preventDefault();
  24213. }
  24214. const dir = getElementDir(el);
  24215. const directionKeys = ["ArrowLeft", "ArrowRight"];
  24216. const directionFactor = dir === "rtl" && directionKeys.includes(key) ? -1 : 1;
  24217. const increaseKeys = key === "ArrowUp" ||
  24218. (position === "end" ? key === directionKeys[0] : key === directionKeys[1]);
  24219. if (increaseKeys) {
  24220. const stepValue = event.shiftKey ? multipliedStep : step;
  24221. return initialContentWidth + directionFactor * stepValue;
  24222. }
  24223. const decreaseKeys = key === "ArrowDown" ||
  24224. (position === "end" ? key === directionKeys[1] : key === directionKeys[0]);
  24225. if (decreaseKeys) {
  24226. const stepValue = event.shiftKey ? multipliedStep : step;
  24227. return initialContentWidth - directionFactor * stepValue;
  24228. }
  24229. if (typeof contentWidthMin === "number" && key === "Home") {
  24230. return contentWidthMin;
  24231. }
  24232. if (typeof contentWidthMax === "number" && key === "End") {
  24233. return contentWidthMax;
  24234. }
  24235. if (key === "PageDown") {
  24236. return initialContentWidth - multipliedStep;
  24237. }
  24238. if (key === "PageUp") {
  24239. return initialContentWidth + multipliedStep;
  24240. }
  24241. return null;
  24242. };
  24243. this.separatorKeyDown = (event) => {
  24244. this.setInitialContentWidth();
  24245. const width = this.getKeyAdjustedWidth(event);
  24246. if (typeof width === "number") {
  24247. this.setContentWidth(width);
  24248. }
  24249. };
  24250. this.separatorPointerMove = (event) => {
  24251. event.preventDefault();
  24252. const { el, initialContentWidth, position, initialClientX } = this;
  24253. const offset = event.clientX - initialClientX;
  24254. const dir = getElementDir(el);
  24255. const adjustmentDirection = dir === "rtl" ? -1 : 1;
  24256. const adjustedOffset = position === "end" ? -adjustmentDirection * offset : adjustmentDirection * offset;
  24257. const width = initialContentWidth + adjustedOffset;
  24258. this.setContentWidth(width);
  24259. };
  24260. this.separatorPointerUp = (event) => {
  24261. event.preventDefault();
  24262. document.removeEventListener("pointerup", this.separatorPointerUp);
  24263. document.removeEventListener("pointermove", this.separatorPointerMove);
  24264. };
  24265. this.setInitialContentWidth = () => {
  24266. var _a;
  24267. this.initialContentWidth = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
  24268. };
  24269. this.separatorPointerDown = (event) => {
  24270. event.preventDefault();
  24271. const { separatorEl } = this;
  24272. separatorEl && document.activeElement !== separatorEl && separatorEl.focus();
  24273. this.setInitialContentWidth();
  24274. this.initialClientX = event.clientX;
  24275. document.addEventListener("pointerup", this.separatorPointerUp);
  24276. document.addEventListener("pointermove", this.separatorPointerMove);
  24277. };
  24278. this.connectSeparator = (separatorEl) => {
  24279. this.disconnectSeparator();
  24280. this.separatorEl = separatorEl;
  24281. separatorEl.addEventListener("pointerdown", this.separatorPointerDown);
  24282. };
  24283. this.disconnectSeparator = () => {
  24284. var _a;
  24285. (_a = this.separatorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener("pointerdown", this.separatorPointerDown);
  24286. };
  24287. }
  24288. watchHandler() {
  24289. this.calciteShellPanelToggle.emit();
  24290. }
  24291. //--------------------------------------------------------------------------
  24292. //
  24293. // Lifecycle
  24294. //
  24295. //--------------------------------------------------------------------------
  24296. connectedCallback() {
  24297. connectConditionalSlotComponent(this);
  24298. }
  24299. disconnectedCallback() {
  24300. disconnectConditionalSlotComponent(this);
  24301. this.disconnectSeparator();
  24302. }
  24303. componentDidLoad() {
  24304. this.updateAriaValues();
  24305. }
  24306. // --------------------------------------------------------------------------
  24307. //
  24308. // Render Methods
  24309. //
  24310. // --------------------------------------------------------------------------
  24311. renderHeader() {
  24312. const { el } = this;
  24313. const hasHeader = getSlotted(el, SLOTS$5.header);
  24314. return hasHeader ? (hAsync("div", { class: CSS$9.contentHeader, key: "header" }, hAsync("slot", { name: SLOTS$5.header }))) : null;
  24315. }
  24316. render() {
  24317. const { collapsed, detached, position, initialContentWidth, contentWidth, contentWidthMax, contentWidthMin, intlResize, resizable } = this;
  24318. const allowResizing = !detached && resizable;
  24319. const contentNode = (hAsync("div", { class: { [CSS$9.content]: true, [CSS$9.contentDetached]: detached }, hidden: collapsed, key: "content", ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null }, this.renderHeader(), hAsync("div", { class: CSS$9.contentBody }, hAsync("slot", null))));
  24320. const separatorNode = allowResizing ? (hAsync("div", { "aria-label": intlResize, "aria-orientation": "horizontal", "aria-valuemax": contentWidthMax, "aria-valuemin": contentWidthMin, "aria-valuenow": contentWidth !== null && contentWidth !== void 0 ? contentWidth : initialContentWidth, class: CSS$9.separator, key: "separator", onKeyDown: this.separatorKeyDown, ref: this.connectSeparator, role: "separator", tabIndex: 0, "touch-action": "none" })) : null;
  24321. const actionBarNode = hAsync("slot", { key: "action-bar", name: SLOTS$5.actionBar });
  24322. const mainNodes = [actionBarNode, contentNode, separatorNode];
  24323. if (position === "end") {
  24324. mainNodes.reverse();
  24325. }
  24326. return hAsync("div", { class: { [CSS$9.container]: true } }, mainNodes);
  24327. }
  24328. // --------------------------------------------------------------------------
  24329. //
  24330. // private Methods
  24331. //
  24332. // --------------------------------------------------------------------------
  24333. setContentWidth(width) {
  24334. const { contentWidthMax, contentWidthMin } = this;
  24335. const roundedWidth = Math.round(width);
  24336. this.contentWidth =
  24337. typeof contentWidthMax === "number" && typeof contentWidthMin === "number"
  24338. ? clamp(roundedWidth, contentWidthMin, contentWidthMax)
  24339. : roundedWidth;
  24340. }
  24341. updateAriaValues() {
  24342. const { contentEl } = this;
  24343. const computedStyle = contentEl && getComputedStyle(contentEl);
  24344. if (!computedStyle) {
  24345. return;
  24346. }
  24347. const max = parseInt(computedStyle.getPropertyValue("max-width"), 10);
  24348. const min = parseInt(computedStyle.getPropertyValue("min-width"), 10);
  24349. const valueNow = parseInt(computedStyle.getPropertyValue("width"), 10);
  24350. if (typeof valueNow === "number" && !isNaN(valueNow)) {
  24351. this.initialContentWidth = valueNow;
  24352. }
  24353. if (typeof max === "number" && !isNaN(max)) {
  24354. this.contentWidthMax = max;
  24355. }
  24356. if (typeof min === "number" && !isNaN(min)) {
  24357. this.contentWidthMin = min;
  24358. }
  24359. forceUpdate$1(this);
  24360. }
  24361. get el() { return getElement(this); }
  24362. static get watchers() { return {
  24363. "collapsed": ["watchHandler"]
  24364. }; }
  24365. static get style() { return shellPanelCss; }
  24366. static get cmpMeta() { return {
  24367. "$flags$": 9,
  24368. "$tagName$": "calcite-shell-panel",
  24369. "$members$": {
  24370. "collapsed": [516],
  24371. "detached": [516],
  24372. "detachedHeightScale": [513, "detached-height-scale"],
  24373. "widthScale": [513, "width-scale"],
  24374. "position": [513],
  24375. "intlResize": [1, "intl-resize"],
  24376. "resizable": [516],
  24377. "contentWidth": [32]
  24378. },
  24379. "$listeners$": undefined,
  24380. "$lazyBundleId$": "-",
  24381. "$attrsToReflect$": [["collapsed", "collapsed"], ["detached", "detached"], ["detachedHeightScale", "detached-height-scale"], ["widthScale", "width-scale"], ["position", "position"], ["resizable", "resizable"]]
  24382. }; }
  24383. }
  24384. const sliderCss = "@charset \"UTF-8\";@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-slider:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-slider{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-slider{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-slider{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-slider{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-slider{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-slider:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-slider-h{display:none}/*!@.scale--s*/.scale--s.sc-calcite-slider{--calcite-slider-handle-size:10px;--calcite-slider-handle-extension-height:6.5px;--calcite-slider-container-font-size:var(--calcite-font-size--3)}/*!@.scale--s .handle__label, .scale--s .tick__label*/.scale--s.sc-calcite-slider .handle__label.sc-calcite-slider,.scale--s.sc-calcite-slider .tick__label.sc-calcite-slider{line-height:.75rem}/*!@.scale--m*/.scale--m.sc-calcite-slider{--calcite-slider-handle-size:14px;--calcite-slider-handle-extension-height:8px;--calcite-slider-container-font-size:var(--calcite-font-size--2)}/*!@.scale--m .handle__label, .scale--m .tick__label*/.scale--m.sc-calcite-slider .handle__label.sc-calcite-slider,.scale--m.sc-calcite-slider .tick__label.sc-calcite-slider{line-height:1rem}/*!@.scale--l*/.scale--l.sc-calcite-slider{--calcite-slider-handle-size:16px;--calcite-slider-handle-extension-height:10.5px;--calcite-slider-container-font-size:var(--calcite-font-size--1)}/*!@.scale--l .handle__label, .scale--l .tick__label*/.scale--l.sc-calcite-slider .handle__label.sc-calcite-slider,.scale--l.sc-calcite-slider .tick__label.sc-calcite-slider{line-height:1rem}/*!@.handle__label, .tick__label*/.handle__label.sc-calcite-slider,.tick__label.sc-calcite-slider{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);font-size:var(--calcite-slider-container-font-size)}/*!@:host*/.sc-calcite-slider-h{display:block}/*!@.container*/.container.sc-calcite-slider{position:relative;display:block;overflow-wrap:normal;word-break:normal;padding:calc(var(--calcite-slider-handle-size) * 0.5);margin:calc(var(--calcite-slider-handle-size) * 0.5) 0;--calcite-slider-full-handle-height:calc(\n var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)\n )}/*!@:host([disabled])*/[disabled].sc-calcite-slider-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) .track__range,\n:host([disabled]) .tick--active*/[disabled].sc-calcite-slider-h .track__range.sc-calcite-slider,[disabled].sc-calcite-slider-h .tick--active.sc-calcite-slider{background-color:var(--calcite-ui-text-3)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-slider-h[disabled] .sc-calcite-slider-s>[calcite-hydrated][disabled],[disabled].sc-calcite-slider-h [calcite-hydrated][disabled].sc-calcite-slider{opacity:1}/*!@.scale--s .thumb:not(.thumb--precise)*/.scale--s.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-6px}/*!@.scale--m .thumb:not(.thumb--precise)*/.scale--m.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-8px}/*!@.scale--l .thumb:not(.thumb--precise)*/.scale--l.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-9px}/*!@:host([precise]:not([has-histogram])) .container .thumb--value*/[precise].sc-calcite-slider-h:not([has-histogram]) .container.sc-calcite-slider .thumb--value.sc-calcite-slider{--calcite-slider-thumb-y-offset:calc(var(--calcite-slider-full-handle-height) * -1)}/*!@.thumb-container*/.thumb-container.sc-calcite-slider{position:relative;max-width:100%}/*!@.thumb*/.thumb.sc-calcite-slider{--calcite-slider-thumb-x-offset:calc(var(--calcite-slider-handle-size) * 0.5);position:absolute;margin:0px;display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;border-style:none;background-color:transparent;padding:0px;font-family:inherit;outline:2px solid transparent;outline-offset:2px;-webkit-transform:translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset));transform:translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset))}/*!@.thumb .handle__label.static, .thumb .handle__label.transformed*/.thumb.sc-calcite-slider .handle__label.static.sc-calcite-slider,.thumb.sc-calcite-slider .handle__label.transformed.sc-calcite-slider{position:absolute;top:0px;bottom:0px;opacity:0}/*!@.thumb .handle__label.hyphen::after*/.thumb.sc-calcite-slider .handle__label.hyphen.sc-calcite-slider::after{content:\"—\";display:inline-block;width:1em}/*!@.thumb .handle__label.hyphen--wrap*/.thumb.sc-calcite-slider .handle__label.hyphen--wrap.sc-calcite-slider{display:-ms-flexbox;display:flex}/*!@.thumb .handle*/.thumb.sc-calcite-slider .handle.sc-calcite-slider{-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:9999px;background-color:var(--calcite-ui-foreground-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;height:var(--calcite-slider-handle-size);width:var(--calcite-slider-handle-size);-webkit-box-shadow:0 0 0 2px var(--calcite-ui-text-3) inset;box-shadow:0 0 0 2px var(--calcite-ui-text-3) inset;-webkit-transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, -webkit-box-shadow var(--calcite-animation-timing) ease;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, -webkit-box-shadow var(--calcite-animation-timing) ease;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease, -webkit-box-shadow var(--calcite-animation-timing) ease}/*!@.thumb .handle-extension*/.thumb.sc-calcite-slider .handle-extension.sc-calcite-slider{width:0.125rem;height:var(--calcite-slider-handle-extension-height);background-color:var(--calcite-ui-text-3)}/*!@.thumb:hover .handle*/.thumb.sc-calcite-slider:hover .handle.sc-calcite-slider{-webkit-box-shadow:0 0 0 3px var(--calcite-ui-brand) inset;box-shadow:0 0 0 3px var(--calcite-ui-brand) inset}/*!@.thumb:hover .handle-extension*/.thumb.sc-calcite-slider:hover .handle-extension.sc-calcite-slider{background-color:var(--calcite-ui-brand)}/*!@.thumb:focus .handle*/.thumb.sc-calcite-slider:focus .handle.sc-calcite-slider{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.thumb:focus .handle-extension*/.thumb.sc-calcite-slider:focus .handle-extension.sc-calcite-slider{background-color:var(--calcite-ui-brand)}/*!@.thumb.thumb--minValue*/.thumb.thumb--minValue.sc-calcite-slider{-webkit-transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset));transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset))}/*!@.thumb.thumb--precise*/.thumb.thumb--precise.sc-calcite-slider{--calcite-slider-thumb-y-offset:-2px}/*!@:host([label-handles]) .thumb*/[label-handles].sc-calcite-slider-h .thumb.sc-calcite-slider{--calcite-slider-thumb-x-offset:50%}/*!@:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise)*/[label-handles].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--s.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-23px}/*!@:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise)*/[label-handles].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--m.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-30px}/*!@:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise)*/[label-handles].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--l.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-32px}/*!@:host([has-histogram][label-handles]) .handle__label,\n:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label*/[has-histogram][label-handles].sc-calcite-slider-h .handle__label.sc-calcite-slider,[label-handles].sc-calcite-slider-h:not([has-histogram]) .thumb--minValue.thumb--precise.sc-calcite-slider .handle__label.sc-calcite-slider{margin-top:0.5em}/*!@:host(:not([has-histogram]):not([precise])) .handle__label,\n:host([label-handles]:not([has-histogram])) .thumb--value .handle__label*/.sc-calcite-slider-h:not([has-histogram]):not([precise]) .handle__label.sc-calcite-slider,[label-handles].sc-calcite-slider-h:not([has-histogram]) .thumb--value.sc-calcite-slider .handle__label.sc-calcite-slider{margin-bottom:0.5em}/*!@:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value*/[label-handles][precise].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--s.sc-calcite-slider .thumb--value.sc-calcite-slider{--calcite-slider-thumb-y-offset:-33px}/*!@:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value*/[label-handles][precise].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--m.sc-calcite-slider .thumb--value.sc-calcite-slider{--calcite-slider-thumb-y-offset:-44px}/*!@:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value*/[label-handles][precise].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--l.sc-calcite-slider .thumb--value.sc-calcite-slider{--calcite-slider-thumb-y-offset:-49px}/*!@.thumb:focus .handle, .thumb--active .handle*/.thumb.sc-calcite-slider:focus .handle.sc-calcite-slider,.thumb--active.sc-calcite-slider .handle.sc-calcite-slider{background-color:var(--calcite-ui-brand);-webkit-box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}/*!@.thumb:hover.thumb--precise:after, .thumb:focus.thumb--precise:after, .thumb--active.thumb--precise:after*/.thumb.sc-calcite-slider:hover.thumb--precise:after,.thumb.sc-calcite-slider:focus.thumb--precise:after,.thumb--active.thumb--precise.sc-calcite-slider:after{background-color:var(--calcite-ui-brand)}/*!@.track*/.track.sc-calcite-slider{position:relative;height:0.125rem;border-radius:0px;background-color:var(--calcite-ui-border-2);-webkit-transition:all var(--calcite-internal-animation-timing-medium) ease-in;transition:all var(--calcite-internal-animation-timing-medium) ease-in}/*!@.track__range*/.track__range.sc-calcite-slider{position:absolute;top:0px;height:0.125rem;background-color:var(--calcite-ui-brand)}/*!@.container--range .track__range:hover*/.container--range.sc-calcite-slider .track__range.sc-calcite-slider:hover{cursor:ew-resize}/*!@.container--range .track__range:after*/.container--range.sc-calcite-slider .track__range.sc-calcite-slider:after{position:absolute;width:100%;content:\"\";top:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);height:calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height))}@media (forced-colors: active){/*!@.thumb*/.thumb.sc-calcite-slider{outline-width:0;outline-offset:0}/*!@.handle*/.handle.sc-calcite-slider{outline:2px solid transparent;outline-offset:2px}/*!@.thumb:focus .handle,\n.thumb .handle-extension,\n.thumb:hover .handle-extension,\n.thumb:focus .handle-extension,\n.thumb:active .handle-extension*/.thumb.sc-calcite-slider:focus .handle.sc-calcite-slider,.thumb.sc-calcite-slider .handle-extension.sc-calcite-slider,.thumb.sc-calcite-slider:hover .handle-extension.sc-calcite-slider,.thumb.sc-calcite-slider:focus .handle-extension.sc-calcite-slider,.thumb.sc-calcite-slider:active .handle-extension.sc-calcite-slider{background-color:canvasText}/*!@.track*/.track.sc-calcite-slider{background-color:canvasText}/*!@.track__range*/.track__range.sc-calcite-slider{background-color:highlight}}/*!@.tick*/.tick.sc-calcite-slider{position:absolute;height:0.25rem;width:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-ui-border-input);border-color:var(--calcite-ui-foreground-1);top:-2px;pointer-events:none;-webkit-margin-start:calc(-1 * 0.125rem);margin-inline-start:calc(-1 * 0.125rem)}/*!@.tick--active*/.tick--active.sc-calcite-slider{background-color:var(--calcite-ui-brand)}/*!@.tick__label*/.tick__label.sc-calcite-slider{pointer-events:none;margin-top:0.875rem;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}/*!@.tick__label--min*/.tick__label--min.sc-calcite-slider{-webkit-transition:opacity var(--calcite-animation-timing);transition:opacity var(--calcite-animation-timing)}/*!@.tick__label--max*/.tick__label--max.sc-calcite-slider{-webkit-transition:opacity var(--calcite-internal-animation-timing-fast);transition:opacity var(--calcite-internal-animation-timing-fast)}/*!@:host([has-histogram][label-handles]) .tick__label--min, :host([has-histogram][label-handles]) .tick__label--max, :host([has-histogram][precise]) .tick__label--min, :host([has-histogram][precise]) .tick__label--max*/[has-histogram][label-handles].sc-calcite-slider-h .tick__label--min.sc-calcite-slider,[has-histogram][label-handles].sc-calcite-slider-h .tick__label--max.sc-calcite-slider,[has-histogram][precise].sc-calcite-slider-h .tick__label--min.sc-calcite-slider,[has-histogram][precise].sc-calcite-slider-h .tick__label--max.sc-calcite-slider{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@.graph*/.graph.sc-calcite-slider{color:var(--calcite-ui-foreground-3);height:48px}/*!@:host([label-ticks][ticks]) .container*/[label-ticks][ticks].sc-calcite-slider-h .container.sc-calcite-slider{padding-bottom:calc(0.875rem + var(--calcite-slider-container-font-size))}/*!@:host([has-histogram]):host([precise][label-handles]) .container*/[has-histogram].sc-calcite-slider-h([precise][label-handles]).sc-calcite-slider-h .container.sc-calcite-slider{padding-bottom:calc(var(--calcite-slider-full-handle-height) + 1em)}/*!@:host([has-histogram]):host([label-handles]:not([precise])) .container*/[has-histogram].sc-calcite-slider-h([label-handles].sc-calcite-slider-h:not([precise])) .container.sc-calcite-slider{padding-bottom:calc(var(--calcite-slider-handle-size) * 0.5 + 1em)}/*!@:host([has-histogram]):host([precise]:not([label-handles])) .container*/[has-histogram].sc-calcite-slider-h([precise].sc-calcite-slider-h:not([label-handles])) .container.sc-calcite-slider{padding-bottom:var(--calcite-slider-full-handle-height)}/*!@:host(:not([has-histogram])):host([precise]:not([label-handles])) .container*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([precise]:not([label-handles])) .container.sc-calcite-slider{padding-top:var(--calcite-slider-full-handle-height)}/*!@:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([precise]:not([label-handles])) .container--range.sc-calcite-slider{padding-bottom:var(--calcite-slider-full-handle-height)}/*!@:host(:not([has-histogram])):host([label-handles]:not([precise])) .container*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([label-handles]:not([precise])) .container.sc-calcite-slider{padding-top:calc(var(--calcite-slider-full-handle-height) + 4px)}/*!@:host(:not([has-histogram])):host([label-handles][precise]) .container*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([label-handles][precise]) .container.sc-calcite-slider{padding-top:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}/*!@:host(:not([has-histogram])):host([label-handles][precise]) .container--range*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([label-handles][precise]) .container--range.sc-calcite-slider{padding-bottom:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-slider-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  24385. function isRange(value) {
  24386. return Array.isArray(value);
  24387. }
  24388. class Slider {
  24389. constructor(hostRef) {
  24390. registerInstance(this, hostRef);
  24391. this.calciteSliderInput = createEvent(this, "calciteSliderInput", 7);
  24392. this.calciteSliderChange = createEvent(this, "calciteSliderChange", 7);
  24393. this.calciteSliderUpdate = createEvent(this, "calciteSliderUpdate", 7);
  24394. //--------------------------------------------------------------------------
  24395. //
  24396. // Properties
  24397. //
  24398. //--------------------------------------------------------------------------
  24399. /** Disable and gray out the slider */
  24400. this.disabled = false;
  24401. /** Indicates if a histogram is present */
  24402. this.hasHistogram = false;
  24403. /** Label handles with their numeric value */
  24404. this.labelHandles = false;
  24405. /** Label tick marks with their numeric value. */
  24406. this.labelTicks = false;
  24407. /** Maximum selectable value */
  24408. this.max = 100;
  24409. /** Minimum selectable value */
  24410. this.min = 0;
  24411. /**
  24412. * When true, the slider will display values from high to low.
  24413. *
  24414. * Note that this value will be ignored if the slider has an associated histogram.
  24415. */
  24416. this.mirrored = false;
  24417. /** Use finer point for handles */
  24418. this.precise = false;
  24419. /**
  24420. * When true, makes the component required for form-submission.
  24421. */
  24422. this.required = false;
  24423. /** When true, enables snap selection along the step interval */
  24424. this.snap = false;
  24425. /** Interval to move on up/down keys */
  24426. this.step = 1;
  24427. /** Currently selected number (if single select) */
  24428. this.value = 0;
  24429. /**
  24430. * Specify the scale of the slider, defaults to m
  24431. */
  24432. this.scale = "m";
  24433. this.guid = `calcite-slider-${guid()}`;
  24434. this.activeProp = "value";
  24435. this.minMaxValueRange = null;
  24436. this.minValueDragRange = null;
  24437. this.maxValueDragRange = null;
  24438. this.tickValues = [];
  24439. this.dragUpdate = (event) => {
  24440. event.preventDefault();
  24441. if (this.dragProp) {
  24442. const value = this.translate(event.clientX || event.pageX);
  24443. if (isRange(this.value) && this.dragProp === "minMaxValue") {
  24444. if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
  24445. const newMinValue = value - this.minValueDragRange;
  24446. const newMaxValue = value + this.maxValueDragRange;
  24447. if (newMaxValue <= this.max &&
  24448. newMinValue >= this.min &&
  24449. newMaxValue - newMinValue === this.minMaxValueRange) {
  24450. this.minValue = this.clamp(newMinValue, "minValue");
  24451. this.maxValue = this.clamp(newMaxValue, "maxValue");
  24452. }
  24453. }
  24454. else {
  24455. this.minValueDragRange = value - this.minValue;
  24456. this.maxValueDragRange = this.maxValue - value;
  24457. this.minMaxValueRange = this.maxValue - this.minValue;
  24458. }
  24459. }
  24460. else {
  24461. this.setValue(this.dragProp, this.clamp(value, this.dragProp));
  24462. }
  24463. }
  24464. };
  24465. this.dragEnd = (event) => {
  24466. this.removeDragListeners();
  24467. this.focusActiveHandle(event.clientX);
  24468. if (this.lastDragPropValue != this[this.dragProp]) {
  24469. this.emitChange();
  24470. }
  24471. this.dragProp = null;
  24472. this.lastDragPropValue = null;
  24473. this.minValueDragRange = null;
  24474. this.maxValueDragRange = null;
  24475. this.minMaxValueRange = null;
  24476. };
  24477. /**
  24478. * Set the reference of the track Element
  24479. * @internal
  24480. * @param node
  24481. */
  24482. this.storeTrackRef = (node) => {
  24483. this.trackEl = node;
  24484. };
  24485. }
  24486. histogramWatcher(newHistogram) {
  24487. this.hasHistogram = !!newHistogram;
  24488. }
  24489. valueHandler() {
  24490. this.setMinMaxFromValue();
  24491. }
  24492. minMaxValueHandler() {
  24493. this.setValueFromMinMax();
  24494. }
  24495. //--------------------------------------------------------------------------
  24496. //
  24497. // Lifecycle
  24498. //
  24499. //--------------------------------------------------------------------------
  24500. connectedCallback() {
  24501. this.setMinMaxFromValue();
  24502. this.setValueFromMinMax();
  24503. connectLabel(this);
  24504. connectForm(this);
  24505. }
  24506. disconnectedCallback() {
  24507. disconnectLabel(this);
  24508. disconnectForm(this);
  24509. this.removeDragListeners();
  24510. }
  24511. componentWillLoad() {
  24512. this.tickValues = this.generateTickValues();
  24513. if (!isRange(this.value)) {
  24514. this.value = this.clamp(this.value);
  24515. }
  24516. afterConnectDefaultValueSet(this, this.value);
  24517. if (this.snap && !isRange(this.value)) {
  24518. this.value = this.getClosestStep(this.value);
  24519. }
  24520. if (this.histogram) {
  24521. this.hasHistogram = true;
  24522. }
  24523. }
  24524. componentDidRender() {
  24525. if (this.labelHandles) {
  24526. this.adjustHostObscuredHandleLabel("value");
  24527. if (isRange(this.value)) {
  24528. this.adjustHostObscuredHandleLabel("minValue");
  24529. if (!(this.precise && !this.hasHistogram)) {
  24530. this.hyphenateCollidingRangeHandleLabels();
  24531. }
  24532. }
  24533. }
  24534. this.hideObscuredBoundingTickLabels();
  24535. updateHostInteraction(this);
  24536. }
  24537. render() {
  24538. const id = this.el.id || this.guid;
  24539. const maxProp = isRange(this.value) ? "maxValue" : "value";
  24540. const value = isRange(this.value) ? this.maxValue : this.value;
  24541. const min = this.minValue || this.min;
  24542. const useMinValue = this.shouldUseMinValue();
  24543. const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
  24544. const maxInterval = this.getUnitInterval(value) * 100;
  24545. const mirror = this.shouldMirror();
  24546. const leftThumbOffset = `${mirror ? 100 - minInterval : minInterval}%`;
  24547. const rightThumbOffset = `${mirror ? maxInterval : 100 - maxInterval}%`;
  24548. const valueIsRange = isRange(this.value);
  24549. const handle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  24550. thumb: true,
  24551. "thumb--value": true,
  24552. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
  24553. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" })));
  24554. const labeledHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  24555. thumb: true,
  24556. "thumb--value": true,
  24557. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
  24558. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value" }, value ? value.toLocaleString() : value), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value), hAsync("div", { class: "handle" })));
  24559. const histogramLabeledHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  24560. thumb: true,
  24561. "thumb--value": true,
  24562. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
  24563. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value" }, value ? value.toLocaleString() : value), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value)));
  24564. const preciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  24565. thumb: true,
  24566. "thumb--value": true,
  24567. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
  24568. "thumb--precise": true
  24569. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("div", { class: "handle-extension" })));
  24570. const histogramPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  24571. thumb: true,
  24572. "thumb--value": true,
  24573. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
  24574. "thumb--precise": true
  24575. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" })));
  24576. const labeledPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  24577. thumb: true,
  24578. "thumb--value": true,
  24579. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
  24580. "thumb--precise": true
  24581. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value" }, value ? value.toLocaleString() : value), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value), hAsync("div", { class: "handle" }), hAsync("div", { class: "handle-extension" })));
  24582. const histogramLabeledPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  24583. thumb: true,
  24584. "thumb--value": true,
  24585. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
  24586. "thumb--precise": true
  24587. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value" }, value ? value.toLocaleString() : value), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value)));
  24588. const minHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  24589. thumb: true,
  24590. "thumb--minValue": true,
  24591. "thumb--active": this.dragProp === "minValue"
  24592. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: () => this.dragStart("minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" })));
  24593. const minLabeledHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  24594. thumb: true,
  24595. "thumb--minValue": true,
  24596. "thumb--active": this.dragProp === "minValue"
  24597. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: () => this.dragStart("minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue" }, this.minValue && this.minValue.toLocaleString()), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue static" }, this.minValue && this.minValue.toLocaleString()), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue transformed" }, this.minValue && this.minValue.toLocaleString()), hAsync("div", { class: "handle" })));
  24598. const minHistogramLabeledHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  24599. thumb: true,
  24600. "thumb--minValue": true,
  24601. "thumb--active": this.dragProp === "minValue"
  24602. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: () => this.dragStart("minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue" }, this.minValue && this.minValue.toLocaleString()), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue static" }, this.minValue && this.minValue.toLocaleString()), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue transformed" }, this.minValue && this.minValue.toLocaleString())));
  24603. const minPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  24604. thumb: true,
  24605. "thumb--minValue": true,
  24606. "thumb--active": this.dragProp === "minValue",
  24607. "thumb--precise": true
  24608. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: () => this.dragStart("minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" })));
  24609. const minLabeledPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  24610. thumb: true,
  24611. "thumb--minValue": true,
  24612. "thumb--active": this.dragProp === "minValue",
  24613. "thumb--precise": true
  24614. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: () => this.dragStart("minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue" }, this.minValue && this.minValue.toLocaleString()), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue static" }, this.minValue && this.minValue.toLocaleString()), hAsync("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue transformed" }, this.minValue && this.minValue.toLocaleString())));
  24615. return (hAsync(Host, { id: id, onTouchStart: this.handleTouchStart }, hAsync("div", { class: {
  24616. ["container"]: true,
  24617. ["container--range"]: valueIsRange,
  24618. [`scale--${this.scale}`]: true
  24619. } }, this.renderGraph(), hAsync("div", { class: "track", ref: this.storeTrackRef }, hAsync("div", { class: "track__range", onPointerDown: () => this.dragStart("minMaxValue"), style: {
  24620. left: `${mirror ? 100 - maxInterval : minInterval}%`,
  24621. right: `${mirror ? minInterval : 100 - maxInterval}%`
  24622. } }), hAsync("div", { class: "ticks" }, this.tickValues.map((tick) => {
  24623. const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
  24624. let activeTicks = tick >= min && tick <= value;
  24625. if (useMinValue) {
  24626. activeTicks = tick >= this.minValue && tick <= this.maxValue;
  24627. }
  24628. return (hAsync("span", { class: {
  24629. tick: true,
  24630. "tick--active": activeTicks
  24631. }, style: {
  24632. left: mirror ? "" : tickOffset,
  24633. right: mirror ? tickOffset : ""
  24634. } }, this.renderTickLabel(tick)));
  24635. }))), hAsync("div", { class: "thumb-container" }, !this.precise && !this.labelHandles && valueIsRange && minHandle, !this.hasHistogram &&
  24636. !this.precise &&
  24637. this.labelHandles &&
  24638. valueIsRange &&
  24639. minLabeledHandle, this.precise && !this.labelHandles && valueIsRange && minPreciseHandle, this.precise && this.labelHandles && valueIsRange && minLabeledPreciseHandle, this.hasHistogram &&
  24640. !this.precise &&
  24641. this.labelHandles &&
  24642. valueIsRange &&
  24643. minHistogramLabeledHandle, !this.precise && !this.labelHandles && handle, !this.hasHistogram && !this.precise && this.labelHandles && labeledHandle, !this.hasHistogram && this.precise && !this.labelHandles && preciseHandle, this.hasHistogram && this.precise && !this.labelHandles && histogramPreciseHandle, !this.hasHistogram && this.precise && this.labelHandles && labeledPreciseHandle, this.hasHistogram && !this.precise && this.labelHandles && histogramLabeledHandle, this.hasHistogram &&
  24644. this.precise &&
  24645. this.labelHandles &&
  24646. histogramLabeledPreciseHandle, hAsync(HiddenFormInputSlot, { component: this })))));
  24647. }
  24648. renderGraph() {
  24649. return this.histogram ? (hAsync("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: isRange(this.value) ? this.maxValue : this.value, highlightMin: isRange(this.value) ? this.minValue : this.min, max: this.max, min: this.min })) : null;
  24650. }
  24651. renderTickLabel(tick) {
  24652. const valueIsRange = isRange(this.value);
  24653. const isMinTickLabel = tick === this.min;
  24654. const isMaxTickLabel = tick === this.max;
  24655. const tickLabel = (hAsync("span", { class: {
  24656. tick__label: true,
  24657. "tick__label--min": isMinTickLabel,
  24658. "tick__label--max": isMaxTickLabel
  24659. } }, tick.toLocaleString()));
  24660. if (this.labelTicks && !this.hasHistogram && !valueIsRange) {
  24661. return tickLabel;
  24662. }
  24663. if (this.labelTicks &&
  24664. !this.hasHistogram &&
  24665. valueIsRange &&
  24666. !this.precise &&
  24667. !this.labelHandles) {
  24668. return tickLabel;
  24669. }
  24670. if (this.labelTicks &&
  24671. !this.hasHistogram &&
  24672. valueIsRange &&
  24673. !this.precise &&
  24674. this.labelHandles) {
  24675. return tickLabel;
  24676. }
  24677. if (this.labelTicks &&
  24678. !this.hasHistogram &&
  24679. valueIsRange &&
  24680. this.precise &&
  24681. (isMinTickLabel || isMaxTickLabel)) {
  24682. return tickLabel;
  24683. }
  24684. if (this.labelTicks && this.hasHistogram && !this.precise && !this.labelHandles) {
  24685. return tickLabel;
  24686. }
  24687. if (this.labelTicks &&
  24688. this.hasHistogram &&
  24689. this.precise &&
  24690. !this.labelHandles &&
  24691. (isMinTickLabel || isMaxTickLabel)) {
  24692. return tickLabel;
  24693. }
  24694. if (this.labelTicks &&
  24695. this.hasHistogram &&
  24696. !this.precise &&
  24697. this.labelHandles &&
  24698. (isMinTickLabel || isMaxTickLabel)) {
  24699. return tickLabel;
  24700. }
  24701. if (this.labelTicks &&
  24702. this.hasHistogram &&
  24703. this.precise &&
  24704. this.labelHandles &&
  24705. (isMinTickLabel || isMaxTickLabel)) {
  24706. return tickLabel;
  24707. }
  24708. return null;
  24709. }
  24710. //--------------------------------------------------------------------------
  24711. //
  24712. // Event Listeners
  24713. //
  24714. //--------------------------------------------------------------------------
  24715. keyDownHandler(event) {
  24716. const mirror = this.shouldMirror();
  24717. const { activeProp, max, min, pageStep, step } = this;
  24718. const value = this[activeProp];
  24719. const key = event.key;
  24720. if (key === "Enter" || key === " ") {
  24721. event.preventDefault();
  24722. return;
  24723. }
  24724. let adjustment;
  24725. if (key === "ArrowUp" || key === "ArrowRight") {
  24726. const directionFactor = mirror && key === "ArrowRight" ? -1 : 1;
  24727. adjustment = value + step * directionFactor;
  24728. }
  24729. else if (key === "ArrowDown" || key === "ArrowLeft") {
  24730. const directionFactor = mirror && key === "ArrowLeft" ? -1 : 1;
  24731. adjustment = value - step * directionFactor;
  24732. }
  24733. else if (key === "PageUp") {
  24734. if (pageStep) {
  24735. adjustment = value + pageStep;
  24736. }
  24737. }
  24738. else if (key === "PageDown") {
  24739. if (pageStep) {
  24740. adjustment = value - pageStep;
  24741. }
  24742. }
  24743. else if (key === "Home") {
  24744. adjustment = min;
  24745. }
  24746. else if (key === "End") {
  24747. adjustment = max;
  24748. }
  24749. if (isNaN(adjustment)) {
  24750. return;
  24751. }
  24752. event.preventDefault();
  24753. const fixedDecimalAdjustment = Number(adjustment.toFixed(decimalPlaces(step)));
  24754. this.setValue(activeProp, this.clamp(fixedDecimalAdjustment, activeProp));
  24755. }
  24756. clickHandler(event) {
  24757. this.focusActiveHandle(event.clientX);
  24758. }
  24759. pointerDownHandler(event) {
  24760. const x = event.clientX || event.pageX;
  24761. const position = this.translate(x);
  24762. let prop = "value";
  24763. if (isRange(this.value)) {
  24764. const inRange = position >= this.minValue && position <= this.maxValue;
  24765. if (inRange && this.lastDragProp === "minMaxValue") {
  24766. prop = "minMaxValue";
  24767. }
  24768. else {
  24769. const closerToMax = Math.abs(this.maxValue - position) < Math.abs(this.minValue - position);
  24770. prop = closerToMax || position > this.maxValue ? "maxValue" : "minValue";
  24771. }
  24772. }
  24773. this.lastDragPropValue = this[prop];
  24774. this.dragStart(prop);
  24775. const isThumbActive = this.el.shadowRoot.querySelector(".thumb:active");
  24776. if (!isThumbActive) {
  24777. this.setValue(prop, this.clamp(position, prop));
  24778. }
  24779. }
  24780. handleTouchStart(event) {
  24781. // needed to prevent extra click at the end of a handle drag
  24782. event.preventDefault();
  24783. }
  24784. //--------------------------------------------------------------------------
  24785. //
  24786. // Public Methods
  24787. //
  24788. //--------------------------------------------------------------------------
  24789. /** Sets focus on the component. */
  24790. async setFocus() {
  24791. const handle = this.minHandle ? this.minHandle : this.maxHandle;
  24792. handle.focus();
  24793. }
  24794. //--------------------------------------------------------------------------
  24795. //
  24796. // Private Methods
  24797. //
  24798. //--------------------------------------------------------------------------
  24799. setValueFromMinMax() {
  24800. const { minValue, maxValue } = this;
  24801. if (typeof minValue === "number" && typeof maxValue === "number") {
  24802. this.value = [minValue, maxValue];
  24803. }
  24804. }
  24805. setMinMaxFromValue() {
  24806. const { value } = this;
  24807. if (isRange(value)) {
  24808. this.minValue = value[0];
  24809. this.maxValue = value[1];
  24810. }
  24811. }
  24812. onLabelClick() {
  24813. this.setFocus();
  24814. }
  24815. shouldMirror() {
  24816. return this.mirrored && !this.hasHistogram;
  24817. }
  24818. shouldUseMinValue() {
  24819. if (!isRange(this.value)) {
  24820. return false;
  24821. }
  24822. return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
  24823. }
  24824. generateTickValues() {
  24825. const ticks = [];
  24826. let current = this.min;
  24827. while (this.ticks && current < this.max + this.ticks) {
  24828. ticks.push(Math.min(current, this.max));
  24829. current = current + this.ticks;
  24830. }
  24831. return ticks;
  24832. }
  24833. dragStart(prop) {
  24834. this.dragProp = prop;
  24835. this.lastDragProp = this.dragProp;
  24836. this.activeProp = prop;
  24837. document.addEventListener("pointermove", this.dragUpdate);
  24838. document.addEventListener("pointerup", this.dragEnd);
  24839. document.addEventListener("pointercancel", this.dragEnd);
  24840. }
  24841. focusActiveHandle(valueX) {
  24842. switch (this.dragProp) {
  24843. case "minValue":
  24844. this.minHandle.focus();
  24845. break;
  24846. case "maxValue":
  24847. this.maxHandle.focus();
  24848. break;
  24849. case "minMaxValue":
  24850. this.getClosestHandle(valueX).focus();
  24851. break;
  24852. }
  24853. }
  24854. emitInput() {
  24855. this.calciteSliderInput.emit();
  24856. this.calciteSliderUpdate.emit();
  24857. }
  24858. emitChange() {
  24859. this.calciteSliderChange.emit();
  24860. }
  24861. removeDragListeners() {
  24862. document.removeEventListener("pointermove", this.dragUpdate);
  24863. document.removeEventListener("pointerup", this.dragEnd);
  24864. document.removeEventListener("pointercancel", this.dragEnd);
  24865. }
  24866. /**
  24867. * Set the prop value if changed at the component level
  24868. * @param valueProp
  24869. * @param value
  24870. */
  24871. setValue(valueProp, value) {
  24872. const oldValue = this[valueProp];
  24873. const valueChanged = oldValue !== value;
  24874. if (!valueChanged) {
  24875. return;
  24876. }
  24877. this[valueProp] = value;
  24878. const dragging = this.dragProp;
  24879. if (!dragging) {
  24880. this.emitChange();
  24881. }
  24882. this.emitInput();
  24883. }
  24884. /**
  24885. * If number is outside range, constrain to min or max
  24886. * @internal
  24887. */
  24888. clamp(value, prop) {
  24889. value = clamp(value, this.min, this.max);
  24890. // ensure that maxValue and minValue don't swap positions
  24891. if (prop === "maxValue") {
  24892. value = Math.max(value, this.minValue);
  24893. }
  24894. if (prop === "minValue") {
  24895. value = Math.min(value, this.maxValue);
  24896. }
  24897. return value;
  24898. }
  24899. /**
  24900. * Translate a pixel position to value along the range
  24901. * @internal
  24902. */
  24903. translate(x) {
  24904. const range = this.max - this.min;
  24905. const { left, width } = this.trackEl.getBoundingClientRect();
  24906. const percent = (x - left) / width;
  24907. const mirror = this.shouldMirror();
  24908. const clampedValue = this.clamp(this.min + range * (mirror ? 1 - percent : percent));
  24909. let value = Number(clampedValue.toFixed(decimalPlaces(this.step)));
  24910. if (this.snap && this.step) {
  24911. value = this.getClosestStep(value);
  24912. }
  24913. return value;
  24914. }
  24915. /**
  24916. * Get closest allowed value along stepped values
  24917. * @internal
  24918. */
  24919. getClosestStep(num) {
  24920. num = Number(this.clamp(num).toFixed(decimalPlaces(this.step)));
  24921. if (this.step) {
  24922. const step = Math.round(num / this.step) * this.step;
  24923. num = Number(this.clamp(step).toFixed(decimalPlaces(this.step)));
  24924. }
  24925. return num;
  24926. }
  24927. getClosestHandle(valueX) {
  24928. return this.getDistanceX(this.maxHandle, valueX) > this.getDistanceX(this.minHandle, valueX)
  24929. ? this.minHandle
  24930. : this.maxHandle;
  24931. }
  24932. getDistanceX(el, valueX) {
  24933. return Math.abs(el.getBoundingClientRect().left - valueX);
  24934. }
  24935. getFontSizeForElement(element) {
  24936. return Number(window.getComputedStyle(element).getPropertyValue("font-size").match(/\d+/)[0]);
  24937. }
  24938. /**
  24939. * Get position of value along range as fractional value
  24940. * @return {number} number in the unit interval [0,1]
  24941. * @internal
  24942. */
  24943. getUnitInterval(num) {
  24944. num = this.clamp(num);
  24945. const range = this.max - this.min;
  24946. return (num - this.min) / range;
  24947. }
  24948. adjustHostObscuredHandleLabel(name) {
  24949. const label = this.el.shadowRoot.querySelector(`.handle__label--${name}`);
  24950. const labelStatic = this.el.shadowRoot.querySelector(`.handle__label--${name}.static`);
  24951. const labelTransformed = this.el.shadowRoot.querySelector(`.handle__label--${name}.transformed`);
  24952. const labelStaticBounds = labelStatic.getBoundingClientRect();
  24953. const labelStaticOffset = this.getHostOffset(labelStaticBounds.left, labelStaticBounds.right);
  24954. label.style.transform = `translateX(${labelStaticOffset}px)`;
  24955. labelTransformed.style.transform = `translateX(${labelStaticOffset}px)`;
  24956. }
  24957. hyphenateCollidingRangeHandleLabels() {
  24958. const { shadowRoot } = this.el;
  24959. const mirror = this.shouldMirror();
  24960. const leftModifier = mirror ? "value" : "minValue";
  24961. const rightModifier = mirror ? "minValue" : "value";
  24962. const leftValueLabel = shadowRoot.querySelector(`.handle__label--${leftModifier}`);
  24963. const leftValueLabelStatic = shadowRoot.querySelector(`.handle__label--${leftModifier}.static`);
  24964. const leftValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${leftModifier}.transformed`);
  24965. const leftValueLabelStaticHostOffset = this.getHostOffset(leftValueLabelStatic.getBoundingClientRect().left, leftValueLabelStatic.getBoundingClientRect().right);
  24966. const rightValueLabel = shadowRoot.querySelector(`.handle__label--${rightModifier}`);
  24967. const rightValueLabelStatic = shadowRoot.querySelector(`.handle__label--${rightModifier}.static`);
  24968. const rightValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${rightModifier}.transformed`);
  24969. const rightValueLabelStaticHostOffset = this.getHostOffset(rightValueLabelStatic.getBoundingClientRect().left, rightValueLabelStatic.getBoundingClientRect().right);
  24970. const labelFontSize = this.getFontSizeForElement(leftValueLabel);
  24971. const labelTransformedOverlap = this.getRangeLabelOverlap(leftValueLabelTransformed, rightValueLabelTransformed);
  24972. const hyphenLabel = leftValueLabel;
  24973. const labelOffset = labelFontSize / 2;
  24974. if (labelTransformedOverlap > 0) {
  24975. hyphenLabel.classList.add("hyphen", "hyphen--wrap");
  24976. if (rightValueLabelStaticHostOffset === 0 && leftValueLabelStaticHostOffset === 0) {
  24977. // Neither handle overlaps the host boundary
  24978. let leftValueLabelTranslate = labelTransformedOverlap / 2 - labelOffset;
  24979. leftValueLabelTranslate =
  24980. Math.sign(leftValueLabelTranslate) === -1
  24981. ? Math.abs(leftValueLabelTranslate)
  24982. : -leftValueLabelTranslate;
  24983. const leftValueLabelTransformedHostOffset = this.getHostOffset(leftValueLabelTransformed.getBoundingClientRect().left +
  24984. leftValueLabelTranslate -
  24985. labelOffset, leftValueLabelTransformed.getBoundingClientRect().right +
  24986. leftValueLabelTranslate -
  24987. labelOffset);
  24988. let rightValueLabelTranslate = labelTransformedOverlap / 2;
  24989. const rightValueLabelTransformedHostOffset = this.getHostOffset(rightValueLabelTransformed.getBoundingClientRect().left + rightValueLabelTranslate, rightValueLabelTransformed.getBoundingClientRect().right + rightValueLabelTranslate);
  24990. if (leftValueLabelTransformedHostOffset !== 0) {
  24991. leftValueLabelTranslate += leftValueLabelTransformedHostOffset;
  24992. rightValueLabelTranslate += leftValueLabelTransformedHostOffset;
  24993. }
  24994. if (rightValueLabelTransformedHostOffset !== 0) {
  24995. leftValueLabelTranslate += rightValueLabelTransformedHostOffset;
  24996. rightValueLabelTranslate += rightValueLabelTransformedHostOffset;
  24997. }
  24998. leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
  24999. leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
  25000. rightValueLabel.style.transform = `translateX(${rightValueLabelTranslate}px)`;
  25001. rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelTranslate}px)`;
  25002. }
  25003. else if (leftValueLabelStaticHostOffset > 0 || rightValueLabelStaticHostOffset > 0) {
  25004. // labels overlap host boundary on the left side
  25005. leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset + labelOffset}px)`;
  25006. rightValueLabel.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
  25007. rightValueLabelTransformed.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
  25008. }
  25009. else if (leftValueLabelStaticHostOffset < 0 || rightValueLabelStaticHostOffset < 0) {
  25010. // labels overlap host boundary on the right side
  25011. let leftValueLabelTranslate = Math.abs(leftValueLabelStaticHostOffset) + labelTransformedOverlap - labelOffset;
  25012. leftValueLabelTranslate =
  25013. Math.sign(leftValueLabelTranslate) === -1
  25014. ? Math.abs(leftValueLabelTranslate)
  25015. : -leftValueLabelTranslate;
  25016. leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
  25017. leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
  25018. }
  25019. }
  25020. else {
  25021. hyphenLabel.classList.remove("hyphen", "hyphen--wrap");
  25022. leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
  25023. leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
  25024. rightValueLabel.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
  25025. rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
  25026. }
  25027. }
  25028. /**
  25029. * Hides bounding tick labels that are obscured by either handle.
  25030. */
  25031. hideObscuredBoundingTickLabels() {
  25032. const valueIsRange = isRange(this.value);
  25033. if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
  25034. return;
  25035. }
  25036. if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
  25037. return;
  25038. }
  25039. if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
  25040. return;
  25041. }
  25042. if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
  25043. return;
  25044. }
  25045. if (!this.hasHistogram && valueIsRange && !this.precise) {
  25046. return;
  25047. }
  25048. if (this.hasHistogram && !this.precise && !this.labelHandles) {
  25049. return;
  25050. }
  25051. const minHandle = this.el.shadowRoot.querySelector(".thumb--minValue");
  25052. const maxHandle = this.el.shadowRoot.querySelector(".thumb--value");
  25053. const minTickLabel = this.el.shadowRoot.querySelector(".tick__label--min");
  25054. const maxTickLabel = this.el.shadowRoot.querySelector(".tick__label--max");
  25055. if (!minHandle && maxHandle && minTickLabel && maxTickLabel) {
  25056. minTickLabel.style.opacity = this.isMinTickLabelObscured(minTickLabel, maxHandle) ? "0" : "1";
  25057. maxTickLabel.style.opacity = this.isMaxTickLabelObscured(maxTickLabel, maxHandle) ? "0" : "1";
  25058. }
  25059. if (minHandle && maxHandle && minTickLabel && maxTickLabel) {
  25060. minTickLabel.style.opacity =
  25061. this.isMinTickLabelObscured(minTickLabel, minHandle) ||
  25062. this.isMinTickLabelObscured(minTickLabel, maxHandle)
  25063. ? "0"
  25064. : "1";
  25065. maxTickLabel.style.opacity =
  25066. this.isMaxTickLabelObscured(maxTickLabel, minHandle) ||
  25067. (this.isMaxTickLabelObscured(maxTickLabel, maxHandle) && this.hasHistogram)
  25068. ? "0"
  25069. : "1";
  25070. }
  25071. }
  25072. /**
  25073. * Returns an integer representing the number of pixels to offset on the left or right side based on desired position behavior.
  25074. * @internal
  25075. */
  25076. getHostOffset(leftBounds, rightBounds) {
  25077. const hostBounds = this.el.getBoundingClientRect();
  25078. const buffer = 7;
  25079. if (leftBounds + buffer < hostBounds.left) {
  25080. return hostBounds.left - leftBounds - buffer;
  25081. }
  25082. if (rightBounds - buffer > hostBounds.right) {
  25083. return -(rightBounds - hostBounds.right) + buffer;
  25084. }
  25085. return 0;
  25086. }
  25087. /**
  25088. * Returns an integer representing the number of pixels that the two given span elements are overlapping, taking into account
  25089. * a space in between the two spans equal to the font-size set on them to account for the space needed to render a hyphen.
  25090. * @param leftLabel
  25091. * @param rightLabel
  25092. */
  25093. getRangeLabelOverlap(leftLabel, rightLabel) {
  25094. const leftLabelBounds = leftLabel.getBoundingClientRect();
  25095. const rightLabelBounds = rightLabel.getBoundingClientRect();
  25096. const leftLabelFontSize = this.getFontSizeForElement(leftLabel);
  25097. const rangeLabelOverlap = leftLabelBounds.right + leftLabelFontSize - rightLabelBounds.left;
  25098. return Math.max(rangeLabelOverlap, 0);
  25099. }
  25100. /**
  25101. * Returns a boolean value representing if the minLabel span element is obscured (being overlapped) by the given handle div element.
  25102. * @param minLabel
  25103. * @param handle
  25104. */
  25105. isMinTickLabelObscured(minLabel, handle) {
  25106. const minLabelBounds = minLabel.getBoundingClientRect();
  25107. const handleBounds = handle.getBoundingClientRect();
  25108. return intersects(minLabelBounds, handleBounds);
  25109. }
  25110. /**
  25111. * Returns a boolean value representing if the maxLabel span element is obscured (being overlapped) by the given handle div element.
  25112. * @param maxLabel
  25113. * @param handle
  25114. */
  25115. isMaxTickLabelObscured(maxLabel, handle) {
  25116. const maxLabelBounds = maxLabel.getBoundingClientRect();
  25117. const handleBounds = handle.getBoundingClientRect();
  25118. return intersects(maxLabelBounds, handleBounds);
  25119. }
  25120. get el() { return getElement(this); }
  25121. static get watchers() { return {
  25122. "histogram": ["histogramWatcher"],
  25123. "value": ["valueHandler"],
  25124. "minValue": ["minMaxValueHandler"],
  25125. "maxValue": ["minMaxValueHandler"]
  25126. }; }
  25127. static get style() { return sliderCss; }
  25128. static get cmpMeta() { return {
  25129. "$flags$": 9,
  25130. "$tagName$": "calcite-slider",
  25131. "$members$": {
  25132. "disabled": [516],
  25133. "hasHistogram": [1540, "has-histogram"],
  25134. "histogram": [16],
  25135. "histogramStops": [16],
  25136. "labelHandles": [516, "label-handles"],
  25137. "labelTicks": [516, "label-ticks"],
  25138. "max": [514],
  25139. "maxLabel": [1, "max-label"],
  25140. "maxValue": [1026, "max-value"],
  25141. "min": [514],
  25142. "minLabel": [1, "min-label"],
  25143. "minValue": [1026, "min-value"],
  25144. "mirrored": [516],
  25145. "name": [513],
  25146. "pageStep": [2, "page-step"],
  25147. "precise": [4],
  25148. "required": [516],
  25149. "snap": [4],
  25150. "step": [2],
  25151. "ticks": [2],
  25152. "value": [1538],
  25153. "scale": [1],
  25154. "activeProp": [32],
  25155. "minMaxValueRange": [32],
  25156. "minValueDragRange": [32],
  25157. "maxValueDragRange": [32],
  25158. "tickValues": [32],
  25159. "setFocus": [64]
  25160. },
  25161. "$listeners$": [[0, "keydown", "keyDownHandler"], [0, "click", "clickHandler"], [1, "pointerdown", "pointerDownHandler"]],
  25162. "$lazyBundleId$": "-",
  25163. "$attrsToReflect$": [["disabled", "disabled"], ["hasHistogram", "has-histogram"], ["labelHandles", "label-handles"], ["labelTicks", "label-ticks"], ["max", "max"], ["min", "min"], ["mirrored", "mirrored"], ["name", "name"], ["required", "required"], ["value", "value"]]
  25164. }; }
  25165. }
  25166. /**!
  25167. * Sortable 1.15.0
  25168. * @author RubaXa <trash@rubaxa.org>
  25169. * @author owenm <owen23355@gmail.com>
  25170. * @license MIT
  25171. */
  25172. function ownKeys(object, enumerableOnly) {
  25173. var keys = Object.keys(object);
  25174. if (Object.getOwnPropertySymbols) {
  25175. var symbols = Object.getOwnPropertySymbols(object);
  25176. if (enumerableOnly) {
  25177. symbols = symbols.filter(function (sym) {
  25178. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  25179. });
  25180. }
  25181. keys.push.apply(keys, symbols);
  25182. }
  25183. return keys;
  25184. }
  25185. function _objectSpread2(target) {
  25186. for (var i = 1; i < arguments.length; i++) {
  25187. var source = arguments[i] != null ? arguments[i] : {};
  25188. if (i % 2) {
  25189. ownKeys(Object(source), true).forEach(function (key) {
  25190. _defineProperty(target, key, source[key]);
  25191. });
  25192. } else if (Object.getOwnPropertyDescriptors) {
  25193. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  25194. } else {
  25195. ownKeys(Object(source)).forEach(function (key) {
  25196. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  25197. });
  25198. }
  25199. }
  25200. return target;
  25201. }
  25202. function _typeof(obj) {
  25203. "@babel/helpers - typeof";
  25204. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  25205. _typeof = function (obj) {
  25206. return typeof obj;
  25207. };
  25208. } else {
  25209. _typeof = function (obj) {
  25210. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  25211. };
  25212. }
  25213. return _typeof(obj);
  25214. }
  25215. function _defineProperty(obj, key, value) {
  25216. if (key in obj) {
  25217. Object.defineProperty(obj, key, {
  25218. value: value,
  25219. enumerable: true,
  25220. configurable: true,
  25221. writable: true
  25222. });
  25223. } else {
  25224. obj[key] = value;
  25225. }
  25226. return obj;
  25227. }
  25228. function _extends() {
  25229. _extends = Object.assign || function (target) {
  25230. for (var i = 1; i < arguments.length; i++) {
  25231. var source = arguments[i];
  25232. for (var key in source) {
  25233. if (Object.prototype.hasOwnProperty.call(source, key)) {
  25234. target[key] = source[key];
  25235. }
  25236. }
  25237. }
  25238. return target;
  25239. };
  25240. return _extends.apply(this, arguments);
  25241. }
  25242. function _objectWithoutPropertiesLoose(source, excluded) {
  25243. if (source == null) return {};
  25244. var target = {};
  25245. var sourceKeys = Object.keys(source);
  25246. var key, i;
  25247. for (i = 0; i < sourceKeys.length; i++) {
  25248. key = sourceKeys[i];
  25249. if (excluded.indexOf(key) >= 0) continue;
  25250. target[key] = source[key];
  25251. }
  25252. return target;
  25253. }
  25254. function _objectWithoutProperties(source, excluded) {
  25255. if (source == null) return {};
  25256. var target = _objectWithoutPropertiesLoose(source, excluded);
  25257. var key, i;
  25258. if (Object.getOwnPropertySymbols) {
  25259. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  25260. for (i = 0; i < sourceSymbolKeys.length; i++) {
  25261. key = sourceSymbolKeys[i];
  25262. if (excluded.indexOf(key) >= 0) continue;
  25263. if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
  25264. target[key] = source[key];
  25265. }
  25266. }
  25267. return target;
  25268. }
  25269. var version = "1.15.0";
  25270. function userAgent(pattern) {
  25271. if (typeof window !== 'undefined' && window.navigator) {
  25272. return !! /*@__PURE__*/navigator.userAgent.match(pattern);
  25273. }
  25274. }
  25275. var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
  25276. var Edge = userAgent(/Edge/i);
  25277. var FireFox = userAgent(/firefox/i);
  25278. var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
  25279. var IOS = userAgent(/iP(ad|od|hone)/i);
  25280. var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
  25281. var captureMode = {
  25282. capture: false,
  25283. passive: false
  25284. };
  25285. function on(el, event, fn) {
  25286. el.addEventListener(event, fn, !IE11OrLess && captureMode);
  25287. }
  25288. function off(el, event, fn) {
  25289. el.removeEventListener(event, fn, !IE11OrLess && captureMode);
  25290. }
  25291. function matches(
  25292. /**HTMLElement*/
  25293. el,
  25294. /**String*/
  25295. selector) {
  25296. if (!selector) return;
  25297. selector[0] === '>' && (selector = selector.substring(1));
  25298. if (el) {
  25299. try {
  25300. if (el.matches) {
  25301. return el.matches(selector);
  25302. } else if (el.msMatchesSelector) {
  25303. return el.msMatchesSelector(selector);
  25304. } else if (el.webkitMatchesSelector) {
  25305. return el.webkitMatchesSelector(selector);
  25306. }
  25307. } catch (_) {
  25308. return false;
  25309. }
  25310. }
  25311. return false;
  25312. }
  25313. function getParentOrHost(el) {
  25314. return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
  25315. }
  25316. function closest(
  25317. /**HTMLElement*/
  25318. el,
  25319. /**String*/
  25320. selector,
  25321. /**HTMLElement*/
  25322. ctx, includeCTX) {
  25323. if (el) {
  25324. ctx = ctx || document;
  25325. do {
  25326. if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
  25327. return el;
  25328. }
  25329. if (el === ctx) break;
  25330. /* jshint boss:true */
  25331. } while (el = getParentOrHost(el));
  25332. }
  25333. return null;
  25334. }
  25335. var R_SPACE = /\s+/g;
  25336. function toggleClass(el, name, state) {
  25337. if (el && name) {
  25338. if (el.classList) {
  25339. el.classList[state ? 'add' : 'remove'](name);
  25340. } else {
  25341. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  25342. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  25343. }
  25344. }
  25345. }
  25346. function css(el, prop, val) {
  25347. var style = el && el.style;
  25348. if (style) {
  25349. if (val === void 0) {
  25350. if (document.defaultView && document.defaultView.getComputedStyle) {
  25351. val = document.defaultView.getComputedStyle(el, '');
  25352. } else if (el.currentStyle) {
  25353. val = el.currentStyle;
  25354. }
  25355. return prop === void 0 ? val : val[prop];
  25356. } else {
  25357. if (!(prop in style) && prop.indexOf('webkit') === -1) {
  25358. prop = '-webkit-' + prop;
  25359. }
  25360. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  25361. }
  25362. }
  25363. }
  25364. function matrix(el, selfOnly) {
  25365. var appliedTransforms = '';
  25366. if (typeof el === 'string') {
  25367. appliedTransforms = el;
  25368. } else {
  25369. do {
  25370. var transform = css(el, 'transform');
  25371. if (transform && transform !== 'none') {
  25372. appliedTransforms = transform + ' ' + appliedTransforms;
  25373. }
  25374. /* jshint boss:true */
  25375. } while (!selfOnly && (el = el.parentNode));
  25376. }
  25377. var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
  25378. /*jshint -W056 */
  25379. return matrixFn && new matrixFn(appliedTransforms);
  25380. }
  25381. function find(ctx, tagName, iterator) {
  25382. if (ctx) {
  25383. var list = ctx.getElementsByTagName(tagName),
  25384. i = 0,
  25385. n = list.length;
  25386. if (iterator) {
  25387. for (; i < n; i++) {
  25388. iterator(list[i], i);
  25389. }
  25390. }
  25391. return list;
  25392. }
  25393. return [];
  25394. }
  25395. function getWindowScrollingElement() {
  25396. var scrollingElement = document.scrollingElement;
  25397. if (scrollingElement) {
  25398. return scrollingElement;
  25399. } else {
  25400. return document.documentElement;
  25401. }
  25402. }
  25403. /**
  25404. * Returns the "bounding client rect" of given element
  25405. * @param {HTMLElement} el The element whose boundingClientRect is wanted
  25406. * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
  25407. * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
  25408. * @param {[Boolean]} undoScale Whether the container's scale() should be undone
  25409. * @param {[HTMLElement]} container The parent the element will be placed in
  25410. * @return {Object} The boundingClientRect of el, with specified adjustments
  25411. */
  25412. function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
  25413. if (!el.getBoundingClientRect && el !== window) return;
  25414. var elRect, top, left, bottom, right, height, width;
  25415. if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
  25416. elRect = el.getBoundingClientRect();
  25417. top = elRect.top;
  25418. left = elRect.left;
  25419. bottom = elRect.bottom;
  25420. right = elRect.right;
  25421. height = elRect.height;
  25422. width = elRect.width;
  25423. } else {
  25424. top = 0;
  25425. left = 0;
  25426. bottom = window.innerHeight;
  25427. right = window.innerWidth;
  25428. height = window.innerHeight;
  25429. width = window.innerWidth;
  25430. }
  25431. if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
  25432. // Adjust for translate()
  25433. container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
  25434. // Not needed on <= IE11
  25435. if (!IE11OrLess) {
  25436. do {
  25437. if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
  25438. var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container
  25439. top -= containerRect.top + parseInt(css(container, 'border-top-width'));
  25440. left -= containerRect.left + parseInt(css(container, 'border-left-width'));
  25441. bottom = top + elRect.height;
  25442. right = left + elRect.width;
  25443. break;
  25444. }
  25445. /* jshint boss:true */
  25446. } while (container = container.parentNode);
  25447. }
  25448. }
  25449. if (undoScale && el !== window) {
  25450. // Adjust for scale()
  25451. var elMatrix = matrix(container || el),
  25452. scaleX = elMatrix && elMatrix.a,
  25453. scaleY = elMatrix && elMatrix.d;
  25454. if (elMatrix) {
  25455. top /= scaleY;
  25456. left /= scaleX;
  25457. width /= scaleX;
  25458. height /= scaleY;
  25459. bottom = top + height;
  25460. right = left + width;
  25461. }
  25462. }
  25463. return {
  25464. top: top,
  25465. left: left,
  25466. bottom: bottom,
  25467. right: right,
  25468. width: width,
  25469. height: height
  25470. };
  25471. }
  25472. /**
  25473. * Checks if a side of an element is scrolled past a side of its parents
  25474. * @param {HTMLElement} el The element who's side being scrolled out of view is in question
  25475. * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
  25476. * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
  25477. * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
  25478. */
  25479. function isScrolledPast(el, elSide, parentSide) {
  25480. var parent = getParentAutoScrollElement(el, true),
  25481. elSideVal = getRect(el)[elSide];
  25482. /* jshint boss:true */
  25483. while (parent) {
  25484. var parentSideVal = getRect(parent)[parentSide],
  25485. visible = void 0;
  25486. if (parentSide === 'top' || parentSide === 'left') {
  25487. visible = elSideVal >= parentSideVal;
  25488. } else {
  25489. visible = elSideVal <= parentSideVal;
  25490. }
  25491. if (!visible) return parent;
  25492. if (parent === getWindowScrollingElement()) break;
  25493. parent = getParentAutoScrollElement(parent, false);
  25494. }
  25495. return false;
  25496. }
  25497. /**
  25498. * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
  25499. * and non-draggable elements
  25500. * @param {HTMLElement} el The parent element
  25501. * @param {Number} childNum The index of the child
  25502. * @param {Object} options Parent Sortable's options
  25503. * @return {HTMLElement} The child at index childNum, or null if not found
  25504. */
  25505. function getChild(el, childNum, options, includeDragEl) {
  25506. var currentChild = 0,
  25507. i = 0,
  25508. children = el.children;
  25509. while (i < children.length) {
  25510. if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
  25511. if (currentChild === childNum) {
  25512. return children[i];
  25513. }
  25514. currentChild++;
  25515. }
  25516. i++;
  25517. }
  25518. return null;
  25519. }
  25520. /**
  25521. * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
  25522. * @param {HTMLElement} el Parent element
  25523. * @param {selector} selector Any other elements that should be ignored
  25524. * @return {HTMLElement} The last child, ignoring ghostEl
  25525. */
  25526. function lastChild(el, selector) {
  25527. var last = el.lastElementChild;
  25528. while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
  25529. last = last.previousElementSibling;
  25530. }
  25531. return last || null;
  25532. }
  25533. /**
  25534. * Returns the index of an element within its parent for a selected set of
  25535. * elements
  25536. * @param {HTMLElement} el
  25537. * @param {selector} selector
  25538. * @return {number}
  25539. */
  25540. function index(el, selector) {
  25541. var index = 0;
  25542. if (!el || !el.parentNode) {
  25543. return -1;
  25544. }
  25545. /* jshint boss:true */
  25546. while (el = el.previousElementSibling) {
  25547. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
  25548. index++;
  25549. }
  25550. }
  25551. return index;
  25552. }
  25553. /**
  25554. * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
  25555. * The value is returned in real pixels.
  25556. * @param {HTMLElement} el
  25557. * @return {Array} Offsets in the format of [left, top]
  25558. */
  25559. function getRelativeScrollOffset(el) {
  25560. var offsetLeft = 0,
  25561. offsetTop = 0,
  25562. winScroller = getWindowScrollingElement();
  25563. if (el) {
  25564. do {
  25565. var elMatrix = matrix(el),
  25566. scaleX = elMatrix.a,
  25567. scaleY = elMatrix.d;
  25568. offsetLeft += el.scrollLeft * scaleX;
  25569. offsetTop += el.scrollTop * scaleY;
  25570. } while (el !== winScroller && (el = el.parentNode));
  25571. }
  25572. return [offsetLeft, offsetTop];
  25573. }
  25574. /**
  25575. * Returns the index of the object within the given array
  25576. * @param {Array} arr Array that may or may not hold the object
  25577. * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
  25578. * @return {Number} The index of the object in the array, or -1
  25579. */
  25580. function indexOfObject(arr, obj) {
  25581. for (var i in arr) {
  25582. if (!arr.hasOwnProperty(i)) continue;
  25583. for (var key in obj) {
  25584. if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
  25585. }
  25586. }
  25587. return -1;
  25588. }
  25589. function getParentAutoScrollElement(el, includeSelf) {
  25590. // skip to window
  25591. if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
  25592. var elem = el;
  25593. var gotSelf = false;
  25594. do {
  25595. // we don't need to get elem css if it isn't even overflowing in the first place (performance)
  25596. if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
  25597. var elemCSS = css(elem);
  25598. if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
  25599. if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
  25600. if (gotSelf || includeSelf) return elem;
  25601. gotSelf = true;
  25602. }
  25603. }
  25604. /* jshint boss:true */
  25605. } while (elem = elem.parentNode);
  25606. return getWindowScrollingElement();
  25607. }
  25608. function extend(dst, src) {
  25609. if (dst && src) {
  25610. for (var key in src) {
  25611. if (src.hasOwnProperty(key)) {
  25612. dst[key] = src[key];
  25613. }
  25614. }
  25615. }
  25616. return dst;
  25617. }
  25618. function isRectEqual(rect1, rect2) {
  25619. return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
  25620. }
  25621. var _throttleTimeout;
  25622. function throttle(callback, ms) {
  25623. return function () {
  25624. if (!_throttleTimeout) {
  25625. var args = arguments,
  25626. _this = this;
  25627. if (args.length === 1) {
  25628. callback.call(_this, args[0]);
  25629. } else {
  25630. callback.apply(_this, args);
  25631. }
  25632. _throttleTimeout = setTimeout(function () {
  25633. _throttleTimeout = void 0;
  25634. }, ms);
  25635. }
  25636. };
  25637. }
  25638. function cancelThrottle() {
  25639. clearTimeout(_throttleTimeout);
  25640. _throttleTimeout = void 0;
  25641. }
  25642. function scrollBy(el, x, y) {
  25643. el.scrollLeft += x;
  25644. el.scrollTop += y;
  25645. }
  25646. function clone(el) {
  25647. var Polymer = window.Polymer;
  25648. var $ = window.jQuery || window.Zepto;
  25649. if (Polymer && Polymer.dom) {
  25650. return Polymer.dom(el).cloneNode(true);
  25651. } else if ($) {
  25652. return $(el).clone(true)[0];
  25653. } else {
  25654. return el.cloneNode(true);
  25655. }
  25656. }
  25657. var expando = 'Sortable' + new Date().getTime();
  25658. function AnimationStateManager() {
  25659. var animationStates = [],
  25660. animationCallbackId;
  25661. return {
  25662. captureAnimationState: function captureAnimationState() {
  25663. animationStates = [];
  25664. if (!this.options.animation) return;
  25665. var children = [].slice.call(this.el.children);
  25666. children.forEach(function (child) {
  25667. if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
  25668. animationStates.push({
  25669. target: child,
  25670. rect: getRect(child)
  25671. });
  25672. var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation
  25673. if (child.thisAnimationDuration) {
  25674. var childMatrix = matrix(child, true);
  25675. if (childMatrix) {
  25676. fromRect.top -= childMatrix.f;
  25677. fromRect.left -= childMatrix.e;
  25678. }
  25679. }
  25680. child.fromRect = fromRect;
  25681. });
  25682. },
  25683. addAnimationState: function addAnimationState(state) {
  25684. animationStates.push(state);
  25685. },
  25686. removeAnimationState: function removeAnimationState(target) {
  25687. animationStates.splice(indexOfObject(animationStates, {
  25688. target: target
  25689. }), 1);
  25690. },
  25691. animateAll: function animateAll(callback) {
  25692. var _this = this;
  25693. if (!this.options.animation) {
  25694. clearTimeout(animationCallbackId);
  25695. if (typeof callback === 'function') callback();
  25696. return;
  25697. }
  25698. var animating = false,
  25699. animationTime = 0;
  25700. animationStates.forEach(function (state) {
  25701. var time = 0,
  25702. target = state.target,
  25703. fromRect = target.fromRect,
  25704. toRect = getRect(target),
  25705. prevFromRect = target.prevFromRect,
  25706. prevToRect = target.prevToRect,
  25707. animatingRect = state.rect,
  25708. targetMatrix = matrix(target, true);
  25709. if (targetMatrix) {
  25710. // Compensate for current animation
  25711. toRect.top -= targetMatrix.f;
  25712. toRect.left -= targetMatrix.e;
  25713. }
  25714. target.toRect = toRect;
  25715. if (target.thisAnimationDuration) {
  25716. // Could also check if animatingRect is between fromRect and toRect
  25717. if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect
  25718. (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
  25719. // If returning to same place as started from animation and on same axis
  25720. time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
  25721. }
  25722. } // if fromRect != toRect: animate
  25723. if (!isRectEqual(toRect, fromRect)) {
  25724. target.prevFromRect = fromRect;
  25725. target.prevToRect = toRect;
  25726. if (!time) {
  25727. time = _this.options.animation;
  25728. }
  25729. _this.animate(target, animatingRect, toRect, time);
  25730. }
  25731. if (time) {
  25732. animating = true;
  25733. animationTime = Math.max(animationTime, time);
  25734. clearTimeout(target.animationResetTimer);
  25735. target.animationResetTimer = setTimeout(function () {
  25736. target.animationTime = 0;
  25737. target.prevFromRect = null;
  25738. target.fromRect = null;
  25739. target.prevToRect = null;
  25740. target.thisAnimationDuration = null;
  25741. }, time);
  25742. target.thisAnimationDuration = time;
  25743. }
  25744. });
  25745. clearTimeout(animationCallbackId);
  25746. if (!animating) {
  25747. if (typeof callback === 'function') callback();
  25748. } else {
  25749. animationCallbackId = setTimeout(function () {
  25750. if (typeof callback === 'function') callback();
  25751. }, animationTime);
  25752. }
  25753. animationStates = [];
  25754. },
  25755. animate: function animate(target, currentRect, toRect, duration) {
  25756. if (duration) {
  25757. css(target, 'transition', '');
  25758. css(target, 'transform', '');
  25759. var elMatrix = matrix(this.el),
  25760. scaleX = elMatrix && elMatrix.a,
  25761. scaleY = elMatrix && elMatrix.d,
  25762. translateX = (currentRect.left - toRect.left) / (scaleX || 1),
  25763. translateY = (currentRect.top - toRect.top) / (scaleY || 1);
  25764. target.animatingX = !!translateX;
  25765. target.animatingY = !!translateY;
  25766. css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
  25767. this.forRepaintDummy = repaint(target); // repaint
  25768. css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
  25769. css(target, 'transform', 'translate3d(0,0,0)');
  25770. typeof target.animated === 'number' && clearTimeout(target.animated);
  25771. target.animated = setTimeout(function () {
  25772. css(target, 'transition', '');
  25773. css(target, 'transform', '');
  25774. target.animated = false;
  25775. target.animatingX = false;
  25776. target.animatingY = false;
  25777. }, duration);
  25778. }
  25779. }
  25780. };
  25781. }
  25782. function repaint(target) {
  25783. return target.offsetWidth;
  25784. }
  25785. function calculateRealTime(animatingRect, fromRect, toRect, options) {
  25786. return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
  25787. }
  25788. var plugins = [];
  25789. var defaults = {
  25790. initializeByDefault: true
  25791. };
  25792. var PluginManager = {
  25793. mount: function mount(plugin) {
  25794. // Set default static properties
  25795. for (var option in defaults) {
  25796. if (defaults.hasOwnProperty(option) && !(option in plugin)) {
  25797. plugin[option] = defaults[option];
  25798. }
  25799. }
  25800. plugins.forEach(function (p) {
  25801. if (p.pluginName === plugin.pluginName) {
  25802. throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
  25803. }
  25804. });
  25805. plugins.push(plugin);
  25806. },
  25807. pluginEvent: function pluginEvent(eventName, sortable, evt) {
  25808. var _this = this;
  25809. this.eventCanceled = false;
  25810. evt.cancel = function () {
  25811. _this.eventCanceled = true;
  25812. };
  25813. var eventNameGlobal = eventName + 'Global';
  25814. plugins.forEach(function (plugin) {
  25815. if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable
  25816. if (sortable[plugin.pluginName][eventNameGlobal]) {
  25817. sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
  25818. sortable: sortable
  25819. }, evt));
  25820. } // Only fire plugin event if plugin is enabled in this sortable,
  25821. // and plugin has event defined
  25822. if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
  25823. sortable[plugin.pluginName][eventName](_objectSpread2({
  25824. sortable: sortable
  25825. }, evt));
  25826. }
  25827. });
  25828. },
  25829. initializePlugins: function initializePlugins(sortable, el, defaults, options) {
  25830. plugins.forEach(function (plugin) {
  25831. var pluginName = plugin.pluginName;
  25832. if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
  25833. var initialized = new plugin(sortable, el, sortable.options);
  25834. initialized.sortable = sortable;
  25835. initialized.options = sortable.options;
  25836. sortable[pluginName] = initialized; // Add default options from plugin
  25837. _extends(defaults, initialized.defaults);
  25838. });
  25839. for (var option in sortable.options) {
  25840. if (!sortable.options.hasOwnProperty(option)) continue;
  25841. var modified = this.modifyOption(sortable, option, sortable.options[option]);
  25842. if (typeof modified !== 'undefined') {
  25843. sortable.options[option] = modified;
  25844. }
  25845. }
  25846. },
  25847. getEventProperties: function getEventProperties(name, sortable) {
  25848. var eventProperties = {};
  25849. plugins.forEach(function (plugin) {
  25850. if (typeof plugin.eventProperties !== 'function') return;
  25851. _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
  25852. });
  25853. return eventProperties;
  25854. },
  25855. modifyOption: function modifyOption(sortable, name, value) {
  25856. var modifiedValue;
  25857. plugins.forEach(function (plugin) {
  25858. // Plugin must exist on the Sortable
  25859. if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
  25860. if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
  25861. modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
  25862. }
  25863. });
  25864. return modifiedValue;
  25865. }
  25866. };
  25867. function dispatchEvent(_ref) {
  25868. var sortable = _ref.sortable,
  25869. rootEl = _ref.rootEl,
  25870. name = _ref.name,
  25871. targetEl = _ref.targetEl,
  25872. cloneEl = _ref.cloneEl,
  25873. toEl = _ref.toEl,
  25874. fromEl = _ref.fromEl,
  25875. oldIndex = _ref.oldIndex,
  25876. newIndex = _ref.newIndex,
  25877. oldDraggableIndex = _ref.oldDraggableIndex,
  25878. newDraggableIndex = _ref.newDraggableIndex,
  25879. originalEvent = _ref.originalEvent,
  25880. putSortable = _ref.putSortable,
  25881. extraEventProperties = _ref.extraEventProperties;
  25882. sortable = sortable || rootEl && rootEl[expando];
  25883. if (!sortable) return;
  25884. var evt,
  25885. options = sortable.options,
  25886. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature
  25887. if (window.CustomEvent && !IE11OrLess && !Edge) {
  25888. evt = new CustomEvent(name, {
  25889. bubbles: true,
  25890. cancelable: true
  25891. });
  25892. } else {
  25893. evt = document.createEvent('Event');
  25894. evt.initEvent(name, true, true);
  25895. }
  25896. evt.to = toEl || rootEl;
  25897. evt.from = fromEl || rootEl;
  25898. evt.item = targetEl || rootEl;
  25899. evt.clone = cloneEl;
  25900. evt.oldIndex = oldIndex;
  25901. evt.newIndex = newIndex;
  25902. evt.oldDraggableIndex = oldDraggableIndex;
  25903. evt.newDraggableIndex = newDraggableIndex;
  25904. evt.originalEvent = originalEvent;
  25905. evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
  25906. var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
  25907. for (var option in allEventProperties) {
  25908. evt[option] = allEventProperties[option];
  25909. }
  25910. if (rootEl) {
  25911. rootEl.dispatchEvent(evt);
  25912. }
  25913. if (options[onName]) {
  25914. options[onName].call(sortable, evt);
  25915. }
  25916. }
  25917. var _excluded = ["evt"];
  25918. var pluginEvent = function pluginEvent(eventName, sortable) {
  25919. var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  25920. originalEvent = _ref.evt,
  25921. data = _objectWithoutProperties(_ref, _excluded);
  25922. PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
  25923. dragEl: dragEl,
  25924. parentEl: parentEl,
  25925. ghostEl: ghostEl,
  25926. rootEl: rootEl,
  25927. nextEl: nextEl,
  25928. lastDownEl: lastDownEl,
  25929. cloneEl: cloneEl,
  25930. cloneHidden: cloneHidden,
  25931. dragStarted: moved,
  25932. putSortable: putSortable,
  25933. activeSortable: Sortable.active,
  25934. originalEvent: originalEvent,
  25935. oldIndex: oldIndex,
  25936. oldDraggableIndex: oldDraggableIndex,
  25937. newIndex: newIndex,
  25938. newDraggableIndex: newDraggableIndex,
  25939. hideGhostForTarget: _hideGhostForTarget,
  25940. unhideGhostForTarget: _unhideGhostForTarget,
  25941. cloneNowHidden: function cloneNowHidden() {
  25942. cloneHidden = true;
  25943. },
  25944. cloneNowShown: function cloneNowShown() {
  25945. cloneHidden = false;
  25946. },
  25947. dispatchSortableEvent: function dispatchSortableEvent(name) {
  25948. _dispatchEvent({
  25949. sortable: sortable,
  25950. name: name,
  25951. originalEvent: originalEvent
  25952. });
  25953. }
  25954. }, data));
  25955. };
  25956. function _dispatchEvent(info) {
  25957. dispatchEvent(_objectSpread2({
  25958. putSortable: putSortable,
  25959. cloneEl: cloneEl,
  25960. targetEl: dragEl,
  25961. rootEl: rootEl,
  25962. oldIndex: oldIndex,
  25963. oldDraggableIndex: oldDraggableIndex,
  25964. newIndex: newIndex,
  25965. newDraggableIndex: newDraggableIndex
  25966. }, info));
  25967. }
  25968. var dragEl,
  25969. parentEl,
  25970. ghostEl,
  25971. rootEl,
  25972. nextEl,
  25973. lastDownEl,
  25974. cloneEl,
  25975. cloneHidden,
  25976. oldIndex,
  25977. newIndex,
  25978. oldDraggableIndex,
  25979. newDraggableIndex,
  25980. activeGroup,
  25981. putSortable,
  25982. awaitingDragStarted = false,
  25983. ignoreNextClick = false,
  25984. sortables = [],
  25985. tapEvt,
  25986. touchEvt,
  25987. lastDx,
  25988. lastDy,
  25989. tapDistanceLeft,
  25990. tapDistanceTop,
  25991. moved,
  25992. lastTarget,
  25993. lastDirection,
  25994. pastFirstInvertThresh = false,
  25995. isCircumstantialInvert = false,
  25996. targetMoveDistance,
  25997. // For positioning ghost absolutely
  25998. ghostRelativeParent,
  25999. ghostRelativeParentInitialScroll = [],
  26000. // (left, top)
  26001. _silent = false,
  26002. savedInputChecked = [];
  26003. /** @const */
  26004. var documentExists = typeof document !== 'undefined',
  26005. PositionGhostAbsolutely = IOS,
  26006. CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
  26007. // This will not pass for IE9, because IE9 DnD only works on anchors
  26008. supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
  26009. supportCssPointerEvents = function () {
  26010. if (!documentExists) return; // false when <= IE11
  26011. if (IE11OrLess) {
  26012. return false;
  26013. }
  26014. var el = document.createElement('x');
  26015. el.style.cssText = 'pointer-events:auto';
  26016. return el.style.pointerEvents === 'auto';
  26017. }(),
  26018. _detectDirection = function _detectDirection(el, options) {
  26019. var elCSS = css(el),
  26020. elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
  26021. child1 = getChild(el, 0, options),
  26022. child2 = getChild(el, 1, options),
  26023. firstChildCSS = child1 && css(child1),
  26024. secondChildCSS = child2 && css(child2),
  26025. firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
  26026. secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
  26027. if (elCSS.display === 'flex') {
  26028. return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
  26029. }
  26030. if (elCSS.display === 'grid') {
  26031. return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
  26032. }
  26033. if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
  26034. var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
  26035. return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
  26036. }
  26037. return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
  26038. },
  26039. _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
  26040. var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
  26041. dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
  26042. dragElOppLength = vertical ? dragRect.width : dragRect.height,
  26043. targetS1Opp = vertical ? targetRect.left : targetRect.top,
  26044. targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
  26045. targetOppLength = vertical ? targetRect.width : targetRect.height;
  26046. return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
  26047. },
  26048. /**
  26049. * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
  26050. * @param {Number} x X position
  26051. * @param {Number} y Y position
  26052. * @return {HTMLElement} Element of the first found nearest Sortable
  26053. */
  26054. _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
  26055. var ret;
  26056. sortables.some(function (sortable) {
  26057. var threshold = sortable[expando].options.emptyInsertThreshold;
  26058. if (!threshold || lastChild(sortable)) return;
  26059. var rect = getRect(sortable),
  26060. insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
  26061. insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
  26062. if (insideHorizontally && insideVertically) {
  26063. return ret = sortable;
  26064. }
  26065. });
  26066. return ret;
  26067. },
  26068. _prepareGroup = function _prepareGroup(options) {
  26069. function toFn(value, pull) {
  26070. return function (to, from, dragEl, evt) {
  26071. var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
  26072. if (value == null && (pull || sameGroup)) {
  26073. // Default pull value
  26074. // Default pull and put value if same group
  26075. return true;
  26076. } else if (value == null || value === false) {
  26077. return false;
  26078. } else if (pull && value === 'clone') {
  26079. return value;
  26080. } else if (typeof value === 'function') {
  26081. return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
  26082. } else {
  26083. var otherGroup = (pull ? to : from).options.group.name;
  26084. return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
  26085. }
  26086. };
  26087. }
  26088. var group = {};
  26089. var originalGroup = options.group;
  26090. if (!originalGroup || _typeof(originalGroup) != 'object') {
  26091. originalGroup = {
  26092. name: originalGroup
  26093. };
  26094. }
  26095. group.name = originalGroup.name;
  26096. group.checkPull = toFn(originalGroup.pull, true);
  26097. group.checkPut = toFn(originalGroup.put);
  26098. group.revertClone = originalGroup.revertClone;
  26099. options.group = group;
  26100. },
  26101. _hideGhostForTarget = function _hideGhostForTarget() {
  26102. if (!supportCssPointerEvents && ghostEl) {
  26103. css(ghostEl, 'display', 'none');
  26104. }
  26105. },
  26106. _unhideGhostForTarget = function _unhideGhostForTarget() {
  26107. if (!supportCssPointerEvents && ghostEl) {
  26108. css(ghostEl, 'display', '');
  26109. }
  26110. }; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
  26111. if (documentExists && !ChromeForAndroid) {
  26112. document.addEventListener('click', function (evt) {
  26113. if (ignoreNextClick) {
  26114. evt.preventDefault();
  26115. evt.stopPropagation && evt.stopPropagation();
  26116. evt.stopImmediatePropagation && evt.stopImmediatePropagation();
  26117. ignoreNextClick = false;
  26118. return false;
  26119. }
  26120. }, true);
  26121. }
  26122. var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
  26123. if (dragEl) {
  26124. evt = evt.touches ? evt.touches[0] : evt;
  26125. var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
  26126. if (nearest) {
  26127. // Create imitation event
  26128. var event = {};
  26129. for (var i in evt) {
  26130. if (evt.hasOwnProperty(i)) {
  26131. event[i] = evt[i];
  26132. }
  26133. }
  26134. event.target = event.rootEl = nearest;
  26135. event.preventDefault = void 0;
  26136. event.stopPropagation = void 0;
  26137. nearest[expando]._onDragOver(event);
  26138. }
  26139. }
  26140. };
  26141. var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
  26142. if (dragEl) {
  26143. dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
  26144. }
  26145. };
  26146. /**
  26147. * @class Sortable
  26148. * @param {HTMLElement} el
  26149. * @param {Object} [options]
  26150. */
  26151. function Sortable(el, options) {
  26152. if (!(el && el.nodeType && el.nodeType === 1)) {
  26153. throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
  26154. }
  26155. this.el = el; // root element
  26156. this.options = options = _extends({}, options); // Export instance
  26157. el[expando] = this;
  26158. var defaults = {
  26159. group: null,
  26160. sort: true,
  26161. disabled: false,
  26162. store: null,
  26163. handle: null,
  26164. draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
  26165. swapThreshold: 1,
  26166. // percentage; 0 <= x <= 1
  26167. invertSwap: false,
  26168. // invert always
  26169. invertedSwapThreshold: null,
  26170. // will be set to same as swapThreshold if default
  26171. removeCloneOnHide: true,
  26172. direction: function direction() {
  26173. return _detectDirection(el, this.options);
  26174. },
  26175. ghostClass: 'sortable-ghost',
  26176. chosenClass: 'sortable-chosen',
  26177. dragClass: 'sortable-drag',
  26178. ignore: 'a, img',
  26179. filter: null,
  26180. preventOnFilter: true,
  26181. animation: 0,
  26182. easing: null,
  26183. setData: function setData(dataTransfer, dragEl) {
  26184. dataTransfer.setData('Text', dragEl.textContent);
  26185. },
  26186. dropBubble: false,
  26187. dragoverBubble: false,
  26188. dataIdAttr: 'data-id',
  26189. delay: 0,
  26190. delayOnTouchOnly: false,
  26191. touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
  26192. forceFallback: false,
  26193. fallbackClass: 'sortable-fallback',
  26194. fallbackOnBody: false,
  26195. fallbackTolerance: 0,
  26196. fallbackOffset: {
  26197. x: 0,
  26198. y: 0
  26199. },
  26200. supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
  26201. emptyInsertThreshold: 5
  26202. };
  26203. PluginManager.initializePlugins(this, el, defaults); // Set default options
  26204. for (var name in defaults) {
  26205. !(name in options) && (options[name] = defaults[name]);
  26206. }
  26207. _prepareGroup(options); // Bind all private methods
  26208. for (var fn in this) {
  26209. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  26210. this[fn] = this[fn].bind(this);
  26211. }
  26212. } // Setup drag mode
  26213. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  26214. if (this.nativeDraggable) {
  26215. // Touch start threshold cannot be greater than the native dragstart threshold
  26216. this.options.touchStartThreshold = 1;
  26217. } // Bind events
  26218. if (options.supportPointer) {
  26219. on(el, 'pointerdown', this._onTapStart);
  26220. } else {
  26221. on(el, 'mousedown', this._onTapStart);
  26222. on(el, 'touchstart', this._onTapStart);
  26223. }
  26224. if (this.nativeDraggable) {
  26225. on(el, 'dragover', this);
  26226. on(el, 'dragenter', this);
  26227. }
  26228. sortables.push(this.el); // Restore sorting
  26229. options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager
  26230. _extends(this, AnimationStateManager());
  26231. }
  26232. Sortable.prototype =
  26233. /** @lends Sortable.prototype */
  26234. {
  26235. constructor: Sortable,
  26236. _isOutsideThisEl: function _isOutsideThisEl(target) {
  26237. if (!this.el.contains(target) && target !== this.el) {
  26238. lastTarget = null;
  26239. }
  26240. },
  26241. _getDirection: function _getDirection(evt, target) {
  26242. return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
  26243. },
  26244. _onTapStart: function _onTapStart(
  26245. /** Event|TouchEvent */
  26246. evt) {
  26247. if (!evt.cancelable) return;
  26248. var _this = this,
  26249. el = this.el,
  26250. options = this.options,
  26251. preventOnFilter = options.preventOnFilter,
  26252. type = evt.type,
  26253. touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
  26254. target = (touch || evt).target,
  26255. originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
  26256. filter = options.filter;
  26257. _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  26258. if (dragEl) {
  26259. return;
  26260. }
  26261. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  26262. return; // only left button and enabled
  26263. } // cancel dnd if original target is content editable
  26264. if (originalTarget.isContentEditable) {
  26265. return;
  26266. } // Safari ignores further event handling after mousedown
  26267. if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
  26268. return;
  26269. }
  26270. target = closest(target, options.draggable, el, false);
  26271. if (target && target.animated) {
  26272. return;
  26273. }
  26274. if (lastDownEl === target) {
  26275. // Ignoring duplicate `down`
  26276. return;
  26277. } // Get the index of the dragged element within its parent
  26278. oldIndex = index(target);
  26279. oldDraggableIndex = index(target, options.draggable); // Check filter
  26280. if (typeof filter === 'function') {
  26281. if (filter.call(this, evt, target, this)) {
  26282. _dispatchEvent({
  26283. sortable: _this,
  26284. rootEl: originalTarget,
  26285. name: 'filter',
  26286. targetEl: target,
  26287. toEl: el,
  26288. fromEl: el
  26289. });
  26290. pluginEvent('filter', _this, {
  26291. evt: evt
  26292. });
  26293. preventOnFilter && evt.cancelable && evt.preventDefault();
  26294. return; // cancel dnd
  26295. }
  26296. } else if (filter) {
  26297. filter = filter.split(',').some(function (criteria) {
  26298. criteria = closest(originalTarget, criteria.trim(), el, false);
  26299. if (criteria) {
  26300. _dispatchEvent({
  26301. sortable: _this,
  26302. rootEl: criteria,
  26303. name: 'filter',
  26304. targetEl: target,
  26305. fromEl: el,
  26306. toEl: el
  26307. });
  26308. pluginEvent('filter', _this, {
  26309. evt: evt
  26310. });
  26311. return true;
  26312. }
  26313. });
  26314. if (filter) {
  26315. preventOnFilter && evt.cancelable && evt.preventDefault();
  26316. return; // cancel dnd
  26317. }
  26318. }
  26319. if (options.handle && !closest(originalTarget, options.handle, el, false)) {
  26320. return;
  26321. } // Prepare `dragstart`
  26322. this._prepareDragStart(evt, touch, target);
  26323. },
  26324. _prepareDragStart: function _prepareDragStart(
  26325. /** Event */
  26326. evt,
  26327. /** Touch */
  26328. touch,
  26329. /** HTMLElement */
  26330. target) {
  26331. var _this = this,
  26332. el = _this.el,
  26333. options = _this.options,
  26334. ownerDocument = el.ownerDocument,
  26335. dragStartFn;
  26336. if (target && !dragEl && target.parentNode === el) {
  26337. var dragRect = getRect(target);
  26338. rootEl = el;
  26339. dragEl = target;
  26340. parentEl = dragEl.parentNode;
  26341. nextEl = dragEl.nextSibling;
  26342. lastDownEl = target;
  26343. activeGroup = options.group;
  26344. Sortable.dragged = dragEl;
  26345. tapEvt = {
  26346. target: dragEl,
  26347. clientX: (touch || evt).clientX,
  26348. clientY: (touch || evt).clientY
  26349. };
  26350. tapDistanceLeft = tapEvt.clientX - dragRect.left;
  26351. tapDistanceTop = tapEvt.clientY - dragRect.top;
  26352. this._lastX = (touch || evt).clientX;
  26353. this._lastY = (touch || evt).clientY;
  26354. dragEl.style['will-change'] = 'all';
  26355. dragStartFn = function dragStartFn() {
  26356. pluginEvent('delayEnded', _this, {
  26357. evt: evt
  26358. });
  26359. if (Sortable.eventCanceled) {
  26360. _this._onDrop();
  26361. return;
  26362. } // Delayed drag has been triggered
  26363. // we can re-enable the events: touchmove/mousemove
  26364. _this._disableDelayedDragEvents();
  26365. if (!FireFox && _this.nativeDraggable) {
  26366. dragEl.draggable = true;
  26367. } // Bind the events: dragstart/dragend
  26368. _this._triggerDragStart(evt, touch); // Drag start event
  26369. _dispatchEvent({
  26370. sortable: _this,
  26371. name: 'choose',
  26372. originalEvent: evt
  26373. }); // Chosen item
  26374. toggleClass(dragEl, options.chosenClass, true);
  26375. }; // Disable "draggable"
  26376. options.ignore.split(',').forEach(function (criteria) {
  26377. find(dragEl, criteria.trim(), _disableDraggable);
  26378. });
  26379. on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
  26380. on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
  26381. on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
  26382. on(ownerDocument, 'mouseup', _this._onDrop);
  26383. on(ownerDocument, 'touchend', _this._onDrop);
  26384. on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
  26385. if (FireFox && this.nativeDraggable) {
  26386. this.options.touchStartThreshold = 4;
  26387. dragEl.draggable = true;
  26388. }
  26389. pluginEvent('delayStart', this, {
  26390. evt: evt
  26391. }); // Delay is impossible for native DnD in Edge or IE
  26392. if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
  26393. if (Sortable.eventCanceled) {
  26394. this._onDrop();
  26395. return;
  26396. } // If the user moves the pointer or let go the click or touch
  26397. // before the delay has been reached:
  26398. // disable the delayed drag
  26399. on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  26400. on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  26401. on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  26402. on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
  26403. on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
  26404. options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
  26405. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  26406. } else {
  26407. dragStartFn();
  26408. }
  26409. }
  26410. },
  26411. _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
  26412. /** TouchEvent|PointerEvent **/
  26413. e) {
  26414. var touch = e.touches ? e.touches[0] : e;
  26415. if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
  26416. this._disableDelayedDrag();
  26417. }
  26418. },
  26419. _disableDelayedDrag: function _disableDelayedDrag() {
  26420. dragEl && _disableDraggable(dragEl);
  26421. clearTimeout(this._dragStartTimer);
  26422. this._disableDelayedDragEvents();
  26423. },
  26424. _disableDelayedDragEvents: function _disableDelayedDragEvents() {
  26425. var ownerDocument = this.el.ownerDocument;
  26426. off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  26427. off(ownerDocument, 'touchend', this._disableDelayedDrag);
  26428. off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  26429. off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
  26430. off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
  26431. off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
  26432. },
  26433. _triggerDragStart: function _triggerDragStart(
  26434. /** Event */
  26435. evt,
  26436. /** Touch */
  26437. touch) {
  26438. touch = touch || evt.pointerType == 'touch' && evt;
  26439. if (!this.nativeDraggable || touch) {
  26440. if (this.options.supportPointer) {
  26441. on(document, 'pointermove', this._onTouchMove);
  26442. } else if (touch) {
  26443. on(document, 'touchmove', this._onTouchMove);
  26444. } else {
  26445. on(document, 'mousemove', this._onTouchMove);
  26446. }
  26447. } else {
  26448. on(dragEl, 'dragend', this);
  26449. on(rootEl, 'dragstart', this._onDragStart);
  26450. }
  26451. try {
  26452. if (document.selection) {
  26453. // Timeout neccessary for IE9
  26454. _nextTick(function () {
  26455. document.selection.empty();
  26456. });
  26457. } else {
  26458. window.getSelection().removeAllRanges();
  26459. }
  26460. } catch (err) {}
  26461. },
  26462. _dragStarted: function _dragStarted(fallback, evt) {
  26463. awaitingDragStarted = false;
  26464. if (rootEl && dragEl) {
  26465. pluginEvent('dragStarted', this, {
  26466. evt: evt
  26467. });
  26468. if (this.nativeDraggable) {
  26469. on(document, 'dragover', _checkOutsideTargetEl);
  26470. }
  26471. var options = this.options; // Apply effect
  26472. !fallback && toggleClass(dragEl, options.dragClass, false);
  26473. toggleClass(dragEl, options.ghostClass, true);
  26474. Sortable.active = this;
  26475. fallback && this._appendGhost(); // Drag start event
  26476. _dispatchEvent({
  26477. sortable: this,
  26478. name: 'start',
  26479. originalEvent: evt
  26480. });
  26481. } else {
  26482. this._nulling();
  26483. }
  26484. },
  26485. _emulateDragOver: function _emulateDragOver() {
  26486. if (touchEvt) {
  26487. this._lastX = touchEvt.clientX;
  26488. this._lastY = touchEvt.clientY;
  26489. _hideGhostForTarget();
  26490. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
  26491. var parent = target;
  26492. while (target && target.shadowRoot) {
  26493. target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
  26494. if (target === parent) break;
  26495. parent = target;
  26496. }
  26497. dragEl.parentNode[expando]._isOutsideThisEl(target);
  26498. if (parent) {
  26499. do {
  26500. if (parent[expando]) {
  26501. var inserted = void 0;
  26502. inserted = parent[expando]._onDragOver({
  26503. clientX: touchEvt.clientX,
  26504. clientY: touchEvt.clientY,
  26505. target: target,
  26506. rootEl: parent
  26507. });
  26508. if (inserted && !this.options.dragoverBubble) {
  26509. break;
  26510. }
  26511. }
  26512. target = parent; // store last element
  26513. }
  26514. /* jshint boss:true */
  26515. while (parent = parent.parentNode);
  26516. }
  26517. _unhideGhostForTarget();
  26518. }
  26519. },
  26520. _onTouchMove: function _onTouchMove(
  26521. /**TouchEvent*/
  26522. evt) {
  26523. if (tapEvt) {
  26524. var options = this.options,
  26525. fallbackTolerance = options.fallbackTolerance,
  26526. fallbackOffset = options.fallbackOffset,
  26527. touch = evt.touches ? evt.touches[0] : evt,
  26528. ghostMatrix = ghostEl && matrix(ghostEl, true),
  26529. scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
  26530. scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
  26531. relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
  26532. dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
  26533. dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging
  26534. if (!Sortable.active && !awaitingDragStarted) {
  26535. if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  26536. return;
  26537. }
  26538. this._onDragStart(evt, true);
  26539. }
  26540. if (ghostEl) {
  26541. if (ghostMatrix) {
  26542. ghostMatrix.e += dx - (lastDx || 0);
  26543. ghostMatrix.f += dy - (lastDy || 0);
  26544. } else {
  26545. ghostMatrix = {
  26546. a: 1,
  26547. b: 0,
  26548. c: 0,
  26549. d: 1,
  26550. e: dx,
  26551. f: dy
  26552. };
  26553. }
  26554. var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
  26555. css(ghostEl, 'webkitTransform', cssMatrix);
  26556. css(ghostEl, 'mozTransform', cssMatrix);
  26557. css(ghostEl, 'msTransform', cssMatrix);
  26558. css(ghostEl, 'transform', cssMatrix);
  26559. lastDx = dx;
  26560. lastDy = dy;
  26561. touchEvt = touch;
  26562. }
  26563. evt.cancelable && evt.preventDefault();
  26564. }
  26565. },
  26566. _appendGhost: function _appendGhost() {
  26567. // Bug if using scale(): https://stackoverflow.com/questions/2637058
  26568. // Not being adjusted for
  26569. if (!ghostEl) {
  26570. var container = this.options.fallbackOnBody ? document.body : rootEl,
  26571. rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
  26572. options = this.options; // Position absolutely
  26573. if (PositionGhostAbsolutely) {
  26574. // Get relatively positioned parent
  26575. ghostRelativeParent = container;
  26576. while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
  26577. ghostRelativeParent = ghostRelativeParent.parentNode;
  26578. }
  26579. if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
  26580. if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
  26581. rect.top += ghostRelativeParent.scrollTop;
  26582. rect.left += ghostRelativeParent.scrollLeft;
  26583. } else {
  26584. ghostRelativeParent = getWindowScrollingElement();
  26585. }
  26586. ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
  26587. }
  26588. ghostEl = dragEl.cloneNode(true);
  26589. toggleClass(ghostEl, options.ghostClass, false);
  26590. toggleClass(ghostEl, options.fallbackClass, true);
  26591. toggleClass(ghostEl, options.dragClass, true);
  26592. css(ghostEl, 'transition', '');
  26593. css(ghostEl, 'transform', '');
  26594. css(ghostEl, 'box-sizing', 'border-box');
  26595. css(ghostEl, 'margin', 0);
  26596. css(ghostEl, 'top', rect.top);
  26597. css(ghostEl, 'left', rect.left);
  26598. css(ghostEl, 'width', rect.width);
  26599. css(ghostEl, 'height', rect.height);
  26600. css(ghostEl, 'opacity', '0.8');
  26601. css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
  26602. css(ghostEl, 'zIndex', '100000');
  26603. css(ghostEl, 'pointerEvents', 'none');
  26604. Sortable.ghost = ghostEl;
  26605. container.appendChild(ghostEl); // Set transform-origin
  26606. css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
  26607. }
  26608. },
  26609. _onDragStart: function _onDragStart(
  26610. /**Event*/
  26611. evt,
  26612. /**boolean*/
  26613. fallback) {
  26614. var _this = this;
  26615. var dataTransfer = evt.dataTransfer;
  26616. var options = _this.options;
  26617. pluginEvent('dragStart', this, {
  26618. evt: evt
  26619. });
  26620. if (Sortable.eventCanceled) {
  26621. this._onDrop();
  26622. return;
  26623. }
  26624. pluginEvent('setupClone', this);
  26625. if (!Sortable.eventCanceled) {
  26626. cloneEl = clone(dragEl);
  26627. cloneEl.removeAttribute("id");
  26628. cloneEl.draggable = false;
  26629. cloneEl.style['will-change'] = '';
  26630. this._hideClone();
  26631. toggleClass(cloneEl, this.options.chosenClass, false);
  26632. Sortable.clone = cloneEl;
  26633. } // #1143: IFrame support workaround
  26634. _this.cloneId = _nextTick(function () {
  26635. pluginEvent('clone', _this);
  26636. if (Sortable.eventCanceled) return;
  26637. if (!_this.options.removeCloneOnHide) {
  26638. rootEl.insertBefore(cloneEl, dragEl);
  26639. }
  26640. _this._hideClone();
  26641. _dispatchEvent({
  26642. sortable: _this,
  26643. name: 'clone'
  26644. });
  26645. });
  26646. !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events
  26647. if (fallback) {
  26648. ignoreNextClick = true;
  26649. _this._loopId = setInterval(_this._emulateDragOver, 50);
  26650. } else {
  26651. // Undo what was set in _prepareDragStart before drag started
  26652. off(document, 'mouseup', _this._onDrop);
  26653. off(document, 'touchend', _this._onDrop);
  26654. off(document, 'touchcancel', _this._onDrop);
  26655. if (dataTransfer) {
  26656. dataTransfer.effectAllowed = 'move';
  26657. options.setData && options.setData.call(_this, dataTransfer, dragEl);
  26658. }
  26659. on(document, 'drop', _this); // #1276 fix:
  26660. css(dragEl, 'transform', 'translateZ(0)');
  26661. }
  26662. awaitingDragStarted = true;
  26663. _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
  26664. on(document, 'selectstart', _this);
  26665. moved = true;
  26666. if (Safari) {
  26667. css(document.body, 'user-select', 'none');
  26668. }
  26669. },
  26670. // Returns true - if no further action is needed (either inserted or another condition)
  26671. _onDragOver: function _onDragOver(
  26672. /**Event*/
  26673. evt) {
  26674. var el = this.el,
  26675. target = evt.target,
  26676. dragRect,
  26677. targetRect,
  26678. revert,
  26679. options = this.options,
  26680. group = options.group,
  26681. activeSortable = Sortable.active,
  26682. isOwner = activeGroup === group,
  26683. canSort = options.sort,
  26684. fromSortable = putSortable || activeSortable,
  26685. vertical,
  26686. _this = this,
  26687. completedFired = false;
  26688. if (_silent) return;
  26689. function dragOverEvent(name, extra) {
  26690. pluginEvent(name, _this, _objectSpread2({
  26691. evt: evt,
  26692. isOwner: isOwner,
  26693. axis: vertical ? 'vertical' : 'horizontal',
  26694. revert: revert,
  26695. dragRect: dragRect,
  26696. targetRect: targetRect,
  26697. canSort: canSort,
  26698. fromSortable: fromSortable,
  26699. target: target,
  26700. completed: completed,
  26701. onMove: function onMove(target, after) {
  26702. return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
  26703. },
  26704. changed: changed
  26705. }, extra));
  26706. } // Capture animation state
  26707. function capture() {
  26708. dragOverEvent('dragOverAnimationCapture');
  26709. _this.captureAnimationState();
  26710. if (_this !== fromSortable) {
  26711. fromSortable.captureAnimationState();
  26712. }
  26713. } // Return invocation when dragEl is inserted (or completed)
  26714. function completed(insertion) {
  26715. dragOverEvent('dragOverCompleted', {
  26716. insertion: insertion
  26717. });
  26718. if (insertion) {
  26719. // Clones must be hidden before folding animation to capture dragRectAbsolute properly
  26720. if (isOwner) {
  26721. activeSortable._hideClone();
  26722. } else {
  26723. activeSortable._showClone(_this);
  26724. }
  26725. if (_this !== fromSortable) {
  26726. // Set ghost class to new sortable's ghost class
  26727. toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
  26728. toggleClass(dragEl, options.ghostClass, true);
  26729. }
  26730. if (putSortable !== _this && _this !== Sortable.active) {
  26731. putSortable = _this;
  26732. } else if (_this === Sortable.active && putSortable) {
  26733. putSortable = null;
  26734. } // Animation
  26735. if (fromSortable === _this) {
  26736. _this._ignoreWhileAnimating = target;
  26737. }
  26738. _this.animateAll(function () {
  26739. dragOverEvent('dragOverAnimationComplete');
  26740. _this._ignoreWhileAnimating = null;
  26741. });
  26742. if (_this !== fromSortable) {
  26743. fromSortable.animateAll();
  26744. fromSortable._ignoreWhileAnimating = null;
  26745. }
  26746. } // Null lastTarget if it is not inside a previously swapped element
  26747. if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
  26748. lastTarget = null;
  26749. } // no bubbling and not fallback
  26750. if (!options.dragoverBubble && !evt.rootEl && target !== document) {
  26751. dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted
  26752. !insertion && nearestEmptyInsertDetectEvent(evt);
  26753. }
  26754. !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
  26755. return completedFired = true;
  26756. } // Call when dragEl has been inserted
  26757. function changed() {
  26758. newIndex = index(dragEl);
  26759. newDraggableIndex = index(dragEl, options.draggable);
  26760. _dispatchEvent({
  26761. sortable: _this,
  26762. name: 'change',
  26763. toEl: el,
  26764. newIndex: newIndex,
  26765. newDraggableIndex: newDraggableIndex,
  26766. originalEvent: evt
  26767. });
  26768. }
  26769. if (evt.preventDefault !== void 0) {
  26770. evt.cancelable && evt.preventDefault();
  26771. }
  26772. target = closest(target, options.draggable, el, true);
  26773. dragOverEvent('dragOver');
  26774. if (Sortable.eventCanceled) return completedFired;
  26775. if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
  26776. return completed(false);
  26777. }
  26778. ignoreNextClick = false;
  26779. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
  26780. : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
  26781. vertical = this._getDirection(evt, target) === 'vertical';
  26782. dragRect = getRect(dragEl);
  26783. dragOverEvent('dragOverValid');
  26784. if (Sortable.eventCanceled) return completedFired;
  26785. if (revert) {
  26786. parentEl = rootEl; // actualization
  26787. capture();
  26788. this._hideClone();
  26789. dragOverEvent('revert');
  26790. if (!Sortable.eventCanceled) {
  26791. if (nextEl) {
  26792. rootEl.insertBefore(dragEl, nextEl);
  26793. } else {
  26794. rootEl.appendChild(dragEl);
  26795. }
  26796. }
  26797. return completed(true);
  26798. }
  26799. var elLastChild = lastChild(el, options.draggable);
  26800. if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
  26801. // Insert to end of list
  26802. // If already at end of list: Do not insert
  26803. if (elLastChild === dragEl) {
  26804. return completed(false);
  26805. } // if there is a last element, it is the target
  26806. if (elLastChild && el === evt.target) {
  26807. target = elLastChild;
  26808. }
  26809. if (target) {
  26810. targetRect = getRect(target);
  26811. }
  26812. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
  26813. capture();
  26814. if (elLastChild && elLastChild.nextSibling) {
  26815. // the last draggable element is not the last node
  26816. el.insertBefore(dragEl, elLastChild.nextSibling);
  26817. } else {
  26818. el.appendChild(dragEl);
  26819. }
  26820. parentEl = el; // actualization
  26821. changed();
  26822. return completed(true);
  26823. }
  26824. } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
  26825. // Insert to start of list
  26826. var firstChild = getChild(el, 0, options, true);
  26827. if (firstChild === dragEl) {
  26828. return completed(false);
  26829. }
  26830. target = firstChild;
  26831. targetRect = getRect(target);
  26832. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
  26833. capture();
  26834. el.insertBefore(dragEl, firstChild);
  26835. parentEl = el; // actualization
  26836. changed();
  26837. return completed(true);
  26838. }
  26839. } else if (target.parentNode === el) {
  26840. targetRect = getRect(target);
  26841. var direction = 0,
  26842. targetBeforeFirstSwap,
  26843. differentLevel = dragEl.parentNode !== el,
  26844. differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
  26845. side1 = vertical ? 'top' : 'left',
  26846. scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
  26847. scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
  26848. if (lastTarget !== target) {
  26849. targetBeforeFirstSwap = targetRect[side1];
  26850. pastFirstInvertThresh = false;
  26851. isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
  26852. }
  26853. direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
  26854. var sibling;
  26855. if (direction !== 0) {
  26856. // Check if target is beside dragEl in respective direction (ignoring hidden elements)
  26857. var dragIndex = index(dragEl);
  26858. do {
  26859. dragIndex -= direction;
  26860. sibling = parentEl.children[dragIndex];
  26861. } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
  26862. } // If dragEl is already beside target: Do not insert
  26863. if (direction === 0 || sibling === target) {
  26864. return completed(false);
  26865. }
  26866. lastTarget = target;
  26867. lastDirection = direction;
  26868. var nextSibling = target.nextElementSibling,
  26869. after = false;
  26870. after = direction === 1;
  26871. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  26872. if (moveVector !== false) {
  26873. if (moveVector === 1 || moveVector === -1) {
  26874. after = moveVector === 1;
  26875. }
  26876. _silent = true;
  26877. setTimeout(_unsilent, 30);
  26878. capture();
  26879. if (after && !nextSibling) {
  26880. el.appendChild(dragEl);
  26881. } else {
  26882. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  26883. } // Undo chrome's scroll adjustment (has no effect on other browsers)
  26884. if (scrolledPastTop) {
  26885. scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
  26886. }
  26887. parentEl = dragEl.parentNode; // actualization
  26888. // must be done before animation
  26889. if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
  26890. targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
  26891. }
  26892. changed();
  26893. return completed(true);
  26894. }
  26895. }
  26896. if (el.contains(dragEl)) {
  26897. return completed(false);
  26898. }
  26899. }
  26900. return false;
  26901. },
  26902. _ignoreWhileAnimating: null,
  26903. _offMoveEvents: function _offMoveEvents() {
  26904. off(document, 'mousemove', this._onTouchMove);
  26905. off(document, 'touchmove', this._onTouchMove);
  26906. off(document, 'pointermove', this._onTouchMove);
  26907. off(document, 'dragover', nearestEmptyInsertDetectEvent);
  26908. off(document, 'mousemove', nearestEmptyInsertDetectEvent);
  26909. off(document, 'touchmove', nearestEmptyInsertDetectEvent);
  26910. },
  26911. _offUpEvents: function _offUpEvents() {
  26912. var ownerDocument = this.el.ownerDocument;
  26913. off(ownerDocument, 'mouseup', this._onDrop);
  26914. off(ownerDocument, 'touchend', this._onDrop);
  26915. off(ownerDocument, 'pointerup', this._onDrop);
  26916. off(ownerDocument, 'touchcancel', this._onDrop);
  26917. off(document, 'selectstart', this);
  26918. },
  26919. _onDrop: function _onDrop(
  26920. /**Event*/
  26921. evt) {
  26922. var el = this.el,
  26923. options = this.options; // Get the index of the dragged element within its parent
  26924. newIndex = index(dragEl);
  26925. newDraggableIndex = index(dragEl, options.draggable);
  26926. pluginEvent('drop', this, {
  26927. evt: evt
  26928. });
  26929. parentEl = dragEl && dragEl.parentNode; // Get again after plugin event
  26930. newIndex = index(dragEl);
  26931. newDraggableIndex = index(dragEl, options.draggable);
  26932. if (Sortable.eventCanceled) {
  26933. this._nulling();
  26934. return;
  26935. }
  26936. awaitingDragStarted = false;
  26937. isCircumstantialInvert = false;
  26938. pastFirstInvertThresh = false;
  26939. clearInterval(this._loopId);
  26940. clearTimeout(this._dragStartTimer);
  26941. _cancelNextTick(this.cloneId);
  26942. _cancelNextTick(this._dragStartId); // Unbind events
  26943. if (this.nativeDraggable) {
  26944. off(document, 'drop', this);
  26945. off(el, 'dragstart', this._onDragStart);
  26946. }
  26947. this._offMoveEvents();
  26948. this._offUpEvents();
  26949. if (Safari) {
  26950. css(document.body, 'user-select', '');
  26951. }
  26952. css(dragEl, 'transform', '');
  26953. if (evt) {
  26954. if (moved) {
  26955. evt.cancelable && evt.preventDefault();
  26956. !options.dropBubble && evt.stopPropagation();
  26957. }
  26958. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  26959. if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
  26960. // Remove clone(s)
  26961. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  26962. }
  26963. if (dragEl) {
  26964. if (this.nativeDraggable) {
  26965. off(dragEl, 'dragend', this);
  26966. }
  26967. _disableDraggable(dragEl);
  26968. dragEl.style['will-change'] = ''; // Remove classes
  26969. // ghostClass is added in dragStarted
  26970. if (moved && !awaitingDragStarted) {
  26971. toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
  26972. }
  26973. toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
  26974. _dispatchEvent({
  26975. sortable: this,
  26976. name: 'unchoose',
  26977. toEl: parentEl,
  26978. newIndex: null,
  26979. newDraggableIndex: null,
  26980. originalEvent: evt
  26981. });
  26982. if (rootEl !== parentEl) {
  26983. if (newIndex >= 0) {
  26984. // Add event
  26985. _dispatchEvent({
  26986. rootEl: parentEl,
  26987. name: 'add',
  26988. toEl: parentEl,
  26989. fromEl: rootEl,
  26990. originalEvent: evt
  26991. }); // Remove event
  26992. _dispatchEvent({
  26993. sortable: this,
  26994. name: 'remove',
  26995. toEl: parentEl,
  26996. originalEvent: evt
  26997. }); // drag from one list and drop into another
  26998. _dispatchEvent({
  26999. rootEl: parentEl,
  27000. name: 'sort',
  27001. toEl: parentEl,
  27002. fromEl: rootEl,
  27003. originalEvent: evt
  27004. });
  27005. _dispatchEvent({
  27006. sortable: this,
  27007. name: 'sort',
  27008. toEl: parentEl,
  27009. originalEvent: evt
  27010. });
  27011. }
  27012. putSortable && putSortable.save();
  27013. } else {
  27014. if (newIndex !== oldIndex) {
  27015. if (newIndex >= 0) {
  27016. // drag & drop within the same list
  27017. _dispatchEvent({
  27018. sortable: this,
  27019. name: 'update',
  27020. toEl: parentEl,
  27021. originalEvent: evt
  27022. });
  27023. _dispatchEvent({
  27024. sortable: this,
  27025. name: 'sort',
  27026. toEl: parentEl,
  27027. originalEvent: evt
  27028. });
  27029. }
  27030. }
  27031. }
  27032. if (Sortable.active) {
  27033. /* jshint eqnull:true */
  27034. if (newIndex == null || newIndex === -1) {
  27035. newIndex = oldIndex;
  27036. newDraggableIndex = oldDraggableIndex;
  27037. }
  27038. _dispatchEvent({
  27039. sortable: this,
  27040. name: 'end',
  27041. toEl: parentEl,
  27042. originalEvent: evt
  27043. }); // Save sorting
  27044. this.save();
  27045. }
  27046. }
  27047. }
  27048. this._nulling();
  27049. },
  27050. _nulling: function _nulling() {
  27051. pluginEvent('nulling', this);
  27052. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
  27053. savedInputChecked.forEach(function (el) {
  27054. el.checked = true;
  27055. });
  27056. savedInputChecked.length = lastDx = lastDy = 0;
  27057. },
  27058. handleEvent: function handleEvent(
  27059. /**Event*/
  27060. evt) {
  27061. switch (evt.type) {
  27062. case 'drop':
  27063. case 'dragend':
  27064. this._onDrop(evt);
  27065. break;
  27066. case 'dragenter':
  27067. case 'dragover':
  27068. if (dragEl) {
  27069. this._onDragOver(evt);
  27070. _globalDragOver(evt);
  27071. }
  27072. break;
  27073. case 'selectstart':
  27074. evt.preventDefault();
  27075. break;
  27076. }
  27077. },
  27078. /**
  27079. * Serializes the item into an array of string.
  27080. * @returns {String[]}
  27081. */
  27082. toArray: function toArray() {
  27083. var order = [],
  27084. el,
  27085. children = this.el.children,
  27086. i = 0,
  27087. n = children.length,
  27088. options = this.options;
  27089. for (; i < n; i++) {
  27090. el = children[i];
  27091. if (closest(el, options.draggable, this.el, false)) {
  27092. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  27093. }
  27094. }
  27095. return order;
  27096. },
  27097. /**
  27098. * Sorts the elements according to the array.
  27099. * @param {String[]} order order of the items
  27100. */
  27101. sort: function sort(order, useAnimation) {
  27102. var items = {},
  27103. rootEl = this.el;
  27104. this.toArray().forEach(function (id, i) {
  27105. var el = rootEl.children[i];
  27106. if (closest(el, this.options.draggable, rootEl, false)) {
  27107. items[id] = el;
  27108. }
  27109. }, this);
  27110. useAnimation && this.captureAnimationState();
  27111. order.forEach(function (id) {
  27112. if (items[id]) {
  27113. rootEl.removeChild(items[id]);
  27114. rootEl.appendChild(items[id]);
  27115. }
  27116. });
  27117. useAnimation && this.animateAll();
  27118. },
  27119. /**
  27120. * Save the current sorting
  27121. */
  27122. save: function save() {
  27123. var store = this.options.store;
  27124. store && store.set && store.set(this);
  27125. },
  27126. /**
  27127. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  27128. * @param {HTMLElement} el
  27129. * @param {String} [selector] default: `options.draggable`
  27130. * @returns {HTMLElement|null}
  27131. */
  27132. closest: function closest$1(el, selector) {
  27133. return closest(el, selector || this.options.draggable, this.el, false);
  27134. },
  27135. /**
  27136. * Set/get option
  27137. * @param {string} name
  27138. * @param {*} [value]
  27139. * @returns {*}
  27140. */
  27141. option: function option(name, value) {
  27142. var options = this.options;
  27143. if (value === void 0) {
  27144. return options[name];
  27145. } else {
  27146. var modifiedValue = PluginManager.modifyOption(this, name, value);
  27147. if (typeof modifiedValue !== 'undefined') {
  27148. options[name] = modifiedValue;
  27149. } else {
  27150. options[name] = value;
  27151. }
  27152. if (name === 'group') {
  27153. _prepareGroup(options);
  27154. }
  27155. }
  27156. },
  27157. /**
  27158. * Destroy
  27159. */
  27160. destroy: function destroy() {
  27161. pluginEvent('destroy', this);
  27162. var el = this.el;
  27163. el[expando] = null;
  27164. off(el, 'mousedown', this._onTapStart);
  27165. off(el, 'touchstart', this._onTapStart);
  27166. off(el, 'pointerdown', this._onTapStart);
  27167. if (this.nativeDraggable) {
  27168. off(el, 'dragover', this);
  27169. off(el, 'dragenter', this);
  27170. } // Remove draggable attributes
  27171. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  27172. el.removeAttribute('draggable');
  27173. });
  27174. this._onDrop();
  27175. this._disableDelayedDragEvents();
  27176. sortables.splice(sortables.indexOf(this.el), 1);
  27177. this.el = el = null;
  27178. },
  27179. _hideClone: function _hideClone() {
  27180. if (!cloneHidden) {
  27181. pluginEvent('hideClone', this);
  27182. if (Sortable.eventCanceled) return;
  27183. css(cloneEl, 'display', 'none');
  27184. if (this.options.removeCloneOnHide && cloneEl.parentNode) {
  27185. cloneEl.parentNode.removeChild(cloneEl);
  27186. }
  27187. cloneHidden = true;
  27188. }
  27189. },
  27190. _showClone: function _showClone(putSortable) {
  27191. if (putSortable.lastPutMode !== 'clone') {
  27192. this._hideClone();
  27193. return;
  27194. }
  27195. if (cloneHidden) {
  27196. pluginEvent('showClone', this);
  27197. if (Sortable.eventCanceled) return; // show clone at dragEl or original position
  27198. if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
  27199. rootEl.insertBefore(cloneEl, dragEl);
  27200. } else if (nextEl) {
  27201. rootEl.insertBefore(cloneEl, nextEl);
  27202. } else {
  27203. rootEl.appendChild(cloneEl);
  27204. }
  27205. if (this.options.group.revertClone) {
  27206. this.animate(dragEl, cloneEl);
  27207. }
  27208. css(cloneEl, 'display', '');
  27209. cloneHidden = false;
  27210. }
  27211. }
  27212. };
  27213. function _globalDragOver(
  27214. /**Event*/
  27215. evt) {
  27216. if (evt.dataTransfer) {
  27217. evt.dataTransfer.dropEffect = 'move';
  27218. }
  27219. evt.cancelable && evt.preventDefault();
  27220. }
  27221. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
  27222. var evt,
  27223. sortable = fromEl[expando],
  27224. onMoveFn = sortable.options.onMove,
  27225. retVal; // Support for new CustomEvent feature
  27226. if (window.CustomEvent && !IE11OrLess && !Edge) {
  27227. evt = new CustomEvent('move', {
  27228. bubbles: true,
  27229. cancelable: true
  27230. });
  27231. } else {
  27232. evt = document.createEvent('Event');
  27233. evt.initEvent('move', true, true);
  27234. }
  27235. evt.to = toEl;
  27236. evt.from = fromEl;
  27237. evt.dragged = dragEl;
  27238. evt.draggedRect = dragRect;
  27239. evt.related = targetEl || toEl;
  27240. evt.relatedRect = targetRect || getRect(toEl);
  27241. evt.willInsertAfter = willInsertAfter;
  27242. evt.originalEvent = originalEvent;
  27243. fromEl.dispatchEvent(evt);
  27244. if (onMoveFn) {
  27245. retVal = onMoveFn.call(sortable, evt, originalEvent);
  27246. }
  27247. return retVal;
  27248. }
  27249. function _disableDraggable(el) {
  27250. el.draggable = false;
  27251. }
  27252. function _unsilent() {
  27253. _silent = false;
  27254. }
  27255. function _ghostIsFirst(evt, vertical, sortable) {
  27256. var rect = getRect(getChild(sortable.el, 0, sortable.options, true));
  27257. var spacer = 10;
  27258. return vertical ? evt.clientX < rect.left - spacer || evt.clientY < rect.top && evt.clientX < rect.right : evt.clientY < rect.top - spacer || evt.clientY < rect.bottom && evt.clientX < rect.left;
  27259. }
  27260. function _ghostIsLast(evt, vertical, sortable) {
  27261. var rect = getRect(lastChild(sortable.el, sortable.options.draggable));
  27262. var spacer = 10;
  27263. return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;
  27264. }
  27265. function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
  27266. var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
  27267. targetLength = vertical ? targetRect.height : targetRect.width,
  27268. targetS1 = vertical ? targetRect.top : targetRect.left,
  27269. targetS2 = vertical ? targetRect.bottom : targetRect.right,
  27270. invert = false;
  27271. if (!invertSwap) {
  27272. // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
  27273. if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
  27274. // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
  27275. // check if past first invert threshold on side opposite of lastDirection
  27276. if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
  27277. // past first invert threshold, do not restrict inverted threshold to dragEl shadow
  27278. pastFirstInvertThresh = true;
  27279. }
  27280. if (!pastFirstInvertThresh) {
  27281. // dragEl shadow (target move distance shadow)
  27282. if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
  27283. : mouseOnAxis > targetS2 - targetMoveDistance) {
  27284. return -lastDirection;
  27285. }
  27286. } else {
  27287. invert = true;
  27288. }
  27289. } else {
  27290. // Regular
  27291. if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
  27292. return _getInsertDirection(target);
  27293. }
  27294. }
  27295. }
  27296. invert = invert || invertSwap;
  27297. if (invert) {
  27298. // Invert of regular
  27299. if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
  27300. return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
  27301. }
  27302. }
  27303. return 0;
  27304. }
  27305. /**
  27306. * Gets the direction dragEl must be swapped relative to target in order to make it
  27307. * seem that dragEl has been "inserted" into that element's position
  27308. * @param {HTMLElement} target The target whose position dragEl is being inserted at
  27309. * @return {Number} Direction dragEl must be swapped
  27310. */
  27311. function _getInsertDirection(target) {
  27312. if (index(dragEl) < index(target)) {
  27313. return 1;
  27314. } else {
  27315. return -1;
  27316. }
  27317. }
  27318. /**
  27319. * Generate id
  27320. * @param {HTMLElement} el
  27321. * @returns {String}
  27322. * @private
  27323. */
  27324. function _generateId(el) {
  27325. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  27326. i = str.length,
  27327. sum = 0;
  27328. while (i--) {
  27329. sum += str.charCodeAt(i);
  27330. }
  27331. return sum.toString(36);
  27332. }
  27333. function _saveInputCheckedState(root) {
  27334. savedInputChecked.length = 0;
  27335. var inputs = root.getElementsByTagName('input');
  27336. var idx = inputs.length;
  27337. while (idx--) {
  27338. var el = inputs[idx];
  27339. el.checked && savedInputChecked.push(el);
  27340. }
  27341. }
  27342. function _nextTick(fn) {
  27343. return setTimeout(fn, 0);
  27344. }
  27345. function _cancelNextTick(id) {
  27346. return clearTimeout(id);
  27347. } // Fixed #973:
  27348. if (documentExists) {
  27349. on(document, 'touchmove', function (evt) {
  27350. if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
  27351. evt.preventDefault();
  27352. }
  27353. });
  27354. } // Export utils
  27355. Sortable.utils = {
  27356. on: on,
  27357. off: off,
  27358. css: css,
  27359. find: find,
  27360. is: function is(el, selector) {
  27361. return !!closest(el, selector, el, false);
  27362. },
  27363. extend: extend,
  27364. throttle: throttle,
  27365. closest: closest,
  27366. toggleClass: toggleClass,
  27367. clone: clone,
  27368. index: index,
  27369. nextTick: _nextTick,
  27370. cancelNextTick: _cancelNextTick,
  27371. detectDirection: _detectDirection,
  27372. getChild: getChild
  27373. };
  27374. /**
  27375. * Get the Sortable instance of an element
  27376. * @param {HTMLElement} element The element
  27377. * @return {Sortable|undefined} The instance of Sortable
  27378. */
  27379. Sortable.get = function (element) {
  27380. return element[expando];
  27381. };
  27382. /**
  27383. * Mount a plugin to Sortable
  27384. * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
  27385. */
  27386. Sortable.mount = function () {
  27387. for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
  27388. plugins[_key] = arguments[_key];
  27389. }
  27390. if (plugins[0].constructor === Array) plugins = plugins[0];
  27391. plugins.forEach(function (plugin) {
  27392. if (!plugin.prototype || !plugin.prototype.constructor) {
  27393. throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
  27394. }
  27395. if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
  27396. PluginManager.mount(plugin);
  27397. });
  27398. };
  27399. /**
  27400. * Create sortable instance
  27401. * @param {HTMLElement} el
  27402. * @param {Object} [options]
  27403. */
  27404. Sortable.create = function (el, options) {
  27405. return new Sortable(el, options);
  27406. }; // Export
  27407. Sortable.version = version;
  27408. var autoScrolls = [],
  27409. scrollEl,
  27410. scrollRootEl,
  27411. scrolling = false,
  27412. lastAutoScrollX,
  27413. lastAutoScrollY,
  27414. touchEvt$1,
  27415. pointerElemChangedInterval;
  27416. function AutoScrollPlugin() {
  27417. function AutoScroll() {
  27418. this.defaults = {
  27419. scroll: true,
  27420. forceAutoScrollFallback: false,
  27421. scrollSensitivity: 30,
  27422. scrollSpeed: 10,
  27423. bubbleScroll: true
  27424. }; // Bind all private methods
  27425. for (var fn in this) {
  27426. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  27427. this[fn] = this[fn].bind(this);
  27428. }
  27429. }
  27430. }
  27431. AutoScroll.prototype = {
  27432. dragStarted: function dragStarted(_ref) {
  27433. var originalEvent = _ref.originalEvent;
  27434. if (this.sortable.nativeDraggable) {
  27435. on(document, 'dragover', this._handleAutoScroll);
  27436. } else {
  27437. if (this.options.supportPointer) {
  27438. on(document, 'pointermove', this._handleFallbackAutoScroll);
  27439. } else if (originalEvent.touches) {
  27440. on(document, 'touchmove', this._handleFallbackAutoScroll);
  27441. } else {
  27442. on(document, 'mousemove', this._handleFallbackAutoScroll);
  27443. }
  27444. }
  27445. },
  27446. dragOverCompleted: function dragOverCompleted(_ref2) {
  27447. var originalEvent = _ref2.originalEvent;
  27448. // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
  27449. if (!this.options.dragOverBubble && !originalEvent.rootEl) {
  27450. this._handleAutoScroll(originalEvent);
  27451. }
  27452. },
  27453. drop: function drop() {
  27454. if (this.sortable.nativeDraggable) {
  27455. off(document, 'dragover', this._handleAutoScroll);
  27456. } else {
  27457. off(document, 'pointermove', this._handleFallbackAutoScroll);
  27458. off(document, 'touchmove', this._handleFallbackAutoScroll);
  27459. off(document, 'mousemove', this._handleFallbackAutoScroll);
  27460. }
  27461. clearPointerElemChangedInterval();
  27462. clearAutoScrolls();
  27463. cancelThrottle();
  27464. },
  27465. nulling: function nulling() {
  27466. touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
  27467. autoScrolls.length = 0;
  27468. },
  27469. _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
  27470. this._handleAutoScroll(evt, true);
  27471. },
  27472. _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
  27473. var _this = this;
  27474. var x = (evt.touches ? evt.touches[0] : evt).clientX,
  27475. y = (evt.touches ? evt.touches[0] : evt).clientY,
  27476. elem = document.elementFromPoint(x, y);
  27477. touchEvt$1 = evt; // IE does not seem to have native autoscroll,
  27478. // Edge's autoscroll seems too conditional,
  27479. // MACOS Safari does not have autoscroll,
  27480. // Firefox and Chrome are good
  27481. if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
  27482. autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change
  27483. var ogElemScroller = getParentAutoScrollElement(elem, true);
  27484. if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
  27485. pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour
  27486. pointerElemChangedInterval = setInterval(function () {
  27487. var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
  27488. if (newElem !== ogElemScroller) {
  27489. ogElemScroller = newElem;
  27490. clearAutoScrolls();
  27491. }
  27492. autoScroll(evt, _this.options, newElem, fallback);
  27493. }, 10);
  27494. lastAutoScrollX = x;
  27495. lastAutoScrollY = y;
  27496. }
  27497. } else {
  27498. // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
  27499. if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
  27500. clearAutoScrolls();
  27501. return;
  27502. }
  27503. autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
  27504. }
  27505. }
  27506. };
  27507. return _extends(AutoScroll, {
  27508. pluginName: 'scroll',
  27509. initializeByDefault: true
  27510. });
  27511. }
  27512. function clearAutoScrolls() {
  27513. autoScrolls.forEach(function (autoScroll) {
  27514. clearInterval(autoScroll.pid);
  27515. });
  27516. autoScrolls = [];
  27517. }
  27518. function clearPointerElemChangedInterval() {
  27519. clearInterval(pointerElemChangedInterval);
  27520. }
  27521. var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
  27522. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  27523. if (!options.scroll) return;
  27524. var x = (evt.touches ? evt.touches[0] : evt).clientX,
  27525. y = (evt.touches ? evt.touches[0] : evt).clientY,
  27526. sens = options.scrollSensitivity,
  27527. speed = options.scrollSpeed,
  27528. winScroller = getWindowScrollingElement();
  27529. var scrollThisInstance = false,
  27530. scrollCustomFn; // New scroll root, set scrollEl
  27531. if (scrollRootEl !== rootEl) {
  27532. scrollRootEl = rootEl;
  27533. clearAutoScrolls();
  27534. scrollEl = options.scroll;
  27535. scrollCustomFn = options.scrollFn;
  27536. if (scrollEl === true) {
  27537. scrollEl = getParentAutoScrollElement(rootEl, true);
  27538. }
  27539. }
  27540. var layersOut = 0;
  27541. var currentParent = scrollEl;
  27542. do {
  27543. var el = currentParent,
  27544. rect = getRect(el),
  27545. top = rect.top,
  27546. bottom = rect.bottom,
  27547. left = rect.left,
  27548. right = rect.right,
  27549. width = rect.width,
  27550. height = rect.height,
  27551. canScrollX = void 0,
  27552. canScrollY = void 0,
  27553. scrollWidth = el.scrollWidth,
  27554. scrollHeight = el.scrollHeight,
  27555. elCSS = css(el),
  27556. scrollPosX = el.scrollLeft,
  27557. scrollPosY = el.scrollTop;
  27558. if (el === winScroller) {
  27559. canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
  27560. canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
  27561. } else {
  27562. canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
  27563. canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
  27564. }
  27565. var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
  27566. var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
  27567. if (!autoScrolls[layersOut]) {
  27568. for (var i = 0; i <= layersOut; i++) {
  27569. if (!autoScrolls[i]) {
  27570. autoScrolls[i] = {};
  27571. }
  27572. }
  27573. }
  27574. if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
  27575. autoScrolls[layersOut].el = el;
  27576. autoScrolls[layersOut].vx = vx;
  27577. autoScrolls[layersOut].vy = vy;
  27578. clearInterval(autoScrolls[layersOut].pid);
  27579. if (vx != 0 || vy != 0) {
  27580. scrollThisInstance = true;
  27581. /* jshint loopfunc:true */
  27582. autoScrolls[layersOut].pid = setInterval(function () {
  27583. // emulate drag over during autoscroll (fallback), emulating native DnD behaviour
  27584. if (isFallback && this.layer === 0) {
  27585. Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
  27586. }
  27587. var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
  27588. var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
  27589. if (typeof scrollCustomFn === 'function') {
  27590. if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
  27591. return;
  27592. }
  27593. }
  27594. scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
  27595. }.bind({
  27596. layer: layersOut
  27597. }), 24);
  27598. }
  27599. }
  27600. layersOut++;
  27601. } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
  27602. scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
  27603. }, 30);
  27604. var drop = function drop(_ref) {
  27605. var originalEvent = _ref.originalEvent,
  27606. putSortable = _ref.putSortable,
  27607. dragEl = _ref.dragEl,
  27608. activeSortable = _ref.activeSortable,
  27609. dispatchSortableEvent = _ref.dispatchSortableEvent,
  27610. hideGhostForTarget = _ref.hideGhostForTarget,
  27611. unhideGhostForTarget = _ref.unhideGhostForTarget;
  27612. if (!originalEvent) return;
  27613. var toSortable = putSortable || activeSortable;
  27614. hideGhostForTarget();
  27615. var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
  27616. var target = document.elementFromPoint(touch.clientX, touch.clientY);
  27617. unhideGhostForTarget();
  27618. if (toSortable && !toSortable.el.contains(target)) {
  27619. dispatchSortableEvent('spill');
  27620. this.onSpill({
  27621. dragEl: dragEl,
  27622. putSortable: putSortable
  27623. });
  27624. }
  27625. };
  27626. function Revert() {}
  27627. Revert.prototype = {
  27628. startIndex: null,
  27629. dragStart: function dragStart(_ref2) {
  27630. var oldDraggableIndex = _ref2.oldDraggableIndex;
  27631. this.startIndex = oldDraggableIndex;
  27632. },
  27633. onSpill: function onSpill(_ref3) {
  27634. var dragEl = _ref3.dragEl,
  27635. putSortable = _ref3.putSortable;
  27636. this.sortable.captureAnimationState();
  27637. if (putSortable) {
  27638. putSortable.captureAnimationState();
  27639. }
  27640. var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
  27641. if (nextSibling) {
  27642. this.sortable.el.insertBefore(dragEl, nextSibling);
  27643. } else {
  27644. this.sortable.el.appendChild(dragEl);
  27645. }
  27646. this.sortable.animateAll();
  27647. if (putSortable) {
  27648. putSortable.animateAll();
  27649. }
  27650. },
  27651. drop: drop
  27652. };
  27653. _extends(Revert, {
  27654. pluginName: 'revertOnSpill'
  27655. });
  27656. function Remove() {}
  27657. Remove.prototype = {
  27658. onSpill: function onSpill(_ref4) {
  27659. var dragEl = _ref4.dragEl,
  27660. putSortable = _ref4.putSortable;
  27661. var parentSortable = putSortable || this.sortable;
  27662. parentSortable.captureAnimationState();
  27663. dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
  27664. parentSortable.animateAll();
  27665. },
  27666. drop: drop
  27667. };
  27668. _extends(Remove, {
  27669. pluginName: 'removeOnSpill'
  27670. });
  27671. Sortable.mount(new AutoScrollPlugin());
  27672. Sortable.mount(Remove, Revert);
  27673. const CSS$8 = {
  27674. sortItem: "sort-item",
  27675. container: "container",
  27676. containerHorizontal: "container--horizontal",
  27677. containerVertical: "container--vertical"
  27678. };
  27679. const sortableListCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-sortable-list:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-sortable-list{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-sortable-list{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-sortable-list{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-sortable-list{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-sortable-list{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-sortable-list:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-sortable-list-h{display:none}/*!@:host*/.sc-calcite-sortable-list-h{display:-ms-flexbox;display:flex}/*!@:host([disabled])*/[disabled].sc-calcite-sortable-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-sortable-list-h[disabled] .sc-calcite-sortable-list-s>[calcite-hydrated][disabled],[disabled].sc-calcite-sortable-list-h [calcite-hydrated][disabled].sc-calcite-sortable-list{opacity:1}/*!@.container*/.container.sc-calcite-sortable-list{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto}/*!@.container--vertical*/.container--vertical.sc-calcite-sortable-list{-ms-flex-direction:column;flex-direction:column}/*!@.container--horizontal*/.container--horizontal.sc-calcite-sortable-list{-ms-flex-direction:row;flex-direction:row}";
  27680. /**
  27681. * @slot - A slot for adding sortable items.
  27682. */
  27683. class SortableList {
  27684. constructor(hostRef) {
  27685. registerInstance(this, hostRef);
  27686. this.calciteListOrderChange = createEvent(this, "calciteListOrderChange", 7);
  27687. /**
  27688. * The selector for the handle elements.
  27689. */
  27690. this.handleSelector = "calcite-handle";
  27691. /**
  27692. * Indicates the horizontal or vertical orientation of the component.
  27693. */
  27694. this.layout = "vertical";
  27695. /**
  27696. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  27697. */
  27698. this.disabled = false;
  27699. /**
  27700. * When true, content is waiting to be loaded. This state shows a busy indicator.
  27701. */
  27702. this.loading = false;
  27703. this.handleActivated = false;
  27704. this.items = [];
  27705. this.mutationObserver = createObserver();
  27706. }
  27707. // --------------------------------------------------------------------------
  27708. //
  27709. // Lifecycle
  27710. //
  27711. // --------------------------------------------------------------------------
  27712. connectedCallback() {
  27713. this.items = Array.from(this.el.children);
  27714. this.setUpDragAndDrop();
  27715. this.beginObserving();
  27716. }
  27717. disconnectedCallback() {
  27718. var _a;
  27719. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  27720. this.cleanUpDragAndDrop();
  27721. }
  27722. componentDidRender() {
  27723. updateHostInteraction(this);
  27724. }
  27725. calciteHandleNudgeHandler(event) {
  27726. var _a;
  27727. const sortItem = this.items.find((item) => {
  27728. return item.contains(event.detail.handle) || event.composedPath().includes(item);
  27729. });
  27730. const lastIndex = this.items.length - 1;
  27731. const startingIndex = this.items.indexOf(sortItem);
  27732. let appendInstead = false;
  27733. let buddyIndex;
  27734. switch (event.detail.direction) {
  27735. case "up":
  27736. event.preventDefault();
  27737. if (startingIndex === 0) {
  27738. appendInstead = true;
  27739. }
  27740. else {
  27741. buddyIndex = startingIndex - 1;
  27742. }
  27743. break;
  27744. case "down":
  27745. event.preventDefault();
  27746. if (startingIndex === lastIndex) {
  27747. buddyIndex = 0;
  27748. }
  27749. else if (startingIndex === lastIndex - 1) {
  27750. appendInstead = true;
  27751. }
  27752. else {
  27753. buddyIndex = startingIndex + 2;
  27754. }
  27755. break;
  27756. default:
  27757. return;
  27758. }
  27759. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  27760. if (appendInstead) {
  27761. sortItem.parentElement.appendChild(sortItem);
  27762. }
  27763. else {
  27764. sortItem.parentElement.insertBefore(sortItem, this.items[buddyIndex]);
  27765. }
  27766. this.items = Array.from(this.el.children);
  27767. event.detail.handle.activated = true;
  27768. event.detail.handle.setFocus();
  27769. this.beginObserving();
  27770. }
  27771. // --------------------------------------------------------------------------
  27772. //
  27773. // Private Methods
  27774. //
  27775. // --------------------------------------------------------------------------
  27776. setUpDragAndDrop() {
  27777. this.cleanUpDragAndDrop();
  27778. const options = {
  27779. dataIdAttr: "id",
  27780. group: this.group,
  27781. handle: this.handleSelector,
  27782. // Changed sorting within list
  27783. onUpdate: () => {
  27784. this.items = Array.from(this.el.children);
  27785. this.calciteListOrderChange.emit();
  27786. },
  27787. // Element dragging started
  27788. onStart: () => {
  27789. var _a;
  27790. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  27791. },
  27792. // Element dragging ended
  27793. onEnd: () => {
  27794. this.beginObserving();
  27795. }
  27796. };
  27797. if (this.dragSelector) {
  27798. options.draggable = this.dragSelector;
  27799. }
  27800. this.sortable = Sortable.create(this.el, options);
  27801. }
  27802. cleanUpDragAndDrop() {
  27803. var _a;
  27804. (_a = this.sortable) === null || _a === void 0 ? void 0 : _a.destroy();
  27805. this.sortable = null;
  27806. }
  27807. beginObserving() {
  27808. var _a;
  27809. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  27810. }
  27811. // --------------------------------------------------------------------------
  27812. //
  27813. // Render Methods
  27814. //
  27815. // --------------------------------------------------------------------------
  27816. render() {
  27817. const { layout } = this;
  27818. const horizontal = layout === "horizontal" || false;
  27819. return (hAsync("div", { class: {
  27820. [CSS$8.container]: true,
  27821. [CSS$8.containerVertical]: !horizontal,
  27822. [CSS$8.containerHorizontal]: horizontal
  27823. } }, hAsync("slot", null)));
  27824. }
  27825. get el() { return getElement(this); }
  27826. static get style() { return sortableListCss; }
  27827. static get cmpMeta() { return {
  27828. "$flags$": 9,
  27829. "$tagName$": "calcite-sortable-list",
  27830. "$members$": {
  27831. "dragSelector": [1, "drag-selector"],
  27832. "group": [1],
  27833. "handleSelector": [1, "handle-selector"],
  27834. "layout": [1],
  27835. "disabled": [516],
  27836. "loading": [516],
  27837. "handleActivated": [32]
  27838. },
  27839. "$listeners$": [[0, "calciteHandleNudge", "calciteHandleNudgeHandler"]],
  27840. "$lazyBundleId$": "-",
  27841. "$attrsToReflect$": [["disabled", "disabled"], ["loading", "loading"]]
  27842. }; }
  27843. }
  27844. const CSS$7 = {
  27845. container: "split-button__container",
  27846. dividerContainer: "split-button__divider-container",
  27847. divider: "split-button__divider",
  27848. widthAuto: "width-auto",
  27849. widthHalf: "width-half",
  27850. widthFull: "width-full"
  27851. };
  27852. const splitButtonCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-split-button:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-split-button{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-split-button{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-split-button{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-split-button{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-split-button{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-split-button:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-split-button-h{display:none}/*!@:host*/.sc-calcite-split-button-h{display:inline-block}/*!@:host .split-button__container*/.sc-calcite-split-button-h .split-button__container.sc-calcite-split-button{display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch}/*!@:host .split-button__container > calcite-dropdown > calcite-button*/.sc-calcite-split-button-h .split-button__container.sc-calcite-split-button>calcite-dropdown.sc-calcite-split-button>calcite-button.sc-calcite-split-button{height:100%;vertical-align:top}/*!@:host([appearance=solid]):host([color=blue])*/[appearance=solid].sc-calcite-split-button-h([color=blue]).sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-brand);--calcite-split-button-divider:var(--calcite-ui-foreground-1)}/*!@:host([appearance=solid]):host([color=red])*/[appearance=solid].sc-calcite-split-button-h([color=red]).sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-danger);--calcite-split-button-divider:var(--calcite-ui-foreground-1)}/*!@:host([appearance=solid]):host([color=neutral])*/[appearance=solid].sc-calcite-split-button-h([color=neutral]).sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-foreground-3);--calcite-split-button-divider:var(--calcite-ui-text-1)}/*!@:host([appearance=solid]):host([color=inverse])*/[appearance=solid].sc-calcite-split-button-h([color=inverse]).sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-inverse);--calcite-split-button-divider:var(--calcite-ui-foreground-1)}/*!@:host([appearance=transparent]):host([color=blue])*/[appearance=transparent].sc-calcite-split-button-h([color=blue]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-brand)}/*!@:host([appearance=transparent]):host([color=red])*/[appearance=transparent].sc-calcite-split-button-h([color=red]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-danger)}/*!@:host([appearance=transparent]):host([color=neutral])*/[appearance=transparent].sc-calcite-split-button-h([color=neutral]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-text-1)}/*!@:host([appearance=transparent]):host([color=inverse])*/[appearance=transparent].sc-calcite-split-button-h([color=inverse]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-foreground-1)}/*!@:host([appearance=clear]),\n:host([appearance=transparent])*/[appearance=clear].sc-calcite-split-button-h,[appearance=transparent].sc-calcite-split-button-h{--calcite-split-button-background:transparent}/*!@:host([appearance=outline])*/[appearance=outline].sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-foreground-1)}/*!@:host([appearance=clear]):host([color=blue]),\n:host([appearance=outline]):host([color=blue])*/[appearance=clear].sc-calcite-split-button-h([color=blue]).sc-calcite-split-button-h,[appearance=outline].sc-calcite-split-button-h([color=blue]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-brand)}/*!@:host([appearance=clear]):host([color=red]),\n:host([appearance=outline]):host([color=red])*/[appearance=clear].sc-calcite-split-button-h([color=red]).sc-calcite-split-button-h,[appearance=outline].sc-calcite-split-button-h([color=red]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-danger)}/*!@:host([appearance=clear]):host([color=neutral]),\n:host([appearance=outline]):host([color=neutral])*/[appearance=clear].sc-calcite-split-button-h([color=neutral]).sc-calcite-split-button-h,[appearance=outline].sc-calcite-split-button-h([color=neutral]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear]):host([color=inverse]),\n:host([appearance=outline]):host([color=inverse])*/[appearance=clear].sc-calcite-split-button-h([color=inverse]).sc-calcite-split-button-h,[appearance=outline].sc-calcite-split-button-h([color=inverse]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-inverse)}/*!@.width-auto*/.width-auto.sc-calcite-split-button{width:auto}/*!@.width-half*/.width-half.sc-calcite-split-button{width:50%}/*!@.width-full*/.width-full.sc-calcite-split-button{width:100%}/*!@.split-button__divider-container*/.split-button__divider-container.sc-calcite-split-button{display:-ms-flexbox;display:flex;width:1px;-ms-flex-align:stretch;align-items:stretch;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;background-color:var(--calcite-split-button-background)}/*!@.split-button__divider*/.split-button__divider.sc-calcite-split-button{margin-top:0.25rem;margin-bottom:0.25rem;display:inline-block;width:1px;background-color:var(--calcite-split-button-divider)}/*!@:host([appearance=outline]) .split-button__divider-container,\n:host([appearance=clear]) .split-button__divider-container*/[appearance=outline].sc-calcite-split-button-h .split-button__divider-container.sc-calcite-split-button,[appearance=clear].sc-calcite-split-button-h .split-button__divider-container.sc-calcite-split-button{border-top:1px solid var(--calcite-split-button-divider);border-bottom:1px solid var(--calcite-split-button-divider)}/*!@:host([appearance=outline]):hover .split-button__divider-container,\n:host([appearance=clear]):hover .split-button__divider-container*/[appearance=outline].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button,[appearance=clear].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button{background-color:var(--calcite-split-button-divider)}/*!@:host([appearance=outline]:hover) .split-button__divider-container,\n:host([appearance=clear]:hover) .split-button__divider-container*/[appearance=outline].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button,[appearance=clear].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button{background-color:var(--calcite-split-button-divider)}/*!@:host([appearance=outline]:focus-within):host([color=blue]),\n:host([appearance=clear]:focus-within):host([color=blue])*/[appearance=outline].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=blue]),[appearance=clear].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=blue]){--calcite-split-button-divider:var(--calcite-ui-brand-press)}/*!@:host([appearance=outline]:focus-within):host([color=red]),\n:host([appearance=clear]:focus-within):host([color=red])*/[appearance=outline].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=red]),[appearance=clear].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=red]){--calcite-split-button-divider:var(--calcite-ui-danger-press)}/*!@:host([appearance=outline]:focus-within) .split-button__divider-container,\n:host([appearance=clear]:focus-within) .split-button__divider-container*/[appearance=outline].sc-calcite-split-button-h:focus-within .split-button__divider-container.sc-calcite-split-button,[appearance=clear].sc-calcite-split-button-h:focus-within .split-button__divider-container.sc-calcite-split-button{background-color:var(--calcite-split-button-divider)}/*!@:host([disabled])*/[disabled].sc-calcite-split-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) .split-button__divider-container*/[disabled].sc-calcite-split-button-h .split-button__divider-container.sc-calcite-split-button{opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) calcite-dropdown > calcite-button*/[disabled].sc-calcite-split-button-h calcite-dropdown.sc-calcite-split-button>calcite-button.sc-calcite-split-button{pointer-events:none}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-split-button-h[disabled] .sc-calcite-split-button-s>[calcite-hydrated][disabled],[disabled].sc-calcite-split-button-h [calcite-hydrated][disabled].sc-calcite-split-button{opacity:1}";
  27853. /**
  27854. * @slot - A slot for adding `calcite-dropdown` content.
  27855. */
  27856. class SplitButton {
  27857. constructor(hostRef) {
  27858. registerInstance(this, hostRef);
  27859. this.calciteSplitButtonPrimaryClick = createEvent(this, "calciteSplitButtonPrimaryClick", 7);
  27860. this.calciteSplitButtonSecondaryClick = createEvent(this, "calciteSplitButtonSecondaryClick", 7);
  27861. /** specify the appearance style of the button, defaults to solid. */
  27862. this.appearance = "solid";
  27863. /** specify the color of the control, defaults to blue */
  27864. this.color = "blue";
  27865. /** is the control disabled */
  27866. this.disabled = false;
  27867. /**
  27868. * Is the dropdown currently active or not
  27869. * @internal
  27870. */
  27871. this.active = false;
  27872. /** specify the icon used for the dropdown menu, defaults to chevron */
  27873. this.dropdownIconType = "chevron";
  27874. /** optionally add a calcite-loader component to the control,
  27875. disabling interaction. with the primary button */
  27876. this.loading = false;
  27877. /** Describes the type of positioning to use for the dropdown. If your element is in a fixed container, use the 'fixed' value. */
  27878. this.overlayPositioning = "absolute";
  27879. /** specify the scale of the control, defaults to m */
  27880. this.scale = "m";
  27881. /** specify the width of the button, defaults to auto */
  27882. this.width = "auto";
  27883. this.calciteSplitButtonPrimaryClickHandler = (e) => this.calciteSplitButtonPrimaryClick.emit(e);
  27884. this.calciteSplitButtonSecondaryClickHandler = (e) => this.calciteSplitButtonSecondaryClick.emit(e);
  27885. }
  27886. handleDisabledChange(value) {
  27887. if (!value) {
  27888. this.active = false;
  27889. }
  27890. }
  27891. activeHandler() {
  27892. if (this.disabled) {
  27893. this.active = false;
  27894. }
  27895. }
  27896. //--------------------------------------------------------------------------
  27897. //
  27898. // Lifecycle
  27899. //
  27900. //--------------------------------------------------------------------------
  27901. componentDidRender() {
  27902. updateHostInteraction(this);
  27903. }
  27904. render() {
  27905. const widthClasses = {
  27906. [CSS$7.container]: true,
  27907. [CSS$7.widthAuto]: this.width === "auto",
  27908. [CSS$7.widthHalf]: this.width === "half",
  27909. [CSS$7.widthFull]: this.width === "full"
  27910. };
  27911. const buttonWidth = this.width === "auto" ? "auto" : "full";
  27912. return (hAsync("div", { class: widthClasses }, hAsync("calcite-button", { appearance: this.appearance, color: this.color, disabled: this.disabled, "icon-end": this.primaryIconEnd ? this.primaryIconEnd : null, "icon-start": this.primaryIconStart ? this.primaryIconStart : null, iconFlipRtl: this.primaryIconFlipRtl ? this.primaryIconFlipRtl : null, label: this.primaryLabel, loading: this.loading, onClick: this.calciteSplitButtonPrimaryClickHandler, scale: this.scale, splitChild: "primary", type: "button", width: buttonWidth }, this.primaryText), hAsync("div", { class: CSS$7.dividerContainer }, hAsync("div", { class: CSS$7.divider })), hAsync("calcite-dropdown", { active: this.active, disabled: this.disabled, onClick: this.calciteSplitButtonSecondaryClickHandler, overlayPositioning: this.overlayPositioning, placement: "bottom-trailing", scale: this.scale, width: this.scale }, hAsync("calcite-button", { appearance: this.appearance, color: this.color, disabled: this.disabled, "icon-start": this.dropdownIcon, label: this.dropdownLabel, scale: this.scale, slot: "dropdown-trigger", splitChild: "secondary", type: "button" }), hAsync("slot", null))));
  27913. }
  27914. get dropdownIcon() {
  27915. return this.dropdownIconType === "chevron"
  27916. ? "chevronDown"
  27917. : this.dropdownIconType === "caret"
  27918. ? "caretDown"
  27919. : this.dropdownIconType === "ellipsis"
  27920. ? "ellipsis"
  27921. : "handle-vertical";
  27922. }
  27923. get el() { return getElement(this); }
  27924. static get watchers() { return {
  27925. "disabled": ["handleDisabledChange"],
  27926. "active": ["activeHandler"]
  27927. }; }
  27928. static get style() { return splitButtonCss; }
  27929. static get cmpMeta() { return {
  27930. "$flags$": 9,
  27931. "$tagName$": "calcite-split-button",
  27932. "$members$": {
  27933. "appearance": [513],
  27934. "color": [513],
  27935. "disabled": [516],
  27936. "active": [1540],
  27937. "dropdownIconType": [513, "dropdown-icon-type"],
  27938. "dropdownLabel": [513, "dropdown-label"],
  27939. "loading": [516],
  27940. "overlayPositioning": [1, "overlay-positioning"],
  27941. "primaryIconEnd": [513, "primary-icon-end"],
  27942. "primaryIconFlipRtl": [513, "primary-icon-flip-rtl"],
  27943. "primaryIconStart": [513, "primary-icon-start"],
  27944. "primaryLabel": [513, "primary-label"],
  27945. "primaryText": [513, "primary-text"],
  27946. "scale": [513],
  27947. "width": [513]
  27948. },
  27949. "$listeners$": undefined,
  27950. "$lazyBundleId$": "-",
  27951. "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["active", "active"], ["dropdownIconType", "dropdown-icon-type"], ["dropdownLabel", "dropdown-label"], ["loading", "loading"], ["primaryIconEnd", "primary-icon-end"], ["primaryIconFlipRtl", "primary-icon-flip-rtl"], ["primaryIconStart", "primary-icon-start"], ["primaryLabel", "primary-label"], ["primaryText", "primary-text"], ["scale", "scale"], ["width", "width"]]
  27952. }; }
  27953. }
  27954. const stepperCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-stepper:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-stepper{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-stepper{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-stepper{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-stepper{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-stepper{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-stepper:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-stepper-h{display:none}/*!@:host*/.sc-calcite-stepper-h{position:relative;display:-ms-flexbox;display:flex;width:100%;min-width:100%;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:justify;justify-content:space-between}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-stepper-h{-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column}/*!@:host ::slotted(.calcite-stepper-content)*/.sc-calcite-stepper-h .sc-calcite-stepper-s>.calcite-stepper-content{display:-ms-flexbox;display:flex;width:100%;min-width:100%;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap}";
  27955. /**
  27956. * @slot - A slot for adding `calcite-stepper-item`s.
  27957. */
  27958. class Stepper {
  27959. constructor(hostRef) {
  27960. registerInstance(this, hostRef);
  27961. this.calciteStepperItemChange = createEvent(this, "calciteStepperItemChange", 7);
  27962. //--------------------------------------------------------------------------
  27963. //
  27964. // Public Properties
  27965. //
  27966. //--------------------------------------------------------------------------
  27967. /** optionally display a status icon next to the step title */
  27968. this.icon = false;
  27969. /** specify the layout of stepper, defaults to horizontal */
  27970. this.layout = "horizontal";
  27971. /** optionally display the number next to the step title */
  27972. this.numbered = false;
  27973. /** specify the scale of stepper, defaults to m */
  27974. this.scale = "m";
  27975. //--------------------------------------------------------------------------
  27976. //
  27977. // Private State/Props
  27978. //
  27979. //--------------------------------------------------------------------------
  27980. this.itemMap = new Map();
  27981. /** list of sorted Stepper items */
  27982. this.items = [];
  27983. /** list of enabled Stepper items */
  27984. this.enabledItems = [];
  27985. }
  27986. // watch for removal of disabled to register step
  27987. contentWatcher() {
  27988. if (this.layout === "horizontal") {
  27989. if (!this.stepperContentContainer && this.requestedContent) {
  27990. this.addHorizontalContentContainer();
  27991. }
  27992. this.updateContent(this.requestedContent);
  27993. }
  27994. }
  27995. //--------------------------------------------------------------------------
  27996. //
  27997. // Lifecycle
  27998. //
  27999. //--------------------------------------------------------------------------
  28000. componentDidLoad() {
  28001. // if no stepper items are set as active, default to the first one
  28002. if (!this.currentPosition) {
  28003. this.calciteStepperItemChange.emit({
  28004. position: 0
  28005. });
  28006. }
  28007. }
  28008. componentWillLoad() {
  28009. if (this.layout === "horizontal" && !this.stepperContentContainer) {
  28010. this.addHorizontalContentContainer();
  28011. }
  28012. }
  28013. render() {
  28014. return hAsync("slot", null);
  28015. }
  28016. //--------------------------------------------------------------------------
  28017. //
  28018. // Event Listeners
  28019. //
  28020. //--------------------------------------------------------------------------
  28021. calciteStepperItemKeyEvent(e) {
  28022. const item = e.detail.item;
  28023. const itemToFocus = e.target;
  28024. const isFirstItem = this.itemIndex(itemToFocus) === 0;
  28025. const isLastItem = this.itemIndex(itemToFocus) === this.enabledItems.length - 1;
  28026. switch (item.key) {
  28027. case "ArrowDown":
  28028. case "ArrowRight":
  28029. if (isLastItem) {
  28030. this.focusFirstItem();
  28031. }
  28032. else {
  28033. this.focusNextItem(itemToFocus);
  28034. }
  28035. break;
  28036. case "ArrowUp":
  28037. case "ArrowLeft":
  28038. if (isFirstItem) {
  28039. this.focusLastItem();
  28040. }
  28041. else {
  28042. this.focusPrevItem(itemToFocus);
  28043. }
  28044. break;
  28045. case "Home":
  28046. this.focusFirstItem();
  28047. break;
  28048. case "End":
  28049. this.focusLastItem();
  28050. break;
  28051. }
  28052. }
  28053. registerItem(event) {
  28054. const item = event.target;
  28055. const { content, position } = event.detail;
  28056. if (content && item.active) {
  28057. this.requestedContent = content;
  28058. }
  28059. this.itemMap.set(item, position);
  28060. this.items = this.sortItems();
  28061. this.enabledItems = this.filterItems();
  28062. }
  28063. updateItem(event) {
  28064. if (event.detail.content) {
  28065. this.requestedContent = event.detail.content;
  28066. }
  28067. this.currentPosition = event.detail.position;
  28068. this.calciteStepperItemChange.emit({
  28069. position: this.currentPosition
  28070. });
  28071. }
  28072. //--------------------------------------------------------------------------
  28073. //
  28074. // Public Methods
  28075. //
  28076. //--------------------------------------------------------------------------
  28077. /** set the next step as active */
  28078. async nextStep() {
  28079. const enabledStepIndex = this.getEnabledStepIndex(this.currentPosition + 1, "next");
  28080. if (typeof enabledStepIndex !== "number") {
  28081. return;
  28082. }
  28083. this.emitChangedItem(enabledStepIndex);
  28084. }
  28085. /** set the previous step as active */
  28086. async prevStep() {
  28087. const enabledStepIndex = this.getEnabledStepIndex(this.currentPosition - 1, "previous");
  28088. if (typeof enabledStepIndex !== "number") {
  28089. return;
  28090. }
  28091. this.emitChangedItem(enabledStepIndex);
  28092. }
  28093. /** set the requested step as active */
  28094. async goToStep(step) {
  28095. const position = step - 1;
  28096. if (this.currentPosition !== position) {
  28097. this.emitChangedItem(position);
  28098. }
  28099. }
  28100. /** set the first step as active */
  28101. async startStep() {
  28102. const enabledStepIndex = this.getEnabledStepIndex(0, "next");
  28103. if (typeof enabledStepIndex !== "number") {
  28104. return;
  28105. }
  28106. this.emitChangedItem(enabledStepIndex);
  28107. }
  28108. /** set the last step as active */
  28109. async endStep() {
  28110. const enabledStepIndex = this.getEnabledStepIndex(this.items.length - 1, "previous");
  28111. if (typeof enabledStepIndex !== "number") {
  28112. return;
  28113. }
  28114. this.emitChangedItem(enabledStepIndex);
  28115. }
  28116. //--------------------------------------------------------------------------
  28117. //
  28118. // Private Methods
  28119. //
  28120. //--------------------------------------------------------------------------
  28121. getEnabledStepIndex(startIndex, direction = "next") {
  28122. var _a;
  28123. const { items, currentPosition } = this;
  28124. let newIndex = startIndex;
  28125. while ((_a = items[newIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
  28126. newIndex = newIndex + (direction === "previous" ? -1 : 1);
  28127. }
  28128. return newIndex !== currentPosition && newIndex < items.length && newIndex >= 0
  28129. ? newIndex
  28130. : null;
  28131. }
  28132. addHorizontalContentContainer() {
  28133. this.stepperContentContainer = document.createElement("div");
  28134. this.stepperContentContainer.classList.add("calcite-stepper-content");
  28135. this.el.insertAdjacentElement("beforeend", this.stepperContentContainer);
  28136. }
  28137. emitChangedItem(position) {
  28138. this.currentPosition = position;
  28139. this.calciteStepperItemChange.emit({
  28140. position
  28141. });
  28142. }
  28143. focusFirstItem() {
  28144. const firstItem = this.enabledItems[0];
  28145. this.focusElement(firstItem);
  28146. }
  28147. focusLastItem() {
  28148. const lastItem = this.enabledItems[this.enabledItems.length - 1];
  28149. this.focusElement(lastItem);
  28150. }
  28151. focusNextItem(e) {
  28152. const index = this.itemIndex(e);
  28153. const nextItem = this.enabledItems[index + 1] || this.enabledItems[0];
  28154. this.focusElement(nextItem);
  28155. }
  28156. focusPrevItem(e) {
  28157. const index = this.itemIndex(e);
  28158. const prevItem = this.enabledItems[index - 1] || this.enabledItems[this.enabledItems.length - 1];
  28159. this.focusElement(prevItem);
  28160. }
  28161. itemIndex(e) {
  28162. return this.enabledItems.indexOf(e);
  28163. }
  28164. focusElement(item) {
  28165. item.focus();
  28166. }
  28167. sortItems() {
  28168. const { itemMap } = this;
  28169. return Array.from(itemMap.keys()).sort((a, b) => itemMap.get(a) - itemMap.get(b));
  28170. }
  28171. filterItems() {
  28172. return this.items.filter((item) => !item.disabled);
  28173. }
  28174. updateContent(content) {
  28175. this.stepperContentContainer.innerHTML = "";
  28176. this.stepperContentContainer.append(...content);
  28177. }
  28178. get el() { return getElement(this); }
  28179. static get watchers() { return {
  28180. "requestedContent": ["contentWatcher"]
  28181. }; }
  28182. static get style() { return stepperCss; }
  28183. static get cmpMeta() { return {
  28184. "$flags$": 9,
  28185. "$tagName$": "calcite-stepper",
  28186. "$members$": {
  28187. "icon": [516],
  28188. "layout": [513],
  28189. "numbered": [516],
  28190. "scale": [513],
  28191. "requestedContent": [1040],
  28192. "nextStep": [64],
  28193. "prevStep": [64],
  28194. "goToStep": [64],
  28195. "startStep": [64],
  28196. "endStep": [64]
  28197. },
  28198. "$listeners$": [[0, "calciteStepperItemKeyEvent", "calciteStepperItemKeyEvent"], [0, "calciteStepperItemRegister", "registerItem"], [0, "calciteStepperItemSelect", "updateItem"]],
  28199. "$lazyBundleId$": "-",
  28200. "$attrsToReflect$": [["icon", "icon"], ["layout", "layout"], ["numbered", "numbered"], ["scale", "scale"]]
  28201. }; }
  28202. }
  28203. const stepperItemCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-stepper-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-stepper-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-stepper-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-stepper-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-stepper-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-stepper-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-stepper-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-stepper-item-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-stepper-item-h{--calcite-stepper-item-spacing-unit-s:0.25rem;--calcite-stepper-item-spacing-unit-m:0.75rem;--calcite-stepper-item-spacing-unit-l:1rem;font-size:var(--calcite-font-size--1);line-height:1rem;-webkit-margin-end:0.25rem;margin-inline-end:0.25rem}/*!@:host([scale=s]) .stepper-item-subtitle*/[scale=s].sc-calcite-stepper-item-h .stepper-item-subtitle.sc-calcite-stepper-item{font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-stepper-item-h{--calcite-stepper-item-spacing-unit-s:0.5rem;--calcite-stepper-item-spacing-unit-m:1rem;--calcite-stepper-item-spacing-unit-l:1.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}/*!@:host([scale=m]) .stepper-item-subtitle*/[scale=m].sc-calcite-stepper-item-h .stepper-item-subtitle.sc-calcite-stepper-item{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-stepper-item-h{--calcite-stepper-item-spacing-unit-s:0.75rem;--calcite-stepper-item-spacing-unit-m:1.25rem;--calcite-stepper-item-spacing-unit-l:1.5rem;font-size:var(--calcite-font-size-1);line-height:1.5rem;-webkit-margin-end:0.75rem;margin-inline-end:0.75rem}/*!@:host([scale=l]) .stepper-item-subtitle*/[scale=l].sc-calcite-stepper-item-h .stepper-item-subtitle.sc-calcite-stepper-item{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host*/.sc-calcite-stepper-item-h{position:relative;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-direction:column;flex-direction:column;margin-bottom:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host .container*/.sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{position:relative;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;cursor:pointer;-ms-flex-direction:column;flex-direction:column;border-width:0px;border-top-width:2px;border-style:solid;border-color:var(--calcite-ui-border-3);color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host*/.sc-calcite-stepper-item-h{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host(:focus)*/.sc-calcite-stepper-item-h:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@:host .stepper-item-header*/.sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:start;align-items:flex-start}/*!@:host .stepper-item-content, :host .stepper-item-header*/.sc-calcite-stepper-item-h .stepper-item-content.sc-calcite-stepper-item,.sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);padding-block:var(--calcite-stepper-item-spacing-unit-l);-webkit-padding-end:var(--calcite-stepper-item-spacing-unit-m);padding-inline-end:var(--calcite-stepper-item-spacing-unit-m);text-align:start}/*!@:host .stepper-item-header **/.sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item *.sc-calcite-stepper-item{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .stepper-item-content*/.sc-calcite-stepper-item-h .stepper-item-content.sc-calcite-stepper-item{display:none;width:100%;-ms-flex-direction:column;flex-direction:column;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host .stepper-item-icon*/.sc-calcite-stepper-item-h .stepper-item-icon.sc-calcite-stepper-item{-webkit-margin-end:var(--calcite-stepper-item-spacing-unit-m);margin-inline-end:var(--calcite-stepper-item-spacing-unit-m);margin-top:1px;display:-ms-inline-flexbox;display:inline-flex;height:0.75rem;-ms-flex-negative:0;flex-shrink:0;-ms-flex-item-align:start;align-self:flex-start;color:var(--calcite-ui-text-3);opacity:var(--calcite-ui-opacity-disabled);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .stepper-item-header-text*/.sc-calcite-stepper-item-h .stepper-item-header-text.sc-calcite-stepper-item{-ms-flex-direction:column;flex-direction:column;text-align:initial;-webkit-margin-end:auto;margin-inline-end:auto}/*!@:host .stepper-item-title, :host .stepper-item-subtitle*/.sc-calcite-stepper-item-h .stepper-item-title.sc-calcite-stepper-item,.sc-calcite-stepper-item-h .stepper-item-subtitle.sc-calcite-stepper-item{display:-ms-flexbox;display:flex;width:100%}/*!@:host .stepper-item-title*/.sc-calcite-stepper-item-h .stepper-item-title.sc-calcite-stepper-item{margin-bottom:0.25rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}/*!@:host .stepper-item-subtitle*/.sc-calcite-stepper-item-h .stepper-item-subtitle.sc-calcite-stepper-item{color:var(--calcite-ui-text-3)}/*!@:host .stepper-item-number*/.sc-calcite-stepper-item-h .stepper-item-number.sc-calcite-stepper-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-3);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-margin-end:var(--calcite-stepper-item-spacing-unit-m);margin-inline-end:var(--calcite-stepper-item-spacing-unit-m)}/*!@:host([disabled])*/[disabled].sc-calcite-stepper-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-stepper-item-h[disabled] .sc-calcite-stepper-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-stepper-item-h [calcite-hydrated][disabled].sc-calcite-stepper-item{opacity:1}/*!@:host([complete]) .container*/[complete].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([complete]) .container .stepper-item-icon*/[complete].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{color:var(--calcite-ui-brand)}/*!@:host([error]) .container*/[error].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-top-color:var(--calcite-ui-danger)}/*!@:host([error]) .container .stepper-item-number*/[error].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-number.sc-calcite-stepper-item{color:var(--calcite-ui-danger)}/*!@:host([error]) .container .stepper-item-icon*/[error].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{opacity:1;color:var(--calcite-ui-danger)}/*!@:host(:hover:not([disabled]):not([active])) .container, :host(:focus:not([disabled]):not([active])) .container*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([active]) .container.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([active]) .container.sc-calcite-stepper-item{border-top-color:var(--calcite-ui-brand)}/*!@:host(:hover:not([disabled]):not([active])) .container .stepper-item-title, :host(:focus:not([disabled]):not([active])) .container .stepper-item-title*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([active]) .container.sc-calcite-stepper-item .stepper-item-title.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([active]) .container.sc-calcite-stepper-item .stepper-item-title.sc-calcite-stepper-item{color:var(--calcite-ui-text-1)}/*!@:host(:hover:not([disabled]):not([active])) .container .stepper-item-subtitle, :host(:focus:not([disabled]):not([active])) .container .stepper-item-subtitle*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([active]) .container.sc-calcite-stepper-item .stepper-item-subtitle.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([active]) .container.sc-calcite-stepper-item .stepper-item-subtitle.sc-calcite-stepper-item{color:var(--calcite-ui-text-2)}/*!@:host([error]:hover:not([disabled]):not([active])) .container, :host([error]:focus:not([disabled]):not([active])) .container*/[error].sc-calcite-stepper-item-h:hover:not([disabled]):not([active]) .container.sc-calcite-stepper-item,[error].sc-calcite-stepper-item-h:focus:not([disabled]):not([active]) .container.sc-calcite-stepper-item{border-top-color:var(--calcite-ui-danger-hover)}/*!@:host([active]) .container*/[active].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-top-color:var(--calcite-ui-brand)}/*!@:host([active]) .container .stepper-item-title*/[active].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-title.sc-calcite-stepper-item{color:var(--calcite-ui-text-1)}/*!@:host([active]) .container .stepper-item-subtitle*/[active].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-subtitle.sc-calcite-stepper-item{color:var(--calcite-ui-text-2)}/*!@:host([active]) .container .stepper-item-number*/[active].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-number.sc-calcite-stepper-item{color:var(--calcite-ui-brand)}/*!@:host([active]) .container .stepper-item-icon*/[active].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{color:var(--calcite-ui-brand);opacity:1}/*!@:host([layout=vertical]) .container*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{margin-left:0px;margin-right:0px;margin-top:0px;-ms-flex:1 1 auto;flex:1 1 auto;border-top-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-top:0px;padding-bottom:0px;border-inline-start-width:2px;-webkit-padding-start:var(--calcite-stepper-item-spacing-unit-l);padding-inline-start:var(--calcite-stepper-item-spacing-unit-l)}/*!@:host([layout=vertical]) .container .stepper-item-icon*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{-ms-flex-order:3;order:3;margin-top:1px;margin-bottom:0px;-webkit-padding-start:var(--calcite-stepper-item-spacing-unit-s);padding-inline-start:var(--calcite-stepper-item-spacing-unit-s);-webkit-margin-start:auto;margin-inline-start:auto}/*!@:host([layout=vertical]) .container .stepper-item-header*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-header.sc-calcite-stepper-item{-webkit-padding-end:0px;padding-inline-end:0px}/*!@:host([layout=vertical]) .container .stepper-item-content*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-content.sc-calcite-stepper-item{padding:0px}/*!@:host([layout=vertical][active]) .container .stepper-item-content*/[layout=vertical][active].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-content.sc-calcite-stepper-item{display:-ms-flexbox;display:flex}/*!@:host([layout=vertical][active]) .container .stepper-item-content ::slotted(:last-child)*/.sc-calcite-stepper-item-h[layout=vertical][active] .container .stepper-item-content .sc-calcite-stepper-item-s>:last-child{margin-bottom:var(--calcite-stepper-item-spacing-unit-l)}/*!@:host([layout=vertical][complete]) .container*/[layout=vertical][complete].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=vertical][complete]:hover:not([disabled]):not([active])) .container, :host([layout=vertical][complete]:focus:not([disabled]):not([active])) .container*/[layout=vertical][complete].sc-calcite-stepper-item-h:hover:not([disabled]):not([active]) .container.sc-calcite-stepper-item,[layout=vertical][complete].sc-calcite-stepper-item-h:focus:not([disabled]):not([active]) .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=vertical][error]) .container*/[layout=vertical][error].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger)}/*!@:host([layout=vertical][active]) .container*/[layout=vertical][active].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=vertical]:hover:not([disabled]):not([active])) .container,\n:host([layout=vertical]:focus:not([disabled]):not([active])) .container*/[layout=vertical].sc-calcite-stepper-item-h:hover:not([disabled]):not([active]) .container.sc-calcite-stepper-item,[layout=vertical].sc-calcite-stepper-item-h:focus:not([disabled]):not([active]) .container.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=vertical][error]:hover:not([disabled]):not([active])) .container, :host([layout=vertical][error]:focus:not([disabled]):not([active])) .container*/[layout=vertical][error].sc-calcite-stepper-item-h:hover:not([disabled]):not([active]) .container.sc-calcite-stepper-item,[layout=vertical][error].sc-calcite-stepper-item-h:focus:not([disabled]):not([active]) .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger-hover)}";
  28204. /**
  28205. * @slot - A slot for adding custom content.
  28206. */
  28207. class StepperItem {
  28208. constructor(hostRef) {
  28209. registerInstance(this, hostRef);
  28210. this.calciteStepperItemKeyEvent = createEvent(this, "calciteStepperItemKeyEvent", 7);
  28211. this.calciteStepperItemSelect = createEvent(this, "calciteStepperItemSelect", 7);
  28212. this.calciteStepperItemRegister = createEvent(this, "calciteStepperItemRegister", 7);
  28213. //--------------------------------------------------------------------------
  28214. //
  28215. // Public Properties
  28216. //
  28217. //--------------------------------------------------------------------------
  28218. /** is the step active */
  28219. this.active = false;
  28220. /** has the step been completed */
  28221. this.complete = false;
  28222. /** does the step contain an error that needs to be resolved by the user */
  28223. this.error = false;
  28224. /** is the step disabled and not navigable to by a user */
  28225. this.disabled = false;
  28226. /** should the items display an icon based on status */
  28227. /** @internal */
  28228. this.icon = false;
  28229. /** optionally display the step number next to the title and subtitle */
  28230. /** @internal */
  28231. this.numbered = false;
  28232. /** the scale of the item */
  28233. /** @internal */
  28234. this.scale = "m";
  28235. //--------------------------------------------------------------------------
  28236. //
  28237. // Private Methods
  28238. //
  28239. //--------------------------------------------------------------------------
  28240. this.keyDownHandler = (e) => {
  28241. if (!this.disabled && e.target === this.el) {
  28242. switch (e.key) {
  28243. case " ":
  28244. case "Enter":
  28245. this.emitRequestedItem();
  28246. e.preventDefault();
  28247. break;
  28248. case "ArrowUp":
  28249. case "ArrowDown":
  28250. case "ArrowLeft":
  28251. case "ArrowRight":
  28252. case "Home":
  28253. case "End":
  28254. this.calciteStepperItemKeyEvent.emit({ item: e });
  28255. e.preventDefault();
  28256. break;
  28257. }
  28258. }
  28259. };
  28260. this.emitRequestedItem = () => {
  28261. if (!this.disabled) {
  28262. this.calciteStepperItemSelect.emit({
  28263. position: this.itemPosition,
  28264. content: this.itemContent
  28265. });
  28266. }
  28267. };
  28268. this.setItemContent = (event) => {
  28269. this.itemPosition = this.getItemPosition();
  28270. const itemContent = event.target.assignedNodes({ flatten: true });
  28271. if (itemContent.length) {
  28272. this.itemContent = itemContent;
  28273. }
  28274. this.registerStepperItem();
  28275. if (this.active) {
  28276. this.emitRequestedItem();
  28277. }
  28278. };
  28279. }
  28280. // watch for removal of disabled to register step
  28281. disabledWatcher() {
  28282. this.registerStepperItem();
  28283. }
  28284. //--------------------------------------------------------------------------
  28285. //
  28286. // Lifecycle
  28287. //
  28288. //--------------------------------------------------------------------------
  28289. componentWillLoad() {
  28290. this.icon = getElementProp(this.el, "icon", false);
  28291. this.numbered = getElementProp(this.el, "numbered", false);
  28292. this.layout = getElementProp(this.el, "layout", false);
  28293. this.scale = getElementProp(this.el, "scale", "m");
  28294. this.parentStepperEl = this.el.parentElement;
  28295. }
  28296. componentDidRender() {
  28297. updateHostInteraction(this, true);
  28298. }
  28299. render() {
  28300. return (hAsync(Host, { "aria-expanded": toAriaBoolean(this.active), onClick: this.emitRequestedItem, onKeyDown: this.keyDownHandler }, hAsync("div", { class: "container" }, hAsync("div", { class: "stepper-item-header" }, this.icon ? this.renderIcon() : null, this.numbered ? (hAsync("div", { class: "stepper-item-number" }, this.getItemPosition() + 1, ".")) : null, hAsync("div", { class: "stepper-item-header-text" }, hAsync("span", { class: "stepper-item-title" }, this.itemTitle), hAsync("span", { class: "stepper-item-subtitle" }, this.itemSubtitle))), hAsync("div", { class: "stepper-item-content" }, hAsync("slot", { onSlotchange: this.setItemContent })))));
  28301. }
  28302. //--------------------------------------------------------------------------
  28303. //
  28304. // Event Listeners
  28305. //
  28306. //--------------------------------------------------------------------------
  28307. updateActiveItemOnChange(event) {
  28308. if (event.target === this.parentStepperEl ||
  28309. event.composedPath().includes(this.parentStepperEl)) {
  28310. this.activePosition = event.detail.position;
  28311. this.determineActiveItem();
  28312. }
  28313. }
  28314. renderIcon() {
  28315. const path = this.active
  28316. ? "circleF"
  28317. : this.error
  28318. ? "exclamationMarkCircleF"
  28319. : this.complete
  28320. ? "checkCircleF"
  28321. : "circle";
  28322. return hAsync("calcite-icon", { class: "stepper-item-icon", icon: path, scale: "s" });
  28323. }
  28324. determineActiveItem() {
  28325. this.active = !this.disabled && this.itemPosition === this.activePosition;
  28326. }
  28327. registerStepperItem() {
  28328. this.calciteStepperItemRegister.emit({
  28329. position: this.itemPosition,
  28330. content: this.itemContent
  28331. });
  28332. }
  28333. getItemPosition() {
  28334. return Array.prototype.indexOf.call(this.parentStepperEl.querySelectorAll("calcite-stepper-item"), this.el);
  28335. }
  28336. get el() { return getElement(this); }
  28337. static get watchers() { return {
  28338. "disabled": ["disabledWatcher"]
  28339. }; }
  28340. static get style() { return stepperItemCss; }
  28341. static get cmpMeta() { return {
  28342. "$flags$": 9,
  28343. "$tagName$": "calcite-stepper-item",
  28344. "$members$": {
  28345. "active": [1540],
  28346. "complete": [516],
  28347. "error": [4],
  28348. "disabled": [516],
  28349. "itemTitle": [1, "item-title"],
  28350. "itemSubtitle": [1, "item-subtitle"],
  28351. "layout": [1537],
  28352. "icon": [1028],
  28353. "numbered": [1028],
  28354. "scale": [1537]
  28355. },
  28356. "$listeners$": [[16, "calciteStepperItemChange", "updateActiveItemOnChange"]],
  28357. "$lazyBundleId$": "-",
  28358. "$attrsToReflect$": [["active", "active"], ["complete", "complete"], ["disabled", "disabled"], ["layout", "layout"], ["scale", "scale"]]
  28359. }; }
  28360. }
  28361. const switchCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-switch:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-switch{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-switch{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-switch{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-switch{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-switch{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-switch:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-switch-h{display:none}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-switch-h .container.sc-calcite-switch{height:0.75rem}/*!@:host([scale=s]) .track*/[scale=s].sc-calcite-switch-h .track.sc-calcite-switch{height:0.75rem;width:1.5rem}/*!@:host([scale=s]) .handle*/[scale=s].sc-calcite-switch-h .handle.sc-calcite-switch{height:0.5rem;width:0.5rem}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-switch-h .container.sc-calcite-switch{height:1rem}/*!@:host([scale=m]) .track*/[scale=m].sc-calcite-switch-h .track.sc-calcite-switch{height:1rem;width:2rem}/*!@:host([scale=m]) .handle*/[scale=m].sc-calcite-switch-h .handle.sc-calcite-switch{height:0.75rem;width:0.75rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-switch-h .container.sc-calcite-switch{height:1.5rem}/*!@:host([scale=l]) .track*/[scale=l].sc-calcite-switch-h .track.sc-calcite-switch{height:1.5rem;width:3rem}/*!@:host([scale=l]) .handle*/[scale=l].sc-calcite-switch-h .handle.sc-calcite-switch{height:1.25rem;width:1.25rem}/*!@:host*/.sc-calcite-switch-h{position:relative;display:inline-block;width:auto;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;tap-highlight-color:transparent}/*!@:host([disabled])*/[disabled].sc-calcite-switch-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-switch-h[disabled] .sc-calcite-switch-s>[calcite-hydrated][disabled],[disabled].sc-calcite-switch-h [calcite-hydrated][disabled].sc-calcite-switch{opacity:1}/*!@:host*/.sc-calcite-switch-h{width:auto;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@.track*/.track.sc-calcite-switch{pointer-events:none;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-2);vertical-align:top;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@.handle*/.handle.sc-calcite-switch{pointer-events:none;position:absolute;display:block;border-radius:9999px;border-width:2px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);top:-1px;inset-inline:-1px auto}/*!@:host(:hover) .handle, :host(:focus) .handle*/.sc-calcite-switch-h:hover .handle.sc-calcite-switch,.sc-calcite-switch-h:focus .handle.sc-calcite-switch{border-color:var(--calcite-ui-brand);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-brand);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand)}/*!@:host([checked]) .track*/[checked].sc-calcite-switch-h .track.sc-calcite-switch{border-color:var(--calcite-ui-brand-hover);background-color:var(--calcite-ui-brand)}/*!@:host([checked]) .handle*/[checked].sc-calcite-switch-h .handle.sc-calcite-switch{border-color:var(--calcite-ui-brand);inset-inline:auto -1px}/*!@:host([checked]:hover) .track*/[checked].sc-calcite-switch-h:hover .track.sc-calcite-switch{border-color:var(--calcite-ui-brand-hover);background-color:var(--calcite-ui-brand)}/*!@:host([checked]:hover) .handle*/[checked].sc-calcite-switch-h:hover .handle.sc-calcite-switch{border-color:var(--calcite-ui-brand-hover);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover)}@media (forced-colors: active){/*!@:host([checked]) .track*/[checked].sc-calcite-switch-h .track.sc-calcite-switch{background-color:canvasText}}/*!@.container:focus*/.container.sc-calcite-switch:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-switch-s>input[slot=hidden-form-input]{bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  28362. class Switch {
  28363. constructor(hostRef) {
  28364. registerInstance(this, hostRef);
  28365. this.calciteSwitchChange = createEvent(this, "calciteSwitchChange", 7);
  28366. //--------------------------------------------------------------------------
  28367. //
  28368. // Properties
  28369. //
  28370. //--------------------------------------------------------------------------
  28371. /** True if the switch is disabled */
  28372. this.disabled = false;
  28373. /** The scale of the switch */
  28374. this.scale = "m";
  28375. /** True if the switch is initially on
  28376. * @deprecated use 'checked' instead.
  28377. */
  28378. this.switched = false;
  28379. /** True if the switch is initially on */
  28380. this.checked = false;
  28381. //--------------------------------------------------------------------------
  28382. //
  28383. // Private Methods
  28384. //
  28385. //--------------------------------------------------------------------------
  28386. this.keyDownHandler = (e) => {
  28387. const key = e.key;
  28388. if (!this.disabled && (key === " " || key === "Enter")) {
  28389. this.toggle();
  28390. e.preventDefault();
  28391. }
  28392. };
  28393. this.clickHandler = () => {
  28394. this.toggle();
  28395. };
  28396. this.setSwitchEl = (el) => {
  28397. this.switchEl = el;
  28398. };
  28399. }
  28400. switchedWatcher(switched) {
  28401. this.checked = switched;
  28402. }
  28403. //--------------------------------------------------------------------------
  28404. //
  28405. // Public Methods
  28406. //
  28407. //--------------------------------------------------------------------------
  28408. /** Sets focus on the component. */
  28409. async setFocus() {
  28410. focusElement(this.switchEl);
  28411. }
  28412. onLabelClick() {
  28413. if (!this.disabled) {
  28414. this.toggle();
  28415. this.setFocus();
  28416. }
  28417. }
  28418. toggle() {
  28419. this.checked = !this.checked;
  28420. this.calciteSwitchChange.emit({
  28421. // todo: We should remove emmitting redudant props in event payload.
  28422. // https://github.com/Esri/calcite-components/issues/3163
  28423. switched: this.checked
  28424. });
  28425. }
  28426. //--------------------------------------------------------------------------
  28427. //
  28428. // Lifecycle
  28429. //
  28430. //--------------------------------------------------------------------------
  28431. connectedCallback() {
  28432. const initiallyChecked = this.checked || this.switched;
  28433. if (initiallyChecked) {
  28434. // if either prop is set, we ensure both are synced initially
  28435. this.switched = this.checked = initiallyChecked;
  28436. }
  28437. connectLabel(this);
  28438. connectForm(this);
  28439. }
  28440. disconnectedCallback() {
  28441. disconnectLabel(this);
  28442. disconnectForm(this);
  28443. }
  28444. componentDidRender() {
  28445. updateHostInteraction(this);
  28446. }
  28447. // --------------------------------------------------------------------------
  28448. //
  28449. // Render Methods
  28450. //
  28451. // --------------------------------------------------------------------------
  28452. render() {
  28453. return (hAsync(Host, { onClick: this.clickHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { "aria-checked": toAriaBoolean(this.checked), "aria-label": getLabelText(this), class: "container", ref: this.setSwitchEl, role: "switch", tabIndex: 0 }, hAsync("div", { class: "track" }, hAsync("div", { class: "handle" })), hAsync(HiddenFormInputSlot, { component: this }))));
  28454. }
  28455. get el() { return getElement(this); }
  28456. static get watchers() { return {
  28457. "switched": ["switchedWatcher"]
  28458. }; }
  28459. static get style() { return switchCss; }
  28460. static get cmpMeta() { return {
  28461. "$flags$": 9,
  28462. "$tagName$": "calcite-switch",
  28463. "$members$": {
  28464. "disabled": [516],
  28465. "label": [1],
  28466. "name": [513],
  28467. "scale": [513],
  28468. "switched": [1028],
  28469. "checked": [1540],
  28470. "value": [8],
  28471. "setFocus": [64]
  28472. },
  28473. "$listeners$": undefined,
  28474. "$lazyBundleId$": "-",
  28475. "$attrsToReflect$": [["disabled", "disabled"], ["name", "name"], ["scale", "scale"], ["checked", "checked"]]
  28476. }; }
  28477. }
  28478. const tabCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tab:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tab{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tab:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-h{display:none}/*!@:host([active]) section*/[active].sc-calcite-tab-h section.sc-calcite-tab{display:block}/*!@:host*/.sc-calcite-tab-h{display:none;height:100%;width:100%}/*!@:host([active])*/[active].sc-calcite-tab-h{display:block;height:100%;width:100%;overflow:auto}/*!@section*/section.sc-calcite-tab{display:none;height:100%;width:100%}/*!@:host([scale=s])*/[scale=s].sc-calcite-tab-h{padding-top:0.25rem;padding-bottom:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-tab-h{padding-top:0.5rem;padding-bottom:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-h{padding-top:0.75rem;padding-bottom:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}";
  28479. /**
  28480. * @slot - A slot for adding custom content.
  28481. */
  28482. class Tab {
  28483. constructor(hostRef) {
  28484. registerInstance(this, hostRef);
  28485. this.calciteTabRegister = createEvent(this, "calciteTabRegister", 7);
  28486. /**
  28487. * Show this tab
  28488. */
  28489. this.active = false;
  28490. /** @internal Parent tabs component scale value */
  28491. this.scale = "m";
  28492. this.guid = `calcite-tab-title-${guid()}`;
  28493. }
  28494. //--------------------------------------------------------------------------
  28495. //
  28496. // Lifecycle
  28497. //
  28498. //--------------------------------------------------------------------------
  28499. render() {
  28500. const id = this.el.id || this.guid;
  28501. return (hAsync(Host, { "aria-expanded": toAriaBoolean(this.active), "aria-labelledby": this.labeledBy, id: id, role: "tabpanel" }, hAsync("section", null, hAsync("slot", null))));
  28502. }
  28503. connectedCallback() {
  28504. this.parentTabsEl = this.el.closest("calcite-tabs");
  28505. }
  28506. componentDidLoad() {
  28507. this.calciteTabRegister.emit();
  28508. }
  28509. componentWillRender() {
  28510. var _a;
  28511. this.scale = (_a = this.parentTabsEl) === null || _a === void 0 ? void 0 : _a.scale;
  28512. }
  28513. disconnectedCallback() {
  28514. var _a;
  28515. // Dispatching to body in order to be listened by other elements that are still connected to the DOM.
  28516. (_a = document.body) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent("calciteTabUnregister", {
  28517. detail: this.el
  28518. }));
  28519. }
  28520. //--------------------------------------------------------------------------
  28521. //
  28522. // Event Listeners
  28523. //
  28524. //--------------------------------------------------------------------------
  28525. internalTabChangeHandler(event) {
  28526. const targetTabsEl = event
  28527. .composedPath()
  28528. .find((el) => el.tagName === "CALCITE-TABS");
  28529. // to allow `<calcite-tabs>` to be nested we need to make sure this
  28530. // `calciteTabChange` event was actually fired from a within the same
  28531. // `<calcite-tabs>` that is the a parent of this tab.
  28532. if (targetTabsEl !== this.parentTabsEl) {
  28533. return;
  28534. }
  28535. if (this.tab) {
  28536. this.active = this.tab === event.detail.tab;
  28537. }
  28538. else {
  28539. this.getTabIndex().then((index) => {
  28540. this.active = index === event.detail.tab;
  28541. });
  28542. }
  28543. }
  28544. //--------------------------------------------------------------------------
  28545. //
  28546. // Public Methods
  28547. //
  28548. //--------------------------------------------------------------------------
  28549. /**
  28550. * Return the index of this tab within the tab array
  28551. */
  28552. async getTabIndex() {
  28553. return Array.prototype.indexOf.call(nodeListToArray(this.el.parentElement.children).filter((e) => e.matches("calcite-tab")), this.el);
  28554. }
  28555. //--------------------------------------------------------------------------
  28556. //
  28557. // Private Methods
  28558. //
  28559. //--------------------------------------------------------------------------
  28560. /**
  28561. * @internal
  28562. */
  28563. async updateAriaInfo(tabIds = [], titleIds = []) {
  28564. this.labeledBy = titleIds[tabIds.indexOf(this.el.id)] || null;
  28565. }
  28566. get el() { return getElement(this); }
  28567. static get style() { return tabCss; }
  28568. static get cmpMeta() { return {
  28569. "$flags$": 9,
  28570. "$tagName$": "calcite-tab",
  28571. "$members$": {
  28572. "tab": [513],
  28573. "active": [1540],
  28574. "scale": [1537],
  28575. "labeledBy": [32],
  28576. "getTabIndex": [64],
  28577. "updateAriaInfo": [64]
  28578. },
  28579. "$listeners$": [[16, "calciteInternalTabChange", "internalTabChangeHandler"]],
  28580. "$lazyBundleId$": "-",
  28581. "$attrsToReflect$": [["tab", "tab"], ["active", "active"], ["scale", "scale"]]
  28582. }; }
  28583. }
  28584. const tabNavCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tab-nav:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tab-nav{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab-nav{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab-nav{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab-nav{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab-nav{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tab-nav:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-nav-h{display:none}/*!@:host*/.sc-calcite-tab-nav-h{position:relative;display:-ms-flexbox;display:flex}/*!@:host([scale=s])*/[scale=s].sc-calcite-tab-nav-h{min-height:1.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-tab-nav-h{min-height:2rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-nav-h{min-height:2.75rem}/*!@.tab-nav*/.tab-nav.sc-calcite-tab-nav{display:-ms-flexbox;display:flex;width:100%;-ms-flex-pack:start;justify-content:flex-start;overflow:auto}/*!@:host([layout=center]) .tab-nav*/[layout=center].sc-calcite-tab-nav-h .tab-nav.sc-calcite-tab-nav{-ms-flex-pack:center;justify-content:center}/*!@.tab-nav-active-indicator-container*/.tab-nav-active-indicator-container.sc-calcite-tab-nav{position:absolute;left:0px;right:0px;bottom:0px;height:0.125rem;width:100%;overflow:hidden}/*!@.tab-nav-active-indicator*/.tab-nav-active-indicator.sc-calcite-tab-nav{position:absolute;bottom:0px;display:block;height:0.125rem;background-color:var(--calcite-ui-brand);-webkit-transition-property:all;transition-property:all;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}/*!@:host([position=below]) .tab-nav-active-indicator*/[position=below].sc-calcite-tab-nav-h .tab-nav-active-indicator.sc-calcite-tab-nav{bottom:unset;top:0px}/*!@:host([position=below]) .tab-nav-active-indicator-container*/[position=below].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{bottom:unset;top:0px}/*!@:host([bordered]) .tab-nav-active-indicator-container*/[bordered].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{bottom:unset}/*!@:host([bordered][position=below]) .tab-nav-active-indicator-container*/[bordered][position=below].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{bottom:0;top:unset}";
  28585. /**
  28586. * @slot - A slot for adding `calcite-tab-title`s.
  28587. */
  28588. class TabNav {
  28589. constructor(hostRef) {
  28590. registerInstance(this, hostRef);
  28591. this.calciteTabChange = createEvent(this, "calciteTabChange", 7);
  28592. this.calciteInternalTabChange = createEvent(this, "calciteInternalTabChange", 7);
  28593. /** @internal Parent tabs component scale value */
  28594. this.scale = "m";
  28595. /** @internal Parent tabs component layout value */
  28596. this.layout = "inline";
  28597. /** @internal Parent tabs component position value */
  28598. this.position = "below";
  28599. /** @internal Parent tabs component bordered value when layout is "inline" */
  28600. this.bordered = false;
  28601. this.animationActiveDuration = 0.3;
  28602. this.resizeObserver = createObserver();
  28603. //--------------------------------------------------------------------------
  28604. //
  28605. // Private Methods
  28606. //
  28607. //--------------------------------------------------------------------------
  28608. this.handleContainerScroll = () => {
  28609. // remove active indicator transition duration while container is scrolling to prevent wobble
  28610. this.activeIndicatorEl.style.transitionDuration = "0s";
  28611. this.updateOffsetPosition();
  28612. };
  28613. }
  28614. async selectedTabChanged() {
  28615. if (localStorage &&
  28616. this.storageId &&
  28617. this.selectedTab !== undefined &&
  28618. this.selectedTab !== null) {
  28619. localStorage.setItem(`calcite-tab-nav-${this.storageId}`, JSON.stringify(this.selectedTab));
  28620. }
  28621. this.calciteInternalTabChange.emit({
  28622. tab: this.selectedTab
  28623. });
  28624. this.selectedTabEl = await this.getTabTitleById(this.selectedTab);
  28625. }
  28626. selectedTabElChanged() {
  28627. this.updateOffsetPosition();
  28628. this.updateActiveWidth();
  28629. // reset the animation time on tab selection
  28630. this.activeIndicatorEl.style.transitionDuration = `${this.animationActiveDuration}s`;
  28631. }
  28632. //--------------------------------------------------------------------------
  28633. //
  28634. // Lifecycle
  28635. //
  28636. //--------------------------------------------------------------------------
  28637. connectedCallback() {
  28638. var _a;
  28639. this.parentTabsEl = this.el.closest("calcite-tabs");
  28640. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el);
  28641. }
  28642. disconnectedCallback() {
  28643. var _a;
  28644. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  28645. }
  28646. componentWillLoad() {
  28647. const storageKey = `calcite-tab-nav-${this.storageId}`;
  28648. if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
  28649. const storedTab = JSON.parse(localStorage.getItem(storageKey));
  28650. this.selectedTab = storedTab;
  28651. }
  28652. }
  28653. componentWillRender() {
  28654. const { parentTabsEl } = this;
  28655. this.layout = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.layout;
  28656. this.position = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.position;
  28657. this.scale = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.scale;
  28658. this.bordered = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.bordered;
  28659. // fix issue with active tab-title not lining up with blue indicator
  28660. if (this.selectedTabEl) {
  28661. this.updateOffsetPosition();
  28662. }
  28663. }
  28664. componentDidRender() {
  28665. // if every tab title is active select the first tab.
  28666. if (this.tabTitles.length &&
  28667. this.tabTitles.every((title) => !title.active) &&
  28668. !this.selectedTab) {
  28669. this.tabTitles[0].getTabIdentifier().then((tab) => {
  28670. this.calciteInternalTabChange.emit({
  28671. tab
  28672. });
  28673. });
  28674. }
  28675. }
  28676. render() {
  28677. const dir = getElementDir(this.el);
  28678. const width = `${this.indicatorWidth}px`;
  28679. const offset = `${this.indicatorOffset}px`;
  28680. const indicatorStyle = dir !== "rtl" ? { width, left: offset } : { width, right: offset };
  28681. return (hAsync(Host, { role: "tablist" }, hAsync("div", { class: "tab-nav", onScroll: this.handleContainerScroll, ref: (el) => (this.tabNavEl = el) }, hAsync("div", { class: "tab-nav-active-indicator-container", ref: (el) => (this.activeIndicatorContainerEl = el) }, hAsync("div", { class: "tab-nav-active-indicator", ref: (el) => (this.activeIndicatorEl = el), style: indicatorStyle })), hAsync("slot", null))));
  28682. }
  28683. //--------------------------------------------------------------------------
  28684. //
  28685. // Event Listeners
  28686. //
  28687. //--------------------------------------------------------------------------
  28688. focusPreviousTabHandler(e) {
  28689. const currentIndex = this.getIndexOfTabTitle(e.target, this.enabledTabTitles);
  28690. const previousTab = this.enabledTabTitles[currentIndex - 1] ||
  28691. this.enabledTabTitles[this.enabledTabTitles.length - 1];
  28692. previousTab.focus();
  28693. e.stopPropagation();
  28694. e.preventDefault();
  28695. }
  28696. focusNextTabHandler(e) {
  28697. const currentIndex = this.getIndexOfTabTitle(e.target, this.enabledTabTitles);
  28698. const nextTab = this.enabledTabTitles[currentIndex + 1] || this.enabledTabTitles[0];
  28699. nextTab.focus();
  28700. e.stopPropagation();
  28701. e.preventDefault();
  28702. }
  28703. internalActivateTabHandler(e) {
  28704. this.selectedTab = e.detail.tab
  28705. ? e.detail.tab
  28706. : this.getIndexOfTabTitle(e.target);
  28707. e.stopPropagation();
  28708. e.preventDefault();
  28709. }
  28710. activateTabHandler(e) {
  28711. this.calciteTabChange.emit({
  28712. tab: this.selectedTab
  28713. });
  28714. e.stopPropagation();
  28715. e.preventDefault();
  28716. }
  28717. /**
  28718. * Check for active tabs on register and update selected
  28719. */
  28720. updateTabTitles(e) {
  28721. if (e.target.active) {
  28722. this.selectedTab = e.detail;
  28723. }
  28724. }
  28725. globalInternalTabChangeHandler(e) {
  28726. if (this.syncId &&
  28727. e.target !== this.el &&
  28728. e.target.syncId === this.syncId &&
  28729. this.selectedTab !== e.detail.tab) {
  28730. this.selectedTab = e.detail.tab;
  28731. e.stopPropagation();
  28732. }
  28733. }
  28734. updateOffsetPosition() {
  28735. var _a, _b, _c, _d, _e;
  28736. const dir = getElementDir(this.el);
  28737. const navWidth = (_a = this.activeIndicatorContainerEl) === null || _a === void 0 ? void 0 : _a.offsetWidth;
  28738. const tabLeft = (_b = this.selectedTabEl) === null || _b === void 0 ? void 0 : _b.offsetLeft;
  28739. const tabWidth = (_c = this.selectedTabEl) === null || _c === void 0 ? void 0 : _c.offsetWidth;
  28740. const offsetRight = navWidth - (tabLeft + tabWidth);
  28741. this.indicatorOffset =
  28742. dir !== "rtl" ? tabLeft - ((_d = this.tabNavEl) === null || _d === void 0 ? void 0 : _d.scrollLeft) : offsetRight + ((_e = this.tabNavEl) === null || _e === void 0 ? void 0 : _e.scrollLeft);
  28743. }
  28744. updateActiveWidth() {
  28745. var _a;
  28746. this.indicatorWidth = (_a = this.selectedTabEl) === null || _a === void 0 ? void 0 : _a.offsetWidth;
  28747. }
  28748. getIndexOfTabTitle(el, tabTitles = this.tabTitles) {
  28749. // In most cases, since these indexes correlate with tab contents, we want to consider all tab titles.
  28750. // However, when doing relative index operations, it makes sense to pass in this.enabledTabTitles as the 2nd arg.
  28751. return tabTitles.indexOf(el);
  28752. }
  28753. async getTabTitleById(id) {
  28754. return Promise.all(this.tabTitles.map((el) => el.getTabIdentifier())).then((ids) => {
  28755. return this.tabTitles[ids.indexOf(id)];
  28756. });
  28757. }
  28758. get tabTitles() {
  28759. return filterDirectChildren(this.el, "calcite-tab-title");
  28760. }
  28761. get enabledTabTitles() {
  28762. return filterDirectChildren(this.el, "calcite-tab-title:not([disabled])");
  28763. }
  28764. get el() { return getElement(this); }
  28765. static get watchers() { return {
  28766. "selectedTab": ["selectedTabChanged"],
  28767. "selectedTabEl": ["selectedTabElChanged"]
  28768. }; }
  28769. static get style() { return tabNavCss; }
  28770. static get cmpMeta() { return {
  28771. "$flags$": 9,
  28772. "$tagName$": "calcite-tab-nav",
  28773. "$members$": {
  28774. "storageId": [1, "storage-id"],
  28775. "syncId": [1, "sync-id"],
  28776. "scale": [1537],
  28777. "layout": [1537],
  28778. "position": [1537],
  28779. "bordered": [1540],
  28780. "indicatorOffset": [1026, "indicator-offset"],
  28781. "indicatorWidth": [1026, "indicator-width"],
  28782. "selectedTab": [32],
  28783. "selectedTabEl": [32]
  28784. },
  28785. "$listeners$": [[0, "calciteTabsFocusPrevious", "focusPreviousTabHandler"], [0, "calciteTabsFocusNext", "focusNextTabHandler"], [0, "calciteInternalTabsActivate", "internalActivateTabHandler"], [0, "calciteTabsActivate", "activateTabHandler"], [0, "calciteTabTitleRegister", "updateTabTitles"], [16, "calciteInternalTabChange", "globalInternalTabChangeHandler"]],
  28786. "$lazyBundleId$": "-",
  28787. "$attrsToReflect$": [["scale", "scale"], ["layout", "layout"], ["position", "position"], ["bordered", "bordered"]]
  28788. }; }
  28789. }
  28790. const tabTitleCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tab-title:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tab-title{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab-title{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab-title{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab-title{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab-title{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tab-title:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-title-h{display:none}/*!@:host*/.sc-calcite-tab-title-h{margin-right:1.25rem;display:block;-ms-flex:0 1 auto;flex:0 1 auto;outline:2px solid transparent;outline-offset:2px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:1.25rem;margin-inline-end:1.25rem}/*!@:host([layout=center])*/[layout=center].sc-calcite-tab-title-h{margin-top:0px;margin-bottom:0px;margin-left:1.25rem;margin-right:1.25rem;text-align:center;-ms-flex-preferred-size:12rem;flex-basis:12rem}/*!@:host([position=below]) a*/[position=below].sc-calcite-tab-title-h a.sc-calcite-tab-title{border-bottom-width:0px;border-top-width:2px;border-top-color:transparent;border-top-style:solid}/*!@:host a*/.sc-calcite-tab-title-h a.sc-calcite-tab-title{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host(:focus) a*/.sc-calcite-tab-title-h:focus a.sc-calcite-tab-title{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host(:active) a, :host(:focus) a, :host(:hover) a*/.sc-calcite-tab-title-h:active a.sc-calcite-tab-title,.sc-calcite-tab-title-h:focus a.sc-calcite-tab-title,.sc-calcite-tab-title-h:hover a.sc-calcite-tab-title{border-color:var(--calcite-ui-border-2);color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none}/*!@:host([active]) a*/[active].sc-calcite-tab-title-h a.sc-calcite-tab-title{border-color:transparent;color:var(--calcite-ui-text-1)}/*!@:host([disabled])*/[disabled].sc-calcite-tab-title-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) span, :host([disabled]) a*/[disabled].sc-calcite-tab-title-h span.sc-calcite-tab-title,[disabled].sc-calcite-tab-title-h a.sc-calcite-tab-title{pointer-events:none;opacity:0.5}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tab-title-h[disabled] .sc-calcite-tab-title-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tab-title-h [calcite-hydrated][disabled].sc-calcite-tab-title{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-tab-title-h{-webkit-margin-end:1rem;margin-inline-end:1rem}/*!@:host([scale=s]) a, :host([scale=s]) span*/[scale=s].sc-calcite-tab-title-h a.sc-calcite-tab-title,[scale=s].sc-calcite-tab-title-h span.sc-calcite-tab-title{padding-top:0.25rem;padding-bottom:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m]) a, :host([scale=m]) span*/[scale=m].sc-calcite-tab-title-h a.sc-calcite-tab-title,[scale=m].sc-calcite-tab-title-h span.sc-calcite-tab-title{padding-top:0.5rem;padding-bottom:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-title-h{-webkit-margin-end:1.5rem;margin-inline-end:1.5rem}/*!@:host([scale=l]) a, :host([scale=l]) span*/[scale=l].sc-calcite-tab-title-h a.sc-calcite-tab-title,[scale=l].sc-calcite-tab-title-h span.sc-calcite-tab-title{padding-top:0.75rem;padding-bottom:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@a, span*/a.sc-calcite-tab-title,span.sc-calcite-tab-title{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;height:100%;width:100%;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;-ms-flex-pack:center;justify-content:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom-width:2px;padding-left:0px;padding-right:0px;padding-top:0.5rem;padding-bottom:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-3);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;border-bottom-color:transparent;border-bottom-style:solid}/*!@span*/span.sc-calcite-tab-title{cursor:default}/*!@.calcite-tab-title--icon*/.calcite-tab-title--icon.sc-calcite-tab-title{position:relative;margin:0px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-item-align:center;align-self:center}/*!@.calcite-tab-title--icon svg*/.calcite-tab-title--icon.sc-calcite-tab-title svg.sc-calcite-tab-title{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@.container--has-text*/.container--has-text.sc-calcite-tab-title{padding:0.25rem}/*!@.container--has-text .calcite-tab-title--icon.icon-start*/.container--has-text.sc-calcite-tab-title .calcite-tab-title--icon.icon-start.sc-calcite-tab-title{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}/*!@.container--has-text .calcite-tab-title--icon.icon-end*/.container--has-text.sc-calcite-tab-title .calcite-tab-title--icon.icon-end.sc-calcite-tab-title{-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}/*!@:host([icon-start][icon-end]) .calcite-tab-title--icon:first-child*/[icon-start][icon-end].sc-calcite-tab-title-h .calcite-tab-title--icon.sc-calcite-tab-title:first-child{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}/*!@:host([bordered])*/[bordered].sc-calcite-tab-title-h{-webkit-margin-end:0;margin-inline-end:0}/*!@:host([bordered][active])*/[bordered][active].sc-calcite-tab-title-h{-webkit-box-shadow:inset 0px -2px var(--calcite-ui-foreground-1);box-shadow:inset 0px -2px var(--calcite-ui-foreground-1)}/*!@:host([bordered][active][position=below])*/[bordered][active][position=below].sc-calcite-tab-title-h{-webkit-box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1);box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}/*!@:host([bordered]:hover) a, :host([bordered]:focus) a, :host([bordered]:active) a*/[bordered].sc-calcite-tab-title-h:hover a.sc-calcite-tab-title,[bordered].sc-calcite-tab-title-h:focus a.sc-calcite-tab-title,[bordered].sc-calcite-tab-title-h:active a.sc-calcite-tab-title{position:relative}/*!@:host([bordered]:hover) a*/[bordered].sc-calcite-tab-title-h:hover a.sc-calcite-tab-title{background-color:var(--calcite-button-transparent-hover);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}/*!@:host([bordered]) a*/[bordered].sc-calcite-tab-title-h a.sc-calcite-tab-title{border-bottom-style:unset}/*!@:host([bordered][position=below]) a*/[bordered][position=below].sc-calcite-tab-title-h a.sc-calcite-tab-title{border-top-style:unset}/*!@:host([active][bordered]) a*/[active][bordered].sc-calcite-tab-title-h a.sc-calcite-tab-title{border-left:1px solid var(--calcite-ui-border-1);border-right:1px solid var(--calcite-ui-border-1)}/*!@:host([bordered]) a, :host([bordered]) span*/[bordered].sc-calcite-tab-title-h a.sc-calcite-tab-title,[bordered].sc-calcite-tab-title-h span.sc-calcite-tab-title{padding-left:0.75rem;padding-right:0.75rem}/*!@:host([bordered][scale=s]) a, :host([bordered][scale=s]) span*/[bordered][scale=s].sc-calcite-tab-title-h a.sc-calcite-tab-title,[bordered][scale=s].sc-calcite-tab-title-h span.sc-calcite-tab-title{padding-left:0.5rem;padding-right:0.5rem}/*!@:host([bordered][scale=l]) a, :host([bordered][scale=l]) span*/[bordered][scale=l].sc-calcite-tab-title-h a.sc-calcite-tab-title,[bordered][scale=l].sc-calcite-tab-title-h span.sc-calcite-tab-title{padding-left:1rem;padding-right:1rem}";
  28791. /**
  28792. * @slot - A slot for adding text.
  28793. */
  28794. class TabTitle {
  28795. constructor(hostRef) {
  28796. registerInstance(this, hostRef);
  28797. this.calciteTabsActivate = createEvent(this, "calciteTabsActivate", 7);
  28798. this.calciteInternalTabsActivate = createEvent(this, "calciteInternalTabsActivate", 7);
  28799. this.calciteTabsFocusNext = createEvent(this, "calciteTabsFocusNext", 7);
  28800. this.calciteTabsFocusPrevious = createEvent(this, "calciteTabsFocusPrevious", 7);
  28801. this.calciteTabTitleRegister = createEvent(this, "calciteTabTitleRegister", 7);
  28802. //--------------------------------------------------------------------------
  28803. //
  28804. // Properties
  28805. //
  28806. //--------------------------------------------------------------------------
  28807. /** Show this tab title as selected */
  28808. this.active = false;
  28809. /** Disable this tab title */
  28810. this.disabled = false;
  28811. /** @internal Parent tabs component bordered value */
  28812. this.bordered = false;
  28813. //--------------------------------------------------------------------------
  28814. //
  28815. // Private State/Props
  28816. //
  28817. //--------------------------------------------------------------------------
  28818. /** watches for changing text content **/
  28819. this.mutationObserver = createObserver();
  28820. /** determine if there is slotted text for styling purposes */
  28821. this.hasText = false;
  28822. this.guid = `calcite-tab-title-${guid()}`;
  28823. }
  28824. activeTabChanged() {
  28825. if (this.active) {
  28826. this.emitActiveTab(false);
  28827. }
  28828. }
  28829. //--------------------------------------------------------------------------
  28830. //
  28831. // Lifecycle
  28832. //
  28833. //--------------------------------------------------------------------------
  28834. connectedCallback() {
  28835. this.setupTextContentObserver();
  28836. this.parentTabNavEl = this.el.closest("calcite-tab-nav");
  28837. this.parentTabsEl = this.el.closest("calcite-tabs");
  28838. }
  28839. disconnectedCallback() {
  28840. var _a, _b;
  28841. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  28842. // Dispatching to body in order to be listened by other elements that are still connected to the DOM.
  28843. (_b = document.body) === null || _b === void 0 ? void 0 : _b.dispatchEvent(new CustomEvent("calciteTabTitleUnregister", {
  28844. detail: this.el
  28845. }));
  28846. }
  28847. componentWillLoad() {
  28848. if (this.tab && this.active) {
  28849. this.emitActiveTab(false);
  28850. }
  28851. }
  28852. componentWillRender() {
  28853. if (this.parentTabsEl) {
  28854. this.layout = this.parentTabsEl.layout;
  28855. this.position = this.parentTabsEl.position;
  28856. this.scale = this.parentTabsEl.scale;
  28857. this.bordered = this.parentTabsEl.bordered;
  28858. }
  28859. // handle case when tab-nav is only parent
  28860. if (!this.parentTabsEl && this.parentTabNavEl) {
  28861. this.position = getElementProp(this.parentTabNavEl, "position", this.position);
  28862. this.scale = getElementProp(this.parentTabNavEl, "scale", this.scale);
  28863. }
  28864. }
  28865. render() {
  28866. const id = this.el.id || this.guid;
  28867. const showSideBorders = this.bordered && !this.disabled && this.layout !== "center";
  28868. const iconStartEl = (hAsync("calcite-icon", { class: "calcite-tab-title--icon icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
  28869. const iconEndEl = (hAsync("calcite-icon", { class: "calcite-tab-title--icon icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
  28870. return (hAsync(Host, { "aria-controls": this.controls, "aria-expanded": toAriaBoolean(this.active), id: id, role: "tab" }, hAsync("a", { class: {
  28871. container: true,
  28872. "container--has-text": this.hasText
  28873. }, style: showSideBorders && { width: `${this.parentTabNavEl.indicatorWidth}px` } }, this.iconStart ? iconStartEl : null, hAsync("slot", null), this.iconEnd ? iconEndEl : null)));
  28874. }
  28875. async componentDidLoad() {
  28876. this.calciteTabTitleRegister.emit(await this.getTabIdentifier());
  28877. }
  28878. componentDidRender() {
  28879. updateHostInteraction(this, true);
  28880. }
  28881. //--------------------------------------------------------------------------
  28882. //
  28883. // Event Listeners
  28884. //
  28885. //--------------------------------------------------------------------------
  28886. internalTabChangeHandler(event) {
  28887. const targetTabsEl = event
  28888. .composedPath()
  28889. .find((el) => el.tagName === "CALCITE-TABS");
  28890. if (targetTabsEl !== this.parentTabsEl) {
  28891. return;
  28892. }
  28893. if (this.tab) {
  28894. this.active = this.tab === event.detail.tab;
  28895. }
  28896. else {
  28897. this.getTabIndex().then((index) => {
  28898. this.active = index === event.detail.tab;
  28899. });
  28900. }
  28901. event.stopPropagation();
  28902. }
  28903. onClick() {
  28904. this.emitActiveTab();
  28905. }
  28906. keyDownHandler(e) {
  28907. switch (e.key) {
  28908. case " ":
  28909. case "Enter":
  28910. this.emitActiveTab();
  28911. e.preventDefault();
  28912. break;
  28913. case "ArrowRight":
  28914. if (getElementDir(this.el) === "ltr") {
  28915. this.calciteTabsFocusNext.emit();
  28916. }
  28917. else {
  28918. this.calciteTabsFocusPrevious.emit();
  28919. }
  28920. break;
  28921. case "ArrowLeft":
  28922. if (getElementDir(this.el) === "ltr") {
  28923. this.calciteTabsFocusPrevious.emit();
  28924. }
  28925. else {
  28926. this.calciteTabsFocusNext.emit();
  28927. }
  28928. break;
  28929. }
  28930. }
  28931. //--------------------------------------------------------------------------
  28932. //
  28933. // Public Methods
  28934. //
  28935. //--------------------------------------------------------------------------
  28936. /**
  28937. * Return the index of this title within the nav
  28938. */
  28939. async getTabIndex() {
  28940. return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-tab-title"), this.el);
  28941. }
  28942. /**
  28943. * @internal
  28944. */
  28945. async getTabIdentifier() {
  28946. return this.tab ? this.tab : this.getTabIndex();
  28947. }
  28948. /**
  28949. * @internal
  28950. */
  28951. async updateAriaInfo(tabIds = [], titleIds = []) {
  28952. this.controls = tabIds[titleIds.indexOf(this.el.id)] || null;
  28953. }
  28954. updateHasText() {
  28955. this.hasText = this.el.textContent.trim().length > 0;
  28956. }
  28957. setupTextContentObserver() {
  28958. var _a;
  28959. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  28960. }
  28961. emitActiveTab(userTriggered = true) {
  28962. if (this.disabled) {
  28963. return;
  28964. }
  28965. const payload = { tab: this.tab };
  28966. this.calciteInternalTabsActivate.emit(payload);
  28967. if (userTriggered) {
  28968. this.calciteTabsActivate.emit(payload);
  28969. }
  28970. }
  28971. get el() { return getElement(this); }
  28972. static get watchers() { return {
  28973. "active": ["activeTabChanged"]
  28974. }; }
  28975. static get style() { return tabTitleCss; }
  28976. static get cmpMeta() { return {
  28977. "$flags$": 9,
  28978. "$tagName$": "calcite-tab-title",
  28979. "$members$": {
  28980. "active": [1540],
  28981. "disabled": [516],
  28982. "iconEnd": [513, "icon-end"],
  28983. "iconFlipRtl": [513, "icon-flip-rtl"],
  28984. "iconStart": [513, "icon-start"],
  28985. "layout": [1537],
  28986. "position": [1537],
  28987. "scale": [1537],
  28988. "bordered": [1540],
  28989. "tab": [513],
  28990. "controls": [32],
  28991. "hasText": [32],
  28992. "getTabIndex": [64],
  28993. "getTabIdentifier": [64],
  28994. "updateAriaInfo": [64]
  28995. },
  28996. "$listeners$": [[16, "calciteInternalTabChange", "internalTabChangeHandler"], [0, "click", "onClick"], [0, "keydown", "keyDownHandler"]],
  28997. "$lazyBundleId$": "-",
  28998. "$attrsToReflect$": [["active", "active"], ["disabled", "disabled"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["layout", "layout"], ["position", "position"], ["scale", "scale"], ["bordered", "bordered"], ["tab", "tab"]]
  28999. }; }
  29000. }
  29001. const SLOTS$4 = {
  29002. tabNav: "tab-nav"
  29003. };
  29004. const tabsCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tabs:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tabs{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tabs{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tabs{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tabs{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tabs{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tabs:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tabs-h{display:none}/*!@:host*/.sc-calcite-tabs-h{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}/*!@:host([bordered])*/[bordered].sc-calcite-tabs-h{-webkit-box-shadow:inset 0 1px 0 var(--calcite-ui-border-1);box-shadow:inset 0 1px 0 var(--calcite-ui-border-1);background-color:var(--calcite-ui-foreground-1)}/*!@:host([bordered]:not([position=below])) ::slotted(calcite-tab-nav)*/.sc-calcite-tabs-h[bordered]:not([position=below]) .sc-calcite-tabs-s>calcite-tab-nav{margin-bottom:-1px}/*!@:host([bordered][position=below]) ::slotted(calcite-tab-nav)*/.sc-calcite-tabs-h[bordered][position=below] .sc-calcite-tabs-s>calcite-tab-nav{margin-top:-1px}/*!@:host([bordered][position=below])*/[bordered][position=below].sc-calcite-tabs-h{-webkit-box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1);box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}/*!@:host([bordered]) section*/[bordered].sc-calcite-tabs-h section.sc-calcite-tabs{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1)}/*!@:host([bordered][scale=s]) section*/[bordered][scale=s].sc-calcite-tabs-h section.sc-calcite-tabs{padding:0.75rem}/*!@:host([bordered][scale=m]) section*/[bordered][scale=m].sc-calcite-tabs-h section.sc-calcite-tabs{padding:0.5rem}/*!@:host([bordered][scale=l]) section*/[bordered][scale=l].sc-calcite-tabs-h section.sc-calcite-tabs{padding:1rem}/*!@:host([position=below])*/[position=below].sc-calcite-tabs-h{-ms-flex-direction:column-reverse;flex-direction:column-reverse}/*!@section*/section.sc-calcite-tabs{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;overflow:hidden;border-top-width:1px;border-top-color:var(--calcite-ui-border-1);border-top-style:solid}/*!@:host([position=below]) section*/[position=below].sc-calcite-tabs-h section.sc-calcite-tabs{-ms-flex-direction:column-reverse;flex-direction:column-reverse;border-top-width:0px;border-bottom-width:1px;border-bottom-color:var(--calcite-ui-border-1)}/*!@:host([position=below]:not([bordered])) section*/[position=below].sc-calcite-tabs-h:not([bordered]) section.sc-calcite-tabs{border-bottom-style:solid}";
  29005. /**
  29006. * @slot - A slot for adding `calcite-tab`s.
  29007. * @slot tab-nav - A slot for adding a tab navigation component.
  29008. */
  29009. class Tabs {
  29010. constructor(hostRef) {
  29011. registerInstance(this, hostRef);
  29012. //--------------------------------------------------------------------------
  29013. //
  29014. // Public Properties
  29015. //
  29016. //--------------------------------------------------------------------------
  29017. /**
  29018. * Align tab titles to the edge or fully justify them across the tab nav ("center")
  29019. */
  29020. this.layout = "inline";
  29021. /**
  29022. * Display the tabs above (default) or below the tab content
  29023. */
  29024. this.position = "above";
  29025. /**
  29026. * Specify the scale of the tabs component, defaults to m
  29027. */
  29028. this.scale = "m";
  29029. /**
  29030. * Optionally enable tabs to appear like a folder-style menu when its layout is "inline"
  29031. */
  29032. this.bordered = false;
  29033. //--------------------------------------------------------------------------
  29034. //
  29035. // Events
  29036. //
  29037. //--------------------------------------------------------------------------
  29038. //--------------------------------------------------------------------------
  29039. //
  29040. // Private State/Props
  29041. //
  29042. //--------------------------------------------------------------------------
  29043. /**
  29044. *
  29045. * Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
  29046. * attributes.
  29047. */
  29048. this.titles = [];
  29049. /**
  29050. *
  29051. * Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
  29052. */
  29053. this.tabs = [];
  29054. }
  29055. //--------------------------------------------------------------------------
  29056. //
  29057. // Lifecycle
  29058. //
  29059. //--------------------------------------------------------------------------
  29060. connectedCallback() {
  29061. if (this.layout === "center") {
  29062. this.bordered = false;
  29063. }
  29064. }
  29065. render() {
  29066. return (hAsync(Fragment, null, hAsync("slot", { name: SLOTS$4.tabNav }), hAsync("section", null, hAsync("slot", null))));
  29067. }
  29068. //--------------------------------------------------------------------------
  29069. //
  29070. // Event Listeners
  29071. //
  29072. //--------------------------------------------------------------------------
  29073. /**
  29074. * @internal
  29075. */
  29076. calciteTabTitleRegister(e) {
  29077. this.titles = [...this.titles, e.target];
  29078. this.registryHandler();
  29079. e.stopPropagation();
  29080. }
  29081. /**
  29082. * @internal
  29083. */
  29084. calciteTabTitleUnregister(e) {
  29085. this.titles = this.titles.filter((el) => el !== e.detail);
  29086. this.registryHandler();
  29087. e.stopPropagation();
  29088. }
  29089. /**
  29090. * @internal
  29091. */
  29092. calciteTabRegister(e) {
  29093. this.tabs = [...this.tabs, e.target];
  29094. this.registryHandler();
  29095. e.stopPropagation();
  29096. }
  29097. /**
  29098. * @internal
  29099. */
  29100. calciteTabUnregister(e) {
  29101. this.tabs = this.tabs.filter((el) => el !== e.detail);
  29102. this.registryHandler();
  29103. e.stopPropagation();
  29104. }
  29105. //--------------------------------------------------------------------------
  29106. //
  29107. // Private Methods
  29108. //
  29109. //--------------------------------------------------------------------------
  29110. /**
  29111. *
  29112. * Matches up elements from the internal `tabs` and `titles` to automatically
  29113. * update the ARIA attributes and link `<calcite-tab>` and
  29114. * `<calcite-tab-title>` components.
  29115. */
  29116. async registryHandler() {
  29117. let tabIds;
  29118. let titleIds;
  29119. // determine if we are using `tab` based or `index` based tab identifiers.
  29120. if (this.tabs.some((e) => e.tab) || this.titles.some((e) => e.tab)) {
  29121. // if we are using `tab` based identifiers sort by `tab` to account for
  29122. // possible out of order tabs and get the id of each tab
  29123. tabIds = this.tabs.sort((a, b) => a.tab.localeCompare(b.tab)).map((e) => e.id);
  29124. titleIds = this.titles.sort((a, b) => a.tab.localeCompare(b.tab)).map((e) => e.id);
  29125. }
  29126. else {
  29127. // if we are using index based tabs then the `<calcite-tab>` and
  29128. // `<calcite-tab-title>` might have been rendered out of order so the
  29129. // order of `this.tabs` and `this.titles` might not reflect the DOM state,
  29130. // and might not match each other so we need to get the index of all the
  29131. // tabs and titles in the DOM order to match them up as a source of truth
  29132. const tabDomIndexes = await Promise.all(this.tabs.map((el) => el.getTabIndex()));
  29133. const titleDomIndexes = await Promise.all(this.titles.map((el) => el.getTabIndex()));
  29134. // once we have the DOM order as a source of truth we can build the
  29135. // matching tabIds and titleIds arrays
  29136. tabIds = tabDomIndexes.reduce((ids, indexInDOM, registryIndex) => {
  29137. ids[indexInDOM] = this.tabs[registryIndex].id;
  29138. return ids;
  29139. }, []);
  29140. titleIds = titleDomIndexes.reduce((ids, indexInDOM, registryIndex) => {
  29141. ids[indexInDOM] = this.titles[registryIndex].id;
  29142. return ids;
  29143. }, []);
  29144. }
  29145. // pass all our new aria information to each `<calcite-tab>` and
  29146. // `<calcite-tab-title>` which will check if they can update their internal
  29147. // `controlled` or `labeledBy` states and re-render if necessary
  29148. this.tabs.forEach((el) => el.updateAriaInfo(tabIds, titleIds));
  29149. this.titles.forEach((el) => el.updateAriaInfo(tabIds, titleIds));
  29150. }
  29151. get el() { return getElement(this); }
  29152. static get style() { return tabsCss; }
  29153. static get cmpMeta() { return {
  29154. "$flags$": 9,
  29155. "$tagName$": "calcite-tabs",
  29156. "$members$": {
  29157. "layout": [513],
  29158. "position": [513],
  29159. "scale": [513],
  29160. "bordered": [1540],
  29161. "titles": [32],
  29162. "tabs": [32]
  29163. },
  29164. "$listeners$": [[0, "calciteTabTitleRegister", "calciteTabTitleRegister"], [16, "calciteTabTitleUnregister", "calciteTabTitleUnregister"], [0, "calciteTabRegister", "calciteTabRegister"], [16, "calciteTabUnregister", "calciteTabUnregister"]],
  29165. "$lazyBundleId$": "-",
  29166. "$attrsToReflect$": [["layout", "layout"], ["position", "position"], ["scale", "scale"], ["bordered", "bordered"]]
  29167. }; }
  29168. }
  29169. const SLOTS$3 = {
  29170. contentStart: "content-start",
  29171. contentEnd: "content-end"
  29172. };
  29173. const tileCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tile:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tile{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tile:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-h{display:none}/*!@:host*/.sc-calcite-tile-h{-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .container*/.sc-calcite-tile-h .container.sc-calcite-tile{pointer-events:none;display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));gap:0.5rem}/*!@:host .content*/.sc-calcite-tile-h .content.sc-calcite-tile{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;gap:0.5rem;width:10%}/*!@:host .content-container*/.sc-calcite-tile-h .content-container.sc-calcite-tile{display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:stretch;align-items:stretch;padding:0px;color:var(--calcite-ui-text-2);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host .content-slot-container*/.sc-calcite-tile-h .content-slot-container.sc-calcite-tile{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background-color:var(--calcite-ui-foreground-1)}/*!@:host .content-slot-container:first-child*/.sc-calcite-tile-h .content-slot-container.sc-calcite-tile:first-child{padding-inline:0 0.75rem}/*!@:host .content-slot-container:last-child*/.sc-calcite-tile-h .content-slot-container.sc-calcite-tile:last-child{padding-inline:0.75rem 0}/*!@:host .heading*/.sc-calcite-tile-h .heading.sc-calcite-tile{pointer-events:none;overflow-wrap:break-word;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .large-visual*/.sc-calcite-tile-h .large-visual.sc-calcite-tile{-ms-flex-align:center;align-items:center;text-align:center;min-height:12rem}/*!@:host .large-visual .icon*/.sc-calcite-tile-h .large-visual.sc-calcite-tile .icon.sc-calcite-tile{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-item-align:end;align-self:flex-end}/*!@:host .large-visual .content-container*/.sc-calcite-tile-h .large-visual.sc-calcite-tile .content-container.sc-calcite-tile{-ms-flex-item-align:center;align-self:center}/*!@:host .description*/.sc-calcite-tile-h .description.sc-calcite-tile{pointer-events:none;overflow-wrap:break-word;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-ui-text-3);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host(:not([embed]))*/.sc-calcite-tile-h:not([embed]){padding:0.75rem;-webkit-box-shadow:0 0 0 1px var(--calcite-ui-border-2);box-shadow:0 0 0 1px var(--calcite-ui-border-2)}/*!@:host(:not([embed])[href]:hover)*/.sc-calcite-tile-h:not([embed])[href]:hover{cursor:pointer;-webkit-box-shadow:0 0 0 2px var(--calcite-ui-brand);box-shadow:0 0 0 2px var(--calcite-ui-brand)}/*!@:host(:not([embed])[href]:active)*/.sc-calcite-tile-h:not([embed])[href]:active{-webkit-box-shadow:0 0 0 3px var(--calcite-ui-brand);box-shadow:0 0 0 3px var(--calcite-ui-brand)}/*!@:host([icon][heading]:not([description]):not([embed]))*/[icon][heading].sc-calcite-tile-h:not([description]):not([embed]){padding:0px}/*!@:host([icon][heading]:not([description])) .icon*/[icon][heading].sc-calcite-tile-h:not([description]) .icon.sc-calcite-tile{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}/*!@:host([icon][heading]:not([description])) .large-visual*/[icon][heading].sc-calcite-tile-h:not([description]) .large-visual.sc-calcite-tile{text-align:center}/*!@:host([disabled])*/[disabled].sc-calcite-tile-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tile-h[disabled] .sc-calcite-tile-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tile-h [calcite-hydrated][disabled].sc-calcite-tile{opacity:1}/*!@:host(:hover) .heading, :host([active]) .heading*/.sc-calcite-tile-h:hover .heading.sc-calcite-tile,[active].sc-calcite-tile-h .heading.sc-calcite-tile{color:var(--calcite-ui-text-1)}/*!@:host(:hover) .description, :host([active]) .description*/.sc-calcite-tile-h:hover .description.sc-calcite-tile,[active].sc-calcite-tile-h .description.sc-calcite-tile{color:var(--calcite-ui-text-2)}";
  29174. /**
  29175. * @slot content-start - A slot for adding non-actionable elements before the tile content.
  29176. * @slot content-end - A slot for adding non-actionable elements after the tile content.
  29177. */
  29178. class Tile {
  29179. constructor(hostRef) {
  29180. registerInstance(this, hostRef);
  29181. //--------------------------------------------------------------------------
  29182. //
  29183. // Properties
  29184. //
  29185. //--------------------------------------------------------------------------
  29186. /** The active state of the tile. */
  29187. this.active = false;
  29188. /**
  29189. * When true, prevents interaction.
  29190. */
  29191. this.disabled = false;
  29192. /** The embed mode of the tile. When true, renders without a border and padding for use by other components. */
  29193. this.embed = false;
  29194. /**
  29195. * The focused state of the tile.
  29196. * @internal
  29197. */
  29198. this.focused = false;
  29199. /** The hidden state of the tile. */
  29200. this.hidden = false;
  29201. }
  29202. // --------------------------------------------------------------------------
  29203. //
  29204. // Lifecycle
  29205. //
  29206. // --------------------------------------------------------------------------
  29207. connectedCallback() {
  29208. connectConditionalSlotComponent(this);
  29209. }
  29210. disconnectedCallback() {
  29211. disconnectConditionalSlotComponent(this);
  29212. }
  29213. componentDidRender() {
  29214. updateHostInteraction(this);
  29215. }
  29216. // --------------------------------------------------------------------------
  29217. //
  29218. // Render Methods
  29219. //
  29220. // --------------------------------------------------------------------------
  29221. renderTile() {
  29222. const { icon, el, heading, description } = this;
  29223. const isLargeVisual = heading && icon && !description;
  29224. const iconStyle = isLargeVisual
  29225. ? {
  29226. height: "64px",
  29227. width: "64px"
  29228. }
  29229. : undefined;
  29230. return (hAsync("div", { class: { container: true, "large-visual": isLargeVisual } }, icon && (hAsync("div", { class: "icon" }, hAsync("calcite-icon", { icon: icon, scale: "l", style: iconStyle }))), hAsync("div", { class: "content-container" }, getSlotted(el, SLOTS$3.contentStart) ? (hAsync("div", { class: "content-slot-container" }, hAsync("slot", { name: SLOTS$3.contentStart }))) : null, hAsync("div", { class: "content" }, heading && hAsync("div", { class: "heading" }, heading), description && hAsync("div", { class: "description" }, description)), getSlotted(el, SLOTS$3.contentEnd) ? (hAsync("div", { class: "content-slot-container" }, hAsync("slot", { name: SLOTS$3.contentEnd }))) : null)));
  29231. }
  29232. render() {
  29233. return (hAsync(Fragment, null, this.href ? (hAsync("calcite-link", { disabled: this.disabled, href: this.href }, this.renderTile())) : (this.renderTile())));
  29234. }
  29235. get el() { return getElement(this); }
  29236. static get style() { return tileCss; }
  29237. static get cmpMeta() { return {
  29238. "$flags$": 9,
  29239. "$tagName$": "calcite-tile",
  29240. "$members$": {
  29241. "active": [516],
  29242. "description": [513],
  29243. "disabled": [516],
  29244. "embed": [516],
  29245. "focused": [516],
  29246. "heading": [513],
  29247. "hidden": [516],
  29248. "href": [513],
  29249. "icon": [513]
  29250. },
  29251. "$listeners$": undefined,
  29252. "$lazyBundleId$": "-",
  29253. "$attrsToReflect$": [["active", "active"], ["description", "description"], ["disabled", "disabled"], ["embed", "embed"], ["focused", "focused"], ["heading", "heading"], ["hidden", "hidden"], ["href", "href"], ["icon", "icon"]]
  29254. }; }
  29255. }
  29256. const CSS$6 = {
  29257. checked: "checked",
  29258. description: "description",
  29259. descriptionOnly: "description-only",
  29260. disabled: "disabled",
  29261. heading: "heading",
  29262. headingOnly: "heading-only",
  29263. icon: "icon",
  29264. iconOnly: "icon-only",
  29265. inputAlignmentEnd: "input-alignment-end",
  29266. inputAlignmentStart: "input-alignment-start",
  29267. inputEnabled: "input-enabled",
  29268. largeVisual: "large-visual",
  29269. widthAuto: "width-auto",
  29270. widthFull: "width-full"
  29271. };
  29272. const tileSelectCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tile-select:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tile-select{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile-select{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile-select{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile-select{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile-select{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tile-select:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-select-h{display:none}/*!@:host*/.sc-calcite-tile-select-h{display:block}/*!@:host .container*/.sc-calcite-tile-select-h .container.sc-calcite-tile-select{background-color:var(--calcite-ui-foreground-1);-webkit-box-shadow:0 0 0 1px var(--calcite-ui-border-2);box-shadow:0 0 0 1px var(--calcite-ui-border-2);-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:inline-block;height:100%;max-width:300px;padding:0.75rem;position:relative;-webkit-transition:var(--calcite-animation-timing);transition:var(--calcite-animation-timing);vertical-align:top;z-index:10}/*!@:host .container.checked*/.sc-calcite-tile-select-h .container.checked.sc-calcite-tile-select{z-index:30;-webkit-box-shadow:0 0 0 1px var(--calcite-ui-brand);box-shadow:0 0 0 1px var(--calcite-ui-brand)}/*!@:host .container.heading-only*/.sc-calcite-tile-select-h .container.heading-only.sc-calcite-tile-select{-ms-flex-align:center;align-items:center}/*!@:host .container:not(.input-enabled) ::slotted(calcite-checkbox), :host .container:not(.input-enabled) ::slotted(calcite-radio-button)*/.sc-calcite-tile-select-h .container:not(.input-enabled) .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container:not(.input-enabled) .sc-calcite-tile-select-s>calcite-radio-button{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}/*!@:host .container.focused:not(.disabled)*/.sc-calcite-tile-select-h .container.focused.sc-calcite-tile-select:not(.disabled){z-index:30}/*!@:host .container.focused:not(.disabled):not(.input-enabled)*/.sc-calcite-tile-select-h .container.focused.sc-calcite-tile-select:not(.disabled):not(.input-enabled){-webkit-box-shadow:0 0 0 1px var(--calcite-ui-brand), inset 0 0 0 2px var(--calcite-ui-foreground-1), inset 0 0 0 5px var(--calcite-ui-brand);box-shadow:0 0 0 1px var(--calcite-ui-brand), inset 0 0 0 2px var(--calcite-ui-foreground-1), inset 0 0 0 5px var(--calcite-ui-brand)}/*!@:host .container.input-enabled.input-alignment-start.width-auto.heading-only, :host .container.input-enabled.input-alignment-start.width-auto.icon-only, :host .container.input-enabled.input-alignment-start.width-auto.description-only, :host .container.input-enabled.input-alignment-start.width-auto.heading.description, :host .container.input-enabled.input-alignment-start.width-auto.icon.description, :host .container.input-enabled.input-alignment-start.width-auto.heading.icon.description*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.heading-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.icon-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.description-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.heading.description.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.icon.description.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.heading.icon.description.sc-calcite-tile-select{display:inline-grid;grid-template-columns:-webkit-max-content 1fr;grid-template-columns:max-content 1fr}/*!@:host .container.input-enabled.input-alignment-start.heading-only, :host .container.input-enabled.input-alignment-start.icon-only, :host .container.input-enabled.input-alignment-start.description-only, :host .container.input-enabled.input-alignment-start.heading.description, :host .container.input-enabled.input-alignment-start.icon.description, :host .container.input-enabled.input-alignment-start.heading.icon.description*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.heading-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.icon-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.description-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.heading.description.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.icon.description.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.heading.icon.description.sc-calcite-tile-select{gap:0.75rem}/*!@:host .container.input-enabled.input-alignment-start calcite-tile*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.sc-calcite-tile-select calcite-tile.sc-calcite-tile-select{-ms-flex-order:1;order:1}/*!@:host .container.input-enabled.input-alignment-start.large-visual ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-start.large-visual ::slotted(calcite-radio-button)*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.large-visual .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.large-visual .sc-calcite-tile-select-s>calcite-radio-button{position:absolute;inset-block-start:0.75rem;inset-inline-start:0.75rem}/*!@:host .container.input-enabled.input-alignment-end.width-auto.heading-only, :host .container.input-enabled.input-alignment-end.width-auto.icon-only*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.width-auto.heading-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.width-auto.icon-only.sc-calcite-tile-select{display:inline-grid;grid-gap:0.75rem;grid-template-columns:-webkit-max-content 1fr;grid-template-columns:max-content 1fr}/*!@:host .container.input-enabled.input-alignment-end.heading-only, :host .container.input-enabled.input-alignment-end.icon-only*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.icon-only.sc-calcite-tile-select{gap:0.75rem}/*!@:host .container.input-enabled.input-alignment-end.description-only ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.description-only ::slotted(calcite-radio-button), :host .container.input-enabled.input-alignment-end.heading.description ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.heading.description ::slotted(calcite-radio-button), :host .container.input-enabled.input-alignment-end.icon.description ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.icon.description ::slotted(calcite-radio-button), :host .container.input-enabled.input-alignment-end.heading.icon.description ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.heading.icon.description ::slotted(calcite-radio-button)*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.description-only .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.description-only .sc-calcite-tile-select-s>calcite-radio-button,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading.description .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading.description .sc-calcite-tile-select-s>calcite-radio-button,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.icon.description .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.icon.description .sc-calcite-tile-select-s>calcite-radio-button,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading.icon.description .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading.icon.description .sc-calcite-tile-select-s>calcite-radio-button{position:absolute;inset-block-start:0.75rem;inset-inline-end:0.75rem}/*!@:host .container.input-enabled.input-alignment-end.large-visual ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.large-visual ::slotted(calcite-radio-button)*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.large-visual .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.large-visual .sc-calcite-tile-select-s>calcite-radio-button{position:absolute;inset-block-start:0.75rem;inset-inline-end:0.75rem}/*!@:host .container.width-full*/.sc-calcite-tile-select-h .container.width-full.sc-calcite-tile-select{display:-ms-flexbox;display:flex;max-width:none}/*!@:host .container.width-full calcite-tile*/.sc-calcite-tile-select-h .container.width-full.sc-calcite-tile-select calcite-tile.sc-calcite-tile-select{-ms-flex:1 1 auto;flex:1 1 auto}/*!@:host(:hover) .container*/.sc-calcite-tile-select-h:hover .container.sc-calcite-tile-select{z-index:20}/*!@:host(:hover) .container:not(.input-enabled)*/.sc-calcite-tile-select-h:hover .container.sc-calcite-tile-select:not(.input-enabled){-webkit-box-shadow:0 0 0 1px var(--calcite-ui-brand);box-shadow:0 0 0 1px var(--calcite-ui-brand)}/*!@:host([disabled])*/[disabled].sc-calcite-tile-select-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tile-select-h[disabled] .sc-calcite-tile-select-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tile-select-h [calcite-hydrated][disabled].sc-calcite-tile-select{opacity:1}";
  29273. /**
  29274. * @slot - A slot for adding custom content.
  29275. */
  29276. class TileSelect {
  29277. constructor(hostRef) {
  29278. registerInstance(this, hostRef);
  29279. this.calciteTileSelectChange = createEvent(this, "calciteTileSelectChange", 7);
  29280. //--------------------------------------------------------------------------
  29281. //
  29282. // Properties
  29283. //
  29284. //--------------------------------------------------------------------------
  29285. /** The checked state of the tile select. */
  29286. this.checked = false;
  29287. /** The disabled state of the tile select. */
  29288. this.disabled = false;
  29289. /** The hidden state of the tile select. */
  29290. this.hidden = false;
  29291. /** Display an interactive radio or checkbox. */
  29292. this.inputEnabled = false;
  29293. /** The side of the tile that the radio or checkbox appears on when inputEnabled is true. */
  29294. this.inputAlignment = "start";
  29295. /** The selection mode of the tile select: radio (single) or checkbox (multiple). */
  29296. this.type = "radio";
  29297. /** specify the width of the tile, defaults to auto */
  29298. this.width = "auto";
  29299. this.guid = `calcite-tile-select-${guid()}`;
  29300. //--------------------------------------------------------------------------
  29301. //
  29302. // State
  29303. //
  29304. //--------------------------------------------------------------------------
  29305. /** The focused state of the tile-select. */
  29306. this.focused = false;
  29307. }
  29308. checkedChanged(newChecked) {
  29309. this.input.checked = newChecked;
  29310. }
  29311. nameChanged(newName) {
  29312. this.input.name = newName;
  29313. }
  29314. //--------------------------------------------------------------------------
  29315. //
  29316. // Public Methods
  29317. //
  29318. //--------------------------------------------------------------------------
  29319. /** Sets focus on the component. */
  29320. async setFocus() {
  29321. this.input.setFocus();
  29322. }
  29323. //--------------------------------------------------------------------------
  29324. //
  29325. // Event Listeners
  29326. //
  29327. //--------------------------------------------------------------------------
  29328. checkboxChangeHandler(event) {
  29329. const checkbox = event.target;
  29330. if (checkbox === this.input) {
  29331. this.checked = checkbox.checked;
  29332. }
  29333. event.stopPropagation();
  29334. this.calciteTileSelectChange.emit();
  29335. }
  29336. checkboxFocusBlurHandler(event) {
  29337. const checkbox = event.target;
  29338. if (checkbox === this.input) {
  29339. this.focused = event.detail;
  29340. }
  29341. event.stopPropagation();
  29342. }
  29343. radioButtonChangeHandler(event) {
  29344. const radioButton = event.target;
  29345. if (radioButton === this.input) {
  29346. this.checked = radioButton.checked;
  29347. }
  29348. event.stopPropagation();
  29349. this.calciteTileSelectChange.emit();
  29350. }
  29351. radioButtonCheckedChangeHandler(event) {
  29352. const radioButton = event.target;
  29353. if (radioButton === this.input) {
  29354. this.checked = radioButton.checked;
  29355. }
  29356. event.stopPropagation();
  29357. }
  29358. radioButtonFocusBlurHandler(event) {
  29359. const radioButton = event.target;
  29360. if (radioButton === this.input) {
  29361. this.focused = radioButton.focused;
  29362. }
  29363. event.stopPropagation();
  29364. }
  29365. click(event) {
  29366. const target = event.target;
  29367. const targets = ["calcite-tile", "calcite-tile-select"];
  29368. if (targets.includes(target.localName)) {
  29369. this.input.click();
  29370. }
  29371. }
  29372. mouseenter() {
  29373. if (this.input.localName === "calcite-radio-button") {
  29374. this.input.hovered = true;
  29375. }
  29376. if (this.input.localName === "calcite-checkbox") {
  29377. this.input.hovered = true;
  29378. }
  29379. }
  29380. mouseleave() {
  29381. if (this.input.localName === "calcite-radio-button") {
  29382. this.input.hovered = false;
  29383. }
  29384. if (this.input.localName === "calcite-checkbox") {
  29385. this.input.hovered = false;
  29386. }
  29387. }
  29388. //--------------------------------------------------------------------------
  29389. //
  29390. // Lifecycle
  29391. //
  29392. //--------------------------------------------------------------------------
  29393. connectedCallback() {
  29394. this.renderInput();
  29395. }
  29396. disconnectedCallback() {
  29397. this.input.parentNode.removeChild(this.input);
  29398. }
  29399. componentDidRender() {
  29400. updateHostInteraction(this);
  29401. }
  29402. // --------------------------------------------------------------------------
  29403. //
  29404. // Render Methods
  29405. //
  29406. // --------------------------------------------------------------------------
  29407. renderInput() {
  29408. this.input = document.createElement(this.type === "radio" ? "calcite-radio-button" : "calcite-checkbox");
  29409. this.input.checked = this.checked;
  29410. this.input.disabled = this.disabled;
  29411. this.input.hidden = this.hidden;
  29412. this.input.id = this.guid;
  29413. this.input.label = this.heading || this.name || "";
  29414. if (this.name) {
  29415. this.input.name = this.name;
  29416. }
  29417. if (this.value) {
  29418. this.input.value = this.value != null ? this.value.toString() : "";
  29419. }
  29420. this.el.insertAdjacentElement("beforeend", this.input);
  29421. }
  29422. render() {
  29423. const { checked, description, disabled, focused, heading, icon, inputAlignment, inputEnabled, width } = this;
  29424. return (hAsync("div", { class: {
  29425. checked,
  29426. container: true,
  29427. [CSS$6.description]: Boolean(description),
  29428. [CSS$6.descriptionOnly]: Boolean(!heading && !icon && description),
  29429. disabled,
  29430. focused,
  29431. [CSS$6.heading]: Boolean(heading),
  29432. [CSS$6.headingOnly]: heading && !icon && !description,
  29433. [CSS$6.icon]: Boolean(icon),
  29434. [CSS$6.iconOnly]: !heading && icon && !description,
  29435. [CSS$6.inputAlignmentEnd]: inputAlignment === "end",
  29436. [CSS$6.inputAlignmentStart]: inputAlignment === "start",
  29437. [CSS$6.inputEnabled]: inputEnabled,
  29438. [CSS$6.largeVisual]: heading && icon && !description,
  29439. [CSS$6.widthAuto]: width === "auto",
  29440. [CSS$6.widthFull]: width === "full"
  29441. } }, hAsync("calcite-tile", { active: checked, description: description, embed: true, heading: heading, icon: icon }), hAsync("slot", null)));
  29442. }
  29443. get el() { return getElement(this); }
  29444. static get watchers() { return {
  29445. "checked": ["checkedChanged"],
  29446. "name": ["nameChanged"]
  29447. }; }
  29448. static get style() { return tileSelectCss; }
  29449. static get cmpMeta() { return {
  29450. "$flags$": 9,
  29451. "$tagName$": "calcite-tile-select",
  29452. "$members$": {
  29453. "checked": [1540],
  29454. "description": [513],
  29455. "disabled": [516],
  29456. "heading": [513],
  29457. "hidden": [516],
  29458. "icon": [513],
  29459. "name": [520],
  29460. "inputEnabled": [516, "input-enabled"],
  29461. "inputAlignment": [513, "input-alignment"],
  29462. "type": [513],
  29463. "value": [8],
  29464. "width": [513],
  29465. "focused": [32],
  29466. "setFocus": [64]
  29467. },
  29468. "$listeners$": [[0, "calciteCheckboxChange", "checkboxChangeHandler"], [0, "calciteInternalCheckboxFocus", "checkboxFocusBlurHandler"], [0, "calciteInternalCheckboxBlur", "checkboxFocusBlurHandler"], [0, "calciteRadioButtonChange", "radioButtonChangeHandler"], [0, "calciteInternalRadioButtonCheckedChange", "radioButtonCheckedChangeHandler"], [0, "calciteInternalRadioButtonFocus", "radioButtonFocusBlurHandler"], [0, "calciteInternalRadioButtonBlur", "radioButtonFocusBlurHandler"], [0, "click", "click"], [1, "mouseenter", "mouseenter"], [1, "mouseleave", "mouseleave"]],
  29469. "$lazyBundleId$": "-",
  29470. "$attrsToReflect$": [["checked", "checked"], ["description", "description"], ["disabled", "disabled"], ["heading", "heading"], ["hidden", "hidden"], ["icon", "icon"], ["name", "name"], ["inputEnabled", "input-enabled"], ["inputAlignment", "input-alignment"], ["type", "type"], ["width", "width"]]
  29471. }; }
  29472. }
  29473. const tileSelectGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tile-select-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tile-select-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile-select-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile-select-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile-select-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile-select-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tile-select-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-select-group-h{display:none}/*!@:host*/.sc-calcite-tile-select-group-h{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}/*!@:host ::slotted(calcite-tile-select)*/.sc-calcite-tile-select-group-h .sc-calcite-tile-select-group-s>calcite-tile-select{margin-right:1px;margin-bottom:1px}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-tile-select-group-h{-ms-flex-direction:column;flex-direction:column}/*!@:host([disabled])*/[disabled].sc-calcite-tile-select-group-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tile-select-group-h[disabled] .sc-calcite-tile-select-group-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tile-select-group-h [calcite-hydrated][disabled].sc-calcite-tile-select-group{opacity:1}";
  29474. /**
  29475. * @slot - A slot for adding `calcite-tile-select`s.
  29476. */
  29477. class TileSelectGroup {
  29478. constructor(hostRef) {
  29479. registerInstance(this, hostRef);
  29480. //--------------------------------------------------------------------------
  29481. //
  29482. // Properties
  29483. //
  29484. //--------------------------------------------------------------------------
  29485. /** The disabled state of the tile select. */
  29486. this.disabled = false;
  29487. /** Tiles by default move horizontally, stacking with each row, vertical allows single-column layouts */
  29488. this.layout = "horizontal";
  29489. }
  29490. //--------------------------------------------------------------------------
  29491. //
  29492. // Lifecycle
  29493. //
  29494. //--------------------------------------------------------------------------
  29495. componentDidRender() {
  29496. updateHostInteraction(this);
  29497. }
  29498. render() {
  29499. return hAsync("slot", null);
  29500. }
  29501. get el() { return getElement(this); }
  29502. static get style() { return tileSelectGroupCss; }
  29503. static get cmpMeta() { return {
  29504. "$flags$": 9,
  29505. "$tagName$": "calcite-tile-select-group",
  29506. "$members$": {
  29507. "disabled": [516],
  29508. "layout": [513]
  29509. },
  29510. "$listeners$": undefined,
  29511. "$lazyBundleId$": "-",
  29512. "$attrsToReflect$": [["disabled", "disabled"], ["layout", "layout"]]
  29513. }; }
  29514. }
  29515. const CSS$5 = {
  29516. button: "button",
  29517. buttonBottomLeft: "button--bottom-left",
  29518. buttonBottomRight: "button--bottom-right",
  29519. buttonHourDown: "button--hour-down",
  29520. buttonHourUp: "button--hour-up",
  29521. buttonMeridiemDown: "button--meridiem-down",
  29522. buttonMeridiemUp: "button--meridiem-up",
  29523. buttonMinuteDown: "button--minute-down",
  29524. buttonMinuteUp: "button--minute-up",
  29525. buttonSecondDown: "button--second-down",
  29526. buttonSecondUp: "button--second-up",
  29527. buttonTopLeft: "button--top-left",
  29528. buttonTopRight: "button--top-right",
  29529. column: "column",
  29530. delimiter: "delimiter",
  29531. hour: "hour",
  29532. input: "input",
  29533. meridiem: "meridiem",
  29534. minute: "minute",
  29535. second: "second",
  29536. showMeridiem: "show-meridiem",
  29537. showSecond: "show-second",
  29538. "scale-s": "scale-s",
  29539. "scale-m": "scale-m",
  29540. "scale-l": "scale-l",
  29541. timePicker: "time-picker",
  29542. meridiemStart: "meridiem--start"
  29543. };
  29544. const TEXT$2 = {
  29545. hour: "Hour",
  29546. hourDown: "Decrease hour",
  29547. hourUp: "Increase hour",
  29548. meridiem: "AM/PM",
  29549. meridiemDown: "Decrease AM/PM",
  29550. meridiemUp: "Increase AM/PM",
  29551. minute: "Minute",
  29552. minuteDown: "Decrease minute",
  29553. minuteUp: "Increase minute",
  29554. second: "Second",
  29555. secondDown: "Decrease second",
  29556. secondUp: "Increase second"
  29557. };
  29558. const timePickerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-time-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-time-picker{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-time-picker{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-time-picker{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-time-picker{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-time-picker{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-time-picker:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-time-picker-h{display:none}/*!@:host*/.sc-calcite-time-picker-h{display:inline-block}/*!@.time-picker*/.time-picker.sc-calcite-time-picker{display:-ms-flexbox;display:flex;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-align:center;align-items:center;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-radius:var(--calcite-border-radius)}/*!@.time-picker .column*/.time-picker.sc-calcite-time-picker .column.sc-calcite-time-picker{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}/*!@.time-picker .meridiem--start*/.time-picker.sc-calcite-time-picker .meridiem--start.sc-calcite-time-picker{-ms-flex-order:-1;order:-1}/*!@.time-picker .button*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--calcite-ui-foreground-1)}/*!@.time-picker .button:hover, .time-picker .button:focus*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker:hover,.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker:focus{background-color:var(--calcite-ui-foreground-2);outline:2px solid transparent;outline-offset:2px}/*!@.time-picker .button:active*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker:active{background-color:var(--calcite-ui-foreground-3)}/*!@.time-picker .button.top-left*/.time-picker.sc-calcite-time-picker .button.top-left.sc-calcite-time-picker{border-top-left-radius:var(--calcite-border-radius)}/*!@.time-picker .button.bottom-left*/.time-picker.sc-calcite-time-picker .button.bottom-left.sc-calcite-time-picker{border-bottom-left-radius:var(--calcite-border-radius)}/*!@.time-picker .button.top-right*/.time-picker.sc-calcite-time-picker .button.top-right.sc-calcite-time-picker{border-top-right-radius:var(--calcite-border-radius)}/*!@.time-picker .button.bottom-right*/.time-picker.sc-calcite-time-picker .button.bottom-right.sc-calcite-time-picker{border-bottom-right-radius:var(--calcite-border-radius)}/*!@.time-picker .button calcite-icon*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker calcite-icon.sc-calcite-time-picker{color:var(--calcite-ui-text-3)}/*!@.time-picker .input*/.time-picker.sc-calcite-time-picker .input.sc-calcite-time-picker{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium)}/*!@.time-picker .input:hover*/.time-picker.sc-calcite-time-picker .input.sc-calcite-time-picker:hover{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-2);box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-2)}/*!@.time-picker .input:focus, .time-picker .input:hover:focus*/.time-picker.sc-calcite-time-picker .input.sc-calcite-time-picker:focus,.time-picker.sc-calcite-time-picker .input.sc-calcite-time-picker:hover:focus{outline:2px solid transparent;outline-offset:2px;-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@.time-picker.scale-s*/.time-picker.scale-s.sc-calcite-time-picker{font-size:var(--calcite-font-size--1)}/*!@.time-picker.scale-s .button, .time-picker.scale-s .input*/.time-picker.scale-s.sc-calcite-time-picker .button.sc-calcite-time-picker,.time-picker.scale-s.sc-calcite-time-picker .input.sc-calcite-time-picker{padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem}/*!@.time-picker.scale-s:not(.show-meridiem) .delimiter:last-child*/.time-picker.scale-s.sc-calcite-time-picker:not(.show-meridiem) .delimiter.sc-calcite-time-picker:last-child{-webkit-padding-end:0.75rem;padding-inline-end:0.75rem}/*!@.time-picker.scale-m*/.time-picker.scale-m.sc-calcite-time-picker{font-size:var(--calcite-font-size-0)}/*!@.time-picker.scale-m .button, .time-picker.scale-m .input*/.time-picker.scale-m.sc-calcite-time-picker .button.sc-calcite-time-picker,.time-picker.scale-m.sc-calcite-time-picker .input.sc-calcite-time-picker{padding-left:1rem;padding-right:1rem;padding-top:0.5rem;padding-bottom:0.5rem}/*!@.time-picker.scale-m:not(.show-meridiem) .delimiter:last-child*/.time-picker.scale-m.sc-calcite-time-picker:not(.show-meridiem) .delimiter.sc-calcite-time-picker:last-child{-webkit-padding-end:1rem;padding-inline-end:1rem}/*!@.time-picker.scale-l*/.time-picker.scale-l.sc-calcite-time-picker{font-size:var(--calcite-font-size-1)}/*!@.time-picker.scale-l .button, .time-picker.scale-l .input*/.time-picker.scale-l.sc-calcite-time-picker .button.sc-calcite-time-picker,.time-picker.scale-l.sc-calcite-time-picker .input.sc-calcite-time-picker{padding-left:1.25rem;padding-right:1.25rem;padding-top:0.75rem;padding-bottom:0.75rem}/*!@.time-picker.scale-l:not(.show-meridiem) .delimiter:last-child*/.time-picker.scale-l.sc-calcite-time-picker:not(.show-meridiem) .delimiter.sc-calcite-time-picker:last-child{-webkit-padding-end:1.25rem;padding-inline-end:1.25rem}";
  29559. function capitalize(str) {
  29560. return str.charAt(0).toUpperCase() + str.slice(1);
  29561. }
  29562. class TimePicker {
  29563. constructor(hostRef) {
  29564. registerInstance(this, hostRef);
  29565. this.calciteTimePickerBlur = createEvent(this, "calciteTimePickerBlur", 7);
  29566. this.calciteTimePickerChange = createEvent(this, "calciteTimePickerChange", 7);
  29567. this.calciteTimePickerFocus = createEvent(this, "calciteTimePickerFocus", 7);
  29568. //--------------------------------------------------------------------------
  29569. //
  29570. // Properties
  29571. //
  29572. //--------------------------------------------------------------------------
  29573. /** aria-label for the hour input
  29574. * @default "Hour"
  29575. */
  29576. this.intlHour = TEXT$2.hour;
  29577. /** aria-label for the hour down button
  29578. * @default "Decrease hour"
  29579. */
  29580. this.intlHourDown = TEXT$2.hourDown;
  29581. /** aria-label for the hour up button
  29582. * @default "Increase hour"
  29583. */
  29584. this.intlHourUp = TEXT$2.hourUp;
  29585. /** aria-label for the meridiem (am/pm) input
  29586. * @default "AM/PM"
  29587. */
  29588. this.intlMeridiem = TEXT$2.meridiem;
  29589. /** aria-label for the meridiem (am/pm) down button
  29590. * @default "Decrease AM/PM"
  29591. */
  29592. this.intlMeridiemDown = TEXT$2.meridiemDown;
  29593. /** aria-label for the meridiem (am/pm) up button
  29594. * @default "Increase AM/PM"
  29595. */
  29596. this.intlMeridiemUp = TEXT$2.meridiemUp;
  29597. /** aria-label for the minute input
  29598. * @default "Minute"
  29599. */
  29600. this.intlMinute = TEXT$2.minute;
  29601. /** aria-label for the minute down button
  29602. * @default "Decrease minute"
  29603. */
  29604. this.intlMinuteDown = TEXT$2.minuteDown;
  29605. /** aria-label for the minute up button
  29606. * @default "Increase minute"
  29607. */
  29608. this.intlMinuteUp = TEXT$2.minuteUp;
  29609. /** aria-label for the second input
  29610. * @default "Second"
  29611. */
  29612. this.intlSecond = TEXT$2.second;
  29613. /** aria-label for the second down button
  29614. * @default "Decrease second"
  29615. */
  29616. this.intlSecondDown = TEXT$2.secondDown;
  29617. /** aria-label for the second up button
  29618. * @default "Increase second"
  29619. */
  29620. this.intlSecondUp = TEXT$2.secondUp;
  29621. /**
  29622. * BCP 47 language tag for desired language and country format
  29623. * @internal
  29624. */
  29625. this.locale = document.documentElement.lang || navigator.language || "en";
  29626. /** The scale (size) of the time picker */
  29627. this.scale = "m";
  29628. /** number (seconds) that specifies the granularity that the value must adhere to */
  29629. this.step = 60;
  29630. /** The selected time in UTC (always 24-hour format) */
  29631. this.value = null;
  29632. this.showSecond = this.step < 60;
  29633. this.decrementHour = () => {
  29634. const newHour = !this.hour ? 0 : this.hour === "00" ? 23 : parseInt(this.hour) - 1;
  29635. this.setValuePart("hour", newHour);
  29636. };
  29637. this.decrementMeridiem = () => {
  29638. const newMeridiem = this.meridiem === "PM" ? "AM" : "PM";
  29639. this.setValuePart("meridiem", newMeridiem);
  29640. };
  29641. this.decrementMinuteOrSecond = (key) => {
  29642. let newValue;
  29643. if (isValidNumber(this[key])) {
  29644. const valueAsNumber = parseInt(this[key]);
  29645. newValue = valueAsNumber === 0 ? 59 : valueAsNumber - 1;
  29646. }
  29647. else {
  29648. newValue = 59;
  29649. }
  29650. this.setValuePart(key, newValue);
  29651. };
  29652. this.decrementMinute = () => {
  29653. this.decrementMinuteOrSecond("minute");
  29654. };
  29655. this.decrementSecond = () => {
  29656. this.decrementMinuteOrSecond("second");
  29657. };
  29658. this.focusHandler = (event) => {
  29659. this.activeEl = event.currentTarget;
  29660. };
  29661. this.hourDownButtonKeyDownHandler = (event) => {
  29662. if (this.buttonActivated(event)) {
  29663. this.decrementHour();
  29664. }
  29665. };
  29666. this.hourKeyDownHandler = (event) => {
  29667. const key = event.key;
  29668. if (numberKeys.includes(key)) {
  29669. const keyAsNumber = parseInt(key);
  29670. let newHour;
  29671. if (isValidNumber(this.hour)) {
  29672. switch (this.hourCycle) {
  29673. case "12":
  29674. newHour =
  29675. this.hour === "01" && keyAsNumber >= 0 && keyAsNumber <= 2
  29676. ? `1${keyAsNumber}`
  29677. : keyAsNumber;
  29678. break;
  29679. case "24":
  29680. if (this.hour === "01") {
  29681. newHour = `1${keyAsNumber}`;
  29682. }
  29683. else if (this.hour === "02" && keyAsNumber >= 0 && keyAsNumber <= 3) {
  29684. newHour = `2${keyAsNumber}`;
  29685. }
  29686. else {
  29687. newHour = keyAsNumber;
  29688. }
  29689. break;
  29690. }
  29691. }
  29692. else {
  29693. newHour = keyAsNumber;
  29694. }
  29695. this.setValuePart("hour", newHour);
  29696. }
  29697. else {
  29698. switch (key) {
  29699. case "Backspace":
  29700. case "Delete":
  29701. this.setValuePart("hour", null);
  29702. break;
  29703. case "ArrowDown":
  29704. event.preventDefault();
  29705. this.decrementHour();
  29706. break;
  29707. case "ArrowUp":
  29708. event.preventDefault();
  29709. this.incrementHour();
  29710. break;
  29711. case " ":
  29712. case "Spacebar":
  29713. event.preventDefault();
  29714. break;
  29715. }
  29716. }
  29717. };
  29718. this.hourUpButtonKeyDownHandler = (event) => {
  29719. if (this.buttonActivated(event)) {
  29720. this.incrementHour();
  29721. }
  29722. };
  29723. this.incrementMeridiem = () => {
  29724. const newMeridiem = this.meridiem === "AM" ? "PM" : "AM";
  29725. this.setValuePart("meridiem", newMeridiem);
  29726. };
  29727. this.incrementHour = () => {
  29728. const newHour = isValidNumber(this.hour)
  29729. ? this.hour === "23"
  29730. ? 0
  29731. : parseInt(this.hour) + 1
  29732. : 1;
  29733. this.setValuePart("hour", newHour);
  29734. };
  29735. this.incrementMinuteOrSecond = (key) => {
  29736. const newValue = isValidNumber(this[key])
  29737. ? this[key] === "59"
  29738. ? 0
  29739. : parseInt(this[key]) + 1
  29740. : 0;
  29741. this.setValuePart(key, newValue);
  29742. };
  29743. this.incrementMinute = () => {
  29744. this.incrementMinuteOrSecond("minute");
  29745. };
  29746. this.incrementSecond = () => {
  29747. this.incrementMinuteOrSecond("second");
  29748. };
  29749. this.meridiemDownButtonKeyDownHandler = (event) => {
  29750. if (this.buttonActivated(event)) {
  29751. this.decrementMeridiem();
  29752. }
  29753. };
  29754. this.meridiemKeyDownHandler = (event) => {
  29755. switch (event.key) {
  29756. case "a":
  29757. this.setValuePart("meridiem", "AM");
  29758. break;
  29759. case "p":
  29760. this.setValuePart("meridiem", "PM");
  29761. break;
  29762. case "Backspace":
  29763. case "Delete":
  29764. this.setValuePart("meridiem", null);
  29765. break;
  29766. case "ArrowUp":
  29767. event.preventDefault();
  29768. this.incrementMeridiem();
  29769. break;
  29770. case "ArrowDown":
  29771. event.preventDefault();
  29772. this.decrementMeridiem();
  29773. break;
  29774. case " ":
  29775. case "Spacebar":
  29776. event.preventDefault();
  29777. break;
  29778. }
  29779. };
  29780. this.meridiemUpButtonKeyDownHandler = (event) => {
  29781. if (this.buttonActivated(event)) {
  29782. this.incrementMeridiem();
  29783. }
  29784. };
  29785. this.minuteDownButtonKeyDownHandler = (event) => {
  29786. if (this.buttonActivated(event)) {
  29787. this.decrementMinute();
  29788. }
  29789. };
  29790. this.minuteKeyDownHandler = (event) => {
  29791. const key = event.key;
  29792. if (numberKeys.includes(key)) {
  29793. const keyAsNumber = parseInt(key);
  29794. let newMinute;
  29795. if (isValidNumber(this.minute) && this.minute.startsWith("0")) {
  29796. const minuteAsNumber = parseInt(this.minute);
  29797. newMinute =
  29798. minuteAsNumber > maxTenthForMinuteAndSecond
  29799. ? keyAsNumber
  29800. : `${minuteAsNumber}${keyAsNumber}`;
  29801. }
  29802. else {
  29803. newMinute = keyAsNumber;
  29804. }
  29805. this.setValuePart("minute", newMinute);
  29806. }
  29807. else {
  29808. switch (key) {
  29809. case "Backspace":
  29810. case "Delete":
  29811. this.setValuePart("minute", null);
  29812. break;
  29813. case "ArrowDown":
  29814. event.preventDefault();
  29815. this.decrementMinute();
  29816. break;
  29817. case "ArrowUp":
  29818. event.preventDefault();
  29819. this.incrementMinute();
  29820. break;
  29821. case " ":
  29822. case "Spacebar":
  29823. event.preventDefault();
  29824. break;
  29825. }
  29826. }
  29827. };
  29828. this.minuteUpButtonKeyDownHandler = (event) => {
  29829. if (this.buttonActivated(event)) {
  29830. this.incrementMinute();
  29831. }
  29832. };
  29833. this.secondDownButtonKeyDownHandler = (event) => {
  29834. if (this.buttonActivated(event)) {
  29835. this.decrementSecond();
  29836. }
  29837. };
  29838. this.secondKeyDownHandler = (event) => {
  29839. const key = event.key;
  29840. if (numberKeys.includes(key)) {
  29841. const keyAsNumber = parseInt(key);
  29842. let newSecond;
  29843. if (isValidNumber(this.second) && this.second.startsWith("0")) {
  29844. const secondAsNumber = parseInt(this.second);
  29845. newSecond =
  29846. secondAsNumber > maxTenthForMinuteAndSecond
  29847. ? keyAsNumber
  29848. : `${secondAsNumber}${keyAsNumber}`;
  29849. }
  29850. else {
  29851. newSecond = keyAsNumber;
  29852. }
  29853. this.setValuePart("second", newSecond);
  29854. }
  29855. else {
  29856. switch (key) {
  29857. case "Backspace":
  29858. case "Delete":
  29859. this.setValuePart("second", null);
  29860. break;
  29861. case "ArrowDown":
  29862. event.preventDefault();
  29863. this.decrementSecond();
  29864. break;
  29865. case "ArrowUp":
  29866. event.preventDefault();
  29867. this.incrementSecond();
  29868. break;
  29869. case " ":
  29870. case "Spacebar":
  29871. event.preventDefault();
  29872. break;
  29873. }
  29874. }
  29875. };
  29876. this.secondUpButtonKeyDownHandler = (event) => {
  29877. if (this.buttonActivated(event)) {
  29878. this.incrementSecond();
  29879. }
  29880. };
  29881. this.setHourEl = (el) => (this.hourEl = el);
  29882. this.setMeridiemEl = (el) => (this.meridiemEl = el);
  29883. this.setMinuteEl = (el) => (this.minuteEl = el);
  29884. this.setSecondEl = (el) => (this.secondEl = el);
  29885. this.setValue = (value, emit = true) => {
  29886. if (isValidTime(value)) {
  29887. const { hour, minute, second } = parseTimeString(value);
  29888. const { localizedHour, localizedHourSuffix, localizedMinute, localizedMinuteSuffix, localizedSecond, localizedSecondSuffix, localizedMeridiem } = localizeTimeStringToParts(value, this.locale);
  29889. this.localizedHour = localizedHour;
  29890. this.localizedHourSuffix = localizedHourSuffix;
  29891. this.localizedMinute = localizedMinute;
  29892. this.localizedMinuteSuffix = localizedMinuteSuffix;
  29893. this.localizedSecond = localizedSecond;
  29894. this.localizedSecondSuffix = localizedSecondSuffix;
  29895. this.hour = hour;
  29896. this.minute = minute;
  29897. this.second = second;
  29898. if (localizedMeridiem) {
  29899. this.localizedMeridiem = localizedMeridiem;
  29900. this.meridiem = getMeridiem(this.hour);
  29901. const formatParts = getTimeParts(value, this.locale);
  29902. this.meridiemOrder = this.getMeridiemOrder(formatParts);
  29903. }
  29904. }
  29905. else {
  29906. this.hour = null;
  29907. this.localizedHour = null;
  29908. this.localizedHourSuffix = null;
  29909. this.localizedMeridiem = null;
  29910. this.localizedMinute = null;
  29911. this.localizedMinuteSuffix = null;
  29912. this.localizedSecond = null;
  29913. this.localizedSecondSuffix = null;
  29914. this.meridiem = null;
  29915. this.minute = null;
  29916. this.second = null;
  29917. this.value = null;
  29918. }
  29919. if (emit) {
  29920. this.calciteTimePickerChange.emit();
  29921. }
  29922. };
  29923. this.setValuePart = (key, value, emit = true) => {
  29924. var _a;
  29925. if (key === "meridiem") {
  29926. this.meridiem = value;
  29927. if (isValidNumber(this.hour)) {
  29928. const hourAsNumber = parseInt(this.hour);
  29929. switch (value) {
  29930. case "AM":
  29931. if (hourAsNumber >= 12) {
  29932. this.hour = formatTimePart(hourAsNumber - 12);
  29933. }
  29934. break;
  29935. case "PM":
  29936. if (hourAsNumber < 12) {
  29937. this.hour = formatTimePart(hourAsNumber + 12);
  29938. }
  29939. break;
  29940. }
  29941. this.localizedHour = localizeTimePart(this.hour, "hour", this.locale);
  29942. }
  29943. }
  29944. else {
  29945. this[key] = typeof value === "number" ? formatTimePart(value) : value;
  29946. this[`localized${capitalize(key)}`] = localizeTimePart(this[key], key, this.locale);
  29947. }
  29948. if (this.hour && this.minute) {
  29949. const showSeconds = this.second && this.showSecond;
  29950. this.value = `${this.hour}:${this.minute}:${showSeconds ? this.second : "00"}`;
  29951. }
  29952. else {
  29953. this.value = null;
  29954. }
  29955. this.localizedMeridiem = this.value
  29956. ? ((_a = localizeTimeStringToParts(this.value, this.locale)) === null || _a === void 0 ? void 0 : _a.localizedMeridiem) || null
  29957. : localizeTimePart(this.meridiem, "meridiem", this.locale);
  29958. if (emit) {
  29959. this.calciteTimePickerChange.emit();
  29960. }
  29961. };
  29962. }
  29963. localeWatcher(newLocale) {
  29964. this.hourCycle = getLocaleHourCycle(newLocale);
  29965. this.setValue(this.value, false);
  29966. }
  29967. valueWatcher(newValue) {
  29968. this.setValue(newValue, false);
  29969. }
  29970. //--------------------------------------------------------------------------
  29971. //
  29972. // Event Listeners
  29973. //
  29974. //--------------------------------------------------------------------------
  29975. hostBlurHandler() {
  29976. this.calciteTimePickerBlur.emit();
  29977. }
  29978. hostFocusHandler() {
  29979. this.calciteTimePickerFocus.emit();
  29980. }
  29981. keyDownHandler(event) {
  29982. const key = event.key;
  29983. switch (this.activeEl) {
  29984. case this.hourEl:
  29985. if (key === "ArrowRight") {
  29986. this.setFocus("minute");
  29987. }
  29988. break;
  29989. case this.minuteEl:
  29990. switch (key) {
  29991. case "ArrowLeft":
  29992. this.setFocus("hour");
  29993. break;
  29994. case "ArrowRight":
  29995. if (this.step !== 60) {
  29996. this.setFocus("second");
  29997. }
  29998. else if (this.hourCycle === "12") {
  29999. this.setFocus("meridiem");
  30000. }
  30001. break;
  30002. }
  30003. break;
  30004. case this.secondEl:
  30005. switch (key) {
  30006. case "ArrowLeft":
  30007. this.setFocus("minute");
  30008. break;
  30009. case "ArrowRight":
  30010. if (this.hourCycle === "12") {
  30011. this.setFocus("meridiem");
  30012. }
  30013. break;
  30014. }
  30015. break;
  30016. case this.meridiemEl:
  30017. switch (key) {
  30018. case "ArrowLeft":
  30019. if (this.step !== 60) {
  30020. this.setFocus("second");
  30021. }
  30022. else {
  30023. this.setFocus("minute");
  30024. }
  30025. break;
  30026. }
  30027. break;
  30028. }
  30029. }
  30030. //--------------------------------------------------------------------------
  30031. //
  30032. // Public Methods
  30033. //
  30034. //--------------------------------------------------------------------------
  30035. /** Sets focus on the component. */
  30036. async setFocus(target) {
  30037. var _a;
  30038. (_a = this[`${target || "hour"}El`]) === null || _a === void 0 ? void 0 : _a.focus();
  30039. }
  30040. // --------------------------------------------------------------------------
  30041. //
  30042. // Private Methods
  30043. //
  30044. // --------------------------------------------------------------------------
  30045. buttonActivated(event) {
  30046. const key = event.key;
  30047. if (key === " ") {
  30048. event.preventDefault();
  30049. }
  30050. return isActivationKey(key);
  30051. }
  30052. getMeridiemOrder(formatParts) {
  30053. const isRTLKind = this.locale === "ar" || this.locale === "he";
  30054. if (formatParts && !isRTLKind) {
  30055. const index = formatParts.findIndex((parts) => {
  30056. return parts.value === this.localizedMeridiem;
  30057. });
  30058. return index;
  30059. }
  30060. return 0;
  30061. }
  30062. // --------------------------------------------------------------------------
  30063. //
  30064. // Lifecycle
  30065. //
  30066. // --------------------------------------------------------------------------
  30067. connectedCallback() {
  30068. this.setValue(this.value, false);
  30069. this.hourCycle = getLocaleHourCycle(this.locale);
  30070. }
  30071. // --------------------------------------------------------------------------
  30072. //
  30073. // Render Methods
  30074. //
  30075. // --------------------------------------------------------------------------
  30076. render() {
  30077. const hourIsNumber = isValidNumber(this.hour);
  30078. const iconScale = this.scale === "s" || this.scale === "m" ? "s" : "m";
  30079. const minuteIsNumber = isValidNumber(this.minute);
  30080. const secondIsNumber = isValidNumber(this.second);
  30081. const showMeridiem = this.hourCycle === "12";
  30082. return (hAsync("div", { class: {
  30083. [CSS$5.timePicker]: true,
  30084. [CSS$5.showMeridiem]: showMeridiem,
  30085. [CSS$5.showSecond]: this.showSecond,
  30086. [CSS$5[`scale-${this.scale}`]]: true
  30087. }, dir: "ltr" }, hAsync("div", { class: CSS$5.column, role: "group" }, hAsync("span", { "aria-label": this.intlHourUp, class: {
  30088. [CSS$5.button]: true,
  30089. [CSS$5.buttonHourUp]: true,
  30090. [CSS$5.buttonTopLeft]: true
  30091. }, onClick: this.incrementHour, onKeyDown: this.hourUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-up", scale: iconScale })), hAsync("span", { "aria-label": this.intlHour, "aria-valuemax": "23", "aria-valuemin": "1", "aria-valuenow": (hourIsNumber && parseInt(this.hour)) || "0", "aria-valuetext": this.hour, class: {
  30092. [CSS$5.input]: true,
  30093. [CSS$5.hour]: true
  30094. }, onFocus: this.focusHandler, onKeyDown: this.hourKeyDownHandler, ref: this.setHourEl, role: "spinbutton", tabIndex: 0 }, this.localizedHour || "--"), hAsync("span", { "aria-label": this.intlHourDown, class: {
  30095. [CSS$5.button]: true,
  30096. [CSS$5.buttonHourDown]: true,
  30097. [CSS$5.buttonBottomLeft]: true
  30098. }, onClick: this.decrementHour, onKeyDown: this.hourDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale }))), hAsync("span", { class: CSS$5.delimiter }, this.localizedHourSuffix), hAsync("div", { class: CSS$5.column, role: "group" }, hAsync("span", { "aria-label": this.intlMinuteUp, class: {
  30099. [CSS$5.button]: true,
  30100. [CSS$5.buttonMinuteUp]: true
  30101. }, onClick: this.incrementMinute, onKeyDown: this.minuteUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-up", scale: iconScale })), hAsync("span", { "aria-label": this.intlMinute, "aria-valuemax": "12", "aria-valuemin": "1", "aria-valuenow": (minuteIsNumber && parseInt(this.minute)) || "0", "aria-valuetext": this.minute, class: {
  30102. [CSS$5.input]: true,
  30103. [CSS$5.minute]: true
  30104. }, onFocus: this.focusHandler, onKeyDown: this.minuteKeyDownHandler, ref: this.setMinuteEl, role: "spinbutton", tabIndex: 0 }, this.localizedMinute || "--"), hAsync("span", { "aria-label": this.intlMinuteDown, class: {
  30105. [CSS$5.button]: true,
  30106. [CSS$5.buttonMinuteDown]: true
  30107. }, onClick: this.decrementMinute, onKeyDown: this.minuteDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale }))), this.showSecond && hAsync("span", { class: CSS$5.delimiter }, this.localizedMinuteSuffix), this.showSecond && (hAsync("div", { class: CSS$5.column, role: "group" }, hAsync("span", { "aria-label": this.intlSecondUp, class: {
  30108. [CSS$5.button]: true,
  30109. [CSS$5.buttonSecondUp]: true
  30110. }, onClick: this.incrementSecond, onKeyDown: this.secondUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-up", scale: iconScale })), hAsync("span", { "aria-label": this.intlSecond, "aria-valuemax": "59", "aria-valuemin": "0", "aria-valuenow": (secondIsNumber && parseInt(this.second)) || "0", "aria-valuetext": this.second, class: {
  30111. [CSS$5.input]: true,
  30112. [CSS$5.second]: true
  30113. }, onFocus: this.focusHandler, onKeyDown: this.secondKeyDownHandler, ref: this.setSecondEl, role: "spinbutton", tabIndex: 0 }, this.localizedSecond || "--"), hAsync("span", { "aria-label": this.intlSecondDown, class: {
  30114. [CSS$5.button]: true,
  30115. [CSS$5.buttonSecondDown]: true
  30116. }, onClick: this.decrementSecond, onKeyDown: this.secondDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale })))), this.localizedSecondSuffix && (hAsync("span", { class: CSS$5.delimiter }, this.localizedSecondSuffix)), showMeridiem && (hAsync("div", { class: {
  30117. [CSS$5.column]: true,
  30118. [CSS$5.meridiemStart]: this.meridiemOrder === 0
  30119. }, role: "group" }, hAsync("span", { "aria-label": this.intlMeridiemUp, class: {
  30120. [CSS$5.button]: true,
  30121. [CSS$5.buttonMeridiemUp]: true,
  30122. [CSS$5.buttonTopRight]: true
  30123. }, onClick: this.incrementMeridiem, onKeyDown: this.meridiemUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-up", scale: iconScale })), hAsync("span", { "aria-label": this.intlMeridiem, "aria-valuemax": "2", "aria-valuemin": "1", "aria-valuenow": (this.meridiem === "PM" && "2") || "1", "aria-valuetext": this.meridiem, class: {
  30124. [CSS$5.input]: true,
  30125. [CSS$5.meridiem]: true
  30126. }, onFocus: this.focusHandler, onKeyDown: this.meridiemKeyDownHandler, ref: this.setMeridiemEl, role: "spinbutton", tabIndex: 0 }, this.localizedMeridiem || "--"), hAsync("span", { "aria-label": this.intlMeridiemDown, class: {
  30127. [CSS$5.button]: true,
  30128. [CSS$5.buttonMeridiemDown]: true,
  30129. [CSS$5.buttonBottomRight]: true
  30130. }, onClick: this.decrementMeridiem, onKeyDown: this.meridiemDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale }))))));
  30131. }
  30132. get el() { return getElement(this); }
  30133. static get watchers() { return {
  30134. "locale": ["localeWatcher"],
  30135. "value": ["valueWatcher"]
  30136. }; }
  30137. static get style() { return timePickerCss; }
  30138. static get cmpMeta() { return {
  30139. "$flags$": 9,
  30140. "$tagName$": "calcite-time-picker",
  30141. "$members$": {
  30142. "intlHour": [1, "intl-hour"],
  30143. "intlHourDown": [1, "intl-hour-down"],
  30144. "intlHourUp": [1, "intl-hour-up"],
  30145. "intlMeridiem": [1, "intl-meridiem"],
  30146. "intlMeridiemDown": [1, "intl-meridiem-down"],
  30147. "intlMeridiemUp": [1, "intl-meridiem-up"],
  30148. "intlMinute": [1, "intl-minute"],
  30149. "intlMinuteDown": [1, "intl-minute-down"],
  30150. "intlMinuteUp": [1, "intl-minute-up"],
  30151. "intlSecond": [1, "intl-second"],
  30152. "intlSecondDown": [1, "intl-second-down"],
  30153. "intlSecondUp": [1, "intl-second-up"],
  30154. "locale": [1025, "lang"],
  30155. "scale": [1],
  30156. "step": [2],
  30157. "value": [1025],
  30158. "hour": [32],
  30159. "hourCycle": [32],
  30160. "localizedHour": [32],
  30161. "localizedHourSuffix": [32],
  30162. "localizedMeridiem": [32],
  30163. "localizedMinute": [32],
  30164. "localizedMinuteSuffix": [32],
  30165. "localizedSecond": [32],
  30166. "localizedSecondSuffix": [32],
  30167. "meridiem": [32],
  30168. "minute": [32],
  30169. "second": [32],
  30170. "showSecond": [32],
  30171. "setFocus": [64]
  30172. },
  30173. "$listeners$": [[0, "blur", "hostBlurHandler"], [0, "focus", "hostFocusHandler"], [0, "keydown", "keyDownHandler"]],
  30174. "$lazyBundleId$": "-",
  30175. "$attrsToReflect$": []
  30176. }; }
  30177. }
  30178. const CSS$4 = {
  30179. header: "header",
  30180. heading: "heading",
  30181. close: "close",
  30182. container: "container",
  30183. tipContainer: "tip-container",
  30184. tipContainerAdvancing: "tip-container--advancing",
  30185. tipContainerRetreating: "tip-container--retreating",
  30186. pagination: "pagination",
  30187. pagePosition: "page-position",
  30188. pageNext: "page-next",
  30189. pagePrevious: "page-previous"
  30190. };
  30191. const ICONS$3 = {
  30192. chevronLeft: "chevron-left",
  30193. chevronRight: "chevron-right",
  30194. close: "x"
  30195. };
  30196. const TEXT$1 = {
  30197. defaultGroupTitle: "Tips",
  30198. defaultPaginationLabel: "Tip",
  30199. close: "Close",
  30200. previous: "Previous",
  30201. next: "Next"
  30202. };
  30203. const HEADING_LEVEL$1 = 2;
  30204. const CSS$3 = {
  30205. container: "container",
  30206. header: "header",
  30207. heading: "heading",
  30208. close: "close",
  30209. imageFrame: "image-frame",
  30210. content: "content",
  30211. info: "info"
  30212. };
  30213. const ICONS$2 = {
  30214. close: "x"
  30215. };
  30216. const SLOTS$2 = {
  30217. thumbnail: "thumbnail"
  30218. };
  30219. const TEXT = {
  30220. close: "Close"
  30221. };
  30222. const HEADING_LEVEL = (HEADING_LEVEL$1 + 1);
  30223. const tipCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tip:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tip{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tip:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-h{display:none}/*!@:host*/.sc-calcite-tip-h{position:relative;margin:1rem;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}/*!@:host **/.sc-calcite-tip-h *.sc-calcite-tip{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@.container*/.container.sc-calcite-tip{width:100%;padding:1rem}/*!@:host([dismissed]), :host([dismissed]) .container*/[dismissed].sc-calcite-tip-h,[dismissed].sc-calcite-tip-h .container.sc-calcite-tip{display:none}/*!@:host([selected]) .container*/[selected].sc-calcite-tip-h .container.sc-calcite-tip{margin:0px;border-style:none;padding:0px}/*!@.header*/.header.sc-calcite-tip{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-line-pack:justify;align-content:space-between;-ms-flex-align:center;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-tip{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-tip .heading.sc-calcite-tip{-ms-flex:1 1 auto;flex:1 1 auto;padding:0.5rem}/*!@h1.heading*/h1.heading.sc-calcite-tip{font-size:var(--calcite-font-size-2);line-height:1.5rem}/*!@h2.heading*/h2.heading.sc-calcite-tip{font-size:var(--calcite-font-size-1);line-height:1.5rem}/*!@h3.heading*/h3.heading.sc-calcite-tip{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@h4.heading, h5.heading*/h4.heading.sc-calcite-tip,h5.heading.sc-calcite-tip{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.header*/.header.sc-calcite-tip{margin-bottom:0.5rem}/*!@.header .heading*/.header.sc-calcite-tip .heading.sc-calcite-tip{padding:0px;color:var(--calcite-ui-text-1)}/*!@.container[hidden]*/.container[hidden].sc-calcite-tip{display:none}/*!@.content*/.content.sc-calcite-tip{display:-ms-flexbox;display:flex}/*!@.info*/.info.sc-calcite-tip{padding-top:0px;padding-bottom:0px;padding-left:1rem;padding-right:1rem;width:70%}/*!@.info:only-child*/.info.sc-calcite-tip:only-child{width:100%;padding-left:0px;padding-right:0px}/*!@::slotted(p)*/.sc-calcite-tip-s>p{margin-top:0px}/*!@::slotted(a)*/.sc-calcite-tip-s>a{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;color:var(--calcite-ui-brand)}/*!@::slotted(a:focus)*/.sc-calcite-tip-s>a:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.image-frame*/.image-frame.sc-calcite-tip{width:25%}/*!@.image-frame img*/.image-frame.sc-calcite-tip img.sc-calcite-tip{max-width:100%}/*!@::slotted(img)*/.sc-calcite-tip-s>img{max-width:100%}";
  30224. /**
  30225. * @slot - A slot for adding text and a hyperlink.
  30226. * @slot thumbnail - A slot for adding an HTML image element to the tip.
  30227. */
  30228. class Tip {
  30229. constructor(hostRef) {
  30230. registerInstance(this, hostRef);
  30231. this.calciteTipDismiss = createEvent(this, "calciteTipDismiss", 7);
  30232. // --------------------------------------------------------------------------
  30233. //
  30234. // Properties
  30235. //
  30236. // --------------------------------------------------------------------------
  30237. /**
  30238. * No longer displays the tip.
  30239. */
  30240. this.dismissed = false;
  30241. /**
  30242. * Indicates whether the tip can be dismissed.
  30243. */
  30244. this.nonDismissible = false;
  30245. /**
  30246. * The selected state of the tip if it is being used inside a `calcite-tip-manager`.
  30247. */
  30248. this.selected = false;
  30249. // --------------------------------------------------------------------------
  30250. //
  30251. // Private Methods
  30252. //
  30253. // --------------------------------------------------------------------------
  30254. this.hideTip = () => {
  30255. this.dismissed = true;
  30256. this.calciteTipDismiss.emit();
  30257. };
  30258. }
  30259. // --------------------------------------------------------------------------
  30260. //
  30261. // Lifecycle
  30262. //
  30263. // --------------------------------------------------------------------------
  30264. connectedCallback() {
  30265. connectConditionalSlotComponent(this);
  30266. }
  30267. disconnectedCallback() {
  30268. disconnectConditionalSlotComponent(this);
  30269. }
  30270. // --------------------------------------------------------------------------
  30271. //
  30272. // Render Methods
  30273. //
  30274. // --------------------------------------------------------------------------
  30275. renderHeader() {
  30276. var _a;
  30277. const { heading, headingLevel, el } = this;
  30278. const parentLevel = (_a = el.closest("calcite-tip-manager")) === null || _a === void 0 ? void 0 : _a.headingLevel;
  30279. const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
  30280. const level = headingLevel || relativeLevel || HEADING_LEVEL;
  30281. return heading ? (hAsync("header", { class: CSS$3.header }, hAsync(Heading, { class: CSS$3.heading, level: level }, heading))) : null;
  30282. }
  30283. renderDismissButton() {
  30284. const { nonDismissible, hideTip, intlClose } = this;
  30285. const text = intlClose || TEXT.close;
  30286. return !nonDismissible ? (hAsync("calcite-action", { class: CSS$3.close, icon: ICONS$2.close, onClick: hideTip, scale: "l", text: text })) : null;
  30287. }
  30288. renderImageFrame() {
  30289. const { el } = this;
  30290. return getSlotted(el, SLOTS$2.thumbnail) ? (hAsync("div", { class: CSS$3.imageFrame, key: "thumbnail" }, hAsync("slot", { name: SLOTS$2.thumbnail }))) : null;
  30291. }
  30292. renderInfoNode() {
  30293. return (hAsync("div", { class: CSS$3.info }, hAsync("slot", null)));
  30294. }
  30295. renderContent() {
  30296. return (hAsync("div", { class: CSS$3.content }, this.renderImageFrame(), this.renderInfoNode()));
  30297. }
  30298. render() {
  30299. return (hAsync(Fragment, null, hAsync("article", { class: CSS$3.container }, this.renderHeader(), this.renderContent()), this.renderDismissButton()));
  30300. }
  30301. get el() { return getElement(this); }
  30302. static get style() { return tipCss; }
  30303. static get cmpMeta() { return {
  30304. "$flags$": 9,
  30305. "$tagName$": "calcite-tip",
  30306. "$members$": {
  30307. "dismissed": [1540],
  30308. "nonDismissible": [516, "non-dismissible"],
  30309. "heading": [1],
  30310. "headingLevel": [2, "heading-level"],
  30311. "selected": [516],
  30312. "intlClose": [1, "intl-close"]
  30313. },
  30314. "$listeners$": undefined,
  30315. "$lazyBundleId$": "-",
  30316. "$attrsToReflect$": [["dismissed", "dismissed"], ["nonDismissible", "non-dismissible"], ["selected", "selected"]]
  30317. }; }
  30318. }
  30319. const tipGroupCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tip-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tip-group{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip-group{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip-group{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip-group{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip-group{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tip-group:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-group-h{display:none}/*!@:host*/.sc-calcite-tip-group-h{-webkit-box-sizing:border-box;box-sizing:border-box;display:block;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}/*!@::slotted(calcite-tip)*/.sc-calcite-tip-group-s>calcite-tip{margin:0px;border-style:none}/*!@:host-context(calcite-tip-manager)*/calcite-tip-manager.sc-calcite-tip-group-h,calcite-tip-manager .sc-calcite-tip-group-h{margin-top:0.75rem;margin-bottom:0.75rem}/*!@:host-context(calcite-tip-manager) ::slotted(calcite-tip)*/.sc-calcite-tip-group-hcalcite-tip-manager .sc-calcite-tip-group-s>calcite-tip,calcite-tip-manager .sc-calcite-tip-group-h .sc-calcite-tip-group-s>calcite-tip{padding:1rem}";
  30320. /**
  30321. * @slot - A slot for adding `calcite-tip`s.
  30322. */
  30323. class TipGroup {
  30324. constructor(hostRef) {
  30325. registerInstance(this, hostRef);
  30326. }
  30327. render() {
  30328. return hAsync("slot", null);
  30329. }
  30330. static get style() { return tipGroupCss; }
  30331. static get cmpMeta() { return {
  30332. "$flags$": 9,
  30333. "$tagName$": "calcite-tip-group",
  30334. "$members$": {
  30335. "groupTitle": [1, "group-title"]
  30336. },
  30337. "$listeners$": undefined,
  30338. "$lazyBundleId$": "-",
  30339. "$attrsToReflect$": []
  30340. }; }
  30341. }
  30342. const tipManagerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tip-manager:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tip-manager{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip-manager{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip-manager{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip-manager{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip-manager{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tip-manager:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-manager-h{display:none}/*!@:host*/.sc-calcite-tip-manager-h{-webkit-box-sizing:border-box;box-sizing:border-box;display:block;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2);--calcite-tip-manager-height:19vh}/*!@:host **/.sc-calcite-tip-manager-h *.sc-calcite-tip-manager{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:host([closed])*/[closed].sc-calcite-tip-manager-h{display:none}/*!@.header*/.header.sc-calcite-tip-manager{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-line-pack:justify;align-content:space-between;-ms-flex-align:center;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-tip-manager{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-tip-manager .heading.sc-calcite-tip-manager{-ms-flex:1 1 auto;flex:1 1 auto;padding:0.5rem}/*!@h1.heading*/h1.heading.sc-calcite-tip-manager{font-size:var(--calcite-font-size-2);line-height:1.5rem}/*!@h2.heading*/h2.heading.sc-calcite-tip-manager{font-size:var(--calcite-font-size-1);line-height:1.5rem}/*!@h3.heading*/h3.heading.sc-calcite-tip-manager{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@h4.heading, h5.heading*/h4.heading.sc-calcite-tip-manager,h5.heading.sc-calcite-tip-manager{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.header*/.header.sc-calcite-tip-manager{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-top:0px;padding-bottom:0px;-webkit-padding-end:0px;padding-inline-end:0px;-webkit-padding-start:1rem;padding-inline-start:1rem}/*!@.header h2.heading*/.header.sc-calcite-tip-manager h2.heading.sc-calcite-tip-manager{padding:0px;font-size:var(--calcite-font-size-1);line-height:1.5rem;font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-1)}/*!@.container*/.container.sc-calcite-tip-manager{position:relative;overflow:hidden;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;min-height:150px}/*!@.container:focus*/.container.sc-calcite-tip-manager:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.tip-container*/.tip-container.sc-calcite-tip-manager{margin-top:1px;display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center;overflow:auto;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;-webkit-animation-name:none;animation-name:none;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing);height:var(--calcite-tip-manager-height)}/*!@.tip-container:focus*/.tip-container.sc-calcite-tip-manager:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@::slotted(calcite-tip)*/.sc-calcite-tip-manager-s>calcite-tip{border-style:none;padding:0.75rem;max-width:var(--calcite-tip-max-width)}/*!@.tip-container--advancing*/.tip-container--advancing.sc-calcite-tip-manager{-webkit-animation-name:tip-advance;animation-name:tip-advance}/*!@.tip-container--retreating*/.tip-container--retreating.sc-calcite-tip-manager{-webkit-animation-name:tip-retreat;animation-name:tip-retreat}/*!@.pagination*/.pagination.sc-calcite-tip-manager{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-left:0px;padding-right:0px;padding-top:0.75rem;padding-bottom:0.5rem}/*!@.page-position*/.page-position.sc-calcite-tip-manager{margin-top:0px;margin-bottom:0px;margin-left:0.5rem;margin-right:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}@-webkit-keyframes tip-advance{0%{opacity:0;-webkit-transform:translate3d(50px, 0, 0) scale(0.99);transform:translate3d(50px, 0, 0) scale(0.99)}100%{opacity:1;-webkit-transform:translate3d(0, 0, 0) scale(1);transform:translate3d(0, 0, 0) scale(1)}}@keyframes tip-advance{0%{opacity:0;-webkit-transform:translate3d(50px, 0, 0) scale(0.99);transform:translate3d(50px, 0, 0) scale(0.99)}100%{opacity:1;-webkit-transform:translate3d(0, 0, 0) scale(1);transform:translate3d(0, 0, 0) scale(1)}}@-webkit-keyframes tip-retreat{0%{opacity:0;-webkit-transform:translate3d(-50px, 0, 0) scale(0.99);transform:translate3d(-50px, 0, 0) scale(0.99)}100%{opacity:1;-webkit-transform:translate3d(0, 0, 0) scale(1);transform:translate3d(0, 0, 0) scale(1)}}@keyframes tip-retreat{0%{opacity:0;-webkit-transform:translate3d(-50px, 0, 0) scale(0.99);transform:translate3d(-50px, 0, 0) scale(0.99)}100%{opacity:1;-webkit-transform:translate3d(0, 0, 0) scale(1);transform:translate3d(0, 0, 0) scale(1)}}";
  30343. /**
  30344. * @slot - A slot for adding `calcite-tip`s.
  30345. */
  30346. class TipManager {
  30347. constructor(hostRef) {
  30348. registerInstance(this, hostRef);
  30349. this.calciteTipManagerToggle = createEvent(this, "calciteTipManagerToggle", 7);
  30350. this.calciteTipManagerClose = createEvent(this, "calciteTipManagerClose", 7);
  30351. // --------------------------------------------------------------------------
  30352. //
  30353. // Properties
  30354. //
  30355. // --------------------------------------------------------------------------
  30356. /**
  30357. * Closed state of the `calcite-tip-manager`.
  30358. */
  30359. this.closed = false;
  30360. this.mutationObserver = createObserver();
  30361. this.hideTipManager = () => {
  30362. this.closed = true;
  30363. this.calciteTipManagerToggle.emit();
  30364. this.calciteTipManagerClose.emit();
  30365. };
  30366. this.previousClicked = () => {
  30367. this.previousTip();
  30368. };
  30369. this.nextClicked = () => {
  30370. this.nextTip();
  30371. };
  30372. this.tipManagerKeyUpHandler = (event) => {
  30373. if (event.target !== this.container) {
  30374. return;
  30375. }
  30376. switch (event.key) {
  30377. case "ArrowRight":
  30378. event.preventDefault();
  30379. this.nextTip();
  30380. break;
  30381. case "ArrowLeft":
  30382. event.preventDefault();
  30383. this.previousTip();
  30384. break;
  30385. case "Home":
  30386. event.preventDefault();
  30387. this.selectedIndex = 0;
  30388. break;
  30389. case "End":
  30390. event.preventDefault();
  30391. this.selectedIndex = this.total - 1;
  30392. break;
  30393. }
  30394. };
  30395. this.storeContainerRef = (el) => {
  30396. this.container = el;
  30397. };
  30398. }
  30399. closedChangeHandler() {
  30400. this.direction = null;
  30401. this.calciteTipManagerToggle.emit();
  30402. }
  30403. selectedChangeHandler() {
  30404. this.showSelectedTip();
  30405. this.updateGroupTitle();
  30406. }
  30407. // --------------------------------------------------------------------------
  30408. //
  30409. // Lifecycle
  30410. //
  30411. // --------------------------------------------------------------------------
  30412. connectedCallback() {
  30413. var _a;
  30414. this.setUpTips();
  30415. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  30416. }
  30417. disconnectedCallback() {
  30418. var _a;
  30419. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  30420. }
  30421. // --------------------------------------------------------------------------
  30422. //
  30423. // Public Methods
  30424. //
  30425. // --------------------------------------------------------------------------
  30426. /** Selects the next tip to display */
  30427. async nextTip() {
  30428. this.direction = "advancing";
  30429. const nextIndex = this.selectedIndex + 1;
  30430. this.selectedIndex = (nextIndex + this.total) % this.total;
  30431. }
  30432. /** Selects the previous tip to display */
  30433. async previousTip() {
  30434. this.direction = "retreating";
  30435. const previousIndex = this.selectedIndex - 1;
  30436. this.selectedIndex = (previousIndex + this.total) % this.total;
  30437. }
  30438. // --------------------------------------------------------------------------
  30439. //
  30440. // Private Methods
  30441. //
  30442. // --------------------------------------------------------------------------
  30443. setUpTips() {
  30444. const tips = Array.from(this.el.querySelectorAll("calcite-tip"));
  30445. this.total = tips.length;
  30446. if (this.total === 0) {
  30447. return;
  30448. }
  30449. const selectedTip = this.el.querySelector("calcite-tip[selected]");
  30450. this.tips = tips;
  30451. this.selectedIndex = selectedTip ? tips.indexOf(selectedTip) : 0;
  30452. tips.forEach((tip) => {
  30453. tip.nonDismissible = true;
  30454. });
  30455. this.showSelectedTip();
  30456. this.updateGroupTitle();
  30457. }
  30458. showSelectedTip() {
  30459. this.tips.forEach((tip, index) => {
  30460. const isSelected = this.selectedIndex === index;
  30461. tip.selected = isSelected;
  30462. tip.hidden = !isSelected;
  30463. });
  30464. }
  30465. updateGroupTitle() {
  30466. const selectedTip = this.tips[this.selectedIndex];
  30467. const tipParent = selectedTip.closest("calcite-tip-group");
  30468. this.groupTitle = (tipParent === null || tipParent === void 0 ? void 0 : tipParent.groupTitle) || this.intlDefaultTitle || TEXT$1.defaultGroupTitle;
  30469. }
  30470. // --------------------------------------------------------------------------
  30471. //
  30472. // Render Methods
  30473. //
  30474. // --------------------------------------------------------------------------
  30475. renderPagination() {
  30476. const dir = getElementDir(this.el);
  30477. const { selectedIndex, tips, total, intlNext, intlPrevious, intlPaginationLabel } = this;
  30478. const nextLabel = intlNext || TEXT$1.next;
  30479. const previousLabel = intlPrevious || TEXT$1.previous;
  30480. const paginationLabel = intlPaginationLabel || TEXT$1.defaultPaginationLabel;
  30481. return tips.length > 1 ? (hAsync("footer", { class: CSS$4.pagination }, hAsync("calcite-action", { class: CSS$4.pagePrevious, icon: dir === "ltr" ? ICONS$3.chevronLeft : ICONS$3.chevronRight, onClick: this.previousClicked, scale: "m", text: previousLabel }), hAsync("span", { class: CSS$4.pagePosition }, `${paginationLabel} ${selectedIndex + 1}/${total}`), hAsync("calcite-action", { class: CSS$4.pageNext, icon: dir === "ltr" ? ICONS$3.chevronRight : ICONS$3.chevronLeft, onClick: this.nextClicked, scale: "m", text: nextLabel }))) : null;
  30482. }
  30483. render() {
  30484. const { closed, direction, headingLevel, groupTitle, selectedIndex, intlClose, total } = this;
  30485. const closeLabel = intlClose || TEXT$1.close;
  30486. if (total === 0) {
  30487. return null;
  30488. }
  30489. return (hAsync("section", { "aria-hidden": toAriaBoolean(closed), class: CSS$4.container, hidden: closed, onKeyUp: this.tipManagerKeyUpHandler, ref: this.storeContainerRef, tabIndex: 0 }, hAsync("header", { class: CSS$4.header }, hAsync(Heading, { class: CSS$4.heading, level: headingLevel || HEADING_LEVEL$1 }, groupTitle), hAsync("calcite-action", { class: CSS$4.close, onClick: this.hideTipManager, scale: "m", text: closeLabel }, hAsync("calcite-icon", { icon: ICONS$3.close, scale: "m" }))), hAsync("div", { class: {
  30490. [CSS$4.tipContainer]: true,
  30491. [CSS$4.tipContainerAdvancing]: !closed && direction === "advancing",
  30492. [CSS$4.tipContainerRetreating]: !closed && direction === "retreating"
  30493. }, key: selectedIndex, tabIndex: 0 }, hAsync("slot", null)), this.renderPagination()));
  30494. }
  30495. get el() { return getElement(this); }
  30496. static get watchers() { return {
  30497. "closed": ["closedChangeHandler"],
  30498. "selectedIndex": ["selectedChangeHandler"]
  30499. }; }
  30500. static get style() { return tipManagerCss; }
  30501. static get cmpMeta() { return {
  30502. "$flags$": 9,
  30503. "$tagName$": "calcite-tip-manager",
  30504. "$members$": {
  30505. "closed": [1540],
  30506. "headingLevel": [2, "heading-level"],
  30507. "intlClose": [1, "intl-close"],
  30508. "intlDefaultTitle": [1, "intl-default-title"],
  30509. "intlNext": [1, "intl-next"],
  30510. "intlPaginationLabel": [1, "intl-pagination-label"],
  30511. "intlPrevious": [1, "intl-previous"],
  30512. "selectedIndex": [32],
  30513. "tips": [32],
  30514. "total": [32],
  30515. "direction": [32],
  30516. "groupTitle": [32],
  30517. "nextTip": [64],
  30518. "previousTip": [64]
  30519. },
  30520. "$listeners$": undefined,
  30521. "$lazyBundleId$": "-",
  30522. "$attrsToReflect$": [["closed", "closed"]]
  30523. }; }
  30524. }
  30525. const CSS$2 = {
  30526. container: "container",
  30527. arrow: "arrow"
  30528. };
  30529. const TOOLTIP_DELAY_MS = 500;
  30530. const ARIA_DESCRIBED_BY = "aria-describedby";
  30531. class TooltipManager$1 {
  30532. constructor() {
  30533. // --------------------------------------------------------------------------
  30534. //
  30535. // Private Properties
  30536. //
  30537. // --------------------------------------------------------------------------
  30538. this.registeredElements = new WeakMap();
  30539. this.hoverTimeouts = new WeakMap();
  30540. this.registeredElementCount = 0;
  30541. // --------------------------------------------------------------------------
  30542. //
  30543. // Private Methods
  30544. //
  30545. // --------------------------------------------------------------------------
  30546. this.queryTooltip = (composedPath) => {
  30547. const { registeredElements } = this;
  30548. const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
  30549. return registeredElements.get(registeredElement);
  30550. };
  30551. this.keyDownHandler = (event) => {
  30552. if (event.key === "Escape") {
  30553. const { activeTooltipEl } = this;
  30554. if (activeTooltipEl) {
  30555. this.clearHoverTimeout(activeTooltipEl);
  30556. this.toggleTooltip(activeTooltipEl, false);
  30557. }
  30558. }
  30559. };
  30560. this.mouseEnterShow = (event) => {
  30561. this.hoverEvent(event, true);
  30562. };
  30563. this.mouseLeaveHide = (event) => {
  30564. this.hoverEvent(event, false);
  30565. };
  30566. this.clickHandler = (event) => {
  30567. this.clickedTooltip = this.queryTooltip(event.composedPath());
  30568. };
  30569. this.focusShow = (event) => {
  30570. this.focusEvent(event, true);
  30571. };
  30572. this.blurHide = (event) => {
  30573. this.focusEvent(event, false);
  30574. };
  30575. this.hoverToggle = (tooltip, value) => {
  30576. const { hoverTimeouts } = this;
  30577. hoverTimeouts.delete(tooltip);
  30578. if (value) {
  30579. this.closeExistingTooltip();
  30580. }
  30581. this.toggleTooltip(tooltip, value);
  30582. };
  30583. }
  30584. // --------------------------------------------------------------------------
  30585. //
  30586. // Public Methods
  30587. //
  30588. // --------------------------------------------------------------------------
  30589. registerElement(referenceEl, tooltip) {
  30590. this.registeredElementCount++;
  30591. this.registeredElements.set(referenceEl, tooltip);
  30592. if (this.registeredElementCount === 1) {
  30593. this.addListeners();
  30594. }
  30595. }
  30596. unregisterElement(referenceEl) {
  30597. if (this.registeredElements.delete(referenceEl)) {
  30598. this.registeredElementCount--;
  30599. }
  30600. if (this.registeredElementCount === 0) {
  30601. this.removeListeners();
  30602. }
  30603. }
  30604. addListeners() {
  30605. document.addEventListener("keydown", this.keyDownHandler);
  30606. document.addEventListener("mouseover", this.mouseEnterShow, { capture: true });
  30607. document.addEventListener("mouseout", this.mouseLeaveHide, { capture: true });
  30608. document.addEventListener("pointerdown", this.clickHandler, { capture: true });
  30609. document.addEventListener("focusin", this.focusShow), { capture: true };
  30610. document.addEventListener("focusout", this.blurHide, { capture: true });
  30611. }
  30612. removeListeners() {
  30613. document.removeEventListener("keydown", this.keyDownHandler);
  30614. document.removeEventListener("mouseover", this.mouseEnterShow, { capture: true });
  30615. document.removeEventListener("mouseout", this.mouseLeaveHide, { capture: true });
  30616. document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
  30617. document.removeEventListener("focusin", this.focusShow, { capture: true });
  30618. document.removeEventListener("focusout", this.blurHide, { capture: true });
  30619. }
  30620. clearHoverTimeout(tooltip) {
  30621. const { hoverTimeouts } = this;
  30622. if (hoverTimeouts.has(tooltip)) {
  30623. window.clearTimeout(hoverTimeouts.get(tooltip));
  30624. hoverTimeouts.delete(tooltip);
  30625. }
  30626. }
  30627. closeExistingTooltip() {
  30628. const { activeTooltipEl } = this;
  30629. if (activeTooltipEl) {
  30630. this.toggleTooltip(activeTooltipEl, false);
  30631. }
  30632. }
  30633. focusTooltip(tooltip, value) {
  30634. this.closeExistingTooltip();
  30635. if (value) {
  30636. this.clearHoverTimeout(tooltip);
  30637. }
  30638. this.toggleTooltip(tooltip, value);
  30639. }
  30640. toggleTooltip(tooltip, value) {
  30641. tooltip.open = value;
  30642. if (value) {
  30643. this.activeTooltipEl = tooltip;
  30644. }
  30645. }
  30646. hoverTooltip(tooltip, value) {
  30647. this.clearHoverTimeout(tooltip);
  30648. const { hoverTimeouts } = this;
  30649. const timeoutId = window.setTimeout(() => this.hoverToggle(tooltip, value), TOOLTIP_DELAY_MS );
  30650. hoverTimeouts.set(tooltip, timeoutId);
  30651. }
  30652. activeTooltipHover(event) {
  30653. const { activeTooltipEl, hoverTimeouts } = this;
  30654. const { type } = event;
  30655. if (!activeTooltipEl) {
  30656. return;
  30657. }
  30658. if (type === "mouseover" && event.composedPath().includes(activeTooltipEl)) {
  30659. this.clearHoverTimeout(activeTooltipEl);
  30660. }
  30661. else if (type === "mouseout" && !hoverTimeouts.has(activeTooltipEl)) {
  30662. this.hoverTooltip(activeTooltipEl, false);
  30663. }
  30664. }
  30665. hoverEvent(event, value) {
  30666. const tooltip = this.queryTooltip(event.composedPath());
  30667. this.activeTooltipHover(event);
  30668. if (!tooltip) {
  30669. return;
  30670. }
  30671. this.hoverTooltip(tooltip, value);
  30672. }
  30673. focusEvent(event, value) {
  30674. const tooltip = this.queryTooltip(event.composedPath());
  30675. if (!tooltip || tooltip === this.clickedTooltip) {
  30676. this.clickedTooltip = null;
  30677. return;
  30678. }
  30679. this.focusTooltip(tooltip, value);
  30680. }
  30681. }
  30682. const tooltipCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tooltip:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tooltip{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tooltip{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tooltip{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tooltip{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tooltip{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tooltip:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tooltip-h{display:none}/*!@:host*/.sc-calcite-tooltip-h{display:block;position:absolute;z-index:999;-webkit-transform:scale(0);transform:scale(0)}/*!@.calcite-popper-anim*/.calcite-popper-anim.sc-calcite-tooltip{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}/*!@:host([data-popper-placement^=bottom]) .calcite-popper-anim*/[data-popper-placement^=bottom].sc-calcite-tooltip-h .calcite-popper-anim.sc-calcite-tooltip{-webkit-transform:translateY(-5px);transform:translateY(-5px)}/*!@:host([data-popper-placement^=top]) .calcite-popper-anim*/[data-popper-placement^=top].sc-calcite-tooltip-h .calcite-popper-anim.sc-calcite-tooltip{-webkit-transform:translateY(5px);transform:translateY(5px)}/*!@:host([data-popper-placement^=left]) .calcite-popper-anim*/[data-popper-placement^=left].sc-calcite-tooltip-h .calcite-popper-anim.sc-calcite-tooltip{-webkit-transform:translateX(5px);transform:translateX(5px)}/*!@:host([data-popper-placement^=right]) .calcite-popper-anim*/[data-popper-placement^=right].sc-calcite-tooltip-h .calcite-popper-anim.sc-calcite-tooltip{-webkit-transform:translateX(-5px);transform:translateX(-5px)}/*!@:host([data-popper-placement]) .calcite-popper-anim--active*/[data-popper-placement].sc-calcite-tooltip-h .calcite-popper-anim--active.sc-calcite-tooltip{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}/*!@:host([data-popper-placement][data-popper-reference-hidden])*/[data-popper-placement][data-popper-reference-hidden].sc-calcite-tooltip-h{pointer-events:none;opacity:0}/*!@.arrow,\n.arrow::before*/.arrow.sc-calcite-tooltip,.arrow.sc-calcite-tooltip::before{position:absolute;width:8px;height:8px;z-index:-1}/*!@.arrow::before*/.arrow.sc-calcite-tooltip::before{content:\"\";--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-transform:rotate(45deg);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}/*!@:host([data-popper-placement^=top]) .arrow*/[data-popper-placement^=top].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{bottom:-4px}/*!@:host([data-popper-placement^=bottom]) .arrow*/[data-popper-placement^=bottom].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{top:-4px}/*!@:host([data-popper-placement^=left]) .arrow*/[data-popper-placement^=left].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{right:-4px}/*!@:host([data-popper-placement^=right]) .arrow*/[data-popper-placement^=right].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{left:-4px}/*!@.container*/.container.sc-calcite-tooltip{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:start;justify-content:flex-start;overflow:hidden;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);padding-top:0.75rem;padding-bottom:0.75rem;padding-left:1rem;padding-right:1rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);max-width:20rem;max-height:20rem}/*!@.calcite-popper-anim*/.calcite-popper-anim.sc-calcite-tooltip{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}/*!@.arrow::before*/.arrow.sc-calcite-tooltip::before{outline:1px solid var(--calcite-ui-border-3)}";
  30683. const manager = new TooltipManager$1();
  30684. /**
  30685. * @slot - A slot for adding text.
  30686. */
  30687. class Tooltip {
  30688. constructor(hostRef) {
  30689. registerInstance(this, hostRef);
  30690. /**
  30691. * Offset the position of the tooltip away from the reference element.
  30692. * @default 6
  30693. */
  30694. this.offsetDistance = defaultOffsetDistance;
  30695. /**
  30696. * Offset the position of the tooltip along the reference element.
  30697. */
  30698. this.offsetSkidding = 0;
  30699. /**
  30700. * Display and position the component.
  30701. */
  30702. this.open = false;
  30703. /** Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value. */
  30704. this.overlayPositioning = "absolute";
  30705. /**
  30706. * Determines where the component will be positioned relative to the referenceElement.
  30707. * @see [PopperPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/popper.ts#L25)
  30708. */
  30709. this.placement = "auto";
  30710. this.guid = `calcite-tooltip-${guid()}`;
  30711. // --------------------------------------------------------------------------
  30712. //
  30713. // Private Methods
  30714. //
  30715. // --------------------------------------------------------------------------
  30716. this.setUpReferenceElement = () => {
  30717. this.removeReferences();
  30718. this.effectiveReferenceElement = this.getReferenceElement();
  30719. const { el, referenceElement, effectiveReferenceElement } = this;
  30720. if (referenceElement && !effectiveReferenceElement) {
  30721. console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
  30722. el
  30723. });
  30724. }
  30725. this.addReferences();
  30726. this.createPopper();
  30727. };
  30728. this.getId = () => {
  30729. return this.el.id || this.guid;
  30730. };
  30731. this.addReferences = () => {
  30732. const { effectiveReferenceElement } = this;
  30733. if (!effectiveReferenceElement) {
  30734. return;
  30735. }
  30736. const id = this.getId();
  30737. effectiveReferenceElement.setAttribute(ARIA_DESCRIBED_BY, id);
  30738. manager.registerElement(effectiveReferenceElement, this.el);
  30739. };
  30740. this.removeReferences = () => {
  30741. const { effectiveReferenceElement } = this;
  30742. if (!effectiveReferenceElement) {
  30743. return;
  30744. }
  30745. effectiveReferenceElement.removeAttribute(ARIA_DESCRIBED_BY);
  30746. manager.unregisterElement(effectiveReferenceElement);
  30747. };
  30748. }
  30749. offsetDistanceOffsetHandler() {
  30750. this.reposition();
  30751. }
  30752. offsetSkiddingHandler() {
  30753. this.reposition();
  30754. }
  30755. openHandler() {
  30756. this.reposition();
  30757. }
  30758. placementHandler() {
  30759. this.reposition();
  30760. }
  30761. referenceElementHandler() {
  30762. this.setUpReferenceElement();
  30763. }
  30764. // --------------------------------------------------------------------------
  30765. //
  30766. // Lifecycle
  30767. //
  30768. // --------------------------------------------------------------------------
  30769. componentWillLoad() {
  30770. this.setUpReferenceElement();
  30771. }
  30772. componentDidLoad() {
  30773. this.reposition();
  30774. }
  30775. disconnectedCallback() {
  30776. this.removeReferences();
  30777. this.destroyPopper();
  30778. }
  30779. // --------------------------------------------------------------------------
  30780. //
  30781. // Public Methods
  30782. //
  30783. // --------------------------------------------------------------------------
  30784. /** Updates the position of the component. */
  30785. async reposition() {
  30786. const { popper, el, placement } = this;
  30787. const modifiers = this.getModifiers();
  30788. popper
  30789. ? await updatePopper({
  30790. el,
  30791. modifiers,
  30792. placement,
  30793. popper
  30794. })
  30795. : this.createPopper();
  30796. }
  30797. getReferenceElement() {
  30798. const { referenceElement, el } = this;
  30799. return ((typeof referenceElement === "string"
  30800. ? queryElementRoots(el, { id: referenceElement })
  30801. : referenceElement) || null);
  30802. }
  30803. getModifiers() {
  30804. const { arrowEl, offsetDistance, offsetSkidding } = this;
  30805. const arrowModifier = {
  30806. name: "arrow",
  30807. enabled: true,
  30808. options: {
  30809. element: arrowEl
  30810. }
  30811. };
  30812. const offsetModifier = {
  30813. name: "offset",
  30814. enabled: true,
  30815. options: {
  30816. offset: [offsetSkidding, offsetDistance]
  30817. }
  30818. };
  30819. const eventListenerModifier = {
  30820. name: "eventListeners",
  30821. enabled: this.open
  30822. };
  30823. return [arrowModifier, offsetModifier, eventListenerModifier];
  30824. }
  30825. createPopper() {
  30826. this.destroyPopper();
  30827. const { el, placement, effectiveReferenceElement: referenceEl, overlayPositioning } = this;
  30828. const modifiers = this.getModifiers();
  30829. this.popper = createPopper({
  30830. el,
  30831. modifiers,
  30832. placement,
  30833. overlayPositioning,
  30834. referenceEl
  30835. });
  30836. }
  30837. destroyPopper() {
  30838. const { popper } = this;
  30839. if (popper) {
  30840. popper.destroy();
  30841. }
  30842. this.popper = null;
  30843. }
  30844. // --------------------------------------------------------------------------
  30845. //
  30846. // Render Methods
  30847. //
  30848. // --------------------------------------------------------------------------
  30849. render() {
  30850. const { effectiveReferenceElement, label, open } = this;
  30851. const displayed = effectiveReferenceElement && open;
  30852. const hidden = !displayed;
  30853. return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "calcite-hydrated-hidden": hidden, id: this.getId(), role: "tooltip" }, hAsync("div", { class: {
  30854. [CSS$D.animation]: true,
  30855. [CSS$D.animationActive]: displayed
  30856. } }, hAsync("div", { class: CSS$2.arrow, ref: (arrowEl) => (this.arrowEl = arrowEl) }), hAsync("div", { class: CSS$2.container }, hAsync("slot", null)))));
  30857. }
  30858. get el() { return getElement(this); }
  30859. static get watchers() { return {
  30860. "offsetDistance": ["offsetDistanceOffsetHandler"],
  30861. "offsetSkidding": ["offsetSkiddingHandler"],
  30862. "open": ["openHandler"],
  30863. "placement": ["placementHandler"],
  30864. "referenceElement": ["referenceElementHandler"]
  30865. }; }
  30866. static get style() { return tooltipCss; }
  30867. static get cmpMeta() { return {
  30868. "$flags$": 9,
  30869. "$tagName$": "calcite-tooltip",
  30870. "$members$": {
  30871. "label": [1],
  30872. "offsetDistance": [514, "offset-distance"],
  30873. "offsetSkidding": [514, "offset-skidding"],
  30874. "open": [516],
  30875. "overlayPositioning": [1, "overlay-positioning"],
  30876. "placement": [513],
  30877. "referenceElement": [1, "reference-element"],
  30878. "effectiveReferenceElement": [32],
  30879. "reposition": [64]
  30880. },
  30881. "$listeners$": undefined,
  30882. "$lazyBundleId$": "-",
  30883. "$attrsToReflect$": [["offsetDistance", "offset-distance"], ["offsetSkidding", "offset-skidding"], ["open", "open"], ["placement", "placement"]]
  30884. }; }
  30885. }
  30886. const tooltipManagerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tooltip-manager:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tooltip-manager{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tooltip-manager{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tooltip-manager{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tooltip-manager{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tooltip-manager{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tooltip-manager:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tooltip-manager-h{display:none}/*!@:host*/.sc-calcite-tooltip-manager-h{position:relative;display:block}";
  30887. /**
  30888. * @slot - A slot for adding elements that reference a 'calcite-tooltip' by the 'selector' property.
  30889. * @deprecated No longer required for tooltip usage.
  30890. */
  30891. class TooltipManager {
  30892. constructor(hostRef) {
  30893. registerInstance(this, hostRef);
  30894. // --------------------------------------------------------------------------
  30895. //
  30896. // Properties
  30897. //
  30898. // --------------------------------------------------------------------------
  30899. /**
  30900. * CSS Selector to match reference elements for tooltips. Reference elements will be identified by this selector in order to open their associated tooltip.
  30901. * @default `[data-calcite-tooltip-reference]`
  30902. */
  30903. this.selector = "[data-calcite-tooltip-reference]";
  30904. }
  30905. // --------------------------------------------------------------------------
  30906. //
  30907. // Render Methods
  30908. //
  30909. // --------------------------------------------------------------------------
  30910. render() {
  30911. return hAsync("slot", null);
  30912. }
  30913. static get style() { return tooltipManagerCss; }
  30914. static get cmpMeta() { return {
  30915. "$flags$": 9,
  30916. "$tagName$": "calcite-tooltip-manager",
  30917. "$members$": {
  30918. "selector": [1]
  30919. },
  30920. "$listeners$": undefined,
  30921. "$lazyBundleId$": "-",
  30922. "$attrsToReflect$": []
  30923. }; }
  30924. }
  30925. var TreeSelectionMode;
  30926. (function (TreeSelectionMode) {
  30927. TreeSelectionMode["Single"] = "single";
  30928. TreeSelectionMode["Multi"] = "multi";
  30929. TreeSelectionMode["Children"] = "children";
  30930. TreeSelectionMode["MultiChildren"] = "multi-children";
  30931. TreeSelectionMode["Ancestors"] = "ancestors";
  30932. })(TreeSelectionMode || (TreeSelectionMode = {}));
  30933. const treeCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tree:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tree{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tree{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tree{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tree{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tree{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tree:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tree-h{display:none}/*!@:host*/.sc-calcite-tree-h{display:block;outline:2px solid transparent;outline-offset:2px}";
  30934. /**
  30935. * @slot - A slot for calcite-tree-item elements.
  30936. */
  30937. class Tree {
  30938. constructor(hostRef) {
  30939. registerInstance(this, hostRef);
  30940. this.calciteTreeSelect = createEvent(this, "calciteTreeSelect", 7);
  30941. //--------------------------------------------------------------------------
  30942. //
  30943. // Properties
  30944. //
  30945. //--------------------------------------------------------------------------
  30946. /** Display indentation guide lines. */
  30947. this.lines = false;
  30948. /** Display input
  30949. * @deprecated Use "ancestors" selection-mode for checkbox input.
  30950. */
  30951. this.inputEnabled = false;
  30952. /** Specify the scale of the tree. */
  30953. this.scale = "m";
  30954. /** Customize how tree selection works.
  30955. * @default "single"
  30956. * @see [TreeSelectionMode](https://github.com/Esri/calcite-components/blob/master/src/components/tree/interfaces.ts#L5)
  30957. */
  30958. this.selectionMode = TreeSelectionMode.Single;
  30959. }
  30960. //--------------------------------------------------------------------------
  30961. //
  30962. // Lifecycle
  30963. //
  30964. //--------------------------------------------------------------------------
  30965. componentWillRender() {
  30966. const parent = this.el.parentElement.closest("calcite-tree");
  30967. this.lines = parent ? parent.lines : this.lines;
  30968. this.scale = parent ? parent.scale : this.scale;
  30969. this.selectionMode = parent ? parent.selectionMode : this.selectionMode;
  30970. this.child = !!parent;
  30971. }
  30972. render() {
  30973. return (hAsync(Host, { "aria-multiselectable": this.child
  30974. ? undefined
  30975. : (this.selectionMode === TreeSelectionMode.Multi ||
  30976. this.selectionMode === TreeSelectionMode.MultiChildren).toString(), role: !this.child ? "tree" : undefined, tabIndex: this.getRootTabIndex() }, hAsync("slot", null)));
  30977. }
  30978. //--------------------------------------------------------------------------
  30979. //
  30980. // Event Listeners
  30981. //
  30982. //--------------------------------------------------------------------------
  30983. onFocus() {
  30984. if (!this.child) {
  30985. const focusTarget = this.el.querySelector("calcite-tree-item[selected]") ||
  30986. this.el.querySelector("calcite-tree-item");
  30987. focusElement(focusTarget);
  30988. }
  30989. }
  30990. onFocusIn(event) {
  30991. const focusedFromRootOrOutsideTree = event.relatedTarget === this.el || !this.el.contains(event.relatedTarget);
  30992. if (focusedFromRootOrOutsideTree) {
  30993. // gives user the ability to tab into external elements (modifying tabindex property will not work in firefox)
  30994. this.el.removeAttribute("tabindex");
  30995. }
  30996. }
  30997. onFocusOut(event) {
  30998. const willFocusOutsideTree = !this.el.contains(event.relatedTarget);
  30999. if (willFocusOutsideTree) {
  31000. this.el.tabIndex = this.getRootTabIndex();
  31001. }
  31002. }
  31003. onClick(e) {
  31004. const target = e.target;
  31005. const childItems = nodeListToArray(target.querySelectorAll("calcite-tree-item"));
  31006. if (this.child) {
  31007. return;
  31008. }
  31009. if (!this.child) {
  31010. e.preventDefault();
  31011. e.stopPropagation();
  31012. }
  31013. if (this.selectionMode === TreeSelectionMode.Ancestors && !this.child) {
  31014. this.updateAncestorTree(e);
  31015. return;
  31016. }
  31017. const shouldSelect = this.selectionMode !== null &&
  31018. (!target.hasChildren ||
  31019. (target.hasChildren &&
  31020. (this.selectionMode === TreeSelectionMode.Children ||
  31021. this.selectionMode === TreeSelectionMode.MultiChildren)));
  31022. const shouldModifyToCurrentSelection = e.detail.modifyCurrentSelection &&
  31023. (this.selectionMode === TreeSelectionMode.Multi ||
  31024. this.selectionMode === TreeSelectionMode.MultiChildren);
  31025. const shouldSelectChildren = this.selectionMode === TreeSelectionMode.MultiChildren ||
  31026. this.selectionMode === TreeSelectionMode.Children;
  31027. const shouldClearCurrentSelection = !shouldModifyToCurrentSelection &&
  31028. (((this.selectionMode === TreeSelectionMode.Single ||
  31029. this.selectionMode === TreeSelectionMode.Multi) &&
  31030. childItems.length <= 0) ||
  31031. this.selectionMode === TreeSelectionMode.Children ||
  31032. this.selectionMode === TreeSelectionMode.MultiChildren);
  31033. const shouldExpandTarget = this.selectionMode === TreeSelectionMode.Children ||
  31034. this.selectionMode === TreeSelectionMode.MultiChildren;
  31035. if (!this.child) {
  31036. const targetItems = [];
  31037. if (shouldSelect) {
  31038. targetItems.push(target);
  31039. }
  31040. if (shouldSelectChildren) {
  31041. childItems.forEach((treeItem) => {
  31042. targetItems.push(treeItem);
  31043. });
  31044. }
  31045. if (shouldClearCurrentSelection) {
  31046. const selectedItems = nodeListToArray(this.el.querySelectorAll("calcite-tree-item[selected]"));
  31047. selectedItems.forEach((treeItem) => {
  31048. if (!targetItems.includes(treeItem)) {
  31049. treeItem.selected = false;
  31050. }
  31051. });
  31052. }
  31053. if (shouldExpandTarget && !e.detail.forceToggle) {
  31054. target.expanded = true;
  31055. }
  31056. if (shouldModifyToCurrentSelection) {
  31057. window.getSelection().removeAllRanges();
  31058. }
  31059. if ((shouldModifyToCurrentSelection && target.selected) ||
  31060. (shouldSelectChildren && e.detail.forceToggle)) {
  31061. targetItems.forEach((treeItem) => {
  31062. treeItem.selected = false;
  31063. });
  31064. }
  31065. else {
  31066. targetItems.forEach((treeItem) => {
  31067. treeItem.selected = true;
  31068. });
  31069. }
  31070. }
  31071. this.calciteTreeSelect.emit({
  31072. selected: nodeListToArray(this.el.querySelectorAll("calcite-tree-item")).filter((i) => i.selected)
  31073. });
  31074. }
  31075. keyDownHandler(event) {
  31076. var _a;
  31077. const root = this.el.closest("calcite-tree:not([child])");
  31078. const target = event.target;
  31079. if (root === this.el && target.tagName === "CALCITE-TREE-ITEM" && this.el.contains(target)) {
  31080. switch (event.key) {
  31081. case "ArrowDown":
  31082. const next = target.nextElementSibling;
  31083. if (next && next.matches("calcite-tree-item")) {
  31084. next.focus();
  31085. event.preventDefault();
  31086. }
  31087. break;
  31088. case "ArrowLeft":
  31089. // When focus is on an open node, closes the node.
  31090. if (target.hasChildren && target.expanded) {
  31091. target.expanded = false;
  31092. event.preventDefault();
  31093. break;
  31094. }
  31095. // When focus is on a child node that is also either an end node or a closed node, moves focus to its parent node.
  31096. const parentItem = target.parentElement.closest("calcite-tree-item");
  31097. if (parentItem && (!target.hasChildren || target.expanded === false)) {
  31098. parentItem.focus();
  31099. event.preventDefault();
  31100. break;
  31101. }
  31102. // When focus is on a root node that is also either an end node or a closed node, does nothing.
  31103. break;
  31104. case "ArrowRight":
  31105. if (!target.hasChildren) {
  31106. break;
  31107. }
  31108. if (target.expanded && document.activeElement === target) {
  31109. // When focus is on an open node, moves focus to the first child node.
  31110. (_a = target.querySelector("calcite-tree-item")) === null || _a === void 0 ? void 0 : _a.focus();
  31111. event.preventDefault();
  31112. }
  31113. else {
  31114. // When focus is on a closed node, opens the node; focus does not move.
  31115. target.expanded = true;
  31116. event.preventDefault();
  31117. }
  31118. // When focus is on an end node, does nothing.
  31119. break;
  31120. case "ArrowUp":
  31121. const previous = target.previousElementSibling;
  31122. if (previous && previous.matches("calcite-tree-item")) {
  31123. previous.focus();
  31124. event.preventDefault();
  31125. }
  31126. break;
  31127. }
  31128. }
  31129. }
  31130. updateAncestorTree(e) {
  31131. const item = e.target;
  31132. const children = item.querySelectorAll("calcite-tree-item");
  31133. const ancestors = [];
  31134. let parent = item.parentElement.closest("calcite-tree-item");
  31135. while (parent) {
  31136. ancestors.push(parent);
  31137. parent = parent.parentElement.closest("calcite-tree-item");
  31138. }
  31139. item.selected = !item.selected;
  31140. item.indeterminate = false;
  31141. if (children === null || children === void 0 ? void 0 : children.length) {
  31142. children.forEach((el) => {
  31143. el.selected = item.selected;
  31144. el.indeterminate = false;
  31145. });
  31146. }
  31147. if (ancestors) {
  31148. ancestors.forEach((ancestor) => {
  31149. const descendants = nodeListToArray(ancestor.querySelectorAll("calcite-tree-item"));
  31150. const activeDescendants = descendants.filter((el) => el.selected);
  31151. if (activeDescendants.length === 0) {
  31152. ancestor.selected = false;
  31153. ancestor.indeterminate = false;
  31154. return;
  31155. }
  31156. const indeterminate = activeDescendants.length < descendants.length;
  31157. ancestor.indeterminate = indeterminate;
  31158. ancestor.selected = !indeterminate;
  31159. });
  31160. }
  31161. this.calciteTreeSelect.emit({
  31162. selected: nodeListToArray(this.el.querySelectorAll("calcite-tree-item")).filter((i) => i.selected)
  31163. });
  31164. }
  31165. // --------------------------------------------------------------------------
  31166. //
  31167. // Private Methods
  31168. //
  31169. //--------------------------------------------------------------------------
  31170. getRootTabIndex() {
  31171. return !this.child ? 0 : -1;
  31172. }
  31173. get el() { return getElement(this); }
  31174. static get style() { return treeCss; }
  31175. static get cmpMeta() { return {
  31176. "$flags$": 9,
  31177. "$tagName$": "calcite-tree",
  31178. "$members$": {
  31179. "lines": [1540],
  31180. "inputEnabled": [4, "input-enabled"],
  31181. "child": [1540],
  31182. "scale": [1537],
  31183. "selectionMode": [1537, "selection-mode"]
  31184. },
  31185. "$listeners$": [[0, "focus", "onFocus"], [0, "focusin", "onFocusIn"], [0, "focusout", "onFocusOut"], [0, "calciteTreeItemSelect", "onClick"], [0, "keydown", "keyDownHandler"]],
  31186. "$lazyBundleId$": "-",
  31187. "$attrsToReflect$": [["lines", "lines"], ["child", "child"], ["scale", "scale"], ["selectionMode", "selection-mode"]]
  31188. }; }
  31189. }
  31190. const CSS$1 = {
  31191. checkboxLabel: "checkbox-label",
  31192. checkbox: "checkbox",
  31193. chevron: "chevron",
  31194. nodeContainer: "node-container",
  31195. childrenContainer: "children-container",
  31196. bulletPointIcon: "bullet-point",
  31197. checkmarkIcon: "checkmark"
  31198. };
  31199. const SLOTS$1 = {
  31200. children: "children"
  31201. };
  31202. const ICONS$1 = {
  31203. bulletPoint: "bullet-point",
  31204. checkmark: "check",
  31205. chevronRight: "chevron-right"
  31206. };
  31207. const treeItemCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tree-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tree-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tree-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tree-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tree-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tree-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-tree-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tree-item-h{display:none}/*!@:host*/.sc-calcite-tree-item-h{display:block;max-width:100%;cursor:pointer;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px}/*!@:host([scale=s])*/[scale=s].sc-calcite-tree-item-h{font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) .node-container*/[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item{--calcite-tree-padding-y:0.25rem}/*!@:host([scale=s]) .node-container .checkbox,\n:host([scale=s]) .node-container .chevron,\n:host([scale=s]) .node-container .checkmark,\n:host([scale=s]) .node-container .bullet-point*/[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkbox.sc-calcite-tree-item,[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .chevron.sc-calcite-tree-item,[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{margin-inline:0.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-tree-item-h{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) .node-container*/[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item{--calcite-tree-padding-y:0.5rem}/*!@:host([scale=m]) .node-container .checkbox,\n:host([scale=m]) .node-container .chevron,\n:host([scale=m]) .node-container .checkmark,\n:host([scale=m]) .node-container .bullet-point*/[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkbox.sc-calcite-tree-item,[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .chevron.sc-calcite-tree-item,[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{margin-inline:0.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tree-item-h{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) .node-container*/[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item{--calcite-tree-padding-y:0.75rem}/*!@:host([scale=l]) .node-container .checkbox,\n:host([scale=l]) .node-container .chevron,\n:host([scale=l]) .node-container .checkmark,\n:host([scale=l]) .node-container .bullet-point*/[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkbox.sc-calcite-tree-item,[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .chevron.sc-calcite-tree-item,[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{margin-inline:0.75rem}/*!@:host([lines]) .children-container:after*/[lines].sc-calcite-tree-item-h .children-container.sc-calcite-tree-item:after{position:absolute;top:0px;width:1px;transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;-webkit-transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;height:96%;content:\"\";background-color:var(--calcite-ui-border-2);z-index:-1}/*!@:host(:not([lines])) .node-container:after*/.sc-calcite-tree-item-h:not([lines]) .node-container.sc-calcite-tree-item:after{display:none}/*!@::slotted(*)*/.sc-calcite-tree-item-s>*{min-width:0px;max-width:100%;overflow-wrap:break-word;color:inherit;text-decoration:none !important}/*!@::slotted(*):hover*/.sc-calcite-tree-item-s>*:hover{text-decoration:none !important}/*!@::slotted(a)*/.sc-calcite-tree-item-s>a{width:100%;-webkit-text-decoration-line:none;text-decoration-line:none}/*!@:host*/.sc-calcite-tree-item-h{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@:host(:focus)*/.sc-calcite-tree-item-h:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.checkbox*/.checkbox.sc-calcite-tree-item{outline:2px solid transparent;outline-offset:2px;line-height:0}/*!@.checkbox-label*/.checkbox-label.sc-calcite-tree-item{pointer-events:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}/*!@.children-container*/.children-container.sc-calcite-tree-item{position:relative;height:0px;overflow:hidden;-webkit-margin-start:1.25rem;margin-inline-start:1.25rem;-webkit-transform:scaleY(0);transform:scaleY(0);opacity:0;-webkit-transition:var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out;transition:var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out;-webkit-transform-origin:top;transform-origin:top}/*!@:host([expanded]) > .children-container*/[expanded].sc-calcite-tree-item-h>.children-container.sc-calcite-tree-item{-webkit-transform:scaleY(1);transform:scaleY(1);opacity:1;height:auto}/*!@.node-container*/.node-container.sc-calcite-tree-item{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:var(--calcite-tree-padding-y) 0}/*!@.node-container .checkmark, .node-container .bullet-point*/.node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,.node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{opacity:0;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;color:var(--calcite-ui-border-1)}/*!@.node-container:hover .checkmark, .node-container:hover .bullet-point, :host([selected]) .node-container:hover .checkmark, :host([selected]) .node-container:hover .bullet-point, :host(:focus) .node-container .checkmark, :host(:focus) .node-container .bullet-point*/.node-container.sc-calcite-tree-item:hover .checkmark.sc-calcite-tree-item,.node-container.sc-calcite-tree-item:hover .bullet-point.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item:hover .checkmark.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item:hover .bullet-point.sc-calcite-tree-item,.sc-calcite-tree-item-h:focus .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,.sc-calcite-tree-item-h:focus .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{opacity:1}/*!@:host([selected]) > .node-container, :host([selected]) > .node-container:hover*/[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item:hover{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@:host([selected]) > .node-container .bullet-point, :host([selected]) > .node-container .checkmark, :host([selected]) > .node-container:hover .bullet-point, :host([selected]) > .node-container:hover .checkmark*/[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item:hover .bullet-point.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item:hover .checkmark.sc-calcite-tree-item{opacity:1;color:var(--calcite-ui-brand)}/*!@:host(:not([has-children])):host([scale=s]) > .node-container[data-selection-mode=ancestors] .checkbox*/.sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=s])>.node-container[data-selection-mode=ancestors].sc-calcite-tree-item .checkbox.sc-calcite-tree-item{-webkit-padding-start:1.25rem;padding-inline-start:1.25rem}/*!@:host(:not([has-children])):host([scale=m]) > .node-container[data-selection-mode=ancestors] .checkbox*/.sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=m])>.node-container[data-selection-mode=ancestors].sc-calcite-tree-item .checkbox.sc-calcite-tree-item{-webkit-padding-start:1.5rem;padding-inline-start:1.5rem}/*!@:host(:not([has-children])):host([scale=l]) > .node-container[data-selection-mode=ancestors] .checkbox*/.sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=l])>.node-container[data-selection-mode=ancestors].sc-calcite-tree-item .checkbox.sc-calcite-tree-item{-webkit-padding-start:1.75rem;padding-inline-start:1.75rem}/*!@:host([has-children]) > .node-container[data-selection-mode=ancestors] .checkbox*/[has-children].sc-calcite-tree-item-h>.node-container[data-selection-mode=ancestors].sc-calcite-tree-item .checkbox.sc-calcite-tree-item{-webkit-margin-start:0;margin-inline-start:0}/*!@:host([has-children]) > .node-container .bullet-point, :host([has-children]) > .node-container .checkmark*/[has-children].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item,[has-children].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item{display:none}/*!@:host([has-children][expanded]:not([selected])) > .node-container ::slotted(*)*/.sc-calcite-tree-item-h[has-children][expanded]:not([selected])>.node-container .sc-calcite-tree-item-s>*{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@:host([has-children][selected]) > .node-container[data-selection-mode=children], :host([has-children][selected]) > .node-container[data-selection-mode=multi-children]*/[has-children][selected].sc-calcite-tree-item-h>.node-container[data-selection-mode=children].sc-calcite-tree-item,[has-children][selected].sc-calcite-tree-item-h>.node-container[data-selection-mode=multi-children].sc-calcite-tree-item{color:var(--calcite-ui-brand)}/*!@.chevron*/.chevron.sc-calcite-tree-item{position:relative;-ms-flex-item-align:center;align-self:center;color:var(--calcite-ui-text-3);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;-ms-flex:0 0 auto;flex:0 0 auto;-webkit-transform:rotate(0deg);transform:rotate(0deg)}/*!@.calcite--rtl .chevron*/.calcite--rtl.sc-calcite-tree-item .chevron.sc-calcite-tree-item{-webkit-transform:rotate(180deg);transform:rotate(180deg)}/*!@:host([expanded]) > .node-container > .chevron*/[expanded].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item>.chevron.sc-calcite-tree-item{-webkit-transform:rotate(90deg);transform:rotate(90deg)}/*!@:host([selected]) .checkmark,\n:host([selected]) .bullet-point*/[selected].sc-calcite-tree-item-h .checkmark.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h .bullet-point.sc-calcite-tree-item{color:var(--calcite-ui-brand)}";
  31208. /**
  31209. * @slot - A slot for adding content to the item.
  31210. * @slot children - A slot for adding nested calcite-tree elements.
  31211. */
  31212. class TreeItem {
  31213. constructor(hostRef) {
  31214. registerInstance(this, hostRef);
  31215. this.calciteTreeItemSelect = createEvent(this, "calciteTreeItemSelect", 7);
  31216. //--------------------------------------------------------------------------
  31217. //
  31218. // Properties
  31219. //
  31220. //--------------------------------------------------------------------------
  31221. /** Selected state of the item. */
  31222. this.selected = false;
  31223. /** Expanded state of the item. */
  31224. this.expanded = false;
  31225. /** @internal Expanded state of the parent. */
  31226. this.parentExpanded = false;
  31227. /** @internal Level of depth of the item. */
  31228. this.depth = -1;
  31229. /** @internal Does this tree item have a tree inside it? */
  31230. this.hasChildren = null;
  31231. this.iconClickHandler = (event) => {
  31232. event.stopPropagation();
  31233. this.expanded = !this.expanded;
  31234. };
  31235. this.childrenClickHandler = (event) => event.stopPropagation();
  31236. //--------------------------------------------------------------------------
  31237. //
  31238. // Private Methods
  31239. //
  31240. //--------------------------------------------------------------------------
  31241. this.updateParentIsExpanded = (el, expanded) => {
  31242. const items = getSlotted(el, SLOTS$1.children, {
  31243. all: true,
  31244. selector: "calcite-tree-item"
  31245. });
  31246. items.forEach((item) => (item.parentExpanded = expanded));
  31247. };
  31248. this.updateAncestorTree = () => {
  31249. if (this.selected && this.selectionMode === TreeSelectionMode.Ancestors) {
  31250. const ancestors = [];
  31251. let parent = this.parentTreeItem;
  31252. while (parent) {
  31253. ancestors.push(parent);
  31254. parent = parent.parentElement.closest("calcite-tree-item");
  31255. }
  31256. ancestors.forEach((item) => (item.indeterminate = true));
  31257. return;
  31258. }
  31259. };
  31260. }
  31261. expandedHandler(newValue) {
  31262. this.updateParentIsExpanded(this.el, newValue);
  31263. }
  31264. getselectionMode() {
  31265. this.isSelectionMultiLike =
  31266. this.selectionMode === TreeSelectionMode.Multi ||
  31267. this.selectionMode === TreeSelectionMode.MultiChildren;
  31268. }
  31269. //--------------------------------------------------------------------------
  31270. //
  31271. // Lifecycle
  31272. //
  31273. //--------------------------------------------------------------------------
  31274. connectedCallback() {
  31275. this.parentTreeItem = this.el.parentElement.closest("calcite-tree-item");
  31276. if (this.parentTreeItem) {
  31277. const { expanded } = this.parentTreeItem;
  31278. this.updateParentIsExpanded(this.parentTreeItem, expanded);
  31279. }
  31280. connectConditionalSlotComponent(this);
  31281. }
  31282. disconnectedCallback() {
  31283. disconnectConditionalSlotComponent(this);
  31284. }
  31285. componentWillRender() {
  31286. this.hasChildren = !!this.el.querySelector("calcite-tree");
  31287. this.depth = 0;
  31288. let parentTree = this.el.closest("calcite-tree");
  31289. if (!parentTree) {
  31290. return;
  31291. }
  31292. this.selectionMode = parentTree.selectionMode;
  31293. this.scale = parentTree.scale || "m";
  31294. this.lines = parentTree.lines;
  31295. let nextParentTree;
  31296. while (parentTree) {
  31297. nextParentTree = parentTree.parentElement.closest("calcite-tree");
  31298. if (nextParentTree === parentTree) {
  31299. break;
  31300. }
  31301. else {
  31302. parentTree = nextParentTree;
  31303. this.depth = this.depth + 1;
  31304. }
  31305. }
  31306. }
  31307. componentDidLoad() {
  31308. this.updateAncestorTree();
  31309. }
  31310. render() {
  31311. const rtl = getElementDir(this.el) === "rtl";
  31312. const showBulletPoint = this.selectionMode === TreeSelectionMode.Single ||
  31313. this.selectionMode === TreeSelectionMode.Children;
  31314. const showCheckmark = this.selectionMode === TreeSelectionMode.Multi ||
  31315. this.selectionMode === TreeSelectionMode.MultiChildren;
  31316. const chevron = this.hasChildren ? (hAsync("calcite-icon", { class: {
  31317. [CSS$1.chevron]: true,
  31318. [CSS_UTILITY.rtl]: rtl
  31319. }, "data-test-id": "icon", icon: ICONS$1.chevronRight, onClick: this.iconClickHandler, scale: "s" })) : null;
  31320. const defaultSlotNode = hAsync("slot", { key: "default-slot" });
  31321. const checkbox = this.selectionMode === TreeSelectionMode.Ancestors ? (hAsync("label", { class: CSS$1.checkboxLabel, key: "checkbox-label" }, hAsync("calcite-checkbox", { checked: this.selected, class: CSS$1.checkbox, "data-test-id": "checkbox", indeterminate: this.hasChildren && this.indeterminate, scale: this.scale, tabIndex: -1 }), defaultSlotNode)) : null;
  31322. const selectedIcon = showBulletPoint
  31323. ? ICONS$1.bulletPoint
  31324. : showCheckmark
  31325. ? ICONS$1.checkmark
  31326. : null;
  31327. const bulletOrCheckIcon = selectedIcon ? (hAsync("calcite-icon", { class: {
  31328. [CSS$1.bulletPointIcon]: selectedIcon === ICONS$1.bulletPoint,
  31329. [CSS$1.checkmarkIcon]: selectedIcon === ICONS$1.checkmark,
  31330. [CSS_UTILITY.rtl]: rtl
  31331. }, icon: selectedIcon, scale: "s" })) : null;
  31332. const hidden = !(this.parentExpanded || this.depth === 1);
  31333. return (hAsync(Host, { "aria-expanded": this.hasChildren ? toAriaBoolean(this.expanded) : undefined, "aria-hidden": toAriaBoolean(hidden), "aria-selected": this.selected ? "true" : showCheckmark ? "false" : undefined, "calcite-hydrated-hidden": hidden, role: "treeitem", tabindex: this.parentExpanded || this.depth === 1 ? "0" : "-1" }, hAsync("div", { class: {
  31334. [CSS$1.nodeContainer]: true,
  31335. [CSS_UTILITY.rtl]: rtl
  31336. }, "data-selection-mode": this.selectionMode, ref: (el) => (this.defaultSlotWrapper = el) }, chevron, bulletOrCheckIcon, checkbox ? checkbox : defaultSlotNode), hAsync("div", { class: {
  31337. [CSS$1.childrenContainer]: true,
  31338. [CSS_UTILITY.rtl]: rtl
  31339. }, "data-test-id": "calcite-tree-children", onClick: this.childrenClickHandler, ref: (el) => (this.childrenSlotWrapper = el), role: this.hasChildren ? "group" : undefined }, hAsync("slot", { name: SLOTS$1.children }))));
  31340. }
  31341. //--------------------------------------------------------------------------
  31342. //
  31343. // Event Listeners
  31344. //
  31345. //--------------------------------------------------------------------------
  31346. onClick(e) {
  31347. // Solve for if the item is clicked somewhere outside the slotted anchor.
  31348. // Anchor is triggered anywhere you click
  31349. const [link] = filterDirectChildren(this.el, "a");
  31350. if (link && e.composedPath()[0].tagName.toLowerCase() !== "a") {
  31351. const target = link.target === "" ? "_self" : link.target;
  31352. window.open(link.href, target);
  31353. }
  31354. this.calciteTreeItemSelect.emit({
  31355. modifyCurrentSelection: this.selectionMode === TreeSelectionMode.Ancestors || this.isSelectionMultiLike,
  31356. forceToggle: false
  31357. });
  31358. }
  31359. keyDownHandler(e) {
  31360. let root;
  31361. switch (e.key) {
  31362. case " ":
  31363. this.calciteTreeItemSelect.emit({
  31364. modifyCurrentSelection: this.isSelectionMultiLike,
  31365. forceToggle: false
  31366. });
  31367. e.preventDefault();
  31368. break;
  31369. case "Enter":
  31370. // activates a node, i.e., performs its default action. For parent nodes, one possible default action is to open or close the node. In single-select trees where selection does not follow focus (see note below), the default action is typically to select the focused node.
  31371. const link = nodeListToArray(this.el.children).find((e) => e.matches("a"));
  31372. if (link) {
  31373. link.click();
  31374. this.selected = true;
  31375. }
  31376. else {
  31377. this.calciteTreeItemSelect.emit({
  31378. modifyCurrentSelection: this.isSelectionMultiLike,
  31379. forceToggle: false
  31380. });
  31381. }
  31382. e.preventDefault();
  31383. break;
  31384. case "Home":
  31385. root = this.el.closest("calcite-tree:not([child])");
  31386. const firstNode = root.querySelector("calcite-tree-item");
  31387. firstNode.focus();
  31388. break;
  31389. case "End":
  31390. root = this.el.closest("calcite-tree:not([child])");
  31391. let currentNode = root.children[root.children.length - 1]; // last child
  31392. let currentTree = nodeListToArray(currentNode.children).find((e) => e.matches("calcite-tree"));
  31393. while (currentTree) {
  31394. currentNode = currentTree.children[root.children.length - 1];
  31395. currentTree = nodeListToArray(currentNode.children).find((e) => e.matches("calcite-tree"));
  31396. }
  31397. currentNode.focus();
  31398. break;
  31399. }
  31400. }
  31401. get el() { return getElement(this); }
  31402. static get watchers() { return {
  31403. "expanded": ["expandedHandler"],
  31404. "selectionMode": ["getselectionMode"]
  31405. }; }
  31406. static get style() { return treeItemCss; }
  31407. static get cmpMeta() { return {
  31408. "$flags$": 9,
  31409. "$tagName$": "calcite-tree-item",
  31410. "$members$": {
  31411. "selected": [1540],
  31412. "expanded": [1540],
  31413. "parentExpanded": [4, "parent-expanded"],
  31414. "depth": [1538],
  31415. "hasChildren": [1540, "has-children"],
  31416. "lines": [1540],
  31417. "inputEnabled": [4, "input-enabled"],
  31418. "scale": [1537],
  31419. "indeterminate": [516],
  31420. "selectionMode": [1025, "selection-mode"]
  31421. },
  31422. "$listeners$": [[0, "click", "onClick"], [0, "keydown", "keyDownHandler"]],
  31423. "$lazyBundleId$": "-",
  31424. "$attrsToReflect$": [["selected", "selected"], ["expanded", "expanded"], ["depth", "depth"], ["hasChildren", "has-children"], ["lines", "lines"], ["scale", "scale"], ["indeterminate", "indeterminate"]]
  31425. }; }
  31426. }
  31427. const CSS = {
  31428. container: "container",
  31429. handle: "handle"
  31430. };
  31431. var ICON_TYPES;
  31432. (function (ICON_TYPES) {
  31433. ICON_TYPES["grip"] = "grip";
  31434. })(ICON_TYPES || (ICON_TYPES = {}));
  31435. const valueListCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-value-list:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-value-list{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-value-list{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-value-list{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-value-list{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-value-list{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-value-list:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-value-list-h{display:none}/*!@:host*/.sc-calcite-value-list-h{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;background-color:transparent;font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}/*!@:host **/.sc-calcite-value-list-h *.sc-calcite-value-list{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@:host([disabled])*/[disabled].sc-calcite-value-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-value-list-h[disabled] .sc-calcite-value-list-s>[calcite-hydrated][disabled],[disabled].sc-calcite-value-list-h [calcite-hydrated][disabled].sc-calcite-value-list{opacity:1}/*!@calcite-value-list-item:last-of-type*/calcite-value-list-item.sc-calcite-value-list:last-of-type{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([filter-enabled]) header*/[filter-enabled].sc-calcite-value-list-h header.sc-calcite-value-list{margin-bottom:0.25rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end;background-color:var(--calcite-ui-foreground-1);--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([filter-enabled]) header.sticky-pos*/[filter-enabled].sc-calcite-value-list-h header.sticky-pos.sc-calcite-value-list{position:-webkit-sticky;position:sticky;top:0px;z-index:10}/*!@calcite-filter*/calcite-filter.sc-calcite-value-list{margin-bottom:1px}";
  31436. /**
  31437. * @slot - A slot for adding calcite-value-list-item elements. List items are displayed as a vertical list.
  31438. * @slot menu-actions - A slot for adding a button and menu combination for performing actions, such as sorting.
  31439. */
  31440. class ValueList {
  31441. constructor(hostRef) {
  31442. registerInstance(this, hostRef);
  31443. this.calciteListChange = createEvent(this, "calciteListChange", 7);
  31444. this.calciteListOrderChange = createEvent(this, "calciteListOrderChange", 7);
  31445. // --------------------------------------------------------------------------
  31446. //
  31447. // Properties
  31448. //
  31449. // --------------------------------------------------------------------------
  31450. /**
  31451. * When true, prevents user interaction. This state shows list items grayed out and with lower opacity.
  31452. */
  31453. this.disabled = false;
  31454. /**
  31455. * When true, list items are sortable via a draggable button.
  31456. */
  31457. this.dragEnabled = false;
  31458. /**
  31459. * When true, an input appears at the top of the list that can be used by end users to filter list items.
  31460. */
  31461. this.filterEnabled = false;
  31462. /**
  31463. * When true, content is waiting to be loaded. This state shows a busy indicator.
  31464. */
  31465. this.loading = false;
  31466. /**
  31467. * Similar to standard radio buttons and checkboxes.
  31468. * When true, a user can select multiple list items at a time.
  31469. * When false, only a single list item can be selected at a time,
  31470. * and selecting a new list item will deselect any other selected list items.
  31471. */
  31472. this.multiple = false;
  31473. /**
  31474. * When true and single-selection is enabled, the selection changes when navigating list items via the keyboard.
  31475. */
  31476. this.selectionFollowsFocus = false;
  31477. // --------------------------------------------------------------------------
  31478. //
  31479. // Private Properties
  31480. //
  31481. // --------------------------------------------------------------------------
  31482. this.selectedValues = new Map();
  31483. this.dataForFilter = [];
  31484. this.lastSelectedItem = null;
  31485. this.mutationObserver = createObserver("mutation", mutationObserverCallback.bind(this));
  31486. this.setFilterEl = (el) => {
  31487. this.filterEl = el;
  31488. };
  31489. this.deselectRemovedItems = deselectRemovedItems.bind(this);
  31490. this.deselectSiblingItems = deselectSiblingItems.bind(this);
  31491. this.selectSiblings = selectSiblings.bind(this);
  31492. this.handleFilter = handleFilter.bind(this);
  31493. this.getItemData = getItemData.bind(this);
  31494. this.keyDownHandler = (event) => {
  31495. const handleElement = event
  31496. .composedPath()
  31497. .find((item) => { var _a; return ((_a = item.dataset) === null || _a === void 0 ? void 0 : _a.jsHandle) !== undefined; });
  31498. const item = event
  31499. .composedPath()
  31500. .find((item) => { var _a; return ((_a = item.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "calcite-value-list-item"; });
  31501. // Only trigger keyboard sorting when the internal drag handle is focused and activated
  31502. if (!handleElement || !item.handleActivated) {
  31503. keyDownHandler.call(this, event);
  31504. return;
  31505. }
  31506. const { items } = this;
  31507. if ((event.key !== "ArrowUp" && event.key !== "ArrowDown") || items.length <= 1) {
  31508. return;
  31509. }
  31510. event.preventDefault();
  31511. const { el } = this;
  31512. const nextIndex = moveItemIndex(this, item, event.key === "ArrowUp" ? "up" : "down");
  31513. if (nextIndex === items.length - 1) {
  31514. el.appendChild(item);
  31515. }
  31516. else {
  31517. const itemAtNextIndex = el.children[nextIndex];
  31518. const insertionReferenceItem = itemAtNextIndex === item.nextElementSibling
  31519. ? itemAtNextIndex.nextElementSibling
  31520. : itemAtNextIndex;
  31521. el.insertBefore(item, insertionReferenceItem);
  31522. }
  31523. this.items = this.getItems();
  31524. this.calciteListOrderChange.emit(this.items.map(({ value }) => value));
  31525. requestAnimationFrame(() => handleElement.focus());
  31526. item.handleActivated = true;
  31527. };
  31528. }
  31529. // --------------------------------------------------------------------------
  31530. //
  31531. // Lifecycle
  31532. //
  31533. // --------------------------------------------------------------------------
  31534. connectedCallback() {
  31535. initialize.call(this);
  31536. initializeObserver.call(this);
  31537. }
  31538. componentDidLoad() {
  31539. this.setUpDragAndDrop();
  31540. }
  31541. componentDidRender() {
  31542. updateHostInteraction(this);
  31543. }
  31544. disconnectedCallback() {
  31545. cleanUpObserver.call(this);
  31546. this.cleanUpDragAndDrop();
  31547. }
  31548. calciteListFocusOutHandler(event) {
  31549. calciteListFocusOutHandler.call(this, event);
  31550. }
  31551. calciteListItemRemoveHandler(event) {
  31552. removeItem.call(this, event);
  31553. }
  31554. calciteListItemChangeHandler(event) {
  31555. calciteListItemChangeHandler.call(this, event);
  31556. }
  31557. calciteListItemPropsChangeHandler(event) {
  31558. event.stopPropagation();
  31559. this.setUpFilter();
  31560. }
  31561. calciteListItemValueChangeHandler(event) {
  31562. calciteListItemValueChangeHandler.call(this, event);
  31563. }
  31564. // --------------------------------------------------------------------------
  31565. //
  31566. // Private Methods
  31567. //
  31568. // --------------------------------------------------------------------------
  31569. getItems() {
  31570. return Array.from(this.el.querySelectorAll("calcite-value-list-item"));
  31571. }
  31572. setUpItems() {
  31573. setUpItems.call(this, "calcite-value-list-item");
  31574. }
  31575. setUpFilter() {
  31576. if (this.filterEnabled) {
  31577. this.dataForFilter = this.getItemData();
  31578. }
  31579. }
  31580. setUpDragAndDrop() {
  31581. this.cleanUpDragAndDrop();
  31582. if (!this.dragEnabled) {
  31583. return;
  31584. }
  31585. this.sortable = Sortable.create(this.el, {
  31586. dataIdAttr: "id",
  31587. handle: `.${CSS.handle}`,
  31588. draggable: "calcite-value-list-item",
  31589. group: this.group,
  31590. onSort: () => {
  31591. this.items = Array.from(this.el.querySelectorAll("calcite-value-list-item"));
  31592. const values = this.items.map((item) => item.value);
  31593. this.calciteListOrderChange.emit(values);
  31594. }
  31595. });
  31596. }
  31597. cleanUpDragAndDrop() {
  31598. var _a;
  31599. (_a = this.sortable) === null || _a === void 0 ? void 0 : _a.destroy();
  31600. this.sortable = null;
  31601. }
  31602. // --------------------------------------------------------------------------
  31603. //
  31604. // Public Methods
  31605. //
  31606. // --------------------------------------------------------------------------
  31607. /** Returns the currently selected items */
  31608. async getSelectedItems() {
  31609. return this.selectedValues;
  31610. }
  31611. /** Sets focus on the component. */
  31612. async setFocus(focusId) {
  31613. return setFocus.call(this, focusId);
  31614. }
  31615. // --------------------------------------------------------------------------
  31616. //
  31617. // Render Methods
  31618. //
  31619. // --------------------------------------------------------------------------
  31620. getIconType() {
  31621. let type = null;
  31622. if (this.dragEnabled) {
  31623. type = ICON_TYPES.grip;
  31624. }
  31625. return type;
  31626. }
  31627. render() {
  31628. return hAsync(List, { onKeyDown: this.keyDownHandler, props: this });
  31629. }
  31630. get el() { return getElement(this); }
  31631. static get style() { return valueListCss; }
  31632. static get cmpMeta() { return {
  31633. "$flags$": 9,
  31634. "$tagName$": "calcite-value-list",
  31635. "$members$": {
  31636. "disabled": [516],
  31637. "dragEnabled": [516, "drag-enabled"],
  31638. "filterEnabled": [516, "filter-enabled"],
  31639. "filterPlaceholder": [513, "filter-placeholder"],
  31640. "group": [1],
  31641. "loading": [516],
  31642. "multiple": [516],
  31643. "selectionFollowsFocus": [4, "selection-follows-focus"],
  31644. "selectedValues": [32],
  31645. "dataForFilter": [32],
  31646. "getSelectedItems": [64],
  31647. "setFocus": [64]
  31648. },
  31649. "$listeners$": [[0, "focusout", "calciteListFocusOutHandler"], [0, "calciteListItemRemove", "calciteListItemRemoveHandler"], [0, "calciteListItemChange", "calciteListItemChangeHandler"], [0, "calciteListItemPropsChange", "calciteListItemPropsChangeHandler"], [0, "calciteListItemValueChange", "calciteListItemValueChangeHandler"]],
  31650. "$lazyBundleId$": "-",
  31651. "$attrsToReflect$": [["disabled", "disabled"], ["dragEnabled", "drag-enabled"], ["filterEnabled", "filter-enabled"], ["filterPlaceholder", "filter-placeholder"], ["loading", "loading"], ["multiple", "multiple"]]
  31652. }; }
  31653. }
  31654. const ICONS = {
  31655. drag: "drag"
  31656. };
  31657. const SLOTS = {
  31658. actionsEnd: "actions-end",
  31659. actionsStart: "actions-start"
  31660. };
  31661. const valueListItemCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-value-list-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-value-list-item{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-value-list-item{-webkit-animation-name:in;animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-value-list-item{-webkit-animation-name:in-down;animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-value-list-item{-webkit-animation-name:in-up;animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-value-list-item{-webkit-animation-name:in-scale;animation-name:in-scale}/*!@:root*/.sc-calcite-value-list-item:root{--calcite-popper-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-value-list-item-h{display:none}/*!@:host*/.sc-calcite-value-list-item-h{margin-bottom:1px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2);--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-transition:background-color var(--calcite-animation-timing), -webkit-box-shadow var(--calcite-animation-timing);transition:background-color var(--calcite-animation-timing), -webkit-box-shadow var(--calcite-animation-timing);transition:background-color var(--calcite-animation-timing), box-shadow var(--calcite-animation-timing);transition:background-color var(--calcite-animation-timing), box-shadow var(--calcite-animation-timing), -webkit-box-shadow var(--calcite-animation-timing)}/*!@:host **/.sc-calcite-value-list-item-h *.sc-calcite-value-list-item{-webkit-box-sizing:border-box;box-sizing:border-box}/*!@calcite-pick-list-item*/calcite-pick-list-item.sc-calcite-value-list-item{position:relative;margin:0px;-ms-flex-positive:1;flex-grow:1;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([active]), :host([selected])*/[active].sc-calcite-value-list-item-h,[selected].sc-calcite-value-list-item-h{--tw-shadow:0 0 0 1px var(--calcite-ui-brand);--tw-shadow-colored:0 0 0 1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@.handle*/.handle.sc-calcite-value-list-item{display:-ms-flexbox;display:flex;cursor:move;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-style:none;background-color:transparent;padding-top:0px;padding-bottom:0px;padding-left:0.25rem;padding-right:0.25rem;color:var(--calcite-ui-text-1);color:var(--calcite-ui-border-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}/*!@.handle:hover*/.handle.sc-calcite-value-list-item:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.handle:focus*/.handle.sc-calcite-value-list-item:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.handle--activated*/.handle--activated.sc-calcite-value-list-item{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}/*!@.handle calcite-icon*/.handle.sc-calcite-value-list-item calcite-icon.sc-calcite-value-list-item{color:inherit}/*!@:host([disabled])*/[disabled].sc-calcite-value-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-value-list-item-h[disabled] .sc-calcite-value-list-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-value-list-item-h [calcite-hydrated][disabled].sc-calcite-value-list-item{opacity:1}";
  31662. /**
  31663. * @slot actions-end - A slot for adding actions or content to the end side of the item.
  31664. * @slot actions-start - A slot for adding actions or content to the start side of the item.
  31665. */
  31666. class ValueListItem {
  31667. constructor(hostRef) {
  31668. registerInstance(this, hostRef);
  31669. this.calciteListItemRemove = createEvent(this, "calciteListItemRemove", 7);
  31670. /**
  31671. * When true, the list item cannot be clicked and is visually muted.
  31672. */
  31673. this.disabled = false;
  31674. /**
  31675. * @internal When false, the list item cannot be deselected by user interaction.
  31676. */
  31677. this.disableDeselect = false;
  31678. /**
  31679. * When true, prevents the content of the list item from user interaction.
  31680. */
  31681. this.nonInteractive = false;
  31682. /**
  31683. * @internal - Stores the activated state of the drag handle.
  31684. */
  31685. this.handleActivated = false;
  31686. /**
  31687. * Determines the icon SVG symbol that will be shown. Options are circle, square, grip or null.
  31688. * @see [ICON_TYPES](https://github.com/Esri/calcite-components/blob/master/src/components/pick-list/resources.ts#L5)
  31689. */
  31690. this.icon = null;
  31691. /**
  31692. * When true, adds an action to remove the list item.
  31693. */
  31694. this.removable = false;
  31695. /**
  31696. * When true, preselects the list item. Toggles when an item is checked/unchecked.
  31697. */
  31698. this.selected = false;
  31699. this.pickListItem = null;
  31700. this.guid = `calcite-value-list-item-${guid()}`;
  31701. // --------------------------------------------------------------------------
  31702. //
  31703. // Private Methods
  31704. //
  31705. // --------------------------------------------------------------------------
  31706. this.getPickListRef = (el) => (this.pickListItem = el);
  31707. this.handleKeyDown = (event) => {
  31708. if (event.key === " ") {
  31709. this.handleActivated = !this.handleActivated;
  31710. }
  31711. };
  31712. this.handleBlur = () => {
  31713. this.handleActivated = false;
  31714. };
  31715. this.handleSelectChange = (event) => {
  31716. this.selected = event.detail.selected;
  31717. };
  31718. }
  31719. // --------------------------------------------------------------------------
  31720. //
  31721. // Lifecycle
  31722. //
  31723. // --------------------------------------------------------------------------
  31724. connectedCallback() {
  31725. connectConditionalSlotComponent(this);
  31726. }
  31727. disconnectedCallback() {
  31728. disconnectConditionalSlotComponent(this);
  31729. }
  31730. componentDidRender() {
  31731. updateHostInteraction(this, this.el.closest("calcite-value-list") ? "managed" : false);
  31732. }
  31733. // --------------------------------------------------------------------------
  31734. //
  31735. // Public Methods
  31736. //
  31737. // --------------------------------------------------------------------------
  31738. /**
  31739. * Toggle the selection state. By default this won't trigger an event.
  31740. * The first argument allows the value to be coerced, rather than swapping values.
  31741. */
  31742. async toggleSelected(coerce) {
  31743. this.pickListItem.toggleSelected(coerce);
  31744. }
  31745. /** Set focus on the component. */
  31746. async setFocus() {
  31747. var _a;
  31748. (_a = this.pickListItem) === null || _a === void 0 ? void 0 : _a.setFocus();
  31749. }
  31750. calciteListItemChangeHandler(event) {
  31751. // adjust item payload from wrapped item before bubbling
  31752. event.detail.item = this.el;
  31753. }
  31754. // --------------------------------------------------------------------------
  31755. //
  31756. // Render Methods
  31757. //
  31758. // --------------------------------------------------------------------------
  31759. renderActionsEnd() {
  31760. const { el } = this;
  31761. const hasActionsEnd = getSlotted(el, SLOTS.actionsEnd);
  31762. return hasActionsEnd ? (hAsync("slot", { name: SLOTS.actionsEnd, slot: SLOTS$9.actionsEnd })) : null;
  31763. }
  31764. renderActionsStart() {
  31765. const { el } = this;
  31766. const hasActionsStart = getSlotted(el, SLOTS.actionsStart);
  31767. return hasActionsStart ? (hAsync("slot", { name: SLOTS.actionsStart, slot: SLOTS$9.actionsStart })) : null;
  31768. }
  31769. renderHandle() {
  31770. const { icon } = this;
  31771. if (icon === ICON_TYPES$1.grip) {
  31772. return (hAsync("span", { "aria-pressed": toAriaBoolean(this.handleActivated), class: {
  31773. [CSS$h.handle]: true,
  31774. [CSS$h.handleActivated]: this.handleActivated
  31775. }, "data-js-handle": true, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, role: "button", tabindex: "0" }, hAsync("calcite-icon", { icon: ICONS.drag, scale: "s" })));
  31776. }
  31777. }
  31778. render() {
  31779. return (hAsync(Host, { id: this.el.id || this.guid }, this.renderHandle(), hAsync("calcite-pick-list-item", { description: this.description, disableDeselect: this.disableDeselect, disabled: this.disabled, label: this.label, metadata: this.metadata, nonInteractive: this.nonInteractive, onCalciteListItemChange: this.handleSelectChange, ref: this.getPickListRef, removable: this.removable, selected: this.selected, value: this.value }, this.renderActionsStart(), this.renderActionsEnd())));
  31780. }
  31781. get el() { return getElement(this); }
  31782. static get style() { return valueListItemCss; }
  31783. static get cmpMeta() { return {
  31784. "$flags$": 9,
  31785. "$tagName$": "calcite-value-list-item",
  31786. "$members$": {
  31787. "description": [513],
  31788. "disabled": [516],
  31789. "disableDeselect": [4, "disable-deselect"],
  31790. "nonInteractive": [516, "non-interactive"],
  31791. "handleActivated": [1028, "handle-activated"],
  31792. "icon": [513],
  31793. "label": [513],
  31794. "metadata": [16],
  31795. "removable": [516],
  31796. "selected": [1540],
  31797. "value": [8],
  31798. "toggleSelected": [64],
  31799. "setFocus": [64]
  31800. },
  31801. "$listeners$": [[0, "calciteListItemChange", "calciteListItemChangeHandler"]],
  31802. "$lazyBundleId$": "-",
  31803. "$attrsToReflect$": [["description", "description"], ["disabled", "disabled"], ["nonInteractive", "non-interactive"], ["icon", "icon"], ["label", "label"], ["removable", "removable"], ["selected", "selected"]]
  31804. }; }
  31805. }
  31806. registerComponents([
  31807. Accordion,
  31808. AccordionItem,
  31809. Action,
  31810. ActionBar,
  31811. ActionGroup,
  31812. ActionMenu,
  31813. ActionPad,
  31814. Alert,
  31815. Avatar,
  31816. Block,
  31817. BlockSection,
  31818. Button,
  31819. Card,
  31820. Checkbox,
  31821. Chip,
  31822. ColorPicker,
  31823. ColorPickerHexInput,
  31824. ColorPickerSwatch,
  31825. Combobox,
  31826. ComboboxItem,
  31827. ComboboxItemGroup,
  31828. DatePicker,
  31829. DatePickerDay,
  31830. DatePickerMonth,
  31831. DatePickerMonthHeader,
  31832. Dropdown,
  31833. DropdownGroup,
  31834. DropdownItem,
  31835. Fab,
  31836. Filter,
  31837. Flow,
  31838. Graph,
  31839. Handle,
  31840. Icon,
  31841. InlineEditable,
  31842. Input,
  31843. InputDatePicker,
  31844. InputMessage,
  31845. InputTimePicker,
  31846. Label,
  31847. Link,
  31848. List$1,
  31849. ListItem,
  31850. ListItemGroup,
  31851. Loader,
  31852. Modal,
  31853. Notice,
  31854. Option,
  31855. OptionGroup,
  31856. Pagination,
  31857. Panel,
  31858. PickList,
  31859. PickListGroup,
  31860. PickListItem,
  31861. Popover,
  31862. PopoverManager,
  31863. Progress,
  31864. RadioButton,
  31865. RadioButtonGroup,
  31866. RadioGroup,
  31867. RadioGroupItem,
  31868. Rating,
  31869. Scrim,
  31870. Select,
  31871. Shell,
  31872. ShellCenterRow,
  31873. ShellPanel,
  31874. Slider,
  31875. SortableList,
  31876. SplitButton,
  31877. Stepper,
  31878. StepperItem,
  31879. Switch,
  31880. Tab,
  31881. TabNav,
  31882. TabTitle,
  31883. Tabs,
  31884. Tile,
  31885. TileSelect,
  31886. TileSelectGroup,
  31887. TimePicker,
  31888. Tip,
  31889. TipGroup,
  31890. TipManager,
  31891. Tooltip,
  31892. TooltipManager,
  31893. Tree,
  31894. TreeItem,
  31895. ValueList,
  31896. ValueListItem,
  31897. ]);
  31898. exports.hydrateApp = hydrateApp;
  31899. /*hydrateAppClosure end*/
  31900. hydrateApp(window, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve);
  31901. }
  31902. hydrateAppClosure($stencilWindow);
  31903. }
  31904. function createWindowFromHtml(e, t) {
  31905. let r = templateWindows.get(t);
  31906. return null == r && (r = new MockWindow(e), templateWindows.set(t, r)), cloneWindow(r);
  31907. }
  31908. function normalizeHydrateOptions(e) {
  31909. const t = Object.assign({
  31910. serializeToHtml: !1,
  31911. destroyWindow: !1,
  31912. destroyDocument: !1
  31913. }, e || {});
  31914. return "boolean" != typeof t.clientHydrateAnnotations && (t.clientHydrateAnnotations = !0),
  31915. "boolean" != typeof t.constrainTimeouts && (t.constrainTimeouts = !0), "number" != typeof t.maxHydrateCount && (t.maxHydrateCount = 300),
  31916. "boolean" != typeof t.runtimeLogging && (t.runtimeLogging = !1), "number" != typeof t.timeout && (t.timeout = 15e3),
  31917. Array.isArray(t.excludeComponents) ? t.excludeComponents = t.excludeComponents.filter(filterValidTags).map(mapValidTags) : t.excludeComponents = [],
  31918. Array.isArray(t.staticComponents) ? t.staticComponents = t.staticComponents.filter(filterValidTags).map(mapValidTags) : t.staticComponents = [],
  31919. t;
  31920. }
  31921. function filterValidTags(e) {
  31922. return "string" == typeof e && e.includes("-");
  31923. }
  31924. function mapValidTags(e) {
  31925. return e.trim().toLowerCase();
  31926. }
  31927. function generateHydrateResults(e) {
  31928. "string" != typeof e.url && (e.url = "https://hydrate.stenciljs.com/"), "string" != typeof e.buildId && (e.buildId = createHydrateBuildId());
  31929. const t = {
  31930. buildId: e.buildId,
  31931. diagnostics: [],
  31932. url: e.url,
  31933. host: null,
  31934. hostname: null,
  31935. href: null,
  31936. pathname: null,
  31937. port: null,
  31938. search: null,
  31939. hash: null,
  31940. html: null,
  31941. httpStatus: null,
  31942. hydratedCount: 0,
  31943. anchors: [],
  31944. components: [],
  31945. imgs: [],
  31946. scripts: [],
  31947. staticData: [],
  31948. styles: [],
  31949. title: null
  31950. };
  31951. try {
  31952. const r = new URL(e.url, "https://hydrate.stenciljs.com/");
  31953. t.url = r.href, t.host = r.host, t.hostname = r.hostname, t.href = r.href, t.port = r.port,
  31954. t.pathname = r.pathname, t.search = r.search, t.hash = r.hash;
  31955. } catch (e) {
  31956. renderCatchError(t, e);
  31957. }
  31958. return t;
  31959. }
  31960. function renderBuildDiagnostic(e, t, r, s) {
  31961. const n = {
  31962. level: t,
  31963. type: "build",
  31964. header: r,
  31965. messageText: s,
  31966. relFilePath: null,
  31967. absFilePath: null,
  31968. lines: []
  31969. };
  31970. return e.pathname ? "/" !== e.pathname && (n.header += ": " + e.pathname) : e.url && (n.header += ": " + e.url),
  31971. e.diagnostics.push(n), n;
  31972. }
  31973. function renderBuildError(e, t) {
  31974. return renderBuildDiagnostic(e, "error", "Hydrate Error", t);
  31975. }
  31976. function renderCatchError(e, t) {
  31977. const r = renderBuildError(e, null);
  31978. return null != t && (null != t.stack ? r.messageText = t.stack.toString() : null != t.message ? r.messageText = t.message.toString() : r.messageText = t.toString()),
  31979. r;
  31980. }
  31981. function runtimeLog(e, t, r) {
  31982. global.console[t].apply(global.console, [ `[ ${e} ${t} ] `, ...r ]);
  31983. }
  31984. function inspectElement(e, t, r) {
  31985. const s = t.children;
  31986. for (let t = 0, n = s.length; t < n; t++) {
  31987. const n = s[t], o = n.nodeName.toLowerCase();
  31988. if (o.includes("-")) {
  31989. const t = e.components.find((e => e.tag === o));
  31990. null != t && (t.count++, r > t.depth && (t.depth = r));
  31991. } else switch (o) {
  31992. case "a":
  31993. const t = collectAttributes(n);
  31994. t.href = n.href, "string" == typeof t.href && (e.anchors.some((e => e.href === t.href)) || e.anchors.push(t));
  31995. break;
  31996. case "img":
  31997. const r = collectAttributes(n);
  31998. r.src = n.src, "string" == typeof r.src && (e.imgs.some((e => e.src === r.src)) || e.imgs.push(r));
  31999. break;
  32000. case "link":
  32001. const s = collectAttributes(n);
  32002. s.href = n.href, "string" == typeof s.rel && "stylesheet" === s.rel.toLowerCase() && "string" == typeof s.href && (e.styles.some((e => e.link === s.href)) || (delete s.rel,
  32003. delete s.type, e.styles.push(s)));
  32004. break;
  32005. case "script":
  32006. const o = collectAttributes(n);
  32007. if (n.hasAttribute("src")) o.src = n.src, "string" == typeof o.src && (e.scripts.some((e => e.src === o.src)) || e.scripts.push(o)); else {
  32008. const t = n.getAttribute("data-stencil-static");
  32009. t && e.staticData.push({
  32010. id: t,
  32011. type: n.getAttribute("type"),
  32012. content: n.textContent
  32013. });
  32014. }
  32015. }
  32016. inspectElement(e, n, ++r);
  32017. }
  32018. }
  32019. function collectAttributes(e) {
  32020. const t = {}, r = e.attributes;
  32021. for (let e = 0, s = r.length; e < s; e++) {
  32022. const s = r.item(e), n = s.nodeName.toLowerCase();
  32023. if (SKIP_ATTRS.has(n)) continue;
  32024. const o = s.nodeValue;
  32025. "class" === n && "" === o || (t[n] = o);
  32026. }
  32027. return t;
  32028. }
  32029. function patchDomImplementation(e, t) {
  32030. let r;
  32031. if (null != e.defaultView ? (t.destroyWindow = !0, patchWindow(e.defaultView), r = e.defaultView) : (t.destroyWindow = !0,
  32032. t.destroyDocument = !1, r = new MockWindow(!1)), r.document !== e && (r.document = e),
  32033. e.defaultView !== r && (e.defaultView = r), "function" != typeof e.documentElement.constructor.prototype.getRootNode && (e.createElement("unknown-element").constructor.prototype.getRootNode = getRootNode),
  32034. "function" == typeof e.createEvent) {
  32035. const t = e.createEvent("CustomEvent").constructor;
  32036. r.CustomEvent !== t && (r.CustomEvent = t);
  32037. }
  32038. try {
  32039. e.baseURI;
  32040. } catch (t) {
  32041. Object.defineProperty(e, "baseURI", {
  32042. get() {
  32043. const t = e.querySelector("base[href]");
  32044. return t ? new URL(t.getAttribute("href"), r.location.href).href : r.location.href;
  32045. }
  32046. });
  32047. }
  32048. return r;
  32049. }
  32050. function getRootNode(e) {
  32051. const t = null != e && !0 === e.composed;
  32052. let r = this;
  32053. for (;null != r.parentNode; ) r = r.parentNode, !0 === t && null == r.parentNode && null != r.host && (r = r.host);
  32054. return r;
  32055. }
  32056. function renderToString(e, t) {
  32057. const r = normalizeHydrateOptions(t);
  32058. return r.serializeToHtml = !0, new Promise((t => {
  32059. let s;
  32060. const n = generateHydrateResults(r);
  32061. if (hasError(n.diagnostics)) t(n); else if ("string" == typeof e) try {
  32062. r.destroyWindow = !0, r.destroyDocument = !0, s = new MockWindow(e), render(s, r, n, t);
  32063. } catch (e) {
  32064. s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
  32065. } else if (isValidDocument(e)) try {
  32066. r.destroyDocument = !1, s = patchDomImplementation(e, r), render(s, r, n, t);
  32067. } catch (e) {
  32068. s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
  32069. } else renderBuildError(n, 'Invalid html or document. Must be either a valid "html" string, or DOM "document".'),
  32070. t(n);
  32071. }));
  32072. }
  32073. function hydrateDocument(e, t) {
  32074. const r = normalizeHydrateOptions(t);
  32075. return r.serializeToHtml = !1, new Promise((t => {
  32076. let s;
  32077. const n = generateHydrateResults(r);
  32078. if (hasError(n.diagnostics)) t(n); else if ("string" == typeof e) try {
  32079. r.destroyWindow = !0, r.destroyDocument = !0, s = new MockWindow(e), render(s, r, n, t);
  32080. } catch (e) {
  32081. s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
  32082. } else if (isValidDocument(e)) try {
  32083. r.destroyDocument = !1, s = patchDomImplementation(e, r), render(s, r, n, t);
  32084. } catch (e) {
  32085. s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
  32086. } else renderBuildError(n, 'Invalid html or document. Must be either a valid "html" string, or DOM "document".'),
  32087. t(n);
  32088. }));
  32089. }
  32090. function render(e, t, r, s) {
  32091. if (process.__stencilErrors || (process.__stencilErrors = !0, process.on("unhandledRejection", (e => {
  32092. console.log("unhandledRejection", e);
  32093. }))), function n(e, t, r, s) {
  32094. try {
  32095. e.location.href = r.url;
  32096. } catch (e) {
  32097. renderCatchError(s, e);
  32098. }
  32099. if ("string" == typeof r.userAgent) try {
  32100. e.navigator.userAgent = r.userAgent;
  32101. } catch (e) {}
  32102. if ("string" == typeof r.cookie) try {
  32103. t.cookie = r.cookie;
  32104. } catch (e) {}
  32105. if ("string" == typeof r.referrer) try {
  32106. t.referrer = r.referrer;
  32107. } catch (e) {}
  32108. if ("string" == typeof r.direction) try {
  32109. t.documentElement.setAttribute("dir", r.direction);
  32110. } catch (e) {}
  32111. if ("string" == typeof r.language) try {
  32112. t.documentElement.setAttribute("lang", r.language);
  32113. } catch (e) {}
  32114. if ("string" == typeof r.buildId) try {
  32115. t.documentElement.setAttribute("data-stencil-build", r.buildId);
  32116. } catch (e) {}
  32117. try {
  32118. e.customElements = null;
  32119. } catch (e) {}
  32120. return r.constrainTimeouts && constrainTimeouts(e), function n(e, t, r) {
  32121. try {
  32122. const s = e.location.pathname;
  32123. e.console.error = (...e) => {
  32124. const n = e.reduce(((e, t) => {
  32125. if (t) {
  32126. if (null != t.stack) return e + " " + String(t.stack);
  32127. if (null != t.message) return e + " " + String(t.message);
  32128. }
  32129. return String(t);
  32130. }), "").trim();
  32131. "" !== n && (renderCatchError(r, n), t.runtimeLogging && runtimeLog(s, "error", [ n ]));
  32132. }, e.console.debug = (...e) => {
  32133. renderBuildDiagnostic(r, "debug", "Hydrate Debug", [ ...e ].join(", ")), t.runtimeLogging && runtimeLog(s, "debug", e);
  32134. }, t.runtimeLogging && [ "log", "warn", "assert", "info", "trace" ].forEach((t => {
  32135. e.console[t] = (...e) => {
  32136. runtimeLog(s, t, e);
  32137. };
  32138. }));
  32139. } catch (e) {
  32140. renderCatchError(r, e);
  32141. }
  32142. }(e, r, s), e;
  32143. }(e, e.document, t, r), "function" == typeof t.beforeHydrate) try {
  32144. const n = t.beforeHydrate(e.document);
  32145. isPromise(n) ? n.then((() => {
  32146. hydrateFactory(e, t, r, afterHydrate, s);
  32147. })) : hydrateFactory(e, t, r, afterHydrate, s);
  32148. } catch (n) {
  32149. renderCatchError(r, n), finalizeHydrate(e, e.document, t, r, s);
  32150. } else hydrateFactory(e, t, r, afterHydrate, s);
  32151. }
  32152. function afterHydrate(e, t, r, s) {
  32153. if ("function" == typeof t.afterHydrate) try {
  32154. const n = t.afterHydrate(e.document);
  32155. isPromise(n) ? n.then((() => {
  32156. finalizeHydrate(e, e.document, t, r, s);
  32157. })) : finalizeHydrate(e, e.document, t, r, s);
  32158. } catch (n) {
  32159. renderCatchError(r, n), finalizeHydrate(e, e.document, t, r, s);
  32160. } else finalizeHydrate(e, e.document, t, r, s);
  32161. }
  32162. function finalizeHydrate(e, t, r, s, n) {
  32163. try {
  32164. if (inspectElement(s, t.documentElement, 0), !1 !== r.removeUnusedStyles) try {
  32165. ((e, t) => {
  32166. try {
  32167. const r = e.head.querySelectorAll("style[data-styles]"), s = r.length;
  32168. if (s > 0) {
  32169. const n = (e => {
  32170. const t = {
  32171. attrs: new Set,
  32172. classNames: new Set,
  32173. ids: new Set,
  32174. tags: new Set
  32175. };
  32176. return collectUsedSelectors(t, e), t;
  32177. })(e.documentElement);
  32178. for (let e = 0; e < s; e++) removeUnusedStyleText(n, t, r[e]);
  32179. }
  32180. } catch (e) {
  32181. ((e, t, r) => {
  32182. const s = {
  32183. level: "error",
  32184. type: "build",
  32185. header: "Build Error",
  32186. messageText: "build error",
  32187. relFilePath: null,
  32188. absFilePath: null,
  32189. lines: []
  32190. };
  32191. null != t && (null != t.stack ? s.messageText = t.stack.toString() : null != t.message ? s.messageText = t.message.length ? t.message : "UNKNOWN ERROR" : s.messageText = t.toString()),
  32192. null == e || shouldIgnoreError(s.messageText) || e.push(s);
  32193. })(t, e);
  32194. }
  32195. })(t, s.diagnostics);
  32196. } catch (e) {
  32197. renderCatchError(s, e);
  32198. }
  32199. if ("string" == typeof r.title) try {
  32200. t.title = r.title;
  32201. } catch (e) {
  32202. renderCatchError(s, e);
  32203. }
  32204. s.title = t.title, r.removeScripts && removeScripts(t.documentElement);
  32205. try {
  32206. ((e, t) => {
  32207. let r = e.head.querySelector('link[rel="canonical"]');
  32208. "string" == typeof t ? (null == r && (r = e.createElement("link"), r.setAttribute("rel", "canonical"),
  32209. e.head.appendChild(r)), r.setAttribute("href", t)) : null != r && (r.getAttribute("href") || r.parentNode.removeChild(r));
  32210. })(t, r.canonicalUrl);
  32211. } catch (e) {
  32212. renderCatchError(s, e);
  32213. }
  32214. try {
  32215. (e => {
  32216. const t = e.head;
  32217. let r = t.querySelector("meta[charset]");
  32218. null == r ? (r = e.createElement("meta"), r.setAttribute("charset", "utf-8")) : r.remove(),
  32219. t.insertBefore(r, t.firstChild);
  32220. })(t);
  32221. } catch (e) {}
  32222. hasError(s.diagnostics) || (s.httpStatus = 200);
  32223. try {
  32224. const e = t.head.querySelector('meta[http-equiv="status"]');
  32225. if (null != e) {
  32226. const t = e.getAttribute("content");
  32227. t && t.length > 0 && (s.httpStatus = parseInt(t, 10));
  32228. }
  32229. } catch (e) {}
  32230. r.clientHydrateAnnotations && t.documentElement.classList.add("hydrated"), r.serializeToHtml && (s.html = serializeDocumentToString(t, r));
  32231. } catch (e) {
  32232. renderCatchError(s, e);
  32233. }
  32234. if (r.destroyWindow) try {
  32235. r.destroyDocument || (e.document = null, t.defaultView = null), e.close && e.close();
  32236. } catch (e) {
  32237. renderCatchError(s, e);
  32238. }
  32239. n(s);
  32240. }
  32241. function serializeDocumentToString(e, t) {
  32242. return serializeNodeToHtml(e, {
  32243. approximateLineWidth: t.approximateLineWidth,
  32244. outerHtml: !1,
  32245. prettyHtml: t.prettyHtml,
  32246. removeAttributeQuotes: t.removeAttributeQuotes,
  32247. removeBooleanAttributeQuotes: t.removeBooleanAttributeQuotes,
  32248. removeEmptyAttributes: t.removeEmptyAttributes,
  32249. removeHtmlComments: t.removeHtmlComments,
  32250. serializeShadowRoot: !1
  32251. });
  32252. }
  32253. function isValidDocument(e) {
  32254. return null != e && 9 === e.nodeType && null != e.documentElement && 1 === e.documentElement.nodeType && null != e.body && 1 === e.body.nodeType;
  32255. }
  32256. function removeScripts(e) {
  32257. const t = e.children;
  32258. for (let e = t.length - 1; e >= 0; e--) {
  32259. const r = t[e];
  32260. removeScripts(r), ("SCRIPT" === r.nodeName || "LINK" === r.nodeName && "modulepreload" === r.getAttribute("rel")) && r.remove();
  32261. }
  32262. }
  32263. const templateWindows = new Map, createHydrateBuildId = () => {
  32264. let e = "abcdefghijklmnopqrstuvwxyz", t = "";
  32265. for (;t.length < 8; ) t += e[Math.floor(Math.random() * e.length)], 1 === t.length && (e += "0123456789");
  32266. return t;
  32267. }, isPromise = e => !!e && ("object" == typeof e || "function" == typeof e) && "function" == typeof e.then, hasError = e => null != e && 0 !== e.length && e.some((e => "error" === e.level && "runtime" !== e.type)), shouldIgnoreError = e => e === TASK_CANCELED_MSG, TASK_CANCELED_MSG = "task canceled", SKIP_ATTRS = new Set([ "s-id", "c-id" ]), collectUsedSelectors = (e, t) => {
  32268. if (null != t && 1 === t.nodeType) {
  32269. const r = t.children, s = t.nodeName.toLowerCase();
  32270. e.tags.add(s);
  32271. const n = t.attributes;
  32272. for (let r = 0, s = n.length; r < s; r++) {
  32273. const s = n.item(r), o = s.name.toLowerCase();
  32274. if (e.attrs.add(o), "class" === o) {
  32275. const r = t.classList;
  32276. for (let t = 0, s = r.length; t < s; t++) e.classNames.add(r.item(t));
  32277. } else "id" === o && e.ids.add(s.value);
  32278. }
  32279. if (r) for (let t = 0, s = r.length; t < s; t++) collectUsedSelectors(e, r[t]);
  32280. }
  32281. }, parseCss = (e, t) => {
  32282. let r = 1, s = 1;
  32283. const n = [], o = e => {
  32284. const t = e.match(/\n/g);
  32285. t && (r += t.length);
  32286. const n = e.lastIndexOf("\n");
  32287. s = ~n ? e.length - n : s + e.length;
  32288. }, i = () => {
  32289. const e = {
  32290. line: r,
  32291. column: s
  32292. };
  32293. return t => (t.position = new z(e), m(), t);
  32294. }, a = o => {
  32295. const i = e.split("\n"), a = {
  32296. level: "error",
  32297. type: "css",
  32298. language: "css",
  32299. header: "CSS Parse",
  32300. messageText: o,
  32301. absFilePath: t,
  32302. lines: [ {
  32303. lineIndex: r - 1,
  32304. lineNumber: r,
  32305. errorCharStart: s,
  32306. text: e[r - 1]
  32307. } ]
  32308. };
  32309. if (r > 1) {
  32310. const t = {
  32311. lineIndex: r - 1,
  32312. lineNumber: r - 1,
  32313. text: e[r - 2],
  32314. errorCharStart: -1,
  32315. errorLength: -1
  32316. };
  32317. a.lines.unshift(t);
  32318. }
  32319. if (r + 2 < i.length) {
  32320. const e = {
  32321. lineIndex: r,
  32322. lineNumber: r + 1,
  32323. text: i[r],
  32324. errorCharStart: -1,
  32325. errorLength: -1
  32326. };
  32327. a.lines.push(e);
  32328. }
  32329. return n.push(a), null;
  32330. }, l = () => u(/^{\s*/), c = () => u(/^}/), u = t => {
  32331. const r = t.exec(e);
  32332. if (!r) return;
  32333. const s = r[0];
  32334. return o(s), e = e.slice(s.length), r;
  32335. }, d = () => {
  32336. let t;
  32337. const r = [];
  32338. for (m(), h(r); e.length && "}" !== e.charAt(0) && (t = w() || A()); ) !1 !== t && (r.push(t),
  32339. h(r));
  32340. return r;
  32341. }, m = () => u(/^\s*/), h = e => {
  32342. let t;
  32343. for (e = e || []; t = p(); ) !1 !== t && e.push(t);
  32344. return e;
  32345. }, p = () => {
  32346. const t = i();
  32347. if ("/" !== e.charAt(0) || "*" !== e.charAt(1)) return null;
  32348. let r = 2;
  32349. for (;"" !== e.charAt(r) && ("*" !== e.charAt(r) || "/" !== e.charAt(r + 1)); ) ++r;
  32350. if (r += 2, "" === e.charAt(r - 1)) return a("End of comment missing");
  32351. const n = e.slice(2, r - 2);
  32352. return s += 2, o(n), e = e.slice(r), s += 2, t({
  32353. type: 1,
  32354. comment: n
  32355. });
  32356. }, f = () => {
  32357. const e = u(/^([^{]+)/);
  32358. return e ? trim(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, "").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (function(e) {
  32359. return e.replace(/,/g, "‌");
  32360. })).split(/\s*(?![^(]*\)),\s*/).map((function(e) {
  32361. return e.replace(/\u200C/g, ",");
  32362. })) : null;
  32363. }, g = () => {
  32364. const e = i();
  32365. let t = u(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
  32366. if (!t) return null;
  32367. if (t = trim(t[0]), !u(/^:\s*/)) return a("property missing ':'");
  32368. const r = u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/), s = e({
  32369. type: 4,
  32370. property: t.replace(commentre, ""),
  32371. value: r ? trim(r[0]).replace(commentre, "") : ""
  32372. });
  32373. return u(/^[;\s]*/), s;
  32374. }, y = () => {
  32375. const e = [];
  32376. if (!l()) return a("missing '{'");
  32377. let t;
  32378. for (h(e); t = g(); ) !1 !== t && (e.push(t), h(e));
  32379. return c() ? e : a("missing '}'");
  32380. }, C = () => {
  32381. let e;
  32382. const t = [], r = i();
  32383. for (;e = u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/); ) t.push(e[1]), u(/^,\s*/);
  32384. return t.length ? r({
  32385. type: 9,
  32386. values: t,
  32387. declarations: y()
  32388. }) : null;
  32389. }, S = (e, t) => {
  32390. const r = new RegExp("^@" + e + "\\s*([^;]+);");
  32391. return () => {
  32392. const s = i(), n = u(r);
  32393. if (!n) return null;
  32394. const o = {
  32395. type: t
  32396. };
  32397. return o[e] = n[1].trim(), s(o);
  32398. };
  32399. }, E = S("import", 7), b = S("charset", 0), T = S("namespace", 11), w = () => "@" !== e[0] ? null : (() => {
  32400. const e = i();
  32401. let t = u(/^@([-\w]+)?keyframes\s*/);
  32402. if (!t) return null;
  32403. const r = t[1];
  32404. if (t = u(/^([-\w]+)\s*/), !t) return a("@keyframes missing name");
  32405. const s = t[1];
  32406. if (!l()) return a("@keyframes missing '{'");
  32407. let n, o = h();
  32408. for (;n = C(); ) o.push(n), o = o.concat(h());
  32409. return c() ? e({
  32410. type: 8,
  32411. name: s,
  32412. vendor: r,
  32413. keyframes: o
  32414. }) : a("@keyframes missing '}'");
  32415. })() || (() => {
  32416. const e = i(), t = u(/^@media *([^{]+)/);
  32417. if (!t) return null;
  32418. const r = trim(t[1]);
  32419. if (!l()) return a("@media missing '{'");
  32420. const s = h().concat(d());
  32421. return c() ? e({
  32422. type: 10,
  32423. media: r,
  32424. rules: s
  32425. }) : a("@media missing '}'");
  32426. })() || (() => {
  32427. const e = i(), t = u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
  32428. return t ? e({
  32429. type: 2,
  32430. name: trim(t[1]),
  32431. media: trim(t[2])
  32432. }) : null;
  32433. })() || (() => {
  32434. const e = i(), t = u(/^@supports *([^{]+)/);
  32435. if (!t) return null;
  32436. const r = trim(t[1]);
  32437. if (!l()) return a("@supports missing '{'");
  32438. const s = h().concat(d());
  32439. return c() ? e({
  32440. type: 15,
  32441. supports: r,
  32442. rules: s
  32443. }) : a("@supports missing '}'");
  32444. })() || E() || b() || T() || (() => {
  32445. const e = i(), t = u(/^@([-\w]+)?document *([^{]+)/);
  32446. if (!t) return null;
  32447. const r = trim(t[1]), s = trim(t[2]);
  32448. if (!l()) return a("@document missing '{'");
  32449. const n = h().concat(d());
  32450. return c() ? e({
  32451. type: 3,
  32452. document: s,
  32453. vendor: r,
  32454. rules: n
  32455. }) : a("@document missing '}'");
  32456. })() || (() => {
  32457. const e = i();
  32458. if (!u(/^@page */)) return null;
  32459. const t = f() || [];
  32460. if (!l()) return a("@page missing '{'");
  32461. let r, s = h();
  32462. for (;r = g(); ) s.push(r), s = s.concat(h());
  32463. return c() ? e({
  32464. type: 12,
  32465. selectors: t,
  32466. declarations: s
  32467. }) : a("@page missing '}'");
  32468. })() || (() => {
  32469. const e = i();
  32470. if (!u(/^@host\s*/)) return null;
  32471. if (!l()) return a("@host missing '{'");
  32472. const t = h().concat(d());
  32473. return c() ? e({
  32474. type: 6,
  32475. rules: t
  32476. }) : a("@host missing '}'");
  32477. })() || (() => {
  32478. const e = i();
  32479. if (!u(/^@font-face\s*/)) return null;
  32480. if (!l()) return a("@font-face missing '{'");
  32481. let t, r = h();
  32482. for (;t = g(); ) r.push(t), r = r.concat(h());
  32483. return c() ? e({
  32484. type: 5,
  32485. declarations: r
  32486. }) : a("@font-face missing '}'");
  32487. })(), A = () => {
  32488. const e = i(), t = f();
  32489. return t ? (h(), e({
  32490. type: 13,
  32491. selectors: t,
  32492. declarations: y()
  32493. })) : a("selector missing");
  32494. };
  32495. class z {
  32496. constructor(e) {
  32497. this.start = e, this.end = {
  32498. line: r,
  32499. column: s
  32500. }, this.source = t;
  32501. }
  32502. }
  32503. return z.prototype.content = e, {
  32504. diagnostics: n,
  32505. ...addParent((() => {
  32506. const e = d();
  32507. return {
  32508. type: 14,
  32509. stylesheet: {
  32510. source: t,
  32511. rules: e
  32512. }
  32513. };
  32514. })())
  32515. };
  32516. }, trim = e => e ? e.trim() : "", addParent = (e, t) => {
  32517. const r = e && "string" == typeof e.type, s = r ? e : t;
  32518. for (const t in e) {
  32519. const r = e[t];
  32520. Array.isArray(r) ? r.forEach((function(e) {
  32521. addParent(e, s);
  32522. })) : r && "object" == typeof r && addParent(r, s);
  32523. }
  32524. return r && Object.defineProperty(e, "parent", {
  32525. configurable: !0,
  32526. writable: !0,
  32527. enumerable: !1,
  32528. value: t || null
  32529. }), e;
  32530. }, commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g, getCssSelectors = e => {
  32531. SELECTORS.all.length = SELECTORS.tags.length = SELECTORS.classNames.length = SELECTORS.ids.length = SELECTORS.attrs.length = 0;
  32532. const t = (e = e.replace(/\./g, " .").replace(/\#/g, " #").replace(/\[/g, " [").replace(/\>/g, " > ").replace(/\+/g, " + ").replace(/\~/g, " ~ ").replace(/\*/g, " * ").replace(/\:not\((.*?)\)/g, " ")).split(" ");
  32533. for (let e = 0, r = t.length; e < r; e++) t[e] = t[e].split(":")[0], 0 !== t[e].length && ("." === t[e].charAt(0) ? SELECTORS.classNames.push(t[e].slice(1)) : "#" === t[e].charAt(0) ? SELECTORS.ids.push(t[e].slice(1)) : "[" === t[e].charAt(0) ? (t[e] = t[e].slice(1).split("=")[0].split("]")[0].trim(),
  32534. SELECTORS.attrs.push(t[e].toLowerCase())) : /[a-z]/g.test(t[e].charAt(0)) && SELECTORS.tags.push(t[e].toLowerCase()));
  32535. return SELECTORS.classNames = SELECTORS.classNames.sort(((e, t) => e.length < t.length ? -1 : e.length > t.length ? 1 : 0)),
  32536. SELECTORS;
  32537. }, SELECTORS = {
  32538. all: [],
  32539. tags: [],
  32540. classNames: [],
  32541. ids: [],
  32542. attrs: []
  32543. }, serializeCssVisitNode = (e, t, r, s) => {
  32544. const n = t.type;
  32545. return 4 === n ? serializeCssDeclaration(t, r, s) : 13 === n ? serializeCssRule(e, t) : 1 === n ? "!" === t.comment[0] ? `/*${t.comment}*/` : "" : 10 === n ? serializeCssMedia(e, t) : 8 === n ? serializeCssKeyframes(e, t) : 9 === n ? serializeCssKeyframe(e, t) : 5 === n ? serializeCssFontFace(e, t) : 15 === n ? serializeCssSupports(e, t) : 7 === n ? "@import " + t.import + ";" : 0 === n ? "@charset " + t.charset + ";" : 12 === n ? serializeCssPage(e, t) : 6 === n ? "@host{" + serializeCssMapVisit(e, t.rules) + "}" : 2 === n ? "@custom-media " + t.name + " " + t.media + ";" : 3 === n ? serializeCssDocument(e, t) : 11 === n ? "@namespace " + t.namespace + ";" : "";
  32546. }, serializeCssRule = (e, t) => {
  32547. const r = t.declarations, s = e.usedSelectors, n = t.selectors.slice();
  32548. if (null == r || 0 === r.length) return "";
  32549. if (s) {
  32550. let t, r, o = !0;
  32551. for (t = n.length - 1; t >= 0; t--) {
  32552. const i = getCssSelectors(n[t]);
  32553. o = !0;
  32554. let a = i.classNames.length;
  32555. if (a > 0 && e.hasUsedClassNames) for (r = 0; r < a; r++) if (!s.classNames.has(i.classNames[r])) {
  32556. o = !1;
  32557. break;
  32558. }
  32559. if (o && e.hasUsedTags && (a = i.tags.length, a > 0)) for (r = 0; r < a; r++) if (!s.tags.has(i.tags[r])) {
  32560. o = !1;
  32561. break;
  32562. }
  32563. if (o && e.hasUsedAttrs && (a = i.attrs.length, a > 0)) for (r = 0; r < a; r++) if (!s.attrs.has(i.attrs[r])) {
  32564. o = !1;
  32565. break;
  32566. }
  32567. if (o && e.hasUsedIds && (a = i.ids.length, a > 0)) for (r = 0; r < a; r++) if (!s.ids.has(i.ids[r])) {
  32568. o = !1;
  32569. break;
  32570. }
  32571. o || n.splice(t, 1);
  32572. }
  32573. }
  32574. if (0 === n.length) return "";
  32575. const o = [];
  32576. let i = "";
  32577. for (const e of t.selectors) i = removeSelectorWhitespace(e), o.includes(i) || o.push(i);
  32578. return `${o}{${serializeCssMapVisit(e, r)}}`;
  32579. }, serializeCssDeclaration = (e, t, r) => "" === e.value ? "" : r - 1 === t ? e.property + ":" + e.value : e.property + ":" + e.value + ";", serializeCssMedia = (e, t) => {
  32580. const r = serializeCssMapVisit(e, t.rules);
  32581. return "" === r ? "" : "@media " + removeMediaWhitespace(t.media) + "{" + r + "}";
  32582. }, serializeCssKeyframes = (e, t) => {
  32583. const r = serializeCssMapVisit(e, t.keyframes);
  32584. return "" === r ? "" : "@" + (t.vendor || "") + "keyframes " + t.name + "{" + r + "}";
  32585. }, serializeCssKeyframe = (e, t) => t.values.join(",") + "{" + serializeCssMapVisit(e, t.declarations) + "}", serializeCssFontFace = (e, t) => {
  32586. const r = serializeCssMapVisit(e, t.declarations);
  32587. return "" === r ? "" : "@font-face{" + r + "}";
  32588. }, serializeCssSupports = (e, t) => {
  32589. const r = serializeCssMapVisit(e, t.rules);
  32590. return "" === r ? "" : "@supports " + t.supports + "{" + r + "}";
  32591. }, serializeCssPage = (e, t) => "@page " + t.selectors.join(", ") + "{" + serializeCssMapVisit(e, t.declarations) + "}", serializeCssDocument = (e, t) => {
  32592. const r = serializeCssMapVisit(e, t.rules), s = "@" + (t.vendor || "") + "document " + t.document;
  32593. return "" === r ? "" : s + "{" + r + "}";
  32594. }, serializeCssMapVisit = (e, t) => {
  32595. let r = "";
  32596. if (t) for (let s = 0, n = t.length; s < n; s++) r += serializeCssVisitNode(e, t[s], s, n);
  32597. return r;
  32598. }, removeSelectorWhitespace = e => {
  32599. let t = "", r = "", s = !1;
  32600. for (let n = 0, o = (e = e.trim()).length; n < o; n++) if (r = e[n], "[" === r && "\\" !== t[t.length - 1] ? s = !0 : "]" === r && "\\" !== t[t.length - 1] && (s = !1),
  32601. !s && CSS_WS_REG.test(r)) {
  32602. if (CSS_NEXT_CHAR_REG.test(e[n + 1])) continue;
  32603. if (CSS_PREV_CHAR_REG.test(t[t.length - 1])) continue;
  32604. t += " ";
  32605. } else t += r;
  32606. return t;
  32607. }, removeMediaWhitespace = e => {
  32608. let t = "", r = "";
  32609. for (let s = 0, n = (e = e.trim()).length; s < n; s++) if (r = e[s], CSS_WS_REG.test(r)) {
  32610. if (CSS_WS_REG.test(t[t.length - 1])) continue;
  32611. t += " ";
  32612. } else t += r;
  32613. return t;
  32614. }, CSS_WS_REG = /\s/, CSS_NEXT_CHAR_REG = /[>\(\)\~\,\+\s]/, CSS_PREV_CHAR_REG = /[>\(\~\,\+]/, removeUnusedStyleText = (e, t, r) => {
  32615. try {
  32616. const s = parseCss(r.innerHTML);
  32617. if (t.push(...s.diagnostics), hasError(t)) return;
  32618. try {
  32619. r.innerHTML = ((e, t) => {
  32620. const r = t.usedSelectors || null, s = {
  32621. usedSelectors: r || null,
  32622. hasUsedAttrs: !!r && r.attrs.size > 0,
  32623. hasUsedClassNames: !!r && r.classNames.size > 0,
  32624. hasUsedIds: !!r && r.ids.size > 0,
  32625. hasUsedTags: !!r && r.tags.size > 0
  32626. }, n = e.rules;
  32627. if (!n) return "";
  32628. const o = n.length, i = [];
  32629. for (let e = 0; e < o; e++) i.push(serializeCssVisitNode(s, n[e], e, o));
  32630. return i.join("");
  32631. })(s.stylesheet, {
  32632. usedSelectors: e
  32633. });
  32634. } catch (e) {
  32635. t.push({
  32636. level: "warn",
  32637. type: "css",
  32638. header: "CSS Stringify",
  32639. messageText: e
  32640. });
  32641. }
  32642. } catch (e) {
  32643. t.push({
  32644. level: "warn",
  32645. type: "css",
  32646. header: "CSS Parse",
  32647. messageText: e
  32648. });
  32649. }
  32650. };
  32651. exports.createWindowFromHtml = createWindowFromHtml;
  32652. exports.hydrateDocument = hydrateDocument;
  32653. exports.renderToString = renderToString;
  32654. exports.serializeDocumentToString = serializeDocumentToString;